aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-08-06 07:34:41 -0400
committerMark Brown <broonie@kernel.org>2015-08-06 07:34:41 -0400
commit113adf21cf1ed49b57098c1d0d6b38ffbe9ea1e6 (patch)
tree90505c4418561b98f773e5f7b549399e2868c239
parentc3879956957b8de9fd6cbad604e668fd00c6506c (diff)
parent996034b117b467709dec7811ef134063934fa626 (diff)
Merge tag 'asoc-fix-v4.2-rc3' into asoc-fix-topology
ASoC: Fixes for v4.2 A lot of small fixes here, a few to the core: - Fix for binding DAPM stream widgets on devices with prefixes assigned to them - Minor fixes for the newly added topology interfaces - Locking and memory leak fixes for DAPM - Driver specific fixes
-rw-r--r--.mailmap5
-rw-r--r--Documentation/ABI/testing/sysfs-bus-iio6
-rw-r--r--Documentation/DocBook/drm.tmpl2
-rw-r--r--Documentation/arm/SPEAr/overview.txt2
-rw-r--r--Documentation/device-mapper/cache.txt6
-rw-r--r--Documentation/device-mapper/thin-provisioning.txt9
-rw-r--r--Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt26
-rw-r--r--Documentation/devicetree/bindings/sound/mt8173-max98090.txt2
-rw-r--r--Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt2
-rw-r--r--Documentation/kbuild/makefiles.txt8
-rw-r--r--MAINTAINERS110
-rw-r--r--Makefile11
-rw-r--r--arch/Kconfig4
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/arc/Kconfig3
-rw-r--r--arch/arc/Makefile3
-rw-r--r--arch/arc/boot/dts/axc003.dtsi2
-rw-r--r--arch/arc/boot/dts/axc003_idu.dtsi2
-rw-r--r--arch/arc/include/asm/Kbuild1
-rw-r--r--arch/arc/include/asm/bitops.h35
-rw-r--r--arch/arc/include/asm/futex.h48
-rw-r--r--arch/arc/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/arc/include/asm/ptrace.h2
-rw-r--r--arch/arc/kernel/intc-arcv2.c1
-rw-r--r--arch/arc/kernel/intc-compact.c1
-rw-r--r--arch/arc/kernel/mcip.c23
-rw-r--r--arch/arc/kernel/setup.c15
-rw-r--r--arch/arc/kernel/troubleshoot.c1
-rw-r--r--arch/arc/mm/cache.c12
-rw-r--r--arch/arc/mm/dma.c4
-rw-r--r--arch/arm/boot/dts/am335x-pepper.dts16
-rw-r--r--arch/arm/boot/dts/cros-ec-keyboard.dtsi4
-rw-r--r--arch/arm/boot/dts/dra7-evm.dts5
-rw-r--r--arch/arm/boot/dts/dra72-evm.dts5
-rw-r--r--arch/arm/boot/dts/imx23.dtsi1
-rw-r--r--arch/arm/boot/dts/imx27.dtsi12
-rw-r--r--arch/arm/boot/dts/imx53-qsb-common.dtsi5
-rw-r--r--arch/arm/boot/dts/k2e.dtsi3
-rw-r--r--arch/arm/boot/dts/keystone.dtsi3
-rw-r--r--arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi2
-rw-r--r--arch/arm/boot/dts/omap4.dtsi2
-rw-r--r--arch/arm/boot/dts/omap5.dtsi2
-rw-r--r--arch/arm/boot/dts/socfpga_cyclone5_sockit.dts26
-rw-r--r--arch/arm/boot/dts/spear1310-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi2
-rw-r--r--arch/arm/boot/dts/spear1340-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi2
-rw-r--r--arch/arm/boot/dts/spear13xx.dtsi2
-rw-r--r--arch/arm/boot/dts/spear300-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear300.dtsi2
-rw-r--r--arch/arm/boot/dts/spear310-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear310.dtsi2
-rw-r--r--arch/arm/boot/dts/spear320-evb.dts2
-rw-r--r--arch/arm/boot/dts/spear320.dtsi2
-rw-r--r--arch/arm/boot/dts/spear3xx.dtsi2
-rw-r--r--arch/arm/boot/dts/ste-ccu8540.dts7
-rw-r--r--arch/arm/boot/dts/ste-ccu9540.dts7
-rw-r--r--arch/arm/boot/dts/ste-dbx5x0.dtsi6
-rw-r--r--arch/arm/boot/dts/ste-href.dtsi2
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60-stuib.dts7
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60-tvk.dts7
-rw-r--r--arch/arm/boot/dts/ste-hrefprev60.dtsi5
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus-stuib.dts7
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus-tvk.dts7
-rw-r--r--arch/arm/boot/dts/ste-hrefv60plus.dtsi25
-rw-r--r--arch/arm/boot/dts/ste-snowball.dts25
-rw-r--r--arch/arm/include/asm/Kbuild1
-rw-r--r--arch/arm/include/asm/memory.h2
-rw-r--r--arch/arm/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/arm/kernel/perf_event.c3
-rw-r--r--arch/arm/kernel/reboot.c2
-rw-r--r--arch/arm/mach-imx/gpc.c27
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-pxa/capc7117.c3
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c3
-rw-r--r--arch/arm/mach-pxa/cm-x300.c2
-rw-r--r--arch/arm/mach-pxa/colibri-pxa270.c3
-rw-r--r--arch/arm/mach-pxa/em-x270.c2
-rw-r--r--arch/arm/mach-pxa/icontrol.c3
-rw-r--r--arch/arm/mach-pxa/trizeps4.c3
-rw-r--r--arch/arm/mach-pxa/vpac270.c3
-rw-r--r--arch/arm/mach-pxa/zeus.c2
-rw-r--r--arch/arm/mach-spear/generic.h2
-rw-r--r--arch/arm/mach-spear/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-spear/include/mach/misc_regs.h2
-rw-r--r--arch/arm/mach-spear/include/mach/spear.h2
-rw-r--r--arch/arm/mach-spear/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-spear/pl080.c2
-rw-r--r--arch/arm/mach-spear/pl080.h2
-rw-r--r--arch/arm/mach-spear/restart.c2
-rw-r--r--arch/arm/mach-spear/spear1310.c2
-rw-r--r--arch/arm/mach-spear/spear1340.c2
-rw-r--r--arch/arm/mach-spear/spear13xx.c2
-rw-r--r--arch/arm/mach-spear/spear300.c2
-rw-r--r--arch/arm/mach-spear/spear310.c2
-rw-r--r--arch/arm/mach-spear/spear320.c2
-rw-r--r--arch/arm/mach-spear/spear3xx.c2
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm/mm/proc-v7.S14
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/avr32/include/asm/Kbuild1
-rw-r--r--arch/avr32/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/c6x/include/asm/Kbuild1
-rw-r--r--arch/c6x/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/cris/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/h8300/include/asm/Kbuild1
-rw-r--r--arch/hexagon/include/asm/Kbuild1
-rw-r--r--arch/hexagon/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/ia64/include/asm/Kbuild1
-rw-r--r--arch/ia64/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/m68k/Kconfig.cpu49
-rw-r--r--arch/m68k/configs/m5208evb_defconfig22
-rw-r--r--arch/m68k/configs/m5249evb_defconfig17
-rw-r--r--arch/m68k/configs/m5272c3_defconfig14
-rw-r--r--arch/m68k/configs/m5275evb_defconfig19
-rw-r--r--arch/m68k/configs/m5307c3_defconfig21
-rw-r--r--arch/m68k/configs/m5407c3_defconfig17
-rw-r--r--arch/m68k/configs/m5475evb_defconfig9
-rw-r--r--arch/m68k/include/asm/Kbuild1
-rw-r--r--arch/m68k/include/asm/coldfire.h2
-rw-r--r--arch/m68k/include/asm/io_mm.h3
-rw-r--r--arch/m68k/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/metag/include/asm/Kbuild1
-rw-r--r--arch/metag/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/mips/Kconfig6
-rw-r--r--arch/mips/Makefile7
-rw-r--r--arch/mips/include/asm/Kbuild1
-rw-r--r--arch/mips/include/asm/fpu.h2
-rw-r--r--arch/mips/include/asm/mach-sibyte/war.h3
-rw-r--r--arch/mips/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/mips/include/uapi/asm/sigcontext.h4
-rw-r--r--arch/mips/kernel/asm-offsets.c2
-rw-r--r--arch/mips/sibyte/Kconfig5
-rw-r--r--arch/mips/sibyte/common/bus_watcher.c5
-rw-r--r--arch/mips/sibyte/sb1250/setup.c2
-rw-r--r--arch/mn10300/include/asm/Kbuild1
-rw-r--r--arch/mn10300/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/nios2/include/asm/Kbuild1
-rw-r--r--arch/nios2/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/openrisc/Kconfig4
-rw-r--r--arch/openrisc/include/asm/Kbuild1
-rw-r--r--arch/openrisc/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/parisc/include/asm/Kbuild1
-rw-r--r--arch/parisc/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/parisc/include/asm/pgalloc.h3
-rw-r--r--arch/s390/include/asm/Kbuild1
-rw-r--r--arch/s390/include/asm/ctl_reg.h5
-rw-r--r--arch/s390/include/asm/hugetlb.h1
-rw-r--r--arch/s390/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/s390/include/asm/page.h8
-rw-r--r--arch/s390/include/asm/perf_event.h8
-rw-r--r--arch/s390/kernel/nmi.c51
-rw-r--r--arch/s390/kernel/process.c2
-rw-r--r--arch/s390/kernel/sclp.S4
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/s390/mm/pgtable.c2
-rw-r--r--arch/s390/oprofile/init.c1
-rw-r--r--arch/score/include/asm/Kbuild1
-rw-r--r--arch/score/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/sh/include/asm/Kbuild1
-rw-r--r--arch/sh/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/tile/include/asm/Kbuild1
-rw-r--r--arch/tile/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/um/include/asm/Kbuild1
-rw-r--r--arch/um/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/unicore32/include/asm/Kbuild1
-rw-r--r--arch/unicore32/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/Kconfig.debug12
-rw-r--r--arch/x86/entry/entry_64.S299
-rw-r--r--arch/x86/include/asm/Kbuild1
-rw-r--r--arch/x86/include/asm/fpu/types.h72
-rw-r--r--arch/x86/include/asm/intel_pmc_ipc.h27
-rw-r--r--arch/x86/include/asm/kvm_host.h2
-rw-r--r--arch/x86/include/asm/mm-arch-hooks.h15
-rw-r--r--arch/x86/include/asm/mmu_context.h2
-rw-r--r--arch/x86/include/asm/processor.h10
-rw-r--r--arch/x86/include/uapi/asm/hyperv.h2
-rw-r--r--arch/x86/kernel/fpu/init.c40
-rw-r--r--arch/x86/kernel/nmi.c123
-rw-r--r--arch/x86/kernel/process.c2
-rw-r--r--arch/x86/kernel/smpboot.c11
-rw-r--r--arch/x86/kvm/cpuid.c2
-rw-r--r--arch/x86/kvm/iommu.c2
-rw-r--r--arch/x86/kvm/mmu.c10
-rw-r--r--arch/x86/kvm/svm.c108
-rw-r--r--arch/x86/kvm/vmx.c11
-rw-r--r--arch/x86/kvm/x86.c26
-rw-r--r--arch/xtensa/include/asm/Kbuild1
-rw-r--r--arch/xtensa/include/asm/mm-arch-hooks.h15
-rw-r--r--block/bio-integrity.c4
-rw-r--r--block/blk-cgroup.c140
-rw-r--r--block/blk-core.c2
-rw-r--r--block/blk-mq.c2
-rw-r--r--drivers/acpi/resource.c24
-rw-r--r--drivers/ata/pata_arasan_cf.c4
-rw-r--r--drivers/block/nvme-core.c13
-rw-r--r--drivers/char/tpm/tpm-chip.c3
-rw-r--r--drivers/char/tpm/tpm_crb.c8
-rw-r--r--drivers/clk/spear/clk-aux-synth.c2
-rw-r--r--drivers/clk/spear/clk-frac-synth.c2
-rw-r--r--drivers/clk/spear/clk-gpt-synth.c2
-rw-r--r--drivers/clk/spear/clk-vco-pll.c2
-rw-r--r--drivers/clk/spear/clk.c2
-rw-r--r--drivers/clk/spear/clk.h2
-rw-r--r--drivers/clk/spear/spear1310_clock.c2
-rw-r--r--drivers/clk/spear/spear1340_clock.c2
-rw-r--r--drivers/clk/spear/spear3xx_clock.c2
-rw-r--r--drivers/clk/spear/spear6xx_clock.c2
-rw-r--r--drivers/cpufreq/cpufreq.c10
-rw-r--r--drivers/cpufreq/freq_table.c9
-rw-r--r--drivers/cpuidle/cpuidle.c9
-rw-r--r--drivers/crypto/nx/nx-aes-ccm.c6
-rw-r--r--drivers/crypto/nx/nx-aes-ctr.c7
-rw-r--r--drivers/crypto/nx/nx-aes-gcm.c17
-rw-r--r--drivers/crypto/nx/nx-aes-xcbc.c70
-rw-r--r--drivers/crypto/nx/nx-sha256.c43
-rw-r--r--drivers/crypto/nx/nx-sha512.c44
-rw-r--r--drivers/crypto/nx/nx.c3
-rw-r--r--drivers/crypto/nx/nx.h14
-rw-r--r--drivers/crypto/omap-des.c3
-rw-r--r--drivers/dma/dw/core.c2
-rw-r--r--drivers/gpio/gpio-brcmstb.c14
-rw-r--r--drivers/gpio/gpio-davinci.c6
-rw-r--r--drivers/gpio/gpio-max732x.c1
-rw-r--r--drivers/gpio/gpio-omap.c5
-rw-r--r--drivers/gpio/gpio-pca953x.c4
-rw-r--r--drivers/gpio/gpio-xilinx.c4
-rw-r--r--drivers/gpio/gpio-zynq.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c19
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_dpm.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c35
-rw-r--r--drivers/gpu/drm/armada/armada_crtc.c2
-rw-r--r--drivers/gpu/drm/armada/armada_gem.c5
-rw-r--r--drivers/gpu/drm/armada/armada_overlay.c121
-rw-r--r--drivers/gpu/drm/drm_crtc.c7
-rw-r--r--drivers/gpu/drm/drm_ioc32.c60
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h6
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c35
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c4
-rw-r--r--drivers/gpu/drm/i915/i915_gem_dmabuf.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.c9
-rw-r--r--drivers/gpu/drm/i915/i915_gem_stolen.c1
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c12
-rw-r--r--drivers/gpu/drm/i915/i915_gem_userptr.c29
-rw-r--r--drivers/gpu/drm/i915/i915_ioc32.c2
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c13
-rw-r--r--drivers/gpu/drm/i915/i915_trace.h2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c8
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h7
-rw-r--r--drivers/gpu/drm/imx/imx-tve.c2
-rw-r--r--drivers/gpu/drm/imx/parallel-display.c21
-rw-r--r--drivers/gpu/drm/radeon/ci_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c1
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c1
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_drv.c1
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_fb.c3
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_gem.c67
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_vop.c49
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc_dma.c13
-rw-r--r--drivers/gpu/ipu-v3/ipu-common.c3
-rw-r--r--drivers/iio/accel/bmc150-accel.c2
-rw-r--r--drivers/iio/adc/Kconfig3
-rw-r--r--drivers/iio/adc/at91_adc.c8
-rw-r--r--drivers/iio/adc/rockchip_saradc.c4
-rw-r--r--drivers/iio/adc/twl4030-madc.c3
-rw-r--r--drivers/iio/common/hid-sensors/hid-sensor-trigger.c11
-rw-r--r--drivers/iio/dac/ad5624r_spi.c4
-rw-r--r--drivers/iio/imu/inv_mpu6050/inv_mpu_core.c18
-rw-r--r--drivers/iio/light/Kconfig2
-rw-r--r--drivers/iio/light/cm3323.c2
-rw-r--r--drivers/iio/light/ltr501.c2
-rw-r--r--drivers/iio/light/stk3310.c53
-rw-r--r--drivers/iio/light/tcs3414.c2
-rw-r--r--drivers/iio/magnetometer/mmc35240.c35
-rw-r--r--drivers/iio/proximity/sx9500.c28
-rw-r--r--drivers/iio/temperature/tmp006.c3
-rw-r--r--drivers/infiniband/core/agent.c4
-rw-r--r--drivers/infiniband/core/cm.c61
-rw-r--r--drivers/infiniband/core/iwpm_msg.c33
-rw-r--r--drivers/infiniband/core/iwpm_util.c12
-rw-r--r--drivers/infiniband/core/iwpm_util.h28
-rw-r--r--drivers/infiniband/core/mad.c47
-rw-r--r--drivers/infiniband/core/multicast.c8
-rw-r--r--drivers/infiniband/core/opa_smi.h4
-rw-r--r--drivers/infiniband/core/sa_query.c8
-rw-r--r--drivers/infiniband/core/smi.c37
-rw-r--r--drivers/infiniband/core/smi.h4
-rw-r--r--drivers/infiniband/core/sysfs.c2
-rw-r--r--drivers/infiniband/core/ucm.c4
-rw-r--r--drivers/infiniband/core/ucma.c5
-rw-r--r--drivers/infiniband/hw/ehca/ehca_sqp.c5
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c5
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c4
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c34
-rw-r--r--drivers/infiniband/hw/mlx4/main.c33
-rw-r--r--drivers/infiniband/hw/mlx5/mad.c5
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mad.c5
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c5
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c2
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_ah.c5
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_main.c1
-rw-r--r--drivers/infiniband/hw/qib/qib_mad.c5
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h29
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c33
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c49
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c21
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c23
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c71
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c111
-rw-r--r--drivers/irqchip/spear-shirq.c2
-rw-r--r--drivers/md/bcache/closure.h3
-rw-r--r--drivers/md/bcache/io.c1
-rw-r--r--drivers/md/bcache/journal.c2
-rw-r--r--drivers/md/bcache/request.c14
-rw-r--r--drivers/md/dm-cache-target.c38
-rw-r--r--drivers/md/dm-thin.c44
-rw-r--r--drivers/md/dm.c12
-rw-r--r--drivers/md/persistent-data/dm-btree-remove.c6
-rw-r--r--drivers/md/persistent-data/dm-btree.c2
-rw-r--r--drivers/mfd/stmpe-i2c.c2
-rw-r--r--drivers/mfd/stmpe-spi.c4
-rw-r--r--drivers/mmc/host/sdhci-spear.c4
-rw-r--r--drivers/net/bonding/bond_main.c51
-rw-r--r--drivers/net/can/c_can/c_can.c10
-rw-r--r--drivers/net/can/dev.c7
-rw-r--r--drivers/net/can/rcar_can.c16
-rw-r--r--drivers/net/can/slcan.c2
-rw-r--r--drivers/net/can/vcan.c3
-rw-r--r--drivers/net/ethernet/3com/3c59x.c4
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-desc.c3
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-dev.c11
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe-drv.c17
-rw-r--r--drivers/net/ethernet/amd/xgbe/xgbe.h3
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c2
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c4
-rw-r--r--drivers/net/ethernet/broadcom/sb1250-mac.c9
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c25
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c4
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c88
-rw-r--r--drivers/net/ethernet/sfc/ef10.c172
-rw-r--r--drivers/net/ethernet/sfc/ef10_sriov.c59
-rw-r--r--drivers/net/ethernet/sfc/ef10_sriov.h6
-rw-r--r--drivers/net/ethernet/sfc/efx.c14
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h2
-rw-r--r--drivers/net/ethernet/sfc/tx.c3
-rw-r--r--drivers/net/ethernet/ti/cpsw.c25
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c8
-rw-r--r--drivers/net/hamradio/bpqether.c1
-rw-r--r--drivers/net/macvtap.c1
-rw-r--r--drivers/net/phy/Kconfig2
-rw-r--r--drivers/net/usb/cdc_ether.c8
-rw-r--r--drivers/net/usb/cdc_mbim.c2
-rw-r--r--drivers/net/usb/cdc_ncm.c63
-rw-r--r--drivers/net/usb/huawei_cdc_ncm.c7
-rw-r--r--drivers/net/usb/r8152.c2
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c8
-rw-r--r--drivers/net/wan/z85230.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.h2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1310.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear1340.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear300.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear310.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear320.c4
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear3xx.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear3xx.h2
-rw-r--r--drivers/platform/x86/dell-laptop.c171
-rw-r--r--drivers/platform/x86/intel_pmc_ipc.c83
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c6
-rw-r--r--drivers/rtc/rtc-armada38x.c2
-rw-r--r--drivers/rtc/rtc-mt6397.c4
-rw-r--r--drivers/s390/block/dasd.c36
-rw-r--r--drivers/s390/block/dasd_alias.c3
-rw-r--r--drivers/s390/char/sclp_early.c1
-rw-r--r--drivers/s390/crypto/zcrypt_api.c7
-rw-r--r--drivers/scsi/scsi_sysfs.c2
-rw-r--r--drivers/scsi/scsi_transport_srp.c3
-rw-r--r--drivers/scsi/st.c2
-rw-r--r--drivers/staging/board/Kconfig2
-rw-r--r--drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h1
-rw-r--r--drivers/staging/vt6655/device_main.c2
-rw-r--r--drivers/staging/vt6656/main_usb.c2
-rw-r--r--drivers/usb/dwc2/core.c55
-rw-r--r--drivers/usb/dwc2/core.h9
-rw-r--r--drivers/usb/dwc2/hcd.c55
-rw-r--r--drivers/usb/dwc2/hcd.h5
-rw-r--r--drivers/usb/dwc2/hcd_queue.c49
-rw-r--r--drivers/usb/dwc3/core.c6
-rw-r--r--drivers/usb/gadget/composite.c11
-rw-r--r--drivers/usb/gadget/configfs.c2
-rw-r--r--drivers/usb/gadget/function/f_fs.c6
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c16
-rw-r--r--drivers/usb/gadget/function/f_midi.c4
-rw-r--r--drivers/usb/gadget/udc/fotg210-udc.c3
-rw-r--r--drivers/usb/musb/musb_virthub.c4
-rw-r--r--drivers/usb/phy/phy-mxs-usb.c3
-rw-r--r--drivers/usb/serial/cp210x.c1
-rw-r--r--drivers/usb/serial/mos7720.c253
-rw-r--r--drivers/usb/serial/option.c1
-rw-r--r--drivers/usb/serial/usb-serial.c1
-rw-r--r--drivers/watchdog/sp805_wdt.c4
-rw-r--r--fs/btrfs/extent-tree.c13
-rw-r--r--fs/btrfs/inode.c5
-rw-r--r--fs/btrfs/ioctl.c18
-rw-r--r--fs/btrfs/transaction.c4
-rw-r--r--fs/configfs/item.c4
-rw-r--r--fs/jfs/file.c2
-rw-r--r--fs/jfs/inode.c4
-rw-r--r--fs/jfs/namei.c27
-rw-r--r--fs/locks.c38
-rw-r--r--fs/nfs/nfs4proc.c18
-rw-r--r--fs/notify/mark.c34
-rw-r--r--fs/proc/Kconfig6
-rw-r--r--fs/proc/base.c5
-rw-r--r--fs/proc/kcore.c4
-rw-r--r--include/asm-generic/mm-arch-hooks.h16
-rw-r--r--include/linux/amba/sp810.h2
-rw-r--r--include/linux/blk-cgroup.h11
-rw-r--r--include/linux/can/skb.h2
-rw-r--r--include/linux/clkdev.h7
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/configfs.h3
-rw-r--r--include/linux/cpu.h7
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/fs.h30
-rw-r--r--include/linux/gpio/driver.h2
-rw-r--r--include/linux/hid-sensor-hub.h1
-rw-r--r--include/linux/hugetlb.h17
-rw-r--r--include/linux/init.h78
-rw-r--r--include/linux/iommu.h2
-rw-r--r--include/linux/kernel.h9
-rw-r--r--include/linux/kobject.h5
-rw-r--r--include/linux/kvm_host.h18
-rw-r--r--include/linux/mmiotrace.h2
-rw-r--r--include/linux/module.h84
-rw-r--r--include/linux/page_owner.h13
-rw-r--r--include/linux/pata_arasan_cf_data.h2
-rw-r--r--include/linux/printk.h6
-rw-r--r--include/linux/sched.h16
-rw-r--r--include/linux/usb/cdc_ncm.h7
-rw-r--r--include/rdma/ib_verbs.h20
-rw-r--r--include/scsi/scsi_transport_srp.h1
-rw-r--r--include/uapi/linux/netconf.h1
-rw-r--r--include/uapi/sound/asoc.h4
-rw-r--r--kernel/cpu.c9
-rw-r--r--kernel/fork.c7
-rw-r--r--kernel/irq/resend.c18
-rw-r--r--kernel/sched/fair.c2
-rw-r--r--kernel/time/tick-broadcast.c1
-rw-r--r--kernel/time/tick-common.c1
-rw-r--r--kernel/trace/trace.h1
-rw-r--r--kernel/trace/trace_branch.c17
-rw-r--r--lib/decompress.c5
-rw-r--r--lib/dma-debug.c3
-rw-r--r--lib/hexdump.c7
-rw-r--r--lib/kobject.c5
-rw-r--r--lib/rhashtable.c4
-rw-r--r--mm/cma_debug.c11
-rw-r--r--mm/page_alloc.c14
-rw-r--r--mm/page_owner.c7
-rw-r--r--net/bridge/br_forward.c1
-rw-r--r--net/bridge/br_mdb.c16
-rw-r--r--net/bridge/br_netfilter_hooks.c16
-rw-r--r--net/bridge/br_netfilter_ipv6.c2
-rw-r--r--net/bridge/br_netlink.c2
-rw-r--r--net/can/af_can.c12
-rw-r--r--net/can/bcm.c2
-rw-r--r--net/can/raw.c7
-rw-r--r--net/core/dev.c45
-rw-r--r--net/core/gen_estimator.c13
-rw-r--r--net/core/pktgen.c9
-rw-r--r--net/core/rtnetlink.c187
-rw-r--r--net/dsa/dsa.c6
-rw-r--r--net/ipv4/devinet.c13
-rw-r--r--net/ipv4/inet_diag.c4
-rw-r--r--net/ipv4/ip_tunnel.c8
-rw-r--r--net/ipv4/netfilter/arp_tables.c25
-rw-r--r--net/ipv6/ip6_input.c6
-rw-r--r--net/ipv6/route.c5
-rw-r--r--net/netfilter/nf_queue.c2
-rw-r--r--net/netfilter/nfnetlink.c38
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/rds/ib_rdma.c4
-rw-r--r--net/rds/transport.c2
-rw-r--r--net/switchdev/switchdev.c12
-rw-r--r--net/tipc/socket.c1
-rwxr-xr-xscripts/checkpatch.pl2
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c55
-rw-r--r--sound/soc/codecs/pcm1681.c2
-rw-r--r--sound/soc/codecs/rt5645.c3
-rw-r--r--sound/soc/codecs/sgtl5000.h2
-rw-r--r--sound/soc/codecs/ssm4567.c8
-rw-r--r--sound/soc/fsl/fsl_ssi.c2
-rw-r--r--sound/soc/intel/Makefile2
-rw-r--r--sound/soc/intel/atom/sst/sst_drv_interface.c14
-rw-r--r--sound/soc/intel/boards/cht_bsw_max98090_ti.c4
-rw-r--r--sound/soc/mediatek/mt8173-max98090.c17
-rw-r--r--sound/soc/mediatek/mt8173-rt5650-rt5676.c19
-rw-r--r--sound/soc/mediatek/mtk-afe-pcm.c2
-rw-r--r--sound/soc/soc-core.c1
-rw-r--r--sound/soc/soc-dapm.c35
-rw-r--r--sound/soc/soc-topology.c23
-rw-r--r--sound/soc/zte/zx296702-i2s.c4
-rw-r--r--sound/soc/zte/zx296702-spdif.c4
-rw-r--r--sound/usb/line6/pcm.c9
-rw-r--r--sound/usb/quirks-table.h68
-rw-r--r--tools/lib/api/Makefile2
-rw-r--r--tools/lib/hweight.c62
-rw-r--r--tools/lib/traceevent/Makefile2
-rw-r--r--tools/perf/MANIFEST2
-rw-r--r--tools/perf/Makefile.perf19
-rw-r--r--tools/perf/builtin-stat.c4
-rw-r--r--tools/perf/ui/browsers/hists.c2
-rw-r--r--tools/perf/util/Build2
-rw-r--r--tools/perf/util/auxtrace.c10
-rw-r--r--tools/perf/util/python-ext-sources4
-rw-r--r--tools/perf/util/symbol.c2
-rw-r--r--tools/perf/util/symbol.h3
-rw-r--r--tools/perf/util/thread_map.c3
-rw-r--r--tools/perf/util/vdso.c8
-rw-r--r--virt/kvm/vfio.c5
544 files changed, 4296 insertions, 3013 deletions
diff --git a/.mailmap b/.mailmap
index 977f958eedbe..b4091b7a78fe 100644
--- a/.mailmap
+++ b/.mailmap
@@ -116,6 +116,7 @@ Shiraz Hashim <shiraz.linux.kernel@gmail.com> <shiraz.hashim@st.com>
116Simon Kelley <simon@thekelleys.org.uk> 116Simon Kelley <simon@thekelleys.org.uk>
117Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr> 117Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
118Stephen Hemminger <shemminger@osdl.org> 118Stephen Hemminger <shemminger@osdl.org>
119Sudeep Holla <sudeep.holla@arm.com> Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
119Sumit Semwal <sumit.semwal@ti.com> 120Sumit Semwal <sumit.semwal@ti.com>
120Tejun Heo <htejun@gmail.com> 121Tejun Heo <htejun@gmail.com>
121Thomas Graf <tgraf@suug.ch> 122Thomas Graf <tgraf@suug.ch>
@@ -125,7 +126,9 @@ Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
125Uwe Kleine-König <ukl@pengutronix.de> 126Uwe Kleine-König <ukl@pengutronix.de>
126Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com> 127Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
127Valdis Kletnieks <Valdis.Kletnieks@vt.edu> 128Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
128Viresh Kumar <viresh.linux@gmail.com> <viresh.kumar@st.com> 129Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com>
130Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com>
131Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com>
129Takashi YOSHII <takashi.yoshii.zj@renesas.com> 132Takashi YOSHII <takashi.yoshii.zj@renesas.com>
130Yusuke Goda <goda.yusuke@renesas.com> 133Yusuke Goda <goda.yusuke@renesas.com>
131Gustavo Padovan <gustavo@las.ic.unicamp.br> 134Gustavo Padovan <gustavo@las.ic.unicamp.br>
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index bbed111c31b4..70c9b1ac66db 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -1234,10 +1234,8 @@ Description:
1234 object is near the sensor, usually be observing 1234 object is near the sensor, usually be observing
1235 reflectivity of infrared or ultrasound emitted. 1235 reflectivity of infrared or ultrasound emitted.
1236 Often these sensors are unit less and as such conversion 1236 Often these sensors are unit less and as such conversion
1237 to SI units is not possible. Where it is, the units should 1237 to SI units is not possible. Higher proximity measurements
1238 be meters. If such a conversion is not possible, the reported 1238 indicate closer objects, and vice versa.
1239 values should behave in the same way as a distance, i.e. lower
1240 values indicate something is closer to the sensor.
1241 1239
1242What: /sys/.../iio:deviceX/in_illuminance_input 1240What: /sys/.../iio:deviceX/in_illuminance_input
1243What: /sys/.../iio:deviceX/in_illuminance_raw 1241What: /sys/.../iio:deviceX/in_illuminance_raw
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index c0312cbd023d..2fb9a5457522 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -3383,7 +3383,7 @@ void intel_crt_init(struct drm_device *dev)
3383 <td valign="top" >TBD</td> 3383 <td valign="top" >TBD</td>
3384 </tr> 3384 </tr>
3385 <tr> 3385 <tr>
3386 <td rowspan="2" valign="top" >omap</td> 3386 <td valign="top" >omap</td>
3387 <td valign="top" >Generic</td> 3387 <td valign="top" >Generic</td>
3388 <td valign="top" >“zorder”</td> 3388 <td valign="top" >“zorder”</td>
3389 <td valign="top" >RANGE</td> 3389 <td valign="top" >RANGE</td>
diff --git a/Documentation/arm/SPEAr/overview.txt b/Documentation/arm/SPEAr/overview.txt
index 65610bf52ebf..1b049be6c84f 100644
--- a/Documentation/arm/SPEAr/overview.txt
+++ b/Documentation/arm/SPEAr/overview.txt
@@ -60,4 +60,4 @@ Introduction
60 Document Author 60 Document Author
61 --------------- 61 ---------------
62 62
63 Viresh Kumar <viresh.linux@gmail.com>, (c) 2010-2012 ST Microelectronics 63 Viresh Kumar <vireshk@kernel.org>, (c) 2010-2012 ST Microelectronics
diff --git a/Documentation/device-mapper/cache.txt b/Documentation/device-mapper/cache.txt
index 82960cffbad3..785eab87aa71 100644
--- a/Documentation/device-mapper/cache.txt
+++ b/Documentation/device-mapper/cache.txt
@@ -258,6 +258,12 @@ cache metadata mode : ro if read-only, rw if read-write
258 no further I/O will be permitted and the status will just 258 no further I/O will be permitted and the status will just
259 contain the string 'Fail'. The userspace recovery tools 259 contain the string 'Fail'. The userspace recovery tools
260 should then be used. 260 should then be used.
261needs_check : 'needs_check' if set, '-' if not set
262 A metadata operation has failed, resulting in the needs_check
263 flag being set in the metadata's superblock. The metadata
264 device must be deactivated and checked/repaired before the
265 cache can be made fully operational again. '-' indicates
266 needs_check is not set.
261 267
262Messages 268Messages
263-------- 269--------
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt
index 4f67578b2954..1699a55b7b70 100644
--- a/Documentation/device-mapper/thin-provisioning.txt
+++ b/Documentation/device-mapper/thin-provisioning.txt
@@ -296,7 +296,7 @@ ii) Status
296 underlying device. When this is enabled when loading the table, 296 underlying device. When this is enabled when loading the table,
297 it can get disabled if the underlying device doesn't support it. 297 it can get disabled if the underlying device doesn't support it.
298 298
299 ro|rw 299 ro|rw|out_of_data_space
300 If the pool encounters certain types of device failures it will 300 If the pool encounters certain types of device failures it will
301 drop into a read-only metadata mode in which no changes to 301 drop into a read-only metadata mode in which no changes to
302 the pool metadata (like allocating new blocks) are permitted. 302 the pool metadata (like allocating new blocks) are permitted.
@@ -314,6 +314,13 @@ ii) Status
314 module parameter can be used to change this timeout -- it 314 module parameter can be used to change this timeout -- it
315 defaults to 60 seconds but may be disabled using a value of 0. 315 defaults to 60 seconds but may be disabled using a value of 0.
316 316
317 needs_check
318 A metadata operation has failed, resulting in the needs_check
319 flag being set in the metadata's superblock. The metadata
320 device must be deactivated and checked/repaired before the
321 thin-pool can be made fully operational again. '-' indicates
322 needs_check is not set.
323
317iii) Messages 324iii) Messages
318 325
319 create_thin <dev id> 326 create_thin <dev id>
diff --git a/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt
index e75f0e549fff..971c3eedb1c7 100644
--- a/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt
+++ b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt
@@ -65,8 +65,10 @@ Optional properties:
65- edid: verbatim EDID data block describing attached display. 65- edid: verbatim EDID data block describing attached display.
66- ddc: phandle describing the i2c bus handling the display data 66- ddc: phandle describing the i2c bus handling the display data
67 channel 67 channel
68- port: A port node with endpoint definitions as defined in 68- port@[0-1]: Port nodes with endpoint definitions as defined in
69 Documentation/devicetree/bindings/media/video-interfaces.txt. 69 Documentation/devicetree/bindings/media/video-interfaces.txt.
70 Port 0 is the input port connected to the IPU display interface,
71 port 1 is the output port connected to a panel.
70 72
71example: 73example:
72 74
@@ -75,9 +77,29 @@ display@di0 {
75 edid = [edid-data]; 77 edid = [edid-data];
76 interface-pix-fmt = "rgb24"; 78 interface-pix-fmt = "rgb24";
77 79
78 port { 80 port@0 {
81 reg = <0>;
82
79 display_in: endpoint { 83 display_in: endpoint {
80 remote-endpoint = <&ipu_di0_disp0>; 84 remote-endpoint = <&ipu_di0_disp0>;
81 }; 85 };
82 }; 86 };
87
88 port@1 {
89 reg = <1>;
90
91 display_out: endpoint {
92 remote-endpoint = <&panel_in>;
93 };
94 };
95};
96
97panel {
98 ...
99
100 port {
101 panel_in: endpoint {
102 remote-endpoint = <&display_out>;
103 };
104 };
83}; 105};
diff --git a/Documentation/devicetree/bindings/sound/mt8173-max98090.txt b/Documentation/devicetree/bindings/sound/mt8173-max98090.txt
index 829bd26d17f8..519e97c8f1b8 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-max98090.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-max98090.txt
@@ -3,11 +3,13 @@ MT8173 with MAX98090 CODEC
3Required properties: 3Required properties:
4- compatible : "mediatek,mt8173-max98090" 4- compatible : "mediatek,mt8173-max98090"
5- mediatek,audio-codec: the phandle of the MAX98090 audio codec 5- mediatek,audio-codec: the phandle of the MAX98090 audio codec
6- mediatek,platform: the phandle of MT8173 ASoC platform
6 7
7Example: 8Example:
8 9
9 sound { 10 sound {
10 compatible = "mediatek,mt8173-max98090"; 11 compatible = "mediatek,mt8173-max98090";
11 mediatek,audio-codec = <&max98090>; 12 mediatek,audio-codec = <&max98090>;
13 mediatek,platform = <&afe>;
12 }; 14 };
13 15
diff --git a/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt b/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt
index 61e98c976bd4..f205ce9e31dd 100644
--- a/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt
+++ b/Documentation/devicetree/bindings/sound/mt8173-rt5650-rt5676.txt
@@ -3,11 +3,13 @@ MT8173 with RT5650 RT5676 CODECS
3Required properties: 3Required properties:
4- compatible : "mediatek,mt8173-rt5650-rt5676" 4- compatible : "mediatek,mt8173-rt5650-rt5676"
5- mediatek,audio-codec: the phandles of rt5650 and rt5676 codecs 5- mediatek,audio-codec: the phandles of rt5650 and rt5676 codecs
6- mediatek,platform: the phandle of MT8173 ASoC platform
6 7
7Example: 8Example:
8 9
9 sound { 10 sound {
10 compatible = "mediatek,mt8173-rt5650-rt5676"; 11 compatible = "mediatek,mt8173-rt5650-rt5676";
11 mediatek,audio-codec = <&rt5650 &rt5676>; 12 mediatek,audio-codec = <&rt5650 &rt5676>;
13 mediatek,platform = <&afe>;
12 }; 14 };
13 15
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index e63b446d973c..13f888a02a3d 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -952,6 +952,14 @@ When kbuild executes, the following steps are followed (roughly):
952 $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic 952 $(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
953 mode) if this option is supported by $(AR). 953 mode) if this option is supported by $(AR).
954 954
955 ARCH_CPPFLAGS, ARCH_AFLAGS, ARCH_CFLAGS Overrides the kbuild defaults
956
957 These variables are appended to the KBUILD_CPPFLAGS,
958 KBUILD_AFLAGS, and KBUILD_CFLAGS, respectively, after the
959 top-level Makefile has set any other flags. This provides a
960 means for an architecture to override the defaults.
961
962
955--- 6.2 Add prerequisites to archheaders: 963--- 6.2 Add prerequisites to archheaders:
956 964
957 The archheaders: rule is used to generate header files that 965 The archheaders: rule is used to generate header files that
diff --git a/MAINTAINERS b/MAINTAINERS
index fd6078443083..a2264167791a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -361,11 +361,11 @@ S: Supported
361F: drivers/input/touchscreen/ad7879.c 361F: drivers/input/touchscreen/ad7879.c
362 362
363ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR) 363ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR)
364M: Jiri Kosina <jkosina@suse.cz> 364M: Jiri Kosina <jkosina@suse.com>
365S: Maintained 365S: Maintained
366 366
367ADM1025 HARDWARE MONITOR DRIVER 367ADM1025 HARDWARE MONITOR DRIVER
368M: Jean Delvare <jdelvare@suse.de> 368M: Jean Delvare <jdelvare@suse.com>
369L: lm-sensors@lm-sensors.org 369L: lm-sensors@lm-sensors.org
370S: Maintained 370S: Maintained
371F: Documentation/hwmon/adm1025 371F: Documentation/hwmon/adm1025
@@ -430,7 +430,7 @@ S: Maintained
430F: drivers/macintosh/therm_adt746x.c 430F: drivers/macintosh/therm_adt746x.c
431 431
432ADT7475 HARDWARE MONITOR DRIVER 432ADT7475 HARDWARE MONITOR DRIVER
433M: Jean Delvare <jdelvare@suse.de> 433M: Jean Delvare <jdelvare@suse.com>
434L: lm-sensors@lm-sensors.org 434L: lm-sensors@lm-sensors.org
435S: Maintained 435S: Maintained
436F: Documentation/hwmon/adt7475 436F: Documentation/hwmon/adt7475
@@ -445,7 +445,7 @@ F: drivers/input/misc/adxl34x.c
445 445
446ADVANSYS SCSI DRIVER 446ADVANSYS SCSI DRIVER
447M: Matthew Wilcox <matthew@wil.cx> 447M: Matthew Wilcox <matthew@wil.cx>
448M: Hannes Reinecke <hare@suse.de> 448M: Hannes Reinecke <hare@suse.com>
449L: linux-scsi@vger.kernel.org 449L: linux-scsi@vger.kernel.org
450S: Maintained 450S: Maintained
451F: Documentation/scsi/advansys.txt 451F: Documentation/scsi/advansys.txt
@@ -506,7 +506,7 @@ F: drivers/scsi/aha152x*
506F: drivers/scsi/pcmcia/aha152x* 506F: drivers/scsi/pcmcia/aha152x*
507 507
508AIC7XXX / AIC79XX SCSI DRIVER 508AIC7XXX / AIC79XX SCSI DRIVER
509M: Hannes Reinecke <hare@suse.de> 509M: Hannes Reinecke <hare@suse.com>
510L: linux-scsi@vger.kernel.org 510L: linux-scsi@vger.kernel.org
511S: Maintained 511S: Maintained
512F: drivers/scsi/aic7xxx/ 512F: drivers/scsi/aic7xxx/
@@ -746,7 +746,7 @@ S: Maintained
746F: sound/aoa/ 746F: sound/aoa/
747 747
748APM DRIVER 748APM DRIVER
749M: Jiri Kosina <jkosina@suse.cz> 749M: Jiri Kosina <jkosina@suse.com>
750S: Odd fixes 750S: Odd fixes
751F: arch/x86/kernel/apm_32.c 751F: arch/x86/kernel/apm_32.c
752F: include/linux/apm_bios.h 752F: include/linux/apm_bios.h
@@ -1001,6 +1001,7 @@ ARM/CONEXANT DIGICOLOR MACHINE SUPPORT
1001M: Baruch Siach <baruch@tkos.co.il> 1001M: Baruch Siach <baruch@tkos.co.il>
1002L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1002L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1003S: Maintained 1003S: Maintained
1004F: arch/arm/boot/dts/cx92755*
1004N: digicolor 1005N: digicolor
1005 1006
1006ARM/EBSA110 MACHINE SUPPORT 1007ARM/EBSA110 MACHINE SUPPORT
@@ -1324,7 +1325,7 @@ F: arch/arm/mach-pxa/include/mach/palmtc.h
1324F: arch/arm/mach-pxa/palmtc.c 1325F: arch/arm/mach-pxa/palmtc.c
1325 1326
1326ARM/PALM TREO SUPPORT 1327ARM/PALM TREO SUPPORT
1327M: Tomas Cech <sleep_walker@suse.cz> 1328M: Tomas Cech <sleep_walker@suse.com>
1328L: linux-arm-kernel@lists.infradead.org 1329L: linux-arm-kernel@lists.infradead.org
1329W: http://hackndev.com 1330W: http://hackndev.com
1330S: Maintained 1331S: Maintained
@@ -2405,7 +2406,7 @@ F: drivers/gpio/gpio-bt8xx.c
2405BTRFS FILE SYSTEM 2406BTRFS FILE SYSTEM
2406M: Chris Mason <clm@fb.com> 2407M: Chris Mason <clm@fb.com>
2407M: Josef Bacik <jbacik@fb.com> 2408M: Josef Bacik <jbacik@fb.com>
2408M: David Sterba <dsterba@suse.cz> 2409M: David Sterba <dsterba@suse.com>
2409L: linux-btrfs@vger.kernel.org 2410L: linux-btrfs@vger.kernel.org
2410W: http://btrfs.wiki.kernel.org/ 2411W: http://btrfs.wiki.kernel.org/
2411Q: http://patchwork.kernel.org/project/linux-btrfs/list/ 2412Q: http://patchwork.kernel.org/project/linux-btrfs/list/
@@ -2748,7 +2749,7 @@ COCCINELLE/Semantic Patches (SmPL)
2748M: Julia Lawall <Julia.Lawall@lip6.fr> 2749M: Julia Lawall <Julia.Lawall@lip6.fr>
2749M: Gilles Muller <Gilles.Muller@lip6.fr> 2750M: Gilles Muller <Gilles.Muller@lip6.fr>
2750M: Nicolas Palix <nicolas.palix@imag.fr> 2751M: Nicolas Palix <nicolas.palix@imag.fr>
2751M: Michal Marek <mmarek@suse.cz> 2752M: Michal Marek <mmarek@suse.com>
2752L: cocci@systeme.lip6.fr (moderated for non-subscribers) 2753L: cocci@systeme.lip6.fr (moderated for non-subscribers)
2753T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git misc 2754T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git misc
2754W: http://coccinelle.lip6.fr/ 2755W: http://coccinelle.lip6.fr/
@@ -2864,7 +2865,7 @@ F: kernel/cpuset.c
2864 2865
2865CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG) 2866CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)
2866M: Johannes Weiner <hannes@cmpxchg.org> 2867M: Johannes Weiner <hannes@cmpxchg.org>
2867M: Michal Hocko <mhocko@suse.cz> 2868M: Michal Hocko <mhocko@kernel.org>
2868L: cgroups@vger.kernel.org 2869L: cgroups@vger.kernel.org
2869L: linux-mm@kvack.org 2870L: linux-mm@kvack.org
2870S: Maintained 2871S: Maintained
@@ -2945,7 +2946,7 @@ F: arch/x86/kernel/cpuid.c
2945F: arch/x86/kernel/msr.c 2946F: arch/x86/kernel/msr.c
2946 2947
2947CPU POWER MONITORING SUBSYSTEM 2948CPU POWER MONITORING SUBSYSTEM
2948M: Thomas Renninger <trenn@suse.de> 2949M: Thomas Renninger <trenn@suse.com>
2949L: linux-pm@vger.kernel.org 2950L: linux-pm@vger.kernel.org
2950S: Maintained 2951S: Maintained
2951F: tools/power/cpupower/ 2952F: tools/power/cpupower/
@@ -3175,7 +3176,7 @@ F: Documentation/networking/dmfe.txt
3175F: drivers/net/ethernet/dec/tulip/dmfe.c 3176F: drivers/net/ethernet/dec/tulip/dmfe.c
3176 3177
3177DC390/AM53C974 SCSI driver 3178DC390/AM53C974 SCSI driver
3178M: Hannes Reinecke <hare@suse.de> 3179M: Hannes Reinecke <hare@suse.com>
3179L: linux-scsi@vger.kernel.org 3180L: linux-scsi@vger.kernel.org
3180S: Maintained 3181S: Maintained
3181F: drivers/scsi/am53c974.c 3182F: drivers/scsi/am53c974.c
@@ -3379,7 +3380,7 @@ W: http://www.win.tue.nl/~aeb/partitions/partition_types-1.html
3379S: Maintained 3380S: Maintained
3380 3381
3381DISKQUOTA 3382DISKQUOTA
3382M: Jan Kara <jack@suse.cz> 3383M: Jan Kara <jack@suse.com>
3383S: Maintained 3384S: Maintained
3384F: Documentation/filesystems/quota.txt 3385F: Documentation/filesystems/quota.txt
3385F: fs/quota/ 3386F: fs/quota/
@@ -3435,7 +3436,7 @@ F: Documentation/hwmon/dme1737
3435F: drivers/hwmon/dme1737.c 3436F: drivers/hwmon/dme1737.c
3436 3437
3437DMI/SMBIOS SUPPORT 3438DMI/SMBIOS SUPPORT
3438M: Jean Delvare <jdelvare@suse.de> 3439M: Jean Delvare <jdelvare@suse.com>
3439S: Maintained 3440S: Maintained
3440T: quilt http://jdelvare.nerim.net/devel/linux/jdelvare-dmi/ 3441T: quilt http://jdelvare.nerim.net/devel/linux/jdelvare-dmi/
3441F: Documentation/ABI/testing/sysfs-firmware-dmi-tables 3442F: Documentation/ABI/testing/sysfs-firmware-dmi-tables
@@ -4051,7 +4052,7 @@ F: drivers/of/of_mdio.c
4051F: drivers/of/of_net.c 4052F: drivers/of/of_net.c
4052 4053
4053EXT2 FILE SYSTEM 4054EXT2 FILE SYSTEM
4054M: Jan Kara <jack@suse.cz> 4055M: Jan Kara <jack@suse.com>
4055L: linux-ext4@vger.kernel.org 4056L: linux-ext4@vger.kernel.org
4056S: Maintained 4057S: Maintained
4057F: Documentation/filesystems/ext2.txt 4058F: Documentation/filesystems/ext2.txt
@@ -4059,7 +4060,7 @@ F: fs/ext2/
4059F: include/linux/ext2* 4060F: include/linux/ext2*
4060 4061
4061EXT3 FILE SYSTEM 4062EXT3 FILE SYSTEM
4062M: Jan Kara <jack@suse.cz> 4063M: Jan Kara <jack@suse.com>
4063M: Andrew Morton <akpm@linux-foundation.org> 4064M: Andrew Morton <akpm@linux-foundation.org>
4064M: Andreas Dilger <adilger.kernel@dilger.ca> 4065M: Andreas Dilger <adilger.kernel@dilger.ca>
4065L: linux-ext4@vger.kernel.org 4066L: linux-ext4@vger.kernel.org
@@ -4109,7 +4110,7 @@ F: drivers/video/fbdev/exynos/exynos_mipi*
4109F: include/video/exynos_mipi* 4110F: include/video/exynos_mipi*
4110 4111
4111F71805F HARDWARE MONITORING DRIVER 4112F71805F HARDWARE MONITORING DRIVER
4112M: Jean Delvare <jdelvare@suse.de> 4113M: Jean Delvare <jdelvare@suse.com>
4113L: lm-sensors@lm-sensors.org 4114L: lm-sensors@lm-sensors.org
4114S: Maintained 4115S: Maintained
4115F: Documentation/hwmon/f71805f 4116F: Documentation/hwmon/f71805f
@@ -4244,7 +4245,7 @@ S: Maintained
4244F: drivers/block/rsxx/ 4245F: drivers/block/rsxx/
4245 4246
4246FLOPPY DRIVER 4247FLOPPY DRIVER
4247M: Jiri Kosina <jkosina@suse.cz> 4248M: Jiri Kosina <jkosina@suse.com>
4248T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/floppy.git 4249T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/floppy.git
4249S: Odd fixes 4250S: Odd fixes
4250F: drivers/block/floppy.c 4251F: drivers/block/floppy.c
@@ -4665,7 +4666,7 @@ F: drivers/media/usb/stk1160/
4665 4666
4666H8/300 ARCHITECTURE 4667H8/300 ARCHITECTURE
4667M: Yoshinori Sato <ysato@users.sourceforge.jp> 4668M: Yoshinori Sato <ysato@users.sourceforge.jp>
4668L: uclinux-h8-devel@lists.sourceforge.jp 4669L: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers)
4669W: http://uclinux-h8.sourceforge.jp 4670W: http://uclinux-h8.sourceforge.jp
4670T: git git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git 4671T: git git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git
4671S: Maintained 4672S: Maintained
@@ -4712,7 +4713,7 @@ S: Maintained
4712F: drivers/media/usb/hackrf/ 4713F: drivers/media/usb/hackrf/
4713 4714
4714HARDWARE MONITORING 4715HARDWARE MONITORING
4715M: Jean Delvare <jdelvare@suse.de> 4716M: Jean Delvare <jdelvare@suse.com>
4716M: Guenter Roeck <linux@roeck-us.net> 4717M: Guenter Roeck <linux@roeck-us.net>
4717L: lm-sensors@lm-sensors.org 4718L: lm-sensors@lm-sensors.org
4718W: http://www.lm-sensors.org/ 4719W: http://www.lm-sensors.org/
@@ -4815,7 +4816,7 @@ F: include/linux/pm.h
4815F: arch/*/include/asm/suspend*.h 4816F: arch/*/include/asm/suspend*.h
4816 4817
4817HID CORE LAYER 4818HID CORE LAYER
4818M: Jiri Kosina <jkosina@suse.cz> 4819M: Jiri Kosina <jkosina@suse.com>
4819L: linux-input@vger.kernel.org 4820L: linux-input@vger.kernel.org
4820T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git 4821T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
4821S: Maintained 4822S: Maintained
@@ -4824,7 +4825,7 @@ F: include/linux/hid*
4824F: include/uapi/linux/hid* 4825F: include/uapi/linux/hid*
4825 4826
4826HID SENSOR HUB DRIVERS 4827HID SENSOR HUB DRIVERS
4827M: Jiri Kosina <jkosina@suse.cz> 4828M: Jiri Kosina <jkosina@suse.com>
4828M: Jonathan Cameron <jic23@kernel.org> 4829M: Jonathan Cameron <jic23@kernel.org>
4829M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> 4830M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
4830L: linux-input@vger.kernel.org 4831L: linux-input@vger.kernel.org
@@ -4958,7 +4959,7 @@ F: include/linux/hyperv.h
4958F: tools/hv/ 4959F: tools/hv/
4959 4960
4960I2C OVER PARALLEL PORT 4961I2C OVER PARALLEL PORT
4961M: Jean Delvare <jdelvare@suse.de> 4962M: Jean Delvare <jdelvare@suse.com>
4962L: linux-i2c@vger.kernel.org 4963L: linux-i2c@vger.kernel.org
4963S: Maintained 4964S: Maintained
4964F: Documentation/i2c/busses/i2c-parport 4965F: Documentation/i2c/busses/i2c-parport
@@ -4967,7 +4968,7 @@ F: drivers/i2c/busses/i2c-parport.c
4967F: drivers/i2c/busses/i2c-parport-light.c 4968F: drivers/i2c/busses/i2c-parport-light.c
4968 4969
4969I2C/SMBUS CONTROLLER DRIVERS FOR PC 4970I2C/SMBUS CONTROLLER DRIVERS FOR PC
4970M: Jean Delvare <jdelvare@suse.de> 4971M: Jean Delvare <jdelvare@suse.com>
4971L: linux-i2c@vger.kernel.org 4972L: linux-i2c@vger.kernel.org
4972S: Maintained 4973S: Maintained
4973F: Documentation/i2c/busses/i2c-ali1535 4974F: Documentation/i2c/busses/i2c-ali1535
@@ -5008,7 +5009,7 @@ F: drivers/i2c/busses/i2c-ismt.c
5008F: Documentation/i2c/busses/i2c-ismt 5009F: Documentation/i2c/busses/i2c-ismt
5009 5010
5010I2C/SMBUS STUB DRIVER 5011I2C/SMBUS STUB DRIVER
5011M: Jean Delvare <jdelvare@suse.de> 5012M: Jean Delvare <jdelvare@suse.com>
5012L: linux-i2c@vger.kernel.org 5013L: linux-i2c@vger.kernel.org
5013S: Maintained 5014S: Maintained
5014F: drivers/i2c/i2c-stub.c 5015F: drivers/i2c/i2c-stub.c
@@ -5035,7 +5036,7 @@ L: linux-acpi@vger.kernel.org
5035S: Maintained 5036S: Maintained
5036 5037
5037I2C-TAOS-EVM DRIVER 5038I2C-TAOS-EVM DRIVER
5038M: Jean Delvare <jdelvare@suse.de> 5039M: Jean Delvare <jdelvare@suse.com>
5039L: linux-i2c@vger.kernel.org 5040L: linux-i2c@vger.kernel.org
5040S: Maintained 5041S: Maintained
5041F: Documentation/i2c/busses/i2c-taos-evm 5042F: Documentation/i2c/busses/i2c-taos-evm
@@ -5564,8 +5565,8 @@ F: include/uapi/linux/ip_vs.h
5564F: net/netfilter/ipvs/ 5565F: net/netfilter/ipvs/
5565 5566
5566IPWIRELESS DRIVER 5567IPWIRELESS DRIVER
5567M: Jiri Kosina <jkosina@suse.cz> 5568M: Jiri Kosina <jkosina@suse.com>
5568M: David Sterba <dsterba@suse.cz> 5569M: David Sterba <dsterba@suse.com>
5569S: Odd Fixes 5570S: Odd Fixes
5570F: drivers/tty/ipwireless/ 5571F: drivers/tty/ipwireless/
5571 5572
@@ -5685,7 +5686,7 @@ S: Maintained
5685F: drivers/isdn/hardware/eicon/ 5686F: drivers/isdn/hardware/eicon/
5686 5687
5687IT87 HARDWARE MONITORING DRIVER 5688IT87 HARDWARE MONITORING DRIVER
5688M: Jean Delvare <jdelvare@suse.de> 5689M: Jean Delvare <jdelvare@suse.com>
5689L: lm-sensors@lm-sensors.org 5690L: lm-sensors@lm-sensors.org
5690S: Maintained 5691S: Maintained
5691F: Documentation/hwmon/it87 5692F: Documentation/hwmon/it87
@@ -5752,7 +5753,7 @@ F: include/uapi/linux/jffs2.h
5752 5753
5753JOURNALLING LAYER FOR BLOCK DEVICES (JBD) 5754JOURNALLING LAYER FOR BLOCK DEVICES (JBD)
5754M: Andrew Morton <akpm@linux-foundation.org> 5755M: Andrew Morton <akpm@linux-foundation.org>
5755M: Jan Kara <jack@suse.cz> 5756M: Jan Kara <jack@suse.com>
5756L: linux-ext4@vger.kernel.org 5757L: linux-ext4@vger.kernel.org
5757S: Maintained 5758S: Maintained
5758F: fs/jbd/ 5759F: fs/jbd/
@@ -5816,7 +5817,7 @@ S: Maintained
5816F: fs/autofs4/ 5817F: fs/autofs4/
5817 5818
5818KERNEL BUILD + files below scripts/ (unless maintained elsewhere) 5819KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
5819M: Michal Marek <mmarek@suse.cz> 5820M: Michal Marek <mmarek@suse.com>
5820T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next 5821T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next
5821T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes 5822T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes
5822L: linux-kbuild@vger.kernel.org 5823L: linux-kbuild@vger.kernel.org
@@ -5880,7 +5881,7 @@ F: arch/x86/include/asm/svm.h
5880F: arch/x86/kvm/svm.c 5881F: arch/x86/kvm/svm.c
5881 5882
5882KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC 5883KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC
5883M: Alexander Graf <agraf@suse.de> 5884M: Alexander Graf <agraf@suse.com>
5884L: kvm-ppc@vger.kernel.org 5885L: kvm-ppc@vger.kernel.org
5885W: http://kvm.qumranet.com 5886W: http://kvm.qumranet.com
5886T: git git://github.com/agraf/linux-2.6.git 5887T: git git://github.com/agraf/linux-2.6.git
@@ -6037,7 +6038,7 @@ F: drivers/leds/
6037F: include/linux/leds.h 6038F: include/linux/leds.h
6038 6039
6039LEGACY EEPROM DRIVER 6040LEGACY EEPROM DRIVER
6040M: Jean Delvare <jdelvare@suse.de> 6041M: Jean Delvare <jdelvare@suse.com>
6041S: Maintained 6042S: Maintained
6042F: Documentation/misc-devices/eeprom 6043F: Documentation/misc-devices/eeprom
6043F: drivers/misc/eeprom/eeprom.c 6044F: drivers/misc/eeprom/eeprom.c
@@ -6090,7 +6091,7 @@ F: include/linux/ata.h
6090F: include/linux/libata.h 6091F: include/linux/libata.h
6091 6092
6092LIBATA PATA ARASAN COMPACT FLASH CONTROLLER 6093LIBATA PATA ARASAN COMPACT FLASH CONTROLLER
6093M: Viresh Kumar <viresh.linux@gmail.com> 6094M: Viresh Kumar <vireshk@kernel.org>
6094L: linux-ide@vger.kernel.org 6095L: linux-ide@vger.kernel.org
6095T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git 6096T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git
6096S: Maintained 6097S: Maintained
@@ -6251,8 +6252,8 @@ F: drivers/platform/x86/hp_accel.c
6251LIVE PATCHING 6252LIVE PATCHING
6252M: Josh Poimboeuf <jpoimboe@redhat.com> 6253M: Josh Poimboeuf <jpoimboe@redhat.com>
6253M: Seth Jennings <sjenning@redhat.com> 6254M: Seth Jennings <sjenning@redhat.com>
6254M: Jiri Kosina <jkosina@suse.cz> 6255M: Jiri Kosina <jkosina@suse.com>
6255M: Vojtech Pavlik <vojtech@suse.cz> 6256M: Vojtech Pavlik <vojtech@suse.com>
6256S: Maintained 6257S: Maintained
6257F: kernel/livepatch/ 6258F: kernel/livepatch/
6258F: include/linux/livepatch.h 6259F: include/linux/livepatch.h
@@ -6278,21 +6279,21 @@ S: Maintained
6278F: drivers/hwmon/lm73.c 6279F: drivers/hwmon/lm73.c
6279 6280
6280LM78 HARDWARE MONITOR DRIVER 6281LM78 HARDWARE MONITOR DRIVER
6281M: Jean Delvare <jdelvare@suse.de> 6282M: Jean Delvare <jdelvare@suse.com>
6282L: lm-sensors@lm-sensors.org 6283L: lm-sensors@lm-sensors.org
6283S: Maintained 6284S: Maintained
6284F: Documentation/hwmon/lm78 6285F: Documentation/hwmon/lm78
6285F: drivers/hwmon/lm78.c 6286F: drivers/hwmon/lm78.c
6286 6287
6287LM83 HARDWARE MONITOR DRIVER 6288LM83 HARDWARE MONITOR DRIVER
6288M: Jean Delvare <jdelvare@suse.de> 6289M: Jean Delvare <jdelvare@suse.com>
6289L: lm-sensors@lm-sensors.org 6290L: lm-sensors@lm-sensors.org
6290S: Maintained 6291S: Maintained
6291F: Documentation/hwmon/lm83 6292F: Documentation/hwmon/lm83
6292F: drivers/hwmon/lm83.c 6293F: drivers/hwmon/lm83.c
6293 6294
6294LM90 HARDWARE MONITOR DRIVER 6295LM90 HARDWARE MONITOR DRIVER
6295M: Jean Delvare <jdelvare@suse.de> 6296M: Jean Delvare <jdelvare@suse.com>
6296L: lm-sensors@lm-sensors.org 6297L: lm-sensors@lm-sensors.org
6297S: Maintained 6298S: Maintained
6298F: Documentation/hwmon/lm90 6299F: Documentation/hwmon/lm90
@@ -7019,6 +7020,7 @@ F: include/uapi/linux/netfilter/
7019F: net/*/netfilter.c 7020F: net/*/netfilter.c
7020F: net/*/netfilter/ 7021F: net/*/netfilter/
7021F: net/netfilter/ 7022F: net/netfilter/
7023F: net/bridge/br_netfilter*.c
7022 7024
7023NETLABEL 7025NETLABEL
7024M: Paul Moore <paul@paul-moore.com> 7026M: Paul Moore <paul@paul-moore.com>
@@ -7718,7 +7720,7 @@ S: Maintained
7718F: drivers/char/pc8736x_gpio.c 7720F: drivers/char/pc8736x_gpio.c
7719 7721
7720PC87427 HARDWARE MONITORING DRIVER 7722PC87427 HARDWARE MONITORING DRIVER
7721M: Jean Delvare <jdelvare@suse.de> 7723M: Jean Delvare <jdelvare@suse.com>
7722L: lm-sensors@lm-sensors.org 7724L: lm-sensors@lm-sensors.org
7723S: Maintained 7725S: Maintained
7724F: Documentation/hwmon/pc87427 7726F: Documentation/hwmon/pc87427
@@ -7995,7 +7997,7 @@ S: Maintained
7995F: drivers/pinctrl/samsung/ 7997F: drivers/pinctrl/samsung/
7996 7998
7997PIN CONTROLLER - ST SPEAR 7999PIN CONTROLLER - ST SPEAR
7998M: Viresh Kumar <viresh.linux@gmail.com> 8000M: Viresh Kumar <vireshk@kernel.org>
7999L: spear-devel@list.st.com 8001L: spear-devel@list.st.com
8000L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 8002L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
8001W: http://www.st.com/spear 8003W: http://www.st.com/spear
@@ -8003,7 +8005,7 @@ S: Maintained
8003F: drivers/pinctrl/spear/ 8005F: drivers/pinctrl/spear/
8004 8006
8005PKTCDVD DRIVER 8007PKTCDVD DRIVER
8006M: Jiri Kosina <jkosina@suse.cz> 8008M: Jiri Kosina <jkosina@suse.com>
8007S: Maintained 8009S: Maintained
8008F: drivers/block/pktcdvd.c 8010F: drivers/block/pktcdvd.c
8009F: include/linux/pktcdvd.h 8011F: include/linux/pktcdvd.h
@@ -8894,7 +8896,7 @@ S: Maintained
8894F: drivers/tty/serial/ 8896F: drivers/tty/serial/
8895 8897
8896SYNOPSYS DESIGNWARE DMAC DRIVER 8898SYNOPSYS DESIGNWARE DMAC DRIVER
8897M: Viresh Kumar <viresh.linux@gmail.com> 8899M: Viresh Kumar <vireshk@kernel.org>
8898M: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 8900M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8899S: Maintained 8901S: Maintained
8900F: include/linux/dma/dw.h 8902F: include/linux/dma/dw.h
@@ -9061,7 +9063,7 @@ S: Maintained
9061F: drivers/mmc/host/sdhci-s3c* 9063F: drivers/mmc/host/sdhci-s3c*
9062 9064
9063SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER 9065SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER
9064M: Viresh Kumar <viresh.linux@gmail.com> 9066M: Viresh Kumar <vireshk@kernel.org>
9065L: spear-devel@list.st.com 9067L: spear-devel@list.st.com
9066L: linux-mmc@vger.kernel.org 9068L: linux-mmc@vger.kernel.org
9067S: Maintained 9069S: Maintained
@@ -9423,7 +9425,7 @@ F: Documentation/hwmon/sch5627
9423F: drivers/hwmon/sch5627.c 9425F: drivers/hwmon/sch5627.c
9424 9426
9425SMSC47B397 HARDWARE MONITOR DRIVER 9427SMSC47B397 HARDWARE MONITOR DRIVER
9426M: Jean Delvare <jdelvare@suse.de> 9428M: Jean Delvare <jdelvare@suse.com>
9427L: lm-sensors@lm-sensors.org 9429L: lm-sensors@lm-sensors.org
9428S: Maintained 9430S: Maintained
9429F: Documentation/hwmon/smsc47b397 9431F: Documentation/hwmon/smsc47b397
@@ -9472,7 +9474,7 @@ S: Supported
9472F: drivers/media/pci/solo6x10/ 9474F: drivers/media/pci/solo6x10/
9473 9475
9474SOFTWARE RAID (Multiple Disks) SUPPORT 9476SOFTWARE RAID (Multiple Disks) SUPPORT
9475M: Neil Brown <neilb@suse.de> 9477M: Neil Brown <neilb@suse.com>
9476L: linux-raid@vger.kernel.org 9478L: linux-raid@vger.kernel.org
9477S: Supported 9479S: Supported
9478F: drivers/md/ 9480F: drivers/md/
@@ -9515,7 +9517,7 @@ F: drivers/memstick/core/ms_block.*
9515 9517
9516SOUND 9518SOUND
9517M: Jaroslav Kysela <perex@perex.cz> 9519M: Jaroslav Kysela <perex@perex.cz>
9518M: Takashi Iwai <tiwai@suse.de> 9520M: Takashi Iwai <tiwai@suse.com>
9519L: alsa-devel@alsa-project.org (moderated for non-subscribers) 9521L: alsa-devel@alsa-project.org (moderated for non-subscribers)
9520W: http://www.alsa-project.org/ 9522W: http://www.alsa-project.org/
9521T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git 9523T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
@@ -9599,7 +9601,7 @@ S: Maintained
9599F: include/linux/compiler.h 9601F: include/linux/compiler.h
9600 9602
9601SPEAR PLATFORM SUPPORT 9603SPEAR PLATFORM SUPPORT
9602M: Viresh Kumar <viresh.linux@gmail.com> 9604M: Viresh Kumar <vireshk@kernel.org>
9603M: Shiraz Hashim <shiraz.linux.kernel@gmail.com> 9605M: Shiraz Hashim <shiraz.linux.kernel@gmail.com>
9604L: spear-devel@list.st.com 9606L: spear-devel@list.st.com
9605L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 9607L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -9608,7 +9610,7 @@ S: Maintained
9608F: arch/arm/mach-spear/ 9610F: arch/arm/mach-spear/
9609 9611
9610SPEAR CLOCK FRAMEWORK SUPPORT 9612SPEAR CLOCK FRAMEWORK SUPPORT
9611M: Viresh Kumar <viresh.linux@gmail.com> 9613M: Viresh Kumar <vireshk@kernel.org>
9612L: spear-devel@list.st.com 9614L: spear-devel@list.st.com
9613L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 9615L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
9614W: http://www.st.com/spear 9616W: http://www.st.com/spear
@@ -10398,7 +10400,7 @@ K: ^Subject:.*(?i)trivial
10398 10400
10399TTY LAYER 10401TTY LAYER
10400M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 10402M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10401M: Jiri Slaby <jslaby@suse.cz> 10403M: Jiri Slaby <jslaby@suse.com>
10402S: Supported 10404S: Supported
10403T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git 10405T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
10404F: Documentation/serial/ 10406F: Documentation/serial/
@@ -10472,7 +10474,7 @@ F: arch/m68k/*/*_no.*
10472F: arch/m68k/include/asm/*_no.* 10474F: arch/m68k/include/asm/*_no.*
10473 10475
10474UDF FILESYSTEM 10476UDF FILESYSTEM
10475M: Jan Kara <jack@suse.cz> 10477M: Jan Kara <jack@suse.com>
10476S: Maintained 10478S: Maintained
10477F: Documentation/filesystems/udf.txt 10479F: Documentation/filesystems/udf.txt
10478F: fs/udf/ 10480F: fs/udf/
@@ -10615,7 +10617,7 @@ F: drivers/usb/gadget/
10615F: include/linux/usb/gadget* 10617F: include/linux/usb/gadget*
10616 10618
10617USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 10619USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
10618M: Jiri Kosina <jkosina@suse.cz> 10620M: Jiri Kosina <jkosina@suse.com>
10619L: linux-usb@vger.kernel.org 10621L: linux-usb@vger.kernel.org
10620T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git 10622T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git
10621S: Maintained 10623S: Maintained
@@ -10740,7 +10742,7 @@ S: Maintained
10740F: drivers/usb/host/uhci* 10742F: drivers/usb/host/uhci*
10741 10743
10742USB "USBNET" DRIVER FRAMEWORK 10744USB "USBNET" DRIVER FRAMEWORK
10743M: Oliver Neukum <oneukum@suse.de> 10745M: Oliver Neukum <oneukum@suse.com>
10744L: netdev@vger.kernel.org 10746L: netdev@vger.kernel.org
10745W: http://www.linux-usb.org/usbnet 10747W: http://www.linux-usb.org/usbnet
10746S: Maintained 10748S: Maintained
@@ -11067,7 +11069,7 @@ F: Documentation/hwmon/w83793
11067F: drivers/hwmon/w83793.c 11069F: drivers/hwmon/w83793.c
11068 11070
11069W83795 HARDWARE MONITORING DRIVER 11071W83795 HARDWARE MONITORING DRIVER
11070M: Jean Delvare <jdelvare@suse.de> 11072M: Jean Delvare <jdelvare@suse.com>
11071L: lm-sensors@lm-sensors.org 11073L: lm-sensors@lm-sensors.org
11072S: Maintained 11074S: Maintained
11073F: drivers/hwmon/w83795.c 11075F: drivers/hwmon/w83795.c
diff --git a/Makefile b/Makefile
index 257ef5892ab7..a9ad4908e870 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 2 2PATCHLEVEL = 2
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc3
5NAME = Hurr durr I'ma sheep 5NAME = Hurr durr I'ma sheep
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -780,10 +780,11 @@ endif
780include scripts/Makefile.kasan 780include scripts/Makefile.kasan
781include scripts/Makefile.extrawarn 781include scripts/Makefile.extrawarn
782 782
783# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 783# Add any arch overrides and user supplied CPPFLAGS, AFLAGS and CFLAGS as the
784KBUILD_CPPFLAGS += $(KCPPFLAGS) 784# last assignments
785KBUILD_AFLAGS += $(KAFLAGS) 785KBUILD_CPPFLAGS += $(ARCH_CPPFLAGS) $(KCPPFLAGS)
786KBUILD_CFLAGS += $(KCFLAGS) 786KBUILD_AFLAGS += $(ARCH_AFLAGS) $(KAFLAGS)
787KBUILD_CFLAGS += $(ARCH_CFLAGS) $(KCFLAGS)
787 788
788# Use --build-id when available. 789# Use --build-id when available.
789LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ 790LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
diff --git a/arch/Kconfig b/arch/Kconfig
index bec6666a3cc4..8a8ea7110de8 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -221,6 +221,10 @@ config ARCH_TASK_STRUCT_ALLOCATOR
221config ARCH_THREAD_INFO_ALLOCATOR 221config ARCH_THREAD_INFO_ALLOCATOR
222 bool 222 bool
223 223
224# Select if arch wants to size task_struct dynamically via arch_task_struct_size:
225config ARCH_WANTS_DYNAMIC_TASK_STRUCT
226 bool
227
224config HAVE_REGS_AND_STACK_ACCESS_API 228config HAVE_REGS_AND_STACK_ACCESS_API
225 bool 229 bool
226 help 230 help
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index cde23cd03609..ffd9cf5ec8c4 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += cputime.h
5generic-y += exec.h 5generic-y += exec.h
6generic-y += irq_work.h 6generic-y += irq_work.h
7generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
8generic-y += mm-arch-hooks.h
8generic-y += preempt.h 9generic-y += preempt.h
9generic-y += sections.h 10generic-y += sections.h
10generic-y += trace_clock.h 11generic-y += trace_clock.h
diff --git a/arch/alpha/include/asm/mm-arch-hooks.h b/arch/alpha/include/asm/mm-arch-hooks.h
deleted file mode 100644
index b07fd862fec3..000000000000
--- a/arch/alpha/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_ALPHA_MM_ARCH_HOOKS_H
13#define _ASM_ALPHA_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_ALPHA_MM_ARCH_HOOKS_H */
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index e7cee0a5c56d..91cf4055acab 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -115,6 +115,7 @@ if ISA_ARCOMPACT
115 115
116config ARC_CPU_750D 116config ARC_CPU_750D
117 bool "ARC750D" 117 bool "ARC750D"
118 select ARC_CANT_LLSC
118 help 119 help
119 Support for ARC750 core 120 Support for ARC750 core
120 121
@@ -362,7 +363,7 @@ config ARC_CANT_LLSC
362config ARC_HAS_LLSC 363config ARC_HAS_LLSC
363 bool "Insn: LLOCK/SCOND (efficient atomic ops)" 364 bool "Insn: LLOCK/SCOND (efficient atomic ops)"
364 default y 365 default y
365 depends on !ARC_CPU_750D && !ARC_CANT_LLSC 366 depends on !ARC_CANT_LLSC
366 367
367config ARC_HAS_SWAPE 368config ARC_HAS_SWAPE
368 bool "Insn: SWAPE (endian-swap)" 369 bool "Insn: SWAPE (endian-swap)"
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 6107062c0111..46d87310220d 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -49,7 +49,8 @@ endif
49 49
50ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE 50ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
51# Generic build system uses -O2, we want -O3 51# Generic build system uses -O2, we want -O3
52cflags-y += -O3 52# Note: No need to add to cflags-y as that happens anyways
53ARCH_CFLAGS += -O3
53endif 54endif
54 55
55# small data is default for elf32 tool-chain. If not usable, disable it 56# small data is default for elf32 tool-chain. If not usable, disable it
diff --git a/arch/arc/boot/dts/axc003.dtsi b/arch/arc/boot/dts/axc003.dtsi
index 15c8d6226c9d..1cd5e82f5dc2 100644
--- a/arch/arc/boot/dts/axc003.dtsi
+++ b/arch/arc/boot/dts/axc003.dtsi
@@ -12,7 +12,7 @@
12 12
13/ { 13/ {
14 compatible = "snps,arc"; 14 compatible = "snps,arc";
15 clock-frequency = <75000000>; 15 clock-frequency = <90000000>;
16 #address-cells = <1>; 16 #address-cells = <1>;
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
diff --git a/arch/arc/boot/dts/axc003_idu.dtsi b/arch/arc/boot/dts/axc003_idu.dtsi
index 199d42820eca..2f0b33257db2 100644
--- a/arch/arc/boot/dts/axc003_idu.dtsi
+++ b/arch/arc/boot/dts/axc003_idu.dtsi
@@ -12,7 +12,7 @@
12 12
13/ { 13/ {
14 compatible = "snps,arc"; 14 compatible = "snps,arc";
15 clock-frequency = <75000000>; 15 clock-frequency = <90000000>;
16 #address-cells = <1>; 16 #address-cells = <1>;
17 #size-cells = <1>; 17 #size-cells = <1>;
18 18
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 1a80cc91a03b..7611b10a2d23 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -22,6 +22,7 @@ generic-y += kvm_para.h
22generic-y += local.h 22generic-y += local.h
23generic-y += local64.h 23generic-y += local64.h
24generic-y += mcs_spinlock.h 24generic-y += mcs_spinlock.h
25generic-y += mm-arch-hooks.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
diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
index 99fe118d3730..57c1f33844d4 100644
--- a/arch/arc/include/asm/bitops.h
+++ b/arch/arc/include/asm/bitops.h
@@ -50,8 +50,7 @@ static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\
50 * done for const @nr, but no code is generated due to gcc \ 50 * done for const @nr, but no code is generated due to gcc \
51 * const prop. \ 51 * const prop. \
52 */ \ 52 */ \
53 if (__builtin_constant_p(nr)) \ 53 nr &= 0x1f; \
54 nr &= 0x1f; \
55 \ 54 \
56 __asm__ __volatile__( \ 55 __asm__ __volatile__( \
57 "1: llock %0, [%1] \n" \ 56 "1: llock %0, [%1] \n" \
@@ -82,8 +81,7 @@ static inline int test_and_##op##_bit(unsigned long nr, volatile unsigned long *
82 \ 81 \
83 m += nr >> 5; \ 82 m += nr >> 5; \
84 \ 83 \
85 if (__builtin_constant_p(nr)) \ 84 nr &= 0x1f; \
86 nr &= 0x1f; \
87 \ 85 \
88 /* \ 86 /* \
89 * Explicit full memory barrier needed before/after as \ 87 * Explicit full memory barrier needed before/after as \
@@ -129,16 +127,13 @@ static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\
129 unsigned long temp, flags; \ 127 unsigned long temp, flags; \
130 m += nr >> 5; \ 128 m += nr >> 5; \
131 \ 129 \
132 if (__builtin_constant_p(nr)) \
133 nr &= 0x1f; \
134 \
135 /* \ 130 /* \
136 * spin lock/unlock provide the needed smp_mb() before/after \ 131 * spin lock/unlock provide the needed smp_mb() before/after \
137 */ \ 132 */ \
138 bitops_lock(flags); \ 133 bitops_lock(flags); \
139 \ 134 \
140 temp = *m; \ 135 temp = *m; \
141 *m = temp c_op (1UL << nr); \ 136 *m = temp c_op (1UL << (nr & 0x1f)); \
142 \ 137 \
143 bitops_unlock(flags); \ 138 bitops_unlock(flags); \
144} 139}
@@ -149,17 +144,14 @@ static inline int test_and_##op##_bit(unsigned long nr, volatile unsigned long *
149 unsigned long old, flags; \ 144 unsigned long old, flags; \
150 m += nr >> 5; \ 145 m += nr >> 5; \
151 \ 146 \
152 if (__builtin_constant_p(nr)) \
153 nr &= 0x1f; \
154 \
155 bitops_lock(flags); \ 147 bitops_lock(flags); \
156 \ 148 \
157 old = *m; \ 149 old = *m; \
158 *m = old c_op (1 << nr); \ 150 *m = old c_op (1UL << (nr & 0x1f)); \
159 \ 151 \
160 bitops_unlock(flags); \ 152 bitops_unlock(flags); \
161 \ 153 \
162 return (old & (1 << nr)) != 0; \ 154 return (old & (1UL << (nr & 0x1f))) != 0; \
163} 155}
164 156
165#endif /* CONFIG_ARC_HAS_LLSC */ 157#endif /* CONFIG_ARC_HAS_LLSC */
@@ -174,11 +166,8 @@ static inline void __##op##_bit(unsigned long nr, volatile unsigned long *m) \
174 unsigned long temp; \ 166 unsigned long temp; \
175 m += nr >> 5; \ 167 m += nr >> 5; \
176 \ 168 \
177 if (__builtin_constant_p(nr)) \
178 nr &= 0x1f; \
179 \
180 temp = *m; \ 169 temp = *m; \
181 *m = temp c_op (1UL << nr); \ 170 *m = temp c_op (1UL << (nr & 0x1f)); \
182} 171}
183 172
184#define __TEST_N_BIT_OP(op, c_op, asm_op) \ 173#define __TEST_N_BIT_OP(op, c_op, asm_op) \
@@ -187,13 +176,10 @@ static inline int __test_and_##op##_bit(unsigned long nr, volatile unsigned long
187 unsigned long old; \ 176 unsigned long old; \
188 m += nr >> 5; \ 177 m += nr >> 5; \
189 \ 178 \
190 if (__builtin_constant_p(nr)) \
191 nr &= 0x1f; \
192 \
193 old = *m; \ 179 old = *m; \
194 *m = old c_op (1 << nr); \ 180 *m = old c_op (1UL << (nr & 0x1f)); \
195 \ 181 \
196 return (old & (1 << nr)) != 0; \ 182 return (old & (1UL << (nr & 0x1f))) != 0; \
197} 183}
198 184
199#define BIT_OPS(op, c_op, asm_op) \ 185#define BIT_OPS(op, c_op, asm_op) \
@@ -224,10 +210,7 @@ test_bit(unsigned int nr, const volatile unsigned long *addr)
224 210
225 addr += nr >> 5; 211 addr += nr >> 5;
226 212
227 if (__builtin_constant_p(nr)) 213 mask = 1UL << (nr & 0x1f);
228 nr &= 0x1f;
229
230 mask = 1 << nr;
231 214
232 return ((mask & *addr) != 0); 215 return ((mask & *addr) != 0);
233} 216}
diff --git a/arch/arc/include/asm/futex.h b/arch/arc/include/asm/futex.h
index 05b5aaf5b0f9..70cfe16b742d 100644
--- a/arch/arc/include/asm/futex.h
+++ b/arch/arc/include/asm/futex.h
@@ -16,12 +16,40 @@
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17#include <asm/errno.h> 17#include <asm/errno.h>
18 18
19#ifdef CONFIG_ARC_HAS_LLSC
20
21#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\
22 \
23 __asm__ __volatile__( \
24 "1: llock %1, [%2] \n" \
25 insn "\n" \
26 "2: scond %0, [%2] \n" \
27 " bnz 1b \n" \
28 " mov %0, 0 \n" \
29 "3: \n" \
30 " .section .fixup,\"ax\" \n" \
31 " .align 4 \n" \
32 "4: mov %0, %4 \n" \
33 " b 3b \n" \
34 " .previous \n" \
35 " .section __ex_table,\"a\" \n" \
36 " .align 4 \n" \
37 " .word 1b, 4b \n" \
38 " .word 2b, 4b \n" \
39 " .previous \n" \
40 \
41 : "=&r" (ret), "=&r" (oldval) \
42 : "r" (uaddr), "r" (oparg), "ir" (-EFAULT) \
43 : "cc", "memory")
44
45#else /* !CONFIG_ARC_HAS_LLSC */
46
19#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\ 47#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\
20 \ 48 \
21 __asm__ __volatile__( \ 49 __asm__ __volatile__( \
22 "1: ld %1, [%2] \n" \ 50 "1: ld %1, [%2] \n" \
23 insn "\n" \ 51 insn "\n" \
24 "2: st %0, [%2] \n" \ 52 "2: st %0, [%2] \n" \
25 " mov %0, 0 \n" \ 53 " mov %0, 0 \n" \
26 "3: \n" \ 54 "3: \n" \
27 " .section .fixup,\"ax\" \n" \ 55 " .section .fixup,\"ax\" \n" \
@@ -39,6 +67,8 @@
39 : "r" (uaddr), "r" (oparg), "ir" (-EFAULT) \ 67 : "r" (uaddr), "r" (oparg), "ir" (-EFAULT) \
40 : "cc", "memory") 68 : "cc", "memory")
41 69
70#endif
71
42static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr) 72static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
43{ 73{
44 int op = (encoded_op >> 28) & 7; 74 int op = (encoded_op >> 28) & 7;
@@ -123,11 +153,17 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
123 153
124 pagefault_disable(); 154 pagefault_disable();
125 155
126 /* TBD : can use llock/scond */
127 __asm__ __volatile__( 156 __asm__ __volatile__(
128 "1: ld %0, [%3] \n" 157#ifdef CONFIG_ARC_HAS_LLSC
129 " brne %0, %1, 3f \n" 158 "1: llock %0, [%3] \n"
130 "2: st %2, [%3] \n" 159 " brne %0, %1, 3f \n"
160 "2: scond %2, [%3] \n"
161 " bnz 1b \n"
162#else
163 "1: ld %0, [%3] \n"
164 " brne %0, %1, 3f \n"
165 "2: st %2, [%3] \n"
166#endif
131 "3: \n" 167 "3: \n"
132 " .section .fixup,\"ax\" \n" 168 " .section .fixup,\"ax\" \n"
133 "4: mov %0, %4 \n" 169 "4: mov %0, %4 \n"
diff --git a/arch/arc/include/asm/mm-arch-hooks.h b/arch/arc/include/asm/mm-arch-hooks.h
deleted file mode 100644
index c37541c5f8ba..000000000000
--- a/arch/arc/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_ARC_MM_ARCH_HOOKS_H
13#define _ASM_ARC_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_ARC_MM_ARCH_HOOKS_H */
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
index 91755972b9a2..91694ec1ce95 100644
--- a/arch/arc/include/asm/ptrace.h
+++ b/arch/arc/include/asm/ptrace.h
@@ -106,7 +106,7 @@ struct callee_regs {
106 long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; 106 long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;
107}; 107};
108 108
109#define instruction_pointer(regs) ((regs)->ret) 109#define instruction_pointer(regs) (unsigned long)((regs)->ret)
110#define profile_pc(regs) instruction_pointer(regs) 110#define profile_pc(regs) instruction_pointer(regs)
111 111
112/* return 1 if user mode or 0 if kernel mode */ 112/* return 1 if user mode or 0 if kernel mode */
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c
index 6208c630abed..26c156827479 100644
--- a/arch/arc/kernel/intc-arcv2.c
+++ b/arch/arc/kernel/intc-arcv2.c
@@ -12,7 +12,6 @@
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/irqdomain.h> 13#include <linux/irqdomain.h>
14#include <linux/irqchip.h> 14#include <linux/irqchip.h>
15#include "../../drivers/irqchip/irqchip.h"
16#include <asm/irq.h> 15#include <asm/irq.h>
17 16
18/* 17/*
diff --git a/arch/arc/kernel/intc-compact.c b/arch/arc/kernel/intc-compact.c
index fcdddb631766..039fac30b5c1 100644
--- a/arch/arc/kernel/intc-compact.c
+++ b/arch/arc/kernel/intc-compact.c
@@ -12,7 +12,6 @@
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/irqdomain.h> 13#include <linux/irqdomain.h>
14#include <linux/irqchip.h> 14#include <linux/irqchip.h>
15#include "../../drivers/irqchip/irqchip.h"
16#include <asm/irq.h> 15#include <asm/irq.h>
17 16
18/* 17/*
diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c
index 30284e8de6ff..2fb86589054d 100644
--- a/arch/arc/kernel/mcip.c
+++ b/arch/arc/kernel/mcip.c
@@ -175,7 +175,6 @@ void mcip_init_early_smp(void)
175#include <linux/irqchip.h> 175#include <linux/irqchip.h>
176#include <linux/of.h> 176#include <linux/of.h>
177#include <linux/of_irq.h> 177#include <linux/of_irq.h>
178#include "../../drivers/irqchip/irqchip.h"
179 178
180/* 179/*
181 * Set the DEST for @cmn_irq to @cpu_mask (1 bit per core) 180 * Set the DEST for @cmn_irq to @cpu_mask (1 bit per core)
@@ -218,11 +217,28 @@ static void idu_irq_unmask(struct irq_data *data)
218 raw_spin_unlock_irqrestore(&mcip_lock, flags); 217 raw_spin_unlock_irqrestore(&mcip_lock, flags);
219} 218}
220 219
220#ifdef CONFIG_SMP
221static int 221static int
222idu_irq_set_affinity(struct irq_data *d, const struct cpumask *cpumask, bool f) 222idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
223 bool force)
223{ 224{
225 unsigned long flags;
226 cpumask_t online;
227
228 /* errout if no online cpu per @cpumask */
229 if (!cpumask_and(&online, cpumask, cpu_online_mask))
230 return -EINVAL;
231
232 raw_spin_lock_irqsave(&mcip_lock, flags);
233
234 idu_set_dest(data->hwirq, cpumask_bits(&online)[0]);
235 idu_set_mode(data->hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR);
236
237 raw_spin_unlock_irqrestore(&mcip_lock, flags);
238
224 return IRQ_SET_MASK_OK; 239 return IRQ_SET_MASK_OK;
225} 240}
241#endif
226 242
227static struct irq_chip idu_irq_chip = { 243static struct irq_chip idu_irq_chip = {
228 .name = "MCIP IDU Intc", 244 .name = "MCIP IDU Intc",
@@ -330,8 +346,7 @@ idu_of_init(struct device_node *intc, struct device_node *parent)
330 if (!i) 346 if (!i)
331 idu_first_irq = irq; 347 idu_first_irq = irq;
332 348
333 irq_set_handler_data(irq, domain); 349 irq_set_chained_handler_and_data(irq, idu_cascade_isr, domain);
334 irq_set_chained_handler(irq, idu_cascade_isr);
335 } 350 }
336 351
337 __mcip_cmd(CMD_IDU_ENABLE, 0); 352 __mcip_cmd(CMD_IDU_ENABLE, 0);
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index a3d186211ed3..18cc01591c96 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -142,17 +142,22 @@ static void read_arc_build_cfg_regs(void)
142} 142}
143 143
144static const struct cpuinfo_data arc_cpu_tbl[] = { 144static const struct cpuinfo_data arc_cpu_tbl[] = {
145#ifdef CONFIG_ISA_ARCOMPACT
145 { {0x20, "ARC 600" }, 0x2F}, 146 { {0x20, "ARC 600" }, 0x2F},
146 { {0x30, "ARC 700" }, 0x33}, 147 { {0x30, "ARC 700" }, 0x33},
147 { {0x34, "ARC 700 R4.10"}, 0x34}, 148 { {0x34, "ARC 700 R4.10"}, 0x34},
148 { {0x35, "ARC 700 R4.11"}, 0x35}, 149 { {0x35, "ARC 700 R4.11"}, 0x35},
149 { {0x50, "ARC HS38" }, 0x51}, 150#else
151 { {0x50, "ARC HS38 R2.0"}, 0x51},
152 { {0x52, "ARC HS38 R2.1"}, 0x52},
153#endif
150 { {0x00, NULL } } 154 { {0x00, NULL } }
151}; 155};
152 156
153#define IS_AVAIL1(v, str) ((v) ? str : "") 157#define IS_AVAIL1(v, s) ((v) ? s : "")
154#define IS_USED(cfg) (IS_ENABLED(cfg) ? "" : "(not used) ") 158#define IS_USED_RUN(v) ((v) ? "" : "(not used) ")
155#define IS_AVAIL2(v, str, cfg) IS_AVAIL1(v, str), IS_AVAIL1(v, IS_USED(cfg)) 159#define IS_USED_CFG(cfg) IS_USED_RUN(IS_ENABLED(cfg))
160#define IS_AVAIL2(v, s, cfg) IS_AVAIL1(v, s), IS_AVAIL1(v, IS_USED_CFG(cfg))
156 161
157static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) 162static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
158{ 163{
@@ -226,7 +231,7 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len)
226 n += scnprintf(buf + n, len - n, "mpy[opt %d] ", opt); 231 n += scnprintf(buf + n, len - n, "mpy[opt %d] ", opt);
227 } 232 }
228 n += scnprintf(buf + n, len - n, "%s", 233 n += scnprintf(buf + n, len - n, "%s",
229 IS_USED(CONFIG_ARC_HAS_HW_MPY)); 234 IS_USED_CFG(CONFIG_ARC_HAS_HW_MPY));
230 } 235 }
231 236
232 n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n", 237 n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n",
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index 807f7d61d7a7..a6f91e88ce36 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -58,7 +58,6 @@ static void show_callee_regs(struct callee_regs *cregs)
58 58
59static void print_task_path_n_nm(struct task_struct *tsk, char *buf) 59static void print_task_path_n_nm(struct task_struct *tsk, char *buf)
60{ 60{
61 struct path path;
62 char *path_nm = NULL; 61 char *path_nm = NULL;
63 struct mm_struct *mm; 62 struct mm_struct *mm;
64 struct file *exe_file; 63 struct file *exe_file;
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index b29d62ed4f7e..1cd6695b6ab5 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -468,10 +468,18 @@ static void __ic_line_inv_vaddr(unsigned long paddr, unsigned long vaddr,
468noinline void slc_op(unsigned long paddr, unsigned long sz, const int op) 468noinline void slc_op(unsigned long paddr, unsigned long sz, const int op)
469{ 469{
470#ifdef CONFIG_ISA_ARCV2 470#ifdef CONFIG_ISA_ARCV2
471 /*
472 * SLC is shared between all cores and concurrent aux operations from
473 * multiple cores need to be serialized using a spinlock
474 * A concurrent operation can be silently ignored and/or the old/new
475 * operation can remain incomplete forever (lockup in SLC_CTRL_BUSY loop
476 * below)
477 */
478 static DEFINE_SPINLOCK(lock);
471 unsigned long flags; 479 unsigned long flags;
472 unsigned int ctrl; 480 unsigned int ctrl;
473 481
474 local_irq_save(flags); 482 spin_lock_irqsave(&lock, flags);
475 483
476 /* 484 /*
477 * The Region Flush operation is specified by CTRL.RGN_OP[11..9] 485 * The Region Flush operation is specified by CTRL.RGN_OP[11..9]
@@ -504,7 +512,7 @@ noinline void slc_op(unsigned long paddr, unsigned long sz, const int op)
504 512
505 while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY); 513 while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY);
506 514
507 local_irq_restore(flags); 515 spin_unlock_irqrestore(&lock, flags);
508#endif 516#endif
509} 517}
510 518
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 74a637a1cfc4..57706a9c6948 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -60,8 +60,8 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
60 60
61 /* This is kernel Virtual address (0x7000_0000 based) */ 61 /* This is kernel Virtual address (0x7000_0000 based) */
62 kvaddr = ioremap_nocache((unsigned long)paddr, size); 62 kvaddr = ioremap_nocache((unsigned long)paddr, size);
63 if (kvaddr != NULL) 63 if (kvaddr == NULL)
64 memset(kvaddr, 0, size); 64 return NULL;
65 65
66 /* This is bus address, platform dependent */ 66 /* This is bus address, platform dependent */
67 *dma_handle = (dma_addr_t)paddr; 67 *dma_handle = (dma_addr_t)paddr;
diff --git a/arch/arm/boot/dts/am335x-pepper.dts b/arch/arm/boot/dts/am335x-pepper.dts
index 0d35ab64641c..7106114c7464 100644
--- a/arch/arm/boot/dts/am335x-pepper.dts
+++ b/arch/arm/boot/dts/am335x-pepper.dts
@@ -74,6 +74,7 @@
74 audio_codec: tlv320aic3106@1b { 74 audio_codec: tlv320aic3106@1b {
75 compatible = "ti,tlv320aic3106"; 75 compatible = "ti,tlv320aic3106";
76 reg = <0x1b>; 76 reg = <0x1b>;
77 ai3x-micbias-vg = <0x2>;
77 }; 78 };
78 79
79 accel: lis331dlh@1d { 80 accel: lis331dlh@1d {
@@ -153,7 +154,7 @@
153 ti,audio-routing = 154 ti,audio-routing =
154 "Headphone Jack", "HPLOUT", 155 "Headphone Jack", "HPLOUT",
155 "Headphone Jack", "HPROUT", 156 "Headphone Jack", "HPROUT",
156 "LINE1L", "Line In"; 157 "MIC3L", "Mic3L Switch";
157}; 158};
158 159
159&mcasp0 { 160&mcasp0 {
@@ -438,41 +439,50 @@
438 regulators { 439 regulators {
439 dcdc1_reg: regulator@0 { 440 dcdc1_reg: regulator@0 {
440 /* VDD_1V8 system supply */ 441 /* VDD_1V8 system supply */
442 regulator-always-on;
441 }; 443 };
442 444
443 dcdc2_reg: regulator@1 { 445 dcdc2_reg: regulator@1 {
444 /* VDD_CORE voltage limits 0.95V - 1.26V with +/-4% tolerance */ 446 /* VDD_CORE voltage limits 0.95V - 1.26V with +/-4% tolerance */
445 regulator-name = "vdd_core"; 447 regulator-name = "vdd_core";
446 regulator-min-microvolt = <925000>; 448 regulator-min-microvolt = <925000>;
447 regulator-max-microvolt = <1325000>; 449 regulator-max-microvolt = <1150000>;
448 regulator-boot-on; 450 regulator-boot-on;
451 regulator-always-on;
449 }; 452 };
450 453
451 dcdc3_reg: regulator@2 { 454 dcdc3_reg: regulator@2 {
452 /* VDD_MPU voltage limits 0.95V - 1.1V with +/-4% tolerance */ 455 /* VDD_MPU voltage limits 0.95V - 1.1V with +/-4% tolerance */
453 regulator-name = "vdd_mpu"; 456 regulator-name = "vdd_mpu";
454 regulator-min-microvolt = <925000>; 457 regulator-min-microvolt = <925000>;
455 regulator-max-microvolt = <1150000>; 458 regulator-max-microvolt = <1325000>;
456 regulator-boot-on; 459 regulator-boot-on;
460 regulator-always-on;
457 }; 461 };
458 462
459 ldo1_reg: regulator@3 { 463 ldo1_reg: regulator@3 {
460 /* VRTC 1.8V always-on supply */ 464 /* VRTC 1.8V always-on supply */
465 regulator-name = "vrtc,vdds";
461 regulator-always-on; 466 regulator-always-on;
462 }; 467 };
463 468
464 ldo2_reg: regulator@4 { 469 ldo2_reg: regulator@4 {
465 /* 3.3V rail */ 470 /* 3.3V rail */
471 regulator-name = "vdd_3v3aux";
472 regulator-always-on;
466 }; 473 };
467 474
468 ldo3_reg: regulator@5 { 475 ldo3_reg: regulator@5 {
469 /* VDD_3V3A 3.3V rail */ 476 /* VDD_3V3A 3.3V rail */
477 regulator-name = "vdd_3v3a";
470 regulator-min-microvolt = <3300000>; 478 regulator-min-microvolt = <3300000>;
471 regulator-max-microvolt = <3300000>; 479 regulator-max-microvolt = <3300000>;
472 }; 480 };
473 481
474 ldo4_reg: regulator@6 { 482 ldo4_reg: regulator@6 {
475 /* VDD_3V3B 3.3V rail */ 483 /* VDD_3V3B 3.3V rail */
484 regulator-name = "vdd_3v3b";
485 regulator-always-on;
476 }; 486 };
477 }; 487 };
478}; 488};
diff --git a/arch/arm/boot/dts/cros-ec-keyboard.dtsi b/arch/arm/boot/dts/cros-ec-keyboard.dtsi
index 9c7fb0acae79..4e42f30cb318 100644
--- a/arch/arm/boot/dts/cros-ec-keyboard.dtsi
+++ b/arch/arm/boot/dts/cros-ec-keyboard.dtsi
@@ -22,6 +22,7 @@
22 MATRIX_KEY(0x00, 0x02, KEY_F1) 22 MATRIX_KEY(0x00, 0x02, KEY_F1)
23 MATRIX_KEY(0x00, 0x03, KEY_B) 23 MATRIX_KEY(0x00, 0x03, KEY_B)
24 MATRIX_KEY(0x00, 0x04, KEY_F10) 24 MATRIX_KEY(0x00, 0x04, KEY_F10)
25 MATRIX_KEY(0x00, 0x05, KEY_RO)
25 MATRIX_KEY(0x00, 0x06, KEY_N) 26 MATRIX_KEY(0x00, 0x06, KEY_N)
26 MATRIX_KEY(0x00, 0x08, KEY_EQUAL) 27 MATRIX_KEY(0x00, 0x08, KEY_EQUAL)
27 MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT) 28 MATRIX_KEY(0x00, 0x0a, KEY_RIGHTALT)
@@ -34,6 +35,7 @@
34 MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE) 35 MATRIX_KEY(0x01, 0x08, KEY_APOSTROPHE)
35 MATRIX_KEY(0x01, 0x09, KEY_F9) 36 MATRIX_KEY(0x01, 0x09, KEY_F9)
36 MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE) 37 MATRIX_KEY(0x01, 0x0b, KEY_BACKSPACE)
38 MATRIX_KEY(0x01, 0x0c, KEY_HENKAN)
37 39
38 MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL) 40 MATRIX_KEY(0x02, 0x00, KEY_LEFTCTRL)
39 MATRIX_KEY(0x02, 0x01, KEY_TAB) 41 MATRIX_KEY(0x02, 0x01, KEY_TAB)
@@ -45,6 +47,7 @@
45 MATRIX_KEY(0x02, 0x07, KEY_102ND) 47 MATRIX_KEY(0x02, 0x07, KEY_102ND)
46 MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE) 48 MATRIX_KEY(0x02, 0x08, KEY_LEFTBRACE)
47 MATRIX_KEY(0x02, 0x09, KEY_F8) 49 MATRIX_KEY(0x02, 0x09, KEY_F8)
50 MATRIX_KEY(0x02, 0x0a, KEY_YEN)
48 51
49 MATRIX_KEY(0x03, 0x01, KEY_GRAVE) 52 MATRIX_KEY(0x03, 0x01, KEY_GRAVE)
50 MATRIX_KEY(0x03, 0x02, KEY_F2) 53 MATRIX_KEY(0x03, 0x02, KEY_F2)
@@ -53,6 +56,7 @@
53 MATRIX_KEY(0x03, 0x06, KEY_6) 56 MATRIX_KEY(0x03, 0x06, KEY_6)
54 MATRIX_KEY(0x03, 0x08, KEY_MINUS) 57 MATRIX_KEY(0x03, 0x08, KEY_MINUS)
55 MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH) 58 MATRIX_KEY(0x03, 0x0b, KEY_BACKSLASH)
59 MATRIX_KEY(0x03, 0x0c, KEY_MUHENKAN)
56 60
57 MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL) 61 MATRIX_KEY(0x04, 0x00, KEY_RIGHTCTRL)
58 MATRIX_KEY(0x04, 0x01, KEY_A) 62 MATRIX_KEY(0x04, 0x01, KEY_A)
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index aa465904f6cc..096f68be99e2 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -686,7 +686,8 @@
686 686
687&dcan1 { 687&dcan1 {
688 status = "ok"; 688 status = "ok";
689 pinctrl-names = "default", "sleep"; 689 pinctrl-names = "default", "sleep", "active";
690 pinctrl-0 = <&dcan1_pins_default>; 690 pinctrl-0 = <&dcan1_pins_sleep>;
691 pinctrl-1 = <&dcan1_pins_sleep>; 691 pinctrl-1 = <&dcan1_pins_sleep>;
692 pinctrl-2 = <&dcan1_pins_default>;
692}; 693};
diff --git a/arch/arm/boot/dts/dra72-evm.dts b/arch/arm/boot/dts/dra72-evm.dts
index 4e1b60581782..803738414086 100644
--- a/arch/arm/boot/dts/dra72-evm.dts
+++ b/arch/arm/boot/dts/dra72-evm.dts
@@ -587,9 +587,10 @@
587 587
588&dcan1 { 588&dcan1 {
589 status = "ok"; 589 status = "ok";
590 pinctrl-names = "default", "sleep"; 590 pinctrl-names = "default", "sleep", "active";
591 pinctrl-0 = <&dcan1_pins_default>; 591 pinctrl-0 = <&dcan1_pins_sleep>;
592 pinctrl-1 = <&dcan1_pins_sleep>; 592 pinctrl-1 = <&dcan1_pins_sleep>;
593 pinctrl-2 = <&dcan1_pins_default>;
593}; 594};
594 595
595&qspi { 596&qspi {
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index c892d58e8dad..b995333ea22b 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -468,6 +468,7 @@
468 interrupts = <36 37 38 39 40 41 42 43 44>; 468 interrupts = <36 37 38 39 40 41 42 43 44>;
469 status = "disabled"; 469 status = "disabled";
470 clocks = <&clks 26>; 470 clocks = <&clks 26>;
471 #io-channel-cells = <1>;
471 }; 472 };
472 473
473 spdif@80054000 { 474 spdif@80054000 {
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index bc215e4b75fd..b69be5c499cf 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -108,7 +108,7 @@
108 }; 108 };
109 109
110 gpt1: timer@10003000 { 110 gpt1: timer@10003000 {
111 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 111 compatible = "fsl,imx27-gpt", "fsl,imx21-gpt";
112 reg = <0x10003000 0x1000>; 112 reg = <0x10003000 0x1000>;
113 interrupts = <26>; 113 interrupts = <26>;
114 clocks = <&clks IMX27_CLK_GPT1_IPG_GATE>, 114 clocks = <&clks IMX27_CLK_GPT1_IPG_GATE>,
@@ -117,7 +117,7 @@
117 }; 117 };
118 118
119 gpt2: timer@10004000 { 119 gpt2: timer@10004000 {
120 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 120 compatible = "fsl,imx27-gpt", "fsl,imx21-gpt";
121 reg = <0x10004000 0x1000>; 121 reg = <0x10004000 0x1000>;
122 interrupts = <25>; 122 interrupts = <25>;
123 clocks = <&clks IMX27_CLK_GPT2_IPG_GATE>, 123 clocks = <&clks IMX27_CLK_GPT2_IPG_GATE>,
@@ -126,7 +126,7 @@
126 }; 126 };
127 127
128 gpt3: timer@10005000 { 128 gpt3: timer@10005000 {
129 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 129 compatible = "fsl,imx27-gpt", "fsl,imx21-gpt";
130 reg = <0x10005000 0x1000>; 130 reg = <0x10005000 0x1000>;
131 interrupts = <24>; 131 interrupts = <24>;
132 clocks = <&clks IMX27_CLK_GPT3_IPG_GATE>, 132 clocks = <&clks IMX27_CLK_GPT3_IPG_GATE>,
@@ -376,7 +376,7 @@
376 }; 376 };
377 377
378 gpt4: timer@10019000 { 378 gpt4: timer@10019000 {
379 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 379 compatible = "fsl,imx27-gpt", "fsl,imx21-gpt";
380 reg = <0x10019000 0x1000>; 380 reg = <0x10019000 0x1000>;
381 interrupts = <4>; 381 interrupts = <4>;
382 clocks = <&clks IMX27_CLK_GPT4_IPG_GATE>, 382 clocks = <&clks IMX27_CLK_GPT4_IPG_GATE>,
@@ -385,7 +385,7 @@
385 }; 385 };
386 386
387 gpt5: timer@1001a000 { 387 gpt5: timer@1001a000 {
388 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 388 compatible = "fsl,imx27-gpt", "fsl,imx21-gpt";
389 reg = <0x1001a000 0x1000>; 389 reg = <0x1001a000 0x1000>;
390 interrupts = <3>; 390 interrupts = <3>;
391 clocks = <&clks IMX27_CLK_GPT5_IPG_GATE>, 391 clocks = <&clks IMX27_CLK_GPT5_IPG_GATE>,
@@ -436,7 +436,7 @@
436 }; 436 };
437 437
438 gpt6: timer@1001f000 { 438 gpt6: timer@1001f000 {
439 compatible = "fsl,imx27-gpt", "fsl,imx1-gpt"; 439 compatible = "fsl,imx27-gpt", "fsl,imx21-gpt";
440 reg = <0x1001f000 0x1000>; 440 reg = <0x1001f000 0x1000>;
441 interrupts = <2>; 441 interrupts = <2>;
442 clocks = <&clks IMX27_CLK_GPT6_IPG_GATE>, 442 clocks = <&clks IMX27_CLK_GPT6_IPG_GATE>,
diff --git a/arch/arm/boot/dts/imx53-qsb-common.dtsi b/arch/arm/boot/dts/imx53-qsb-common.dtsi
index 181ae5ebf23f..ab4ba39f2ed9 100644
--- a/arch/arm/boot/dts/imx53-qsb-common.dtsi
+++ b/arch/arm/boot/dts/imx53-qsb-common.dtsi
@@ -295,9 +295,10 @@
295&tve { 295&tve {
296 pinctrl-names = "default"; 296 pinctrl-names = "default";
297 pinctrl-0 = <&pinctrl_vga_sync>; 297 pinctrl-0 = <&pinctrl_vga_sync>;
298 ddc-i2c-bus = <&i2c2>;
298 fsl,tve-mode = "vga"; 299 fsl,tve-mode = "vga";
299 fsl,hsync-pin = <4>; 300 fsl,hsync-pin = <7>; /* IPU DI1 PIN7 via EIM_OE */
300 fsl,vsync-pin = <6>; 301 fsl,vsync-pin = <8>; /* IPU DI1 PIN8 via EIM_RW */
301 status = "okay"; 302 status = "okay";
302}; 303};
303 304
diff --git a/arch/arm/boot/dts/k2e.dtsi b/arch/arm/boot/dts/k2e.dtsi
index 50e555eab50d..1b6494fbdb91 100644
--- a/arch/arm/boot/dts/k2e.dtsi
+++ b/arch/arm/boot/dts/k2e.dtsi
@@ -86,7 +86,7 @@
86 gpio,syscon-dev = <&devctrl 0x240>; 86 gpio,syscon-dev = <&devctrl 0x240>;
87 }; 87 };
88 88
89 pcie@21020000 { 89 pcie1: pcie@21020000 {
90 compatible = "ti,keystone-pcie","snps,dw-pcie"; 90 compatible = "ti,keystone-pcie","snps,dw-pcie";
91 clocks = <&clkpcie1>; 91 clocks = <&clkpcie1>;
92 clock-names = "pcie"; 92 clock-names = "pcie";
@@ -96,6 +96,7 @@
96 ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000 96 ranges = <0x81000000 0 0 0x23260000 0x4000 0x4000
97 0x82000000 0 0x60000000 0x60000000 0 0x10000000>; 97 0x82000000 0 0x60000000 0x60000000 0 0x10000000>;
98 98
99 status = "disabled";
99 device_type = "pci"; 100 device_type = "pci";
100 num-lanes = <2>; 101 num-lanes = <2>;
101 102
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi
index c06542b2c954..e7a6f6deabb6 100644
--- a/arch/arm/boot/dts/keystone.dtsi
+++ b/arch/arm/boot/dts/keystone.dtsi
@@ -286,7 +286,7 @@
286 ti,syscon-dev = <&devctrl 0x2a0>; 286 ti,syscon-dev = <&devctrl 0x2a0>;
287 }; 287 };
288 288
289 pcie@21800000 { 289 pcie0: pcie@21800000 {
290 compatible = "ti,keystone-pcie", "snps,dw-pcie"; 290 compatible = "ti,keystone-pcie", "snps,dw-pcie";
291 clocks = <&clkpcie>; 291 clocks = <&clkpcie>;
292 clock-names = "pcie"; 292 clock-names = "pcie";
@@ -296,6 +296,7 @@
296 ranges = <0x81000000 0 0 0x23250000 0 0x4000 296 ranges = <0x81000000 0 0 0x23250000 0 0x4000
297 0x82000000 0 0x50000000 0x50000000 0 0x10000000>; 297 0x82000000 0 0x50000000 0x50000000 0 0x10000000>;
298 298
299 status = "disabled";
299 device_type = "pci"; 300 device_type = "pci";
300 num-lanes = <2>; 301 num-lanes = <2>;
301 302
diff --git a/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi b/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi
index 233c69e50ae3..df8908adb0cb 100644
--- a/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-common-lcd35.dtsi
@@ -120,7 +120,7 @@
120 120
121 lcd0: display@0 { 121 lcd0: display@0 {
122 compatible = "lgphilips,lb035q02"; 122 compatible = "lgphilips,lb035q02";
123 label = "lcd"; 123 label = "lcd35";
124 124
125 reg = <1>; /* CS1 */ 125 reg = <1>; /* CS1 */
126 spi-max-frequency = <10000000>; 126 spi-max-frequency = <10000000>;
diff --git a/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi b/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi
index f5395b7da912..048fd216970a 100644
--- a/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi
+++ b/arch/arm/boot/dts/omap3-overo-common-lcd43.dtsi
@@ -98,7 +98,7 @@
98 98
99 lcd0: display@0 { 99 lcd0: display@0 {
100 compatible = "samsung,lte430wq-f0c", "panel-dpi"; 100 compatible = "samsung,lte430wq-f0c", "panel-dpi";
101 label = "lcd"; 101 label = "lcd43";
102 102
103 pinctrl-names = "default"; 103 pinctrl-names = "default";
104 pinctrl-0 = <&lte430_pins>; 104 pinctrl-0 = <&lte430_pins>;
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index f884d6adb71e..7d31c6ff246f 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -551,6 +551,7 @@
551 reg = <0x4a066000 0x100>; 551 reg = <0x4a066000 0x100>;
552 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; 552 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
553 ti,hwmods = "mmu_dsp"; 553 ti,hwmods = "mmu_dsp";
554 #iommu-cells = <0>;
554 }; 555 };
555 556
556 mmu_ipu: mmu@55082000 { 557 mmu_ipu: mmu@55082000 {
@@ -558,6 +559,7 @@
558 reg = <0x55082000 0x100>; 559 reg = <0x55082000 0x100>;
559 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; 560 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
560 ti,hwmods = "mmu_ipu"; 561 ti,hwmods = "mmu_ipu";
562 #iommu-cells = <0>;
561 ti,iommu-bus-err-back; 563 ti,iommu-bus-err-back;
562 }; 564 };
563 565
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 7d24ae0306b5..c8fd648a7108 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -612,6 +612,7 @@
612 reg = <0x4a066000 0x100>; 612 reg = <0x4a066000 0x100>;
613 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; 613 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
614 ti,hwmods = "mmu_dsp"; 614 ti,hwmods = "mmu_dsp";
615 #iommu-cells = <0>;
615 }; 616 };
616 617
617 mmu_ipu: mmu@55082000 { 618 mmu_ipu: mmu@55082000 {
@@ -619,6 +620,7 @@
619 reg = <0x55082000 0x100>; 620 reg = <0x55082000 0x100>;
620 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; 621 interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
621 ti,hwmods = "mmu_ipu"; 622 ti,hwmods = "mmu_ipu";
623 #iommu-cells = <0>;
622 ti,iommu-bus-err-back; 624 ti,iommu-bus-err-back;
623 }; 625 };
624 626
diff --git a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
index 71468a7eb28f..5e17fd147728 100644
--- a/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
+++ b/arch/arm/boot/dts/socfpga_cyclone5_sockit.dts
@@ -60,27 +60,27 @@
60 rxc-skew-ps = <2000>; 60 rxc-skew-ps = <2000>;
61}; 61};
62 62
63&mmc0 {
64 vmmc-supply = <&regulator_3_3v>;
65 vqmmc-supply = <&regulator_3_3v>;
66};
67
68&usb1 {
69 status = "okay";
70};
71
72&gpio2 { 63&gpio2 {
73 status = "okay"; 64 status = "okay";
74}; 65};
75 66
76&i2c1{ 67&i2c1 {
77 status = "okay"; 68 status = "okay";
78 69
79 accel1: accel1@53{ 70 accel1: accelerometer@53 {
80 compatible = "adxl34x"; 71 compatible = "adi,adxl345";
81 reg = <0x53>; 72 reg = <0x53>;
82 73
83 interrupt-parent = < &portc >; 74 interrupt-parent = <&portc>;
84 interrupts = <3 2>; 75 interrupts = <3 2>;
85 }; 76 };
86}; 77};
78
79&mmc0 {
80 vmmc-supply = <&regulator_3_3v>;
81 vqmmc-supply = <&regulator_3_3v>;
82};
83
84&usb1 {
85 status = "okay";
86};
diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts
index d42c84b1df8d..e48857249ce7 100644
--- a/arch/arm/boot/dts/spear1310-evb.dts
+++ b/arch/arm/boot/dts/spear1310-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr1310 Evaluation Baord 2 * DTS file for SPEAr1310 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 9d342920695a..54bc6d3cf290 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr1310 SoCs 2 * DTS file for all SPEAr1310 SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts
index b23e05ed1d60..c611f5606dfe 100644
--- a/arch/arm/boot/dts/spear1340-evb.dts
+++ b/arch/arm/boot/dts/spear1340-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr1340 Evaluation Baord 2 * DTS file for SPEAr1340 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 13e1aa33daa2..df2232d767ed 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr1340 SoCs 2 * DTS file for all SPEAr1340 SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear13xx.dtsi b/arch/arm/boot/dts/spear13xx.dtsi
index 40accc87e3a2..14594ce8c18a 100644
--- a/arch/arm/boot/dts/spear13xx.dtsi
+++ b/arch/arm/boot/dts/spear13xx.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr13xx SoCs 2 * DTS file for all SPEAr13xx SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear300-evb.dts b/arch/arm/boot/dts/spear300-evb.dts
index 5de1431653e4..e859e8288bcd 100644
--- a/arch/arm/boot/dts/spear300-evb.dts
+++ b/arch/arm/boot/dts/spear300-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr300 Evaluation Baord 2 * DTS file for SPEAr300 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear300.dtsi b/arch/arm/boot/dts/spear300.dtsi
index f79b3dfaabe6..f4e92e599729 100644
--- a/arch/arm/boot/dts/spear300.dtsi
+++ b/arch/arm/boot/dts/spear300.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr300 SoC 2 * DTS file for SPEAr300 SoC
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear310-evb.dts b/arch/arm/boot/dts/spear310-evb.dts
index b09632963d15..070f2c1b7851 100644
--- a/arch/arm/boot/dts/spear310-evb.dts
+++ b/arch/arm/boot/dts/spear310-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr310 Evaluation Baord 2 * DTS file for SPEAr310 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index 95372080eea6..da210b454753 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr310 SoC 2 * DTS file for SPEAr310 SoC
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts
index fdedbb514102..1b1034477923 100644
--- a/arch/arm/boot/dts/spear320-evb.dts
+++ b/arch/arm/boot/dts/spear320-evb.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr320 Evaluation Baord 2 * DTS file for SPEAr320 Evaluation Baord
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index ffea342aeec9..22be6e5edaac 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for SPEAr320 SoC 2 * DTS file for SPEAr320 SoC
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/spear3xx.dtsi b/arch/arm/boot/dts/spear3xx.dtsi
index f0e3fcf8e323..118135d75899 100644
--- a/arch/arm/boot/dts/spear3xx.dtsi
+++ b/arch/arm/boot/dts/spear3xx.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * DTS file for all SPEAr3xx SoCs 2 * DTS file for all SPEAr3xx SoCs
3 * 3 *
4 * Copyright 2012 Viresh Kumar <viresh.linux@gmail.com> 4 * Copyright 2012 Viresh Kumar <vireshk@kernel.org>
5 * 5 *
6 * The code contained herein is licensed under the GNU General Public 6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License 7 * License. You may obtain a copy of the GNU General Public License
diff --git a/arch/arm/boot/dts/ste-ccu8540.dts b/arch/arm/boot/dts/ste-ccu8540.dts
index 32dd55e5f4e6..6eaaf638e52e 100644
--- a/arch/arm/boot/dts/ste-ccu8540.dts
+++ b/arch/arm/boot/dts/ste-ccu8540.dts
@@ -17,6 +17,13 @@
17 model = "ST-Ericsson U8540 platform with Device Tree"; 17 model = "ST-Ericsson U8540 platform with Device Tree";
18 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540"; 18 compatible = "st-ericsson,ccu8540", "st-ericsson,u8540";
19 19
20 /* This stablilizes the serial port enumeration */
21 aliases {
22 serial0 = &ux500_serial0;
23 serial1 = &ux500_serial1;
24 serial2 = &ux500_serial2;
25 };
26
20 memory@0 { 27 memory@0 {
21 device_type = "memory"; 28 device_type = "memory";
22 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>; 29 reg = <0x20000000 0x1f000000>, <0xc0000000 0x3f000000>;
diff --git a/arch/arm/boot/dts/ste-ccu9540.dts b/arch/arm/boot/dts/ste-ccu9540.dts
index 651c56d400a4..c8b815819cfe 100644
--- a/arch/arm/boot/dts/ste-ccu9540.dts
+++ b/arch/arm/boot/dts/ste-ccu9540.dts
@@ -16,6 +16,13 @@
16 model = "ST-Ericsson CCU9540 platform with Device Tree"; 16 model = "ST-Ericsson CCU9540 platform with Device Tree";
17 compatible = "st-ericsson,ccu9540", "st-ericsson,u9540"; 17 compatible = "st-ericsson,ccu9540", "st-ericsson,u9540";
18 18
19 /* This stablilizes the serial port enumeration */
20 aliases {
21 serial0 = &ux500_serial0;
22 serial1 = &ux500_serial1;
23 serial2 = &ux500_serial2;
24 };
25
19 memory { 26 memory {
20 reg = <0x00000000 0x20000000>; 27 reg = <0x00000000 0x20000000>;
21 }; 28 };
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi
index 853684ad7773..a75f3289e653 100644
--- a/arch/arm/boot/dts/ste-dbx5x0.dtsi
+++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi
@@ -971,7 +971,7 @@
971 power-domains = <&pm_domains DOMAIN_VAPE>; 971 power-domains = <&pm_domains DOMAIN_VAPE>;
972 }; 972 };
973 973
974 uart@80120000 { 974 ux500_serial0: uart@80120000 {
975 compatible = "arm,pl011", "arm,primecell"; 975 compatible = "arm,pl011", "arm,primecell";
976 reg = <0x80120000 0x1000>; 976 reg = <0x80120000 0x1000>;
977 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>; 977 interrupts = <0 11 IRQ_TYPE_LEVEL_HIGH>;
@@ -986,7 +986,7 @@
986 status = "disabled"; 986 status = "disabled";
987 }; 987 };
988 988
989 uart@80121000 { 989 ux500_serial1: uart@80121000 {
990 compatible = "arm,pl011", "arm,primecell"; 990 compatible = "arm,pl011", "arm,primecell";
991 reg = <0x80121000 0x1000>; 991 reg = <0x80121000 0x1000>;
992 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>; 992 interrupts = <0 19 IRQ_TYPE_LEVEL_HIGH>;
@@ -1001,7 +1001,7 @@
1001 status = "disabled"; 1001 status = "disabled";
1002 }; 1002 };
1003 1003
1004 uart@80007000 { 1004 ux500_serial2: uart@80007000 {
1005 compatible = "arm,pl011", "arm,primecell"; 1005 compatible = "arm,pl011", "arm,primecell";
1006 reg = <0x80007000 0x1000>; 1006 reg = <0x80007000 0x1000>;
1007 interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; 1007 interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/ste-href.dtsi b/arch/arm/boot/dts/ste-href.dtsi
index 744c1e3a744d..6d8ce154347e 100644
--- a/arch/arm/boot/dts/ste-href.dtsi
+++ b/arch/arm/boot/dts/ste-href.dtsi
@@ -32,11 +32,11 @@
32 status = "okay"; 32 status = "okay";
33 }; 33 };
34 34
35 /* This UART is unused and thus left disabled */
35 uart@80121000 { 36 uart@80121000 {
36 pinctrl-names = "default", "sleep"; 37 pinctrl-names = "default", "sleep";
37 pinctrl-0 = <&uart1_default_mode>; 38 pinctrl-0 = <&uart1_default_mode>;
38 pinctrl-1 = <&uart1_sleep_mode>; 39 pinctrl-1 = <&uart1_sleep_mode>;
39 status = "okay";
40 }; 40 };
41 41
42 uart@80007000 { 42 uart@80007000 {
diff --git a/arch/arm/boot/dts/ste-hrefprev60-stuib.dts b/arch/arm/boot/dts/ste-hrefprev60-stuib.dts
index 2b1cb5b584b6..18e9795a94f9 100644
--- a/arch/arm/boot/dts/ste-hrefprev60-stuib.dts
+++ b/arch/arm/boot/dts/ste-hrefprev60-stuib.dts
@@ -17,6 +17,13 @@
17 model = "ST-Ericsson HREF (pre-v60) and ST UIB"; 17 model = "ST-Ericsson HREF (pre-v60) and ST UIB";
18 compatible = "st-ericsson,mop500", "st-ericsson,u8500"; 18 compatible = "st-ericsson,mop500", "st-ericsson,u8500";
19 19
20 /* This stablilizes the serial port enumeration */
21 aliases {
22 serial0 = &ux500_serial0;
23 serial1 = &ux500_serial1;
24 serial2 = &ux500_serial2;
25 };
26
20 soc { 27 soc {
21 /* Reset line for the BU21013 touchscreen */ 28 /* Reset line for the BU21013 touchscreen */
22 i2c@80110000 { 29 i2c@80110000 {
diff --git a/arch/arm/boot/dts/ste-hrefprev60-tvk.dts b/arch/arm/boot/dts/ste-hrefprev60-tvk.dts
index 59523f866812..24739914e689 100644
--- a/arch/arm/boot/dts/ste-hrefprev60-tvk.dts
+++ b/arch/arm/boot/dts/ste-hrefprev60-tvk.dts
@@ -16,4 +16,11 @@
16/ { 16/ {
17 model = "ST-Ericsson HREF (pre-v60) and TVK1281618 UIB"; 17 model = "ST-Ericsson HREF (pre-v60) and TVK1281618 UIB";
18 compatible = "st-ericsson,mop500", "st-ericsson,u8500"; 18 compatible = "st-ericsson,mop500", "st-ericsson,u8500";
19
20 /* This stablilizes the serial port enumeration */
21 aliases {
22 serial0 = &ux500_serial0;
23 serial1 = &ux500_serial1;
24 serial2 = &ux500_serial2;
25 };
19}; 26};
diff --git a/arch/arm/boot/dts/ste-hrefprev60.dtsi b/arch/arm/boot/dts/ste-hrefprev60.dtsi
index 7f3975b58d16..b0278f4c486c 100644
--- a/arch/arm/boot/dts/ste-hrefprev60.dtsi
+++ b/arch/arm/boot/dts/ste-hrefprev60.dtsi
@@ -23,6 +23,11 @@
23 }; 23 };
24 24
25 soc { 25 soc {
26 /* Enable UART1 on this board */
27 uart@80121000 {
28 status = "okay";
29 };
30
26 i2c@80004000 { 31 i2c@80004000 {
27 tps61052@33 { 32 tps61052@33 {
28 compatible = "tps61052"; 33 compatible = "tps61052";
diff --git a/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts b/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts
index 8c6a2de56cf1..c2e1ba019a2f 100644
--- a/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts
+++ b/arch/arm/boot/dts/ste-hrefv60plus-stuib.dts
@@ -19,6 +19,13 @@
19 model = "ST-Ericsson HREF (v60+) and ST UIB"; 19 model = "ST-Ericsson HREF (v60+) and ST UIB";
20 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; 20 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
21 21
22 /* This stablilizes the serial port enumeration */
23 aliases {
24 serial0 = &ux500_serial0;
25 serial1 = &ux500_serial1;
26 serial2 = &ux500_serial2;
27 };
28
22 soc { 29 soc {
23 /* Reset line for the BU21013 touchscreen */ 30 /* Reset line for the BU21013 touchscreen */
24 i2c@80110000 { 31 i2c@80110000 {
diff --git a/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts b/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts
index d53cccdce776..ebd8547e98f1 100644
--- a/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts
+++ b/arch/arm/boot/dts/ste-hrefv60plus-tvk.dts
@@ -18,4 +18,11 @@
18/ { 18/ {
19 model = "ST-Ericsson HREF (v60+) and TVK1281618 UIB"; 19 model = "ST-Ericsson HREF (v60+) and TVK1281618 UIB";
20 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500"; 20 compatible = "st-ericsson,hrefv60+", "st-ericsson,u8500";
21
22 /* This stablilizes the serial port enumeration */
23 aliases {
24 serial0 = &ux500_serial0;
25 serial1 = &ux500_serial1;
26 serial2 = &ux500_serial2;
27 };
21}; 28};
diff --git a/arch/arm/boot/dts/ste-hrefv60plus.dtsi b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
index a4bc9e77d640..810cda743b6d 100644
--- a/arch/arm/boot/dts/ste-hrefv60plus.dtsi
+++ b/arch/arm/boot/dts/ste-hrefv60plus.dtsi
@@ -43,15 +43,26 @@
43 <&vaudio_hf_hrefv60_mode>, 43 <&vaudio_hf_hrefv60_mode>,
44 <&gbf_hrefv60_mode>, 44 <&gbf_hrefv60_mode>,
45 <&hdtv_hrefv60_mode>, 45 <&hdtv_hrefv60_mode>,
46 <&touch_hrefv60_mode>; 46 <&touch_hrefv60_mode>,
47 <&gpios_hrefv60_mode>;
47 48
48 sdi0 { 49 sdi0 {
49 /* SD card detect GPIO pin, extend default state */
50 sdi0_default_mode: sdi0_default { 50 sdi0_default_mode: sdi0_default {
51 /* SD card detect GPIO pin, extend default state */
51 default_hrefv60_cfg1 { 52 default_hrefv60_cfg1 {
52 pins = "GPIO95_E8"; 53 pins = "GPIO95_E8";
53 ste,config = <&gpio_in_pu>; 54 ste,config = <&gpio_in_pu>;
54 }; 55 };
56 /* VMMCI level-shifter enable */
57 default_hrefv60_cfg2 {
58 pins = "GPIO169_D22";
59 ste,config = <&gpio_out_lo>;
60 };
61 /* VMMCI level-shifter voltage select */
62 default_hrefv60_cfg3 {
63 pins = "GPIO5_AG6";
64 ste,config = <&gpio_out_hi>;
65 };
55 }; 66 };
56 }; 67 };
57 ipgpio { 68 ipgpio {
@@ -213,6 +224,16 @@
213 }; 224 };
214 }; 225 };
215 }; 226 };
227 gpios {
228 /* Dangling GPIO pins */
229 gpios_hrefv60_mode: gpios_hrefv60 {
230 default_cfg1 {
231 /* Normally UART1 RXD, now dangling */
232 pins = "GPIO4_AH6";
233 ste,config = <&in_pu>;
234 };
235 };
236 };
216 }; 237 };
217 }; 238 };
218}; 239};
diff --git a/arch/arm/boot/dts/ste-snowball.dts b/arch/arm/boot/dts/ste-snowball.dts
index 9edadc37719f..32a5ccb14e7e 100644
--- a/arch/arm/boot/dts/ste-snowball.dts
+++ b/arch/arm/boot/dts/ste-snowball.dts
@@ -18,6 +18,13 @@
18 model = "Calao Systems Snowball platform with device tree"; 18 model = "Calao Systems Snowball platform with device tree";
19 compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500"; 19 compatible = "calaosystems,snowball-a9500", "st-ericsson,u9500";
20 20
21 /* This stablilizes the serial port enumeration */
22 aliases {
23 serial0 = &ux500_serial0;
24 serial1 = &ux500_serial1;
25 serial2 = &ux500_serial2;
26 };
27
21 memory { 28 memory {
22 reg = <0x00000000 0x20000000>; 29 reg = <0x00000000 0x20000000>;
23 }; 30 };
@@ -223,11 +230,11 @@
223 status = "okay"; 230 status = "okay";
224 }; 231 };
225 232
233 /* This UART is unused and thus left disabled */
226 uart@80121000 { 234 uart@80121000 {
227 pinctrl-names = "default", "sleep"; 235 pinctrl-names = "default", "sleep";
228 pinctrl-0 = <&uart1_default_mode>; 236 pinctrl-0 = <&uart1_default_mode>;
229 pinctrl-1 = <&uart1_sleep_mode>; 237 pinctrl-1 = <&uart1_sleep_mode>;
230 status = "okay";
231 }; 238 };
232 239
233 uart@80007000 { 240 uart@80007000 {
@@ -452,7 +459,21 @@
452 pins = "GPIO21_AB3"; /* DAT31DIR */ 459 pins = "GPIO21_AB3"; /* DAT31DIR */
453 ste,config = <&out_hi>; 460 ste,config = <&out_hi>;
454 }; 461 };
455 462 /* SD card detect GPIO pin, extend default state */
463 snowball_cfg2 {
464 pins = "GPIO218_AH11";
465 ste,config = <&gpio_in_pu>;
466 };
467 /* VMMCI level-shifter enable */
468 snowball_cfg3 {
469 pins = "GPIO217_AH12";
470 ste,config = <&gpio_out_lo>;
471 };
472 /* VMMCI level-shifter voltage select */
473 snowball_cfg4 {
474 pins = "GPIO228_AJ6";
475 ste,config = <&gpio_out_hi>;
476 };
456 }; 477 };
457 }; 478 };
458 ssp0 { 479 ssp0 {
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 83c50193626c..30b3bc1666d2 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += kdebug.h
13generic-y += local.h 13generic-y += local.h
14generic-y += local64.h 14generic-y += local64.h
15generic-y += mcs_spinlock.h 15generic-y += mcs_spinlock.h
16generic-y += mm-arch-hooks.h
16generic-y += msgbuf.h 17generic-y += msgbuf.h
17generic-y += param.h 18generic-y += param.h
18generic-y += parport.h 19generic-y += parport.h
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 6f225acc07c5..b7f6fb462ea0 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -286,7 +286,7 @@ extern phys_addr_t (*arch_virt_to_idmap)(unsigned long x);
286 */ 286 */
287static inline phys_addr_t __virt_to_idmap(unsigned long x) 287static inline phys_addr_t __virt_to_idmap(unsigned long x)
288{ 288{
289 if (arch_virt_to_idmap) 289 if (IS_ENABLED(CONFIG_MMU) && arch_virt_to_idmap)
290 return arch_virt_to_idmap(x); 290 return arch_virt_to_idmap(x);
291 else 291 else
292 return __virt_to_phys(x); 292 return __virt_to_phys(x);
diff --git a/arch/arm/include/asm/mm-arch-hooks.h b/arch/arm/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 7056660c7cc4..000000000000
--- a/arch/arm/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_ARM_MM_ARCH_HOOKS_H
13#define _ASM_ARM_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_ARM_MM_ARCH_HOOKS_H */
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 357f57ea83f4..54272e0be713 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -818,12 +818,13 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
818 if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL)) 818 if (arch_find_n_match_cpu_physical_id(dn, cpu, NULL))
819 break; 819 break;
820 820
821 of_node_put(dn);
822 if (cpu >= nr_cpu_ids) { 821 if (cpu >= nr_cpu_ids) {
823 pr_warn("Failed to find logical CPU for %s\n", 822 pr_warn("Failed to find logical CPU for %s\n",
824 dn->name); 823 dn->name);
824 of_node_put(dn);
825 break; 825 break;
826 } 826 }
827 of_node_put(dn);
827 828
828 irqs[i] = cpu; 829 irqs[i] = cpu;
829 cpumask_set_cpu(cpu, &pmu->supported_cpus); 830 cpumask_set_cpu(cpu, &pmu->supported_cpus);
diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c
index 1a4d232796be..38269358fd25 100644
--- a/arch/arm/kernel/reboot.c
+++ b/arch/arm/kernel/reboot.c
@@ -50,7 +50,7 @@ static void __soft_restart(void *addr)
50 flush_cache_all(); 50 flush_cache_all();
51 51
52 /* Switch to the identity mapping. */ 52 /* Switch to the identity mapping. */
53 phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset); 53 phys_reset = (phys_reset_t)(unsigned long)virt_to_idmap(cpu_reset);
54 phys_reset((unsigned long)addr); 54 phys_reset((unsigned long)addr);
55 55
56 /* Should never get here. */ 56 /* Should never get here. */
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 80bad29d609a..8c4467fad837 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -291,8 +291,6 @@ void __init imx_gpc_check_dt(void)
291 } 291 }
292} 292}
293 293
294#ifdef CONFIG_PM_GENERIC_DOMAINS
295
296static void _imx6q_pm_pu_power_off(struct generic_pm_domain *genpd) 294static void _imx6q_pm_pu_power_off(struct generic_pm_domain *genpd)
297{ 295{
298 int iso, iso2sw; 296 int iso, iso2sw;
@@ -399,7 +397,6 @@ static struct genpd_onecell_data imx_gpc_onecell_data = {
399static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg) 397static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
400{ 398{
401 struct clk *clk; 399 struct clk *clk;
402 bool is_off;
403 int i; 400 int i;
404 401
405 imx6q_pu_domain.reg = pu_reg; 402 imx6q_pu_domain.reg = pu_reg;
@@ -416,18 +413,13 @@ static int imx_gpc_genpd_init(struct device *dev, struct regulator *pu_reg)
416 } 413 }
417 imx6q_pu_domain.num_clks = i; 414 imx6q_pu_domain.num_clks = i;
418 415
419 is_off = IS_ENABLED(CONFIG_PM); 416 /* Enable power always in case bootloader disabled it. */
420 if (is_off) { 417 imx6q_pm_pu_power_on(&imx6q_pu_domain.base);
421 _imx6q_pm_pu_power_off(&imx6q_pu_domain.base); 418
422 } else { 419 if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
423 /* 420 return 0;
424 * Enable power if compiled without CONFIG_PM in case the
425 * bootloader disabled it.
426 */
427 imx6q_pm_pu_power_on(&imx6q_pu_domain.base);
428 }
429 421
430 pm_genpd_init(&imx6q_pu_domain.base, NULL, is_off); 422 pm_genpd_init(&imx6q_pu_domain.base, NULL, false);
431 return of_genpd_add_provider_onecell(dev->of_node, 423 return of_genpd_add_provider_onecell(dev->of_node,
432 &imx_gpc_onecell_data); 424 &imx_gpc_onecell_data);
433 425
@@ -437,13 +429,6 @@ clk_err:
437 return -EINVAL; 429 return -EINVAL;
438} 430}
439 431
440#else
441static inline int imx_gpc_genpd_init(struct device *dev, struct regulator *reg)
442{
443 return 0;
444}
445#endif /* CONFIG_PM_GENERIC_DOMAINS */
446
447static int imx_gpc_probe(struct platform_device *pdev) 432static int imx_gpc_probe(struct platform_device *pdev)
448{ 433{
449 struct regulator *pu_reg; 434 struct regulator *pu_reg;
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index ecc04ff13e95..4a023e8d1bdb 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -60,6 +60,7 @@ config SOC_AM43XX
60 select ARM_GIC 60 select ARM_GIC
61 select MACH_OMAP_GENERIC 61 select MACH_OMAP_GENERIC
62 select MIGHT_HAVE_CACHE_L2X0 62 select MIGHT_HAVE_CACHE_L2X0
63 select HAVE_ARM_SCU
63 64
64config SOC_DRA7XX 65config SOC_DRA7XX
65 bool "TI DRA7XX" 66 bool "TI DRA7XX"
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c
index c092730749b9..bf366b39fa61 100644
--- a/arch/arm/mach-pxa/capc7117.c
+++ b/arch/arm/mach-pxa/capc7117.c
@@ -24,6 +24,7 @@
24#include <linux/ata_platform.h> 24#include <linux/ata_platform.h>
25#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/regulator/machine.h>
27 28
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
@@ -144,6 +145,8 @@ static void __init capc7117_init(void)
144 145
145 capc7117_uarts_init(); 146 capc7117_uarts_init();
146 capc7117_ide_init(); 147 capc7117_ide_init();
148
149 regulator_has_full_constraints();
147} 150}
148 151
149MACHINE_START(CAPC7117, 152MACHINE_START(CAPC7117,
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index bb99f59a36d8..a17a91eb8e9a 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -13,6 +13,7 @@
13#include <linux/syscore_ops.h> 13#include <linux/syscore_ops.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16#include <linux/regulator/machine.h>
16 17
17#include <linux/dm9000.h> 18#include <linux/dm9000.h>
18#include <linux/leds.h> 19#include <linux/leds.h>
@@ -466,6 +467,8 @@ static void __init cmx2xx_init(void)
466 cmx2xx_init_ac97(); 467 cmx2xx_init_ac97();
467 cmx2xx_init_touchscreen(); 468 cmx2xx_init_touchscreen();
468 cmx2xx_init_leds(); 469 cmx2xx_init_leds();
470
471 regulator_has_full_constraints();
469} 472}
470 473
471static void __init cmx2xx_init_irq(void) 474static void __init cmx2xx_init_irq(void)
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 4d3588d26c2a..5851f4c254c1 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -835,6 +835,8 @@ static void __init cm_x300_init(void)
835 cm_x300_init_ac97(); 835 cm_x300_init_ac97();
836 cm_x300_init_wi2wi(); 836 cm_x300_init_wi2wi();
837 cm_x300_init_bl(); 837 cm_x300_init_bl();
838
839 regulator_has_full_constraints();
838} 840}
839 841
840static void __init cm_x300_fixup(struct tag *tags, char **cmdline) 842static void __init cm_x300_fixup(struct tag *tags, char **cmdline)
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c
index 5f9d9303b346..3503826333c7 100644
--- a/arch/arm/mach-pxa/colibri-pxa270.c
+++ b/arch/arm/mach-pxa/colibri-pxa270.c
@@ -18,6 +18,7 @@
18#include <linux/mtd/partitions.h> 18#include <linux/mtd/partitions.h>
19#include <linux/mtd/physmap.h> 19#include <linux/mtd/physmap.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/regulator/machine.h>
21#include <linux/ucb1400.h> 22#include <linux/ucb1400.h>
22 23
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
@@ -294,6 +295,8 @@ static void __init colibri_pxa270_init(void)
294 printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n", 295 printk(KERN_ERR "Illegal colibri_pxa270_baseboard type %d\n",
295 colibri_pxa270_baseboard); 296 colibri_pxa270_baseboard);
296 } 297 }
298
299 regulator_has_full_constraints();
297} 300}
298 301
299/* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either 302/* The "Income s.r.o. SH-Dmaster PXA270 SBC" board can be booted either
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 51531ecffca8..9d7072b04045 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1306,6 +1306,8 @@ static void __init em_x270_init(void)
1306 em_x270_init_i2c(); 1306 em_x270_init_i2c();
1307 em_x270_init_camera(); 1307 em_x270_init_camera();
1308 em_x270_userspace_consumers_init(); 1308 em_x270_userspace_consumers_init();
1309
1310 regulator_has_full_constraints();
1309} 1311}
1310 1312
1311MACHINE_START(EM_X270, "Compulab EM-X270") 1313MACHINE_START(EM_X270, "Compulab EM-X270")
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c
index c98511c5abd1..9b0eb0252af6 100644
--- a/arch/arm/mach-pxa/icontrol.c
+++ b/arch/arm/mach-pxa/icontrol.c
@@ -26,6 +26,7 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/pxa2xx_spi.h> 27#include <linux/spi/pxa2xx_spi.h>
28#include <linux/can/platform/mcp251x.h> 28#include <linux/can/platform/mcp251x.h>
29#include <linux/regulator/machine.h>
29 30
30#include "generic.h" 31#include "generic.h"
31 32
@@ -185,6 +186,8 @@ static void __init icontrol_init(void)
185 mxm_8x10_mmc_init(); 186 mxm_8x10_mmc_init();
186 187
187 icontrol_can_init(); 188 icontrol_can_init();
189
190 regulator_has_full_constraints();
188} 191}
189 192
190MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") 193MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM")
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 872dcb20e757..066e3a250ee0 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -26,6 +26,7 @@
26#include <linux/dm9000.h> 26#include <linux/dm9000.h>
27#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/regulator/machine.h>
29#include <linux/i2c/pxa-i2c.h> 30#include <linux/i2c/pxa-i2c.h>
30 31
31#include <asm/types.h> 32#include <asm/types.h>
@@ -534,6 +535,8 @@ static void __init trizeps4_init(void)
534 535
535 BCR_writew(trizeps_conxs_bcr); 536 BCR_writew(trizeps_conxs_bcr);
536 board_backlight_power(1); 537 board_backlight_power(1);
538
539 regulator_has_full_constraints();
537} 540}
538 541
539static void __init trizeps4_map_io(void) 542static void __init trizeps4_map_io(void)
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
index aa89488f961e..54122a983ae3 100644
--- a/arch/arm/mach-pxa/vpac270.c
+++ b/arch/arm/mach-pxa/vpac270.c
@@ -24,6 +24,7 @@
24#include <linux/dm9000.h> 24#include <linux/dm9000.h>
25#include <linux/ucb1400.h> 25#include <linux/ucb1400.h>
26#include <linux/ata_platform.h> 26#include <linux/ata_platform.h>
27#include <linux/regulator/machine.h>
27#include <linux/regulator/max1586.h> 28#include <linux/regulator/max1586.h>
28#include <linux/i2c/pxa-i2c.h> 29#include <linux/i2c/pxa-i2c.h>
29 30
@@ -711,6 +712,8 @@ static void __init vpac270_init(void)
711 vpac270_ts_init(); 712 vpac270_ts_init();
712 vpac270_rtc_init(); 713 vpac270_rtc_init();
713 vpac270_ide_init(); 714 vpac270_ide_init();
715
716 regulator_has_full_constraints();
714} 717}
715 718
716MACHINE_START(VPAC270, "Voipac PXA270") 719MACHINE_START(VPAC270, "Voipac PXA270")
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index ac2ae5c71ab4..6158566fa0f7 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -868,6 +868,8 @@ static void __init zeus_init(void)
868 i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices)); 868 i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices));
869 pxa2xx_set_spi_info(3, &pxa2xx_spi_ssp3_master_info); 869 pxa2xx_set_spi_info(3, &pxa2xx_spi_ssp3_master_info);
870 spi_register_board_info(zeus_spi_board_info, ARRAY_SIZE(zeus_spi_board_info)); 870 spi_register_board_info(zeus_spi_board_info, ARRAY_SIZE(zeus_spi_board_info));
871
872 regulator_has_full_constraints();
871} 873}
872 874
873static struct map_desc zeus_io_desc[] __initdata = { 875static struct map_desc zeus_io_desc[] __initdata = {
diff --git a/arch/arm/mach-spear/generic.h b/arch/arm/mach-spear/generic.h
index a99d90a4d09c..06640914d9a0 100644
--- a/arch/arm/mach-spear/generic.h
+++ b/arch/arm/mach-spear/generic.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009-2012 ST Microelectronics 4 * Copyright (C) 2009-2012 ST Microelectronics
5 * Rajeev Kumar <rajeev-dlh.kumar@st.com> 5 * Rajeev Kumar <rajeev-dlh.kumar@st.com>
6 * Viresh Kumar <viresh.linux@gmail.com> 6 * Viresh Kumar <vireshk@kernel.org>
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/include/mach/irqs.h b/arch/arm/mach-spear/include/mach/irqs.h
index 92da0a8c6bce..7058720c5278 100644
--- a/arch/arm/mach-spear/include/mach/irqs.h
+++ b/arch/arm/mach-spear/include/mach/irqs.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009-2012 ST Microelectronics 4 * Copyright (C) 2009-2012 ST Microelectronics
5 * Rajeev Kumar <rajeev-dlh.kumar@st.com> 5 * Rajeev Kumar <rajeev-dlh.kumar@st.com>
6 * Viresh Kumar <viresh.linux@gmail.com> 6 * Viresh Kumar <vireshk@kernel.org>
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/include/mach/misc_regs.h b/arch/arm/mach-spear/include/mach/misc_regs.h
index 935639ce59ba..cfaf7c665b58 100644
--- a/arch/arm/mach-spear/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear/include/mach/misc_regs.h
@@ -4,7 +4,7 @@
4 * Miscellaneous registers definitions for SPEAr3xx machine family 4 * Miscellaneous registers definitions for SPEAr3xx machine family
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/include/mach/spear.h b/arch/arm/mach-spear/include/mach/spear.h
index f2d6a0176575..5ed841ccf8a3 100644
--- a/arch/arm/mach-spear/include/mach/spear.h
+++ b/arch/arm/mach-spear/include/mach/spear.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009,2012 ST Microelectronics 4 * Copyright (C) 2009,2012 ST Microelectronics
5 * Rajeev Kumar<rajeev-dlh.kumar@st.com> 5 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
6 * Viresh Kumar <viresh.linux@gmail.com> 6 * Viresh Kumar <vireshk@kernel.org>
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/include/mach/uncompress.h b/arch/arm/mach-spear/include/mach/uncompress.h
index 51b2dc93e4da..8439b9c12edb 100644
--- a/arch/arm/mach-spear/include/mach/uncompress.h
+++ b/arch/arm/mach-spear/include/mach/uncompress.h
@@ -4,7 +4,7 @@
4 * Serial port stubs for kernel decompress status messages 4 * Serial port stubs for kernel decompress status messages
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/pl080.c b/arch/arm/mach-spear/pl080.c
index cfa1199d0f4a..b4529f3e0ee9 100644
--- a/arch/arm/mach-spear/pl080.c
+++ b/arch/arm/mach-spear/pl080.c
@@ -4,7 +4,7 @@
4 * DMAC pl080 definitions for SPEAr platform 4 * DMAC pl080 definitions for SPEAr platform
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/pl080.h b/arch/arm/mach-spear/pl080.h
index eb6590ded40d..608dec6725ae 100644
--- a/arch/arm/mach-spear/pl080.h
+++ b/arch/arm/mach-spear/pl080.h
@@ -4,7 +4,7 @@
4 * DMAC pl080 definitions for SPEAr platform 4 * DMAC pl080 definitions for SPEAr platform
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/restart.c b/arch/arm/mach-spear/restart.c
index ce5e098c4888..b4342155a783 100644
--- a/arch/arm/mach-spear/restart.c
+++ b/arch/arm/mach-spear/restart.c
@@ -4,7 +4,7 @@
4 * SPEAr platform specific restart functions 4 * SPEAr platform specific restart functions
5 * 5 *
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index d9ce4d8000f0..cd5d375d91f0 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -4,7 +4,7 @@
4 * SPEAr1310 machine source file 4 * SPEAr1310 machine source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 3f3c0f124bd3..94594d5a446c 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -4,7 +4,7 @@
4 * SPEAr1340 machine source file 4 * SPEAr1340 machine source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear13xx.c b/arch/arm/mach-spear/spear13xx.c
index 2e463a93468d..b7afce6795f4 100644
--- a/arch/arm/mach-spear/spear13xx.c
+++ b/arch/arm/mach-spear/spear13xx.c
@@ -4,7 +4,7 @@
4 * SPEAr13XX machines common source file 4 * SPEAr13XX machines common source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear300.c b/arch/arm/mach-spear/spear300.c
index b52e48f342f4..5b32edda2276 100644
--- a/arch/arm/mach-spear/spear300.c
+++ b/arch/arm/mach-spear/spear300.c
@@ -4,7 +4,7 @@
4 * SPEAr300 machine source file 4 * SPEAr300 machine source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear310.c b/arch/arm/mach-spear/spear310.c
index ed2029db391f..86a44ac7ff67 100644
--- a/arch/arm/mach-spear/spear310.c
+++ b/arch/arm/mach-spear/spear310.c
@@ -4,7 +4,7 @@
4 * SPEAr310 machine source file 4 * SPEAr310 machine source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear320.c b/arch/arm/mach-spear/spear320.c
index bf634b32a930..d45d751926c5 100644
--- a/arch/arm/mach-spear/spear320.c
+++ b/arch/arm/mach-spear/spear320.c
@@ -4,7 +4,7 @@
4 * SPEAr320 machine source file 4 * SPEAr320 machine source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mach-spear/spear3xx.c b/arch/arm/mach-spear/spear3xx.c
index bf3b1fd8cb23..23394ac76cf2 100644
--- a/arch/arm/mach-spear/spear3xx.c
+++ b/arch/arm/mach-spear/spear3xx.c
@@ -4,7 +4,7 @@
4 * SPEAr3XX machines common source file 4 * SPEAr3XX machines common source file
5 * 5 *
6 * Copyright (C) 2009-2012 ST Microelectronics 6 * Copyright (C) 2009-2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 1ced8a0f7a52..cba12f34ff77 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1971,7 +1971,7 @@ static int extend_iommu_mapping(struct dma_iommu_mapping *mapping)
1971{ 1971{
1972 int next_bitmap; 1972 int next_bitmap;
1973 1973
1974 if (mapping->nr_bitmaps > mapping->extensions) 1974 if (mapping->nr_bitmaps >= mapping->extensions)
1975 return -EINVAL; 1975 return -EINVAL;
1976 1976
1977 next_bitmap = mapping->nr_bitmaps; 1977 next_bitmap = mapping->nr_bitmaps;
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 0716bbe19872..de2b246fed38 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -274,7 +274,10 @@ __v7_ca15mp_setup:
274__v7_b15mp_setup: 274__v7_b15mp_setup:
275__v7_ca17mp_setup: 275__v7_ca17mp_setup:
276 mov r10, #0 276 mov r10, #0
2771: 2771: adr r12, __v7_setup_stack @ the local stack
278 stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6
279 bl v7_invalidate_l1
280 ldmia r12, {r0-r5, lr}
278#ifdef CONFIG_SMP 281#ifdef CONFIG_SMP
279 ALT_SMP(mrc p15, 0, r0, c1, c0, 1) 282 ALT_SMP(mrc p15, 0, r0, c1, c0, 1)
280 ALT_UP(mov r0, #(1 << 6)) @ fake it for UP 283 ALT_UP(mov r0, #(1 << 6)) @ fake it for UP
@@ -283,7 +286,7 @@ __v7_ca17mp_setup:
283 orreq r0, r0, r10 @ Enable CPU-specific SMP bits 286 orreq r0, r0, r10 @ Enable CPU-specific SMP bits
284 mcreq p15, 0, r0, c1, c0, 1 287 mcreq p15, 0, r0, c1, c0, 1
285#endif 288#endif
286 b __v7_setup 289 b __v7_setup_cont
287 290
288/* 291/*
289 * Errata: 292 * Errata:
@@ -413,10 +416,11 @@ __v7_pj4b_setup:
413 416
414__v7_setup: 417__v7_setup:
415 adr r12, __v7_setup_stack @ the local stack 418 adr r12, __v7_setup_stack @ the local stack
416 stmia r12, {r0-r5, r7, r9, r11, lr} 419 stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6
417 bl v7_invalidate_l1 420 bl v7_invalidate_l1
418 ldmia r12, {r0-r5, r7, r9, r11, lr} 421 ldmia r12, {r0-r5, lr}
419 422
423__v7_setup_cont:
420 and r0, r9, #0xff000000 @ ARM? 424 and r0, r9, #0xff000000 @ ARM?
421 teq r0, #0x41000000 425 teq r0, #0x41000000
422 bne __errata_finish 426 bne __errata_finish
@@ -480,7 +484,7 @@ ENDPROC(__v7_setup)
480 484
481 .align 2 485 .align 2
482__v7_setup_stack: 486__v7_setup_stack:
483 .space 4 * 11 @ 11 registers 487 .space 4 * 7 @ 12 registers
484 488
485 __INITDATA 489 __INITDATA
486 490
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index b112a39834d0..70fd9ffb58cf 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -25,6 +25,7 @@ generic-y += kvm_para.h
25generic-y += local.h 25generic-y += local.h
26generic-y += local64.h 26generic-y += local64.h
27generic-y += mcs_spinlock.h 27generic-y += mcs_spinlock.h
28generic-y += mm-arch-hooks.h
28generic-y += mman.h 29generic-y += mman.h
29generic-y += msgbuf.h 30generic-y += msgbuf.h
30generic-y += msi.h 31generic-y += msi.h
diff --git a/arch/arm64/include/asm/mm-arch-hooks.h b/arch/arm64/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 562b655f5ba9..000000000000
--- a/arch/arm64/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_ARM64_MM_ARCH_HOOKS_H
13#define _ASM_ARM64_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_ARM64_MM_ARCH_HOOKS_H */
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index 1d66afdfac07..f61f2dd67464 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -12,6 +12,7 @@ generic-y += irq_work.h
12generic-y += local.h 12generic-y += local.h
13generic-y += local64.h 13generic-y += local64.h
14generic-y += mcs_spinlock.h 14generic-y += mcs_spinlock.h
15generic-y += mm-arch-hooks.h
15generic-y += param.h 16generic-y += param.h
16generic-y += percpu.h 17generic-y += percpu.h
17generic-y += preempt.h 18generic-y += preempt.h
diff --git a/arch/avr32/include/asm/mm-arch-hooks.h b/arch/avr32/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 145452ffbdad..000000000000
--- a/arch/avr32/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_AVR32_MM_ARCH_HOOKS_H
13#define _ASM_AVR32_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_AVR32_MM_ARCH_HOOKS_H */
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 07051a63415d..61cd1e786a14 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -21,6 +21,7 @@ generic-y += kvm_para.h
21generic-y += local.h 21generic-y += local.h
22generic-y += local64.h 22generic-y += local64.h
23generic-y += mcs_spinlock.h 23generic-y += mcs_spinlock.h
24generic-y += mm-arch-hooks.h
24generic-y += mman.h 25generic-y += mman.h
25generic-y += msgbuf.h 26generic-y += msgbuf.h
26generic-y += mutex.h 27generic-y += mutex.h
diff --git a/arch/blackfin/include/asm/mm-arch-hooks.h b/arch/blackfin/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 1c5211ec338f..000000000000
--- a/arch/blackfin/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_BLACKFIN_MM_ARCH_HOOKS_H
13#define _ASM_BLACKFIN_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_BLACKFIN_MM_ARCH_HOOKS_H */
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 7aeb32272975..f17c4dc6050c 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -26,6 +26,7 @@ generic-y += kdebug.h
26generic-y += kmap_types.h 26generic-y += kmap_types.h
27generic-y += local.h 27generic-y += local.h
28generic-y += mcs_spinlock.h 28generic-y += mcs_spinlock.h
29generic-y += mm-arch-hooks.h
29generic-y += mman.h 30generic-y += mman.h
30generic-y += mmu.h 31generic-y += mmu.h
31generic-y += mmu_context.h 32generic-y += mmu_context.h
diff --git a/arch/c6x/include/asm/mm-arch-hooks.h b/arch/c6x/include/asm/mm-arch-hooks.h
deleted file mode 100644
index bb3c4a6ce8e9..000000000000
--- a/arch/c6x/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_C6X_MM_ARCH_HOOKS_H
13#define _ASM_C6X_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_C6X_MM_ARCH_HOOKS_H */
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index d294f6aaff1d..ad2244f35bca 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -18,6 +18,7 @@ generic-y += linkage.h
18generic-y += local.h 18generic-y += local.h
19generic-y += local64.h 19generic-y += local64.h
20generic-y += mcs_spinlock.h 20generic-y += mcs_spinlock.h
21generic-y += mm-arch-hooks.h
21generic-y += module.h 22generic-y += module.h
22generic-y += percpu.h 23generic-y += percpu.h
23generic-y += preempt.h 24generic-y += preempt.h
diff --git a/arch/cris/include/asm/mm-arch-hooks.h b/arch/cris/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 314f774db2b0..000000000000
--- a/arch/cris/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_CRIS_MM_ARCH_HOOKS_H
13#define _ASM_CRIS_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_CRIS_MM_ARCH_HOOKS_H */
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index 30edce31e5c2..8e47b832cc76 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -4,5 +4,6 @@ generic-y += cputime.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += irq_work.h 5generic-y += irq_work.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += mm-arch-hooks.h
7generic-y += preempt.h 8generic-y += preempt.h
8generic-y += trace_clock.h 9generic-y += trace_clock.h
diff --git a/arch/frv/include/asm/mm-arch-hooks.h b/arch/frv/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 51d13a870404..000000000000
--- a/arch/frv/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_FRV_MM_ARCH_HOOKS_H
13#define _ASM_FRV_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_FRV_MM_ARCH_HOOKS_H */
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild
index 00379d64f707..70e6ae1e7006 100644
--- a/arch/h8300/include/asm/Kbuild
+++ b/arch/h8300/include/asm/Kbuild
@@ -33,6 +33,7 @@ generic-y += linkage.h
33generic-y += local.h 33generic-y += local.h
34generic-y += local64.h 34generic-y += local64.h
35generic-y += mcs_spinlock.h 35generic-y += mcs_spinlock.h
36generic-y += mm-arch-hooks.h
36generic-y += mman.h 37generic-y += mman.h
37generic-y += mmu.h 38generic-y += mmu.h
38generic-y += mmu_context.h 39generic-y += mmu_context.h
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 5ade4a163558..daee37bd0999 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -28,6 +28,7 @@ generic-y += kmap_types.h
28generic-y += local.h 28generic-y += local.h
29generic-y += local64.h 29generic-y += local64.h
30generic-y += mcs_spinlock.h 30generic-y += mcs_spinlock.h
31generic-y += mm-arch-hooks.h
31generic-y += mman.h 32generic-y += mman.h
32generic-y += msgbuf.h 33generic-y += msgbuf.h
33generic-y += pci.h 34generic-y += pci.h
diff --git a/arch/hexagon/include/asm/mm-arch-hooks.h b/arch/hexagon/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 05e8b939e416..000000000000
--- a/arch/hexagon/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_HEXAGON_MM_ARCH_HOOKS_H
13#define _ASM_HEXAGON_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_HEXAGON_MM_ARCH_HOOKS_H */
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index ccff13d33fa2..9de3ba12f6b9 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += exec.h
4generic-y += irq_work.h 4generic-y += irq_work.h
5generic-y += kvm_para.h 5generic-y += kvm_para.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += mm-arch-hooks.h
7generic-y += preempt.h 8generic-y += preempt.h
8generic-y += trace_clock.h 9generic-y += trace_clock.h
9generic-y += vtime.h 10generic-y += vtime.h
diff --git a/arch/ia64/include/asm/mm-arch-hooks.h b/arch/ia64/include/asm/mm-arch-hooks.h
deleted file mode 100644
index ab4b5c698322..000000000000
--- a/arch/ia64/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_IA64_MM_ARCH_HOOKS_H
13#define _ASM_IA64_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_IA64_MM_ARCH_HOOKS_H */
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index ba1cdc018731..e0eb704ca1fa 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += cputime.h
4generic-y += exec.h 4generic-y += exec.h
5generic-y += irq_work.h 5generic-y += irq_work.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += mm-arch-hooks.h
7generic-y += module.h 8generic-y += module.h
8generic-y += preempt.h 9generic-y += preempt.h
9generic-y += sections.h 10generic-y += sections.h
diff --git a/arch/m32r/include/asm/mm-arch-hooks.h b/arch/m32r/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 6d60b4750f41..000000000000
--- a/arch/m32r/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_M32R_MM_ARCH_HOOKS_H
13#define _ASM_M32R_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_M32R_MM_ARCH_HOOKS_H */
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 33013dfcd3e1..c496d48a8c8d 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -125,6 +125,13 @@ endif # M68KCLASSIC
125 125
126if COLDFIRE 126if COLDFIRE
127 127
128choice
129 prompt "ColdFire SoC type"
130 default M520x
131 help
132 Select the type of ColdFire System-on-Chip (SoC) that you want
133 to build for.
134
128config M5206 135config M5206
129 bool "MCF5206" 136 bool "MCF5206"
130 depends on !MMU 137 depends on !MMU
@@ -174,9 +181,6 @@ config M525x
174 help 181 help
175 Freescale (Motorola) Coldfire 5251/5253 processor support. 182 Freescale (Motorola) Coldfire 5251/5253 processor support.
176 183
177config M527x
178 bool
179
180config M5271 184config M5271
181 bool "MCF5271" 185 bool "MCF5271"
182 depends on !MMU 186 depends on !MMU
@@ -223,9 +227,6 @@ config M5307
223 help 227 help
224 Motorola ColdFire 5307 processor support. 228 Motorola ColdFire 5307 processor support.
225 229
226config M53xx
227 bool
228
229config M532x 230config M532x
230 bool "MCF532x" 231 bool "MCF532x"
231 depends on !MMU 232 depends on !MMU
@@ -251,9 +252,6 @@ config M5407
251 help 252 help
252 Motorola ColdFire 5407 processor support. 253 Motorola ColdFire 5407 processor support.
253 254
254config M54xx
255 bool
256
257config M547x 255config M547x
258 bool "MCF547x" 256 bool "MCF547x"
259 select M54xx 257 select M54xx
@@ -280,6 +278,17 @@ config M5441x
280 help 278 help
281 Freescale Coldfire 54410/54415/54416/54417/54418 processor support. 279 Freescale Coldfire 54410/54415/54416/54417/54418 processor support.
282 280
281endchoice
282
283config M527x
284 bool
285
286config M53xx
287 bool
288
289config M54xx
290 bool
291
283endif # COLDFIRE 292endif # COLDFIRE
284 293
285 294
@@ -416,22 +425,18 @@ config HAVE_MBAR
416config HAVE_IPSBAR 425config HAVE_IPSBAR
417 bool 426 bool
418 427
419config CLOCK_SET
420 bool "Enable setting the CPU clock frequency"
421 depends on COLDFIRE
422 default n
423 help
424 On some CPU's you do not need to know what the core CPU clock
425 frequency is. On these you can disable clock setting. On some
426 traditional 68K parts, and on all ColdFire parts you need to set
427 the appropriate CPU clock frequency. On these devices many of the
428 onboard peripherals derive their timing from the master CPU clock
429 frequency.
430
431config CLOCK_FREQ 428config CLOCK_FREQ
432 int "Set the core clock frequency" 429 int "Set the core clock frequency"
430 default "25000000" if M5206
431 default "54000000" if M5206e
432 default "166666666" if M520x
433 default "140000000" if M5249
434 default "150000000" if M527x || M523x
435 default "90000000" if M5307
436 default "50000000" if M5407
437 default "266000000" if M54xx
433 default "66666666" 438 default "66666666"
434 depends on CLOCK_SET 439 depends on COLDFIRE
435 help 440 help
436 Define the CPU clock frequency in use. This is the core clock 441 Define the CPU clock frequency in use. This is the core clock
437 frequency, it may or may not be the same as the external clock 442 frequency, it may or may not be the same as the external clock
diff --git a/arch/m68k/configs/m5208evb_defconfig b/arch/m68k/configs/m5208evb_defconfig
index e7292f460af4..4c7b7938d53a 100644
--- a/arch/m68k/configs/m5208evb_defconfig
+++ b/arch/m68k/configs/m5208evb_defconfig
@@ -1,10 +1,6 @@
1# CONFIG_MMU is not set
2CONFIG_EXPERIMENTAL=y
3CONFIG_LOG_BUF_SHIFT=14 1CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EXPERT=y 2CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 3# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set
8# CONFIG_FUTEX is not set 4# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 5# CONFIG_EPOLL is not set
10# CONFIG_SIGNALFD is not set 6# CONFIG_SIGNALFD is not set
@@ -16,17 +12,12 @@ CONFIG_EXPERT=y
16# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
19CONFIG_M520x=y 15# CONFIG_MMU is not set
20CONFIG_CLOCK_SET=y
21CONFIG_CLOCK_FREQ=166666666
22CONFIG_CLOCK_DIV=2
23CONFIG_M5208EVB=y
24# CONFIG_4KSTACKS is not set 16# CONFIG_4KSTACKS is not set
25CONFIG_RAMBASE=0x40000000 17CONFIG_RAMBASE=0x40000000
26CONFIG_RAMSIZE=0x2000000 18CONFIG_RAMSIZE=0x2000000
27CONFIG_VECTORBASE=0x40000000 19CONFIG_VECTORBASE=0x40000000
28CONFIG_KERNELBASE=0x40020000 20CONFIG_KERNELBASE=0x40020000
29CONFIG_RAM16BIT=y
30CONFIG_BINFMT_FLAT=y 21CONFIG_BINFMT_FLAT=y
31CONFIG_NET=y 22CONFIG_NET=y
32CONFIG_PACKET=y 23CONFIG_PACKET=y
@@ -40,24 +31,19 @@ CONFIG_INET=y
40# CONFIG_IPV6 is not set 31# CONFIG_IPV6 is not set
41# CONFIG_FW_LOADER is not set 32# CONFIG_FW_LOADER is not set
42CONFIG_MTD=y 33CONFIG_MTD=y
43CONFIG_MTD_CHAR=y
44CONFIG_MTD_BLOCK=y 34CONFIG_MTD_BLOCK=y
45CONFIG_MTD_RAM=y 35CONFIG_MTD_RAM=y
46CONFIG_MTD_UCLINUX=y 36CONFIG_MTD_UCLINUX=y
47CONFIG_BLK_DEV_RAM=y 37CONFIG_BLK_DEV_RAM=y
48# CONFIG_MISC_DEVICES is not set
49CONFIG_NETDEVICES=y 38CONFIG_NETDEVICES=y
50CONFIG_NET_ETHERNET=y
51CONFIG_FEC=y 39CONFIG_FEC=y
52# CONFIG_NETDEV_1000 is not set
53# CONFIG_NETDEV_10000 is not set
54# CONFIG_INPUT is not set 40# CONFIG_INPUT is not set
55# CONFIG_SERIO is not set 41# CONFIG_SERIO is not set
56# CONFIG_VT is not set 42# CONFIG_VT is not set
43# CONFIG_UNIX98_PTYS is not set
57CONFIG_SERIAL_MCF=y 44CONFIG_SERIAL_MCF=y
58CONFIG_SERIAL_MCF_BAUDRATE=115200 45CONFIG_SERIAL_MCF_BAUDRATE=115200
59CONFIG_SERIAL_MCF_CONSOLE=y 46CONFIG_SERIAL_MCF_CONSOLE=y
60# CONFIG_UNIX98_PTYS is not set
61# CONFIG_HW_RANDOM is not set 47# CONFIG_HW_RANDOM is not set
62# CONFIG_HWMON is not set 48# CONFIG_HWMON is not set
63# CONFIG_USB_SUPPORT is not set 49# CONFIG_USB_SUPPORT is not set
@@ -68,8 +54,6 @@ CONFIG_EXT2_FS=y
68CONFIG_ROMFS_FS=y 54CONFIG_ROMFS_FS=y
69CONFIG_ROMFS_BACKED_BY_MTD=y 55CONFIG_ROMFS_BACKED_BY_MTD=y
70# CONFIG_NETWORK_FILESYSTEMS is not set 56# CONFIG_NETWORK_FILESYSTEMS is not set
71# CONFIG_RCU_CPU_STALL_DETECTOR is not set
72CONFIG_SYSCTL_SYSCALL_CHECK=y
73CONFIG_FULLDEBUG=y
74CONFIG_BOOTPARAM=y 57CONFIG_BOOTPARAM=y
75CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" 58CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
59CONFIG_FULLDEBUG=y
diff --git a/arch/m68k/configs/m5249evb_defconfig b/arch/m68k/configs/m5249evb_defconfig
index 0cd4b39f325b..a782f368650f 100644
--- a/arch/m68k/configs/m5249evb_defconfig
+++ b/arch/m68k/configs/m5249evb_defconfig
@@ -1,10 +1,6 @@
1# CONFIG_MMU is not set
2CONFIG_EXPERIMENTAL=y
3CONFIG_LOG_BUF_SHIFT=14 1CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EXPERT=y 2CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 3# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set
8# CONFIG_FUTEX is not set 4# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 5# CONFIG_EPOLL is not set
10# CONFIG_SIGNALFD is not set 6# CONFIG_SIGNALFD is not set
@@ -16,10 +12,8 @@ CONFIG_EXPERT=y
16# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_MMU is not set
19CONFIG_M5249=y 16CONFIG_M5249=y
20CONFIG_CLOCK_SET=y
21CONFIG_CLOCK_FREQ=140000000
22CONFIG_CLOCK_DIV=2
23CONFIG_M5249C3=y 17CONFIG_M5249C3=y
24CONFIG_RAMBASE=0x00000000 18CONFIG_RAMBASE=0x00000000
25CONFIG_RAMSIZE=0x00800000 19CONFIG_RAMSIZE=0x00800000
@@ -38,23 +32,18 @@ CONFIG_INET=y
38# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
39# CONFIG_FW_LOADER is not set 33# CONFIG_FW_LOADER is not set
40CONFIG_MTD=y 34CONFIG_MTD=y
41CONFIG_MTD_CHAR=y
42CONFIG_MTD_BLOCK=y 35CONFIG_MTD_BLOCK=y
43CONFIG_MTD_RAM=y 36CONFIG_MTD_RAM=y
44CONFIG_MTD_UCLINUX=y 37CONFIG_MTD_UCLINUX=y
45CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
46# CONFIG_MISC_DEVICES is not set
47CONFIG_NETDEVICES=y 39CONFIG_NETDEVICES=y
48CONFIG_NET_ETHERNET=y
49# CONFIG_NETDEV_1000 is not set
50# CONFIG_NETDEV_10000 is not set
51CONFIG_PPP=y 40CONFIG_PPP=y
52# CONFIG_INPUT is not set 41# CONFIG_INPUT is not set
53# CONFIG_SERIO is not set 42# CONFIG_SERIO is not set
54# CONFIG_VT is not set 43# CONFIG_VT is not set
44# CONFIG_UNIX98_PTYS is not set
55CONFIG_SERIAL_MCF=y 45CONFIG_SERIAL_MCF=y
56CONFIG_SERIAL_MCF_CONSOLE=y 46CONFIG_SERIAL_MCF_CONSOLE=y
57# CONFIG_UNIX98_PTYS is not set
58# CONFIG_HWMON is not set 47# CONFIG_HWMON is not set
59# CONFIG_USB_SUPPORT is not set 48# CONFIG_USB_SUPPORT is not set
60CONFIG_EXT2_FS=y 49CONFIG_EXT2_FS=y
@@ -62,7 +51,5 @@ CONFIG_EXT2_FS=y
62CONFIG_ROMFS_FS=y 51CONFIG_ROMFS_FS=y
63CONFIG_ROMFS_BACKED_BY_MTD=y 52CONFIG_ROMFS_BACKED_BY_MTD=y
64# CONFIG_NETWORK_FILESYSTEMS is not set 53# CONFIG_NETWORK_FILESYSTEMS is not set
65# CONFIG_RCU_CPU_STALL_DETECTOR is not set
66CONFIG_BOOTPARAM=y 54CONFIG_BOOTPARAM=y
67CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" 55CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
68# CONFIG_CRC32 is not set
diff --git a/arch/m68k/configs/m5272c3_defconfig b/arch/m68k/configs/m5272c3_defconfig
index a60cb3509135..6f5fb92f5cbf 100644
--- a/arch/m68k/configs/m5272c3_defconfig
+++ b/arch/m68k/configs/m5272c3_defconfig
@@ -1,10 +1,6 @@
1# CONFIG_MMU is not set
2CONFIG_EXPERIMENTAL=y
3CONFIG_LOG_BUF_SHIFT=14 1CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EXPERT=y 2CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 3# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set
8# CONFIG_FUTEX is not set 4# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 5# CONFIG_EPOLL is not set
10# CONFIG_SIGNALFD is not set 6# CONFIG_SIGNALFD is not set
@@ -16,8 +12,8 @@ CONFIG_EXPERT=y
16# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_MMU is not set
19CONFIG_M5272=y 16CONFIG_M5272=y
20CONFIG_CLOCK_SET=y
21CONFIG_M5272C3=y 17CONFIG_M5272C3=y
22CONFIG_RAMBASE=0x00000000 18CONFIG_RAMBASE=0x00000000
23CONFIG_RAMSIZE=0x00800000 19CONFIG_RAMSIZE=0x00800000
@@ -36,23 +32,18 @@ CONFIG_INET=y
36# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
37# CONFIG_FW_LOADER is not set 33# CONFIG_FW_LOADER is not set
38CONFIG_MTD=y 34CONFIG_MTD=y
39CONFIG_MTD_CHAR=y
40CONFIG_MTD_BLOCK=y 35CONFIG_MTD_BLOCK=y
41CONFIG_MTD_RAM=y 36CONFIG_MTD_RAM=y
42CONFIG_MTD_UCLINUX=y 37CONFIG_MTD_UCLINUX=y
43CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
44# CONFIG_MISC_DEVICES is not set
45CONFIG_NETDEVICES=y 39CONFIG_NETDEVICES=y
46CONFIG_NET_ETHERNET=y
47CONFIG_FEC=y 40CONFIG_FEC=y
48# CONFIG_NETDEV_1000 is not set
49# CONFIG_NETDEV_10000 is not set
50# CONFIG_INPUT is not set 41# CONFIG_INPUT is not set
51# CONFIG_SERIO is not set 42# CONFIG_SERIO is not set
52# CONFIG_VT is not set 43# CONFIG_VT is not set
44# CONFIG_UNIX98_PTYS is not set
53CONFIG_SERIAL_MCF=y 45CONFIG_SERIAL_MCF=y
54CONFIG_SERIAL_MCF_CONSOLE=y 46CONFIG_SERIAL_MCF_CONSOLE=y
55# CONFIG_UNIX98_PTYS is not set
56# CONFIG_HWMON is not set 47# CONFIG_HWMON is not set
57# CONFIG_USB_SUPPORT is not set 48# CONFIG_USB_SUPPORT is not set
58CONFIG_EXT2_FS=y 49CONFIG_EXT2_FS=y
@@ -61,6 +52,5 @@ CONFIG_EXT2_FS=y
61CONFIG_ROMFS_FS=y 52CONFIG_ROMFS_FS=y
62CONFIG_ROMFS_BACKED_BY_MTD=y 53CONFIG_ROMFS_BACKED_BY_MTD=y
63# CONFIG_NETWORK_FILESYSTEMS is not set 54# CONFIG_NETWORK_FILESYSTEMS is not set
64# CONFIG_RCU_CPU_STALL_DETECTOR is not set
65CONFIG_BOOTPARAM=y 55CONFIG_BOOTPARAM=y
66CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" 56CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig
index e6502ab7cb2f..b5d7cd1ce856 100644
--- a/arch/m68k/configs/m5275evb_defconfig
+++ b/arch/m68k/configs/m5275evb_defconfig
@@ -1,10 +1,6 @@
1# CONFIG_MMU is not set
2CONFIG_EXPERIMENTAL=y
3CONFIG_LOG_BUF_SHIFT=14 1CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EXPERT=y 2CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 3# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set
8# CONFIG_FUTEX is not set 4# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 5# CONFIG_EPOLL is not set
10# CONFIG_SIGNALFD is not set 6# CONFIG_SIGNALFD is not set
@@ -16,11 +12,8 @@ CONFIG_EXPERT=y
16# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_MMU is not set
19CONFIG_M5275=y 16CONFIG_M5275=y
20CONFIG_CLOCK_SET=y
21CONFIG_CLOCK_FREQ=150000000
22CONFIG_CLOCK_DIV=2
23CONFIG_M5275EVB=y
24# CONFIG_4KSTACKS is not set 17# CONFIG_4KSTACKS is not set
25CONFIG_RAMBASE=0x00000000 18CONFIG_RAMBASE=0x00000000
26CONFIG_RAMSIZE=0x00000000 19CONFIG_RAMSIZE=0x00000000
@@ -39,24 +32,19 @@ CONFIG_INET=y
39# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
40# CONFIG_FW_LOADER is not set 33# CONFIG_FW_LOADER is not set
41CONFIG_MTD=y 34CONFIG_MTD=y
42CONFIG_MTD_CHAR=y
43CONFIG_MTD_BLOCK=y 35CONFIG_MTD_BLOCK=y
44CONFIG_MTD_RAM=y 36CONFIG_MTD_RAM=y
45CONFIG_MTD_UCLINUX=y 37CONFIG_MTD_UCLINUX=y
46CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
47# CONFIG_MISC_DEVICES is not set
48CONFIG_NETDEVICES=y 39CONFIG_NETDEVICES=y
49CONFIG_NET_ETHERNET=y
50CONFIG_FEC=y 40CONFIG_FEC=y
51# CONFIG_NETDEV_1000 is not set
52# CONFIG_NETDEV_10000 is not set
53CONFIG_PPP=y 41CONFIG_PPP=y
54# CONFIG_INPUT is not set 42# CONFIG_INPUT is not set
55# CONFIG_SERIO is not set 43# CONFIG_SERIO is not set
56# CONFIG_VT is not set 44# CONFIG_VT is not set
45# CONFIG_UNIX98_PTYS is not set
57CONFIG_SERIAL_MCF=y 46CONFIG_SERIAL_MCF=y
58CONFIG_SERIAL_MCF_CONSOLE=y 47CONFIG_SERIAL_MCF_CONSOLE=y
59# CONFIG_UNIX98_PTYS is not set
60# CONFIG_HWMON is not set 48# CONFIG_HWMON is not set
61# CONFIG_USB_SUPPORT is not set 49# CONFIG_USB_SUPPORT is not set
62CONFIG_EXT2_FS=y 50CONFIG_EXT2_FS=y
@@ -65,8 +53,5 @@ CONFIG_EXT2_FS=y
65CONFIG_ROMFS_FS=y 53CONFIG_ROMFS_FS=y
66CONFIG_ROMFS_BACKED_BY_MTD=y 54CONFIG_ROMFS_BACKED_BY_MTD=y
67# CONFIG_NETWORK_FILESYSTEMS is not set 55# CONFIG_NETWORK_FILESYSTEMS is not set
68# CONFIG_RCU_CPU_STALL_DETECTOR is not set
69CONFIG_SYSCTL_SYSCALL_CHECK=y
70CONFIG_BOOTPARAM=y 56CONFIG_BOOTPARAM=y
71CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" 57CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
72# CONFIG_CRC32 is not set
diff --git a/arch/m68k/configs/m5307c3_defconfig b/arch/m68k/configs/m5307c3_defconfig
index 023812abd2e6..1b4c09461c40 100644
--- a/arch/m68k/configs/m5307c3_defconfig
+++ b/arch/m68k/configs/m5307c3_defconfig
@@ -1,10 +1,6 @@
1# CONFIG_MMU is not set
2CONFIG_EXPERIMENTAL=y
3CONFIG_LOG_BUF_SHIFT=14 1CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EXPERT=y 2CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 3# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set
8# CONFIG_FUTEX is not set 4# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 5# CONFIG_EPOLL is not set
10# CONFIG_SIGNALFD is not set 6# CONFIG_SIGNALFD is not set
@@ -16,10 +12,8 @@ CONFIG_EXPERT=y
16# CONFIG_BLK_DEV_BSG is not set 12# CONFIG_BLK_DEV_BSG is not set
17# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
18# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_MMU is not set
19CONFIG_M5307=y 16CONFIG_M5307=y
20CONFIG_CLOCK_SET=y
21CONFIG_CLOCK_FREQ=90000000
22CONFIG_CLOCK_DIV=2
23CONFIG_M5307C3=y 17CONFIG_M5307C3=y
24CONFIG_RAMBASE=0x00000000 18CONFIG_RAMBASE=0x00000000
25CONFIG_RAMSIZE=0x00800000 19CONFIG_RAMSIZE=0x00800000
@@ -38,16 +32,11 @@ CONFIG_INET=y
38# CONFIG_IPV6 is not set 32# CONFIG_IPV6 is not set
39# CONFIG_FW_LOADER is not set 33# CONFIG_FW_LOADER is not set
40CONFIG_MTD=y 34CONFIG_MTD=y
41CONFIG_MTD_CHAR=y
42CONFIG_MTD_BLOCK=y 35CONFIG_MTD_BLOCK=y
43CONFIG_MTD_RAM=y 36CONFIG_MTD_RAM=y
44CONFIG_MTD_UCLINUX=y 37CONFIG_MTD_UCLINUX=y
45CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
46# CONFIG_MISC_DEVICES is not set
47CONFIG_NETDEVICES=y 39CONFIG_NETDEVICES=y
48CONFIG_NET_ETHERNET=y
49# CONFIG_NETDEV_1000 is not set
50# CONFIG_NETDEV_10000 is not set
51CONFIG_PPP=y 40CONFIG_PPP=y
52CONFIG_SLIP=y 41CONFIG_SLIP=y
53CONFIG_SLIP_COMPRESSED=y 42CONFIG_SLIP_COMPRESSED=y
@@ -56,21 +45,17 @@ CONFIG_SLIP_COMPRESSED=y
56# CONFIG_INPUT_MOUSE is not set 45# CONFIG_INPUT_MOUSE is not set
57# CONFIG_SERIO is not set 46# CONFIG_SERIO is not set
58# CONFIG_VT is not set 47# CONFIG_VT is not set
48# CONFIG_LEGACY_PTYS is not set
59CONFIG_SERIAL_MCF=y 49CONFIG_SERIAL_MCF=y
60CONFIG_SERIAL_MCF_CONSOLE=y 50CONFIG_SERIAL_MCF_CONSOLE=y
61# CONFIG_LEGACY_PTYS is not set
62# CONFIG_HW_RANDOM is not set 51# CONFIG_HW_RANDOM is not set
63# CONFIG_HWMON is not set 52# CONFIG_HWMON is not set
64# CONFIG_HID_SUPPORT is not set
65# CONFIG_USB_SUPPORT is not set 53# CONFIG_USB_SUPPORT is not set
66CONFIG_EXT2_FS=y 54CONFIG_EXT2_FS=y
67# CONFIG_DNOTIFY is not set 55# CONFIG_DNOTIFY is not set
68CONFIG_ROMFS_FS=y 56CONFIG_ROMFS_FS=y
69CONFIG_ROMFS_BACKED_BY_MTD=y 57CONFIG_ROMFS_BACKED_BY_MTD=y
70# CONFIG_NETWORK_FILESYSTEMS is not set 58# CONFIG_NETWORK_FILESYSTEMS is not set
71# CONFIG_RCU_CPU_STALL_DETECTOR is not set
72CONFIG_SYSCTL_SYSCALL_CHECK=y
73CONFIG_FULLDEBUG=y
74CONFIG_BOOTPARAM=y 59CONFIG_BOOTPARAM=y
75CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" 60CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
76# CONFIG_CRC32 is not set 61CONFIG_FULLDEBUG=y
diff --git a/arch/m68k/configs/m5407c3_defconfig b/arch/m68k/configs/m5407c3_defconfig
index 557b39f3be90..275ad543d4bc 100644
--- a/arch/m68k/configs/m5407c3_defconfig
+++ b/arch/m68k/configs/m5407c3_defconfig
@@ -1,10 +1,6 @@
1# CONFIG_MMU is not set
2CONFIG_EXPERIMENTAL=y
3CONFIG_LOG_BUF_SHIFT=14 1CONFIG_LOG_BUF_SHIFT=14
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5CONFIG_EXPERT=y 2CONFIG_EXPERT=y
6# CONFIG_KALLSYMS is not set 3# CONFIG_KALLSYMS is not set
7# CONFIG_HOTPLUG is not set
8# CONFIG_FUTEX is not set 4# CONFIG_FUTEX is not set
9# CONFIG_EPOLL is not set 5# CONFIG_EPOLL is not set
10# CONFIG_SIGNALFD is not set 6# CONFIG_SIGNALFD is not set
@@ -17,9 +13,8 @@ CONFIG_MODULE_UNLOAD=y
17# CONFIG_BLK_DEV_BSG is not set 13# CONFIG_BLK_DEV_BSG is not set
18# CONFIG_IOSCHED_DEADLINE is not set 14# CONFIG_IOSCHED_DEADLINE is not set
19# CONFIG_IOSCHED_CFQ is not set 15# CONFIG_IOSCHED_CFQ is not set
16# CONFIG_MMU is not set
20CONFIG_M5407=y 17CONFIG_M5407=y
21CONFIG_CLOCK_SET=y
22CONFIG_CLOCK_FREQ=50000000
23CONFIG_M5407C3=y 18CONFIG_M5407C3=y
24CONFIG_RAMBASE=0x00000000 19CONFIG_RAMBASE=0x00000000
25CONFIG_RAMSIZE=0x00000000 20CONFIG_RAMSIZE=0x00000000
@@ -38,22 +33,17 @@ CONFIG_INET=y
38# CONFIG_IPV6 is not set 33# CONFIG_IPV6 is not set
39# CONFIG_FW_LOADER is not set 34# CONFIG_FW_LOADER is not set
40CONFIG_MTD=y 35CONFIG_MTD=y
41CONFIG_MTD_CHAR=y
42CONFIG_MTD_BLOCK=y 36CONFIG_MTD_BLOCK=y
43CONFIG_MTD_RAM=y 37CONFIG_MTD_RAM=y
44CONFIG_MTD_UCLINUX=y 38CONFIG_MTD_UCLINUX=y
45CONFIG_BLK_DEV_RAM=y 39CONFIG_BLK_DEV_RAM=y
46# CONFIG_MISC_DEVICES is not set
47CONFIG_NETDEVICES=y 40CONFIG_NETDEVICES=y
48CONFIG_NET_ETHERNET=y
49# CONFIG_NETDEV_1000 is not set
50# CONFIG_NETDEV_10000 is not set
51CONFIG_PPP=y 41CONFIG_PPP=y
52# CONFIG_INPUT is not set 42# CONFIG_INPUT is not set
53# CONFIG_VT is not set 43# CONFIG_VT is not set
44# CONFIG_UNIX98_PTYS is not set
54CONFIG_SERIAL_MCF=y 45CONFIG_SERIAL_MCF=y
55CONFIG_SERIAL_MCF_CONSOLE=y 46CONFIG_SERIAL_MCF_CONSOLE=y
56# CONFIG_UNIX98_PTYS is not set
57# CONFIG_HW_RANDOM is not set 47# CONFIG_HW_RANDOM is not set
58# CONFIG_HWMON is not set 48# CONFIG_HWMON is not set
59# CONFIG_USB_SUPPORT is not set 49# CONFIG_USB_SUPPORT is not set
@@ -63,8 +53,5 @@ CONFIG_EXT2_FS=y
63CONFIG_ROMFS_FS=y 53CONFIG_ROMFS_FS=y
64CONFIG_ROMFS_BACKED_BY_MTD=y 54CONFIG_ROMFS_BACKED_BY_MTD=y
65# CONFIG_NETWORK_FILESYSTEMS is not set 55# CONFIG_NETWORK_FILESYSTEMS is not set
66# CONFIG_RCU_CPU_STALL_DETECTOR is not set
67CONFIG_SYSCTL_SYSCALL_CHECK=y
68CONFIG_BOOTPARAM=y 56CONFIG_BOOTPARAM=y
69CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0" 57CONFIG_BOOTPARAM_STRING="root=/dev/mtdblock0"
70# CONFIG_CRC32 is not set
diff --git a/arch/m68k/configs/m5475evb_defconfig b/arch/m68k/configs/m5475evb_defconfig
index c5018a68819b..4f4ccd13c11b 100644
--- a/arch/m68k/configs/m5475evb_defconfig
+++ b/arch/m68k/configs/m5475evb_defconfig
@@ -1,11 +1,7 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 1# CONFIG_SWAP is not set
3CONFIG_LOG_BUF_SHIFT=14 2CONFIG_LOG_BUF_SHIFT=14
4CONFIG_SYSFS_DEPRECATED=y
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_SYSCTL_SYSCALL=y 3CONFIG_SYSCTL_SYSCALL=y
7# CONFIG_KALLSYMS is not set 4# CONFIG_KALLSYMS is not set
8# CONFIG_HOTPLUG is not set
9# CONFIG_FUTEX is not set 5# CONFIG_FUTEX is not set
10# CONFIG_EPOLL is not set 6# CONFIG_EPOLL is not set
11# CONFIG_SIGNALFD is not set 7# CONFIG_SIGNALFD is not set
@@ -20,19 +16,16 @@ CONFIG_MODULES=y
20# CONFIG_IOSCHED_DEADLINE is not set 16# CONFIG_IOSCHED_DEADLINE is not set
21# CONFIG_IOSCHED_CFQ is not set 17# CONFIG_IOSCHED_CFQ is not set
22CONFIG_COLDFIRE=y 18CONFIG_COLDFIRE=y
23CONFIG_M547x=y
24CONFIG_CLOCK_SET=y
25CONFIG_CLOCK_FREQ=266000000
26# CONFIG_4KSTACKS is not set 19# CONFIG_4KSTACKS is not set
27CONFIG_RAMBASE=0x0 20CONFIG_RAMBASE=0x0
28CONFIG_RAMSIZE=0x2000000 21CONFIG_RAMSIZE=0x2000000
29CONFIG_VECTORBASE=0x0 22CONFIG_VECTORBASE=0x0
30CONFIG_MBAR=0xff000000 23CONFIG_MBAR=0xff000000
31CONFIG_KERNELBASE=0x20000 24CONFIG_KERNELBASE=0x20000
25CONFIG_PCI=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 26# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33# CONFIG_FW_LOADER is not set 27# CONFIG_FW_LOADER is not set
34CONFIG_MTD=y 28CONFIG_MTD=y
35CONFIG_MTD_CHAR=y
36CONFIG_MTD_BLOCK=y 29CONFIG_MTD_BLOCK=y
37CONFIG_MTD_CFI=y 30CONFIG_MTD_CFI=y
38CONFIG_MTD_JEDECPROBE=y 31CONFIG_MTD_JEDECPROBE=y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 1555bc189c7d..eb85bd9c6180 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -18,6 +18,7 @@ generic-y += kvm_para.h
18generic-y += local.h 18generic-y += local.h
19generic-y += local64.h 19generic-y += local64.h
20generic-y += mcs_spinlock.h 20generic-y += mcs_spinlock.h
21generic-y += mm-arch-hooks.h
21generic-y += mman.h 22generic-y += mman.h
22generic-y += mutex.h 23generic-y += mutex.h
23generic-y += percpu.h 24generic-y += percpu.h
diff --git a/arch/m68k/include/asm/coldfire.h b/arch/m68k/include/asm/coldfire.h
index c94557b91448..50aa4dac9ca2 100644
--- a/arch/m68k/include/asm/coldfire.h
+++ b/arch/m68k/include/asm/coldfire.h
@@ -19,7 +19,7 @@
19 * in any case new boards come along from time to time that have yet 19 * in any case new boards come along from time to time that have yet
20 * another different clocking frequency. 20 * another different clocking frequency.
21 */ 21 */
22#ifdef CONFIG_CLOCK_SET 22#ifdef CONFIG_CLOCK_FREQ
23#define MCF_CLK CONFIG_CLOCK_FREQ 23#define MCF_CLK CONFIG_CLOCK_FREQ
24#else 24#else
25#error "Don't know what your ColdFire CPU clock frequency is??" 25#error "Don't know what your ColdFire CPU clock frequency is??"
diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h
index 618c85d3c786..f55cad529400 100644
--- a/arch/m68k/include/asm/io_mm.h
+++ b/arch/m68k/include/asm/io_mm.h
@@ -413,7 +413,8 @@ static inline void isa_delay(void)
413#define writew(val, addr) out_le16((addr), (val)) 413#define writew(val, addr) out_le16((addr), (val))
414#endif /* CONFIG_ATARI_ROM_ISA */ 414#endif /* CONFIG_ATARI_ROM_ISA */
415 415
416#if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA) 416#if !defined(CONFIG_ISA) && !defined(CONFIG_ATARI_ROM_ISA) && \
417 !(defined(CONFIG_PCI) && defined(CONFIG_COLDFIRE))
417/* 418/*
418 * We need to define dummy functions for GENERIC_IOMAP support. 419 * We need to define dummy functions for GENERIC_IOMAP support.
419 */ 420 */
diff --git a/arch/m68k/include/asm/mm-arch-hooks.h b/arch/m68k/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 7e8709bc90ae..000000000000
--- a/arch/m68k/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_M68K_MM_ARCH_HOOKS_H
13#define _ASM_M68K_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_M68K_MM_ARCH_HOOKS_H */
diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
index 199320f3c345..df31353fd200 100644
--- a/arch/metag/include/asm/Kbuild
+++ b/arch/metag/include/asm/Kbuild
@@ -25,6 +25,7 @@ generic-y += kvm_para.h
25generic-y += local.h 25generic-y += local.h
26generic-y += local64.h 26generic-y += local64.h
27generic-y += mcs_spinlock.h 27generic-y += mcs_spinlock.h
28generic-y += mm-arch-hooks.h
28generic-y += msgbuf.h 29generic-y += msgbuf.h
29generic-y += mutex.h 30generic-y += mutex.h
30generic-y += param.h 31generic-y += param.h
diff --git a/arch/metag/include/asm/mm-arch-hooks.h b/arch/metag/include/asm/mm-arch-hooks.h
deleted file mode 100644
index b0072b2eb0de..000000000000
--- a/arch/metag/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_METAG_MM_ARCH_HOOKS_H
13#define _ASM_METAG_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_METAG_MM_ARCH_HOOKS_H */
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 9989ddb169ca..2f222f355c4b 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += device.h
6generic-y += exec.h 6generic-y += exec.h
7generic-y += irq_work.h 7generic-y += irq_work.h
8generic-y += mcs_spinlock.h 8generic-y += mcs_spinlock.h
9generic-y += mm-arch-hooks.h
9generic-y += preempt.h 10generic-y += preempt.h
10generic-y += syscalls.h 11generic-y += syscalls.h
11generic-y += trace_clock.h 12generic-y += trace_clock.h
diff --git a/arch/microblaze/include/asm/mm-arch-hooks.h b/arch/microblaze/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 5c4065911bda..000000000000
--- a/arch/microblaze/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_MICROBLAZE_MM_ARCH_HOOKS_H
13#define _ASM_MICROBLAZE_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_MICROBLAZE_MM_ARCH_HOOKS_H */
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index aab7e46cadd5..cee5f93e5712 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1427,6 +1427,7 @@ config CPU_MIPS64_R6
1427 select CPU_SUPPORTS_HIGHMEM 1427 select CPU_SUPPORTS_HIGHMEM
1428 select CPU_SUPPORTS_MSA 1428 select CPU_SUPPORTS_MSA
1429 select GENERIC_CSUM 1429 select GENERIC_CSUM
1430 select MIPS_O32_FP64_SUPPORT if MIPS32_O32
1430 help 1431 help
1431 Choose this option to build a kernel for release 6 or later of the 1432 Choose this option to build a kernel for release 6 or later of the
1432 MIPS64 architecture. New MIPS processors, starting with the Warrior 1433 MIPS64 architecture. New MIPS processors, starting with the Warrior
@@ -2262,11 +2263,6 @@ config MIPS_CM
2262config MIPS_CPC 2263config MIPS_CPC
2263 bool 2264 bool
2264 2265
2265config SB1_PASS_1_WORKAROUNDS
2266 bool
2267 depends on CPU_SB1_PASS_1
2268 default y
2269
2270config SB1_PASS_2_WORKAROUNDS 2266config SB1_PASS_2_WORKAROUNDS
2271 bool 2267 bool
2272 depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2) 2268 depends on CPU_SB1 && (CPU_SB1_PASS_2_2 || CPU_SB1_PASS_2)
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index ae2dd59050f7..252e347958f3 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -181,13 +181,6 @@ cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,)
181cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) 181cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,)
182cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,) 182cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,)
183 183
184ifdef CONFIG_CPU_SB1
185ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
186KBUILD_AFLAGS_MODULE += -msb1-pass1-workarounds
187KBUILD_CFLAGS_MODULE += -msb1-pass1-workarounds
188endif
189endif
190
191# For smartmips configurations, there are hundreds of warnings due to ISA overrides 184# For smartmips configurations, there are hundreds of warnings due to ISA overrides
192# in assembly and header files. smartmips is only supported for MIPS32r1 onwards 185# in assembly and header files. smartmips is only supported for MIPS32r1 onwards
193# and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or 186# and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 7fe5c61a3cb8..1f8546081d20 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -7,6 +7,7 @@ generic-y += emergency-restart.h
7generic-y += irq_work.h 7generic-y += irq_work.h
8generic-y += local64.h 8generic-y += local64.h
9generic-y += mcs_spinlock.h 9generic-y += mcs_spinlock.h
10generic-y += mm-arch-hooks.h
10generic-y += mutex.h 11generic-y += mutex.h
11generic-y += parport.h 12generic-y += parport.h
12generic-y += percpu.h 13generic-y += percpu.h
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 084780b355aa..1b0625189835 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -74,7 +74,7 @@ static inline int __enable_fpu(enum fpu_mode mode)
74 goto fr_common; 74 goto fr_common;
75 75
76 case FPU_64BIT: 76 case FPU_64BIT:
77#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_CPU_MIPS32_R6) \ 77#if !(defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) \
78 || defined(CONFIG_64BIT)) 78 || defined(CONFIG_64BIT))
79 /* we only have a 32-bit FPU */ 79 /* we only have a 32-bit FPU */
80 return SIGFPE; 80 return SIGFPE;
diff --git a/arch/mips/include/asm/mach-sibyte/war.h b/arch/mips/include/asm/mach-sibyte/war.h
index 0a227d426b9c..520f8fc2c806 100644
--- a/arch/mips/include/asm/mach-sibyte/war.h
+++ b/arch/mips/include/asm/mach-sibyte/war.h
@@ -13,8 +13,7 @@
13#define R4600_V2_HIT_CACHEOP_WAR 0 13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0 14#define R5432_CP0_INTERRUPT_WAR 0
15 15
16#if defined(CONFIG_SB1_PASS_1_WORKAROUNDS) || \ 16#if defined(CONFIG_SB1_PASS_2_WORKAROUNDS)
17 defined(CONFIG_SB1_PASS_2_WORKAROUNDS)
18 17
19#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
20extern int sb1250_m3_workaround_needed(void); 19extern int sb1250_m3_workaround_needed(void);
diff --git a/arch/mips/include/asm/mm-arch-hooks.h b/arch/mips/include/asm/mm-arch-hooks.h
deleted file mode 100644
index b5609fe8e475..000000000000
--- a/arch/mips/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_MIPS_MM_ARCH_HOOKS_H
13#define _ASM_MIPS_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_MIPS_MM_ARCH_HOOKS_H */
diff --git a/arch/mips/include/uapi/asm/sigcontext.h b/arch/mips/include/uapi/asm/sigcontext.h
index 6c9906f59c6e..9081d88ae44f 100644
--- a/arch/mips/include/uapi/asm/sigcontext.h
+++ b/arch/mips/include/uapi/asm/sigcontext.h
@@ -16,7 +16,7 @@
16 16
17/* 17/*
18 * Keep this struct definition in sync with the sigcontext fragment 18 * Keep this struct definition in sync with the sigcontext fragment
19 * in arch/mips/tools/offset.c 19 * in arch/mips/kernel/asm-offsets.c
20 */ 20 */
21struct sigcontext { 21struct sigcontext {
22 unsigned int sc_regmask; /* Unused */ 22 unsigned int sc_regmask; /* Unused */
@@ -46,7 +46,7 @@ struct sigcontext {
46#include <linux/posix_types.h> 46#include <linux/posix_types.h>
47/* 47/*
48 * Keep this struct definition in sync with the sigcontext fragment 48 * Keep this struct definition in sync with the sigcontext fragment
49 * in arch/mips/tools/offset.c 49 * in arch/mips/kernel/asm-offsets.c
50 * 50 *
51 * Warning: this structure illdefined with sc_badvaddr being just an unsigned 51 * Warning: this structure illdefined with sc_badvaddr being just an unsigned
52 * int so it was changed to unsigned long in 2.6.0-test1. This may break 52 * int so it was changed to unsigned long in 2.6.0-test1. This may break
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index beabe19ff8e5..072fab13645d 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * offset.c: Calculate pt_regs and task_struct offsets. 2 * asm-offsets.c: Calculate pt_regs and task_struct offsets.
3 * 3 *
4 * Copyright (C) 1996 David S. Miller 4 * Copyright (C) 1996 David S. Miller
5 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle 5 * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index a8bb972fd9fd..cb9a095f5c5e 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -81,11 +81,6 @@ choice
81 prompt "SiByte SOC Stepping" 81 prompt "SiByte SOC Stepping"
82 depends on SIBYTE_SB1xxx_SOC 82 depends on SIBYTE_SB1xxx_SOC
83 83
84config CPU_SB1_PASS_1
85 bool "1250 Pass1"
86 depends on SIBYTE_SB1250
87 select CPU_HAS_PREFETCH
88
89config CPU_SB1_PASS_2_1250 84config CPU_SB1_PASS_2_1250
90 bool "1250 An" 85 bool "1250 An"
91 depends on SIBYTE_SB1250 86 depends on SIBYTE_SB1250
diff --git a/arch/mips/sibyte/common/bus_watcher.c b/arch/mips/sibyte/common/bus_watcher.c
index 5581844c9194..41a1d2242211 100644
--- a/arch/mips/sibyte/common/bus_watcher.c
+++ b/arch/mips/sibyte/common/bus_watcher.c
@@ -81,10 +81,7 @@ void check_bus_watcher(void)
81{ 81{
82 u32 status, l2_err, memio_err; 82 u32 status, l2_err, memio_err;
83 83
84#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 84#if defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250)
85 /* Destructive read, clears register and interrupt */
86 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS));
87#elif defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250)
88 /* Use non-destructive register */ 85 /* Use non-destructive register */
89 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG)); 86 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG));
90#elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80) 87#elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
diff --git a/arch/mips/sibyte/sb1250/setup.c b/arch/mips/sibyte/sb1250/setup.c
index 3c02b2a77ae9..9d3c24efdf4a 100644
--- a/arch/mips/sibyte/sb1250/setup.c
+++ b/arch/mips/sibyte/sb1250/setup.c
@@ -202,12 +202,10 @@ void __init sb1250_setup(void)
202 202
203 switch (war_pass) { 203 switch (war_pass) {
204 case K_SYS_REVISION_BCM1250_PASS1: 204 case K_SYS_REVISION_BCM1250_PASS1:
205#ifndef CONFIG_SB1_PASS_1_WORKAROUNDS
206 printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, " 205 printk("@@@@ This is a BCM1250 A0-A2 (Pass 1) board, "
207 "and the kernel doesn't have the proper " 206 "and the kernel doesn't have the proper "
208 "workarounds compiled in. @@@@\n"); 207 "workarounds compiled in. @@@@\n");
209 bad_config = 1; 208 bad_config = 1;
210#endif
211 break; 209 break;
212 case K_SYS_REVISION_BCM1250_PASS2: 210 case K_SYS_REVISION_BCM1250_PASS2:
213 /* Pass 2 - easiest as default for now - so many numbers */ 211 /* Pass 2 - easiest as default for now - so many numbers */
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index de30b0c88796..6edb9ee6128e 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += cputime.h
5generic-y += exec.h 5generic-y += exec.h
6generic-y += irq_work.h 6generic-y += irq_work.h
7generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
8generic-y += mm-arch-hooks.h
8generic-y += preempt.h 9generic-y += preempt.h
9generic-y += sections.h 10generic-y += sections.h
10generic-y += trace_clock.h 11generic-y += trace_clock.h
diff --git a/arch/mn10300/include/asm/mm-arch-hooks.h b/arch/mn10300/include/asm/mm-arch-hooks.h
deleted file mode 100644
index e2029a652f4c..000000000000
--- a/arch/mn10300/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_MN10300_MM_ARCH_HOOKS_H
13#define _ASM_MN10300_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_MN10300_MM_ARCH_HOOKS_H */
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index 434639d510b3..914864eb5a25 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -30,6 +30,7 @@ generic-y += kmap_types.h
30generic-y += kvm_para.h 30generic-y += kvm_para.h
31generic-y += local.h 31generic-y += local.h
32generic-y += mcs_spinlock.h 32generic-y += mcs_spinlock.h
33generic-y += mm-arch-hooks.h
33generic-y += mman.h 34generic-y += mman.h
34generic-y += module.h 35generic-y += module.h
35generic-y += msgbuf.h 36generic-y += msgbuf.h
diff --git a/arch/nios2/include/asm/mm-arch-hooks.h b/arch/nios2/include/asm/mm-arch-hooks.h
deleted file mode 100644
index d7290dc68558..000000000000
--- a/arch/nios2/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_NIOS2_MM_ARCH_HOOKS_H
13#define _ASM_NIOS2_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_NIOS2_MM_ARCH_HOOKS_H */
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index e5a693b16da2..443f44de1020 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -17,6 +17,7 @@ config OPENRISC
17 select GENERIC_IRQ_SHOW 17 select GENERIC_IRQ_SHOW
18 select GENERIC_IOMAP 18 select GENERIC_IOMAP
19 select GENERIC_CPU_DEVICES 19 select GENERIC_CPU_DEVICES
20 select HAVE_UID16
20 select GENERIC_ATOMIC64 21 select GENERIC_ATOMIC64
21 select GENERIC_CLOCKEVENTS 22 select GENERIC_CLOCKEVENTS
22 select GENERIC_STRNCPY_FROM_USER 23 select GENERIC_STRNCPY_FROM_USER
@@ -31,9 +32,6 @@ config MMU
31config HAVE_DMA_ATTRS 32config HAVE_DMA_ATTRS
32 def_bool y 33 def_bool y
33 34
34config UID16
35 def_bool y
36
37config RWSEM_GENERIC_SPINLOCK 35config RWSEM_GENERIC_SPINLOCK
38 def_bool y 36 def_bool y
39 37
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 2a2e39b8109a..2832f031fb11 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -36,6 +36,7 @@ generic-y += kmap_types.h
36generic-y += kvm_para.h 36generic-y += kvm_para.h
37generic-y += local.h 37generic-y += local.h
38generic-y += mcs_spinlock.h 38generic-y += mcs_spinlock.h
39generic-y += mm-arch-hooks.h
39generic-y += mman.h 40generic-y += mman.h
40generic-y += module.h 41generic-y += module.h
41generic-y += msgbuf.h 42generic-y += msgbuf.h
diff --git a/arch/openrisc/include/asm/mm-arch-hooks.h b/arch/openrisc/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 6d33cb555fe1..000000000000
--- a/arch/openrisc/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_OPENRISC_MM_ARCH_HOOKS_H
13#define _ASM_OPENRISC_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_OPENRISC_MM_ARCH_HOOKS_H */
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 12b341d04f88..f9b3a81aefcd 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -15,6 +15,7 @@ generic-y += kvm_para.h
15generic-y += local.h 15generic-y += local.h
16generic-y += local64.h 16generic-y += local64.h
17generic-y += mcs_spinlock.h 17generic-y += mcs_spinlock.h
18generic-y += mm-arch-hooks.h
18generic-y += mutex.h 19generic-y += mutex.h
19generic-y += param.h 20generic-y += param.h
20generic-y += percpu.h 21generic-y += percpu.h
diff --git a/arch/parisc/include/asm/mm-arch-hooks.h b/arch/parisc/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 654ec63b0ee9..000000000000
--- a/arch/parisc/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_PARISC_MM_ARCH_HOOKS_H
13#define _ASM_PARISC_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_PARISC_MM_ARCH_HOOKS_H */
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 3a08eae3318f..3edbb9fc91b4 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -72,7 +72,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
72 72
73static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 73static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
74{ 74{
75 if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) 75 if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
76 /* 76 /*
77 * This is the permanent pmd attached to the pgd; 77 * This is the permanent pmd attached to the pgd;
78 * cannot free it. 78 * cannot free it.
@@ -81,6 +81,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
81 */ 81 */
82 mm_inc_nr_pmds(mm); 82 mm_inc_nr_pmds(mm);
83 return; 83 return;
84 }
84 free_pages((unsigned long)pmd, PMD_ORDER); 85 free_pages((unsigned long)pmd, PMD_ORDER);
85} 86}
86 87
diff --git a/arch/s390/include/asm/Kbuild b/arch/s390/include/asm/Kbuild
index dc5385ebb071..5ad26dd94d77 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -3,5 +3,6 @@
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += irq_work.h 4generic-y += irq_work.h
5generic-y += mcs_spinlock.h 5generic-y += mcs_spinlock.h
6generic-y += mm-arch-hooks.h
6generic-y += preempt.h 7generic-y += preempt.h
7generic-y += trace_clock.h 8generic-y += trace_clock.h
diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_reg.h
index cfad7fca01d6..d7697ab802f6 100644
--- a/arch/s390/include/asm/ctl_reg.h
+++ b/arch/s390/include/asm/ctl_reg.h
@@ -57,7 +57,10 @@ union ctlreg0 {
57 unsigned long lap : 1; /* Low-address-protection control */ 57 unsigned long lap : 1; /* Low-address-protection control */
58 unsigned long : 4; 58 unsigned long : 4;
59 unsigned long edat : 1; /* Enhanced-DAT-enablement control */ 59 unsigned long edat : 1; /* Enhanced-DAT-enablement control */
60 unsigned long : 23; 60 unsigned long : 4;
61 unsigned long afp : 1; /* AFP-register control */
62 unsigned long vx : 1; /* Vector enablement control */
63 unsigned long : 17;
61 }; 64 };
62}; 65};
63 66
diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index 0130d0379edd..d9be7c0c1291 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -14,6 +14,7 @@
14 14
15#define is_hugepage_only_range(mm, addr, len) 0 15#define is_hugepage_only_range(mm, addr, len) 0
16#define hugetlb_free_pgd_range free_pgd_range 16#define hugetlb_free_pgd_range free_pgd_range
17#define hugepages_supported() (MACHINE_HAS_HPAGE)
17 18
18void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, 19void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
19 pte_t *ptep, pte_t pte); 20 pte_t *ptep, pte_t pte);
diff --git a/arch/s390/include/asm/mm-arch-hooks.h b/arch/s390/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 07680b2f3c59..000000000000
--- a/arch/s390/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_S390_MM_ARCH_HOOKS_H
13#define _ASM_S390_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_S390_MM_ARCH_HOOKS_H */
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index dd345238d9a7..53eacbd4f09b 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -17,10 +17,7 @@
17#define PAGE_DEFAULT_ACC 0 17#define PAGE_DEFAULT_ACC 0
18#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) 18#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
19 19
20#include <asm/setup.h> 20#define HPAGE_SHIFT 20
21#ifndef __ASSEMBLY__
22
23extern int HPAGE_SHIFT;
24#define HPAGE_SIZE (1UL << HPAGE_SHIFT) 21#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
25#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 22#define HPAGE_MASK (~(HPAGE_SIZE - 1))
26#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 23#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
@@ -30,6 +27,9 @@ extern int HPAGE_SHIFT;
30#define ARCH_HAS_PREPARE_HUGEPAGE 27#define ARCH_HAS_PREPARE_HUGEPAGE
31#define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH 28#define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH
32 29
30#include <asm/setup.h>
31#ifndef __ASSEMBLY__
32
33static inline void storage_key_init_range(unsigned long start, unsigned long end) 33static inline void storage_key_init_range(unsigned long start, unsigned long end)
34{ 34{
35#if PAGE_DEFAULT_KEY 35#if PAGE_DEFAULT_KEY
diff --git a/arch/s390/include/asm/perf_event.h b/arch/s390/include/asm/perf_event.h
index 4cb19fe76dd9..f897ec73dc8c 100644
--- a/arch/s390/include/asm/perf_event.h
+++ b/arch/s390/include/asm/perf_event.h
@@ -87,7 +87,15 @@ struct sf_raw_sample {
87} __packed; 87} __packed;
88 88
89/* Perf hardware reserve and release functions */ 89/* Perf hardware reserve and release functions */
90#ifdef CONFIG_PERF_EVENTS
90int perf_reserve_sampling(void); 91int perf_reserve_sampling(void);
91void perf_release_sampling(void); 92void perf_release_sampling(void);
93#else /* CONFIG_PERF_EVENTS */
94static inline int perf_reserve_sampling(void)
95{
96 return 0;
97}
98static inline void perf_release_sampling(void) {}
99#endif /* CONFIG_PERF_EVENTS */
92 100
93#endif /* _ASM_S390_PERF_EVENT_H */ 101#endif /* _ASM_S390_PERF_EVENT_H */
diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index 505c17c0ae1a..56b550893593 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -21,6 +21,7 @@
21#include <asm/nmi.h> 21#include <asm/nmi.h>
22#include <asm/crw.h> 22#include <asm/crw.h>
23#include <asm/switch_to.h> 23#include <asm/switch_to.h>
24#include <asm/ctl_reg.h>
24 25
25struct mcck_struct { 26struct mcck_struct {
26 int kill_task; 27 int kill_task;
@@ -129,26 +130,30 @@ static int notrace s390_revalidate_registers(struct mci *mci)
129 } else 130 } else
130 asm volatile("lfpc 0(%0)" : : "a" (fpt_creg_save_area)); 131 asm volatile("lfpc 0(%0)" : : "a" (fpt_creg_save_area));
131 132
132 asm volatile( 133 if (!MACHINE_HAS_VX) {
133 " ld 0,0(%0)\n" 134 /* Revalidate floating point registers */
134 " ld 1,8(%0)\n" 135 asm volatile(
135 " ld 2,16(%0)\n" 136 " ld 0,0(%0)\n"
136 " ld 3,24(%0)\n" 137 " ld 1,8(%0)\n"
137 " ld 4,32(%0)\n" 138 " ld 2,16(%0)\n"
138 " ld 5,40(%0)\n" 139 " ld 3,24(%0)\n"
139 " ld 6,48(%0)\n" 140 " ld 4,32(%0)\n"
140 " ld 7,56(%0)\n" 141 " ld 5,40(%0)\n"
141 " ld 8,64(%0)\n" 142 " ld 6,48(%0)\n"
142 " ld 9,72(%0)\n" 143 " ld 7,56(%0)\n"
143 " ld 10,80(%0)\n" 144 " ld 8,64(%0)\n"
144 " ld 11,88(%0)\n" 145 " ld 9,72(%0)\n"
145 " ld 12,96(%0)\n" 146 " ld 10,80(%0)\n"
146 " ld 13,104(%0)\n" 147 " ld 11,88(%0)\n"
147 " ld 14,112(%0)\n" 148 " ld 12,96(%0)\n"
148 " ld 15,120(%0)\n" 149 " ld 13,104(%0)\n"
149 : : "a" (fpt_save_area)); 150 " ld 14,112(%0)\n"
150 /* Revalidate vector registers */ 151 " ld 15,120(%0)\n"
151 if (MACHINE_HAS_VX && current->thread.vxrs) { 152 : : "a" (fpt_save_area));
153 } else {
154 /* Revalidate vector registers */
155 union ctlreg0 cr0;
156
152 if (!mci->vr) { 157 if (!mci->vr) {
153 /* 158 /*
154 * Vector registers can't be restored and therefore 159 * Vector registers can't be restored and therefore
@@ -156,8 +161,12 @@ static int notrace s390_revalidate_registers(struct mci *mci)
156 */ 161 */
157 kill_task = 1; 162 kill_task = 1;
158 } 163 }
164 cr0.val = S390_lowcore.cregs_save_area[0];
165 cr0.afp = cr0.vx = 1;
166 __ctl_load(cr0.val, 0, 0);
159 restore_vx_regs((__vector128 *) 167 restore_vx_regs((__vector128 *)
160 S390_lowcore.vector_save_area_addr); 168 &S390_lowcore.vector_save_area);
169 __ctl_load(S390_lowcore.cregs_save_area[0], 0, 0);
161 } 170 }
162 /* Revalidate access registers */ 171 /* Revalidate access registers */
163 asm volatile( 172 asm volatile(
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index dc5edc29b73a..8f587d871b9f 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -163,7 +163,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
163asmlinkage void execve_tail(void) 163asmlinkage void execve_tail(void)
164{ 164{
165 current->thread.fp_regs.fpc = 0; 165 current->thread.fp_regs.fpc = 0;
166 asm volatile("sfpc %0,%0" : : "d" (0)); 166 asm volatile("sfpc %0" : : "d" (0));
167} 167}
168 168
169/* 169/*
diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S
index 43c3169ea49c..ada0c07fe1a8 100644
--- a/arch/s390/kernel/sclp.S
+++ b/arch/s390/kernel/sclp.S
@@ -270,6 +270,8 @@ ENTRY(_sclp_print_early)
270 jno .Lesa2 270 jno .Lesa2
271 ahi %r15,-80 271 ahi %r15,-80
272 stmh %r6,%r15,96(%r15) # store upper register halves 272 stmh %r6,%r15,96(%r15) # store upper register halves
273 basr %r13,0
274 lmh %r0,%r15,.Lzeroes-.(%r13) # clear upper register halves
273.Lesa2: 275.Lesa2:
274 lr %r10,%r2 # save string pointer 276 lr %r10,%r2 # save string pointer
275 lhi %r2,0 277 lhi %r2,0
@@ -291,6 +293,8 @@ ENTRY(_sclp_print_early)
291.Lesa3: 293.Lesa3:
292 lm %r6,%r15,120(%r15) # restore registers 294 lm %r6,%r15,120(%r15) # restore registers
293 br %r14 295 br %r14
296.Lzeroes:
297 .fill 64,4,0
294 298
295.LwritedataS4: 299.LwritedataS4:
296 .long 0x00760005 # SCLP command for write data 300 .long 0x00760005 # SCLP command for write data
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index f7f027caaaaa..ca070d260af2 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -885,8 +885,6 @@ void __init setup_arch(char **cmdline_p)
885 */ 885 */
886 setup_hwcaps(); 886 setup_hwcaps();
887 887
888 HPAGE_SHIFT = MACHINE_HAS_HPAGE ? 20 : 0;
889
890 /* 888 /*
891 * Create kernel page tables and switch to virtual addressing. 889 * Create kernel page tables and switch to virtual addressing.
892 */ 890 */
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 33082d0d101b..b33f66110ca9 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -31,8 +31,6 @@
31#define ALLOC_ORDER 2 31#define ALLOC_ORDER 2
32#define FRAG_MASK 0x03 32#define FRAG_MASK 0x03
33 33
34int HPAGE_SHIFT;
35
36unsigned long *crst_table_alloc(struct mm_struct *mm) 34unsigned long *crst_table_alloc(struct mm_struct *mm)
37{ 35{
38 struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER); 36 struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index bc927a09a172..9cfa2ffaa9d6 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -16,6 +16,7 @@
16#include <linux/fs.h> 16#include <linux/fs.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19#include <asm/perf_event.h>
19 20
20#include "../../../drivers/oprofile/oprof.h" 21#include "../../../drivers/oprofile/oprof.h"
21 22
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index 138fb3db45ba..92ffe397b893 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -7,6 +7,7 @@ generic-y += clkdev.h
7generic-y += cputime.h 7generic-y += cputime.h
8generic-y += irq_work.h 8generic-y += irq_work.h
9generic-y += mcs_spinlock.h 9generic-y += mcs_spinlock.h
10generic-y += mm-arch-hooks.h
10generic-y += preempt.h 11generic-y += preempt.h
11generic-y += sections.h 12generic-y += sections.h
12generic-y += trace_clock.h 13generic-y += trace_clock.h
diff --git a/arch/score/include/asm/mm-arch-hooks.h b/arch/score/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 5e38689f189a..000000000000
--- a/arch/score/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_SCORE_MM_ARCH_HOOKS_H
13#define _ASM_SCORE_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_SCORE_MM_ARCH_HOOKS_H */
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 9ac4626e7284..aac452b26aa8 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -16,6 +16,7 @@ generic-y += kvm_para.h
16generic-y += local.h 16generic-y += local.h
17generic-y += local64.h 17generic-y += local64.h
18generic-y += mcs_spinlock.h 18generic-y += mcs_spinlock.h
19generic-y += mm-arch-hooks.h
19generic-y += mman.h 20generic-y += mman.h
20generic-y += msgbuf.h 21generic-y += msgbuf.h
21generic-y += param.h 22generic-y += param.h
diff --git a/arch/sh/include/asm/mm-arch-hooks.h b/arch/sh/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 18087298b728..000000000000
--- a/arch/sh/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_SH_MM_ARCH_HOOKS_H
13#define _ASM_SH_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_SH_MM_ARCH_HOOKS_H */
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 2b2a69dcc467..e928618838bc 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -12,6 +12,7 @@ generic-y += linkage.h
12generic-y += local.h 12generic-y += local.h
13generic-y += local64.h 13generic-y += local64.h
14generic-y += mcs_spinlock.h 14generic-y += mcs_spinlock.h
15generic-y += mm-arch-hooks.h
15generic-y += module.h 16generic-y += module.h
16generic-y += mutex.h 17generic-y += mutex.h
17generic-y += preempt.h 18generic-y += preempt.h
diff --git a/arch/sparc/include/asm/mm-arch-hooks.h b/arch/sparc/include/asm/mm-arch-hooks.h
deleted file mode 100644
index b89ba44c16f1..000000000000
--- a/arch/sparc/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_SPARC_MM_ARCH_HOOKS_H
13#define _ASM_SPARC_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_SPARC_MM_ARCH_HOOKS_H */
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index d53654488c2c..d8a843163471 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -19,6 +19,7 @@ generic-y += irq_regs.h
19generic-y += local.h 19generic-y += local.h
20generic-y += local64.h 20generic-y += local64.h
21generic-y += mcs_spinlock.h 21generic-y += mcs_spinlock.h
22generic-y += mm-arch-hooks.h
22generic-y += msgbuf.h 23generic-y += msgbuf.h
23generic-y += mutex.h 24generic-y += mutex.h
24generic-y += param.h 25generic-y += param.h
diff --git a/arch/tile/include/asm/mm-arch-hooks.h b/arch/tile/include/asm/mm-arch-hooks.h
deleted file mode 100644
index d1709ea774f7..000000000000
--- a/arch/tile/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_TILE_MM_ARCH_HOOKS_H
13#define _ASM_TILE_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_TILE_MM_ARCH_HOOKS_H */
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 3d63ff6f583f..149ec55f9c46 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -16,6 +16,7 @@ generic-y += irq_regs.h
16generic-y += irq_work.h 16generic-y += irq_work.h
17generic-y += kdebug.h 17generic-y += kdebug.h
18generic-y += mcs_spinlock.h 18generic-y += mcs_spinlock.h
19generic-y += mm-arch-hooks.h
19generic-y += mutex.h 20generic-y += mutex.h
20generic-y += param.h 21generic-y += param.h
21generic-y += pci.h 22generic-y += pci.h
diff --git a/arch/um/include/asm/mm-arch-hooks.h b/arch/um/include/asm/mm-arch-hooks.h
deleted file mode 100644
index a7c8b0dfdd4e..000000000000
--- a/arch/um/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_UM_MM_ARCH_HOOKS_H
13#define _ASM_UM_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_UM_MM_ARCH_HOOKS_H */
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index d12b377b5a8b..1fc7a286dc6f 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -26,6 +26,7 @@ generic-y += kdebug.h
26generic-y += kmap_types.h 26generic-y += kmap_types.h
27generic-y += local.h 27generic-y += local.h
28generic-y += mcs_spinlock.h 28generic-y += mcs_spinlock.h
29generic-y += mm-arch-hooks.h
29generic-y += mman.h 30generic-y += mman.h
30generic-y += module.h 31generic-y += module.h
31generic-y += msgbuf.h 32generic-y += msgbuf.h
diff --git a/arch/unicore32/include/asm/mm-arch-hooks.h b/arch/unicore32/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 4d79a850c509..000000000000
--- a/arch/unicore32/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_UNICORE32_MM_ARCH_HOOKS_H
13#define _ASM_UNICORE32_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_UNICORE32_MM_ARCH_HOOKS_H */
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3dbb7e7909ca..b3a1a5d77d92 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -41,6 +41,7 @@ config X86
41 select ARCH_USE_CMPXCHG_LOCKREF if X86_64 41 select ARCH_USE_CMPXCHG_LOCKREF if X86_64
42 select ARCH_USE_QUEUED_RWLOCKS 42 select ARCH_USE_QUEUED_RWLOCKS
43 select ARCH_USE_QUEUED_SPINLOCKS 43 select ARCH_USE_QUEUED_SPINLOCKS
44 select ARCH_WANTS_DYNAMIC_TASK_STRUCT
44 select ARCH_WANT_FRAME_POINTERS 45 select ARCH_WANT_FRAME_POINTERS
45 select ARCH_WANT_IPC_PARSE_VERSION if X86_32 46 select ARCH_WANT_IPC_PARSE_VERSION if X86_32
46 select ARCH_WANT_OPTIONAL_GPIOLIB 47 select ARCH_WANT_OPTIONAL_GPIOLIB
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index a15893d17c55..d8c0d3266173 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -297,6 +297,18 @@ config OPTIMIZE_INLINING
297 297
298 If unsure, say N. 298 If unsure, say N.
299 299
300config DEBUG_ENTRY
301 bool "Debug low-level entry code"
302 depends on DEBUG_KERNEL
303 ---help---
304 This option enables sanity checks in x86's low-level entry code.
305 Some of these sanity checks may slow down kernel entries and
306 exits or otherwise impact performance.
307
308 This is currently used to help test NMI code.
309
310 If unsure, say N.
311
300config DEBUG_NMI_SELFTEST 312config DEBUG_NMI_SELFTEST
301 bool "NMI Selftest" 313 bool "NMI Selftest"
302 depends on DEBUG_KERNEL && X86_LOCAL_APIC 314 depends on DEBUG_KERNEL && X86_LOCAL_APIC
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index 3bb2c4302df1..8cb3e438f21e 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -1237,11 +1237,12 @@ ENTRY(nmi)
1237 * If the variable is not set and the stack is not the NMI 1237 * If the variable is not set and the stack is not the NMI
1238 * stack then: 1238 * stack then:
1239 * o Set the special variable on the stack 1239 * o Set the special variable on the stack
1240 * o Copy the interrupt frame into a "saved" location on the stack 1240 * o Copy the interrupt frame into an "outermost" location on the
1241 * o Copy the interrupt frame into a "copy" location on the stack 1241 * stack
1242 * o Copy the interrupt frame into an "iret" location on the stack
1242 * o Continue processing the NMI 1243 * o Continue processing the NMI
1243 * If the variable is set or the previous stack is the NMI stack: 1244 * If the variable is set or the previous stack is the NMI stack:
1244 * o Modify the "copy" location to jump to the repeate_nmi 1245 * o Modify the "iret" location to jump to the repeat_nmi
1245 * o return back to the first NMI 1246 * o return back to the first NMI
1246 * 1247 *
1247 * Now on exit of the first NMI, we first clear the stack variable 1248 * Now on exit of the first NMI, we first clear the stack variable
@@ -1250,31 +1251,151 @@ ENTRY(nmi)
1250 * a nested NMI that updated the copy interrupt stack frame, a 1251 * a nested NMI that updated the copy interrupt stack frame, a
1251 * jump will be made to the repeat_nmi code that will handle the second 1252 * jump will be made to the repeat_nmi code that will handle the second
1252 * NMI. 1253 * NMI.
1254 *
1255 * However, espfix prevents us from directly returning to userspace
1256 * with a single IRET instruction. Similarly, IRET to user mode
1257 * can fault. We therefore handle NMIs from user space like
1258 * other IST entries.
1253 */ 1259 */
1254 1260
1255 /* Use %rdx as our temp variable throughout */ 1261 /* Use %rdx as our temp variable throughout */
1256 pushq %rdx 1262 pushq %rdx
1257 1263
1264 testb $3, CS-RIP+8(%rsp)
1265 jz .Lnmi_from_kernel
1266
1267 /*
1268 * NMI from user mode. We need to run on the thread stack, but we
1269 * can't go through the normal entry paths: NMIs are masked, and
1270 * we don't want to enable interrupts, because then we'll end
1271 * up in an awkward situation in which IRQs are on but NMIs
1272 * are off.
1273 */
1274
1275 SWAPGS
1276 cld
1277 movq %rsp, %rdx
1278 movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp
1279 pushq 5*8(%rdx) /* pt_regs->ss */
1280 pushq 4*8(%rdx) /* pt_regs->rsp */
1281 pushq 3*8(%rdx) /* pt_regs->flags */
1282 pushq 2*8(%rdx) /* pt_regs->cs */
1283 pushq 1*8(%rdx) /* pt_regs->rip */
1284 pushq $-1 /* pt_regs->orig_ax */
1285 pushq %rdi /* pt_regs->di */
1286 pushq %rsi /* pt_regs->si */
1287 pushq (%rdx) /* pt_regs->dx */
1288 pushq %rcx /* pt_regs->cx */
1289 pushq %rax /* pt_regs->ax */
1290 pushq %r8 /* pt_regs->r8 */
1291 pushq %r9 /* pt_regs->r9 */
1292 pushq %r10 /* pt_regs->r10 */
1293 pushq %r11 /* pt_regs->r11 */
1294 pushq %rbx /* pt_regs->rbx */
1295 pushq %rbp /* pt_regs->rbp */
1296 pushq %r12 /* pt_regs->r12 */
1297 pushq %r13 /* pt_regs->r13 */
1298 pushq %r14 /* pt_regs->r14 */
1299 pushq %r15 /* pt_regs->r15 */
1300
1301 /*
1302 * At this point we no longer need to worry about stack damage
1303 * due to nesting -- we're on the normal thread stack and we're
1304 * done with the NMI stack.
1305 */
1306
1307 movq %rsp, %rdi
1308 movq $-1, %rsi
1309 call do_nmi
1310
1311 /*
1312 * Return back to user mode. We must *not* do the normal exit
1313 * work, because we don't want to enable interrupts. Fortunately,
1314 * do_nmi doesn't modify pt_regs.
1315 */
1316 SWAPGS
1317 jmp restore_c_regs_and_iret
1318
1319.Lnmi_from_kernel:
1320 /*
1321 * Here's what our stack frame will look like:
1322 * +---------------------------------------------------------+
1323 * | original SS |
1324 * | original Return RSP |
1325 * | original RFLAGS |
1326 * | original CS |
1327 * | original RIP |
1328 * +---------------------------------------------------------+
1329 * | temp storage for rdx |
1330 * +---------------------------------------------------------+
1331 * | "NMI executing" variable |
1332 * +---------------------------------------------------------+
1333 * | iret SS } Copied from "outermost" frame |
1334 * | iret Return RSP } on each loop iteration; overwritten |
1335 * | iret RFLAGS } by a nested NMI to force another |
1336 * | iret CS } iteration if needed. |
1337 * | iret RIP } |
1338 * +---------------------------------------------------------+
1339 * | outermost SS } initialized in first_nmi; |
1340 * | outermost Return RSP } will not be changed before |
1341 * | outermost RFLAGS } NMI processing is done. |
1342 * | outermost CS } Copied to "iret" frame on each |
1343 * | outermost RIP } iteration. |
1344 * +---------------------------------------------------------+
1345 * | pt_regs |
1346 * +---------------------------------------------------------+
1347 *
1348 * The "original" frame is used by hardware. Before re-enabling
1349 * NMIs, we need to be done with it, and we need to leave enough
1350 * space for the asm code here.
1351 *
1352 * We return by executing IRET while RSP points to the "iret" frame.
1353 * That will either return for real or it will loop back into NMI
1354 * processing.
1355 *
1356 * The "outermost" frame is copied to the "iret" frame on each
1357 * iteration of the loop, so each iteration starts with the "iret"
1358 * frame pointing to the final return target.
1359 */
1360
1258 /* 1361 /*
1259 * If %cs was not the kernel segment, then the NMI triggered in user 1362 * Determine whether we're a nested NMI.
1260 * space, which means it is definitely not nested. 1363 *
1364 * If we interrupted kernel code between repeat_nmi and
1365 * end_repeat_nmi, then we are a nested NMI. We must not
1366 * modify the "iret" frame because it's being written by
1367 * the outer NMI. That's okay; the outer NMI handler is
1368 * about to about to call do_nmi anyway, so we can just
1369 * resume the outer NMI.
1261 */ 1370 */
1262 cmpl $__KERNEL_CS, 16(%rsp) 1371
1263 jne first_nmi 1372 movq $repeat_nmi, %rdx
1373 cmpq 8(%rsp), %rdx
1374 ja 1f
1375 movq $end_repeat_nmi, %rdx
1376 cmpq 8(%rsp), %rdx
1377 ja nested_nmi_out
13781:
1264 1379
1265 /* 1380 /*
1266 * Check the special variable on the stack to see if NMIs are 1381 * Now check "NMI executing". If it's set, then we're nested.
1267 * executing. 1382 * This will not detect if we interrupted an outer NMI just
1383 * before IRET.
1268 */ 1384 */
1269 cmpl $1, -8(%rsp) 1385 cmpl $1, -8(%rsp)
1270 je nested_nmi 1386 je nested_nmi
1271 1387
1272 /* 1388 /*
1273 * Now test if the previous stack was an NMI stack. 1389 * Now test if the previous stack was an NMI stack. This covers
1274 * We need the double check. We check the NMI stack to satisfy the 1390 * the case where we interrupt an outer NMI after it clears
1275 * race when the first NMI clears the variable before returning. 1391 * "NMI executing" but before IRET. We need to be careful, though:
1276 * We check the variable because the first NMI could be in a 1392 * there is one case in which RSP could point to the NMI stack
1277 * breakpoint routine using a breakpoint stack. 1393 * despite there being no NMI active: naughty userspace controls
1394 * RSP at the very beginning of the SYSCALL targets. We can
1395 * pull a fast one on naughty userspace, though: we program
1396 * SYSCALL to mask DF, so userspace cannot cause DF to be set
1397 * if it controls the kernel's RSP. We set DF before we clear
1398 * "NMI executing".
1278 */ 1399 */
1279 lea 6*8(%rsp), %rdx 1400 lea 6*8(%rsp), %rdx
1280 /* Compare the NMI stack (rdx) with the stack we came from (4*8(%rsp)) */ 1401 /* Compare the NMI stack (rdx) with the stack we came from (4*8(%rsp)) */
@@ -1286,25 +1407,20 @@ ENTRY(nmi)
1286 cmpq %rdx, 4*8(%rsp) 1407 cmpq %rdx, 4*8(%rsp)
1287 /* If it is below the NMI stack, it is a normal NMI */ 1408 /* If it is below the NMI stack, it is a normal NMI */
1288 jb first_nmi 1409 jb first_nmi
1289 /* Ah, it is within the NMI stack, treat it as nested */ 1410
1411 /* Ah, it is within the NMI stack. */
1412
1413 testb $(X86_EFLAGS_DF >> 8), (3*8 + 1)(%rsp)
1414 jz first_nmi /* RSP was user controlled. */
1415
1416 /* This is a nested NMI. */
1290 1417
1291nested_nmi: 1418nested_nmi:
1292 /* 1419 /*
1293 * Do nothing if we interrupted the fixup in repeat_nmi. 1420 * Modify the "iret" frame to point to repeat_nmi, forcing another
1294 * It's about to repeat the NMI handler, so we are fine 1421 * iteration of NMI handling.
1295 * with ignoring this one.
1296 */ 1422 */
1297 movq $repeat_nmi, %rdx 1423 subq $8, %rsp
1298 cmpq 8(%rsp), %rdx
1299 ja 1f
1300 movq $end_repeat_nmi, %rdx
1301 cmpq 8(%rsp), %rdx
1302 ja nested_nmi_out
1303
13041:
1305 /* Set up the interrupted NMIs stack to jump to repeat_nmi */
1306 leaq -1*8(%rsp), %rdx
1307 movq %rdx, %rsp
1308 leaq -10*8(%rsp), %rdx 1424 leaq -10*8(%rsp), %rdx
1309 pushq $__KERNEL_DS 1425 pushq $__KERNEL_DS
1310 pushq %rdx 1426 pushq %rdx
@@ -1318,61 +1434,42 @@ nested_nmi:
1318nested_nmi_out: 1434nested_nmi_out:
1319 popq %rdx 1435 popq %rdx
1320 1436
1321 /* No need to check faults here */ 1437 /* We are returning to kernel mode, so this cannot result in a fault. */
1322 INTERRUPT_RETURN 1438 INTERRUPT_RETURN
1323 1439
1324first_nmi: 1440first_nmi:
1325 /* 1441 /* Restore rdx. */
1326 * Because nested NMIs will use the pushed location that we
1327 * stored in rdx, we must keep that space available.
1328 * Here's what our stack frame will look like:
1329 * +-------------------------+
1330 * | original SS |
1331 * | original Return RSP |
1332 * | original RFLAGS |
1333 * | original CS |
1334 * | original RIP |
1335 * +-------------------------+
1336 * | temp storage for rdx |
1337 * +-------------------------+
1338 * | NMI executing variable |
1339 * +-------------------------+
1340 * | copied SS |
1341 * | copied Return RSP |
1342 * | copied RFLAGS |
1343 * | copied CS |
1344 * | copied RIP |
1345 * +-------------------------+
1346 * | Saved SS |
1347 * | Saved Return RSP |
1348 * | Saved RFLAGS |
1349 * | Saved CS |
1350 * | Saved RIP |
1351 * +-------------------------+
1352 * | pt_regs |
1353 * +-------------------------+
1354 *
1355 * The saved stack frame is used to fix up the copied stack frame
1356 * that a nested NMI may change to make the interrupted NMI iret jump
1357 * to the repeat_nmi. The original stack frame and the temp storage
1358 * is also used by nested NMIs and can not be trusted on exit.
1359 */
1360 /* Do not pop rdx, nested NMIs will corrupt that part of the stack */
1361 movq (%rsp), %rdx 1442 movq (%rsp), %rdx
1362 1443
1363 /* Set the NMI executing variable on the stack. */ 1444 /* Make room for "NMI executing". */
1364 pushq $1 1445 pushq $0
1365 1446
1366 /* Leave room for the "copied" frame */ 1447 /* Leave room for the "iret" frame */
1367 subq $(5*8), %rsp 1448 subq $(5*8), %rsp
1368 1449
1369 /* Copy the stack frame to the Saved frame */ 1450 /* Copy the "original" frame to the "outermost" frame */
1370 .rept 5 1451 .rept 5
1371 pushq 11*8(%rsp) 1452 pushq 11*8(%rsp)
1372 .endr 1453 .endr
1373 1454
1374 /* Everything up to here is safe from nested NMIs */ 1455 /* Everything up to here is safe from nested NMIs */
1375 1456
1457#ifdef CONFIG_DEBUG_ENTRY
1458 /*
1459 * For ease of testing, unmask NMIs right away. Disabled by
1460 * default because IRET is very expensive.
1461 */
1462 pushq $0 /* SS */
1463 pushq %rsp /* RSP (minus 8 because of the previous push) */
1464 addq $8, (%rsp) /* Fix up RSP */
1465 pushfq /* RFLAGS */
1466 pushq $__KERNEL_CS /* CS */
1467 pushq $1f /* RIP */
1468 INTERRUPT_RETURN /* continues at repeat_nmi below */
14691:
1470#endif
1471
1472repeat_nmi:
1376 /* 1473 /*
1377 * If there was a nested NMI, the first NMI's iret will return 1474 * If there was a nested NMI, the first NMI's iret will return
1378 * here. But NMIs are still enabled and we can take another 1475 * here. But NMIs are still enabled and we can take another
@@ -1381,16 +1478,20 @@ first_nmi:
1381 * it will just return, as we are about to repeat an NMI anyway. 1478 * it will just return, as we are about to repeat an NMI anyway.
1382 * This makes it safe to copy to the stack frame that a nested 1479 * This makes it safe to copy to the stack frame that a nested
1383 * NMI will update. 1480 * NMI will update.
1481 *
1482 * RSP is pointing to "outermost RIP". gsbase is unknown, but, if
1483 * we're repeating an NMI, gsbase has the same value that it had on
1484 * the first iteration. paranoid_entry will load the kernel
1485 * gsbase if needed before we call do_nmi. "NMI executing"
1486 * is zero.
1384 */ 1487 */
1385repeat_nmi: 1488 movq $1, 10*8(%rsp) /* Set "NMI executing". */
1489
1386 /* 1490 /*
1387 * Update the stack variable to say we are still in NMI (the update 1491 * Copy the "outermost" frame to the "iret" frame. NMIs that nest
1388 * is benign for the non-repeat case, where 1 was pushed just above 1492 * here must not modify the "iret" frame while we're writing to
1389 * to this very stack slot). 1493 * it or it will end up containing garbage.
1390 */ 1494 */
1391 movq $1, 10*8(%rsp)
1392
1393 /* Make another copy, this one may be modified by nested NMIs */
1394 addq $(10*8), %rsp 1495 addq $(10*8), %rsp
1395 .rept 5 1496 .rept 5
1396 pushq -6*8(%rsp) 1497 pushq -6*8(%rsp)
@@ -1399,9 +1500,9 @@ repeat_nmi:
1399end_repeat_nmi: 1500end_repeat_nmi:
1400 1501
1401 /* 1502 /*
1402 * Everything below this point can be preempted by a nested 1503 * Everything below this point can be preempted by a nested NMI.
1403 * NMI if the first NMI took an exception and reset our iret stack 1504 * If this happens, then the inner NMI will change the "iret"
1404 * so that we repeat another NMI. 1505 * frame to point back to repeat_nmi.
1405 */ 1506 */
1406 pushq $-1 /* ORIG_RAX: no syscall to restart */ 1507 pushq $-1 /* ORIG_RAX: no syscall to restart */
1407 ALLOC_PT_GPREGS_ON_STACK 1508 ALLOC_PT_GPREGS_ON_STACK
@@ -1415,28 +1516,11 @@ end_repeat_nmi:
1415 */ 1516 */
1416 call paranoid_entry 1517 call paranoid_entry
1417 1518
1418 /*
1419 * Save off the CR2 register. If we take a page fault in the NMI then
1420 * it could corrupt the CR2 value. If the NMI preempts a page fault
1421 * handler before it was able to read the CR2 register, and then the
1422 * NMI itself takes a page fault, the page fault that was preempted
1423 * will read the information from the NMI page fault and not the
1424 * origin fault. Save it off and restore it if it changes.
1425 * Use the r12 callee-saved register.
1426 */
1427 movq %cr2, %r12
1428
1429 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ 1519 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
1430 movq %rsp, %rdi 1520 movq %rsp, %rdi
1431 movq $-1, %rsi 1521 movq $-1, %rsi
1432 call do_nmi 1522 call do_nmi
1433 1523
1434 /* Did the NMI take a page fault? Restore cr2 if it did */
1435 movq %cr2, %rcx
1436 cmpq %rcx, %r12
1437 je 1f
1438 movq %r12, %cr2
14391:
1440 testl %ebx, %ebx /* swapgs needed? */ 1524 testl %ebx, %ebx /* swapgs needed? */
1441 jnz nmi_restore 1525 jnz nmi_restore
1442nmi_swapgs: 1526nmi_swapgs:
@@ -1444,11 +1528,26 @@ nmi_swapgs:
1444nmi_restore: 1528nmi_restore:
1445 RESTORE_EXTRA_REGS 1529 RESTORE_EXTRA_REGS
1446 RESTORE_C_REGS 1530 RESTORE_C_REGS
1447 /* Pop the extra iret frame at once */ 1531
1532 /* Point RSP at the "iret" frame. */
1448 REMOVE_PT_GPREGS_FROM_STACK 6*8 1533 REMOVE_PT_GPREGS_FROM_STACK 6*8
1449 1534
1450 /* Clear the NMI executing stack variable */ 1535 /*
1451 movq $0, 5*8(%rsp) 1536 * Clear "NMI executing". Set DF first so that we can easily
1537 * distinguish the remaining code between here and IRET from
1538 * the SYSCALL entry and exit paths. On a native kernel, we
1539 * could just inspect RIP, but, on paravirt kernels,
1540 * INTERRUPT_RETURN can translate into a jump into a
1541 * hypercall page.
1542 */
1543 std
1544 movq $0, 5*8(%rsp) /* clear "NMI executing" */
1545
1546 /*
1547 * INTERRUPT_RETURN reads the "iret" frame and exits the NMI
1548 * stack in a single instruction. We are returning to kernel
1549 * mode, so this cannot result in a fault.
1550 */
1452 INTERRUPT_RETURN 1551 INTERRUPT_RETURN
1453END(nmi) 1552END(nmi)
1454 1553
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 4dd1f2d770af..aeac434c9feb 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -9,3 +9,4 @@ generic-y += cputime.h
9generic-y += dma-contiguous.h 9generic-y += dma-contiguous.h
10generic-y += early_ioremap.h 10generic-y += early_ioremap.h
11generic-y += mcs_spinlock.h 11generic-y += mcs_spinlock.h
12generic-y += mm-arch-hooks.h
diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h
index 0637826292de..c49c5173158e 100644
--- a/arch/x86/include/asm/fpu/types.h
+++ b/arch/x86/include/asm/fpu/types.h
@@ -189,6 +189,7 @@ union fpregs_state {
189 struct fxregs_state fxsave; 189 struct fxregs_state fxsave;
190 struct swregs_state soft; 190 struct swregs_state soft;
191 struct xregs_state xsave; 191 struct xregs_state xsave;
192 u8 __padding[PAGE_SIZE];
192}; 193};
193 194
194/* 195/*
@@ -198,40 +199,6 @@ union fpregs_state {
198 */ 199 */
199struct fpu { 200struct fpu {
200 /* 201 /*
201 * @state:
202 *
203 * In-memory copy of all FPU registers that we save/restore
204 * over context switches. If the task is using the FPU then
205 * the registers in the FPU are more recent than this state
206 * copy. If the task context-switches away then they get
207 * saved here and represent the FPU state.
208 *
209 * After context switches there may be a (short) time period
210 * during which the in-FPU hardware registers are unchanged
211 * and still perfectly match this state, if the tasks
212 * scheduled afterwards are not using the FPU.
213 *
214 * This is the 'lazy restore' window of optimization, which
215 * we track though 'fpu_fpregs_owner_ctx' and 'fpu->last_cpu'.
216 *
217 * We detect whether a subsequent task uses the FPU via setting
218 * CR0::TS to 1, which causes any FPU use to raise a #NM fault.
219 *
220 * During this window, if the task gets scheduled again, we
221 * might be able to skip having to do a restore from this
222 * memory buffer to the hardware registers - at the cost of
223 * incurring the overhead of #NM fault traps.
224 *
225 * Note that on modern CPUs that support the XSAVEOPT (or other
226 * optimized XSAVE instructions), we don't use #NM traps anymore,
227 * as the hardware can track whether FPU registers need saving
228 * or not. On such CPUs we activate the non-lazy ('eagerfpu')
229 * logic, which unconditionally saves/restores all FPU state
230 * across context switches. (if FPU state exists.)
231 */
232 union fpregs_state state;
233
234 /*
235 * @last_cpu: 202 * @last_cpu:
236 * 203 *
237 * Records the last CPU on which this context was loaded into 204 * Records the last CPU on which this context was loaded into
@@ -288,6 +255,43 @@ struct fpu {
288 * deal with bursty apps that only use the FPU for a short time: 255 * deal with bursty apps that only use the FPU for a short time:
289 */ 256 */
290 unsigned char counter; 257 unsigned char counter;
258 /*
259 * @state:
260 *
261 * In-memory copy of all FPU registers that we save/restore
262 * over context switches. If the task is using the FPU then
263 * the registers in the FPU are more recent than this state
264 * copy. If the task context-switches away then they get
265 * saved here and represent the FPU state.
266 *
267 * After context switches there may be a (short) time period
268 * during which the in-FPU hardware registers are unchanged
269 * and still perfectly match this state, if the tasks
270 * scheduled afterwards are not using the FPU.
271 *
272 * This is the 'lazy restore' window of optimization, which
273 * we track though 'fpu_fpregs_owner_ctx' and 'fpu->last_cpu'.
274 *
275 * We detect whether a subsequent task uses the FPU via setting
276 * CR0::TS to 1, which causes any FPU use to raise a #NM fault.
277 *
278 * During this window, if the task gets scheduled again, we
279 * might be able to skip having to do a restore from this
280 * memory buffer to the hardware registers - at the cost of
281 * incurring the overhead of #NM fault traps.
282 *
283 * Note that on modern CPUs that support the XSAVEOPT (or other
284 * optimized XSAVE instructions), we don't use #NM traps anymore,
285 * as the hardware can track whether FPU registers need saving
286 * or not. On such CPUs we activate the non-lazy ('eagerfpu')
287 * logic, which unconditionally saves/restores all FPU state
288 * across context switches. (if FPU state exists.)
289 */
290 union fpregs_state state;
291 /*
292 * WARNING: 'state' is dynamically-sized. Do not put
293 * anything after it here.
294 */
291}; 295};
292 296
293#endif /* _ASM_X86_FPU_H */ 297#endif /* _ASM_X86_FPU_H */
diff --git a/arch/x86/include/asm/intel_pmc_ipc.h b/arch/x86/include/asm/intel_pmc_ipc.h
index 200ec2e7821d..cd0310e186f4 100644
--- a/arch/x86/include/asm/intel_pmc_ipc.h
+++ b/arch/x86/include/asm/intel_pmc_ipc.h
@@ -25,36 +25,9 @@
25 25
26#if IS_ENABLED(CONFIG_INTEL_PMC_IPC) 26#if IS_ENABLED(CONFIG_INTEL_PMC_IPC)
27 27
28/*
29 * intel_pmc_ipc_simple_command
30 * @cmd: command
31 * @sub: sub type
32 */
33int intel_pmc_ipc_simple_command(int cmd, int sub); 28int intel_pmc_ipc_simple_command(int cmd, int sub);
34
35/*
36 * intel_pmc_ipc_raw_cmd
37 * @cmd: command
38 * @sub: sub type
39 * @in: input data
40 * @inlen: input length in bytes
41 * @out: output data
42 * @outlen: output length in dwords
43 * @sptr: data writing to SPTR register
44 * @dptr: data writing to DPTR register
45 */
46int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, 29int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
47 u32 *out, u32 outlen, u32 dptr, u32 sptr); 30 u32 *out, u32 outlen, u32 dptr, u32 sptr);
48
49/*
50 * intel_pmc_ipc_command
51 * @cmd: command
52 * @sub: sub type
53 * @in: input data
54 * @inlen: input length in bytes
55 * @out: output data
56 * @outlen: output length in dwords
57 */
58int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, 31int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
59 u32 *out, u32 outlen); 32 u32 *out, u32 outlen);
60 33
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 2a7f5d782c33..49ec9038ec14 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -604,6 +604,8 @@ struct kvm_arch {
604 bool iommu_noncoherent; 604 bool iommu_noncoherent;
605#define __KVM_HAVE_ARCH_NONCOHERENT_DMA 605#define __KVM_HAVE_ARCH_NONCOHERENT_DMA
606 atomic_t noncoherent_dma_count; 606 atomic_t noncoherent_dma_count;
607#define __KVM_HAVE_ARCH_ASSIGNED_DEVICE
608 atomic_t assigned_device_count;
607 struct kvm_pic *vpic; 609 struct kvm_pic *vpic;
608 struct kvm_ioapic *vioapic; 610 struct kvm_ioapic *vioapic;
609 struct kvm_pit *vpit; 611 struct kvm_pit *vpit;
diff --git a/arch/x86/include/asm/mm-arch-hooks.h b/arch/x86/include/asm/mm-arch-hooks.h
deleted file mode 100644
index 4e881a342236..000000000000
--- a/arch/x86/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_X86_MM_ARCH_HOOKS_H
13#define _ASM_X86_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_X86_MM_ARCH_HOOKS_H */
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 5e8daee7c5c9..804a3a6030ca 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -23,7 +23,7 @@ extern struct static_key rdpmc_always_available;
23 23
24static inline void load_mm_cr4(struct mm_struct *mm) 24static inline void load_mm_cr4(struct mm_struct *mm)
25{ 25{
26 if (static_key_true(&rdpmc_always_available) || 26 if (static_key_false(&rdpmc_always_available) ||
27 atomic_read(&mm->context.perf_rdpmc_allowed)) 27 atomic_read(&mm->context.perf_rdpmc_allowed))
28 cr4_set_bits(X86_CR4_PCE); 28 cr4_set_bits(X86_CR4_PCE);
29 else 29 else
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 43e6519df0d5..944f1785ed0d 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -390,9 +390,6 @@ struct thread_struct {
390#endif 390#endif
391 unsigned long gs; 391 unsigned long gs;
392 392
393 /* Floating point and extended processor state */
394 struct fpu fpu;
395
396 /* Save middle states of ptrace breakpoints */ 393 /* Save middle states of ptrace breakpoints */
397 struct perf_event *ptrace_bps[HBP_NUM]; 394 struct perf_event *ptrace_bps[HBP_NUM];
398 /* Debug status used for traps, single steps, etc... */ 395 /* Debug status used for traps, single steps, etc... */
@@ -418,6 +415,13 @@ struct thread_struct {
418 unsigned long iopl; 415 unsigned long iopl;
419 /* Max allowed port in the bitmap, in bytes: */ 416 /* Max allowed port in the bitmap, in bytes: */
420 unsigned io_bitmap_max; 417 unsigned io_bitmap_max;
418
419 /* Floating point and extended processor state */
420 struct fpu fpu;
421 /*
422 * WARNING: 'fpu' is dynamically-sized. It *MUST* be at
423 * the end.
424 */
421}; 425};
422 426
423/* 427/*
diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm/hyperv.h
index 8fba544e9cc4..f36d56bd7632 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -108,6 +108,8 @@
108#define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE (1 << 4) 108#define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE (1 << 4)
109/* Support for a virtual guest idle state is available */ 109/* Support for a virtual guest idle state is available */
110#define HV_X64_GUEST_IDLE_STATE_AVAILABLE (1 << 5) 110#define HV_X64_GUEST_IDLE_STATE_AVAILABLE (1 << 5)
111/* Guest crash data handler available */
112#define HV_X64_GUEST_CRASH_MSR_AVAILABLE (1 << 10)
111 113
112/* 114/*
113 * Implementation recommendations. Indicates which behaviors the hypervisor 115 * Implementation recommendations. Indicates which behaviors the hypervisor
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c
index 32826791e675..0b39173dd971 100644
--- a/arch/x86/kernel/fpu/init.c
+++ b/arch/x86/kernel/fpu/init.c
@@ -4,6 +4,8 @@
4#include <asm/fpu/internal.h> 4#include <asm/fpu/internal.h>
5#include <asm/tlbflush.h> 5#include <asm/tlbflush.h>
6 6
7#include <linux/sched.h>
8
7/* 9/*
8 * Initialize the TS bit in CR0 according to the style of context-switches 10 * Initialize the TS bit in CR0 according to the style of context-switches
9 * we are using: 11 * we are using:
@@ -136,6 +138,43 @@ static void __init fpu__init_system_generic(void)
136unsigned int xstate_size; 138unsigned int xstate_size;
137EXPORT_SYMBOL_GPL(xstate_size); 139EXPORT_SYMBOL_GPL(xstate_size);
138 140
141/* Enforce that 'MEMBER' is the last field of 'TYPE': */
142#define CHECK_MEMBER_AT_END_OF(TYPE, MEMBER) \
143 BUILD_BUG_ON(sizeof(TYPE) != offsetofend(TYPE, MEMBER))
144
145/*
146 * We append the 'struct fpu' to the task_struct:
147 */
148static void __init fpu__init_task_struct_size(void)
149{
150 int task_size = sizeof(struct task_struct);
151
152 /*
153 * Subtract off the static size of the register state.
154 * It potentially has a bunch of padding.
155 */
156 task_size -= sizeof(((struct task_struct *)0)->thread.fpu.state);
157
158 /*
159 * Add back the dynamically-calculated register state
160 * size.
161 */
162 task_size += xstate_size;
163
164 /*
165 * We dynamically size 'struct fpu', so we require that
166 * it be at the end of 'thread_struct' and that
167 * 'thread_struct' be at the end of 'task_struct'. If
168 * you hit a compile error here, check the structure to
169 * see if something got added to the end.
170 */
171 CHECK_MEMBER_AT_END_OF(struct fpu, state);
172 CHECK_MEMBER_AT_END_OF(struct thread_struct, fpu);
173 CHECK_MEMBER_AT_END_OF(struct task_struct, thread);
174
175 arch_task_struct_size = task_size;
176}
177
139/* 178/*
140 * Set up the xstate_size based on the legacy FPU context size. 179 * Set up the xstate_size based on the legacy FPU context size.
141 * 180 *
@@ -287,6 +326,7 @@ void __init fpu__init_system(struct cpuinfo_x86 *c)
287 fpu__init_system_generic(); 326 fpu__init_system_generic();
288 fpu__init_system_xstate_size_legacy(); 327 fpu__init_system_xstate_size_legacy();
289 fpu__init_system_xstate(); 328 fpu__init_system_xstate();
329 fpu__init_task_struct_size();
290 330
291 fpu__init_system_ctx_switch(); 331 fpu__init_system_ctx_switch();
292} 332}
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index c3e985d1751c..d05bd2e2ee91 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -408,15 +408,15 @@ static void default_do_nmi(struct pt_regs *regs)
408NOKPROBE_SYMBOL(default_do_nmi); 408NOKPROBE_SYMBOL(default_do_nmi);
409 409
410/* 410/*
411 * NMIs can hit breakpoints which will cause it to lose its 411 * NMIs can page fault or hit breakpoints which will cause it to lose
412 * NMI context with the CPU when the breakpoint does an iret. 412 * its NMI context with the CPU when the breakpoint or page fault does an IRET.
413 */ 413 *
414#ifdef CONFIG_X86_32 414 * As a result, NMIs can nest if NMIs get unmasked due an IRET during
415/* 415 * NMI processing. On x86_64, the asm glue protects us from nested NMIs
416 * For i386, NMIs use the same stack as the kernel, and we can 416 * if the outer NMI came from kernel mode, but we can still nest if the
417 * add a workaround to the iret problem in C (preventing nested 417 * outer NMI came from user mode.
418 * NMIs if an NMI takes a trap). Simply have 3 states the NMI 418 *
419 * can be in: 419 * To handle these nested NMIs, we have three states:
420 * 420 *
421 * 1) not running 421 * 1) not running
422 * 2) executing 422 * 2) executing
@@ -430,15 +430,14 @@ NOKPROBE_SYMBOL(default_do_nmi);
430 * (Note, the latch is binary, thus multiple NMIs triggering, 430 * (Note, the latch is binary, thus multiple NMIs triggering,
431 * when one is running, are ignored. Only one NMI is restarted.) 431 * when one is running, are ignored. Only one NMI is restarted.)
432 * 432 *
433 * If an NMI hits a breakpoint that executes an iret, another 433 * If an NMI executes an iret, another NMI can preempt it. We do not
434 * NMI can preempt it. We do not want to allow this new NMI 434 * want to allow this new NMI to run, but we want to execute it when the
435 * to run, but we want to execute it when the first one finishes. 435 * first one finishes. We set the state to "latched", and the exit of
436 * We set the state to "latched", and the exit of the first NMI will 436 * the first NMI will perform a dec_return, if the result is zero
437 * perform a dec_return, if the result is zero (NOT_RUNNING), then 437 * (NOT_RUNNING), then it will simply exit the NMI handler. If not, the
438 * it will simply exit the NMI handler. If not, the dec_return 438 * dec_return would have set the state to NMI_EXECUTING (what we want it
439 * would have set the state to NMI_EXECUTING (what we want it to 439 * to be when we are running). In this case, we simply jump back to
440 * be when we are running). In this case, we simply jump back 440 * rerun the NMI handler again, and restart the 'latched' NMI.
441 * to rerun the NMI handler again, and restart the 'latched' NMI.
442 * 441 *
443 * No trap (breakpoint or page fault) should be hit before nmi_restart, 442 * No trap (breakpoint or page fault) should be hit before nmi_restart,
444 * thus there is no race between the first check of state for NOT_RUNNING 443 * thus there is no race between the first check of state for NOT_RUNNING
@@ -461,49 +460,36 @@ enum nmi_states {
461static DEFINE_PER_CPU(enum nmi_states, nmi_state); 460static DEFINE_PER_CPU(enum nmi_states, nmi_state);
462static DEFINE_PER_CPU(unsigned long, nmi_cr2); 461static DEFINE_PER_CPU(unsigned long, nmi_cr2);
463 462
464#define nmi_nesting_preprocess(regs) \ 463#ifdef CONFIG_X86_64
465 do { \
466 if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) { \
467 this_cpu_write(nmi_state, NMI_LATCHED); \
468 return; \
469 } \
470 this_cpu_write(nmi_state, NMI_EXECUTING); \
471 this_cpu_write(nmi_cr2, read_cr2()); \
472 } while (0); \
473 nmi_restart:
474
475#define nmi_nesting_postprocess() \
476 do { \
477 if (unlikely(this_cpu_read(nmi_cr2) != read_cr2())) \
478 write_cr2(this_cpu_read(nmi_cr2)); \
479 if (this_cpu_dec_return(nmi_state)) \
480 goto nmi_restart; \
481 } while (0)
482#else /* x86_64 */
483/* 464/*
484 * In x86_64 things are a bit more difficult. This has the same problem 465 * In x86_64, we need to handle breakpoint -> NMI -> breakpoint. Without
485 * where an NMI hitting a breakpoint that calls iret will remove the 466 * some care, the inner breakpoint will clobber the outer breakpoint's
486 * NMI context, allowing a nested NMI to enter. What makes this more 467 * stack.
487 * difficult is that both NMIs and breakpoints have their own stack.
488 * When a new NMI or breakpoint is executed, the stack is set to a fixed
489 * point. If an NMI is nested, it will have its stack set at that same
490 * fixed address that the first NMI had, and will start corrupting the
491 * stack. This is handled in entry_64.S, but the same problem exists with
492 * the breakpoint stack.
493 * 468 *
494 * If a breakpoint is being processed, and the debug stack is being used, 469 * If a breakpoint is being processed, and the debug stack is being
495 * if an NMI comes in and also hits a breakpoint, the stack pointer 470 * used, if an NMI comes in and also hits a breakpoint, the stack
496 * will be set to the same fixed address as the breakpoint that was 471 * pointer will be set to the same fixed address as the breakpoint that
497 * interrupted, causing that stack to be corrupted. To handle this case, 472 * was interrupted, causing that stack to be corrupted. To handle this
498 * check if the stack that was interrupted is the debug stack, and if 473 * case, check if the stack that was interrupted is the debug stack, and
499 * so, change the IDT so that new breakpoints will use the current stack 474 * if so, change the IDT so that new breakpoints will use the current
500 * and not switch to the fixed address. On return of the NMI, switch back 475 * stack and not switch to the fixed address. On return of the NMI,
501 * to the original IDT. 476 * switch back to the original IDT.
502 */ 477 */
503static DEFINE_PER_CPU(int, update_debug_stack); 478static DEFINE_PER_CPU(int, update_debug_stack);
479#endif
504 480
505static inline void nmi_nesting_preprocess(struct pt_regs *regs) 481dotraplinkage notrace void
482do_nmi(struct pt_regs *regs, long error_code)
506{ 483{
484 if (this_cpu_read(nmi_state) != NMI_NOT_RUNNING) {
485 this_cpu_write(nmi_state, NMI_LATCHED);
486 return;
487 }
488 this_cpu_write(nmi_state, NMI_EXECUTING);
489 this_cpu_write(nmi_cr2, read_cr2());
490nmi_restart:
491
492#ifdef CONFIG_X86_64
507 /* 493 /*
508 * If we interrupted a breakpoint, it is possible that 494 * If we interrupted a breakpoint, it is possible that
509 * the nmi handler will have breakpoints too. We need to 495 * the nmi handler will have breakpoints too. We need to
@@ -514,22 +500,8 @@ static inline void nmi_nesting_preprocess(struct pt_regs *regs)
514 debug_stack_set_zero(); 500 debug_stack_set_zero();
515 this_cpu_write(update_debug_stack, 1); 501 this_cpu_write(update_debug_stack, 1);
516 } 502 }
517}
518
519static inline void nmi_nesting_postprocess(void)
520{
521 if (unlikely(this_cpu_read(update_debug_stack))) {
522 debug_stack_reset();
523 this_cpu_write(update_debug_stack, 0);
524 }
525}
526#endif 503#endif
527 504
528dotraplinkage notrace void
529do_nmi(struct pt_regs *regs, long error_code)
530{
531 nmi_nesting_preprocess(regs);
532
533 nmi_enter(); 505 nmi_enter();
534 506
535 inc_irq_stat(__nmi_count); 507 inc_irq_stat(__nmi_count);
@@ -539,8 +511,17 @@ do_nmi(struct pt_regs *regs, long error_code)
539 511
540 nmi_exit(); 512 nmi_exit();
541 513
542 /* On i386, may loop back to preprocess */ 514#ifdef CONFIG_X86_64
543 nmi_nesting_postprocess(); 515 if (unlikely(this_cpu_read(update_debug_stack))) {
516 debug_stack_reset();
517 this_cpu_write(update_debug_stack, 0);
518 }
519#endif
520
521 if (unlikely(this_cpu_read(nmi_cr2) != read_cr2()))
522 write_cr2(this_cpu_read(nmi_cr2));
523 if (this_cpu_dec_return(nmi_state))
524 goto nmi_restart;
544} 525}
545NOKPROBE_SYMBOL(do_nmi); 526NOKPROBE_SYMBOL(do_nmi);
546 527
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 9cad694ed7c4..397688beed4b 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -81,7 +81,7 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister);
81 */ 81 */
82int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) 82int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
83{ 83{
84 *dst = *src; 84 memcpy(dst, src, arch_task_struct_size);
85 85
86 return fpu__copy(&dst->thread.fpu, &src->thread.fpu); 86 return fpu__copy(&dst->thread.fpu, &src->thread.fpu);
87} 87}
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index d3010aa79daf..b1f3ed9c7a9e 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -992,8 +992,17 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
992 992
993 common_cpu_up(cpu, tidle); 993 common_cpu_up(cpu, tidle);
994 994
995 /*
996 * We have to walk the irq descriptors to setup the vector
997 * space for the cpu which comes online. Prevent irq
998 * alloc/free across the bringup.
999 */
1000 irq_lock_sparse();
1001
995 err = do_boot_cpu(apicid, cpu, tidle); 1002 err = do_boot_cpu(apicid, cpu, tidle);
1003
996 if (err) { 1004 if (err) {
1005 irq_unlock_sparse();
997 pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu); 1006 pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu);
998 return -EIO; 1007 return -EIO;
999 } 1008 }
@@ -1011,6 +1020,8 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
1011 touch_nmi_watchdog(); 1020 touch_nmi_watchdog();
1012 } 1021 }
1013 1022
1023 irq_unlock_sparse();
1024
1014 return 0; 1025 return 0;
1015} 1026}
1016 1027
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 64dd46793099..2fbea2544f24 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -98,6 +98,8 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)
98 best->ebx = xstate_required_size(vcpu->arch.xcr0, true); 98 best->ebx = xstate_required_size(vcpu->arch.xcr0, true);
99 99
100 vcpu->arch.eager_fpu = use_eager_fpu() || guest_cpuid_has_mpx(vcpu); 100 vcpu->arch.eager_fpu = use_eager_fpu() || guest_cpuid_has_mpx(vcpu);
101 if (vcpu->arch.eager_fpu)
102 kvm_x86_ops->fpu_activate(vcpu);
101 103
102 /* 104 /*
103 * The existing code assumes virtual address is 48-bit in the canonical 105 * The existing code assumes virtual address is 48-bit in the canonical
diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c
index 7dbced309ddb..5c520ebf6343 100644
--- a/arch/x86/kvm/iommu.c
+++ b/arch/x86/kvm/iommu.c
@@ -200,6 +200,7 @@ int kvm_assign_device(struct kvm *kvm, struct pci_dev *pdev)
200 goto out_unmap; 200 goto out_unmap;
201 } 201 }
202 202
203 kvm_arch_start_assignment(kvm);
203 pci_set_dev_assigned(pdev); 204 pci_set_dev_assigned(pdev);
204 205
205 dev_info(&pdev->dev, "kvm assign device\n"); 206 dev_info(&pdev->dev, "kvm assign device\n");
@@ -224,6 +225,7 @@ int kvm_deassign_device(struct kvm *kvm, struct pci_dev *pdev)
224 iommu_detach_device(domain, &pdev->dev); 225 iommu_detach_device(domain, &pdev->dev);
225 226
226 pci_clear_dev_assigned(pdev); 227 pci_clear_dev_assigned(pdev);
228 kvm_arch_end_assignment(kvm);
227 229
228 dev_info(&pdev->dev, "kvm deassign device\n"); 230 dev_info(&pdev->dev, "kvm deassign device\n");
229 231
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index f807496b62c2..44171462bd2a 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2479,6 +2479,14 @@ static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn,
2479 return 0; 2479 return 0;
2480} 2480}
2481 2481
2482static bool kvm_is_mmio_pfn(pfn_t pfn)
2483{
2484 if (pfn_valid(pfn))
2485 return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn));
2486
2487 return true;
2488}
2489
2482static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep, 2490static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2483 unsigned pte_access, int level, 2491 unsigned pte_access, int level,
2484 gfn_t gfn, pfn_t pfn, bool speculative, 2492 gfn_t gfn, pfn_t pfn, bool speculative,
@@ -2506,7 +2514,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2506 spte |= PT_PAGE_SIZE_MASK; 2514 spte |= PT_PAGE_SIZE_MASK;
2507 if (tdp_enabled) 2515 if (tdp_enabled)
2508 spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, 2516 spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn,
2509 kvm_is_reserved_pfn(pfn)); 2517 kvm_is_mmio_pfn(pfn));
2510 2518
2511 if (host_writable) 2519 if (host_writable)
2512 spte |= SPTE_HOST_WRITEABLE; 2520 spte |= SPTE_HOST_WRITEABLE;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 602b974a60a6..bbc678a66b18 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -865,6 +865,64 @@ static void svm_disable_lbrv(struct vcpu_svm *svm)
865 set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0); 865 set_msr_interception(msrpm, MSR_IA32_LASTINTTOIP, 0, 0);
866} 866}
867 867
868#define MTRR_TYPE_UC_MINUS 7
869#define MTRR2PROTVAL_INVALID 0xff
870
871static u8 mtrr2protval[8];
872
873static u8 fallback_mtrr_type(int mtrr)
874{
875 /*
876 * WT and WP aren't always available in the host PAT. Treat
877 * them as UC and UC- respectively. Everything else should be
878 * there.
879 */
880 switch (mtrr)
881 {
882 case MTRR_TYPE_WRTHROUGH:
883 return MTRR_TYPE_UNCACHABLE;
884 case MTRR_TYPE_WRPROT:
885 return MTRR_TYPE_UC_MINUS;
886 default:
887 BUG();
888 }
889}
890
891static void build_mtrr2protval(void)
892{
893 int i;
894 u64 pat;
895
896 for (i = 0; i < 8; i++)
897 mtrr2protval[i] = MTRR2PROTVAL_INVALID;
898
899 /* Ignore the invalid MTRR types. */
900 mtrr2protval[2] = 0;
901 mtrr2protval[3] = 0;
902
903 /*
904 * Use host PAT value to figure out the mapping from guest MTRR
905 * values to nested page table PAT/PCD/PWT values. We do not
906 * want to change the host PAT value every time we enter the
907 * guest.
908 */
909 rdmsrl(MSR_IA32_CR_PAT, pat);
910 for (i = 0; i < 8; i++) {
911 u8 mtrr = pat >> (8 * i);
912
913 if (mtrr2protval[mtrr] == MTRR2PROTVAL_INVALID)
914 mtrr2protval[mtrr] = __cm_idx2pte(i);
915 }
916
917 for (i = 0; i < 8; i++) {
918 if (mtrr2protval[i] == MTRR2PROTVAL_INVALID) {
919 u8 fallback = fallback_mtrr_type(i);
920 mtrr2protval[i] = mtrr2protval[fallback];
921 BUG_ON(mtrr2protval[i] == MTRR2PROTVAL_INVALID);
922 }
923 }
924}
925
868static __init int svm_hardware_setup(void) 926static __init int svm_hardware_setup(void)
869{ 927{
870 int cpu; 928 int cpu;
@@ -931,6 +989,7 @@ static __init int svm_hardware_setup(void)
931 } else 989 } else
932 kvm_disable_tdp(); 990 kvm_disable_tdp();
933 991
992 build_mtrr2protval();
934 return 0; 993 return 0;
935 994
936err: 995err:
@@ -1085,6 +1144,39 @@ static u64 svm_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc)
1085 return target_tsc - tsc; 1144 return target_tsc - tsc;
1086} 1145}
1087 1146
1147static void svm_set_guest_pat(struct vcpu_svm *svm, u64 *g_pat)
1148{
1149 struct kvm_vcpu *vcpu = &svm->vcpu;
1150
1151 /* Unlike Intel, AMD takes the guest's CR0.CD into account.
1152 *
1153 * AMD does not have IPAT. To emulate it for the case of guests
1154 * with no assigned devices, just set everything to WB. If guests
1155 * have assigned devices, however, we cannot force WB for RAM
1156 * pages only, so use the guest PAT directly.
1157 */
1158 if (!kvm_arch_has_assigned_device(vcpu->kvm))
1159 *g_pat = 0x0606060606060606;
1160 else
1161 *g_pat = vcpu->arch.pat;
1162}
1163
1164static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
1165{
1166 u8 mtrr;
1167
1168 /*
1169 * 1. MMIO: trust guest MTRR, so same as item 3.
1170 * 2. No passthrough: always map as WB, and force guest PAT to WB as well
1171 * 3. Passthrough: can't guarantee the result, try to trust guest.
1172 */
1173 if (!is_mmio && !kvm_arch_has_assigned_device(vcpu->kvm))
1174 return 0;
1175
1176 mtrr = kvm_mtrr_get_guest_memory_type(vcpu, gfn);
1177 return mtrr2protval[mtrr];
1178}
1179
1088static void init_vmcb(struct vcpu_svm *svm, bool init_event) 1180static void init_vmcb(struct vcpu_svm *svm, bool init_event)
1089{ 1181{
1090 struct vmcb_control_area *control = &svm->vmcb->control; 1182 struct vmcb_control_area *control = &svm->vmcb->control;
@@ -1180,6 +1272,7 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event)
1180 clr_cr_intercept(svm, INTERCEPT_CR3_READ); 1272 clr_cr_intercept(svm, INTERCEPT_CR3_READ);
1181 clr_cr_intercept(svm, INTERCEPT_CR3_WRITE); 1273 clr_cr_intercept(svm, INTERCEPT_CR3_WRITE);
1182 save->g_pat = svm->vcpu.arch.pat; 1274 save->g_pat = svm->vcpu.arch.pat;
1275 svm_set_guest_pat(svm, &save->g_pat);
1183 save->cr3 = 0; 1276 save->cr3 = 0;
1184 save->cr4 = 0; 1277 save->cr4 = 0;
1185 } 1278 }
@@ -3254,6 +3347,16 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
3254 case MSR_VM_IGNNE: 3347 case MSR_VM_IGNNE:
3255 vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); 3348 vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data);
3256 break; 3349 break;
3350 case MSR_IA32_CR_PAT:
3351 if (npt_enabled) {
3352 if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data))
3353 return 1;
3354 vcpu->arch.pat = data;
3355 svm_set_guest_pat(svm, &svm->vmcb->save.g_pat);
3356 mark_dirty(svm->vmcb, VMCB_NPT);
3357 break;
3358 }
3359 /* fall through */
3257 default: 3360 default:
3258 return kvm_set_msr_common(vcpu, msr); 3361 return kvm_set_msr_common(vcpu, msr);
3259 } 3362 }
@@ -4088,11 +4191,6 @@ static bool svm_has_high_real_mode_segbase(void)
4088 return true; 4191 return true;
4089} 4192}
4090 4193
4091static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
4092{
4093 return 0;
4094}
4095
4096static void svm_cpuid_update(struct kvm_vcpu *vcpu) 4194static void svm_cpuid_update(struct kvm_vcpu *vcpu)
4097{ 4195{
4098} 4196}
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e856dd566f4c..5b4e9384717a 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8632,22 +8632,17 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
8632 u64 ipat = 0; 8632 u64 ipat = 0;
8633 8633
8634 /* For VT-d and EPT combination 8634 /* For VT-d and EPT combination
8635 * 1. MMIO: always map as UC 8635 * 1. MMIO: guest may want to apply WC, trust it.
8636 * 2. EPT with VT-d: 8636 * 2. EPT with VT-d:
8637 * a. VT-d without snooping control feature: can't guarantee the 8637 * a. VT-d without snooping control feature: can't guarantee the
8638 * result, try to trust guest. 8638 * result, try to trust guest. So the same as item 1.
8639 * b. VT-d with snooping control feature: snooping control feature of 8639 * b. VT-d with snooping control feature: snooping control feature of
8640 * VT-d engine can guarantee the cache correctness. Just set it 8640 * VT-d engine can guarantee the cache correctness. Just set it
8641 * to WB to keep consistent with host. So the same as item 3. 8641 * to WB to keep consistent with host. So the same as item 3.
8642 * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep 8642 * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep
8643 * consistent with host MTRR 8643 * consistent with host MTRR
8644 */ 8644 */
8645 if (is_mmio) { 8645 if (!is_mmio && !kvm_arch_has_noncoherent_dma(vcpu->kvm)) {
8646 cache = MTRR_TYPE_UNCACHABLE;
8647 goto exit;
8648 }
8649
8650 if (!kvm_arch_has_noncoherent_dma(vcpu->kvm)) {
8651 ipat = VMX_EPT_IPAT_BIT; 8646 ipat = VMX_EPT_IPAT_BIT;
8652 cache = MTRR_TYPE_WRBACK; 8647 cache = MTRR_TYPE_WRBACK;
8653 goto exit; 8648 goto exit;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bbaf44e8f0d3..5ef2560075bf 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3157,8 +3157,7 @@ static void load_xsave(struct kvm_vcpu *vcpu, u8 *src)
3157 cpuid_count(XSTATE_CPUID, index, 3157 cpuid_count(XSTATE_CPUID, index,
3158 &size, &offset, &ecx, &edx); 3158 &size, &offset, &ecx, &edx);
3159 memcpy(dest, src + offset, size); 3159 memcpy(dest, src + offset, size);
3160 } else 3160 }
3161 WARN_ON_ONCE(1);
3162 3161
3163 valid -= feature; 3162 valid -= feature;
3164 } 3163 }
@@ -7315,11 +7314,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
7315 7314
7316 vcpu = kvm_x86_ops->vcpu_create(kvm, id); 7315 vcpu = kvm_x86_ops->vcpu_create(kvm, id);
7317 7316
7318 /*
7319 * Activate fpu unconditionally in case the guest needs eager FPU. It will be
7320 * deactivated soon if it doesn't.
7321 */
7322 kvm_x86_ops->fpu_activate(vcpu);
7323 return vcpu; 7317 return vcpu;
7324} 7318}
7325 7319
@@ -8218,6 +8212,24 @@ bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu)
8218 kvm_x86_ops->interrupt_allowed(vcpu); 8212 kvm_x86_ops->interrupt_allowed(vcpu);
8219} 8213}
8220 8214
8215void kvm_arch_start_assignment(struct kvm *kvm)
8216{
8217 atomic_inc(&kvm->arch.assigned_device_count);
8218}
8219EXPORT_SYMBOL_GPL(kvm_arch_start_assignment);
8220
8221void kvm_arch_end_assignment(struct kvm *kvm)
8222{
8223 atomic_dec(&kvm->arch.assigned_device_count);
8224}
8225EXPORT_SYMBOL_GPL(kvm_arch_end_assignment);
8226
8227bool kvm_arch_has_assigned_device(struct kvm *kvm)
8228{
8229 return atomic_read(&kvm->arch.assigned_device_count);
8230}
8231EXPORT_SYMBOL_GPL(kvm_arch_has_assigned_device);
8232
8221void kvm_arch_register_noncoherent_dma(struct kvm *kvm) 8233void kvm_arch_register_noncoherent_dma(struct kvm *kvm)
8222{ 8234{
8223 atomic_inc(&kvm->arch.noncoherent_dma_count); 8235 atomic_inc(&kvm->arch.noncoherent_dma_count);
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 14d15bf1a95b..5b478accd5fc 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -19,6 +19,7 @@ generic-y += linkage.h
19generic-y += local.h 19generic-y += local.h
20generic-y += local64.h 20generic-y += local64.h
21generic-y += mcs_spinlock.h 21generic-y += mcs_spinlock.h
22generic-y += mm-arch-hooks.h
22generic-y += percpu.h 23generic-y += percpu.h
23generic-y += preempt.h 24generic-y += preempt.h
24generic-y += resource.h 25generic-y += resource.h
diff --git a/arch/xtensa/include/asm/mm-arch-hooks.h b/arch/xtensa/include/asm/mm-arch-hooks.h
deleted file mode 100644
index d2e5cfd3dd02..000000000000
--- a/arch/xtensa/include/asm/mm-arch-hooks.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Architecture specific mm hooks
3 *
4 * Copyright (C) 2015, IBM Corporation
5 * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _ASM_XTENSA_MM_ARCH_HOOKS_H
13#define _ASM_XTENSA_MM_ARCH_HOOKS_H
14
15#endif /* _ASM_XTENSA_MM_ARCH_HOOKS_H */
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 0436c21db7f2..719b7152aed1 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -51,7 +51,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
51 unsigned long idx = BIO_POOL_NONE; 51 unsigned long idx = BIO_POOL_NONE;
52 unsigned inline_vecs; 52 unsigned inline_vecs;
53 53
54 if (!bs) { 54 if (!bs || !bs->bio_integrity_pool) {
55 bip = kmalloc(sizeof(struct bio_integrity_payload) + 55 bip = kmalloc(sizeof(struct bio_integrity_payload) +
56 sizeof(struct bio_vec) * nr_vecs, gfp_mask); 56 sizeof(struct bio_vec) * nr_vecs, gfp_mask);
57 inline_vecs = nr_vecs; 57 inline_vecs = nr_vecs;
@@ -104,7 +104,7 @@ void bio_integrity_free(struct bio *bio)
104 kfree(page_address(bip->bip_vec->bv_page) + 104 kfree(page_address(bip->bip_vec->bv_page) +
105 bip->bip_vec->bv_offset); 105 bip->bip_vec->bv_offset);
106 106
107 if (bs) { 107 if (bs && bs->bio_integrity_pool) {
108 if (bip->bip_slab != BIO_POOL_NONE) 108 if (bip->bip_slab != BIO_POOL_NONE)
109 bvec_free(bs->bvec_integrity_pool, bip->bip_vec, 109 bvec_free(bs->bvec_integrity_pool, bip->bip_vec,
110 bip->bip_slab); 110 bip->bip_slab);
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 9f97da52d006..9da02c021ebe 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -29,6 +29,14 @@
29 29
30#define MAX_KEY_LEN 100 30#define MAX_KEY_LEN 100
31 31
32/*
33 * blkcg_pol_mutex protects blkcg_policy[] and policy [de]activation.
34 * blkcg_pol_register_mutex nests outside of it and synchronizes entire
35 * policy [un]register operations including cgroup file additions /
36 * removals. Putting cgroup file registration outside blkcg_pol_mutex
37 * allows grabbing it from cgroup callbacks.
38 */
39static DEFINE_MUTEX(blkcg_pol_register_mutex);
32static DEFINE_MUTEX(blkcg_pol_mutex); 40static DEFINE_MUTEX(blkcg_pol_mutex);
33 41
34struct blkcg blkcg_root; 42struct blkcg blkcg_root;
@@ -38,6 +46,8 @@ struct cgroup_subsys_state * const blkcg_root_css = &blkcg_root.css;
38 46
39static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS]; 47static struct blkcg_policy *blkcg_policy[BLKCG_MAX_POLS];
40 48
49static LIST_HEAD(all_blkcgs); /* protected by blkcg_pol_mutex */
50
41static bool blkcg_policy_enabled(struct request_queue *q, 51static bool blkcg_policy_enabled(struct request_queue *q,
42 const struct blkcg_policy *pol) 52 const struct blkcg_policy *pol)
43{ 53{
@@ -453,20 +463,7 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css,
453 struct blkcg_gq *blkg; 463 struct blkcg_gq *blkg;
454 int i; 464 int i;
455 465
456 /* 466 mutex_lock(&blkcg_pol_mutex);
457 * XXX: We invoke cgroup_add/rm_cftypes() under blkcg_pol_mutex
458 * which ends up putting cgroup's internal cgroup_tree_mutex under
459 * it; however, cgroup_tree_mutex is nested above cgroup file
460 * active protection and grabbing blkcg_pol_mutex from a cgroup
461 * file operation creates a possible circular dependency. cgroup
462 * internal locking is planned to go through further simplification
463 * and this issue should go away soon. For now, let's trylock
464 * blkcg_pol_mutex and restart the write on failure.
465 *
466 * http://lkml.kernel.org/g/5363C04B.4010400@oracle.com
467 */
468 if (!mutex_trylock(&blkcg_pol_mutex))
469 return restart_syscall();
470 spin_lock_irq(&blkcg->lock); 467 spin_lock_irq(&blkcg->lock);
471 468
472 /* 469 /*
@@ -822,8 +819,17 @@ static void blkcg_css_free(struct cgroup_subsys_state *css)
822{ 819{
823 struct blkcg *blkcg = css_to_blkcg(css); 820 struct blkcg *blkcg = css_to_blkcg(css);
824 821
825 if (blkcg != &blkcg_root) 822 mutex_lock(&blkcg_pol_mutex);
823 list_del(&blkcg->all_blkcgs_node);
824 mutex_unlock(&blkcg_pol_mutex);
825
826 if (blkcg != &blkcg_root) {
827 int i;
828
829 for (i = 0; i < BLKCG_MAX_POLS; i++)
830 kfree(blkcg->pd[i]);
826 kfree(blkcg); 831 kfree(blkcg);
832 }
827} 833}
828 834
829static struct cgroup_subsys_state * 835static struct cgroup_subsys_state *
@@ -833,6 +839,8 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
833 struct cgroup_subsys_state *ret; 839 struct cgroup_subsys_state *ret;
834 int i; 840 int i;
835 841
842 mutex_lock(&blkcg_pol_mutex);
843
836 if (!parent_css) { 844 if (!parent_css) {
837 blkcg = &blkcg_root; 845 blkcg = &blkcg_root;
838 goto done; 846 goto done;
@@ -875,14 +883,17 @@ done:
875#ifdef CONFIG_CGROUP_WRITEBACK 883#ifdef CONFIG_CGROUP_WRITEBACK
876 INIT_LIST_HEAD(&blkcg->cgwb_list); 884 INIT_LIST_HEAD(&blkcg->cgwb_list);
877#endif 885#endif
886 list_add_tail(&blkcg->all_blkcgs_node, &all_blkcgs);
887
888 mutex_unlock(&blkcg_pol_mutex);
878 return &blkcg->css; 889 return &blkcg->css;
879 890
880free_pd_blkcg: 891free_pd_blkcg:
881 for (i--; i >= 0; i--) 892 for (i--; i >= 0; i--)
882 kfree(blkcg->pd[i]); 893 kfree(blkcg->pd[i]);
883
884free_blkcg: 894free_blkcg:
885 kfree(blkcg); 895 kfree(blkcg);
896 mutex_unlock(&blkcg_pol_mutex);
886 return ret; 897 return ret;
887} 898}
888 899
@@ -1037,10 +1048,8 @@ int blkcg_activate_policy(struct request_queue *q,
1037 const struct blkcg_policy *pol) 1048 const struct blkcg_policy *pol)
1038{ 1049{
1039 LIST_HEAD(pds); 1050 LIST_HEAD(pds);
1040 LIST_HEAD(cpds);
1041 struct blkcg_gq *blkg; 1051 struct blkcg_gq *blkg;
1042 struct blkg_policy_data *pd, *nd; 1052 struct blkg_policy_data *pd, *nd;
1043 struct blkcg_policy_data *cpd, *cnd;
1044 int cnt = 0, ret; 1053 int cnt = 0, ret;
1045 1054
1046 if (blkcg_policy_enabled(q, pol)) 1055 if (blkcg_policy_enabled(q, pol))
@@ -1053,10 +1062,7 @@ int blkcg_activate_policy(struct request_queue *q,
1053 cnt++; 1062 cnt++;
1054 spin_unlock_irq(q->queue_lock); 1063 spin_unlock_irq(q->queue_lock);
1055 1064
1056 /* 1065 /* allocate per-blkg policy data for all existing blkgs */
1057 * Allocate per-blkg and per-blkcg policy data
1058 * for all existing blkgs.
1059 */
1060 while (cnt--) { 1066 while (cnt--) {
1061 pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node); 1067 pd = kzalloc_node(pol->pd_size, GFP_KERNEL, q->node);
1062 if (!pd) { 1068 if (!pd) {
@@ -1064,15 +1070,6 @@ int blkcg_activate_policy(struct request_queue *q,
1064 goto out_free; 1070 goto out_free;
1065 } 1071 }
1066 list_add_tail(&pd->alloc_node, &pds); 1072 list_add_tail(&pd->alloc_node, &pds);
1067
1068 if (!pol->cpd_size)
1069 continue;
1070 cpd = kzalloc_node(pol->cpd_size, GFP_KERNEL, q->node);
1071 if (!cpd) {
1072 ret = -ENOMEM;
1073 goto out_free;
1074 }
1075 list_add_tail(&cpd->alloc_node, &cpds);
1076 } 1073 }
1077 1074
1078 /* 1075 /*
@@ -1082,32 +1079,17 @@ int blkcg_activate_policy(struct request_queue *q,
1082 spin_lock_irq(q->queue_lock); 1079 spin_lock_irq(q->queue_lock);
1083 1080
1084 list_for_each_entry(blkg, &q->blkg_list, q_node) { 1081 list_for_each_entry(blkg, &q->blkg_list, q_node) {
1085 if (WARN_ON(list_empty(&pds)) || 1082 if (WARN_ON(list_empty(&pds))) {
1086 WARN_ON(pol->cpd_size && list_empty(&cpds))) {
1087 /* umm... this shouldn't happen, just abort */ 1083 /* umm... this shouldn't happen, just abort */
1088 ret = -ENOMEM; 1084 ret = -ENOMEM;
1089 goto out_unlock; 1085 goto out_unlock;
1090 } 1086 }
1091 cpd = list_first_entry(&cpds, struct blkcg_policy_data,
1092 alloc_node);
1093 list_del_init(&cpd->alloc_node);
1094 pd = list_first_entry(&pds, struct blkg_policy_data, alloc_node); 1087 pd = list_first_entry(&pds, struct blkg_policy_data, alloc_node);
1095 list_del_init(&pd->alloc_node); 1088 list_del_init(&pd->alloc_node);
1096 1089
1097 /* grab blkcg lock too while installing @pd on @blkg */ 1090 /* grab blkcg lock too while installing @pd on @blkg */
1098 spin_lock(&blkg->blkcg->lock); 1091 spin_lock(&blkg->blkcg->lock);
1099 1092
1100 if (!pol->cpd_size)
1101 goto no_cpd;
1102 if (!blkg->blkcg->pd[pol->plid]) {
1103 /* Per-policy per-blkcg data */
1104 blkg->blkcg->pd[pol->plid] = cpd;
1105 cpd->plid = pol->plid;
1106 pol->cpd_init_fn(blkg->blkcg);
1107 } else { /* must free it as it has already been extracted */
1108 kfree(cpd);
1109 }
1110no_cpd:
1111 blkg->pd[pol->plid] = pd; 1093 blkg->pd[pol->plid] = pd;
1112 pd->blkg = blkg; 1094 pd->blkg = blkg;
1113 pd->plid = pol->plid; 1095 pd->plid = pol->plid;
@@ -1124,8 +1106,6 @@ out_free:
1124 blk_queue_bypass_end(q); 1106 blk_queue_bypass_end(q);
1125 list_for_each_entry_safe(pd, nd, &pds, alloc_node) 1107 list_for_each_entry_safe(pd, nd, &pds, alloc_node)
1126 kfree(pd); 1108 kfree(pd);
1127 list_for_each_entry_safe(cpd, cnd, &cpds, alloc_node)
1128 kfree(cpd);
1129 return ret; 1109 return ret;
1130} 1110}
1131EXPORT_SYMBOL_GPL(blkcg_activate_policy); 1111EXPORT_SYMBOL_GPL(blkcg_activate_policy);
@@ -1162,8 +1142,6 @@ void blkcg_deactivate_policy(struct request_queue *q,
1162 1142
1163 kfree(blkg->pd[pol->plid]); 1143 kfree(blkg->pd[pol->plid]);
1164 blkg->pd[pol->plid] = NULL; 1144 blkg->pd[pol->plid] = NULL;
1165 kfree(blkg->blkcg->pd[pol->plid]);
1166 blkg->blkcg->pd[pol->plid] = NULL;
1167 1145
1168 spin_unlock(&blkg->blkcg->lock); 1146 spin_unlock(&blkg->blkcg->lock);
1169 } 1147 }
@@ -1182,11 +1160,13 @@ EXPORT_SYMBOL_GPL(blkcg_deactivate_policy);
1182 */ 1160 */
1183int blkcg_policy_register(struct blkcg_policy *pol) 1161int blkcg_policy_register(struct blkcg_policy *pol)
1184{ 1162{
1163 struct blkcg *blkcg;
1185 int i, ret; 1164 int i, ret;
1186 1165
1187 if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data))) 1166 if (WARN_ON(pol->pd_size < sizeof(struct blkg_policy_data)))
1188 return -EINVAL; 1167 return -EINVAL;
1189 1168
1169 mutex_lock(&blkcg_pol_register_mutex);
1190 mutex_lock(&blkcg_pol_mutex); 1170 mutex_lock(&blkcg_pol_mutex);
1191 1171
1192 /* find an empty slot */ 1172 /* find an empty slot */
@@ -1195,19 +1175,49 @@ int blkcg_policy_register(struct blkcg_policy *pol)
1195 if (!blkcg_policy[i]) 1175 if (!blkcg_policy[i])
1196 break; 1176 break;
1197 if (i >= BLKCG_MAX_POLS) 1177 if (i >= BLKCG_MAX_POLS)
1198 goto out_unlock; 1178 goto err_unlock;
1199 1179
1200 /* register and update blkgs */ 1180 /* register @pol */
1201 pol->plid = i; 1181 pol->plid = i;
1202 blkcg_policy[i] = pol; 1182 blkcg_policy[pol->plid] = pol;
1183
1184 /* allocate and install cpd's */
1185 if (pol->cpd_size) {
1186 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) {
1187 struct blkcg_policy_data *cpd;
1188
1189 cpd = kzalloc(pol->cpd_size, GFP_KERNEL);
1190 if (!cpd) {
1191 mutex_unlock(&blkcg_pol_mutex);
1192 goto err_free_cpds;
1193 }
1194
1195 blkcg->pd[pol->plid] = cpd;
1196 cpd->plid = pol->plid;
1197 pol->cpd_init_fn(blkcg);
1198 }
1199 }
1200
1201 mutex_unlock(&blkcg_pol_mutex);
1203 1202
1204 /* everything is in place, add intf files for the new policy */ 1203 /* everything is in place, add intf files for the new policy */
1205 if (pol->cftypes) 1204 if (pol->cftypes)
1206 WARN_ON(cgroup_add_legacy_cftypes(&blkio_cgrp_subsys, 1205 WARN_ON(cgroup_add_legacy_cftypes(&blkio_cgrp_subsys,
1207 pol->cftypes)); 1206 pol->cftypes));
1208 ret = 0; 1207 mutex_unlock(&blkcg_pol_register_mutex);
1209out_unlock: 1208 return 0;
1209
1210err_free_cpds:
1211 if (pol->cpd_size) {
1212 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) {
1213 kfree(blkcg->pd[pol->plid]);
1214 blkcg->pd[pol->plid] = NULL;
1215 }
1216 }
1217 blkcg_policy[pol->plid] = NULL;
1218err_unlock:
1210 mutex_unlock(&blkcg_pol_mutex); 1219 mutex_unlock(&blkcg_pol_mutex);
1220 mutex_unlock(&blkcg_pol_register_mutex);
1211 return ret; 1221 return ret;
1212} 1222}
1213EXPORT_SYMBOL_GPL(blkcg_policy_register); 1223EXPORT_SYMBOL_GPL(blkcg_policy_register);
@@ -1220,7 +1230,9 @@ EXPORT_SYMBOL_GPL(blkcg_policy_register);
1220 */ 1230 */
1221void blkcg_policy_unregister(struct blkcg_policy *pol) 1231void blkcg_policy_unregister(struct blkcg_policy *pol)
1222{ 1232{
1223 mutex_lock(&blkcg_pol_mutex); 1233 struct blkcg *blkcg;
1234
1235 mutex_lock(&blkcg_pol_register_mutex);
1224 1236
1225 if (WARN_ON(blkcg_policy[pol->plid] != pol)) 1237 if (WARN_ON(blkcg_policy[pol->plid] != pol))
1226 goto out_unlock; 1238 goto out_unlock;
@@ -1229,9 +1241,19 @@ void blkcg_policy_unregister(struct blkcg_policy *pol)
1229 if (pol->cftypes) 1241 if (pol->cftypes)
1230 cgroup_rm_cftypes(pol->cftypes); 1242 cgroup_rm_cftypes(pol->cftypes);
1231 1243
1232 /* unregister and update blkgs */ 1244 /* remove cpds and unregister */
1245 mutex_lock(&blkcg_pol_mutex);
1246
1247 if (pol->cpd_size) {
1248 list_for_each_entry(blkcg, &all_blkcgs, all_blkcgs_node) {
1249 kfree(blkcg->pd[pol->plid]);
1250 blkcg->pd[pol->plid] = NULL;
1251 }
1252 }
1233 blkcg_policy[pol->plid] = NULL; 1253 blkcg_policy[pol->plid] = NULL;
1234out_unlock: 1254
1235 mutex_unlock(&blkcg_pol_mutex); 1255 mutex_unlock(&blkcg_pol_mutex);
1256out_unlock:
1257 mutex_unlock(&blkcg_pol_register_mutex);
1236} 1258}
1237EXPORT_SYMBOL_GPL(blkcg_policy_unregister); 1259EXPORT_SYMBOL_GPL(blkcg_policy_unregister);
diff --git a/block/blk-core.c b/block/blk-core.c
index 82819e68f58b..627ed0c593fb 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3370,7 +3370,7 @@ EXPORT_SYMBOL(blk_post_runtime_resume);
3370int __init blk_dev_init(void) 3370int __init blk_dev_init(void)
3371{ 3371{
3372 BUILD_BUG_ON(__REQ_NR_BITS > 8 * 3372 BUILD_BUG_ON(__REQ_NR_BITS > 8 *
3373 sizeof(((struct request *)0)->cmd_flags)); 3373 FIELD_SIZEOF(struct request, cmd_flags));
3374 3374
3375 /* used for unplugging and affects IO latency/throughput - HIGHPRI */ 3375 /* used for unplugging and affects IO latency/throughput - HIGHPRI */
3376 kblockd_workqueue = alloc_workqueue("kblockd", 3376 kblockd_workqueue = alloc_workqueue("kblockd",
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f53779692c77..7d842db59699 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1998,7 +1998,7 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
1998 goto err_hctxs; 1998 goto err_hctxs;
1999 1999
2000 setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); 2000 setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q);
2001 blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30000); 2001 blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30 * HZ);
2002 2002
2003 q->nr_queues = nr_cpu_ids; 2003 q->nr_queues = nr_cpu_ids;
2004 q->nr_hw_queues = set->nr_hw_queues; 2004 q->nr_hw_queues = set->nr_hw_queues;
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 8244f013f210..f1c966e05078 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -193,6 +193,7 @@ static bool acpi_decode_space(struct resource_win *win,
193 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16; 193 u8 iodec = attr->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16;
194 bool wp = addr->info.mem.write_protect; 194 bool wp = addr->info.mem.write_protect;
195 u64 len = attr->address_length; 195 u64 len = attr->address_length;
196 u64 start, end, offset = 0;
196 struct resource *res = &win->res; 197 struct resource *res = &win->res;
197 198
198 /* 199 /*
@@ -204,9 +205,6 @@ static bool acpi_decode_space(struct resource_win *win,
204 pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n", 205 pr_debug("ACPI: Invalid address space min_addr_fix %d, max_addr_fix %d, len %llx\n",
205 addr->min_address_fixed, addr->max_address_fixed, len); 206 addr->min_address_fixed, addr->max_address_fixed, len);
206 207
207 res->start = attr->minimum;
208 res->end = attr->maximum;
209
210 /* 208 /*
211 * For bridges that translate addresses across the bridge, 209 * For bridges that translate addresses across the bridge,
212 * translation_offset is the offset that must be added to the 210 * translation_offset is the offset that must be added to the
@@ -214,12 +212,22 @@ static bool acpi_decode_space(struct resource_win *win,
214 * primary side. Non-bridge devices must list 0 for all Address 212 * primary side. Non-bridge devices must list 0 for all Address
215 * Translation offset bits. 213 * Translation offset bits.
216 */ 214 */
217 if (addr->producer_consumer == ACPI_PRODUCER) { 215 if (addr->producer_consumer == ACPI_PRODUCER)
218 res->start += attr->translation_offset; 216 offset = attr->translation_offset;
219 res->end += attr->translation_offset; 217 else if (attr->translation_offset)
220 } else if (attr->translation_offset) {
221 pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n", 218 pr_debug("ACPI: translation_offset(%lld) is invalid for non-bridge device.\n",
222 attr->translation_offset); 219 attr->translation_offset);
220 start = attr->minimum + offset;
221 end = attr->maximum + offset;
222
223 win->offset = offset;
224 res->start = start;
225 res->end = end;
226 if (sizeof(resource_size_t) < sizeof(u64) &&
227 (offset != win->offset || start != res->start || end != res->end)) {
228 pr_warn("acpi resource window ([%#llx-%#llx] ignored, not CPU addressable)\n",
229 attr->minimum, attr->maximum);
230 return false;
223 } 231 }
224 232
225 switch (addr->resource_type) { 233 switch (addr->resource_type) {
@@ -236,8 +244,6 @@ static bool acpi_decode_space(struct resource_win *win,
236 return false; 244 return false;
237 } 245 }
238 246
239 win->offset = attr->translation_offset;
240
241 if (addr->producer_consumer == ACPI_PRODUCER) 247 if (addr->producer_consumer == ACPI_PRODUCER)
242 res->flags |= IORESOURCE_WINDOW; 248 res->flags |= IORESOURCE_WINDOW;
243 249
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index a9b0c820f2eb..5d9ee99c2148 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -4,7 +4,7 @@
4 * Arasan Compact Flash host controller source file 4 * Arasan Compact Flash host controller source file
5 * 5 *
6 * Copyright (C) 2011 ST Microelectronics 6 * Copyright (C) 2011 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -968,7 +968,7 @@ static struct platform_driver arasan_cf_driver = {
968 968
969module_platform_driver(arasan_cf_driver); 969module_platform_driver(arasan_cf_driver);
970 970
971MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 971MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
972MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); 972MODULE_DESCRIPTION("Arasan ATA Compact Flash driver");
973MODULE_LICENSE("GPL"); 973MODULE_LICENSE("GPL");
974MODULE_ALIAS("platform:" DRIVER_NAME); 974MODULE_ALIAS("platform:" DRIVER_NAME);
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index d1d6141920d3..7920c2741b47 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2108,8 +2108,17 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid)
2108 goto out_free_disk; 2108 goto out_free_disk;
2109 2109
2110 add_disk(ns->disk); 2110 add_disk(ns->disk);
2111 if (ns->ms) 2111 if (ns->ms) {
2112 revalidate_disk(ns->disk); 2112 struct block_device *bd = bdget_disk(ns->disk, 0);
2113 if (!bd)
2114 return;
2115 if (blkdev_get(bd, FMODE_READ, NULL)) {
2116 bdput(bd);
2117 return;
2118 }
2119 blkdev_reread_part(bd);
2120 blkdev_put(bd, FMODE_READ);
2121 }
2113 return; 2122 return;
2114 out_free_disk: 2123 out_free_disk:
2115 kfree(disk); 2124 kfree(disk);
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 283f00a7f036..1082d4bb016a 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -129,8 +129,9 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
129 129
130 device_initialize(&chip->dev); 130 device_initialize(&chip->dev);
131 131
132 chip->cdev.owner = chip->pdev->driver->owner;
133 cdev_init(&chip->cdev, &tpm_fops); 132 cdev_init(&chip->cdev, &tpm_fops);
133 chip->cdev.owner = chip->pdev->driver->owner;
134 chip->cdev.kobj.parent = &chip->dev.kobj;
134 135
135 return chip; 136 return chip;
136} 137}
diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 44f9d20c19ac..1267322595da 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -233,6 +233,14 @@ static int crb_acpi_add(struct acpi_device *device)
233 return -ENODEV; 233 return -ENODEV;
234 } 234 }
235 235
236 /* At least some versions of AMI BIOS have a bug that TPM2 table has
237 * zero address for the control area and therefore we must fail.
238 */
239 if (!buf->control_area_pa) {
240 dev_err(dev, "TPM2 ACPI table has a zero address for the control area\n");
241 return -EINVAL;
242 }
243
236 if (buf->hdr.length < sizeof(struct acpi_tpm2)) { 244 if (buf->hdr.length < sizeof(struct acpi_tpm2)) {
237 dev_err(dev, "TPM2 ACPI table has wrong size"); 245 dev_err(dev, "TPM2 ACPI table has wrong size");
238 return -EINVAL; 246 return -EINVAL;
diff --git a/drivers/clk/spear/clk-aux-synth.c b/drivers/clk/spear/clk-aux-synth.c
index bdfb4421c643..f271c350ef94 100644
--- a/drivers/clk/spear/clk-aux-synth.c
+++ b/drivers/clk/spear/clk-aux-synth.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.linux@gmail.com> 3 * Viresh Kumar <vireshk@kernel.org>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk-frac-synth.c b/drivers/clk/spear/clk-frac-synth.c
index dffd4ce6c8b5..58d678b5b40a 100644
--- a/drivers/clk/spear/clk-frac-synth.c
+++ b/drivers/clk/spear/clk-frac-synth.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.linux@gmail.com> 3 * Viresh Kumar <vireshk@kernel.org>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk-gpt-synth.c b/drivers/clk/spear/clk-gpt-synth.c
index 1afc18c4effc..1a722e99e76e 100644
--- a/drivers/clk/spear/clk-gpt-synth.c
+++ b/drivers/clk/spear/clk-gpt-synth.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.linux@gmail.com> 3 * Viresh Kumar <vireshk@kernel.org>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk-vco-pll.c b/drivers/clk/spear/clk-vco-pll.c
index 1b9b65bca51e..5ebddc528145 100644
--- a/drivers/clk/spear/clk-vco-pll.c
+++ b/drivers/clk/spear/clk-vco-pll.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.linux@gmail.com> 3 * Viresh Kumar <vireshk@kernel.org>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk.c b/drivers/clk/spear/clk.c
index 628b6d5ed3d9..157fe099ea6a 100644
--- a/drivers/clk/spear/clk.c
+++ b/drivers/clk/spear/clk.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 2012 ST Microelectronics 2 * Copyright (C) 2012 ST Microelectronics
3 * Viresh Kumar <viresh.linux@gmail.com> 3 * Viresh Kumar <vireshk@kernel.org>
4 * 4 *
5 * This file is licensed under the terms of the GNU General Public 5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any 6 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/clk.h b/drivers/clk/spear/clk.h
index 931737677dfa..9834944f08b1 100644
--- a/drivers/clk/spear/clk.h
+++ b/drivers/clk/spear/clk.h
@@ -2,7 +2,7 @@
2 * Clock framework definitions for SPEAr platform 2 * Clock framework definitions for SPEAr platform
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear1310_clock.c b/drivers/clk/spear/spear1310_clock.c
index 4daa5977793a..222ce108b41a 100644
--- a/drivers/clk/spear/spear1310_clock.c
+++ b/drivers/clk/spear/spear1310_clock.c
@@ -4,7 +4,7 @@
4 * SPEAr1310 machine clock framework source file 4 * SPEAr1310 machine clock framework source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c
index 5a5c6648308d..973c9d3fbcf8 100644
--- a/drivers/clk/spear/spear1340_clock.c
+++ b/drivers/clk/spear/spear1340_clock.c
@@ -4,7 +4,7 @@
4 * SPEAr1340 machine clock framework source file 4 * SPEAr1340 machine clock framework source file
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c
index bb5f387774e2..404a55edd613 100644
--- a/drivers/clk/spear/spear3xx_clock.c
+++ b/drivers/clk/spear/spear3xx_clock.c
@@ -2,7 +2,7 @@
2 * SPEAr3xx machines clock framework source file 2 * SPEAr3xx machines clock framework source file
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/clk/spear/spear6xx_clock.c b/drivers/clk/spear/spear6xx_clock.c
index 4f649c9cb094..231061fa73a4 100644
--- a/drivers/clk/spear/spear6xx_clock.c
+++ b/drivers/clk/spear/spear6xx_clock.c
@@ -2,7 +2,7 @@
2 * SPEAr6xx machines clock framework source file 2 * SPEAr6xx machines clock framework source file
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index b612411655f9..26063afb3eba 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -169,6 +169,15 @@ struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy)
169} 169}
170EXPORT_SYMBOL_GPL(get_governor_parent_kobj); 170EXPORT_SYMBOL_GPL(get_governor_parent_kobj);
171 171
172struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu)
173{
174 struct cpufreq_policy *policy = per_cpu(cpufreq_cpu_data, cpu);
175
176 return policy && !policy_is_inactive(policy) ?
177 policy->freq_table : NULL;
178}
179EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table);
180
172static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall) 181static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
173{ 182{
174 u64 idle_time; 183 u64 idle_time;
@@ -1132,6 +1141,7 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
1132 1141
1133 down_write(&policy->rwsem); 1142 down_write(&policy->rwsem);
1134 policy->cpu = cpu; 1143 policy->cpu = cpu;
1144 policy->governor = NULL;
1135 up_write(&policy->rwsem); 1145 up_write(&policy->rwsem);
1136 } 1146 }
1137 1147
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index df14766a8e06..dfbbf981ed56 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -297,15 +297,6 @@ int cpufreq_table_validate_and_show(struct cpufreq_policy *policy,
297} 297}
298EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show); 298EXPORT_SYMBOL_GPL(cpufreq_table_validate_and_show);
299 299
300struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu);
301
302struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu)
303{
304 struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
305 return policy ? policy->freq_table : NULL;
306}
307EXPORT_SYMBOL_GPL(cpufreq_frequency_get_table);
308
309MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); 300MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
310MODULE_DESCRIPTION("CPUfreq frequency table helpers"); 301MODULE_DESCRIPTION("CPUfreq frequency table helpers");
311MODULE_LICENSE("GPL"); 302MODULE_LICENSE("GPL");
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index e8e2775c3821..48b7228563ad 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -112,7 +112,12 @@ int cpuidle_find_deepest_state(struct cpuidle_driver *drv,
112static void enter_freeze_proper(struct cpuidle_driver *drv, 112static void enter_freeze_proper(struct cpuidle_driver *drv,
113 struct cpuidle_device *dev, int index) 113 struct cpuidle_device *dev, int index)
114{ 114{
115 tick_freeze(); 115 /*
116 * trace_suspend_resume() called by tick_freeze() for the last CPU
117 * executing it contains RCU usage regarded as invalid in the idle
118 * context, so tell RCU about that.
119 */
120 RCU_NONIDLE(tick_freeze());
116 /* 121 /*
117 * The state used here cannot be a "coupled" one, because the "coupled" 122 * The state used here cannot be a "coupled" one, because the "coupled"
118 * cpuidle mechanism enables interrupts and doing that with timekeeping 123 * cpuidle mechanism enables interrupts and doing that with timekeeping
@@ -122,7 +127,7 @@ static void enter_freeze_proper(struct cpuidle_driver *drv,
122 WARN_ON(!irqs_disabled()); 127 WARN_ON(!irqs_disabled());
123 /* 128 /*
124 * timekeeping_resume() that will be called by tick_unfreeze() for the 129 * timekeeping_resume() that will be called by tick_unfreeze() for the
125 * last CPU executing it calls functions containing RCU read-side 130 * first CPU executing it calls functions containing RCU read-side
126 * critical sections, so tell RCU about that. 131 * critical sections, so tell RCU about that.
127 */ 132 */
128 RCU_NONIDLE(tick_unfreeze()); 133 RCU_NONIDLE(tick_unfreeze());
diff --git a/drivers/crypto/nx/nx-aes-ccm.c b/drivers/crypto/nx/nx-aes-ccm.c
index 67f80813a06f..e4311ce0cd78 100644
--- a/drivers/crypto/nx/nx-aes-ccm.c
+++ b/drivers/crypto/nx/nx-aes-ccm.c
@@ -494,8 +494,9 @@ out:
494static int ccm4309_aes_nx_encrypt(struct aead_request *req) 494static int ccm4309_aes_nx_encrypt(struct aead_request *req)
495{ 495{
496 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 496 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm);
497 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
497 struct blkcipher_desc desc; 498 struct blkcipher_desc desc;
498 u8 *iv = nx_ctx->priv.ccm.iv; 499 u8 *iv = rctx->iv;
499 500
500 iv[0] = 3; 501 iv[0] = 3;
501 memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3); 502 memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3);
@@ -525,8 +526,9 @@ static int ccm_aes_nx_encrypt(struct aead_request *req)
525static int ccm4309_aes_nx_decrypt(struct aead_request *req) 526static int ccm4309_aes_nx_decrypt(struct aead_request *req)
526{ 527{
527 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 528 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm);
529 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
528 struct blkcipher_desc desc; 530 struct blkcipher_desc desc;
529 u8 *iv = nx_ctx->priv.ccm.iv; 531 u8 *iv = rctx->iv;
530 532
531 iv[0] = 3; 533 iv[0] = 3;
532 memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3); 534 memcpy(iv + 1, nx_ctx->priv.ccm.nonce, 3);
diff --git a/drivers/crypto/nx/nx-aes-ctr.c b/drivers/crypto/nx/nx-aes-ctr.c
index 2617cd4d54dd..dd7e9f3f5b6b 100644
--- a/drivers/crypto/nx/nx-aes-ctr.c
+++ b/drivers/crypto/nx/nx-aes-ctr.c
@@ -72,7 +72,7 @@ static int ctr3686_aes_nx_set_key(struct crypto_tfm *tfm,
72 if (key_len < CTR_RFC3686_NONCE_SIZE) 72 if (key_len < CTR_RFC3686_NONCE_SIZE)
73 return -EINVAL; 73 return -EINVAL;
74 74
75 memcpy(nx_ctx->priv.ctr.iv, 75 memcpy(nx_ctx->priv.ctr.nonce,
76 in_key + key_len - CTR_RFC3686_NONCE_SIZE, 76 in_key + key_len - CTR_RFC3686_NONCE_SIZE,
77 CTR_RFC3686_NONCE_SIZE); 77 CTR_RFC3686_NONCE_SIZE);
78 78
@@ -131,14 +131,15 @@ static int ctr3686_aes_nx_crypt(struct blkcipher_desc *desc,
131 unsigned int nbytes) 131 unsigned int nbytes)
132{ 132{
133 struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm); 133 struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm);
134 u8 *iv = nx_ctx->priv.ctr.iv; 134 u8 iv[16];
135 135
136 memcpy(iv, nx_ctx->priv.ctr.nonce, CTR_RFC3686_IV_SIZE);
136 memcpy(iv + CTR_RFC3686_NONCE_SIZE, 137 memcpy(iv + CTR_RFC3686_NONCE_SIZE,
137 desc->info, CTR_RFC3686_IV_SIZE); 138 desc->info, CTR_RFC3686_IV_SIZE);
138 iv[12] = iv[13] = iv[14] = 0; 139 iv[12] = iv[13] = iv[14] = 0;
139 iv[15] = 1; 140 iv[15] = 1;
140 141
141 desc->info = nx_ctx->priv.ctr.iv; 142 desc->info = iv;
142 143
143 return ctr_aes_nx_crypt(desc, dst, src, nbytes); 144 return ctr_aes_nx_crypt(desc, dst, src, nbytes);
144} 145}
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c
index 08ac6d48688c..92c993f08213 100644
--- a/drivers/crypto/nx/nx-aes-gcm.c
+++ b/drivers/crypto/nx/nx-aes-gcm.c
@@ -317,6 +317,7 @@ out:
317static int gcm_aes_nx_crypt(struct aead_request *req, int enc) 317static int gcm_aes_nx_crypt(struct aead_request *req, int enc)
318{ 318{
319 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 319 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm);
320 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
320 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; 321 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
321 struct blkcipher_desc desc; 322 struct blkcipher_desc desc;
322 unsigned int nbytes = req->cryptlen; 323 unsigned int nbytes = req->cryptlen;
@@ -326,7 +327,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc)
326 327
327 spin_lock_irqsave(&nx_ctx->lock, irq_flags); 328 spin_lock_irqsave(&nx_ctx->lock, irq_flags);
328 329
329 desc.info = nx_ctx->priv.gcm.iv; 330 desc.info = rctx->iv;
330 /* initialize the counter */ 331 /* initialize the counter */
331 *(u32 *)(desc.info + NX_GCM_CTR_OFFSET) = 1; 332 *(u32 *)(desc.info + NX_GCM_CTR_OFFSET) = 1;
332 333
@@ -424,8 +425,8 @@ out:
424 425
425static int gcm_aes_nx_encrypt(struct aead_request *req) 426static int gcm_aes_nx_encrypt(struct aead_request *req)
426{ 427{
427 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 428 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
428 char *iv = nx_ctx->priv.gcm.iv; 429 char *iv = rctx->iv;
429 430
430 memcpy(iv, req->iv, 12); 431 memcpy(iv, req->iv, 12);
431 432
@@ -434,8 +435,8 @@ static int gcm_aes_nx_encrypt(struct aead_request *req)
434 435
435static int gcm_aes_nx_decrypt(struct aead_request *req) 436static int gcm_aes_nx_decrypt(struct aead_request *req)
436{ 437{
437 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 438 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
438 char *iv = nx_ctx->priv.gcm.iv; 439 char *iv = rctx->iv;
439 440
440 memcpy(iv, req->iv, 12); 441 memcpy(iv, req->iv, 12);
441 442
@@ -445,7 +446,8 @@ static int gcm_aes_nx_decrypt(struct aead_request *req)
445static int gcm4106_aes_nx_encrypt(struct aead_request *req) 446static int gcm4106_aes_nx_encrypt(struct aead_request *req)
446{ 447{
447 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 448 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm);
448 char *iv = nx_ctx->priv.gcm.iv; 449 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
450 char *iv = rctx->iv;
449 char *nonce = nx_ctx->priv.gcm.nonce; 451 char *nonce = nx_ctx->priv.gcm.nonce;
450 452
451 memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); 453 memcpy(iv, nonce, NX_GCM4106_NONCE_LEN);
@@ -457,7 +459,8 @@ static int gcm4106_aes_nx_encrypt(struct aead_request *req)
457static int gcm4106_aes_nx_decrypt(struct aead_request *req) 459static int gcm4106_aes_nx_decrypt(struct aead_request *req)
458{ 460{
459 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); 461 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm);
460 char *iv = nx_ctx->priv.gcm.iv; 462 struct nx_gcm_rctx *rctx = aead_request_ctx(req);
463 char *iv = rctx->iv;
461 char *nonce = nx_ctx->priv.gcm.nonce; 464 char *nonce = nx_ctx->priv.gcm.nonce;
462 465
463 memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); 466 memcpy(iv, nonce, NX_GCM4106_NONCE_LEN);
diff --git a/drivers/crypto/nx/nx-aes-xcbc.c b/drivers/crypto/nx/nx-aes-xcbc.c
index 8c2faffab4a3..c2f7d4befb55 100644
--- a/drivers/crypto/nx/nx-aes-xcbc.c
+++ b/drivers/crypto/nx/nx-aes-xcbc.c
@@ -42,6 +42,7 @@ static int nx_xcbc_set_key(struct crypto_shash *desc,
42 unsigned int key_len) 42 unsigned int key_len)
43{ 43{
44 struct nx_crypto_ctx *nx_ctx = crypto_shash_ctx(desc); 44 struct nx_crypto_ctx *nx_ctx = crypto_shash_ctx(desc);
45 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
45 46
46 switch (key_len) { 47 switch (key_len) {
47 case AES_KEYSIZE_128: 48 case AES_KEYSIZE_128:
@@ -51,7 +52,7 @@ static int nx_xcbc_set_key(struct crypto_shash *desc,
51 return -EINVAL; 52 return -EINVAL;
52 } 53 }
53 54
54 memcpy(nx_ctx->priv.xcbc.key, in_key, key_len); 55 memcpy(csbcpb->cpb.aes_xcbc.key, in_key, key_len);
55 56
56 return 0; 57 return 0;
57} 58}
@@ -148,32 +149,29 @@ out:
148 return rc; 149 return rc;
149} 150}
150 151
151static int nx_xcbc_init(struct shash_desc *desc) 152static int nx_crypto_ctx_aes_xcbc_init2(struct crypto_tfm *tfm)
152{ 153{
153 struct xcbc_state *sctx = shash_desc_ctx(desc); 154 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
154 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
155 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; 155 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
156 struct nx_sg *out_sg; 156 int err;
157 int len;
158 157
159 nx_ctx_init(nx_ctx, HCOP_FC_AES); 158 err = nx_crypto_ctx_aes_xcbc_init(tfm);
159 if (err)
160 return err;
160 161
161 memset(sctx, 0, sizeof *sctx); 162 nx_ctx_init(nx_ctx, HCOP_FC_AES);
162 163
163 NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_128); 164 NX_CPB_SET_KEY_SIZE(csbcpb, NX_KS_AES_128);
164 csbcpb->cpb.hdr.mode = NX_MODE_AES_XCBC_MAC; 165 csbcpb->cpb.hdr.mode = NX_MODE_AES_XCBC_MAC;
165 166
166 memcpy(csbcpb->cpb.aes_xcbc.key, nx_ctx->priv.xcbc.key, AES_BLOCK_SIZE); 167 return 0;
167 memset(nx_ctx->priv.xcbc.key, 0, sizeof *nx_ctx->priv.xcbc.key); 168}
168
169 len = AES_BLOCK_SIZE;
170 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state,
171 &len, nx_ctx->ap->sglen);
172 169
173 if (len != AES_BLOCK_SIZE) 170static int nx_xcbc_init(struct shash_desc *desc)
174 return -EINVAL; 171{
172 struct xcbc_state *sctx = shash_desc_ctx(desc);
175 173
176 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); 174 memset(sctx, 0, sizeof *sctx);
177 175
178 return 0; 176 return 0;
179} 177}
@@ -186,6 +184,7 @@ static int nx_xcbc_update(struct shash_desc *desc,
186 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); 184 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
187 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; 185 struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
188 struct nx_sg *in_sg; 186 struct nx_sg *in_sg;
187 struct nx_sg *out_sg;
189 u32 to_process = 0, leftover, total; 188 u32 to_process = 0, leftover, total;
190 unsigned int max_sg_len; 189 unsigned int max_sg_len;
191 unsigned long irq_flags; 190 unsigned long irq_flags;
@@ -213,6 +212,17 @@ static int nx_xcbc_update(struct shash_desc *desc,
213 max_sg_len = min_t(u64, max_sg_len, 212 max_sg_len = min_t(u64, max_sg_len,
214 nx_ctx->ap->databytelen/NX_PAGE_SIZE); 213 nx_ctx->ap->databytelen/NX_PAGE_SIZE);
215 214
215 data_len = AES_BLOCK_SIZE;
216 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state,
217 &len, nx_ctx->ap->sglen);
218
219 if (data_len != AES_BLOCK_SIZE) {
220 rc = -EINVAL;
221 goto out;
222 }
223
224 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
225
216 do { 226 do {
217 to_process = total - to_process; 227 to_process = total - to_process;
218 to_process = to_process & ~(AES_BLOCK_SIZE - 1); 228 to_process = to_process & ~(AES_BLOCK_SIZE - 1);
@@ -235,8 +245,10 @@ static int nx_xcbc_update(struct shash_desc *desc,
235 (u8 *) sctx->buffer, 245 (u8 *) sctx->buffer,
236 &data_len, 246 &data_len,
237 max_sg_len); 247 max_sg_len);
238 if (data_len != sctx->count) 248 if (data_len != sctx->count) {
239 return -EINVAL; 249 rc = -EINVAL;
250 goto out;
251 }
240 } 252 }
241 253
242 data_len = to_process - sctx->count; 254 data_len = to_process - sctx->count;
@@ -245,8 +257,10 @@ static int nx_xcbc_update(struct shash_desc *desc,
245 &data_len, 257 &data_len,
246 max_sg_len); 258 max_sg_len);
247 259
248 if (data_len != to_process - sctx->count) 260 if (data_len != to_process - sctx->count) {
249 return -EINVAL; 261 rc = -EINVAL;
262 goto out;
263 }
250 264
251 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * 265 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) *
252 sizeof(struct nx_sg); 266 sizeof(struct nx_sg);
@@ -325,15 +339,19 @@ static int nx_xcbc_final(struct shash_desc *desc, u8 *out)
325 in_sg = nx_build_sg_list(nx_ctx->in_sg, (u8 *)sctx->buffer, 339 in_sg = nx_build_sg_list(nx_ctx->in_sg, (u8 *)sctx->buffer,
326 &len, nx_ctx->ap->sglen); 340 &len, nx_ctx->ap->sglen);
327 341
328 if (len != sctx->count) 342 if (len != sctx->count) {
329 return -EINVAL; 343 rc = -EINVAL;
344 goto out;
345 }
330 346
331 len = AES_BLOCK_SIZE; 347 len = AES_BLOCK_SIZE;
332 out_sg = nx_build_sg_list(nx_ctx->out_sg, out, &len, 348 out_sg = nx_build_sg_list(nx_ctx->out_sg, out, &len,
333 nx_ctx->ap->sglen); 349 nx_ctx->ap->sglen);
334 350
335 if (len != AES_BLOCK_SIZE) 351 if (len != AES_BLOCK_SIZE) {
336 return -EINVAL; 352 rc = -EINVAL;
353 goto out;
354 }
337 355
338 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); 356 nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
339 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg); 357 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
@@ -372,7 +390,7 @@ struct shash_alg nx_shash_aes_xcbc_alg = {
372 .cra_blocksize = AES_BLOCK_SIZE, 390 .cra_blocksize = AES_BLOCK_SIZE,
373 .cra_module = THIS_MODULE, 391 .cra_module = THIS_MODULE,
374 .cra_ctxsize = sizeof(struct nx_crypto_ctx), 392 .cra_ctxsize = sizeof(struct nx_crypto_ctx),
375 .cra_init = nx_crypto_ctx_aes_xcbc_init, 393 .cra_init = nx_crypto_ctx_aes_xcbc_init2,
376 .cra_exit = nx_crypto_ctx_exit, 394 .cra_exit = nx_crypto_ctx_exit,
377 } 395 }
378}; 396};
diff --git a/drivers/crypto/nx/nx-sha256.c b/drivers/crypto/nx/nx-sha256.c
index 4e91bdb83c59..08f8d5cd6334 100644
--- a/drivers/crypto/nx/nx-sha256.c
+++ b/drivers/crypto/nx/nx-sha256.c
@@ -29,34 +29,28 @@
29#include "nx.h" 29#include "nx.h"
30 30
31 31
32static int nx_sha256_init(struct shash_desc *desc) 32static int nx_crypto_ctx_sha256_init(struct crypto_tfm *tfm)
33{ 33{
34 struct sha256_state *sctx = shash_desc_ctx(desc); 34 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
35 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); 35 int err;
36 struct nx_sg *out_sg;
37 int len;
38 u32 max_sg_len;
39 36
40 nx_ctx_init(nx_ctx, HCOP_FC_SHA); 37 err = nx_crypto_ctx_sha_init(tfm);
38 if (err)
39 return err;
41 40
42 memset(sctx, 0, sizeof *sctx); 41 nx_ctx_init(nx_ctx, HCOP_FC_SHA);
43 42
44 nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA256]; 43 nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA256];
45 44
46 NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA256); 45 NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA256);
47 46
48 max_sg_len = min_t(u64, nx_ctx->ap->sglen, 47 return 0;
49 nx_driver.of.max_sg_len/sizeof(struct nx_sg)); 48}
50 max_sg_len = min_t(u64, max_sg_len,
51 nx_ctx->ap->databytelen/NX_PAGE_SIZE);
52 49
53 len = SHA256_DIGEST_SIZE; 50static int nx_sha256_init(struct shash_desc *desc) {
54 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, 51 struct sha256_state *sctx = shash_desc_ctx(desc);
55 &len, max_sg_len);
56 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
57 52
58 if (len != SHA256_DIGEST_SIZE) 53 memset(sctx, 0, sizeof *sctx);
59 return -EINVAL;
60 54
61 sctx->state[0] = __cpu_to_be32(SHA256_H0); 55 sctx->state[0] = __cpu_to_be32(SHA256_H0);
62 sctx->state[1] = __cpu_to_be32(SHA256_H1); 56 sctx->state[1] = __cpu_to_be32(SHA256_H1);
@@ -78,6 +72,7 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
78 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); 72 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
79 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; 73 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
80 struct nx_sg *in_sg; 74 struct nx_sg *in_sg;
75 struct nx_sg *out_sg;
81 u64 to_process = 0, leftover, total; 76 u64 to_process = 0, leftover, total;
82 unsigned long irq_flags; 77 unsigned long irq_flags;
83 int rc = 0; 78 int rc = 0;
@@ -108,6 +103,16 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data,
108 max_sg_len = min_t(u64, max_sg_len, 103 max_sg_len = min_t(u64, max_sg_len,
109 nx_ctx->ap->databytelen/NX_PAGE_SIZE); 104 nx_ctx->ap->databytelen/NX_PAGE_SIZE);
110 105
106 data_len = SHA256_DIGEST_SIZE;
107 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state,
108 &data_len, max_sg_len);
109 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
110
111 if (data_len != SHA256_DIGEST_SIZE) {
112 rc = -EINVAL;
113 goto out;
114 }
115
111 do { 116 do {
112 /* 117 /*
113 * to_process: the SHA256_BLOCK_SIZE data chunk to process in 118 * to_process: the SHA256_BLOCK_SIZE data chunk to process in
@@ -282,7 +287,7 @@ struct shash_alg nx_shash_sha256_alg = {
282 .cra_blocksize = SHA256_BLOCK_SIZE, 287 .cra_blocksize = SHA256_BLOCK_SIZE,
283 .cra_module = THIS_MODULE, 288 .cra_module = THIS_MODULE,
284 .cra_ctxsize = sizeof(struct nx_crypto_ctx), 289 .cra_ctxsize = sizeof(struct nx_crypto_ctx),
285 .cra_init = nx_crypto_ctx_sha_init, 290 .cra_init = nx_crypto_ctx_sha256_init,
286 .cra_exit = nx_crypto_ctx_exit, 291 .cra_exit = nx_crypto_ctx_exit,
287 } 292 }
288}; 293};
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c
index e6a58d2ee628..aff0fe58eac0 100644
--- a/drivers/crypto/nx/nx-sha512.c
+++ b/drivers/crypto/nx/nx-sha512.c
@@ -28,34 +28,29 @@
28#include "nx.h" 28#include "nx.h"
29 29
30 30
31static int nx_sha512_init(struct shash_desc *desc) 31static int nx_crypto_ctx_sha512_init(struct crypto_tfm *tfm)
32{ 32{
33 struct sha512_state *sctx = shash_desc_ctx(desc); 33 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
34 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); 34 int err;
35 struct nx_sg *out_sg;
36 int len;
37 u32 max_sg_len;
38 35
39 nx_ctx_init(nx_ctx, HCOP_FC_SHA); 36 err = nx_crypto_ctx_sha_init(tfm);
37 if (err)
38 return err;
40 39
41 memset(sctx, 0, sizeof *sctx); 40 nx_ctx_init(nx_ctx, HCOP_FC_SHA);
42 41
43 nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA512]; 42 nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA512];
44 43
45 NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA512); 44 NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA512);
46 45
47 max_sg_len = min_t(u64, nx_ctx->ap->sglen, 46 return 0;
48 nx_driver.of.max_sg_len/sizeof(struct nx_sg)); 47}
49 max_sg_len = min_t(u64, max_sg_len,
50 nx_ctx->ap->databytelen/NX_PAGE_SIZE);
51 48
52 len = SHA512_DIGEST_SIZE; 49static int nx_sha512_init(struct shash_desc *desc)
53 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state, 50{
54 &len, max_sg_len); 51 struct sha512_state *sctx = shash_desc_ctx(desc);
55 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
56 52
57 if (len != SHA512_DIGEST_SIZE) 53 memset(sctx, 0, sizeof *sctx);
58 return -EINVAL;
59 54
60 sctx->state[0] = __cpu_to_be64(SHA512_H0); 55 sctx->state[0] = __cpu_to_be64(SHA512_H0);
61 sctx->state[1] = __cpu_to_be64(SHA512_H1); 56 sctx->state[1] = __cpu_to_be64(SHA512_H1);
@@ -77,6 +72,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
77 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); 72 struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
78 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; 73 struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
79 struct nx_sg *in_sg; 74 struct nx_sg *in_sg;
75 struct nx_sg *out_sg;
80 u64 to_process, leftover = 0, total; 76 u64 to_process, leftover = 0, total;
81 unsigned long irq_flags; 77 unsigned long irq_flags;
82 int rc = 0; 78 int rc = 0;
@@ -107,6 +103,16 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
107 max_sg_len = min_t(u64, max_sg_len, 103 max_sg_len = min_t(u64, max_sg_len,
108 nx_ctx->ap->databytelen/NX_PAGE_SIZE); 104 nx_ctx->ap->databytelen/NX_PAGE_SIZE);
109 105
106 data_len = SHA512_DIGEST_SIZE;
107 out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state,
108 &data_len, max_sg_len);
109 nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
110
111 if (data_len != SHA512_DIGEST_SIZE) {
112 rc = -EINVAL;
113 goto out;
114 }
115
110 do { 116 do {
111 /* 117 /*
112 * to_process: the SHA512_BLOCK_SIZE data chunk to process in 118 * to_process: the SHA512_BLOCK_SIZE data chunk to process in
@@ -288,7 +294,7 @@ struct shash_alg nx_shash_sha512_alg = {
288 .cra_blocksize = SHA512_BLOCK_SIZE, 294 .cra_blocksize = SHA512_BLOCK_SIZE,
289 .cra_module = THIS_MODULE, 295 .cra_module = THIS_MODULE,
290 .cra_ctxsize = sizeof(struct nx_crypto_ctx), 296 .cra_ctxsize = sizeof(struct nx_crypto_ctx),
291 .cra_init = nx_crypto_ctx_sha_init, 297 .cra_init = nx_crypto_ctx_sha512_init,
292 .cra_exit = nx_crypto_ctx_exit, 298 .cra_exit = nx_crypto_ctx_exit,
293 } 299 }
294}; 300};
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index f6198f29a4a8..436971343ff7 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -713,12 +713,15 @@ static int nx_crypto_ctx_init(struct nx_crypto_ctx *nx_ctx, u32 fc, u32 mode)
713/* entry points from the crypto tfm initializers */ 713/* entry points from the crypto tfm initializers */
714int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm) 714int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm)
715{ 715{
716 crypto_aead_set_reqsize(__crypto_aead_cast(tfm),
717 sizeof(struct nx_ccm_rctx));
716 return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES, 718 return nx_crypto_ctx_init(crypto_tfm_ctx(tfm), NX_FC_AES,
717 NX_MODE_AES_CCM); 719 NX_MODE_AES_CCM);
718} 720}
719 721
720int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm) 722int nx_crypto_ctx_aes_gcm_init(struct crypto_aead *tfm)
721{ 723{
724 crypto_aead_set_reqsize(tfm, sizeof(struct nx_gcm_rctx));
722 return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES, 725 return nx_crypto_ctx_init(crypto_aead_ctx(tfm), NX_FC_AES,
723 NX_MODE_AES_GCM); 726 NX_MODE_AES_GCM);
724} 727}
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index de3ea8738146..cdff03a42ae7 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -2,6 +2,8 @@
2#ifndef __NX_H__ 2#ifndef __NX_H__
3#define __NX_H__ 3#define __NX_H__
4 4
5#include <crypto/ctr.h>
6
5#define NX_NAME "nx-crypto" 7#define NX_NAME "nx-crypto"
6#define NX_STRING "IBM Power7+ Nest Accelerator Crypto Driver" 8#define NX_STRING "IBM Power7+ Nest Accelerator Crypto Driver"
7#define NX_VERSION "1.0" 9#define NX_VERSION "1.0"
@@ -91,8 +93,11 @@ struct nx_crypto_driver {
91 93
92#define NX_GCM4106_NONCE_LEN (4) 94#define NX_GCM4106_NONCE_LEN (4)
93#define NX_GCM_CTR_OFFSET (12) 95#define NX_GCM_CTR_OFFSET (12)
94struct nx_gcm_priv { 96struct nx_gcm_rctx {
95 u8 iv[16]; 97 u8 iv[16];
98};
99
100struct nx_gcm_priv {
96 u8 iauth_tag[16]; 101 u8 iauth_tag[16];
97 u8 nonce[NX_GCM4106_NONCE_LEN]; 102 u8 nonce[NX_GCM4106_NONCE_LEN];
98}; 103};
@@ -100,8 +105,11 @@ struct nx_gcm_priv {
100#define NX_CCM_AES_KEY_LEN (16) 105#define NX_CCM_AES_KEY_LEN (16)
101#define NX_CCM4309_AES_KEY_LEN (19) 106#define NX_CCM4309_AES_KEY_LEN (19)
102#define NX_CCM4309_NONCE_LEN (3) 107#define NX_CCM4309_NONCE_LEN (3)
103struct nx_ccm_priv { 108struct nx_ccm_rctx {
104 u8 iv[16]; 109 u8 iv[16];
110};
111
112struct nx_ccm_priv {
105 u8 b0[16]; 113 u8 b0[16];
106 u8 iauth_tag[16]; 114 u8 iauth_tag[16];
107 u8 oauth_tag[16]; 115 u8 oauth_tag[16];
@@ -113,7 +121,7 @@ struct nx_xcbc_priv {
113}; 121};
114 122
115struct nx_ctr_priv { 123struct nx_ctr_priv {
116 u8 iv[16]; 124 u8 nonce[CTR_RFC3686_NONCE_SIZE];
117}; 125};
118 126
119struct nx_crypto_ctx { 127struct nx_crypto_ctx {
diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index 46307098f8ba..0a70e46d5416 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -536,9 +536,6 @@ static int omap_des_crypt_dma_stop(struct omap_des_dev *dd)
536 dmaengine_terminate_all(dd->dma_lch_in); 536 dmaengine_terminate_all(dd->dma_lch_in);
537 dmaengine_terminate_all(dd->dma_lch_out); 537 dmaengine_terminate_all(dd->dma_lch_out);
538 538
539 dma_unmap_sg(dd->dev, dd->in_sg, dd->in_sg_len, DMA_TO_DEVICE);
540 dma_unmap_sg(dd->dev, dd->out_sg, dd->out_sg_len, DMA_FROM_DEVICE);
541
542 return err; 539 return err;
543} 540}
544 541
diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
index 1022c2e1a2b0..cf1c87fa1edd 100644
--- a/drivers/dma/dw/core.c
+++ b/drivers/dma/dw/core.c
@@ -1746,4 +1746,4 @@ EXPORT_SYMBOL_GPL(dw_dma_enable);
1746MODULE_LICENSE("GPL v2"); 1746MODULE_LICENSE("GPL v2");
1747MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller core driver"); 1747MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller core driver");
1748MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); 1748MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
1749MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 1749MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 7a3cb1fa0a76..4630a8133ea6 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -87,6 +87,15 @@ static int brcmstb_gpio_remove(struct platform_device *pdev)
87 struct brcmstb_gpio_bank *bank; 87 struct brcmstb_gpio_bank *bank;
88 int ret = 0; 88 int ret = 0;
89 89
90 if (!priv) {
91 dev_err(&pdev->dev, "called %s without drvdata!\n", __func__);
92 return -EFAULT;
93 }
94
95 /*
96 * You can lose return values below, but we report all errors, and it's
97 * more important to actually perform all of the steps.
98 */
90 list_for_each(pos, &priv->bank_list) { 99 list_for_each(pos, &priv->bank_list) {
91 bank = list_entry(pos, struct brcmstb_gpio_bank, node); 100 bank = list_entry(pos, struct brcmstb_gpio_bank, node);
92 ret = bgpio_remove(&bank->bgc); 101 ret = bgpio_remove(&bank->bgc);
@@ -143,6 +152,8 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
143 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 152 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
144 if (!priv) 153 if (!priv)
145 return -ENOMEM; 154 return -ENOMEM;
155 platform_set_drvdata(pdev, priv);
156 INIT_LIST_HEAD(&priv->bank_list);
146 157
147 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 158 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
148 reg_base = devm_ioremap_resource(dev, res); 159 reg_base = devm_ioremap_resource(dev, res);
@@ -153,7 +164,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
153 priv->reg_base = reg_base; 164 priv->reg_base = reg_base;
154 priv->pdev = pdev; 165 priv->pdev = pdev;
155 166
156 INIT_LIST_HEAD(&priv->bank_list);
157 if (brcmstb_gpio_sanity_check_banks(dev, np, res)) 167 if (brcmstb_gpio_sanity_check_banks(dev, np, res))
158 return -EINVAL; 168 return -EINVAL;
159 169
@@ -221,8 +231,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
221 dev_info(dev, "Registered %d banks (GPIO(s): %d-%d)\n", 231 dev_info(dev, "Registered %d banks (GPIO(s): %d-%d)\n",
222 priv->num_banks, priv->gpio_base, gpio_base - 1); 232 priv->num_banks, priv->gpio_base, gpio_base - 1);
223 233
224 platform_set_drvdata(pdev, priv);
225
226 return 0; 234 return 0;
227 235
228fail: 236fail:
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index c5e05c82d67c..c246ac3dda7c 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -578,15 +578,13 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
578 writel_relaxed(~0, &g->clr_falling); 578 writel_relaxed(~0, &g->clr_falling);
579 writel_relaxed(~0, &g->clr_rising); 579 writel_relaxed(~0, &g->clr_rising);
580 580
581 /* set up all irqs in this bank */
582 irq_set_chained_handler(bank_irq, gpio_irq_handler);
583
584 /* 581 /*
585 * Each chip handles 32 gpios, and each irq bank consists of 16 582 * Each chip handles 32 gpios, and each irq bank consists of 16
586 * gpio irqs. Pass the irq bank's corresponding controller to 583 * gpio irqs. Pass the irq bank's corresponding controller to
587 * the chained irq handler. 584 * the chained irq handler.
588 */ 585 */
589 irq_set_handler_data(bank_irq, &chips[gpio / 32]); 586 irq_set_chained_handler_and_data(bank_irq, gpio_irq_handler,
587 &chips[gpio / 32]);
590 588
591 binten |= BIT(bank); 589 binten |= BIT(bank);
592 } 590 }
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index aed4ca9338bc..7d3c90e9da71 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -603,6 +603,7 @@ static int max732x_setup_gpio(struct max732x_chip *chip,
603 gc->base = gpio_start; 603 gc->base = gpio_start;
604 gc->ngpio = port; 604 gc->ngpio = port;
605 gc->label = chip->client->name; 605 gc->label = chip->client->name;
606 gc->dev = &chip->client->dev;
606 gc->owner = THIS_MODULE; 607 gc->owner = THIS_MODULE;
607 608
608 return port; 609 return port;
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b0c57d505be7..61a731ff9a07 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -500,8 +500,10 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
500 500
501 spin_lock_irqsave(&bank->lock, flags); 501 spin_lock_irqsave(&bank->lock, flags);
502 retval = omap_set_gpio_triggering(bank, offset, type); 502 retval = omap_set_gpio_triggering(bank, offset, type);
503 if (retval) 503 if (retval) {
504 spin_unlock_irqrestore(&bank->lock, flags);
504 goto error; 505 goto error;
506 }
505 omap_gpio_init_irq(bank, offset); 507 omap_gpio_init_irq(bank, offset);
506 if (!omap_gpio_is_input(bank, offset)) { 508 if (!omap_gpio_is_input(bank, offset)) {
507 spin_unlock_irqrestore(&bank->lock, flags); 509 spin_unlock_irqrestore(&bank->lock, flags);
@@ -1185,6 +1187,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
1185 bank->irq = res->start; 1187 bank->irq = res->start;
1186 bank->dev = dev; 1188 bank->dev = dev;
1187 bank->chip.dev = dev; 1189 bank->chip.dev = dev;
1190 bank->chip.owner = THIS_MODULE;
1188 bank->dbck_flag = pdata->dbck_flag; 1191 bank->dbck_flag = pdata->dbck_flag;
1189 bank->stride = pdata->bank_stride; 1192 bank->stride = pdata->bank_stride;
1190 bank->width = pdata->bank_width; 1193 bank->width = pdata->bank_width;
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d233eb3b8132..50caeb1ee350 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -570,6 +570,10 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
570 "could not connect irqchip to gpiochip\n"); 570 "could not connect irqchip to gpiochip\n");
571 return ret; 571 return ret;
572 } 572 }
573
574 gpiochip_set_chained_irqchip(&chip->gpio_chip,
575 &pca953x_irq_chip,
576 client->irq, NULL);
573 } 577 }
574 578
575 return 0; 579 return 0;
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 77fe5d3cb105..d5284dfe01fe 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -220,9 +220,9 @@ static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc)
220 if (!chip->gpio_width[1]) 220 if (!chip->gpio_width[1])
221 return; 221 return;
222 222
223 xgpio_writereg(mm_gc->regs + XGPIO_DATA_OFFSET + XGPIO_TRI_OFFSET, 223 xgpio_writereg(mm_gc->regs + XGPIO_DATA_OFFSET + XGPIO_CHANNEL_OFFSET,
224 chip->gpio_state[1]); 224 chip->gpio_state[1]);
225 xgpio_writereg(mm_gc->regs + XGPIO_TRI_OFFSET + XGPIO_TRI_OFFSET, 225 xgpio_writereg(mm_gc->regs + XGPIO_TRI_OFFSET + XGPIO_CHANNEL_OFFSET,
226 chip->gpio_dir[1]); 226 chip->gpio_dir[1]);
227} 227}
228 228
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 2e87c4b8da26..a78882389836 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -757,6 +757,7 @@ static int zynq_gpio_remove(struct platform_device *pdev)
757 gpiochip_remove(&gpio->chip); 757 gpiochip_remove(&gpio->chip);
758 clk_disable_unprepare(gpio->clk); 758 clk_disable_unprepare(gpio->clk);
759 device_set_wakeup_capable(&pdev->dev, 0); 759 device_set_wakeup_capable(&pdev->dev, 0);
760 pm_runtime_disable(&pdev->dev);
760 return 0; 761 return 0;
761} 762}
762 763
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index d63135bf29c0..1f040d85ac47 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -669,6 +669,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
669static int amdgpu_cs_dependencies(struct amdgpu_device *adev, 669static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
670 struct amdgpu_cs_parser *p) 670 struct amdgpu_cs_parser *p)
671{ 671{
672 struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
672 struct amdgpu_ib *ib; 673 struct amdgpu_ib *ib;
673 int i, j, r; 674 int i, j, r;
674 675
@@ -694,6 +695,7 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
694 for (j = 0; j < num_deps; ++j) { 695 for (j = 0; j < num_deps; ++j) {
695 struct amdgpu_fence *fence; 696 struct amdgpu_fence *fence;
696 struct amdgpu_ring *ring; 697 struct amdgpu_ring *ring;
698 struct amdgpu_ctx *ctx;
697 699
698 r = amdgpu_cs_get_ring(adev, deps[j].ip_type, 700 r = amdgpu_cs_get_ring(adev, deps[j].ip_type,
699 deps[j].ip_instance, 701 deps[j].ip_instance,
@@ -701,14 +703,21 @@ static int amdgpu_cs_dependencies(struct amdgpu_device *adev,
701 if (r) 703 if (r)
702 return r; 704 return r;
703 705
706 ctx = amdgpu_ctx_get(fpriv, deps[j].ctx_id);
707 if (ctx == NULL)
708 return -EINVAL;
709
704 r = amdgpu_fence_recreate(ring, p->filp, 710 r = amdgpu_fence_recreate(ring, p->filp,
705 deps[j].handle, 711 deps[j].handle,
706 &fence); 712 &fence);
707 if (r) 713 if (r) {
714 amdgpu_ctx_put(ctx);
708 return r; 715 return r;
716 }
709 717
710 amdgpu_sync_fence(&ib->sync, fence); 718 amdgpu_sync_fence(&ib->sync, fence);
711 amdgpu_fence_unref(&fence); 719 amdgpu_fence_unref(&fence);
720 amdgpu_ctx_put(ctx);
712 } 721 }
713 } 722 }
714 723
@@ -808,12 +817,16 @@ int amdgpu_cs_wait_ioctl(struct drm_device *dev, void *data,
808 817
809 r = amdgpu_cs_get_ring(adev, wait->in.ip_type, wait->in.ip_instance, 818 r = amdgpu_cs_get_ring(adev, wait->in.ip_type, wait->in.ip_instance,
810 wait->in.ring, &ring); 819 wait->in.ring, &ring);
811 if (r) 820 if (r) {
821 amdgpu_ctx_put(ctx);
812 return r; 822 return r;
823 }
813 824
814 r = amdgpu_fence_recreate(ring, filp, wait->in.handle, &fence); 825 r = amdgpu_fence_recreate(ring, filp, wait->in.handle, &fence);
815 if (r) 826 if (r) {
827 amdgpu_ctx_put(ctx);
816 return r; 828 return r;
829 }
817 830
818 r = fence_wait_timeout(&fence->base, true, timeout); 831 r = fence_wait_timeout(&fence->base, true, timeout);
819 amdgpu_fence_unref(&fence); 832 amdgpu_fence_unref(&fence);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index ba46be361c9b..d79009b65867 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1207,10 +1207,15 @@ static int amdgpu_early_init(struct amdgpu_device *adev)
1207 } else { 1207 } else {
1208 if (adev->ip_blocks[i].funcs->early_init) { 1208 if (adev->ip_blocks[i].funcs->early_init) {
1209 r = adev->ip_blocks[i].funcs->early_init((void *)adev); 1209 r = adev->ip_blocks[i].funcs->early_init((void *)adev);
1210 if (r) 1210 if (r == -ENOENT)
1211 adev->ip_block_enabled[i] = false;
1212 else if (r)
1211 return r; 1213 return r;
1214 else
1215 adev->ip_block_enabled[i] = true;
1216 } else {
1217 adev->ip_block_enabled[i] = true;
1212 } 1218 }
1213 adev->ip_block_enabled[i] = true;
1214 } 1219 }
1215 } 1220 }
1216 1221
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
index f75a31df30bd..1a2d419cbf16 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
@@ -1679,25 +1679,31 @@ static int cz_dpm_unforce_dpm_levels(struct amdgpu_device *adev)
1679 if (ret) 1679 if (ret)
1680 return ret; 1680 return ret;
1681 1681
1682 DRM_INFO("DPM unforce state min=%d, max=%d.\n", 1682 DRM_DEBUG("DPM unforce state min=%d, max=%d.\n",
1683 pi->sclk_dpm.soft_min_clk, 1683 pi->sclk_dpm.soft_min_clk,
1684 pi->sclk_dpm.soft_max_clk); 1684 pi->sclk_dpm.soft_max_clk);
1685 1685
1686 return 0; 1686 return 0;
1687} 1687}
1688 1688
1689static int cz_dpm_force_dpm_level(struct amdgpu_device *adev, 1689static int cz_dpm_force_dpm_level(struct amdgpu_device *adev,
1690 enum amdgpu_dpm_forced_level level) 1690 enum amdgpu_dpm_forced_level level)
1691{ 1691{
1692 int ret = 0; 1692 int ret = 0;
1693 1693
1694 switch (level) { 1694 switch (level) {
1695 case AMDGPU_DPM_FORCED_LEVEL_HIGH: 1695 case AMDGPU_DPM_FORCED_LEVEL_HIGH:
1696 ret = cz_dpm_unforce_dpm_levels(adev);
1697 if (ret)
1698 return ret;
1696 ret = cz_dpm_force_highest(adev); 1699 ret = cz_dpm_force_highest(adev);
1697 if (ret) 1700 if (ret)
1698 return ret; 1701 return ret;
1699 break; 1702 break;
1700 case AMDGPU_DPM_FORCED_LEVEL_LOW: 1703 case AMDGPU_DPM_FORCED_LEVEL_LOW:
1704 ret = cz_dpm_unforce_dpm_levels(adev);
1705 if (ret)
1706 return ret;
1701 ret = cz_dpm_force_lowest(adev); 1707 ret = cz_dpm_force_lowest(adev);
1702 if (ret) 1708 if (ret)
1703 return ret; 1709 return ret;
@@ -1711,6 +1717,8 @@ static int cz_dpm_force_dpm_level(struct amdgpu_device *adev,
1711 break; 1717 break;
1712 } 1718 }
1713 1719
1720 adev->pm.dpm.forced_level = level;
1721
1714 return ret; 1722 return ret;
1715} 1723}
1716 1724
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 08387dfd98a7..cc050a329c49 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -2566,6 +2566,7 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2566 struct drm_device *dev = crtc->dev; 2566 struct drm_device *dev = crtc->dev;
2567 struct amdgpu_device *adev = dev->dev_private; 2567 struct amdgpu_device *adev = dev->dev_private;
2568 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2568 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
2569 unsigned type;
2569 2570
2570 switch (mode) { 2571 switch (mode) {
2571 case DRM_MODE_DPMS_ON: 2572 case DRM_MODE_DPMS_ON:
@@ -2574,6 +2575,9 @@ static void dce_v8_0_crtc_dpms(struct drm_crtc *crtc, int mode)
2574 dce_v8_0_vga_enable(crtc, true); 2575 dce_v8_0_vga_enable(crtc, true);
2575 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE); 2576 amdgpu_atombios_crtc_blank(crtc, ATOM_DISABLE);
2576 dce_v8_0_vga_enable(crtc, false); 2577 dce_v8_0_vga_enable(crtc, false);
2578 /* Make sure VBLANK interrupt is still enabled */
2579 type = amdgpu_crtc_idx_to_irq_type(adev, amdgpu_crtc->crtc_id);
2580 amdgpu_irq_update(adev, &adev->crtc_irq, type);
2577 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id); 2581 drm_vblank_post_modeset(dev, amdgpu_crtc->crtc_id);
2578 dce_v8_0_crtc_load_lut(crtc); 2582 dce_v8_0_crtc_load_lut(crtc);
2579 break; 2583 break;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 7b683fb2173c..1c7c992dea37 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1813,10 +1813,7 @@ static u32 gfx_v8_0_get_rb_disabled(struct amdgpu_device *adev,
1813 u32 data, mask; 1813 u32 data, mask;
1814 1814
1815 data = RREG32(mmCC_RB_BACKEND_DISABLE); 1815 data = RREG32(mmCC_RB_BACKEND_DISABLE);
1816 if (data & 1) 1816 data &= CC_RB_BACKEND_DISABLE__BACKEND_DISABLE_MASK;
1817 data &= CC_RB_BACKEND_DISABLE__BACKEND_DISABLE_MASK;
1818 else
1819 data = 0;
1820 1817
1821 data |= RREG32(mmGC_USER_RB_BACKEND_DISABLE); 1818 data |= RREG32(mmGC_USER_RB_BACKEND_DISABLE);
1822 1819
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index fa5a4448531d..68552da40287 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -122,6 +122,32 @@ static void vi_smc_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
122 spin_unlock_irqrestore(&adev->smc_idx_lock, flags); 122 spin_unlock_irqrestore(&adev->smc_idx_lock, flags);
123} 123}
124 124
125/* smu_8_0_d.h */
126#define mmMP0PUB_IND_INDEX 0x180
127#define mmMP0PUB_IND_DATA 0x181
128
129static u32 cz_smc_rreg(struct amdgpu_device *adev, u32 reg)
130{
131 unsigned long flags;
132 u32 r;
133
134 spin_lock_irqsave(&adev->smc_idx_lock, flags);
135 WREG32(mmMP0PUB_IND_INDEX, (reg));
136 r = RREG32(mmMP0PUB_IND_DATA);
137 spin_unlock_irqrestore(&adev->smc_idx_lock, flags);
138 return r;
139}
140
141static void cz_smc_wreg(struct amdgpu_device *adev, u32 reg, u32 v)
142{
143 unsigned long flags;
144
145 spin_lock_irqsave(&adev->smc_idx_lock, flags);
146 WREG32(mmMP0PUB_IND_INDEX, (reg));
147 WREG32(mmMP0PUB_IND_DATA, (v));
148 spin_unlock_irqrestore(&adev->smc_idx_lock, flags);
149}
150
125static u32 vi_uvd_ctx_rreg(struct amdgpu_device *adev, u32 reg) 151static u32 vi_uvd_ctx_rreg(struct amdgpu_device *adev, u32 reg)
126{ 152{
127 unsigned long flags; 153 unsigned long flags;
@@ -1222,8 +1248,13 @@ static int vi_common_early_init(void *handle)
1222 bool smc_enabled = false; 1248 bool smc_enabled = false;
1223 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1249 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1224 1250
1225 adev->smc_rreg = &vi_smc_rreg; 1251 if (adev->flags & AMDGPU_IS_APU) {
1226 adev->smc_wreg = &vi_smc_wreg; 1252 adev->smc_rreg = &cz_smc_rreg;
1253 adev->smc_wreg = &cz_smc_wreg;
1254 } else {
1255 adev->smc_rreg = &vi_smc_rreg;
1256 adev->smc_wreg = &vi_smc_wreg;
1257 }
1227 adev->pcie_rreg = &vi_pcie_rreg; 1258 adev->pcie_rreg = &vi_pcie_rreg;
1228 adev->pcie_wreg = &vi_pcie_wreg; 1259 adev->pcie_wreg = &vi_pcie_wreg;
1229 adev->uvd_ctx_rreg = &vi_uvd_ctx_rreg; 1260 adev->uvd_ctx_rreg = &vi_uvd_ctx_rreg;
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c
index 42d2ffa08716..01ffe9bffe38 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -531,8 +531,6 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
531 531
532 drm_crtc_vblank_off(crtc); 532 drm_crtc_vblank_off(crtc);
533 533
534 crtc->mode = *adj;
535
536 val = dcrtc->dumb_ctrl & ~CFG_DUMB_ENA; 534 val = dcrtc->dumb_ctrl & ~CFG_DUMB_ENA;
537 if (val != dcrtc->dumb_ctrl) { 535 if (val != dcrtc->dumb_ctrl) {
538 dcrtc->dumb_ctrl = val; 536 dcrtc->dumb_ctrl = val;
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c
index 580e10acaa3a..60a688ef81c7 100644
--- a/drivers/gpu/drm/armada/armada_gem.c
+++ b/drivers/gpu/drm/armada/armada_gem.c
@@ -69,8 +69,9 @@ void armada_gem_free_object(struct drm_gem_object *obj)
69 69
70 if (dobj->obj.import_attach) { 70 if (dobj->obj.import_attach) {
71 /* We only ever display imported data */ 71 /* We only ever display imported data */
72 dma_buf_unmap_attachment(dobj->obj.import_attach, dobj->sgt, 72 if (dobj->sgt)
73 DMA_TO_DEVICE); 73 dma_buf_unmap_attachment(dobj->obj.import_attach,
74 dobj->sgt, DMA_TO_DEVICE);
74 drm_prime_gem_destroy(&dobj->obj, NULL); 75 drm_prime_gem_destroy(&dobj->obj, NULL);
75 } 76 }
76 77
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index c5b06fdb459c..e939faba7fcc 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -7,6 +7,7 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 */ 8 */
9#include <drm/drmP.h> 9#include <drm/drmP.h>
10#include <drm/drm_plane_helper.h>
10#include "armada_crtc.h" 11#include "armada_crtc.h"
11#include "armada_drm.h" 12#include "armada_drm.h"
12#include "armada_fb.h" 13#include "armada_fb.h"
@@ -85,16 +86,8 @@ static void armada_plane_vbl(struct armada_crtc *dcrtc, void *data)
85 86
86 if (fb) 87 if (fb)
87 armada_drm_queue_unref_work(dcrtc->crtc.dev, fb); 88 armada_drm_queue_unref_work(dcrtc->crtc.dev, fb);
88}
89 89
90static unsigned armada_limit(int start, unsigned size, unsigned max) 90 wake_up(&dplane->vbl.wait);
91{
92 int end = start + size;
93 if (end < 0)
94 return 0;
95 if (start < 0)
96 start = 0;
97 return (unsigned)end > max ? max - start : end - start;
98} 91}
99 92
100static int 93static int
@@ -105,26 +98,39 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
105{ 98{
106 struct armada_plane *dplane = drm_to_armada_plane(plane); 99 struct armada_plane *dplane = drm_to_armada_plane(plane);
107 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); 100 struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
101 struct drm_rect src = {
102 .x1 = src_x,
103 .y1 = src_y,
104 .x2 = src_x + src_w,
105 .y2 = src_y + src_h,
106 };
107 struct drm_rect dest = {
108 .x1 = crtc_x,
109 .y1 = crtc_y,
110 .x2 = crtc_x + crtc_w,
111 .y2 = crtc_y + crtc_h,
112 };
113 const struct drm_rect clip = {
114 .x2 = crtc->mode.hdisplay,
115 .y2 = crtc->mode.vdisplay,
116 };
108 uint32_t val, ctrl0; 117 uint32_t val, ctrl0;
109 unsigned idx = 0; 118 unsigned idx = 0;
119 bool visible;
110 int ret; 120 int ret;
111 121
112 crtc_w = armada_limit(crtc_x, crtc_w, dcrtc->crtc.mode.hdisplay); 122 ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
113 crtc_h = armada_limit(crtc_y, crtc_h, dcrtc->crtc.mode.vdisplay); 123 0, INT_MAX, true, false, &visible);
124 if (ret)
125 return ret;
126
114 ctrl0 = CFG_DMA_FMT(drm_fb_to_armada_fb(fb)->fmt) | 127 ctrl0 = CFG_DMA_FMT(drm_fb_to_armada_fb(fb)->fmt) |
115 CFG_DMA_MOD(drm_fb_to_armada_fb(fb)->mod) | 128 CFG_DMA_MOD(drm_fb_to_armada_fb(fb)->mod) |
116 CFG_CBSH_ENA | CFG_DMA_HSMOOTH | CFG_DMA_ENA; 129 CFG_CBSH_ENA | CFG_DMA_HSMOOTH | CFG_DMA_ENA;
117 130
118 /* Does the position/size result in nothing to display? */ 131 /* Does the position/size result in nothing to display? */
119 if (crtc_w == 0 || crtc_h == 0) { 132 if (!visible)
120 ctrl0 &= ~CFG_DMA_ENA; 133 ctrl0 &= ~CFG_DMA_ENA;
121 }
122
123 /*
124 * FIXME: if the starting point is off screen, we need to
125 * adjust src_x, src_y, src_w, src_h appropriately, and
126 * according to the scale.
127 */
128 134
129 if (!dcrtc->plane) { 135 if (!dcrtc->plane) {
130 dcrtc->plane = plane; 136 dcrtc->plane = plane;
@@ -134,15 +140,19 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
134 /* FIXME: overlay on an interlaced display */ 140 /* FIXME: overlay on an interlaced display */
135 /* Just updating the position/size? */ 141 /* Just updating the position/size? */
136 if (plane->fb == fb && dplane->ctrl0 == ctrl0) { 142 if (plane->fb == fb && dplane->ctrl0 == ctrl0) {
137 val = (src_h & 0xffff0000) | src_w >> 16; 143 val = (drm_rect_height(&src) & 0xffff0000) |
144 drm_rect_width(&src) >> 16;
138 dplane->src_hw = val; 145 dplane->src_hw = val;
139 writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_HPXL_VLN); 146 writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_HPXL_VLN);
140 val = crtc_h << 16 | crtc_w; 147
148 val = drm_rect_height(&dest) << 16 | drm_rect_width(&dest);
141 dplane->dst_hw = val; 149 dplane->dst_hw = val;
142 writel_relaxed(val, dcrtc->base + LCD_SPU_DZM_HPXL_VLN); 150 writel_relaxed(val, dcrtc->base + LCD_SPU_DZM_HPXL_VLN);
143 val = crtc_y << 16 | crtc_x; 151
152 val = dest.y1 << 16 | dest.x1;
144 dplane->dst_yx = val; 153 dplane->dst_yx = val;
145 writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_OVSA_HPXL_VLN); 154 writel_relaxed(val, dcrtc->base + LCD_SPU_DMA_OVSA_HPXL_VLN);
155
146 return 0; 156 return 0;
147 } else if (~dplane->ctrl0 & ctrl0 & CFG_DMA_ENA) { 157 } else if (~dplane->ctrl0 & ctrl0 & CFG_DMA_ENA) {
148 /* Power up the Y/U/V FIFOs on ENA 0->1 transitions */ 158 /* Power up the Y/U/V FIFOs on ENA 0->1 transitions */
@@ -150,15 +160,14 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
150 dcrtc->base + LCD_SPU_SRAM_PARA1); 160 dcrtc->base + LCD_SPU_SRAM_PARA1);
151 } 161 }
152 162
153 ret = wait_event_timeout(dplane->vbl.wait, 163 wait_event_timeout(dplane->vbl.wait,
154 list_empty(&dplane->vbl.update.node), 164 list_empty(&dplane->vbl.update.node),
155 HZ/25); 165 HZ/25);
156 if (ret < 0)
157 return ret;
158 166
159 if (plane->fb != fb) { 167 if (plane->fb != fb) {
160 struct armada_gem_object *obj = drm_fb_obj(fb); 168 struct armada_gem_object *obj = drm_fb_obj(fb);
161 uint32_t sy, su, sv; 169 uint32_t addr[3], pixel_format;
170 int i, num_planes, hsub;
162 171
163 /* 172 /*
164 * Take a reference on the new framebuffer - we want to 173 * Take a reference on the new framebuffer - we want to
@@ -178,26 +187,39 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
178 older_fb); 187 older_fb);
179 } 188 }
180 189
181 src_y >>= 16; 190 src_y = src.y1 >> 16;
182 src_x >>= 16; 191 src_x = src.x1 >> 16;
183 sy = obj->dev_addr + fb->offsets[0] + src_y * fb->pitches[0] +
184 src_x * fb->bits_per_pixel / 8;
185 su = obj->dev_addr + fb->offsets[1] + src_y * fb->pitches[1] +
186 src_x;
187 sv = obj->dev_addr + fb->offsets[2] + src_y * fb->pitches[2] +
188 src_x;
189 192
190 armada_reg_queue_set(dplane->vbl.regs, idx, sy, 193 pixel_format = fb->pixel_format;
194 hsub = drm_format_horz_chroma_subsampling(pixel_format);
195 num_planes = drm_format_num_planes(pixel_format);
196
197 /*
198 * Annoyingly, shifting a YUYV-format image by one pixel
199 * causes the U/V planes to toggle. Toggle the UV swap.
200 * (Unfortunately, this causes momentary colour flickering.)
201 */
202 if (src_x & (hsub - 1) && num_planes == 1)
203 ctrl0 ^= CFG_DMA_MOD(CFG_SWAPUV);
204
205 for (i = 0; i < num_planes; i++)
206 addr[i] = obj->dev_addr + fb->offsets[i] +
207 src_y * fb->pitches[i] +
208 src_x * drm_format_plane_cpp(pixel_format, i);
209 for (; i < ARRAY_SIZE(addr); i++)
210 addr[i] = 0;
211
212 armada_reg_queue_set(dplane->vbl.regs, idx, addr[0],
191 LCD_SPU_DMA_START_ADDR_Y0); 213 LCD_SPU_DMA_START_ADDR_Y0);
192 armada_reg_queue_set(dplane->vbl.regs, idx, su, 214 armada_reg_queue_set(dplane->vbl.regs, idx, addr[1],
193 LCD_SPU_DMA_START_ADDR_U0); 215 LCD_SPU_DMA_START_ADDR_U0);
194 armada_reg_queue_set(dplane->vbl.regs, idx, sv, 216 armada_reg_queue_set(dplane->vbl.regs, idx, addr[2],
195 LCD_SPU_DMA_START_ADDR_V0); 217 LCD_SPU_DMA_START_ADDR_V0);
196 armada_reg_queue_set(dplane->vbl.regs, idx, sy, 218 armada_reg_queue_set(dplane->vbl.regs, idx, addr[0],
197 LCD_SPU_DMA_START_ADDR_Y1); 219 LCD_SPU_DMA_START_ADDR_Y1);
198 armada_reg_queue_set(dplane->vbl.regs, idx, su, 220 armada_reg_queue_set(dplane->vbl.regs, idx, addr[1],
199 LCD_SPU_DMA_START_ADDR_U1); 221 LCD_SPU_DMA_START_ADDR_U1);
200 armada_reg_queue_set(dplane->vbl.regs, idx, sv, 222 armada_reg_queue_set(dplane->vbl.regs, idx, addr[2],
201 LCD_SPU_DMA_START_ADDR_V1); 223 LCD_SPU_DMA_START_ADDR_V1);
202 224
203 val = fb->pitches[0] << 16 | fb->pitches[0]; 225 val = fb->pitches[0] << 16 | fb->pitches[0];
@@ -208,24 +230,27 @@ armada_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
208 LCD_SPU_DMA_PITCH_UV); 230 LCD_SPU_DMA_PITCH_UV);
209 } 231 }
210 232
211 val = (src_h & 0xffff0000) | src_w >> 16; 233 val = (drm_rect_height(&src) & 0xffff0000) | drm_rect_width(&src) >> 16;
212 if (dplane->src_hw != val) { 234 if (dplane->src_hw != val) {
213 dplane->src_hw = val; 235 dplane->src_hw = val;
214 armada_reg_queue_set(dplane->vbl.regs, idx, val, 236 armada_reg_queue_set(dplane->vbl.regs, idx, val,
215 LCD_SPU_DMA_HPXL_VLN); 237 LCD_SPU_DMA_HPXL_VLN);
216 } 238 }
217 val = crtc_h << 16 | crtc_w; 239
240 val = drm_rect_height(&dest) << 16 | drm_rect_width(&dest);
218 if (dplane->dst_hw != val) { 241 if (dplane->dst_hw != val) {
219 dplane->dst_hw = val; 242 dplane->dst_hw = val;
220 armada_reg_queue_set(dplane->vbl.regs, idx, val, 243 armada_reg_queue_set(dplane->vbl.regs, idx, val,
221 LCD_SPU_DZM_HPXL_VLN); 244 LCD_SPU_DZM_HPXL_VLN);
222 } 245 }
223 val = crtc_y << 16 | crtc_x; 246
247 val = dest.y1 << 16 | dest.x1;
224 if (dplane->dst_yx != val) { 248 if (dplane->dst_yx != val) {
225 dplane->dst_yx = val; 249 dplane->dst_yx = val;
226 armada_reg_queue_set(dplane->vbl.regs, idx, val, 250 armada_reg_queue_set(dplane->vbl.regs, idx, val,
227 LCD_SPU_DMA_OVSA_HPXL_VLN); 251 LCD_SPU_DMA_OVSA_HPXL_VLN);
228 } 252 }
253
229 if (dplane->ctrl0 != ctrl0) { 254 if (dplane->ctrl0 != ctrl0) {
230 dplane->ctrl0 = ctrl0; 255 dplane->ctrl0 = ctrl0;
231 armada_reg_queue_mod(dplane->vbl.regs, idx, ctrl0, 256 armada_reg_queue_mod(dplane->vbl.regs, idx, ctrl0,
@@ -279,7 +304,11 @@ static int armada_plane_disable(struct drm_plane *plane)
279 304
280static void armada_plane_destroy(struct drm_plane *plane) 305static void armada_plane_destroy(struct drm_plane *plane)
281{ 306{
282 kfree(plane); 307 struct armada_plane *dplane = drm_to_armada_plane(plane);
308
309 drm_plane_cleanup(plane);
310
311 kfree(dplane);
283} 312}
284 313
285static int armada_plane_set_property(struct drm_plane *plane, 314static int armada_plane_set_property(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b9ba06176eb1..357bd04a173b 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2706,8 +2706,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
2706 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 2706 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2707 return -EINVAL; 2707 return -EINVAL;
2708 2708
2709 /* For some reason crtc x/y offsets are signed internally. */ 2709 /*
2710 if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX) 2710 * Universal plane src offsets are only 16.16, prevent havoc for
2711 * drivers using universal plane code internally.
2712 */
2713 if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000)
2711 return -ERANGE; 2714 return -ERANGE;
2712 2715
2713 drm_modeset_lock_all(dev); 2716 drm_modeset_lock_all(dev);
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index aa8bbb460c57..9cfcd0aef0df 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -70,6 +70,8 @@
70 70
71#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t) 71#define DRM_IOCTL_WAIT_VBLANK32 DRM_IOWR(0x3a, drm_wait_vblank32_t)
72 72
73#define DRM_IOCTL_MODE_ADDFB232 DRM_IOWR(0xb8, drm_mode_fb_cmd232_t)
74
73typedef struct drm_version_32 { 75typedef struct drm_version_32 {
74 int version_major; /**< Major version */ 76 int version_major; /**< Major version */
75 int version_minor; /**< Minor version */ 77 int version_minor; /**< Minor version */
@@ -1016,6 +1018,63 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
1016 return 0; 1018 return 0;
1017} 1019}
1018 1020
1021typedef struct drm_mode_fb_cmd232 {
1022 u32 fb_id;
1023 u32 width;
1024 u32 height;
1025 u32 pixel_format;
1026 u32 flags;
1027 u32 handles[4];
1028 u32 pitches[4];
1029 u32 offsets[4];
1030 u64 modifier[4];
1031} __attribute__((packed)) drm_mode_fb_cmd232_t;
1032
1033static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd,
1034 unsigned long arg)
1035{
1036 struct drm_mode_fb_cmd232 __user *argp = (void __user *)arg;
1037 struct drm_mode_fb_cmd232 req32;
1038 struct drm_mode_fb_cmd2 __user *req64;
1039 int i;
1040 int err;
1041
1042 if (copy_from_user(&req32, argp, sizeof(req32)))
1043 return -EFAULT;
1044
1045 req64 = compat_alloc_user_space(sizeof(*req64));
1046
1047 if (!access_ok(VERIFY_WRITE, req64, sizeof(*req64))
1048 || __put_user(req32.width, &req64->width)
1049 || __put_user(req32.height, &req64->height)
1050 || __put_user(req32.pixel_format, &req64->pixel_format)
1051 || __put_user(req32.flags, &req64->flags))
1052 return -EFAULT;
1053
1054 for (i = 0; i < 4; i++) {
1055 if (__put_user(req32.handles[i], &req64->handles[i]))
1056 return -EFAULT;
1057 if (__put_user(req32.pitches[i], &req64->pitches[i]))
1058 return -EFAULT;
1059 if (__put_user(req32.offsets[i], &req64->offsets[i]))
1060 return -EFAULT;
1061 if (__put_user(req32.modifier[i], &req64->modifier[i]))
1062 return -EFAULT;
1063 }
1064
1065 err = drm_ioctl(file, DRM_IOCTL_MODE_ADDFB2, (unsigned long)req64);
1066 if (err)
1067 return err;
1068
1069 if (__get_user(req32.fb_id, &req64->fb_id))
1070 return -EFAULT;
1071
1072 if (copy_to_user(argp, &req32, sizeof(req32)))
1073 return -EFAULT;
1074
1075 return 0;
1076}
1077
1019static drm_ioctl_compat_t *drm_compat_ioctls[] = { 1078static drm_ioctl_compat_t *drm_compat_ioctls[] = {
1020 [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, 1079 [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version,
1021 [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)] = compat_drm_getunique, 1080 [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)] = compat_drm_getunique,
@@ -1048,6 +1107,7 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = {
1048 [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, 1107 [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw,
1049#endif 1108#endif
1050 [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, 1109 [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank,
1110 [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2,
1051}; 1111};
1052 1112
1053/** 1113/**
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 542fac628b28..5f27290201e0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -826,6 +826,7 @@ struct intel_context {
826 struct kref ref; 826 struct kref ref;
827 int user_handle; 827 int user_handle;
828 uint8_t remap_slice; 828 uint8_t remap_slice;
829 struct drm_i915_private *i915;
829 struct drm_i915_file_private *file_priv; 830 struct drm_i915_file_private *file_priv;
830 struct i915_ctx_hang_stats hang_stats; 831 struct i915_ctx_hang_stats hang_stats;
831 struct i915_hw_ppgtt *ppgtt; 832 struct i915_hw_ppgtt *ppgtt;
@@ -2036,8 +2037,6 @@ struct drm_i915_gem_object {
2036 unsigned int cache_level:3; 2037 unsigned int cache_level:3;
2037 unsigned int cache_dirty:1; 2038 unsigned int cache_dirty:1;
2038 2039
2039 unsigned int has_dma_mapping:1;
2040
2041 unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; 2040 unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS;
2042 2041
2043 unsigned int pin_display; 2042 unsigned int pin_display;
@@ -3116,7 +3115,8 @@ void i915_debugfs_cleanup(struct drm_minor *minor);
3116int i915_debugfs_connector_add(struct drm_connector *connector); 3115int i915_debugfs_connector_add(struct drm_connector *connector);
3117void intel_display_crc_init(struct drm_device *dev); 3116void intel_display_crc_init(struct drm_device *dev);
3118#else 3117#else
3119static inline int i915_debugfs_connector_add(struct drm_connector *connector) {} 3118static inline int i915_debugfs_connector_add(struct drm_connector *connector)
3119{ return 0; }
3120static inline void intel_display_crc_init(struct drm_device *dev) {} 3120static inline void intel_display_crc_init(struct drm_device *dev) {}
3121#endif 3121#endif
3122 3122
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 248fd1ac7b3a..52b446b27b4d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -213,7 +213,6 @@ i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj)
213 sg_dma_len(sg) = obj->base.size; 213 sg_dma_len(sg) = obj->base.size;
214 214
215 obj->pages = st; 215 obj->pages = st;
216 obj->has_dma_mapping = true;
217 return 0; 216 return 0;
218} 217}
219 218
@@ -265,8 +264,6 @@ i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj)
265 264
266 sg_free_table(obj->pages); 265 sg_free_table(obj->pages);
267 kfree(obj->pages); 266 kfree(obj->pages);
268
269 obj->has_dma_mapping = false;
270} 267}
271 268
272static void 269static void
@@ -2139,6 +2136,8 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
2139 obj->base.read_domains = obj->base.write_domain = I915_GEM_DOMAIN_CPU; 2136 obj->base.read_domains = obj->base.write_domain = I915_GEM_DOMAIN_CPU;
2140 } 2137 }
2141 2138
2139 i915_gem_gtt_finish_object(obj);
2140
2142 if (i915_gem_object_needs_bit17_swizzle(obj)) 2141 if (i915_gem_object_needs_bit17_swizzle(obj))
2143 i915_gem_object_save_bit_17_swizzle(obj); 2142 i915_gem_object_save_bit_17_swizzle(obj);
2144 2143
@@ -2199,6 +2198,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
2199 struct sg_page_iter sg_iter; 2198 struct sg_page_iter sg_iter;
2200 struct page *page; 2199 struct page *page;
2201 unsigned long last_pfn = 0; /* suppress gcc warning */ 2200 unsigned long last_pfn = 0; /* suppress gcc warning */
2201 int ret;
2202 gfp_t gfp; 2202 gfp_t gfp;
2203 2203
2204 /* Assert that the object is not currently in any GPU domain. As it 2204 /* Assert that the object is not currently in any GPU domain. As it
@@ -2246,8 +2246,10 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
2246 */ 2246 */
2247 i915_gem_shrink_all(dev_priv); 2247 i915_gem_shrink_all(dev_priv);
2248 page = shmem_read_mapping_page(mapping, i); 2248 page = shmem_read_mapping_page(mapping, i);
2249 if (IS_ERR(page)) 2249 if (IS_ERR(page)) {
2250 ret = PTR_ERR(page);
2250 goto err_pages; 2251 goto err_pages;
2252 }
2251 } 2253 }
2252#ifdef CONFIG_SWIOTLB 2254#ifdef CONFIG_SWIOTLB
2253 if (swiotlb_nr_tbl()) { 2255 if (swiotlb_nr_tbl()) {
@@ -2276,6 +2278,10 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
2276 sg_mark_end(sg); 2278 sg_mark_end(sg);
2277 obj->pages = st; 2279 obj->pages = st;
2278 2280
2281 ret = i915_gem_gtt_prepare_object(obj);
2282 if (ret)
2283 goto err_pages;
2284
2279 if (i915_gem_object_needs_bit17_swizzle(obj)) 2285 if (i915_gem_object_needs_bit17_swizzle(obj))
2280 i915_gem_object_do_bit_17_swizzle(obj); 2286 i915_gem_object_do_bit_17_swizzle(obj);
2281 2287
@@ -2300,10 +2306,10 @@ err_pages:
2300 * space and so want to translate the error from shmemfs back to our 2306 * space and so want to translate the error from shmemfs back to our
2301 * usual understanding of ENOMEM. 2307 * usual understanding of ENOMEM.
2302 */ 2308 */
2303 if (PTR_ERR(page) == -ENOSPC) 2309 if (ret == -ENOSPC)
2304 return -ENOMEM; 2310 ret = -ENOMEM;
2305 else 2311
2306 return PTR_ERR(page); 2312 return ret;
2307} 2313}
2308 2314
2309/* Ensure that the associated pages are gathered from the backing storage 2315/* Ensure that the associated pages are gathered from the backing storage
@@ -2542,6 +2548,7 @@ int __i915_add_request(struct intel_engine_cs *ring,
2542 } 2548 }
2543 2549
2544 request->emitted_jiffies = jiffies; 2550 request->emitted_jiffies = jiffies;
2551 ring->last_submitted_seqno = request->seqno;
2545 list_add_tail(&request->list, &ring->request_list); 2552 list_add_tail(&request->list, &ring->request_list);
2546 request->file_priv = NULL; 2553 request->file_priv = NULL;
2547 2554
@@ -3247,10 +3254,8 @@ int i915_vma_unbind(struct i915_vma *vma)
3247 3254
3248 /* Since the unbound list is global, only move to that list if 3255 /* Since the unbound list is global, only move to that list if
3249 * no more VMAs exist. */ 3256 * no more VMAs exist. */
3250 if (list_empty(&obj->vma_list)) { 3257 if (list_empty(&obj->vma_list))
3251 i915_gem_gtt_finish_object(obj);
3252 list_move_tail(&obj->global_list, &dev_priv->mm.unbound_list); 3258 list_move_tail(&obj->global_list, &dev_priv->mm.unbound_list);
3253 }
3254 3259
3255 /* And finally now the object is completely decoupled from this vma, 3260 /* And finally now the object is completely decoupled from this vma,
3256 * we can drop its hold on the backing storage and allow it to be 3261 * we can drop its hold on the backing storage and allow it to be
@@ -3768,22 +3773,16 @@ search_free:
3768 goto err_remove_node; 3773 goto err_remove_node;
3769 } 3774 }
3770 3775
3771 ret = i915_gem_gtt_prepare_object(obj);
3772 if (ret)
3773 goto err_remove_node;
3774
3775 trace_i915_vma_bind(vma, flags); 3776 trace_i915_vma_bind(vma, flags);
3776 ret = i915_vma_bind(vma, obj->cache_level, flags); 3777 ret = i915_vma_bind(vma, obj->cache_level, flags);
3777 if (ret) 3778 if (ret)
3778 goto err_finish_gtt; 3779 goto err_remove_node;
3779 3780
3780 list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); 3781 list_move_tail(&obj->global_list, &dev_priv->mm.bound_list);
3781 list_add_tail(&vma->mm_list, &vm->inactive_list); 3782 list_add_tail(&vma->mm_list, &vm->inactive_list);
3782 3783
3783 return vma; 3784 return vma;
3784 3785
3785err_finish_gtt:
3786 i915_gem_gtt_finish_object(obj);
3787err_remove_node: 3786err_remove_node:
3788 drm_mm_remove_node(&vma->node); 3787 drm_mm_remove_node(&vma->node);
3789err_free_vma: 3788err_free_vma:
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index d65cbe6afb92..48afa777e94a 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -135,8 +135,7 @@ static int get_context_size(struct drm_device *dev)
135 135
136void i915_gem_context_free(struct kref *ctx_ref) 136void i915_gem_context_free(struct kref *ctx_ref)
137{ 137{
138 struct intel_context *ctx = container_of(ctx_ref, 138 struct intel_context *ctx = container_of(ctx_ref, typeof(*ctx), ref);
139 typeof(*ctx), ref);
140 139
141 trace_i915_context_free(ctx); 140 trace_i915_context_free(ctx);
142 141
@@ -195,6 +194,7 @@ __create_hw_context(struct drm_device *dev,
195 194
196 kref_init(&ctx->ref); 195 kref_init(&ctx->ref);
197 list_add_tail(&ctx->link, &dev_priv->context_list); 196 list_add_tail(&ctx->link, &dev_priv->context_list);
197 ctx->i915 = dev_priv;
198 198
199 if (dev_priv->hw_context_size) { 199 if (dev_priv->hw_context_size) {
200 struct drm_i915_gem_object *obj = 200 struct drm_i915_gem_object *obj =
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 7998da27c500..e9c2bfd85b52 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -256,7 +256,6 @@ static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
256 return PTR_ERR(sg); 256 return PTR_ERR(sg);
257 257
258 obj->pages = sg; 258 obj->pages = sg;
259 obj->has_dma_mapping = true;
260 return 0; 259 return 0;
261} 260}
262 261
@@ -264,7 +263,6 @@ static void i915_gem_object_put_pages_dmabuf(struct drm_i915_gem_object *obj)
264{ 263{
265 dma_buf_unmap_attachment(obj->base.import_attach, 264 dma_buf_unmap_attachment(obj->base.import_attach,
266 obj->pages, DMA_BIDIRECTIONAL); 265 obj->pages, DMA_BIDIRECTIONAL);
267 obj->has_dma_mapping = false;
268} 266}
269 267
270static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_ops = { 268static const struct drm_i915_gem_object_ops i915_gem_object_dmabuf_ops = {
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index dcc6a88c560e..56b52a4767d4 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1723,9 +1723,6 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
1723 1723
1724int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) 1724int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj)
1725{ 1725{
1726 if (obj->has_dma_mapping)
1727 return 0;
1728
1729 if (!dma_map_sg(&obj->base.dev->pdev->dev, 1726 if (!dma_map_sg(&obj->base.dev->pdev->dev,
1730 obj->pages->sgl, obj->pages->nents, 1727 obj->pages->sgl, obj->pages->nents,
1731 PCI_DMA_BIDIRECTIONAL)) 1728 PCI_DMA_BIDIRECTIONAL))
@@ -1972,10 +1969,8 @@ void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj)
1972 1969
1973 interruptible = do_idling(dev_priv); 1970 interruptible = do_idling(dev_priv);
1974 1971
1975 if (!obj->has_dma_mapping) 1972 dma_unmap_sg(&dev->pdev->dev, obj->pages->sgl, obj->pages->nents,
1976 dma_unmap_sg(&dev->pdev->dev, 1973 PCI_DMA_BIDIRECTIONAL);
1977 obj->pages->sgl, obj->pages->nents,
1978 PCI_DMA_BIDIRECTIONAL);
1979 1974
1980 undo_idling(dev_priv, interruptible); 1975 undo_idling(dev_priv, interruptible);
1981} 1976}
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 348ed5abcdbf..8b5b784c62fe 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -416,7 +416,6 @@ _i915_gem_object_create_stolen(struct drm_device *dev,
416 if (obj->pages == NULL) 416 if (obj->pages == NULL)
417 goto cleanup; 417 goto cleanup;
418 418
419 obj->has_dma_mapping = true;
420 i915_gem_object_pin_pages(obj); 419 i915_gem_object_pin_pages(obj);
421 obj->stolen = stolen; 420 obj->stolen = stolen;
422 421
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index d61e74a08f82..633bd1fcab69 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -183,18 +183,8 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
183 if (IS_GEN4(dev)) { 183 if (IS_GEN4(dev)) {
184 uint32_t ddc2 = I915_READ(DCC2); 184 uint32_t ddc2 = I915_READ(DCC2);
185 185
186 if (!(ddc2 & DCC2_MODIFIED_ENHANCED_DISABLE)) { 186 if (!(ddc2 & DCC2_MODIFIED_ENHANCED_DISABLE))
187 /* Since the swizzling may vary within an
188 * object, we have no idea what the swizzling
189 * is for any page in particular. Thus we
190 * cannot migrate tiled pages using the GPU,
191 * nor can we tell userspace what the exact
192 * swizzling is for any object.
193 */
194 dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES; 187 dev_priv->quirks |= QUIRK_PIN_SWIZZLED_PAGES;
195 swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
196 swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
197 }
198 } 188 }
199 189
200 if (dcc == 0xffffffff) { 190 if (dcc == 0xffffffff) {
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 1f4e5a32a16e..8fd431bcdfd3 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -545,6 +545,26 @@ err:
545 return ret; 545 return ret;
546} 546}
547 547
548static int
549__i915_gem_userptr_set_pages(struct drm_i915_gem_object *obj,
550 struct page **pvec, int num_pages)
551{
552 int ret;
553
554 ret = st_set_pages(&obj->pages, pvec, num_pages);
555 if (ret)
556 return ret;
557
558 ret = i915_gem_gtt_prepare_object(obj);
559 if (ret) {
560 sg_free_table(obj->pages);
561 kfree(obj->pages);
562 obj->pages = NULL;
563 }
564
565 return ret;
566}
567
548static void 568static void
549__i915_gem_userptr_get_pages_worker(struct work_struct *_work) 569__i915_gem_userptr_get_pages_worker(struct work_struct *_work)
550{ 570{
@@ -584,9 +604,12 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
584 if (obj->userptr.work != &work->work) { 604 if (obj->userptr.work != &work->work) {
585 ret = 0; 605 ret = 0;
586 } else if (pinned == num_pages) { 606 } else if (pinned == num_pages) {
587 ret = st_set_pages(&obj->pages, pvec, num_pages); 607 ret = __i915_gem_userptr_set_pages(obj, pvec, num_pages);
588 if (ret == 0) { 608 if (ret == 0) {
589 list_add_tail(&obj->global_list, &to_i915(dev)->mm.unbound_list); 609 list_add_tail(&obj->global_list, &to_i915(dev)->mm.unbound_list);
610 obj->get_page.sg = obj->pages->sgl;
611 obj->get_page.last = 0;
612
590 pinned = 0; 613 pinned = 0;
591 } 614 }
592 } 615 }
@@ -693,7 +716,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
693 } 716 }
694 } 717 }
695 } else { 718 } else {
696 ret = st_set_pages(&obj->pages, pvec, num_pages); 719 ret = __i915_gem_userptr_set_pages(obj, pvec, num_pages);
697 if (ret == 0) { 720 if (ret == 0) {
698 obj->userptr.work = NULL; 721 obj->userptr.work = NULL;
699 pinned = 0; 722 pinned = 0;
@@ -715,6 +738,8 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj)
715 if (obj->madv != I915_MADV_WILLNEED) 738 if (obj->madv != I915_MADV_WILLNEED)
716 obj->dirty = 0; 739 obj->dirty = 0;
717 740
741 i915_gem_gtt_finish_object(obj);
742
718 for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) { 743 for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) {
719 struct page *page = sg_page_iter_page(&sg_iter); 744 struct page *page = sg_page_iter_page(&sg_iter);
720 745
diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c
index 176de6322e4d..23aa04cded6b 100644
--- a/drivers/gpu/drm/i915/i915_ioc32.c
+++ b/drivers/gpu/drm/i915/i915_ioc32.c
@@ -204,7 +204,7 @@ long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
204 drm_ioctl_compat_t *fn = NULL; 204 drm_ioctl_compat_t *fn = NULL;
205 int ret; 205 int ret;
206 206
207 if (nr < DRM_COMMAND_BASE) 207 if (nr < DRM_COMMAND_BASE || nr >= DRM_COMMAND_END)
208 return drm_compat_ioctl(filp, cmd, arg); 208 return drm_compat_ioctl(filp, cmd, arg);
209 209
210 if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(i915_compat_ioctls)) 210 if (nr < DRM_COMMAND_BASE + ARRAY_SIZE(i915_compat_ioctls))
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index e6bb72dca3ff..984e2fe6688c 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2706,18 +2706,11 @@ static void gen8_disable_vblank(struct drm_device *dev, int pipe)
2706 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2706 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2707} 2707}
2708 2708
2709static struct drm_i915_gem_request *
2710ring_last_request(struct intel_engine_cs *ring)
2711{
2712 return list_entry(ring->request_list.prev,
2713 struct drm_i915_gem_request, list);
2714}
2715
2716static bool 2709static bool
2717ring_idle(struct intel_engine_cs *ring) 2710ring_idle(struct intel_engine_cs *ring, u32 seqno)
2718{ 2711{
2719 return (list_empty(&ring->request_list) || 2712 return (list_empty(&ring->request_list) ||
2720 i915_gem_request_completed(ring_last_request(ring), false)); 2713 i915_seqno_passed(seqno, ring->last_submitted_seqno));
2721} 2714}
2722 2715
2723static bool 2716static bool
@@ -2939,7 +2932,7 @@ static void i915_hangcheck_elapsed(struct work_struct *work)
2939 acthd = intel_ring_get_active_head(ring); 2932 acthd = intel_ring_get_active_head(ring);
2940 2933
2941 if (ring->hangcheck.seqno == seqno) { 2934 if (ring->hangcheck.seqno == seqno) {
2942 if (ring_idle(ring)) { 2935 if (ring_idle(ring, seqno)) {
2943 ring->hangcheck.action = HANGCHECK_IDLE; 2936 ring->hangcheck.action = HANGCHECK_IDLE;
2944 2937
2945 if (waitqueue_active(&ring->irq_queue)) { 2938 if (waitqueue_active(&ring->irq_queue)) {
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index 497cba5deb1e..849a2590e010 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -727,7 +727,7 @@ DECLARE_EVENT_CLASS(i915_context,
727 TP_fast_assign( 727 TP_fast_assign(
728 __entry->ctx = ctx; 728 __entry->ctx = ctx;
729 __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL; 729 __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL;
730 __entry->dev = ctx->file_priv->dev_priv->dev->primary->index; 730 __entry->dev = ctx->i915->dev->primary->index;
731 ), 731 ),
732 732
733 TP_printk("dev=%u, ctx=%p, ctx_vm=%p", 733 TP_printk("dev=%u, ctx=%p, ctx_vm=%p",
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 647b1404c441..30e0f54ba19d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6315,9 +6315,6 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
6315 struct drm_connector *connector; 6315 struct drm_connector *connector;
6316 struct drm_i915_private *dev_priv = dev->dev_private; 6316 struct drm_i915_private *dev_priv = dev->dev_private;
6317 6317
6318 /* crtc should still be enabled when we disable it. */
6319 WARN_ON(!crtc->state->enable);
6320
6321 intel_crtc_disable_planes(crtc); 6318 intel_crtc_disable_planes(crtc);
6322 dev_priv->display.crtc_disable(crtc); 6319 dev_priv->display.crtc_disable(crtc);
6323 dev_priv->display.off(crtc); 6320 dev_priv->display.off(crtc);
@@ -12591,7 +12588,8 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
12591 continue; 12588 continue;
12592 12589
12593 if (!crtc_state->enable) { 12590 if (!crtc_state->enable) {
12594 intel_crtc_disable(crtc); 12591 if (crtc->state->enable)
12592 intel_crtc_disable(crtc);
12595 } else if (crtc->state->enable) { 12593 } else if (crtc->state->enable) {
12596 intel_crtc_disable_planes(crtc); 12594 intel_crtc_disable_planes(crtc);
12597 dev_priv->display.crtc_disable(crtc); 12595 dev_priv->display.crtc_disable(crtc);
@@ -13276,7 +13274,7 @@ intel_check_primary_plane(struct drm_plane *plane,
13276 if (ret) 13274 if (ret)
13277 return ret; 13275 return ret;
13278 13276
13279 if (intel_crtc->active) { 13277 if (crtc_state ? crtc_state->base.active : intel_crtc->active) {
13280 struct intel_plane_state *old_state = 13278 struct intel_plane_state *old_state =
13281 to_intel_plane_state(plane->state); 13279 to_intel_plane_state(plane->state);
13282 13280
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index e539314ae87e..4be66f60504d 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -275,6 +275,13 @@ struct intel_engine_cs {
275 * Do we have some not yet emitted requests outstanding? 275 * Do we have some not yet emitted requests outstanding?
276 */ 276 */
277 struct drm_i915_gem_request *outstanding_lazy_request; 277 struct drm_i915_gem_request *outstanding_lazy_request;
278 /**
279 * Seqno of request most recently submitted to request_list.
280 * Used exclusively by hang checker to avoid grabbing lock while
281 * inspecting request list.
282 */
283 u32 last_submitted_seqno;
284
278 bool gpu_caches_dirty; 285 bool gpu_caches_dirty;
279 286
280 wait_queue_head_t irq_queue; 287 wait_queue_head_t irq_queue;
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 214eceefc981..e671ad369416 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -301,7 +301,7 @@ static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
301 301
302 switch (tve->mode) { 302 switch (tve->mode) {
303 case TVE_MODE_VGA: 303 case TVE_MODE_VGA:
304 imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_YUV8_1X24, 304 imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_GBR888_1X24,
305 tve->hsync_pin, tve->vsync_pin); 305 tve->hsync_pin, tve->vsync_pin);
306 break; 306 break;
307 case TVE_MODE_TVOUT: 307 case TVE_MODE_TVOUT:
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 74a9ce40ddc4..b4deb9cf9d71 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -21,6 +21,7 @@
21#include <drm/drm_panel.h> 21#include <drm/drm_panel.h>
22#include <linux/videodev2.h> 22#include <linux/videodev2.h>
23#include <video/of_display_timing.h> 23#include <video/of_display_timing.h>
24#include <linux/of_graph.h>
24 25
25#include "imx-drm.h" 26#include "imx-drm.h"
26 27
@@ -208,7 +209,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
208{ 209{
209 struct drm_device *drm = data; 210 struct drm_device *drm = data;
210 struct device_node *np = dev->of_node; 211 struct device_node *np = dev->of_node;
211 struct device_node *panel_node; 212 struct device_node *port;
212 const u8 *edidp; 213 const u8 *edidp;
213 struct imx_parallel_display *imxpd; 214 struct imx_parallel_display *imxpd;
214 int ret; 215 int ret;
@@ -234,11 +235,19 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
234 imxpd->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI; 235 imxpd->bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI;
235 } 236 }
236 237
237 panel_node = of_parse_phandle(np, "fsl,panel", 0); 238 /* port@1 is the output port */
238 if (panel_node) { 239 port = of_graph_get_port_by_id(np, 1);
239 imxpd->panel = of_drm_find_panel(panel_node); 240 if (port) {
240 if (!imxpd->panel) 241 struct device_node *endpoint, *remote;
241 return -EPROBE_DEFER; 242
243 endpoint = of_get_child_by_name(port, "endpoint");
244 if (endpoint) {
245 remote = of_graph_get_remote_port_parent(endpoint);
246 if (remote)
247 imxpd->panel = of_drm_find_panel(remote);
248 if (!imxpd->panel)
249 return -EPROBE_DEFER;
250 }
242 } 251 }
243 252
244 imxpd->dev = dev; 253 imxpd->dev = dev;
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 8730562323a8..4a09947be244 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -5818,7 +5818,7 @@ int ci_dpm_init(struct radeon_device *rdev)
5818 tmp |= DPM_ENABLED; 5818 tmp |= DPM_ENABLED;
5819 break; 5819 break;
5820 default: 5820 default:
5821 DRM_ERROR("Invalid PCC GPIO: %u!\n", gpio.shift); 5821 DRM_DEBUG("Invalid PCC GPIO: %u!\n", gpio.shift);
5822 break; 5822 break;
5823 } 5823 }
5824 WREG32_SMC(CNB_PWRMGT_CNTL, tmp); 5824 WREG32_SMC(CNB_PWRMGT_CNTL, tmp);
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 5450fa95a47e..c4777c8d0312 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -260,8 +260,10 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
260 } 260 }
261 } 261 }
262 } 262 }
263 mb(); 263 if (rdev->gart.ptr) {
264 radeon_gart_tlb_flush(rdev); 264 mb();
265 radeon_gart_tlb_flush(rdev);
266 }
265} 267}
266 268
267/** 269/**
@@ -306,8 +308,10 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
306 page_base += RADEON_GPU_PAGE_SIZE; 308 page_base += RADEON_GPU_PAGE_SIZE;
307 } 309 }
308 } 310 }
309 mb(); 311 if (rdev->gart.ptr) {
310 radeon_gart_tlb_flush(rdev); 312 mb();
313 radeon_gart_tlb_flush(rdev);
314 }
311 return 0; 315 return 0;
312} 316}
313 317
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 013ec7106e55..3dcc5733ff69 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -36,6 +36,7 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
36 if (robj) { 36 if (robj) {
37 if (robj->gem_base.import_attach) 37 if (robj->gem_base.import_attach)
38 drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg); 38 drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
39 radeon_mn_unregister(robj);
39 radeon_bo_unref(&robj); 40 radeon_bo_unref(&robj);
40 } 41 }
41} 42}
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 318165d4855c..676362769b8d 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -75,7 +75,6 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo)
75 bo = container_of(tbo, struct radeon_bo, tbo); 75 bo = container_of(tbo, struct radeon_bo, tbo);
76 76
77 radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1); 77 radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1);
78 radeon_mn_unregister(bo);
79 78
80 mutex_lock(&bo->rdev->gem.mutex); 79 mutex_lock(&bo->rdev->gem.mutex);
81 list_del_init(&bo->list); 80 list_del_init(&bo->list);
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 1dbdf3230dae..787cd8fd897f 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2926,6 +2926,7 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
2926 /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */ 2926 /* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */
2927 { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 }, 2927 { PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 }, 2928 { PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
2929 { PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
2929 { 0, 0, 0, 0 }, 2930 { 0, 0, 0, 0 },
2930}; 2931};
2931 2932
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 01b558fe3695..9a0c2911272a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -555,7 +555,6 @@ static struct platform_driver rockchip_drm_platform_driver = {
555 .probe = rockchip_drm_platform_probe, 555 .probe = rockchip_drm_platform_probe,
556 .remove = rockchip_drm_platform_remove, 556 .remove = rockchip_drm_platform_remove,
557 .driver = { 557 .driver = {
558 .owner = THIS_MODULE,
559 .name = "rockchip-drm", 558 .name = "rockchip-drm",
560 .of_match_table = rockchip_drm_dt_ids, 559 .of_match_table = rockchip_drm_dt_ids,
561 .pm = &rockchip_drm_pm_ops, 560 .pm = &rockchip_drm_pm_ops,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index 77d52893d40f..002645bb5bbf 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -162,7 +162,8 @@ static void rockchip_drm_output_poll_changed(struct drm_device *dev)
162 struct rockchip_drm_private *private = dev->dev_private; 162 struct rockchip_drm_private *private = dev->dev_private;
163 struct drm_fb_helper *fb_helper = &private->fbdev_helper; 163 struct drm_fb_helper *fb_helper = &private->fbdev_helper;
164 164
165 drm_fb_helper_hotplug_event(fb_helper); 165 if (fb_helper)
166 drm_fb_helper_hotplug_event(fb_helper);
166} 167}
167 168
168static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = { 169static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = {
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index eb2282cc4a56..eba5f8a52fbd 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -54,55 +54,56 @@ static void rockchip_gem_free_buf(struct rockchip_gem_object *rk_obj)
54 &rk_obj->dma_attrs); 54 &rk_obj->dma_attrs);
55} 55}
56 56
57int rockchip_gem_mmap_buf(struct drm_gem_object *obj, 57static int rockchip_drm_gem_object_mmap(struct drm_gem_object *obj,
58 struct vm_area_struct *vma) 58 struct vm_area_struct *vma)
59
59{ 60{
61 int ret;
60 struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj); 62 struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj);
61 struct drm_device *drm = obj->dev; 63 struct drm_device *drm = obj->dev;
62 unsigned long vm_size;
63 64
64 vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; 65 /*
65 vm_size = vma->vm_end - vma->vm_start; 66 * dma_alloc_attrs() allocated a struct page table for rk_obj, so clear
66 67 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
67 if (vm_size > obj->size) 68 */
68 return -EINVAL; 69 vma->vm_flags &= ~VM_PFNMAP;
69 70
70 return dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr, 71 ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr,
71 obj->size, &rk_obj->dma_attrs); 72 obj->size, &rk_obj->dma_attrs);
73 if (ret)
74 drm_gem_vm_close(vma);
75
76 return ret;
72} 77}
73 78
74/* drm driver mmap file operations */ 79int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
75int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma) 80 struct vm_area_struct *vma)
76{ 81{
77 struct drm_file *priv = filp->private_data; 82 struct drm_device *drm = obj->dev;
78 struct drm_device *dev = priv->minor->dev;
79 struct drm_gem_object *obj;
80 struct drm_vma_offset_node *node;
81 int ret; 83 int ret;
82 84
83 if (drm_device_is_unplugged(dev)) 85 mutex_lock(&drm->struct_mutex);
84 return -ENODEV; 86 ret = drm_gem_mmap_obj(obj, obj->size, vma);
87 mutex_unlock(&drm->struct_mutex);
88 if (ret)
89 return ret;
85 90
86 mutex_lock(&dev->struct_mutex); 91 return rockchip_drm_gem_object_mmap(obj, vma);
92}
87 93
88 node = drm_vma_offset_exact_lookup(dev->vma_offset_manager, 94/* drm driver mmap file operations */
89 vma->vm_pgoff, 95int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma)
90 vma_pages(vma)); 96{
91 if (!node) { 97 struct drm_gem_object *obj;
92 mutex_unlock(&dev->struct_mutex); 98 int ret;
93 DRM_ERROR("failed to find vma node.\n");
94 return -EINVAL;
95 } else if (!drm_vma_node_is_allowed(node, filp)) {
96 mutex_unlock(&dev->struct_mutex);
97 return -EACCES;
98 }
99 99
100 obj = container_of(node, struct drm_gem_object, vma_node); 100 ret = drm_gem_mmap(filp, vma);
101 ret = rockchip_gem_mmap_buf(obj, vma); 101 if (ret)
102 return ret;
102 103
103 mutex_unlock(&dev->struct_mutex); 104 obj = vma->vm_private_data;
104 105
105 return ret; 106 return rockchip_drm_gem_object_mmap(obj, vma);
106} 107}
107 108
108struct rockchip_gem_object * 109struct rockchip_gem_object *
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index dc65161d7cad..34b78e736532 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -170,6 +170,7 @@ struct vop_win_phy {
170 170
171 struct vop_reg enable; 171 struct vop_reg enable;
172 struct vop_reg format; 172 struct vop_reg format;
173 struct vop_reg rb_swap;
173 struct vop_reg act_info; 174 struct vop_reg act_info;
174 struct vop_reg dsp_info; 175 struct vop_reg dsp_info;
175 struct vop_reg dsp_st; 176 struct vop_reg dsp_st;
@@ -199,8 +200,12 @@ struct vop_data {
199static const uint32_t formats_01[] = { 200static const uint32_t formats_01[] = {
200 DRM_FORMAT_XRGB8888, 201 DRM_FORMAT_XRGB8888,
201 DRM_FORMAT_ARGB8888, 202 DRM_FORMAT_ARGB8888,
203 DRM_FORMAT_XBGR8888,
204 DRM_FORMAT_ABGR8888,
202 DRM_FORMAT_RGB888, 205 DRM_FORMAT_RGB888,
206 DRM_FORMAT_BGR888,
203 DRM_FORMAT_RGB565, 207 DRM_FORMAT_RGB565,
208 DRM_FORMAT_BGR565,
204 DRM_FORMAT_NV12, 209 DRM_FORMAT_NV12,
205 DRM_FORMAT_NV16, 210 DRM_FORMAT_NV16,
206 DRM_FORMAT_NV24, 211 DRM_FORMAT_NV24,
@@ -209,8 +214,12 @@ static const uint32_t formats_01[] = {
209static const uint32_t formats_234[] = { 214static const uint32_t formats_234[] = {
210 DRM_FORMAT_XRGB8888, 215 DRM_FORMAT_XRGB8888,
211 DRM_FORMAT_ARGB8888, 216 DRM_FORMAT_ARGB8888,
217 DRM_FORMAT_XBGR8888,
218 DRM_FORMAT_ABGR8888,
212 DRM_FORMAT_RGB888, 219 DRM_FORMAT_RGB888,
220 DRM_FORMAT_BGR888,
213 DRM_FORMAT_RGB565, 221 DRM_FORMAT_RGB565,
222 DRM_FORMAT_BGR565,
214}; 223};
215 224
216static const struct vop_win_phy win01_data = { 225static const struct vop_win_phy win01_data = {
@@ -218,6 +227,7 @@ static const struct vop_win_phy win01_data = {
218 .nformats = ARRAY_SIZE(formats_01), 227 .nformats = ARRAY_SIZE(formats_01),
219 .enable = VOP_REG(WIN0_CTRL0, 0x1, 0), 228 .enable = VOP_REG(WIN0_CTRL0, 0x1, 0),
220 .format = VOP_REG(WIN0_CTRL0, 0x7, 1), 229 .format = VOP_REG(WIN0_CTRL0, 0x7, 1),
230 .rb_swap = VOP_REG(WIN0_CTRL0, 0x1, 12),
221 .act_info = VOP_REG(WIN0_ACT_INFO, 0x1fff1fff, 0), 231 .act_info = VOP_REG(WIN0_ACT_INFO, 0x1fff1fff, 0),
222 .dsp_info = VOP_REG(WIN0_DSP_INFO, 0x0fff0fff, 0), 232 .dsp_info = VOP_REG(WIN0_DSP_INFO, 0x0fff0fff, 0),
223 .dsp_st = VOP_REG(WIN0_DSP_ST, 0x1fff1fff, 0), 233 .dsp_st = VOP_REG(WIN0_DSP_ST, 0x1fff1fff, 0),
@@ -234,6 +244,7 @@ static const struct vop_win_phy win23_data = {
234 .nformats = ARRAY_SIZE(formats_234), 244 .nformats = ARRAY_SIZE(formats_234),
235 .enable = VOP_REG(WIN2_CTRL0, 0x1, 0), 245 .enable = VOP_REG(WIN2_CTRL0, 0x1, 0),
236 .format = VOP_REG(WIN2_CTRL0, 0x7, 1), 246 .format = VOP_REG(WIN2_CTRL0, 0x7, 1),
247 .rb_swap = VOP_REG(WIN2_CTRL0, 0x1, 12),
237 .dsp_info = VOP_REG(WIN2_DSP_INFO0, 0x0fff0fff, 0), 248 .dsp_info = VOP_REG(WIN2_DSP_INFO0, 0x0fff0fff, 0),
238 .dsp_st = VOP_REG(WIN2_DSP_ST0, 0x1fff1fff, 0), 249 .dsp_st = VOP_REG(WIN2_DSP_ST0, 0x1fff1fff, 0),
239 .yrgb_mst = VOP_REG(WIN2_MST0, 0xffffffff, 0), 250 .yrgb_mst = VOP_REG(WIN2_MST0, 0xffffffff, 0),
@@ -242,15 +253,6 @@ static const struct vop_win_phy win23_data = {
242 .dst_alpha_ctl = VOP_REG(WIN2_DST_ALPHA_CTRL, 0xff, 0), 253 .dst_alpha_ctl = VOP_REG(WIN2_DST_ALPHA_CTRL, 0xff, 0),
243}; 254};
244 255
245static const struct vop_win_phy cursor_data = {
246 .data_formats = formats_234,
247 .nformats = ARRAY_SIZE(formats_234),
248 .enable = VOP_REG(HWC_CTRL0, 0x1, 0),
249 .format = VOP_REG(HWC_CTRL0, 0x7, 1),
250 .dsp_st = VOP_REG(HWC_DSP_ST, 0x1fff1fff, 0),
251 .yrgb_mst = VOP_REG(HWC_MST, 0xffffffff, 0),
252};
253
254static const struct vop_ctrl ctrl_data = { 256static const struct vop_ctrl ctrl_data = {
255 .standby = VOP_REG(SYS_CTRL, 0x1, 22), 257 .standby = VOP_REG(SYS_CTRL, 0x1, 22),
256 .gate_en = VOP_REG(SYS_CTRL, 0x1, 23), 258 .gate_en = VOP_REG(SYS_CTRL, 0x1, 23),
@@ -282,14 +284,14 @@ static const struct vop_reg_data vop_init_reg_table[] = {
282/* 284/*
283 * Note: rk3288 has a dedicated 'cursor' window, however, that window requires 285 * Note: rk3288 has a dedicated 'cursor' window, however, that window requires
284 * special support to get alpha blending working. For now, just use overlay 286 * special support to get alpha blending working. For now, just use overlay
285 * window 1 for the drm cursor. 287 * window 3 for the drm cursor.
288 *
286 */ 289 */
287static const struct vop_win_data rk3288_vop_win_data[] = { 290static const struct vop_win_data rk3288_vop_win_data[] = {
288 { .base = 0x00, .phy = &win01_data, .type = DRM_PLANE_TYPE_PRIMARY }, 291 { .base = 0x00, .phy = &win01_data, .type = DRM_PLANE_TYPE_PRIMARY },
289 { .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_CURSOR }, 292 { .base = 0x40, .phy = &win01_data, .type = DRM_PLANE_TYPE_OVERLAY },
290 { .base = 0x00, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, 293 { .base = 0x00, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY },
291 { .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_OVERLAY }, 294 { .base = 0x50, .phy = &win23_data, .type = DRM_PLANE_TYPE_CURSOR },
292 { .base = 0x00, .phy = &cursor_data, .type = DRM_PLANE_TYPE_OVERLAY },
293}; 295};
294 296
295static const struct vop_data rk3288_vop = { 297static const struct vop_data rk3288_vop = {
@@ -352,15 +354,32 @@ static inline void vop_mask_write_relaxed(struct vop *vop, uint32_t offset,
352 } 354 }
353} 355}
354 356
357static bool has_rb_swapped(uint32_t format)
358{
359 switch (format) {
360 case DRM_FORMAT_XBGR8888:
361 case DRM_FORMAT_ABGR8888:
362 case DRM_FORMAT_BGR888:
363 case DRM_FORMAT_BGR565:
364 return true;
365 default:
366 return false;
367 }
368}
369
355static enum vop_data_format vop_convert_format(uint32_t format) 370static enum vop_data_format vop_convert_format(uint32_t format)
356{ 371{
357 switch (format) { 372 switch (format) {
358 case DRM_FORMAT_XRGB8888: 373 case DRM_FORMAT_XRGB8888:
359 case DRM_FORMAT_ARGB8888: 374 case DRM_FORMAT_ARGB8888:
375 case DRM_FORMAT_XBGR8888:
376 case DRM_FORMAT_ABGR8888:
360 return VOP_FMT_ARGB8888; 377 return VOP_FMT_ARGB8888;
361 case DRM_FORMAT_RGB888: 378 case DRM_FORMAT_RGB888:
379 case DRM_FORMAT_BGR888:
362 return VOP_FMT_RGB888; 380 return VOP_FMT_RGB888;
363 case DRM_FORMAT_RGB565: 381 case DRM_FORMAT_RGB565:
382 case DRM_FORMAT_BGR565:
364 return VOP_FMT_RGB565; 383 return VOP_FMT_RGB565;
365 case DRM_FORMAT_NV12: 384 case DRM_FORMAT_NV12:
366 return VOP_FMT_YUV420SP; 385 return VOP_FMT_YUV420SP;
@@ -378,6 +397,7 @@ static bool is_alpha_support(uint32_t format)
378{ 397{
379 switch (format) { 398 switch (format) {
380 case DRM_FORMAT_ARGB8888: 399 case DRM_FORMAT_ARGB8888:
400 case DRM_FORMAT_ABGR8888:
381 return true; 401 return true;
382 default: 402 default:
383 return false; 403 return false;
@@ -588,6 +608,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
588 enum vop_data_format format; 608 enum vop_data_format format;
589 uint32_t val; 609 uint32_t val;
590 bool is_alpha; 610 bool is_alpha;
611 bool rb_swap;
591 bool visible; 612 bool visible;
592 int ret; 613 int ret;
593 struct drm_rect dest = { 614 struct drm_rect dest = {
@@ -621,6 +642,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
621 return 0; 642 return 0;
622 643
623 is_alpha = is_alpha_support(fb->pixel_format); 644 is_alpha = is_alpha_support(fb->pixel_format);
645 rb_swap = has_rb_swapped(fb->pixel_format);
624 format = vop_convert_format(fb->pixel_format); 646 format = vop_convert_format(fb->pixel_format);
625 if (format < 0) 647 if (format < 0)
626 return format; 648 return format;
@@ -689,6 +711,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
689 val = (dsp_sty - 1) << 16; 711 val = (dsp_sty - 1) << 16;
690 val |= (dsp_stx - 1) & 0xffff; 712 val |= (dsp_stx - 1) & 0xffff;
691 VOP_WIN_SET(vop, win, dsp_st, val); 713 VOP_WIN_SET(vop, win, dsp_st, val);
714 VOP_WIN_SET(vop, win, rb_swap, rb_swap);
692 715
693 if (is_alpha) { 716 if (is_alpha) {
694 VOP_WIN_SET(vop, win, dst_alpha_ctl, 717 VOP_WIN_SET(vop, win, dst_alpha_ctl,
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 3077f1554099..624d941aaad1 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -963,14 +963,13 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
963 } else { 963 } else {
964 pool->npages_free += count; 964 pool->npages_free += count;
965 list_splice(&ttm_dma->pages_list, &pool->free_list); 965 list_splice(&ttm_dma->pages_list, &pool->free_list);
966 npages = count; 966 /*
967 if (pool->npages_free > _manager->options.max_size) { 967 * Wait to have at at least NUM_PAGES_TO_ALLOC number of pages
968 * to free in order to minimize calls to set_memory_wb().
969 */
970 if (pool->npages_free >= (_manager->options.max_size +
971 NUM_PAGES_TO_ALLOC))
968 npages = pool->npages_free - _manager->options.max_size; 972 npages = pool->npages_free - _manager->options.max_size;
969 /* free at least NUM_PAGES_TO_ALLOC number of pages
970 * to reduce calls to set_memory_wb */
971 if (npages < NUM_PAGES_TO_ALLOC)
972 npages = NUM_PAGES_TO_ALLOC;
973 }
974 } 973 }
975 spin_unlock_irqrestore(&pool->lock, irq_flags); 974 spin_unlock_irqrestore(&pool->lock, irq_flags);
976 975
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 6d2f39d36e44..00f2058944e5 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1107,6 +1107,9 @@ static int ipu_irq_init(struct ipu_soc *ipu)
1107 return ret; 1107 return ret;
1108 } 1108 }
1109 1109
1110 for (i = 0; i < IPU_NUM_IRQS; i += 32)
1111 ipu_cm_write(ipu, 0, IPU_INT_CTRL(i / 32));
1112
1110 for (i = 0; i < IPU_NUM_IRQS; i += 32) { 1113 for (i = 0; i < IPU_NUM_IRQS; i += 32) {
1111 gc = irq_get_domain_generic_chip(ipu->domain, i); 1114 gc = irq_get_domain_generic_chip(ipu->domain, i);
1112 gc->reg_base = ipu->cm_reg; 1115 gc->reg_base = ipu->cm_reg;
diff --git a/drivers/iio/accel/bmc150-accel.c b/drivers/iio/accel/bmc150-accel.c
index 4e70f51c2370..cc5a35750b50 100644
--- a/drivers/iio/accel/bmc150-accel.c
+++ b/drivers/iio/accel/bmc150-accel.c
@@ -1464,7 +1464,7 @@ static void bmc150_accel_unregister_triggers(struct bmc150_accel_data *data,
1464{ 1464{
1465 int i; 1465 int i;
1466 1466
1467 for (i = from; i >= 0; i++) { 1467 for (i = from; i >= 0; i--) {
1468 if (data->triggers[i].indio_trig) { 1468 if (data->triggers[i].indio_trig) {
1469 iio_trigger_unregister(data->triggers[i].indio_trig); 1469 iio_trigger_unregister(data->triggers[i].indio_trig);
1470 data->triggers[i].indio_trig = NULL; 1470 data->triggers[i].indio_trig = NULL;
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 7c5565891cb8..eb0cd897714a 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -153,8 +153,7 @@ config DA9150_GPADC
153 153
154config CC10001_ADC 154config CC10001_ADC
155 tristate "Cosmic Circuits 10001 ADC driver" 155 tristate "Cosmic Circuits 10001 ADC driver"
156 depends on HAVE_CLK || REGULATOR 156 depends on HAS_IOMEM && HAVE_CLK && REGULATOR
157 depends on HAS_IOMEM
158 select IIO_BUFFER 157 select IIO_BUFFER
159 select IIO_TRIGGERED_BUFFER 158 select IIO_TRIGGERED_BUFFER
160 help 159 help
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 8a0eb4a04fb5..7b40925dd4ff 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -182,7 +182,7 @@ struct at91_adc_caps {
182 u8 ts_pen_detect_sensitivity; 182 u8 ts_pen_detect_sensitivity;
183 183
184 /* startup time calculate function */ 184 /* startup time calculate function */
185 u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz); 185 u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
186 186
187 u8 num_channels; 187 u8 num_channels;
188 struct at91_adc_reg_desc registers; 188 struct at91_adc_reg_desc registers;
@@ -201,7 +201,7 @@ struct at91_adc_state {
201 u8 num_channels; 201 u8 num_channels;
202 void __iomem *reg_base; 202 void __iomem *reg_base;
203 struct at91_adc_reg_desc *registers; 203 struct at91_adc_reg_desc *registers;
204 u8 startup_time; 204 u32 startup_time;
205 u8 sample_hold_time; 205 u8 sample_hold_time;
206 bool sleep_mode; 206 bool sleep_mode;
207 struct iio_trigger **trig; 207 struct iio_trigger **trig;
@@ -779,7 +779,7 @@ ret:
779 return ret; 779 return ret;
780} 780}
781 781
782static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) 782static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
783{ 783{
784 /* 784 /*
785 * Number of ticks needed to cover the startup time of the ADC 785 * Number of ticks needed to cover the startup time of the ADC
@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
790 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; 790 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
791} 791}
792 792
793static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz) 793static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
794{ 794{
795 /* 795 /*
796 * For sama5d3x and at91sam9x5, the formula changes to: 796 * For sama5d3x and at91sam9x5, the formula changes to:
diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 8d4e019ea4ca..9c311c1e1ac7 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -349,3 +349,7 @@ static struct platform_driver rockchip_saradc_driver = {
349}; 349};
350 350
351module_platform_driver(rockchip_saradc_driver); 351module_platform_driver(rockchip_saradc_driver);
352
353MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
354MODULE_DESCRIPTION("Rockchip SARADC driver");
355MODULE_LICENSE("GPL v2");
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 06f4792240f0..ebe415f10640 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -833,7 +833,8 @@ static int twl4030_madc_probe(struct platform_device *pdev)
833 irq = platform_get_irq(pdev, 0); 833 irq = platform_get_irq(pdev, 0);
834 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, 834 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
835 twl4030_madc_threaded_irq_handler, 835 twl4030_madc_threaded_irq_handler,
836 IRQF_TRIGGER_RISING, "twl4030_madc", madc); 836 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
837 "twl4030_madc", madc);
837 if (ret) { 838 if (ret) {
838 dev_err(&pdev->dev, "could not request irq\n"); 839 dev_err(&pdev->dev, "could not request irq\n");
839 goto err_i2c; 840 goto err_i2c;
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
index 610fc98f88ef..595511022795 100644
--- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
+++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
@@ -36,6 +36,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
36 s32 poll_value = 0; 36 s32 poll_value = 0;
37 37
38 if (state) { 38 if (state) {
39 if (!atomic_read(&st->user_requested_state))
40 return 0;
39 if (sensor_hub_device_open(st->hsdev)) 41 if (sensor_hub_device_open(st->hsdev))
40 return -EIO; 42 return -EIO;
41 43
@@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
52 54
53 poll_value = hid_sensor_read_poll_value(st); 55 poll_value = hid_sensor_read_poll_value(st);
54 } else { 56 } else {
55 if (!atomic_dec_and_test(&st->data_ready)) 57 int val;
58
59 val = atomic_dec_if_positive(&st->data_ready);
60 if (val < 0)
56 return 0; 61 return 0;
62
57 sensor_hub_device_close(st->hsdev); 63 sensor_hub_device_close(st->hsdev);
58 state_val = hid_sensor_get_usage_index(st->hsdev, 64 state_val = hid_sensor_get_usage_index(st->hsdev,
59 st->power_state.report_id, 65 st->power_state.report_id,
@@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state);
92 98
93int hid_sensor_power_state(struct hid_sensor_common *st, bool state) 99int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
94{ 100{
101
95#ifdef CONFIG_PM 102#ifdef CONFIG_PM
96 int ret; 103 int ret;
97 104
105 atomic_set(&st->user_requested_state, state);
98 if (state) 106 if (state)
99 ret = pm_runtime_get_sync(&st->pdev->dev); 107 ret = pm_runtime_get_sync(&st->pdev->dev);
100 else { 108 else {
@@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
109 117
110 return 0; 118 return 0;
111#else 119#else
120 atomic_set(&st->user_requested_state, state);
112 return _hid_sensor_power_state(st, state); 121 return _hid_sensor_power_state(st, state);
113#endif 122#endif
114} 123}
diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
index 61bb9d4239ea..e98428df0d44 100644
--- a/drivers/iio/dac/ad5624r_spi.c
+++ b/drivers/iio/dac/ad5624r_spi.c
@@ -22,7 +22,7 @@
22#include "ad5624r.h" 22#include "ad5624r.h"
23 23
24static int ad5624r_spi_write(struct spi_device *spi, 24static int ad5624r_spi_write(struct spi_device *spi,
25 u8 cmd, u8 addr, u16 val, u8 len) 25 u8 cmd, u8 addr, u16 val, u8 shift)
26{ 26{
27 u32 data; 27 u32 data;
28 u8 msg[3]; 28 u8 msg[3];
@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi,
35 * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, 35 * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits,
36 * for the AD5664R, AD5644R, and AD5624R, respectively. 36 * for the AD5664R, AD5644R, and AD5624R, respectively.
37 */ 37 */
38 data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); 38 data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift);
39 msg[0] = data >> 16; 39 msg[0] = data >> 16;
40 msg[1] = data >> 8; 40 msg[1] = data >> 8;
41 msg[2] = data; 41 msg[2] = data;
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 17d4bb15be4d..65ce86837177 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -431,6 +431,23 @@ static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val)
431 return -EINVAL; 431 return -EINVAL;
432} 432}
433 433
434static int inv_write_raw_get_fmt(struct iio_dev *indio_dev,
435 struct iio_chan_spec const *chan, long mask)
436{
437 switch (mask) {
438 case IIO_CHAN_INFO_SCALE:
439 switch (chan->type) {
440 case IIO_ANGL_VEL:
441 return IIO_VAL_INT_PLUS_NANO;
442 default:
443 return IIO_VAL_INT_PLUS_MICRO;
444 }
445 default:
446 return IIO_VAL_INT_PLUS_MICRO;
447 }
448
449 return -EINVAL;
450}
434static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val) 451static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val)
435{ 452{
436 int result, i; 453 int result, i;
@@ -696,6 +713,7 @@ static const struct iio_info mpu_info = {
696 .driver_module = THIS_MODULE, 713 .driver_module = THIS_MODULE,
697 .read_raw = &inv_mpu6050_read_raw, 714 .read_raw = &inv_mpu6050_read_raw,
698 .write_raw = &inv_mpu6050_write_raw, 715 .write_raw = &inv_mpu6050_write_raw,
716 .write_raw_get_fmt = &inv_write_raw_get_fmt,
699 .attrs = &inv_attribute_group, 717 .attrs = &inv_attribute_group,
700 .validate_trigger = inv_mpu6050_validate_trigger, 718 .validate_trigger = inv_mpu6050_validate_trigger,
701}; 719};
diff --git a/drivers/iio/light/Kconfig b/drivers/iio/light/Kconfig
index e6198b7c9cbf..a5c59251ec0e 100644
--- a/drivers/iio/light/Kconfig
+++ b/drivers/iio/light/Kconfig
@@ -188,6 +188,7 @@ config SENSORS_LM3533
188config LTR501 188config LTR501
189 tristate "LTR-501ALS-01 light sensor" 189 tristate "LTR-501ALS-01 light sensor"
190 depends on I2C 190 depends on I2C
191 select REGMAP_I2C
191 select IIO_BUFFER 192 select IIO_BUFFER
192 select IIO_TRIGGERED_BUFFER 193 select IIO_TRIGGERED_BUFFER
193 help 194 help
@@ -201,6 +202,7 @@ config LTR501
201config STK3310 202config STK3310
202 tristate "STK3310 ALS and proximity sensor" 203 tristate "STK3310 ALS and proximity sensor"
203 depends on I2C 204 depends on I2C
205 select REGMAP_I2C
204 help 206 help
205 Say yes here to get support for the Sensortek STK3310 ambient light 207 Say yes here to get support for the Sensortek STK3310 ambient light
206 and proximity sensor. The STK3311 model is also supported by this 208 and proximity sensor. The STK3311 model is also supported by this
diff --git a/drivers/iio/light/cm3323.c b/drivers/iio/light/cm3323.c
index 869033e48a1f..a1d4905cc9d2 100644
--- a/drivers/iio/light/cm3323.c
+++ b/drivers/iio/light/cm3323.c
@@ -123,7 +123,7 @@ static int cm3323_set_it_bits(struct cm3323_data *data, int val, int val2)
123 for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) { 123 for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) {
124 if (val == cm3323_int_time[i].val && 124 if (val == cm3323_int_time[i].val &&
125 val2 == cm3323_int_time[i].val2) { 125 val2 == cm3323_int_time[i].val2) {
126 reg_conf = data->reg_conf; 126 reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK;
127 reg_conf |= i << CM3323_CONF_IT_SHIFT; 127 reg_conf |= i << CM3323_CONF_IT_SHIFT;
128 128
129 ret = i2c_smbus_write_word_data(data->client, 129 ret = i2c_smbus_write_word_data(data->client,
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 1ef7d3773ab9..b5a0e66b5f28 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1302,7 +1302,7 @@ static int ltr501_init(struct ltr501_data *data)
1302 if (ret < 0) 1302 if (ret < 0)
1303 return ret; 1303 return ret;
1304 1304
1305 data->als_contr = ret | data->chip_info->als_mode_active; 1305 data->als_contr = status | data->chip_info->als_mode_active;
1306 1306
1307 ret = regmap_read(data->regmap, LTR501_PS_CONTR, &status); 1307 ret = regmap_read(data->regmap, LTR501_PS_CONTR, &status);
1308 if (ret < 0) 1308 if (ret < 0)
diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index fee4297d7c8f..c1a218236be5 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -43,7 +43,6 @@
43#define STK3311_CHIP_ID_VAL 0x1D 43#define STK3311_CHIP_ID_VAL 0x1D
44#define STK3310_PSINT_EN 0x01 44#define STK3310_PSINT_EN 0x01
45#define STK3310_PS_MAX_VAL 0xFFFF 45#define STK3310_PS_MAX_VAL 0xFFFF
46#define STK3310_THRESH_MAX 0xFFFF
47 46
48#define STK3310_DRIVER_NAME "stk3310" 47#define STK3310_DRIVER_NAME "stk3310"
49#define STK3310_REGMAP_NAME "stk3310_regmap" 48#define STK3310_REGMAP_NAME "stk3310_regmap"
@@ -84,15 +83,13 @@ static const struct reg_field stk3310_reg_field_flag_psint =
84 REG_FIELD(STK3310_REG_FLAG, 4, 4); 83 REG_FIELD(STK3310_REG_FLAG, 4, 4);
85static const struct reg_field stk3310_reg_field_flag_nf = 84static const struct reg_field stk3310_reg_field_flag_nf =
86 REG_FIELD(STK3310_REG_FLAG, 0, 0); 85 REG_FIELD(STK3310_REG_FLAG, 0, 0);
87/* 86
88 * Maximum PS values with regard to scale. Used to export the 'inverse' 87/* Estimate maximum proximity values with regard to measurement scale. */
89 * PS value (high values for far objects, low values for near objects).
90 */
91static const int stk3310_ps_max[4] = { 88static const int stk3310_ps_max[4] = {
92 STK3310_PS_MAX_VAL / 64, 89 STK3310_PS_MAX_VAL / 640,
93 STK3310_PS_MAX_VAL / 16, 90 STK3310_PS_MAX_VAL / 160,
94 STK3310_PS_MAX_VAL / 4, 91 STK3310_PS_MAX_VAL / 40,
95 STK3310_PS_MAX_VAL, 92 STK3310_PS_MAX_VAL / 10
96}; 93};
97 94
98static const int stk3310_scale_table[][2] = { 95static const int stk3310_scale_table[][2] = {
@@ -128,14 +125,14 @@ static const struct iio_event_spec stk3310_events[] = {
128 /* Proximity event */ 125 /* Proximity event */
129 { 126 {
130 .type = IIO_EV_TYPE_THRESH, 127 .type = IIO_EV_TYPE_THRESH,
131 .dir = IIO_EV_DIR_FALLING, 128 .dir = IIO_EV_DIR_RISING,
132 .mask_separate = BIT(IIO_EV_INFO_VALUE) | 129 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
133 BIT(IIO_EV_INFO_ENABLE), 130 BIT(IIO_EV_INFO_ENABLE),
134 }, 131 },
135 /* Out-of-proximity event */ 132 /* Out-of-proximity event */
136 { 133 {
137 .type = IIO_EV_TYPE_THRESH, 134 .type = IIO_EV_TYPE_THRESH,
138 .dir = IIO_EV_DIR_RISING, 135 .dir = IIO_EV_DIR_FALLING,
139 .mask_separate = BIT(IIO_EV_INFO_VALUE) | 136 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
140 BIT(IIO_EV_INFO_ENABLE), 137 BIT(IIO_EV_INFO_ENABLE),
141 }, 138 },
@@ -205,23 +202,16 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
205 u8 reg; 202 u8 reg;
206 u16 buf; 203 u16 buf;
207 int ret; 204 int ret;
208 unsigned int index;
209 struct stk3310_data *data = iio_priv(indio_dev); 205 struct stk3310_data *data = iio_priv(indio_dev);
210 206
211 if (info != IIO_EV_INFO_VALUE) 207 if (info != IIO_EV_INFO_VALUE)
212 return -EINVAL; 208 return -EINVAL;
213 209
214 /* 210 /* Only proximity interrupts are implemented at the moment. */
215 * Only proximity interrupts are implemented at the moment.
216 * Since we're inverting proximity values, the sensor's 'high'
217 * threshold will become our 'low' threshold, associated with
218 * 'near' events. Similarly, the sensor's 'low' threshold will
219 * be our 'high' threshold, associated with 'far' events.
220 */
221 if (dir == IIO_EV_DIR_RISING) 211 if (dir == IIO_EV_DIR_RISING)
222 reg = STK3310_REG_THDL_PS;
223 else if (dir == IIO_EV_DIR_FALLING)
224 reg = STK3310_REG_THDH_PS; 212 reg = STK3310_REG_THDH_PS;
213 else if (dir == IIO_EV_DIR_FALLING)
214 reg = STK3310_REG_THDL_PS;
225 else 215 else
226 return -EINVAL; 216 return -EINVAL;
227 217
@@ -232,8 +222,7 @@ static int stk3310_read_event(struct iio_dev *indio_dev,
232 dev_err(&data->client->dev, "register read failed\n"); 222 dev_err(&data->client->dev, "register read failed\n");
233 return ret; 223 return ret;
234 } 224 }
235 regmap_field_read(data->reg_ps_gain, &index); 225 *val = swab16(buf);
236 *val = swab16(stk3310_ps_max[index] - buf);
237 226
238 return IIO_VAL_INT; 227 return IIO_VAL_INT;
239} 228}
@@ -257,13 +246,13 @@ static int stk3310_write_event(struct iio_dev *indio_dev,
257 return -EINVAL; 246 return -EINVAL;
258 247
259 if (dir == IIO_EV_DIR_RISING) 248 if (dir == IIO_EV_DIR_RISING)
260 reg = STK3310_REG_THDL_PS;
261 else if (dir == IIO_EV_DIR_FALLING)
262 reg = STK3310_REG_THDH_PS; 249 reg = STK3310_REG_THDH_PS;
250 else if (dir == IIO_EV_DIR_FALLING)
251 reg = STK3310_REG_THDL_PS;
263 else 252 else
264 return -EINVAL; 253 return -EINVAL;
265 254
266 buf = swab16(stk3310_ps_max[index] - val); 255 buf = swab16(val);
267 ret = regmap_bulk_write(data->regmap, reg, &buf, 2); 256 ret = regmap_bulk_write(data->regmap, reg, &buf, 2);
268 if (ret < 0) 257 if (ret < 0)
269 dev_err(&client->dev, "failed to set PS threshold!\n"); 258 dev_err(&client->dev, "failed to set PS threshold!\n");
@@ -334,14 +323,6 @@ static int stk3310_read_raw(struct iio_dev *indio_dev,
334 return ret; 323 return ret;
335 } 324 }
336 *val = swab16(buf); 325 *val = swab16(buf);
337 if (chan->type == IIO_PROXIMITY) {
338 /*
339 * Invert the proximity data so we return low values
340 * for close objects and high values for far ones.
341 */
342 regmap_field_read(data->reg_ps_gain, &index);
343 *val = stk3310_ps_max[index] - *val;
344 }
345 mutex_unlock(&data->lock); 326 mutex_unlock(&data->lock);
346 return IIO_VAL_INT; 327 return IIO_VAL_INT;
347 case IIO_CHAN_INFO_INT_TIME: 328 case IIO_CHAN_INFO_INT_TIME:
@@ -581,8 +562,8 @@ static irqreturn_t stk3310_irq_event_handler(int irq, void *private)
581 } 562 }
582 event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, 563 event = IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1,
583 IIO_EV_TYPE_THRESH, 564 IIO_EV_TYPE_THRESH,
584 (dir ? IIO_EV_DIR_RISING : 565 (dir ? IIO_EV_DIR_FALLING :
585 IIO_EV_DIR_FALLING)); 566 IIO_EV_DIR_RISING));
586 iio_push_event(indio_dev, event, data->timestamp); 567 iio_push_event(indio_dev, event, data->timestamp);
587 568
588 /* Reset the interrupt flag */ 569 /* Reset the interrupt flag */
diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c
index 71c2bde275aa..f8b1df018abe 100644
--- a/drivers/iio/light/tcs3414.c
+++ b/drivers/iio/light/tcs3414.c
@@ -185,7 +185,7 @@ static int tcs3414_write_raw(struct iio_dev *indio_dev,
185 if (val != 0) 185 if (val != 0)
186 return -EINVAL; 186 return -EINVAL;
187 for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) { 187 for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) {
188 if (val == tcs3414_times[i] * 1000) { 188 if (val2 == tcs3414_times[i] * 1000) {
189 data->timing &= ~TCS3414_INTEG_MASK; 189 data->timing &= ~TCS3414_INTEG_MASK;
190 data->timing |= i; 190 data->timing |= i;
191 return i2c_smbus_write_byte_data( 191 return i2c_smbus_write_byte_data(
diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c
index 7a2ea71c659a..d927397a6ef7 100644
--- a/drivers/iio/magnetometer/mmc35240.c
+++ b/drivers/iio/magnetometer/mmc35240.c
@@ -84,10 +84,10 @@
84#define MMC35240_OTP_START_ADDR 0x1B 84#define MMC35240_OTP_START_ADDR 0x1B
85 85
86enum mmc35240_resolution { 86enum mmc35240_resolution {
87 MMC35240_16_BITS_SLOW = 0, /* 100 Hz */ 87 MMC35240_16_BITS_SLOW = 0, /* 7.92 ms */
88 MMC35240_16_BITS_FAST, /* 200 Hz */ 88 MMC35240_16_BITS_FAST, /* 4.08 ms */
89 MMC35240_14_BITS, /* 333 Hz */ 89 MMC35240_14_BITS, /* 2.16 ms */
90 MMC35240_12_BITS, /* 666 Hz */ 90 MMC35240_12_BITS, /* 1.20 ms */
91}; 91};
92 92
93enum mmc35240_axis { 93enum mmc35240_axis {
@@ -100,22 +100,22 @@ static const struct {
100 int sens[3]; /* sensitivity per X, Y, Z axis */ 100 int sens[3]; /* sensitivity per X, Y, Z axis */
101 int nfo; /* null field output */ 101 int nfo; /* null field output */
102} mmc35240_props_table[] = { 102} mmc35240_props_table[] = {
103 /* 16 bits, 100Hz ODR */ 103 /* 16 bits, 125Hz ODR */
104 { 104 {
105 {1024, 1024, 1024}, 105 {1024, 1024, 1024},
106 32768, 106 32768,
107 }, 107 },
108 /* 16 bits, 200Hz ODR */ 108 /* 16 bits, 250Hz ODR */
109 { 109 {
110 {1024, 1024, 770}, 110 {1024, 1024, 770},
111 32768, 111 32768,
112 }, 112 },
113 /* 14 bits, 333Hz ODR */ 113 /* 14 bits, 450Hz ODR */
114 { 114 {
115 {256, 256, 193}, 115 {256, 256, 193},
116 8192, 116 8192,
117 }, 117 },
118 /* 12 bits, 666Hz ODR */ 118 /* 12 bits, 800Hz ODR */
119 { 119 {
120 {64, 64, 48}, 120 {64, 64, 48},
121 2048, 121 2048,
@@ -133,9 +133,15 @@ struct mmc35240_data {
133 int axis_scale[3]; 133 int axis_scale[3];
134}; 134};
135 135
136static const int mmc35240_samp_freq[] = {100, 200, 333, 666}; 136static const struct {
137 int val;
138 int val2;
139} mmc35240_samp_freq[] = { {1, 500000},
140 {13, 0},
141 {25, 0},
142 {50, 0} };
137 143
138static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("100 200 333 666"); 144static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("1.5 13 25 50");
139 145
140#define MMC35240_CHANNEL(_axis) { \ 146#define MMC35240_CHANNEL(_axis) { \
141 .type = IIO_MAGN, \ 147 .type = IIO_MAGN, \
@@ -168,7 +174,8 @@ static int mmc35240_get_samp_freq_index(struct mmc35240_data *data,
168 int i; 174 int i;
169 175
170 for (i = 0; i < ARRAY_SIZE(mmc35240_samp_freq); i++) 176 for (i = 0; i < ARRAY_SIZE(mmc35240_samp_freq); i++)
171 if (mmc35240_samp_freq[i] == val) 177 if (mmc35240_samp_freq[i].val == val &&
178 mmc35240_samp_freq[i].val2 == val2)
172 return i; 179 return i;
173 return -EINVAL; 180 return -EINVAL;
174} 181}
@@ -378,9 +385,9 @@ static int mmc35240_read_raw(struct iio_dev *indio_dev,
378 if (i < 0 || i >= ARRAY_SIZE(mmc35240_samp_freq)) 385 if (i < 0 || i >= ARRAY_SIZE(mmc35240_samp_freq))
379 return -EINVAL; 386 return -EINVAL;
380 387
381 *val = mmc35240_samp_freq[i]; 388 *val = mmc35240_samp_freq[i].val;
382 *val2 = 0; 389 *val2 = mmc35240_samp_freq[i].val2;
383 return IIO_VAL_INT; 390 return IIO_VAL_INT_PLUS_MICRO;
384 default: 391 default:
385 return -EINVAL; 392 return -EINVAL;
386 } 393 }
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index 2042e375f835..3d756bd8c703 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -80,6 +80,7 @@
80#define SX9500_COMPSTAT_MASK GENMASK(3, 0) 80#define SX9500_COMPSTAT_MASK GENMASK(3, 0)
81 81
82#define SX9500_NUM_CHANNELS 4 82#define SX9500_NUM_CHANNELS 4
83#define SX9500_CHAN_MASK GENMASK(SX9500_NUM_CHANNELS - 1, 0)
83 84
84struct sx9500_data { 85struct sx9500_data {
85 struct mutex mutex; 86 struct mutex mutex;
@@ -281,7 +282,7 @@ static int sx9500_read_prox_data(struct sx9500_data *data,
281 if (ret < 0) 282 if (ret < 0)
282 return ret; 283 return ret;
283 284
284 *val = 32767 - (s16)be16_to_cpu(regval); 285 *val = be16_to_cpu(regval);
285 286
286 return IIO_VAL_INT; 287 return IIO_VAL_INT;
287} 288}
@@ -329,27 +330,29 @@ static int sx9500_read_proximity(struct sx9500_data *data,
329 else 330 else
330 ret = sx9500_wait_for_sample(data); 331 ret = sx9500_wait_for_sample(data);
331 332
332 if (ret < 0)
333 return ret;
334
335 mutex_lock(&data->mutex); 333 mutex_lock(&data->mutex);
336 334
337 ret = sx9500_read_prox_data(data, chan, val);
338 if (ret < 0) 335 if (ret < 0)
339 goto out; 336 goto out_dec_data_rdy;
340 337
341 ret = sx9500_dec_chan_users(data, chan->channel); 338 ret = sx9500_read_prox_data(data, chan, val);
342 if (ret < 0) 339 if (ret < 0)
343 goto out; 340 goto out_dec_data_rdy;
344 341
345 ret = sx9500_dec_data_rdy_users(data); 342 ret = sx9500_dec_data_rdy_users(data);
346 if (ret < 0) 343 if (ret < 0)
344 goto out_dec_chan;
345
346 ret = sx9500_dec_chan_users(data, chan->channel);
347 if (ret < 0)
347 goto out; 348 goto out;
348 349
349 ret = IIO_VAL_INT; 350 ret = IIO_VAL_INT;
350 351
351 goto out; 352 goto out;
352 353
354out_dec_data_rdy:
355 sx9500_dec_data_rdy_users(data);
353out_dec_chan: 356out_dec_chan:
354 sx9500_dec_chan_users(data, chan->channel); 357 sx9500_dec_chan_users(data, chan->channel);
355out: 358out:
@@ -679,7 +682,7 @@ out:
679static int sx9500_buffer_preenable(struct iio_dev *indio_dev) 682static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
680{ 683{
681 struct sx9500_data *data = iio_priv(indio_dev); 684 struct sx9500_data *data = iio_priv(indio_dev);
682 int ret, i; 685 int ret = 0, i;
683 686
684 mutex_lock(&data->mutex); 687 mutex_lock(&data->mutex);
685 688
@@ -703,7 +706,7 @@ static int sx9500_buffer_preenable(struct iio_dev *indio_dev)
703static int sx9500_buffer_predisable(struct iio_dev *indio_dev) 706static int sx9500_buffer_predisable(struct iio_dev *indio_dev)
704{ 707{
705 struct sx9500_data *data = iio_priv(indio_dev); 708 struct sx9500_data *data = iio_priv(indio_dev);
706 int ret, i; 709 int ret = 0, i;
707 710
708 iio_triggered_buffer_predisable(indio_dev); 711 iio_triggered_buffer_predisable(indio_dev);
709 712
@@ -800,8 +803,7 @@ static int sx9500_init_compensation(struct iio_dev *indio_dev)
800 unsigned int val; 803 unsigned int val;
801 804
802 ret = regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0, 805 ret = regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0,
803 GENMASK(SX9500_NUM_CHANNELS, 0), 806 SX9500_CHAN_MASK, SX9500_CHAN_MASK);
804 GENMASK(SX9500_NUM_CHANNELS, 0));
805 if (ret < 0) 807 if (ret < 0)
806 return ret; 808 return ret;
807 809
@@ -821,7 +823,7 @@ static int sx9500_init_compensation(struct iio_dev *indio_dev)
821 823
822out: 824out:
823 regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0, 825 regmap_update_bits(data->regmap, SX9500_REG_PROX_CTRL0,
824 GENMASK(SX9500_NUM_CHANNELS, 0), 0); 826 SX9500_CHAN_MASK, 0);
825 return ret; 827 return ret;
826} 828}
827 829
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index fcc49f89b946..8f21f32f9739 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -132,6 +132,9 @@ static int tmp006_write_raw(struct iio_dev *indio_dev,
132 struct tmp006_data *data = iio_priv(indio_dev); 132 struct tmp006_data *data = iio_priv(indio_dev);
133 int i; 133 int i;
134 134
135 if (mask != IIO_CHAN_INFO_SAMP_FREQ)
136 return -EINVAL;
137
135 for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++) 138 for (i = 0; i < ARRAY_SIZE(tmp006_freqs); i++)
136 if ((val == tmp006_freqs[i][0]) && 139 if ((val == tmp006_freqs[i][0]) &&
137 (val2 == tmp006_freqs[i][1])) { 140 (val2 == tmp006_freqs[i][1])) {
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
index c7dcfe4ca5f1..0429040304fd 100644
--- a/drivers/infiniband/core/agent.c
+++ b/drivers/infiniband/core/agent.c
@@ -88,7 +88,7 @@ void agent_send_response(const struct ib_mad_hdr *mad_hdr, const struct ib_grh *
88 struct ib_ah *ah; 88 struct ib_ah *ah;
89 struct ib_mad_send_wr_private *mad_send_wr; 89 struct ib_mad_send_wr_private *mad_send_wr;
90 90
91 if (device->node_type == RDMA_NODE_IB_SWITCH) 91 if (rdma_cap_ib_switch(device))
92 port_priv = ib_get_agent_port(device, 0); 92 port_priv = ib_get_agent_port(device, 0);
93 else 93 else
94 port_priv = ib_get_agent_port(device, port_num); 94 port_priv = ib_get_agent_port(device, port_num);
@@ -122,7 +122,7 @@ void agent_send_response(const struct ib_mad_hdr *mad_hdr, const struct ib_grh *
122 memcpy(send_buf->mad, mad_hdr, resp_mad_len); 122 memcpy(send_buf->mad, mad_hdr, resp_mad_len);
123 send_buf->ah = ah; 123 send_buf->ah = ah;
124 124
125 if (device->node_type == RDMA_NODE_IB_SWITCH) { 125 if (rdma_cap_ib_switch(device)) {
126 mad_send_wr = container_of(send_buf, 126 mad_send_wr = container_of(send_buf,
127 struct ib_mad_send_wr_private, 127 struct ib_mad_send_wr_private,
128 send_buf); 128 send_buf);
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index dbddddd6fb5d..3a972ebf3c0d 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -169,6 +169,7 @@ struct cm_device {
169 struct ib_device *ib_device; 169 struct ib_device *ib_device;
170 struct device *device; 170 struct device *device;
171 u8 ack_delay; 171 u8 ack_delay;
172 int going_down;
172 struct cm_port *port[0]; 173 struct cm_port *port[0];
173}; 174};
174 175
@@ -805,6 +806,11 @@ static void cm_enter_timewait(struct cm_id_private *cm_id_priv)
805{ 806{
806 int wait_time; 807 int wait_time;
807 unsigned long flags; 808 unsigned long flags;
809 struct cm_device *cm_dev;
810
811 cm_dev = ib_get_client_data(cm_id_priv->id.device, &cm_client);
812 if (!cm_dev)
813 return;
808 814
809 spin_lock_irqsave(&cm.lock, flags); 815 spin_lock_irqsave(&cm.lock, flags);
810 cm_cleanup_timewait(cm_id_priv->timewait_info); 816 cm_cleanup_timewait(cm_id_priv->timewait_info);
@@ -818,8 +824,14 @@ static void cm_enter_timewait(struct cm_id_private *cm_id_priv)
818 */ 824 */
819 cm_id_priv->id.state = IB_CM_TIMEWAIT; 825 cm_id_priv->id.state = IB_CM_TIMEWAIT;
820 wait_time = cm_convert_to_ms(cm_id_priv->av.timeout); 826 wait_time = cm_convert_to_ms(cm_id_priv->av.timeout);
821 queue_delayed_work(cm.wq, &cm_id_priv->timewait_info->work.work, 827
822 msecs_to_jiffies(wait_time)); 828 /* Check if the device started its remove_one */
829 spin_lock_irq(&cm.lock);
830 if (!cm_dev->going_down)
831 queue_delayed_work(cm.wq, &cm_id_priv->timewait_info->work.work,
832 msecs_to_jiffies(wait_time));
833 spin_unlock_irq(&cm.lock);
834
823 cm_id_priv->timewait_info = NULL; 835 cm_id_priv->timewait_info = NULL;
824} 836}
825 837
@@ -3305,6 +3317,11 @@ static int cm_establish(struct ib_cm_id *cm_id)
3305 struct cm_work *work; 3317 struct cm_work *work;
3306 unsigned long flags; 3318 unsigned long flags;
3307 int ret = 0; 3319 int ret = 0;
3320 struct cm_device *cm_dev;
3321
3322 cm_dev = ib_get_client_data(cm_id->device, &cm_client);
3323 if (!cm_dev)
3324 return -ENODEV;
3308 3325
3309 work = kmalloc(sizeof *work, GFP_ATOMIC); 3326 work = kmalloc(sizeof *work, GFP_ATOMIC);
3310 if (!work) 3327 if (!work)
@@ -3343,7 +3360,17 @@ static int cm_establish(struct ib_cm_id *cm_id)
3343 work->remote_id = cm_id->remote_id; 3360 work->remote_id = cm_id->remote_id;
3344 work->mad_recv_wc = NULL; 3361 work->mad_recv_wc = NULL;
3345 work->cm_event.event = IB_CM_USER_ESTABLISHED; 3362 work->cm_event.event = IB_CM_USER_ESTABLISHED;
3346 queue_delayed_work(cm.wq, &work->work, 0); 3363
3364 /* Check if the device started its remove_one */
3365 spin_lock_irq(&cm.lock);
3366 if (!cm_dev->going_down) {
3367 queue_delayed_work(cm.wq, &work->work, 0);
3368 } else {
3369 kfree(work);
3370 ret = -ENODEV;
3371 }
3372 spin_unlock_irq(&cm.lock);
3373
3347out: 3374out:
3348 return ret; 3375 return ret;
3349} 3376}
@@ -3394,6 +3421,7 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent,
3394 enum ib_cm_event_type event; 3421 enum ib_cm_event_type event;
3395 u16 attr_id; 3422 u16 attr_id;
3396 int paths = 0; 3423 int paths = 0;
3424 int going_down = 0;
3397 3425
3398 switch (mad_recv_wc->recv_buf.mad->mad_hdr.attr_id) { 3426 switch (mad_recv_wc->recv_buf.mad->mad_hdr.attr_id) {
3399 case CM_REQ_ATTR_ID: 3427 case CM_REQ_ATTR_ID:
@@ -3452,7 +3480,19 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent,
3452 work->cm_event.event = event; 3480 work->cm_event.event = event;
3453 work->mad_recv_wc = mad_recv_wc; 3481 work->mad_recv_wc = mad_recv_wc;
3454 work->port = port; 3482 work->port = port;
3455 queue_delayed_work(cm.wq, &work->work, 0); 3483
3484 /* Check if the device started its remove_one */
3485 spin_lock_irq(&cm.lock);
3486 if (!port->cm_dev->going_down)
3487 queue_delayed_work(cm.wq, &work->work, 0);
3488 else
3489 going_down = 1;
3490 spin_unlock_irq(&cm.lock);
3491
3492 if (going_down) {
3493 kfree(work);
3494 ib_free_recv_mad(mad_recv_wc);
3495 }
3456} 3496}
3457 3497
3458static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, 3498static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
@@ -3771,7 +3811,7 @@ static void cm_add_one(struct ib_device *ib_device)
3771 3811
3772 cm_dev->ib_device = ib_device; 3812 cm_dev->ib_device = ib_device;
3773 cm_get_ack_delay(cm_dev); 3813 cm_get_ack_delay(cm_dev);
3774 3814 cm_dev->going_down = 0;
3775 cm_dev->device = device_create(&cm_class, &ib_device->dev, 3815 cm_dev->device = device_create(&cm_class, &ib_device->dev,
3776 MKDEV(0, 0), NULL, 3816 MKDEV(0, 0), NULL,
3777 "%s", ib_device->name); 3817 "%s", ib_device->name);
@@ -3864,14 +3904,23 @@ static void cm_remove_one(struct ib_device *ib_device)
3864 list_del(&cm_dev->list); 3904 list_del(&cm_dev->list);
3865 write_unlock_irqrestore(&cm.device_lock, flags); 3905 write_unlock_irqrestore(&cm.device_lock, flags);
3866 3906
3907 spin_lock_irq(&cm.lock);
3908 cm_dev->going_down = 1;
3909 spin_unlock_irq(&cm.lock);
3910
3867 for (i = 1; i <= ib_device->phys_port_cnt; i++) { 3911 for (i = 1; i <= ib_device->phys_port_cnt; i++) {
3868 if (!rdma_cap_ib_cm(ib_device, i)) 3912 if (!rdma_cap_ib_cm(ib_device, i))
3869 continue; 3913 continue;
3870 3914
3871 port = cm_dev->port[i-1]; 3915 port = cm_dev->port[i-1];
3872 ib_modify_port(ib_device, port->port_num, 0, &port_modify); 3916 ib_modify_port(ib_device, port->port_num, 0, &port_modify);
3873 ib_unregister_mad_agent(port->mad_agent); 3917 /*
3918 * We flush the queue here after the going_down set, this
3919 * verify that no new works will be queued in the recv handler,
3920 * after that we can call the unregister_mad_agent
3921 */
3874 flush_workqueue(cm.wq); 3922 flush_workqueue(cm.wq);
3923 ib_unregister_mad_agent(port->mad_agent);
3875 cm_remove_port_fs(port); 3924 cm_remove_port_fs(port);
3876 } 3925 }
3877 device_unregister(cm_dev->device); 3926 device_unregister(cm_dev->device);
diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c
index e6ffa2e66c1a..22a3abee2a54 100644
--- a/drivers/infiniband/core/iwpm_msg.c
+++ b/drivers/infiniband/core/iwpm_msg.c
@@ -67,7 +67,8 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
67 err_str = "Invalid port mapper client"; 67 err_str = "Invalid port mapper client";
68 goto pid_query_error; 68 goto pid_query_error;
69 } 69 }
70 if (iwpm_registered_client(nl_client)) 70 if (iwpm_check_registration(nl_client, IWPM_REG_VALID) ||
71 iwpm_user_pid == IWPM_PID_UNAVAILABLE)
71 return 0; 72 return 0;
72 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REG_PID, &nlh, nl_client); 73 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REG_PID, &nlh, nl_client);
73 if (!skb) { 74 if (!skb) {
@@ -106,7 +107,6 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
106 ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_IWPM, GFP_KERNEL); 107 ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_IWPM, GFP_KERNEL);
107 if (ret) { 108 if (ret) {
108 skb = NULL; /* skb is freed in the netlink send-op handling */ 109 skb = NULL; /* skb is freed in the netlink send-op handling */
109 iwpm_set_registered(nl_client, 1);
110 iwpm_user_pid = IWPM_PID_UNAVAILABLE; 110 iwpm_user_pid = IWPM_PID_UNAVAILABLE;
111 err_str = "Unable to send a nlmsg"; 111 err_str = "Unable to send a nlmsg";
112 goto pid_query_error; 112 goto pid_query_error;
@@ -144,12 +144,12 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
144 err_str = "Invalid port mapper client"; 144 err_str = "Invalid port mapper client";
145 goto add_mapping_error; 145 goto add_mapping_error;
146 } 146 }
147 if (!iwpm_registered_client(nl_client)) { 147 if (!iwpm_valid_pid())
148 return 0;
149 if (!iwpm_check_registration(nl_client, IWPM_REG_VALID)) {
148 err_str = "Unregistered port mapper client"; 150 err_str = "Unregistered port mapper client";
149 goto add_mapping_error; 151 goto add_mapping_error;
150 } 152 }
151 if (!iwpm_valid_pid())
152 return 0;
153 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_ADD_MAPPING, &nlh, nl_client); 153 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_ADD_MAPPING, &nlh, nl_client);
154 if (!skb) { 154 if (!skb) {
155 err_str = "Unable to create a nlmsg"; 155 err_str = "Unable to create a nlmsg";
@@ -214,12 +214,12 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
214 err_str = "Invalid port mapper client"; 214 err_str = "Invalid port mapper client";
215 goto query_mapping_error; 215 goto query_mapping_error;
216 } 216 }
217 if (!iwpm_registered_client(nl_client)) { 217 if (!iwpm_valid_pid())
218 return 0;
219 if (!iwpm_check_registration(nl_client, IWPM_REG_VALID)) {
218 err_str = "Unregistered port mapper client"; 220 err_str = "Unregistered port mapper client";
219 goto query_mapping_error; 221 goto query_mapping_error;
220 } 222 }
221 if (!iwpm_valid_pid())
222 return 0;
223 ret = -ENOMEM; 223 ret = -ENOMEM;
224 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_QUERY_MAPPING, &nlh, nl_client); 224 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_QUERY_MAPPING, &nlh, nl_client);
225 if (!skb) { 225 if (!skb) {
@@ -288,12 +288,12 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)
288 err_str = "Invalid port mapper client"; 288 err_str = "Invalid port mapper client";
289 goto remove_mapping_error; 289 goto remove_mapping_error;
290 } 290 }
291 if (!iwpm_registered_client(nl_client)) { 291 if (!iwpm_valid_pid())
292 return 0;
293 if (iwpm_check_registration(nl_client, IWPM_REG_UNDEF)) {
292 err_str = "Unregistered port mapper client"; 294 err_str = "Unregistered port mapper client";
293 goto remove_mapping_error; 295 goto remove_mapping_error;
294 } 296 }
295 if (!iwpm_valid_pid())
296 return 0;
297 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REMOVE_MAPPING, &nlh, nl_client); 297 skb = iwpm_create_nlmsg(RDMA_NL_IWPM_REMOVE_MAPPING, &nlh, nl_client);
298 if (!skb) { 298 if (!skb) {
299 ret = -ENOMEM; 299 ret = -ENOMEM;
@@ -388,7 +388,7 @@ int iwpm_register_pid_cb(struct sk_buff *skb, struct netlink_callback *cb)
388 pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", 388 pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n",
389 __func__, iwpm_user_pid); 389 __func__, iwpm_user_pid);
390 if (iwpm_valid_client(nl_client)) 390 if (iwpm_valid_client(nl_client))
391 iwpm_set_registered(nl_client, 1); 391 iwpm_set_registration(nl_client, IWPM_REG_VALID);
392register_pid_response_exit: 392register_pid_response_exit:
393 nlmsg_request->request_done = 1; 393 nlmsg_request->request_done = 1;
394 /* always for found nlmsg_request */ 394 /* always for found nlmsg_request */
@@ -644,7 +644,6 @@ int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
644{ 644{
645 struct nlattr *nltb[IWPM_NLA_MAPINFO_REQ_MAX]; 645 struct nlattr *nltb[IWPM_NLA_MAPINFO_REQ_MAX];
646 const char *msg_type = "Mapping Info response"; 646 const char *msg_type = "Mapping Info response";
647 int iwpm_pid;
648 u8 nl_client; 647 u8 nl_client;
649 char *iwpm_name; 648 char *iwpm_name;
650 u16 iwpm_version; 649 u16 iwpm_version;
@@ -669,14 +668,14 @@ int iwpm_mapping_info_cb(struct sk_buff *skb, struct netlink_callback *cb)
669 __func__, nl_client); 668 __func__, nl_client);
670 return ret; 669 return ret;
671 } 670 }
672 iwpm_set_registered(nl_client, 0); 671 iwpm_set_registration(nl_client, IWPM_REG_INCOMPL);
673 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq); 672 atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq);
673 iwpm_user_pid = cb->nlh->nlmsg_pid;
674 if (!iwpm_mapinfo_available()) 674 if (!iwpm_mapinfo_available())
675 return 0; 675 return 0;
676 iwpm_pid = cb->nlh->nlmsg_pid;
677 pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n", 676 pr_debug("%s: iWarp Port Mapper (pid = %d) is available!\n",
678 __func__, iwpm_pid); 677 __func__, iwpm_user_pid);
679 ret = iwpm_send_mapinfo(nl_client, iwpm_pid); 678 ret = iwpm_send_mapinfo(nl_client, iwpm_user_pid);
680 return ret; 679 return ret;
681} 680}
682EXPORT_SYMBOL(iwpm_mapping_info_cb); 681EXPORT_SYMBOL(iwpm_mapping_info_cb);
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index a626795bf9c7..5fb089e91353 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -78,6 +78,7 @@ init_exit:
78 mutex_unlock(&iwpm_admin_lock); 78 mutex_unlock(&iwpm_admin_lock);
79 if (!ret) { 79 if (!ret) {
80 iwpm_set_valid(nl_client, 1); 80 iwpm_set_valid(nl_client, 1);
81 iwpm_set_registration(nl_client, IWPM_REG_UNDEF);
81 pr_debug("%s: Mapinfo and reminfo tables are created\n", 82 pr_debug("%s: Mapinfo and reminfo tables are created\n",
82 __func__); 83 __func__);
83 } 84 }
@@ -106,6 +107,7 @@ int iwpm_exit(u8 nl_client)
106 } 107 }
107 mutex_unlock(&iwpm_admin_lock); 108 mutex_unlock(&iwpm_admin_lock);
108 iwpm_set_valid(nl_client, 0); 109 iwpm_set_valid(nl_client, 0);
110 iwpm_set_registration(nl_client, IWPM_REG_UNDEF);
109 return 0; 111 return 0;
110} 112}
111EXPORT_SYMBOL(iwpm_exit); 113EXPORT_SYMBOL(iwpm_exit);
@@ -397,17 +399,23 @@ void iwpm_set_valid(u8 nl_client, int valid)
397} 399}
398 400
399/* valid client */ 401/* valid client */
400int iwpm_registered_client(u8 nl_client) 402u32 iwpm_get_registration(u8 nl_client)
401{ 403{
402 return iwpm_admin.reg_list[nl_client]; 404 return iwpm_admin.reg_list[nl_client];
403} 405}
404 406
405/* valid client */ 407/* valid client */
406void iwpm_set_registered(u8 nl_client, int reg) 408void iwpm_set_registration(u8 nl_client, u32 reg)
407{ 409{
408 iwpm_admin.reg_list[nl_client] = reg; 410 iwpm_admin.reg_list[nl_client] = reg;
409} 411}
410 412
413/* valid client */
414u32 iwpm_check_registration(u8 nl_client, u32 reg)
415{
416 return (iwpm_get_registration(nl_client) & reg);
417}
418
411int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr, 419int iwpm_compare_sockaddr(struct sockaddr_storage *a_sockaddr,
412 struct sockaddr_storage *b_sockaddr) 420 struct sockaddr_storage *b_sockaddr)
413{ 421{
diff --git a/drivers/infiniband/core/iwpm_util.h b/drivers/infiniband/core/iwpm_util.h
index ee2d9ff095be..b7b9e194ce81 100644
--- a/drivers/infiniband/core/iwpm_util.h
+++ b/drivers/infiniband/core/iwpm_util.h
@@ -58,6 +58,10 @@
58#define IWPM_PID_UNDEFINED -1 58#define IWPM_PID_UNDEFINED -1
59#define IWPM_PID_UNAVAILABLE -2 59#define IWPM_PID_UNAVAILABLE -2
60 60
61#define IWPM_REG_UNDEF 0x01
62#define IWPM_REG_VALID 0x02
63#define IWPM_REG_INCOMPL 0x04
64
61struct iwpm_nlmsg_request { 65struct iwpm_nlmsg_request {
62 struct list_head inprocess_list; 66 struct list_head inprocess_list;
63 __u32 nlmsg_seq; 67 __u32 nlmsg_seq;
@@ -88,7 +92,7 @@ struct iwpm_admin_data {
88 atomic_t refcount; 92 atomic_t refcount;
89 atomic_t nlmsg_seq; 93 atomic_t nlmsg_seq;
90 int client_list[RDMA_NL_NUM_CLIENTS]; 94 int client_list[RDMA_NL_NUM_CLIENTS];
91 int reg_list[RDMA_NL_NUM_CLIENTS]; 95 u32 reg_list[RDMA_NL_NUM_CLIENTS];
92}; 96};
93 97
94/** 98/**
@@ -159,19 +163,31 @@ int iwpm_valid_client(u8 nl_client);
159void iwpm_set_valid(u8 nl_client, int valid); 163void iwpm_set_valid(u8 nl_client, int valid);
160 164
161/** 165/**
162 * iwpm_registered_client - Check if the port mapper client is registered 166 * iwpm_check_registration - Check if the client registration
167 * matches the given one
163 * @nl_client: The index of the netlink client 168 * @nl_client: The index of the netlink client
169 * @reg: The given registration type to compare with
164 * 170 *
165 * Call iwpm_register_pid() to register a client 171 * Call iwpm_register_pid() to register a client
172 * Returns true if the client registration matches reg,
173 * otherwise returns false
174 */
175u32 iwpm_check_registration(u8 nl_client, u32 reg);
176
177/**
178 * iwpm_set_registration - Set the client registration
179 * @nl_client: The index of the netlink client
180 * @reg: Registration type to set
166 */ 181 */
167int iwpm_registered_client(u8 nl_client); 182void iwpm_set_registration(u8 nl_client, u32 reg);
168 183
169/** 184/**
170 * iwpm_set_registered - Set the port mapper client to registered or not 185 * iwpm_get_registration
171 * @nl_client: The index of the netlink client 186 * @nl_client: The index of the netlink client
172 * @reg: 1 if registered or 0 if not 187 *
188 * Returns the client registration type
173 */ 189 */
174void iwpm_set_registered(u8 nl_client, int reg); 190u32 iwpm_get_registration(u8 nl_client);
175 191
176/** 192/**
177 * iwpm_send_mapinfo - Send local and mapped IPv4/IPv6 address info of 193 * iwpm_send_mapinfo - Send local and mapped IPv4/IPv6 address info of
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index a4b1466c1bf6..786fc51bf04b 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -769,7 +769,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
769 bool opa = rdma_cap_opa_mad(mad_agent_priv->qp_info->port_priv->device, 769 bool opa = rdma_cap_opa_mad(mad_agent_priv->qp_info->port_priv->device,
770 mad_agent_priv->qp_info->port_priv->port_num); 770 mad_agent_priv->qp_info->port_priv->port_num);
771 771
772 if (device->node_type == RDMA_NODE_IB_SWITCH && 772 if (rdma_cap_ib_switch(device) &&
773 smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) 773 smp->mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
774 port_num = send_wr->wr.ud.port_num; 774 port_num = send_wr->wr.ud.port_num;
775 else 775 else
@@ -787,14 +787,15 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
787 if ((opa_get_smp_direction(opa_smp) 787 if ((opa_get_smp_direction(opa_smp)
788 ? opa_smp->route.dr.dr_dlid : opa_smp->route.dr.dr_slid) == 788 ? opa_smp->route.dr.dr_dlid : opa_smp->route.dr.dr_slid) ==
789 OPA_LID_PERMISSIVE && 789 OPA_LID_PERMISSIVE &&
790 opa_smi_handle_dr_smp_send(opa_smp, device->node_type, 790 opa_smi_handle_dr_smp_send(opa_smp,
791 rdma_cap_ib_switch(device),
791 port_num) == IB_SMI_DISCARD) { 792 port_num) == IB_SMI_DISCARD) {
792 ret = -EINVAL; 793 ret = -EINVAL;
793 dev_err(&device->dev, "OPA Invalid directed route\n"); 794 dev_err(&device->dev, "OPA Invalid directed route\n");
794 goto out; 795 goto out;
795 } 796 }
796 opa_drslid = be32_to_cpu(opa_smp->route.dr.dr_slid); 797 opa_drslid = be32_to_cpu(opa_smp->route.dr.dr_slid);
797 if (opa_drslid != OPA_LID_PERMISSIVE && 798 if (opa_drslid != be32_to_cpu(OPA_LID_PERMISSIVE) &&
798 opa_drslid & 0xffff0000) { 799 opa_drslid & 0xffff0000) {
799 ret = -EINVAL; 800 ret = -EINVAL;
800 dev_err(&device->dev, "OPA Invalid dr_slid 0x%x\n", 801 dev_err(&device->dev, "OPA Invalid dr_slid 0x%x\n",
@@ -810,7 +811,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
810 } else { 811 } else {
811 if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) == 812 if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) ==
812 IB_LID_PERMISSIVE && 813 IB_LID_PERMISSIVE &&
813 smi_handle_dr_smp_send(smp, device->node_type, port_num) == 814 smi_handle_dr_smp_send(smp, rdma_cap_ib_switch(device), port_num) ==
814 IB_SMI_DISCARD) { 815 IB_SMI_DISCARD) {
815 ret = -EINVAL; 816 ret = -EINVAL;
816 dev_err(&device->dev, "Invalid directed route\n"); 817 dev_err(&device->dev, "Invalid directed route\n");
@@ -2030,7 +2031,7 @@ static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv
2030 struct ib_smp *smp = (struct ib_smp *)recv->mad; 2031 struct ib_smp *smp = (struct ib_smp *)recv->mad;
2031 2032
2032 if (smi_handle_dr_smp_recv(smp, 2033 if (smi_handle_dr_smp_recv(smp,
2033 port_priv->device->node_type, 2034 rdma_cap_ib_switch(port_priv->device),
2034 port_num, 2035 port_num,
2035 port_priv->device->phys_port_cnt) == 2036 port_priv->device->phys_port_cnt) ==
2036 IB_SMI_DISCARD) 2037 IB_SMI_DISCARD)
@@ -2042,13 +2043,13 @@ static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv
2042 2043
2043 if (retsmi == IB_SMI_SEND) { /* don't forward */ 2044 if (retsmi == IB_SMI_SEND) { /* don't forward */
2044 if (smi_handle_dr_smp_send(smp, 2045 if (smi_handle_dr_smp_send(smp,
2045 port_priv->device->node_type, 2046 rdma_cap_ib_switch(port_priv->device),
2046 port_num) == IB_SMI_DISCARD) 2047 port_num) == IB_SMI_DISCARD)
2047 return IB_SMI_DISCARD; 2048 return IB_SMI_DISCARD;
2048 2049
2049 if (smi_check_local_smp(smp, port_priv->device) == IB_SMI_DISCARD) 2050 if (smi_check_local_smp(smp, port_priv->device) == IB_SMI_DISCARD)
2050 return IB_SMI_DISCARD; 2051 return IB_SMI_DISCARD;
2051 } else if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) { 2052 } else if (rdma_cap_ib_switch(port_priv->device)) {
2052 /* forward case for switches */ 2053 /* forward case for switches */
2053 memcpy(response, recv, mad_priv_size(response)); 2054 memcpy(response, recv, mad_priv_size(response));
2054 response->header.recv_wc.wc = &response->header.wc; 2055 response->header.recv_wc.wc = &response->header.wc;
@@ -2115,7 +2116,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv,
2115 struct opa_smp *smp = (struct opa_smp *)recv->mad; 2116 struct opa_smp *smp = (struct opa_smp *)recv->mad;
2116 2117
2117 if (opa_smi_handle_dr_smp_recv(smp, 2118 if (opa_smi_handle_dr_smp_recv(smp,
2118 port_priv->device->node_type, 2119 rdma_cap_ib_switch(port_priv->device),
2119 port_num, 2120 port_num,
2120 port_priv->device->phys_port_cnt) == 2121 port_priv->device->phys_port_cnt) ==
2121 IB_SMI_DISCARD) 2122 IB_SMI_DISCARD)
@@ -2127,7 +2128,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv,
2127 2128
2128 if (retsmi == IB_SMI_SEND) { /* don't forward */ 2129 if (retsmi == IB_SMI_SEND) { /* don't forward */
2129 if (opa_smi_handle_dr_smp_send(smp, 2130 if (opa_smi_handle_dr_smp_send(smp,
2130 port_priv->device->node_type, 2131 rdma_cap_ib_switch(port_priv->device),
2131 port_num) == IB_SMI_DISCARD) 2132 port_num) == IB_SMI_DISCARD)
2132 return IB_SMI_DISCARD; 2133 return IB_SMI_DISCARD;
2133 2134
@@ -2135,7 +2136,7 @@ handle_opa_smi(struct ib_mad_port_private *port_priv,
2135 IB_SMI_DISCARD) 2136 IB_SMI_DISCARD)
2136 return IB_SMI_DISCARD; 2137 return IB_SMI_DISCARD;
2137 2138
2138 } else if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) { 2139 } else if (rdma_cap_ib_switch(port_priv->device)) {
2139 /* forward case for switches */ 2140 /* forward case for switches */
2140 memcpy(response, recv, mad_priv_size(response)); 2141 memcpy(response, recv, mad_priv_size(response));
2141 response->header.recv_wc.wc = &response->header.wc; 2142 response->header.recv_wc.wc = &response->header.wc;
@@ -2235,7 +2236,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
2235 goto out; 2236 goto out;
2236 } 2237 }
2237 2238
2238 if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) 2239 if (rdma_cap_ib_switch(port_priv->device))
2239 port_num = wc->port_num; 2240 port_num = wc->port_num;
2240 else 2241 else
2241 port_num = port_priv->port_num; 2242 port_num = port_priv->port_num;
@@ -3297,17 +3298,11 @@ static int ib_mad_port_close(struct ib_device *device, int port_num)
3297 3298
3298static void ib_mad_init_device(struct ib_device *device) 3299static void ib_mad_init_device(struct ib_device *device)
3299{ 3300{
3300 int start, end, i; 3301 int start, i;
3301 3302
3302 if (device->node_type == RDMA_NODE_IB_SWITCH) { 3303 start = rdma_start_port(device);
3303 start = 0;
3304 end = 0;
3305 } else {
3306 start = 1;
3307 end = device->phys_port_cnt;
3308 }
3309 3304
3310 for (i = start; i <= end; i++) { 3305 for (i = start; i <= rdma_end_port(device); i++) {
3311 if (!rdma_cap_ib_mad(device, i)) 3306 if (!rdma_cap_ib_mad(device, i))
3312 continue; 3307 continue;
3313 3308
@@ -3342,17 +3337,9 @@ error:
3342 3337
3343static void ib_mad_remove_device(struct ib_device *device) 3338static void ib_mad_remove_device(struct ib_device *device)
3344{ 3339{
3345 int start, end, i; 3340 int i;
3346
3347 if (device->node_type == RDMA_NODE_IB_SWITCH) {
3348 start = 0;
3349 end = 0;
3350 } else {
3351 start = 1;
3352 end = device->phys_port_cnt;
3353 }
3354 3341
3355 for (i = start; i <= end; i++) { 3342 for (i = rdma_start_port(device); i <= rdma_end_port(device); i++) {
3356 if (!rdma_cap_ib_mad(device, i)) 3343 if (!rdma_cap_ib_mad(device, i))
3357 continue; 3344 continue;
3358 3345
diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
index 1244f02a5c6d..2cb865c7ce7a 100644
--- a/drivers/infiniband/core/multicast.c
+++ b/drivers/infiniband/core/multicast.c
@@ -812,12 +812,8 @@ static void mcast_add_one(struct ib_device *device)
812 if (!dev) 812 if (!dev)
813 return; 813 return;
814 814
815 if (device->node_type == RDMA_NODE_IB_SWITCH) 815 dev->start_port = rdma_start_port(device);
816 dev->start_port = dev->end_port = 0; 816 dev->end_port = rdma_end_port(device);
817 else {
818 dev->start_port = 1;
819 dev->end_port = device->phys_port_cnt;
820 }
821 817
822 for (i = 0; i <= dev->end_port - dev->start_port; i++) { 818 for (i = 0; i <= dev->end_port - dev->start_port; i++) {
823 if (!rdma_cap_ib_mcast(device, dev->start_port + i)) 819 if (!rdma_cap_ib_mcast(device, dev->start_port + i))
diff --git a/drivers/infiniband/core/opa_smi.h b/drivers/infiniband/core/opa_smi.h
index 62d91bfa4cb7..3bfab3505a29 100644
--- a/drivers/infiniband/core/opa_smi.h
+++ b/drivers/infiniband/core/opa_smi.h
@@ -39,12 +39,12 @@
39 39
40#include "smi.h" 40#include "smi.h"
41 41
42enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, u8 node_type, 42enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, bool is_switch,
43 int port_num, int phys_port_cnt); 43 int port_num, int phys_port_cnt);
44int opa_smi_get_fwd_port(struct opa_smp *smp); 44int opa_smi_get_fwd_port(struct opa_smp *smp);
45extern enum smi_forward_action opa_smi_check_forward_dr_smp(struct opa_smp *smp); 45extern enum smi_forward_action opa_smi_check_forward_dr_smp(struct opa_smp *smp);
46extern enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, 46extern enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp,
47 u8 node_type, int port_num); 47 bool is_switch, int port_num);
48 48
49/* 49/*
50 * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM 50 * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 0fae85062a65..ca919f429666 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1156,12 +1156,8 @@ static void ib_sa_add_one(struct ib_device *device)
1156 int s, e, i; 1156 int s, e, i;
1157 int count = 0; 1157 int count = 0;
1158 1158
1159 if (device->node_type == RDMA_NODE_IB_SWITCH) 1159 s = rdma_start_port(device);
1160 s = e = 0; 1160 e = rdma_end_port(device);
1161 else {
1162 s = 1;
1163 e = device->phys_port_cnt;
1164 }
1165 1161
1166 sa_dev = kzalloc(sizeof *sa_dev + 1162 sa_dev = kzalloc(sizeof *sa_dev +
1167 (e - s + 1) * sizeof (struct ib_sa_port), 1163 (e - s + 1) * sizeof (struct ib_sa_port),
diff --git a/drivers/infiniband/core/smi.c b/drivers/infiniband/core/smi.c
index 368a561d1a5d..f19b23817c2b 100644
--- a/drivers/infiniband/core/smi.c
+++ b/drivers/infiniband/core/smi.c
@@ -41,7 +41,7 @@
41#include "smi.h" 41#include "smi.h"
42#include "opa_smi.h" 42#include "opa_smi.h"
43 43
44static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num, 44static enum smi_action __smi_handle_dr_smp_send(bool is_switch, int port_num,
45 u8 *hop_ptr, u8 hop_cnt, 45 u8 *hop_ptr, u8 hop_cnt,
46 const u8 *initial_path, 46 const u8 *initial_path,
47 const u8 *return_path, 47 const u8 *return_path,
@@ -64,7 +64,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num,
64 64
65 /* C14-9:2 */ 65 /* C14-9:2 */
66 if (*hop_ptr && *hop_ptr < hop_cnt) { 66 if (*hop_ptr && *hop_ptr < hop_cnt) {
67 if (node_type != RDMA_NODE_IB_SWITCH) 67 if (!is_switch)
68 return IB_SMI_DISCARD; 68 return IB_SMI_DISCARD;
69 69
70 /* return_path set when received */ 70 /* return_path set when received */
@@ -77,7 +77,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num,
77 if (*hop_ptr == hop_cnt) { 77 if (*hop_ptr == hop_cnt) {
78 /* return_path set when received */ 78 /* return_path set when received */
79 (*hop_ptr)++; 79 (*hop_ptr)++;
80 return (node_type == RDMA_NODE_IB_SWITCH || 80 return (is_switch ||
81 dr_dlid_is_permissive ? 81 dr_dlid_is_permissive ?
82 IB_SMI_HANDLE : IB_SMI_DISCARD); 82 IB_SMI_HANDLE : IB_SMI_DISCARD);
83 } 83 }
@@ -96,7 +96,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num,
96 96
97 /* C14-13:2 */ 97 /* C14-13:2 */
98 if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) { 98 if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) {
99 if (node_type != RDMA_NODE_IB_SWITCH) 99 if (!is_switch)
100 return IB_SMI_DISCARD; 100 return IB_SMI_DISCARD;
101 101
102 (*hop_ptr)--; 102 (*hop_ptr)--;
@@ -108,7 +108,7 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num,
108 if (*hop_ptr == 1) { 108 if (*hop_ptr == 1) {
109 (*hop_ptr)--; 109 (*hop_ptr)--;
110 /* C14-13:3 -- SMPs destined for SM shouldn't be here */ 110 /* C14-13:3 -- SMPs destined for SM shouldn't be here */
111 return (node_type == RDMA_NODE_IB_SWITCH || 111 return (is_switch ||
112 dr_slid_is_permissive ? 112 dr_slid_is_permissive ?
113 IB_SMI_HANDLE : IB_SMI_DISCARD); 113 IB_SMI_HANDLE : IB_SMI_DISCARD);
114 } 114 }
@@ -127,9 +127,9 @@ static enum smi_action __smi_handle_dr_smp_send(u8 node_type, int port_num,
127 * Return IB_SMI_DISCARD if the SMP should be discarded 127 * Return IB_SMI_DISCARD if the SMP should be discarded
128 */ 128 */
129enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, 129enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp,
130 u8 node_type, int port_num) 130 bool is_switch, int port_num)
131{ 131{
132 return __smi_handle_dr_smp_send(node_type, port_num, 132 return __smi_handle_dr_smp_send(is_switch, port_num,
133 &smp->hop_ptr, smp->hop_cnt, 133 &smp->hop_ptr, smp->hop_cnt,
134 smp->initial_path, 134 smp->initial_path,
135 smp->return_path, 135 smp->return_path,
@@ -139,9 +139,9 @@ enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp,
139} 139}
140 140
141enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp, 141enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp,
142 u8 node_type, int port_num) 142 bool is_switch, int port_num)
143{ 143{
144 return __smi_handle_dr_smp_send(node_type, port_num, 144 return __smi_handle_dr_smp_send(is_switch, port_num,
145 &smp->hop_ptr, smp->hop_cnt, 145 &smp->hop_ptr, smp->hop_cnt,
146 smp->route.dr.initial_path, 146 smp->route.dr.initial_path,
147 smp->route.dr.return_path, 147 smp->route.dr.return_path,
@@ -152,7 +152,7 @@ enum smi_action opa_smi_handle_dr_smp_send(struct opa_smp *smp,
152 OPA_LID_PERMISSIVE); 152 OPA_LID_PERMISSIVE);
153} 153}
154 154
155static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num, 155static enum smi_action __smi_handle_dr_smp_recv(bool is_switch, int port_num,
156 int phys_port_cnt, 156 int phys_port_cnt,
157 u8 *hop_ptr, u8 hop_cnt, 157 u8 *hop_ptr, u8 hop_cnt,
158 const u8 *initial_path, 158 const u8 *initial_path,
@@ -173,7 +173,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num,
173 173
174 /* C14-9:2 -- intermediate hop */ 174 /* C14-9:2 -- intermediate hop */
175 if (*hop_ptr && *hop_ptr < hop_cnt) { 175 if (*hop_ptr && *hop_ptr < hop_cnt) {
176 if (node_type != RDMA_NODE_IB_SWITCH) 176 if (!is_switch)
177 return IB_SMI_DISCARD; 177 return IB_SMI_DISCARD;
178 178
179 return_path[*hop_ptr] = port_num; 179 return_path[*hop_ptr] = port_num;
@@ -188,7 +188,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num,
188 return_path[*hop_ptr] = port_num; 188 return_path[*hop_ptr] = port_num;
189 /* hop_ptr updated when sending */ 189 /* hop_ptr updated when sending */
190 190
191 return (node_type == RDMA_NODE_IB_SWITCH || 191 return (is_switch ||
192 dr_dlid_is_permissive ? 192 dr_dlid_is_permissive ?
193 IB_SMI_HANDLE : IB_SMI_DISCARD); 193 IB_SMI_HANDLE : IB_SMI_DISCARD);
194 } 194 }
@@ -208,7 +208,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num,
208 208
209 /* C14-13:2 */ 209 /* C14-13:2 */
210 if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) { 210 if (2 <= *hop_ptr && *hop_ptr <= hop_cnt) {
211 if (node_type != RDMA_NODE_IB_SWITCH) 211 if (!is_switch)
212 return IB_SMI_DISCARD; 212 return IB_SMI_DISCARD;
213 213
214 /* hop_ptr updated when sending */ 214 /* hop_ptr updated when sending */
@@ -224,8 +224,7 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num,
224 return IB_SMI_HANDLE; 224 return IB_SMI_HANDLE;
225 } 225 }
226 /* hop_ptr updated when sending */ 226 /* hop_ptr updated when sending */
227 return (node_type == RDMA_NODE_IB_SWITCH ? 227 return (is_switch ? IB_SMI_HANDLE : IB_SMI_DISCARD);
228 IB_SMI_HANDLE : IB_SMI_DISCARD);
229 } 228 }
230 229
231 /* C14-13:4 -- hop_ptr = 0 -> give to SM */ 230 /* C14-13:4 -- hop_ptr = 0 -> give to SM */
@@ -238,10 +237,10 @@ static enum smi_action __smi_handle_dr_smp_recv(u8 node_type, int port_num,
238 * Adjust information for a received SMP 237 * Adjust information for a received SMP
239 * Return IB_SMI_DISCARD if the SMP should be dropped 238 * Return IB_SMI_DISCARD if the SMP should be dropped
240 */ 239 */
241enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type, 240enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, bool is_switch,
242 int port_num, int phys_port_cnt) 241 int port_num, int phys_port_cnt)
243{ 242{
244 return __smi_handle_dr_smp_recv(node_type, port_num, phys_port_cnt, 243 return __smi_handle_dr_smp_recv(is_switch, port_num, phys_port_cnt,
245 &smp->hop_ptr, smp->hop_cnt, 244 &smp->hop_ptr, smp->hop_cnt,
246 smp->initial_path, 245 smp->initial_path,
247 smp->return_path, 246 smp->return_path,
@@ -254,10 +253,10 @@ enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type,
254 * Adjust information for a received SMP 253 * Adjust information for a received SMP
255 * Return IB_SMI_DISCARD if the SMP should be dropped 254 * Return IB_SMI_DISCARD if the SMP should be dropped
256 */ 255 */
257enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, u8 node_type, 256enum smi_action opa_smi_handle_dr_smp_recv(struct opa_smp *smp, bool is_switch,
258 int port_num, int phys_port_cnt) 257 int port_num, int phys_port_cnt)
259{ 258{
260 return __smi_handle_dr_smp_recv(node_type, port_num, phys_port_cnt, 259 return __smi_handle_dr_smp_recv(is_switch, port_num, phys_port_cnt,
261 &smp->hop_ptr, smp->hop_cnt, 260 &smp->hop_ptr, smp->hop_cnt,
262 smp->route.dr.initial_path, 261 smp->route.dr.initial_path,
263 smp->route.dr.return_path, 262 smp->route.dr.return_path,
diff --git a/drivers/infiniband/core/smi.h b/drivers/infiniband/core/smi.h
index aff96bac49b4..33c91c8a16e9 100644
--- a/drivers/infiniband/core/smi.h
+++ b/drivers/infiniband/core/smi.h
@@ -51,12 +51,12 @@ enum smi_forward_action {
51 IB_SMI_FORWARD /* SMP should be forwarded (for switches only) */ 51 IB_SMI_FORWARD /* SMP should be forwarded (for switches only) */
52}; 52};
53 53
54enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, u8 node_type, 54enum smi_action smi_handle_dr_smp_recv(struct ib_smp *smp, bool is_switch,
55 int port_num, int phys_port_cnt); 55 int port_num, int phys_port_cnt);
56int smi_get_fwd_port(struct ib_smp *smp); 56int smi_get_fwd_port(struct ib_smp *smp);
57extern enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp); 57extern enum smi_forward_action smi_check_forward_dr_smp(struct ib_smp *smp);
58extern enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp, 58extern enum smi_action smi_handle_dr_smp_send(struct ib_smp *smp,
59 u8 node_type, int port_num); 59 bool is_switch, int port_num);
60 60
61/* 61/*
62 * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM 62 * Return IB_SMI_HANDLE if the SMP should be handled by the local SMA/SM
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index ed6b6c85c334..0b84a9cdfe5b 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -870,7 +870,7 @@ int ib_device_register_sysfs(struct ib_device *device,
870 goto err_put; 870 goto err_put;
871 } 871 }
872 872
873 if (device->node_type == RDMA_NODE_IB_SWITCH) { 873 if (rdma_cap_ib_switch(device)) {
874 ret = add_port(device, 0, port_callback); 874 ret = add_port(device, 0, port_callback);
875 if (ret) 875 if (ret)
876 goto err_put; 876 goto err_put;
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index 62c24b1452b8..009481073644 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -1193,6 +1193,7 @@ static int ib_ucm_close(struct inode *inode, struct file *filp)
1193 return 0; 1193 return 0;
1194} 1194}
1195 1195
1196static DECLARE_BITMAP(overflow_map, IB_UCM_MAX_DEVICES);
1196static void ib_ucm_release_dev(struct device *dev) 1197static void ib_ucm_release_dev(struct device *dev)
1197{ 1198{
1198 struct ib_ucm_device *ucm_dev; 1199 struct ib_ucm_device *ucm_dev;
@@ -1202,7 +1203,7 @@ static void ib_ucm_release_dev(struct device *dev)
1202 if (ucm_dev->devnum < IB_UCM_MAX_DEVICES) 1203 if (ucm_dev->devnum < IB_UCM_MAX_DEVICES)
1203 clear_bit(ucm_dev->devnum, dev_map); 1204 clear_bit(ucm_dev->devnum, dev_map);
1204 else 1205 else
1205 clear_bit(ucm_dev->devnum - IB_UCM_MAX_DEVICES, dev_map); 1206 clear_bit(ucm_dev->devnum - IB_UCM_MAX_DEVICES, overflow_map);
1206 kfree(ucm_dev); 1207 kfree(ucm_dev);
1207} 1208}
1208 1209
@@ -1226,7 +1227,6 @@ static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr,
1226static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); 1227static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
1227 1228
1228static dev_t overflow_maj; 1229static dev_t overflow_maj;
1229static DECLARE_BITMAP(overflow_map, IB_UCM_MAX_DEVICES);
1230static int find_overflow_devnum(void) 1230static int find_overflow_devnum(void)
1231{ 1231{
1232 int ret; 1232 int ret;
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index ad45469f7582..29b21213ea75 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -1354,10 +1354,10 @@ static void ucma_lock_files(struct ucma_file *file1, struct ucma_file *file2)
1354 /* Acquire mutex's based on pointer comparison to prevent deadlock. */ 1354 /* Acquire mutex's based on pointer comparison to prevent deadlock. */
1355 if (file1 < file2) { 1355 if (file1 < file2) {
1356 mutex_lock(&file1->mut); 1356 mutex_lock(&file1->mut);
1357 mutex_lock(&file2->mut); 1357 mutex_lock_nested(&file2->mut, SINGLE_DEPTH_NESTING);
1358 } else { 1358 } else {
1359 mutex_lock(&file2->mut); 1359 mutex_lock(&file2->mut);
1360 mutex_lock(&file1->mut); 1360 mutex_lock_nested(&file1->mut, SINGLE_DEPTH_NESTING);
1361 } 1361 }
1362} 1362}
1363 1363
@@ -1616,6 +1616,7 @@ static void __exit ucma_cleanup(void)
1616 device_remove_file(ucma_misc.this_device, &dev_attr_abi_version); 1616 device_remove_file(ucma_misc.this_device, &dev_attr_abi_version);
1617 misc_deregister(&ucma_misc); 1617 misc_deregister(&ucma_misc);
1618 idr_destroy(&ctx_idr); 1618 idr_destroy(&ctx_idr);
1619 idr_destroy(&multicast_idr);
1619} 1620}
1620 1621
1621module_init(ucma_init); 1622module_init(ucma_init);
diff --git a/drivers/infiniband/hw/ehca/ehca_sqp.c b/drivers/infiniband/hw/ehca/ehca_sqp.c
index 12b5bc23832b..376b031c2c7f 100644
--- a/drivers/infiniband/hw/ehca/ehca_sqp.c
+++ b/drivers/infiniband/hw/ehca/ehca_sqp.c
@@ -226,8 +226,9 @@ int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
226 const struct ib_mad *in_mad = (const struct ib_mad *)in; 226 const struct ib_mad *in_mad = (const struct ib_mad *)in;
227 struct ib_mad *out_mad = (struct ib_mad *)out; 227 struct ib_mad *out_mad = (struct ib_mad *)out;
228 228
229 BUG_ON(in_mad_size != sizeof(*in_mad) || 229 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
230 *out_mad_size != sizeof(*out_mad)); 230 *out_mad_size != sizeof(*out_mad)))
231 return IB_MAD_RESULT_FAILURE;
231 232
232 if (!port_num || port_num > ibdev->phys_port_cnt || !in_wc) 233 if (!port_num || port_num > ibdev->phys_port_cnt || !in_wc)
233 return IB_MAD_RESULT_FAILURE; 234 return IB_MAD_RESULT_FAILURE;
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index 948188e37f95..ad3a926ab3c5 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -1499,8 +1499,9 @@ int ipath_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
1499 const struct ib_mad *in_mad = (const struct ib_mad *)in; 1499 const struct ib_mad *in_mad = (const struct ib_mad *)in;
1500 struct ib_mad *out_mad = (struct ib_mad *)out; 1500 struct ib_mad *out_mad = (struct ib_mad *)out;
1501 1501
1502 BUG_ON(in_mad_size != sizeof(*in_mad) || 1502 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
1503 *out_mad_size != sizeof(*out_mad)); 1503 *out_mad_size != sizeof(*out_mad)))
1504 return IB_MAD_RESULT_FAILURE;
1504 1505
1505 switch (in_mad->mad_hdr.mgmt_class) { 1506 switch (in_mad->mad_hdr.mgmt_class) {
1506 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: 1507 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE:
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 48253b839a6f..30ba49c4a98c 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -2044,9 +2044,9 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
2044 2044
2045 spin_lock_init(&idev->qp_table.lock); 2045 spin_lock_init(&idev->qp_table.lock);
2046 spin_lock_init(&idev->lk_table.lock); 2046 spin_lock_init(&idev->lk_table.lock);
2047 idev->sm_lid = __constant_be16_to_cpu(IB_LID_PERMISSIVE); 2047 idev->sm_lid = be16_to_cpu(IB_LID_PERMISSIVE);
2048 /* Set the prefix to the default value (see ch. 4.1.1) */ 2048 /* Set the prefix to the default value (see ch. 4.1.1) */
2049 idev->gid_prefix = __constant_cpu_to_be64(0xfe80000000000000ULL); 2049 idev->gid_prefix = cpu_to_be64(0xfe80000000000000ULL);
2050 2050
2051 ret = ipath_init_qp_table(idev, ib_ipath_qp_table_size); 2051 ret = ipath_init_qp_table(idev, ib_ipath_qp_table_size);
2052 if (ret) 2052 if (ret)
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 85a50df2f203..68b3dfa922bf 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -860,21 +860,31 @@ int mlx4_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
860 struct mlx4_ib_dev *dev = to_mdev(ibdev); 860 struct mlx4_ib_dev *dev = to_mdev(ibdev);
861 const struct ib_mad *in_mad = (const struct ib_mad *)in; 861 const struct ib_mad *in_mad = (const struct ib_mad *)in;
862 struct ib_mad *out_mad = (struct ib_mad *)out; 862 struct ib_mad *out_mad = (struct ib_mad *)out;
863 enum rdma_link_layer link = rdma_port_get_link_layer(ibdev, port_num);
863 864
864 BUG_ON(in_mad_size != sizeof(*in_mad) || 865 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
865 *out_mad_size != sizeof(*out_mad)); 866 *out_mad_size != sizeof(*out_mad)))
867 return IB_MAD_RESULT_FAILURE;
866 868
867 switch (rdma_port_get_link_layer(ibdev, port_num)) { 869 /* iboe_process_mad() which uses the HCA flow-counters to implement IB PMA
868 case IB_LINK_LAYER_INFINIBAND: 870 * queries, should be called only by VFs and for that specific purpose
869 if (!mlx4_is_slave(dev->dev)) 871 */
870 return ib_process_mad(ibdev, mad_flags, port_num, in_wc, 872 if (link == IB_LINK_LAYER_INFINIBAND) {
871 in_grh, in_mad, out_mad); 873 if (mlx4_is_slave(dev->dev) &&
872 case IB_LINK_LAYER_ETHERNET: 874 in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT &&
873 return iboe_process_mad(ibdev, mad_flags, port_num, in_wc, 875 in_mad->mad_hdr.attr_id == IB_PMA_PORT_COUNTERS)
874 in_grh, in_mad, out_mad); 876 return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
875 default: 877 in_grh, in_mad, out_mad);
876 return -EINVAL; 878
879 return ib_process_mad(ibdev, mad_flags, port_num, in_wc,
880 in_grh, in_mad, out_mad);
877 } 881 }
882
883 if (link == IB_LINK_LAYER_ETHERNET)
884 return iboe_process_mad(ibdev, mad_flags, port_num, in_wc,
885 in_grh, in_mad, out_mad);
886
887 return -EINVAL;
878} 888}
879 889
880static void send_handler(struct ib_mad_agent *agent, 890static void send_handler(struct ib_mad_agent *agent,
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 067a691ecbed..8be6db816460 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -253,14 +253,15 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
253 props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; 253 props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL;
254 props->timestamp_mask = 0xFFFFFFFFFFFFULL; 254 props->timestamp_mask = 0xFFFFFFFFFFFFULL;
255 255
256 err = mlx4_get_internal_clock_params(dev->dev, &clock_params); 256 if (!mlx4_is_slave(dev->dev))
257 if (err) 257 err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
258 goto out;
259 258
260 if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) { 259 if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) {
261 resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE;
262 resp.response_length += sizeof(resp.hca_core_clock_offset); 260 resp.response_length += sizeof(resp.hca_core_clock_offset);
263 resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP; 261 if (!err && !mlx4_is_slave(dev->dev)) {
262 resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP;
263 resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE;
264 }
264 } 265 }
265 266
266 if (uhw->outlen) { 267 if (uhw->outlen) {
@@ -2669,31 +2670,33 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init)
2669 dm = kcalloc(ports, sizeof(*dm), GFP_ATOMIC); 2670 dm = kcalloc(ports, sizeof(*dm), GFP_ATOMIC);
2670 if (!dm) { 2671 if (!dm) {
2671 pr_err("failed to allocate memory for tunneling qp update\n"); 2672 pr_err("failed to allocate memory for tunneling qp update\n");
2672 goto out; 2673 return;
2673 } 2674 }
2674 2675
2675 for (i = 0; i < ports; i++) { 2676 for (i = 0; i < ports; i++) {
2676 dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC); 2677 dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC);
2677 if (!dm[i]) { 2678 if (!dm[i]) {
2678 pr_err("failed to allocate memory for tunneling qp update work struct\n"); 2679 pr_err("failed to allocate memory for tunneling qp update work struct\n");
2679 for (i = 0; i < dev->caps.num_ports; i++) { 2680 while (--i >= 0)
2680 if (dm[i]) 2681 kfree(dm[i]);
2681 kfree(dm[i]);
2682 }
2683 goto out; 2682 goto out;
2684 } 2683 }
2685 }
2686 /* initialize or tear down tunnel QPs for the slave */
2687 for (i = 0; i < ports; i++) {
2688 INIT_WORK(&dm[i]->work, mlx4_ib_tunnels_update_work); 2684 INIT_WORK(&dm[i]->work, mlx4_ib_tunnels_update_work);
2689 dm[i]->port = first_port + i + 1; 2685 dm[i]->port = first_port + i + 1;
2690 dm[i]->slave = slave; 2686 dm[i]->slave = slave;
2691 dm[i]->do_init = do_init; 2687 dm[i]->do_init = do_init;
2692 dm[i]->dev = ibdev; 2688 dm[i]->dev = ibdev;
2693 spin_lock_irqsave(&ibdev->sriov.going_down_lock, flags); 2689 }
2694 if (!ibdev->sriov.is_going_down) 2690 /* initialize or tear down tunnel QPs for the slave */
2691 spin_lock_irqsave(&ibdev->sriov.going_down_lock, flags);
2692 if (!ibdev->sriov.is_going_down) {
2693 for (i = 0; i < ports; i++)
2695 queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work); 2694 queue_work(ibdev->sriov.demux[i].ud_wq, &dm[i]->work);
2696 spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags); 2695 spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags);
2696 } else {
2697 spin_unlock_irqrestore(&ibdev->sriov.going_down_lock, flags);
2698 for (i = 0; i < ports; i++)
2699 kfree(dm[i]);
2697 } 2700 }
2698out: 2701out:
2699 kfree(dm); 2702 kfree(dm);
diff --git a/drivers/infiniband/hw/mlx5/mad.c b/drivers/infiniband/hw/mlx5/mad.c
index 01fc97db45d6..b84d13a487cc 100644
--- a/drivers/infiniband/hw/mlx5/mad.c
+++ b/drivers/infiniband/hw/mlx5/mad.c
@@ -68,8 +68,9 @@ int mlx5_ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
68 const struct ib_mad *in_mad = (const struct ib_mad *)in; 68 const struct ib_mad *in_mad = (const struct ib_mad *)in;
69 struct ib_mad *out_mad = (struct ib_mad *)out; 69 struct ib_mad *out_mad = (struct ib_mad *)out;
70 70
71 BUG_ON(in_mad_size != sizeof(*in_mad) || 71 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
72 *out_mad_size != sizeof(*out_mad)); 72 *out_mad_size != sizeof(*out_mad)))
73 return IB_MAD_RESULT_FAILURE;
73 74
74 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE); 75 slid = in_wc ? in_wc->slid : be16_to_cpu(IB_LID_PERMISSIVE);
75 76
diff --git a/drivers/infiniband/hw/mthca/mthca_mad.c b/drivers/infiniband/hw/mthca/mthca_mad.c
index 6b2418b74c99..7c3f2fb44ba5 100644
--- a/drivers/infiniband/hw/mthca/mthca_mad.c
+++ b/drivers/infiniband/hw/mthca/mthca_mad.c
@@ -209,8 +209,9 @@ int mthca_process_mad(struct ib_device *ibdev,
209 const struct ib_mad *in_mad = (const struct ib_mad *)in; 209 const struct ib_mad *in_mad = (const struct ib_mad *)in;
210 struct ib_mad *out_mad = (struct ib_mad *)out; 210 struct ib_mad *out_mad = (struct ib_mad *)out;
211 211
212 BUG_ON(in_mad_size != sizeof(*in_mad) || 212 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
213 *out_mad_size != sizeof(*out_mad)); 213 *out_mad_size != sizeof(*out_mad)))
214 return IB_MAD_RESULT_FAILURE;
214 215
215 /* Forward locally generated traps to the SM */ 216 /* Forward locally generated traps to the SM */
216 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP && 217 if (in_mad->mad_hdr.method == IB_MGMT_METHOD_TRAP &&
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 9047af429906..8a3ad170d790 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1520,8 +1520,9 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
1520 int rc = arpindex; 1520 int rc = arpindex;
1521 struct net_device *netdev; 1521 struct net_device *netdev;
1522 struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter; 1522 struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
1523 __be32 dst_ipaddr = htonl(dst_ip);
1523 1524
1524 rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0); 1525 rt = ip_route_output(&init_net, dst_ipaddr, nesvnic->local_ipaddr, 0, 0);
1525 if (IS_ERR(rt)) { 1526 if (IS_ERR(rt)) {
1526 printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n", 1527 printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
1527 __func__, dst_ip); 1528 __func__, dst_ip);
@@ -1533,7 +1534,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
1533 else 1534 else
1534 netdev = nesvnic->netdev; 1535 netdev = nesvnic->netdev;
1535 1536
1536 neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev); 1537 neigh = dst_neigh_lookup(&rt->dst, &dst_ipaddr);
1537 1538
1538 rcu_read_lock(); 1539 rcu_read_lock();
1539 if (neigh) { 1540 if (neigh) {
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 02120d340d50..4713dd7ed764 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -3861,7 +3861,7 @@ void nes_manage_arp_cache(struct net_device *netdev, unsigned char *mac_addr,
3861 (((u32)mac_addr[2]) << 24) | (((u32)mac_addr[3]) << 16) | 3861 (((u32)mac_addr[2]) << 24) | (((u32)mac_addr[3]) << 16) |
3862 (((u32)mac_addr[4]) << 8) | (u32)mac_addr[5]); 3862 (((u32)mac_addr[4]) << 8) | (u32)mac_addr[5]);
3863 cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = cpu_to_le32( 3863 cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = cpu_to_le32(
3864 (((u32)mac_addr[0]) << 16) | (u32)mac_addr[1]); 3864 (((u32)mac_addr[0]) << 8) | (u32)mac_addr[1]);
3865 } else { 3865 } else {
3866 cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_ADDR_LOW_IDX] = 0; 3866 cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_ADDR_LOW_IDX] = 0;
3867 cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = 0; 3867 cqp_wqe->wqe_words[NES_CQP_ARP_WQE_MAC_HIGH_IDX] = 0;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
index 4bafa15708d0..29b27675dd70 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
@@ -215,8 +215,9 @@ int ocrdma_process_mad(struct ib_device *ibdev,
215 const struct ib_mad *in_mad = (const struct ib_mad *)in; 215 const struct ib_mad *in_mad = (const struct ib_mad *)in;
216 struct ib_mad *out_mad = (struct ib_mad *)out; 216 struct ib_mad *out_mad = (struct ib_mad *)out;
217 217
218 BUG_ON(in_mad_size != sizeof(*in_mad) || 218 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
219 *out_mad_size != sizeof(*out_mad)); 219 *out_mad_size != sizeof(*out_mad)))
220 return IB_MAD_RESULT_FAILURE;
220 221
221 switch (in_mad->mad_hdr.mgmt_class) { 222 switch (in_mad->mad_hdr.mgmt_class) {
222 case IB_MGMT_CLASS_PERF_MGMT: 223 case IB_MGMT_CLASS_PERF_MGMT:
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index 8a1398b253a2..d98a707a5eb9 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -696,6 +696,7 @@ static void __exit ocrdma_exit_module(void)
696 ocrdma_unregister_inet6addr_notifier(); 696 ocrdma_unregister_inet6addr_notifier();
697 ocrdma_unregister_inetaddr_notifier(); 697 ocrdma_unregister_inetaddr_notifier();
698 ocrdma_rem_debugfs(); 698 ocrdma_rem_debugfs();
699 idr_destroy(&ocrdma_dev_id);
699} 700}
700 701
701module_init(ocrdma_init_module); 702module_init(ocrdma_init_module);
diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
index 05e3242d8442..9625e7c438e5 100644
--- a/drivers/infiniband/hw/qib/qib_mad.c
+++ b/drivers/infiniband/hw/qib/qib_mad.c
@@ -2412,8 +2412,9 @@ int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,
2412 const struct ib_mad *in_mad = (const struct ib_mad *)in; 2412 const struct ib_mad *in_mad = (const struct ib_mad *)in;
2413 struct ib_mad *out_mad = (struct ib_mad *)out; 2413 struct ib_mad *out_mad = (struct ib_mad *)out;
2414 2414
2415 BUG_ON(in_mad_size != sizeof(*in_mad) || 2415 if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) ||
2416 *out_mad_size != sizeof(*out_mad)); 2416 *out_mad_size != sizeof(*out_mad)))
2417 return IB_MAD_RESULT_FAILURE;
2417 2418
2418 switch (in_mad->mad_hdr.mgmt_class) { 2419 switch (in_mad->mad_hdr.mgmt_class) {
2419 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE: 2420 case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE:
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index bd94b0a6e9e5..79859c4d43c9 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -239,7 +239,7 @@ struct ipoib_cm_tx {
239 struct net_device *dev; 239 struct net_device *dev;
240 struct ipoib_neigh *neigh; 240 struct ipoib_neigh *neigh;
241 struct ipoib_path *path; 241 struct ipoib_path *path;
242 struct ipoib_cm_tx_buf *tx_ring; 242 struct ipoib_tx_buf *tx_ring;
243 unsigned tx_head; 243 unsigned tx_head;
244 unsigned tx_tail; 244 unsigned tx_tail;
245 unsigned long flags; 245 unsigned long flags;
@@ -504,6 +504,33 @@ int ipoib_mcast_stop_thread(struct net_device *dev);
504void ipoib_mcast_dev_down(struct net_device *dev); 504void ipoib_mcast_dev_down(struct net_device *dev);
505void ipoib_mcast_dev_flush(struct net_device *dev); 505void ipoib_mcast_dev_flush(struct net_device *dev);
506 506
507int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req);
508void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv,
509 struct ipoib_tx_buf *tx_req);
510
511static inline void ipoib_build_sge(struct ipoib_dev_priv *priv,
512 struct ipoib_tx_buf *tx_req)
513{
514 int i, off;
515 struct sk_buff *skb = tx_req->skb;
516 skb_frag_t *frags = skb_shinfo(skb)->frags;
517 int nr_frags = skb_shinfo(skb)->nr_frags;
518 u64 *mapping = tx_req->mapping;
519
520 if (skb_headlen(skb)) {
521 priv->tx_sge[0].addr = mapping[0];
522 priv->tx_sge[0].length = skb_headlen(skb);
523 off = 1;
524 } else
525 off = 0;
526
527 for (i = 0; i < nr_frags; ++i) {
528 priv->tx_sge[i + off].addr = mapping[i + off];
529 priv->tx_sge[i + off].length = skb_frag_size(&frags[i]);
530 }
531 priv->tx_wr.num_sge = nr_frags + off;
532}
533
507#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG 534#ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
508struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev); 535struct ipoib_mcast_iter *ipoib_mcast_iter_init(struct net_device *dev);
509int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter); 536int ipoib_mcast_iter_next(struct ipoib_mcast_iter *iter);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index cf32a778e7d0..ee39be6ccfb0 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -694,14 +694,12 @@ repost:
694static inline int post_send(struct ipoib_dev_priv *priv, 694static inline int post_send(struct ipoib_dev_priv *priv,
695 struct ipoib_cm_tx *tx, 695 struct ipoib_cm_tx *tx,
696 unsigned int wr_id, 696 unsigned int wr_id,
697 u64 addr, int len) 697 struct ipoib_tx_buf *tx_req)
698{ 698{
699 struct ib_send_wr *bad_wr; 699 struct ib_send_wr *bad_wr;
700 700
701 priv->tx_sge[0].addr = addr; 701 ipoib_build_sge(priv, tx_req);
702 priv->tx_sge[0].length = len;
703 702
704 priv->tx_wr.num_sge = 1;
705 priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM; 703 priv->tx_wr.wr_id = wr_id | IPOIB_OP_CM;
706 704
707 return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr); 705 return ib_post_send(tx->qp, &priv->tx_wr, &bad_wr);
@@ -710,8 +708,7 @@ static inline int post_send(struct ipoib_dev_priv *priv,
710void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx) 708void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_tx *tx)
711{ 709{
712 struct ipoib_dev_priv *priv = netdev_priv(dev); 710 struct ipoib_dev_priv *priv = netdev_priv(dev);
713 struct ipoib_cm_tx_buf *tx_req; 711 struct ipoib_tx_buf *tx_req;
714 u64 addr;
715 int rc; 712 int rc;
716 713
717 if (unlikely(skb->len > tx->mtu)) { 714 if (unlikely(skb->len > tx->mtu)) {
@@ -735,24 +732,21 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
735 */ 732 */
736 tx_req = &tx->tx_ring[tx->tx_head & (ipoib_sendq_size - 1)]; 733 tx_req = &tx->tx_ring[tx->tx_head & (ipoib_sendq_size - 1)];
737 tx_req->skb = skb; 734 tx_req->skb = skb;
738 addr = ib_dma_map_single(priv->ca, skb->data, skb->len, DMA_TO_DEVICE); 735
739 if (unlikely(ib_dma_mapping_error(priv->ca, addr))) { 736 if (unlikely(ipoib_dma_map_tx(priv->ca, tx_req))) {
740 ++dev->stats.tx_errors; 737 ++dev->stats.tx_errors;
741 dev_kfree_skb_any(skb); 738 dev_kfree_skb_any(skb);
742 return; 739 return;
743 } 740 }
744 741
745 tx_req->mapping = addr;
746
747 skb_orphan(skb); 742 skb_orphan(skb);
748 skb_dst_drop(skb); 743 skb_dst_drop(skb);
749 744
750 rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), 745 rc = post_send(priv, tx, tx->tx_head & (ipoib_sendq_size - 1), tx_req);
751 addr, skb->len);
752 if (unlikely(rc)) { 746 if (unlikely(rc)) {
753 ipoib_warn(priv, "post_send failed, error %d\n", rc); 747 ipoib_warn(priv, "post_send failed, error %d\n", rc);
754 ++dev->stats.tx_errors; 748 ++dev->stats.tx_errors;
755 ib_dma_unmap_single(priv->ca, addr, skb->len, DMA_TO_DEVICE); 749 ipoib_dma_unmap_tx(priv, tx_req);
756 dev_kfree_skb_any(skb); 750 dev_kfree_skb_any(skb);
757 } else { 751 } else {
758 dev->trans_start = jiffies; 752 dev->trans_start = jiffies;
@@ -777,7 +771,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
777 struct ipoib_dev_priv *priv = netdev_priv(dev); 771 struct ipoib_dev_priv *priv = netdev_priv(dev);
778 struct ipoib_cm_tx *tx = wc->qp->qp_context; 772 struct ipoib_cm_tx *tx = wc->qp->qp_context;
779 unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM; 773 unsigned int wr_id = wc->wr_id & ~IPOIB_OP_CM;
780 struct ipoib_cm_tx_buf *tx_req; 774 struct ipoib_tx_buf *tx_req;
781 unsigned long flags; 775 unsigned long flags;
782 776
783 ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n", 777 ipoib_dbg_data(priv, "cm send completion: id %d, status: %d\n",
@@ -791,7 +785,7 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
791 785
792 tx_req = &tx->tx_ring[wr_id]; 786 tx_req = &tx->tx_ring[wr_id];
793 787
794 ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len, DMA_TO_DEVICE); 788 ipoib_dma_unmap_tx(priv, tx_req);
795 789
796 /* FIXME: is this right? Shouldn't we only increment on success? */ 790 /* FIXME: is this right? Shouldn't we only increment on success? */
797 ++dev->stats.tx_packets; 791 ++dev->stats.tx_packets;
@@ -1036,6 +1030,9 @@ static struct ib_qp *ipoib_cm_create_tx_qp(struct net_device *dev, struct ipoib_
1036 1030
1037 struct ib_qp *tx_qp; 1031 struct ib_qp *tx_qp;
1038 1032
1033 if (dev->features & NETIF_F_SG)
1034 attr.cap.max_send_sge = MAX_SKB_FRAGS + 1;
1035
1039 tx_qp = ib_create_qp(priv->pd, &attr); 1036 tx_qp = ib_create_qp(priv->pd, &attr);
1040 if (PTR_ERR(tx_qp) == -EINVAL) { 1037 if (PTR_ERR(tx_qp) == -EINVAL) {
1041 ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n", 1038 ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n",
@@ -1170,7 +1167,7 @@ err_tx:
1170static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p) 1167static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
1171{ 1168{
1172 struct ipoib_dev_priv *priv = netdev_priv(p->dev); 1169 struct ipoib_dev_priv *priv = netdev_priv(p->dev);
1173 struct ipoib_cm_tx_buf *tx_req; 1170 struct ipoib_tx_buf *tx_req;
1174 unsigned long begin; 1171 unsigned long begin;
1175 1172
1176 ipoib_dbg(priv, "Destroy active connection 0x%x head 0x%x tail 0x%x\n", 1173 ipoib_dbg(priv, "Destroy active connection 0x%x head 0x%x tail 0x%x\n",
@@ -1197,8 +1194,7 @@ timeout:
1197 1194
1198 while ((int) p->tx_tail - (int) p->tx_head < 0) { 1195 while ((int) p->tx_tail - (int) p->tx_head < 0) {
1199 tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)]; 1196 tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)];
1200 ib_dma_unmap_single(priv->ca, tx_req->mapping, tx_req->skb->len, 1197 ipoib_dma_unmap_tx(priv, tx_req);
1201 DMA_TO_DEVICE);
1202 dev_kfree_skb_any(tx_req->skb); 1198 dev_kfree_skb_any(tx_req->skb);
1203 ++p->tx_tail; 1199 ++p->tx_tail;
1204 netif_tx_lock_bh(p->dev); 1200 netif_tx_lock_bh(p->dev);
@@ -1455,7 +1451,6 @@ static void ipoib_cm_stale_task(struct work_struct *work)
1455 spin_unlock_irq(&priv->lock); 1451 spin_unlock_irq(&priv->lock);
1456} 1452}
1457 1453
1458
1459static ssize_t show_mode(struct device *d, struct device_attribute *attr, 1454static ssize_t show_mode(struct device *d, struct device_attribute *attr,
1460 char *buf) 1455 char *buf)
1461{ 1456{
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 63b92cbb29ad..d266667ca9b8 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -263,8 +263,7 @@ repost:
263 "for buf %d\n", wr_id); 263 "for buf %d\n", wr_id);
264} 264}
265 265
266static int ipoib_dma_map_tx(struct ib_device *ca, 266int ipoib_dma_map_tx(struct ib_device *ca, struct ipoib_tx_buf *tx_req)
267 struct ipoib_tx_buf *tx_req)
268{ 267{
269 struct sk_buff *skb = tx_req->skb; 268 struct sk_buff *skb = tx_req->skb;
270 u64 *mapping = tx_req->mapping; 269 u64 *mapping = tx_req->mapping;
@@ -305,8 +304,8 @@ partial_error:
305 return -EIO; 304 return -EIO;
306} 305}
307 306
308static void ipoib_dma_unmap_tx(struct ib_device *ca, 307void ipoib_dma_unmap_tx(struct ipoib_dev_priv *priv,
309 struct ipoib_tx_buf *tx_req) 308 struct ipoib_tx_buf *tx_req)
310{ 309{
311 struct sk_buff *skb = tx_req->skb; 310 struct sk_buff *skb = tx_req->skb;
312 u64 *mapping = tx_req->mapping; 311 u64 *mapping = tx_req->mapping;
@@ -314,7 +313,8 @@ static void ipoib_dma_unmap_tx(struct ib_device *ca,
314 int off; 313 int off;
315 314
316 if (skb_headlen(skb)) { 315 if (skb_headlen(skb)) {
317 ib_dma_unmap_single(ca, mapping[0], skb_headlen(skb), DMA_TO_DEVICE); 316 ib_dma_unmap_single(priv->ca, mapping[0], skb_headlen(skb),
317 DMA_TO_DEVICE);
318 off = 1; 318 off = 1;
319 } else 319 } else
320 off = 0; 320 off = 0;
@@ -322,8 +322,8 @@ static void ipoib_dma_unmap_tx(struct ib_device *ca,
322 for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) { 322 for (i = 0; i < skb_shinfo(skb)->nr_frags; ++i) {
323 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 323 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
324 324
325 ib_dma_unmap_page(ca, mapping[i + off], skb_frag_size(frag), 325 ib_dma_unmap_page(priv->ca, mapping[i + off],
326 DMA_TO_DEVICE); 326 skb_frag_size(frag), DMA_TO_DEVICE);
327 } 327 }
328} 328}
329 329
@@ -389,7 +389,7 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
389 389
390 tx_req = &priv->tx_ring[wr_id]; 390 tx_req = &priv->tx_ring[wr_id];
391 391
392 ipoib_dma_unmap_tx(priv->ca, tx_req); 392 ipoib_dma_unmap_tx(priv, tx_req);
393 393
394 ++dev->stats.tx_packets; 394 ++dev->stats.tx_packets;
395 dev->stats.tx_bytes += tx_req->skb->len; 395 dev->stats.tx_bytes += tx_req->skb->len;
@@ -514,24 +514,10 @@ static inline int post_send(struct ipoib_dev_priv *priv,
514 void *head, int hlen) 514 void *head, int hlen)
515{ 515{
516 struct ib_send_wr *bad_wr; 516 struct ib_send_wr *bad_wr;
517 int i, off;
518 struct sk_buff *skb = tx_req->skb; 517 struct sk_buff *skb = tx_req->skb;
519 skb_frag_t *frags = skb_shinfo(skb)->frags;
520 int nr_frags = skb_shinfo(skb)->nr_frags;
521 u64 *mapping = tx_req->mapping;
522 518
523 if (skb_headlen(skb)) { 519 ipoib_build_sge(priv, tx_req);
524 priv->tx_sge[0].addr = mapping[0];
525 priv->tx_sge[0].length = skb_headlen(skb);
526 off = 1;
527 } else
528 off = 0;
529 520
530 for (i = 0; i < nr_frags; ++i) {
531 priv->tx_sge[i + off].addr = mapping[i + off];
532 priv->tx_sge[i + off].length = skb_frag_size(&frags[i]);
533 }
534 priv->tx_wr.num_sge = nr_frags + off;
535 priv->tx_wr.wr_id = wr_id; 521 priv->tx_wr.wr_id = wr_id;
536 priv->tx_wr.wr.ud.remote_qpn = qpn; 522 priv->tx_wr.wr.ud.remote_qpn = qpn;
537 priv->tx_wr.wr.ud.ah = address; 523 priv->tx_wr.wr.ud.ah = address;
@@ -617,7 +603,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
617 ipoib_warn(priv, "post_send failed, error %d\n", rc); 603 ipoib_warn(priv, "post_send failed, error %d\n", rc);
618 ++dev->stats.tx_errors; 604 ++dev->stats.tx_errors;
619 --priv->tx_outstanding; 605 --priv->tx_outstanding;
620 ipoib_dma_unmap_tx(priv->ca, tx_req); 606 ipoib_dma_unmap_tx(priv, tx_req);
621 dev_kfree_skb_any(skb); 607 dev_kfree_skb_any(skb);
622 if (netif_queue_stopped(dev)) 608 if (netif_queue_stopped(dev))
623 netif_wake_queue(dev); 609 netif_wake_queue(dev);
@@ -868,7 +854,7 @@ int ipoib_ib_dev_stop(struct net_device *dev)
868 while ((int) priv->tx_tail - (int) priv->tx_head < 0) { 854 while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
869 tx_req = &priv->tx_ring[priv->tx_tail & 855 tx_req = &priv->tx_ring[priv->tx_tail &
870 (ipoib_sendq_size - 1)]; 856 (ipoib_sendq_size - 1)];
871 ipoib_dma_unmap_tx(priv->ca, tx_req); 857 ipoib_dma_unmap_tx(priv, tx_req);
872 dev_kfree_skb_any(tx_req->skb); 858 dev_kfree_skb_any(tx_req->skb);
873 ++priv->tx_tail; 859 ++priv->tx_tail;
874 --priv->tx_outstanding; 860 --priv->tx_outstanding;
@@ -985,20 +971,21 @@ static inline int update_child_pkey(struct ipoib_dev_priv *priv)
985} 971}
986 972
987static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, 973static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,
988 enum ipoib_flush_level level) 974 enum ipoib_flush_level level,
975 int nesting)
989{ 976{
990 struct ipoib_dev_priv *cpriv; 977 struct ipoib_dev_priv *cpriv;
991 struct net_device *dev = priv->dev; 978 struct net_device *dev = priv->dev;
992 int result; 979 int result;
993 980
994 down_read(&priv->vlan_rwsem); 981 down_read_nested(&priv->vlan_rwsem, nesting);
995 982
996 /* 983 /*
997 * Flush any child interfaces too -- they might be up even if 984 * Flush any child interfaces too -- they might be up even if
998 * the parent is down. 985 * the parent is down.
999 */ 986 */
1000 list_for_each_entry(cpriv, &priv->child_intfs, list) 987 list_for_each_entry(cpriv, &priv->child_intfs, list)
1001 __ipoib_ib_dev_flush(cpriv, level); 988 __ipoib_ib_dev_flush(cpriv, level, nesting + 1);
1002 989
1003 up_read(&priv->vlan_rwsem); 990 up_read(&priv->vlan_rwsem);
1004 991
@@ -1076,7 +1063,7 @@ void ipoib_ib_dev_flush_light(struct work_struct *work)
1076 struct ipoib_dev_priv *priv = 1063 struct ipoib_dev_priv *priv =
1077 container_of(work, struct ipoib_dev_priv, flush_light); 1064 container_of(work, struct ipoib_dev_priv, flush_light);
1078 1065
1079 __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_LIGHT); 1066 __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_LIGHT, 0);
1080} 1067}
1081 1068
1082void ipoib_ib_dev_flush_normal(struct work_struct *work) 1069void ipoib_ib_dev_flush_normal(struct work_struct *work)
@@ -1084,7 +1071,7 @@ void ipoib_ib_dev_flush_normal(struct work_struct *work)
1084 struct ipoib_dev_priv *priv = 1071 struct ipoib_dev_priv *priv =
1085 container_of(work, struct ipoib_dev_priv, flush_normal); 1072 container_of(work, struct ipoib_dev_priv, flush_normal);
1086 1073
1087 __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_NORMAL); 1074 __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_NORMAL, 0);
1088} 1075}
1089 1076
1090void ipoib_ib_dev_flush_heavy(struct work_struct *work) 1077void ipoib_ib_dev_flush_heavy(struct work_struct *work)
@@ -1092,7 +1079,7 @@ void ipoib_ib_dev_flush_heavy(struct work_struct *work)
1092 struct ipoib_dev_priv *priv = 1079 struct ipoib_dev_priv *priv =
1093 container_of(work, struct ipoib_dev_priv, flush_heavy); 1080 container_of(work, struct ipoib_dev_priv, flush_heavy);
1094 1081
1095 __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY); 1082 __ipoib_ib_dev_flush(priv, IPOIB_FLUSH_HEAVY, 0);
1096} 1083}
1097 1084
1098void ipoib_ib_dev_cleanup(struct net_device *dev) 1085void ipoib_ib_dev_cleanup(struct net_device *dev)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index da149c278cb8..b2943c84a5dd 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -190,7 +190,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
190 struct ipoib_dev_priv *priv = netdev_priv(dev); 190 struct ipoib_dev_priv *priv = netdev_priv(dev);
191 191
192 if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags)) 192 if (test_bit(IPOIB_FLAG_ADMIN_CM, &priv->flags))
193 features &= ~(NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO); 193 features &= ~(NETIF_F_IP_CSUM | NETIF_F_TSO);
194 194
195 return features; 195 return features;
196} 196}
@@ -232,6 +232,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf)
232 ipoib_warn(priv, "enabling connected mode " 232 ipoib_warn(priv, "enabling connected mode "
233 "will cause multicast packet drops\n"); 233 "will cause multicast packet drops\n");
234 netdev_update_features(dev); 234 netdev_update_features(dev);
235 dev_set_mtu(dev, ipoib_cm_max_mtu(dev));
235 rtnl_unlock(); 236 rtnl_unlock();
236 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM; 237 priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
237 238
@@ -1577,7 +1578,8 @@ static struct net_device *ipoib_add_port(const char *format,
1577 SET_NETDEV_DEV(priv->dev, hca->dma_device); 1578 SET_NETDEV_DEV(priv->dev, hca->dma_device);
1578 priv->dev->dev_id = port - 1; 1579 priv->dev->dev_id = port - 1;
1579 1580
1580 if (!ib_query_port(hca, port, &attr)) 1581 result = ib_query_port(hca, port, &attr);
1582 if (!result)
1581 priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu); 1583 priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);
1582 else { 1584 else {
1583 printk(KERN_WARNING "%s: ib_query_port %d failed\n", 1585 printk(KERN_WARNING "%s: ib_query_port %d failed\n",
@@ -1598,7 +1600,8 @@ static struct net_device *ipoib_add_port(const char *format,
1598 goto device_init_failed; 1600 goto device_init_failed;
1599 } 1601 }
1600 1602
1601 if (ipoib_set_dev_features(priv, hca)) 1603 result = ipoib_set_dev_features(priv, hca);
1604 if (result)
1602 goto device_init_failed; 1605 goto device_init_failed;
1603 1606
1604 /* 1607 /*
@@ -1684,7 +1687,7 @@ static void ipoib_add_one(struct ib_device *device)
1684 struct list_head *dev_list; 1687 struct list_head *dev_list;
1685 struct net_device *dev; 1688 struct net_device *dev;
1686 struct ipoib_dev_priv *priv; 1689 struct ipoib_dev_priv *priv;
1687 int s, e, p; 1690 int p;
1688 int count = 0; 1691 int count = 0;
1689 1692
1690 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); 1693 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
@@ -1693,15 +1696,7 @@ static void ipoib_add_one(struct ib_device *device)
1693 1696
1694 INIT_LIST_HEAD(dev_list); 1697 INIT_LIST_HEAD(dev_list);
1695 1698
1696 if (device->node_type == RDMA_NODE_IB_SWITCH) { 1699 for (p = rdma_start_port(device); p <= rdma_end_port(device); ++p) {
1697 s = 0;
1698 e = 0;
1699 } else {
1700 s = 1;
1701 e = device->phys_port_cnt;
1702 }
1703
1704 for (p = s; p <= e; ++p) {
1705 if (!rdma_protocol_ib(device, p)) 1700 if (!rdma_protocol_ib(device, p))
1706 continue; 1701 continue;
1707 dev = ipoib_add_port("ib%d", device, p); 1702 dev = ipoib_add_port("ib%d", device, p);
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 267dc4f75502..31a20b462266 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -161,13 +161,10 @@ static int srp_tmo_set(const char *val, const struct kernel_param *kp)
161{ 161{
162 int tmo, res; 162 int tmo, res;
163 163
164 if (strncmp(val, "off", 3) != 0) { 164 res = srp_parse_tmo(&tmo, val);
165 res = kstrtoint(val, 0, &tmo); 165 if (res)
166 if (res) 166 goto out;
167 goto out; 167
168 } else {
169 tmo = -1;
170 }
171 if (kp->arg == &srp_reconnect_delay) 168 if (kp->arg == &srp_reconnect_delay)
172 res = srp_tmo_valid(tmo, srp_fast_io_fail_tmo, 169 res = srp_tmo_valid(tmo, srp_fast_io_fail_tmo,
173 srp_dev_loss_tmo); 170 srp_dev_loss_tmo);
@@ -3379,7 +3376,7 @@ static void srp_add_one(struct ib_device *device)
3379 struct srp_device *srp_dev; 3376 struct srp_device *srp_dev;
3380 struct ib_device_attr *dev_attr; 3377 struct ib_device_attr *dev_attr;
3381 struct srp_host *host; 3378 struct srp_host *host;
3382 int mr_page_shift, s, e, p; 3379 int mr_page_shift, p;
3383 u64 max_pages_per_mr; 3380 u64 max_pages_per_mr;
3384 3381
3385 dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL); 3382 dev_attr = kmalloc(sizeof *dev_attr, GFP_KERNEL);
@@ -3443,15 +3440,7 @@ static void srp_add_one(struct ib_device *device)
3443 if (IS_ERR(srp_dev->mr)) 3440 if (IS_ERR(srp_dev->mr))
3444 goto err_pd; 3441 goto err_pd;
3445 3442
3446 if (device->node_type == RDMA_NODE_IB_SWITCH) { 3443 for (p = rdma_start_port(device); p <= rdma_end_port(device); ++p) {
3447 s = 0;
3448 e = 0;
3449 } else {
3450 s = 1;
3451 e = device->phys_port_cnt;
3452 }
3453
3454 for (p = s; p <= e; ++p) {
3455 host = srp_add_port(srp_dev, p); 3444 host = srp_add_port(srp_dev, p);
3456 if (host) 3445 if (host)
3457 list_add_tail(&host->list, &srp_dev->dev_list); 3446 list_add_tail(&host->list, &srp_dev->dev_list);
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 82897ca17f32..60ff0a2390e5 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -302,7 +302,7 @@ static void srpt_get_iou(struct ib_dm_mad *mad)
302 int i; 302 int i;
303 303
304 ioui = (struct ib_dm_iou_info *)mad->data; 304 ioui = (struct ib_dm_iou_info *)mad->data;
305 ioui->change_id = __constant_cpu_to_be16(1); 305 ioui->change_id = cpu_to_be16(1);
306 ioui->max_controllers = 16; 306 ioui->max_controllers = 16;
307 307
308 /* set present for slot 1 and empty for the rest */ 308 /* set present for slot 1 and empty for the rest */
@@ -330,13 +330,13 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot,
330 330
331 if (!slot || slot > 16) { 331 if (!slot || slot > 16) {
332 mad->mad_hdr.status 332 mad->mad_hdr.status
333 = __constant_cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); 333 = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
334 return; 334 return;
335 } 335 }
336 336
337 if (slot > 2) { 337 if (slot > 2) {
338 mad->mad_hdr.status 338 mad->mad_hdr.status
339 = __constant_cpu_to_be16(DM_MAD_STATUS_NO_IOC); 339 = cpu_to_be16(DM_MAD_STATUS_NO_IOC);
340 return; 340 return;
341 } 341 }
342 342
@@ -348,10 +348,10 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot,
348 iocp->device_version = cpu_to_be16(sdev->dev_attr.hw_ver); 348 iocp->device_version = cpu_to_be16(sdev->dev_attr.hw_ver);
349 iocp->subsys_vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id); 349 iocp->subsys_vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id);
350 iocp->subsys_device_id = 0x0; 350 iocp->subsys_device_id = 0x0;
351 iocp->io_class = __constant_cpu_to_be16(SRP_REV16A_IB_IO_CLASS); 351 iocp->io_class = cpu_to_be16(SRP_REV16A_IB_IO_CLASS);
352 iocp->io_subclass = __constant_cpu_to_be16(SRP_IO_SUBCLASS); 352 iocp->io_subclass = cpu_to_be16(SRP_IO_SUBCLASS);
353 iocp->protocol = __constant_cpu_to_be16(SRP_PROTOCOL); 353 iocp->protocol = cpu_to_be16(SRP_PROTOCOL);
354 iocp->protocol_version = __constant_cpu_to_be16(SRP_PROTOCOL_VERSION); 354 iocp->protocol_version = cpu_to_be16(SRP_PROTOCOL_VERSION);
355 iocp->send_queue_depth = cpu_to_be16(sdev->srq_size); 355 iocp->send_queue_depth = cpu_to_be16(sdev->srq_size);
356 iocp->rdma_read_depth = 4; 356 iocp->rdma_read_depth = 4;
357 iocp->send_size = cpu_to_be32(srp_max_req_size); 357 iocp->send_size = cpu_to_be32(srp_max_req_size);
@@ -379,13 +379,13 @@ static void srpt_get_svc_entries(u64 ioc_guid,
379 379
380 if (!slot || slot > 16) { 380 if (!slot || slot > 16) {
381 mad->mad_hdr.status 381 mad->mad_hdr.status
382 = __constant_cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD); 382 = cpu_to_be16(DM_MAD_STATUS_INVALID_FIELD);
383 return; 383 return;
384 } 384 }
385 385
386 if (slot > 2 || lo > hi || hi > 1) { 386 if (slot > 2 || lo > hi || hi > 1) {
387 mad->mad_hdr.status 387 mad->mad_hdr.status
388 = __constant_cpu_to_be16(DM_MAD_STATUS_NO_IOC); 388 = cpu_to_be16(DM_MAD_STATUS_NO_IOC);
389 return; 389 return;
390 } 390 }
391 391
@@ -436,7 +436,7 @@ static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad,
436 break; 436 break;
437 default: 437 default:
438 rsp_mad->mad_hdr.status = 438 rsp_mad->mad_hdr.status =
439 __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); 439 cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR);
440 break; 440 break;
441 } 441 }
442} 442}
@@ -493,11 +493,11 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
493 break; 493 break;
494 case IB_MGMT_METHOD_SET: 494 case IB_MGMT_METHOD_SET:
495 dm_mad->mad_hdr.status = 495 dm_mad->mad_hdr.status =
496 __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR); 496 cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD_ATTR);
497 break; 497 break;
498 default: 498 default:
499 dm_mad->mad_hdr.status = 499 dm_mad->mad_hdr.status =
500 __constant_cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD); 500 cpu_to_be16(DM_MAD_STATUS_UNSUP_METHOD);
501 break; 501 break;
502 } 502 }
503 503
@@ -1535,7 +1535,7 @@ static int srpt_build_cmd_rsp(struct srpt_rdma_ch *ch,
1535 memset(srp_rsp, 0, sizeof *srp_rsp); 1535 memset(srp_rsp, 0, sizeof *srp_rsp);
1536 srp_rsp->opcode = SRP_RSP; 1536 srp_rsp->opcode = SRP_RSP;
1537 srp_rsp->req_lim_delta = 1537 srp_rsp->req_lim_delta =
1538 __constant_cpu_to_be32(1 + atomic_xchg(&ch->req_lim_delta, 0)); 1538 cpu_to_be32(1 + atomic_xchg(&ch->req_lim_delta, 0));
1539 srp_rsp->tag = tag; 1539 srp_rsp->tag = tag;
1540 srp_rsp->status = status; 1540 srp_rsp->status = status;
1541 1541
@@ -1585,8 +1585,8 @@ static int srpt_build_tskmgmt_rsp(struct srpt_rdma_ch *ch,
1585 memset(srp_rsp, 0, sizeof *srp_rsp); 1585 memset(srp_rsp, 0, sizeof *srp_rsp);
1586 1586
1587 srp_rsp->opcode = SRP_RSP; 1587 srp_rsp->opcode = SRP_RSP;
1588 srp_rsp->req_lim_delta = __constant_cpu_to_be32(1 1588 srp_rsp->req_lim_delta =
1589 + atomic_xchg(&ch->req_lim_delta, 0)); 1589 cpu_to_be32(1 + atomic_xchg(&ch->req_lim_delta, 0));
1590 srp_rsp->tag = tag; 1590 srp_rsp->tag = tag;
1591 1591
1592 srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID; 1592 srp_rsp->flags |= SRP_RSP_FLAG_RSPVALID;
@@ -1630,7 +1630,7 @@ static uint64_t srpt_unpack_lun(const uint8_t *lun, int len)
1630 switch (len) { 1630 switch (len) {
1631 case 8: 1631 case 8:
1632 if ((*((__be64 *)lun) & 1632 if ((*((__be64 *)lun) &
1633 __constant_cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0) 1633 cpu_to_be64(0x0000FFFFFFFFFFFFLL)) != 0)
1634 goto out_err; 1634 goto out_err;
1635 break; 1635 break;
1636 case 4: 1636 case 4:
@@ -2449,8 +2449,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2449 } 2449 }
2450 2450
2451 if (it_iu_len > srp_max_req_size || it_iu_len < 64) { 2451 if (it_iu_len > srp_max_req_size || it_iu_len < 64) {
2452 rej->reason = __constant_cpu_to_be32( 2452 rej->reason = cpu_to_be32(
2453 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE); 2453 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE);
2454 ret = -EINVAL; 2454 ret = -EINVAL;
2455 pr_err("rejected SRP_LOGIN_REQ because its" 2455 pr_err("rejected SRP_LOGIN_REQ because its"
2456 " length (%d bytes) is out of range (%d .. %d)\n", 2456 " length (%d bytes) is out of range (%d .. %d)\n",
@@ -2459,8 +2459,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2459 } 2459 }
2460 2460
2461 if (!sport->enabled) { 2461 if (!sport->enabled) {
2462 rej->reason = __constant_cpu_to_be32( 2462 rej->reason = cpu_to_be32(
2463 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); 2463 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2464 ret = -EINVAL; 2464 ret = -EINVAL;
2465 pr_err("rejected SRP_LOGIN_REQ because the target port" 2465 pr_err("rejected SRP_LOGIN_REQ because the target port"
2466 " has not yet been enabled\n"); 2466 " has not yet been enabled\n");
@@ -2505,8 +2505,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2505 if (*(__be64 *)req->target_port_id != cpu_to_be64(srpt_service_guid) 2505 if (*(__be64 *)req->target_port_id != cpu_to_be64(srpt_service_guid)
2506 || *(__be64 *)(req->target_port_id + 8) != 2506 || *(__be64 *)(req->target_port_id + 8) !=
2507 cpu_to_be64(srpt_service_guid)) { 2507 cpu_to_be64(srpt_service_guid)) {
2508 rej->reason = __constant_cpu_to_be32( 2508 rej->reason = cpu_to_be32(
2509 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL); 2509 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL);
2510 ret = -ENOMEM; 2510 ret = -ENOMEM;
2511 pr_err("rejected SRP_LOGIN_REQ because it" 2511 pr_err("rejected SRP_LOGIN_REQ because it"
2512 " has an invalid target port identifier.\n"); 2512 " has an invalid target port identifier.\n");
@@ -2515,8 +2515,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2515 2515
2516 ch = kzalloc(sizeof *ch, GFP_KERNEL); 2516 ch = kzalloc(sizeof *ch, GFP_KERNEL);
2517 if (!ch) { 2517 if (!ch) {
2518 rej->reason = __constant_cpu_to_be32( 2518 rej->reason = cpu_to_be32(
2519 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); 2519 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2520 pr_err("rejected SRP_LOGIN_REQ because no memory.\n"); 2520 pr_err("rejected SRP_LOGIN_REQ because no memory.\n");
2521 ret = -ENOMEM; 2521 ret = -ENOMEM;
2522 goto reject; 2522 goto reject;
@@ -2552,8 +2552,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2552 2552
2553 ret = srpt_create_ch_ib(ch); 2553 ret = srpt_create_ch_ib(ch);
2554 if (ret) { 2554 if (ret) {
2555 rej->reason = __constant_cpu_to_be32( 2555 rej->reason = cpu_to_be32(
2556 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); 2556 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2557 pr_err("rejected SRP_LOGIN_REQ because creating" 2557 pr_err("rejected SRP_LOGIN_REQ because creating"
2558 " a new RDMA channel failed.\n"); 2558 " a new RDMA channel failed.\n");
2559 goto free_ring; 2559 goto free_ring;
@@ -2561,8 +2561,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2561 2561
2562 ret = srpt_ch_qp_rtr(ch, ch->qp); 2562 ret = srpt_ch_qp_rtr(ch, ch->qp);
2563 if (ret) { 2563 if (ret) {
2564 rej->reason = __constant_cpu_to_be32( 2564 rej->reason = cpu_to_be32(SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2565 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2566 pr_err("rejected SRP_LOGIN_REQ because enabling" 2565 pr_err("rejected SRP_LOGIN_REQ because enabling"
2567 " RTR failed (error code = %d)\n", ret); 2566 " RTR failed (error code = %d)\n", ret);
2568 goto destroy_ib; 2567 goto destroy_ib;
@@ -2580,15 +2579,15 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2580 if (!nacl) { 2579 if (!nacl) {
2581 pr_info("Rejected login because no ACL has been" 2580 pr_info("Rejected login because no ACL has been"
2582 " configured yet for initiator %s.\n", ch->sess_name); 2581 " configured yet for initiator %s.\n", ch->sess_name);
2583 rej->reason = __constant_cpu_to_be32( 2582 rej->reason = cpu_to_be32(
2584 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); 2583 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED);
2585 goto destroy_ib; 2584 goto destroy_ib;
2586 } 2585 }
2587 2586
2588 ch->sess = transport_init_session(TARGET_PROT_NORMAL); 2587 ch->sess = transport_init_session(TARGET_PROT_NORMAL);
2589 if (IS_ERR(ch->sess)) { 2588 if (IS_ERR(ch->sess)) {
2590 rej->reason = __constant_cpu_to_be32( 2589 rej->reason = cpu_to_be32(
2591 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); 2590 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
2592 pr_debug("Failed to create session\n"); 2591 pr_debug("Failed to create session\n");
2593 goto deregister_session; 2592 goto deregister_session;
2594 } 2593 }
@@ -2604,8 +2603,8 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
2604 rsp->max_it_iu_len = req->req_it_iu_len; 2603 rsp->max_it_iu_len = req->req_it_iu_len;
2605 rsp->max_ti_iu_len = req->req_it_iu_len; 2604 rsp->max_ti_iu_len = req->req_it_iu_len;
2606 ch->max_ti_iu_len = it_iu_len; 2605 ch->max_ti_iu_len = it_iu_len;
2607 rsp->buf_fmt = __constant_cpu_to_be16(SRP_BUF_FORMAT_DIRECT 2606 rsp->buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT
2608 | SRP_BUF_FORMAT_INDIRECT); 2607 | SRP_BUF_FORMAT_INDIRECT);
2609 rsp->req_lim_delta = cpu_to_be32(ch->rq_size); 2608 rsp->req_lim_delta = cpu_to_be32(ch->rq_size);
2610 atomic_set(&ch->req_lim, ch->rq_size); 2609 atomic_set(&ch->req_lim, ch->rq_size);
2611 atomic_set(&ch->req_lim_delta, 0); 2610 atomic_set(&ch->req_lim_delta, 0);
@@ -2655,8 +2654,8 @@ free_ch:
2655reject: 2654reject:
2656 rej->opcode = SRP_LOGIN_REJ; 2655 rej->opcode = SRP_LOGIN_REJ;
2657 rej->tag = req->tag; 2656 rej->tag = req->tag;
2658 rej->buf_fmt = __constant_cpu_to_be16(SRP_BUF_FORMAT_DIRECT 2657 rej->buf_fmt = cpu_to_be16(SRP_BUF_FORMAT_DIRECT
2659 | SRP_BUF_FORMAT_INDIRECT); 2658 | SRP_BUF_FORMAT_INDIRECT);
2660 2659
2661 ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED, NULL, 0, 2660 ib_send_cm_rej(cm_id, IB_CM_REJ_CONSUMER_DEFINED, NULL, 0,
2662 (void *)rej, sizeof *rej); 2661 (void *)rej, sizeof *rej);
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 1b7e155869f6..c00e2db351ba 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -75,6 +75,13 @@ struct its_node {
75 75
76#define ITS_ITT_ALIGN SZ_256 76#define ITS_ITT_ALIGN SZ_256
77 77
78struct event_lpi_map {
79 unsigned long *lpi_map;
80 u16 *col_map;
81 irq_hw_number_t lpi_base;
82 int nr_lpis;
83};
84
78/* 85/*
79 * The ITS view of a device - belongs to an ITS, a collection, owns an 86 * The ITS view of a device - belongs to an ITS, a collection, owns an
80 * interrupt translation table, and a list of interrupts. 87 * interrupt translation table, and a list of interrupts.
@@ -82,11 +89,8 @@ struct its_node {
82struct its_device { 89struct its_device {
83 struct list_head entry; 90 struct list_head entry;
84 struct its_node *its; 91 struct its_node *its;
85 struct its_collection *collection; 92 struct event_lpi_map event_map;
86 void *itt; 93 void *itt;
87 unsigned long *lpi_map;
88 irq_hw_number_t lpi_base;
89 int nr_lpis;
90 u32 nr_ites; 94 u32 nr_ites;
91 u32 device_id; 95 u32 device_id;
92}; 96};
@@ -99,6 +103,14 @@ static struct rdists *gic_rdists;
99#define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist)) 103#define gic_data_rdist() (raw_cpu_ptr(gic_rdists->rdist))
100#define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base) 104#define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base)
101 105
106static struct its_collection *dev_event_to_col(struct its_device *its_dev,
107 u32 event)
108{
109 struct its_node *its = its_dev->its;
110
111 return its->collections + its_dev->event_map.col_map[event];
112}
113
102/* 114/*
103 * ITS command descriptors - parameters to be encoded in a command 115 * ITS command descriptors - parameters to be encoded in a command
104 * block. 116 * block.
@@ -134,7 +146,7 @@ struct its_cmd_desc {
134 struct { 146 struct {
135 struct its_device *dev; 147 struct its_device *dev;
136 struct its_collection *col; 148 struct its_collection *col;
137 u32 id; 149 u32 event_id;
138 } its_movi_cmd; 150 } its_movi_cmd;
139 151
140 struct { 152 struct {
@@ -241,7 +253,7 @@ static struct its_collection *its_build_mapd_cmd(struct its_cmd_block *cmd,
241 253
242 its_fixup_cmd(cmd); 254 its_fixup_cmd(cmd);
243 255
244 return desc->its_mapd_cmd.dev->collection; 256 return NULL;
245} 257}
246 258
247static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd, 259static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd,
@@ -260,52 +272,72 @@ static struct its_collection *its_build_mapc_cmd(struct its_cmd_block *cmd,
260static struct its_collection *its_build_mapvi_cmd(struct its_cmd_block *cmd, 272static struct its_collection *its_build_mapvi_cmd(struct its_cmd_block *cmd,
261 struct its_cmd_desc *desc) 273 struct its_cmd_desc *desc)
262{ 274{
275 struct its_collection *col;
276
277 col = dev_event_to_col(desc->its_mapvi_cmd.dev,
278 desc->its_mapvi_cmd.event_id);
279
263 its_encode_cmd(cmd, GITS_CMD_MAPVI); 280 its_encode_cmd(cmd, GITS_CMD_MAPVI);
264 its_encode_devid(cmd, desc->its_mapvi_cmd.dev->device_id); 281 its_encode_devid(cmd, desc->its_mapvi_cmd.dev->device_id);
265 its_encode_event_id(cmd, desc->its_mapvi_cmd.event_id); 282 its_encode_event_id(cmd, desc->its_mapvi_cmd.event_id);
266 its_encode_phys_id(cmd, desc->its_mapvi_cmd.phys_id); 283 its_encode_phys_id(cmd, desc->its_mapvi_cmd.phys_id);
267 its_encode_collection(cmd, desc->its_mapvi_cmd.dev->collection->col_id); 284 its_encode_collection(cmd, col->col_id);
268 285
269 its_fixup_cmd(cmd); 286 its_fixup_cmd(cmd);
270 287
271 return desc->its_mapvi_cmd.dev->collection; 288 return col;
272} 289}
273 290
274static struct its_collection *its_build_movi_cmd(struct its_cmd_block *cmd, 291static struct its_collection *its_build_movi_cmd(struct its_cmd_block *cmd,
275 struct its_cmd_desc *desc) 292 struct its_cmd_desc *desc)
276{ 293{
294 struct its_collection *col;
295
296 col = dev_event_to_col(desc->its_movi_cmd.dev,
297 desc->its_movi_cmd.event_id);
298
277 its_encode_cmd(cmd, GITS_CMD_MOVI); 299 its_encode_cmd(cmd, GITS_CMD_MOVI);
278 its_encode_devid(cmd, desc->its_movi_cmd.dev->device_id); 300 its_encode_devid(cmd, desc->its_movi_cmd.dev->device_id);
279 its_encode_event_id(cmd, desc->its_movi_cmd.id); 301 its_encode_event_id(cmd, desc->its_movi_cmd.event_id);
280 its_encode_collection(cmd, desc->its_movi_cmd.col->col_id); 302 its_encode_collection(cmd, desc->its_movi_cmd.col->col_id);
281 303
282 its_fixup_cmd(cmd); 304 its_fixup_cmd(cmd);
283 305
284 return desc->its_movi_cmd.dev->collection; 306 return col;
285} 307}
286 308
287static struct its_collection *its_build_discard_cmd(struct its_cmd_block *cmd, 309static struct its_collection *its_build_discard_cmd(struct its_cmd_block *cmd,
288 struct its_cmd_desc *desc) 310 struct its_cmd_desc *desc)
289{ 311{
312 struct its_collection *col;
313
314 col = dev_event_to_col(desc->its_discard_cmd.dev,
315 desc->its_discard_cmd.event_id);
316
290 its_encode_cmd(cmd, GITS_CMD_DISCARD); 317 its_encode_cmd(cmd, GITS_CMD_DISCARD);
291 its_encode_devid(cmd, desc->its_discard_cmd.dev->device_id); 318 its_encode_devid(cmd, desc->its_discard_cmd.dev->device_id);
292 its_encode_event_id(cmd, desc->its_discard_cmd.event_id); 319 its_encode_event_id(cmd, desc->its_discard_cmd.event_id);
293 320
294 its_fixup_cmd(cmd); 321 its_fixup_cmd(cmd);
295 322
296 return desc->its_discard_cmd.dev->collection; 323 return col;
297} 324}
298 325
299static struct its_collection *its_build_inv_cmd(struct its_cmd_block *cmd, 326static struct its_collection *its_build_inv_cmd(struct its_cmd_block *cmd,
300 struct its_cmd_desc *desc) 327 struct its_cmd_desc *desc)
301{ 328{
329 struct its_collection *col;
330
331 col = dev_event_to_col(desc->its_inv_cmd.dev,
332 desc->its_inv_cmd.event_id);
333
302 its_encode_cmd(cmd, GITS_CMD_INV); 334 its_encode_cmd(cmd, GITS_CMD_INV);
303 its_encode_devid(cmd, desc->its_inv_cmd.dev->device_id); 335 its_encode_devid(cmd, desc->its_inv_cmd.dev->device_id);
304 its_encode_event_id(cmd, desc->its_inv_cmd.event_id); 336 its_encode_event_id(cmd, desc->its_inv_cmd.event_id);
305 337
306 its_fixup_cmd(cmd); 338 its_fixup_cmd(cmd);
307 339
308 return desc->its_inv_cmd.dev->collection; 340 return col;
309} 341}
310 342
311static struct its_collection *its_build_invall_cmd(struct its_cmd_block *cmd, 343static struct its_collection *its_build_invall_cmd(struct its_cmd_block *cmd,
@@ -497,7 +529,7 @@ static void its_send_movi(struct its_device *dev,
497 529
498 desc.its_movi_cmd.dev = dev; 530 desc.its_movi_cmd.dev = dev;
499 desc.its_movi_cmd.col = col; 531 desc.its_movi_cmd.col = col;
500 desc.its_movi_cmd.id = id; 532 desc.its_movi_cmd.event_id = id;
501 533
502 its_send_single_command(dev->its, its_build_movi_cmd, &desc); 534 its_send_single_command(dev->its, its_build_movi_cmd, &desc);
503} 535}
@@ -528,7 +560,7 @@ static void its_send_invall(struct its_node *its, struct its_collection *col)
528static inline u32 its_get_event_id(struct irq_data *d) 560static inline u32 its_get_event_id(struct irq_data *d)
529{ 561{
530 struct its_device *its_dev = irq_data_get_irq_chip_data(d); 562 struct its_device *its_dev = irq_data_get_irq_chip_data(d);
531 return d->hwirq - its_dev->lpi_base; 563 return d->hwirq - its_dev->event_map.lpi_base;
532} 564}
533 565
534static void lpi_set_config(struct irq_data *d, bool enable) 566static void lpi_set_config(struct irq_data *d, bool enable)
@@ -583,7 +615,7 @@ static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
583 615
584 target_col = &its_dev->its->collections[cpu]; 616 target_col = &its_dev->its->collections[cpu];
585 its_send_movi(its_dev, target_col, id); 617 its_send_movi(its_dev, target_col, id);
586 its_dev->collection = target_col; 618 its_dev->event_map.col_map[id] = cpu;
587 619
588 return IRQ_SET_MASK_OK_DONE; 620 return IRQ_SET_MASK_OK_DONE;
589} 621}
@@ -713,8 +745,10 @@ out:
713 return bitmap; 745 return bitmap;
714} 746}
715 747
716static void its_lpi_free(unsigned long *bitmap, int base, int nr_ids) 748static void its_lpi_free(struct event_lpi_map *map)
717{ 749{
750 int base = map->lpi_base;
751 int nr_ids = map->nr_lpis;
718 int lpi; 752 int lpi;
719 753
720 spin_lock(&lpi_lock); 754 spin_lock(&lpi_lock);
@@ -731,7 +765,8 @@ static void its_lpi_free(unsigned long *bitmap, int base, int nr_ids)
731 765
732 spin_unlock(&lpi_lock); 766 spin_unlock(&lpi_lock);
733 767
734 kfree(bitmap); 768 kfree(map->lpi_map);
769 kfree(map->col_map);
735} 770}
736 771
737/* 772/*
@@ -1099,11 +1134,11 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
1099 struct its_device *dev; 1134 struct its_device *dev;
1100 unsigned long *lpi_map; 1135 unsigned long *lpi_map;
1101 unsigned long flags; 1136 unsigned long flags;
1137 u16 *col_map = NULL;
1102 void *itt; 1138 void *itt;
1103 int lpi_base; 1139 int lpi_base;
1104 int nr_lpis; 1140 int nr_lpis;
1105 int nr_ites; 1141 int nr_ites;
1106 int cpu;
1107 int sz; 1142 int sz;
1108 1143
1109 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1144 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
@@ -1117,20 +1152,24 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
1117 sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1; 1152 sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1;
1118 itt = kzalloc(sz, GFP_KERNEL); 1153 itt = kzalloc(sz, GFP_KERNEL);
1119 lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis); 1154 lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis);
1155 if (lpi_map)
1156 col_map = kzalloc(sizeof(*col_map) * nr_lpis, GFP_KERNEL);
1120 1157
1121 if (!dev || !itt || !lpi_map) { 1158 if (!dev || !itt || !lpi_map || !col_map) {
1122 kfree(dev); 1159 kfree(dev);
1123 kfree(itt); 1160 kfree(itt);
1124 kfree(lpi_map); 1161 kfree(lpi_map);
1162 kfree(col_map);
1125 return NULL; 1163 return NULL;
1126 } 1164 }
1127 1165
1128 dev->its = its; 1166 dev->its = its;
1129 dev->itt = itt; 1167 dev->itt = itt;
1130 dev->nr_ites = nr_ites; 1168 dev->nr_ites = nr_ites;
1131 dev->lpi_map = lpi_map; 1169 dev->event_map.lpi_map = lpi_map;
1132 dev->lpi_base = lpi_base; 1170 dev->event_map.col_map = col_map;
1133 dev->nr_lpis = nr_lpis; 1171 dev->event_map.lpi_base = lpi_base;
1172 dev->event_map.nr_lpis = nr_lpis;
1134 dev->device_id = dev_id; 1173 dev->device_id = dev_id;
1135 INIT_LIST_HEAD(&dev->entry); 1174 INIT_LIST_HEAD(&dev->entry);
1136 1175
@@ -1138,10 +1177,6 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
1138 list_add(&dev->entry, &its->its_device_list); 1177 list_add(&dev->entry, &its->its_device_list);
1139 raw_spin_unlock_irqrestore(&its->lock, flags); 1178 raw_spin_unlock_irqrestore(&its->lock, flags);
1140 1179
1141 /* Bind the device to the first possible CPU */
1142 cpu = cpumask_first(cpu_online_mask);
1143 dev->collection = &its->collections[cpu];
1144
1145 /* Map device to its ITT */ 1180 /* Map device to its ITT */
1146 its_send_mapd(dev, 1); 1181 its_send_mapd(dev, 1);
1147 1182
@@ -1163,12 +1198,13 @@ static int its_alloc_device_irq(struct its_device *dev, irq_hw_number_t *hwirq)
1163{ 1198{
1164 int idx; 1199 int idx;
1165 1200
1166 idx = find_first_zero_bit(dev->lpi_map, dev->nr_lpis); 1201 idx = find_first_zero_bit(dev->event_map.lpi_map,
1167 if (idx == dev->nr_lpis) 1202 dev->event_map.nr_lpis);
1203 if (idx == dev->event_map.nr_lpis)
1168 return -ENOSPC; 1204 return -ENOSPC;
1169 1205
1170 *hwirq = dev->lpi_base + idx; 1206 *hwirq = dev->event_map.lpi_base + idx;
1171 set_bit(idx, dev->lpi_map); 1207 set_bit(idx, dev->event_map.lpi_map);
1172 1208
1173 return 0; 1209 return 0;
1174} 1210}
@@ -1288,7 +1324,8 @@ static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
1288 irq_domain_set_hwirq_and_chip(domain, virq + i, 1324 irq_domain_set_hwirq_and_chip(domain, virq + i,
1289 hwirq, &its_irq_chip, its_dev); 1325 hwirq, &its_irq_chip, its_dev);
1290 dev_dbg(info->scratchpad[1].ptr, "ID:%d pID:%d vID:%d\n", 1326 dev_dbg(info->scratchpad[1].ptr, "ID:%d pID:%d vID:%d\n",
1291 (int)(hwirq - its_dev->lpi_base), (int)hwirq, virq + i); 1327 (int)(hwirq - its_dev->event_map.lpi_base),
1328 (int)hwirq, virq + i);
1292 } 1329 }
1293 1330
1294 return 0; 1331 return 0;
@@ -1300,6 +1337,9 @@ static void its_irq_domain_activate(struct irq_domain *domain,
1300 struct its_device *its_dev = irq_data_get_irq_chip_data(d); 1337 struct its_device *its_dev = irq_data_get_irq_chip_data(d);
1301 u32 event = its_get_event_id(d); 1338 u32 event = its_get_event_id(d);
1302 1339
1340 /* Bind the LPI to the first possible CPU */
1341 its_dev->event_map.col_map[event] = cpumask_first(cpu_online_mask);
1342
1303 /* Map the GIC IRQ and event to the device */ 1343 /* Map the GIC IRQ and event to the device */
1304 its_send_mapvi(its_dev, d->hwirq, event); 1344 its_send_mapvi(its_dev, d->hwirq, event);
1305} 1345}
@@ -1327,17 +1367,16 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq,
1327 u32 event = its_get_event_id(data); 1367 u32 event = its_get_event_id(data);
1328 1368
1329 /* Mark interrupt index as unused */ 1369 /* Mark interrupt index as unused */
1330 clear_bit(event, its_dev->lpi_map); 1370 clear_bit(event, its_dev->event_map.lpi_map);
1331 1371
1332 /* Nuke the entry in the domain */ 1372 /* Nuke the entry in the domain */
1333 irq_domain_reset_irq_data(data); 1373 irq_domain_reset_irq_data(data);
1334 } 1374 }
1335 1375
1336 /* If all interrupts have been freed, start mopping the floor */ 1376 /* If all interrupts have been freed, start mopping the floor */
1337 if (bitmap_empty(its_dev->lpi_map, its_dev->nr_lpis)) { 1377 if (bitmap_empty(its_dev->event_map.lpi_map,
1338 its_lpi_free(its_dev->lpi_map, 1378 its_dev->event_map.nr_lpis)) {
1339 its_dev->lpi_base, 1379 its_lpi_free(&its_dev->event_map);
1340 its_dev->nr_lpis);
1341 1380
1342 /* Unmap device/itt */ 1381 /* Unmap device/itt */
1343 its_send_mapd(its_dev, 0); 1382 its_send_mapd(its_dev, 0);
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c
index a45121546caf..acb721b31bcf 100644
--- a/drivers/irqchip/spear-shirq.c
+++ b/drivers/irqchip/spear-shirq.c
@@ -2,7 +2,7 @@
2 * SPEAr platform shared irq layer source file 2 * SPEAr platform shared irq layer source file
3 * 3 *
4 * Copyright (C) 2009-2012 ST Microelectronics 4 * Copyright (C) 2009-2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * Copyright (C) 2012 ST Microelectronics 7 * Copyright (C) 2012 ST Microelectronics
8 * Shiraz Hashim <shiraz.linux.kernel@gmail.com> 8 * Shiraz Hashim <shiraz.linux.kernel@gmail.com>
diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h
index a08e3eeac3c5..79a6d63e8ed3 100644
--- a/drivers/md/bcache/closure.h
+++ b/drivers/md/bcache/closure.h
@@ -320,7 +320,6 @@ static inline void closure_wake_up(struct closure_waitlist *list)
320do { \ 320do { \
321 set_closure_fn(_cl, _fn, _wq); \ 321 set_closure_fn(_cl, _fn, _wq); \
322 closure_sub(_cl, CLOSURE_RUNNING + 1); \ 322 closure_sub(_cl, CLOSURE_RUNNING + 1); \
323 return; \
324} while (0) 323} while (0)
325 324
326/** 325/**
@@ -349,7 +348,6 @@ do { \
349do { \ 348do { \
350 set_closure_fn(_cl, _fn, _wq); \ 349 set_closure_fn(_cl, _fn, _wq); \
351 closure_queue(_cl); \ 350 closure_queue(_cl); \
352 return; \
353} while (0) 351} while (0)
354 352
355/** 353/**
@@ -365,7 +363,6 @@ do { \
365do { \ 363do { \
366 set_closure_fn(_cl, _destructor, NULL); \ 364 set_closure_fn(_cl, _destructor, NULL); \
367 closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \ 365 closure_sub(_cl, CLOSURE_RUNNING - CLOSURE_DESTRUCTOR + 1); \
368 return; \
369} while (0) 366} while (0)
370 367
371/** 368/**
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index cb64e64a4789..bf6a9ca18403 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -105,6 +105,7 @@ void bch_generic_make_request(struct bio *bio, struct bio_split_pool *p)
105 } while (n != bio); 105 } while (n != bio);
106 106
107 continue_at(&s->cl, bch_bio_submit_split_done, NULL); 107 continue_at(&s->cl, bch_bio_submit_split_done, NULL);
108 return;
108submit: 109submit:
109 generic_make_request(bio); 110 generic_make_request(bio);
110} 111}
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index ce64fc851251..418607a6ba33 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -592,12 +592,14 @@ static void journal_write_unlocked(struct closure *cl)
592 592
593 if (!w->need_write) { 593 if (!w->need_write) {
594 closure_return_with_destructor(cl, journal_write_unlock); 594 closure_return_with_destructor(cl, journal_write_unlock);
595 return;
595 } else if (journal_full(&c->journal)) { 596 } else if (journal_full(&c->journal)) {
596 journal_reclaim(c); 597 journal_reclaim(c);
597 spin_unlock(&c->journal.lock); 598 spin_unlock(&c->journal.lock);
598 599
599 btree_flush_write(c); 600 btree_flush_write(c);
600 continue_at(cl, journal_write, system_wq); 601 continue_at(cl, journal_write, system_wq);
602 return;
601 } 603 }
602 604
603 c->journal.blocks_free -= set_blocks(w->data, block_bytes(c)); 605 c->journal.blocks_free -= set_blocks(w->data, block_bytes(c));
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 4afb2d26b148..f292790997d7 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -88,8 +88,10 @@ static void bch_data_insert_keys(struct closure *cl)
88 if (journal_ref) 88 if (journal_ref)
89 atomic_dec_bug(journal_ref); 89 atomic_dec_bug(journal_ref);
90 90
91 if (!op->insert_data_done) 91 if (!op->insert_data_done) {
92 continue_at(cl, bch_data_insert_start, op->wq); 92 continue_at(cl, bch_data_insert_start, op->wq);
93 return;
94 }
93 95
94 bch_keylist_free(&op->insert_keys); 96 bch_keylist_free(&op->insert_keys);
95 closure_return(cl); 97 closure_return(cl);
@@ -216,8 +218,10 @@ static void bch_data_insert_start(struct closure *cl)
216 /* 1 for the device pointer and 1 for the chksum */ 218 /* 1 for the device pointer and 1 for the chksum */
217 if (bch_keylist_realloc(&op->insert_keys, 219 if (bch_keylist_realloc(&op->insert_keys,
218 3 + (op->csum ? 1 : 0), 220 3 + (op->csum ? 1 : 0),
219 op->c)) 221 op->c)) {
220 continue_at(cl, bch_data_insert_keys, op->wq); 222 continue_at(cl, bch_data_insert_keys, op->wq);
223 return;
224 }
221 225
222 k = op->insert_keys.top; 226 k = op->insert_keys.top;
223 bkey_init(k); 227 bkey_init(k);
@@ -255,6 +259,7 @@ static void bch_data_insert_start(struct closure *cl)
255 259
256 op->insert_data_done = true; 260 op->insert_data_done = true;
257 continue_at(cl, bch_data_insert_keys, op->wq); 261 continue_at(cl, bch_data_insert_keys, op->wq);
262 return;
258err: 263err:
259 /* bch_alloc_sectors() blocks if s->writeback = true */ 264 /* bch_alloc_sectors() blocks if s->writeback = true */
260 BUG_ON(op->writeback); 265 BUG_ON(op->writeback);
@@ -576,8 +581,10 @@ static void cache_lookup(struct closure *cl)
576 ret = bch_btree_map_keys(&s->op, s->iop.c, 581 ret = bch_btree_map_keys(&s->op, s->iop.c,
577 &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0), 582 &KEY(s->iop.inode, bio->bi_iter.bi_sector, 0),
578 cache_lookup_fn, MAP_END_KEY); 583 cache_lookup_fn, MAP_END_KEY);
579 if (ret == -EAGAIN) 584 if (ret == -EAGAIN) {
580 continue_at(cl, cache_lookup, bcache_wq); 585 continue_at(cl, cache_lookup, bcache_wq);
586 return;
587 }
581 588
582 closure_return(cl); 589 closure_return(cl);
583} 590}
@@ -1085,6 +1092,7 @@ static void flash_dev_make_request(struct request_queue *q, struct bio *bio)
1085 continue_at_nobarrier(&s->cl, 1092 continue_at_nobarrier(&s->cl,
1086 flash_dev_nodata, 1093 flash_dev_nodata,
1087 bcache_wq); 1094 bcache_wq);
1095 return;
1088 } else if (rw) { 1096 } else if (rw) {
1089 bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys, 1097 bch_keybuf_check_overlapping(&s->iop.c->moving_gc_keys,
1090 &KEY(d->id, bio->bi_iter.bi_sector, 0), 1098 &KEY(d->id, bio->bi_iter.bi_sector, 0),
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 1b4e1756b169..b680da5d7b93 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -424,7 +424,6 @@ static void free_migration(struct dm_cache_migration *mg)
424 wake_up(&cache->migration_wait); 424 wake_up(&cache->migration_wait);
425 425
426 mempool_free(mg, cache->migration_pool); 426 mempool_free(mg, cache->migration_pool);
427 wake_worker(cache);
428} 427}
429 428
430static int prealloc_data_structs(struct cache *cache, struct prealloc *p) 429static int prealloc_data_structs(struct cache *cache, struct prealloc *p)
@@ -1947,6 +1946,7 @@ static int commit_if_needed(struct cache *cache)
1947 1946
1948static void process_deferred_bios(struct cache *cache) 1947static void process_deferred_bios(struct cache *cache)
1949{ 1948{
1949 bool prealloc_used = false;
1950 unsigned long flags; 1950 unsigned long flags;
1951 struct bio_list bios; 1951 struct bio_list bios;
1952 struct bio *bio; 1952 struct bio *bio;
@@ -1981,13 +1981,16 @@ static void process_deferred_bios(struct cache *cache)
1981 process_discard_bio(cache, &structs, bio); 1981 process_discard_bio(cache, &structs, bio);
1982 else 1982 else
1983 process_bio(cache, &structs, bio); 1983 process_bio(cache, &structs, bio);
1984 prealloc_used = true;
1984 } 1985 }
1985 1986
1986 prealloc_free_structs(cache, &structs); 1987 if (prealloc_used)
1988 prealloc_free_structs(cache, &structs);
1987} 1989}
1988 1990
1989static void process_deferred_cells(struct cache *cache) 1991static void process_deferred_cells(struct cache *cache)
1990{ 1992{
1993 bool prealloc_used = false;
1991 unsigned long flags; 1994 unsigned long flags;
1992 struct dm_bio_prison_cell *cell, *tmp; 1995 struct dm_bio_prison_cell *cell, *tmp;
1993 struct list_head cells; 1996 struct list_head cells;
@@ -2015,9 +2018,11 @@ static void process_deferred_cells(struct cache *cache)
2015 } 2018 }
2016 2019
2017 process_cell(cache, &structs, cell); 2020 process_cell(cache, &structs, cell);
2021 prealloc_used = true;
2018 } 2022 }
2019 2023
2020 prealloc_free_structs(cache, &structs); 2024 if (prealloc_used)
2025 prealloc_free_structs(cache, &structs);
2021} 2026}
2022 2027
2023static void process_deferred_flush_bios(struct cache *cache, bool submit_bios) 2028static void process_deferred_flush_bios(struct cache *cache, bool submit_bios)
@@ -2062,7 +2067,7 @@ static void process_deferred_writethrough_bios(struct cache *cache)
2062 2067
2063static void writeback_some_dirty_blocks(struct cache *cache) 2068static void writeback_some_dirty_blocks(struct cache *cache)
2064{ 2069{
2065 int r = 0; 2070 bool prealloc_used = false;
2066 dm_oblock_t oblock; 2071 dm_oblock_t oblock;
2067 dm_cblock_t cblock; 2072 dm_cblock_t cblock;
2068 struct prealloc structs; 2073 struct prealloc structs;
@@ -2072,23 +2077,21 @@ static void writeback_some_dirty_blocks(struct cache *cache)
2072 memset(&structs, 0, sizeof(structs)); 2077 memset(&structs, 0, sizeof(structs));
2073 2078
2074 while (spare_migration_bandwidth(cache)) { 2079 while (spare_migration_bandwidth(cache)) {
2075 if (prealloc_data_structs(cache, &structs)) 2080 if (policy_writeback_work(cache->policy, &oblock, &cblock, busy))
2076 break; 2081 break; /* no work to do */
2077 2082
2078 r = policy_writeback_work(cache->policy, &oblock, &cblock, busy); 2083 if (prealloc_data_structs(cache, &structs) ||
2079 if (r) 2084 get_cell(cache, oblock, &structs, &old_ocell)) {
2080 break;
2081
2082 r = get_cell(cache, oblock, &structs, &old_ocell);
2083 if (r) {
2084 policy_set_dirty(cache->policy, oblock); 2085 policy_set_dirty(cache->policy, oblock);
2085 break; 2086 break;
2086 } 2087 }
2087 2088
2088 writeback(cache, &structs, oblock, cblock, old_ocell); 2089 writeback(cache, &structs, oblock, cblock, old_ocell);
2090 prealloc_used = true;
2089 } 2091 }
2090 2092
2091 prealloc_free_structs(cache, &structs); 2093 if (prealloc_used)
2094 prealloc_free_structs(cache, &structs);
2092} 2095}
2093 2096
2094/*---------------------------------------------------------------- 2097/*----------------------------------------------------------------
@@ -3496,7 +3499,7 @@ static void cache_resume(struct dm_target *ti)
3496 * <#demotions> <#promotions> <#dirty> 3499 * <#demotions> <#promotions> <#dirty>
3497 * <#features> <features>* 3500 * <#features> <features>*
3498 * <#core args> <core args> 3501 * <#core args> <core args>
3499 * <policy name> <#policy args> <policy args>* <cache metadata mode> 3502 * <policy name> <#policy args> <policy args>* <cache metadata mode> <needs_check>
3500 */ 3503 */
3501static void cache_status(struct dm_target *ti, status_type_t type, 3504static void cache_status(struct dm_target *ti, status_type_t type,
3502 unsigned status_flags, char *result, unsigned maxlen) 3505 unsigned status_flags, char *result, unsigned maxlen)
@@ -3582,6 +3585,11 @@ static void cache_status(struct dm_target *ti, status_type_t type,
3582 else 3585 else
3583 DMEMIT("rw "); 3586 DMEMIT("rw ");
3584 3587
3588 if (dm_cache_metadata_needs_check(cache->cmd))
3589 DMEMIT("needs_check ");
3590 else
3591 DMEMIT("- ");
3592
3585 break; 3593 break;
3586 3594
3587 case STATUSTYPE_TABLE: 3595 case STATUSTYPE_TABLE:
@@ -3820,7 +3828,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
3820 3828
3821static struct target_type cache_target = { 3829static struct target_type cache_target = {
3822 .name = "cache", 3830 .name = "cache",
3823 .version = {1, 7, 0}, 3831 .version = {1, 8, 0},
3824 .module = THIS_MODULE, 3832 .module = THIS_MODULE,
3825 .ctr = cache_ctr, 3833 .ctr = cache_ctr,
3826 .dtr = cache_dtr, 3834 .dtr = cache_dtr,
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index c33f61a4cc28..1c50c580215c 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/vmalloc.h>
21#include <linux/sort.h> 22#include <linux/sort.h>
22#include <linux/rbtree.h> 23#include <linux/rbtree.h>
23 24
@@ -268,7 +269,7 @@ struct pool {
268 process_mapping_fn process_prepared_mapping; 269 process_mapping_fn process_prepared_mapping;
269 process_mapping_fn process_prepared_discard; 270 process_mapping_fn process_prepared_discard;
270 271
271 struct dm_bio_prison_cell *cell_sort_array[CELL_SORT_ARRAY_SIZE]; 272 struct dm_bio_prison_cell **cell_sort_array;
272}; 273};
273 274
274static enum pool_mode get_pool_mode(struct pool *pool); 275static enum pool_mode get_pool_mode(struct pool *pool);
@@ -2281,18 +2282,23 @@ static void do_waker(struct work_struct *ws)
2281 queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD); 2282 queue_delayed_work(pool->wq, &pool->waker, COMMIT_PERIOD);
2282} 2283}
2283 2284
2285static void notify_of_pool_mode_change_to_oods(struct pool *pool);
2286
2284/* 2287/*
2285 * We're holding onto IO to allow userland time to react. After the 2288 * We're holding onto IO to allow userland time to react. After the
2286 * timeout either the pool will have been resized (and thus back in 2289 * timeout either the pool will have been resized (and thus back in
2287 * PM_WRITE mode), or we degrade to PM_READ_ONLY and start erroring IO. 2290 * PM_WRITE mode), or we degrade to PM_OUT_OF_DATA_SPACE w/ error_if_no_space.
2288 */ 2291 */
2289static void do_no_space_timeout(struct work_struct *ws) 2292static void do_no_space_timeout(struct work_struct *ws)
2290{ 2293{
2291 struct pool *pool = container_of(to_delayed_work(ws), struct pool, 2294 struct pool *pool = container_of(to_delayed_work(ws), struct pool,
2292 no_space_timeout); 2295 no_space_timeout);
2293 2296
2294 if (get_pool_mode(pool) == PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) 2297 if (get_pool_mode(pool) == PM_OUT_OF_DATA_SPACE && !pool->pf.error_if_no_space) {
2295 set_pool_mode(pool, PM_READ_ONLY); 2298 pool->pf.error_if_no_space = true;
2299 notify_of_pool_mode_change_to_oods(pool);
2300 error_retry_list(pool);
2301 }
2296} 2302}
2297 2303
2298/*----------------------------------------------------------------*/ 2304/*----------------------------------------------------------------*/
@@ -2370,6 +2376,14 @@ static void notify_of_pool_mode_change(struct pool *pool, const char *new_mode)
2370 dm_device_name(pool->pool_md), new_mode); 2376 dm_device_name(pool->pool_md), new_mode);
2371} 2377}
2372 2378
2379static void notify_of_pool_mode_change_to_oods(struct pool *pool)
2380{
2381 if (!pool->pf.error_if_no_space)
2382 notify_of_pool_mode_change(pool, "out-of-data-space (queue IO)");
2383 else
2384 notify_of_pool_mode_change(pool, "out-of-data-space (error IO)");
2385}
2386
2373static bool passdown_enabled(struct pool_c *pt) 2387static bool passdown_enabled(struct pool_c *pt)
2374{ 2388{
2375 return pt->adjusted_pf.discard_passdown; 2389 return pt->adjusted_pf.discard_passdown;
@@ -2454,7 +2468,7 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
2454 * frequently seeing this mode. 2468 * frequently seeing this mode.
2455 */ 2469 */
2456 if (old_mode != new_mode) 2470 if (old_mode != new_mode)
2457 notify_of_pool_mode_change(pool, "out-of-data-space"); 2471 notify_of_pool_mode_change_to_oods(pool);
2458 pool->process_bio = process_bio_read_only; 2472 pool->process_bio = process_bio_read_only;
2459 pool->process_discard = process_discard_bio; 2473 pool->process_discard = process_discard_bio;
2460 pool->process_cell = process_cell_read_only; 2474 pool->process_cell = process_cell_read_only;
@@ -2777,6 +2791,7 @@ static void __pool_destroy(struct pool *pool)
2777{ 2791{
2778 __pool_table_remove(pool); 2792 __pool_table_remove(pool);
2779 2793
2794 vfree(pool->cell_sort_array);
2780 if (dm_pool_metadata_close(pool->pmd) < 0) 2795 if (dm_pool_metadata_close(pool->pmd) < 0)
2781 DMWARN("%s: dm_pool_metadata_close() failed.", __func__); 2796 DMWARN("%s: dm_pool_metadata_close() failed.", __func__);
2782 2797
@@ -2889,6 +2904,13 @@ static struct pool *pool_create(struct mapped_device *pool_md,
2889 goto bad_mapping_pool; 2904 goto bad_mapping_pool;
2890 } 2905 }
2891 2906
2907 pool->cell_sort_array = vmalloc(sizeof(*pool->cell_sort_array) * CELL_SORT_ARRAY_SIZE);
2908 if (!pool->cell_sort_array) {
2909 *error = "Error allocating cell sort array";
2910 err_p = ERR_PTR(-ENOMEM);
2911 goto bad_sort_array;
2912 }
2913
2892 pool->ref_count = 1; 2914 pool->ref_count = 1;
2893 pool->last_commit_jiffies = jiffies; 2915 pool->last_commit_jiffies = jiffies;
2894 pool->pool_md = pool_md; 2916 pool->pool_md = pool_md;
@@ -2897,6 +2919,8 @@ static struct pool *pool_create(struct mapped_device *pool_md,
2897 2919
2898 return pool; 2920 return pool;
2899 2921
2922bad_sort_array:
2923 mempool_destroy(pool->mapping_pool);
2900bad_mapping_pool: 2924bad_mapping_pool:
2901 dm_deferred_set_destroy(pool->all_io_ds); 2925 dm_deferred_set_destroy(pool->all_io_ds);
2902bad_all_io_ds: 2926bad_all_io_ds:
@@ -3714,6 +3738,7 @@ static void emit_flags(struct pool_features *pf, char *result,
3714 * Status line is: 3738 * Status line is:
3715 * <transaction id> <used metadata sectors>/<total metadata sectors> 3739 * <transaction id> <used metadata sectors>/<total metadata sectors>
3716 * <used data sectors>/<total data sectors> <held metadata root> 3740 * <used data sectors>/<total data sectors> <held metadata root>
3741 * <pool mode> <discard config> <no space config> <needs_check>
3717 */ 3742 */
3718static void pool_status(struct dm_target *ti, status_type_t type, 3743static void pool_status(struct dm_target *ti, status_type_t type,
3719 unsigned status_flags, char *result, unsigned maxlen) 3744 unsigned status_flags, char *result, unsigned maxlen)
@@ -3815,6 +3840,11 @@ static void pool_status(struct dm_target *ti, status_type_t type,
3815 else 3840 else
3816 DMEMIT("queue_if_no_space "); 3841 DMEMIT("queue_if_no_space ");
3817 3842
3843 if (dm_pool_metadata_needs_check(pool->pmd))
3844 DMEMIT("needs_check ");
3845 else
3846 DMEMIT("- ");
3847
3818 break; 3848 break;
3819 3849
3820 case STATUSTYPE_TABLE: 3850 case STATUSTYPE_TABLE:
@@ -3918,7 +3948,7 @@ static struct target_type pool_target = {
3918 .name = "thin-pool", 3948 .name = "thin-pool",
3919 .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | 3949 .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE |
3920 DM_TARGET_IMMUTABLE, 3950 DM_TARGET_IMMUTABLE,
3921 .version = {1, 15, 0}, 3951 .version = {1, 16, 0},
3922 .module = THIS_MODULE, 3952 .module = THIS_MODULE,
3923 .ctr = pool_ctr, 3953 .ctr = pool_ctr,
3924 .dtr = pool_dtr, 3954 .dtr = pool_dtr,
@@ -4305,7 +4335,7 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)
4305 4335
4306static struct target_type thin_target = { 4336static struct target_type thin_target = {
4307 .name = "thin", 4337 .name = "thin",
4308 .version = {1, 15, 0}, 4338 .version = {1, 16, 0},
4309 .module = THIS_MODULE, 4339 .module = THIS_MODULE,
4310 .ctr = thin_ctr, 4340 .ctr = thin_ctr,
4311 .dtr = thin_dtr, 4341 .dtr = thin_dtr,
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index f331d888e7f5..ab37ae114e94 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1067,13 +1067,10 @@ static void rq_end_stats(struct mapped_device *md, struct request *orig)
1067 */ 1067 */
1068static void rq_completed(struct mapped_device *md, int rw, bool run_queue) 1068static void rq_completed(struct mapped_device *md, int rw, bool run_queue)
1069{ 1069{
1070 int nr_requests_pending;
1071
1072 atomic_dec(&md->pending[rw]); 1070 atomic_dec(&md->pending[rw]);
1073 1071
1074 /* nudge anyone waiting on suspend queue */ 1072 /* nudge anyone waiting on suspend queue */
1075 nr_requests_pending = md_in_flight(md); 1073 if (!md_in_flight(md))
1076 if (!nr_requests_pending)
1077 wake_up(&md->wait); 1074 wake_up(&md->wait);
1078 1075
1079 /* 1076 /*
@@ -1085,8 +1082,7 @@ static void rq_completed(struct mapped_device *md, int rw, bool run_queue)
1085 if (run_queue) { 1082 if (run_queue) {
1086 if (md->queue->mq_ops) 1083 if (md->queue->mq_ops)
1087 blk_mq_run_hw_queues(md->queue, true); 1084 blk_mq_run_hw_queues(md->queue, true);
1088 else if (!nr_requests_pending || 1085 else
1089 (nr_requests_pending >= md->queue->nr_congestion_on))
1090 blk_run_queue_async(md->queue); 1086 blk_run_queue_async(md->queue);
1091 } 1087 }
1092 1088
@@ -2281,8 +2277,6 @@ static void dm_init_old_md_queue(struct mapped_device *md)
2281 2277
2282static void cleanup_mapped_device(struct mapped_device *md) 2278static void cleanup_mapped_device(struct mapped_device *md)
2283{ 2279{
2284 cleanup_srcu_struct(&md->io_barrier);
2285
2286 if (md->wq) 2280 if (md->wq)
2287 destroy_workqueue(md->wq); 2281 destroy_workqueue(md->wq);
2288 if (md->kworker_task) 2282 if (md->kworker_task)
@@ -2294,6 +2288,8 @@ static void cleanup_mapped_device(struct mapped_device *md)
2294 if (md->bs) 2288 if (md->bs)
2295 bioset_free(md->bs); 2289 bioset_free(md->bs);
2296 2290
2291 cleanup_srcu_struct(&md->io_barrier);
2292
2297 if (md->disk) { 2293 if (md->disk) {
2298 spin_lock(&_minor_lock); 2294 spin_lock(&_minor_lock);
2299 md->disk->private_data = NULL; 2295 md->disk->private_data = NULL;
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c
index e04cfd2d60ef..9836c0ae897c 100644
--- a/drivers/md/persistent-data/dm-btree-remove.c
+++ b/drivers/md/persistent-data/dm-btree-remove.c
@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
309 309
310 if (s < 0 && nr_center < -s) { 310 if (s < 0 && nr_center < -s) {
311 /* not enough in central node */ 311 /* not enough in central node */
312 shift(left, center, nr_center); 312 shift(left, center, -nr_center);
313 s = nr_center - target; 313 s += nr_center;
314 shift(left, right, s); 314 shift(left, right, s);
315 nr_right += s; 315 nr_right += s;
316 } else 316 } else
@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent,
323 if (s > 0 && nr_center < s) { 323 if (s > 0 && nr_center < s) {
324 /* not enough in central node */ 324 /* not enough in central node */
325 shift(center, right, nr_center); 325 shift(center, right, nr_center);
326 s = target - nr_center; 326 s -= nr_center;
327 shift(left, right, s); 327 shift(left, right, s);
328 nr_left -= s; 328 nr_left -= s;
329 } else 329 } else
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index 200ac12a1d40..fdd3793e22f9 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -255,7 +255,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root)
255 int r; 255 int r;
256 struct del_stack *s; 256 struct del_stack *s;
257 257
258 s = kmalloc(sizeof(*s), GFP_KERNEL); 258 s = kmalloc(sizeof(*s), GFP_NOIO);
259 if (!s) 259 if (!s)
260 return -ENOMEM; 260 return -ENOMEM;
261 s->info = info; 261 s->info = info;
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index 5c054031c3f8..e14c8c9d189b 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * License Terms: GNU General Public License, version 2 7 * License Terms: GNU General Public License, version 2
8 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 8 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
9 * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics 9 * Author: Viresh Kumar <vireshk@kernel.org> for ST Microelectronics
10 */ 10 */
11 11
12#include <linux/i2c.h> 12#include <linux/i2c.h>
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c
index a81badbaa917..6fdb30e84a2b 100644
--- a/drivers/mfd/stmpe-spi.c
+++ b/drivers/mfd/stmpe-spi.c
@@ -4,7 +4,7 @@
4 * Copyright (C) ST Microelectronics SA 2011 4 * Copyright (C) ST Microelectronics SA 2011
5 * 5 *
6 * License Terms: GNU General Public License, version 2 6 * License Terms: GNU General Public License, version 2
7 * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics 7 * Author: Viresh Kumar <vireshk@kernel.org> for ST Microelectronics
8 */ 8 */
9 9
10#include <linux/spi/spi.h> 10#include <linux/spi/spi.h>
@@ -146,4 +146,4 @@ module_exit(stmpe_exit);
146 146
147MODULE_LICENSE("GPL v2"); 147MODULE_LICENSE("GPL v2");
148MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver"); 148MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver");
149MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 149MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index df088343d60f..255a896769b8 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -4,7 +4,7 @@
4 * Support of SDHCI platform devices for spear soc family 4 * Support of SDHCI platform devices for spear soc family
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * Inspired by sdhci-pltfm.c 9 * Inspired by sdhci-pltfm.c
10 * 10 *
@@ -211,5 +211,5 @@ static struct platform_driver sdhci_driver = {
211module_platform_driver(sdhci_driver); 211module_platform_driver(sdhci_driver);
212 212
213MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); 213MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver");
214MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 214MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
215MODULE_LICENSE("GPL v2"); 215MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 19eb990d398c..317a49480475 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -689,40 +689,57 @@ out:
689 689
690} 690}
691 691
692static bool bond_should_change_active(struct bonding *bond) 692static struct slave *bond_choose_primary_or_current(struct bonding *bond)
693{ 693{
694 struct slave *prim = rtnl_dereference(bond->primary_slave); 694 struct slave *prim = rtnl_dereference(bond->primary_slave);
695 struct slave *curr = rtnl_dereference(bond->curr_active_slave); 695 struct slave *curr = rtnl_dereference(bond->curr_active_slave);
696 696
697 if (!prim || !curr || curr->link != BOND_LINK_UP) 697 if (!prim || prim->link != BOND_LINK_UP) {
698 return true; 698 if (!curr || curr->link != BOND_LINK_UP)
699 return NULL;
700 return curr;
701 }
702
699 if (bond->force_primary) { 703 if (bond->force_primary) {
700 bond->force_primary = false; 704 bond->force_primary = false;
701 return true; 705 return prim;
706 }
707
708 if (!curr || curr->link != BOND_LINK_UP)
709 return prim;
710
711 /* At this point, prim and curr are both up */
712 switch (bond->params.primary_reselect) {
713 case BOND_PRI_RESELECT_ALWAYS:
714 return prim;
715 case BOND_PRI_RESELECT_BETTER:
716 if (prim->speed < curr->speed)
717 return curr;
718 if (prim->speed == curr->speed && prim->duplex <= curr->duplex)
719 return curr;
720 return prim;
721 case BOND_PRI_RESELECT_FAILURE:
722 return curr;
723 default:
724 netdev_err(bond->dev, "impossible primary_reselect %d\n",
725 bond->params.primary_reselect);
726 return curr;
702 } 727 }
703 if (bond->params.primary_reselect == BOND_PRI_RESELECT_BETTER &&
704 (prim->speed < curr->speed ||
705 (prim->speed == curr->speed && prim->duplex <= curr->duplex)))
706 return false;
707 if (bond->params.primary_reselect == BOND_PRI_RESELECT_FAILURE)
708 return false;
709 return true;
710} 728}
711 729
712/** 730/**
713 * find_best_interface - select the best available slave to be the active one 731 * bond_find_best_slave - select the best available slave to be the active one
714 * @bond: our bonding struct 732 * @bond: our bonding struct
715 */ 733 */
716static struct slave *bond_find_best_slave(struct bonding *bond) 734static struct slave *bond_find_best_slave(struct bonding *bond)
717{ 735{
718 struct slave *slave, *bestslave = NULL, *primary; 736 struct slave *slave, *bestslave = NULL;
719 struct list_head *iter; 737 struct list_head *iter;
720 int mintime = bond->params.updelay; 738 int mintime = bond->params.updelay;
721 739
722 primary = rtnl_dereference(bond->primary_slave); 740 slave = bond_choose_primary_or_current(bond);
723 if (primary && primary->link == BOND_LINK_UP && 741 if (slave)
724 bond_should_change_active(bond)) 742 return slave;
725 return primary;
726 743
727 bond_for_each_slave(bond, slave, iter) { 744 bond_for_each_slave(bond, slave, iter) {
728 if (slave->link == BOND_LINK_UP) 745 if (slave->link == BOND_LINK_UP)
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 041525d2595c..5d214d135332 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -592,6 +592,7 @@ static int c_can_start(struct net_device *dev)
592{ 592{
593 struct c_can_priv *priv = netdev_priv(dev); 593 struct c_can_priv *priv = netdev_priv(dev);
594 int err; 594 int err;
595 struct pinctrl *p;
595 596
596 /* basic c_can configuration */ 597 /* basic c_can configuration */
597 err = c_can_chip_config(dev); 598 err = c_can_chip_config(dev);
@@ -604,8 +605,13 @@ static int c_can_start(struct net_device *dev)
604 605
605 priv->can.state = CAN_STATE_ERROR_ACTIVE; 606 priv->can.state = CAN_STATE_ERROR_ACTIVE;
606 607
607 /* activate pins */ 608 /* Attempt to use "active" if available else use "default" */
608 pinctrl_pm_select_default_state(dev->dev.parent); 609 p = pinctrl_get_select(priv->device, "active");
610 if (!IS_ERR(p))
611 pinctrl_put(p);
612 else
613 pinctrl_pm_select_default_state(priv->device);
614
609 return 0; 615 return 0;
610} 616}
611 617
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index e9b1810d319f..aede704605c6 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -440,9 +440,6 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
440 struct can_frame *cf = (struct can_frame *)skb->data; 440 struct can_frame *cf = (struct can_frame *)skb->data;
441 u8 dlc = cf->can_dlc; 441 u8 dlc = cf->can_dlc;
442 442
443 if (!(skb->tstamp.tv64))
444 __net_timestamp(skb);
445
446 netif_rx(priv->echo_skb[idx]); 443 netif_rx(priv->echo_skb[idx]);
447 priv->echo_skb[idx] = NULL; 444 priv->echo_skb[idx] = NULL;
448 445
@@ -578,7 +575,6 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
578 if (unlikely(!skb)) 575 if (unlikely(!skb))
579 return NULL; 576 return NULL;
580 577
581 __net_timestamp(skb);
582 skb->protocol = htons(ETH_P_CAN); 578 skb->protocol = htons(ETH_P_CAN);
583 skb->pkt_type = PACKET_BROADCAST; 579 skb->pkt_type = PACKET_BROADCAST;
584 skb->ip_summed = CHECKSUM_UNNECESSARY; 580 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -589,6 +585,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
589 585
590 can_skb_reserve(skb); 586 can_skb_reserve(skb);
591 can_skb_prv(skb)->ifindex = dev->ifindex; 587 can_skb_prv(skb)->ifindex = dev->ifindex;
588 can_skb_prv(skb)->skbcnt = 0;
592 589
593 *cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame)); 590 *cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
594 memset(*cf, 0, sizeof(struct can_frame)); 591 memset(*cf, 0, sizeof(struct can_frame));
@@ -607,7 +604,6 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
607 if (unlikely(!skb)) 604 if (unlikely(!skb))
608 return NULL; 605 return NULL;
609 606
610 __net_timestamp(skb);
611 skb->protocol = htons(ETH_P_CANFD); 607 skb->protocol = htons(ETH_P_CANFD);
612 skb->pkt_type = PACKET_BROADCAST; 608 skb->pkt_type = PACKET_BROADCAST;
613 skb->ip_summed = CHECKSUM_UNNECESSARY; 609 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -618,6 +614,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
618 614
619 can_skb_reserve(skb); 615 can_skb_reserve(skb);
620 can_skb_prv(skb)->ifindex = dev->ifindex; 616 can_skb_prv(skb)->ifindex = dev->ifindex;
617 can_skb_prv(skb)->skbcnt = 0;
621 618
622 *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame)); 619 *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame));
623 memset(*cfd, 0, sizeof(struct canfd_frame)); 620 memset(*cfd, 0, sizeof(struct canfd_frame));
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
index 7deb80dcbe8c..7bd54191f962 100644
--- a/drivers/net/can/rcar_can.c
+++ b/drivers/net/can/rcar_can.c
@@ -508,7 +508,8 @@ static int rcar_can_open(struct net_device *ndev)
508 508
509 err = clk_prepare_enable(priv->clk); 509 err = clk_prepare_enable(priv->clk);
510 if (err) { 510 if (err) {
511 netdev_err(ndev, "failed to enable periperal clock, error %d\n", 511 netdev_err(ndev,
512 "failed to enable peripheral clock, error %d\n",
512 err); 513 err);
513 goto out; 514 goto out;
514 } 515 }
@@ -526,7 +527,8 @@ static int rcar_can_open(struct net_device *ndev)
526 napi_enable(&priv->napi); 527 napi_enable(&priv->napi);
527 err = request_irq(ndev->irq, rcar_can_interrupt, 0, ndev->name, ndev); 528 err = request_irq(ndev->irq, rcar_can_interrupt, 0, ndev->name, ndev);
528 if (err) { 529 if (err) {
529 netdev_err(ndev, "error requesting interrupt %x\n", ndev->irq); 530 netdev_err(ndev, "request_irq(%d) failed, error %d\n",
531 ndev->irq, err);
530 goto out_close; 532 goto out_close;
531 } 533 }
532 can_led_event(ndev, CAN_LED_EVENT_OPEN); 534 can_led_event(ndev, CAN_LED_EVENT_OPEN);
@@ -758,8 +760,9 @@ static int rcar_can_probe(struct platform_device *pdev)
758 } 760 }
759 761
760 irq = platform_get_irq(pdev, 0); 762 irq = platform_get_irq(pdev, 0);
761 if (!irq) { 763 if (irq < 0) {
762 dev_err(&pdev->dev, "No IRQ resource\n"); 764 dev_err(&pdev->dev, "No IRQ resource\n");
765 err = irq;
763 goto fail; 766 goto fail;
764 } 767 }
765 768
@@ -782,7 +785,8 @@ static int rcar_can_probe(struct platform_device *pdev)
782 priv->clk = devm_clk_get(&pdev->dev, "clkp1"); 785 priv->clk = devm_clk_get(&pdev->dev, "clkp1");
783 if (IS_ERR(priv->clk)) { 786 if (IS_ERR(priv->clk)) {
784 err = PTR_ERR(priv->clk); 787 err = PTR_ERR(priv->clk);
785 dev_err(&pdev->dev, "cannot get peripheral clock: %d\n", err); 788 dev_err(&pdev->dev, "cannot get peripheral clock, error %d\n",
789 err);
786 goto fail_clk; 790 goto fail_clk;
787 } 791 }
788 792
@@ -794,7 +798,7 @@ static int rcar_can_probe(struct platform_device *pdev)
794 priv->can_clk = devm_clk_get(&pdev->dev, clock_names[clock_select]); 798 priv->can_clk = devm_clk_get(&pdev->dev, clock_names[clock_select]);
795 if (IS_ERR(priv->can_clk)) { 799 if (IS_ERR(priv->can_clk)) {
796 err = PTR_ERR(priv->can_clk); 800 err = PTR_ERR(priv->can_clk);
797 dev_err(&pdev->dev, "cannot get CAN clock: %d\n", err); 801 dev_err(&pdev->dev, "cannot get CAN clock, error %d\n", err);
798 goto fail_clk; 802 goto fail_clk;
799 } 803 }
800 804
@@ -823,7 +827,7 @@ static int rcar_can_probe(struct platform_device *pdev)
823 827
824 devm_can_led_init(ndev); 828 devm_can_led_init(ndev);
825 829
826 dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%u)\n", 830 dev_info(&pdev->dev, "device registered (regs @ %p, IRQ%d)\n",
827 priv->regs, ndev->irq); 831 priv->regs, ndev->irq);
828 832
829 return 0; 833 return 0;
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index f64f5290d6f8..a23a7af8eb9a 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -207,7 +207,6 @@ static void slc_bump(struct slcan *sl)
207 if (!skb) 207 if (!skb)
208 return; 208 return;
209 209
210 __net_timestamp(skb);
211 skb->dev = sl->dev; 210 skb->dev = sl->dev;
212 skb->protocol = htons(ETH_P_CAN); 211 skb->protocol = htons(ETH_P_CAN);
213 skb->pkt_type = PACKET_BROADCAST; 212 skb->pkt_type = PACKET_BROADCAST;
@@ -215,6 +214,7 @@ static void slc_bump(struct slcan *sl)
215 214
216 can_skb_reserve(skb); 215 can_skb_reserve(skb);
217 can_skb_prv(skb)->ifindex = sl->dev->ifindex; 216 can_skb_prv(skb)->ifindex = sl->dev->ifindex;
217 can_skb_prv(skb)->skbcnt = 0;
218 218
219 memcpy(skb_put(skb, sizeof(struct can_frame)), 219 memcpy(skb_put(skb, sizeof(struct can_frame)),
220 &cf, sizeof(struct can_frame)); 220 &cf, sizeof(struct can_frame));
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index 0ce868de855d..674f367087c5 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -78,9 +78,6 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
78 skb->dev = dev; 78 skb->dev = dev;
79 skb->ip_summed = CHECKSUM_UNNECESSARY; 79 skb->ip_summed = CHECKSUM_UNNECESSARY;
80 80
81 if (!(skb->tstamp.tv64))
82 __net_timestamp(skb);
83
84 netif_rx_ni(skb); 81 netif_rx_ni(skb);
85} 82}
86 83
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c
index 41095ebad97f..2d1ce3c5d0dd 100644
--- a/drivers/net/ethernet/3com/3c59x.c
+++ b/drivers/net/ethernet/3com/3c59x.c
@@ -2382,6 +2382,7 @@ boomerang_interrupt(int irq, void *dev_id)
2382 void __iomem *ioaddr; 2382 void __iomem *ioaddr;
2383 int status; 2383 int status;
2384 int work_done = max_interrupt_work; 2384 int work_done = max_interrupt_work;
2385 int handled = 0;
2385 2386
2386 ioaddr = vp->ioaddr; 2387 ioaddr = vp->ioaddr;
2387 2388
@@ -2400,6 +2401,7 @@ boomerang_interrupt(int irq, void *dev_id)
2400 2401
2401 if ((status & IntLatch) == 0) 2402 if ((status & IntLatch) == 0)
2402 goto handler_exit; /* No interrupt: shared IRQs can cause this */ 2403 goto handler_exit; /* No interrupt: shared IRQs can cause this */
2404 handled = 1;
2403 2405
2404 if (status == 0xffff) { /* h/w no longer present (hotplug)? */ 2406 if (status == 0xffff) { /* h/w no longer present (hotplug)? */
2405 if (vortex_debug > 1) 2407 if (vortex_debug > 1)
@@ -2501,7 +2503,7 @@ boomerang_interrupt(int irq, void *dev_id)
2501handler_exit: 2503handler_exit:
2502 vp->handling_irq = 0; 2504 vp->handling_irq = 0;
2503 spin_unlock(&vp->lock); 2505 spin_unlock(&vp->lock);
2504 return IRQ_HANDLED; 2506 return IRQ_RETVAL(handled);
2505} 2507}
2506 2508
2507static int vortex_rx(struct net_device *dev) 2509static int vortex_rx(struct net_device *dev)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
index 661cdaa7ea96..b3bc87fe3764 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-desc.c
@@ -303,7 +303,8 @@ static void xgbe_set_buffer_data(struct xgbe_buffer_data *bd,
303 get_page(pa->pages); 303 get_page(pa->pages);
304 bd->pa = *pa; 304 bd->pa = *pa;
305 305
306 bd->dma = pa->pages_dma + pa->pages_offset; 306 bd->dma_base = pa->pages_dma;
307 bd->dma_off = pa->pages_offset;
307 bd->dma_len = len; 308 bd->dma_len = len;
308 309
309 pa->pages_offset += len; 310 pa->pages_offset += len;
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
index 506e832c9e9a..a4473d8ff4fa 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
@@ -1110,6 +1110,7 @@ static void xgbe_rx_desc_reset(struct xgbe_prv_data *pdata,
1110 unsigned int rx_usecs = pdata->rx_usecs; 1110 unsigned int rx_usecs = pdata->rx_usecs;
1111 unsigned int rx_frames = pdata->rx_frames; 1111 unsigned int rx_frames = pdata->rx_frames;
1112 unsigned int inte; 1112 unsigned int inte;
1113 dma_addr_t hdr_dma, buf_dma;
1113 1114
1114 if (!rx_usecs && !rx_frames) { 1115 if (!rx_usecs && !rx_frames) {
1115 /* No coalescing, interrupt for every descriptor */ 1116 /* No coalescing, interrupt for every descriptor */
@@ -1129,10 +1130,12 @@ static void xgbe_rx_desc_reset(struct xgbe_prv_data *pdata,
1129 * Set buffer 2 (hi) address to buffer dma address (hi) and 1130 * Set buffer 2 (hi) address to buffer dma address (hi) and
1130 * set control bits OWN and INTE 1131 * set control bits OWN and INTE
1131 */ 1132 */
1132 rdesc->desc0 = cpu_to_le32(lower_32_bits(rdata->rx.hdr.dma)); 1133 hdr_dma = rdata->rx.hdr.dma_base + rdata->rx.hdr.dma_off;
1133 rdesc->desc1 = cpu_to_le32(upper_32_bits(rdata->rx.hdr.dma)); 1134 buf_dma = rdata->rx.buf.dma_base + rdata->rx.buf.dma_off;
1134 rdesc->desc2 = cpu_to_le32(lower_32_bits(rdata->rx.buf.dma)); 1135 rdesc->desc0 = cpu_to_le32(lower_32_bits(hdr_dma));
1135 rdesc->desc3 = cpu_to_le32(upper_32_bits(rdata->rx.buf.dma)); 1136 rdesc->desc1 = cpu_to_le32(upper_32_bits(hdr_dma));
1137 rdesc->desc2 = cpu_to_le32(lower_32_bits(buf_dma));
1138 rdesc->desc3 = cpu_to_le32(upper_32_bits(buf_dma));
1136 1139
1137 XGMAC_SET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, INTE, inte); 1140 XGMAC_SET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, INTE, inte);
1138 1141
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
index 1e9c28d19ef8..aae9d5ecd182 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
@@ -1765,8 +1765,9 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
1765 /* Start with the header buffer which may contain just the header 1765 /* Start with the header buffer which may contain just the header
1766 * or the header plus data 1766 * or the header plus data
1767 */ 1767 */
1768 dma_sync_single_for_cpu(pdata->dev, rdata->rx.hdr.dma, 1768 dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base,
1769 rdata->rx.hdr.dma_len, DMA_FROM_DEVICE); 1769 rdata->rx.hdr.dma_off,
1770 rdata->rx.hdr.dma_len, DMA_FROM_DEVICE);
1770 1771
1771 packet = page_address(rdata->rx.hdr.pa.pages) + 1772 packet = page_address(rdata->rx.hdr.pa.pages) +
1772 rdata->rx.hdr.pa.pages_offset; 1773 rdata->rx.hdr.pa.pages_offset;
@@ -1778,8 +1779,11 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
1778 len -= copy_len; 1779 len -= copy_len;
1779 if (len) { 1780 if (len) {
1780 /* Add the remaining data as a frag */ 1781 /* Add the remaining data as a frag */
1781 dma_sync_single_for_cpu(pdata->dev, rdata->rx.buf.dma, 1782 dma_sync_single_range_for_cpu(pdata->dev,
1782 rdata->rx.buf.dma_len, DMA_FROM_DEVICE); 1783 rdata->rx.buf.dma_base,
1784 rdata->rx.buf.dma_off,
1785 rdata->rx.buf.dma_len,
1786 DMA_FROM_DEVICE);
1783 1787
1784 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, 1788 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
1785 rdata->rx.buf.pa.pages, 1789 rdata->rx.buf.pa.pages,
@@ -1945,8 +1949,9 @@ read_again:
1945 if (!skb) 1949 if (!skb)
1946 error = 1; 1950 error = 1;
1947 } else if (rdesc_len) { 1951 } else if (rdesc_len) {
1948 dma_sync_single_for_cpu(pdata->dev, 1952 dma_sync_single_range_for_cpu(pdata->dev,
1949 rdata->rx.buf.dma, 1953 rdata->rx.buf.dma_base,
1954 rdata->rx.buf.dma_off,
1950 rdata->rx.buf.dma_len, 1955 rdata->rx.buf.dma_len,
1951 DMA_FROM_DEVICE); 1956 DMA_FROM_DEVICE);
1952 1957
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
index 63d72a140053..717ce21b6077 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
+++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
@@ -337,7 +337,8 @@ struct xgbe_buffer_data {
337 struct xgbe_page_alloc pa; 337 struct xgbe_page_alloc pa;
338 struct xgbe_page_alloc pa_unmap; 338 struct xgbe_page_alloc pa_unmap;
339 339
340 dma_addr_t dma; 340 dma_addr_t dma_base;
341 unsigned long dma_off;
341 unsigned int dma_len; 342 unsigned int dma_len;
342}; 343};
343 344
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 909ad7a0d480..4566cdf0bc39 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1793,7 +1793,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
1793 macaddr = of_get_mac_address(dn); 1793 macaddr = of_get_mac_address(dn);
1794 if (!macaddr || !is_valid_ether_addr(macaddr)) { 1794 if (!macaddr || !is_valid_ether_addr(macaddr)) {
1795 dev_warn(&pdev->dev, "using random Ethernet MAC\n"); 1795 dev_warn(&pdev->dev, "using random Ethernet MAC\n");
1796 random_ether_addr(dev->dev_addr); 1796 eth_hw_addr_random(dev);
1797 } else { 1797 } else {
1798 ether_addr_copy(dev->dev_addr, macaddr); 1798 ether_addr_copy(dev->dev_addr, macaddr);
1799 } 1799 }
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index b43b2cb9b830..64c1e9db6b0b 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1230,7 +1230,6 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
1230 new_skb = skb_realloc_headroom(skb, sizeof(*status)); 1230 new_skb = skb_realloc_headroom(skb, sizeof(*status));
1231 dev_kfree_skb(skb); 1231 dev_kfree_skb(skb);
1232 if (!new_skb) { 1232 if (!new_skb) {
1233 dev->stats.tx_errors++;
1234 dev->stats.tx_dropped++; 1233 dev->stats.tx_dropped++;
1235 return NULL; 1234 return NULL;
1236 } 1235 }
@@ -1465,7 +1464,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
1465 1464
1466 if (unlikely(!skb)) { 1465 if (unlikely(!skb)) {
1467 dev->stats.rx_dropped++; 1466 dev->stats.rx_dropped++;
1468 dev->stats.rx_errors++;
1469 goto next; 1467 goto next;
1470 } 1468 }
1471 1469
@@ -1493,7 +1491,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
1493 if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { 1491 if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) {
1494 netif_err(priv, rx_status, dev, 1492 netif_err(priv, rx_status, dev,
1495 "dropping fragmented packet!\n"); 1493 "dropping fragmented packet!\n");
1496 dev->stats.rx_dropped++;
1497 dev->stats.rx_errors++; 1494 dev->stats.rx_errors++;
1498 dev_kfree_skb_any(skb); 1495 dev_kfree_skb_any(skb);
1499 goto next; 1496 goto next;
@@ -1515,7 +1512,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
1515 dev->stats.rx_frame_errors++; 1512 dev->stats.rx_frame_errors++;
1516 if (dma_flag & DMA_RX_LG) 1513 if (dma_flag & DMA_RX_LG)
1517 dev->stats.rx_length_errors++; 1514 dev->stats.rx_length_errors++;
1518 dev->stats.rx_dropped++;
1519 dev->stats.rx_errors++; 1515 dev->stats.rx_errors++;
1520 dev_kfree_skb_any(skb); 1516 dev_kfree_skb_any(skb);
1521 goto next; 1517 goto next;
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index ac27e24264a5..f557a2aaec23 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -1508,16 +1508,7 @@ static void sbmac_channel_start(struct sbmac_softc *s)
1508 __raw_writeq(reg, port); 1508 __raw_writeq(reg, port);
1509 port = s->sbm_base + R_MAC_ETHERNET_ADDR; 1509 port = s->sbm_base + R_MAC_ETHERNET_ADDR;
1510 1510
1511#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
1512 /*
1513 * Pass1 SOCs do not receive packets addressed to the
1514 * destination address in the R_MAC_ETHERNET_ADDR register.
1515 * Set the value to zero.
1516 */
1517 __raw_writeq(0, port);
1518#else
1519 __raw_writeq(reg, port); 1511 __raw_writeq(reg, port);
1520#endif
1521 1512
1522 /* 1513 /*
1523 * Set the receive filter for no packets, and write values 1514 * Set the receive filter for no packets, and write values
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
index 484eb8c37489..a11485fbb33f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
@@ -952,16 +952,23 @@ static int devlog_show(struct seq_file *seq, void *v)
952 * eventually have to put a format interpreter in here ... 952 * eventually have to put a format interpreter in here ...
953 */ 953 */
954 seq_printf(seq, "%10d %15llu %8s %8s ", 954 seq_printf(seq, "%10d %15llu %8s %8s ",
955 e->seqno, e->timestamp, 955 be32_to_cpu(e->seqno),
956 be64_to_cpu(e->timestamp),
956 (e->level < ARRAY_SIZE(devlog_level_strings) 957 (e->level < ARRAY_SIZE(devlog_level_strings)
957 ? devlog_level_strings[e->level] 958 ? devlog_level_strings[e->level]
958 : "UNKNOWN"), 959 : "UNKNOWN"),
959 (e->facility < ARRAY_SIZE(devlog_facility_strings) 960 (e->facility < ARRAY_SIZE(devlog_facility_strings)
960 ? devlog_facility_strings[e->facility] 961 ? devlog_facility_strings[e->facility]
961 : "UNKNOWN")); 962 : "UNKNOWN"));
962 seq_printf(seq, e->fmt, e->params[0], e->params[1], 963 seq_printf(seq, e->fmt,
963 e->params[2], e->params[3], e->params[4], 964 be32_to_cpu(e->params[0]),
964 e->params[5], e->params[6], e->params[7]); 965 be32_to_cpu(e->params[1]),
966 be32_to_cpu(e->params[2]),
967 be32_to_cpu(e->params[3]),
968 be32_to_cpu(e->params[4]),
969 be32_to_cpu(e->params[5]),
970 be32_to_cpu(e->params[6]),
971 be32_to_cpu(e->params[7]));
965 } 972 }
966 return 0; 973 return 0;
967} 974}
@@ -1043,23 +1050,17 @@ static int devlog_open(struct inode *inode, struct file *file)
1043 return ret; 1050 return ret;
1044 } 1051 }
1045 1052
1046 /* Translate log multi-byte integral elements into host native format 1053 /* Find the earliest (lowest Sequence Number) log entry in the
1047 * and determine where the first entry in the log is. 1054 * circular Device Log.
1048 */ 1055 */
1049 for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) { 1056 for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) {
1050 struct fw_devlog_e *e = &dinfo->log[index]; 1057 struct fw_devlog_e *e = &dinfo->log[index];
1051 int i;
1052 __u32 seqno; 1058 __u32 seqno;
1053 1059
1054 if (e->timestamp == 0) 1060 if (e->timestamp == 0)
1055 continue; 1061 continue;
1056 1062
1057 e->timestamp = (__force __be64)be64_to_cpu(e->timestamp);
1058 seqno = be32_to_cpu(e->seqno); 1063 seqno = be32_to_cpu(e->seqno);
1059 for (i = 0; i < 8; i++)
1060 e->params[i] =
1061 (__force __be32)be32_to_cpu(e->params[i]);
1062
1063 if (seqno < fseqno) { 1064 if (seqno < fseqno) {
1064 fseqno = seqno; 1065 fseqno = seqno;
1065 dinfo->first = index; 1066 dinfo->first = index;
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index da2004e2a741..918a8e42139b 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1170,7 +1170,7 @@ static int enic_poll(struct napi_struct *napi, int budget)
1170 wq_work_done, 1170 wq_work_done,
1171 0 /* dont unmask intr */, 1171 0 /* dont unmask intr */,
1172 0 /* dont reset intr timer */); 1172 0 /* dont reset intr timer */);
1173 return rq_work_done; 1173 return budget;
1174 } 1174 }
1175 1175
1176 if (budget > 0) 1176 if (budget > 0)
@@ -1191,6 +1191,7 @@ static int enic_poll(struct napi_struct *napi, int budget)
1191 0 /* don't reset intr timer */); 1191 0 /* don't reset intr timer */);
1192 1192
1193 err = vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf); 1193 err = vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf);
1194 enic_poll_unlock_napi(&enic->rq[cq_rq], napi);
1194 1195
1195 /* Buffer allocation failed. Stay in polling 1196 /* Buffer allocation failed. Stay in polling
1196 * mode so we can try to fill the ring again. 1197 * mode so we can try to fill the ring again.
@@ -1208,7 +1209,6 @@ static int enic_poll(struct napi_struct *napi, int budget)
1208 napi_complete(napi); 1209 napi_complete(napi);
1209 vnic_intr_unmask(&enic->intr[intr]); 1210 vnic_intr_unmask(&enic->intr[intr]);
1210 } 1211 }
1211 enic_poll_unlock_napi(&enic->rq[cq_rq], napi);
1212 1212
1213 return rq_work_done; 1213 return rq_work_done;
1214} 1214}
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1f89c59b4353..42e20e5385ac 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/pm_runtime.h>
27#include <linux/ptrace.h> 28#include <linux/ptrace.h>
28#include <linux/errno.h> 29#include <linux/errno.h>
29#include <linux/ioport.h> 30#include <linux/ioport.h>
@@ -77,6 +78,7 @@ static void fec_enet_itr_coal_init(struct net_device *ndev);
77#define FEC_ENET_RAEM_V 0x8 78#define FEC_ENET_RAEM_V 0x8
78#define FEC_ENET_RAFL_V 0x8 79#define FEC_ENET_RAFL_V 0x8
79#define FEC_ENET_OPD_V 0xFFF0 80#define FEC_ENET_OPD_V 0xFFF0
81#define FEC_MDIO_PM_TIMEOUT 100 /* ms */
80 82
81static struct platform_device_id fec_devtype[] = { 83static struct platform_device_id fec_devtype[] = {
82 { 84 {
@@ -1767,7 +1769,13 @@ static void fec_enet_adjust_link(struct net_device *ndev)
1767static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) 1769static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
1768{ 1770{
1769 struct fec_enet_private *fep = bus->priv; 1771 struct fec_enet_private *fep = bus->priv;
1772 struct device *dev = &fep->pdev->dev;
1770 unsigned long time_left; 1773 unsigned long time_left;
1774 int ret = 0;
1775
1776 ret = pm_runtime_get_sync(dev);
1777 if (IS_ERR_VALUE(ret))
1778 return ret;
1771 1779
1772 fep->mii_timeout = 0; 1780 fep->mii_timeout = 0;
1773 init_completion(&fep->mdio_done); 1781 init_completion(&fep->mdio_done);
@@ -1783,18 +1791,30 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
1783 if (time_left == 0) { 1791 if (time_left == 0) {
1784 fep->mii_timeout = 1; 1792 fep->mii_timeout = 1;
1785 netdev_err(fep->netdev, "MDIO read timeout\n"); 1793 netdev_err(fep->netdev, "MDIO read timeout\n");
1786 return -ETIMEDOUT; 1794 ret = -ETIMEDOUT;
1795 goto out;
1787 } 1796 }
1788 1797
1789 /* return value */ 1798 ret = FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA));
1790 return FEC_MMFR_DATA(readl(fep->hwp + FEC_MII_DATA)); 1799
1800out:
1801 pm_runtime_mark_last_busy(dev);
1802 pm_runtime_put_autosuspend(dev);
1803
1804 return ret;
1791} 1805}
1792 1806
1793static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, 1807static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
1794 u16 value) 1808 u16 value)
1795{ 1809{
1796 struct fec_enet_private *fep = bus->priv; 1810 struct fec_enet_private *fep = bus->priv;
1811 struct device *dev = &fep->pdev->dev;
1797 unsigned long time_left; 1812 unsigned long time_left;
1813 int ret = 0;
1814
1815 ret = pm_runtime_get_sync(dev);
1816 if (IS_ERR_VALUE(ret))
1817 return ret;
1798 1818
1799 fep->mii_timeout = 0; 1819 fep->mii_timeout = 0;
1800 init_completion(&fep->mdio_done); 1820 init_completion(&fep->mdio_done);
@@ -1811,10 +1831,13 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
1811 if (time_left == 0) { 1831 if (time_left == 0) {
1812 fep->mii_timeout = 1; 1832 fep->mii_timeout = 1;
1813 netdev_err(fep->netdev, "MDIO write timeout\n"); 1833 netdev_err(fep->netdev, "MDIO write timeout\n");
1814 return -ETIMEDOUT; 1834 ret = -ETIMEDOUT;
1815 } 1835 }
1816 1836
1817 return 0; 1837 pm_runtime_mark_last_busy(dev);
1838 pm_runtime_put_autosuspend(dev);
1839
1840 return ret;
1818} 1841}
1819 1842
1820static int fec_enet_clk_enable(struct net_device *ndev, bool enable) 1843static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
@@ -1826,9 +1849,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
1826 ret = clk_prepare_enable(fep->clk_ahb); 1849 ret = clk_prepare_enable(fep->clk_ahb);
1827 if (ret) 1850 if (ret)
1828 return ret; 1851 return ret;
1829 ret = clk_prepare_enable(fep->clk_ipg);
1830 if (ret)
1831 goto failed_clk_ipg;
1832 if (fep->clk_enet_out) { 1852 if (fep->clk_enet_out) {
1833 ret = clk_prepare_enable(fep->clk_enet_out); 1853 ret = clk_prepare_enable(fep->clk_enet_out);
1834 if (ret) 1854 if (ret)
@@ -1852,7 +1872,6 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
1852 } 1872 }
1853 } else { 1873 } else {
1854 clk_disable_unprepare(fep->clk_ahb); 1874 clk_disable_unprepare(fep->clk_ahb);
1855 clk_disable_unprepare(fep->clk_ipg);
1856 if (fep->clk_enet_out) 1875 if (fep->clk_enet_out)
1857 clk_disable_unprepare(fep->clk_enet_out); 1876 clk_disable_unprepare(fep->clk_enet_out);
1858 if (fep->clk_ptp) { 1877 if (fep->clk_ptp) {
@@ -1874,8 +1893,6 @@ failed_clk_ptp:
1874 if (fep->clk_enet_out) 1893 if (fep->clk_enet_out)
1875 clk_disable_unprepare(fep->clk_enet_out); 1894 clk_disable_unprepare(fep->clk_enet_out);
1876failed_clk_enet_out: 1895failed_clk_enet_out:
1877 clk_disable_unprepare(fep->clk_ipg);
1878failed_clk_ipg:
1879 clk_disable_unprepare(fep->clk_ahb); 1896 clk_disable_unprepare(fep->clk_ahb);
1880 1897
1881 return ret; 1898 return ret;
@@ -2847,10 +2864,14 @@ fec_enet_open(struct net_device *ndev)
2847 struct fec_enet_private *fep = netdev_priv(ndev); 2864 struct fec_enet_private *fep = netdev_priv(ndev);
2848 int ret; 2865 int ret;
2849 2866
2867 ret = pm_runtime_get_sync(&fep->pdev->dev);
2868 if (IS_ERR_VALUE(ret))
2869 return ret;
2870
2850 pinctrl_pm_select_default_state(&fep->pdev->dev); 2871 pinctrl_pm_select_default_state(&fep->pdev->dev);
2851 ret = fec_enet_clk_enable(ndev, true); 2872 ret = fec_enet_clk_enable(ndev, true);
2852 if (ret) 2873 if (ret)
2853 return ret; 2874 goto clk_enable;
2854 2875
2855 /* I should reset the ring buffers here, but I don't yet know 2876 /* I should reset the ring buffers here, but I don't yet know
2856 * a simple way to do that. 2877 * a simple way to do that.
@@ -2881,6 +2902,9 @@ err_enet_mii_probe:
2881 fec_enet_free_buffers(ndev); 2902 fec_enet_free_buffers(ndev);
2882err_enet_alloc: 2903err_enet_alloc:
2883 fec_enet_clk_enable(ndev, false); 2904 fec_enet_clk_enable(ndev, false);
2905clk_enable:
2906 pm_runtime_mark_last_busy(&fep->pdev->dev);
2907 pm_runtime_put_autosuspend(&fep->pdev->dev);
2884 pinctrl_pm_select_sleep_state(&fep->pdev->dev); 2908 pinctrl_pm_select_sleep_state(&fep->pdev->dev);
2885 return ret; 2909 return ret;
2886} 2910}
@@ -2903,6 +2927,9 @@ fec_enet_close(struct net_device *ndev)
2903 2927
2904 fec_enet_clk_enable(ndev, false); 2928 fec_enet_clk_enable(ndev, false);
2905 pinctrl_pm_select_sleep_state(&fep->pdev->dev); 2929 pinctrl_pm_select_sleep_state(&fep->pdev->dev);
2930 pm_runtime_mark_last_busy(&fep->pdev->dev);
2931 pm_runtime_put_autosuspend(&fep->pdev->dev);
2932
2906 fec_enet_free_buffers(ndev); 2933 fec_enet_free_buffers(ndev);
2907 2934
2908 return 0; 2935 return 0;
@@ -3388,6 +3415,10 @@ fec_probe(struct platform_device *pdev)
3388 if (ret) 3415 if (ret)
3389 goto failed_clk; 3416 goto failed_clk;
3390 3417
3418 ret = clk_prepare_enable(fep->clk_ipg);
3419 if (ret)
3420 goto failed_clk_ipg;
3421
3391 fep->reg_phy = devm_regulator_get(&pdev->dev, "phy"); 3422 fep->reg_phy = devm_regulator_get(&pdev->dev, "phy");
3392 if (!IS_ERR(fep->reg_phy)) { 3423 if (!IS_ERR(fep->reg_phy)) {
3393 ret = regulator_enable(fep->reg_phy); 3424 ret = regulator_enable(fep->reg_phy);
@@ -3434,6 +3465,8 @@ fec_probe(struct platform_device *pdev)
3434 netif_carrier_off(ndev); 3465 netif_carrier_off(ndev);
3435 fec_enet_clk_enable(ndev, false); 3466 fec_enet_clk_enable(ndev, false);
3436 pinctrl_pm_select_sleep_state(&pdev->dev); 3467 pinctrl_pm_select_sleep_state(&pdev->dev);
3468 pm_runtime_set_active(&pdev->dev);
3469 pm_runtime_enable(&pdev->dev);
3437 3470
3438 ret = register_netdev(ndev); 3471 ret = register_netdev(ndev);
3439 if (ret) 3472 if (ret)
@@ -3447,6 +3480,12 @@ fec_probe(struct platform_device *pdev)
3447 3480
3448 fep->rx_copybreak = COPYBREAK_DEFAULT; 3481 fep->rx_copybreak = COPYBREAK_DEFAULT;
3449 INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work); 3482 INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
3483
3484 pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
3485 pm_runtime_use_autosuspend(&pdev->dev);
3486 pm_runtime_mark_last_busy(&pdev->dev);
3487 pm_runtime_put_autosuspend(&pdev->dev);
3488
3450 return 0; 3489 return 0;
3451 3490
3452failed_register: 3491failed_register:
@@ -3457,6 +3496,8 @@ failed_init:
3457 if (fep->reg_phy) 3496 if (fep->reg_phy)
3458 regulator_disable(fep->reg_phy); 3497 regulator_disable(fep->reg_phy);
3459failed_regulator: 3498failed_regulator:
3499 clk_disable_unprepare(fep->clk_ipg);
3500failed_clk_ipg:
3460 fec_enet_clk_enable(ndev, false); 3501 fec_enet_clk_enable(ndev, false);
3461failed_clk: 3502failed_clk:
3462failed_phy: 3503failed_phy:
@@ -3568,7 +3609,28 @@ failed_clk:
3568 return ret; 3609 return ret;
3569} 3610}
3570 3611
3571static SIMPLE_DEV_PM_OPS(fec_pm_ops, fec_suspend, fec_resume); 3612static int __maybe_unused fec_runtime_suspend(struct device *dev)
3613{
3614 struct net_device *ndev = dev_get_drvdata(dev);
3615 struct fec_enet_private *fep = netdev_priv(ndev);
3616
3617 clk_disable_unprepare(fep->clk_ipg);
3618
3619 return 0;
3620}
3621
3622static int __maybe_unused fec_runtime_resume(struct device *dev)
3623{
3624 struct net_device *ndev = dev_get_drvdata(dev);
3625 struct fec_enet_private *fep = netdev_priv(ndev);
3626
3627 return clk_prepare_enable(fep->clk_ipg);
3628}
3629
3630static const struct dev_pm_ops fec_pm_ops = {
3631 SET_SYSTEM_SLEEP_PM_OPS(fec_suspend, fec_resume)
3632 SET_RUNTIME_PM_OPS(fec_runtime_suspend, fec_runtime_resume, NULL)
3633};
3572 3634
3573static struct platform_driver fec_driver = { 3635static struct platform_driver fec_driver = {
3574 .driver = { 3636 .driver = {
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 847643455468..605cc8948594 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -101,6 +101,11 @@ static unsigned int efx_ef10_mem_map_size(struct efx_nic *efx)
101 return resource_size(&efx->pci_dev->resource[bar]); 101 return resource_size(&efx->pci_dev->resource[bar]);
102} 102}
103 103
104static bool efx_ef10_is_vf(struct efx_nic *efx)
105{
106 return efx->type->is_vf;
107}
108
104static int efx_ef10_get_pf_index(struct efx_nic *efx) 109static int efx_ef10_get_pf_index(struct efx_nic *efx)
105{ 110{
106 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN); 111 MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN);
@@ -677,6 +682,48 @@ static int efx_ef10_probe_pf(struct efx_nic *efx)
677 return efx_ef10_probe(efx); 682 return efx_ef10_probe(efx);
678} 683}
679 684
685int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id)
686{
687 MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_ALLOC_IN_LEN);
688
689 MCDI_SET_DWORD(inbuf, VADAPTOR_ALLOC_IN_UPSTREAM_PORT_ID, port_id);
690 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf),
691 NULL, 0, NULL);
692}
693
694int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id)
695{
696 MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_FREE_IN_LEN);
697
698 MCDI_SET_DWORD(inbuf, VADAPTOR_FREE_IN_UPSTREAM_PORT_ID, port_id);
699 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf),
700 NULL, 0, NULL);
701}
702
703int efx_ef10_vport_add_mac(struct efx_nic *efx,
704 unsigned int port_id, u8 *mac)
705{
706 MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_ADD_MAC_ADDRESS_IN_LEN);
707
708 MCDI_SET_DWORD(inbuf, VPORT_ADD_MAC_ADDRESS_IN_VPORT_ID, port_id);
709 ether_addr_copy(MCDI_PTR(inbuf, VPORT_ADD_MAC_ADDRESS_IN_MACADDR), mac);
710
711 return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf,
712 sizeof(inbuf), NULL, 0, NULL);
713}
714
715int efx_ef10_vport_del_mac(struct efx_nic *efx,
716 unsigned int port_id, u8 *mac)
717{
718 MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN);
719
720 MCDI_SET_DWORD(inbuf, VPORT_DEL_MAC_ADDRESS_IN_VPORT_ID, port_id);
721 ether_addr_copy(MCDI_PTR(inbuf, VPORT_DEL_MAC_ADDRESS_IN_MACADDR), mac);
722
723 return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf,
724 sizeof(inbuf), NULL, 0, NULL);
725}
726
680#ifdef CONFIG_SFC_SRIOV 727#ifdef CONFIG_SFC_SRIOV
681static int efx_ef10_probe_vf(struct efx_nic *efx) 728static int efx_ef10_probe_vf(struct efx_nic *efx)
682{ 729{
@@ -3804,6 +3851,72 @@ static void efx_ef10_filter_sync_rx_mode(struct efx_nic *efx)
3804 WARN_ON(remove_failed); 3851 WARN_ON(remove_failed);
3805} 3852}
3806 3853
3854static int efx_ef10_vport_set_mac_address(struct efx_nic *efx)
3855{
3856 struct efx_ef10_nic_data *nic_data = efx->nic_data;
3857 u8 mac_old[ETH_ALEN];
3858 int rc, rc2;
3859
3860 /* Only reconfigure a PF-created vport */
3861 if (is_zero_ether_addr(nic_data->vport_mac))
3862 return 0;
3863
3864 efx_device_detach_sync(efx);
3865 efx_net_stop(efx->net_dev);
3866 down_write(&efx->filter_sem);
3867 efx_ef10_filter_table_remove(efx);
3868 up_write(&efx->filter_sem);
3869
3870 rc = efx_ef10_vadaptor_free(efx, nic_data->vport_id);
3871 if (rc)
3872 goto restore_filters;
3873
3874 ether_addr_copy(mac_old, nic_data->vport_mac);
3875 rc = efx_ef10_vport_del_mac(efx, nic_data->vport_id,
3876 nic_data->vport_mac);
3877 if (rc)
3878 goto restore_vadaptor;
3879
3880 rc = efx_ef10_vport_add_mac(efx, nic_data->vport_id,
3881 efx->net_dev->dev_addr);
3882 if (!rc) {
3883 ether_addr_copy(nic_data->vport_mac, efx->net_dev->dev_addr);
3884 } else {
3885 rc2 = efx_ef10_vport_add_mac(efx, nic_data->vport_id, mac_old);
3886 if (rc2) {
3887 /* Failed to add original MAC, so clear vport_mac */
3888 eth_zero_addr(nic_data->vport_mac);
3889 goto reset_nic;
3890 }
3891 }
3892
3893restore_vadaptor:
3894 rc2 = efx_ef10_vadaptor_alloc(efx, nic_data->vport_id);
3895 if (rc2)
3896 goto reset_nic;
3897restore_filters:
3898 down_write(&efx->filter_sem);
3899 rc2 = efx_ef10_filter_table_probe(efx);
3900 up_write(&efx->filter_sem);
3901 if (rc2)
3902 goto reset_nic;
3903
3904 rc2 = efx_net_open(efx->net_dev);
3905 if (rc2)
3906 goto reset_nic;
3907
3908 netif_device_attach(efx->net_dev);
3909
3910 return rc;
3911
3912reset_nic:
3913 netif_err(efx, drv, efx->net_dev,
3914 "Failed to restore when changing MAC address - scheduling reset\n");
3915 efx_schedule_reset(efx, RESET_TYPE_DATAPATH);
3916
3917 return rc ? rc : rc2;
3918}
3919
3807static int efx_ef10_set_mac_address(struct efx_nic *efx) 3920static int efx_ef10_set_mac_address(struct efx_nic *efx)
3808{ 3921{
3809 MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_SET_MAC_IN_LEN); 3922 MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_SET_MAC_IN_LEN);
@@ -3820,8 +3933,8 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx)
3820 efx->net_dev->dev_addr); 3933 efx->net_dev->dev_addr);
3821 MCDI_SET_DWORD(inbuf, VADAPTOR_SET_MAC_IN_UPSTREAM_PORT_ID, 3934 MCDI_SET_DWORD(inbuf, VADAPTOR_SET_MAC_IN_UPSTREAM_PORT_ID,
3822 nic_data->vport_id); 3935 nic_data->vport_id);
3823 rc = efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf, 3936 rc = efx_mcdi_rpc_quiet(efx, MC_CMD_VADAPTOR_SET_MAC, inbuf,
3824 sizeof(inbuf), NULL, 0, NULL); 3937 sizeof(inbuf), NULL, 0, NULL);
3825 3938
3826 efx_ef10_filter_table_probe(efx); 3939 efx_ef10_filter_table_probe(efx);
3827 up_write(&efx->filter_sem); 3940 up_write(&efx->filter_sem);
@@ -3829,38 +3942,27 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx)
3829 efx_net_open(efx->net_dev); 3942 efx_net_open(efx->net_dev);
3830 netif_device_attach(efx->net_dev); 3943 netif_device_attach(efx->net_dev);
3831 3944
3832#if !defined(CONFIG_SFC_SRIOV) 3945#ifdef CONFIG_SFC_SRIOV
3833 if (rc == -EPERM) 3946 if (efx->pci_dev->is_virtfn && efx->pci_dev->physfn) {
3834 netif_err(efx, drv, efx->net_dev,
3835 "Cannot change MAC address; use sfboot to enable mac-spoofing"
3836 " on this interface\n");
3837#else
3838 if (rc == -EPERM) {
3839 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn; 3947 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn;
3840 3948
3841 /* Switch to PF and change MAC address on vport */ 3949 if (rc == -EPERM) {
3842 if (efx->pci_dev->is_virtfn && pci_dev_pf) { 3950 struct efx_nic *efx_pf;
3843 struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf);
3844 3951
3845 if (!efx_ef10_sriov_set_vf_mac(efx_pf, 3952 /* Switch to PF and change MAC address on vport */
3846 nic_data->vf_index, 3953 efx_pf = pci_get_drvdata(pci_dev_pf);
3847 efx->net_dev->dev_addr))
3848 return 0;
3849 }
3850 netif_err(efx, drv, efx->net_dev,
3851 "Cannot change MAC address; use sfboot to enable mac-spoofing"
3852 " on this interface\n");
3853 } else if (efx->pci_dev->is_virtfn) {
3854 /* Successfully changed by VF (with MAC spoofing), so update the
3855 * parent PF if possible.
3856 */
3857 struct pci_dev *pci_dev_pf = efx->pci_dev->physfn;
3858 3954
3859 if (pci_dev_pf) { 3955 rc = efx_ef10_sriov_set_vf_mac(efx_pf,
3956 nic_data->vf_index,
3957 efx->net_dev->dev_addr);
3958 } else if (!rc) {
3860 struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf); 3959 struct efx_nic *efx_pf = pci_get_drvdata(pci_dev_pf);
3861 struct efx_ef10_nic_data *nic_data = efx_pf->nic_data; 3960 struct efx_ef10_nic_data *nic_data = efx_pf->nic_data;
3862 unsigned int i; 3961 unsigned int i;
3863 3962
3963 /* MAC address successfully changed by VF (with MAC
3964 * spoofing) so update the parent PF if possible.
3965 */
3864 for (i = 0; i < efx_pf->vf_count; ++i) { 3966 for (i = 0; i < efx_pf->vf_count; ++i) {
3865 struct ef10_vf *vf = nic_data->vf + i; 3967 struct ef10_vf *vf = nic_data->vf + i;
3866 3968
@@ -3871,8 +3973,24 @@ static int efx_ef10_set_mac_address(struct efx_nic *efx)
3871 } 3973 }
3872 } 3974 }
3873 } 3975 }
3874 } 3976 } else
3875#endif 3977#endif
3978 if (rc == -EPERM) {
3979 netif_err(efx, drv, efx->net_dev,
3980 "Cannot change MAC address; use sfboot to enable"
3981 " mac-spoofing on this interface\n");
3982 } else if (rc == -ENOSYS && !efx_ef10_is_vf(efx)) {
3983 /* If the active MCFW does not support MC_CMD_VADAPTOR_SET_MAC
3984 * fall-back to the method of changing the MAC address on the
3985 * vport. This only applies to PFs because such versions of
3986 * MCFW do not support VFs.
3987 */
3988 rc = efx_ef10_vport_set_mac_address(efx);
3989 } else {
3990 efx_mcdi_display_error(efx, MC_CMD_VADAPTOR_SET_MAC,
3991 sizeof(inbuf), NULL, 0, rc);
3992 }
3993
3876 return rc; 3994 return rc;
3877} 3995}
3878 3996
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
index 6c9b6e45509a..3c17f274e802 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.c
+++ b/drivers/net/ethernet/sfc/ef10_sriov.c
@@ -29,30 +29,6 @@ static int efx_ef10_evb_port_assign(struct efx_nic *efx, unsigned int port_id,
29 NULL, 0, NULL); 29 NULL, 0, NULL);
30} 30}
31 31
32static int efx_ef10_vport_add_mac(struct efx_nic *efx,
33 unsigned int port_id, u8 *mac)
34{
35 MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_ADD_MAC_ADDRESS_IN_LEN);
36
37 MCDI_SET_DWORD(inbuf, VPORT_ADD_MAC_ADDRESS_IN_VPORT_ID, port_id);
38 ether_addr_copy(MCDI_PTR(inbuf, VPORT_ADD_MAC_ADDRESS_IN_MACADDR), mac);
39
40 return efx_mcdi_rpc(efx, MC_CMD_VPORT_ADD_MAC_ADDRESS, inbuf,
41 sizeof(inbuf), NULL, 0, NULL);
42}
43
44static int efx_ef10_vport_del_mac(struct efx_nic *efx,
45 unsigned int port_id, u8 *mac)
46{
47 MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN);
48
49 MCDI_SET_DWORD(inbuf, VPORT_DEL_MAC_ADDRESS_IN_VPORT_ID, port_id);
50 ether_addr_copy(MCDI_PTR(inbuf, VPORT_DEL_MAC_ADDRESS_IN_MACADDR), mac);
51
52 return efx_mcdi_rpc(efx, MC_CMD_VPORT_DEL_MAC_ADDRESS, inbuf,
53 sizeof(inbuf), NULL, 0, NULL);
54}
55
56static int efx_ef10_vswitch_alloc(struct efx_nic *efx, unsigned int port_id, 32static int efx_ef10_vswitch_alloc(struct efx_nic *efx, unsigned int port_id,
57 unsigned int vswitch_type) 33 unsigned int vswitch_type)
58{ 34{
@@ -136,24 +112,6 @@ static int efx_ef10_vport_free(struct efx_nic *efx, unsigned int port_id)
136 NULL, 0, NULL); 112 NULL, 0, NULL);
137} 113}
138 114
139static int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id)
140{
141 MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_ALLOC_IN_LEN);
142
143 MCDI_SET_DWORD(inbuf, VADAPTOR_ALLOC_IN_UPSTREAM_PORT_ID, port_id);
144 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_ALLOC, inbuf, sizeof(inbuf),
145 NULL, 0, NULL);
146}
147
148static int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id)
149{
150 MCDI_DECLARE_BUF(inbuf, MC_CMD_VADAPTOR_FREE_IN_LEN);
151
152 MCDI_SET_DWORD(inbuf, VADAPTOR_FREE_IN_UPSTREAM_PORT_ID, port_id);
153 return efx_mcdi_rpc(efx, MC_CMD_VADAPTOR_FREE, inbuf, sizeof(inbuf),
154 NULL, 0, NULL);
155}
156
157static void efx_ef10_sriov_free_vf_vports(struct efx_nic *efx) 115static void efx_ef10_sriov_free_vf_vports(struct efx_nic *efx)
158{ 116{
159 struct efx_ef10_nic_data *nic_data = efx->nic_data; 117 struct efx_ef10_nic_data *nic_data = efx->nic_data;
@@ -640,21 +598,21 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan,
640 MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL, 598 MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL,
641 vf->vlan, &vf->vport_id); 599 vf->vlan, &vf->vport_id);
642 if (rc) 600 if (rc)
643 goto reset_nic; 601 goto reset_nic_up_write;
644 602
645restore_mac: 603restore_mac:
646 if (!is_zero_ether_addr(vf->mac)) { 604 if (!is_zero_ether_addr(vf->mac)) {
647 rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac); 605 rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac);
648 if (rc2) { 606 if (rc2) {
649 eth_zero_addr(vf->mac); 607 eth_zero_addr(vf->mac);
650 goto reset_nic; 608 goto reset_nic_up_write;
651 } 609 }
652 } 610 }
653 611
654restore_evb_port: 612restore_evb_port:
655 rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); 613 rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i);
656 if (rc2) 614 if (rc2)
657 goto reset_nic; 615 goto reset_nic_up_write;
658 else 616 else
659 vf->vport_assigned = 1; 617 vf->vport_assigned = 1;
660 618
@@ -662,14 +620,16 @@ restore_vadaptor:
662 if (vf->efx) { 620 if (vf->efx) {
663 rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED); 621 rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED);
664 if (rc2) 622 if (rc2)
665 goto reset_nic; 623 goto reset_nic_up_write;
666 } 624 }
667 625
668restore_filters: 626restore_filters:
669 if (vf->efx) { 627 if (vf->efx) {
670 rc2 = vf->efx->type->filter_table_probe(vf->efx); 628 rc2 = vf->efx->type->filter_table_probe(vf->efx);
671 if (rc2) 629 if (rc2)
672 goto reset_nic; 630 goto reset_nic_up_write;
631
632 up_write(&vf->efx->filter_sem);
673 633
674 up_write(&vf->efx->filter_sem); 634 up_write(&vf->efx->filter_sem);
675 635
@@ -681,9 +641,12 @@ restore_filters:
681 } 641 }
682 return rc; 642 return rc;
683 643
644reset_nic_up_write:
645 if (vf->efx)
646 up_write(&vf->efx->filter_sem);
647
684reset_nic: 648reset_nic:
685 if (vf->efx) { 649 if (vf->efx) {
686 up_write(&vf->efx->filter_sem);
687 netif_err(efx, drv, efx->net_dev, 650 netif_err(efx, drv, efx->net_dev,
688 "Failed to restore VF - scheduling reset.\n"); 651 "Failed to restore VF - scheduling reset.\n");
689 efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH); 652 efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH);
diff --git a/drivers/net/ethernet/sfc/ef10_sriov.h b/drivers/net/ethernet/sfc/ef10_sriov.h
index db4ef537c610..6d25b92cb45e 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.h
+++ b/drivers/net/ethernet/sfc/ef10_sriov.h
@@ -65,5 +65,11 @@ int efx_ef10_vswitching_restore_pf(struct efx_nic *efx);
65int efx_ef10_vswitching_restore_vf(struct efx_nic *efx); 65int efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
66void efx_ef10_vswitching_remove_pf(struct efx_nic *efx); 66void efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
67void efx_ef10_vswitching_remove_vf(struct efx_nic *efx); 67void efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
68int efx_ef10_vport_add_mac(struct efx_nic *efx,
69 unsigned int port_id, u8 *mac);
70int efx_ef10_vport_del_mac(struct efx_nic *efx,
71 unsigned int port_id, u8 *mac);
72int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id);
73int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id);
68 74
69#endif /* EF10_SRIOV_H */ 75#endif /* EF10_SRIOV_H */
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 804b9ad553d3..03bc03b67f08 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -245,11 +245,17 @@ static int efx_check_disabled(struct efx_nic *efx)
245 */ 245 */
246static int efx_process_channel(struct efx_channel *channel, int budget) 246static int efx_process_channel(struct efx_channel *channel, int budget)
247{ 247{
248 struct efx_tx_queue *tx_queue;
248 int spent; 249 int spent;
249 250
250 if (unlikely(!channel->enabled)) 251 if (unlikely(!channel->enabled))
251 return 0; 252 return 0;
252 253
254 efx_for_each_channel_tx_queue(tx_queue, channel) {
255 tx_queue->pkts_compl = 0;
256 tx_queue->bytes_compl = 0;
257 }
258
253 spent = efx_nic_process_eventq(channel, budget); 259 spent = efx_nic_process_eventq(channel, budget);
254 if (spent && efx_channel_has_rx_queue(channel)) { 260 if (spent && efx_channel_has_rx_queue(channel)) {
255 struct efx_rx_queue *rx_queue = 261 struct efx_rx_queue *rx_queue =
@@ -259,6 +265,14 @@ static int efx_process_channel(struct efx_channel *channel, int budget)
259 efx_fast_push_rx_descriptors(rx_queue, true); 265 efx_fast_push_rx_descriptors(rx_queue, true);
260 } 266 }
261 267
268 /* Update BQL */
269 efx_for_each_channel_tx_queue(tx_queue, channel) {
270 if (tx_queue->bytes_compl) {
271 netdev_tx_completed_queue(tx_queue->core_txq,
272 tx_queue->pkts_compl, tx_queue->bytes_compl);
273 }
274 }
275
262 return spent; 276 return spent;
263} 277}
264 278
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index d72f522bf9c3..47d1e3a96522 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -241,6 +241,8 @@ struct efx_tx_queue {
241 unsigned int read_count ____cacheline_aligned_in_smp; 241 unsigned int read_count ____cacheline_aligned_in_smp;
242 unsigned int old_write_count; 242 unsigned int old_write_count;
243 unsigned int merge_events; 243 unsigned int merge_events;
244 unsigned int bytes_compl;
245 unsigned int pkts_compl;
244 246
245 /* Members used only on the xmit path */ 247 /* Members used only on the xmit path */
246 unsigned int insert_count ____cacheline_aligned_in_smp; 248 unsigned int insert_count ____cacheline_aligned_in_smp;
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index aaf2987512b5..1833a0146571 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -617,7 +617,8 @@ void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index)
617 EFX_BUG_ON_PARANOID(index > tx_queue->ptr_mask); 617 EFX_BUG_ON_PARANOID(index > tx_queue->ptr_mask);
618 618
619 efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl); 619 efx_dequeue_buffers(tx_queue, index, &pkts_compl, &bytes_compl);
620 netdev_tx_completed_queue(tx_queue->core_txq, pkts_compl, bytes_compl); 620 tx_queue->pkts_compl += pkts_compl;
621 tx_queue->bytes_compl += bytes_compl;
621 622
622 if (pkts_compl > 1) 623 if (pkts_compl > 1)
623 ++tx_queue->merge_events; 624 ++tx_queue->merge_events;
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 462820514fae..f335bf119ab5 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -138,19 +138,6 @@ do { \
138#define CPSW_CMINTMAX_INTVL (1000 / CPSW_CMINTMIN_CNT) 138#define CPSW_CMINTMAX_INTVL (1000 / CPSW_CMINTMIN_CNT)
139#define CPSW_CMINTMIN_INTVL ((1000 / CPSW_CMINTMAX_CNT) + 1) 139#define CPSW_CMINTMIN_INTVL ((1000 / CPSW_CMINTMAX_CNT) + 1)
140 140
141#define cpsw_enable_irq(priv) \
142 do { \
143 u32 i; \
144 for (i = 0; i < priv->num_irqs; i++) \
145 enable_irq(priv->irqs_table[i]); \
146 } while (0)
147#define cpsw_disable_irq(priv) \
148 do { \
149 u32 i; \
150 for (i = 0; i < priv->num_irqs; i++) \
151 disable_irq_nosync(priv->irqs_table[i]); \
152 } while (0)
153
154#define cpsw_slave_index(priv) \ 141#define cpsw_slave_index(priv) \
155 ((priv->data.dual_emac) ? priv->emac_port : \ 142 ((priv->data.dual_emac) ? priv->emac_port : \
156 priv->data.active_slave) 143 priv->data.active_slave)
@@ -509,9 +496,11 @@ static const struct cpsw_stats cpsw_gstrings_stats[] = {
509 (func)(slave++, ##arg); \ 496 (func)(slave++, ##arg); \
510 } while (0) 497 } while (0)
511#define cpsw_get_slave_ndev(priv, __slave_no__) \ 498#define cpsw_get_slave_ndev(priv, __slave_no__) \
512 (priv->slaves[__slave_no__].ndev) 499 ((__slave_no__ < priv->data.slaves) ? \
500 priv->slaves[__slave_no__].ndev : NULL)
513#define cpsw_get_slave_priv(priv, __slave_no__) \ 501#define cpsw_get_slave_priv(priv, __slave_no__) \
514 ((priv->slaves[__slave_no__].ndev) ? \ 502 (((__slave_no__ < priv->data.slaves) && \
503 (priv->slaves[__slave_no__].ndev)) ? \
515 netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \ 504 netdev_priv(priv->slaves[__slave_no__].ndev) : NULL) \
516 505
517#define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \ 506#define cpsw_dual_emac_src_port_detect(status, priv, ndev, skb) \
@@ -781,7 +770,7 @@ static irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id)
781 770
782 cpsw_intr_disable(priv); 771 cpsw_intr_disable(priv);
783 if (priv->irq_enabled == true) { 772 if (priv->irq_enabled == true) {
784 cpsw_disable_irq(priv); 773 disable_irq_nosync(priv->irqs_table[0]);
785 priv->irq_enabled = false; 774 priv->irq_enabled = false;
786 } 775 }
787 776
@@ -817,7 +806,7 @@ static int cpsw_poll(struct napi_struct *napi, int budget)
817 prim_cpsw = cpsw_get_slave_priv(priv, 0); 806 prim_cpsw = cpsw_get_slave_priv(priv, 0);
818 if (prim_cpsw->irq_enabled == false) { 807 if (prim_cpsw->irq_enabled == false) {
819 prim_cpsw->irq_enabled = true; 808 prim_cpsw->irq_enabled = true;
820 cpsw_enable_irq(priv); 809 enable_irq(priv->irqs_table[0]);
821 } 810 }
822 } 811 }
823 812
@@ -1333,7 +1322,7 @@ static int cpsw_ndo_open(struct net_device *ndev)
1333 if (prim_cpsw->irq_enabled == false) { 1322 if (prim_cpsw->irq_enabled == false) {
1334 if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) { 1323 if ((priv == prim_cpsw) || !netif_running(prim_cpsw->ndev)) {
1335 prim_cpsw->irq_enabled = true; 1324 prim_cpsw->irq_enabled = true;
1336 cpsw_enable_irq(prim_cpsw); 1325 enable_irq(prim_cpsw->irqs_table[0]);
1337 } 1326 }
1338 } 1327 }
1339 1328
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4208dd7ef101..d95f9aae95e7 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1530,9 +1530,9 @@ static int axienet_probe(struct platform_device *pdev)
1530 /* Map device registers */ 1530 /* Map device registers */
1531 ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1531 ethres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1532 lp->regs = devm_ioremap_resource(&pdev->dev, ethres); 1532 lp->regs = devm_ioremap_resource(&pdev->dev, ethres);
1533 if (!lp->regs) { 1533 if (IS_ERR(lp->regs)) {
1534 dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n"); 1534 dev_err(&pdev->dev, "could not map Axi Ethernet regs.\n");
1535 ret = -ENOMEM; 1535 ret = PTR_ERR(lp->regs);
1536 goto free_netdev; 1536 goto free_netdev;
1537 } 1537 }
1538 1538
@@ -1599,9 +1599,9 @@ static int axienet_probe(struct platform_device *pdev)
1599 goto free_netdev; 1599 goto free_netdev;
1600 } 1600 }
1601 lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares); 1601 lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares);
1602 if (!lp->dma_regs) { 1602 if (IS_ERR(lp->dma_regs)) {
1603 dev_err(&pdev->dev, "could not map DMA regs\n"); 1603 dev_err(&pdev->dev, "could not map DMA regs\n");
1604 ret = -ENOMEM; 1604 ret = PTR_ERR(lp->dma_regs);
1605 goto free_netdev; 1605 goto free_netdev;
1606 } 1606 }
1607 lp->rx_irq = irq_of_parse_and_map(np, 1); 1607 lp->rx_irq = irq_of_parse_and_map(np, 1);
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index 7856b6ccf5c5..d95a50ae996d 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -482,6 +482,7 @@ static void bpq_setup(struct net_device *dev)
482 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN); 482 memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
483 483
484 dev->flags = 0; 484 dev->flags = 0;
485 dev->features = NETIF_F_LLTX; /* Allow recursion */
485 486
486#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 487#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
487 dev->header_ops = &ax25_header_ops; 488 dev->header_ops = &ax25_header_ops;
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index f8370808a018..3b933bb5a8d5 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -1355,6 +1355,7 @@ static void macvtap_exit(void)
1355 class_unregister(macvtap_class); 1355 class_unregister(macvtap_class);
1356 cdev_del(&macvtap_cdev); 1356 cdev_del(&macvtap_cdev);
1357 unregister_chrdev_region(macvtap_major, MACVTAP_NUM_DEVS); 1357 unregister_chrdev_region(macvtap_major, MACVTAP_NUM_DEVS);
1358 idr_destroy(&minor_idr);
1358} 1359}
1359module_exit(macvtap_exit); 1360module_exit(macvtap_exit);
1360 1361
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index cf18940f4e84..cb86d7a01542 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -191,7 +191,7 @@ config MDIO_BUS_MUX_GPIO
191 191
192config MDIO_BUS_MUX_MMIOREG 192config MDIO_BUS_MUX_MMIOREG
193 tristate "Support for MMIO device-controlled MDIO bus multiplexers" 193 tristate "Support for MMIO device-controlled MDIO bus multiplexers"
194 depends on OF_MDIO 194 depends on OF_MDIO && HAS_IOMEM
195 select MDIO_BUS_MUX 195 select MDIO_BUS_MUX
196 help 196 help
197 This module provides a driver for MDIO bus multiplexers that 197 This module provides a driver for MDIO bus multiplexers that
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 4545e78840b0..35a2bffe848a 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -523,6 +523,7 @@ static const struct driver_info wwan_info = {
523#define REALTEK_VENDOR_ID 0x0bda 523#define REALTEK_VENDOR_ID 0x0bda
524#define SAMSUNG_VENDOR_ID 0x04e8 524#define SAMSUNG_VENDOR_ID 0x04e8
525#define LENOVO_VENDOR_ID 0x17ef 525#define LENOVO_VENDOR_ID 0x17ef
526#define NVIDIA_VENDOR_ID 0x0955
526 527
527static const struct usb_device_id products[] = { 528static const struct usb_device_id products[] = {
528/* BLACKLIST !! 529/* BLACKLIST !!
@@ -710,6 +711,13 @@ static const struct usb_device_id products[] = {
710 .driver_info = 0, 711 .driver_info = 0,
711}, 712},
712 713
714/* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
715{
716 USB_DEVICE_AND_INTERFACE_INFO(NVIDIA_VENDOR_ID, 0x09ff, USB_CLASS_COMM,
717 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
718 .driver_info = 0,
719},
720
713/* WHITELIST!!! 721/* WHITELIST!!!
714 * 722 *
715 * CDC Ether uses two interfaces, not necessarily consecutive. 723 * CDC Ether uses two interfaces, not necessarily consecutive.
diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index e4b7a47a825c..efc18e05af0a 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -158,7 +158,7 @@ static int cdc_mbim_bind(struct usbnet *dev, struct usb_interface *intf)
158 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) 158 if (!cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting))
159 goto err; 159 goto err;
160 160
161 ret = cdc_ncm_bind_common(dev, intf, data_altsetting); 161 ret = cdc_ncm_bind_common(dev, intf, data_altsetting, 0);
162 if (ret) 162 if (ret)
163 goto err; 163 goto err;
164 164
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 8067b8fbb0ee..db40175b1a0b 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -6,7 +6,7 @@
6 * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com> 6 * Original author: Hans Petter Selasky <hans.petter.selasky@stericsson.com>
7 * 7 *
8 * USB Host Driver for Network Control Model (NCM) 8 * USB Host Driver for Network Control Model (NCM)
9 * http://www.usb.org/developers/devclass_docs/NCM10.zip 9 * http://www.usb.org/developers/docs/devclass_docs/NCM10_012011.zip
10 * 10 *
11 * The NCM encoding, decoding and initialization logic 11 * The NCM encoding, decoding and initialization logic
12 * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h 12 * derives from FreeBSD 8.x. if_cdce.c and if_cdcereg.h
@@ -684,10 +684,12 @@ static void cdc_ncm_free(struct cdc_ncm_ctx *ctx)
684 ctx->tx_curr_skb = NULL; 684 ctx->tx_curr_skb = NULL;
685 } 685 }
686 686
687 kfree(ctx->delayed_ndp16);
688
687 kfree(ctx); 689 kfree(ctx);
688} 690}
689 691
690int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting) 692int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags)
691{ 693{
692 const struct usb_cdc_union_desc *union_desc = NULL; 694 const struct usb_cdc_union_desc *union_desc = NULL;
693 struct cdc_ncm_ctx *ctx; 695 struct cdc_ncm_ctx *ctx;
@@ -855,6 +857,17 @@ advance:
855 /* finish setting up the device specific data */ 857 /* finish setting up the device specific data */
856 cdc_ncm_setup(dev); 858 cdc_ncm_setup(dev);
857 859
860 /* Device-specific flags */
861 ctx->drvflags = drvflags;
862
863 /* Allocate the delayed NDP if needed. */
864 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
865 ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL);
866 if (!ctx->delayed_ndp16)
867 goto error2;
868 dev_info(&intf->dev, "NDP will be placed at end of frame for this device.");
869 }
870
858 /* override ethtool_ops */ 871 /* override ethtool_ops */
859 dev->net->ethtool_ops = &cdc_ncm_ethtool_ops; 872 dev->net->ethtool_ops = &cdc_ncm_ethtool_ops;
860 873
@@ -954,8 +967,11 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
954 if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM) 967 if (cdc_ncm_select_altsetting(intf) != CDC_NCM_COMM_ALTSETTING_NCM)
955 return -ENODEV; 968 return -ENODEV;
956 969
957 /* The NCM data altsetting is fixed */ 970 /* The NCM data altsetting is fixed, so we hard-coded it.
958 ret = cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM); 971 * Additionally, generic NCM devices are assumed to accept arbitrarily
972 * placed NDP.
973 */
974 ret = cdc_ncm_bind_common(dev, intf, CDC_NCM_DATA_ALTSETTING_NCM, 0);
959 975
960 /* 976 /*
961 * We should get an event when network connection is "connected" or 977 * We should get an event when network connection is "connected" or
@@ -986,6 +1002,14 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_
986 struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data; 1002 struct usb_cdc_ncm_nth16 *nth16 = (void *)skb->data;
987 size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex); 1003 size_t ndpoffset = le16_to_cpu(nth16->wNdpIndex);
988 1004
1005 /* If NDP should be moved to the end of the NCM package, we can't follow the
1006 * NTH16 header as we would normally do. NDP isn't written to the SKB yet, and
1007 * the wNdpIndex field in the header is actually not consistent with reality. It will be later.
1008 */
1009 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
1010 if (ctx->delayed_ndp16->dwSignature == sign)
1011 return ctx->delayed_ndp16;
1012
989 /* follow the chain of NDPs, looking for a match */ 1013 /* follow the chain of NDPs, looking for a match */
990 while (ndpoffset) { 1014 while (ndpoffset) {
991 ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset); 1015 ndp16 = (struct usb_cdc_ncm_ndp16 *)(skb->data + ndpoffset);
@@ -995,7 +1019,8 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_
995 } 1019 }
996 1020
997 /* align new NDP */ 1021 /* align new NDP */
998 cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max); 1022 if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END))
1023 cdc_ncm_align_tail(skb, ctx->tx_ndp_modulus, 0, ctx->tx_max);
999 1024
1000 /* verify that there is room for the NDP and the datagram (reserve) */ 1025 /* verify that there is room for the NDP and the datagram (reserve) */
1001 if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size) 1026 if ((ctx->tx_max - skb->len - reserve) < ctx->max_ndp_size)
@@ -1008,7 +1033,11 @@ static struct usb_cdc_ncm_ndp16 *cdc_ncm_ndp(struct cdc_ncm_ctx *ctx, struct sk_
1008 nth16->wNdpIndex = cpu_to_le16(skb->len); 1033 nth16->wNdpIndex = cpu_to_le16(skb->len);
1009 1034
1010 /* push a new empty NDP */ 1035 /* push a new empty NDP */
1011 ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size); 1036 if (!(ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END))
1037 ndp16 = (struct usb_cdc_ncm_ndp16 *)memset(skb_put(skb, ctx->max_ndp_size), 0, ctx->max_ndp_size);
1038 else
1039 ndp16 = ctx->delayed_ndp16;
1040
1012 ndp16->dwSignature = sign; 1041 ndp16->dwSignature = sign;
1013 ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16)); 1042 ndp16->wLength = cpu_to_le16(sizeof(struct usb_cdc_ncm_ndp16) + sizeof(struct usb_cdc_ncm_dpe16));
1014 return ndp16; 1043 return ndp16;
@@ -1023,6 +1052,15 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1023 struct sk_buff *skb_out; 1052 struct sk_buff *skb_out;
1024 u16 n = 0, index, ndplen; 1053 u16 n = 0, index, ndplen;
1025 u8 ready2send = 0; 1054 u8 ready2send = 0;
1055 u32 delayed_ndp_size;
1056
1057 /* When our NDP gets written in cdc_ncm_ndp(), then skb_out->len gets updated
1058 * accordingly. Otherwise, we should check here.
1059 */
1060 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
1061 delayed_ndp_size = ctx->max_ndp_size;
1062 else
1063 delayed_ndp_size = 0;
1026 1064
1027 /* if there is a remaining skb, it gets priority */ 1065 /* if there is a remaining skb, it gets priority */
1028 if (skb != NULL) { 1066 if (skb != NULL) {
@@ -1077,7 +1115,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1077 cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max); 1115 cdc_ncm_align_tail(skb_out, ctx->tx_modulus, ctx->tx_remainder, ctx->tx_max);
1078 1116
1079 /* check if we had enough room left for both NDP and frame */ 1117 /* check if we had enough room left for both NDP and frame */
1080 if (!ndp16 || skb_out->len + skb->len > ctx->tx_max) { 1118 if (!ndp16 || skb_out->len + skb->len + delayed_ndp_size > ctx->tx_max) {
1081 if (n == 0) { 1119 if (n == 0) {
1082 /* won't fit, MTU problem? */ 1120 /* won't fit, MTU problem? */
1083 dev_kfree_skb_any(skb); 1121 dev_kfree_skb_any(skb);
@@ -1150,6 +1188,17 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
1150 /* variables will be reset at next call */ 1188 /* variables will be reset at next call */
1151 } 1189 }
1152 1190
1191 /* If requested, put NDP at end of frame. */
1192 if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
1193 nth16 = (struct usb_cdc_ncm_nth16 *)skb_out->data;
1194 cdc_ncm_align_tail(skb_out, ctx->tx_ndp_modulus, 0, ctx->tx_max);
1195 nth16->wNdpIndex = cpu_to_le16(skb_out->len);
1196 memcpy(skb_put(skb_out, ctx->max_ndp_size), ctx->delayed_ndp16, ctx->max_ndp_size);
1197
1198 /* Zero out delayed NDP - signature checking will naturally fail. */
1199 ndp16 = memset(ctx->delayed_ndp16, 0, ctx->max_ndp_size);
1200 }
1201
1153 /* If collected data size is less or equal ctx->min_tx_pkt 1202 /* If collected data size is less or equal ctx->min_tx_pkt
1154 * bytes, we send buffers as it is. If we get more data, it 1203 * bytes, we send buffers as it is. If we get more data, it
1155 * would be more efficient for USB HS mobile device with DMA 1204 * would be more efficient for USB HS mobile device with DMA
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
index 735f7dadb9a0..2680a65cd5e4 100644
--- a/drivers/net/usb/huawei_cdc_ncm.c
+++ b/drivers/net/usb/huawei_cdc_ncm.c
@@ -73,11 +73,14 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
73 struct usb_driver *subdriver = ERR_PTR(-ENODEV); 73 struct usb_driver *subdriver = ERR_PTR(-ENODEV);
74 int ret = -ENODEV; 74 int ret = -ENODEV;
75 struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data; 75 struct huawei_cdc_ncm_state *drvstate = (void *)&usbnet_dev->data;
76 int drvflags = 0;
76 77
77 /* altsetting should always be 1 for NCM devices - so we hard-coded 78 /* altsetting should always be 1 for NCM devices - so we hard-coded
78 * it here 79 * it here. Some huawei devices will need the NDP part of the NCM package to
80 * be at the end of the frame.
79 */ 81 */
80 ret = cdc_ncm_bind_common(usbnet_dev, intf, 1); 82 drvflags |= CDC_NCM_FLAG_NDP_TO_END;
83 ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags);
81 if (ret) 84 if (ret)
82 goto err; 85 goto err;
83 86
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index aafa1a1898e4..7f6419ebb5e1 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -494,6 +494,7 @@ enum rtl8152_flags {
494#define VENDOR_ID_REALTEK 0x0bda 494#define VENDOR_ID_REALTEK 0x0bda
495#define VENDOR_ID_SAMSUNG 0x04e8 495#define VENDOR_ID_SAMSUNG 0x04e8
496#define VENDOR_ID_LENOVO 0x17ef 496#define VENDOR_ID_LENOVO 0x17ef
497#define VENDOR_ID_NVIDIA 0x0955
497 498
498#define MCU_TYPE_PLA 0x0100 499#define MCU_TYPE_PLA 0x0100
499#define MCU_TYPE_USB 0x0000 500#define MCU_TYPE_USB 0x0000
@@ -4117,6 +4118,7 @@ static struct usb_device_id rtl8152_table[] = {
4117 {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)}, 4118 {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)},
4118 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, 4119 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)},
4119 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)}, 4120 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)},
4121 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)},
4120 {} 4122 {}
4121}; 4123};
4122 4124
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index da11bb5e9c7f..46f4caddccbe 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1216,7 +1216,7 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1216 static const u32 rxprod_reg[2] = { 1216 static const u32 rxprod_reg[2] = {
1217 VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2 1217 VMXNET3_REG_RXPROD, VMXNET3_REG_RXPROD2
1218 }; 1218 };
1219 u32 num_rxd = 0; 1219 u32 num_pkts = 0;
1220 bool skip_page_frags = false; 1220 bool skip_page_frags = false;
1221 struct Vmxnet3_RxCompDesc *rcd; 1221 struct Vmxnet3_RxCompDesc *rcd;
1222 struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx; 1222 struct vmxnet3_rx_ctx *ctx = &rq->rx_ctx;
@@ -1235,13 +1235,12 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
1235 struct Vmxnet3_RxDesc *rxd; 1235 struct Vmxnet3_RxDesc *rxd;
1236 u32 idx, ring_idx; 1236 u32 idx, ring_idx;
1237 struct vmxnet3_cmd_ring *ring = NULL; 1237 struct vmxnet3_cmd_ring *ring = NULL;
1238 if (num_rxd >= quota) { 1238 if (num_pkts >= quota) {
1239 /* we may stop even before we see the EOP desc of 1239 /* we may stop even before we see the EOP desc of
1240 * the current pkt 1240 * the current pkt
1241 */ 1241 */
1242 break; 1242 break;
1243 } 1243 }
1244 num_rxd++;
1245 BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2); 1244 BUG_ON(rcd->rqID != rq->qid && rcd->rqID != rq->qid2);
1246 idx = rcd->rxdIdx; 1245 idx = rcd->rxdIdx;
1247 ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1; 1246 ring_idx = rcd->rqID < adapter->num_rx_queues ? 0 : 1;
@@ -1413,6 +1412,7 @@ not_lro:
1413 napi_gro_receive(&rq->napi, skb); 1412 napi_gro_receive(&rq->napi, skb);
1414 1413
1415 ctx->skb = NULL; 1414 ctx->skb = NULL;
1415 num_pkts++;
1416 } 1416 }
1417 1417
1418rcd_done: 1418rcd_done:
@@ -1443,7 +1443,7 @@ rcd_done:
1443 &rq->comp_ring.base[rq->comp_ring.next2proc].rcd, &rxComp); 1443 &rq->comp_ring.base[rq->comp_ring.next2proc].rcd, &rxComp);
1444 } 1444 }
1445 1445
1446 return num_rxd; 1446 return num_pkts;
1447} 1447}
1448 1448
1449 1449
diff --git a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
index feacc3b994b7..2f0bd6955f33 100644
--- a/drivers/net/wan/z85230.c
+++ b/drivers/net/wan/z85230.c
@@ -1044,7 +1044,7 @@ EXPORT_SYMBOL(z8530_sync_dma_close);
1044 * @dev: The network device to attach 1044 * @dev: The network device to attach
1045 * @c: The Z8530 channel to configure in sync DMA mode. 1045 * @c: The Z8530 channel to configure in sync DMA mode.
1046 * 1046 *
1047 * Set up a Z85x30 device for synchronous DMA tranmission. One 1047 * Set up a Z85x30 device for synchronous DMA transmission. One
1048 * ISA DMA channel must be available for this to work. The receive 1048 * ISA DMA channel must be available for this to work. The receive
1049 * side is run in PIO mode, but then it has the bigger FIFO. 1049 * side is run in PIO mode, but then it has the bigger FIFO.
1050 */ 1050 */
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index f87a5eaf75da..0afaf79a4e51 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr pinmux 2 * Driver for the ST Microelectronics SPEAr pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * Inspired from: 7 * Inspired from:
8 * - U300 Pinctl drivers 8 * - U300 Pinctl drivers
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h
index dc8bf85ecb2a..27c2cc8d83ad 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.h
+++ b/drivers/pinctrl/spear/pinctrl-spear.h
@@ -2,7 +2,7 @@
2 * Driver header file for the ST Microelectronics SPEAr pinmux 2 * Driver header file for the ST Microelectronics SPEAr pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/pinctrl/spear/pinctrl-spear1310.c b/drivers/pinctrl/spear/pinctrl-spear1310.c
index a7bdc537efa7..92611bb757ac 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1310.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr1310 pinmux 2 * Driver for the ST Microelectronics SPEAr1310 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -2730,7 +2730,7 @@ static void __exit spear1310_pinctrl_exit(void)
2730} 2730}
2731module_exit(spear1310_pinctrl_exit); 2731module_exit(spear1310_pinctrl_exit);
2732 2732
2733MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 2733MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
2734MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver"); 2734MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver");
2735MODULE_LICENSE("GPL v2"); 2735MODULE_LICENSE("GPL v2");
2736MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match); 2736MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear1340.c b/drivers/pinctrl/spear/pinctrl-spear1340.c
index f43ec85a0328..f842e9dc40d0 100644
--- a/drivers/pinctrl/spear/pinctrl-spear1340.c
+++ b/drivers/pinctrl/spear/pinctrl-spear1340.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr1340 pinmux 2 * Driver for the ST Microelectronics SPEAr1340 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -2046,7 +2046,7 @@ static void __exit spear1340_pinctrl_exit(void)
2046} 2046}
2047module_exit(spear1340_pinctrl_exit); 2047module_exit(spear1340_pinctrl_exit);
2048 2048
2049MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 2049MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
2050MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver"); 2050MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver");
2051MODULE_LICENSE("GPL v2"); 2051MODULE_LICENSE("GPL v2");
2052MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match); 2052MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear300.c b/drivers/pinctrl/spear/pinctrl-spear300.c
index da8990a8eeef..d998a2ccff48 100644
--- a/drivers/pinctrl/spear/pinctrl-spear300.c
+++ b/drivers/pinctrl/spear/pinctrl-spear300.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr300 pinmux 2 * Driver for the ST Microelectronics SPEAr300 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -703,7 +703,7 @@ static void __exit spear300_pinctrl_exit(void)
703} 703}
704module_exit(spear300_pinctrl_exit); 704module_exit(spear300_pinctrl_exit);
705 705
706MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 706MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
707MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver"); 707MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver");
708MODULE_LICENSE("GPL v2"); 708MODULE_LICENSE("GPL v2");
709MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match); 709MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear310.c b/drivers/pinctrl/spear/pinctrl-spear310.c
index 31ede51e819b..609b18aceb16 100644
--- a/drivers/pinctrl/spear/pinctrl-spear310.c
+++ b/drivers/pinctrl/spear/pinctrl-spear310.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr310 pinmux 2 * Driver for the ST Microelectronics SPEAr310 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -426,7 +426,7 @@ static void __exit spear310_pinctrl_exit(void)
426} 426}
427module_exit(spear310_pinctrl_exit); 427module_exit(spear310_pinctrl_exit);
428 428
429MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 429MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
430MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver"); 430MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver");
431MODULE_LICENSE("GPL v2"); 431MODULE_LICENSE("GPL v2");
432MODULE_DEVICE_TABLE(of, spear310_pinctrl_of_match); 432MODULE_DEVICE_TABLE(of, spear310_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear320.c b/drivers/pinctrl/spear/pinctrl-spear320.c
index 506e40b641e0..c07114431bd4 100644
--- a/drivers/pinctrl/spear/pinctrl-spear320.c
+++ b/drivers/pinctrl/spear/pinctrl-spear320.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr320 pinmux 2 * Driver for the ST Microelectronics SPEAr320 pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -3467,7 +3467,7 @@ static void __exit spear320_pinctrl_exit(void)
3467} 3467}
3468module_exit(spear320_pinctrl_exit); 3468module_exit(spear320_pinctrl_exit);
3469 3469
3470MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 3470MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
3471MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver"); 3471MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver");
3472MODULE_LICENSE("GPL v2"); 3472MODULE_LICENSE("GPL v2");
3473MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match); 3473MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match);
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.c b/drivers/pinctrl/spear/pinctrl-spear3xx.c
index 12ee21af766b..d3119aafe709 100644
--- a/drivers/pinctrl/spear/pinctrl-spear3xx.c
+++ b/drivers/pinctrl/spear/pinctrl-spear3xx.c
@@ -2,7 +2,7 @@
2 * Driver for the ST Microelectronics SPEAr3xx pinmux 2 * Driver for the ST Microelectronics SPEAr3xx pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.h b/drivers/pinctrl/spear/pinctrl-spear3xx.h
index 7860b36053c4..ce19dcf8f08b 100644
--- a/drivers/pinctrl/spear/pinctrl-spear3xx.h
+++ b/drivers/pinctrl/spear/pinctrl-spear3xx.h
@@ -2,7 +2,7 @@
2 * Header file for the ST Microelectronics SPEAr3xx pinmux 2 * Header file for the ST Microelectronics SPEAr3xx pinmux
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index ed317ccac4a2..aaeeae81e3a9 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -309,12 +309,15 @@ static const struct dmi_system_id dell_quirks[] __initconst = {
309static struct calling_interface_buffer *buffer; 309static struct calling_interface_buffer *buffer;
310static DEFINE_MUTEX(buffer_mutex); 310static DEFINE_MUTEX(buffer_mutex);
311 311
312static int hwswitch_state; 312static void clear_buffer(void)
313{
314 memset(buffer, 0, sizeof(struct calling_interface_buffer));
315}
313 316
314static void get_buffer(void) 317static void get_buffer(void)
315{ 318{
316 mutex_lock(&buffer_mutex); 319 mutex_lock(&buffer_mutex);
317 memset(buffer, 0, sizeof(struct calling_interface_buffer)); 320 clear_buffer();
318} 321}
319 322
320static void release_buffer(void) 323static void release_buffer(void)
@@ -548,21 +551,41 @@ static int dell_rfkill_set(void *data, bool blocked)
548 int disable = blocked ? 1 : 0; 551 int disable = blocked ? 1 : 0;
549 unsigned long radio = (unsigned long)data; 552 unsigned long radio = (unsigned long)data;
550 int hwswitch_bit = (unsigned long)data - 1; 553 int hwswitch_bit = (unsigned long)data - 1;
554 int hwswitch;
555 int status;
556 int ret;
551 557
552 get_buffer(); 558 get_buffer();
559
560 dell_send_request(buffer, 17, 11);
561 ret = buffer->output[0];
562 status = buffer->output[1];
563
564 if (ret != 0)
565 goto out;
566
567 clear_buffer();
568
569 buffer->input[0] = 0x2;
553 dell_send_request(buffer, 17, 11); 570 dell_send_request(buffer, 17, 11);
571 ret = buffer->output[0];
572 hwswitch = buffer->output[1];
554 573
555 /* If the hardware switch controls this radio, and the hardware 574 /* If the hardware switch controls this radio, and the hardware
556 switch is disabled, always disable the radio */ 575 switch is disabled, always disable the radio */
557 if ((hwswitch_state & BIT(hwswitch_bit)) && 576 if (ret == 0 && (hwswitch & BIT(hwswitch_bit)) &&
558 !(buffer->output[1] & BIT(16))) 577 (status & BIT(0)) && !(status & BIT(16)))
559 disable = 1; 578 disable = 1;
560 579
580 clear_buffer();
581
561 buffer->input[0] = (1 | (radio<<8) | (disable << 16)); 582 buffer->input[0] = (1 | (radio<<8) | (disable << 16));
562 dell_send_request(buffer, 17, 11); 583 dell_send_request(buffer, 17, 11);
584 ret = buffer->output[0];
563 585
586 out:
564 release_buffer(); 587 release_buffer();
565 return 0; 588 return dell_smi_error(ret);
566} 589}
567 590
568/* Must be called with the buffer held */ 591/* Must be called with the buffer held */
@@ -572,6 +595,7 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio,
572 if (status & BIT(0)) { 595 if (status & BIT(0)) {
573 /* Has hw-switch, sync sw_state to BIOS */ 596 /* Has hw-switch, sync sw_state to BIOS */
574 int block = rfkill_blocked(rfkill); 597 int block = rfkill_blocked(rfkill);
598 clear_buffer();
575 buffer->input[0] = (1 | (radio << 8) | (block << 16)); 599 buffer->input[0] = (1 | (radio << 8) | (block << 16));
576 dell_send_request(buffer, 17, 11); 600 dell_send_request(buffer, 17, 11);
577 } else { 601 } else {
@@ -581,23 +605,43 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio,
581} 605}
582 606
583static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio, 607static void dell_rfkill_update_hw_state(struct rfkill *rfkill, int radio,
584 int status) 608 int status, int hwswitch)
585{ 609{
586 if (hwswitch_state & (BIT(radio - 1))) 610 if (hwswitch & (BIT(radio - 1)))
587 rfkill_set_hw_state(rfkill, !(status & BIT(16))); 611 rfkill_set_hw_state(rfkill, !(status & BIT(16)));
588} 612}
589 613
590static void dell_rfkill_query(struct rfkill *rfkill, void *data) 614static void dell_rfkill_query(struct rfkill *rfkill, void *data)
591{ 615{
616 int radio = ((unsigned long)data & 0xF);
617 int hwswitch;
592 int status; 618 int status;
619 int ret;
593 620
594 get_buffer(); 621 get_buffer();
622
595 dell_send_request(buffer, 17, 11); 623 dell_send_request(buffer, 17, 11);
624 ret = buffer->output[0];
596 status = buffer->output[1]; 625 status = buffer->output[1];
597 626
598 dell_rfkill_update_hw_state(rfkill, (unsigned long)data, status); 627 if (ret != 0 || !(status & BIT(0))) {
628 release_buffer();
629 return;
630 }
631
632 clear_buffer();
633
634 buffer->input[0] = 0x2;
635 dell_send_request(buffer, 17, 11);
636 ret = buffer->output[0];
637 hwswitch = buffer->output[1];
599 638
600 release_buffer(); 639 release_buffer();
640
641 if (ret != 0)
642 return;
643
644 dell_rfkill_update_hw_state(rfkill, radio, status, hwswitch);
601} 645}
602 646
603static const struct rfkill_ops dell_rfkill_ops = { 647static const struct rfkill_ops dell_rfkill_ops = {
@@ -609,13 +653,27 @@ static struct dentry *dell_laptop_dir;
609 653
610static int dell_debugfs_show(struct seq_file *s, void *data) 654static int dell_debugfs_show(struct seq_file *s, void *data)
611{ 655{
656 int hwswitch_state;
657 int hwswitch_ret;
612 int status; 658 int status;
659 int ret;
613 660
614 get_buffer(); 661 get_buffer();
662
615 dell_send_request(buffer, 17, 11); 663 dell_send_request(buffer, 17, 11);
664 ret = buffer->output[0];
616 status = buffer->output[1]; 665 status = buffer->output[1];
666
667 clear_buffer();
668
669 buffer->input[0] = 0x2;
670 dell_send_request(buffer, 17, 11);
671 hwswitch_ret = buffer->output[0];
672 hwswitch_state = buffer->output[1];
673
617 release_buffer(); 674 release_buffer();
618 675
676 seq_printf(s, "return:\t%d\n", ret);
619 seq_printf(s, "status:\t0x%X\n", status); 677 seq_printf(s, "status:\t0x%X\n", status);
620 seq_printf(s, "Bit 0 : Hardware switch supported: %lu\n", 678 seq_printf(s, "Bit 0 : Hardware switch supported: %lu\n",
621 status & BIT(0)); 679 status & BIT(0));
@@ -657,7 +715,8 @@ static int dell_debugfs_show(struct seq_file *s, void *data)
657 seq_printf(s, "Bit 21: WiGig is blocked: %lu\n", 715 seq_printf(s, "Bit 21: WiGig is blocked: %lu\n",
658 (status & BIT(21)) >> 21); 716 (status & BIT(21)) >> 21);
659 717
660 seq_printf(s, "\nhwswitch_state:\t0x%X\n", hwswitch_state); 718 seq_printf(s, "\nhwswitch_return:\t%d\n", hwswitch_ret);
719 seq_printf(s, "hwswitch_state:\t0x%X\n", hwswitch_state);
661 seq_printf(s, "Bit 0 : Wifi controlled by switch: %lu\n", 720 seq_printf(s, "Bit 0 : Wifi controlled by switch: %lu\n",
662 hwswitch_state & BIT(0)); 721 hwswitch_state & BIT(0));
663 seq_printf(s, "Bit 1 : Bluetooth controlled by switch: %lu\n", 722 seq_printf(s, "Bit 1 : Bluetooth controlled by switch: %lu\n",
@@ -693,25 +752,43 @@ static const struct file_operations dell_debugfs_fops = {
693 752
694static void dell_update_rfkill(struct work_struct *ignored) 753static void dell_update_rfkill(struct work_struct *ignored)
695{ 754{
755 int hwswitch = 0;
696 int status; 756 int status;
757 int ret;
697 758
698 get_buffer(); 759 get_buffer();
760
699 dell_send_request(buffer, 17, 11); 761 dell_send_request(buffer, 17, 11);
762 ret = buffer->output[0];
700 status = buffer->output[1]; 763 status = buffer->output[1];
701 764
765 if (ret != 0)
766 goto out;
767
768 clear_buffer();
769
770 buffer->input[0] = 0x2;
771 dell_send_request(buffer, 17, 11);
772 ret = buffer->output[0];
773
774 if (ret == 0 && (status & BIT(0)))
775 hwswitch = buffer->output[1];
776
702 if (wifi_rfkill) { 777 if (wifi_rfkill) {
703 dell_rfkill_update_hw_state(wifi_rfkill, 1, status); 778 dell_rfkill_update_hw_state(wifi_rfkill, 1, status, hwswitch);
704 dell_rfkill_update_sw_state(wifi_rfkill, 1, status); 779 dell_rfkill_update_sw_state(wifi_rfkill, 1, status);
705 } 780 }
706 if (bluetooth_rfkill) { 781 if (bluetooth_rfkill) {
707 dell_rfkill_update_hw_state(bluetooth_rfkill, 2, status); 782 dell_rfkill_update_hw_state(bluetooth_rfkill, 2, status,
783 hwswitch);
708 dell_rfkill_update_sw_state(bluetooth_rfkill, 2, status); 784 dell_rfkill_update_sw_state(bluetooth_rfkill, 2, status);
709 } 785 }
710 if (wwan_rfkill) { 786 if (wwan_rfkill) {
711 dell_rfkill_update_hw_state(wwan_rfkill, 3, status); 787 dell_rfkill_update_hw_state(wwan_rfkill, 3, status, hwswitch);
712 dell_rfkill_update_sw_state(wwan_rfkill, 3, status); 788 dell_rfkill_update_sw_state(wwan_rfkill, 3, status);
713 } 789 }
714 790
791 out:
715 release_buffer(); 792 release_buffer();
716} 793}
717static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); 794static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill);
@@ -773,21 +850,17 @@ static int __init dell_setup_rfkill(void)
773 850
774 get_buffer(); 851 get_buffer();
775 dell_send_request(buffer, 17, 11); 852 dell_send_request(buffer, 17, 11);
853 ret = buffer->output[0];
776 status = buffer->output[1]; 854 status = buffer->output[1];
777 buffer->input[0] = 0x2;
778 dell_send_request(buffer, 17, 11);
779 hwswitch_state = buffer->output[1];
780 release_buffer(); 855 release_buffer();
781 856
782 if (!(status & BIT(0))) { 857 /* dell wireless info smbios call is not supported */
783 if (force_rfkill) { 858 if (ret != 0)
784 /* No hwsitch, clear all hw-controlled bits */ 859 return 0;
785 hwswitch_state &= ~7; 860
786 } else { 861 /* rfkill is only tested on laptops with a hwswitch */
787 /* rfkill is only tested on laptops with a hwswitch */ 862 if (!(status & BIT(0)) && !force_rfkill)
788 return 0; 863 return 0;
789 }
790 }
791 864
792 if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) { 865 if ((status & (1<<2|1<<8)) == (1<<2|1<<8)) {
793 wifi_rfkill = rfkill_alloc("dell-wifi", &platform_device->dev, 866 wifi_rfkill = rfkill_alloc("dell-wifi", &platform_device->dev,
@@ -932,47 +1005,50 @@ static void dell_cleanup_rfkill(void)
932 1005
933static int dell_send_intensity(struct backlight_device *bd) 1006static int dell_send_intensity(struct backlight_device *bd)
934{ 1007{
935 int ret = 0; 1008 int token;
1009 int ret;
1010
1011 token = find_token_location(BRIGHTNESS_TOKEN);
1012 if (token == -1)
1013 return -ENODEV;
936 1014
937 get_buffer(); 1015 get_buffer();
938 buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); 1016 buffer->input[0] = token;
939 buffer->input[1] = bd->props.brightness; 1017 buffer->input[1] = bd->props.brightness;
940 1018
941 if (buffer->input[0] == -1) {
942 ret = -ENODEV;
943 goto out;
944 }
945
946 if (power_supply_is_system_supplied() > 0) 1019 if (power_supply_is_system_supplied() > 0)
947 dell_send_request(buffer, 1, 2); 1020 dell_send_request(buffer, 1, 2);
948 else 1021 else
949 dell_send_request(buffer, 1, 1); 1022 dell_send_request(buffer, 1, 1);
950 1023
951 out: 1024 ret = dell_smi_error(buffer->output[0]);
1025
952 release_buffer(); 1026 release_buffer();
953 return ret; 1027 return ret;
954} 1028}
955 1029
956static int dell_get_intensity(struct backlight_device *bd) 1030static int dell_get_intensity(struct backlight_device *bd)
957{ 1031{
958 int ret = 0; 1032 int token;
1033 int ret;
959 1034
960 get_buffer(); 1035 token = find_token_location(BRIGHTNESS_TOKEN);
961 buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); 1036 if (token == -1)
1037 return -ENODEV;
962 1038
963 if (buffer->input[0] == -1) { 1039 get_buffer();
964 ret = -ENODEV; 1040 buffer->input[0] = token;
965 goto out;
966 }
967 1041
968 if (power_supply_is_system_supplied() > 0) 1042 if (power_supply_is_system_supplied() > 0)
969 dell_send_request(buffer, 0, 2); 1043 dell_send_request(buffer, 0, 2);
970 else 1044 else
971 dell_send_request(buffer, 0, 1); 1045 dell_send_request(buffer, 0, 1);
972 1046
973 ret = buffer->output[1]; 1047 if (buffer->output[0])
1048 ret = dell_smi_error(buffer->output[0]);
1049 else
1050 ret = buffer->output[1];
974 1051
975 out:
976 release_buffer(); 1052 release_buffer();
977 return ret; 1053 return ret;
978} 1054}
@@ -2036,6 +2112,7 @@ static void kbd_led_exit(void)
2036static int __init dell_init(void) 2112static int __init dell_init(void)
2037{ 2113{
2038 int max_intensity = 0; 2114 int max_intensity = 0;
2115 int token;
2039 int ret; 2116 int ret;
2040 2117
2041 if (!dmi_check_system(dell_device_table)) 2118 if (!dmi_check_system(dell_device_table))
@@ -2094,13 +2171,15 @@ static int __init dell_init(void)
2094 if (acpi_video_get_backlight_type() != acpi_backlight_vendor) 2171 if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
2095 return 0; 2172 return 0;
2096 2173
2097 get_buffer(); 2174 token = find_token_location(BRIGHTNESS_TOKEN);
2098 buffer->input[0] = find_token_location(BRIGHTNESS_TOKEN); 2175 if (token != -1) {
2099 if (buffer->input[0] != -1) { 2176 get_buffer();
2177 buffer->input[0] = token;
2100 dell_send_request(buffer, 0, 2); 2178 dell_send_request(buffer, 0, 2);
2101 max_intensity = buffer->output[3]; 2179 if (buffer->output[0] == 0)
2180 max_intensity = buffer->output[3];
2181 release_buffer();
2102 } 2182 }
2103 release_buffer();
2104 2183
2105 if (max_intensity) { 2184 if (max_intensity) {
2106 struct backlight_properties props; 2185 struct backlight_properties props;
diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c
index d734763dab69..105cfffe82c6 100644
--- a/drivers/platform/x86/intel_pmc_ipc.c
+++ b/drivers/platform/x86/intel_pmc_ipc.c
@@ -96,18 +96,18 @@ static struct intel_pmc_ipc_dev {
96 struct completion cmd_complete; 96 struct completion cmd_complete;
97 97
98 /* The following PMC BARs share the same ACPI device with the IPC */ 98 /* The following PMC BARs share the same ACPI device with the IPC */
99 void *acpi_io_base; 99 resource_size_t acpi_io_base;
100 int acpi_io_size; 100 int acpi_io_size;
101 struct platform_device *tco_dev; 101 struct platform_device *tco_dev;
102 102
103 /* gcr */ 103 /* gcr */
104 void *gcr_base; 104 resource_size_t gcr_base;
105 int gcr_size; 105 int gcr_size;
106 106
107 /* punit */ 107 /* punit */
108 void *punit_base; 108 resource_size_t punit_base;
109 int punit_size; 109 int punit_size;
110 void *punit_base2; 110 resource_size_t punit_base2;
111 int punit_size2; 111 int punit_size2;
112 struct platform_device *punit_dev; 112 struct platform_device *punit_dev;
113} ipcdev; 113} ipcdev;
@@ -210,10 +210,15 @@ static int intel_pmc_ipc_check_status(void)
210 return ret; 210 return ret;
211} 211}
212 212
213/* 213/**
214 * intel_pmc_ipc_simple_command 214 * intel_pmc_ipc_simple_command() - Simple IPC command
215 * @cmd: command 215 * @cmd: IPC command code.
216 * @sub: sub type 216 * @sub: IPC command sub type.
217 *
218 * Send a simple IPC command to PMC when don't need to specify
219 * input/output data and source/dest pointers.
220 *
221 * Return: an IPC error code or 0 on success.
217 */ 222 */
218int intel_pmc_ipc_simple_command(int cmd, int sub) 223int intel_pmc_ipc_simple_command(int cmd, int sub)
219{ 224{
@@ -232,16 +237,20 @@ int intel_pmc_ipc_simple_command(int cmd, int sub)
232} 237}
233EXPORT_SYMBOL_GPL(intel_pmc_ipc_simple_command); 238EXPORT_SYMBOL_GPL(intel_pmc_ipc_simple_command);
234 239
235/* 240/**
236 * intel_pmc_ipc_raw_cmd 241 * intel_pmc_ipc_raw_cmd() - IPC command with data and pointers
237 * @cmd: command 242 * @cmd: IPC command code.
238 * @sub: sub type 243 * @sub: IPC command sub type.
239 * @in: input data 244 * @in: input data of this IPC command.
240 * @inlen: input length in bytes 245 * @inlen: input data length in bytes.
241 * @out: output data 246 * @out: output data of this IPC command.
242 * @outlen: output length in dwords 247 * @outlen: output data length in dwords.
243 * @sptr: data writing to SPTR register 248 * @sptr: data writing to SPTR register.
244 * @dptr: data writing to DPTR register 249 * @dptr: data writing to DPTR register.
250 *
251 * Send an IPC command to PMC with input/output data and source/dest pointers.
252 *
253 * Return: an IPC error code or 0 on success.
245 */ 254 */
246int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out, 255int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out,
247 u32 outlen, u32 dptr, u32 sptr) 256 u32 outlen, u32 dptr, u32 sptr)
@@ -278,14 +287,18 @@ int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen, u32 *out,
278} 287}
279EXPORT_SYMBOL_GPL(intel_pmc_ipc_raw_cmd); 288EXPORT_SYMBOL_GPL(intel_pmc_ipc_raw_cmd);
280 289
281/* 290/**
282 * intel_pmc_ipc_command 291 * intel_pmc_ipc_command() - IPC command with input/output data
283 * @cmd: command 292 * @cmd: IPC command code.
284 * @sub: sub type 293 * @sub: IPC command sub type.
285 * @in: input data 294 * @in: input data of this IPC command.
286 * @inlen: input length in bytes 295 * @inlen: input data length in bytes.
287 * @out: output data 296 * @out: output data of this IPC command.
288 * @outlen: output length in dwords 297 * @outlen: output data length in dwords.
298 *
299 * Send an IPC command to PMC with input/output data.
300 *
301 * Return: an IPC error code or 0 on success.
289 */ 302 */
290int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen, 303int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
291 u32 *out, u32 outlen) 304 u32 *out, u32 outlen)
@@ -480,11 +493,11 @@ static int ipc_create_punit_device(void)
480 pdev->dev.parent = ipcdev.dev; 493 pdev->dev.parent = ipcdev.dev;
481 494
482 res = punit_res; 495 res = punit_res;
483 res->start = (resource_size_t)ipcdev.punit_base; 496 res->start = ipcdev.punit_base;
484 res->end = res->start + ipcdev.punit_size - 1; 497 res->end = res->start + ipcdev.punit_size - 1;
485 498
486 res = punit_res + PUNIT_RESOURCE_INTER; 499 res = punit_res + PUNIT_RESOURCE_INTER;
487 res->start = (resource_size_t)ipcdev.punit_base2; 500 res->start = ipcdev.punit_base2;
488 res->end = res->start + ipcdev.punit_size2 - 1; 501 res->end = res->start + ipcdev.punit_size2 - 1;
489 502
490 ret = platform_device_add_resources(pdev, punit_res, 503 ret = platform_device_add_resources(pdev, punit_res,
@@ -522,15 +535,15 @@ static int ipc_create_tco_device(void)
522 pdev->dev.parent = ipcdev.dev; 535 pdev->dev.parent = ipcdev.dev;
523 536
524 res = tco_res + TCO_RESOURCE_ACPI_IO; 537 res = tco_res + TCO_RESOURCE_ACPI_IO;
525 res->start = (resource_size_t)ipcdev.acpi_io_base + TCO_BASE_OFFSET; 538 res->start = ipcdev.acpi_io_base + TCO_BASE_OFFSET;
526 res->end = res->start + TCO_REGS_SIZE - 1; 539 res->end = res->start + TCO_REGS_SIZE - 1;
527 540
528 res = tco_res + TCO_RESOURCE_SMI_EN_IO; 541 res = tco_res + TCO_RESOURCE_SMI_EN_IO;
529 res->start = (resource_size_t)ipcdev.acpi_io_base + SMI_EN_OFFSET; 542 res->start = ipcdev.acpi_io_base + SMI_EN_OFFSET;
530 res->end = res->start + SMI_EN_SIZE - 1; 543 res->end = res->start + SMI_EN_SIZE - 1;
531 544
532 res = tco_res + TCO_RESOURCE_GCR_MEM; 545 res = tco_res + TCO_RESOURCE_GCR_MEM;
533 res->start = (resource_size_t)ipcdev.gcr_base; 546 res->start = ipcdev.gcr_base;
534 res->end = res->start + ipcdev.gcr_size - 1; 547 res->end = res->start + ipcdev.gcr_size - 1;
535 548
536 ret = platform_device_add_resources(pdev, tco_res, ARRAY_SIZE(tco_res)); 549 ret = platform_device_add_resources(pdev, tco_res, ARRAY_SIZE(tco_res));
@@ -589,7 +602,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
589 return -ENXIO; 602 return -ENXIO;
590 } 603 }
591 size = resource_size(res); 604 size = resource_size(res);
592 ipcdev.acpi_io_base = (void *)res->start; 605 ipcdev.acpi_io_base = res->start;
593 ipcdev.acpi_io_size = size; 606 ipcdev.acpi_io_size = size;
594 dev_info(&pdev->dev, "io res: %llx %x\n", 607 dev_info(&pdev->dev, "io res: %llx %x\n",
595 (long long)res->start, (int)resource_size(res)); 608 (long long)res->start, (int)resource_size(res));
@@ -601,7 +614,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
601 return -ENXIO; 614 return -ENXIO;
602 } 615 }
603 size = resource_size(res); 616 size = resource_size(res);
604 ipcdev.punit_base = (void *)res->start; 617 ipcdev.punit_base = res->start;
605 ipcdev.punit_size = size; 618 ipcdev.punit_size = size;
606 dev_info(&pdev->dev, "punit data res: %llx %x\n", 619 dev_info(&pdev->dev, "punit data res: %llx %x\n",
607 (long long)res->start, (int)resource_size(res)); 620 (long long)res->start, (int)resource_size(res));
@@ -613,7 +626,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
613 return -ENXIO; 626 return -ENXIO;
614 } 627 }
615 size = resource_size(res); 628 size = resource_size(res);
616 ipcdev.punit_base2 = (void *)res->start; 629 ipcdev.punit_base2 = res->start;
617 ipcdev.punit_size2 = size; 630 ipcdev.punit_size2 = size;
618 dev_info(&pdev->dev, "punit interface res: %llx %x\n", 631 dev_info(&pdev->dev, "punit interface res: %llx %x\n",
619 (long long)res->start, (int)resource_size(res)); 632 (long long)res->start, (int)resource_size(res));
@@ -637,7 +650,7 @@ static int ipc_plat_get_res(struct platform_device *pdev)
637 } 650 }
638 ipcdev.ipc_base = addr; 651 ipcdev.ipc_base = addr;
639 652
640 ipcdev.gcr_base = (void *)(res->start + size); 653 ipcdev.gcr_base = res->start + size;
641 ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE; 654 ipcdev.gcr_size = PLAT_RESOURCE_GCR_SIZE;
642 dev_info(&pdev->dev, "ipc res: %llx %x\n", 655 dev_info(&pdev->dev, "ipc res: %llx %x\n",
643 (long long)res->start, (int)resource_size(res)); 656 (long long)res->start, (int)resource_size(res));
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 001b199a8c33..187d1086d15c 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -216,13 +216,13 @@ static int pwr_reg_rdwr(u16 *addr, u8 *data, u32 count, u32 op, u32 id)
216 int nc; 216 int nc;
217 u32 offset = 0; 217 u32 offset = 0;
218 int err; 218 int err;
219 u8 cbuf[IPC_WWBUF_SIZE] = { }; 219 u8 cbuf[IPC_WWBUF_SIZE];
220 u32 *wbuf = (u32 *)&cbuf; 220 u32 *wbuf = (u32 *)&cbuf;
221 221
222 mutex_lock(&ipclock);
223
224 memset(cbuf, 0, sizeof(cbuf)); 222 memset(cbuf, 0, sizeof(cbuf));
225 223
224 mutex_lock(&ipclock);
225
226 if (ipcdev.pdev == NULL) { 226 if (ipcdev.pdev == NULL) {
227 mutex_unlock(&ipclock); 227 mutex_unlock(&ipclock);
228 return -ENODEV; 228 return -ENODEV;
diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c
index 4b62d1a875e4..2b08cac62f07 100644
--- a/drivers/rtc/rtc-armada38x.c
+++ b/drivers/rtc/rtc-armada38x.c
@@ -88,7 +88,7 @@ static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm)
88{ 88{
89 struct armada38x_rtc *rtc = dev_get_drvdata(dev); 89 struct armada38x_rtc *rtc = dev_get_drvdata(dev);
90 int ret = 0; 90 int ret = 0;
91 unsigned long time, flags; 91 unsigned long time;
92 92
93 ret = rtc_tm_to_time(tm, &time); 93 ret = rtc_tm_to_time(tm, &time);
94 94
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index c0090b698ff3..eab230be5a54 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -343,6 +343,8 @@ static int mtk_rtc_probe(struct platform_device *pdev)
343 goto out_dispose_irq; 343 goto out_dispose_irq;
344 } 344 }
345 345
346 device_init_wakeup(&pdev->dev, 1);
347
346 rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev, 348 rtc->rtc_dev = rtc_device_register("mt6397-rtc", &pdev->dev,
347 &mtk_rtc_ops, THIS_MODULE); 349 &mtk_rtc_ops, THIS_MODULE);
348 if (IS_ERR(rtc->rtc_dev)) { 350 if (IS_ERR(rtc->rtc_dev)) {
@@ -351,8 +353,6 @@ static int mtk_rtc_probe(struct platform_device *pdev)
351 goto out_free_irq; 353 goto out_free_irq;
352 } 354 }
353 355
354 device_init_wakeup(&pdev->dev, 1);
355
356 return 0; 356 return 0;
357 357
358out_free_irq: 358out_free_irq:
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 1aec8ff0b587..f73d2f579a7e 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1863,6 +1863,33 @@ static void __dasd_device_check_expire(struct dasd_device *device)
1863} 1863}
1864 1864
1865/* 1865/*
1866 * return 1 when device is not eligible for IO
1867 */
1868static int __dasd_device_is_unusable(struct dasd_device *device,
1869 struct dasd_ccw_req *cqr)
1870{
1871 int mask = ~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM);
1872
1873 if (test_bit(DASD_FLAG_OFFLINE, &device->flags)) {
1874 /* dasd is being set offline. */
1875 return 1;
1876 }
1877 if (device->stopped) {
1878 if (device->stopped & mask) {
1879 /* stopped and CQR will not change that. */
1880 return 1;
1881 }
1882 if (!test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags)) {
1883 /* CQR is not able to change device to
1884 * operational. */
1885 return 1;
1886 }
1887 /* CQR required to get device operational. */
1888 }
1889 return 0;
1890}
1891
1892/*
1866 * Take a look at the first request on the ccw queue and check 1893 * Take a look at the first request on the ccw queue and check
1867 * if it needs to be started. 1894 * if it needs to be started.
1868 */ 1895 */
@@ -1876,13 +1903,8 @@ static void __dasd_device_start_head(struct dasd_device *device)
1876 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist); 1903 cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist);
1877 if (cqr->status != DASD_CQR_QUEUED) 1904 if (cqr->status != DASD_CQR_QUEUED)
1878 return; 1905 return;
1879 /* when device is stopped, return request to previous layer 1906 /* if device is not usable return request to upper layer */
1880 * exception: only the disconnect or unresumed bits are set and the 1907 if (__dasd_device_is_unusable(device, cqr)) {
1881 * cqr is a path verification request
1882 */
1883 if (device->stopped &&
1884 !(!(device->stopped & ~(DASD_STOPPED_DC_WAIT | DASD_UNRESUMED_PM))
1885 && test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags))) {
1886 cqr->intrc = -EAGAIN; 1908 cqr->intrc = -EAGAIN;
1887 cqr->status = DASD_CQR_CLEARED; 1909 cqr->status = DASD_CQR_CLEARED;
1888 dasd_schedule_device_bh(device); 1910 dasd_schedule_device_bh(device);
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index a2597e683e79..ee3a6faae22a 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -699,7 +699,8 @@ struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *base_device)
699 struct dasd_device, alias_list); 699 struct dasd_device, alias_list);
700 spin_unlock_irqrestore(&lcu->lock, flags); 700 spin_unlock_irqrestore(&lcu->lock, flags);
701 alias_priv = (struct dasd_eckd_private *) alias_device->private; 701 alias_priv = (struct dasd_eckd_private *) alias_device->private;
702 if ((alias_priv->count < private->count) && !alias_device->stopped) 702 if ((alias_priv->count < private->count) && !alias_device->stopped &&
703 !test_bit(DASD_FLAG_OFFLINE, &alias_device->flags))
703 return alias_device; 704 return alias_device;
704 else 705 else
705 return NULL; 706 return NULL;
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c
index aeed7969fd79..7bc6df3100ef 100644
--- a/drivers/s390/char/sclp_early.c
+++ b/drivers/s390/char/sclp_early.c
@@ -7,6 +7,7 @@
7#define KMSG_COMPONENT "sclp_early" 7#define KMSG_COMPONENT "sclp_early"
8#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 8#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
9 9
10#include <linux/errno.h>
10#include <asm/ctl_reg.h> 11#include <asm/ctl_reg.h>
11#include <asm/sclp.h> 12#include <asm/sclp.h>
12#include <asm/ipl.h> 13#include <asm/ipl.h>
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 08f1830cbfc4..01bf1f5cf2e9 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -54,6 +54,10 @@ MODULE_DESCRIPTION("Cryptographic Coprocessor interface, " \
54 "Copyright IBM Corp. 2001, 2012"); 54 "Copyright IBM Corp. 2001, 2012");
55MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
56 56
57static int zcrypt_hwrng_seed = 1;
58module_param_named(hwrng_seed, zcrypt_hwrng_seed, int, S_IRUSR|S_IRGRP);
59MODULE_PARM_DESC(hwrng_seed, "Turn on/off hwrng auto seed, default is 1 (on).");
60
57static DEFINE_SPINLOCK(zcrypt_device_lock); 61static DEFINE_SPINLOCK(zcrypt_device_lock);
58static LIST_HEAD(zcrypt_device_list); 62static LIST_HEAD(zcrypt_device_list);
59static int zcrypt_device_count = 0; 63static int zcrypt_device_count = 0;
@@ -1373,6 +1377,7 @@ static int zcrypt_rng_data_read(struct hwrng *rng, u32 *data)
1373static struct hwrng zcrypt_rng_dev = { 1377static struct hwrng zcrypt_rng_dev = {
1374 .name = "zcrypt", 1378 .name = "zcrypt",
1375 .data_read = zcrypt_rng_data_read, 1379 .data_read = zcrypt_rng_data_read,
1380 .quality = 990,
1376}; 1381};
1377 1382
1378static int zcrypt_rng_device_add(void) 1383static int zcrypt_rng_device_add(void)
@@ -1387,6 +1392,8 @@ static int zcrypt_rng_device_add(void)
1387 goto out; 1392 goto out;
1388 } 1393 }
1389 zcrypt_rng_buffer_index = 0; 1394 zcrypt_rng_buffer_index = 0;
1395 if (!zcrypt_hwrng_seed)
1396 zcrypt_rng_dev.quality = 0;
1390 rc = hwrng_register(&zcrypt_rng_dev); 1397 rc = hwrng_register(&zcrypt_rng_dev);
1391 if (rc) 1398 if (rc)
1392 goto out_free; 1399 goto out_free;
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 1ac38e73df7e..9ad41168d26d 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -859,7 +859,7 @@ sdev_store_queue_depth(struct device *dev, struct device_attribute *attr,
859 859
860 depth = simple_strtoul(buf, NULL, 0); 860 depth = simple_strtoul(buf, NULL, 0);
861 861
862 if (depth < 1 || depth > sht->can_queue) 862 if (depth < 1 || depth > sdev->host->can_queue)
863 return -EINVAL; 863 return -EINVAL;
864 864
865 retval = sht->change_queue_depth(sdev, depth); 865 retval = sht->change_queue_depth(sdev, depth);
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
index a85292b1d09d..e3cd3ece4412 100644
--- a/drivers/scsi/scsi_transport_srp.c
+++ b/drivers/scsi/scsi_transport_srp.c
@@ -203,7 +203,7 @@ static ssize_t srp_show_tmo(char *buf, int tmo)
203 return tmo >= 0 ? sprintf(buf, "%d\n", tmo) : sprintf(buf, "off\n"); 203 return tmo >= 0 ? sprintf(buf, "%d\n", tmo) : sprintf(buf, "off\n");
204} 204}
205 205
206static int srp_parse_tmo(int *tmo, const char *buf) 206int srp_parse_tmo(int *tmo, const char *buf)
207{ 207{
208 int res = 0; 208 int res = 0;
209 209
@@ -214,6 +214,7 @@ static int srp_parse_tmo(int *tmo, const char *buf)
214 214
215 return res; 215 return res;
216} 216}
217EXPORT_SYMBOL(srp_parse_tmo);
217 218
218static ssize_t show_reconnect_delay(struct device *dev, 219static ssize_t show_reconnect_delay(struct device *dev,
219 struct device_attribute *attr, char *buf) 220 struct device_attribute *attr, char *buf)
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 3f25b8fa921d..871f3553987d 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -1329,9 +1329,9 @@ static int st_open(struct inode *inode, struct file *filp)
1329 spin_lock(&st_use_lock); 1329 spin_lock(&st_use_lock);
1330 STp->in_use = 0; 1330 STp->in_use = 0;
1331 spin_unlock(&st_use_lock); 1331 spin_unlock(&st_use_lock);
1332 scsi_tape_put(STp);
1333 if (resumed) 1332 if (resumed)
1334 scsi_autopm_put_device(STp->device); 1333 scsi_autopm_put_device(STp->device);
1334 scsi_tape_put(STp);
1335 return retval; 1335 return retval;
1336 1336
1337} 1337}
diff --git a/drivers/staging/board/Kconfig b/drivers/staging/board/Kconfig
index b8ee81840666..3f287c48e082 100644
--- a/drivers/staging/board/Kconfig
+++ b/drivers/staging/board/Kconfig
@@ -1,6 +1,6 @@
1config STAGING_BOARD 1config STAGING_BOARD
2 bool "Staging Board Support" 2 bool "Staging Board Support"
3 depends on OF_ADDRESS 3 depends on OF_ADDRESS && OF_IRQ && CLKDEV_LOOKUP
4 help 4 help
5 Select to enable per-board staging support code. 5 Select to enable per-board staging support code.
6 6
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 7125eb955ae5..8a9d4a0de129 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -31,7 +31,6 @@
31#define DEBUG_PORTAL_ALLOC 31#define DEBUG_PORTAL_ALLOC
32#define DEBUG_SUBSYSTEM S_LND 32#define DEBUG_SUBSYSTEM S_LND
33 33
34#include <asm/irq.h>
35#include <linux/crc32.h> 34#include <linux/crc32.h>
36#include <linux/errno.h> 35#include <linux/errno.h>
37#include <linux/if.h> 36#include <linux/if.h>
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index ed040fbb7df8..b0c8e235b982 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1418,7 +1418,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
1418 1418
1419 priv->current_aid = conf->aid; 1419 priv->current_aid = conf->aid;
1420 1420
1421 if (changed & BSS_CHANGED_BSSID) { 1421 if (changed & BSS_CHANGED_BSSID && conf->bssid) {
1422 unsigned long flags; 1422 unsigned long flags;
1423 1423
1424 spin_lock_irqsave(&priv->lock, flags); 1424 spin_lock_irqsave(&priv->lock, flags);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index f97323f19acf..af572d718135 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -701,7 +701,7 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,
701 701
702 priv->current_aid = conf->aid; 702 priv->current_aid = conf->aid;
703 703
704 if (changed & BSS_CHANGED_BSSID) 704 if (changed & BSS_CHANGED_BSSID && conf->bssid)
705 vnt_mac_set_bssid_addr(priv, (u8 *)conf->bssid); 705 vnt_mac_set_bssid_addr(priv, (u8 *)conf->bssid);
706 706
707 707
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
index e5b546f1152e..c3cc1a78d1e2 100644
--- a/drivers/usb/dwc2/core.c
+++ b/drivers/usb/dwc2/core.c
@@ -72,17 +72,7 @@ static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg)
72 dev_dbg(hsotg->dev, "%s\n", __func__); 72 dev_dbg(hsotg->dev, "%s\n", __func__);
73 73
74 /* Backup Host regs */ 74 /* Backup Host regs */
75 hr = hsotg->hr_backup; 75 hr = &hsotg->hr_backup;
76 if (!hr) {
77 hr = devm_kzalloc(hsotg->dev, sizeof(*hr), GFP_KERNEL);
78 if (!hr) {
79 dev_err(hsotg->dev, "%s: can't allocate host regs\n",
80 __func__);
81 return -ENOMEM;
82 }
83
84 hsotg->hr_backup = hr;
85 }
86 hr->hcfg = readl(hsotg->regs + HCFG); 76 hr->hcfg = readl(hsotg->regs + HCFG);
87 hr->haintmsk = readl(hsotg->regs + HAINTMSK); 77 hr->haintmsk = readl(hsotg->regs + HAINTMSK);
88 for (i = 0; i < hsotg->core_params->host_channels; ++i) 78 for (i = 0; i < hsotg->core_params->host_channels; ++i)
@@ -90,6 +80,7 @@ static int dwc2_backup_host_registers(struct dwc2_hsotg *hsotg)
90 80
91 hr->hprt0 = readl(hsotg->regs + HPRT0); 81 hr->hprt0 = readl(hsotg->regs + HPRT0);
92 hr->hfir = readl(hsotg->regs + HFIR); 82 hr->hfir = readl(hsotg->regs + HFIR);
83 hr->valid = true;
93 84
94 return 0; 85 return 0;
95} 86}
@@ -109,12 +100,13 @@ static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg)
109 dev_dbg(hsotg->dev, "%s\n", __func__); 100 dev_dbg(hsotg->dev, "%s\n", __func__);
110 101
111 /* Restore host regs */ 102 /* Restore host regs */
112 hr = hsotg->hr_backup; 103 hr = &hsotg->hr_backup;
113 if (!hr) { 104 if (!hr->valid) {
114 dev_err(hsotg->dev, "%s: no host registers to restore\n", 105 dev_err(hsotg->dev, "%s: no host registers to restore\n",
115 __func__); 106 __func__);
116 return -EINVAL; 107 return -EINVAL;
117 } 108 }
109 hr->valid = false;
118 110
119 writel(hr->hcfg, hsotg->regs + HCFG); 111 writel(hr->hcfg, hsotg->regs + HCFG);
120 writel(hr->haintmsk, hsotg->regs + HAINTMSK); 112 writel(hr->haintmsk, hsotg->regs + HAINTMSK);
@@ -152,17 +144,7 @@ static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg)
152 dev_dbg(hsotg->dev, "%s\n", __func__); 144 dev_dbg(hsotg->dev, "%s\n", __func__);
153 145
154 /* Backup dev regs */ 146 /* Backup dev regs */
155 dr = hsotg->dr_backup; 147 dr = &hsotg->dr_backup;
156 if (!dr) {
157 dr = devm_kzalloc(hsotg->dev, sizeof(*dr), GFP_KERNEL);
158 if (!dr) {
159 dev_err(hsotg->dev, "%s: can't allocate device regs\n",
160 __func__);
161 return -ENOMEM;
162 }
163
164 hsotg->dr_backup = dr;
165 }
166 148
167 dr->dcfg = readl(hsotg->regs + DCFG); 149 dr->dcfg = readl(hsotg->regs + DCFG);
168 dr->dctl = readl(hsotg->regs + DCTL); 150 dr->dctl = readl(hsotg->regs + DCTL);
@@ -195,7 +177,7 @@ static int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg)
195 dr->doeptsiz[i] = readl(hsotg->regs + DOEPTSIZ(i)); 177 dr->doeptsiz[i] = readl(hsotg->regs + DOEPTSIZ(i));
196 dr->doepdma[i] = readl(hsotg->regs + DOEPDMA(i)); 178 dr->doepdma[i] = readl(hsotg->regs + DOEPDMA(i));
197 } 179 }
198 180 dr->valid = true;
199 return 0; 181 return 0;
200} 182}
201 183
@@ -215,12 +197,13 @@ static int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg)
215 dev_dbg(hsotg->dev, "%s\n", __func__); 197 dev_dbg(hsotg->dev, "%s\n", __func__);
216 198
217 /* Restore dev regs */ 199 /* Restore dev regs */
218 dr = hsotg->dr_backup; 200 dr = &hsotg->dr_backup;
219 if (!dr) { 201 if (!dr->valid) {
220 dev_err(hsotg->dev, "%s: no device registers to restore\n", 202 dev_err(hsotg->dev, "%s: no device registers to restore\n",
221 __func__); 203 __func__);
222 return -EINVAL; 204 return -EINVAL;
223 } 205 }
206 dr->valid = false;
224 207
225 writel(dr->dcfg, hsotg->regs + DCFG); 208 writel(dr->dcfg, hsotg->regs + DCFG);
226 writel(dr->dctl, hsotg->regs + DCTL); 209 writel(dr->dctl, hsotg->regs + DCTL);
@@ -268,17 +251,7 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg)
268 int i; 251 int i;
269 252
270 /* Backup global regs */ 253 /* Backup global regs */
271 gr = hsotg->gr_backup; 254 gr = &hsotg->gr_backup;
272 if (!gr) {
273 gr = devm_kzalloc(hsotg->dev, sizeof(*gr), GFP_KERNEL);
274 if (!gr) {
275 dev_err(hsotg->dev, "%s: can't allocate global regs\n",
276 __func__);
277 return -ENOMEM;
278 }
279
280 hsotg->gr_backup = gr;
281 }
282 255
283 gr->gotgctl = readl(hsotg->regs + GOTGCTL); 256 gr->gotgctl = readl(hsotg->regs + GOTGCTL);
284 gr->gintmsk = readl(hsotg->regs + GINTMSK); 257 gr->gintmsk = readl(hsotg->regs + GINTMSK);
@@ -291,6 +264,7 @@ static int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg)
291 for (i = 0; i < MAX_EPS_CHANNELS; i++) 264 for (i = 0; i < MAX_EPS_CHANNELS; i++)
292 gr->dtxfsiz[i] = readl(hsotg->regs + DPTXFSIZN(i)); 265 gr->dtxfsiz[i] = readl(hsotg->regs + DPTXFSIZN(i));
293 266
267 gr->valid = true;
294 return 0; 268 return 0;
295} 269}
296 270
@@ -309,12 +283,13 @@ static int dwc2_restore_global_registers(struct dwc2_hsotg *hsotg)
309 dev_dbg(hsotg->dev, "%s\n", __func__); 283 dev_dbg(hsotg->dev, "%s\n", __func__);
310 284
311 /* Restore global regs */ 285 /* Restore global regs */
312 gr = hsotg->gr_backup; 286 gr = &hsotg->gr_backup;
313 if (!gr) { 287 if (!gr->valid) {
314 dev_err(hsotg->dev, "%s: no global registers to restore\n", 288 dev_err(hsotg->dev, "%s: no global registers to restore\n",
315 __func__); 289 __func__);
316 return -EINVAL; 290 return -EINVAL;
317 } 291 }
292 gr->valid = false;
318 293
319 writel(0xffffffff, hsotg->regs + GINTSTS); 294 writel(0xffffffff, hsotg->regs + GINTSTS);
320 writel(gr->gotgctl, hsotg->regs + GOTGCTL); 295 writel(gr->gotgctl, hsotg->regs + GOTGCTL);
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 53b8de03f102..0ed87620941b 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -492,6 +492,7 @@ struct dwc2_gregs_backup {
492 u32 gdfifocfg; 492 u32 gdfifocfg;
493 u32 dtxfsiz[MAX_EPS_CHANNELS]; 493 u32 dtxfsiz[MAX_EPS_CHANNELS];
494 u32 gpwrdn; 494 u32 gpwrdn;
495 bool valid;
495}; 496};
496 497
497/** 498/**
@@ -521,6 +522,7 @@ struct dwc2_dregs_backup {
521 u32 doepctl[MAX_EPS_CHANNELS]; 522 u32 doepctl[MAX_EPS_CHANNELS];
522 u32 doeptsiz[MAX_EPS_CHANNELS]; 523 u32 doeptsiz[MAX_EPS_CHANNELS];
523 u32 doepdma[MAX_EPS_CHANNELS]; 524 u32 doepdma[MAX_EPS_CHANNELS];
525 bool valid;
524}; 526};
525 527
526/** 528/**
@@ -538,6 +540,7 @@ struct dwc2_hregs_backup {
538 u32 hcintmsk[MAX_EPS_CHANNELS]; 540 u32 hcintmsk[MAX_EPS_CHANNELS];
539 u32 hprt0; 541 u32 hprt0;
540 u32 hfir; 542 u32 hfir;
543 bool valid;
541}; 544};
542 545
543/** 546/**
@@ -705,9 +708,9 @@ struct dwc2_hsotg {
705 struct work_struct wf_otg; 708 struct work_struct wf_otg;
706 struct timer_list wkp_timer; 709 struct timer_list wkp_timer;
707 enum dwc2_lx_state lx_state; 710 enum dwc2_lx_state lx_state;
708 struct dwc2_gregs_backup *gr_backup; 711 struct dwc2_gregs_backup gr_backup;
709 struct dwc2_dregs_backup *dr_backup; 712 struct dwc2_dregs_backup dr_backup;
710 struct dwc2_hregs_backup *hr_backup; 713 struct dwc2_hregs_backup hr_backup;
711 714
712 struct dentry *debug_root; 715 struct dentry *debug_root;
713 struct debugfs_regset32 *regset; 716 struct debugfs_regset32 *regset;
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index b10377c65064..f845c41fe9e5 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -359,10 +359,9 @@ void dwc2_hcd_stop(struct dwc2_hsotg *hsotg)
359 359
360/* Caller must hold driver lock */ 360/* Caller must hold driver lock */
361static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg, 361static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
362 struct dwc2_hcd_urb *urb, void **ep_handle, 362 struct dwc2_hcd_urb *urb, struct dwc2_qh *qh,
363 gfp_t mem_flags) 363 struct dwc2_qtd *qtd)
364{ 364{
365 struct dwc2_qtd *qtd;
366 u32 intr_mask; 365 u32 intr_mask;
367 int retval; 366 int retval;
368 int dev_speed; 367 int dev_speed;
@@ -386,18 +385,15 @@ static int dwc2_hcd_urb_enqueue(struct dwc2_hsotg *hsotg,
386 return -ENODEV; 385 return -ENODEV;
387 } 386 }
388 387
389 qtd = kzalloc(sizeof(*qtd), mem_flags);
390 if (!qtd) 388 if (!qtd)
391 return -ENOMEM; 389 return -EINVAL;
392 390
393 dwc2_hcd_qtd_init(qtd, urb); 391 dwc2_hcd_qtd_init(qtd, urb);
394 retval = dwc2_hcd_qtd_add(hsotg, qtd, (struct dwc2_qh **)ep_handle, 392 retval = dwc2_hcd_qtd_add(hsotg, qtd, qh);
395 mem_flags);
396 if (retval) { 393 if (retval) {
397 dev_err(hsotg->dev, 394 dev_err(hsotg->dev,
398 "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n", 395 "DWC OTG HCD URB Enqueue failed adding QTD. Error status %d\n",
399 retval); 396 retval);
400 kfree(qtd);
401 return retval; 397 return retval;
402 } 398 }
403 399
@@ -2445,6 +2441,9 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2445 u32 tflags = 0; 2441 u32 tflags = 0;
2446 void *buf; 2442 void *buf;
2447 unsigned long flags; 2443 unsigned long flags;
2444 struct dwc2_qh *qh;
2445 bool qh_allocated = false;
2446 struct dwc2_qtd *qtd;
2448 2447
2449 if (dbg_urb(urb)) { 2448 if (dbg_urb(urb)) {
2450 dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n"); 2449 dev_vdbg(hsotg->dev, "DWC OTG HCD URB Enqueue\n");
@@ -2523,15 +2522,32 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2523 urb->iso_frame_desc[i].length); 2522 urb->iso_frame_desc[i].length);
2524 2523
2525 urb->hcpriv = dwc2_urb; 2524 urb->hcpriv = dwc2_urb;
2525 qh = (struct dwc2_qh *) ep->hcpriv;
2526 /* Create QH for the endpoint if it doesn't exist */
2527 if (!qh) {
2528 qh = dwc2_hcd_qh_create(hsotg, dwc2_urb, mem_flags);
2529 if (!qh) {
2530 retval = -ENOMEM;
2531 goto fail0;
2532 }
2533 ep->hcpriv = qh;
2534 qh_allocated = true;
2535 }
2536
2537 qtd = kzalloc(sizeof(*qtd), mem_flags);
2538 if (!qtd) {
2539 retval = -ENOMEM;
2540 goto fail1;
2541 }
2526 2542
2527 spin_lock_irqsave(&hsotg->lock, flags); 2543 spin_lock_irqsave(&hsotg->lock, flags);
2528 retval = usb_hcd_link_urb_to_ep(hcd, urb); 2544 retval = usb_hcd_link_urb_to_ep(hcd, urb);
2529 if (retval) 2545 if (retval)
2530 goto fail1; 2546 goto fail2;
2531 2547
2532 retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, &ep->hcpriv, mem_flags); 2548 retval = dwc2_hcd_urb_enqueue(hsotg, dwc2_urb, qh, qtd);
2533 if (retval) 2549 if (retval)
2534 goto fail2; 2550 goto fail3;
2535 2551
2536 if (alloc_bandwidth) { 2552 if (alloc_bandwidth) {
2537 dwc2_allocate_bus_bandwidth(hcd, 2553 dwc2_allocate_bus_bandwidth(hcd,
@@ -2543,12 +2559,25 @@ static int _dwc2_hcd_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
2543 2559
2544 return 0; 2560 return 0;
2545 2561
2546fail2: 2562fail3:
2547 dwc2_urb->priv = NULL; 2563 dwc2_urb->priv = NULL;
2548 usb_hcd_unlink_urb_from_ep(hcd, urb); 2564 usb_hcd_unlink_urb_from_ep(hcd, urb);
2549fail1: 2565fail2:
2550 spin_unlock_irqrestore(&hsotg->lock, flags); 2566 spin_unlock_irqrestore(&hsotg->lock, flags);
2551 urb->hcpriv = NULL; 2567 urb->hcpriv = NULL;
2568 kfree(qtd);
2569fail1:
2570 if (qh_allocated) {
2571 struct dwc2_qtd *qtd2, *qtd2_tmp;
2572
2573 ep->hcpriv = NULL;
2574 dwc2_hcd_qh_unlink(hsotg, qh);
2575 /* Free each QTD in the QH's QTD list */
2576 list_for_each_entry_safe(qtd2, qtd2_tmp, &qh->qtd_list,
2577 qtd_list_entry)
2578 dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh);
2579 dwc2_hcd_qh_free(hsotg, qh);
2580 }
2552fail0: 2581fail0:
2553 kfree(dwc2_urb); 2582 kfree(dwc2_urb);
2554 2583
diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h
index 7b5841c40033..fc1054965552 100644
--- a/drivers/usb/dwc2/hcd.h
+++ b/drivers/usb/dwc2/hcd.h
@@ -463,6 +463,9 @@ extern void dwc2_hcd_queue_transactions(struct dwc2_hsotg *hsotg,
463/* Schedule Queue Functions */ 463/* Schedule Queue Functions */
464/* Implemented in hcd_queue.c */ 464/* Implemented in hcd_queue.c */
465extern void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg); 465extern void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg);
466extern struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg,
467 struct dwc2_hcd_urb *urb,
468 gfp_t mem_flags);
466extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); 469extern void dwc2_hcd_qh_free(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
467extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); 470extern int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
468extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh); 471extern void dwc2_hcd_qh_unlink(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh);
@@ -471,7 +474,7 @@ extern void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
471 474
472extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb); 475extern void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb);
473extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, 476extern int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
474 struct dwc2_qh **qh, gfp_t mem_flags); 477 struct dwc2_qh *qh);
475 478
476/* Unlinks and frees a QTD */ 479/* Unlinks and frees a QTD */
477static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg, 480static inline void dwc2_hcd_qtd_unlink_and_free(struct dwc2_hsotg *hsotg,
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index 9b5c36256627..3ad63d392e13 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -191,7 +191,7 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
191 * 191 *
192 * Return: Pointer to the newly allocated QH, or NULL on error 192 * Return: Pointer to the newly allocated QH, or NULL on error
193 */ 193 */
194static struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg, 194struct dwc2_qh *dwc2_hcd_qh_create(struct dwc2_hsotg *hsotg,
195 struct dwc2_hcd_urb *urb, 195 struct dwc2_hcd_urb *urb,
196 gfp_t mem_flags) 196 gfp_t mem_flags)
197{ 197{
@@ -767,57 +767,32 @@ void dwc2_hcd_qtd_init(struct dwc2_qtd *qtd, struct dwc2_hcd_urb *urb)
767 * 767 *
768 * @hsotg: The DWC HCD structure 768 * @hsotg: The DWC HCD structure
769 * @qtd: The QTD to add 769 * @qtd: The QTD to add
770 * @qh: Out parameter to return queue head 770 * @qh: Queue head to add qtd to
771 * @atomic_alloc: Flag to do atomic alloc if needed
772 * 771 *
773 * Return: 0 if successful, negative error code otherwise 772 * Return: 0 if successful, negative error code otherwise
774 * 773 *
775 * Finds the correct QH to place the QTD into. If it does not find a QH, it 774 * If the QH to which the QTD is added is not currently scheduled, it is placed
776 * will create a new QH. If the QH to which the QTD is added is not currently 775 * into the proper schedule based on its EP type.
777 * scheduled, it is placed into the proper schedule based on its EP type.
778 */ 776 */
779int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd, 777int dwc2_hcd_qtd_add(struct dwc2_hsotg *hsotg, struct dwc2_qtd *qtd,
780 struct dwc2_qh **qh, gfp_t mem_flags) 778 struct dwc2_qh *qh)
781{ 779{
782 struct dwc2_hcd_urb *urb = qtd->urb;
783 int allocated = 0;
784 int retval; 780 int retval;
785 781
786 /* 782 if (unlikely(!qh)) {
787 * Get the QH which holds the QTD-list to insert to. Create QH if it 783 dev_err(hsotg->dev, "%s: Invalid QH\n", __func__);
788 * doesn't exist. 784 retval = -EINVAL;
789 */ 785 goto fail;
790 if (*qh == NULL) {
791 *qh = dwc2_hcd_qh_create(hsotg, urb, mem_flags);
792 if (*qh == NULL)
793 return -ENOMEM;
794 allocated = 1;
795 } 786 }
796 787
797 retval = dwc2_hcd_qh_add(hsotg, *qh); 788 retval = dwc2_hcd_qh_add(hsotg, qh);
798 if (retval) 789 if (retval)
799 goto fail; 790 goto fail;
800 791
801 qtd->qh = *qh; 792 qtd->qh = qh;
802 list_add_tail(&qtd->qtd_list_entry, &(*qh)->qtd_list); 793 list_add_tail(&qtd->qtd_list_entry, &qh->qtd_list);
803 794
804 return 0; 795 return 0;
805
806fail: 796fail:
807 if (allocated) {
808 struct dwc2_qtd *qtd2, *qtd2_tmp;
809 struct dwc2_qh *qh_tmp = *qh;
810
811 *qh = NULL;
812 dwc2_hcd_qh_unlink(hsotg, qh_tmp);
813
814 /* Free each QTD in the QH's QTD list */
815 list_for_each_entry_safe(qtd2, qtd2_tmp, &qh_tmp->qtd_list,
816 qtd_list_entry)
817 dwc2_hcd_qtd_unlink_and_free(hsotg, qtd2, qh_tmp);
818
819 dwc2_hcd_qh_free(hsotg, qh_tmp);
820 }
821
822 return retval; 797 return retval;
823} 798}
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 5c110d8e293b..ff5773c66b84 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -446,10 +446,12 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
446 /* Select the HS PHY interface */ 446 /* Select the HS PHY interface */
447 switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) { 447 switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) {
448 case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI: 448 case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI:
449 if (!strncmp(dwc->hsphy_interface, "utmi", 4)) { 449 if (dwc->hsphy_interface &&
450 !strncmp(dwc->hsphy_interface, "utmi", 4)) {
450 reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI; 451 reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI;
451 break; 452 break;
452 } else if (!strncmp(dwc->hsphy_interface, "ulpi", 4)) { 453 } else if (dwc->hsphy_interface &&
454 !strncmp(dwc->hsphy_interface, "ulpi", 4)) {
453 reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI; 455 reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI;
454 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); 456 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
455 } else { 457 } else {
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 4e3447bbd097..58b4657fc721 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1758,10 +1758,13 @@ unknown:
1758 * take such requests too, if that's ever needed: to work 1758 * take such requests too, if that's ever needed: to work
1759 * in config 0, etc. 1759 * in config 0, etc.
1760 */ 1760 */
1761 list_for_each_entry(f, &cdev->config->functions, list) 1761 if (cdev->config) {
1762 if (f->req_match && f->req_match(f, ctrl)) 1762 list_for_each_entry(f, &cdev->config->functions, list)
1763 goto try_fun_setup; 1763 if (f->req_match && f->req_match(f, ctrl))
1764 f = NULL; 1764 goto try_fun_setup;
1765 f = NULL;
1766 }
1767
1765 switch (ctrl->bRequestType & USB_RECIP_MASK) { 1768 switch (ctrl->bRequestType & USB_RECIP_MASK) {
1766 case USB_RECIP_INTERFACE: 1769 case USB_RECIP_INTERFACE:
1767 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES) 1770 if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index 0495c94a23d7..289e20119fea 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -571,7 +571,7 @@ static struct config_group *function_make(
571 if (IS_ERR(fi)) 571 if (IS_ERR(fi))
572 return ERR_CAST(fi); 572 return ERR_CAST(fi);
573 573
574 ret = config_item_set_name(&fi->group.cg_item, name); 574 ret = config_item_set_name(&fi->group.cg_item, "%s", name);
575 if (ret) { 575 if (ret) {
576 usb_put_function_instance(fi); 576 usb_put_function_instance(fi);
577 return ERR_PTR(ret); 577 return ERR_PTR(ret);
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 45b8c8b338df..6e7be91e6097 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(struct kiocb *kiocb, struct iov_iter *from)
924 924
925 kiocb->private = p; 925 kiocb->private = p;
926 926
927 kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); 927 if (p->aio)
928 kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
928 929
929 res = ffs_epfile_io(kiocb->ki_filp, p); 930 res = ffs_epfile_io(kiocb->ki_filp, p);
930 if (res == -EIOCBQUEUED) 931 if (res == -EIOCBQUEUED)
@@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(struct kiocb *kiocb, struct iov_iter *to)
968 969
969 kiocb->private = p; 970 kiocb->private = p;
970 971
971 kiocb_set_cancel_fn(kiocb, ffs_aio_cancel); 972 if (p->aio)
973 kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
972 974
973 res = ffs_epfile_io(kiocb->ki_filp, p); 975 res = ffs_epfile_io(kiocb->ki_filp, p);
974 if (res == -EIOCBQUEUED) 976 if (res == -EIOCBQUEUED)
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index d2259c663996..f936268d26c6 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2786,7 +2786,7 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns)
2786 return -EINVAL; 2786 return -EINVAL;
2787 } 2787 }
2788 2788
2789 curlun = kcalloc(nluns, sizeof(*curlun), GFP_KERNEL); 2789 curlun = kcalloc(FSG_MAX_LUNS, sizeof(*curlun), GFP_KERNEL);
2790 if (unlikely(!curlun)) 2790 if (unlikely(!curlun))
2791 return -ENOMEM; 2791 return -ENOMEM;
2792 2792
@@ -2796,8 +2796,6 @@ int fsg_common_set_nluns(struct fsg_common *common, int nluns)
2796 common->luns = curlun; 2796 common->luns = curlun;
2797 common->nluns = nluns; 2797 common->nluns = nluns;
2798 2798
2799 pr_info("Number of LUNs=%d\n", common->nluns);
2800
2801 return 0; 2799 return 0;
2802} 2800}
2803EXPORT_SYMBOL_GPL(fsg_common_set_nluns); 2801EXPORT_SYMBOL_GPL(fsg_common_set_nluns);
@@ -3563,14 +3561,26 @@ static struct usb_function *fsg_alloc(struct usb_function_instance *fi)
3563 struct fsg_opts *opts = fsg_opts_from_func_inst(fi); 3561 struct fsg_opts *opts = fsg_opts_from_func_inst(fi);
3564 struct fsg_common *common = opts->common; 3562 struct fsg_common *common = opts->common;
3565 struct fsg_dev *fsg; 3563 struct fsg_dev *fsg;
3564 unsigned nluns, i;
3566 3565
3567 fsg = kzalloc(sizeof(*fsg), GFP_KERNEL); 3566 fsg = kzalloc(sizeof(*fsg), GFP_KERNEL);
3568 if (unlikely(!fsg)) 3567 if (unlikely(!fsg))
3569 return ERR_PTR(-ENOMEM); 3568 return ERR_PTR(-ENOMEM);
3570 3569
3571 mutex_lock(&opts->lock); 3570 mutex_lock(&opts->lock);
3571 if (!opts->refcnt) {
3572 for (nluns = i = 0; i < FSG_MAX_LUNS; ++i)
3573 if (common->luns[i])
3574 nluns = i + 1;
3575 if (!nluns)
3576 pr_warn("No LUNS defined, continuing anyway\n");
3577 else
3578 common->nluns = nluns;
3579 pr_info("Number of LUNs=%u\n", common->nluns);
3580 }
3572 opts->refcnt++; 3581 opts->refcnt++;
3573 mutex_unlock(&opts->lock); 3582 mutex_unlock(&opts->lock);
3583
3574 fsg->function.name = FSG_DRIVER_DESC; 3584 fsg->function.name = FSG_DRIVER_DESC;
3575 fsg->function.bind = fsg_bind; 3585 fsg->function.bind = fsg_bind;
3576 fsg->function.unbind = fsg_unbind; 3586 fsg->function.unbind = fsg_unbind;
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 6316aa5b1c49..ad50a67c1465 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -1145,7 +1145,7 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
1145 if (opts->id && !midi->id) { 1145 if (opts->id && !midi->id) {
1146 status = -ENOMEM; 1146 status = -ENOMEM;
1147 mutex_unlock(&opts->lock); 1147 mutex_unlock(&opts->lock);
1148 goto kstrdup_fail; 1148 goto setup_fail;
1149 } 1149 }
1150 midi->in_ports = opts->in_ports; 1150 midi->in_ports = opts->in_ports;
1151 midi->out_ports = opts->out_ports; 1151 midi->out_ports = opts->out_ports;
@@ -1164,8 +1164,6 @@ static struct usb_function *f_midi_alloc(struct usb_function_instance *fi)
1164 1164
1165 return &midi->func; 1165 return &midi->func;
1166 1166
1167kstrdup_fail:
1168 f_midi_unregister_card(midi);
1169setup_fail: 1167setup_fail:
1170 for (--i; i >= 0; i--) 1168 for (--i; i >= 0; i--)
1171 kfree(midi->in_port[i]); 1169 kfree(midi->in_port[i]);
diff --git a/drivers/usb/gadget/udc/fotg210-udc.c b/drivers/usb/gadget/udc/fotg210-udc.c
index e547ea7f56b1..1137e3384218 100644
--- a/drivers/usb/gadget/udc/fotg210-udc.c
+++ b/drivers/usb/gadget/udc/fotg210-udc.c
@@ -1171,7 +1171,7 @@ static int fotg210_udc_probe(struct platform_device *pdev)
1171 udc_name, fotg210); 1171 udc_name, fotg210);
1172 if (ret < 0) { 1172 if (ret < 0) {
1173 pr_err("request_irq error (%d)\n", ret); 1173 pr_err("request_irq error (%d)\n", ret);
1174 goto err_irq; 1174 goto err_req;
1175 } 1175 }
1176 1176
1177 ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget); 1177 ret = usb_add_gadget_udc(&pdev->dev, &fotg210->gadget);
@@ -1183,7 +1183,6 @@ static int fotg210_udc_probe(struct platform_device *pdev)
1183 return 0; 1183 return 0;
1184 1184
1185err_add_udc: 1185err_add_udc:
1186err_irq:
1187 free_irq(ires->start, fotg210); 1186 free_irq(ires->start, fotg210);
1188 1187
1189err_req: 1188err_req:
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index 30842bc195f5..92d5f718659b 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -275,9 +275,7 @@ static int musb_has_gadget(struct musb *musb)
275#ifdef CONFIG_USB_MUSB_HOST 275#ifdef CONFIG_USB_MUSB_HOST
276 return 1; 276 return 1;
277#else 277#else
278 if (musb->port_mode == MUSB_PORT_MODE_HOST) 278 return musb->port_mode == MUSB_PORT_MODE_HOST;
279 return 1;
280 return musb->g.dev.driver != NULL;
281#endif 279#endif
282} 280}
283 281
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 8f7cb068d29b..3fcc0483a081 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -217,6 +217,9 @@ static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy)
217{ 217{
218 unsigned int vbus_value; 218 unsigned int vbus_value;
219 219
220 if (!mxs_phy->regmap_anatop)
221 return false;
222
220 if (mxs_phy->port_id == 0) 223 if (mxs_phy->port_id == 0)
221 regmap_read(mxs_phy->regmap_anatop, 224 regmap_read(mxs_phy->regmap_anatop,
222 ANADIG_USB1_VBUS_DET_STAT, 225 ANADIG_USB1_VBUS_DET_STAT,
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index ffd739e31bfc..eac7ccaa3c85 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = {
187 { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ 187 { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */
188 { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ 188 { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */
189 { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ 189 { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */
190 { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */
190 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ 191 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
191 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ 192 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
192 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ 193 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 4f70df33975a..78b4f64c6b00 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -121,26 +121,26 @@ static DEFINE_SPINLOCK(release_lock);
121static const unsigned int dummy; /* for clarity in register access fns */ 121static const unsigned int dummy; /* for clarity in register access fns */
122 122
123enum mos_regs { 123enum mos_regs {
124 THR, /* serial port regs */ 124 MOS7720_THR, /* serial port regs */
125 RHR, 125 MOS7720_RHR,
126 IER, 126 MOS7720_IER,
127 FCR, 127 MOS7720_FCR,
128 ISR, 128 MOS7720_ISR,
129 LCR, 129 MOS7720_LCR,
130 MCR, 130 MOS7720_MCR,
131 LSR, 131 MOS7720_LSR,
132 MSR, 132 MOS7720_MSR,
133 SPR, 133 MOS7720_SPR,
134 DLL, 134 MOS7720_DLL,
135 DLM, 135 MOS7720_DLM,
136 DPR, /* parallel port regs */ 136 MOS7720_DPR, /* parallel port regs */
137 DSR, 137 MOS7720_DSR,
138 DCR, 138 MOS7720_DCR,
139 ECR, 139 MOS7720_ECR,
140 SP1_REG, /* device control regs */ 140 MOS7720_SP1_REG, /* device control regs */
141 SP2_REG, /* serial port 2 (7720 only) */ 141 MOS7720_SP2_REG, /* serial port 2 (7720 only) */
142 PP_REG, 142 MOS7720_PP_REG,
143 SP_CONTROL_REG, 143 MOS7720_SP_CONTROL_REG,
144}; 144};
145 145
146/* 146/*
@@ -150,26 +150,26 @@ enum mos_regs {
150static inline __u16 get_reg_index(enum mos_regs reg) 150static inline __u16 get_reg_index(enum mos_regs reg)
151{ 151{
152 static const __u16 mos7715_index_lookup_table[] = { 152 static const __u16 mos7715_index_lookup_table[] = {
153 0x00, /* THR */ 153 0x00, /* MOS7720_THR */
154 0x00, /* RHR */ 154 0x00, /* MOS7720_RHR */
155 0x01, /* IER */ 155 0x01, /* MOS7720_IER */
156 0x02, /* FCR */ 156 0x02, /* MOS7720_FCR */
157 0x02, /* ISR */ 157 0x02, /* MOS7720_ISR */
158 0x03, /* LCR */ 158 0x03, /* MOS7720_LCR */
159 0x04, /* MCR */ 159 0x04, /* MOS7720_MCR */
160 0x05, /* LSR */ 160 0x05, /* MOS7720_LSR */
161 0x06, /* MSR */ 161 0x06, /* MOS7720_MSR */
162 0x07, /* SPR */ 162 0x07, /* MOS7720_SPR */
163 0x00, /* DLL */ 163 0x00, /* MOS7720_DLL */
164 0x01, /* DLM */ 164 0x01, /* MOS7720_DLM */
165 0x00, /* DPR */ 165 0x00, /* MOS7720_DPR */
166 0x01, /* DSR */ 166 0x01, /* MOS7720_DSR */
167 0x02, /* DCR */ 167 0x02, /* MOS7720_DCR */
168 0x0a, /* ECR */ 168 0x0a, /* MOS7720_ECR */
169 0x01, /* SP1_REG */ 169 0x01, /* MOS7720_SP1_REG */
170 0x02, /* SP2_REG (7720 only) */ 170 0x02, /* MOS7720_SP2_REG (7720 only) */
171 0x04, /* PP_REG (7715 only) */ 171 0x04, /* MOS7720_PP_REG (7715 only) */
172 0x08, /* SP_CONTROL_REG */ 172 0x08, /* MOS7720_SP_CONTROL_REG */
173 }; 173 };
174 return mos7715_index_lookup_table[reg]; 174 return mos7715_index_lookup_table[reg];
175} 175}
@@ -181,10 +181,10 @@ static inline __u16 get_reg_index(enum mos_regs reg)
181static inline __u16 get_reg_value(enum mos_regs reg, 181static inline __u16 get_reg_value(enum mos_regs reg,
182 unsigned int serial_portnum) 182 unsigned int serial_portnum)
183{ 183{
184 if (reg >= SP1_REG) /* control reg */ 184 if (reg >= MOS7720_SP1_REG) /* control reg */
185 return 0x0000; 185 return 0x0000;
186 186
187 else if (reg >= DPR) /* parallel port reg (7715 only) */ 187 else if (reg >= MOS7720_DPR) /* parallel port reg (7715 only) */
188 return 0x0100; 188 return 0x0100;
189 189
190 else /* serial port reg */ 190 else /* serial port reg */
@@ -252,7 +252,8 @@ static inline int mos7715_change_mode(struct mos7715_parport *mos_parport,
252 enum mos7715_pp_modes mode) 252 enum mos7715_pp_modes mode)
253{ 253{
254 mos_parport->shadowECR = mode; 254 mos_parport->shadowECR = mode;
255 write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR); 255 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR,
256 mos_parport->shadowECR);
256 return 0; 257 return 0;
257} 258}
258 259
@@ -486,7 +487,7 @@ static void parport_mos7715_write_data(struct parport *pp, unsigned char d)
486 if (parport_prologue(pp) < 0) 487 if (parport_prologue(pp) < 0)
487 return; 488 return;
488 mos7715_change_mode(mos_parport, SPP); 489 mos7715_change_mode(mos_parport, SPP);
489 write_mos_reg(mos_parport->serial, dummy, DPR, (__u8)d); 490 write_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, (__u8)d);
490 parport_epilogue(pp); 491 parport_epilogue(pp);
491} 492}
492 493
@@ -497,7 +498,7 @@ static unsigned char parport_mos7715_read_data(struct parport *pp)
497 498
498 if (parport_prologue(pp) < 0) 499 if (parport_prologue(pp) < 0)
499 return 0; 500 return 0;
500 read_mos_reg(mos_parport->serial, dummy, DPR, &d); 501 read_mos_reg(mos_parport->serial, dummy, MOS7720_DPR, &d);
501 parport_epilogue(pp); 502 parport_epilogue(pp);
502 return d; 503 return d;
503} 504}
@@ -510,7 +511,7 @@ static void parport_mos7715_write_control(struct parport *pp, unsigned char d)
510 if (parport_prologue(pp) < 0) 511 if (parport_prologue(pp) < 0)
511 return; 512 return;
512 data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0); 513 data = ((__u8)d & 0x0f) | (mos_parport->shadowDCR & 0xf0);
513 write_mos_reg(mos_parport->serial, dummy, DCR, data); 514 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR, data);
514 mos_parport->shadowDCR = data; 515 mos_parport->shadowDCR = data;
515 parport_epilogue(pp); 516 parport_epilogue(pp);
516} 517}
@@ -543,7 +544,8 @@ static unsigned char parport_mos7715_frob_control(struct parport *pp,
543 if (parport_prologue(pp) < 0) 544 if (parport_prologue(pp) < 0)
544 return 0; 545 return 0;
545 mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val; 546 mos_parport->shadowDCR = (mos_parport->shadowDCR & (~mask)) ^ val;
546 write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); 547 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
548 mos_parport->shadowDCR);
547 dcr = mos_parport->shadowDCR & 0x0f; 549 dcr = mos_parport->shadowDCR & 0x0f;
548 parport_epilogue(pp); 550 parport_epilogue(pp);
549 return dcr; 551 return dcr;
@@ -581,7 +583,8 @@ static void parport_mos7715_data_forward(struct parport *pp)
581 return; 583 return;
582 mos7715_change_mode(mos_parport, PS2); 584 mos7715_change_mode(mos_parport, PS2);
583 mos_parport->shadowDCR &= ~0x20; 585 mos_parport->shadowDCR &= ~0x20;
584 write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); 586 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
587 mos_parport->shadowDCR);
585 parport_epilogue(pp); 588 parport_epilogue(pp);
586} 589}
587 590
@@ -593,7 +596,8 @@ static void parport_mos7715_data_reverse(struct parport *pp)
593 return; 596 return;
594 mos7715_change_mode(mos_parport, PS2); 597 mos7715_change_mode(mos_parport, PS2);
595 mos_parport->shadowDCR |= 0x20; 598 mos_parport->shadowDCR |= 0x20;
596 write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); 599 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
600 mos_parport->shadowDCR);
597 parport_epilogue(pp); 601 parport_epilogue(pp);
598} 602}
599 603
@@ -633,8 +637,10 @@ static void parport_mos7715_restore_state(struct parport *pp,
633 spin_unlock(&release_lock); 637 spin_unlock(&release_lock);
634 return; 638 return;
635 } 639 }
636 write_parport_reg_nonblock(mos_parport, DCR, mos_parport->shadowDCR); 640 write_parport_reg_nonblock(mos_parport, MOS7720_DCR,
637 write_parport_reg_nonblock(mos_parport, ECR, mos_parport->shadowECR); 641 mos_parport->shadowDCR);
642 write_parport_reg_nonblock(mos_parport, MOS7720_ECR,
643 mos_parport->shadowECR);
638 spin_unlock(&release_lock); 644 spin_unlock(&release_lock);
639} 645}
640 646
@@ -714,14 +720,16 @@ static int mos7715_parport_init(struct usb_serial *serial)
714 init_completion(&mos_parport->syncmsg_compl); 720 init_completion(&mos_parport->syncmsg_compl);
715 721
716 /* cycle parallel port reset bit */ 722 /* cycle parallel port reset bit */
717 write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x80); 723 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x80);
718 write_mos_reg(mos_parport->serial, dummy, PP_REG, (__u8)0x00); 724 write_mos_reg(mos_parport->serial, dummy, MOS7720_PP_REG, (__u8)0x00);
719 725
720 /* initialize device registers */ 726 /* initialize device registers */
721 mos_parport->shadowDCR = DCR_INIT_VAL; 727 mos_parport->shadowDCR = DCR_INIT_VAL;
722 write_mos_reg(mos_parport->serial, dummy, DCR, mos_parport->shadowDCR); 728 write_mos_reg(mos_parport->serial, dummy, MOS7720_DCR,
729 mos_parport->shadowDCR);
723 mos_parport->shadowECR = ECR_INIT_VAL; 730 mos_parport->shadowECR = ECR_INIT_VAL;
724 write_mos_reg(mos_parport->serial, dummy, ECR, mos_parport->shadowECR); 731 write_mos_reg(mos_parport->serial, dummy, MOS7720_ECR,
732 mos_parport->shadowECR);
725 733
726 /* register with parport core */ 734 /* register with parport core */
727 mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE, 735 mos_parport->pp = parport_register_port(0, PARPORT_IRQ_NONE,
@@ -1033,45 +1041,49 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
1033 /* Initialize MCS7720 -- Write Init values to corresponding Registers 1041 /* Initialize MCS7720 -- Write Init values to corresponding Registers
1034 * 1042 *
1035 * Register Index 1043 * Register Index
1036 * 0 : THR/RHR 1044 * 0 : MOS7720_THR/MOS7720_RHR
1037 * 1 : IER 1045 * 1 : MOS7720_IER
1038 * 2 : FCR 1046 * 2 : MOS7720_FCR
1039 * 3 : LCR 1047 * 3 : MOS7720_LCR
1040 * 4 : MCR 1048 * 4 : MOS7720_MCR
1041 * 5 : LSR 1049 * 5 : MOS7720_LSR
1042 * 6 : MSR 1050 * 6 : MOS7720_MSR
1043 * 7 : SPR 1051 * 7 : MOS7720_SPR
1044 * 1052 *
1045 * 0x08 : SP1/2 Control Reg 1053 * 0x08 : SP1/2 Control Reg
1046 */ 1054 */
1047 port_number = port->port_number; 1055 port_number = port->port_number;
1048 read_mos_reg(serial, port_number, LSR, &data); 1056 read_mos_reg(serial, port_number, MOS7720_LSR, &data);
1049 1057
1050 dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); 1058 dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);
1051 1059
1052 write_mos_reg(serial, dummy, SP1_REG, 0x02); 1060 write_mos_reg(serial, dummy, MOS7720_SP1_REG, 0x02);
1053 write_mos_reg(serial, dummy, SP2_REG, 0x02); 1061 write_mos_reg(serial, dummy, MOS7720_SP2_REG, 0x02);
1054 1062
1055 write_mos_reg(serial, port_number, IER, 0x00); 1063 write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
1056 write_mos_reg(serial, port_number, FCR, 0x00); 1064 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00);
1057 1065
1058 write_mos_reg(serial, port_number, FCR, 0xcf); 1066 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf);
1059 mos7720_port->shadowLCR = 0x03; 1067 mos7720_port->shadowLCR = 0x03;
1060 write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); 1068 write_mos_reg(serial, port_number, MOS7720_LCR,
1069 mos7720_port->shadowLCR);
1061 mos7720_port->shadowMCR = 0x0b; 1070 mos7720_port->shadowMCR = 0x0b;
1062 write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); 1071 write_mos_reg(serial, port_number, MOS7720_MCR,
1072 mos7720_port->shadowMCR);
1063 1073
1064 write_mos_reg(serial, port_number, SP_CONTROL_REG, 0x00); 1074 write_mos_reg(serial, port_number, MOS7720_SP_CONTROL_REG, 0x00);
1065 read_mos_reg(serial, dummy, SP_CONTROL_REG, &data); 1075 read_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, &data);
1066 data = data | (port->port_number + 1); 1076 data = data | (port->port_number + 1);
1067 write_mos_reg(serial, dummy, SP_CONTROL_REG, data); 1077 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, data);
1068 mos7720_port->shadowLCR = 0x83; 1078 mos7720_port->shadowLCR = 0x83;
1069 write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); 1079 write_mos_reg(serial, port_number, MOS7720_LCR,
1070 write_mos_reg(serial, port_number, THR, 0x0c); 1080 mos7720_port->shadowLCR);
1071 write_mos_reg(serial, port_number, IER, 0x00); 1081 write_mos_reg(serial, port_number, MOS7720_THR, 0x0c);
1082 write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
1072 mos7720_port->shadowLCR = 0x03; 1083 mos7720_port->shadowLCR = 0x03;
1073 write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); 1084 write_mos_reg(serial, port_number, MOS7720_LCR,
1074 write_mos_reg(serial, port_number, IER, 0x0c); 1085 mos7720_port->shadowLCR);
1086 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c);
1075 1087
1076 response = usb_submit_urb(port->read_urb, GFP_KERNEL); 1088 response = usb_submit_urb(port->read_urb, GFP_KERNEL);
1077 if (response) 1089 if (response)
@@ -1144,8 +1156,8 @@ static void mos7720_close(struct usb_serial_port *port)
1144 usb_kill_urb(port->write_urb); 1156 usb_kill_urb(port->write_urb);
1145 usb_kill_urb(port->read_urb); 1157 usb_kill_urb(port->read_urb);
1146 1158
1147 write_mos_reg(serial, port->port_number, MCR, 0x00); 1159 write_mos_reg(serial, port->port_number, MOS7720_MCR, 0x00);
1148 write_mos_reg(serial, port->port_number, IER, 0x00); 1160 write_mos_reg(serial, port->port_number, MOS7720_IER, 0x00);
1149 1161
1150 mos7720_port->open = 0; 1162 mos7720_port->open = 0;
1151} 1163}
@@ -1169,7 +1181,8 @@ static void mos7720_break(struct tty_struct *tty, int break_state)
1169 data = mos7720_port->shadowLCR & ~UART_LCR_SBC; 1181 data = mos7720_port->shadowLCR & ~UART_LCR_SBC;
1170 1182
1171 mos7720_port->shadowLCR = data; 1183 mos7720_port->shadowLCR = data;
1172 write_mos_reg(serial, port->port_number, LCR, mos7720_port->shadowLCR); 1184 write_mos_reg(serial, port->port_number, MOS7720_LCR,
1185 mos7720_port->shadowLCR);
1173} 1186}
1174 1187
1175/* 1188/*
@@ -1297,7 +1310,7 @@ static void mos7720_throttle(struct tty_struct *tty)
1297 /* if we are implementing RTS/CTS, toggle that line */ 1310 /* if we are implementing RTS/CTS, toggle that line */
1298 if (tty->termios.c_cflag & CRTSCTS) { 1311 if (tty->termios.c_cflag & CRTSCTS) {
1299 mos7720_port->shadowMCR &= ~UART_MCR_RTS; 1312 mos7720_port->shadowMCR &= ~UART_MCR_RTS;
1300 write_mos_reg(port->serial, port->port_number, MCR, 1313 write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
1301 mos7720_port->shadowMCR); 1314 mos7720_port->shadowMCR);
1302 } 1315 }
1303} 1316}
@@ -1327,7 +1340,7 @@ static void mos7720_unthrottle(struct tty_struct *tty)
1327 /* if we are implementing RTS/CTS, toggle that line */ 1340 /* if we are implementing RTS/CTS, toggle that line */
1328 if (tty->termios.c_cflag & CRTSCTS) { 1341 if (tty->termios.c_cflag & CRTSCTS) {
1329 mos7720_port->shadowMCR |= UART_MCR_RTS; 1342 mos7720_port->shadowMCR |= UART_MCR_RTS;
1330 write_mos_reg(port->serial, port->port_number, MCR, 1343 write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
1331 mos7720_port->shadowMCR); 1344 mos7720_port->shadowMCR);
1332 } 1345 }
1333} 1346}
@@ -1352,35 +1365,39 @@ static int set_higher_rates(struct moschip_port *mos7720_port,
1352 dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); 1365 dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
1353 port_number = port->port_number; 1366 port_number = port->port_number;
1354 1367
1355 write_mos_reg(serial, port_number, IER, 0x00); 1368 write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
1356 write_mos_reg(serial, port_number, FCR, 0x00); 1369 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00);
1357 write_mos_reg(serial, port_number, FCR, 0xcf); 1370 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf);
1358 mos7720_port->shadowMCR = 0x0b; 1371 mos7720_port->shadowMCR = 0x0b;
1359 write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); 1372 write_mos_reg(serial, port_number, MOS7720_MCR,
1360 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x00); 1373 mos7720_port->shadowMCR);
1374 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x00);
1361 1375
1362 /*********************************************** 1376 /***********************************************
1363 * Set for higher rates * 1377 * Set for higher rates *
1364 ***********************************************/ 1378 ***********************************************/
1365 /* writing baud rate verbatum into uart clock field clearly not right */ 1379 /* writing baud rate verbatum into uart clock field clearly not right */
1366 if (port_number == 0) 1380 if (port_number == 0)
1367 sp_reg = SP1_REG; 1381 sp_reg = MOS7720_SP1_REG;
1368 else 1382 else
1369 sp_reg = SP2_REG; 1383 sp_reg = MOS7720_SP2_REG;
1370 write_mos_reg(serial, dummy, sp_reg, baud * 0x10); 1384 write_mos_reg(serial, dummy, sp_reg, baud * 0x10);
1371 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x03); 1385 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG, 0x03);
1372 mos7720_port->shadowMCR = 0x2b; 1386 mos7720_port->shadowMCR = 0x2b;
1373 write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); 1387 write_mos_reg(serial, port_number, MOS7720_MCR,
1388 mos7720_port->shadowMCR);
1374 1389
1375 /*********************************************** 1390 /***********************************************
1376 * Set DLL/DLM 1391 * Set DLL/DLM
1377 ***********************************************/ 1392 ***********************************************/
1378 mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; 1393 mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB;
1379 write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); 1394 write_mos_reg(serial, port_number, MOS7720_LCR,
1380 write_mos_reg(serial, port_number, DLL, 0x01); 1395 mos7720_port->shadowLCR);
1381 write_mos_reg(serial, port_number, DLM, 0x00); 1396 write_mos_reg(serial, port_number, MOS7720_DLL, 0x01);
1397 write_mos_reg(serial, port_number, MOS7720_DLM, 0x00);
1382 mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; 1398 mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB;
1383 write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); 1399 write_mos_reg(serial, port_number, MOS7720_LCR,
1400 mos7720_port->shadowLCR);
1384 1401
1385 return 0; 1402 return 0;
1386} 1403}
@@ -1488,15 +1505,16 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,
1488 1505
1489 /* Enable access to divisor latch */ 1506 /* Enable access to divisor latch */
1490 mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB; 1507 mos7720_port->shadowLCR = mos7720_port->shadowLCR | UART_LCR_DLAB;
1491 write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR); 1508 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR);
1492 1509
1493 /* Write the divisor */ 1510 /* Write the divisor */
1494 write_mos_reg(serial, number, DLL, (__u8)(divisor & 0xff)); 1511 write_mos_reg(serial, number, MOS7720_DLL, (__u8)(divisor & 0xff));
1495 write_mos_reg(serial, number, DLM, (__u8)((divisor & 0xff00) >> 8)); 1512 write_mos_reg(serial, number, MOS7720_DLM,
1513 (__u8)((divisor & 0xff00) >> 8));
1496 1514
1497 /* Disable access to divisor latch */ 1515 /* Disable access to divisor latch */
1498 mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB; 1516 mos7720_port->shadowLCR = mos7720_port->shadowLCR & ~UART_LCR_DLAB;
1499 write_mos_reg(serial, number, LCR, mos7720_port->shadowLCR); 1517 write_mos_reg(serial, number, MOS7720_LCR, mos7720_port->shadowLCR);
1500 1518
1501 return status; 1519 return status;
1502} 1520}
@@ -1600,14 +1618,16 @@ static void change_port_settings(struct tty_struct *tty,
1600 1618
1601 1619
1602 /* Disable Interrupts */ 1620 /* Disable Interrupts */
1603 write_mos_reg(serial, port_number, IER, 0x00); 1621 write_mos_reg(serial, port_number, MOS7720_IER, 0x00);
1604 write_mos_reg(serial, port_number, FCR, 0x00); 1622 write_mos_reg(serial, port_number, MOS7720_FCR, 0x00);
1605 write_mos_reg(serial, port_number, FCR, 0xcf); 1623 write_mos_reg(serial, port_number, MOS7720_FCR, 0xcf);
1606 1624
1607 /* Send the updated LCR value to the mos7720 */ 1625 /* Send the updated LCR value to the mos7720 */
1608 write_mos_reg(serial, port_number, LCR, mos7720_port->shadowLCR); 1626 write_mos_reg(serial, port_number, MOS7720_LCR,
1627 mos7720_port->shadowLCR);
1609 mos7720_port->shadowMCR = 0x0b; 1628 mos7720_port->shadowMCR = 0x0b;
1610 write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); 1629 write_mos_reg(serial, port_number, MOS7720_MCR,
1630 mos7720_port->shadowMCR);
1611 1631
1612 /* set up the MCR register and send it to the mos7720 */ 1632 /* set up the MCR register and send it to the mos7720 */
1613 mos7720_port->shadowMCR = UART_MCR_OUT2; 1633 mos7720_port->shadowMCR = UART_MCR_OUT2;
@@ -1619,14 +1639,17 @@ static void change_port_settings(struct tty_struct *tty,
1619 /* To set hardware flow control to the specified * 1639 /* To set hardware flow control to the specified *
1620 * serial port, in SP1/2_CONTROL_REG */ 1640 * serial port, in SP1/2_CONTROL_REG */
1621 if (port_number) 1641 if (port_number)
1622 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x01); 1642 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG,
1643 0x01);
1623 else 1644 else
1624 write_mos_reg(serial, dummy, SP_CONTROL_REG, 0x02); 1645 write_mos_reg(serial, dummy, MOS7720_SP_CONTROL_REG,
1646 0x02);
1625 1647
1626 } else 1648 } else
1627 mos7720_port->shadowMCR &= ~(UART_MCR_XONANY); 1649 mos7720_port->shadowMCR &= ~(UART_MCR_XONANY);
1628 1650
1629 write_mos_reg(serial, port_number, MCR, mos7720_port->shadowMCR); 1651 write_mos_reg(serial, port_number, MOS7720_MCR,
1652 mos7720_port->shadowMCR);
1630 1653
1631 /* Determine divisor based on baud rate */ 1654 /* Determine divisor based on baud rate */
1632 baud = tty_get_baud_rate(tty); 1655 baud = tty_get_baud_rate(tty);
@@ -1639,7 +1662,7 @@ static void change_port_settings(struct tty_struct *tty,
1639 if (baud >= 230400) { 1662 if (baud >= 230400) {
1640 set_higher_rates(mos7720_port, baud); 1663 set_higher_rates(mos7720_port, baud);
1641 /* Enable Interrupts */ 1664 /* Enable Interrupts */
1642 write_mos_reg(serial, port_number, IER, 0x0c); 1665 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c);
1643 return; 1666 return;
1644 } 1667 }
1645 1668
@@ -1650,7 +1673,7 @@ static void change_port_settings(struct tty_struct *tty,
1650 if (cflag & CBAUD) 1673 if (cflag & CBAUD)
1651 tty_encode_baud_rate(tty, baud, baud); 1674 tty_encode_baud_rate(tty, baud, baud);
1652 /* Enable Interrupts */ 1675 /* Enable Interrupts */
1653 write_mos_reg(serial, port_number, IER, 0x0c); 1676 write_mos_reg(serial, port_number, MOS7720_IER, 0x0c);
1654 1677
1655 if (port->read_urb->status != -EINPROGRESS) { 1678 if (port->read_urb->status != -EINPROGRESS) {
1656 status = usb_submit_urb(port->read_urb, GFP_KERNEL); 1679 status = usb_submit_urb(port->read_urb, GFP_KERNEL);
@@ -1725,7 +1748,7 @@ static int get_lsr_info(struct tty_struct *tty,
1725 1748
1726 count = mos7720_chars_in_buffer(tty); 1749 count = mos7720_chars_in_buffer(tty);
1727 if (count == 0) { 1750 if (count == 0) {
1728 read_mos_reg(port->serial, port_number, LSR, &data); 1751 read_mos_reg(port->serial, port_number, MOS7720_LSR, &data);
1729 if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) 1752 if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
1730 == (UART_LSR_TEMT | UART_LSR_THRE)) { 1753 == (UART_LSR_TEMT | UART_LSR_THRE)) {
1731 dev_dbg(&port->dev, "%s -- Empty\n", __func__); 1754 dev_dbg(&port->dev, "%s -- Empty\n", __func__);
@@ -1782,7 +1805,7 @@ static int mos7720_tiocmset(struct tty_struct *tty,
1782 mcr &= ~UART_MCR_LOOP; 1805 mcr &= ~UART_MCR_LOOP;
1783 1806
1784 mos7720_port->shadowMCR = mcr; 1807 mos7720_port->shadowMCR = mcr;
1785 write_mos_reg(port->serial, port->port_number, MCR, 1808 write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
1786 mos7720_port->shadowMCR); 1809 mos7720_port->shadowMCR);
1787 1810
1788 return 0; 1811 return 0;
@@ -1827,7 +1850,7 @@ static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1827 } 1850 }
1828 1851
1829 mos7720_port->shadowMCR = mcr; 1852 mos7720_port->shadowMCR = mcr;
1830 write_mos_reg(port->serial, port->port_number, MCR, 1853 write_mos_reg(port->serial, port->port_number, MOS7720_MCR,
1831 mos7720_port->shadowMCR); 1854 mos7720_port->shadowMCR);
1832 1855
1833 return 0; 1856 return 0;
@@ -1942,7 +1965,7 @@ static int mos7720_startup(struct usb_serial *serial)
1942 } 1965 }
1943#endif 1966#endif
1944 /* LSR For Port 1 */ 1967 /* LSR For Port 1 */
1945 read_mos_reg(serial, 0, LSR, &data); 1968 read_mos_reg(serial, 0, MOS7720_LSR, &data);
1946 dev_dbg(&dev->dev, "LSR:%x\n", data); 1969 dev_dbg(&dev->dev, "LSR:%x\n", data);
1947 1970
1948 return 0; 1971 return 0;
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f0c0c53359ad..19b85ee98a72 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1765,6 +1765,7 @@ static const struct usb_device_id option_ids[] = {
1765 { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, 1765 { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
1766 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ 1766 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
1767 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ 1767 { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
1768 { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */
1768 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, 1769 { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) },
1769 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, 1770 { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) },
1770 { } /* Terminating entry */ 1771 { } /* Terminating entry */
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 529066bbc7e8..46f1f13b41f1 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1306,6 +1306,7 @@ static void __exit usb_serial_exit(void)
1306 tty_unregister_driver(usb_serial_tty_driver); 1306 tty_unregister_driver(usb_serial_tty_driver);
1307 put_tty_driver(usb_serial_tty_driver); 1307 put_tty_driver(usb_serial_tty_driver);
1308 bus_unregister(&usb_serial_bus_type); 1308 bus_unregister(&usb_serial_bus_type);
1309 idr_destroy(&serial_minors);
1309} 1310}
1310 1311
1311 1312
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index c1b03f4235b9..4e7fec36f5c3 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -4,7 +4,7 @@
4 * Watchdog driver for ARM SP805 watchdog module 4 * Watchdog driver for ARM SP805 watchdog module
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2 or later. This program is licensed "as is" without any 10 * License version 2 or later. This program is licensed "as is" without any
@@ -303,6 +303,6 @@ static struct amba_driver sp805_wdt_driver = {
303 303
304module_amba_driver(sp805_wdt_driver); 304module_amba_driver(sp805_wdt_driver);
305 305
306MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); 306MODULE_AUTHOR("Viresh Kumar <vireshk@kernel.org>");
307MODULE_DESCRIPTION("ARM SP805 Watchdog Driver"); 307MODULE_DESCRIPTION("ARM SP805 Watchdog Driver");
308MODULE_LICENSE("GPL"); 308MODULE_LICENSE("GPL");
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1c2bd1723e40..171312d51799 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2296,9 +2296,22 @@ static int run_one_delayed_ref(struct btrfs_trans_handle *trans,
2296static inline struct btrfs_delayed_ref_node * 2296static inline struct btrfs_delayed_ref_node *
2297select_delayed_ref(struct btrfs_delayed_ref_head *head) 2297select_delayed_ref(struct btrfs_delayed_ref_head *head)
2298{ 2298{
2299 struct btrfs_delayed_ref_node *ref;
2300
2299 if (list_empty(&head->ref_list)) 2301 if (list_empty(&head->ref_list))
2300 return NULL; 2302 return NULL;
2301 2303
2304 /*
2305 * Select a delayed ref of type BTRFS_ADD_DELAYED_REF first.
2306 * This is to prevent a ref count from going down to zero, which deletes
2307 * the extent item from the extent tree, when there still are references
2308 * to add, which would fail because they would not find the extent item.
2309 */
2310 list_for_each_entry(ref, &head->ref_list, list) {
2311 if (ref->action == BTRFS_ADD_DELAYED_REF)
2312 return ref;
2313 }
2314
2302 return list_entry(head->ref_list.next, struct btrfs_delayed_ref_node, 2315 return list_entry(head->ref_list.next, struct btrfs_delayed_ref_node,
2303 list); 2316 list);
2304} 2317}
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b33c0cf02668..e33dff356460 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4209,7 +4209,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
4209 u64 extent_num_bytes = 0; 4209 u64 extent_num_bytes = 0;
4210 u64 extent_offset = 0; 4210 u64 extent_offset = 0;
4211 u64 item_end = 0; 4211 u64 item_end = 0;
4212 u64 last_size = (u64)-1; 4212 u64 last_size = new_size;
4213 u32 found_type = (u8)-1; 4213 u32 found_type = (u8)-1;
4214 int found_extent; 4214 int found_extent;
4215 int del_item; 4215 int del_item;
@@ -4493,8 +4493,7 @@ out:
4493 btrfs_abort_transaction(trans, root, ret); 4493 btrfs_abort_transaction(trans, root, ret);
4494 } 4494 }
4495error: 4495error:
4496 if (last_size != (u64)-1 && 4496 if (root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID)
4497 root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID)
4498 btrfs_ordered_update_i_size(inode, last_size, NULL); 4497 btrfs_ordered_update_i_size(inode, last_size, NULL);
4499 4498
4500 btrfs_free_path(path); 4499 btrfs_free_path(path);
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 5d91776e12a2..0770c91586ca 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3090,7 +3090,7 @@ out_unlock:
3090static long btrfs_ioctl_file_extent_same(struct file *file, 3090static long btrfs_ioctl_file_extent_same(struct file *file,
3091 struct btrfs_ioctl_same_args __user *argp) 3091 struct btrfs_ioctl_same_args __user *argp)
3092{ 3092{
3093 struct btrfs_ioctl_same_args *same; 3093 struct btrfs_ioctl_same_args *same = NULL;
3094 struct btrfs_ioctl_same_extent_info *info; 3094 struct btrfs_ioctl_same_extent_info *info;
3095 struct inode *src = file_inode(file); 3095 struct inode *src = file_inode(file);
3096 u64 off; 3096 u64 off;
@@ -3120,6 +3120,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
3120 3120
3121 if (IS_ERR(same)) { 3121 if (IS_ERR(same)) {
3122 ret = PTR_ERR(same); 3122 ret = PTR_ERR(same);
3123 same = NULL;
3123 goto out; 3124 goto out;
3124 } 3125 }
3125 3126
@@ -3190,6 +3191,7 @@ static long btrfs_ioctl_file_extent_same(struct file *file,
3190 3191
3191out: 3192out:
3192 mnt_drop_write_file(file); 3193 mnt_drop_write_file(file);
3194 kfree(same);
3193 return ret; 3195 return ret;
3194} 3196}
3195 3197
@@ -3586,6 +3588,20 @@ process_slot:
3586 u64 trim = 0; 3588 u64 trim = 0;
3587 u64 aligned_end = 0; 3589 u64 aligned_end = 0;
3588 3590
3591 /*
3592 * Don't copy an inline extent into an offset
3593 * greater than zero. Having an inline extent
3594 * at such an offset results in chaos as btrfs
3595 * isn't prepared for such cases. Just skip
3596 * this case for the same reasons as commented
3597 * at btrfs_ioctl_clone().
3598 */
3599 if (last_dest_end > 0) {
3600 ret = -EOPNOTSUPP;
3601 btrfs_end_transaction(trans, root);
3602 goto out;
3603 }
3604
3589 if (off > key.offset) { 3605 if (off > key.offset) {
3590 skip = off - key.offset; 3606 skip = off - key.offset;
3591 new_key.offset += skip; 3607 new_key.offset += skip;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index c0f18e7266b6..51e0f0d0053e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -761,7 +761,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
761 761
762 if (!list_empty(&trans->ordered)) { 762 if (!list_empty(&trans->ordered)) {
763 spin_lock(&info->trans_lock); 763 spin_lock(&info->trans_lock);
764 list_splice(&trans->ordered, &cur_trans->pending_ordered); 764 list_splice_init(&trans->ordered, &cur_trans->pending_ordered);
765 spin_unlock(&info->trans_lock); 765 spin_unlock(&info->trans_lock);
766 } 766 }
767 767
@@ -1866,7 +1866,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
1866 } 1866 }
1867 1867
1868 spin_lock(&root->fs_info->trans_lock); 1868 spin_lock(&root->fs_info->trans_lock);
1869 list_splice(&trans->ordered, &cur_trans->pending_ordered); 1869 list_splice_init(&trans->ordered, &cur_trans->pending_ordered);
1870 if (cur_trans->state >= TRANS_STATE_COMMIT_START) { 1870 if (cur_trans->state >= TRANS_STATE_COMMIT_START) {
1871 spin_unlock(&root->fs_info->trans_lock); 1871 spin_unlock(&root->fs_info->trans_lock);
1872 atomic_inc(&cur_trans->use_count); 1872 atomic_inc(&cur_trans->use_count);
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index 4d6a30e76168..b863a09cd2f1 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -115,7 +115,7 @@ void config_item_init_type_name(struct config_item *item,
115 const char *name, 115 const char *name,
116 struct config_item_type *type) 116 struct config_item_type *type)
117{ 117{
118 config_item_set_name(item, name); 118 config_item_set_name(item, "%s", name);
119 item->ci_type = type; 119 item->ci_type = type;
120 config_item_init(item); 120 config_item_init(item);
121} 121}
@@ -124,7 +124,7 @@ EXPORT_SYMBOL(config_item_init_type_name);
124void config_group_init_type_name(struct config_group *group, const char *name, 124void config_group_init_type_name(struct config_group *group, const char *name,
125 struct config_item_type *type) 125 struct config_item_type *type)
126{ 126{
127 config_item_set_name(&group->cg_item, name); 127 config_item_set_name(&group->cg_item, "%s", name);
128 group->cg_item.ci_type = type; 128 group->cg_item.ci_type = type;
129 config_group_init(group); 129 config_group_init(group);
130} 130}
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index e98d39d75cf4..b9dc23cd04f2 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -76,7 +76,7 @@ static int jfs_open(struct inode *inode, struct file *file)
76 if (ji->active_ag == -1) { 76 if (ji->active_ag == -1) {
77 struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb); 77 struct jfs_sb_info *jfs_sb = JFS_SBI(inode->i_sb);
78 ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb); 78 ji->active_ag = BLKTOAG(addressPXD(&ji->ixpxd), jfs_sb);
79 atomic_inc( &jfs_sb->bmap->db_active[ji->active_ag]); 79 atomic_inc(&jfs_sb->bmap->db_active[ji->active_ag]);
80 } 80 }
81 spin_unlock_irq(&ji->ag_lock); 81 spin_unlock_irq(&ji->ag_lock);
82 } 82 }
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 6f1cb2b5ee28..41aa3ca6a6a4 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -134,11 +134,11 @@ int jfs_write_inode(struct inode *inode, struct writeback_control *wbc)
134 * It has been committed since the last change, but was still 134 * It has been committed since the last change, but was still
135 * on the dirty inode list. 135 * on the dirty inode list.
136 */ 136 */
137 if (!test_cflag(COMMIT_Dirty, inode)) { 137 if (!test_cflag(COMMIT_Dirty, inode)) {
138 /* Make sure committed changes hit the disk */ 138 /* Make sure committed changes hit the disk */
139 jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait); 139 jfs_flush_journal(JFS_SBI(inode->i_sb)->log, wait);
140 return 0; 140 return 0;
141 } 141 }
142 142
143 if (jfs_commit_inode(inode, wait)) { 143 if (jfs_commit_inode(inode, wait)) {
144 jfs_err("jfs_write_inode: jfs_commit_inode failed!"); 144 jfs_err("jfs_write_inode: jfs_commit_inode failed!");
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index e33be921aa41..a5ac97b9a933 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1160,7 +1160,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1160 rc = dtModify(tid, new_dir, &new_dname, &ino, 1160 rc = dtModify(tid, new_dir, &new_dname, &ino,
1161 old_ip->i_ino, JFS_RENAME); 1161 old_ip->i_ino, JFS_RENAME);
1162 if (rc) 1162 if (rc)
1163 goto out4; 1163 goto out_tx;
1164 drop_nlink(new_ip); 1164 drop_nlink(new_ip);
1165 if (S_ISDIR(new_ip->i_mode)) { 1165 if (S_ISDIR(new_ip->i_mode)) {
1166 drop_nlink(new_ip); 1166 drop_nlink(new_ip);
@@ -1185,7 +1185,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1185 if ((new_size = commitZeroLink(tid, new_ip)) < 0) { 1185 if ((new_size = commitZeroLink(tid, new_ip)) < 0) {
1186 txAbort(tid, 1); /* Marks FS Dirty */ 1186 txAbort(tid, 1); /* Marks FS Dirty */
1187 rc = new_size; 1187 rc = new_size;
1188 goto out4; 1188 goto out_tx;
1189 } 1189 }
1190 tblk = tid_to_tblock(tid); 1190 tblk = tid_to_tblock(tid);
1191 tblk->xflag |= COMMIT_DELETE; 1191 tblk->xflag |= COMMIT_DELETE;
@@ -1203,7 +1203,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1203 if (rc) { 1203 if (rc) {
1204 jfs_err("jfs_rename didn't expect dtSearch to fail " 1204 jfs_err("jfs_rename didn't expect dtSearch to fail "
1205 "w/rc = %d", rc); 1205 "w/rc = %d", rc);
1206 goto out4; 1206 goto out_tx;
1207 } 1207 }
1208 1208
1209 ino = old_ip->i_ino; 1209 ino = old_ip->i_ino;
@@ -1211,7 +1211,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1211 if (rc) { 1211 if (rc) {
1212 if (rc == -EIO) 1212 if (rc == -EIO)
1213 jfs_err("jfs_rename: dtInsert returned -EIO"); 1213 jfs_err("jfs_rename: dtInsert returned -EIO");
1214 goto out4; 1214 goto out_tx;
1215 } 1215 }
1216 if (S_ISDIR(old_ip->i_mode)) 1216 if (S_ISDIR(old_ip->i_mode))
1217 inc_nlink(new_dir); 1217 inc_nlink(new_dir);
@@ -1226,7 +1226,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1226 jfs_err("jfs_rename did not expect dtDelete to return rc = %d", 1226 jfs_err("jfs_rename did not expect dtDelete to return rc = %d",
1227 rc); 1227 rc);
1228 txAbort(tid, 1); /* Marks Filesystem dirty */ 1228 txAbort(tid, 1); /* Marks Filesystem dirty */
1229 goto out4; 1229 goto out_tx;
1230 } 1230 }
1231 if (S_ISDIR(old_ip->i_mode)) { 1231 if (S_ISDIR(old_ip->i_mode)) {
1232 drop_nlink(old_dir); 1232 drop_nlink(old_dir);
@@ -1285,7 +1285,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1285 1285
1286 rc = txCommit(tid, ipcount, iplist, commit_flag); 1286 rc = txCommit(tid, ipcount, iplist, commit_flag);
1287 1287
1288 out4: 1288 out_tx:
1289 txEnd(tid); 1289 txEnd(tid);
1290 if (new_ip) 1290 if (new_ip)
1291 mutex_unlock(&JFS_IP(new_ip)->commit_mutex); 1291 mutex_unlock(&JFS_IP(new_ip)->commit_mutex);
@@ -1308,13 +1308,6 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1308 } 1308 }
1309 if (new_ip && (new_ip->i_nlink == 0)) 1309 if (new_ip && (new_ip->i_nlink == 0))
1310 set_cflag(COMMIT_Nolink, new_ip); 1310 set_cflag(COMMIT_Nolink, new_ip);
1311 out3:
1312 free_UCSname(&new_dname);
1313 out2:
1314 free_UCSname(&old_dname);
1315 out1:
1316 if (new_ip && !S_ISDIR(new_ip->i_mode))
1317 IWRITE_UNLOCK(new_ip);
1318 /* 1311 /*
1319 * Truncating the directory index table is not guaranteed. It 1312 * Truncating the directory index table is not guaranteed. It
1320 * may need to be done iteratively 1313 * may need to be done iteratively
@@ -1325,7 +1318,13 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1325 1318
1326 clear_cflag(COMMIT_Stale, old_dir); 1319 clear_cflag(COMMIT_Stale, old_dir);
1327 } 1320 }
1328 1321 if (new_ip && !S_ISDIR(new_ip->i_mode))
1322 IWRITE_UNLOCK(new_ip);
1323 out3:
1324 free_UCSname(&new_dname);
1325 out2:
1326 free_UCSname(&old_dname);
1327 out1:
1329 jfs_info("jfs_rename: returning %d", rc); 1328 jfs_info("jfs_rename: returning %d", rc);
1330 return rc; 1329 return rc;
1331} 1330}
diff --git a/fs/locks.c b/fs/locks.c
index 653faabb07f4..d3d558ba4da7 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -862,12 +862,11 @@ static int posix_locks_deadlock(struct file_lock *caller_fl,
862 * whether or not a lock was successfully freed by testing the return 862 * whether or not a lock was successfully freed by testing the return
863 * value for -ENOENT. 863 * value for -ENOENT.
864 */ 864 */
865static int flock_lock_file(struct file *filp, struct file_lock *request) 865static int flock_lock_inode(struct inode *inode, struct file_lock *request)
866{ 866{
867 struct file_lock *new_fl = NULL; 867 struct file_lock *new_fl = NULL;
868 struct file_lock *fl; 868 struct file_lock *fl;
869 struct file_lock_context *ctx; 869 struct file_lock_context *ctx;
870 struct inode *inode = file_inode(filp);
871 int error = 0; 870 int error = 0;
872 bool found = false; 871 bool found = false;
873 LIST_HEAD(dispose); 872 LIST_HEAD(dispose);
@@ -890,7 +889,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
890 goto find_conflict; 889 goto find_conflict;
891 890
892 list_for_each_entry(fl, &ctx->flc_flock, fl_list) { 891 list_for_each_entry(fl, &ctx->flc_flock, fl_list) {
893 if (filp != fl->fl_file) 892 if (request->fl_file != fl->fl_file)
894 continue; 893 continue;
895 if (request->fl_type == fl->fl_type) 894 if (request->fl_type == fl->fl_type)
896 goto out; 895 goto out;
@@ -1164,20 +1163,19 @@ int posix_lock_file(struct file *filp, struct file_lock *fl,
1164EXPORT_SYMBOL(posix_lock_file); 1163EXPORT_SYMBOL(posix_lock_file);
1165 1164
1166/** 1165/**
1167 * posix_lock_file_wait - Apply a POSIX-style lock to a file 1166 * posix_lock_inode_wait - Apply a POSIX-style lock to a file
1168 * @filp: The file to apply the lock to 1167 * @inode: inode of file to which lock request should be applied
1169 * @fl: The lock to be applied 1168 * @fl: The lock to be applied
1170 * 1169 *
1171 * Add a POSIX style lock to a file. 1170 * Variant of posix_lock_file_wait that does not take a filp, and so can be
1172 * We merge adjacent & overlapping locks whenever possible. 1171 * used after the filp has already been torn down.
1173 * POSIX locks are sorted by owner task, then by starting address
1174 */ 1172 */
1175int posix_lock_file_wait(struct file *filp, struct file_lock *fl) 1173int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
1176{ 1174{
1177 int error; 1175 int error;
1178 might_sleep (); 1176 might_sleep ();
1179 for (;;) { 1177 for (;;) {
1180 error = posix_lock_file(filp, fl, NULL); 1178 error = __posix_lock_file(inode, fl, NULL);
1181 if (error != FILE_LOCK_DEFERRED) 1179 if (error != FILE_LOCK_DEFERRED)
1182 break; 1180 break;
1183 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); 1181 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next);
@@ -1189,7 +1187,7 @@ int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1189 } 1187 }
1190 return error; 1188 return error;
1191} 1189}
1192EXPORT_SYMBOL(posix_lock_file_wait); 1190EXPORT_SYMBOL(posix_lock_inode_wait);
1193 1191
1194/** 1192/**
1195 * locks_mandatory_locked - Check for an active lock 1193 * locks_mandatory_locked - Check for an active lock
@@ -1851,18 +1849,18 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
1851} 1849}
1852 1850
1853/** 1851/**
1854 * flock_lock_file_wait - Apply a FLOCK-style lock to a file 1852 * flock_lock_inode_wait - Apply a FLOCK-style lock to a file
1855 * @filp: The file to apply the lock to 1853 * @inode: inode of the file to apply to
1856 * @fl: The lock to be applied 1854 * @fl: The lock to be applied
1857 * 1855 *
1858 * Add a FLOCK style lock to a file. 1856 * Apply a FLOCK style lock request to an inode.
1859 */ 1857 */
1860int flock_lock_file_wait(struct file *filp, struct file_lock *fl) 1858int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
1861{ 1859{
1862 int error; 1860 int error;
1863 might_sleep(); 1861 might_sleep();
1864 for (;;) { 1862 for (;;) {
1865 error = flock_lock_file(filp, fl); 1863 error = flock_lock_inode(inode, fl);
1866 if (error != FILE_LOCK_DEFERRED) 1864 if (error != FILE_LOCK_DEFERRED)
1867 break; 1865 break;
1868 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next); 1866 error = wait_event_interruptible(fl->fl_wait, !fl->fl_next);
@@ -1874,8 +1872,7 @@ int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
1874 } 1872 }
1875 return error; 1873 return error;
1876} 1874}
1877 1875EXPORT_SYMBOL(flock_lock_inode_wait);
1878EXPORT_SYMBOL(flock_lock_file_wait);
1879 1876
1880/** 1877/**
1881 * sys_flock: - flock() system call. 1878 * sys_flock: - flock() system call.
@@ -2401,7 +2398,8 @@ locks_remove_flock(struct file *filp)
2401 .fl_type = F_UNLCK, 2398 .fl_type = F_UNLCK,
2402 .fl_end = OFFSET_MAX, 2399 .fl_end = OFFSET_MAX,
2403 }; 2400 };
2404 struct file_lock_context *flctx = file_inode(filp)->i_flctx; 2401 struct inode *inode = file_inode(filp);
2402 struct file_lock_context *flctx = inode->i_flctx;
2405 2403
2406 if (list_empty(&flctx->flc_flock)) 2404 if (list_empty(&flctx->flc_flock))
2407 return; 2405 return;
@@ -2409,7 +2407,7 @@ locks_remove_flock(struct file *filp)
2409 if (filp->f_op->flock) 2407 if (filp->f_op->flock)
2410 filp->f_op->flock(filp, F_SETLKW, &fl); 2408 filp->f_op->flock(filp, F_SETLKW, &fl);
2411 else 2409 else
2412 flock_lock_file(filp, &fl); 2410 flock_lock_inode(inode, &fl);
2413 2411
2414 if (fl.fl_ops && fl.fl_ops->fl_release_private) 2412 if (fl.fl_ops && fl.fl_ops->fl_release_private)
2415 fl.fl_ops->fl_release_private(&fl); 2413 fl.fl_ops->fl_release_private(&fl);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6f228b5af819..8bee93469617 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5439,15 +5439,15 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *
5439 return err; 5439 return err;
5440} 5440}
5441 5441
5442static int do_vfs_lock(struct file *file, struct file_lock *fl) 5442static int do_vfs_lock(struct inode *inode, struct file_lock *fl)
5443{ 5443{
5444 int res = 0; 5444 int res = 0;
5445 switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) { 5445 switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
5446 case FL_POSIX: 5446 case FL_POSIX:
5447 res = posix_lock_file_wait(file, fl); 5447 res = posix_lock_inode_wait(inode, fl);
5448 break; 5448 break;
5449 case FL_FLOCK: 5449 case FL_FLOCK:
5450 res = flock_lock_file_wait(file, fl); 5450 res = flock_lock_inode_wait(inode, fl);
5451 break; 5451 break;
5452 default: 5452 default:
5453 BUG(); 5453 BUG();
@@ -5484,7 +5484,6 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,
5484 atomic_inc(&lsp->ls_count); 5484 atomic_inc(&lsp->ls_count);
5485 /* Ensure we don't close file until we're done freeing locks! */ 5485 /* Ensure we don't close file until we're done freeing locks! */
5486 p->ctx = get_nfs_open_context(ctx); 5486 p->ctx = get_nfs_open_context(ctx);
5487 get_file(fl->fl_file);
5488 memcpy(&p->fl, fl, sizeof(p->fl)); 5487 memcpy(&p->fl, fl, sizeof(p->fl));
5489 p->server = NFS_SERVER(inode); 5488 p->server = NFS_SERVER(inode);
5490 return p; 5489 return p;
@@ -5496,7 +5495,6 @@ static void nfs4_locku_release_calldata(void *data)
5496 nfs_free_seqid(calldata->arg.seqid); 5495 nfs_free_seqid(calldata->arg.seqid);
5497 nfs4_put_lock_state(calldata->lsp); 5496 nfs4_put_lock_state(calldata->lsp);
5498 put_nfs_open_context(calldata->ctx); 5497 put_nfs_open_context(calldata->ctx);
5499 fput(calldata->fl.fl_file);
5500 kfree(calldata); 5498 kfree(calldata);
5501} 5499}
5502 5500
@@ -5509,7 +5507,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
5509 switch (task->tk_status) { 5507 switch (task->tk_status) {
5510 case 0: 5508 case 0:
5511 renew_lease(calldata->server, calldata->timestamp); 5509 renew_lease(calldata->server, calldata->timestamp);
5512 do_vfs_lock(calldata->fl.fl_file, &calldata->fl); 5510 do_vfs_lock(calldata->lsp->ls_state->inode, &calldata->fl);
5513 if (nfs4_update_lock_stateid(calldata->lsp, 5511 if (nfs4_update_lock_stateid(calldata->lsp,
5514 &calldata->res.stateid)) 5512 &calldata->res.stateid))
5515 break; 5513 break;
@@ -5617,7 +5615,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
5617 mutex_lock(&sp->so_delegreturn_mutex); 5615 mutex_lock(&sp->so_delegreturn_mutex);
5618 /* Exclude nfs4_reclaim_open_stateid() - note nesting! */ 5616 /* Exclude nfs4_reclaim_open_stateid() - note nesting! */
5619 down_read(&nfsi->rwsem); 5617 down_read(&nfsi->rwsem);
5620 if (do_vfs_lock(request->fl_file, request) == -ENOENT) { 5618 if (do_vfs_lock(inode, request) == -ENOENT) {
5621 up_read(&nfsi->rwsem); 5619 up_read(&nfsi->rwsem);
5622 mutex_unlock(&sp->so_delegreturn_mutex); 5620 mutex_unlock(&sp->so_delegreturn_mutex);
5623 goto out; 5621 goto out;
@@ -5758,7 +5756,7 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
5758 data->timestamp); 5756 data->timestamp);
5759 if (data->arg.new_lock) { 5757 if (data->arg.new_lock) {
5760 data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS); 5758 data->fl.fl_flags &= ~(FL_SLEEP | FL_ACCESS);
5761 if (do_vfs_lock(data->fl.fl_file, &data->fl) < 0) { 5759 if (do_vfs_lock(lsp->ls_state->inode, &data->fl) < 0) {
5762 rpc_restart_call_prepare(task); 5760 rpc_restart_call_prepare(task);
5763 break; 5761 break;
5764 } 5762 }
@@ -6000,7 +5998,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
6000 if (status != 0) 5998 if (status != 0)
6001 goto out; 5999 goto out;
6002 request->fl_flags |= FL_ACCESS; 6000 request->fl_flags |= FL_ACCESS;
6003 status = do_vfs_lock(request->fl_file, request); 6001 status = do_vfs_lock(state->inode, request);
6004 if (status < 0) 6002 if (status < 0)
6005 goto out; 6003 goto out;
6006 down_read(&nfsi->rwsem); 6004 down_read(&nfsi->rwsem);
@@ -6008,7 +6006,7 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
6008 /* Yes: cache locks! */ 6006 /* Yes: cache locks! */
6009 /* ...but avoid races with delegation recall... */ 6007 /* ...but avoid races with delegation recall... */
6010 request->fl_flags = fl_flags & ~FL_SLEEP; 6008 request->fl_flags = fl_flags & ~FL_SLEEP;
6011 status = do_vfs_lock(request->fl_file, request); 6009 status = do_vfs_lock(state->inode, request);
6012 up_read(&nfsi->rwsem); 6010 up_read(&nfsi->rwsem);
6013 goto out; 6011 goto out;
6014 } 6012 }
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 92e48c70f0f0..3e594ce41010 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -152,31 +152,15 @@ void fsnotify_destroy_mark_locked(struct fsnotify_mark *mark,
152 BUG(); 152 BUG();
153 153
154 list_del_init(&mark->g_list); 154 list_del_init(&mark->g_list);
155
156 spin_unlock(&mark->lock); 155 spin_unlock(&mark->lock);
157 156
158 if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED)) 157 if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED))
159 iput(inode); 158 iput(inode);
160 /* release lock temporarily */
161 mutex_unlock(&group->mark_mutex);
162 159
163 spin_lock(&destroy_lock); 160 spin_lock(&destroy_lock);
164 list_add(&mark->g_list, &destroy_list); 161 list_add(&mark->g_list, &destroy_list);
165 spin_unlock(&destroy_lock); 162 spin_unlock(&destroy_lock);
166 wake_up(&destroy_waitq); 163 wake_up(&destroy_waitq);
167 /*
168 * We don't necessarily have a ref on mark from caller so the above destroy
169 * may have actually freed it, unless this group provides a 'freeing_mark'
170 * function which must be holding a reference.
171 */
172
173 /*
174 * Some groups like to know that marks are being freed. This is a
175 * callback to the group function to let it know that this mark
176 * is being freed.
177 */
178 if (group->ops->freeing_mark)
179 group->ops->freeing_mark(mark, group);
180 164
181 /* 165 /*
182 * __fsnotify_update_child_dentry_flags(inode); 166 * __fsnotify_update_child_dentry_flags(inode);
@@ -191,8 +175,6 @@ void fsnotify_destroy_mark_locked(struct fsnotify_mark *mark,
191 */ 175 */
192 176
193 atomic_dec(&group->num_marks); 177 atomic_dec(&group->num_marks);
194
195 mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING);
196} 178}
197 179
198void fsnotify_destroy_mark(struct fsnotify_mark *mark, 180void fsnotify_destroy_mark(struct fsnotify_mark *mark,
@@ -205,7 +187,10 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark,
205 187
206/* 188/*
207 * Destroy all marks in the given list. The marks must be already detached from 189 * Destroy all marks in the given list. The marks must be already detached from
208 * the original inode / vfsmount. 190 * the original inode / vfsmount. Note that we can race with
191 * fsnotify_clear_marks_by_group_flags(). However we hold a reference to each
192 * mark so they won't get freed from under us and nobody else touches our
193 * free_list list_head.
209 */ 194 */
210void fsnotify_destroy_marks(struct list_head *to_free) 195void fsnotify_destroy_marks(struct list_head *to_free)
211{ 196{
@@ -406,7 +391,7 @@ struct fsnotify_mark *fsnotify_find_mark(struct hlist_head *head,
406} 391}
407 392
408/* 393/*
409 * clear any marks in a group in which mark->flags & flags is true 394 * Clear any marks in a group in which mark->flags & flags is true.
410 */ 395 */
411void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, 396void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group,
412 unsigned int flags) 397 unsigned int flags)
@@ -460,6 +445,7 @@ static int fsnotify_mark_destroy(void *ignored)
460{ 445{
461 struct fsnotify_mark *mark, *next; 446 struct fsnotify_mark *mark, *next;
462 struct list_head private_destroy_list; 447 struct list_head private_destroy_list;
448 struct fsnotify_group *group;
463 449
464 for (;;) { 450 for (;;) {
465 spin_lock(&destroy_lock); 451 spin_lock(&destroy_lock);
@@ -471,6 +457,14 @@ static int fsnotify_mark_destroy(void *ignored)
471 457
472 list_for_each_entry_safe(mark, next, &private_destroy_list, g_list) { 458 list_for_each_entry_safe(mark, next, &private_destroy_list, g_list) {
473 list_del_init(&mark->g_list); 459 list_del_init(&mark->g_list);
460 group = mark->group;
461 /*
462 * Some groups like to know that marks are being freed.
463 * This is a callback to the group function to let it
464 * know that this mark is being freed.
465 */
466 if (group && group->ops->freeing_mark)
467 group->ops->freeing_mark(mark, group);
474 fsnotify_put_mark(mark); 468 fsnotify_put_mark(mark);
475 } 469 }
476 470
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index d751fcb637bb..1ade1206bb89 100644
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
@@ -75,3 +75,9 @@ config PROC_PAGE_MONITOR
75config PROC_CHILDREN 75config PROC_CHILDREN
76 bool "Include /proc/<pid>/task/<tid>/children file" 76 bool "Include /proc/<pid>/task/<tid>/children file"
77 default n 77 default n
78 help
79 Provides a fast way to retrieve first level children pids of a task. See
80 <file:Documentation/filesystems/proc.txt> for more information.
81
82 Say Y if you are running any user-space software which takes benefit from
83 this interface. For example, rkt is such a piece of software.
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 87782e874b6a..aa50d1ac28fc 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -243,6 +243,11 @@ static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf,
243 len1 = arg_end - arg_start; 243 len1 = arg_end - arg_start;
244 len2 = env_end - env_start; 244 len2 = env_end - env_start;
245 245
246 /* Empty ARGV. */
247 if (len1 == 0) {
248 rv = 0;
249 goto out_free_page;
250 }
246 /* 251 /*
247 * Inherently racy -- command line shares address space 252 * Inherently racy -- command line shares address space
248 * with code and data. 253 * with code and data.
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 91a4e6426321..92e6726f6e37 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -92,7 +92,7 @@ static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
92 roundup(sizeof(CORE_STR), 4)) + 92 roundup(sizeof(CORE_STR), 4)) +
93 roundup(sizeof(struct elf_prstatus), 4) + 93 roundup(sizeof(struct elf_prstatus), 4) +
94 roundup(sizeof(struct elf_prpsinfo), 4) + 94 roundup(sizeof(struct elf_prpsinfo), 4) +
95 roundup(sizeof(struct task_struct), 4); 95 roundup(arch_task_struct_size, 4);
96 *elf_buflen = PAGE_ALIGN(*elf_buflen); 96 *elf_buflen = PAGE_ALIGN(*elf_buflen);
97 return size + *elf_buflen; 97 return size + *elf_buflen;
98} 98}
@@ -415,7 +415,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
415 /* set up the task structure */ 415 /* set up the task structure */
416 notes[2].name = CORE_STR; 416 notes[2].name = CORE_STR;
417 notes[2].type = NT_TASKSTRUCT; 417 notes[2].type = NT_TASKSTRUCT;
418 notes[2].datasz = sizeof(struct task_struct); 418 notes[2].datasz = arch_task_struct_size;
419 notes[2].data = current; 419 notes[2].data = current;
420 420
421 nhdr->p_filesz += notesize(&notes[2]); 421 nhdr->p_filesz += notesize(&notes[2]);
diff --git a/include/asm-generic/mm-arch-hooks.h b/include/asm-generic/mm-arch-hooks.h
new file mode 100644
index 000000000000..5ff0e5193f85
--- /dev/null
+++ b/include/asm-generic/mm-arch-hooks.h
@@ -0,0 +1,16 @@
1/*
2 * Architecture specific mm hooks
3 */
4
5#ifndef _ASM_GENERIC_MM_ARCH_HOOKS_H
6#define _ASM_GENERIC_MM_ARCH_HOOKS_H
7
8/*
9 * This file should be included through arch/../include/asm/Kbuild for
10 * the architecture which doesn't need specific mm hooks.
11 *
12 * In that case, the generic hooks defined in include/linux/mm-arch-hooks.h
13 * are used.
14 */
15
16#endif /* _ASM_GENERIC_MM_ARCH_HOOKS_H */
diff --git a/include/linux/amba/sp810.h b/include/linux/amba/sp810.h
index c7df89f99115..58fe9e8b6fd7 100644
--- a/include/linux/amba/sp810.h
+++ b/include/linux/amba/sp810.h
@@ -2,7 +2,7 @@
2 * ARM PrimeXsys System Controller SP810 header file 2 * ARM PrimeXsys System Controller SP810 header file
3 * 3 *
4 * Copyright (C) 2009 ST Microelectronics 4 * Copyright (C) 2009 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com> 5 * Viresh Kumar <vireshk@kernel.org>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 58cfab80dd70..1b62d768c7df 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -47,6 +47,7 @@ struct blkcg {
47 47
48 struct blkcg_policy_data *pd[BLKCG_MAX_POLS]; 48 struct blkcg_policy_data *pd[BLKCG_MAX_POLS];
49 49
50 struct list_head all_blkcgs_node;
50#ifdef CONFIG_CGROUP_WRITEBACK 51#ifdef CONFIG_CGROUP_WRITEBACK
51 struct list_head cgwb_list; 52 struct list_head cgwb_list;
52#endif 53#endif
@@ -88,18 +89,12 @@ struct blkg_policy_data {
88 * Policies that need to keep per-blkcg data which is independent 89 * Policies that need to keep per-blkcg data which is independent
89 * from any request_queue associated to it must specify its size 90 * from any request_queue associated to it must specify its size
90 * with the cpd_size field of the blkcg_policy structure and 91 * with the cpd_size field of the blkcg_policy structure and
91 * embed a blkcg_policy_data in it. blkcg core allocates 92 * embed a blkcg_policy_data in it. cpd_init() is invoked to let
92 * policy-specific per-blkcg structures lazily the first time 93 * each policy handle per-blkcg data.
93 * they are actually needed, so it handles them together with
94 * blkgs. cpd_init() is invoked to let each policy handle
95 * per-blkcg data.
96 */ 94 */
97struct blkcg_policy_data { 95struct blkcg_policy_data {
98 /* the policy id this per-policy data belongs to */ 96 /* the policy id this per-policy data belongs to */
99 int plid; 97 int plid;
100
101 /* used during policy activation */
102 struct list_head alloc_node;
103}; 98};
104 99
105/* association between a blk cgroup and a request queue */ 100/* association between a blk cgroup and a request queue */
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index b6a52a4b457a..51bb6532785c 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -27,10 +27,12 @@
27/** 27/**
28 * struct can_skb_priv - private additional data inside CAN sk_buffs 28 * struct can_skb_priv - private additional data inside CAN sk_buffs
29 * @ifindex: ifindex of the first interface the CAN frame appeared on 29 * @ifindex: ifindex of the first interface the CAN frame appeared on
30 * @skbcnt: atomic counter to have an unique id together with skb pointer
30 * @cf: align to the following CAN frame at skb->data 31 * @cf: align to the following CAN frame at skb->data
31 */ 32 */
32struct can_skb_priv { 33struct can_skb_priv {
33 int ifindex; 34 int ifindex;
35 int skbcnt;
34 struct can_frame cf[0]; 36 struct can_frame cf[0];
35}; 37};
36 38
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
index a240b18e86fa..08bffcc466de 100644
--- a/include/linux/clkdev.h
+++ b/include/linux/clkdev.h
@@ -33,18 +33,19 @@ struct clk_lookup {
33 } 33 }
34 34
35struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, 35struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
36 const char *dev_fmt, ...); 36 const char *dev_fmt, ...) __printf(3, 4);
37 37
38void clkdev_add(struct clk_lookup *cl); 38void clkdev_add(struct clk_lookup *cl);
39void clkdev_drop(struct clk_lookup *cl); 39void clkdev_drop(struct clk_lookup *cl);
40 40
41struct clk_lookup *clkdev_create(struct clk *clk, const char *con_id, 41struct clk_lookup *clkdev_create(struct clk *clk, const char *con_id,
42 const char *dev_fmt, ...); 42 const char *dev_fmt, ...) __printf(3, 4);
43 43
44void clkdev_add_table(struct clk_lookup *, size_t); 44void clkdev_add_table(struct clk_lookup *, size_t);
45int clk_add_alias(const char *, const char *, const char *, struct device *); 45int clk_add_alias(const char *, const char *, const char *, struct device *);
46 46
47int clk_register_clkdev(struct clk *, const char *, const char *, ...); 47int clk_register_clkdev(struct clk *, const char *, const char *, ...)
48 __printf(3, 4);
48int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t); 49int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t);
49 50
50#ifdef CONFIG_COMMON_CLK 51#ifdef CONFIG_COMMON_CLK
diff --git a/include/linux/compat.h b/include/linux/compat.h
index ab25814690bc..a76c9172b2eb 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -424,7 +424,7 @@ asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
424 424
425asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); 425asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp);
426 426
427extern int compat_printk(const char *fmt, ...); 427extern __printf(1, 2) int compat_printk(const char *fmt, ...);
428extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat); 428extern void sigset_from_compat(sigset_t *set, const compat_sigset_t *compat);
429extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set); 429extern void sigset_to_compat(compat_sigset_t *compat, const sigset_t *set);
430 430
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index c9e5c57e4edf..63a36e89d0eb 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -64,7 +64,8 @@ struct config_item {
64 struct dentry *ci_dentry; 64 struct dentry *ci_dentry;
65}; 65};
66 66
67extern int config_item_set_name(struct config_item *, const char *, ...); 67extern __printf(2, 3)
68int config_item_set_name(struct config_item *, const char *, ...);
68 69
69static inline char *config_item_name(struct config_item * item) 70static inline char *config_item_name(struct config_item * item)
70{ 71{
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index c0fb6b1b4712..23c30bdcca86 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -40,9 +40,10 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);
40extern int cpu_add_dev_attr_group(struct attribute_group *attrs); 40extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
41extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); 41extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
42 42
43extern struct device *cpu_device_create(struct device *parent, void *drvdata, 43extern __printf(4, 5)
44 const struct attribute_group **groups, 44struct device *cpu_device_create(struct device *parent, void *drvdata,
45 const char *fmt, ...); 45 const struct attribute_group **groups,
46 const char *fmt, ...);
46#ifdef CONFIG_HOTPLUG_CPU 47#ifdef CONFIG_HOTPLUG_CPU
47extern void unregister_cpu(struct cpu *cpu); 48extern void unregister_cpu(struct cpu *cpu);
48extern ssize_t arch_cpu_probe(const char *, size_t); 49extern ssize_t arch_cpu_probe(const char *, size_t);
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d2d50249b7b2..d67ae119cf4e 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -327,7 +327,8 @@ static inline unsigned d_count(const struct dentry *dentry)
327/* 327/*
328 * helper function for dentry_operations.d_dname() members 328 * helper function for dentry_operations.d_dname() members
329 */ 329 */
330extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 330extern __printf(4, 5)
331char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
331extern char *simple_dname(struct dentry *, char *, int); 332extern char *simple_dname(struct dentry *, char *, int);
332 333
333extern char *__d_path(const struct path *, const struct path *, char *, int); 334extern char *__d_path(const struct path *, const struct path *, char *, int);
diff --git a/include/linux/device.h b/include/linux/device.h
index 5a31bf3a4024..a2b4ea70a946 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -637,8 +637,9 @@ extern int devres_release_group(struct device *dev, void *id);
637 637
638/* managed devm_k.alloc/kfree for device drivers */ 638/* managed devm_k.alloc/kfree for device drivers */
639extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp); 639extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
640extern char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 640extern __printf(3, 0)
641 va_list ap); 641char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt,
642 va_list ap);
642extern __printf(3, 4) 643extern __printf(3, 4)
643char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...); 644char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...);
644static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp) 645static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
@@ -1011,12 +1012,10 @@ extern int __must_check device_reprobe(struct device *dev);
1011/* 1012/*
1012 * Easy functions for dynamically creating devices on the fly 1013 * Easy functions for dynamically creating devices on the fly
1013 */ 1014 */
1014extern struct device *device_create_vargs(struct class *cls, 1015extern __printf(5, 0)
1015 struct device *parent, 1016struct device *device_create_vargs(struct class *cls, struct device *parent,
1016 dev_t devt, 1017 dev_t devt, void *drvdata,
1017 void *drvdata, 1018 const char *fmt, va_list vargs);
1018 const char *fmt,
1019 va_list vargs);
1020extern __printf(5, 6) 1019extern __printf(5, 6)
1021struct device *device_create(struct class *cls, struct device *parent, 1020struct device *device_create(struct class *cls, struct device *parent,
1022 dev_t devt, void *drvdata, 1021 dev_t devt, void *drvdata,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a0653e560c26..cc008c338f5a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1046,12 +1046,12 @@ extern void locks_remove_file(struct file *);
1046extern void locks_release_private(struct file_lock *); 1046extern void locks_release_private(struct file_lock *);
1047extern void posix_test_lock(struct file *, struct file_lock *); 1047extern void posix_test_lock(struct file *, struct file_lock *);
1048extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 1048extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
1049extern int posix_lock_file_wait(struct file *, struct file_lock *); 1049extern int posix_lock_inode_wait(struct inode *, struct file_lock *);
1050extern int posix_unblock_lock(struct file_lock *); 1050extern int posix_unblock_lock(struct file_lock *);
1051extern int vfs_test_lock(struct file *, struct file_lock *); 1051extern int vfs_test_lock(struct file *, struct file_lock *);
1052extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *); 1052extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
1053extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); 1053extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
1054extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); 1054extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
1055extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type); 1055extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
1056extern void lease_get_mtime(struct inode *, struct timespec *time); 1056extern void lease_get_mtime(struct inode *, struct timespec *time);
1057extern int generic_setlease(struct file *, long, struct file_lock **, void **priv); 1057extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
@@ -1137,7 +1137,8 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
1137 return -ENOLCK; 1137 return -ENOLCK;
1138} 1138}
1139 1139
1140static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl) 1140static inline int posix_lock_inode_wait(struct inode *inode,
1141 struct file_lock *fl)
1141{ 1142{
1142 return -ENOLCK; 1143 return -ENOLCK;
1143} 1144}
@@ -1163,8 +1164,8 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
1163 return 0; 1164 return 0;
1164} 1165}
1165 1166
1166static inline int flock_lock_file_wait(struct file *filp, 1167static inline int flock_lock_inode_wait(struct inode *inode,
1167 struct file_lock *request) 1168 struct file_lock *request)
1168{ 1169{
1169 return -ENOLCK; 1170 return -ENOLCK;
1170} 1171}
@@ -1202,6 +1203,20 @@ static inline void show_fd_locks(struct seq_file *f,
1202 struct file *filp, struct files_struct *files) {} 1203 struct file *filp, struct files_struct *files) {}
1203#endif /* !CONFIG_FILE_LOCKING */ 1204#endif /* !CONFIG_FILE_LOCKING */
1204 1205
1206static inline struct inode *file_inode(const struct file *f)
1207{
1208 return f->f_inode;
1209}
1210
1211static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
1212{
1213 return posix_lock_inode_wait(file_inode(filp), fl);
1214}
1215
1216static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
1217{
1218 return flock_lock_inode_wait(file_inode(filp), fl);
1219}
1205 1220
1206struct fasync_struct { 1221struct fasync_struct {
1207 spinlock_t fa_lock; 1222 spinlock_t fa_lock;
@@ -2011,11 +2026,6 @@ extern void ihold(struct inode * inode);
2011extern void iput(struct inode *); 2026extern void iput(struct inode *);
2012extern int generic_update_time(struct inode *, struct timespec *, int); 2027extern int generic_update_time(struct inode *, struct timespec *, int);
2013 2028
2014static inline struct inode *file_inode(const struct file *f)
2015{
2016 return f->f_inode;
2017}
2018
2019/* /sys/fs */ 2029/* /sys/fs */
2020extern struct kobject *fs_kobj; 2030extern struct kobject *fs_kobj;
2021 2031
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index cc7ec129b329..c8393cd4d44f 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -45,7 +45,7 @@ struct seq_file;
45 * @base: identifies the first GPIO number handled by this chip; 45 * @base: identifies the first GPIO number handled by this chip;
46 * or, if negative during registration, requests dynamic ID allocation. 46 * or, if negative during registration, requests dynamic ID allocation.
47 * DEPRECATION: providing anything non-negative and nailing the base 47 * DEPRECATION: providing anything non-negative and nailing the base
48 * base offset of GPIO chips is deprecated. Please pass -1 as base to 48 * offset of GPIO chips is deprecated. Please pass -1 as base to
49 * let gpiolib select the chip base in all possible cases. We want to 49 * let gpiolib select the chip base in all possible cases. We want to
50 * get rid of the static GPIO number space in the long run. 50 * get rid of the static GPIO number space in the long run.
51 * @ngpio: the number of GPIOs handled by this controller; the last GPIO 51 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 0042bf330b99..c02b5ce6c5cd 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -230,6 +230,7 @@ struct hid_sensor_common {
230 struct platform_device *pdev; 230 struct platform_device *pdev;
231 unsigned usage_id; 231 unsigned usage_id;
232 atomic_t data_ready; 232 atomic_t data_ready;
233 atomic_t user_requested_state;
233 struct iio_trigger *trigger; 234 struct iio_trigger *trigger;
234 struct hid_sensor_hub_attribute_info poll; 235 struct hid_sensor_hub_attribute_info poll;
235 struct hid_sensor_hub_attribute_info report_state; 236 struct hid_sensor_hub_attribute_info report_state;
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 205026175c42..d891f949466a 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -460,15 +460,14 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
460 return &mm->page_table_lock; 460 return &mm->page_table_lock;
461} 461}
462 462
463static inline bool hugepages_supported(void) 463#ifndef hugepages_supported
464{ 464/*
465 /* 465 * Some platform decide whether they support huge pages at boot
466 * Some platform decide whether they support huge pages at boot 466 * time. Some of them, such as powerpc, set HPAGE_SHIFT to 0
467 * time. On these, such as powerpc, HPAGE_SHIFT is set to 0 when 467 * when there is no such support
468 * there is no such support 468 */
469 */ 469#define hugepages_supported() (HPAGE_SHIFT != 0)
470 return HPAGE_SHIFT != 0; 470#endif
471}
472 471
473#else /* CONFIG_HUGETLB_PAGE */ 472#else /* CONFIG_HUGETLB_PAGE */
474struct hstate {}; 473struct hstate {};
diff --git a/include/linux/init.h b/include/linux/init.h
index 7c68c36d3fd8..b449f378f995 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -282,68 +282,8 @@ void __init parse_early_param(void);
282void __init parse_early_options(char *cmdline); 282void __init parse_early_options(char *cmdline);
283#endif /* __ASSEMBLY__ */ 283#endif /* __ASSEMBLY__ */
284 284
285/**
286 * module_init() - driver initialization entry point
287 * @x: function to be run at kernel boot time or module insertion
288 *
289 * module_init() will either be called during do_initcalls() (if
290 * builtin) or at module insertion time (if a module). There can only
291 * be one per module.
292 */
293#define module_init(x) __initcall(x);
294
295/**
296 * module_exit() - driver exit entry point
297 * @x: function to be run when driver is removed
298 *
299 * module_exit() will wrap the driver clean-up code
300 * with cleanup_module() when used with rmmod when
301 * the driver is a module. If the driver is statically
302 * compiled into the kernel, module_exit() has no effect.
303 * There can only be one per module.
304 */
305#define module_exit(x) __exitcall(x);
306
307#else /* MODULE */ 285#else /* MODULE */
308 286
309/*
310 * In most cases loadable modules do not need custom
311 * initcall levels. There are still some valid cases where
312 * a driver may be needed early if built in, and does not
313 * matter when built as a loadable module. Like bus
314 * snooping debug drivers.
315 */
316#define early_initcall(fn) module_init(fn)
317#define core_initcall(fn) module_init(fn)
318#define core_initcall_sync(fn) module_init(fn)
319#define postcore_initcall(fn) module_init(fn)
320#define postcore_initcall_sync(fn) module_init(fn)
321#define arch_initcall(fn) module_init(fn)
322#define subsys_initcall(fn) module_init(fn)
323#define subsys_initcall_sync(fn) module_init(fn)
324#define fs_initcall(fn) module_init(fn)
325#define fs_initcall_sync(fn) module_init(fn)
326#define rootfs_initcall(fn) module_init(fn)
327#define device_initcall(fn) module_init(fn)
328#define device_initcall_sync(fn) module_init(fn)
329#define late_initcall(fn) module_init(fn)
330#define late_initcall_sync(fn) module_init(fn)
331
332#define console_initcall(fn) module_init(fn)
333#define security_initcall(fn) module_init(fn)
334
335/* Each module must use one module_init(). */
336#define module_init(initfn) \
337 static inline initcall_t __inittest(void) \
338 { return initfn; } \
339 int init_module(void) __attribute__((alias(#initfn)));
340
341/* This is only required if you want to be unloadable. */
342#define module_exit(exitfn) \
343 static inline exitcall_t __exittest(void) \
344 { return exitfn; } \
345 void cleanup_module(void) __attribute__((alias(#exitfn)));
346
347#define __setup_param(str, unique_id, fn) /* nothing */ 287#define __setup_param(str, unique_id, fn) /* nothing */
348#define __setup(str, func) /* nothing */ 288#define __setup(str, func) /* nothing */
349#endif 289#endif
@@ -351,24 +291,6 @@ void __init parse_early_options(char *cmdline);
351/* Data marked not to be saved by software suspend */ 291/* Data marked not to be saved by software suspend */
352#define __nosavedata __section(.data..nosave) 292#define __nosavedata __section(.data..nosave)
353 293
354/* This means "can be init if no module support, otherwise module load
355 may call it." */
356#ifdef CONFIG_MODULES
357#define __init_or_module
358#define __initdata_or_module
359#define __initconst_or_module
360#define __INIT_OR_MODULE .text
361#define __INITDATA_OR_MODULE .data
362#define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
363#else
364#define __init_or_module __init
365#define __initdata_or_module __initdata
366#define __initconst_or_module __initconst
367#define __INIT_OR_MODULE __INIT
368#define __INITDATA_OR_MODULE __INITDATA
369#define __INITRODATA_OR_MODULE __INITRODATA
370#endif /*CONFIG_MODULES*/
371
372#ifdef MODULE 294#ifdef MODULE
373#define __exit_p(x) x 295#define __exit_p(x) x
374#else 296#else
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index dc767f7c3704..f9c1b6d0f2e4 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -258,7 +258,7 @@ extern int iommu_domain_set_attr(struct iommu_domain *domain, enum iommu_attr,
258 void *data); 258 void *data);
259struct device *iommu_device_create(struct device *parent, void *drvdata, 259struct device *iommu_device_create(struct device *parent, void *drvdata,
260 const struct attribute_group **groups, 260 const struct attribute_group **groups,
261 const char *fmt, ...); 261 const char *fmt, ...) __printf(4, 5);
262void iommu_device_destroy(struct device *dev); 262void iommu_device_destroy(struct device *dev);
263int iommu_device_link(struct device *dev, struct device *link); 263int iommu_device_link(struct device *dev, struct device *link);
264void iommu_device_unlink(struct device *dev, struct device *link); 264void iommu_device_unlink(struct device *dev, struct device *link);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5f0be58640ea..5582410727cb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -411,7 +411,8 @@ extern __printf(3, 0)
411int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); 411int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
412extern __printf(2, 3) 412extern __printf(2, 3)
413char *kasprintf(gfp_t gfp, const char *fmt, ...); 413char *kasprintf(gfp_t gfp, const char *fmt, ...);
414extern char *kvasprintf(gfp_t gfp, const char *fmt, va_list args); 414extern __printf(2, 0)
415char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
415 416
416extern __scanf(2, 3) 417extern __scanf(2, 3)
417int sscanf(const char *, const char *, ...); 418int sscanf(const char *, const char *, ...);
@@ -679,10 +680,10 @@ do { \
679 __ftrace_vprintk(_THIS_IP_, fmt, vargs); \ 680 __ftrace_vprintk(_THIS_IP_, fmt, vargs); \
680} while (0) 681} while (0)
681 682
682extern int 683extern __printf(2, 0) int
683__ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap); 684__ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);
684 685
685extern int 686extern __printf(2, 0) int
686__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); 687__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
687 688
688extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode); 689extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
@@ -702,7 +703,7 @@ int trace_printk(const char *fmt, ...)
702{ 703{
703 return 0; 704 return 0;
704} 705}
705static inline int 706static __printf(1, 0) inline int
706ftrace_vprintk(const char *fmt, va_list ap) 707ftrace_vprintk(const char *fmt, va_list ap)
707{ 708{
708 return 0; 709 return 0;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 2d61b909f414..637f67002c5a 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -80,8 +80,9 @@ struct kobject {
80 80
81extern __printf(2, 3) 81extern __printf(2, 3)
82int kobject_set_name(struct kobject *kobj, const char *name, ...); 82int kobject_set_name(struct kobject *kobj, const char *name, ...);
83extern int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, 83extern __printf(2, 0)
84 va_list vargs); 84int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
85 va_list vargs);
85 86
86static inline const char *kobject_name(const struct kobject *kobj) 87static inline const char *kobject_name(const struct kobject *kobj)
87{ 88{
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 9564fd78c547..05e99b8ef465 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -734,6 +734,24 @@ static inline bool kvm_arch_has_noncoherent_dma(struct kvm *kvm)
734 return false; 734 return false;
735} 735}
736#endif 736#endif
737#ifdef __KVM_HAVE_ARCH_ASSIGNED_DEVICE
738void kvm_arch_start_assignment(struct kvm *kvm);
739void kvm_arch_end_assignment(struct kvm *kvm);
740bool kvm_arch_has_assigned_device(struct kvm *kvm);
741#else
742static inline void kvm_arch_start_assignment(struct kvm *kvm)
743{
744}
745
746static inline void kvm_arch_end_assignment(struct kvm *kvm)
747{
748}
749
750static inline bool kvm_arch_has_assigned_device(struct kvm *kvm)
751{
752 return false;
753}
754#endif
737 755
738static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu) 756static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
739{ 757{
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
index c5d52780d6a0..3ba327af055c 100644
--- a/include/linux/mmiotrace.h
+++ b/include/linux/mmiotrace.h
@@ -106,6 +106,6 @@ extern void enable_mmiotrace(void);
106extern void disable_mmiotrace(void); 106extern void disable_mmiotrace(void);
107extern void mmio_trace_rw(struct mmiotrace_rw *rw); 107extern void mmio_trace_rw(struct mmiotrace_rw *rw);
108extern void mmio_trace_mapping(struct mmiotrace_map *map); 108extern void mmio_trace_mapping(struct mmiotrace_map *map);
109extern int mmio_trace_printk(const char *fmt, va_list args); 109extern __printf(1, 0) int mmio_trace_printk(const char *fmt, va_list args);
110 110
111#endif /* _LINUX_MMIOTRACE_H */ 111#endif /* _LINUX_MMIOTRACE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index d67b1932cc59..3a19c79918e0 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -11,6 +11,7 @@
11#include <linux/compiler.h> 11#include <linux/compiler.h>
12#include <linux/cache.h> 12#include <linux/cache.h>
13#include <linux/kmod.h> 13#include <linux/kmod.h>
14#include <linux/init.h>
14#include <linux/elf.h> 15#include <linux/elf.h>
15#include <linux/stringify.h> 16#include <linux/stringify.h>
16#include <linux/kobject.h> 17#include <linux/kobject.h>
@@ -71,6 +72,89 @@ extern struct module_attribute module_uevent;
71extern int init_module(void); 72extern int init_module(void);
72extern void cleanup_module(void); 73extern void cleanup_module(void);
73 74
75#ifndef MODULE
76/**
77 * module_init() - driver initialization entry point
78 * @x: function to be run at kernel boot time or module insertion
79 *
80 * module_init() will either be called during do_initcalls() (if
81 * builtin) or at module insertion time (if a module). There can only
82 * be one per module.
83 */
84#define module_init(x) __initcall(x);
85
86/**
87 * module_exit() - driver exit entry point
88 * @x: function to be run when driver is removed
89 *
90 * module_exit() will wrap the driver clean-up code
91 * with cleanup_module() when used with rmmod when
92 * the driver is a module. If the driver is statically
93 * compiled into the kernel, module_exit() has no effect.
94 * There can only be one per module.
95 */
96#define module_exit(x) __exitcall(x);
97
98#else /* MODULE */
99
100/*
101 * In most cases loadable modules do not need custom
102 * initcall levels. There are still some valid cases where
103 * a driver may be needed early if built in, and does not
104 * matter when built as a loadable module. Like bus
105 * snooping debug drivers.
106 */
107#define early_initcall(fn) module_init(fn)
108#define core_initcall(fn) module_init(fn)
109#define core_initcall_sync(fn) module_init(fn)
110#define postcore_initcall(fn) module_init(fn)
111#define postcore_initcall_sync(fn) module_init(fn)
112#define arch_initcall(fn) module_init(fn)
113#define subsys_initcall(fn) module_init(fn)
114#define subsys_initcall_sync(fn) module_init(fn)
115#define fs_initcall(fn) module_init(fn)
116#define fs_initcall_sync(fn) module_init(fn)
117#define rootfs_initcall(fn) module_init(fn)
118#define device_initcall(fn) module_init(fn)
119#define device_initcall_sync(fn) module_init(fn)
120#define late_initcall(fn) module_init(fn)
121#define late_initcall_sync(fn) module_init(fn)
122
123#define console_initcall(fn) module_init(fn)
124#define security_initcall(fn) module_init(fn)
125
126/* Each module must use one module_init(). */
127#define module_init(initfn) \
128 static inline initcall_t __inittest(void) \
129 { return initfn; } \
130 int init_module(void) __attribute__((alias(#initfn)));
131
132/* This is only required if you want to be unloadable. */
133#define module_exit(exitfn) \
134 static inline exitcall_t __exittest(void) \
135 { return exitfn; } \
136 void cleanup_module(void) __attribute__((alias(#exitfn)));
137
138#endif
139
140/* This means "can be init if no module support, otherwise module load
141 may call it." */
142#ifdef CONFIG_MODULES
143#define __init_or_module
144#define __initdata_or_module
145#define __initconst_or_module
146#define __INIT_OR_MODULE .text
147#define __INITDATA_OR_MODULE .data
148#define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
149#else
150#define __init_or_module __init
151#define __initdata_or_module __initdata
152#define __initconst_or_module __initconst
153#define __INIT_OR_MODULE __INIT
154#define __INITDATA_OR_MODULE __INITDATA
155#define __INITRODATA_OR_MODULE __INITRODATA
156#endif /*CONFIG_MODULES*/
157
74/* Archs provide a method of finding the correct exception table. */ 158/* Archs provide a method of finding the correct exception table. */
75struct exception_table_entry; 159struct exception_table_entry;
76 160
diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h
index b48c3471c254..cacaabea8a09 100644
--- a/include/linux/page_owner.h
+++ b/include/linux/page_owner.h
@@ -8,6 +8,7 @@ extern struct page_ext_operations page_owner_ops;
8extern void __reset_page_owner(struct page *page, unsigned int order); 8extern void __reset_page_owner(struct page *page, unsigned int order);
9extern void __set_page_owner(struct page *page, 9extern void __set_page_owner(struct page *page,
10 unsigned int order, gfp_t gfp_mask); 10 unsigned int order, gfp_t gfp_mask);
11extern gfp_t __get_page_owner_gfp(struct page *page);
11 12
12static inline void reset_page_owner(struct page *page, unsigned int order) 13static inline void reset_page_owner(struct page *page, unsigned int order)
13{ 14{
@@ -25,6 +26,14 @@ static inline void set_page_owner(struct page *page,
25 26
26 __set_page_owner(page, order, gfp_mask); 27 __set_page_owner(page, order, gfp_mask);
27} 28}
29
30static inline gfp_t get_page_owner_gfp(struct page *page)
31{
32 if (likely(!page_owner_inited))
33 return 0;
34
35 return __get_page_owner_gfp(page);
36}
28#else 37#else
29static inline void reset_page_owner(struct page *page, unsigned int order) 38static inline void reset_page_owner(struct page *page, unsigned int order)
30{ 39{
@@ -33,6 +42,10 @@ static inline void set_page_owner(struct page *page,
33 unsigned int order, gfp_t gfp_mask) 42 unsigned int order, gfp_t gfp_mask)
34{ 43{
35} 44}
45static inline gfp_t get_page_owner_gfp(struct page *page)
46{
47 return 0;
48}
36 49
37#endif /* CONFIG_PAGE_OWNER */ 50#endif /* CONFIG_PAGE_OWNER */
38#endif /* __LINUX_PAGE_OWNER_H */ 51#endif /* __LINUX_PAGE_OWNER_H */
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h
index 3cc21c9cc1e8..9fade5dd2e86 100644
--- a/include/linux/pata_arasan_cf_data.h
+++ b/include/linux/pata_arasan_cf_data.h
@@ -4,7 +4,7 @@
4 * Arasan Compact Flash host controller platform data header file 4 * Arasan Compact Flash host controller platform data header file
5 * 5 *
6 * Copyright (C) 2011 ST Microelectronics 6 * Copyright (C) 2011 ST Microelectronics
7 * Viresh Kumar <viresh.linux@gmail.com> 7 * Viresh Kumar <vireshk@kernel.org>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 58b1fec40d37..a6298b27ac99 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -122,7 +122,7 @@ static inline __printf(1, 2) __cold
122void early_printk(const char *s, ...) { } 122void early_printk(const char *s, ...) { }
123#endif 123#endif
124 124
125typedef int(*printk_func_t)(const char *fmt, va_list args); 125typedef __printf(1, 0) int (*printk_func_t)(const char *fmt, va_list args);
126 126
127#ifdef CONFIG_PRINTK 127#ifdef CONFIG_PRINTK
128asmlinkage __printf(5, 0) 128asmlinkage __printf(5, 0)
@@ -166,7 +166,7 @@ char *log_buf_addr_get(void);
166u32 log_buf_len_get(void); 166u32 log_buf_len_get(void);
167void log_buf_kexec_setup(void); 167void log_buf_kexec_setup(void);
168void __init setup_log_buf(int early); 168void __init setup_log_buf(int early);
169void dump_stack_set_arch_desc(const char *fmt, ...); 169__printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...);
170void dump_stack_print_info(const char *log_lvl); 170void dump_stack_print_info(const char *log_lvl);
171void show_regs_print_info(const char *log_lvl); 171void show_regs_print_info(const char *log_lvl);
172#else 172#else
@@ -217,7 +217,7 @@ static inline void setup_log_buf(int early)
217{ 217{
218} 218}
219 219
220static inline void dump_stack_set_arch_desc(const char *fmt, ...) 220static inline __printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...)
221{ 221{
222} 222}
223 223
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ae21f1591615..04b5ada460b4 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1522,8 +1522,6 @@ struct task_struct {
1522/* hung task detection */ 1522/* hung task detection */
1523 unsigned long last_switch_count; 1523 unsigned long last_switch_count;
1524#endif 1524#endif
1525/* CPU-specific state of this task */
1526 struct thread_struct thread;
1527/* filesystem information */ 1525/* filesystem information */
1528 struct fs_struct *fs; 1526 struct fs_struct *fs;
1529/* open file information */ 1527/* open file information */
@@ -1778,8 +1776,22 @@ struct task_struct {
1778 unsigned long task_state_change; 1776 unsigned long task_state_change;
1779#endif 1777#endif
1780 int pagefault_disabled; 1778 int pagefault_disabled;
1779/* CPU-specific state of this task */
1780 struct thread_struct thread;
1781/*
1782 * WARNING: on x86, 'thread_struct' contains a variable-sized
1783 * structure. It *MUST* be at the end of 'task_struct'.
1784 *
1785 * Do not put anything below here!
1786 */
1781}; 1787};
1782 1788
1789#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
1790extern int arch_task_struct_size __read_mostly;
1791#else
1792# define arch_task_struct_size (sizeof(struct task_struct))
1793#endif
1794
1783/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1795/* Future-safe accessor for struct task_struct's cpus_allowed. */
1784#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) 1796#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1785 1797
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 7c9b484735c5..1f6526c76ee8 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -80,6 +80,9 @@
80#define CDC_NCM_TIMER_INTERVAL_MIN 5UL 80#define CDC_NCM_TIMER_INTERVAL_MIN 5UL
81#define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC) 81#define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC)
82 82
83/* Driver flags */
84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
85
83#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ 86#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
84 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) 87 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
85#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) 88#define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB)
@@ -103,9 +106,11 @@ struct cdc_ncm_ctx {
103 106
104 spinlock_t mtx; 107 spinlock_t mtx;
105 atomic_t stop; 108 atomic_t stop;
109 int drvflags;
106 110
107 u32 timer_interval; 111 u32 timer_interval;
108 u32 max_ndp_size; 112 u32 max_ndp_size;
113 struct usb_cdc_ncm_ndp16 *delayed_ndp16;
109 114
110 u32 tx_timer_pending; 115 u32 tx_timer_pending;
111 u32 tx_curr_frame_num; 116 u32 tx_curr_frame_num;
@@ -133,7 +138,7 @@ struct cdc_ncm_ctx {
133}; 138};
134 139
135u8 cdc_ncm_select_altsetting(struct usb_interface *intf); 140u8 cdc_ncm_select_altsetting(struct usb_interface *intf);
136int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); 141int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags);
137void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 142void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
138struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); 143struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
139int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); 144int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 986fddb08579..b0f898e3b2e7 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1745,6 +1745,7 @@ struct ib_device {
1745 char node_desc[64]; 1745 char node_desc[64];
1746 __be64 node_guid; 1746 __be64 node_guid;
1747 u32 local_dma_lkey; 1747 u32 local_dma_lkey;
1748 u16 is_switch:1;
1748 u8 node_type; 1749 u8 node_type;
1749 u8 phys_port_cnt; 1750 u8 phys_port_cnt;
1750 1751
@@ -1824,6 +1825,20 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device,
1824 u8 port_num); 1825 u8 port_num);
1825 1826
1826/** 1827/**
1828 * rdma_cap_ib_switch - Check if the device is IB switch
1829 * @device: Device to check
1830 *
1831 * Device driver is responsible for setting is_switch bit on
1832 * in ib_device structure at init time.
1833 *
1834 * Return: true if the device is IB switch.
1835 */
1836static inline bool rdma_cap_ib_switch(const struct ib_device *device)
1837{
1838 return device->is_switch;
1839}
1840
1841/**
1827 * rdma_start_port - Return the first valid port number for the device 1842 * rdma_start_port - Return the first valid port number for the device
1828 * specified 1843 * specified
1829 * 1844 *
@@ -1833,7 +1848,7 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device,
1833 */ 1848 */
1834static inline u8 rdma_start_port(const struct ib_device *device) 1849static inline u8 rdma_start_port(const struct ib_device *device)
1835{ 1850{
1836 return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1; 1851 return rdma_cap_ib_switch(device) ? 0 : 1;
1837} 1852}
1838 1853
1839/** 1854/**
@@ -1846,8 +1861,7 @@ static inline u8 rdma_start_port(const struct ib_device *device)
1846 */ 1861 */
1847static inline u8 rdma_end_port(const struct ib_device *device) 1862static inline u8 rdma_end_port(const struct ib_device *device)
1848{ 1863{
1849 return (device->node_type == RDMA_NODE_IB_SWITCH) ? 1864 return rdma_cap_ib_switch(device) ? 0 : device->phys_port_cnt;
1850 0 : device->phys_port_cnt;
1851} 1865}
1852 1866
1853static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) 1867static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num)
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
index cdb05dd1d440..d40d3ef25707 100644
--- a/include/scsi/scsi_transport_srp.h
+++ b/include/scsi/scsi_transport_srp.h
@@ -119,6 +119,7 @@ extern struct srp_rport *srp_rport_add(struct Scsi_Host *,
119extern void srp_rport_del(struct srp_rport *); 119extern void srp_rport_del(struct srp_rport *);
120extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo, 120extern int srp_tmo_valid(int reconnect_delay, int fast_io_fail_tmo,
121 int dev_loss_tmo); 121 int dev_loss_tmo);
122int srp_parse_tmo(int *tmo, const char *buf);
122extern int srp_reconnect_rport(struct srp_rport *rport); 123extern int srp_reconnect_rport(struct srp_rport *rport);
123extern void srp_start_tl_fail_timers(struct srp_rport *rport); 124extern void srp_start_tl_fail_timers(struct srp_rport *rport);
124extern void srp_remove_host(struct Scsi_Host *); 125extern void srp_remove_host(struct Scsi_Host *);
diff --git a/include/uapi/linux/netconf.h b/include/uapi/linux/netconf.h
index 669a1f0b1d97..23cbd34e4ac7 100644
--- a/include/uapi/linux/netconf.h
+++ b/include/uapi/linux/netconf.h
@@ -15,6 +15,7 @@ enum {
15 NETCONFA_RP_FILTER, 15 NETCONFA_RP_FILTER,
16 NETCONFA_MC_FORWARDING, 16 NETCONFA_MC_FORWARDING,
17 NETCONFA_PROXY_NEIGH, 17 NETCONFA_PROXY_NEIGH,
18 NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
18 __NETCONFA_MAX 19 __NETCONFA_MAX
19}; 20};
20#define NETCONFA_MAX (__NETCONFA_MAX - 1) 21#define NETCONFA_MAX (__NETCONFA_MAX - 1)
diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h
index d550c8d40269..2819fc1f8458 100644
--- a/include/uapi/sound/asoc.h
+++ b/include/uapi/sound/asoc.h
@@ -110,7 +110,7 @@
110 110
111/* 111/*
112 * Block Header. 112 * Block Header.
113 * This header preceeds all object and object arrays below. 113 * This header precedes all object and object arrays below.
114 */ 114 */
115struct snd_soc_tplg_hdr { 115struct snd_soc_tplg_hdr {
116 __le32 magic; /* magic number */ 116 __le32 magic; /* magic number */
@@ -222,7 +222,7 @@ struct snd_soc_tplg_stream_config {
222/* 222/*
223 * Manifest. List totals for each payload type. Not used in parsing, but will 223 * Manifest. List totals for each payload type. Not used in parsing, but will
224 * be passed to the component driver before any other objects in order for any 224 * be passed to the component driver before any other objects in order for any
225 * global componnent resource allocations. 225 * global component resource allocations.
226 * 226 *
227 * File block representation for manifest :- 227 * File block representation for manifest :-
228 * +-----------------------------------+----+ 228 * +-----------------------------------+----+
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 6a374544d495..5644ec5582b9 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -527,18 +527,9 @@ static int _cpu_up(unsigned int cpu, int tasks_frozen)
527 goto out_notify; 527 goto out_notify;
528 } 528 }
529 529
530 /*
531 * Some architectures have to walk the irq descriptors to
532 * setup the vector space for the cpu which comes online.
533 * Prevent irq alloc/free across the bringup.
534 */
535 irq_lock_sparse();
536
537 /* Arch-specific enabling code. */ 530 /* Arch-specific enabling code. */
538 ret = __cpu_up(cpu, idle); 531 ret = __cpu_up(cpu, idle);
539 532
540 irq_unlock_sparse();
541
542 if (ret != 0) 533 if (ret != 0)
543 goto out_notify; 534 goto out_notify;
544 BUG_ON(!cpu_online(cpu)); 535 BUG_ON(!cpu_online(cpu));
diff --git a/kernel/fork.c b/kernel/fork.c
index 1bfefc6f96a4..dbd9b8d7b7cc 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -287,6 +287,11 @@ static void set_max_threads(unsigned int max_threads_suggested)
287 max_threads = clamp_t(u64, threads, MIN_THREADS, MAX_THREADS); 287 max_threads = clamp_t(u64, threads, MIN_THREADS, MAX_THREADS);
288} 288}
289 289
290#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT
291/* Initialized by the architecture: */
292int arch_task_struct_size __read_mostly;
293#endif
294
290void __init fork_init(void) 295void __init fork_init(void)
291{ 296{
292#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR 297#ifndef CONFIG_ARCH_TASK_STRUCT_ALLOCATOR
@@ -295,7 +300,7 @@ void __init fork_init(void)
295#endif 300#endif
296 /* create a slab on which task_structs can be allocated */ 301 /* create a slab on which task_structs can be allocated */
297 task_struct_cachep = 302 task_struct_cachep =
298 kmem_cache_create("task_struct", sizeof(struct task_struct), 303 kmem_cache_create("task_struct", arch_task_struct_size,
299 ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_NOTRACK, NULL); 304 ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_NOTRACK, NULL);
300#endif 305#endif
301 306
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index 9065107f083e..7a5237a1bce5 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -75,13 +75,21 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
75 !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) { 75 !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) {
76#ifdef CONFIG_HARDIRQS_SW_RESEND 76#ifdef CONFIG_HARDIRQS_SW_RESEND
77 /* 77 /*
78 * If the interrupt has a parent irq and runs 78 * If the interrupt is running in the thread
79 * in the thread context of the parent irq, 79 * context of the parent irq we need to be
80 * retrigger the parent. 80 * careful, because we cannot trigger it
81 * directly.
81 */ 82 */
82 if (desc->parent_irq && 83 if (irq_settings_is_nested_thread(desc)) {
83 irq_settings_is_nested_thread(desc)) 84 /*
85 * If the parent_irq is valid, we
86 * retrigger the parent, otherwise we
87 * do nothing.
88 */
89 if (!desc->parent_irq)
90 return;
84 irq = desc->parent_irq; 91 irq = desc->parent_irq;
92 }
85 /* Set it pending and activate the softirq: */ 93 /* Set it pending and activate the softirq: */
86 set_bit(irq, irqs_resend); 94 set_bit(irq, irqs_resend);
87 tasklet_schedule(&resend_tasklet); 95 tasklet_schedule(&resend_tasklet);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 65c8f3ebdc3c..d113c3ba8bc4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3683,7 +3683,7 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq)
3683 cfs_rq->throttled = 1; 3683 cfs_rq->throttled = 1;
3684 cfs_rq->throttled_clock = rq_clock(rq); 3684 cfs_rq->throttled_clock = rq_clock(rq);
3685 raw_spin_lock(&cfs_b->lock); 3685 raw_spin_lock(&cfs_b->lock);
3686 empty = list_empty(&cfs_rq->throttled_list); 3686 empty = list_empty(&cfs_b->throttled_cfs_rq);
3687 3687
3688 /* 3688 /*
3689 * Add to the _head_ of the list, so that an already-started 3689 * Add to the _head_ of the list, so that an already-started
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 52b9e199b5ac..f6aae7977824 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -839,7 +839,6 @@ out:
839 raw_spin_unlock(&tick_broadcast_lock); 839 raw_spin_unlock(&tick_broadcast_lock);
840 return ret; 840 return ret;
841} 841}
842EXPORT_SYMBOL_GPL(tick_broadcast_oneshot_control);
843 842
844/* 843/*
845 * Reset the one shot broadcast for a cpu 844 * Reset the one shot broadcast for a cpu
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 55e13efff1ab..f8bf47571dda 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -363,6 +363,7 @@ int tick_broadcast_oneshot_control(enum tick_broadcast_state state)
363 363
364 return __tick_broadcast_oneshot_control(state); 364 return __tick_broadcast_oneshot_control(state);
365} 365}
366EXPORT_SYMBOL_GPL(tick_broadcast_oneshot_control);
366 367
367#ifdef CONFIG_HOTPLUG_CPU 368#ifdef CONFIG_HOTPLUG_CPU
368/* 369/*
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index f060716b02ae..74bde81601a9 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -444,6 +444,7 @@ enum {
444 444
445 TRACE_CONTROL_BIT, 445 TRACE_CONTROL_BIT,
446 446
447 TRACE_BRANCH_BIT,
447/* 448/*
448 * Abuse of the trace_recursion. 449 * Abuse of the trace_recursion.
449 * As we need a way to maintain state if we are tracing the function 450 * As we need a way to maintain state if we are tracing the function
diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index a87b43f49eb4..e2e12ad3186f 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -36,9 +36,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
36 struct trace_branch *entry; 36 struct trace_branch *entry;
37 struct ring_buffer *buffer; 37 struct ring_buffer *buffer;
38 unsigned long flags; 38 unsigned long flags;
39 int cpu, pc; 39 int pc;
40 const char *p; 40 const char *p;
41 41
42 if (current->trace_recursion & TRACE_BRANCH_BIT)
43 return;
44
42 /* 45 /*
43 * I would love to save just the ftrace_likely_data pointer, but 46 * I would love to save just the ftrace_likely_data pointer, but
44 * this code can also be used by modules. Ugly things can happen 47 * this code can also be used by modules. Ugly things can happen
@@ -49,10 +52,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
49 if (unlikely(!tr)) 52 if (unlikely(!tr))
50 return; 53 return;
51 54
52 local_irq_save(flags); 55 raw_local_irq_save(flags);
53 cpu = raw_smp_processor_id(); 56 current->trace_recursion |= TRACE_BRANCH_BIT;
54 data = per_cpu_ptr(tr->trace_buffer.data, cpu); 57 data = this_cpu_ptr(tr->trace_buffer.data);
55 if (atomic_inc_return(&data->disabled) != 1) 58 if (atomic_read(&data->disabled))
56 goto out; 59 goto out;
57 60
58 pc = preempt_count(); 61 pc = preempt_count();
@@ -81,8 +84,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
81 __buffer_unlock_commit(buffer, event); 84 __buffer_unlock_commit(buffer, event);
82 85
83 out: 86 out:
84 atomic_dec(&data->disabled); 87 current->trace_recursion &= ~TRACE_BRANCH_BIT;
85 local_irq_restore(flags); 88 raw_local_irq_restore(flags);
86} 89}
87 90
88static inline 91static inline
diff --git a/lib/decompress.c b/lib/decompress.c
index 528ff932d8e4..62696dff5730 100644
--- a/lib/decompress.c
+++ b/lib/decompress.c
@@ -59,8 +59,11 @@ decompress_fn __init decompress_method(const unsigned char *inbuf, long len,
59{ 59{
60 const struct compress_format *cf; 60 const struct compress_format *cf;
61 61
62 if (len < 2) 62 if (len < 2) {
63 if (name)
64 *name = NULL;
63 return NULL; /* Need at least this much... */ 65 return NULL; /* Need at least this much... */
66 }
64 67
65 pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); 68 pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]);
66 69
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index ae4b65e17e64..dace71fe41f7 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -574,6 +574,9 @@ void debug_dma_assert_idle(struct page *page)
574 unsigned long flags; 574 unsigned long flags;
575 phys_addr_t cln; 575 phys_addr_t cln;
576 576
577 if (dma_debug_disabled())
578 return;
579
577 if (!page) 580 if (!page)
578 return; 581 return;
579 582
diff --git a/lib/hexdump.c b/lib/hexdump.c
index 7ea09699855d..8d74c20d8595 100644
--- a/lib/hexdump.c
+++ b/lib/hexdump.c
@@ -11,6 +11,7 @@
11#include <linux/ctype.h> 11#include <linux/ctype.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/export.h> 13#include <linux/export.h>
14#include <asm/unaligned.h>
14 15
15const char hex_asc[] = "0123456789abcdef"; 16const char hex_asc[] = "0123456789abcdef";
16EXPORT_SYMBOL(hex_asc); 17EXPORT_SYMBOL(hex_asc);
@@ -139,7 +140,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
139 for (j = 0; j < ngroups; j++) { 140 for (j = 0; j < ngroups; j++) {
140 ret = snprintf(linebuf + lx, linebuflen - lx, 141 ret = snprintf(linebuf + lx, linebuflen - lx,
141 "%s%16.16llx", j ? " " : "", 142 "%s%16.16llx", j ? " " : "",
142 (unsigned long long)*(ptr8 + j)); 143 get_unaligned(ptr8 + j));
143 if (ret >= linebuflen - lx) 144 if (ret >= linebuflen - lx)
144 goto overflow1; 145 goto overflow1;
145 lx += ret; 146 lx += ret;
@@ -150,7 +151,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
150 for (j = 0; j < ngroups; j++) { 151 for (j = 0; j < ngroups; j++) {
151 ret = snprintf(linebuf + lx, linebuflen - lx, 152 ret = snprintf(linebuf + lx, linebuflen - lx,
152 "%s%8.8x", j ? " " : "", 153 "%s%8.8x", j ? " " : "",
153 *(ptr4 + j)); 154 get_unaligned(ptr4 + j));
154 if (ret >= linebuflen - lx) 155 if (ret >= linebuflen - lx)
155 goto overflow1; 156 goto overflow1;
156 lx += ret; 157 lx += ret;
@@ -161,7 +162,7 @@ int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, int groupsize,
161 for (j = 0; j < ngroups; j++) { 162 for (j = 0; j < ngroups; j++) {
162 ret = snprintf(linebuf + lx, linebuflen - lx, 163 ret = snprintf(linebuf + lx, linebuflen - lx,
163 "%s%4.4x", j ? " " : "", 164 "%s%4.4x", j ? " " : "",
164 *(ptr2 + j)); 165 get_unaligned(ptr2 + j));
165 if (ret >= linebuflen - lx) 166 if (ret >= linebuflen - lx)
166 goto overflow1; 167 goto overflow1;
167 lx += ret; 168 lx += ret;
diff --git a/lib/kobject.c b/lib/kobject.c
index 2e3bd01964a9..3e3a5c3cb330 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -337,8 +337,9 @@ error:
337} 337}
338EXPORT_SYMBOL(kobject_init); 338EXPORT_SYMBOL(kobject_init);
339 339
340static int kobject_add_varg(struct kobject *kobj, struct kobject *parent, 340static __printf(3, 0) int kobject_add_varg(struct kobject *kobj,
341 const char *fmt, va_list vargs) 341 struct kobject *parent,
342 const char *fmt, va_list vargs)
342{ 343{
343 int retval; 344 int retval;
344 345
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index a60a6d335a91..cc0c69710dcf 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -610,6 +610,8 @@ next:
610 iter->skip = 0; 610 iter->skip = 0;
611 } 611 }
612 612
613 iter->p = NULL;
614
613 /* Ensure we see any new tables. */ 615 /* Ensure we see any new tables. */
614 smp_rmb(); 616 smp_rmb();
615 617
@@ -620,8 +622,6 @@ next:
620 return ERR_PTR(-EAGAIN); 622 return ERR_PTR(-EAGAIN);
621 } 623 }
622 624
623 iter->p = NULL;
624
625 return NULL; 625 return NULL;
626} 626}
627EXPORT_SYMBOL_GPL(rhashtable_walk_next); 627EXPORT_SYMBOL_GPL(rhashtable_walk_next);
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 7621ee34daa0..f8e4b60db167 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -39,7 +39,7 @@ static int cma_used_get(void *data, u64 *val)
39 39
40 mutex_lock(&cma->lock); 40 mutex_lock(&cma->lock);
41 /* pages counter is smaller than sizeof(int) */ 41 /* pages counter is smaller than sizeof(int) */
42 used = bitmap_weight(cma->bitmap, (int)cma->count); 42 used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma));
43 mutex_unlock(&cma->lock); 43 mutex_unlock(&cma->lock);
44 *val = (u64)used << cma->order_per_bit; 44 *val = (u64)used << cma->order_per_bit;
45 45
@@ -52,13 +52,14 @@ static int cma_maxchunk_get(void *data, u64 *val)
52 struct cma *cma = data; 52 struct cma *cma = data;
53 unsigned long maxchunk = 0; 53 unsigned long maxchunk = 0;
54 unsigned long start, end = 0; 54 unsigned long start, end = 0;
55 unsigned long bitmap_maxno = cma_bitmap_maxno(cma);
55 56
56 mutex_lock(&cma->lock); 57 mutex_lock(&cma->lock);
57 for (;;) { 58 for (;;) {
58 start = find_next_zero_bit(cma->bitmap, cma->count, end); 59 start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
59 if (start >= cma->count) 60 if (start >= cma->count)
60 break; 61 break;
61 end = find_next_bit(cma->bitmap, cma->count, start); 62 end = find_next_bit(cma->bitmap, bitmap_maxno, start);
62 maxchunk = max(end - start, maxchunk); 63 maxchunk = max(end - start, maxchunk);
63 } 64 }
64 mutex_unlock(&cma->lock); 65 mutex_unlock(&cma->lock);
@@ -170,10 +171,10 @@ static void cma_debugfs_add_one(struct cma *cma, int idx)
170 171
171 tmp = debugfs_create_dir(name, cma_debugfs_root); 172 tmp = debugfs_create_dir(name, cma_debugfs_root);
172 173
173 debugfs_create_file("alloc", S_IWUSR, cma_debugfs_root, cma, 174 debugfs_create_file("alloc", S_IWUSR, tmp, cma,
174 &cma_alloc_fops); 175 &cma_alloc_fops);
175 176
176 debugfs_create_file("free", S_IWUSR, cma_debugfs_root, cma, 177 debugfs_create_file("free", S_IWUSR, tmp, cma,
177 &cma_free_fops); 178 &cma_free_fops);
178 179
179 debugfs_create_file("base_pfn", S_IRUGO, tmp, 180 debugfs_create_file("base_pfn", S_IRUGO, tmp,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 506eac8b38af..ef19f22b2b7d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -246,9 +246,7 @@ static inline void reset_deferred_meminit(pg_data_t *pgdat)
246/* Returns true if the struct page for the pfn is uninitialised */ 246/* Returns true if the struct page for the pfn is uninitialised */
247static inline bool __meminit early_page_uninitialised(unsigned long pfn) 247static inline bool __meminit early_page_uninitialised(unsigned long pfn)
248{ 248{
249 int nid = early_pfn_to_nid(pfn); 249 if (pfn >= NODE_DATA(early_pfn_to_nid(pfn))->first_deferred_pfn)
250
251 if (pfn >= NODE_DATA(nid)->first_deferred_pfn)
252 return true; 250 return true;
253 251
254 return false; 252 return false;
@@ -1950,6 +1948,7 @@ void free_hot_cold_page_list(struct list_head *list, bool cold)
1950void split_page(struct page *page, unsigned int order) 1948void split_page(struct page *page, unsigned int order)
1951{ 1949{
1952 int i; 1950 int i;
1951 gfp_t gfp_mask;
1953 1952
1954 VM_BUG_ON_PAGE(PageCompound(page), page); 1953 VM_BUG_ON_PAGE(PageCompound(page), page);
1955 VM_BUG_ON_PAGE(!page_count(page), page); 1954 VM_BUG_ON_PAGE(!page_count(page), page);
@@ -1963,10 +1962,11 @@ void split_page(struct page *page, unsigned int order)
1963 split_page(virt_to_page(page[0].shadow), order); 1962 split_page(virt_to_page(page[0].shadow), order);
1964#endif 1963#endif
1965 1964
1966 set_page_owner(page, 0, 0); 1965 gfp_mask = get_page_owner_gfp(page);
1966 set_page_owner(page, 0, gfp_mask);
1967 for (i = 1; i < (1 << order); i++) { 1967 for (i = 1; i < (1 << order); i++) {
1968 set_page_refcounted(page + i); 1968 set_page_refcounted(page + i);
1969 set_page_owner(page + i, 0, 0); 1969 set_page_owner(page + i, 0, gfp_mask);
1970 } 1970 }
1971} 1971}
1972EXPORT_SYMBOL_GPL(split_page); 1972EXPORT_SYMBOL_GPL(split_page);
@@ -1996,6 +1996,8 @@ int __isolate_free_page(struct page *page, unsigned int order)
1996 zone->free_area[order].nr_free--; 1996 zone->free_area[order].nr_free--;
1997 rmv_page_order(page); 1997 rmv_page_order(page);
1998 1998
1999 set_page_owner(page, order, __GFP_MOVABLE);
2000
1999 /* Set the pageblock if the isolated page is at least a pageblock */ 2001 /* Set the pageblock if the isolated page is at least a pageblock */
2000 if (order >= pageblock_order - 1) { 2002 if (order >= pageblock_order - 1) {
2001 struct page *endpage = page + (1 << order) - 1; 2003 struct page *endpage = page + (1 << order) - 1;
@@ -2007,7 +2009,7 @@ int __isolate_free_page(struct page *page, unsigned int order)
2007 } 2009 }
2008 } 2010 }
2009 2011
2010 set_page_owner(page, order, 0); 2012
2011 return 1UL << order; 2013 return 1UL << order;
2012} 2014}
2013 2015
diff --git a/mm/page_owner.c b/mm/page_owner.c
index bd5f842b56d2..983c3a10fa07 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -76,6 +76,13 @@ void __set_page_owner(struct page *page, unsigned int order, gfp_t gfp_mask)
76 __set_bit(PAGE_EXT_OWNER, &page_ext->flags); 76 __set_bit(PAGE_EXT_OWNER, &page_ext->flags);
77} 77}
78 78
79gfp_t __get_page_owner_gfp(struct page *page)
80{
81 struct page_ext *page_ext = lookup_page_ext(page);
82
83 return page_ext->gfp_mask;
84}
85
79static ssize_t 86static ssize_t
80print_page_owner(char __user *buf, size_t count, unsigned long pfn, 87print_page_owner(char __user *buf, size_t count, unsigned long pfn,
81 struct page *page, struct page_ext *page_ext) 88 struct page *page, struct page_ext *page_ext)
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index e97572b5d2cc..0ff6e1bbca91 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -42,6 +42,7 @@ int br_dev_queue_push_xmit(struct sock *sk, struct sk_buff *skb)
42 } else { 42 } else {
43 skb_push(skb, ETH_HLEN); 43 skb_push(skb, ETH_HLEN);
44 br_drop_fake_rtable(skb); 44 br_drop_fake_rtable(skb);
45 skb_sender_cpu_clear(skb);
45 dev_queue_xmit(skb); 46 dev_queue_xmit(skb);
46 } 47 }
47 48
diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index e29ad70b3000..c11cf2611db0 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -323,6 +323,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
323 struct net_bridge_port_group *p; 323 struct net_bridge_port_group *p;
324 struct net_bridge_port_group __rcu **pp; 324 struct net_bridge_port_group __rcu **pp;
325 struct net_bridge_mdb_htable *mdb; 325 struct net_bridge_mdb_htable *mdb;
326 unsigned long now = jiffies;
326 int err; 327 int err;
327 328
328 mdb = mlock_dereference(br->mdb, br); 329 mdb = mlock_dereference(br->mdb, br);
@@ -347,6 +348,8 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
347 if (unlikely(!p)) 348 if (unlikely(!p))
348 return -ENOMEM; 349 return -ENOMEM;
349 rcu_assign_pointer(*pp, p); 350 rcu_assign_pointer(*pp, p);
351 if (state == MDB_TEMPORARY)
352 mod_timer(&p->timer, now + br->multicast_membership_interval);
350 353
351 br_mdb_notify(br->dev, port, group, RTM_NEWMDB); 354 br_mdb_notify(br->dev, port, group, RTM_NEWMDB);
352 return 0; 355 return 0;
@@ -371,6 +374,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br,
371 if (!p || p->br != br || p->state == BR_STATE_DISABLED) 374 if (!p || p->br != br || p->state == BR_STATE_DISABLED)
372 return -EINVAL; 375 return -EINVAL;
373 376
377 memset(&ip, 0, sizeof(ip));
374 ip.proto = entry->addr.proto; 378 ip.proto = entry->addr.proto;
375 if (ip.proto == htons(ETH_P_IP)) 379 if (ip.proto == htons(ETH_P_IP))
376 ip.u.ip4 = entry->addr.u.ip4; 380 ip.u.ip4 = entry->addr.u.ip4;
@@ -417,20 +421,14 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry)
417 if (!netif_running(br->dev) || br->multicast_disabled) 421 if (!netif_running(br->dev) || br->multicast_disabled)
418 return -EINVAL; 422 return -EINVAL;
419 423
424 memset(&ip, 0, sizeof(ip));
420 ip.proto = entry->addr.proto; 425 ip.proto = entry->addr.proto;
421 if (ip.proto == htons(ETH_P_IP)) { 426 if (ip.proto == htons(ETH_P_IP))
422 if (timer_pending(&br->ip4_other_query.timer))
423 return -EBUSY;
424
425 ip.u.ip4 = entry->addr.u.ip4; 427 ip.u.ip4 = entry->addr.u.ip4;
426#if IS_ENABLED(CONFIG_IPV6) 428#if IS_ENABLED(CONFIG_IPV6)
427 } else { 429 else
428 if (timer_pending(&br->ip6_other_query.timer))
429 return -EBUSY;
430
431 ip.u.ip6 = entry->addr.u.ip6; 430 ip.u.ip6 = entry->addr.u.ip6;
432#endif 431#endif
433 }
434 432
435 spin_lock_bh(&br->multicast_lock); 433 spin_lock_bh(&br->multicast_lock);
436 mdb = mlock_dereference(br->mdb, br); 434 mdb = mlock_dereference(br->mdb, br);
diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
index d89f4fac0bc5..c8b9bcfe997e 100644
--- a/net/bridge/br_netfilter_hooks.c
+++ b/net/bridge/br_netfilter_hooks.c
@@ -111,7 +111,7 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
111/* largest possible L2 header, see br_nf_dev_queue_xmit() */ 111/* largest possible L2 header, see br_nf_dev_queue_xmit() */
112#define NF_BRIDGE_MAX_MAC_HEADER_LENGTH (PPPOE_SES_HLEN + ETH_HLEN) 112#define NF_BRIDGE_MAX_MAC_HEADER_LENGTH (PPPOE_SES_HLEN + ETH_HLEN)
113 113
114#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) 114#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) || IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
115struct brnf_frag_data { 115struct brnf_frag_data {
116 char mac[NF_BRIDGE_MAX_MAC_HEADER_LENGTH]; 116 char mac[NF_BRIDGE_MAX_MAC_HEADER_LENGTH];
117 u8 encap_size; 117 u8 encap_size;
@@ -694,6 +694,7 @@ static int br_nf_push_frag_xmit(struct sock *sk, struct sk_buff *skb)
694} 694}
695#endif 695#endif
696 696
697#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4)
697static int br_nf_ip_fragment(struct sock *sk, struct sk_buff *skb, 698static int br_nf_ip_fragment(struct sock *sk, struct sk_buff *skb,
698 int (*output)(struct sock *, struct sk_buff *)) 699 int (*output)(struct sock *, struct sk_buff *))
699{ 700{
@@ -712,6 +713,7 @@ static int br_nf_ip_fragment(struct sock *sk, struct sk_buff *skb,
712 713
713 return ip_do_fragment(sk, skb, output); 714 return ip_do_fragment(sk, skb, output);
714} 715}
716#endif
715 717
716static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) 718static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
717{ 719{
@@ -742,7 +744,7 @@ static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb)
742 struct brnf_frag_data *data; 744 struct brnf_frag_data *data;
743 745
744 if (br_validate_ipv4(skb)) 746 if (br_validate_ipv4(skb))
745 return NF_DROP; 747 goto drop;
746 748
747 IPCB(skb)->frag_max_size = nf_bridge->frag_max_size; 749 IPCB(skb)->frag_max_size = nf_bridge->frag_max_size;
748 750
@@ -767,7 +769,7 @@ static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb)
767 struct brnf_frag_data *data; 769 struct brnf_frag_data *data;
768 770
769 if (br_validate_ipv6(skb)) 771 if (br_validate_ipv6(skb))
770 return NF_DROP; 772 goto drop;
771 773
772 IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size; 774 IP6CB(skb)->frag_max_size = nf_bridge->frag_max_size;
773 775
@@ -782,12 +784,16 @@ static int br_nf_dev_queue_xmit(struct sock *sk, struct sk_buff *skb)
782 784
783 if (v6ops) 785 if (v6ops)
784 return v6ops->fragment(sk, skb, br_nf_push_frag_xmit); 786 return v6ops->fragment(sk, skb, br_nf_push_frag_xmit);
785 else 787
786 return -EMSGSIZE; 788 kfree_skb(skb);
789 return -EMSGSIZE;
787 } 790 }
788#endif 791#endif
789 nf_bridge_info_free(skb); 792 nf_bridge_info_free(skb);
790 return br_dev_queue_push_xmit(sk, skb); 793 return br_dev_queue_push_xmit(sk, skb);
794 drop:
795 kfree_skb(skb);
796 return 0;
791} 797}
792 798
793/* PF_BRIDGE/POST_ROUTING ********************************************/ 799/* PF_BRIDGE/POST_ROUTING ********************************************/
diff --git a/net/bridge/br_netfilter_ipv6.c b/net/bridge/br_netfilter_ipv6.c
index 6d12d2675c80..13b7d1e3d185 100644
--- a/net/bridge/br_netfilter_ipv6.c
+++ b/net/bridge/br_netfilter_ipv6.c
@@ -104,7 +104,7 @@ int br_validate_ipv6(struct sk_buff *skb)
104{ 104{
105 const struct ipv6hdr *hdr; 105 const struct ipv6hdr *hdr;
106 struct net_device *dev = skb->dev; 106 struct net_device *dev = skb->dev;
107 struct inet6_dev *idev = in6_dev_get(skb->dev); 107 struct inet6_dev *idev = __in6_dev_get(skb->dev);
108 u32 pkt_len; 108 u32 pkt_len;
109 u8 ip6h_len = sizeof(struct ipv6hdr); 109 u8 ip6h_len = sizeof(struct ipv6hdr);
110 110
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 6b67ed3831de..364bdc98bd9b 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -457,6 +457,8 @@ static int br_afspec(struct net_bridge *br,
457 if (nla_len(attr) != sizeof(struct bridge_vlan_info)) 457 if (nla_len(attr) != sizeof(struct bridge_vlan_info))
458 return -EINVAL; 458 return -EINVAL;
459 vinfo = nla_data(attr); 459 vinfo = nla_data(attr);
460 if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
461 return -EINVAL;
460 if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) { 462 if (vinfo->flags & BRIDGE_VLAN_INFO_RANGE_BEGIN) {
461 if (vinfo_start) 463 if (vinfo_start)
462 return -EINVAL; 464 return -EINVAL;
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 7933e62a7318..166d436196c1 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -89,6 +89,8 @@ struct timer_list can_stattimer; /* timer for statistics update */
89struct s_stats can_stats; /* packet statistics */ 89struct s_stats can_stats; /* packet statistics */
90struct s_pstats can_pstats; /* receive list statistics */ 90struct s_pstats can_pstats; /* receive list statistics */
91 91
92static atomic_t skbcounter = ATOMIC_INIT(0);
93
92/* 94/*
93 * af_can socket functions 95 * af_can socket functions
94 */ 96 */
@@ -310,12 +312,8 @@ int can_send(struct sk_buff *skb, int loop)
310 return err; 312 return err;
311 } 313 }
312 314
313 if (newskb) { 315 if (newskb)
314 if (!(newskb->tstamp.tv64))
315 __net_timestamp(newskb);
316
317 netif_rx_ni(newskb); 316 netif_rx_ni(newskb);
318 }
319 317
320 /* update statistics */ 318 /* update statistics */
321 can_stats.tx_frames++; 319 can_stats.tx_frames++;
@@ -683,6 +681,10 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
683 can_stats.rx_frames++; 681 can_stats.rx_frames++;
684 can_stats.rx_frames_delta++; 682 can_stats.rx_frames_delta++;
685 683
684 /* create non-zero unique skb identifier together with *skb */
685 while (!(can_skb_prv(skb)->skbcnt))
686 can_skb_prv(skb)->skbcnt = atomic_inc_return(&skbcounter);
687
686 rcu_read_lock(); 688 rcu_read_lock();
687 689
688 /* deliver the packet to sockets listening on all devices */ 690 /* deliver the packet to sockets listening on all devices */
diff --git a/net/can/bcm.c b/net/can/bcm.c
index b523453585be..a1ba6875c2a2 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -261,6 +261,7 @@ static void bcm_can_tx(struct bcm_op *op)
261 261
262 can_skb_reserve(skb); 262 can_skb_reserve(skb);
263 can_skb_prv(skb)->ifindex = dev->ifindex; 263 can_skb_prv(skb)->ifindex = dev->ifindex;
264 can_skb_prv(skb)->skbcnt = 0;
264 265
265 memcpy(skb_put(skb, CFSIZ), cf, CFSIZ); 266 memcpy(skb_put(skb, CFSIZ), cf, CFSIZ);
266 267
@@ -1217,6 +1218,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
1217 } 1218 }
1218 1219
1219 can_skb_prv(skb)->ifindex = dev->ifindex; 1220 can_skb_prv(skb)->ifindex = dev->ifindex;
1221 can_skb_prv(skb)->skbcnt = 0;
1220 skb->dev = dev; 1222 skb->dev = dev;
1221 can_skb_set_owner(skb, sk); 1223 can_skb_set_owner(skb, sk);
1222 err = can_send(skb, 1); /* send with loopback */ 1224 err = can_send(skb, 1); /* send with loopback */
diff --git a/net/can/raw.c b/net/can/raw.c
index 31b9748cbb4e..2e67b1423cd3 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -75,7 +75,7 @@ MODULE_ALIAS("can-proto-1");
75 */ 75 */
76 76
77struct uniqframe { 77struct uniqframe {
78 ktime_t tstamp; 78 int skbcnt;
79 const struct sk_buff *skb; 79 const struct sk_buff *skb;
80 unsigned int join_rx_count; 80 unsigned int join_rx_count;
81}; 81};
@@ -133,7 +133,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
133 133
134 /* eliminate multiple filter matches for the same skb */ 134 /* eliminate multiple filter matches for the same skb */
135 if (this_cpu_ptr(ro->uniq)->skb == oskb && 135 if (this_cpu_ptr(ro->uniq)->skb == oskb &&
136 ktime_equal(this_cpu_ptr(ro->uniq)->tstamp, oskb->tstamp)) { 136 this_cpu_ptr(ro->uniq)->skbcnt == can_skb_prv(oskb)->skbcnt) {
137 if (ro->join_filters) { 137 if (ro->join_filters) {
138 this_cpu_inc(ro->uniq->join_rx_count); 138 this_cpu_inc(ro->uniq->join_rx_count);
139 /* drop frame until all enabled filters matched */ 139 /* drop frame until all enabled filters matched */
@@ -144,7 +144,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
144 } 144 }
145 } else { 145 } else {
146 this_cpu_ptr(ro->uniq)->skb = oskb; 146 this_cpu_ptr(ro->uniq)->skb = oskb;
147 this_cpu_ptr(ro->uniq)->tstamp = oskb->tstamp; 147 this_cpu_ptr(ro->uniq)->skbcnt = can_skb_prv(oskb)->skbcnt;
148 this_cpu_ptr(ro->uniq)->join_rx_count = 1; 148 this_cpu_ptr(ro->uniq)->join_rx_count = 1;
149 /* drop first frame to check all enabled filters? */ 149 /* drop first frame to check all enabled filters? */
150 if (ro->join_filters && ro->count > 1) 150 if (ro->join_filters && ro->count > 1)
@@ -749,6 +749,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
749 749
750 can_skb_reserve(skb); 750 can_skb_reserve(skb);
751 can_skb_prv(skb)->ifindex = dev->ifindex; 751 can_skb_prv(skb)->ifindex = dev->ifindex;
752 can_skb_prv(skb)->skbcnt = 0;
752 753
753 err = memcpy_from_msg(skb_put(skb, size), msg, size); 754 err = memcpy_from_msg(skb_put(skb, size), msg, size);
754 if (err < 0) 755 if (err < 0)
diff --git a/net/core/dev.c b/net/core/dev.c
index 6778a9999d52..a8e4dd430285 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -677,10 +677,6 @@ int dev_get_iflink(const struct net_device *dev)
677 if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink) 677 if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
678 return dev->netdev_ops->ndo_get_iflink(dev); 678 return dev->netdev_ops->ndo_get_iflink(dev);
679 679
680 /* If dev->rtnl_link_ops is set, it's a virtual interface. */
681 if (dev->rtnl_link_ops)
682 return 0;
683
684 return dev->ifindex; 680 return dev->ifindex;
685} 681}
686EXPORT_SYMBOL(dev_get_iflink); 682EXPORT_SYMBOL(dev_get_iflink);
@@ -3452,6 +3448,8 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu,
3452 local_irq_save(flags); 3448 local_irq_save(flags);
3453 3449
3454 rps_lock(sd); 3450 rps_lock(sd);
3451 if (!netif_running(skb->dev))
3452 goto drop;
3455 qlen = skb_queue_len(&sd->input_pkt_queue); 3453 qlen = skb_queue_len(&sd->input_pkt_queue);
3456 if (qlen <= netdev_max_backlog && !skb_flow_limit(skb, qlen)) { 3454 if (qlen <= netdev_max_backlog && !skb_flow_limit(skb, qlen)) {
3457 if (qlen) { 3455 if (qlen) {
@@ -3473,6 +3471,7 @@ enqueue:
3473 goto enqueue; 3471 goto enqueue;
3474 } 3472 }
3475 3473
3474drop:
3476 sd->dropped++; 3475 sd->dropped++;
3477 rps_unlock(sd); 3476 rps_unlock(sd);
3478 3477
@@ -3775,8 +3774,6 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc)
3775 3774
3776 pt_prev = NULL; 3775 pt_prev = NULL;
3777 3776
3778 rcu_read_lock();
3779
3780another_round: 3777another_round:
3781 skb->skb_iif = skb->dev->ifindex; 3778 skb->skb_iif = skb->dev->ifindex;
3782 3779
@@ -3786,7 +3783,7 @@ another_round:
3786 skb->protocol == cpu_to_be16(ETH_P_8021AD)) { 3783 skb->protocol == cpu_to_be16(ETH_P_8021AD)) {
3787 skb = skb_vlan_untag(skb); 3784 skb = skb_vlan_untag(skb);
3788 if (unlikely(!skb)) 3785 if (unlikely(!skb))
3789 goto unlock; 3786 goto out;
3790 } 3787 }
3791 3788
3792#ifdef CONFIG_NET_CLS_ACT 3789#ifdef CONFIG_NET_CLS_ACT
@@ -3816,10 +3813,10 @@ skip_taps:
3816 if (static_key_false(&ingress_needed)) { 3813 if (static_key_false(&ingress_needed)) {
3817 skb = handle_ing(skb, &pt_prev, &ret, orig_dev); 3814 skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
3818 if (!skb) 3815 if (!skb)
3819 goto unlock; 3816 goto out;
3820 3817
3821 if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0) 3818 if (nf_ingress(skb, &pt_prev, &ret, orig_dev) < 0)
3822 goto unlock; 3819 goto out;
3823 } 3820 }
3824#endif 3821#endif
3825#ifdef CONFIG_NET_CLS_ACT 3822#ifdef CONFIG_NET_CLS_ACT
@@ -3837,7 +3834,7 @@ ncls:
3837 if (vlan_do_receive(&skb)) 3834 if (vlan_do_receive(&skb))
3838 goto another_round; 3835 goto another_round;
3839 else if (unlikely(!skb)) 3836 else if (unlikely(!skb))
3840 goto unlock; 3837 goto out;
3841 } 3838 }
3842 3839
3843 rx_handler = rcu_dereference(skb->dev->rx_handler); 3840 rx_handler = rcu_dereference(skb->dev->rx_handler);
@@ -3849,7 +3846,7 @@ ncls:
3849 switch (rx_handler(&skb)) { 3846 switch (rx_handler(&skb)) {
3850 case RX_HANDLER_CONSUMED: 3847 case RX_HANDLER_CONSUMED:
3851 ret = NET_RX_SUCCESS; 3848 ret = NET_RX_SUCCESS;
3852 goto unlock; 3849 goto out;
3853 case RX_HANDLER_ANOTHER: 3850 case RX_HANDLER_ANOTHER:
3854 goto another_round; 3851 goto another_round;
3855 case RX_HANDLER_EXACT: 3852 case RX_HANDLER_EXACT:
@@ -3903,8 +3900,7 @@ drop:
3903 ret = NET_RX_DROP; 3900 ret = NET_RX_DROP;
3904 } 3901 }
3905 3902
3906unlock: 3903out:
3907 rcu_read_unlock();
3908 return ret; 3904 return ret;
3909} 3905}
3910 3906
@@ -3935,29 +3931,30 @@ static int __netif_receive_skb(struct sk_buff *skb)
3935 3931
3936static int netif_receive_skb_internal(struct sk_buff *skb) 3932static int netif_receive_skb_internal(struct sk_buff *skb)
3937{ 3933{
3934 int ret;
3935
3938 net_timestamp_check(netdev_tstamp_prequeue, skb); 3936 net_timestamp_check(netdev_tstamp_prequeue, skb);
3939 3937
3940 if (skb_defer_rx_timestamp(skb)) 3938 if (skb_defer_rx_timestamp(skb))
3941 return NET_RX_SUCCESS; 3939 return NET_RX_SUCCESS;
3942 3940
3941 rcu_read_lock();
3942
3943#ifdef CONFIG_RPS 3943#ifdef CONFIG_RPS
3944 if (static_key_false(&rps_needed)) { 3944 if (static_key_false(&rps_needed)) {
3945 struct rps_dev_flow voidflow, *rflow = &voidflow; 3945 struct rps_dev_flow voidflow, *rflow = &voidflow;
3946 int cpu, ret; 3946 int cpu = get_rps_cpu(skb->dev, skb, &rflow);
3947
3948 rcu_read_lock();
3949
3950 cpu = get_rps_cpu(skb->dev, skb, &rflow);
3951 3947
3952 if (cpu >= 0) { 3948 if (cpu >= 0) {
3953 ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); 3949 ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
3954 rcu_read_unlock(); 3950 rcu_read_unlock();
3955 return ret; 3951 return ret;
3956 } 3952 }
3957 rcu_read_unlock();
3958 } 3953 }
3959#endif 3954#endif
3960 return __netif_receive_skb(skb); 3955 ret = __netif_receive_skb(skb);
3956 rcu_read_unlock();
3957 return ret;
3961} 3958}
3962 3959
3963/** 3960/**
@@ -4502,8 +4499,10 @@ static int process_backlog(struct napi_struct *napi, int quota)
4502 struct sk_buff *skb; 4499 struct sk_buff *skb;
4503 4500
4504 while ((skb = __skb_dequeue(&sd->process_queue))) { 4501 while ((skb = __skb_dequeue(&sd->process_queue))) {
4502 rcu_read_lock();
4505 local_irq_enable(); 4503 local_irq_enable();
4506 __netif_receive_skb(skb); 4504 __netif_receive_skb(skb);
4505 rcu_read_unlock();
4507 local_irq_disable(); 4506 local_irq_disable();
4508 input_queue_head_incr(sd); 4507 input_queue_head_incr(sd);
4509 if (++work >= quota) { 4508 if (++work >= quota) {
@@ -6139,6 +6138,7 @@ static void rollback_registered_many(struct list_head *head)
6139 unlist_netdevice(dev); 6138 unlist_netdevice(dev);
6140 6139
6141 dev->reg_state = NETREG_UNREGISTERING; 6140 dev->reg_state = NETREG_UNREGISTERING;
6141 on_each_cpu(flush_backlog, dev, 1);
6142 } 6142 }
6143 6143
6144 synchronize_net(); 6144 synchronize_net();
@@ -6409,7 +6409,8 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
6409 struct netdev_queue *tx; 6409 struct netdev_queue *tx;
6410 size_t sz = count * sizeof(*tx); 6410 size_t sz = count * sizeof(*tx);
6411 6411
6412 BUG_ON(count < 1 || count > 0xffff); 6412 if (count < 1 || count > 0xffff)
6413 return -EINVAL;
6413 6414
6414 tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); 6415 tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT);
6415 if (!tx) { 6416 if (!tx) {
@@ -6773,8 +6774,6 @@ void netdev_run_todo(void)
6773 6774
6774 dev->reg_state = NETREG_UNREGISTERED; 6775 dev->reg_state = NETREG_UNREGISTERED;
6775 6776
6776 on_each_cpu(flush_backlog, dev, 1);
6777
6778 netdev_wait_allrefs(dev); 6777 netdev_wait_allrefs(dev);
6779 6778
6780 /* paranoia */ 6779 /* paranoia */
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 9dfb88a933e7..92d886f4adcb 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -66,7 +66,7 @@
66 66
67 NOTES. 67 NOTES.
68 68
69 * avbps is scaled by 2^5, avpps is scaled by 2^10. 69 * avbps and avpps are scaled by 2^5.
70 * both values are reported as 32 bit unsigned values. bps can 70 * both values are reported as 32 bit unsigned values. bps can
71 overflow for fast links : max speed being 34360Mbit/sec 71 overflow for fast links : max speed being 34360Mbit/sec
72 * Minimal interval is HZ/4=250msec (it is the greatest common divisor 72 * Minimal interval is HZ/4=250msec (it is the greatest common divisor
@@ -85,10 +85,10 @@ struct gen_estimator
85 struct gnet_stats_rate_est64 *rate_est; 85 struct gnet_stats_rate_est64 *rate_est;
86 spinlock_t *stats_lock; 86 spinlock_t *stats_lock;
87 int ewma_log; 87 int ewma_log;
88 u32 last_packets;
89 unsigned long avpps;
88 u64 last_bytes; 90 u64 last_bytes;
89 u64 avbps; 91 u64 avbps;
90 u32 last_packets;
91 u32 avpps;
92 struct rcu_head e_rcu; 92 struct rcu_head e_rcu;
93 struct rb_node node; 93 struct rb_node node;
94 struct gnet_stats_basic_cpu __percpu *cpu_bstats; 94 struct gnet_stats_basic_cpu __percpu *cpu_bstats;
@@ -118,8 +118,8 @@ static void est_timer(unsigned long arg)
118 rcu_read_lock(); 118 rcu_read_lock();
119 list_for_each_entry_rcu(e, &elist[idx].list, list) { 119 list_for_each_entry_rcu(e, &elist[idx].list, list) {
120 struct gnet_stats_basic_packed b = {0}; 120 struct gnet_stats_basic_packed b = {0};
121 unsigned long rate;
121 u64 brate; 122 u64 brate;
122 u32 rate;
123 123
124 spin_lock(e->stats_lock); 124 spin_lock(e->stats_lock);
125 read_lock(&est_lock); 125 read_lock(&est_lock);
@@ -133,10 +133,11 @@ static void est_timer(unsigned long arg)
133 e->avbps += (brate >> e->ewma_log) - (e->avbps >> e->ewma_log); 133 e->avbps += (brate >> e->ewma_log) - (e->avbps >> e->ewma_log);
134 e->rate_est->bps = (e->avbps+0xF)>>5; 134 e->rate_est->bps = (e->avbps+0xF)>>5;
135 135
136 rate = (b.packets - e->last_packets)<<(12 - idx); 136 rate = b.packets - e->last_packets;
137 rate <<= (7 - idx);
137 e->last_packets = b.packets; 138 e->last_packets = b.packets;
138 e->avpps += (rate >> e->ewma_log) - (e->avpps >> e->ewma_log); 139 e->avpps += (rate >> e->ewma_log) - (e->avpps >> e->ewma_log);
139 e->rate_est->pps = (e->avpps+0x1FF)>>10; 140 e->rate_est->pps = (e->avpps + 0xF) >> 5;
140skip: 141skip:
141 read_unlock(&est_lock); 142 read_unlock(&est_lock);
142 spin_unlock(e->stats_lock); 143 spin_unlock(e->stats_lock);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 05badbb58865..1ebdf1c0d118 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3571,13 +3571,6 @@ static int pktgen_thread_worker(void *arg)
3571 pr_debug("%s removing thread\n", t->tsk->comm); 3571 pr_debug("%s removing thread\n", t->tsk->comm);
3572 pktgen_rem_thread(t); 3572 pktgen_rem_thread(t);
3573 3573
3574 /* Wait for kthread_stop */
3575 while (!kthread_should_stop()) {
3576 set_current_state(TASK_INTERRUPTIBLE);
3577 schedule();
3578 }
3579 __set_current_state(TASK_RUNNING);
3580
3581 return 0; 3574 return 0;
3582} 3575}
3583 3576
@@ -3769,6 +3762,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
3769 } 3762 }
3770 3763
3771 t->net = pn; 3764 t->net = pn;
3765 get_task_struct(p);
3772 wake_up_process(p); 3766 wake_up_process(p);
3773 wait_for_completion(&t->start_done); 3767 wait_for_completion(&t->start_done);
3774 3768
@@ -3891,6 +3885,7 @@ static void __net_exit pg_net_exit(struct net *net)
3891 t = list_entry(q, struct pktgen_thread, th_list); 3885 t = list_entry(q, struct pktgen_thread, th_list);
3892 list_del(&t->th_list); 3886 list_del(&t->th_list);
3893 kthread_stop(t->tsk); 3887 kthread_stop(t->tsk);
3888 put_task_struct(t->tsk);
3894 kfree(t); 3889 kfree(t);
3895 } 3890 }
3896 3891
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 01ced4a889e0..9e433d58d265 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1328,10 +1328,6 @@ static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
1328 [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED }, 1328 [IFLA_INFO_SLAVE_DATA] = { .type = NLA_NESTED },
1329}; 1329};
1330 1330
1331static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = {
1332 [IFLA_VF_INFO] = { .type = NLA_NESTED },
1333};
1334
1335static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { 1331static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = {
1336 [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, 1332 [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) },
1337 [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, 1333 [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) },
@@ -1488,96 +1484,98 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
1488 return 0; 1484 return 0;
1489} 1485}
1490 1486
1491static int do_setvfinfo(struct net_device *dev, struct nlattr *attr) 1487static int do_setvfinfo(struct net_device *dev, struct nlattr **tb)
1492{ 1488{
1493 int rem, err = -EINVAL;
1494 struct nlattr *vf;
1495 const struct net_device_ops *ops = dev->netdev_ops; 1489 const struct net_device_ops *ops = dev->netdev_ops;
1490 int err = -EINVAL;
1496 1491
1497 nla_for_each_nested(vf, attr, rem) { 1492 if (tb[IFLA_VF_MAC]) {
1498 switch (nla_type(vf)) { 1493 struct ifla_vf_mac *ivm = nla_data(tb[IFLA_VF_MAC]);
1499 case IFLA_VF_MAC: {
1500 struct ifla_vf_mac *ivm;
1501 ivm = nla_data(vf);
1502 err = -EOPNOTSUPP;
1503 if (ops->ndo_set_vf_mac)
1504 err = ops->ndo_set_vf_mac(dev, ivm->vf,
1505 ivm->mac);
1506 break;
1507 }
1508 case IFLA_VF_VLAN: {
1509 struct ifla_vf_vlan *ivv;
1510 ivv = nla_data(vf);
1511 err = -EOPNOTSUPP;
1512 if (ops->ndo_set_vf_vlan)
1513 err = ops->ndo_set_vf_vlan(dev, ivv->vf,
1514 ivv->vlan,
1515 ivv->qos);
1516 break;
1517 }
1518 case IFLA_VF_TX_RATE: {
1519 struct ifla_vf_tx_rate *ivt;
1520 struct ifla_vf_info ivf;
1521 ivt = nla_data(vf);
1522 err = -EOPNOTSUPP;
1523 if (ops->ndo_get_vf_config)
1524 err = ops->ndo_get_vf_config(dev, ivt->vf,
1525 &ivf);
1526 if (err)
1527 break;
1528 err = -EOPNOTSUPP;
1529 if (ops->ndo_set_vf_rate)
1530 err = ops->ndo_set_vf_rate(dev, ivt->vf,
1531 ivf.min_tx_rate,
1532 ivt->rate);
1533 break;
1534 }
1535 case IFLA_VF_RATE: {
1536 struct ifla_vf_rate *ivt;
1537 ivt = nla_data(vf);
1538 err = -EOPNOTSUPP;
1539 if (ops->ndo_set_vf_rate)
1540 err = ops->ndo_set_vf_rate(dev, ivt->vf,
1541 ivt->min_tx_rate,
1542 ivt->max_tx_rate);
1543 break;
1544 }
1545 case IFLA_VF_SPOOFCHK: {
1546 struct ifla_vf_spoofchk *ivs;
1547 ivs = nla_data(vf);
1548 err = -EOPNOTSUPP;
1549 if (ops->ndo_set_vf_spoofchk)
1550 err = ops->ndo_set_vf_spoofchk(dev, ivs->vf,
1551 ivs->setting);
1552 break;
1553 }
1554 case IFLA_VF_LINK_STATE: {
1555 struct ifla_vf_link_state *ivl;
1556 ivl = nla_data(vf);
1557 err = -EOPNOTSUPP;
1558 if (ops->ndo_set_vf_link_state)
1559 err = ops->ndo_set_vf_link_state(dev, ivl->vf,
1560 ivl->link_state);
1561 break;
1562 }
1563 case IFLA_VF_RSS_QUERY_EN: {
1564 struct ifla_vf_rss_query_en *ivrssq_en;
1565 1494
1566 ivrssq_en = nla_data(vf); 1495 err = -EOPNOTSUPP;
1567 err = -EOPNOTSUPP; 1496 if (ops->ndo_set_vf_mac)
1568 if (ops->ndo_set_vf_rss_query_en) 1497 err = ops->ndo_set_vf_mac(dev, ivm->vf,
1569 err = ops->ndo_set_vf_rss_query_en(dev, 1498 ivm->mac);
1570 ivrssq_en->vf, 1499 if (err < 0)
1571 ivrssq_en->setting); 1500 return err;
1572 break; 1501 }
1573 } 1502
1574 default: 1503 if (tb[IFLA_VF_VLAN]) {
1575 err = -EINVAL; 1504 struct ifla_vf_vlan *ivv = nla_data(tb[IFLA_VF_VLAN]);
1576 break; 1505
1577 } 1506 err = -EOPNOTSUPP;
1578 if (err) 1507 if (ops->ndo_set_vf_vlan)
1579 break; 1508 err = ops->ndo_set_vf_vlan(dev, ivv->vf, ivv->vlan,
1509 ivv->qos);
1510 if (err < 0)
1511 return err;
1512 }
1513
1514 if (tb[IFLA_VF_TX_RATE]) {
1515 struct ifla_vf_tx_rate *ivt = nla_data(tb[IFLA_VF_TX_RATE]);
1516 struct ifla_vf_info ivf;
1517
1518 err = -EOPNOTSUPP;
1519 if (ops->ndo_get_vf_config)
1520 err = ops->ndo_get_vf_config(dev, ivt->vf, &ivf);
1521 if (err < 0)
1522 return err;
1523
1524 err = -EOPNOTSUPP;
1525 if (ops->ndo_set_vf_rate)
1526 err = ops->ndo_set_vf_rate(dev, ivt->vf,
1527 ivf.min_tx_rate,
1528 ivt->rate);
1529 if (err < 0)
1530 return err;
1531 }
1532
1533 if (tb[IFLA_VF_RATE]) {
1534 struct ifla_vf_rate *ivt = nla_data(tb[IFLA_VF_RATE]);
1535
1536 err = -EOPNOTSUPP;
1537 if (ops->ndo_set_vf_rate)
1538 err = ops->ndo_set_vf_rate(dev, ivt->vf,
1539 ivt->min_tx_rate,
1540 ivt->max_tx_rate);
1541 if (err < 0)
1542 return err;
1580 } 1543 }
1544
1545 if (tb[IFLA_VF_SPOOFCHK]) {
1546 struct ifla_vf_spoofchk *ivs = nla_data(tb[IFLA_VF_SPOOFCHK]);
1547
1548 err = -EOPNOTSUPP;
1549 if (ops->ndo_set_vf_spoofchk)
1550 err = ops->ndo_set_vf_spoofchk(dev, ivs->vf,
1551 ivs->setting);
1552 if (err < 0)
1553 return err;
1554 }
1555
1556 if (tb[IFLA_VF_LINK_STATE]) {
1557 struct ifla_vf_link_state *ivl = nla_data(tb[IFLA_VF_LINK_STATE]);
1558
1559 err = -EOPNOTSUPP;
1560 if (ops->ndo_set_vf_link_state)
1561 err = ops->ndo_set_vf_link_state(dev, ivl->vf,
1562 ivl->link_state);
1563 if (err < 0)
1564 return err;
1565 }
1566
1567 if (tb[IFLA_VF_RSS_QUERY_EN]) {
1568 struct ifla_vf_rss_query_en *ivrssq_en;
1569
1570 err = -EOPNOTSUPP;
1571 ivrssq_en = nla_data(tb[IFLA_VF_RSS_QUERY_EN]);
1572 if (ops->ndo_set_vf_rss_query_en)
1573 err = ops->ndo_set_vf_rss_query_en(dev, ivrssq_en->vf,
1574 ivrssq_en->setting);
1575 if (err < 0)
1576 return err;
1577 }
1578
1581 return err; 1579 return err;
1582} 1580}
1583 1581
@@ -1773,14 +1771,21 @@ static int do_setlink(const struct sk_buff *skb,
1773 } 1771 }
1774 1772
1775 if (tb[IFLA_VFINFO_LIST]) { 1773 if (tb[IFLA_VFINFO_LIST]) {
1774 struct nlattr *vfinfo[IFLA_VF_MAX + 1];
1776 struct nlattr *attr; 1775 struct nlattr *attr;
1777 int rem; 1776 int rem;
1777
1778 nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) { 1778 nla_for_each_nested(attr, tb[IFLA_VFINFO_LIST], rem) {
1779 if (nla_type(attr) != IFLA_VF_INFO) { 1779 if (nla_type(attr) != IFLA_VF_INFO ||
1780 nla_len(attr) < NLA_HDRLEN) {
1780 err = -EINVAL; 1781 err = -EINVAL;
1781 goto errout; 1782 goto errout;
1782 } 1783 }
1783 err = do_setvfinfo(dev, attr); 1784 err = nla_parse_nested(vfinfo, IFLA_VF_MAX, attr,
1785 ifla_vf_policy);
1786 if (err < 0)
1787 goto errout;
1788 err = do_setvfinfo(dev, vfinfo);
1784 if (err < 0) 1789 if (err < 0)
1785 goto errout; 1790 goto errout;
1786 status |= DO_SETLINK_NOTIFY; 1791 status |= DO_SETLINK_NOTIFY;
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 392e29a0227d..b445d492c115 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -630,7 +630,7 @@ static int dsa_of_probe(struct device *dev)
630 continue; 630 continue;
631 631
632 cd->sw_addr = be32_to_cpup(sw_addr); 632 cd->sw_addr = be32_to_cpup(sw_addr);
633 if (cd->sw_addr > PHY_MAX_ADDR) 633 if (cd->sw_addr >= PHY_MAX_ADDR)
634 continue; 634 continue;
635 635
636 if (!of_property_read_u32(child, "eeprom-length", &eeprom_len)) 636 if (!of_property_read_u32(child, "eeprom-length", &eeprom_len))
@@ -642,6 +642,8 @@ static int dsa_of_probe(struct device *dev)
642 continue; 642 continue;
643 643
644 port_index = be32_to_cpup(port_reg); 644 port_index = be32_to_cpup(port_reg);
645 if (port_index >= DSA_MAX_PORTS)
646 break;
645 647
646 port_name = of_get_property(port, "label", NULL); 648 port_name = of_get_property(port, "label", NULL);
647 if (!port_name) 649 if (!port_name)
@@ -666,8 +668,6 @@ static int dsa_of_probe(struct device *dev)
666 goto out_free_chip; 668 goto out_free_chip;
667 } 669 }
668 670
669 if (port_index == DSA_MAX_PORTS)
670 break;
671 } 671 }
672 } 672 }
673 673
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7498716e8f54..e813196c91c7 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1740,6 +1740,8 @@ static int inet_netconf_msgsize_devconf(int type)
1740 size += nla_total_size(4); 1740 size += nla_total_size(4);
1741 if (type == -1 || type == NETCONFA_PROXY_NEIGH) 1741 if (type == -1 || type == NETCONFA_PROXY_NEIGH)
1742 size += nla_total_size(4); 1742 size += nla_total_size(4);
1743 if (type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN)
1744 size += nla_total_size(4);
1743 1745
1744 return size; 1746 return size;
1745} 1747}
@@ -1780,6 +1782,10 @@ static int inet_netconf_fill_devconf(struct sk_buff *skb, int ifindex,
1780 nla_put_s32(skb, NETCONFA_PROXY_NEIGH, 1782 nla_put_s32(skb, NETCONFA_PROXY_NEIGH,
1781 IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0) 1783 IPV4_DEVCONF(*devconf, PROXY_ARP)) < 0)
1782 goto nla_put_failure; 1784 goto nla_put_failure;
1785 if ((type == -1 || type == NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN) &&
1786 nla_put_s32(skb, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
1787 IPV4_DEVCONF(*devconf, IGNORE_ROUTES_WITH_LINKDOWN)) < 0)
1788 goto nla_put_failure;
1783 1789
1784 nlmsg_end(skb, nlh); 1790 nlmsg_end(skb, nlh);
1785 return 0; 1791 return 0;
@@ -1819,6 +1825,7 @@ static const struct nla_policy devconf_ipv4_policy[NETCONFA_MAX+1] = {
1819 [NETCONFA_FORWARDING] = { .len = sizeof(int) }, 1825 [NETCONFA_FORWARDING] = { .len = sizeof(int) },
1820 [NETCONFA_RP_FILTER] = { .len = sizeof(int) }, 1826 [NETCONFA_RP_FILTER] = { .len = sizeof(int) },
1821 [NETCONFA_PROXY_NEIGH] = { .len = sizeof(int) }, 1827 [NETCONFA_PROXY_NEIGH] = { .len = sizeof(int) },
1828 [NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN] = { .len = sizeof(int) },
1822}; 1829};
1823 1830
1824static int inet_netconf_get_devconf(struct sk_buff *in_skb, 1831static int inet_netconf_get_devconf(struct sk_buff *in_skb,
@@ -2048,6 +2055,12 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write,
2048 inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH, 2055 inet_netconf_notify_devconf(net, NETCONFA_PROXY_NEIGH,
2049 ifindex, cnf); 2056 ifindex, cnf);
2050 } 2057 }
2058 if (i == IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN - 1 &&
2059 new_value != old_value) {
2060 ifindex = devinet_conf_ifindex(net, cnf);
2061 inet_netconf_notify_devconf(net, NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN,
2062 ifindex, cnf);
2063 }
2051 } 2064 }
2052 2065
2053 return ret; 2066 return ret;
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 9bc26677058e..c3b1f3a0f4cf 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -152,8 +152,8 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
152 inet6_sk(sk)->tclass) < 0) 152 inet6_sk(sk)->tclass) < 0)
153 goto errout; 153 goto errout;
154 154
155 if (ipv6_only_sock(sk) && 155 if (((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE)) &&
156 nla_put_u8(skb, INET_DIAG_SKV6ONLY, 1)) 156 nla_put_u8(skb, INET_DIAG_SKV6ONLY, ipv6_only_sock(sk)))
157 goto errout; 157 goto errout;
158 } 158 }
159#endif 159#endif
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 4c2c3ba4ba65..626d9e56a6bd 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -586,7 +586,8 @@ int ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
586EXPORT_SYMBOL(ip_tunnel_encap); 586EXPORT_SYMBOL(ip_tunnel_encap);
587 587
588static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb, 588static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,
589 struct rtable *rt, __be16 df) 589 struct rtable *rt, __be16 df,
590 const struct iphdr *inner_iph)
590{ 591{
591 struct ip_tunnel *tunnel = netdev_priv(dev); 592 struct ip_tunnel *tunnel = netdev_priv(dev);
592 int pkt_size = skb->len - tunnel->hlen - dev->hard_header_len; 593 int pkt_size = skb->len - tunnel->hlen - dev->hard_header_len;
@@ -603,7 +604,8 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,
603 604
604 if (skb->protocol == htons(ETH_P_IP)) { 605 if (skb->protocol == htons(ETH_P_IP)) {
605 if (!skb_is_gso(skb) && 606 if (!skb_is_gso(skb) &&
606 (df & htons(IP_DF)) && mtu < pkt_size) { 607 (inner_iph->frag_off & htons(IP_DF)) &&
608 mtu < pkt_size) {
607 memset(IPCB(skb), 0, sizeof(*IPCB(skb))); 609 memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
608 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); 610 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
609 return -E2BIG; 611 return -E2BIG;
@@ -737,7 +739,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
737 goto tx_error; 739 goto tx_error;
738 } 740 }
739 741
740 if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off)) { 742 if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph)) {
741 ip_rt_put(rt); 743 ip_rt_put(rt);
742 goto tx_error; 744 goto tx_error;
743 } 745 }
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 95c9b6eece25..92305a1a021a 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -254,9 +254,10 @@ unsigned int arpt_do_table(struct sk_buff *skb,
254 static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))); 254 static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
255 unsigned int verdict = NF_DROP; 255 unsigned int verdict = NF_DROP;
256 const struct arphdr *arp; 256 const struct arphdr *arp;
257 struct arpt_entry *e, *back; 257 struct arpt_entry *e, **jumpstack;
258 const char *indev, *outdev; 258 const char *indev, *outdev;
259 const void *table_base; 259 const void *table_base;
260 unsigned int cpu, stackidx = 0;
260 const struct xt_table_info *private; 261 const struct xt_table_info *private;
261 struct xt_action_param acpar; 262 struct xt_action_param acpar;
262 unsigned int addend; 263 unsigned int addend;
@@ -270,15 +271,16 @@ unsigned int arpt_do_table(struct sk_buff *skb,
270 local_bh_disable(); 271 local_bh_disable();
271 addend = xt_write_recseq_begin(); 272 addend = xt_write_recseq_begin();
272 private = table->private; 273 private = table->private;
274 cpu = smp_processor_id();
273 /* 275 /*
274 * Ensure we load private-> members after we've fetched the base 276 * Ensure we load private-> members after we've fetched the base
275 * pointer. 277 * pointer.
276 */ 278 */
277 smp_read_barrier_depends(); 279 smp_read_barrier_depends();
278 table_base = private->entries; 280 table_base = private->entries;
281 jumpstack = (struct arpt_entry **)private->jumpstack[cpu];
279 282
280 e = get_entry(table_base, private->hook_entry[hook]); 283 e = get_entry(table_base, private->hook_entry[hook]);
281 back = get_entry(table_base, private->underflow[hook]);
282 284
283 acpar.in = state->in; 285 acpar.in = state->in;
284 acpar.out = state->out; 286 acpar.out = state->out;
@@ -312,18 +314,23 @@ unsigned int arpt_do_table(struct sk_buff *skb,
312 verdict = (unsigned int)(-v) - 1; 314 verdict = (unsigned int)(-v) - 1;
313 break; 315 break;
314 } 316 }
315 e = back; 317 if (stackidx == 0) {
316 back = get_entry(table_base, back->comefrom); 318 e = get_entry(table_base,
319 private->underflow[hook]);
320 } else {
321 e = jumpstack[--stackidx];
322 e = arpt_next_entry(e);
323 }
317 continue; 324 continue;
318 } 325 }
319 if (table_base + v 326 if (table_base + v
320 != arpt_next_entry(e)) { 327 != arpt_next_entry(e)) {
321 /* Save old back ptr in next entry */
322 struct arpt_entry *next = arpt_next_entry(e);
323 next->comefrom = (void *)back - table_base;
324 328
325 /* set back pointer to next entry */ 329 if (stackidx >= private->stacksize) {
326 back = next; 330 verdict = NF_DROP;
331 break;
332 }
333 jumpstack[stackidx++] = e;
327 } 334 }
328 335
329 e = get_entry(table_base, v); 336 e = get_entry(table_base, v);
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index f2e464eba5ef..57990c929cd8 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -331,10 +331,10 @@ int ip6_mc_input(struct sk_buff *skb)
331 if (offset < 0) 331 if (offset < 0)
332 goto out; 332 goto out;
333 333
334 if (!ipv6_is_mld(skb, nexthdr, offset)) 334 if (ipv6_is_mld(skb, nexthdr, offset))
335 goto out; 335 deliver = true;
336 336
337 deliver = true; 337 goto out;
338 } 338 }
339 /* unknown RA - process it normally */ 339 /* unknown RA - process it normally */
340 } 340 }
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1a1122a6bbf5..6090969937f8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -369,10 +369,7 @@ static void ip6_dst_destroy(struct dst_entry *dst)
369 struct inet6_dev *idev; 369 struct inet6_dev *idev;
370 370
371 dst_destroy_metrics_generic(dst); 371 dst_destroy_metrics_generic(dst);
372 372 free_percpu(rt->rt6i_pcpu);
373 if (rt->rt6i_pcpu)
374 free_percpu(rt->rt6i_pcpu);
375
376 rt6_uncached_list_del(rt); 373 rt6_uncached_list_del(rt);
377 374
378 idev = rt->rt6i_idev; 375 idev = rt->rt6i_idev;
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index cd60d397fe05..8a8b2abc35ff 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -213,7 +213,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
213 213
214 if (verdict == NF_ACCEPT) { 214 if (verdict == NF_ACCEPT) {
215 next_hook: 215 next_hook:
216 verdict = nf_iterate(&nf_hooks[entry->state.pf][entry->state.hook], 216 verdict = nf_iterate(entry->state.hook_list,
217 skb, &entry->state, &elem); 217 skb, &entry->state, &elem);
218 } 218 }
219 219
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 8b117c90ecd7..0c0e8ecf02ab 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -269,6 +269,12 @@ static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb)
269 } 269 }
270} 270}
271 271
272enum {
273 NFNL_BATCH_FAILURE = (1 << 0),
274 NFNL_BATCH_DONE = (1 << 1),
275 NFNL_BATCH_REPLAY = (1 << 2),
276};
277
272static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, 278static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
273 u_int16_t subsys_id) 279 u_int16_t subsys_id)
274{ 280{
@@ -276,13 +282,15 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
276 struct net *net = sock_net(skb->sk); 282 struct net *net = sock_net(skb->sk);
277 const struct nfnetlink_subsystem *ss; 283 const struct nfnetlink_subsystem *ss;
278 const struct nfnl_callback *nc; 284 const struct nfnl_callback *nc;
279 bool success = true, done = false;
280 static LIST_HEAD(err_list); 285 static LIST_HEAD(err_list);
286 u32 status;
281 int err; 287 int err;
282 288
283 if (subsys_id >= NFNL_SUBSYS_COUNT) 289 if (subsys_id >= NFNL_SUBSYS_COUNT)
284 return netlink_ack(skb, nlh, -EINVAL); 290 return netlink_ack(skb, nlh, -EINVAL);
285replay: 291replay:
292 status = 0;
293
286 skb = netlink_skb_clone(oskb, GFP_KERNEL); 294 skb = netlink_skb_clone(oskb, GFP_KERNEL);
287 if (!skb) 295 if (!skb)
288 return netlink_ack(oskb, nlh, -ENOMEM); 296 return netlink_ack(oskb, nlh, -ENOMEM);
@@ -336,10 +344,10 @@ replay:
336 if (type == NFNL_MSG_BATCH_BEGIN) { 344 if (type == NFNL_MSG_BATCH_BEGIN) {
337 /* Malformed: Batch begin twice */ 345 /* Malformed: Batch begin twice */
338 nfnl_err_reset(&err_list); 346 nfnl_err_reset(&err_list);
339 success = false; 347 status |= NFNL_BATCH_FAILURE;
340 goto done; 348 goto done;
341 } else if (type == NFNL_MSG_BATCH_END) { 349 } else if (type == NFNL_MSG_BATCH_END) {
342 done = true; 350 status |= NFNL_BATCH_DONE;
343 goto done; 351 goto done;
344 } else if (type < NLMSG_MIN_TYPE) { 352 } else if (type < NLMSG_MIN_TYPE) {
345 err = -EINVAL; 353 err = -EINVAL;
@@ -382,11 +390,8 @@ replay:
382 * original skb. 390 * original skb.
383 */ 391 */
384 if (err == -EAGAIN) { 392 if (err == -EAGAIN) {
385 nfnl_err_reset(&err_list); 393 status |= NFNL_BATCH_REPLAY;
386 ss->abort(oskb); 394 goto next;
387 nfnl_unlock(subsys_id);
388 kfree_skb(skb);
389 goto replay;
390 } 395 }
391 } 396 }
392ack: 397ack:
@@ -402,7 +407,7 @@ ack:
402 */ 407 */
403 nfnl_err_reset(&err_list); 408 nfnl_err_reset(&err_list);
404 netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM); 409 netlink_ack(skb, nlmsg_hdr(oskb), -ENOMEM);
405 success = false; 410 status |= NFNL_BATCH_FAILURE;
406 goto done; 411 goto done;
407 } 412 }
408 /* We don't stop processing the batch on errors, thus, 413 /* We don't stop processing the batch on errors, thus,
@@ -410,19 +415,26 @@ ack:
410 * triggers. 415 * triggers.
411 */ 416 */
412 if (err) 417 if (err)
413 success = false; 418 status |= NFNL_BATCH_FAILURE;
414 } 419 }
415 420next:
416 msglen = NLMSG_ALIGN(nlh->nlmsg_len); 421 msglen = NLMSG_ALIGN(nlh->nlmsg_len);
417 if (msglen > skb->len) 422 if (msglen > skb->len)
418 msglen = skb->len; 423 msglen = skb->len;
419 skb_pull(skb, msglen); 424 skb_pull(skb, msglen);
420 } 425 }
421done: 426done:
422 if (success && done) 427 if (status & NFNL_BATCH_REPLAY) {
428 ss->abort(oskb);
429 nfnl_err_reset(&err_list);
430 nfnl_unlock(subsys_id);
431 kfree_skb(skb);
432 goto replay;
433 } else if (status == NFNL_BATCH_DONE) {
423 ss->commit(oskb); 434 ss->commit(oskb);
424 else 435 } else {
425 ss->abort(oskb); 436 ss->abort(oskb);
437 }
426 438
427 nfnl_err_deliver(&err_list, oskb); 439 nfnl_err_deliver(&err_list, oskb);
428 nfnl_unlock(subsys_id); 440 nfnl_unlock(subsys_id);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index dea925388a5b..9a0ae7172f92 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -158,7 +158,7 @@ static int __netlink_remove_tap(struct netlink_tap *nt)
158out: 158out:
159 spin_unlock(&netlink_tap_lock); 159 spin_unlock(&netlink_tap_lock);
160 160
161 if (found && nt->module) 161 if (found)
162 module_put(nt->module); 162 module_put(nt->module);
163 163
164 return found ? 0 : -ENODEV; 164 return found ? 0 : -ENODEV;
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index 273b8bff6ba4..657ba9f5d308 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
759 } 759 }
760 760
761 ibmr = rds_ib_alloc_fmr(rds_ibdev); 761 ibmr = rds_ib_alloc_fmr(rds_ibdev);
762 if (IS_ERR(ibmr)) 762 if (IS_ERR(ibmr)) {
763 rds_ib_dev_put(rds_ibdev);
763 return ibmr; 764 return ibmr;
765 }
764 766
765 ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents); 767 ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents);
766 if (ret == 0) 768 if (ret == 0)
diff --git a/net/rds/transport.c b/net/rds/transport.c
index 8b4a6cd2c3a7..83498e1c75b8 100644
--- a/net/rds/transport.c
+++ b/net/rds/transport.c
@@ -73,7 +73,7 @@ EXPORT_SYMBOL_GPL(rds_trans_unregister);
73 73
74void rds_trans_put(struct rds_transport *trans) 74void rds_trans_put(struct rds_transport *trans)
75{ 75{
76 if (trans && trans->t_owner) 76 if (trans)
77 module_put(trans->t_owner); 77 module_put(trans->t_owner);
78} 78}
79 79
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 84f77a054025..9f2add3cba26 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -171,8 +171,10 @@ int switchdev_port_attr_set(struct net_device *dev, struct switchdev_attr *attr)
171 * released. 171 * released.
172 */ 172 */
173 173
174 attr->trans = SWITCHDEV_TRANS_ABORT; 174 if (err != -EOPNOTSUPP) {
175 __switchdev_port_attr_set(dev, attr); 175 attr->trans = SWITCHDEV_TRANS_ABORT;
176 __switchdev_port_attr_set(dev, attr);
177 }
176 178
177 return err; 179 return err;
178 } 180 }
@@ -249,8 +251,10 @@ int switchdev_port_obj_add(struct net_device *dev, struct switchdev_obj *obj)
249 * released. 251 * released.
250 */ 252 */
251 253
252 obj->trans = SWITCHDEV_TRANS_ABORT; 254 if (err != -EOPNOTSUPP) {
253 __switchdev_port_obj_add(dev, obj); 255 obj->trans = SWITCHDEV_TRANS_ABORT;
256 __switchdev_port_obj_add(dev, obj);
257 }
254 258
255 return err; 259 return err;
256 } 260 }
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 46b6ed534ef2..3a7567f690f3 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2007,6 +2007,7 @@ static int tipc_accept(struct socket *sock, struct socket *new_sock, int flags)
2007 res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 1); 2007 res = tipc_sk_create(sock_net(sock->sk), new_sock, 0, 1);
2008 if (res) 2008 if (res)
2009 goto exit; 2009 goto exit;
2010 security_sk_clone(sock->sk, new_sock->sk);
2010 2011
2011 new_sk = new_sock->sk; 2012 new_sk = new_sock->sk;
2012 new_tsock = tipc_sk(new_sk); 2013 new_tsock = tipc_sk(new_sk);
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 90e1edc8dd42..d5c8e9a3a73c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2599,7 +2599,7 @@ sub process {
2599# if LONG_LINE is ignored, the other 2 types are also ignored 2599# if LONG_LINE is ignored, the other 2 types are also ignored
2600# 2600#
2601 2601
2602 if ($length > $max_line_length) { 2602 if ($line =~ /^\+/ && $length > $max_line_length) {
2603 my $msg_type = "LONG_LINE"; 2603 my $msg_type = "LONG_LINE";
2604 2604
2605 # Check the allowed long line types first 2605 # Check the allowed long line types first
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index ac0db1679f09..b077bb644434 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -5175,7 +5175,7 @@ static int alt_playback_pcm_open(struct hda_pcm_stream *hinfo,
5175 int err = 0; 5175 int err = 0;
5176 5176
5177 mutex_lock(&spec->pcm_mutex); 5177 mutex_lock(&spec->pcm_mutex);
5178 if (!spec->indep_hp_enabled) 5178 if (spec->indep_hp && !spec->indep_hp_enabled)
5179 err = -EBUSY; 5179 err = -EBUSY;
5180 else 5180 else
5181 spec->active_streams |= 1 << STREAM_INDEP_HP; 5181 spec->active_streams |= 1 << STREAM_INDEP_HP;
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 2f2433845d04..95158914cc6c 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -3527,6 +3527,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
3527{ .id = 0x80862807, .name = "Haswell HDMI", .patch = patch_generic_hdmi }, 3527{ .id = 0x80862807, .name = "Haswell HDMI", .patch = patch_generic_hdmi },
3528{ .id = 0x80862808, .name = "Broadwell HDMI", .patch = patch_generic_hdmi }, 3528{ .id = 0x80862808, .name = "Broadwell HDMI", .patch = patch_generic_hdmi },
3529{ .id = 0x80862809, .name = "Skylake HDMI", .patch = patch_generic_hdmi }, 3529{ .id = 0x80862809, .name = "Skylake HDMI", .patch = patch_generic_hdmi },
3530{ .id = 0x8086280a, .name = "Broxton HDMI", .patch = patch_generic_hdmi },
3530{ .id = 0x80862880, .name = "CedarTrail HDMI", .patch = patch_generic_hdmi }, 3531{ .id = 0x80862880, .name = "CedarTrail HDMI", .patch = patch_generic_hdmi },
3531{ .id = 0x80862882, .name = "Valleyview2 HDMI", .patch = patch_generic_hdmi }, 3532{ .id = 0x80862882, .name = "Valleyview2 HDMI", .patch = patch_generic_hdmi },
3532{ .id = 0x80862883, .name = "Braswell HDMI", .patch = patch_generic_hdmi }, 3533{ .id = 0x80862883, .name = "Braswell HDMI", .patch = patch_generic_hdmi },
@@ -3591,6 +3592,7 @@ MODULE_ALIAS("snd-hda-codec-id:80862806");
3591MODULE_ALIAS("snd-hda-codec-id:80862807"); 3592MODULE_ALIAS("snd-hda-codec-id:80862807");
3592MODULE_ALIAS("snd-hda-codec-id:80862808"); 3593MODULE_ALIAS("snd-hda-codec-id:80862808");
3593MODULE_ALIAS("snd-hda-codec-id:80862809"); 3594MODULE_ALIAS("snd-hda-codec-id:80862809");
3595MODULE_ALIAS("snd-hda-codec-id:8086280a");
3594MODULE_ALIAS("snd-hda-codec-id:80862880"); 3596MODULE_ALIAS("snd-hda-codec-id:80862880");
3595MODULE_ALIAS("snd-hda-codec-id:80862882"); 3597MODULE_ALIAS("snd-hda-codec-id:80862882");
3596MODULE_ALIAS("snd-hda-codec-id:80862883"); 3598MODULE_ALIAS("snd-hda-codec-id:80862883");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b3b44681d3cf..d35cf506a7db 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4441,6 +4441,55 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4441 } 4441 }
4442} 4442}
4443 4443
4444/* Hook to update amp GPIO4 for automute */
4445static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
4446 struct hda_jack_callback *jack)
4447{
4448 struct alc_spec *spec = codec->spec;
4449
4450 snd_hda_gen_hp_automute(codec, jack);
4451 /* mute_led_polarity is set to 0, so we pass inverted value here */
4452 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
4453}
4454
4455/* Manage GPIOs for HP EliteBook Folio 9480m.
4456 *
4457 * GPIO4 is the headphone amplifier power control
4458 * GPIO3 is the audio output mute indicator LED
4459 */
4460
4461static void alc280_fixup_hp_9480m(struct hda_codec *codec,
4462 const struct hda_fixup *fix,
4463 int action)
4464{
4465 struct alc_spec *spec = codec->spec;
4466 static const struct hda_verb gpio_init[] = {
4467 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
4468 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
4469 {}
4470 };
4471
4472 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4473 /* Set the hooks to turn the headphone amp on/off
4474 * as needed
4475 */
4476 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
4477 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
4478
4479 /* The GPIOs are currently off */
4480 spec->gpio_led = 0;
4481
4482 /* GPIO3 is connected to the output mute LED,
4483 * high is on, low is off
4484 */
4485 spec->mute_led_polarity = 0;
4486 spec->gpio_mute_led_mask = 0x08;
4487
4488 /* Initialize GPIO configuration */
4489 snd_hda_add_verbs(codec, gpio_init);
4490 }
4491}
4492
4444/* for hda_fixup_thinkpad_acpi() */ 4493/* for hda_fixup_thinkpad_acpi() */
4445#include "thinkpad_helper.c" 4494#include "thinkpad_helper.c"
4446 4495
@@ -4521,6 +4570,7 @@ enum {
4521 ALC286_FIXUP_HP_GPIO_LED, 4570 ALC286_FIXUP_HP_GPIO_LED,
4522 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, 4571 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
4523 ALC280_FIXUP_HP_DOCK_PINS, 4572 ALC280_FIXUP_HP_DOCK_PINS,
4573 ALC280_FIXUP_HP_9480M,
4524 ALC288_FIXUP_DELL_HEADSET_MODE, 4574 ALC288_FIXUP_DELL_HEADSET_MODE,
4525 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, 4575 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
4526 ALC288_FIXUP_DELL_XPS_13_GPIO6, 4576 ALC288_FIXUP_DELL_XPS_13_GPIO6,
@@ -5043,6 +5093,10 @@ static const struct hda_fixup alc269_fixups[] = {
5043 .chained = true, 5093 .chained = true,
5044 .chain_id = ALC280_FIXUP_HP_GPIO4 5094 .chain_id = ALC280_FIXUP_HP_GPIO4
5045 }, 5095 },
5096 [ALC280_FIXUP_HP_9480M] = {
5097 .type = HDA_FIXUP_FUNC,
5098 .v.func = alc280_fixup_hp_9480m,
5099 },
5046 [ALC288_FIXUP_DELL_HEADSET_MODE] = { 5100 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
5047 .type = HDA_FIXUP_FUNC, 5101 .type = HDA_FIXUP_FUNC,
5048 .v.func = alc_fixup_headset_mode_dell_alc288, 5102 .v.func = alc_fixup_headset_mode_dell_alc288,
@@ -5161,6 +5215,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5161 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 5215 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5162 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 5216 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5163 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 5217 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
5218 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
5164 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 5219 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5165 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), 5220 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
5166 /* ALC290 */ 5221 /* ALC290 */
diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 477e13d30971..e7ba557979cb 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -102,7 +102,7 @@ static int pcm1681_set_deemph(struct snd_soc_codec *codec)
102 102
103 if (val != -1) { 103 if (val != -1) {
104 regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL, 104 regmap_update_bits(priv->regmap, PCM1681_DEEMPH_CONTROL,
105 PCM1681_DEEMPH_RATE_MASK, val); 105 PCM1681_DEEMPH_RATE_MASK, val << 3);
106 enable = 1; 106 enable = 1;
107 } else 107 } else
108 enable = 0; 108 enable = 0;
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 9ce311e088fc..e9cc3aae5366 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -2943,6 +2943,9 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645)
2943{ 2943{
2944 int val, btn_type, gpio_state = 0, report = 0; 2944 int val, btn_type, gpio_state = 0, report = 0;
2945 2945
2946 if (!rt5645->codec)
2947 return -EINVAL;
2948
2946 switch (rt5645->pdata.jd_mode) { 2949 switch (rt5645->pdata.jd_mode) {
2947 case 0: /* Not using rt5645 JD */ 2950 case 0: /* Not using rt5645 JD */
2948 if (rt5645->gpiod_hp_det) { 2951 if (rt5645->gpiod_hp_det) {
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
index bd7a344bf8c5..1c317de26176 100644
--- a/sound/soc/codecs/sgtl5000.h
+++ b/sound/soc/codecs/sgtl5000.h
@@ -275,7 +275,7 @@
275#define SGTL5000_BIAS_CTRL_MASK 0x000e 275#define SGTL5000_BIAS_CTRL_MASK 0x000e
276#define SGTL5000_BIAS_CTRL_SHIFT 1 276#define SGTL5000_BIAS_CTRL_SHIFT 1
277#define SGTL5000_BIAS_CTRL_WIDTH 3 277#define SGTL5000_BIAS_CTRL_WIDTH 3
278#define SGTL5000_SMALL_POP 0 278#define SGTL5000_SMALL_POP 1
279 279
280/* 280/*
281 * SGTL5000_CHIP_MIC_CTRL 281 * SGTL5000_CHIP_MIC_CTRL
diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
index 938d2cb6d78b..84a4f5ad8064 100644
--- a/sound/soc/codecs/ssm4567.c
+++ b/sound/soc/codecs/ssm4567.c
@@ -315,7 +315,13 @@ static int ssm4567_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
315 if (invert_fclk) 315 if (invert_fclk)
316 ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC; 316 ctrl1 |= SSM4567_SAI_CTRL_1_FSYNC;
317 317
318 return regmap_write(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1, ctrl1); 318 return regmap_update_bits(ssm4567->regmap, SSM4567_REG_SAI_CTRL_1,
319 SSM4567_SAI_CTRL_1_BCLK |
320 SSM4567_SAI_CTRL_1_FSYNC |
321 SSM4567_SAI_CTRL_1_LJ |
322 SSM4567_SAI_CTRL_1_TDM |
323 SSM4567_SAI_CTRL_1_PDM,
324 ctrl1);
319} 325}
320 326
321static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable) 327static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index c7647e066cfd..c0b940e2019f 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -633,7 +633,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
633 sub *= 100000; 633 sub *= 100000;
634 do_div(sub, freq); 634 do_div(sub, freq);
635 635
636 if (sub < savesub) { 636 if (sub < savesub && !(i == 0 && psr == 0 && div2 == 0)) {
637 baudrate = tmprate; 637 baudrate = tmprate;
638 savesub = sub; 638 savesub = sub;
639 pm = i; 639 pm = i;
diff --git a/sound/soc/intel/Makefile b/sound/soc/intel/Makefile
index 3853ec2ddbc7..6de5d5cd3280 100644
--- a/sound/soc/intel/Makefile
+++ b/sound/soc/intel/Makefile
@@ -7,4 +7,4 @@ obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += baytrail/
7obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += atom/ 7obj-$(CONFIG_SND_SST_MFLD_PLATFORM) += atom/
8 8
9# Machine support 9# Machine support
10obj-$(CONFIG_SND_SOC_INTEL_SST) += boards/ 10obj-$(CONFIG_SND_SOC) += boards/
diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 620da1d1b9e3..0e0e4d9c021f 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -42,6 +42,11 @@
42#define MIN_FRAGMENT_SIZE (50 * 1024) 42#define MIN_FRAGMENT_SIZE (50 * 1024)
43#define MAX_FRAGMENT_SIZE (1024 * 1024) 43#define MAX_FRAGMENT_SIZE (1024 * 1024)
44#define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz) (((pcm_wd_sz + 15) >> 4) << 1) 44#define SST_GET_BYTES_PER_SAMPLE(pcm_wd_sz) (((pcm_wd_sz + 15) >> 4) << 1)
45#ifdef CONFIG_PM
46#define GET_USAGE_COUNT(dev) (atomic_read(&dev->power.usage_count))
47#else
48#define GET_USAGE_COUNT(dev) 1
49#endif
45 50
46int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id) 51int free_stream_context(struct intel_sst_drv *ctx, unsigned int str_id)
47{ 52{
@@ -141,15 +146,9 @@ static int sst_power_control(struct device *dev, bool state)
141 int ret = 0; 146 int ret = 0;
142 int usage_count = 0; 147 int usage_count = 0;
143 148
144#ifdef CONFIG_PM
145 usage_count = atomic_read(&dev->power.usage_count);
146#else
147 usage_count = 1;
148#endif
149
150 if (state == true) { 149 if (state == true) {
151 ret = pm_runtime_get_sync(dev); 150 ret = pm_runtime_get_sync(dev);
152 151 usage_count = GET_USAGE_COUNT(dev);
153 dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count); 152 dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
154 if (ret < 0) { 153 if (ret < 0) {
155 dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret); 154 dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
@@ -164,6 +163,7 @@ static int sst_power_control(struct device *dev, bool state)
164 } 163 }
165 } 164 }
166 } else { 165 } else {
166 usage_count = GET_USAGE_COUNT(dev);
167 dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count); 167 dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
168 return sst_pm_runtime_put(ctx); 168 return sst_pm_runtime_put(ctx);
169 } 169 }
diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index d604ee80eda4..70f832114a5a 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -69,12 +69,12 @@ static const struct snd_soc_dapm_route cht_audio_map[] = {
69 {"Headphone", NULL, "HPR"}, 69 {"Headphone", NULL, "HPR"},
70 {"Ext Spk", NULL, "SPKL"}, 70 {"Ext Spk", NULL, "SPKL"},
71 {"Ext Spk", NULL, "SPKR"}, 71 {"Ext Spk", NULL, "SPKR"},
72 {"AIF1 Playback", NULL, "ssp2 Tx"}, 72 {"HiFi Playback", NULL, "ssp2 Tx"},
73 {"ssp2 Tx", NULL, "codec_out0"}, 73 {"ssp2 Tx", NULL, "codec_out0"},
74 {"ssp2 Tx", NULL, "codec_out1"}, 74 {"ssp2 Tx", NULL, "codec_out1"},
75 {"codec_in0", NULL, "ssp2 Rx" }, 75 {"codec_in0", NULL, "ssp2 Rx" },
76 {"codec_in1", NULL, "ssp2 Rx" }, 76 {"codec_in1", NULL, "ssp2 Rx" },
77 {"ssp2 Rx", NULL, "AIF1 Capture"}, 77 {"ssp2 Rx", NULL, "HiFi Capture"},
78}; 78};
79 79
80static const struct snd_kcontrol_new cht_mc_controls[] = { 80static const struct snd_kcontrol_new cht_mc_controls[] = {
diff --git a/sound/soc/mediatek/mt8173-max98090.c b/sound/soc/mediatek/mt8173-max98090.c
index 4d44b5803e55..2d2536af141f 100644
--- a/sound/soc/mediatek/mt8173-max98090.c
+++ b/sound/soc/mediatek/mt8173-max98090.c
@@ -103,7 +103,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
103 .name = "MAX98090 Playback", 103 .name = "MAX98090 Playback",
104 .stream_name = "MAX98090 Playback", 104 .stream_name = "MAX98090 Playback",
105 .cpu_dai_name = "DL1", 105 .cpu_dai_name = "DL1",
106 .platform_name = "11220000.mt8173-afe-pcm",
107 .codec_name = "snd-soc-dummy", 106 .codec_name = "snd-soc-dummy",
108 .codec_dai_name = "snd-soc-dummy-dai", 107 .codec_dai_name = "snd-soc-dummy-dai",
109 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 108 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -114,7 +113,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
114 .name = "MAX98090 Capture", 113 .name = "MAX98090 Capture",
115 .stream_name = "MAX98090 Capture", 114 .stream_name = "MAX98090 Capture",
116 .cpu_dai_name = "VUL", 115 .cpu_dai_name = "VUL",
117 .platform_name = "11220000.mt8173-afe-pcm",
118 .codec_name = "snd-soc-dummy", 116 .codec_name = "snd-soc-dummy",
119 .codec_dai_name = "snd-soc-dummy-dai", 117 .codec_dai_name = "snd-soc-dummy-dai",
120 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 118 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -125,7 +123,6 @@ static struct snd_soc_dai_link mt8173_max98090_dais[] = {
125 { 123 {
126 .name = "Codec", 124 .name = "Codec",
127 .cpu_dai_name = "I2S", 125 .cpu_dai_name = "I2S",
128 .platform_name = "11220000.mt8173-afe-pcm",
129 .no_pcm = 1, 126 .no_pcm = 1,
130 .codec_dai_name = "HiFi", 127 .codec_dai_name = "HiFi",
131 .init = mt8173_max98090_init, 128 .init = mt8173_max98090_init,
@@ -152,9 +149,21 @@ static struct snd_soc_card mt8173_max98090_card = {
152static int mt8173_max98090_dev_probe(struct platform_device *pdev) 149static int mt8173_max98090_dev_probe(struct platform_device *pdev)
153{ 150{
154 struct snd_soc_card *card = &mt8173_max98090_card; 151 struct snd_soc_card *card = &mt8173_max98090_card;
155 struct device_node *codec_node; 152 struct device_node *codec_node, *platform_node;
156 int ret, i; 153 int ret, i;
157 154
155 platform_node = of_parse_phandle(pdev->dev.of_node,
156 "mediatek,platform", 0);
157 if (!platform_node) {
158 dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
159 return -EINVAL;
160 }
161 for (i = 0; i < card->num_links; i++) {
162 if (mt8173_max98090_dais[i].platform_name)
163 continue;
164 mt8173_max98090_dais[i].platform_of_node = platform_node;
165 }
166
158 codec_node = of_parse_phandle(pdev->dev.of_node, 167 codec_node = of_parse_phandle(pdev->dev.of_node,
159 "mediatek,audio-codec", 0); 168 "mediatek,audio-codec", 0);
160 if (!codec_node) { 169 if (!codec_node) {
diff --git a/sound/soc/mediatek/mt8173-rt5650-rt5676.c b/sound/soc/mediatek/mt8173-rt5650-rt5676.c
index 094055323059..6f52eca05e26 100644
--- a/sound/soc/mediatek/mt8173-rt5650-rt5676.c
+++ b/sound/soc/mediatek/mt8173-rt5650-rt5676.c
@@ -138,7 +138,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
138 .name = "rt5650_rt5676 Playback", 138 .name = "rt5650_rt5676 Playback",
139 .stream_name = "rt5650_rt5676 Playback", 139 .stream_name = "rt5650_rt5676 Playback",
140 .cpu_dai_name = "DL1", 140 .cpu_dai_name = "DL1",
141 .platform_name = "11220000.mt8173-afe-pcm",
142 .codec_name = "snd-soc-dummy", 141 .codec_name = "snd-soc-dummy",
143 .codec_dai_name = "snd-soc-dummy-dai", 142 .codec_dai_name = "snd-soc-dummy-dai",
144 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 143 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -149,7 +148,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
149 .name = "rt5650_rt5676 Capture", 148 .name = "rt5650_rt5676 Capture",
150 .stream_name = "rt5650_rt5676 Capture", 149 .stream_name = "rt5650_rt5676 Capture",
151 .cpu_dai_name = "VUL", 150 .cpu_dai_name = "VUL",
152 .platform_name = "11220000.mt8173-afe-pcm",
153 .codec_name = "snd-soc-dummy", 151 .codec_name = "snd-soc-dummy",
154 .codec_dai_name = "snd-soc-dummy-dai", 152 .codec_dai_name = "snd-soc-dummy-dai",
155 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, 153 .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
@@ -161,7 +159,6 @@ static struct snd_soc_dai_link mt8173_rt5650_rt5676_dais[] = {
161 { 159 {
162 .name = "Codec", 160 .name = "Codec",
163 .cpu_dai_name = "I2S", 161 .cpu_dai_name = "I2S",
164 .platform_name = "11220000.mt8173-afe-pcm",
165 .no_pcm = 1, 162 .no_pcm = 1,
166 .codecs = mt8173_rt5650_rt5676_codecs, 163 .codecs = mt8173_rt5650_rt5676_codecs,
167 .num_codecs = 2, 164 .num_codecs = 2,
@@ -209,7 +206,21 @@ static struct snd_soc_card mt8173_rt5650_rt5676_card = {
209static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev) 206static int mt8173_rt5650_rt5676_dev_probe(struct platform_device *pdev)
210{ 207{
211 struct snd_soc_card *card = &mt8173_rt5650_rt5676_card; 208 struct snd_soc_card *card = &mt8173_rt5650_rt5676_card;
212 int ret; 209 struct device_node *platform_node;
210 int i, ret;
211
212 platform_node = of_parse_phandle(pdev->dev.of_node,
213 "mediatek,platform", 0);
214 if (!platform_node) {
215 dev_err(&pdev->dev, "Property 'platform' missing or invalid\n");
216 return -EINVAL;
217 }
218
219 for (i = 0; i < card->num_links; i++) {
220 if (mt8173_rt5650_rt5676_dais[i].platform_name)
221 continue;
222 mt8173_rt5650_rt5676_dais[i].platform_of_node = platform_node;
223 }
213 224
214 mt8173_rt5650_rt5676_codecs[0].of_node = 225 mt8173_rt5650_rt5676_codecs[0].of_node =
215 of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0); 226 of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 0);
diff --git a/sound/soc/mediatek/mtk-afe-pcm.c b/sound/soc/mediatek/mtk-afe-pcm.c
index cc228db5fb76..9863da73dfe0 100644
--- a/sound/soc/mediatek/mtk-afe-pcm.c
+++ b/sound/soc/mediatek/mtk-afe-pcm.c
@@ -1199,6 +1199,8 @@ err_pm_disable:
1199static int mtk_afe_pcm_dev_remove(struct platform_device *pdev) 1199static int mtk_afe_pcm_dev_remove(struct platform_device *pdev)
1200{ 1200{
1201 pm_runtime_disable(&pdev->dev); 1201 pm_runtime_disable(&pdev->dev);
1202 if (!pm_runtime_status_suspended(&pdev->dev))
1203 mtk_afe_runtime_suspend(&pdev->dev);
1202 snd_soc_unregister_component(&pdev->dev); 1204 snd_soc_unregister_component(&pdev->dev);
1203 snd_soc_unregister_platform(&pdev->dev); 1205 snd_soc_unregister_platform(&pdev->dev);
1204 return 0; 1206 return 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a4a5c0e3f97..0e1e69c7abd5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1716,6 +1716,7 @@ card_probe_error:
1716 if (card->remove) 1716 if (card->remove)
1717 card->remove(card); 1717 card->remove(card);
1718 1718
1719 snd_soc_dapm_free(&card->dapm);
1719 soc_cleanup_card_debugfs(card); 1720 soc_cleanup_card_debugfs(card);
1720 snd_card_free(card->snd_card); 1721 snd_card_free(card->snd_card);
1721 1722
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index aa327c92480c..e0de8072c514 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -358,9 +358,10 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
358 data->widget = 358 data->widget =
359 snd_soc_dapm_new_control_unlocked(widget->dapm, 359 snd_soc_dapm_new_control_unlocked(widget->dapm,
360 &template); 360 &template);
361 kfree(name);
361 if (!data->widget) { 362 if (!data->widget) {
362 ret = -ENOMEM; 363 ret = -ENOMEM;
363 goto err_name; 364 goto err_data;
364 } 365 }
365 } 366 }
366 break; 367 break;
@@ -389,11 +390,12 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
389 390
390 data->value = template.on_val; 391 data->value = template.on_val;
391 392
392 data->widget = snd_soc_dapm_new_control(widget->dapm, 393 data->widget = snd_soc_dapm_new_control_unlocked(
393 &template); 394 widget->dapm, &template);
395 kfree(name);
394 if (!data->widget) { 396 if (!data->widget) {
395 ret = -ENOMEM; 397 ret = -ENOMEM;
396 goto err_name; 398 goto err_data;
397 } 399 }
398 400
399 snd_soc_dapm_add_path(widget->dapm, data->widget, 401 snd_soc_dapm_add_path(widget->dapm, data->widget,
@@ -408,8 +410,6 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
408 410
409 return 0; 411 return 0;
410 412
411err_name:
412 kfree(name);
413err_data: 413err_data:
414 kfree(data); 414 kfree(data);
415 return ret; 415 return ret;
@@ -418,8 +418,6 @@ err_data:
418static void dapm_kcontrol_free(struct snd_kcontrol *kctl) 418static void dapm_kcontrol_free(struct snd_kcontrol *kctl)
419{ 419{
420 struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); 420 struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl);
421 if (data->widget)
422 kfree(data->widget->name);
423 kfree(data->wlist); 421 kfree(data->wlist);
424 kfree(data); 422 kfree(data);
425} 423}
@@ -1952,6 +1950,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1952 size_t count, loff_t *ppos) 1950 size_t count, loff_t *ppos)
1953{ 1951{
1954 struct snd_soc_dapm_widget *w = file->private_data; 1952 struct snd_soc_dapm_widget *w = file->private_data;
1953 struct snd_soc_card *card = w->dapm->card;
1955 char *buf; 1954 char *buf;
1956 int in, out; 1955 int in, out;
1957 ssize_t ret; 1956 ssize_t ret;
@@ -1961,6 +1960,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
1961 if (!buf) 1960 if (!buf)
1962 return -ENOMEM; 1961 return -ENOMEM;
1963 1962
1963 mutex_lock(&card->dapm_mutex);
1964
1964 /* Supply widgets are not handled by is_connected_{input,output}_ep() */ 1965 /* Supply widgets are not handled by is_connected_{input,output}_ep() */
1965 if (w->is_supply) { 1966 if (w->is_supply) {
1966 in = 0; 1967 in = 0;
@@ -2007,6 +2008,8 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
2007 p->sink->name); 2008 p->sink->name);
2008 } 2009 }
2009 2010
2011 mutex_unlock(&card->dapm_mutex);
2012
2010 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); 2013 ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
2011 2014
2012 kfree(buf); 2015 kfree(buf);
@@ -2281,11 +2284,15 @@ static ssize_t dapm_widget_show(struct device *dev,
2281 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev); 2284 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
2282 int i, count = 0; 2285 int i, count = 0;
2283 2286
2287 mutex_lock(&rtd->card->dapm_mutex);
2288
2284 for (i = 0; i < rtd->num_codecs; i++) { 2289 for (i = 0; i < rtd->num_codecs; i++) {
2285 struct snd_soc_codec *codec = rtd->codec_dais[i]->codec; 2290 struct snd_soc_codec *codec = rtd->codec_dais[i]->codec;
2286 count += dapm_widget_show_codec(codec, buf + count); 2291 count += dapm_widget_show_codec(codec, buf + count);
2287 } 2292 }
2288 2293
2294 mutex_unlock(&rtd->card->dapm_mutex);
2295
2289 return count; 2296 return count;
2290} 2297}
2291 2298
@@ -3334,16 +3341,10 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,
3334 } 3341 }
3335 3342
3336 prefix = soc_dapm_prefix(dapm); 3343 prefix = soc_dapm_prefix(dapm);
3337 if (prefix) { 3344 if (prefix)
3338 w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); 3345 w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name);
3339 if (widget->sname) 3346 else
3340 w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix,
3341 widget->sname);
3342 } else {
3343 w->name = kasprintf(GFP_KERNEL, "%s", widget->name); 3347 w->name = kasprintf(GFP_KERNEL, "%s", widget->name);
3344 if (widget->sname)
3345 w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname);
3346 }
3347 if (w->name == NULL) { 3348 if (w->name == NULL) {
3348 kfree(w); 3349 kfree(w);
3349 return NULL; 3350 return NULL;
@@ -3792,7 +3793,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
3792 break; 3793 break;
3793 } 3794 }
3794 3795
3795 if (!w->sname || !strstr(w->sname, dai_w->name)) 3796 if (!w->sname || !strstr(w->sname, dai_w->sname))
3796 continue; 3797 continue;
3797 3798
3798 if (dai_w->id == snd_soc_dapm_dai_in) { 3799 if (dai_w->id == snd_soc_dapm_dai_in) {
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 9f2b048f1071..2c70f30d2d78 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -144,7 +144,7 @@ static const struct snd_soc_tplg_kcontrol_ops io_ops[] = {
144 {SND_SOC_TPLG_CTL_STROBE, snd_soc_get_strobe, 144 {SND_SOC_TPLG_CTL_STROBE, snd_soc_get_strobe,
145 snd_soc_put_strobe, NULL}, 145 snd_soc_put_strobe, NULL},
146 {SND_SOC_TPLG_DAPM_CTL_VOLSW, snd_soc_dapm_get_volsw, 146 {SND_SOC_TPLG_DAPM_CTL_VOLSW, snd_soc_dapm_get_volsw,
147 snd_soc_dapm_put_volsw, NULL}, 147 snd_soc_dapm_put_volsw, snd_soc_info_volsw},
148 {SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE, snd_soc_dapm_get_enum_double, 148 {SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE, snd_soc_dapm_get_enum_double,
149 snd_soc_dapm_put_enum_double, snd_soc_info_enum_double}, 149 snd_soc_dapm_put_enum_double, snd_soc_info_enum_double},
150 {SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT, snd_soc_dapm_get_enum_double, 150 {SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT, snd_soc_dapm_get_enum_double,
@@ -580,27 +580,26 @@ static int soc_tplg_init_kcontrol(struct soc_tplg *tplg,
580} 580}
581 581
582static int soc_tplg_create_tlv(struct soc_tplg *tplg, 582static int soc_tplg_create_tlv(struct soc_tplg *tplg,
583 struct snd_kcontrol_new *kc, u32 tlv_size) 583 struct snd_kcontrol_new *kc, struct snd_soc_tplg_ctl_tlv *tplg_tlv)
584{ 584{
585 struct snd_soc_tplg_ctl_tlv *tplg_tlv;
586 struct snd_ctl_tlv *tlv; 585 struct snd_ctl_tlv *tlv;
586 int size;
587 587
588 if (tlv_size == 0) 588 if (tplg_tlv->count == 0)
589 return 0; 589 return 0;
590 590
591 tplg_tlv = (struct snd_soc_tplg_ctl_tlv *) tplg->pos; 591 size = ((tplg_tlv->count + (sizeof(unsigned int) - 1)) &
592 tplg->pos += tlv_size; 592 ~(sizeof(unsigned int) - 1));
593 593 tlv = kzalloc(sizeof(*tlv) + size, GFP_KERNEL);
594 tlv = kzalloc(sizeof(*tlv) + tlv_size, GFP_KERNEL);
595 if (tlv == NULL) 594 if (tlv == NULL)
596 return -ENOMEM; 595 return -ENOMEM;
597 596
598 dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n", 597 dev_dbg(tplg->dev, " created TLV type %d size %d bytes\n",
599 tplg_tlv->numid, tplg_tlv->size); 598 tplg_tlv->numid, size);
600 599
601 tlv->numid = tplg_tlv->numid; 600 tlv->numid = tplg_tlv->numid;
602 tlv->length = tplg_tlv->size; 601 tlv->length = size;
603 memcpy(tlv->tlv, tplg_tlv + 1, tplg_tlv->size); 602 memcpy(&tlv->tlv[0], tplg_tlv->data, size);
604 kc->tlv.p = (void *)tlv; 603 kc->tlv.p = (void *)tlv;
605 604
606 return 0; 605 return 0;
@@ -773,7 +772,7 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
773 } 772 }
774 773
775 /* create any TLV data */ 774 /* create any TLV data */
776 soc_tplg_create_tlv(tplg, &kc, mc->hdr.tlv_size); 775 soc_tplg_create_tlv(tplg, &kc, &mc->tlv);
777 776
778 /* register control here */ 777 /* register control here */
779 err = soc_tplg_add_kcontrol(tplg, &kc, 778 err = soc_tplg_add_kcontrol(tplg, &kc,
diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
index 98d96e1b17e0..1930c42e1f55 100644
--- a/sound/soc/zte/zx296702-i2s.c
+++ b/sound/soc/zte/zx296702-i2s.c
@@ -393,9 +393,9 @@ static int zx_i2s_probe(struct platform_device *pdev)
393 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 393 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
394 zx_i2s->mapbase = res->start; 394 zx_i2s->mapbase = res->start;
395 zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res); 395 zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res);
396 if (!zx_i2s->reg_base) { 396 if (IS_ERR(zx_i2s->reg_base)) {
397 dev_err(&pdev->dev, "ioremap failed!\n"); 397 dev_err(&pdev->dev, "ioremap failed!\n");
398 return -EIO; 398 return PTR_ERR(zx_i2s->reg_base);
399 } 399 }
400 400
401 writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL); 401 writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
diff --git a/sound/soc/zte/zx296702-spdif.c b/sound/soc/zte/zx296702-spdif.c
index 11a0e46a1156..26265ce4caca 100644
--- a/sound/soc/zte/zx296702-spdif.c
+++ b/sound/soc/zte/zx296702-spdif.c
@@ -322,9 +322,9 @@ static int zx_spdif_probe(struct platform_device *pdev)
322 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 322 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
323 zx_spdif->mapbase = res->start; 323 zx_spdif->mapbase = res->start;
324 zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res); 324 zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res);
325 if (!zx_spdif->reg_base) { 325 if (IS_ERR(zx_spdif->reg_base)) {
326 dev_err(&pdev->dev, "ioremap failed!\n"); 326 dev_err(&pdev->dev, "ioremap failed!\n");
327 return -EIO; 327 return PTR_ERR(zx_spdif->reg_base);
328 } 328 }
329 329
330 zx_spdif_dev_init(zx_spdif->reg_base); 330 zx_spdif_dev_init(zx_spdif->reg_base);
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index 8461d6bf992f..204cc074adb9 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -186,12 +186,8 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction,
186 int ret = 0; 186 int ret = 0;
187 187
188 spin_lock_irqsave(&pstr->lock, flags); 188 spin_lock_irqsave(&pstr->lock, flags);
189 if (!test_and_set_bit(type, &pstr->running)) { 189 if (!test_and_set_bit(type, &pstr->running) &&
190 if (pstr->active_urbs || pstr->unlink_urbs) { 190 !(pstr->active_urbs || pstr->unlink_urbs)) {
191 ret = -EBUSY;
192 goto error;
193 }
194
195 pstr->count = 0; 191 pstr->count = 0;
196 /* Submit all currently available URBs */ 192 /* Submit all currently available URBs */
197 if (direction == SNDRV_PCM_STREAM_PLAYBACK) 193 if (direction == SNDRV_PCM_STREAM_PLAYBACK)
@@ -199,7 +195,6 @@ static int line6_stream_start(struct snd_line6_pcm *line6pcm, int direction,
199 else 195 else
200 ret = line6_submit_audio_in_all_urbs(line6pcm); 196 ret = line6_submit_audio_in_all_urbs(line6pcm);
201 } 197 }
202 error:
203 if (ret < 0) 198 if (ret < 0)
204 clear_bit(type, &pstr->running); 199 clear_bit(type, &pstr->running);
205 spin_unlock_irqrestore(&pstr->lock, flags); 200 spin_unlock_irqrestore(&pstr->lock, flags);
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 2f6d3e9a1bcd..e4756651a52c 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -2512,6 +2512,74 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2512 } 2512 }
2513}, 2513},
2514 2514
2515/* Steinberg devices */
2516{
2517 /* Steinberg MI2 */
2518 USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x2040),
2519 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2520 .ifnum = QUIRK_ANY_INTERFACE,
2521 .type = QUIRK_COMPOSITE,
2522 .data = & (const struct snd_usb_audio_quirk[]) {
2523 {
2524 .ifnum = 0,
2525 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2526 },
2527 {
2528 .ifnum = 1,
2529 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2530 },
2531 {
2532 .ifnum = 2,
2533 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2534 },
2535 {
2536 .ifnum = 3,
2537 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2538 .data = &(const struct snd_usb_midi_endpoint_info) {
2539 .out_cables = 0x0001,
2540 .in_cables = 0x0001
2541 }
2542 },
2543 {
2544 .ifnum = -1
2545 }
2546 }
2547 }
2548},
2549{
2550 /* Steinberg MI4 */
2551 USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x4040),
2552 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2553 .ifnum = QUIRK_ANY_INTERFACE,
2554 .type = QUIRK_COMPOSITE,
2555 .data = & (const struct snd_usb_audio_quirk[]) {
2556 {
2557 .ifnum = 0,
2558 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2559 },
2560 {
2561 .ifnum = 1,
2562 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2563 },
2564 {
2565 .ifnum = 2,
2566 .type = QUIRK_AUDIO_STANDARD_INTERFACE
2567 },
2568 {
2569 .ifnum = 3,
2570 .type = QUIRK_MIDI_FIXED_ENDPOINT,
2571 .data = &(const struct snd_usb_midi_endpoint_info) {
2572 .out_cables = 0x0001,
2573 .in_cables = 0x0001
2574 }
2575 },
2576 {
2577 .ifnum = -1
2578 }
2579 }
2580 }
2581},
2582
2515/* TerraTec devices */ 2583/* TerraTec devices */
2516{ 2584{
2517 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), 2585 USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012),
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 8bd960658463..fe1b02c2c95b 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -36,7 +36,7 @@ $(LIBFILE): $(API_IN)
36 36
37clean: 37clean:
38 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \ 38 $(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
39 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM) 39 find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
40 40
41FORCE: 41FORCE:
42 42
diff --git a/tools/lib/hweight.c b/tools/lib/hweight.c
new file mode 100644
index 000000000000..0b859b884339
--- /dev/null
+++ b/tools/lib/hweight.c
@@ -0,0 +1,62 @@
1#include <linux/bitops.h>
2#include <asm/types.h>
3
4/**
5 * hweightN - returns the hamming weight of a N-bit word
6 * @x: the word to weigh
7 *
8 * The Hamming Weight of a number is the total number of bits set in it.
9 */
10
11unsigned int __sw_hweight32(unsigned int w)
12{
13#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
14 w -= (w >> 1) & 0x55555555;
15 w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
16 w = (w + (w >> 4)) & 0x0f0f0f0f;
17 return (w * 0x01010101) >> 24;
18#else
19 unsigned int res = w - ((w >> 1) & 0x55555555);
20 res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
21 res = (res + (res >> 4)) & 0x0F0F0F0F;
22 res = res + (res >> 8);
23 return (res + (res >> 16)) & 0x000000FF;
24#endif
25}
26
27unsigned int __sw_hweight16(unsigned int w)
28{
29 unsigned int res = w - ((w >> 1) & 0x5555);
30 res = (res & 0x3333) + ((res >> 2) & 0x3333);
31 res = (res + (res >> 4)) & 0x0F0F;
32 return (res + (res >> 8)) & 0x00FF;
33}
34
35unsigned int __sw_hweight8(unsigned int w)
36{
37 unsigned int res = w - ((w >> 1) & 0x55);
38 res = (res & 0x33) + ((res >> 2) & 0x33);
39 return (res + (res >> 4)) & 0x0F;
40}
41
42unsigned long __sw_hweight64(__u64 w)
43{
44#if BITS_PER_LONG == 32
45 return __sw_hweight32((unsigned int)(w >> 32)) +
46 __sw_hweight32((unsigned int)w);
47#elif BITS_PER_LONG == 64
48#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
49 w -= (w >> 1) & 0x5555555555555555ul;
50 w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul);
51 w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful;
52 return (w * 0x0101010101010101ul) >> 56;
53#else
54 __u64 res = w - ((w >> 1) & 0x5555555555555555ul);
55 res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
56 res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful;
57 res = res + (res >> 8);
58 res = res + (res >> 16);
59 return (res + (res >> 32)) & 0x00000000000000FFul;
60#endif
61#endif
62}
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 6daaff652aff..7851df1490e0 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -268,7 +268,7 @@ install: install_lib
268 268
269clean: 269clean:
270 $(call QUIET_CLEAN, libtraceevent) \ 270 $(call QUIET_CLEAN, libtraceevent) \
271 $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \ 271 $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
272 $(RM) TRACEEVENT-CFLAGS tags TAGS 272 $(RM) TRACEEVENT-CFLAGS tags TAGS
273 273
274PHONY += force plugins 274PHONY += force plugins
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 09dc0aabb515..d01a0aad5a01 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -18,6 +18,7 @@ tools/arch/x86/include/asm/atomic.h
18tools/arch/x86/include/asm/rmwcc.h 18tools/arch/x86/include/asm/rmwcc.h
19tools/lib/traceevent 19tools/lib/traceevent
20tools/lib/api 20tools/lib/api
21tools/lib/hweight.c
21tools/lib/rbtree.c 22tools/lib/rbtree.c
22tools/lib/symbol/kallsyms.c 23tools/lib/symbol/kallsyms.c
23tools/lib/symbol/kallsyms.h 24tools/lib/symbol/kallsyms.h
@@ -57,7 +58,6 @@ include/linux/perf_event.h
57include/linux/list.h 58include/linux/list.h
58include/linux/hash.h 59include/linux/hash.h
59include/linux/stringify.h 60include/linux/stringify.h
60lib/hweight.c
61include/linux/swab.h 61include/linux/swab.h
62arch/*/include/asm/unistd*.h 62arch/*/include/asm/unistd*.h
63arch/*/include/uapi/asm/unistd*.h 63arch/*/include/uapi/asm/unistd*.h
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 7a4b549214e3..bba34636b733 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -109,9 +109,22 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
109 $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 109 $(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
110 $(Q)touch $(OUTPUT)PERF-VERSION-FILE 110 $(Q)touch $(OUTPUT)PERF-VERSION-FILE
111 111
112CC = $(CROSS_COMPILE)gcc 112# Makefiles suck: This macro sets a default value of $(2) for the
113LD ?= $(CROSS_COMPILE)ld 113# variable named by $(1), unless the variable has been set by
114AR = $(CROSS_COMPILE)ar 114# environment or command line. This is necessary for CC and AR
115# because make sets default values, so the simpler ?= approach
116# won't work as expected.
117define allow-override
118 $(if $(or $(findstring environment,$(origin $(1))),\
119 $(findstring command line,$(origin $(1)))),,\
120 $(eval $(1) = $(2)))
121endef
122
123# Allow setting CC and AR and LD, or setting CROSS_COMPILE as a prefix.
124$(call allow-override,CC,$(CROSS_COMPILE)gcc)
125$(call allow-override,AR,$(CROSS_COMPILE)ar)
126$(call allow-override,LD,$(CROSS_COMPILE)ld)
127
115PKG_CONFIG = $(CROSS_COMPILE)pkg-config 128PKG_CONFIG = $(CROSS_COMPILE)pkg-config
116 129
117RM = rm -f 130RM = rm -f
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 37e301a32f43..d99d850e1444 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -343,7 +343,7 @@ static int read_counter(struct perf_evsel *counter)
343 return 0; 343 return 0;
344} 344}
345 345
346static void read_counters(bool close) 346static void read_counters(bool close_counters)
347{ 347{
348 struct perf_evsel *counter; 348 struct perf_evsel *counter;
349 349
@@ -354,7 +354,7 @@ static void read_counters(bool close)
354 if (process_counter(counter)) 354 if (process_counter(counter))
355 pr_warning("failed to process counter %s\n", counter->name); 355 pr_warning("failed to process counter %s\n", counter->name);
356 356
357 if (close) { 357 if (close_counters) {
358 perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter), 358 perf_evsel__close_fd(counter, perf_evsel__nr_cpus(counter),
359 thread_map__nr(evsel_list->threads)); 359 thread_map__nr(evsel_list->threads));
360 } 360 }
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 7629bef2fd79..fa67613976a8 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -48,7 +48,7 @@ static struct rb_node *hists__filter_entries(struct rb_node *nd,
48 48
49static bool hist_browser__has_filter(struct hist_browser *hb) 49static bool hist_browser__has_filter(struct hist_browser *hb)
50{ 50{
51 return hists__has_filter(hb->hists) || hb->min_pcnt; 51 return hists__has_filter(hb->hists) || hb->min_pcnt || symbol_conf.has_filter;
52} 52}
53 53
54static int hist_browser__get_folding(struct hist_browser *browser) 54static int hist_browser__get_folding(struct hist_browser *browser)
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 601d11440596..d2d318c59b37 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -143,6 +143,6 @@ $(OUTPUT)util/rbtree.o: ../lib/rbtree.c FORCE
143 $(call rule_mkdir) 143 $(call rule_mkdir)
144 $(call if_changed_dep,cc_o_c) 144 $(call if_changed_dep,cc_o_c)
145 145
146$(OUTPUT)util/hweight.o: ../../lib/hweight.c FORCE 146$(OUTPUT)util/hweight.o: ../lib/hweight.c FORCE
147 $(call rule_mkdir) 147 $(call rule_mkdir)
148 $(call if_changed_dep,cc_o_c) 148 $(call if_changed_dep,cc_o_c)
diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
index 7e7405c9b936..83d9dd96fe08 100644
--- a/tools/perf/util/auxtrace.c
+++ b/tools/perf/util/auxtrace.c
@@ -53,11 +53,6 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
53{ 53{
54 struct perf_event_mmap_page *pc = userpg; 54 struct perf_event_mmap_page *pc = userpg;
55 55
56#if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
57 pr_err("Cannot use AUX area tracing mmaps\n");
58 return -1;
59#endif
60
61 WARN_ONCE(mm->base, "Uninitialized auxtrace_mmap\n"); 56 WARN_ONCE(mm->base, "Uninitialized auxtrace_mmap\n");
62 57
63 mm->userpg = userpg; 58 mm->userpg = userpg;
@@ -73,6 +68,11 @@ int auxtrace_mmap__mmap(struct auxtrace_mmap *mm,
73 return 0; 68 return 0;
74 } 69 }
75 70
71#if BITS_PER_LONG != 64 && !defined(HAVE_SYNC_COMPARE_AND_SWAP_SUPPORT)
72 pr_err("Cannot use AUX area tracing mmaps\n");
73 return -1;
74#endif
75
76 pc->aux_offset = mp->offset; 76 pc->aux_offset = mp->offset;
77 pc->aux_size = mp->len; 77 pc->aux_size = mp->len;
78 78
diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index e23ded40c79e..0766d98c5da5 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -10,7 +10,7 @@ util/ctype.c
10util/evlist.c 10util/evlist.c
11util/evsel.c 11util/evsel.c
12util/cpumap.c 12util/cpumap.c
13../../lib/hweight.c 13../lib/hweight.c
14util/thread_map.c 14util/thread_map.c
15util/util.c 15util/util.c
16util/xyarray.c 16util/xyarray.c
@@ -19,5 +19,5 @@ util/rblist.c
19util/stat.c 19util/stat.c
20util/strlist.c 20util/strlist.c
21util/trace-event.c 21util/trace-event.c
22../../lib/rbtree.c 22../lib/rbtree.c
23util/string.c 23util/string.c
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 48b588c6951a..60f11414bb5c 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1911,6 +1911,8 @@ int setup_list(struct strlist **list, const char *list_str,
1911 pr_err("problems parsing %s list\n", list_name); 1911 pr_err("problems parsing %s list\n", list_name);
1912 return -1; 1912 return -1;
1913 } 1913 }
1914
1915 symbol_conf.has_filter = true;
1914 return 0; 1916 return 0;
1915} 1917}
1916 1918
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index bef47ead1d9b..b98ce51af142 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -105,7 +105,8 @@ struct symbol_conf {
105 demangle_kernel, 105 demangle_kernel,
106 filter_relative, 106 filter_relative,
107 show_hist_headers, 107 show_hist_headers,
108 branch_callstack; 108 branch_callstack,
109 has_filter;
109 const char *vmlinux_name, 110 const char *vmlinux_name,
110 *kallsyms_name, 111 *kallsyms_name,
111 *source_prefix, 112 *source_prefix,
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index da7646d767fe..292ae2c90e06 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -136,8 +136,7 @@ struct thread_map *thread_map__new_by_uid(uid_t uid)
136 if (grow) { 136 if (grow) {
137 struct thread_map *tmp; 137 struct thread_map *tmp;
138 138
139 tmp = realloc(threads, (sizeof(*threads) + 139 tmp = thread_map__realloc(threads, max_threads);
140 max_threads * sizeof(pid_t)));
141 if (tmp == NULL) 140 if (tmp == NULL)
142 goto out_free_namelist; 141 goto out_free_namelist;
143 142
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 4b89118f158d..44d440da15dc 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine,
236 const char *file_name; 236 const char *file_name;
237 struct dso *dso; 237 struct dso *dso;
238 238
239 pthread_rwlock_wrlock(&machine->dsos.lock);
240 dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true); 239 dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true);
241 if (dso) 240 if (dso)
242 goto out_unlock; 241 goto out;
243 242
244 file_name = vdso__get_compat_file(vdso_file); 243 file_name = vdso__get_compat_file(vdso_file);
245 if (!file_name) 244 if (!file_name)
246 goto out_unlock; 245 goto out;
247 246
248 dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name); 247 dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name);
249out_unlock: 248out:
250 pthread_rwlock_unlock(&machine->dsos.lock);
251 return dso; 249 return dso;
252} 250}
253 251
diff --git a/virt/kvm/vfio.c b/virt/kvm/vfio.c
index 620e37f741b8..1dd087da6f31 100644
--- a/virt/kvm/vfio.c
+++ b/virt/kvm/vfio.c
@@ -155,6 +155,8 @@ static int kvm_vfio_set_group(struct kvm_device *dev, long attr, u64 arg)
155 list_add_tail(&kvg->node, &kv->group_list); 155 list_add_tail(&kvg->node, &kv->group_list);
156 kvg->vfio_group = vfio_group; 156 kvg->vfio_group = vfio_group;
157 157
158 kvm_arch_start_assignment(dev->kvm);
159
158 mutex_unlock(&kv->lock); 160 mutex_unlock(&kv->lock);
159 161
160 kvm_vfio_update_coherency(dev); 162 kvm_vfio_update_coherency(dev);
@@ -190,6 +192,8 @@ static int kvm_vfio_set_group(struct kvm_device *dev, long attr, u64 arg)
190 break; 192 break;
191 } 193 }
192 194
195 kvm_arch_end_assignment(dev->kvm);
196
193 mutex_unlock(&kv->lock); 197 mutex_unlock(&kv->lock);
194 198
195 kvm_vfio_group_put_external_user(vfio_group); 199 kvm_vfio_group_put_external_user(vfio_group);
@@ -239,6 +243,7 @@ static void kvm_vfio_destroy(struct kvm_device *dev)
239 kvm_vfio_group_put_external_user(kvg->vfio_group); 243 kvm_vfio_group_put_external_user(kvg->vfio_group);
240 list_del(&kvg->node); 244 list_del(&kvg->node);
241 kfree(kvg); 245 kfree(kvg);
246 kvm_arch_end_assignment(dev->kvm);
242 } 247 }
243 248
244 kvm_vfio_update_coherency(dev); 249 kvm_vfio_update_coherency(dev);