aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2017-08-25 09:44:05 -0400
committerMark Brown <broonie@kernel.org>2017-08-25 09:44:05 -0400
commitb7e2672d1a23a53bd2657704bf94a8dc8880cc49 (patch)
tree7e315f84913b6cd896fda558724961b39a735587
parentc0d1cb8366bab9963822c27b0d40cb8b32928cdc (diff)
parent9ce76511b67be8fbcdff36b7e1662e3887bb7377 (diff)
Merge tag 'sound-4.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into asoc-rt5677
sound fixes for 4.13-rc7 We're keeping in a good shape, this batch contains just a few small fixes (a regression fix for ASoC rt5677 codec, NULL dereference and error-path fixes in firewire, and a corner-case ioctl error fix for user TLV), as well as usual quirks for USB-audio and HD-audio.
-rw-r--r--Documentation/device-mapper/dm-raid.txt1
-rw-r--r--Documentation/devicetree/bindings/crypto/inside-secure-safexcel.txt2
-rw-r--r--Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt1
-rw-r--r--Documentation/devicetree/bindings/mmc/img-dw-mshc.txt1
-rw-r--r--Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt2
-rw-r--r--Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt16
-rw-r--r--Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt1
-rw-r--r--Documentation/devicetree/bindings/net/brcm,amac.txt1
-rw-r--r--Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt24
-rw-r--r--Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt2
-rw-r--r--Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt15
-rw-r--r--Documentation/devicetree/bindings/serial/fsl-imx-uart.txt2
-rw-r--r--MAINTAINERS4928
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/include/uapi/asm/ioctls.h2
-rw-r--r--arch/arc/mm/dma.c2
-rw-r--r--arch/arm/include/asm/bug.h2
-rw-r--r--arch/arm/include/asm/cacheflush.h2
-rw-r--r--arch/arm/include/asm/kexec.h5
-rw-r--r--arch/arm/include/asm/ucontext.h6
-rw-r--r--arch/arm/kernel/machine_kexec.c11
-rw-r--r--arch/arm/kernel/setup.c3
-rw-r--r--arch/arm/kernel/signal.c78
-rw-r--r--arch/arm/mach-omap2/hsmmc.c239
-rw-r--r--arch/arm/mach-omap2/hsmmc.h9
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c1
-rw-r--r--arch/arm/mm/dma-mapping-nommu.c45
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm64/include/asm/atomic_lse.h2
-rw-r--r--arch/arm64/include/asm/bug.h2
-rw-r--r--arch/arm64/include/asm/sysreg.h4
-rw-r--r--arch/arm64/include/asm/uaccess.h2
-rw-r--r--arch/arm64/kernel/cpu_ops.c4
-rw-r--r--arch/arm64/kernel/smp.c12
-rw-r--r--arch/arm64/kernel/topology.c22
-rw-r--r--arch/arm64/kernel/traps.c8
-rw-r--r--arch/arm64/lib/copy_page.S9
-rw-r--r--arch/arm64/mm/dma-mapping.c4
-rw-r--r--arch/arm64/mm/mmu.c18
-rw-r--r--arch/arm64/mm/numa.c7
-rw-r--r--arch/blackfin/include/asm/bug.h4
-rw-r--r--arch/blackfin/include/asm/flat.h3
-rw-r--r--arch/blackfin/kernel/flat.c4
-rw-r--r--arch/h8300/include/asm/flat.h2
-rw-r--r--arch/m68k/include/asm/flat.h3
-rw-r--r--arch/mips/include/uapi/asm/ioctls.h2
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mn10300/include/asm/bug.h2
-rw-r--r--arch/parisc/configs/712_defconfig41
-rw-r--r--arch/parisc/configs/a500_defconfig50
-rw-r--r--arch/parisc/configs/b180_defconfig17
-rw-r--r--arch/parisc/configs/c3000_defconfig38
-rw-r--r--arch/parisc/configs/c8000_defconfig17
-rw-r--r--arch/parisc/configs/default_defconfig49
-rw-r--r--arch/parisc/configs/generic-32bit_defconfig21
-rw-r--r--arch/parisc/configs/generic-64bit_defconfig48
-rw-r--r--arch/parisc/include/asm/bug.h6
-rw-r--r--arch/parisc/include/asm/pdcpat.h16
-rw-r--r--arch/parisc/include/uapi/asm/ioctls.h2
-rw-r--r--arch/parisc/kernel/cache.c36
-rw-r--r--arch/parisc/kernel/firmware.c36
-rw-r--r--arch/parisc/kernel/irq.c8
-rw-r--r--arch/parisc/kernel/pdt.c23
-rw-r--r--arch/parisc/kernel/process.c2
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S2
-rw-r--r--arch/powerpc/Makefile25
-rw-r--r--arch/powerpc/include/asm/book3s/64/hash.h1
-rw-r--r--arch/powerpc/include/asm/book3s/64/mmu.h15
-rw-r--r--arch/powerpc/include/asm/book3s/64/pgtable.h1
-rw-r--r--arch/powerpc/include/asm/book3s/64/radix.h1
-rw-r--r--arch/powerpc/include/asm/bug.h8
-rw-r--r--arch/powerpc/include/asm/mmu_context.h18
-rw-r--r--arch/powerpc/include/asm/pgtable.h7
-rw-r--r--arch/powerpc/include/uapi/asm/ioctls.h2
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S28
-rw-r--r--arch/powerpc/kernel/idle_book3s.S15
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c4
-rw-r--r--arch/powerpc/kvm/book3s_hv.c2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S59
-rw-r--r--arch/powerpc/mm/mem.c1
-rw-r--r--arch/powerpc/mm/mmu_context_book3s64.c5
-rw-r--r--arch/powerpc/mm/pgtable-hash64.c44
-rw-r--r--arch/powerpc/mm/pgtable-radix.c62
-rw-r--r--arch/powerpc/mm/pgtable_64.c8
-rw-r--r--arch/powerpc/mm/subpage-prot.c2
-rw-r--r--arch/powerpc/mm/tlb-radix.c45
-rw-r--r--arch/powerpc/platforms/powernv/opal.c2
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c1
-rw-r--r--arch/s390/include/asm/bug.h4
-rw-r--r--arch/s390/kernel/perf_cpum_sf.c2
-rw-r--r--arch/s390/kvm/kvm-s390.c8
-rw-r--r--arch/s390/mm/pgtable.c6
-rw-r--r--arch/sh/include/asm/bug.h4
-rw-r--r--arch/sh/include/uapi/asm/ioctls.h2
-rw-r--r--arch/sparc/include/asm/trap_block.h1
-rw-r--r--arch/sparc/include/uapi/asm/ioctls.h2
-rw-r--r--arch/sparc/kernel/pci_sun4v.c12
-rw-r--r--arch/sparc/kernel/smp_64.c185
-rw-r--r--arch/sparc/kernel/sun4v_ivec.S15
-rw-r--r--arch/sparc/kernel/traps_64.c1
-rw-r--r--arch/x86/Kconfig.debug1
-rw-r--r--arch/x86/boot/Makefile5
-rw-r--r--arch/x86/boot/compressed/Makefile1
-rw-r--r--arch/x86/boot/string.c9
-rw-r--r--arch/x86/configs/i386_defconfig3
-rw-r--r--arch/x86/configs/x86_64_defconfig3
-rw-r--r--arch/x86/entry/entry_64.S1
-rw-r--r--arch/x86/events/core.c4
-rw-r--r--arch/x86/events/intel/core.c164
-rw-r--r--arch/x86/events/intel/cstate.c26
-rw-r--r--arch/x86/events/intel/ds.c22
-rw-r--r--arch/x86/events/intel/lbr.c4
-rw-r--r--arch/x86/events/intel/uncore_snbep.c51
-rw-r--r--arch/x86/events/perf_event.h2
-rw-r--r--arch/x86/include/asm/bug.h4
-rw-r--r--arch/x86/include/asm/entry_arch.h2
-rw-r--r--arch/x86/include/asm/hardirq.h1
-rw-r--r--arch/x86/include/asm/hw_irq.h2
-rw-r--r--arch/x86/include/asm/io.h4
-rw-r--r--arch/x86/include/asm/irq_vectors.h3
-rw-r--r--arch/x86/include/asm/kprobes.h8
-rw-r--r--arch/x86/include/asm/mmu_context.h2
-rw-r--r--arch/x86/include/asm/paravirt_types.h16
-rw-r--r--arch/x86/include/asm/processor.h2
-rw-r--r--arch/x86/kernel/acpi/boot.c8
-rw-r--r--arch/x86/kernel/apic/io_apic.c2
-rw-r--r--arch/x86/kernel/cpu/amd.c1
-rw-r--r--arch/x86/kernel/devicetree.c3
-rw-r--r--arch/x86/kernel/irq.c19
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/kprobes/core.c10
-rw-r--r--arch/x86/kernel/reboot.c6
-rw-r--r--arch/x86/kvm/Kconfig2
-rw-r--r--arch/x86/kvm/hyperv.c7
-rw-r--r--arch/x86/kvm/lapic.c17
-rw-r--r--arch/x86/kvm/vmx.c71
-rw-r--r--arch/x86/kvm/x86.c4
-rw-r--r--arch/x86/math-emu/Makefile4
-rw-r--r--arch/x86/math-emu/fpu_emu.h2
-rw-r--r--arch/x86/math-emu/reg_compare.c16
-rw-r--r--arch/x86/platform/intel-mid/device_libs/platform_max7315.c6
-rw-r--r--arch/x86/platform/uv/tlb_uv.c29
-rw-r--r--arch/x86/xen/smp_pv.c3
-rw-r--r--arch/x86/xen/time.c1
-rw-r--r--arch/xtensa/include/uapi/asm/ioctls.h2
-rw-r--r--block/bfq-iosched.c3
-rw-r--r--block/bfq-iosched.h2
-rw-r--r--block/bfq-wf2q.c2
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-mq-cpumap.c4
-rw-r--r--crypto/authencesn.c5
-rw-r--r--drivers/acpi/ec.c39
-rw-r--r--drivers/acpi/internal.h4
-rw-r--r--drivers/acpi/nfit/core.c10
-rw-r--r--drivers/acpi/numa.c2
-rw-r--r--drivers/acpi/sleep.c6
-rw-r--r--drivers/android/binder.c17
-rw-r--r--drivers/atm/zatm.c2
-rw-r--r--drivers/base/dma-coherent.c164
-rw-r--r--drivers/base/dma-mapping.c2
-rw-r--r--drivers/base/power/domain.c8
-rw-r--r--drivers/base/regmap/regmap-w1.c4
-rw-r--r--drivers/block/nbd.c20
-rw-r--r--drivers/block/virtio_blk.c7
-rw-r--r--drivers/block/xen-blkfront.c25
-rw-r--r--drivers/clocksource/timer-of.c12
-rw-r--r--drivers/cpufreq/intel_pstate.c21
-rw-r--r--drivers/crypto/Kconfig2
-rw-r--r--drivers/crypto/bcm/spu2.c1
-rw-r--r--drivers/crypto/cavium/nitrox/nitrox_main.c3
-rw-r--r--drivers/crypto/inside-secure/safexcel.c5
-rw-r--r--drivers/dax/device-dax.h2
-rw-r--r--drivers/dax/device.c33
-rw-r--r--drivers/dax/pmem.c12
-rw-r--r--drivers/dax/super.c6
-rw-r--r--drivers/dma-buf/dma-fence.c17
-rw-r--r--drivers/dma-buf/sync_debug.c2
-rw-r--r--drivers/dma-buf/sync_file.c8
-rw-r--r--drivers/fsi/fsi-core.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c24
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device.c4
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c7
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h1
-rw-r--r--drivers/gpu/drm/amd/include/kgd_kfd_interface.h3
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c12
-rw-r--r--drivers/gpu/drm/drm_dp_helper.c5
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c41
-rw-r--r--drivers/gpu/drm/exynos/Kconfig1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_dsi.c10
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_mic.c24
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c10
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c10
-rw-r--r--drivers/gpu/drm/i915/gvt/display.c22
-rw-r--r--drivers/gpu/drm/i915/i915_gem_clflush.c7
-rw-r--r--drivers/gpu/drm/i915/i915_gem_clflush.h2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c24
-rw-r--r--drivers/gpu/drm/i915/i915_vma.h2
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c86
-rw-r--r--drivers/gpu/drm/i915/intel_gvt.c2
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c4
-rw-r--r--drivers/gpu/drm/i915/selftests/mock_gem_device.c2
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.c2
-rw-r--r--drivers/gpu/drm/imx/parallel-display.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_connector.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_display.c5
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c31
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild1
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h6
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c30
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgf119.c35
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c5
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgf119.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_kfd.c1
-rw-r--r--drivers/gpu/drm/rockchip/Kconfig19
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c66
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c24
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_context.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c8
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c8
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fence.c10
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c9
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_mob.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_msg.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c4
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_shader.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c4
-rw-r--r--drivers/gpu/host1x/dev.c8
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-logitech-hidpp.c3
-rw-r--r--drivers/hid/hid-multitouch.c16
-rw-r--r--drivers/hid/hid-ortek.c6
-rw-r--r--drivers/hid/usbhid/hid-core.c16
-rw-r--r--drivers/hv/channel.c2
-rw-r--r--drivers/hwmon/applesmc.c13
-rw-r--r--drivers/ide/ide-timings.c18
-rw-r--r--drivers/infiniband/core/addr.c46
-rw-r--r--drivers/infiniband/core/cma.c34
-rw-r--r--drivers/infiniband/core/roce_gid_mgmt.c11
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c36
-rw-r--r--drivers/infiniband/core/verbs.c51
-rw-r--r--drivers/infiniband/hw/bnxt_re/bnxt_re.h9
-rw-r--r--drivers/infiniband/hw/bnxt_re/ib_verbs.c119
-rw-r--r--drivers/infiniband/hw/bnxt_re/ib_verbs.h3
-rw-r--r--drivers/infiniband/hw/bnxt_re/main.c1
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_fp.c29
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_fp.h1
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_sp.c16
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_sp.h3
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c9
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c1
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c2
-rw-r--r--drivers/infiniband/hw/hfi1/chip.c7
-rw-r--r--drivers/infiniband/hw/hfi1/qp.c7
-rw-r--r--drivers/infiniband/hw/hfi1/qp.h3
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_hw_v1.c86
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_main.c3
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw.h1
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_cm.c5
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_ctrl.c2
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_main.c60
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_puda.c5
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_utils.c60
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_verbs.c19
-rw-r--r--drivers/infiniband/hw/i40iw/i40iw_verbs.h2
-rw-r--r--drivers/infiniband/hw/mlx4/cm.c4
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c6
-rw-r--r--drivers/infiniband/hw/mlx4/main.c2
-rw-r--r--drivers/infiniband/hw/mlx4/mcg.c2
-rw-r--r--drivers/infiniband/hw/mlx4/mlx4_ib.h1
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c40
-rw-r--r--drivers/infiniband/hw/mlx4/srq.c8
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c38
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c4
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_verbs.c4
-rw-r--r--drivers/infiniband/hw/qedr/verbs.c16
-rw-r--r--drivers/infiniband/hw/qib/qib_qp.c15
-rw-r--r--drivers/infiniband/hw/qib/qib_verbs.h4
-rw-r--r--drivers/infiniband/sw/rdmavt/qp.c52
-rw-r--r--drivers/infiniband/sw/rxe/rxe_net.c3
-rw-r--r--drivers/infiniband/sw/rxe/rxe_resp.c3
-rw-r--r--drivers/infiniband/sw/rxe/rxe_verbs.c5
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c20
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_ib.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c32
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c11
-rw-r--r--drivers/infiniband/ulp/iser/iser_initiator.c6
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c10
-rw-r--r--drivers/irqchip/irq-digicolor.c2
-rw-r--r--drivers/irqchip/irq-gic-realview.c2
-rw-r--r--drivers/irqchip/irq-mips-cpu.c2
-rw-r--r--drivers/irqchip/irq-mips-gic.c2
-rw-r--r--drivers/isdn/divert/isdn_divert.c25
-rw-r--r--drivers/isdn/hardware/avm/c4.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c2
-rw-r--r--drivers/isdn/hardware/mISDN/avmfritz.c2
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c2
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c2
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c2
-rw-r--r--drivers/isdn/hardware/mISDN/w6692.c2
-rw-r--r--drivers/isdn/hisax/config.c2
-rw-r--r--drivers/isdn/hisax/hfc4s8s_l1.c2
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c2
-rw-r--r--drivers/lightnvm/pblk-rb.c4
-rw-r--r--drivers/lightnvm/pblk-read.c23
-rw-r--r--drivers/lightnvm/pblk.h2
-rw-r--r--drivers/md/bitmap.c3
-rw-r--r--drivers/md/dm-bufio.c3
-rw-r--r--drivers/md/dm-integrity.c22
-rw-r--r--drivers/md/dm-raid.c29
-rw-r--r--drivers/md/dm-table.c35
-rw-r--r--drivers/md/dm-verity-fec.c21
-rw-r--r--drivers/md/dm-zoned-metadata.c12
-rw-r--r--drivers/md/dm-zoned-reclaim.c2
-rw-r--r--drivers/md/dm-zoned-target.c8
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/md.h58
-rw-r--r--drivers/md/raid1-10.c81
-rw-r--r--drivers/md/raid1.c68
-rw-r--r--drivers/md/raid10.c25
-rw-r--r--drivers/md/raid5-ppl.c2
-rw-r--r--drivers/md/raid5.c15
-rw-r--r--drivers/mmc/host/dw_mmc.c2
-rw-r--r--drivers/mmc/host/omap_hsmmc.c11
-rw-r--r--drivers/mmc/host/sunxi-mmc.c8
-rw-r--r--drivers/mux/Kconfig19
-rw-r--r--drivers/mux/mux-core.c2
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/dsa/b53/b53_common.c1
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c1
-rw-r--r--drivers/net/ethernet/apm/xgene/xgene_enet_main.c22
-rw-r--r--drivers/net/ethernet/broadcom/bgmac-platform.c21
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.c70
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.h1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c7
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c299
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.h2
-rw-r--r--drivers/net/ethernet/cavium/liquidio/lio_ethtool.c2
-rw-r--r--drivers/net/ethernet/cavium/thunder/thunder_bgx.c2
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c3
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h2
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c3
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c58
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/alloc.c37
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cq.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/icm.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/icm.h3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c20
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/srq.c4
-rw-r--r--drivers/net/ethernet/qualcomm/emac/emac.c10
-rw-r--r--drivers/net/ethernet/sgi/ioc3-eth.c14
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c9
-rw-r--r--drivers/net/ethernet/sun/niu.c4
-rw-r--r--drivers/net/ethernet/tehuti/tehuti.c2
-rw-r--r--drivers/net/ethernet/ti/cpsw.c49
-rw-r--r--drivers/net/phy/mdio-mux.c4
-rw-r--r--drivers/net/ppp/ppp_generic.c30
-rw-r--r--drivers/net/usb/cdc_ncm.c28
-rw-r--r--drivers/net/usb/huawei_cdc_ncm.c6
-rw-r--r--drivers/net/usb/smsc95xx.c1
-rw-r--r--drivers/net/virtio_net.c2
-rw-r--r--drivers/net/vmxnet3/vmxnet3_int.h2
-rw-r--r--drivers/net/wireless/ralink/rt2x00/rt2800lib.c2
-rw-r--r--drivers/nvdimm/core.c7
-rw-r--r--drivers/nvme/host/core.c8
-rw-r--r--drivers/nvme/host/fc.c121
-rw-r--r--drivers/nvme/host/pci.c49
-rw-r--r--drivers/nvme/target/admin-cmd.c16
-rw-r--r--drivers/nvme/target/configfs.c30
-rw-r--r--drivers/nvme/target/core.c5
-rw-r--r--drivers/nvme/target/fc.c109
-rw-r--r--drivers/nvme/target/nvmet.h2
-rw-r--r--drivers/nvmem/rockchip-efuse.c2
-rw-r--r--drivers/of/irq.c2
-rw-r--r--drivers/of/property.c17
-rw-r--r--drivers/parisc/pdc_stable.c2
-rw-r--r--drivers/perf/arm_pmu.c41
-rw-r--r--drivers/perf/arm_pmu_platform.c9
-rw-r--r--drivers/perf/qcom_l2_pmu.c2
-rw-r--r--drivers/s390/cio/chp.c1
-rw-r--r--drivers/scsi/cxlflash/main.c11
-rw-r--r--drivers/scsi/hisi_sas/hisi_sas_v2_hw.c10
-rw-r--r--drivers/scsi/hpsa.c2
-rw-r--r--drivers/scsi/isci/request.c14
-rw-r--r--drivers/scsi/libfc/fc_disc.c2
-rw-r--r--drivers/scsi/qedf/qedf_main.c2
-rw-r--r--drivers/scsi/qedi/qedi.h17
-rw-r--r--drivers/scsi/qedi/qedi_fw.c2
-rw-r--r--drivers/scsi/qedi/qedi_main.c419
-rw-r--r--drivers/scsi/qedi/qedi_nvm_iscsi_cfg.h210
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c2
-rw-r--r--drivers/scsi/sg.c8
-rw-r--r--drivers/scsi/smartpqi/smartpqi.h2
-rw-r--r--drivers/scsi/virtio_scsi.c1
-rw-r--r--drivers/spmi/spmi-pmic-arb.c17
-rw-r--r--drivers/spmi/spmi.c12
-rw-r--r--drivers/staging/Kconfig2
-rw-r--r--drivers/staging/Makefile1
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c3
-rw-r--r--drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c19
-rw-r--r--drivers/staging/rtl8188eu/core/rtw_cmd.c2
-rw-r--r--drivers/staging/rtl8188eu/os_dep/usb_intf.c1
-rw-r--r--drivers/staging/sm750fb/ddk750_chip.c2
-rw-r--r--drivers/staging/sm750fb/sm750.c24
-rw-r--r--drivers/staging/speakup/main.c2
-rw-r--r--drivers/staging/speakup/spk_priv.h2
-rw-r--r--drivers/staging/speakup/spk_ttyio.c22
-rw-r--r--drivers/staging/vboxvideo/Kconfig12
-rw-r--r--drivers/staging/vboxvideo/Makefile7
-rw-r--r--drivers/staging/vboxvideo/TODO9
-rw-r--r--drivers/staging/vboxvideo/hgsmi_base.c246
-rw-r--r--drivers/staging/vboxvideo/hgsmi_ch_setup.h66
-rw-r--r--drivers/staging/vboxvideo/hgsmi_channels.h53
-rw-r--r--drivers/staging/vboxvideo/hgsmi_defs.h92
-rw-r--r--drivers/staging/vboxvideo/modesetting.c142
-rw-r--r--drivers/staging/vboxvideo/vbox_drv.c286
-rw-r--r--drivers/staging/vboxvideo/vbox_drv.h296
-rw-r--r--drivers/staging/vboxvideo/vbox_err.h50
-rw-r--r--drivers/staging/vboxvideo/vbox_fb.c412
-rw-r--r--drivers/staging/vboxvideo/vbox_hgsmi.c115
-rw-r--r--drivers/staging/vboxvideo/vbox_irq.c197
-rw-r--r--drivers/staging/vboxvideo/vbox_main.c534
-rw-r--r--drivers/staging/vboxvideo/vbox_mode.c877
-rw-r--r--drivers/staging/vboxvideo/vbox_prime.c74
-rw-r--r--drivers/staging/vboxvideo/vbox_ttm.c472
-rw-r--r--drivers/staging/vboxvideo/vboxvideo.h491
-rw-r--r--drivers/staging/vboxvideo/vboxvideo_guest.h95
-rw-r--r--drivers/staging/vboxvideo/vboxvideo_vbe.h84
-rw-r--r--drivers/staging/vboxvideo/vbva_base.c233
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c10
-rw-r--r--drivers/thunderbolt/switch.c11
-rw-r--r--drivers/thunderbolt/tb.h4
-rw-r--r--drivers/thunderbolt/tb_msgs.h12
-rw-r--r--drivers/tty/pty.c85
-rw-r--r--drivers/tty/serial/fsl_lpuart.c24
-rw-r--r--drivers/tty/serial/imx.c27
-rw-r--r--drivers/tty/serial/sh-sci.c12
-rw-r--r--drivers/tty/serial/st-asc.c1
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/dwc2/gadget.c3
-rw-r--r--drivers/usb/dwc3/core.c6
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c18
-rw-r--r--drivers/usb/dwc3/gadget.c8
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c2
-rw-r--r--drivers/usb/gadget/function/f_uac1.c20
-rw-r--r--drivers/usb/gadget/function/f_uac2.c25
-rw-r--r--drivers/usb/gadget/udc/Kconfig5
-rw-r--r--drivers/usb/gadget/udc/renesas_usb3.c14
-rw-r--r--drivers/usb/gadget/udc/snps_udc_plat.c6
-rw-r--r--drivers/usb/host/pci-quirks.c54
-rw-r--r--drivers/usb/host/pci-quirks.h2
-rw-r--r--drivers/usb/host/xhci-hub.c14
-rw-r--r--drivers/usb/host/xhci-pci.c6
-rw-r--r--drivers/usb/host/xhci-ring.c11
-rw-r--r--drivers/usb/host/xhci.c10
-rw-r--r--drivers/usb/host/xhci.h1
-rw-r--r--drivers/usb/renesas_usbhs/common.c4
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c31
-rw-r--r--drivers/usb/storage/isd200.c5
-rw-r--r--drivers/usb/typec/ucsi/ucsi.h1
-rw-r--r--drivers/virtio/virtio_balloon.c28
-rw-r--r--drivers/w1/masters/omap_hdq.c3
-rw-r--r--drivers/w1/w1.c4
-rw-r--r--drivers/xen/balloon.c3
-rw-r--r--drivers/xen/events/events_base.c13
-rw-r--r--drivers/xen/grant-table.c9
-rw-r--r--drivers/xen/xen-balloon.c22
-rw-r--r--drivers/xen/xen-selfballoon.c4
-rw-r--r--drivers/xen/xenfs/super.c1
-rw-r--r--fs/binfmt_flat.c2
-rw-r--r--fs/btrfs/extent-tree.c11
-rw-r--r--fs/btrfs/tree-log.c3
-rw-r--r--fs/btrfs/volumes.c4
-rw-r--r--fs/ceph/dir.c5
-rw-r--r--fs/ext2/acl.c43
-rw-r--r--fs/f2fs/acl.c2
-rw-r--r--fs/f2fs/checkpoint.c10
-rw-r--r--fs/f2fs/file.c5
-rw-r--r--fs/f2fs/sysfs.c1
-rw-r--r--fs/hfsplus/posix_acl.c30
-rw-r--r--fs/isofs/inode.c8
-rw-r--r--fs/jfs/acl.c24
-rw-r--r--fs/jfs/resize.c4
-rw-r--r--fs/jfs/super.c4
-rw-r--r--fs/mount.h4
-rw-r--r--fs/namei.c2
-rw-r--r--fs/nfs/client.c1
-rw-r--r--fs/nfs/dir.c47
-rw-r--r--fs/nfs/file.c4
-rw-r--r--fs/nfs/filelayout/filelayout.c13
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.c4
-rw-r--r--fs/nfs/mount_clnt.c2
-rw-r--r--fs/nfs/nfs3proc.c11
-rw-r--r--fs/nfs/nfs4proc.c14
-rw-r--r--fs/nfs/pnfs_nfs.c24
-rw-r--r--fs/nfsd/nfs4callback.c6
-rw-r--r--fs/overlayfs/dir.c22
-rw-r--r--fs/overlayfs/inode.c32
-rw-r--r--fs/overlayfs/namei.c41
-rw-r--r--fs/overlayfs/overlayfs.h10
-rw-r--r--fs/overlayfs/readdir.c5
-rw-r--r--fs/overlayfs/super.c13
-rw-r--r--fs/overlayfs/util.c7
-rw-r--r--fs/proc/internal.h6
-rw-r--r--fs/reiserfs/xattr_acl.c17
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c21
-rw-r--r--fs/xfs/libxfs/xfs_btree.c6
-rw-r--r--fs/xfs/libxfs/xfs_dir2_data.c4
-rw-r--r--fs/xfs/libxfs/xfs_refcount.c4
-rw-r--r--fs/xfs/xfs_qm.c3
-rw-r--r--fs/xfs/xfs_reflink.c4
-rw-r--r--include/acpi/acpi_numa.h1
-rw-r--r--include/linux/binfmts.h4
-rw-r--r--include/linux/bpf-cgroup.h2
-rw-r--r--include/linux/bpf_verifier.h1
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/ceph/ceph_features.h8
-rw-r--r--include/linux/compiler-gcc.h13
-rw-r--r--include/linux/compiler.h5
-rw-r--r--include/linux/cred.h4
-rw-r--r--include/linux/dax.h1
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/dma-fence.h2
-rw-r--r--include/linux/dma-mapping.h40
-rw-r--r--include/linux/fs.h17
-rw-r--r--include/linux/fs_struct.h2
-rw-r--r--include/linux/ftrace.h6
-rw-r--r--include/linux/ipc.h2
-rw-r--r--include/linux/ipc_namespace.h2
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/jhash.h29
-rw-r--r--include/linux/key-type.h4
-rw-r--r--include/linux/kmod.h2
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kvm_host.h1
-rw-r--r--include/linux/llist.h21
-rw-r--r--include/linux/lsm_hooks.h4
-rw-r--r--include/linux/mlx4/device.h10
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/module.h4
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/msg.h2
-rw-r--r--include/linux/netfilter.h9
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nvme-fc.h19
-rw-r--r--include/linux/nvme.h16
-rw-r--r--include/linux/path.h2
-rw-r--r--include/linux/perf/arm_pmu.h4
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/platform_data/hsmmc-omap.h10
-rw-r--r--include/linux/proc_ns.h2
-rw-r--r--include/linux/sched.h16
-rw-r--r--include/linux/sched/signal.h2
-rw-r--r--include/linux/sem.h2
-rw-r--r--include/linux/shm.h2
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/trace_events.h2
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_driver.h4
-rw-r--r--include/linux/usb/audio-v2.h14
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/user_namespace.h2
-rw-r--r--include/linux/utsname.h2
-rw-r--r--include/linux/uuid.h14
-rw-r--r--include/linux/wait.h8
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/neighbour.h2
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netlink.h4
-rw-r--r--include/net/sctp/sctp.h4
-rw-r--r--include/net/sock.h2
-rw-r--r--include/rdma/ib_addr.h6
-rw-r--r--include/rdma/ib_verbs.h18
-rw-r--r--include/rdma/rdma_vt.h5
-rw-r--r--include/rdma/rdmavt_qp.h14
-rw-r--r--include/sound/soc.h6
-rw-r--r--include/uapi/asm-generic/ioctls.h2
-rw-r--r--include/uapi/linux/usb/audio.h6
-rw-r--r--include/xen/balloon.h8
-rw-r--r--kernel/audit.c1
-rw-r--r--kernel/bpf/verifier.c108
-rw-r--r--kernel/cpu.c3
-rw-r--r--kernel/events/core.c33
-rw-r--r--kernel/futex.c4
-rw-r--r--kernel/irq/chip.c10
-rw-r--r--kernel/irq/cpuhotplug.c9
-rw-r--r--kernel/irq/internals.h10
-rw-r--r--kernel/irq/manage.c63
-rw-r--r--kernel/irq/pm.c2
-rw-r--r--kernel/locking/rtmutex.c1
-rw-r--r--kernel/sched/core.c2
-rw-r--r--kernel/sched/cputime.c6
-rw-r--r--kernel/sched/deadline.c14
-rw-r--r--kernel/trace/ftrace.c41
-rw-r--r--kernel/trace/ring_buffer.c10
-rw-r--r--kernel/trace/trace.c1
-rw-r--r--kernel/trace/trace.h6
-rw-r--r--lib/test_uuid.c2
-rw-r--r--net/bridge/br_device.c3
-rw-r--r--net/bridge/br_input.c3
-rw-r--r--net/ceph/messenger.c6
-rw-r--r--net/ceph/osd_client.c5
-rw-r--r--net/ceph/osdmap.c31
-rw-r--r--net/core/dev_ioctl.c3
-rw-r--r--net/core/fib_rules.c3
-rw-r--r--net/core/filter.c2
-rw-r--r--net/core/netpoll.c2
-rw-r--r--net/core/rtnetlink.c4
-rw-r--r--net/dccp/input.c2
-rw-r--r--net/ipv4/fib_frontend.c9
-rw-r--r--net/ipv4/ip_output.c8
-rw-r--r--net/ipv4/netfilter/nf_tables_arp.c3
-rw-r--r--net/ipv4/syncookies.c1
-rw-r--r--net/ipv4/tcp_bbr.c49
-rw-r--r--net/ipv4/udp.c13
-rw-r--r--net/ipv6/output_core.c8
-rw-r--r--net/ipv6/syncookies.c1
-rw-r--r--net/netfilter/core.c147
-rw-r--r--net/netfilter/nf_conntrack_expect.c2
-rw-r--r--net/netfilter/nf_nat_core.c17
-rw-r--r--net/netfilter/nfnetlink.c6
-rw-r--r--net/openvswitch/conntrack.c51
-rw-r--r--net/packet/af_packet.c6
-rw-r--r--net/rds/send.c6
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sctp/sm_make_chunk.c4
-rw-r--r--net/sunrpc/xprtsock.c2
-rwxr-xr-xscripts/dtc/dtx_diff2
-rw-r--r--scripts/parse-maintainers.pl77
-rw-r--r--security/keys/internal.h2
-rw-r--r--sound/core/control.c2
-rw-r--r--sound/core/seq/Kconfig4
-rw-r--r--sound/core/seq/seq_clientmgr.c13
-rw-r--r--sound/core/seq/seq_queue.c14
-rw-r--r--sound/core/seq/seq_queue.h2
-rw-r--r--sound/firewire/iso-resources.c7
-rw-r--r--sound/firewire/motu/motu.c1
-rw-r--r--sound/pci/emu10k1/emufx.c14
-rw-r--r--sound/pci/fm801.c4
-rw-r--r--sound/pci/hda/patch_conexant.c2
-rw-r--r--sound/pci/hda/patch_hdmi.c27
-rw-r--r--sound/pci/hda/patch_realtek.c146
-rw-r--r--sound/soc/codecs/msm8916-wcd-analog.c2
-rw-r--r--sound/soc/codecs/rt5663.c18
-rw-r--r--sound/soc/codecs/rt5665.c4
-rw-r--r--sound/soc/codecs/rt5665.h4
-rw-r--r--sound/soc/codecs/rt5677.c2
-rw-r--r--sound/soc/codecs/sgtl5000.c4
-rw-r--r--sound/soc/fsl/imx-ssi.c4
-rw-r--r--sound/soc/generic/audio-graph-card.c10
-rw-r--r--sound/soc/generic/audio-graph-scu-card.c15
-rw-r--r--sound/soc/generic/simple-card-utils.c8
-rw-r--r--sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c17
-rw-r--r--sound/soc/intel/skylake/skl-messages.c8
-rw-r--r--sound/soc/intel/skylake/skl.c2
-rw-r--r--sound/soc/pxa/Kconfig1
-rw-r--r--sound/soc/samsung/odroid.c6
-rw-r--r--sound/soc/sh/hac.c2
-rw-r--r--sound/soc/soc-core.c27
-rw-r--r--sound/soc/soc-pcm.c36
-rw-r--r--sound/soc/ux500/mop500.c4
-rw-r--r--sound/usb/mixer.c2
-rw-r--r--sound/usb/mixer.h1
-rw-r--r--sound/usb/mixer_quirks.c6
-rw-r--r--sound/usb/quirks.c14
-rwxr-xr-xtools/kvm/kvm_stat/kvm_stat22
-rw-r--r--tools/lib/bpf/bpf.c4
-rw-r--r--tools/lib/bpf/bpf.h2
-rw-r--r--tools/perf/ui/browser.c2
-rw-r--r--tools/perf/util/evsel.c8
-rw-r--r--tools/perf/util/machine.c2
-rw-r--r--tools/testing/selftests/bpf/test_align.c2
-rw-r--r--tools/testing/selftests/bpf/test_verifier.c480
-rw-r--r--virt/kvm/kvm_main.c35
693 files changed, 13777 insertions, 6008 deletions
diff --git a/Documentation/device-mapper/dm-raid.txt b/Documentation/device-mapper/dm-raid.txt
index 7e06e65586d4..4a0a7469fdd7 100644
--- a/Documentation/device-mapper/dm-raid.txt
+++ b/Documentation/device-mapper/dm-raid.txt
@@ -343,3 +343,4 @@ Version History
3431.11.0 Fix table line argument order 3431.11.0 Fix table line argument order
344 (wrong raid10_copies/raid10_format sequence) 344 (wrong raid10_copies/raid10_format sequence)
3451.11.1 Add raid4/5/6 journal write-back support via journal_mode option 3451.11.1 Add raid4/5/6 journal write-back support via journal_mode option
3461.12.1 fix for MD deadlock between mddev_suspend() and md_write_start() available
diff --git a/Documentation/devicetree/bindings/crypto/inside-secure-safexcel.txt b/Documentation/devicetree/bindings/crypto/inside-secure-safexcel.txt
index f69773f4252b..941bb6a6fb13 100644
--- a/Documentation/devicetree/bindings/crypto/inside-secure-safexcel.txt
+++ b/Documentation/devicetree/bindings/crypto/inside-secure-safexcel.txt
@@ -8,7 +8,6 @@ Required properties:
8 8
9Optional properties: 9Optional properties:
10- clocks: Reference to the crypto engine clock. 10- clocks: Reference to the crypto engine clock.
11- dma-mask: The address mask limitation. Defaults to 64.
12 11
13Example: 12Example:
14 13
@@ -24,6 +23,5 @@ Example:
24 interrupt-names = "mem", "ring0", "ring1", "ring2", "ring3", 23 interrupt-names = "mem", "ring0", "ring1", "ring2", "ring3",
25 "eip"; 24 "eip";
26 clocks = <&cpm_syscon0 1 26>; 25 clocks = <&cpm_syscon0 1 26>;
27 dma-mask = <0xff 0xffffffff>;
28 status = "disabled"; 26 status = "disabled";
29 }; 27 };
diff --git a/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
index aad98442788b..a58c173b7ab9 100644
--- a/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/exynos-dw-mshc.txt
@@ -78,7 +78,6 @@ Example:
78 }; 78 };
79 79
80 dwmmc0@12200000 { 80 dwmmc0@12200000 {
81 num-slots = <1>;
82 cap-mmc-highspeed; 81 cap-mmc-highspeed;
83 cap-sd-highspeed; 82 cap-sd-highspeed;
84 broken-cd; 83 broken-cd;
diff --git a/Documentation/devicetree/bindings/mmc/img-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/img-dw-mshc.txt
index 85de99fcaa2f..c54e577eea07 100644
--- a/Documentation/devicetree/bindings/mmc/img-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/img-dw-mshc.txt
@@ -24,6 +24,5 @@ Example:
24 24
25 fifo-depth = <0x20>; 25 fifo-depth = <0x20>;
26 bus-width = <4>; 26 bus-width = <4>;
27 num-slots = <1>;
28 disable-wp; 27 disable-wp;
29 }; 28 };
diff --git a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
index 8af1afcb86dc..07242d141773 100644
--- a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt
@@ -36,7 +36,6 @@ Example:
36 36
37 /* Board portion */ 37 /* Board portion */
38 dwmmc0@fcd03000 { 38 dwmmc0@fcd03000 {
39 num-slots = <1>;
40 vmmc-supply = <&ldo12>; 39 vmmc-supply = <&ldo12>;
41 fifo-depth = <0x100>; 40 fifo-depth = <0x100>;
42 pinctrl-names = "default"; 41 pinctrl-names = "default";
@@ -52,7 +51,6 @@ Example:
52 51
53 dwmmc_1: dwmmc1@f723e000 { 52 dwmmc_1: dwmmc1@f723e000 {
54 compatible = "hisilicon,hi6220-dw-mshc"; 53 compatible = "hisilicon,hi6220-dw-mshc";
55 num-slots = <0x1>;
56 bus-width = <0x4>; 54 bus-width = <0x4>;
57 disable-wp; 55 disable-wp;
58 cap-sd-highspeed; 56 cap-sd-highspeed;
diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
index 9cb55ca57461..ef3e5f14067a 100644
--- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
@@ -12,12 +12,12 @@ Required Properties:
12* #address-cells: should be 1. 12* #address-cells: should be 1.
13* #size-cells: should be 0. 13* #size-cells: should be 0.
14 14
15# Slots: The slot specific information are contained within child-nodes with 15# Slots (DEPRECATED): The slot specific information are contained within
16 each child-node representing a supported slot. There should be atleast one 16 child-nodes with each child-node representing a supported slot. There should
17 child node representing a card slot. The name of the child node representing 17 be atleast one child node representing a card slot. The name of the child node
18 the slot is recommended to be slot@n where n is the unique number of the slot 18 representing the slot is recommended to be slot@n where n is the unique number
19 connected to the controller. The following are optional properties which 19 of the slot connected to the controller. The following are optional properties
20 can be included in the slot child node. 20 which can be included in the slot child node.
21 21
22 * reg: specifies the physical slot number. The valid values of this 22 * reg: specifies the physical slot number. The valid values of this
23 property is 0 to (num-slots -1), where num-slots is the value 23 property is 0 to (num-slots -1), where num-slots is the value
@@ -63,7 +63,7 @@ Optional properties:
63 clock(cclk_out). If it's not specified, max is 200MHZ and min is 400KHz by default. 63 clock(cclk_out). If it's not specified, max is 200MHZ and min is 400KHz by default.
64 (Use the "max-frequency" instead of "clock-freq-min-max".) 64 (Use the "max-frequency" instead of "clock-freq-min-max".)
65 65
66* num-slots: specifies the number of slots supported by the controller. 66* num-slots (DEPRECATED): specifies the number of slots supported by the controller.
67 The number of physical slots actually used could be equal or less than the 67 The number of physical slots actually used could be equal or less than the
68 value specified by num-slots. If this property is not specified, the value 68 value specified by num-slots. If this property is not specified, the value
69 of num-slot property is assumed to be 1. 69 of num-slot property is assumed to be 1.
@@ -124,7 +124,6 @@ board specific portions as listed below.
124 dwmmc0@12200000 { 124 dwmmc0@12200000 {
125 clock-frequency = <400000000>; 125 clock-frequency = <400000000>;
126 clock-freq-min-max = <400000 200000000>; 126 clock-freq-min-max = <400000 200000000>;
127 num-slots = <1>;
128 broken-cd; 127 broken-cd;
129 fifo-depth = <0x80>; 128 fifo-depth = <0x80>;
130 card-detect-delay = <200>; 129 card-detect-delay = <200>;
@@ -139,7 +138,6 @@ board specific portions as listed below.
139 dwmmc0@12200000 { 138 dwmmc0@12200000 {
140 clock-frequency = <400000000>; 139 clock-frequency = <400000000>;
141 clock-freq-min-max = <400000 200000000>; 140 clock-freq-min-max = <400000 200000000>;
142 num-slots = <1>;
143 broken-cd; 141 broken-cd;
144 fifo-depth = <0x80>; 142 fifo-depth = <0x80>;
145 card-detect-delay = <200>; 143 card-detect-delay = <200>;
diff --git a/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt
index eaade0e5adeb..906819a90c2b 100644
--- a/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt
+++ b/Documentation/devicetree/bindings/mmc/zx-dw-mshc.txt
@@ -25,7 +25,6 @@ Example:
25 clock-frequency = <50000000>; 25 clock-frequency = <50000000>;
26 clocks = <&topcrm SD0_AHB>, <&topcrm SD0_WCLK>; 26 clocks = <&topcrm SD0_AHB>, <&topcrm SD0_WCLK>;
27 clock-names = "biu", "ciu"; 27 clock-names = "biu", "ciu";
28 num-slots = <1>;
29 max-frequency = <50000000>; 28 max-frequency = <50000000>;
30 cap-sdio-irq; 29 cap-sdio-irq;
31 cap-sd-highspeed; 30 cap-sd-highspeed;
diff --git a/Documentation/devicetree/bindings/net/brcm,amac.txt b/Documentation/devicetree/bindings/net/brcm,amac.txt
index 2fefa1a44afd..ad16c1f481f7 100644
--- a/Documentation/devicetree/bindings/net/brcm,amac.txt
+++ b/Documentation/devicetree/bindings/net/brcm,amac.txt
@@ -11,6 +11,7 @@ Required properties:
11 - reg-names: Names of the registers. 11 - reg-names: Names of the registers.
12 "amac_base": Address and length of the GMAC registers 12 "amac_base": Address and length of the GMAC registers
13 "idm_base": Address and length of the GMAC IDM registers 13 "idm_base": Address and length of the GMAC IDM registers
14 (required for NSP and Northstar2)
14 "nicpm_base": Address and length of the NIC Port Manager 15 "nicpm_base": Address and length of the NIC Port Manager
15 registers (required for Northstar2) 16 registers (required for Northstar2)
16 - interrupts: Interrupt number 17 - interrupts: Interrupt number
diff --git a/Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt b/Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt
deleted file mode 100644
index 022946caa7e2..000000000000
--- a/Documentation/devicetree/bindings/net/brcm,bgmac-nsp.txt
+++ /dev/null
@@ -1,24 +0,0 @@
1Broadcom GMAC Ethernet Controller Device Tree Bindings
2-------------------------------------------------------------
3
4Required properties:
5 - compatible: "brcm,bgmac-nsp"
6 - reg: Address and length of the GMAC registers,
7 Address and length of the GMAC IDM registers
8 - reg-names: Names of the registers. Must have both "gmac_base" and
9 "idm_base"
10 - interrupts: Interrupt number
11
12Optional properties:
13- mac-address: See ethernet.txt file in the same directory
14
15Examples:
16
17gmac0: ethernet@18022000 {
18 compatible = "brcm,bgmac-nsp";
19 reg = <0x18022000 0x1000>,
20 <0x18110000 0x1000>;
21 reg-names = "gmac_base", "idm_base";
22 interrupts = <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>;
23 status = "disabled";
24};
diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
index 194926f77194..1ff02afdc55a 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
+++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
@@ -4,7 +4,7 @@ Required properties:
4- compatible: Should be one of the following. 4- compatible: Should be one of the following.
5 - "rockchip,rk3066a-efuse" - for RK3066a SoCs. 5 - "rockchip,rk3066a-efuse" - for RK3066a SoCs.
6 - "rockchip,rk3188-efuse" - for RK3188 SoCs. 6 - "rockchip,rk3188-efuse" - for RK3188 SoCs.
7 - "rockchip,rk322x-efuse" - for RK322x SoCs. 7 - "rockchip,rk3228-efuse" - for RK3228 SoCs.
8 - "rockchip,rk3288-efuse" - for RK3288 SoCs. 8 - "rockchip,rk3288-efuse" - for RK3288 SoCs.
9 - "rockchip,rk3399-efuse" - for RK3399 SoCs. 9 - "rockchip,rk3399-efuse" - for RK3399 SoCs.
10- reg: Should contain the registers location and exact eFuse size 10- reg: Should contain the registers location and exact eFuse size
diff --git a/Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt b/Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt
index 07590bcdad15..7c04e22a5d6a 100644
--- a/Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt
+++ b/Documentation/devicetree/bindings/ptp/brcm,ptp-dte.txt
@@ -1,13 +1,20 @@
1* Broadcom Digital Timing Engine(DTE) based PTP clock driver 1* Broadcom Digital Timing Engine(DTE) based PTP clock
2 2
3Required properties: 3Required properties:
4- compatible: should be "brcm,ptp-dte" 4- compatible: should contain the core compatibility string
5 and the SoC compatibility string. The SoC
6 compatibility string is to handle SoC specific
7 hardware differences.
8 Core compatibility string:
9 "brcm,ptp-dte"
10 SoC compatibility strings:
11 "brcm,iproc-ptp-dte" - for iproc based SoC's
5- reg: address and length of the DTE block's NCO registers 12- reg: address and length of the DTE block's NCO registers
6 13
7Example: 14Example:
8 15
9ptp_dte: ptp_dte@180af650 { 16ptp: ptp-dte@180af650 {
10 compatible = "brcm,ptp-dte"; 17 compatible = "brcm,iproc-ptp-dte", "brcm,ptp-dte";
11 reg = <0x180af650 0x10>; 18 reg = <0x180af650 0x10>;
12 status = "okay"; 19 status = "okay";
13}; 20};
diff --git a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
index e6b572409cf5..574c3a2c77d5 100644
--- a/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
+++ b/Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
@@ -9,7 +9,6 @@ Optional properties:
9- fsl,irda-mode : Indicate the uart supports irda mode 9- fsl,irda-mode : Indicate the uart supports irda mode
10- fsl,dte-mode : Indicate the uart works in DTE mode. The uart works 10- fsl,dte-mode : Indicate the uart works in DTE mode. The uart works
11 in DCE mode by default. 11 in DCE mode by default.
12- fsl,dma-size : Indicate the size of the DMA buffer and its periods
13 12
14Please check Documentation/devicetree/bindings/serial/serial.txt 13Please check Documentation/devicetree/bindings/serial/serial.txt
15for the complete list of generic properties. 14for the complete list of generic properties.
@@ -29,5 +28,4 @@ uart1: serial@73fbc000 {
29 interrupts = <31>; 28 interrupts = <31>;
30 uart-has-rtscts; 29 uart-has-rtscts;
31 fsl,dte-mode; 30 fsl,dte-mode;
32 fsl,dma-size = <1024 4>;
33}; 31};
diff --git a/MAINTAINERS b/MAINTAINERS
index 205d3977ac46..f66488dfdbc9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -205,7 +205,6 @@ F: include/net/9p/
205F: include/uapi/linux/virtio_9p.h 205F: include/uapi/linux/virtio_9p.h
206F: include/trace/events/9p.h 206F: include/trace/events/9p.h
207 207
208
209A8293 MEDIA DRIVER 208A8293 MEDIA DRIVER
210M: Antti Palosaari <crope@iki.fi> 209M: Antti Palosaari <crope@iki.fi>
211L: linux-media@vger.kernel.org 210L: linux-media@vger.kernel.org
@@ -492,13 +491,6 @@ S: Maintained
492F: Documentation/hwmon/adt7475 491F: Documentation/hwmon/adt7475
493F: drivers/hwmon/adt7475.c 492F: drivers/hwmon/adt7475.c
494 493
495ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346)
496M: Michael Hennerich <michael.hennerich@analog.com>
497W: http://wiki.analog.com/ADXL345
498W: http://ez.analog.com/community/linux-device-drivers
499S: Supported
500F: drivers/input/misc/adxl34x.c
501
502ADVANSYS SCSI DRIVER 494ADVANSYS SCSI DRIVER
503M: Matthew Wilcox <matthew@wil.cx> 495M: Matthew Wilcox <matthew@wil.cx>
504M: Hannes Reinecke <hare@suse.com> 496M: Hannes Reinecke <hare@suse.com>
@@ -507,6 +499,13 @@ S: Maintained
507F: Documentation/scsi/advansys.txt 499F: Documentation/scsi/advansys.txt
508F: drivers/scsi/advansys.c 500F: drivers/scsi/advansys.c
509 501
502ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346)
503M: Michael Hennerich <michael.hennerich@analog.com>
504W: http://wiki.analog.com/ADXL345
505W: http://ez.analog.com/community/linux-device-drivers
506S: Supported
507F: drivers/input/misc/adxl34x.c
508
510AEDSP16 DRIVER 509AEDSP16 DRIVER
511M: Riccardo Facchetti <fizban@tin.it> 510M: Riccardo Facchetti <fizban@tin.it>
512S: Maintained 511S: Maintained
@@ -808,6 +807,12 @@ W: http://blackfin.uclinux.org/
808S: Supported 807S: Supported
809F: sound/soc/blackfin/* 808F: sound/soc/blackfin/*
810 809
810ANALOG DEVICES INC DMA DRIVERS
811M: Lars-Peter Clausen <lars@metafoo.de>
812W: http://ez.analog.com/community/linux-device-drivers
813S: Supported
814F: drivers/dma/dma-axi-dmac.c
815
811ANALOG DEVICES INC IIO DRIVERS 816ANALOG DEVICES INC IIO DRIVERS
812M: Lars-Peter Clausen <lars@metafoo.de> 817M: Lars-Peter Clausen <lars@metafoo.de>
813M: Michael Hennerich <Michael.Hennerich@analog.com> 818M: Michael Hennerich <Michael.Hennerich@analog.com>
@@ -820,12 +825,6 @@ X: drivers/iio/*/adjd*
820F: drivers/staging/iio/*/ad* 825F: drivers/staging/iio/*/ad*
821F: drivers/staging/iio/trigger/iio-trig-bfin-timer.c 826F: drivers/staging/iio/trigger/iio-trig-bfin-timer.c
822 827
823ANALOG DEVICES INC DMA DRIVERS
824M: Lars-Peter Clausen <lars@metafoo.de>
825W: http://ez.analog.com/community/linux-device-drivers
826S: Supported
827F: drivers/dma/dma-axi-dmac.c
828
829ANDROID CONFIG FRAGMENTS 828ANDROID CONFIG FRAGMENTS
830M: Rob Herring <robh@kernel.org> 829M: Rob Herring <robh@kernel.org>
831S: Supported 830S: Supported
@@ -872,6 +871,15 @@ F: include/linux/apm_bios.h
872F: include/uapi/linux/apm_bios.h 871F: include/uapi/linux/apm_bios.h
873F: drivers/char/apm-emulation.c 872F: drivers/char/apm-emulation.c
874 873
874APPARMOR SECURITY MODULE
875M: John Johansen <john.johansen@canonical.com>
876L: apparmor@lists.ubuntu.com (subscribers-only, general discussion)
877W: apparmor.wiki.kernel.org
878T: git git://git.kernel.org/pub/scm/linux/kernel/git/jj/apparmor-dev.git
879S: Supported
880F: security/apparmor/
881F: Documentation/admin-guide/LSM/apparmor.rst
882
875APPLE BCM5974 MULTITOUCH DRIVER 883APPLE BCM5974 MULTITOUCH DRIVER
876M: Henrik Rydberg <rydberg@bitmath.org> 884M: Henrik Rydberg <rydberg@bitmath.org>
877L: linux-input@vger.kernel.org 885L: linux-input@vger.kernel.org
@@ -895,6 +903,18 @@ M: Duc Dang <dhdang@apm.com>
895S: Supported 903S: Supported
896F: arch/arm64/boot/dts/apm/ 904F: arch/arm64/boot/dts/apm/
897 905
906APPLIED MICRO (APM) X-GENE SOC EDAC
907M: Loc Ho <lho@apm.com>
908S: Supported
909F: drivers/edac/xgene_edac.c
910F: Documentation/devicetree/bindings/edac/apm-xgene-edac.txt
911
912APPLIED MICRO (APM) X-GENE SOC ETHERNET (V2) DRIVER
913M: Iyappan Subramanian <isubramanian@apm.com>
914M: Keyur Chudgar <kchudgar@apm.com>
915S: Supported
916F: drivers/net/ethernet/apm/xgene-v2/
917
898APPLIED MICRO (APM) X-GENE SOC ETHERNET DRIVER 918APPLIED MICRO (APM) X-GENE SOC ETHERNET DRIVER
899M: Iyappan Subramanian <isubramanian@apm.com> 919M: Iyappan Subramanian <isubramanian@apm.com>
900M: Keyur Chudgar <kchudgar@apm.com> 920M: Keyur Chudgar <kchudgar@apm.com>
@@ -905,12 +925,6 @@ F: drivers/net/phy/mdio-xgene.c
905F: Documentation/devicetree/bindings/net/apm-xgene-enet.txt 925F: Documentation/devicetree/bindings/net/apm-xgene-enet.txt
906F: Documentation/devicetree/bindings/net/apm-xgene-mdio.txt 926F: Documentation/devicetree/bindings/net/apm-xgene-mdio.txt
907 927
908APPLIED MICRO (APM) X-GENE SOC ETHERNET (V2) DRIVER
909M: Iyappan Subramanian <isubramanian@apm.com>
910M: Keyur Chudgar <kchudgar@apm.com>
911S: Supported
912F: drivers/net/ethernet/apm/xgene-v2/
913
914APPLIED MICRO (APM) X-GENE SOC PMU 928APPLIED MICRO (APM) X-GENE SOC PMU
915M: Tai Nguyen <ttnguyen@apm.com> 929M: Tai Nguyen <ttnguyen@apm.com>
916S: Supported 930S: Supported
@@ -930,6 +944,12 @@ S: Maintained
930F: drivers/video/fbdev/arcfb.c 944F: drivers/video/fbdev/arcfb.c
931F: drivers/video/fbdev/core/fb_defio.c 945F: drivers/video/fbdev/core/fb_defio.c
932 946
947ARC PGU DRM DRIVER
948M: Alexey Brodkin <abrodkin@synopsys.com>
949S: Supported
950F: drivers/gpu/drm/arc/
951F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
952
933ARCNET NETWORK LAYER 953ARCNET NETWORK LAYER
934M: Michael Grzeschik <m.grzeschik@pengutronix.de> 954M: Michael Grzeschik <m.grzeschik@pengutronix.de>
935L: netdev@vger.kernel.org 955L: netdev@vger.kernel.org
@@ -937,12 +957,6 @@ S: Maintained
937F: drivers/net/arcnet/ 957F: drivers/net/arcnet/
938F: include/uapi/linux/if_arcnet.h 958F: include/uapi/linux/if_arcnet.h
939 959
940ARC PGU DRM DRIVER
941M: Alexey Brodkin <abrodkin@synopsys.com>
942S: Supported
943F: drivers/gpu/drm/arc/
944F: Documentation/devicetree/bindings/display/snps,arcpgu.txt
945
946ARM ARCHITECTED TIMER DRIVER 960ARM ARCHITECTED TIMER DRIVER
947M: Mark Rutland <mark.rutland@arm.com> 961M: Mark Rutland <mark.rutland@arm.com>
948M: Marc Zyngier <marc.zyngier@arm.com> 962M: Marc Zyngier <marc.zyngier@arm.com>
@@ -995,18 +1009,17 @@ S: Maintained
995T: git git://git.armlinux.org.uk/~rmk/linux-arm.git 1009T: git git://git.armlinux.org.uk/~rmk/linux-arm.git
996F: arch/arm/ 1010F: arch/arm/
997 1011
998ARM SUB-ARCHITECTURES
999L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1000S: Maintained
1001F: arch/arm/mach-*/
1002F: arch/arm/plat-*/
1003T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
1004
1005ARM PRIMECELL AACI PL041 DRIVER 1012ARM PRIMECELL AACI PL041 DRIVER
1006M: Russell King <linux@armlinux.org.uk> 1013M: Russell King <linux@armlinux.org.uk>
1007S: Maintained 1014S: Maintained
1008F: sound/arm/aaci.* 1015F: sound/arm/aaci.*
1009 1016
1017ARM PRIMECELL BUS SUPPORT
1018M: Russell King <linux@armlinux.org.uk>
1019S: Maintained
1020F: drivers/amba/
1021F: include/linux/amba/bus.h
1022
1010ARM PRIMECELL CLCD PL110 DRIVER 1023ARM PRIMECELL CLCD PL110 DRIVER
1011M: Russell King <linux@armlinux.org.uk> 1024M: Russell King <linux@armlinux.org.uk>
1012S: Maintained 1025S: Maintained
@@ -1030,11 +1043,22 @@ S: Maintained
1030F: drivers/tty/serial/amba-pl01*.c 1043F: drivers/tty/serial/amba-pl01*.c
1031F: include/linux/amba/serial.h 1044F: include/linux/amba/serial.h
1032 1045
1033ARM PRIMECELL BUS SUPPORT 1046ARM SMMU DRIVERS
1034M: Russell King <linux@armlinux.org.uk> 1047M: Will Deacon <will.deacon@arm.com>
1048R: Robin Murphy <robin.murphy@arm.com>
1049L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1035S: Maintained 1050S: Maintained
1036F: drivers/amba/ 1051F: drivers/iommu/arm-smmu.c
1037F: include/linux/amba/bus.h 1052F: drivers/iommu/arm-smmu-v3.c
1053F: drivers/iommu/io-pgtable-arm.c
1054F: drivers/iommu/io-pgtable-arm-v7s.c
1055
1056ARM SUB-ARCHITECTURES
1057L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1058S: Maintained
1059F: arch/arm/mach-*/
1060F: arch/arm/plat-*/
1061T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
1038 1062
1039ARM/ACTIONS SEMI ARCHITECTURE 1063ARM/ACTIONS SEMI ARCHITECTURE
1040M: Andreas Färber <afaerber@suse.de> 1064M: Andreas Färber <afaerber@suse.de>
@@ -1067,6 +1091,11 @@ M: Lennert Buytenhek <kernel@wantstofly.org>
1067L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1091L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1068S: Maintained 1092S: Maintained
1069 1093
1094ARM/Allwinner SoC Clock Support
1095M: Emilio López <emilio@elopez.com.ar>
1096S: Maintained
1097F: drivers/clk/sunxi/
1098
1070ARM/Allwinner sunXi SoC support 1099ARM/Allwinner sunXi SoC support
1071M: Maxime Ripard <maxime.ripard@free-electrons.com> 1100M: Maxime Ripard <maxime.ripard@free-electrons.com>
1072M: Chen-Yu Tsai <wens@csie.org> 1101M: Chen-Yu Tsai <wens@csie.org>
@@ -1081,10 +1110,15 @@ F: drivers/pinctrl/sunxi/
1081F: drivers/soc/sunxi/ 1110F: drivers/soc/sunxi/
1082T: git git://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git 1111T: git git://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git
1083 1112
1084ARM/Allwinner SoC Clock Support 1113ARM/Amlogic Meson SoC CLOCK FRAMEWORK
1085M: Emilio López <emilio@elopez.com.ar> 1114M: Neil Armstrong <narmstrong@baylibre.com>
1115M: Jerome Brunet <jbrunet@baylibre.com>
1116L: linux-amlogic@lists.infradead.org
1086S: Maintained 1117S: Maintained
1087F: drivers/clk/sunxi/ 1118F: drivers/clk/meson/
1119F: include/dt-bindings/clock/meson*
1120F: include/dt-bindings/clock/gxbb*
1121F: Documentation/devicetree/bindings/clock/amlogic*
1088 1122
1089ARM/Amlogic Meson SoC support 1123ARM/Amlogic Meson SoC support
1090M: Carlo Caione <carlo@caione.org> 1124M: Carlo Caione <carlo@caione.org>
@@ -1096,20 +1130,10 @@ S: Maintained
1096F: arch/arm/mach-meson/ 1130F: arch/arm/mach-meson/
1097F: arch/arm/boot/dts/meson* 1131F: arch/arm/boot/dts/meson*
1098F: arch/arm64/boot/dts/amlogic/ 1132F: arch/arm64/boot/dts/amlogic/
1099F: drivers/pinctrl/meson/ 1133F: drivers/pinctrl/meson/
1100F: drivers/mmc/host/meson* 1134F: drivers/mmc/host/meson*
1101N: meson 1135N: meson
1102 1136
1103ARM/Amlogic Meson SoC CLOCK FRAMEWORK
1104M: Neil Armstrong <narmstrong@baylibre.com>
1105M: Jerome Brunet <jbrunet@baylibre.com>
1106L: linux-amlogic@lists.infradead.org
1107S: Maintained
1108F: drivers/clk/meson/
1109F: include/dt-bindings/clock/meson*
1110F: include/dt-bindings/clock/gxbb*
1111F: Documentation/devicetree/bindings/clock/amlogic*
1112
1113ARM/Annapurna Labs ALPINE ARCHITECTURE 1137ARM/Annapurna Labs ALPINE ARCHITECTURE
1114M: Tsahee Zidenberg <tsahee@annapurnalabs.com> 1138M: Tsahee Zidenberg <tsahee@annapurnalabs.com>
1115M: Antoine Tenart <antoine.tenart@free-electrons.com> 1139M: Antoine Tenart <antoine.tenart@free-electrons.com>
@@ -1132,13 +1156,6 @@ F: drivers/clk/axis
1132F: drivers/pinctrl/pinctrl-artpec* 1156F: drivers/pinctrl/pinctrl-artpec*
1133F: Documentation/devicetree/bindings/pinctrl/axis,artpec6-pinctrl.txt 1157F: Documentation/devicetree/bindings/pinctrl/axis,artpec6-pinctrl.txt
1134 1158
1135ARM/ASPEED MACHINE SUPPORT
1136M: Joel Stanley <joel@jms.id.au>
1137S: Maintained
1138F: arch/arm/mach-aspeed/
1139F: arch/arm/boot/dts/aspeed-*
1140F: drivers/*/*aspeed*
1141
1142ARM/ASPEED I2C DRIVER 1159ARM/ASPEED I2C DRIVER
1143M: Brendan Higgins <brendanhiggins@google.com> 1160M: Brendan Higgins <brendanhiggins@google.com>
1144R: Benjamin Herrenschmidt <benh@kernel.crashing.org> 1161R: Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -1151,6 +1168,18 @@ F: drivers/i2c/busses/i2c-aspeed.c
1151F: Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2400-i2c-ic.txt 1168F: Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2400-i2c-ic.txt
1152F: Documentation/devicetree/bindings/i2c/i2c-aspeed.txt 1169F: Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
1153 1170
1171ARM/ASPEED MACHINE SUPPORT
1172M: Joel Stanley <joel@jms.id.au>
1173S: Maintained
1174F: arch/arm/mach-aspeed/
1175F: arch/arm/boot/dts/aspeed-*
1176F: drivers/*/*aspeed*
1177
1178ARM/ATMEL AT91 Clock Support
1179M: Boris Brezillon <boris.brezillon@free-electrons.com>
1180S: Maintained
1181F: drivers/clk/at91
1182
1154ARM/ATMEL AT91RM9200, AT91SAM9 AND SAMA5 SOC SUPPORT 1183ARM/ATMEL AT91RM9200, AT91SAM9 AND SAMA5 SOC SUPPORT
1155M: Nicolas Ferre <nicolas.ferre@microchip.com> 1184M: Nicolas Ferre <nicolas.ferre@microchip.com>
1156M: Alexandre Belloni <alexandre.belloni@free-electrons.com> 1185M: Alexandre Belloni <alexandre.belloni@free-electrons.com>
@@ -1167,11 +1196,6 @@ F: arch/arm/boot/dts/sama*.dtsi
1167F: arch/arm/include/debug/at91.S 1196F: arch/arm/include/debug/at91.S
1168F: drivers/memory/atmel* 1197F: drivers/memory/atmel*
1169 1198
1170ARM/ATMEL AT91 Clock Support
1171M: Boris Brezillon <boris.brezillon@free-electrons.com>
1172S: Maintained
1173F: drivers/clk/at91
1174
1175ARM/CALXEDA HIGHBANK ARCHITECTURE 1199ARM/CALXEDA HIGHBANK ARCHITECTURE
1176M: Rob Herring <robh@kernel.org> 1200M: Rob Herring <robh@kernel.org>
1177L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1201L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1198,6 +1222,11 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1198S: Odd Fixes 1222S: Odd Fixes
1199N: clps711x 1223N: clps711x
1200 1224
1225ARM/CIRRUS LOGIC EDB9315A MACHINE SUPPORT
1226M: Lennert Buytenhek <kernel@wantstofly.org>
1227L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1228S: Maintained
1229
1201ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE 1230ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE
1202M: Hartley Sweeten <hsweeten@visionengravers.com> 1231M: Hartley Sweeten <hsweeten@visionengravers.com>
1203M: Alexander Sverdlin <alexander.sverdlin@gmail.com> 1232M: Alexander Sverdlin <alexander.sverdlin@gmail.com>
@@ -1206,11 +1235,6 @@ S: Maintained
1206F: arch/arm/mach-ep93xx/ 1235F: arch/arm/mach-ep93xx/
1207F: arch/arm/mach-ep93xx/include/mach/ 1236F: arch/arm/mach-ep93xx/include/mach/
1208 1237
1209ARM/CIRRUS LOGIC EDB9315A MACHINE SUPPORT
1210M: Lennert Buytenhek <kernel@wantstofly.org>
1211L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1212S: Maintained
1213
1214ARM/CLKDEV SUPPORT 1238ARM/CLKDEV SUPPORT
1215M: Russell King <linux@armlinux.org.uk> 1239M: Russell King <linux@armlinux.org.uk>
1216L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1240L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1224,6 +1248,13 @@ M: Mike Rapoport <mike@compulab.co.il>
1224L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1248L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1225S: Maintained 1249S: Maintained
1226 1250
1251ARM/CONEXANT DIGICOLOR MACHINE SUPPORT
1252M: Baruch Siach <baruch@tkos.co.il>
1253L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1254S: Maintained
1255F: arch/arm/boot/dts/cx92755*
1256N: digicolor
1257
1227ARM/CONTEC MICRO9 MACHINE SUPPORT 1258ARM/CONTEC MICRO9 MACHINE SUPPORT
1228M: Hubert Feurstein <hubert.feurstein@contec.at> 1259M: Hubert Feurstein <hubert.feurstein@contec.at>
1229S: Maintained 1260S: Maintained
@@ -1269,13 +1300,6 @@ F: drivers/clocksource/timer-prima2.c
1269F: drivers/clocksource/timer-atlas7.c 1300F: drivers/clocksource/timer-atlas7.c
1270N: [^a-z]sirf 1301N: [^a-z]sirf
1271 1302
1272ARM/CONEXANT DIGICOLOR MACHINE SUPPORT
1273M: Baruch Siach <baruch@tkos.co.il>
1274L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1275S: Maintained
1276F: arch/arm/boot/dts/cx92755*
1277N: digicolor
1278
1279ARM/EBSA110 MACHINE SUPPORT 1303ARM/EBSA110 MACHINE SUPPORT
1280M: Russell King <linux@armlinux.org.uk> 1304M: Russell King <linux@armlinux.org.uk>
1281L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1305L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1389,6 +1413,11 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1389S: Maintained 1413S: Maintained
1390F: arch/arm/mach-pxa/colibri-pxa270-income.c 1414F: arch/arm/mach-pxa/colibri-pxa270-income.c
1391 1415
1416ARM/INTEL IOP13XX ARM ARCHITECTURE
1417M: Lennert Buytenhek <kernel@wantstofly.org>
1418L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1419S: Maintained
1420
1392ARM/INTEL IOP32X ARM ARCHITECTURE 1421ARM/INTEL IOP32X ARM ARCHITECTURE
1393M: Lennert Buytenhek <kernel@wantstofly.org> 1422M: Lennert Buytenhek <kernel@wantstofly.org>
1394L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1423L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1398,11 +1427,6 @@ ARM/INTEL IOP33X ARM ARCHITECTURE
1398L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1427L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1399S: Orphan 1428S: Orphan
1400 1429
1401ARM/INTEL IOP13XX ARM ARCHITECTURE
1402M: Lennert Buytenhek <kernel@wantstofly.org>
1403L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1404S: Maintained
1405
1406ARM/INTEL IQ81342EX MACHINE SUPPORT 1430ARM/INTEL IQ81342EX MACHINE SUPPORT
1407M: Lennert Buytenhek <kernel@wantstofly.org> 1431M: Lennert Buytenhek <kernel@wantstofly.org>
1408L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1432L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1437,39 +1461,6 @@ M: Lennert Buytenhek <kernel@wantstofly.org>
1437L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1461L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1438S: Maintained 1462S: Maintained
1439 1463
1440ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE
1441M: Santosh Shilimkar <ssantosh@kernel.org>
1442L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1443S: Maintained
1444F: arch/arm/mach-keystone/
1445F: arch/arm/boot/dts/keystone-*
1446T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
1447
1448ARM/TEXAS INSTRUMENT KEYSTONE CLOCK FRAMEWORK
1449M: Santosh Shilimkar <ssantosh@kernel.org>
1450L: linux-kernel@vger.kernel.org
1451S: Maintained
1452F: drivers/clk/keystone/
1453
1454ARM/TEXAS INSTRUMENT KEYSTONE ClOCKSOURCE
1455M: Santosh Shilimkar <ssantosh@kernel.org>
1456L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1457L: linux-kernel@vger.kernel.org
1458S: Maintained
1459F: drivers/clocksource/timer-keystone.c
1460
1461ARM/TEXAS INSTRUMENT KEYSTONE RESET DRIVER
1462M: Santosh Shilimkar <ssantosh@kernel.org>
1463L: linux-kernel@vger.kernel.org
1464S: Maintained
1465F: drivers/power/reset/keystone-reset.c
1466
1467ARM/TEXAS INSTRUMENT AEMIF/EMIF DRIVERS
1468M: Santosh Shilimkar <ssantosh@kernel.org>
1469L: linux-kernel@vger.kernel.org
1470S: Maintained
1471F: drivers/memory/*emif*
1472
1473ARM/LG1K ARCHITECTURE 1464ARM/LG1K ARCHITECTURE
1474M: Chanho Min <chanho.min@lge.com> 1465M: Chanho Min <chanho.min@lge.com>
1475L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1466L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -1512,24 +1503,6 @@ ARM/MAGICIAN MACHINE SUPPORT
1512M: Philipp Zabel <philipp.zabel@gmail.com> 1503M: Philipp Zabel <philipp.zabel@gmail.com>
1513S: Maintained 1504S: Maintained
1514 1505
1515ARM/Marvell Kirkwood and Armada 370, 375, 38x, 39x, XP, 3700, 7K/8K SOC support
1516M: Jason Cooper <jason@lakedaemon.net>
1517M: Andrew Lunn <andrew@lunn.ch>
1518M: Gregory Clement <gregory.clement@free-electrons.com>
1519M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
1520L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1521S: Maintained
1522F: arch/arm/boot/dts/armada*
1523F: arch/arm/boot/dts/kirkwood*
1524F: arch/arm/configs/mvebu_*_defconfig
1525F: arch/arm/mach-mvebu/
1526F: arch/arm64/boot/dts/marvell/armada*
1527F: drivers/cpufreq/mvebu-cpufreq.c
1528F: drivers/irqchip/irq-armada-370-xp.c
1529F: drivers/irqchip/irq-mvebu-*
1530F: drivers/pinctrl/mvebu/
1531F: drivers/rtc/rtc-armada38x.c
1532
1533ARM/Marvell Berlin SoC support 1506ARM/Marvell Berlin SoC support
1534M: Jisheng Zhang <jszhang@marvell.com> 1507M: Jisheng Zhang <jszhang@marvell.com>
1535M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> 1508M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
@@ -1539,7 +1512,6 @@ F: arch/arm/mach-berlin/
1539F: arch/arm/boot/dts/berlin* 1512F: arch/arm/boot/dts/berlin*
1540F: arch/arm64/boot/dts/marvell/berlin* 1513F: arch/arm64/boot/dts/marvell/berlin*
1541 1514
1542
1543ARM/Marvell Dove/MV78xx0/Orion SOC support 1515ARM/Marvell Dove/MV78xx0/Orion SOC support
1544M: Jason Cooper <jason@lakedaemon.net> 1516M: Jason Cooper <jason@lakedaemon.net>
1545M: Andrew Lunn <andrew@lunn.ch> 1517M: Andrew Lunn <andrew@lunn.ch>
@@ -1555,24 +1527,23 @@ F: arch/arm/plat-orion/
1555F: arch/arm/boot/dts/dove* 1527F: arch/arm/boot/dts/dove*
1556F: arch/arm/boot/dts/orion5x* 1528F: arch/arm/boot/dts/orion5x*
1557 1529
1558 1530ARM/Marvell Kirkwood and Armada 370, 375, 38x, 39x, XP, 3700, 7K/8K SOC support
1559ARM/Orion SoC/Technologic Systems TS-78xx platform support 1531M: Jason Cooper <jason@lakedaemon.net>
1560M: Alexander Clouter <alex@digriz.org.uk> 1532M: Andrew Lunn <andrew@lunn.ch>
1561L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1533M: Gregory Clement <gregory.clement@free-electrons.com>
1562W: http://www.digriz.org.uk/ts78xx/kernel 1534M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
1563S: Maintained
1564F: arch/arm/mach-orion5x/ts78xx-*
1565
1566ARM/OXNAS platform support
1567M: Neil Armstrong <narmstrong@baylibre.com>
1568L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1535L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1569L: linux-oxnas@lists.tuxfamily.org (moderated for non-subscribers)
1570S: Maintained 1536S: Maintained
1571F: arch/arm/mach-oxnas/ 1537F: arch/arm/boot/dts/armada*
1572F: arch/arm/boot/dts/ox8*.dtsi 1538F: arch/arm/boot/dts/kirkwood*
1573F: arch/arm/boot/dts/wd-mbwe.dts 1539F: arch/arm/configs/mvebu_*_defconfig
1574F: arch/arm/boot/dts/cloudengines-pogoplug-series-3.dts 1540F: arch/arm/mach-mvebu/
1575N: oxnas 1541F: arch/arm64/boot/dts/marvell/armada*
1542F: drivers/cpufreq/mvebu-cpufreq.c
1543F: drivers/irqchip/irq-armada-370-xp.c
1544F: drivers/irqchip/irq-mvebu-*
1545F: drivers/pinctrl/mvebu/
1546F: drivers/rtc/rtc-armada38x.c
1576 1547
1577ARM/Mediatek RTC DRIVER 1548ARM/Mediatek RTC DRIVER
1578M: Eddie Huang <eddie.huang@mediatek.com> 1549M: Eddie Huang <eddie.huang@mediatek.com>
@@ -1627,16 +1598,53 @@ F: drivers/pinctrl/nomadik/
1627F: drivers/i2c/busses/i2c-nomadik.c 1598F: drivers/i2c/busses/i2c-nomadik.c
1628T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git 1599T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
1629 1600
1601ARM/NUVOTON W90X900 ARM ARCHITECTURE
1602M: Wan ZongShun <mcuos.com@gmail.com>
1603L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1604W: http://www.mcuos.com
1605S: Maintained
1606F: arch/arm/mach-w90x900/
1607F: drivers/input/keyboard/w90p910_keypad.c
1608F: drivers/input/touchscreen/w90p910_ts.c
1609F: drivers/watchdog/nuc900_wdt.c
1610F: drivers/net/ethernet/nuvoton/w90p910_ether.c
1611F: drivers/mtd/nand/nuc900_nand.c
1612F: drivers/rtc/rtc-nuc900.c
1613F: drivers/spi/spi-nuc900.c
1614F: drivers/usb/host/ehci-w90x900.c
1615F: drivers/video/fbdev/nuc900fb.c
1616
1630ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT 1617ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT
1631M: Nelson Castillo <arhuaco@freaks-unidos.net> 1618M: Nelson Castillo <arhuaco@freaks-unidos.net>
1632L: openmoko-kernel@lists.openmoko.org (subscribers-only) 1619L: openmoko-kernel@lists.openmoko.org (subscribers-only)
1633W: http://wiki.openmoko.org/wiki/Neo_FreeRunner 1620W: http://wiki.openmoko.org/wiki/Neo_FreeRunner
1634S: Supported 1621S: Supported
1635 1622
1636ARM/TOSA MACHINE SUPPORT 1623ARM/Orion SoC/Technologic Systems TS-78xx platform support
1637M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 1624M: Alexander Clouter <alex@digriz.org.uk>
1638M: Dirk Opfer <dirk@opfer-online.de> 1625L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1626W: http://www.digriz.org.uk/ts78xx/kernel
1627S: Maintained
1628F: arch/arm/mach-orion5x/ts78xx-*
1629
1630ARM/OXNAS platform support
1631M: Neil Armstrong <narmstrong@baylibre.com>
1632L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1633L: linux-oxnas@lists.tuxfamily.org (moderated for non-subscribers)
1639S: Maintained 1634S: Maintained
1635F: arch/arm/mach-oxnas/
1636F: arch/arm/boot/dts/ox8*.dtsi
1637F: arch/arm/boot/dts/wd-mbwe.dts
1638F: arch/arm/boot/dts/cloudengines-pogoplug-series-3.dts
1639N: oxnas
1640
1641ARM/PALM TREO SUPPORT
1642M: Tomas Cech <sleep_walker@suse.com>
1643L: linux-arm-kernel@lists.infradead.org
1644W: http://hackndev.com
1645S: Maintained
1646F: arch/arm/mach-pxa/include/mach/palmtreo.h
1647F: arch/arm/mach-pxa/palmtreo.c
1640 1648
1641ARM/PALMTX,PALMT5,PALMLD,PALMTE2,PALMTC SUPPORT 1649ARM/PALMTX,PALMT5,PALMLD,PALMTE2,PALMTC SUPPORT
1642M: Marek Vasut <marek.vasut@gmail.com> 1650M: Marek Vasut <marek.vasut@gmail.com>
@@ -1654,14 +1662,6 @@ F: arch/arm/mach-pxa/palmte2.c
1654F: arch/arm/mach-pxa/include/mach/palmtc.h 1662F: arch/arm/mach-pxa/include/mach/palmtc.h
1655F: arch/arm/mach-pxa/palmtc.c 1663F: arch/arm/mach-pxa/palmtc.c
1656 1664
1657ARM/PALM TREO SUPPORT
1658M: Tomas Cech <sleep_walker@suse.com>
1659L: linux-arm-kernel@lists.infradead.org
1660W: http://hackndev.com
1661S: Maintained
1662F: arch/arm/mach-pxa/include/mach/palmtreo.h
1663F: arch/arm/mach-pxa/palmtreo.c
1664
1665ARM/PALMZ72 SUPPORT 1665ARM/PALMZ72 SUPPORT
1666M: Sergey Lapin <slapin@ossfans.org> 1666M: Sergey Lapin <slapin@ossfans.org>
1667L: linux-arm-kernel@lists.infradead.org 1667L: linux-arm-kernel@lists.infradead.org
@@ -1802,17 +1802,6 @@ L: linux-media@vger.kernel.org
1802S: Maintained 1802S: Maintained
1803F: drivers/media/platform/s5p-g2d/ 1803F: drivers/media/platform/s5p-g2d/
1804 1804
1805ARM/SAMSUNG S5P SERIES Multi Format Codec (MFC) SUPPORT
1806M: Kyungmin Park <kyungmin.park@samsung.com>
1807M: Kamil Debski <kamil@wypas.org>
1808M: Jeongtae Park <jtp.park@samsung.com>
1809M: Andrzej Hajda <a.hajda@samsung.com>
1810L: linux-arm-kernel@lists.infradead.org
1811L: linux-media@vger.kernel.org
1812S: Maintained
1813F: arch/arm/plat-samsung/s5p-dev-mfc.c
1814F: drivers/media/platform/s5p-mfc/
1815
1816ARM/SAMSUNG S5P SERIES HDMI CEC SUBSYSTEM SUPPORT 1805ARM/SAMSUNG S5P SERIES HDMI CEC SUBSYSTEM SUPPORT
1817M: Marek Szyprowski <m.szyprowski@samsung.com> 1806M: Marek Szyprowski <m.szyprowski@samsung.com>
1818L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 1807L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
@@ -1829,6 +1818,17 @@ L: linux-media@vger.kernel.org
1829S: Maintained 1818S: Maintained
1830F: drivers/media/platform/s5p-jpeg/ 1819F: drivers/media/platform/s5p-jpeg/
1831 1820
1821ARM/SAMSUNG S5P SERIES Multi Format Codec (MFC) SUPPORT
1822M: Kyungmin Park <kyungmin.park@samsung.com>
1823M: Kamil Debski <kamil@wypas.org>
1824M: Jeongtae Park <jtp.park@samsung.com>
1825M: Andrzej Hajda <a.hajda@samsung.com>
1826L: linux-arm-kernel@lists.infradead.org
1827L: linux-media@vger.kernel.org
1828S: Maintained
1829F: arch/arm/plat-samsung/s5p-dev-mfc.c
1830F: drivers/media/platform/s5p-mfc/
1831
1832ARM/SHMOBILE ARM ARCHITECTURE 1832ARM/SHMOBILE ARM ARCHITECTURE
1833M: Simon Horman <horms@verge.net.au> 1833M: Simon Horman <horms@verge.net.au>
1834M: Magnus Damm <magnus.damm@gmail.com> 1834M: Magnus Damm <magnus.damm@gmail.com>
@@ -1922,26 +1922,48 @@ M: "Mark F. Brown" <mark.brown314@gmail.com>
1922L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1922L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1923S: Maintained 1923S: Maintained
1924 1924
1925ARM/TEXAS INSTRUMENT AEMIF/EMIF DRIVERS
1926M: Santosh Shilimkar <ssantosh@kernel.org>
1927L: linux-kernel@vger.kernel.org
1928S: Maintained
1929F: drivers/memory/*emif*
1930
1931ARM/TEXAS INSTRUMENT KEYSTONE ARCHITECTURE
1932M: Santosh Shilimkar <ssantosh@kernel.org>
1933L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1934S: Maintained
1935F: arch/arm/mach-keystone/
1936F: arch/arm/boot/dts/keystone-*
1937T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
1938
1939ARM/TEXAS INSTRUMENT KEYSTONE CLOCK FRAMEWORK
1940M: Santosh Shilimkar <ssantosh@kernel.org>
1941L: linux-kernel@vger.kernel.org
1942S: Maintained
1943F: drivers/clk/keystone/
1944
1945ARM/TEXAS INSTRUMENT KEYSTONE ClOCKSOURCE
1946M: Santosh Shilimkar <ssantosh@kernel.org>
1947L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1948L: linux-kernel@vger.kernel.org
1949S: Maintained
1950F: drivers/clocksource/timer-keystone.c
1951
1952ARM/TEXAS INSTRUMENT KEYSTONE RESET DRIVER
1953M: Santosh Shilimkar <ssantosh@kernel.org>
1954L: linux-kernel@vger.kernel.org
1955S: Maintained
1956F: drivers/power/reset/keystone-reset.c
1957
1925ARM/THECUS N2100 MACHINE SUPPORT 1958ARM/THECUS N2100 MACHINE SUPPORT
1926M: Lennert Buytenhek <kernel@wantstofly.org> 1959M: Lennert Buytenhek <kernel@wantstofly.org>
1927L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1960L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1928S: Maintained 1961S: Maintained
1929 1962
1930ARM/NUVOTON W90X900 ARM ARCHITECTURE 1963ARM/TOSA MACHINE SUPPORT
1931M: Wan ZongShun <mcuos.com@gmail.com> 1964M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
1932L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1965M: Dirk Opfer <dirk@opfer-online.de>
1933W: http://www.mcuos.com
1934S: Maintained 1966S: Maintained
1935F: arch/arm/mach-w90x900/
1936F: drivers/input/keyboard/w90p910_keypad.c
1937F: drivers/input/touchscreen/w90p910_ts.c
1938F: drivers/watchdog/nuc900_wdt.c
1939F: drivers/net/ethernet/nuvoton/w90p910_ether.c
1940F: drivers/mtd/nand/nuc900_nand.c
1941F: drivers/rtc/rtc-nuc900.c
1942F: drivers/spi/spi-nuc900.c
1943F: drivers/usb/host/ehci-w90x900.c
1944F: drivers/video/fbdev/nuc900fb.c
1945 1967
1946ARM/U300 MACHINE SUPPORT 1968ARM/U300 MACHINE SUPPORT
1947M: Linus Walleij <linus.walleij@linaro.org> 1969M: Linus Walleij <linus.walleij@linaro.org>
@@ -2086,16 +2108,6 @@ F: drivers/i2c/busses/i2c-cadence.c
2086F: drivers/mmc/host/sdhci-of-arasan.c 2108F: drivers/mmc/host/sdhci-of-arasan.c
2087F: drivers/edac/synopsys_edac.c 2109F: drivers/edac/synopsys_edac.c
2088 2110
2089ARM SMMU DRIVERS
2090M: Will Deacon <will.deacon@arm.com>
2091R: Robin Murphy <robin.murphy@arm.com>
2092L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
2093S: Maintained
2094F: drivers/iommu/arm-smmu.c
2095F: drivers/iommu/arm-smmu-v3.c
2096F: drivers/iommu/io-pgtable-arm.c
2097F: drivers/iommu/io-pgtable-arm-v7s.c
2098
2099ARM64 PORT (AARCH64 ARCHITECTURE) 2111ARM64 PORT (AARCH64 ARCHITECTURE)
2100M: Catalin Marinas <catalin.marinas@arm.com> 2112M: Catalin Marinas <catalin.marinas@arm.com>
2101M: Will Deacon <will.deacon@arm.com> 2113M: Will Deacon <will.deacon@arm.com>
@@ -2207,21 +2219,10 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
2207S: Supported 2219S: Supported
2208F: drivers/net/wireless/ath/ath6kl/ 2220F: drivers/net/wireless/ath/ath6kl/
2209 2221
2210WILOCITY WIL6210 WIRELESS DRIVER 2222ATI_REMOTE2 DRIVER
2211M: Maya Erez <qca_merez@qca.qualcomm.com> 2223M: Ville Syrjala <syrjala@sci.fi>
2212L: linux-wireless@vger.kernel.org
2213L: wil6210@qca.qualcomm.com
2214S: Supported
2215W: http://wireless.kernel.org/en/users/Drivers/wil6210
2216F: drivers/net/wireless/ath/wil6210/
2217F: include/uapi/linux/wil6210_uapi.h
2218
2219CARL9170 LINUX COMMUNITY WIRELESS DRIVER
2220M: Christian Lamparter <chunkeey@googlemail.com>
2221L: linux-wireless@vger.kernel.org
2222W: http://wireless.kernel.org/en/users/Drivers/carl9170
2223S: Maintained 2224S: Maintained
2224F: drivers/net/wireless/ath/carl9170/ 2225F: drivers/input/misc/ati_remote2.c
2225 2226
2226ATK0110 HWMON DRIVER 2227ATK0110 HWMON DRIVER
2227M: Luca Tettamanti <kronos.it@gmail.com> 2228M: Luca Tettamanti <kronos.it@gmail.com>
@@ -2229,11 +2230,6 @@ L: linux-hwmon@vger.kernel.org
2229S: Maintained 2230S: Maintained
2230F: drivers/hwmon/asus_atk0110.c 2231F: drivers/hwmon/asus_atk0110.c
2231 2232
2232ATI_REMOTE2 DRIVER
2233M: Ville Syrjala <syrjala@sci.fi>
2234S: Maintained
2235F: drivers/input/misc/ati_remote2.c
2236
2237ATLX ETHERNET DRIVERS 2233ATLX ETHERNET DRIVERS
2238M: Jay Cliburn <jcliburn@gmail.com> 2234M: Jay Cliburn <jcliburn@gmail.com>
2239M: Chris Snook <chris.snook@gmail.com> 2235M: Chris Snook <chris.snook@gmail.com>
@@ -2263,25 +2259,12 @@ M: Nicolas Ferre <nicolas.ferre@microchip.com>
2263S: Supported 2259S: Supported
2264F: drivers/power/reset/at91-sama5d2_shdwc.c 2260F: drivers/power/reset/at91-sama5d2_shdwc.c
2265 2261
2266ATMEL SAMA5D2 ADC DRIVER
2267M: Ludovic Desroches <ludovic.desroches@microchip.com>
2268L: linux-iio@vger.kernel.org
2269S: Supported
2270F: drivers/iio/adc/at91-sama5d2_adc.c
2271
2272ATMEL Audio ALSA driver 2262ATMEL Audio ALSA driver
2273M: Nicolas Ferre <nicolas.ferre@microchip.com> 2263M: Nicolas Ferre <nicolas.ferre@microchip.com>
2274L: alsa-devel@alsa-project.org (moderated for non-subscribers) 2264L: alsa-devel@alsa-project.org (moderated for non-subscribers)
2275S: Supported 2265S: Supported
2276F: sound/soc/atmel 2266F: sound/soc/atmel
2277 2267
2278ATMEL XDMA DRIVER
2279M: Ludovic Desroches <ludovic.desroches@microchip.com>
2280L: linux-arm-kernel@lists.infradead.org
2281L: dmaengine@vger.kernel.org
2282S: Supported
2283F: drivers/dma/at_xdmac.c
2284
2285ATMEL I2C DRIVER 2268ATMEL I2C DRIVER
2286M: Ludovic Desroches <ludovic.desroches@microchip.com> 2269M: Ludovic Desroches <ludovic.desroches@microchip.com>
2287L: linux-i2c@vger.kernel.org 2270L: linux-i2c@vger.kernel.org
@@ -2307,6 +2290,14 @@ M: Nicolas Ferre <nicolas.ferre@microchip.com>
2307S: Supported 2290S: Supported
2308F: drivers/net/ethernet/cadence/ 2291F: drivers/net/ethernet/cadence/
2309 2292
2293ATMEL MAXTOUCH DRIVER
2294M: Nick Dyer <nick@shmanahar.org>
2295T: git git://github.com/ndyer/linux.git
2296S: Maintained
2297F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt
2298F: drivers/input/touchscreen/atmel_mxt_ts.c
2299F: include/linux/platform_data/atmel_mxt_ts.h
2300
2310ATMEL NAND DRIVER 2301ATMEL NAND DRIVER
2311M: Wenyou Yang <wenyou.yang@atmel.com> 2302M: Wenyou Yang <wenyou.yang@atmel.com>
2312M: Josh Wu <rainyfeeling@outlook.com> 2303M: Josh Wu <rainyfeeling@outlook.com>
@@ -2314,6 +2305,12 @@ L: linux-mtd@lists.infradead.org
2314S: Supported 2305S: Supported
2315F: drivers/mtd/nand/atmel/* 2306F: drivers/mtd/nand/atmel/*
2316 2307
2308ATMEL SAMA5D2 ADC DRIVER
2309M: Ludovic Desroches <ludovic.desroches@microchip.com>
2310L: linux-iio@vger.kernel.org
2311S: Supported
2312F: drivers/iio/adc/at91-sama5d2_adc.c
2313
2317ATMEL SDMMC DRIVER 2314ATMEL SDMMC DRIVER
2318M: Ludovic Desroches <ludovic.desroches@microchip.com> 2315M: Ludovic Desroches <ludovic.desroches@microchip.com>
2319L: linux-mmc@vger.kernel.org 2316L: linux-mmc@vger.kernel.org
@@ -2353,13 +2350,12 @@ W: http://atmelwlandriver.sourceforge.net/
2353S: Maintained 2350S: Maintained
2354F: drivers/net/wireless/atmel/atmel* 2351F: drivers/net/wireless/atmel/atmel*
2355 2352
2356ATMEL MAXTOUCH DRIVER 2353ATMEL XDMA DRIVER
2357M: Nick Dyer <nick@shmanahar.org> 2354M: Ludovic Desroches <ludovic.desroches@microchip.com>
2358T: git git://github.com/ndyer/linux.git 2355L: linux-arm-kernel@lists.infradead.org
2359S: Maintained 2356L: dmaengine@vger.kernel.org
2360F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt 2357S: Supported
2361F: drivers/input/touchscreen/atmel_mxt_ts.c 2358F: drivers/dma/at_xdmac.c
2362F: include/linux/platform_data/atmel_mxt_ts.h
2363 2359
2364ATOMIC INFRASTRUCTURE 2360ATOMIC INFRASTRUCTURE
2365M: Will Deacon <will.deacon@arm.com> 2361M: Will Deacon <will.deacon@arm.com>
@@ -2413,13 +2409,6 @@ F: include/uapi/linux/ax25.h
2413F: include/net/ax25.h 2409F: include/net/ax25.h
2414F: net/ax25/ 2410F: net/ax25/
2415 2411
2416AXENTIA ASOC DRIVERS
2417M: Peter Rosin <peda@axentia.se>
2418L: alsa-devel@alsa-project.org (moderated for non-subscribers)
2419S: Maintained
2420F: Documentation/devicetree/bindings/sound/axentia,*
2421F: sound/soc/atmel/tse850-pcm5142.c
2422
2423AXENTIA ARM DEVICES 2412AXENTIA ARM DEVICES
2424M: Peter Rosin <peda@axentia.se> 2413M: Peter Rosin <peda@axentia.se>
2425L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 2414L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -2428,6 +2417,13 @@ F: Documentation/devicetree/bindings/arm/axentia.txt
2428F: arch/arm/boot/dts/at91-linea.dtsi 2417F: arch/arm/boot/dts/at91-linea.dtsi
2429F: arch/arm/boot/dts/at91-tse850-3.dts 2418F: arch/arm/boot/dts/at91-tse850-3.dts
2430 2419
2420AXENTIA ASOC DRIVERS
2421M: Peter Rosin <peda@axentia.se>
2422L: alsa-devel@alsa-project.org (moderated for non-subscribers)
2423S: Maintained
2424F: Documentation/devicetree/bindings/sound/axentia,*
2425F: sound/soc/atmel/tse850-pcm5142.c
2426
2431AZ6007 DVB DRIVER 2427AZ6007 DVB DRIVER
2432M: Mauro Carvalho Chehab <mchehab@s-opensource.com> 2428M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2433M: Mauro Carvalho Chehab <mchehab@kernel.org> 2429M: Mauro Carvalho Chehab <mchehab@kernel.org>
@@ -2507,13 +2503,11 @@ W: https://linuxtv.org
2507S: Supported 2503S: Supported
2508F: drivers/media/platform/sti/bdisp 2504F: drivers/media/platform/sti/bdisp
2509 2505
2510DELTA ST MEDIA DRIVER 2506BECKHOFF CX5020 ETHERCAT MASTER DRIVER
2511M: Hugues Fruchet <hugues.fruchet@st.com> 2507M: Dariusz Marcinkiewicz <reksio@newterm.pl>
2512L: linux-media@vger.kernel.org 2508L: netdev@vger.kernel.org
2513T: git git://linuxtv.org/media_tree.git 2509S: Maintained
2514W: https://linuxtv.org 2510F: drivers/net/ethernet/ec_bhf.c
2515S: Supported
2516F: drivers/media/platform/sti/delta
2517 2511
2518BEFS FILE SYSTEM 2512BEFS FILE SYSTEM
2519M: Luis de Bethencourt <luisbg@kernel.org> 2513M: Luis de Bethencourt <luisbg@kernel.org>
@@ -2523,11 +2517,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/luisbg/linux-befs.git
2523F: Documentation/filesystems/befs.txt 2517F: Documentation/filesystems/befs.txt
2524F: fs/befs/ 2518F: fs/befs/
2525 2519
2526BECKHOFF CX5020 ETHERCAT MASTER DRIVER 2520BFQ I/O SCHEDULER
2527M: Dariusz Marcinkiewicz <reksio@newterm.pl> 2521M: Paolo Valente <paolo.valente@linaro.org>
2528L: netdev@vger.kernel.org 2522M: Jens Axboe <axboe@kernel.dk>
2523L: linux-block@vger.kernel.org
2529S: Maintained 2524S: Maintained
2530F: drivers/net/ethernet/ec_bhf.c 2525F: block/bfq-*
2526F: Documentation/block/bfq-iosched.txt
2531 2527
2532BFS FILE SYSTEM 2528BFS FILE SYSTEM
2533M: "Tigran A. Aivazian" <aivazian.tigran@gmail.com> 2529M: "Tigran A. Aivazian" <aivazian.tigran@gmail.com>
@@ -2550,6 +2546,22 @@ W: http://blackfin.uclinux.org
2550S: Supported 2546S: Supported
2551F: drivers/net/ethernet/adi/ 2547F: drivers/net/ethernet/adi/
2552 2548
2549BLACKFIN I2C TWI DRIVER
2550M: Sonic Zhang <sonic.zhang@analog.com>
2551L: adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
2552W: http://blackfin.uclinux.org/
2553S: Supported
2554F: drivers/i2c/busses/i2c-bfin-twi.c
2555
2556BLACKFIN MEDIA DRIVER
2557M: Scott Jiang <scott.jiang.linux@gmail.com>
2558L: adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
2559W: http://blackfin.uclinux.org/
2560S: Supported
2561F: drivers/media/platform/blackfin/
2562F: drivers/media/i2c/adv7183*
2563F: drivers/media/i2c/vs6624*
2564
2553BLACKFIN RTC DRIVER 2565BLACKFIN RTC DRIVER
2554L: adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers) 2566L: adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
2555W: http://blackfin.uclinux.org 2567W: http://blackfin.uclinux.org
@@ -2576,22 +2588,6 @@ W: http://blackfin.uclinux.org
2576S: Supported 2588S: Supported
2577F: drivers/watchdog/bfin_wdt.c 2589F: drivers/watchdog/bfin_wdt.c
2578 2590
2579BLACKFIN I2C TWI DRIVER
2580M: Sonic Zhang <sonic.zhang@analog.com>
2581L: adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
2582W: http://blackfin.uclinux.org/
2583S: Supported
2584F: drivers/i2c/busses/i2c-bfin-twi.c
2585
2586BLACKFIN MEDIA DRIVER
2587M: Scott Jiang <scott.jiang.linux@gmail.com>
2588L: adi-buildroot-devel@lists.sourceforge.net (moderated for non-subscribers)
2589W: http://blackfin.uclinux.org/
2590S: Supported
2591F: drivers/media/platform/blackfin/
2592F: drivers/media/i2c/adv7183*
2593F: drivers/media/i2c/vs6624*
2594
2595BLINKM RGB LED DRIVER 2591BLINKM RGB LED DRIVER
2596M: Jan-Simon Moeller <jansimon.moeller@gmx.de> 2592M: Jan-Simon Moeller <jansimon.moeller@gmx.de>
2597S: Maintained 2593S: Maintained
@@ -2606,14 +2602,6 @@ F: block/
2606F: kernel/trace/blktrace.c 2602F: kernel/trace/blktrace.c
2607F: lib/sbitmap.c 2603F: lib/sbitmap.c
2608 2604
2609BFQ I/O SCHEDULER
2610M: Paolo Valente <paolo.valente@linaro.org>
2611M: Jens Axboe <axboe@kernel.dk>
2612L: linux-block@vger.kernel.org
2613S: Maintained
2614F: block/bfq-*
2615F: Documentation/block/bfq-iosched.txt
2616
2617BLOCK2MTD DRIVER 2605BLOCK2MTD DRIVER
2618M: Joern Engel <joern@lazybastard.org> 2606M: Joern Engel <joern@lazybastard.org>
2619L: linux-mtd@lists.infradead.org 2607L: linux-mtd@lists.infradead.org
@@ -2643,21 +2631,6 @@ S: Maintained
2643F: net/bluetooth/ 2631F: net/bluetooth/
2644F: include/net/bluetooth/ 2632F: include/net/bluetooth/
2645 2633
2646DMA MAPPING HELPERS
2647M: Christoph Hellwig <hch@lst.de>
2648M: Marek Szyprowski <m.szyprowski@samsung.com>
2649R: Robin Murphy <robin.murphy@arm.com>
2650L: linux-kernel@vger.kernel.org
2651T: git git://git.infradead.org/users/hch/dma-mapping.git
2652W: http://git.infradead.org/users/hch/dma-mapping.git
2653S: Supported
2654F: lib/dma-debug.c
2655F: lib/dma-noop.c
2656F: lib/dma-virt.c
2657F: drivers/base/dma-mapping.c
2658F: drivers/base/dma-coherent.c
2659F: include/linux/dma-mapping.h
2660
2661BONDING DRIVER 2634BONDING DRIVER
2662M: Jay Vosburgh <j.vosburgh@gmail.com> 2635M: Jay Vosburgh <j.vosburgh@gmail.com>
2663M: Veaceslav Falico <vfalico@gmail.com> 2636M: Veaceslav Falico <vfalico@gmail.com>
@@ -2705,35 +2678,6 @@ S: Supported
2705F: drivers/net/dsa/b53/* 2678F: drivers/net/dsa/b53/*
2706F: include/linux/platform_data/b53.h 2679F: include/linux/platform_data/b53.h
2707 2680
2708BROADCOM GENET ETHERNET DRIVER
2709M: Florian Fainelli <f.fainelli@gmail.com>
2710L: netdev@vger.kernel.org
2711S: Supported
2712F: drivers/net/ethernet/broadcom/genet/
2713
2714BROADCOM BNX2 GIGABIT ETHERNET DRIVER
2715M: Rasesh Mody <rasesh.mody@cavium.com>
2716M: Harish Patil <harish.patil@cavium.com>
2717M: Dept-GELinuxNICDev@cavium.com
2718L: netdev@vger.kernel.org
2719S: Supported
2720F: drivers/net/ethernet/broadcom/bnx2.*
2721F: drivers/net/ethernet/broadcom/bnx2_*
2722
2723BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
2724M: Yuval Mintz <Yuval.Mintz@cavium.com>
2725M: Ariel Elior <ariel.elior@cavium.com>
2726M: everest-linux-l2@cavium.com
2727L: netdev@vger.kernel.org
2728S: Supported
2729F: drivers/net/ethernet/broadcom/bnx2x/
2730
2731BROADCOM BNXT_EN 50 GIGABIT ETHERNET DRIVER
2732M: Michael Chan <michael.chan@broadcom.com>
2733L: netdev@vger.kernel.org
2734S: Supported
2735F: drivers/net/ethernet/broadcom/bnxt/
2736
2737BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITECTURE 2681BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITECTURE
2738M: Florian Fainelli <f.fainelli@gmail.com> 2682M: Florian Fainelli <f.fainelli@gmail.com>
2739M: Ray Jui <rjui@broadcom.com> 2683M: Ray Jui <rjui@broadcom.com>
@@ -2812,6 +2756,13 @@ F: arch/arm/boot/dts/bcm7*.dts*
2812F: drivers/bus/brcmstb_gisb.c 2756F: drivers/bus/brcmstb_gisb.c
2813N: brcmstb 2757N: brcmstb
2814 2758
2759BROADCOM BMIPS CPUFREQ DRIVER
2760M: Markus Mayer <mmayer@broadcom.com>
2761M: bcm-kernel-feedback-list@broadcom.com
2762L: linux-pm@vger.kernel.org
2763S: Maintained
2764F: drivers/cpufreq/bmips-cpufreq.c
2765
2815BROADCOM BMIPS MIPS ARCHITECTURE 2766BROADCOM BMIPS MIPS ARCHITECTURE
2816M: Kevin Cernekee <cernekee@gmail.com> 2767M: Kevin Cernekee <cernekee@gmail.com>
2817M: Florian Fainelli <f.fainelli@gmail.com> 2768M: Florian Fainelli <f.fainelli@gmail.com>
@@ -2828,20 +2779,40 @@ F: drivers/irqchip/irq-brcmstb*
2828F: include/linux/bcm963xx_nvram.h 2779F: include/linux/bcm963xx_nvram.h
2829F: include/linux/bcm963xx_tag.h 2780F: include/linux/bcm963xx_tag.h
2830 2781
2831BROADCOM BMIPS CPUFREQ DRIVER 2782BROADCOM BNX2 GIGABIT ETHERNET DRIVER
2832M: Markus Mayer <mmayer@broadcom.com> 2783M: Rasesh Mody <rasesh.mody@cavium.com>
2833M: bcm-kernel-feedback-list@broadcom.com 2784M: Harish Patil <harish.patil@cavium.com>
2834L: linux-pm@vger.kernel.org 2785M: Dept-GELinuxNICDev@cavium.com
2835S: Maintained 2786L: netdev@vger.kernel.org
2836F: drivers/cpufreq/bmips-cpufreq.c 2787S: Supported
2788F: drivers/net/ethernet/broadcom/bnx2.*
2789F: drivers/net/ethernet/broadcom/bnx2_*
2837 2790
2838BROADCOM TG3 GIGABIT ETHERNET DRIVER 2791BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER
2839M: Siva Reddy Kallam <siva.kallam@broadcom.com> 2792M: QLogic-Storage-Upstream@qlogic.com
2840M: Prashant Sreedharan <prashant@broadcom.com> 2793L: linux-scsi@vger.kernel.org
2841M: Michael Chan <mchan@broadcom.com> 2794S: Supported
2795F: drivers/scsi/bnx2fc/
2796
2797BROADCOM BNX2I 1/10 GIGABIT iSCSI DRIVER
2798M: QLogic-Storage-Upstream@qlogic.com
2799L: linux-scsi@vger.kernel.org
2800S: Supported
2801F: drivers/scsi/bnx2i/
2802
2803BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER
2804M: Yuval Mintz <Yuval.Mintz@cavium.com>
2805M: Ariel Elior <ariel.elior@cavium.com>
2806M: everest-linux-l2@cavium.com
2842L: netdev@vger.kernel.org 2807L: netdev@vger.kernel.org
2843S: Supported 2808S: Supported
2844F: drivers/net/ethernet/broadcom/tg3.* 2809F: drivers/net/ethernet/broadcom/bnx2x/
2810
2811BROADCOM BNXT_EN 50 GIGABIT ETHERNET DRIVER
2812M: Michael Chan <michael.chan@broadcom.com>
2813L: netdev@vger.kernel.org
2814S: Supported
2815F: drivers/net/ethernet/broadcom/bnxt/
2845 2816
2846BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER 2817BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER
2847M: Arend van Spriel <arend.vanspriel@broadcom.com> 2818M: Arend van Spriel <arend.vanspriel@broadcom.com>
@@ -2855,17 +2826,18 @@ L: brcm80211-dev-list@cypress.com
2855S: Supported 2826S: Supported
2856F: drivers/net/wireless/broadcom/brcm80211/ 2827F: drivers/net/wireless/broadcom/brcm80211/
2857 2828
2858BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER 2829BROADCOM BRCMSTB GPIO DRIVER
2859M: QLogic-Storage-Upstream@qlogic.com 2830M: Gregory Fong <gregory.0xf0@gmail.com>
2860L: linux-scsi@vger.kernel.org 2831L: bcm-kernel-feedback-list@broadcom.com
2861S: Supported 2832S: Supported
2862F: drivers/scsi/bnx2fc/ 2833F: drivers/gpio/gpio-brcmstb.c
2834F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt
2863 2835
2864BROADCOM BNX2I 1/10 GIGABIT iSCSI DRIVER 2836BROADCOM GENET ETHERNET DRIVER
2865M: QLogic-Storage-Upstream@qlogic.com 2837M: Florian Fainelli <f.fainelli@gmail.com>
2866L: linux-scsi@vger.kernel.org 2838L: netdev@vger.kernel.org
2867S: Supported 2839S: Supported
2868F: drivers/scsi/bnx2i/ 2840F: drivers/net/ethernet/broadcom/genet/
2869 2841
2870BROADCOM IPROC ARM ARCHITECTURE 2842BROADCOM IPROC ARM ARCHITECTURE
2871M: Ray Jui <rjui@broadcom.com> 2843M: Ray Jui <rjui@broadcom.com>
@@ -2892,13 +2864,6 @@ F: arch/arm64/boot/dts/broadcom/ns2*
2892F: drivers/clk/bcm/clk-ns* 2864F: drivers/clk/bcm/clk-ns*
2893F: drivers/pinctrl/bcm/pinctrl-ns* 2865F: drivers/pinctrl/bcm/pinctrl-ns*
2894 2866
2895BROADCOM BRCMSTB GPIO DRIVER
2896M: Gregory Fong <gregory.0xf0@gmail.com>
2897L: bcm-kernel-feedback-list@broadcom.com
2898S: Supported
2899F: drivers/gpio/gpio-brcmstb.c
2900F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.txt
2901
2902BROADCOM KONA GPIO DRIVER 2867BROADCOM KONA GPIO DRIVER
2903M: Ray Jui <rjui@broadcom.com> 2868M: Ray Jui <rjui@broadcom.com>
2904L: bcm-kernel-feedback-list@broadcom.com 2869L: bcm-kernel-feedback-list@broadcom.com
@@ -2906,19 +2871,29 @@ S: Supported
2906F: drivers/gpio/gpio-bcm-kona.c 2871F: drivers/gpio/gpio-bcm-kona.c
2907F: Documentation/devicetree/bindings/gpio/brcm,kona-gpio.txt 2872F: Documentation/devicetree/bindings/gpio/brcm,kona-gpio.txt
2908 2873
2874BROADCOM NETXTREME-E ROCE DRIVER
2875M: Selvin Xavier <selvin.xavier@broadcom.com>
2876M: Devesh Sharma <devesh.sharma@broadcom.com>
2877M: Somnath Kotur <somnath.kotur@broadcom.com>
2878M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
2879L: linux-rdma@vger.kernel.org
2880W: http://www.broadcom.com
2881S: Supported
2882F: drivers/infiniband/hw/bnxt_re/
2883F: include/uapi/rdma/bnxt_re-abi.h
2884
2909BROADCOM NVRAM DRIVER 2885BROADCOM NVRAM DRIVER
2910M: Rafał Miłecki <zajec5@gmail.com> 2886M: Rafał Miłecki <zajec5@gmail.com>
2911L: linux-mips@linux-mips.org 2887L: linux-mips@linux-mips.org
2912S: Maintained 2888S: Maintained
2913F: drivers/firmware/broadcom/* 2889F: drivers/firmware/broadcom/*
2914 2890
2915BROADCOM STB NAND FLASH DRIVER 2891BROADCOM SPECIFIC AMBA DRIVER (BCMA)
2916M: Brian Norris <computersforpeace@gmail.com> 2892M: Rafał Miłecki <zajec5@gmail.com>
2917M: Kamal Dasu <kdasu.kdev@gmail.com> 2893L: linux-wireless@vger.kernel.org
2918L: linux-mtd@lists.infradead.org
2919L: bcm-kernel-feedback-list@broadcom.com
2920S: Maintained 2894S: Maintained
2921F: drivers/mtd/nand/brcmnand/ 2895F: drivers/bcma/
2896F: include/linux/bcma/
2922 2897
2923BROADCOM STB AVS CPUFREQ DRIVER 2898BROADCOM STB AVS CPUFREQ DRIVER
2924M: Markus Mayer <mmayer@broadcom.com> 2899M: Markus Mayer <mmayer@broadcom.com>
@@ -2928,12 +2903,13 @@ S: Maintained
2928F: Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt 2903F: Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt
2929F: drivers/cpufreq/brcmstb* 2904F: drivers/cpufreq/brcmstb*
2930 2905
2931BROADCOM SPECIFIC AMBA DRIVER (BCMA) 2906BROADCOM STB NAND FLASH DRIVER
2932M: Rafał Miłecki <zajec5@gmail.com> 2907M: Brian Norris <computersforpeace@gmail.com>
2933L: linux-wireless@vger.kernel.org 2908M: Kamal Dasu <kdasu.kdev@gmail.com>
2909L: linux-mtd@lists.infradead.org
2910L: bcm-kernel-feedback-list@broadcom.com
2934S: Maintained 2911S: Maintained
2935F: drivers/bcma/ 2912F: drivers/mtd/nand/brcmnand/
2936F: include/linux/bcma/
2937 2913
2938BROADCOM SYSTEMPORT ETHERNET DRIVER 2914BROADCOM SYSTEMPORT ETHERNET DRIVER
2939M: Florian Fainelli <f.fainelli@gmail.com> 2915M: Florian Fainelli <f.fainelli@gmail.com>
@@ -2941,16 +2917,13 @@ L: netdev@vger.kernel.org
2941S: Supported 2917S: Supported
2942F: drivers/net/ethernet/broadcom/bcmsysport.* 2918F: drivers/net/ethernet/broadcom/bcmsysport.*
2943 2919
2944BROADCOM NETXTREME-E ROCE DRIVER 2920BROADCOM TG3 GIGABIT ETHERNET DRIVER
2945M: Selvin Xavier <selvin.xavier@broadcom.com> 2921M: Siva Reddy Kallam <siva.kallam@broadcom.com>
2946M: Devesh Sharma <devesh.sharma@broadcom.com> 2922M: Prashant Sreedharan <prashant@broadcom.com>
2947M: Somnath Kotur <somnath.kotur@broadcom.com> 2923M: Michael Chan <mchan@broadcom.com>
2948M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> 2924L: netdev@vger.kernel.org
2949L: linux-rdma@vger.kernel.org
2950W: http://www.broadcom.com
2951S: Supported 2925S: Supported
2952F: drivers/infiniband/hw/bnxt_re/ 2926F: drivers/net/ethernet/broadcom/tg3.*
2953F: include/uapi/rdma/bnxt_re-abi.h
2954 2927
2955BROCADE BFA FC SCSI DRIVER 2928BROCADE BFA FC SCSI DRIVER
2956M: Anil Gurumurthy <anil.gurumurthy@qlogic.com> 2929M: Anil Gurumurthy <anil.gurumurthy@qlogic.com>
@@ -3013,6 +2986,15 @@ S: Odd fixes
3013F: Documentation/media/v4l-drivers/bttv* 2986F: Documentation/media/v4l-drivers/bttv*
3014F: drivers/media/pci/bt8xx/bttv* 2987F: drivers/media/pci/bt8xx/bttv*
3015 2988
2989BUS FREQUENCY DRIVER FOR SAMSUNG EXYNOS
2990M: Chanwoo Choi <cw00.choi@samsung.com>
2991L: linux-pm@vger.kernel.org
2992L: linux-samsung-soc@vger.kernel.org
2993T: git git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git
2994S: Maintained
2995F: drivers/devfreq/exynos-bus.c
2996F: Documentation/devicetree/bindings/devfreq/exynos-bus.txt
2997
3016BUSLOGIC SCSI DRIVER 2998BUSLOGIC SCSI DRIVER
3017M: Khalid Aziz <khalid@gonehiking.org> 2999M: Khalid Aziz <khalid@gonehiking.org>
3018L: linux-scsi@vger.kernel.org 3000L: linux-scsi@vger.kernel.org
@@ -3087,6 +3069,21 @@ F: arch/x86/kernel/tce_64.c
3087F: arch/x86/include/asm/calgary.h 3069F: arch/x86/include/asm/calgary.h
3088F: arch/x86/include/asm/tce.h 3070F: arch/x86/include/asm/tce.h
3089 3071
3072CAN NETWORK DRIVERS
3073M: Wolfgang Grandegger <wg@grandegger.com>
3074M: Marc Kleine-Budde <mkl@pengutronix.de>
3075L: linux-can@vger.kernel.org
3076W: https://github.com/linux-can
3077T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
3078T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
3079S: Maintained
3080F: Documentation/devicetree/bindings/net/can/
3081F: drivers/net/can/
3082F: include/linux/can/dev.h
3083F: include/linux/can/platform/
3084F: include/uapi/linux/can/error.h
3085F: include/uapi/linux/can/netlink.h
3086
3090CAN NETWORK LAYER 3087CAN NETWORK LAYER
3091M: Oliver Hartkopp <socketcan@hartkopp.net> 3088M: Oliver Hartkopp <socketcan@hartkopp.net>
3092M: Marc Kleine-Budde <mkl@pengutronix.de> 3089M: Marc Kleine-Budde <mkl@pengutronix.de>
@@ -3103,21 +3100,6 @@ F: include/uapi/linux/can/bcm.h
3103F: include/uapi/linux/can/raw.h 3100F: include/uapi/linux/can/raw.h
3104F: include/uapi/linux/can/gw.h 3101F: include/uapi/linux/can/gw.h
3105 3102
3106CAN NETWORK DRIVERS
3107M: Wolfgang Grandegger <wg@grandegger.com>
3108M: Marc Kleine-Budde <mkl@pengutronix.de>
3109L: linux-can@vger.kernel.org
3110W: https://github.com/linux-can
3111T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git
3112T: git git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git
3113S: Maintained
3114F: Documentation/devicetree/bindings/net/can/
3115F: drivers/net/can/
3116F: include/linux/can/dev.h
3117F: include/linux/can/platform/
3118F: include/uapi/linux/can/error.h
3119F: include/uapi/linux/can/netlink.h
3120
3121CAPABILITIES 3103CAPABILITIES
3122M: Serge Hallyn <serge@hallyn.com> 3104M: Serge Hallyn <serge@hallyn.com>
3123L: linux-security-module@vger.kernel.org 3105L: linux-security-module@vger.kernel.org
@@ -3132,12 +3114,12 @@ M: Kevin Tsai <ktsai@capellamicro.com>
3132S: Maintained 3114S: Maintained
3133F: drivers/iio/light/cm* 3115F: drivers/iio/light/cm*
3134 3116
3135CAVIUM THUNDERX2 ARM64 SOC 3117CARL9170 LINUX COMMUNITY WIRELESS DRIVER
3136M: Jayachandran C <jnair@caviumnetworks.com> 3118M: Christian Lamparter <chunkeey@googlemail.com>
3137L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 3119L: linux-wireless@vger.kernel.org
3120W: http://wireless.kernel.org/en/users/Drivers/carl9170
3138S: Maintained 3121S: Maintained
3139F: arch/arm64/boot/dts/cavium/thunder2-99xx* 3122F: drivers/net/wireless/ath/carl9170/
3140F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt
3141 3123
3142CAVIUM I2C DRIVER 3124CAVIUM I2C DRIVER
3143M: Jan Glauber <jglauber@cavium.com> 3125M: Jan Glauber <jglauber@cavium.com>
@@ -3147,6 +3129,16 @@ S: Supported
3147F: drivers/i2c/busses/i2c-octeon* 3129F: drivers/i2c/busses/i2c-octeon*
3148F: drivers/i2c/busses/i2c-thunderx* 3130F: drivers/i2c/busses/i2c-thunderx*
3149 3131
3132CAVIUM LIQUIDIO NETWORK DRIVER
3133M: Derek Chickles <derek.chickles@caviumnetworks.com>
3134M: Satanand Burla <satananda.burla@caviumnetworks.com>
3135M: Felix Manlunas <felix.manlunas@caviumnetworks.com>
3136M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
3137L: netdev@vger.kernel.org
3138W: http://www.cavium.com
3139S: Supported
3140F: drivers/net/ethernet/cavium/liquidio/
3141
3150CAVIUM MMC DRIVER 3142CAVIUM MMC DRIVER
3151M: Jan Glauber <jglauber@cavium.com> 3143M: Jan Glauber <jglauber@cavium.com>
3152M: David Daney <david.daney@cavium.com> 3144M: David Daney <david.daney@cavium.com>
@@ -3155,16 +3147,6 @@ W: http://www.cavium.com
3155S: Supported 3147S: Supported
3156F: drivers/mmc/host/cavium* 3148F: drivers/mmc/host/cavium*
3157 3149
3158CAVIUM LIQUIDIO NETWORK DRIVER
3159M: Derek Chickles <derek.chickles@caviumnetworks.com>
3160M: Satanand Burla <satananda.burla@caviumnetworks.com>
3161M: Felix Manlunas <felix.manlunas@caviumnetworks.com>
3162M: Raghu Vatsavayi <raghu.vatsavayi@caviumnetworks.com>
3163L: netdev@vger.kernel.org
3164W: http://www.cavium.com
3165S: Supported
3166F: drivers/net/ethernet/cavium/liquidio/
3167
3168CAVIUM OCTEON-TX CRYPTO DRIVER 3150CAVIUM OCTEON-TX CRYPTO DRIVER
3169M: George Cherian <george.cherian@cavium.com> 3151M: George Cherian <george.cherian@cavium.com>
3170L: linux-crypto@vger.kernel.org 3152L: linux-crypto@vger.kernel.org
@@ -3172,6 +3154,13 @@ W: http://www.cavium.com
3172S: Supported 3154S: Supported
3173F: drivers/crypto/cavium/cpt/ 3155F: drivers/crypto/cavium/cpt/
3174 3156
3157CAVIUM THUNDERX2 ARM64 SOC
3158M: Jayachandran C <jnair@caviumnetworks.com>
3159L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
3160S: Maintained
3161F: arch/arm64/boot/dts/cavium/thunder2-99xx*
3162F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt
3163
3175CC2520 IEEE-802.15.4 RADIO DRIVER 3164CC2520 IEEE-802.15.4 RADIO DRIVER
3176M: Varka Bhadram <varkabhadram@gmail.com> 3165M: Varka Bhadram <varkabhadram@gmail.com>
3177L: linux-wpan@vger.kernel.org 3166L: linux-wpan@vger.kernel.org
@@ -3260,12 +3249,6 @@ F: drivers/usb/host/whci/
3260F: drivers/usb/wusbcore/ 3249F: drivers/usb/wusbcore/
3261F: include/linux/usb/wusb* 3250F: include/linux/usb/wusb*
3262 3251
3263HT16K33 LED CONTROLLER DRIVER
3264M: Robin van der Gracht <robin@protonic.nl>
3265S: Maintained
3266F: drivers/auxdisplay/ht16k33.c
3267F: Documentation/devicetree/bindings/display/ht16k33.txt
3268
3269CFAG12864B LCD DRIVER 3252CFAG12864B LCD DRIVER
3270M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> 3253M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com>
3271W: http://miguelojeda.es/auxdisplay.htm 3254W: http://miguelojeda.es/auxdisplay.htm
@@ -3337,6 +3320,34 @@ S: Maintained
3337T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git 3320T: git git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform.git
3338F: drivers/platform/chrome/ 3321F: drivers/platform/chrome/
3339 3322
3323CIRRUS LOGIC AUDIO CODEC DRIVERS
3324M: Brian Austin <brian.austin@cirrus.com>
3325M: Paul Handrigan <Paul.Handrigan@cirrus.com>
3326L: alsa-devel@alsa-project.org (moderated for non-subscribers)
3327S: Maintained
3328F: sound/soc/codecs/cs*
3329
3330CIRRUS LOGIC EP93XX ETHERNET DRIVER
3331M: Hartley Sweeten <hsweeten@visionengravers.com>
3332L: netdev@vger.kernel.org
3333S: Maintained
3334F: drivers/net/ethernet/cirrus/ep93xx_eth.c
3335
3336CISCO FCOE HBA DRIVER
3337M: Satish Kharat <satishkh@cisco.com>
3338M: Sesidhar Baddela <sebaddel@cisco.com>
3339M: Karan Tilak Kumar <kartilak@cisco.com>
3340L: linux-scsi@vger.kernel.org
3341S: Supported
3342F: drivers/scsi/fnic/
3343
3344CISCO SCSI HBA DRIVER
3345M: Karan Tilak Kumar <kartilak@cisco.com>
3346M: Sesidhar Baddela <sebaddel@cisco.com>
3347L: linux-scsi@vger.kernel.org
3348S: Supported
3349F: drivers/scsi/snic/
3350
3340CISCO VIC ETHERNET NIC DRIVER 3351CISCO VIC ETHERNET NIC DRIVER
3341M: Christian Benvenuti <benve@cisco.com> 3352M: Christian Benvenuti <benve@cisco.com>
3342M: Govindarajulu Varadarajan <_govind@gmx.com> 3353M: Govindarajulu Varadarajan <_govind@gmx.com>
@@ -3350,19 +3361,6 @@ M: Dave Goodell <dgoodell@cisco.com>
3350S: Supported 3361S: Supported
3351F: drivers/infiniband/hw/usnic/ 3362F: drivers/infiniband/hw/usnic/
3352 3363
3353CIRRUS LOGIC EP93XX ETHERNET DRIVER
3354M: Hartley Sweeten <hsweeten@visionengravers.com>
3355L: netdev@vger.kernel.org
3356S: Maintained
3357F: drivers/net/ethernet/cirrus/ep93xx_eth.c
3358
3359CIRRUS LOGIC AUDIO CODEC DRIVERS
3360M: Brian Austin <brian.austin@cirrus.com>
3361M: Paul Handrigan <Paul.Handrigan@cirrus.com>
3362L: alsa-devel@alsa-project.org (moderated for non-subscribers)
3363S: Maintained
3364F: sound/soc/codecs/cs*
3365
3366CLEANCACHE API 3364CLEANCACHE API
3367M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 3365M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
3368L: linux-kernel@vger.kernel.org 3366L: linux-kernel@vger.kernel.org
@@ -3384,21 +3382,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
3384S: Supported 3382S: Supported
3385F: drivers/clocksource 3383F: drivers/clocksource
3386 3384
3387CISCO FCOE HBA DRIVER
3388M: Satish Kharat <satishkh@cisco.com>
3389M: Sesidhar Baddela <sebaddel@cisco.com>
3390M: Karan Tilak Kumar <kartilak@cisco.com>
3391L: linux-scsi@vger.kernel.org
3392S: Supported
3393F: drivers/scsi/fnic/
3394
3395CISCO SCSI HBA DRIVER
3396M: Karan Tilak Kumar <kartilak@cisco.com>
3397M: Sesidhar Baddela <sebaddel@cisco.com>
3398L: linux-scsi@vger.kernel.org
3399S: Supported
3400F: drivers/scsi/snic/
3401
3402CMPC ACPI DRIVER 3385CMPC ACPI DRIVER
3403M: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> 3386M: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
3404M: Daniel Oliveira Nascimento <don@syst.com.br> 3387M: Daniel Oliveira Nascimento <don@syst.com.br>
@@ -3474,17 +3457,17 @@ L: linux-pci@vger.kernel.org
3474S: Maintained 3457S: Maintained
3475F: drivers/pci/hotplug/cpci_hotplug* 3458F: drivers/pci/hotplug/cpci_hotplug*
3476 3459
3477COMPACTPCI HOTPLUG ZIATECH ZT5550 DRIVER 3460COMPACTPCI HOTPLUG GENERIC DRIVER
3478M: Scott Murray <scott@spiteful.org> 3461M: Scott Murray <scott@spiteful.org>
3479L: linux-pci@vger.kernel.org 3462L: linux-pci@vger.kernel.org
3480S: Maintained 3463S: Maintained
3481F: drivers/pci/hotplug/cpcihp_zt5550.* 3464F: drivers/pci/hotplug/cpcihp_generic.c
3482 3465
3483COMPACTPCI HOTPLUG GENERIC DRIVER 3466COMPACTPCI HOTPLUG ZIATECH ZT5550 DRIVER
3484M: Scott Murray <scott@spiteful.org> 3467M: Scott Murray <scott@spiteful.org>
3485L: linux-pci@vger.kernel.org 3468L: linux-pci@vger.kernel.org
3486S: Maintained 3469S: Maintained
3487F: drivers/pci/hotplug/cpcihp_generic.c 3470F: drivers/pci/hotplug/cpcihp_zt5550.*
3488 3471
3489COMPAL LAPTOP SUPPORT 3472COMPAL LAPTOP SUPPORT
3490M: Cezary Jackiewicz <cezary.jackiewicz@gmail.com> 3473M: Cezary Jackiewicz <cezary.jackiewicz@gmail.com>
@@ -3587,6 +3570,18 @@ F: drivers/cpufreq/arm_big_little.h
3587F: drivers/cpufreq/arm_big_little.c 3570F: drivers/cpufreq/arm_big_little.c
3588F: drivers/cpufreq/arm_big_little_dt.c 3571F: drivers/cpufreq/arm_big_little_dt.c
3589 3572
3573CPU POWER MONITORING SUBSYSTEM
3574M: Thomas Renninger <trenn@suse.com>
3575L: linux-pm@vger.kernel.org
3576S: Maintained
3577F: tools/power/cpupower/
3578
3579CPUID/MSR DRIVER
3580M: "H. Peter Anvin" <hpa@zytor.com>
3581S: Maintained
3582F: arch/x86/kernel/cpuid.c
3583F: arch/x86/kernel/msr.c
3584
3590CPUIDLE DRIVER - ARM BIG LITTLE 3585CPUIDLE DRIVER - ARM BIG LITTLE
3591M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> 3586M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
3592M: Daniel Lezcano <daniel.lezcano@linaro.org> 3587M: Daniel Lezcano <daniel.lezcano@linaro.org>
@@ -3616,18 +3611,6 @@ B: https://bugzilla.kernel.org
3616F: drivers/cpuidle/* 3611F: drivers/cpuidle/*
3617F: include/linux/cpuidle.h 3612F: include/linux/cpuidle.h
3618 3613
3619CPUID/MSR DRIVER
3620M: "H. Peter Anvin" <hpa@zytor.com>
3621S: Maintained
3622F: arch/x86/kernel/cpuid.c
3623F: arch/x86/kernel/msr.c
3624
3625CPU POWER MONITORING SUBSYSTEM
3626M: Thomas Renninger <trenn@suse.com>
3627L: linux-pm@vger.kernel.org
3628S: Maintained
3629F: tools/power/cpupower/
3630
3631CRAMFS FILESYSTEM 3614CRAMFS FILESYSTEM
3632W: http://sourceforge.net/projects/cramfs/ 3615W: http://sourceforge.net/projects/cramfs/
3633S: Orphan / Obsolete 3616S: Orphan / Obsolete
@@ -3757,6 +3740,13 @@ S: Supported
3757F: drivers/infiniband/hw/cxgb3/ 3740F: drivers/infiniband/hw/cxgb3/
3758F: include/uapi/rdma/cxgb3-abi.h 3741F: include/uapi/rdma/cxgb3-abi.h
3759 3742
3743CXGB4 CRYPTO DRIVER (chcr)
3744M: Harsh Jain <harsh@chelsio.com>
3745L: linux-crypto@vger.kernel.org
3746W: http://www.chelsio.com
3747S: Supported
3748F: drivers/crypto/chelsio
3749
3760CXGB4 ETHERNET DRIVER (CXGB4) 3750CXGB4 ETHERNET DRIVER (CXGB4)
3761M: Ganesh Goudar <ganeshgr@chelsio.com> 3751M: Ganesh Goudar <ganeshgr@chelsio.com>
3762L: netdev@vger.kernel.org 3752L: netdev@vger.kernel.org
@@ -3779,13 +3769,6 @@ S: Supported
3779F: drivers/infiniband/hw/cxgb4/ 3769F: drivers/infiniband/hw/cxgb4/
3780F: include/uapi/rdma/cxgb4-abi.h 3770F: include/uapi/rdma/cxgb4-abi.h
3781 3771
3782CXGB4 CRYPTO DRIVER (chcr)
3783M: Harsh Jain <harsh@chelsio.com>
3784L: linux-crypto@vger.kernel.org
3785W: http://www.chelsio.com
3786S: Supported
3787F: drivers/crypto/chelsio
3788
3789CXGB4VF ETHERNET DRIVER (CXGB4VF) 3772CXGB4VF ETHERNET DRIVER (CXGB4VF)
3790M: Casey Leedom <leedom@chelsio.com> 3773M: Casey Leedom <leedom@chelsio.com>
3791L: netdev@vger.kernel.org 3774L: netdev@vger.kernel.org
@@ -3815,14 +3798,6 @@ F: drivers/scsi/cxlflash/
3815F: include/uapi/scsi/cxlflash_ioctls.h 3798F: include/uapi/scsi/cxlflash_ioctls.h
3816F: Documentation/powerpc/cxlflash.txt 3799F: Documentation/powerpc/cxlflash.txt
3817 3800
3818STMMAC ETHERNET DRIVER
3819M: Giuseppe Cavallaro <peppe.cavallaro@st.com>
3820M: Alexandre Torgue <alexandre.torgue@st.com>
3821L: netdev@vger.kernel.org
3822W: http://www.stlinux.com
3823S: Supported
3824F: drivers/net/ethernet/stmicro/stmmac/
3825
3826CYBERPRO FB DRIVER 3801CYBERPRO FB DRIVER
3827M: Russell King <linux@armlinux.org.uk> 3802M: Russell King <linux@armlinux.org.uk>
3828L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 3803L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -3946,15 +3921,15 @@ L: platform-driver-x86@vger.kernel.org
3946S: Maintained 3921S: Maintained
3947F: drivers/platform/x86/dell-laptop.c 3922F: drivers/platform/x86/dell-laptop.c
3948 3923
3949DELL LAPTOP RBTN DRIVER 3924DELL LAPTOP FREEFALL DRIVER
3950M: Pali Rohár <pali.rohar@gmail.com> 3925M: Pali Rohár <pali.rohar@gmail.com>
3951S: Maintained 3926S: Maintained
3952F: drivers/platform/x86/dell-rbtn.* 3927F: drivers/platform/x86/dell-smo8800.c
3953 3928
3954DELL LAPTOP FREEFALL DRIVER 3929DELL LAPTOP RBTN DRIVER
3955M: Pali Rohár <pali.rohar@gmail.com> 3930M: Pali Rohár <pali.rohar@gmail.com>
3956S: Maintained 3931S: Maintained
3957F: drivers/platform/x86/dell-smo8800.c 3932F: drivers/platform/x86/dell-rbtn.*
3958 3933
3959DELL LAPTOP SMM DRIVER 3934DELL LAPTOP SMM DRIVER
3960M: Pali Rohár <pali.rohar@gmail.com> 3935M: Pali Rohár <pali.rohar@gmail.com>
@@ -3974,6 +3949,14 @@ M: Pali Rohár <pali.rohar@gmail.com>
3974S: Maintained 3949S: Maintained
3975F: drivers/platform/x86/dell-wmi.c 3950F: drivers/platform/x86/dell-wmi.c
3976 3951
3952DELTA ST MEDIA DRIVER
3953M: Hugues Fruchet <hugues.fruchet@st.com>
3954L: linux-media@vger.kernel.org
3955T: git git://linuxtv.org/media_tree.git
3956W: https://linuxtv.org
3957S: Supported
3958F: drivers/media/platform/sti/delta
3959
3977DENALI NAND DRIVER 3960DENALI NAND DRIVER
3978M: Masahiro Yamada <yamada.masahiro@socionext.com> 3961M: Masahiro Yamada <yamada.masahiro@socionext.com>
3979L: linux-mtd@lists.infradead.org 3962L: linux-mtd@lists.infradead.org
@@ -4028,15 +4011,6 @@ F: drivers/devfreq/devfreq-event.c
4028F: include/linux/devfreq-event.h 4011F: include/linux/devfreq-event.h
4029F: Documentation/devicetree/bindings/devfreq/event/ 4012F: Documentation/devicetree/bindings/devfreq/event/
4030 4013
4031BUS FREQUENCY DRIVER FOR SAMSUNG EXYNOS
4032M: Chanwoo Choi <cw00.choi@samsung.com>
4033L: linux-pm@vger.kernel.org
4034L: linux-samsung-soc@vger.kernel.org
4035T: git git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git
4036S: Maintained
4037F: drivers/devfreq/exynos-bus.c
4038F: Documentation/devicetree/bindings/devfreq/exynos-bus.txt
4039
4040DEVICE NUMBER REGISTRY 4014DEVICE NUMBER REGISTRY
4041M: Torben Mathiasen <device@lanana.org> 4015M: Torben Mathiasen <device@lanana.org>
4042W: http://lanana.org/docs/device-list/index.html 4016W: http://lanana.org/docs/device-list/index.html
@@ -4186,20 +4160,6 @@ F: include/linux/*fence.h
4186F: Documentation/driver-api/dma-buf.rst 4160F: Documentation/driver-api/dma-buf.rst
4187T: git git://anongit.freedesktop.org/drm/drm-misc 4161T: git git://anongit.freedesktop.org/drm/drm-misc
4188 4162
4189SYNC FILE FRAMEWORK
4190M: Sumit Semwal <sumit.semwal@linaro.org>
4191R: Gustavo Padovan <gustavo@padovan.org>
4192S: Maintained
4193L: linux-media@vger.kernel.org
4194L: dri-devel@lists.freedesktop.org
4195F: drivers/dma-buf/sync_*
4196F: drivers/dma-buf/dma-fence*
4197F: drivers/dma-buf/sw_sync.c
4198F: include/linux/sync_file.h
4199F: include/uapi/linux/sync_file.h
4200F: Documentation/sync_file.txt
4201T: git git://anongit.freedesktop.org/drm/drm-misc
4202
4203DMA GENERIC OFFLOAD ENGINE SUBSYSTEM 4163DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
4204M: Vinod Koul <vinod.koul@intel.com> 4164M: Vinod Koul <vinod.koul@intel.com>
4205L: dmaengine@vger.kernel.org 4165L: dmaengine@vger.kernel.org
@@ -4211,6 +4171,21 @@ F: Documentation/devicetree/bindings/dma/
4211F: Documentation/dmaengine/ 4171F: Documentation/dmaengine/
4212T: git git://git.infradead.org/users/vkoul/slave-dma.git 4172T: git git://git.infradead.org/users/vkoul/slave-dma.git
4213 4173
4174DMA MAPPING HELPERS
4175M: Christoph Hellwig <hch@lst.de>
4176M: Marek Szyprowski <m.szyprowski@samsung.com>
4177R: Robin Murphy <robin.murphy@arm.com>
4178L: linux-kernel@vger.kernel.org
4179T: git git://git.infradead.org/users/hch/dma-mapping.git
4180W: http://git.infradead.org/users/hch/dma-mapping.git
4181S: Supported
4182F: lib/dma-debug.c
4183F: lib/dma-noop.c
4184F: lib/dma-virt.c
4185F: drivers/base/dma-mapping.c
4186F: drivers/base/dma-coherent.c
4187F: include/linux/dma-mapping.h
4188
4214DME1737 HARDWARE MONITOR DRIVER 4189DME1737 HARDWARE MONITOR DRIVER
4215M: Juerg Haefliger <juergh@gmail.com> 4190M: Juerg Haefliger <juergh@gmail.com>
4216L: linux-hwmon@vger.kernel.org 4191L: linux-hwmon@vger.kernel.org
@@ -4241,6 +4216,13 @@ X: Documentation/spi
4241X: Documentation/media 4216X: Documentation/media
4242T: git git://git.lwn.net/linux.git docs-next 4217T: git git://git.lwn.net/linux.git docs-next
4243 4218
4219DONGWOON DW9714 LENS VOICE COIL DRIVER
4220M: Sakari Ailus <sakari.ailus@linux.intel.com>
4221L: linux-media@vger.kernel.org
4222T: git git://linuxtv.org/media_tree.git
4223S: Maintained
4224F: drivers/media/i2c/dw9714.c
4225
4244DOUBLETALK DRIVER 4226DOUBLETALK DRIVER
4245M: "James R. Van Zandt" <jrv@vanzandt.mv.com> 4227M: "James R. Van Zandt" <jrv@vanzandt.mv.com>
4246L: blinux-list@redhat.com 4228L: blinux-list@redhat.com
@@ -4292,36 +4274,13 @@ F: include/linux/debugfs.h
4292F: include/linux/kobj* 4274F: include/linux/kobj*
4293F: lib/kobj* 4275F: lib/kobj*
4294 4276
4295DRM DRIVERS 4277DRIVERS FOR ADAPTIVE VOLTAGE SCALING (AVS)
4296M: David Airlie <airlied@linux.ie> 4278M: Kevin Hilman <khilman@kernel.org>
4297L: dri-devel@lists.freedesktop.org 4279M: Nishanth Menon <nm@ti.com>
4298T: git git://people.freedesktop.org/~airlied/linux
4299B: https://bugs.freedesktop.org/
4300C: irc://chat.freenode.net/dri-devel
4301S: Maintained
4302F: drivers/gpu/drm/
4303F: drivers/gpu/vga/
4304F: Documentation/devicetree/bindings/display/
4305F: Documentation/devicetree/bindings/gpu/
4306F: Documentation/devicetree/bindings/video/
4307F: Documentation/gpu/
4308F: include/drm/
4309F: include/uapi/drm/
4310F: include/linux/vga*
4311
4312DRM DRIVERS AND MISC GPU PATCHES
4313M: Daniel Vetter <daniel.vetter@intel.com>
4314M: Jani Nikula <jani.nikula@linux.intel.com>
4315M: Sean Paul <seanpaul@chromium.org>
4316W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
4317S: Maintained 4280S: Maintained
4318T: git git://anongit.freedesktop.org/drm/drm-misc 4281F: drivers/power/avs/
4319F: Documentation/gpu/ 4282F: include/linux/power/smartreflex.h
4320F: drivers/gpu/vga/ 4283L: linux-pm@vger.kernel.org
4321F: drivers/gpu/drm/*
4322F: include/drm/drm*
4323F: include/uapi/drm/drm*
4324F: include/linux/vga*
4325 4284
4326DRM DRIVER FOR ARM PL111 CLCD 4285DRM DRIVER FOR ARM PL111 CLCD
4327M: Eric Anholt <eric@anholt.net> 4286M: Eric Anholt <eric@anholt.net>
@@ -4334,14 +4293,6 @@ M: Dave Airlie <airlied@redhat.com>
4334S: Odd Fixes 4293S: Odd Fixes
4335F: drivers/gpu/drm/ast/ 4294F: drivers/gpu/drm/ast/
4336 4295
4337DRM DRIVERS FOR BRIDGE CHIPS
4338M: Archit Taneja <architt@codeaurora.org>
4339M: Andrzej Hajda <a.hajda@samsung.com>
4340R: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
4341S: Maintained
4342T: git git://anongit.freedesktop.org/drm/drm-misc
4343F: drivers/gpu/drm/bridge/
4344
4345DRM DRIVER FOR BOCHS VIRTUAL GPU 4296DRM DRIVER FOR BOCHS VIRTUAL GPU
4346M: Gerd Hoffmann <kraxel@redhat.com> 4297M: Gerd Hoffmann <kraxel@redhat.com>
4347L: virtualization@lists.linux-foundation.org 4298L: virtualization@lists.linux-foundation.org
@@ -4349,6 +4300,47 @@ T: git git://anongit.freedesktop.org/drm/drm-misc
4349S: Maintained 4300S: Maintained
4350F: drivers/gpu/drm/bochs/ 4301F: drivers/gpu/drm/bochs/
4351 4302
4303DRM DRIVER FOR INTEL I810 VIDEO CARDS
4304S: Orphan / Obsolete
4305F: drivers/gpu/drm/i810/
4306F: include/uapi/drm/i810_drm.h
4307
4308DRM DRIVER FOR MATROX G200/G400 GRAPHICS CARDS
4309S: Orphan / Obsolete
4310F: drivers/gpu/drm/mga/
4311F: include/uapi/drm/mga_drm.h
4312
4313DRM DRIVER FOR MGA G200 SERVER GRAPHICS CHIPS
4314M: Dave Airlie <airlied@redhat.com>
4315S: Odd Fixes
4316F: drivers/gpu/drm/mgag200/
4317
4318DRM DRIVER FOR MI0283QT
4319M: Noralf Trønnes <noralf@tronnes.org>
4320S: Maintained
4321F: drivers/gpu/drm/tinydrm/mi0283qt.c
4322F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
4323
4324DRM DRIVER FOR MSM ADRENO GPU
4325M: Rob Clark <robdclark@gmail.com>
4326L: linux-arm-msm@vger.kernel.org
4327L: dri-devel@lists.freedesktop.org
4328L: freedreno@lists.freedesktop.org
4329T: git git://people.freedesktop.org/~robclark/linux
4330S: Maintained
4331F: drivers/gpu/drm/msm/
4332F: include/uapi/drm/msm_drm.h
4333F: Documentation/devicetree/bindings/display/msm/
4334
4335DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
4336M: Ben Skeggs <bskeggs@redhat.com>
4337L: dri-devel@lists.freedesktop.org
4338L: nouveau@lists.freedesktop.org
4339T: git git://github.com/skeggsb/linux
4340S: Supported
4341F: drivers/gpu/drm/nouveau/
4342F: include/uapi/drm/nouveau_drm.h
4343
4352DRM DRIVER FOR QEMU'S CIRRUS DEVICE 4344DRM DRIVER FOR QEMU'S CIRRUS DEVICE
4353M: Dave Airlie <airlied@redhat.com> 4345M: Dave Airlie <airlied@redhat.com>
4354M: Gerd Hoffmann <kraxel@redhat.com> 4346M: Gerd Hoffmann <kraxel@redhat.com>
@@ -4358,59 +4350,80 @@ S: Obsolete
4358W: https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/ 4350W: https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/
4359F: drivers/gpu/drm/cirrus/ 4351F: drivers/gpu/drm/cirrus/
4360 4352
4361RADEON and AMDGPU DRM DRIVERS 4353DRM DRIVER FOR QXL VIRTUAL GPU
4362M: Alex Deucher <alexander.deucher@amd.com> 4354M: Dave Airlie <airlied@redhat.com>
4363M: Christian König <christian.koenig@amd.com> 4355M: Gerd Hoffmann <kraxel@redhat.com>
4364L: amd-gfx@lists.freedesktop.org 4356L: virtualization@lists.linux-foundation.org
4365T: git git://people.freedesktop.org/~agd5f/linux 4357T: git git://anongit.freedesktop.org/drm/drm-misc
4358S: Maintained
4359F: drivers/gpu/drm/qxl/
4360F: include/uapi/drm/qxl_drm.h
4361
4362DRM DRIVER FOR RAGE 128 VIDEO CARDS
4363S: Orphan / Obsolete
4364F: drivers/gpu/drm/r128/
4365F: include/uapi/drm/r128_drm.h
4366
4367DRM DRIVER FOR SAVAGE VIDEO CARDS
4368S: Orphan / Obsolete
4369F: drivers/gpu/drm/savage/
4370F: include/uapi/drm/savage_drm.h
4371
4372DRM DRIVER FOR SIS VIDEO CARDS
4373S: Orphan / Obsolete
4374F: drivers/gpu/drm/sis/
4375F: include/uapi/drm/sis_drm.h
4376
4377DRM DRIVER FOR TDFX VIDEO CARDS
4378S: Orphan / Obsolete
4379F: drivers/gpu/drm/tdfx/
4380
4381DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS
4382M: Dave Airlie <airlied@redhat.com>
4383S: Odd Fixes
4384F: drivers/gpu/drm/udl/
4385
4386DRM DRIVER FOR VMWARE VIRTUAL GPU
4387M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
4388M: Sinclair Yeh <syeh@vmware.com>
4389M: Thomas Hellstrom <thellstrom@vmware.com>
4390L: dri-devel@lists.freedesktop.org
4391T: git git://people.freedesktop.org/~syeh/repos_linux
4392T: git git://people.freedesktop.org/~thomash/linux
4366S: Supported 4393S: Supported
4367F: drivers/gpu/drm/radeon/ 4394F: drivers/gpu/drm/vmwgfx/
4368F: include/uapi/drm/radeon_drm.h 4395F: include/uapi/drm/vmwgfx_drm.h
4369F: drivers/gpu/drm/amd/
4370F: include/uapi/drm/amdgpu_drm.h
4371 4396
4372DRM PANEL DRIVERS 4397DRM DRIVERS
4373M: Thierry Reding <thierry.reding@gmail.com> 4398M: David Airlie <airlied@linux.ie>
4374L: dri-devel@lists.freedesktop.org 4399L: dri-devel@lists.freedesktop.org
4375T: git git://anongit.freedesktop.org/tegra/linux.git 4400T: git git://people.freedesktop.org/~airlied/linux
4401B: https://bugs.freedesktop.org/
4402C: irc://chat.freenode.net/dri-devel
4376S: Maintained 4403S: Maintained
4377F: drivers/gpu/drm/drm_panel.c 4404F: drivers/gpu/drm/
4378F: drivers/gpu/drm/panel/ 4405F: drivers/gpu/vga/
4379F: include/drm/drm_panel.h 4406F: Documentation/devicetree/bindings/display/
4380F: Documentation/devicetree/bindings/display/panel/ 4407F: Documentation/devicetree/bindings/gpu/
4408F: Documentation/devicetree/bindings/video/
4409F: Documentation/gpu/
4410F: include/drm/
4411F: include/uapi/drm/
4412F: include/linux/vga*
4381 4413
4382INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) 4414DRM DRIVERS AND MISC GPU PATCHES
4383M: Daniel Vetter <daniel.vetter@intel.com> 4415M: Daniel Vetter <daniel.vetter@intel.com>
4384M: Jani Nikula <jani.nikula@linux.intel.com> 4416M: Jani Nikula <jani.nikula@linux.intel.com>
4385L: intel-gfx@lists.freedesktop.org 4417M: Sean Paul <seanpaul@chromium.org>
4386W: https://01.org/linuxgraphics/ 4418W: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-misc.html
4387B: https://01.org/linuxgraphics/documentation/how-report-bugs 4419S: Maintained
4388C: irc://chat.freenode.net/intel-gfx
4389Q: http://patchwork.freedesktop.org/project/intel-gfx/
4390T: git git://anongit.freedesktop.org/drm-intel
4391S: Supported
4392F: drivers/gpu/drm/i915/
4393F: include/drm/i915*
4394F: include/uapi/drm/i915_drm.h
4395F: Documentation/gpu/i915.rst
4396
4397INTEL GVT-g DRIVERS (Intel GPU Virtualization)
4398M: Zhenyu Wang <zhenyuw@linux.intel.com>
4399M: Zhi Wang <zhi.a.wang@intel.com>
4400L: intel-gvt-dev@lists.freedesktop.org
4401L: intel-gfx@lists.freedesktop.org
4402W: https://01.org/igvt-g
4403T: git https://github.com/01org/gvt-linux.git
4404S: Supported
4405F: drivers/gpu/drm/i915/gvt/
4406
4407DRM DRIVERS FOR ATMEL HLCDC
4408M: Boris Brezillon <boris.brezillon@free-electrons.com>
4409L: dri-devel@lists.freedesktop.org
4410S: Supported
4411F: drivers/gpu/drm/atmel-hlcdc/
4412F: Documentation/devicetree/bindings/drm/atmel/
4413T: git git://anongit.freedesktop.org/drm/drm-misc 4420T: git git://anongit.freedesktop.org/drm/drm-misc
4421F: Documentation/gpu/
4422F: drivers/gpu/vga/
4423F: drivers/gpu/drm/*
4424F: include/drm/drm*
4425F: include/uapi/drm/drm*
4426F: include/linux/vga*
4414 4427
4415DRM DRIVERS FOR ALLWINNER A10 4428DRM DRIVERS FOR ALLWINNER A10
4416M: Maxime Ripard <maxime.ripard@free-electrons.com> 4429M: Maxime Ripard <maxime.ripard@free-electrons.com>
@@ -4432,6 +4445,22 @@ F: Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.txt
4432F: Documentation/gpu/meson.rst 4445F: Documentation/gpu/meson.rst
4433T: git git://anongit.freedesktop.org/drm/drm-misc 4446T: git git://anongit.freedesktop.org/drm/drm-misc
4434 4447
4448DRM DRIVERS FOR ATMEL HLCDC
4449M: Boris Brezillon <boris.brezillon@free-electrons.com>
4450L: dri-devel@lists.freedesktop.org
4451S: Supported
4452F: drivers/gpu/drm/atmel-hlcdc/
4453F: Documentation/devicetree/bindings/drm/atmel/
4454T: git git://anongit.freedesktop.org/drm/drm-misc
4455
4456DRM DRIVERS FOR BRIDGE CHIPS
4457M: Archit Taneja <architt@codeaurora.org>
4458M: Andrzej Hajda <a.hajda@samsung.com>
4459R: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
4460S: Maintained
4461T: git git://anongit.freedesktop.org/drm/drm-misc
4462F: drivers/gpu/drm/bridge/
4463
4435DRM DRIVERS FOR EXYNOS 4464DRM DRIVERS FOR EXYNOS
4436M: Inki Dae <inki.dae@samsung.com> 4465M: Inki Dae <inki.dae@samsung.com>
4437M: Joonyoung Shim <jy0922.shim@samsung.com> 4466M: Joonyoung Shim <jy0922.shim@samsung.com>
@@ -4480,11 +4509,6 @@ S: Maintained
4480F: drivers/gpu/drm/hisilicon/ 4509F: drivers/gpu/drm/hisilicon/
4481F: Documentation/devicetree/bindings/display/hisilicon/ 4510F: Documentation/devicetree/bindings/display/hisilicon/
4482 4511
4483DRM DRIVER FOR INTEL I810 VIDEO CARDS
4484S: Orphan / Obsolete
4485F: drivers/gpu/drm/i810/
4486F: include/uapi/drm/i810_drm.h
4487
4488DRM DRIVERS FOR MEDIATEK 4512DRM DRIVERS FOR MEDIATEK
4489M: CK Hu <ck.hu@mediatek.com> 4513M: CK Hu <ck.hu@mediatek.com>
4490M: Philipp Zabel <p.zabel@pengutronix.de> 4514M: Philipp Zabel <p.zabel@pengutronix.de>
@@ -4493,32 +4517,6 @@ S: Supported
4493F: drivers/gpu/drm/mediatek/ 4517F: drivers/gpu/drm/mediatek/
4494F: Documentation/devicetree/bindings/display/mediatek/ 4518F: Documentation/devicetree/bindings/display/mediatek/
4495 4519
4496DRM DRIVER FOR MI0283QT
4497M: Noralf Trønnes <noralf@tronnes.org>
4498S: Maintained
4499F: drivers/gpu/drm/tinydrm/mi0283qt.c
4500F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
4501
4502DRM DRIVER FOR MSM ADRENO GPU
4503M: Rob Clark <robdclark@gmail.com>
4504L: linux-arm-msm@vger.kernel.org
4505L: dri-devel@lists.freedesktop.org
4506L: freedreno@lists.freedesktop.org
4507T: git git://people.freedesktop.org/~robclark/linux
4508S: Maintained
4509F: drivers/gpu/drm/msm/
4510F: include/uapi/drm/msm_drm.h
4511F: Documentation/devicetree/bindings/display/msm/
4512
4513DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
4514M: Ben Skeggs <bskeggs@redhat.com>
4515L: dri-devel@lists.freedesktop.org
4516L: nouveau@lists.freedesktop.org
4517T: git git://github.com/skeggsb/linux
4518S: Supported
4519F: drivers/gpu/drm/nouveau/
4520F: include/uapi/drm/nouveau_drm.h
4521
4522DRM DRIVERS FOR NVIDIA TEGRA 4520DRM DRIVERS FOR NVIDIA TEGRA
4523M: Thierry Reding <thierry.reding@gmail.com> 4521M: Thierry Reding <thierry.reding@gmail.com>
4524L: dri-devel@lists.freedesktop.org 4522L: dri-devel@lists.freedesktop.org
@@ -4531,21 +4529,6 @@ F: include/linux/host1x.h
4531F: include/uapi/drm/tegra_drm.h 4529F: include/uapi/drm/tegra_drm.h
4532F: Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt 4530F: Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
4533 4531
4534DRM DRIVER FOR MATROX G200/G400 GRAPHICS CARDS
4535S: Orphan / Obsolete
4536F: drivers/gpu/drm/mga/
4537F: include/uapi/drm/mga_drm.h
4538
4539DRM DRIVER FOR MGA G200 SERVER GRAPHICS CHIPS
4540M: Dave Airlie <airlied@redhat.com>
4541S: Odd Fixes
4542F: drivers/gpu/drm/mgag200/
4543
4544DRM DRIVER FOR RAGE 128 VIDEO CARDS
4545S: Orphan / Obsolete
4546F: drivers/gpu/drm/r128/
4547F: include/uapi/drm/r128_drm.h
4548
4549DRM DRIVERS FOR RENESAS 4532DRM DRIVERS FOR RENESAS
4550M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 4533M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
4551L: dri-devel@lists.freedesktop.org 4534L: dri-devel@lists.freedesktop.org
@@ -4558,15 +4541,6 @@ F: include/linux/platform_data/shmob_drm.h
4558F: Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt 4541F: Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
4559F: Documentation/devicetree/bindings/display/renesas,du.txt 4542F: Documentation/devicetree/bindings/display/renesas,du.txt
4560 4543
4561DRM DRIVER FOR QXL VIRTUAL GPU
4562M: Dave Airlie <airlied@redhat.com>
4563M: Gerd Hoffmann <kraxel@redhat.com>
4564L: virtualization@lists.linux-foundation.org
4565T: git git://anongit.freedesktop.org/drm/drm-misc
4566S: Maintained
4567F: drivers/gpu/drm/qxl/
4568F: include/uapi/drm/qxl_drm.h
4569
4570DRM DRIVERS FOR ROCKCHIP 4544DRM DRIVERS FOR ROCKCHIP
4571M: Mark Yao <mark.yao@rock-chips.com> 4545M: Mark Yao <mark.yao@rock-chips.com>
4572L: dri-devel@lists.freedesktop.org 4546L: dri-devel@lists.freedesktop.org
@@ -4575,16 +4549,6 @@ F: drivers/gpu/drm/rockchip/
4575F: Documentation/devicetree/bindings/display/rockchip/ 4549F: Documentation/devicetree/bindings/display/rockchip/
4576T: git git://anongit.freedesktop.org/drm/drm-misc 4550T: git git://anongit.freedesktop.org/drm/drm-misc
4577 4551
4578DRM DRIVER FOR SAVAGE VIDEO CARDS
4579S: Orphan / Obsolete
4580F: drivers/gpu/drm/savage/
4581F: include/uapi/drm/savage_drm.h
4582
4583DRM DRIVER FOR SIS VIDEO CARDS
4584S: Orphan / Obsolete
4585F: drivers/gpu/drm/sis/
4586F: include/uapi/drm/sis_drm.h
4587
4588DRM DRIVERS FOR STI 4552DRM DRIVERS FOR STI
4589M: Benjamin Gaignard <benjamin.gaignard@linaro.org> 4553M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
4590M: Vincent Abriou <vincent.abriou@st.com> 4554M: Vincent Abriou <vincent.abriou@st.com>
@@ -4605,36 +4569,20 @@ S: Maintained
4605F: drivers/gpu/drm/stm 4569F: drivers/gpu/drm/stm
4606F: Documentation/devicetree/bindings/display/st,stm32-ltdc.txt 4570F: Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
4607 4571
4608DRM DRIVER FOR TDFX VIDEO CARDS 4572DRM DRIVERS FOR TI LCDC
4609S: Orphan / Obsolete 4573M: Jyri Sarha <jsarha@ti.com>
4610F: drivers/gpu/drm/tdfx/ 4574R: Tomi Valkeinen <tomi.valkeinen@ti.com>
4611
4612DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS
4613M: Dave Airlie <airlied@redhat.com>
4614S: Odd Fixes
4615F: drivers/gpu/drm/udl/
4616
4617DRM DRIVERS FOR VIVANTE GPU IP
4618M: Lucas Stach <l.stach@pengutronix.de>
4619R: Russell King <linux+etnaviv@armlinux.org.uk>
4620R: Christian Gmeiner <christian.gmeiner@gmail.com>
4621L: etnaviv@lists.freedesktop.org
4622L: dri-devel@lists.freedesktop.org 4575L: dri-devel@lists.freedesktop.org
4623S: Maintained 4576S: Maintained
4624F: drivers/gpu/drm/etnaviv/ 4577F: drivers/gpu/drm/tilcdc/
4625F: include/uapi/drm/etnaviv_drm.h 4578F: Documentation/devicetree/bindings/display/tilcdc/
4626F: Documentation/devicetree/bindings/display/etnaviv/
4627 4579
4628DRM DRIVER FOR VMWARE VIRTUAL GPU 4580DRM DRIVERS FOR TI OMAP
4629M: "VMware Graphics" <linux-graphics-maintainer@vmware.com> 4581M: Tomi Valkeinen <tomi.valkeinen@ti.com>
4630M: Sinclair Yeh <syeh@vmware.com>
4631M: Thomas Hellstrom <thellstrom@vmware.com>
4632L: dri-devel@lists.freedesktop.org 4582L: dri-devel@lists.freedesktop.org
4633T: git git://people.freedesktop.org/~syeh/repos_linux 4583S: Maintained
4634T: git git://people.freedesktop.org/~thomash/linux 4584F: drivers/gpu/drm/omapdrm/
4635S: Supported 4585F: Documentation/devicetree/bindings/display/ti/
4636F: drivers/gpu/drm/vmwgfx/
4637F: include/uapi/drm/vmwgfx_drm.h
4638 4586
4639DRM DRIVERS FOR VC4 4587DRM DRIVERS FOR VC4
4640M: Eric Anholt <eric@anholt.net> 4588M: Eric Anholt <eric@anholt.net>
@@ -4645,20 +4593,16 @@ F: include/uapi/drm/vc4_drm.h
4645F: Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt 4593F: Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt
4646T: git git://anongit.freedesktop.org/drm/drm-misc 4594T: git git://anongit.freedesktop.org/drm/drm-misc
4647 4595
4648DRM DRIVERS FOR TI OMAP 4596DRM DRIVERS FOR VIVANTE GPU IP
4649M: Tomi Valkeinen <tomi.valkeinen@ti.com> 4597M: Lucas Stach <l.stach@pengutronix.de>
4650L: dri-devel@lists.freedesktop.org 4598R: Russell King <linux+etnaviv@armlinux.org.uk>
4651S: Maintained 4599R: Christian Gmeiner <christian.gmeiner@gmail.com>
4652F: drivers/gpu/drm/omapdrm/ 4600L: etnaviv@lists.freedesktop.org
4653F: Documentation/devicetree/bindings/display/ti/
4654
4655DRM DRIVERS FOR TI LCDC
4656M: Jyri Sarha <jsarha@ti.com>
4657R: Tomi Valkeinen <tomi.valkeinen@ti.com>
4658L: dri-devel@lists.freedesktop.org 4601L: dri-devel@lists.freedesktop.org
4659S: Maintained 4602S: Maintained
4660F: drivers/gpu/drm/tilcdc/ 4603F: drivers/gpu/drm/etnaviv/
4661F: Documentation/devicetree/bindings/display/tilcdc/ 4604F: include/uapi/drm/etnaviv_drm.h
4605F: Documentation/devicetree/bindings/display/etnaviv/
4662 4606
4663DRM DRIVERS FOR ZTE ZX 4607DRM DRIVERS FOR ZTE ZX
4664M: Shawn Guo <shawnguo@kernel.org> 4608M: Shawn Guo <shawnguo@kernel.org>
@@ -4668,6 +4612,16 @@ F: drivers/gpu/drm/zte/
4668F: Documentation/devicetree/bindings/display/zte,vou.txt 4612F: Documentation/devicetree/bindings/display/zte,vou.txt
4669T: git git://anongit.freedesktop.org/drm/drm-misc 4613T: git git://anongit.freedesktop.org/drm/drm-misc
4670 4614
4615DRM PANEL DRIVERS
4616M: Thierry Reding <thierry.reding@gmail.com>
4617L: dri-devel@lists.freedesktop.org
4618T: git git://anongit.freedesktop.org/tegra/linux.git
4619S: Maintained
4620F: drivers/gpu/drm/drm_panel.c
4621F: drivers/gpu/drm/panel/
4622F: include/drm/drm_panel.h
4623F: Documentation/devicetree/bindings/display/panel/
4624
4671DSBR100 USB FM RADIO DRIVER 4625DSBR100 USB FM RADIO DRIVER
4672M: Alexey Klimov <klimov.linux@gmail.com> 4626M: Alexey Klimov <klimov.linux@gmail.com>
4673L: linux-media@vger.kernel.org 4627L: linux-media@vger.kernel.org
@@ -4799,13 +4753,6 @@ S: Maintained
4799F: drivers/media/usb/dvb-usb-v2/dvb_usb* 4753F: drivers/media/usb/dvb-usb-v2/dvb_usb*
4800F: drivers/media/usb/dvb-usb-v2/usb_urb.c 4754F: drivers/media/usb/dvb-usb-v2/usb_urb.c
4801 4755
4802DONGWOON DW9714 LENS VOICE COIL DRIVER
4803M: Sakari Ailus <sakari.ailus@linux.intel.com>
4804L: linux-media@vger.kernel.org
4805T: git git://linuxtv.org/media_tree.git
4806S: Maintained
4807F: drivers/media/i2c/dw9714.c
4808
4809DYNAMIC DEBUG 4756DYNAMIC DEBUG
4810M: Jason Baron <jbaron@akamai.com> 4757M: Jason Baron <jbaron@akamai.com>
4811S: Maintained 4758S: Maintained
@@ -4861,19 +4808,6 @@ S: Supported
4861F: Documentation/filesystems/ecryptfs.txt 4808F: Documentation/filesystems/ecryptfs.txt
4862F: fs/ecryptfs/ 4809F: fs/ecryptfs/
4863 4810
4864EDAC-CORE
4865M: Borislav Petkov <bp@alien8.de>
4866M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4867M: Mauro Carvalho Chehab <mchehab@kernel.org>
4868L: linux-edac@vger.kernel.org
4869T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
4870T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac.git linux_next
4871S: Supported
4872F: Documentation/admin-guide/ras.rst
4873F: Documentation/driver-api/edac.rst
4874F: drivers/edac/
4875F: include/linux/edac.h
4876
4877EDAC-AMD64 4811EDAC-AMD64
4878M: Borislav Petkov <bp@alien8.de> 4812M: Borislav Petkov <bp@alien8.de>
4879L: linux-edac@vger.kernel.org 4813L: linux-edac@vger.kernel.org
@@ -4895,6 +4829,19 @@ S: Supported
4895F: drivers/edac/octeon_edac* 4829F: drivers/edac/octeon_edac*
4896F: drivers/edac/thunderx_edac* 4830F: drivers/edac/thunderx_edac*
4897 4831
4832EDAC-CORE
4833M: Borislav Petkov <bp@alien8.de>
4834M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
4835M: Mauro Carvalho Chehab <mchehab@kernel.org>
4836L: linux-edac@vger.kernel.org
4837T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
4838T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-edac.git linux_next
4839S: Supported
4840F: Documentation/admin-guide/ras.rst
4841F: Documentation/driver-api/edac.rst
4842F: drivers/edac/
4843F: include/linux/edac.h
4844
4898EDAC-E752X 4845EDAC-E752X
4899M: Mark Gross <mark.gross@intel.com> 4846M: Mark Gross <mark.gross@intel.com>
4900L: linux-edac@vger.kernel.org 4847L: linux-edac@vger.kernel.org
@@ -4919,12 +4866,6 @@ L: linux-edac@vger.kernel.org
4919S: Maintained 4866S: Maintained
4920F: drivers/edac/ghes_edac.c 4867F: drivers/edac/ghes_edac.c
4921 4868
4922EDAC-I82443BXGX
4923M: Tim Small <tim@buttersideup.com>
4924L: linux-edac@vger.kernel.org
4925S: Maintained
4926F: drivers/edac/i82443bxgx_edac.c
4927
4928EDAC-I3000 4869EDAC-I3000
4929L: linux-edac@vger.kernel.org 4870L: linux-edac@vger.kernel.org
4930S: Orphan 4871S: Orphan
@@ -4956,6 +4897,12 @@ L: linux-edac@vger.kernel.org
4956S: Maintained 4897S: Maintained
4957F: drivers/edac/i7core_edac.c 4898F: drivers/edac/i7core_edac.c
4958 4899
4900EDAC-I82443BXGX
4901M: Tim Small <tim@buttersideup.com>
4902L: linux-edac@vger.kernel.org
4903S: Maintained
4904F: drivers/edac/i82443bxgx_edac.c
4905
4959EDAC-I82975X 4906EDAC-I82975X
4960M: Ranganathan Desikan <ravi@jetztechnologies.com> 4907M: Ranganathan Desikan <ravi@jetztechnologies.com>
4961M: "Arvind R." <arvino55@gmail.com> 4908M: "Arvind R." <arvino55@gmail.com>
@@ -4975,18 +4922,18 @@ L: linux-edac@vger.kernel.org
4975S: Maintained 4922S: Maintained
4976F: drivers/edac/mpc85xx_edac.[ch] 4923F: drivers/edac/mpc85xx_edac.[ch]
4977 4924
4978EDAC-PND2
4979M: Tony Luck <tony.luck@intel.com>
4980L: linux-edac@vger.kernel.org
4981S: Maintained
4982F: drivers/edac/pnd2_edac.[ch]
4983
4984EDAC-PASEMI 4925EDAC-PASEMI
4985M: Egor Martovetsky <egor@pasemi.com> 4926M: Egor Martovetsky <egor@pasemi.com>
4986L: linux-edac@vger.kernel.org 4927L: linux-edac@vger.kernel.org
4987S: Maintained 4928S: Maintained
4988F: drivers/edac/pasemi_edac.c 4929F: drivers/edac/pasemi_edac.c
4989 4930
4931EDAC-PND2
4932M: Tony Luck <tony.luck@intel.com>
4933L: linux-edac@vger.kernel.org
4934S: Maintained
4935F: drivers/edac/pnd2_edac.[ch]
4936
4990EDAC-R82600 4937EDAC-R82600
4991M: Tim Small <tim@buttersideup.com> 4938M: Tim Small <tim@buttersideup.com>
4992L: linux-edac@vger.kernel.org 4939L: linux-edac@vger.kernel.org
@@ -5006,13 +4953,6 @@ L: linux-edac@vger.kernel.org
5006S: Maintained 4953S: Maintained
5007F: drivers/edac/skx_edac.c 4954F: drivers/edac/skx_edac.c
5008 4955
5009EDAC-XGENE
5010APPLIED MICRO (APM) X-GENE SOC EDAC
5011M: Loc Ho <lho@apm.com>
5012S: Supported
5013F: drivers/edac/xgene_edac.c
5014F: Documentation/devicetree/bindings/edac/apm-xgene-edac.txt
5015
5016EDIROL UA-101/UA-1000 DRIVER 4956EDIROL UA-101/UA-1000 DRIVER
5017M: Clemens Ladisch <clemens@ladisch.de> 4957M: Clemens Ladisch <clemens@ladisch.de>
5018L: alsa-devel@alsa-project.org (moderated for non-subscribers) 4958L: alsa-devel@alsa-project.org (moderated for non-subscribers)
@@ -5020,21 +4960,12 @@ T: git git://git.alsa-project.org/alsa-kernel.git
5020S: Maintained 4960S: Maintained
5021F: sound/usb/misc/ua101.c 4961F: sound/usb/misc/ua101.c
5022 4962
5023EXTENSIBLE FIRMWARE INTERFACE (EFI) 4963EFI TEST DRIVER
5024M: Matt Fleming <matt@codeblueprint.co.uk>
5025M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5026L: linux-efi@vger.kernel.org 4964L: linux-efi@vger.kernel.org
5027T: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git 4965M: Ivan Hu <ivan.hu@canonical.com>
4966M: Matt Fleming <matt@codeblueprint.co.uk>
5028S: Maintained 4967S: Maintained
5029F: Documentation/efi-stub.txt 4968F: drivers/firmware/efi/test/
5030F: arch/*/kernel/efi.c
5031F: arch/x86/boot/compressed/eboot.[ch]
5032F: arch/*/include/asm/efi.h
5033F: arch/x86/platform/efi/
5034F: drivers/firmware/efi/
5035F: include/linux/efi*.h
5036F: arch/arm/boot/compressed/efi-header.S
5037F: arch/arm64/kernel/efi-entry.S
5038 4969
5039EFI VARIABLE FILESYSTEM 4970EFI VARIABLE FILESYSTEM
5040M: Matthew Garrett <matthew.garrett@nebula.com> 4971M: Matthew Garrett <matthew.garrett@nebula.com>
@@ -5051,13 +4982,6 @@ M: Peter Jones <pjones@redhat.com>
5051S: Maintained 4982S: Maintained
5052F: drivers/video/fbdev/efifb.c 4983F: drivers/video/fbdev/efifb.c
5053 4984
5054EFI TEST DRIVER
5055L: linux-efi@vger.kernel.org
5056M: Ivan Hu <ivan.hu@canonical.com>
5057M: Matt Fleming <matt@codeblueprint.co.uk>
5058S: Maintained
5059F: drivers/firmware/efi/test/
5060
5061EFS FILESYSTEM 4985EFS FILESYSTEM
5062W: http://aeschi.ch.eu.org/efs/ 4986W: http://aeschi.ch.eu.org/efs/
5063S: Orphan 4987S: Orphan
@@ -5086,6 +5010,34 @@ M: David Woodhouse <dwmw2@infradead.org>
5086L: linux-embedded@vger.kernel.org 5010L: linux-embedded@vger.kernel.org
5087S: Maintained 5011S: Maintained
5088 5012
5013Emulex 10Gbps iSCSI - OneConnect DRIVER
5014M: Subbu Seetharaman <subbu.seetharaman@broadcom.com>
5015M: Ketan Mukadam <ketan.mukadam@broadcom.com>
5016M: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
5017L: linux-scsi@vger.kernel.org
5018W: http://www.broadcom.com
5019S: Supported
5020F: drivers/scsi/be2iscsi/
5021
5022Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER (be2net)
5023M: Sathya Perla <sathya.perla@broadcom.com>
5024M: Ajit Khaparde <ajit.khaparde@broadcom.com>
5025M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
5026M: Somnath Kotur <somnath.kotur@broadcom.com>
5027L: netdev@vger.kernel.org
5028W: http://www.emulex.com
5029S: Supported
5030F: drivers/net/ethernet/emulex/benet/
5031
5032EMULEX ONECONNECT ROCE DRIVER
5033M: Selvin Xavier <selvin.xavier@broadcom.com>
5034M: Devesh Sharma <devesh.sharma@broadcom.com>
5035L: linux-rdma@vger.kernel.org
5036W: http://www.broadcom.com
5037S: Odd Fixes
5038F: drivers/infiniband/hw/ocrdma/
5039F: include/uapi/rdma/ocrdma-abi.h
5040
5089EMULEX/BROADCOM LPFC FC/FCOE SCSI DRIVER 5041EMULEX/BROADCOM LPFC FC/FCOE SCSI DRIVER
5090M: James Smart <james.smart@broadcom.com> 5042M: James Smart <james.smart@broadcom.com>
5091M: Dick Kennedy <dick.kennedy@broadcom.com> 5043M: Dick Kennedy <dick.kennedy@broadcom.com>
@@ -5171,6 +5123,22 @@ L: linux-security-module@vger.kernel.org
5171S: Supported 5123S: Supported
5172F: security/integrity/evm/ 5124F: security/integrity/evm/
5173 5125
5126EXTENSIBLE FIRMWARE INTERFACE (EFI)
5127M: Matt Fleming <matt@codeblueprint.co.uk>
5128M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5129L: linux-efi@vger.kernel.org
5130T: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
5131S: Maintained
5132F: Documentation/efi-stub.txt
5133F: arch/*/kernel/efi.c
5134F: arch/x86/boot/compressed/eboot.[ch]
5135F: arch/*/include/asm/efi.h
5136F: arch/x86/platform/efi/
5137F: drivers/firmware/efi/
5138F: include/linux/efi*.h
5139F: arch/arm/boot/compressed/efi-header.S
5140F: arch/arm64/kernel/efi-entry.S
5141
5174EXTERNAL CONNECTOR SUBSYSTEM (EXTCON) 5142EXTERNAL CONNECTOR SUBSYSTEM (EXTCON)
5175M: MyungJoo Ham <myungjoo.ham@samsung.com> 5143M: MyungJoo Ham <myungjoo.ham@samsung.com>
5176M: Chanwoo Choi <cw00.choi@samsung.com> 5144M: Chanwoo Choi <cw00.choi@samsung.com>
@@ -5201,6 +5169,19 @@ S: Supported
5201F: arch/arc/plat-eznps 5169F: arch/arc/plat-eznps
5202F: arch/arc/boot/dts/eznps.dts 5170F: arch/arc/boot/dts/eznps.dts
5203 5171
5172F2FS FILE SYSTEM
5173M: Jaegeuk Kim <jaegeuk@kernel.org>
5174M: Chao Yu <yuchao0@huawei.com>
5175L: linux-f2fs-devel@lists.sourceforge.net
5176W: https://f2fs.wiki.kernel.org/
5177T: git git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
5178S: Maintained
5179F: Documentation/filesystems/f2fs.txt
5180F: Documentation/ABI/testing/sysfs-fs-f2fs
5181F: fs/f2fs/
5182F: include/linux/f2fs_fs.h
5183F: include/trace/events/f2fs.h
5184
5204F71805F HARDWARE MONITORING DRIVER 5185F71805F HARDWARE MONITORING DRIVER
5205M: Jean Delvare <jdelvare@suse.com> 5186M: Jean Delvare <jdelvare@suse.com>
5206L: linux-hwmon@vger.kernel.org 5187L: linux-hwmon@vger.kernel.org
@@ -5208,23 +5189,6 @@ S: Maintained
5208F: Documentation/hwmon/f71805f 5189F: Documentation/hwmon/f71805f
5209F: drivers/hwmon/f71805f.c 5190F: drivers/hwmon/f71805f.c
5210 5191
5211FC0011 TUNER DRIVER
5212M: Michael Buesch <m@bues.ch>
5213L: linux-media@vger.kernel.org
5214S: Maintained
5215F: drivers/media/tuners/fc0011.h
5216F: drivers/media/tuners/fc0011.c
5217
5218FC2580 MEDIA DRIVER
5219M: Antti Palosaari <crope@iki.fi>
5220L: linux-media@vger.kernel.org
5221W: https://linuxtv.org
5222W: http://palosaari.fi/linux/
5223Q: http://patchwork.linuxtv.org/project/linux-media/list/
5224T: git git://linuxtv.org/anttip/media_tree.git
5225S: Maintained
5226F: drivers/media/tuners/fc2580*
5227
5228FANOTIFY 5192FANOTIFY
5229M: Eric Paris <eparis@redhat.com> 5193M: Eric Paris <eparis@redhat.com>
5230S: Maintained 5194S: Maintained
@@ -5249,6 +5213,23 @@ M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
5249S: Maintained 5213S: Maintained
5250F: drivers/staging/fbtft/ 5214F: drivers/staging/fbtft/
5251 5215
5216FC0011 TUNER DRIVER
5217M: Michael Buesch <m@bues.ch>
5218L: linux-media@vger.kernel.org
5219S: Maintained
5220F: drivers/media/tuners/fc0011.h
5221F: drivers/media/tuners/fc0011.c
5222
5223FC2580 MEDIA DRIVER
5224M: Antti Palosaari <crope@iki.fi>
5225L: linux-media@vger.kernel.org
5226W: https://linuxtv.org
5227W: http://palosaari.fi/linux/
5228Q: http://patchwork.linuxtv.org/project/linux-media/list/
5229T: git git://linuxtv.org/anttip/media_tree.git
5230S: Maintained
5231F: drivers/media/tuners/fc2580*
5232
5252FCOE SUBSYSTEM (libfc, libfcoe, fcoe) 5233FCOE SUBSYSTEM (libfc, libfcoe, fcoe)
5253M: Johannes Thumshirn <jth@kernel.org> 5234M: Johannes Thumshirn <jth@kernel.org>
5254L: fcoe-devel@open-fcoe.org 5235L: fcoe-devel@open-fcoe.org
@@ -5408,6 +5389,14 @@ L: linuxppc-dev@lists.ozlabs.org
5408S: Maintained 5389S: Maintained
5409F: drivers/dma/fsldma.* 5390F: drivers/dma/fsldma.*
5410 5391
5392FREESCALE eTSEC ETHERNET DRIVER (GIANFAR)
5393M: Claudiu Manoil <claudiu.manoil@freescale.com>
5394L: netdev@vger.kernel.org
5395S: Maintained
5396F: drivers/net/ethernet/freescale/gianfar*
5397X: drivers/net/ethernet/freescale/gianfar_ptp.c
5398F: Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
5399
5411FREESCALE GPMI NAND DRIVER 5400FREESCALE GPMI NAND DRIVER
5412M: Han Xu <han.xu@nxp.com> 5401M: Han Xu <han.xu@nxp.com>
5413L: linux-mtd@lists.infradead.org 5402L: linux-mtd@lists.infradead.org
@@ -5421,6 +5410,15 @@ L: linux-i2c@vger.kernel.org
5421S: Maintained 5410S: Maintained
5422F: drivers/i2c/busses/i2c-cpm.c 5411F: drivers/i2c/busses/i2c-cpm.c
5423 5412
5413FREESCALE IMX / MXC FEC DRIVER
5414M: Fugang Duan <fugang.duan@nxp.com>
5415L: netdev@vger.kernel.org
5416S: Maintained
5417F: drivers/net/ethernet/freescale/fec_main.c
5418F: drivers/net/ethernet/freescale/fec_ptp.c
5419F: drivers/net/ethernet/freescale/fec.h
5420F: Documentation/devicetree/bindings/net/fsl-fec.txt
5421
5424FREESCALE IMX / MXC FRAMEBUFFER DRIVER 5422FREESCALE IMX / MXC FRAMEBUFFER DRIVER
5425M: Sascha Hauer <kernel@pengutronix.de> 5423M: Sascha Hauer <kernel@pengutronix.de>
5426L: linux-fbdev@vger.kernel.org 5424L: linux-fbdev@vger.kernel.org
@@ -5429,29 +5427,11 @@ S: Maintained
5429F: include/linux/platform_data/video-imxfb.h 5427F: include/linux/platform_data/video-imxfb.h
5430F: drivers/video/fbdev/imxfb.c 5428F: drivers/video/fbdev/imxfb.c
5431 5429
5432FREESCALE QUAD SPI DRIVER 5430FREESCALE QORIQ DPAA ETHERNET DRIVER
5433M: Han Xu <han.xu@nxp.com> 5431M: Madalin Bucur <madalin.bucur@nxp.com>
5434L: linux-mtd@lists.infradead.org
5435S: Maintained
5436F: drivers/mtd/spi-nor/fsl-quadspi.c
5437
5438FREESCALE SOC FS_ENET DRIVER
5439M: Pantelis Antoniou <pantelis.antoniou@gmail.com>
5440M: Vitaly Bordug <vbordug@ru.mvista.com>
5441L: linuxppc-dev@lists.ozlabs.org
5442L: netdev@vger.kernel.org
5443S: Maintained
5444F: drivers/net/ethernet/freescale/fs_enet/
5445F: include/linux/fs_enet_pd.h
5446
5447FREESCALE IMX / MXC FEC DRIVER
5448M: Fugang Duan <fugang.duan@nxp.com>
5449L: netdev@vger.kernel.org 5432L: netdev@vger.kernel.org
5450S: Maintained 5433S: Maintained
5451F: drivers/net/ethernet/freescale/fec_main.c 5434F: drivers/net/ethernet/freescale/dpaa
5452F: drivers/net/ethernet/freescale/fec_ptp.c
5453F: drivers/net/ethernet/freescale/fec.h
5454F: Documentation/devicetree/bindings/net/fsl-fec.txt
5455 5435
5456FREESCALE QORIQ DPAA FMAN DRIVER 5436FREESCALE QORIQ DPAA FMAN DRIVER
5457M: Madalin Bucur <madalin.bucur@nxp.com> 5437M: Madalin Bucur <madalin.bucur@nxp.com>
@@ -5460,20 +5440,11 @@ S: Maintained
5460F: drivers/net/ethernet/freescale/fman 5440F: drivers/net/ethernet/freescale/fman
5461F: Documentation/devicetree/bindings/powerpc/fsl/fman.txt 5441F: Documentation/devicetree/bindings/powerpc/fsl/fman.txt
5462 5442
5463FREESCALE QORIQ DPAA ETHERNET DRIVER 5443FREESCALE QUAD SPI DRIVER
5464M: Madalin Bucur <madalin.bucur@nxp.com> 5444M: Han Xu <han.xu@nxp.com>
5465L: netdev@vger.kernel.org 5445L: linux-mtd@lists.infradead.org
5466S: Maintained
5467F: drivers/net/ethernet/freescale/dpaa
5468
5469FREESCALE SOC DRIVERS
5470M: Li Yang <leoyang.li@nxp.com>
5471L: linuxppc-dev@lists.ozlabs.org
5472L: linux-arm-kernel@lists.infradead.org
5473S: Maintained 5446S: Maintained
5474F: Documentation/devicetree/bindings/soc/fsl/ 5447F: drivers/mtd/spi-nor/fsl-quadspi.c
5475F: drivers/soc/fsl/
5476F: include/linux/fsl/
5477 5448
5478FREESCALE QUICC ENGINE LIBRARY 5449FREESCALE QUICC ENGINE LIBRARY
5479M: Qiang Zhao <qiang.zhao@nxp.com> 5450M: Qiang Zhao <qiang.zhao@nxp.com>
@@ -5483,13 +5454,6 @@ F: drivers/soc/fsl/qe/
5483F: include/soc/fsl/*qe*.h 5454F: include/soc/fsl/*qe*.h
5484F: include/soc/fsl/*ucc*.h 5455F: include/soc/fsl/*ucc*.h
5485 5456
5486FREESCALE USB PERIPHERAL DRIVERS
5487M: Li Yang <leoyang.li@nxp.com>
5488L: linux-usb@vger.kernel.org
5489L: linuxppc-dev@lists.ozlabs.org
5490S: Maintained
5491F: drivers/usb/gadget/udc/fsl*
5492
5493FREESCALE QUICC ENGINE UCC ETHERNET DRIVER 5457FREESCALE QUICC ENGINE UCC ETHERNET DRIVER
5494M: Li Yang <leoyang.li@nxp.com> 5458M: Li Yang <leoyang.li@nxp.com>
5495L: netdev@vger.kernel.org 5459L: netdev@vger.kernel.org
@@ -5497,14 +5461,6 @@ L: linuxppc-dev@lists.ozlabs.org
5497S: Maintained 5461S: Maintained
5498F: drivers/net/ethernet/freescale/ucc_geth* 5462F: drivers/net/ethernet/freescale/ucc_geth*
5499 5463
5500FREESCALE eTSEC ETHERNET DRIVER (GIANFAR)
5501M: Claudiu Manoil <claudiu.manoil@freescale.com>
5502L: netdev@vger.kernel.org
5503S: Maintained
5504F: drivers/net/ethernet/freescale/gianfar*
5505X: drivers/net/ethernet/freescale/gianfar_ptp.c
5506F: Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
5507
5508FREESCALE QUICC ENGINE UCC HDLC DRIVER 5464FREESCALE QUICC ENGINE UCC HDLC DRIVER
5509M: Zhao Qiang <qiang.zhao@nxp.com> 5465M: Zhao Qiang <qiang.zhao@nxp.com>
5510L: netdev@vger.kernel.org 5466L: netdev@vger.kernel.org
@@ -5518,6 +5474,24 @@ L: linuxppc-dev@lists.ozlabs.org
5518S: Maintained 5474S: Maintained
5519F: drivers/tty/serial/ucc_uart.c 5475F: drivers/tty/serial/ucc_uart.c
5520 5476
5477FREESCALE SOC DRIVERS
5478M: Li Yang <leoyang.li@nxp.com>
5479L: linuxppc-dev@lists.ozlabs.org
5480L: linux-arm-kernel@lists.infradead.org
5481S: Maintained
5482F: Documentation/devicetree/bindings/soc/fsl/
5483F: drivers/soc/fsl/
5484F: include/linux/fsl/
5485
5486FREESCALE SOC FS_ENET DRIVER
5487M: Pantelis Antoniou <pantelis.antoniou@gmail.com>
5488M: Vitaly Bordug <vbordug@ru.mvista.com>
5489L: linuxppc-dev@lists.ozlabs.org
5490L: netdev@vger.kernel.org
5491S: Maintained
5492F: drivers/net/ethernet/freescale/fs_enet/
5493F: include/linux/fs_enet_pd.h
5494
5521FREESCALE SOC SOUND DRIVERS 5495FREESCALE SOC SOUND DRIVERS
5522M: Timur Tabi <timur@tabi.org> 5496M: Timur Tabi <timur@tabi.org>
5523M: Nicolin Chen <nicoleotsuka@gmail.com> 5497M: Nicolin Chen <nicoleotsuka@gmail.com>
@@ -5530,6 +5504,13 @@ F: sound/soc/fsl/fsl*
5530F: sound/soc/fsl/imx* 5504F: sound/soc/fsl/imx*
5531F: sound/soc/fsl/mpc8610_hpcd.c 5505F: sound/soc/fsl/mpc8610_hpcd.c
5532 5506
5507FREESCALE USB PERIPHERAL DRIVERS
5508M: Li Yang <leoyang.li@nxp.com>
5509L: linux-usb@vger.kernel.org
5510L: linuxppc-dev@lists.ozlabs.org
5511S: Maintained
5512F: drivers/usb/gadget/udc/fsl*
5513
5533FREEVXFS FILESYSTEM 5514FREEVXFS FILESYSTEM
5534M: Christoph Hellwig <hch@infradead.org> 5515M: Christoph Hellwig <hch@infradead.org>
5535W: ftp://ftp.openlinux.org/pub/people/hch/vxfs 5516W: ftp://ftp.openlinux.org/pub/people/hch/vxfs
@@ -5570,19 +5551,6 @@ S: Supported
5570F: fs/crypto/ 5551F: fs/crypto/
5571F: include/linux/fscrypt*.h 5552F: include/linux/fscrypt*.h
5572 5553
5573F2FS FILE SYSTEM
5574M: Jaegeuk Kim <jaegeuk@kernel.org>
5575M: Chao Yu <yuchao0@huawei.com>
5576L: linux-f2fs-devel@lists.sourceforge.net
5577W: https://f2fs.wiki.kernel.org/
5578T: git git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
5579S: Maintained
5580F: Documentation/filesystems/f2fs.txt
5581F: Documentation/ABI/testing/sysfs-fs-f2fs
5582F: fs/f2fs/
5583F: include/linux/f2fs_fs.h
5584F: include/trace/events/f2fs.h
5585
5586FUJITSU FR-V (FRV) PORT 5554FUJITSU FR-V (FRV) PORT
5587S: Orphan 5555S: Orphan
5588F: arch/frv/ 5556F: arch/frv/
@@ -5656,6 +5624,12 @@ S: Maintained
5656F: kernel/gcov/ 5624F: kernel/gcov/
5657F: Documentation/dev-tools/gcov.rst 5625F: Documentation/dev-tools/gcov.rst
5658 5626
5627GDB KERNEL DEBUGGING HELPER SCRIPTS
5628M: Jan Kiszka <jan.kiszka@siemens.com>
5629M: Kieran Bingham <kieran@bingham.xyz>
5630S: Supported
5631F: scripts/gdb/
5632
5659GDT SCSI DISK ARRAY CONTROLLER DRIVER 5633GDT SCSI DISK ARRAY CONTROLLER DRIVER
5660M: Achim Leubner <achim_leubner@adaptec.com> 5634M: Achim Leubner <achim_leubner@adaptec.com>
5661L: linux-scsi@vger.kernel.org 5635L: linux-scsi@vger.kernel.org
@@ -5663,12 +5637,6 @@ W: http://www.icp-vortex.com/
5663S: Supported 5637S: Supported
5664F: drivers/scsi/gdt* 5638F: drivers/scsi/gdt*
5665 5639
5666GDB KERNEL DEBUGGING HELPER SCRIPTS
5667M: Jan Kiszka <jan.kiszka@siemens.com>
5668M: Kieran Bingham <kieran@bingham.xyz>
5669S: Supported
5670F: scripts/gdb/
5671
5672GEMTEK FM RADIO RECEIVER DRIVER 5640GEMTEK FM RADIO RECEIVER DRIVER
5673M: Hans Verkuil <hverkuil@xs4all.nl> 5641M: Hans Verkuil <hverkuil@xs4all.nl>
5674L: linux-media@vger.kernel.org 5642L: linux-media@vger.kernel.org
@@ -5735,17 +5703,17 @@ L: kvm@vger.kernel.org
5735S: Supported 5703S: Supported
5736F: drivers/uio/uio_pci_generic.c 5704F: drivers/uio/uio_pci_generic.c
5737 5705
5738GET_MAINTAINER SCRIPT
5739M: Joe Perches <joe@perches.com>
5740S: Maintained
5741F: scripts/get_maintainer.pl
5742
5743GENWQE (IBM Generic Workqueue Card) 5706GENWQE (IBM Generic Workqueue Card)
5744M: Frank Haverkamp <haver@linux.vnet.ibm.com> 5707M: Frank Haverkamp <haver@linux.vnet.ibm.com>
5745M: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> 5708M: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
5746S: Supported 5709S: Supported
5747F: drivers/misc/genwqe/ 5710F: drivers/misc/genwqe/
5748 5711
5712GET_MAINTAINER SCRIPT
5713M: Joe Perches <joe@perches.com>
5714S: Maintained
5715F: scripts/get_maintainer.pl
5716
5749GFS2 FILE SYSTEM 5717GFS2 FILE SYSTEM
5750M: Steven Whitehouse <swhiteho@redhat.com> 5718M: Steven Whitehouse <swhiteho@redhat.com>
5751M: Bob Peterson <rpeterso@redhat.com> 5719M: Bob Peterson <rpeterso@redhat.com>
@@ -5778,6 +5746,15 @@ L: linux-input@vger.kernel.org
5778S: Maintained 5746S: Maintained
5779F: drivers/input/touchscreen/goodix.c 5747F: drivers/input/touchscreen/goodix.c
5780 5748
5749GPIO ACPI SUPPORT
5750M: Mika Westerberg <mika.westerberg@linux.intel.com>
5751M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5752L: linux-gpio@vger.kernel.org
5753L: linux-acpi@vger.kernel.org
5754S: Maintained
5755F: Documentation/acpi/gpio-properties.txt
5756F: drivers/gpio/gpiolib-acpi.c
5757
5781GPIO MOCKUP DRIVER 5758GPIO MOCKUP DRIVER
5782M: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> 5759M: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
5783L: linux-gpio@vger.kernel.org 5760L: linux-gpio@vger.kernel.org
@@ -5801,15 +5778,6 @@ F: include/asm-generic/gpio.h
5801F: include/uapi/linux/gpio.h 5778F: include/uapi/linux/gpio.h
5802F: tools/gpio/ 5779F: tools/gpio/
5803 5780
5804GPIO ACPI SUPPORT
5805M: Mika Westerberg <mika.westerberg@linux.intel.com>
5806M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
5807L: linux-gpio@vger.kernel.org
5808L: linux-acpi@vger.kernel.org
5809S: Maintained
5810F: Documentation/acpi/gpio-properties.txt
5811F: drivers/gpio/gpiolib-acpi.c
5812
5813GRE DEMULTIPLEXER DRIVER 5781GRE DEMULTIPLEXER DRIVER
5814M: Dmitry Kozlov <xeb@mail.ru> 5782M: Dmitry Kozlov <xeb@mail.ru>
5815L: netdev@vger.kernel.org 5783L: netdev@vger.kernel.org
@@ -5824,14 +5792,6 @@ L: netdev@vger.kernel.org
5824S: Maintained 5792S: Maintained
5825F: drivers/net/ethernet/aeroflex/ 5793F: drivers/net/ethernet/aeroflex/
5826 5794
5827GREYBUS SUBSYSTEM
5828M: Johan Hovold <johan@kernel.org>
5829M: Alex Elder <elder@kernel.org>
5830M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5831S: Maintained
5832F: drivers/staging/greybus/
5833L: greybus-dev@lists.linaro.org (moderated for non-subscribers)
5834
5835GREYBUS AUDIO PROTOCOLS DRIVERS 5795GREYBUS AUDIO PROTOCOLS DRIVERS
5836M: Vaibhav Agarwal <vaibhav.sr@gmail.com> 5796M: Vaibhav Agarwal <vaibhav.sr@gmail.com>
5837M: Mark Greer <mgreer@animalcreek.com> 5797M: Mark Greer <mgreer@animalcreek.com>
@@ -5849,24 +5809,7 @@ F: drivers/staging/greybus/audio_manager_sysfs.c
5849F: drivers/staging/greybus/audio_module.c 5809F: drivers/staging/greybus/audio_module.c
5850F: drivers/staging/greybus/audio_topology.c 5810F: drivers/staging/greybus/audio_topology.c
5851 5811
5852GREYBUS PROTOCOLS DRIVERS 5812GREYBUS FW/HID/SPI PROTOCOLS DRIVERS
5853M: Rui Miguel Silva <rmfrfs@gmail.com>
5854S: Maintained
5855F: drivers/staging/greybus/sdio.c
5856F: drivers/staging/greybus/light.c
5857F: drivers/staging/greybus/gpio.c
5858F: drivers/staging/greybus/power_supply.c
5859F: drivers/staging/greybus/spi.c
5860F: drivers/staging/greybus/spilib.c
5861
5862GREYBUS PROTOCOLS DRIVERS
5863M: Bryan O'Donoghue <pure.logic@nexus-software.ie>
5864S: Maintained
5865F: drivers/staging/greybus/loopback.c
5866F: drivers/staging/greybus/timesync.c
5867F: drivers/staging/greybus/timesync_platform.c
5868
5869GREYBUS PROTOCOLS DRIVERS
5870M: Viresh Kumar <vireshk@kernel.org> 5813M: Viresh Kumar <vireshk@kernel.org>
5871S: Maintained 5814S: Maintained
5872F: drivers/staging/greybus/authentication.c 5815F: drivers/staging/greybus/authentication.c
@@ -5883,11 +5826,12 @@ F: drivers/staging/greybus/spi.c
5883F: drivers/staging/greybus/spilib.c 5826F: drivers/staging/greybus/spilib.c
5884F: drivers/staging/greybus/spilib.h 5827F: drivers/staging/greybus/spilib.h
5885 5828
5886GREYBUS PROTOCOLS DRIVERS 5829GREYBUS LOOBACK/TIME PROTOCOLS DRIVERS
5887M: David Lin <dtwlin@gmail.com> 5830M: Bryan O'Donoghue <pure.logic@nexus-software.ie>
5888S: Maintained 5831S: Maintained
5889F: drivers/staging/greybus/uart.c 5832F: drivers/staging/greybus/loopback.c
5890F: drivers/staging/greybus/log.c 5833F: drivers/staging/greybus/timesync.c
5834F: drivers/staging/greybus/timesync_platform.c
5891 5835
5892GREYBUS PLATFORM DRIVERS 5836GREYBUS PLATFORM DRIVERS
5893M: Vaibhav Hiremath <hvaibhav.linux@gmail.com> 5837M: Vaibhav Hiremath <hvaibhav.linux@gmail.com>
@@ -5896,6 +5840,30 @@ F: drivers/staging/greybus/arche-platform.c
5896F: drivers/staging/greybus/arche-apb-ctrl.c 5840F: drivers/staging/greybus/arche-apb-ctrl.c
5897F: drivers/staging/greybus/arche_platform.h 5841F: drivers/staging/greybus/arche_platform.h
5898 5842
5843GREYBUS SDIO/GPIO/SPI PROTOCOLS DRIVERS
5844M: Rui Miguel Silva <rmfrfs@gmail.com>
5845S: Maintained
5846F: drivers/staging/greybus/sdio.c
5847F: drivers/staging/greybus/light.c
5848F: drivers/staging/greybus/gpio.c
5849F: drivers/staging/greybus/power_supply.c
5850F: drivers/staging/greybus/spi.c
5851F: drivers/staging/greybus/spilib.c
5852
5853GREYBUS SUBSYSTEM
5854M: Johan Hovold <johan@kernel.org>
5855M: Alex Elder <elder@kernel.org>
5856M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5857S: Maintained
5858F: drivers/staging/greybus/
5859L: greybus-dev@lists.linaro.org (moderated for non-subscribers)
5860
5861GREYBUS UART PROTOCOLS DRIVERS
5862M: David Lin <dtwlin@gmail.com>
5863S: Maintained
5864F: drivers/staging/greybus/uart.c
5865F: drivers/staging/greybus/log.c
5866
5899GS1662 VIDEO SERIALIZER 5867GS1662 VIDEO SERIALIZER
5900M: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr> 5868M: Charles-Antoine Couret <charles-antoine.couret@nexvision.fr>
5901L: linux-media@vger.kernel.org 5869L: linux-media@vger.kernel.org
@@ -5966,13 +5934,6 @@ L: linux-efi@vger.kernel.org
5966S: Maintained 5934S: Maintained
5967F: block/partitions/efi.* 5935F: block/partitions/efi.*
5968 5936
5969STK1160 USB VIDEO CAPTURE DRIVER
5970M: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
5971L: linux-media@vger.kernel.org
5972T: git git://linuxtv.org/media_tree.git
5973S: Maintained
5974F: drivers/media/usb/stk1160/
5975
5976H8/300 ARCHITECTURE 5937H8/300 ARCHITECTURE
5977M: Yoshinori Sato <ysato@users.sourceforge.jp> 5938M: Yoshinori Sato <ysato@users.sourceforge.jp>
5978L: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers) 5939L: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers)
@@ -5984,33 +5945,6 @@ F: drivers/clocksource/h8300_*.c
5984F: drivers/clk/h8300/ 5945F: drivers/clk/h8300/
5985F: drivers/irqchip/irq-renesas-h8*.c 5946F: drivers/irqchip/irq-renesas-h8*.c
5986 5947
5987HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
5988M: Frank Seidel <frank@f-seidel.de>
5989L: platform-driver-x86@vger.kernel.org
5990W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
5991S: Maintained
5992F: drivers/platform/x86/hdaps.c
5993
5994HDPVR USB VIDEO ENCODER DRIVER
5995M: Hans Verkuil <hverkuil@xs4all.nl>
5996L: linux-media@vger.kernel.org
5997T: git git://linuxtv.org/media_tree.git
5998W: https://linuxtv.org
5999S: Odd Fixes
6000F: drivers/media/usb/hdpvr/
6001
6002HWPOISON MEMORY FAILURE HANDLING
6003M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
6004L: linux-mm@kvack.org
6005S: Maintained
6006F: mm/memory-failure.c
6007F: mm/hwpoison-inject.c
6008
6009HYPERVISOR VIRTUAL CONSOLE DRIVER
6010L: linuxppc-dev@lists.ozlabs.org
6011S: Odd Fixes
6012F: drivers/tty/hvc/
6013
6014HACKRF MEDIA DRIVER 5948HACKRF MEDIA DRIVER
6015M: Antti Palosaari <crope@iki.fi> 5949M: Antti Palosaari <crope@iki.fi>
6016L: linux-media@vger.kernel.org 5950L: linux-media@vger.kernel.org
@@ -6021,6 +5955,13 @@ T: git git://linuxtv.org/anttip/media_tree.git
6021S: Maintained 5955S: Maintained
6022F: drivers/media/usb/hackrf/ 5956F: drivers/media/usb/hackrf/
6023 5957
5958HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
5959M: Frank Seidel <frank@f-seidel.de>
5960L: platform-driver-x86@vger.kernel.org
5961W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
5962S: Maintained
5963F: drivers/platform/x86/hdaps.c
5964
6024HARDWARE MONITORING 5965HARDWARE MONITORING
6025M: Jean Delvare <jdelvare@suse.com> 5966M: Jean Delvare <jdelvare@suse.com>
6026M: Guenter Roeck <linux@roeck-us.net> 5967M: Guenter Roeck <linux@roeck-us.net>
@@ -6059,6 +6000,14 @@ L: linux-parisc@vger.kernel.org
6059S: Maintained 6000S: Maintained
6060F: sound/parisc/harmony.* 6001F: sound/parisc/harmony.*
6061 6002
6003HDPVR USB VIDEO ENCODER DRIVER
6004M: Hans Verkuil <hverkuil@xs4all.nl>
6005L: linux-media@vger.kernel.org
6006T: git git://linuxtv.org/media_tree.git
6007W: https://linuxtv.org
6008S: Odd Fixes
6009F: drivers/media/usb/hdpvr/
6010
6062HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER 6011HEWLETT PACKARD ENTERPRISE ILO NMI WATCHDOG DRIVER
6063M: Jimmy Vance <jimmy.vance@hpe.com> 6012M: Jimmy Vance <jimmy.vance@hpe.com>
6064S: Supported 6013S: Supported
@@ -6085,13 +6034,6 @@ F: drivers/block/cciss*
6085F: include/linux/cciss_ioctl.h 6034F: include/linux/cciss_ioctl.h
6086F: include/uapi/linux/cciss_ioctl.h 6035F: include/uapi/linux/cciss_ioctl.h
6087 6036
6088OPA-VNIC DRIVER
6089M: Dennis Dalessandro <dennis.dalessandro@intel.com>
6090M: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
6091L: linux-rdma@vger.kernel.org
6092S: Supported
6093F: drivers/infiniband/ulp/opa_vnic
6094
6095HFI1 DRIVER 6037HFI1 DRIVER
6096M: Mike Marciniszyn <mike.marciniszyn@intel.com> 6038M: Mike Marciniszyn <mike.marciniszyn@intel.com>
6097M: Dennis Dalessandro <dennis.dalessandro@intel.com> 6039M: Dennis Dalessandro <dennis.dalessandro@intel.com>
@@ -6269,6 +6211,12 @@ L: netdev@vger.kernel.org
6269S: Maintained 6211S: Maintained
6270F: net/hsr/ 6212F: net/hsr/
6271 6213
6214HT16K33 LED CONTROLLER DRIVER
6215M: Robin van der Gracht <robin@protonic.nl>
6216S: Maintained
6217F: drivers/auxdisplay/ht16k33.c
6218F: Documentation/devicetree/bindings/display/ht16k33.txt
6219
6272HTCPEN TOUCHSCREEN DRIVER 6220HTCPEN TOUCHSCREEN DRIVER
6273M: Pau Oliva Fora <pof@eslack.org> 6221M: Pau Oliva Fora <pof@eslack.org>
6274L: linux-input@vger.kernel.org 6222L: linux-input@vger.kernel.org
@@ -6288,6 +6236,13 @@ W: https://linuxtv.org
6288S: Supported 6236S: Supported
6289F: drivers/media/platform/sti/hva 6237F: drivers/media/platform/sti/hva
6290 6238
6239HWPOISON MEMORY FAILURE HANDLING
6240M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
6241L: linux-mm@kvack.org
6242S: Maintained
6243F: mm/memory-failure.c
6244F: mm/hwpoison-inject.c
6245
6291Hyper-V CORE AND DRIVERS 6246Hyper-V CORE AND DRIVERS
6292M: "K. Y. Srinivasan" <kys@microsoft.com> 6247M: "K. Y. Srinivasan" <kys@microsoft.com>
6293M: Haiyang Zhang <haiyangz@microsoft.com> 6248M: Haiyang Zhang <haiyangz@microsoft.com>
@@ -6310,6 +6265,18 @@ F: include/linux/hyperv.h
6310F: tools/hv/ 6265F: tools/hv/
6311F: Documentation/ABI/stable/sysfs-bus-vmbus 6266F: Documentation/ABI/stable/sysfs-bus-vmbus
6312 6267
6268HYPERVISOR VIRTUAL CONSOLE DRIVER
6269L: linuxppc-dev@lists.ozlabs.org
6270S: Odd Fixes
6271F: drivers/tty/hvc/
6272
6273I2C ACPI SUPPORT
6274M: Mika Westerberg <mika.westerberg@linux.intel.com>
6275L: linux-i2c@vger.kernel.org
6276L: linux-acpi@vger.kernel.org
6277S: Maintained
6278F: drivers/i2c/i2c-core-acpi.c
6279
6313I2C MUXES 6280I2C MUXES
6314M: Peter Rosin <peda@axentia.se> 6281M: Peter Rosin <peda@axentia.se>
6315L: linux-i2c@vger.kernel.org 6282L: linux-i2c@vger.kernel.org
@@ -6332,6 +6299,36 @@ F: Documentation/i2c/busses/i2c-parport-light
6332F: drivers/i2c/busses/i2c-parport.c 6299F: drivers/i2c/busses/i2c-parport.c
6333F: drivers/i2c/busses/i2c-parport-light.c 6300F: drivers/i2c/busses/i2c-parport-light.c
6334 6301
6302I2C SUBSYSTEM
6303M: Wolfram Sang <wsa@the-dreams.de>
6304L: linux-i2c@vger.kernel.org
6305W: https://i2c.wiki.kernel.org/
6306Q: https://patchwork.ozlabs.org/project/linux-i2c/list/
6307T: git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
6308S: Maintained
6309F: Documentation/devicetree/bindings/i2c/
6310F: Documentation/i2c/
6311F: drivers/i2c/
6312F: drivers/i2c/*/
6313F: include/linux/i2c.h
6314F: include/linux/i2c-*.h
6315F: include/uapi/linux/i2c.h
6316F: include/uapi/linux/i2c-*.h
6317
6318I2C-TAOS-EVM DRIVER
6319M: Jean Delvare <jdelvare@suse.com>
6320L: linux-i2c@vger.kernel.org
6321S: Maintained
6322F: Documentation/i2c/busses/i2c-taos-evm
6323F: drivers/i2c/busses/i2c-taos-evm.c
6324
6325I2C-TINY-USB DRIVER
6326M: Till Harbaum <till@harbaum.org>
6327L: linux-i2c@vger.kernel.org
6328W: http://www.harbaum.org/till/i2c_tiny_usb
6329S: Maintained
6330F: drivers/i2c/busses/i2c-tiny-usb.c
6331
6335I2C/SMBUS CONTROLLER DRIVERS FOR PC 6332I2C/SMBUS CONTROLLER DRIVERS FOR PC
6336M: Jean Delvare <jdelvare@suse.com> 6333M: Jean Delvare <jdelvare@suse.com>
6337L: linux-i2c@vger.kernel.org 6334L: linux-i2c@vger.kernel.org
@@ -6379,43 +6376,6 @@ L: linux-i2c@vger.kernel.org
6379S: Maintained 6376S: Maintained
6380F: drivers/i2c/i2c-stub.c 6377F: drivers/i2c/i2c-stub.c
6381 6378
6382I2C SUBSYSTEM
6383M: Wolfram Sang <wsa@the-dreams.de>
6384L: linux-i2c@vger.kernel.org
6385W: https://i2c.wiki.kernel.org/
6386Q: https://patchwork.ozlabs.org/project/linux-i2c/list/
6387T: git git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
6388S: Maintained
6389F: Documentation/devicetree/bindings/i2c/
6390F: Documentation/i2c/
6391F: drivers/i2c/
6392F: drivers/i2c/*/
6393F: include/linux/i2c.h
6394F: include/linux/i2c-*.h
6395F: include/uapi/linux/i2c.h
6396F: include/uapi/linux/i2c-*.h
6397
6398I2C ACPI SUPPORT
6399M: Mika Westerberg <mika.westerberg@linux.intel.com>
6400L: linux-i2c@vger.kernel.org
6401L: linux-acpi@vger.kernel.org
6402S: Maintained
6403F: drivers/i2c/i2c-core-acpi.c
6404
6405I2C-TAOS-EVM DRIVER
6406M: Jean Delvare <jdelvare@suse.com>
6407L: linux-i2c@vger.kernel.org
6408S: Maintained
6409F: Documentation/i2c/busses/i2c-taos-evm
6410F: drivers/i2c/busses/i2c-taos-evm.c
6411
6412I2C-TINY-USB DRIVER
6413M: Till Harbaum <till@harbaum.org>
6414L: linux-i2c@vger.kernel.org
6415W: http://www.harbaum.org/till/i2c_tiny_usb
6416S: Maintained
6417F: drivers/i2c/busses/i2c-tiny-usb.c
6418
6419i386 BOOT CODE 6379i386 BOOT CODE
6420M: "H. Peter Anvin" <hpa@zytor.com> 6380M: "H. Peter Anvin" <hpa@zytor.com>
6421S: Maintained 6381S: Maintained
@@ -6434,17 +6394,15 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git
6434S: Maintained 6394S: Maintained
6435F: arch/ia64/ 6395F: arch/ia64/
6436 6396
6437IBM Power VMX Cryptographic instructions 6397IBM Power 842 compression accelerator
6438M: Leonidas S. Barbosa <leosilva@linux.vnet.ibm.com> 6398M: Haren Myneni <haren@us.ibm.com>
6439M: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
6440L: linux-crypto@vger.kernel.org
6441S: Supported 6399S: Supported
6442F: drivers/crypto/vmx/Makefile 6400F: drivers/crypto/nx/Makefile
6443F: drivers/crypto/vmx/Kconfig 6401F: drivers/crypto/nx/Kconfig
6444F: drivers/crypto/vmx/vmx.c 6402F: drivers/crypto/nx/nx-842*
6445F: drivers/crypto/vmx/aes* 6403F: include/linux/sw842.h
6446F: drivers/crypto/vmx/ghash* 6404F: crypto/842.c
6447F: drivers/crypto/vmx/ppc-xlate.pl 6405F: lib/842/
6448 6406
6449IBM Power in-Nest Crypto Acceleration 6407IBM Power in-Nest Crypto Acceleration
6450M: Leonidas S. Barbosa <leosilva@linux.vnet.ibm.com> 6408M: Leonidas S. Barbosa <leosilva@linux.vnet.ibm.com>
@@ -6459,33 +6417,29 @@ F: drivers/crypto/nx/nx.*
6459F: drivers/crypto/nx/nx_csbcpb.h 6417F: drivers/crypto/nx/nx_csbcpb.h
6460F: drivers/crypto/nx/nx_debugfs.h 6418F: drivers/crypto/nx/nx_debugfs.h
6461 6419
6462IBM Power 842 compression accelerator
6463M: Haren Myneni <haren@us.ibm.com>
6464S: Supported
6465F: drivers/crypto/nx/Makefile
6466F: drivers/crypto/nx/Kconfig
6467F: drivers/crypto/nx/nx-842*
6468F: include/linux/sw842.h
6469F: crypto/842.c
6470F: lib/842/
6471
6472IBM Power Linux RAID adapter 6420IBM Power Linux RAID adapter
6473M: Brian King <brking@us.ibm.com> 6421M: Brian King <brking@us.ibm.com>
6474S: Supported 6422S: Supported
6475F: drivers/scsi/ipr.* 6423F: drivers/scsi/ipr.*
6476 6424
6477IBM Power Virtual Ethernet Device Driver 6425IBM Power SRIOV Virtual NIC Device Driver
6478M: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> 6426M: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
6427M: John Allen <jallen@linux.vnet.ibm.com>
6479L: netdev@vger.kernel.org 6428L: netdev@vger.kernel.org
6480S: Supported 6429S: Supported
6481F: drivers/net/ethernet/ibm/ibmveth.* 6430F: drivers/net/ethernet/ibm/ibmvnic.*
6482 6431
6483IBM Power SRIOV Virtual NIC Device Driver 6432IBM Power Virtual Ethernet Device Driver
6484M: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> 6433M: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
6485M: John Allen <jallen@linux.vnet.ibm.com>
6486L: netdev@vger.kernel.org 6434L: netdev@vger.kernel.org
6487S: Supported 6435S: Supported
6488F: drivers/net/ethernet/ibm/ibmvnic.* 6436F: drivers/net/ethernet/ibm/ibmveth.*
6437
6438IBM Power Virtual FC Device Drivers
6439M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
6440L: linux-scsi@vger.kernel.org
6441S: Supported
6442F: drivers/scsi/ibmvscsi/ibmvfc*
6489 6443
6490IBM Power Virtual SCSI Device Drivers 6444IBM Power Virtual SCSI Device Drivers
6491M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> 6445M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
@@ -6502,11 +6456,17 @@ L: target-devel@vger.kernel.org
6502S: Supported 6456S: Supported
6503F: drivers/scsi/ibmvscsi_tgt/ 6457F: drivers/scsi/ibmvscsi_tgt/
6504 6458
6505IBM Power Virtual FC Device Drivers 6459IBM Power VMX Cryptographic instructions
6506M: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> 6460M: Leonidas S. Barbosa <leosilva@linux.vnet.ibm.com>
6507L: linux-scsi@vger.kernel.org 6461M: Paulo Flabiano Smorigo <pfsmorigo@linux.vnet.ibm.com>
6462L: linux-crypto@vger.kernel.org
6508S: Supported 6463S: Supported
6509F: drivers/scsi/ibmvscsi/ibmvfc* 6464F: drivers/crypto/vmx/Makefile
6465F: drivers/crypto/vmx/Kconfig
6466F: drivers/crypto/vmx/vmx.c
6467F: drivers/crypto/vmx/aes*
6468F: drivers/crypto/vmx/ghash*
6469F: drivers/crypto/vmx/ppc-xlate.pl
6510 6470
6511IBM ServeRAID RAID DRIVER 6471IBM ServeRAID RAID DRIVER
6512S: Orphan 6472S: Orphan
@@ -6518,11 +6478,6 @@ S: Maintained
6518F: drivers/mfd/lpc_ich.c 6478F: drivers/mfd/lpc_ich.c
6519F: drivers/gpio/gpio-ich.c 6479F: drivers/gpio/gpio-ich.c
6520 6480
6521IDT VersaClock 5 CLOCK DRIVER
6522M: Marek Vasut <marek.vasut@gmail.com>
6523S: Maintained
6524F: drivers/clk/clk-versaclock5.c
6525
6526IDE SUBSYSTEM 6481IDE SUBSYSTEM
6527M: "David S. Miller" <davem@davemloft.net> 6482M: "David S. Miller" <davem@davemloft.net>
6528L: linux-ide@vger.kernel.org 6483L: linux-ide@vger.kernel.org
@@ -6533,6 +6488,13 @@ F: Documentation/ide/
6533F: drivers/ide/ 6488F: drivers/ide/
6534F: include/linux/ide.h 6489F: include/linux/ide.h
6535 6490
6491IDE/ATAPI DRIVERS
6492M: Borislav Petkov <bp@alien8.de>
6493L: linux-ide@vger.kernel.org
6494S: Maintained
6495F: Documentation/cdrom/ide-cd
6496F: drivers/ide/ide-cd*
6497
6536IDEAPAD LAPTOP EXTRAS DRIVER 6498IDEAPAD LAPTOP EXTRAS DRIVER
6537M: Ike Panhc <ike.pan@canonical.com> 6499M: Ike Panhc <ike.pan@canonical.com>
6538L: platform-driver-x86@vger.kernel.org 6500L: platform-driver-x86@vger.kernel.org
@@ -6547,12 +6509,10 @@ W: https://github.com/o2genum/ideapad-slidebar
6547S: Maintained 6509S: Maintained
6548F: drivers/input/misc/ideapad_slidebar.c 6510F: drivers/input/misc/ideapad_slidebar.c
6549 6511
6550IDE/ATAPI DRIVERS 6512IDT VersaClock 5 CLOCK DRIVER
6551M: Borislav Petkov <bp@alien8.de> 6513M: Marek Vasut <marek.vasut@gmail.com>
6552L: linux-ide@vger.kernel.org
6553S: Maintained 6514S: Maintained
6554F: Documentation/cdrom/ide-cd 6515F: drivers/clk/clk-versaclock5.c
6555F: drivers/ide/ide-cd*
6556 6516
6557IEEE 802.15.4 SUBSYSTEM 6517IEEE 802.15.4 SUBSYSTEM
6558M: Alexander Aring <alex.aring@gmail.com> 6518M: Alexander Aring <alex.aring@gmail.com>
@@ -6642,6 +6602,16 @@ S: Maintained
6642F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt 6602F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
6643F: drivers/auxdisplay/img-ascii-lcd.c 6603F: drivers/auxdisplay/img-ascii-lcd.c
6644 6604
6605IMGTEC IR DECODER DRIVER
6606M: James Hogan <james.hogan@imgtec.com>
6607S: Maintained
6608F: drivers/media/rc/img-ir/
6609
6610IMS TWINTURBO FRAMEBUFFER DRIVER
6611L: linux-fbdev@vger.kernel.org
6612S: Orphan
6613F: drivers/video/fbdev/imsttfb.c
6614
6645INA209 HARDWARE MONITOR DRIVER 6615INA209 HARDWARE MONITOR DRIVER
6646M: Guenter Roeck <linux@roeck-us.net> 6616M: Guenter Roeck <linux@roeck-us.net>
6647L: linux-hwmon@vger.kernel.org 6617L: linux-hwmon@vger.kernel.org
@@ -6667,37 +6637,6 @@ W: http://industrypack.sourceforge.net
6667S: Maintained 6637S: Maintained
6668F: drivers/ipack/ 6638F: drivers/ipack/
6669 6639
6670INGENIC JZ4780 DMA Driver
6671M: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
6672S: Maintained
6673F: drivers/dma/dma-jz4780.c
6674
6675INGENIC JZ4780 NAND DRIVER
6676M: Harvey Hunt <harveyhuntnexus@gmail.com>
6677L: linux-mtd@lists.infradead.org
6678S: Maintained
6679F: drivers/mtd/nand/jz4780_*
6680
6681INTEGRITY MEASUREMENT ARCHITECTURE (IMA)
6682M: Mimi Zohar <zohar@linux.vnet.ibm.com>
6683M: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
6684L: linux-ima-devel@lists.sourceforge.net
6685L: linux-ima-user@lists.sourceforge.net
6686L: linux-security-module@vger.kernel.org
6687T: git git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
6688S: Supported
6689F: security/integrity/ima/
6690
6691IMGTEC IR DECODER DRIVER
6692M: James Hogan <james.hogan@imgtec.com>
6693S: Maintained
6694F: drivers/media/rc/img-ir/
6695
6696IMS TWINTURBO FRAMEBUFFER DRIVER
6697L: linux-fbdev@vger.kernel.org
6698S: Orphan
6699F: drivers/video/fbdev/imsttfb.c
6700
6701INFINIBAND SUBSYSTEM 6640INFINIBAND SUBSYSTEM
6702M: Doug Ledford <dledford@redhat.com> 6641M: Doug Ledford <dledford@redhat.com>
6703M: Sean Hefty <sean.hefty@intel.com> 6642M: Sean Hefty <sean.hefty@intel.com>
@@ -6714,6 +6653,17 @@ F: include/uapi/linux/if_infiniband.h
6714F: include/uapi/rdma/ 6653F: include/uapi/rdma/
6715F: include/rdma/ 6654F: include/rdma/
6716 6655
6656INGENIC JZ4780 DMA Driver
6657M: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
6658S: Maintained
6659F: drivers/dma/dma-jz4780.c
6660
6661INGENIC JZ4780 NAND DRIVER
6662M: Harvey Hunt <harveyhuntnexus@gmail.com>
6663L: linux-mtd@lists.infradead.org
6664S: Maintained
6665F: drivers/mtd/nand/jz4780_*
6666
6717INOTIFY 6667INOTIFY
6718M: John McCutchan <john@johnmccutchan.com> 6668M: John McCutchan <john@johnmccutchan.com>
6719M: Robert Love <rlove@rlove.org> 6669M: Robert Love <rlove@rlove.org>
@@ -6752,6 +6702,22 @@ F: drivers/crypto/inside-secure/
6752S: Maintained 6702S: Maintained
6753L: linux-crypto@vger.kernel.org 6703L: linux-crypto@vger.kernel.org
6754 6704
6705INTEGRITY MEASUREMENT ARCHITECTURE (IMA)
6706M: Mimi Zohar <zohar@linux.vnet.ibm.com>
6707M: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
6708L: linux-ima-devel@lists.sourceforge.net
6709L: linux-ima-user@lists.sourceforge.net
6710L: linux-security-module@vger.kernel.org
6711T: git git://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
6712S: Supported
6713F: security/integrity/ima/
6714
6715INTEL 810/815 FRAMEBUFFER DRIVER
6716M: Antonino Daplas <adaplas@gmail.com>
6717L: linux-fbdev@vger.kernel.org
6718S: Maintained
6719F: drivers/video/fbdev/i810/
6720
6755INTEL ASoC BDW/HSW DRIVERS 6721INTEL ASoC BDW/HSW DRIVERS
6756M: Jie Yang <yang.jie@linux.intel.com> 6722M: Jie Yang <yang.jie@linux.intel.com>
6757L: alsa-devel@alsa-project.org (moderated for non-subscribers) 6723L: alsa-devel@alsa-project.org (moderated for non-subscribers)
@@ -6769,17 +6735,74 @@ T: git git://git.code.sf.net/p/intel-sas/isci
6769S: Supported 6735S: Supported
6770F: drivers/scsi/isci/ 6736F: drivers/scsi/isci/
6771 6737
6738INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
6739M: Daniel Vetter <daniel.vetter@intel.com>
6740M: Jani Nikula <jani.nikula@linux.intel.com>
6741L: intel-gfx@lists.freedesktop.org
6742W: https://01.org/linuxgraphics/
6743B: https://01.org/linuxgraphics/documentation/how-report-bugs
6744C: irc://chat.freenode.net/intel-gfx
6745Q: http://patchwork.freedesktop.org/project/intel-gfx/
6746T: git git://anongit.freedesktop.org/drm-intel
6747S: Supported
6748F: drivers/gpu/drm/i915/
6749F: include/drm/i915*
6750F: include/uapi/drm/i915_drm.h
6751F: Documentation/gpu/i915.rst
6752
6753INTEL ETHERNET DRIVERS
6754M: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
6755L: intel-wired-lan@lists.osuosl.org (moderated for non-subscribers)
6756W: http://www.intel.com/support/feedback.htm
6757W: http://e1000.sourceforge.net/
6758Q: http://patchwork.ozlabs.org/project/intel-wired-lan/list/
6759T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue.git
6760T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git
6761S: Supported
6762F: Documentation/networking/e100.txt
6763F: Documentation/networking/e1000.txt
6764F: Documentation/networking/e1000e.txt
6765F: Documentation/networking/igb.txt
6766F: Documentation/networking/igbvf.txt
6767F: Documentation/networking/ixgb.txt
6768F: Documentation/networking/ixgbe.txt
6769F: Documentation/networking/ixgbevf.txt
6770F: Documentation/networking/i40e.txt
6771F: Documentation/networking/i40evf.txt
6772F: drivers/net/ethernet/intel/
6773F: drivers/net/ethernet/intel/*/
6774F: include/linux/avf/virtchnl.h
6775
6776INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
6777M: Maik Broemme <mbroemme@libmpq.org>
6778L: linux-fbdev@vger.kernel.org
6779S: Maintained
6780F: Documentation/fb/intelfb.txt
6781F: drivers/video/fbdev/intelfb/
6782
6783INTEL GVT-g DRIVERS (Intel GPU Virtualization)
6784M: Zhenyu Wang <zhenyuw@linux.intel.com>
6785M: Zhi Wang <zhi.a.wang@intel.com>
6786L: intel-gvt-dev@lists.freedesktop.org
6787L: intel-gfx@lists.freedesktop.org
6788W: https://01.org/igvt-g
6789T: git https://github.com/01org/gvt-linux.git
6790S: Supported
6791F: drivers/gpu/drm/i915/gvt/
6792
6772INTEL HID EVENT DRIVER 6793INTEL HID EVENT DRIVER
6773M: Alex Hung <alex.hung@canonical.com> 6794M: Alex Hung <alex.hung@canonical.com>
6774L: platform-driver-x86@vger.kernel.org 6795L: platform-driver-x86@vger.kernel.org
6775S: Maintained 6796S: Maintained
6776F: drivers/platform/x86/intel-hid.c 6797F: drivers/platform/x86/intel-hid.c
6777 6798
6778INTEL VIRTUAL BUTTON DRIVER 6799INTEL I/OAT DMA DRIVER
6779M: AceLan Kao <acelan.kao@canonical.com> 6800M: Dave Jiang <dave.jiang@intel.com>
6780L: platform-driver-x86@vger.kernel.org 6801R: Dan Williams <dan.j.williams@intel.com>
6781S: Maintained 6802L: dmaengine@vger.kernel.org
6782F: drivers/platform/x86/intel-vbtn.c 6803Q: https://patchwork.kernel.org/project/linux-dmaengine/list/
6804S: Supported
6805F: drivers/dma/ioat*
6783 6806
6784INTEL IDLE DRIVER 6807INTEL IDLE DRIVER
6785M: Jacob Pan <jacob.jun.pan@linux.intel.com> 6808M: Jacob Pan <jacob.jun.pan@linux.intel.com>
@@ -6797,41 +6820,6 @@ L: linux-input@vger.kernel.org
6797S: Maintained 6820S: Maintained
6798F: drivers/hid/intel-ish-hid/ 6821F: drivers/hid/intel-ish-hid/
6799 6822
6800INTEL PSTATE DRIVER
6801M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
6802M: Len Brown <lenb@kernel.org>
6803L: linux-pm@vger.kernel.org
6804S: Supported
6805F: drivers/cpufreq/intel_pstate.c
6806
6807INTEL FRAMEBUFFER DRIVER (excluding 810 and 815)
6808M: Maik Broemme <mbroemme@libmpq.org>
6809L: linux-fbdev@vger.kernel.org
6810S: Maintained
6811F: Documentation/fb/intelfb.txt
6812F: drivers/video/fbdev/intelfb/
6813
6814INTEL 810/815 FRAMEBUFFER DRIVER
6815M: Antonino Daplas <adaplas@gmail.com>
6816L: linux-fbdev@vger.kernel.org
6817S: Maintained
6818F: drivers/video/fbdev/i810/
6819
6820INTEL MENLOW THERMAL DRIVER
6821M: Sujith Thomas <sujith.thomas@intel.com>
6822L: platform-driver-x86@vger.kernel.org
6823W: https://01.org/linux-acpi
6824S: Supported
6825F: drivers/platform/x86/intel_menlow.c
6826
6827INTEL I/OAT DMA DRIVER
6828M: Dave Jiang <dave.jiang@intel.com>
6829R: Dan Williams <dan.j.williams@intel.com>
6830L: dmaengine@vger.kernel.org
6831Q: https://patchwork.kernel.org/project/linux-dmaengine/list/
6832S: Supported
6833F: drivers/dma/ioat*
6834
6835INTEL IOMMU (VT-d) 6823INTEL IOMMU (VT-d)
6836M: David Woodhouse <dwmw2@infradead.org> 6824M: David Woodhouse <dwmw2@infradead.org>
6837L: iommu@lists.linux-foundation.org 6825L: iommu@lists.linux-foundation.org
@@ -6860,35 +6848,23 @@ M: Deepak Saxena <dsaxena@plexity.net>
6860S: Maintained 6848S: Maintained
6861F: drivers/char/hw_random/ixp4xx-rng.c 6849F: drivers/char/hw_random/ixp4xx-rng.c
6862 6850
6863INTEL ETHERNET DRIVERS 6851INTEL MANAGEMENT ENGINE (mei)
6864M: Jeff Kirsher <jeffrey.t.kirsher@intel.com> 6852M: Tomas Winkler <tomas.winkler@intel.com>
6865L: intel-wired-lan@lists.osuosl.org (moderated for non-subscribers) 6853L: linux-kernel@vger.kernel.org
6866W: http://www.intel.com/support/feedback.htm
6867W: http://e1000.sourceforge.net/
6868Q: http://patchwork.ozlabs.org/project/intel-wired-lan/list/
6869T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-queue.git
6870T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue.git
6871S: Supported 6854S: Supported
6872F: Documentation/networking/e100.txt 6855F: include/uapi/linux/mei.h
6873F: Documentation/networking/e1000.txt 6856F: include/linux/mei_cl_bus.h
6874F: Documentation/networking/e1000e.txt 6857F: drivers/misc/mei/*
6875F: Documentation/networking/igb.txt 6858F: drivers/watchdog/mei_wdt.c
6876F: Documentation/networking/igbvf.txt 6859F: Documentation/misc-devices/mei/*
6877F: Documentation/networking/ixgb.txt 6860F: samples/mei/*
6878F: Documentation/networking/ixgbe.txt
6879F: Documentation/networking/ixgbevf.txt
6880F: Documentation/networking/i40e.txt
6881F: Documentation/networking/i40evf.txt
6882F: drivers/net/ethernet/intel/
6883F: drivers/net/ethernet/intel/*/
6884F: include/linux/avf/virtchnl.h
6885 6861
6886INTEL RDMA RNIC DRIVER 6862INTEL MENLOW THERMAL DRIVER
6887M: Faisal Latif <faisal.latif@intel.com> 6863M: Sujith Thomas <sujith.thomas@intel.com>
6888M: Shiraz Saleem <shiraz.saleem@intel.com> 6864L: platform-driver-x86@vger.kernel.org
6889L: linux-rdma@vger.kernel.org 6865W: https://01.org/linux-acpi
6890S: Supported 6866S: Supported
6891F: drivers/infiniband/hw/i40iw/ 6867F: drivers/platform/x86/intel_menlow.c
6892 6868
6893INTEL MERRIFIELD GPIO DRIVER 6869INTEL MERRIFIELD GPIO DRIVER
6894M: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 6870M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
@@ -6896,11 +6872,38 @@ L: linux-gpio@vger.kernel.org
6896S: Maintained 6872S: Maintained
6897F: drivers/gpio/gpio-merrifield.c 6873F: drivers/gpio/gpio-merrifield.c
6898 6874
6899INTEL-MID GPIO DRIVER 6875INTEL MIC DRIVERS (mic)
6900M: David Cohen <david.a.cohen@linux.intel.com> 6876M: Sudeep Dutt <sudeep.dutt@intel.com>
6901L: linux-gpio@vger.kernel.org 6877M: Ashutosh Dixit <ashutosh.dixit@intel.com>
6878S: Supported
6879W: https://github.com/sudeepdutt/mic
6880W: http://software.intel.com/en-us/mic-developer
6881F: include/linux/mic_bus.h
6882F: include/linux/scif.h
6883F: include/uapi/linux/mic_common.h
6884F: include/uapi/linux/mic_ioctl.h
6885F: include/uapi/linux/scif_ioctl.h
6886F: drivers/misc/mic/
6887F: drivers/dma/mic_x100_dma.c
6888F: drivers/dma/mic_x100_dma.h
6889F: Documentation/mic/
6890
6891INTEL PMC CORE DRIVER
6892M: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
6893M: Vishwanath Somayaji <vishwanath.somayaji@intel.com>
6894L: platform-driver-x86@vger.kernel.org
6902S: Maintained 6895S: Maintained
6903F: drivers/gpio/gpio-intel-mid.c 6896F: arch/x86/include/asm/pmc_core.h
6897F: drivers/platform/x86/intel_pmc_core*
6898
6899INTEL PMC/P-Unit IPC DRIVER
6900M: Zha Qipeng<qipeng.zha@intel.com>
6901L: platform-driver-x86@vger.kernel.org
6902S: Maintained
6903F: drivers/platform/x86/intel_pmc_ipc.c
6904F: drivers/platform/x86/intel_punit_ipc.c
6905F: arch/x86/include/asm/intel_pmc_ipc.h
6906F: arch/x86/include/asm/intel_punit_ipc.h
6904 6907
6905INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT 6908INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
6906M: Stanislav Yakovlev <stas.yakovlev@gmail.com> 6909M: Stanislav Yakovlev <stas.yakovlev@gmail.com>
@@ -6910,31 +6913,32 @@ F: Documentation/networking/README.ipw2100
6910F: Documentation/networking/README.ipw2200 6913F: Documentation/networking/README.ipw2200
6911F: drivers/net/wireless/intel/ipw2x00/ 6914F: drivers/net/wireless/intel/ipw2x00/
6912 6915
6913INTEL(R) TRACE HUB 6916INTEL PSTATE DRIVER
6914M: Alexander Shishkin <alexander.shishkin@linux.intel.com> 6917M: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
6918M: Len Brown <lenb@kernel.org>
6919L: linux-pm@vger.kernel.org
6915S: Supported 6920S: Supported
6916F: Documentation/trace/intel_th.txt 6921F: drivers/cpufreq/intel_pstate.c
6917F: drivers/hwtracing/intel_th/
6918 6922
6919INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) 6923INTEL RDMA RNIC DRIVER
6920M: Ning Sun <ning.sun@intel.com> 6924M: Faisal Latif <faisal.latif@intel.com>
6921L: tboot-devel@lists.sourceforge.net 6925M: Shiraz Saleem <shiraz.saleem@intel.com>
6922W: http://tboot.sourceforge.net 6926L: linux-rdma@vger.kernel.org
6923T: hg http://tboot.hg.sourceforge.net:8000/hgroot/tboot/tboot
6924S: Supported 6927S: Supported
6925F: Documentation/intel_txt.txt 6928F: drivers/infiniband/hw/i40iw/
6926F: include/linux/tboot.h
6927F: arch/x86/kernel/tboot.c
6928 6929
6929INTEL WIRELESS WIMAX CONNECTION 2400 6930INTEL TELEMETRY DRIVER
6930M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> 6931M: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
6931M: linux-wimax@intel.com 6932L: platform-driver-x86@vger.kernel.org
6932L: wimax@linuxwimax.org (subscribers-only) 6933S: Maintained
6933S: Supported 6934F: arch/x86/include/asm/intel_telemetry.h
6934W: http://linuxwimax.org 6935F: drivers/platform/x86/intel_telemetry*
6935F: Documentation/wimax/README.i2400m 6936
6936F: drivers/net/wimax/i2400m/ 6937INTEL VIRTUAL BUTTON DRIVER
6937F: include/uapi/linux/wimax/i2400m.h 6938M: AceLan Kao <acelan.kao@canonical.com>
6939L: platform-driver-x86@vger.kernel.org
6940S: Maintained
6941F: drivers/platform/x86/intel-vbtn.c
6938 6942
6939INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy) 6943INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy)
6940M: Stanislaw Gruszka <sgruszka@redhat.com> 6944M: Stanislaw Gruszka <sgruszka@redhat.com>
@@ -6953,56 +6957,37 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git
6953S: Supported 6957S: Supported
6954F: drivers/net/wireless/intel/iwlwifi/ 6958F: drivers/net/wireless/intel/iwlwifi/
6955 6959
6956INTEL MANAGEMENT ENGINE (mei) 6960INTEL WIRELESS WIMAX CONNECTION 2400
6957M: Tomas Winkler <tomas.winkler@intel.com> 6961M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
6958L: linux-kernel@vger.kernel.org 6962M: linux-wimax@intel.com
6963L: wimax@linuxwimax.org (subscribers-only)
6959S: Supported 6964S: Supported
6960F: include/uapi/linux/mei.h 6965W: http://linuxwimax.org
6961F: include/linux/mei_cl_bus.h 6966F: Documentation/wimax/README.i2400m
6962F: drivers/misc/mei/* 6967F: drivers/net/wimax/i2400m/
6963F: drivers/watchdog/mei_wdt.c 6968F: include/uapi/linux/wimax/i2400m.h
6964F: Documentation/misc-devices/mei/*
6965F: samples/mei/*
6966 6969
6967INTEL MIC DRIVERS (mic) 6970INTEL(R) TRACE HUB
6968M: Sudeep Dutt <sudeep.dutt@intel.com> 6971M: Alexander Shishkin <alexander.shishkin@linux.intel.com>
6969M: Ashutosh Dixit <ashutosh.dixit@intel.com>
6970S: Supported 6972S: Supported
6971W: https://github.com/sudeepdutt/mic 6973F: Documentation/trace/intel_th.txt
6972W: http://software.intel.com/en-us/mic-developer 6974F: drivers/hwtracing/intel_th/
6973F: include/linux/mic_bus.h
6974F: include/linux/scif.h
6975F: include/uapi/linux/mic_common.h
6976F: include/uapi/linux/mic_ioctl.h
6977F: include/uapi/linux/scif_ioctl.h
6978F: drivers/misc/mic/
6979F: drivers/dma/mic_x100_dma.c
6980F: drivers/dma/mic_x100_dma.h
6981F: Documentation/mic/
6982
6983INTEL PMC/P-Unit IPC DRIVER
6984M: Zha Qipeng<qipeng.zha@intel.com>
6985L: platform-driver-x86@vger.kernel.org
6986S: Maintained
6987F: drivers/platform/x86/intel_pmc_ipc.c
6988F: drivers/platform/x86/intel_punit_ipc.c
6989F: arch/x86/include/asm/intel_pmc_ipc.h
6990F: arch/x86/include/asm/intel_punit_ipc.h
6991 6975
6992INTEL TELEMETRY DRIVER 6976INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
6993M: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com> 6977M: Ning Sun <ning.sun@intel.com>
6994L: platform-driver-x86@vger.kernel.org 6978L: tboot-devel@lists.sourceforge.net
6995S: Maintained 6979W: http://tboot.sourceforge.net
6996F: arch/x86/include/asm/intel_telemetry.h 6980T: hg http://tboot.hg.sourceforge.net:8000/hgroot/tboot/tboot
6997F: drivers/platform/x86/intel_telemetry* 6981S: Supported
6982F: Documentation/intel_txt.txt
6983F: include/linux/tboot.h
6984F: arch/x86/kernel/tboot.c
6998 6985
6999INTEL PMC CORE DRIVER 6986INTEL-MID GPIO DRIVER
7000M: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com> 6987M: David Cohen <david.a.cohen@linux.intel.com>
7001M: Vishwanath Somayaji <vishwanath.somayaji@intel.com> 6988L: linux-gpio@vger.kernel.org
7002L: platform-driver-x86@vger.kernel.org
7003S: Maintained 6989S: Maintained
7004F: arch/x86/include/asm/pmc_core.h 6990F: drivers/gpio/gpio-intel-mid.c
7005F: drivers/platform/x86/intel_pmc_core*
7006 6991
7007INVENSENSE MPU-3050 GYROSCOPE DRIVER 6992INVENSENSE MPU-3050 GYROSCOPE DRIVER
7008M: Linus Walleij <linus.walleij@linaro.org> 6993M: Linus Walleij <linus.walleij@linaro.org>
@@ -7048,13 +7033,6 @@ F: drivers/char/ipmi/
7048F: include/linux/ipmi* 7033F: include/linux/ipmi*
7049F: include/uapi/linux/ipmi* 7034F: include/uapi/linux/ipmi*
7050 7035
7051QCOM AUDIO (ASoC) DRIVERS
7052M: Patrick Lai <plai@codeaurora.org>
7053M: Banajit Goswami <bgoswami@codeaurora.org>
7054L: alsa-devel@alsa-project.org (moderated for non-subscribers)
7055S: Supported
7056F: sound/soc/qcom/
7057
7058IPS SCSI RAID DRIVER 7036IPS SCSI RAID DRIVER
7059M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> 7037M: Adaptec OEM Raid Solutions <aacraid@adaptec.com>
7060L: linux-scsi@vger.kernel.org 7038L: linux-scsi@vger.kernel.org
@@ -7101,6 +7079,15 @@ F: drivers/net/irda/
7101F: include/net/irda/ 7079F: include/net/irda/
7102F: net/irda/ 7080F: net/irda/
7103 7081
7082IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
7083M: Marc Zyngier <marc.zyngier@arm.com>
7084S: Maintained
7085T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
7086F: Documentation/IRQ-domain.txt
7087F: include/linux/irqdomain.h
7088F: kernel/irq/irqdomain.c
7089F: kernel/irq/msi.c
7090
7104IRQ SUBSYSTEM 7091IRQ SUBSYSTEM
7105M: Thomas Gleixner <tglx@linutronix.de> 7092M: Thomas Gleixner <tglx@linutronix.de>
7106L: linux-kernel@vger.kernel.org 7093L: linux-kernel@vger.kernel.org
@@ -7119,15 +7106,6 @@ T: git git://git.infradead.org/users/jcooper/linux.git irqchip/core
7119F: Documentation/devicetree/bindings/interrupt-controller/ 7106F: Documentation/devicetree/bindings/interrupt-controller/
7120F: drivers/irqchip/ 7107F: drivers/irqchip/
7121 7108
7122IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
7123M: Marc Zyngier <marc.zyngier@arm.com>
7124S: Maintained
7125T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
7126F: Documentation/IRQ-domain.txt
7127F: include/linux/irqdomain.h
7128F: kernel/irq/irqdomain.c
7129F: kernel/irq/msi.c
7130
7131ISA 7109ISA
7132M: William Breathitt Gray <vilhelm.gray@gmail.com> 7110M: William Breathitt Gray <vilhelm.gray@gmail.com>
7133S: Maintained 7111S: Maintained
@@ -7135,13 +7113,6 @@ F: Documentation/isa.txt
7135F: drivers/base/isa.c 7113F: drivers/base/isa.c
7136F: include/linux/isa.h 7114F: include/linux/isa.h
7137 7115
7138ISAPNP
7139M: Jaroslav Kysela <perex@perex.cz>
7140S: Maintained
7141F: Documentation/isapnp.txt
7142F: drivers/pnp/isapnp/
7143F: include/linux/isapnp.h
7144
7145ISA RADIO MODULE 7116ISA RADIO MODULE
7146M: Hans Verkuil <hverkuil@xs4all.nl> 7117M: Hans Verkuil <hverkuil@xs4all.nl>
7147L: linux-media@vger.kernel.org 7118L: linux-media@vger.kernel.org
@@ -7150,11 +7121,12 @@ W: https://linuxtv.org
7150S: Maintained 7121S: Maintained
7151F: drivers/media/radio/radio-isa* 7122F: drivers/media/radio/radio-isa*
7152 7123
7153iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER 7124ISAPNP
7154M: Peter Jones <pjones@redhat.com> 7125M: Jaroslav Kysela <perex@perex.cz>
7155M: Konrad Rzeszutek Wilk <konrad@kernel.org>
7156S: Maintained 7126S: Maintained
7157F: drivers/firmware/iscsi_ibft* 7127F: Documentation/isapnp.txt
7128F: drivers/pnp/isapnp/
7129F: include/linux/isapnp.h
7158 7130
7159ISCSI 7131ISCSI
7160M: Lee Duncan <lduncan@suse.com> 7132M: Lee Duncan <lduncan@suse.com>
@@ -7165,6 +7137,12 @@ S: Maintained
7165F: drivers/scsi/*iscsi* 7137F: drivers/scsi/*iscsi*
7166F: include/scsi/*iscsi* 7138F: include/scsi/*iscsi*
7167 7139
7140iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER
7141M: Peter Jones <pjones@redhat.com>
7142M: Konrad Rzeszutek Wilk <konrad@kernel.org>
7143S: Maintained
7144F: drivers/firmware/iscsi_ibft*
7145
7168ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR 7146ISCSI EXTENSIONS FOR RDMA (ISER) INITIATOR
7169M: Or Gerlitz <ogerlitz@mellanox.com> 7147M: Or Gerlitz <ogerlitz@mellanox.com>
7170M: Sagi Grimberg <sagi@grimberg.me> 7148M: Sagi Grimberg <sagi@grimberg.me>
@@ -7420,27 +7398,6 @@ S: Maintained
7420F: arch/x86/include/asm/svm.h 7398F: arch/x86/include/asm/svm.h
7421F: arch/x86/kvm/svm.c 7399F: arch/x86/kvm/svm.c
7422 7400
7423KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC
7424M: Alexander Graf <agraf@suse.com>
7425L: kvm-ppc@vger.kernel.org
7426W: http://www.linux-kvm.org/
7427T: git git://github.com/agraf/linux-2.6.git
7428S: Supported
7429F: arch/powerpc/include/asm/kvm*
7430F: arch/powerpc/kvm/
7431
7432KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
7433M: Christian Borntraeger <borntraeger@de.ibm.com>
7434M: Cornelia Huck <cohuck@redhat.com>
7435L: linux-s390@vger.kernel.org
7436W: http://www.ibm.com/developerworks/linux/linux390/
7437T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
7438S: Supported
7439F: Documentation/s390/kvm.txt
7440F: arch/s390/include/asm/kvm*
7441F: arch/s390/kvm/
7442F: arch/s390/mm/gmap.c
7443
7444KERNEL VIRTUAL MACHINE (KVM) FOR ARM 7401KERNEL VIRTUAL MACHINE (KVM) FOR ARM
7445M: Christoffer Dall <christoffer.dall@linaro.org> 7402M: Christoffer Dall <christoffer.dall@linaro.org>
7446M: Marc Zyngier <marc.zyngier@arm.com> 7403M: Marc Zyngier <marc.zyngier@arm.com>
@@ -7455,6 +7412,15 @@ F: arch/arm/kvm/
7455F: virt/kvm/arm/ 7412F: virt/kvm/arm/
7456F: include/kvm/arm_* 7413F: include/kvm/arm_*
7457 7414
7415KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC
7416M: Alexander Graf <agraf@suse.com>
7417L: kvm-ppc@vger.kernel.org
7418W: http://www.linux-kvm.org/
7419T: git git://github.com/agraf/linux-2.6.git
7420S: Supported
7421F: arch/powerpc/include/asm/kvm*
7422F: arch/powerpc/kvm/
7423
7458KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64) 7424KERNEL VIRTUAL MACHINE FOR ARM64 (KVM/arm64)
7459M: Christoffer Dall <christoffer.dall@linaro.org> 7425M: Christoffer Dall <christoffer.dall@linaro.org>
7460M: Marc Zyngier <marc.zyngier@arm.com> 7426M: Marc Zyngier <marc.zyngier@arm.com>
@@ -7473,6 +7439,18 @@ F: arch/mips/include/uapi/asm/kvm*
7473F: arch/mips/include/asm/kvm* 7439F: arch/mips/include/asm/kvm*
7474F: arch/mips/kvm/ 7440F: arch/mips/kvm/
7475 7441
7442KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
7443M: Christian Borntraeger <borntraeger@de.ibm.com>
7444M: Cornelia Huck <cohuck@redhat.com>
7445L: linux-s390@vger.kernel.org
7446W: http://www.ibm.com/developerworks/linux/linux390/
7447T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
7448S: Supported
7449F: Documentation/s390/kvm.txt
7450F: arch/s390/include/asm/kvm*
7451F: arch/s390/kvm/
7452F: arch/s390/mm/gmap.c
7453
7476KERNFS 7454KERNFS
7477M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 7455M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7478M: Tejun Heo <tj@kernel.org> 7456M: Tejun Heo <tj@kernel.org>
@@ -7490,17 +7468,15 @@ F: include/linux/kexec.h
7490F: include/uapi/linux/kexec.h 7468F: include/uapi/linux/kexec.h
7491F: kernel/kexec* 7469F: kernel/kexec*
7492 7470
7493KEYS/KEYRINGS: 7471KEYS-ENCRYPTED
7494M: David Howells <dhowells@redhat.com> 7472M: Mimi Zohar <zohar@linux.vnet.ibm.com>
7473M: David Safford <safford@us.ibm.com>
7474L: linux-security-module@vger.kernel.org
7495L: keyrings@vger.kernel.org 7475L: keyrings@vger.kernel.org
7496S: Maintained 7476S: Supported
7497F: Documentation/security/keys/core.rst 7477F: Documentation/security/keys/trusted-encrypted.rst
7498F: include/linux/key.h 7478F: include/keys/encrypted-type.h
7499F: include/linux/key-type.h 7479F: security/keys/encrypted-keys/
7500F: include/linux/keyctl.h
7501F: include/uapi/linux/keyctl.h
7502F: include/keys/
7503F: security/keys/
7504 7480
7505KEYS-TRUSTED 7481KEYS-TRUSTED
7506M: David Safford <safford@us.ibm.com> 7482M: David Safford <safford@us.ibm.com>
@@ -7513,15 +7489,17 @@ F: include/keys/trusted-type.h
7513F: security/keys/trusted.c 7489F: security/keys/trusted.c
7514F: security/keys/trusted.h 7490F: security/keys/trusted.h
7515 7491
7516KEYS-ENCRYPTED 7492KEYS/KEYRINGS:
7517M: Mimi Zohar <zohar@linux.vnet.ibm.com> 7493M: David Howells <dhowells@redhat.com>
7518M: David Safford <safford@us.ibm.com>
7519L: linux-security-module@vger.kernel.org
7520L: keyrings@vger.kernel.org 7494L: keyrings@vger.kernel.org
7521S: Supported 7495S: Maintained
7522F: Documentation/security/keys/trusted-encrypted.rst 7496F: Documentation/security/keys/core.rst
7523F: include/keys/encrypted-type.h 7497F: include/linux/key.h
7524F: security/keys/encrypted-keys/ 7498F: include/linux/key-type.h
7499F: include/linux/keyctl.h
7500F: include/uapi/linux/keyctl.h
7501F: include/keys/
7502F: security/keys/
7525 7503
7526KGDB / KDB /debug_core 7504KGDB / KDB /debug_core
7527M: Jason Wessel <jason.wessel@windriver.com> 7505M: Jason Wessel <jason.wessel@windriver.com>
@@ -7665,16 +7643,6 @@ F: drivers/lguest/
7665F: include/linux/lguest*.h 7643F: include/linux/lguest*.h
7666F: tools/lguest/ 7644F: tools/lguest/
7667 7645
7668LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)
7669M: Tejun Heo <tj@kernel.org>
7670L: linux-ide@vger.kernel.org
7671T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git
7672S: Maintained
7673F: drivers/ata/
7674F: include/linux/ata.h
7675F: include/linux/libata.h
7676F: Documentation/devicetree/bindings/ata/
7677
7678LIBATA PATA ARASAN COMPACT FLASH CONTROLLER 7646LIBATA PATA ARASAN COMPACT FLASH CONTROLLER
7679M: Viresh Kumar <vireshk@kernel.org> 7647M: Viresh Kumar <vireshk@kernel.org>
7680L: linux-ide@vger.kernel.org 7648L: linux-ide@vger.kernel.org
@@ -7718,22 +7686,21 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git
7718S: Maintained 7686S: Maintained
7719F: drivers/ata/sata_promise.* 7687F: drivers/ata/sata_promise.*
7720 7688
7689LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)
7690M: Tejun Heo <tj@kernel.org>
7691L: linux-ide@vger.kernel.org
7692T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata.git
7693S: Maintained
7694F: drivers/ata/
7695F: include/linux/ata.h
7696F: include/linux/libata.h
7697F: Documentation/devicetree/bindings/ata/
7698
7721LIBLOCKDEP 7699LIBLOCKDEP
7722M: Sasha Levin <alexander.levin@verizon.com> 7700M: Sasha Levin <alexander.levin@verizon.com>
7723S: Maintained 7701S: Maintained
7724F: tools/lib/lockdep/ 7702F: tools/lib/lockdep/
7725 7703
7726LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
7727M: Dan Williams <dan.j.williams@intel.com>
7728L: linux-nvdimm@lists.01.org
7729Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
7730T: git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
7731S: Supported
7732F: drivers/nvdimm/*
7733F: include/linux/nd.h
7734F: include/linux/libnvdimm.h
7735F: include/uapi/linux/ndctl.h
7736
7737LIBNVDIMM BLK: MMIO-APERTURE DRIVER 7704LIBNVDIMM BLK: MMIO-APERTURE DRIVER
7738M: Ross Zwisler <ross.zwisler@linux.intel.com> 7705M: Ross Zwisler <ross.zwisler@linux.intel.com>
7739L: linux-nvdimm@lists.01.org 7706L: linux-nvdimm@lists.01.org
@@ -7741,7 +7708,6 @@ Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
7741S: Supported 7708S: Supported
7742F: drivers/nvdimm/blk.c 7709F: drivers/nvdimm/blk.c
7743F: drivers/nvdimm/region_devs.c 7710F: drivers/nvdimm/region_devs.c
7744F: drivers/acpi/nfit*
7745 7711
7746LIBNVDIMM BTT: BLOCK TRANSLATION TABLE 7712LIBNVDIMM BTT: BLOCK TRANSLATION TABLE
7747M: Vishal Verma <vishal.l.verma@intel.com> 7713M: Vishal Verma <vishal.l.verma@intel.com>
@@ -7757,6 +7723,18 @@ Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
7757S: Supported 7723S: Supported
7758F: drivers/nvdimm/pmem* 7724F: drivers/nvdimm/pmem*
7759 7725
7726LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
7727M: Dan Williams <dan.j.williams@intel.com>
7728L: linux-nvdimm@lists.01.org
7729Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
7730T: git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
7731S: Supported
7732F: drivers/nvdimm/*
7733F: drivers/acpi/nfit/*
7734F: include/linux/nd.h
7735F: include/linux/libnvdimm.h
7736F: include/uapi/linux/ndctl.h
7737
7760LIGHTNVM PLATFORM SUPPORT 7738LIGHTNVM PLATFORM SUPPORT
7761M: Matias Bjorling <mb@lightnvm.io> 7739M: Matias Bjorling <mb@lightnvm.io>
7762W: http://github/OpenChannelSSD 7740W: http://github/OpenChannelSSD
@@ -7766,6 +7744,14 @@ F: drivers/lightnvm/
7766F: include/linux/lightnvm.h 7744F: include/linux/lightnvm.h
7767F: include/uapi/linux/lightnvm.h 7745F: include/uapi/linux/lightnvm.h
7768 7746
7747LINUX FOR POWER MACINTOSH
7748M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7749W: http://www.penguinppc.org/
7750L: linuxppc-dev@lists.ozlabs.org
7751S: Maintained
7752F: arch/powerpc/platforms/powermac/
7753F: drivers/macintosh/
7754
7769LINUX FOR POWERPC (32-BIT AND 64-BIT) 7755LINUX FOR POWERPC (32-BIT AND 64-BIT)
7770M: Benjamin Herrenschmidt <benh@kernel.crashing.org> 7756M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7771M: Paul Mackerras <paulus@samba.org> 7757M: Paul Mackerras <paulus@samba.org>
@@ -7799,14 +7785,6 @@ N: powernv
7799N: [^a-z0-9]ps3 7785N: [^a-z0-9]ps3
7800N: pseries 7786N: pseries
7801 7787
7802LINUX FOR POWER MACINTOSH
7803M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
7804W: http://www.penguinppc.org/
7805L: linuxppc-dev@lists.ozlabs.org
7806S: Maintained
7807F: arch/powerpc/platforms/powermac/
7808F: drivers/macintosh/
7809
7810LINUX FOR POWERPC EMBEDDED MPC5XXX 7788LINUX FOR POWERPC EMBEDDED MPC5XXX
7811M: Anatolij Gustschin <agust@denx.de> 7789M: Anatolij Gustschin <agust@denx.de>
7812L: linuxppc-dev@lists.ozlabs.org 7790L: linuxppc-dev@lists.ozlabs.org
@@ -7824,19 +7802,6 @@ S: Maintained
7824F: arch/powerpc/platforms/40x/ 7802F: arch/powerpc/platforms/40x/
7825F: arch/powerpc/platforms/44x/ 7803F: arch/powerpc/platforms/44x/
7826 7804
7827LINUX FOR POWERPC EMBEDDED XILINX VIRTEX
7828L: linuxppc-dev@lists.ozlabs.org
7829S: Orphan
7830F: arch/powerpc/*/*virtex*
7831F: arch/powerpc/*/*/*virtex*
7832
7833LINUX FOR POWERPC EMBEDDED PPC8XX
7834M: Vitaly Bordug <vitb@kernel.crashing.org>
7835W: http://www.penguinppc.org/
7836L: linuxppc-dev@lists.ozlabs.org
7837S: Maintained
7838F: arch/powerpc/platforms/8xx/
7839
7840LINUX FOR POWERPC EMBEDDED PPC83XX AND PPC85XX 7805LINUX FOR POWERPC EMBEDDED PPC83XX AND PPC85XX
7841M: Scott Wood <oss@buserror.net> 7806M: Scott Wood <oss@buserror.net>
7842M: Kumar Gala <galak@kernel.crashing.org> 7807M: Kumar Gala <galak@kernel.crashing.org>
@@ -7848,6 +7813,19 @@ F: arch/powerpc/platforms/83xx/
7848F: arch/powerpc/platforms/85xx/ 7813F: arch/powerpc/platforms/85xx/
7849F: Documentation/devicetree/bindings/powerpc/fsl/ 7814F: Documentation/devicetree/bindings/powerpc/fsl/
7850 7815
7816LINUX FOR POWERPC EMBEDDED PPC8XX
7817M: Vitaly Bordug <vitb@kernel.crashing.org>
7818W: http://www.penguinppc.org/
7819L: linuxppc-dev@lists.ozlabs.org
7820S: Maintained
7821F: arch/powerpc/platforms/8xx/
7822
7823LINUX FOR POWERPC EMBEDDED XILINX VIRTEX
7824L: linuxppc-dev@lists.ozlabs.org
7825S: Orphan
7826F: arch/powerpc/*/*virtex*
7827F: arch/powerpc/*/*/*virtex*
7828
7851LINUX FOR POWERPC PA SEMI PWRFICIENT 7829LINUX FOR POWERPC PA SEMI PWRFICIENT
7852L: linuxppc-dev@lists.ozlabs.org 7830L: linuxppc-dev@lists.ozlabs.org
7853S: Orphan 7831S: Orphan
@@ -7855,6 +7833,11 @@ F: arch/powerpc/platforms/pasemi/
7855F: drivers/*/*pasemi* 7833F: drivers/*/*pasemi*
7856F: drivers/*/*/*pasemi* 7834F: drivers/*/*/*pasemi*
7857 7835
7836LINUX KERNEL DUMP TEST MODULE (LKDTM)
7837M: Kees Cook <keescook@chromium.org>
7838S: Maintained
7839F: drivers/misc/lkdtm*
7840
7858LINUX SECURITY MODULE (LSM) FRAMEWORK 7841LINUX SECURITY MODULE (LSM) FRAMEWORK
7859M: Chris Wright <chrisw@sous-sol.org> 7842M: Chris Wright <chrisw@sous-sol.org>
7860L: linux-security-module@vger.kernel.org 7843L: linux-security-module@vger.kernel.org
@@ -7884,11 +7867,6 @@ F: samples/livepatch/
7884L: live-patching@vger.kernel.org 7867L: live-patching@vger.kernel.org
7885T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching.git 7868T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching.git
7886 7869
7887LINUX KERNEL DUMP TEST MODULE (LKDTM)
7888M: Kees Cook <keescook@chromium.org>
7889S: Maintained
7890F: drivers/misc/lkdtm*
7891
7892LLC (802.2) 7870LLC (802.2)
7893L: netdev@vger.kernel.org 7871L: netdev@vger.kernel.org
7894S: Odd fixes 7872S: Odd fixes
@@ -7941,6 +7919,13 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/
7941S: Maintained 7919S: Maintained
7942F: drivers/media/usb/dvb-usb-v2/lmedm04* 7920F: drivers/media/usb/dvb-usb-v2/lmedm04*
7943 7921
7922LOADPIN SECURITY MODULE
7923M: Kees Cook <keescook@chromium.org>
7924T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git lsm/loadpin
7925S: Supported
7926F: security/loadpin/
7927F: Documentation/admin-guide/LSM/LoadPin.rst
7928
7944LOCKING PRIMITIVES 7929LOCKING PRIMITIVES
7945M: Peter Zijlstra <peterz@infradead.org> 7930M: Peter Zijlstra <peterz@infradead.org>
7946M: Ingo Molnar <mingo@redhat.com> 7931M: Ingo Molnar <mingo@redhat.com>
@@ -8231,14 +8216,6 @@ S: Maintained
8231F: Documentation/devicetree/bindings/sound/max9860.txt 8216F: Documentation/devicetree/bindings/sound/max9860.txt
8232F: sound/soc/codecs/max9860.* 8217F: sound/soc/codecs/max9860.*
8233 8218
8234MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS
8235M: Krzysztof Kozlowski <krzk@kernel.org>
8236M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
8237L: linux-pm@vger.kernel.org
8238S: Supported
8239F: drivers/power/supply/max14577_charger.c
8240F: drivers/power/supply/max77693_charger.c
8241
8242MAXIM MAX77802 PMIC REGULATOR DEVICE DRIVER 8219MAXIM MAX77802 PMIC REGULATOR DEVICE DRIVER
8243M: Javier Martinez Canillas <javier@dowhile0.org> 8220M: Javier Martinez Canillas <javier@dowhile0.org>
8244L: linux-kernel@vger.kernel.org 8221L: linux-kernel@vger.kernel.org
@@ -8247,6 +8224,14 @@ F: drivers/regulator/max77802-regulator.c
8247F: Documentation/devicetree/bindings/*/*max77802.txt 8224F: Documentation/devicetree/bindings/*/*max77802.txt
8248F: include/dt-bindings/*/*max77802.h 8225F: include/dt-bindings/*/*max77802.h
8249 8226
8227MAXIM MUIC CHARGER DRIVERS FOR EXYNOS BASED BOARDS
8228M: Krzysztof Kozlowski <krzk@kernel.org>
8229M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
8230L: linux-pm@vger.kernel.org
8231S: Supported
8232F: drivers/power/supply/max14577_charger.c
8233F: drivers/power/supply/max77693_charger.c
8234
8250MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS 8235MAXIM PMIC AND MUIC DRIVERS FOR EXYNOS BASED BOARDS
8251M: Chanwoo Choi <cw00.choi@samsung.com> 8236M: Chanwoo Choi <cw00.choi@samsung.com>
8252M: Krzysztof Kozlowski <krzk@kernel.org> 8237M: Krzysztof Kozlowski <krzk@kernel.org>
@@ -8289,14 +8274,25 @@ L: linux-iio@vger.kernel.org
8289S: Maintained 8274S: Maintained
8290F: drivers/iio/dac/cio-dac.c 8275F: drivers/iio/dac/cio-dac.c
8291 8276
8292MEDIA DRIVERS FOR RENESAS - DRIF 8277MEDIA DRIVERS FOR ASCOT2E
8293M: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com> 8278M: Sergey Kozlov <serjk@netup.ru>
8279M: Abylay Ospan <aospan@netup.ru>
8294L: linux-media@vger.kernel.org 8280L: linux-media@vger.kernel.org
8295L: linux-renesas-soc@vger.kernel.org 8281W: https://linuxtv.org
8282W: http://netup.tv/
8296T: git git://linuxtv.org/media_tree.git 8283T: git git://linuxtv.org/media_tree.git
8297S: Supported 8284S: Supported
8298F: Documentation/devicetree/bindings/media/renesas,drif.txt 8285F: drivers/media/dvb-frontends/ascot2e*
8299F: drivers/media/platform/rcar_drif.c 8286
8287MEDIA DRIVERS FOR CXD2841ER
8288M: Sergey Kozlov <serjk@netup.ru>
8289M: Abylay Ospan <aospan@netup.ru>
8290L: linux-media@vger.kernel.org
8291W: https://linuxtv.org
8292W: http://netup.tv/
8293T: git git://linuxtv.org/media_tree.git
8294S: Supported
8295F: drivers/media/dvb-frontends/cxd2841er*
8300 8296
8301MEDIA DRIVERS FOR FREESCALE IMX 8297MEDIA DRIVERS FOR FREESCALE IMX
8302M: Steve Longerbeam <slongerbeam@gmail.com> 8298M: Steve Longerbeam <slongerbeam@gmail.com>
@@ -8310,43 +8306,6 @@ F: drivers/staging/media/imx/
8310F: include/linux/imx-media.h 8306F: include/linux/imx-media.h
8311F: include/media/imx.h 8307F: include/media/imx.h
8312 8308
8313MEDIA DRIVERS FOR RENESAS - FCP
8314M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8315L: linux-media@vger.kernel.org
8316L: linux-renesas-soc@vger.kernel.org
8317T: git git://linuxtv.org/media_tree.git
8318S: Supported
8319F: Documentation/devicetree/bindings/media/renesas,fcp.txt
8320F: drivers/media/platform/rcar-fcp.c
8321F: include/media/rcar-fcp.h
8322
8323MEDIA DRIVERS FOR RENESAS - FDP1
8324M: Kieran Bingham <kieran@bingham.xyz>
8325L: linux-media@vger.kernel.org
8326L: linux-renesas-soc@vger.kernel.org
8327T: git git://linuxtv.org/media_tree.git
8328S: Supported
8329F: Documentation/devicetree/bindings/media/renesas,fdp1.txt
8330F: drivers/media/platform/rcar_fdp1.c
8331
8332MEDIA DRIVERS FOR RENESAS - VIN
8333M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
8334L: linux-media@vger.kernel.org
8335L: linux-renesas-soc@vger.kernel.org
8336T: git git://linuxtv.org/media_tree.git
8337S: Supported
8338F: Documentation/devicetree/bindings/media/rcar_vin.txt
8339F: drivers/media/platform/rcar-vin/
8340
8341MEDIA DRIVERS FOR RENESAS - VSP1
8342M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8343L: linux-media@vger.kernel.org
8344L: linux-renesas-soc@vger.kernel.org
8345T: git git://linuxtv.org/media_tree.git
8346S: Supported
8347F: Documentation/devicetree/bindings/media/renesas,vsp1.txt
8348F: drivers/media/platform/vsp1/
8349
8350MEDIA DRIVERS FOR HELENE 8309MEDIA DRIVERS FOR HELENE
8351M: Abylay Ospan <aospan@netup.ru> 8310M: Abylay Ospan <aospan@netup.ru>
8352L: linux-media@vger.kernel.org 8311L: linux-media@vger.kernel.org
@@ -8356,7 +8315,7 @@ T: git git://linuxtv.org/media_tree.git
8356S: Supported 8315S: Supported
8357F: drivers/media/dvb-frontends/helene* 8316F: drivers/media/dvb-frontends/helene*
8358 8317
8359MEDIA DRIVERS FOR ASCOT2E 8318MEDIA DRIVERS FOR HORUS3A
8360M: Sergey Kozlov <serjk@netup.ru> 8319M: Sergey Kozlov <serjk@netup.ru>
8361M: Abylay Ospan <aospan@netup.ru> 8320M: Abylay Ospan <aospan@netup.ru>
8362L: linux-media@vger.kernel.org 8321L: linux-media@vger.kernel.org
@@ -8364,9 +8323,9 @@ W: https://linuxtv.org
8364W: http://netup.tv/ 8323W: http://netup.tv/
8365T: git git://linuxtv.org/media_tree.git 8324T: git git://linuxtv.org/media_tree.git
8366S: Supported 8325S: Supported
8367F: drivers/media/dvb-frontends/ascot2e* 8326F: drivers/media/dvb-frontends/horus3a*
8368 8327
8369MEDIA DRIVERS FOR CXD2841ER 8328MEDIA DRIVERS FOR LNBH25
8370M: Sergey Kozlov <serjk@netup.ru> 8329M: Sergey Kozlov <serjk@netup.ru>
8371M: Abylay Ospan <aospan@netup.ru> 8330M: Abylay Ospan <aospan@netup.ru>
8372L: linux-media@vger.kernel.org 8331L: linux-media@vger.kernel.org
@@ -8374,9 +8333,9 @@ W: https://linuxtv.org
8374W: http://netup.tv/ 8333W: http://netup.tv/
8375T: git git://linuxtv.org/media_tree.git 8334T: git git://linuxtv.org/media_tree.git
8376S: Supported 8335S: Supported
8377F: drivers/media/dvb-frontends/cxd2841er* 8336F: drivers/media/dvb-frontends/lnbh25*
8378 8337
8379MEDIA DRIVERS FOR HORUS3A 8338MEDIA DRIVERS FOR NETUP PCI UNIVERSAL DVB devices
8380M: Sergey Kozlov <serjk@netup.ru> 8339M: Sergey Kozlov <serjk@netup.ru>
8381M: Abylay Ospan <aospan@netup.ru> 8340M: Abylay Ospan <aospan@netup.ru>
8382L: linux-media@vger.kernel.org 8341L: linux-media@vger.kernel.org
@@ -8384,27 +8343,53 @@ W: https://linuxtv.org
8384W: http://netup.tv/ 8343W: http://netup.tv/
8385T: git git://linuxtv.org/media_tree.git 8344T: git git://linuxtv.org/media_tree.git
8386S: Supported 8345S: Supported
8387F: drivers/media/dvb-frontends/horus3a* 8346F: drivers/media/pci/netup_unidvb/*
8388 8347
8389MEDIA DRIVERS FOR LNBH25 8348MEDIA DRIVERS FOR RENESAS - DRIF
8390M: Sergey Kozlov <serjk@netup.ru> 8349M: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
8391M: Abylay Ospan <aospan@netup.ru>
8392L: linux-media@vger.kernel.org 8350L: linux-media@vger.kernel.org
8393W: https://linuxtv.org 8351L: linux-renesas-soc@vger.kernel.org
8394W: http://netup.tv/
8395T: git git://linuxtv.org/media_tree.git 8352T: git git://linuxtv.org/media_tree.git
8396S: Supported 8353S: Supported
8397F: drivers/media/dvb-frontends/lnbh25* 8354F: Documentation/devicetree/bindings/media/renesas,drif.txt
8355F: drivers/media/platform/rcar_drif.c
8398 8356
8399MEDIA DRIVERS FOR NETUP PCI UNIVERSAL DVB devices 8357MEDIA DRIVERS FOR RENESAS - FCP
8400M: Sergey Kozlov <serjk@netup.ru> 8358M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8401M: Abylay Ospan <aospan@netup.ru>
8402L: linux-media@vger.kernel.org 8359L: linux-media@vger.kernel.org
8403W: https://linuxtv.org 8360L: linux-renesas-soc@vger.kernel.org
8404W: http://netup.tv/
8405T: git git://linuxtv.org/media_tree.git 8361T: git git://linuxtv.org/media_tree.git
8406S: Supported 8362S: Supported
8407F: drivers/media/pci/netup_unidvb/* 8363F: Documentation/devicetree/bindings/media/renesas,fcp.txt
8364F: drivers/media/platform/rcar-fcp.c
8365F: include/media/rcar-fcp.h
8366
8367MEDIA DRIVERS FOR RENESAS - FDP1
8368M: Kieran Bingham <kieran@bingham.xyz>
8369L: linux-media@vger.kernel.org
8370L: linux-renesas-soc@vger.kernel.org
8371T: git git://linuxtv.org/media_tree.git
8372S: Supported
8373F: Documentation/devicetree/bindings/media/renesas,fdp1.txt
8374F: drivers/media/platform/rcar_fdp1.c
8375
8376MEDIA DRIVERS FOR RENESAS - VIN
8377M: Niklas Söderlund <niklas.soderlund@ragnatech.se>
8378L: linux-media@vger.kernel.org
8379L: linux-renesas-soc@vger.kernel.org
8380T: git git://linuxtv.org/media_tree.git
8381S: Supported
8382F: Documentation/devicetree/bindings/media/rcar_vin.txt
8383F: drivers/media/platform/rcar-vin/
8384
8385MEDIA DRIVERS FOR RENESAS - VSP1
8386M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8387L: linux-media@vger.kernel.org
8388L: linux-renesas-soc@vger.kernel.org
8389T: git git://linuxtv.org/media_tree.git
8390S: Supported
8391F: Documentation/devicetree/bindings/media/renesas,vsp1.txt
8392F: drivers/media/platform/vsp1/
8408 8393
8409MEDIA INPUT INFRASTRUCTURE (V4L/DVB) 8394MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
8410M: Mauro Carvalho Chehab <mchehab@s-opensource.com> 8395M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
@@ -8443,15 +8428,6 @@ S: Supported
8443F: drivers/media/platform/mtk-jpeg/ 8428F: drivers/media/platform/mtk-jpeg/
8444F: Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.txt 8429F: Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.txt
8445 8430
8446MEDIATEK MEDIA DRIVER
8447M: Tiffany Lin <tiffany.lin@mediatek.com>
8448M: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
8449S: Supported
8450F: drivers/media/platform/mtk-vcodec/
8451F: drivers/media/platform/mtk-vpu/
8452F: Documentation/devicetree/bindings/media/mediatek-vcodec.txt
8453F: Documentation/devicetree/bindings/media/mediatek-vpu.txt
8454
8455MEDIATEK MDP DRIVER 8431MEDIATEK MDP DRIVER
8456M: Minghsiu Tsai <minghsiu.tsai@mediatek.com> 8432M: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
8457M: Houlong Wei <houlong.wei@mediatek.com> 8433M: Houlong Wei <houlong.wei@mediatek.com>
@@ -8461,6 +8437,15 @@ F: drivers/media/platform/mtk-mdp/
8461F: drivers/media/platform/mtk-vpu/ 8437F: drivers/media/platform/mtk-vpu/
8462F: Documentation/devicetree/bindings/media/mediatek-mdp.txt 8438F: Documentation/devicetree/bindings/media/mediatek-mdp.txt
8463 8439
8440MEDIATEK MEDIA DRIVER
8441M: Tiffany Lin <tiffany.lin@mediatek.com>
8442M: Andrew-CT Chen <andrew-ct.chen@mediatek.com>
8443S: Supported
8444F: drivers/media/platform/mtk-vcodec/
8445F: drivers/media/platform/mtk-vpu/
8446F: Documentation/devicetree/bindings/media/mediatek-vcodec.txt
8447F: Documentation/devicetree/bindings/media/mediatek-vpu.txt
8448
8464MEDIATEK MT7601U WIRELESS LAN DRIVER 8449MEDIATEK MT7601U WIRELESS LAN DRIVER
8465M: Jakub Kicinski <kubakici@wp.pl> 8450M: Jakub Kicinski <kubakici@wp.pl>
8466L: linux-wireless@vger.kernel.org 8451L: linux-wireless@vger.kernel.org
@@ -8468,9 +8453,9 @@ S: Maintained
8468F: drivers/net/wireless/mediatek/mt7601u/ 8453F: drivers/net/wireless/mediatek/mt7601u/
8469 8454
8470MEDIATEK RANDOM NUMBER GENERATOR SUPPORT 8455MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
8471M: Sean Wang <sean.wang@mediatek.com> 8456M: Sean Wang <sean.wang@mediatek.com>
8472S: Maintained 8457S: Maintained
8473F: drivers/char/hw_random/mtk-rng.c 8458F: drivers/char/hw_random/mtk-rng.c
8474 8459
8475MEGACHIPS STDPXXXX-GE-B850V3-FW LVDS/DP++ BRIDGES 8460MEGACHIPS STDPXXXX-GE-B850V3-FW LVDS/DP++ BRIDGES
8476M: Peter Senna Tschudin <peter.senna@collabora.com> 8461M: Peter Senna Tschudin <peter.senna@collabora.com>
@@ -8492,6 +8477,13 @@ F: Documentation/scsi/megaraid.txt
8492F: drivers/scsi/megaraid.* 8477F: drivers/scsi/megaraid.*
8493F: drivers/scsi/megaraid/ 8478F: drivers/scsi/megaraid/
8494 8479
8480MELEXIS MLX90614 DRIVER
8481M: Crt Mori <cmo@melexis.com>
8482L: linux-iio@vger.kernel.org
8483W: http://www.melexis.com
8484S: Supported
8485F: drivers/iio/temperature/mlx90614.c
8486
8495MELFAS MIP4 TOUCHSCREEN DRIVER 8487MELFAS MIP4 TOUCHSCREEN DRIVER
8496M: Sangwon Jee <jeesw@melfas.com> 8488M: Sangwon Jee <jeesw@melfas.com>
8497W: http://www.melfas.com 8489W: http://www.melfas.com
@@ -8552,6 +8544,56 @@ W: http://www.mellanox.com
8552Q: http://patchwork.ozlabs.org/project/netdev/list/ 8544Q: http://patchwork.ozlabs.org/project/netdev/list/
8553F: drivers/net/ethernet/mellanox/mlxfw/ 8545F: drivers/net/ethernet/mellanox/mlxfw/
8554 8546
8547MELLANOX MLX CPLD HOTPLUG DRIVER
8548M: Vadim Pasternak <vadimp@mellanox.com>
8549L: platform-driver-x86@vger.kernel.org
8550S: Supported
8551F: drivers/platform/x86/mlxcpld-hotplug.c
8552F: include/linux/platform_data/mlxcpld-hotplug.h
8553
8554MELLANOX MLX4 core VPI driver
8555M: Tariq Toukan <tariqt@mellanox.com>
8556L: netdev@vger.kernel.org
8557L: linux-rdma@vger.kernel.org
8558W: http://www.mellanox.com
8559Q: http://patchwork.ozlabs.org/project/netdev/list/
8560S: Supported
8561F: drivers/net/ethernet/mellanox/mlx4/
8562F: include/linux/mlx4/
8563
8564MELLANOX MLX4 IB driver
8565M: Yishai Hadas <yishaih@mellanox.com>
8566L: linux-rdma@vger.kernel.org
8567W: http://www.mellanox.com
8568Q: http://patchwork.kernel.org/project/linux-rdma/list/
8569S: Supported
8570F: drivers/infiniband/hw/mlx4/
8571F: include/linux/mlx4/
8572F: include/uapi/rdma/mlx4-abi.h
8573
8574MELLANOX MLX5 core VPI driver
8575M: Saeed Mahameed <saeedm@mellanox.com>
8576M: Matan Barak <matanb@mellanox.com>
8577M: Leon Romanovsky <leonro@mellanox.com>
8578L: netdev@vger.kernel.org
8579L: linux-rdma@vger.kernel.org
8580W: http://www.mellanox.com
8581Q: http://patchwork.ozlabs.org/project/netdev/list/
8582S: Supported
8583F: drivers/net/ethernet/mellanox/mlx5/core/
8584F: include/linux/mlx5/
8585
8586MELLANOX MLX5 IB driver
8587M: Matan Barak <matanb@mellanox.com>
8588M: Leon Romanovsky <leonro@mellanox.com>
8589L: linux-rdma@vger.kernel.org
8590W: http://www.mellanox.com
8591Q: http://patchwork.kernel.org/project/linux-rdma/list/
8592S: Supported
8593F: drivers/infiniband/hw/mlx5/
8594F: include/linux/mlx5/
8595F: include/uapi/rdma/mlx5-abi.h
8596
8555MELLANOX MLXCPLD I2C AND MUX DRIVER 8597MELLANOX MLXCPLD I2C AND MUX DRIVER
8556M: Vadim Pasternak <vadimp@mellanox.com> 8598M: Vadim Pasternak <vadimp@mellanox.com>
8557M: Michael Shych <michaelsh@mellanox.com> 8599M: Michael Shych <michaelsh@mellanox.com>
@@ -8569,26 +8611,10 @@ F: drivers/leds/leds-mlxcpld.c
8569F: Documentation/leds/leds-mlxcpld.txt 8611F: Documentation/leds/leds-mlxcpld.txt
8570 8612
8571MELLANOX PLATFORM DRIVER 8613MELLANOX PLATFORM DRIVER
8572M: Vadim Pasternak <vadimp@mellanox.com>
8573L: platform-driver-x86@vger.kernel.org
8574S: Supported
8575F: drivers/platform/x86/mlx-platform.c
8576
8577MELLANOX MLX CPLD HOTPLUG DRIVER
8578M: Vadim Pasternak <vadimp@mellanox.com> 8614M: Vadim Pasternak <vadimp@mellanox.com>
8579L: platform-driver-x86@vger.kernel.org 8615L: platform-driver-x86@vger.kernel.org
8580S: Supported 8616S: Supported
8581F: drivers/platform/x86/mlxcpld-hotplug.c 8617F: drivers/platform/x86/mlx-platform.c
8582F: include/linux/platform_data/mlxcpld-hotplug.h
8583
8584SOFT-ROCE DRIVER (rxe)
8585M: Moni Shoua <monis@mellanox.com>
8586L: linux-rdma@vger.kernel.org
8587S: Supported
8588W: https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home
8589Q: http://patchwork.kernel.org/project/linux-rdma/list/
8590F: drivers/infiniband/sw/rxe/
8591F: include/uapi/rdma/rdma_user_rxe.h
8592 8618
8593MEMBARRIER SUPPORT 8619MEMBARRIER SUPPORT
8594M: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> 8620M: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
@@ -8710,6 +8736,18 @@ S: Maintained
8710F: drivers/usb/misc/usb251xb.c 8736F: drivers/usb/misc/usb251xb.c
8711F: Documentation/devicetree/bindings/usb/usb251xb.txt 8737F: Documentation/devicetree/bindings/usb/usb251xb.txt
8712 8738
8739MICROSEMI SMART ARRAY SMARTPQI DRIVER (smartpqi)
8740M: Don Brace <don.brace@microsemi.com>
8741L: esc.storagedev@microsemi.com
8742L: linux-scsi@vger.kernel.org
8743S: Supported
8744F: drivers/scsi/smartpqi/smartpqi*.[ch]
8745F: drivers/scsi/smartpqi/Kconfig
8746F: drivers/scsi/smartpqi/Makefile
8747F: include/linux/cciss*.h
8748F: include/uapi/linux/cciss*.h
8749F: Documentation/scsi/smartpqi.txt
8750
8713MICROSOFT SURFACE PRO 3 BUTTON DRIVER 8751MICROSOFT SURFACE PRO 3 BUTTON DRIVER
8714M: Chen Yu <yu.c.chen@intel.com> 8752M: Chen Yu <yu.c.chen@intel.com>
8715L: platform-driver-x86@vger.kernel.org 8753L: platform-driver-x86@vger.kernel.org
@@ -8732,6 +8770,16 @@ F: Documentation/devicetree/bindings/mips/
8732F: Documentation/mips/ 8770F: Documentation/mips/
8733F: arch/mips/ 8771F: arch/mips/
8734 8772
8773MIPS BOSTON DEVELOPMENT BOARD
8774M: Paul Burton <paul.burton@imgtec.com>
8775L: linux-mips@linux-mips.org
8776S: Maintained
8777F: Documentation/devicetree/bindings/clock/img,boston-clock.txt
8778F: arch/mips/boot/dts/img/boston.dts
8779F: arch/mips/configs/generic/board-boston.config
8780F: drivers/clk/imgtec/clk-boston.c
8781F: include/dt-bindings/clock/boston-clock.h
8782
8735MIPS GENERIC PLATFORM 8783MIPS GENERIC PLATFORM
8736M: Paul Burton <paul.burton@imgtec.com> 8784M: Paul Burton <paul.burton@imgtec.com>
8737L: linux-mips@linux-mips.org 8785L: linux-mips@linux-mips.org
@@ -8747,16 +8795,6 @@ F: arch/mips/include/asm/mach-loongson32/
8747F: drivers/*/*loongson1* 8795F: drivers/*/*loongson1*
8748F: drivers/*/*/*loongson1* 8796F: drivers/*/*/*loongson1*
8749 8797
8750MIPS BOSTON DEVELOPMENT BOARD
8751M: Paul Burton <paul.burton@imgtec.com>
8752L: linux-mips@linux-mips.org
8753S: Maintained
8754F: Documentation/devicetree/bindings/clock/img,boston-clock.txt
8755F: arch/mips/boot/dts/img/boston.dts
8756F: arch/mips/configs/generic/board-boston.config
8757F: drivers/clk/imgtec/clk-boston.c
8758F: include/dt-bindings/clock/boston-clock.h
8759
8760MIROSOUND PCM20 FM RADIO RECEIVER DRIVER 8798MIROSOUND PCM20 FM RADIO RECEIVER DRIVER
8761M: Hans Verkuil <hverkuil@xs4all.nl> 8799M: Hans Verkuil <hverkuil@xs4all.nl>
8762L: linux-media@vger.kernel.org 8800L: linux-media@vger.kernel.org
@@ -8765,67 +8803,15 @@ W: https://linuxtv.org
8765S: Odd Fixes 8803S: Odd Fixes
8766F: drivers/media/radio/radio-miropcm20* 8804F: drivers/media/radio/radio-miropcm20*
8767 8805
8768MELLANOX MLX4 core VPI driver 8806MMP SUPPORT
8769M: Tariq Toukan <tariqt@mellanox.com> 8807M: Eric Miao <eric.y.miao@gmail.com>
8770L: netdev@vger.kernel.org 8808M: Haojian Zhuang <haojian.zhuang@gmail.com>
8771L: linux-rdma@vger.kernel.org 8809L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
8772W: http://www.mellanox.com 8810T: git git://github.com/hzhuang1/linux.git
8773Q: http://patchwork.ozlabs.org/project/netdev/list/ 8811T: git git://git.linaro.org/people/ycmiao/pxa-linux.git
8774S: Supported 8812S: Maintained
8775F: drivers/net/ethernet/mellanox/mlx4/ 8813F: arch/arm/boot/dts/mmp*
8776F: include/linux/mlx4/ 8814F: arch/arm/mach-mmp/
8777
8778MELLANOX MLX4 IB driver
8779M: Yishai Hadas <yishaih@mellanox.com>
8780L: linux-rdma@vger.kernel.org
8781W: http://www.mellanox.com
8782Q: http://patchwork.kernel.org/project/linux-rdma/list/
8783S: Supported
8784F: drivers/infiniband/hw/mlx4/
8785F: include/linux/mlx4/
8786F: include/uapi/rdma/mlx4-abi.h
8787
8788MELLANOX MLX5 core VPI driver
8789M: Saeed Mahameed <saeedm@mellanox.com>
8790M: Matan Barak <matanb@mellanox.com>
8791M: Leon Romanovsky <leonro@mellanox.com>
8792L: netdev@vger.kernel.org
8793L: linux-rdma@vger.kernel.org
8794W: http://www.mellanox.com
8795Q: http://patchwork.ozlabs.org/project/netdev/list/
8796S: Supported
8797F: drivers/net/ethernet/mellanox/mlx5/core/
8798F: include/linux/mlx5/
8799
8800MELLANOX MLX5 IB driver
8801M: Matan Barak <matanb@mellanox.com>
8802M: Leon Romanovsky <leonro@mellanox.com>
8803L: linux-rdma@vger.kernel.org
8804W: http://www.mellanox.com
8805Q: http://patchwork.kernel.org/project/linux-rdma/list/
8806S: Supported
8807F: drivers/infiniband/hw/mlx5/
8808F: include/linux/mlx5/
8809F: include/uapi/rdma/mlx5-abi.h
8810
8811MELEXIS MLX90614 DRIVER
8812M: Crt Mori <cmo@melexis.com>
8813L: linux-iio@vger.kernel.org
8814W: http://www.melexis.com
8815S: Supported
8816F: drivers/iio/temperature/mlx90614.c
8817
8818MICROSEMI SMART ARRAY SMARTPQI DRIVER (smartpqi)
8819M: Don Brace <don.brace@microsemi.com>
8820L: esc.storagedev@microsemi.com
8821L: linux-scsi@vger.kernel.org
8822S: Supported
8823F: drivers/scsi/smartpqi/smartpqi*.[ch]
8824F: drivers/scsi/smartpqi/Kconfig
8825F: drivers/scsi/smartpqi/Makefile
8826F: include/linux/cciss*.h
8827F: include/uapi/linux/cciss*.h
8828F: Documentation/scsi/smartpqi.txt
8829 8815
8830MN88472 MEDIA DRIVER 8816MN88472 MEDIA DRIVER
8831M: Antti Palosaari <crope@iki.fi> 8817M: Antti Palosaari <crope@iki.fi>
@@ -8959,6 +8945,11 @@ F: drivers/mfd/
8959F: include/linux/mfd/ 8945F: include/linux/mfd/
8960F: include/dt-bindings/mfd/ 8946F: include/dt-bindings/mfd/
8961 8947
8948MULTIMEDIA CARD (MMC) ETC. OVER SPI
8949S: Orphan
8950F: drivers/mmc/host/mmc_spi.c
8951F: include/linux/spi/mmc_spi.h
8952
8962MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM 8953MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
8963M: Ulf Hansson <ulf.hansson@linaro.org> 8954M: Ulf Hansson <ulf.hansson@linaro.org>
8964L: linux-mmc@vger.kernel.org 8955L: linux-mmc@vger.kernel.org
@@ -8969,11 +8960,6 @@ F: drivers/mmc/
8969F: include/linux/mmc/ 8960F: include/linux/mmc/
8970F: include/uapi/linux/mmc/ 8961F: include/uapi/linux/mmc/
8971 8962
8972MULTIMEDIA CARD (MMC) ETC. OVER SPI
8973S: Orphan
8974F: drivers/mmc/host/mmc_spi.c
8975F: include/linux/spi/mmc_spi.h
8976
8977MULTIPLEXER SUBSYSTEM 8963MULTIPLEXER SUBSYSTEM
8978M: Peter Rosin <peda@axentia.se> 8964M: Peter Rosin <peda@axentia.se>
8979S: Maintained 8965S: Maintained
@@ -9036,10 +9022,6 @@ S: Maintained
9036F: drivers/mtd/nand/ 9022F: drivers/mtd/nand/
9037F: include/linux/mtd/nand*.h 9023F: include/linux/mtd/nand*.h
9038 9024
9039NATSEMI ETHERNET DRIVER (DP8381x)
9040S: Orphan
9041F: drivers/net/ethernet/natsemi/natsemi.c
9042
9043NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER 9025NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER
9044M: Daniel Mack <zonque@gmail.com> 9026M: Daniel Mack <zonque@gmail.com>
9045S: Maintained 9027S: Maintained
@@ -9047,6 +9029,10 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
9047W: http://www.native-instruments.com 9029W: http://www.native-instruments.com
9048F: sound/usb/caiaq/ 9030F: sound/usb/caiaq/
9049 9031
9032NATSEMI ETHERNET DRIVER (DP8381x)
9033S: Orphan
9034F: drivers/net/ethernet/natsemi/natsemi.c
9035
9050NCP FILESYSTEM 9036NCP FILESYSTEM
9051M: Petr Vandrovec <petr@vandrovec.name> 9037M: Petr Vandrovec <petr@vandrovec.name>
9052S: Odd Fixes 9038S: Odd Fixes
@@ -9166,6 +9152,35 @@ S: Maintained
9166W: https://fedorahosted.org/dropwatch/ 9152W: https://fedorahosted.org/dropwatch/
9167F: net/core/drop_monitor.c 9153F: net/core/drop_monitor.c
9168 9154
9155NETWORKING DRIVERS
9156L: netdev@vger.kernel.org
9157W: http://www.linuxfoundation.org/en/Net
9158Q: http://patchwork.ozlabs.org/project/netdev/list/
9159T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
9160T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
9161S: Odd Fixes
9162F: Documentation/devicetree/bindings/net/
9163F: drivers/net/
9164F: include/linux/if_*
9165F: include/linux/netdevice.h
9166F: include/linux/etherdevice.h
9167F: include/linux/fcdevice.h
9168F: include/linux/fddidevice.h
9169F: include/linux/hippidevice.h
9170F: include/linux/inetdevice.h
9171F: include/uapi/linux/if_*
9172F: include/uapi/linux/netdevice.h
9173
9174NETWORKING DRIVERS (WIRELESS)
9175M: Kalle Valo <kvalo@codeaurora.org>
9176L: linux-wireless@vger.kernel.org
9177Q: http://patchwork.kernel.org/project/linux-wireless/list/
9178T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
9179T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
9180S: Maintained
9181F: Documentation/devicetree/bindings/net/wireless/
9182F: drivers/net/wireless/
9183
9169NETWORKING [DSA] 9184NETWORKING [DSA]
9170M: Andrew Lunn <andrew@lunn.ch> 9185M: Andrew Lunn <andrew@lunn.ch>
9171M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> 9186M: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
@@ -9197,28 +9212,6 @@ F: tools/net/
9197F: tools/testing/selftests/net/ 9212F: tools/testing/selftests/net/
9198F: lib/random32.c 9213F: lib/random32.c
9199 9214
9200NETWORKING [IPv4/IPv6]
9201M: "David S. Miller" <davem@davemloft.net>
9202M: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
9203M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
9204L: netdev@vger.kernel.org
9205T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
9206S: Maintained
9207F: net/ipv4/
9208F: net/ipv6/
9209F: include/net/ip*
9210F: arch/x86/net/*
9211
9212NETWORKING [TLS]
9213M: Ilya Lesokhin <ilyal@mellanox.com>
9214M: Aviad Yehezkel <aviadye@mellanox.com>
9215M: Dave Watson <davejwatson@fb.com>
9216L: netdev@vger.kernel.org
9217S: Maintained
9218F: net/tls/*
9219F: include/uapi/linux/tls.h
9220F: include/net/tls.h
9221
9222NETWORKING [IPSEC] 9215NETWORKING [IPSEC]
9223M: Steffen Klassert <steffen.klassert@secunet.com> 9216M: Steffen Klassert <steffen.klassert@secunet.com>
9224M: Herbert Xu <herbert@gondor.apana.org.au> 9217M: Herbert Xu <herbert@gondor.apana.org.au>
@@ -9243,43 +9236,36 @@ F: net/ipv6/ip6_vti.c
9243F: include/uapi/linux/xfrm.h 9236F: include/uapi/linux/xfrm.h
9244F: include/net/xfrm.h 9237F: include/net/xfrm.h
9245 9238
9239NETWORKING [IPv4/IPv6]
9240M: "David S. Miller" <davem@davemloft.net>
9241M: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
9242M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
9243L: netdev@vger.kernel.org
9244T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
9245S: Maintained
9246F: net/ipv4/
9247F: net/ipv6/
9248F: include/net/ip*
9249F: arch/x86/net/*
9250
9246NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK) 9251NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK)
9247M: Paul Moore <paul@paul-moore.com> 9252M: Paul Moore <paul@paul-moore.com>
9248L: netdev@vger.kernel.org 9253L: netdev@vger.kernel.org
9249S: Maintained 9254S: Maintained
9250 9255
9251NETWORKING [WIRELESS] 9256NETWORKING [TLS]
9252L: linux-wireless@vger.kernel.org 9257M: Ilya Lesokhin <ilyal@mellanox.com>
9253Q: http://patchwork.kernel.org/project/linux-wireless/list/ 9258M: Aviad Yehezkel <aviadye@mellanox.com>
9254 9259M: Dave Watson <davejwatson@fb.com>
9255NETWORKING DRIVERS
9256L: netdev@vger.kernel.org 9260L: netdev@vger.kernel.org
9257W: http://www.linuxfoundation.org/en/Net 9261S: Maintained
9258Q: http://patchwork.ozlabs.org/project/netdev/list/ 9262F: net/tls/*
9259T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 9263F: include/uapi/linux/tls.h
9260T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9264F: include/net/tls.h
9261S: Odd Fixes
9262F: Documentation/devicetree/bindings/net/
9263F: drivers/net/
9264F: include/linux/if_*
9265F: include/linux/netdevice.h
9266F: include/linux/etherdevice.h
9267F: include/linux/fcdevice.h
9268F: include/linux/fddidevice.h
9269F: include/linux/hippidevice.h
9270F: include/linux/inetdevice.h
9271F: include/uapi/linux/if_*
9272F: include/uapi/linux/netdevice.h
9273 9265
9274NETWORKING DRIVERS (WIRELESS) 9266NETWORKING [WIRELESS]
9275M: Kalle Valo <kvalo@codeaurora.org>
9276L: linux-wireless@vger.kernel.org 9267L: linux-wireless@vger.kernel.org
9277Q: http://patchwork.kernel.org/project/linux-wireless/list/ 9268Q: http://patchwork.kernel.org/project/linux-wireless/list/
9278T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
9279T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
9280S: Maintained
9281F: Documentation/devicetree/bindings/net/wireless/
9282F: drivers/net/wireless/
9283 9269
9284NETXEN (1/10) GbE SUPPORT 9270NETXEN (1/10) GbE SUPPORT
9285M: Manish Chopra <manish.chopra@cavium.com> 9271M: Manish Chopra <manish.chopra@cavium.com>
@@ -9373,14 +9359,6 @@ S: Maintained
9373F: drivers/media/i2c/et8ek8 9359F: drivers/media/i2c/et8ek8
9374F: drivers/media/i2c/ad5820.c 9360F: drivers/media/i2c/ad5820.c
9375 9361
9376NOKIA N900 CAMERA SUPPORT (ET8EK8 SENSOR, AD5820 FOCUS)
9377M: Pavel Machek <pavel@ucw.cz>
9378M: Sakari Ailus <sakari.ailus@iki.fi>
9379L: linux-media@vger.kernel.org
9380S: Maintained
9381F: drivers/media/i2c/et8ek8
9382F: drivers/media/i2c/ad5820.c
9383
9384NOKIA N900 POWER SUPPLY DRIVERS 9362NOKIA N900 POWER SUPPLY DRIVERS
9385R: Pali Rohár <pali.rohar@gmail.com> 9363R: Pali Rohár <pali.rohar@gmail.com>
9386F: include/linux/power/bq2415x_charger.h 9364F: include/linux/power/bq2415x_charger.h
@@ -9392,6 +9370,12 @@ F: drivers/power/supply/bq27xxx_battery_i2c.c
9392F: drivers/power/supply/isp1704_charger.c 9370F: drivers/power/supply/isp1704_charger.c
9393F: drivers/power/supply/rx51_battery.c 9371F: drivers/power/supply/rx51_battery.c
9394 9372
9373NTB AMD DRIVER
9374M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
9375L: linux-ntb@googlegroups.com
9376S: Supported
9377F: drivers/ntb/hw/amd/
9378
9395NTB DRIVER CORE 9379NTB DRIVER CORE
9396M: Jon Mason <jdmason@kudzu.us> 9380M: Jon Mason <jdmason@kudzu.us>
9397M: Dave Jiang <dave.jiang@intel.com> 9381M: Dave Jiang <dave.jiang@intel.com>
@@ -9421,12 +9405,6 @@ W: https://github.com/jonmason/ntb/wiki
9421T: git git://github.com/jonmason/ntb.git 9405T: git git://github.com/jonmason/ntb.git
9422F: drivers/ntb/hw/intel/ 9406F: drivers/ntb/hw/intel/
9423 9407
9424NTB AMD DRIVER
9425M: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
9426L: linux-ntb@googlegroups.com
9427S: Supported
9428F: drivers/ntb/hw/amd/
9429
9430NTFS FILESYSTEM 9408NTFS FILESYSTEM
9431M: Anton Altaparmakov <anton@tuxera.com> 9409M: Anton Altaparmakov <anton@tuxera.com>
9432L: linux-ntfs-dev@lists.sourceforge.net 9410L: linux-ntfs-dev@lists.sourceforge.net
@@ -9456,15 +9434,6 @@ F: drivers/nvme/host/
9456F: include/linux/nvme.h 9434F: include/linux/nvme.h
9457F: include/uapi/linux/nvme_ioctl.h 9435F: include/uapi/linux/nvme_ioctl.h
9458 9436
9459NVM EXPRESS TARGET DRIVER
9460M: Christoph Hellwig <hch@lst.de>
9461M: Sagi Grimberg <sagi@grimberg.me>
9462L: linux-nvme@lists.infradead.org
9463T: git://git.infradead.org/nvme.git
9464W: http://git.infradead.org/nvme.git
9465S: Supported
9466F: drivers/nvme/target/
9467
9468NVM EXPRESS FC TRANSPORT DRIVERS 9437NVM EXPRESS FC TRANSPORT DRIVERS
9469M: James Smart <james.smart@broadcom.com> 9438M: James Smart <james.smart@broadcom.com>
9470L: linux-nvme@lists.infradead.org 9439L: linux-nvme@lists.infradead.org
@@ -9475,6 +9444,15 @@ F: drivers/nvme/host/fc.c
9475F: drivers/nvme/target/fc.c 9444F: drivers/nvme/target/fc.c
9476F: drivers/nvme/target/fcloop.c 9445F: drivers/nvme/target/fcloop.c
9477 9446
9447NVM EXPRESS TARGET DRIVER
9448M: Christoph Hellwig <hch@lst.de>
9449M: Sagi Grimberg <sagi@grimberg.me>
9450L: linux-nvme@lists.infradead.org
9451T: git://git.infradead.org/nvme.git
9452W: http://git.infradead.org/nvme.git
9453S: Supported
9454F: drivers/nvme/target/
9455
9478NVMEM FRAMEWORK 9456NVMEM FRAMEWORK
9479M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> 9457M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
9480S: Maintained 9458S: Maintained
@@ -9483,13 +9461,6 @@ F: Documentation/devicetree/bindings/nvmem/
9483F: include/linux/nvmem-consumer.h 9461F: include/linux/nvmem-consumer.h
9484F: include/linux/nvmem-provider.h 9462F: include/linux/nvmem-provider.h
9485 9463
9486NXP-NCI NFC DRIVER
9487M: Clément Perrochaud <clement.perrochaud@effinnov.com>
9488R: Charles Gorand <charles.gorand@effinnov.com>
9489L: linux-nfc@lists.01.org (moderated for non-subscribers)
9490S: Supported
9491F: drivers/nfc/nxp-nci
9492
9493NXP TDA998X DRM DRIVER 9464NXP TDA998X DRM DRIVER
9494M: Russell King <linux@armlinux.org.uk> 9465M: Russell King <linux@armlinux.org.uk>
9495S: Supported 9466S: Supported
@@ -9504,55 +9475,31 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
9504S: Maintained 9475S: Maintained
9505F: sound/soc/codecs/tfa9879* 9476F: sound/soc/codecs/tfa9879*
9506 9477
9478NXP-NCI NFC DRIVER
9479M: Clément Perrochaud <clement.perrochaud@effinnov.com>
9480R: Charles Gorand <charles.gorand@effinnov.com>
9481L: linux-nfc@lists.01.org (moderated for non-subscribers)
9482S: Supported
9483F: drivers/nfc/nxp-nci
9484
9507OBJTOOL 9485OBJTOOL
9508M: Josh Poimboeuf <jpoimboe@redhat.com> 9486M: Josh Poimboeuf <jpoimboe@redhat.com>
9509S: Supported 9487S: Supported
9510F: tools/objtool/ 9488F: tools/objtool/
9511 9489
9512OMAP1 SUPPORT 9490OMAP AUDIO SUPPORT
9513M: Aaro Koskinen <aaro.koskinen@iki.fi> 9491M: Peter Ujfalusi <peter.ujfalusi@ti.com>
9514M: Tony Lindgren <tony@atomide.com> 9492M: Jarkko Nikula <jarkko.nikula@bitmer.com>
9493L: alsa-devel@alsa-project.org (moderated for non-subscribers)
9515L: linux-omap@vger.kernel.org 9494L: linux-omap@vger.kernel.org
9516Q: http://patchwork.kernel.org/project/linux-omap/list/
9517T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
9518S: Maintained 9495S: Maintained
9519F: arch/arm/mach-omap1/ 9496F: sound/soc/omap/
9520F: arch/arm/plat-omap/
9521F: arch/arm/configs/omap1_defconfig
9522F: drivers/i2c/busses/i2c-omap.c
9523F: include/linux/i2c-omap.h
9524 9497
9525OMAP2+ SUPPORT 9498OMAP CLOCK FRAMEWORK SUPPORT
9526M: Tony Lindgren <tony@atomide.com> 9499M: Paul Walmsley <paul@pwsan.com>
9527L: linux-omap@vger.kernel.org 9500L: linux-omap@vger.kernel.org
9528W: http://www.muru.com/linux/omap/
9529W: http://linux.omap.com/
9530Q: http://patchwork.kernel.org/project/linux-omap/list/
9531T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
9532S: Maintained 9501S: Maintained
9533F: arch/arm/mach-omap2/ 9502F: arch/arm/*omap*/*clock*
9534F: arch/arm/plat-omap/
9535F: arch/arm/configs/omap2plus_defconfig
9536F: drivers/i2c/busses/i2c-omap.c
9537F: drivers/irqchip/irq-omap-intc.c
9538F: drivers/mfd/*omap*.c
9539F: drivers/mfd/menelaus.c
9540F: drivers/mfd/palmas.c
9541F: drivers/mfd/tps65217.c
9542F: drivers/mfd/tps65218.c
9543F: drivers/mfd/tps65910.c
9544F: drivers/mfd/twl-core.[ch]
9545F: drivers/mfd/twl4030*.c
9546F: drivers/mfd/twl6030*.c
9547F: drivers/mfd/twl6040*.c
9548F: drivers/regulator/palmas-regulator*.c
9549F: drivers/regulator/pbias-regulator.c
9550F: drivers/regulator/tps65217-regulator.c
9551F: drivers/regulator/tps65218-regulator.c
9552F: drivers/regulator/tps65910-regulator.c
9553F: drivers/regulator/twl-regulator.c
9554F: drivers/regulator/twl6030-regulator.c
9555F: include/linux/i2c-omap.h
9556 9503
9557OMAP DEVICE TREE SUPPORT 9504OMAP DEVICE TREE SUPPORT
9558M: Benoît Cousson <bcousson@baylibre.com> 9505M: Benoît Cousson <bcousson@baylibre.com>
@@ -9566,33 +9513,20 @@ F: arch/arm/boot/dts/*am4*
9566F: arch/arm/boot/dts/*am5* 9513F: arch/arm/boot/dts/*am5*
9567F: arch/arm/boot/dts/*dra7* 9514F: arch/arm/boot/dts/*dra7*
9568 9515
9569OMAP CLOCK FRAMEWORK SUPPORT 9516OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2)
9570M: Paul Walmsley <paul@pwsan.com> 9517M: Tomi Valkeinen <tomi.valkeinen@ti.com>
9571L: linux-omap@vger.kernel.org
9572S: Maintained
9573F: arch/arm/*omap*/*clock*
9574
9575OMAP POWER MANAGEMENT SUPPORT
9576M: Kevin Hilman <khilman@kernel.org>
9577L: linux-omap@vger.kernel.org
9578S: Maintained
9579F: arch/arm/*omap*/*pm*
9580F: drivers/cpufreq/omap-cpufreq.c
9581
9582OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT
9583M: Rajendra Nayak <rnayak@codeaurora.org>
9584M: Paul Walmsley <paul@pwsan.com>
9585L: linux-omap@vger.kernel.org 9518L: linux-omap@vger.kernel.org
9519L: linux-fbdev@vger.kernel.org
9586S: Maintained 9520S: Maintained
9587F: arch/arm/mach-omap2/prm* 9521F: drivers/video/fbdev/omap2/
9522F: Documentation/arm/OMAP/DSS
9588 9523
9589OMAP AUDIO SUPPORT 9524OMAP FRAMEBUFFER SUPPORT
9590M: Peter Ujfalusi <peter.ujfalusi@ti.com> 9525M: Tomi Valkeinen <tomi.valkeinen@ti.com>
9591M: Jarkko Nikula <jarkko.nikula@bitmer.com> 9526L: linux-fbdev@vger.kernel.org
9592L: alsa-devel@alsa-project.org (moderated for non-subscribers)
9593L: linux-omap@vger.kernel.org 9527L: linux-omap@vger.kernel.org
9594S: Maintained 9528S: Maintained
9595F: sound/soc/omap/ 9529F: drivers/video/fbdev/omap/
9596 9530
9597OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT 9531OMAP GENERAL PURPOSE MEMORY CONTROLLER SUPPORT
9598M: Roger Quadros <rogerq@ti.com> 9532M: Roger Quadros <rogerq@ti.com>
@@ -9602,20 +9536,14 @@ S: Maintained
9602F: drivers/memory/omap-gpmc.c 9536F: drivers/memory/omap-gpmc.c
9603F: arch/arm/mach-omap2/*gpmc* 9537F: arch/arm/mach-omap2/*gpmc*
9604 9538
9605OMAP FRAMEBUFFER SUPPORT 9539OMAP GPIO DRIVER
9606M: Tomi Valkeinen <tomi.valkeinen@ti.com> 9540M: Grygorii Strashko <grygorii.strashko@ti.com>
9607L: linux-fbdev@vger.kernel.org 9541M: Santosh Shilimkar <ssantosh@kernel.org>
9608L: linux-omap@vger.kernel.org 9542M: Kevin Hilman <khilman@kernel.org>
9609S: Maintained
9610F: drivers/video/fbdev/omap/
9611
9612OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2)
9613M: Tomi Valkeinen <tomi.valkeinen@ti.com>
9614L: linux-omap@vger.kernel.org 9543L: linux-omap@vger.kernel.org
9615L: linux-fbdev@vger.kernel.org
9616S: Maintained 9544S: Maintained
9617F: drivers/video/fbdev/omap2/ 9545F: Documentation/devicetree/bindings/gpio/gpio-omap.txt
9618F: Documentation/arm/OMAP/DSS 9546F: drivers/gpio/gpio-omap.c
9619 9547
9620OMAP HARDWARE SPINLOCK SUPPORT 9548OMAP HARDWARE SPINLOCK SUPPORT
9621M: Ohad Ben-Cohen <ohad@wizery.com> 9549M: Ohad Ben-Cohen <ohad@wizery.com>
@@ -9623,30 +9551,12 @@ L: linux-omap@vger.kernel.org
9623S: Maintained 9551S: Maintained
9624F: drivers/hwspinlock/omap_hwspinlock.c 9552F: drivers/hwspinlock/omap_hwspinlock.c
9625 9553
9626OMAP MMC SUPPORT
9627M: Jarkko Lavinen <jarkko.lavinen@nokia.com>
9628L: linux-omap@vger.kernel.org
9629S: Maintained
9630F: drivers/mmc/host/omap.c
9631
9632OMAP HS MMC SUPPORT 9554OMAP HS MMC SUPPORT
9633L: linux-mmc@vger.kernel.org 9555L: linux-mmc@vger.kernel.org
9634L: linux-omap@vger.kernel.org 9556L: linux-omap@vger.kernel.org
9635S: Orphan 9557S: Orphan
9636F: drivers/mmc/host/omap_hsmmc.c 9558F: drivers/mmc/host/omap_hsmmc.c
9637 9559
9638OMAP RANDOM NUMBER GENERATOR SUPPORT
9639M: Deepak Saxena <dsaxena@plexity.net>
9640S: Maintained
9641F: drivers/char/hw_random/omap-rng.c
9642
9643OMAP HWMOD SUPPORT
9644M: Benoît Cousson <bcousson@baylibre.com>
9645M: Paul Walmsley <paul@pwsan.com>
9646L: linux-omap@vger.kernel.org
9647S: Maintained
9648F: arch/arm/mach-omap2/omap_hwmod.*
9649
9650OMAP HWMOD DATA 9560OMAP HWMOD DATA
9651M: Paul Walmsley <paul@pwsan.com> 9561M: Paul Walmsley <paul@pwsan.com>
9652L: linux-omap@vger.kernel.org 9562L: linux-omap@vger.kernel.org
@@ -9659,6 +9569,13 @@ L: linux-omap@vger.kernel.org
9659S: Maintained 9569S: Maintained
9660F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c 9570F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c
9661 9571
9572OMAP HWMOD SUPPORT
9573M: Benoît Cousson <bcousson@baylibre.com>
9574M: Paul Walmsley <paul@pwsan.com>
9575L: linux-omap@vger.kernel.org
9576S: Maintained
9577F: arch/arm/mach-omap2/omap_hwmod.*
9578
9662OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS) 9579OMAP IMAGING SUBSYSTEM (OMAP3 ISP and OMAP4 ISS)
9663M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 9580M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9664L: linux-media@vger.kernel.org 9581L: linux-media@vger.kernel.org
@@ -9667,6 +9584,31 @@ F: Documentation/devicetree/bindings/media/ti,omap3isp.txt
9667F: drivers/media/platform/omap3isp/ 9584F: drivers/media/platform/omap3isp/
9668F: drivers/staging/media/omap4iss/ 9585F: drivers/staging/media/omap4iss/
9669 9586
9587OMAP MMC SUPPORT
9588M: Jarkko Lavinen <jarkko.lavinen@nokia.com>
9589L: linux-omap@vger.kernel.org
9590S: Maintained
9591F: drivers/mmc/host/omap.c
9592
9593OMAP POWER MANAGEMENT SUPPORT
9594M: Kevin Hilman <khilman@kernel.org>
9595L: linux-omap@vger.kernel.org
9596S: Maintained
9597F: arch/arm/*omap*/*pm*
9598F: drivers/cpufreq/omap-cpufreq.c
9599
9600OMAP POWERDOMAIN SOC ADAPTATION LAYER SUPPORT
9601M: Rajendra Nayak <rnayak@codeaurora.org>
9602M: Paul Walmsley <paul@pwsan.com>
9603L: linux-omap@vger.kernel.org
9604S: Maintained
9605F: arch/arm/mach-omap2/prm*
9606
9607OMAP RANDOM NUMBER GENERATOR SUPPORT
9608M: Deepak Saxena <dsaxena@plexity.net>
9609S: Maintained
9610F: drivers/char/hw_random/omap-rng.c
9611
9670OMAP USB SUPPORT 9612OMAP USB SUPPORT
9671L: linux-usb@vger.kernel.org 9613L: linux-usb@vger.kernel.org
9672L: linux-omap@vger.kernel.org 9614L: linux-omap@vger.kernel.org
@@ -9674,21 +9616,57 @@ S: Orphan
9674F: drivers/usb/*/*omap* 9616F: drivers/usb/*/*omap*
9675F: arch/arm/*omap*/usb* 9617F: arch/arm/*omap*/usb*
9676 9618
9677OMAP GPIO DRIVER
9678M: Grygorii Strashko <grygorii.strashko@ti.com>
9679M: Santosh Shilimkar <ssantosh@kernel.org>
9680M: Kevin Hilman <khilman@kernel.org>
9681L: linux-omap@vger.kernel.org
9682S: Maintained
9683F: Documentation/devicetree/bindings/gpio/gpio-omap.txt
9684F: drivers/gpio/gpio-omap.c
9685
9686OMAP/NEWFLOW NANOBONE MACHINE SUPPORT 9619OMAP/NEWFLOW NANOBONE MACHINE SUPPORT
9687M: Mark Jackson <mpfj@newflow.co.uk> 9620M: Mark Jackson <mpfj@newflow.co.uk>
9688L: linux-omap@vger.kernel.org 9621L: linux-omap@vger.kernel.org
9689S: Maintained 9622S: Maintained
9690F: arch/arm/boot/dts/am335x-nano.dts 9623F: arch/arm/boot/dts/am335x-nano.dts
9691 9624
9625OMAP1 SUPPORT
9626M: Aaro Koskinen <aaro.koskinen@iki.fi>
9627M: Tony Lindgren <tony@atomide.com>
9628L: linux-omap@vger.kernel.org
9629Q: http://patchwork.kernel.org/project/linux-omap/list/
9630T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
9631S: Maintained
9632F: arch/arm/mach-omap1/
9633F: arch/arm/plat-omap/
9634F: arch/arm/configs/omap1_defconfig
9635F: drivers/i2c/busses/i2c-omap.c
9636F: include/linux/i2c-omap.h
9637
9638OMAP2+ SUPPORT
9639M: Tony Lindgren <tony@atomide.com>
9640L: linux-omap@vger.kernel.org
9641W: http://www.muru.com/linux/omap/
9642W: http://linux.omap.com/
9643Q: http://patchwork.kernel.org/project/linux-omap/list/
9644T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
9645S: Maintained
9646F: arch/arm/mach-omap2/
9647F: arch/arm/plat-omap/
9648F: arch/arm/configs/omap2plus_defconfig
9649F: drivers/i2c/busses/i2c-omap.c
9650F: drivers/irqchip/irq-omap-intc.c
9651F: drivers/mfd/*omap*.c
9652F: drivers/mfd/menelaus.c
9653F: drivers/mfd/palmas.c
9654F: drivers/mfd/tps65217.c
9655F: drivers/mfd/tps65218.c
9656F: drivers/mfd/tps65910.c
9657F: drivers/mfd/twl-core.[ch]
9658F: drivers/mfd/twl4030*.c
9659F: drivers/mfd/twl6030*.c
9660F: drivers/mfd/twl6040*.c
9661F: drivers/regulator/palmas-regulator*.c
9662F: drivers/regulator/pbias-regulator.c
9663F: drivers/regulator/tps65217-regulator.c
9664F: drivers/regulator/tps65218-regulator.c
9665F: drivers/regulator/tps65910-regulator.c
9666F: drivers/regulator/twl-regulator.c
9667F: drivers/regulator/twl6030-regulator.c
9668F: include/linux/i2c-omap.h
9669
9692OMFS FILESYSTEM 9670OMFS FILESYSTEM
9693M: Bob Copeland <me@bobcopeland.com> 9671M: Bob Copeland <me@bobcopeland.com>
9694L: linux-karma-devel@lists.sourceforge.net 9672L: linux-karma-devel@lists.sourceforge.net
@@ -9708,6 +9686,13 @@ M: Harald Welte <laforge@gnumonks.org>
9708S: Maintained 9686S: Maintained
9709F: drivers/char/pcmcia/cm4040_cs.* 9687F: drivers/char/pcmcia/cm4040_cs.*
9710 9688
9689OMNIVISION OV13858 SENSOR DRIVER
9690M: Sakari Ailus <sakari.ailus@linux.intel.com>
9691L: linux-media@vger.kernel.org
9692T: git git://linuxtv.org/media_tree.git
9693S: Maintained
9694F: drivers/media/i2c/ov13858.c
9695
9711OMNIVISION OV5640 SENSOR DRIVER 9696OMNIVISION OV5640 SENSOR DRIVER
9712M: Steve Longerbeam <slongerbeam@gmail.com> 9697M: Steve Longerbeam <slongerbeam@gmail.com>
9713L: linux-media@vger.kernel.org 9698L: linux-media@vger.kernel.org
@@ -9730,13 +9715,6 @@ S: Maintained
9730F: drivers/media/i2c/ov7670.c 9715F: drivers/media/i2c/ov7670.c
9731F: Documentation/devicetree/bindings/media/i2c/ov7670.txt 9716F: Documentation/devicetree/bindings/media/i2c/ov7670.txt
9732 9717
9733OMNIVISION OV13858 SENSOR DRIVER
9734M: Sakari Ailus <sakari.ailus@linux.intel.com>
9735L: linux-media@vger.kernel.org
9736T: git git://linuxtv.org/media_tree.git
9737S: Maintained
9738F: drivers/media/i2c/ov13858.c
9739
9740ONENAND FLASH DRIVER 9718ONENAND FLASH DRIVER
9741M: Kyungmin Park <kyungmin.park@samsung.com> 9719M: Kyungmin Park <kyungmin.park@samsung.com>
9742L: linux-mtd@lists.infradead.org 9720L: linux-mtd@lists.infradead.org
@@ -9754,12 +9732,26 @@ F: drivers/scsi/osst.*
9754F: drivers/scsi/osst_*.h 9732F: drivers/scsi/osst_*.h
9755F: drivers/scsi/st.h 9733F: drivers/scsi/st.h
9756 9734
9757OPENCORES I2C BUS DRIVER 9735OP-TEE DRIVER
9758M: Peter Korsgaard <jacmet@sunsite.dk> 9736M: Jens Wiklander <jens.wiklander@linaro.org>
9759L: linux-i2c@vger.kernel.org
9760S: Maintained 9737S: Maintained
9761F: Documentation/i2c/busses/i2c-ocores 9738F: drivers/tee/optee/
9762F: drivers/i2c/busses/i2c-ocores.c 9739
9740OPA-VNIC DRIVER
9741M: Dennis Dalessandro <dennis.dalessandro@intel.com>
9742M: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
9743L: linux-rdma@vger.kernel.org
9744S: Supported
9745F: drivers/infiniband/ulp/opa_vnic
9746
9747OPEN FIRMWARE AND DEVICE TREE OVERLAYS
9748M: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
9749L: devicetree@vger.kernel.org
9750S: Maintained
9751F: Documentation/devicetree/dynamic-resolution-notes.txt
9752F: Documentation/devicetree/overlay-notes.txt
9753F: drivers/of/overlay.c
9754F: drivers/of/resolver.c
9763 9755
9764OPEN FIRMWARE AND FLATTENED DEVICE TREE 9756OPEN FIRMWARE AND FLATTENED DEVICE TREE
9765M: Rob Herring <robh+dt@kernel.org> 9757M: Rob Herring <robh+dt@kernel.org>
@@ -9784,14 +9776,12 @@ F: Documentation/devicetree/
9784F: arch/*/boot/dts/ 9776F: arch/*/boot/dts/
9785F: include/dt-bindings/ 9777F: include/dt-bindings/
9786 9778
9787OPEN FIRMWARE AND DEVICE TREE OVERLAYS 9779OPENCORES I2C BUS DRIVER
9788M: Pantelis Antoniou <pantelis.antoniou@konsulko.com> 9780M: Peter Korsgaard <jacmet@sunsite.dk>
9789L: devicetree@vger.kernel.org 9781L: linux-i2c@vger.kernel.org
9790S: Maintained 9782S: Maintained
9791F: Documentation/devicetree/dynamic-resolution-notes.txt 9783F: Documentation/i2c/busses/i2c-ocores
9792F: Documentation/devicetree/overlay-notes.txt 9784F: drivers/i2c/busses/i2c-ocores.c
9793F: drivers/of/overlay.c
9794F: drivers/of/resolver.c
9795 9785
9796OPENRISC ARCHITECTURE 9786OPENRISC ARCHITECTURE
9797M: Jonas Bonn <jonas@southpole.se> 9787M: Jonas Bonn <jonas@southpole.se>
@@ -9840,11 +9830,6 @@ F: arch/*/oprofile/
9840F: drivers/oprofile/ 9830F: drivers/oprofile/
9841F: include/linux/oprofile.h 9831F: include/linux/oprofile.h
9842 9832
9843OP-TEE DRIVER
9844M: Jens Wiklander <jens.wiklander@linaro.org>
9845S: Maintained
9846F: drivers/tee/optee/
9847
9848ORACLE CLUSTER FILESYSTEM 2 (OCFS2) 9833ORACLE CLUSTER FILESYSTEM 2 (OCFS2)
9849M: Mark Fasheh <mfasheh@versity.com> 9834M: Mark Fasheh <mfasheh@versity.com>
9850M: Joel Becker <jlbec@evilplan.org> 9835M: Joel Becker <jlbec@evilplan.org>
@@ -9855,6 +9840,14 @@ F: Documentation/filesystems/ocfs2.txt
9855F: Documentation/filesystems/dlmfs.txt 9840F: Documentation/filesystems/dlmfs.txt
9856F: fs/ocfs2/ 9841F: fs/ocfs2/
9857 9842
9843ORANGEFS FILESYSTEM
9844M: Mike Marshall <hubcap@omnibond.com>
9845L: pvfs2-developers@beowulf-underground.org (subscribers-only)
9846T: git git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux.git
9847S: Supported
9848F: fs/orangefs/
9849F: Documentation/filesystems/orangefs.txt
9850
9858ORINOCO DRIVER 9851ORINOCO DRIVER
9859L: linux-wireless@vger.kernel.org 9852L: linux-wireless@vger.kernel.org
9860W: http://wireless.kernel.org/en/users/Drivers/orinoco 9853W: http://wireless.kernel.org/en/users/Drivers/orinoco
@@ -9869,6 +9862,16 @@ F: drivers/scsi/osd/
9869F: include/scsi/osd_* 9862F: include/scsi/osd_*
9870F: fs/exofs/ 9863F: fs/exofs/
9871 9864
9865OV2659 OMNIVISION SENSOR DRIVER
9866M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
9867L: linux-media@vger.kernel.org
9868W: https://linuxtv.org
9869Q: http://patchwork.linuxtv.org/project/linux-media/list/
9870T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
9871S: Maintained
9872F: drivers/media/i2c/ov2659.c
9873F: include/media/i2c/ov2659.h
9874
9872OVERLAY FILESYSTEM 9875OVERLAY FILESYSTEM
9873M: Miklos Szeredi <miklos@szeredi.hu> 9876M: Miklos Szeredi <miklos@szeredi.hu>
9874L: linux-unionfs@vger.kernel.org 9877L: linux-unionfs@vger.kernel.org
@@ -9877,14 +9880,6 @@ S: Supported
9877F: fs/overlayfs/ 9880F: fs/overlayfs/
9878F: Documentation/filesystems/overlayfs.txt 9881F: Documentation/filesystems/overlayfs.txt
9879 9882
9880ORANGEFS FILESYSTEM
9881M: Mike Marshall <hubcap@omnibond.com>
9882L: pvfs2-developers@beowulf-underground.org (subscribers-only)
9883T: git git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux.git
9884S: Supported
9885F: fs/orangefs/
9886F: Documentation/filesystems/orangefs.txt
9887
9888P54 WIRELESS DRIVER 9883P54 WIRELESS DRIVER
9889M: Christian Lamparter <chunkeey@googlemail.com> 9884M: Christian Lamparter <chunkeey@googlemail.com>
9890L: linux-wireless@vger.kernel.org 9885L: linux-wireless@vger.kernel.org
@@ -9925,11 +9920,11 @@ F: Documentation/mn10300/
9925F: arch/mn10300/ 9920F: arch/mn10300/
9926 9921
9927PARALLEL LCD/KEYPAD PANEL DRIVER 9922PARALLEL LCD/KEYPAD PANEL DRIVER
9928M: Willy Tarreau <willy@haproxy.com> 9923M: Willy Tarreau <willy@haproxy.com>
9929M: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> 9924M: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
9930S: Odd Fixes 9925S: Odd Fixes
9931F: Documentation/misc-devices/lcd-panel-cgram.txt 9926F: Documentation/misc-devices/lcd-panel-cgram.txt
9932F: drivers/misc/panel.c 9927F: drivers/misc/panel.c
9933 9928
9934PARALLEL PORT SUBSYSTEM 9929PARALLEL PORT SUBSYSTEM
9935M: Sudip Mukherjee <sudipm.mukherjee@gmail.com> 9930M: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
@@ -10025,42 +10020,13 @@ M: Khalid Aziz <khalid@gonehiking.org>
10025S: Maintained 10020S: Maintained
10026F: drivers/firmware/pcdp.* 10021F: drivers/firmware/pcdp.*
10027 10022
10028PCI ERROR RECOVERY 10023PCI DRIVER FOR AARDVARK (Marvell Armada 3700)
10029M: Linas Vepstas <linasvepstas@gmail.com> 10024M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10030L: linux-pci@vger.kernel.org
10031S: Supported
10032F: Documentation/PCI/pci-error-recovery.txt
10033
10034PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC
10035M: Russell Currey <ruscur@russell.cc>
10036L: linuxppc-dev@lists.ozlabs.org
10037S: Supported
10038F: Documentation/powerpc/eeh-pci-error-recovery.txt
10039F: arch/powerpc/kernel/eeh*.c
10040F: arch/powerpc/platforms/*/eeh*.c
10041F: arch/powerpc/include/*/eeh*.h
10042
10043PCI SUBSYSTEM
10044M: Bjorn Helgaas <bhelgaas@google.com>
10045L: linux-pci@vger.kernel.org
10046Q: http://patchwork.ozlabs.org/project/linux-pci/list/
10047T: git git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
10048S: Supported
10049F: Documentation/devicetree/bindings/pci/
10050F: Documentation/PCI/
10051F: drivers/pci/
10052F: include/linux/pci*
10053F: arch/x86/pci/
10054F: arch/x86/kernel/quirks.c
10055
10056PCI ENDPOINT SUBSYSTEM
10057M: Kishon Vijay Abraham I <kishon@ti.com>
10058L: linux-pci@vger.kernel.org 10025L: linux-pci@vger.kernel.org
10059T: git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git 10026L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10060S: Supported 10027S: Maintained
10061F: drivers/pci/endpoint/ 10028F: Documentation/devicetree/bindings/pci/aardvark-pci.txt
10062F: drivers/misc/pci_endpoint_test.c 10029F: drivers/pci/host/pci-aardvark.c
10063F: tools/pci/
10064 10030
10065PCI DRIVER FOR ALTERA PCIE IP 10031PCI DRIVER FOR ALTERA PCIE IP
10066M: Ley Foon Tan <lftan@altera.com> 10032M: Ley Foon Tan <lftan@altera.com>
@@ -10070,6 +10036,14 @@ S: Supported
10070F: Documentation/devicetree/bindings/pci/altera-pcie.txt 10036F: Documentation/devicetree/bindings/pci/altera-pcie.txt
10071F: drivers/pci/host/pcie-altera.c 10037F: drivers/pci/host/pcie-altera.c
10072 10038
10039PCI DRIVER FOR APPLIEDMICRO XGENE
10040M: Tanmay Inamdar <tinamdar@apm.com>
10041L: linux-pci@vger.kernel.org
10042L: linux-arm-kernel@lists.infradead.org
10043S: Maintained
10044F: Documentation/devicetree/bindings/pci/xgene-pci.txt
10045F: drivers/pci/host/pci-xgene.c
10046
10073PCI DRIVER FOR ARM VERSATILE PLATFORM 10047PCI DRIVER FOR ARM VERSATILE PLATFORM
10074M: Rob Herring <robh@kernel.org> 10048M: Rob Herring <robh@kernel.org>
10075L: linux-pci@vger.kernel.org 10049L: linux-pci@vger.kernel.org
@@ -10086,14 +10060,6 @@ S: Maintained
10086F: Documentation/devicetree/bindings/pci/pci-armada8k.txt 10060F: Documentation/devicetree/bindings/pci/pci-armada8k.txt
10087F: drivers/pci/dwc/pcie-armada8k.c 10061F: drivers/pci/dwc/pcie-armada8k.c
10088 10062
10089PCI DRIVER FOR APPLIEDMICRO XGENE
10090M: Tanmay Inamdar <tinamdar@apm.com>
10091L: linux-pci@vger.kernel.org
10092L: linux-arm-kernel@lists.infradead.org
10093S: Maintained
10094F: Documentation/devicetree/bindings/pci/xgene-pci.txt
10095F: drivers/pci/host/pci-xgene.c
10096
10097PCI DRIVER FOR FREESCALE LAYERSCAPE 10063PCI DRIVER FOR FREESCALE LAYERSCAPE
10098M: Minghuan Lian <minghuan.Lian@freescale.com> 10064M: Minghuan Lian <minghuan.Lian@freescale.com>
10099M: Mingkai Hu <mingkai.hu@freescale.com> 10065M: Mingkai Hu <mingkai.hu@freescale.com>
@@ -10104,6 +10070,15 @@ L: linux-arm-kernel@lists.infradead.org
10104S: Maintained 10070S: Maintained
10105F: drivers/pci/dwc/*layerscape* 10071F: drivers/pci/dwc/*layerscape*
10106 10072
10073PCI DRIVER FOR GENERIC OF HOSTS
10074M: Will Deacon <will.deacon@arm.com>
10075L: linux-pci@vger.kernel.org
10076L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10077S: Maintained
10078F: Documentation/devicetree/bindings/pci/host-generic-pci.txt
10079F: drivers/pci/host/pci-host-common.c
10080F: drivers/pci/host/pci-host-generic.c
10081
10107PCI DRIVER FOR IMX6 10082PCI DRIVER FOR IMX6
10108M: Richard Zhu <hongxing.zhu@nxp.com> 10083M: Richard Zhu <hongxing.zhu@nxp.com>
10109M: Lucas Stach <l.stach@pengutronix.de> 10084M: Lucas Stach <l.stach@pengutronix.de>
@@ -10113,28 +10088,11 @@ S: Maintained
10113F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt 10088F: Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt
10114F: drivers/pci/dwc/*imx6* 10089F: drivers/pci/dwc/*imx6*
10115 10090
10116PCI DRIVER FOR TI KEYSTONE 10091PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD)
10117M: Murali Karicheri <m-karicheri2@ti.com> 10092M: Keith Busch <keith.busch@intel.com>
10118L: linux-pci@vger.kernel.org
10119L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10120S: Maintained
10121F: drivers/pci/dwc/*keystone*
10122
10123PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support)
10124M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10125M: Jason Cooper <jason@lakedaemon.net>
10126L: linux-pci@vger.kernel.org
10127L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10128S: Maintained
10129F: drivers/pci/host/*mvebu*
10130
10131PCI DRIVER FOR AARDVARK (Marvell Armada 3700)
10132M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10133L: linux-pci@vger.kernel.org 10093L: linux-pci@vger.kernel.org
10134L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 10094S: Supported
10135S: Maintained 10095F: drivers/pci/host/vmd.c
10136F: Documentation/devicetree/bindings/pci/aardvark-pci.txt
10137F: drivers/pci/host/pci-aardvark.c
10138 10096
10139PCI DRIVER FOR MICROSEMI SWITCHTEC 10097PCI DRIVER FOR MICROSEMI SWITCHTEC
10140M: Kurt Schwemmer <kurt.schwemmer@microsemi.com> 10098M: Kurt Schwemmer <kurt.schwemmer@microsemi.com>
@@ -10147,6 +10105,14 @@ F: Documentation/ABI/testing/sysfs-class-switchtec
10147F: drivers/pci/switch/switchtec* 10105F: drivers/pci/switch/switchtec*
10148F: include/uapi/linux/switchtec_ioctl.h 10106F: include/uapi/linux/switchtec_ioctl.h
10149 10107
10108PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support)
10109M: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10110M: Jason Cooper <jason@lakedaemon.net>
10111L: linux-pci@vger.kernel.org
10112L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10113S: Maintained
10114F: drivers/pci/host/*mvebu*
10115
10150PCI DRIVER FOR NVIDIA TEGRA 10116PCI DRIVER FOR NVIDIA TEGRA
10151M: Thierry Reding <thierry.reding@gmail.com> 10117M: Thierry Reding <thierry.reding@gmail.com>
10152L: linux-tegra@vger.kernel.org 10118L: linux-tegra@vger.kernel.org
@@ -10155,14 +10121,6 @@ S: Supported
10155F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt 10121F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt
10156F: drivers/pci/host/pci-tegra.c 10122F: drivers/pci/host/pci-tegra.c
10157 10123
10158PCI DRIVER FOR TI DRA7XX
10159M: Kishon Vijay Abraham I <kishon@ti.com>
10160L: linux-omap@vger.kernel.org
10161L: linux-pci@vger.kernel.org
10162S: Supported
10163F: Documentation/devicetree/bindings/pci/ti-pci.txt
10164F: drivers/pci/dwc/pci-dra7xx.c
10165
10166PCI DRIVER FOR RENESAS R-CAR 10124PCI DRIVER FOR RENESAS R-CAR
10167M: Simon Horman <horms@verge.net.au> 10125M: Simon Horman <horms@verge.net.au>
10168L: linux-pci@vger.kernel.org 10126L: linux-pci@vger.kernel.org
@@ -10186,26 +10144,44 @@ S: Maintained
10186F: Documentation/devicetree/bindings/pci/designware-pcie.txt 10144F: Documentation/devicetree/bindings/pci/designware-pcie.txt
10187F: drivers/pci/dwc/*designware* 10145F: drivers/pci/dwc/*designware*
10188 10146
10189PCI DRIVER FOR GENERIC OF HOSTS 10147PCI DRIVER FOR TI DRA7XX
10190M: Will Deacon <will.deacon@arm.com> 10148M: Kishon Vijay Abraham I <kishon@ti.com>
10149L: linux-omap@vger.kernel.org
10150L: linux-pci@vger.kernel.org
10151S: Supported
10152F: Documentation/devicetree/bindings/pci/ti-pci.txt
10153F: drivers/pci/dwc/pci-dra7xx.c
10154
10155PCI DRIVER FOR TI KEYSTONE
10156M: Murali Karicheri <m-karicheri2@ti.com>
10191L: linux-pci@vger.kernel.org 10157L: linux-pci@vger.kernel.org
10192L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 10158L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10193S: Maintained 10159S: Maintained
10194F: Documentation/devicetree/bindings/pci/host-generic-pci.txt 10160F: drivers/pci/dwc/*keystone*
10195F: drivers/pci/host/pci-host-common.c
10196F: drivers/pci/host/pci-host-generic.c
10197 10161
10198PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) 10162PCI ENDPOINT SUBSYSTEM
10199M: Keith Busch <keith.busch@intel.com> 10163M: Kishon Vijay Abraham I <kishon@ti.com>
10200L: linux-pci@vger.kernel.org 10164L: linux-pci@vger.kernel.org
10165T: git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git
10201S: Supported 10166S: Supported
10202F: drivers/pci/host/vmd.c 10167F: drivers/pci/endpoint/
10168F: drivers/misc/pci_endpoint_test.c
10169F: tools/pci/
10203 10170
10204PCIE DRIVER FOR ST SPEAR13XX 10171PCI ENHANCED ERROR HANDLING (EEH) FOR POWERPC
10205M: Pratyush Anand <pratyush.anand@gmail.com> 10172M: Russell Currey <ruscur@russell.cc>
10173L: linuxppc-dev@lists.ozlabs.org
10174S: Supported
10175F: Documentation/powerpc/eeh-pci-error-recovery.txt
10176F: arch/powerpc/kernel/eeh*.c
10177F: arch/powerpc/platforms/*/eeh*.c
10178F: arch/powerpc/include/*/eeh*.h
10179
10180PCI ERROR RECOVERY
10181M: Linas Vepstas <linasvepstas@gmail.com>
10206L: linux-pci@vger.kernel.org 10182L: linux-pci@vger.kernel.org
10207S: Maintained 10183S: Supported
10208F: drivers/pci/dwc/*spear* 10184F: Documentation/PCI/pci-error-recovery.txt
10209 10185
10210PCI MSI DRIVER FOR ALTERA MSI IP 10186PCI MSI DRIVER FOR ALTERA MSI IP
10211M: Ley Foon Tan <lftan@altera.com> 10187M: Ley Foon Tan <lftan@altera.com>
@@ -10223,6 +10199,19 @@ S: Maintained
10223F: Documentation/devicetree/bindings/pci/xgene-pci-msi.txt 10199F: Documentation/devicetree/bindings/pci/xgene-pci-msi.txt
10224F: drivers/pci/host/pci-xgene-msi.c 10200F: drivers/pci/host/pci-xgene-msi.c
10225 10201
10202PCI SUBSYSTEM
10203M: Bjorn Helgaas <bhelgaas@google.com>
10204L: linux-pci@vger.kernel.org
10205Q: http://patchwork.ozlabs.org/project/linux-pci/list/
10206T: git git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
10207S: Supported
10208F: Documentation/devicetree/bindings/pci/
10209F: Documentation/PCI/
10210F: drivers/pci/
10211F: include/linux/pci*
10212F: arch/x86/pci/
10213F: arch/x86/kernel/quirks.c
10214
10226PCIE DRIVER FOR AXIS ARTPEC 10215PCIE DRIVER FOR AXIS ARTPEC
10227M: Niklas Cassel <niklas.cassel@axis.com> 10216M: Niklas Cassel <niklas.cassel@axis.com>
10228M: Jesper Nilsson <jesper.nilsson@axis.com> 10217M: Jesper Nilsson <jesper.nilsson@axis.com>
@@ -10232,6 +10221,14 @@ S: Maintained
10232F: Documentation/devicetree/bindings/pci/axis,artpec* 10221F: Documentation/devicetree/bindings/pci/axis,artpec*
10233F: drivers/pci/dwc/*artpec* 10222F: drivers/pci/dwc/*artpec*
10234 10223
10224PCIE DRIVER FOR CAVIUM THUNDERX
10225M: David Daney <david.daney@cavium.com>
10226L: linux-pci@vger.kernel.org
10227L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10228S: Supported
10229F: Documentation/devicetree/bindings/pci/pci-thunder-*
10230F: drivers/pci/host/pci-thunder-*
10231
10235PCIE DRIVER FOR HISILICON 10232PCIE DRIVER FOR HISILICON
10236M: Zhou Wang <wangzhou1@hisilicon.com> 10233M: Zhou Wang <wangzhou1@hisilicon.com>
10237M: Gabriele Paoloni <gabriele.paoloni@huawei.com> 10234M: Gabriele Paoloni <gabriele.paoloni@huawei.com>
@@ -10248,6 +10245,21 @@ S: Maintained
10248F: Documentation/devicetree/bindings/pci/pcie-kirin.txt 10245F: Documentation/devicetree/bindings/pci/pcie-kirin.txt
10249F: drivers/pci/dwc/pcie-kirin.c 10246F: drivers/pci/dwc/pcie-kirin.c
10250 10247
10248PCIE DRIVER FOR MEDIATEK
10249M: Ryder Lee <ryder.lee@mediatek.com>
10250L: linux-pci@vger.kernel.org
10251L: linux-mediatek@lists.infradead.org
10252S: Supported
10253F: Documentation/devicetree/bindings/pci/mediatek*
10254F: drivers/pci/host/*mediatek*
10255
10256PCIE DRIVER FOR QUALCOMM MSM
10257M: Stanimir Varbanov <svarbanov@mm-sol.com>
10258L: linux-pci@vger.kernel.org
10259L: linux-arm-msm@vger.kernel.org
10260S: Maintained
10261F: drivers/pci/dwc/*qcom*
10262
10251PCIE DRIVER FOR ROCKCHIP 10263PCIE DRIVER FOR ROCKCHIP
10252M: Shawn Lin <shawn.lin@rock-chips.com> 10264M: Shawn Lin <shawn.lin@rock-chips.com>
10253L: linux-pci@vger.kernel.org 10265L: linux-pci@vger.kernel.org
@@ -10256,28 +10268,11 @@ S: Maintained
10256F: Documentation/devicetree/bindings/pci/rockchip-pcie.txt 10268F: Documentation/devicetree/bindings/pci/rockchip-pcie.txt
10257F: drivers/pci/host/pcie-rockchip.c 10269F: drivers/pci/host/pcie-rockchip.c
10258 10270
10259PCIE DRIVER FOR QUALCOMM MSM 10271PCIE DRIVER FOR ST SPEAR13XX
10260M: Stanimir Varbanov <svarbanov@mm-sol.com> 10272M: Pratyush Anand <pratyush.anand@gmail.com>
10261L: linux-pci@vger.kernel.org
10262L: linux-arm-msm@vger.kernel.org
10263S: Maintained
10264F: drivers/pci/dwc/*qcom*
10265
10266PCIE DRIVER FOR CAVIUM THUNDERX
10267M: David Daney <david.daney@cavium.com>
10268L: linux-pci@vger.kernel.org 10273L: linux-pci@vger.kernel.org
10269L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 10274S: Maintained
10270S: Supported 10275F: drivers/pci/dwc/*spear*
10271F: Documentation/devicetree/bindings/pci/pci-thunder-*
10272F: drivers/pci/host/pci-thunder-*
10273
10274PCIE DRIVER FOR MEDIATEK
10275M: Ryder Lee <ryder.lee@mediatek.com>
10276L: linux-pci@vger.kernel.org
10277L: linux-mediatek@lists.infradead.org
10278S: Supported
10279F: Documentation/devicetree/bindings/pci/mediatek*
10280F: drivers/pci/host/*mediatek*
10281 10276
10282PCMCIA SUBSYSTEM 10277PCMCIA SUBSYSTEM
10283P: Linux PCMCIA Team 10278P: Linux PCMCIA Team
@@ -10446,14 +10441,14 @@ S: Maintained
10446F: drivers/pinctrl/spear/ 10441F: drivers/pinctrl/spear/
10447 10442
10448PISTACHIO SOC SUPPORT 10443PISTACHIO SOC SUPPORT
10449M: James Hartley <james.hartley@imgtec.com> 10444M: James Hartley <james.hartley@imgtec.com>
10450M: Ionela Voinescu <ionela.voinescu@imgtec.com> 10445M: Ionela Voinescu <ionela.voinescu@imgtec.com>
10451L: linux-mips@linux-mips.org 10446L: linux-mips@linux-mips.org
10452S: Maintained 10447S: Maintained
10453F: arch/mips/pistachio/ 10448F: arch/mips/pistachio/
10454F: arch/mips/include/asm/mach-pistachio/ 10449F: arch/mips/include/asm/mach-pistachio/
10455F: arch/mips/boot/dts/img/pistachio* 10450F: arch/mips/boot/dts/img/pistachio*
10456F: arch/mips/configs/pistachio*_defconfig 10451F: arch/mips/configs/pistachio*_defconfig
10457 10452
10458PKTCDVD DRIVER 10453PKTCDVD DRIVER
10459S: Orphan 10454S: Orphan
@@ -10496,6 +10491,11 @@ L: linux-scsi@vger.kernel.org
10496S: Supported 10491S: Supported
10497F: drivers/scsi/pm8001/ 10492F: drivers/scsi/pm8001/
10498 10493
10494PNP SUPPORT
10495M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
10496S: Maintained
10497F: drivers/pnp/
10498
10499POSIX CLOCKS and TIMERS 10499POSIX CLOCKS and TIMERS
10500M: Thomas Gleixner <tglx@linutronix.de> 10500M: Thomas Gleixner <tglx@linutronix.de>
10501L: linux-kernel@vger.kernel.org 10501L: linux-kernel@vger.kernel.org
@@ -10517,15 +10517,6 @@ F: include/linux/pm_*
10517F: include/linux/powercap.h 10517F: include/linux/powercap.h
10518F: drivers/powercap/ 10518F: drivers/powercap/
10519 10519
10520POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS
10521M: Sebastian Reichel <sre@kernel.org>
10522L: linux-pm@vger.kernel.org
10523T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
10524S: Maintained
10525F: Documentation/devicetree/bindings/power/supply/
10526F: include/linux/power_supply.h
10527F: drivers/power/supply/
10528
10529POWER STATE COORDINATION INTERFACE (PSCI) 10520POWER STATE COORDINATION INTERFACE (PSCI)
10530M: Mark Rutland <mark.rutland@arm.com> 10521M: Mark Rutland <mark.rutland@arm.com>
10531M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> 10522M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
@@ -10535,23 +10526,21 @@ F: drivers/firmware/psci*.c
10535F: include/linux/psci.h 10526F: include/linux/psci.h
10536F: include/uapi/linux/psci.h 10527F: include/uapi/linux/psci.h
10537 10528
10529POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS
10530M: Sebastian Reichel <sre@kernel.org>
10531L: linux-pm@vger.kernel.org
10532T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
10533S: Maintained
10534F: Documentation/devicetree/bindings/power/supply/
10535F: include/linux/power_supply.h
10536F: drivers/power/supply/
10537
10538POWERNV OPERATOR PANEL LCD DISPLAY DRIVER 10538POWERNV OPERATOR PANEL LCD DISPLAY DRIVER
10539M: Suraj Jitindar Singh <sjitindarsingh@gmail.com> 10539M: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
10540L: linuxppc-dev@lists.ozlabs.org 10540L: linuxppc-dev@lists.ozlabs.org
10541S: Maintained 10541S: Maintained
10542F: drivers/char/powernv-op-panel.c 10542F: drivers/char/powernv-op-panel.c
10543 10543
10544PNP SUPPORT
10545M: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
10546S: Maintained
10547F: drivers/pnp/
10548
10549PPP PROTOCOL DRIVERS AND COMPRESSORS
10550M: Paul Mackerras <paulus@samba.org>
10551L: linux-ppp@vger.kernel.org
10552S: Maintained
10553F: drivers/net/ppp/ppp_*
10554
10555PPP OVER ATM (RFC 2364) 10544PPP OVER ATM (RFC 2364)
10556M: Mitchell Blank Jr <mitch@sfgoth.com> 10545M: Mitchell Blank Jr <mitch@sfgoth.com>
10557S: Maintained 10546S: Maintained
@@ -10571,6 +10560,12 @@ F: net/l2tp/l2tp_ppp.c
10571F: include/linux/if_pppol2tp.h 10560F: include/linux/if_pppol2tp.h
10572F: include/uapi/linux/if_pppol2tp.h 10561F: include/uapi/linux/if_pppol2tp.h
10573 10562
10563PPP PROTOCOL DRIVERS AND COMPRESSORS
10564M: Paul Mackerras <paulus@samba.org>
10565L: linux-ppp@vger.kernel.org
10566S: Maintained
10567F: drivers/net/ppp/ppp_*
10568
10574PPS SUPPORT 10569PPS SUPPORT
10575M: Rodolfo Giometti <giometti@enneenne.com> 10570M: Rodolfo Giometti <giometti@enneenne.com>
10576W: http://wiki.enneenne.com/index.php/LinuxPPS_support 10571W: http://wiki.enneenne.com/index.php/LinuxPPS_support
@@ -10684,7 +10679,6 @@ F: drivers/ptp/*
10684F: include/linux/ptp_cl* 10679F: include/linux/ptp_cl*
10685 10680
10686PTRACE SUPPORT 10681PTRACE SUPPORT
10687M: Roland McGrath <roland@hack.frob.com>
10688M: Oleg Nesterov <oleg@redhat.com> 10682M: Oleg Nesterov <oleg@redhat.com>
10689S: Maintained 10683S: Maintained
10690F: include/asm-generic/syscall.h 10684F: include/asm-generic/syscall.h
@@ -10692,7 +10686,12 @@ F: include/linux/ptrace.h
10692F: include/linux/regset.h 10686F: include/linux/regset.h
10693F: include/linux/tracehook.h 10687F: include/linux/tracehook.h
10694F: include/uapi/linux/ptrace.h 10688F: include/uapi/linux/ptrace.h
10689F: include/uapi/linux/ptrace.h
10690F: include/asm-generic/ptrace.h
10695F: kernel/ptrace.c 10691F: kernel/ptrace.c
10692F: arch/*/ptrace*.c
10693F: arch/*/*/ptrace*.c
10694F: arch/*/include/asm/ptrace*.h
10696 10695
10697PULSE8-CEC DRIVER 10696PULSE8-CEC DRIVER
10698M: Hans Verkuil <hverkuil@xs4all.nl> 10697M: Hans Verkuil <hverkuil@xs4all.nl>
@@ -10741,6 +10740,20 @@ F: include/linux/pwm_backlight.h
10741F: drivers/gpio/gpio-mvebu.c 10740F: drivers/gpio/gpio-mvebu.c
10742F: Documentation/devicetree/bindings/gpio/gpio-mvebu.txt 10741F: Documentation/devicetree/bindings/gpio/gpio-mvebu.txt
10743 10742
10743PXA GPIO DRIVER
10744M: Robert Jarzmik <robert.jarzmik@free.fr>
10745L: linux-gpio@vger.kernel.org
10746S: Maintained
10747F: drivers/gpio/gpio-pxa.c
10748
10749PXA MMCI DRIVER
10750S: Orphan
10751
10752PXA RTC DRIVER
10753M: Robert Jarzmik <robert.jarzmik@free.fr>
10754L: linux-rtc@vger.kernel.org
10755S: Maintained
10756
10744PXA2xx/PXA3xx SUPPORT 10757PXA2xx/PXA3xx SUPPORT
10745M: Daniel Mack <daniel@zonque.org> 10758M: Daniel Mack <daniel@zonque.org>
10746M: Haojian Zhuang <haojian.zhuang@gmail.com> 10759M: Haojian Zhuang <haojian.zhuang@gmail.com>
@@ -10760,36 +10773,12 @@ F: include/sound/pxa2xx-lib.h
10760F: sound/arm/pxa* 10773F: sound/arm/pxa*
10761F: sound/soc/pxa/ 10774F: sound/soc/pxa/
10762 10775
10763PXA GPIO DRIVER
10764M: Robert Jarzmik <robert.jarzmik@free.fr>
10765L: linux-gpio@vger.kernel.org
10766S: Maintained
10767F: drivers/gpio/gpio-pxa.c
10768
10769PXA3xx NAND FLASH DRIVER 10776PXA3xx NAND FLASH DRIVER
10770M: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> 10777M: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
10771L: linux-mtd@lists.infradead.org 10778L: linux-mtd@lists.infradead.org
10772S: Maintained 10779S: Maintained
10773F: drivers/mtd/nand/pxa3xx_nand.c 10780F: drivers/mtd/nand/pxa3xx_nand.c
10774 10781
10775MMP SUPPORT
10776M: Eric Miao <eric.y.miao@gmail.com>
10777M: Haojian Zhuang <haojian.zhuang@gmail.com>
10778L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
10779T: git git://github.com/hzhuang1/linux.git
10780T: git git://git.linaro.org/people/ycmiao/pxa-linux.git
10781S: Maintained
10782F: arch/arm/boot/dts/mmp*
10783F: arch/arm/mach-mmp/
10784
10785PXA MMCI DRIVER
10786S: Orphan
10787
10788PXA RTC DRIVER
10789M: Robert Jarzmik <robert.jarzmik@free.fr>
10790L: linux-rtc@vger.kernel.org
10791S: Maintained
10792
10793QAT DRIVER 10782QAT DRIVER
10794M: Giovanni Cabiddu <giovanni.cabiddu@intel.com> 10783M: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
10795M: Salvatore Benedetto <salvatore.benedetto@intel.com> 10784M: Salvatore Benedetto <salvatore.benedetto@intel.com>
@@ -10797,12 +10786,56 @@ L: qat-linux@intel.com
10797S: Supported 10786S: Supported
10798F: drivers/crypto/qat/ 10787F: drivers/crypto/qat/
10799 10788
10789QCOM AUDIO (ASoC) DRIVERS
10790M: Patrick Lai <plai@codeaurora.org>
10791M: Banajit Goswami <bgoswami@codeaurora.org>
10792L: alsa-devel@alsa-project.org (moderated for non-subscribers)
10793S: Supported
10794F: sound/soc/qcom/
10795
10796QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT
10797M: Gabriel Somlo <somlo@cmu.edu>
10798M: "Michael S. Tsirkin" <mst@redhat.com>
10799L: qemu-devel@nongnu.org
10800S: Maintained
10801F: drivers/firmware/qemu_fw_cfg.c
10802
10800QIB DRIVER 10803QIB DRIVER
10801M: Mike Marciniszyn <infinipath@intel.com> 10804M: Mike Marciniszyn <infinipath@intel.com>
10802L: linux-rdma@vger.kernel.org 10805L: linux-rdma@vger.kernel.org
10803S: Supported 10806S: Supported
10804F: drivers/infiniband/hw/qib/ 10807F: drivers/infiniband/hw/qib/
10805 10808
10809QLOGIC QL41xxx FCOE DRIVER
10810M: QLogic-Storage-Upstream@cavium.com
10811L: linux-scsi@vger.kernel.org
10812S: Supported
10813F: drivers/scsi/qedf/
10814
10815QLOGIC QL41xxx ISCSI DRIVER
10816M: QLogic-Storage-Upstream@cavium.com
10817L: linux-scsi@vger.kernel.org
10818S: Supported
10819F: drivers/scsi/qedi/
10820
10821QLOGIC QL4xxx ETHERNET DRIVER
10822M: Yuval Mintz <Yuval.Mintz@cavium.com>
10823M: Ariel Elior <Ariel.Elior@cavium.com>
10824M: everest-linux-l2@cavium.com
10825L: netdev@vger.kernel.org
10826S: Supported
10827F: drivers/net/ethernet/qlogic/qed/
10828F: include/linux/qed/
10829F: drivers/net/ethernet/qlogic/qede/
10830
10831QLOGIC QL4xxx RDMA DRIVER
10832M: Ram Amrani <Ram.Amrani@cavium.com>
10833M: Ariel Elior <Ariel.Elior@cavium.com>
10834L: linux-rdma@vger.kernel.org
10835S: Supported
10836F: drivers/infiniband/hw/qedr/
10837F: include/uapi/rdma/qedr-abi.h
10838
10806QLOGIC QLA1280 SCSI DRIVER 10839QLOGIC QLA1280 SCSI DRIVER
10807M: Michael Reed <mdr@sgi.com> 10840M: Michael Reed <mdr@sgi.com>
10808L: linux-scsi@vger.kernel.org 10841L: linux-scsi@vger.kernel.org
@@ -10816,13 +10849,6 @@ S: Supported
10816F: Documentation/scsi/LICENSE.qla2xxx 10849F: Documentation/scsi/LICENSE.qla2xxx
10817F: drivers/scsi/qla2xxx/ 10850F: drivers/scsi/qla2xxx/
10818 10851
10819QLOGIC QLA4XXX iSCSI DRIVER
10820M: QLogic-Storage-Upstream@qlogic.com
10821L: linux-scsi@vger.kernel.org
10822S: Supported
10823F: Documentation/scsi/LICENSE.qla4xxx
10824F: drivers/scsi/qla4xxx/
10825
10826QLOGIC QLA3XXX NETWORK DRIVER 10852QLOGIC QLA3XXX NETWORK DRIVER
10827M: Dept-GELinuxNICDev@cavium.com 10853M: Dept-GELinuxNICDev@cavium.com
10828L: netdev@vger.kernel.org 10854L: netdev@vger.kernel.org
@@ -10830,6 +10856,13 @@ S: Supported
10830F: Documentation/networking/LICENSE.qla3xxx 10856F: Documentation/networking/LICENSE.qla3xxx
10831F: drivers/net/ethernet/qlogic/qla3xxx.* 10857F: drivers/net/ethernet/qlogic/qla3xxx.*
10832 10858
10859QLOGIC QLA4XXX iSCSI DRIVER
10860M: QLogic-Storage-Upstream@qlogic.com
10861L: linux-scsi@vger.kernel.org
10862S: Supported
10863F: Documentation/scsi/LICENSE.qla4xxx
10864F: drivers/scsi/qla4xxx/
10865
10833QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER 10866QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER
10834M: Harish Patil <harish.patil@cavium.com> 10867M: Harish Patil <harish.patil@cavium.com>
10835M: Manish Chopra <manish.chopra@cavium.com> 10868M: Manish Chopra <manish.chopra@cavium.com>
@@ -10846,28 +10879,6 @@ L: netdev@vger.kernel.org
10846S: Supported 10879S: Supported
10847F: drivers/net/ethernet/qlogic/qlge/ 10880F: drivers/net/ethernet/qlogic/qlge/
10848 10881
10849QLOGIC QL4xxx ETHERNET DRIVER
10850M: Yuval Mintz <Yuval.Mintz@cavium.com>
10851M: Ariel Elior <Ariel.Elior@cavium.com>
10852M: everest-linux-l2@cavium.com
10853L: netdev@vger.kernel.org
10854S: Supported
10855F: drivers/net/ethernet/qlogic/qed/
10856F: include/linux/qed/
10857F: drivers/net/ethernet/qlogic/qede/
10858
10859QLOGIC QL41xxx ISCSI DRIVER
10860M: QLogic-Storage-Upstream@cavium.com
10861L: linux-scsi@vger.kernel.org
10862S: Supported
10863F: drivers/scsi/qedi/
10864
10865QLOGIC QL41xxx FCOE DRIVER
10866M: QLogic-Storage-Upstream@cavium.com
10867L: linux-scsi@vger.kernel.org
10868S: Supported
10869F: drivers/scsi/qedf/
10870
10871QNX4 FILESYSTEM 10882QNX4 FILESYSTEM
10872M: Anders Larsen <al@alarsen.net> 10883M: Anders Larsen <al@alarsen.net>
10873W: http://www.alarsen.net/linux/qnx4fs/ 10884W: http://www.alarsen.net/linux/qnx4fs/
@@ -10894,13 +10905,6 @@ T: git git://linuxtv.org/anttip/media_tree.git
10894S: Maintained 10905S: Maintained
10895F: drivers/media/tuners/qt1010* 10906F: drivers/media/tuners/qt1010*
10896 10907
10897QUALCOMM ATHEROS ATH9K WIRELESS DRIVER
10898M: QCA ath9k Development <ath9k-devel@qca.qualcomm.com>
10899L: linux-wireless@vger.kernel.org
10900W: http://wireless.kernel.org/en/users/Drivers/ath9k
10901S: Supported
10902F: drivers/net/wireless/ath/ath9k/
10903
10904QUALCOMM ATHEROS ATH10K WIRELESS DRIVER 10908QUALCOMM ATHEROS ATH10K WIRELESS DRIVER
10905M: Kalle Valo <kvalo@qca.qualcomm.com> 10909M: Kalle Valo <kvalo@qca.qualcomm.com>
10906L: ath10k@lists.infradead.org 10910L: ath10k@lists.infradead.org
@@ -10909,6 +10913,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
10909S: Supported 10913S: Supported
10910F: drivers/net/wireless/ath/ath10k/ 10914F: drivers/net/wireless/ath/ath10k/
10911 10915
10916QUALCOMM ATHEROS ATH9K WIRELESS DRIVER
10917M: QCA ath9k Development <ath9k-devel@qca.qualcomm.com>
10918L: linux-wireless@vger.kernel.org
10919W: http://wireless.kernel.org/en/users/Drivers/ath9k
10920S: Supported
10921F: drivers/net/wireless/ath/ath9k/
10922
10912QUALCOMM EMAC GIGABIT ETHERNET DRIVER 10923QUALCOMM EMAC GIGABIT ETHERNET DRIVER
10913M: Timur Tabi <timur@codeaurora.org> 10924M: Timur Tabi <timur@codeaurora.org>
10914L: netdev@vger.kernel.org 10925L: netdev@vger.kernel.org
@@ -10938,33 +10949,24 @@ T: git git://github.com/KrasnikovEugene/wcn36xx.git
10938S: Supported 10949S: Supported
10939F: drivers/net/wireless/ath/wcn36xx/ 10950F: drivers/net/wireless/ath/wcn36xx/
10940 10951
10941QEMU MACHINE EMULATOR AND VIRTUALIZER SUPPORT
10942M: Gabriel Somlo <somlo@cmu.edu>
10943M: "Michael S. Tsirkin" <mst@redhat.com>
10944L: qemu-devel@nongnu.org
10945S: Maintained
10946F: drivers/firmware/qemu_fw_cfg.c
10947
10948QUANTENNA QTNFMAC WIRELESS DRIVER 10952QUANTENNA QTNFMAC WIRELESS DRIVER
10949M: Igor Mitsyanko <imitsyanko@quantenna.com> 10953M: Igor Mitsyanko <imitsyanko@quantenna.com>
10950M: Avinash Patil <avinashp@quantenna.com> 10954M: Avinash Patil <avinashp@quantenna.com>
10951M: Sergey Matyukevich <smatyukevich@quantenna.com> 10955M: Sergey Matyukevich <smatyukevich@quantenna.com>
10952L: linux-wireless@vger.kernel.org 10956L: linux-wireless@vger.kernel.org
10953S: Maintained 10957S: Maintained
10954F: drivers/net/wireless/quantenna 10958F: drivers/net/wireless/quantenna
10955 10959
10956RADOS BLOCK DEVICE (RBD) 10960RADEON and AMDGPU DRM DRIVERS
10957M: Ilya Dryomov <idryomov@gmail.com> 10961M: Alex Deucher <alexander.deucher@amd.com>
10958M: Sage Weil <sage@redhat.com> 10962M: Christian König <christian.koenig@amd.com>
10959M: Alex Elder <elder@kernel.org> 10963L: amd-gfx@lists.freedesktop.org
10960L: ceph-devel@vger.kernel.org 10964T: git git://people.freedesktop.org/~agd5f/linux
10961W: http://ceph.com/
10962T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
10963T: git git://github.com/ceph/ceph-client.git
10964S: Supported 10965S: Supported
10965F: Documentation/ABI/testing/sysfs-bus-rbd 10966F: drivers/gpu/drm/radeon/
10966F: drivers/block/rbd.c 10967F: include/uapi/drm/radeon_drm.h
10967F: drivers/block/rbd_types.h 10968F: drivers/gpu/drm/amd/
10969F: include/uapi/drm/amdgpu_drm.h
10968 10970
10969RADEON FRAMEBUFFER DISPLAY DRIVER 10971RADEON FRAMEBUFFER DISPLAY DRIVER
10970M: Benjamin Herrenschmidt <benh@kernel.crashing.org> 10972M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
@@ -10988,6 +10990,19 @@ S: Maintained
10988F: drivers/media/radio/radio-shark2.c 10990F: drivers/media/radio/radio-shark2.c
10989F: drivers/media/radio/radio-tea5777.c 10991F: drivers/media/radio/radio-tea5777.c
10990 10992
10993RADOS BLOCK DEVICE (RBD)
10994M: Ilya Dryomov <idryomov@gmail.com>
10995M: Sage Weil <sage@redhat.com>
10996M: Alex Elder <elder@kernel.org>
10997L: ceph-devel@vger.kernel.org
10998W: http://ceph.com/
10999T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
11000T: git git://github.com/ceph/ceph-client.git
11001S: Supported
11002F: Documentation/ABI/testing/sysfs-bus-rbd
11003F: drivers/block/rbd.c
11004F: drivers/block/rbd_types.h
11005
10991RAGE128 FRAMEBUFFER DISPLAY DRIVER 11006RAGE128 FRAMEBUFFER DISPLAY DRIVER
10992M: Paul Mackerras <paulus@samba.org> 11007M: Paul Mackerras <paulus@samba.org>
10993L: linux-fbdev@vger.kernel.org 11008L: linux-fbdev@vger.kernel.org
@@ -11067,6 +11082,12 @@ L: netdev@vger.kernel.org
11067S: Maintained 11082S: Maintained
11068F: drivers/net/ethernet/rdc/r6040.c 11083F: drivers/net/ethernet/rdc/r6040.c
11069 11084
11085RDMAVT - RDMA verbs software
11086M: Dennis Dalessandro <dennis.dalessandro@intel.com>
11087L: linux-rdma@vger.kernel.org
11088S: Supported
11089F: drivers/infiniband/sw/rdmavt
11090
11070RDS - RELIABLE DATAGRAM SOCKETS 11091RDS - RELIABLE DATAGRAM SOCKETS
11071M: Santosh Shilimkar <santosh.shilimkar@oracle.com> 11092M: Santosh Shilimkar <santosh.shilimkar@oracle.com>
11072L: netdev@vger.kernel.org 11093L: netdev@vger.kernel.org
@@ -11077,12 +11098,6 @@ S: Supported
11077F: net/rds/ 11098F: net/rds/
11078F: Documentation/networking/rds.txt 11099F: Documentation/networking/rds.txt
11079 11100
11080RDMAVT - RDMA verbs software
11081M: Dennis Dalessandro <dennis.dalessandro@intel.com>
11082L: linux-rdma@vger.kernel.org
11083S: Supported
11084F: drivers/infiniband/sw/rdmavt
11085
11086RDT - RESOURCE ALLOCATION 11101RDT - RESOURCE ALLOCATION
11087M: Fenghua Yu <fenghua.yu@intel.com> 11102M: Fenghua Yu <fenghua.yu@intel.com>
11088L: linux-kernel@vger.kernel.org 11103L: linux-kernel@vger.kernel.org
@@ -11131,11 +11146,6 @@ S: Maintained
11131F: sound/soc/codecs/rt* 11146F: sound/soc/codecs/rt*
11132F: include/sound/rt*.h 11147F: include/sound/rt*.h
11133 11148
11134REISERFS FILE SYSTEM
11135L: reiserfs-devel@vger.kernel.org
11136S: Supported
11137F: fs/reiserfs/
11138
11139REGISTER MAP ABSTRACTION 11149REGISTER MAP ABSTRACTION
11140M: Mark Brown <broonie@kernel.org> 11150M: Mark Brown <broonie@kernel.org>
11141L: linux-kernel@vger.kernel.org 11151L: linux-kernel@vger.kernel.org
@@ -11145,6 +11155,11 @@ F: Documentation/devicetree/bindings/regmap/
11145F: drivers/base/regmap/ 11155F: drivers/base/regmap/
11146F: include/linux/regmap.h 11156F: include/linux/regmap.h
11147 11157
11158REISERFS FILE SYSTEM
11159L: reiserfs-devel@vger.kernel.org
11160S: Supported
11161F: fs/reiserfs/
11162
11148REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM 11163REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM
11149M: Ohad Ben-Cohen <ohad@wizery.com> 11164M: Ohad Ben-Cohen <ohad@wizery.com>
11150M: Bjorn Andersson <bjorn.andersson@linaro.org> 11165M: Bjorn Andersson <bjorn.andersson@linaro.org>
@@ -11220,16 +11235,16 @@ S: Maintained
11220F: lib/rhashtable.c 11235F: lib/rhashtable.c
11221F: include/linux/rhashtable.h 11236F: include/linux/rhashtable.h
11222 11237
11223RICOH SMARTMEDIA/XD DRIVER 11238RICOH R5C592 MEMORYSTICK DRIVER
11224M: Maxim Levitsky <maximlevitsky@gmail.com> 11239M: Maxim Levitsky <maximlevitsky@gmail.com>
11225S: Maintained 11240S: Maintained
11226F: drivers/mtd/nand/r852.c 11241F: drivers/memstick/host/r592.*
11227F: drivers/mtd/nand/r852.h
11228 11242
11229RICOH R5C592 MEMORYSTICK DRIVER 11243RICOH SMARTMEDIA/XD DRIVER
11230M: Maxim Levitsky <maximlevitsky@gmail.com> 11244M: Maxim Levitsky <maximlevitsky@gmail.com>
11231S: Maintained 11245S: Maintained
11232F: drivers/memstick/host/r592.* 11246F: drivers/mtd/nand/r852.c
11247F: drivers/mtd/nand/r852.h
11233 11248
11234ROCCAT DRIVERS 11249ROCCAT DRIVERS
11235M: Stefan Achatz <erazor_de@users.sourceforge.net> 11250M: Stefan Achatz <erazor_de@users.sourceforge.net>
@@ -11366,6 +11381,23 @@ S: Supported
11366F: drivers/s390/block/dasd* 11381F: drivers/s390/block/dasd*
11367F: block/partitions/ibm.c 11382F: block/partitions/ibm.c
11368 11383
11384S390 IOMMU (PCI)
11385M: Gerald Schaefer <gerald.schaefer@de.ibm.com>
11386L: linux-s390@vger.kernel.org
11387W: http://www.ibm.com/developerworks/linux/linux390/
11388S: Supported
11389F: drivers/iommu/s390-iommu.c
11390
11391S390 IUCV NETWORK LAYER
11392M: Julian Wiedmann <jwi@linux.vnet.ibm.com>
11393M: Ursula Braun <ubraun@linux.vnet.ibm.com>
11394L: linux-s390@vger.kernel.org
11395W: http://www.ibm.com/developerworks/linux/linux390/
11396S: Supported
11397F: drivers/s390/net/*iucv*
11398F: include/net/iucv/
11399F: net/iucv/
11400
11369S390 NETWORK DRIVERS 11401S390 NETWORK DRIVERS
11370M: Julian Wiedmann <jwi@linux.vnet.ibm.com> 11402M: Julian Wiedmann <jwi@linux.vnet.ibm.com>
11371M: Ursula Braun <ubraun@linux.vnet.ibm.com> 11403M: Ursula Braun <ubraun@linux.vnet.ibm.com>
@@ -11383,6 +11415,16 @@ S: Supported
11383F: arch/s390/pci/ 11415F: arch/s390/pci/
11384F: drivers/pci/hotplug/s390_pci_hpc.c 11416F: drivers/pci/hotplug/s390_pci_hpc.c
11385 11417
11418S390 VFIO-CCW DRIVER
11419M: Cornelia Huck <cohuck@redhat.com>
11420M: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
11421L: linux-s390@vger.kernel.org
11422L: kvm@vger.kernel.org
11423S: Supported
11424F: drivers/s390/cio/vfio_ccw*
11425F: Documentation/s390/vfio-ccw.txt
11426F: include/uapi/linux/vfio_ccw.h
11427
11386S390 ZCRYPT DRIVER 11428S390 ZCRYPT DRIVER
11387M: Harald Freudenberger <freude@de.ibm.com> 11429M: Harald Freudenberger <freude@de.ibm.com>
11388L: linux-s390@vger.kernel.org 11430L: linux-s390@vger.kernel.org
@@ -11397,33 +11439,6 @@ W: http://www.ibm.com/developerworks/linux/linux390/
11397S: Supported 11439S: Supported
11398F: drivers/s390/scsi/zfcp_* 11440F: drivers/s390/scsi/zfcp_*
11399 11441
11400S390 IUCV NETWORK LAYER
11401M: Julian Wiedmann <jwi@linux.vnet.ibm.com>
11402M: Ursula Braun <ubraun@linux.vnet.ibm.com>
11403L: linux-s390@vger.kernel.org
11404W: http://www.ibm.com/developerworks/linux/linux390/
11405S: Supported
11406F: drivers/s390/net/*iucv*
11407F: include/net/iucv/
11408F: net/iucv/
11409
11410S390 IOMMU (PCI)
11411M: Gerald Schaefer <gerald.schaefer@de.ibm.com>
11412L: linux-s390@vger.kernel.org
11413W: http://www.ibm.com/developerworks/linux/linux390/
11414S: Supported
11415F: drivers/iommu/s390-iommu.c
11416
11417S390 VFIO-CCW DRIVER
11418M: Cornelia Huck <cohuck@redhat.com>
11419M: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
11420L: linux-s390@vger.kernel.org
11421L: kvm@vger.kernel.org
11422S: Supported
11423F: drivers/s390/cio/vfio_ccw*
11424F: Documentation/s390/vfio-ccw.txt
11425F: include/uapi/linux/vfio_ccw.h
11426
11427S3C24XX SD/MMC Driver 11442S3C24XX SD/MMC Driver
11428M: Ben Dooks <ben-linux@fluff.org> 11443M: Ben Dooks <ben-linux@fluff.org>
11429L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 11444L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -11457,12 +11472,6 @@ F: drivers/media/common/saa7146/
11457F: drivers/media/pci/saa7146/ 11472F: drivers/media/pci/saa7146/
11458F: include/media/saa7146* 11473F: include/media/saa7146*
11459 11474
11460SAMSUNG LAPTOP DRIVER
11461M: Corentin Chary <corentin.chary@gmail.com>
11462L: platform-driver-x86@vger.kernel.org
11463S: Maintained
11464F: drivers/platform/x86/samsung-laptop.c
11465
11466SAMSUNG AUDIO (ASoC) DRIVERS 11475SAMSUNG AUDIO (ASoC) DRIVERS
11467M: Krzysztof Kozlowski <krzk@kernel.org> 11476M: Krzysztof Kozlowski <krzk@kernel.org>
11468M: Sangbeom Kim <sbkim73@samsung.com> 11477M: Sangbeom Kim <sbkim73@samsung.com>
@@ -11485,6 +11494,12 @@ L: linux-fbdev@vger.kernel.org
11485S: Maintained 11494S: Maintained
11486F: drivers/video/fbdev/s3c-fb.c 11495F: drivers/video/fbdev/s3c-fb.c
11487 11496
11497SAMSUNG LAPTOP DRIVER
11498M: Corentin Chary <corentin.chary@gmail.com>
11499L: platform-driver-x86@vger.kernel.org
11500S: Maintained
11501F: drivers/platform/x86/samsung-laptop.c
11502
11488SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS 11503SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS
11489M: Sangbeom Kim <sbkim73@samsung.com> 11504M: Sangbeom Kim <sbkim73@samsung.com>
11490M: Krzysztof Kozlowski <krzk@kernel.org> 11505M: Krzysztof Kozlowski <krzk@kernel.org>
@@ -11503,22 +11518,6 @@ F: Documentation/devicetree/bindings/regulator/samsung,s2m*.txt
11503F: Documentation/devicetree/bindings/regulator/samsung,s5m*.txt 11518F: Documentation/devicetree/bindings/regulator/samsung,s5m*.txt
11504F: Documentation/devicetree/bindings/clock/samsung,s2mps11.txt 11519F: Documentation/devicetree/bindings/clock/samsung,s2mps11.txt
11505 11520
11506SAMSUNG S5P Security SubSystem (SSS) DRIVER
11507M: Krzysztof Kozlowski <krzk@kernel.org>
11508M: Vladimir Zapolskiy <vz@mleia.com>
11509L: linux-crypto@vger.kernel.org
11510L: linux-samsung-soc@vger.kernel.org
11511S: Maintained
11512F: drivers/crypto/s5p-sss.c
11513
11514SAMSUNG S5P/EXYNOS4 SOC SERIES CAMERA SUBSYSTEM DRIVERS
11515M: Kyungmin Park <kyungmin.park@samsung.com>
11516M: Sylwester Nawrocki <s.nawrocki@samsung.com>
11517L: linux-media@vger.kernel.org
11518Q: https://patchwork.linuxtv.org/project/linux-media/list/
11519S: Supported
11520F: drivers/media/platform/exynos4-is/
11521
11522SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER 11521SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER
11523M: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> 11522M: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
11524L: linux-media@vger.kernel.org 11523L: linux-media@vger.kernel.org
@@ -11527,6 +11526,13 @@ S: Maintained
11527F: drivers/media/platform/s3c-camif/ 11526F: drivers/media/platform/s3c-camif/
11528F: include/media/drv-intf/s3c_camif.h 11527F: include/media/drv-intf/s3c_camif.h
11529 11528
11529SAMSUNG S3FWRN5 NFC DRIVER
11530M: Robert Baldyga <r.baldyga@samsung.com>
11531M: Krzysztof Opasiak <k.opasiak@samsung.com>
11532L: linux-nfc@lists.01.org (moderated for non-subscribers)
11533S: Supported
11534F: drivers/nfc/s3fwrn5
11535
11530SAMSUNG S5C73M3 CAMERA DRIVER 11536SAMSUNG S5C73M3 CAMERA DRIVER
11531M: Kyungmin Park <kyungmin.park@samsung.com> 11537M: Kyungmin Park <kyungmin.park@samsung.com>
11532M: Andrzej Hajda <a.hajda@samsung.com> 11538M: Andrzej Hajda <a.hajda@samsung.com>
@@ -11541,12 +11547,21 @@ L: linux-media@vger.kernel.org
11541S: Supported 11547S: Supported
11542F: drivers/media/i2c/s5k5baf.c 11548F: drivers/media/i2c/s5k5baf.c
11543 11549
11544SAMSUNG S3FWRN5 NFC DRIVER 11550SAMSUNG S5P Security SubSystem (SSS) DRIVER
11545M: Robert Baldyga <r.baldyga@samsung.com> 11551M: Krzysztof Kozlowski <krzk@kernel.org>
11546M: Krzysztof Opasiak <k.opasiak@samsung.com> 11552M: Vladimir Zapolskiy <vz@mleia.com>
11547L: linux-nfc@lists.01.org (moderated for non-subscribers) 11553L: linux-crypto@vger.kernel.org
11554L: linux-samsung-soc@vger.kernel.org
11555S: Maintained
11556F: drivers/crypto/s5p-sss.c
11557
11558SAMSUNG S5P/EXYNOS4 SOC SERIES CAMERA SUBSYSTEM DRIVERS
11559M: Kyungmin Park <kyungmin.park@samsung.com>
11560M: Sylwester Nawrocki <s.nawrocki@samsung.com>
11561L: linux-media@vger.kernel.org
11562Q: https://patchwork.linuxtv.org/project/linux-media/list/
11548S: Supported 11563S: Supported
11549F: drivers/nfc/s3fwrn5 11564F: drivers/media/platform/exynos4-is/
11550 11565
11551SAMSUNG SOC CLOCK DRIVERS 11566SAMSUNG SOC CLOCK DRIVERS
11552M: Sylwester Nawrocki <s.nawrocki@samsung.com> 11567M: Sylwester Nawrocki <s.nawrocki@samsung.com>
@@ -11599,126 +11614,6 @@ F: drivers/phy/samsung/phy-s5pv210-usb2.c
11599F: drivers/phy/samsung/phy-samsung-usb2.c 11614F: drivers/phy/samsung/phy-samsung-usb2.c
11600F: drivers/phy/samsung/phy-samsung-usb2.h 11615F: drivers/phy/samsung/phy-samsung-usb2.h
11601 11616
11602SERIAL DRIVERS
11603M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11604L: linux-serial@vger.kernel.org
11605S: Maintained
11606F: Documentation/devicetree/bindings/serial/
11607F: drivers/tty/serial/
11608
11609SERIAL DEVICE BUS
11610M: Rob Herring <robh@kernel.org>
11611L: linux-serial@vger.kernel.org
11612S: Maintained
11613F: Documentation/devicetree/bindings/serial/slave-device.txt
11614F: drivers/tty/serdev/
11615F: include/linux/serdev.h
11616
11617SERIAL IR RECEIVER
11618M: Sean Young <sean@mess.org>
11619L: linux-media@vger.kernel.org
11620S: Maintained
11621F: drivers/media/rc/serial_ir.c
11622
11623STI CEC DRIVER
11624M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
11625S: Maintained
11626F: drivers/staging/media/st-cec/
11627F: Documentation/devicetree/bindings/media/stih-cec.txt
11628
11629SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
11630M: Ursula Braun <ubraun@linux.vnet.ibm.com>
11631L: linux-s390@vger.kernel.org
11632W: http://www.ibm.com/developerworks/linux/linux390/
11633S: Supported
11634F: net/smc/
11635
11636SYNOPSYS DESIGNWARE DMAC DRIVER
11637M: Viresh Kumar <vireshk@kernel.org>
11638M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
11639S: Maintained
11640F: include/linux/dma/dw.h
11641F: include/linux/platform_data/dma-dw.h
11642F: drivers/dma/dw/
11643
11644SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER
11645M: Jie Deng <jiedeng@synopsys.com>
11646L: netdev@vger.kernel.org
11647S: Supported
11648F: drivers/net/ethernet/synopsys/
11649
11650SYNOPSYS DESIGNWARE I2C DRIVER
11651M: Jarkko Nikula <jarkko.nikula@linux.intel.com>
11652R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
11653R: Mika Westerberg <mika.westerberg@linux.intel.com>
11654L: linux-i2c@vger.kernel.org
11655S: Maintained
11656F: drivers/i2c/busses/i2c-designware-*
11657F: include/linux/platform_data/i2c-designware.h
11658
11659SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
11660M: Jaehoon Chung <jh80.chung@samsung.com>
11661L: linux-mmc@vger.kernel.org
11662S: Maintained
11663F: drivers/mmc/host/dw_mmc*
11664
11665SYSTEM TRACE MODULE CLASS
11666M: Alexander Shishkin <alexander.shishkin@linux.intel.com>
11667S: Maintained
11668T: git git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git
11669F: Documentation/trace/stm.txt
11670F: drivers/hwtracing/stm/
11671F: include/linux/stm.h
11672F: include/uapi/linux/stm.h
11673
11674TEE SUBSYSTEM
11675M: Jens Wiklander <jens.wiklander@linaro.org>
11676S: Maintained
11677F: include/linux/tee_drv.h
11678F: include/uapi/linux/tee.h
11679F: drivers/tee/
11680F: Documentation/tee.txt
11681
11682THUNDERBOLT DRIVER
11683M: Andreas Noever <andreas.noever@gmail.com>
11684M: Michael Jamet <michael.jamet@intel.com>
11685M: Mika Westerberg <mika.westerberg@linux.intel.com>
11686M: Yehezkel Bernat <yehezkel.bernat@intel.com>
11687S: Maintained
11688F: drivers/thunderbolt/
11689
11690TI BQ27XXX POWER SUPPLY DRIVER
11691R: Andrew F. Davis <afd@ti.com>
11692F: include/linux/power/bq27xxx_battery.h
11693F: drivers/power/supply/bq27xxx_battery.c
11694F: drivers/power/supply/bq27xxx_battery_i2c.c
11695
11696TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
11697M: John Stultz <john.stultz@linaro.org>
11698M: Thomas Gleixner <tglx@linutronix.de>
11699R: Stephen Boyd <sboyd@codeaurora.org>
11700L: linux-kernel@vger.kernel.org
11701T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
11702S: Supported
11703F: include/linux/clocksource.h
11704F: include/linux/time.h
11705F: include/linux/timex.h
11706F: include/uapi/linux/time.h
11707F: include/uapi/linux/timex.h
11708F: kernel/time/clocksource.c
11709F: kernel/time/time*.c
11710F: kernel/time/alarmtimer.c
11711F: kernel/time/ntp.c
11712F: tools/testing/selftests/timers/
11713
11714TI TRF7970A NFC DRIVER
11715M: Mark Greer <mgreer@animalcreek.com>
11716L: linux-wireless@vger.kernel.org
11717L: linux-nfc@lists.01.org (moderated for non-subscribers)
11718S: Supported
11719F: drivers/nfc/trf7970a.c
11720F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
11721
11722SC1200 WDT DRIVER 11617SC1200 WDT DRIVER
11723M: Zwane Mwaikambo <zwanem@gmail.com> 11618M: Zwane Mwaikambo <zwanem@gmail.com>
11724S: Maintained 11619S: Maintained
@@ -11747,16 +11642,6 @@ M: Lubomir Rintel <lkundrak@v3.sk>
11747S: Supported 11642S: Supported
11748F: drivers/char/pcmcia/scr24x_cs.c 11643F: drivers/char/pcmcia/scr24x_cs.c
11749 11644
11750SYSTEM CONTROL & POWER INTERFACE (SCPI) Message Protocol drivers
11751M: Sudeep Holla <sudeep.holla@arm.com>
11752L: linux-arm-kernel@lists.infradead.org
11753S: Maintained
11754F: Documentation/devicetree/bindings/arm/arm,scpi.txt
11755F: drivers/clk/clk-scpi.c
11756F: drivers/cpufreq/scpi-cpufreq.c
11757F: drivers/firmware/arm_scpi.c
11758F: include/linux/scpi_protocol.h
11759
11760SCSI CDROM DRIVER 11645SCSI CDROM DRIVER
11761M: Jens Axboe <axboe@kernel.dk> 11646M: Jens Axboe <axboe@kernel.dk>
11762L: linux-scsi@vger.kernel.org 11647L: linux-scsi@vger.kernel.org
@@ -11841,14 +11726,6 @@ L: sdricohcs-devel@lists.sourceforge.net (subscribers-only)
11841S: Maintained 11726S: Maintained
11842F: drivers/mmc/host/sdricoh_cs.c 11727F: drivers/mmc/host/sdricoh_cs.c
11843 11728
11844SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER
11845M: Adrian Hunter <adrian.hunter@intel.com>
11846L: linux-mmc@vger.kernel.org
11847T: git git://git.infradead.org/users/ahunter/linux-sdhci.git
11848S: Maintained
11849F: drivers/mmc/host/sdhci*
11850F: include/linux/mmc/sdhci*
11851
11852SECURE COMPUTING 11729SECURE COMPUTING
11853M: Kees Cook <keescook@chromium.org> 11730M: Kees Cook <keescook@chromium.org>
11854R: Andy Lutomirski <luto@amacapital.net> 11731R: Andy Lutomirski <luto@amacapital.net>
@@ -11871,6 +11748,14 @@ L: bcm-kernel-feedback-list@broadcom.com
11871S: Maintained 11748S: Maintained
11872F: drivers/mmc/host/sdhci-brcmstb* 11749F: drivers/mmc/host/sdhci-brcmstb*
11873 11750
11751SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER
11752M: Adrian Hunter <adrian.hunter@intel.com>
11753L: linux-mmc@vger.kernel.org
11754T: git git://git.infradead.org/users/ahunter/linux-sdhci.git
11755S: Maintained
11756F: drivers/mmc/host/sdhci*
11757F: include/linux/mmc/sdhci*
11758
11874SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER 11759SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER
11875M: Ben Dooks <ben-linux@fluff.org> 11760M: Ben Dooks <ben-linux@fluff.org>
11876M: Jaehoon Chung <jh80.chung@samsung.com> 11761M: Jaehoon Chung <jh80.chung@samsung.com>
@@ -11895,6 +11780,10 @@ F: block/opal_proto.h
11895F: include/linux/sed* 11780F: include/linux/sed*
11896F: include/uapi/linux/sed* 11781F: include/uapi/linux/sed*
11897 11782
11783SECURITY CONTACT
11784M: Security Officers <security@kernel.org>
11785S: Supported
11786
11898SECURITY SUBSYSTEM 11787SECURITY SUBSYSTEM
11899M: James Morris <james.l.morris@oracle.com> 11788M: James Morris <james.l.morris@oracle.com>
11900M: "Serge E. Hallyn" <serge@hallyn.com> 11789M: "Serge E. Hallyn" <serge@hallyn.com>
@@ -11904,10 +11793,6 @@ W: http://kernsec.org/
11904S: Supported 11793S: Supported
11905F: security/ 11794F: security/
11906 11795
11907SECURITY CONTACT
11908M: Security Officers <security@kernel.org>
11909S: Supported
11910
11911SELINUX SECURITY MODULE 11796SELINUX SECURITY MODULE
11912M: Paul Moore <paul@paul-moore.com> 11797M: Paul Moore <paul@paul-moore.com>
11913M: Stephen Smalley <sds@tycho.nsa.gov> 11798M: Stephen Smalley <sds@tycho.nsa.gov>
@@ -11921,62 +11806,32 @@ F: security/selinux/
11921F: scripts/selinux/ 11806F: scripts/selinux/
11922F: Documentation/admin-guide/LSM/SELinux.rst 11807F: Documentation/admin-guide/LSM/SELinux.rst
11923 11808
11924APPARMOR SECURITY MODULE
11925M: John Johansen <john.johansen@canonical.com>
11926L: apparmor@lists.ubuntu.com (subscribers-only, general discussion)
11927W: apparmor.wiki.kernel.org
11928T: git git://git.kernel.org/pub/scm/linux/kernel/git/jj/apparmor-dev.git
11929S: Supported
11930F: security/apparmor/
11931F: Documentation/admin-guide/LSM/apparmor.rst
11932
11933LOADPIN SECURITY MODULE
11934M: Kees Cook <keescook@chromium.org>
11935T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git lsm/loadpin
11936S: Supported
11937F: security/loadpin/
11938F: Documentation/admin-guide/LSM/LoadPin.rst
11939
11940YAMA SECURITY MODULE
11941M: Kees Cook <keescook@chromium.org>
11942T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip
11943S: Supported
11944F: security/yama/
11945F: Documentation/admin-guide/LSM/Yama.rst
11946
11947SENSABLE PHANTOM 11809SENSABLE PHANTOM
11948M: Jiri Slaby <jirislaby@gmail.com> 11810M: Jiri Slaby <jirislaby@gmail.com>
11949S: Maintained 11811S: Maintained
11950F: drivers/misc/phantom.c 11812F: drivers/misc/phantom.c
11951F: include/uapi/linux/phantom.h 11813F: include/uapi/linux/phantom.h
11952 11814
11953Emulex 10Gbps iSCSI - OneConnect DRIVER 11815SERIAL DEVICE BUS
11954M: Subbu Seetharaman <subbu.seetharaman@broadcom.com> 11816M: Rob Herring <robh@kernel.org>
11955M: Ketan Mukadam <ketan.mukadam@broadcom.com> 11817L: linux-serial@vger.kernel.org
11956M: Jitendra Bhivare <jitendra.bhivare@broadcom.com> 11818S: Maintained
11957L: linux-scsi@vger.kernel.org 11819F: Documentation/devicetree/bindings/serial/slave-device.txt
11958W: http://www.broadcom.com 11820F: drivers/tty/serdev/
11959S: Supported 11821F: include/linux/serdev.h
11960F: drivers/scsi/be2iscsi/
11961 11822
11962Emulex 10Gbps NIC BE2, BE3-R, Lancer, Skyhawk-R DRIVER (be2net) 11823SERIAL DRIVERS
11963M: Sathya Perla <sathya.perla@broadcom.com> 11824M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11964M: Ajit Khaparde <ajit.khaparde@broadcom.com> 11825L: linux-serial@vger.kernel.org
11965M: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> 11826S: Maintained
11966M: Somnath Kotur <somnath.kotur@broadcom.com> 11827F: Documentation/devicetree/bindings/serial/
11967L: netdev@vger.kernel.org 11828F: drivers/tty/serial/
11968W: http://www.emulex.com
11969S: Supported
11970F: drivers/net/ethernet/emulex/benet/
11971 11829
11972EMULEX ONECONNECT ROCE DRIVER 11830SERIAL IR RECEIVER
11973M: Selvin Xavier <selvin.xavier@broadcom.com> 11831M: Sean Young <sean@mess.org>
11974M: Devesh Sharma <devesh.sharma@broadcom.com> 11832L: linux-media@vger.kernel.org
11975L: linux-rdma@vger.kernel.org 11833S: Maintained
11976W: http://www.broadcom.com 11834F: drivers/media/rc/serial_ir.c
11977S: Odd Fixes
11978F: drivers/infiniband/hw/ocrdma/
11979F: include/uapi/rdma/ocrdma-abi.h
11980 11835
11981SFC NETWORK DRIVER 11836SFC NETWORK DRIVER
11982M: Solarflare linux maintainers <linux-net-drivers@solarflare.com> 11837M: Solarflare linux maintainers <linux-net-drivers@solarflare.com>
@@ -12005,6 +11860,24 @@ M: Robin Holt <robinmholt@gmail.com>
12005S: Maintained 11860S: Maintained
12006F: drivers/misc/sgi-xp/ 11861F: drivers/misc/sgi-xp/
12007 11862
11863SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
11864M: Ursula Braun <ubraun@linux.vnet.ibm.com>
11865L: linux-s390@vger.kernel.org
11866W: http://www.ibm.com/developerworks/linux/linux390/
11867S: Supported
11868F: net/smc/
11869
11870SH_VEU V4L2 MEM2MEM DRIVER
11871L: linux-media@vger.kernel.org
11872S: Orphan
11873F: drivers/media/platform/sh_veu.c
11874
11875SH_VOU V4L2 OUTPUT DRIVER
11876L: linux-media@vger.kernel.org
11877S: Orphan
11878F: drivers/media/platform/sh_vou.c
11879F: include/media/drv-intf/sh_vou.h
11880
12008SI2157 MEDIA DRIVER 11881SI2157 MEDIA DRIVER
12009M: Antti Palosaari <crope@iki.fi> 11882M: Antti Palosaari <crope@iki.fi>
12010L: linux-media@vger.kernel.org 11883L: linux-media@vger.kernel.org
@@ -12087,24 +11960,14 @@ S: Maintained
12087F: drivers/input/touchscreen/silead.c 11960F: drivers/input/touchscreen/silead.c
12088F: drivers/platform/x86/silead_dmi.c 11961F: drivers/platform/x86/silead_dmi.c
12089 11962
12090SIMPLEFB FB DRIVER 11963SILICON MOTION SM712 FRAME BUFFER DRIVER
12091M: Hans de Goede <hdegoede@redhat.com> 11964M: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
11965M: Teddy Wang <teddy.wang@siliconmotion.com>
11966M: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
12092L: linux-fbdev@vger.kernel.org 11967L: linux-fbdev@vger.kernel.org
12093S: Maintained 11968S: Maintained
12094F: Documentation/devicetree/bindings/display/simple-framebuffer.txt 11969F: drivers/video/fbdev/sm712*
12095F: drivers/video/fbdev/simplefb.c 11970F: Documentation/fb/sm712fb.txt
12096F: include/linux/platform_data/simplefb.h
12097
12098SH_VEU V4L2 MEM2MEM DRIVER
12099L: linux-media@vger.kernel.org
12100S: Orphan
12101F: drivers/media/platform/sh_veu.c
12102
12103SH_VOU V4L2 OUTPUT DRIVER
12104L: linux-media@vger.kernel.org
12105S: Orphan
12106F: drivers/media/platform/sh_vou.c
12107F: include/media/drv-intf/sh_vou.h
12108 11971
12109SIMPLE FIRMWARE INTERFACE (SFI) 11972SIMPLE FIRMWARE INTERFACE (SFI)
12110M: Len Brown <lenb@kernel.org> 11973M: Len Brown <lenb@kernel.org>
@@ -12116,6 +11979,14 @@ F: arch/x86/platform/sfi/
12116F: drivers/sfi/ 11979F: drivers/sfi/
12117F: include/linux/sfi*.h 11980F: include/linux/sfi*.h
12118 11981
11982SIMPLEFB FB DRIVER
11983M: Hans de Goede <hdegoede@redhat.com>
11984L: linux-fbdev@vger.kernel.org
11985S: Maintained
11986F: Documentation/devicetree/bindings/display/simple-framebuffer.txt
11987F: drivers/video/fbdev/simplefb.c
11988F: include/linux/platform_data/simplefb.h
11989
12119SIMTEC EB110ATX (Chalice CATS) 11990SIMTEC EB110ATX (Chalice CATS)
12120P: Ben Dooks 11991P: Ben Dooks
12121P: Vincent Sanders <vince@simtec.co.uk> 11992P: Vincent Sanders <vince@simtec.co.uk>
@@ -12140,61 +12011,6 @@ F: lib/siphash.c
12140F: lib/test_siphash.c 12011F: lib/test_siphash.c
12141F: include/linux/siphash.h 12012F: include/linux/siphash.h
12142 12013
12143TI DAVINCI MACHINE SUPPORT
12144M: Sekhar Nori <nsekhar@ti.com>
12145M: Kevin Hilman <khilman@kernel.org>
12146L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
12147T: git git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git
12148S: Supported
12149F: arch/arm/mach-davinci/
12150F: drivers/i2c/busses/i2c-davinci.c
12151F: arch/arm/boot/dts/da850*
12152
12153TI DAVINCI SERIES MEDIA DRIVER
12154M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
12155L: linux-media@vger.kernel.org
12156W: https://linuxtv.org
12157Q: http://patchwork.linuxtv.org/project/linux-media/list/
12158T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
12159S: Maintained
12160F: drivers/media/platform/davinci/
12161F: include/media/davinci/
12162
12163TI DAVINCI SERIES GPIO DRIVER
12164M: Keerthy <j-keerthy@ti.com>
12165L: linux-gpio@vger.kernel.org
12166S: Maintained
12167F: Documentation/devicetree/bindings/gpio/gpio-davinci.txt
12168F: drivers/gpio/gpio-davinci.c
12169
12170TI AM437X VPFE DRIVER
12171M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
12172L: linux-media@vger.kernel.org
12173W: https://linuxtv.org
12174Q: http://patchwork.linuxtv.org/project/linux-media/list/
12175T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
12176S: Maintained
12177F: drivers/media/platform/am437x/
12178
12179OV2659 OMNIVISION SENSOR DRIVER
12180M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
12181L: linux-media@vger.kernel.org
12182W: https://linuxtv.org
12183Q: http://patchwork.linuxtv.org/project/linux-media/list/
12184T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
12185S: Maintained
12186F: drivers/media/i2c/ov2659.c
12187F: include/media/i2c/ov2659.h
12188
12189SILICON MOTION SM712 FRAME BUFFER DRIVER
12190M: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
12191M: Teddy Wang <teddy.wang@siliconmotion.com>
12192M: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
12193L: linux-fbdev@vger.kernel.org
12194S: Maintained
12195F: drivers/video/fbdev/sm712*
12196F: Documentation/fb/sm712fb.txt
12197
12198SIS 190 ETHERNET DRIVER 12014SIS 190 ETHERNET DRIVER
12199M: Francois Romieu <romieu@fr.zoreil.com> 12015M: Francois Romieu <romieu@fr.zoreil.com>
12200L: netdev@vger.kernel.org 12016L: netdev@vger.kernel.org
@@ -12255,14 +12071,6 @@ S: Maintained
12255F: Documentation/admin-guide/LSM/Smack.rst 12071F: Documentation/admin-guide/LSM/Smack.rst
12256F: security/smack/ 12072F: security/smack/
12257 12073
12258DRIVERS FOR ADAPTIVE VOLTAGE SCALING (AVS)
12259M: Kevin Hilman <khilman@kernel.org>
12260M: Nishanth Menon <nm@ti.com>
12261S: Maintained
12262F: drivers/power/avs/
12263F: include/linux/power/smartreflex.h
12264L: linux-pm@vger.kernel.org
12265
12266SMC91x ETHERNET DRIVER 12074SMC91x ETHERNET DRIVER
12267M: Nicolas Pitre <nico@fluxnic.net> 12075M: Nicolas Pitre <nico@fluxnic.net>
12268S: Odd Fixes 12076S: Odd Fixes
@@ -12300,6 +12108,12 @@ S: Supported
12300F: Documentation/hwmon/sch5627 12108F: Documentation/hwmon/sch5627
12301F: drivers/hwmon/sch5627.c 12109F: drivers/hwmon/sch5627.c
12302 12110
12111SMSC UFX6000 and UFX7000 USB to VGA DRIVER
12112M: Steve Glendinning <steve.glendinning@shawell.net>
12113L: linux-fbdev@vger.kernel.org
12114S: Maintained
12115F: drivers/video/fbdev/smscufx.c
12116
12303SMSC47B397 HARDWARE MONITOR DRIVER 12117SMSC47B397 HARDWARE MONITOR DRIVER
12304M: Jean Delvare <jdelvare@suse.com> 12118M: Jean Delvare <jdelvare@suse.com>
12305L: linux-hwmon@vger.kernel.org 12119L: linux-hwmon@vger.kernel.org
@@ -12320,12 +12134,6 @@ L: netdev@vger.kernel.org
12320S: Maintained 12134S: Maintained
12321F: drivers/net/ethernet/smsc/smsc9420.* 12135F: drivers/net/ethernet/smsc/smsc9420.*
12322 12136
12323SMSC UFX6000 and UFX7000 USB to VGA DRIVER
12324M: Steve Glendinning <steve.glendinning@shawell.net>
12325L: linux-fbdev@vger.kernel.org
12326S: Maintained
12327F: drivers/video/fbdev/smscufx.c
12328
12329SOC-CAMERA V4L2 SUBSYSTEM 12137SOC-CAMERA V4L2 SUBSYSTEM
12330M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> 12138M: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
12331L: linux-media@vger.kernel.org 12139L: linux-media@vger.kernel.org
@@ -12340,6 +12148,15 @@ M: Chris Boot <bootc@bootc.net>
12340S: Maintained 12148S: Maintained
12341F: drivers/leds/leds-net48xx.c 12149F: drivers/leds/leds-net48xx.c
12342 12150
12151SOFT-ROCE DRIVER (rxe)
12152M: Moni Shoua <monis@mellanox.com>
12153L: linux-rdma@vger.kernel.org
12154S: Supported
12155W: https://github.com/SoftRoCE/rxe-dev/wiki/rxe-dev:-Home
12156Q: http://patchwork.kernel.org/project/linux-rdma/list/
12157F: drivers/infiniband/sw/rxe/
12158F: include/uapi/rdma/rdma_user_rxe.h
12159
12343SOFTLOGIC 6x10 MPEG CODEC 12160SOFTLOGIC 6x10 MPEG CODEC
12344M: Bluecherry Maintainers <maintainers@bluecherrydvr.com> 12161M: Bluecherry Maintainers <maintainers@bluecherrydvr.com>
12345M: Anton Sviridenko <anton@corp.bluecherry.net> 12162M: Anton Sviridenko <anton@corp.bluecherry.net>
@@ -12372,16 +12189,6 @@ S: Maintained
12372F: drivers/ssb/ 12189F: drivers/ssb/
12373F: include/linux/ssb/ 12190F: include/linux/ssb/
12374 12191
12375SONY VAIO CONTROL DEVICE DRIVER
12376M: Mattia Dongili <malattia@linux.it>
12377L: platform-driver-x86@vger.kernel.org
12378W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
12379S: Maintained
12380F: Documentation/laptops/sony-laptop.txt
12381F: drivers/char/sonypi.c
12382F: drivers/platform/x86/sony-laptop.c
12383F: include/linux/sony-laptop.h
12384
12385SONY MEMORYSTICK CARD SUPPORT 12192SONY MEMORYSTICK CARD SUPPORT
12386M: Alex Dubov <oakad@yahoo.com> 12193M: Alex Dubov <oakad@yahoo.com>
12387W: http://tifmxx.berlios.de/ 12194W: http://tifmxx.berlios.de/
@@ -12393,6 +12200,16 @@ M: Maxim Levitsky <maximlevitsky@gmail.com>
12393S: Maintained 12200S: Maintained
12394F: drivers/memstick/core/ms_block.* 12201F: drivers/memstick/core/ms_block.*
12395 12202
12203SONY VAIO CONTROL DEVICE DRIVER
12204M: Mattia Dongili <malattia@linux.it>
12205L: platform-driver-x86@vger.kernel.org
12206W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers
12207S: Maintained
12208F: Documentation/laptops/sony-laptop.txt
12209F: drivers/char/sonypi.c
12210F: drivers/platform/x86/sony-laptop.c
12211F: include/linux/sony-laptop.h
12212
12396SOUND 12213SOUND
12397M: Jaroslav Kysela <perex@perex.cz> 12214M: Jaroslav Kysela <perex@perex.cz>
12398M: Takashi Iwai <tiwai@suse.com> 12215M: Takashi Iwai <tiwai@suse.com>
@@ -12418,6 +12235,13 @@ F: include/uapi/sound/compress_*
12418F: sound/core/compress_offload.c 12235F: sound/core/compress_offload.c
12419F: sound/soc/soc-compress.c 12236F: sound/soc/soc-compress.c
12420 12237
12238SOUND - DMAENGINE HELPERS
12239M: Lars-Peter Clausen <lars@metafoo.de>
12240S: Supported
12241F: include/sound/dmaengine_pcm.h
12242F: sound/core/pcm_dmaengine.c
12243F: sound/soc/soc-generic-dmaengine-pcm.c
12244
12421SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) 12245SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC)
12422M: Liam Girdwood <lgirdwood@gmail.com> 12246M: Liam Girdwood <lgirdwood@gmail.com>
12423M: Mark Brown <broonie@kernel.org> 12247M: Mark Brown <broonie@kernel.org>
@@ -12430,13 +12254,6 @@ F: Documentation/sound/alsa/soc/
12430F: sound/soc/ 12254F: sound/soc/
12431F: include/sound/soc* 12255F: include/sound/soc*
12432 12256
12433SOUND - DMAENGINE HELPERS
12434M: Lars-Peter Clausen <lars@metafoo.de>
12435S: Supported
12436F: include/sound/dmaengine_pcm.h
12437F: sound/core/pcm_dmaengine.c
12438F: sound/soc/soc-generic-dmaengine-pcm.c
12439
12440SP2 MEDIA DRIVER 12257SP2 MEDIA DRIVER
12441M: Olli Salonen <olli.salonen@iki.fi> 12258M: Olli Salonen <olli.salonen@iki.fi>
12442L: linux-media@vger.kernel.org 12259L: linux-media@vger.kernel.org
@@ -12479,21 +12296,21 @@ T: git git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git
12479S: Maintained 12296S: Maintained
12480F: include/linux/compiler.h 12297F: include/linux/compiler.h
12481 12298
12482SPEAR PLATFORM SUPPORT 12299SPEAR CLOCK FRAMEWORK SUPPORT
12483M: Viresh Kumar <vireshk@kernel.org> 12300M: Viresh Kumar <vireshk@kernel.org>
12484M: Shiraz Hashim <shiraz.linux.kernel@gmail.com>
12485L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 12301L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
12486W: http://www.st.com/spear 12302W: http://www.st.com/spear
12487S: Maintained 12303S: Maintained
12488F: arch/arm/boot/dts/spear* 12304F: drivers/clk/spear/
12489F: arch/arm/mach-spear/
12490 12305
12491SPEAR CLOCK FRAMEWORK SUPPORT 12306SPEAR PLATFORM SUPPORT
12492M: Viresh Kumar <vireshk@kernel.org> 12307M: Viresh Kumar <vireshk@kernel.org>
12308M: Shiraz Hashim <shiraz.linux.kernel@gmail.com>
12493L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 12309L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
12494W: http://www.st.com/spear 12310W: http://www.st.com/spear
12495S: Maintained 12311S: Maintained
12496F: drivers/clk/spear/ 12312F: arch/arm/boot/dts/spear*
12313F: arch/arm/mach-spear/
12497 12314
12498SPI NOR SUBSYSTEM 12315SPI NOR SUBSYSTEM
12499M: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr> 12316M: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
@@ -12527,6 +12344,15 @@ S: Supported
12527F: Documentation/networking/spider_net.txt 12344F: Documentation/networking/spider_net.txt
12528F: drivers/net/ethernet/toshiba/spider_net* 12345F: drivers/net/ethernet/toshiba/spider_net*
12529 12346
12347SPMI SUBSYSTEM
12348R: Stephen Boyd <sboyd@codeaurora.org>
12349L: linux-arm-msm@vger.kernel.org
12350F: Documentation/devicetree/bindings/spmi/
12351F: drivers/spmi/
12352F: include/dt-bindings/spmi/spmi.h
12353F: include/linux/spmi.h
12354F: include/trace/events/spmi.h
12355
12530SPU FILE SYSTEM 12356SPU FILE SYSTEM
12531M: Jeremy Kerr <jk@ozlabs.org> 12357M: Jeremy Kerr <jk@ozlabs.org>
12532L: linuxppc-dev@lists.ozlabs.org 12358L: linuxppc-dev@lists.ozlabs.org
@@ -12555,13 +12381,6 @@ L: stable@vger.kernel.org
12555S: Supported 12381S: Supported
12556F: Documentation/process/stable-kernel-rules.rst 12382F: Documentation/process/stable-kernel-rules.rst
12557 12383
12558STAGING SUBSYSTEM
12559M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12560T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
12561L: devel@driverdev.osuosl.org
12562S: Supported
12563F: drivers/staging/
12564
12565STAGING - COMEDI 12384STAGING - COMEDI
12566M: Ian Abbott <abbotti@mev.co.uk> 12385M: Ian Abbott <abbotti@mev.co.uk>
12567M: H Hartley Sweeten <hsweeten@visionengravers.com> 12386M: H Hartley Sweeten <hsweeten@visionengravers.com>
@@ -12651,11 +12470,39 @@ M: Arnaud Patard <arnaud.patard@rtp-net.org>
12651S: Odd Fixes 12470S: Odd Fixes
12652F: drivers/staging/xgifb/ 12471F: drivers/staging/xgifb/
12653 12472
12473STAGING SUBSYSTEM
12474M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
12475T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
12476L: devel@driverdev.osuosl.org
12477S: Supported
12478F: drivers/staging/
12479
12654STARFIRE/DURALAN NETWORK DRIVER 12480STARFIRE/DURALAN NETWORK DRIVER
12655M: Ion Badulescu <ionut@badula.org> 12481M: Ion Badulescu <ionut@badula.org>
12656S: Odd Fixes 12482S: Odd Fixes
12657F: drivers/net/ethernet/adaptec/starfire* 12483F: drivers/net/ethernet/adaptec/starfire*
12658 12484
12485STI CEC DRIVER
12486M: Benjamin Gaignard <benjamin.gaignard@linaro.org>
12487S: Maintained
12488F: drivers/staging/media/st-cec/
12489F: Documentation/devicetree/bindings/media/stih-cec.txt
12490
12491STK1160 USB VIDEO CAPTURE DRIVER
12492M: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
12493L: linux-media@vger.kernel.org
12494T: git git://linuxtv.org/media_tree.git
12495S: Maintained
12496F: drivers/media/usb/stk1160/
12497
12498STMMAC ETHERNET DRIVER
12499M: Giuseppe Cavallaro <peppe.cavallaro@st.com>
12500M: Alexandre Torgue <alexandre.torgue@st.com>
12501L: netdev@vger.kernel.org
12502W: http://www.stlinux.com
12503S: Supported
12504F: drivers/net/ethernet/stmicro/stmmac/
12505
12659SUN3/3X 12506SUN3/3X
12660M: Sam Creasey <sammy@sammy.net> 12507M: Sam Creasey <sammy@sammy.net>
12661W: http://sammy.net/sun3/ 12508W: http://sammy.net/sun3/
@@ -12727,6 +12574,20 @@ S: Supported
12727F: net/switchdev/ 12574F: net/switchdev/
12728F: include/net/switchdev.h 12575F: include/net/switchdev.h
12729 12576
12577SYNC FILE FRAMEWORK
12578M: Sumit Semwal <sumit.semwal@linaro.org>
12579R: Gustavo Padovan <gustavo@padovan.org>
12580S: Maintained
12581L: linux-media@vger.kernel.org
12582L: dri-devel@lists.freedesktop.org
12583F: drivers/dma-buf/sync_*
12584F: drivers/dma-buf/dma-fence*
12585F: drivers/dma-buf/sw_sync.c
12586F: include/linux/sync_file.h
12587F: include/uapi/linux/sync_file.h
12588F: Documentation/sync_file.txt
12589T: git git://anongit.freedesktop.org/drm/drm-misc
12590
12730SYNOPSYS ARC ARCHITECTURE 12591SYNOPSYS ARC ARCHITECTURE
12731M: Vineet Gupta <vgupta@synopsys.com> 12592M: Vineet Gupta <vgupta@synopsys.com>
12732L: linux-snps-arc@lists.infradead.org 12593L: linux-snps-arc@lists.infradead.org
@@ -12745,6 +12606,35 @@ F: arch/arc/plat-axs10x
12745F: arch/arc/boot/dts/ax* 12606F: arch/arc/boot/dts/ax*
12746F: Documentation/devicetree/bindings/arc/axs10* 12607F: Documentation/devicetree/bindings/arc/axs10*
12747 12608
12609SYNOPSYS DESIGNWARE DMAC DRIVER
12610M: Viresh Kumar <vireshk@kernel.org>
12611M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
12612S: Maintained
12613F: include/linux/dma/dw.h
12614F: include/linux/platform_data/dma-dw.h
12615F: drivers/dma/dw/
12616
12617SYNOPSYS DESIGNWARE ENTERPRISE ETHERNET DRIVER
12618M: Jie Deng <jiedeng@synopsys.com>
12619L: netdev@vger.kernel.org
12620S: Supported
12621F: drivers/net/ethernet/synopsys/
12622
12623SYNOPSYS DESIGNWARE I2C DRIVER
12624M: Jarkko Nikula <jarkko.nikula@linux.intel.com>
12625R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
12626R: Mika Westerberg <mika.westerberg@linux.intel.com>
12627L: linux-i2c@vger.kernel.org
12628S: Maintained
12629F: drivers/i2c/busses/i2c-designware-*
12630F: include/linux/platform_data/i2c-designware.h
12631
12632SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
12633M: Jaehoon Chung <jh80.chung@samsung.com>
12634L: linux-mmc@vger.kernel.org
12635S: Maintained
12636F: drivers/mmc/host/dw_mmc*
12637
12748SYSTEM CONFIGURATION (SYSCON) 12638SYSTEM CONFIGURATION (SYSCON)
12749M: Lee Jones <lee.jones@linaro.org> 12639M: Lee Jones <lee.jones@linaro.org>
12750M: Arnd Bergmann <arnd@arndb.de> 12640M: Arnd Bergmann <arnd@arndb.de>
@@ -12752,6 +12642,16 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
12752S: Supported 12642S: Supported
12753F: drivers/mfd/syscon.c 12643F: drivers/mfd/syscon.c
12754 12644
12645SYSTEM CONTROL & POWER INTERFACE (SCPI) Message Protocol drivers
12646M: Sudeep Holla <sudeep.holla@arm.com>
12647L: linux-arm-kernel@lists.infradead.org
12648S: Maintained
12649F: Documentation/devicetree/bindings/arm/arm,scpi.txt
12650F: drivers/clk/clk-scpi.c
12651F: drivers/cpufreq/scpi-cpufreq.c
12652F: drivers/firmware/arm_scpi.c
12653F: include/linux/scpi_protocol.h
12654
12755SYSTEM RESET/SHUTDOWN DRIVERS 12655SYSTEM RESET/SHUTDOWN DRIVERS
12756M: Sebastian Reichel <sre@kernel.org> 12656M: Sebastian Reichel <sre@kernel.org>
12757L: linux-pm@vger.kernel.org 12657L: linux-pm@vger.kernel.org
@@ -12760,6 +12660,15 @@ S: Maintained
12760F: Documentation/devicetree/bindings/power/reset/ 12660F: Documentation/devicetree/bindings/power/reset/
12761F: drivers/power/reset/ 12661F: drivers/power/reset/
12762 12662
12663SYSTEM TRACE MODULE CLASS
12664M: Alexander Shishkin <alexander.shishkin@linux.intel.com>
12665S: Maintained
12666T: git git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git
12667F: Documentation/trace/stm.txt
12668F: drivers/hwtracing/stm/
12669F: include/linux/stm.h
12670F: include/uapi/linux/stm.h
12671
12763SYSV FILESYSTEM 12672SYSV FILESYSTEM
12764M: Christoph Hellwig <hch@infradead.org> 12673M: Christoph Hellwig <hch@infradead.org>
12765S: Maintained 12674S: Maintained
@@ -12929,6 +12838,14 @@ L: linux-media@vger.kernel.org
12929S: Maintained 12838S: Maintained
12930F: drivers/media/rc/ttusbir.c 12839F: drivers/media/rc/ttusbir.c
12931 12840
12841TEE SUBSYSTEM
12842M: Jens Wiklander <jens.wiklander@linaro.org>
12843S: Maintained
12844F: include/linux/tee_drv.h
12845F: include/uapi/linux/tee.h
12846F: drivers/tee/
12847F: Documentation/tee.txt
12848
12932TEGRA ARCHITECTURE SUPPORT 12849TEGRA ARCHITECTURE SUPPORT
12933M: Thierry Reding <thierry.reding@gmail.com> 12850M: Thierry Reding <thierry.reding@gmail.com>
12934M: Jonathan Hunter <jonathanh@nvidia.com> 12851M: Jonathan Hunter <jonathanh@nvidia.com>
@@ -13060,6 +12977,23 @@ T: git git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
13060S: Maintained 12977S: Maintained
13061F: drivers/platform/x86/thinkpad_acpi.c 12978F: drivers/platform/x86/thinkpad_acpi.c
13062 12979
12980THUNDERBOLT DRIVER
12981M: Andreas Noever <andreas.noever@gmail.com>
12982M: Michael Jamet <michael.jamet@intel.com>
12983M: Mika Westerberg <mika.westerberg@linux.intel.com>
12984M: Yehezkel Bernat <yehezkel.bernat@intel.com>
12985S: Maintained
12986F: drivers/thunderbolt/
12987
12988TI AM437X VPFE DRIVER
12989M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
12990L: linux-media@vger.kernel.org
12991W: https://linuxtv.org
12992Q: http://patchwork.linuxtv.org/project/linux-media/list/
12993T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
12994S: Maintained
12995F: drivers/media/platform/am437x/
12996
13063TI BANDGAP AND THERMAL DRIVER 12997TI BANDGAP AND THERMAL DRIVER
13064M: Eduardo Valentin <edubezval@gmail.com> 12998M: Eduardo Valentin <edubezval@gmail.com>
13065M: Keerthy <j-keerthy@ti.com> 12999M: Keerthy <j-keerthy@ti.com>
@@ -13068,13 +13002,11 @@ L: linux-omap@vger.kernel.org
13068S: Maintained 13002S: Maintained
13069F: drivers/thermal/ti-soc-thermal/ 13003F: drivers/thermal/ti-soc-thermal/
13070 13004
13071TI VPE/CAL DRIVERS 13005TI BQ27XXX POWER SUPPLY DRIVER
13072M: Benoit Parrot <bparrot@ti.com> 13006R: Andrew F. Davis <afd@ti.com>
13073L: linux-media@vger.kernel.org 13007F: include/linux/power/bq27xxx_battery.h
13074W: http://linuxtv.org/ 13008F: drivers/power/supply/bq27xxx_battery.c
13075Q: http://patchwork.linuxtv.org/project/linux-media/list/ 13009F: drivers/power/supply/bq27xxx_battery_i2c.c
13076S: Maintained
13077F: drivers/media/platform/ti-vpe/
13078 13010
13079TI CDCE706 CLOCK DRIVER 13011TI CDCE706 CLOCK DRIVER
13080M: Max Filippov <jcmvbkbc@gmail.com> 13012M: Max Filippov <jcmvbkbc@gmail.com>
@@ -13088,6 +13020,33 @@ S: Maintained
13088F: drivers/clk/ti/ 13020F: drivers/clk/ti/
13089F: include/linux/clk/ti.h 13021F: include/linux/clk/ti.h
13090 13022
13023TI DAVINCI MACHINE SUPPORT
13024M: Sekhar Nori <nsekhar@ti.com>
13025M: Kevin Hilman <khilman@kernel.org>
13026L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
13027T: git git://git.kernel.org/pub/scm/linux/kernel/git/nsekhar/linux-davinci.git
13028S: Supported
13029F: arch/arm/mach-davinci/
13030F: drivers/i2c/busses/i2c-davinci.c
13031F: arch/arm/boot/dts/da850*
13032
13033TI DAVINCI SERIES GPIO DRIVER
13034M: Keerthy <j-keerthy@ti.com>
13035L: linux-gpio@vger.kernel.org
13036S: Maintained
13037F: Documentation/devicetree/bindings/gpio/gpio-davinci.txt
13038F: drivers/gpio/gpio-davinci.c
13039
13040TI DAVINCI SERIES MEDIA DRIVER
13041M: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
13042L: linux-media@vger.kernel.org
13043W: https://linuxtv.org
13044Q: http://patchwork.linuxtv.org/project/linux-media/list/
13045T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
13046S: Maintained
13047F: drivers/media/platform/davinci/
13048F: include/media/davinci/
13049
13091TI ETHERNET SWITCH DRIVER (CPSW) 13050TI ETHERNET SWITCH DRIVER (CPSW)
13092R: Grygorii Strashko <grygorii.strashko@ti.com> 13051R: Grygorii Strashko <grygorii.strashko@ti.com>
13093L: linux-omap@vger.kernel.org 13052L: linux-omap@vger.kernel.org
@@ -13111,7 +13070,6 @@ S: Maintained
13111F: drivers/soc/ti/* 13070F: drivers/soc/ti/*
13112T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git 13071T: git git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone.git
13113 13072
13114
13115TI LM49xxx FAMILY ASoC CODEC DRIVERS 13073TI LM49xxx FAMILY ASoC CODEC DRIVERS
13116M: M R Swami Reddy <mr.swami.reddy@ti.com> 13074M: M R Swami Reddy <mr.swami.reddy@ti.com>
13117M: Vishwas A Deshpande <vishwas.a.deshpande@ti.com> 13075M: Vishwas A Deshpande <vishwas.a.deshpande@ti.com>
@@ -13156,12 +13114,28 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
13156S: Odd Fixes 13114S: Odd Fixes
13157F: sound/soc/codecs/tas571x* 13115F: sound/soc/codecs/tas571x*
13158 13116
13117TI TRF7970A NFC DRIVER
13118M: Mark Greer <mgreer@animalcreek.com>
13119L: linux-wireless@vger.kernel.org
13120L: linux-nfc@lists.01.org (moderated for non-subscribers)
13121S: Supported
13122F: drivers/nfc/trf7970a.c
13123F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
13124
13159TI TWL4030 SERIES SOC CODEC DRIVER 13125TI TWL4030 SERIES SOC CODEC DRIVER
13160M: Peter Ujfalusi <peter.ujfalusi@ti.com> 13126M: Peter Ujfalusi <peter.ujfalusi@ti.com>
13161L: alsa-devel@alsa-project.org (moderated for non-subscribers) 13127L: alsa-devel@alsa-project.org (moderated for non-subscribers)
13162S: Maintained 13128S: Maintained
13163F: sound/soc/codecs/twl4030* 13129F: sound/soc/codecs/twl4030*
13164 13130
13131TI VPE/CAL DRIVERS
13132M: Benoit Parrot <bparrot@ti.com>
13133L: linux-media@vger.kernel.org
13134W: http://linuxtv.org/
13135Q: http://patchwork.linuxtv.org/project/linux-media/list/
13136S: Maintained
13137F: drivers/media/platform/ti-vpe/
13138
13165TI WILINK WIRELESS DRIVERS 13139TI WILINK WIRELESS DRIVERS
13166L: linux-wireless@vger.kernel.org 13140L: linux-wireless@vger.kernel.org
13167W: http://wireless.kernel.org/en/users/Drivers/wl12xx 13141W: http://wireless.kernel.org/en/users/Drivers/wl12xx
@@ -13171,16 +13145,6 @@ S: Orphan
13171F: drivers/net/wireless/ti/ 13145F: drivers/net/wireless/ti/
13172F: include/linux/wl12xx.h 13146F: include/linux/wl12xx.h
13173 13147
13174TIPC NETWORK LAYER
13175M: Jon Maloy <jon.maloy@ericsson.com>
13176M: Ying Xue <ying.xue@windriver.com>
13177L: netdev@vger.kernel.org (core kernel code)
13178L: tipc-discussion@lists.sourceforge.net (user apps, general discussion)
13179W: http://tipc.sourceforge.net/
13180S: Maintained
13181F: include/uapi/linux/tipc*.h
13182F: net/tipc/
13183
13184TILE ARCHITECTURE 13148TILE ARCHITECTURE
13185M: Chris Metcalf <cmetcalf@mellanox.com> 13149M: Chris Metcalf <cmetcalf@mellanox.com>
13186W: http://www.mellanox.com/repository/solutions/tile-scm/ 13150W: http://www.mellanox.com/repository/solutions/tile-scm/
@@ -13196,6 +13160,34 @@ F: drivers/tty/serial/tilegx.c
13196F: drivers/usb/host/*-tilegx.c 13160F: drivers/usb/host/*-tilegx.c
13197F: include/linux/usb/tilegx.h 13161F: include/linux/usb/tilegx.h
13198 13162
13163TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
13164M: John Stultz <john.stultz@linaro.org>
13165M: Thomas Gleixner <tglx@linutronix.de>
13166R: Stephen Boyd <sboyd@codeaurora.org>
13167L: linux-kernel@vger.kernel.org
13168T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
13169S: Supported
13170F: include/linux/clocksource.h
13171F: include/linux/time.h
13172F: include/linux/timex.h
13173F: include/uapi/linux/time.h
13174F: include/uapi/linux/timex.h
13175F: kernel/time/clocksource.c
13176F: kernel/time/time*.c
13177F: kernel/time/alarmtimer.c
13178F: kernel/time/ntp.c
13179F: tools/testing/selftests/timers/
13180
13181TIPC NETWORK LAYER
13182M: Jon Maloy <jon.maloy@ericsson.com>
13183M: Ying Xue <ying.xue@windriver.com>
13184L: netdev@vger.kernel.org (core kernel code)
13185L: tipc-discussion@lists.sourceforge.net (user apps, general discussion)
13186W: http://tipc.sourceforge.net/
13187S: Maintained
13188F: include/uapi/linux/tipc*.h
13189F: net/tipc/
13190
13199TLAN NETWORK DRIVER 13191TLAN NETWORK DRIVER
13200M: Samuel Chessman <chessman@tux.org> 13192M: Samuel Chessman <chessman@tux.org>
13201L: tlan-devel@lists.sourceforge.net (subscribers-only) 13193L: tlan-devel@lists.sourceforge.net (subscribers-only)
@@ -13204,6 +13196,38 @@ S: Maintained
13204F: Documentation/networking/tlan.txt 13196F: Documentation/networking/tlan.txt
13205F: drivers/net/ethernet/ti/tlan.* 13197F: drivers/net/ethernet/ti/tlan.*
13206 13198
13199TM6000 VIDEO4LINUX DRIVER
13200M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13201M: Mauro Carvalho Chehab <mchehab@kernel.org>
13202L: linux-media@vger.kernel.org
13203W: https://linuxtv.org
13204T: git git://linuxtv.org/media_tree.git
13205S: Odd fixes
13206F: drivers/media/usb/tm6000/
13207F: Documentation/media/v4l-drivers/tm6000*
13208
13209TMIO/SDHI MMC DRIVER
13210M: Wolfram Sang <wsa+renesas@sang-engineering.com>
13211L: linux-mmc@vger.kernel.org
13212S: Supported
13213F: drivers/mmc/host/tmio_mmc*
13214F: drivers/mmc/host/renesas_sdhi*
13215F: include/linux/mfd/tmio.h
13216
13217TMP401 HARDWARE MONITOR DRIVER
13218M: Guenter Roeck <linux@roeck-us.net>
13219L: linux-hwmon@vger.kernel.org
13220S: Maintained
13221F: Documentation/hwmon/tmp401
13222F: drivers/hwmon/tmp401.c
13223
13224TMPFS (SHMEM FILESYSTEM)
13225M: Hugh Dickins <hughd@google.com>
13226L: linux-mm@kvack.org
13227S: Maintained
13228F: include/linux/shmem_fs.h
13229F: mm/shmem.c
13230
13207TOMOYO SECURITY MODULE 13231TOMOYO SECURITY MODULE
13208M: Kentaro Takeda <takedakn@nttdata.co.jp> 13232M: Kentaro Takeda <takedakn@nttdata.co.jp>
13209M: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> 13233M: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
@@ -13240,12 +13264,6 @@ L: platform-driver-x86@vger.kernel.org
13240S: Maintained 13264S: Maintained
13241F: drivers/platform/x86/toshiba_haps.c 13265F: drivers/platform/x86/toshiba_haps.c
13242 13266
13243TOSHIBA WMI HOTKEYS DRIVER
13244M: Azael Avalos <coproscefalo@gmail.com>
13245L: platform-driver-x86@vger.kernel.org
13246S: Maintained
13247F: drivers/platform/x86/toshiba-wmi.c
13248
13249TOSHIBA SMM DRIVER 13267TOSHIBA SMM DRIVER
13250M: Jonathan Buzzard <jonathan@buzzard.org.uk> 13268M: Jonathan Buzzard <jonathan@buzzard.org.uk>
13251W: http://www.buzzard.org.uk/toshiba/ 13269W: http://www.buzzard.org.uk/toshiba/
@@ -13261,62 +13279,11 @@ S: Maintained
13261F: drivers/media/i2c/tc358743* 13279F: drivers/media/i2c/tc358743*
13262F: include/media/i2c/tc358743.h 13280F: include/media/i2c/tc358743.h
13263 13281
13264TMIO/SDHI MMC DRIVER 13282TOSHIBA WMI HOTKEYS DRIVER
13265M: Wolfram Sang <wsa+renesas@sang-engineering.com> 13283M: Azael Avalos <coproscefalo@gmail.com>
13266L: linux-mmc@vger.kernel.org 13284L: platform-driver-x86@vger.kernel.org
13267S: Supported
13268F: drivers/mmc/host/tmio_mmc*
13269F: drivers/mmc/host/renesas_sdhi*
13270F: include/linux/mfd/tmio.h
13271
13272TMP401 HARDWARE MONITOR DRIVER
13273M: Guenter Roeck <linux@roeck-us.net>
13274L: linux-hwmon@vger.kernel.org
13275S: Maintained
13276F: Documentation/hwmon/tmp401
13277F: drivers/hwmon/tmp401.c
13278
13279TMPFS (SHMEM FILESYSTEM)
13280M: Hugh Dickins <hughd@google.com>
13281L: linux-mm@kvack.org
13282S: Maintained
13283F: include/linux/shmem_fs.h
13284F: mm/shmem.c
13285
13286TM6000 VIDEO4LINUX DRIVER
13287M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13288M: Mauro Carvalho Chehab <mchehab@kernel.org>
13289L: linux-media@vger.kernel.org
13290W: https://linuxtv.org
13291T: git git://linuxtv.org/media_tree.git
13292S: Odd fixes
13293F: drivers/media/usb/tm6000/
13294F: Documentation/media/v4l-drivers/tm6000*
13295
13296TW5864 VIDEO4LINUX DRIVER
13297M: Bluecherry Maintainers <maintainers@bluecherrydvr.com>
13298M: Anton Sviridenko <anton@corp.bluecherry.net>
13299M: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
13300M: Andrey Utkin <andrey_utkin@fastmail.com>
13301L: linux-media@vger.kernel.org
13302S: Supported
13303F: drivers/media/pci/tw5864/
13304
13305TW68 VIDEO4LINUX DRIVER
13306M: Hans Verkuil <hverkuil@xs4all.nl>
13307L: linux-media@vger.kernel.org
13308T: git git://linuxtv.org/media_tree.git
13309W: https://linuxtv.org
13310S: Odd Fixes
13311F: drivers/media/pci/tw68/
13312
13313TW686X VIDEO4LINUX DRIVER
13314M: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
13315L: linux-media@vger.kernel.org
13316T: git git://linuxtv.org/media_tree.git
13317W: http://linuxtv.org
13318S: Maintained 13285S: Maintained
13319F: drivers/media/pci/tw686x/ 13286F: drivers/platform/x86/toshiba-wmi.c
13320 13287
13321TPM DEVICE DRIVER 13288TPM DEVICE DRIVER
13322M: Peter Huewe <peterhuewe@gmx.de> 13289M: Peter Huewe <peterhuewe@gmx.de>
@@ -13418,6 +13385,31 @@ S: Maintained
13418F: drivers/tc/ 13385F: drivers/tc/
13419F: include/linux/tc.h 13386F: include/linux/tc.h
13420 13387
13388TW5864 VIDEO4LINUX DRIVER
13389M: Bluecherry Maintainers <maintainers@bluecherrydvr.com>
13390M: Anton Sviridenko <anton@corp.bluecherry.net>
13391M: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
13392M: Andrey Utkin <andrey_utkin@fastmail.com>
13393L: linux-media@vger.kernel.org
13394S: Supported
13395F: drivers/media/pci/tw5864/
13396
13397TW68 VIDEO4LINUX DRIVER
13398M: Hans Verkuil <hverkuil@xs4all.nl>
13399L: linux-media@vger.kernel.org
13400T: git git://linuxtv.org/media_tree.git
13401W: https://linuxtv.org
13402S: Odd Fixes
13403F: drivers/media/pci/tw68/
13404
13405TW686X VIDEO4LINUX DRIVER
13406M: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
13407L: linux-media@vger.kernel.org
13408T: git git://linuxtv.org/media_tree.git
13409W: http://linuxtv.org
13410S: Maintained
13411F: drivers/media/pci/tw686x/
13412
13421UBI FILE SYSTEM (UBIFS) 13413UBI FILE SYSTEM (UBIFS)
13422M: Richard Weinberger <richard@nod.at> 13414M: Richard Weinberger <richard@nod.at>
13423M: Artem Bityutskiy <dedekind1@gmail.com> 13415M: Artem Bityutskiy <dedekind1@gmail.com>
@@ -13467,6 +13459,13 @@ S: Maintained
13467F: drivers/hid/uhid.c 13459F: drivers/hid/uhid.c
13468F: include/uapi/linux/uhid.h 13460F: include/uapi/linux/uhid.h
13469 13461
13462ULPI BUS
13463M: Heikki Krogerus <heikki.krogerus@linux.intel.com>
13464L: linux-usb@vger.kernel.org
13465S: Maintained
13466F: drivers/usb/common/ulpi.c
13467F: include/linux/ulpi/
13468
13470ULTRA-WIDEBAND (UWB) SUBSYSTEM: 13469ULTRA-WIDEBAND (UWB) SUBSYSTEM:
13471L: linux-usb@vger.kernel.org 13470L: linux-usb@vger.kernel.org
13472S: Orphan 13471S: Orphan
@@ -13527,6 +13526,14 @@ F: drivers/mtd/ubi/
13527F: include/linux/mtd/ubi.h 13526F: include/linux/mtd/ubi.h
13528F: include/uapi/mtd/ubi-user.h 13527F: include/uapi/mtd/ubi-user.h
13529 13528
13529USB "USBNET" DRIVER FRAMEWORK
13530M: Oliver Neukum <oneukum@suse.com>
13531L: netdev@vger.kernel.org
13532W: http://www.linux-usb.org/usbnet
13533S: Maintained
13534F: drivers/net/usb/usbnet.c
13535F: include/linux/usb/usbnet.h
13536
13530USB ACM DRIVER 13537USB ACM DRIVER
13531M: Oliver Neukum <oneukum@suse.com> 13538M: Oliver Neukum <oneukum@suse.com>
13532L: linux-usb@vger.kernel.org 13539L: linux-usb@vger.kernel.org
@@ -13750,14 +13757,6 @@ L: linux-usb@vger.kernel.org
13750S: Maintained 13757S: Maintained
13751F: drivers/usb/host/uhci* 13758F: drivers/usb/host/uhci*
13752 13759
13753USB "USBNET" DRIVER FRAMEWORK
13754M: Oliver Neukum <oneukum@suse.com>
13755L: netdev@vger.kernel.org
13756W: http://www.linux-usb.org/usbnet
13757S: Maintained
13758F: drivers/net/usb/usbnet.c
13759F: include/linux/usb/usbnet.h
13760
13761USB VIDEO CLASS 13760USB VIDEO CLASS
13762M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 13761M: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13763L: linux-uvc-devel@lists.sourceforge.net (subscribers-only) 13762L: linux-uvc-devel@lists.sourceforge.net (subscribers-only)
@@ -13812,13 +13811,6 @@ S: Maintained
13812F: Documentation/media/v4l-drivers/zr364xx* 13811F: Documentation/media/v4l-drivers/zr364xx*
13813F: drivers/media/usb/zr364xx/ 13812F: drivers/media/usb/zr364xx/
13814 13813
13815ULPI BUS
13816M: Heikki Krogerus <heikki.krogerus@linux.intel.com>
13817L: linux-usb@vger.kernel.org
13818S: Maintained
13819F: drivers/usb/common/ulpi.c
13820F: include/linux/ulpi/
13821
13822USER-MODE LINUX (UML) 13814USER-MODE LINUX (UML)
13823M: Jeff Dike <jdike@addtoit.com> 13815M: Jeff Dike <jdike@addtoit.com>
13824M: Richard Weinberger <richard@nod.at> 13816M: Richard Weinberger <richard@nod.at>
@@ -13912,6 +13904,37 @@ F: drivers/gpu/vga/vga_switcheroo.c
13912F: include/linux/vga_switcheroo.h 13904F: include/linux/vga_switcheroo.h
13913T: git git://anongit.freedesktop.org/drm/drm-misc 13905T: git git://anongit.freedesktop.org/drm/drm-misc
13914 13906
13907VIA RHINE NETWORK DRIVER
13908S: Orphan
13909F: drivers/net/ethernet/via/via-rhine.c
13910
13911VIA SD/MMC CARD CONTROLLER DRIVER
13912M: Bruce Chang <brucechang@via.com.tw>
13913M: Harald Welte <HaraldWelte@viatech.com>
13914S: Maintained
13915F: drivers/mmc/host/via-sdmmc.c
13916
13917VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER
13918M: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
13919L: linux-fbdev@vger.kernel.org
13920S: Maintained
13921F: include/linux/via-core.h
13922F: include/linux/via-gpio.h
13923F: include/linux/via_i2c.h
13924F: drivers/video/fbdev/via/
13925
13926VIA VELOCITY NETWORK DRIVER
13927M: Francois Romieu <romieu@fr.zoreil.com>
13928L: netdev@vger.kernel.org
13929S: Maintained
13930F: drivers/net/ethernet/via/via-velocity.*
13931
13932VIDEO MULTIPLEXER DRIVER
13933M: Philipp Zabel <p.zabel@pengutronix.de>
13934L: linux-media@vger.kernel.org
13935S: Maintained
13936F: drivers/media/platform/video-mux.c
13937
13915VIDEOBUF2 FRAMEWORK 13938VIDEOBUF2 FRAMEWORK
13916M: Pawel Osciak <pawel@osciak.com> 13939M: Pawel Osciak <pawel@osciak.com>
13917M: Marek Szyprowski <m.szyprowski@samsung.com> 13940M: Marek Szyprowski <m.szyprowski@samsung.com>
@@ -13921,11 +13944,20 @@ S: Maintained
13921F: drivers/media/v4l2-core/videobuf2-* 13944F: drivers/media/v4l2-core/videobuf2-*
13922F: include/media/videobuf2-* 13945F: include/media/videobuf2-*
13923 13946
13924VIDEO MULTIPLEXER DRIVER 13947VIMC VIRTUAL MEDIA CONTROLLER DRIVER
13925M: Philipp Zabel <p.zabel@pengutronix.de> 13948M: Helen Koike <helen.koike@collabora.com>
13926L: linux-media@vger.kernel.org 13949L: linux-media@vger.kernel.org
13950T: git git://linuxtv.org/media_tree.git
13951W: https://linuxtv.org
13927S: Maintained 13952S: Maintained
13928F: drivers/media/platform/video-mux.c 13953F: drivers/media/platform/vimc/*
13954
13955VIRT LIB
13956M: Alex Williamson <alex.williamson@redhat.com>
13957M: Paolo Bonzini <pbonzini@redhat.com>
13958L: kvm@vger.kernel.org
13959S: Supported
13960F: virt/lib/
13929 13961
13930VIRTIO AND VHOST VSOCK DRIVER 13962VIRTIO AND VHOST VSOCK DRIVER
13931M: Stefan Hajnoczi <stefanha@redhat.com> 13963M: Stefan Hajnoczi <stefanha@redhat.com>
@@ -13943,12 +13975,6 @@ F: drivers/net/vsockmon.c
13943F: drivers/vhost/vsock.c 13975F: drivers/vhost/vsock.c
13944F: drivers/vhost/vsock.h 13976F: drivers/vhost/vsock.h
13945 13977
13946VIRTUAL SERIO DEVICE DRIVER
13947M: Stephen Chandler Paul <thatslyude@gmail.com>
13948S: Maintained
13949F: drivers/input/serio/userio.c
13950F: include/uapi/linux/userio.h
13951
13952VIRTIO CONSOLE DRIVER 13978VIRTIO CONSOLE DRIVER
13953M: Amit Shah <amit@kernel.org> 13979M: Amit Shah <amit@kernel.org>
13954L: virtualization@lists.linux-foundation.org 13980L: virtualization@lists.linux-foundation.org
@@ -13971,6 +13997,14 @@ F: include/linux/virtio*.h
13971F: include/uapi/linux/virtio_*.h 13997F: include/uapi/linux/virtio_*.h
13972F: drivers/crypto/virtio/ 13998F: drivers/crypto/virtio/
13973 13999
14000VIRTIO CRYPTO DRIVER
14001M: Gonglei <arei.gonglei@huawei.com>
14002L: virtualization@lists.linux-foundation.org
14003L: linux-crypto@vger.kernel.org
14004S: Maintained
14005F: drivers/crypto/virtio/
14006F: include/uapi/linux/virtio_crypto.h
14007
13974VIRTIO DRIVERS FOR S390 14008VIRTIO DRIVERS FOR S390
13975M: Cornelia Huck <cohuck@redhat.com> 14009M: Cornelia Huck <cohuck@redhat.com>
13976M: Halil Pasic <pasic@linux.vnet.ibm.com> 14010M: Halil Pasic <pasic@linux.vnet.ibm.com>
@@ -14007,45 +14041,11 @@ S: Maintained
14007F: drivers/virtio/virtio_input.c 14041F: drivers/virtio/virtio_input.c
14008F: include/uapi/linux/virtio_input.h 14042F: include/uapi/linux/virtio_input.h
14009 14043
14010VIRTIO CRYPTO DRIVER 14044VIRTUAL SERIO DEVICE DRIVER
14011M: Gonglei <arei.gonglei@huawei.com> 14045M: Stephen Chandler Paul <thatslyude@gmail.com>
14012L: virtualization@lists.linux-foundation.org
14013L: linux-crypto@vger.kernel.org
14014S: Maintained
14015F: drivers/crypto/virtio/
14016F: include/uapi/linux/virtio_crypto.h
14017
14018VIA RHINE NETWORK DRIVER
14019S: Orphan
14020F: drivers/net/ethernet/via/via-rhine.c
14021
14022VIA SD/MMC CARD CONTROLLER DRIVER
14023M: Bruce Chang <brucechang@via.com.tw>
14024M: Harald Welte <HaraldWelte@viatech.com>
14025S: Maintained
14026F: drivers/mmc/host/via-sdmmc.c
14027
14028VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER
14029M: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
14030L: linux-fbdev@vger.kernel.org
14031S: Maintained
14032F: include/linux/via-core.h
14033F: include/linux/via-gpio.h
14034F: include/linux/via_i2c.h
14035F: drivers/video/fbdev/via/
14036
14037VIA VELOCITY NETWORK DRIVER
14038M: Francois Romieu <romieu@fr.zoreil.com>
14039L: netdev@vger.kernel.org
14040S: Maintained 14046S: Maintained
14041F: drivers/net/ethernet/via/via-velocity.* 14047F: drivers/input/serio/userio.c
14042 14048F: include/uapi/linux/userio.h
14043VIRT LIB
14044M: Alex Williamson <alex.williamson@redhat.com>
14045M: Paolo Bonzini <pbonzini@redhat.com>
14046L: kvm@vger.kernel.org
14047S: Supported
14048F: virt/lib/
14049 14049
14050VIVID VIRTUAL VIDEO DRIVER 14050VIVID VIRTUAL VIDEO DRIVER
14051M: Hans Verkuil <hverkuil@xs4all.nl> 14051M: Hans Verkuil <hverkuil@xs4all.nl>
@@ -14055,14 +14055,6 @@ W: https://linuxtv.org
14055S: Maintained 14055S: Maintained
14056F: drivers/media/platform/vivid/* 14056F: drivers/media/platform/vivid/*
14057 14057
14058VIMC VIRTUAL MEDIA CONTROLLER DRIVER
14059M: Helen Koike <helen.koike@collabora.com>
14060L: linux-media@vger.kernel.org
14061T: git git://linuxtv.org/media_tree.git
14062W: https://linuxtv.org
14063S: Maintained
14064F: drivers/media/platform/vimc/*
14065
14066VLYNQ BUS 14058VLYNQ BUS
14067M: Florian Fainelli <f.fainelli@gmail.com> 14059M: Florian Fainelli <f.fainelli@gmail.com>
14068L: openwrt-devel@lists.openwrt.org (subscribers-only) 14060L: openwrt-devel@lists.openwrt.org (subscribers-only)
@@ -14082,12 +14074,6 @@ F: drivers/staging/vme/
14082F: drivers/vme/ 14074F: drivers/vme/
14083F: include/linux/vme* 14075F: include/linux/vme*
14084 14076
14085VMWARE HYPERVISOR INTERFACE
14086M: Alok Kataria <akataria@vmware.com>
14087L: virtualization@lists.linux-foundation.org
14088S: Supported
14089F: arch/x86/kernel/cpu/vmware.c
14090
14091VMWARE BALLOON DRIVER 14077VMWARE BALLOON DRIVER
14092M: Xavier Deguillard <xdeguillard@vmware.com> 14078M: Xavier Deguillard <xdeguillard@vmware.com>
14093M: Philip Moltmann <moltmann@vmware.com> 14079M: Philip Moltmann <moltmann@vmware.com>
@@ -14096,6 +14082,27 @@ L: linux-kernel@vger.kernel.org
14096S: Maintained 14082S: Maintained
14097F: drivers/misc/vmw_balloon.c 14083F: drivers/misc/vmw_balloon.c
14098 14084
14085VMWARE HYPERVISOR INTERFACE
14086M: Alok Kataria <akataria@vmware.com>
14087L: virtualization@lists.linux-foundation.org
14088S: Supported
14089F: arch/x86/kernel/cpu/vmware.c
14090
14091VMWARE PVRDMA DRIVER
14092M: Adit Ranadive <aditr@vmware.com>
14093M: VMware PV-Drivers <pv-drivers@vmware.com>
14094L: linux-rdma@vger.kernel.org
14095S: Maintained
14096F: drivers/infiniband/hw/vmw_pvrdma/
14097
14098VMware PVSCSI driver
14099M: Jim Gill <jgill@vmware.com>
14100M: VMware PV-Drivers <pv-drivers@vmware.com>
14101L: linux-scsi@vger.kernel.org
14102S: Maintained
14103F: drivers/scsi/vmw_pvscsi.c
14104F: drivers/scsi/vmw_pvscsi.h
14105
14099VMWARE VMMOUSE SUBDRIVER 14106VMWARE VMMOUSE SUBDRIVER
14100M: "VMware Graphics" <linux-graphics-maintainer@vmware.com> 14107M: "VMware Graphics" <linux-graphics-maintainer@vmware.com>
14101M: "VMware, Inc." <pv-drivers@vmware.com> 14108M: "VMware, Inc." <pv-drivers@vmware.com>
@@ -14111,21 +14118,6 @@ L: netdev@vger.kernel.org
14111S: Maintained 14118S: Maintained
14112F: drivers/net/vmxnet3/ 14119F: drivers/net/vmxnet3/
14113 14120
14114VMware PVSCSI driver
14115M: Jim Gill <jgill@vmware.com>
14116M: VMware PV-Drivers <pv-drivers@vmware.com>
14117L: linux-scsi@vger.kernel.org
14118S: Maintained
14119F: drivers/scsi/vmw_pvscsi.c
14120F: drivers/scsi/vmw_pvscsi.h
14121
14122VMWARE PVRDMA DRIVER
14123M: Adit Ranadive <aditr@vmware.com>
14124M: VMware PV-Drivers <pv-drivers@vmware.com>
14125L: linux-rdma@vger.kernel.org
14126S: Maintained
14127F: drivers/infiniband/hw/vmw_pvrdma/
14128
14129VOLTAGE AND CURRENT REGULATOR FRAMEWORK 14121VOLTAGE AND CURRENT REGULATOR FRAMEWORK
14130M: Liam Girdwood <lgirdwood@gmail.com> 14122M: Liam Girdwood <lgirdwood@gmail.com>
14131M: Mark Brown <broonie@kernel.org> 14123M: Mark Brown <broonie@kernel.org>
@@ -14224,6 +14216,27 @@ L: linux-input@vger.kernel.org
14224S: Maintained 14216S: Maintained
14225F: drivers/hid/hid-wiimote* 14217F: drivers/hid/hid-wiimote*
14226 14218
14219WILOCITY WIL6210 WIRELESS DRIVER
14220M: Maya Erez <qca_merez@qca.qualcomm.com>
14221L: linux-wireless@vger.kernel.org
14222L: wil6210@qca.qualcomm.com
14223S: Supported
14224W: http://wireless.kernel.org/en/users/Drivers/wil6210
14225F: drivers/net/wireless/ath/wil6210/
14226F: include/uapi/linux/wil6210_uapi.h
14227
14228WIMAX STACK
14229M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
14230M: linux-wimax@intel.com
14231L: wimax@linuxwimax.org (subscribers-only)
14232S: Supported
14233W: http://linuxwimax.org
14234F: Documentation/wimax/README.wimax
14235F: include/linux/wimax/debug.h
14236F: include/net/wimax.h
14237F: include/uapi/linux/wimax.h
14238F: net/wimax/
14239
14227WINBOND CIR DRIVER 14240WINBOND CIR DRIVER
14228M: David Härdeman <david@hardeman.nu> 14241M: David Härdeman <david@hardeman.nu>
14229S: Maintained 14242S: Maintained
@@ -14241,18 +14254,6 @@ L: linux-gpio@vger.kernel.org
14241S: Maintained 14254S: Maintained
14242F: drivers/gpio/gpio-ws16c48.c 14255F: drivers/gpio/gpio-ws16c48.c
14243 14256
14244WIMAX STACK
14245M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
14246M: linux-wimax@intel.com
14247L: wimax@linuxwimax.org (subscribers-only)
14248S: Supported
14249W: http://linuxwimax.org
14250F: Documentation/wimax/README.wimax
14251F: include/linux/wimax/debug.h
14252F: include/net/wimax.h
14253F: include/uapi/linux/wimax.h
14254F: net/wimax/
14255
14256WISTRON LAPTOP BUTTON DRIVER 14257WISTRON LAPTOP BUTTON DRIVER
14257M: Miloslav Trmac <mitr@volny.cz> 14258M: Miloslav Trmac <mitr@volny.cz>
14258S: Maintained 14259S: Maintained
@@ -14337,15 +14338,6 @@ S: Maintained
14337F: Documentation/x86/ 14338F: Documentation/x86/
14338F: arch/x86/ 14339F: arch/x86/
14339 14340
14340X86 PLATFORM DRIVERS
14341M: Darren Hart <dvhart@infradead.org>
14342M: Andy Shevchenko <andy@infradead.org>
14343L: platform-driver-x86@vger.kernel.org
14344T: git git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
14345S: Maintained
14346F: drivers/platform/x86/
14347F: drivers/platform/olpc/
14348
14349X86 MCE INFRASTRUCTURE 14341X86 MCE INFRASTRUCTURE
14350M: Tony Luck <tony.luck@intel.com> 14342M: Tony Luck <tony.luck@intel.com>
14351M: Borislav Petkov <bp@alien8.de> 14343M: Borislav Petkov <bp@alien8.de>
@@ -14358,6 +14350,15 @@ M: Borislav Petkov <bp@alien8.de>
14358S: Maintained 14350S: Maintained
14359F: arch/x86/kernel/cpu/microcode/* 14351F: arch/x86/kernel/cpu/microcode/*
14360 14352
14353X86 PLATFORM DRIVERS
14354M: Darren Hart <dvhart@infradead.org>
14355M: Andy Shevchenko <andy@infradead.org>
14356L: platform-driver-x86@vger.kernel.org
14357T: git git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
14358S: Maintained
14359F: drivers/platform/x86/
14360F: drivers/platform/olpc/
14361
14361X86 VDSO 14362X86 VDSO
14362M: Andy Lutomirski <luto@amacapital.net> 14363M: Andy Lutomirski <luto@amacapital.net>
14363L: linux-kernel@vger.kernel.org 14364L: linux-kernel@vger.kernel.org
@@ -14374,20 +14375,13 @@ T: git git://linuxtv.org/media_tree.git
14374S: Maintained 14375S: Maintained
14375F: drivers/media/tuners/tuner-xc2028.* 14376F: drivers/media/tuners/tuner-xc2028.*
14376 14377
14377XEN HYPERVISOR INTERFACE 14378XEN BLOCK SUBSYSTEM
14378M: Boris Ostrovsky <boris.ostrovsky@oracle.com> 14379M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
14379M: Juergen Gross <jgross@suse.com> 14380M: Roger Pau Monné <roger.pau@citrix.com>
14380L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 14381L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
14381T: git git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git
14382S: Supported 14382S: Supported
14383F: arch/x86/xen/ 14383F: drivers/block/xen-blkback/*
14384F: drivers/*/xen-*front.c 14384F: drivers/block/xen*
14385F: drivers/xen/
14386F: arch/x86/include/asm/xen/
14387F: include/xen/
14388F: include/uapi/xen/
14389F: Documentation/ABI/stable/sysfs-hypervisor-xen
14390F: Documentation/ABI/testing/sysfs-hypervisor-xen
14391 14385
14392XEN HYPERVISOR ARM 14386XEN HYPERVISOR ARM
14393M: Stefano Stabellini <sstabellini@kernel.org> 14387M: Stefano Stabellini <sstabellini@kernel.org>
@@ -14403,6 +14397,21 @@ S: Maintained
14403F: arch/arm64/xen/ 14397F: arch/arm64/xen/
14404F: arch/arm64/include/asm/xen/ 14398F: arch/arm64/include/asm/xen/
14405 14399
14400XEN HYPERVISOR INTERFACE
14401M: Boris Ostrovsky <boris.ostrovsky@oracle.com>
14402M: Juergen Gross <jgross@suse.com>
14403L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
14404T: git git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git
14405S: Supported
14406F: arch/x86/xen/
14407F: drivers/*/xen-*front.c
14408F: drivers/xen/
14409F: arch/x86/include/asm/xen/
14410F: include/xen/
14411F: include/uapi/xen/
14412F: Documentation/ABI/stable/sysfs-hypervisor-xen
14413F: Documentation/ABI/testing/sysfs-hypervisor-xen
14414
14406XEN NETWORK BACKEND DRIVER 14415XEN NETWORK BACKEND DRIVER
14407M: Wei Liu <wei.liu2@citrix.com> 14416M: Wei Liu <wei.liu2@citrix.com>
14408M: Paul Durrant <paul.durrant@citrix.com> 14417M: Paul Durrant <paul.durrant@citrix.com>
@@ -14418,14 +14427,6 @@ S: Supported
14418F: arch/x86/pci/*xen* 14427F: arch/x86/pci/*xen*
14419F: drivers/pci/*xen* 14428F: drivers/pci/*xen*
14420 14429
14421XEN BLOCK SUBSYSTEM
14422M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
14423M: Roger Pau Monné <roger.pau@citrix.com>
14424L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
14425S: Supported
14426F: drivers/block/xen-blkback/*
14427F: drivers/block/xen*
14428
14429XEN PVSCSI DRIVERS 14430XEN PVSCSI DRIVERS
14430M: Juergen Gross <jgross@suse.com> 14431M: Juergen Gross <jgross@suse.com>
14431L: xen-devel@lists.xenproject.org (moderated for non-subscribers) 14432L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
@@ -14502,6 +14503,13 @@ S: Maintained
14502F: drivers/net/hamradio/yam* 14503F: drivers/net/hamradio/yam*
14503F: include/linux/yam.h 14504F: include/linux/yam.h
14504 14505
14506YAMA SECURITY MODULE
14507M: Kees Cook <keescook@chromium.org>
14508T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git yama/tip
14509S: Supported
14510F: security/yama/
14511F: Documentation/admin-guide/LSM/Yama.rst
14512
14505YEALINK PHONE DRIVER 14513YEALINK PHONE DRIVER
14506M: Henk Vergonet <Henk.Vergonet@gmail.com> 14514M: Henk Vergonet <Henk.Vergonet@gmail.com>
14507L: usbb2k-api-dev@nongnu.org 14515L: usbb2k-api-dev@nongnu.org
@@ -14536,23 +14544,23 @@ L: zd1211-devs@lists.sourceforge.net (subscribers-only)
14536S: Maintained 14544S: Maintained
14537F: drivers/net/wireless/zydas/zd1211rw/ 14545F: drivers/net/wireless/zydas/zd1211rw/
14538 14546
14539ZD1301_DEMOD MEDIA DRIVER 14547ZD1301 MEDIA DRIVER
14540M: Antti Palosaari <crope@iki.fi> 14548M: Antti Palosaari <crope@iki.fi>
14541L: linux-media@vger.kernel.org 14549L: linux-media@vger.kernel.org
14542W: https://linuxtv.org/ 14550W: https://linuxtv.org/
14543W: http://palosaari.fi/linux/ 14551W: http://palosaari.fi/linux/
14544Q: https://patchwork.linuxtv.org/project/linux-media/list/ 14552Q: https://patchwork.linuxtv.org/project/linux-media/list/
14545S: Maintained 14553S: Maintained
14546F: drivers/media/dvb-frontends/zd1301_demod* 14554F: drivers/media/usb/dvb-usb-v2/zd1301*
14547 14555
14548ZD1301 MEDIA DRIVER 14556ZD1301_DEMOD MEDIA DRIVER
14549M: Antti Palosaari <crope@iki.fi> 14557M: Antti Palosaari <crope@iki.fi>
14550L: linux-media@vger.kernel.org 14558L: linux-media@vger.kernel.org
14551W: https://linuxtv.org/ 14559W: https://linuxtv.org/
14552W: http://palosaari.fi/linux/ 14560W: http://palosaari.fi/linux/
14553Q: https://patchwork.linuxtv.org/project/linux-media/list/ 14561Q: https://patchwork.linuxtv.org/project/linux-media/list/
14554S: Maintained 14562S: Maintained
14555F: drivers/media/usb/dvb-usb-v2/zd1301* 14563F: drivers/media/dvb-frontends/zd1301_demod*
14556 14564
14557ZPOOL COMPRESSED PAGE STORAGE API 14565ZPOOL COMPRESSED PAGE STORAGE API
14558M: Dan Streetman <ddstreet@ieee.org> 14566M: Dan Streetman <ddstreet@ieee.org>
diff --git a/Makefile b/Makefile
index b4fb9a1d1594..37087b4657b7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 13 2PATCHLEVEL = 13
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc3
5NAME = Fearless Coyote 5NAME = Fearless Coyote
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h
index ff67b8373bf7..1cd7dc7d4870 100644
--- a/arch/alpha/include/uapi/asm/ioctls.h
+++ b/arch/alpha/include/uapi/asm/ioctls.h
@@ -100,7 +100,7 @@
100#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 100#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
101#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 101#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
102#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 102#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
103#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 103#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
104 104
105#define TIOCSERCONFIG 0x5453 105#define TIOCSERCONFIG 0x5453
106#define TIOCSERGWILD 0x5454 106#define TIOCSERGWILD 0x5454
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 2a07e6ecafbd..71d3efff99d3 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -117,7 +117,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
117 117
118 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 118 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
119 119
120 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) 120 if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
121 return ret; 121 return ret;
122 122
123 if (off < count && user_count <= (count - off)) { 123 if (off < count && user_count <= (count - off)) {
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 4e6e88a6b2f4..2244a94ed9c9 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -37,7 +37,7 @@ do { \
37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ 37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
38 "2:\t.asciz " #__file "\n" \ 38 "2:\t.asciz " #__file "\n" \
39 ".popsection\n" \ 39 ".popsection\n" \
40 ".pushsection __bug_table,\"a\"\n" \ 40 ".pushsection __bug_table,\"aw\"\n" \
41 ".align 2\n" \ 41 ".align 2\n" \
42 "3:\t.word 1b, 2b\n" \ 42 "3:\t.word 1b, 2b\n" \
43 "\t.hword " #__line ", 0\n" \ 43 "\t.hword " #__line ", 0\n" \
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index d69bebf697e7..74504b154256 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -116,7 +116,7 @@ struct cpu_cache_fns {
116 void (*dma_unmap_area)(const void *, size_t, int); 116 void (*dma_unmap_area)(const void *, size_t, int);
117 117
118 void (*dma_flush_range)(const void *, const void *); 118 void (*dma_flush_range)(const void *, const void *);
119}; 119} __no_randomize_layout;
120 120
121/* 121/*
122 * Select the calling method 122 * Select the calling method
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index 1869af6bac5c..25021b798a1e 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -19,6 +19,11 @@
19 19
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22#define ARCH_HAS_KIMAGE_ARCH
23struct kimage_arch {
24 u32 kernel_r2;
25};
26
22/** 27/**
23 * crash_setup_regs() - save registers for the panic kernel 28 * crash_setup_regs() - save registers for the panic kernel
24 * @newregs: registers are saved here 29 * @newregs: registers are saved here
diff --git a/arch/arm/include/asm/ucontext.h b/arch/arm/include/asm/ucontext.h
index 14749aec94bf..921d8274855c 100644
--- a/arch/arm/include/asm/ucontext.h
+++ b/arch/arm/include/asm/ucontext.h
@@ -35,6 +35,12 @@ struct ucontext {
35 * bytes, to prevent unpredictable padding in the signal frame. 35 * bytes, to prevent unpredictable padding in the signal frame.
36 */ 36 */
37 37
38/*
39 * Dummy padding block: if this magic is encountered, the block should
40 * be skipped using the corresponding size field.
41 */
42#define DUMMY_MAGIC 0xb0d9ed01
43
38#ifdef CONFIG_CRUNCH 44#ifdef CONFIG_CRUNCH
39#define CRUNCH_MAGIC 0x5065cf03 45#define CRUNCH_MAGIC 0x5065cf03
40#define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8) 46#define CRUNCH_STORAGE_SIZE (CRUNCH_SIZE + 8)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 15495887ca14..fe1419eeb932 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -30,7 +30,6 @@ extern unsigned long kexec_boot_atags;
30 30
31static atomic_t waiting_for_crash_ipi; 31static atomic_t waiting_for_crash_ipi;
32 32
33static unsigned long dt_mem;
34/* 33/*
35 * Provide a dummy crash_notes definition while crash dump arrives to arm. 34 * Provide a dummy crash_notes definition while crash dump arrives to arm.
36 * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. 35 * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
@@ -42,6 +41,9 @@ int machine_kexec_prepare(struct kimage *image)
42 __be32 header; 41 __be32 header;
43 int i, err; 42 int i, err;
44 43
44 image->arch.kernel_r2 = image->start - KEXEC_ARM_ZIMAGE_OFFSET
45 + KEXEC_ARM_ATAGS_OFFSET;
46
45 /* 47 /*
46 * Validate that if the current HW supports SMP, then the SW supports 48 * Validate that if the current HW supports SMP, then the SW supports
47 * and implements CPU hotplug for the current HW. If not, we won't be 49 * and implements CPU hotplug for the current HW. If not, we won't be
@@ -66,8 +68,8 @@ int machine_kexec_prepare(struct kimage *image)
66 if (err) 68 if (err)
67 return err; 69 return err;
68 70
69 if (be32_to_cpu(header) == OF_DT_HEADER) 71 if (header == cpu_to_be32(OF_DT_HEADER))
70 dt_mem = current_segment->mem; 72 image->arch.kernel_r2 = current_segment->mem;
71 } 73 }
72 return 0; 74 return 0;
73} 75}
@@ -165,8 +167,7 @@ void machine_kexec(struct kimage *image)
165 kexec_start_address = image->start; 167 kexec_start_address = image->start;
166 kexec_indirection_page = page_list; 168 kexec_indirection_page = page_list;
167 kexec_mach_type = machine_arch_type; 169 kexec_mach_type = machine_arch_type;
168 kexec_boot_atags = dt_mem ?: image->start - KEXEC_ARM_ZIMAGE_OFFSET 170 kexec_boot_atags = image->arch.kernel_r2;
169 + KEXEC_ARM_ATAGS_OFFSET;
170 171
171 /* copy our kernel relocation code to the control code page */ 172 /* copy our kernel relocation code to the control code page */
172 reboot_entry = fncpy(reboot_code_buffer, 173 reboot_entry = fncpy(reboot_code_buffer,
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 4e80bf7420d4..8e9a3e40d949 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -987,6 +987,9 @@ static void __init reserve_crashkernel(void)
987 987
988 if (crash_base <= 0) { 988 if (crash_base <= 0) {
989 unsigned long long crash_max = idmap_to_phys((u32)~0); 989 unsigned long long crash_max = idmap_to_phys((u32)~0);
990 unsigned long long lowmem_max = __pa(high_memory - 1) + 1;
991 if (crash_max > lowmem_max)
992 crash_max = lowmem_max;
990 crash_base = memblock_find_in_range(CRASH_ALIGN, crash_max, 993 crash_base = memblock_find_in_range(CRASH_ALIGN, crash_max,
991 crash_size, CRASH_ALIGN); 994 crash_size, CRASH_ALIGN);
992 if (!crash_base) { 995 if (!crash_base) {
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 7b8f2141427b..5814298ef0b7 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -40,8 +40,10 @@ static int preserve_crunch_context(struct crunch_sigframe __user *frame)
40 return __copy_to_user(frame, kframe, sizeof(*frame)); 40 return __copy_to_user(frame, kframe, sizeof(*frame));
41} 41}
42 42
43static int restore_crunch_context(struct crunch_sigframe __user *frame) 43static int restore_crunch_context(char __user **auxp)
44{ 44{
45 struct crunch_sigframe __user *frame =
46 (struct crunch_sigframe __user *)*auxp;
45 char kbuf[sizeof(*frame) + 8]; 47 char kbuf[sizeof(*frame) + 8];
46 struct crunch_sigframe *kframe; 48 struct crunch_sigframe *kframe;
47 49
@@ -52,6 +54,7 @@ static int restore_crunch_context(struct crunch_sigframe __user *frame)
52 if (kframe->magic != CRUNCH_MAGIC || 54 if (kframe->magic != CRUNCH_MAGIC ||
53 kframe->size != CRUNCH_STORAGE_SIZE) 55 kframe->size != CRUNCH_STORAGE_SIZE)
54 return -1; 56 return -1;
57 *auxp += CRUNCH_STORAGE_SIZE;
55 crunch_task_restore(current_thread_info(), &kframe->storage); 58 crunch_task_restore(current_thread_info(), &kframe->storage);
56 return 0; 59 return 0;
57} 60}
@@ -59,21 +62,39 @@ static int restore_crunch_context(struct crunch_sigframe __user *frame)
59 62
60#ifdef CONFIG_IWMMXT 63#ifdef CONFIG_IWMMXT
61 64
62static int preserve_iwmmxt_context(struct iwmmxt_sigframe *frame) 65static int preserve_iwmmxt_context(struct iwmmxt_sigframe __user *frame)
63{ 66{
64 char kbuf[sizeof(*frame) + 8]; 67 char kbuf[sizeof(*frame) + 8];
65 struct iwmmxt_sigframe *kframe; 68 struct iwmmxt_sigframe *kframe;
69 int err = 0;
66 70
67 /* the iWMMXt context must be 64 bit aligned */ 71 /* the iWMMXt context must be 64 bit aligned */
68 kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7); 72 kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7);
69 kframe->magic = IWMMXT_MAGIC; 73
70 kframe->size = IWMMXT_STORAGE_SIZE; 74 if (test_thread_flag(TIF_USING_IWMMXT)) {
71 iwmmxt_task_copy(current_thread_info(), &kframe->storage); 75 kframe->magic = IWMMXT_MAGIC;
72 return __copy_to_user(frame, kframe, sizeof(*frame)); 76 kframe->size = IWMMXT_STORAGE_SIZE;
77 iwmmxt_task_copy(current_thread_info(), &kframe->storage);
78
79 err = __copy_to_user(frame, kframe, sizeof(*frame));
80 } else {
81 /*
82 * For bug-compatibility with older kernels, some space
83 * has to be reserved for iWMMXt even if it's not used.
84 * Set the magic and size appropriately so that properly
85 * written userspace can skip it reliably:
86 */
87 __put_user_error(DUMMY_MAGIC, &frame->magic, err);
88 __put_user_error(IWMMXT_STORAGE_SIZE, &frame->size, err);
89 }
90
91 return err;
73} 92}
74 93
75static int restore_iwmmxt_context(struct iwmmxt_sigframe *frame) 94static int restore_iwmmxt_context(char __user **auxp)
76{ 95{
96 struct iwmmxt_sigframe __user *frame =
97 (struct iwmmxt_sigframe __user *)*auxp;
77 char kbuf[sizeof(*frame) + 8]; 98 char kbuf[sizeof(*frame) + 8];
78 struct iwmmxt_sigframe *kframe; 99 struct iwmmxt_sigframe *kframe;
79 100
@@ -81,10 +102,28 @@ static int restore_iwmmxt_context(struct iwmmxt_sigframe *frame)
81 kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7); 102 kframe = (struct iwmmxt_sigframe *)((unsigned long)(kbuf + 8) & ~7);
82 if (__copy_from_user(kframe, frame, sizeof(*frame))) 103 if (__copy_from_user(kframe, frame, sizeof(*frame)))
83 return -1; 104 return -1;
84 if (kframe->magic != IWMMXT_MAGIC || 105
85 kframe->size != IWMMXT_STORAGE_SIZE) 106 /*
107 * For non-iWMMXt threads: a single iwmmxt_sigframe-sized dummy
108 * block is discarded for compatibility with setup_sigframe() if
109 * present, but we don't mandate its presence. If some other
110 * magic is here, it's not for us:
111 */
112 if (!test_thread_flag(TIF_USING_IWMMXT) &&
113 kframe->magic != DUMMY_MAGIC)
114 return 0;
115
116 if (kframe->size != IWMMXT_STORAGE_SIZE)
86 return -1; 117 return -1;
87 iwmmxt_task_restore(current_thread_info(), &kframe->storage); 118
119 if (test_thread_flag(TIF_USING_IWMMXT)) {
120 if (kframe->magic != IWMMXT_MAGIC)
121 return -1;
122
123 iwmmxt_task_restore(current_thread_info(), &kframe->storage);
124 }
125
126 *auxp += IWMMXT_STORAGE_SIZE;
88 return 0; 127 return 0;
89} 128}
90 129
@@ -107,8 +146,10 @@ static int preserve_vfp_context(struct vfp_sigframe __user *frame)
107 return vfp_preserve_user_clear_hwstate(&frame->ufp, &frame->ufp_exc); 146 return vfp_preserve_user_clear_hwstate(&frame->ufp, &frame->ufp_exc);
108} 147}
109 148
110static int restore_vfp_context(struct vfp_sigframe __user *frame) 149static int restore_vfp_context(char __user **auxp)
111{ 150{
151 struct vfp_sigframe __user *frame =
152 (struct vfp_sigframe __user *)*auxp;
112 unsigned long magic; 153 unsigned long magic;
113 unsigned long size; 154 unsigned long size;
114 int err = 0; 155 int err = 0;
@@ -121,6 +162,7 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame)
121 if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) 162 if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE)
122 return -EINVAL; 163 return -EINVAL;
123 164
165 *auxp += size;
124 return vfp_restore_user_hwstate(&frame->ufp, &frame->ufp_exc); 166 return vfp_restore_user_hwstate(&frame->ufp, &frame->ufp_exc);
125} 167}
126 168
@@ -141,7 +183,7 @@ struct rt_sigframe {
141 183
142static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf) 184static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
143{ 185{
144 struct aux_sigframe __user *aux; 186 char __user *aux;
145 sigset_t set; 187 sigset_t set;
146 int err; 188 int err;
147 189
@@ -169,18 +211,18 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
169 211
170 err |= !valid_user_regs(regs); 212 err |= !valid_user_regs(regs);
171 213
172 aux = (struct aux_sigframe __user *) sf->uc.uc_regspace; 214 aux = (char __user *) sf->uc.uc_regspace;
173#ifdef CONFIG_CRUNCH 215#ifdef CONFIG_CRUNCH
174 if (err == 0) 216 if (err == 0)
175 err |= restore_crunch_context(&aux->crunch); 217 err |= restore_crunch_context(&aux);
176#endif 218#endif
177#ifdef CONFIG_IWMMXT 219#ifdef CONFIG_IWMMXT
178 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 220 if (err == 0)
179 err |= restore_iwmmxt_context(&aux->iwmmxt); 221 err |= restore_iwmmxt_context(&aux);
180#endif 222#endif
181#ifdef CONFIG_VFP 223#ifdef CONFIG_VFP
182 if (err == 0) 224 if (err == 0)
183 err |= restore_vfp_context(&aux->vfp); 225 err |= restore_vfp_context(&aux);
184#endif 226#endif
185 227
186 return err; 228 return err;
@@ -286,7 +328,7 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
286 err |= preserve_crunch_context(&aux->crunch); 328 err |= preserve_crunch_context(&aux->crunch);
287#endif 329#endif
288#ifdef CONFIG_IWMMXT 330#ifdef CONFIG_IWMMXT
289 if (err == 0 && test_thread_flag(TIF_USING_IWMMXT)) 331 if (err == 0)
290 err |= preserve_iwmmxt_context(&aux->iwmmxt); 332 err |= preserve_iwmmxt_context(&aux->iwmmxt);
291#endif 333#endif
292#ifdef CONFIG_VFP 334#ifdef CONFIG_VFP
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index be517b048762..5b614388d72f 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -32,120 +32,6 @@ static u16 control_devconf1_offset;
32 32
33#define HSMMC_NAME_LEN 9 33#define HSMMC_NAME_LEN 9
34 34
35static void omap_hsmmc1_before_set_reg(struct device *dev,
36 int power_on, int vdd)
37{
38 u32 reg, prog_io;
39 struct omap_hsmmc_platform_data *mmc = dev->platform_data;
40
41 if (mmc->remux)
42 mmc->remux(dev, power_on);
43
44 /*
45 * Assume we power both OMAP VMMC1 (for CMD, CLK, DAT0..3) and the
46 * card with Vcc regulator (from twl4030 or whatever). OMAP has both
47 * 1.8V and 3.0V modes, controlled by the PBIAS register.
48 *
49 * In 8-bit modes, OMAP VMMC1A (for DAT4..7) needs a supply, which
50 * is most naturally TWL VSIM; those pins also use PBIAS.
51 *
52 * FIXME handle VMMC1A as needed ...
53 */
54 if (power_on) {
55 if (cpu_is_omap2430()) {
56 reg = omap_ctrl_readl(OMAP243X_CONTROL_DEVCONF1);
57 if ((1 << vdd) >= MMC_VDD_30_31)
58 reg |= OMAP243X_MMC1_ACTIVE_OVERWRITE;
59 else
60 reg &= ~OMAP243X_MMC1_ACTIVE_OVERWRITE;
61 omap_ctrl_writel(reg, OMAP243X_CONTROL_DEVCONF1);
62 }
63
64 if (mmc->internal_clock) {
65 reg = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
66 reg |= OMAP2_MMCSDIO1ADPCLKISEL;
67 omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);
68 }
69
70 reg = omap_ctrl_readl(control_pbias_offset);
71 if (cpu_is_omap3630()) {
72 /* Set MMC I/O to 52MHz */
73 prog_io = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1);
74 prog_io |= OMAP3630_PRG_SDMMC1_SPEEDCTRL;
75 omap_ctrl_writel(prog_io, OMAP343X_CONTROL_PROG_IO1);
76 } else {
77 reg |= OMAP2_PBIASSPEEDCTRL0;
78 }
79 reg &= ~OMAP2_PBIASLITEPWRDNZ0;
80 omap_ctrl_writel(reg, control_pbias_offset);
81 } else {
82 reg = omap_ctrl_readl(control_pbias_offset);
83 reg &= ~OMAP2_PBIASLITEPWRDNZ0;
84 omap_ctrl_writel(reg, control_pbias_offset);
85 }
86}
87
88static void omap_hsmmc1_after_set_reg(struct device *dev, int power_on, int vdd)
89{
90 u32 reg;
91
92 /* 100ms delay required for PBIAS configuration */
93 msleep(100);
94
95 if (power_on) {
96 reg = omap_ctrl_readl(control_pbias_offset);
97 reg |= (OMAP2_PBIASLITEPWRDNZ0 | OMAP2_PBIASSPEEDCTRL0);
98 if ((1 << vdd) <= MMC_VDD_165_195)
99 reg &= ~OMAP2_PBIASLITEVMODE0;
100 else
101 reg |= OMAP2_PBIASLITEVMODE0;
102 omap_ctrl_writel(reg, control_pbias_offset);
103 } else {
104 reg = omap_ctrl_readl(control_pbias_offset);
105 reg |= (OMAP2_PBIASSPEEDCTRL0 | OMAP2_PBIASLITEPWRDNZ0 |
106 OMAP2_PBIASLITEVMODE0);
107 omap_ctrl_writel(reg, control_pbias_offset);
108 }
109}
110
111static void hsmmc2_select_input_clk_src(struct omap_hsmmc_platform_data *mmc)
112{
113 u32 reg;
114
115 reg = omap_ctrl_readl(control_devconf1_offset);
116 if (mmc->internal_clock)
117 reg |= OMAP2_MMCSDIO2ADPCLKISEL;
118 else
119 reg &= ~OMAP2_MMCSDIO2ADPCLKISEL;
120 omap_ctrl_writel(reg, control_devconf1_offset);
121}
122
123static void hsmmc2_before_set_reg(struct device *dev, int power_on, int vdd)
124{
125 struct omap_hsmmc_platform_data *mmc = dev->platform_data;
126
127 if (mmc->remux)
128 mmc->remux(dev, power_on);
129
130 if (power_on)
131 hsmmc2_select_input_clk_src(mmc);
132}
133
134static int am35x_hsmmc2_set_power(struct device *dev, int power_on, int vdd)
135{
136 struct omap_hsmmc_platform_data *mmc = dev->platform_data;
137
138 if (power_on)
139 hsmmc2_select_input_clk_src(mmc);
140
141 return 0;
142}
143
144static int nop_mmc_set_power(struct device *dev, int power_on, int vdd)
145{
146 return 0;
147}
148
149static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, 35static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
150 struct omap_hsmmc_platform_data *mmc) 36 struct omap_hsmmc_platform_data *mmc)
151{ 37{
@@ -157,101 +43,11 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
157 return -ENOMEM; 43 return -ENOMEM;
158 } 44 }
159 45
160 if (c->name) 46 snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i", c->mmc, 1);
161 strncpy(hc_name, c->name, HSMMC_NAME_LEN);
162 else
163 snprintf(hc_name, (HSMMC_NAME_LEN + 1), "mmc%islot%i",
164 c->mmc, 1);
165 mmc->name = hc_name; 47 mmc->name = hc_name;
166 mmc->caps = c->caps; 48 mmc->caps = c->caps;
167 mmc->internal_clock = !c->ext_clock;
168 mmc->reg_offset = 0; 49 mmc->reg_offset = 0;
169 50
170 if (c->cover_only) {
171 /* detect if mobile phone cover removed */
172 mmc->gpio_cd = -EINVAL;
173 mmc->gpio_cod = c->gpio_cd;
174 } else {
175 /* card detect pin on the mmc socket itself */
176 mmc->gpio_cd = c->gpio_cd;
177 mmc->gpio_cod = -EINVAL;
178 }
179 mmc->gpio_wp = c->gpio_wp;
180
181 mmc->remux = c->remux;
182 mmc->init_card = c->init_card;
183
184 if (c->nonremovable)
185 mmc->nonremovable = 1;
186
187 /*
188 * NOTE: MMC slots should have a Vcc regulator set up.
189 * This may be from a TWL4030-family chip, another
190 * controllable regulator, or a fixed supply.
191 *
192 * temporary HACK: ocr_mask instead of fixed supply
193 */
194 if (soc_is_am35xx())
195 mmc->ocr_mask = MMC_VDD_165_195 |
196 MMC_VDD_26_27 |
197 MMC_VDD_27_28 |
198 MMC_VDD_29_30 |
199 MMC_VDD_30_31 |
200 MMC_VDD_31_32;
201 else
202 mmc->ocr_mask = c->ocr_mask;
203
204 if (!soc_is_am35xx())
205 mmc->features |= HSMMC_HAS_PBIAS;
206
207 switch (c->mmc) {
208 case 1:
209 if (mmc->features & HSMMC_HAS_PBIAS) {
210 /* on-chip level shifting via PBIAS0/PBIAS1 */
211 mmc->before_set_reg =
212 omap_hsmmc1_before_set_reg;
213 mmc->after_set_reg =
214 omap_hsmmc1_after_set_reg;
215 }
216
217 if (soc_is_am35xx())
218 mmc->set_power = nop_mmc_set_power;
219
220 /* OMAP3630 HSMMC1 supports only 4-bit */
221 if (cpu_is_omap3630() &&
222 (c->caps & MMC_CAP_8_BIT_DATA)) {
223 c->caps &= ~MMC_CAP_8_BIT_DATA;
224 c->caps |= MMC_CAP_4_BIT_DATA;
225 mmc->caps = c->caps;
226 }
227 break;
228 case 2:
229 if (soc_is_am35xx())
230 mmc->set_power = am35x_hsmmc2_set_power;
231
232 if (c->ext_clock)
233 c->transceiver = 1;
234 if (c->transceiver && (c->caps & MMC_CAP_8_BIT_DATA)) {
235 c->caps &= ~MMC_CAP_8_BIT_DATA;
236 c->caps |= MMC_CAP_4_BIT_DATA;
237 }
238 if (mmc->features & HSMMC_HAS_PBIAS) {
239 /* off-chip level shifting, or none */
240 mmc->before_set_reg = hsmmc2_before_set_reg;
241 mmc->after_set_reg = NULL;
242 }
243 break;
244 case 3:
245 case 4:
246 case 5:
247 mmc->before_set_reg = NULL;
248 mmc->after_set_reg = NULL;
249 break;
250 default:
251 pr_err("MMC%d configuration not supported!\n", c->mmc);
252 kfree(hc_name);
253 return -ENODEV;
254 }
255 return 0; 51 return 0;
256} 52}
257 53
@@ -260,7 +56,6 @@ static int omap_hsmmc_done;
260void omap_hsmmc_late_init(struct omap2_hsmmc_info *c) 56void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
261{ 57{
262 struct platform_device *pdev; 58 struct platform_device *pdev;
263 struct omap_hsmmc_platform_data *mmc_pdata;
264 int res; 59 int res;
265 60
266 if (omap_hsmmc_done != 1) 61 if (omap_hsmmc_done != 1)
@@ -269,32 +64,12 @@ void omap_hsmmc_late_init(struct omap2_hsmmc_info *c)
269 omap_hsmmc_done++; 64 omap_hsmmc_done++;
270 65
271 for (; c->mmc; c++) { 66 for (; c->mmc; c++) {
272 if (!c->deferred)
273 continue;
274
275 pdev = c->pdev; 67 pdev = c->pdev;
276 if (!pdev) 68 if (!pdev)
277 continue; 69 continue;
278
279 mmc_pdata = pdev->dev.platform_data;
280 if (!mmc_pdata)
281 continue;
282
283 if (c->cover_only) {
284 /* detect if mobile phone cover removed */
285 mmc_pdata->gpio_cd = -EINVAL;
286 mmc_pdata->gpio_cod = c->gpio_cd;
287 } else {
288 /* card detect pin on the mmc socket itself */
289 mmc_pdata->gpio_cd = c->gpio_cd;
290 mmc_pdata->gpio_cod = -EINVAL;
291 }
292 mmc_pdata->gpio_wp = c->gpio_wp;
293
294 res = omap_device_register(pdev); 70 res = omap_device_register(pdev);
295 if (res) 71 if (res)
296 pr_err("Could not late init MMC %s\n", 72 pr_err("Could not late init MMC\n");
297 c->name);
298 } 73 }
299} 74}
300 75
@@ -336,13 +111,6 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
336 if (oh->dev_attr != NULL) { 111 if (oh->dev_attr != NULL) {
337 mmc_dev_attr = oh->dev_attr; 112 mmc_dev_attr = oh->dev_attr;
338 mmc_data->controller_flags = mmc_dev_attr->flags; 113 mmc_data->controller_flags = mmc_dev_attr->flags;
339 /*
340 * erratum 2.1.1.128 doesn't apply if board has
341 * a transceiver is attached
342 */
343 if (hsmmcinfo->transceiver)
344 mmc_data->controller_flags &=
345 ~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
346 } 114 }
347 115
348 pdev = platform_device_alloc(name, ctrl_nr - 1); 116 pdev = platform_device_alloc(name, ctrl_nr - 1);
@@ -367,9 +135,6 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
367 135
368 hsmmcinfo->pdev = pdev; 136 hsmmcinfo->pdev = pdev;
369 137
370 if (hsmmcinfo->deferred)
371 goto free_mmc;
372
373 res = omap_device_register(pdev); 138 res = omap_device_register(pdev);
374 if (res) { 139 if (res) {
375 pr_err("Could not register od for %s\n", name); 140 pr_err("Could not register od for %s\n", name);
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index 69b619ddc765..af9af5094ec3 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -12,18 +12,9 @@ struct omap2_hsmmc_info {
12 u8 mmc; /* controller 1/2/3 */ 12 u8 mmc; /* controller 1/2/3 */
13 u32 caps; /* 4/8 wires and any additional host 13 u32 caps; /* 4/8 wires and any additional host
14 * capabilities OR'd (ref. linux/mmc/host.h) */ 14 * capabilities OR'd (ref. linux/mmc/host.h) */
15 bool transceiver; /* MMC-2 option */
16 bool ext_clock; /* use external pin for input clock */
17 bool cover_only; /* No card detect - just cover switch */
18 bool nonremovable; /* Nonremovable e.g. eMMC */
19 bool deferred; /* mmc needs a deferred probe */
20 int gpio_cd; /* or -EINVAL */ 15 int gpio_cd; /* or -EINVAL */
21 int gpio_wp; /* or -EINVAL */ 16 int gpio_wp; /* or -EINVAL */
22 char *name; /* or NULL for default */
23 struct platform_device *pdev; /* mmc controller instance */ 17 struct platform_device *pdev; /* mmc controller instance */
24 int ocr_mask; /* temporary HACK */
25 /* Remux (pad configuration) when powering on/off */
26 void (*remux)(struct device *dev, int power_on);
27 /* init some special card */ 18 /* init some special card */
28 void (*init_card)(struct mmc_card *card); 19 void (*init_card)(struct mmc_card *card);
29}; 20};
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 28083ef72819..71a34e8c345a 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -133,6 +133,7 @@ static irqreturn_t db8500_pmu_handler(int irq, void *dev, irq_handler_t handler)
133 133
134static struct arm_pmu_platdata db8500_pmu_platdata = { 134static struct arm_pmu_platdata db8500_pmu_platdata = {
135 .handle_irq = db8500_pmu_handler, 135 .handle_irq = db8500_pmu_handler,
136 .irq_flags = IRQF_NOBALANCING | IRQF_NO_THREAD,
136}; 137};
137 138
138static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { 139static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 90ee354d803e..6db5fc26d154 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -40,9 +40,21 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
40 40
41{ 41{
42 const struct dma_map_ops *ops = &dma_noop_ops; 42 const struct dma_map_ops *ops = &dma_noop_ops;
43 void *ret;
43 44
44 /* 45 /*
45 * We are here because: 46 * Try generic allocator first if we are advertised that
47 * consistency is not required.
48 */
49
50 if (attrs & DMA_ATTR_NON_CONSISTENT)
51 return ops->alloc(dev, size, dma_handle, gfp, attrs);
52
53 ret = dma_alloc_from_global_coherent(size, dma_handle);
54
55 /*
56 * dma_alloc_from_global_coherent() may fail because:
57 *
46 * - no consistent DMA region has been defined, so we can't 58 * - no consistent DMA region has been defined, so we can't
47 * continue. 59 * continue.
48 * - there is no space left in consistent DMA region, so we 60 * - there is no space left in consistent DMA region, so we
@@ -50,11 +62,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
50 * advertised that consistency is not required. 62 * advertised that consistency is not required.
51 */ 63 */
52 64
53 if (attrs & DMA_ATTR_NON_CONSISTENT) 65 WARN_ON_ONCE(ret == NULL);
54 return ops->alloc(dev, size, dma_handle, gfp, attrs); 66 return ret;
55
56 WARN_ON_ONCE(1);
57 return NULL;
58} 67}
59 68
60static void arm_nommu_dma_free(struct device *dev, size_t size, 69static void arm_nommu_dma_free(struct device *dev, size_t size,
@@ -63,14 +72,31 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
63{ 72{
64 const struct dma_map_ops *ops = &dma_noop_ops; 73 const struct dma_map_ops *ops = &dma_noop_ops;
65 74
66 if (attrs & DMA_ATTR_NON_CONSISTENT) 75 if (attrs & DMA_ATTR_NON_CONSISTENT) {
67 ops->free(dev, size, cpu_addr, dma_addr, attrs); 76 ops->free(dev, size, cpu_addr, dma_addr, attrs);
68 else 77 } else {
69 WARN_ON_ONCE(1); 78 int ret = dma_release_from_global_coherent(get_order(size),
79 cpu_addr);
80
81 WARN_ON_ONCE(ret == 0);
82 }
70 83
71 return; 84 return;
72} 85}
73 86
87static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
88 void *cpu_addr, dma_addr_t dma_addr, size_t size,
89 unsigned long attrs)
90{
91 int ret;
92
93 if (dma_mmap_from_global_coherent(vma, cpu_addr, size, &ret))
94 return ret;
95
96 return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
97}
98
99
74static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size, 100static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
75 enum dma_data_direction dir) 101 enum dma_data_direction dir)
76{ 102{
@@ -173,6 +199,7 @@ static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist
173const struct dma_map_ops arm_nommu_dma_ops = { 199const struct dma_map_ops arm_nommu_dma_ops = {
174 .alloc = arm_nommu_dma_alloc, 200 .alloc = arm_nommu_dma_alloc,
175 .free = arm_nommu_dma_free, 201 .free = arm_nommu_dma_free,
202 .mmap = arm_nommu_dma_mmap,
176 .map_page = arm_nommu_dma_map_page, 203 .map_page = arm_nommu_dma_map_page,
177 .unmap_page = arm_nommu_dma_unmap_page, 204 .unmap_page = arm_nommu_dma_unmap_page,
178 .map_sg = arm_nommu_dma_map_sg, 205 .map_sg = arm_nommu_dma_map_sg,
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e7380bafbfa6..fcf1473d6fed 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -851,7 +851,7 @@ static int __arm_dma_mmap(struct device *dev, struct vm_area_struct *vma,
851 unsigned long pfn = dma_to_pfn(dev, dma_addr); 851 unsigned long pfn = dma_to_pfn(dev, dma_addr);
852 unsigned long off = vma->vm_pgoff; 852 unsigned long off = vma->vm_pgoff;
853 853
854 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) 854 if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
855 return ret; 855 return ret;
856 856
857 if (off < nr_pages && nr_vma_pages <= (nr_pages - off)) { 857 if (off < nr_pages && nr_vma_pages <= (nr_pages - off)) {
diff --git a/arch/arm64/include/asm/atomic_lse.h b/arch/arm64/include/asm/atomic_lse.h
index 99fa69c9c3cf..9ef0797380cb 100644
--- a/arch/arm64/include/asm/atomic_lse.h
+++ b/arch/arm64/include/asm/atomic_lse.h
@@ -435,7 +435,7 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
435 " sub x30, x30, %[ret]\n" 435 " sub x30, x30, %[ret]\n"
436 " cbnz x30, 1b\n" 436 " cbnz x30, 1b\n"
437 "2:") 437 "2:")
438 : [ret] "+&r" (x0), [v] "+Q" (v->counter) 438 : [ret] "+r" (x0), [v] "+Q" (v->counter)
439 : 439 :
440 : __LL_SC_CLOBBERS, "cc", "memory"); 440 : __LL_SC_CLOBBERS, "cc", "memory");
441 441
diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
index 366448eb0fb7..a02a57186f56 100644
--- a/arch/arm64/include/asm/bug.h
+++ b/arch/arm64/include/asm/bug.h
@@ -36,7 +36,7 @@
36#ifdef CONFIG_GENERIC_BUG 36#ifdef CONFIG_GENERIC_BUG
37 37
38#define __BUG_ENTRY(flags) \ 38#define __BUG_ENTRY(flags) \
39 ".pushsection __bug_table,\"a\"\n\t" \ 39 ".pushsection __bug_table,\"aw\"\n\t" \
40 ".align 2\n\t" \ 40 ".align 2\n\t" \
41 "0: .long 1f - 0b\n\t" \ 41 "0: .long 1f - 0b\n\t" \
42_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ 42_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 16e44fa9b3b6..248339e4aaf5 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -492,7 +492,7 @@ asm(
492 * the "%x0" template means XZR. 492 * the "%x0" template means XZR.
493 */ 493 */
494#define write_sysreg(v, r) do { \ 494#define write_sysreg(v, r) do { \
495 u64 __val = (u64)v; \ 495 u64 __val = (u64)(v); \
496 asm volatile("msr " __stringify(r) ", %x0" \ 496 asm volatile("msr " __stringify(r) ", %x0" \
497 : : "rZ" (__val)); \ 497 : : "rZ" (__val)); \
498} while (0) 498} while (0)
@@ -508,7 +508,7 @@ asm(
508}) 508})
509 509
510#define write_sysreg_s(v, r) do { \ 510#define write_sysreg_s(v, r) do { \
511 u64 __val = (u64)v; \ 511 u64 __val = (u64)(v); \
512 asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val)); \ 512 asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val)); \
513} while (0) 513} while (0)
514 514
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index 8f0a1de11e4a..fab46a0ea223 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -69,7 +69,7 @@ static inline void set_fs(mm_segment_t fs)
69 */ 69 */
70#define __range_ok(addr, size) \ 70#define __range_ok(addr, size) \
71({ \ 71({ \
72 unsigned long __addr = (unsigned long __force)(addr); \ 72 unsigned long __addr = (unsigned long)(addr); \
73 unsigned long flag, roksum; \ 73 unsigned long flag, roksum; \
74 __chk_user_ptr(addr); \ 74 __chk_user_ptr(addr); \
75 asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, ls" \ 75 asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, ls" \
diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c
index e137ceaf5016..d16978213c5b 100644
--- a/arch/arm64/kernel/cpu_ops.c
+++ b/arch/arm64/kernel/cpu_ops.c
@@ -82,8 +82,8 @@ static const char *__init cpu_read_enable_method(int cpu)
82 * Don't warn spuriously. 82 * Don't warn spuriously.
83 */ 83 */
84 if (cpu != 0) 84 if (cpu != 0)
85 pr_err("%s: missing enable-method property\n", 85 pr_err("%pOF: missing enable-method property\n",
86 dn->full_name); 86 dn);
87 } 87 }
88 } else { 88 } else {
89 enable_method = acpi_get_enable_method(cpu); 89 enable_method = acpi_get_enable_method(cpu);
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 321119881abf..dc66e6ec3a99 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -469,7 +469,7 @@ static u64 __init of_get_cpu_mpidr(struct device_node *dn)
469 */ 469 */
470 cell = of_get_property(dn, "reg", NULL); 470 cell = of_get_property(dn, "reg", NULL);
471 if (!cell) { 471 if (!cell) {
472 pr_err("%s: missing reg property\n", dn->full_name); 472 pr_err("%pOF: missing reg property\n", dn);
473 return INVALID_HWID; 473 return INVALID_HWID;
474 } 474 }
475 475
@@ -478,7 +478,7 @@ static u64 __init of_get_cpu_mpidr(struct device_node *dn)
478 * Non affinity bits must be set to 0 in the DT 478 * Non affinity bits must be set to 0 in the DT
479 */ 479 */
480 if (hwid & ~MPIDR_HWID_BITMASK) { 480 if (hwid & ~MPIDR_HWID_BITMASK) {
481 pr_err("%s: invalid reg property\n", dn->full_name); 481 pr_err("%pOF: invalid reg property\n", dn);
482 return INVALID_HWID; 482 return INVALID_HWID;
483 } 483 }
484 return hwid; 484 return hwid;
@@ -627,8 +627,8 @@ static void __init of_parse_and_init_cpus(void)
627 goto next; 627 goto next;
628 628
629 if (is_mpidr_duplicate(cpu_count, hwid)) { 629 if (is_mpidr_duplicate(cpu_count, hwid)) {
630 pr_err("%s: duplicate cpu reg properties in the DT\n", 630 pr_err("%pOF: duplicate cpu reg properties in the DT\n",
631 dn->full_name); 631 dn);
632 goto next; 632 goto next;
633 } 633 }
634 634
@@ -640,8 +640,8 @@ static void __init of_parse_and_init_cpus(void)
640 */ 640 */
641 if (hwid == cpu_logical_map(0)) { 641 if (hwid == cpu_logical_map(0)) {
642 if (bootcpu_valid) { 642 if (bootcpu_valid) {
643 pr_err("%s: duplicate boot cpu reg property in DT\n", 643 pr_err("%pOF: duplicate boot cpu reg property in DT\n",
644 dn->full_name); 644 dn);
645 goto next; 645 goto next;
646 } 646 }
647 647
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
index 79244c75eaec..8d48b233e6ce 100644
--- a/arch/arm64/kernel/topology.c
+++ b/arch/arm64/kernel/topology.c
@@ -45,7 +45,7 @@ static int __init get_cpu_for_node(struct device_node *node)
45 } 45 }
46 } 46 }
47 47
48 pr_crit("Unable to find CPU node for %s\n", cpu_node->full_name); 48 pr_crit("Unable to find CPU node for %pOF\n", cpu_node);
49 49
50 of_node_put(cpu_node); 50 of_node_put(cpu_node);
51 return -1; 51 return -1;
@@ -71,8 +71,8 @@ static int __init parse_core(struct device_node *core, int cluster_id,
71 cpu_topology[cpu].core_id = core_id; 71 cpu_topology[cpu].core_id = core_id;
72 cpu_topology[cpu].thread_id = i; 72 cpu_topology[cpu].thread_id = i;
73 } else { 73 } else {
74 pr_err("%s: Can't get CPU for thread\n", 74 pr_err("%pOF: Can't get CPU for thread\n",
75 t->full_name); 75 t);
76 of_node_put(t); 76 of_node_put(t);
77 return -EINVAL; 77 return -EINVAL;
78 } 78 }
@@ -84,15 +84,15 @@ static int __init parse_core(struct device_node *core, int cluster_id,
84 cpu = get_cpu_for_node(core); 84 cpu = get_cpu_for_node(core);
85 if (cpu >= 0) { 85 if (cpu >= 0) {
86 if (!leaf) { 86 if (!leaf) {
87 pr_err("%s: Core has both threads and CPU\n", 87 pr_err("%pOF: Core has both threads and CPU\n",
88 core->full_name); 88 core);
89 return -EINVAL; 89 return -EINVAL;
90 } 90 }
91 91
92 cpu_topology[cpu].cluster_id = cluster_id; 92 cpu_topology[cpu].cluster_id = cluster_id;
93 cpu_topology[cpu].core_id = core_id; 93 cpu_topology[cpu].core_id = core_id;
94 } else if (leaf) { 94 } else if (leaf) {
95 pr_err("%s: Can't get CPU for leaf core\n", core->full_name); 95 pr_err("%pOF: Can't get CPU for leaf core\n", core);
96 return -EINVAL; 96 return -EINVAL;
97 } 97 }
98 98
@@ -137,8 +137,8 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
137 has_cores = true; 137 has_cores = true;
138 138
139 if (depth == 0) { 139 if (depth == 0) {
140 pr_err("%s: cpu-map children should be clusters\n", 140 pr_err("%pOF: cpu-map children should be clusters\n",
141 c->full_name); 141 c);
142 of_node_put(c); 142 of_node_put(c);
143 return -EINVAL; 143 return -EINVAL;
144 } 144 }
@@ -146,8 +146,8 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
146 if (leaf) { 146 if (leaf) {
147 ret = parse_core(c, cluster_id, core_id++); 147 ret = parse_core(c, cluster_id, core_id++);
148 } else { 148 } else {
149 pr_err("%s: Non-leaf cluster with core %s\n", 149 pr_err("%pOF: Non-leaf cluster with core %s\n",
150 cluster->full_name, name); 150 cluster, name);
151 ret = -EINVAL; 151 ret = -EINVAL;
152 } 152 }
153 153
@@ -159,7 +159,7 @@ static int __init parse_cluster(struct device_node *cluster, int depth)
159 } while (c); 159 } while (c);
160 160
161 if (leaf && !has_cores) 161 if (leaf && !has_cores)
162 pr_warn("%s: empty cluster\n", cluster->full_name); 162 pr_warn("%pOF: empty cluster\n", cluster);
163 163
164 if (leaf) 164 if (leaf)
165 cluster_id++; 165 cluster_id++;
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index c7c7088097be..d48f47080213 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -274,10 +274,12 @@ static DEFINE_RAW_SPINLOCK(die_lock);
274void die(const char *str, struct pt_regs *regs, int err) 274void die(const char *str, struct pt_regs *regs, int err)
275{ 275{
276 int ret; 276 int ret;
277 unsigned long flags;
278
279 raw_spin_lock_irqsave(&die_lock, flags);
277 280
278 oops_enter(); 281 oops_enter();
279 282
280 raw_spin_lock_irq(&die_lock);
281 console_verbose(); 283 console_verbose();
282 bust_spinlocks(1); 284 bust_spinlocks(1);
283 ret = __die(str, err, regs); 285 ret = __die(str, err, regs);
@@ -287,13 +289,15 @@ void die(const char *str, struct pt_regs *regs, int err)
287 289
288 bust_spinlocks(0); 290 bust_spinlocks(0);
289 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); 291 add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
290 raw_spin_unlock_irq(&die_lock);
291 oops_exit(); 292 oops_exit();
292 293
293 if (in_interrupt()) 294 if (in_interrupt())
294 panic("Fatal exception in interrupt"); 295 panic("Fatal exception in interrupt");
295 if (panic_on_oops) 296 if (panic_on_oops)
296 panic("Fatal exception"); 297 panic("Fatal exception");
298
299 raw_spin_unlock_irqrestore(&die_lock, flags);
300
297 if (ret != NOTIFY_STOP) 301 if (ret != NOTIFY_STOP)
298 do_exit(SIGSEGV); 302 do_exit(SIGSEGV);
299} 303}
diff --git a/arch/arm64/lib/copy_page.S b/arch/arm64/lib/copy_page.S
index c3cd65e31814..076c43715e64 100644
--- a/arch/arm64/lib/copy_page.S
+++ b/arch/arm64/lib/copy_page.S
@@ -30,9 +30,10 @@
30 */ 30 */
31ENTRY(copy_page) 31ENTRY(copy_page)
32alternative_if ARM64_HAS_NO_HW_PREFETCH 32alternative_if ARM64_HAS_NO_HW_PREFETCH
33 # Prefetch two cache lines ahead. 33 // Prefetch three cache lines ahead.
34 prfm pldl1strm, [x1, #128] 34 prfm pldl1strm, [x1, #128]
35 prfm pldl1strm, [x1, #256] 35 prfm pldl1strm, [x1, #256]
36 prfm pldl1strm, [x1, #384]
36alternative_else_nop_endif 37alternative_else_nop_endif
37 38
38 ldp x2, x3, [x1] 39 ldp x2, x3, [x1]
@@ -50,7 +51,7 @@ alternative_else_nop_endif
50 subs x18, x18, #128 51 subs x18, x18, #128
51 52
52alternative_if ARM64_HAS_NO_HW_PREFETCH 53alternative_if ARM64_HAS_NO_HW_PREFETCH
53 prfm pldl1strm, [x1, #384] 54 prfm pldl1strm, [x1, #384]
54alternative_else_nop_endif 55alternative_else_nop_endif
55 56
56 stnp x2, x3, [x0] 57 stnp x2, x3, [x0]
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index e90cd1db42a8..f27d4dd04384 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -329,7 +329,7 @@ static int __swiotlb_mmap(struct device *dev,
329 vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot, 329 vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
330 is_device_dma_coherent(dev)); 330 is_device_dma_coherent(dev));
331 331
332 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) 332 if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
333 return ret; 333 return ret;
334 334
335 return __swiotlb_mmap_pfn(vma, pfn, size); 335 return __swiotlb_mmap_pfn(vma, pfn, size);
@@ -706,7 +706,7 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
706 vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot, 706 vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
707 is_device_dma_coherent(dev)); 707 is_device_dma_coherent(dev));
708 708
709 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) 709 if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
710 return ret; 710 return ret;
711 711
712 if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) { 712 if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) {
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 23c2d89a362e..f1eb15e0e864 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -496,7 +496,7 @@ void mark_rodata_ro(void)
496 496
497static void __init map_kernel_segment(pgd_t *pgd, void *va_start, void *va_end, 497static void __init map_kernel_segment(pgd_t *pgd, void *va_start, void *va_end,
498 pgprot_t prot, struct vm_struct *vma, 498 pgprot_t prot, struct vm_struct *vma,
499 int flags) 499 int flags, unsigned long vm_flags)
500{ 500{
501 phys_addr_t pa_start = __pa_symbol(va_start); 501 phys_addr_t pa_start = __pa_symbol(va_start);
502 unsigned long size = va_end - va_start; 502 unsigned long size = va_end - va_start;
@@ -507,10 +507,13 @@ static void __init map_kernel_segment(pgd_t *pgd, void *va_start, void *va_end,
507 __create_pgd_mapping(pgd, pa_start, (unsigned long)va_start, size, prot, 507 __create_pgd_mapping(pgd, pa_start, (unsigned long)va_start, size, prot,
508 early_pgtable_alloc, flags); 508 early_pgtable_alloc, flags);
509 509
510 if (!(vm_flags & VM_NO_GUARD))
511 size += PAGE_SIZE;
512
510 vma->addr = va_start; 513 vma->addr = va_start;
511 vma->phys_addr = pa_start; 514 vma->phys_addr = pa_start;
512 vma->size = size; 515 vma->size = size;
513 vma->flags = VM_MAP; 516 vma->flags = VM_MAP | vm_flags;
514 vma->caller = __builtin_return_address(0); 517 vma->caller = __builtin_return_address(0);
515 518
516 vm_area_add_early(vma); 519 vm_area_add_early(vma);
@@ -541,14 +544,15 @@ static void __init map_kernel(pgd_t *pgd)
541 * Only rodata will be remapped with different permissions later on, 544 * Only rodata will be remapped with different permissions later on,
542 * all other segments are allowed to use contiguous mappings. 545 * all other segments are allowed to use contiguous mappings.
543 */ 546 */
544 map_kernel_segment(pgd, _text, _etext, text_prot, &vmlinux_text, 0); 547 map_kernel_segment(pgd, _text, _etext, text_prot, &vmlinux_text, 0,
548 VM_NO_GUARD);
545 map_kernel_segment(pgd, __start_rodata, __inittext_begin, PAGE_KERNEL, 549 map_kernel_segment(pgd, __start_rodata, __inittext_begin, PAGE_KERNEL,
546 &vmlinux_rodata, NO_CONT_MAPPINGS); 550 &vmlinux_rodata, NO_CONT_MAPPINGS, VM_NO_GUARD);
547 map_kernel_segment(pgd, __inittext_begin, __inittext_end, text_prot, 551 map_kernel_segment(pgd, __inittext_begin, __inittext_end, text_prot,
548 &vmlinux_inittext, 0); 552 &vmlinux_inittext, 0, VM_NO_GUARD);
549 map_kernel_segment(pgd, __initdata_begin, __initdata_end, PAGE_KERNEL, 553 map_kernel_segment(pgd, __initdata_begin, __initdata_end, PAGE_KERNEL,
550 &vmlinux_initdata, 0); 554 &vmlinux_initdata, 0, VM_NO_GUARD);
551 map_kernel_segment(pgd, _data, _end, PAGE_KERNEL, &vmlinux_data, 0); 555 map_kernel_segment(pgd, _data, _end, PAGE_KERNEL, &vmlinux_data, 0, 0);
552 556
553 if (!pgd_val(*pgd_offset_raw(pgd, FIXADDR_START))) { 557 if (!pgd_val(*pgd_offset_raw(pgd, FIXADDR_START))) {
554 /* 558 /*
diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index b388a99fea7b..dad128ba98bf 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -208,8 +208,6 @@ int __init numa_add_memblk(int nid, u64 start, u64 end)
208 } 208 }
209 209
210 node_set(nid, numa_nodes_parsed); 210 node_set(nid, numa_nodes_parsed);
211 pr_info("Adding memblock [0x%llx - 0x%llx] on node %d\n",
212 start, (end - 1), nid);
213 return ret; 211 return ret;
214} 212}
215 213
@@ -223,10 +221,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
223 void *nd; 221 void *nd;
224 int tnid; 222 int tnid;
225 223
226 if (start_pfn < end_pfn) 224 if (start_pfn >= end_pfn)
227 pr_info("Initmem setup node %d [mem %#010Lx-%#010Lx]\n", nid,
228 start_pfn << PAGE_SHIFT, (end_pfn << PAGE_SHIFT) - 1);
229 else
230 pr_info("Initmem setup node %d [<memory-less node>]\n", nid); 225 pr_info("Initmem setup node %d [<memory-less node>]\n", nid);
231 226
232 nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid); 227 nd_pa = memblock_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
diff --git a/arch/blackfin/include/asm/bug.h b/arch/blackfin/include/asm/bug.h
index 8d9b1eba89c4..76b2e82ee730 100644
--- a/arch/blackfin/include/asm/bug.h
+++ b/arch/blackfin/include/asm/bug.h
@@ -21,7 +21,7 @@
21#define _BUG_OR_WARN(flags) \ 21#define _BUG_OR_WARN(flags) \
22 asm volatile( \ 22 asm volatile( \
23 "1: .hword %0\n" \ 23 "1: .hword %0\n" \
24 " .section __bug_table,\"a\",@progbits\n" \ 24 " .section __bug_table,\"aw\",@progbits\n" \
25 "2: .long 1b\n" \ 25 "2: .long 1b\n" \
26 " .long %1\n" \ 26 " .long %1\n" \
27 " .short %2\n" \ 27 " .short %2\n" \
@@ -38,7 +38,7 @@
38#define _BUG_OR_WARN(flags) \ 38#define _BUG_OR_WARN(flags) \
39 asm volatile( \ 39 asm volatile( \
40 "1: .hword %0\n" \ 40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \ 41 " .section __bug_table,\"aw\",@progbits\n" \
42 "2: .long 1b\n" \ 42 "2: .long 1b\n" \
43 " .short %1\n" \ 43 " .short %1\n" \
44 " .org 2b + %2\n" \ 44 " .org 2b + %2\n" \
diff --git a/arch/blackfin/include/asm/flat.h b/arch/blackfin/include/asm/flat.h
index 296d7f56fbfd..f1d6ba7afbf2 100644
--- a/arch/blackfin/include/asm/flat.h
+++ b/arch/blackfin/include/asm/flat.h
@@ -44,8 +44,7 @@ flat_get_relocate_addr (unsigned long relval)
44 return relval & 0x03ffffff; /* Mask out top 6 bits */ 44 return relval & 0x03ffffff; /* Mask out top 6 bits */
45} 45}
46 46
47static inline int flat_set_persistent(unsigned long relval, 47static inline int flat_set_persistent(u32 relval, u32 *persistent)
48 unsigned long *persistent)
49{ 48{
50 int type = (relval >> 26) & 7; 49 int type = (relval >> 26) & 7;
51 if (type == 3) { 50 if (type == 3) {
diff --git a/arch/blackfin/kernel/flat.c b/arch/blackfin/kernel/flat.c
index d29ab6a2e909..8ebc54daaa8e 100644
--- a/arch/blackfin/kernel/flat.c
+++ b/arch/blackfin/kernel/flat.c
@@ -32,7 +32,7 @@ unsigned long bfin_get_addr_from_rp(u32 *ptr,
32 break; 32 break;
33 33
34 case FLAT_BFIN_RELOC_TYPE_32_BIT: 34 case FLAT_BFIN_RELOC_TYPE_32_BIT:
35 pr_debug("*ptr = %lx", get_unaligned(ptr)); 35 pr_debug("*ptr = %x", get_unaligned(ptr));
36 val = get_unaligned(ptr); 36 val = get_unaligned(ptr);
37 break; 37 break;
38 38
@@ -77,7 +77,7 @@ void bfin_put_addr_at_rp(u32 *ptr, u32 addr, u32 relval)
77 77
78 case FLAT_BFIN_RELOC_TYPE_32_BIT: 78 case FLAT_BFIN_RELOC_TYPE_32_BIT:
79 put_unaligned(addr, ptr); 79 put_unaligned(addr, ptr);
80 pr_debug("new ptr =%lx", get_unaligned(ptr)); 80 pr_debug("new ptr =%x", get_unaligned(ptr));
81 break; 81 break;
82 } 82 }
83} 83}
diff --git a/arch/h8300/include/asm/flat.h b/arch/h8300/include/asm/flat.h
index 18d024251738..7e0bd6fa1532 100644
--- a/arch/h8300/include/asm/flat.h
+++ b/arch/h8300/include/asm/flat.h
@@ -24,7 +24,7 @@ static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
24 u32 *addr, u32 *persistent) 24 u32 *addr, u32 *persistent)
25{ 25{
26 u32 val = get_unaligned((__force u32 *)rp); 26 u32 val = get_unaligned((__force u32 *)rp);
27 if (!(flags & FLAT_FLAG_GOTPIC) 27 if (!(flags & FLAT_FLAG_GOTPIC))
28 val &= 0x00ffffff; 28 val &= 0x00ffffff;
29 *addr = val; 29 *addr = val;
30 return 0; 30 return 0;
diff --git a/arch/m68k/include/asm/flat.h b/arch/m68k/include/asm/flat.h
index 48b62790fe70..b2a41f5b3890 100644
--- a/arch/m68k/include/asm/flat.h
+++ b/arch/m68k/include/asm/flat.h
@@ -30,8 +30,7 @@ static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
30} 30}
31#define flat_get_relocate_addr(rel) (rel) 31#define flat_get_relocate_addr(rel) (rel)
32 32
33static inline int flat_set_persistent(unsigned long relval, 33static inline int flat_set_persistent(u32 relval, u32 *persistent)
34 unsigned long *persistent)
35{ 34{
36 return 0; 35 return 0;
37} 36}
diff --git a/arch/mips/include/uapi/asm/ioctls.h b/arch/mips/include/uapi/asm/ioctls.h
index 68e19b689a00..1609cb0907ac 100644
--- a/arch/mips/include/uapi/asm/ioctls.h
+++ b/arch/mips/include/uapi/asm/ioctls.h
@@ -91,7 +91,7 @@
91#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 91#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
92#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 92#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
93#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 93#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
94#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 94#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
95 95
96/* I hope the range from 0x5480 on is free ... */ 96/* I hope the range from 0x5480 on is free ... */
97#define TIOCSCTTY 0x5480 /* become controlling tty */ 97#define TIOCSCTTY 0x5480 /* become controlling tty */
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index e08598c70b3e..8e78251eccc2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -232,7 +232,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma,
232 else 232 else
233 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 233 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
234 234
235 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) 235 if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
236 return ret; 236 return ret;
237 237
238 if (off < count && user_count <= (count - off)) { 238 if (off < count && user_count <= (count - off)) {
diff --git a/arch/mn10300/include/asm/bug.h b/arch/mn10300/include/asm/bug.h
index aa6a38886391..811414fb002d 100644
--- a/arch/mn10300/include/asm/bug.h
+++ b/arch/mn10300/include/asm/bug.h
@@ -21,7 +21,7 @@ do { \
21 asm volatile( \ 21 asm volatile( \
22 " syscall 15 \n" \ 22 " syscall 15 \n" \
23 "0: \n" \ 23 "0: \n" \
24 " .section __bug_table,\"a\" \n" \ 24 " .section __bug_table,\"aw\" \n" \
25 " .long 0b,%0,%1 \n" \ 25 " .long 0b,%0,%1 \n" \
26 " .previous \n" \ 26 " .previous \n" \
27 : \ 27 : \
diff --git a/arch/parisc/configs/712_defconfig b/arch/parisc/configs/712_defconfig
index 143d02652792..ccc109761f44 100644
--- a/arch/parisc/configs/712_defconfig
+++ b/arch/parisc/configs/712_defconfig
@@ -1,11 +1,9 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 6CONFIG_LOG_BUF_SHIFT=16
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
10CONFIG_KALLSYMS_ALL=y 8CONFIG_KALLSYMS_ALL=y
11CONFIG_SLAB=y 9CONFIG_SLAB=y
@@ -14,7 +12,6 @@ CONFIG_OPROFILE=m
14CONFIG_MODULES=y 12CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
16CONFIG_MODULE_FORCE_UNLOAD=y 14CONFIG_MODULE_FORCE_UNLOAD=y
17# CONFIG_BLK_DEV_BSG is not set
18CONFIG_PA7100LC=y 15CONFIG_PA7100LC=y
19CONFIG_PREEMPT_VOLUNTARY=y 16CONFIG_PREEMPT_VOLUNTARY=y
20CONFIG_GSC_LASI=y 17CONFIG_GSC_LASI=y
@@ -32,11 +29,9 @@ CONFIG_IP_PNP_DHCP=y
32CONFIG_IP_PNP_BOOTP=y 29CONFIG_IP_PNP_BOOTP=y
33CONFIG_INET_AH=m 30CONFIG_INET_AH=m
34CONFIG_INET_ESP=m 31CONFIG_INET_ESP=m
35# CONFIG_INET_LRO is not set
36CONFIG_INET_DIAG=m 32CONFIG_INET_DIAG=m
37# CONFIG_IPV6 is not set 33# CONFIG_IPV6 is not set
38CONFIG_NETFILTER=y 34CONFIG_NETFILTER=y
39CONFIG_IP_NF_QUEUE=m
40CONFIG_LLC2=m 35CONFIG_LLC2=m
41CONFIG_NET_PKTGEN=m 36CONFIG_NET_PKTGEN=m
42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
@@ -65,21 +60,20 @@ CONFIG_MD_LINEAR=m
65CONFIG_MD_RAID0=m 60CONFIG_MD_RAID0=m
66CONFIG_MD_RAID1=m 61CONFIG_MD_RAID1=m
67CONFIG_NETDEVICES=y 62CONFIG_NETDEVICES=y
68CONFIG_DUMMY=m
69CONFIG_BONDING=m 63CONFIG_BONDING=m
64CONFIG_DUMMY=m
70CONFIG_TUN=m 65CONFIG_TUN=m
71CONFIG_NET_ETHERNET=y
72CONFIG_MII=m
73CONFIG_LASI_82596=y 66CONFIG_LASI_82596=y
74CONFIG_PPP=m 67CONFIG_PPP=m
75CONFIG_PPP_ASYNC=m
76CONFIG_PPP_SYNC_TTY=m
77CONFIG_PPP_DEFLATE=m
78CONFIG_PPP_BSDCOMP=m 68CONFIG_PPP_BSDCOMP=m
69CONFIG_PPP_DEFLATE=m
79CONFIG_PPP_MPPE=m 70CONFIG_PPP_MPPE=m
80CONFIG_PPPOE=m 71CONFIG_PPPOE=m
72CONFIG_PPP_ASYNC=m
73CONFIG_PPP_SYNC_TTY=m
81# CONFIG_KEYBOARD_HIL_OLD is not set 74# CONFIG_KEYBOARD_HIL_OLD is not set
82CONFIG_MOUSE_SERIAL=m 75CONFIG_MOUSE_SERIAL=m
76CONFIG_LEGACY_PTY_COUNT=64
83CONFIG_SERIAL_8250=y 77CONFIG_SERIAL_8250=y
84CONFIG_SERIAL_8250_CONSOLE=y 78CONFIG_SERIAL_8250_CONSOLE=y
85CONFIG_SERIAL_8250_NR_UARTS=17 79CONFIG_SERIAL_8250_NR_UARTS=17
@@ -88,22 +82,17 @@ CONFIG_SERIAL_8250_MANY_PORTS=y
88CONFIG_SERIAL_8250_SHARE_IRQ=y 82CONFIG_SERIAL_8250_SHARE_IRQ=y
89# CONFIG_SERIAL_MUX is not set 83# CONFIG_SERIAL_MUX is not set
90CONFIG_PDC_CONSOLE=y 84CONFIG_PDC_CONSOLE=y
91CONFIG_LEGACY_PTY_COUNT=64
92CONFIG_PRINTER=m 85CONFIG_PRINTER=m
93CONFIG_PPDEV=m 86CONFIG_PPDEV=m
94# CONFIG_HW_RANDOM is not set 87# CONFIG_HW_RANDOM is not set
95CONFIG_RAW_DRIVER=y 88CONFIG_RAW_DRIVER=y
96# CONFIG_HWMON is not set 89# CONFIG_HWMON is not set
97CONFIG_VIDEO_OUTPUT_CONTROL=m
98CONFIG_FB=y 90CONFIG_FB=y
99CONFIG_FB_MODE_HELPERS=y 91CONFIG_FB_MODE_HELPERS=y
100CONFIG_FB_TILEBLITTING=y 92CONFIG_FB_TILEBLITTING=y
101CONFIG_DUMMY_CONSOLE_COLUMNS=128 93CONFIG_DUMMY_CONSOLE_COLUMNS=128
102CONFIG_DUMMY_CONSOLE_ROWS=48 94CONFIG_DUMMY_CONSOLE_ROWS=48
103CONFIG_FRAMEBUFFER_CONSOLE=y 95CONFIG_FRAMEBUFFER_CONSOLE=y
104CONFIG_FONTS=y
105CONFIG_FONT_8x8=y
106CONFIG_FONT_8x16=y
107CONFIG_LOGO=y 96CONFIG_LOGO=y
108# CONFIG_LOGO_LINUX_MONO is not set 97# CONFIG_LOGO_LINUX_MONO is not set
109# CONFIG_LOGO_LINUX_VGA16 is not set 98# CONFIG_LOGO_LINUX_VGA16 is not set
@@ -111,13 +100,9 @@ CONFIG_LOGO=y
111CONFIG_SOUND=y 100CONFIG_SOUND=y
112CONFIG_SND=y 101CONFIG_SND=y
113CONFIG_SND_SEQUENCER=y 102CONFIG_SND_SEQUENCER=y
114CONFIG_SND_MIXER_OSS=y
115CONFIG_SND_PCM_OSS=y
116CONFIG_SND_SEQUENCER_OSS=y
117CONFIG_SND_HARMONY=y 103CONFIG_SND_HARMONY=y
118CONFIG_EXT2_FS=y 104CONFIG_EXT2_FS=y
119CONFIG_EXT3_FS=y 105CONFIG_EXT3_FS=y
120# CONFIG_EXT3_FS_XATTR is not set
121CONFIG_JFS_FS=m 106CONFIG_JFS_FS=m
122CONFIG_XFS_FS=m 107CONFIG_XFS_FS=m
123CONFIG_AUTOFS4_FS=y 108CONFIG_AUTOFS4_FS=y
@@ -130,14 +115,10 @@ CONFIG_PROC_KCORE=y
130CONFIG_TMPFS=y 115CONFIG_TMPFS=y
131CONFIG_UFS_FS=m 116CONFIG_UFS_FS=m
132CONFIG_NFS_FS=y 117CONFIG_NFS_FS=y
133CONFIG_NFS_V3=y
134CONFIG_NFS_V4=y 118CONFIG_NFS_V4=y
135CONFIG_ROOT_NFS=y 119CONFIG_ROOT_NFS=y
136CONFIG_NFSD=m 120CONFIG_NFSD=m
137CONFIG_NFSD_V4=y 121CONFIG_NFSD_V4=y
138CONFIG_RPCSEC_GSS_SPKM3=m
139CONFIG_SMB_FS=m
140CONFIG_SMB_NLS_DEFAULT=y
141CONFIG_CIFS=m 122CONFIG_CIFS=m
142CONFIG_NLS_CODEPAGE_437=m 123CONFIG_NLS_CODEPAGE_437=m
143CONFIG_NLS_CODEPAGE_737=m 124CONFIG_NLS_CODEPAGE_737=m
@@ -177,21 +158,16 @@ CONFIG_NLS_ISO8859_15=m
177CONFIG_NLS_KOI8_R=m 158CONFIG_NLS_KOI8_R=m
178CONFIG_NLS_KOI8_U=m 159CONFIG_NLS_KOI8_U=m
179CONFIG_NLS_UTF8=m 160CONFIG_NLS_UTF8=m
180CONFIG_MAGIC_SYSRQ=y
181CONFIG_DEBUG_FS=y 161CONFIG_DEBUG_FS=y
162CONFIG_MAGIC_SYSRQ=y
182CONFIG_DEBUG_KERNEL=y 163CONFIG_DEBUG_KERNEL=y
183CONFIG_DEBUG_MUTEXES=y 164CONFIG_DEBUG_MUTEXES=y
184# CONFIG_RCU_CPU_STALL_DETECTOR is not set
185CONFIG_CRYPTO_NULL=m
186CONFIG_CRYPTO_TEST=m 165CONFIG_CRYPTO_TEST=m
187CONFIG_CRYPTO_HMAC=y 166CONFIG_CRYPTO_HMAC=y
188CONFIG_CRYPTO_MD4=m
189CONFIG_CRYPTO_MICHAEL_MIC=m 167CONFIG_CRYPTO_MICHAEL_MIC=m
190CONFIG_CRYPTO_SHA256=m
191CONFIG_CRYPTO_SHA512=m 168CONFIG_CRYPTO_SHA512=m
192CONFIG_CRYPTO_TGR192=m 169CONFIG_CRYPTO_TGR192=m
193CONFIG_CRYPTO_WP512=m 170CONFIG_CRYPTO_WP512=m
194CONFIG_CRYPTO_AES=m
195CONFIG_CRYPTO_ANUBIS=m 171CONFIG_CRYPTO_ANUBIS=m
196CONFIG_CRYPTO_BLOWFISH=m 172CONFIG_CRYPTO_BLOWFISH=m
197CONFIG_CRYPTO_CAST6=m 173CONFIG_CRYPTO_CAST6=m
@@ -200,6 +176,7 @@ CONFIG_CRYPTO_SERPENT=m
200CONFIG_CRYPTO_TEA=m 176CONFIG_CRYPTO_TEA=m
201CONFIG_CRYPTO_TWOFISH=m 177CONFIG_CRYPTO_TWOFISH=m
202CONFIG_CRYPTO_DEFLATE=m 178CONFIG_CRYPTO_DEFLATE=m
203# CONFIG_CRYPTO_ANSI_CPRNG is not set
204# CONFIG_CRYPTO_HW is not set 179# CONFIG_CRYPTO_HW is not set
205CONFIG_LIBCRC32C=m 180CONFIG_FONTS=y
181CONFIG_FONT_8x8=y
182CONFIG_FONT_8x16=y
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index 1a4f776b49b8..5acb93dcaabf 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -1,13 +1,10 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 6CONFIG_LOG_BUF_SHIFT=16
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
10# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
11CONFIG_EXPERT=y 8CONFIG_EXPERT=y
12CONFIG_KALLSYMS_ALL=y 9CONFIG_KALLSYMS_ALL=y
13CONFIG_SLAB=y 10CONFIG_SLAB=y
@@ -16,7 +13,6 @@ CONFIG_OPROFILE=m
16CONFIG_MODULES=y 13CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y 14CONFIG_MODULE_UNLOAD=y
18CONFIG_MODULE_FORCE_UNLOAD=y 15CONFIG_MODULE_FORCE_UNLOAD=y
19# CONFIG_BLK_DEV_BSG is not set
20CONFIG_PA8X00=y 16CONFIG_PA8X00=y
21CONFIG_64BIT=y 17CONFIG_64BIT=y
22CONFIG_SMP=y 18CONFIG_SMP=y
@@ -43,21 +39,17 @@ CONFIG_IP_PNP_DHCP=y
43CONFIG_IP_PNP_BOOTP=y 39CONFIG_IP_PNP_BOOTP=y
44CONFIG_INET_AH=m 40CONFIG_INET_AH=m
45CONFIG_INET_ESP=m 41CONFIG_INET_ESP=m
46# CONFIG_INET_LRO is not set
47CONFIG_INET6_AH=m 42CONFIG_INET6_AH=m
48CONFIG_INET6_ESP=m 43CONFIG_INET6_ESP=m
49CONFIG_INET6_IPCOMP=m 44CONFIG_INET6_IPCOMP=m
50CONFIG_IPV6_TUNNEL=m 45CONFIG_IPV6_TUNNEL=m
51CONFIG_NETFILTER=y 46CONFIG_NETFILTER=y
52# CONFIG_NETFILTER_XT_MATCH_DCCP is not set 47# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
53CONFIG_IP_NF_QUEUE=m
54CONFIG_IP_NF_IPTABLES=m 48CONFIG_IP_NF_IPTABLES=m
55CONFIG_IP_NF_MATCH_ECN=m 49CONFIG_IP_NF_MATCH_ECN=m
56CONFIG_IP_NF_MATCH_TTL=m 50CONFIG_IP_NF_MATCH_TTL=m
57CONFIG_IP_NF_FILTER=m 51CONFIG_IP_NF_FILTER=m
58CONFIG_IP_NF_TARGET_REJECT=m 52CONFIG_IP_NF_TARGET_REJECT=m
59CONFIG_IP_NF_TARGET_LOG=m
60CONFIG_IP_NF_TARGET_ULOG=m
61CONFIG_IP_NF_MANGLE=m 53CONFIG_IP_NF_MANGLE=m
62CONFIG_IP_NF_TARGET_ECN=m 54CONFIG_IP_NF_TARGET_ECN=m
63CONFIG_IP_NF_RAW=m 55CONFIG_IP_NF_RAW=m
@@ -70,7 +62,6 @@ CONFIG_IP6_NF_MATCH_OPTS=m
70CONFIG_IP6_NF_MATCH_HL=m 62CONFIG_IP6_NF_MATCH_HL=m
71CONFIG_IP6_NF_MATCH_IPV6HEADER=m 63CONFIG_IP6_NF_MATCH_IPV6HEADER=m
72CONFIG_IP6_NF_MATCH_RT=m 64CONFIG_IP6_NF_MATCH_RT=m
73CONFIG_IP6_NF_TARGET_LOG=m
74CONFIG_IP6_NF_FILTER=m 65CONFIG_IP6_NF_FILTER=m
75CONFIG_IP6_NF_TARGET_REJECT=m 66CONFIG_IP6_NF_TARGET_REJECT=m
76CONFIG_IP6_NF_MANGLE=m 67CONFIG_IP6_NF_MANGLE=m
@@ -94,7 +85,6 @@ CONFIG_BLK_DEV_SD=y
94CONFIG_CHR_DEV_ST=y 85CONFIG_CHR_DEV_ST=y
95CONFIG_BLK_DEV_SR=y 86CONFIG_BLK_DEV_SR=y
96CONFIG_CHR_DEV_SG=y 87CONFIG_CHR_DEV_SG=y
97CONFIG_SCSI_MULTI_LUN=y
98CONFIG_SCSI_ISCSI_ATTRS=m 88CONFIG_SCSI_ISCSI_ATTRS=m
99CONFIG_SCSI_SYM53C8XX_2=y 89CONFIG_SCSI_SYM53C8XX_2=y
100CONFIG_SCSI_QLOGIC_1280=m 90CONFIG_SCSI_QLOGIC_1280=m
@@ -106,43 +96,38 @@ CONFIG_MD_RAID0=y
106CONFIG_MD_RAID1=y 96CONFIG_MD_RAID1=y
107CONFIG_FUSION=y 97CONFIG_FUSION=y
108CONFIG_FUSION_SPI=m 98CONFIG_FUSION_SPI=m
109CONFIG_FUSION_FC=m
110CONFIG_FUSION_CTL=m 99CONFIG_FUSION_CTL=m
111CONFIG_NETDEVICES=y 100CONFIG_NETDEVICES=y
112CONFIG_DUMMY=m
113CONFIG_BONDING=m 101CONFIG_BONDING=m
102CONFIG_DUMMY=m
114CONFIG_TUN=m 103CONFIG_TUN=m
115CONFIG_NET_ETHERNET=y 104CONFIG_PCMCIA_3C574=m
116CONFIG_NET_VENDOR_3COM=y 105CONFIG_PCMCIA_3C589=m
117CONFIG_VORTEX=m 106CONFIG_VORTEX=m
118CONFIG_TYPHOON=m 107CONFIG_TYPHOON=m
108CONFIG_ACENIC=m
109CONFIG_ACENIC_OMIT_TIGON_I=y
110CONFIG_PCNET32=m
111CONFIG_TIGON3=m
119CONFIG_NET_TULIP=y 112CONFIG_NET_TULIP=y
120CONFIG_DE2104X=m 113CONFIG_DE2104X=m
121CONFIG_TULIP=y 114CONFIG_TULIP=y
122CONFIG_TULIP_MMIO=y 115CONFIG_TULIP_MMIO=y
123CONFIG_PCMCIA_XIRCOM=m 116CONFIG_PCMCIA_XIRCOM=m
124CONFIG_HP100=m 117CONFIG_HP100=m
125CONFIG_NET_PCI=y
126CONFIG_PCNET32=m
127CONFIG_E100=m 118CONFIG_E100=m
128CONFIG_ACENIC=m
129CONFIG_ACENIC_OMIT_TIGON_I=y
130CONFIG_E1000=m 119CONFIG_E1000=m
131CONFIG_TIGON3=m
132CONFIG_NET_PCMCIA=y
133CONFIG_PCMCIA_3C589=m
134CONFIG_PCMCIA_3C574=m
135CONFIG_PCMCIA_SMC91C92=m 120CONFIG_PCMCIA_SMC91C92=m
136CONFIG_PCMCIA_XIRC2PS=m 121CONFIG_PCMCIA_XIRC2PS=m
137CONFIG_PPP=m 122CONFIG_PPP=m
123CONFIG_PPP_BSDCOMP=m
124CONFIG_PPP_DEFLATE=m
138CONFIG_PPP_ASYNC=m 125CONFIG_PPP_ASYNC=m
139CONFIG_PPP_SYNC_TTY=m 126CONFIG_PPP_SYNC_TTY=m
140CONFIG_PPP_DEFLATE=m
141CONFIG_PPP_BSDCOMP=m
142# CONFIG_INPUT_MOUSEDEV is not set
143# CONFIG_INPUT_KEYBOARD is not set 127# CONFIG_INPUT_KEYBOARD is not set
144# CONFIG_INPUT_MOUSE is not set 128# CONFIG_INPUT_MOUSE is not set
145# CONFIG_SERIO is not set 129# CONFIG_SERIO is not set
130# CONFIG_LEGACY_PTYS is not set
146CONFIG_SERIAL_8250=y 131CONFIG_SERIAL_8250=y
147CONFIG_SERIAL_8250_CONSOLE=y 132CONFIG_SERIAL_8250_CONSOLE=y
148CONFIG_SERIAL_8250_CS=m 133CONFIG_SERIAL_8250_CS=m
@@ -151,7 +136,6 @@ CONFIG_SERIAL_8250_EXTENDED=y
151CONFIG_SERIAL_8250_MANY_PORTS=y 136CONFIG_SERIAL_8250_MANY_PORTS=y
152CONFIG_SERIAL_8250_SHARE_IRQ=y 137CONFIG_SERIAL_8250_SHARE_IRQ=y
153CONFIG_PDC_CONSOLE=y 138CONFIG_PDC_CONSOLE=y
154# CONFIG_LEGACY_PTYS is not set
155# CONFIG_HW_RANDOM is not set 139# CONFIG_HW_RANDOM is not set
156CONFIG_RAW_DRIVER=y 140CONFIG_RAW_DRIVER=y
157# CONFIG_HWMON is not set 141# CONFIG_HWMON is not set
@@ -160,7 +144,6 @@ CONFIG_AGP_PARISC=y
160# CONFIG_STI_CONSOLE is not set 144# CONFIG_STI_CONSOLE is not set
161CONFIG_EXT2_FS=y 145CONFIG_EXT2_FS=y
162CONFIG_EXT3_FS=y 146CONFIG_EXT3_FS=y
163# CONFIG_EXT3_FS_XATTR is not set
164CONFIG_JFS_FS=m 147CONFIG_JFS_FS=m
165CONFIG_XFS_FS=m 148CONFIG_XFS_FS=m
166CONFIG_AUTOFS4_FS=y 149CONFIG_AUTOFS4_FS=y
@@ -173,13 +156,9 @@ CONFIG_PROC_KCORE=y
173CONFIG_TMPFS=y 156CONFIG_TMPFS=y
174CONFIG_UFS_FS=m 157CONFIG_UFS_FS=m
175CONFIG_NFS_FS=m 158CONFIG_NFS_FS=m
176CONFIG_NFS_V3=y 159CONFIG_NFS_V4=m
177CONFIG_NFS_V4=y
178CONFIG_NFSD=m 160CONFIG_NFSD=m
179CONFIG_NFSD_V4=y 161CONFIG_NFSD_V4=y
180CONFIG_RPCSEC_GSS_SPKM3=m
181CONFIG_SMB_FS=m
182CONFIG_SMB_NLS_DEFAULT=y
183CONFIG_CIFS=m 162CONFIG_CIFS=m
184CONFIG_NLS_CODEPAGE_437=m 163CONFIG_NLS_CODEPAGE_437=m
185CONFIG_NLS_CODEPAGE_850=m 164CONFIG_NLS_CODEPAGE_850=m
@@ -187,17 +166,12 @@ CONFIG_NLS_ASCII=m
187CONFIG_NLS_ISO8859_1=m 166CONFIG_NLS_ISO8859_1=m
188CONFIG_NLS_ISO8859_15=m 167CONFIG_NLS_ISO8859_15=m
189CONFIG_NLS_UTF8=m 168CONFIG_NLS_UTF8=m
190CONFIG_MAGIC_SYSRQ=y
191CONFIG_DEBUG_FS=y 169CONFIG_DEBUG_FS=y
192CONFIG_HEADERS_CHECK=y 170CONFIG_HEADERS_CHECK=y
193CONFIG_DEBUG_KERNEL=y 171CONFIG_MAGIC_SYSRQ=y
194# CONFIG_DEBUG_BUGVERBOSE is not set 172# CONFIG_DEBUG_BUGVERBOSE is not set
195# CONFIG_RCU_CPU_STALL_DETECTOR is not set
196CONFIG_CRYPTO_NULL=m
197CONFIG_CRYPTO_TEST=m 173CONFIG_CRYPTO_TEST=m
198CONFIG_CRYPTO_HMAC=y 174CONFIG_CRYPTO_HMAC=y
199CONFIG_CRYPTO_MD5=y 175CONFIG_CRYPTO_MD5=y
200CONFIG_CRYPTO_BLOWFISH=m 176CONFIG_CRYPTO_BLOWFISH=m
201# CONFIG_CRYPTO_ANSI_CPRNG is not set
202# CONFIG_CRYPTO_HW is not set 177# CONFIG_CRYPTO_HW is not set
203CONFIG_LIBCRC32C=m
diff --git a/arch/parisc/configs/b180_defconfig b/arch/parisc/configs/b180_defconfig
index f1a0c25bef8d..83ffd161aec5 100644
--- a/arch/parisc/configs/b180_defconfig
+++ b/arch/parisc/configs/b180_defconfig
@@ -3,7 +3,6 @@ CONFIG_SYSVIPC=y
3CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
6CONFIG_SYSFS_DEPRECATED_V2=y
7CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
8CONFIG_SLAB=y 7CONFIG_SLAB=y
9CONFIG_MODULES=y 8CONFIG_MODULES=y
@@ -25,8 +24,6 @@ CONFIG_INET=y
25CONFIG_IP_MULTICAST=y 24CONFIG_IP_MULTICAST=y
26CONFIG_IP_PNP=y 25CONFIG_IP_PNP=y
27CONFIG_IP_PNP_BOOTP=y 26CONFIG_IP_PNP_BOOTP=y
28# CONFIG_INET_LRO is not set
29CONFIG_IPV6=y
30CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 27CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
31CONFIG_DEVTMPFS=y 28CONFIG_DEVTMPFS=y
32CONFIG_DEVTMPFS_MOUNT=y 29CONFIG_DEVTMPFS_MOUNT=y
@@ -53,10 +50,9 @@ CONFIG_MD_LINEAR=y
53CONFIG_MD_RAID0=y 50CONFIG_MD_RAID0=y
54CONFIG_MD_RAID1=y 51CONFIG_MD_RAID1=y
55CONFIG_NETDEVICES=y 52CONFIG_NETDEVICES=y
56CONFIG_NET_ETHERNET=y
57CONFIG_LASI_82596=y
58CONFIG_NET_TULIP=y 53CONFIG_NET_TULIP=y
59CONFIG_TULIP=y 54CONFIG_TULIP=y
55CONFIG_LASI_82596=y
60CONFIG_PPP=y 56CONFIG_PPP=y
61CONFIG_INPUT_EVDEV=y 57CONFIG_INPUT_EVDEV=y
62# CONFIG_KEYBOARD_HIL_OLD is not set 58# CONFIG_KEYBOARD_HIL_OLD is not set
@@ -71,40 +67,31 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
71CONFIG_PRINTER=y 67CONFIG_PRINTER=y
72# CONFIG_HW_RANDOM is not set 68# CONFIG_HW_RANDOM is not set
73# CONFIG_HWMON is not set 69# CONFIG_HWMON is not set
74CONFIG_VIDEO_OUTPUT_CONTROL=m
75CONFIG_FB=y 70CONFIG_FB=y
76CONFIG_FRAMEBUFFER_CONSOLE=y 71CONFIG_FRAMEBUFFER_CONSOLE=y
77CONFIG_LOGO=y 72CONFIG_LOGO=y
78CONFIG_SOUND=y 73CONFIG_SOUND=y
79CONFIG_SND=y 74CONFIG_SND=y
80CONFIG_SND_SEQUENCER=y 75CONFIG_SND_SEQUENCER=y
81CONFIG_SND_MIXER_OSS=y
82CONFIG_SND_PCM_OSS=y
83CONFIG_SND_SEQUENCER_OSS=y
84CONFIG_SND_HARMONY=y 76CONFIG_SND_HARMONY=y
85CONFIG_EXT2_FS=y 77CONFIG_EXT2_FS=y
86CONFIG_EXT3_FS=y 78CONFIG_EXT3_FS=y
87# CONFIG_EXT3_FS_XATTR is not set
88CONFIG_AUTOFS4_FS=y 79CONFIG_AUTOFS4_FS=y
89CONFIG_ISO9660_FS=y 80CONFIG_ISO9660_FS=y
90CONFIG_JOLIET=y 81CONFIG_JOLIET=y
91CONFIG_PROC_KCORE=y 82CONFIG_PROC_KCORE=y
92CONFIG_TMPFS=y 83CONFIG_TMPFS=y
93CONFIG_NFS_FS=y 84CONFIG_NFS_FS=y
94CONFIG_NFS_V3=y
95CONFIG_ROOT_NFS=y 85CONFIG_ROOT_NFS=y
96CONFIG_NFSD=y 86CONFIG_NFSD=y
97CONFIG_NFSD_V3=y 87CONFIG_NFSD_V3=y
98CONFIG_SMB_FS=y
99CONFIG_NLS_CODEPAGE_437=m 88CONFIG_NLS_CODEPAGE_437=m
100CONFIG_NLS_CODEPAGE_850=m 89CONFIG_NLS_CODEPAGE_850=m
101CONFIG_NLS_ASCII=m 90CONFIG_NLS_ASCII=m
102CONFIG_NLS_ISO8859_1=m 91CONFIG_NLS_ISO8859_1=m
103CONFIG_NLS_ISO8859_15=m 92CONFIG_NLS_ISO8859_15=m
104CONFIG_NLS_UTF8=m 93CONFIG_NLS_UTF8=m
105CONFIG_MAGIC_SYSRQ=y
106CONFIG_HEADERS_CHECK=y 94CONFIG_HEADERS_CHECK=y
95CONFIG_MAGIC_SYSRQ=y
107CONFIG_DEBUG_KERNEL=y 96CONFIG_DEBUG_KERNEL=y
108# CONFIG_RCU_CPU_STALL_DETECTOR is not set
109CONFIG_SECURITY=y 97CONFIG_SECURITY=y
110# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index 8e8f0e34f817..0764d3971cf6 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -1,12 +1,9 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_IKCONFIG=y 3CONFIG_IKCONFIG=y
5CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
6CONFIG_LOG_BUF_SHIFT=16 5CONFIG_LOG_BUF_SHIFT=16
7CONFIG_SYSFS_DEPRECATED_V2=y
8CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EXPERT=y 7CONFIG_EXPERT=y
11CONFIG_KALLSYMS_ALL=y 8CONFIG_KALLSYMS_ALL=y
12CONFIG_SLAB=y 9CONFIG_SLAB=y
@@ -15,7 +12,6 @@ CONFIG_OPROFILE=m
15CONFIG_MODULES=y 12CONFIG_MODULES=y
16CONFIG_MODULE_UNLOAD=y 13CONFIG_MODULE_UNLOAD=y
17CONFIG_MODULE_FORCE_UNLOAD=y 14CONFIG_MODULE_FORCE_UNLOAD=y
18# CONFIG_BLK_DEV_BSG is not set
19CONFIG_PA8X00=y 15CONFIG_PA8X00=y
20CONFIG_PREEMPT_VOLUNTARY=y 16CONFIG_PREEMPT_VOLUNTARY=y
21# CONFIG_GSC is not set 17# CONFIG_GSC is not set
@@ -31,13 +27,11 @@ CONFIG_INET=y
31CONFIG_IP_MULTICAST=y 27CONFIG_IP_MULTICAST=y
32CONFIG_IP_PNP=y 28CONFIG_IP_PNP=y
33CONFIG_IP_PNP_BOOTP=y 29CONFIG_IP_PNP_BOOTP=y
34# CONFIG_INET_LRO is not set
35# CONFIG_INET_DIAG is not set 30# CONFIG_INET_DIAG is not set
36CONFIG_INET6_IPCOMP=m 31CONFIG_INET6_IPCOMP=m
37CONFIG_IPV6_TUNNEL=m 32CONFIG_IPV6_TUNNEL=m
38CONFIG_NETFILTER=y 33CONFIG_NETFILTER=y
39CONFIG_NETFILTER_DEBUG=y 34CONFIG_NETFILTER_DEBUG=y
40CONFIG_IP_NF_QUEUE=m
41CONFIG_NET_PKTGEN=m 35CONFIG_NET_PKTGEN=m
42CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 36CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
43CONFIG_DEVTMPFS=y 37CONFIG_DEVTMPFS=y
@@ -50,13 +44,11 @@ CONFIG_BLK_DEV_CRYPTOLOOP=m
50CONFIG_IDE=y 44CONFIG_IDE=y
51CONFIG_BLK_DEV_IDECD=y 45CONFIG_BLK_DEV_IDECD=y
52CONFIG_BLK_DEV_NS87415=y 46CONFIG_BLK_DEV_NS87415=y
53CONFIG_PATA_SIL680=m
54CONFIG_SCSI=y 47CONFIG_SCSI=y
55CONFIG_BLK_DEV_SD=y 48CONFIG_BLK_DEV_SD=y
56CONFIG_CHR_DEV_ST=y 49CONFIG_CHR_DEV_ST=y
57CONFIG_BLK_DEV_SR=y 50CONFIG_BLK_DEV_SR=y
58CONFIG_CHR_DEV_SG=y 51CONFIG_CHR_DEV_SG=y
59CONFIG_SCSI_MULTI_LUN=y
60CONFIG_SCSI_ISCSI_ATTRS=m 52CONFIG_SCSI_ISCSI_ATTRS=m
61CONFIG_SCSI_SYM53C8XX_2=y 53CONFIG_SCSI_SYM53C8XX_2=y
62CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 54CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
@@ -76,28 +68,23 @@ CONFIG_FUSION=y
76CONFIG_FUSION_SPI=m 68CONFIG_FUSION_SPI=m
77CONFIG_FUSION_CTL=m 69CONFIG_FUSION_CTL=m
78CONFIG_NETDEVICES=y 70CONFIG_NETDEVICES=y
79CONFIG_DUMMY=m
80CONFIG_BONDING=m 71CONFIG_BONDING=m
72CONFIG_DUMMY=m
81CONFIG_TUN=m 73CONFIG_TUN=m
82CONFIG_NET_ETHERNET=y 74CONFIG_ACENIC=m
75CONFIG_TIGON3=m
83CONFIG_NET_TULIP=y 76CONFIG_NET_TULIP=y
84CONFIG_DE2104X=m 77CONFIG_DE2104X=m
85CONFIG_TULIP=y 78CONFIG_TULIP=y
86CONFIG_TULIP_MMIO=y 79CONFIG_TULIP_MMIO=y
87CONFIG_NET_PCI=y
88CONFIG_E100=m 80CONFIG_E100=m
89CONFIG_ACENIC=m
90CONFIG_E1000=m 81CONFIG_E1000=m
91CONFIG_TIGON3=m
92CONFIG_PPP=m 82CONFIG_PPP=m
93CONFIG_PPP_ASYNC=m
94CONFIG_PPP_SYNC_TTY=m
95CONFIG_PPP_DEFLATE=m
96CONFIG_PPP_BSDCOMP=m 83CONFIG_PPP_BSDCOMP=m
84CONFIG_PPP_DEFLATE=m
97CONFIG_PPPOE=m 85CONFIG_PPPOE=m
98# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 86CONFIG_PPP_ASYNC=m
99CONFIG_INPUT_MOUSEDEV_SCREEN_X=1600 87CONFIG_PPP_SYNC_TTY=m
100CONFIG_INPUT_MOUSEDEV_SCREEN_Y=1200
101# CONFIG_KEYBOARD_ATKBD is not set 88# CONFIG_KEYBOARD_ATKBD is not set
102# CONFIG_MOUSE_PS2 is not set 89# CONFIG_MOUSE_PS2 is not set
103CONFIG_SERIO=m 90CONFIG_SERIO=m
@@ -111,7 +98,6 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
111# CONFIG_HW_RANDOM is not set 98# CONFIG_HW_RANDOM is not set
112CONFIG_RAW_DRIVER=y 99CONFIG_RAW_DRIVER=y
113# CONFIG_HWMON is not set 100# CONFIG_HWMON is not set
114CONFIG_VIDEO_OUTPUT_CONTROL=m
115CONFIG_FB=y 101CONFIG_FB=y
116CONFIG_FRAMEBUFFER_CONSOLE=y 102CONFIG_FRAMEBUFFER_CONSOLE=y
117CONFIG_LOGO=y 103CONFIG_LOGO=y
@@ -121,9 +107,6 @@ CONFIG_LOGO=y
121CONFIG_SOUND=y 107CONFIG_SOUND=y
122CONFIG_SND=y 108CONFIG_SND=y
123CONFIG_SND_SEQUENCER=y 109CONFIG_SND_SEQUENCER=y
124CONFIG_SND_MIXER_OSS=y
125CONFIG_SND_PCM_OSS=y
126CONFIG_SND_SEQUENCER_OSS=y
127CONFIG_SND_AD1889=y 110CONFIG_SND_AD1889=y
128CONFIG_USB_HIDDEV=y 111CONFIG_USB_HIDDEV=y
129CONFIG_USB=y 112CONFIG_USB=y
@@ -139,7 +122,6 @@ CONFIG_USB_MICROTEK=m
139CONFIG_USB_LEGOTOWER=m 122CONFIG_USB_LEGOTOWER=m
140CONFIG_EXT2_FS=y 123CONFIG_EXT2_FS=y
141CONFIG_EXT3_FS=y 124CONFIG_EXT3_FS=y
142# CONFIG_EXT3_FS_XATTR is not set
143CONFIG_XFS_FS=m 125CONFIG_XFS_FS=m
144CONFIG_AUTOFS4_FS=y 126CONFIG_AUTOFS4_FS=y
145CONFIG_ISO9660_FS=y 127CONFIG_ISO9660_FS=y
@@ -149,7 +131,6 @@ CONFIG_VFAT_FS=m
149CONFIG_PROC_KCORE=y 131CONFIG_PROC_KCORE=y
150CONFIG_TMPFS=y 132CONFIG_TMPFS=y
151CONFIG_NFS_FS=y 133CONFIG_NFS_FS=y
152CONFIG_NFS_V3=y
153CONFIG_ROOT_NFS=y 134CONFIG_ROOT_NFS=y
154CONFIG_NFSD=y 135CONFIG_NFSD=y
155CONFIG_NFSD_V3=y 136CONFIG_NFSD_V3=y
@@ -159,18 +140,13 @@ CONFIG_NLS_ASCII=m
159CONFIG_NLS_ISO8859_1=m 140CONFIG_NLS_ISO8859_1=m
160CONFIG_NLS_ISO8859_15=m 141CONFIG_NLS_ISO8859_15=m
161CONFIG_NLS_UTF8=m 142CONFIG_NLS_UTF8=m
162CONFIG_MAGIC_SYSRQ=y
163CONFIG_DEBUG_FS=y 143CONFIG_DEBUG_FS=y
164CONFIG_HEADERS_CHECK=y 144CONFIG_HEADERS_CHECK=y
165CONFIG_DEBUG_KERNEL=y 145CONFIG_MAGIC_SYSRQ=y
166CONFIG_DEBUG_MUTEXES=y 146CONFIG_DEBUG_MUTEXES=y
167# CONFIG_DEBUG_BUGVERBOSE is not set 147# CONFIG_DEBUG_BUGVERBOSE is not set
168# CONFIG_RCU_CPU_STALL_DETECTOR is not set
169CONFIG_CRYPTO_NULL=m
170CONFIG_CRYPTO_TEST=m 148CONFIG_CRYPTO_TEST=m
171CONFIG_CRYPTO_MD5=m 149CONFIG_CRYPTO_MD5=m
172CONFIG_CRYPTO_BLOWFISH=m 150CONFIG_CRYPTO_BLOWFISH=m
173CONFIG_CRYPTO_DES=m 151CONFIG_CRYPTO_DES=m
174# CONFIG_CRYPTO_ANSI_CPRNG is not set
175# CONFIG_CRYPTO_HW is not set 152# CONFIG_CRYPTO_HW is not set
176CONFIG_LIBCRC32C=m
diff --git a/arch/parisc/configs/c8000_defconfig b/arch/parisc/configs/c8000_defconfig
index f6a4c016304b..088ab948a5ca 100644
--- a/arch/parisc/configs/c8000_defconfig
+++ b/arch/parisc/configs/c8000_defconfig
@@ -1,16 +1,13 @@
1# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y 4# CONFIG_CROSS_MEMORY_ATTACH is not set
5CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
6CONFIG_BSD_PROCESS_ACCT_V3=y 6CONFIG_BSD_PROCESS_ACCT_V3=y
7CONFIG_IKCONFIG=y 7CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y 8CONFIG_IKCONFIG_PROC=y
9CONFIG_RELAY=y 9CONFIG_RELAY=y
10CONFIG_BLK_DEV_INITRD=y 10CONFIG_BLK_DEV_INITRD=y
11CONFIG_RD_BZIP2=y
12CONFIG_RD_LZMA=y
13CONFIG_RD_LZO=y
14CONFIG_EXPERT=y 11CONFIG_EXPERT=y
15CONFIG_SYSCTL_SYSCALL=y 12CONFIG_SYSCTL_SYSCALL=y
16CONFIG_SLAB=y 13CONFIG_SLAB=y
@@ -23,7 +20,6 @@ CONFIG_PA8X00=y
23CONFIG_64BIT=y 20CONFIG_64BIT=y
24CONFIG_SMP=y 21CONFIG_SMP=y
25CONFIG_PREEMPT=y 22CONFIG_PREEMPT=y
26# CONFIG_CROSS_MEMORY_ATTACH is not set
27CONFIG_IOMMU_CCIO=y 23CONFIG_IOMMU_CCIO=y
28CONFIG_PCI=y 24CONFIG_PCI=y
29CONFIG_PCI_LBA=y 25CONFIG_PCI_LBA=y
@@ -146,7 +142,6 @@ CONFIG_FB_FOREIGN_ENDIAN=y
146CONFIG_FB_MODE_HELPERS=y 142CONFIG_FB_MODE_HELPERS=y
147CONFIG_FB_TILEBLITTING=y 143CONFIG_FB_TILEBLITTING=y
148# CONFIG_FB_STI is not set 144# CONFIG_FB_STI is not set
149CONFIG_BACKLIGHT_LCD_SUPPORT=y
150# CONFIG_LCD_CLASS_DEVICE is not set 145# CONFIG_LCD_CLASS_DEVICE is not set
151# CONFIG_BACKLIGHT_GENERIC is not set 146# CONFIG_BACKLIGHT_GENERIC is not set
152CONFIG_FRAMEBUFFER_CONSOLE=y 147CONFIG_FRAMEBUFFER_CONSOLE=y
@@ -157,12 +152,9 @@ CONFIG_LOGO=y
157# CONFIG_LOGO_LINUX_CLUT224 is not set 152# CONFIG_LOGO_LINUX_CLUT224 is not set
158CONFIG_SOUND=m 153CONFIG_SOUND=m
159CONFIG_SND=m 154CONFIG_SND=m
155CONFIG_SND_VERBOSE_PRINTK=y
160CONFIG_SND_SEQUENCER=m 156CONFIG_SND_SEQUENCER=m
161CONFIG_SND_SEQ_DUMMY=m 157CONFIG_SND_SEQ_DUMMY=m
162CONFIG_SND_MIXER_OSS=m
163CONFIG_SND_PCM_OSS=m
164CONFIG_SND_SEQUENCER_OSS=y
165CONFIG_SND_VERBOSE_PRINTK=y
166CONFIG_SND_AD1889=m 158CONFIG_SND_AD1889=m
167# CONFIG_SND_USB is not set 159# CONFIG_SND_USB is not set
168# CONFIG_SND_GSC is not set 160# CONFIG_SND_GSC is not set
@@ -174,8 +166,6 @@ CONFIG_EXT2_FS_XATTR=y
174CONFIG_EXT2_FS_POSIX_ACL=y 166CONFIG_EXT2_FS_POSIX_ACL=y
175CONFIG_EXT2_FS_SECURITY=y 167CONFIG_EXT2_FS_SECURITY=y
176CONFIG_EXT3_FS=y 168CONFIG_EXT3_FS=y
177# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
178CONFIG_EXT4_FS=m
179CONFIG_REISERFS_FS=m 169CONFIG_REISERFS_FS=m
180CONFIG_REISERFS_PROC_INFO=y 170CONFIG_REISERFS_PROC_INFO=y
181CONFIG_XFS_FS=m 171CONFIG_XFS_FS=m
@@ -238,11 +228,8 @@ CONFIG_DEBUG_SLAB=y
238CONFIG_DEBUG_SLAB_LEAK=y 228CONFIG_DEBUG_SLAB_LEAK=y
239CONFIG_DEBUG_MEMORY_INIT=y 229CONFIG_DEBUG_MEMORY_INIT=y
240CONFIG_DEBUG_STACKOVERFLOW=y 230CONFIG_DEBUG_STACKOVERFLOW=y
241CONFIG_LOCKUP_DETECTOR=y
242CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
243CONFIG_PANIC_ON_OOPS=y 231CONFIG_PANIC_ON_OOPS=y
244CONFIG_DEBUG_RT_MUTEXES=y 232CONFIG_DEBUG_RT_MUTEXES=y
245CONFIG_PROVE_RCU_DELAY=y
246CONFIG_DEBUG_BLOCK_EXT_DEVT=y 233CONFIG_DEBUG_BLOCK_EXT_DEVT=y
247CONFIG_LATENCYTOP=y 234CONFIG_LATENCYTOP=y
248CONFIG_KEYS=y 235CONFIG_KEYS=y
diff --git a/arch/parisc/configs/default_defconfig b/arch/parisc/configs/default_defconfig
index 310b6657e4ac..52c9050a7c5c 100644
--- a/arch/parisc/configs/default_defconfig
+++ b/arch/parisc/configs/default_defconfig
@@ -1,11 +1,9 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
5CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
6CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
7CONFIG_LOG_BUF_SHIFT=16 6CONFIG_LOG_BUF_SHIFT=16
8CONFIG_SYSFS_DEPRECATED_V2=y
9CONFIG_BLK_DEV_INITRD=y 7CONFIG_BLK_DEV_INITRD=y
10CONFIG_KALLSYMS_ALL=y 8CONFIG_KALLSYMS_ALL=y
11CONFIG_SLAB=y 9CONFIG_SLAB=y
@@ -41,9 +39,7 @@ CONFIG_IP_PNP_DHCP=y
41CONFIG_IP_PNP_BOOTP=y 39CONFIG_IP_PNP_BOOTP=y
42CONFIG_INET_AH=m 40CONFIG_INET_AH=m
43CONFIG_INET_ESP=m 41CONFIG_INET_ESP=m
44# CONFIG_INET_LRO is not set
45CONFIG_INET_DIAG=m 42CONFIG_INET_DIAG=m
46CONFIG_IPV6=y
47CONFIG_INET6_AH=y 43CONFIG_INET6_AH=y
48CONFIG_INET6_ESP=y 44CONFIG_INET6_ESP=y
49CONFIG_INET6_IPCOMP=y 45CONFIG_INET6_IPCOMP=y
@@ -82,26 +78,23 @@ CONFIG_MD_RAID1=y
82CONFIG_MD_RAID10=y 78CONFIG_MD_RAID10=y
83CONFIG_BLK_DEV_DM=y 79CONFIG_BLK_DEV_DM=y
84CONFIG_NETDEVICES=y 80CONFIG_NETDEVICES=y
85CONFIG_DUMMY=m
86CONFIG_BONDING=m 81CONFIG_BONDING=m
82CONFIG_DUMMY=m
87CONFIG_TUN=m 83CONFIG_TUN=m
88CONFIG_NET_ETHERNET=y
89CONFIG_MII=m
90CONFIG_LASI_82596=y
91CONFIG_NET_TULIP=y
92CONFIG_TULIP=y
93CONFIG_NET_PCI=y
94CONFIG_ACENIC=y 84CONFIG_ACENIC=y
95CONFIG_TIGON3=y 85CONFIG_TIGON3=y
96CONFIG_NET_PCMCIA=y 86CONFIG_NET_TULIP=y
87CONFIG_TULIP=y
88CONFIG_LASI_82596=y
97CONFIG_PPP=m 89CONFIG_PPP=m
98CONFIG_PPP_ASYNC=m
99CONFIG_PPP_SYNC_TTY=m
100CONFIG_PPP_DEFLATE=m
101CONFIG_PPP_BSDCOMP=m 90CONFIG_PPP_BSDCOMP=m
91CONFIG_PPP_DEFLATE=m
102CONFIG_PPPOE=m 92CONFIG_PPPOE=m
93CONFIG_PPP_ASYNC=m
94CONFIG_PPP_SYNC_TTY=m
103# CONFIG_KEYBOARD_HIL_OLD is not set 95# CONFIG_KEYBOARD_HIL_OLD is not set
104CONFIG_MOUSE_SERIAL=y 96CONFIG_MOUSE_SERIAL=y
97CONFIG_LEGACY_PTY_COUNT=64
105CONFIG_SERIAL_8250=y 98CONFIG_SERIAL_8250=y
106CONFIG_SERIAL_8250_CONSOLE=y 99CONFIG_SERIAL_8250_CONSOLE=y
107CONFIG_SERIAL_8250_CS=y 100CONFIG_SERIAL_8250_CS=y
@@ -109,31 +102,24 @@ CONFIG_SERIAL_8250_NR_UARTS=17
109CONFIG_SERIAL_8250_EXTENDED=y 102CONFIG_SERIAL_8250_EXTENDED=y
110CONFIG_SERIAL_8250_MANY_PORTS=y 103CONFIG_SERIAL_8250_MANY_PORTS=y
111CONFIG_SERIAL_8250_SHARE_IRQ=y 104CONFIG_SERIAL_8250_SHARE_IRQ=y
112CONFIG_LEGACY_PTY_COUNT=64
113CONFIG_PRINTER=m 105CONFIG_PRINTER=m
114CONFIG_PPDEV=m 106CONFIG_PPDEV=m
115# CONFIG_HW_RANDOM is not set 107# CONFIG_HW_RANDOM is not set
116# CONFIG_HWMON is not set 108# CONFIG_HWMON is not set
117CONFIG_VIDEO_OUTPUT_CONTROL=m
118CONFIG_FB=y 109CONFIG_FB=y
119CONFIG_FB_MODE_HELPERS=y 110CONFIG_FB_MODE_HELPERS=y
120CONFIG_FB_TILEBLITTING=y 111CONFIG_FB_TILEBLITTING=y
121CONFIG_DUMMY_CONSOLE_COLUMNS=128 112CONFIG_DUMMY_CONSOLE_COLUMNS=128
122CONFIG_DUMMY_CONSOLE_ROWS=48 113CONFIG_DUMMY_CONSOLE_ROWS=48
123CONFIG_FRAMEBUFFER_CONSOLE=y 114CONFIG_FRAMEBUFFER_CONSOLE=y
124CONFIG_FONTS=y
125CONFIG_FONT_8x16=y
126CONFIG_LOGO=y 115CONFIG_LOGO=y
127# CONFIG_LOGO_LINUX_MONO is not set 116# CONFIG_LOGO_LINUX_MONO is not set
128# CONFIG_LOGO_LINUX_VGA16 is not set 117# CONFIG_LOGO_LINUX_VGA16 is not set
129# CONFIG_LOGO_LINUX_CLUT224 is not set 118# CONFIG_LOGO_LINUX_CLUT224 is not set
130CONFIG_SOUND=y 119CONFIG_SOUND=y
131CONFIG_SND=y 120CONFIG_SND=y
132CONFIG_SND_SEQUENCER=y
133CONFIG_SND_MIXER_OSS=y
134CONFIG_SND_PCM_OSS=y
135CONFIG_SND_SEQUENCER_OSS=y
136CONFIG_SND_DYNAMIC_MINORS=y 121CONFIG_SND_DYNAMIC_MINORS=y
122CONFIG_SND_SEQUENCER=y
137CONFIG_SND_AD1889=y 123CONFIG_SND_AD1889=y
138CONFIG_SND_HARMONY=y 124CONFIG_SND_HARMONY=y
139CONFIG_HID_GYRATION=y 125CONFIG_HID_GYRATION=y
@@ -141,7 +127,6 @@ CONFIG_HID_NTRIG=y
141CONFIG_HID_PANTHERLORD=y 127CONFIG_HID_PANTHERLORD=y
142CONFIG_HID_PETALYNX=y 128CONFIG_HID_PETALYNX=y
143CONFIG_HID_SAMSUNG=y 129CONFIG_HID_SAMSUNG=y
144CONFIG_HID_SONY=y
145CONFIG_HID_SUNPLUS=y 130CONFIG_HID_SUNPLUS=y
146CONFIG_HID_TOPSEED=y 131CONFIG_HID_TOPSEED=y
147CONFIG_USB=y 132CONFIG_USB=y
@@ -150,21 +135,15 @@ CONFIG_USB_OHCI_HCD=y
150CONFIG_USB_UHCI_HCD=y 135CONFIG_USB_UHCI_HCD=y
151CONFIG_EXT2_FS=y 136CONFIG_EXT2_FS=y
152CONFIG_EXT3_FS=y 137CONFIG_EXT3_FS=y
153# CONFIG_EXT3_FS_XATTR is not set
154CONFIG_AUTOFS_FS=y
155CONFIG_ISO9660_FS=y 138CONFIG_ISO9660_FS=y
156CONFIG_JOLIET=y 139CONFIG_JOLIET=y
157CONFIG_VFAT_FS=y 140CONFIG_VFAT_FS=y
158CONFIG_PROC_KCORE=y 141CONFIG_PROC_KCORE=y
159CONFIG_TMPFS=y 142CONFIG_TMPFS=y
160CONFIG_NFS_FS=y 143CONFIG_NFS_FS=y
161CONFIG_NFS_V3=y
162CONFIG_ROOT_NFS=y 144CONFIG_ROOT_NFS=y
163CONFIG_NFSD=y 145CONFIG_NFSD=y
164CONFIG_NFSD_V4=y 146CONFIG_NFSD_V4=y
165CONFIG_RPCSEC_GSS_SPKM3=m
166CONFIG_SMB_FS=m
167CONFIG_SMB_NLS_DEFAULT=y
168CONFIG_CIFS=m 147CONFIG_CIFS=m
169CONFIG_NLS_CODEPAGE_437=y 148CONFIG_NLS_CODEPAGE_437=y
170CONFIG_NLS_CODEPAGE_737=m 149CONFIG_NLS_CODEPAGE_737=m
@@ -204,30 +183,24 @@ CONFIG_NLS_ISO8859_15=m
204CONFIG_NLS_KOI8_R=m 183CONFIG_NLS_KOI8_R=m
205CONFIG_NLS_KOI8_U=m 184CONFIG_NLS_KOI8_U=m
206CONFIG_NLS_UTF8=y 185CONFIG_NLS_UTF8=y
207CONFIG_MAGIC_SYSRQ=y
208CONFIG_DEBUG_FS=y 186CONFIG_DEBUG_FS=y
209CONFIG_HEADERS_CHECK=y 187CONFIG_HEADERS_CHECK=y
188CONFIG_MAGIC_SYSRQ=y
210CONFIG_DEBUG_KERNEL=y 189CONFIG_DEBUG_KERNEL=y
211CONFIG_DEBUG_MUTEXES=y 190CONFIG_DEBUG_MUTEXES=y
212# CONFIG_RCU_CPU_STALL_DETECTOR is not set
213CONFIG_KEYS=y 191CONFIG_KEYS=y
214CONFIG_CRYPTO_NULL=m
215CONFIG_CRYPTO_TEST=m 192CONFIG_CRYPTO_TEST=m
216CONFIG_CRYPTO_MD4=m
217CONFIG_CRYPTO_MICHAEL_MIC=m 193CONFIG_CRYPTO_MICHAEL_MIC=m
218CONFIG_CRYPTO_SHA256=m
219CONFIG_CRYPTO_SHA512=m 194CONFIG_CRYPTO_SHA512=m
220CONFIG_CRYPTO_TGR192=m 195CONFIG_CRYPTO_TGR192=m
221CONFIG_CRYPTO_WP512=m 196CONFIG_CRYPTO_WP512=m
222CONFIG_CRYPTO_AES=m
223CONFIG_CRYPTO_ANUBIS=m 197CONFIG_CRYPTO_ANUBIS=m
224CONFIG_CRYPTO_ARC4=m
225CONFIG_CRYPTO_BLOWFISH=m 198CONFIG_CRYPTO_BLOWFISH=m
226CONFIG_CRYPTO_CAST6=m 199CONFIG_CRYPTO_CAST6=m
227CONFIG_CRYPTO_KHAZAD=m 200CONFIG_CRYPTO_KHAZAD=m
228CONFIG_CRYPTO_SERPENT=m 201CONFIG_CRYPTO_SERPENT=m
229CONFIG_CRYPTO_TEA=m 202CONFIG_CRYPTO_TEA=m
230CONFIG_CRYPTO_TWOFISH=m 203CONFIG_CRYPTO_TWOFISH=m
231# CONFIG_CRYPTO_ANSI_CPRNG is not set
232# CONFIG_CRYPTO_HW is not set 204# CONFIG_CRYPTO_HW is not set
233CONFIG_LIBCRC32C=m 205CONFIG_LIBCRC32C=m
206CONFIG_FONTS=y
diff --git a/arch/parisc/configs/generic-32bit_defconfig b/arch/parisc/configs/generic-32bit_defconfig
index 8688ba7f5966..37ae4b57c001 100644
--- a/arch/parisc/configs/generic-32bit_defconfig
+++ b/arch/parisc/configs/generic-32bit_defconfig
@@ -2,15 +2,11 @@ CONFIG_LOCALVERSION="-32bit"
2# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_FHANDLE=y
6CONFIG_BSD_PROCESS_ACCT=y 5CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_IKCONFIG=y 6CONFIG_IKCONFIG=y
8CONFIG_IKCONFIG_PROC=y 7CONFIG_IKCONFIG_PROC=y
9CONFIG_LOG_BUF_SHIFT=16 8CONFIG_LOG_BUF_SHIFT=16
10CONFIG_BLK_DEV_INITRD=y 9CONFIG_BLK_DEV_INITRD=y
11CONFIG_RD_BZIP2=y
12CONFIG_RD_LZMA=y
13CONFIG_RD_LZO=y
14CONFIG_EXPERT=y 10CONFIG_EXPERT=y
15CONFIG_SYSCTL_SYSCALL=y 11CONFIG_SYSCTL_SYSCALL=y
16CONFIG_PERF_EVENTS=y 12CONFIG_PERF_EVENTS=y
@@ -49,7 +45,6 @@ CONFIG_INET_ESP=m
49# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 45# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
50# CONFIG_INET_XFRM_MODE_TUNNEL is not set 46# CONFIG_INET_XFRM_MODE_TUNNEL is not set
51# CONFIG_INET_XFRM_MODE_BEET is not set 47# CONFIG_INET_XFRM_MODE_BEET is not set
52# CONFIG_INET_LRO is not set
53CONFIG_INET_DIAG=m 48CONFIG_INET_DIAG=m
54CONFIG_LLC2=m 49CONFIG_LLC2=m
55# CONFIG_WIRELESS is not set 50# CONFIG_WIRELESS is not set
@@ -149,10 +144,8 @@ CONFIG_PRINTER=m
149CONFIG_PPDEV=m 144CONFIG_PPDEV=m
150# CONFIG_HW_RANDOM is not set 145# CONFIG_HW_RANDOM is not set
151CONFIG_I2C=y 146CONFIG_I2C=y
152CONFIG_POWER_SUPPLY=y
153# CONFIG_HWMON is not set 147# CONFIG_HWMON is not set
154CONFIG_AGP=y 148CONFIG_AGP=y
155CONFIG_VIDEO_OUTPUT_CONTROL=y
156CONFIG_FB=y 149CONFIG_FB=y
157CONFIG_FB_FOREIGN_ENDIAN=y 150CONFIG_FB_FOREIGN_ENDIAN=y
158CONFIG_FB_MODE_HELPERS=y 151CONFIG_FB_MODE_HELPERS=y
@@ -169,11 +162,8 @@ CONFIG_LOGO=y
169# CONFIG_LOGO_LINUX_CLUT224 is not set 162# CONFIG_LOGO_LINUX_CLUT224 is not set
170CONFIG_SOUND=m 163CONFIG_SOUND=m
171CONFIG_SND=m 164CONFIG_SND=m
172CONFIG_SND_SEQUENCER=m
173CONFIG_SND_MIXER_OSS=m
174CONFIG_SND_PCM_OSS=m
175CONFIG_SND_SEQUENCER_OSS=y
176CONFIG_SND_DYNAMIC_MINORS=y 165CONFIG_SND_DYNAMIC_MINORS=y
166CONFIG_SND_SEQUENCER=m
177CONFIG_SND_AD1889=m 167CONFIG_SND_AD1889=m
178CONFIG_SND_HARMONY=m 168CONFIG_SND_HARMONY=m
179CONFIG_HIDRAW=y 169CONFIG_HIDRAW=y
@@ -223,12 +213,7 @@ CONFIG_EXT2_FS=y
223CONFIG_EXT2_FS_XATTR=y 213CONFIG_EXT2_FS_XATTR=y
224CONFIG_EXT2_FS_SECURITY=y 214CONFIG_EXT2_FS_SECURITY=y
225CONFIG_EXT3_FS=y 215CONFIG_EXT3_FS=y
226# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
227CONFIG_EXT3_FS_SECURITY=y 216CONFIG_EXT3_FS_SECURITY=y
228CONFIG_EXT4_FS=y
229CONFIG_XFS_FS=m
230CONFIG_XFS_QUOTA=y
231CONFIG_XFS_RT=y
232CONFIG_QUOTA=y 217CONFIG_QUOTA=y
233CONFIG_QUOTA_NETLINK_INTERFACE=y 218CONFIG_QUOTA_NETLINK_INTERFACE=y
234CONFIG_QFMT_V2=y 219CONFIG_QFMT_V2=y
@@ -293,15 +278,12 @@ CONFIG_DEBUG_MEMORY_INIT=y
293CONFIG_DEBUG_STACKOVERFLOW=y 278CONFIG_DEBUG_STACKOVERFLOW=y
294CONFIG_DEBUG_SHIRQ=y 279CONFIG_DEBUG_SHIRQ=y
295CONFIG_DETECT_HUNG_TASK=y 280CONFIG_DETECT_HUNG_TASK=y
296CONFIG_TIMER_STATS=y
297CONFIG_DEBUG_RT_MUTEXES=y 281CONFIG_DEBUG_RT_MUTEXES=y
298CONFIG_DEBUG_SPINLOCK=y 282CONFIG_DEBUG_SPINLOCK=y
299CONFIG_DEBUG_MUTEXES=y 283CONFIG_DEBUG_MUTEXES=y
300CONFIG_RCU_CPU_STALL_INFO=y
301CONFIG_LATENCYTOP=y 284CONFIG_LATENCYTOP=y
302CONFIG_LKDTM=m 285CONFIG_LKDTM=m
303CONFIG_KEYS=y 286CONFIG_KEYS=y
304CONFIG_CRYPTO_NULL=m
305CONFIG_CRYPTO_TEST=m 287CONFIG_CRYPTO_TEST=m
306CONFIG_CRYPTO_HMAC=y 288CONFIG_CRYPTO_HMAC=y
307CONFIG_CRYPTO_MD5=y 289CONFIG_CRYPTO_MD5=y
@@ -320,7 +302,6 @@ CONFIG_CRYPTO_SERPENT=m
320CONFIG_CRYPTO_TEA=m 302CONFIG_CRYPTO_TEA=m
321CONFIG_CRYPTO_TWOFISH=m 303CONFIG_CRYPTO_TWOFISH=m
322CONFIG_CRYPTO_DEFLATE=y 304CONFIG_CRYPTO_DEFLATE=y
323# CONFIG_CRYPTO_ANSI_CPRNG is not set
324CONFIG_CRC_CCITT=m 305CONFIG_CRC_CCITT=m
325CONFIG_CRC_T10DIF=y 306CONFIG_CRC_T10DIF=y
326CONFIG_FONTS=y 307CONFIG_FONTS=y
diff --git a/arch/parisc/configs/generic-64bit_defconfig b/arch/parisc/configs/generic-64bit_defconfig
index c564e6e1fa23..d39e7f821aba 100644
--- a/arch/parisc/configs/generic-64bit_defconfig
+++ b/arch/parisc/configs/generic-64bit_defconfig
@@ -8,10 +8,11 @@ CONFIG_TASKSTATS=y
8CONFIG_TASK_DELAY_ACCT=y 8CONFIG_TASK_DELAY_ACCT=y
9CONFIG_TASK_XACCT=y 9CONFIG_TASK_XACCT=y
10CONFIG_TASK_IO_ACCOUNTING=y 10CONFIG_TASK_IO_ACCOUNTING=y
11# CONFIG_UTS_NS is not set 11CONFIG_CGROUPS=y
12# CONFIG_IPC_NS is not set 12CONFIG_MEMCG=y
13# CONFIG_PID_NS is not set 13CONFIG_MEMCG_SWAP=y
14# CONFIG_NET_NS is not set 14CONFIG_CGROUP_PIDS=y
15CONFIG_CPUSETS=y
15CONFIG_RELAY=y 16CONFIG_RELAY=y
16CONFIG_BLK_DEV_INITRD=y 17CONFIG_BLK_DEV_INITRD=y
17CONFIG_CC_OPTIMIZE_FOR_SIZE=y 18CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -52,7 +53,6 @@ CONFIG_INET_ESP=m
52CONFIG_INET_XFRM_MODE_TRANSPORT=m 53CONFIG_INET_XFRM_MODE_TRANSPORT=m
53CONFIG_INET_XFRM_MODE_TUNNEL=m 54CONFIG_INET_XFRM_MODE_TUNNEL=m
54CONFIG_INET_XFRM_MODE_BEET=m 55CONFIG_INET_XFRM_MODE_BEET=m
55CONFIG_INET_LRO=m
56CONFIG_INET_DIAG=m 56CONFIG_INET_DIAG=m
57CONFIG_NETFILTER=y 57CONFIG_NETFILTER=y
58# CONFIG_NETFILTER_ADVANCED is not set 58# CONFIG_NETFILTER_ADVANCED is not set
@@ -84,7 +84,6 @@ CONFIG_PATA_SIL680=y
84CONFIG_ATA_GENERIC=y 84CONFIG_ATA_GENERIC=y
85CONFIG_MD=y 85CONFIG_MD=y
86CONFIG_MD_LINEAR=m 86CONFIG_MD_LINEAR=m
87CONFIG_MD_RAID0=m
88CONFIG_BLK_DEV_DM=m 87CONFIG_BLK_DEV_DM=m
89CONFIG_DM_RAID=m 88CONFIG_DM_RAID=m
90CONFIG_DM_UEVENT=y 89CONFIG_DM_UEVENT=y
@@ -138,21 +137,21 @@ CONFIG_QLGE=m
138# CONFIG_NET_VENDOR_TI is not set 137# CONFIG_NET_VENDOR_TI is not set
139# CONFIG_NET_VENDOR_VIA is not set 138# CONFIG_NET_VENDOR_VIA is not set
140# CONFIG_NET_VENDOR_WIZNET is not set 139# CONFIG_NET_VENDOR_WIZNET is not set
140CONFIG_MDIO_BITBANG=m
141CONFIG_PHYLIB=y 141CONFIG_PHYLIB=y
142CONFIG_MARVELL_PHY=m
143CONFIG_DAVICOM_PHY=m
144CONFIG_QSEMI_PHY=m
145CONFIG_LXT_PHY=m
146CONFIG_CICADA_PHY=m
147CONFIG_VITESSE_PHY=m
148CONFIG_SMSC_PHY=m
149CONFIG_BROADCOM_PHY=m 142CONFIG_BROADCOM_PHY=m
143CONFIG_CICADA_PHY=m
144CONFIG_DAVICOM_PHY=m
150CONFIG_ICPLUS_PHY=m 145CONFIG_ICPLUS_PHY=m
151CONFIG_REALTEK_PHY=m 146CONFIG_LSI_ET1011C_PHY=m
147CONFIG_LXT_PHY=m
148CONFIG_MARVELL_PHY=m
152CONFIG_NATIONAL_PHY=m 149CONFIG_NATIONAL_PHY=m
150CONFIG_QSEMI_PHY=m
151CONFIG_REALTEK_PHY=m
152CONFIG_SMSC_PHY=m
153CONFIG_STE10XP=m 153CONFIG_STE10XP=m
154CONFIG_LSI_ET1011C_PHY=m 154CONFIG_VITESSE_PHY=m
155CONFIG_MDIO_BITBANG=m
156CONFIG_SLIP=m 155CONFIG_SLIP=m
157CONFIG_SLIP_COMPRESSED=y 156CONFIG_SLIP_COMPRESSED=y
158CONFIG_SLIP_SMART=y 157CONFIG_SLIP_SMART=y
@@ -166,10 +165,8 @@ CONFIG_INPUT_MISC=y
166CONFIG_SERIO_SERPORT=m 165CONFIG_SERIO_SERPORT=m
167# CONFIG_HP_SDC is not set 166# CONFIG_HP_SDC is not set
168CONFIG_SERIO_RAW=m 167CONFIG_SERIO_RAW=m
169CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
170# CONFIG_LEGACY_PTYS is not set 168# CONFIG_LEGACY_PTYS is not set
171CONFIG_NOZOMI=m 169CONFIG_NOZOMI=m
172# CONFIG_DEVKMEM is not set
173CONFIG_SERIAL_8250=y 170CONFIG_SERIAL_8250=y
174# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set 171# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
175CONFIG_SERIAL_8250_CONSOLE=y 172CONFIG_SERIAL_8250_CONSOLE=y
@@ -207,10 +204,8 @@ CONFIG_AGP=y
207CONFIG_AGP_PARISC=y 204CONFIG_AGP_PARISC=y
208CONFIG_DRM=y 205CONFIG_DRM=y
209CONFIG_DRM_RADEON=y 206CONFIG_DRM_RADEON=y
210CONFIG_DRM_RADEON_UMS=y
211CONFIG_FIRMWARE_EDID=y 207CONFIG_FIRMWARE_EDID=y
212CONFIG_FB_MODE_HELPERS=y 208CONFIG_FB_MODE_HELPERS=y
213CONFIG_BACKLIGHT_LCD_SUPPORT=y
214# CONFIG_BACKLIGHT_GENERIC is not set 209# CONFIG_BACKLIGHT_GENERIC is not set
215CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 210CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
216CONFIG_LOGO=y 211CONFIG_LOGO=y
@@ -246,8 +241,6 @@ CONFIG_EXT2_FS_XATTR=y
246CONFIG_EXT2_FS_SECURITY=y 241CONFIG_EXT2_FS_SECURITY=y
247CONFIG_EXT3_FS=y 242CONFIG_EXT3_FS=y
248CONFIG_EXT3_FS_SECURITY=y 243CONFIG_EXT3_FS_SECURITY=y
249CONFIG_EXT4_FS=y
250CONFIG_EXT4_FS_SECURITY=y
251CONFIG_XFS_FS=m 244CONFIG_XFS_FS=m
252CONFIG_BTRFS_FS=m 245CONFIG_BTRFS_FS=m
253CONFIG_QUOTA=y 246CONFIG_QUOTA=y
@@ -286,27 +279,16 @@ CONFIG_DEBUG_FS=y
286CONFIG_MAGIC_SYSRQ=y 279CONFIG_MAGIC_SYSRQ=y
287CONFIG_DEBUG_KERNEL=y 280CONFIG_DEBUG_KERNEL=y
288CONFIG_DEBUG_STACKOVERFLOW=y 281CONFIG_DEBUG_STACKOVERFLOW=y
289CONFIG_LOCKUP_DETECTOR=y
290CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
291CONFIG_BOOTPARAM_HUNG_TASK_PANIC=y
292# CONFIG_SCHED_DEBUG is not set 282# CONFIG_SCHED_DEBUG is not set
293CONFIG_TIMER_STATS=y
294CONFIG_CRYPTO_MANAGER=y 283CONFIG_CRYPTO_MANAGER=y
295CONFIG_CRYPTO_ECB=m 284CONFIG_CRYPTO_ECB=m
296CONFIG_CRYPTO_PCBC=m 285CONFIG_CRYPTO_PCBC=m
297CONFIG_CRYPTO_MD4=m 286CONFIG_CRYPTO_MD4=m
298CONFIG_CRYPTO_MD5=y 287CONFIG_CRYPTO_MD5=y
299CONFIG_CRYPTO_MICHAEL_MIC=m 288CONFIG_CRYPTO_MICHAEL_MIC=m
300CONFIG_CRYPTO_SHA256=m
301CONFIG_CRYPTO_ARC4=m 289CONFIG_CRYPTO_ARC4=m
302CONFIG_CRYPTO_FCRYPT=m 290CONFIG_CRYPTO_FCRYPT=m
303CONFIG_CRYPTO_DEFLATE=m 291CONFIG_CRYPTO_DEFLATE=m
304# CONFIG_CRYPTO_HW is not set 292# CONFIG_CRYPTO_HW is not set
305CONFIG_CRC_CCITT=m 293CONFIG_CRC_CCITT=m
306CONFIG_LIBCRC32C=y 294CONFIG_LIBCRC32C=y
307CONFIG_XZ_DEC_X86=y
308CONFIG_XZ_DEC_POWERPC=y
309CONFIG_XZ_DEC_IA64=y
310CONFIG_XZ_DEC_ARM=y
311CONFIG_XZ_DEC_ARMTHUMB=y
312CONFIG_XZ_DEC_SPARC=y
diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h
index d2742273a685..07ea467f22fc 100644
--- a/arch/parisc/include/asm/bug.h
+++ b/arch/parisc/include/asm/bug.h
@@ -27,7 +27,7 @@
27 do { \ 27 do { \
28 asm volatile("\n" \ 28 asm volatile("\n" \
29 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 29 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
30 "\t.pushsection __bug_table,\"a\"\n" \ 30 "\t.pushsection __bug_table,\"aw\"\n" \
31 "2:\t" ASM_WORD_INSN "1b, %c0\n" \ 31 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
32 "\t.short %c1, %c2\n" \ 32 "\t.short %c1, %c2\n" \
33 "\t.org 2b+%c3\n" \ 33 "\t.org 2b+%c3\n" \
@@ -50,7 +50,7 @@
50 do { \ 50 do { \
51 asm volatile("\n" \ 51 asm volatile("\n" \
52 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 52 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
53 "\t.pushsection __bug_table,\"a\"\n" \ 53 "\t.pushsection __bug_table,\"aw\"\n" \
54 "2:\t" ASM_WORD_INSN "1b, %c0\n" \ 54 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
55 "\t.short %c1, %c2\n" \ 55 "\t.short %c1, %c2\n" \
56 "\t.org 2b+%c3\n" \ 56 "\t.org 2b+%c3\n" \
@@ -64,7 +64,7 @@
64 do { \ 64 do { \
65 asm volatile("\n" \ 65 asm volatile("\n" \
66 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 66 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
67 "\t.pushsection __bug_table,\"a\"\n" \ 67 "\t.pushsection __bug_table,\"aw\"\n" \
68 "2:\t" ASM_WORD_INSN "1b\n" \ 68 "2:\t" ASM_WORD_INSN "1b\n" \
69 "\t.short %c0\n" \ 69 "\t.short %c0\n" \
70 "\t.org 2b+%c1\n" \ 70 "\t.org 2b+%c1\n" \
diff --git a/arch/parisc/include/asm/pdcpat.h b/arch/parisc/include/asm/pdcpat.h
index 32e105fb8adb..e3c0586260d8 100644
--- a/arch/parisc/include/asm/pdcpat.h
+++ b/arch/parisc/include/asm/pdcpat.h
@@ -150,7 +150,7 @@
150#define PDC_PAT_MEM_SETGM 9L /* Set Good Memory value */ 150#define PDC_PAT_MEM_SETGM 9L /* Set Good Memory value */
151#define PDC_PAT_MEM_ADD_PAGE 10L /* ADDs a page to the cell */ 151#define PDC_PAT_MEM_ADD_PAGE 10L /* ADDs a page to the cell */
152#define PDC_PAT_MEM_ADDRESS 11L /* Get Physical Location From */ 152#define PDC_PAT_MEM_ADDRESS 11L /* Get Physical Location From */
153 /* Memory Address */ 153 /* Memory Address */
154#define PDC_PAT_MEM_GET_TXT_SIZE 12L /* Get Formatted Text Size */ 154#define PDC_PAT_MEM_GET_TXT_SIZE 12L /* Get Formatted Text Size */
155#define PDC_PAT_MEM_GET_PD_TXT 13L /* Get PD Formatted Text */ 155#define PDC_PAT_MEM_GET_PD_TXT 13L /* Get PD Formatted Text */
156#define PDC_PAT_MEM_GET_CELL_TXT 14L /* Get Cell Formatted Text */ 156#define PDC_PAT_MEM_GET_CELL_TXT 14L /* Get Cell Formatted Text */
@@ -228,6 +228,17 @@ struct pdc_pat_mem_read_pd_retinfo { /* PDC_PAT_MEM/PDC_PAT_MEM_PD_READ */
228 unsigned long pdt_entries; 228 unsigned long pdt_entries;
229}; 229};
230 230
231struct pdc_pat_mem_phys_mem_location { /* PDC_PAT_MEM/PDC_PAT_MEM_ADDRESS */
232 u64 cabinet:8;
233 u64 ign1:8;
234 u64 ign2:8;
235 u64 cell_slot:8;
236 u64 ign3:8;
237 u64 dimm_slot:8; /* DIMM slot, e.g. 0x1A, 0x2B, show user hex value! */
238 u64 ign4:8;
239 u64 source:4; /* for mem: always 0x07 */
240 u64 source_detail:4; /* for mem: always 0x04 (SIMM or DIMM) */
241};
231 242
232struct pdc_pat_pd_addr_map_entry { 243struct pdc_pat_pd_addr_map_entry {
233 unsigned char entry_type; /* 1 = Memory Descriptor Entry Type */ 244 unsigned char entry_type; /* 1 = Memory Descriptor Entry Type */
@@ -319,6 +330,9 @@ extern int pdc_pat_mem_read_cell_pdt(struct pdc_pat_mem_read_pd_retinfo *pret,
319extern int pdc_pat_mem_read_pd_pdt(struct pdc_pat_mem_read_pd_retinfo *pret, 330extern int pdc_pat_mem_read_pd_pdt(struct pdc_pat_mem_read_pd_retinfo *pret,
320 unsigned long *pdt_entries_ptr, unsigned long count, 331 unsigned long *pdt_entries_ptr, unsigned long count,
321 unsigned long offset); 332 unsigned long offset);
333extern int pdc_pat_mem_get_dimm_phys_location(
334 struct pdc_pat_mem_phys_mem_location *pret,
335 unsigned long phys_addr);
322 336
323#endif /* __ASSEMBLY__ */ 337#endif /* __ASSEMBLY__ */
324 338
diff --git a/arch/parisc/include/uapi/asm/ioctls.h b/arch/parisc/include/uapi/asm/ioctls.h
index 674c68a5bbd0..d0e3321403be 100644
--- a/arch/parisc/include/uapi/asm/ioctls.h
+++ b/arch/parisc/include/uapi/asm/ioctls.h
@@ -60,7 +60,7 @@
60#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 60#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
61#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 61#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
62#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 62#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
63#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 63#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
64 64
65#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ 65#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
66#define FIOCLEX 0x5451 66#define FIOCLEX 0x5451
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index c32a09095216..85a92db70afc 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -453,8 +453,8 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
453 before it can be accessed through the kernel mapping. */ 453 before it can be accessed through the kernel mapping. */
454 preempt_disable(); 454 preempt_disable();
455 flush_dcache_page_asm(__pa(vfrom), vaddr); 455 flush_dcache_page_asm(__pa(vfrom), vaddr);
456 preempt_enable();
457 copy_page_asm(vto, vfrom); 456 copy_page_asm(vto, vfrom);
457 preempt_enable();
458} 458}
459EXPORT_SYMBOL(copy_user_page); 459EXPORT_SYMBOL(copy_user_page);
460 460
@@ -539,6 +539,10 @@ void flush_cache_mm(struct mm_struct *mm)
539 struct vm_area_struct *vma; 539 struct vm_area_struct *vma;
540 pgd_t *pgd; 540 pgd_t *pgd;
541 541
542 /* Flush the TLB to avoid speculation if coherency is required. */
543 if (parisc_requires_coherency())
544 flush_tlb_all();
545
542 /* Flushing the whole cache on each cpu takes forever on 546 /* Flushing the whole cache on each cpu takes forever on
543 rp3440, etc. So, avoid it if the mm isn't too big. */ 547 rp3440, etc. So, avoid it if the mm isn't too big. */
544 if (mm_total_size(mm) >= parisc_cache_flush_threshold) { 548 if (mm_total_size(mm) >= parisc_cache_flush_threshold) {
@@ -577,33 +581,22 @@ void flush_cache_mm(struct mm_struct *mm)
577void flush_cache_range(struct vm_area_struct *vma, 581void flush_cache_range(struct vm_area_struct *vma,
578 unsigned long start, unsigned long end) 582 unsigned long start, unsigned long end)
579{ 583{
580 unsigned long addr;
581 pgd_t *pgd;
582
583 BUG_ON(!vma->vm_mm->context); 584 BUG_ON(!vma->vm_mm->context);
584 585
586 /* Flush the TLB to avoid speculation if coherency is required. */
587 if (parisc_requires_coherency())
588 flush_tlb_range(vma, start, end);
589
585 if ((end - start) >= parisc_cache_flush_threshold) { 590 if ((end - start) >= parisc_cache_flush_threshold) {
586 flush_cache_all(); 591 flush_cache_all();
587 return; 592 return;
588 } 593 }
589 594
590 if (vma->vm_mm->context == mfsp(3)) { 595 BUG_ON(vma->vm_mm->context != mfsp(3));
591 flush_user_dcache_range_asm(start, end);
592 if (vma->vm_flags & VM_EXEC)
593 flush_user_icache_range_asm(start, end);
594 return;
595 }
596 596
597 pgd = vma->vm_mm->pgd; 597 flush_user_dcache_range_asm(start, end);
598 for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { 598 if (vma->vm_flags & VM_EXEC)
599 unsigned long pfn; 599 flush_user_icache_range_asm(start, end);
600 pte_t *ptep = get_ptep(pgd, addr);
601 if (!ptep)
602 continue;
603 pfn = pte_pfn(*ptep);
604 if (pfn_valid(pfn))
605 __flush_cache_page(vma, addr, PFN_PHYS(pfn));
606 }
607} 600}
608 601
609void 602void
@@ -612,7 +605,8 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
612 BUG_ON(!vma->vm_mm->context); 605 BUG_ON(!vma->vm_mm->context);
613 606
614 if (pfn_valid(pfn)) { 607 if (pfn_valid(pfn)) {
615 flush_tlb_page(vma, vmaddr); 608 if (parisc_requires_coherency())
609 flush_tlb_page(vma, vmaddr);
616 __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); 610 __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn));
617 } 611 }
618} 612}
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 98190252c12f..f622a311d04a 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1481,12 +1481,44 @@ int pdc_pat_mem_read_pd_pdt(struct pdc_pat_mem_read_pd_retinfo *pret,
1481 unsigned long offset) 1481 unsigned long offset)
1482{ 1482{
1483 int retval; 1483 int retval;
1484 unsigned long flags; 1484 unsigned long flags, entries;
1485 1485
1486 spin_lock_irqsave(&pdc_lock, flags); 1486 spin_lock_irqsave(&pdc_lock, flags);
1487 retval = mem_pdc_call(PDC_PAT_MEM, PDC_PAT_MEM_PD_READ, 1487 retval = mem_pdc_call(PDC_PAT_MEM, PDC_PAT_MEM_PD_READ,
1488 __pa(&pret), __pa(pdt_entries_ptr), 1488 __pa(&pdc_result), __pa(pdt_entries_ptr),
1489 count, offset); 1489 count, offset);
1490
1491 if (retval == PDC_OK) {
1492 entries = min(pdc_result[0], count);
1493 pret->actual_count_bytes = entries;
1494 pret->pdt_entries = entries / sizeof(unsigned long);
1495 }
1496
1497 spin_unlock_irqrestore(&pdc_lock, flags);
1498
1499 return retval;
1500}
1501
1502/**
1503 * pdc_pat_mem_get_dimm_phys_location - Get physical DIMM slot via PAT firmware
1504 * @pret: ptr to hold returned information
1505 * @phys_addr: physical address to examine
1506 *
1507 */
1508int pdc_pat_mem_get_dimm_phys_location(
1509 struct pdc_pat_mem_phys_mem_location *pret,
1510 unsigned long phys_addr)
1511{
1512 int retval;
1513 unsigned long flags;
1514
1515 spin_lock_irqsave(&pdc_lock, flags);
1516 retval = mem_pdc_call(PDC_PAT_MEM, PDC_PAT_MEM_ADDRESS,
1517 __pa(&pdc_result), phys_addr);
1518
1519 if (retval == PDC_OK)
1520 memcpy(pret, &pdc_result, sizeof(*pret));
1521
1490 spin_unlock_irqrestore(&pdc_lock, flags); 1522 spin_unlock_irqrestore(&pdc_lock, flags);
1491 1523
1492 return retval; 1524 return retval;
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index ba5e1c7b1f17..5404e4086cb9 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -413,6 +413,10 @@ static inline void stack_overflow_check(struct pt_regs *regs)
413 if (regs->sr[7]) 413 if (regs->sr[7])
414 return; 414 return;
415 415
416 /* exit if already in panic */
417 if (sysctl_panic_on_stackoverflow < 0)
418 return;
419
416 /* calculate kernel stack usage */ 420 /* calculate kernel stack usage */
417 stack_usage = sp - stack_start; 421 stack_usage = sp - stack_start;
418#ifdef CONFIG_IRQSTACKS 422#ifdef CONFIG_IRQSTACKS
@@ -454,8 +458,10 @@ check_kernel_stack:
454#ifdef CONFIG_IRQSTACKS 458#ifdef CONFIG_IRQSTACKS
455panic_check: 459panic_check:
456#endif 460#endif
457 if (sysctl_panic_on_stackoverflow) 461 if (sysctl_panic_on_stackoverflow) {
462 sysctl_panic_on_stackoverflow = -1; /* disable further checks */
458 panic("low stack detected by irq handler - check messages\n"); 463 panic("low stack detected by irq handler - check messages\n");
464 }
459#endif 465#endif
460} 466}
461 467
diff --git a/arch/parisc/kernel/pdt.c b/arch/parisc/kernel/pdt.c
index f3a797e670b0..d02874ecb94d 100644
--- a/arch/parisc/kernel/pdt.c
+++ b/arch/parisc/kernel/pdt.c
@@ -112,10 +112,12 @@ void __init pdc_pdt_init(void)
112#ifdef CONFIG_64BIT 112#ifdef CONFIG_64BIT
113 struct pdc_pat_mem_read_pd_retinfo pat_pret; 113 struct pdc_pat_mem_read_pd_retinfo pat_pret;
114 114
115 /* try old obsolete PAT firmware function first */
116 pdt_type = PDT_PAT_OLD;
115 ret = pdc_pat_mem_read_cell_pdt(&pat_pret, pdt_entry, 117 ret = pdc_pat_mem_read_cell_pdt(&pat_pret, pdt_entry,
116 MAX_PDT_ENTRIES); 118 MAX_PDT_ENTRIES);
117 if (ret != PDC_OK) { 119 if (ret != PDC_OK) {
118 pdt_type = PDT_PAT_OLD; 120 pdt_type = PDT_PAT_NEW;
119 ret = pdc_pat_mem_read_pd_pdt(&pat_pret, pdt_entry, 121 ret = pdc_pat_mem_read_pd_pdt(&pat_pret, pdt_entry,
120 MAX_PDT_TABLE_SIZE, 0); 122 MAX_PDT_TABLE_SIZE, 0);
121 } 123 }
@@ -131,11 +133,20 @@ void __init pdc_pdt_init(void)
131 } 133 }
132 134
133 for (i = 0; i < pdt_status.pdt_entries; i++) { 135 for (i = 0; i < pdt_status.pdt_entries; i++) {
134 if (i < 20) 136 struct pdc_pat_mem_phys_mem_location loc;
135 pr_warn("PDT: BAD PAGE #%d at 0x%08lx (error_type = %lu)\n", 137
136 i, 138 /* get DIMM slot number */
137 pdt_entry[i] & PAGE_MASK, 139 loc.dimm_slot = 0xff;
138 pdt_entry[i] & 1); 140#ifdef CONFIG_64BIT
141 pdc_pat_mem_get_dimm_phys_location(&loc, pdt_entry[i]);
142#endif
143
144 pr_warn("PDT: BAD PAGE #%d at 0x%08lx, "
145 "DIMM slot %02x (error_type = %lu)\n",
146 i,
147 pdt_entry[i] & PAGE_MASK,
148 loc.dimm_slot,
149 pdt_entry[i] & 1);
139 150
140 /* mark memory page bad */ 151 /* mark memory page bad */
141 memblock_reserve(pdt_entry[i] & PAGE_MASK, PAGE_SIZE); 152 memblock_reserve(pdt_entry[i] & PAGE_MASK, PAGE_SIZE);
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index b64d7d21646e..a45a67d526f8 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -53,6 +53,7 @@
53#include <linux/uaccess.h> 53#include <linux/uaccess.h>
54#include <linux/rcupdate.h> 54#include <linux/rcupdate.h>
55#include <linux/random.h> 55#include <linux/random.h>
56#include <linux/nmi.h>
56 57
57#include <asm/io.h> 58#include <asm/io.h>
58#include <asm/asm-offsets.h> 59#include <asm/asm-offsets.h>
@@ -145,6 +146,7 @@ void machine_power_off(void)
145 146
146 /* prevent soft lockup/stalled CPU messages for endless loop. */ 147 /* prevent soft lockup/stalled CPU messages for endless loop. */
147 rcu_sysrq_start(); 148 rcu_sysrq_start();
149 lockup_detector_suspend();
148 for (;;); 150 for (;;);
149} 151}
150 152
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 3d6ef1b29c6a..ffe2cbf52d1a 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -78,6 +78,8 @@ SECTIONS
78 *(.text.sys_exit) 78 *(.text.sys_exit)
79 *(.text.do_sigaltstack) 79 *(.text.do_sigaltstack)
80 *(.text.do_fork) 80 *(.text.do_fork)
81 *(.text.div)
82 *($$*) /* millicode routines */
81 *(.text.*) 83 *(.text.*)
82 *(.fixup) 84 *(.fixup)
83 *(.lock.text) /* out-of-line lock text */ 85 *(.lock.text) /* out-of-line lock text */
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 8d4ed73d5490..e2b3e7a00c9e 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -59,6 +59,19 @@ machine-$(CONFIG_PPC64) += 64
59machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le 59machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
60UTS_MACHINE := $(subst $(space),,$(machine-y)) 60UTS_MACHINE := $(subst $(space),,$(machine-y))
61 61
62# XXX This needs to be before we override LD below
63ifdef CONFIG_PPC32
64KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
65else
66ifeq ($(call ld-ifversion, -ge, 225000000, y),y)
67# Have the linker provide sfpr if possible.
68# There is a corresponding test in arch/powerpc/lib/Makefile
69KBUILD_LDFLAGS_MODULE += --save-restore-funcs
70else
71KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
72endif
73endif
74
62ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) 75ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
63override LD += -EL 76override LD += -EL
64LDEMULATION := lppc 77LDEMULATION := lppc
@@ -190,18 +203,6 @@ else
190CHECKFLAGS += -D__LITTLE_ENDIAN__ 203CHECKFLAGS += -D__LITTLE_ENDIAN__
191endif 204endif
192 205
193ifdef CONFIG_PPC32
194KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
195else
196ifeq ($(call ld-ifversion, -ge, 225000000, y),y)
197# Have the linker provide sfpr if possible.
198# There is a corresponding test in arch/powerpc/lib/Makefile
199KBUILD_LDFLAGS_MODULE += --save-restore-funcs
200else
201KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
202endif
203endif
204
205ifeq ($(CONFIG_476FPE_ERR46),y) 206ifeq ($(CONFIG_476FPE_ERR46),y)
206 KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ 207 KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
207 -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds 208 -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
index 0ce513f2926f..36fc7bfe9e11 100644
--- a/arch/powerpc/include/asm/book3s/64/hash.h
+++ b/arch/powerpc/include/asm/book3s/64/hash.h
@@ -91,6 +91,7 @@ static inline int hash__pgd_bad(pgd_t pgd)
91} 91}
92#ifdef CONFIG_STRICT_KERNEL_RWX 92#ifdef CONFIG_STRICT_KERNEL_RWX
93extern void hash__mark_rodata_ro(void); 93extern void hash__mark_rodata_ro(void);
94extern void hash__mark_initmem_nx(void);
94#endif 95#endif
95 96
96extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr, 97extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
index 77529a3e3811..5b4023c616f7 100644
--- a/arch/powerpc/include/asm/book3s/64/mmu.h
+++ b/arch/powerpc/include/asm/book3s/64/mmu.h
@@ -59,13 +59,14 @@ extern struct patb_entry *partition_tb;
59#define PRTS_MASK 0x1f /* process table size field */ 59#define PRTS_MASK 0x1f /* process table size field */
60#define PRTB_MASK 0x0ffffffffffff000UL 60#define PRTB_MASK 0x0ffffffffffff000UL
61 61
62/* 62/* Number of supported PID bits */
63 * Limit process table to PAGE_SIZE table. This 63extern unsigned int mmu_pid_bits;
64 * also limit the max pid we can support. 64
65 * MAX_USER_CONTEXT * 16 bytes of space. 65/* Base PID to allocate from */
66 */ 66extern unsigned int mmu_base_pid;
67#define PRTB_SIZE_SHIFT (CONTEXT_BITS + 4) 67
68#define PRTB_ENTRIES (1ul << CONTEXT_BITS) 68#define PRTB_SIZE_SHIFT (mmu_pid_bits + 4)
69#define PRTB_ENTRIES (1ul << mmu_pid_bits)
69 70
70/* 71/*
71 * Power9 currently only support 64K partition table size. 72 * Power9 currently only support 64K partition table size.
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index c0737c86a362..d1da415e283c 100644
--- a/arch/powerpc/include/asm/book3s/64/pgtable.h
+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
@@ -1192,5 +1192,6 @@ static inline const int pud_pfn(pud_t pud)
1192 BUILD_BUG(); 1192 BUILD_BUG();
1193 return 0; 1193 return 0;
1194} 1194}
1195
1195#endif /* __ASSEMBLY__ */ 1196#endif /* __ASSEMBLY__ */
1196#endif /* _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ */ 1197#endif /* _ASM_POWERPC_BOOK3S_64_PGTABLE_H_ */
diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h
index 487709ff6875..544440b5aff3 100644
--- a/arch/powerpc/include/asm/book3s/64/radix.h
+++ b/arch/powerpc/include/asm/book3s/64/radix.h
@@ -118,6 +118,7 @@
118 118
119#ifdef CONFIG_STRICT_KERNEL_RWX 119#ifdef CONFIG_STRICT_KERNEL_RWX
120extern void radix__mark_rodata_ro(void); 120extern void radix__mark_rodata_ro(void);
121extern void radix__mark_initmem_nx(void);
121#endif 122#endif
122 123
123static inline unsigned long __radix_pte_update(pte_t *ptep, unsigned long clr, 124static inline unsigned long __radix_pte_update(pte_t *ptep, unsigned long clr,
diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
index 0151af6c2a50..87fcc1948817 100644
--- a/arch/powerpc/include/asm/bug.h
+++ b/arch/powerpc/include/asm/bug.h
@@ -18,7 +18,7 @@
18#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
19#ifdef CONFIG_DEBUG_BUGVERBOSE 19#ifdef CONFIG_DEBUG_BUGVERBOSE
20.macro EMIT_BUG_ENTRY addr,file,line,flags 20.macro EMIT_BUG_ENTRY addr,file,line,flags
21 .section __bug_table,"a" 21 .section __bug_table,"aw"
225001: PPC_LONG \addr, 5002f 225001: PPC_LONG \addr, 5002f
23 .short \line, \flags 23 .short \line, \flags
24 .org 5001b+BUG_ENTRY_SIZE 24 .org 5001b+BUG_ENTRY_SIZE
@@ -29,7 +29,7 @@
29.endm 29.endm
30#else 30#else
31.macro EMIT_BUG_ENTRY addr,file,line,flags 31.macro EMIT_BUG_ENTRY addr,file,line,flags
32 .section __bug_table,"a" 32 .section __bug_table,"aw"
335001: PPC_LONG \addr 335001: PPC_LONG \addr
34 .short \flags 34 .short \flags
35 .org 5001b+BUG_ENTRY_SIZE 35 .org 5001b+BUG_ENTRY_SIZE
@@ -42,14 +42,14 @@
42 sizeof(struct bug_entry), respectively */ 42 sizeof(struct bug_entry), respectively */
43#ifdef CONFIG_DEBUG_BUGVERBOSE 43#ifdef CONFIG_DEBUG_BUGVERBOSE
44#define _EMIT_BUG_ENTRY \ 44#define _EMIT_BUG_ENTRY \
45 ".section __bug_table,\"a\"\n" \ 45 ".section __bug_table,\"aw\"\n" \
46 "2:\t" PPC_LONG "1b, %0\n" \ 46 "2:\t" PPC_LONG "1b, %0\n" \
47 "\t.short %1, %2\n" \ 47 "\t.short %1, %2\n" \
48 ".org 2b+%3\n" \ 48 ".org 2b+%3\n" \
49 ".previous\n" 49 ".previous\n"
50#else 50#else
51#define _EMIT_BUG_ENTRY \ 51#define _EMIT_BUG_ENTRY \
52 ".section __bug_table,\"a\"\n" \ 52 ".section __bug_table,\"aw\"\n" \
53 "2:\t" PPC_LONG "1b\n" \ 53 "2:\t" PPC_LONG "1b\n" \
54 "\t.short %2\n" \ 54 "\t.short %2\n" \
55 ".org 2b+%3\n" \ 55 ".org 2b+%3\n" \
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index da7e9432fa8f..0c76675394c5 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -45,7 +45,7 @@ extern void set_context(unsigned long id, pgd_t *pgd);
45 45
46#ifdef CONFIG_PPC_BOOK3S_64 46#ifdef CONFIG_PPC_BOOK3S_64
47extern void radix__switch_mmu_context(struct mm_struct *prev, 47extern void radix__switch_mmu_context(struct mm_struct *prev,
48 struct mm_struct *next); 48 struct mm_struct *next);
49static inline void switch_mmu_context(struct mm_struct *prev, 49static inline void switch_mmu_context(struct mm_struct *prev,
50 struct mm_struct *next, 50 struct mm_struct *next,
51 struct task_struct *tsk) 51 struct task_struct *tsk)
@@ -67,6 +67,12 @@ extern void __destroy_context(unsigned long context_id);
67extern void mmu_context_init(void); 67extern void mmu_context_init(void);
68#endif 68#endif
69 69
70#if defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE) && defined(CONFIG_PPC_RADIX_MMU)
71extern void radix_kvm_prefetch_workaround(struct mm_struct *mm);
72#else
73static inline void radix_kvm_prefetch_workaround(struct mm_struct *mm) { }
74#endif
75
70extern void switch_cop(struct mm_struct *next); 76extern void switch_cop(struct mm_struct *next);
71extern int use_cop(unsigned long acop, struct mm_struct *mm); 77extern int use_cop(unsigned long acop, struct mm_struct *mm);
72extern void drop_cop(unsigned long acop, struct mm_struct *mm); 78extern void drop_cop(unsigned long acop, struct mm_struct *mm);
@@ -79,9 +85,13 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev,
79 struct mm_struct *next, 85 struct mm_struct *next,
80 struct task_struct *tsk) 86 struct task_struct *tsk)
81{ 87{
88 bool new_on_cpu = false;
89
82 /* Mark this context has been used on the new CPU */ 90 /* Mark this context has been used on the new CPU */
83 if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(next))) 91 if (!cpumask_test_cpu(smp_processor_id(), mm_cpumask(next))) {
84 cpumask_set_cpu(smp_processor_id(), mm_cpumask(next)); 92 cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
93 new_on_cpu = true;
94 }
85 95
86 /* 32-bit keeps track of the current PGDIR in the thread struct */ 96 /* 32-bit keeps track of the current PGDIR in the thread struct */
87#ifdef CONFIG_PPC32 97#ifdef CONFIG_PPC32
@@ -109,6 +119,10 @@ static inline void switch_mm_irqs_off(struct mm_struct *prev,
109 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 119 if (cpu_has_feature(CPU_FTR_ALTIVEC))
110 asm volatile ("dssall"); 120 asm volatile ("dssall");
111#endif /* CONFIG_ALTIVEC */ 121#endif /* CONFIG_ALTIVEC */
122
123 if (new_on_cpu)
124 radix_kvm_prefetch_workaround(next);
125
112 /* 126 /*
113 * The actual HW switching method differs between the various 127 * The actual HW switching method differs between the various
114 * sub architectures. Out of line for now 128 * sub architectures. Out of line for now
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index dd01212935ac..afae9a336136 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -80,6 +80,13 @@ unsigned long vmalloc_to_phys(void *vmalloc_addr);
80 80
81void pgtable_cache_add(unsigned shift, void (*ctor)(void *)); 81void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
82void pgtable_cache_init(void); 82void pgtable_cache_init(void);
83
84#ifdef CONFIG_STRICT_KERNEL_RWX
85void mark_initmem_nx(void);
86#else
87static inline void mark_initmem_nx(void) { }
88#endif
89
83#endif /* __ASSEMBLY__ */ 90#endif /* __ASSEMBLY__ */
84 91
85#endif /* _ASM_POWERPC_PGTABLE_H */ 92#endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/arch/powerpc/include/uapi/asm/ioctls.h b/arch/powerpc/include/uapi/asm/ioctls.h
index bfd609a3e928..e3b10469f787 100644
--- a/arch/powerpc/include/uapi/asm/ioctls.h
+++ b/arch/powerpc/include/uapi/asm/ioctls.h
@@ -100,7 +100,7 @@
100#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 100#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
101#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 101#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
102#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 102#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
103#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 103#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
104 104
105#define TIOCSERCONFIG 0x5453 105#define TIOCSERCONFIG 0x5453
106#define TIOCSERGWILD 0x5454 106#define TIOCSERGWILD 0x5454
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index e6d8354d79ef..9029afd1fa2a 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -824,7 +824,7 @@ EXC_COMMON(trap_0b_common, 0xb00, unknown_exception)
824 * r3 volatile parameter and return value for status 824 * r3 volatile parameter and return value for status
825 * r4-r10 volatile input and output value 825 * r4-r10 volatile input and output value
826 * r11 volatile hypercall number and output value 826 * r11 volatile hypercall number and output value
827 * r12 volatile 827 * r12 volatile input and output value
828 * r13-r31 nonvolatile 828 * r13-r31 nonvolatile
829 * LR nonvolatile 829 * LR nonvolatile
830 * CTR volatile 830 * CTR volatile
@@ -834,25 +834,26 @@ EXC_COMMON(trap_0b_common, 0xb00, unknown_exception)
834 * Other registers nonvolatile 834 * Other registers nonvolatile
835 * 835 *
836 * The intersection of volatile registers that don't contain possible 836 * The intersection of volatile registers that don't contain possible
837 * inputs is: r12, cr0, xer, ctr. We may use these as scratch regs 837 * inputs is: cr0, xer, ctr. We may use these as scratch regs upon entry
838 * upon entry without saving. 838 * without saving, though xer is not a good idea to use, as hardware may
839 * interpret some bits so it may be costly to change them.
839 */ 840 */
840#ifdef CONFIG_KVM_BOOK3S_64_HANDLER 841#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
841 /* 842 /*
842 * There is a little bit of juggling to get syscall and hcall 843 * There is a little bit of juggling to get syscall and hcall
843 * working well. Save r10 in ctr to be restored in case it is a 844 * working well. Save r13 in ctr to avoid using SPRG scratch
844 * hcall. 845 * register.
845 * 846 *
846 * Userspace syscalls have already saved the PPR, hcalls must save 847 * Userspace syscalls have already saved the PPR, hcalls must save
847 * it before setting HMT_MEDIUM. 848 * it before setting HMT_MEDIUM.
848 */ 849 */
849#define SYSCALL_KVMTEST \ 850#define SYSCALL_KVMTEST \
850 mr r12,r13; \ 851 mtctr r13; \
851 GET_PACA(r13); \ 852 GET_PACA(r13); \
852 mtctr r10; \ 853 std r10,PACA_EXGEN+EX_R10(r13); \
853 KVMTEST_PR(0xc00); /* uses r10, branch to do_kvm_0xc00_system_call */ \ 854 KVMTEST_PR(0xc00); /* uses r10, branch to do_kvm_0xc00_system_call */ \
854 HMT_MEDIUM; \ 855 HMT_MEDIUM; \
855 mr r9,r12; \ 856 mfctr r9;
856 857
857#else 858#else
858#define SYSCALL_KVMTEST \ 859#define SYSCALL_KVMTEST \
@@ -935,8 +936,8 @@ EXC_VIRT_END(system_call, 0x4c00, 0x100)
935 * This is a hcall, so register convention is as above, with these 936 * This is a hcall, so register convention is as above, with these
936 * differences: 937 * differences:
937 * r13 = PACA 938 * r13 = PACA
938 * r12 = orig r13 939 * ctr = orig r13
939 * ctr = orig r10 940 * orig r10 saved in PACA
940 */ 941 */
941TRAMP_KVM_BEGIN(do_kvm_0xc00) 942TRAMP_KVM_BEGIN(do_kvm_0xc00)
942 /* 943 /*
@@ -944,14 +945,13 @@ TRAMP_KVM_BEGIN(do_kvm_0xc00)
944 * HMT_MEDIUM. That allows the KVM code to save that value into the 945 * HMT_MEDIUM. That allows the KVM code to save that value into the
945 * guest state (it is the guest's PPR value). 946 * guest state (it is the guest's PPR value).
946 */ 947 */
947 OPT_GET_SPR(r0, SPRN_PPR, CPU_FTR_HAS_PPR) 948 OPT_GET_SPR(r10, SPRN_PPR, CPU_FTR_HAS_PPR)
948 HMT_MEDIUM 949 HMT_MEDIUM
949 OPT_SAVE_REG_TO_PACA(PACA_EXGEN+EX_PPR, r0, CPU_FTR_HAS_PPR) 950 OPT_SAVE_REG_TO_PACA(PACA_EXGEN+EX_PPR, r10, CPU_FTR_HAS_PPR)
950 mfctr r10 951 mfctr r10
951 SET_SCRATCH0(r12) 952 SET_SCRATCH0(r10)
952 std r9,PACA_EXGEN+EX_R9(r13) 953 std r9,PACA_EXGEN+EX_R9(r13)
953 mfcr r9 954 mfcr r9
954 std r10,PACA_EXGEN+EX_R10(r13)
955 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00) 955 KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00)
956#endif 956#endif
957 957
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 5adb390e773b..516ebef905c0 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -30,6 +30,7 @@
30 * Use unused space in the interrupt stack to save and restore 30 * Use unused space in the interrupt stack to save and restore
31 * registers for winkle support. 31 * registers for winkle support.
32 */ 32 */
33#define _MMCR0 GPR0
33#define _SDR1 GPR3 34#define _SDR1 GPR3
34#define _PTCR GPR3 35#define _PTCR GPR3
35#define _RPR GPR4 36#define _RPR GPR4
@@ -272,6 +273,14 @@ power_enter_stop:
272 b pnv_wakeup_noloss 273 b pnv_wakeup_noloss
273 274
274.Lhandle_esl_ec_set: 275.Lhandle_esl_ec_set:
276 /*
277 * POWER9 DD2 can incorrectly set PMAO when waking up after a
278 * state-loss idle. Saving and restoring MMCR0 over idle is a
279 * workaround.
280 */
281 mfspr r4,SPRN_MMCR0
282 std r4,_MMCR0(r1)
283
275/* 284/*
276 * Check if the requested state is a deep idle state. 285 * Check if the requested state is a deep idle state.
277 */ 286 */
@@ -450,10 +459,14 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
450pnv_restore_hyp_resource_arch300: 459pnv_restore_hyp_resource_arch300:
451 /* 460 /*
452 * Workaround for POWER9, if we lost resources, the ERAT 461 * Workaround for POWER9, if we lost resources, the ERAT
453 * might have been mixed up and needs flushing. 462 * might have been mixed up and needs flushing. We also need
463 * to reload MMCR0 (see comment above).
454 */ 464 */
455 blt cr3,1f 465 blt cr3,1f
456 PPC_INVALIDATE_ERAT 466 PPC_INVALIDATE_ERAT
467 ld r1,PACAR1(r13)
468 ld r4,_MMCR0(r1)
469 mtspr SPRN_MMCR0,r4
4571: 4701:
458 /* 471 /*
459 * POWER ISA 3. Use PSSCR to determine if we 472 * POWER ISA 3. Use PSSCR to determine if we
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 8cb0190e2a73..b42812e014c0 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -164,8 +164,10 @@ long kvmppc_alloc_reset_hpt(struct kvm *kvm, int order)
164 goto out; 164 goto out;
165 } 165 }
166 166
167 if (kvm->arch.hpt.virt) 167 if (kvm->arch.hpt.virt) {
168 kvmppc_free_hpt(&kvm->arch.hpt); 168 kvmppc_free_hpt(&kvm->arch.hpt);
169 kvmppc_rmap_reset(kvm);
170 }
169 171
170 err = kvmppc_allocate_hpt(&info, order); 172 err = kvmppc_allocate_hpt(&info, order);
171 if (err < 0) 173 if (err < 0)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 0b436df746fc..359c79cdf0cc 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3211,6 +3211,8 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
3211 run->fail_entry.hardware_entry_failure_reason = 0; 3211 run->fail_entry.hardware_entry_failure_reason = 0;
3212 return -EINVAL; 3212 return -EINVAL;
3213 } 3213 }
3214 /* Enable TM so we can read the TM SPRs */
3215 mtmsr(mfmsr() | MSR_TM);
3214 current->thread.tm_tfhar = mfspr(SPRN_TFHAR); 3216 current->thread.tm_tfhar = mfspr(SPRN_TFHAR);
3215 current->thread.tm_tfiar = mfspr(SPRN_TFIAR); 3217 current->thread.tm_tfiar = mfspr(SPRN_TFIAR);
3216 current->thread.tm_texasr = mfspr(SPRN_TEXASR); 3218 current->thread.tm_texasr = mfspr(SPRN_TEXASR);
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index cb44065e2946..c52184a8efdf 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1443,12 +1443,14 @@ mc_cont:
1443 ori r6,r6,1 1443 ori r6,r6,1
1444 mtspr SPRN_CTRLT,r6 1444 mtspr SPRN_CTRLT,r6
14454: 14454:
1446 /* Read the guest SLB and save it away */ 1446 /* Check if we are running hash or radix and store it in cr2 */
1447 ld r5, VCPU_KVM(r9) 1447 ld r5, VCPU_KVM(r9)
1448 lbz r0, KVM_RADIX(r5) 1448 lbz r0, KVM_RADIX(r5)
1449 cmpwi r0, 0 1449 cmpwi cr2,r0,0
1450
1451 /* Read the guest SLB and save it away */
1450 li r5, 0 1452 li r5, 0
1451 bne 3f /* for radix, save 0 entries */ 1453 bne cr2, 3f /* for radix, save 0 entries */
1452 lwz r0,VCPU_SLB_NR(r9) /* number of entries in SLB */ 1454 lwz r0,VCPU_SLB_NR(r9) /* number of entries in SLB */
1453 mtctr r0 1455 mtctr r0
1454 li r6,0 1456 li r6,0
@@ -1712,11 +1714,6 @@ BEGIN_FTR_SECTION_NESTED(96)
1712END_FTR_SECTION_NESTED(CPU_FTR_ARCH_300, 0, 96) 1714END_FTR_SECTION_NESTED(CPU_FTR_ARCH_300, 0, 96)
1713END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) 1715END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
171422: 171622:
1715 /* Clear out SLB */
1716 li r5,0
1717 slbmte r5,r5
1718 slbia
1719 ptesync
1720 1717
1721 /* Restore host values of some registers */ 1718 /* Restore host values of some registers */
1722BEGIN_FTR_SECTION 1719BEGIN_FTR_SECTION
@@ -1737,10 +1734,56 @@ BEGIN_FTR_SECTION
1737 mtspr SPRN_PID, r7 1734 mtspr SPRN_PID, r7
1738 mtspr SPRN_IAMR, r8 1735 mtspr SPRN_IAMR, r8
1739END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) 1736END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
1737
1738#ifdef CONFIG_PPC_RADIX_MMU
1739 /*
1740 * Are we running hash or radix ?
1741 */
1742 beq cr2,3f
1743
1744 /* Radix: Handle the case where the guest used an illegal PID */
1745 LOAD_REG_ADDR(r4, mmu_base_pid)
1746 lwz r3, VCPU_GUEST_PID(r9)
1747 lwz r5, 0(r4)
1748 cmpw cr0,r3,r5
1749 blt 2f
1750
1751 /*
1752 * Illegal PID, the HW might have prefetched and cached in the TLB
1753 * some translations for the LPID 0 / guest PID combination which
1754 * Linux doesn't know about, so we need to flush that PID out of
1755 * the TLB. First we need to set LPIDR to 0 so tlbiel applies to
1756 * the right context.
1757 */
1758 li r0,0
1759 mtspr SPRN_LPID,r0
1760 isync
1761
1762 /* Then do a congruence class local flush */
1763 ld r6,VCPU_KVM(r9)
1764 lwz r0,KVM_TLB_SETS(r6)
1765 mtctr r0
1766 li r7,0x400 /* IS field = 0b01 */
1767 ptesync
1768 sldi r0,r3,32 /* RS has PID */
17691: PPC_TLBIEL(7,0,2,1,1) /* RIC=2, PRS=1, R=1 */
1770 addi r7,r7,0x1000
1771 bdnz 1b
1772 ptesync
1773
17742: /* Flush the ERAT on radix P9 DD1 guest exit */
1740BEGIN_FTR_SECTION 1775BEGIN_FTR_SECTION
1741 PPC_INVALIDATE_ERAT 1776 PPC_INVALIDATE_ERAT
1742END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1) 1777END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1)
1778 b 4f
1779#endif /* CONFIG_PPC_RADIX_MMU */
1743 1780
1781 /* Hash: clear out SLB */
17823: li r5,0
1783 slbmte r5,r5
1784 slbia
1785 ptesync
17864:
1744 /* 1787 /*
1745 * POWER7/POWER8 guest -> host partition switch code. 1788 * POWER7/POWER8 guest -> host partition switch code.
1746 * We don't have to lock against tlbies but we do 1789 * We don't have to lock against tlbies but we do
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 8541f18694a4..46b4e67d2372 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -402,6 +402,7 @@ void __init mem_init(void)
402void free_initmem(void) 402void free_initmem(void)
403{ 403{
404 ppc_md.progress = ppc_printk_progress; 404 ppc_md.progress = ppc_printk_progress;
405 mark_initmem_nx();
405 free_initmem_default(POISON_FREE_INITMEM); 406 free_initmem_default(POISON_FREE_INITMEM);
406} 407}
407 408
diff --git a/arch/powerpc/mm/mmu_context_book3s64.c b/arch/powerpc/mm/mmu_context_book3s64.c
index abed1fe6992f..a75f63833284 100644
--- a/arch/powerpc/mm/mmu_context_book3s64.c
+++ b/arch/powerpc/mm/mmu_context_book3s64.c
@@ -126,9 +126,10 @@ static int hash__init_new_context(struct mm_struct *mm)
126static int radix__init_new_context(struct mm_struct *mm) 126static int radix__init_new_context(struct mm_struct *mm)
127{ 127{
128 unsigned long rts_field; 128 unsigned long rts_field;
129 int index; 129 int index, max_id;
130 130
131 index = alloc_context_id(1, PRTB_ENTRIES - 1); 131 max_id = (1 << mmu_pid_bits) - 1;
132 index = alloc_context_id(mmu_base_pid, max_id);
132 if (index < 0) 133 if (index < 0)
133 return index; 134 return index;
134 135
diff --git a/arch/powerpc/mm/pgtable-hash64.c b/arch/powerpc/mm/pgtable-hash64.c
index 188b4107584d..443a2c66a304 100644
--- a/arch/powerpc/mm/pgtable-hash64.c
+++ b/arch/powerpc/mm/pgtable-hash64.c
@@ -425,33 +425,51 @@ int hash__has_transparent_hugepage(void)
425#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 425#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
426 426
427#ifdef CONFIG_STRICT_KERNEL_RWX 427#ifdef CONFIG_STRICT_KERNEL_RWX
428void hash__mark_rodata_ro(void) 428static bool hash__change_memory_range(unsigned long start, unsigned long end,
429 unsigned long newpp)
429{ 430{
430 unsigned long start = (unsigned long)_stext;
431 unsigned long end = (unsigned long)__init_begin;
432 unsigned long idx; 431 unsigned long idx;
433 unsigned int step, shift; 432 unsigned int step, shift;
434 unsigned long newpp = PP_RXXX;
435 433
436 shift = mmu_psize_defs[mmu_linear_psize].shift; 434 shift = mmu_psize_defs[mmu_linear_psize].shift;
437 step = 1 << shift; 435 step = 1 << shift;
438 436
439 start = ((start + step - 1) >> shift) << shift; 437 start = ALIGN_DOWN(start, step);
440 end = (end >> shift) << shift; 438 end = ALIGN(end, step); // aligns up
441 439
442 pr_devel("marking ro start %lx, end %lx, step %x\n", 440 if (start >= end)
443 start, end, step); 441 return false;
444 442
445 if (start == end) { 443 pr_debug("Changing page protection on range 0x%lx-0x%lx, to 0x%lx, step 0x%x\n",
446 pr_warn("could not set rodata ro, relocate the start" 444 start, end, newpp, step);
447 " of the kernel to a 0x%x boundary\n", step);
448 return;
449 }
450 445
451 for (idx = start; idx < end; idx += step) 446 for (idx = start; idx < end; idx += step)
452 /* Not sure if we can do much with the return value */ 447 /* Not sure if we can do much with the return value */
453 mmu_hash_ops.hpte_updateboltedpp(newpp, idx, mmu_linear_psize, 448 mmu_hash_ops.hpte_updateboltedpp(newpp, idx, mmu_linear_psize,
454 mmu_kernel_ssize); 449 mmu_kernel_ssize);
455 450
451 return true;
452}
453
454void hash__mark_rodata_ro(void)
455{
456 unsigned long start, end;
457
458 start = (unsigned long)_stext;
459 end = (unsigned long)__init_begin;
460
461 WARN_ON(!hash__change_memory_range(start, end, PP_RXXX));
462}
463
464void hash__mark_initmem_nx(void)
465{
466 unsigned long start, end, pp;
467
468 start = (unsigned long)__init_begin;
469 end = (unsigned long)__init_end;
470
471 pp = htab_convert_pte_flags(pgprot_val(PAGE_KERNEL));
472
473 WARN_ON(!hash__change_memory_range(start, end, pp));
456} 474}
457#endif 475#endif
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 8c13e4282308..671a45d86c18 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -25,6 +25,9 @@
25 25
26#include <trace/events/thp.h> 26#include <trace/events/thp.h>
27 27
28unsigned int mmu_pid_bits;
29unsigned int mmu_base_pid;
30
28static int native_register_process_table(unsigned long base, unsigned long pg_sz, 31static int native_register_process_table(unsigned long base, unsigned long pg_sz,
29 unsigned long table_size) 32 unsigned long table_size)
30{ 33{
@@ -112,10 +115,9 @@ set_the_pte:
112} 115}
113 116
114#ifdef CONFIG_STRICT_KERNEL_RWX 117#ifdef CONFIG_STRICT_KERNEL_RWX
115void radix__mark_rodata_ro(void) 118void radix__change_memory_range(unsigned long start, unsigned long end,
119 unsigned long clear)
116{ 120{
117 unsigned long start = (unsigned long)_stext;
118 unsigned long end = (unsigned long)__init_begin;
119 unsigned long idx; 121 unsigned long idx;
120 pgd_t *pgdp; 122 pgd_t *pgdp;
121 pud_t *pudp; 123 pud_t *pudp;
@@ -125,7 +127,8 @@ void radix__mark_rodata_ro(void)
125 start = ALIGN_DOWN(start, PAGE_SIZE); 127 start = ALIGN_DOWN(start, PAGE_SIZE);
126 end = PAGE_ALIGN(end); // aligns up 128 end = PAGE_ALIGN(end); // aligns up
127 129
128 pr_devel("marking ro start %lx, end %lx\n", start, end); 130 pr_debug("Changing flags on range %lx-%lx removing 0x%lx\n",
131 start, end, clear);
129 132
130 for (idx = start; idx < end; idx += PAGE_SIZE) { 133 for (idx = start; idx < end; idx += PAGE_SIZE) {
131 pgdp = pgd_offset_k(idx); 134 pgdp = pgd_offset_k(idx);
@@ -147,11 +150,29 @@ void radix__mark_rodata_ro(void)
147 if (!ptep) 150 if (!ptep)
148 continue; 151 continue;
149update_the_pte: 152update_the_pte:
150 radix__pte_update(&init_mm, idx, ptep, _PAGE_WRITE, 0, 0); 153 radix__pte_update(&init_mm, idx, ptep, clear, 0, 0);
151 } 154 }
152 155
153 radix__flush_tlb_kernel_range(start, end); 156 radix__flush_tlb_kernel_range(start, end);
154} 157}
158
159void radix__mark_rodata_ro(void)
160{
161 unsigned long start, end;
162
163 start = (unsigned long)_stext;
164 end = (unsigned long)__init_begin;
165
166 radix__change_memory_range(start, end, _PAGE_WRITE);
167}
168
169void radix__mark_initmem_nx(void)
170{
171 unsigned long start = (unsigned long)__init_begin;
172 unsigned long end = (unsigned long)__init_end;
173
174 radix__change_memory_range(start, end, _PAGE_EXEC);
175}
155#endif /* CONFIG_STRICT_KERNEL_RWX */ 176#endif /* CONFIG_STRICT_KERNEL_RWX */
156 177
157static inline void __meminit print_mapping(unsigned long start, 178static inline void __meminit print_mapping(unsigned long start,
@@ -243,11 +264,34 @@ static void __init radix_init_pgtable(void)
243 for_each_memblock(memory, reg) 264 for_each_memblock(memory, reg)
244 WARN_ON(create_physical_mapping(reg->base, 265 WARN_ON(create_physical_mapping(reg->base,
245 reg->base + reg->size)); 266 reg->base + reg->size));
267
268 /* Find out how many PID bits are supported */
269 if (cpu_has_feature(CPU_FTR_HVMODE)) {
270 if (!mmu_pid_bits)
271 mmu_pid_bits = 20;
272#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
273 /*
274 * When KVM is possible, we only use the top half of the
275 * PID space to avoid collisions between host and guest PIDs
276 * which can cause problems due to prefetch when exiting the
277 * guest with AIL=3
278 */
279 mmu_base_pid = 1 << (mmu_pid_bits - 1);
280#else
281 mmu_base_pid = 1;
282#endif
283 } else {
284 /* The guest uses the bottom half of the PID space */
285 if (!mmu_pid_bits)
286 mmu_pid_bits = 19;
287 mmu_base_pid = 1;
288 }
289
246 /* 290 /*
247 * Allocate Partition table and process table for the 291 * Allocate Partition table and process table for the
248 * host. 292 * host.
249 */ 293 */
250 BUILD_BUG_ON_MSG((PRTB_SIZE_SHIFT > 36), "Process table size too large."); 294 BUG_ON(PRTB_SIZE_SHIFT > 36);
251 process_tb = early_alloc_pgtable(1UL << PRTB_SIZE_SHIFT); 295 process_tb = early_alloc_pgtable(1UL << PRTB_SIZE_SHIFT);
252 /* 296 /*
253 * Fill in the process table. 297 * Fill in the process table.
@@ -321,6 +365,12 @@ static int __init radix_dt_scan_page_sizes(unsigned long node,
321 if (type == NULL || strcmp(type, "cpu") != 0) 365 if (type == NULL || strcmp(type, "cpu") != 0)
322 return 0; 366 return 0;
323 367
368 /* Find MMU PID size */
369 prop = of_get_flat_dt_prop(node, "ibm,mmu-pid-bits", &size);
370 if (prop && size == 4)
371 mmu_pid_bits = be32_to_cpup(prop);
372
373 /* Grab page size encodings */
324 prop = of_get_flat_dt_prop(node, "ibm,processor-radix-AP-encodings", &size); 374 prop = of_get_flat_dt_prop(node, "ibm,processor-radix-AP-encodings", &size);
325 if (!prop) 375 if (!prop)
326 return 0; 376 return 0;
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 5c0b795d656c..0736e94c7615 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -505,4 +505,12 @@ void mark_rodata_ro(void)
505 else 505 else
506 hash__mark_rodata_ro(); 506 hash__mark_rodata_ro();
507} 507}
508
509void mark_initmem_nx(void)
510{
511 if (radix_enabled())
512 radix__mark_initmem_nx();
513 else
514 hash__mark_initmem_nx();
515}
508#endif 516#endif
diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index e94fbd4c8845..781532d7bc4d 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -36,7 +36,7 @@ void subpage_prot_free(struct mm_struct *mm)
36 } 36 }
37 } 37 }
38 addr = 0; 38 addr = 0;
39 for (i = 0; i < 2; ++i) { 39 for (i = 0; i < (TASK_SIZE_USER64 >> 43); ++i) {
40 p = spt->protptrs[i]; 40 p = spt->protptrs[i];
41 if (!p) 41 if (!p)
42 continue; 42 continue;
diff --git a/arch/powerpc/mm/tlb-radix.c b/arch/powerpc/mm/tlb-radix.c
index 744e0164ecf5..16ae1bbe13f0 100644
--- a/arch/powerpc/mm/tlb-radix.c
+++ b/arch/powerpc/mm/tlb-radix.c
@@ -12,12 +12,12 @@
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/hugetlb.h> 13#include <linux/hugetlb.h>
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <asm/ppc-opcode.h>
16 15
16#include <asm/ppc-opcode.h>
17#include <asm/tlb.h> 17#include <asm/tlb.h>
18#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
19#include <asm/trace.h> 19#include <asm/trace.h>
20 20#include <asm/cputhreads.h>
21 21
22#define RIC_FLUSH_TLB 0 22#define RIC_FLUSH_TLB 0
23#define RIC_FLUSH_PWC 1 23#define RIC_FLUSH_PWC 1
@@ -454,3 +454,44 @@ void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,
454 else 454 else
455 radix__flush_tlb_page_psize(mm, address, mmu_virtual_psize); 455 radix__flush_tlb_page_psize(mm, address, mmu_virtual_psize);
456} 456}
457
458#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
459extern void radix_kvm_prefetch_workaround(struct mm_struct *mm)
460{
461 unsigned int pid = mm->context.id;
462
463 if (unlikely(pid == MMU_NO_CONTEXT))
464 return;
465
466 /*
467 * If this context hasn't run on that CPU before and KVM is
468 * around, there's a slim chance that the guest on another
469 * CPU just brought in obsolete translation into the TLB of
470 * this CPU due to a bad prefetch using the guest PID on
471 * the way into the hypervisor.
472 *
473 * We work around this here. If KVM is possible, we check if
474 * any sibling thread is in KVM. If it is, the window may exist
475 * and thus we flush that PID from the core.
476 *
477 * A potential future improvement would be to mark which PIDs
478 * have never been used on the system and avoid it if the PID
479 * is new and the process has no other cpumask bit set.
480 */
481 if (cpu_has_feature(CPU_FTR_HVMODE) && radix_enabled()) {
482 int cpu = smp_processor_id();
483 int sib = cpu_first_thread_sibling(cpu);
484 bool flush = false;
485
486 for (; sib <= cpu_last_thread_sibling(cpu) && !flush; sib++) {
487 if (sib == cpu)
488 continue;
489 if (paca[sib].kvm_hstate.kvm_vcpu)
490 flush = true;
491 }
492 if (flush)
493 _tlbiel_pid(pid, RIC_FLUSH_ALL);
494 }
495}
496EXPORT_SYMBOL_GPL(radix_kvm_prefetch_workaround);
497#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 9b87abb178f0..cad6b57ce494 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -78,7 +78,7 @@ void opal_configure_cores(void)
78 * ie. Host hash supports hash guests 78 * ie. Host hash supports hash guests
79 * Host radix supports hash/radix guests 79 * Host radix supports hash/radix guests
80 */ 80 */
81 if (cpu_has_feature(CPU_FTR_ARCH_300)) { 81 if (early_cpu_has_feature(CPU_FTR_ARCH_300)) {
82 reinit_flags |= OPAL_REINIT_CPUS_MMU_HASH; 82 reinit_flags |= OPAL_REINIT_CPUS_MMU_HASH;
83 if (early_radix_enabled()) 83 if (early_radix_enabled())
84 reinit_flags |= OPAL_REINIT_CPUS_MMU_RADIX; 84 reinit_flags |= OPAL_REINIT_CPUS_MMU_RADIX;
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index e5bf1e84047f..011ef2180fe6 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -82,7 +82,6 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
82 82
83 of_detach_node(np); 83 of_detach_node(np);
84 of_node_put(parent); 84 of_node_put(parent);
85 of_node_put(np); /* Must decrement the refcount */
86 return 0; 85 return 0;
87} 86}
88 87
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index 1bbd9dbfe4e0..ce9cc123988b 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -14,7 +14,7 @@
14 ".section .rodata.str,\"aMS\",@progbits,1\n" \ 14 ".section .rodata.str,\"aMS\",@progbits,1\n" \
15 "2: .asciz \""__FILE__"\"\n" \ 15 "2: .asciz \""__FILE__"\"\n" \
16 ".previous\n" \ 16 ".previous\n" \
17 ".section __bug_table,\"a\"\n" \ 17 ".section __bug_table,\"aw\"\n" \
18 "3: .long 1b-3b,2b-3b\n" \ 18 "3: .long 1b-3b,2b-3b\n" \
19 " .short %0,%1\n" \ 19 " .short %0,%1\n" \
20 " .org 3b+%2\n" \ 20 " .org 3b+%2\n" \
@@ -30,7 +30,7 @@
30 asm volatile( \ 30 asm volatile( \
31 "0: j 0b+2\n" \ 31 "0: j 0b+2\n" \
32 "1:\n" \ 32 "1:\n" \
33 ".section __bug_table,\"a\"\n" \ 33 ".section __bug_table,\"aw\"\n" \
34 "2: .long 1b-2b\n" \ 34 "2: .long 1b-2b\n" \
35 " .short %0\n" \ 35 " .short %0\n" \
36 " .org 2b+%1\n" \ 36 " .org 2b+%1\n" \
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 0c82f7903fc7..c1bf75ffb875 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -998,7 +998,7 @@ static int perf_push_sample(struct perf_event *event, struct sf_raw_sample *sfr)
998 psw_bits(regs.psw).ia = sfr->basic.ia; 998 psw_bits(regs.psw).ia = sfr->basic.ia;
999 psw_bits(regs.psw).dat = sfr->basic.T; 999 psw_bits(regs.psw).dat = sfr->basic.T;
1000 psw_bits(regs.psw).wait = sfr->basic.W; 1000 psw_bits(regs.psw).wait = sfr->basic.W;
1001 psw_bits(regs.psw).per = sfr->basic.P; 1001 psw_bits(regs.psw).pstate = sfr->basic.P;
1002 psw_bits(regs.psw).as = sfr->basic.AS; 1002 psw_bits(regs.psw).as = sfr->basic.AS;
1003 1003
1004 /* 1004 /*
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 3f2884e99ed4..af09d3437631 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1324,7 +1324,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
1324{ 1324{
1325 uint8_t *keys; 1325 uint8_t *keys;
1326 uint64_t hva; 1326 uint64_t hva;
1327 int i, r = 0; 1327 int srcu_idx, i, r = 0;
1328 1328
1329 if (args->flags != 0) 1329 if (args->flags != 0)
1330 return -EINVAL; 1330 return -EINVAL;
@@ -1342,6 +1342,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
1342 return -ENOMEM; 1342 return -ENOMEM;
1343 1343
1344 down_read(&current->mm->mmap_sem); 1344 down_read(&current->mm->mmap_sem);
1345 srcu_idx = srcu_read_lock(&kvm->srcu);
1345 for (i = 0; i < args->count; i++) { 1346 for (i = 0; i < args->count; i++) {
1346 hva = gfn_to_hva(kvm, args->start_gfn + i); 1347 hva = gfn_to_hva(kvm, args->start_gfn + i);
1347 if (kvm_is_error_hva(hva)) { 1348 if (kvm_is_error_hva(hva)) {
@@ -1353,6 +1354,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
1353 if (r) 1354 if (r)
1354 break; 1355 break;
1355 } 1356 }
1357 srcu_read_unlock(&kvm->srcu, srcu_idx);
1356 up_read(&current->mm->mmap_sem); 1358 up_read(&current->mm->mmap_sem);
1357 1359
1358 if (!r) { 1360 if (!r) {
@@ -1370,7 +1372,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
1370{ 1372{
1371 uint8_t *keys; 1373 uint8_t *keys;
1372 uint64_t hva; 1374 uint64_t hva;
1373 int i, r = 0; 1375 int srcu_idx, i, r = 0;
1374 1376
1375 if (args->flags != 0) 1377 if (args->flags != 0)
1376 return -EINVAL; 1378 return -EINVAL;
@@ -1396,6 +1398,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
1396 goto out; 1398 goto out;
1397 1399
1398 down_read(&current->mm->mmap_sem); 1400 down_read(&current->mm->mmap_sem);
1401 srcu_idx = srcu_read_lock(&kvm->srcu);
1399 for (i = 0; i < args->count; i++) { 1402 for (i = 0; i < args->count; i++) {
1400 hva = gfn_to_hva(kvm, args->start_gfn + i); 1403 hva = gfn_to_hva(kvm, args->start_gfn + i);
1401 if (kvm_is_error_hva(hva)) { 1404 if (kvm_is_error_hva(hva)) {
@@ -1413,6 +1416,7 @@ static long kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
1413 if (r) 1416 if (r)
1414 break; 1417 break;
1415 } 1418 }
1419 srcu_read_unlock(&kvm->srcu, srcu_idx);
1416 up_read(&current->mm->mmap_sem); 1420 up_read(&current->mm->mmap_sem);
1417out: 1421out:
1418 kvfree(keys); 1422 kvfree(keys);
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index d4d409ba206b..4a1f7366b17a 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -591,11 +591,11 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
591 unsigned long ptev; 591 unsigned long ptev;
592 pgste_t pgste; 592 pgste_t pgste;
593 593
594 /* Clear storage key */ 594 /* Clear storage key ACC and F, but set R/C */
595 preempt_disable(); 595 preempt_disable();
596 pgste = pgste_get_lock(ptep); 596 pgste = pgste_get_lock(ptep);
597 pgste_val(pgste) &= ~(PGSTE_ACC_BITS | PGSTE_FP_BIT | 597 pgste_val(pgste) &= ~(PGSTE_ACC_BITS | PGSTE_FP_BIT);
598 PGSTE_GR_BIT | PGSTE_GC_BIT); 598 pgste_val(pgste) |= PGSTE_GR_BIT | PGSTE_GC_BIT;
599 ptev = pte_val(*ptep); 599 ptev = pte_val(*ptep);
600 if (!(ptev & _PAGE_INVALID) && (ptev & _PAGE_WRITE)) 600 if (!(ptev & _PAGE_INVALID) && (ptev & _PAGE_WRITE))
601 page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 1); 601 page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 1);
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index c9828f785ca0..5b5086367639 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -24,14 +24,14 @@
24 */ 24 */
25#ifdef CONFIG_DEBUG_BUGVERBOSE 25#ifdef CONFIG_DEBUG_BUGVERBOSE
26#define _EMIT_BUG_ENTRY \ 26#define _EMIT_BUG_ENTRY \
27 "\t.pushsection __bug_table,\"a\"\n" \ 27 "\t.pushsection __bug_table,\"aw\"\n" \
28 "2:\t.long 1b, %O1\n" \ 28 "2:\t.long 1b, %O1\n" \
29 "\t.short %O2, %O3\n" \ 29 "\t.short %O2, %O3\n" \
30 "\t.org 2b+%O4\n" \ 30 "\t.org 2b+%O4\n" \
31 "\t.popsection\n" 31 "\t.popsection\n"
32#else 32#else
33#define _EMIT_BUG_ENTRY \ 33#define _EMIT_BUG_ENTRY \
34 "\t.pushsection __bug_table,\"a\"\n" \ 34 "\t.pushsection __bug_table,\"aw\"\n" \
35 "2:\t.long 1b\n" \ 35 "2:\t.long 1b\n" \
36 "\t.short %O3\n" \ 36 "\t.short %O3\n" \
37 "\t.org 2b+%O4\n" \ 37 "\t.org 2b+%O4\n" \
diff --git a/arch/sh/include/uapi/asm/ioctls.h b/arch/sh/include/uapi/asm/ioctls.h
index eec7901e9e65..787bac9f67da 100644
--- a/arch/sh/include/uapi/asm/ioctls.h
+++ b/arch/sh/include/uapi/asm/ioctls.h
@@ -93,7 +93,7 @@
93#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 93#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
94#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 94#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
95#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 95#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
96#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 96#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
97 97
98#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */ 98#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
99#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */ 99#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h
index ec9c04de3664..ff05992dae7a 100644
--- a/arch/sparc/include/asm/trap_block.h
+++ b/arch/sparc/include/asm/trap_block.h
@@ -54,6 +54,7 @@ extern struct trap_per_cpu trap_block[NR_CPUS];
54void init_cur_cpu_trap(struct thread_info *); 54void init_cur_cpu_trap(struct thread_info *);
55void setup_tba(void); 55void setup_tba(void);
56extern int ncpus_probed; 56extern int ncpus_probed;
57extern u64 cpu_mondo_counter[NR_CPUS];
57 58
58unsigned long real_hard_smp_processor_id(void); 59unsigned long real_hard_smp_processor_id(void);
59 60
diff --git a/arch/sparc/include/uapi/asm/ioctls.h b/arch/sparc/include/uapi/asm/ioctls.h
index 6d27398632ea..f5df72b93bb2 100644
--- a/arch/sparc/include/uapi/asm/ioctls.h
+++ b/arch/sparc/include/uapi/asm/ioctls.h
@@ -88,7 +88,7 @@
88#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */ 88#define TIOCGPTN _IOR('t', 134, unsigned int) /* Get Pty Number */
89#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */ 89#define TIOCSPTLCK _IOW('t', 135, int) /* Lock/unlock PTY */
90#define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */ 90#define TIOCSIG _IOW('t', 136, int) /* Generate signal on Pty slave */
91#define TIOCGPTPEER _IOR('t', 137, int) /* Safely open the slave */ 91#define TIOCGPTPEER _IO('t', 137) /* Safely open the slave */
92 92
93/* Little f */ 93/* Little f */
94#define FIOCLEX _IO('f', 1) 94#define FIOCLEX _IO('f', 1)
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index 24f21c726dfa..f10e2f712394 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -673,12 +673,14 @@ static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
673static int dma_4v_supported(struct device *dev, u64 device_mask) 673static int dma_4v_supported(struct device *dev, u64 device_mask)
674{ 674{
675 struct iommu *iommu = dev->archdata.iommu; 675 struct iommu *iommu = dev->archdata.iommu;
676 u64 dma_addr_mask; 676 u64 dma_addr_mask = iommu->dma_addr_mask;
677 677
678 if (device_mask > DMA_BIT_MASK(32) && iommu->atu) 678 if (device_mask > DMA_BIT_MASK(32)) {
679 dma_addr_mask = iommu->atu->dma_addr_mask; 679 if (iommu->atu)
680 else 680 dma_addr_mask = iommu->atu->dma_addr_mask;
681 dma_addr_mask = iommu->dma_addr_mask; 681 else
682 return 0;
683 }
682 684
683 if ((device_mask & dma_addr_mask) == dma_addr_mask) 685 if ((device_mask & dma_addr_mask) == dma_addr_mask)
684 return 1; 686 return 1;
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index fdf31040a7dc..3218bc43302e 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -622,22 +622,48 @@ retry:
622 } 622 }
623} 623}
624 624
625/* Multi-cpu list version. */ 625#define CPU_MONDO_COUNTER(cpuid) (cpu_mondo_counter[cpuid])
626#define MONDO_USEC_WAIT_MIN 2
627#define MONDO_USEC_WAIT_MAX 100
628#define MONDO_RETRY_LIMIT 500000
629
630/* Multi-cpu list version.
631 *
632 * Deliver xcalls to 'cnt' number of cpus in 'cpu_list'.
633 * Sometimes not all cpus receive the mondo, requiring us to re-send
634 * the mondo until all cpus have received, or cpus are truly stuck
635 * unable to receive mondo, and we timeout.
636 * Occasionally a target cpu strand is borrowed briefly by hypervisor to
637 * perform guest service, such as PCIe error handling. Consider the
638 * service time, 1 second overall wait is reasonable for 1 cpu.
639 * Here two in-between mondo check wait time are defined: 2 usec for
640 * single cpu quick turn around and up to 100usec for large cpu count.
641 * Deliver mondo to large number of cpus could take longer, we adjusts
642 * the retry count as long as target cpus are making forward progress.
643 */
626static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt) 644static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
627{ 645{
628 int retries, this_cpu, prev_sent, i, saw_cpu_error; 646 int this_cpu, tot_cpus, prev_sent, i, rem;
647 int usec_wait, retries, tot_retries;
648 u16 first_cpu = 0xffff;
649 unsigned long xc_rcvd = 0;
629 unsigned long status; 650 unsigned long status;
651 int ecpuerror_id = 0;
652 int enocpu_id = 0;
630 u16 *cpu_list; 653 u16 *cpu_list;
654 u16 cpu;
631 655
632 this_cpu = smp_processor_id(); 656 this_cpu = smp_processor_id();
633
634 cpu_list = __va(tb->cpu_list_pa); 657 cpu_list = __va(tb->cpu_list_pa);
635 658 usec_wait = cnt * MONDO_USEC_WAIT_MIN;
636 saw_cpu_error = 0; 659 if (usec_wait > MONDO_USEC_WAIT_MAX)
637 retries = 0; 660 usec_wait = MONDO_USEC_WAIT_MAX;
661 retries = tot_retries = 0;
662 tot_cpus = cnt;
638 prev_sent = 0; 663 prev_sent = 0;
664
639 do { 665 do {
640 int forward_progress, n_sent; 666 int n_sent, mondo_delivered, target_cpu_busy;
641 667
642 status = sun4v_cpu_mondo_send(cnt, 668 status = sun4v_cpu_mondo_send(cnt,
643 tb->cpu_list_pa, 669 tb->cpu_list_pa,
@@ -645,94 +671,113 @@ static void hypervisor_xcall_deliver(struct trap_per_cpu *tb, int cnt)
645 671
646 /* HV_EOK means all cpus received the xcall, we're done. */ 672 /* HV_EOK means all cpus received the xcall, we're done. */
647 if (likely(status == HV_EOK)) 673 if (likely(status == HV_EOK))
648 break; 674 goto xcall_done;
675
676 /* If not these non-fatal errors, panic */
677 if (unlikely((status != HV_EWOULDBLOCK) &&
678 (status != HV_ECPUERROR) &&
679 (status != HV_ENOCPU)))
680 goto fatal_errors;
649 681
650 /* First, see if we made any forward progress. 682 /* First, see if we made any forward progress.
651 * 683 *
684 * Go through the cpu_list, count the target cpus that have
685 * received our mondo (n_sent), and those that did not (rem).
686 * Re-pack cpu_list with the cpus remain to be retried in the
687 * front - this simplifies tracking the truly stalled cpus.
688 *
652 * The hypervisor indicates successful sends by setting 689 * The hypervisor indicates successful sends by setting
653 * cpu list entries to the value 0xffff. 690 * cpu list entries to the value 0xffff.
691 *
692 * EWOULDBLOCK means some target cpus did not receive the
693 * mondo and retry usually helps.
694 *
695 * ECPUERROR means at least one target cpu is in error state,
696 * it's usually safe to skip the faulty cpu and retry.
697 *
698 * ENOCPU means one of the target cpu doesn't belong to the
699 * domain, perhaps offlined which is unexpected, but not
700 * fatal and it's okay to skip the offlined cpu.
654 */ 701 */
702 rem = 0;
655 n_sent = 0; 703 n_sent = 0;
656 for (i = 0; i < cnt; i++) { 704 for (i = 0; i < cnt; i++) {
657 if (likely(cpu_list[i] == 0xffff)) 705 cpu = cpu_list[i];
706 if (likely(cpu == 0xffff)) {
658 n_sent++; 707 n_sent++;
708 } else if ((status == HV_ECPUERROR) &&
709 (sun4v_cpu_state(cpu) == HV_CPU_STATE_ERROR)) {
710 ecpuerror_id = cpu + 1;
711 } else if (status == HV_ENOCPU && !cpu_online(cpu)) {
712 enocpu_id = cpu + 1;
713 } else {
714 cpu_list[rem++] = cpu;
715 }
659 } 716 }
660 717
661 forward_progress = 0; 718 /* No cpu remained, we're done. */
662 if (n_sent > prev_sent) 719 if (rem == 0)
663 forward_progress = 1; 720 break;
664 721
665 prev_sent = n_sent; 722 /* Otherwise, update the cpu count for retry. */
723 cnt = rem;
666 724
667 /* If we get a HV_ECPUERROR, then one or more of the cpus 725 /* Record the overall number of mondos received by the
668 * in the list are in error state. Use the cpu_state() 726 * first of the remaining cpus.
669 * hypervisor call to find out which cpus are in error state.
670 */ 727 */
671 if (unlikely(status == HV_ECPUERROR)) { 728 if (first_cpu != cpu_list[0]) {
672 for (i = 0; i < cnt; i++) { 729 first_cpu = cpu_list[0];
673 long err; 730 xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
674 u16 cpu; 731 }
675 732
676 cpu = cpu_list[i]; 733 /* Was any mondo delivered successfully? */
677 if (cpu == 0xffff) 734 mondo_delivered = (n_sent > prev_sent);
678 continue; 735 prev_sent = n_sent;
679 736
680 err = sun4v_cpu_state(cpu); 737 /* or, was any target cpu busy processing other mondos? */
681 if (err == HV_CPU_STATE_ERROR) { 738 target_cpu_busy = (xc_rcvd < CPU_MONDO_COUNTER(first_cpu));
682 saw_cpu_error = (cpu + 1); 739 xc_rcvd = CPU_MONDO_COUNTER(first_cpu);
683 cpu_list[i] = 0xffff;
684 }
685 }
686 } else if (unlikely(status != HV_EWOULDBLOCK))
687 goto fatal_mondo_error;
688 740
689 /* Don't bother rewriting the CPU list, just leave the 741 /* Retry count is for no progress. If we're making progress,
690 * 0xffff and non-0xffff entries in there and the 742 * reset the retry count.
691 * hypervisor will do the right thing.
692 *
693 * Only advance timeout state if we didn't make any
694 * forward progress.
695 */ 743 */
696 if (unlikely(!forward_progress)) { 744 if (likely(mondo_delivered || target_cpu_busy)) {
697 if (unlikely(++retries > 10000)) 745 tot_retries += retries;
698 goto fatal_mondo_timeout; 746 retries = 0;
699 747 } else if (unlikely(retries > MONDO_RETRY_LIMIT)) {
700 /* Delay a little bit to let other cpus catch up 748 goto fatal_mondo_timeout;
701 * on their cpu mondo queue work.
702 */
703 udelay(2 * cnt);
704 } 749 }
705 } while (1);
706 750
707 if (unlikely(saw_cpu_error)) 751 /* Delay a little bit to let other cpus catch up on
708 goto fatal_mondo_cpu_error; 752 * their cpu mondo queue work.
753 */
754 if (!mondo_delivered)
755 udelay(usec_wait);
709 756
710 return; 757 retries++;
758 } while (1);
711 759
712fatal_mondo_cpu_error: 760xcall_done:
713 printk(KERN_CRIT "CPU[%d]: SUN4V mondo cpu error, some target cpus " 761 if (unlikely(ecpuerror_id > 0)) {
714 "(including %d) were in error state\n", 762 pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) was in error state\n",
715 this_cpu, saw_cpu_error - 1); 763 this_cpu, ecpuerror_id - 1);
764 } else if (unlikely(enocpu_id > 0)) {
765 pr_crit("CPU[%d]: SUN4V mondo cpu error, target cpu(%d) does not belong to the domain\n",
766 this_cpu, enocpu_id - 1);
767 }
716 return; 768 return;
717 769
770fatal_errors:
771 /* fatal errors include bad alignment, etc */
772 pr_crit("CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) mondo_block_pa(%lx)\n",
773 this_cpu, tot_cpus, tb->cpu_list_pa, tb->cpu_mondo_block_pa);
774 panic("Unexpected SUN4V mondo error %lu\n", status);
775
718fatal_mondo_timeout: 776fatal_mondo_timeout:
719 printk(KERN_CRIT "CPU[%d]: SUN4V mondo timeout, no forward " 777 /* some cpus being non-responsive to the cpu mondo */
720 " progress after %d retries.\n", 778 pr_crit("CPU[%d]: SUN4V mondo timeout, cpu(%d) made no forward progress after %d retries. Total target cpus(%d).\n",
721 this_cpu, retries); 779 this_cpu, first_cpu, (tot_retries + retries), tot_cpus);
722 goto dump_cpu_list_and_out; 780 panic("SUN4V mondo timeout panic\n");
723
724fatal_mondo_error:
725 printk(KERN_CRIT "CPU[%d]: Unexpected SUN4V mondo error %lu\n",
726 this_cpu, status);
727 printk(KERN_CRIT "CPU[%d]: Args were cnt(%d) cpulist_pa(%lx) "
728 "mondo_block_pa(%lx)\n",
729 this_cpu, cnt, tb->cpu_list_pa, tb->cpu_mondo_block_pa);
730
731dump_cpu_list_and_out:
732 printk(KERN_CRIT "CPU[%d]: CPU list [ ", this_cpu);
733 for (i = 0; i < cnt; i++)
734 printk("%u ", cpu_list[i]);
735 printk("]\n");
736} 781}
737 782
738static void (*xcall_deliver_impl)(struct trap_per_cpu *, int); 783static void (*xcall_deliver_impl)(struct trap_per_cpu *, int);
diff --git a/arch/sparc/kernel/sun4v_ivec.S b/arch/sparc/kernel/sun4v_ivec.S
index 559bc5e9c199..34631995859a 100644
--- a/arch/sparc/kernel/sun4v_ivec.S
+++ b/arch/sparc/kernel/sun4v_ivec.S
@@ -26,6 +26,21 @@ sun4v_cpu_mondo:
26 ldxa [%g0] ASI_SCRATCHPAD, %g4 26 ldxa [%g0] ASI_SCRATCHPAD, %g4
27 sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4 27 sub %g4, TRAP_PER_CPU_FAULT_INFO, %g4
28 28
29 /* Get smp_processor_id() into %g3 */
30 sethi %hi(trap_block), %g5
31 or %g5, %lo(trap_block), %g5
32 sub %g4, %g5, %g3
33 srlx %g3, TRAP_BLOCK_SZ_SHIFT, %g3
34
35 /* Increment cpu_mondo_counter[smp_processor_id()] */
36 sethi %hi(cpu_mondo_counter), %g5
37 or %g5, %lo(cpu_mondo_counter), %g5
38 sllx %g3, 3, %g3
39 add %g5, %g3, %g5
40 ldx [%g5], %g3
41 add %g3, 1, %g3
42 stx %g3, [%g5]
43
29 /* Get CPU mondo queue base phys address into %g7. */ 44 /* Get CPU mondo queue base phys address into %g7. */
30 ldx [%g4 + TRAP_PER_CPU_CPU_MONDO_PA], %g7 45 ldx [%g4 + TRAP_PER_CPU_CPU_MONDO_PA], %g7
31 46
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index 196ee5eb4d48..ad31af1dd726 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -2733,6 +2733,7 @@ void do_getpsr(struct pt_regs *regs)
2733 } 2733 }
2734} 2734}
2735 2735
2736u64 cpu_mondo_counter[NR_CPUS] = {0};
2736struct trap_per_cpu trap_block[NR_CPUS]; 2737struct trap_per_cpu trap_block[NR_CPUS];
2737EXPORT_SYMBOL(trap_block); 2738EXPORT_SYMBOL(trap_block);
2738 2739
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index fcb7604172ce..cd20ca0b4043 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -348,6 +348,7 @@ config X86_DEBUG_FPU
348 348
349config PUNIT_ATOM_DEBUG 349config PUNIT_ATOM_DEBUG
350 tristate "ATOM Punit debug driver" 350 tristate "ATOM Punit debug driver"
351 depends on PCI
351 select DEBUG_FS 352 select DEBUG_FS
352 select IOSF_MBI 353 select IOSF_MBI
353 ---help--- 354 ---help---
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 0d810fb15eac..d88a2fddba8c 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -73,12 +73,13 @@ UBSAN_SANITIZE := n
73$(obj)/bzImage: asflags-y := $(SVGA_MODE) 73$(obj)/bzImage: asflags-y := $(SVGA_MODE)
74 74
75quiet_cmd_image = BUILD $@ 75quiet_cmd_image = BUILD $@
76silent_redirect_image = >/dev/null
76cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \ 77cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
77 $(obj)/zoffset.h $@ 78 $(obj)/zoffset.h $@ $($(quiet)redirect_image)
78 79
79$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE 80$(obj)/bzImage: $(obj)/setup.bin $(obj)/vmlinux.bin $(obj)/tools/build FORCE
80 $(call if_changed,image) 81 $(call if_changed,image)
81 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 82 @$(kecho) 'Kernel: $@ is ready' ' (#'`cat .version`')'
82 83
83OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S 84OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
84$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE 85$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 2c860ad4fe06..8a958274b54c 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -34,6 +34,7 @@ KBUILD_CFLAGS += $(cflags-y)
34KBUILD_CFLAGS += -mno-mmx -mno-sse 34KBUILD_CFLAGS += -mno-mmx -mno-sse
35KBUILD_CFLAGS += $(call cc-option,-ffreestanding) 35KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
36KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) 36KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
37KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
37 38
38KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ 39KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
39GCOV_PROFILE := n 40GCOV_PROFILE := n
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 630e3664906b..16f49123d747 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -16,6 +16,15 @@
16#include "ctype.h" 16#include "ctype.h"
17#include "string.h" 17#include "string.h"
18 18
19/*
20 * Undef these macros so that the functions that we provide
21 * here will have the correct names regardless of how string.h
22 * may have chosen to #define them.
23 */
24#undef memcpy
25#undef memset
26#undef memcmp
27
19int memcmp(const void *s1, const void *s2, size_t len) 28int memcmp(const void *s1, const void *s2, size_t len)
20{ 29{
21 bool diff; 30 bool diff;
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 6cf79e1a6830..0eb9f92f3717 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -1,5 +1,4 @@
1# CONFIG_64BIT is not set 1# CONFIG_64BIT is not set
2CONFIG_EXPERIMENTAL=y
3# CONFIG_LOCALVERSION_AUTO is not set 2# CONFIG_LOCALVERSION_AUTO is not set
4CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
@@ -125,7 +124,6 @@ CONFIG_NF_CONNTRACK_IPV4=y
125CONFIG_IP_NF_IPTABLES=y 124CONFIG_IP_NF_IPTABLES=y
126CONFIG_IP_NF_FILTER=y 125CONFIG_IP_NF_FILTER=y
127CONFIG_IP_NF_TARGET_REJECT=y 126CONFIG_IP_NF_TARGET_REJECT=y
128CONFIG_IP_NF_TARGET_ULOG=y
129CONFIG_NF_NAT=y 127CONFIG_NF_NAT=y
130CONFIG_IP_NF_TARGET_MASQUERADE=y 128CONFIG_IP_NF_TARGET_MASQUERADE=y
131CONFIG_IP_NF_MANGLE=y 129CONFIG_IP_NF_MANGLE=y
@@ -255,7 +253,6 @@ CONFIG_USB_OHCI_HCD=y
255CONFIG_USB_UHCI_HCD=y 253CONFIG_USB_UHCI_HCD=y
256CONFIG_USB_PRINTER=y 254CONFIG_USB_PRINTER=y
257CONFIG_USB_STORAGE=y 255CONFIG_USB_STORAGE=y
258CONFIG_USB_LIBUSUAL=y
259CONFIG_EDAC=y 256CONFIG_EDAC=y
260CONFIG_RTC_CLASS=y 257CONFIG_RTC_CLASS=y
261# CONFIG_RTC_HCTOSYS is not set 258# CONFIG_RTC_HCTOSYS is not set
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index de45f57b410d..4a4b16e56d35 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2# CONFIG_LOCALVERSION_AUTO is not set 1# CONFIG_LOCALVERSION_AUTO is not set
3CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
@@ -124,7 +123,6 @@ CONFIG_NF_CONNTRACK_IPV4=y
124CONFIG_IP_NF_IPTABLES=y 123CONFIG_IP_NF_IPTABLES=y
125CONFIG_IP_NF_FILTER=y 124CONFIG_IP_NF_FILTER=y
126CONFIG_IP_NF_TARGET_REJECT=y 125CONFIG_IP_NF_TARGET_REJECT=y
127CONFIG_IP_NF_TARGET_ULOG=y
128CONFIG_NF_NAT=y 126CONFIG_NF_NAT=y
129CONFIG_IP_NF_TARGET_MASQUERADE=y 127CONFIG_IP_NF_TARGET_MASQUERADE=y
130CONFIG_IP_NF_MANGLE=y 128CONFIG_IP_NF_MANGLE=y
@@ -251,7 +249,6 @@ CONFIG_USB_OHCI_HCD=y
251CONFIG_USB_UHCI_HCD=y 249CONFIG_USB_UHCI_HCD=y
252CONFIG_USB_PRINTER=y 250CONFIG_USB_PRINTER=y
253CONFIG_USB_STORAGE=y 251CONFIG_USB_STORAGE=y
254CONFIG_USB_LIBUSUAL=y
255CONFIG_EDAC=y 252CONFIG_EDAC=y
256CONFIG_RTC_CLASS=y 253CONFIG_RTC_CLASS=y
257# CONFIG_RTC_HCTOSYS is not set 254# CONFIG_RTC_HCTOSYS is not set
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
index a9a8027a6c0e..d271fb79248f 100644
--- a/arch/x86/entry/entry_64.S
+++ b/arch/x86/entry/entry_64.S
@@ -705,6 +705,7 @@ apicinterrupt X86_PLATFORM_IPI_VECTOR x86_platform_ipi smp_x86_platform_ipi
705#ifdef CONFIG_HAVE_KVM 705#ifdef CONFIG_HAVE_KVM
706apicinterrupt3 POSTED_INTR_VECTOR kvm_posted_intr_ipi smp_kvm_posted_intr_ipi 706apicinterrupt3 POSTED_INTR_VECTOR kvm_posted_intr_ipi smp_kvm_posted_intr_ipi
707apicinterrupt3 POSTED_INTR_WAKEUP_VECTOR kvm_posted_intr_wakeup_ipi smp_kvm_posted_intr_wakeup_ipi 707apicinterrupt3 POSTED_INTR_WAKEUP_VECTOR kvm_posted_intr_wakeup_ipi smp_kvm_posted_intr_wakeup_ipi
708apicinterrupt3 POSTED_INTR_NESTED_VECTOR kvm_posted_intr_nested_ipi smp_kvm_posted_intr_nested_ipi
708#endif 709#endif
709 710
710#ifdef CONFIG_X86_MCE_THRESHOLD 711#ifdef CONFIG_X86_MCE_THRESHOLD
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index ff1ea2fb9705..8e3db8f642a7 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -191,8 +191,8 @@ static void release_pmc_hardware(void) {}
191 191
192static bool check_hw_exists(void) 192static bool check_hw_exists(void)
193{ 193{
194 u64 val, val_fail, val_new= ~0; 194 u64 val, val_fail = -1, val_new= ~0;
195 int i, reg, reg_fail, ret = 0; 195 int i, reg, reg_fail = -1, ret = 0;
196 int bios_fail = 0; 196 int bios_fail = 0;
197 int reg_safe = -1; 197 int reg_safe = -1;
198 198
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index aa62437d1aa1..98b0f0729527 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -1708,6 +1708,120 @@ static __initconst const u64 glm_hw_cache_extra_regs
1708 }, 1708 },
1709}; 1709};
1710 1710
1711static __initconst const u64 glp_hw_cache_event_ids
1712 [PERF_COUNT_HW_CACHE_MAX]
1713 [PERF_COUNT_HW_CACHE_OP_MAX]
1714 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
1715 [C(L1D)] = {
1716 [C(OP_READ)] = {
1717 [C(RESULT_ACCESS)] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */
1718 [C(RESULT_MISS)] = 0x0,
1719 },
1720 [C(OP_WRITE)] = {
1721 [C(RESULT_ACCESS)] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */
1722 [C(RESULT_MISS)] = 0x0,
1723 },
1724 [C(OP_PREFETCH)] = {
1725 [C(RESULT_ACCESS)] = 0x0,
1726 [C(RESULT_MISS)] = 0x0,
1727 },
1728 },
1729 [C(L1I)] = {
1730 [C(OP_READ)] = {
1731 [C(RESULT_ACCESS)] = 0x0380, /* ICACHE.ACCESSES */
1732 [C(RESULT_MISS)] = 0x0280, /* ICACHE.MISSES */
1733 },
1734 [C(OP_WRITE)] = {
1735 [C(RESULT_ACCESS)] = -1,
1736 [C(RESULT_MISS)] = -1,
1737 },
1738 [C(OP_PREFETCH)] = {
1739 [C(RESULT_ACCESS)] = 0x0,
1740 [C(RESULT_MISS)] = 0x0,
1741 },
1742 },
1743 [C(LL)] = {
1744 [C(OP_READ)] = {
1745 [C(RESULT_ACCESS)] = 0x1b7, /* OFFCORE_RESPONSE */
1746 [C(RESULT_MISS)] = 0x1b7, /* OFFCORE_RESPONSE */
1747 },
1748 [C(OP_WRITE)] = {
1749 [C(RESULT_ACCESS)] = 0x1b7, /* OFFCORE_RESPONSE */
1750 [C(RESULT_MISS)] = 0x1b7, /* OFFCORE_RESPONSE */
1751 },
1752 [C(OP_PREFETCH)] = {
1753 [C(RESULT_ACCESS)] = 0x0,
1754 [C(RESULT_MISS)] = 0x0,
1755 },
1756 },
1757 [C(DTLB)] = {
1758 [C(OP_READ)] = {
1759 [C(RESULT_ACCESS)] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */
1760 [C(RESULT_MISS)] = 0xe08, /* DTLB_LOAD_MISSES.WALK_COMPLETED */
1761 },
1762 [C(OP_WRITE)] = {
1763 [C(RESULT_ACCESS)] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */
1764 [C(RESULT_MISS)] = 0xe49, /* DTLB_STORE_MISSES.WALK_COMPLETED */
1765 },
1766 [C(OP_PREFETCH)] = {
1767 [C(RESULT_ACCESS)] = 0x0,
1768 [C(RESULT_MISS)] = 0x0,
1769 },
1770 },
1771 [C(ITLB)] = {
1772 [C(OP_READ)] = {
1773 [C(RESULT_ACCESS)] = 0x00c0, /* INST_RETIRED.ANY_P */
1774 [C(RESULT_MISS)] = 0x0481, /* ITLB.MISS */
1775 },
1776 [C(OP_WRITE)] = {
1777 [C(RESULT_ACCESS)] = -1,
1778 [C(RESULT_MISS)] = -1,
1779 },
1780 [C(OP_PREFETCH)] = {
1781 [C(RESULT_ACCESS)] = -1,
1782 [C(RESULT_MISS)] = -1,
1783 },
1784 },
1785 [C(BPU)] = {
1786 [C(OP_READ)] = {
1787 [C(RESULT_ACCESS)] = 0x00c4, /* BR_INST_RETIRED.ALL_BRANCHES */
1788 [C(RESULT_MISS)] = 0x00c5, /* BR_MISP_RETIRED.ALL_BRANCHES */
1789 },
1790 [C(OP_WRITE)] = {
1791 [C(RESULT_ACCESS)] = -1,
1792 [C(RESULT_MISS)] = -1,
1793 },
1794 [C(OP_PREFETCH)] = {
1795 [C(RESULT_ACCESS)] = -1,
1796 [C(RESULT_MISS)] = -1,
1797 },
1798 },
1799};
1800
1801static __initconst const u64 glp_hw_cache_extra_regs
1802 [PERF_COUNT_HW_CACHE_MAX]
1803 [PERF_COUNT_HW_CACHE_OP_MAX]
1804 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
1805 [C(LL)] = {
1806 [C(OP_READ)] = {
1807 [C(RESULT_ACCESS)] = GLM_DEMAND_READ|
1808 GLM_LLC_ACCESS,
1809 [C(RESULT_MISS)] = GLM_DEMAND_READ|
1810 GLM_LLC_MISS,
1811 },
1812 [C(OP_WRITE)] = {
1813 [C(RESULT_ACCESS)] = GLM_DEMAND_WRITE|
1814 GLM_LLC_ACCESS,
1815 [C(RESULT_MISS)] = GLM_DEMAND_WRITE|
1816 GLM_LLC_MISS,
1817 },
1818 [C(OP_PREFETCH)] = {
1819 [C(RESULT_ACCESS)] = 0x0,
1820 [C(RESULT_MISS)] = 0x0,
1821 },
1822 },
1823};
1824
1711#define KNL_OT_L2_HITE BIT_ULL(19) /* Other Tile L2 Hit */ 1825#define KNL_OT_L2_HITE BIT_ULL(19) /* Other Tile L2 Hit */
1712#define KNL_OT_L2_HITF BIT_ULL(20) /* Other Tile L2 Hit */ 1826#define KNL_OT_L2_HITF BIT_ULL(20) /* Other Tile L2 Hit */
1713#define KNL_MCDRAM_LOCAL BIT_ULL(21) 1827#define KNL_MCDRAM_LOCAL BIT_ULL(21)
@@ -3016,6 +3130,9 @@ static int hsw_hw_config(struct perf_event *event)
3016 return 0; 3130 return 0;
3017} 3131}
3018 3132
3133static struct event_constraint counter0_constraint =
3134 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1);
3135
3019static struct event_constraint counter2_constraint = 3136static struct event_constraint counter2_constraint =
3020 EVENT_CONSTRAINT(0, 0x4, 0); 3137 EVENT_CONSTRAINT(0, 0x4, 0);
3021 3138
@@ -3037,6 +3154,21 @@ hsw_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
3037 return c; 3154 return c;
3038} 3155}
3039 3156
3157static struct event_constraint *
3158glp_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
3159 struct perf_event *event)
3160{
3161 struct event_constraint *c;
3162
3163 /* :ppp means to do reduced skid PEBS which is PMC0 only. */
3164 if (event->attr.precise_ip == 3)
3165 return &counter0_constraint;
3166
3167 c = intel_get_event_constraints(cpuc, idx, event);
3168
3169 return c;
3170}
3171
3040/* 3172/*
3041 * Broadwell: 3173 * Broadwell:
3042 * 3174 *
@@ -3265,10 +3397,8 @@ static void intel_pmu_cpu_dying(int cpu)
3265static void intel_pmu_sched_task(struct perf_event_context *ctx, 3397static void intel_pmu_sched_task(struct perf_event_context *ctx,
3266 bool sched_in) 3398 bool sched_in)
3267{ 3399{
3268 if (x86_pmu.pebs_active) 3400 intel_pmu_pebs_sched_task(ctx, sched_in);
3269 intel_pmu_pebs_sched_task(ctx, sched_in); 3401 intel_pmu_lbr_sched_task(ctx, sched_in);
3270 if (x86_pmu.lbr_nr)
3271 intel_pmu_lbr_sched_task(ctx, sched_in);
3272} 3402}
3273 3403
3274PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); 3404PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63");
@@ -3838,6 +3968,32 @@ __init int intel_pmu_init(void)
3838 pr_cont("Goldmont events, "); 3968 pr_cont("Goldmont events, ");
3839 break; 3969 break;
3840 3970
3971 case INTEL_FAM6_ATOM_GEMINI_LAKE:
3972 memcpy(hw_cache_event_ids, glp_hw_cache_event_ids,
3973 sizeof(hw_cache_event_ids));
3974 memcpy(hw_cache_extra_regs, glp_hw_cache_extra_regs,
3975 sizeof(hw_cache_extra_regs));
3976
3977 intel_pmu_lbr_init_skl();
3978
3979 x86_pmu.event_constraints = intel_slm_event_constraints;
3980 x86_pmu.pebs_constraints = intel_glp_pebs_event_constraints;
3981 x86_pmu.extra_regs = intel_glm_extra_regs;
3982 /*
3983 * It's recommended to use CPU_CLK_UNHALTED.CORE_P + NPEBS
3984 * for precise cycles.
3985 */
3986 x86_pmu.pebs_aliases = NULL;
3987 x86_pmu.pebs_prec_dist = true;
3988 x86_pmu.lbr_pt_coexist = true;
3989 x86_pmu.flags |= PMU_FL_HAS_RSP_1;
3990 x86_pmu.get_event_constraints = glp_get_event_constraints;
3991 x86_pmu.cpu_events = glm_events_attrs;
3992 /* Goldmont Plus has 4-wide pipeline */
3993 event_attr_td_total_slots_scale_glm.event_str = "4";
3994 pr_cont("Goldmont plus events, ");
3995 break;
3996
3841 case INTEL_FAM6_WESTMERE: 3997 case INTEL_FAM6_WESTMERE:
3842 case INTEL_FAM6_WESTMERE_EP: 3998 case INTEL_FAM6_WESTMERE_EP:
3843 case INTEL_FAM6_WESTMERE_EX: 3999 case INTEL_FAM6_WESTMERE_EX:
diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 238ae3248ba5..4cf100ff2a37 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -40,16 +40,16 @@
40 * Model specific counters: 40 * Model specific counters:
41 * MSR_CORE_C1_RES: CORE C1 Residency Counter 41 * MSR_CORE_C1_RES: CORE C1 Residency Counter
42 * perf code: 0x00 42 * perf code: 0x00
43 * Available model: SLM,AMT 43 * Available model: SLM,AMT,GLM
44 * Scope: Core (each processor core has a MSR) 44 * Scope: Core (each processor core has a MSR)
45 * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter 45 * MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter
46 * perf code: 0x01 46 * perf code: 0x01
47 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL 47 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM
48 * Scope: Core 48 * Scope: Core
49 * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter 49 * MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter
50 * perf code: 0x02 50 * perf code: 0x02
51 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW 51 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW
52 * SKL,KNL 52 * SKL,KNL,GLM
53 * Scope: Core 53 * Scope: Core
54 * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter 54 * MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter
55 * perf code: 0x03 55 * perf code: 0x03
@@ -57,16 +57,17 @@
57 * Scope: Core 57 * Scope: Core
58 * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter. 58 * MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter.
59 * perf code: 0x00 59 * perf code: 0x00
60 * Available model: SNB,IVB,HSW,BDW,SKL,KNL 60 * Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM
61 * Scope: Package (physical package) 61 * Scope: Package (physical package)
62 * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter. 62 * MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter.
63 * perf code: 0x01 63 * perf code: 0x01
64 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL 64 * Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL
65 * GLM
65 * Scope: Package (physical package) 66 * Scope: Package (physical package)
66 * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter. 67 * MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter.
67 * perf code: 0x02 68 * perf code: 0x02
68 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW 69 * Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW
69 * SKL,KNL 70 * SKL,KNL,GLM
70 * Scope: Package (physical package) 71 * Scope: Package (physical package)
71 * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter. 72 * MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter.
72 * perf code: 0x03 73 * perf code: 0x03
@@ -82,7 +83,7 @@
82 * Scope: Package (physical package) 83 * Scope: Package (physical package)
83 * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter. 84 * MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter.
84 * perf code: 0x06 85 * perf code: 0x06
85 * Available model: HSW ULT only 86 * Available model: HSW ULT, GLM
86 * Scope: Package (physical package) 87 * Scope: Package (physical package)
87 * 88 *
88 */ 89 */
@@ -504,6 +505,17 @@ static const struct cstate_model knl_cstates __initconst = {
504}; 505};
505 506
506 507
508static const struct cstate_model glm_cstates __initconst = {
509 .core_events = BIT(PERF_CSTATE_CORE_C1_RES) |
510 BIT(PERF_CSTATE_CORE_C3_RES) |
511 BIT(PERF_CSTATE_CORE_C6_RES),
512
513 .pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) |
514 BIT(PERF_CSTATE_PKG_C3_RES) |
515 BIT(PERF_CSTATE_PKG_C6_RES) |
516 BIT(PERF_CSTATE_PKG_C10_RES),
517};
518
507 519
508#define X86_CSTATES_MODEL(model, states) \ 520#define X86_CSTATES_MODEL(model, states) \
509 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) &(states) } 521 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long) &(states) }
@@ -546,6 +558,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {
546 558
547 X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNL, knl_cstates), 559 X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNL, knl_cstates),
548 X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNM, knl_cstates), 560 X86_CSTATES_MODEL(INTEL_FAM6_XEON_PHI_KNM, knl_cstates),
561
562 X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT, glm_cstates),
549 { }, 563 { },
550}; 564};
551MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match); 565MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match);
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index c6d23ffe422d..a322fed5f8ed 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -606,12 +606,6 @@ static inline void intel_pmu_drain_pebs_buffer(void)
606 x86_pmu.drain_pebs(&regs); 606 x86_pmu.drain_pebs(&regs);
607} 607}
608 608
609void intel_pmu_pebs_sched_task(struct perf_event_context *ctx, bool sched_in)
610{
611 if (!sched_in)
612 intel_pmu_drain_pebs_buffer();
613}
614
615/* 609/*
616 * PEBS 610 * PEBS
617 */ 611 */
@@ -651,6 +645,12 @@ struct event_constraint intel_glm_pebs_event_constraints[] = {
651 EVENT_CONSTRAINT_END 645 EVENT_CONSTRAINT_END
652}; 646};
653 647
648struct event_constraint intel_glp_pebs_event_constraints[] = {
649 /* Allow all events as PEBS with no flags */
650 INTEL_ALL_EVENT_CONSTRAINT(0, 0xf),
651 EVENT_CONSTRAINT_END
652};
653
654struct event_constraint intel_nehalem_pebs_event_constraints[] = { 654struct event_constraint intel_nehalem_pebs_event_constraints[] = {
655 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */ 655 INTEL_PLD_CONSTRAINT(0x100b, 0xf), /* MEM_INST_RETIRED.* */
656 INTEL_FLAGS_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 656 INTEL_FLAGS_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
@@ -816,6 +816,14 @@ static inline bool pebs_needs_sched_cb(struct cpu_hw_events *cpuc)
816 return cpuc->n_pebs && (cpuc->n_pebs == cpuc->n_large_pebs); 816 return cpuc->n_pebs && (cpuc->n_pebs == cpuc->n_large_pebs);
817} 817}
818 818
819void intel_pmu_pebs_sched_task(struct perf_event_context *ctx, bool sched_in)
820{
821 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
822
823 if (!sched_in && pebs_needs_sched_cb(cpuc))
824 intel_pmu_drain_pebs_buffer();
825}
826
819static inline void pebs_update_threshold(struct cpu_hw_events *cpuc) 827static inline void pebs_update_threshold(struct cpu_hw_events *cpuc)
820{ 828{
821 struct debug_store *ds = cpuc->ds; 829 struct debug_store *ds = cpuc->ds;
@@ -889,6 +897,8 @@ void intel_pmu_pebs_enable(struct perf_event *event)
889 if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD) { 897 if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD) {
890 ds->pebs_event_reset[hwc->idx] = 898 ds->pebs_event_reset[hwc->idx] =
891 (u64)(-hwc->sample_period) & x86_pmu.cntval_mask; 899 (u64)(-hwc->sample_period) & x86_pmu.cntval_mask;
900 } else {
901 ds->pebs_event_reset[hwc->idx] = 0;
892 } 902 }
893} 903}
894 904
diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c
index eb261656a320..955457a30197 100644
--- a/arch/x86/events/intel/lbr.c
+++ b/arch/x86/events/intel/lbr.c
@@ -380,8 +380,12 @@ static void __intel_pmu_lbr_save(struct x86_perf_task_context *task_ctx)
380 380
381void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool sched_in) 381void intel_pmu_lbr_sched_task(struct perf_event_context *ctx, bool sched_in)
382{ 382{
383 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
383 struct x86_perf_task_context *task_ctx; 384 struct x86_perf_task_context *task_ctx;
384 385
386 if (!cpuc->lbr_users)
387 return;
388
385 /* 389 /*
386 * If LBR callstack feature is enabled and the stack was saved when 390 * If LBR callstack feature is enabled and the stack was saved when
387 * the task was scheduled out, restore the stack. Otherwise flush 391 * the task was scheduled out, restore the stack. Otherwise flush
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index dae2fedc1601..4f9127644b80 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -316,7 +316,7 @@
316#define SKX_UPI_PCI_PMON_CTL0 0x350 316#define SKX_UPI_PCI_PMON_CTL0 0x350
317#define SKX_UPI_PCI_PMON_CTR0 0x318 317#define SKX_UPI_PCI_PMON_CTR0 0x318
318#define SKX_UPI_PCI_PMON_BOX_CTL 0x378 318#define SKX_UPI_PCI_PMON_BOX_CTL 0x378
319#define SKX_PMON_CTL_UMASK_EXT 0xff 319#define SKX_UPI_CTL_UMASK_EXT 0xffefff
320 320
321/* SKX M2M */ 321/* SKX M2M */
322#define SKX_M2M_PCI_PMON_CTL0 0x228 322#define SKX_M2M_PCI_PMON_CTL0 0x228
@@ -328,7 +328,7 @@ DEFINE_UNCORE_FORMAT_ATTR(event2, event, "config:0-6");
328DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21"); 328DEFINE_UNCORE_FORMAT_ATTR(event_ext, event, "config:0-7,21");
329DEFINE_UNCORE_FORMAT_ATTR(use_occ_ctr, use_occ_ctr, "config:7"); 329DEFINE_UNCORE_FORMAT_ATTR(use_occ_ctr, use_occ_ctr, "config:7");
330DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15"); 330DEFINE_UNCORE_FORMAT_ATTR(umask, umask, "config:8-15");
331DEFINE_UNCORE_FORMAT_ATTR(umask_ext, umask, "config:8-15,32-39"); 331DEFINE_UNCORE_FORMAT_ATTR(umask_ext, umask, "config:8-15,32-43,45-55");
332DEFINE_UNCORE_FORMAT_ATTR(qor, qor, "config:16"); 332DEFINE_UNCORE_FORMAT_ATTR(qor, qor, "config:16");
333DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18"); 333DEFINE_UNCORE_FORMAT_ATTR(edge, edge, "config:18");
334DEFINE_UNCORE_FORMAT_ATTR(tid_en, tid_en, "config:19"); 334DEFINE_UNCORE_FORMAT_ATTR(tid_en, tid_en, "config:19");
@@ -351,7 +351,6 @@ DEFINE_UNCORE_FORMAT_ATTR(filter_cid, filter_cid, "config1:5");
351DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8"); 351DEFINE_UNCORE_FORMAT_ATTR(filter_link, filter_link, "config1:5-8");
352DEFINE_UNCORE_FORMAT_ATTR(filter_link2, filter_link, "config1:6-8"); 352DEFINE_UNCORE_FORMAT_ATTR(filter_link2, filter_link, "config1:6-8");
353DEFINE_UNCORE_FORMAT_ATTR(filter_link3, filter_link, "config1:12"); 353DEFINE_UNCORE_FORMAT_ATTR(filter_link3, filter_link, "config1:12");
354DEFINE_UNCORE_FORMAT_ATTR(filter_link4, filter_link, "config1:9-12");
355DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17"); 354DEFINE_UNCORE_FORMAT_ATTR(filter_nid, filter_nid, "config1:10-17");
356DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47"); 355DEFINE_UNCORE_FORMAT_ATTR(filter_nid2, filter_nid, "config1:32-47");
357DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22"); 356DEFINE_UNCORE_FORMAT_ATTR(filter_state, filter_state, "config1:18-22");
@@ -3302,7 +3301,6 @@ static struct attribute *skx_uncore_cha_formats_attr[] = {
3302 &format_attr_inv.attr, 3301 &format_attr_inv.attr,
3303 &format_attr_thresh8.attr, 3302 &format_attr_thresh8.attr,
3304 &format_attr_filter_tid4.attr, 3303 &format_attr_filter_tid4.attr,
3305 &format_attr_filter_link4.attr,
3306 &format_attr_filter_state5.attr, 3304 &format_attr_filter_state5.attr,
3307 &format_attr_filter_rem.attr, 3305 &format_attr_filter_rem.attr,
3308 &format_attr_filter_loc.attr, 3306 &format_attr_filter_loc.attr,
@@ -3312,7 +3310,6 @@ static struct attribute *skx_uncore_cha_formats_attr[] = {
3312 &format_attr_filter_opc_0.attr, 3310 &format_attr_filter_opc_0.attr,
3313 &format_attr_filter_opc_1.attr, 3311 &format_attr_filter_opc_1.attr,
3314 &format_attr_filter_nc.attr, 3312 &format_attr_filter_nc.attr,
3315 &format_attr_filter_c6.attr,
3316 &format_attr_filter_isoc.attr, 3313 &format_attr_filter_isoc.attr,
3317 NULL, 3314 NULL,
3318}; 3315};
@@ -3333,8 +3330,11 @@ static struct extra_reg skx_uncore_cha_extra_regs[] = {
3333 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4), 3330 SNBEP_CBO_EVENT_EXTRA_REG(0x0534, 0xffff, 0x4),
3334 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4), 3331 SNBEP_CBO_EVENT_EXTRA_REG(0x0934, 0xffff, 0x4),
3335 SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), 3332 SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4),
3336 SNBEP_CBO_EVENT_EXTRA_REG(0x2134, 0xffff, 0x4), 3333 SNBEP_CBO_EVENT_EXTRA_REG(0x3134, 0xffff, 0x4),
3337 SNBEP_CBO_EVENT_EXTRA_REG(0x8134, 0xffff, 0x4), 3334 SNBEP_CBO_EVENT_EXTRA_REG(0x9134, 0xffff, 0x4),
3335 SNBEP_CBO_EVENT_EXTRA_REG(0x35, 0xff, 0x8),
3336 SNBEP_CBO_EVENT_EXTRA_REG(0x36, 0xff, 0x8),
3337 EVENT_EXTRA_END
3338}; 3338};
3339 3339
3340static u64 skx_cha_filter_mask(int fields) 3340static u64 skx_cha_filter_mask(int fields)
@@ -3347,6 +3347,17 @@ static u64 skx_cha_filter_mask(int fields)
3347 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LINK; 3347 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LINK;
3348 if (fields & 0x4) 3348 if (fields & 0x4)
3349 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_STATE; 3349 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_STATE;
3350 if (fields & 0x8) {
3351 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_REM;
3352 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_LOC;
3353 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_ALL_OPC;
3354 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_NM;
3355 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_NOT_NM;
3356 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_OPC0;
3357 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_OPC1;
3358 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_NC;
3359 mask |= SKX_CHA_MSR_PMON_BOX_FILTER_ISOC;
3360 }
3350 return mask; 3361 return mask;
3351} 3362}
3352 3363
@@ -3492,6 +3503,26 @@ static struct intel_uncore_type skx_uncore_irp = {
3492 .format_group = &skx_uncore_format_group, 3503 .format_group = &skx_uncore_format_group,
3493}; 3504};
3494 3505
3506static struct attribute *skx_uncore_pcu_formats_attr[] = {
3507 &format_attr_event.attr,
3508 &format_attr_umask.attr,
3509 &format_attr_edge.attr,
3510 &format_attr_inv.attr,
3511 &format_attr_thresh8.attr,
3512 &format_attr_occ_invert.attr,
3513 &format_attr_occ_edge_det.attr,
3514 &format_attr_filter_band0.attr,
3515 &format_attr_filter_band1.attr,
3516 &format_attr_filter_band2.attr,
3517 &format_attr_filter_band3.attr,
3518 NULL,
3519};
3520
3521static struct attribute_group skx_uncore_pcu_format_group = {
3522 .name = "format",
3523 .attrs = skx_uncore_pcu_formats_attr,
3524};
3525
3495static struct intel_uncore_ops skx_uncore_pcu_ops = { 3526static struct intel_uncore_ops skx_uncore_pcu_ops = {
3496 IVBEP_UNCORE_MSR_OPS_COMMON_INIT(), 3527 IVBEP_UNCORE_MSR_OPS_COMMON_INIT(),
3497 .hw_config = hswep_pcu_hw_config, 3528 .hw_config = hswep_pcu_hw_config,
@@ -3510,7 +3541,7 @@ static struct intel_uncore_type skx_uncore_pcu = {
3510 .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL, 3541 .box_ctl = HSWEP_PCU_MSR_PMON_BOX_CTL,
3511 .num_shared_regs = 1, 3542 .num_shared_regs = 1,
3512 .ops = &skx_uncore_pcu_ops, 3543 .ops = &skx_uncore_pcu_ops,
3513 .format_group = &snbep_uncore_pcu_format_group, 3544 .format_group = &skx_uncore_pcu_format_group,
3514}; 3545};
3515 3546
3516static struct intel_uncore_type *skx_msr_uncores[] = { 3547static struct intel_uncore_type *skx_msr_uncores[] = {
@@ -3603,8 +3634,8 @@ static struct intel_uncore_type skx_uncore_upi = {
3603 .perf_ctr_bits = 48, 3634 .perf_ctr_bits = 48,
3604 .perf_ctr = SKX_UPI_PCI_PMON_CTR0, 3635 .perf_ctr = SKX_UPI_PCI_PMON_CTR0,
3605 .event_ctl = SKX_UPI_PCI_PMON_CTL0, 3636 .event_ctl = SKX_UPI_PCI_PMON_CTL0,
3606 .event_mask = SNBEP_QPI_PCI_PMON_RAW_EVENT_MASK, 3637 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
3607 .event_mask_ext = SKX_PMON_CTL_UMASK_EXT, 3638 .event_mask_ext = SKX_UPI_CTL_UMASK_EXT,
3608 .box_ctl = SKX_UPI_PCI_PMON_BOX_CTL, 3639 .box_ctl = SKX_UPI_PCI_PMON_BOX_CTL,
3609 .ops = &skx_upi_uncore_pci_ops, 3640 .ops = &skx_upi_uncore_pci_ops,
3610 .format_group = &skx_upi_uncore_format_group, 3641 .format_group = &skx_upi_uncore_format_group,
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index 53728eea1bed..476aec3a4cab 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -879,6 +879,8 @@ extern struct event_constraint intel_slm_pebs_event_constraints[];
879 879
880extern struct event_constraint intel_glm_pebs_event_constraints[]; 880extern struct event_constraint intel_glm_pebs_event_constraints[];
881 881
882extern struct event_constraint intel_glp_pebs_event_constraints[];
883
882extern struct event_constraint intel_nehalem_pebs_event_constraints[]; 884extern struct event_constraint intel_nehalem_pebs_event_constraints[];
883 885
884extern struct event_constraint intel_westmere_pebs_event_constraints[]; 886extern struct event_constraint intel_westmere_pebs_event_constraints[];
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 39e702d90cdb..aa6b2023d8f8 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -35,7 +35,7 @@
35#define _BUG_FLAGS(ins, flags) \ 35#define _BUG_FLAGS(ins, flags) \
36do { \ 36do { \
37 asm volatile("1:\t" ins "\n" \ 37 asm volatile("1:\t" ins "\n" \
38 ".pushsection __bug_table,\"a\"\n" \ 38 ".pushsection __bug_table,\"aw\"\n" \
39 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ 39 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
40 "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ 40 "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \
41 "\t.word %c1" "\t# bug_entry::line\n" \ 41 "\t.word %c1" "\t# bug_entry::line\n" \
@@ -52,7 +52,7 @@ do { \
52#define _BUG_FLAGS(ins, flags) \ 52#define _BUG_FLAGS(ins, flags) \
53do { \ 53do { \
54 asm volatile("1:\t" ins "\n" \ 54 asm volatile("1:\t" ins "\n" \
55 ".pushsection __bug_table,\"a\"\n" \ 55 ".pushsection __bug_table,\"aw\"\n" \
56 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ 56 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
57 "\t.word %c0" "\t# bug_entry::flags\n" \ 57 "\t.word %c0" "\t# bug_entry::flags\n" \
58 "\t.org 2b+%c1\n" \ 58 "\t.org 2b+%c1\n" \
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
index df002992d8fd..07b06955a05d 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -25,6 +25,8 @@ BUILD_INTERRUPT3(kvm_posted_intr_ipi, POSTED_INTR_VECTOR,
25 smp_kvm_posted_intr_ipi) 25 smp_kvm_posted_intr_ipi)
26BUILD_INTERRUPT3(kvm_posted_intr_wakeup_ipi, POSTED_INTR_WAKEUP_VECTOR, 26BUILD_INTERRUPT3(kvm_posted_intr_wakeup_ipi, POSTED_INTR_WAKEUP_VECTOR,
27 smp_kvm_posted_intr_wakeup_ipi) 27 smp_kvm_posted_intr_wakeup_ipi)
28BUILD_INTERRUPT3(kvm_posted_intr_nested_ipi, POSTED_INTR_NESTED_VECTOR,
29 smp_kvm_posted_intr_nested_ipi)
28#endif 30#endif
29 31
30/* 32/*
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 9b76cd331990..ad1ed531febc 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -15,6 +15,7 @@ typedef struct {
15#ifdef CONFIG_HAVE_KVM 15#ifdef CONFIG_HAVE_KVM
16 unsigned int kvm_posted_intr_ipis; 16 unsigned int kvm_posted_intr_ipis;
17 unsigned int kvm_posted_intr_wakeup_ipis; 17 unsigned int kvm_posted_intr_wakeup_ipis;
18 unsigned int kvm_posted_intr_nested_ipis;
18#endif 19#endif
19 unsigned int x86_platform_ipis; /* arch dependent */ 20 unsigned int x86_platform_ipis; /* arch dependent */
20 unsigned int apic_perf_irqs; 21 unsigned int apic_perf_irqs;
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index b90e1053049b..d6dbafbd4207 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -30,6 +30,7 @@ extern asmlinkage void apic_timer_interrupt(void);
30extern asmlinkage void x86_platform_ipi(void); 30extern asmlinkage void x86_platform_ipi(void);
31extern asmlinkage void kvm_posted_intr_ipi(void); 31extern asmlinkage void kvm_posted_intr_ipi(void);
32extern asmlinkage void kvm_posted_intr_wakeup_ipi(void); 32extern asmlinkage void kvm_posted_intr_wakeup_ipi(void);
33extern asmlinkage void kvm_posted_intr_nested_ipi(void);
33extern asmlinkage void error_interrupt(void); 34extern asmlinkage void error_interrupt(void);
34extern asmlinkage void irq_work_interrupt(void); 35extern asmlinkage void irq_work_interrupt(void);
35 36
@@ -62,6 +63,7 @@ extern void trace_call_function_single_interrupt(void);
62#define trace_reboot_interrupt reboot_interrupt 63#define trace_reboot_interrupt reboot_interrupt
63#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi 64#define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
64#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi 65#define trace_kvm_posted_intr_wakeup_ipi kvm_posted_intr_wakeup_ipi
66#define trace_kvm_posted_intr_nested_ipi kvm_posted_intr_nested_ipi
65#endif /* CONFIG_TRACING */ 67#endif /* CONFIG_TRACING */
66 68
67#ifdef CONFIG_X86_LOCAL_APIC 69#ifdef CONFIG_X86_LOCAL_APIC
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 7afb0e2f07f4..48febf07e828 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -328,13 +328,13 @@ static inline unsigned type in##bwl##_p(int port) \
328static inline void outs##bwl(int port, const void *addr, unsigned long count) \ 328static inline void outs##bwl(int port, const void *addr, unsigned long count) \
329{ \ 329{ \
330 asm volatile("rep; outs" #bwl \ 330 asm volatile("rep; outs" #bwl \
331 : "+S"(addr), "+c"(count) : "d"(port)); \ 331 : "+S"(addr), "+c"(count) : "d"(port) : "memory"); \
332} \ 332} \
333 \ 333 \
334static inline void ins##bwl(int port, void *addr, unsigned long count) \ 334static inline void ins##bwl(int port, void *addr, unsigned long count) \
335{ \ 335{ \
336 asm volatile("rep; ins" #bwl \ 336 asm volatile("rep; ins" #bwl \
337 : "+D"(addr), "+c"(count) : "d"(port)); \ 337 : "+D"(addr), "+c"(count) : "d"(port) : "memory"); \
338} 338}
339 339
340BUILDIO(b, b, char) 340BUILDIO(b, b, char)
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 6ca9fd6234e1..aaf8d28b5d00 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -83,7 +83,6 @@
83 */ 83 */
84#define X86_PLATFORM_IPI_VECTOR 0xf7 84#define X86_PLATFORM_IPI_VECTOR 0xf7
85 85
86#define POSTED_INTR_WAKEUP_VECTOR 0xf1
87/* 86/*
88 * IRQ work vector: 87 * IRQ work vector:
89 */ 88 */
@@ -98,6 +97,8 @@
98/* Vector for KVM to deliver posted interrupt IPI */ 97/* Vector for KVM to deliver posted interrupt IPI */
99#ifdef CONFIG_HAVE_KVM 98#ifdef CONFIG_HAVE_KVM
100#define POSTED_INTR_VECTOR 0xf2 99#define POSTED_INTR_VECTOR 0xf2
100#define POSTED_INTR_WAKEUP_VECTOR 0xf1
101#define POSTED_INTR_NESTED_VECTOR 0xf0
101#endif 102#endif
102 103
103/* 104/*
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
index 34b984c60790..6cf65437b5e5 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -52,10 +52,10 @@ typedef u8 kprobe_opcode_t;
52#define flush_insn_slot(p) do { } while (0) 52#define flush_insn_slot(p) do { } while (0)
53 53
54/* optinsn template addresses */ 54/* optinsn template addresses */
55extern __visible kprobe_opcode_t optprobe_template_entry; 55extern __visible kprobe_opcode_t optprobe_template_entry[];
56extern __visible kprobe_opcode_t optprobe_template_val; 56extern __visible kprobe_opcode_t optprobe_template_val[];
57extern __visible kprobe_opcode_t optprobe_template_call; 57extern __visible kprobe_opcode_t optprobe_template_call[];
58extern __visible kprobe_opcode_t optprobe_template_end; 58extern __visible kprobe_opcode_t optprobe_template_end[];
59#define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE) 59#define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE)
60#define MAX_OPTINSN_SIZE \ 60#define MAX_OPTINSN_SIZE \
61 (((unsigned long)&optprobe_template_end - \ 61 (((unsigned long)&optprobe_template_end - \
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index ecfcb6643c9b..265c907d7d4c 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -293,7 +293,7 @@ static inline unsigned long __get_current_cr3_fast(void)
293 unsigned long cr3 = __pa(this_cpu_read(cpu_tlbstate.loaded_mm)->pgd); 293 unsigned long cr3 = __pa(this_cpu_read(cpu_tlbstate.loaded_mm)->pgd);
294 294
295 /* For now, be very restrictive about when this can be called. */ 295 /* For now, be very restrictive about when this can be called. */
296 VM_WARN_ON(in_nmi() || !in_atomic()); 296 VM_WARN_ON(in_nmi() || preemptible());
297 297
298 VM_BUG_ON(cr3 != __read_cr3()); 298 VM_BUG_ON(cr3 != __read_cr3());
299 return cr3; 299 return cr3;
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index cb976bab6299..9ffc36bfe4cd 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -84,7 +84,7 @@ struct pv_init_ops {
84 */ 84 */
85 unsigned (*patch)(u8 type, u16 clobber, void *insnbuf, 85 unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
86 unsigned long addr, unsigned len); 86 unsigned long addr, unsigned len);
87}; 87} __no_randomize_layout;
88 88
89 89
90struct pv_lazy_ops { 90struct pv_lazy_ops {
@@ -92,12 +92,12 @@ struct pv_lazy_ops {
92 void (*enter)(void); 92 void (*enter)(void);
93 void (*leave)(void); 93 void (*leave)(void);
94 void (*flush)(void); 94 void (*flush)(void);
95}; 95} __no_randomize_layout;
96 96
97struct pv_time_ops { 97struct pv_time_ops {
98 unsigned long long (*sched_clock)(void); 98 unsigned long long (*sched_clock)(void);
99 unsigned long long (*steal_clock)(int cpu); 99 unsigned long long (*steal_clock)(int cpu);
100}; 100} __no_randomize_layout;
101 101
102struct pv_cpu_ops { 102struct pv_cpu_ops {
103 /* hooks for various privileged instructions */ 103 /* hooks for various privileged instructions */
@@ -176,7 +176,7 @@ struct pv_cpu_ops {
176 176
177 void (*start_context_switch)(struct task_struct *prev); 177 void (*start_context_switch)(struct task_struct *prev);
178 void (*end_context_switch)(struct task_struct *next); 178 void (*end_context_switch)(struct task_struct *next);
179}; 179} __no_randomize_layout;
180 180
181struct pv_irq_ops { 181struct pv_irq_ops {
182 /* 182 /*
@@ -199,7 +199,7 @@ struct pv_irq_ops {
199#ifdef CONFIG_X86_64 199#ifdef CONFIG_X86_64
200 void (*adjust_exception_frame)(void); 200 void (*adjust_exception_frame)(void);
201#endif 201#endif
202}; 202} __no_randomize_layout;
203 203
204struct pv_mmu_ops { 204struct pv_mmu_ops {
205 unsigned long (*read_cr2)(void); 205 unsigned long (*read_cr2)(void);
@@ -305,7 +305,7 @@ struct pv_mmu_ops {
305 an mfn. We can tell which is which from the index. */ 305 an mfn. We can tell which is which from the index. */
306 void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx, 306 void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
307 phys_addr_t phys, pgprot_t flags); 307 phys_addr_t phys, pgprot_t flags);
308}; 308} __no_randomize_layout;
309 309
310struct arch_spinlock; 310struct arch_spinlock;
311#ifdef CONFIG_SMP 311#ifdef CONFIG_SMP
@@ -322,7 +322,7 @@ struct pv_lock_ops {
322 void (*kick)(int cpu); 322 void (*kick)(int cpu);
323 323
324 struct paravirt_callee_save vcpu_is_preempted; 324 struct paravirt_callee_save vcpu_is_preempted;
325}; 325} __no_randomize_layout;
326 326
327/* This contains all the paravirt structures: we get a convenient 327/* This contains all the paravirt structures: we get a convenient
328 * number for each function using the offset which we use to indicate 328 * number for each function using the offset which we use to indicate
@@ -334,7 +334,7 @@ struct paravirt_patch_template {
334 struct pv_irq_ops pv_irq_ops; 334 struct pv_irq_ops pv_irq_ops;
335 struct pv_mmu_ops pv_mmu_ops; 335 struct pv_mmu_ops pv_mmu_ops;
336 struct pv_lock_ops pv_lock_ops; 336 struct pv_lock_ops pv_lock_ops;
337}; 337} __no_randomize_layout;
338 338
339extern struct pv_info pv_info; 339extern struct pv_info pv_info;
340extern struct pv_init_ops pv_init_ops; 340extern struct pv_init_ops pv_init_ops;
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 6a79547e8ee0..028245e1c42b 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -129,7 +129,7 @@ struct cpuinfo_x86 {
129 /* Index into per_cpu list: */ 129 /* Index into per_cpu list: */
130 u16 cpu_index; 130 u16 cpu_index;
131 u32 microcode; 131 u32 microcode;
132}; 132} __randomize_layout;
133 133
134struct cpuid_regs { 134struct cpuid_regs {
135 u32 eax, ebx, ecx, edx; 135 u32 eax, ebx, ecx, edx;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 6bb680671088..7491e73d9253 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -347,6 +347,14 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
347 struct mpc_intsrc mp_irq; 347 struct mpc_intsrc mp_irq;
348 348
349 /* 349 /*
350 * Check bus_irq boundary.
351 */
352 if (bus_irq >= NR_IRQS_LEGACY) {
353 pr_warn("Invalid bus_irq %u for legacy override\n", bus_irq);
354 return;
355 }
356
357 /*
350 * Convert 'gsi' to 'ioapic.pin'. 358 * Convert 'gsi' to 'ioapic.pin'.
351 */ 359 */
352 ioapic = mp_find_ioapic(gsi); 360 ioapic = mp_find_ioapic(gsi);
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index b4f5f73febdb..237e9c2341c7 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2093,7 +2093,7 @@ static inline void __init check_timer(void)
2093 int idx; 2093 int idx;
2094 idx = find_irq_entry(apic1, pin1, mp_INT); 2094 idx = find_irq_entry(apic1, pin1, mp_INT);
2095 if (idx != -1 && irq_trigger(idx)) 2095 if (idx != -1 && irq_trigger(idx))
2096 unmask_ioapic_irq(irq_get_chip_data(0)); 2096 unmask_ioapic_irq(irq_get_irq_data(0));
2097 } 2097 }
2098 irq_domain_deactivate_irq(irq_data); 2098 irq_domain_deactivate_irq(irq_data);
2099 irq_domain_activate_irq(irq_data); 2099 irq_domain_activate_irq(irq_data);
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index bb5abe8f5fd4..3b9e220621f8 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -134,6 +134,7 @@ static void init_amd_k6(struct cpuinfo_x86 *c)
134 134
135 n = K6_BUG_LOOP; 135 n = K6_BUG_LOOP;
136 f_vide = vide; 136 f_vide = vide;
137 OPTIMIZER_HIDE_VAR(f_vide);
137 d = rdtsc(); 138 d = rdtsc();
138 while (n--) 139 while (n--)
139 f_vide(); 140 f_vide();
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 3fe45f84ced4..cbf1f6ba39a8 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -235,8 +235,7 @@ static void __init dtb_add_ioapic(struct device_node *dn)
235 235
236 ret = of_address_to_resource(dn, 0, &r); 236 ret = of_address_to_resource(dn, 0, &r);
237 if (ret) { 237 if (ret) {
238 printk(KERN_ERR "Can't obtain address from node %s.\n", 238 printk(KERN_ERR "Can't obtain address from device node %pOF.\n", dn);
239 dn->full_name);
240 return; 239 return;
241 } 240 }
242 mp_register_ioapic(++ioapic_id, r.start, gsi_top, &cfg); 241 mp_register_ioapic(++ioapic_id, r.start, gsi_top, &cfg);
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 4aa03c5a14c9..4ed0aba8dbc8 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -155,6 +155,12 @@ int arch_show_interrupts(struct seq_file *p, int prec)
155 seq_printf(p, "%10u ", irq_stats(j)->kvm_posted_intr_ipis); 155 seq_printf(p, "%10u ", irq_stats(j)->kvm_posted_intr_ipis);
156 seq_puts(p, " Posted-interrupt notification event\n"); 156 seq_puts(p, " Posted-interrupt notification event\n");
157 157
158 seq_printf(p, "%*s: ", prec, "NPI");
159 for_each_online_cpu(j)
160 seq_printf(p, "%10u ",
161 irq_stats(j)->kvm_posted_intr_nested_ipis);
162 seq_puts(p, " Nested posted-interrupt event\n");
163
158 seq_printf(p, "%*s: ", prec, "PIW"); 164 seq_printf(p, "%*s: ", prec, "PIW");
159 for_each_online_cpu(j) 165 for_each_online_cpu(j)
160 seq_printf(p, "%10u ", 166 seq_printf(p, "%10u ",
@@ -313,6 +319,19 @@ __visible void smp_kvm_posted_intr_wakeup_ipi(struct pt_regs *regs)
313 exiting_irq(); 319 exiting_irq();
314 set_irq_regs(old_regs); 320 set_irq_regs(old_regs);
315} 321}
322
323/*
324 * Handler for POSTED_INTERRUPT_NESTED_VECTOR.
325 */
326__visible void smp_kvm_posted_intr_nested_ipi(struct pt_regs *regs)
327{
328 struct pt_regs *old_regs = set_irq_regs(regs);
329
330 entering_ack_irq();
331 inc_irq_stat(kvm_posted_intr_nested_ipis);
332 exiting_irq();
333 set_irq_regs(old_regs);
334}
316#endif 335#endif
317 336
318__visible void __irq_entry smp_trace_x86_platform_ipi(struct pt_regs *regs) 337__visible void __irq_entry smp_trace_x86_platform_ipi(struct pt_regs *regs)
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index 7468c6987547..c7fd18526c3e 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -150,6 +150,8 @@ static void __init apic_intr_init(void)
150 alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi); 150 alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi);
151 /* IPI for KVM to deliver interrupt to wake up tasks */ 151 /* IPI for KVM to deliver interrupt to wake up tasks */
152 alloc_intr_gate(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi); 152 alloc_intr_gate(POSTED_INTR_WAKEUP_VECTOR, kvm_posted_intr_wakeup_ipi);
153 /* IPI for KVM to deliver nested posted interrupt */
154 alloc_intr_gate(POSTED_INTR_NESTED_VECTOR, kvm_posted_intr_nested_ipi);
153#endif 155#endif
154 156
155 /* IPI vectors for APIC spurious and error interrupts */ 157 /* IPI vectors for APIC spurious and error interrupts */
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 6b877807598b..f0153714ddac 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -457,6 +457,8 @@ static int arch_copy_kprobe(struct kprobe *p)
457 457
458int arch_prepare_kprobe(struct kprobe *p) 458int arch_prepare_kprobe(struct kprobe *p)
459{ 459{
460 int ret;
461
460 if (alternatives_text_reserved(p->addr, p->addr)) 462 if (alternatives_text_reserved(p->addr, p->addr))
461 return -EINVAL; 463 return -EINVAL;
462 464
@@ -467,7 +469,13 @@ int arch_prepare_kprobe(struct kprobe *p)
467 if (!p->ainsn.insn) 469 if (!p->ainsn.insn)
468 return -ENOMEM; 470 return -ENOMEM;
469 471
470 return arch_copy_kprobe(p); 472 ret = arch_copy_kprobe(p);
473 if (ret) {
474 free_insn_slot(p->ainsn.insn, 0);
475 p->ainsn.insn = NULL;
476 }
477
478 return ret;
471} 479}
472 480
473void arch_arm_kprobe(struct kprobe *p) 481void arch_arm_kprobe(struct kprobe *p)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 67393fc88353..a56bf6051f4e 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -471,12 +471,12 @@ static int __init reboot_init(void)
471 471
472 /* 472 /*
473 * The DMI quirks table takes precedence. If no quirks entry 473 * The DMI quirks table takes precedence. If no quirks entry
474 * matches and the ACPI Hardware Reduced bit is set, force EFI 474 * matches and the ACPI Hardware Reduced bit is set and EFI
475 * reboot. 475 * runtime services are enabled, force EFI reboot.
476 */ 476 */
477 rv = dmi_check_system(reboot_dmi_table); 477 rv = dmi_check_system(reboot_dmi_table);
478 478
479 if (!rv && efi_reboot_required()) 479 if (!rv && efi_reboot_required() && !efi_runtime_disabled())
480 reboot_type = BOOT_EFI; 480 reboot_type = BOOT_EFI;
481 481
482 return 0; 482 return 0;
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 760433b2574a..2688c7dc5323 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -22,7 +22,7 @@ config KVM
22 depends on HAVE_KVM 22 depends on HAVE_KVM
23 depends on HIGH_RES_TIMERS 23 depends on HIGH_RES_TIMERS
24 # for TASKSTATS/TASK_DELAY_ACCT: 24 # for TASKSTATS/TASK_DELAY_ACCT:
25 depends on NET 25 depends on NET && MULTIUSER
26 select PREEMPT_NOTIFIERS 26 select PREEMPT_NOTIFIERS
27 select MMU_NOTIFIER 27 select MMU_NOTIFIER
28 select ANON_INODES 28 select ANON_INODES
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 2695a34fa1c5..337b6d2730fa 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -649,9 +649,10 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu)
649 } 649 }
650 650
651 if ((stimer->config & HV_STIMER_ENABLE) && 651 if ((stimer->config & HV_STIMER_ENABLE) &&
652 stimer->count) 652 stimer->count) {
653 stimer_start(stimer); 653 if (!stimer->msg_pending)
654 else 654 stimer_start(stimer);
655 } else
655 stimer_cleanup(stimer); 656 stimer_cleanup(stimer);
656 } 657 }
657 } 658 }
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 2819d4c123eb..589dcc117086 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1495,11 +1495,10 @@ EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use);
1495 1495
1496static void cancel_hv_timer(struct kvm_lapic *apic) 1496static void cancel_hv_timer(struct kvm_lapic *apic)
1497{ 1497{
1498 WARN_ON(preemptible());
1498 WARN_ON(!apic->lapic_timer.hv_timer_in_use); 1499 WARN_ON(!apic->lapic_timer.hv_timer_in_use);
1499 preempt_disable();
1500 kvm_x86_ops->cancel_hv_timer(apic->vcpu); 1500 kvm_x86_ops->cancel_hv_timer(apic->vcpu);
1501 apic->lapic_timer.hv_timer_in_use = false; 1501 apic->lapic_timer.hv_timer_in_use = false;
1502 preempt_enable();
1503} 1502}
1504 1503
1505static bool start_hv_timer(struct kvm_lapic *apic) 1504static bool start_hv_timer(struct kvm_lapic *apic)
@@ -1507,6 +1506,7 @@ static bool start_hv_timer(struct kvm_lapic *apic)
1507 struct kvm_timer *ktimer = &apic->lapic_timer; 1506 struct kvm_timer *ktimer = &apic->lapic_timer;
1508 int r; 1507 int r;
1509 1508
1509 WARN_ON(preemptible());
1510 if (!kvm_x86_ops->set_hv_timer) 1510 if (!kvm_x86_ops->set_hv_timer)
1511 return false; 1511 return false;
1512 1512
@@ -1538,6 +1538,8 @@ static bool start_hv_timer(struct kvm_lapic *apic)
1538static void start_sw_timer(struct kvm_lapic *apic) 1538static void start_sw_timer(struct kvm_lapic *apic)
1539{ 1539{
1540 struct kvm_timer *ktimer = &apic->lapic_timer; 1540 struct kvm_timer *ktimer = &apic->lapic_timer;
1541
1542 WARN_ON(preemptible());
1541 if (apic->lapic_timer.hv_timer_in_use) 1543 if (apic->lapic_timer.hv_timer_in_use)
1542 cancel_hv_timer(apic); 1544 cancel_hv_timer(apic);
1543 if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending)) 1545 if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending))
@@ -1552,15 +1554,20 @@ static void start_sw_timer(struct kvm_lapic *apic)
1552 1554
1553static void restart_apic_timer(struct kvm_lapic *apic) 1555static void restart_apic_timer(struct kvm_lapic *apic)
1554{ 1556{
1557 preempt_disable();
1555 if (!start_hv_timer(apic)) 1558 if (!start_hv_timer(apic))
1556 start_sw_timer(apic); 1559 start_sw_timer(apic);
1560 preempt_enable();
1557} 1561}
1558 1562
1559void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu) 1563void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
1560{ 1564{
1561 struct kvm_lapic *apic = vcpu->arch.apic; 1565 struct kvm_lapic *apic = vcpu->arch.apic;
1562 1566
1563 WARN_ON(!apic->lapic_timer.hv_timer_in_use); 1567 preempt_disable();
1568 /* If the preempt notifier has already run, it also called apic_timer_expired */
1569 if (!apic->lapic_timer.hv_timer_in_use)
1570 goto out;
1564 WARN_ON(swait_active(&vcpu->wq)); 1571 WARN_ON(swait_active(&vcpu->wq));
1565 cancel_hv_timer(apic); 1572 cancel_hv_timer(apic);
1566 apic_timer_expired(apic); 1573 apic_timer_expired(apic);
@@ -1569,6 +1576,8 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
1569 advance_periodic_target_expiration(apic); 1576 advance_periodic_target_expiration(apic);
1570 restart_apic_timer(apic); 1577 restart_apic_timer(apic);
1571 } 1578 }
1579out:
1580 preempt_enable();
1572} 1581}
1573EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer); 1582EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer);
1574 1583
@@ -1582,9 +1591,11 @@ void kvm_lapic_switch_to_sw_timer(struct kvm_vcpu *vcpu)
1582{ 1591{
1583 struct kvm_lapic *apic = vcpu->arch.apic; 1592 struct kvm_lapic *apic = vcpu->arch.apic;
1584 1593
1594 preempt_disable();
1585 /* Possibly the TSC deadline timer is not enabled yet */ 1595 /* Possibly the TSC deadline timer is not enabled yet */
1586 if (apic->lapic_timer.hv_timer_in_use) 1596 if (apic->lapic_timer.hv_timer_in_use)
1587 start_sw_timer(apic); 1597 start_sw_timer(apic);
1598 preempt_enable();
1588} 1599}
1589EXPORT_SYMBOL_GPL(kvm_lapic_switch_to_sw_timer); 1600EXPORT_SYMBOL_GPL(kvm_lapic_switch_to_sw_timer);
1590 1601
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 84e62acf2dd8..39a6222bf968 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -198,7 +198,8 @@ struct loaded_vmcs {
198 struct vmcs *vmcs; 198 struct vmcs *vmcs;
199 struct vmcs *shadow_vmcs; 199 struct vmcs *shadow_vmcs;
200 int cpu; 200 int cpu;
201 int launched; 201 bool launched;
202 bool nmi_known_unmasked;
202 struct list_head loaded_vmcss_on_cpu_link; 203 struct list_head loaded_vmcss_on_cpu_link;
203}; 204};
204 205
@@ -562,7 +563,6 @@ struct vcpu_vmx {
562 struct kvm_vcpu vcpu; 563 struct kvm_vcpu vcpu;
563 unsigned long host_rsp; 564 unsigned long host_rsp;
564 u8 fail; 565 u8 fail;
565 bool nmi_known_unmasked;
566 u32 exit_intr_info; 566 u32 exit_intr_info;
567 u32 idt_vectoring_info; 567 u32 idt_vectoring_info;
568 ulong rflags; 568 ulong rflags;
@@ -2326,6 +2326,11 @@ static void vmx_vcpu_put(struct kvm_vcpu *vcpu)
2326 __vmx_load_host_state(to_vmx(vcpu)); 2326 __vmx_load_host_state(to_vmx(vcpu));
2327} 2327}
2328 2328
2329static bool emulation_required(struct kvm_vcpu *vcpu)
2330{
2331 return emulate_invalid_guest_state && !guest_state_valid(vcpu);
2332}
2333
2329static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu); 2334static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu);
2330 2335
2331/* 2336/*
@@ -2363,6 +2368,8 @@ static unsigned long vmx_get_rflags(struct kvm_vcpu *vcpu)
2363 2368
2364static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) 2369static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
2365{ 2370{
2371 unsigned long old_rflags = vmx_get_rflags(vcpu);
2372
2366 __set_bit(VCPU_EXREG_RFLAGS, (ulong *)&vcpu->arch.regs_avail); 2373 __set_bit(VCPU_EXREG_RFLAGS, (ulong *)&vcpu->arch.regs_avail);
2367 to_vmx(vcpu)->rflags = rflags; 2374 to_vmx(vcpu)->rflags = rflags;
2368 if (to_vmx(vcpu)->rmode.vm86_active) { 2375 if (to_vmx(vcpu)->rmode.vm86_active) {
@@ -2370,6 +2377,9 @@ static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
2370 rflags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM; 2377 rflags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM;
2371 } 2378 }
2372 vmcs_writel(GUEST_RFLAGS, rflags); 2379 vmcs_writel(GUEST_RFLAGS, rflags);
2380
2381 if ((old_rflags ^ to_vmx(vcpu)->rflags) & X86_EFLAGS_VM)
2382 to_vmx(vcpu)->emulation_required = emulation_required(vcpu);
2373} 2383}
2374 2384
2375static u32 vmx_get_pkru(struct kvm_vcpu *vcpu) 2385static u32 vmx_get_pkru(struct kvm_vcpu *vcpu)
@@ -3857,11 +3867,6 @@ static __init int alloc_kvm_area(void)
3857 return 0; 3867 return 0;
3858} 3868}
3859 3869
3860static bool emulation_required(struct kvm_vcpu *vcpu)
3861{
3862 return emulate_invalid_guest_state && !guest_state_valid(vcpu);
3863}
3864
3865static void fix_pmode_seg(struct kvm_vcpu *vcpu, int seg, 3870static void fix_pmode_seg(struct kvm_vcpu *vcpu, int seg,
3866 struct kvm_segment *save) 3871 struct kvm_segment *save)
3867{ 3872{
@@ -4982,9 +4987,12 @@ static void vmx_complete_nested_posted_interrupt(struct kvm_vcpu *vcpu)
4982 } 4987 }
4983} 4988}
4984 4989
4985static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu) 4990static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu,
4991 bool nested)
4986{ 4992{
4987#ifdef CONFIG_SMP 4993#ifdef CONFIG_SMP
4994 int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR;
4995
4988 if (vcpu->mode == IN_GUEST_MODE) { 4996 if (vcpu->mode == IN_GUEST_MODE) {
4989 struct vcpu_vmx *vmx = to_vmx(vcpu); 4997 struct vcpu_vmx *vmx = to_vmx(vcpu);
4990 4998
@@ -5002,8 +5010,7 @@ static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu)
5002 */ 5010 */
5003 WARN_ON_ONCE(pi_test_sn(&vmx->pi_desc)); 5011 WARN_ON_ONCE(pi_test_sn(&vmx->pi_desc));
5004 5012
5005 apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), 5013 apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec);
5006 POSTED_INTR_VECTOR);
5007 return true; 5014 return true;
5008 } 5015 }
5009#endif 5016#endif
@@ -5018,7 +5025,7 @@ static int vmx_deliver_nested_posted_interrupt(struct kvm_vcpu *vcpu,
5018 if (is_guest_mode(vcpu) && 5025 if (is_guest_mode(vcpu) &&
5019 vector == vmx->nested.posted_intr_nv) { 5026 vector == vmx->nested.posted_intr_nv) {
5020 /* the PIR and ON have been set by L1. */ 5027 /* the PIR and ON have been set by L1. */
5021 kvm_vcpu_trigger_posted_interrupt(vcpu); 5028 kvm_vcpu_trigger_posted_interrupt(vcpu, true);
5022 /* 5029 /*
5023 * If a posted intr is not recognized by hardware, 5030 * If a posted intr is not recognized by hardware,
5024 * we will accomplish it in the next vmentry. 5031 * we will accomplish it in the next vmentry.
@@ -5052,7 +5059,7 @@ static void vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector)
5052 if (pi_test_and_set_on(&vmx->pi_desc)) 5059 if (pi_test_and_set_on(&vmx->pi_desc))
5053 return; 5060 return;
5054 5061
5055 if (!kvm_vcpu_trigger_posted_interrupt(vcpu)) 5062 if (!kvm_vcpu_trigger_posted_interrupt(vcpu, false))
5056 kvm_vcpu_kick(vcpu); 5063 kvm_vcpu_kick(vcpu);
5057} 5064}
5058 5065
@@ -5510,10 +5517,8 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
5510{ 5517{
5511 struct vcpu_vmx *vmx = to_vmx(vcpu); 5518 struct vcpu_vmx *vmx = to_vmx(vcpu);
5512 5519
5513 if (!is_guest_mode(vcpu)) { 5520 ++vcpu->stat.nmi_injections;
5514 ++vcpu->stat.nmi_injections; 5521 vmx->loaded_vmcs->nmi_known_unmasked = false;
5515 vmx->nmi_known_unmasked = false;
5516 }
5517 5522
5518 if (vmx->rmode.vm86_active) { 5523 if (vmx->rmode.vm86_active) {
5519 if (kvm_inject_realmode_interrupt(vcpu, NMI_VECTOR, 0) != EMULATE_DONE) 5524 if (kvm_inject_realmode_interrupt(vcpu, NMI_VECTOR, 0) != EMULATE_DONE)
@@ -5527,16 +5532,21 @@ static void vmx_inject_nmi(struct kvm_vcpu *vcpu)
5527 5532
5528static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu) 5533static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu)
5529{ 5534{
5530 if (to_vmx(vcpu)->nmi_known_unmasked) 5535 struct vcpu_vmx *vmx = to_vmx(vcpu);
5536 bool masked;
5537
5538 if (vmx->loaded_vmcs->nmi_known_unmasked)
5531 return false; 5539 return false;
5532 return vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_NMI; 5540 masked = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_NMI;
5541 vmx->loaded_vmcs->nmi_known_unmasked = !masked;
5542 return masked;
5533} 5543}
5534 5544
5535static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked) 5545static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked)
5536{ 5546{
5537 struct vcpu_vmx *vmx = to_vmx(vcpu); 5547 struct vcpu_vmx *vmx = to_vmx(vcpu);
5538 5548
5539 vmx->nmi_known_unmasked = !masked; 5549 vmx->loaded_vmcs->nmi_known_unmasked = !masked;
5540 if (masked) 5550 if (masked)
5541 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, 5551 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
5542 GUEST_INTR_STATE_NMI); 5552 GUEST_INTR_STATE_NMI);
@@ -8736,7 +8746,7 @@ static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx)
8736 8746
8737 idtv_info_valid = vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK; 8747 idtv_info_valid = vmx->idt_vectoring_info & VECTORING_INFO_VALID_MASK;
8738 8748
8739 if (vmx->nmi_known_unmasked) 8749 if (vmx->loaded_vmcs->nmi_known_unmasked)
8740 return; 8750 return;
8741 /* 8751 /*
8742 * Can't use vmx->exit_intr_info since we're not sure what 8752 * Can't use vmx->exit_intr_info since we're not sure what
@@ -8760,7 +8770,7 @@ static void vmx_recover_nmi_blocking(struct vcpu_vmx *vmx)
8760 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, 8770 vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO,
8761 GUEST_INTR_STATE_NMI); 8771 GUEST_INTR_STATE_NMI);
8762 else 8772 else
8763 vmx->nmi_known_unmasked = 8773 vmx->loaded_vmcs->nmi_known_unmasked =
8764 !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) 8774 !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO)
8765 & GUEST_INTR_STATE_NMI); 8775 & GUEST_INTR_STATE_NMI);
8766} 8776}
@@ -10032,6 +10042,8 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
10032 vmcs12->vm_entry_instruction_len); 10042 vmcs12->vm_entry_instruction_len);
10033 vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, 10043 vmcs_write32(GUEST_INTERRUPTIBILITY_INFO,
10034 vmcs12->guest_interruptibility_info); 10044 vmcs12->guest_interruptibility_info);
10045 vmx->loaded_vmcs->nmi_known_unmasked =
10046 !(vmcs12->guest_interruptibility_info & GUEST_INTR_STATE_NMI);
10035 } else { 10047 } else {
10036 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); 10048 vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0);
10037 } 10049 }
@@ -10056,13 +10068,9 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,
10056 10068
10057 /* Posted interrupts setting is only taken from vmcs12. */ 10069 /* Posted interrupts setting is only taken from vmcs12. */
10058 if (nested_cpu_has_posted_intr(vmcs12)) { 10070 if (nested_cpu_has_posted_intr(vmcs12)) {
10059 /*
10060 * Note that we use L0's vector here and in
10061 * vmx_deliver_nested_posted_interrupt.
10062 */
10063 vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv; 10071 vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv;
10064 vmx->nested.pi_pending = false; 10072 vmx->nested.pi_pending = false;
10065 vmcs_write16(POSTED_INTR_NV, POSTED_INTR_VECTOR); 10073 vmcs_write16(POSTED_INTR_NV, POSTED_INTR_NESTED_VECTOR);
10066 } else { 10074 } else {
10067 exec_control &= ~PIN_BASED_POSTED_INTR; 10075 exec_control &= ~PIN_BASED_POSTED_INTR;
10068 } 10076 }
@@ -10488,6 +10496,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
10488{ 10496{
10489 struct vmcs12 *vmcs12; 10497 struct vmcs12 *vmcs12;
10490 struct vcpu_vmx *vmx = to_vmx(vcpu); 10498 struct vcpu_vmx *vmx = to_vmx(vcpu);
10499 u32 interrupt_shadow = vmx_get_interrupt_shadow(vcpu);
10491 u32 exit_qual; 10500 u32 exit_qual;
10492 int ret; 10501 int ret;
10493 10502
@@ -10512,6 +10521,12 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
10512 * for misconfigurations which will anyway be caught by the processor 10521 * for misconfigurations which will anyway be caught by the processor
10513 * when using the merged vmcs02. 10522 * when using the merged vmcs02.
10514 */ 10523 */
10524 if (interrupt_shadow & KVM_X86_SHADOW_INT_MOV_SS) {
10525 nested_vmx_failValid(vcpu,
10526 VMXERR_ENTRY_EVENTS_BLOCKED_BY_MOV_SS);
10527 goto out;
10528 }
10529
10515 if (vmcs12->launch_state == launch) { 10530 if (vmcs12->launch_state == launch) {
10516 nested_vmx_failValid(vcpu, 10531 nested_vmx_failValid(vcpu,
10517 launch ? VMXERR_VMLAUNCH_NONCLEAR_VMCS 10532 launch ? VMXERR_VMLAUNCH_NONCLEAR_VMCS
@@ -10926,7 +10941,9 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
10926 */ 10941 */
10927 vmx_flush_tlb(vcpu); 10942 vmx_flush_tlb(vcpu);
10928 } 10943 }
10929 10944 /* Restore posted intr vector. */
10945 if (nested_cpu_has_posted_intr(vmcs12))
10946 vmcs_write16(POSTED_INTR_NV, POSTED_INTR_VECTOR);
10930 10947
10931 vmcs_write32(GUEST_SYSENTER_CS, vmcs12->host_ia32_sysenter_cs); 10948 vmcs_write32(GUEST_SYSENTER_CS, vmcs12->host_ia32_sysenter_cs);
10932 vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->host_ia32_sysenter_esp); 10949 vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->host_ia32_sysenter_esp);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5b8f07889f6a..6c97c82814c4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -597,8 +597,8 @@ bool pdptrs_changed(struct kvm_vcpu *vcpu)
597 (unsigned long *)&vcpu->arch.regs_avail)) 597 (unsigned long *)&vcpu->arch.regs_avail))
598 return true; 598 return true;
599 599
600 gfn = (kvm_read_cr3(vcpu) & ~31u) >> PAGE_SHIFT; 600 gfn = (kvm_read_cr3(vcpu) & 0xffffffe0ul) >> PAGE_SHIFT;
601 offset = (kvm_read_cr3(vcpu) & ~31u) & (PAGE_SIZE - 1); 601 offset = (kvm_read_cr3(vcpu) & 0xffffffe0ul) & (PAGE_SIZE - 1);
602 r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte), 602 r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
603 PFERR_USER_MASK | PFERR_WRITE_MASK); 603 PFERR_USER_MASK | PFERR_WRITE_MASK);
604 if (r < 0) 604 if (r < 0)
diff --git a/arch/x86/math-emu/Makefile b/arch/x86/math-emu/Makefile
index 9b0c63b60302..1b2dac174321 100644
--- a/arch/x86/math-emu/Makefile
+++ b/arch/x86/math-emu/Makefile
@@ -5,8 +5,8 @@
5#DEBUG = -DDEBUGGING 5#DEBUG = -DDEBUGGING
6DEBUG = 6DEBUG =
7PARANOID = -DPARANOID 7PARANOID = -DPARANOID
8EXTRA_CFLAGS := $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION) 8ccflags-y += $(PARANOID) $(DEBUG) -fno-builtin $(MATH_EMULATION)
9EXTRA_AFLAGS := $(PARANOID) 9asflags-y += $(PARANOID)
10 10
11# From 'C' language sources: 11# From 'C' language sources:
12C_OBJS =fpu_entry.o errors.o \ 12C_OBJS =fpu_entry.o errors.o \
diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h
index afbc4d805d66..c9c320dccca1 100644
--- a/arch/x86/math-emu/fpu_emu.h
+++ b/arch/x86/math-emu/fpu_emu.h
@@ -157,7 +157,7 @@ extern u_char const data_sizes_16[32];
157 157
158#define signbyte(a) (((u_char *)(a))[9]) 158#define signbyte(a) (((u_char *)(a))[9])
159#define getsign(a) (signbyte(a) & 0x80) 159#define getsign(a) (signbyte(a) & 0x80)
160#define setsign(a,b) { if (b) signbyte(a) |= 0x80; else signbyte(a) &= 0x7f; } 160#define setsign(a,b) { if ((b) != 0) signbyte(a) |= 0x80; else signbyte(a) &= 0x7f; }
161#define copysign(a,b) { if (getsign(a)) signbyte(b) |= 0x80; \ 161#define copysign(a,b) { if (getsign(a)) signbyte(b) |= 0x80; \
162 else signbyte(b) &= 0x7f; } 162 else signbyte(b) &= 0x7f; }
163#define changesign(a) { signbyte(a) ^= 0x80; } 163#define changesign(a) { signbyte(a) ^= 0x80; }
diff --git a/arch/x86/math-emu/reg_compare.c b/arch/x86/math-emu/reg_compare.c
index b77360fdbf4a..19b33b50adfa 100644
--- a/arch/x86/math-emu/reg_compare.c
+++ b/arch/x86/math-emu/reg_compare.c
@@ -168,7 +168,7 @@ static int compare(FPU_REG const *b, int tagb)
168/* This function requires that st(0) is not empty */ 168/* This function requires that st(0) is not empty */
169int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag) 169int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
170{ 170{
171 int f = 0, c; 171 int f, c;
172 172
173 c = compare(loaded_data, loaded_tag); 173 c = compare(loaded_data, loaded_tag);
174 174
@@ -189,12 +189,12 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
189 case COMP_No_Comp: 189 case COMP_No_Comp:
190 f = SW_C3 | SW_C2 | SW_C0; 190 f = SW_C3 | SW_C2 | SW_C0;
191 break; 191 break;
192#ifdef PARANOID
193 default: 192 default:
193#ifdef PARANOID
194 EXCEPTION(EX_INTERNAL | 0x121); 194 EXCEPTION(EX_INTERNAL | 0x121);
195#endif /* PARANOID */
195 f = SW_C3 | SW_C2 | SW_C0; 196 f = SW_C3 | SW_C2 | SW_C0;
196 break; 197 break;
197#endif /* PARANOID */
198 } 198 }
199 setcc(f); 199 setcc(f);
200 if (c & COMP_Denormal) { 200 if (c & COMP_Denormal) {
@@ -205,7 +205,7 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag)
205 205
206static int compare_st_st(int nr) 206static int compare_st_st(int nr)
207{ 207{
208 int f = 0, c; 208 int f, c;
209 FPU_REG *st_ptr; 209 FPU_REG *st_ptr;
210 210
211 if (!NOT_EMPTY(0) || !NOT_EMPTY(nr)) { 211 if (!NOT_EMPTY(0) || !NOT_EMPTY(nr)) {
@@ -235,12 +235,12 @@ static int compare_st_st(int nr)
235 case COMP_No_Comp: 235 case COMP_No_Comp:
236 f = SW_C3 | SW_C2 | SW_C0; 236 f = SW_C3 | SW_C2 | SW_C0;
237 break; 237 break;
238#ifdef PARANOID
239 default: 238 default:
239#ifdef PARANOID
240 EXCEPTION(EX_INTERNAL | 0x122); 240 EXCEPTION(EX_INTERNAL | 0x122);
241#endif /* PARANOID */
241 f = SW_C3 | SW_C2 | SW_C0; 242 f = SW_C3 | SW_C2 | SW_C0;
242 break; 243 break;
243#endif /* PARANOID */
244 } 244 }
245 setcc(f); 245 setcc(f);
246 if (c & COMP_Denormal) { 246 if (c & COMP_Denormal) {
@@ -283,12 +283,12 @@ static int compare_i_st_st(int nr)
283 case COMP_No_Comp: 283 case COMP_No_Comp:
284 f = X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF; 284 f = X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF;
285 break; 285 break;
286#ifdef PARANOID
287 default: 286 default:
287#ifdef PARANOID
288 EXCEPTION(EX_INTERNAL | 0x122); 288 EXCEPTION(EX_INTERNAL | 0x122);
289#endif /* PARANOID */
289 f = 0; 290 f = 0;
290 break; 291 break;
291#endif /* PARANOID */
292 } 292 }
293 FPU_EFLAGS = (FPU_EFLAGS & ~(X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF)) | f; 293 FPU_EFLAGS = (FPU_EFLAGS & ~(X86_EFLAGS_ZF | X86_EFLAGS_PF | X86_EFLAGS_CF)) | f;
294 if (c & COMP_Denormal) { 294 if (c & COMP_Denormal) {
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_max7315.c b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c
index 6e075afa7877..58337b2bc682 100644
--- a/arch/x86/platform/intel-mid/device_libs/platform_max7315.c
+++ b/arch/x86/platform/intel-mid/device_libs/platform_max7315.c
@@ -38,8 +38,10 @@ static void __init *max7315_platform_data(void *info)
38 */ 38 */
39 strcpy(i2c_info->type, "max7315"); 39 strcpy(i2c_info->type, "max7315");
40 if (nr++) { 40 if (nr++) {
41 sprintf(base_pin_name, "max7315_%d_base", nr); 41 snprintf(base_pin_name, sizeof(base_pin_name),
42 sprintf(intr_pin_name, "max7315_%d_int", nr); 42 "max7315_%d_base", nr);
43 snprintf(intr_pin_name, sizeof(intr_pin_name),
44 "max7315_%d_int", nr);
43 } else { 45 } else {
44 strcpy(base_pin_name, "max7315_base"); 46 strcpy(base_pin_name, "max7315_base");
45 strcpy(intr_pin_name, "max7315_int"); 47 strcpy(intr_pin_name, "max7315_int");
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index d4a61ddf9e62..3e4bdb442fbc 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -40,7 +40,6 @@ static int timeout_base_ns[] = {
40static int timeout_us; 40static int timeout_us;
41static bool nobau = true; 41static bool nobau = true;
42static int nobau_perm; 42static int nobau_perm;
43static cycles_t congested_cycles;
44 43
45/* tunables: */ 44/* tunables: */
46static int max_concurr = MAX_BAU_CONCURRENT; 45static int max_concurr = MAX_BAU_CONCURRENT;
@@ -829,10 +828,10 @@ static void record_send_stats(cycles_t time1, cycles_t time2,
829 if ((completion_status == FLUSH_COMPLETE) && (try == 1)) { 828 if ((completion_status == FLUSH_COMPLETE) && (try == 1)) {
830 bcp->period_requests++; 829 bcp->period_requests++;
831 bcp->period_time += elapsed; 830 bcp->period_time += elapsed;
832 if ((elapsed > congested_cycles) && 831 if ((elapsed > usec_2_cycles(bcp->cong_response_us)) &&
833 (bcp->period_requests > bcp->cong_reps) && 832 (bcp->period_requests > bcp->cong_reps) &&
834 ((bcp->period_time / bcp->period_requests) > 833 ((bcp->period_time / bcp->period_requests) >
835 congested_cycles)) { 834 usec_2_cycles(bcp->cong_response_us))) {
836 stat->s_congested++; 835 stat->s_congested++;
837 disable_for_period(bcp, stat); 836 disable_for_period(bcp, stat);
838 } 837 }
@@ -2222,14 +2221,17 @@ static int __init uv_bau_init(void)
2222 else if (is_uv1_hub()) 2221 else if (is_uv1_hub())
2223 ops = uv1_bau_ops; 2222 ops = uv1_bau_ops;
2224 2223
2224 nuvhubs = uv_num_possible_blades();
2225 if (nuvhubs < 2) {
2226 pr_crit("UV: BAU disabled - insufficient hub count\n");
2227 goto err_bau_disable;
2228 }
2229
2225 for_each_possible_cpu(cur_cpu) { 2230 for_each_possible_cpu(cur_cpu) {
2226 mask = &per_cpu(uv_flush_tlb_mask, cur_cpu); 2231 mask = &per_cpu(uv_flush_tlb_mask, cur_cpu);
2227 zalloc_cpumask_var_node(mask, GFP_KERNEL, cpu_to_node(cur_cpu)); 2232 zalloc_cpumask_var_node(mask, GFP_KERNEL, cpu_to_node(cur_cpu));
2228 } 2233 }
2229 2234
2230 nuvhubs = uv_num_possible_blades();
2231 congested_cycles = usec_2_cycles(congested_respns_us);
2232
2233 uv_base_pnode = 0x7fffffff; 2235 uv_base_pnode = 0x7fffffff;
2234 for (uvhub = 0; uvhub < nuvhubs; uvhub++) { 2236 for (uvhub = 0; uvhub < nuvhubs; uvhub++) {
2235 cpus = uv_blade_nr_possible_cpus(uvhub); 2237 cpus = uv_blade_nr_possible_cpus(uvhub);
@@ -2242,9 +2244,8 @@ static int __init uv_bau_init(void)
2242 enable_timeouts(); 2244 enable_timeouts();
2243 2245
2244 if (init_per_cpu(nuvhubs, uv_base_pnode)) { 2246 if (init_per_cpu(nuvhubs, uv_base_pnode)) {
2245 set_bau_off(); 2247 pr_crit("UV: BAU disabled - per CPU init failed\n");
2246 nobau_perm = 1; 2248 goto err_bau_disable;
2247 return 0;
2248 } 2249 }
2249 2250
2250 vector = UV_BAU_MESSAGE; 2251 vector = UV_BAU_MESSAGE;
@@ -2270,6 +2271,16 @@ static int __init uv_bau_init(void)
2270 } 2271 }
2271 2272
2272 return 0; 2273 return 0;
2274
2275err_bau_disable:
2276
2277 for_each_possible_cpu(cur_cpu)
2278 free_cpumask_var(per_cpu(uv_flush_tlb_mask, cur_cpu));
2279
2280 set_bau_off();
2281 nobau_perm = 1;
2282
2283 return -EINVAL;
2273} 2284}
2274core_initcall(uv_bau_init); 2285core_initcall(uv_bau_init);
2275fs_initcall(uv_ptc_init); 2286fs_initcall(uv_ptc_init);
diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c
index 1ea598e5f030..51471408fdd1 100644
--- a/arch/x86/xen/smp_pv.c
+++ b/arch/x86/xen/smp_pv.c
@@ -19,6 +19,7 @@
19#include <linux/irq_work.h> 19#include <linux/irq_work.h>
20#include <linux/tick.h> 20#include <linux/tick.h>
21#include <linux/nmi.h> 21#include <linux/nmi.h>
22#include <linux/cpuhotplug.h>
22 23
23#include <asm/paravirt.h> 24#include <asm/paravirt.h>
24#include <asm/desc.h> 25#include <asm/desc.h>
@@ -413,7 +414,7 @@ static void xen_pv_play_dead(void) /* used only with HOTPLUG_CPU */
413 */ 414 */
414 tick_nohz_idle_enter(); 415 tick_nohz_idle_enter();
415 416
416 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); 417 cpuhp_online_idle(CPUHP_AP_ONLINE_IDLE);
417} 418}
418 419
419#else /* !CONFIG_HOTPLUG_CPU */ 420#else /* !CONFIG_HOTPLUG_CPU */
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index a1895a8e85c1..1ecb05db3632 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -309,7 +309,6 @@ static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
309void xen_teardown_timer(int cpu) 309void xen_teardown_timer(int cpu)
310{ 310{
311 struct clock_event_device *evt; 311 struct clock_event_device *evt;
312 BUG_ON(cpu == 0);
313 evt = &per_cpu(xen_clock_events, cpu).evt; 312 evt = &per_cpu(xen_clock_events, cpu).evt;
314 313
315 if (evt->irq >= 0) { 314 if (evt->irq >= 0) {
diff --git a/arch/xtensa/include/uapi/asm/ioctls.h b/arch/xtensa/include/uapi/asm/ioctls.h
index 98b004e24e85..47d82c09be7b 100644
--- a/arch/xtensa/include/uapi/asm/ioctls.h
+++ b/arch/xtensa/include/uapi/asm/ioctls.h
@@ -105,7 +105,7 @@
105#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 105#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
106#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 106#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
107#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 107#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
108#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 108#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
109 109
110#define TIOCSERCONFIG _IO('T', 83) 110#define TIOCSERCONFIG _IO('T', 83)
111#define TIOCSERGWILD _IOR('T', 84, int) 111#define TIOCSERGWILD _IOR('T', 84, int)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 60a6835265fc..436b6ca6b175 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4299,6 +4299,9 @@ static void bfq_completed_request(struct bfq_queue *bfqq, struct bfq_data *bfqd)
4299 bfq_bfqq_expire(bfqd, bfqq, false, 4299 bfq_bfqq_expire(bfqd, bfqq, false,
4300 BFQQE_NO_MORE_REQUESTS); 4300 BFQQE_NO_MORE_REQUESTS);
4301 } 4301 }
4302
4303 if (!bfqd->rq_in_driver)
4304 bfq_schedule_dispatch(bfqd);
4302} 4305}
4303 4306
4304static void bfq_put_rq_priv_body(struct bfq_queue *bfqq) 4307static void bfq_put_rq_priv_body(struct bfq_queue *bfqq)
diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
index 8fd83b885774..63e771ab56d8 100644
--- a/block/bfq-iosched.h
+++ b/block/bfq-iosched.h
@@ -52,7 +52,7 @@ struct bfq_entity;
52struct bfq_service_tree { 52struct bfq_service_tree {
53 /* tree for active entities (i.e., those backlogged) */ 53 /* tree for active entities (i.e., those backlogged) */
54 struct rb_root active; 54 struct rb_root active;
55 /* tree for idle entities (i.e., not backlogged, with V <= F_i)*/ 55 /* tree for idle entities (i.e., not backlogged, with V < F_i)*/
56 struct rb_root idle; 56 struct rb_root idle;
57 57
58 /* idle entity with minimum F_i */ 58 /* idle entity with minimum F_i */
diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c
index 5ec05cd42b80..979f8f21b7e2 100644
--- a/block/bfq-wf2q.c
+++ b/block/bfq-wf2q.c
@@ -1297,7 +1297,7 @@ static void bfq_update_vtime(struct bfq_service_tree *st, u64 new_value)
1297 * 1297 *
1298 * This function searches the first schedulable entity, starting from the 1298 * This function searches the first schedulable entity, starting from the
1299 * root of the tree and going on the left every time on this side there is 1299 * root of the tree and going on the left every time on this side there is
1300 * a subtree with at least one eligible (start >= vtime) entity. The path on 1300 * a subtree with at least one eligible (start <= vtime) entity. The path on
1301 * the right is followed only if a) the left subtree contains no eligible 1301 * the right is followed only if a) the left subtree contains no eligible
1302 * entities and b) no eligible entity has been found yet. 1302 * entities and b) no eligible entity has been found yet.
1303 */ 1303 */
diff --git a/block/blk-core.c b/block/blk-core.c
index 970b9c9638c5..dbecbf4a64e0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -3421,6 +3421,10 @@ EXPORT_SYMBOL(blk_finish_plug);
3421 */ 3421 */
3422void blk_pm_runtime_init(struct request_queue *q, struct device *dev) 3422void blk_pm_runtime_init(struct request_queue *q, struct device *dev)
3423{ 3423{
3424 /* not support for RQF_PM and ->rpm_status in blk-mq yet */
3425 if (q->mq_ops)
3426 return;
3427
3424 q->dev = dev; 3428 q->dev = dev;
3425 q->rpm_status = RPM_ACTIVE; 3429 q->rpm_status = RPM_ACTIVE;
3426 pm_runtime_set_autosuspend_delay(q->dev, -1); 3430 pm_runtime_set_autosuspend_delay(q->dev, -1);
diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index 4891f042a22f..9f8cffc8a701 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -17,9 +17,9 @@
17static int cpu_to_queue_index(unsigned int nr_queues, const int cpu) 17static int cpu_to_queue_index(unsigned int nr_queues, const int cpu)
18{ 18{
19 /* 19 /*
20 * Non online CPU will be mapped to queue index 0. 20 * Non present CPU will be mapped to queue index 0.
21 */ 21 */
22 if (!cpu_online(cpu)) 22 if (!cpu_present(cpu))
23 return 0; 23 return 0;
24 return cpu % nr_queues; 24 return cpu % nr_queues;
25} 25}
diff --git a/crypto/authencesn.c b/crypto/authencesn.c
index 6f8f6b86bfe2..0cf5fefdb859 100644
--- a/crypto/authencesn.c
+++ b/crypto/authencesn.c
@@ -248,6 +248,9 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
248 u8 *ihash = ohash + crypto_ahash_digestsize(auth); 248 u8 *ihash = ohash + crypto_ahash_digestsize(auth);
249 u32 tmp[2]; 249 u32 tmp[2];
250 250
251 if (!authsize)
252 goto decrypt;
253
251 /* Move high-order bits of sequence number back. */ 254 /* Move high-order bits of sequence number back. */
252 scatterwalk_map_and_copy(tmp, dst, 4, 4, 0); 255 scatterwalk_map_and_copy(tmp, dst, 4, 4, 0);
253 scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 0); 256 scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 0);
@@ -256,6 +259,8 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
256 if (crypto_memneq(ihash, ohash, authsize)) 259 if (crypto_memneq(ihash, ohash, authsize))
257 return -EBADMSG; 260 return -EBADMSG;
258 261
262decrypt:
263
259 sg_init_table(areq_ctx->dst, 2); 264 sg_init_table(areq_ctx->dst, 2);
260 dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen); 265 dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen);
261 266
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index ddb01e9fa5b2..62068a5e814f 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -151,6 +151,10 @@ static bool ec_freeze_events __read_mostly = false;
151module_param(ec_freeze_events, bool, 0644); 151module_param(ec_freeze_events, bool, 0644);
152MODULE_PARM_DESC(ec_freeze_events, "Disabling event handling during suspend/resume"); 152MODULE_PARM_DESC(ec_freeze_events, "Disabling event handling during suspend/resume");
153 153
154static bool ec_no_wakeup __read_mostly;
155module_param(ec_no_wakeup, bool, 0644);
156MODULE_PARM_DESC(ec_no_wakeup, "Do not wake up from suspend-to-idle");
157
154struct acpi_ec_query_handler { 158struct acpi_ec_query_handler {
155 struct list_head node; 159 struct list_head node;
156 acpi_ec_query_func func; 160 acpi_ec_query_func func;
@@ -535,6 +539,14 @@ static void acpi_ec_disable_event(struct acpi_ec *ec)
535 spin_unlock_irqrestore(&ec->lock, flags); 539 spin_unlock_irqrestore(&ec->lock, flags);
536 __acpi_ec_flush_event(ec); 540 __acpi_ec_flush_event(ec);
537} 541}
542
543void acpi_ec_flush_work(void)
544{
545 if (first_ec)
546 __acpi_ec_flush_event(first_ec);
547
548 flush_scheduled_work();
549}
538#endif /* CONFIG_PM_SLEEP */ 550#endif /* CONFIG_PM_SLEEP */
539 551
540static bool acpi_ec_guard_event(struct acpi_ec *ec) 552static bool acpi_ec_guard_event(struct acpi_ec *ec)
@@ -1880,6 +1892,32 @@ static int acpi_ec_suspend(struct device *dev)
1880 return 0; 1892 return 0;
1881} 1893}
1882 1894
1895static int acpi_ec_suspend_noirq(struct device *dev)
1896{
1897 struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev));
1898
1899 /*
1900 * The SCI handler doesn't run at this point, so the GPE can be
1901 * masked at the low level without side effects.
1902 */
1903 if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) &&
1904 ec->reference_count >= 1)
1905 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE);
1906
1907 return 0;
1908}
1909
1910static int acpi_ec_resume_noirq(struct device *dev)
1911{
1912 struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev));
1913
1914 if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) &&
1915 ec->reference_count >= 1)
1916 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_ENABLE);
1917
1918 return 0;
1919}
1920
1883static int acpi_ec_resume(struct device *dev) 1921static int acpi_ec_resume(struct device *dev)
1884{ 1922{
1885 struct acpi_ec *ec = 1923 struct acpi_ec *ec =
@@ -1891,6 +1929,7 @@ static int acpi_ec_resume(struct device *dev)
1891#endif 1929#endif
1892 1930
1893static const struct dev_pm_ops acpi_ec_pm = { 1931static const struct dev_pm_ops acpi_ec_pm = {
1932 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(acpi_ec_suspend_noirq, acpi_ec_resume_noirq)
1894 SET_SYSTEM_SLEEP_PM_OPS(acpi_ec_suspend, acpi_ec_resume) 1933 SET_SYSTEM_SLEEP_PM_OPS(acpi_ec_suspend, acpi_ec_resume)
1895}; 1934};
1896 1935
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 9531d3276f65..58dd7ab3c653 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -193,6 +193,10 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
193 void *data); 193 void *data);
194void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit); 194void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
195 195
196#ifdef CONFIG_PM_SLEEP
197void acpi_ec_flush_work(void);
198#endif
199
196 200
197/*-------------------------------------------------------------------------- 201/*--------------------------------------------------------------------------
198 Suspend/Resume 202 Suspend/Resume
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index b75b734ee73a..19182d091587 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -3160,6 +3160,8 @@ static struct acpi_driver acpi_nfit_driver = {
3160 3160
3161static __init int nfit_init(void) 3161static __init int nfit_init(void)
3162{ 3162{
3163 int ret;
3164
3163 BUILD_BUG_ON(sizeof(struct acpi_table_nfit) != 40); 3165 BUILD_BUG_ON(sizeof(struct acpi_table_nfit) != 40);
3164 BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 56); 3166 BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 56);
3165 BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48); 3167 BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48);
@@ -3187,8 +3189,14 @@ static __init int nfit_init(void)
3187 return -ENOMEM; 3189 return -ENOMEM;
3188 3190
3189 nfit_mce_register(); 3191 nfit_mce_register();
3192 ret = acpi_bus_register_driver(&acpi_nfit_driver);
3193 if (ret) {
3194 nfit_mce_unregister();
3195 destroy_workqueue(nfit_wq);
3196 }
3197
3198 return ret;
3190 3199
3191 return acpi_bus_register_driver(&acpi_nfit_driver);
3192} 3200}
3193 3201
3194static __exit void nfit_exit(void) 3202static __exit void nfit_exit(void)
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index edb0c79f7c64..917f1cc0fda4 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -443,7 +443,7 @@ int __init acpi_numa_init(void)
443 * So go over all cpu entries in SRAT to get apicid to node mapping. 443 * So go over all cpu entries in SRAT to get apicid to node mapping.
444 */ 444 */
445 445
446 /* SRAT: Static Resource Affinity Table */ 446 /* SRAT: System Resource Affinity Table */
447 if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { 447 if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) {
448 struct acpi_subtable_proc srat_proc[3]; 448 struct acpi_subtable_proc srat_proc[3];
449 449
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index be17664736b2..fa8243c5c062 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -777,11 +777,11 @@ static void acpi_freeze_sync(void)
777 /* 777 /*
778 * Process all pending events in case there are any wakeup ones. 778 * Process all pending events in case there are any wakeup ones.
779 * 779 *
780 * The EC driver uses the system workqueue, so that one needs to be 780 * The EC driver uses the system workqueue and an additional special
781 * flushed too. 781 * one, so those need to be flushed too.
782 */ 782 */
783 acpi_ec_flush_work();
783 acpi_os_wait_events_complete(); 784 acpi_os_wait_events_complete();
784 flush_scheduled_work();
785 s2idle_wakeup = false; 785 s2idle_wakeup = false;
786} 786}
787 787
diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index aae4d8d4be36..f7665c31feca 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -2200,8 +2200,12 @@ static void binder_transaction(struct binder_proc *proc,
2200 list_add_tail(&t->work.entry, target_list); 2200 list_add_tail(&t->work.entry, target_list);
2201 tcomplete->type = BINDER_WORK_TRANSACTION_COMPLETE; 2201 tcomplete->type = BINDER_WORK_TRANSACTION_COMPLETE;
2202 list_add_tail(&tcomplete->entry, &thread->todo); 2202 list_add_tail(&tcomplete->entry, &thread->todo);
2203 if (target_wait) 2203 if (target_wait) {
2204 wake_up_interruptible(target_wait); 2204 if (reply || !(t->flags & TF_ONE_WAY))
2205 wake_up_interruptible_sync(target_wait);
2206 else
2207 wake_up_interruptible(target_wait);
2208 }
2205 return; 2209 return;
2206 2210
2207err_translate_failed: 2211err_translate_failed:
@@ -3247,10 +3251,6 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3247 /*pr_info("binder_ioctl: %d:%d %x %lx\n", 3251 /*pr_info("binder_ioctl: %d:%d %x %lx\n",
3248 proc->pid, current->pid, cmd, arg);*/ 3252 proc->pid, current->pid, cmd, arg);*/
3249 3253
3250 if (unlikely(current->mm != proc->vma_vm_mm)) {
3251 pr_err("current mm mismatch proc mm\n");
3252 return -EINVAL;
3253 }
3254 trace_binder_ioctl(cmd, arg); 3254 trace_binder_ioctl(cmd, arg);
3255 3255
3256 ret = wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2); 3256 ret = wait_event_interruptible(binder_user_error_wait, binder_stop_on_user_error < 2);
@@ -3464,9 +3464,8 @@ static int binder_open(struct inode *nodp, struct file *filp)
3464 proc = kzalloc(sizeof(*proc), GFP_KERNEL); 3464 proc = kzalloc(sizeof(*proc), GFP_KERNEL);
3465 if (proc == NULL) 3465 if (proc == NULL)
3466 return -ENOMEM; 3466 return -ENOMEM;
3467 get_task_struct(current); 3467 get_task_struct(current->group_leader);
3468 proc->tsk = current; 3468 proc->tsk = current->group_leader;
3469 proc->vma_vm_mm = current->mm;
3470 INIT_LIST_HEAD(&proc->todo); 3469 INIT_LIST_HEAD(&proc->todo);
3471 init_waitqueue_head(&proc->wait); 3470 init_waitqueue_head(&proc->wait);
3472 proc->default_priority = task_nice(current); 3471 proc->default_priority = task_nice(current);
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 292dec18ffb8..07bdd51b3b9a 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1613,7 +1613,7 @@ static int zatm_init_one(struct pci_dev *pci_dev,
1613 1613
1614 ret = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)); 1614 ret = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
1615 if (ret < 0) 1615 if (ret < 0)
1616 goto out_disable; 1616 goto out_release;
1617 1617
1618 zatm_dev->pci_dev = pci_dev; 1618 zatm_dev->pci_dev = pci_dev;
1619 dev->dev_data = zatm_dev; 1619 dev->dev_data = zatm_dev;
diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c
index 2ae24c28e70c..1c152aed6b82 100644
--- a/drivers/base/dma-coherent.c
+++ b/drivers/base/dma-coherent.c
@@ -25,7 +25,7 @@ static inline struct dma_coherent_mem *dev_get_coherent_memory(struct device *de
25{ 25{
26 if (dev && dev->dma_mem) 26 if (dev && dev->dma_mem)
27 return dev->dma_mem; 27 return dev->dma_mem;
28 return dma_coherent_default_memory; 28 return NULL;
29} 29}
30 30
31static inline dma_addr_t dma_get_device_base(struct device *dev, 31static inline dma_addr_t dma_get_device_base(struct device *dev,
@@ -165,34 +165,15 @@ void *dma_mark_declared_memory_occupied(struct device *dev,
165} 165}
166EXPORT_SYMBOL(dma_mark_declared_memory_occupied); 166EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
167 167
168/** 168static void *__dma_alloc_from_coherent(struct dma_coherent_mem *mem,
169 * dma_alloc_from_coherent() - try to allocate memory from the per-device coherent area 169 ssize_t size, dma_addr_t *dma_handle)
170 *
171 * @dev: device from which we allocate memory
172 * @size: size of requested memory area
173 * @dma_handle: This will be filled with the correct dma handle
174 * @ret: This pointer will be filled with the virtual address
175 * to allocated area.
176 *
177 * This function should be only called from per-arch dma_alloc_coherent()
178 * to support allocation from per-device coherent memory pools.
179 *
180 * Returns 0 if dma_alloc_coherent should continue with allocating from
181 * generic memory areas, or !0 if dma_alloc_coherent should return @ret.
182 */
183int dma_alloc_from_coherent(struct device *dev, ssize_t size,
184 dma_addr_t *dma_handle, void **ret)
185{ 170{
186 struct dma_coherent_mem *mem = dev_get_coherent_memory(dev);
187 int order = get_order(size); 171 int order = get_order(size);
188 unsigned long flags; 172 unsigned long flags;
189 int pageno; 173 int pageno;
190 int dma_memory_map; 174 int dma_memory_map;
175 void *ret;
191 176
192 if (!mem)
193 return 0;
194
195 *ret = NULL;
196 spin_lock_irqsave(&mem->spinlock, flags); 177 spin_lock_irqsave(&mem->spinlock, flags);
197 178
198 if (unlikely(size > (mem->size << PAGE_SHIFT))) 179 if (unlikely(size > (mem->size << PAGE_SHIFT)))
@@ -203,21 +184,50 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
203 goto err; 184 goto err;
204 185
205 /* 186 /*
206 * Memory was found in the per-device area. 187 * Memory was found in the coherent area.
207 */ 188 */
208 *dma_handle = dma_get_device_base(dev, mem) + (pageno << PAGE_SHIFT); 189 *dma_handle = mem->device_base + (pageno << PAGE_SHIFT);
209 *ret = mem->virt_base + (pageno << PAGE_SHIFT); 190 ret = mem->virt_base + (pageno << PAGE_SHIFT);
210 dma_memory_map = (mem->flags & DMA_MEMORY_MAP); 191 dma_memory_map = (mem->flags & DMA_MEMORY_MAP);
211 spin_unlock_irqrestore(&mem->spinlock, flags); 192 spin_unlock_irqrestore(&mem->spinlock, flags);
212 if (dma_memory_map) 193 if (dma_memory_map)
213 memset(*ret, 0, size); 194 memset(ret, 0, size);
214 else 195 else
215 memset_io(*ret, 0, size); 196 memset_io(ret, 0, size);
216 197
217 return 1; 198 return ret;
218 199
219err: 200err:
220 spin_unlock_irqrestore(&mem->spinlock, flags); 201 spin_unlock_irqrestore(&mem->spinlock, flags);
202 return NULL;
203}
204
205/**
206 * dma_alloc_from_dev_coherent() - allocate memory from device coherent pool
207 * @dev: device from which we allocate memory
208 * @size: size of requested memory area
209 * @dma_handle: This will be filled with the correct dma handle
210 * @ret: This pointer will be filled with the virtual address
211 * to allocated area.
212 *
213 * This function should be only called from per-arch dma_alloc_coherent()
214 * to support allocation from per-device coherent memory pools.
215 *
216 * Returns 0 if dma_alloc_coherent should continue with allocating from
217 * generic memory areas, or !0 if dma_alloc_coherent should return @ret.
218 */
219int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size,
220 dma_addr_t *dma_handle, void **ret)
221{
222 struct dma_coherent_mem *mem = dev_get_coherent_memory(dev);
223
224 if (!mem)
225 return 0;
226
227 *ret = __dma_alloc_from_coherent(mem, size, dma_handle);
228 if (*ret)
229 return 1;
230
221 /* 231 /*
222 * In the case where the allocation can not be satisfied from the 232 * In the case where the allocation can not be satisfied from the
223 * per-device area, try to fall back to generic memory if the 233 * per-device area, try to fall back to generic memory if the
@@ -225,25 +235,20 @@ err:
225 */ 235 */
226 return mem->flags & DMA_MEMORY_EXCLUSIVE; 236 return mem->flags & DMA_MEMORY_EXCLUSIVE;
227} 237}
228EXPORT_SYMBOL(dma_alloc_from_coherent); 238EXPORT_SYMBOL(dma_alloc_from_dev_coherent);
229 239
230/** 240void *dma_alloc_from_global_coherent(ssize_t size, dma_addr_t *dma_handle)
231 * dma_release_from_coherent() - try to free the memory allocated from per-device coherent memory pool
232 * @dev: device from which the memory was allocated
233 * @order: the order of pages allocated
234 * @vaddr: virtual address of allocated pages
235 *
236 * This checks whether the memory was allocated from the per-device
237 * coherent memory pool and if so, releases that memory.
238 *
239 * Returns 1 if we correctly released the memory, or 0 if
240 * dma_release_coherent() should proceed with releasing memory from
241 * generic pools.
242 */
243int dma_release_from_coherent(struct device *dev, int order, void *vaddr)
244{ 241{
245 struct dma_coherent_mem *mem = dev_get_coherent_memory(dev); 242 if (!dma_coherent_default_memory)
243 return NULL;
244
245 return __dma_alloc_from_coherent(dma_coherent_default_memory, size,
246 dma_handle);
247}
246 248
249static int __dma_release_from_coherent(struct dma_coherent_mem *mem,
250 int order, void *vaddr)
251{
247 if (mem && vaddr >= mem->virt_base && vaddr < 252 if (mem && vaddr >= mem->virt_base && vaddr <
248 (mem->virt_base + (mem->size << PAGE_SHIFT))) { 253 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
249 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; 254 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
@@ -256,28 +261,39 @@ int dma_release_from_coherent(struct device *dev, int order, void *vaddr)
256 } 261 }
257 return 0; 262 return 0;
258} 263}
259EXPORT_SYMBOL(dma_release_from_coherent);
260 264
261/** 265/**
262 * dma_mmap_from_coherent() - try to mmap the memory allocated from 266 * dma_release_from_dev_coherent() - free memory to device coherent memory pool
263 * per-device coherent memory pool to userspace
264 * @dev: device from which the memory was allocated 267 * @dev: device from which the memory was allocated
265 * @vma: vm_area for the userspace memory 268 * @order: the order of pages allocated
266 * @vaddr: cpu address returned by dma_alloc_from_coherent 269 * @vaddr: virtual address of allocated pages
267 * @size: size of the memory buffer allocated by dma_alloc_from_coherent
268 * @ret: result from remap_pfn_range()
269 * 270 *
270 * This checks whether the memory was allocated from the per-device 271 * This checks whether the memory was allocated from the per-device
271 * coherent memory pool and if so, maps that memory to the provided vma. 272 * coherent memory pool and if so, releases that memory.
272 * 273 *
273 * Returns 1 if we correctly mapped the memory, or 0 if the caller should 274 * Returns 1 if we correctly released the memory, or 0 if the caller should
274 * proceed with mapping memory from generic pools. 275 * proceed with releasing memory from generic pools.
275 */ 276 */
276int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, 277int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr)
277 void *vaddr, size_t size, int *ret)
278{ 278{
279 struct dma_coherent_mem *mem = dev_get_coherent_memory(dev); 279 struct dma_coherent_mem *mem = dev_get_coherent_memory(dev);
280 280
281 return __dma_release_from_coherent(mem, order, vaddr);
282}
283EXPORT_SYMBOL(dma_release_from_dev_coherent);
284
285int dma_release_from_global_coherent(int order, void *vaddr)
286{
287 if (!dma_coherent_default_memory)
288 return 0;
289
290 return __dma_release_from_coherent(dma_coherent_default_memory, order,
291 vaddr);
292}
293
294static int __dma_mmap_from_coherent(struct dma_coherent_mem *mem,
295 struct vm_area_struct *vma, void *vaddr, size_t size, int *ret)
296{
281 if (mem && vaddr >= mem->virt_base && vaddr + size <= 297 if (mem && vaddr >= mem->virt_base && vaddr + size <=
282 (mem->virt_base + (mem->size << PAGE_SHIFT))) { 298 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
283 unsigned long off = vma->vm_pgoff; 299 unsigned long off = vma->vm_pgoff;
@@ -296,7 +312,39 @@ int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
296 } 312 }
297 return 0; 313 return 0;
298} 314}
299EXPORT_SYMBOL(dma_mmap_from_coherent); 315
316/**
317 * dma_mmap_from_dev_coherent() - mmap memory from the device coherent pool
318 * @dev: device from which the memory was allocated
319 * @vma: vm_area for the userspace memory
320 * @vaddr: cpu address returned by dma_alloc_from_dev_coherent
321 * @size: size of the memory buffer allocated
322 * @ret: result from remap_pfn_range()
323 *
324 * This checks whether the memory was allocated from the per-device
325 * coherent memory pool and if so, maps that memory to the provided vma.
326 *
327 * Returns 1 if we correctly mapped the memory, or 0 if the caller should
328 * proceed with mapping memory from generic pools.
329 */
330int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma,
331 void *vaddr, size_t size, int *ret)
332{
333 struct dma_coherent_mem *mem = dev_get_coherent_memory(dev);
334
335 return __dma_mmap_from_coherent(mem, vma, vaddr, size, ret);
336}
337EXPORT_SYMBOL(dma_mmap_from_dev_coherent);
338
339int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *vaddr,
340 size_t size, int *ret)
341{
342 if (!dma_coherent_default_memory)
343 return 0;
344
345 return __dma_mmap_from_coherent(dma_coherent_default_memory, vma,
346 vaddr, size, ret);
347}
300 348
301/* 349/*
302 * Support for reserved memory regions defined in device tree 350 * Support for reserved memory regions defined in device tree
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index 5096755d185e..b555ff9dd8fc 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -235,7 +235,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
235 235
236 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 236 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
237 237
238 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret)) 238 if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret))
239 return ret; 239 return ret;
240 240
241 if (off < count && user_count <= (count - off)) { 241 if (off < count && user_count <= (count - off)) {
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 3b8210ebb50e..60303aa28587 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1222,8 +1222,6 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev,
1222 1222
1223 spin_unlock_irq(&dev->power.lock); 1223 spin_unlock_irq(&dev->power.lock);
1224 1224
1225 dev_pm_domain_set(dev, &genpd->domain);
1226
1227 return gpd_data; 1225 return gpd_data;
1228 1226
1229 err_free: 1227 err_free:
@@ -1237,8 +1235,6 @@ static struct generic_pm_domain_data *genpd_alloc_dev_data(struct device *dev,
1237static void genpd_free_dev_data(struct device *dev, 1235static void genpd_free_dev_data(struct device *dev,
1238 struct generic_pm_domain_data *gpd_data) 1236 struct generic_pm_domain_data *gpd_data)
1239{ 1237{
1240 dev_pm_domain_set(dev, NULL);
1241
1242 spin_lock_irq(&dev->power.lock); 1238 spin_lock_irq(&dev->power.lock);
1243 1239
1244 dev->power.subsys_data->domain_data = NULL; 1240 dev->power.subsys_data->domain_data = NULL;
@@ -1275,6 +1271,8 @@ static int genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
1275 if (ret) 1271 if (ret)
1276 goto out; 1272 goto out;
1277 1273
1274 dev_pm_domain_set(dev, &genpd->domain);
1275
1278 genpd->device_count++; 1276 genpd->device_count++;
1279 genpd->max_off_time_changed = true; 1277 genpd->max_off_time_changed = true;
1280 1278
@@ -1336,6 +1334,8 @@ static int genpd_remove_device(struct generic_pm_domain *genpd,
1336 if (genpd->detach_dev) 1334 if (genpd->detach_dev)
1337 genpd->detach_dev(genpd, dev); 1335 genpd->detach_dev(genpd, dev);
1338 1336
1337 dev_pm_domain_set(dev, NULL);
1338
1339 list_del_init(&pdd->list_node); 1339 list_del_init(&pdd->list_node);
1340 1340
1341 genpd_unlock(genpd); 1341 genpd_unlock(genpd);
diff --git a/drivers/base/regmap/regmap-w1.c b/drivers/base/regmap/regmap-w1.c
index 5f04e7bf063e..e6c64b0be5b2 100644
--- a/drivers/base/regmap/regmap-w1.c
+++ b/drivers/base/regmap/regmap-w1.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Register map access API - W1 (1-Wire) support 2 * Register map access API - W1 (1-Wire) support
3 * 3 *
4 * Copyright (C) 2017 OAO Radioavionica 4 * Copyright (c) 2017 Radioavionica Corporation
5 * Author: Alex A. Mihaylov <minimumlaw@rambler.ru> 5 * Author: Alex A. Mihaylov <minimumlaw@rambler.ru>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -11,7 +11,7 @@
11 11
12#include <linux/regmap.h> 12#include <linux/regmap.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include "../../w1/w1.h" 14#include <linux/w1.h>
15 15
16#include "internal.h" 16#include "internal.h"
17 17
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index dea7d85134ee..5bdf923294a5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -626,7 +626,6 @@ static void recv_work(struct work_struct *work)
626 struct nbd_device *nbd = args->nbd; 626 struct nbd_device *nbd = args->nbd;
627 struct nbd_config *config = nbd->config; 627 struct nbd_config *config = nbd->config;
628 struct nbd_cmd *cmd; 628 struct nbd_cmd *cmd;
629 int ret = 0;
630 629
631 while (1) { 630 while (1) {
632 cmd = nbd_read_stat(nbd, args->index); 631 cmd = nbd_read_stat(nbd, args->index);
@@ -636,7 +635,6 @@ static void recv_work(struct work_struct *work)
636 mutex_lock(&nsock->tx_lock); 635 mutex_lock(&nsock->tx_lock);
637 nbd_mark_nsock_dead(nbd, nsock, 1); 636 nbd_mark_nsock_dead(nbd, nsock, 1);
638 mutex_unlock(&nsock->tx_lock); 637 mutex_unlock(&nsock->tx_lock);
639 ret = PTR_ERR(cmd);
640 break; 638 break;
641 } 639 }
642 640
@@ -910,7 +908,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
910 continue; 908 continue;
911 } 909 }
912 sk_set_memalloc(sock->sk); 910 sk_set_memalloc(sock->sk);
913 sock->sk->sk_sndtimeo = nbd->tag_set.timeout; 911 if (nbd->tag_set.timeout)
912 sock->sk->sk_sndtimeo = nbd->tag_set.timeout;
914 atomic_inc(&config->recv_threads); 913 atomic_inc(&config->recv_threads);
915 refcount_inc(&nbd->config_refs); 914 refcount_inc(&nbd->config_refs);
916 old = nsock->sock; 915 old = nsock->sock;
@@ -924,6 +923,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
924 mutex_unlock(&nsock->tx_lock); 923 mutex_unlock(&nsock->tx_lock);
925 sockfd_put(old); 924 sockfd_put(old);
926 925
926 clear_bit(NBD_DISCONNECTED, &config->runtime_flags);
927
927 /* We take the tx_mutex in an error path in the recv_work, so we 928 /* We take the tx_mutex in an error path in the recv_work, so we
928 * need to queue_work outside of the tx_mutex. 929 * need to queue_work outside of the tx_mutex.
929 */ 930 */
@@ -980,11 +981,15 @@ static void send_disconnects(struct nbd_device *nbd)
980 int i, ret; 981 int i, ret;
981 982
982 for (i = 0; i < config->num_connections; i++) { 983 for (i = 0; i < config->num_connections; i++) {
984 struct nbd_sock *nsock = config->socks[i];
985
983 iov_iter_kvec(&from, WRITE | ITER_KVEC, &iov, 1, sizeof(request)); 986 iov_iter_kvec(&from, WRITE | ITER_KVEC, &iov, 1, sizeof(request));
987 mutex_lock(&nsock->tx_lock);
984 ret = sock_xmit(nbd, i, 1, &from, 0, NULL); 988 ret = sock_xmit(nbd, i, 1, &from, 0, NULL);
985 if (ret <= 0) 989 if (ret <= 0)
986 dev_err(disk_to_dev(nbd->disk), 990 dev_err(disk_to_dev(nbd->disk),
987 "Send disconnect failed %d\n", ret); 991 "Send disconnect failed %d\n", ret);
992 mutex_unlock(&nsock->tx_lock);
988 } 993 }
989} 994}
990 995
@@ -993,9 +998,8 @@ static int nbd_disconnect(struct nbd_device *nbd)
993 struct nbd_config *config = nbd->config; 998 struct nbd_config *config = nbd->config;
994 999
995 dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n"); 1000 dev_info(disk_to_dev(nbd->disk), "NBD_DISCONNECT\n");
996 if (!test_and_set_bit(NBD_DISCONNECT_REQUESTED, 1001 set_bit(NBD_DISCONNECT_REQUESTED, &config->runtime_flags);
997 &config->runtime_flags)) 1002 send_disconnects(nbd);
998 send_disconnects(nbd);
999 return 0; 1003 return 0;
1000} 1004}
1001 1005
@@ -1076,7 +1080,9 @@ static int nbd_start_device(struct nbd_device *nbd)
1076 return -ENOMEM; 1080 return -ENOMEM;
1077 } 1081 }
1078 sk_set_memalloc(config->socks[i]->sock->sk); 1082 sk_set_memalloc(config->socks[i]->sock->sk);
1079 config->socks[i]->sock->sk->sk_sndtimeo = nbd->tag_set.timeout; 1083 if (nbd->tag_set.timeout)
1084 config->socks[i]->sock->sk->sk_sndtimeo =
1085 nbd->tag_set.timeout;
1080 atomic_inc(&config->recv_threads); 1086 atomic_inc(&config->recv_threads);
1081 refcount_inc(&nbd->config_refs); 1087 refcount_inc(&nbd->config_refs);
1082 INIT_WORK(&args->work, recv_work); 1088 INIT_WORK(&args->work, recv_work);
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 4e02aa5fdac0..1498b899a593 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -541,12 +541,9 @@ virtblk_cache_type_store(struct device *dev, struct device_attribute *attr,
541 int i; 541 int i;
542 542
543 BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE)); 543 BUG_ON(!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_CONFIG_WCE));
544 for (i = ARRAY_SIZE(virtblk_cache_types); --i >= 0; ) 544 i = sysfs_match_string(virtblk_cache_types, buf);
545 if (sysfs_streq(buf, virtblk_cache_types[i]))
546 break;
547
548 if (i < 0) 545 if (i < 0)
549 return -EINVAL; 546 return i;
550 547
551 virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i); 548 virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
552 virtblk_update_cache_mode(vdev); 549 virtblk_update_cache_mode(vdev);
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index c852ed3c01d5..98e34e4c62b8 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -111,7 +111,7 @@ struct blk_shadow {
111}; 111};
112 112
113struct blkif_req { 113struct blkif_req {
114 int error; 114 blk_status_t error;
115}; 115};
116 116
117static inline struct blkif_req *blkif_req(struct request *rq) 117static inline struct blkif_req *blkif_req(struct request *rq)
@@ -708,6 +708,7 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
708 * existing persistent grants, or if we have to get new grants, 708 * existing persistent grants, or if we have to get new grants,
709 * as there are not sufficiently many free. 709 * as there are not sufficiently many free.
710 */ 710 */
711 bool new_persistent_gnts = false;
711 struct scatterlist *sg; 712 struct scatterlist *sg;
712 int num_sg, max_grefs, num_grant; 713 int num_sg, max_grefs, num_grant;
713 714
@@ -719,19 +720,21 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
719 */ 720 */
720 max_grefs += INDIRECT_GREFS(max_grefs); 721 max_grefs += INDIRECT_GREFS(max_grefs);
721 722
722 /* 723 /* Check if we have enough persistent grants to allocate a requests */
723 * We have to reserve 'max_grefs' grants because persistent 724 if (rinfo->persistent_gnts_c < max_grefs) {
724 * grants are shared by all rings. 725 new_persistent_gnts = true;
725 */ 726
726 if (max_grefs > 0) 727 if (gnttab_alloc_grant_references(
727 if (gnttab_alloc_grant_references(max_grefs, &setup.gref_head) < 0) { 728 max_grefs - rinfo->persistent_gnts_c,
729 &setup.gref_head) < 0) {
728 gnttab_request_free_callback( 730 gnttab_request_free_callback(
729 &rinfo->callback, 731 &rinfo->callback,
730 blkif_restart_queue_callback, 732 blkif_restart_queue_callback,
731 rinfo, 733 rinfo,
732 max_grefs); 734 max_grefs - rinfo->persistent_gnts_c);
733 return 1; 735 return 1;
734 } 736 }
737 }
735 738
736 /* Fill out a communications ring structure. */ 739 /* Fill out a communications ring structure. */
737 id = blkif_ring_get_request(rinfo, req, &ring_req); 740 id = blkif_ring_get_request(rinfo, req, &ring_req);
@@ -832,7 +835,7 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri
832 if (unlikely(require_extra_req)) 835 if (unlikely(require_extra_req))
833 rinfo->shadow[extra_id].req = *extra_ring_req; 836 rinfo->shadow[extra_id].req = *extra_ring_req;
834 837
835 if (max_grefs > 0) 838 if (new_persistent_gnts)
836 gnttab_free_grant_references(setup.gref_head); 839 gnttab_free_grant_references(setup.gref_head);
837 840
838 return 0; 841 return 0;
@@ -906,8 +909,8 @@ out_err:
906 return BLK_STS_IOERR; 909 return BLK_STS_IOERR;
907 910
908out_busy: 911out_busy:
909 spin_unlock_irqrestore(&rinfo->ring_lock, flags);
910 blk_mq_stop_hw_queue(hctx); 912 blk_mq_stop_hw_queue(hctx);
913 spin_unlock_irqrestore(&rinfo->ring_lock, flags);
911 return BLK_STS_RESOURCE; 914 return BLK_STS_RESOURCE;
912} 915}
913 916
@@ -1616,7 +1619,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
1616 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) { 1619 if (unlikely(bret->status == BLKIF_RSP_EOPNOTSUPP)) {
1617 printk(KERN_WARNING "blkfront: %s: %s op failed\n", 1620 printk(KERN_WARNING "blkfront: %s: %s op failed\n",
1618 info->gd->disk_name, op_name(bret->operation)); 1621 info->gd->disk_name, op_name(bret->operation));
1619 blkif_req(req)->error = -EOPNOTSUPP; 1622 blkif_req(req)->error = BLK_STS_NOTSUPP;
1620 } 1623 }
1621 if (unlikely(bret->status == BLKIF_RSP_ERROR && 1624 if (unlikely(bret->status == BLKIF_RSP_ERROR &&
1622 rinfo->shadow[id].req.u.rw.nr_segments == 0)) { 1625 rinfo->shadow[id].req.u.rw.nr_segments == 0)) {
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index f6e7491c873c..d509b500a7b5 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -41,8 +41,16 @@ static __init int timer_irq_init(struct device_node *np,
41 struct timer_of *to = container_of(of_irq, struct timer_of, of_irq); 41 struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
42 struct clock_event_device *clkevt = &to->clkevt; 42 struct clock_event_device *clkevt = &to->clkevt;
43 43
44 of_irq->irq = of_irq->name ? of_irq_get_byname(np, of_irq->name): 44 if (of_irq->name) {
45 irq_of_parse_and_map(np, of_irq->index); 45 of_irq->irq = ret = of_irq_get_byname(np, of_irq->name);
46 if (ret < 0) {
47 pr_err("Failed to get interrupt %s for %s\n",
48 of_irq->name, np->full_name);
49 return ret;
50 }
51 } else {
52 of_irq->irq = irq_of_parse_and_map(np, of_irq->index);
53 }
46 if (!of_irq->irq) { 54 if (!of_irq->irq) {
47 pr_err("Failed to map interrupt for %s\n", np->full_name); 55 pr_err("Failed to map interrupt for %s\n", np->full_name);
48 return -EINVAL; 56 return -EINVAL;
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index b7fb8b7c980d..6cd503525638 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -225,6 +225,9 @@ struct global_params {
225 * @vid: Stores VID limits for this CPU 225 * @vid: Stores VID limits for this CPU
226 * @pid: Stores PID parameters for this CPU 226 * @pid: Stores PID parameters for this CPU
227 * @last_sample_time: Last Sample time 227 * @last_sample_time: Last Sample time
228 * @aperf_mperf_shift: Number of clock cycles after aperf, merf is incremented
229 * This shift is a multiplier to mperf delta to
230 * calculate CPU busy.
228 * @prev_aperf: Last APERF value read from APERF MSR 231 * @prev_aperf: Last APERF value read from APERF MSR
229 * @prev_mperf: Last MPERF value read from MPERF MSR 232 * @prev_mperf: Last MPERF value read from MPERF MSR
230 * @prev_tsc: Last timestamp counter (TSC) value 233 * @prev_tsc: Last timestamp counter (TSC) value
@@ -259,6 +262,7 @@ struct cpudata {
259 262
260 u64 last_update; 263 u64 last_update;
261 u64 last_sample_time; 264 u64 last_sample_time;
265 u64 aperf_mperf_shift;
262 u64 prev_aperf; 266 u64 prev_aperf;
263 u64 prev_mperf; 267 u64 prev_mperf;
264 u64 prev_tsc; 268 u64 prev_tsc;
@@ -321,6 +325,7 @@ struct pstate_funcs {
321 int (*get_min)(void); 325 int (*get_min)(void);
322 int (*get_turbo)(void); 326 int (*get_turbo)(void);
323 int (*get_scaling)(void); 327 int (*get_scaling)(void);
328 int (*get_aperf_mperf_shift)(void);
324 u64 (*get_val)(struct cpudata*, int pstate); 329 u64 (*get_val)(struct cpudata*, int pstate);
325 void (*get_vid)(struct cpudata *); 330 void (*get_vid)(struct cpudata *);
326 void (*update_util)(struct update_util_data *data, u64 time, 331 void (*update_util)(struct update_util_data *data, u64 time,
@@ -1486,6 +1491,11 @@ static u64 core_get_val(struct cpudata *cpudata, int pstate)
1486 return val; 1491 return val;
1487} 1492}
1488 1493
1494static int knl_get_aperf_mperf_shift(void)
1495{
1496 return 10;
1497}
1498
1489static int knl_get_turbo_pstate(void) 1499static int knl_get_turbo_pstate(void)
1490{ 1500{
1491 u64 value; 1501 u64 value;
@@ -1543,6 +1553,9 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu)
1543 cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling; 1553 cpu->pstate.max_freq = cpu->pstate.max_pstate * cpu->pstate.scaling;
1544 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling; 1554 cpu->pstate.turbo_freq = cpu->pstate.turbo_pstate * cpu->pstate.scaling;
1545 1555
1556 if (pstate_funcs.get_aperf_mperf_shift)
1557 cpu->aperf_mperf_shift = pstate_funcs.get_aperf_mperf_shift();
1558
1546 if (pstate_funcs.get_vid) 1559 if (pstate_funcs.get_vid)
1547 pstate_funcs.get_vid(cpu); 1560 pstate_funcs.get_vid(cpu);
1548 1561
@@ -1616,7 +1629,8 @@ static inline int32_t get_target_pstate_use_cpu_load(struct cpudata *cpu)
1616 int32_t busy_frac, boost; 1629 int32_t busy_frac, boost;
1617 int target, avg_pstate; 1630 int target, avg_pstate;
1618 1631
1619 busy_frac = div_fp(sample->mperf, sample->tsc); 1632 busy_frac = div_fp(sample->mperf << cpu->aperf_mperf_shift,
1633 sample->tsc);
1620 1634
1621 boost = cpu->iowait_boost; 1635 boost = cpu->iowait_boost;
1622 cpu->iowait_boost >>= 1; 1636 cpu->iowait_boost >>= 1;
@@ -1675,7 +1689,8 @@ static inline int32_t get_target_pstate_use_performance(struct cpudata *cpu)
1675 sample_ratio = div_fp(pid_params.sample_rate_ns, duration_ns); 1689 sample_ratio = div_fp(pid_params.sample_rate_ns, duration_ns);
1676 perf_scaled = mul_fp(perf_scaled, sample_ratio); 1690 perf_scaled = mul_fp(perf_scaled, sample_ratio);
1677 } else { 1691 } else {
1678 sample_ratio = div_fp(100 * cpu->sample.mperf, cpu->sample.tsc); 1692 sample_ratio = div_fp(100 * (cpu->sample.mperf << cpu->aperf_mperf_shift),
1693 cpu->sample.tsc);
1679 if (sample_ratio < int_tofp(1)) 1694 if (sample_ratio < int_tofp(1))
1680 perf_scaled = 0; 1695 perf_scaled = 0;
1681 } 1696 }
@@ -1807,6 +1822,7 @@ static const struct pstate_funcs knl_funcs = {
1807 .get_max_physical = core_get_max_pstate_physical, 1822 .get_max_physical = core_get_max_pstate_physical,
1808 .get_min = core_get_min_pstate, 1823 .get_min = core_get_min_pstate,
1809 .get_turbo = knl_get_turbo_pstate, 1824 .get_turbo = knl_get_turbo_pstate,
1825 .get_aperf_mperf_shift = knl_get_aperf_mperf_shift,
1810 .get_scaling = core_get_scaling, 1826 .get_scaling = core_get_scaling,
1811 .get_val = core_get_val, 1827 .get_val = core_get_val,
1812 .update_util = intel_pstate_update_util_pid, 1828 .update_util = intel_pstate_update_util_pid,
@@ -2403,6 +2419,7 @@ static void __init copy_cpu_funcs(struct pstate_funcs *funcs)
2403 pstate_funcs.get_val = funcs->get_val; 2419 pstate_funcs.get_val = funcs->get_val;
2404 pstate_funcs.get_vid = funcs->get_vid; 2420 pstate_funcs.get_vid = funcs->get_vid;
2405 pstate_funcs.update_util = funcs->update_util; 2421 pstate_funcs.update_util = funcs->update_util;
2422 pstate_funcs.get_aperf_mperf_shift = funcs->get_aperf_mperf_shift;
2406 2423
2407 intel_pstate_use_acpi_profile(); 2424 intel_pstate_use_acpi_profile();
2408} 2425}
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 193204dfbf3a..4b75084fabad 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -655,7 +655,7 @@ source "drivers/crypto/virtio/Kconfig"
655config CRYPTO_DEV_BCM_SPU 655config CRYPTO_DEV_BCM_SPU
656 tristate "Broadcom symmetric crypto/hash acceleration support" 656 tristate "Broadcom symmetric crypto/hash acceleration support"
657 depends on ARCH_BCM_IPROC 657 depends on ARCH_BCM_IPROC
658 depends on BCM_PDC_MBOX 658 depends on MAILBOX
659 default m 659 default m
660 select CRYPTO_DES 660 select CRYPTO_DES
661 select CRYPTO_MD5 661 select CRYPTO_MD5
diff --git a/drivers/crypto/bcm/spu2.c b/drivers/crypto/bcm/spu2.c
index ef04c9748317..bf7ac621c591 100644
--- a/drivers/crypto/bcm/spu2.c
+++ b/drivers/crypto/bcm/spu2.c
@@ -302,6 +302,7 @@ spu2_hash_xlate(enum hash_alg hash_alg, enum hash_mode hash_mode,
302 break; 302 break;
303 case HASH_ALG_SHA3_512: 303 case HASH_ALG_SHA3_512:
304 *spu2_type = SPU2_HASH_TYPE_SHA3_512; 304 *spu2_type = SPU2_HASH_TYPE_SHA3_512;
305 break;
305 case HASH_ALG_LAST: 306 case HASH_ALG_LAST:
306 default: 307 default:
307 err = -EINVAL; 308 err = -EINVAL;
diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c
index ae44a464cd2d..9ccefb9b7232 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_main.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
@@ -18,8 +18,9 @@
18#define SE_GROUP 0 18#define SE_GROUP 0
19 19
20#define DRIVER_VERSION "1.0" 20#define DRIVER_VERSION "1.0"
21#define FW_DIR "cavium/"
21/* SE microcode */ 22/* SE microcode */
22#define SE_FW "cnn55xx_se.fw" 23#define SE_FW FW_DIR "cnn55xx_se.fw"
23 24
24static const char nitrox_driver_name[] = "CNN55XX"; 25static const char nitrox_driver_name[] = "CNN55XX";
25 26
diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index e7f87ac12685..1fabd4aee81b 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -773,7 +773,6 @@ static int safexcel_probe(struct platform_device *pdev)
773 struct device *dev = &pdev->dev; 773 struct device *dev = &pdev->dev;
774 struct resource *res; 774 struct resource *res;
775 struct safexcel_crypto_priv *priv; 775 struct safexcel_crypto_priv *priv;
776 u64 dma_mask;
777 int i, ret; 776 int i, ret;
778 777
779 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 778 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -802,9 +801,7 @@ static int safexcel_probe(struct platform_device *pdev)
802 return -EPROBE_DEFER; 801 return -EPROBE_DEFER;
803 } 802 }
804 803
805 if (of_property_read_u64(dev->of_node, "dma-mask", &dma_mask)) 804 ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
806 dma_mask = DMA_BIT_MASK(64);
807 ret = dma_set_mask_and_coherent(dev, dma_mask);
808 if (ret) 805 if (ret)
809 goto err_clk; 806 goto err_clk;
810 807
diff --git a/drivers/dax/device-dax.h b/drivers/dax/device-dax.h
index fdcd9769ffde..688b051750bd 100644
--- a/drivers/dax/device-dax.h
+++ b/drivers/dax/device-dax.h
@@ -21,5 +21,5 @@ struct dax_region *alloc_dax_region(struct device *parent,
21 int region_id, struct resource *res, unsigned int align, 21 int region_id, struct resource *res, unsigned int align,
22 void *addr, unsigned long flags); 22 void *addr, unsigned long flags);
23struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region, 23struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
24 struct resource *res, int count); 24 int id, struct resource *res, int count);
25#endif /* __DEVICE_DAX_H__ */ 25#endif /* __DEVICE_DAX_H__ */
diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index 12943d19bfc4..e9f3b3e4bbf4 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -529,7 +529,8 @@ static void dev_dax_release(struct device *dev)
529 struct dax_region *dax_region = dev_dax->region; 529 struct dax_region *dax_region = dev_dax->region;
530 struct dax_device *dax_dev = dev_dax->dax_dev; 530 struct dax_device *dax_dev = dev_dax->dax_dev;
531 531
532 ida_simple_remove(&dax_region->ida, dev_dax->id); 532 if (dev_dax->id >= 0)
533 ida_simple_remove(&dax_region->ida, dev_dax->id);
533 dax_region_put(dax_region); 534 dax_region_put(dax_region);
534 put_dax(dax_dev); 535 put_dax(dax_dev);
535 kfree(dev_dax); 536 kfree(dev_dax);
@@ -559,7 +560,7 @@ static void unregister_dev_dax(void *dev)
559} 560}
560 561
561struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region, 562struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
562 struct resource *res, int count) 563 int id, struct resource *res, int count)
563{ 564{
564 struct device *parent = dax_region->dev; 565 struct device *parent = dax_region->dev;
565 struct dax_device *dax_dev; 566 struct dax_device *dax_dev;
@@ -567,7 +568,10 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
567 struct inode *inode; 568 struct inode *inode;
568 struct device *dev; 569 struct device *dev;
569 struct cdev *cdev; 570 struct cdev *cdev;
570 int rc = 0, i; 571 int rc, i;
572
573 if (!count)
574 return ERR_PTR(-EINVAL);
571 575
572 dev_dax = kzalloc(sizeof(*dev_dax) + sizeof(*res) * count, GFP_KERNEL); 576 dev_dax = kzalloc(sizeof(*dev_dax) + sizeof(*res) * count, GFP_KERNEL);
573 if (!dev_dax) 577 if (!dev_dax)
@@ -587,10 +591,16 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
587 if (i < count) 591 if (i < count)
588 goto err_id; 592 goto err_id;
589 593
590 dev_dax->id = ida_simple_get(&dax_region->ida, 0, 0, GFP_KERNEL); 594 if (id < 0) {
591 if (dev_dax->id < 0) { 595 id = ida_simple_get(&dax_region->ida, 0, 0, GFP_KERNEL);
592 rc = dev_dax->id; 596 dev_dax->id = id;
593 goto err_id; 597 if (id < 0) {
598 rc = id;
599 goto err_id;
600 }
601 } else {
602 /* region provider owns @id lifetime */
603 dev_dax->id = -1;
594 } 604 }
595 605
596 /* 606 /*
@@ -598,8 +608,10 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
598 * device outside of mmap of the resulting character device. 608 * device outside of mmap of the resulting character device.
599 */ 609 */
600 dax_dev = alloc_dax(dev_dax, NULL, NULL); 610 dax_dev = alloc_dax(dev_dax, NULL, NULL);
601 if (!dax_dev) 611 if (!dax_dev) {
612 rc = -ENOMEM;
602 goto err_dax; 613 goto err_dax;
614 }
603 615
604 /* from here on we're committed to teardown via dax_dev_release() */ 616 /* from here on we're committed to teardown via dax_dev_release() */
605 dev = &dev_dax->dev; 617 dev = &dev_dax->dev;
@@ -620,7 +632,7 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
620 dev->parent = parent; 632 dev->parent = parent;
621 dev->groups = dax_attribute_groups; 633 dev->groups = dax_attribute_groups;
622 dev->release = dev_dax_release; 634 dev->release = dev_dax_release;
623 dev_set_name(dev, "dax%d.%d", dax_region->id, dev_dax->id); 635 dev_set_name(dev, "dax%d.%d", dax_region->id, id);
624 636
625 rc = cdev_device_add(cdev, dev); 637 rc = cdev_device_add(cdev, dev);
626 if (rc) { 638 if (rc) {
@@ -636,7 +648,8 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
636 return dev_dax; 648 return dev_dax;
637 649
638 err_dax: 650 err_dax:
639 ida_simple_remove(&dax_region->ida, dev_dax->id); 651 if (dev_dax->id >= 0)
652 ida_simple_remove(&dax_region->ida, dev_dax->id);
640 err_id: 653 err_id:
641 kfree(dev_dax); 654 kfree(dev_dax);
642 655
diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c
index 9f2a0b4fd801..8d8c852ba8f2 100644
--- a/drivers/dax/pmem.c
+++ b/drivers/dax/pmem.c
@@ -58,13 +58,12 @@ static void dax_pmem_percpu_kill(void *data)
58 58
59static int dax_pmem_probe(struct device *dev) 59static int dax_pmem_probe(struct device *dev)
60{ 60{
61 int rc;
62 void *addr; 61 void *addr;
63 struct resource res; 62 struct resource res;
63 int rc, id, region_id;
64 struct nd_pfn_sb *pfn_sb; 64 struct nd_pfn_sb *pfn_sb;
65 struct dev_dax *dev_dax; 65 struct dev_dax *dev_dax;
66 struct dax_pmem *dax_pmem; 66 struct dax_pmem *dax_pmem;
67 struct nd_region *nd_region;
68 struct nd_namespace_io *nsio; 67 struct nd_namespace_io *nsio;
69 struct dax_region *dax_region; 68 struct dax_region *dax_region;
70 struct nd_namespace_common *ndns; 69 struct nd_namespace_common *ndns;
@@ -123,14 +122,17 @@ static int dax_pmem_probe(struct device *dev)
123 /* adjust the dax_region resource to the start of data */ 122 /* adjust the dax_region resource to the start of data */
124 res.start += le64_to_cpu(pfn_sb->dataoff); 123 res.start += le64_to_cpu(pfn_sb->dataoff);
125 124
126 nd_region = to_nd_region(dev->parent); 125 rc = sscanf(dev_name(&ndns->dev), "namespace%d.%d", &region_id, &id);
127 dax_region = alloc_dax_region(dev, nd_region->id, &res, 126 if (rc != 2)
127 return -EINVAL;
128
129 dax_region = alloc_dax_region(dev, region_id, &res,
128 le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP); 130 le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP);
129 if (!dax_region) 131 if (!dax_region)
130 return -ENOMEM; 132 return -ENOMEM;
131 133
132 /* TODO: support for subdividing a dax region... */ 134 /* TODO: support for subdividing a dax region... */
133 dev_dax = devm_create_dev_dax(dax_region, &res, 1); 135 dev_dax = devm_create_dev_dax(dax_region, id, &res, 1);
134 136
135 /* child dev_dax instances now own the lifetime of the dax_region */ 137 /* child dev_dax instances now own the lifetime of the dax_region */
136 dax_region_put(dax_region); 138 dax_region_put(dax_region);
diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index ce9e563e6e1d..938eb4868f7f 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -278,6 +278,12 @@ void dax_write_cache(struct dax_device *dax_dev, bool wc)
278} 278}
279EXPORT_SYMBOL_GPL(dax_write_cache); 279EXPORT_SYMBOL_GPL(dax_write_cache);
280 280
281bool dax_write_cache_enabled(struct dax_device *dax_dev)
282{
283 return test_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags);
284}
285EXPORT_SYMBOL_GPL(dax_write_cache_enabled);
286
281bool dax_alive(struct dax_device *dax_dev) 287bool dax_alive(struct dax_device *dax_dev)
282{ 288{
283 lockdep_assert_held(&dax_srcu); 289 lockdep_assert_held(&dax_srcu);
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 57da14c15987..56e0a0e1b600 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -75,11 +75,6 @@ int dma_fence_signal_locked(struct dma_fence *fence)
75 if (WARN_ON(!fence)) 75 if (WARN_ON(!fence))
76 return -EINVAL; 76 return -EINVAL;
77 77
78 if (!ktime_to_ns(fence->timestamp)) {
79 fence->timestamp = ktime_get();
80 smp_mb__before_atomic();
81 }
82
83 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { 78 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
84 ret = -EINVAL; 79 ret = -EINVAL;
85 80
@@ -87,8 +82,11 @@ int dma_fence_signal_locked(struct dma_fence *fence)
87 * we might have raced with the unlocked dma_fence_signal, 82 * we might have raced with the unlocked dma_fence_signal,
88 * still run through all callbacks 83 * still run through all callbacks
89 */ 84 */
90 } else 85 } else {
86 fence->timestamp = ktime_get();
87 set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
91 trace_dma_fence_signaled(fence); 88 trace_dma_fence_signaled(fence);
89 }
92 90
93 list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) { 91 list_for_each_entry_safe(cur, tmp, &fence->cb_list, node) {
94 list_del_init(&cur->node); 92 list_del_init(&cur->node);
@@ -115,14 +113,11 @@ int dma_fence_signal(struct dma_fence *fence)
115 if (!fence) 113 if (!fence)
116 return -EINVAL; 114 return -EINVAL;
117 115
118 if (!ktime_to_ns(fence->timestamp)) {
119 fence->timestamp = ktime_get();
120 smp_mb__before_atomic();
121 }
122
123 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) 116 if (test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
124 return -EINVAL; 117 return -EINVAL;
125 118
119 fence->timestamp = ktime_get();
120 set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
126 trace_dma_fence_signaled(fence); 121 trace_dma_fence_signaled(fence);
127 122
128 if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) { 123 if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags)) {
diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 82a6e7f6d37f..59a3b2f8ee91 100644
--- a/drivers/dma-buf/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -84,7 +84,7 @@ static void sync_print_fence(struct seq_file *s,
84 show ? "_" : "", 84 show ? "_" : "",
85 sync_status_str(status)); 85 sync_status_str(status));
86 86
87 if (status) { 87 if (test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags)) {
88 struct timespec64 ts64 = 88 struct timespec64 ts64 =
89 ktime_to_timespec64(fence->timestamp); 89 ktime_to_timespec64(fence->timestamp);
90 90
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 545e2c5c4815..d7e219d2669d 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -391,7 +391,13 @@ static void sync_fill_fence_info(struct dma_fence *fence,
391 sizeof(info->driver_name)); 391 sizeof(info->driver_name));
392 392
393 info->status = dma_fence_get_status(fence); 393 info->status = dma_fence_get_status(fence);
394 info->timestamp_ns = ktime_to_ns(fence->timestamp); 394 while (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
395 !test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
396 cpu_relax();
397 info->timestamp_ns =
398 test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags) ?
399 ktime_to_ns(fence->timestamp) :
400 ktime_set(0, 0);
395} 401}
396 402
397static long sync_file_ioctl_fence_info(struct sync_file *sync_file, 403static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index a485864cb512..06432d84cbf8 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -532,7 +532,7 @@ static inline uint32_t fsi_smode_sid(int x)
532 return (x & FSI_SMODE_SID_MASK) << FSI_SMODE_SID_SHIFT; 532 return (x & FSI_SMODE_SID_MASK) << FSI_SMODE_SID_SHIFT;
533} 533}
534 534
535static const uint32_t fsi_slave_smode(int id) 535static uint32_t fsi_slave_smode(int id)
536{ 536{
537 return FSI_SMODE_WSC | FSI_SMODE_ECRC 537 return FSI_SMODE_WSC | FSI_SMODE_ECRC
538 | fsi_smode_sid(id) 538 | fsi_smode_sid(id)
@@ -883,17 +883,16 @@ struct bus_type fsi_bus_type = {
883}; 883};
884EXPORT_SYMBOL_GPL(fsi_bus_type); 884EXPORT_SYMBOL_GPL(fsi_bus_type);
885 885
886static int fsi_init(void) 886static int __init fsi_init(void)
887{ 887{
888 return bus_register(&fsi_bus_type); 888 return bus_register(&fsi_bus_type);
889} 889}
890postcore_initcall(fsi_init);
890 891
891static void fsi_exit(void) 892static void fsi_exit(void)
892{ 893{
893 bus_unregister(&fsi_bus_type); 894 bus_unregister(&fsi_bus_type);
894} 895}
895
896module_init(fsi_init);
897module_exit(fsi_exit); 896module_exit(fsi_exit);
898module_param(discard_errors, int, 0664); 897module_param(discard_errors, int, 0664);
899MODULE_LICENSE("GPL"); 898MODULE_LICENSE("GPL");
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index 5f8ada1d872b..37971d9402e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -101,7 +101,6 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
101 if (adev->kfd) { 101 if (adev->kfd) {
102 struct kgd2kfd_shared_resources gpu_resources = { 102 struct kgd2kfd_shared_resources gpu_resources = {
103 .compute_vmid_bitmap = 0xFF00, 103 .compute_vmid_bitmap = 0xFF00,
104 .num_mec = adev->gfx.mec.num_mec,
105 .num_pipe_per_mec = adev->gfx.mec.num_pipe_per_mec, 104 .num_pipe_per_mec = adev->gfx.mec.num_pipe_per_mec,
106 .num_queue_per_pipe = adev->gfx.mec.num_queue_per_pipe 105 .num_queue_per_pipe = adev->gfx.mec.num_queue_per_pipe
107 }; 106 };
@@ -122,7 +121,7 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
122 121
123 /* According to linux/bitmap.h we shouldn't use bitmap_clear if 122 /* According to linux/bitmap.h we shouldn't use bitmap_clear if
124 * nbits is not compile time constant */ 123 * nbits is not compile time constant */
125 last_valid_bit = adev->gfx.mec.num_mec 124 last_valid_bit = 1 /* only first MEC can have compute queues */
126 * adev->gfx.mec.num_pipe_per_mec 125 * adev->gfx.mec.num_pipe_per_mec
127 * adev->gfx.mec.num_queue_per_pipe; 126 * adev->gfx.mec.num_queue_per_pipe;
128 for (i = last_valid_bit; i < KGD_MAX_QUEUES; ++i) 127 for (i = last_valid_bit; i < KGD_MAX_QUEUES; ++i)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index f621ee115c98..5e771bc11b00 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -198,12 +198,16 @@ amdgpu_bo_list_get(struct amdgpu_fpriv *fpriv, int id)
198 result = idr_find(&fpriv->bo_list_handles, id); 198 result = idr_find(&fpriv->bo_list_handles, id);
199 199
200 if (result) { 200 if (result) {
201 if (kref_get_unless_zero(&result->refcount)) 201 if (kref_get_unless_zero(&result->refcount)) {
202 rcu_read_unlock();
202 mutex_lock(&result->lock); 203 mutex_lock(&result->lock);
203 else 204 } else {
205 rcu_read_unlock();
204 result = NULL; 206 result = NULL;
207 }
208 } else {
209 rcu_read_unlock();
205 } 210 }
206 rcu_read_unlock();
207 211
208 return result; 212 return result;
209} 213}
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 3a0b69b09ed6..c9b9c88231aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1475,21 +1475,23 @@ static void gfx_v9_0_tiling_mode_table_init(struct amdgpu_device *adev)
1475 1475
1476static void gfx_v9_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num, u32 instance) 1476static void gfx_v9_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num, u32 instance)
1477{ 1477{
1478 u32 data = REG_SET_FIELD(0, GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES, 1); 1478 u32 data;
1479 1479
1480 if ((se_num == 0xffffffff) && (sh_num == 0xffffffff)) { 1480 if (instance == 0xffffffff)
1481 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_BROADCAST_WRITES, 1); 1481 data = REG_SET_FIELD(0, GRBM_GFX_INDEX, INSTANCE_BROADCAST_WRITES, 1);
1482 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_BROADCAST_WRITES, 1); 1482 else
1483 } else if (se_num == 0xffffffff) { 1483 data = REG_SET_FIELD(0, GRBM_GFX_INDEX, INSTANCE_INDEX, instance);
1484 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_INDEX, sh_num); 1484
1485 if (se_num == 0xffffffff)
1485 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_BROADCAST_WRITES, 1); 1486 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_BROADCAST_WRITES, 1);
1486 } else if (sh_num == 0xffffffff) { 1487 else
1487 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_BROADCAST_WRITES, 1);
1488 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_INDEX, se_num); 1488 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_INDEX, se_num);
1489 } else { 1489
1490 if (sh_num == 0xffffffff)
1491 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_BROADCAST_WRITES, 1);
1492 else
1490 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_INDEX, sh_num); 1493 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SH_INDEX, sh_num);
1491 data = REG_SET_FIELD(data, GRBM_GFX_INDEX, SE_INDEX, se_num); 1494
1492 }
1493 WREG32_SOC15(GC, 0, mmGRBM_GFX_INDEX, data); 1495 WREG32_SOC15(GC, 0, mmGRBM_GFX_INDEX, data);
1494} 1496}
1495 1497
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 88187bfc5ea3..3f95f7cb4019 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -226,10 +226,6 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
226 226
227 kfd->shared_resources = *gpu_resources; 227 kfd->shared_resources = *gpu_resources;
228 228
229 /* We only use the first MEC */
230 if (kfd->shared_resources.num_mec > 1)
231 kfd->shared_resources.num_mec = 1;
232
233 /* calculate max size of mqds needed for queues */ 229 /* calculate max size of mqds needed for queues */
234 size = max_num_of_queues_per_device * 230 size = max_num_of_queues_per_device *
235 kfd->device_info->mqd_size_aligned; 231 kfd->device_info->mqd_size_aligned;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 955aa304ff48..602769ced3bd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -77,13 +77,6 @@ static bool is_pipe_enabled(struct device_queue_manager *dqm, int mec, int pipe)
77 return false; 77 return false;
78} 78}
79 79
80unsigned int get_mec_num(struct device_queue_manager *dqm)
81{
82 BUG_ON(!dqm || !dqm->dev);
83
84 return dqm->dev->shared_resources.num_mec;
85}
86
87unsigned int get_queues_num(struct device_queue_manager *dqm) 80unsigned int get_queues_num(struct device_queue_manager *dqm)
88{ 81{
89 BUG_ON(!dqm || !dqm->dev); 82 BUG_ON(!dqm || !dqm->dev);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
index 66b9615bc3c1..faf820a06400 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h
@@ -180,7 +180,6 @@ void device_queue_manager_init_cik(struct device_queue_manager_asic_ops *ops);
180void device_queue_manager_init_vi(struct device_queue_manager_asic_ops *ops); 180void device_queue_manager_init_vi(struct device_queue_manager_asic_ops *ops);
181void program_sh_mem_settings(struct device_queue_manager *dqm, 181void program_sh_mem_settings(struct device_queue_manager *dqm,
182 struct qcm_process_device *qpd); 182 struct qcm_process_device *qpd);
183unsigned int get_mec_num(struct device_queue_manager *dqm);
184unsigned int get_queues_num(struct device_queue_manager *dqm); 183unsigned int get_queues_num(struct device_queue_manager *dqm);
185unsigned int get_queues_per_pipe(struct device_queue_manager *dqm); 184unsigned int get_queues_per_pipe(struct device_queue_manager *dqm);
186unsigned int get_pipes_per_mec(struct device_queue_manager *dqm); 185unsigned int get_pipes_per_mec(struct device_queue_manager *dqm);
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index 91ef1484b3bb..36f376677a53 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -63,9 +63,6 @@ struct kgd2kfd_shared_resources {
63 /* Bit n == 1 means VMID n is available for KFD. */ 63 /* Bit n == 1 means VMID n is available for KFD. */
64 unsigned int compute_vmid_bitmap; 64 unsigned int compute_vmid_bitmap;
65 65
66 /* number of mec available from the hardware */
67 uint32_t num_mec;
68
69 /* number of pipes per mec */ 66 /* number of pipes per mec */
70 uint32_t num_pipe_per_mec; 67 uint32_t num_pipe_per_mec;
71 68
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index d6f097f44b6c..197174e562d2 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -2128,15 +2128,9 @@ static int vega10_populate_avfs_parameters(struct pp_hwmgr *hwmgr)
2128 pp_table->AvfsGbCksOff.m2_shift = 12; 2128 pp_table->AvfsGbCksOff.m2_shift = 12;
2129 pp_table->AvfsGbCksOff.b_shift = 0; 2129 pp_table->AvfsGbCksOff.b_shift = 0;
2130 2130
2131 for (i = 0; i < dep_table->count; i++) { 2131 for (i = 0; i < dep_table->count; i++)
2132 if (dep_table->entries[i].sclk_offset == 0) 2132 pp_table->StaticVoltageOffsetVid[i] =
2133 pp_table->StaticVoltageOffsetVid[i] = 248; 2133 convert_to_vid((uint8_t)(dep_table->entries[i].sclk_offset));
2134 else
2135 pp_table->StaticVoltageOffsetVid[i] =
2136 (uint8_t)(dep_table->entries[i].sclk_offset *
2137 VOLTAGE_VID_OFFSET_SCALE2 /
2138 VOLTAGE_VID_OFFSET_SCALE1);
2139 }
2140 2134
2141 if ((PPREGKEY_VEGA10QUADRATICEQUATION_DFLT != 2135 if ((PPREGKEY_VEGA10QUADRATICEQUATION_DFLT !=
2142 data->disp_clk_quad_eqn_a) && 2136 data->disp_clk_quad_eqn_a) &&
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 213fb837e1c4..08af8d6b844b 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -544,7 +544,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
544 DP_DETAILED_CAP_INFO_AVAILABLE; 544 DP_DETAILED_CAP_INFO_AVAILABLE;
545 int clk; 545 int clk;
546 int bpc; 546 int bpc;
547 char id[6]; 547 char id[7];
548 int len; 548 int len;
549 uint8_t rev[2]; 549 uint8_t rev[2];
550 int type = port_cap[0] & DP_DS_PORT_TYPE_MASK; 550 int type = port_cap[0] & DP_DS_PORT_TYPE_MASK;
@@ -583,6 +583,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
583 seq_puts(m, "\t\tType: N/A\n"); 583 seq_puts(m, "\t\tType: N/A\n");
584 } 584 }
585 585
586 memset(id, 0, sizeof(id));
586 drm_dp_downstream_id(aux, id); 587 drm_dp_downstream_id(aux, id);
587 seq_printf(m, "\t\tID: %s\n", id); 588 seq_printf(m, "\t\tID: %s\n", id);
588 589
@@ -591,7 +592,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
591 seq_printf(m, "\t\tHW: %d.%d\n", 592 seq_printf(m, "\t\tHW: %d.%d\n",
592 (rev[0] & 0xf0) >> 4, rev[0] & 0xf); 593 (rev[0] & 0xf0) >> 4, rev[0] & 0xf);
593 594
594 len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, &rev, 2); 595 len = drm_dp_dpcd_read(aux, DP_BRANCH_SW_REV, rev, 2);
595 if (len > 0) 596 if (len > 0)
596 seq_printf(m, "\t\tSW: %d.%d\n", rev[0], rev[1]); 597 seq_printf(m, "\t\tSW: %d.%d\n", rev[0], rev[1]);
597 598
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index bfd237c15e76..ae5f06895562 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -330,6 +330,13 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
330 return false; 330 return false;
331 } 331 }
332 332
333 /*
334 * ignore out-of-order messages or messages that are part of a
335 * failed transaction
336 */
337 if (!recv_hdr.somt && !msg->have_somt)
338 return false;
339
333 /* get length contained in this portion */ 340 /* get length contained in this portion */
334 msg->curchunk_len = recv_hdr.msg_len; 341 msg->curchunk_len = recv_hdr.msg_len;
335 msg->curchunk_hdrlen = hdrlen; 342 msg->curchunk_hdrlen = hdrlen;
@@ -2164,7 +2171,7 @@ out_unlock:
2164} 2171}
2165EXPORT_SYMBOL(drm_dp_mst_topology_mgr_resume); 2172EXPORT_SYMBOL(drm_dp_mst_topology_mgr_resume);
2166 2173
2167static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up) 2174static bool drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
2168{ 2175{
2169 int len; 2176 int len;
2170 u8 replyblock[32]; 2177 u8 replyblock[32];
@@ -2179,12 +2186,12 @@ static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
2179 replyblock, len); 2186 replyblock, len);
2180 if (ret != len) { 2187 if (ret != len) {
2181 DRM_DEBUG_KMS("failed to read DPCD down rep %d %d\n", len, ret); 2188 DRM_DEBUG_KMS("failed to read DPCD down rep %d %d\n", len, ret);
2182 return; 2189 return false;
2183 } 2190 }
2184 ret = drm_dp_sideband_msg_build(msg, replyblock, len, true); 2191 ret = drm_dp_sideband_msg_build(msg, replyblock, len, true);
2185 if (!ret) { 2192 if (!ret) {
2186 DRM_DEBUG_KMS("sideband msg build failed %d\n", replyblock[0]); 2193 DRM_DEBUG_KMS("sideband msg build failed %d\n", replyblock[0]);
2187 return; 2194 return false;
2188 } 2195 }
2189 replylen = msg->curchunk_len + msg->curchunk_hdrlen; 2196 replylen = msg->curchunk_len + msg->curchunk_hdrlen;
2190 2197
@@ -2196,21 +2203,32 @@ static void drm_dp_get_one_sb_msg(struct drm_dp_mst_topology_mgr *mgr, bool up)
2196 ret = drm_dp_dpcd_read(mgr->aux, basereg + curreply, 2203 ret = drm_dp_dpcd_read(mgr->aux, basereg + curreply,
2197 replyblock, len); 2204 replyblock, len);
2198 if (ret != len) { 2205 if (ret != len) {
2199 DRM_DEBUG_KMS("failed to read a chunk\n"); 2206 DRM_DEBUG_KMS("failed to read a chunk (len %d, ret %d)\n",
2207 len, ret);
2208 return false;
2200 } 2209 }
2210
2201 ret = drm_dp_sideband_msg_build(msg, replyblock, len, false); 2211 ret = drm_dp_sideband_msg_build(msg, replyblock, len, false);
2202 if (ret == false) 2212 if (!ret) {
2203 DRM_DEBUG_KMS("failed to build sideband msg\n"); 2213 DRM_DEBUG_KMS("failed to build sideband msg\n");
2214 return false;
2215 }
2216
2204 curreply += len; 2217 curreply += len;
2205 replylen -= len; 2218 replylen -= len;
2206 } 2219 }
2220 return true;
2207} 2221}
2208 2222
2209static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr) 2223static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
2210{ 2224{
2211 int ret = 0; 2225 int ret = 0;
2212 2226
2213 drm_dp_get_one_sb_msg(mgr, false); 2227 if (!drm_dp_get_one_sb_msg(mgr, false)) {
2228 memset(&mgr->down_rep_recv, 0,
2229 sizeof(struct drm_dp_sideband_msg_rx));
2230 return 0;
2231 }
2214 2232
2215 if (mgr->down_rep_recv.have_eomt) { 2233 if (mgr->down_rep_recv.have_eomt) {
2216 struct drm_dp_sideband_msg_tx *txmsg; 2234 struct drm_dp_sideband_msg_tx *txmsg;
@@ -2266,7 +2284,12 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
2266static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) 2284static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
2267{ 2285{
2268 int ret = 0; 2286 int ret = 0;
2269 drm_dp_get_one_sb_msg(mgr, true); 2287
2288 if (!drm_dp_get_one_sb_msg(mgr, true)) {
2289 memset(&mgr->up_req_recv, 0,
2290 sizeof(struct drm_dp_sideband_msg_rx));
2291 return 0;
2292 }
2270 2293
2271 if (mgr->up_req_recv.have_eomt) { 2294 if (mgr->up_req_recv.have_eomt) {
2272 struct drm_dp_sideband_msg_req_body msg; 2295 struct drm_dp_sideband_msg_req_body msg;
@@ -2318,7 +2341,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
2318 DRM_DEBUG_KMS("Got RSN: pn: %d avail_pbn %d\n", msg.u.resource_stat.port_number, msg.u.resource_stat.available_pbn); 2341 DRM_DEBUG_KMS("Got RSN: pn: %d avail_pbn %d\n", msg.u.resource_stat.port_number, msg.u.resource_stat.available_pbn);
2319 } 2342 }
2320 2343
2321 drm_dp_put_mst_branch_device(mstb); 2344 if (mstb)
2345 drm_dp_put_mst_branch_device(mstb);
2346
2322 memset(&mgr->up_req_recv, 0, sizeof(struct drm_dp_sideband_msg_rx)); 2347 memset(&mgr->up_req_recv, 0, sizeof(struct drm_dp_sideband_msg_rx));
2323 } 2348 }
2324 return ret; 2349 return ret;
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 1d185347c64c..305dc3d4ff77 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -75,6 +75,7 @@ config DRM_EXYNOS_DP
75config DRM_EXYNOS_HDMI 75config DRM_EXYNOS_HDMI
76 bool "HDMI" 76 bool "HDMI"
77 depends on DRM_EXYNOS_MIXER || DRM_EXYNOS5433_DECON 77 depends on DRM_EXYNOS_MIXER || DRM_EXYNOS5433_DECON
78 select CEC_CORE if CEC_NOTIFIER
78 help 79 help
79 Choose this option if you want to use Exynos HDMI for DRM. 80 Choose this option if you want to use Exynos HDMI for DRM.
80 81
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 35a8dfc93836..242bd50faa26 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -453,7 +453,6 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
453 struct component_match *match; 453 struct component_match *match;
454 454
455 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 455 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
456 exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
457 456
458 match = exynos_drm_match_add(&pdev->dev); 457 match = exynos_drm_match_add(&pdev->dev);
459 if (IS_ERR(match)) 458 if (IS_ERR(match))
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index a11b79596e2f..b6a46d9a016e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1651,8 +1651,6 @@ static int exynos_dsi_parse_dt(struct exynos_dsi *dsi)
1651 return ret; 1651 return ret;
1652 1652
1653 dsi->bridge_node = of_graph_get_remote_node(node, DSI_PORT_IN, 0); 1653 dsi->bridge_node = of_graph_get_remote_node(node, DSI_PORT_IN, 0);
1654 if (!dsi->bridge_node)
1655 return -EINVAL;
1656 1654
1657 return 0; 1655 return 0;
1658} 1656}
@@ -1687,9 +1685,11 @@ static int exynos_dsi_bind(struct device *dev, struct device *master,
1687 return ret; 1685 return ret;
1688 } 1686 }
1689 1687
1690 bridge = of_drm_find_bridge(dsi->bridge_node); 1688 if (dsi->bridge_node) {
1691 if (bridge) 1689 bridge = of_drm_find_bridge(dsi->bridge_node);
1692 drm_bridge_attach(encoder, bridge, NULL); 1690 if (bridge)
1691 drm_bridge_attach(encoder, bridge, NULL);
1692 }
1693 1693
1694 return mipi_dsi_host_register(&dsi->dsi_host); 1694 return mipi_dsi_host_register(&dsi->dsi_host);
1695} 1695}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index e45720543a45..16bbee897e0d 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -340,16 +340,10 @@ static int exynos_mic_bind(struct device *dev, struct device *master,
340 void *data) 340 void *data)
341{ 341{
342 struct exynos_mic *mic = dev_get_drvdata(dev); 342 struct exynos_mic *mic = dev_get_drvdata(dev);
343 int ret;
344 343
345 mic->bridge.funcs = &mic_bridge_funcs;
346 mic->bridge.of_node = dev->of_node;
347 mic->bridge.driver_private = mic; 344 mic->bridge.driver_private = mic;
348 ret = drm_bridge_add(&mic->bridge);
349 if (ret)
350 DRM_ERROR("mic: Failed to add MIC to the global bridge list\n");
351 345
352 return ret; 346 return 0;
353} 347}
354 348
355static void exynos_mic_unbind(struct device *dev, struct device *master, 349static void exynos_mic_unbind(struct device *dev, struct device *master,
@@ -365,8 +359,6 @@ static void exynos_mic_unbind(struct device *dev, struct device *master,
365 359
366already_disabled: 360already_disabled:
367 mutex_unlock(&mic_mutex); 361 mutex_unlock(&mic_mutex);
368
369 drm_bridge_remove(&mic->bridge);
370} 362}
371 363
372static const struct component_ops exynos_mic_component_ops = { 364static const struct component_ops exynos_mic_component_ops = {
@@ -461,6 +453,15 @@ static int exynos_mic_probe(struct platform_device *pdev)
461 453
462 platform_set_drvdata(pdev, mic); 454 platform_set_drvdata(pdev, mic);
463 455
456 mic->bridge.funcs = &mic_bridge_funcs;
457 mic->bridge.of_node = dev->of_node;
458
459 ret = drm_bridge_add(&mic->bridge);
460 if (ret) {
461 DRM_ERROR("mic: Failed to add MIC to the global bridge list\n");
462 return ret;
463 }
464
464 pm_runtime_enable(dev); 465 pm_runtime_enable(dev);
465 466
466 ret = component_add(dev, &exynos_mic_component_ops); 467 ret = component_add(dev, &exynos_mic_component_ops);
@@ -479,8 +480,13 @@ err:
479 480
480static int exynos_mic_remove(struct platform_device *pdev) 481static int exynos_mic_remove(struct platform_device *pdev)
481{ 482{
483 struct exynos_mic *mic = platform_get_drvdata(pdev);
484
482 component_del(&pdev->dev, &exynos_mic_component_ops); 485 component_del(&pdev->dev, &exynos_mic_component_ops);
483 pm_runtime_disable(&pdev->dev); 486 pm_runtime_disable(&pdev->dev);
487
488 drm_bridge_remove(&mic->bridge);
489
484 return 0; 490 return 0;
485} 491}
486 492
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 06bfbe400cf1..d3b69d66736f 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -1501,8 +1501,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
1501 */ 1501 */
1502 cancel_delayed_work(&hdata->hotplug_work); 1502 cancel_delayed_work(&hdata->hotplug_work);
1503 cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); 1503 cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID);
1504
1505 hdmiphy_disable(hdata);
1506} 1504}
1507 1505
1508static const struct drm_encoder_helper_funcs exynos_hdmi_encoder_helper_funcs = { 1506static const struct drm_encoder_helper_funcs exynos_hdmi_encoder_helper_funcs = {
@@ -1676,7 +1674,7 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
1676 return hdmi_bridge_init(hdata); 1674 return hdmi_bridge_init(hdata);
1677} 1675}
1678 1676
1679static struct of_device_id hdmi_match_types[] = { 1677static const struct of_device_id hdmi_match_types[] = {
1680 { 1678 {
1681 .compatible = "samsung,exynos4210-hdmi", 1679 .compatible = "samsung,exynos4210-hdmi",
1682 .data = &exynos4210_hdmi_driver_data, 1680 .data = &exynos4210_hdmi_driver_data,
@@ -1934,8 +1932,7 @@ static int hdmi_remove(struct platform_device *pdev)
1934 return 0; 1932 return 0;
1935} 1933}
1936 1934
1937#ifdef CONFIG_PM 1935static int __maybe_unused exynos_hdmi_suspend(struct device *dev)
1938static int exynos_hdmi_suspend(struct device *dev)
1939{ 1936{
1940 struct hdmi_context *hdata = dev_get_drvdata(dev); 1937 struct hdmi_context *hdata = dev_get_drvdata(dev);
1941 1938
@@ -1944,7 +1941,7 @@ static int exynos_hdmi_suspend(struct device *dev)
1944 return 0; 1941 return 0;
1945} 1942}
1946 1943
1947static int exynos_hdmi_resume(struct device *dev) 1944static int __maybe_unused exynos_hdmi_resume(struct device *dev)
1948{ 1945{
1949 struct hdmi_context *hdata = dev_get_drvdata(dev); 1946 struct hdmi_context *hdata = dev_get_drvdata(dev);
1950 int ret; 1947 int ret;
@@ -1955,7 +1952,6 @@ static int exynos_hdmi_resume(struct device *dev)
1955 1952
1956 return 0; 1953 return 0;
1957} 1954}
1958#endif
1959 1955
1960static const struct dev_pm_ops exynos_hdmi_pm_ops = { 1956static const struct dev_pm_ops exynos_hdmi_pm_ops = {
1961 SET_RUNTIME_PM_OPS(exynos_hdmi_suspend, exynos_hdmi_resume, NULL) 1957 SET_RUNTIME_PM_OPS(exynos_hdmi_suspend, exynos_hdmi_resume, NULL)
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 6bed4f3ffcd6..a998a8dd783c 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1094,28 +1094,28 @@ static const struct exynos_drm_crtc_ops mixer_crtc_ops = {
1094 .atomic_check = mixer_atomic_check, 1094 .atomic_check = mixer_atomic_check,
1095}; 1095};
1096 1096
1097static struct mixer_drv_data exynos5420_mxr_drv_data = { 1097static const struct mixer_drv_data exynos5420_mxr_drv_data = {
1098 .version = MXR_VER_128_0_0_184, 1098 .version = MXR_VER_128_0_0_184,
1099 .is_vp_enabled = 0, 1099 .is_vp_enabled = 0,
1100}; 1100};
1101 1101
1102static struct mixer_drv_data exynos5250_mxr_drv_data = { 1102static const struct mixer_drv_data exynos5250_mxr_drv_data = {
1103 .version = MXR_VER_16_0_33_0, 1103 .version = MXR_VER_16_0_33_0,
1104 .is_vp_enabled = 0, 1104 .is_vp_enabled = 0,
1105}; 1105};
1106 1106
1107static struct mixer_drv_data exynos4212_mxr_drv_data = { 1107static const struct mixer_drv_data exynos4212_mxr_drv_data = {
1108 .version = MXR_VER_0_0_0_16, 1108 .version = MXR_VER_0_0_0_16,
1109 .is_vp_enabled = 1, 1109 .is_vp_enabled = 1,
1110}; 1110};
1111 1111
1112static struct mixer_drv_data exynos4210_mxr_drv_data = { 1112static const struct mixer_drv_data exynos4210_mxr_drv_data = {
1113 .version = MXR_VER_0_0_0_16, 1113 .version = MXR_VER_0_0_0_16,
1114 .is_vp_enabled = 1, 1114 .is_vp_enabled = 1,
1115 .has_sclk = 1, 1115 .has_sclk = 1,
1116}; 1116};
1117 1117
1118static struct of_device_id mixer_match_types[] = { 1118static const struct of_device_id mixer_match_types[] = {
1119 { 1119 {
1120 .compatible = "samsung,exynos4210-mixer", 1120 .compatible = "samsung,exynos4210-mixer",
1121 .data = &exynos4210_mxr_drv_data, 1121 .data = &exynos4210_mxr_drv_data,
diff --git a/drivers/gpu/drm/i915/gvt/display.c b/drivers/gpu/drm/i915/gvt/display.c
index 2deb05f618fb..7cb0818a13de 100644
--- a/drivers/gpu/drm/i915/gvt/display.c
+++ b/drivers/gpu/drm/i915/gvt/display.c
@@ -323,27 +323,27 @@ void intel_gvt_check_vblank_emulation(struct intel_gvt *gvt)
323{ 323{
324 struct intel_gvt_irq *irq = &gvt->irq; 324 struct intel_gvt_irq *irq = &gvt->irq;
325 struct intel_vgpu *vgpu; 325 struct intel_vgpu *vgpu;
326 bool have_enabled_pipe = false;
327 int pipe, id; 326 int pipe, id;
328 327
329 if (WARN_ON(!mutex_is_locked(&gvt->lock))) 328 if (WARN_ON(!mutex_is_locked(&gvt->lock)))
330 return; 329 return;
331 330
332 hrtimer_cancel(&irq->vblank_timer.timer);
333
334 for_each_active_vgpu(gvt, vgpu, id) { 331 for_each_active_vgpu(gvt, vgpu, id) {
335 for (pipe = 0; pipe < I915_MAX_PIPES; pipe++) { 332 for (pipe = 0; pipe < I915_MAX_PIPES; pipe++) {
336 have_enabled_pipe = 333 if (pipe_is_enabled(vgpu, pipe))
337 pipe_is_enabled(vgpu, pipe); 334 goto out;
338 if (have_enabled_pipe)
339 break;
340 } 335 }
341 } 336 }
342 337
343 if (have_enabled_pipe) 338 /* all the pipes are disabled */
344 hrtimer_start(&irq->vblank_timer.timer, 339 hrtimer_cancel(&irq->vblank_timer.timer);
345 ktime_add_ns(ktime_get(), irq->vblank_timer.period), 340 return;
346 HRTIMER_MODE_ABS); 341
342out:
343 hrtimer_start(&irq->vblank_timer.timer,
344 ktime_add_ns(ktime_get(), irq->vblank_timer.period),
345 HRTIMER_MODE_ABS);
346
347} 347}
348 348
349static void emulate_vblank_on_pipe(struct intel_vgpu *vgpu, int pipe) 349static void emulate_vblank_on_pipe(struct intel_vgpu *vgpu, int pipe)
diff --git a/drivers/gpu/drm/i915/i915_gem_clflush.c b/drivers/gpu/drm/i915/i915_gem_clflush.c
index 152f16c11878..348b29a845c9 100644
--- a/drivers/gpu/drm/i915/i915_gem_clflush.c
+++ b/drivers/gpu/drm/i915/i915_gem_clflush.c
@@ -114,7 +114,7 @@ i915_clflush_notify(struct i915_sw_fence *fence,
114 return NOTIFY_DONE; 114 return NOTIFY_DONE;
115} 115}
116 116
117void i915_gem_clflush_object(struct drm_i915_gem_object *obj, 117bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
118 unsigned int flags) 118 unsigned int flags)
119{ 119{
120 struct clflush *clflush; 120 struct clflush *clflush;
@@ -128,7 +128,7 @@ void i915_gem_clflush_object(struct drm_i915_gem_object *obj,
128 */ 128 */
129 if (!i915_gem_object_has_struct_page(obj)) { 129 if (!i915_gem_object_has_struct_page(obj)) {
130 obj->cache_dirty = false; 130 obj->cache_dirty = false;
131 return; 131 return false;
132 } 132 }
133 133
134 /* If the GPU is snooping the contents of the CPU cache, 134 /* If the GPU is snooping the contents of the CPU cache,
@@ -140,7 +140,7 @@ void i915_gem_clflush_object(struct drm_i915_gem_object *obj,
140 * tracking. 140 * tracking.
141 */ 141 */
142 if (!(flags & I915_CLFLUSH_FORCE) && obj->cache_coherent) 142 if (!(flags & I915_CLFLUSH_FORCE) && obj->cache_coherent)
143 return; 143 return false;
144 144
145 trace_i915_gem_object_clflush(obj); 145 trace_i915_gem_object_clflush(obj);
146 146
@@ -179,4 +179,5 @@ void i915_gem_clflush_object(struct drm_i915_gem_object *obj,
179 } 179 }
180 180
181 obj->cache_dirty = false; 181 obj->cache_dirty = false;
182 return true;
182} 183}
diff --git a/drivers/gpu/drm/i915/i915_gem_clflush.h b/drivers/gpu/drm/i915/i915_gem_clflush.h
index 2455a7820937..f390247561b3 100644
--- a/drivers/gpu/drm/i915/i915_gem_clflush.h
+++ b/drivers/gpu/drm/i915/i915_gem_clflush.h
@@ -28,7 +28,7 @@
28struct drm_i915_private; 28struct drm_i915_private;
29struct drm_i915_gem_object; 29struct drm_i915_gem_object;
30 30
31void i915_gem_clflush_object(struct drm_i915_gem_object *obj, 31bool i915_gem_clflush_object(struct drm_i915_gem_object *obj,
32 unsigned int flags); 32 unsigned int flags);
33#define I915_CLFLUSH_FORCE BIT(0) 33#define I915_CLFLUSH_FORCE BIT(0)
34#define I915_CLFLUSH_SYNC BIT(1) 34#define I915_CLFLUSH_SYNC BIT(1)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 054b2e54cdaf..e9503f6d1100 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -560,9 +560,6 @@ static int eb_reserve_vma(const struct i915_execbuffer *eb,
560 eb->args->flags |= __EXEC_HAS_RELOC; 560 eb->args->flags |= __EXEC_HAS_RELOC;
561 } 561 }
562 562
563 entry->flags |= __EXEC_OBJECT_HAS_PIN;
564 GEM_BUG_ON(eb_vma_misplaced(entry, vma));
565
566 if (unlikely(entry->flags & EXEC_OBJECT_NEEDS_FENCE)) { 563 if (unlikely(entry->flags & EXEC_OBJECT_NEEDS_FENCE)) {
567 err = i915_vma_get_fence(vma); 564 err = i915_vma_get_fence(vma);
568 if (unlikely(err)) { 565 if (unlikely(err)) {
@@ -574,6 +571,9 @@ static int eb_reserve_vma(const struct i915_execbuffer *eb,
574 entry->flags |= __EXEC_OBJECT_HAS_FENCE; 571 entry->flags |= __EXEC_OBJECT_HAS_FENCE;
575 } 572 }
576 573
574 entry->flags |= __EXEC_OBJECT_HAS_PIN;
575 GEM_BUG_ON(eb_vma_misplaced(entry, vma));
576
577 return 0; 577 return 0;
578} 578}
579 579
@@ -1458,7 +1458,7 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct i915_vma *vma)
1458 * to read. However, if the array is not writable the user loses 1458 * to read. However, if the array is not writable the user loses
1459 * the updated relocation values. 1459 * the updated relocation values.
1460 */ 1460 */
1461 if (unlikely(!access_ok(VERIFY_READ, urelocs, remain*sizeof(urelocs)))) 1461 if (unlikely(!access_ok(VERIFY_READ, urelocs, remain*sizeof(*urelocs))))
1462 return -EFAULT; 1462 return -EFAULT;
1463 1463
1464 do { 1464 do {
@@ -1775,7 +1775,7 @@ out:
1775 } 1775 }
1776 } 1776 }
1777 1777
1778 return err ?: have_copy; 1778 return err;
1779} 1779}
1780 1780
1781static int eb_relocate(struct i915_execbuffer *eb) 1781static int eb_relocate(struct i915_execbuffer *eb)
@@ -1825,7 +1825,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
1825 int err; 1825 int err;
1826 1826
1827 for (i = 0; i < count; i++) { 1827 for (i = 0; i < count; i++) {
1828 const struct drm_i915_gem_exec_object2 *entry = &eb->exec[i]; 1828 struct drm_i915_gem_exec_object2 *entry = &eb->exec[i];
1829 struct i915_vma *vma = exec_to_vma(entry); 1829 struct i915_vma *vma = exec_to_vma(entry);
1830 struct drm_i915_gem_object *obj = vma->obj; 1830 struct drm_i915_gem_object *obj = vma->obj;
1831 1831
@@ -1841,12 +1841,14 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
1841 eb->request->capture_list = capture; 1841 eb->request->capture_list = capture;
1842 } 1842 }
1843 1843
1844 if (unlikely(obj->cache_dirty && !obj->cache_coherent)) {
1845 if (i915_gem_clflush_object(obj, 0))
1846 entry->flags &= ~EXEC_OBJECT_ASYNC;
1847 }
1848
1844 if (entry->flags & EXEC_OBJECT_ASYNC) 1849 if (entry->flags & EXEC_OBJECT_ASYNC)
1845 goto skip_flushes; 1850 goto skip_flushes;
1846 1851
1847 if (unlikely(obj->cache_dirty && !obj->cache_coherent))
1848 i915_gem_clflush_object(obj, 0);
1849
1850 err = i915_gem_request_await_object 1852 err = i915_gem_request_await_object
1851 (eb->request, obj, entry->flags & EXEC_OBJECT_WRITE); 1853 (eb->request, obj, entry->flags & EXEC_OBJECT_WRITE);
1852 if (err) 1854 if (err)
@@ -2209,7 +2211,7 @@ i915_gem_do_execbuffer(struct drm_device *dev,
2209 goto err_unlock; 2211 goto err_unlock;
2210 2212
2211 err = eb_relocate(&eb); 2213 err = eb_relocate(&eb);
2212 if (err) 2214 if (err) {
2213 /* 2215 /*
2214 * If the user expects the execobject.offset and 2216 * If the user expects the execobject.offset and
2215 * reloc.presumed_offset to be an exact match, 2217 * reloc.presumed_offset to be an exact match,
@@ -2218,8 +2220,8 @@ i915_gem_do_execbuffer(struct drm_device *dev,
2218 * relocation. 2220 * relocation.
2219 */ 2221 */
2220 args->flags &= ~__EXEC_HAS_RELOC; 2222 args->flags &= ~__EXEC_HAS_RELOC;
2221 if (err < 0)
2222 goto err_vma; 2223 goto err_vma;
2224 }
2223 2225
2224 if (unlikely(eb.batch->exec_entry->flags & EXEC_OBJECT_WRITE)) { 2226 if (unlikely(eb.batch->exec_entry->flags & EXEC_OBJECT_WRITE)) {
2225 DRM_DEBUG("Attempting to use self-modifying batch buffer\n"); 2227 DRM_DEBUG("Attempting to use self-modifying batch buffer\n");
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index 4a673fc1a432..20cf272c97b1 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -284,12 +284,12 @@ static inline void __i915_vma_pin(struct i915_vma *vma)
284 284
285static inline void __i915_vma_unpin(struct i915_vma *vma) 285static inline void __i915_vma_unpin(struct i915_vma *vma)
286{ 286{
287 GEM_BUG_ON(!i915_vma_is_pinned(vma));
288 vma->flags--; 287 vma->flags--;
289} 288}
290 289
291static inline void i915_vma_unpin(struct i915_vma *vma) 290static inline void i915_vma_unpin(struct i915_vma *vma)
292{ 291{
292 GEM_BUG_ON(!i915_vma_is_pinned(vma));
293 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node)); 293 GEM_BUG_ON(!drm_mm_node_allocated(&vma->node));
294 __i915_vma_unpin(vma); 294 __i915_vma_unpin(vma);
295} 295}
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 80e96f1f49d2..9edeaaef77ad 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1896,8 +1896,8 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level)
1896 val = I915_READ(CNL_PORT_TX_DW4_LN(port, ln)); 1896 val = I915_READ(CNL_PORT_TX_DW4_LN(port, ln));
1897 val &= ~LOADGEN_SELECT; 1897 val &= ~LOADGEN_SELECT;
1898 1898
1899 if (((rate < 600000) && (width == 4) && (ln >= 1)) || 1899 if ((rate <= 600000 && width == 4 && ln >= 1) ||
1900 ((rate < 600000) && (width < 4) && ((ln == 1) || (ln == 2)))) { 1900 (rate <= 600000 && width < 4 && (ln == 1 || ln == 2))) {
1901 val |= LOADGEN_SELECT; 1901 val |= LOADGEN_SELECT;
1902 } 1902 }
1903 I915_WRITE(CNL_PORT_TX_DW4_LN(port, ln), val); 1903 I915_WRITE(CNL_PORT_TX_DW4_LN(port, ln), val);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index dec9e58545a1..9471c88d449e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3427,26 +3427,6 @@ static void intel_complete_page_flips(struct drm_i915_private *dev_priv)
3427 intel_finish_page_flip_cs(dev_priv, crtc->pipe); 3427 intel_finish_page_flip_cs(dev_priv, crtc->pipe);
3428} 3428}
3429 3429
3430static void intel_update_primary_planes(struct drm_device *dev)
3431{
3432 struct drm_crtc *crtc;
3433
3434 for_each_crtc(dev, crtc) {
3435 struct intel_plane *plane = to_intel_plane(crtc->primary);
3436 struct intel_plane_state *plane_state =
3437 to_intel_plane_state(plane->base.state);
3438
3439 if (plane_state->base.visible) {
3440 trace_intel_update_plane(&plane->base,
3441 to_intel_crtc(crtc));
3442
3443 plane->update_plane(plane,
3444 to_intel_crtc_state(crtc->state),
3445 plane_state);
3446 }
3447 }
3448}
3449
3450static int 3430static int
3451__intel_display_resume(struct drm_device *dev, 3431__intel_display_resume(struct drm_device *dev,
3452 struct drm_atomic_state *state, 3432 struct drm_atomic_state *state,
@@ -3499,6 +3479,12 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv)
3499 struct drm_atomic_state *state; 3479 struct drm_atomic_state *state;
3500 int ret; 3480 int ret;
3501 3481
3482
3483 /* reset doesn't touch the display */
3484 if (!i915.force_reset_modeset_test &&
3485 !gpu_reset_clobbers_display(dev_priv))
3486 return;
3487
3502 /* 3488 /*
3503 * Need mode_config.mutex so that we don't 3489 * Need mode_config.mutex so that we don't
3504 * trample ongoing ->detect() and whatnot. 3490 * trample ongoing ->detect() and whatnot.
@@ -3512,12 +3498,6 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv)
3512 3498
3513 drm_modeset_backoff(ctx); 3499 drm_modeset_backoff(ctx);
3514 } 3500 }
3515
3516 /* reset doesn't touch the display, but flips might get nuked anyway, */
3517 if (!i915.force_reset_modeset_test &&
3518 !gpu_reset_clobbers_display(dev_priv))
3519 return;
3520
3521 /* 3501 /*
3522 * Disabling the crtcs gracefully seems nicer. Also the 3502 * Disabling the crtcs gracefully seems nicer. Also the
3523 * g33 docs say we should at least disable all the planes. 3503 * g33 docs say we should at least disable all the planes.
@@ -3547,6 +3527,14 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)
3547 struct drm_atomic_state *state = dev_priv->modeset_restore_state; 3527 struct drm_atomic_state *state = dev_priv->modeset_restore_state;
3548 int ret; 3528 int ret;
3549 3529
3530 /* reset doesn't touch the display */
3531 if (!i915.force_reset_modeset_test &&
3532 !gpu_reset_clobbers_display(dev_priv))
3533 return;
3534
3535 if (!state)
3536 goto unlock;
3537
3550 /* 3538 /*
3551 * Flips in the rings will be nuked by the reset, 3539 * Flips in the rings will be nuked by the reset,
3552 * so complete all pending flips so that user space 3540 * so complete all pending flips so that user space
@@ -3558,22 +3546,10 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)
3558 3546
3559 /* reset doesn't touch the display */ 3547 /* reset doesn't touch the display */
3560 if (!gpu_reset_clobbers_display(dev_priv)) { 3548 if (!gpu_reset_clobbers_display(dev_priv)) {
3561 if (!state) { 3549 /* for testing only restore the display */
3562 /* 3550 ret = __intel_display_resume(dev, state, ctx);
3563 * Flips in the rings have been nuked by the reset,
3564 * so update the base address of all primary
3565 * planes to the the last fb to make sure we're
3566 * showing the correct fb after a reset.
3567 *
3568 * FIXME: Atomic will make this obsolete since we won't schedule
3569 * CS-based flips (which might get lost in gpu resets) any more.
3570 */
3571 intel_update_primary_planes(dev);
3572 } else {
3573 ret = __intel_display_resume(dev, state, ctx);
3574 if (ret) 3551 if (ret)
3575 DRM_ERROR("Restoring old state failed with %i\n", ret); 3552 DRM_ERROR("Restoring old state failed with %i\n", ret);
3576 }
3577 } else { 3553 } else {
3578 /* 3554 /*
3579 * The display has been reset as well, 3555 * The display has been reset as well,
@@ -3597,8 +3573,8 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)
3597 intel_hpd_init(dev_priv); 3573 intel_hpd_init(dev_priv);
3598 } 3574 }
3599 3575
3600 if (state) 3576 drm_atomic_state_put(state);
3601 drm_atomic_state_put(state); 3577unlock:
3602 drm_modeset_drop_locks(ctx); 3578 drm_modeset_drop_locks(ctx);
3603 drm_modeset_acquire_fini(ctx); 3579 drm_modeset_acquire_fini(ctx);
3604 mutex_unlock(&dev->mode_config.mutex); 3580 mutex_unlock(&dev->mode_config.mutex);
@@ -9117,6 +9093,13 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
9117 u64 power_domain_mask; 9093 u64 power_domain_mask;
9118 bool active; 9094 bool active;
9119 9095
9096 if (INTEL_GEN(dev_priv) >= 9) {
9097 intel_crtc_init_scalers(crtc, pipe_config);
9098
9099 pipe_config->scaler_state.scaler_id = -1;
9100 pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX);
9101 }
9102
9120 power_domain = POWER_DOMAIN_PIPE(crtc->pipe); 9103 power_domain = POWER_DOMAIN_PIPE(crtc->pipe);
9121 if (!intel_display_power_get_if_enabled(dev_priv, power_domain)) 9104 if (!intel_display_power_get_if_enabled(dev_priv, power_domain))
9122 return false; 9105 return false;
@@ -9145,13 +9128,6 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
9145 pipe_config->gamma_mode = 9128 pipe_config->gamma_mode =
9146 I915_READ(GAMMA_MODE(crtc->pipe)) & GAMMA_MODE_MODE_MASK; 9129 I915_READ(GAMMA_MODE(crtc->pipe)) & GAMMA_MODE_MODE_MASK;
9147 9130
9148 if (INTEL_GEN(dev_priv) >= 9) {
9149 intel_crtc_init_scalers(crtc, pipe_config);
9150
9151 pipe_config->scaler_state.scaler_id = -1;
9152 pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX);
9153 }
9154
9155 power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe); 9131 power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
9156 if (intel_display_power_get_if_enabled(dev_priv, power_domain)) { 9132 if (intel_display_power_get_if_enabled(dev_priv, power_domain)) {
9157 power_domain_mask |= BIT_ULL(power_domain); 9133 power_domain_mask |= BIT_ULL(power_domain);
@@ -9540,7 +9516,16 @@ static void i9xx_update_cursor(struct intel_plane *plane,
9540 * On some platforms writing CURCNTR first will also 9516 * On some platforms writing CURCNTR first will also
9541 * cause CURPOS to be armed by the CURBASE write. 9517 * cause CURPOS to be armed by the CURBASE write.
9542 * Without the CURCNTR write the CURPOS write would 9518 * Without the CURCNTR write the CURPOS write would
9543 * arm itself. 9519 * arm itself. Thus we always start the full update
9520 * with a CURCNTR write.
9521 *
9522 * On other platforms CURPOS always requires the
9523 * CURBASE write to arm the update. Additonally
9524 * a write to any of the cursor register will cancel
9525 * an already armed cursor update. Thus leaving out
9526 * the CURBASE write after CURPOS could lead to a
9527 * cursor that doesn't appear to move, or even change
9528 * shape. Thus we always write CURBASE.
9544 * 9529 *
9545 * CURCNTR and CUR_FBC_CTL are always 9530 * CURCNTR and CUR_FBC_CTL are always
9546 * armed by the CURBASE write only. 9531 * armed by the CURBASE write only.
@@ -9559,6 +9544,7 @@ static void i9xx_update_cursor(struct intel_plane *plane,
9559 plane->cursor.cntl = cntl; 9544 plane->cursor.cntl = cntl;
9560 } else { 9545 } else {
9561 I915_WRITE_FW(CURPOS(pipe), pos); 9546 I915_WRITE_FW(CURPOS(pipe), pos);
9547 I915_WRITE_FW(CURBASE(pipe), base);
9562 } 9548 }
9563 9549
9564 POSTING_READ_FW(CURBASE(pipe)); 9550 POSTING_READ_FW(CURBASE(pipe));
diff --git a/drivers/gpu/drm/i915/intel_gvt.c b/drivers/gpu/drm/i915/intel_gvt.c
index 52d5b82790d9..c17ed0e62b67 100644
--- a/drivers/gpu/drm/i915/intel_gvt.c
+++ b/drivers/gpu/drm/i915/intel_gvt.c
@@ -45,7 +45,7 @@ static bool is_supported_device(struct drm_i915_private *dev_priv)
45 return true; 45 return true;
46 if (IS_SKYLAKE(dev_priv)) 46 if (IS_SKYLAKE(dev_priv))
47 return true; 47 return true;
48 if (IS_KABYLAKE(dev_priv) && INTEL_DEVID(dev_priv) == 0x591D) 48 if (IS_KABYLAKE(dev_priv))
49 return true; 49 return true;
50 return false; 50 return false;
51} 51}
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 48ea0fca1f72..40b224b44d1b 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4463,8 +4463,8 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
4463 if ((cpp * cstate->base.adjusted_mode.crtc_htotal / 512 < 1) && 4463 if ((cpp * cstate->base.adjusted_mode.crtc_htotal / 512 < 1) &&
4464 (plane_bytes_per_line / 512 < 1)) 4464 (plane_bytes_per_line / 512 < 1))
4465 selected_result = method2; 4465 selected_result = method2;
4466 else if ((ddb_allocation && ddb_allocation / 4466 else if (ddb_allocation >=
4467 fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1) 4467 fixed_16_16_to_u32_round_up(plane_blocks_per_line))
4468 selected_result = min_fixed_16_16(method1, method2); 4468 selected_result = min_fixed_16_16(method1, method2);
4469 else if (latency >= linetime_us) 4469 else if (latency >= linetime_us)
4470 selected_result = min_fixed_16_16(method1, method2); 4470 selected_result = min_fixed_16_16(method1, method2);
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 627e2aa09766..8cdec455cf7d 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -206,7 +206,7 @@ struct drm_i915_private *mock_gem_device(void)
206 mkwrite_device_info(i915)->ring_mask = BIT(0); 206 mkwrite_device_info(i915)->ring_mask = BIT(0);
207 i915->engine[RCS] = mock_engine(i915, "mock"); 207 i915->engine[RCS] = mock_engine(i915, "mock");
208 if (!i915->engine[RCS]) 208 if (!i915->engine[RCS])
209 goto err_dependencies; 209 goto err_priorities;
210 210
211 i915->kernel_context = mock_context(i915, NULL); 211 i915->kernel_context = mock_context(i915, NULL);
212 if (!i915->kernel_context) 212 if (!i915->kernel_context)
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 49546222c6d3..6276bb834b4f 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -54,7 +54,7 @@ static const uint32_t ipu_plane_formats[] = {
54 DRM_FORMAT_RGBA8888, 54 DRM_FORMAT_RGBA8888,
55 DRM_FORMAT_RGBX8888, 55 DRM_FORMAT_RGBX8888,
56 DRM_FORMAT_BGRA8888, 56 DRM_FORMAT_BGRA8888,
57 DRM_FORMAT_BGRA8888, 57 DRM_FORMAT_BGRX8888,
58 DRM_FORMAT_UYVY, 58 DRM_FORMAT_UYVY,
59 DRM_FORMAT_VYUY, 59 DRM_FORMAT_VYUY,
60 DRM_FORMAT_YUYV, 60 DRM_FORMAT_YUYV,
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 636031a30e17..8aca20209cb8 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -237,7 +237,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
237 237
238 /* port@1 is the output port */ 238 /* port@1 is the output port */
239 ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge); 239 ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, &imxpd->bridge);
240 if (ret) 240 if (ret && ret != -ENODEV)
241 return ret; 241 return ret;
242 242
243 imxpd->dev = dev; 243 imxpd->dev = dev;
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 147b22163f9f..dab78c660dd6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1158,8 +1158,6 @@ nouveau_connector_aux_xfer(struct drm_dp_aux *obj, struct drm_dp_aux_msg *msg)
1158 return -ENODEV; 1158 return -ENODEV;
1159 if (WARN_ON(msg->size > 16)) 1159 if (WARN_ON(msg->size > 16))
1160 return -E2BIG; 1160 return -E2BIG;
1161 if (msg->size == 0)
1162 return msg->size;
1163 1161
1164 ret = nvkm_i2c_aux_acquire(aux); 1162 ret = nvkm_i2c_aux_acquire(aux);
1165 if (ret) 1163 if (ret)
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c
index 8d1df5678eaa..f362c9fa8b3b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -409,7 +409,6 @@ nouveau_display_fini(struct drm_device *dev, bool suspend)
409 struct nouveau_display *disp = nouveau_display(dev); 409 struct nouveau_display *disp = nouveau_display(dev);
410 struct nouveau_drm *drm = nouveau_drm(dev); 410 struct nouveau_drm *drm = nouveau_drm(dev);
411 struct drm_connector *connector; 411 struct drm_connector *connector;
412 struct drm_crtc *crtc;
413 412
414 if (!suspend) { 413 if (!suspend) {
415 if (drm_drv_uses_atomic_modeset(dev)) 414 if (drm_drv_uses_atomic_modeset(dev))
@@ -418,10 +417,6 @@ nouveau_display_fini(struct drm_device *dev, bool suspend)
418 drm_crtc_force_disable_all(dev); 417 drm_crtc_force_disable_all(dev);
419 } 418 }
420 419
421 /* Make sure that drm and hw vblank irqs get properly disabled. */
422 drm_for_each_crtc(crtc, dev)
423 drm_crtc_vblank_off(crtc);
424
425 /* disable flip completion events */ 420 /* disable flip completion events */
426 nvif_notify_put(&drm->flip); 421 nvif_notify_put(&drm->flip);
427 422
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index e3132a2ce34d..2bc0dc985214 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -3674,15 +3674,24 @@ nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe)
3674 drm_mode_connector_attach_encoder(connector, encoder); 3674 drm_mode_connector_attach_encoder(connector, encoder);
3675 3675
3676 if (dcbe->type == DCB_OUTPUT_DP) { 3676 if (dcbe->type == DCB_OUTPUT_DP) {
3677 struct nv50_disp *disp = nv50_disp(encoder->dev);
3677 struct nvkm_i2c_aux *aux = 3678 struct nvkm_i2c_aux *aux =
3678 nvkm_i2c_aux_find(i2c, dcbe->i2c_index); 3679 nvkm_i2c_aux_find(i2c, dcbe->i2c_index);
3679 if (aux) { 3680 if (aux) {
3680 nv_encoder->i2c = &nv_connector->aux.ddc; 3681 if (disp->disp->oclass < GF110_DISP) {
3682 /* HW has no support for address-only
3683 * transactions, so we're required to
3684 * use custom I2C-over-AUX code.
3685 */
3686 nv_encoder->i2c = &aux->i2c;
3687 } else {
3688 nv_encoder->i2c = &nv_connector->aux.ddc;
3689 }
3681 nv_encoder->aux = aux; 3690 nv_encoder->aux = aux;
3682 } 3691 }
3683 3692
3684 /*TODO: Use DP Info Table to check for support. */ 3693 /*TODO: Use DP Info Table to check for support. */
3685 if (nv50_disp(encoder->dev)->disp->oclass >= GF110_DISP) { 3694 if (disp->disp->oclass >= GF110_DISP) {
3686 ret = nv50_mstm_new(nv_encoder, &nv_connector->aux, 16, 3695 ret = nv50_mstm_new(nv_encoder, &nv_connector->aux, 16,
3687 nv_connector->base.base.id, 3696 nv_connector->base.base.id,
3688 &nv_encoder->dp.mstm); 3697 &nv_encoder->dp.mstm);
@@ -3931,6 +3940,8 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
3931 3940
3932 NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name, 3941 NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name,
3933 asyh->clr.mask, asyh->set.mask); 3942 asyh->clr.mask, asyh->set.mask);
3943 if (crtc_state->active && !asyh->state.active)
3944 drm_crtc_vblank_off(crtc);
3934 3945
3935 if (asyh->clr.mask) { 3946 if (asyh->clr.mask) {
3936 nv50_head_flush_clr(head, asyh, atom->flush_disable); 3947 nv50_head_flush_clr(head, asyh, atom->flush_disable);
@@ -4016,11 +4027,13 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
4016 nv50_head_flush_set(head, asyh); 4027 nv50_head_flush_set(head, asyh);
4017 interlock_core = 1; 4028 interlock_core = 1;
4018 } 4029 }
4019 }
4020 4030
4021 for_each_crtc_in_state(state, crtc, crtc_state, i) { 4031 if (asyh->state.active) {
4022 if (crtc->state->event) 4032 if (!crtc_state->active)
4023 drm_crtc_vblank_get(crtc); 4033 drm_crtc_vblank_on(crtc);
4034 if (asyh->state.event)
4035 drm_crtc_vblank_get(crtc);
4036 }
4024 } 4037 }
4025 4038
4026 /* Update plane(s). */ 4039 /* Update plane(s). */
@@ -4067,12 +4080,14 @@ nv50_disp_atomic_commit_tail(struct drm_atomic_state *state)
4067 if (crtc->state->event) { 4080 if (crtc->state->event) {
4068 unsigned long flags; 4081 unsigned long flags;
4069 /* Get correct count/ts if racing with vblank irq */ 4082 /* Get correct count/ts if racing with vblank irq */
4070 drm_accurate_vblank_count(crtc); 4083 if (crtc->state->active)
4084 drm_accurate_vblank_count(crtc);
4071 spin_lock_irqsave(&crtc->dev->event_lock, flags); 4085 spin_lock_irqsave(&crtc->dev->event_lock, flags);
4072 drm_crtc_send_vblank_event(crtc, crtc->state->event); 4086 drm_crtc_send_vblank_event(crtc, crtc->state->event);
4073 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 4087 spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
4074 crtc->state->event = NULL; 4088 crtc->state->event = NULL;
4075 drm_crtc_vblank_put(crtc); 4089 if (crtc->state->active)
4090 drm_crtc_vblank_put(crtc);
4076 } 4091 }
4077 } 4092 }
4078 4093
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
index a24312fb0228..a1e8bf48b778 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
@@ -22,6 +22,7 @@ struct nvkm_ior {
22 unsigned proto_evo:4; 22 unsigned proto_evo:4;
23 enum nvkm_ior_proto { 23 enum nvkm_ior_proto {
24 CRT, 24 CRT,
25 TV,
25 TMDS, 26 TMDS,
26 LVDS, 27 LVDS,
27 DP, 28 DP,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
index 19c635663399..6ea19466f436 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
@@ -22,7 +22,7 @@ struct nv50_disp {
22 u8 type[3]; 22 u8 type[3];
23 } pior; 23 } pior;
24 24
25 struct nv50_disp_chan *chan[17]; 25 struct nv50_disp_chan *chan[21];
26}; 26};
27 27
28void nv50_disp_super_1(struct nv50_disp *); 28void nv50_disp_super_1(struct nv50_disp *);
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c
index 85aff85394ac..be9e7f8c3b23 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.c
@@ -62,6 +62,7 @@ nvkm_outp_xlat(struct nvkm_outp *outp, enum nvkm_ior_type *type)
62 case 0: 62 case 0:
63 switch (outp->info.type) { 63 switch (outp->info.type) {
64 case DCB_OUTPUT_ANALOG: *type = DAC; return CRT; 64 case DCB_OUTPUT_ANALOG: *type = DAC; return CRT;
65 case DCB_OUTPUT_TV : *type = DAC; return TV;
65 case DCB_OUTPUT_TMDS : *type = SOR; return TMDS; 66 case DCB_OUTPUT_TMDS : *type = SOR; return TMDS;
66 case DCB_OUTPUT_LVDS : *type = SOR; return LVDS; 67 case DCB_OUTPUT_LVDS : *type = SOR; return LVDS;
67 case DCB_OUTPUT_DP : *type = SOR; return DP; 68 case DCB_OUTPUT_DP : *type = SOR; return DP;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
index c794b2c2d21e..6d8f21290aa2 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/gf100.c
@@ -129,7 +129,7 @@ gf100_bar_init(struct nvkm_bar *base)
129 129
130 if (bar->bar[0].mem) { 130 if (bar->bar[0].mem) {
131 addr = nvkm_memory_addr(bar->bar[0].mem) >> 12; 131 addr = nvkm_memory_addr(bar->bar[0].mem) >> 12;
132 nvkm_wr32(device, 0x001714, 0xc0000000 | addr); 132 nvkm_wr32(device, 0x001714, 0x80000000 | addr);
133 } 133 }
134 134
135 return 0; 135 return 0;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild
index 48f01e40b8fc..b768e66a472b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild
@@ -25,6 +25,7 @@ nvkm-y += nvkm/subdev/i2c/bit.o
25 25
26nvkm-y += nvkm/subdev/i2c/aux.o 26nvkm-y += nvkm/subdev/i2c/aux.o
27nvkm-y += nvkm/subdev/i2c/auxg94.o 27nvkm-y += nvkm/subdev/i2c/auxg94.o
28nvkm-y += nvkm/subdev/i2c/auxgf119.o
28nvkm-y += nvkm/subdev/i2c/auxgm200.o 29nvkm-y += nvkm/subdev/i2c/auxgm200.o
29 30
30nvkm-y += nvkm/subdev/i2c/anx9805.o 31nvkm-y += nvkm/subdev/i2c/anx9805.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
index d172e42dd228..4c1f547da463 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c
@@ -117,6 +117,10 @@ int
117nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *aux, bool retry, u8 type, 117nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *aux, bool retry, u8 type,
118 u32 addr, u8 *data, u8 *size) 118 u32 addr, u8 *data, u8 *size)
119{ 119{
120 if (!*size && !aux->func->address_only) {
121 AUX_ERR(aux, "address-only transaction dropped");
122 return -ENOSYS;
123 }
120 return aux->func->xfer(aux, retry, type, addr, data, size); 124 return aux->func->xfer(aux, retry, type, addr, data, size);
121} 125}
122 126
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h
index 27a4a39c87f0..9587ab456d9e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.h
@@ -3,6 +3,7 @@
3#include "pad.h" 3#include "pad.h"
4 4
5struct nvkm_i2c_aux_func { 5struct nvkm_i2c_aux_func {
6 bool address_only;
6 int (*xfer)(struct nvkm_i2c_aux *, bool retry, u8 type, 7 int (*xfer)(struct nvkm_i2c_aux *, bool retry, u8 type,
7 u32 addr, u8 *data, u8 *size); 8 u32 addr, u8 *data, u8 *size);
8 int (*lnk_ctl)(struct nvkm_i2c_aux *, int link_nr, int link_bw, 9 int (*lnk_ctl)(struct nvkm_i2c_aux *, int link_nr, int link_bw,
@@ -17,7 +18,12 @@ void nvkm_i2c_aux_del(struct nvkm_i2c_aux **);
17int nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *, bool retry, u8 type, 18int nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *, bool retry, u8 type,
18 u32 addr, u8 *data, u8 *size); 19 u32 addr, u8 *data, u8 *size);
19 20
21int g94_i2c_aux_new_(const struct nvkm_i2c_aux_func *, struct nvkm_i2c_pad *,
22 int, u8, struct nvkm_i2c_aux **);
23
20int g94_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 24int g94_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
25int g94_i2c_aux_xfer(struct nvkm_i2c_aux *, bool, u8, u32, u8 *, u8 *);
26int gf119_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
21int gm200_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 27int gm200_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
22 28
23#define AUX_MSG(b,l,f,a...) do { \ 29#define AUX_MSG(b,l,f,a...) do { \
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
index ab8cb196c34e..c8ab1b5741a3 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxg94.c
@@ -72,7 +72,7 @@ g94_i2c_aux_init(struct g94_i2c_aux *aux)
72 return 0; 72 return 0;
73} 73}
74 74
75static int 75int
76g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry, 76g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
77 u8 type, u32 addr, u8 *data, u8 *size) 77 u8 type, u32 addr, u8 *data, u8 *size)
78{ 78{
@@ -105,9 +105,9 @@ g94_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
105 } 105 }
106 106
107 ctrl = nvkm_rd32(device, 0x00e4e4 + base); 107 ctrl = nvkm_rd32(device, 0x00e4e4 + base);
108 ctrl &= ~0x0001f0ff; 108 ctrl &= ~0x0001f1ff;
109 ctrl |= type << 12; 109 ctrl |= type << 12;
110 ctrl |= *size - 1; 110 ctrl |= (*size ? (*size - 1) : 0x00000100);
111 nvkm_wr32(device, 0x00e4e0 + base, addr); 111 nvkm_wr32(device, 0x00e4e0 + base, addr);
112 112
113 /* (maybe) retry transaction a number of times on failure... */ 113 /* (maybe) retry transaction a number of times on failure... */
@@ -160,14 +160,10 @@ out:
160 return ret < 0 ? ret : (stat & 0x000f0000) >> 16; 160 return ret < 0 ? ret : (stat & 0x000f0000) >> 16;
161} 161}
162 162
163static const struct nvkm_i2c_aux_func
164g94_i2c_aux_func = {
165 .xfer = g94_i2c_aux_xfer,
166};
167
168int 163int
169g94_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive, 164g94_i2c_aux_new_(const struct nvkm_i2c_aux_func *func,
170 struct nvkm_i2c_aux **paux) 165 struct nvkm_i2c_pad *pad, int index, u8 drive,
166 struct nvkm_i2c_aux **paux)
171{ 167{
172 struct g94_i2c_aux *aux; 168 struct g94_i2c_aux *aux;
173 169
@@ -175,8 +171,20 @@ g94_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive,
175 return -ENOMEM; 171 return -ENOMEM;
176 *paux = &aux->base; 172 *paux = &aux->base;
177 173
178 nvkm_i2c_aux_ctor(&g94_i2c_aux_func, pad, index, &aux->base); 174 nvkm_i2c_aux_ctor(func, pad, index, &aux->base);
179 aux->ch = drive; 175 aux->ch = drive;
180 aux->base.intr = 1 << aux->ch; 176 aux->base.intr = 1 << aux->ch;
181 return 0; 177 return 0;
182} 178}
179
180static const struct nvkm_i2c_aux_func
181g94_i2c_aux = {
182 .xfer = g94_i2c_aux_xfer,
183};
184
185int
186g94_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive,
187 struct nvkm_i2c_aux **paux)
188{
189 return g94_i2c_aux_new_(&g94_i2c_aux, pad, index, drive, paux);
190}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgf119.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgf119.c
new file mode 100644
index 000000000000..dab40cd8fe3a
--- /dev/null
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgf119.c
@@ -0,0 +1,35 @@
1/*
2 * Copyright 2017 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22#include "aux.h"
23
24static const struct nvkm_i2c_aux_func
25gf119_i2c_aux = {
26 .address_only = true,
27 .xfer = g94_i2c_aux_xfer,
28};
29
30int
31gf119_i2c_aux_new(struct nvkm_i2c_pad *pad, int index, u8 drive,
32 struct nvkm_i2c_aux **paux)
33{
34 return g94_i2c_aux_new_(&gf119_i2c_aux, pad, index, drive, paux);
35}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
index ee091fa79628..7ef60895f43a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/auxgm200.c
@@ -105,9 +105,9 @@ gm200_i2c_aux_xfer(struct nvkm_i2c_aux *obj, bool retry,
105 } 105 }
106 106
107 ctrl = nvkm_rd32(device, 0x00d954 + base); 107 ctrl = nvkm_rd32(device, 0x00d954 + base);
108 ctrl &= ~0x0001f0ff; 108 ctrl &= ~0x0001f1ff;
109 ctrl |= type << 12; 109 ctrl |= type << 12;
110 ctrl |= *size - 1; 110 ctrl |= (*size ? (*size - 1) : 0x00000100);
111 nvkm_wr32(device, 0x00d950 + base, addr); 111 nvkm_wr32(device, 0x00d950 + base, addr);
112 112
113 /* (maybe) retry transaction a number of times on failure... */ 113 /* (maybe) retry transaction a number of times on failure... */
@@ -162,6 +162,7 @@ out:
162 162
163static const struct nvkm_i2c_aux_func 163static const struct nvkm_i2c_aux_func
164gm200_i2c_aux_func = { 164gm200_i2c_aux_func = {
165 .address_only = true,
165 .xfer = gm200_i2c_aux_xfer, 166 .xfer = gm200_i2c_aux_xfer,
166}; 167};
167 168
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgf119.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgf119.c
index d53212f1aa52..3bc4d0310076 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgf119.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgf119.c
@@ -28,7 +28,7 @@
28static const struct nvkm_i2c_pad_func 28static const struct nvkm_i2c_pad_func
29gf119_i2c_pad_s_func = { 29gf119_i2c_pad_s_func = {
30 .bus_new_4 = gf119_i2c_bus_new, 30 .bus_new_4 = gf119_i2c_bus_new,
31 .aux_new_6 = g94_i2c_aux_new, 31 .aux_new_6 = gf119_i2c_aux_new,
32 .mode = g94_i2c_pad_mode, 32 .mode = g94_i2c_pad_mode,
33}; 33};
34 34
@@ -41,7 +41,7 @@ gf119_i2c_pad_s_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad)
41static const struct nvkm_i2c_pad_func 41static const struct nvkm_i2c_pad_func
42gf119_i2c_pad_x_func = { 42gf119_i2c_pad_x_func = {
43 .bus_new_4 = gf119_i2c_bus_new, 43 .bus_new_4 = gf119_i2c_bus_new,
44 .aux_new_6 = g94_i2c_aux_new, 44 .aux_new_6 = gf119_i2c_aux_new,
45}; 45};
46 46
47int 47int
diff --git a/drivers/gpu/drm/radeon/radeon_kfd.c b/drivers/gpu/drm/radeon/radeon_kfd.c
index 699fe7f9b8bf..a2ab6dcdf4a2 100644
--- a/drivers/gpu/drm/radeon/radeon_kfd.c
+++ b/drivers/gpu/drm/radeon/radeon_kfd.c
@@ -184,7 +184,6 @@ void radeon_kfd_device_init(struct radeon_device *rdev)
184 if (rdev->kfd) { 184 if (rdev->kfd) {
185 struct kgd2kfd_shared_resources gpu_resources = { 185 struct kgd2kfd_shared_resources gpu_resources = {
186 .compute_vmid_bitmap = 0xFF00, 186 .compute_vmid_bitmap = 0xFF00,
187 .num_mec = 1,
188 .num_pipe_per_mec = 4, 187 .num_pipe_per_mec = 4,
189 .num_queue_per_pipe = 8 188 .num_queue_per_pipe = 8
190 }; 189 };
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 50c41c0a50ef..dcc539ba85d6 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -5,6 +5,10 @@ config DRM_ROCKCHIP
5 select DRM_KMS_HELPER 5 select DRM_KMS_HELPER
6 select DRM_PANEL 6 select DRM_PANEL
7 select VIDEOMODE_HELPERS 7 select VIDEOMODE_HELPERS
8 select DRM_ANALOGIX_DP if ROCKCHIP_ANALOGIX_DP
9 select DRM_DW_HDMI if ROCKCHIP_DW_HDMI
10 select DRM_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI
11 select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC
8 help 12 help
9 Choose this option if you have a Rockchip soc chipset. 13 Choose this option if you have a Rockchip soc chipset.
10 This driver provides kernel mode setting and buffer 14 This driver provides kernel mode setting and buffer
@@ -12,10 +16,10 @@ config DRM_ROCKCHIP
12 2D or 3D acceleration; acceleration is performed by other 16 2D or 3D acceleration; acceleration is performed by other
13 IP found on the SoC. 17 IP found on the SoC.
14 18
19if DRM_ROCKCHIP
20
15config ROCKCHIP_ANALOGIX_DP 21config ROCKCHIP_ANALOGIX_DP
16 bool "Rockchip specific extensions for Analogix DP driver" 22 bool "Rockchip specific extensions for Analogix DP driver"
17 depends on DRM_ROCKCHIP
18 select DRM_ANALOGIX_DP
19 help 23 help
20 This selects support for Rockchip SoC specific extensions 24 This selects support for Rockchip SoC specific extensions
21 for the Analogix Core DP driver. If you want to enable DP 25 for the Analogix Core DP driver. If you want to enable DP
@@ -23,9 +27,7 @@ config ROCKCHIP_ANALOGIX_DP
23 27
24config ROCKCHIP_CDN_DP 28config ROCKCHIP_CDN_DP
25 bool "Rockchip cdn DP" 29 bool "Rockchip cdn DP"
26 depends on DRM_ROCKCHIP 30 depends on EXTCON=y || (EXTCON=m && DRM_ROCKCHIP=m)
27 depends on EXTCON
28 select SND_SOC_HDMI_CODEC if SND_SOC
29 help 31 help
30 This selects support for Rockchip SoC specific extensions 32 This selects support for Rockchip SoC specific extensions
31 for the cdn DP driver. If you want to enable Dp on 33 for the cdn DP driver. If you want to enable Dp on
@@ -34,8 +36,6 @@ config ROCKCHIP_CDN_DP
34 36
35config ROCKCHIP_DW_HDMI 37config ROCKCHIP_DW_HDMI
36 bool "Rockchip specific extensions for Synopsys DW HDMI" 38 bool "Rockchip specific extensions for Synopsys DW HDMI"
37 depends on DRM_ROCKCHIP
38 select DRM_DW_HDMI
39 help 39 help
40 This selects support for Rockchip SoC specific extensions 40 This selects support for Rockchip SoC specific extensions
41 for the Synopsys DesignWare HDMI driver. If you want to 41 for the Synopsys DesignWare HDMI driver. If you want to
@@ -44,8 +44,6 @@ config ROCKCHIP_DW_HDMI
44 44
45config ROCKCHIP_DW_MIPI_DSI 45config ROCKCHIP_DW_MIPI_DSI
46 bool "Rockchip specific extensions for Synopsys DW MIPI DSI" 46 bool "Rockchip specific extensions for Synopsys DW MIPI DSI"
47 depends on DRM_ROCKCHIP
48 select DRM_MIPI_DSI
49 help 47 help
50 This selects support for Rockchip SoC specific extensions 48 This selects support for Rockchip SoC specific extensions
51 for the Synopsys DesignWare HDMI driver. If you want to 49 for the Synopsys DesignWare HDMI driver. If you want to
@@ -54,8 +52,9 @@ config ROCKCHIP_DW_MIPI_DSI
54 52
55config ROCKCHIP_INNO_HDMI 53config ROCKCHIP_INNO_HDMI
56 bool "Rockchip specific extensions for Innosilicon HDMI" 54 bool "Rockchip specific extensions for Innosilicon HDMI"
57 depends on DRM_ROCKCHIP
58 help 55 help
59 This selects support for Rockchip SoC specific extensions 56 This selects support for Rockchip SoC specific extensions
60 for the Innosilicon HDMI driver. If you want to enable 57 for the Innosilicon HDMI driver. If you want to enable
61 HDMI on RK3036 based SoC, you should select this option. 58 HDMI on RK3036 based SoC, you should select this option.
59
60endif
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 403bbd5f99a9..a12cc7ea99b6 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -520,6 +520,34 @@ static void vc4_crtc_disable(struct drm_crtc *crtc)
520 SCALER_DISPSTATX_EMPTY); 520 SCALER_DISPSTATX_EMPTY);
521} 521}
522 522
523static void vc4_crtc_update_dlist(struct drm_crtc *crtc)
524{
525 struct drm_device *dev = crtc->dev;
526 struct vc4_dev *vc4 = to_vc4_dev(dev);
527 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
528 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
529
530 if (crtc->state->event) {
531 unsigned long flags;
532
533 crtc->state->event->pipe = drm_crtc_index(crtc);
534
535 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
536
537 spin_lock_irqsave(&dev->event_lock, flags);
538 vc4_crtc->event = crtc->state->event;
539 crtc->state->event = NULL;
540
541 HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
542 vc4_state->mm.start);
543
544 spin_unlock_irqrestore(&dev->event_lock, flags);
545 } else {
546 HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
547 vc4_state->mm.start);
548 }
549}
550
523static void vc4_crtc_enable(struct drm_crtc *crtc) 551static void vc4_crtc_enable(struct drm_crtc *crtc)
524{ 552{
525 struct drm_device *dev = crtc->dev; 553 struct drm_device *dev = crtc->dev;
@@ -530,6 +558,12 @@ static void vc4_crtc_enable(struct drm_crtc *crtc)
530 558
531 require_hvs_enabled(dev); 559 require_hvs_enabled(dev);
532 560
561 /* Enable vblank irq handling before crtc is started otherwise
562 * drm_crtc_get_vblank() fails in vc4_crtc_update_dlist().
563 */
564 drm_crtc_vblank_on(crtc);
565 vc4_crtc_update_dlist(crtc);
566
533 /* Turn on the scaler, which will wait for vstart to start 567 /* Turn on the scaler, which will wait for vstart to start
534 * compositing. 568 * compositing.
535 */ 569 */
@@ -541,9 +575,6 @@ static void vc4_crtc_enable(struct drm_crtc *crtc)
541 /* Turn on the pixel valve, which will emit the vstart signal. */ 575 /* Turn on the pixel valve, which will emit the vstart signal. */
542 CRTC_WRITE(PV_V_CONTROL, 576 CRTC_WRITE(PV_V_CONTROL,
543 CRTC_READ(PV_V_CONTROL) | PV_VCONTROL_VIDEN); 577 CRTC_READ(PV_V_CONTROL) | PV_VCONTROL_VIDEN);
544
545 /* Enable vblank irq handling after crtc is started. */
546 drm_crtc_vblank_on(crtc);
547} 578}
548 579
549static bool vc4_crtc_mode_fixup(struct drm_crtc *crtc, 580static bool vc4_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -598,7 +629,6 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
598{ 629{
599 struct drm_device *dev = crtc->dev; 630 struct drm_device *dev = crtc->dev;
600 struct vc4_dev *vc4 = to_vc4_dev(dev); 631 struct vc4_dev *vc4 = to_vc4_dev(dev);
601 struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
602 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state); 632 struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
603 struct drm_plane *plane; 633 struct drm_plane *plane;
604 bool debug_dump_regs = false; 634 bool debug_dump_regs = false;
@@ -620,25 +650,15 @@ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
620 650
621 WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size); 651 WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size);
622 652
623 if (crtc->state->event) { 653 /* Only update DISPLIST if the CRTC was already running and is not
624 unsigned long flags; 654 * being disabled.
625 655 * vc4_crtc_enable() takes care of updating the dlist just after
626 crtc->state->event->pipe = drm_crtc_index(crtc); 656 * re-enabling VBLANK interrupts and before enabling the engine.
627 657 * If the CRTC is being disabled, there's no point in updating this
628 WARN_ON(drm_crtc_vblank_get(crtc) != 0); 658 * information.
629 659 */
630 spin_lock_irqsave(&dev->event_lock, flags); 660 if (crtc->state->active && old_state->active)
631 vc4_crtc->event = crtc->state->event; 661 vc4_crtc_update_dlist(crtc);
632 crtc->state->event = NULL;
633
634 HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
635 vc4_state->mm.start);
636
637 spin_unlock_irqrestore(&dev->event_lock, flags);
638 } else {
639 HVS_WRITE(SCALER_DISPLISTX(vc4_crtc->channel),
640 vc4_state->mm.start);
641 }
642 662
643 if (debug_dump_regs) { 663 if (debug_dump_regs) {
644 DRM_INFO("CRTC %d HVS after:\n", drm_crtc_index(crtc)); 664 DRM_INFO("CRTC %d HVS after:\n", drm_crtc_index(crtc));
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
index 35bf781e418e..c7056322211c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
@@ -30,49 +30,49 @@
30#include <drm/ttm/ttm_placement.h> 30#include <drm/ttm/ttm_placement.h>
31#include <drm/ttm/ttm_page_alloc.h> 31#include <drm/ttm/ttm_page_alloc.h>
32 32
33static struct ttm_place vram_placement_flags = { 33static const struct ttm_place vram_placement_flags = {
34 .fpfn = 0, 34 .fpfn = 0,
35 .lpfn = 0, 35 .lpfn = 0,
36 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED 36 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED
37}; 37};
38 38
39static struct ttm_place vram_ne_placement_flags = { 39static const struct ttm_place vram_ne_placement_flags = {
40 .fpfn = 0, 40 .fpfn = 0,
41 .lpfn = 0, 41 .lpfn = 0,
42 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT 42 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
43}; 43};
44 44
45static struct ttm_place sys_placement_flags = { 45static const struct ttm_place sys_placement_flags = {
46 .fpfn = 0, 46 .fpfn = 0,
47 .lpfn = 0, 47 .lpfn = 0,
48 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED 48 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED
49}; 49};
50 50
51static struct ttm_place sys_ne_placement_flags = { 51static const struct ttm_place sys_ne_placement_flags = {
52 .fpfn = 0, 52 .fpfn = 0,
53 .lpfn = 0, 53 .lpfn = 0,
54 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT 54 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
55}; 55};
56 56
57static struct ttm_place gmr_placement_flags = { 57static const struct ttm_place gmr_placement_flags = {
58 .fpfn = 0, 58 .fpfn = 0,
59 .lpfn = 0, 59 .lpfn = 0,
60 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED 60 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED
61}; 61};
62 62
63static struct ttm_place gmr_ne_placement_flags = { 63static const struct ttm_place gmr_ne_placement_flags = {
64 .fpfn = 0, 64 .fpfn = 0,
65 .lpfn = 0, 65 .lpfn = 0,
66 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT 66 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
67}; 67};
68 68
69static struct ttm_place mob_placement_flags = { 69static const struct ttm_place mob_placement_flags = {
70 .fpfn = 0, 70 .fpfn = 0,
71 .lpfn = 0, 71 .lpfn = 0,
72 .flags = VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED 72 .flags = VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED
73}; 73};
74 74
75static struct ttm_place mob_ne_placement_flags = { 75static const struct ttm_place mob_ne_placement_flags = {
76 .fpfn = 0, 76 .fpfn = 0,
77 .lpfn = 0, 77 .lpfn = 0,
78 .flags = VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT 78 .flags = VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
@@ -85,7 +85,7 @@ struct ttm_placement vmw_vram_placement = {
85 .busy_placement = &vram_placement_flags 85 .busy_placement = &vram_placement_flags
86}; 86};
87 87
88static struct ttm_place vram_gmr_placement_flags[] = { 88static const struct ttm_place vram_gmr_placement_flags[] = {
89 { 89 {
90 .fpfn = 0, 90 .fpfn = 0,
91 .lpfn = 0, 91 .lpfn = 0,
@@ -97,7 +97,7 @@ static struct ttm_place vram_gmr_placement_flags[] = {
97 } 97 }
98}; 98};
99 99
100static struct ttm_place gmr_vram_placement_flags[] = { 100static const struct ttm_place gmr_vram_placement_flags[] = {
101 { 101 {
102 .fpfn = 0, 102 .fpfn = 0,
103 .lpfn = 0, 103 .lpfn = 0,
@@ -116,7 +116,7 @@ struct ttm_placement vmw_vram_gmr_placement = {
116 .busy_placement = &gmr_placement_flags 116 .busy_placement = &gmr_placement_flags
117}; 117};
118 118
119static struct ttm_place vram_gmr_ne_placement_flags[] = { 119static const struct ttm_place vram_gmr_ne_placement_flags[] = {
120 { 120 {
121 .fpfn = 0, 121 .fpfn = 0,
122 .lpfn = 0, 122 .lpfn = 0,
@@ -165,7 +165,7 @@ struct ttm_placement vmw_sys_ne_placement = {
165 .busy_placement = &sys_ne_placement_flags 165 .busy_placement = &sys_ne_placement_flags
166}; 166};
167 167
168static struct ttm_place evictable_placement_flags[] = { 168static const struct ttm_place evictable_placement_flags[] = {
169 { 169 {
170 .fpfn = 0, 170 .fpfn = 0,
171 .lpfn = 0, 171 .lpfn = 0,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
index 99a7f4ab7d97..86178796de6c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
@@ -779,8 +779,8 @@ static int vmw_cmdbuf_space_pool(struct vmw_cmdbuf_man *man,
779 if (ret) 779 if (ret)
780 return ret; 780 return ret;
781 781
782 header->cb_header = dma_pool_alloc(man->headers, GFP_KERNEL, 782 header->cb_header = dma_pool_zalloc(man->headers, GFP_KERNEL,
783 &header->handle); 783 &header->handle);
784 if (!header->cb_header) { 784 if (!header->cb_header) {
785 ret = -ENOMEM; 785 ret = -ENOMEM;
786 goto out_no_cb_header; 786 goto out_no_cb_header;
@@ -790,7 +790,6 @@ static int vmw_cmdbuf_space_pool(struct vmw_cmdbuf_man *man,
790 cb_hdr = header->cb_header; 790 cb_hdr = header->cb_header;
791 offset = header->node.start << PAGE_SHIFT; 791 offset = header->node.start << PAGE_SHIFT;
792 header->cmd = man->map + offset; 792 header->cmd = man->map + offset;
793 memset(cb_hdr, 0, sizeof(*cb_hdr));
794 if (man->using_mob) { 793 if (man->using_mob) {
795 cb_hdr->flags = SVGA_CB_FLAG_MOB; 794 cb_hdr->flags = SVGA_CB_FLAG_MOB;
796 cb_hdr->ptr.mob.mobid = man->cmd_space->mem.start; 795 cb_hdr->ptr.mob.mobid = man->cmd_space->mem.start;
@@ -827,8 +826,8 @@ static int vmw_cmdbuf_space_inline(struct vmw_cmdbuf_man *man,
827 if (WARN_ON_ONCE(size > VMW_CMDBUF_INLINE_SIZE)) 826 if (WARN_ON_ONCE(size > VMW_CMDBUF_INLINE_SIZE))
828 return -ENOMEM; 827 return -ENOMEM;
829 828
830 dheader = dma_pool_alloc(man->dheaders, GFP_KERNEL, 829 dheader = dma_pool_zalloc(man->dheaders, GFP_KERNEL,
831 &header->handle); 830 &header->handle);
832 if (!dheader) 831 if (!dheader)
833 return -ENOMEM; 832 return -ENOMEM;
834 833
@@ -837,7 +836,6 @@ static int vmw_cmdbuf_space_inline(struct vmw_cmdbuf_man *man,
837 cb_hdr = &dheader->cb_header; 836 cb_hdr = &dheader->cb_header;
838 header->cb_header = cb_hdr; 837 header->cb_header = cb_hdr;
839 header->cmd = dheader->cmd; 838 header->cmd = dheader->cmd;
840 memset(dheader, 0, sizeof(*dheader));
841 cb_hdr->status = SVGA_CB_STATUS_NONE; 839 cb_hdr->status = SVGA_CB_STATUS_NONE;
842 cb_hdr->flags = SVGA_CB_FLAG_NONE; 840 cb_hdr->flags = SVGA_CB_FLAG_NONE;
843 cb_hdr->ptr.pa = (u64)header->handle + 841 cb_hdr->ptr.pa = (u64)header->handle +
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
index 1f013d45c9e9..36c7b6c839c0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c
@@ -205,7 +205,7 @@ int vmw_cmdbuf_res_add(struct vmw_cmdbuf_res_manager *man,
205 int ret; 205 int ret;
206 206
207 cres = kzalloc(sizeof(*cres), GFP_KERNEL); 207 cres = kzalloc(sizeof(*cres), GFP_KERNEL);
208 if (unlikely(cres == NULL)) 208 if (unlikely(!cres))
209 return -ENOMEM; 209 return -ENOMEM;
210 210
211 cres->hash.key = user_key | (res_type << 24); 211 cres->hash.key = user_key | (res_type << 24);
@@ -291,7 +291,7 @@ vmw_cmdbuf_res_man_create(struct vmw_private *dev_priv)
291 int ret; 291 int ret;
292 292
293 man = kzalloc(sizeof(*man), GFP_KERNEL); 293 man = kzalloc(sizeof(*man), GFP_KERNEL);
294 if (man == NULL) 294 if (!man)
295 return ERR_PTR(-ENOMEM); 295 return ERR_PTR(-ENOMEM);
296 296
297 man->dev_priv = dev_priv; 297 man->dev_priv = dev_priv;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index bcc6d4136c87..4212b3e673bc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -210,8 +210,8 @@ static int vmw_gb_context_init(struct vmw_private *dev_priv,
210 for (i = 0; i < SVGA_COTABLE_DX10_MAX; ++i) { 210 for (i = 0; i < SVGA_COTABLE_DX10_MAX; ++i) {
211 uctx->cotables[i] = vmw_cotable_alloc(dev_priv, 211 uctx->cotables[i] = vmw_cotable_alloc(dev_priv,
212 &uctx->res, i); 212 &uctx->res, i);
213 if (unlikely(uctx->cotables[i] == NULL)) { 213 if (unlikely(IS_ERR(uctx->cotables[i]))) {
214 ret = -ENOMEM; 214 ret = PTR_ERR(uctx->cotables[i]);
215 goto out_cotables; 215 goto out_cotables;
216 } 216 }
217 } 217 }
@@ -777,7 +777,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
777 } 777 }
778 778
779 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 779 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
780 if (unlikely(ctx == NULL)) { 780 if (unlikely(!ctx)) {
781 ttm_mem_global_free(vmw_mem_glob(dev_priv), 781 ttm_mem_global_free(vmw_mem_glob(dev_priv),
782 vmw_user_context_size); 782 vmw_user_context_size);
783 ret = -ENOMEM; 783 ret = -ENOMEM;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
index 6c026d75c180..d87861bbe971 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
@@ -584,7 +584,7 @@ struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv,
584 return ERR_PTR(ret); 584 return ERR_PTR(ret);
585 585
586 vcotbl = kzalloc(sizeof(*vcotbl), GFP_KERNEL); 586 vcotbl = kzalloc(sizeof(*vcotbl), GFP_KERNEL);
587 if (unlikely(vcotbl == NULL)) { 587 if (unlikely(!vcotbl)) {
588 ret = -ENOMEM; 588 ret = -ENOMEM;
589 goto out_no_alloc; 589 goto out_no_alloc;
590 } 590 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 4a641555b960..4436d53ae16c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -227,7 +227,7 @@ static const struct drm_ioctl_desc vmw_ioctls[] = {
227 DRM_AUTH | DRM_RENDER_ALLOW), 227 DRM_AUTH | DRM_RENDER_ALLOW),
228}; 228};
229 229
230static struct pci_device_id vmw_pci_id_list[] = { 230static const struct pci_device_id vmw_pci_id_list[] = {
231 {0x15ad, 0x0405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VMWGFX_CHIP_SVGAII}, 231 {0x15ad, 0x0405, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VMWGFX_CHIP_SVGAII},
232 {0, 0, 0} 232 {0, 0, 0}
233}; 233};
@@ -630,7 +630,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
630 char host_log[100] = {0}; 630 char host_log[100] = {0};
631 631
632 dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); 632 dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
633 if (unlikely(dev_priv == NULL)) { 633 if (unlikely(!dev_priv)) {
634 DRM_ERROR("Failed allocating a device private struct.\n"); 634 DRM_ERROR("Failed allocating a device private struct.\n");
635 return -ENOMEM; 635 return -ENOMEM;
636 } 636 }
@@ -1035,7 +1035,7 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv)
1035 int ret = -ENOMEM; 1035 int ret = -ENOMEM;
1036 1036
1037 vmw_fp = kzalloc(sizeof(*vmw_fp), GFP_KERNEL); 1037 vmw_fp = kzalloc(sizeof(*vmw_fp), GFP_KERNEL);
1038 if (unlikely(vmw_fp == NULL)) 1038 if (unlikely(!vmw_fp))
1039 return ret; 1039 return ret;
1040 1040
1041 vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10); 1041 vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10);
@@ -1196,7 +1196,7 @@ static int vmw_master_create(struct drm_device *dev,
1196 struct vmw_master *vmaster; 1196 struct vmw_master *vmaster;
1197 1197
1198 vmaster = kzalloc(sizeof(*vmaster), GFP_KERNEL); 1198 vmaster = kzalloc(sizeof(*vmaster), GFP_KERNEL);
1199 if (unlikely(vmaster == NULL)) 1199 if (unlikely(!vmaster))
1200 return -ENOMEM; 1200 return -ENOMEM;
1201 1201
1202 vmw_master_init(vmaster); 1202 vmw_master_init(vmaster);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index c7b53d987f06..2cfb3c93f42a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -264,7 +264,7 @@ static int vmw_resource_val_add(struct vmw_sw_context *sw_context,
264 } 264 }
265 265
266 node = kzalloc(sizeof(*node), GFP_KERNEL); 266 node = kzalloc(sizeof(*node), GFP_KERNEL);
267 if (unlikely(node == NULL)) { 267 if (unlikely(!node)) {
268 DRM_ERROR("Failed to allocate a resource validation " 268 DRM_ERROR("Failed to allocate a resource validation "
269 "entry.\n"); 269 "entry.\n");
270 return -ENOMEM; 270 return -ENOMEM;
@@ -452,7 +452,7 @@ static int vmw_resource_relocation_add(struct list_head *list,
452 struct vmw_resource_relocation *rel; 452 struct vmw_resource_relocation *rel;
453 453
454 rel = kmalloc(sizeof(*rel), GFP_KERNEL); 454 rel = kmalloc(sizeof(*rel), GFP_KERNEL);
455 if (unlikely(rel == NULL)) { 455 if (unlikely(!rel)) {
456 DRM_ERROR("Failed to allocate a resource relocation.\n"); 456 DRM_ERROR("Failed to allocate a resource relocation.\n");
457 return -ENOMEM; 457 return -ENOMEM;
458 } 458 }
@@ -519,7 +519,7 @@ static int vmw_cmd_invalid(struct vmw_private *dev_priv,
519 struct vmw_sw_context *sw_context, 519 struct vmw_sw_context *sw_context,
520 SVGA3dCmdHeader *header) 520 SVGA3dCmdHeader *header)
521{ 521{
522 return capable(CAP_SYS_ADMIN) ? : -EINVAL; 522 return -EINVAL;
523} 523}
524 524
525static int vmw_cmd_ok(struct vmw_private *dev_priv, 525static int vmw_cmd_ok(struct vmw_private *dev_priv,
@@ -2584,7 +2584,7 @@ static int vmw_cmd_dx_set_vertex_buffers(struct vmw_private *dev_priv,
2584 2584
2585/** 2585/**
2586 * vmw_cmd_dx_ia_set_vertex_buffers - Validate an 2586 * vmw_cmd_dx_ia_set_vertex_buffers - Validate an
2587 * SVGA_3D_CMD_DX_IA_SET_VERTEX_BUFFERS command. 2587 * SVGA_3D_CMD_DX_IA_SET_INDEX_BUFFER command.
2588 * 2588 *
2589 * @dev_priv: Pointer to a device private struct. 2589 * @dev_priv: Pointer to a device private struct.
2590 * @sw_context: The software context being used for this batch. 2590 * @sw_context: The software context being used for this batch.
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 6b2708b4eafe..b8bc5bc7de7e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -284,7 +284,7 @@ struct vmw_fence_manager *vmw_fence_manager_init(struct vmw_private *dev_priv)
284{ 284{
285 struct vmw_fence_manager *fman = kzalloc(sizeof(*fman), GFP_KERNEL); 285 struct vmw_fence_manager *fman = kzalloc(sizeof(*fman), GFP_KERNEL);
286 286
287 if (unlikely(fman == NULL)) 287 if (unlikely(!fman))
288 return NULL; 288 return NULL;
289 289
290 fman->dev_priv = dev_priv; 290 fman->dev_priv = dev_priv;
@@ -541,7 +541,7 @@ int vmw_fence_create(struct vmw_fence_manager *fman,
541 int ret; 541 int ret;
542 542
543 fence = kzalloc(sizeof(*fence), GFP_KERNEL); 543 fence = kzalloc(sizeof(*fence), GFP_KERNEL);
544 if (unlikely(fence == NULL)) 544 if (unlikely(!fence))
545 return -ENOMEM; 545 return -ENOMEM;
546 546
547 ret = vmw_fence_obj_init(fman, fence, seqno, 547 ret = vmw_fence_obj_init(fman, fence, seqno,
@@ -606,7 +606,7 @@ int vmw_user_fence_create(struct drm_file *file_priv,
606 return ret; 606 return ret;
607 607
608 ufence = kzalloc(sizeof(*ufence), GFP_KERNEL); 608 ufence = kzalloc(sizeof(*ufence), GFP_KERNEL);
609 if (unlikely(ufence == NULL)) { 609 if (unlikely(!ufence)) {
610 ret = -ENOMEM; 610 ret = -ENOMEM;
611 goto out_no_object; 611 goto out_no_object;
612 } 612 }
@@ -966,7 +966,7 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv,
966 struct vmw_fence_manager *fman = fman_from_fence(fence); 966 struct vmw_fence_manager *fman = fman_from_fence(fence);
967 967
968 eaction = kzalloc(sizeof(*eaction), GFP_KERNEL); 968 eaction = kzalloc(sizeof(*eaction), GFP_KERNEL);
969 if (unlikely(eaction == NULL)) 969 if (unlikely(!eaction))
970 return -ENOMEM; 970 return -ENOMEM;
971 971
972 eaction->event = event; 972 eaction->event = event;
@@ -1002,7 +1002,7 @@ static int vmw_event_fence_action_create(struct drm_file *file_priv,
1002 int ret; 1002 int ret;
1003 1003
1004 event = kzalloc(sizeof(*event), GFP_KERNEL); 1004 event = kzalloc(sizeof(*event), GFP_KERNEL);
1005 if (unlikely(event == NULL)) { 1005 if (unlikely(!event)) {
1006 DRM_ERROR("Failed to allocate an event.\n"); 1006 DRM_ERROR("Failed to allocate an event.\n");
1007 ret = -ENOMEM; 1007 ret = -ENOMEM;
1008 goto out_no_space; 1008 goto out_no_space;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index c1900f4390a4..d2b03d4a3c86 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -121,7 +121,7 @@ static int vmw_gmrid_man_init(struct ttm_mem_type_manager *man,
121 struct vmwgfx_gmrid_man *gman = 121 struct vmwgfx_gmrid_man *gman =
122 kzalloc(sizeof(*gman), GFP_KERNEL); 122 kzalloc(sizeof(*gman), GFP_KERNEL);
123 123
124 if (unlikely(gman == NULL)) 124 if (unlikely(!gman))
125 return -ENOMEM; 125 return -ENOMEM;
126 126
127 spin_lock_init(&gman->lock); 127 spin_lock_init(&gman->lock);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 3d94ea67a825..61e06f0e8cd3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -384,6 +384,12 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
384 384
385 hotspot_x = du->hotspot_x; 385 hotspot_x = du->hotspot_x;
386 hotspot_y = du->hotspot_y; 386 hotspot_y = du->hotspot_y;
387
388 if (plane->fb) {
389 hotspot_x += plane->fb->hot_x;
390 hotspot_y += plane->fb->hot_y;
391 }
392
387 du->cursor_surface = vps->surf; 393 du->cursor_surface = vps->surf;
388 du->cursor_dmabuf = vps->dmabuf; 394 du->cursor_dmabuf = vps->dmabuf;
389 395
@@ -411,6 +417,9 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
411 vmw_cursor_update_position(dev_priv, true, 417 vmw_cursor_update_position(dev_priv, true,
412 du->cursor_x + hotspot_x, 418 du->cursor_x + hotspot_x,
413 du->cursor_y + hotspot_y); 419 du->cursor_y + hotspot_y);
420
421 du->core_hotspot_x = hotspot_x - du->hotspot_x;
422 du->core_hotspot_y = hotspot_y - du->hotspot_y;
414 } else { 423 } else {
415 DRM_ERROR("Failed to update cursor image\n"); 424 DRM_ERROR("Failed to update cursor image\n");
416 } 425 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
index 941bcfd131ff..b17f08fc50d3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
@@ -320,14 +320,14 @@ int vmw_otables_setup(struct vmw_private *dev_priv)
320 320
321 if (dev_priv->has_dx) { 321 if (dev_priv->has_dx) {
322 *otables = kmemdup(dx_tables, sizeof(dx_tables), GFP_KERNEL); 322 *otables = kmemdup(dx_tables, sizeof(dx_tables), GFP_KERNEL);
323 if (*otables == NULL) 323 if (!(*otables))
324 return -ENOMEM; 324 return -ENOMEM;
325 325
326 dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables); 326 dev_priv->otable_batch.num_otables = ARRAY_SIZE(dx_tables);
327 } else { 327 } else {
328 *otables = kmemdup(pre_dx_tables, sizeof(pre_dx_tables), 328 *otables = kmemdup(pre_dx_tables, sizeof(pre_dx_tables),
329 GFP_KERNEL); 329 GFP_KERNEL);
330 if (*otables == NULL) 330 if (!(*otables))
331 return -ENOMEM; 331 return -ENOMEM;
332 332
333 dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables); 333 dev_priv->otable_batch.num_otables = ARRAY_SIZE(pre_dx_tables);
@@ -407,7 +407,7 @@ struct vmw_mob *vmw_mob_create(unsigned long data_pages)
407{ 407{
408 struct vmw_mob *mob = kzalloc(sizeof(*mob), GFP_KERNEL); 408 struct vmw_mob *mob = kzalloc(sizeof(*mob), GFP_KERNEL);
409 409
410 if (unlikely(mob == NULL)) 410 if (unlikely(!mob))
411 return NULL; 411 return NULL;
412 412
413 mob->num_pages = vmw_mob_calculate_pt_pages(data_pages); 413 mob->num_pages = vmw_mob_calculate_pt_pages(data_pages);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index 6063c9636d4a..97000996b8dc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -244,7 +244,7 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg,
244 244
245 reply_len = ebx; 245 reply_len = ebx;
246 reply = kzalloc(reply_len + 1, GFP_KERNEL); 246 reply = kzalloc(reply_len + 1, GFP_KERNEL);
247 if (reply == NULL) { 247 if (!reply) {
248 DRM_ERROR("Cannot allocate memory for reply\n"); 248 DRM_ERROR("Cannot allocate memory for reply\n");
249 return -ENOMEM; 249 return -ENOMEM;
250 } 250 }
@@ -340,7 +340,7 @@ int vmw_host_get_guestinfo(const char *guest_info_param,
340 340
341 msg_len = strlen(guest_info_param) + strlen("info-get ") + 1; 341 msg_len = strlen(guest_info_param) + strlen("info-get ") + 1;
342 msg = kzalloc(msg_len, GFP_KERNEL); 342 msg = kzalloc(msg_len, GFP_KERNEL);
343 if (msg == NULL) { 343 if (!msg) {
344 DRM_ERROR("Cannot allocate memory to get %s", guest_info_param); 344 DRM_ERROR("Cannot allocate memory to get %s", guest_info_param);
345 return -ENOMEM; 345 return -ENOMEM;
346 } 346 }
@@ -400,7 +400,7 @@ int vmw_host_log(const char *log)
400 400
401 msg_len = strlen(log) + strlen("log ") + 1; 401 msg_len = strlen(log) + strlen("log ") + 1;
402 msg = kzalloc(msg_len, GFP_KERNEL); 402 msg = kzalloc(msg_len, GFP_KERNEL);
403 if (msg == NULL) { 403 if (!msg) {
404 DRM_ERROR("Cannot allocate memory for log message\n"); 404 DRM_ERROR("Cannot allocate memory for log message\n");
405 return -ENOMEM; 405 return -ENOMEM;
406 } 406 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 7d591f653dfa..a96f90f017d1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -446,7 +446,7 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
446 int ret; 446 int ret;
447 447
448 user_bo = kzalloc(sizeof(*user_bo), GFP_KERNEL); 448 user_bo = kzalloc(sizeof(*user_bo), GFP_KERNEL);
449 if (unlikely(user_bo == NULL)) { 449 if (unlikely(!user_bo)) {
450 DRM_ERROR("Failed to allocate a buffer.\n"); 450 DRM_ERROR("Failed to allocate a buffer.\n");
451 return -ENOMEM; 451 return -ENOMEM;
452 } 452 }
@@ -836,7 +836,7 @@ static int vmw_resource_buf_alloc(struct vmw_resource *res,
836 } 836 }
837 837
838 backup = kzalloc(sizeof(*backup), GFP_KERNEL); 838 backup = kzalloc(sizeof(*backup), GFP_KERNEL);
839 if (unlikely(backup == NULL)) 839 if (unlikely(!backup))
840 return -ENOMEM; 840 return -ENOMEM;
841 841
842 ret = vmw_dmabuf_init(res->dev_priv, backup, res->backup_size, 842 ret = vmw_dmabuf_init(res->dev_priv, backup, res->backup_size,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 68f135c5b0d8..9b832f136813 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -751,7 +751,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
751 } 751 }
752 752
753 ushader = kzalloc(sizeof(*ushader), GFP_KERNEL); 753 ushader = kzalloc(sizeof(*ushader), GFP_KERNEL);
754 if (unlikely(ushader == NULL)) { 754 if (unlikely(!ushader)) {
755 ttm_mem_global_free(vmw_mem_glob(dev_priv), 755 ttm_mem_global_free(vmw_mem_glob(dev_priv),
756 vmw_user_shader_size); 756 vmw_user_shader_size);
757 ret = -ENOMEM; 757 ret = -ENOMEM;
@@ -821,7 +821,7 @@ static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv,
821 } 821 }
822 822
823 shader = kzalloc(sizeof(*shader), GFP_KERNEL); 823 shader = kzalloc(sizeof(*shader), GFP_KERNEL);
824 if (unlikely(shader == NULL)) { 824 if (unlikely(!shader)) {
825 ttm_mem_global_free(vmw_mem_glob(dev_priv), 825 ttm_mem_global_free(vmw_mem_glob(dev_priv),
826 vmw_shader_size); 826 vmw_shader_size);
827 ret = -ENOMEM; 827 ret = -ENOMEM;
@@ -981,7 +981,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
981 981
982 /* Allocate and pin a DMA buffer */ 982 /* Allocate and pin a DMA buffer */
983 buf = kzalloc(sizeof(*buf), GFP_KERNEL); 983 buf = kzalloc(sizeof(*buf), GFP_KERNEL);
984 if (unlikely(buf == NULL)) 984 if (unlikely(!buf))
985 return -ENOMEM; 985 return -ENOMEM;
986 986
987 ret = vmw_dmabuf_init(dev_priv, buf, size, &vmw_sys_ne_placement, 987 ret = vmw_dmabuf_init(dev_priv, buf, size, &vmw_sys_ne_placement,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 50be1f034f9e..5284e8d2f7ba 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -1640,8 +1640,8 @@ int vmw_kms_stdu_init_display(struct vmw_private *dev_priv)
1640 * something arbitrarily large and we will reject any layout 1640 * something arbitrarily large and we will reject any layout
1641 * that doesn't fit prim_bb_mem later 1641 * that doesn't fit prim_bb_mem later
1642 */ 1642 */
1643 dev->mode_config.max_width = 16384; 1643 dev->mode_config.max_width = 8192;
1644 dev->mode_config.max_height = 16384; 1644 dev->mode_config.max_height = 8192;
1645 } 1645 }
1646 1646
1647 vmw_kms_create_implicit_placement_property(dev_priv, false); 1647 vmw_kms_create_implicit_placement_property(dev_priv, false);
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 2c58a390123a..778272514164 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -186,8 +186,13 @@ static int host1x_probe(struct platform_device *pdev)
186 return -ENOMEM; 186 return -ENOMEM;
187 187
188 err = iommu_attach_device(host->domain, &pdev->dev); 188 err = iommu_attach_device(host->domain, &pdev->dev);
189 if (err) 189 if (err == -ENODEV) {
190 iommu_domain_free(host->domain);
191 host->domain = NULL;
192 goto skip_iommu;
193 } else if (err) {
190 goto fail_free_domain; 194 goto fail_free_domain;
195 }
191 196
192 geometry = &host->domain->geometry; 197 geometry = &host->domain->geometry;
193 198
@@ -198,6 +203,7 @@ static int host1x_probe(struct platform_device *pdev)
198 host->iova_end = geometry->aperture_end; 203 host->iova_end = geometry->aperture_end;
199 } 204 }
200 205
206skip_iommu:
201 err = host1x_channel_list_init(&host->channel_list, 207 err = host1x_channel_list_init(&host->channel_list,
202 host->info->nb_channels); 208 host->info->nb_channels);
203 if (err) { 209 if (err) {
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 6fd01a692197..9017dcc14502 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2216,6 +2216,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
2216#if IS_ENABLED(CONFIG_HID_ORTEK) 2216#if IS_ENABLED(CONFIG_HID_ORTEK)
2217 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 2217 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
2218 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 2218 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
2219 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
2219 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, 2220 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
2220#endif 2221#endif
2221#if IS_ENABLED(CONFIG_HID_PANTHERLORD) 2222#if IS_ENABLED(CONFIG_HID_PANTHERLORD)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3d911bfd91cf..c9ba4c6db74c 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -824,6 +824,7 @@
824#define USB_VENDOR_ID_ORTEK 0x05a4 824#define USB_VENDOR_ID_ORTEK 0x05a4
825#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 825#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
826#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 826#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
827#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
827 828
828#define USB_VENDOR_ID_PLANTRONICS 0x047f 829#define USB_VENDOR_ID_PLANTRONICS 0x047f
829 830
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 41b39464ded8..501e16a9227d 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2732,6 +2732,9 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp)
2732 hidpp_battery_props, 2732 hidpp_battery_props,
2733 sizeof(hidpp_battery_props), 2733 sizeof(hidpp_battery_props),
2734 GFP_KERNEL); 2734 GFP_KERNEL);
2735 if (!battery_props)
2736 return -ENOMEM;
2737
2735 num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2; 2738 num_battery_props = ARRAY_SIZE(hidpp_battery_props) - 2;
2736 2739
2737 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE) 2740 if (hidpp->capabilities & HIDPP_CAPABILITY_BATTERY_MILEAGE)
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index f3e35e7a189d..aff20f4b6d97 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -620,16 +620,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
620 return 0; 620 return 0;
621} 621}
622 622
623static int mt_touch_input_mapped(struct hid_device *hdev, struct hid_input *hi,
624 struct hid_field *field, struct hid_usage *usage,
625 unsigned long **bit, int *max)
626{
627 if (usage->type == EV_KEY || usage->type == EV_ABS)
628 set_bit(usage->type, hi->input->evbit);
629
630 return -1;
631}
632
633static int mt_compute_slot(struct mt_device *td, struct input_dev *input) 623static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
634{ 624{
635 __s32 quirks = td->mtclass.quirks; 625 __s32 quirks = td->mtclass.quirks;
@@ -969,8 +959,10 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
969 return 0; 959 return 0;
970 960
971 if (field->application == HID_DG_TOUCHSCREEN || 961 if (field->application == HID_DG_TOUCHSCREEN ||
972 field->application == HID_DG_TOUCHPAD) 962 field->application == HID_DG_TOUCHPAD) {
973 return mt_touch_input_mapped(hdev, hi, field, usage, bit, max); 963 /* We own these mappings, tell hid-input to ignore them */
964 return -1;
965 }
974 966
975 /* let hid-core decide for the others */ 967 /* let hid-core decide for the others */
976 return 0; 968 return 0;
diff --git a/drivers/hid/hid-ortek.c b/drivers/hid/hid-ortek.c
index 6620f15fec22..8783a064cdcf 100644
--- a/drivers/hid/hid-ortek.c
+++ b/drivers/hid/hid-ortek.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Ortek PKB-1700 6 * Ortek PKB-1700
7 * Ortek WKB-2000 7 * Ortek WKB-2000
8 * iHome IMAC-A210S
8 * Skycable wireless presenter 9 * Skycable wireless presenter
9 * 10 *
10 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com> 11 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
@@ -28,10 +29,10 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
28 unsigned int *rsize) 29 unsigned int *rsize)
29{ 30{
30 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { 31 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
31 hid_info(hdev, "Fixing up logical minimum in report descriptor (Ortek)\n"); 32 hid_info(hdev, "Fixing up logical maximum in report descriptor (Ortek)\n");
32 rdesc[55] = 0x92; 33 rdesc[55] = 0x92;
33 } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) { 34 } else if (*rsize >= 54 && rdesc[52] == 0x25 && rdesc[53] == 0x01) {
34 hid_info(hdev, "Fixing up logical minimum in report descriptor (Skycable)\n"); 35 hid_info(hdev, "Fixing up logical maximum in report descriptor (Skycable)\n");
35 rdesc[53] = 0x65; 36 rdesc[53] = 0x65;
36 } 37 }
37 return rdesc; 38 return rdesc;
@@ -40,6 +41,7 @@ static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
40static const struct hid_device_id ortek_devices[] = { 41static const struct hid_device_id ortek_devices[] = {
41 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) }, 42 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_PKB1700) },
42 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, 43 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
44 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S) },
43 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, 45 { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
44 { } 46 { }
45}; 47};
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 76013eb5cb7f..c008847e0b20 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -680,18 +680,21 @@ static int usbhid_open(struct hid_device *hid)
680 struct usbhid_device *usbhid = hid->driver_data; 680 struct usbhid_device *usbhid = hid->driver_data;
681 int res; 681 int res;
682 682
683 set_bit(HID_OPENED, &usbhid->iofl);
684
683 if (hid->quirks & HID_QUIRK_ALWAYS_POLL) 685 if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
684 return 0; 686 return 0;
685 687
686 res = usb_autopm_get_interface(usbhid->intf); 688 res = usb_autopm_get_interface(usbhid->intf);
687 /* the device must be awake to reliably request remote wakeup */ 689 /* the device must be awake to reliably request remote wakeup */
688 if (res < 0) 690 if (res < 0) {
691 clear_bit(HID_OPENED, &usbhid->iofl);
689 return -EIO; 692 return -EIO;
693 }
690 694
691 usbhid->intf->needs_remote_wakeup = 1; 695 usbhid->intf->needs_remote_wakeup = 1;
692 696
693 set_bit(HID_RESUME_RUNNING, &usbhid->iofl); 697 set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
694 set_bit(HID_OPENED, &usbhid->iofl);
695 set_bit(HID_IN_POLLING, &usbhid->iofl); 698 set_bit(HID_IN_POLLING, &usbhid->iofl);
696 699
697 res = hid_start_in(hid); 700 res = hid_start_in(hid);
@@ -727,19 +730,20 @@ static void usbhid_close(struct hid_device *hid)
727{ 730{
728 struct usbhid_device *usbhid = hid->driver_data; 731 struct usbhid_device *usbhid = hid->driver_data;
729 732
730 if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
731 return;
732
733 /* 733 /*
734 * Make sure we don't restart data acquisition due to 734 * Make sure we don't restart data acquisition due to
735 * a resumption we no longer care about by avoiding racing 735 * a resumption we no longer care about by avoiding racing
736 * with hid_start_in(). 736 * with hid_start_in().
737 */ 737 */
738 spin_lock_irq(&usbhid->lock); 738 spin_lock_irq(&usbhid->lock);
739 clear_bit(HID_IN_POLLING, &usbhid->iofl);
740 clear_bit(HID_OPENED, &usbhid->iofl); 739 clear_bit(HID_OPENED, &usbhid->iofl);
740 if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL))
741 clear_bit(HID_IN_POLLING, &usbhid->iofl);
741 spin_unlock_irq(&usbhid->lock); 742 spin_unlock_irq(&usbhid->lock);
742 743
744 if (hid->quirks & HID_QUIRK_ALWAYS_POLL)
745 return;
746
743 hid_cancel_delayed_stuff(usbhid); 747 hid_cancel_delayed_stuff(usbhid);
744 usb_kill_urb(usbhid->urbin); 748 usb_kill_urb(usbhid->urbin);
745 usbhid->intf->needs_remote_wakeup = 0; 749 usbhid->intf->needs_remote_wakeup = 0;
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index e9bf0bb87ac4..e57cc40cb768 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -606,6 +606,8 @@ static int vmbus_close_internal(struct vmbus_channel *channel)
606 get_order(channel->ringbuffer_pagecount * PAGE_SIZE)); 606 get_order(channel->ringbuffer_pagecount * PAGE_SIZE));
607 607
608out: 608out:
609 /* re-enable tasklet for use on re-open */
610 tasklet_enable(&channel->callback_event);
609 return ret; 611 return ret;
610} 612}
611 613
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 0af7fd311979..76c34f4fde13 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -566,6 +566,8 @@ static int applesmc_init_smcreg_try(void)
566 if (ret) 566 if (ret)
567 return ret; 567 return ret;
568 s->fan_count = tmp[0]; 568 s->fan_count = tmp[0];
569 if (s->fan_count > 10)
570 s->fan_count = 10;
569 571
570 ret = applesmc_get_lower_bound(&s->temp_begin, "T"); 572 ret = applesmc_get_lower_bound(&s->temp_begin, "T");
571 if (ret) 573 if (ret)
@@ -811,7 +813,8 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
811 char newkey[5]; 813 char newkey[5];
812 u8 buffer[2]; 814 u8 buffer[2];
813 815
814 sprintf(newkey, fan_speed_fmt[to_option(attr)], to_index(attr)); 816 scnprintf(newkey, sizeof(newkey), fan_speed_fmt[to_option(attr)],
817 to_index(attr));
815 818
816 ret = applesmc_read_key(newkey, buffer, 2); 819 ret = applesmc_read_key(newkey, buffer, 2);
817 speed = ((buffer[0] << 8 | buffer[1]) >> 2); 820 speed = ((buffer[0] << 8 | buffer[1]) >> 2);
@@ -834,7 +837,8 @@ static ssize_t applesmc_store_fan_speed(struct device *dev,
834 if (kstrtoul(sysfsbuf, 10, &speed) < 0 || speed >= 0x4000) 837 if (kstrtoul(sysfsbuf, 10, &speed) < 0 || speed >= 0x4000)
835 return -EINVAL; /* Bigger than a 14-bit value */ 838 return -EINVAL; /* Bigger than a 14-bit value */
836 839
837 sprintf(newkey, fan_speed_fmt[to_option(attr)], to_index(attr)); 840 scnprintf(newkey, sizeof(newkey), fan_speed_fmt[to_option(attr)],
841 to_index(attr));
838 842
839 buffer[0] = (speed >> 6) & 0xff; 843 buffer[0] = (speed >> 6) & 0xff;
840 buffer[1] = (speed << 2) & 0xff; 844 buffer[1] = (speed << 2) & 0xff;
@@ -903,7 +907,7 @@ static ssize_t applesmc_show_fan_position(struct device *dev,
903 char newkey[5]; 907 char newkey[5];
904 u8 buffer[17]; 908 u8 buffer[17];
905 909
906 sprintf(newkey, FAN_ID_FMT, to_index(attr)); 910 scnprintf(newkey, sizeof(newkey), FAN_ID_FMT, to_index(attr));
907 911
908 ret = applesmc_read_key(newkey, buffer, 16); 912 ret = applesmc_read_key(newkey, buffer, 16);
909 buffer[16] = 0; 913 buffer[16] = 0;
@@ -1116,7 +1120,8 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num)
1116 } 1120 }
1117 for (i = 0; i < num; i++) { 1121 for (i = 0; i < num; i++) {
1118 node = &grp->nodes[i]; 1122 node = &grp->nodes[i];
1119 sprintf(node->name, grp->format, i + 1); 1123 scnprintf(node->name, sizeof(node->name), grp->format,
1124 i + 1);
1120 node->sda.index = (grp->option << 16) | (i & 0xffff); 1125 node->sda.index = (grp->option << 16) | (i & 0xffff);
1121 node->sda.dev_attr.show = grp->show; 1126 node->sda.dev_attr.show = grp->show;
1122 node->sda.dev_attr.store = grp->store; 1127 node->sda.dev_attr.store = grp->store;
diff --git a/drivers/ide/ide-timings.c b/drivers/ide/ide-timings.c
index 0e05f75934c9..1858e3ce3993 100644
--- a/drivers/ide/ide-timings.c
+++ b/drivers/ide/ide-timings.c
@@ -104,19 +104,19 @@ u16 ide_pio_cycle_time(ide_drive_t *drive, u8 pio)
104EXPORT_SYMBOL_GPL(ide_pio_cycle_time); 104EXPORT_SYMBOL_GPL(ide_pio_cycle_time);
105 105
106#define ENOUGH(v, unit) (((v) - 1) / (unit) + 1) 106#define ENOUGH(v, unit) (((v) - 1) / (unit) + 1)
107#define EZ(v, unit) ((v) ? ENOUGH(v, unit) : 0) 107#define EZ(v, unit) ((v) ? ENOUGH((v) * 1000, unit) : 0)
108 108
109static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, 109static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q,
110 int T, int UT) 110 int T, int UT)
111{ 111{
112 q->setup = EZ(t->setup * 1000, T); 112 q->setup = EZ(t->setup, T);
113 q->act8b = EZ(t->act8b * 1000, T); 113 q->act8b = EZ(t->act8b, T);
114 q->rec8b = EZ(t->rec8b * 1000, T); 114 q->rec8b = EZ(t->rec8b, T);
115 q->cyc8b = EZ(t->cyc8b * 1000, T); 115 q->cyc8b = EZ(t->cyc8b, T);
116 q->active = EZ(t->active * 1000, T); 116 q->active = EZ(t->active, T);
117 q->recover = EZ(t->recover * 1000, T); 117 q->recover = EZ(t->recover, T);
118 q->cycle = EZ(t->cycle * 1000, T); 118 q->cycle = EZ(t->cycle, T);
119 q->udma = EZ(t->udma * 1000, UT); 119 q->udma = EZ(t->udma, UT);
120} 120}
121 121
122void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, 122void ide_timing_merge(struct ide_timing *a, struct ide_timing *b,
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index a6cb379a4ebc..01236cef7bfb 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -268,6 +268,7 @@ int rdma_translate_ip(const struct sockaddr *addr,
268 return ret; 268 return ret;
269 269
270 ret = rdma_copy_addr(dev_addr, dev, NULL); 270 ret = rdma_copy_addr(dev_addr, dev, NULL);
271 dev_addr->bound_dev_if = dev->ifindex;
271 if (vlan_id) 272 if (vlan_id)
272 *vlan_id = rdma_vlan_dev_vlan_id(dev); 273 *vlan_id = rdma_vlan_dev_vlan_id(dev);
273 dev_put(dev); 274 dev_put(dev);
@@ -280,6 +281,7 @@ int rdma_translate_ip(const struct sockaddr *addr,
280 &((const struct sockaddr_in6 *)addr)->sin6_addr, 281 &((const struct sockaddr_in6 *)addr)->sin6_addr,
281 dev, 1)) { 282 dev, 1)) {
282 ret = rdma_copy_addr(dev_addr, dev, NULL); 283 ret = rdma_copy_addr(dev_addr, dev, NULL);
284 dev_addr->bound_dev_if = dev->ifindex;
283 if (vlan_id) 285 if (vlan_id)
284 *vlan_id = rdma_vlan_dev_vlan_id(dev); 286 *vlan_id = rdma_vlan_dev_vlan_id(dev);
285 break; 287 break;
@@ -405,10 +407,10 @@ static int addr4_resolve(struct sockaddr_in *src_in,
405 fl4.saddr = src_ip; 407 fl4.saddr = src_ip;
406 fl4.flowi4_oif = addr->bound_dev_if; 408 fl4.flowi4_oif = addr->bound_dev_if;
407 rt = ip_route_output_key(addr->net, &fl4); 409 rt = ip_route_output_key(addr->net, &fl4);
408 if (IS_ERR(rt)) { 410 ret = PTR_ERR_OR_ZERO(rt);
409 ret = PTR_ERR(rt); 411 if (ret)
410 goto out; 412 return ret;
411 } 413
412 src_in->sin_family = AF_INET; 414 src_in->sin_family = AF_INET;
413 src_in->sin_addr.s_addr = fl4.saddr; 415 src_in->sin_addr.s_addr = fl4.saddr;
414 416
@@ -423,8 +425,6 @@ static int addr4_resolve(struct sockaddr_in *src_in,
423 425
424 *prt = rt; 426 *prt = rt;
425 return 0; 427 return 0;
426out:
427 return ret;
428} 428}
429 429
430#if IS_ENABLED(CONFIG_IPV6) 430#if IS_ENABLED(CONFIG_IPV6)
@@ -509,6 +509,11 @@ static int addr_resolve(struct sockaddr *src_in,
509 struct dst_entry *dst; 509 struct dst_entry *dst;
510 int ret; 510 int ret;
511 511
512 if (!addr->net) {
513 pr_warn_ratelimited("%s: missing namespace\n", __func__);
514 return -EINVAL;
515 }
516
512 if (src_in->sa_family == AF_INET) { 517 if (src_in->sa_family == AF_INET) {
513 struct rtable *rt = NULL; 518 struct rtable *rt = NULL;
514 const struct sockaddr_in *dst_in4 = 519 const struct sockaddr_in *dst_in4 =
@@ -522,8 +527,12 @@ static int addr_resolve(struct sockaddr *src_in,
522 if (resolve_neigh) 527 if (resolve_neigh)
523 ret = addr_resolve_neigh(&rt->dst, dst_in, addr, seq); 528 ret = addr_resolve_neigh(&rt->dst, dst_in, addr, seq);
524 529
525 ndev = rt->dst.dev; 530 if (addr->bound_dev_if) {
526 dev_hold(ndev); 531 ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
532 } else {
533 ndev = rt->dst.dev;
534 dev_hold(ndev);
535 }
527 536
528 ip_rt_put(rt); 537 ip_rt_put(rt);
529 } else { 538 } else {
@@ -539,14 +548,27 @@ static int addr_resolve(struct sockaddr *src_in,
539 if (resolve_neigh) 548 if (resolve_neigh)
540 ret = addr_resolve_neigh(dst, dst_in, addr, seq); 549 ret = addr_resolve_neigh(dst, dst_in, addr, seq);
541 550
542 ndev = dst->dev; 551 if (addr->bound_dev_if) {
543 dev_hold(ndev); 552 ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
553 } else {
554 ndev = dst->dev;
555 dev_hold(ndev);
556 }
544 557
545 dst_release(dst); 558 dst_release(dst);
546 } 559 }
547 560
548 addr->bound_dev_if = ndev->ifindex; 561 if (ndev->flags & IFF_LOOPBACK) {
549 addr->net = dev_net(ndev); 562 ret = rdma_translate_ip(dst_in, addr, NULL);
563 /*
564 * Put the loopback device and get the translated
565 * device instead.
566 */
567 dev_put(ndev);
568 ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
569 } else {
570 addr->bound_dev_if = ndev->ifindex;
571 }
550 dev_put(ndev); 572 dev_put(ndev);
551 573
552 return ret; 574 return ret;
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 31bb82d8ecd7..0eb393237ba2 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -623,22 +623,11 @@ static inline int cma_validate_port(struct ib_device *device, u8 port,
623 if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port)) 623 if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port))
624 return ret; 624 return ret;
625 625
626 if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) { 626 if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port))
627 ndev = dev_get_by_index(&init_net, bound_if_index); 627 ndev = dev_get_by_index(&init_net, bound_if_index);
628 if (ndev && ndev->flags & IFF_LOOPBACK) { 628 else
629 pr_info("detected loopback device\n");
630 dev_put(ndev);
631
632 if (!device->get_netdev)
633 return -EOPNOTSUPP;
634
635 ndev = device->get_netdev(device, port);
636 if (!ndev)
637 return -ENODEV;
638 }
639 } else {
640 gid_type = IB_GID_TYPE_IB; 629 gid_type = IB_GID_TYPE_IB;
641 } 630
642 631
643 ret = ib_find_cached_gid_by_port(device, gid, gid_type, port, 632 ret = ib_find_cached_gid_by_port(device, gid, gid_type, port,
644 ndev, NULL); 633 ndev, NULL);
@@ -1044,6 +1033,8 @@ int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
1044 } else 1033 } else
1045 ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr, 1034 ret = iw_cm_init_qp_attr(id_priv->cm_id.iw, qp_attr,
1046 qp_attr_mask); 1035 qp_attr_mask);
1036 qp_attr->port_num = id_priv->id.port_num;
1037 *qp_attr_mask |= IB_QP_PORT;
1047 } else 1038 } else
1048 ret = -ENOSYS; 1039 ret = -ENOSYS;
1049 1040
@@ -2569,21 +2560,6 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
2569 goto err2; 2560 goto err2;
2570 } 2561 }
2571 2562
2572 if (ndev->flags & IFF_LOOPBACK) {
2573 dev_put(ndev);
2574 if (!id_priv->id.device->get_netdev) {
2575 ret = -EOPNOTSUPP;
2576 goto err2;
2577 }
2578
2579 ndev = id_priv->id.device->get_netdev(id_priv->id.device,
2580 id_priv->id.port_num);
2581 if (!ndev) {
2582 ret = -ENODEV;
2583 goto err2;
2584 }
2585 }
2586
2587 supported_gids = roce_gid_type_mask_support(id_priv->id.device, 2563 supported_gids = roce_gid_type_mask_support(id_priv->id.device,
2588 id_priv->id.port_num); 2564 id_priv->id.port_num);
2589 gid_type = cma_route_gid_type(addr->dev_addr.network, 2565 gid_type = cma_route_gid_type(addr->dev_addr.network,
diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c
index db958d3207ef..94a9eefb3cfc 100644
--- a/drivers/infiniband/core/roce_gid_mgmt.c
+++ b/drivers/infiniband/core/roce_gid_mgmt.c
@@ -42,6 +42,8 @@
42#include <rdma/ib_cache.h> 42#include <rdma/ib_cache.h>
43#include <rdma/ib_addr.h> 43#include <rdma/ib_addr.h>
44 44
45static struct workqueue_struct *gid_cache_wq;
46
45enum gid_op_type { 47enum gid_op_type {
46 GID_DEL = 0, 48 GID_DEL = 0,
47 GID_ADD 49 GID_ADD
@@ -560,7 +562,7 @@ static int netdevice_queue_work(struct netdev_event_work_cmd *cmds,
560 } 562 }
561 INIT_WORK(&ndev_work->work, netdevice_event_work_handler); 563 INIT_WORK(&ndev_work->work, netdevice_event_work_handler);
562 564
563 queue_work(ib_wq, &ndev_work->work); 565 queue_work(gid_cache_wq, &ndev_work->work);
564 566
565 return NOTIFY_DONE; 567 return NOTIFY_DONE;
566} 568}
@@ -693,7 +695,7 @@ static int addr_event(struct notifier_block *this, unsigned long event,
693 dev_hold(ndev); 695 dev_hold(ndev);
694 work->gid_attr.ndev = ndev; 696 work->gid_attr.ndev = ndev;
695 697
696 queue_work(ib_wq, &work->work); 698 queue_work(gid_cache_wq, &work->work);
697 699
698 return NOTIFY_DONE; 700 return NOTIFY_DONE;
699} 701}
@@ -740,6 +742,10 @@ static struct notifier_block nb_inet6addr = {
740 742
741int __init roce_gid_mgmt_init(void) 743int __init roce_gid_mgmt_init(void)
742{ 744{
745 gid_cache_wq = alloc_ordered_workqueue("gid-cache-wq", 0);
746 if (!gid_cache_wq)
747 return -ENOMEM;
748
743 register_inetaddr_notifier(&nb_inetaddr); 749 register_inetaddr_notifier(&nb_inetaddr);
744 if (IS_ENABLED(CONFIG_IPV6)) 750 if (IS_ENABLED(CONFIG_IPV6))
745 register_inet6addr_notifier(&nb_inet6addr); 751 register_inet6addr_notifier(&nb_inet6addr);
@@ -764,4 +770,5 @@ void __exit roce_gid_mgmt_cleanup(void)
764 * ib-core is removed, all physical devices have been removed, 770 * ib-core is removed, all physical devices have been removed,
765 * so no issue with remaining hardware contexts. 771 * so no issue with remaining hardware contexts.
766 */ 772 */
773 destroy_workqueue(gid_cache_wq);
767} 774}
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 8ba9bfb073d1..2c98533a0203 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1296,7 +1296,6 @@ ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file,
1296 struct ib_uobject *uobj; 1296 struct ib_uobject *uobj;
1297 struct ib_cq *cq; 1297 struct ib_cq *cq;
1298 struct ib_ucq_object *obj; 1298 struct ib_ucq_object *obj;
1299 struct ib_uverbs_event_queue *ev_queue;
1300 int ret = -EINVAL; 1299 int ret = -EINVAL;
1301 1300
1302 if (copy_from_user(&cmd, buf, sizeof cmd)) 1301 if (copy_from_user(&cmd, buf, sizeof cmd))
@@ -1313,7 +1312,6 @@ ssize_t ib_uverbs_destroy_cq(struct ib_uverbs_file *file,
1313 */ 1312 */
1314 uverbs_uobject_get(uobj); 1313 uverbs_uobject_get(uobj);
1315 cq = uobj->object; 1314 cq = uobj->object;
1316 ev_queue = cq->cq_context;
1317 obj = container_of(cq->uobject, struct ib_ucq_object, uobject); 1315 obj = container_of(cq->uobject, struct ib_ucq_object, uobject);
1318 1316
1319 memset(&resp, 0, sizeof(resp)); 1317 memset(&resp, 0, sizeof(resp));
@@ -1935,7 +1933,8 @@ static int modify_qp(struct ib_uverbs_file *file,
1935 goto out; 1933 goto out;
1936 } 1934 }
1937 1935
1938 if (!rdma_is_port_valid(qp->device, cmd->base.port_num)) { 1936 if ((cmd->base.attr_mask & IB_QP_PORT) &&
1937 !rdma_is_port_valid(qp->device, cmd->base.port_num)) {
1939 ret = -EINVAL; 1938 ret = -EINVAL;
1940 goto release_qp; 1939 goto release_qp;
1941 } 1940 }
@@ -2005,28 +2004,13 @@ static int modify_qp(struct ib_uverbs_file *file,
2005 rdma_ah_set_port_num(&attr->alt_ah_attr, 2004 rdma_ah_set_port_num(&attr->alt_ah_attr,
2006 cmd->base.alt_dest.port_num); 2005 cmd->base.alt_dest.port_num);
2007 2006
2008 if (qp->real_qp == qp) { 2007 ret = ib_modify_qp_with_udata(qp, attr,
2009 if (cmd->base.attr_mask & IB_QP_AV) { 2008 modify_qp_mask(qp->qp_type,
2010 ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr); 2009 cmd->base.attr_mask),
2011 if (ret) 2010 udata);
2012 goto release_qp;
2013 }
2014 ret = ib_security_modify_qp(qp,
2015 attr,
2016 modify_qp_mask(qp->qp_type,
2017 cmd->base.attr_mask),
2018 udata);
2019 } else {
2020 ret = ib_security_modify_qp(qp,
2021 attr,
2022 modify_qp_mask(qp->qp_type,
2023 cmd->base.attr_mask),
2024 NULL);
2025 }
2026 2011
2027release_qp: 2012release_qp:
2028 uobj_put_obj_read(qp); 2013 uobj_put_obj_read(qp);
2029
2030out: 2014out:
2031 kfree(attr); 2015 kfree(attr);
2032 2016
@@ -2103,7 +2087,6 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file,
2103 struct ib_uverbs_destroy_qp cmd; 2087 struct ib_uverbs_destroy_qp cmd;
2104 struct ib_uverbs_destroy_qp_resp resp; 2088 struct ib_uverbs_destroy_qp_resp resp;
2105 struct ib_uobject *uobj; 2089 struct ib_uobject *uobj;
2106 struct ib_qp *qp;
2107 struct ib_uqp_object *obj; 2090 struct ib_uqp_object *obj;
2108 int ret = -EINVAL; 2091 int ret = -EINVAL;
2109 2092
@@ -2117,7 +2100,6 @@ ssize_t ib_uverbs_destroy_qp(struct ib_uverbs_file *file,
2117 if (IS_ERR(uobj)) 2100 if (IS_ERR(uobj))
2118 return PTR_ERR(uobj); 2101 return PTR_ERR(uobj);
2119 2102
2120 qp = uobj->object;
2121 obj = container_of(uobj, struct ib_uqp_object, uevent.uobject); 2103 obj = container_of(uobj, struct ib_uqp_object, uevent.uobject);
2122 /* 2104 /*
2123 * Make sure we don't free the memory in remove_commit as we still 2105 * Make sure we don't free the memory in remove_commit as we still
@@ -3019,7 +3001,6 @@ int ib_uverbs_ex_destroy_wq(struct ib_uverbs_file *file,
3019{ 3001{
3020 struct ib_uverbs_ex_destroy_wq cmd = {}; 3002 struct ib_uverbs_ex_destroy_wq cmd = {};
3021 struct ib_uverbs_ex_destroy_wq_resp resp = {}; 3003 struct ib_uverbs_ex_destroy_wq_resp resp = {};
3022 struct ib_wq *wq;
3023 struct ib_uobject *uobj; 3004 struct ib_uobject *uobj;
3024 struct ib_uwq_object *obj; 3005 struct ib_uwq_object *obj;
3025 size_t required_cmd_sz; 3006 size_t required_cmd_sz;
@@ -3053,7 +3034,6 @@ int ib_uverbs_ex_destroy_wq(struct ib_uverbs_file *file,
3053 if (IS_ERR(uobj)) 3034 if (IS_ERR(uobj))
3054 return PTR_ERR(uobj); 3035 return PTR_ERR(uobj);
3055 3036
3056 wq = uobj->object;
3057 obj = container_of(uobj, struct ib_uwq_object, uevent.uobject); 3037 obj = container_of(uobj, struct ib_uwq_object, uevent.uobject);
3058 /* 3038 /*
3059 * Make sure we don't free the memory in remove_commit as we still 3039 * Make sure we don't free the memory in remove_commit as we still
@@ -3743,10 +3723,8 @@ ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
3743 struct ib_uverbs_destroy_srq cmd; 3723 struct ib_uverbs_destroy_srq cmd;
3744 struct ib_uverbs_destroy_srq_resp resp; 3724 struct ib_uverbs_destroy_srq_resp resp;
3745 struct ib_uobject *uobj; 3725 struct ib_uobject *uobj;
3746 struct ib_srq *srq;
3747 struct ib_uevent_object *obj; 3726 struct ib_uevent_object *obj;
3748 int ret = -EINVAL; 3727 int ret = -EINVAL;
3749 enum ib_srq_type srq_type;
3750 3728
3751 if (copy_from_user(&cmd, buf, sizeof cmd)) 3729 if (copy_from_user(&cmd, buf, sizeof cmd))
3752 return -EFAULT; 3730 return -EFAULT;
@@ -3756,9 +3734,7 @@ ssize_t ib_uverbs_destroy_srq(struct ib_uverbs_file *file,
3756 if (IS_ERR(uobj)) 3734 if (IS_ERR(uobj))
3757 return PTR_ERR(uobj); 3735 return PTR_ERR(uobj);
3758 3736
3759 srq = uobj->object;
3760 obj = container_of(uobj, struct ib_uevent_object, uobject); 3737 obj = container_of(uobj, struct ib_uevent_object, uobject);
3761 srq_type = srq->srq_type;
3762 /* 3738 /*
3763 * Make sure we don't free the memory in remove_commit as we still 3739 * Make sure we don't free the memory in remove_commit as we still
3764 * needs the uobject memory to create the response. 3740 * needs the uobject memory to create the response.
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index c973a83c898b..fb98ed67d5bc 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -452,6 +452,19 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr,
452} 452}
453EXPORT_SYMBOL(ib_get_gids_from_rdma_hdr); 453EXPORT_SYMBOL(ib_get_gids_from_rdma_hdr);
454 454
455/*
456 * This function creates ah from the incoming packet.
457 * Incoming packet has dgid of the receiver node on which this code is
458 * getting executed and, sgid contains the GID of the sender.
459 *
460 * When resolving mac address of destination, the arrived dgid is used
461 * as sgid and, sgid is used as dgid because sgid contains destinations
462 * GID whom to respond to.
463 *
464 * This is why when calling rdma_addr_find_l2_eth_by_grh() function, the
465 * position of arguments dgid and sgid do not match the order of the
466 * parameters.
467 */
455int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, 468int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
456 const struct ib_wc *wc, const struct ib_grh *grh, 469 const struct ib_wc *wc, const struct ib_grh *grh,
457 struct rdma_ah_attr *ah_attr) 470 struct rdma_ah_attr *ah_attr)
@@ -507,11 +520,6 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
507 } 520 }
508 521
509 resolved_dev = dev_get_by_index(&init_net, if_index); 522 resolved_dev = dev_get_by_index(&init_net, if_index);
510 if (resolved_dev->flags & IFF_LOOPBACK) {
511 dev_put(resolved_dev);
512 resolved_dev = idev;
513 dev_hold(resolved_dev);
514 }
515 rcu_read_lock(); 523 rcu_read_lock();
516 if (resolved_dev != idev && !rdma_is_upper_dev_rcu(idev, 524 if (resolved_dev != idev && !rdma_is_upper_dev_rcu(idev,
517 resolved_dev)) 525 resolved_dev))
@@ -887,6 +895,7 @@ static const struct {
887} qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = { 895} qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = {
888 [IB_QPS_RESET] = { 896 [IB_QPS_RESET] = {
889 [IB_QPS_RESET] = { .valid = 1 }, 897 [IB_QPS_RESET] = { .valid = 1 },
898 [IB_QPS_ERR] = { .valid = 1 },
890 [IB_QPS_INIT] = { 899 [IB_QPS_INIT] = {
891 .valid = 1, 900 .valid = 1,
892 .req_param = { 901 .req_param = {
@@ -1268,20 +1277,36 @@ out:
1268} 1277}
1269EXPORT_SYMBOL(ib_resolve_eth_dmac); 1278EXPORT_SYMBOL(ib_resolve_eth_dmac);
1270 1279
1271int ib_modify_qp(struct ib_qp *qp, 1280/**
1272 struct ib_qp_attr *qp_attr, 1281 * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
1273 int qp_attr_mask) 1282 * @qp: The QP to modify.
1283 * @attr: On input, specifies the QP attributes to modify. On output,
1284 * the current values of selected QP attributes are returned.
1285 * @attr_mask: A bit-mask used to specify which attributes of the QP
1286 * are being modified.
1287 * @udata: pointer to user's input output buffer information
1288 * are being modified.
1289 * It returns 0 on success and returns appropriate error code on error.
1290 */
1291int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
1292 int attr_mask, struct ib_udata *udata)
1274{ 1293{
1294 int ret;
1275 1295
1276 if (qp_attr_mask & IB_QP_AV) { 1296 if (attr_mask & IB_QP_AV) {
1277 int ret; 1297 ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
1278
1279 ret = ib_resolve_eth_dmac(qp->device, &qp_attr->ah_attr);
1280 if (ret) 1298 if (ret)
1281 return ret; 1299 return ret;
1282 } 1300 }
1301 return ib_security_modify_qp(qp, attr, attr_mask, udata);
1302}
1303EXPORT_SYMBOL(ib_modify_qp_with_udata);
1283 1304
1284 return ib_security_modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL); 1305int ib_modify_qp(struct ib_qp *qp,
1306 struct ib_qp_attr *qp_attr,
1307 int qp_attr_mask)
1308{
1309 return ib_modify_qp_with_udata(qp, qp_attr, qp_attr_mask, NULL);
1285} 1310}
1286EXPORT_SYMBOL(ib_modify_qp); 1311EXPORT_SYMBOL(ib_modify_qp);
1287 1312
diff --git a/drivers/infiniband/hw/bnxt_re/bnxt_re.h b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
index 08772836fded..85527532c49d 100644
--- a/drivers/infiniband/hw/bnxt_re/bnxt_re.h
+++ b/drivers/infiniband/hw/bnxt_re/bnxt_re.h
@@ -51,6 +51,8 @@
51#define BNXT_RE_PAGE_SIZE_8M BIT(23) 51#define BNXT_RE_PAGE_SIZE_8M BIT(23)
52#define BNXT_RE_PAGE_SIZE_1G BIT(30) 52#define BNXT_RE_PAGE_SIZE_1G BIT(30)
53 53
54#define BNXT_RE_MAX_MR_SIZE BIT(30)
55
54#define BNXT_RE_MAX_QPC_COUNT (64 * 1024) 56#define BNXT_RE_MAX_QPC_COUNT (64 * 1024)
55#define BNXT_RE_MAX_MRW_COUNT (64 * 1024) 57#define BNXT_RE_MAX_MRW_COUNT (64 * 1024)
56#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024) 58#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
@@ -60,6 +62,13 @@
60 62
61#define BNXT_RE_RQ_WQE_THRESHOLD 32 63#define BNXT_RE_RQ_WQE_THRESHOLD 32
62 64
65/*
66 * Setting the default ack delay value to 16, which means
67 * the default timeout is approx. 260ms(4 usec * 2 ^(timeout))
68 */
69
70#define BNXT_RE_DEFAULT_ACK_DELAY 16
71
63struct bnxt_re_work { 72struct bnxt_re_work {
64 struct work_struct work; 73 struct work_struct work;
65 unsigned long event; 74 unsigned long event;
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index c7bd68311d0c..f0e01b3ac711 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -145,10 +145,8 @@ int bnxt_re_query_device(struct ib_device *ibdev,
145 ib_attr->fw_ver = (u64)(unsigned long)(dev_attr->fw_ver); 145 ib_attr->fw_ver = (u64)(unsigned long)(dev_attr->fw_ver);
146 bnxt_qplib_get_guid(rdev->netdev->dev_addr, 146 bnxt_qplib_get_guid(rdev->netdev->dev_addr,
147 (u8 *)&ib_attr->sys_image_guid); 147 (u8 *)&ib_attr->sys_image_guid);
148 ib_attr->max_mr_size = ~0ull; 148 ib_attr->max_mr_size = BNXT_RE_MAX_MR_SIZE;
149 ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_8K | 149 ib_attr->page_size_cap = BNXT_RE_PAGE_SIZE_4K;
150 BNXT_RE_PAGE_SIZE_64K | BNXT_RE_PAGE_SIZE_2M |
151 BNXT_RE_PAGE_SIZE_8M | BNXT_RE_PAGE_SIZE_1G;
152 150
153 ib_attr->vendor_id = rdev->en_dev->pdev->vendor; 151 ib_attr->vendor_id = rdev->en_dev->pdev->vendor;
154 ib_attr->vendor_part_id = rdev->en_dev->pdev->device; 152 ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
@@ -174,9 +172,11 @@ int bnxt_re_query_device(struct ib_device *ibdev,
174 ib_attr->max_mr = dev_attr->max_mr; 172 ib_attr->max_mr = dev_attr->max_mr;
175 ib_attr->max_pd = dev_attr->max_pd; 173 ib_attr->max_pd = dev_attr->max_pd;
176 ib_attr->max_qp_rd_atom = dev_attr->max_qp_rd_atom; 174 ib_attr->max_qp_rd_atom = dev_attr->max_qp_rd_atom;
177 ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_rd_atom; 175 ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom;
178 ib_attr->atomic_cap = IB_ATOMIC_HCA; 176 if (dev_attr->is_atomic) {
179 ib_attr->masked_atomic_cap = IB_ATOMIC_HCA; 177 ib_attr->atomic_cap = IB_ATOMIC_HCA;
178 ib_attr->masked_atomic_cap = IB_ATOMIC_HCA;
179 }
180 180
181 ib_attr->max_ee_rd_atom = 0; 181 ib_attr->max_ee_rd_atom = 0;
182 ib_attr->max_res_rd_atom = 0; 182 ib_attr->max_res_rd_atom = 0;
@@ -201,7 +201,7 @@ int bnxt_re_query_device(struct ib_device *ibdev,
201 ib_attr->max_fast_reg_page_list_len = MAX_PBL_LVL_1_PGS; 201 ib_attr->max_fast_reg_page_list_len = MAX_PBL_LVL_1_PGS;
202 202
203 ib_attr->max_pkeys = 1; 203 ib_attr->max_pkeys = 1;
204 ib_attr->local_ca_ack_delay = 0; 204 ib_attr->local_ca_ack_delay = BNXT_RE_DEFAULT_ACK_DELAY;
205 return 0; 205 return 0;
206} 206}
207 207
@@ -390,15 +390,17 @@ int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num,
390 return -EINVAL; 390 return -EINVAL;
391 ctx->refcnt--; 391 ctx->refcnt--;
392 if (!ctx->refcnt) { 392 if (!ctx->refcnt) {
393 rc = bnxt_qplib_del_sgid 393 rc = bnxt_qplib_del_sgid(sgid_tbl,
394 (sgid_tbl, 394 &sgid_tbl->tbl[ctx->idx],
395 &sgid_tbl->tbl[ctx->idx], true); 395 true);
396 if (rc) 396 if (rc) {
397 dev_err(rdev_to_dev(rdev), 397 dev_err(rdev_to_dev(rdev),
398 "Failed to remove GID: %#x", rc); 398 "Failed to remove GID: %#x", rc);
399 ctx_tbl = sgid_tbl->ctx; 399 } else {
400 ctx_tbl[ctx->idx] = NULL; 400 ctx_tbl = sgid_tbl->ctx;
401 kfree(ctx); 401 ctx_tbl[ctx->idx] = NULL;
402 kfree(ctx);
403 }
402 } 404 }
403 } else { 405 } else {
404 return -EINVAL; 406 return -EINVAL;
@@ -588,10 +590,10 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd)
588 590
589 /* Create a fence MW only for kernel consumers */ 591 /* Create a fence MW only for kernel consumers */
590 mw = bnxt_re_alloc_mw(&pd->ib_pd, IB_MW_TYPE_1, NULL); 592 mw = bnxt_re_alloc_mw(&pd->ib_pd, IB_MW_TYPE_1, NULL);
591 if (!mw) { 593 if (IS_ERR(mw)) {
592 dev_err(rdev_to_dev(rdev), 594 dev_err(rdev_to_dev(rdev),
593 "Failed to create fence-MW for PD: %p\n", pd); 595 "Failed to create fence-MW for PD: %p\n", pd);
594 rc = -EINVAL; 596 rc = PTR_ERR(mw);
595 goto fail; 597 goto fail;
596 } 598 }
597 fence->mw = mw; 599 fence->mw = mw;
@@ -612,30 +614,13 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd)
612 int rc; 614 int rc;
613 615
614 bnxt_re_destroy_fence_mr(pd); 616 bnxt_re_destroy_fence_mr(pd);
615 if (ib_pd->uobject && pd->dpi.dbr) {
616 struct ib_ucontext *ib_uctx = ib_pd->uobject->context;
617 struct bnxt_re_ucontext *ucntx;
618 617
619 /* Free DPI only if this is the first PD allocated by the 618 if (pd->qplib_pd.id) {
620 * application and mark the context dpi as NULL 619 rc = bnxt_qplib_dealloc_pd(&rdev->qplib_res,
621 */ 620 &rdev->qplib_res.pd_tbl,
622 ucntx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx); 621 &pd->qplib_pd);
623
624 rc = bnxt_qplib_dealloc_dpi(&rdev->qplib_res,
625 &rdev->qplib_res.dpi_tbl,
626 &pd->dpi);
627 if (rc) 622 if (rc)
628 dev_err(rdev_to_dev(rdev), "Failed to deallocate HW DPI"); 623 dev_err(rdev_to_dev(rdev), "Failed to deallocate HW PD");
629 /* Don't fail, continue*/
630 ucntx->dpi = NULL;
631 }
632
633 rc = bnxt_qplib_dealloc_pd(&rdev->qplib_res,
634 &rdev->qplib_res.pd_tbl,
635 &pd->qplib_pd);
636 if (rc) {
637 dev_err(rdev_to_dev(rdev), "Failed to deallocate HW PD");
638 return rc;
639 } 624 }
640 625
641 kfree(pd); 626 kfree(pd);
@@ -667,23 +652,22 @@ struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev,
667 if (udata) { 652 if (udata) {
668 struct bnxt_re_pd_resp resp; 653 struct bnxt_re_pd_resp resp;
669 654
670 if (!ucntx->dpi) { 655 if (!ucntx->dpi.dbr) {
671 /* Allocate DPI in alloc_pd to avoid failing of 656 /* Allocate DPI in alloc_pd to avoid failing of
672 * ibv_devinfo and family of application when DPIs 657 * ibv_devinfo and family of application when DPIs
673 * are depleted. 658 * are depleted.
674 */ 659 */
675 if (bnxt_qplib_alloc_dpi(&rdev->qplib_res.dpi_tbl, 660 if (bnxt_qplib_alloc_dpi(&rdev->qplib_res.dpi_tbl,
676 &pd->dpi, ucntx)) { 661 &ucntx->dpi, ucntx)) {
677 rc = -ENOMEM; 662 rc = -ENOMEM;
678 goto dbfail; 663 goto dbfail;
679 } 664 }
680 ucntx->dpi = &pd->dpi;
681 } 665 }
682 666
683 resp.pdid = pd->qplib_pd.id; 667 resp.pdid = pd->qplib_pd.id;
684 /* Still allow mapping this DBR to the new user PD. */ 668 /* Still allow mapping this DBR to the new user PD. */
685 resp.dpi = ucntx->dpi->dpi; 669 resp.dpi = ucntx->dpi.dpi;
686 resp.dbr = (u64)ucntx->dpi->umdbr; 670 resp.dbr = (u64)ucntx->dpi.umdbr;
687 671
688 rc = ib_copy_to_udata(udata, &resp, sizeof(resp)); 672 rc = ib_copy_to_udata(udata, &resp, sizeof(resp));
689 if (rc) { 673 if (rc) {
@@ -960,7 +944,7 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd,
960 qplib_qp->rq.nmap = umem->nmap; 944 qplib_qp->rq.nmap = umem->nmap;
961 } 945 }
962 946
963 qplib_qp->dpi = cntx->dpi; 947 qplib_qp->dpi = &cntx->dpi;
964 return 0; 948 return 0;
965rqfail: 949rqfail:
966 ib_umem_release(qp->sumem); 950 ib_umem_release(qp->sumem);
@@ -1530,13 +1514,24 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
1530 if (qp_attr_mask & IB_QP_MAX_QP_RD_ATOMIC) { 1514 if (qp_attr_mask & IB_QP_MAX_QP_RD_ATOMIC) {
1531 qp->qplib_qp.modify_flags |= 1515 qp->qplib_qp.modify_flags |=
1532 CMDQ_MODIFY_QP_MODIFY_MASK_MAX_RD_ATOMIC; 1516 CMDQ_MODIFY_QP_MODIFY_MASK_MAX_RD_ATOMIC;
1533 qp->qplib_qp.max_rd_atomic = qp_attr->max_rd_atomic; 1517 /* Cap the max_rd_atomic to device max */
1518 qp->qplib_qp.max_rd_atomic = min_t(u32, qp_attr->max_rd_atomic,
1519 dev_attr->max_qp_rd_atom);
1534 } 1520 }
1535 if (qp_attr_mask & IB_QP_SQ_PSN) { 1521 if (qp_attr_mask & IB_QP_SQ_PSN) {
1536 qp->qplib_qp.modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_SQ_PSN; 1522 qp->qplib_qp.modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_SQ_PSN;
1537 qp->qplib_qp.sq.psn = qp_attr->sq_psn; 1523 qp->qplib_qp.sq.psn = qp_attr->sq_psn;
1538 } 1524 }
1539 if (qp_attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) { 1525 if (qp_attr_mask & IB_QP_MAX_DEST_RD_ATOMIC) {
1526 if (qp_attr->max_dest_rd_atomic >
1527 dev_attr->max_qp_init_rd_atom) {
1528 dev_err(rdev_to_dev(rdev),
1529 "max_dest_rd_atomic requested%d is > dev_max%d",
1530 qp_attr->max_dest_rd_atomic,
1531 dev_attr->max_qp_init_rd_atom);
1532 return -EINVAL;
1533 }
1534
1540 qp->qplib_qp.modify_flags |= 1535 qp->qplib_qp.modify_flags |=
1541 CMDQ_MODIFY_QP_MODIFY_MASK_MAX_DEST_RD_ATOMIC; 1536 CMDQ_MODIFY_QP_MODIFY_MASK_MAX_DEST_RD_ATOMIC;
1542 qp->qplib_qp.max_dest_rd_atomic = qp_attr->max_dest_rd_atomic; 1537 qp->qplib_qp.max_dest_rd_atomic = qp_attr->max_dest_rd_atomic;
@@ -2403,7 +2398,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev,
2403 } 2398 }
2404 cq->qplib_cq.sghead = cq->umem->sg_head.sgl; 2399 cq->qplib_cq.sghead = cq->umem->sg_head.sgl;
2405 cq->qplib_cq.nmap = cq->umem->nmap; 2400 cq->qplib_cq.nmap = cq->umem->nmap;
2406 cq->qplib_cq.dpi = uctx->dpi; 2401 cq->qplib_cq.dpi = &uctx->dpi;
2407 } else { 2402 } else {
2408 cq->max_cql = min_t(u32, entries, MAX_CQL_PER_POLL); 2403 cq->max_cql = min_t(u32, entries, MAX_CQL_PER_POLL);
2409 cq->cql = kcalloc(cq->max_cql, sizeof(struct bnxt_qplib_cqe), 2404 cq->cql = kcalloc(cq->max_cql, sizeof(struct bnxt_qplib_cqe),
@@ -2905,6 +2900,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)
2905 2900
2906 spin_lock_irqsave(&cq->cq_lock, flags); 2901 spin_lock_irqsave(&cq->cq_lock, flags);
2907 budget = min_t(u32, num_entries, cq->max_cql); 2902 budget = min_t(u32, num_entries, cq->max_cql);
2903 num_entries = budget;
2908 if (!cq->cql) { 2904 if (!cq->cql) {
2909 dev_err(rdev_to_dev(cq->rdev), "POLL CQ : no CQL to use"); 2905 dev_err(rdev_to_dev(cq->rdev), "POLL CQ : no CQL to use");
2910 goto exit; 2906 goto exit;
@@ -3031,6 +3027,11 @@ int bnxt_re_req_notify_cq(struct ib_cq *ib_cq,
3031 else if (ib_cqn_flags & IB_CQ_SOLICITED) 3027 else if (ib_cqn_flags & IB_CQ_SOLICITED)
3032 type = DBR_DBR_TYPE_CQ_ARMSE; 3028 type = DBR_DBR_TYPE_CQ_ARMSE;
3033 3029
3030 /* Poll to see if there are missed events */
3031 if ((ib_cqn_flags & IB_CQ_REPORT_MISSED_EVENTS) &&
3032 !(bnxt_qplib_is_cq_empty(&cq->qplib_cq)))
3033 return 1;
3034
3034 bnxt_qplib_req_notify_cq(&cq->qplib_cq, type); 3035 bnxt_qplib_req_notify_cq(&cq->qplib_cq, type);
3035 3036
3036 return 0; 3037 return 0;
@@ -3245,6 +3246,12 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,
3245 struct scatterlist *sg; 3246 struct scatterlist *sg;
3246 int entry; 3247 int entry;
3247 3248
3249 if (length > BNXT_RE_MAX_MR_SIZE) {
3250 dev_err(rdev_to_dev(rdev), "MR Size: %lld > Max supported:%ld\n",
3251 length, BNXT_RE_MAX_MR_SIZE);
3252 return ERR_PTR(-ENOMEM);
3253 }
3254
3248 mr = kzalloc(sizeof(*mr), GFP_KERNEL); 3255 mr = kzalloc(sizeof(*mr), GFP_KERNEL);
3249 if (!mr) 3256 if (!mr)
3250 return ERR_PTR(-ENOMEM); 3257 return ERR_PTR(-ENOMEM);
@@ -3388,8 +3395,26 @@ int bnxt_re_dealloc_ucontext(struct ib_ucontext *ib_uctx)
3388 struct bnxt_re_ucontext *uctx = container_of(ib_uctx, 3395 struct bnxt_re_ucontext *uctx = container_of(ib_uctx,
3389 struct bnxt_re_ucontext, 3396 struct bnxt_re_ucontext,
3390 ib_uctx); 3397 ib_uctx);
3398
3399 struct bnxt_re_dev *rdev = uctx->rdev;
3400 int rc = 0;
3401
3391 if (uctx->shpg) 3402 if (uctx->shpg)
3392 free_page((unsigned long)uctx->shpg); 3403 free_page((unsigned long)uctx->shpg);
3404
3405 if (uctx->dpi.dbr) {
3406 /* Free DPI only if this is the first PD allocated by the
3407 * application and mark the context dpi as NULL
3408 */
3409 rc = bnxt_qplib_dealloc_dpi(&rdev->qplib_res,
3410 &rdev->qplib_res.dpi_tbl,
3411 &uctx->dpi);
3412 if (rc)
3413 dev_err(rdev_to_dev(rdev), "Deallocte HW DPI failed!");
3414 /* Don't fail, continue*/
3415 uctx->dpi.dbr = NULL;
3416 }
3417
3393 kfree(uctx); 3418 kfree(uctx);
3394 return 0; 3419 return 0;
3395} 3420}
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
index 6c160f6a5398..a0bb7e33d7ca 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
@@ -59,7 +59,6 @@ struct bnxt_re_pd {
59 struct bnxt_re_dev *rdev; 59 struct bnxt_re_dev *rdev;
60 struct ib_pd ib_pd; 60 struct ib_pd ib_pd;
61 struct bnxt_qplib_pd qplib_pd; 61 struct bnxt_qplib_pd qplib_pd;
62 struct bnxt_qplib_dpi dpi;
63 struct bnxt_re_fence_data fence; 62 struct bnxt_re_fence_data fence;
64}; 63};
65 64
@@ -127,7 +126,7 @@ struct bnxt_re_mw {
127struct bnxt_re_ucontext { 126struct bnxt_re_ucontext {
128 struct bnxt_re_dev *rdev; 127 struct bnxt_re_dev *rdev;
129 struct ib_ucontext ib_uctx; 128 struct ib_ucontext ib_uctx;
130 struct bnxt_qplib_dpi *dpi; 129 struct bnxt_qplib_dpi dpi;
131 void *shpg; 130 void *shpg;
132 spinlock_t sh_lock; /* protect shpg */ 131 spinlock_t sh_lock; /* protect shpg */
133}; 132};
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 1fce5e73216b..ceae2d92fb08 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -333,6 +333,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,
333 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); 333 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1);
334 req.update_period_ms = cpu_to_le32(1000); 334 req.update_period_ms = cpu_to_le32(1000);
335 req.stats_dma_addr = cpu_to_le64(dma_map); 335 req.stats_dma_addr = cpu_to_le64(dma_map);
336 req.stat_ctx_flags = STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE;
336 bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, 337 bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
337 sizeof(resp), DFLT_HWRM_CMD_TIMEOUT); 338 sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
338 rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, BNXT_ROCE_ULP, &fw_msg); 339 rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, BNXT_ROCE_ULP, &fw_msg);
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index f05500bcdcf1..9af1514e5944 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -1128,6 +1128,11 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
1128 } 1128 }
1129 /* Each SGE entry = 1 WQE size16 */ 1129 /* Each SGE entry = 1 WQE size16 */
1130 wqe_size16 = wqe->num_sge; 1130 wqe_size16 = wqe->num_sge;
1131 /* HW requires wqe size has room for atleast one SGE even if
1132 * none was supplied by ULP
1133 */
1134 if (!wqe->num_sge)
1135 wqe_size16++;
1131 } 1136 }
1132 1137
1133 /* Specifics */ 1138 /* Specifics */
@@ -1364,6 +1369,11 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
1364 rqe->flags = wqe->flags; 1369 rqe->flags = wqe->flags;
1365 rqe->wqe_size = wqe->num_sge + 1370 rqe->wqe_size = wqe->num_sge +
1366 ((offsetof(typeof(*rqe), data) + 15) >> 4); 1371 ((offsetof(typeof(*rqe), data) + 15) >> 4);
1372 /* HW requires wqe size has room for atleast one SGE even if none
1373 * was supplied by ULP
1374 */
1375 if (!wqe->num_sge)
1376 rqe->wqe_size++;
1367 1377
1368 /* Supply the rqe->wr_id index to the wr_id_tbl for now */ 1378 /* Supply the rqe->wr_id index to the wr_id_tbl for now */
1369 rqe->wr_id[0] = cpu_to_le32(sw_prod); 1379 rqe->wr_id[0] = cpu_to_le32(sw_prod);
@@ -1885,6 +1895,25 @@ flush_rq:
1885 return rc; 1895 return rc;
1886} 1896}
1887 1897
1898bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq)
1899{
1900 struct cq_base *hw_cqe, **hw_cqe_ptr;
1901 unsigned long flags;
1902 u32 sw_cons, raw_cons;
1903 bool rc = true;
1904
1905 spin_lock_irqsave(&cq->hwq.lock, flags);
1906 raw_cons = cq->hwq.cons;
1907 sw_cons = HWQ_CMP(raw_cons, &cq->hwq);
1908 hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr;
1909 hw_cqe = &hw_cqe_ptr[CQE_PG(sw_cons)][CQE_IDX(sw_cons)];
1910
1911 /* Check for Valid bit. If the CQE is valid, return false */
1912 rc = !CQE_CMP_VALID(hw_cqe, raw_cons, cq->hwq.max_elements);
1913 spin_unlock_irqrestore(&cq->hwq.lock, flags);
1914 return rc;
1915}
1916
1888static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, 1917static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq,
1889 struct cq_res_raweth_qp1 *hwcqe, 1918 struct cq_res_raweth_qp1 *hwcqe,
1890 struct bnxt_qplib_cqe **pcqe, 1919 struct bnxt_qplib_cqe **pcqe,
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.h b/drivers/infiniband/hw/bnxt_re/qplib_fp.h
index 36b7b7db0e3f..19176e06c98a 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.h
@@ -449,6 +449,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
449int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq); 449int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);
450int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe, 450int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,
451 int num, struct bnxt_qplib_qp **qp); 451 int num, struct bnxt_qplib_qp **qp);
452bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq);
452void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type); 453void bnxt_qplib_req_notify_cq(struct bnxt_qplib_cq *cq, u32 arm_type);
453void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq); 454void bnxt_qplib_free_nq(struct bnxt_qplib_nq *nq);
454int bnxt_qplib_alloc_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq); 455int bnxt_qplib_alloc_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq);
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
index fde18cf0e406..ef91ab786dd4 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c
@@ -51,6 +51,19 @@ const struct bnxt_qplib_gid bnxt_qplib_gid_zero = {{ 0, 0, 0, 0, 0, 0, 0, 0,
51 0, 0, 0, 0, 0, 0, 0, 0 } }; 51 0, 0, 0, 0, 0, 0, 0, 0 } };
52 52
53/* Device */ 53/* Device */
54
55static bool bnxt_qplib_is_atomic_cap(struct bnxt_qplib_rcfw *rcfw)
56{
57 int rc;
58 u16 pcie_ctl2;
59
60 rc = pcie_capability_read_word(rcfw->pdev, PCI_EXP_DEVCTL2,
61 &pcie_ctl2);
62 if (rc)
63 return false;
64 return !!(pcie_ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ);
65}
66
54int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, 67int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
55 struct bnxt_qplib_dev_attr *attr) 68 struct bnxt_qplib_dev_attr *attr)
56{ 69{
@@ -81,6 +94,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
81 94
82 /* Extract the context from the side buffer */ 95 /* Extract the context from the side buffer */
83 attr->max_qp = le32_to_cpu(sb->max_qp); 96 attr->max_qp = le32_to_cpu(sb->max_qp);
97 /* max_qp value reported by FW for PF doesn't include the QP1 for PF */
98 attr->max_qp += 1;
84 attr->max_qp_rd_atom = 99 attr->max_qp_rd_atom =
85 sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? 100 sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ?
86 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom; 101 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom;
@@ -129,6 +144,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
129 attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc); 144 attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc);
130 } 145 }
131 146
147 attr->is_atomic = bnxt_qplib_is_atomic_cap(rcfw);
132bail: 148bail:
133 bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf); 149 bnxt_qplib_rcfw_free_sbuf(rcfw, sbuf);
134 return rc; 150 return rc;
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
index a543f959098b..2ce7e2a32cf0 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h
+++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h
@@ -42,6 +42,8 @@
42 42
43#define BNXT_QPLIB_RESERVED_QP_WRS 128 43#define BNXT_QPLIB_RESERVED_QP_WRS 128
44 44
45#define PCI_EXP_DEVCTL2_ATOMIC_REQ 0x0040
46
45struct bnxt_qplib_dev_attr { 47struct bnxt_qplib_dev_attr {
46 char fw_ver[32]; 48 char fw_ver[32];
47 u16 max_sgid; 49 u16 max_sgid;
@@ -70,6 +72,7 @@ struct bnxt_qplib_dev_attr {
70 u32 max_inline_data; 72 u32 max_inline_data;
71 u32 l2_db_size; 73 u32 l2_db_size;
72 u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ]; 74 u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ];
75 bool is_atomic;
73}; 76};
74 77
75struct bnxt_qplib_pd { 78struct bnxt_qplib_pd {
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 29d30744d6c9..0cd0c1fa27d4 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -718,7 +718,7 @@ static struct ib_mr *iwch_alloc_mr(struct ib_pd *pd,
718 struct iwch_mr *mhp; 718 struct iwch_mr *mhp;
719 u32 mmid; 719 u32 mmid;
720 u32 stag = 0; 720 u32 stag = 0;
721 int ret = 0; 721 int ret = -ENOMEM;
722 722
723 if (mr_type != IB_MR_TYPE_MEM_REG || 723 if (mr_type != IB_MR_TYPE_MEM_REG ||
724 max_num_sg > T3_MAX_FASTREG_DEPTH) 724 max_num_sg > T3_MAX_FASTREG_DEPTH)
@@ -731,10 +731,8 @@ static struct ib_mr *iwch_alloc_mr(struct ib_pd *pd,
731 goto err; 731 goto err;
732 732
733 mhp->pages = kcalloc(max_num_sg, sizeof(u64), GFP_KERNEL); 733 mhp->pages = kcalloc(max_num_sg, sizeof(u64), GFP_KERNEL);
734 if (!mhp->pages) { 734 if (!mhp->pages)
735 ret = -ENOMEM;
736 goto pl_err; 735 goto pl_err;
737 }
738 736
739 mhp->rhp = rhp; 737 mhp->rhp = rhp;
740 ret = iwch_alloc_pbl(mhp, max_num_sg); 738 ret = iwch_alloc_pbl(mhp, max_num_sg);
@@ -751,7 +749,8 @@ static struct ib_mr *iwch_alloc_mr(struct ib_pd *pd,
751 mhp->attr.state = 1; 749 mhp->attr.state = 1;
752 mmid = (stag) >> 8; 750 mmid = (stag) >> 8;
753 mhp->ibmr.rkey = mhp->ibmr.lkey = stag; 751 mhp->ibmr.rkey = mhp->ibmr.lkey = stag;
754 if (insert_handle(rhp, &rhp->mmidr, mhp, mmid)) 752 ret = insert_handle(rhp, &rhp->mmidr, mhp, mmid);
753 if (ret)
755 goto err3; 754 goto err3;
756 755
757 pr_debug("%s mmid 0x%x mhp %p stag 0x%x\n", __func__, mmid, mhp, stag); 756 pr_debug("%s mmid 0x%x mhp %p stag 0x%x\n", __func__, mmid, mhp, stag);
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index e16fcaf6b5a3..be07da1997e6 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -963,6 +963,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
963 goto err3; 963 goto err3;
964 964
965 if (ucontext) { 965 if (ucontext) {
966 ret = -ENOMEM;
966 mm = kmalloc(sizeof *mm, GFP_KERNEL); 967 mm = kmalloc(sizeof *mm, GFP_KERNEL);
967 if (!mm) 968 if (!mm)
968 goto err4; 969 goto err4;
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index bfc77596acbe..cb7fc0d35d1d 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -569,7 +569,7 @@ static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16)
569{ 569{
570 if (wr->num_sge > 1) 570 if (wr->num_sge > 1)
571 return -EINVAL; 571 return -EINVAL;
572 if (wr->num_sge) { 572 if (wr->num_sge && wr->sg_list[0].length) {
573 wqe->read.stag_src = cpu_to_be32(rdma_wr(wr)->rkey); 573 wqe->read.stag_src = cpu_to_be32(rdma_wr(wr)->rkey);
574 wqe->read.to_src_hi = cpu_to_be32((u32)(rdma_wr(wr)->remote_addr 574 wqe->read.to_src_hi = cpu_to_be32((u32)(rdma_wr(wr)->remote_addr
575 >> 32)); 575 >> 32));
diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index 2ba00b89df6a..94b54850ec75 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -12847,7 +12847,12 @@ static void remap_intr(struct hfi1_devdata *dd, int isrc, int msix_intr)
12847 /* clear from the handled mask of the general interrupt */ 12847 /* clear from the handled mask of the general interrupt */
12848 m = isrc / 64; 12848 m = isrc / 64;
12849 n = isrc % 64; 12849 n = isrc % 64;
12850 dd->gi_mask[m] &= ~((u64)1 << n); 12850 if (likely(m < CCE_NUM_INT_CSRS)) {
12851 dd->gi_mask[m] &= ~((u64)1 << n);
12852 } else {
12853 dd_dev_err(dd, "remap interrupt err\n");
12854 return;
12855 }
12851 12856
12852 /* direct the chip source to the given MSI-X interrupt */ 12857 /* direct the chip source to the given MSI-X interrupt */
12853 m = isrc / 8; 12858 m = isrc / 8;
diff --git a/drivers/infiniband/hw/hfi1/qp.c b/drivers/infiniband/hw/hfi1/qp.c
index 650305cc0373..1a7af9f60c13 100644
--- a/drivers/infiniband/hw/hfi1/qp.c
+++ b/drivers/infiniband/hw/hfi1/qp.c
@@ -647,18 +647,17 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter)
647 qp->pid); 647 qp->pid);
648} 648}
649 649
650void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, 650void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp)
651 gfp_t gfp)
652{ 651{
653 struct hfi1_qp_priv *priv; 652 struct hfi1_qp_priv *priv;
654 653
655 priv = kzalloc_node(sizeof(*priv), gfp, rdi->dparms.node); 654 priv = kzalloc_node(sizeof(*priv), GFP_KERNEL, rdi->dparms.node);
656 if (!priv) 655 if (!priv)
657 return ERR_PTR(-ENOMEM); 656 return ERR_PTR(-ENOMEM);
658 657
659 priv->owner = qp; 658 priv->owner = qp;
660 659
661 priv->s_ahg = kzalloc_node(sizeof(*priv->s_ahg), gfp, 660 priv->s_ahg = kzalloc_node(sizeof(*priv->s_ahg), GFP_KERNEL,
662 rdi->dparms.node); 661 rdi->dparms.node);
663 if (!priv->s_ahg) { 662 if (!priv->s_ahg) {
664 kfree(priv); 663 kfree(priv);
diff --git a/drivers/infiniband/hw/hfi1/qp.h b/drivers/infiniband/hw/hfi1/qp.h
index 1eb9cd7b8c19..6fe542b6a927 100644
--- a/drivers/infiniband/hw/hfi1/qp.h
+++ b/drivers/infiniband/hw/hfi1/qp.h
@@ -123,8 +123,7 @@ void hfi1_migrate_qp(struct rvt_qp *qp);
123/* 123/*
124 * Functions provided by hfi1 driver for rdmavt to use 124 * Functions provided by hfi1 driver for rdmavt to use
125 */ 125 */
126void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, 126void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp);
127 gfp_t gfp);
128void qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp); 127void qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp);
129unsigned free_all_qps(struct rvt_dev_info *rdi); 128unsigned free_all_qps(struct rvt_dev_info *rdi);
130void notify_qp_reset(struct rvt_qp *qp); 129void notify_qp_reset(struct rvt_qp *qp);
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 37d5d29597a4..23fad6d96944 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -228,14 +228,14 @@ int hns_roce_v1_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
228 switch (wr->opcode) { 228 switch (wr->opcode) {
229 case IB_WR_RDMA_READ: 229 case IB_WR_RDMA_READ:
230 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_READ; 230 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_READ;
231 set_raddr_seg(wqe, atomic_wr(wr)->remote_addr, 231 set_raddr_seg(wqe, rdma_wr(wr)->remote_addr,
232 atomic_wr(wr)->rkey); 232 rdma_wr(wr)->rkey);
233 break; 233 break;
234 case IB_WR_RDMA_WRITE: 234 case IB_WR_RDMA_WRITE:
235 case IB_WR_RDMA_WRITE_WITH_IMM: 235 case IB_WR_RDMA_WRITE_WITH_IMM:
236 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_WRITE; 236 ps_opcode = HNS_ROCE_WQE_OPCODE_RDMA_WRITE;
237 set_raddr_seg(wqe, atomic_wr(wr)->remote_addr, 237 set_raddr_seg(wqe, rdma_wr(wr)->remote_addr,
238 atomic_wr(wr)->rkey); 238 rdma_wr(wr)->rkey);
239 break; 239 break;
240 case IB_WR_SEND: 240 case IB_WR_SEND:
241 case IB_WR_SEND_WITH_INV: 241 case IB_WR_SEND_WITH_INV:
@@ -661,9 +661,11 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
661 union ib_gid dgid; 661 union ib_gid dgid;
662 u64 subnet_prefix; 662 u64 subnet_prefix;
663 int attr_mask = 0; 663 int attr_mask = 0;
664 int i; 664 int i, j;
665 int ret; 665 int ret;
666 u8 queue_en[HNS_ROCE_V1_RESV_QP] = { 0 };
666 u8 phy_port; 667 u8 phy_port;
668 u8 port = 0;
667 u8 sl; 669 u8 sl;
668 670
669 priv = (struct hns_roce_v1_priv *)hr_dev->hw->priv; 671 priv = (struct hns_roce_v1_priv *)hr_dev->hw->priv;
@@ -709,11 +711,27 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
709 attr.rnr_retry = 7; 711 attr.rnr_retry = 7;
710 attr.timeout = 0x12; 712 attr.timeout = 0x12;
711 attr.path_mtu = IB_MTU_256; 713 attr.path_mtu = IB_MTU_256;
714 attr.ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE;
712 rdma_ah_set_grh(&attr.ah_attr, NULL, 0, 0, 1, 0); 715 rdma_ah_set_grh(&attr.ah_attr, NULL, 0, 0, 1, 0);
713 rdma_ah_set_static_rate(&attr.ah_attr, 3); 716 rdma_ah_set_static_rate(&attr.ah_attr, 3);
714 717
715 subnet_prefix = cpu_to_be64(0xfe80000000000000LL); 718 subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
716 for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) { 719 for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) {
720 phy_port = (i >= HNS_ROCE_MAX_PORTS) ? (i - 2) :
721 (i % HNS_ROCE_MAX_PORTS);
722 sl = i / HNS_ROCE_MAX_PORTS;
723
724 for (j = 0; j < caps->num_ports; j++) {
725 if (hr_dev->iboe.phy_port[j] == phy_port) {
726 queue_en[i] = 1;
727 port = j;
728 break;
729 }
730 }
731
732 if (!queue_en[i])
733 continue;
734
717 free_mr->mr_free_qp[i] = hns_roce_v1_create_lp_qp(hr_dev, pd); 735 free_mr->mr_free_qp[i] = hns_roce_v1_create_lp_qp(hr_dev, pd);
718 if (IS_ERR(free_mr->mr_free_qp[i])) { 736 if (IS_ERR(free_mr->mr_free_qp[i])) {
719 dev_err(dev, "Create loop qp failed!\n"); 737 dev_err(dev, "Create loop qp failed!\n");
@@ -721,15 +739,7 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
721 } 739 }
722 hr_qp = free_mr->mr_free_qp[i]; 740 hr_qp = free_mr->mr_free_qp[i];
723 741
724 sl = i / caps->num_ports; 742 hr_qp->port = port;
725
726 if (caps->num_ports == HNS_ROCE_MAX_PORTS)
727 phy_port = (i >= HNS_ROCE_MAX_PORTS) ? (i - 2) :
728 (i % caps->num_ports);
729 else
730 phy_port = i % caps->num_ports;
731
732 hr_qp->port = phy_port + 1;
733 hr_qp->phy_port = phy_port; 743 hr_qp->phy_port = phy_port;
734 hr_qp->ibqp.qp_type = IB_QPT_RC; 744 hr_qp->ibqp.qp_type = IB_QPT_RC;
735 hr_qp->ibqp.device = &hr_dev->ib_dev; 745 hr_qp->ibqp.device = &hr_dev->ib_dev;
@@ -739,23 +749,22 @@ static int hns_roce_v1_rsv_lp_qp(struct hns_roce_dev *hr_dev)
739 hr_qp->ibqp.recv_cq = cq; 749 hr_qp->ibqp.recv_cq = cq;
740 hr_qp->ibqp.send_cq = cq; 750 hr_qp->ibqp.send_cq = cq;
741 751
742 rdma_ah_set_port_num(&attr.ah_attr, phy_port + 1); 752 rdma_ah_set_port_num(&attr.ah_attr, port + 1);
743 rdma_ah_set_sl(&attr.ah_attr, phy_port + 1); 753 rdma_ah_set_sl(&attr.ah_attr, sl);
744 attr.port_num = phy_port + 1; 754 attr.port_num = port + 1;
745 755
746 attr.dest_qp_num = hr_qp->qpn; 756 attr.dest_qp_num = hr_qp->qpn;
747 memcpy(rdma_ah_retrieve_dmac(&attr.ah_attr), 757 memcpy(rdma_ah_retrieve_dmac(&attr.ah_attr),
748 hr_dev->dev_addr[phy_port], 758 hr_dev->dev_addr[port],
749 MAC_ADDR_OCTET_NUM); 759 MAC_ADDR_OCTET_NUM);
750 760
751 memcpy(&dgid.raw, &subnet_prefix, sizeof(u64)); 761 memcpy(&dgid.raw, &subnet_prefix, sizeof(u64));
752 memcpy(&dgid.raw[8], hr_dev->dev_addr[phy_port], 3); 762 memcpy(&dgid.raw[8], hr_dev->dev_addr[port], 3);
753 memcpy(&dgid.raw[13], hr_dev->dev_addr[phy_port] + 3, 3); 763 memcpy(&dgid.raw[13], hr_dev->dev_addr[port] + 3, 3);
754 dgid.raw[11] = 0xff; 764 dgid.raw[11] = 0xff;
755 dgid.raw[12] = 0xfe; 765 dgid.raw[12] = 0xfe;
756 dgid.raw[8] ^= 2; 766 dgid.raw[8] ^= 2;
757 rdma_ah_set_dgid_raw(&attr.ah_attr, dgid.raw); 767 rdma_ah_set_dgid_raw(&attr.ah_attr, dgid.raw);
758 attr_mask |= IB_QP_PORT;
759 768
760 ret = hr_dev->hw->modify_qp(&hr_qp->ibqp, &attr, attr_mask, 769 ret = hr_dev->hw->modify_qp(&hr_qp->ibqp, &attr, attr_mask,
761 IB_QPS_RESET, IB_QPS_INIT); 770 IB_QPS_RESET, IB_QPS_INIT);
@@ -812,6 +821,9 @@ static void hns_roce_v1_release_lp_qp(struct hns_roce_dev *hr_dev)
812 821
813 for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) { 822 for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) {
814 hr_qp = free_mr->mr_free_qp[i]; 823 hr_qp = free_mr->mr_free_qp[i];
824 if (!hr_qp)
825 continue;
826
815 ret = hns_roce_v1_destroy_qp(&hr_qp->ibqp); 827 ret = hns_roce_v1_destroy_qp(&hr_qp->ibqp);
816 if (ret) 828 if (ret)
817 dev_err(dev, "Destroy qp %d for mr free failed(%d)!\n", 829 dev_err(dev, "Destroy qp %d for mr free failed(%d)!\n",
@@ -963,7 +975,7 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work)
963 msecs_to_jiffies(HNS_ROCE_V1_FREE_MR_TIMEOUT_MSECS) + jiffies; 975 msecs_to_jiffies(HNS_ROCE_V1_FREE_MR_TIMEOUT_MSECS) + jiffies;
964 int i; 976 int i;
965 int ret; 977 int ret;
966 int ne; 978 int ne = 0;
967 979
968 mr_work = container_of(work, struct hns_roce_mr_free_work, work); 980 mr_work = container_of(work, struct hns_roce_mr_free_work, work);
969 hr_mr = (struct hns_roce_mr *)mr_work->mr; 981 hr_mr = (struct hns_roce_mr *)mr_work->mr;
@@ -976,6 +988,10 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work)
976 988
977 for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) { 989 for (i = 0; i < HNS_ROCE_V1_RESV_QP; i++) {
978 hr_qp = free_mr->mr_free_qp[i]; 990 hr_qp = free_mr->mr_free_qp[i];
991 if (!hr_qp)
992 continue;
993 ne++;
994
979 ret = hns_roce_v1_send_lp_wqe(hr_qp); 995 ret = hns_roce_v1_send_lp_wqe(hr_qp);
980 if (ret) { 996 if (ret) {
981 dev_err(dev, 997 dev_err(dev,
@@ -985,7 +1001,6 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work)
985 } 1001 }
986 } 1002 }
987 1003
988 ne = HNS_ROCE_V1_RESV_QP;
989 do { 1004 do {
990 ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc); 1005 ret = hns_roce_v1_poll_cq(&mr_free_cq->ib_cq, ne, wc);
991 if (ret < 0) { 1006 if (ret < 0) {
@@ -995,7 +1010,8 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work)
995 goto free_work; 1010 goto free_work;
996 } 1011 }
997 ne -= ret; 1012 ne -= ret;
998 msleep(HNS_ROCE_V1_FREE_MR_WAIT_VALUE); 1013 usleep_range(HNS_ROCE_V1_FREE_MR_WAIT_VALUE * 1000,
1014 (1 + HNS_ROCE_V1_FREE_MR_WAIT_VALUE) * 1000);
999 } while (ne && time_before_eq(jiffies, end)); 1015 } while (ne && time_before_eq(jiffies, end));
1000 1016
1001 if (ne != 0) 1017 if (ne != 0)
@@ -2181,7 +2197,7 @@ static int hns_roce_v1_poll_one(struct hns_roce_cq *hr_cq,
2181 } 2197 }
2182 wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; 2198 wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)];
2183 ++wq->tail; 2199 ++wq->tail;
2184 } else { 2200 } else {
2185 /* RQ conrespond to CQE */ 2201 /* RQ conrespond to CQE */
2186 wc->byte_len = le32_to_cpu(cqe->byte_cnt); 2202 wc->byte_len = le32_to_cpu(cqe->byte_cnt);
2187 opcode = roce_get_field(cqe->cqe_byte_4, 2203 opcode = roce_get_field(cqe->cqe_byte_4,
@@ -3533,10 +3549,12 @@ static int check_qp_db_process_status(struct hns_roce_dev *hr_dev,
3533 old_cnt = roce_get_field(old_send, 3549 old_cnt = roce_get_field(old_send,
3534 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_M, 3550 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_M,
3535 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_S); 3551 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_S);
3536 if (cur_cnt - old_cnt > SDB_ST_CMP_VAL) 3552 if (cur_cnt - old_cnt >
3553 SDB_ST_CMP_VAL) {
3537 success_flags = 1; 3554 success_flags = 1;
3538 else { 3555 } else {
3539 send_ptr = roce_get_field(old_send, 3556 send_ptr =
3557 roce_get_field(old_send,
3540 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_M, 3558 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_M,
3541 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_S) + 3559 ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_S) +
3542 roce_get_field(sdb_retry_cnt, 3560 roce_get_field(sdb_retry_cnt,
@@ -3641,6 +3659,7 @@ static void hns_roce_v1_destroy_qp_work_fn(struct work_struct *work)
3641 struct hns_roce_dev *hr_dev; 3659 struct hns_roce_dev *hr_dev;
3642 struct hns_roce_qp *hr_qp; 3660 struct hns_roce_qp *hr_qp;
3643 struct device *dev; 3661 struct device *dev;
3662 unsigned long qpn;
3644 int ret; 3663 int ret;
3645 3664
3646 qp_work_entry = container_of(work, struct hns_roce_qp_work, work); 3665 qp_work_entry = container_of(work, struct hns_roce_qp_work, work);
@@ -3648,8 +3667,9 @@ static void hns_roce_v1_destroy_qp_work_fn(struct work_struct *work)
3648 dev = &hr_dev->pdev->dev; 3667 dev = &hr_dev->pdev->dev;
3649 priv = (struct hns_roce_v1_priv *)hr_dev->hw->priv; 3668 priv = (struct hns_roce_v1_priv *)hr_dev->hw->priv;
3650 hr_qp = qp_work_entry->qp; 3669 hr_qp = qp_work_entry->qp;
3670 qpn = hr_qp->qpn;
3651 3671
3652 dev_dbg(dev, "Schedule destroy QP(0x%lx) work.\n", hr_qp->qpn); 3672 dev_dbg(dev, "Schedule destroy QP(0x%lx) work.\n", qpn);
3653 3673
3654 qp_work_entry->sche_cnt++; 3674 qp_work_entry->sche_cnt++;
3655 3675
@@ -3660,7 +3680,7 @@ static void hns_roce_v1_destroy_qp_work_fn(struct work_struct *work)
3660 &qp_work_entry->db_wait_stage); 3680 &qp_work_entry->db_wait_stage);
3661 if (ret) { 3681 if (ret) {
3662 dev_err(dev, "Check QP(0x%lx) db process status failed!\n", 3682 dev_err(dev, "Check QP(0x%lx) db process status failed!\n",
3663 hr_qp->qpn); 3683 qpn);
3664 return; 3684 return;
3665 } 3685 }
3666 3686
@@ -3674,7 +3694,7 @@ static void hns_roce_v1_destroy_qp_work_fn(struct work_struct *work)
3674 ret = hns_roce_v1_modify_qp(&hr_qp->ibqp, NULL, 0, hr_qp->state, 3694 ret = hns_roce_v1_modify_qp(&hr_qp->ibqp, NULL, 0, hr_qp->state,
3675 IB_QPS_RESET); 3695 IB_QPS_RESET);
3676 if (ret) { 3696 if (ret) {
3677 dev_err(dev, "Modify QP(0x%lx) to RST failed!\n", hr_qp->qpn); 3697 dev_err(dev, "Modify QP(0x%lx) to RST failed!\n", qpn);
3678 return; 3698 return;
3679 } 3699 }
3680 3700
@@ -3683,14 +3703,14 @@ static void hns_roce_v1_destroy_qp_work_fn(struct work_struct *work)
3683 3703
3684 if (hr_qp->ibqp.qp_type == IB_QPT_RC) { 3704 if (hr_qp->ibqp.qp_type == IB_QPT_RC) {
3685 /* RC QP, release QPN */ 3705 /* RC QP, release QPN */
3686 hns_roce_release_range_qp(hr_dev, hr_qp->qpn, 1); 3706 hns_roce_release_range_qp(hr_dev, qpn, 1);
3687 kfree(hr_qp); 3707 kfree(hr_qp);
3688 } else 3708 } else
3689 kfree(hr_to_hr_sqp(hr_qp)); 3709 kfree(hr_to_hr_sqp(hr_qp));
3690 3710
3691 kfree(qp_work_entry); 3711 kfree(qp_work_entry);
3692 3712
3693 dev_dbg(dev, "Accomplished destroy QP(0x%lx) work.\n", hr_qp->qpn); 3713 dev_dbg(dev, "Accomplished destroy QP(0x%lx) work.\n", qpn);
3694} 3714}
3695 3715
3696int hns_roce_v1_destroy_qp(struct ib_qp *ibqp) 3716int hns_roce_v1_destroy_qp(struct ib_qp *ibqp)
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index c3b41f95e70a..d9777b662eba 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -125,8 +125,6 @@ static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
125 return -ENODEV; 125 return -ENODEV;
126 } 126 }
127 127
128 spin_lock_bh(&hr_dev->iboe.lock);
129
130 switch (event) { 128 switch (event) {
131 case NETDEV_UP: 129 case NETDEV_UP:
132 case NETDEV_CHANGE: 130 case NETDEV_CHANGE:
@@ -144,7 +142,6 @@ static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
144 break; 142 break;
145 } 143 }
146 144
147 spin_unlock_bh(&hr_dev->iboe.lock);
148 return 0; 145 return 0;
149} 146}
150 147
diff --git a/drivers/infiniband/hw/i40iw/i40iw.h b/drivers/infiniband/hw/i40iw/i40iw.h
index da2eb5a281fa..9b1566468744 100644
--- a/drivers/infiniband/hw/i40iw/i40iw.h
+++ b/drivers/infiniband/hw/i40iw/i40iw.h
@@ -527,6 +527,7 @@ enum i40iw_status_code i40iw_add_mac_addr(struct i40iw_device *iwdev,
527int i40iw_modify_qp(struct ib_qp *, struct ib_qp_attr *, int, struct ib_udata *); 527int i40iw_modify_qp(struct ib_qp *, struct ib_qp_attr *, int, struct ib_udata *);
528void i40iw_cq_wq_destroy(struct i40iw_device *iwdev, struct i40iw_sc_cq *cq); 528void i40iw_cq_wq_destroy(struct i40iw_device *iwdev, struct i40iw_sc_cq *cq);
529 529
530void i40iw_cleanup_pending_cqp_op(struct i40iw_device *iwdev);
530void i40iw_rem_pdusecount(struct i40iw_pd *iwpd, struct i40iw_device *iwdev); 531void i40iw_rem_pdusecount(struct i40iw_pd *iwpd, struct i40iw_device *iwdev);
531void i40iw_add_pdusecount(struct i40iw_pd *iwpd); 532void i40iw_add_pdusecount(struct i40iw_pd *iwpd);
532void i40iw_rem_devusecount(struct i40iw_device *iwdev); 533void i40iw_rem_devusecount(struct i40iw_device *iwdev);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
index 6ae98aa7f74e..5a2fa743676c 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
@@ -3487,7 +3487,8 @@ static void i40iw_cm_disconn_true(struct i40iw_qp *iwqp)
3487 if (((original_hw_tcp_state == I40IW_TCP_STATE_CLOSED) || 3487 if (((original_hw_tcp_state == I40IW_TCP_STATE_CLOSED) ||
3488 (original_hw_tcp_state == I40IW_TCP_STATE_TIME_WAIT) || 3488 (original_hw_tcp_state == I40IW_TCP_STATE_TIME_WAIT) ||
3489 (last_ae == I40IW_AE_RDMAP_ROE_BAD_LLP_CLOSE) || 3489 (last_ae == I40IW_AE_RDMAP_ROE_BAD_LLP_CLOSE) ||
3490 (last_ae == I40IW_AE_LLP_CONNECTION_RESET))) { 3490 (last_ae == I40IW_AE_LLP_CONNECTION_RESET) ||
3491 iwdev->reset)) {
3491 issue_close = 1; 3492 issue_close = 1;
3492 iwqp->cm_id = NULL; 3493 iwqp->cm_id = NULL;
3493 if (!iwqp->flush_issued) { 3494 if (!iwqp->flush_issued) {
@@ -4265,6 +4266,8 @@ void i40iw_cm_disconnect_all(struct i40iw_device *iwdev)
4265 cm_node = container_of(list_node, struct i40iw_cm_node, connected_entry); 4266 cm_node = container_of(list_node, struct i40iw_cm_node, connected_entry);
4266 attr.qp_state = IB_QPS_ERR; 4267 attr.qp_state = IB_QPS_ERR;
4267 i40iw_modify_qp(&cm_node->iwqp->ibqp, &attr, IB_QP_STATE, NULL); 4268 i40iw_modify_qp(&cm_node->iwqp->ibqp, &attr, IB_QP_STATE, NULL);
4269 if (iwdev->reset)
4270 i40iw_cm_disconn(cm_node->iwqp);
4268 i40iw_rem_ref_cm_node(cm_node); 4271 i40iw_rem_ref_cm_node(cm_node);
4269 } 4272 }
4270} 4273}
diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
index a027e2072477..9ec1ae9a82c9 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
@@ -1970,6 +1970,8 @@ static enum i40iw_status_code i40iw_sc_ccq_destroy(struct i40iw_sc_cq *ccq,
1970 ret_code = i40iw_cqp_poll_registers(cqp, tail, 1000); 1970 ret_code = i40iw_cqp_poll_registers(cqp, tail, 1000);
1971 } 1971 }
1972 1972
1973 cqp->process_cqp_sds = i40iw_update_sds_noccq;
1974
1973 return ret_code; 1975 return ret_code;
1974} 1976}
1975 1977
diff --git a/drivers/infiniband/hw/i40iw/i40iw_main.c b/drivers/infiniband/hw/i40iw/i40iw_main.c
index e0f47cc2effc..ae8463ff59a7 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_main.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_main.c
@@ -243,6 +243,8 @@ static void i40iw_destroy_cqp(struct i40iw_device *iwdev, bool free_hwcqp)
243 if (free_hwcqp) 243 if (free_hwcqp)
244 dev->cqp_ops->cqp_destroy(dev->cqp); 244 dev->cqp_ops->cqp_destroy(dev->cqp);
245 245
246 i40iw_cleanup_pending_cqp_op(iwdev);
247
246 i40iw_free_dma_mem(dev->hw, &cqp->sq); 248 i40iw_free_dma_mem(dev->hw, &cqp->sq);
247 kfree(cqp->scratch_array); 249 kfree(cqp->scratch_array);
248 iwdev->cqp.scratch_array = NULL; 250 iwdev->cqp.scratch_array = NULL;
@@ -274,13 +276,12 @@ static void i40iw_disable_irq(struct i40iw_sc_dev *dev,
274/** 276/**
275 * i40iw_destroy_aeq - destroy aeq 277 * i40iw_destroy_aeq - destroy aeq
276 * @iwdev: iwarp device 278 * @iwdev: iwarp device
277 * @reset: true if called before reset
278 * 279 *
279 * Issue a destroy aeq request and 280 * Issue a destroy aeq request and
280 * free the resources associated with the aeq 281 * free the resources associated with the aeq
281 * The function is called during driver unload 282 * The function is called during driver unload
282 */ 283 */
283static void i40iw_destroy_aeq(struct i40iw_device *iwdev, bool reset) 284static void i40iw_destroy_aeq(struct i40iw_device *iwdev)
284{ 285{
285 enum i40iw_status_code status = I40IW_ERR_NOT_READY; 286 enum i40iw_status_code status = I40IW_ERR_NOT_READY;
286 struct i40iw_sc_dev *dev = &iwdev->sc_dev; 287 struct i40iw_sc_dev *dev = &iwdev->sc_dev;
@@ -288,7 +289,7 @@ static void i40iw_destroy_aeq(struct i40iw_device *iwdev, bool reset)
288 289
289 if (!iwdev->msix_shared) 290 if (!iwdev->msix_shared)
290 i40iw_disable_irq(dev, iwdev->iw_msixtbl, (void *)iwdev); 291 i40iw_disable_irq(dev, iwdev->iw_msixtbl, (void *)iwdev);
291 if (reset) 292 if (iwdev->reset)
292 goto exit; 293 goto exit;
293 294
294 if (!dev->aeq_ops->aeq_destroy(&aeq->sc_aeq, 0, 1)) 295 if (!dev->aeq_ops->aeq_destroy(&aeq->sc_aeq, 0, 1))
@@ -304,19 +305,17 @@ exit:
304 * i40iw_destroy_ceq - destroy ceq 305 * i40iw_destroy_ceq - destroy ceq
305 * @iwdev: iwarp device 306 * @iwdev: iwarp device
306 * @iwceq: ceq to be destroyed 307 * @iwceq: ceq to be destroyed
307 * @reset: true if called before reset
308 * 308 *
309 * Issue a destroy ceq request and 309 * Issue a destroy ceq request and
310 * free the resources associated with the ceq 310 * free the resources associated with the ceq
311 */ 311 */
312static void i40iw_destroy_ceq(struct i40iw_device *iwdev, 312static void i40iw_destroy_ceq(struct i40iw_device *iwdev,
313 struct i40iw_ceq *iwceq, 313 struct i40iw_ceq *iwceq)
314 bool reset)
315{ 314{
316 enum i40iw_status_code status; 315 enum i40iw_status_code status;
317 struct i40iw_sc_dev *dev = &iwdev->sc_dev; 316 struct i40iw_sc_dev *dev = &iwdev->sc_dev;
318 317
319 if (reset) 318 if (iwdev->reset)
320 goto exit; 319 goto exit;
321 320
322 status = dev->ceq_ops->ceq_destroy(&iwceq->sc_ceq, 0, 1); 321 status = dev->ceq_ops->ceq_destroy(&iwceq->sc_ceq, 0, 1);
@@ -335,12 +334,11 @@ exit:
335/** 334/**
336 * i40iw_dele_ceqs - destroy all ceq's 335 * i40iw_dele_ceqs - destroy all ceq's
337 * @iwdev: iwarp device 336 * @iwdev: iwarp device
338 * @reset: true if called before reset
339 * 337 *
340 * Go through all of the device ceq's and for each ceq 338 * Go through all of the device ceq's and for each ceq
341 * disable the ceq interrupt and destroy the ceq 339 * disable the ceq interrupt and destroy the ceq
342 */ 340 */
343static void i40iw_dele_ceqs(struct i40iw_device *iwdev, bool reset) 341static void i40iw_dele_ceqs(struct i40iw_device *iwdev)
344{ 342{
345 u32 i = 0; 343 u32 i = 0;
346 struct i40iw_sc_dev *dev = &iwdev->sc_dev; 344 struct i40iw_sc_dev *dev = &iwdev->sc_dev;
@@ -349,32 +347,31 @@ static void i40iw_dele_ceqs(struct i40iw_device *iwdev, bool reset)
349 347
350 if (iwdev->msix_shared) { 348 if (iwdev->msix_shared) {
351 i40iw_disable_irq(dev, msix_vec, (void *)iwdev); 349 i40iw_disable_irq(dev, msix_vec, (void *)iwdev);
352 i40iw_destroy_ceq(iwdev, iwceq, reset); 350 i40iw_destroy_ceq(iwdev, iwceq);
353 iwceq++; 351 iwceq++;
354 i++; 352 i++;
355 } 353 }
356 354
357 for (msix_vec++; i < iwdev->ceqs_count; i++, msix_vec++, iwceq++) { 355 for (msix_vec++; i < iwdev->ceqs_count; i++, msix_vec++, iwceq++) {
358 i40iw_disable_irq(dev, msix_vec, (void *)iwceq); 356 i40iw_disable_irq(dev, msix_vec, (void *)iwceq);
359 i40iw_destroy_ceq(iwdev, iwceq, reset); 357 i40iw_destroy_ceq(iwdev, iwceq);
360 } 358 }
361} 359}
362 360
363/** 361/**
364 * i40iw_destroy_ccq - destroy control cq 362 * i40iw_destroy_ccq - destroy control cq
365 * @iwdev: iwarp device 363 * @iwdev: iwarp device
366 * @reset: true if called before reset
367 * 364 *
368 * Issue destroy ccq request and 365 * Issue destroy ccq request and
369 * free the resources associated with the ccq 366 * free the resources associated with the ccq
370 */ 367 */
371static void i40iw_destroy_ccq(struct i40iw_device *iwdev, bool reset) 368static void i40iw_destroy_ccq(struct i40iw_device *iwdev)
372{ 369{
373 struct i40iw_sc_dev *dev = &iwdev->sc_dev; 370 struct i40iw_sc_dev *dev = &iwdev->sc_dev;
374 struct i40iw_ccq *ccq = &iwdev->ccq; 371 struct i40iw_ccq *ccq = &iwdev->ccq;
375 enum i40iw_status_code status = 0; 372 enum i40iw_status_code status = 0;
376 373
377 if (!reset) 374 if (!iwdev->reset)
378 status = dev->ccq_ops->ccq_destroy(dev->ccq, 0, true); 375 status = dev->ccq_ops->ccq_destroy(dev->ccq, 0, true);
379 if (status) 376 if (status)
380 i40iw_pr_err("ccq destroy failed %d\n", status); 377 i40iw_pr_err("ccq destroy failed %d\n", status);
@@ -810,7 +807,7 @@ static enum i40iw_status_code i40iw_setup_ceqs(struct i40iw_device *iwdev,
810 iwceq->msix_idx = msix_vec->idx; 807 iwceq->msix_idx = msix_vec->idx;
811 status = i40iw_configure_ceq_vector(iwdev, iwceq, ceq_id, msix_vec); 808 status = i40iw_configure_ceq_vector(iwdev, iwceq, ceq_id, msix_vec);
812 if (status) { 809 if (status) {
813 i40iw_destroy_ceq(iwdev, iwceq, false); 810 i40iw_destroy_ceq(iwdev, iwceq);
814 break; 811 break;
815 } 812 }
816 i40iw_enable_intr(&iwdev->sc_dev, msix_vec->idx); 813 i40iw_enable_intr(&iwdev->sc_dev, msix_vec->idx);
@@ -912,7 +909,7 @@ static enum i40iw_status_code i40iw_setup_aeq(struct i40iw_device *iwdev)
912 909
913 status = i40iw_configure_aeq_vector(iwdev); 910 status = i40iw_configure_aeq_vector(iwdev);
914 if (status) { 911 if (status) {
915 i40iw_destroy_aeq(iwdev, false); 912 i40iw_destroy_aeq(iwdev);
916 return status; 913 return status;
917 } 914 }
918 915
@@ -1442,12 +1439,11 @@ static enum i40iw_status_code i40iw_save_msix_info(struct i40iw_device *iwdev,
1442/** 1439/**
1443 * i40iw_deinit_device - clean up the device resources 1440 * i40iw_deinit_device - clean up the device resources
1444 * @iwdev: iwarp device 1441 * @iwdev: iwarp device
1445 * @reset: true if called before reset
1446 * 1442 *
1447 * Destroy the ib device interface, remove the mac ip entry and ipv4/ipv6 addresses, 1443 * Destroy the ib device interface, remove the mac ip entry and ipv4/ipv6 addresses,
1448 * destroy the device queues and free the pble and the hmc objects 1444 * destroy the device queues and free the pble and the hmc objects
1449 */ 1445 */
1450static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset) 1446static void i40iw_deinit_device(struct i40iw_device *iwdev)
1451{ 1447{
1452 struct i40e_info *ldev = iwdev->ldev; 1448 struct i40e_info *ldev = iwdev->ldev;
1453 1449
@@ -1464,7 +1460,7 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset)
1464 i40iw_destroy_rdma_device(iwdev->iwibdev); 1460 i40iw_destroy_rdma_device(iwdev->iwibdev);
1465 /* fallthrough */ 1461 /* fallthrough */
1466 case IP_ADDR_REGISTERED: 1462 case IP_ADDR_REGISTERED:
1467 if (!reset) 1463 if (!iwdev->reset)
1468 i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx); 1464 i40iw_del_macip_entry(iwdev, (u8)iwdev->mac_ip_table_idx);
1469 /* fallthrough */ 1465 /* fallthrough */
1470 case INET_NOTIFIER: 1466 case INET_NOTIFIER:
@@ -1474,26 +1470,26 @@ static void i40iw_deinit_device(struct i40iw_device *iwdev, bool reset)
1474 unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier); 1470 unregister_inet6addr_notifier(&i40iw_inetaddr6_notifier);
1475 } 1471 }
1476 /* fallthrough */ 1472 /* fallthrough */
1473 case PBLE_CHUNK_MEM:
1474 i40iw_destroy_pble_pool(dev, iwdev->pble_rsrc);
1475 /* fallthrough */
1477 case CEQ_CREATED: 1476 case CEQ_CREATED:
1478 i40iw_dele_ceqs(iwdev, reset); 1477 i40iw_dele_ceqs(iwdev);
1479 /* fallthrough */ 1478 /* fallthrough */
1480 case AEQ_CREATED: 1479 case AEQ_CREATED:
1481 i40iw_destroy_aeq(iwdev, reset); 1480 i40iw_destroy_aeq(iwdev);
1482 /* fallthrough */ 1481 /* fallthrough */
1483 case IEQ_CREATED: 1482 case IEQ_CREATED:
1484 i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, reset); 1483 i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_IEQ, iwdev->reset);
1485 /* fallthrough */ 1484 /* fallthrough */
1486 case ILQ_CREATED: 1485 case ILQ_CREATED:
1487 i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, reset); 1486 i40iw_puda_dele_resources(&iwdev->vsi, I40IW_PUDA_RSRC_TYPE_ILQ, iwdev->reset);
1488 /* fallthrough */ 1487 /* fallthrough */
1489 case CCQ_CREATED: 1488 case CCQ_CREATED:
1490 i40iw_destroy_ccq(iwdev, reset); 1489 i40iw_destroy_ccq(iwdev);
1491 /* fallthrough */
1492 case PBLE_CHUNK_MEM:
1493 i40iw_destroy_pble_pool(dev, iwdev->pble_rsrc);
1494 /* fallthrough */ 1490 /* fallthrough */
1495 case HMC_OBJS_CREATED: 1491 case HMC_OBJS_CREATED:
1496 i40iw_del_hmc_objects(dev, dev->hmc_info, true, reset); 1492 i40iw_del_hmc_objects(dev, dev->hmc_info, true, iwdev->reset);
1497 /* fallthrough */ 1493 /* fallthrough */
1498 case CQP_CREATED: 1494 case CQP_CREATED:
1499 i40iw_destroy_cqp(iwdev, true); 1495 i40iw_destroy_cqp(iwdev, true);
@@ -1670,6 +1666,7 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client)
1670 status = i40iw_hmc_init_pble(&iwdev->sc_dev, iwdev->pble_rsrc); 1666 status = i40iw_hmc_init_pble(&iwdev->sc_dev, iwdev->pble_rsrc);
1671 if (status) 1667 if (status)
1672 break; 1668 break;
1669 iwdev->init_state = PBLE_CHUNK_MEM;
1673 iwdev->virtchnl_wq = alloc_ordered_workqueue("iwvch", WQ_MEM_RECLAIM); 1670 iwdev->virtchnl_wq = alloc_ordered_workqueue("iwvch", WQ_MEM_RECLAIM);
1674 i40iw_register_notifiers(); 1671 i40iw_register_notifiers();
1675 iwdev->init_state = INET_NOTIFIER; 1672 iwdev->init_state = INET_NOTIFIER;
@@ -1693,7 +1690,7 @@ static int i40iw_open(struct i40e_info *ldev, struct i40e_client *client)
1693 } while (0); 1690 } while (0);
1694 1691
1695 i40iw_pr_err("status = %d last completion = %d\n", status, iwdev->init_state); 1692 i40iw_pr_err("status = %d last completion = %d\n", status, iwdev->init_state);
1696 i40iw_deinit_device(iwdev, false); 1693 i40iw_deinit_device(iwdev);
1697 return -ERESTART; 1694 return -ERESTART;
1698} 1695}
1699 1696
@@ -1774,9 +1771,12 @@ static void i40iw_close(struct i40e_info *ldev, struct i40e_client *client, bool
1774 iwdev = &hdl->device; 1771 iwdev = &hdl->device;
1775 iwdev->closing = true; 1772 iwdev->closing = true;
1776 1773
1774 if (reset)
1775 iwdev->reset = true;
1776
1777 i40iw_cm_disconnect_all(iwdev); 1777 i40iw_cm_disconnect_all(iwdev);
1778 destroy_workqueue(iwdev->virtchnl_wq); 1778 destroy_workqueue(iwdev->virtchnl_wq);
1779 i40iw_deinit_device(iwdev, reset); 1779 i40iw_deinit_device(iwdev);
1780} 1780}
1781 1781
1782/** 1782/**
diff --git a/drivers/infiniband/hw/i40iw/i40iw_puda.c b/drivers/infiniband/hw/i40iw/i40iw_puda.c
index db41ab40da9c..71050c5d29a0 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_puda.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_puda.c
@@ -408,6 +408,9 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp,
408 set_64bit_val(wqe, 0, info->paddr); 408 set_64bit_val(wqe, 0, info->paddr);
409 set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN)); 409 set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN));
410 set_64bit_val(wqe, 16, header[0]); 410 set_64bit_val(wqe, 16, header[0]);
411
412 /* Ensure all data is written before writing valid bit */
413 wmb();
411 set_64bit_val(wqe, 24, header[1]); 414 set_64bit_val(wqe, 24, header[1]);
412 415
413 i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32); 416 i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32);
@@ -1411,10 +1414,10 @@ static void i40iw_ieq_handle_exception(struct i40iw_puda_rsrc *ieq,
1411 1414
1412 if (!list_empty(rxlist)) { 1415 if (!list_empty(rxlist)) {
1413 tmpbuf = (struct i40iw_puda_buf *)rxlist->next; 1416 tmpbuf = (struct i40iw_puda_buf *)rxlist->next;
1414 plist = &tmpbuf->list;
1415 while ((struct list_head *)tmpbuf != rxlist) { 1417 while ((struct list_head *)tmpbuf != rxlist) {
1416 if ((int)(buf->seqnum - tmpbuf->seqnum) < 0) 1418 if ((int)(buf->seqnum - tmpbuf->seqnum) < 0)
1417 break; 1419 break;
1420 plist = &tmpbuf->list;
1418 tmpbuf = (struct i40iw_puda_buf *)plist->next; 1421 tmpbuf = (struct i40iw_puda_buf *)plist->next;
1419 } 1422 }
1420 /* Insert buf before tmpbuf */ 1423 /* Insert buf before tmpbuf */
diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c
index 56d986924a4c..e311ec559f4e 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_utils.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c
@@ -337,6 +337,7 @@ struct i40iw_cqp_request *i40iw_get_cqp_request(struct i40iw_cqp *cqp, bool wait
337 */ 337 */
338void i40iw_free_cqp_request(struct i40iw_cqp *cqp, struct i40iw_cqp_request *cqp_request) 338void i40iw_free_cqp_request(struct i40iw_cqp *cqp, struct i40iw_cqp_request *cqp_request)
339{ 339{
340 struct i40iw_device *iwdev = container_of(cqp, struct i40iw_device, cqp);
340 unsigned long flags; 341 unsigned long flags;
341 342
342 if (cqp_request->dynamic) { 343 if (cqp_request->dynamic) {
@@ -350,6 +351,7 @@ void i40iw_free_cqp_request(struct i40iw_cqp *cqp, struct i40iw_cqp_request *cqp
350 list_add_tail(&cqp_request->list, &cqp->cqp_avail_reqs); 351 list_add_tail(&cqp_request->list, &cqp->cqp_avail_reqs);
351 spin_unlock_irqrestore(&cqp->req_lock, flags); 352 spin_unlock_irqrestore(&cqp->req_lock, flags);
352 } 353 }
354 wake_up(&iwdev->close_wq);
353} 355}
354 356
355/** 357/**
@@ -365,6 +367,56 @@ void i40iw_put_cqp_request(struct i40iw_cqp *cqp,
365} 367}
366 368
367/** 369/**
370 * i40iw_free_pending_cqp_request -free pending cqp request objs
371 * @cqp: cqp ptr
372 * @cqp_request: to be put back in cqp list
373 */
374static void i40iw_free_pending_cqp_request(struct i40iw_cqp *cqp,
375 struct i40iw_cqp_request *cqp_request)
376{
377 struct i40iw_device *iwdev = container_of(cqp, struct i40iw_device, cqp);
378
379 if (cqp_request->waiting) {
380 cqp_request->compl_info.error = true;
381 cqp_request->request_done = true;
382 wake_up(&cqp_request->waitq);
383 }
384 i40iw_put_cqp_request(cqp, cqp_request);
385 wait_event_timeout(iwdev->close_wq,
386 !atomic_read(&cqp_request->refcount),
387 1000);
388}
389
390/**
391 * i40iw_cleanup_pending_cqp_op - clean-up cqp with no completions
392 * @iwdev: iwarp device
393 */
394void i40iw_cleanup_pending_cqp_op(struct i40iw_device *iwdev)
395{
396 struct i40iw_sc_dev *dev = &iwdev->sc_dev;
397 struct i40iw_cqp *cqp = &iwdev->cqp;
398 struct i40iw_cqp_request *cqp_request = NULL;
399 struct cqp_commands_info *pcmdinfo = NULL;
400 u32 i, pending_work, wqe_idx;
401
402 pending_work = I40IW_RING_WORK_AVAILABLE(cqp->sc_cqp.sq_ring);
403 wqe_idx = I40IW_RING_GETCURRENT_TAIL(cqp->sc_cqp.sq_ring);
404 for (i = 0; i < pending_work; i++) {
405 cqp_request = (struct i40iw_cqp_request *)(unsigned long)cqp->scratch_array[wqe_idx];
406 if (cqp_request)
407 i40iw_free_pending_cqp_request(cqp, cqp_request);
408 wqe_idx = (wqe_idx + 1) % I40IW_RING_GETSIZE(cqp->sc_cqp.sq_ring);
409 }
410
411 while (!list_empty(&dev->cqp_cmd_head)) {
412 pcmdinfo = (struct cqp_commands_info *)i40iw_remove_head(&dev->cqp_cmd_head);
413 cqp_request = container_of(pcmdinfo, struct i40iw_cqp_request, info);
414 if (cqp_request)
415 i40iw_free_pending_cqp_request(cqp, cqp_request);
416 }
417}
418
419/**
368 * i40iw_free_qp - callback after destroy cqp completes 420 * i40iw_free_qp - callback after destroy cqp completes
369 * @cqp_request: cqp request for destroy qp 421 * @cqp_request: cqp request for destroy qp
370 * @num: not used 422 * @num: not used
@@ -546,8 +598,12 @@ void i40iw_rem_ref(struct ib_qp *ibqp)
546 cqp_info->in.u.qp_destroy.scratch = (uintptr_t)cqp_request; 598 cqp_info->in.u.qp_destroy.scratch = (uintptr_t)cqp_request;
547 cqp_info->in.u.qp_destroy.remove_hash_idx = true; 599 cqp_info->in.u.qp_destroy.remove_hash_idx = true;
548 status = i40iw_handle_cqp_op(iwdev, cqp_request); 600 status = i40iw_handle_cqp_op(iwdev, cqp_request);
549 if (status) 601 if (!status)
550 i40iw_pr_err("CQP-OP Destroy QP fail"); 602 return;
603
604 i40iw_rem_pdusecount(iwqp->iwpd, iwdev);
605 i40iw_free_qp_resources(iwdev, iwqp, qp_num);
606 i40iw_rem_devusecount(iwdev);
551} 607}
552 608
553/** 609/**
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 4dbe61ec7a77..02d871db7ca5 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -426,9 +426,13 @@ void i40iw_free_qp_resources(struct i40iw_device *iwdev,
426 struct i40iw_qp *iwqp, 426 struct i40iw_qp *iwqp,
427 u32 qp_num) 427 u32 qp_num)
428{ 428{
429 struct i40iw_pbl *iwpbl = &iwqp->iwpbl;
430
429 i40iw_dealloc_push_page(iwdev, &iwqp->sc_qp); 431 i40iw_dealloc_push_page(iwdev, &iwqp->sc_qp);
430 if (qp_num) 432 if (qp_num)
431 i40iw_free_resource(iwdev, iwdev->allocated_qps, qp_num); 433 i40iw_free_resource(iwdev, iwdev->allocated_qps, qp_num);
434 if (iwpbl->pbl_allocated)
435 i40iw_free_pble(iwdev->pble_rsrc, &iwpbl->pble_alloc);
432 i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->q2_ctx_mem); 436 i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->q2_ctx_mem);
433 i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->kqp.dma_mem); 437 i40iw_free_dma_mem(iwdev->sc_dev.hw, &iwqp->kqp.dma_mem);
434 kfree(iwqp->kqp.wrid_mem); 438 kfree(iwqp->kqp.wrid_mem);
@@ -483,7 +487,7 @@ static int i40iw_setup_virt_qp(struct i40iw_device *iwdev,
483 struct i40iw_qp *iwqp, 487 struct i40iw_qp *iwqp,
484 struct i40iw_qp_init_info *init_info) 488 struct i40iw_qp_init_info *init_info)
485{ 489{
486 struct i40iw_pbl *iwpbl = iwqp->iwpbl; 490 struct i40iw_pbl *iwpbl = &iwqp->iwpbl;
487 struct i40iw_qp_mr *qpmr = &iwpbl->qp_mr; 491 struct i40iw_qp_mr *qpmr = &iwpbl->qp_mr;
488 492
489 iwqp->page = qpmr->sq_page; 493 iwqp->page = qpmr->sq_page;
@@ -688,19 +692,22 @@ static struct ib_qp *i40iw_create_qp(struct ib_pd *ibpd,
688 ucontext = to_ucontext(ibpd->uobject->context); 692 ucontext = to_ucontext(ibpd->uobject->context);
689 693
690 if (req.user_wqe_buffers) { 694 if (req.user_wqe_buffers) {
695 struct i40iw_pbl *iwpbl;
696
691 spin_lock_irqsave( 697 spin_lock_irqsave(
692 &ucontext->qp_reg_mem_list_lock, flags); 698 &ucontext->qp_reg_mem_list_lock, flags);
693 iwqp->iwpbl = i40iw_get_pbl( 699 iwpbl = i40iw_get_pbl(
694 (unsigned long)req.user_wqe_buffers, 700 (unsigned long)req.user_wqe_buffers,
695 &ucontext->qp_reg_mem_list); 701 &ucontext->qp_reg_mem_list);
696 spin_unlock_irqrestore( 702 spin_unlock_irqrestore(
697 &ucontext->qp_reg_mem_list_lock, flags); 703 &ucontext->qp_reg_mem_list_lock, flags);
698 704
699 if (!iwqp->iwpbl) { 705 if (!iwpbl) {
700 err_code = -ENODATA; 706 err_code = -ENODATA;
701 i40iw_pr_err("no pbl info\n"); 707 i40iw_pr_err("no pbl info\n");
702 goto error; 708 goto error;
703 } 709 }
710 memcpy(&iwqp->iwpbl, iwpbl, sizeof(iwqp->iwpbl));
704 } 711 }
705 } 712 }
706 err_code = i40iw_setup_virt_qp(iwdev, iwqp, &init_info); 713 err_code = i40iw_setup_virt_qp(iwdev, iwqp, &init_info);
@@ -1161,8 +1168,10 @@ static struct ib_cq *i40iw_create_cq(struct ib_device *ibdev,
1161 memset(&req, 0, sizeof(req)); 1168 memset(&req, 0, sizeof(req));
1162 iwcq->user_mode = true; 1169 iwcq->user_mode = true;
1163 ucontext = to_ucontext(context); 1170 ucontext = to_ucontext(context);
1164 if (ib_copy_from_udata(&req, udata, sizeof(struct i40iw_create_cq_req))) 1171 if (ib_copy_from_udata(&req, udata, sizeof(struct i40iw_create_cq_req))) {
1172 err_code = -EFAULT;
1165 goto cq_free_resources; 1173 goto cq_free_resources;
1174 }
1166 1175
1167 spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags); 1176 spin_lock_irqsave(&ucontext->cq_reg_mem_list_lock, flags);
1168 iwpbl = i40iw_get_pbl((unsigned long)req.user_cq_buffer, 1177 iwpbl = i40iw_get_pbl((unsigned long)req.user_cq_buffer,
@@ -2063,7 +2072,7 @@ static int i40iw_dereg_mr(struct ib_mr *ib_mr)
2063 ucontext = to_ucontext(ibpd->uobject->context); 2072 ucontext = to_ucontext(ibpd->uobject->context);
2064 i40iw_del_memlist(iwmr, ucontext); 2073 i40iw_del_memlist(iwmr, ucontext);
2065 } 2074 }
2066 if (iwpbl->pbl_allocated) 2075 if (iwpbl->pbl_allocated && iwmr->type != IW_MEMREG_TYPE_QP)
2067 i40iw_free_pble(iwdev->pble_rsrc, palloc); 2076 i40iw_free_pble(iwdev->pble_rsrc, palloc);
2068 kfree(iwmr); 2077 kfree(iwmr);
2069 return 0; 2078 return 0;
diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.h b/drivers/infiniband/hw/i40iw/i40iw_verbs.h
index 07c3fec77de6..9067443cd311 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.h
@@ -170,7 +170,7 @@ struct i40iw_qp {
170 struct i40iw_qp_kmode kqp; 170 struct i40iw_qp_kmode kqp;
171 struct i40iw_dma_mem host_ctx; 171 struct i40iw_dma_mem host_ctx;
172 struct timer_list terminate_timer; 172 struct timer_list terminate_timer;
173 struct i40iw_pbl *iwpbl; 173 struct i40iw_pbl iwpbl;
174 struct i40iw_dma_mem q2_ctx_mem; 174 struct i40iw_dma_mem q2_ctx_mem;
175 struct i40iw_dma_mem ietf_mem; 175 struct i40iw_dma_mem ietf_mem;
176 struct completion sq_drained; 176 struct completion sq_drained;
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c
index 1e6c526450d9..fedaf8260105 100644
--- a/drivers/infiniband/hw/mlx4/cm.c
+++ b/drivers/infiniband/hw/mlx4/cm.c
@@ -323,6 +323,9 @@ int mlx4_ib_multiplex_cm_handler(struct ib_device *ibdev, int port, int slave_id
323 mad->mad_hdr.attr_id == CM_REP_ATTR_ID || 323 mad->mad_hdr.attr_id == CM_REP_ATTR_ID ||
324 mad->mad_hdr.attr_id == CM_SIDR_REQ_ATTR_ID) { 324 mad->mad_hdr.attr_id == CM_SIDR_REQ_ATTR_ID) {
325 sl_cm_id = get_local_comm_id(mad); 325 sl_cm_id = get_local_comm_id(mad);
326 id = id_map_get(ibdev, &pv_cm_id, slave_id, sl_cm_id);
327 if (id)
328 goto cont;
326 id = id_map_alloc(ibdev, slave_id, sl_cm_id); 329 id = id_map_alloc(ibdev, slave_id, sl_cm_id);
327 if (IS_ERR(id)) { 330 if (IS_ERR(id)) {
328 mlx4_ib_warn(ibdev, "%s: id{slave: %d, sl_cm_id: 0x%x} Failed to id_map_alloc\n", 331 mlx4_ib_warn(ibdev, "%s: id{slave: %d, sl_cm_id: 0x%x} Failed to id_map_alloc\n",
@@ -343,6 +346,7 @@ int mlx4_ib_multiplex_cm_handler(struct ib_device *ibdev, int port, int slave_id
343 return -EINVAL; 346 return -EINVAL;
344 } 347 }
345 348
349cont:
346 set_local_comm_id(mad, id->pv_cm_id); 350 set_local_comm_id(mad, id->pv_cm_id);
347 351
348 if (mad->mad_hdr.attr_id == CM_DREQ_ATTR_ID) 352 if (mad->mad_hdr.attr_id == CM_DREQ_ATTR_ID)
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 4f5a143fc0a7..ff931c580557 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -102,7 +102,7 @@ static int mlx4_ib_alloc_cq_buf(struct mlx4_ib_dev *dev, struct mlx4_ib_cq_buf *
102 int err; 102 int err;
103 103
104 err = mlx4_buf_alloc(dev->dev, nent * dev->dev->caps.cqe_size, 104 err = mlx4_buf_alloc(dev->dev, nent * dev->dev->caps.cqe_size,
105 PAGE_SIZE * 2, &buf->buf, GFP_KERNEL); 105 PAGE_SIZE * 2, &buf->buf);
106 106
107 if (err) 107 if (err)
108 goto out; 108 goto out;
@@ -113,7 +113,7 @@ static int mlx4_ib_alloc_cq_buf(struct mlx4_ib_dev *dev, struct mlx4_ib_cq_buf *
113 if (err) 113 if (err)
114 goto err_buf; 114 goto err_buf;
115 115
116 err = mlx4_buf_write_mtt(dev->dev, &buf->mtt, &buf->buf, GFP_KERNEL); 116 err = mlx4_buf_write_mtt(dev->dev, &buf->mtt, &buf->buf);
117 if (err) 117 if (err)
118 goto err_mtt; 118 goto err_mtt;
119 119
@@ -219,7 +219,7 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev,
219 219
220 uar = &to_mucontext(context)->uar; 220 uar = &to_mucontext(context)->uar;
221 } else { 221 } else {
222 err = mlx4_db_alloc(dev->dev, &cq->db, 1, GFP_KERNEL); 222 err = mlx4_db_alloc(dev->dev, &cq->db, 1);
223 if (err) 223 if (err)
224 goto err_cq; 224 goto err_cq;
225 225
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 75b2f7d4cd95..d1b43cbbfea7 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1155,7 +1155,7 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
1155 * call to mlx4_ib_vma_close. 1155 * call to mlx4_ib_vma_close.
1156 */ 1156 */
1157 put_task_struct(owning_process); 1157 put_task_struct(owning_process);
1158 msleep(1); 1158 usleep_range(1000, 2000);
1159 owning_process = get_pid_task(ibcontext->tgid, 1159 owning_process = get_pid_task(ibcontext->tgid,
1160 PIDTYPE_PID); 1160 PIDTYPE_PID);
1161 if (!owning_process || 1161 if (!owning_process ||
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
index 3405e947dc1e..b73f89700ef9 100644
--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -1091,7 +1091,7 @@ static void _mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy
1091 if (!count) 1091 if (!count)
1092 break; 1092 break;
1093 1093
1094 msleep(1); 1094 usleep_range(1000, 2000);
1095 } while (time_after(end, jiffies)); 1095 } while (time_after(end, jiffies));
1096 1096
1097 flush_workqueue(ctx->mcg_wq); 1097 flush_workqueue(ctx->mcg_wq);
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index c2b9cbf4da05..9db82e67e959 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -185,7 +185,6 @@ enum mlx4_ib_qp_flags {
185 MLX4_IB_QP_LSO = IB_QP_CREATE_IPOIB_UD_LSO, 185 MLX4_IB_QP_LSO = IB_QP_CREATE_IPOIB_UD_LSO,
186 MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK = IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK, 186 MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK = IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK,
187 MLX4_IB_QP_NETIF = IB_QP_CREATE_NETIF_QP, 187 MLX4_IB_QP_NETIF = IB_QP_CREATE_NETIF_QP,
188 MLX4_IB_QP_CREATE_USE_GFP_NOIO = IB_QP_CREATE_USE_GFP_NOIO,
189 188
190 /* Mellanox specific flags start from IB_QP_CREATE_RESERVED_START */ 189 /* Mellanox specific flags start from IB_QP_CREATE_RESERVED_START */
191 MLX4_IB_ROCE_V2_GSI_QP = MLX4_IB_QP_CREATE_ROCE_V2_GSI, 190 MLX4_IB_ROCE_V2_GSI_QP = MLX4_IB_QP_CREATE_ROCE_V2_GSI,
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 996e9058e515..75c0e6c5dd56 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -634,8 +634,8 @@ static void mlx4_ib_free_qp_counter(struct mlx4_ib_dev *dev,
634 634
635static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, 635static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
636 struct ib_qp_init_attr *init_attr, 636 struct ib_qp_init_attr *init_attr,
637 struct ib_udata *udata, int sqpn, struct mlx4_ib_qp **caller_qp, 637 struct ib_udata *udata, int sqpn,
638 gfp_t gfp) 638 struct mlx4_ib_qp **caller_qp)
639{ 639{
640 int qpn; 640 int qpn;
641 int err; 641 int err;
@@ -691,14 +691,14 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
691 if (qp_type == MLX4_IB_QPT_SMI || qp_type == MLX4_IB_QPT_GSI || 691 if (qp_type == MLX4_IB_QPT_SMI || qp_type == MLX4_IB_QPT_GSI ||
692 (qp_type & (MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_SMI_OWNER | 692 (qp_type & (MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_SMI_OWNER |
693 MLX4_IB_QPT_PROXY_GSI | MLX4_IB_QPT_TUN_SMI_OWNER))) { 693 MLX4_IB_QPT_PROXY_GSI | MLX4_IB_QPT_TUN_SMI_OWNER))) {
694 sqp = kzalloc(sizeof (struct mlx4_ib_sqp), gfp); 694 sqp = kzalloc(sizeof(struct mlx4_ib_sqp), GFP_KERNEL);
695 if (!sqp) 695 if (!sqp)
696 return -ENOMEM; 696 return -ENOMEM;
697 qp = &sqp->qp; 697 qp = &sqp->qp;
698 qp->pri.vid = 0xFFFF; 698 qp->pri.vid = 0xFFFF;
699 qp->alt.vid = 0xFFFF; 699 qp->alt.vid = 0xFFFF;
700 } else { 700 } else {
701 qp = kzalloc(sizeof (struct mlx4_ib_qp), gfp); 701 qp = kzalloc(sizeof(struct mlx4_ib_qp), GFP_KERNEL);
702 if (!qp) 702 if (!qp)
703 return -ENOMEM; 703 return -ENOMEM;
704 qp->pri.vid = 0xFFFF; 704 qp->pri.vid = 0xFFFF;
@@ -780,7 +780,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
780 goto err; 780 goto err;
781 781
782 if (qp_has_rq(init_attr)) { 782 if (qp_has_rq(init_attr)) {
783 err = mlx4_db_alloc(dev->dev, &qp->db, 0, gfp); 783 err = mlx4_db_alloc(dev->dev, &qp->db, 0);
784 if (err) 784 if (err)
785 goto err; 785 goto err;
786 786
@@ -788,7 +788,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
788 } 788 }
789 789
790 if (mlx4_buf_alloc(dev->dev, qp->buf_size, qp->buf_size, 790 if (mlx4_buf_alloc(dev->dev, qp->buf_size, qp->buf_size,
791 &qp->buf, gfp)) { 791 &qp->buf)) {
792 memcpy(&init_attr->cap, &backup_cap, 792 memcpy(&init_attr->cap, &backup_cap,
793 sizeof(backup_cap)); 793 sizeof(backup_cap));
794 err = set_kernel_sq_size(dev, &init_attr->cap, qp_type, 794 err = set_kernel_sq_size(dev, &init_attr->cap, qp_type,
@@ -797,7 +797,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
797 goto err_db; 797 goto err_db;
798 798
799 if (mlx4_buf_alloc(dev->dev, qp->buf_size, 799 if (mlx4_buf_alloc(dev->dev, qp->buf_size,
800 PAGE_SIZE * 2, &qp->buf, gfp)) { 800 PAGE_SIZE * 2, &qp->buf)) {
801 err = -ENOMEM; 801 err = -ENOMEM;
802 goto err_db; 802 goto err_db;
803 } 803 }
@@ -808,20 +808,20 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
808 if (err) 808 if (err)
809 goto err_buf; 809 goto err_buf;
810 810
811 err = mlx4_buf_write_mtt(dev->dev, &qp->mtt, &qp->buf, gfp); 811 err = mlx4_buf_write_mtt(dev->dev, &qp->mtt, &qp->buf);
812 if (err) 812 if (err)
813 goto err_mtt; 813 goto err_mtt;
814 814
815 qp->sq.wrid = kmalloc_array(qp->sq.wqe_cnt, sizeof(u64), 815 qp->sq.wrid = kmalloc_array(qp->sq.wqe_cnt, sizeof(u64),
816 gfp | __GFP_NOWARN); 816 GFP_KERNEL | __GFP_NOWARN);
817 if (!qp->sq.wrid) 817 if (!qp->sq.wrid)
818 qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64), 818 qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64),
819 gfp, PAGE_KERNEL); 819 GFP_KERNEL, PAGE_KERNEL);
820 qp->rq.wrid = kmalloc_array(qp->rq.wqe_cnt, sizeof(u64), 820 qp->rq.wrid = kmalloc_array(qp->rq.wqe_cnt, sizeof(u64),
821 gfp | __GFP_NOWARN); 821 GFP_KERNEL | __GFP_NOWARN);
822 if (!qp->rq.wrid) 822 if (!qp->rq.wrid)
823 qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64), 823 qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64),
824 gfp, PAGE_KERNEL); 824 GFP_KERNEL, PAGE_KERNEL);
825 if (!qp->sq.wrid || !qp->rq.wrid) { 825 if (!qp->sq.wrid || !qp->rq.wrid) {
826 err = -ENOMEM; 826 err = -ENOMEM;
827 goto err_wrid; 827 goto err_wrid;
@@ -859,7 +859,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
859 if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) 859 if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK)
860 qp->flags |= MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK; 860 qp->flags |= MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK;
861 861
862 err = mlx4_qp_alloc(dev->dev, qpn, &qp->mqp, gfp); 862 err = mlx4_qp_alloc(dev->dev, qpn, &qp->mqp);
863 if (err) 863 if (err)
864 goto err_qpn; 864 goto err_qpn;
865 865
@@ -1127,10 +1127,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
1127 int err; 1127 int err;
1128 int sup_u_create_flags = MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK; 1128 int sup_u_create_flags = MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK;
1129 u16 xrcdn = 0; 1129 u16 xrcdn = 0;
1130 gfp_t gfp;
1131 1130
1132 gfp = (init_attr->create_flags & MLX4_IB_QP_CREATE_USE_GFP_NOIO) ?
1133 GFP_NOIO : GFP_KERNEL;
1134 /* 1131 /*
1135 * We only support LSO, vendor flag1, and multicast loopback blocking, 1132 * We only support LSO, vendor flag1, and multicast loopback blocking,
1136 * and only for kernel UD QPs. 1133 * and only for kernel UD QPs.
@@ -1140,8 +1137,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
1140 MLX4_IB_SRIOV_TUNNEL_QP | 1137 MLX4_IB_SRIOV_TUNNEL_QP |
1141 MLX4_IB_SRIOV_SQP | 1138 MLX4_IB_SRIOV_SQP |
1142 MLX4_IB_QP_NETIF | 1139 MLX4_IB_QP_NETIF |
1143 MLX4_IB_QP_CREATE_ROCE_V2_GSI | 1140 MLX4_IB_QP_CREATE_ROCE_V2_GSI))
1144 MLX4_IB_QP_CREATE_USE_GFP_NOIO))
1145 return ERR_PTR(-EINVAL); 1141 return ERR_PTR(-EINVAL);
1146 1142
1147 if (init_attr->create_flags & IB_QP_CREATE_NETIF_QP) { 1143 if (init_attr->create_flags & IB_QP_CREATE_NETIF_QP) {
@@ -1154,7 +1150,6 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
1154 return ERR_PTR(-EINVAL); 1150 return ERR_PTR(-EINVAL);
1155 1151
1156 if ((init_attr->create_flags & ~(MLX4_IB_SRIOV_SQP | 1152 if ((init_attr->create_flags & ~(MLX4_IB_SRIOV_SQP |
1157 MLX4_IB_QP_CREATE_USE_GFP_NOIO |
1158 MLX4_IB_QP_CREATE_ROCE_V2_GSI | 1153 MLX4_IB_QP_CREATE_ROCE_V2_GSI |
1159 MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK) && 1154 MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK) &&
1160 init_attr->qp_type != IB_QPT_UD) || 1155 init_attr->qp_type != IB_QPT_UD) ||
@@ -1179,7 +1174,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
1179 case IB_QPT_RC: 1174 case IB_QPT_RC:
1180 case IB_QPT_UC: 1175 case IB_QPT_UC:
1181 case IB_QPT_RAW_PACKET: 1176 case IB_QPT_RAW_PACKET:
1182 qp = kzalloc(sizeof *qp, gfp); 1177 qp = kzalloc(sizeof(*qp), GFP_KERNEL);
1183 if (!qp) 1178 if (!qp)
1184 return ERR_PTR(-ENOMEM); 1179 return ERR_PTR(-ENOMEM);
1185 qp->pri.vid = 0xFFFF; 1180 qp->pri.vid = 0xFFFF;
@@ -1188,7 +1183,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
1188 case IB_QPT_UD: 1183 case IB_QPT_UD:
1189 { 1184 {
1190 err = create_qp_common(to_mdev(pd->device), pd, init_attr, 1185 err = create_qp_common(to_mdev(pd->device), pd, init_attr,
1191 udata, 0, &qp, gfp); 1186 udata, 0, &qp);
1192 if (err) { 1187 if (err) {
1193 kfree(qp); 1188 kfree(qp);
1194 return ERR_PTR(err); 1189 return ERR_PTR(err);
@@ -1217,8 +1212,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd,
1217 } 1212 }
1218 1213
1219 err = create_qp_common(to_mdev(pd->device), pd, init_attr, udata, 1214 err = create_qp_common(to_mdev(pd->device), pd, init_attr, udata,
1220 sqpn, 1215 sqpn, &qp);
1221 &qp, gfp);
1222 if (err) 1216 if (err)
1223 return ERR_PTR(err); 1217 return ERR_PTR(err);
1224 1218
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index e32dd58937a8..0facaf5f6d23 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -135,14 +135,14 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
135 if (err) 135 if (err)
136 goto err_mtt; 136 goto err_mtt;
137 } else { 137 } else {
138 err = mlx4_db_alloc(dev->dev, &srq->db, 0, GFP_KERNEL); 138 err = mlx4_db_alloc(dev->dev, &srq->db, 0);
139 if (err) 139 if (err)
140 goto err_srq; 140 goto err_srq;
141 141
142 *srq->db.db = 0; 142 *srq->db.db = 0;
143 143
144 if (mlx4_buf_alloc(dev->dev, buf_size, PAGE_SIZE * 2, &srq->buf, 144 if (mlx4_buf_alloc(dev->dev, buf_size, PAGE_SIZE * 2,
145 GFP_KERNEL)) { 145 &srq->buf)) {
146 err = -ENOMEM; 146 err = -ENOMEM;
147 goto err_db; 147 goto err_db;
148 } 148 }
@@ -167,7 +167,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
167 if (err) 167 if (err)
168 goto err_buf; 168 goto err_buf;
169 169
170 err = mlx4_buf_write_mtt(dev->dev, &srq->mtt, &srq->buf, GFP_KERNEL); 170 err = mlx4_buf_write_mtt(dev->dev, &srq->mtt, &srq->buf);
171 if (err) 171 if (err)
172 goto err_mtt; 172 goto err_mtt;
173 173
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 763bb5b36144..2c40a2e989d2 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -582,6 +582,15 @@ static void clean_keys(struct mlx5_ib_dev *dev, int c)
582 } 582 }
583} 583}
584 584
585static void mlx5_mr_cache_debugfs_cleanup(struct mlx5_ib_dev *dev)
586{
587 if (!mlx5_debugfs_root)
588 return;
589
590 debugfs_remove_recursive(dev->cache.root);
591 dev->cache.root = NULL;
592}
593
585static int mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev) 594static int mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev)
586{ 595{
587 struct mlx5_mr_cache *cache = &dev->cache; 596 struct mlx5_mr_cache *cache = &dev->cache;
@@ -600,38 +609,34 @@ static int mlx5_mr_cache_debugfs_init(struct mlx5_ib_dev *dev)
600 sprintf(ent->name, "%d", ent->order); 609 sprintf(ent->name, "%d", ent->order);
601 ent->dir = debugfs_create_dir(ent->name, cache->root); 610 ent->dir = debugfs_create_dir(ent->name, cache->root);
602 if (!ent->dir) 611 if (!ent->dir)
603 return -ENOMEM; 612 goto err;
604 613
605 ent->fsize = debugfs_create_file("size", 0600, ent->dir, ent, 614 ent->fsize = debugfs_create_file("size", 0600, ent->dir, ent,
606 &size_fops); 615 &size_fops);
607 if (!ent->fsize) 616 if (!ent->fsize)
608 return -ENOMEM; 617 goto err;
609 618
610 ent->flimit = debugfs_create_file("limit", 0600, ent->dir, ent, 619 ent->flimit = debugfs_create_file("limit", 0600, ent->dir, ent,
611 &limit_fops); 620 &limit_fops);
612 if (!ent->flimit) 621 if (!ent->flimit)
613 return -ENOMEM; 622 goto err;
614 623
615 ent->fcur = debugfs_create_u32("cur", 0400, ent->dir, 624 ent->fcur = debugfs_create_u32("cur", 0400, ent->dir,
616 &ent->cur); 625 &ent->cur);
617 if (!ent->fcur) 626 if (!ent->fcur)
618 return -ENOMEM; 627 goto err;
619 628
620 ent->fmiss = debugfs_create_u32("miss", 0600, ent->dir, 629 ent->fmiss = debugfs_create_u32("miss", 0600, ent->dir,
621 &ent->miss); 630 &ent->miss);
622 if (!ent->fmiss) 631 if (!ent->fmiss)
623 return -ENOMEM; 632 goto err;
624 } 633 }
625 634
626 return 0; 635 return 0;
627} 636err:
628 637 mlx5_mr_cache_debugfs_cleanup(dev);
629static void mlx5_mr_cache_debugfs_cleanup(struct mlx5_ib_dev *dev)
630{
631 if (!mlx5_debugfs_root)
632 return;
633 638
634 debugfs_remove_recursive(dev->cache.root); 639 return -ENOMEM;
635} 640}
636 641
637static void delay_time_func(unsigned long ctx) 642static void delay_time_func(unsigned long ctx)
@@ -692,6 +697,11 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev)
692 if (err) 697 if (err)
693 mlx5_ib_warn(dev, "cache debugfs failure\n"); 698 mlx5_ib_warn(dev, "cache debugfs failure\n");
694 699
700 /*
701 * We don't want to fail driver if debugfs failed to initialize,
702 * so we are not forwarding error to the user.
703 */
704
695 return 0; 705 return 0;
696} 706}
697 707
@@ -825,7 +835,7 @@ static int mr_umem_get(struct ib_pd *pd, u64 start, u64 length,
825 access_flags, 0); 835 access_flags, 0);
826 err = PTR_ERR_OR_ZERO(*umem); 836 err = PTR_ERR_OR_ZERO(*umem);
827 if (err < 0) { 837 if (err < 0) {
828 mlx5_ib_err(dev, "umem get failed (%ld)\n", PTR_ERR(umem)); 838 mlx5_ib_err(dev, "umem get failed (%d)\n", err);
829 return err; 839 return err;
830 } 840 }
831 841
@@ -1779,7 +1789,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr,
1779 mr->ndescs = sg_nents; 1789 mr->ndescs = sg_nents;
1780 1790
1781 for_each_sg(sgl, sg, sg_nents, i) { 1791 for_each_sg(sgl, sg, sg_nents, i) {
1782 if (unlikely(i > mr->max_descs)) 1792 if (unlikely(i >= mr->max_descs))
1783 break; 1793 break;
1784 klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset); 1794 klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset);
1785 klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset); 1795 klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset);
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 8f9d8b4ad583..b0adf65e4bdb 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -551,7 +551,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {
551 if ((0x0F000100 == (pcs_control_status0 & 0x0F000100)) 551 if ((0x0F000100 == (pcs_control_status0 & 0x0F000100))
552 || (0x0F000100 == (pcs_control_status1 & 0x0F000100))) 552 || (0x0F000100 == (pcs_control_status1 & 0x0F000100)))
553 int_cnt++; 553 int_cnt++;
554 msleep(1); 554 usleep_range(1000, 2000);
555 } 555 }
556 if (int_cnt > 1) { 556 if (int_cnt > 1) {
557 spin_lock_irqsave(&nesadapter->phy_lock, flags); 557 spin_lock_irqsave(&nesadapter->phy_lock, flags);
@@ -592,7 +592,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {
592 break; 592 break;
593 } 593 }
594 } 594 }
595 msleep(1); 595 usleep_range(1000, 2000);
596 } 596 }
597 } 597 }
598 } 598 }
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 2f30bda8457a..27d5e8d9f08d 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -744,7 +744,8 @@ err:
744 if (is_uctx_pd) { 744 if (is_uctx_pd) {
745 ocrdma_release_ucontext_pd(uctx); 745 ocrdma_release_ucontext_pd(uctx);
746 } else { 746 } else {
747 status = _ocrdma_dealloc_pd(dev, pd); 747 if (_ocrdma_dealloc_pd(dev, pd))
748 pr_err("%s: _ocrdma_dealloc_pd() failed\n", __func__);
748 } 749 }
749exit: 750exit:
750 return ERR_PTR(status); 751 return ERR_PTR(status);
@@ -1901,6 +1902,7 @@ struct ib_srq *ocrdma_create_srq(struct ib_pd *ibpd,
1901 goto err; 1902 goto err;
1902 1903
1903 if (udata == NULL) { 1904 if (udata == NULL) {
1905 status = -ENOMEM;
1904 srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt, 1906 srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt,
1905 GFP_KERNEL); 1907 GFP_KERNEL);
1906 if (srq->rqe_wr_id_tbl == NULL) 1908 if (srq->rqe_wr_id_tbl == NULL)
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 548e4d1e998f..2ae71b8f1ba8 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -53,6 +53,14 @@
53 53
54#define DB_ADDR_SHIFT(addr) ((addr) << DB_PWM_ADDR_OFFSET_SHIFT) 54#define DB_ADDR_SHIFT(addr) ((addr) << DB_PWM_ADDR_OFFSET_SHIFT)
55 55
56static inline int qedr_ib_copy_to_udata(struct ib_udata *udata, void *src,
57 size_t len)
58{
59 size_t min_len = min_t(size_t, len, udata->outlen);
60
61 return ib_copy_to_udata(udata, src, min_len);
62}
63
56int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey) 64int qedr_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
57{ 65{
58 if (index > QEDR_ROCE_PKEY_TABLE_LEN) 66 if (index > QEDR_ROCE_PKEY_TABLE_LEN)
@@ -378,7 +386,7 @@ struct ib_ucontext *qedr_alloc_ucontext(struct ib_device *ibdev,
378 uresp.sges_per_srq_wr = dev->attr.max_srq_sge; 386 uresp.sges_per_srq_wr = dev->attr.max_srq_sge;
379 uresp.max_cqes = QEDR_MAX_CQES; 387 uresp.max_cqes = QEDR_MAX_CQES;
380 388
381 rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 389 rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp));
382 if (rc) 390 if (rc)
383 goto err; 391 goto err;
384 392
@@ -499,7 +507,7 @@ struct ib_pd *qedr_alloc_pd(struct ib_device *ibdev,
499 507
500 uresp.pd_id = pd_id; 508 uresp.pd_id = pd_id;
501 509
502 rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 510 rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp));
503 if (rc) { 511 if (rc) {
504 DP_ERR(dev, "copy error pd_id=0x%x.\n", pd_id); 512 DP_ERR(dev, "copy error pd_id=0x%x.\n", pd_id);
505 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd_id); 513 dev->ops->rdma_dealloc_pd(dev->rdma_ctx, pd_id);
@@ -729,7 +737,7 @@ static int qedr_copy_cq_uresp(struct qedr_dev *dev,
729 uresp.db_offset = DB_ADDR_SHIFT(DQ_PWM_OFFSET_UCM_RDMA_CQ_CONS_32BIT); 737 uresp.db_offset = DB_ADDR_SHIFT(DQ_PWM_OFFSET_UCM_RDMA_CQ_CONS_32BIT);
730 uresp.icid = cq->icid; 738 uresp.icid = cq->icid;
731 739
732 rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 740 rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp));
733 if (rc) 741 if (rc)
734 DP_ERR(dev, "copy error cqid=0x%x.\n", cq->icid); 742 DP_ERR(dev, "copy error cqid=0x%x.\n", cq->icid);
735 743
@@ -1238,7 +1246,7 @@ static int qedr_copy_qp_uresp(struct qedr_dev *dev,
1238 uresp.atomic_supported = dev->atomic_cap != IB_ATOMIC_NONE; 1246 uresp.atomic_supported = dev->atomic_cap != IB_ATOMIC_NONE;
1239 uresp.qp_id = qp->qp_id; 1247 uresp.qp_id = qp->qp_id;
1240 1248
1241 rc = ib_copy_to_udata(udata, &uresp, sizeof(uresp)); 1249 rc = qedr_ib_copy_to_udata(udata, &uresp, sizeof(uresp));
1242 if (rc) 1250 if (rc)
1243 DP_ERR(dev, 1251 DP_ERR(dev,
1244 "create qp: failed a copy to user space with qp icid=0x%x.\n", 1252 "create qp: failed a copy to user space with qp icid=0x%x.\n",
diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c
index 5984981e7dd4..a343e3b5d4cb 100644
--- a/drivers/infiniband/hw/qib/qib_qp.c
+++ b/drivers/infiniband/hw/qib/qib_qp.c
@@ -104,10 +104,9 @@ const struct rvt_operation_params qib_post_parms[RVT_OPERATION_MAX] = {
104 104
105}; 105};
106 106
107static void get_map_page(struct rvt_qpn_table *qpt, struct rvt_qpn_map *map, 107static void get_map_page(struct rvt_qpn_table *qpt, struct rvt_qpn_map *map)
108 gfp_t gfp)
109{ 108{
110 unsigned long page = get_zeroed_page(gfp); 109 unsigned long page = get_zeroed_page(GFP_KERNEL);
111 110
112 /* 111 /*
113 * Free the page if someone raced with us installing it. 112 * Free the page if someone raced with us installing it.
@@ -126,7 +125,7 @@ static void get_map_page(struct rvt_qpn_table *qpt, struct rvt_qpn_map *map,
126 * zero/one for QP type IB_QPT_SMI/IB_QPT_GSI. 125 * zero/one for QP type IB_QPT_SMI/IB_QPT_GSI.
127 */ 126 */
128int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 127int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
129 enum ib_qp_type type, u8 port, gfp_t gfp) 128 enum ib_qp_type type, u8 port)
130{ 129{
131 u32 i, offset, max_scan, qpn; 130 u32 i, offset, max_scan, qpn;
132 struct rvt_qpn_map *map; 131 struct rvt_qpn_map *map;
@@ -160,7 +159,7 @@ int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
160 max_scan = qpt->nmaps - !offset; 159 max_scan = qpt->nmaps - !offset;
161 for (i = 0;;) { 160 for (i = 0;;) {
162 if (unlikely(!map->page)) { 161 if (unlikely(!map->page)) {
163 get_map_page(qpt, map, gfp); 162 get_map_page(qpt, map);
164 if (unlikely(!map->page)) 163 if (unlikely(!map->page))
165 break; 164 break;
166 } 165 }
@@ -317,16 +316,16 @@ u32 qib_mtu_from_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp, u32 pmtu)
317 return ib_mtu_enum_to_int(pmtu); 316 return ib_mtu_enum_to_int(pmtu);
318} 317}
319 318
320void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, gfp_t gfp) 319void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp)
321{ 320{
322 struct qib_qp_priv *priv; 321 struct qib_qp_priv *priv;
323 322
324 priv = kzalloc(sizeof(*priv), gfp); 323 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
325 if (!priv) 324 if (!priv)
326 return ERR_PTR(-ENOMEM); 325 return ERR_PTR(-ENOMEM);
327 priv->owner = qp; 326 priv->owner = qp;
328 327
329 priv->s_hdr = kzalloc(sizeof(*priv->s_hdr), gfp); 328 priv->s_hdr = kzalloc(sizeof(*priv->s_hdr), GFP_KERNEL);
330 if (!priv->s_hdr) { 329 if (!priv->s_hdr) {
331 kfree(priv); 330 kfree(priv);
332 return ERR_PTR(-ENOMEM); 331 return ERR_PTR(-ENOMEM);
diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h
index da0db5485ddc..a52fc67b40d7 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -274,11 +274,11 @@ int qib_get_counters(struct qib_pportdata *ppd,
274 * Functions provided by qib driver for rdmavt to use 274 * Functions provided by qib driver for rdmavt to use
275 */ 275 */
276unsigned qib_free_all_qps(struct rvt_dev_info *rdi); 276unsigned qib_free_all_qps(struct rvt_dev_info *rdi);
277void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp, gfp_t gfp); 277void *qib_qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp);
278void qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp); 278void qib_qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp);
279void qib_notify_qp_reset(struct rvt_qp *qp); 279void qib_notify_qp_reset(struct rvt_qp *qp);
280int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 280int qib_alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
281 enum ib_qp_type type, u8 port, gfp_t gfp); 281 enum ib_qp_type type, u8 port);
282void qib_restart_rc(struct rvt_qp *qp, u32 psn, int wait); 282void qib_restart_rc(struct rvt_qp *qp, u32 psn, int wait);
283#ifdef CONFIG_DEBUG_FS 283#ifdef CONFIG_DEBUG_FS
284 284
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 727e81cc2c8f..8876ee7bc326 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -118,10 +118,9 @@ const int ib_rvt_state_ops[IB_QPS_ERR + 1] = {
118EXPORT_SYMBOL(ib_rvt_state_ops); 118EXPORT_SYMBOL(ib_rvt_state_ops);
119 119
120static void get_map_page(struct rvt_qpn_table *qpt, 120static void get_map_page(struct rvt_qpn_table *qpt,
121 struct rvt_qpn_map *map, 121 struct rvt_qpn_map *map)
122 gfp_t gfp)
123{ 122{
124 unsigned long page = get_zeroed_page(gfp); 123 unsigned long page = get_zeroed_page(GFP_KERNEL);
125 124
126 /* 125 /*
127 * Free the page if someone raced with us installing it. 126 * Free the page if someone raced with us installing it.
@@ -173,7 +172,7 @@ static int init_qpn_table(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt)
173 rdi->dparms.qpn_res_start, rdi->dparms.qpn_res_end); 172 rdi->dparms.qpn_res_start, rdi->dparms.qpn_res_end);
174 for (i = rdi->dparms.qpn_res_start; i <= rdi->dparms.qpn_res_end; i++) { 173 for (i = rdi->dparms.qpn_res_start; i <= rdi->dparms.qpn_res_end; i++) {
175 if (!map->page) { 174 if (!map->page) {
176 get_map_page(qpt, map, GFP_KERNEL); 175 get_map_page(qpt, map);
177 if (!map->page) { 176 if (!map->page) {
178 ret = -ENOMEM; 177 ret = -ENOMEM;
179 break; 178 break;
@@ -342,14 +341,14 @@ static inline unsigned mk_qpn(struct rvt_qpn_table *qpt,
342 * Return: The queue pair number 341 * Return: The queue pair number
343 */ 342 */
344static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 343static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
345 enum ib_qp_type type, u8 port_num, gfp_t gfp) 344 enum ib_qp_type type, u8 port_num)
346{ 345{
347 u32 i, offset, max_scan, qpn; 346 u32 i, offset, max_scan, qpn;
348 struct rvt_qpn_map *map; 347 struct rvt_qpn_map *map;
349 u32 ret; 348 u32 ret;
350 349
351 if (rdi->driver_f.alloc_qpn) 350 if (rdi->driver_f.alloc_qpn)
352 return rdi->driver_f.alloc_qpn(rdi, qpt, type, port_num, gfp); 351 return rdi->driver_f.alloc_qpn(rdi, qpt, type, port_num);
353 352
354 if (type == IB_QPT_SMI || type == IB_QPT_GSI) { 353 if (type == IB_QPT_SMI || type == IB_QPT_GSI) {
355 unsigned n; 354 unsigned n;
@@ -374,7 +373,7 @@ static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
374 max_scan = qpt->nmaps - !offset; 373 max_scan = qpt->nmaps - !offset;
375 for (i = 0;;) { 374 for (i = 0;;) {
376 if (unlikely(!map->page)) { 375 if (unlikely(!map->page)) {
377 get_map_page(qpt, map, gfp); 376 get_map_page(qpt, map);
378 if (unlikely(!map->page)) 377 if (unlikely(!map->page))
379 break; 378 break;
380 } 379 }
@@ -672,7 +671,6 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
672 struct ib_qp *ret = ERR_PTR(-ENOMEM); 671 struct ib_qp *ret = ERR_PTR(-ENOMEM);
673 struct rvt_dev_info *rdi = ib_to_rvt(ibpd->device); 672 struct rvt_dev_info *rdi = ib_to_rvt(ibpd->device);
674 void *priv = NULL; 673 void *priv = NULL;
675 gfp_t gfp;
676 size_t sqsize; 674 size_t sqsize;
677 675
678 if (!rdi) 676 if (!rdi)
@@ -680,18 +678,9 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
680 678
681 if (init_attr->cap.max_send_sge > rdi->dparms.props.max_sge || 679 if (init_attr->cap.max_send_sge > rdi->dparms.props.max_sge ||
682 init_attr->cap.max_send_wr > rdi->dparms.props.max_qp_wr || 680 init_attr->cap.max_send_wr > rdi->dparms.props.max_qp_wr ||
683 init_attr->create_flags & ~(IB_QP_CREATE_USE_GFP_NOIO)) 681 init_attr->create_flags)
684 return ERR_PTR(-EINVAL); 682 return ERR_PTR(-EINVAL);
685 683
686 /* GFP_NOIO is applicable to RC QP's only */
687
688 if (init_attr->create_flags & IB_QP_CREATE_USE_GFP_NOIO &&
689 init_attr->qp_type != IB_QPT_RC)
690 return ERR_PTR(-EINVAL);
691
692 gfp = init_attr->create_flags & IB_QP_CREATE_USE_GFP_NOIO ?
693 GFP_NOIO : GFP_KERNEL;
694
695 /* Check receive queue parameters if no SRQ is specified. */ 684 /* Check receive queue parameters if no SRQ is specified. */
696 if (!init_attr->srq) { 685 if (!init_attr->srq) {
697 if (init_attr->cap.max_recv_sge > rdi->dparms.props.max_sge || 686 if (init_attr->cap.max_recv_sge > rdi->dparms.props.max_sge ||
@@ -719,14 +708,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
719 sz = sizeof(struct rvt_sge) * 708 sz = sizeof(struct rvt_sge) *
720 init_attr->cap.max_send_sge + 709 init_attr->cap.max_send_sge +
721 sizeof(struct rvt_swqe); 710 sizeof(struct rvt_swqe);
722 if (gfp == GFP_NOIO) 711 swq = vzalloc_node(sqsize * sz, rdi->dparms.node);
723 swq = __vmalloc(
724 sqsize * sz,
725 gfp | __GFP_ZERO, PAGE_KERNEL);
726 else
727 swq = vzalloc_node(
728 sqsize * sz,
729 rdi->dparms.node);
730 if (!swq) 712 if (!swq)
731 return ERR_PTR(-ENOMEM); 713 return ERR_PTR(-ENOMEM);
732 714
@@ -741,7 +723,8 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
741 } else if (init_attr->cap.max_recv_sge > 1) 723 } else if (init_attr->cap.max_recv_sge > 1)
742 sg_list_sz = sizeof(*qp->r_sg_list) * 724 sg_list_sz = sizeof(*qp->r_sg_list) *
743 (init_attr->cap.max_recv_sge - 1); 725 (init_attr->cap.max_recv_sge - 1);
744 qp = kzalloc_node(sz + sg_list_sz, gfp, rdi->dparms.node); 726 qp = kzalloc_node(sz + sg_list_sz, GFP_KERNEL,
727 rdi->dparms.node);
745 if (!qp) 728 if (!qp)
746 goto bail_swq; 729 goto bail_swq;
747 730
@@ -751,7 +734,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
751 kzalloc_node( 734 kzalloc_node(
752 sizeof(*qp->s_ack_queue) * 735 sizeof(*qp->s_ack_queue) *
753 rvt_max_atomic(rdi), 736 rvt_max_atomic(rdi),
754 gfp, 737 GFP_KERNEL,
755 rdi->dparms.node); 738 rdi->dparms.node);
756 if (!qp->s_ack_queue) 739 if (!qp->s_ack_queue)
757 goto bail_qp; 740 goto bail_qp;
@@ -766,7 +749,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
766 * Driver needs to set up it's private QP structure and do any 749 * Driver needs to set up it's private QP structure and do any
767 * initialization that is needed. 750 * initialization that is needed.
768 */ 751 */
769 priv = rdi->driver_f.qp_priv_alloc(rdi, qp, gfp); 752 priv = rdi->driver_f.qp_priv_alloc(rdi, qp);
770 if (IS_ERR(priv)) { 753 if (IS_ERR(priv)) {
771 ret = priv; 754 ret = priv;
772 goto bail_qp; 755 goto bail_qp;
@@ -786,11 +769,6 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
786 qp->r_rq.wq = vmalloc_user( 769 qp->r_rq.wq = vmalloc_user(
787 sizeof(struct rvt_rwq) + 770 sizeof(struct rvt_rwq) +
788 qp->r_rq.size * sz); 771 qp->r_rq.size * sz);
789 else if (gfp == GFP_NOIO)
790 qp->r_rq.wq = __vmalloc(
791 sizeof(struct rvt_rwq) +
792 qp->r_rq.size * sz,
793 gfp | __GFP_ZERO, PAGE_KERNEL);
794 else 772 else
795 qp->r_rq.wq = vzalloc_node( 773 qp->r_rq.wq = vzalloc_node(
796 sizeof(struct rvt_rwq) + 774 sizeof(struct rvt_rwq) +
@@ -824,7 +802,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
824 802
825 err = alloc_qpn(rdi, &rdi->qp_dev->qpn_table, 803 err = alloc_qpn(rdi, &rdi->qp_dev->qpn_table,
826 init_attr->qp_type, 804 init_attr->qp_type,
827 init_attr->port_num, gfp); 805 init_attr->port_num);
828 if (err < 0) { 806 if (err < 0) {
829 ret = ERR_PTR(err); 807 ret = ERR_PTR(err);
830 goto bail_rq_wq; 808 goto bail_rq_wq;
@@ -1280,9 +1258,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
1280 1258
1281 if (attr_mask & IB_QP_TIMEOUT) { 1259 if (attr_mask & IB_QP_TIMEOUT) {
1282 qp->timeout = attr->timeout; 1260 qp->timeout = attr->timeout;
1283 qp->timeout_jiffies = 1261 qp->timeout_jiffies = rvt_timeout_to_jiffies(qp->timeout);
1284 usecs_to_jiffies((4096UL * (1UL << qp->timeout)) /
1285 1000UL);
1286 } 1262 }
1287 1263
1288 if (attr_mask & IB_QP_QKEY) 1264 if (attr_mask & IB_QP_QKEY)
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
index c3a140ed4df2..08f3f90d2912 100644
--- a/drivers/infiniband/sw/rxe/rxe_net.c
+++ b/drivers/infiniband/sw/rxe/rxe_net.c
@@ -441,6 +441,8 @@ static void rxe_skb_tx_dtor(struct sk_buff *skb)
441 if (unlikely(qp->need_req_skb && 441 if (unlikely(qp->need_req_skb &&
442 skb_out < RXE_INFLIGHT_SKBS_PER_QP_LOW)) 442 skb_out < RXE_INFLIGHT_SKBS_PER_QP_LOW))
443 rxe_run_task(&qp->req.task, 1); 443 rxe_run_task(&qp->req.task, 1);
444
445 rxe_drop_ref(qp);
444} 446}
445 447
446int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct sk_buff *skb) 448int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct sk_buff *skb)
@@ -473,6 +475,7 @@ int rxe_send(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, struct sk_buff *skb)
473 return -EAGAIN; 475 return -EAGAIN;
474 } 476 }
475 477
478 rxe_add_ref(pkt->qp);
476 atomic_inc(&pkt->qp->skb_out); 479 atomic_inc(&pkt->qp->skb_out);
477 kfree_skb(skb); 480 kfree_skb(skb);
478 481
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index be944d5aa9af..a958ee918a49 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -1219,6 +1219,9 @@ void rxe_drain_req_pkts(struct rxe_qp *qp, bool notify)
1219 kfree_skb(skb); 1219 kfree_skb(skb);
1220 } 1220 }
1221 1221
1222 if (notify)
1223 return;
1224
1222 while (!qp->srq && qp->rq.queue && queue_head(qp->rq.queue)) 1225 while (!qp->srq && qp->rq.queue && queue_head(qp->rq.queue))
1223 advance_consumer(qp->rq.queue); 1226 advance_consumer(qp->rq.queue);
1224} 1227}
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 073e66783f1d..af90a7d42b96 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -914,6 +914,9 @@ static int rxe_post_recv(struct ib_qp *ibqp, struct ib_recv_wr *wr,
914 914
915 spin_unlock_irqrestore(&rq->producer_lock, flags); 915 spin_unlock_irqrestore(&rq->producer_lock, flags);
916 916
917 if (qp->resp.state == QP_STATE_ERROR)
918 rxe_run_task(&qp->resp.task, 1);
919
917err1: 920err1:
918 return err; 921 return err;
919} 922}
@@ -1240,6 +1243,8 @@ int rxe_register_device(struct rxe_dev *rxe)
1240 addrconf_addr_eui48((unsigned char *)&dev->node_guid, 1243 addrconf_addr_eui48((unsigned char *)&dev->node_guid,
1241 rxe->ndev->dev_addr); 1244 rxe->ndev->dev_addr);
1242 dev->dev.dma_ops = &dma_virt_ops; 1245 dev->dev.dma_ops = &dma_virt_ops;
1246 dma_coerce_mask_and_coherent(&dev->dev,
1247 dma_get_required_mask(dev->dev.parent));
1243 1248
1244 dev->uverbs_abi_ver = RXE_UVERBS_ABI_VERSION; 1249 dev->uverbs_abi_ver = RXE_UVERBS_ABI_VERSION;
1245 dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT) 1250 dev->uverbs_cmd_mask = BIT_ULL(IB_USER_VERBS_CMD_GET_CONTEXT)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 7cbcfdac6529..f87d104837dc 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -39,6 +39,7 @@
39#include <linux/vmalloc.h> 39#include <linux/vmalloc.h>
40#include <linux/moduleparam.h> 40#include <linux/moduleparam.h>
41#include <linux/sched/signal.h> 41#include <linux/sched/signal.h>
42#include <linux/sched/mm.h>
42 43
43#include "ipoib.h" 44#include "ipoib.h"
44 45
@@ -954,7 +955,7 @@ void ipoib_cm_dev_stop(struct net_device *dev)
954 break; 955 break;
955 } 956 }
956 spin_unlock_irq(&priv->lock); 957 spin_unlock_irq(&priv->lock);
957 msleep(1); 958 usleep_range(1000, 2000);
958 ipoib_drain_cq(dev); 959 ipoib_drain_cq(dev);
959 spin_lock_irq(&priv->lock); 960 spin_lock_irq(&priv->lock);
960 } 961 }
@@ -1047,9 +1048,8 @@ static struct ib_qp *ipoib_cm_create_tx_qp(struct net_device *dev, struct ipoib_
1047 .sq_sig_type = IB_SIGNAL_ALL_WR, 1048 .sq_sig_type = IB_SIGNAL_ALL_WR,
1048 .qp_type = IB_QPT_RC, 1049 .qp_type = IB_QPT_RC,
1049 .qp_context = tx, 1050 .qp_context = tx,
1050 .create_flags = IB_QP_CREATE_USE_GFP_NOIO 1051 .create_flags = 0
1051 }; 1052 };
1052
1053 struct ib_qp *tx_qp; 1053 struct ib_qp *tx_qp;
1054 1054
1055 if (dev->features & NETIF_F_SG) 1055 if (dev->features & NETIF_F_SG)
@@ -1057,10 +1057,6 @@ static struct ib_qp *ipoib_cm_create_tx_qp(struct net_device *dev, struct ipoib_
1057 min_t(u32, priv->ca->attrs.max_sge, MAX_SKB_FRAGS + 1); 1057 min_t(u32, priv->ca->attrs.max_sge, MAX_SKB_FRAGS + 1);
1058 1058
1059 tx_qp = ib_create_qp(priv->pd, &attr); 1059 tx_qp = ib_create_qp(priv->pd, &attr);
1060 if (PTR_ERR(tx_qp) == -EINVAL) {
1061 attr.create_flags &= ~IB_QP_CREATE_USE_GFP_NOIO;
1062 tx_qp = ib_create_qp(priv->pd, &attr);
1063 }
1064 tx->max_send_sge = attr.cap.max_send_sge; 1060 tx->max_send_sge = attr.cap.max_send_sge;
1065 return tx_qp; 1061 return tx_qp;
1066} 1062}
@@ -1131,10 +1127,11 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
1131 struct sa_path_rec *pathrec) 1127 struct sa_path_rec *pathrec)
1132{ 1128{
1133 struct ipoib_dev_priv *priv = ipoib_priv(p->dev); 1129 struct ipoib_dev_priv *priv = ipoib_priv(p->dev);
1130 unsigned int noio_flag;
1134 int ret; 1131 int ret;
1135 1132
1136 p->tx_ring = __vmalloc(ipoib_sendq_size * sizeof *p->tx_ring, 1133 noio_flag = memalloc_noio_save();
1137 GFP_NOIO, PAGE_KERNEL); 1134 p->tx_ring = vzalloc(ipoib_sendq_size * sizeof(*p->tx_ring));
1138 if (!p->tx_ring) { 1135 if (!p->tx_ring) {
1139 ret = -ENOMEM; 1136 ret = -ENOMEM;
1140 goto err_tx; 1137 goto err_tx;
@@ -1142,9 +1139,10 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn,
1142 memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring); 1139 memset(p->tx_ring, 0, ipoib_sendq_size * sizeof *p->tx_ring);
1143 1140
1144 p->qp = ipoib_cm_create_tx_qp(p->dev, p); 1141 p->qp = ipoib_cm_create_tx_qp(p->dev, p);
1142 memalloc_noio_restore(noio_flag);
1145 if (IS_ERR(p->qp)) { 1143 if (IS_ERR(p->qp)) {
1146 ret = PTR_ERR(p->qp); 1144 ret = PTR_ERR(p->qp);
1147 ipoib_warn(priv, "failed to allocate tx qp: %d\n", ret); 1145 ipoib_warn(priv, "failed to create tx qp: %d\n", ret);
1148 goto err_qp; 1146 goto err_qp;
1149 } 1147 }
1150 1148
@@ -1206,7 +1204,7 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
1206 goto timeout; 1204 goto timeout;
1207 } 1205 }
1208 1206
1209 msleep(1); 1207 usleep_range(1000, 2000);
1210 } 1208 }
1211 } 1209 }
1212 1210
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index efe7402f4885..57a9655e844d 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -770,7 +770,7 @@ int ipoib_ib_dev_stop_default(struct net_device *dev)
770 770
771 ipoib_drain_cq(dev); 771 ipoib_drain_cq(dev);
772 772
773 msleep(1); 773 usleep_range(1000, 2000);
774 } 774 }
775 775
776 ipoib_dbg(priv, "All sends and receives done.\n"); 776 ipoib_dbg(priv, "All sends and receives done.\n");
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 6e86eeee370e..4ce315c92b48 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -233,6 +233,7 @@ static netdev_features_t ipoib_fix_features(struct net_device *dev, netdev_featu
233static int ipoib_change_mtu(struct net_device *dev, int new_mtu) 233static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
234{ 234{
235 struct ipoib_dev_priv *priv = ipoib_priv(dev); 235 struct ipoib_dev_priv *priv = ipoib_priv(dev);
236 int ret = 0;
236 237
237 /* dev->mtu > 2K ==> connected mode */ 238 /* dev->mtu > 2K ==> connected mode */
238 if (ipoib_cm_admin_enabled(dev)) { 239 if (ipoib_cm_admin_enabled(dev)) {
@@ -256,9 +257,34 @@ static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
256 ipoib_dbg(priv, "MTU must be smaller than the underlying " 257 ipoib_dbg(priv, "MTU must be smaller than the underlying "
257 "link layer MTU - 4 (%u)\n", priv->mcast_mtu); 258 "link layer MTU - 4 (%u)\n", priv->mcast_mtu);
258 259
259 dev->mtu = min(priv->mcast_mtu, priv->admin_mtu); 260 new_mtu = min(priv->mcast_mtu, priv->admin_mtu);
260 261
261 return 0; 262 if (priv->rn_ops->ndo_change_mtu) {
263 bool carrier_status = netif_carrier_ok(dev);
264
265 netif_carrier_off(dev);
266
267 /* notify lower level on the real mtu */
268 ret = priv->rn_ops->ndo_change_mtu(dev, new_mtu);
269
270 if (carrier_status)
271 netif_carrier_on(dev);
272 } else {
273 dev->mtu = new_mtu;
274 }
275
276 return ret;
277}
278
279static void ipoib_get_stats(struct net_device *dev,
280 struct rtnl_link_stats64 *stats)
281{
282 struct ipoib_dev_priv *priv = ipoib_priv(dev);
283
284 if (priv->rn_ops->ndo_get_stats64)
285 priv->rn_ops->ndo_get_stats64(dev, stats);
286 else
287 netdev_stats_to_stats64(stats, &dev->stats);
262} 288}
263 289
264/* Called with an RCU read lock taken */ 290/* Called with an RCU read lock taken */
@@ -1808,6 +1834,7 @@ static const struct net_device_ops ipoib_netdev_ops_pf = {
1808 .ndo_get_vf_stats = ipoib_get_vf_stats, 1834 .ndo_get_vf_stats = ipoib_get_vf_stats,
1809 .ndo_set_vf_guid = ipoib_set_vf_guid, 1835 .ndo_set_vf_guid = ipoib_set_vf_guid,
1810 .ndo_set_mac_address = ipoib_set_mac, 1836 .ndo_set_mac_address = ipoib_set_mac,
1837 .ndo_get_stats64 = ipoib_get_stats,
1811}; 1838};
1812 1839
1813static const struct net_device_ops ipoib_netdev_ops_vf = { 1840static const struct net_device_ops ipoib_netdev_ops_vf = {
@@ -2212,6 +2239,7 @@ static struct net_device *ipoib_add_port(const char *format,
2212 goto register_failed; 2239 goto register_failed;
2213 } 2240 }
2214 2241
2242 result = -ENOMEM;
2215 if (ipoib_cm_add_mode_attr(priv->dev)) 2243 if (ipoib_cm_add_mode_attr(priv->dev))
2216 goto sysfs_failed; 2244 goto sysfs_failed;
2217 if (ipoib_add_pkey_attr(priv->dev)) 2245 if (ipoib_add_pkey_attr(priv->dev))
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 5a887efb4bdf..37b33d708c2d 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -83,6 +83,7 @@ static struct scsi_host_template iscsi_iser_sht;
83static struct iscsi_transport iscsi_iser_transport; 83static struct iscsi_transport iscsi_iser_transport;
84static struct scsi_transport_template *iscsi_iser_scsi_transport; 84static struct scsi_transport_template *iscsi_iser_scsi_transport;
85static struct workqueue_struct *release_wq; 85static struct workqueue_struct *release_wq;
86static DEFINE_MUTEX(unbind_iser_conn_mutex);
86struct iser_global ig; 87struct iser_global ig;
87 88
88int iser_debug_level = 0; 89int iser_debug_level = 0;
@@ -550,12 +551,14 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
550 */ 551 */
551 if (iser_conn) { 552 if (iser_conn) {
552 mutex_lock(&iser_conn->state_mutex); 553 mutex_lock(&iser_conn->state_mutex);
554 mutex_lock(&unbind_iser_conn_mutex);
553 iser_conn_terminate(iser_conn); 555 iser_conn_terminate(iser_conn);
554 iscsi_conn_stop(cls_conn, flag); 556 iscsi_conn_stop(cls_conn, flag);
555 557
556 /* unbind */ 558 /* unbind */
557 iser_conn->iscsi_conn = NULL; 559 iser_conn->iscsi_conn = NULL;
558 conn->dd_data = NULL; 560 conn->dd_data = NULL;
561 mutex_unlock(&unbind_iser_conn_mutex);
559 562
560 complete(&iser_conn->stop_completion); 563 complete(&iser_conn->stop_completion);
561 mutex_unlock(&iser_conn->state_mutex); 564 mutex_unlock(&iser_conn->state_mutex);
@@ -977,13 +980,21 @@ static int iscsi_iser_slave_alloc(struct scsi_device *sdev)
977 struct iser_conn *iser_conn; 980 struct iser_conn *iser_conn;
978 struct ib_device *ib_dev; 981 struct ib_device *ib_dev;
979 982
983 mutex_lock(&unbind_iser_conn_mutex);
984
980 session = starget_to_session(scsi_target(sdev))->dd_data; 985 session = starget_to_session(scsi_target(sdev))->dd_data;
981 iser_conn = session->leadconn->dd_data; 986 iser_conn = session->leadconn->dd_data;
987 if (!iser_conn) {
988 mutex_unlock(&unbind_iser_conn_mutex);
989 return -ENOTCONN;
990 }
982 ib_dev = iser_conn->ib_conn.device->ib_device; 991 ib_dev = iser_conn->ib_conn.device->ib_device;
983 992
984 if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)) 993 if (!(ib_dev->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG))
985 blk_queue_virt_boundary(sdev->request_queue, ~MASK_4K); 994 blk_queue_virt_boundary(sdev->request_queue, ~MASK_4K);
986 995
996 mutex_unlock(&unbind_iser_conn_mutex);
997
987 return 0; 998 return 0;
988} 999}
989 1000
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c
index 12ed62ce9ff7..2a07692007bd 100644
--- a/drivers/infiniband/ulp/iser/iser_initiator.c
+++ b/drivers/infiniband/ulp/iser/iser_initiator.c
@@ -137,8 +137,10 @@ iser_prepare_write_cmd(struct iscsi_task *task,
137 137
138 if (unsol_sz < edtl) { 138 if (unsol_sz < edtl) {
139 hdr->flags |= ISER_WSV; 139 hdr->flags |= ISER_WSV;
140 hdr->write_stag = cpu_to_be32(mem_reg->rkey); 140 if (buf_out->data_len > imm_sz) {
141 hdr->write_va = cpu_to_be64(mem_reg->sge.addr + unsol_sz); 141 hdr->write_stag = cpu_to_be32(mem_reg->rkey);
142 hdr->write_va = cpu_to_be64(mem_reg->sge.addr + unsol_sz);
143 }
142 144
143 iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X " 145 iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X "
144 "VA:%#llX + unsol:%d\n", 146 "VA:%#llX + unsol:%d\n",
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index c538a38c91ce..26a004e97ae0 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -708,8 +708,14 @@ iser_calc_scsi_params(struct iser_conn *iser_conn,
708 unsigned short sg_tablesize, sup_sg_tablesize; 708 unsigned short sg_tablesize, sup_sg_tablesize;
709 709
710 sg_tablesize = DIV_ROUND_UP(max_sectors * 512, SIZE_4K); 710 sg_tablesize = DIV_ROUND_UP(max_sectors * 512, SIZE_4K);
711 sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE, 711 if (device->ib_device->attrs.device_cap_flags &
712 device->ib_device->attrs.max_fast_reg_page_list_len); 712 IB_DEVICE_MEM_MGT_EXTENSIONS)
713 sup_sg_tablesize =
714 min_t(
715 uint, ISCSI_ISER_MAX_SG_TABLESIZE,
716 device->ib_device->attrs.max_fast_reg_page_list_len);
717 else
718 sup_sg_tablesize = ISCSI_ISER_MAX_SG_TABLESIZE;
713 719
714 iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize); 720 iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize);
715} 721}
diff --git a/drivers/irqchip/irq-digicolor.c b/drivers/irqchip/irq-digicolor.c
index dad85e74c37c..3aae015469a5 100644
--- a/drivers/irqchip/irq-digicolor.c
+++ b/drivers/irqchip/irq-digicolor.c
@@ -71,7 +71,7 @@ static void __init digicolor_set_gc(void __iomem *reg_base, unsigned irq_base,
71static int __init digicolor_of_init(struct device_node *node, 71static int __init digicolor_of_init(struct device_node *node,
72 struct device_node *parent) 72 struct device_node *parent)
73{ 73{
74 static void __iomem *reg_base; 74 void __iomem *reg_base;
75 unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; 75 unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
76 struct regmap *ucregs; 76 struct regmap *ucregs;
77 int ret; 77 int ret;
diff --git a/drivers/irqchip/irq-gic-realview.c b/drivers/irqchip/irq-gic-realview.c
index 54c296401525..18d58d2b4ffe 100644
--- a/drivers/irqchip/irq-gic-realview.c
+++ b/drivers/irqchip/irq-gic-realview.c
@@ -43,7 +43,7 @@ static const struct of_device_id syscon_pldset_of_match[] = {
43static int __init 43static int __init
44realview_gic_of_init(struct device_node *node, struct device_node *parent) 44realview_gic_of_init(struct device_node *node, struct device_node *parent)
45{ 45{
46 static struct regmap *map; 46 struct regmap *map;
47 struct device_node *np; 47 struct device_node *np;
48 const struct of_device_id *gic_id; 48 const struct of_device_id *gic_id;
49 u32 pld1_ctrl; 49 u32 pld1_ctrl;
diff --git a/drivers/irqchip/irq-mips-cpu.c b/drivers/irqchip/irq-mips-cpu.c
index 0a8ed1c05518..14461cbfab2f 100644
--- a/drivers/irqchip/irq-mips-cpu.c
+++ b/drivers/irqchip/irq-mips-cpu.c
@@ -154,7 +154,7 @@ asmlinkage void __weak plat_irq_dispatch(void)
154static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq, 154static int mips_cpu_intc_map(struct irq_domain *d, unsigned int irq,
155 irq_hw_number_t hw) 155 irq_hw_number_t hw)
156{ 156{
157 static struct irq_chip *chip; 157 struct irq_chip *chip;
158 158
159 if (hw < 2 && cpu_has_mipsmt) { 159 if (hw < 2 && cpu_has_mipsmt) {
160 /* Software interrupts are used for MT/CMT IPI */ 160 /* Software interrupts are used for MT/CMT IPI */
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index 832ebf4062f7..6ab1d3afec02 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -950,7 +950,6 @@ static void __init __gic_init(unsigned long gic_base_addr,
950 &gic_irq_domain_ops, NULL); 950 &gic_irq_domain_ops, NULL);
951 if (!gic_irq_domain) 951 if (!gic_irq_domain)
952 panic("Failed to add GIC IRQ domain"); 952 panic("Failed to add GIC IRQ domain");
953 gic_irq_domain->name = "mips-gic-irq";
954 953
955 gic_ipi_domain = irq_domain_add_hierarchy(gic_irq_domain, 954 gic_ipi_domain = irq_domain_add_hierarchy(gic_irq_domain,
956 IRQ_DOMAIN_FLAG_IPI_PER_CPU, 955 IRQ_DOMAIN_FLAG_IPI_PER_CPU,
@@ -959,7 +958,6 @@ static void __init __gic_init(unsigned long gic_base_addr,
959 if (!gic_ipi_domain) 958 if (!gic_ipi_domain)
960 panic("Failed to add GIC IPI domain"); 959 panic("Failed to add GIC IPI domain");
961 960
962 gic_ipi_domain->name = "mips-gic-ipi";
963 irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); 961 irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI);
964 962
965 if (node && 963 if (node &&
diff --git a/drivers/isdn/divert/isdn_divert.c b/drivers/isdn/divert/isdn_divert.c
index 060d357f107f..6f423bc49d0d 100644
--- a/drivers/isdn/divert/isdn_divert.c
+++ b/drivers/isdn/divert/isdn_divert.c
@@ -485,18 +485,19 @@ static int isdn_divert_icall(isdn_ctrl *ic)
485 cs->deflect_dest[0] = '\0'; 485 cs->deflect_dest[0] = '\0';
486 retval = 4; /* only proceed */ 486 retval = 4; /* only proceed */
487 } 487 }
488 sprintf(cs->info, "%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n", 488 snprintf(cs->info, sizeof(cs->info),
489 cs->akt_state, 489 "%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
490 cs->divert_id, 490 cs->akt_state,
491 divert_if.drv_to_name(cs->ics.driver), 491 cs->divert_id,
492 (ic->command == ISDN_STAT_ICALLW) ? "1" : "0", 492 divert_if.drv_to_name(cs->ics.driver),
493 cs->ics.parm.setup.phone, 493 (ic->command == ISDN_STAT_ICALLW) ? "1" : "0",
494 cs->ics.parm.setup.eazmsn, 494 cs->ics.parm.setup.phone,
495 cs->ics.parm.setup.si1, 495 cs->ics.parm.setup.eazmsn,
496 cs->ics.parm.setup.si2, 496 cs->ics.parm.setup.si1,
497 cs->ics.parm.setup.screen, 497 cs->ics.parm.setup.si2,
498 dv->rule.waittime, 498 cs->ics.parm.setup.screen,
499 cs->deflect_dest); 499 dv->rule.waittime,
500 cs->deflect_dest);
500 if ((dv->rule.action == DEFLECT_REPORT) || 501 if ((dv->rule.action == DEFLECT_REPORT) ||
501 (dv->rule.action == DEFLECT_REJECT)) { 502 (dv->rule.action == DEFLECT_REJECT)) {
502 put_info_buffer(cs->info); 503 put_info_buffer(cs->info);
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index 40c7e2cf423b..034cabac699d 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -42,7 +42,7 @@ static char *revision = "$Revision: 1.1.2.2 $";
42 42
43static bool suppress_pollack; 43static bool suppress_pollack;
44 44
45static struct pci_device_id c4_pci_tbl[] = { 45static const struct pci_device_id c4_pci_tbl[] = {
46 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4, 0, 0, (unsigned long)4 }, 46 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4, 0, 0, (unsigned long)4 },
47 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C2, 0, 0, (unsigned long)2 }, 47 { PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C2, 0, 0, (unsigned long)2 },
48 { } /* Terminating entry */ 48 { } /* Terminating entry */
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index 8b7ad4f1ab01..b2023e08dcd2 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -110,7 +110,7 @@ typedef struct _diva_os_thread_dpc {
110/* 110/*
111 This table should be sorted by PCI device ID 111 This table should be sorted by PCI device ID
112*/ 112*/
113static struct pci_device_id divas_pci_tbl[] = { 113static const struct pci_device_id divas_pci_tbl[] = {
114 /* Diva Server BRI-2M PCI 0xE010 */ 114 /* Diva Server BRI-2M PCI 0xE010 */
115 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRA), 115 { PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_MAESTRA),
116 CARDTYPE_MAESTRA_PCI }, 116 CARDTYPE_MAESTRA_PCI },
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index e3fa1cd64470..dce6632daae1 100644
--- a/drivers/isdn/hardware/mISDN/avmfritz.c
+++ b/drivers/isdn/hardware/mISDN/avmfritz.c
@@ -1142,7 +1142,7 @@ fritz_remove_pci(struct pci_dev *pdev)
1142 pr_info("%s: drvdata already removed\n", __func__); 1142 pr_info("%s: drvdata already removed\n", __func__);
1143} 1143}
1144 1144
1145static struct pci_device_id fcpci_ids[] = { 1145static const struct pci_device_id fcpci_ids[] = {
1146 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID, 1146 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1, PCI_ANY_ID, PCI_ANY_ID,
1147 0, 0, (unsigned long) "Fritz!Card PCI"}, 1147 0, 0, (unsigned long) "Fritz!Card PCI"},
1148 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID, 1148 { PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID,
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index aea0c9616ea5..3cf07b8ced1c 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -5348,7 +5348,7 @@ static const struct hm_map hfcm_map[] = {
5348 5348
5349#undef H 5349#undef H
5350#define H(x) ((unsigned long)&hfcm_map[x]) 5350#define H(x) ((unsigned long)&hfcm_map[x])
5351static struct pci_device_id hfmultipci_ids[] = { 5351static const struct pci_device_id hfmultipci_ids[] = {
5352 5352
5353 /* Cards with HFC-4S Chip */ 5353 /* Cards with HFC-4S Chip */
5354 { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC4S, PCI_VENDOR_ID_CCD, 5354 { PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_HFC4S, PCI_VENDOR_ID_CCD,
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 5dc246d71c16..d2e401a8090e 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -2161,7 +2161,7 @@ static const struct _hfc_map hfc_map[] =
2161 {}, 2161 {},
2162}; 2162};
2163 2163
2164static struct pci_device_id hfc_ids[] = 2164static const struct pci_device_id hfc_ids[] =
2165{ 2165{
2166 { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_2BD0), 2166 { PCI_VDEVICE(CCD, PCI_DEVICE_ID_CCD_2BD0),
2167 (unsigned long) &hfc_map[0] }, 2167 (unsigned long) &hfc_map[0] },
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index afde4edef9ae..6a6d848bd18e 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -1137,7 +1137,7 @@ static void nj_remove(struct pci_dev *pdev)
1137/* We cannot select cards with PCI_SUB... IDs, since here are cards with 1137/* We cannot select cards with PCI_SUB... IDs, since here are cards with
1138 * SUB IDs set to PCI_ANY_ID, so we need to match all and reject 1138 * SUB IDs set to PCI_ANY_ID, so we need to match all and reject
1139 * known other cards which not work with this driver - see probe function */ 1139 * known other cards which not work with this driver - see probe function */
1140static struct pci_device_id nj_pci_ids[] = { 1140static const struct pci_device_id nj_pci_ids[] = {
1141 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, 1141 { PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300,
1142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 1142 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1143 { } 1143 { }
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 3052c836b89f..d80072fef434 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1398,7 +1398,7 @@ w6692_remove_pci(struct pci_dev *pdev)
1398 pr_notice("%s: drvdata already removed\n", __func__); 1398 pr_notice("%s: drvdata already removed\n", __func__);
1399} 1399}
1400 1400
1401static struct pci_device_id w6692_ids[] = { 1401static const struct pci_device_id w6692_ids[] = {
1402 { PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH, 1402 { PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH,
1403 PCI_ANY_ID, PCI_ANY_ID, 0, 0, (ulong)&w6692_map[0]}, 1403 PCI_ANY_ID, PCI_ANY_ID, 0, 0, (ulong)&w6692_map[0]},
1404 { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692, 1404 { PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692,
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index c7d68675b028..7108bdb8742e 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1909,7 +1909,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
1909#ifdef CONFIG_PCI 1909#ifdef CONFIG_PCI
1910#include <linux/pci.h> 1910#include <linux/pci.h>
1911 1911
1912static struct pci_device_id hisax_pci_tbl[] __used = { 1912static const struct pci_device_id hisax_pci_tbl[] __used = {
1913#ifdef CONFIG_HISAX_FRITZPCI 1913#ifdef CONFIG_HISAX_FRITZPCI
1914 {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) }, 1914 {PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) },
1915#endif 1915#endif
diff --git a/drivers/isdn/hisax/hfc4s8s_l1.c b/drivers/isdn/hisax/hfc4s8s_l1.c
index 90f051ce0259..9090cc1e1f29 100644
--- a/drivers/isdn/hisax/hfc4s8s_l1.c
+++ b/drivers/isdn/hisax/hfc4s8s_l1.c
@@ -86,7 +86,7 @@ typedef struct {
86 char *device_name; 86 char *device_name;
87} hfc4s8s_param; 87} hfc4s8s_param;
88 88
89static struct pci_device_id hfc4s8s_ids[] = { 89static const struct pci_device_id hfc4s8s_ids[] = {
90 {.vendor = PCI_VENDOR_ID_CCD, 90 {.vendor = PCI_VENDOR_ID_CCD,
91 .device = PCI_DEVICE_ID_4S, 91 .device = PCI_DEVICE_ID_4S,
92 .subvendor = 0x1397, 92 .subvendor = 0x1397,
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index 5a9f39ed1d5d..e4f7573ba9bf 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -52,7 +52,7 @@ module_param(debug, int, 0);
52MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>"); 52MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
53MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver"); 53MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver");
54 54
55static struct pci_device_id fcpci_ids[] = { 55static const struct pci_device_id fcpci_ids[] = {
56 { .vendor = PCI_VENDOR_ID_AVM, 56 { .vendor = PCI_VENDOR_ID_AVM,
57 .device = PCI_DEVICE_ID_AVM_A1, 57 .device = PCI_DEVICE_ID_AVM_A1,
58 .subvendor = PCI_ANY_ID, 58 .subvendor = PCI_ANY_ID,
diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c
index 5ecc154f6831..9bc32578a766 100644
--- a/drivers/lightnvm/pblk-rb.c
+++ b/drivers/lightnvm/pblk-rb.c
@@ -657,7 +657,7 @@ try:
657 * be directed to disk. 657 * be directed to disk.
658 */ 658 */
659int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba, 659int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
660 struct ppa_addr ppa, int bio_iter) 660 struct ppa_addr ppa, int bio_iter, bool advanced_bio)
661{ 661{
662 struct pblk *pblk = container_of(rb, struct pblk, rwb); 662 struct pblk *pblk = container_of(rb, struct pblk, rwb);
663 struct pblk_rb_entry *entry; 663 struct pblk_rb_entry *entry;
@@ -694,7 +694,7 @@ int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
694 * filled with data from the cache). If part of the data resides on the 694 * filled with data from the cache). If part of the data resides on the
695 * media, we will read later on 695 * media, we will read later on
696 */ 696 */
697 if (unlikely(!bio->bi_iter.bi_idx)) 697 if (unlikely(!advanced_bio))
698 bio_advance(bio, bio_iter * PBLK_EXPOSED_PAGE_SIZE); 698 bio_advance(bio, bio_iter * PBLK_EXPOSED_PAGE_SIZE);
699 699
700 data = bio_data(bio); 700 data = bio_data(bio);
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 4e5c48f3de62..d682e89e6493 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -26,7 +26,7 @@
26 */ 26 */
27static int pblk_read_from_cache(struct pblk *pblk, struct bio *bio, 27static int pblk_read_from_cache(struct pblk *pblk, struct bio *bio,
28 sector_t lba, struct ppa_addr ppa, 28 sector_t lba, struct ppa_addr ppa,
29 int bio_iter) 29 int bio_iter, bool advanced_bio)
30{ 30{
31#ifdef CONFIG_NVM_DEBUG 31#ifdef CONFIG_NVM_DEBUG
32 /* Callers must ensure that the ppa points to a cache address */ 32 /* Callers must ensure that the ppa points to a cache address */
@@ -34,7 +34,8 @@ static int pblk_read_from_cache(struct pblk *pblk, struct bio *bio,
34 BUG_ON(!pblk_addr_in_cache(ppa)); 34 BUG_ON(!pblk_addr_in_cache(ppa));
35#endif 35#endif
36 36
37 return pblk_rb_copy_to_bio(&pblk->rwb, bio, lba, ppa, bio_iter); 37 return pblk_rb_copy_to_bio(&pblk->rwb, bio, lba, ppa,
38 bio_iter, advanced_bio);
38} 39}
39 40
40static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd, 41static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
@@ -44,7 +45,7 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
44 struct ppa_addr ppas[PBLK_MAX_REQ_ADDRS]; 45 struct ppa_addr ppas[PBLK_MAX_REQ_ADDRS];
45 sector_t blba = pblk_get_lba(bio); 46 sector_t blba = pblk_get_lba(bio);
46 int nr_secs = rqd->nr_ppas; 47 int nr_secs = rqd->nr_ppas;
47 int advanced_bio = 0; 48 bool advanced_bio = false;
48 int i, j = 0; 49 int i, j = 0;
49 50
50 /* logic error: lba out-of-bounds. Ignore read request */ 51 /* logic error: lba out-of-bounds. Ignore read request */
@@ -62,19 +63,26 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd,
62retry: 63retry:
63 if (pblk_ppa_empty(p)) { 64 if (pblk_ppa_empty(p)) {
64 WARN_ON(test_and_set_bit(i, read_bitmap)); 65 WARN_ON(test_and_set_bit(i, read_bitmap));
65 continue; 66
67 if (unlikely(!advanced_bio)) {
68 bio_advance(bio, (i) * PBLK_EXPOSED_PAGE_SIZE);
69 advanced_bio = true;
70 }
71
72 goto next;
66 } 73 }
67 74
68 /* Try to read from write buffer. The address is later checked 75 /* Try to read from write buffer. The address is later checked
69 * on the write buffer to prevent retrieving overwritten data. 76 * on the write buffer to prevent retrieving overwritten data.
70 */ 77 */
71 if (pblk_addr_in_cache(p)) { 78 if (pblk_addr_in_cache(p)) {
72 if (!pblk_read_from_cache(pblk, bio, lba, p, i)) { 79 if (!pblk_read_from_cache(pblk, bio, lba, p, i,
80 advanced_bio)) {
73 pblk_lookup_l2p_seq(pblk, &p, lba, 1); 81 pblk_lookup_l2p_seq(pblk, &p, lba, 1);
74 goto retry; 82 goto retry;
75 } 83 }
76 WARN_ON(test_and_set_bit(i, read_bitmap)); 84 WARN_ON(test_and_set_bit(i, read_bitmap));
77 advanced_bio = 1; 85 advanced_bio = true;
78#ifdef CONFIG_NVM_DEBUG 86#ifdef CONFIG_NVM_DEBUG
79 atomic_long_inc(&pblk->cache_reads); 87 atomic_long_inc(&pblk->cache_reads);
80#endif 88#endif
@@ -83,6 +91,7 @@ retry:
83 rqd->ppa_list[j++] = p; 91 rqd->ppa_list[j++] = p;
84 } 92 }
85 93
94next:
86 if (advanced_bio) 95 if (advanced_bio)
87 bio_advance(bio, PBLK_EXPOSED_PAGE_SIZE); 96 bio_advance(bio, PBLK_EXPOSED_PAGE_SIZE);
88 } 97 }
@@ -282,7 +291,7 @@ retry:
282 * write buffer to prevent retrieving overwritten data. 291 * write buffer to prevent retrieving overwritten data.
283 */ 292 */
284 if (pblk_addr_in_cache(ppa)) { 293 if (pblk_addr_in_cache(ppa)) {
285 if (!pblk_read_from_cache(pblk, bio, lba, ppa, 0)) { 294 if (!pblk_read_from_cache(pblk, bio, lba, ppa, 0, 1)) {
286 pblk_lookup_l2p_seq(pblk, &ppa, lba, 1); 295 pblk_lookup_l2p_seq(pblk, &ppa, lba, 1);
287 goto retry; 296 goto retry;
288 } 297 }
diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
index 0c5692cc2f60..67e623bd5c2d 100644
--- a/drivers/lightnvm/pblk.h
+++ b/drivers/lightnvm/pblk.h
@@ -670,7 +670,7 @@ unsigned int pblk_rb_read_to_bio_list(struct pblk_rb *rb, struct bio *bio,
670 struct list_head *list, 670 struct list_head *list,
671 unsigned int max); 671 unsigned int max);
672int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba, 672int pblk_rb_copy_to_bio(struct pblk_rb *rb, struct bio *bio, sector_t lba,
673 struct ppa_addr ppa, int bio_iter); 673 struct ppa_addr ppa, int bio_iter, bool advanced_bio);
674unsigned int pblk_rb_read_commit(struct pblk_rb *rb, unsigned int entries); 674unsigned int pblk_rb_read_commit(struct pblk_rb *rb, unsigned int entries);
675 675
676unsigned int pblk_rb_sync_init(struct pblk_rb *rb, unsigned long *flags); 676unsigned int pblk_rb_sync_init(struct pblk_rb *rb, unsigned long *flags);
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index f4eace5ea184..40f3cd7eab0f 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -156,7 +156,8 @@ static int read_sb_page(struct mddev *mddev, loff_t offset,
156 156
157 rdev_for_each(rdev, mddev) { 157 rdev_for_each(rdev, mddev) {
158 if (! test_bit(In_sync, &rdev->flags) 158 if (! test_bit(In_sync, &rdev->flags)
159 || test_bit(Faulty, &rdev->flags)) 159 || test_bit(Faulty, &rdev->flags)
160 || test_bit(Bitmap_sync, &rdev->flags))
160 continue; 161 continue;
161 162
162 target = offset + index * (PAGE_SIZE/512); 163 target = offset + index * (PAGE_SIZE/512);
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 850ff6c67994..44f4a8ac95bd 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1258,8 +1258,7 @@ EXPORT_SYMBOL_GPL(dm_bufio_write_dirty_buffers_async);
1258 */ 1258 */
1259int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c) 1259int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c)
1260{ 1260{
1261 blk_status_t a; 1261 int a, f;
1262 int f;
1263 unsigned long buffers_processed = 0; 1262 unsigned long buffers_processed = 0;
1264 struct dm_buffer *b, *tmp; 1263 struct dm_buffer *b, *tmp;
1265 1264
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 1b224aa9cf15..3acce09bba35 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -1587,16 +1587,18 @@ retry:
1587 if (likely(ic->mode == 'J')) { 1587 if (likely(ic->mode == 'J')) {
1588 if (dio->write) { 1588 if (dio->write) {
1589 unsigned next_entry, i, pos; 1589 unsigned next_entry, i, pos;
1590 unsigned ws, we; 1590 unsigned ws, we, range_sectors;
1591 1591
1592 dio->range.n_sectors = min(dio->range.n_sectors, ic->free_sectors); 1592 dio->range.n_sectors = min(dio->range.n_sectors,
1593 ic->free_sectors << ic->sb->log2_sectors_per_block);
1593 if (unlikely(!dio->range.n_sectors)) 1594 if (unlikely(!dio->range.n_sectors))
1594 goto sleep; 1595 goto sleep;
1595 ic->free_sectors -= dio->range.n_sectors; 1596 range_sectors = dio->range.n_sectors >> ic->sb->log2_sectors_per_block;
1597 ic->free_sectors -= range_sectors;
1596 journal_section = ic->free_section; 1598 journal_section = ic->free_section;
1597 journal_entry = ic->free_section_entry; 1599 journal_entry = ic->free_section_entry;
1598 1600
1599 next_entry = ic->free_section_entry + dio->range.n_sectors; 1601 next_entry = ic->free_section_entry + range_sectors;
1600 ic->free_section_entry = next_entry % ic->journal_section_entries; 1602 ic->free_section_entry = next_entry % ic->journal_section_entries;
1601 ic->free_section += next_entry / ic->journal_section_entries; 1603 ic->free_section += next_entry / ic->journal_section_entries;
1602 ic->n_uncommitted_sections += next_entry / ic->journal_section_entries; 1604 ic->n_uncommitted_sections += next_entry / ic->journal_section_entries;
@@ -1727,6 +1729,8 @@ static void pad_uncommitted(struct dm_integrity_c *ic)
1727 wraparound_section(ic, &ic->free_section); 1729 wraparound_section(ic, &ic->free_section);
1728 ic->n_uncommitted_sections++; 1730 ic->n_uncommitted_sections++;
1729 } 1731 }
1732 WARN_ON(ic->journal_sections * ic->journal_section_entries !=
1733 (ic->n_uncommitted_sections + ic->n_committed_sections) * ic->journal_section_entries + ic->free_sectors);
1730} 1734}
1731 1735
1732static void integrity_commit(struct work_struct *w) 1736static void integrity_commit(struct work_struct *w)
@@ -1821,6 +1825,9 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start,
1821{ 1825{
1822 unsigned i, j, n; 1826 unsigned i, j, n;
1823 struct journal_completion comp; 1827 struct journal_completion comp;
1828 struct blk_plug plug;
1829
1830 blk_start_plug(&plug);
1824 1831
1825 comp.ic = ic; 1832 comp.ic = ic;
1826 comp.in_flight = (atomic_t)ATOMIC_INIT(1); 1833 comp.in_flight = (atomic_t)ATOMIC_INIT(1);
@@ -1945,6 +1952,8 @@ skip_io:
1945 1952
1946 dm_bufio_write_dirty_buffers_async(ic->bufio); 1953 dm_bufio_write_dirty_buffers_async(ic->bufio);
1947 1954
1955 blk_finish_plug(&plug);
1956
1948 complete_journal_op(&comp); 1957 complete_journal_op(&comp);
1949 wait_for_completion_io(&comp.comp); 1958 wait_for_completion_io(&comp.comp);
1950 1959
@@ -3019,6 +3028,11 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
3019 ti->error = "Block size doesn't match the information in superblock"; 3028 ti->error = "Block size doesn't match the information in superblock";
3020 goto bad; 3029 goto bad;
3021 } 3030 }
3031 if (!le32_to_cpu(ic->sb->journal_sections)) {
3032 r = -EINVAL;
3033 ti->error = "Corrupted superblock, journal_sections is 0";
3034 goto bad;
3035 }
3022 /* make sure that ti->max_io_len doesn't overflow */ 3036 /* make sure that ti->max_io_len doesn't overflow */
3023 if (ic->sb->log2_interleave_sectors < MIN_LOG2_INTERLEAVE_SECTORS || 3037 if (ic->sb->log2_interleave_sectors < MIN_LOG2_INTERLEAVE_SECTORS ||
3024 ic->sb->log2_interleave_sectors > MAX_LOG2_INTERLEAVE_SECTORS) { 3038 ic->sb->log2_interleave_sectors > MAX_LOG2_INTERLEAVE_SECTORS) {
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 2e10c2f13a34..5bfe285ea9d1 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -208,6 +208,7 @@ struct raid_dev {
208#define RT_FLAG_RS_BITMAP_LOADED 2 208#define RT_FLAG_RS_BITMAP_LOADED 2
209#define RT_FLAG_UPDATE_SBS 3 209#define RT_FLAG_UPDATE_SBS 3
210#define RT_FLAG_RESHAPE_RS 4 210#define RT_FLAG_RESHAPE_RS 4
211#define RT_FLAG_RS_SUSPENDED 5
211 212
212/* Array elements of 64 bit needed for rebuild/failed disk bits */ 213/* Array elements of 64 bit needed for rebuild/failed disk bits */
213#define DISKS_ARRAY_ELEMS ((MAX_RAID_DEVICES + (sizeof(uint64_t) * 8 - 1)) / sizeof(uint64_t) / 8) 214#define DISKS_ARRAY_ELEMS ((MAX_RAID_DEVICES + (sizeof(uint64_t) * 8 - 1)) / sizeof(uint64_t) / 8)
@@ -564,9 +565,10 @@ static const char *raid10_md_layout_to_format(int layout)
564 if (__raid10_near_copies(layout) > 1) 565 if (__raid10_near_copies(layout) > 1)
565 return "near"; 566 return "near";
566 567
567 WARN_ON(__raid10_far_copies(layout) < 2); 568 if (__raid10_far_copies(layout) > 1)
569 return "far";
568 570
569 return "far"; 571 return "unknown";
570} 572}
571 573
572/* Return md raid10 algorithm for @name */ 574/* Return md raid10 algorithm for @name */
@@ -2540,11 +2542,6 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
2540 if (!freshest) 2542 if (!freshest)
2541 return 0; 2543 return 0;
2542 2544
2543 if (validate_raid_redundancy(rs)) {
2544 rs->ti->error = "Insufficient redundancy to activate array";
2545 return -EINVAL;
2546 }
2547
2548 /* 2545 /*
2549 * Validation of the freshest device provides the source of 2546 * Validation of the freshest device provides the source of
2550 * validation for the remaining devices. 2547 * validation for the remaining devices.
@@ -2553,6 +2550,11 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs)
2553 if (super_validate(rs, freshest)) 2550 if (super_validate(rs, freshest))
2554 return -EINVAL; 2551 return -EINVAL;
2555 2552
2553 if (validate_raid_redundancy(rs)) {
2554 rs->ti->error = "Insufficient redundancy to activate array";
2555 return -EINVAL;
2556 }
2557
2556 rdev_for_each(rdev, mddev) 2558 rdev_for_each(rdev, mddev)
2557 if (!test_bit(Journal, &rdev->flags) && 2559 if (!test_bit(Journal, &rdev->flags) &&
2558 rdev != freshest && 2560 rdev != freshest &&
@@ -3168,6 +3170,7 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
3168 } 3170 }
3169 3171
3170 mddev_suspend(&rs->md); 3172 mddev_suspend(&rs->md);
3173 set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags);
3171 3174
3172 /* Try to adjust the raid4/5/6 stripe cache size to the stripe size */ 3175 /* Try to adjust the raid4/5/6 stripe cache size to the stripe size */
3173 if (rs_is_raid456(rs)) { 3176 if (rs_is_raid456(rs)) {
@@ -3625,7 +3628,7 @@ static void raid_postsuspend(struct dm_target *ti)
3625{ 3628{
3626 struct raid_set *rs = ti->private; 3629 struct raid_set *rs = ti->private;
3627 3630
3628 if (!rs->md.suspended) 3631 if (!test_and_set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags))
3629 mddev_suspend(&rs->md); 3632 mddev_suspend(&rs->md);
3630 3633
3631 rs->md.ro = 1; 3634 rs->md.ro = 1;
@@ -3759,7 +3762,7 @@ static int rs_start_reshape(struct raid_set *rs)
3759 return r; 3762 return r;
3760 3763
3761 /* Need to be resumed to be able to start reshape, recovery is frozen until raid_resume() though */ 3764 /* Need to be resumed to be able to start reshape, recovery is frozen until raid_resume() though */
3762 if (mddev->suspended) 3765 if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags))
3763 mddev_resume(mddev); 3766 mddev_resume(mddev);
3764 3767
3765 /* 3768 /*
@@ -3786,8 +3789,8 @@ static int rs_start_reshape(struct raid_set *rs)
3786 } 3789 }
3787 3790
3788 /* Suspend because a resume will happen in raid_resume() */ 3791 /* Suspend because a resume will happen in raid_resume() */
3789 if (!mddev->suspended) 3792 set_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags);
3790 mddev_suspend(mddev); 3793 mddev_suspend(mddev);
3791 3794
3792 /* 3795 /*
3793 * Now reshape got set up, update superblocks to 3796 * Now reshape got set up, update superblocks to
@@ -3883,13 +3886,13 @@ static void raid_resume(struct dm_target *ti)
3883 if (!(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS)) 3886 if (!(rs->ctr_flags & RESUME_STAY_FROZEN_FLAGS))
3884 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); 3887 clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
3885 3888
3886 if (mddev->suspended) 3889 if (test_and_clear_bit(RT_FLAG_RS_SUSPENDED, &rs->runtime_flags))
3887 mddev_resume(mddev); 3890 mddev_resume(mddev);
3888} 3891}
3889 3892
3890static struct target_type raid_target = { 3893static struct target_type raid_target = {
3891 .name = "raid", 3894 .name = "raid",
3892 .version = {1, 11, 1}, 3895 .version = {1, 12, 1},
3893 .module = THIS_MODULE, 3896 .module = THIS_MODULE,
3894 .ctr = raid_ctr, 3897 .ctr = raid_ctr,
3895 .dtr = raid_dtr, 3898 .dtr = raid_dtr,
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index a39bcd9b982a..28a4071cdf85 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -20,6 +20,7 @@
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <linux/blk-mq.h> 21#include <linux/blk-mq.h>
22#include <linux/mount.h> 22#include <linux/mount.h>
23#include <linux/dax.h>
23 24
24#define DM_MSG_PREFIX "table" 25#define DM_MSG_PREFIX "table"
25 26
@@ -1630,6 +1631,37 @@ static bool dm_table_supports_flush(struct dm_table *t, unsigned long flush)
1630 return false; 1631 return false;
1631} 1632}
1632 1633
1634static int device_dax_write_cache_enabled(struct dm_target *ti,
1635 struct dm_dev *dev, sector_t start,
1636 sector_t len, void *data)
1637{
1638 struct dax_device *dax_dev = dev->dax_dev;
1639
1640 if (!dax_dev)
1641 return false;
1642
1643 if (dax_write_cache_enabled(dax_dev))
1644 return true;
1645 return false;
1646}
1647
1648static int dm_table_supports_dax_write_cache(struct dm_table *t)
1649{
1650 struct dm_target *ti;
1651 unsigned i;
1652
1653 for (i = 0; i < dm_table_get_num_targets(t); i++) {
1654 ti = dm_table_get_target(t, i);
1655
1656 if (ti->type->iterate_devices &&
1657 ti->type->iterate_devices(ti,
1658 device_dax_write_cache_enabled, NULL))
1659 return true;
1660 }
1661
1662 return false;
1663}
1664
1633static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev, 1665static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev,
1634 sector_t start, sector_t len, void *data) 1666 sector_t start, sector_t len, void *data)
1635{ 1667{
@@ -1785,6 +1817,9 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1785 } 1817 }
1786 blk_queue_write_cache(q, wc, fua); 1818 blk_queue_write_cache(q, wc, fua);
1787 1819
1820 if (dm_table_supports_dax_write_cache(t))
1821 dax_write_cache(t->md->dax_dev, true);
1822
1788 /* Ensure that all underlying devices are non-rotational. */ 1823 /* Ensure that all underlying devices are non-rotational. */
1789 if (dm_table_all_devices_attribute(t, device_is_nonrot)) 1824 if (dm_table_all_devices_attribute(t, device_is_nonrot))
1790 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); 1825 queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
index 504ba3fa328b..e13f90832b6b 100644
--- a/drivers/md/dm-verity-fec.c
+++ b/drivers/md/dm-verity-fec.c
@@ -308,19 +308,14 @@ static int fec_alloc_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio)
308{ 308{
309 unsigned n; 309 unsigned n;
310 310
311 if (!fio->rs) { 311 if (!fio->rs)
312 fio->rs = mempool_alloc(v->fec->rs_pool, 0); 312 fio->rs = mempool_alloc(v->fec->rs_pool, GFP_NOIO);
313 if (unlikely(!fio->rs)) {
314 DMERR("failed to allocate RS");
315 return -ENOMEM;
316 }
317 }
318 313
319 fec_for_each_prealloc_buffer(n) { 314 fec_for_each_prealloc_buffer(n) {
320 if (fio->bufs[n]) 315 if (fio->bufs[n])
321 continue; 316 continue;
322 317
323 fio->bufs[n] = mempool_alloc(v->fec->prealloc_pool, GFP_NOIO); 318 fio->bufs[n] = mempool_alloc(v->fec->prealloc_pool, GFP_NOWAIT);
324 if (unlikely(!fio->bufs[n])) { 319 if (unlikely(!fio->bufs[n])) {
325 DMERR("failed to allocate FEC buffer"); 320 DMERR("failed to allocate FEC buffer");
326 return -ENOMEM; 321 return -ENOMEM;
@@ -332,22 +327,16 @@ static int fec_alloc_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio)
332 if (fio->bufs[n]) 327 if (fio->bufs[n])
333 continue; 328 continue;
334 329
335 fio->bufs[n] = mempool_alloc(v->fec->extra_pool, GFP_NOIO); 330 fio->bufs[n] = mempool_alloc(v->fec->extra_pool, GFP_NOWAIT);
336 /* we can manage with even one buffer if necessary */ 331 /* we can manage with even one buffer if necessary */
337 if (unlikely(!fio->bufs[n])) 332 if (unlikely(!fio->bufs[n]))
338 break; 333 break;
339 } 334 }
340 fio->nbufs = n; 335 fio->nbufs = n;
341 336
342 if (!fio->output) { 337 if (!fio->output)
343 fio->output = mempool_alloc(v->fec->output_pool, GFP_NOIO); 338 fio->output = mempool_alloc(v->fec->output_pool, GFP_NOIO);
344 339
345 if (!fio->output) {
346 DMERR("failed to allocate FEC page");
347 return -ENOMEM;
348 }
349 }
350
351 return 0; 340 return 0;
352} 341}
353 342
diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c
index 884ff7c170a0..a4fa2ada6883 100644
--- a/drivers/md/dm-zoned-metadata.c
+++ b/drivers/md/dm-zoned-metadata.c
@@ -624,7 +624,7 @@ static int dmz_write_sb(struct dmz_metadata *zmd, unsigned int set)
624 624
625 ret = dmz_rdwr_block(zmd, REQ_OP_WRITE, block, mblk->page); 625 ret = dmz_rdwr_block(zmd, REQ_OP_WRITE, block, mblk->page);
626 if (ret == 0) 626 if (ret == 0)
627 ret = blkdev_issue_flush(zmd->dev->bdev, GFP_KERNEL, NULL); 627 ret = blkdev_issue_flush(zmd->dev->bdev, GFP_NOIO, NULL);
628 628
629 return ret; 629 return ret;
630} 630}
@@ -658,7 +658,7 @@ static int dmz_write_dirty_mblocks(struct dmz_metadata *zmd,
658 658
659 /* Flush drive cache (this will also sync data) */ 659 /* Flush drive cache (this will also sync data) */
660 if (ret == 0) 660 if (ret == 0)
661 ret = blkdev_issue_flush(zmd->dev->bdev, GFP_KERNEL, NULL); 661 ret = blkdev_issue_flush(zmd->dev->bdev, GFP_NOIO, NULL);
662 662
663 return ret; 663 return ret;
664} 664}
@@ -722,7 +722,7 @@ int dmz_flush_metadata(struct dmz_metadata *zmd)
722 722
723 /* If there are no dirty metadata blocks, just flush the device cache */ 723 /* If there are no dirty metadata blocks, just flush the device cache */
724 if (list_empty(&write_list)) { 724 if (list_empty(&write_list)) {
725 ret = blkdev_issue_flush(zmd->dev->bdev, GFP_KERNEL, NULL); 725 ret = blkdev_issue_flush(zmd->dev->bdev, GFP_NOIO, NULL);
726 goto out; 726 goto out;
727 } 727 }
728 728
@@ -927,7 +927,7 @@ static int dmz_recover_mblocks(struct dmz_metadata *zmd, unsigned int dst_set)
927 (zmd->nr_meta_zones << zmd->dev->zone_nr_blocks_shift); 927 (zmd->nr_meta_zones << zmd->dev->zone_nr_blocks_shift);
928 } 928 }
929 929
930 page = alloc_page(GFP_KERNEL); 930 page = alloc_page(GFP_NOIO);
931 if (!page) 931 if (!page)
932 return -ENOMEM; 932 return -ENOMEM;
933 933
@@ -1183,7 +1183,7 @@ static int dmz_update_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
1183 1183
1184 /* Get zone information from disk */ 1184 /* Get zone information from disk */
1185 ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone), 1185 ret = blkdev_report_zones(zmd->dev->bdev, dmz_start_sect(zmd, zone),
1186 &blkz, &nr_blkz, GFP_KERNEL); 1186 &blkz, &nr_blkz, GFP_NOIO);
1187 if (ret) { 1187 if (ret) {
1188 dmz_dev_err(zmd->dev, "Get zone %u report failed", 1188 dmz_dev_err(zmd->dev, "Get zone %u report failed",
1189 dmz_id(zmd, zone)); 1189 dmz_id(zmd, zone));
@@ -1257,7 +1257,7 @@ static int dmz_reset_zone(struct dmz_metadata *zmd, struct dm_zone *zone)
1257 1257
1258 ret = blkdev_reset_zones(dev->bdev, 1258 ret = blkdev_reset_zones(dev->bdev,
1259 dmz_start_sect(zmd, zone), 1259 dmz_start_sect(zmd, zone),
1260 dev->zone_nr_sectors, GFP_KERNEL); 1260 dev->zone_nr_sectors, GFP_NOIO);
1261 if (ret) { 1261 if (ret) {
1262 dmz_dev_err(dev, "Reset zone %u failed %d", 1262 dmz_dev_err(dev, "Reset zone %u failed %d",
1263 dmz_id(zmd, zone), ret); 1263 dmz_id(zmd, zone), ret);
diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c
index 05c0a126f5c8..44a119e12f1a 100644
--- a/drivers/md/dm-zoned-reclaim.c
+++ b/drivers/md/dm-zoned-reclaim.c
@@ -75,7 +75,7 @@ static int dmz_reclaim_align_wp(struct dmz_reclaim *zrc, struct dm_zone *zone,
75 nr_blocks = block - wp_block; 75 nr_blocks = block - wp_block;
76 ret = blkdev_issue_zeroout(zrc->dev->bdev, 76 ret = blkdev_issue_zeroout(zrc->dev->bdev,
77 dmz_start_sect(zmd, zone) + dmz_blk2sect(wp_block), 77 dmz_start_sect(zmd, zone) + dmz_blk2sect(wp_block),
78 dmz_blk2sect(nr_blocks), GFP_NOFS, false); 78 dmz_blk2sect(nr_blocks), GFP_NOIO, 0);
79 if (ret) { 79 if (ret) {
80 dmz_dev_err(zrc->dev, 80 dmz_dev_err(zrc->dev,
81 "Align zone %u wp %llu to %llu (wp+%u) blocks failed %d", 81 "Align zone %u wp %llu to %llu (wp+%u) blocks failed %d",
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c
index 2b538fa817f4..b08bbbd4d902 100644
--- a/drivers/md/dm-zoned-target.c
+++ b/drivers/md/dm-zoned-target.c
@@ -541,7 +541,7 @@ static void dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
541 int ret; 541 int ret;
542 542
543 /* Create a new chunk work */ 543 /* Create a new chunk work */
544 cw = kmalloc(sizeof(struct dm_chunk_work), GFP_NOFS); 544 cw = kmalloc(sizeof(struct dm_chunk_work), GFP_NOIO);
545 if (!cw) 545 if (!cw)
546 goto out; 546 goto out;
547 547
@@ -588,7 +588,7 @@ static int dmz_map(struct dm_target *ti, struct bio *bio)
588 588
589 bio->bi_bdev = dev->bdev; 589 bio->bi_bdev = dev->bdev;
590 590
591 if (!nr_sectors && (bio_op(bio) != REQ_OP_FLUSH) && (bio_op(bio) != REQ_OP_WRITE)) 591 if (!nr_sectors && bio_op(bio) != REQ_OP_WRITE)
592 return DM_MAPIO_REMAPPED; 592 return DM_MAPIO_REMAPPED;
593 593
594 /* The BIO should be block aligned */ 594 /* The BIO should be block aligned */
@@ -603,7 +603,7 @@ static int dmz_map(struct dm_target *ti, struct bio *bio)
603 bioctx->status = BLK_STS_OK; 603 bioctx->status = BLK_STS_OK;
604 604
605 /* Set the BIO pending in the flush list */ 605 /* Set the BIO pending in the flush list */
606 if (bio_op(bio) == REQ_OP_FLUSH || (!nr_sectors && bio_op(bio) == REQ_OP_WRITE)) { 606 if (!nr_sectors && bio_op(bio) == REQ_OP_WRITE) {
607 spin_lock(&dmz->flush_lock); 607 spin_lock(&dmz->flush_lock);
608 bio_list_add(&dmz->flush_list, bio); 608 bio_list_add(&dmz->flush_list, bio);
609 spin_unlock(&dmz->flush_lock); 609 spin_unlock(&dmz->flush_lock);
@@ -785,7 +785,7 @@ static int dmz_ctr(struct dm_target *ti, unsigned int argc, char **argv)
785 785
786 /* Chunk BIO work */ 786 /* Chunk BIO work */
787 mutex_init(&dmz->chunk_lock); 787 mutex_init(&dmz->chunk_lock);
788 INIT_RADIX_TREE(&dmz->chunk_rxtree, GFP_NOFS); 788 INIT_RADIX_TREE(&dmz->chunk_rxtree, GFP_KERNEL);
789 dmz->chunk_wq = alloc_workqueue("dmz_cwq_%s", WQ_MEM_RECLAIM | WQ_UNBOUND, 789 dmz->chunk_wq = alloc_workqueue("dmz_cwq_%s", WQ_MEM_RECLAIM | WQ_UNBOUND,
790 0, dev->name); 790 0, dev->name);
791 if (!dmz->chunk_wq) { 791 if (!dmz->chunk_wq) {
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8cdca0296749..c99634612fc4 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2287,7 +2287,7 @@ static void export_array(struct mddev *mddev)
2287 2287
2288static bool set_in_sync(struct mddev *mddev) 2288static bool set_in_sync(struct mddev *mddev)
2289{ 2289{
2290 WARN_ON_ONCE(!spin_is_locked(&mddev->lock)); 2290 WARN_ON_ONCE(NR_CPUS != 1 && !spin_is_locked(&mddev->lock));
2291 if (!mddev->in_sync) { 2291 if (!mddev->in_sync) {
2292 mddev->sync_checkers++; 2292 mddev->sync_checkers++;
2293 spin_unlock(&mddev->lock); 2293 spin_unlock(&mddev->lock);
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 991f0fe2dcc6..09db03455801 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -134,7 +134,9 @@ enum flag_bits {
134 Faulty, /* device is known to have a fault */ 134 Faulty, /* device is known to have a fault */
135 In_sync, /* device is in_sync with rest of array */ 135 In_sync, /* device is in_sync with rest of array */
136 Bitmap_sync, /* ..actually, not quite In_sync. Need a 136 Bitmap_sync, /* ..actually, not quite In_sync. Need a
137 * bitmap-based recovery to get fully in sync 137 * bitmap-based recovery to get fully in sync.
138 * The bit is only meaningful before device
139 * has been passed to pers->hot_add_disk.
138 */ 140 */
139 WriteMostly, /* Avoid reading if at all possible */ 141 WriteMostly, /* Avoid reading if at all possible */
140 AutoDetected, /* added by auto-detect */ 142 AutoDetected, /* added by auto-detect */
@@ -729,58 +731,4 @@ static inline void mddev_check_write_zeroes(struct mddev *mddev, struct bio *bio
729 !bdev_get_queue(bio->bi_bdev)->limits.max_write_zeroes_sectors) 731 !bdev_get_queue(bio->bi_bdev)->limits.max_write_zeroes_sectors)
730 mddev->queue->limits.max_write_zeroes_sectors = 0; 732 mddev->queue->limits.max_write_zeroes_sectors = 0;
731} 733}
732
733/* Maximum size of each resync request */
734#define RESYNC_BLOCK_SIZE (64*1024)
735#define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE)
736
737/* for managing resync I/O pages */
738struct resync_pages {
739 unsigned idx; /* for get/put page from the pool */
740 void *raid_bio;
741 struct page *pages[RESYNC_PAGES];
742};
743
744static inline int resync_alloc_pages(struct resync_pages *rp,
745 gfp_t gfp_flags)
746{
747 int i;
748
749 for (i = 0; i < RESYNC_PAGES; i++) {
750 rp->pages[i] = alloc_page(gfp_flags);
751 if (!rp->pages[i])
752 goto out_free;
753 }
754
755 return 0;
756
757out_free:
758 while (--i >= 0)
759 put_page(rp->pages[i]);
760 return -ENOMEM;
761}
762
763static inline void resync_free_pages(struct resync_pages *rp)
764{
765 int i;
766
767 for (i = 0; i < RESYNC_PAGES; i++)
768 put_page(rp->pages[i]);
769}
770
771static inline void resync_get_all_pages(struct resync_pages *rp)
772{
773 int i;
774
775 for (i = 0; i < RESYNC_PAGES; i++)
776 get_page(rp->pages[i]);
777}
778
779static inline struct page *resync_fetch_page(struct resync_pages *rp,
780 unsigned idx)
781{
782 if (WARN_ON_ONCE(idx >= RESYNC_PAGES))
783 return NULL;
784 return rp->pages[idx];
785}
786#endif /* _MD_MD_H */ 734#endif /* _MD_MD_H */
diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
new file mode 100644
index 000000000000..9f2670b45f31
--- /dev/null
+++ b/drivers/md/raid1-10.c
@@ -0,0 +1,81 @@
1/* Maximum size of each resync request */
2#define RESYNC_BLOCK_SIZE (64*1024)
3#define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE)
4
5/* for managing resync I/O pages */
6struct resync_pages {
7 void *raid_bio;
8 struct page *pages[RESYNC_PAGES];
9};
10
11static inline int resync_alloc_pages(struct resync_pages *rp,
12 gfp_t gfp_flags)
13{
14 int i;
15
16 for (i = 0; i < RESYNC_PAGES; i++) {
17 rp->pages[i] = alloc_page(gfp_flags);
18 if (!rp->pages[i])
19 goto out_free;
20 }
21
22 return 0;
23
24out_free:
25 while (--i >= 0)
26 put_page(rp->pages[i]);
27 return -ENOMEM;
28}
29
30static inline void resync_free_pages(struct resync_pages *rp)
31{
32 int i;
33
34 for (i = 0; i < RESYNC_PAGES; i++)
35 put_page(rp->pages[i]);
36}
37
38static inline void resync_get_all_pages(struct resync_pages *rp)
39{
40 int i;
41
42 for (i = 0; i < RESYNC_PAGES; i++)
43 get_page(rp->pages[i]);
44}
45
46static inline struct page *resync_fetch_page(struct resync_pages *rp,
47 unsigned idx)
48{
49 if (WARN_ON_ONCE(idx >= RESYNC_PAGES))
50 return NULL;
51 return rp->pages[idx];
52}
53
54/*
55 * 'strct resync_pages' stores actual pages used for doing the resync
56 * IO, and it is per-bio, so make .bi_private points to it.
57 */
58static inline struct resync_pages *get_resync_pages(struct bio *bio)
59{
60 return bio->bi_private;
61}
62
63/* generally called after bio_reset() for reseting bvec */
64static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp,
65 int size)
66{
67 int idx = 0;
68
69 /* initialize bvec table again */
70 do {
71 struct page *page = resync_fetch_page(rp, idx);
72 int len = min_t(int, size, PAGE_SIZE);
73
74 /*
75 * won't fail because the vec table is big
76 * enough to hold all these pages
77 */
78 bio_add_page(bio, page, len, 0);
79 size -= len;
80 } while (idx++ < RESYNC_PAGES && size > 0);
81}
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3febfc8391fb..f50958ded9f0 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -81,14 +81,7 @@ static void lower_barrier(struct r1conf *conf, sector_t sector_nr);
81#define raid1_log(md, fmt, args...) \ 81#define raid1_log(md, fmt, args...) \
82 do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 " fmt, ##args); } while (0) 82 do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid1 " fmt, ##args); } while (0)
83 83
84/* 84#include "raid1-10.c"
85 * 'strct resync_pages' stores actual pages used for doing the resync
86 * IO, and it is per-bio, so make .bi_private points to it.
87 */
88static inline struct resync_pages *get_resync_pages(struct bio *bio)
89{
90 return bio->bi_private;
91}
92 85
93/* 86/*
94 * for resync bio, r1bio pointer can be retrieved from the per-bio 87 * for resync bio, r1bio pointer can be retrieved from the per-bio
@@ -170,7 +163,6 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
170 resync_get_all_pages(rp); 163 resync_get_all_pages(rp);
171 } 164 }
172 165
173 rp->idx = 0;
174 rp->raid_bio = r1_bio; 166 rp->raid_bio = r1_bio;
175 bio->bi_private = rp; 167 bio->bi_private = rp;
176 } 168 }
@@ -492,10 +484,6 @@ static void raid1_end_write_request(struct bio *bio)
492 } 484 }
493 485
494 if (behind) { 486 if (behind) {
495 /* we release behind master bio when all write are done */
496 if (r1_bio->behind_master_bio == bio)
497 to_put = NULL;
498
499 if (test_bit(WriteMostly, &rdev->flags)) 487 if (test_bit(WriteMostly, &rdev->flags))
500 atomic_dec(&r1_bio->behind_remaining); 488 atomic_dec(&r1_bio->behind_remaining);
501 489
@@ -802,8 +790,7 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
802 bio->bi_next = NULL; 790 bio->bi_next = NULL;
803 bio->bi_bdev = rdev->bdev; 791 bio->bi_bdev = rdev->bdev;
804 if (test_bit(Faulty, &rdev->flags)) { 792 if (test_bit(Faulty, &rdev->flags)) {
805 bio->bi_status = BLK_STS_IOERR; 793 bio_io_error(bio);
806 bio_endio(bio);
807 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && 794 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
808 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 795 !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
809 /* Just ignore it */ 796 /* Just ignore it */
@@ -1088,7 +1075,7 @@ static void unfreeze_array(struct r1conf *conf)
1088 wake_up(&conf->wait_barrier); 1075 wake_up(&conf->wait_barrier);
1089} 1076}
1090 1077
1091static struct bio *alloc_behind_master_bio(struct r1bio *r1_bio, 1078static void alloc_behind_master_bio(struct r1bio *r1_bio,
1092 struct bio *bio) 1079 struct bio *bio)
1093{ 1080{
1094 int size = bio->bi_iter.bi_size; 1081 int size = bio->bi_iter.bi_size;
@@ -1098,11 +1085,13 @@ static struct bio *alloc_behind_master_bio(struct r1bio *r1_bio,
1098 1085
1099 behind_bio = bio_alloc_mddev(GFP_NOIO, vcnt, r1_bio->mddev); 1086 behind_bio = bio_alloc_mddev(GFP_NOIO, vcnt, r1_bio->mddev);
1100 if (!behind_bio) 1087 if (!behind_bio)
1101 goto fail; 1088 return;
1102 1089
1103 /* discard op, we don't support writezero/writesame yet */ 1090 /* discard op, we don't support writezero/writesame yet */
1104 if (!bio_has_data(bio)) 1091 if (!bio_has_data(bio)) {
1092 behind_bio->bi_iter.bi_size = size;
1105 goto skip_copy; 1093 goto skip_copy;
1094 }
1106 1095
1107 while (i < vcnt && size) { 1096 while (i < vcnt && size) {
1108 struct page *page; 1097 struct page *page;
@@ -1123,14 +1112,13 @@ skip_copy:
1123 r1_bio->behind_master_bio = behind_bio;; 1112 r1_bio->behind_master_bio = behind_bio;;
1124 set_bit(R1BIO_BehindIO, &r1_bio->state); 1113 set_bit(R1BIO_BehindIO, &r1_bio->state);
1125 1114
1126 return behind_bio; 1115 return;
1127 1116
1128free_pages: 1117free_pages:
1129 pr_debug("%dB behind alloc failed, doing sync I/O\n", 1118 pr_debug("%dB behind alloc failed, doing sync I/O\n",
1130 bio->bi_iter.bi_size); 1119 bio->bi_iter.bi_size);
1131 bio_free_pages(behind_bio); 1120 bio_free_pages(behind_bio);
1132fail: 1121 bio_put(behind_bio);
1133 return behind_bio;
1134} 1122}
1135 1123
1136struct raid1_plug_cb { 1124struct raid1_plug_cb {
@@ -1483,7 +1471,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
1483 (atomic_read(&bitmap->behind_writes) 1471 (atomic_read(&bitmap->behind_writes)
1484 < mddev->bitmap_info.max_write_behind) && 1472 < mddev->bitmap_info.max_write_behind) &&
1485 !waitqueue_active(&bitmap->behind_wait)) { 1473 !waitqueue_active(&bitmap->behind_wait)) {
1486 mbio = alloc_behind_master_bio(r1_bio, bio); 1474 alloc_behind_master_bio(r1_bio, bio);
1487 } 1475 }
1488 1476
1489 bitmap_startwrite(bitmap, r1_bio->sector, 1477 bitmap_startwrite(bitmap, r1_bio->sector,
@@ -1493,14 +1481,11 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
1493 first_clone = 0; 1481 first_clone = 0;
1494 } 1482 }
1495 1483
1496 if (!mbio) { 1484 if (r1_bio->behind_master_bio)
1497 if (r1_bio->behind_master_bio) 1485 mbio = bio_clone_fast(r1_bio->behind_master_bio,
1498 mbio = bio_clone_fast(r1_bio->behind_master_bio, 1486 GFP_NOIO, mddev->bio_set);
1499 GFP_NOIO, 1487 else
1500 mddev->bio_set); 1488 mbio = bio_clone_fast(bio, GFP_NOIO, mddev->bio_set);
1501 else
1502 mbio = bio_clone_fast(bio, GFP_NOIO, mddev->bio_set);
1503 }
1504 1489
1505 if (r1_bio->behind_master_bio) { 1490 if (r1_bio->behind_master_bio) {
1506 if (test_bit(WriteMostly, &conf->mirrors[i].rdev->flags)) 1491 if (test_bit(WriteMostly, &conf->mirrors[i].rdev->flags))
@@ -2086,10 +2071,7 @@ static void process_checks(struct r1bio *r1_bio)
2086 /* Fix variable parts of all bios */ 2071 /* Fix variable parts of all bios */
2087 vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9); 2072 vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9);
2088 for (i = 0; i < conf->raid_disks * 2; i++) { 2073 for (i = 0; i < conf->raid_disks * 2; i++) {
2089 int j;
2090 int size;
2091 blk_status_t status; 2074 blk_status_t status;
2092 struct bio_vec *bi;
2093 struct bio *b = r1_bio->bios[i]; 2075 struct bio *b = r1_bio->bios[i];
2094 struct resync_pages *rp = get_resync_pages(b); 2076 struct resync_pages *rp = get_resync_pages(b);
2095 if (b->bi_end_io != end_sync_read) 2077 if (b->bi_end_io != end_sync_read)
@@ -2098,8 +2080,6 @@ static void process_checks(struct r1bio *r1_bio)
2098 status = b->bi_status; 2080 status = b->bi_status;
2099 bio_reset(b); 2081 bio_reset(b);
2100 b->bi_status = status; 2082 b->bi_status = status;
2101 b->bi_vcnt = vcnt;
2102 b->bi_iter.bi_size = r1_bio->sectors << 9;
2103 b->bi_iter.bi_sector = r1_bio->sector + 2083 b->bi_iter.bi_sector = r1_bio->sector +
2104 conf->mirrors[i].rdev->data_offset; 2084 conf->mirrors[i].rdev->data_offset;
2105 b->bi_bdev = conf->mirrors[i].rdev->bdev; 2085 b->bi_bdev = conf->mirrors[i].rdev->bdev;
@@ -2107,15 +2087,8 @@ static void process_checks(struct r1bio *r1_bio)
2107 rp->raid_bio = r1_bio; 2087 rp->raid_bio = r1_bio;
2108 b->bi_private = rp; 2088 b->bi_private = rp;
2109 2089
2110 size = b->bi_iter.bi_size; 2090 /* initialize bvec table again */
2111 bio_for_each_segment_all(bi, b, j) { 2091 md_bio_reset_resync_pages(b, rp, r1_bio->sectors << 9);
2112 bi->bv_offset = 0;
2113 if (size > PAGE_SIZE)
2114 bi->bv_len = PAGE_SIZE;
2115 else
2116 bi->bv_len = size;
2117 size -= PAGE_SIZE;
2118 }
2119 } 2092 }
2120 for (primary = 0; primary < conf->raid_disks * 2; primary++) 2093 for (primary = 0; primary < conf->raid_disks * 2; primary++)
2121 if (r1_bio->bios[primary]->bi_end_io == end_sync_read && 2094 if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
@@ -2366,8 +2339,6 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
2366 wbio = bio_clone_fast(r1_bio->behind_master_bio, 2339 wbio = bio_clone_fast(r1_bio->behind_master_bio,
2367 GFP_NOIO, 2340 GFP_NOIO,
2368 mddev->bio_set); 2341 mddev->bio_set);
2369 /* We really need a _all clone */
2370 wbio->bi_iter = (struct bvec_iter){ 0 };
2371 } else { 2342 } else {
2372 wbio = bio_clone_fast(r1_bio->master_bio, GFP_NOIO, 2343 wbio = bio_clone_fast(r1_bio->master_bio, GFP_NOIO,
2373 mddev->bio_set); 2344 mddev->bio_set);
@@ -2619,6 +2590,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
2619 int good_sectors = RESYNC_SECTORS; 2590 int good_sectors = RESYNC_SECTORS;
2620 int min_bad = 0; /* number of sectors that are bad in all devices */ 2591 int min_bad = 0; /* number of sectors that are bad in all devices */
2621 int idx = sector_to_idx(sector_nr); 2592 int idx = sector_to_idx(sector_nr);
2593 int page_idx = 0;
2622 2594
2623 if (!conf->r1buf_pool) 2595 if (!conf->r1buf_pool)
2624 if (init_resync(conf)) 2596 if (init_resync(conf))
@@ -2846,7 +2818,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
2846 bio = r1_bio->bios[i]; 2818 bio = r1_bio->bios[i];
2847 rp = get_resync_pages(bio); 2819 rp = get_resync_pages(bio);
2848 if (bio->bi_end_io) { 2820 if (bio->bi_end_io) {
2849 page = resync_fetch_page(rp, rp->idx++); 2821 page = resync_fetch_page(rp, page_idx);
2850 2822
2851 /* 2823 /*
2852 * won't fail because the vec table is big 2824 * won't fail because the vec table is big
@@ -2858,7 +2830,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
2858 nr_sectors += len>>9; 2830 nr_sectors += len>>9;
2859 sector_nr += len>>9; 2831 sector_nr += len>>9;
2860 sync_blocks -= (len>>9); 2832 sync_blocks -= (len>>9);
2861 } while (get_resync_pages(r1_bio->bios[disk]->bi_private)->idx < RESYNC_PAGES); 2833 } while (++page_idx < RESYNC_PAGES);
2862 2834
2863 r1_bio->sectors = nr_sectors; 2835 r1_bio->sectors = nr_sectors;
2864 2836
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 5026e7ad51d3..f55d4cc085f6 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -110,14 +110,7 @@ static void end_reshape(struct r10conf *conf);
110#define raid10_log(md, fmt, args...) \ 110#define raid10_log(md, fmt, args...) \
111 do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid10 " fmt, ##args); } while (0) 111 do { if ((md)->queue) blk_add_trace_msg((md)->queue, "raid10 " fmt, ##args); } while (0)
112 112
113/* 113#include "raid1-10.c"
114 * 'strct resync_pages' stores actual pages used for doing the resync
115 * IO, and it is per-bio, so make .bi_private points to it.
116 */
117static inline struct resync_pages *get_resync_pages(struct bio *bio)
118{
119 return bio->bi_private;
120}
121 114
122/* 115/*
123 * for resync bio, r10bio pointer can be retrieved from the per-bio 116 * for resync bio, r10bio pointer can be retrieved from the per-bio
@@ -221,7 +214,6 @@ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data)
221 resync_get_all_pages(rp); 214 resync_get_all_pages(rp);
222 } 215 }
223 216
224 rp->idx = 0;
225 rp->raid_bio = r10_bio; 217 rp->raid_bio = r10_bio;
226 bio->bi_private = rp; 218 bio->bi_private = rp;
227 if (rbio) { 219 if (rbio) {
@@ -913,8 +905,7 @@ static void flush_pending_writes(struct r10conf *conf)
913 bio->bi_next = NULL; 905 bio->bi_next = NULL;
914 bio->bi_bdev = rdev->bdev; 906 bio->bi_bdev = rdev->bdev;
915 if (test_bit(Faulty, &rdev->flags)) { 907 if (test_bit(Faulty, &rdev->flags)) {
916 bio->bi_status = BLK_STS_IOERR; 908 bio_io_error(bio);
917 bio_endio(bio);
918 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && 909 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
919 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 910 !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
920 /* Just ignore it */ 911 /* Just ignore it */
@@ -1098,8 +1089,7 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
1098 bio->bi_next = NULL; 1089 bio->bi_next = NULL;
1099 bio->bi_bdev = rdev->bdev; 1090 bio->bi_bdev = rdev->bdev;
1100 if (test_bit(Faulty, &rdev->flags)) { 1091 if (test_bit(Faulty, &rdev->flags)) {
1101 bio->bi_status = BLK_STS_IOERR; 1092 bio_io_error(bio);
1102 bio_endio(bio);
1103 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && 1093 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
1104 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 1094 !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
1105 /* Just ignore it */ 1095 /* Just ignore it */
@@ -2087,8 +2077,8 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
2087 rp = get_resync_pages(tbio); 2077 rp = get_resync_pages(tbio);
2088 bio_reset(tbio); 2078 bio_reset(tbio);
2089 2079
2090 tbio->bi_vcnt = vcnt; 2080 md_bio_reset_resync_pages(tbio, rp, fbio->bi_iter.bi_size);
2091 tbio->bi_iter.bi_size = fbio->bi_iter.bi_size; 2081
2092 rp->raid_bio = r10_bio; 2082 rp->raid_bio = r10_bio;
2093 tbio->bi_private = rp; 2083 tbio->bi_private = rp;
2094 tbio->bi_iter.bi_sector = r10_bio->devs[i].addr; 2084 tbio->bi_iter.bi_sector = r10_bio->devs[i].addr;
@@ -2853,6 +2843,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
2853 sector_t sectors_skipped = 0; 2843 sector_t sectors_skipped = 0;
2854 int chunks_skipped = 0; 2844 int chunks_skipped = 0;
2855 sector_t chunk_mask = conf->geo.chunk_mask; 2845 sector_t chunk_mask = conf->geo.chunk_mask;
2846 int page_idx = 0;
2856 2847
2857 if (!conf->r10buf_pool) 2848 if (!conf->r10buf_pool)
2858 if (init_resync(conf)) 2849 if (init_resync(conf))
@@ -3355,7 +3346,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
3355 break; 3346 break;
3356 for (bio= biolist ; bio ; bio=bio->bi_next) { 3347 for (bio= biolist ; bio ; bio=bio->bi_next) {
3357 struct resync_pages *rp = get_resync_pages(bio); 3348 struct resync_pages *rp = get_resync_pages(bio);
3358 page = resync_fetch_page(rp, rp->idx++); 3349 page = resync_fetch_page(rp, page_idx);
3359 /* 3350 /*
3360 * won't fail because the vec table is big enough 3351 * won't fail because the vec table is big enough
3361 * to hold all these pages 3352 * to hold all these pages
@@ -3364,7 +3355,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
3364 } 3355 }
3365 nr_sectors += len>>9; 3356 nr_sectors += len>>9;
3366 sector_nr += len>>9; 3357 sector_nr += len>>9;
3367 } while (get_resync_pages(biolist)->idx < RESYNC_PAGES); 3358 } while (++page_idx < RESYNC_PAGES);
3368 r10_bio->sectors = nr_sectors; 3359 r10_bio->sectors = nr_sectors;
3369 3360
3370 while (biolist) { 3361 while (biolist) {
diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
index 77cce3573aa8..44ad5baf3206 100644
--- a/drivers/md/raid5-ppl.c
+++ b/drivers/md/raid5-ppl.c
@@ -1150,7 +1150,7 @@ int ppl_init_log(struct r5conf *conf)
1150 goto err; 1150 goto err;
1151 } 1151 }
1152 1152
1153 ppl_conf->bs = bioset_create(conf->raid_disks, 0, 0); 1153 ppl_conf->bs = bioset_create(conf->raid_disks, 0, BIOSET_NEED_BVECS);
1154 if (!ppl_conf->bs) { 1154 if (!ppl_conf->bs) {
1155 ret = -ENOMEM; 1155 ret = -ENOMEM;
1156 goto err; 1156 goto err;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 2ceb338b094b..0fc2748aaf95 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3381,9 +3381,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
3381 sh->dev[i].sector + STRIPE_SECTORS) { 3381 sh->dev[i].sector + STRIPE_SECTORS) {
3382 struct bio *nextbi = r5_next_bio(bi, sh->dev[i].sector); 3382 struct bio *nextbi = r5_next_bio(bi, sh->dev[i].sector);
3383 3383
3384 bi->bi_status = BLK_STS_IOERR;
3385 md_write_end(conf->mddev); 3384 md_write_end(conf->mddev);
3386 bio_endio(bi); 3385 bio_io_error(bi);
3387 bi = nextbi; 3386 bi = nextbi;
3388 } 3387 }
3389 if (bitmap_end) 3388 if (bitmap_end)
@@ -3403,9 +3402,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
3403 sh->dev[i].sector + STRIPE_SECTORS) { 3402 sh->dev[i].sector + STRIPE_SECTORS) {
3404 struct bio *bi2 = r5_next_bio(bi, sh->dev[i].sector); 3403 struct bio *bi2 = r5_next_bio(bi, sh->dev[i].sector);
3405 3404
3406 bi->bi_status = BLK_STS_IOERR;
3407 md_write_end(conf->mddev); 3405 md_write_end(conf->mddev);
3408 bio_endio(bi); 3406 bio_io_error(bi);
3409 bi = bi2; 3407 bi = bi2;
3410 } 3408 }
3411 3409
@@ -3429,8 +3427,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
3429 struct bio *nextbi = 3427 struct bio *nextbi =
3430 r5_next_bio(bi, sh->dev[i].sector); 3428 r5_next_bio(bi, sh->dev[i].sector);
3431 3429
3432 bi->bi_status = BLK_STS_IOERR; 3430 bio_io_error(bi);
3433 bio_endio(bi);
3434 bi = nextbi; 3431 bi = nextbi;
3435 } 3432 }
3436 } 3433 }
@@ -6237,6 +6234,8 @@ static void raid5_do_work(struct work_struct *work)
6237 pr_debug("%d stripes handled\n", handled); 6234 pr_debug("%d stripes handled\n", handled);
6238 6235
6239 spin_unlock_irq(&conf->device_lock); 6236 spin_unlock_irq(&conf->device_lock);
6237
6238 async_tx_issue_pending_all();
6240 blk_finish_plug(&plug); 6239 blk_finish_plug(&plug);
6241 6240
6242 pr_debug("--- raid5worker inactive\n"); 6241 pr_debug("--- raid5worker inactive\n");
@@ -7951,12 +7950,10 @@ static void end_reshape(struct r5conf *conf)
7951{ 7950{
7952 7951
7953 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) { 7952 if (!test_bit(MD_RECOVERY_INTR, &conf->mddev->recovery)) {
7954 struct md_rdev *rdev;
7955 7953
7956 spin_lock_irq(&conf->device_lock); 7954 spin_lock_irq(&conf->device_lock);
7957 conf->previous_raid_disks = conf->raid_disks; 7955 conf->previous_raid_disks = conf->raid_disks;
7958 rdev_for_each(rdev, conf->mddev) 7956 md_finish_reshape(conf->mddev);
7959 rdev->data_offset = rdev->new_data_offset;
7960 smp_wmb(); 7957 smp_wmb();
7961 conf->reshape_progress = MaxSector; 7958 conf->reshape_progress = MaxSector;
7962 conf->mddev->reshape_position = MaxSector; 7959 conf->mddev->reshape_position = MaxSector;
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index a9dfb26972f2..250dc6ec4c82 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2957,7 +2957,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
2957 } 2957 }
2958 2958
2959 /* find out number of slots supported */ 2959 /* find out number of slots supported */
2960 if (device_property_read_u32(dev, "num-slots", &pdata->num_slots)) 2960 if (!device_property_read_u32(dev, "num-slots", &pdata->num_slots))
2961 dev_info(dev, "'num-slots' was deprecated.\n"); 2961 dev_info(dev, "'num-slots' was deprecated.\n");
2962 2962
2963 if (device_property_read_u32(dev, "fifo-depth", &pdata->fifo_depth)) 2963 if (device_property_read_u32(dev, "fifo-depth", &pdata->fifo_depth))
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7c12f3715676..04ff3c97a535 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -356,9 +356,6 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
356 struct mmc_host *mmc = host->mmc; 356 struct mmc_host *mmc = host->mmc;
357 int ret = 0; 357 int ret = 0;
358 358
359 if (mmc_pdata(host)->set_power)
360 return mmc_pdata(host)->set_power(host->dev, power_on, vdd);
361
362 /* 359 /*
363 * If we don't see a Vcc regulator, assume it's a fixed 360 * If we don't see a Vcc regulator, assume it's a fixed
364 * voltage always-on regulator. 361 * voltage always-on regulator.
@@ -366,9 +363,6 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
366 if (IS_ERR(mmc->supply.vmmc)) 363 if (IS_ERR(mmc->supply.vmmc))
367 return 0; 364 return 0;
368 365
369 if (mmc_pdata(host)->before_set_reg)
370 mmc_pdata(host)->before_set_reg(host->dev, power_on, vdd);
371
372 ret = omap_hsmmc_set_pbias(host, false, 0); 366 ret = omap_hsmmc_set_pbias(host, false, 0);
373 if (ret) 367 if (ret)
374 return ret; 368 return ret;
@@ -400,9 +394,6 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
400 return ret; 394 return ret;
401 } 395 }
402 396
403 if (mmc_pdata(host)->after_set_reg)
404 mmc_pdata(host)->after_set_reg(host->dev, power_on, vdd);
405
406 return 0; 397 return 0;
407 398
408err_set_voltage: 399err_set_voltage:
@@ -469,8 +460,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
469 int ret; 460 int ret;
470 struct mmc_host *mmc = host->mmc; 461 struct mmc_host *mmc = host->mmc;
471 462
472 if (mmc_pdata(host)->set_power)
473 return 0;
474 463
475 ret = mmc_regulator_get_supply(mmc); 464 ret = mmc_regulator_get_supply(mmc);
476 if (ret == -EPROBE_DEFER) 465 if (ret == -EPROBE_DEFER)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index d6fa2214aaae..0fb4e4c119e1 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -793,8 +793,12 @@ static int sunxi_mmc_clk_set_rate(struct sunxi_mmc_host *host,
793 } 793 }
794 mmc_writel(host, REG_CLKCR, rval); 794 mmc_writel(host, REG_CLKCR, rval);
795 795
796 if (host->cfg->needs_new_timings) 796 if (host->cfg->needs_new_timings) {
797 mmc_writel(host, REG_SD_NTSR, SDXC_2X_TIMING_MODE); 797 /* Don't touch the delay bits */
798 rval = mmc_readl(host, REG_SD_NTSR);
799 rval |= SDXC_2X_TIMING_MODE;
800 mmc_writel(host, REG_SD_NTSR, rval);
801 }
798 802
799 ret = sunxi_mmc_clk_set_phase(host, ios, rate); 803 ret = sunxi_mmc_clk_set_phase(host, ios, rate);
800 if (ret) 804 if (ret)
diff --git a/drivers/mux/Kconfig b/drivers/mux/Kconfig
index 7c754a0f14bb..19e4e904c9bf 100644
--- a/drivers/mux/Kconfig
+++ b/drivers/mux/Kconfig
@@ -2,20 +2,11 @@
2# Multiplexer devices 2# Multiplexer devices
3# 3#
4 4
5menuconfig MULTIPLEXER 5config MULTIPLEXER
6 tristate "Multiplexer subsystem" 6 tristate
7 help
8 Multiplexer controller subsystem. Multiplexers are used in a
9 variety of settings, and this subsystem abstracts their use
10 so that the rest of the kernel sees a common interface. When
11 multiple parallel multiplexers are controlled by one single
12 multiplexer controller, this subsystem also coordinates the
13 multiplexer accesses.
14
15 To compile the subsystem as a module, choose M here: the module will
16 be called mux-core.
17 7
18if MULTIPLEXER 8menu "Multiplexer drivers"
9 depends on MULTIPLEXER
19 10
20config MUX_ADG792A 11config MUX_ADG792A
21 tristate "Analog Devices ADG792A/ADG792G Multiplexers" 12 tristate "Analog Devices ADG792A/ADG792G Multiplexers"
@@ -56,4 +47,4 @@ config MUX_MMIO
56 To compile the driver as a module, choose M here: the module will 47 To compile the driver as a module, choose M here: the module will
57 be called mux-mmio. 48 be called mux-mmio.
58 49
59endif 50endmenu
diff --git a/drivers/mux/mux-core.c b/drivers/mux/mux-core.c
index 90b8995f07cb..2fe96c470112 100644
--- a/drivers/mux/mux-core.c
+++ b/drivers/mux/mux-core.c
@@ -46,7 +46,7 @@ static int __init mux_init(void)
46 46
47static void __exit mux_exit(void) 47static void __exit mux_exit(void)
48{ 48{
49 class_register(&mux_class); 49 class_unregister(&mux_class);
50 ida_destroy(&mux_ida); 50 ida_destroy(&mux_ida);
51} 51}
52 52
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 14ff622190a5..181839d6fbea 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4596,7 +4596,7 @@ static int bond_check_params(struct bond_params *params)
4596 } 4596 }
4597 ad_user_port_key = valptr->value; 4597 ad_user_port_key = valptr->value;
4598 4598
4599 if (bond_mode == BOND_MODE_TLB) { 4599 if ((bond_mode == BOND_MODE_TLB) || (bond_mode == BOND_MODE_ALB)) {
4600 bond_opt_initstr(&newval, "default"); 4600 bond_opt_initstr(&newval, "default");
4601 valptr = bond_opt_parse(bond_opt_get(BOND_OPT_TLB_DYNAMIC_LB), 4601 valptr = bond_opt_parse(bond_opt_get(BOND_OPT_TLB_DYNAMIC_LB),
4602 &newval); 4602 &newval);
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index e68d368e20ac..7f36d3e3c98b 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1665,6 +1665,7 @@ static const struct b53_chip_data b53_switch_chips[] = {
1665 .dev_name = "BCM53125", 1665 .dev_name = "BCM53125",
1666 .vlans = 4096, 1666 .vlans = 4096,
1667 .enabled_ports = 0xff, 1667 .enabled_ports = 0xff,
1668 .arl_entries = 4,
1668 .cpu_port = B53_CPU_PORT, 1669 .cpu_port = B53_CPU_PORT,
1669 .vta_regs = B53_VTA_REGS, 1670 .vta_regs = B53_VTA_REGS,
1670 .duplex_reg = B53_DUPLEX_STAT_GE, 1671 .duplex_reg = B53_DUPLEX_STAT_GE,
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 53b088166c28..5bcdd33101b0 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3178,6 +3178,7 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = {
3178 .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, 3178 .port_set_jumbo_size = mv88e6165_port_set_jumbo_size,
3179 .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, 3179 .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
3180 .port_pause_limit = mv88e6390_port_pause_limit, 3180 .port_pause_limit = mv88e6390_port_pause_limit,
3181 .port_set_cmode = mv88e6390x_port_set_cmode,
3181 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, 3182 .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit,
3182 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, 3183 .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
3183 .stats_snapshot = mv88e6390_g1_stats_snapshot, 3184 .stats_snapshot = mv88e6390_g1_stats_snapshot,
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index d3906f6b01bd..86058a9f3417 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1785,16 +1785,18 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
1785 1785
1786 xgene_enet_gpiod_get(pdata); 1786 xgene_enet_gpiod_get(pdata);
1787 1787
1788 pdata->clk = devm_clk_get(&pdev->dev, NULL); 1788 if (pdata->phy_mode != PHY_INTERFACE_MODE_SGMII) {
1789 if (IS_ERR(pdata->clk)) { 1789 pdata->clk = devm_clk_get(&pdev->dev, NULL);
1790 /* Abort if the clock is defined but couldn't be retrived. 1790 if (IS_ERR(pdata->clk)) {
1791 * Always abort if the clock is missing on DT system as 1791 /* Abort if the clock is defined but couldn't be
1792 * the driver can't cope with this case. 1792 * retrived. Always abort if the clock is missing on
1793 */ 1793 * DT system as the driver can't cope with this case.
1794 if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node) 1794 */
1795 return PTR_ERR(pdata->clk); 1795 if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node)
1796 /* Firmware may have set up the clock already. */ 1796 return PTR_ERR(pdata->clk);
1797 dev_info(dev, "clocks have been setup already\n"); 1797 /* Firmware may have set up the clock already. */
1798 dev_info(dev, "clocks have been setup already\n");
1799 }
1798 } 1800 }
1799 1801
1800 if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) 1802 if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 73aca97a96bc..d937083db9a4 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -50,11 +50,14 @@ static u32 platform_bgmac_idm_read(struct bgmac *bgmac, u16 offset)
50 50
51static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value) 51static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
52{ 52{
53 return writel(value, bgmac->plat.idm_base + offset); 53 writel(value, bgmac->plat.idm_base + offset);
54} 54}
55 55
56static bool platform_bgmac_clk_enabled(struct bgmac *bgmac) 56static bool platform_bgmac_clk_enabled(struct bgmac *bgmac)
57{ 57{
58 if (!bgmac->plat.idm_base)
59 return true;
60
58 if ((bgmac_idm_read(bgmac, BCMA_IOCTL) & BGMAC_CLK_EN) != BGMAC_CLK_EN) 61 if ((bgmac_idm_read(bgmac, BCMA_IOCTL) & BGMAC_CLK_EN) != BGMAC_CLK_EN)
59 return false; 62 return false;
60 if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET) 63 if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
@@ -66,6 +69,9 @@ static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
66{ 69{
67 u32 val; 70 u32 val;
68 71
72 if (!bgmac->plat.idm_base)
73 return;
74
69 /* The Reset Control register only contains a single bit to show if the 75 /* The Reset Control register only contains a single bit to show if the
70 * controller is currently in reset. Do a sanity check here, just in 76 * controller is currently in reset. Do a sanity check here, just in
71 * case the bootloader happened to leave the device in reset. 77 * case the bootloader happened to leave the device in reset.
@@ -180,6 +186,7 @@ static int bgmac_probe(struct platform_device *pdev)
180 bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4; 186 bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
181 bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP; 187 bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
182 bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP; 188 bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
189 bgmac->feature_flags |= BGMAC_FEAT_IDM_MASK;
183 190
184 bgmac->dev = &pdev->dev; 191 bgmac->dev = &pdev->dev;
185 bgmac->dma_dev = &pdev->dev; 192 bgmac->dma_dev = &pdev->dev;
@@ -207,15 +214,13 @@ static int bgmac_probe(struct platform_device *pdev)
207 return PTR_ERR(bgmac->plat.base); 214 return PTR_ERR(bgmac->plat.base);
208 215
209 regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base"); 216 regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
210 if (!regs) { 217 if (regs) {
211 dev_err(&pdev->dev, "Unable to obtain idm resource\n"); 218 bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
212 return -EINVAL; 219 if (IS_ERR(bgmac->plat.idm_base))
220 return PTR_ERR(bgmac->plat.idm_base);
221 bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
213 } 222 }
214 223
215 bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
216 if (IS_ERR(bgmac->plat.idm_base))
217 return PTR_ERR(bgmac->plat.idm_base);
218
219 regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base"); 224 regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
220 if (regs) { 225 if (regs) {
221 bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev, 226 bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index ba4d2e145bb9..48d672b204a4 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -622,9 +622,11 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
622 BUILD_BUG_ON(BGMAC_MAX_TX_RINGS > ARRAY_SIZE(ring_base)); 622 BUILD_BUG_ON(BGMAC_MAX_TX_RINGS > ARRAY_SIZE(ring_base));
623 BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base)); 623 BUILD_BUG_ON(BGMAC_MAX_RX_RINGS > ARRAY_SIZE(ring_base));
624 624
625 if (!(bgmac_idm_read(bgmac, BCMA_IOST) & BCMA_IOST_DMA64)) { 625 if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) {
626 dev_err(bgmac->dev, "Core does not report 64-bit DMA\n"); 626 if (!(bgmac_idm_read(bgmac, BCMA_IOST) & BCMA_IOST_DMA64)) {
627 return -ENOTSUPP; 627 dev_err(bgmac->dev, "Core does not report 64-bit DMA\n");
628 return -ENOTSUPP;
629 }
628 } 630 }
629 631
630 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) { 632 for (i = 0; i < BGMAC_MAX_TX_RINGS; i++) {
@@ -855,9 +857,11 @@ static void bgmac_mac_speed(struct bgmac *bgmac)
855static void bgmac_miiconfig(struct bgmac *bgmac) 857static void bgmac_miiconfig(struct bgmac *bgmac)
856{ 858{
857 if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) { 859 if (bgmac->feature_flags & BGMAC_FEAT_FORCE_SPEED_2500) {
858 bgmac_idm_write(bgmac, BCMA_IOCTL, 860 if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) {
859 bgmac_idm_read(bgmac, BCMA_IOCTL) | 0x40 | 861 bgmac_idm_write(bgmac, BCMA_IOCTL,
860 BGMAC_BCMA_IOCTL_SW_CLKEN); 862 bgmac_idm_read(bgmac, BCMA_IOCTL) |
863 0x40 | BGMAC_BCMA_IOCTL_SW_CLKEN);
864 }
861 bgmac->mac_speed = SPEED_2500; 865 bgmac->mac_speed = SPEED_2500;
862 bgmac->mac_duplex = DUPLEX_FULL; 866 bgmac->mac_duplex = DUPLEX_FULL;
863 bgmac_mac_speed(bgmac); 867 bgmac_mac_speed(bgmac);
@@ -874,11 +878,36 @@ static void bgmac_miiconfig(struct bgmac *bgmac)
874 } 878 }
875} 879}
876 880
881static void bgmac_chip_reset_idm_config(struct bgmac *bgmac)
882{
883 u32 iost;
884
885 iost = bgmac_idm_read(bgmac, BCMA_IOST);
886 if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED)
887 iost &= ~BGMAC_BCMA_IOST_ATTACHED;
888
889 /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
890 if (!(bgmac->feature_flags & BGMAC_FEAT_NO_RESET)) {
891 u32 flags = 0;
892
893 if (iost & BGMAC_BCMA_IOST_ATTACHED) {
894 flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
895 if (!bgmac->has_robosw)
896 flags |= BGMAC_BCMA_IOCTL_SW_RESET;
897 }
898 bgmac_clk_enable(bgmac, flags);
899 }
900
901 if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
902 bgmac_idm_write(bgmac, BCMA_IOCTL,
903 bgmac_idm_read(bgmac, BCMA_IOCTL) &
904 ~BGMAC_BCMA_IOCTL_SW_RESET);
905}
906
877/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipreset */ 907/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipreset */
878static void bgmac_chip_reset(struct bgmac *bgmac) 908static void bgmac_chip_reset(struct bgmac *bgmac)
879{ 909{
880 u32 cmdcfg_sr; 910 u32 cmdcfg_sr;
881 u32 iost;
882 int i; 911 int i;
883 912
884 if (bgmac_clk_enabled(bgmac)) { 913 if (bgmac_clk_enabled(bgmac)) {
@@ -899,20 +928,8 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
899 /* TODO: Clear software multicast filter list */ 928 /* TODO: Clear software multicast filter list */
900 } 929 }
901 930
902 iost = bgmac_idm_read(bgmac, BCMA_IOST); 931 if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK))
903 if (bgmac->feature_flags & BGMAC_FEAT_IOST_ATTACHED) 932 bgmac_chip_reset_idm_config(bgmac);
904 iost &= ~BGMAC_BCMA_IOST_ATTACHED;
905
906 /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
907 if (!(bgmac->feature_flags & BGMAC_FEAT_NO_RESET)) {
908 u32 flags = 0;
909 if (iost & BGMAC_BCMA_IOST_ATTACHED) {
910 flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
911 if (!bgmac->has_robosw)
912 flags |= BGMAC_BCMA_IOCTL_SW_RESET;
913 }
914 bgmac_clk_enable(bgmac, flags);
915 }
916 933
917 /* Request Misc PLL for corerev > 2 */ 934 /* Request Misc PLL for corerev > 2 */
918 if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) { 935 if (bgmac->feature_flags & BGMAC_FEAT_MISC_PLL_REQ) {
@@ -970,11 +987,6 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
970 BGMAC_CHIPCTL_7_IF_TYPE_RGMII); 987 BGMAC_CHIPCTL_7_IF_TYPE_RGMII);
971 } 988 }
972 989
973 if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
974 bgmac_idm_write(bgmac, BCMA_IOCTL,
975 bgmac_idm_read(bgmac, BCMA_IOCTL) &
976 ~BGMAC_BCMA_IOCTL_SW_RESET);
977
978 /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_reset 990 /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/gmac_reset
979 * Specs don't say about using BGMAC_CMDCFG_SR, but in this routine 991 * Specs don't say about using BGMAC_CMDCFG_SR, but in this routine
980 * BGMAC_CMDCFG is read _after_ putting chip in a reset. So it has to 992 * BGMAC_CMDCFG is read _after_ putting chip in a reset. So it has to
@@ -1497,8 +1509,10 @@ int bgmac_enet_probe(struct bgmac *bgmac)
1497 bgmac_clk_enable(bgmac, 0); 1509 bgmac_clk_enable(bgmac, 0);
1498 1510
1499 /* This seems to be fixing IRQ by assigning OOB #6 to the core */ 1511 /* This seems to be fixing IRQ by assigning OOB #6 to the core */
1500 if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6) 1512 if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) {
1501 bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86); 1513 if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)
1514 bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86);
1515 }
1502 1516
1503 bgmac_chip_reset(bgmac); 1517 bgmac_chip_reset(bgmac);
1504 1518
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h
index c1818766c501..443d57b10264 100644
--- a/drivers/net/ethernet/broadcom/bgmac.h
+++ b/drivers/net/ethernet/broadcom/bgmac.h
@@ -425,6 +425,7 @@
425#define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17) 425#define BGMAC_FEAT_CC4_IF_SW_TYPE BIT(17)
426#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18) 426#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII BIT(18)
427#define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19) 427#define BGMAC_FEAT_CC7_IF_TYPE_RGMII BIT(19)
428#define BGMAC_FEAT_IDM_MASK BIT(20)
428 429
429struct bgmac_slot_info { 430struct bgmac_slot_info {
430 union { 431 union {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 43423744fdfa..1e33abde4a3e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -2886,7 +2886,7 @@ static int bnx2x_test_nvram_tbl(struct bnx2x *bp,
2886 2886
2887static int bnx2x_test_nvram(struct bnx2x *bp) 2887static int bnx2x_test_nvram(struct bnx2x *bp)
2888{ 2888{
2889 const struct crc_pair nvram_tbl[] = { 2889 static const struct crc_pair nvram_tbl[] = {
2890 { 0, 0x14 }, /* bootstrap */ 2890 { 0, 0x14 }, /* bootstrap */
2891 { 0x14, 0xec }, /* dir */ 2891 { 0x14, 0xec }, /* dir */
2892 { 0x100, 0x350 }, /* manuf_info */ 2892 { 0x100, 0x350 }, /* manuf_info */
@@ -2895,7 +2895,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
2895 { 0x708, 0x70 }, /* manuf_key_info */ 2895 { 0x708, 0x70 }, /* manuf_key_info */
2896 { 0, 0 } 2896 { 0, 0 }
2897 }; 2897 };
2898 const struct crc_pair nvram_tbl2[] = { 2898 static const struct crc_pair nvram_tbl2[] = {
2899 { 0x7e8, 0x350 }, /* manuf_info2 */ 2899 { 0x7e8, 0x350 }, /* manuf_info2 */
2900 { 0xb38, 0xf0 }, /* feature_info */ 2900 { 0xb38, 0xf0 }, /* feature_info */
2901 { 0, 0 } 2901 { 0, 0 }
@@ -3162,7 +3162,8 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
3162 if (is_multi(bp)) { 3162 if (is_multi(bp)) {
3163 for_each_eth_queue(bp, i) { 3163 for_each_eth_queue(bp, i) {
3164 memset(queue_name, 0, sizeof(queue_name)); 3164 memset(queue_name, 0, sizeof(queue_name));
3165 sprintf(queue_name, "%d", i); 3165 snprintf(queue_name, sizeof(queue_name),
3166 "%d", i);
3166 for (j = 0; j < BNX2X_NUM_Q_STATS; j++) 3167 for (j = 0; j < BNX2X_NUM_Q_STATS; j++)
3167 snprintf(buf + (k + j)*ETH_GSTRING_LEN, 3168 snprintf(buf + (k + j)*ETH_GSTRING_LEN,
3168 ETH_GSTRING_LEN, 3169 ETH_GSTRING_LEN,
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index daca1c9d254b..7b0b399aaedd 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1202,12 +1202,21 @@ static struct enet_cb *bcmgenet_get_txcb(struct bcmgenet_priv *priv,
1202 return tx_cb_ptr; 1202 return tx_cb_ptr;
1203} 1203}
1204 1204
1205/* Simple helper to free a control block's resources */ 1205static struct enet_cb *bcmgenet_put_txcb(struct bcmgenet_priv *priv,
1206static void bcmgenet_free_cb(struct enet_cb *cb) 1206 struct bcmgenet_tx_ring *ring)
1207{ 1207{
1208 dev_kfree_skb_any(cb->skb); 1208 struct enet_cb *tx_cb_ptr;
1209 cb->skb = NULL; 1209
1210 dma_unmap_addr_set(cb, dma_addr, 0); 1210 tx_cb_ptr = ring->cbs;
1211 tx_cb_ptr += ring->write_ptr - ring->cb_ptr;
1212
1213 /* Rewinding local write pointer */
1214 if (ring->write_ptr == ring->cb_ptr)
1215 ring->write_ptr = ring->end_ptr;
1216 else
1217 ring->write_ptr--;
1218
1219 return tx_cb_ptr;
1211} 1220}
1212 1221
1213static inline void bcmgenet_rx_ring16_int_disable(struct bcmgenet_rx_ring *ring) 1222static inline void bcmgenet_rx_ring16_int_disable(struct bcmgenet_rx_ring *ring)
@@ -1260,18 +1269,72 @@ static inline void bcmgenet_tx_ring_int_disable(struct bcmgenet_tx_ring *ring)
1260 INTRL2_CPU_MASK_SET); 1269 INTRL2_CPU_MASK_SET);
1261} 1270}
1262 1271
1272/* Simple helper to free a transmit control block's resources
1273 * Returns an skb when the last transmit control block associated with the
1274 * skb is freed. The skb should be freed by the caller if necessary.
1275 */
1276static struct sk_buff *bcmgenet_free_tx_cb(struct device *dev,
1277 struct enet_cb *cb)
1278{
1279 struct sk_buff *skb;
1280
1281 skb = cb->skb;
1282
1283 if (skb) {
1284 cb->skb = NULL;
1285 if (cb == GENET_CB(skb)->first_cb)
1286 dma_unmap_single(dev, dma_unmap_addr(cb, dma_addr),
1287 dma_unmap_len(cb, dma_len),
1288 DMA_TO_DEVICE);
1289 else
1290 dma_unmap_page(dev, dma_unmap_addr(cb, dma_addr),
1291 dma_unmap_len(cb, dma_len),
1292 DMA_TO_DEVICE);
1293 dma_unmap_addr_set(cb, dma_addr, 0);
1294
1295 if (cb == GENET_CB(skb)->last_cb)
1296 return skb;
1297
1298 } else if (dma_unmap_addr(cb, dma_addr)) {
1299 dma_unmap_page(dev,
1300 dma_unmap_addr(cb, dma_addr),
1301 dma_unmap_len(cb, dma_len),
1302 DMA_TO_DEVICE);
1303 dma_unmap_addr_set(cb, dma_addr, 0);
1304 }
1305
1306 return 0;
1307}
1308
1309/* Simple helper to free a receive control block's resources */
1310static struct sk_buff *bcmgenet_free_rx_cb(struct device *dev,
1311 struct enet_cb *cb)
1312{
1313 struct sk_buff *skb;
1314
1315 skb = cb->skb;
1316 cb->skb = NULL;
1317
1318 if (dma_unmap_addr(cb, dma_addr)) {
1319 dma_unmap_single(dev, dma_unmap_addr(cb, dma_addr),
1320 dma_unmap_len(cb, dma_len), DMA_FROM_DEVICE);
1321 dma_unmap_addr_set(cb, dma_addr, 0);
1322 }
1323
1324 return skb;
1325}
1326
1263/* Unlocked version of the reclaim routine */ 1327/* Unlocked version of the reclaim routine */
1264static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev, 1328static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
1265 struct bcmgenet_tx_ring *ring) 1329 struct bcmgenet_tx_ring *ring)
1266{ 1330{
1267 struct bcmgenet_priv *priv = netdev_priv(dev); 1331 struct bcmgenet_priv *priv = netdev_priv(dev);
1268 struct device *kdev = &priv->pdev->dev; 1332 unsigned int txbds_processed = 0;
1269 struct enet_cb *tx_cb_ptr;
1270 unsigned int pkts_compl = 0;
1271 unsigned int bytes_compl = 0; 1333 unsigned int bytes_compl = 0;
1272 unsigned int c_index; 1334 unsigned int pkts_compl = 0;
1273 unsigned int txbds_ready; 1335 unsigned int txbds_ready;
1274 unsigned int txbds_processed = 0; 1336 unsigned int c_index;
1337 struct sk_buff *skb;
1275 1338
1276 /* Clear status before servicing to reduce spurious interrupts */ 1339 /* Clear status before servicing to reduce spurious interrupts */
1277 if (ring->index == DESC_INDEX) 1340 if (ring->index == DESC_INDEX)
@@ -1292,21 +1355,12 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
1292 1355
1293 /* Reclaim transmitted buffers */ 1356 /* Reclaim transmitted buffers */
1294 while (txbds_processed < txbds_ready) { 1357 while (txbds_processed < txbds_ready) {
1295 tx_cb_ptr = &priv->tx_cbs[ring->clean_ptr]; 1358 skb = bcmgenet_free_tx_cb(&priv->pdev->dev,
1296 if (tx_cb_ptr->skb) { 1359 &priv->tx_cbs[ring->clean_ptr]);
1360 if (skb) {
1297 pkts_compl++; 1361 pkts_compl++;
1298 bytes_compl += GENET_CB(tx_cb_ptr->skb)->bytes_sent; 1362 bytes_compl += GENET_CB(skb)->bytes_sent;
1299 dma_unmap_single(kdev, 1363 dev_kfree_skb_any(skb);
1300 dma_unmap_addr(tx_cb_ptr, dma_addr),
1301 dma_unmap_len(tx_cb_ptr, dma_len),
1302 DMA_TO_DEVICE);
1303 bcmgenet_free_cb(tx_cb_ptr);
1304 } else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {
1305 dma_unmap_page(kdev,
1306 dma_unmap_addr(tx_cb_ptr, dma_addr),
1307 dma_unmap_len(tx_cb_ptr, dma_len),
1308 DMA_TO_DEVICE);
1309 dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0);
1310 } 1364 }
1311 1365
1312 txbds_processed++; 1366 txbds_processed++;
@@ -1380,95 +1434,6 @@ static void bcmgenet_tx_reclaim_all(struct net_device *dev)
1380 bcmgenet_tx_reclaim(dev, &priv->tx_rings[DESC_INDEX]); 1434 bcmgenet_tx_reclaim(dev, &priv->tx_rings[DESC_INDEX]);
1381} 1435}
1382 1436
1383/* Transmits a single SKB (either head of a fragment or a single SKB)
1384 * caller must hold priv->lock
1385 */
1386static int bcmgenet_xmit_single(struct net_device *dev,
1387 struct sk_buff *skb,
1388 u16 dma_desc_flags,
1389 struct bcmgenet_tx_ring *ring)
1390{
1391 struct bcmgenet_priv *priv = netdev_priv(dev);
1392 struct device *kdev = &priv->pdev->dev;
1393 struct enet_cb *tx_cb_ptr;
1394 unsigned int skb_len;
1395 dma_addr_t mapping;
1396 u32 length_status;
1397 int ret;
1398
1399 tx_cb_ptr = bcmgenet_get_txcb(priv, ring);
1400
1401 if (unlikely(!tx_cb_ptr))
1402 BUG();
1403
1404 tx_cb_ptr->skb = skb;
1405
1406 skb_len = skb_headlen(skb);
1407
1408 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
1409 ret = dma_mapping_error(kdev, mapping);
1410 if (ret) {
1411 priv->mib.tx_dma_failed++;
1412 netif_err(priv, tx_err, dev, "Tx DMA map failed\n");
1413 dev_kfree_skb(skb);
1414 return ret;
1415 }
1416
1417 dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping);
1418 dma_unmap_len_set(tx_cb_ptr, dma_len, skb_len);
1419 length_status = (skb_len << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
1420 (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT) |
1421 DMA_TX_APPEND_CRC;
1422
1423 if (skb->ip_summed == CHECKSUM_PARTIAL)
1424 length_status |= DMA_TX_DO_CSUM;
1425
1426 dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping, length_status);
1427
1428 return 0;
1429}
1430
1431/* Transmit a SKB fragment */
1432static int bcmgenet_xmit_frag(struct net_device *dev,
1433 skb_frag_t *frag,
1434 u16 dma_desc_flags,
1435 struct bcmgenet_tx_ring *ring)
1436{
1437 struct bcmgenet_priv *priv = netdev_priv(dev);
1438 struct device *kdev = &priv->pdev->dev;
1439 struct enet_cb *tx_cb_ptr;
1440 unsigned int frag_size;
1441 dma_addr_t mapping;
1442 int ret;
1443
1444 tx_cb_ptr = bcmgenet_get_txcb(priv, ring);
1445
1446 if (unlikely(!tx_cb_ptr))
1447 BUG();
1448
1449 tx_cb_ptr->skb = NULL;
1450
1451 frag_size = skb_frag_size(frag);
1452
1453 mapping = skb_frag_dma_map(kdev, frag, 0, frag_size, DMA_TO_DEVICE);
1454 ret = dma_mapping_error(kdev, mapping);
1455 if (ret) {
1456 priv->mib.tx_dma_failed++;
1457 netif_err(priv, tx_err, dev, "%s: Tx DMA map failed\n",
1458 __func__);
1459 return ret;
1460 }
1461
1462 dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping);
1463 dma_unmap_len_set(tx_cb_ptr, dma_len, frag_size);
1464
1465 dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping,
1466 (frag_size << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
1467 (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT));
1468
1469 return 0;
1470}
1471
1472/* Reallocate the SKB to put enough headroom in front of it and insert 1437/* Reallocate the SKB to put enough headroom in front of it and insert
1473 * the transmit checksum offsets in the descriptors 1438 * the transmit checksum offsets in the descriptors
1474 */ 1439 */
@@ -1535,11 +1500,16 @@ static struct sk_buff *bcmgenet_put_tx_csum(struct net_device *dev,
1535static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) 1500static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
1536{ 1501{
1537 struct bcmgenet_priv *priv = netdev_priv(dev); 1502 struct bcmgenet_priv *priv = netdev_priv(dev);
1503 struct device *kdev = &priv->pdev->dev;
1538 struct bcmgenet_tx_ring *ring = NULL; 1504 struct bcmgenet_tx_ring *ring = NULL;
1505 struct enet_cb *tx_cb_ptr;
1539 struct netdev_queue *txq; 1506 struct netdev_queue *txq;
1540 unsigned long flags = 0; 1507 unsigned long flags = 0;
1541 int nr_frags, index; 1508 int nr_frags, index;
1542 u16 dma_desc_flags; 1509 dma_addr_t mapping;
1510 unsigned int size;
1511 skb_frag_t *frag;
1512 u32 len_stat;
1543 int ret; 1513 int ret;
1544 int i; 1514 int i;
1545 1515
@@ -1592,29 +1562,53 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
1592 } 1562 }
1593 } 1563 }
1594 1564
1595 dma_desc_flags = DMA_SOP; 1565 for (i = 0; i <= nr_frags; i++) {
1596 if (nr_frags == 0) 1566 tx_cb_ptr = bcmgenet_get_txcb(priv, ring);
1597 dma_desc_flags |= DMA_EOP;
1598 1567
1599 /* Transmit single SKB or head of fragment list */ 1568 if (unlikely(!tx_cb_ptr))
1600 ret = bcmgenet_xmit_single(dev, skb, dma_desc_flags, ring); 1569 BUG();
1601 if (ret) { 1570
1602 ret = NETDEV_TX_OK; 1571 if (!i) {
1603 goto out; 1572 /* Transmit single SKB or head of fragment list */
1604 } 1573 GENET_CB(skb)->first_cb = tx_cb_ptr;
1574 size = skb_headlen(skb);
1575 mapping = dma_map_single(kdev, skb->data, size,
1576 DMA_TO_DEVICE);
1577 } else {
1578 /* xmit fragment */
1579 frag = &skb_shinfo(skb)->frags[i - 1];
1580 size = skb_frag_size(frag);
1581 mapping = skb_frag_dma_map(kdev, frag, 0, size,
1582 DMA_TO_DEVICE);
1583 }
1605 1584
1606 /* xmit fragment */ 1585 ret = dma_mapping_error(kdev, mapping);
1607 for (i = 0; i < nr_frags; i++) {
1608 ret = bcmgenet_xmit_frag(dev,
1609 &skb_shinfo(skb)->frags[i],
1610 (i == nr_frags - 1) ? DMA_EOP : 0,
1611 ring);
1612 if (ret) { 1586 if (ret) {
1587 priv->mib.tx_dma_failed++;
1588 netif_err(priv, tx_err, dev, "Tx DMA map failed\n");
1613 ret = NETDEV_TX_OK; 1589 ret = NETDEV_TX_OK;
1614 goto out; 1590 goto out_unmap_frags;
1591 }
1592 dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping);
1593 dma_unmap_len_set(tx_cb_ptr, dma_len, size);
1594
1595 tx_cb_ptr->skb = skb;
1596
1597 len_stat = (size << DMA_BUFLENGTH_SHIFT) |
1598 (priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT);
1599
1600 if (!i) {
1601 len_stat |= DMA_TX_APPEND_CRC | DMA_SOP;
1602 if (skb->ip_summed == CHECKSUM_PARTIAL)
1603 len_stat |= DMA_TX_DO_CSUM;
1615 } 1604 }
1605 if (i == nr_frags)
1606 len_stat |= DMA_EOP;
1607
1608 dmadesc_set(priv, tx_cb_ptr->bd_addr, mapping, len_stat);
1616 } 1609 }
1617 1610
1611 GENET_CB(skb)->last_cb = tx_cb_ptr;
1618 skb_tx_timestamp(skb); 1612 skb_tx_timestamp(skb);
1619 1613
1620 /* Decrement total BD count and advance our write pointer */ 1614 /* Decrement total BD count and advance our write pointer */
@@ -1635,6 +1629,19 @@ out:
1635 spin_unlock_irqrestore(&ring->lock, flags); 1629 spin_unlock_irqrestore(&ring->lock, flags);
1636 1630
1637 return ret; 1631 return ret;
1632
1633out_unmap_frags:
1634 /* Back up for failed control block mapping */
1635 bcmgenet_put_txcb(priv, ring);
1636
1637 /* Unmap successfully mapped control blocks */
1638 while (i-- > 0) {
1639 tx_cb_ptr = bcmgenet_put_txcb(priv, ring);
1640 bcmgenet_free_tx_cb(kdev, tx_cb_ptr);
1641 }
1642
1643 dev_kfree_skb(skb);
1644 goto out;
1638} 1645}
1639 1646
1640static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv, 1647static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv,
@@ -1666,14 +1673,12 @@ static struct sk_buff *bcmgenet_rx_refill(struct bcmgenet_priv *priv,
1666 } 1673 }
1667 1674
1668 /* Grab the current Rx skb from the ring and DMA-unmap it */ 1675 /* Grab the current Rx skb from the ring and DMA-unmap it */
1669 rx_skb = cb->skb; 1676 rx_skb = bcmgenet_free_rx_cb(kdev, cb);
1670 if (likely(rx_skb))
1671 dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
1672 priv->rx_buf_len, DMA_FROM_DEVICE);
1673 1677
1674 /* Put the new Rx skb on the ring */ 1678 /* Put the new Rx skb on the ring */
1675 cb->skb = skb; 1679 cb->skb = skb;
1676 dma_unmap_addr_set(cb, dma_addr, mapping); 1680 dma_unmap_addr_set(cb, dma_addr, mapping);
1681 dma_unmap_len_set(cb, dma_len, priv->rx_buf_len);
1677 dmadesc_set_addr(priv, cb->bd_addr, mapping); 1682 dmadesc_set_addr(priv, cb->bd_addr, mapping);
1678 1683
1679 /* Return the current Rx skb to caller */ 1684 /* Return the current Rx skb to caller */
@@ -1880,22 +1885,16 @@ static int bcmgenet_alloc_rx_buffers(struct bcmgenet_priv *priv,
1880 1885
1881static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv) 1886static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv)
1882{ 1887{
1883 struct device *kdev = &priv->pdev->dev; 1888 struct sk_buff *skb;
1884 struct enet_cb *cb; 1889 struct enet_cb *cb;
1885 int i; 1890 int i;
1886 1891
1887 for (i = 0; i < priv->num_rx_bds; i++) { 1892 for (i = 0; i < priv->num_rx_bds; i++) {
1888 cb = &priv->rx_cbs[i]; 1893 cb = &priv->rx_cbs[i];
1889 1894
1890 if (dma_unmap_addr(cb, dma_addr)) { 1895 skb = bcmgenet_free_rx_cb(&priv->pdev->dev, cb);
1891 dma_unmap_single(kdev, 1896 if (skb)
1892 dma_unmap_addr(cb, dma_addr), 1897 dev_kfree_skb_any(skb);
1893 priv->rx_buf_len, DMA_FROM_DEVICE);
1894 dma_unmap_addr_set(cb, dma_addr, 0);
1895 }
1896
1897 if (cb->skb)
1898 bcmgenet_free_cb(cb);
1899 } 1898 }
1900} 1899}
1901 1900
@@ -2479,8 +2478,10 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
2479 2478
2480static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) 2479static void bcmgenet_fini_dma(struct bcmgenet_priv *priv)
2481{ 2480{
2482 int i;
2483 struct netdev_queue *txq; 2481 struct netdev_queue *txq;
2482 struct sk_buff *skb;
2483 struct enet_cb *cb;
2484 int i;
2484 2485
2485 bcmgenet_fini_rx_napi(priv); 2486 bcmgenet_fini_rx_napi(priv);
2486 bcmgenet_fini_tx_napi(priv); 2487 bcmgenet_fini_tx_napi(priv);
@@ -2489,10 +2490,10 @@ static void bcmgenet_fini_dma(struct bcmgenet_priv *priv)
2489 bcmgenet_dma_teardown(priv); 2490 bcmgenet_dma_teardown(priv);
2490 2491
2491 for (i = 0; i < priv->num_tx_bds; i++) { 2492 for (i = 0; i < priv->num_tx_bds; i++) {
2492 if (priv->tx_cbs[i].skb != NULL) { 2493 cb = priv->tx_cbs + i;
2493 dev_kfree_skb(priv->tx_cbs[i].skb); 2494 skb = bcmgenet_free_tx_cb(&priv->pdev->dev, cb);
2494 priv->tx_cbs[i].skb = NULL; 2495 if (skb)
2495 } 2496 dev_kfree_skb(skb);
2496 } 2497 }
2497 2498
2498 for (i = 0; i < priv->hw_params->tx_queues; i++) { 2499 for (i = 0; i < priv->hw_params->tx_queues; i++) {
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index efd07020b89f..b9344de669f8 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -544,6 +544,8 @@ struct bcmgenet_hw_params {
544}; 544};
545 545
546struct bcmgenet_skb_cb { 546struct bcmgenet_skb_cb {
547 struct enet_cb *first_cb; /* First control block of SKB */
548 struct enet_cb *last_cb; /* Last control block of SKB */
547 unsigned int bytes_sent; /* bytes on the wire (no TSB) */ 549 unsigned int bytes_sent; /* bytes on the wire (no TSB) */
548}; 550};
549 551
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
index 28ecda3d3404..ebd353bc78ff 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_ethtool.c
@@ -335,7 +335,7 @@ lio_ethtool_get_channels(struct net_device *dev,
335 335
336static int lio_get_eeprom_len(struct net_device *netdev) 336static int lio_get_eeprom_len(struct net_device *netdev)
337{ 337{
338 u8 buf[128]; 338 u8 buf[192];
339 struct lio *lio = GET_LIO(netdev); 339 struct lio *lio = GET_LIO(netdev);
340 struct octeon_device *oct_dev = lio->oct_dev; 340 struct octeon_device *oct_dev = lio->oct_dev;
341 struct octeon_board_info *board_info; 341 struct octeon_board_info *board_info;
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index a0ca68ce3fbb..79112563a25a 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1008,7 +1008,7 @@ static void bgx_print_qlm_mode(struct bgx *bgx, u8 lmacid)
1008{ 1008{
1009 struct device *dev = &bgx->pdev->dev; 1009 struct device *dev = &bgx->pdev->dev;
1010 struct lmac *lmac; 1010 struct lmac *lmac;
1011 char str[20]; 1011 char str[27];
1012 1012
1013 if (!bgx->is_dlm && lmacid) 1013 if (!bgx->is_dlm && lmacid)
1014 return; 1014 return;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
index 50517cfd9671..9f9d6cae39d5 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_ptp.c
@@ -441,7 +441,8 @@ void cxgb4_ptp_init(struct adapter *adapter)
441 441
442 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info, 442 adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info,
443 &adapter->pdev->dev); 443 &adapter->pdev->dev);
444 if (!adapter->ptp_clock) { 444 if (IS_ERR_OR_NULL(adapter->ptp_clock)) {
445 adapter->ptp_clock = NULL;
445 dev_err(adapter->pdev_dev, 446 dev_err(adapter->pdev_dev,
446 "PTP %s Clock registration has failed\n", __func__); 447 "PTP %s Clock registration has failed\n", __func__);
447 return; 448 return;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h
index 99987d8e437e..aa28299aef5f 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_pci_id_tbl.h
@@ -174,6 +174,8 @@ CH_PCI_DEVICE_ID_TABLE_DEFINE_BEGIN
174 CH_PCI_ID_TABLE_FENTRY(0x50a0), /* Custom T540-CR */ 174 CH_PCI_ID_TABLE_FENTRY(0x50a0), /* Custom T540-CR */
175 CH_PCI_ID_TABLE_FENTRY(0x50a1), /* Custom T540-CR */ 175 CH_PCI_ID_TABLE_FENTRY(0x50a1), /* Custom T540-CR */
176 CH_PCI_ID_TABLE_FENTRY(0x50a2), /* Custom T540-KR4 */ 176 CH_PCI_ID_TABLE_FENTRY(0x50a2), /* Custom T540-KR4 */
177 CH_PCI_ID_TABLE_FENTRY(0x50a3), /* Custom T580-KR4 */
178 CH_PCI_ID_TABLE_FENTRY(0x50a4), /* Custom 2x T540-CR */
177 179
178 /* T6 adapters: 180 /* T6 adapters:
179 */ 181 */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index ff864a187d5a..a37166ee577b 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -776,8 +776,9 @@ void hns_ae_update_led_status(struct hnae_handle *handle)
776 776
777 assert(handle); 777 assert(handle);
778 mac_cb = hns_get_mac_cb(handle); 778 mac_cb = hns_get_mac_cb(handle);
779 if (!mac_cb->cpld_ctrl) 779 if (mac_cb->media_type != HNAE_MEDIA_TYPE_FIBER)
780 return; 780 return;
781
781 hns_set_led_opt(mac_cb); 782 hns_set_led_opt(mac_cb);
782} 783}
783 784
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
index 7a8addda726e..408b63faf9a8 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
@@ -53,6 +53,34 @@ static u32 dsaf_read_sub(struct dsaf_device *dsaf_dev, u32 reg)
53 return ret; 53 return ret;
54} 54}
55 55
56static void hns_dsaf_acpi_ledctrl_by_port(struct hns_mac_cb *mac_cb, u8 op_type,
57 u32 link, u32 port, u32 act)
58{
59 union acpi_object *obj;
60 union acpi_object obj_args[3], argv4;
61
62 obj_args[0].integer.type = ACPI_TYPE_INTEGER;
63 obj_args[0].integer.value = link;
64 obj_args[1].integer.type = ACPI_TYPE_INTEGER;
65 obj_args[1].integer.value = port;
66 obj_args[2].integer.type = ACPI_TYPE_INTEGER;
67 obj_args[2].integer.value = act;
68
69 argv4.type = ACPI_TYPE_PACKAGE;
70 argv4.package.count = 3;
71 argv4.package.elements = obj_args;
72
73 obj = acpi_evaluate_dsm(ACPI_HANDLE(mac_cb->dev),
74 &hns_dsaf_acpi_dsm_guid, 0, op_type, &argv4);
75 if (!obj) {
76 dev_warn(mac_cb->dev, "ledctrl fail, link:%d port:%d act:%d!\n",
77 link, port, act);
78 return;
79 }
80
81 ACPI_FREE(obj);
82}
83
56static void hns_cpld_set_led(struct hns_mac_cb *mac_cb, int link_status, 84static void hns_cpld_set_led(struct hns_mac_cb *mac_cb, int link_status,
57 u16 speed, int data) 85 u16 speed, int data)
58{ 86{
@@ -93,6 +121,18 @@ static void hns_cpld_set_led(struct hns_mac_cb *mac_cb, int link_status,
93 } 121 }
94} 122}
95 123
124static void hns_cpld_set_led_acpi(struct hns_mac_cb *mac_cb, int link_status,
125 u16 speed, int data)
126{
127 if (!mac_cb) {
128 pr_err("cpld_led_set mac_cb is null!\n");
129 return;
130 }
131
132 hns_dsaf_acpi_ledctrl_by_port(mac_cb, HNS_OP_LED_SET_FUNC,
133 link_status, mac_cb->mac_id, data);
134}
135
96static void cpld_led_reset(struct hns_mac_cb *mac_cb) 136static void cpld_led_reset(struct hns_mac_cb *mac_cb)
97{ 137{
98 if (!mac_cb || !mac_cb->cpld_ctrl) 138 if (!mac_cb || !mac_cb->cpld_ctrl)
@@ -103,6 +143,20 @@ static void cpld_led_reset(struct hns_mac_cb *mac_cb)
103 mac_cb->cpld_led_value = CPLD_LED_DEFAULT_VALUE; 143 mac_cb->cpld_led_value = CPLD_LED_DEFAULT_VALUE;
104} 144}
105 145
146static void cpld_led_reset_acpi(struct hns_mac_cb *mac_cb)
147{
148 if (!mac_cb) {
149 pr_err("cpld_led_reset mac_cb is null!\n");
150 return;
151 }
152
153 if (mac_cb->media_type != HNAE_MEDIA_TYPE_FIBER)
154 return;
155
156 hns_dsaf_acpi_ledctrl_by_port(mac_cb, HNS_OP_LED_SET_FUNC,
157 0, mac_cb->mac_id, 0);
158}
159
106static int cpld_set_led_id(struct hns_mac_cb *mac_cb, 160static int cpld_set_led_id(struct hns_mac_cb *mac_cb,
107 enum hnae_led_state status) 161 enum hnae_led_state status)
108{ 162{
@@ -604,8 +658,8 @@ struct dsaf_misc_op *hns_misc_op_get(struct dsaf_device *dsaf_dev)
604 658
605 misc_op->cfg_serdes_loopback = hns_mac_config_sds_loopback; 659 misc_op->cfg_serdes_loopback = hns_mac_config_sds_loopback;
606 } else if (is_acpi_node(dsaf_dev->dev->fwnode)) { 660 } else if (is_acpi_node(dsaf_dev->dev->fwnode)) {
607 misc_op->cpld_set_led = hns_cpld_set_led; 661 misc_op->cpld_set_led = hns_cpld_set_led_acpi;
608 misc_op->cpld_reset_led = cpld_led_reset; 662 misc_op->cpld_reset_led = cpld_led_reset_acpi;
609 misc_op->cpld_set_led_id = cpld_set_led_id; 663 misc_op->cpld_set_led_id = cpld_set_led_id;
610 664
611 misc_op->dsaf_reset = hns_dsaf_rst_acpi; 665 misc_op->dsaf_reset = hns_dsaf_rst_acpi;
diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c
index 249a4584401a..b651c1210555 100644
--- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
@@ -283,7 +283,7 @@ int mlx4_zone_add_one(struct mlx4_zone_allocator *zone_alloc,
283} 283}
284 284
285/* Should be called under a lock */ 285/* Should be called under a lock */
286static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry) 286static void __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry)
287{ 287{
288 struct mlx4_zone_allocator *zone_alloc = entry->allocator; 288 struct mlx4_zone_allocator *zone_alloc = entry->allocator;
289 289
@@ -315,8 +315,6 @@ static int __mlx4_zone_remove_one_entry(struct mlx4_zone_entry *entry)
315 } 315 }
316 zone_alloc->mask = mask; 316 zone_alloc->mask = mask;
317 } 317 }
318
319 return 0;
320} 318}
321 319
322void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc) 320void mlx4_zone_allocator_destroy(struct mlx4_zone_allocator *zone_alloc)
@@ -457,7 +455,7 @@ struct mlx4_bitmap *mlx4_zone_get_bitmap(struct mlx4_zone_allocator *zones, u32
457int mlx4_zone_remove_one(struct mlx4_zone_allocator *zones, u32 uid) 455int mlx4_zone_remove_one(struct mlx4_zone_allocator *zones, u32 uid)
458{ 456{
459 struct mlx4_zone_entry *zone; 457 struct mlx4_zone_entry *zone;
460 int res; 458 int res = 0;
461 459
462 spin_lock(&zones->lock); 460 spin_lock(&zones->lock);
463 461
@@ -468,7 +466,7 @@ int mlx4_zone_remove_one(struct mlx4_zone_allocator *zones, u32 uid)
468 goto out; 466 goto out;
469 } 467 }
470 468
471 res = __mlx4_zone_remove_one_entry(zone); 469 __mlx4_zone_remove_one_entry(zone);
472 470
473out: 471out:
474 spin_unlock(&zones->lock); 472 spin_unlock(&zones->lock);
@@ -578,7 +576,7 @@ out:
578} 576}
579 577
580static int mlx4_buf_direct_alloc(struct mlx4_dev *dev, int size, 578static int mlx4_buf_direct_alloc(struct mlx4_dev *dev, int size,
581 struct mlx4_buf *buf, gfp_t gfp) 579 struct mlx4_buf *buf)
582{ 580{
583 dma_addr_t t; 581 dma_addr_t t;
584 582
@@ -587,7 +585,7 @@ static int mlx4_buf_direct_alloc(struct mlx4_dev *dev, int size,
587 buf->page_shift = get_order(size) + PAGE_SHIFT; 585 buf->page_shift = get_order(size) + PAGE_SHIFT;
588 buf->direct.buf = 586 buf->direct.buf =
589 dma_zalloc_coherent(&dev->persist->pdev->dev, 587 dma_zalloc_coherent(&dev->persist->pdev->dev,
590 size, &t, gfp); 588 size, &t, GFP_KERNEL);
591 if (!buf->direct.buf) 589 if (!buf->direct.buf)
592 return -ENOMEM; 590 return -ENOMEM;
593 591
@@ -607,10 +605,10 @@ static int mlx4_buf_direct_alloc(struct mlx4_dev *dev, int size,
607 * multiple pages, so we don't require too much contiguous memory. 605 * multiple pages, so we don't require too much contiguous memory.
608 */ 606 */
609int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 607int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
610 struct mlx4_buf *buf, gfp_t gfp) 608 struct mlx4_buf *buf)
611{ 609{
612 if (size <= max_direct) { 610 if (size <= max_direct) {
613 return mlx4_buf_direct_alloc(dev, size, buf, gfp); 611 return mlx4_buf_direct_alloc(dev, size, buf);
614 } else { 612 } else {
615 dma_addr_t t; 613 dma_addr_t t;
616 int i; 614 int i;
@@ -620,14 +618,14 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
620 buf->npages = buf->nbufs; 618 buf->npages = buf->nbufs;
621 buf->page_shift = PAGE_SHIFT; 619 buf->page_shift = PAGE_SHIFT;
622 buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list), 620 buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list),
623 gfp); 621 GFP_KERNEL);
624 if (!buf->page_list) 622 if (!buf->page_list)
625 return -ENOMEM; 623 return -ENOMEM;
626 624
627 for (i = 0; i < buf->nbufs; ++i) { 625 for (i = 0; i < buf->nbufs; ++i) {
628 buf->page_list[i].buf = 626 buf->page_list[i].buf =
629 dma_zalloc_coherent(&dev->persist->pdev->dev, 627 dma_zalloc_coherent(&dev->persist->pdev->dev,
630 PAGE_SIZE, &t, gfp); 628 PAGE_SIZE, &t, GFP_KERNEL);
631 if (!buf->page_list[i].buf) 629 if (!buf->page_list[i].buf)
632 goto err_free; 630 goto err_free;
633 631
@@ -663,12 +661,11 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf)
663} 661}
664EXPORT_SYMBOL_GPL(mlx4_buf_free); 662EXPORT_SYMBOL_GPL(mlx4_buf_free);
665 663
666static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device, 664static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device)
667 gfp_t gfp)
668{ 665{
669 struct mlx4_db_pgdir *pgdir; 666 struct mlx4_db_pgdir *pgdir;
670 667
671 pgdir = kzalloc(sizeof *pgdir, gfp); 668 pgdir = kzalloc(sizeof(*pgdir), GFP_KERNEL);
672 if (!pgdir) 669 if (!pgdir)
673 return NULL; 670 return NULL;
674 671
@@ -676,7 +673,7 @@ static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device,
676 pgdir->bits[0] = pgdir->order0; 673 pgdir->bits[0] = pgdir->order0;
677 pgdir->bits[1] = pgdir->order1; 674 pgdir->bits[1] = pgdir->order1;
678 pgdir->db_page = dma_alloc_coherent(dma_device, PAGE_SIZE, 675 pgdir->db_page = dma_alloc_coherent(dma_device, PAGE_SIZE,
679 &pgdir->db_dma, gfp); 676 &pgdir->db_dma, GFP_KERNEL);
680 if (!pgdir->db_page) { 677 if (!pgdir->db_page) {
681 kfree(pgdir); 678 kfree(pgdir);
682 return NULL; 679 return NULL;
@@ -716,7 +713,7 @@ found:
716 return 0; 713 return 0;
717} 714}
718 715
719int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order, gfp_t gfp) 716int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order)
720{ 717{
721 struct mlx4_priv *priv = mlx4_priv(dev); 718 struct mlx4_priv *priv = mlx4_priv(dev);
722 struct mlx4_db_pgdir *pgdir; 719 struct mlx4_db_pgdir *pgdir;
@@ -728,7 +725,7 @@ int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order, gfp_t gfp
728 if (!mlx4_alloc_db_from_pgdir(pgdir, db, order)) 725 if (!mlx4_alloc_db_from_pgdir(pgdir, db, order))
729 goto out; 726 goto out;
730 727
731 pgdir = mlx4_alloc_db_pgdir(&dev->persist->pdev->dev, gfp); 728 pgdir = mlx4_alloc_db_pgdir(&dev->persist->pdev->dev);
732 if (!pgdir) { 729 if (!pgdir) {
733 ret = -ENOMEM; 730 ret = -ENOMEM;
734 goto out; 731 goto out;
@@ -780,13 +777,13 @@ int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
780{ 777{
781 int err; 778 int err;
782 779
783 err = mlx4_db_alloc(dev, &wqres->db, 1, GFP_KERNEL); 780 err = mlx4_db_alloc(dev, &wqres->db, 1);
784 if (err) 781 if (err)
785 return err; 782 return err;
786 783
787 *wqres->db.db = 0; 784 *wqres->db.db = 0;
788 785
789 err = mlx4_buf_direct_alloc(dev, size, &wqres->buf, GFP_KERNEL); 786 err = mlx4_buf_direct_alloc(dev, size, &wqres->buf);
790 if (err) 787 if (err)
791 goto err_db; 788 goto err_db;
792 789
@@ -795,7 +792,7 @@ int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
795 if (err) 792 if (err)
796 goto err_buf; 793 goto err_buf;
797 794
798 err = mlx4_buf_write_mtt(dev, &wqres->mtt, &wqres->buf, GFP_KERNEL); 795 err = mlx4_buf_write_mtt(dev, &wqres->mtt, &wqres->buf);
799 if (err) 796 if (err)
800 goto err_mtt; 797 goto err_mtt;
801 798
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c
index fa6d2354a0e9..c56a511b918e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cq.c
@@ -224,11 +224,11 @@ int __mlx4_cq_alloc_icm(struct mlx4_dev *dev, int *cqn)
224 if (*cqn == -1) 224 if (*cqn == -1)
225 return -ENOMEM; 225 return -ENOMEM;
226 226
227 err = mlx4_table_get(dev, &cq_table->table, *cqn, GFP_KERNEL); 227 err = mlx4_table_get(dev, &cq_table->table, *cqn);
228 if (err) 228 if (err)
229 goto err_out; 229 goto err_out;
230 230
231 err = mlx4_table_get(dev, &cq_table->cmpt_table, *cqn, GFP_KERNEL); 231 err = mlx4_table_get(dev, &cq_table->cmpt_table, *cqn);
232 if (err) 232 if (err)
233 goto err_put; 233 goto err_put;
234 return 0; 234 return 0;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index e5fb89505a13..436f7689a032 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -1042,7 +1042,7 @@ static int mlx4_en_config_rss_qp(struct mlx4_en_priv *priv, int qpn,
1042 if (!context) 1042 if (!context)
1043 return -ENOMEM; 1043 return -ENOMEM;
1044 1044
1045 err = mlx4_qp_alloc(mdev->dev, qpn, qp, GFP_KERNEL); 1045 err = mlx4_qp_alloc(mdev->dev, qpn, qp);
1046 if (err) { 1046 if (err) {
1047 en_err(priv, "Failed to allocate qp #%x\n", qpn); 1047 en_err(priv, "Failed to allocate qp #%x\n", qpn);
1048 goto out; 1048 goto out;
@@ -1086,7 +1086,7 @@ int mlx4_en_create_drop_qp(struct mlx4_en_priv *priv)
1086 en_err(priv, "Failed reserving drop qpn\n"); 1086 en_err(priv, "Failed reserving drop qpn\n");
1087 return err; 1087 return err;
1088 } 1088 }
1089 err = mlx4_qp_alloc(priv->mdev->dev, qpn, &priv->drop_qp, GFP_KERNEL); 1089 err = mlx4_qp_alloc(priv->mdev->dev, qpn, &priv->drop_qp);
1090 if (err) { 1090 if (err) {
1091 en_err(priv, "Failed allocating drop qp\n"); 1091 en_err(priv, "Failed allocating drop qp\n");
1092 mlx4_qp_release_range(priv->mdev->dev, qpn, 1); 1092 mlx4_qp_release_range(priv->mdev->dev, qpn, 1);
@@ -1158,8 +1158,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv)
1158 } 1158 }
1159 1159
1160 /* Configure RSS indirection qp */ 1160 /* Configure RSS indirection qp */
1161 err = mlx4_qp_alloc(mdev->dev, priv->base_qpn, rss_map->indir_qp, 1161 err = mlx4_qp_alloc(mdev->dev, priv->base_qpn, rss_map->indir_qp);
1162 GFP_KERNEL);
1163 if (err) { 1162 if (err) {
1164 en_err(priv, "Failed to allocate RSS indirection QP\n"); 1163 en_err(priv, "Failed to allocate RSS indirection QP\n");
1165 goto rss_err; 1164 goto rss_err;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 4f3a9b27ce4a..73faa3d77921 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -111,7 +111,7 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
111 goto err_hwq_res; 111 goto err_hwq_res;
112 } 112 }
113 113
114 err = mlx4_qp_alloc(mdev->dev, ring->qpn, &ring->sp_qp, GFP_KERNEL); 114 err = mlx4_qp_alloc(mdev->dev, ring->qpn, &ring->sp_qp);
115 if (err) { 115 if (err) {
116 en_err(priv, "Failed allocating qp %d\n", ring->qpn); 116 en_err(priv, "Failed allocating qp %d\n", ring->qpn);
117 goto err_reserve; 117 goto err_reserve;
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
index e1f9e7cebf8f..5a7816e7c7b4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
@@ -251,8 +251,7 @@ int mlx4_UNMAP_ICM_AUX(struct mlx4_dev *dev)
251 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE); 251 MLX4_CMD_TIME_CLASS_B, MLX4_CMD_NATIVE);
252} 252}
253 253
254int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj, 254int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj)
255 gfp_t gfp)
256{ 255{
257 u32 i = (obj & (table->num_obj - 1)) / 256 u32 i = (obj & (table->num_obj - 1)) /
258 (MLX4_TABLE_CHUNK_SIZE / table->obj_size); 257 (MLX4_TABLE_CHUNK_SIZE / table->obj_size);
@@ -266,7 +265,7 @@ int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj,
266 } 265 }
267 266
268 table->icm[i] = mlx4_alloc_icm(dev, MLX4_TABLE_CHUNK_SIZE >> PAGE_SHIFT, 267 table->icm[i] = mlx4_alloc_icm(dev, MLX4_TABLE_CHUNK_SIZE >> PAGE_SHIFT,
269 (table->lowmem ? gfp : GFP_HIGHUSER) | 268 (table->lowmem ? GFP_KERNEL : GFP_HIGHUSER) |
270 __GFP_NOWARN, table->coherent); 269 __GFP_NOWARN, table->coherent);
271 if (!table->icm[i]) { 270 if (!table->icm[i]) {
272 ret = -ENOMEM; 271 ret = -ENOMEM;
@@ -363,7 +362,7 @@ int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table,
363 u32 i; 362 u32 i;
364 363
365 for (i = start; i <= end; i += inc) { 364 for (i = start; i <= end; i += inc) {
366 err = mlx4_table_get(dev, table, i, GFP_KERNEL); 365 err = mlx4_table_get(dev, table, i);
367 if (err) 366 if (err)
368 goto fail; 367 goto fail;
369 } 368 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.h b/drivers/net/ethernet/mellanox/mlx4/icm.h
index 0c7364550150..dee67fa39107 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.h
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.h
@@ -71,8 +71,7 @@ struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages,
71 gfp_t gfp_mask, int coherent); 71 gfp_t gfp_mask, int coherent);
72void mlx4_free_icm(struct mlx4_dev *dev, struct mlx4_icm *icm, int coherent); 72void mlx4_free_icm(struct mlx4_dev *dev, struct mlx4_icm *icm, int coherent);
73 73
74int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj, 74int mlx4_table_get(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj);
75 gfp_t gfp);
76void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj); 75void mlx4_table_put(struct mlx4_dev *dev, struct mlx4_icm_table *table, u32 obj);
77int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table, 76int mlx4_table_get_range(struct mlx4_dev *dev, struct mlx4_icm_table *table,
78 u32 start, u32 end); 77 u32 start, u32 end);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index 30616cd0140d..706d7f21ac5c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -969,7 +969,7 @@ void mlx4_cleanup_cq_table(struct mlx4_dev *dev);
969void mlx4_cleanup_qp_table(struct mlx4_dev *dev); 969void mlx4_cleanup_qp_table(struct mlx4_dev *dev);
970void mlx4_cleanup_srq_table(struct mlx4_dev *dev); 970void mlx4_cleanup_srq_table(struct mlx4_dev *dev);
971void mlx4_cleanup_mcg_table(struct mlx4_dev *dev); 971void mlx4_cleanup_mcg_table(struct mlx4_dev *dev);
972int __mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn, gfp_t gfp); 972int __mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn);
973void __mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn); 973void __mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn);
974int __mlx4_cq_alloc_icm(struct mlx4_dev *dev, int *cqn); 974int __mlx4_cq_alloc_icm(struct mlx4_dev *dev, int *cqn);
975void __mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn); 975void __mlx4_cq_free_icm(struct mlx4_dev *dev, int cqn);
@@ -977,7 +977,7 @@ int __mlx4_srq_alloc_icm(struct mlx4_dev *dev, int *srqn);
977void __mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn); 977void __mlx4_srq_free_icm(struct mlx4_dev *dev, int srqn);
978int __mlx4_mpt_reserve(struct mlx4_dev *dev); 978int __mlx4_mpt_reserve(struct mlx4_dev *dev);
979void __mlx4_mpt_release(struct mlx4_dev *dev, u32 index); 979void __mlx4_mpt_release(struct mlx4_dev *dev, u32 index);
980int __mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index, gfp_t gfp); 980int __mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index);
981void __mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index); 981void __mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index);
982u32 __mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order); 982u32 __mlx4_alloc_mtt_range(struct mlx4_dev *dev, int order);
983void __mlx4_free_mtt_range(struct mlx4_dev *dev, u32 first_seg, int order); 983void __mlx4_free_mtt_range(struct mlx4_dev *dev, u32 first_seg, int order);
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index ce852ca22a96..24282cd017d3 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -479,14 +479,14 @@ static void mlx4_mpt_release(struct mlx4_dev *dev, u32 index)
479 __mlx4_mpt_release(dev, index); 479 __mlx4_mpt_release(dev, index);
480} 480}
481 481
482int __mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index, gfp_t gfp) 482int __mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index)
483{ 483{
484 struct mlx4_mr_table *mr_table = &mlx4_priv(dev)->mr_table; 484 struct mlx4_mr_table *mr_table = &mlx4_priv(dev)->mr_table;
485 485
486 return mlx4_table_get(dev, &mr_table->dmpt_table, index, gfp); 486 return mlx4_table_get(dev, &mr_table->dmpt_table, index);
487} 487}
488 488
489static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index, gfp_t gfp) 489static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index)
490{ 490{
491 u64 param = 0; 491 u64 param = 0;
492 492
@@ -497,7 +497,7 @@ static int mlx4_mpt_alloc_icm(struct mlx4_dev *dev, u32 index, gfp_t gfp)
497 MLX4_CMD_TIME_CLASS_A, 497 MLX4_CMD_TIME_CLASS_A,
498 MLX4_CMD_WRAPPED); 498 MLX4_CMD_WRAPPED);
499 } 499 }
500 return __mlx4_mpt_alloc_icm(dev, index, gfp); 500 return __mlx4_mpt_alloc_icm(dev, index);
501} 501}
502 502
503void __mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index) 503void __mlx4_mpt_free_icm(struct mlx4_dev *dev, u32 index)
@@ -629,7 +629,7 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr)
629 struct mlx4_mpt_entry *mpt_entry; 629 struct mlx4_mpt_entry *mpt_entry;
630 int err; 630 int err;
631 631
632 err = mlx4_mpt_alloc_icm(dev, key_to_hw_index(mr->key), GFP_KERNEL); 632 err = mlx4_mpt_alloc_icm(dev, key_to_hw_index(mr->key));
633 if (err) 633 if (err)
634 return err; 634 return err;
635 635
@@ -787,14 +787,13 @@ int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
787EXPORT_SYMBOL_GPL(mlx4_write_mtt); 787EXPORT_SYMBOL_GPL(mlx4_write_mtt);
788 788
789int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 789int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
790 struct mlx4_buf *buf, gfp_t gfp) 790 struct mlx4_buf *buf)
791{ 791{
792 u64 *page_list; 792 u64 *page_list;
793 int err; 793 int err;
794 int i; 794 int i;
795 795
796 page_list = kmalloc(buf->npages * sizeof *page_list, 796 page_list = kcalloc(buf->npages, sizeof(*page_list), GFP_KERNEL);
797 gfp);
798 if (!page_list) 797 if (!page_list)
799 return -ENOMEM; 798 return -ENOMEM;
800 799
@@ -841,7 +840,7 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw)
841 struct mlx4_mpt_entry *mpt_entry; 840 struct mlx4_mpt_entry *mpt_entry;
842 int err; 841 int err;
843 842
844 err = mlx4_mpt_alloc_icm(dev, key_to_hw_index(mw->key), GFP_KERNEL); 843 err = mlx4_mpt_alloc_icm(dev, key_to_hw_index(mw->key));
845 if (err) 844 if (err)
846 return err; 845 return err;
847 846
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 5a310d313e94..26747212526b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -301,29 +301,29 @@ void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt)
301} 301}
302EXPORT_SYMBOL_GPL(mlx4_qp_release_range); 302EXPORT_SYMBOL_GPL(mlx4_qp_release_range);
303 303
304int __mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn, gfp_t gfp) 304int __mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn)
305{ 305{
306 struct mlx4_priv *priv = mlx4_priv(dev); 306 struct mlx4_priv *priv = mlx4_priv(dev);
307 struct mlx4_qp_table *qp_table = &priv->qp_table; 307 struct mlx4_qp_table *qp_table = &priv->qp_table;
308 int err; 308 int err;
309 309
310 err = mlx4_table_get(dev, &qp_table->qp_table, qpn, gfp); 310 err = mlx4_table_get(dev, &qp_table->qp_table, qpn);
311 if (err) 311 if (err)
312 goto err_out; 312 goto err_out;
313 313
314 err = mlx4_table_get(dev, &qp_table->auxc_table, qpn, gfp); 314 err = mlx4_table_get(dev, &qp_table->auxc_table, qpn);
315 if (err) 315 if (err)
316 goto err_put_qp; 316 goto err_put_qp;
317 317
318 err = mlx4_table_get(dev, &qp_table->altc_table, qpn, gfp); 318 err = mlx4_table_get(dev, &qp_table->altc_table, qpn);
319 if (err) 319 if (err)
320 goto err_put_auxc; 320 goto err_put_auxc;
321 321
322 err = mlx4_table_get(dev, &qp_table->rdmarc_table, qpn, gfp); 322 err = mlx4_table_get(dev, &qp_table->rdmarc_table, qpn);
323 if (err) 323 if (err)
324 goto err_put_altc; 324 goto err_put_altc;
325 325
326 err = mlx4_table_get(dev, &qp_table->cmpt_table, qpn, gfp); 326 err = mlx4_table_get(dev, &qp_table->cmpt_table, qpn);
327 if (err) 327 if (err)
328 goto err_put_rdmarc; 328 goto err_put_rdmarc;
329 329
@@ -345,7 +345,7 @@ err_out:
345 return err; 345 return err;
346} 346}
347 347
348static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn, gfp_t gfp) 348static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn)
349{ 349{
350 u64 param = 0; 350 u64 param = 0;
351 351
@@ -355,7 +355,7 @@ static int mlx4_qp_alloc_icm(struct mlx4_dev *dev, int qpn, gfp_t gfp)
355 MLX4_CMD_ALLOC_RES, MLX4_CMD_TIME_CLASS_A, 355 MLX4_CMD_ALLOC_RES, MLX4_CMD_TIME_CLASS_A,
356 MLX4_CMD_WRAPPED); 356 MLX4_CMD_WRAPPED);
357 } 357 }
358 return __mlx4_qp_alloc_icm(dev, qpn, gfp); 358 return __mlx4_qp_alloc_icm(dev, qpn);
359} 359}
360 360
361void __mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn) 361void __mlx4_qp_free_icm(struct mlx4_dev *dev, int qpn)
@@ -397,7 +397,7 @@ struct mlx4_qp *mlx4_qp_lookup(struct mlx4_dev *dev, u32 qpn)
397 return qp; 397 return qp;
398} 398}
399 399
400int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, gfp_t gfp) 400int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp)
401{ 401{
402 struct mlx4_priv *priv = mlx4_priv(dev); 402 struct mlx4_priv *priv = mlx4_priv(dev);
403 struct mlx4_qp_table *qp_table = &priv->qp_table; 403 struct mlx4_qp_table *qp_table = &priv->qp_table;
@@ -408,7 +408,7 @@ int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, gfp_t gfp)
408 408
409 qp->qpn = qpn; 409 qp->qpn = qpn;
410 410
411 err = mlx4_qp_alloc_icm(dev, qpn, gfp); 411 err = mlx4_qp_alloc_icm(dev, qpn);
412 if (err) 412 if (err)
413 return err; 413 return err;
414 414
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 812783865205..215e21c3dc8a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -1822,7 +1822,7 @@ static int qp_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd,
1822 return err; 1822 return err;
1823 1823
1824 if (!fw_reserved(dev, qpn)) { 1824 if (!fw_reserved(dev, qpn)) {
1825 err = __mlx4_qp_alloc_icm(dev, qpn, GFP_KERNEL); 1825 err = __mlx4_qp_alloc_icm(dev, qpn);
1826 if (err) { 1826 if (err) {
1827 res_abort_move(dev, slave, RES_QP, qpn); 1827 res_abort_move(dev, slave, RES_QP, qpn);
1828 return err; 1828 return err;
@@ -1909,7 +1909,7 @@ static int mpt_alloc_res(struct mlx4_dev *dev, int slave, int op, int cmd,
1909 if (err) 1909 if (err)
1910 return err; 1910 return err;
1911 1911
1912 err = __mlx4_mpt_alloc_icm(dev, mpt->key, GFP_KERNEL); 1912 err = __mlx4_mpt_alloc_icm(dev, mpt->key);
1913 if (err) { 1913 if (err) {
1914 res_abort_move(dev, slave, RES_MPT, id); 1914 res_abort_move(dev, slave, RES_MPT, id);
1915 return err; 1915 return err;
diff --git a/drivers/net/ethernet/mellanox/mlx4/srq.c b/drivers/net/ethernet/mellanox/mlx4/srq.c
index f44d089e2ca6..bedf52126824 100644
--- a/drivers/net/ethernet/mellanox/mlx4/srq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/srq.c
@@ -100,11 +100,11 @@ int __mlx4_srq_alloc_icm(struct mlx4_dev *dev, int *srqn)
100 if (*srqn == -1) 100 if (*srqn == -1)
101 return -ENOMEM; 101 return -ENOMEM;
102 102
103 err = mlx4_table_get(dev, &srq_table->table, *srqn, GFP_KERNEL); 103 err = mlx4_table_get(dev, &srq_table->table, *srqn);
104 if (err) 104 if (err)
105 goto err_out; 105 goto err_out;
106 106
107 err = mlx4_table_get(dev, &srq_table->cmpt_table, *srqn, GFP_KERNEL); 107 err = mlx4_table_get(dev, &srq_table->cmpt_table, *srqn);
108 if (err) 108 if (err)
109 goto err_put; 109 goto err_put;
110 return 0; 110 return 0;
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 746d94e28470..60850bfa3d32 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -766,11 +766,13 @@ static void emac_shutdown(struct platform_device *pdev)
766 struct emac_adapter *adpt = netdev_priv(netdev); 766 struct emac_adapter *adpt = netdev_priv(netdev);
767 struct emac_sgmii *sgmii = &adpt->phy; 767 struct emac_sgmii *sgmii = &adpt->phy;
768 768
769 /* Closing the SGMII turns off its interrupts */ 769 if (netdev->flags & IFF_UP) {
770 sgmii->close(adpt); 770 /* Closing the SGMII turns off its interrupts */
771 sgmii->close(adpt);
771 772
772 /* Resetting the MAC turns off all DMA and its interrupts */ 773 /* Resetting the MAC turns off all DMA and its interrupts */
773 emac_mac_reset(adpt); 774 emac_mac_reset(adpt);
775 }
774} 776}
775 777
776static struct platform_driver emac_platform_driver = { 778static struct platform_driver emac_platform_driver = {
diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
index b607936e1b3e..9c0488e0f08e 100644
--- a/drivers/net/ethernet/sgi/ioc3-eth.c
+++ b/drivers/net/ethernet/sgi/ioc3-eth.c
@@ -90,17 +90,13 @@ struct ioc3_private {
90 spinlock_t ioc3_lock; 90 spinlock_t ioc3_lock;
91 struct mii_if_info mii; 91 struct mii_if_info mii;
92 92
93 struct net_device *dev;
93 struct pci_dev *pdev; 94 struct pci_dev *pdev;
94 95
95 /* Members used by autonegotiation */ 96 /* Members used by autonegotiation */
96 struct timer_list ioc3_timer; 97 struct timer_list ioc3_timer;
97}; 98};
98 99
99static inline struct net_device *priv_netdev(struct ioc3_private *dev)
100{
101 return (void *)dev - ((sizeof(struct net_device) + 31) & ~31);
102}
103
104static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 100static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
105static void ioc3_set_multicast_list(struct net_device *dev); 101static void ioc3_set_multicast_list(struct net_device *dev);
106static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev); 102static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev);
@@ -427,7 +423,7 @@ static void ioc3_get_eaddr_nic(struct ioc3_private *ip)
427 nic[i] = nic_read_byte(ioc3); 423 nic[i] = nic_read_byte(ioc3);
428 424
429 for (i = 2; i < 8; i++) 425 for (i = 2; i < 8; i++)
430 priv_netdev(ip)->dev_addr[i - 2] = nic[i]; 426 ip->dev->dev_addr[i - 2] = nic[i];
431} 427}
432 428
433/* 429/*
@@ -439,7 +435,7 @@ static void ioc3_get_eaddr(struct ioc3_private *ip)
439{ 435{
440 ioc3_get_eaddr_nic(ip); 436 ioc3_get_eaddr_nic(ip);
441 437
442 printk("Ethernet address is %pM.\n", priv_netdev(ip)->dev_addr); 438 printk("Ethernet address is %pM.\n", ip->dev->dev_addr);
443} 439}
444 440
445static void __ioc3_set_mac_address(struct net_device *dev) 441static void __ioc3_set_mac_address(struct net_device *dev)
@@ -790,13 +786,12 @@ static void ioc3_timer(unsigned long data)
790 */ 786 */
791static int ioc3_mii_init(struct ioc3_private *ip) 787static int ioc3_mii_init(struct ioc3_private *ip)
792{ 788{
793 struct net_device *dev = priv_netdev(ip);
794 int i, found = 0, res = 0; 789 int i, found = 0, res = 0;
795 int ioc3_phy_workaround = 1; 790 int ioc3_phy_workaround = 1;
796 u16 word; 791 u16 word;
797 792
798 for (i = 0; i < 32; i++) { 793 for (i = 0; i < 32; i++) {
799 word = ioc3_mdio_read(dev, i, MII_PHYSID1); 794 word = ioc3_mdio_read(ip->dev, i, MII_PHYSID1);
800 795
801 if (word != 0xffff && word != 0x0000) { 796 if (word != 0xffff && word != 0x0000) {
802 found = 1; 797 found = 1;
@@ -1276,6 +1271,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1276 SET_NETDEV_DEV(dev, &pdev->dev); 1271 SET_NETDEV_DEV(dev, &pdev->dev);
1277 1272
1278 ip = netdev_priv(dev); 1273 ip = netdev_priv(dev);
1274 ip->dev = dev;
1279 1275
1280 dev->irq = pdev->irq; 1276 dev->irq = pdev->irq;
1281 1277
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index f233bf8b4ebb..c4407e8e39a3 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -117,7 +117,7 @@ static void dwmac4_tx_queue_routing(struct mac_device_info *hw,
117 void __iomem *ioaddr = hw->pcsr; 117 void __iomem *ioaddr = hw->pcsr;
118 u32 value; 118 u32 value;
119 119
120 const struct stmmac_rx_routing route_possibilities[] = { 120 static const struct stmmac_rx_routing route_possibilities[] = {
121 { GMAC_RXQCTRL_AVCPQ_MASK, GMAC_RXQCTRL_AVCPQ_SHIFT }, 121 { GMAC_RXQCTRL_AVCPQ_MASK, GMAC_RXQCTRL_AVCPQ_SHIFT },
122 { GMAC_RXQCTRL_PTPQ_MASK, GMAC_RXQCTRL_PTPQ_SHIFT }, 122 { GMAC_RXQCTRL_PTPQ_MASK, GMAC_RXQCTRL_PTPQ_SHIFT },
123 { GMAC_RXQCTRL_DCBCPQ_MASK, GMAC_RXQCTRL_DCBCPQ_SHIFT }, 123 { GMAC_RXQCTRL_DCBCPQ_MASK, GMAC_RXQCTRL_DCBCPQ_SHIFT },
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1853f7ff6657..1763e48c84e2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4120,8 +4120,15 @@ int stmmac_dvr_probe(struct device *device,
4120 if ((phyaddr >= 0) && (phyaddr <= 31)) 4120 if ((phyaddr >= 0) && (phyaddr <= 31))
4121 priv->plat->phy_addr = phyaddr; 4121 priv->plat->phy_addr = phyaddr;
4122 4122
4123 if (priv->plat->stmmac_rst) 4123 if (priv->plat->stmmac_rst) {
4124 ret = reset_control_assert(priv->plat->stmmac_rst);
4124 reset_control_deassert(priv->plat->stmmac_rst); 4125 reset_control_deassert(priv->plat->stmmac_rst);
4126 /* Some reset controllers have only reset callback instead of
4127 * assert + deassert callbacks pair.
4128 */
4129 if (ret == -ENOTSUPP)
4130 reset_control_reset(priv->plat->stmmac_rst);
4131 }
4125 4132
4126 /* Init MAC and get the capabilities */ 4133 /* Init MAC and get the capabilities */
4127 ret = stmmac_hw_init(priv); 4134 ret = stmmac_hw_init(priv);
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 46cb7f8955a2..4bb04aaf9650 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -9532,7 +9532,7 @@ static struct niu_parent *niu_get_parent(struct niu *np,
9532 p = niu_new_parent(np, id, ptype); 9532 p = niu_new_parent(np, id, ptype);
9533 9533
9534 if (p) { 9534 if (p) {
9535 char port_name[6]; 9535 char port_name[8];
9536 int err; 9536 int err;
9537 9537
9538 sprintf(port_name, "port%d", port); 9538 sprintf(port_name, "port%d", port);
@@ -9553,7 +9553,7 @@ static void niu_put_parent(struct niu *np)
9553{ 9553{
9554 struct niu_parent *p = np->parent; 9554 struct niu_parent *p = np->parent;
9555 u8 port = np->port; 9555 u8 port = np->port;
9556 char port_name[6]; 9556 char port_name[8];
9557 9557
9558 BUG_ON(!p || p->ports[port] != np); 9558 BUG_ON(!p || p->ports[port] != np);
9559 9559
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c
index 711fbbbc4b1f..163d8d16bc24 100644
--- a/drivers/net/ethernet/tehuti/tehuti.c
+++ b/drivers/net/ethernet/tehuti/tehuti.c
@@ -654,6 +654,8 @@ static int bdx_ioctl_priv(struct net_device *ndev, struct ifreq *ifr, int cmd)
654 RET(-EFAULT); 654 RET(-EFAULT);
655 } 655 }
656 DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]); 656 DBG("%d 0x%x 0x%x\n", data[0], data[1], data[2]);
657 } else {
658 return -EOPNOTSUPP;
657 } 659 }
658 660
659 if (!capable(CAP_SYS_RAWIO)) 661 if (!capable(CAP_SYS_RAWIO))
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1850e348f555..badd0a8caeb9 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -3089,6 +3089,31 @@ static int cpsw_probe(struct platform_device *pdev)
3089 cpsw->quirk_irq = true; 3089 cpsw->quirk_irq = true;
3090 } 3090 }
3091 3091
3092 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
3093
3094 ndev->netdev_ops = &cpsw_netdev_ops;
3095 ndev->ethtool_ops = &cpsw_ethtool_ops;
3096 netif_napi_add(ndev, &cpsw->napi_rx, cpsw_rx_poll, CPSW_POLL_WEIGHT);
3097 netif_tx_napi_add(ndev, &cpsw->napi_tx, cpsw_tx_poll, CPSW_POLL_WEIGHT);
3098 cpsw_split_res(ndev);
3099
3100 /* register the network device */
3101 SET_NETDEV_DEV(ndev, &pdev->dev);
3102 ret = register_netdev(ndev);
3103 if (ret) {
3104 dev_err(priv->dev, "error registering net device\n");
3105 ret = -ENODEV;
3106 goto clean_ale_ret;
3107 }
3108
3109 if (cpsw->data.dual_emac) {
3110 ret = cpsw_probe_dual_emac(priv);
3111 if (ret) {
3112 cpsw_err(priv, probe, "error probe slave 2 emac interface\n");
3113 goto clean_unregister_netdev_ret;
3114 }
3115 }
3116
3092 /* Grab RX and TX IRQs. Note that we also have RX_THRESHOLD and 3117 /* Grab RX and TX IRQs. Note that we also have RX_THRESHOLD and
3093 * MISC IRQs which are always kept disabled with this driver so 3118 * MISC IRQs which are always kept disabled with this driver so
3094 * we will not request them. 3119 * we will not request them.
@@ -3127,33 +3152,9 @@ static int cpsw_probe(struct platform_device *pdev)
3127 goto clean_ale_ret; 3152 goto clean_ale_ret;
3128 } 3153 }
3129 3154
3130 ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
3131
3132 ndev->netdev_ops = &cpsw_netdev_ops;
3133 ndev->ethtool_ops = &cpsw_ethtool_ops;
3134 netif_napi_add(ndev, &cpsw->napi_rx, cpsw_rx_poll, CPSW_POLL_WEIGHT);
3135 netif_tx_napi_add(ndev, &cpsw->napi_tx, cpsw_tx_poll, CPSW_POLL_WEIGHT);
3136 cpsw_split_res(ndev);
3137
3138 /* register the network device */
3139 SET_NETDEV_DEV(ndev, &pdev->dev);
3140 ret = register_netdev(ndev);
3141 if (ret) {
3142 dev_err(priv->dev, "error registering net device\n");
3143 ret = -ENODEV;
3144 goto clean_ale_ret;
3145 }
3146
3147 cpsw_notice(priv, probe, 3155 cpsw_notice(priv, probe,
3148 "initialized device (regs %pa, irq %d, pool size %d)\n", 3156 "initialized device (regs %pa, irq %d, pool size %d)\n",
3149 &ss_res->start, ndev->irq, dma_params.descs_pool_size); 3157 &ss_res->start, ndev->irq, dma_params.descs_pool_size);
3150 if (cpsw->data.dual_emac) {
3151 ret = cpsw_probe_dual_emac(priv);
3152 if (ret) {
3153 cpsw_err(priv, probe, "error probe slave 2 emac interface\n");
3154 goto clean_unregister_netdev_ret;
3155 }
3156 }
3157 3158
3158 pm_runtime_put(&pdev->dev); 3159 pm_runtime_put(&pdev->dev);
3159 3160
diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 00755b6a42cf..c608e1dfaf09 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -135,8 +135,8 @@ int mdio_mux_init(struct device *dev,
135 for_each_available_child_of_node(dev->of_node, child_bus_node) { 135 for_each_available_child_of_node(dev->of_node, child_bus_node) {
136 int v; 136 int v;
137 137
138 v = of_mdio_parse_addr(dev, child_bus_node); 138 r = of_property_read_u32(child_bus_node, "reg", &v);
139 if (v < 0) { 139 if (r) {
140 dev_err(dev, 140 dev_err(dev,
141 "Error: Failed to find reg for child %s\n", 141 "Error: Failed to find reg for child %s\n",
142 of_node_full_name(child_bus_node)); 142 of_node_full_name(child_bus_node));
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 13028833bee3..bd4303944e44 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -120,6 +120,7 @@ struct ppp {
120 int n_channels; /* how many channels are attached 54 */ 120 int n_channels; /* how many channels are attached 54 */
121 spinlock_t rlock; /* lock for receive side 58 */ 121 spinlock_t rlock; /* lock for receive side 58 */
122 spinlock_t wlock; /* lock for transmit side 5c */ 122 spinlock_t wlock; /* lock for transmit side 5c */
123 int *xmit_recursion __percpu; /* xmit recursion detect */
123 int mru; /* max receive unit 60 */ 124 int mru; /* max receive unit 60 */
124 unsigned int flags; /* control bits 64 */ 125 unsigned int flags; /* control bits 64 */
125 unsigned int xstate; /* transmit state bits 68 */ 126 unsigned int xstate; /* transmit state bits 68 */
@@ -1025,6 +1026,7 @@ static int ppp_dev_configure(struct net *src_net, struct net_device *dev,
1025 struct ppp *ppp = netdev_priv(dev); 1026 struct ppp *ppp = netdev_priv(dev);
1026 int indx; 1027 int indx;
1027 int err; 1028 int err;
1029 int cpu;
1028 1030
1029 ppp->dev = dev; 1031 ppp->dev = dev;
1030 ppp->ppp_net = src_net; 1032 ppp->ppp_net = src_net;
@@ -1039,6 +1041,15 @@ static int ppp_dev_configure(struct net *src_net, struct net_device *dev,
1039 INIT_LIST_HEAD(&ppp->channels); 1041 INIT_LIST_HEAD(&ppp->channels);
1040 spin_lock_init(&ppp->rlock); 1042 spin_lock_init(&ppp->rlock);
1041 spin_lock_init(&ppp->wlock); 1043 spin_lock_init(&ppp->wlock);
1044
1045 ppp->xmit_recursion = alloc_percpu(int);
1046 if (!ppp->xmit_recursion) {
1047 err = -ENOMEM;
1048 goto err1;
1049 }
1050 for_each_possible_cpu(cpu)
1051 (*per_cpu_ptr(ppp->xmit_recursion, cpu)) = 0;
1052
1042#ifdef CONFIG_PPP_MULTILINK 1053#ifdef CONFIG_PPP_MULTILINK
1043 ppp->minseq = -1; 1054 ppp->minseq = -1;
1044 skb_queue_head_init(&ppp->mrq); 1055 skb_queue_head_init(&ppp->mrq);
@@ -1050,11 +1061,15 @@ static int ppp_dev_configure(struct net *src_net, struct net_device *dev,
1050 1061
1051 err = ppp_unit_register(ppp, conf->unit, conf->ifname_is_set); 1062 err = ppp_unit_register(ppp, conf->unit, conf->ifname_is_set);
1052 if (err < 0) 1063 if (err < 0)
1053 return err; 1064 goto err2;
1054 1065
1055 conf->file->private_data = &ppp->file; 1066 conf->file->private_data = &ppp->file;
1056 1067
1057 return 0; 1068 return 0;
1069err2:
1070 free_percpu(ppp->xmit_recursion);
1071err1:
1072 return err;
1058} 1073}
1059 1074
1060static const struct nla_policy ppp_nl_policy[IFLA_PPP_MAX + 1] = { 1075static const struct nla_policy ppp_nl_policy[IFLA_PPP_MAX + 1] = {
@@ -1400,18 +1415,16 @@ static void __ppp_xmit_process(struct ppp *ppp)
1400 ppp_xmit_unlock(ppp); 1415 ppp_xmit_unlock(ppp);
1401} 1416}
1402 1417
1403static DEFINE_PER_CPU(int, ppp_xmit_recursion);
1404
1405static void ppp_xmit_process(struct ppp *ppp) 1418static void ppp_xmit_process(struct ppp *ppp)
1406{ 1419{
1407 local_bh_disable(); 1420 local_bh_disable();
1408 1421
1409 if (unlikely(__this_cpu_read(ppp_xmit_recursion))) 1422 if (unlikely(*this_cpu_ptr(ppp->xmit_recursion)))
1410 goto err; 1423 goto err;
1411 1424
1412 __this_cpu_inc(ppp_xmit_recursion); 1425 (*this_cpu_ptr(ppp->xmit_recursion))++;
1413 __ppp_xmit_process(ppp); 1426 __ppp_xmit_process(ppp);
1414 __this_cpu_dec(ppp_xmit_recursion); 1427 (*this_cpu_ptr(ppp->xmit_recursion))--;
1415 1428
1416 local_bh_enable(); 1429 local_bh_enable();
1417 1430
@@ -1905,7 +1918,7 @@ static void __ppp_channel_push(struct channel *pch)
1905 read_lock(&pch->upl); 1918 read_lock(&pch->upl);
1906 ppp = pch->ppp; 1919 ppp = pch->ppp;
1907 if (ppp) 1920 if (ppp)
1908 __ppp_xmit_process(ppp); 1921 ppp_xmit_process(ppp);
1909 read_unlock(&pch->upl); 1922 read_unlock(&pch->upl);
1910 } 1923 }
1911} 1924}
@@ -1914,9 +1927,7 @@ static void ppp_channel_push(struct channel *pch)
1914{ 1927{
1915 local_bh_disable(); 1928 local_bh_disable();
1916 1929
1917 __this_cpu_inc(ppp_xmit_recursion);
1918 __ppp_channel_push(pch); 1930 __ppp_channel_push(pch);
1919 __this_cpu_dec(ppp_xmit_recursion);
1920 1931
1921 local_bh_enable(); 1932 local_bh_enable();
1922} 1933}
@@ -3057,6 +3068,7 @@ static void ppp_destroy_interface(struct ppp *ppp)
3057#endif /* CONFIG_PPP_FILTER */ 3068#endif /* CONFIG_PPP_FILTER */
3058 3069
3059 kfree_skb(ppp->xmit_pending); 3070 kfree_skb(ppp->xmit_pending);
3071 free_percpu(ppp->xmit_recursion);
3060 3072
3061 free_netdev(ppp->dev); 3073 free_netdev(ppp->dev);
3062} 3074}
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index d103a1d4fb36..8f572b9f3625 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -768,8 +768,10 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
768 u8 *buf; 768 u8 *buf;
769 int len; 769 int len;
770 int temp; 770 int temp;
771 int err;
771 u8 iface_no; 772 u8 iface_no;
772 struct usb_cdc_parsed_header hdr; 773 struct usb_cdc_parsed_header hdr;
774 u16 curr_ntb_format;
773 775
774 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 776 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
775 if (!ctx) 777 if (!ctx)
@@ -874,6 +876,32 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
874 goto error2; 876 goto error2;
875 } 877 }
876 878
879 /*
880 * Some Huawei devices have been observed to come out of reset in NDP32 mode.
881 * Let's check if this is the case, and set the device to NDP16 mode again if
882 * needed.
883 */
884 if (ctx->drvflags & CDC_NCM_FLAG_RESET_NTB16) {
885 err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_FORMAT,
886 USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
887 0, iface_no, &curr_ntb_format, 2);
888 if (err < 0) {
889 goto error2;
890 }
891
892 if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
893 dev_info(&intf->dev, "resetting NTB format to 16-bit");
894 err = usbnet_write_cmd(dev, USB_CDC_SET_NTB_FORMAT,
895 USB_TYPE_CLASS | USB_DIR_OUT
896 | USB_RECIP_INTERFACE,
897 USB_CDC_NCM_NTB16_FORMAT,
898 iface_no, NULL, 0);
899
900 if (err < 0)
901 goto error2;
902 }
903 }
904
877 cdc_ncm_find_endpoints(dev, ctx->data); 905 cdc_ncm_find_endpoints(dev, ctx->data);
878 cdc_ncm_find_endpoints(dev, ctx->control); 906 cdc_ncm_find_endpoints(dev, ctx->control);
879 if (!dev->in || !dev->out || !dev->status) { 907 if (!dev->in || !dev->out || !dev->status) {
diff --git a/drivers/net/usb/huawei_cdc_ncm.c b/drivers/net/usb/huawei_cdc_ncm.c
index 2680a65cd5e4..63f28908afda 100644
--- a/drivers/net/usb/huawei_cdc_ncm.c
+++ b/drivers/net/usb/huawei_cdc_ncm.c
@@ -80,6 +80,12 @@ static int huawei_cdc_ncm_bind(struct usbnet *usbnet_dev,
80 * be at the end of the frame. 80 * be at the end of the frame.
81 */ 81 */
82 drvflags |= CDC_NCM_FLAG_NDP_TO_END; 82 drvflags |= CDC_NCM_FLAG_NDP_TO_END;
83
84 /* Additionally, it has been reported that some Huawei E3372H devices, with
85 * firmware version 21.318.01.00.541, come out of reset in NTB32 format mode, hence
86 * needing to be set to the NTB16 one again.
87 */
88 drvflags |= CDC_NCM_FLAG_RESET_NTB16;
83 ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags); 89 ret = cdc_ncm_bind_common(usbnet_dev, intf, 1, drvflags);
84 if (ret) 90 if (ret)
85 goto err; 91 goto err;
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 2dfca96a63b6..340c13484e5c 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -898,6 +898,7 @@ static const struct ethtool_ops smsc95xx_ethtool_ops = {
898 .set_wol = smsc95xx_ethtool_set_wol, 898 .set_wol = smsc95xx_ethtool_set_wol,
899 .get_link_ksettings = smsc95xx_get_link_ksettings, 899 .get_link_ksettings = smsc95xx_get_link_ksettings,
900 .set_link_ksettings = smsc95xx_set_link_ksettings, 900 .set_link_ksettings = smsc95xx_set_link_ksettings,
901 .get_ts_info = ethtool_op_get_ts_info,
901}; 902};
902 903
903static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) 904static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 99a26a9efec1..f41ab0ea942a 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2743,9 +2743,9 @@ module_init(virtio_net_driver_init);
2743 2743
2744static __exit void virtio_net_driver_exit(void) 2744static __exit void virtio_net_driver_exit(void)
2745{ 2745{
2746 unregister_virtio_driver(&virtio_net_driver);
2746 cpuhp_remove_multi_state(CPUHP_VIRT_NET_DEAD); 2747 cpuhp_remove_multi_state(CPUHP_VIRT_NET_DEAD);
2747 cpuhp_remove_multi_state(virtionet_online); 2748 cpuhp_remove_multi_state(virtionet_online);
2748 unregister_virtio_driver(&virtio_net_driver);
2749} 2749}
2750module_exit(virtio_net_driver_exit); 2750module_exit(virtio_net_driver_exit);
2751 2751
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index ba1c9f93592b..9c51b8be0038 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -311,7 +311,7 @@ struct vmxnet3_intr {
311 u8 num_intrs; /* # of intr vectors */ 311 u8 num_intrs; /* # of intr vectors */
312 u8 event_intr_idx; /* idx of the intr vector for event */ 312 u8 event_intr_idx; /* idx of the intr vector for event */
313 u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */ 313 u8 mod_levels[VMXNET3_LINUX_MAX_MSIX_VECT]; /* moderation level */
314 char event_msi_vector_name[IFNAMSIZ+11]; 314 char event_msi_vector_name[IFNAMSIZ+17];
315#ifdef CONFIG_PCI_MSI 315#ifdef CONFIG_PCI_MSI
316 struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT]; 316 struct msix_entry msix_entries[VMXNET3_LINUX_MAX_MSIX_VECT];
317#endif 317#endif
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index 6e2e760d98b1..0b75def39c6c 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -5704,7 +5704,7 @@ static void rt2800_init_freq_calibration(struct rt2x00_dev *rt2x00dev)
5704 5704
5705static void rt2800_init_bbp_5592_glrt(struct rt2x00_dev *rt2x00dev) 5705static void rt2800_init_bbp_5592_glrt(struct rt2x00_dev *rt2x00dev)
5706{ 5706{
5707 const u8 glrt_table[] = { 5707 static const u8 glrt_table[] = {
5708 0xE0, 0x1F, 0X38, 0x32, 0x08, 0x28, 0x19, 0x0A, 0xFF, 0x00, /* 128 ~ 137 */ 5708 0xE0, 0x1F, 0X38, 0x32, 0x08, 0x28, 0x19, 0x0A, 0xFF, 0x00, /* 128 ~ 137 */
5709 0x16, 0x10, 0x10, 0x0B, 0x36, 0x2C, 0x26, 0x24, 0x42, 0x36, /* 138 ~ 147 */ 5709 0x16, 0x10, 0x10, 0x0B, 0x36, 0x2C, 0x26, 0x24, 0x42, 0x36, /* 138 ~ 147 */
5710 0x30, 0x2D, 0x4C, 0x46, 0x3D, 0x40, 0x3E, 0x42, 0x3D, 0x40, /* 148 ~ 157 */ 5710 0x30, 0x2D, 0x4C, 0x46, 0x3D, 0x40, 0x3E, 0x42, 0x3D, 0x40, /* 148 ~ 157 */
diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
index 7cd99b1f8596..75bc08c6838c 100644
--- a/drivers/nvdimm/core.c
+++ b/drivers/nvdimm/core.c
@@ -421,14 +421,15 @@ static void set_badblock(struct badblocks *bb, sector_t s, int num)
421static void __add_badblock_range(struct badblocks *bb, u64 ns_offset, u64 len) 421static void __add_badblock_range(struct badblocks *bb, u64 ns_offset, u64 len)
422{ 422{
423 const unsigned int sector_size = 512; 423 const unsigned int sector_size = 512;
424 sector_t start_sector; 424 sector_t start_sector, end_sector;
425 u64 num_sectors; 425 u64 num_sectors;
426 u32 rem; 426 u32 rem;
427 427
428 start_sector = div_u64(ns_offset, sector_size); 428 start_sector = div_u64(ns_offset, sector_size);
429 num_sectors = div_u64_rem(len, sector_size, &rem); 429 end_sector = div_u64_rem(ns_offset + len, sector_size, &rem);
430 if (rem) 430 if (rem)
431 num_sectors++; 431 end_sector++;
432 num_sectors = end_sector - start_sector;
432 433
433 if (unlikely(num_sectors > (u64)INT_MAX)) { 434 if (unlikely(num_sectors > (u64)INT_MAX)) {
434 u64 remaining = num_sectors; 435 u64 remaining = num_sectors;
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index cb96f4a7ae3a..c49f1f8b2e57 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -336,7 +336,7 @@ static int nvme_get_stream_params(struct nvme_ctrl *ctrl,
336 336
337 c.directive.opcode = nvme_admin_directive_recv; 337 c.directive.opcode = nvme_admin_directive_recv;
338 c.directive.nsid = cpu_to_le32(nsid); 338 c.directive.nsid = cpu_to_le32(nsid);
339 c.directive.numd = sizeof(*s); 339 c.directive.numd = cpu_to_le32(sizeof(*s));
340 c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM; 340 c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM;
341 c.directive.dtype = NVME_DIR_STREAMS; 341 c.directive.dtype = NVME_DIR_STREAMS;
342 342
@@ -1995,6 +1995,9 @@ static ssize_t wwid_show(struct device *dev, struct device_attribute *attr,
1995 int serial_len = sizeof(ctrl->serial); 1995 int serial_len = sizeof(ctrl->serial);
1996 int model_len = sizeof(ctrl->model); 1996 int model_len = sizeof(ctrl->model);
1997 1997
1998 if (!uuid_is_null(&ns->uuid))
1999 return sprintf(buf, "uuid.%pU\n", &ns->uuid);
2000
1998 if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid))) 2001 if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
1999 return sprintf(buf, "eui.%16phN\n", ns->nguid); 2002 return sprintf(buf, "eui.%16phN\n", ns->nguid);
2000 2003
@@ -2709,7 +2712,8 @@ void nvme_kill_queues(struct nvme_ctrl *ctrl)
2709 mutex_lock(&ctrl->namespaces_mutex); 2712 mutex_lock(&ctrl->namespaces_mutex);
2710 2713
2711 /* Forcibly unquiesce queues to avoid blocking dispatch */ 2714 /* Forcibly unquiesce queues to avoid blocking dispatch */
2712 blk_mq_unquiesce_queue(ctrl->admin_q); 2715 if (ctrl->admin_q)
2716 blk_mq_unquiesce_queue(ctrl->admin_q);
2713 2717
2714 list_for_each_entry(ns, &ctrl->namespaces, list) { 2718 list_for_each_entry(ns, &ctrl->namespaces, list) {
2715 /* 2719 /*
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index d666ada39a9b..5c2a08ef08ba 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1888,7 +1888,7 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
1888 * the target device is present 1888 * the target device is present
1889 */ 1889 */
1890 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE) 1890 if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
1891 return BLK_STS_IOERR; 1891 goto busy;
1892 1892
1893 if (!nvme_fc_ctrl_get(ctrl)) 1893 if (!nvme_fc_ctrl_get(ctrl))
1894 return BLK_STS_IOERR; 1894 return BLK_STS_IOERR;
@@ -1958,22 +1958,25 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
1958 queue->lldd_handle, &op->fcp_req); 1958 queue->lldd_handle, &op->fcp_req);
1959 1959
1960 if (ret) { 1960 if (ret) {
1961 if (op->rq) /* normal request */ 1961 if (!(op->flags & FCOP_FLAGS_AEN))
1962 nvme_fc_unmap_data(ctrl, op->rq, op); 1962 nvme_fc_unmap_data(ctrl, op->rq, op);
1963 /* else - aen. no cleanup needed */
1964 1963
1965 nvme_fc_ctrl_put(ctrl); 1964 nvme_fc_ctrl_put(ctrl);
1966 1965
1967 if (ret != -EBUSY) 1966 if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&
1967 ret != -EBUSY)
1968 return BLK_STS_IOERR; 1968 return BLK_STS_IOERR;
1969 1969
1970 if (op->rq) 1970 goto busy;
1971 blk_mq_delay_run_hw_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
1972
1973 return BLK_STS_RESOURCE;
1974 } 1971 }
1975 1972
1976 return BLK_STS_OK; 1973 return BLK_STS_OK;
1974
1975busy:
1976 if (!(op->flags & FCOP_FLAGS_AEN) && queue->hctx)
1977 blk_mq_delay_run_hw_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
1978
1979 return BLK_STS_RESOURCE;
1977} 1980}
1978 1981
1979static blk_status_t 1982static blk_status_t
@@ -2802,66 +2805,70 @@ out_fail:
2802 return ERR_PTR(ret); 2805 return ERR_PTR(ret);
2803} 2806}
2804 2807
2805enum {
2806 FCT_TRADDR_ERR = 0,
2807 FCT_TRADDR_WWNN = 1 << 0,
2808 FCT_TRADDR_WWPN = 1 << 1,
2809};
2810 2808
2811struct nvmet_fc_traddr { 2809struct nvmet_fc_traddr {
2812 u64 nn; 2810 u64 nn;
2813 u64 pn; 2811 u64 pn;
2814}; 2812};
2815 2813
2816static const match_table_t traddr_opt_tokens = {
2817 { FCT_TRADDR_WWNN, "nn-%s" },
2818 { FCT_TRADDR_WWPN, "pn-%s" },
2819 { FCT_TRADDR_ERR, NULL }
2820};
2821
2822static int 2814static int
2823nvme_fc_parse_address(struct nvmet_fc_traddr *traddr, char *buf) 2815__nvme_fc_parse_u64(substring_t *sstr, u64 *val)
2824{ 2816{
2825 substring_t args[MAX_OPT_ARGS];
2826 char *options, *o, *p;
2827 int token, ret = 0;
2828 u64 token64; 2817 u64 token64;
2829 2818
2830 options = o = kstrdup(buf, GFP_KERNEL); 2819 if (match_u64(sstr, &token64))
2831 if (!options) 2820 return -EINVAL;
2832 return -ENOMEM; 2821 *val = token64;
2833 2822
2834 while ((p = strsep(&o, ":\n")) != NULL) { 2823 return 0;
2835 if (!*p) 2824}
2836 continue;
2837 2825
2838 token = match_token(p, traddr_opt_tokens, args); 2826/*
2839 switch (token) { 2827 * This routine validates and extracts the WWN's from the TRADDR string.
2840 case FCT_TRADDR_WWNN: 2828 * As kernel parsers need the 0x to determine number base, universally
2841 if (match_u64(args, &token64)) { 2829 * build string to parse with 0x prefix before parsing name strings.
2842 ret = -EINVAL; 2830 */
2843 goto out; 2831static int
2844 } 2832nvme_fc_parse_traddr(struct nvmet_fc_traddr *traddr, char *buf, size_t blen)
2845 traddr->nn = token64; 2833{
2846 break; 2834 char name[2 + NVME_FC_TRADDR_HEXNAMELEN + 1];
2847 case FCT_TRADDR_WWPN: 2835 substring_t wwn = { name, &name[sizeof(name)-1] };
2848 if (match_u64(args, &token64)) { 2836 int nnoffset, pnoffset;
2849 ret = -EINVAL; 2837
2850 goto out; 2838 /* validate it string one of the 2 allowed formats */
2851 } 2839 if (strnlen(buf, blen) == NVME_FC_TRADDR_MAXLENGTH &&
2852 traddr->pn = token64; 2840 !strncmp(buf, "nn-0x", NVME_FC_TRADDR_OXNNLEN) &&
2853 break; 2841 !strncmp(&buf[NVME_FC_TRADDR_MAX_PN_OFFSET],
2854 default: 2842 "pn-0x", NVME_FC_TRADDR_OXNNLEN)) {
2855 pr_warn("unknown traddr token or missing value '%s'\n", 2843 nnoffset = NVME_FC_TRADDR_OXNNLEN;
2856 p); 2844 pnoffset = NVME_FC_TRADDR_MAX_PN_OFFSET +
2857 ret = -EINVAL; 2845 NVME_FC_TRADDR_OXNNLEN;
2858 goto out; 2846 } else if ((strnlen(buf, blen) == NVME_FC_TRADDR_MINLENGTH &&
2859 } 2847 !strncmp(buf, "nn-", NVME_FC_TRADDR_NNLEN) &&
2860 } 2848 !strncmp(&buf[NVME_FC_TRADDR_MIN_PN_OFFSET],
2849 "pn-", NVME_FC_TRADDR_NNLEN))) {
2850 nnoffset = NVME_FC_TRADDR_NNLEN;
2851 pnoffset = NVME_FC_TRADDR_MIN_PN_OFFSET + NVME_FC_TRADDR_NNLEN;
2852 } else
2853 goto out_einval;
2861 2854
2862out: 2855 name[0] = '0';
2863 kfree(options); 2856 name[1] = 'x';
2864 return ret; 2857 name[2 + NVME_FC_TRADDR_HEXNAMELEN] = 0;
2858
2859 memcpy(&name[2], &buf[nnoffset], NVME_FC_TRADDR_HEXNAMELEN);
2860 if (__nvme_fc_parse_u64(&wwn, &traddr->nn))
2861 goto out_einval;
2862
2863 memcpy(&name[2], &buf[pnoffset], NVME_FC_TRADDR_HEXNAMELEN);
2864 if (__nvme_fc_parse_u64(&wwn, &traddr->pn))
2865 goto out_einval;
2866
2867 return 0;
2868
2869out_einval:
2870 pr_warn("%s: bad traddr string\n", __func__);
2871 return -EINVAL;
2865} 2872}
2866 2873
2867static struct nvme_ctrl * 2874static struct nvme_ctrl *
@@ -2875,11 +2882,11 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
2875 unsigned long flags; 2882 unsigned long flags;
2876 int ret; 2883 int ret;
2877 2884
2878 ret = nvme_fc_parse_address(&raddr, opts->traddr); 2885 ret = nvme_fc_parse_traddr(&raddr, opts->traddr, NVMF_TRADDR_SIZE);
2879 if (ret || !raddr.nn || !raddr.pn) 2886 if (ret || !raddr.nn || !raddr.pn)
2880 return ERR_PTR(-EINVAL); 2887 return ERR_PTR(-EINVAL);
2881 2888
2882 ret = nvme_fc_parse_address(&laddr, opts->host_traddr); 2889 ret = nvme_fc_parse_traddr(&laddr, opts->host_traddr, NVMF_TRADDR_SIZE);
2883 if (ret || !laddr.nn || !laddr.pn) 2890 if (ret || !laddr.nn || !laddr.pn)
2884 return ERR_PTR(-EINVAL); 2891 return ERR_PTR(-EINVAL);
2885 2892
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index d10d2f279d19..cd888a47d0fc 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -539,7 +539,7 @@ static void nvme_dif_complete(u32 p, u32 v, struct t10_pi_tuple *pi)
539} 539}
540#endif 540#endif
541 541
542static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) 542static blk_status_t nvme_setup_prps(struct nvme_dev *dev, struct request *req)
543{ 543{
544 struct nvme_iod *iod = blk_mq_rq_to_pdu(req); 544 struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
545 struct dma_pool *pool; 545 struct dma_pool *pool;
@@ -556,7 +556,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)
556 556
557 length -= (page_size - offset); 557 length -= (page_size - offset);
558 if (length <= 0) 558 if (length <= 0)
559 return true; 559 return BLK_STS_OK;
560 560
561 dma_len -= (page_size - offset); 561 dma_len -= (page_size - offset);
562 if (dma_len) { 562 if (dma_len) {
@@ -569,7 +569,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)
569 569
570 if (length <= page_size) { 570 if (length <= page_size) {
571 iod->first_dma = dma_addr; 571 iod->first_dma = dma_addr;
572 return true; 572 return BLK_STS_OK;
573 } 573 }
574 574
575 nprps = DIV_ROUND_UP(length, page_size); 575 nprps = DIV_ROUND_UP(length, page_size);
@@ -585,7 +585,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)
585 if (!prp_list) { 585 if (!prp_list) {
586 iod->first_dma = dma_addr; 586 iod->first_dma = dma_addr;
587 iod->npages = -1; 587 iod->npages = -1;
588 return false; 588 return BLK_STS_RESOURCE;
589 } 589 }
590 list[0] = prp_list; 590 list[0] = prp_list;
591 iod->first_dma = prp_dma; 591 iod->first_dma = prp_dma;
@@ -595,7 +595,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)
595 __le64 *old_prp_list = prp_list; 595 __le64 *old_prp_list = prp_list;
596 prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma); 596 prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma);
597 if (!prp_list) 597 if (!prp_list)
598 return false; 598 return BLK_STS_RESOURCE;
599 list[iod->npages++] = prp_list; 599 list[iod->npages++] = prp_list;
600 prp_list[0] = old_prp_list[i - 1]; 600 prp_list[0] = old_prp_list[i - 1];
601 old_prp_list[i - 1] = cpu_to_le64(prp_dma); 601 old_prp_list[i - 1] = cpu_to_le64(prp_dma);
@@ -609,13 +609,29 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)
609 break; 609 break;
610 if (dma_len > 0) 610 if (dma_len > 0)
611 continue; 611 continue;
612 BUG_ON(dma_len < 0); 612 if (unlikely(dma_len < 0))
613 goto bad_sgl;
613 sg = sg_next(sg); 614 sg = sg_next(sg);
614 dma_addr = sg_dma_address(sg); 615 dma_addr = sg_dma_address(sg);
615 dma_len = sg_dma_len(sg); 616 dma_len = sg_dma_len(sg);
616 } 617 }
617 618
618 return true; 619 return BLK_STS_OK;
620
621 bad_sgl:
622 if (WARN_ONCE(1, "Invalid SGL for payload:%d nents:%d\n",
623 blk_rq_payload_bytes(req), iod->nents)) {
624 for_each_sg(iod->sg, sg, iod->nents, i) {
625 dma_addr_t phys = sg_phys(sg);
626 pr_warn("sg[%d] phys_addr:%pad offset:%d length:%d "
627 "dma_address:%pad dma_length:%d\n", i, &phys,
628 sg->offset, sg->length,
629 &sg_dma_address(sg),
630 sg_dma_len(sg));
631 }
632 }
633 return BLK_STS_IOERR;
634
619} 635}
620 636
621static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, 637static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
@@ -637,7 +653,8 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
637 DMA_ATTR_NO_WARN)) 653 DMA_ATTR_NO_WARN))
638 goto out; 654 goto out;
639 655
640 if (!nvme_setup_prps(dev, req)) 656 ret = nvme_setup_prps(dev, req);
657 if (ret != BLK_STS_OK)
641 goto out_unmap; 658 goto out_unmap;
642 659
643 ret = BLK_STS_IOERR; 660 ret = BLK_STS_IOERR;
@@ -1602,7 +1619,7 @@ static void nvme_free_host_mem(struct nvme_dev *dev)
1602static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred) 1619static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
1603{ 1620{
1604 struct nvme_host_mem_buf_desc *descs; 1621 struct nvme_host_mem_buf_desc *descs;
1605 u32 chunk_size, max_entries; 1622 u32 chunk_size, max_entries, len;
1606 int i = 0; 1623 int i = 0;
1607 void **bufs; 1624 void **bufs;
1608 u64 size = 0, tmp; 1625 u64 size = 0, tmp;
@@ -1621,10 +1638,10 @@ retry:
1621 if (!bufs) 1638 if (!bufs)
1622 goto out_free_descs; 1639 goto out_free_descs;
1623 1640
1624 for (size = 0; size < preferred; size += chunk_size) { 1641 for (size = 0; size < preferred; size += len) {
1625 u32 len = min_t(u64, chunk_size, preferred - size);
1626 dma_addr_t dma_addr; 1642 dma_addr_t dma_addr;
1627 1643
1644 len = min_t(u64, chunk_size, preferred - size);
1628 bufs[i] = dma_alloc_attrs(dev->dev, len, &dma_addr, GFP_KERNEL, 1645 bufs[i] = dma_alloc_attrs(dev->dev, len, &dma_addr, GFP_KERNEL,
1629 DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN); 1646 DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
1630 if (!bufs[i]) 1647 if (!bufs[i])
@@ -2282,7 +2299,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2282 2299
2283 result = nvme_dev_map(dev); 2300 result = nvme_dev_map(dev);
2284 if (result) 2301 if (result)
2285 goto free; 2302 goto put_pci;
2286 2303
2287 INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work); 2304 INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work);
2288 INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work); 2305 INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work);
@@ -2291,7 +2308,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2291 2308
2292 result = nvme_setup_prp_pools(dev); 2309 result = nvme_setup_prp_pools(dev);
2293 if (result) 2310 if (result)
2294 goto put_pci; 2311 goto unmap;
2295 2312
2296 quirks |= check_dell_samsung_bug(pdev); 2313 quirks |= check_dell_samsung_bug(pdev);
2297 2314
@@ -2308,9 +2325,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2308 2325
2309 release_pools: 2326 release_pools:
2310 nvme_release_prp_pools(dev); 2327 nvme_release_prp_pools(dev);
2328 unmap:
2329 nvme_dev_unmap(dev);
2311 put_pci: 2330 put_pci:
2312 put_device(dev->dev); 2331 put_device(dev->dev);
2313 nvme_dev_unmap(dev);
2314 free: 2332 free:
2315 kfree(dev->queues); 2333 kfree(dev->queues);
2316 kfree(dev); 2334 kfree(dev);
@@ -2466,6 +2484,9 @@ static const struct pci_device_id nvme_id_table[] = {
2466 { PCI_VDEVICE(INTEL, 0x0a54), 2484 { PCI_VDEVICE(INTEL, 0x0a54),
2467 .driver_data = NVME_QUIRK_STRIPE_SIZE | 2485 .driver_data = NVME_QUIRK_STRIPE_SIZE |
2468 NVME_QUIRK_DEALLOCATE_ZEROES, }, 2486 NVME_QUIRK_DEALLOCATE_ZEROES, },
2487 { PCI_VDEVICE(INTEL, 0x0a55),
2488 .driver_data = NVME_QUIRK_STRIPE_SIZE |
2489 NVME_QUIRK_DEALLOCATE_ZEROES, },
2469 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ 2490 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
2470 .driver_data = NVME_QUIRK_NO_DEEPEST_PS }, 2491 .driver_data = NVME_QUIRK_NO_DEEPEST_PS },
2471 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ 2492 { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index 35f930db3c02..2d7a98ab53fb 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -168,11 +168,21 @@ out:
168 nvmet_req_complete(req, status); 168 nvmet_req_complete(req, status);
169} 169}
170 170
171static void copy_and_pad(char *dst, int dst_len, const char *src, int src_len)
172{
173 int len = min(src_len, dst_len);
174
175 memcpy(dst, src, len);
176 if (dst_len > len)
177 memset(dst + len, ' ', dst_len - len);
178}
179
171static void nvmet_execute_identify_ctrl(struct nvmet_req *req) 180static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
172{ 181{
173 struct nvmet_ctrl *ctrl = req->sq->ctrl; 182 struct nvmet_ctrl *ctrl = req->sq->ctrl;
174 struct nvme_id_ctrl *id; 183 struct nvme_id_ctrl *id;
175 u16 status = 0; 184 u16 status = 0;
185 const char model[] = "Linux";
176 186
177 id = kzalloc(sizeof(*id), GFP_KERNEL); 187 id = kzalloc(sizeof(*id), GFP_KERNEL);
178 if (!id) { 188 if (!id) {
@@ -184,8 +194,10 @@ static void nvmet_execute_identify_ctrl(struct nvmet_req *req)
184 id->vid = 0; 194 id->vid = 0;
185 id->ssvid = 0; 195 id->ssvid = 0;
186 196
187 memset(id->sn, ' ', sizeof(id->sn)); 197 bin2hex(id->sn, &ctrl->subsys->serial,
188 snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial); 198 min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2));
199 copy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1);
200 copy_and_pad(id->fr, sizeof(id->fr), UTS_RELEASE, strlen(UTS_RELEASE));
189 201
190 memset(id->mn, ' ', sizeof(id->mn)); 202 memset(id->mn, ' ', sizeof(id->mn));
191 strncpy((char *)id->mn, "Linux", sizeof(id->mn)); 203 strncpy((char *)id->mn, "Linux", sizeof(id->mn));
diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
index a358ecd93e11..0a0067e771f5 100644
--- a/drivers/nvme/target/configfs.c
+++ b/drivers/nvme/target/configfs.c
@@ -650,7 +650,7 @@ out_unlock:
650 650
651CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host); 651CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host);
652 652
653static ssize_t nvmet_subsys_version_show(struct config_item *item, 653static ssize_t nvmet_subsys_attr_version_show(struct config_item *item,
654 char *page) 654 char *page)
655{ 655{
656 struct nvmet_subsys *subsys = to_subsys(item); 656 struct nvmet_subsys *subsys = to_subsys(item);
@@ -666,7 +666,7 @@ static ssize_t nvmet_subsys_version_show(struct config_item *item,
666 (int)NVME_MINOR(subsys->ver)); 666 (int)NVME_MINOR(subsys->ver));
667} 667}
668 668
669static ssize_t nvmet_subsys_version_store(struct config_item *item, 669static ssize_t nvmet_subsys_attr_version_store(struct config_item *item,
670 const char *page, size_t count) 670 const char *page, size_t count)
671{ 671{
672 struct nvmet_subsys *subsys = to_subsys(item); 672 struct nvmet_subsys *subsys = to_subsys(item);
@@ -684,11 +684,33 @@ static ssize_t nvmet_subsys_version_store(struct config_item *item,
684 684
685 return count; 685 return count;
686} 686}
687CONFIGFS_ATTR(nvmet_subsys_, version); 687CONFIGFS_ATTR(nvmet_subsys_, attr_version);
688
689static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item,
690 char *page)
691{
692 struct nvmet_subsys *subsys = to_subsys(item);
693
694 return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial);
695}
696
697static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item,
698 const char *page, size_t count)
699{
700 struct nvmet_subsys *subsys = to_subsys(item);
701
702 down_write(&nvmet_config_sem);
703 sscanf(page, "%llx\n", &subsys->serial);
704 up_write(&nvmet_config_sem);
705
706 return count;
707}
708CONFIGFS_ATTR(nvmet_subsys_, attr_serial);
688 709
689static struct configfs_attribute *nvmet_subsys_attrs[] = { 710static struct configfs_attribute *nvmet_subsys_attrs[] = {
690 &nvmet_subsys_attr_attr_allow_any_host, 711 &nvmet_subsys_attr_attr_allow_any_host,
691 &nvmet_subsys_attr_version, 712 &nvmet_subsys_attr_attr_version,
713 &nvmet_subsys_attr_attr_serial,
692 NULL, 714 NULL,
693}; 715};
694 716
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b5b4ac103748..f4b02bb4a1a8 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -767,9 +767,6 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
767 memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE); 767 memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE);
768 memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE); 768 memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE);
769 769
770 /* generate a random serial number as our controllers are ephemeral: */
771 get_random_bytes(&ctrl->serial, sizeof(ctrl->serial));
772
773 kref_init(&ctrl->ref); 770 kref_init(&ctrl->ref);
774 ctrl->subsys = subsys; 771 ctrl->subsys = subsys;
775 772
@@ -928,6 +925,8 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
928 return NULL; 925 return NULL;
929 926
930 subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */ 927 subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */
928 /* generate a random serial number as our controllers are ephemeral: */
929 get_random_bytes(&subsys->serial, sizeof(subsys->serial));
931 930
932 switch (type) { 931 switch (type) {
933 case NVME_NQN_NVME: 932 case NVME_NQN_NVME:
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 1e6dcc241b3c..31ca55dfcb1d 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1174,14 +1174,14 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
1174 */ 1174 */
1175 if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN) 1175 if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN)
1176 ret = VERR_CR_ASSOC_LEN; 1176 ret = VERR_CR_ASSOC_LEN;
1177 else if (rqst->desc_list_len < 1177 else if (be32_to_cpu(rqst->desc_list_len) <
1178 cpu_to_be32(FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN)) 1178 FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN)
1179 ret = VERR_CR_ASSOC_RQST_LEN; 1179 ret = VERR_CR_ASSOC_RQST_LEN;
1180 else if (rqst->assoc_cmd.desc_tag != 1180 else if (rqst->assoc_cmd.desc_tag !=
1181 cpu_to_be32(FCNVME_LSDESC_CREATE_ASSOC_CMD)) 1181 cpu_to_be32(FCNVME_LSDESC_CREATE_ASSOC_CMD))
1182 ret = VERR_CR_ASSOC_CMD; 1182 ret = VERR_CR_ASSOC_CMD;
1183 else if (rqst->assoc_cmd.desc_len < 1183 else if (be32_to_cpu(rqst->assoc_cmd.desc_len) <
1184 cpu_to_be32(FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN)) 1184 FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN)
1185 ret = VERR_CR_ASSOC_CMD_LEN; 1185 ret = VERR_CR_ASSOC_CMD_LEN;
1186 else if (!rqst->assoc_cmd.ersp_ratio || 1186 else if (!rqst->assoc_cmd.ersp_ratio ||
1187 (be16_to_cpu(rqst->assoc_cmd.ersp_ratio) >= 1187 (be16_to_cpu(rqst->assoc_cmd.ersp_ratio) >=
@@ -2293,66 +2293,70 @@ nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *target_port,
2293} 2293}
2294EXPORT_SYMBOL_GPL(nvmet_fc_rcv_fcp_abort); 2294EXPORT_SYMBOL_GPL(nvmet_fc_rcv_fcp_abort);
2295 2295
2296enum {
2297 FCT_TRADDR_ERR = 0,
2298 FCT_TRADDR_WWNN = 1 << 0,
2299 FCT_TRADDR_WWPN = 1 << 1,
2300};
2301 2296
2302struct nvmet_fc_traddr { 2297struct nvmet_fc_traddr {
2303 u64 nn; 2298 u64 nn;
2304 u64 pn; 2299 u64 pn;
2305}; 2300};
2306 2301
2307static const match_table_t traddr_opt_tokens = {
2308 { FCT_TRADDR_WWNN, "nn-%s" },
2309 { FCT_TRADDR_WWPN, "pn-%s" },
2310 { FCT_TRADDR_ERR, NULL }
2311};
2312
2313static int 2302static int
2314nvmet_fc_parse_traddr(struct nvmet_fc_traddr *traddr, char *buf) 2303__nvme_fc_parse_u64(substring_t *sstr, u64 *val)
2315{ 2304{
2316 substring_t args[MAX_OPT_ARGS];
2317 char *options, *o, *p;
2318 int token, ret = 0;
2319 u64 token64; 2305 u64 token64;
2320 2306
2321 options = o = kstrdup(buf, GFP_KERNEL); 2307 if (match_u64(sstr, &token64))
2322 if (!options) 2308 return -EINVAL;
2323 return -ENOMEM; 2309 *val = token64;
2324 2310
2325 while ((p = strsep(&o, ":\n")) != NULL) { 2311 return 0;
2326 if (!*p) 2312}
2327 continue;
2328 2313
2329 token = match_token(p, traddr_opt_tokens, args); 2314/*
2330 switch (token) { 2315 * This routine validates and extracts the WWN's from the TRADDR string.
2331 case FCT_TRADDR_WWNN: 2316 * As kernel parsers need the 0x to determine number base, universally
2332 if (match_u64(args, &token64)) { 2317 * build string to parse with 0x prefix before parsing name strings.
2333 ret = -EINVAL; 2318 */
2334 goto out; 2319static int
2335 } 2320nvme_fc_parse_traddr(struct nvmet_fc_traddr *traddr, char *buf, size_t blen)
2336 traddr->nn = token64; 2321{
2337 break; 2322 char name[2 + NVME_FC_TRADDR_HEXNAMELEN + 1];
2338 case FCT_TRADDR_WWPN: 2323 substring_t wwn = { name, &name[sizeof(name)-1] };
2339 if (match_u64(args, &token64)) { 2324 int nnoffset, pnoffset;
2340 ret = -EINVAL; 2325
2341 goto out; 2326 /* validate it string one of the 2 allowed formats */
2342 } 2327 if (strnlen(buf, blen) == NVME_FC_TRADDR_MAXLENGTH &&
2343 traddr->pn = token64; 2328 !strncmp(buf, "nn-0x", NVME_FC_TRADDR_OXNNLEN) &&
2344 break; 2329 !strncmp(&buf[NVME_FC_TRADDR_MAX_PN_OFFSET],
2345 default: 2330 "pn-0x", NVME_FC_TRADDR_OXNNLEN)) {
2346 pr_warn("unknown traddr token or missing value '%s'\n", 2331 nnoffset = NVME_FC_TRADDR_OXNNLEN;
2347 p); 2332 pnoffset = NVME_FC_TRADDR_MAX_PN_OFFSET +
2348 ret = -EINVAL; 2333 NVME_FC_TRADDR_OXNNLEN;
2349 goto out; 2334 } else if ((strnlen(buf, blen) == NVME_FC_TRADDR_MINLENGTH &&
2350 } 2335 !strncmp(buf, "nn-", NVME_FC_TRADDR_NNLEN) &&
2351 } 2336 !strncmp(&buf[NVME_FC_TRADDR_MIN_PN_OFFSET],
2337 "pn-", NVME_FC_TRADDR_NNLEN))) {
2338 nnoffset = NVME_FC_TRADDR_NNLEN;
2339 pnoffset = NVME_FC_TRADDR_MIN_PN_OFFSET + NVME_FC_TRADDR_NNLEN;
2340 } else
2341 goto out_einval;
2342
2343 name[0] = '0';
2344 name[1] = 'x';
2345 name[2 + NVME_FC_TRADDR_HEXNAMELEN] = 0;
2346
2347 memcpy(&name[2], &buf[nnoffset], NVME_FC_TRADDR_HEXNAMELEN);
2348 if (__nvme_fc_parse_u64(&wwn, &traddr->nn))
2349 goto out_einval;
2350
2351 memcpy(&name[2], &buf[pnoffset], NVME_FC_TRADDR_HEXNAMELEN);
2352 if (__nvme_fc_parse_u64(&wwn, &traddr->pn))
2353 goto out_einval;
2352 2354
2353out: 2355 return 0;
2354 kfree(options); 2356
2355 return ret; 2357out_einval:
2358 pr_warn("%s: bad traddr string\n", __func__);
2359 return -EINVAL;
2356} 2360}
2357 2361
2358static int 2362static int
@@ -2370,7 +2374,8 @@ nvmet_fc_add_port(struct nvmet_port *port)
2370 2374
2371 /* map the traddr address info to a target port */ 2375 /* map the traddr address info to a target port */
2372 2376
2373 ret = nvmet_fc_parse_traddr(&traddr, port->disc_addr.traddr); 2377 ret = nvme_fc_parse_traddr(&traddr, port->disc_addr.traddr,
2378 sizeof(port->disc_addr.traddr));
2374 if (ret) 2379 if (ret)
2375 return ret; 2380 return ret;
2376 2381
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 747bbdb4f9c6..e3b244c7e443 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -112,7 +112,6 @@ struct nvmet_ctrl {
112 112
113 struct mutex lock; 113 struct mutex lock;
114 u64 cap; 114 u64 cap;
115 u64 serial;
116 u32 cc; 115 u32 cc;
117 u32 csts; 116 u32 csts;
118 117
@@ -152,6 +151,7 @@ struct nvmet_subsys {
152 u16 max_qid; 151 u16 max_qid;
153 152
154 u64 ver; 153 u64 ver;
154 u64 serial;
155 char *subsysnqn; 155 char *subsysnqn;
156 156
157 struct config_group group; 157 struct config_group group;
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index a0d4ede9b8fc..63e3eb55f3ac 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -170,7 +170,7 @@ static const struct of_device_id rockchip_efuse_match[] = {
170 .data = (void *)&rockchip_rk3288_efuse_read, 170 .data = (void *)&rockchip_rk3288_efuse_read,
171 }, 171 },
172 { 172 {
173 .compatible = "rockchip,rk322x-efuse", 173 .compatible = "rockchip,rk3228-efuse",
174 .data = (void *)&rockchip_rk3288_efuse_read, 174 .data = (void *)&rockchip_rk3288_efuse_read,
175 }, 175 },
176 { 176 {
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 6ce72aa65425..ab21c846eb27 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -476,7 +476,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res,
476 int i; 476 int i;
477 477
478 for (i = 0; i < nr_irqs; i++, res++) 478 for (i = 0; i < nr_irqs; i++, res++)
479 if (!of_irq_to_resource(dev, i, res)) 479 if (of_irq_to_resource(dev, i, res) <= 0)
480 break; 480 break;
481 481
482 return i; 482 return i;
diff --git a/drivers/of/property.c b/drivers/of/property.c
index eda50b4be934..067f9fab7b77 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -708,6 +708,15 @@ struct device_node *of_graph_get_port_parent(struct device_node *node)
708{ 708{
709 unsigned int depth; 709 unsigned int depth;
710 710
711 if (!node)
712 return NULL;
713
714 /*
715 * Preserve usecount for passed in node as of_get_next_parent()
716 * will do of_node_put() on it.
717 */
718 of_node_get(node);
719
711 /* Walk 3 levels up only if there is 'ports' node. */ 720 /* Walk 3 levels up only if there is 'ports' node. */
712 for (depth = 3; depth && node; depth--) { 721 for (depth = 3; depth && node; depth--) {
713 node = of_get_next_parent(node); 722 node = of_get_next_parent(node);
@@ -728,12 +737,16 @@ EXPORT_SYMBOL(of_graph_get_port_parent);
728struct device_node *of_graph_get_remote_port_parent( 737struct device_node *of_graph_get_remote_port_parent(
729 const struct device_node *node) 738 const struct device_node *node)
730{ 739{
731 struct device_node *np; 740 struct device_node *np, *pp;
732 741
733 /* Get remote endpoint node. */ 742 /* Get remote endpoint node. */
734 np = of_graph_get_remote_endpoint(node); 743 np = of_graph_get_remote_endpoint(node);
735 744
736 return of_graph_get_port_parent(np); 745 pp = of_graph_get_port_parent(np);
746
747 of_node_put(np);
748
749 return pp;
737} 750}
738EXPORT_SYMBOL(of_graph_get_remote_port_parent); 751EXPORT_SYMBOL(of_graph_get_remote_port_parent);
739 752
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
index 055f83fddc18..7147aa53e9a2 100644
--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -954,7 +954,7 @@ static struct attribute *pdcs_subsys_attrs[] = {
954 NULL, 954 NULL,
955}; 955};
956 956
957static struct attribute_group pdcs_attr_group = { 957static const struct attribute_group pdcs_attr_group = {
958 .attrs = pdcs_subsys_attrs, 958 .attrs = pdcs_subsys_attrs,
959}; 959};
960 960
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index dc459eb1246b..1c5e0f333779 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -569,22 +569,41 @@ int armpmu_request_irq(struct arm_pmu *armpmu, int cpu)
569 if (irq != other_irq) { 569 if (irq != other_irq) {
570 pr_warn("mismatched PPIs detected.\n"); 570 pr_warn("mismatched PPIs detected.\n");
571 err = -EINVAL; 571 err = -EINVAL;
572 goto err_out;
572 } 573 }
573 } else { 574 } else {
574 err = request_irq(irq, handler, 575 struct arm_pmu_platdata *platdata = armpmu_get_platdata(armpmu);
575 IRQF_NOBALANCING | IRQF_NO_THREAD, "arm-pmu", 576 unsigned long irq_flags;
577
578 err = irq_force_affinity(irq, cpumask_of(cpu));
579
580 if (err && num_possible_cpus() > 1) {
581 pr_warn("unable to set irq affinity (irq=%d, cpu=%u)\n",
582 irq, cpu);
583 goto err_out;
584 }
585
586 if (platdata && platdata->irq_flags) {
587 irq_flags = platdata->irq_flags;
588 } else {
589 irq_flags = IRQF_PERCPU |
590 IRQF_NOBALANCING |
591 IRQF_NO_THREAD;
592 }
593
594 err = request_irq(irq, handler, irq_flags, "arm-pmu",
576 per_cpu_ptr(&hw_events->percpu_pmu, cpu)); 595 per_cpu_ptr(&hw_events->percpu_pmu, cpu));
577 } 596 }
578 597
579 if (err) { 598 if (err)
580 pr_err("unable to request IRQ%d for ARM PMU counters\n", 599 goto err_out;
581 irq);
582 return err;
583 }
584 600
585 cpumask_set_cpu(cpu, &armpmu->active_irqs); 601 cpumask_set_cpu(cpu, &armpmu->active_irqs);
586
587 return 0; 602 return 0;
603
604err_out:
605 pr_err("unable to request IRQ%d for ARM PMU counters\n", irq);
606 return err;
588} 607}
589 608
590int armpmu_request_irqs(struct arm_pmu *armpmu) 609int armpmu_request_irqs(struct arm_pmu *armpmu)
@@ -628,12 +647,6 @@ static int arm_perf_starting_cpu(unsigned int cpu, struct hlist_node *node)
628 enable_percpu_irq(irq, IRQ_TYPE_NONE); 647 enable_percpu_irq(irq, IRQ_TYPE_NONE);
629 return 0; 648 return 0;
630 } 649 }
631
632 if (irq_force_affinity(irq, cpumask_of(cpu)) &&
633 num_possible_cpus() > 1) {
634 pr_warn("unable to set irq affinity (irq=%d, cpu=%u)\n",
635 irq, cpu);
636 }
637 } 650 }
638 651
639 return 0; 652 return 0;
diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
index 69255f53057a..4eafa7a42e52 100644
--- a/drivers/perf/arm_pmu_platform.c
+++ b/drivers/perf/arm_pmu_platform.c
@@ -131,8 +131,8 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
131 } 131 }
132 132
133 if (!pmu_has_irq_affinity(pdev->dev.of_node)) { 133 if (!pmu_has_irq_affinity(pdev->dev.of_node)) {
134 pr_warn("no interrupt-affinity property for %s, guessing.\n", 134 pr_warn("no interrupt-affinity property for %pOF, guessing.\n",
135 of_node_full_name(pdev->dev.of_node)); 135 pdev->dev.of_node);
136 } 136 }
137 137
138 /* 138 /*
@@ -211,7 +211,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
211 } 211 }
212 212
213 if (ret) { 213 if (ret) {
214 pr_info("%s: failed to probe PMU!\n", of_node_full_name(node)); 214 pr_info("%pOF: failed to probe PMU!\n", node);
215 goto out_free; 215 goto out_free;
216 } 216 }
217 217
@@ -228,8 +228,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
228out_free_irqs: 228out_free_irqs:
229 armpmu_free_irqs(pmu); 229 armpmu_free_irqs(pmu);
230out_free: 230out_free:
231 pr_info("%s: failed to register PMU devices!\n", 231 pr_info("%pOF: failed to register PMU devices!\n", node);
232 of_node_full_name(node));
233 armpmu_free(pmu); 232 armpmu_free(pmu);
234 return ret; 233 return ret;
235} 234}
diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
index c259848228b4..b242cce10468 100644
--- a/drivers/perf/qcom_l2_pmu.c
+++ b/drivers/perf/qcom_l2_pmu.c
@@ -546,6 +546,7 @@ static int l2_cache_event_init(struct perf_event *event)
546 } 546 }
547 547
548 if ((event != event->group_leader) && 548 if ((event != event->group_leader) &&
549 !is_software_event(event->group_leader) &&
549 (L2_EVT_GROUP(event->group_leader->attr.config) == 550 (L2_EVT_GROUP(event->group_leader->attr.config) ==
550 L2_EVT_GROUP(event->attr.config))) { 551 L2_EVT_GROUP(event->attr.config))) {
551 dev_dbg_ratelimited(&l2cache_pmu->pdev->dev, 552 dev_dbg_ratelimited(&l2cache_pmu->pdev->dev,
@@ -558,6 +559,7 @@ static int l2_cache_event_init(struct perf_event *event)
558 list_for_each_entry(sibling, &event->group_leader->sibling_list, 559 list_for_each_entry(sibling, &event->group_leader->sibling_list,
559 group_entry) { 560 group_entry) {
560 if ((sibling != event) && 561 if ((sibling != event) &&
562 !is_software_event(sibling) &&
561 (L2_EVT_GROUP(sibling->attr.config) == 563 (L2_EVT_GROUP(sibling->attr.config) ==
562 L2_EVT_GROUP(event->attr.config))) { 564 L2_EVT_GROUP(event->attr.config))) {
563 dev_dbg_ratelimited(&l2cache_pmu->pdev->dev, 565 dev_dbg_ratelimited(&l2cache_pmu->pdev->dev,
diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c
index 7e0d4f724dda..432fc40990bd 100644
--- a/drivers/s390/cio/chp.c
+++ b/drivers/s390/cio/chp.c
@@ -559,6 +559,7 @@ static void chp_process_crw(struct crw *crw0, struct crw *crw1,
559 chpid.id = crw0->rsid; 559 chpid.id = crw0->rsid;
560 switch (crw0->erc) { 560 switch (crw0->erc) {
561 case CRW_ERC_IPARM: /* Path has come. */ 561 case CRW_ERC_IPARM: /* Path has come. */
562 case CRW_ERC_INIT:
562 if (!chp_is_registered(chpid)) 563 if (!chp_is_registered(chpid))
563 chp_new(chpid); 564 chp_new(chpid);
564 chsc_chp_online(chpid); 565 chsc_chp_online(chpid);
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 077f62e208aa..6a4367cc9caa 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -3401,9 +3401,10 @@ static int cxlflash_afu_debug(struct cxlflash_cfg *cfg,
3401 if (is_write) { 3401 if (is_write) {
3402 req_flags |= SISL_REQ_FLAGS_HOST_WRITE; 3402 req_flags |= SISL_REQ_FLAGS_HOST_WRITE;
3403 3403
3404 rc = copy_from_user(kbuf, ubuf, ulen); 3404 if (copy_from_user(kbuf, ubuf, ulen)) {
3405 if (unlikely(rc)) 3405 rc = -EFAULT;
3406 goto out; 3406 goto out;
3407 }
3407 } 3408 }
3408 } 3409 }
3409 3410
@@ -3431,8 +3432,10 @@ static int cxlflash_afu_debug(struct cxlflash_cfg *cfg,
3431 goto out; 3432 goto out;
3432 } 3433 }
3433 3434
3434 if (ulen && !is_write) 3435 if (ulen && !is_write) {
3435 rc = copy_to_user(ubuf, kbuf, ulen); 3436 if (copy_to_user(ubuf, kbuf, ulen))
3437 rc = -EFAULT;
3438 }
3436out: 3439out:
3437 kfree(buf); 3440 kfree(buf);
3438 dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc); 3441 dev_dbg(dev, "%s: returning rc=%d\n", __func__, rc);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 551d103c27f1..2bfea7082e3a 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -1693,7 +1693,7 @@ static int prep_ssp_v2_hw(struct hisi_hba *hisi_hba,
1693 1693
1694static int parse_trans_tx_err_code_v2_hw(u32 err_msk) 1694static int parse_trans_tx_err_code_v2_hw(u32 err_msk)
1695{ 1695{
1696 const u8 trans_tx_err_code_prio[] = { 1696 static const u8 trans_tx_err_code_prio[] = {
1697 TRANS_TX_OPEN_FAIL_WITH_IT_NEXUS_LOSS, 1697 TRANS_TX_OPEN_FAIL_WITH_IT_NEXUS_LOSS,
1698 TRANS_TX_ERR_PHY_NOT_ENABLE, 1698 TRANS_TX_ERR_PHY_NOT_ENABLE,
1699 TRANS_TX_OPEN_CNX_ERR_WRONG_DESTINATION, 1699 TRANS_TX_OPEN_CNX_ERR_WRONG_DESTINATION,
@@ -1738,7 +1738,7 @@ static int parse_trans_tx_err_code_v2_hw(u32 err_msk)
1738 1738
1739static int parse_trans_rx_err_code_v2_hw(u32 err_msk) 1739static int parse_trans_rx_err_code_v2_hw(u32 err_msk)
1740{ 1740{
1741 const u8 trans_rx_err_code_prio[] = { 1741 static const u8 trans_rx_err_code_prio[] = {
1742 TRANS_RX_ERR_WITH_RXFRAME_CRC_ERR, 1742 TRANS_RX_ERR_WITH_RXFRAME_CRC_ERR,
1743 TRANS_RX_ERR_WITH_RXFIS_8B10B_DISP_ERR, 1743 TRANS_RX_ERR_WITH_RXFIS_8B10B_DISP_ERR,
1744 TRANS_RX_ERR_WITH_RXFRAME_HAVE_ERRPRM, 1744 TRANS_RX_ERR_WITH_RXFRAME_HAVE_ERRPRM,
@@ -1784,7 +1784,7 @@ static int parse_trans_rx_err_code_v2_hw(u32 err_msk)
1784 1784
1785static int parse_dma_tx_err_code_v2_hw(u32 err_msk) 1785static int parse_dma_tx_err_code_v2_hw(u32 err_msk)
1786{ 1786{
1787 const u8 dma_tx_err_code_prio[] = { 1787 static const u8 dma_tx_err_code_prio[] = {
1788 DMA_TX_UNEXP_XFER_ERR, 1788 DMA_TX_UNEXP_XFER_ERR,
1789 DMA_TX_UNEXP_RETRANS_ERR, 1789 DMA_TX_UNEXP_RETRANS_ERR,
1790 DMA_TX_XFER_LEN_OVERFLOW, 1790 DMA_TX_XFER_LEN_OVERFLOW,
@@ -1810,7 +1810,7 @@ static int parse_dma_tx_err_code_v2_hw(u32 err_msk)
1810 1810
1811static int parse_sipc_rx_err_code_v2_hw(u32 err_msk) 1811static int parse_sipc_rx_err_code_v2_hw(u32 err_msk)
1812{ 1812{
1813 const u8 sipc_rx_err_code_prio[] = { 1813 static const u8 sipc_rx_err_code_prio[] = {
1814 SIPC_RX_FIS_STATUS_ERR_BIT_VLD, 1814 SIPC_RX_FIS_STATUS_ERR_BIT_VLD,
1815 SIPC_RX_PIO_WRSETUP_STATUS_DRQ_ERR, 1815 SIPC_RX_PIO_WRSETUP_STATUS_DRQ_ERR,
1816 SIPC_RX_FIS_STATUS_BSY_BIT_ERR, 1816 SIPC_RX_FIS_STATUS_BSY_BIT_ERR,
@@ -1836,7 +1836,7 @@ static int parse_sipc_rx_err_code_v2_hw(u32 err_msk)
1836 1836
1837static int parse_dma_rx_err_code_v2_hw(u32 err_msk) 1837static int parse_dma_rx_err_code_v2_hw(u32 err_msk)
1838{ 1838{
1839 const u8 dma_rx_err_code_prio[] = { 1839 static const u8 dma_rx_err_code_prio[] = {
1840 DMA_RX_UNKNOWN_FRM_ERR, 1840 DMA_RX_UNKNOWN_FRM_ERR,
1841 DMA_RX_DATA_LEN_OVERFLOW, 1841 DMA_RX_DATA_LEN_OVERFLOW,
1842 DMA_RX_DATA_LEN_UNDERFLOW, 1842 DMA_RX_DATA_LEN_UNDERFLOW,
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 8914eab84337..4f7cdb28bd38 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -938,7 +938,7 @@ static struct scsi_host_template hpsa_driver_template = {
938#endif 938#endif
939 .sdev_attrs = hpsa_sdev_attrs, 939 .sdev_attrs = hpsa_sdev_attrs,
940 .shost_attrs = hpsa_shost_attrs, 940 .shost_attrs = hpsa_shost_attrs,
941 .max_sectors = 8192, 941 .max_sectors = 1024,
942 .no_write_same = 1, 942 .no_write_same = 1,
943}; 943};
944 944
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 47f66e949745..ed197bc8e801 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -213,7 +213,7 @@ static void sci_task_request_build_ssp_task_iu(struct isci_request *ireq)
213 * @task_context: 213 * @task_context:
214 * 214 *
215 */ 215 */
216static void scu_ssp_reqeust_construct_task_context( 216static void scu_ssp_request_construct_task_context(
217 struct isci_request *ireq, 217 struct isci_request *ireq,
218 struct scu_task_context *task_context) 218 struct scu_task_context *task_context)
219{ 219{
@@ -425,7 +425,7 @@ static void scu_ssp_io_request_construct_task_context(struct isci_request *ireq,
425 u8 prot_type = scsi_get_prot_type(scmd); 425 u8 prot_type = scsi_get_prot_type(scmd);
426 u8 prot_op = scsi_get_prot_op(scmd); 426 u8 prot_op = scsi_get_prot_op(scmd);
427 427
428 scu_ssp_reqeust_construct_task_context(ireq, task_context); 428 scu_ssp_request_construct_task_context(ireq, task_context);
429 429
430 task_context->ssp_command_iu_length = 430 task_context->ssp_command_iu_length =
431 sizeof(struct ssp_cmd_iu) / sizeof(u32); 431 sizeof(struct ssp_cmd_iu) / sizeof(u32);
@@ -472,7 +472,7 @@ static void scu_ssp_task_request_construct_task_context(struct isci_request *ire
472{ 472{
473 struct scu_task_context *task_context = ireq->tc; 473 struct scu_task_context *task_context = ireq->tc;
474 474
475 scu_ssp_reqeust_construct_task_context(ireq, task_context); 475 scu_ssp_request_construct_task_context(ireq, task_context);
476 476
477 task_context->control_frame = 1; 477 task_context->control_frame = 1;
478 task_context->priority = SCU_TASK_PRIORITY_HIGH; 478 task_context->priority = SCU_TASK_PRIORITY_HIGH;
@@ -495,7 +495,7 @@ static void scu_ssp_task_request_construct_task_context(struct isci_request *ire
495 * the command buffer is complete. none Revisit task context construction to 495 * the command buffer is complete. none Revisit task context construction to
496 * determine what is common for SSP/SMP/STP task context structures. 496 * determine what is common for SSP/SMP/STP task context structures.
497 */ 497 */
498static void scu_sata_reqeust_construct_task_context( 498static void scu_sata_request_construct_task_context(
499 struct isci_request *ireq, 499 struct isci_request *ireq,
500 struct scu_task_context *task_context) 500 struct scu_task_context *task_context)
501{ 501{
@@ -562,7 +562,7 @@ static void scu_stp_raw_request_construct_task_context(struct isci_request *ireq
562{ 562{
563 struct scu_task_context *task_context = ireq->tc; 563 struct scu_task_context *task_context = ireq->tc;
564 564
565 scu_sata_reqeust_construct_task_context(ireq, task_context); 565 scu_sata_request_construct_task_context(ireq, task_context);
566 566
567 task_context->control_frame = 0; 567 task_context->control_frame = 0;
568 task_context->priority = SCU_TASK_PRIORITY_NORMAL; 568 task_context->priority = SCU_TASK_PRIORITY_NORMAL;
@@ -613,7 +613,7 @@ static void sci_stp_optimized_request_construct(struct isci_request *ireq,
613 struct scu_task_context *task_context = ireq->tc; 613 struct scu_task_context *task_context = ireq->tc;
614 614
615 /* Build the STP task context structure */ 615 /* Build the STP task context structure */
616 scu_sata_reqeust_construct_task_context(ireq, task_context); 616 scu_sata_request_construct_task_context(ireq, task_context);
617 617
618 /* Copy over the SGL elements */ 618 /* Copy over the SGL elements */
619 sci_request_build_sgl(ireq); 619 sci_request_build_sgl(ireq);
@@ -1401,7 +1401,7 @@ static enum sci_status sci_stp_request_pio_data_out_transmit_data(struct isci_re
1401 * @data_buffer: The buffer of data to be copied. 1401 * @data_buffer: The buffer of data to be copied.
1402 * @length: The length of the data transfer. 1402 * @length: The length of the data transfer.
1403 * 1403 *
1404 * Copy the data from the buffer for the length specified to the IO reqeust SGL 1404 * Copy the data from the buffer for the length specified to the IO request SGL
1405 * specified data region. enum sci_status 1405 * specified data region. enum sci_status
1406 */ 1406 */
1407static enum sci_status 1407static enum sci_status
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index fd501f8dbb11..8660f923ace0 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -573,7 +573,7 @@ static void fc_disc_gpn_ft_resp(struct fc_seq *sp, struct fc_frame *fp,
573 event = DISC_EV_FAILED; 573 event = DISC_EV_FAILED;
574 } 574 }
575 if (error) 575 if (error)
576 fc_disc_error(disc, fp); 576 fc_disc_error(disc, ERR_PTR(error));
577 else if (event != DISC_EV_NONE) 577 else if (event != DISC_EV_NONE)
578 fc_disc_done(disc, event); 578 fc_disc_done(disc, event);
579 fc_frame_free(fp); 579 fc_frame_free(fp);
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index b58bba4604e8..7786c97e033f 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1227,7 +1227,7 @@ static void qedf_rport_event_handler(struct fc_lport *lport,
1227 1227
1228 if (rdata->spp_type != FC_TYPE_FCP) { 1228 if (rdata->spp_type != FC_TYPE_FCP) {
1229 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, 1229 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
1230 "Not offlading since since spp type isn't FCP\n"); 1230 "Not offloading since spp type isn't FCP\n");
1231 break; 1231 break;
1232 } 1232 }
1233 if (!(rdata->ids.roles & FC_RPORT_ROLE_FCP_TARGET)) { 1233 if (!(rdata->ids.roles & FC_RPORT_ROLE_FCP_TARGET)) {
diff --git a/drivers/scsi/qedi/qedi.h b/drivers/scsi/qedi/qedi.h
index 32632c9b2276..91d2f51c351b 100644
--- a/drivers/scsi/qedi/qedi.h
+++ b/drivers/scsi/qedi/qedi.h
@@ -23,11 +23,17 @@
23#include <linux/qed/qed_iscsi_if.h> 23#include <linux/qed/qed_iscsi_if.h>
24#include <linux/qed/qed_ll2_if.h> 24#include <linux/qed/qed_ll2_if.h>
25#include "qedi_version.h" 25#include "qedi_version.h"
26#include "qedi_nvm_iscsi_cfg.h"
26 27
27#define QEDI_MODULE_NAME "qedi" 28#define QEDI_MODULE_NAME "qedi"
28 29
29struct qedi_endpoint; 30struct qedi_endpoint;
30 31
32#ifndef GET_FIELD2
33#define GET_FIELD2(value, name) \
34 (((value) & (name ## _MASK)) >> (name ## _OFFSET))
35#endif
36
31/* 37/*
32 * PCI function probe defines 38 * PCI function probe defines
33 */ 39 */
@@ -66,6 +72,11 @@ struct qedi_endpoint;
66#define QEDI_HW_DMA_BOUNDARY 0xfff 72#define QEDI_HW_DMA_BOUNDARY 0xfff
67#define QEDI_PATH_HANDLE 0xFE0000000UL 73#define QEDI_PATH_HANDLE 0xFE0000000UL
68 74
75enum qedi_nvm_tgts {
76 QEDI_NVM_TGT_PRI,
77 QEDI_NVM_TGT_SEC,
78};
79
69struct qedi_uio_ctrl { 80struct qedi_uio_ctrl {
70 /* meta data */ 81 /* meta data */
71 u32 uio_hsi_version; 82 u32 uio_hsi_version;
@@ -283,6 +294,8 @@ struct qedi_ctx {
283 void *bdq_pbl_list; 294 void *bdq_pbl_list;
284 dma_addr_t bdq_pbl_list_dma; 295 dma_addr_t bdq_pbl_list_dma;
285 u8 bdq_pbl_list_num_entries; 296 u8 bdq_pbl_list_num_entries;
297 struct nvm_iscsi_cfg *iscsi_cfg;
298 dma_addr_t nvm_buf_dma;
286 void __iomem *bdq_primary_prod; 299 void __iomem *bdq_primary_prod;
287 void __iomem *bdq_secondary_prod; 300 void __iomem *bdq_secondary_prod;
288 u16 bdq_prod_idx; 301 u16 bdq_prod_idx;
@@ -337,6 +350,10 @@ struct qedi_ctx {
337 bool use_fast_sge; 350 bool use_fast_sge;
338 351
339 atomic_t num_offloads; 352 atomic_t num_offloads;
353#define SYSFS_FLAG_FW_SEL_BOOT 2
354#define IPV6_LEN 41
355#define IPV4_LEN 17
356 struct iscsi_boot_kset *boot_kset;
340}; 357};
341 358
342struct qedi_work { 359struct qedi_work {
diff --git a/drivers/scsi/qedi/qedi_fw.c b/drivers/scsi/qedi/qedi_fw.c
index 19254bd739d9..93d54acd4a22 100644
--- a/drivers/scsi/qedi/qedi_fw.c
+++ b/drivers/scsi/qedi/qedi_fw.c
@@ -1411,7 +1411,7 @@ static void qedi_tmf_work(struct work_struct *work)
1411 1411
1412 list_work = kzalloc(sizeof(*list_work), GFP_ATOMIC); 1412 list_work = kzalloc(sizeof(*list_work), GFP_ATOMIC);
1413 if (!list_work) { 1413 if (!list_work) {
1414 QEDI_ERR(&qedi->dbg_ctx, "Memory alloction failed\n"); 1414 QEDI_ERR(&qedi->dbg_ctx, "Memory allocation failed\n");
1415 goto abort_ret; 1415 goto abort_ret;
1416 } 1416 }
1417 1417
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 5f5a4ef2e529..2c3783684815 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -19,6 +19,7 @@
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/if_vlan.h> 20#include <linux/if_vlan.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <linux/iscsi_boot_sysfs.h>
22 23
23#include <scsi/scsi_cmnd.h> 24#include <scsi/scsi_cmnd.h>
24#include <scsi/scsi_device.h> 25#include <scsi/scsi_device.h>
@@ -1143,6 +1144,30 @@ exit_setup_int:
1143 return rc; 1144 return rc;
1144} 1145}
1145 1146
1147static void qedi_free_nvm_iscsi_cfg(struct qedi_ctx *qedi)
1148{
1149 if (qedi->iscsi_cfg)
1150 dma_free_coherent(&qedi->pdev->dev,
1151 sizeof(struct nvm_iscsi_cfg),
1152 qedi->iscsi_cfg, qedi->nvm_buf_dma);
1153}
1154
1155static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
1156{
1157 qedi->iscsi_cfg = dma_zalloc_coherent(&qedi->pdev->dev,
1158 sizeof(struct nvm_iscsi_cfg),
1159 &qedi->nvm_buf_dma, GFP_KERNEL);
1160 if (!qedi->iscsi_cfg) {
1161 QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
1162 return -ENOMEM;
1163 }
1164 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
1165 "NVM BUF addr=0x%p dma=0x%llx.\n", qedi->iscsi_cfg,
1166 qedi->nvm_buf_dma);
1167
1168 return 0;
1169}
1170
1146static void qedi_free_bdq(struct qedi_ctx *qedi) 1171static void qedi_free_bdq(struct qedi_ctx *qedi)
1147{ 1172{
1148 int i; 1173 int i;
@@ -1183,6 +1208,7 @@ static void qedi_free_global_queues(struct qedi_ctx *qedi)
1183 kfree(gl[i]); 1208 kfree(gl[i]);
1184 } 1209 }
1185 qedi_free_bdq(qedi); 1210 qedi_free_bdq(qedi);
1211 qedi_free_nvm_iscsi_cfg(qedi);
1186} 1212}
1187 1213
1188static int qedi_alloc_bdq(struct qedi_ctx *qedi) 1214static int qedi_alloc_bdq(struct qedi_ctx *qedi)
@@ -1309,6 +1335,11 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
1309 if (rc) 1335 if (rc)
1310 goto mem_alloc_failure; 1336 goto mem_alloc_failure;
1311 1337
1338 /* Allocate DMA coherent buffers for NVM_ISCSI_CFG */
1339 rc = qedi_alloc_nvm_iscsi_cfg(qedi);
1340 if (rc)
1341 goto mem_alloc_failure;
1342
1312 /* Allocate a CQ and an associated PBL for each MSI-X 1343 /* Allocate a CQ and an associated PBL for each MSI-X
1313 * vector. 1344 * vector.
1314 */ 1345 */
@@ -1671,6 +1702,387 @@ void qedi_reset_host_mtu(struct qedi_ctx *qedi, u16 mtu)
1671 qedi_ops->ll2->start(qedi->cdev, &params); 1702 qedi_ops->ll2->start(qedi->cdev, &params);
1672} 1703}
1673 1704
1705/**
1706 * qedi_get_nvram_block: - Scan through the iSCSI NVRAM block (while accounting
1707 * for gaps) for the matching absolute-pf-id of the QEDI device.
1708 */
1709static struct nvm_iscsi_block *
1710qedi_get_nvram_block(struct qedi_ctx *qedi)
1711{
1712 int i;
1713 u8 pf;
1714 u32 flags;
1715 struct nvm_iscsi_block *block;
1716
1717 pf = qedi->dev_info.common.abs_pf_id;
1718 block = &qedi->iscsi_cfg->block[0];
1719 for (i = 0; i < NUM_OF_ISCSI_PF_SUPPORTED; i++, block++) {
1720 flags = ((block->id) & NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK) >>
1721 NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET;
1722 if (flags & (NVM_ISCSI_CFG_BLK_CTRL_FLAG_IS_NOT_EMPTY |
1723 NVM_ISCSI_CFG_BLK_CTRL_FLAG_PF_MAPPED) &&
1724 (pf == (block->id & NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_MASK)
1725 >> NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_OFFSET))
1726 return block;
1727 }
1728 return NULL;
1729}
1730
1731static ssize_t qedi_show_boot_eth_info(void *data, int type, char *buf)
1732{
1733 struct qedi_ctx *qedi = data;
1734 struct nvm_iscsi_initiator *initiator;
1735 char *str = buf;
1736 int rc = 1;
1737 u32 ipv6_en, dhcp_en, ip_len;
1738 struct nvm_iscsi_block *block;
1739 char *fmt, *ip, *sub, *gw;
1740
1741 block = qedi_get_nvram_block(qedi);
1742 if (!block)
1743 return 0;
1744
1745 initiator = &block->initiator;
1746 ipv6_en = block->generic.ctrl_flags &
1747 NVM_ISCSI_CFG_GEN_IPV6_ENABLED;
1748 dhcp_en = block->generic.ctrl_flags &
1749 NVM_ISCSI_CFG_GEN_DHCP_TCPIP_CONFIG_ENABLED;
1750 /* Static IP assignments. */
1751 fmt = ipv6_en ? "%pI6\n" : "%pI4\n";
1752 ip = ipv6_en ? initiator->ipv6.addr.byte : initiator->ipv4.addr.byte;
1753 ip_len = ipv6_en ? IPV6_LEN : IPV4_LEN;
1754 sub = ipv6_en ? initiator->ipv6.subnet_mask.byte :
1755 initiator->ipv4.subnet_mask.byte;
1756 gw = ipv6_en ? initiator->ipv6.gateway.byte :
1757 initiator->ipv4.gateway.byte;
1758 /* DHCP IP adjustments. */
1759 fmt = dhcp_en ? "%s\n" : fmt;
1760 if (dhcp_en) {
1761 ip = ipv6_en ? "0::0" : "0.0.0.0";
1762 sub = ip;
1763 gw = ip;
1764 ip_len = ipv6_en ? 5 : 8;
1765 }
1766
1767 switch (type) {
1768 case ISCSI_BOOT_ETH_IP_ADDR:
1769 rc = snprintf(str, ip_len, fmt, ip);
1770 break;
1771 case ISCSI_BOOT_ETH_SUBNET_MASK:
1772 rc = snprintf(str, ip_len, fmt, sub);
1773 break;
1774 case ISCSI_BOOT_ETH_GATEWAY:
1775 rc = snprintf(str, ip_len, fmt, gw);
1776 break;
1777 case ISCSI_BOOT_ETH_FLAGS:
1778 rc = snprintf(str, 3, "%hhd\n",
1779 SYSFS_FLAG_FW_SEL_BOOT);
1780 break;
1781 case ISCSI_BOOT_ETH_INDEX:
1782 rc = snprintf(str, 3, "0\n");
1783 break;
1784 case ISCSI_BOOT_ETH_MAC:
1785 rc = sysfs_format_mac(str, qedi->mac, ETH_ALEN);
1786 break;
1787 case ISCSI_BOOT_ETH_VLAN:
1788 rc = snprintf(str, 12, "%d\n",
1789 GET_FIELD2(initiator->generic_cont0,
1790 NVM_ISCSI_CFG_INITIATOR_VLAN));
1791 break;
1792 case ISCSI_BOOT_ETH_ORIGIN:
1793 if (dhcp_en)
1794 rc = snprintf(str, 3, "3\n");
1795 break;
1796 default:
1797 rc = 0;
1798 break;
1799 }
1800
1801 return rc;
1802}
1803
1804static umode_t qedi_eth_get_attr_visibility(void *data, int type)
1805{
1806 int rc = 1;
1807
1808 switch (type) {
1809 case ISCSI_BOOT_ETH_FLAGS:
1810 case ISCSI_BOOT_ETH_MAC:
1811 case ISCSI_BOOT_ETH_INDEX:
1812 case ISCSI_BOOT_ETH_IP_ADDR:
1813 case ISCSI_BOOT_ETH_SUBNET_MASK:
1814 case ISCSI_BOOT_ETH_GATEWAY:
1815 case ISCSI_BOOT_ETH_ORIGIN:
1816 case ISCSI_BOOT_ETH_VLAN:
1817 rc = 0444;
1818 break;
1819 default:
1820 rc = 0;
1821 break;
1822 }
1823 return rc;
1824}
1825
1826static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
1827{
1828 struct qedi_ctx *qedi = data;
1829 struct nvm_iscsi_initiator *initiator;
1830 char *str = buf;
1831 int rc;
1832 struct nvm_iscsi_block *block;
1833
1834 block = qedi_get_nvram_block(qedi);
1835 if (!block)
1836 return 0;
1837
1838 initiator = &block->initiator;
1839
1840 switch (type) {
1841 case ISCSI_BOOT_INI_INITIATOR_NAME:
1842 rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n",
1843 initiator->initiator_name.byte);
1844 break;
1845 default:
1846 rc = 0;
1847 break;
1848 }
1849 return rc;
1850}
1851
1852static umode_t qedi_ini_get_attr_visibility(void *data, int type)
1853{
1854 int rc;
1855
1856 switch (type) {
1857 case ISCSI_BOOT_INI_INITIATOR_NAME:
1858 rc = 0444;
1859 break;
1860 default:
1861 rc = 0;
1862 break;
1863 }
1864 return rc;
1865}
1866
1867static ssize_t
1868qedi_show_boot_tgt_info(struct qedi_ctx *qedi, int type,
1869 char *buf, enum qedi_nvm_tgts idx)
1870{
1871 char *str = buf;
1872 int rc = 1;
1873 u32 ctrl_flags, ipv6_en, chap_en, mchap_en, ip_len;
1874 struct nvm_iscsi_block *block;
1875 char *chap_name, *chap_secret;
1876 char *mchap_name, *mchap_secret;
1877
1878 block = qedi_get_nvram_block(qedi);
1879 if (!block)
1880 goto exit_show_tgt_info;
1881
1882 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_EVT,
1883 "Port:%d, tgt_idx:%d\n",
1884 GET_FIELD2(block->id, NVM_ISCSI_CFG_BLK_MAPPED_PF_ID), idx);
1885
1886 ctrl_flags = block->target[idx].ctrl_flags &
1887 NVM_ISCSI_CFG_TARGET_ENABLED;
1888
1889 if (!ctrl_flags) {
1890 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_EVT,
1891 "Target disabled\n");
1892 goto exit_show_tgt_info;
1893 }
1894
1895 ipv6_en = block->generic.ctrl_flags &
1896 NVM_ISCSI_CFG_GEN_IPV6_ENABLED;
1897 ip_len = ipv6_en ? IPV6_LEN : IPV4_LEN;
1898 chap_en = block->generic.ctrl_flags &
1899 NVM_ISCSI_CFG_GEN_CHAP_ENABLED;
1900 chap_name = chap_en ? block->initiator.chap_name.byte : NULL;
1901 chap_secret = chap_en ? block->initiator.chap_password.byte : NULL;
1902
1903 mchap_en = block->generic.ctrl_flags &
1904 NVM_ISCSI_CFG_GEN_CHAP_MUTUAL_ENABLED;
1905 mchap_name = mchap_en ? block->target[idx].chap_name.byte : NULL;
1906 mchap_secret = mchap_en ? block->target[idx].chap_password.byte : NULL;
1907
1908 switch (type) {
1909 case ISCSI_BOOT_TGT_NAME:
1910 rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n",
1911 block->target[idx].target_name.byte);
1912 break;
1913 case ISCSI_BOOT_TGT_IP_ADDR:
1914 if (ipv6_en)
1915 rc = snprintf(str, ip_len, "%pI6\n",
1916 block->target[idx].ipv6_addr.byte);
1917 else
1918 rc = snprintf(str, ip_len, "%pI4\n",
1919 block->target[idx].ipv4_addr.byte);
1920 break;
1921 case ISCSI_BOOT_TGT_PORT:
1922 rc = snprintf(str, 12, "%d\n",
1923 GET_FIELD2(block->target[idx].generic_cont0,
1924 NVM_ISCSI_CFG_TARGET_TCP_PORT));
1925 break;
1926 case ISCSI_BOOT_TGT_LUN:
1927 rc = snprintf(str, 22, "%.*d\n",
1928 block->target[idx].lun.value[1],
1929 block->target[idx].lun.value[0]);
1930 break;
1931 case ISCSI_BOOT_TGT_CHAP_NAME:
1932 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n",
1933 chap_name);
1934 break;
1935 case ISCSI_BOOT_TGT_CHAP_SECRET:
1936 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n",
1937 chap_secret);
1938 break;
1939 case ISCSI_BOOT_TGT_REV_CHAP_NAME:
1940 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN, "%s\n",
1941 mchap_name);
1942 break;
1943 case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
1944 rc = snprintf(str, NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN, "%s\n",
1945 mchap_secret);
1946 break;
1947 case ISCSI_BOOT_TGT_FLAGS:
1948 rc = snprintf(str, 3, "%hhd\n", SYSFS_FLAG_FW_SEL_BOOT);
1949 break;
1950 case ISCSI_BOOT_TGT_NIC_ASSOC:
1951 rc = snprintf(str, 3, "0\n");
1952 break;
1953 default:
1954 rc = 0;
1955 break;
1956 }
1957
1958exit_show_tgt_info:
1959 return rc;
1960}
1961
1962static ssize_t qedi_show_boot_tgt_pri_info(void *data, int type, char *buf)
1963{
1964 struct qedi_ctx *qedi = data;
1965
1966 return qedi_show_boot_tgt_info(qedi, type, buf, QEDI_NVM_TGT_PRI);
1967}
1968
1969static ssize_t qedi_show_boot_tgt_sec_info(void *data, int type, char *buf)
1970{
1971 struct qedi_ctx *qedi = data;
1972
1973 return qedi_show_boot_tgt_info(qedi, type, buf, QEDI_NVM_TGT_SEC);
1974}
1975
1976static umode_t qedi_tgt_get_attr_visibility(void *data, int type)
1977{
1978 int rc;
1979
1980 switch (type) {
1981 case ISCSI_BOOT_TGT_NAME:
1982 case ISCSI_BOOT_TGT_IP_ADDR:
1983 case ISCSI_BOOT_TGT_PORT:
1984 case ISCSI_BOOT_TGT_LUN:
1985 case ISCSI_BOOT_TGT_CHAP_NAME:
1986 case ISCSI_BOOT_TGT_CHAP_SECRET:
1987 case ISCSI_BOOT_TGT_REV_CHAP_NAME:
1988 case ISCSI_BOOT_TGT_REV_CHAP_SECRET:
1989 case ISCSI_BOOT_TGT_NIC_ASSOC:
1990 case ISCSI_BOOT_TGT_FLAGS:
1991 rc = 0444;
1992 break;
1993 default:
1994 rc = 0;
1995 break;
1996 }
1997 return rc;
1998}
1999
2000static void qedi_boot_release(void *data)
2001{
2002 struct qedi_ctx *qedi = data;
2003
2004 scsi_host_put(qedi->shost);
2005}
2006
2007static int qedi_get_boot_info(struct qedi_ctx *qedi)
2008{
2009 int ret = 1;
2010 u16 len;
2011
2012 len = sizeof(struct nvm_iscsi_cfg);
2013
2014 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_INFO,
2015 "Get NVM iSCSI CFG image\n");
2016 ret = qedi_ops->common->nvm_get_image(qedi->cdev,
2017 QED_NVM_IMAGE_ISCSI_CFG,
2018 (char *)qedi->iscsi_cfg, len);
2019 if (ret)
2020 QEDI_ERR(&qedi->dbg_ctx,
2021 "Could not get NVM image. ret = %d\n", ret);
2022
2023 return ret;
2024}
2025
2026static int qedi_setup_boot_info(struct qedi_ctx *qedi)
2027{
2028 struct iscsi_boot_kobj *boot_kobj;
2029
2030 if (qedi_get_boot_info(qedi))
2031 return -EPERM;
2032
2033 qedi->boot_kset = iscsi_boot_create_host_kset(qedi->shost->host_no);
2034 if (!qedi->boot_kset)
2035 goto kset_free;
2036
2037 if (!scsi_host_get(qedi->shost))
2038 goto kset_free;
2039
2040 boot_kobj = iscsi_boot_create_target(qedi->boot_kset, 0, qedi,
2041 qedi_show_boot_tgt_pri_info,
2042 qedi_tgt_get_attr_visibility,
2043 qedi_boot_release);
2044 if (!boot_kobj)
2045 goto put_host;
2046
2047 if (!scsi_host_get(qedi->shost))
2048 goto kset_free;
2049
2050 boot_kobj = iscsi_boot_create_target(qedi->boot_kset, 1, qedi,
2051 qedi_show_boot_tgt_sec_info,
2052 qedi_tgt_get_attr_visibility,
2053 qedi_boot_release);
2054 if (!boot_kobj)
2055 goto put_host;
2056
2057 if (!scsi_host_get(qedi->shost))
2058 goto kset_free;
2059
2060 boot_kobj = iscsi_boot_create_initiator(qedi->boot_kset, 0, qedi,
2061 qedi_show_boot_ini_info,
2062 qedi_ini_get_attr_visibility,
2063 qedi_boot_release);
2064 if (!boot_kobj)
2065 goto put_host;
2066
2067 if (!scsi_host_get(qedi->shost))
2068 goto kset_free;
2069
2070 boot_kobj = iscsi_boot_create_ethernet(qedi->boot_kset, 0, qedi,
2071 qedi_show_boot_eth_info,
2072 qedi_eth_get_attr_visibility,
2073 qedi_boot_release);
2074 if (!boot_kobj)
2075 goto put_host;
2076
2077 return 0;
2078
2079put_host:
2080 scsi_host_put(qedi->shost);
2081kset_free:
2082 iscsi_boot_destroy_kset(qedi->boot_kset);
2083 return -ENOMEM;
2084}
2085
1674static void __qedi_remove(struct pci_dev *pdev, int mode) 2086static void __qedi_remove(struct pci_dev *pdev, int mode)
1675{ 2087{
1676 struct qedi_ctx *qedi = pci_get_drvdata(pdev); 2088 struct qedi_ctx *qedi = pci_get_drvdata(pdev);
@@ -1724,6 +2136,9 @@ static void __qedi_remove(struct pci_dev *pdev, int mode)
1724 qedi->ll2_recv_thread = NULL; 2136 qedi->ll2_recv_thread = NULL;
1725 } 2137 }
1726 qedi_ll2_free_skbs(qedi); 2138 qedi_ll2_free_skbs(qedi);
2139
2140 if (qedi->boot_kset)
2141 iscsi_boot_destroy_kset(qedi->boot_kset);
1727 } 2142 }
1728} 2143}
1729 2144
@@ -1967,6 +2382,10 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
1967 /* F/w needs 1st task context memory entry for performance */ 2382 /* F/w needs 1st task context memory entry for performance */
1968 set_bit(QEDI_RESERVE_TASK_ID, qedi->task_idx_map); 2383 set_bit(QEDI_RESERVE_TASK_ID, qedi->task_idx_map);
1969 atomic_set(&qedi->num_offloads, 0); 2384 atomic_set(&qedi->num_offloads, 0);
2385
2386 if (qedi_setup_boot_info(qedi))
2387 QEDI_ERR(&qedi->dbg_ctx,
2388 "No iSCSI boot target configured\n");
1970 } 2389 }
1971 2390
1972 return 0; 2391 return 0;
diff --git a/drivers/scsi/qedi/qedi_nvm_iscsi_cfg.h b/drivers/scsi/qedi/qedi_nvm_iscsi_cfg.h
new file mode 100644
index 000000000000..df39b69b366d
--- /dev/null
+++ b/drivers/scsi/qedi/qedi_nvm_iscsi_cfg.h
@@ -0,0 +1,210 @@
1/*
2 * QLogic iSCSI Offload Driver
3 * Copyright (c) 2016 Cavium Inc.
4 *
5 * This software is available under the terms of the GNU General Public License
6 * (GPL) Version 2, available from the file COPYING in the main directory of
7 * this source tree.
8 */
9
10#ifndef NVM_ISCSI_CFG_H
11#define NVM_ISCSI_CFG_H
12
13#define NUM_OF_ISCSI_TARGET_PER_PF 4 /* Defined as per the
14 * ISCSI IBFT constraint
15 */
16#define NUM_OF_ISCSI_PF_SUPPORTED 4 /* One PF per Port -
17 * assuming 4 port card
18 */
19
20#define NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN 256
21
22union nvm_iscsi_dhcp_vendor_id {
23 u32 value[NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN / 4];
24 u8 byte[NVM_ISCSI_CFG_DHCP_NAME_MAX_LEN];
25};
26
27#define NVM_ISCSI_IPV4_ADDR_BYTE_LEN 4
28union nvm_iscsi_ipv4_addr {
29 u32 addr;
30 u8 byte[NVM_ISCSI_IPV4_ADDR_BYTE_LEN];
31};
32
33#define NVM_ISCSI_IPV6_ADDR_BYTE_LEN 16
34union nvm_iscsi_ipv6_addr {
35 u32 addr[4];
36 u8 byte[NVM_ISCSI_IPV6_ADDR_BYTE_LEN];
37};
38
39struct nvm_iscsi_initiator_ipv4 {
40 union nvm_iscsi_ipv4_addr addr; /* 0x0 */
41 union nvm_iscsi_ipv4_addr subnet_mask; /* 0x4 */
42 union nvm_iscsi_ipv4_addr gateway; /* 0x8 */
43 union nvm_iscsi_ipv4_addr primary_dns; /* 0xC */
44 union nvm_iscsi_ipv4_addr secondary_dns; /* 0x10 */
45 union nvm_iscsi_ipv4_addr dhcp_addr; /* 0x14 */
46
47 union nvm_iscsi_ipv4_addr isns_server; /* 0x18 */
48 union nvm_iscsi_ipv4_addr slp_server; /* 0x1C */
49 union nvm_iscsi_ipv4_addr primay_radius_server; /* 0x20 */
50 union nvm_iscsi_ipv4_addr secondary_radius_server; /* 0x24 */
51
52 union nvm_iscsi_ipv4_addr rsvd[4]; /* 0x28 */
53};
54
55struct nvm_iscsi_initiator_ipv6 {
56 union nvm_iscsi_ipv6_addr addr; /* 0x0 */
57 union nvm_iscsi_ipv6_addr subnet_mask; /* 0x10 */
58 union nvm_iscsi_ipv6_addr gateway; /* 0x20 */
59 union nvm_iscsi_ipv6_addr primary_dns; /* 0x30 */
60 union nvm_iscsi_ipv6_addr secondary_dns; /* 0x40 */
61 union nvm_iscsi_ipv6_addr dhcp_addr; /* 0x50 */
62
63 union nvm_iscsi_ipv6_addr isns_server; /* 0x60 */
64 union nvm_iscsi_ipv6_addr slp_server; /* 0x70 */
65 union nvm_iscsi_ipv6_addr primay_radius_server; /* 0x80 */
66 union nvm_iscsi_ipv6_addr secondary_radius_server; /* 0x90 */
67
68 union nvm_iscsi_ipv6_addr rsvd[3]; /* 0xA0 */
69
70 u32 config; /* 0xD0 */
71#define NVM_ISCSI_CFG_INITIATOR_IPV6_SUBNET_MASK_PREFIX_MASK 0x000000FF
72#define NVM_ISCSI_CFG_INITIATOR_IPV6_SUBNET_MASK_PREFIX_OFFSET 0
73
74 u32 rsvd_1[3];
75};
76
77#define NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN 256
78union nvm_iscsi_name {
79 u32 value[NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN / 4];
80 u8 byte[NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN];
81};
82
83#define NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN 256
84union nvm_iscsi_chap_name {
85 u32 value[NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN / 4];
86 u8 byte[NVM_ISCSI_CFG_CHAP_NAME_MAX_LEN];
87};
88
89#define NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN 16 /* md5 need per RFC1996
90 * is 16 octets
91 */
92union nvm_iscsi_chap_password {
93 u32 value[NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN / 4];
94 u8 byte[NVM_ISCSI_CFG_CHAP_PWD_MAX_LEN];
95};
96
97union nvm_iscsi_lun {
98 u8 byte[8];
99 u32 value[2];
100};
101
102struct nvm_iscsi_generic {
103 u32 ctrl_flags; /* 0x0 */
104#define NVM_ISCSI_CFG_GEN_CHAP_ENABLED BIT(0)
105#define NVM_ISCSI_CFG_GEN_DHCP_TCPIP_CONFIG_ENABLED BIT(1)
106#define NVM_ISCSI_CFG_GEN_DHCP_ISCSI_CONFIG_ENABLED BIT(2)
107#define NVM_ISCSI_CFG_GEN_IPV6_ENABLED BIT(3)
108#define NVM_ISCSI_CFG_GEN_IPV4_FALLBACK_ENABLED BIT(4)
109#define NVM_ISCSI_CFG_GEN_ISNS_WORLD_LOGIN BIT(5)
110#define NVM_ISCSI_CFG_GEN_ISNS_SELECTIVE_LOGIN BIT(6)
111#define NVM_ISCSI_CFG_GEN_ADDR_REDIRECT_ENABLED BIT(7)
112#define NVM_ISCSI_CFG_GEN_CHAP_MUTUAL_ENABLED BIT(8)
113
114 u32 timeout; /* 0x4 */
115#define NVM_ISCSI_CFG_GEN_DHCP_REQUEST_TIMEOUT_MASK 0x0000FFFF
116#define NVM_ISCSI_CFG_GEN_DHCP_REQUEST_TIMEOUT_OFFSET 0
117#define NVM_ISCSI_CFG_GEN_PORT_LOGIN_TIMEOUT_MASK 0xFFFF0000
118#define NVM_ISCSI_CFG_GEN_PORT_LOGIN_TIMEOUT_OFFSET 16
119
120 union nvm_iscsi_dhcp_vendor_id dhcp_vendor_id; /* 0x8 */
121 u32 rsvd[62]; /* 0x108 */
122};
123
124struct nvm_iscsi_initiator {
125 struct nvm_iscsi_initiator_ipv4 ipv4; /* 0x0 */
126 struct nvm_iscsi_initiator_ipv6 ipv6; /* 0x38 */
127
128 union nvm_iscsi_name initiator_name; /* 0x118 */
129 union nvm_iscsi_chap_name chap_name; /* 0x218 */
130 union nvm_iscsi_chap_password chap_password; /* 0x318 */
131
132 u32 generic_cont0; /* 0x398 */
133#define NVM_ISCSI_CFG_INITIATOR_VLAN_MASK 0x0000FFFF
134#define NVM_ISCSI_CFG_INITIATOR_VLAN_OFFSET 0
135#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_MASK 0x00030000
136#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_OFFSET 16
137#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_4 1
138#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_6 2
139#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_4_AND_6 3
140
141 u32 ctrl_flags;
142#define NVM_ISCSI_CFG_INITIATOR_IP_VERSION_PRIORITY_V6 BIT(0)
143#define NVM_ISCSI_CFG_INITIATOR_VLAN_ENABLED BIT(1)
144
145 u32 rsvd[116]; /* 0x32C */
146};
147
148struct nvm_iscsi_target {
149 u32 ctrl_flags; /* 0x0 */
150#define NVM_ISCSI_CFG_TARGET_ENABLED BIT(0)
151#define NVM_ISCSI_CFG_BOOT_TIME_LOGIN_STATUS BIT(1)
152
153 u32 generic_cont0; /* 0x4 */
154#define NVM_ISCSI_CFG_TARGET_TCP_PORT_MASK 0x0000FFFF
155#define NVM_ISCSI_CFG_TARGET_TCP_PORT_OFFSET 0
156
157 u32 ip_ver;
158#define NVM_ISCSI_CFG_IPv4 4
159#define NVM_ISCSI_CFG_IPv6 6
160
161 u32 rsvd_1[7]; /* 0x24 */
162 union nvm_iscsi_ipv4_addr ipv4_addr; /* 0x28 */
163 union nvm_iscsi_ipv6_addr ipv6_addr; /* 0x2C */
164 union nvm_iscsi_lun lun; /* 0x3C */
165
166 union nvm_iscsi_name target_name; /* 0x44 */
167 union nvm_iscsi_chap_name chap_name; /* 0x144 */
168 union nvm_iscsi_chap_password chap_password; /* 0x244 */
169
170 u32 rsvd_2[107]; /* 0x2C4 */
171};
172
173struct nvm_iscsi_block {
174 u32 id; /* 0x0 */
175#define NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_MASK 0x0000000F
176#define NVM_ISCSI_CFG_BLK_MAPPED_PF_ID_OFFSET 0
177#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_MASK 0x00000FF0
178#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_OFFSET 4
179#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_IS_NOT_EMPTY BIT(0)
180#define NVM_ISCSI_CFG_BLK_CTRL_FLAG_PF_MAPPED BIT(1)
181
182 u32 rsvd_1[5]; /* 0x4 */
183
184 struct nvm_iscsi_generic generic; /* 0x18 */
185 struct nvm_iscsi_initiator initiator; /* 0x218 */
186 struct nvm_iscsi_target target[NUM_OF_ISCSI_TARGET_PER_PF];
187 /* 0x718 */
188
189 u32 rsvd_2[58]; /* 0x1718 */
190 /* total size - 0x1800 - 6K block */
191};
192
193struct nvm_iscsi_cfg {
194 u32 id; /* 0x0 */
195#define NVM_ISCSI_CFG_BLK_VERSION_MINOR_MASK 0x000000FF
196#define NVM_ISCSI_CFG_BLK_VERSION_MAJOR_MASK 0x0000FF00
197#define NVM_ISCSI_CFG_BLK_SIGNATURE_MASK 0xFFFF0000
198#define NVM_ISCSI_CFG_BLK_SIGNATURE 0x49430000 /* IC - Iscsi
199 * Config
200 */
201
202#define NVM_ISCSI_CFG_BLK_VERSION_MAJOR 0
203#define NVM_ISCSI_CFG_BLK_VERSION_MINOR 10
204#define NVM_ISCSI_CFG_BLK_VERSION ((NVM_ISCSI_CFG_BLK_VERSION_MAJOR << 8) | \
205 NVM_ISCSI_CFG_BLK_VERSION_MINOR)
206
207 struct nvm_iscsi_block block[NUM_OF_ISCSI_PF_SUPPORTED]; /* 0x4 */
208};
209
210#endif
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index c2dc836dc484..e101cd3043b9 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3727,7 +3727,7 @@ static struct qla_tgt_cmd *qlt_ctio_to_cmd(struct scsi_qla_host *vha,
3727 h &= QLA_CMD_HANDLE_MASK; 3727 h &= QLA_CMD_HANDLE_MASK;
3728 3728
3729 if (h != QLA_TGT_NULL_HANDLE) { 3729 if (h != QLA_TGT_NULL_HANDLE) {
3730 if (unlikely(h > req->num_outstanding_cmds)) { 3730 if (unlikely(h >= req->num_outstanding_cmds)) {
3731 ql_dbg(ql_dbg_tgt, vha, 0xe052, 3731 ql_dbg(ql_dbg_tgt, vha, 0xe052,
3732 "qla_target(%d): Wrong handle %x received\n", 3732 "qla_target(%d): Wrong handle %x received\n",
3733 vha->vp_idx, handle); 3733 vha->vp_idx, handle);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 21225d62b0c1..4fe606b000b4 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -758,8 +758,14 @@ static bool sg_is_valid_dxfer(sg_io_hdr_t *hp)
758 if (hp->dxferp || hp->dxfer_len > 0) 758 if (hp->dxferp || hp->dxfer_len > 0)
759 return false; 759 return false;
760 return true; 760 return true;
761 case SG_DXFER_TO_DEV:
762 case SG_DXFER_FROM_DEV: 761 case SG_DXFER_FROM_DEV:
762 /*
763 * for SG_DXFER_FROM_DEV we always set dxfer_len to > 0. dxferp
764 * can either be NULL or != NULL so there's no point in checking
765 * it either. So just return true.
766 */
767 return true;
768 case SG_DXFER_TO_DEV:
763 case SG_DXFER_TO_FROM_DEV: 769 case SG_DXFER_TO_FROM_DEV:
764 if (!hp->dxferp || hp->dxfer_len == 0) 770 if (!hp->dxferp || hp->dxfer_len == 0)
765 return false; 771 return false;
diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h
index 07ec8a8877de..e164ffade38a 100644
--- a/drivers/scsi/smartpqi/smartpqi.h
+++ b/drivers/scsi/smartpqi/smartpqi.h
@@ -690,7 +690,7 @@ struct pqi_config_table_heartbeat {
690 690
691#define PQI_MAX_OUTSTANDING_REQUESTS ((u32)~0) 691#define PQI_MAX_OUTSTANDING_REQUESTS ((u32)~0)
692#define PQI_MAX_OUTSTANDING_REQUESTS_KDUMP 32 692#define PQI_MAX_OUTSTANDING_REQUESTS_KDUMP 32
693#define PQI_MAX_TRANSFER_SIZE (4 * 1024U * 1024U) 693#define PQI_MAX_TRANSFER_SIZE (1024U * 1024U)
694#define PQI_MAX_TRANSFER_SIZE_KDUMP (512 * 1024U) 694#define PQI_MAX_TRANSFER_SIZE_KDUMP (512 * 1024U)
695 695
696#define RAID_MAP_MAX_ENTRIES 1024 696#define RAID_MAP_MAX_ENTRIES 1024
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 8b93197daefe..9be211d68b15 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -837,6 +837,7 @@ static struct scsi_host_template virtscsi_host_template_multi = {
837 .eh_abort_handler = virtscsi_abort, 837 .eh_abort_handler = virtscsi_abort,
838 .eh_device_reset_handler = virtscsi_device_reset, 838 .eh_device_reset_handler = virtscsi_device_reset,
839 .eh_timed_out = virtscsi_eh_timed_out, 839 .eh_timed_out = virtscsi_eh_timed_out,
840 .slave_alloc = virtscsi_device_alloc,
840 841
841 .can_queue = 1024, 842 .can_queue = 1024,
842 .dma_boundary = UINT_MAX, 843 .dma_boundary = UINT_MAX,
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 2afe3597982e..f4b7a98a7913 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -134,7 +134,6 @@ struct apid_data {
134 * @spmic: SPMI controller object 134 * @spmic: SPMI controller object
135 * @ver_ops: version dependent operations. 135 * @ver_ops: version dependent operations.
136 * @ppid_to_apid in-memory copy of PPID -> channel (APID) mapping table. 136 * @ppid_to_apid in-memory copy of PPID -> channel (APID) mapping table.
137 * v2 only.
138 */ 137 */
139struct spmi_pmic_arb { 138struct spmi_pmic_arb {
140 void __iomem *rd_base; 139 void __iomem *rd_base;
@@ -1016,6 +1015,13 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
1016 goto err_put_ctrl; 1015 goto err_put_ctrl;
1017 } 1016 }
1018 1017
1018 pa->ppid_to_apid = devm_kcalloc(&ctrl->dev, PMIC_ARB_MAX_PPID,
1019 sizeof(*pa->ppid_to_apid), GFP_KERNEL);
1020 if (!pa->ppid_to_apid) {
1021 err = -ENOMEM;
1022 goto err_put_ctrl;
1023 }
1024
1019 hw_ver = readl_relaxed(core + PMIC_ARB_VERSION); 1025 hw_ver = readl_relaxed(core + PMIC_ARB_VERSION);
1020 1026
1021 if (hw_ver < PMIC_ARB_VERSION_V2_MIN) { 1027 if (hw_ver < PMIC_ARB_VERSION_V2_MIN) {
@@ -1048,15 +1054,6 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
1048 err = PTR_ERR(pa->wr_base); 1054 err = PTR_ERR(pa->wr_base);
1049 goto err_put_ctrl; 1055 goto err_put_ctrl;
1050 } 1056 }
1051
1052 pa->ppid_to_apid = devm_kcalloc(&ctrl->dev,
1053 PMIC_ARB_MAX_PPID,
1054 sizeof(*pa->ppid_to_apid),
1055 GFP_KERNEL);
1056 if (!pa->ppid_to_apid) {
1057 err = -ENOMEM;
1058 goto err_put_ctrl;
1059 }
1060 } 1057 }
1061 1058
1062 dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n", 1059 dev_info(&ctrl->dev, "PMIC arbiter version %s (0x%x)\n",
diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index 2b9b0941d9eb..6d23226e5f69 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -365,11 +365,23 @@ static int spmi_drv_remove(struct device *dev)
365 return 0; 365 return 0;
366} 366}
367 367
368static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
369{
370 int ret;
371
372 ret = of_device_uevent_modalias(dev, env);
373 if (ret != -ENODEV)
374 return ret;
375
376 return 0;
377}
378
368static struct bus_type spmi_bus_type = { 379static struct bus_type spmi_bus_type = {
369 .name = "spmi", 380 .name = "spmi",
370 .match = spmi_device_match, 381 .match = spmi_device_match,
371 .probe = spmi_drv_probe, 382 .probe = spmi_drv_probe,
372 .remove = spmi_drv_remove, 383 .remove = spmi_drv_remove,
384 .uevent = spmi_drv_uevent,
373}; 385};
374 386
375/** 387/**
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 268d4e6ef48a..ef28a1cb64ae 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -110,4 +110,6 @@ source "drivers/staging/ccree/Kconfig"
110 110
111source "drivers/staging/typec/Kconfig" 111source "drivers/staging/typec/Kconfig"
112 112
113source "drivers/staging/vboxvideo/Kconfig"
114
113endif # STAGING 115endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index b93e6f5f0f6e..2918580bdb9e 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -44,3 +44,4 @@ obj-$(CONFIG_KS7010) += ks7010/
44obj-$(CONFIG_GREYBUS) += greybus/ 44obj-$(CONFIG_GREYBUS) += greybus/
45obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/ 45obj-$(CONFIG_BCM2835_VCHIQ) += vc04_services/
46obj-$(CONFIG_CRYPTO_DEV_CCREE) += ccree/ 46obj-$(CONFIG_CRYPTO_DEV_CCREE) += ccree/
47obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo/
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index b2e382888981..2f7bfc1c59e5 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3116,8 +3116,7 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev,
3116 /* following line: 2-1 per STC */ 3116 /* following line: 2-1 per STC */
3117 ni_stc_writel(dev, 1, NISTC_AO_UI_LOADA_REG); 3117 ni_stc_writel(dev, 1, NISTC_AO_UI_LOADA_REG);
3118 ni_stc_writew(dev, NISTC_AO_CMD1_UI_LOAD, NISTC_AO_CMD1_REG); 3118 ni_stc_writew(dev, NISTC_AO_CMD1_UI_LOAD, NISTC_AO_CMD1_REG);
3119 /* following line: N-1 per STC */ 3119 ni_stc_writel(dev, trigvar, NISTC_AO_UI_LOADA_REG);
3120 ni_stc_writel(dev, trigvar - 1, NISTC_AO_UI_LOADA_REG);
3121 } else { /* TRIG_EXT */ 3120 } else { /* TRIG_EXT */
3122 /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */ 3121 /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */
3123 devpriv->ao_cmd2 |= NISTC_AO_CMD2_BC_GATE_ENA; 3122 devpriv->ao_cmd2 |= NISTC_AO_CMD2_BC_GATE_ENA;
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
index 85b242ec5f9b..8fc191d99927 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -1640,8 +1640,13 @@ kiblnd_send(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg)
1640 ibmsg = tx->tx_msg; 1640 ibmsg = tx->tx_msg;
1641 ibmsg->ibm_u.immediate.ibim_hdr = *hdr; 1641 ibmsg->ibm_u.immediate.ibim_hdr = *hdr;
1642 1642
1643 copy_from_iter(&ibmsg->ibm_u.immediate.ibim_payload, IBLND_MSG_SIZE, 1643 rc = copy_from_iter(&ibmsg->ibm_u.immediate.ibim_payload, payload_nob,
1644 &from); 1644 &from);
1645 if (rc != payload_nob) {
1646 kiblnd_pool_free_node(&tx->tx_pool->tpo_pool, &tx->tx_list);
1647 return -EFAULT;
1648 }
1649
1645 nob = offsetof(struct kib_immediate_msg, ibim_payload[payload_nob]); 1650 nob = offsetof(struct kib_immediate_msg, ibim_payload[payload_nob]);
1646 kiblnd_init_tx_msg(ni, tx, IBLND_MSG_IMMEDIATE, nob); 1651 kiblnd_init_tx_msg(ni, tx, IBLND_MSG_IMMEDIATE, nob);
1647 1652
@@ -1741,8 +1746,14 @@ kiblnd_recv(struct lnet_ni *ni, void *private, struct lnet_msg *lntmsg,
1741 break; 1746 break;
1742 } 1747 }
1743 1748
1744 copy_to_iter(&rxmsg->ibm_u.immediate.ibim_payload, 1749 rc = copy_to_iter(&rxmsg->ibm_u.immediate.ibim_payload, rlen,
1745 IBLND_MSG_SIZE, to); 1750 to);
1751 if (rc != rlen) {
1752 rc = -EFAULT;
1753 break;
1754 }
1755
1756 rc = 0;
1746 lnet_finalize(ni, lntmsg, 0); 1757 lnet_finalize(ni, lntmsg, 0);
1747 break; 1758 break;
1748 1759
diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 002d09159896..a69007ef77bf 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -132,7 +132,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
132 kfree(pcmd->parmbuf); 132 kfree(pcmd->parmbuf);
133 } 133 }
134 134
135 if (!pcmd->rsp) { 135 if (pcmd->rsp) {
136 if (pcmd->rspsz != 0) { 136 if (pcmd->rspsz != 0) {
137 /* free rsp in cmd_obj */ 137 /* free rsp in cmd_obj */
138 kfree(pcmd->rsp); 138 kfree(pcmd->rsp);
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 963235fd7292..d283341cfe43 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -43,6 +43,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
43 {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ 43 {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
44 {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ 44 {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */
45 {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ 45 {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
46 {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */
46 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ 47 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
47 {} /* Terminating entry */ 48 {} /* Terminating entry */
48}; 49};
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 944dd25924be..4754f7a20684 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -40,7 +40,7 @@ static unsigned int get_mxclk_freq(void)
40 40
41 pll_reg = peek32(MXCLK_PLL_CTRL); 41 pll_reg = peek32(MXCLK_PLL_CTRL);
42 M = (pll_reg & PLL_CTRL_M_MASK) >> PLL_CTRL_M_SHIFT; 42 M = (pll_reg & PLL_CTRL_M_MASK) >> PLL_CTRL_M_SHIFT;
43 N = (pll_reg & PLL_CTRL_N_MASK) >> PLL_CTRL_M_SHIFT; 43 N = (pll_reg & PLL_CTRL_N_MASK) >> PLL_CTRL_N_SHIFT;
44 OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT; 44 OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
45 POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT; 45 POD = (pll_reg & PLL_CTRL_POD_MASK) >> PLL_CTRL_POD_SHIFT;
46 46
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 3aa4128703d5..67207b0554cd 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1053,6 +1053,26 @@ release_fb:
1053 return err; 1053 return err;
1054} 1054}
1055 1055
1056static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
1057{
1058 struct apertures_struct *ap;
1059 bool primary = false;
1060
1061 ap = alloc_apertures(1);
1062 if (!ap)
1063 return -ENOMEM;
1064
1065 ap->ranges[0].base = pci_resource_start(pdev, 0);
1066 ap->ranges[0].size = pci_resource_len(pdev, 0);
1067#ifdef CONFIG_X86
1068 primary = pdev->resource[PCI_ROM_RESOURCE].flags &
1069 IORESOURCE_ROM_SHADOW;
1070#endif
1071 remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
1072 kfree(ap);
1073 return 0;
1074}
1075
1056static int lynxfb_pci_probe(struct pci_dev *pdev, 1076static int lynxfb_pci_probe(struct pci_dev *pdev,
1057 const struct pci_device_id *ent) 1077 const struct pci_device_id *ent)
1058{ 1078{
@@ -1061,6 +1081,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
1061 int fbidx; 1081 int fbidx;
1062 int err; 1082 int err;
1063 1083
1084 err = lynxfb_kick_out_firmware_fb(pdev);
1085 if (err)
1086 return err;
1087
1064 /* enable device */ 1088 /* enable device */
1065 err = pcim_enable_device(pdev); 1089 err = pcim_enable_device(pdev);
1066 if (err) 1090 if (err)
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 82e5de248947..67956e24779c 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -2314,6 +2314,7 @@ static void __exit speakup_exit(void)
2314 mutex_lock(&spk_mutex); 2314 mutex_lock(&spk_mutex);
2315 synth_release(); 2315 synth_release();
2316 mutex_unlock(&spk_mutex); 2316 mutex_unlock(&spk_mutex);
2317 spk_ttyio_unregister_ldisc();
2317 2318
2318 speakup_kobj_exit(); 2319 speakup_kobj_exit();
2319 2320
@@ -2376,6 +2377,7 @@ static int __init speakup_init(void)
2376 if (err) 2377 if (err)
2377 goto error_kobjects; 2378 goto error_kobjects;
2378 2379
2380 spk_ttyio_register_ldisc();
2379 synth_init(synth_name); 2381 synth_init(synth_name);
2380 speakup_register_devsynth(); 2382 speakup_register_devsynth();
2381 /* 2383 /*
diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h
index 87b6a0a4c54d..046040ac074c 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -48,6 +48,8 @@ void spk_stop_serial_interrupt(void);
48int spk_wait_for_xmitr(struct spk_synth *in_synth); 48int spk_wait_for_xmitr(struct spk_synth *in_synth);
49void spk_serial_release(void); 49void spk_serial_release(void);
50void spk_ttyio_release(void); 50void spk_ttyio_release(void);
51void spk_ttyio_register_ldisc(void);
52void spk_ttyio_unregister_ldisc(void);
51 53
52void synth_buffer_skip_nonlatin1(void); 54void synth_buffer_skip_nonlatin1(void);
53u16 synth_buffer_getc(void); 55u16 synth_buffer_getc(void);
diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c
index ed8e96b06ead..fe340b07c482 100644
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -154,12 +154,6 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth)
154 struct ktermios tmp_termios; 154 struct ktermios tmp_termios;
155 dev_t dev; 155 dev_t dev;
156 156
157 ret = tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops);
158 if (ret) {
159 pr_err("Error registering line discipline.\n");
160 return ret;
161 }
162
163 ret = get_dev_to_use(synth, &dev); 157 ret = get_dev_to_use(synth, &dev);
164 if (ret) 158 if (ret)
165 return ret; 159 return ret;
@@ -196,10 +190,24 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth)
196 tty_unlock(tty); 190 tty_unlock(tty);
197 191
198 ret = tty_set_ldisc(tty, N_SPEAKUP); 192 ret = tty_set_ldisc(tty, N_SPEAKUP);
193 if (ret)
194 pr_err("speakup: Failed to set N_SPEAKUP on tty\n");
199 195
200 return ret; 196 return ret;
201} 197}
202 198
199void spk_ttyio_register_ldisc(void)
200{
201 if (tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops))
202 pr_warn("speakup: Error registering line discipline. Most synths won't work.\n");
203}
204
205void spk_ttyio_unregister_ldisc(void)
206{
207 if (tty_unregister_ldisc(N_SPEAKUP))
208 pr_warn("speakup: Couldn't unregister ldisc\n");
209}
210
203static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) 211static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
204{ 212{
205 if (in_synth->alive && speakup_tty && speakup_tty->ops->write) { 213 if (in_synth->alive && speakup_tty && speakup_tty->ops->write) {
@@ -300,7 +308,7 @@ void spk_ttyio_release(void)
300 308
301 tty_ldisc_flush(speakup_tty); 309 tty_ldisc_flush(speakup_tty);
302 tty_unlock(speakup_tty); 310 tty_unlock(speakup_tty);
303 tty_ldisc_release(speakup_tty); 311 tty_release_struct(speakup_tty, speakup_tty->index);
304} 312}
305EXPORT_SYMBOL_GPL(spk_ttyio_release); 313EXPORT_SYMBOL_GPL(spk_ttyio_release);
306 314
diff --git a/drivers/staging/vboxvideo/Kconfig b/drivers/staging/vboxvideo/Kconfig
new file mode 100644
index 000000000000..a52746f9a670
--- /dev/null
+++ b/drivers/staging/vboxvideo/Kconfig
@@ -0,0 +1,12 @@
1config DRM_VBOXVIDEO
2 tristate "Virtual Box Graphics Card"
3 depends on DRM && X86 && PCI
4 select DRM_KMS_HELPER
5 help
6 This is a KMS driver for the virtual Graphics Card used in
7 Virtual Box virtual machines.
8
9 Although it is possible to builtin this module, it is advised
10 to build this driver as a module, so that it can be updated
11 independently of the kernel. Select M to built this driver as a
12 module and add support for these devices via drm/kms interfaces.
diff --git a/drivers/staging/vboxvideo/Makefile b/drivers/staging/vboxvideo/Makefile
new file mode 100644
index 000000000000..2d0b3bc7ad73
--- /dev/null
+++ b/drivers/staging/vboxvideo/Makefile
@@ -0,0 +1,7 @@
1ccflags-y := -Iinclude/drm
2
3vboxvideo-y := hgsmi_base.o modesetting.o vbva_base.o \
4 vbox_drv.o vbox_fb.o vbox_hgsmi.o vbox_irq.o vbox_main.o \
5 vbox_mode.o vbox_prime.o vbox_ttm.o
6
7obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo.o
diff --git a/drivers/staging/vboxvideo/TODO b/drivers/staging/vboxvideo/TODO
new file mode 100644
index 000000000000..ce764309b079
--- /dev/null
+++ b/drivers/staging/vboxvideo/TODO
@@ -0,0 +1,9 @@
1TODO:
2-Move the driver over to the atomic API
3-Stop using old load / unload drm_driver hooks
4-Get a full review from the drm-maintainers on dri-devel done on this driver
5-Extend this TODO with the results of that review
6
7Please send any patches to Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
8Hans de Goede <hdegoede@redhat.com> and
9Michael Thayer <michael.thayer@oracle.com>.
diff --git a/drivers/staging/vboxvideo/hgsmi_base.c b/drivers/staging/vboxvideo/hgsmi_base.c
new file mode 100644
index 000000000000..15ff5f42e2cd
--- /dev/null
+++ b/drivers/staging/vboxvideo/hgsmi_base.c
@@ -0,0 +1,246 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#include "vbox_drv.h"
24#include "vbox_err.h"
25#include "vboxvideo_guest.h"
26#include "vboxvideo_vbe.h"
27#include "hgsmi_channels.h"
28#include "hgsmi_ch_setup.h"
29
30/**
31 * Inform the host of the location of the host flags in VRAM via an HGSMI cmd.
32 * @param ctx the context of the guest heap to use.
33 * @param location the offset chosen for the flags within guest VRAM.
34 * @returns 0 on success, -errno on failure
35 */
36int hgsmi_report_flags_location(struct gen_pool *ctx, u32 location)
37{
38 struct hgsmi_buffer_location *p;
39
40 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_HGSMI,
41 HGSMI_CC_HOST_FLAGS_LOCATION);
42 if (!p)
43 return -ENOMEM;
44
45 p->buf_location = location;
46 p->buf_len = sizeof(struct hgsmi_host_flags);
47
48 hgsmi_buffer_submit(ctx, p);
49 hgsmi_buffer_free(ctx, p);
50
51 return 0;
52}
53
54/**
55 * Notify the host of HGSMI-related guest capabilities via an HGSMI command.
56 * @param ctx the context of the guest heap to use.
57 * @param caps the capabilities to report, see vbva_caps.
58 * @returns 0 on success, -errno on failure
59 */
60int hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps)
61{
62 struct vbva_caps *p;
63
64 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA, VBVA_INFO_CAPS);
65 if (!p)
66 return -ENOMEM;
67
68 p->rc = VERR_NOT_IMPLEMENTED;
69 p->caps = caps;
70
71 hgsmi_buffer_submit(ctx, p);
72
73 WARN_ON_ONCE(RT_FAILURE(p->rc));
74
75 hgsmi_buffer_free(ctx, p);
76
77 return 0;
78}
79
80int hgsmi_test_query_conf(struct gen_pool *ctx)
81{
82 u32 value = 0;
83 int ret;
84
85 ret = hgsmi_query_conf(ctx, U32_MAX, &value);
86 if (ret)
87 return ret;
88
89 return value == U32_MAX ? 0 : -EIO;
90}
91
92/**
93 * Query the host for an HGSMI configuration parameter via an HGSMI command.
94 * @param ctx the context containing the heap used
95 * @param index the index of the parameter to query,
96 * @see vbva_conf32::index
97 * @param value_ret where to store the value of the parameter on success
98 * @returns 0 on success, -errno on failure
99 */
100int hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret)
101{
102 struct vbva_conf32 *p;
103
104 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
105 VBVA_QUERY_CONF32);
106 if (!p)
107 return -ENOMEM;
108
109 p->index = index;
110 p->value = U32_MAX;
111
112 hgsmi_buffer_submit(ctx, p);
113
114 *value_ret = p->value;
115
116 hgsmi_buffer_free(ctx, p);
117
118 return 0;
119}
120
121/**
122 * Pass the host a new mouse pointer shape via an HGSMI command.
123 *
124 * @param ctx the context containing the heap to be used
125 * @param flags cursor flags, @see VMMDevReqMousePointer::flags
126 * @param hot_x horizontal position of the hot spot
127 * @param hot_y vertical position of the hot spot
128 * @param width width in pixels of the cursor
129 * @param height height in pixels of the cursor
130 * @param pixels pixel data, @see VMMDevReqMousePointer for the format
131 * @param len size in bytes of the pixel data
132 * @returns 0 on success, -errno on failure
133 */
134int hgsmi_update_pointer_shape(struct gen_pool *ctx, u32 flags,
135 u32 hot_x, u32 hot_y, u32 width, u32 height,
136 u8 *pixels, u32 len)
137{
138 struct vbva_mouse_pointer_shape *p;
139 u32 pixel_len = 0;
140 int rc;
141
142 if (flags & VBOX_MOUSE_POINTER_SHAPE) {
143 /*
144 * Size of the pointer data:
145 * sizeof (AND mask) + sizeof (XOR_MASK)
146 */
147 pixel_len = ((((width + 7) / 8) * height + 3) & ~3) +
148 width * 4 * height;
149 if (pixel_len > len)
150 return -EINVAL;
151
152 /*
153 * If shape is supplied, then always create the pointer visible.
154 * See comments in 'vboxUpdatePointerShape'
155 */
156 flags |= VBOX_MOUSE_POINTER_VISIBLE;
157 }
158
159 p = hgsmi_buffer_alloc(ctx, sizeof(*p) + pixel_len, HGSMI_CH_VBVA,
160 VBVA_MOUSE_POINTER_SHAPE);
161 if (!p)
162 return -ENOMEM;
163
164 p->result = VINF_SUCCESS;
165 p->flags = flags;
166 p->hot_X = hot_x;
167 p->hot_y = hot_y;
168 p->width = width;
169 p->height = height;
170 if (pixel_len)
171 memcpy(p->data, pixels, pixel_len);
172
173 hgsmi_buffer_submit(ctx, p);
174
175 switch (p->result) {
176 case VINF_SUCCESS:
177 rc = 0;
178 break;
179 case VERR_NO_MEMORY:
180 rc = -ENOMEM;
181 break;
182 case VERR_NOT_SUPPORTED:
183 rc = -EBUSY;
184 break;
185 default:
186 rc = -EINVAL;
187 }
188
189 hgsmi_buffer_free(ctx, p);
190
191 return rc;
192}
193
194/**
195 * Report the guest cursor position. The host may wish to use this information
196 * to re-position its own cursor (though this is currently unlikely). The
197 * current host cursor position is returned.
198 * @param ctx The context containing the heap used.
199 * @param report_position Are we reporting a position?
200 * @param x Guest cursor X position.
201 * @param y Guest cursor Y position.
202 * @param x_host Host cursor X position is stored here. Optional.
203 * @param y_host Host cursor Y position is stored here. Optional.
204 * @returns 0 on success, -errno on failure
205 */
206int hgsmi_cursor_position(struct gen_pool *ctx, bool report_position,
207 u32 x, u32 y, u32 *x_host, u32 *y_host)
208{
209 struct vbva_cursor_position *p;
210
211 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
212 VBVA_CURSOR_POSITION);
213 if (!p)
214 return -ENOMEM;
215
216 p->report_position = report_position;
217 p->x = x;
218 p->y = y;
219
220 hgsmi_buffer_submit(ctx, p);
221
222 *x_host = p->x;
223 *y_host = p->y;
224
225 hgsmi_buffer_free(ctx, p);
226
227 return 0;
228}
229
230/**
231 * @todo Mouse pointer position to be read from VMMDev memory, address of the
232 * memory region can be queried from VMMDev via an IOCTL. This VMMDev memory
233 * region will contain host information which is needed by the guest.
234 *
235 * Reading will not cause a switch to the host.
236 *
237 * Have to take into account:
238 * * synchronization: host must write to the memory only from EMT,
239 * large structures must be read under flag, which tells the host
240 * that the guest is currently reading the memory (OWNER flag?).
241 * * guest writes: may be allocate a page for the host info and make
242 * the page readonly for the guest.
243 * * the information should be available only for additions drivers.
244 * * VMMDev additions driver will inform the host which version of the info
245 * it expects, host must support all versions.
246 */
diff --git a/drivers/staging/vboxvideo/hgsmi_ch_setup.h b/drivers/staging/vboxvideo/hgsmi_ch_setup.h
new file mode 100644
index 000000000000..8e6d9e11a69c
--- /dev/null
+++ b/drivers/staging/vboxvideo/hgsmi_ch_setup.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __HGSMI_CH_SETUP_H__
24#define __HGSMI_CH_SETUP_H__
25
26/*
27 * Tell the host the location of hgsmi_host_flags structure, where the host
28 * can write information about pending buffers, etc, and which can be quickly
29 * polled by the guest without a need to port IO.
30 */
31#define HGSMI_CC_HOST_FLAGS_LOCATION 0
32
33struct hgsmi_buffer_location {
34 u32 buf_location;
35 u32 buf_len;
36} __packed;
37
38/* HGSMI setup and configuration data structures. */
39/* host->guest commands pending, should be accessed under FIFO lock only */
40#define HGSMIHOSTFLAGS_COMMANDS_PENDING 0x01u
41/* IRQ is fired, should be accessed under VGAState::lock only */
42#define HGSMIHOSTFLAGS_IRQ 0x02u
43/* vsync interrupt flag, should be accessed under VGAState::lock only */
44#define HGSMIHOSTFLAGS_VSYNC 0x10u
45/** monitor hotplug flag, should be accessed under VGAState::lock only */
46#define HGSMIHOSTFLAGS_HOTPLUG 0x20u
47/**
48 * Cursor capability state change flag, should be accessed under
49 * VGAState::lock only. @see vbva_conf32.
50 */
51#define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES 0x40u
52
53struct hgsmi_host_flags {
54 /*
55 * Host flags can be accessed and modified in multiple threads
56 * concurrently, e.g. CrOpenGL HGCM and GUI threads when completing
57 * HGSMI 3D and Video Accel respectively, EMT thread when dealing with
58 * HGSMI command processing, etc.
59 * Besides settings/cleaning flags atomically, some flags have their
60 * own special sync restrictions, see comments for flags above.
61 */
62 u32 host_flags;
63 u32 reserved[3];
64} __packed;
65
66#endif
diff --git a/drivers/staging/vboxvideo/hgsmi_channels.h b/drivers/staging/vboxvideo/hgsmi_channels.h
new file mode 100644
index 000000000000..a2a34b2167b4
--- /dev/null
+++ b/drivers/staging/vboxvideo/hgsmi_channels.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __HGSMI_CHANNELS_H__
24#define __HGSMI_CHANNELS_H__
25
26/*
27 * Each channel has an 8 bit identifier. There are a number of predefined
28 * (hardcoded) channels.
29 *
30 * HGSMI_CH_HGSMI channel can be used to map a string channel identifier
31 * to a free 16 bit numerical value. values are allocated in range
32 * [HGSMI_CH_STRING_FIRST;HGSMI_CH_STRING_LAST].
33 */
34
35/* A reserved channel value */
36#define HGSMI_CH_RESERVED 0x00
37/* HGCMI: setup and configuration */
38#define HGSMI_CH_HGSMI 0x01
39/* Graphics: VBVA */
40#define HGSMI_CH_VBVA 0x02
41/* Graphics: Seamless with a single guest region */
42#define HGSMI_CH_SEAMLESS 0x03
43/* Graphics: Seamless with separate host windows */
44#define HGSMI_CH_SEAMLESS2 0x04
45/* Graphics: OpenGL HW acceleration */
46#define HGSMI_CH_OPENGL 0x05
47
48/* The first channel index to be used for string mappings (inclusive) */
49#define HGSMI_CH_STRING_FIRST 0x20
50/* The last channel index for string mappings (inclusive) */
51#define HGSMI_CH_STRING_LAST 0xff
52
53#endif
diff --git a/drivers/staging/vboxvideo/hgsmi_defs.h b/drivers/staging/vboxvideo/hgsmi_defs.h
new file mode 100644
index 000000000000..5b21fb974d20
--- /dev/null
+++ b/drivers/staging/vboxvideo/hgsmi_defs.h
@@ -0,0 +1,92 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __HGSMI_DEFS_H__
24#define __HGSMI_DEFS_H__
25
26/* Buffer sequence type mask. */
27#define HGSMI_BUFFER_HEADER_F_SEQ_MASK 0x03
28/* Single buffer, not a part of a sequence. */
29#define HGSMI_BUFFER_HEADER_F_SEQ_SINGLE 0x00
30/* The first buffer in a sequence. */
31#define HGSMI_BUFFER_HEADER_F_SEQ_START 0x01
32/* A middle buffer in a sequence. */
33#define HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE 0x02
34/* The last buffer in a sequence. */
35#define HGSMI_BUFFER_HEADER_F_SEQ_END 0x03
36
37/* 16 bytes buffer header. */
38struct hgsmi_buffer_header {
39 u32 data_size; /* Size of data that follows the header. */
40 u8 flags; /* HGSMI_BUFFER_HEADER_F_* */
41 u8 channel; /* The channel the data must be routed to. */
42 u16 channel_info; /* Opaque to the HGSMI, used by the channel. */
43
44 union {
45 /* Opaque placeholder to make the union 8 bytes. */
46 u8 header_data[8];
47
48 /* HGSMI_BUFFER_HEADER_F_SEQ_SINGLE */
49 struct {
50 u32 reserved1; /* A reserved field, initialize to 0. */
51 u32 reserved2; /* A reserved field, initialize to 0. */
52 } buffer;
53
54 /* HGSMI_BUFFER_HEADER_F_SEQ_START */
55 struct {
56 /* Must be the same for all buffers in the sequence. */
57 u32 sequence_number;
58 /* The total size of the sequence. */
59 u32 sequence_size;
60 } sequence_start;
61
62 /*
63 * HGSMI_BUFFER_HEADER_F_SEQ_CONTINUE and
64 * HGSMI_BUFFER_HEADER_F_SEQ_END
65 */
66 struct {
67 /* Must be the same for all buffers in the sequence. */
68 u32 sequence_number;
69 /* Data offset in the entire sequence. */
70 u32 sequence_offset;
71 } sequence_continue;
72 } u;
73} __packed;
74
75/* 8 bytes buffer tail. */
76struct hgsmi_buffer_tail {
77 /* Reserved, must be initialized to 0. */
78 u32 reserved;
79 /*
80 * One-at-a-Time Hash: http://www.burtleburtle.net/bob/hash/doobs.html
81 * Over the header, offset and for first 4 bytes of the tail.
82 */
83 u32 checksum;
84} __packed;
85
86/*
87 * The size of the array of channels. Array indexes are u8.
88 * Note: the value must not be changed.
89 */
90#define HGSMI_NUMBER_OF_CHANNELS 0x100
91
92#endif
diff --git a/drivers/staging/vboxvideo/modesetting.c b/drivers/staging/vboxvideo/modesetting.c
new file mode 100644
index 000000000000..7616b8aab23a
--- /dev/null
+++ b/drivers/staging/vboxvideo/modesetting.c
@@ -0,0 +1,142 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#include "vbox_drv.h"
24#include "vbox_err.h"
25#include "vboxvideo_guest.h"
26#include "vboxvideo_vbe.h"
27#include "hgsmi_channels.h"
28
29/**
30 * Set a video mode via an HGSMI request. The views must have been
31 * initialised first using @a VBoxHGSMISendViewInfo and if the mode is being
32 * set on the first display then it must be set first using registers.
33 * @param ctx The context containing the heap to use
34 * @param display The screen number
35 * @param origin_x The horizontal displacement relative to the first scrn
36 * @param origin_y The vertical displacement relative to the first screen
37 * @param start_offset The offset of the visible area of the framebuffer
38 * relative to the framebuffer start
39 * @param pitch The offset in bytes between the starts of two adjecent
40 * scan lines in video RAM
41 * @param width The mode width
42 * @param height The mode height
43 * @param bpp The colour depth of the mode
44 * @param flags Flags
45 */
46void hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
47 s32 origin_x, s32 origin_y, u32 start_offset,
48 u32 pitch, u32 width, u32 height,
49 u16 bpp, u16 flags)
50{
51 struct vbva_infoscreen *p;
52
53 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
54 VBVA_INFO_SCREEN);
55 if (!p)
56 return;
57
58 p->view_index = display;
59 p->origin_x = origin_x;
60 p->origin_y = origin_y;
61 p->start_offset = start_offset;
62 p->line_size = pitch;
63 p->width = width;
64 p->height = height;
65 p->bits_per_pixel = bpp;
66 p->flags = flags;
67
68 hgsmi_buffer_submit(ctx, p);
69 hgsmi_buffer_free(ctx, p);
70}
71
72/**
73 * Report the rectangle relative to which absolute pointer events should be
74 * expressed. This information remains valid until the next VBVA resize event
75 * for any screen, at which time it is reset to the bounding rectangle of all
76 * virtual screens.
77 * @param ctx The context containing the heap to use.
78 * @param origin_x Upper left X co-ordinate relative to the first screen.
79 * @param origin_y Upper left Y co-ordinate relative to the first screen.
80 * @param width Rectangle width.
81 * @param height Rectangle height.
82 * @returns 0 on success, -errno on failure
83 */
84int hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
85 u32 width, u32 height)
86{
87 struct vbva_report_input_mapping *p;
88
89 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
90 VBVA_REPORT_INPUT_MAPPING);
91 if (!p)
92 return -ENOMEM;
93
94 p->x = origin_x;
95 p->y = origin_y;
96 p->cx = width;
97 p->cy = height;
98
99 hgsmi_buffer_submit(ctx, p);
100 hgsmi_buffer_free(ctx, p);
101
102 return 0;
103}
104
105/**
106 * Get most recent video mode hints.
107 * @param ctx The context containing the heap to use.
108 * @param screens The number of screens to query hints for, starting at 0.
109 * @param hints Array of vbva_modehint structures for receiving the hints.
110 * @returns 0 on success, -errno on failure
111 */
112int hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
113 struct vbva_modehint *hints)
114{
115 struct vbva_query_mode_hints *p;
116 size_t size;
117
118 if (WARN_ON(!hints))
119 return -EINVAL;
120
121 size = screens * sizeof(struct vbva_modehint);
122 p = hgsmi_buffer_alloc(ctx, sizeof(*p) + size, HGSMI_CH_VBVA,
123 VBVA_QUERY_MODE_HINTS);
124 if (!p)
125 return -ENOMEM;
126
127 p->hints_queried_count = screens;
128 p->hint_structure_guest_size = sizeof(struct vbva_modehint);
129 p->rc = VERR_NOT_SUPPORTED;
130
131 hgsmi_buffer_submit(ctx, p);
132
133 if (RT_FAILURE(p->rc)) {
134 hgsmi_buffer_free(ctx, p);
135 return -EIO;
136 }
137
138 memcpy(hints, ((u8 *)p) + sizeof(struct vbva_query_mode_hints), size);
139 hgsmi_buffer_free(ctx, p);
140
141 return 0;
142}
diff --git a/drivers/staging/vboxvideo/vbox_drv.c b/drivers/staging/vboxvideo/vbox_drv.c
new file mode 100644
index 000000000000..92ae1560a16d
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_drv.c
@@ -0,0 +1,286 @@
1/*
2 * Copyright (C) 2013-2017 Oracle Corporation
3 * This file is based on ast_drv.c
4 * Copyright 2012 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 * Authors: Dave Airlie <airlied@redhat.com>
27 * Michael Thayer <michael.thayer@oracle.com,
28 * Hans de Goede <hdegoede@redhat.com>
29 */
30#include <linux/module.h>
31#include <linux/console.h>
32#include <linux/vt_kern.h>
33
34#include <drm/drmP.h>
35#include <drm/drm_crtc_helper.h>
36
37#include "vbox_drv.h"
38
39int vbox_modeset = -1;
40
41MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
42module_param_named(modeset, vbox_modeset, int, 0400);
43
44static struct drm_driver driver;
45
46static const struct pci_device_id pciidlist[] = {
47 { 0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
48 { 0, 0, 0},
49};
50MODULE_DEVICE_TABLE(pci, pciidlist);
51
52static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
53{
54 return drm_get_pci_dev(pdev, ent, &driver);
55}
56
57static void vbox_pci_remove(struct pci_dev *pdev)
58{
59 struct drm_device *dev = pci_get_drvdata(pdev);
60
61 drm_put_dev(dev);
62}
63
64static int vbox_drm_freeze(struct drm_device *dev)
65{
66 struct vbox_private *vbox = dev->dev_private;
67
68 drm_kms_helper_poll_disable(dev);
69
70 pci_save_state(dev->pdev);
71
72 drm_fb_helper_set_suspend_unlocked(&vbox->fbdev->helper, true);
73
74 return 0;
75}
76
77static int vbox_drm_thaw(struct drm_device *dev)
78{
79 struct vbox_private *vbox = dev->dev_private;
80
81 drm_mode_config_reset(dev);
82 drm_helper_resume_force_mode(dev);
83 drm_fb_helper_set_suspend_unlocked(&vbox->fbdev->helper, false);
84
85 return 0;
86}
87
88static int vbox_drm_resume(struct drm_device *dev)
89{
90 int ret;
91
92 if (pci_enable_device(dev->pdev))
93 return -EIO;
94
95 ret = vbox_drm_thaw(dev);
96 if (ret)
97 return ret;
98
99 drm_kms_helper_poll_enable(dev);
100
101 return 0;
102}
103
104static int vbox_pm_suspend(struct device *dev)
105{
106 struct pci_dev *pdev = to_pci_dev(dev);
107 struct drm_device *ddev = pci_get_drvdata(pdev);
108 int error;
109
110 error = vbox_drm_freeze(ddev);
111 if (error)
112 return error;
113
114 pci_disable_device(pdev);
115 pci_set_power_state(pdev, PCI_D3hot);
116
117 return 0;
118}
119
120static int vbox_pm_resume(struct device *dev)
121{
122 struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev));
123
124 return vbox_drm_resume(ddev);
125}
126
127static int vbox_pm_freeze(struct device *dev)
128{
129 struct pci_dev *pdev = to_pci_dev(dev);
130 struct drm_device *ddev = pci_get_drvdata(pdev);
131
132 if (!ddev || !ddev->dev_private)
133 return -ENODEV;
134
135 return vbox_drm_freeze(ddev);
136}
137
138static int vbox_pm_thaw(struct device *dev)
139{
140 struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev));
141
142 return vbox_drm_thaw(ddev);
143}
144
145static int vbox_pm_poweroff(struct device *dev)
146{
147 struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev));
148
149 return vbox_drm_freeze(ddev);
150}
151
152static const struct dev_pm_ops vbox_pm_ops = {
153 .suspend = vbox_pm_suspend,
154 .resume = vbox_pm_resume,
155 .freeze = vbox_pm_freeze,
156 .thaw = vbox_pm_thaw,
157 .poweroff = vbox_pm_poweroff,
158 .restore = vbox_pm_resume,
159};
160
161static struct pci_driver vbox_pci_driver = {
162 .name = DRIVER_NAME,
163 .id_table = pciidlist,
164 .probe = vbox_pci_probe,
165 .remove = vbox_pci_remove,
166 .driver.pm = &vbox_pm_ops,
167};
168
169static const struct file_operations vbox_fops = {
170 .owner = THIS_MODULE,
171 .open = drm_open,
172 .release = drm_release,
173 .unlocked_ioctl = drm_ioctl,
174 .mmap = vbox_mmap,
175 .poll = drm_poll,
176#ifdef CONFIG_COMPAT
177 .compat_ioctl = drm_compat_ioctl,
178#endif
179 .read = drm_read,
180};
181
182static int vbox_master_set(struct drm_device *dev,
183 struct drm_file *file_priv, bool from_open)
184{
185 struct vbox_private *vbox = dev->dev_private;
186
187 /*
188 * We do not yet know whether the new owner can handle hotplug, so we
189 * do not advertise dynamic modes on the first query and send a
190 * tentative hotplug notification after that to see if they query again.
191 */
192 vbox->initial_mode_queried = false;
193
194 mutex_lock(&vbox->hw_mutex);
195 /*
196 * Disable VBVA when someone releases master in case the next person
197 * tries tries to do VESA.
198 */
199 /** @todo work out if anyone is likely to and whether it will work. */
200 /*
201 * Update: we also disable it because if the new master does not do
202 * dirty rectangle reporting (e.g. old versions of Plymouth) then at
203 * least the first screen will still be updated. We enable it as soon
204 * as we receive a dirty rectangle report.
205 */
206 vbox_disable_accel(vbox);
207 mutex_unlock(&vbox->hw_mutex);
208
209 return 0;
210}
211
212static void vbox_master_drop(struct drm_device *dev, struct drm_file *file_priv)
213{
214 struct vbox_private *vbox = dev->dev_private;
215
216 /* See vbox_master_set() */
217 vbox->initial_mode_queried = false;
218
219 mutex_lock(&vbox->hw_mutex);
220 vbox_disable_accel(vbox);
221 mutex_unlock(&vbox->hw_mutex);
222}
223
224static struct drm_driver driver = {
225 .driver_features =
226 DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
227 DRIVER_PRIME,
228 .dev_priv_size = 0,
229
230 .load = vbox_driver_load,
231 .unload = vbox_driver_unload,
232 .lastclose = vbox_driver_lastclose,
233 .master_set = vbox_master_set,
234 .master_drop = vbox_master_drop,
235 .set_busid = drm_pci_set_busid,
236
237 .fops = &vbox_fops,
238 .irq_handler = vbox_irq_handler,
239 .name = DRIVER_NAME,
240 .desc = DRIVER_DESC,
241 .date = DRIVER_DATE,
242 .major = DRIVER_MAJOR,
243 .minor = DRIVER_MINOR,
244 .patchlevel = DRIVER_PATCHLEVEL,
245
246 .gem_free_object = vbox_gem_free_object,
247 .dumb_create = vbox_dumb_create,
248 .dumb_map_offset = vbox_dumb_mmap_offset,
249 .dumb_destroy = drm_gem_dumb_destroy,
250 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
251 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
252 .gem_prime_export = drm_gem_prime_export,
253 .gem_prime_import = drm_gem_prime_import,
254 .gem_prime_pin = vbox_gem_prime_pin,
255 .gem_prime_unpin = vbox_gem_prime_unpin,
256 .gem_prime_get_sg_table = vbox_gem_prime_get_sg_table,
257 .gem_prime_import_sg_table = vbox_gem_prime_import_sg_table,
258 .gem_prime_vmap = vbox_gem_prime_vmap,
259 .gem_prime_vunmap = vbox_gem_prime_vunmap,
260 .gem_prime_mmap = vbox_gem_prime_mmap,
261};
262
263static int __init vbox_init(void)
264{
265#ifdef CONFIG_VGA_CONSOLE
266 if (vgacon_text_force() && vbox_modeset == -1)
267 return -EINVAL;
268#endif
269
270 if (vbox_modeset == 0)
271 return -EINVAL;
272
273 return drm_pci_init(&driver, &vbox_pci_driver);
274}
275
276static void __exit vbox_exit(void)
277{
278 drm_pci_exit(&driver, &vbox_pci_driver);
279}
280
281module_init(vbox_init);
282module_exit(vbox_exit);
283
284MODULE_AUTHOR("Oracle Corporation");
285MODULE_DESCRIPTION(DRIVER_DESC);
286MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/staging/vboxvideo/vbox_drv.h b/drivers/staging/vboxvideo/vbox_drv.h
new file mode 100644
index 000000000000..4b9302703b36
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_drv.h
@@ -0,0 +1,296 @@
1/*
2 * Copyright (C) 2013-2017 Oracle Corporation
3 * This file is based on ast_drv.h
4 * Copyright 2012 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 * Authors: Dave Airlie <airlied@redhat.com>
27 * Michael Thayer <michael.thayer@oracle.com,
28 * Hans de Goede <hdegoede@redhat.com>
29 */
30#ifndef __VBOX_DRV_H__
31#define __VBOX_DRV_H__
32
33#include <linux/genalloc.h>
34#include <linux/io.h>
35#include <linux/string.h>
36#include <linux/version.h>
37
38#include <drm/drmP.h>
39#include <drm/drm_encoder.h>
40#include <drm/drm_fb_helper.h>
41#include <drm/drm_gem.h>
42
43#include <drm/ttm/ttm_bo_api.h>
44#include <drm/ttm/ttm_bo_driver.h>
45#include <drm/ttm/ttm_placement.h>
46#include <drm/ttm/ttm_memory.h>
47#include <drm/ttm/ttm_module.h>
48
49#include "vboxvideo_guest.h"
50#include "vboxvideo_vbe.h"
51#include "hgsmi_ch_setup.h"
52
53#define DRIVER_NAME "vboxvideo"
54#define DRIVER_DESC "Oracle VM VirtualBox Graphics Card"
55#define DRIVER_DATE "20130823"
56
57#define DRIVER_MAJOR 1
58#define DRIVER_MINOR 0
59#define DRIVER_PATCHLEVEL 0
60
61#define VBOX_MAX_CURSOR_WIDTH 64
62#define VBOX_MAX_CURSOR_HEIGHT 64
63#define CURSOR_PIXEL_COUNT (VBOX_MAX_CURSOR_WIDTH * VBOX_MAX_CURSOR_HEIGHT)
64#define CURSOR_DATA_SIZE (CURSOR_PIXEL_COUNT * 4 + CURSOR_PIXEL_COUNT / 8)
65
66#define VBOX_MAX_SCREENS 32
67
68#define GUEST_HEAP_OFFSET(vbox) ((vbox)->full_vram_size - \
69 VBVA_ADAPTER_INFORMATION_SIZE)
70#define GUEST_HEAP_SIZE VBVA_ADAPTER_INFORMATION_SIZE
71#define GUEST_HEAP_USABLE_SIZE (VBVA_ADAPTER_INFORMATION_SIZE - \
72 sizeof(struct hgsmi_host_flags))
73#define HOST_FLAGS_OFFSET GUEST_HEAP_USABLE_SIZE
74
75struct vbox_fbdev;
76
77struct vbox_private {
78 struct drm_device *dev;
79
80 u8 __iomem *guest_heap;
81 u8 __iomem *vbva_buffers;
82 struct gen_pool *guest_pool;
83 struct vbva_buf_ctx *vbva_info;
84 bool any_pitch;
85 u32 num_crtcs;
86 /** Amount of available VRAM, including space used for buffers. */
87 u32 full_vram_size;
88 /** Amount of available VRAM, not including space used for buffers. */
89 u32 available_vram_size;
90 /** Array of structures for receiving mode hints. */
91 struct vbva_modehint *last_mode_hints;
92
93 struct vbox_fbdev *fbdev;
94
95 int fb_mtrr;
96
97 struct {
98 struct drm_global_reference mem_global_ref;
99 struct ttm_bo_global_ref bo_global_ref;
100 struct ttm_bo_device bdev;
101 } ttm;
102
103 struct mutex hw_mutex; /* protects modeset and accel/vbva accesses */
104 /**
105 * We decide whether or not user-space supports display hot-plug
106 * depending on whether they react to a hot-plug event after the initial
107 * mode query.
108 */
109 bool initial_mode_queried;
110 struct work_struct hotplug_work;
111 u32 input_mapping_width;
112 u32 input_mapping_height;
113 /**
114 * Is user-space using an X.Org-style layout of one large frame-buffer
115 * encompassing all screen ones or is the fbdev console active?
116 */
117 bool single_framebuffer;
118 u32 cursor_width;
119 u32 cursor_height;
120 u32 cursor_hot_x;
121 u32 cursor_hot_y;
122 size_t cursor_data_size;
123 u8 cursor_data[CURSOR_DATA_SIZE];
124};
125
126#undef CURSOR_PIXEL_COUNT
127#undef CURSOR_DATA_SIZE
128
129int vbox_driver_load(struct drm_device *dev, unsigned long flags);
130void vbox_driver_unload(struct drm_device *dev);
131void vbox_driver_lastclose(struct drm_device *dev);
132
133struct vbox_gem_object;
134
135struct vbox_connector {
136 struct drm_connector base;
137 char name[32];
138 struct vbox_crtc *vbox_crtc;
139 struct {
140 u16 width;
141 u16 height;
142 bool disconnected;
143 } mode_hint;
144};
145
146struct vbox_crtc {
147 struct drm_crtc base;
148 bool blanked;
149 bool disconnected;
150 unsigned int crtc_id;
151 u32 fb_offset;
152 bool cursor_enabled;
153 u16 x_hint;
154 u16 y_hint;
155};
156
157struct vbox_encoder {
158 struct drm_encoder base;
159};
160
161struct vbox_framebuffer {
162 struct drm_framebuffer base;
163 struct drm_gem_object *obj;
164};
165
166struct vbox_fbdev {
167 struct drm_fb_helper helper;
168 struct vbox_framebuffer afb;
169 int size;
170 struct ttm_bo_kmap_obj mapping;
171 int x1, y1, x2, y2; /* dirty rect */
172 spinlock_t dirty_lock;
173};
174
175#define to_vbox_crtc(x) container_of(x, struct vbox_crtc, base)
176#define to_vbox_connector(x) container_of(x, struct vbox_connector, base)
177#define to_vbox_encoder(x) container_of(x, struct vbox_encoder, base)
178#define to_vbox_framebuffer(x) container_of(x, struct vbox_framebuffer, base)
179
180int vbox_mode_init(struct drm_device *dev);
181void vbox_mode_fini(struct drm_device *dev);
182
183#define DRM_MODE_FB_CMD drm_mode_fb_cmd2
184#define CRTC_FB(crtc) ((crtc)->primary->fb)
185
186void vbox_enable_accel(struct vbox_private *vbox);
187void vbox_disable_accel(struct vbox_private *vbox);
188void vbox_report_caps(struct vbox_private *vbox);
189
190void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
191 struct drm_clip_rect *rects,
192 unsigned int num_rects);
193
194int vbox_framebuffer_init(struct drm_device *dev,
195 struct vbox_framebuffer *vbox_fb,
196 const struct DRM_MODE_FB_CMD *mode_cmd,
197 struct drm_gem_object *obj);
198
199int vbox_fbdev_init(struct drm_device *dev);
200void vbox_fbdev_fini(struct drm_device *dev);
201void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr);
202
203struct vbox_bo {
204 struct ttm_buffer_object bo;
205 struct ttm_placement placement;
206 struct ttm_bo_kmap_obj kmap;
207 struct drm_gem_object gem;
208 struct ttm_place placements[3];
209 int pin_count;
210};
211
212#define gem_to_vbox_bo(gobj) container_of((gobj), struct vbox_bo, gem)
213
214static inline struct vbox_bo *vbox_bo(struct ttm_buffer_object *bo)
215{
216 return container_of(bo, struct vbox_bo, bo);
217}
218
219#define to_vbox_obj(x) container_of(x, struct vbox_gem_object, base)
220
221int vbox_dumb_create(struct drm_file *file,
222 struct drm_device *dev,
223 struct drm_mode_create_dumb *args);
224
225void vbox_gem_free_object(struct drm_gem_object *obj);
226int vbox_dumb_mmap_offset(struct drm_file *file,
227 struct drm_device *dev,
228 u32 handle, u64 *offset);
229
230#define DRM_FILE_PAGE_OFFSET (0x10000000ULL >> PAGE_SHIFT)
231
232int vbox_mm_init(struct vbox_private *vbox);
233void vbox_mm_fini(struct vbox_private *vbox);
234
235int vbox_bo_create(struct drm_device *dev, int size, int align,
236 u32 flags, struct vbox_bo **pvboxbo);
237
238int vbox_gem_create(struct drm_device *dev,
239 u32 size, bool iskernel, struct drm_gem_object **obj);
240
241int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr);
242int vbox_bo_unpin(struct vbox_bo *bo);
243
244static inline int vbox_bo_reserve(struct vbox_bo *bo, bool no_wait)
245{
246 int ret;
247
248 ret = ttm_bo_reserve(&bo->bo, true, no_wait, NULL);
249 if (ret) {
250 if (ret != -ERESTARTSYS && ret != -EBUSY)
251 DRM_ERROR("reserve failed %p\n", bo);
252 return ret;
253 }
254 return 0;
255}
256
257static inline void vbox_bo_unreserve(struct vbox_bo *bo)
258{
259 ttm_bo_unreserve(&bo->bo);
260}
261
262void vbox_ttm_placement(struct vbox_bo *bo, int domain);
263int vbox_bo_push_sysram(struct vbox_bo *bo);
264int vbox_mmap(struct file *filp, struct vm_area_struct *vma);
265
266/* vbox_prime.c */
267int vbox_gem_prime_pin(struct drm_gem_object *obj);
268void vbox_gem_prime_unpin(struct drm_gem_object *obj);
269struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj);
270struct drm_gem_object *vbox_gem_prime_import_sg_table(
271 struct drm_device *dev, struct dma_buf_attachment *attach,
272 struct sg_table *table);
273void *vbox_gem_prime_vmap(struct drm_gem_object *obj);
274void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
275int vbox_gem_prime_mmap(struct drm_gem_object *obj,
276 struct vm_area_struct *area);
277
278/* vbox_irq.c */
279int vbox_irq_init(struct vbox_private *vbox);
280void vbox_irq_fini(struct vbox_private *vbox);
281void vbox_report_hotplug(struct vbox_private *vbox);
282irqreturn_t vbox_irq_handler(int irq, void *arg);
283
284/* vbox_hgsmi.c */
285void *hgsmi_buffer_alloc(struct gen_pool *guest_pool, size_t size,
286 u8 channel, u16 channel_info);
287void hgsmi_buffer_free(struct gen_pool *guest_pool, void *buf);
288int hgsmi_buffer_submit(struct gen_pool *guest_pool, void *buf);
289
290static inline void vbox_write_ioport(u16 index, u16 data)
291{
292 outw(index, VBE_DISPI_IOPORT_INDEX);
293 outw(data, VBE_DISPI_IOPORT_DATA);
294}
295
296#endif
diff --git a/drivers/staging/vboxvideo/vbox_err.h b/drivers/staging/vboxvideo/vbox_err.h
new file mode 100644
index 000000000000..562db8630eb0
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_err.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __VBOX_ERR_H__
24#define __VBOX_ERR_H__
25
26/**
27 * @name VirtualBox virtual-hardware error macros
28 * @{
29 */
30
31#define VINF_SUCCESS 0
32#define VERR_INVALID_PARAMETER (-2)
33#define VERR_INVALID_POINTER (-6)
34#define VERR_NO_MEMORY (-8)
35#define VERR_NOT_IMPLEMENTED (-12)
36#define VERR_INVALID_FUNCTION (-36)
37#define VERR_NOT_SUPPORTED (-37)
38#define VERR_TOO_MUCH_DATA (-42)
39#define VERR_INVALID_STATE (-79)
40#define VERR_OUT_OF_RESOURCES (-80)
41#define VERR_ALREADY_EXISTS (-105)
42#define VERR_INTERNAL_ERROR (-225)
43
44#define RT_SUCCESS_NP(rc) ((int)(rc) >= VINF_SUCCESS)
45#define RT_SUCCESS(rc) (likely(RT_SUCCESS_NP(rc)))
46#define RT_FAILURE(rc) (unlikely(!RT_SUCCESS_NP(rc)))
47
48/** @} */
49
50#endif
diff --git a/drivers/staging/vboxvideo/vbox_fb.c b/drivers/staging/vboxvideo/vbox_fb.c
new file mode 100644
index 000000000000..35f6d9f8c203
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_fb.c
@@ -0,0 +1,412 @@
1/*
2 * Copyright (C) 2013-2017 Oracle Corporation
3 * This file is based on ast_fb.c
4 * Copyright 2012 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 * Authors: Dave Airlie <airlied@redhat.com>
27 * Michael Thayer <michael.thayer@oracle.com,
28 */
29#include <linux/module.h>
30#include <linux/kernel.h>
31#include <linux/errno.h>
32#include <linux/string.h>
33#include <linux/mm.h>
34#include <linux/tty.h>
35#include <linux/sysrq.h>
36#include <linux/delay.h>
37#include <linux/fb.h>
38#include <linux/init.h>
39
40#include <drm/drmP.h>
41#include <drm/drm_crtc.h>
42#include <drm/drm_fb_helper.h>
43#include <drm/drm_crtc_helper.h>
44
45#include "vbox_drv.h"
46#include "vboxvideo.h"
47
48#define VBOX_DIRTY_DELAY (HZ / 30)
49/**
50 * Tell the host about dirty rectangles to update.
51 */
52static void vbox_dirty_update(struct vbox_fbdev *fbdev,
53 int x, int y, int width, int height)
54{
55 struct drm_gem_object *obj;
56 struct vbox_bo *bo;
57 int ret = -EBUSY;
58 bool store_for_later = false;
59 int x2, y2;
60 unsigned long flags;
61 struct drm_clip_rect rect;
62
63 obj = fbdev->afb.obj;
64 bo = gem_to_vbox_bo(obj);
65
66 /*
67 * try and reserve the BO, if we fail with busy
68 * then the BO is being moved and we should
69 * store up the damage until later.
70 */
71 if (drm_can_sleep())
72 ret = vbox_bo_reserve(bo, true);
73 if (ret) {
74 if (ret != -EBUSY)
75 return;
76
77 store_for_later = true;
78 }
79
80 x2 = x + width - 1;
81 y2 = y + height - 1;
82 spin_lock_irqsave(&fbdev->dirty_lock, flags);
83
84 if (fbdev->y1 < y)
85 y = fbdev->y1;
86 if (fbdev->y2 > y2)
87 y2 = fbdev->y2;
88 if (fbdev->x1 < x)
89 x = fbdev->x1;
90 if (fbdev->x2 > x2)
91 x2 = fbdev->x2;
92
93 if (store_for_later) {
94 fbdev->x1 = x;
95 fbdev->x2 = x2;
96 fbdev->y1 = y;
97 fbdev->y2 = y2;
98 spin_unlock_irqrestore(&fbdev->dirty_lock, flags);
99 return;
100 }
101
102 fbdev->x1 = INT_MAX;
103 fbdev->y1 = INT_MAX;
104 fbdev->x2 = 0;
105 fbdev->y2 = 0;
106
107 spin_unlock_irqrestore(&fbdev->dirty_lock, flags);
108
109 /*
110 * Not sure why the original code subtracted 1 here, but I will keep
111 * it that way to avoid unnecessary differences.
112 */
113 rect.x1 = x;
114 rect.x2 = x2 + 1;
115 rect.y1 = y;
116 rect.y2 = y2 + 1;
117 vbox_framebuffer_dirty_rectangles(&fbdev->afb.base, &rect, 1);
118
119 vbox_bo_unreserve(bo);
120}
121
122#ifdef CONFIG_FB_DEFERRED_IO
123static void vbox_deferred_io(struct fb_info *info, struct list_head *pagelist)
124{
125 struct vbox_fbdev *fbdev = info->par;
126 unsigned long start, end, min, max;
127 struct page *page;
128 int y1, y2;
129
130 min = ULONG_MAX;
131 max = 0;
132 list_for_each_entry(page, pagelist, lru) {
133 start = page->index << PAGE_SHIFT;
134 end = start + PAGE_SIZE - 1;
135 min = min(min, start);
136 max = max(max, end);
137 }
138
139 if (min < max) {
140 y1 = min / info->fix.line_length;
141 y2 = (max / info->fix.line_length) + 1;
142 DRM_INFO("%s: Calling dirty update: 0, %d, %d, %d\n",
143 __func__, y1, info->var.xres, y2 - y1 - 1);
144 vbox_dirty_update(fbdev, 0, y1, info->var.xres, y2 - y1 - 1);
145 }
146}
147
148static struct fb_deferred_io vbox_defio = {
149 .delay = VBOX_DIRTY_DELAY,
150 .deferred_io = vbox_deferred_io,
151};
152#endif
153
154static void vbox_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
155{
156 struct vbox_fbdev *fbdev = info->par;
157
158 sys_fillrect(info, rect);
159 vbox_dirty_update(fbdev, rect->dx, rect->dy, rect->width, rect->height);
160}
161
162static void vbox_copyarea(struct fb_info *info, const struct fb_copyarea *area)
163{
164 struct vbox_fbdev *fbdev = info->par;
165
166 sys_copyarea(info, area);
167 vbox_dirty_update(fbdev, area->dx, area->dy, area->width, area->height);
168}
169
170static void vbox_imageblit(struct fb_info *info, const struct fb_image *image)
171{
172 struct vbox_fbdev *fbdev = info->par;
173
174 sys_imageblit(info, image);
175 vbox_dirty_update(fbdev, image->dx, image->dy, image->width,
176 image->height);
177}
178
179static struct fb_ops vboxfb_ops = {
180 .owner = THIS_MODULE,
181 .fb_check_var = drm_fb_helper_check_var,
182 .fb_set_par = drm_fb_helper_set_par,
183 .fb_fillrect = vbox_fillrect,
184 .fb_copyarea = vbox_copyarea,
185 .fb_imageblit = vbox_imageblit,
186 .fb_pan_display = drm_fb_helper_pan_display,
187 .fb_blank = drm_fb_helper_blank,
188 .fb_setcmap = drm_fb_helper_setcmap,
189 .fb_debug_enter = drm_fb_helper_debug_enter,
190 .fb_debug_leave = drm_fb_helper_debug_leave,
191};
192
193static int vboxfb_create_object(struct vbox_fbdev *fbdev,
194 struct DRM_MODE_FB_CMD *mode_cmd,
195 struct drm_gem_object **gobj_p)
196{
197 struct drm_device *dev = fbdev->helper.dev;
198 u32 size;
199 struct drm_gem_object *gobj;
200 u32 pitch = mode_cmd->pitches[0];
201 int ret;
202
203 size = pitch * mode_cmd->height;
204 ret = vbox_gem_create(dev, size, true, &gobj);
205 if (ret)
206 return ret;
207
208 *gobj_p = gobj;
209
210 return 0;
211}
212
213static int vboxfb_create(struct drm_fb_helper *helper,
214 struct drm_fb_helper_surface_size *sizes)
215{
216 struct vbox_fbdev *fbdev =
217 container_of(helper, struct vbox_fbdev, helper);
218 struct drm_device *dev = fbdev->helper.dev;
219 struct DRM_MODE_FB_CMD mode_cmd;
220 struct drm_framebuffer *fb;
221 struct fb_info *info;
222 struct device *device = &dev->pdev->dev;
223 struct drm_gem_object *gobj;
224 struct vbox_bo *bo;
225 int size, ret;
226 u32 pitch;
227
228 mode_cmd.width = sizes->surface_width;
229 mode_cmd.height = sizes->surface_height;
230 pitch = mode_cmd.width * ((sizes->surface_bpp + 7) / 8);
231 mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
232 sizes->surface_depth);
233 mode_cmd.pitches[0] = pitch;
234
235 size = pitch * mode_cmd.height;
236
237 ret = vboxfb_create_object(fbdev, &mode_cmd, &gobj);
238 if (ret) {
239 DRM_ERROR("failed to create fbcon backing object %d\n", ret);
240 return ret;
241 }
242
243 ret = vbox_framebuffer_init(dev, &fbdev->afb, &mode_cmd, gobj);
244 if (ret)
245 return ret;
246
247 bo = gem_to_vbox_bo(gobj);
248
249 ret = vbox_bo_reserve(bo, false);
250 if (ret)
251 return ret;
252
253 ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, NULL);
254 if (ret) {
255 vbox_bo_unreserve(bo);
256 return ret;
257 }
258
259 ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap);
260 vbox_bo_unreserve(bo);
261 if (ret) {
262 DRM_ERROR("failed to kmap fbcon\n");
263 return ret;
264 }
265
266 info = framebuffer_alloc(0, device);
267 if (!info)
268 return -ENOMEM;
269 info->par = fbdev;
270
271 fbdev->size = size;
272
273 fb = &fbdev->afb.base;
274 fbdev->helper.fb = fb;
275 fbdev->helper.fbdev = info;
276
277 strcpy(info->fix.id, "vboxdrmfb");
278
279 /*
280 * The last flag forces a mode set on VT switches even if the kernel
281 * does not think it is needed.
282 */
283 info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT |
284 FBINFO_MISC_ALWAYS_SETPAR;
285 info->fbops = &vboxfb_ops;
286
287 ret = fb_alloc_cmap(&info->cmap, 256, 0);
288 if (ret)
289 return -ENOMEM;
290
291 /*
292 * This seems to be done for safety checking that the framebuffer
293 * is not registered twice by different drivers.
294 */
295 info->apertures = alloc_apertures(1);
296 if (!info->apertures)
297 return -ENOMEM;
298 info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
299 info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
300
301 drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
302 drm_fb_helper_fill_var(info, &fbdev->helper, sizes->fb_width,
303 sizes->fb_height);
304
305 info->screen_base = bo->kmap.virtual;
306 info->screen_size = size;
307
308#ifdef CONFIG_FB_DEFERRED_IO
309 info->fbdefio = &vbox_defio;
310 fb_deferred_io_init(info);
311#endif
312
313 info->pixmap.flags = FB_PIXMAP_SYSTEM;
314
315 DRM_DEBUG_KMS("allocated %dx%d\n", fb->width, fb->height);
316
317 return 0;
318}
319
320static void vbox_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
321 u16 blue, int regno)
322{
323}
324
325static void vbox_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
326 u16 *blue, int regno)
327{
328 *red = regno;
329 *green = regno;
330 *blue = regno;
331}
332
333static struct drm_fb_helper_funcs vbox_fb_helper_funcs = {
334 .gamma_set = vbox_fb_gamma_set,
335 .gamma_get = vbox_fb_gamma_get,
336 .fb_probe = vboxfb_create,
337};
338
339void vbox_fbdev_fini(struct drm_device *dev)
340{
341 struct vbox_private *vbox = dev->dev_private;
342 struct vbox_fbdev *fbdev = vbox->fbdev;
343 struct vbox_framebuffer *afb = &fbdev->afb;
344
345 drm_fb_helper_unregister_fbi(&fbdev->helper);
346
347 if (afb->obj) {
348 struct vbox_bo *bo = gem_to_vbox_bo(afb->obj);
349
350 if (!vbox_bo_reserve(bo, false)) {
351 if (bo->kmap.virtual)
352 ttm_bo_kunmap(&bo->kmap);
353 /*
354 * QXL does this, but is it really needed before
355 * freeing?
356 */
357 if (bo->pin_count)
358 vbox_bo_unpin(bo);
359 vbox_bo_unreserve(bo);
360 }
361 drm_gem_object_unreference_unlocked(afb->obj);
362 afb->obj = NULL;
363 }
364 drm_fb_helper_fini(&fbdev->helper);
365
366 drm_framebuffer_unregister_private(&afb->base);
367 drm_framebuffer_cleanup(&afb->base);
368}
369
370int vbox_fbdev_init(struct drm_device *dev)
371{
372 struct vbox_private *vbox = dev->dev_private;
373 struct vbox_fbdev *fbdev;
374 int ret;
375
376 fbdev = devm_kzalloc(dev->dev, sizeof(*fbdev), GFP_KERNEL);
377 if (!fbdev)
378 return -ENOMEM;
379
380 vbox->fbdev = fbdev;
381 spin_lock_init(&fbdev->dirty_lock);
382
383 drm_fb_helper_prepare(dev, &fbdev->helper, &vbox_fb_helper_funcs);
384 ret = drm_fb_helper_init(dev, &fbdev->helper, vbox->num_crtcs);
385 if (ret)
386 return ret;
387
388 ret = drm_fb_helper_single_add_all_connectors(&fbdev->helper);
389 if (ret)
390 goto err_fini;
391
392 /* disable all the possible outputs/crtcs before entering KMS mode */
393 drm_helper_disable_unused_functions(dev);
394
395 ret = drm_fb_helper_initial_config(&fbdev->helper, 32);
396 if (ret)
397 goto err_fini;
398
399 return 0;
400
401err_fini:
402 drm_fb_helper_fini(&fbdev->helper);
403 return ret;
404}
405
406void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr)
407{
408 struct fb_info *fbdev = vbox->fbdev->helper.fbdev;
409
410 fbdev->fix.smem_start = fbdev->apertures->ranges[0].base + gpu_addr;
411 fbdev->fix.smem_len = vbox->available_vram_size - gpu_addr;
412}
diff --git a/drivers/staging/vboxvideo/vbox_hgsmi.c b/drivers/staging/vboxvideo/vbox_hgsmi.c
new file mode 100644
index 000000000000..822fd31121cb
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_hgsmi.c
@@ -0,0 +1,115 @@
1/*
2 * Copyright (C) 2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
15 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18 * USE OR OTHER DEALINGS IN THE SOFTWARE.
19 *
20 * The above copyright notice and this permission notice (including the
21 * next paragraph) shall be included in all copies or substantial portions
22 * of the Software.
23 *
24 * Authors: Hans de Goede <hdegoede@redhat.com>
25 */
26
27#include "vbox_drv.h"
28#include "vboxvideo_vbe.h"
29#include "hgsmi_defs.h"
30
31/* One-at-a-Time Hash from http://www.burtleburtle.net/bob/hash/doobs.html */
32static u32 hgsmi_hash_process(u32 hash, const u8 *data, int size)
33{
34 while (size--) {
35 hash += *data++;
36 hash += (hash << 10);
37 hash ^= (hash >> 6);
38 }
39
40 return hash;
41}
42
43static u32 hgsmi_hash_end(u32 hash)
44{
45 hash += (hash << 3);
46 hash ^= (hash >> 11);
47 hash += (hash << 15);
48
49 return hash;
50}
51
52/* Not really a checksum but that is the naming used in all vbox code */
53static u32 hgsmi_checksum(u32 offset,
54 const struct hgsmi_buffer_header *header,
55 const struct hgsmi_buffer_tail *tail)
56{
57 u32 checksum;
58
59 checksum = hgsmi_hash_process(0, (u8 *)&offset, sizeof(offset));
60 checksum = hgsmi_hash_process(checksum, (u8 *)header, sizeof(*header));
61 /* 4 -> Do not checksum the checksum itself */
62 checksum = hgsmi_hash_process(checksum, (u8 *)tail, 4);
63
64 return hgsmi_hash_end(checksum);
65}
66
67void *hgsmi_buffer_alloc(struct gen_pool *guest_pool, size_t size,
68 u8 channel, u16 channel_info)
69{
70 struct hgsmi_buffer_header *h;
71 struct hgsmi_buffer_tail *t;
72 size_t total_size;
73 dma_addr_t offset;
74
75 total_size = size + sizeof(*h) + sizeof(*t);
76 h = gen_pool_dma_alloc(guest_pool, total_size, &offset);
77 if (!h)
78 return NULL;
79
80 t = (struct hgsmi_buffer_tail *)((u8 *)h + sizeof(*h) + size);
81
82 h->flags = HGSMI_BUFFER_HEADER_F_SEQ_SINGLE;
83 h->data_size = size;
84 h->channel = channel;
85 h->channel_info = channel_info;
86 memset(&h->u.header_data, 0, sizeof(h->u.header_data));
87
88 t->reserved = 0;
89 t->checksum = hgsmi_checksum(offset, h, t);
90
91 return (u8 *)h + sizeof(*h);
92}
93
94void hgsmi_buffer_free(struct gen_pool *guest_pool, void *buf)
95{
96 struct hgsmi_buffer_header *h =
97 (struct hgsmi_buffer_header *)((u8 *)buf - sizeof(*h));
98 size_t total_size = h->data_size + sizeof(*h) +
99 sizeof(struct hgsmi_buffer_tail);
100
101 gen_pool_free(guest_pool, (unsigned long)h, total_size);
102}
103
104int hgsmi_buffer_submit(struct gen_pool *guest_pool, void *buf)
105{
106 phys_addr_t offset;
107
108 offset = gen_pool_virt_to_phys(guest_pool, (unsigned long)buf -
109 sizeof(struct hgsmi_buffer_header));
110 outl(offset, VGA_PORT_HGSMI_GUEST);
111 /* Make the compiler aware that the host has changed memory. */
112 mb();
113
114 return 0;
115}
diff --git a/drivers/staging/vboxvideo/vbox_irq.c b/drivers/staging/vboxvideo/vbox_irq.c
new file mode 100644
index 000000000000..3ca8bec62ac4
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_irq.c
@@ -0,0 +1,197 @@
1/*
2 * Copyright (C) 2016-2017 Oracle Corporation
3 * This file is based on qxl_irq.c
4 * Copyright 2013 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Dave Airlie
25 * Alon Levy
26 * Michael Thayer <michael.thayer@oracle.com,
27 * Hans de Goede <hdegoede@redhat.com>
28 */
29
30#include <drm/drm_crtc_helper.h>
31
32#include "vbox_drv.h"
33#include "vboxvideo.h"
34
35static void vbox_clear_irq(void)
36{
37 outl((u32)~0, VGA_PORT_HGSMI_HOST);
38}
39
40static u32 vbox_get_flags(struct vbox_private *vbox)
41{
42 return readl(vbox->guest_heap + HOST_FLAGS_OFFSET);
43}
44
45void vbox_report_hotplug(struct vbox_private *vbox)
46{
47 schedule_work(&vbox->hotplug_work);
48}
49
50irqreturn_t vbox_irq_handler(int irq, void *arg)
51{
52 struct drm_device *dev = (struct drm_device *)arg;
53 struct vbox_private *vbox = (struct vbox_private *)dev->dev_private;
54 u32 host_flags = vbox_get_flags(vbox);
55
56 if (!(host_flags & HGSMIHOSTFLAGS_IRQ))
57 return IRQ_NONE;
58
59 /*
60 * Due to a bug in the initial host implementation of hot-plug irqs,
61 * the hot-plug and cursor capability flags were never cleared.
62 * Fortunately we can tell when they would have been set by checking
63 * that the VSYNC flag is not set.
64 */
65 if (host_flags &
66 (HGSMIHOSTFLAGS_HOTPLUG | HGSMIHOSTFLAGS_CURSOR_CAPABILITIES) &&
67 !(host_flags & HGSMIHOSTFLAGS_VSYNC))
68 vbox_report_hotplug(vbox);
69
70 vbox_clear_irq();
71
72 return IRQ_HANDLED;
73}
74
75/**
76 * Check that the position hints provided by the host are suitable for GNOME
77 * shell (i.e. all screens disjoint and hints for all enabled screens) and if
78 * not replace them with default ones. Providing valid hints improves the
79 * chances that we will get a known screen layout for pointer mapping.
80 */
81static void validate_or_set_position_hints(struct vbox_private *vbox)
82{
83 struct vbva_modehint *hintsi, *hintsj;
84 bool valid = true;
85 u16 currentx = 0;
86 int i, j;
87
88 for (i = 0; i < vbox->num_crtcs; ++i) {
89 for (j = 0; j < i; ++j) {
90 hintsi = &vbox->last_mode_hints[i];
91 hintsj = &vbox->last_mode_hints[j];
92
93 if (hintsi->enabled && hintsj->enabled) {
94 if (hintsi->dx >= 0xffff ||
95 hintsi->dy >= 0xffff ||
96 hintsj->dx >= 0xffff ||
97 hintsj->dy >= 0xffff ||
98 (hintsi->dx <
99 hintsj->dx + (hintsj->cx & 0x8fff) &&
100 hintsi->dx + (hintsi->cx & 0x8fff) >
101 hintsj->dx) ||
102 (hintsi->dy <
103 hintsj->dy + (hintsj->cy & 0x8fff) &&
104 hintsi->dy + (hintsi->cy & 0x8fff) >
105 hintsj->dy))
106 valid = false;
107 }
108 }
109 }
110 if (!valid)
111 for (i = 0; i < vbox->num_crtcs; ++i) {
112 if (vbox->last_mode_hints[i].enabled) {
113 vbox->last_mode_hints[i].dx = currentx;
114 vbox->last_mode_hints[i].dy = 0;
115 currentx +=
116 vbox->last_mode_hints[i].cx & 0x8fff;
117 }
118 }
119}
120
121/**
122 * Query the host for the most recent video mode hints.
123 */
124static void vbox_update_mode_hints(struct vbox_private *vbox)
125{
126 struct drm_device *dev = vbox->dev;
127 struct drm_connector *connector;
128 struct vbox_connector *vbox_conn;
129 struct vbva_modehint *hints;
130 u16 flags;
131 bool disconnected;
132 unsigned int crtc_id;
133 int ret;
134
135 ret = hgsmi_get_mode_hints(vbox->guest_pool, vbox->num_crtcs,
136 vbox->last_mode_hints);
137 if (ret) {
138 DRM_ERROR("vboxvideo: hgsmi_get_mode_hints failed: %d\n", ret);
139 return;
140 }
141
142 validate_or_set_position_hints(vbox);
143 drm_modeset_lock_all(dev);
144 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
145 vbox_conn = to_vbox_connector(connector);
146
147 hints = &vbox->last_mode_hints[vbox_conn->vbox_crtc->crtc_id];
148 if (hints->magic != VBVAMODEHINT_MAGIC)
149 continue;
150
151 disconnected = !(hints->enabled);
152 crtc_id = vbox_conn->vbox_crtc->crtc_id;
153 vbox_conn->mode_hint.width = hints->cx & 0x8fff;
154 vbox_conn->mode_hint.height = hints->cy & 0x8fff;
155 vbox_conn->vbox_crtc->x_hint = hints->dx;
156 vbox_conn->vbox_crtc->y_hint = hints->dy;
157 vbox_conn->mode_hint.disconnected = disconnected;
158
159 if (vbox_conn->vbox_crtc->disconnected == disconnected)
160 continue;
161
162 if (disconnected)
163 flags = VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_DISABLED;
164 else
165 flags = VBVA_SCREEN_F_ACTIVE | VBVA_SCREEN_F_BLANK;
166
167 hgsmi_process_display_info(vbox->guest_pool, crtc_id, 0, 0, 0,
168 hints->cx * 4, hints->cx,
169 hints->cy, 0, flags);
170
171 vbox_conn->vbox_crtc->disconnected = disconnected;
172 }
173 drm_modeset_unlock_all(dev);
174}
175
176static void vbox_hotplug_worker(struct work_struct *work)
177{
178 struct vbox_private *vbox = container_of(work, struct vbox_private,
179 hotplug_work);
180
181 vbox_update_mode_hints(vbox);
182 drm_kms_helper_hotplug_event(vbox->dev);
183}
184
185int vbox_irq_init(struct vbox_private *vbox)
186{
187 INIT_WORK(&vbox->hotplug_work, vbox_hotplug_worker);
188 vbox_update_mode_hints(vbox);
189
190 return drm_irq_install(vbox->dev, vbox->dev->pdev->irq);
191}
192
193void vbox_irq_fini(struct vbox_private *vbox)
194{
195 drm_irq_uninstall(vbox->dev);
196 flush_work(&vbox->hotplug_work);
197}
diff --git a/drivers/staging/vboxvideo/vbox_main.c b/drivers/staging/vboxvideo/vbox_main.c
new file mode 100644
index 000000000000..d0c6ec75a3c7
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -0,0 +1,534 @@
1/*
2 * Copyright (C) 2013-2017 Oracle Corporation
3 * This file is based on ast_main.c
4 * Copyright 2012 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 * Authors: Dave Airlie <airlied@redhat.com>,
27 * Michael Thayer <michael.thayer@oracle.com,
28 * Hans de Goede <hdegoede@redhat.com>
29 */
30#include <drm/drm_fb_helper.h>
31#include <drm/drm_crtc_helper.h>
32
33#include "vbox_drv.h"
34#include "vbox_err.h"
35#include "vboxvideo_guest.h"
36#include "vboxvideo_vbe.h"
37
38static void vbox_user_framebuffer_destroy(struct drm_framebuffer *fb)
39{
40 struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
41
42 if (vbox_fb->obj)
43 drm_gem_object_unreference_unlocked(vbox_fb->obj);
44
45 drm_framebuffer_cleanup(fb);
46 kfree(fb);
47}
48
49void vbox_enable_accel(struct vbox_private *vbox)
50{
51 unsigned int i;
52 struct vbva_buffer *vbva;
53
54 if (!vbox->vbva_info || !vbox->vbva_buffers) {
55 /* Should never happen... */
56 DRM_ERROR("vboxvideo: failed to set up VBVA.\n");
57 return;
58 }
59
60 for (i = 0; i < vbox->num_crtcs; ++i) {
61 if (vbox->vbva_info[i].vbva)
62 continue;
63
64 vbva = (void *)vbox->vbva_buffers + i * VBVA_MIN_BUFFER_SIZE;
65 if (!vbva_enable(&vbox->vbva_info[i],
66 vbox->guest_pool, vbva, i)) {
67 /* very old host or driver error. */
68 DRM_ERROR("vboxvideo: vbva_enable failed\n");
69 return;
70 }
71 }
72}
73
74void vbox_disable_accel(struct vbox_private *vbox)
75{
76 unsigned int i;
77
78 for (i = 0; i < vbox->num_crtcs; ++i)
79 vbva_disable(&vbox->vbva_info[i], vbox->guest_pool, i);
80}
81
82void vbox_report_caps(struct vbox_private *vbox)
83{
84 u32 caps = VBVACAPS_DISABLE_CURSOR_INTEGRATION |
85 VBVACAPS_IRQ | VBVACAPS_USE_VBVA_ONLY;
86
87 if (vbox->initial_mode_queried)
88 caps |= VBVACAPS_VIDEO_MODE_HINTS;
89
90 hgsmi_send_caps_info(vbox->guest_pool, caps);
91}
92
93/**
94 * Send information about dirty rectangles to VBVA. If necessary we enable
95 * VBVA first, as this is normally disabled after a change of master in case
96 * the new master does not send dirty rectangle information (is this even
97 * allowed?)
98 */
99void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
100 struct drm_clip_rect *rects,
101 unsigned int num_rects)
102{
103 struct vbox_private *vbox = fb->dev->dev_private;
104 struct drm_crtc *crtc;
105 unsigned int i;
106
107 mutex_lock(&vbox->hw_mutex);
108 list_for_each_entry(crtc, &fb->dev->mode_config.crtc_list, head) {
109 if (CRTC_FB(crtc) != fb)
110 continue;
111
112 vbox_enable_accel(vbox);
113
114 for (i = 0; i < num_rects; ++i) {
115 struct vbva_cmd_hdr cmd_hdr;
116 unsigned int crtc_id = to_vbox_crtc(crtc)->crtc_id;
117
118 if ((rects[i].x1 > crtc->x + crtc->hwmode.hdisplay) ||
119 (rects[i].y1 > crtc->y + crtc->hwmode.vdisplay) ||
120 (rects[i].x2 < crtc->x) ||
121 (rects[i].y2 < crtc->y))
122 continue;
123
124 cmd_hdr.x = (s16)rects[i].x1;
125 cmd_hdr.y = (s16)rects[i].y1;
126 cmd_hdr.w = (u16)rects[i].x2 - rects[i].x1;
127 cmd_hdr.h = (u16)rects[i].y2 - rects[i].y1;
128
129 if (!vbva_buffer_begin_update(&vbox->vbva_info[crtc_id],
130 vbox->guest_pool))
131 continue;
132
133 vbva_write(&vbox->vbva_info[crtc_id], vbox->guest_pool,
134 &cmd_hdr, sizeof(cmd_hdr));
135 vbva_buffer_end_update(&vbox->vbva_info[crtc_id]);
136 }
137 }
138 mutex_unlock(&vbox->hw_mutex);
139}
140
141static int vbox_user_framebuffer_dirty(struct drm_framebuffer *fb,
142 struct drm_file *file_priv,
143 unsigned int flags, unsigned int color,
144 struct drm_clip_rect *rects,
145 unsigned int num_rects)
146{
147 vbox_framebuffer_dirty_rectangles(fb, rects, num_rects);
148
149 return 0;
150}
151
152static const struct drm_framebuffer_funcs vbox_fb_funcs = {
153 .destroy = vbox_user_framebuffer_destroy,
154 .dirty = vbox_user_framebuffer_dirty,
155};
156
157int vbox_framebuffer_init(struct drm_device *dev,
158 struct vbox_framebuffer *vbox_fb,
159 const struct DRM_MODE_FB_CMD *mode_cmd,
160 struct drm_gem_object *obj)
161{
162 int ret;
163
164 drm_helper_mode_fill_fb_struct(dev, &vbox_fb->base, mode_cmd);
165 vbox_fb->obj = obj;
166 ret = drm_framebuffer_init(dev, &vbox_fb->base, &vbox_fb_funcs);
167 if (ret) {
168 DRM_ERROR("framebuffer init failed %d\n", ret);
169 return ret;
170 }
171
172 return 0;
173}
174
175static struct drm_framebuffer *vbox_user_framebuffer_create(
176 struct drm_device *dev,
177 struct drm_file *filp,
178 const struct drm_mode_fb_cmd2 *mode_cmd)
179{
180 struct drm_gem_object *obj;
181 struct vbox_framebuffer *vbox_fb;
182 int ret = -ENOMEM;
183
184 obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]);
185 if (!obj)
186 return ERR_PTR(-ENOENT);
187
188 vbox_fb = kzalloc(sizeof(*vbox_fb), GFP_KERNEL);
189 if (!vbox_fb)
190 goto err_unref_obj;
191
192 ret = vbox_framebuffer_init(dev, vbox_fb, mode_cmd, obj);
193 if (ret)
194 goto err_free_vbox_fb;
195
196 return &vbox_fb->base;
197
198err_free_vbox_fb:
199 kfree(vbox_fb);
200err_unref_obj:
201 drm_gem_object_unreference_unlocked(obj);
202 return ERR_PTR(ret);
203}
204
205static const struct drm_mode_config_funcs vbox_mode_funcs = {
206 .fb_create = vbox_user_framebuffer_create,
207};
208
209static int vbox_accel_init(struct vbox_private *vbox)
210{
211 unsigned int i;
212
213 vbox->vbva_info = devm_kcalloc(vbox->dev->dev, vbox->num_crtcs,
214 sizeof(*vbox->vbva_info), GFP_KERNEL);
215 if (!vbox->vbva_info)
216 return -ENOMEM;
217
218 /* Take a command buffer for each screen from the end of usable VRAM. */
219 vbox->available_vram_size -= vbox->num_crtcs * VBVA_MIN_BUFFER_SIZE;
220
221 vbox->vbva_buffers = pci_iomap_range(vbox->dev->pdev, 0,
222 vbox->available_vram_size,
223 vbox->num_crtcs *
224 VBVA_MIN_BUFFER_SIZE);
225 if (!vbox->vbva_buffers)
226 return -ENOMEM;
227
228 for (i = 0; i < vbox->num_crtcs; ++i)
229 vbva_setup_buffer_context(&vbox->vbva_info[i],
230 vbox->available_vram_size +
231 i * VBVA_MIN_BUFFER_SIZE,
232 VBVA_MIN_BUFFER_SIZE);
233
234 return 0;
235}
236
237static void vbox_accel_fini(struct vbox_private *vbox)
238{
239 vbox_disable_accel(vbox);
240 pci_iounmap(vbox->dev->pdev, vbox->vbva_buffers);
241}
242
243/** Do we support the 4.3 plus mode hint reporting interface? */
244static bool have_hgsmi_mode_hints(struct vbox_private *vbox)
245{
246 u32 have_hints, have_cursor;
247 int ret;
248
249 ret = hgsmi_query_conf(vbox->guest_pool,
250 VBOX_VBVA_CONF32_MODE_HINT_REPORTING,
251 &have_hints);
252 if (ret)
253 return false;
254
255 ret = hgsmi_query_conf(vbox->guest_pool,
256 VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING,
257 &have_cursor);
258 if (ret)
259 return false;
260
261 return have_hints == VINF_SUCCESS && have_cursor == VINF_SUCCESS;
262}
263
264static bool vbox_check_supported(u16 id)
265{
266 u16 dispi_id;
267
268 vbox_write_ioport(VBE_DISPI_INDEX_ID, id);
269 dispi_id = inw(VBE_DISPI_IOPORT_DATA);
270
271 return dispi_id == id;
272}
273
274/**
275 * Set up our heaps and data exchange buffers in VRAM before handing the rest
276 * to the memory manager.
277 */
278static int vbox_hw_init(struct vbox_private *vbox)
279{
280 int ret = -ENOMEM;
281
282 vbox->full_vram_size = inl(VBE_DISPI_IOPORT_DATA);
283 vbox->any_pitch = vbox_check_supported(VBE_DISPI_ID_ANYX);
284
285 DRM_INFO("VRAM %08x\n", vbox->full_vram_size);
286
287 /* Map guest-heap at end of vram */
288 vbox->guest_heap =
289 pci_iomap_range(vbox->dev->pdev, 0, GUEST_HEAP_OFFSET(vbox),
290 GUEST_HEAP_SIZE);
291 if (!vbox->guest_heap)
292 return -ENOMEM;
293
294 /* Create guest-heap mem-pool use 2^4 = 16 byte chunks */
295 vbox->guest_pool = gen_pool_create(4, -1);
296 if (!vbox->guest_pool)
297 goto err_unmap_guest_heap;
298
299 ret = gen_pool_add_virt(vbox->guest_pool,
300 (unsigned long)vbox->guest_heap,
301 GUEST_HEAP_OFFSET(vbox),
302 GUEST_HEAP_USABLE_SIZE, -1);
303 if (ret)
304 goto err_destroy_guest_pool;
305
306 ret = hgsmi_test_query_conf(vbox->guest_pool);
307 if (ret) {
308 DRM_ERROR("vboxvideo: hgsmi_test_query_conf failed\n");
309 goto err_destroy_guest_pool;
310 }
311
312 /* Reduce available VRAM size to reflect the guest heap. */
313 vbox->available_vram_size = GUEST_HEAP_OFFSET(vbox);
314 /* Linux drm represents monitors as a 32-bit array. */
315 hgsmi_query_conf(vbox->guest_pool, VBOX_VBVA_CONF32_MONITOR_COUNT,
316 &vbox->num_crtcs);
317 vbox->num_crtcs = clamp_t(u32, vbox->num_crtcs, 1, VBOX_MAX_SCREENS);
318
319 if (!have_hgsmi_mode_hints(vbox)) {
320 ret = -ENOTSUPP;
321 goto err_destroy_guest_pool;
322 }
323
324 vbox->last_mode_hints = devm_kcalloc(vbox->dev->dev, vbox->num_crtcs,
325 sizeof(struct vbva_modehint),
326 GFP_KERNEL);
327 if (!vbox->last_mode_hints) {
328 ret = -ENOMEM;
329 goto err_destroy_guest_pool;
330 }
331
332 ret = vbox_accel_init(vbox);
333 if (ret)
334 goto err_destroy_guest_pool;
335
336 return 0;
337
338err_destroy_guest_pool:
339 gen_pool_destroy(vbox->guest_pool);
340err_unmap_guest_heap:
341 pci_iounmap(vbox->dev->pdev, vbox->guest_heap);
342 return ret;
343}
344
345static void vbox_hw_fini(struct vbox_private *vbox)
346{
347 vbox_accel_fini(vbox);
348 gen_pool_destroy(vbox->guest_pool);
349 pci_iounmap(vbox->dev->pdev, vbox->guest_heap);
350}
351
352int vbox_driver_load(struct drm_device *dev, unsigned long flags)
353{
354 struct vbox_private *vbox;
355 int ret = 0;
356
357 if (!vbox_check_supported(VBE_DISPI_ID_HGSMI))
358 return -ENODEV;
359
360 vbox = devm_kzalloc(dev->dev, sizeof(*vbox), GFP_KERNEL);
361 if (!vbox)
362 return -ENOMEM;
363
364 dev->dev_private = vbox;
365 vbox->dev = dev;
366
367 mutex_init(&vbox->hw_mutex);
368
369 ret = vbox_hw_init(vbox);
370 if (ret)
371 return ret;
372
373 ret = vbox_mm_init(vbox);
374 if (ret)
375 goto err_hw_fini;
376
377 drm_mode_config_init(dev);
378
379 dev->mode_config.funcs = (void *)&vbox_mode_funcs;
380 dev->mode_config.min_width = 64;
381 dev->mode_config.min_height = 64;
382 dev->mode_config.preferred_depth = 24;
383 dev->mode_config.max_width = VBE_DISPI_MAX_XRES;
384 dev->mode_config.max_height = VBE_DISPI_MAX_YRES;
385
386 ret = vbox_mode_init(dev);
387 if (ret)
388 goto err_drm_mode_cleanup;
389
390 ret = vbox_irq_init(vbox);
391 if (ret)
392 goto err_mode_fini;
393
394 ret = vbox_fbdev_init(dev);
395 if (ret)
396 goto err_irq_fini;
397
398 return 0;
399
400err_irq_fini:
401 vbox_irq_fini(vbox);
402err_mode_fini:
403 vbox_mode_fini(dev);
404err_drm_mode_cleanup:
405 drm_mode_config_cleanup(dev);
406 vbox_mm_fini(vbox);
407err_hw_fini:
408 vbox_hw_fini(vbox);
409 return ret;
410}
411
412void vbox_driver_unload(struct drm_device *dev)
413{
414 struct vbox_private *vbox = dev->dev_private;
415
416 vbox_fbdev_fini(dev);
417 vbox_irq_fini(vbox);
418 vbox_mode_fini(dev);
419 drm_mode_config_cleanup(dev);
420 vbox_mm_fini(vbox);
421 vbox_hw_fini(vbox);
422}
423
424/**
425 * @note this is described in the DRM framework documentation. AST does not
426 * have it, but we get an oops on driver unload if it is not present.
427 */
428void vbox_driver_lastclose(struct drm_device *dev)
429{
430 struct vbox_private *vbox = dev->dev_private;
431
432 if (vbox->fbdev)
433 drm_fb_helper_restore_fbdev_mode_unlocked(&vbox->fbdev->helper);
434}
435
436int vbox_gem_create(struct drm_device *dev,
437 u32 size, bool iskernel, struct drm_gem_object **obj)
438{
439 struct vbox_bo *vboxbo;
440 int ret;
441
442 *obj = NULL;
443
444 size = roundup(size, PAGE_SIZE);
445 if (size == 0)
446 return -EINVAL;
447
448 ret = vbox_bo_create(dev, size, 0, 0, &vboxbo);
449 if (ret) {
450 if (ret != -ERESTARTSYS)
451 DRM_ERROR("failed to allocate GEM object\n");
452 return ret;
453 }
454
455 *obj = &vboxbo->gem;
456
457 return 0;
458}
459
460int vbox_dumb_create(struct drm_file *file,
461 struct drm_device *dev, struct drm_mode_create_dumb *args)
462{
463 int ret;
464 struct drm_gem_object *gobj;
465 u32 handle;
466
467 args->pitch = args->width * ((args->bpp + 7) / 8);
468 args->size = args->pitch * args->height;
469
470 ret = vbox_gem_create(dev, args->size, false, &gobj);
471 if (ret)
472 return ret;
473
474 ret = drm_gem_handle_create(file, gobj, &handle);
475 drm_gem_object_unreference_unlocked(gobj);
476 if (ret)
477 return ret;
478
479 args->handle = handle;
480
481 return 0;
482}
483
484static void vbox_bo_unref(struct vbox_bo **bo)
485{
486 struct ttm_buffer_object *tbo;
487
488 if ((*bo) == NULL)
489 return;
490
491 tbo = &((*bo)->bo);
492 ttm_bo_unref(&tbo);
493 if (!tbo)
494 *bo = NULL;
495}
496
497void vbox_gem_free_object(struct drm_gem_object *obj)
498{
499 struct vbox_bo *vbox_bo = gem_to_vbox_bo(obj);
500
501 vbox_bo_unref(&vbox_bo);
502}
503
504static inline u64 vbox_bo_mmap_offset(struct vbox_bo *bo)
505{
506 return drm_vma_node_offset_addr(&bo->bo.vma_node);
507}
508
509int
510vbox_dumb_mmap_offset(struct drm_file *file,
511 struct drm_device *dev,
512 u32 handle, u64 *offset)
513{
514 struct drm_gem_object *obj;
515 int ret;
516 struct vbox_bo *bo;
517
518 mutex_lock(&dev->struct_mutex);
519 obj = drm_gem_object_lookup(file, handle);
520 if (!obj) {
521 ret = -ENOENT;
522 goto out_unlock;
523 }
524
525 bo = gem_to_vbox_bo(obj);
526 *offset = vbox_bo_mmap_offset(bo);
527
528 drm_gem_object_unreference(obj);
529 ret = 0;
530
531out_unlock:
532 mutex_unlock(&dev->struct_mutex);
533 return ret;
534}
diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c
new file mode 100644
index 000000000000..f2b85f3256fa
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -0,0 +1,877 @@
1/*
2 * Copyright (C) 2013-2017 Oracle Corporation
3 * This file is based on ast_mode.c
4 * Copyright 2012 Red Hat Inc.
5 * Parts based on xf86-video-ast
6 * Copyright (c) 2005 ASPEED Technology Inc.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * The above copyright notice and this permission notice (including the
25 * next paragraph) shall be included in all copies or substantial portions
26 * of the Software.
27 *
28 */
29/*
30 * Authors: Dave Airlie <airlied@redhat.com>
31 * Michael Thayer <michael.thayer@oracle.com,
32 * Hans de Goede <hdegoede@redhat.com>
33 */
34#include <linux/export.h>
35#include <drm/drm_crtc_helper.h>
36#include <drm/drm_plane_helper.h>
37
38#include "vbox_drv.h"
39#include "vboxvideo.h"
40#include "hgsmi_channels.h"
41
42static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
43 u32 handle, u32 width, u32 height,
44 s32 hot_x, s32 hot_y);
45static int vbox_cursor_move(struct drm_crtc *crtc, int x, int y);
46
47/**
48 * Set a graphics mode. Poke any required values into registers, do an HGSMI
49 * mode set and tell the host we support advanced graphics functions.
50 */
51static void vbox_do_modeset(struct drm_crtc *crtc,
52 const struct drm_display_mode *mode)
53{
54 struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
55 struct vbox_private *vbox;
56 int width, height, bpp, pitch;
57 unsigned int crtc_id;
58 u16 flags;
59 s32 x_offset, y_offset;
60
61 vbox = crtc->dev->dev_private;
62 width = mode->hdisplay ? mode->hdisplay : 640;
63 height = mode->vdisplay ? mode->vdisplay : 480;
64 crtc_id = vbox_crtc->crtc_id;
65 bpp = crtc->enabled ? CRTC_FB(crtc)->format->cpp[0] * 8 : 32;
66 pitch = crtc->enabled ? CRTC_FB(crtc)->pitches[0] : width * bpp / 8;
67 x_offset = vbox->single_framebuffer ? crtc->x : vbox_crtc->x_hint;
68 y_offset = vbox->single_framebuffer ? crtc->y : vbox_crtc->y_hint;
69
70 /*
71 * This is the old way of setting graphics modes. It assumed one screen
72 * and a frame-buffer at the start of video RAM. On older versions of
73 * VirtualBox, certain parts of the code still assume that the first
74 * screen is programmed this way, so try to fake it.
75 */
76 if (vbox_crtc->crtc_id == 0 && crtc->enabled &&
77 vbox_crtc->fb_offset / pitch < 0xffff - crtc->y &&
78 vbox_crtc->fb_offset % (bpp / 8) == 0) {
79 vbox_write_ioport(VBE_DISPI_INDEX_XRES, width);
80 vbox_write_ioport(VBE_DISPI_INDEX_YRES, height);
81 vbox_write_ioport(VBE_DISPI_INDEX_VIRT_WIDTH, pitch * 8 / bpp);
82 vbox_write_ioport(VBE_DISPI_INDEX_BPP,
83 CRTC_FB(crtc)->format->cpp[0] * 8);
84 vbox_write_ioport(VBE_DISPI_INDEX_ENABLE, VBE_DISPI_ENABLED);
85 vbox_write_ioport(
86 VBE_DISPI_INDEX_X_OFFSET,
87 vbox_crtc->fb_offset % pitch / bpp * 8 + crtc->x);
88 vbox_write_ioport(VBE_DISPI_INDEX_Y_OFFSET,
89 vbox_crtc->fb_offset / pitch + crtc->y);
90 }
91
92 flags = VBVA_SCREEN_F_ACTIVE;
93 flags |= (crtc->enabled && !vbox_crtc->blanked) ?
94 0 : VBVA_SCREEN_F_BLANK;
95 flags |= vbox_crtc->disconnected ? VBVA_SCREEN_F_DISABLED : 0;
96 hgsmi_process_display_info(vbox->guest_pool, vbox_crtc->crtc_id,
97 x_offset, y_offset,
98 crtc->x * bpp / 8 + crtc->y * pitch,
99 pitch, width, height,
100 vbox_crtc->blanked ? 0 : bpp, flags);
101}
102
103static int vbox_set_view(struct drm_crtc *crtc)
104{
105 struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
106 struct vbox_private *vbox = crtc->dev->dev_private;
107 struct vbva_infoview *p;
108
109 /*
110 * Tell the host about the view. This design originally targeted the
111 * Windows XP driver architecture and assumed that each screen would
112 * have a dedicated frame buffer with the command buffer following it,
113 * the whole being a "view". The host works out which screen a command
114 * buffer belongs to by checking whether it is in the first view, then
115 * whether it is in the second and so on. The first match wins. We
116 * cheat around this by making the first view be the managed memory
117 * plus the first command buffer, the second the same plus the second
118 * buffer and so on.
119 */
120 p = hgsmi_buffer_alloc(vbox->guest_pool, sizeof(*p),
121 HGSMI_CH_VBVA, VBVA_INFO_VIEW);
122 if (!p)
123 return -ENOMEM;
124
125 p->view_index = vbox_crtc->crtc_id;
126 p->view_offset = vbox_crtc->fb_offset;
127 p->view_size = vbox->available_vram_size - vbox_crtc->fb_offset +
128 vbox_crtc->crtc_id * VBVA_MIN_BUFFER_SIZE;
129 p->max_screen_size = vbox->available_vram_size - vbox_crtc->fb_offset;
130
131 hgsmi_buffer_submit(vbox->guest_pool, p);
132 hgsmi_buffer_free(vbox->guest_pool, p);
133
134 return 0;
135}
136
137static void vbox_crtc_load_lut(struct drm_crtc *crtc)
138{
139}
140
141static void vbox_crtc_dpms(struct drm_crtc *crtc, int mode)
142{
143 struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
144 struct vbox_private *vbox = crtc->dev->dev_private;
145
146 switch (mode) {
147 case DRM_MODE_DPMS_ON:
148 vbox_crtc->blanked = false;
149 break;
150 case DRM_MODE_DPMS_STANDBY:
151 case DRM_MODE_DPMS_SUSPEND:
152 case DRM_MODE_DPMS_OFF:
153 vbox_crtc->blanked = true;
154 break;
155 }
156
157 mutex_lock(&vbox->hw_mutex);
158 vbox_do_modeset(crtc, &crtc->hwmode);
159 mutex_unlock(&vbox->hw_mutex);
160}
161
162static bool vbox_crtc_mode_fixup(struct drm_crtc *crtc,
163 const struct drm_display_mode *mode,
164 struct drm_display_mode *adjusted_mode)
165{
166 return true;
167}
168
169/*
170 * Try to map the layout of virtual screens to the range of the input device.
171 * Return true if we need to re-set the crtc modes due to screen offset
172 * changes.
173 */
174static bool vbox_set_up_input_mapping(struct vbox_private *vbox)
175{
176 struct drm_crtc *crtci;
177 struct drm_connector *connectori;
178 struct drm_framebuffer *fb1 = NULL;
179 bool single_framebuffer = true;
180 bool old_single_framebuffer = vbox->single_framebuffer;
181 u16 width = 0, height = 0;
182
183 /*
184 * Are we using an X.Org-style single large frame-buffer for all crtcs?
185 * If so then screen layout can be deduced from the crtc offsets.
186 * Same fall-back if this is the fbdev frame-buffer.
187 */
188 list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list, head) {
189 if (!fb1) {
190 fb1 = CRTC_FB(crtci);
191 if (to_vbox_framebuffer(fb1) == &vbox->fbdev->afb)
192 break;
193 } else if (CRTC_FB(crtci) && fb1 != CRTC_FB(crtci)) {
194 single_framebuffer = false;
195 }
196 }
197 if (single_framebuffer) {
198 list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
199 head) {
200 if (to_vbox_crtc(crtci)->crtc_id != 0)
201 continue;
202
203 vbox->single_framebuffer = true;
204 vbox->input_mapping_width = CRTC_FB(crtci)->width;
205 vbox->input_mapping_height = CRTC_FB(crtci)->height;
206 return old_single_framebuffer !=
207 vbox->single_framebuffer;
208 }
209 }
210 /* Otherwise calculate the total span of all screens. */
211 list_for_each_entry(connectori, &vbox->dev->mode_config.connector_list,
212 head) {
213 struct vbox_connector *vbox_connector =
214 to_vbox_connector(connectori);
215 struct vbox_crtc *vbox_crtc = vbox_connector->vbox_crtc;
216
217 width = max_t(u16, width, vbox_crtc->x_hint +
218 vbox_connector->mode_hint.width);
219 height = max_t(u16, height, vbox_crtc->y_hint +
220 vbox_connector->mode_hint.height);
221 }
222
223 vbox->single_framebuffer = false;
224 vbox->input_mapping_width = width;
225 vbox->input_mapping_height = height;
226
227 return old_single_framebuffer != vbox->single_framebuffer;
228}
229
230static int vbox_crtc_do_set_base(struct drm_crtc *crtc,
231 struct drm_framebuffer *old_fb, int x, int y)
232{
233 struct vbox_private *vbox = crtc->dev->dev_private;
234 struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
235 struct drm_gem_object *obj;
236 struct vbox_framebuffer *vbox_fb;
237 struct vbox_bo *bo;
238 int ret;
239 u64 gpu_addr;
240
241 /* Unpin the previous fb. */
242 if (old_fb) {
243 vbox_fb = to_vbox_framebuffer(old_fb);
244 obj = vbox_fb->obj;
245 bo = gem_to_vbox_bo(obj);
246 ret = vbox_bo_reserve(bo, false);
247 if (ret)
248 return ret;
249
250 vbox_bo_unpin(bo);
251 vbox_bo_unreserve(bo);
252 }
253
254 vbox_fb = to_vbox_framebuffer(CRTC_FB(crtc));
255 obj = vbox_fb->obj;
256 bo = gem_to_vbox_bo(obj);
257
258 ret = vbox_bo_reserve(bo, false);
259 if (ret)
260 return ret;
261
262 ret = vbox_bo_pin(bo, TTM_PL_FLAG_VRAM, &gpu_addr);
263 if (ret) {
264 vbox_bo_unreserve(bo);
265 return ret;
266 }
267
268 if (&vbox->fbdev->afb == vbox_fb)
269 vbox_fbdev_set_base(vbox, gpu_addr);
270 vbox_bo_unreserve(bo);
271
272 /* vbox_set_start_address_crt1(crtc, (u32)gpu_addr); */
273 vbox_crtc->fb_offset = gpu_addr;
274 if (vbox_set_up_input_mapping(vbox)) {
275 struct drm_crtc *crtci;
276
277 list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
278 head) {
279 vbox_set_view(crtc);
280 vbox_do_modeset(crtci, &crtci->mode);
281 }
282 }
283
284 return 0;
285}
286
287static int vbox_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
288 struct drm_framebuffer *old_fb)
289{
290 return vbox_crtc_do_set_base(crtc, old_fb, x, y);
291}
292
293static int vbox_crtc_mode_set(struct drm_crtc *crtc,
294 struct drm_display_mode *mode,
295 struct drm_display_mode *adjusted_mode,
296 int x, int y, struct drm_framebuffer *old_fb)
297{
298 struct vbox_private *vbox = crtc->dev->dev_private;
299 int ret;
300
301 vbox_crtc_mode_set_base(crtc, x, y, old_fb);
302
303 mutex_lock(&vbox->hw_mutex);
304 ret = vbox_set_view(crtc);
305 if (!ret)
306 vbox_do_modeset(crtc, mode);
307 hgsmi_update_input_mapping(vbox->guest_pool, 0, 0,
308 vbox->input_mapping_width,
309 vbox->input_mapping_height);
310 mutex_unlock(&vbox->hw_mutex);
311
312 return ret;
313}
314
315static void vbox_crtc_disable(struct drm_crtc *crtc)
316{
317}
318
319static void vbox_crtc_prepare(struct drm_crtc *crtc)
320{
321}
322
323static void vbox_crtc_commit(struct drm_crtc *crtc)
324{
325}
326
327static const struct drm_crtc_helper_funcs vbox_crtc_helper_funcs = {
328 .dpms = vbox_crtc_dpms,
329 .mode_fixup = vbox_crtc_mode_fixup,
330 .mode_set = vbox_crtc_mode_set,
331 /* .mode_set_base = vbox_crtc_mode_set_base, */
332 .disable = vbox_crtc_disable,
333 .load_lut = vbox_crtc_load_lut,
334 .prepare = vbox_crtc_prepare,
335 .commit = vbox_crtc_commit,
336};
337
338static void vbox_crtc_reset(struct drm_crtc *crtc)
339{
340}
341
342static void vbox_crtc_destroy(struct drm_crtc *crtc)
343{
344 drm_crtc_cleanup(crtc);
345 kfree(crtc);
346}
347
348static const struct drm_crtc_funcs vbox_crtc_funcs = {
349 .cursor_move = vbox_cursor_move,
350 .cursor_set2 = vbox_cursor_set2,
351 .reset = vbox_crtc_reset,
352 .set_config = drm_crtc_helper_set_config,
353 /* .gamma_set = vbox_crtc_gamma_set, */
354 .destroy = vbox_crtc_destroy,
355};
356
357static struct vbox_crtc *vbox_crtc_init(struct drm_device *dev, unsigned int i)
358{
359 struct vbox_crtc *vbox_crtc;
360
361 vbox_crtc = kzalloc(sizeof(*vbox_crtc), GFP_KERNEL);
362 if (!vbox_crtc)
363 return NULL;
364
365 vbox_crtc->crtc_id = i;
366
367 drm_crtc_init(dev, &vbox_crtc->base, &vbox_crtc_funcs);
368 drm_mode_crtc_set_gamma_size(&vbox_crtc->base, 256);
369 drm_crtc_helper_add(&vbox_crtc->base, &vbox_crtc_helper_funcs);
370
371 return vbox_crtc;
372}
373
374static void vbox_encoder_destroy(struct drm_encoder *encoder)
375{
376 drm_encoder_cleanup(encoder);
377 kfree(encoder);
378}
379
380static struct drm_encoder *vbox_best_single_encoder(struct drm_connector
381 *connector)
382{
383 int enc_id = connector->encoder_ids[0];
384
385 /* pick the encoder ids */
386 if (enc_id)
387 return drm_encoder_find(connector->dev, enc_id);
388
389 return NULL;
390}
391
392static const struct drm_encoder_funcs vbox_enc_funcs = {
393 .destroy = vbox_encoder_destroy,
394};
395
396static void vbox_encoder_dpms(struct drm_encoder *encoder, int mode)
397{
398}
399
400static bool vbox_mode_fixup(struct drm_encoder *encoder,
401 const struct drm_display_mode *mode,
402 struct drm_display_mode *adjusted_mode)
403{
404 return true;
405}
406
407static void vbox_encoder_mode_set(struct drm_encoder *encoder,
408 struct drm_display_mode *mode,
409 struct drm_display_mode *adjusted_mode)
410{
411}
412
413static void vbox_encoder_prepare(struct drm_encoder *encoder)
414{
415}
416
417static void vbox_encoder_commit(struct drm_encoder *encoder)
418{
419}
420
421static const struct drm_encoder_helper_funcs vbox_enc_helper_funcs = {
422 .dpms = vbox_encoder_dpms,
423 .mode_fixup = vbox_mode_fixup,
424 .prepare = vbox_encoder_prepare,
425 .commit = vbox_encoder_commit,
426 .mode_set = vbox_encoder_mode_set,
427};
428
429static struct drm_encoder *vbox_encoder_init(struct drm_device *dev,
430 unsigned int i)
431{
432 struct vbox_encoder *vbox_encoder;
433
434 vbox_encoder = kzalloc(sizeof(*vbox_encoder), GFP_KERNEL);
435 if (!vbox_encoder)
436 return NULL;
437
438 drm_encoder_init(dev, &vbox_encoder->base, &vbox_enc_funcs,
439 DRM_MODE_ENCODER_DAC, NULL);
440 drm_encoder_helper_add(&vbox_encoder->base, &vbox_enc_helper_funcs);
441
442 vbox_encoder->base.possible_crtcs = 1 << i;
443 return &vbox_encoder->base;
444}
445
446/**
447 * Generate EDID data with a mode-unique serial number for the virtual
448 * monitor to try to persuade Unity that different modes correspond to
449 * different monitors and it should not try to force the same resolution on
450 * them.
451 */
452static void vbox_set_edid(struct drm_connector *connector, int width,
453 int height)
454{
455 enum { EDID_SIZE = 128 };
456 unsigned char edid[EDID_SIZE] = {
457 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* header */
458 0x58, 0x58, /* manufacturer (VBX) */
459 0x00, 0x00, /* product code */
460 0x00, 0x00, 0x00, 0x00, /* serial number goes here */
461 0x01, /* week of manufacture */
462 0x00, /* year of manufacture */
463 0x01, 0x03, /* EDID version */
464 0x80, /* capabilities - digital */
465 0x00, /* horiz. res in cm, zero for projectors */
466 0x00, /* vert. res in cm */
467 0x78, /* display gamma (120 == 2.2). */
468 0xEE, /* features (standby, suspend, off, RGB, std */
469 /* colour space, preferred timing mode) */
470 0xEE, 0x91, 0xA3, 0x54, 0x4C, 0x99, 0x26, 0x0F, 0x50, 0x54,
471 /* chromaticity for standard colour space. */
472 0x00, 0x00, 0x00, /* no default timings */
473 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
474 0x01, 0x01,
475 0x01, 0x01, 0x01, 0x01, /* no standard timings */
476 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x06, 0x00, 0x02, 0x02,
477 0x02, 0x02,
478 /* descriptor block 1 goes below */
479 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480 /* descriptor block 2, monitor ranges */
481 0x00, 0x00, 0x00, 0xFD, 0x00,
482 0x00, 0xC8, 0x00, 0xC8, 0x64, 0x00, 0x0A, 0x20, 0x20, 0x20,
483 0x20, 0x20,
484 /* 0-200Hz vertical, 0-200KHz horizontal, 1000MHz pixel clock */
485 0x20,
486 /* descriptor block 3, monitor name */
487 0x00, 0x00, 0x00, 0xFC, 0x00,
488 'V', 'B', 'O', 'X', ' ', 'm', 'o', 'n', 'i', 't', 'o', 'r',
489 '\n',
490 /* descriptor block 4: dummy data */
491 0x00, 0x00, 0x00, 0x10, 0x00,
492 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20,
493 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
494 0x20,
495 0x00, /* number of extensions */
496 0x00 /* checksum goes here */
497 };
498 int clock = (width + 6) * (height + 6) * 60 / 10000;
499 unsigned int i, sum = 0;
500
501 edid[12] = width & 0xff;
502 edid[13] = width >> 8;
503 edid[14] = height & 0xff;
504 edid[15] = height >> 8;
505 edid[54] = clock & 0xff;
506 edid[55] = clock >> 8;
507 edid[56] = width & 0xff;
508 edid[58] = (width >> 4) & 0xf0;
509 edid[59] = height & 0xff;
510 edid[61] = (height >> 4) & 0xf0;
511 for (i = 0; i < EDID_SIZE - 1; ++i)
512 sum += edid[i];
513 edid[EDID_SIZE - 1] = (0x100 - (sum & 0xFF)) & 0xFF;
514 drm_mode_connector_update_edid_property(connector, (struct edid *)edid);
515}
516
517static int vbox_get_modes(struct drm_connector *connector)
518{
519 struct vbox_connector *vbox_connector = NULL;
520 struct drm_display_mode *mode = NULL;
521 struct vbox_private *vbox = NULL;
522 unsigned int num_modes = 0;
523 int preferred_width, preferred_height;
524
525 vbox_connector = to_vbox_connector(connector);
526 vbox = connector->dev->dev_private;
527 /*
528 * Heuristic: we do not want to tell the host that we support dynamic
529 * resizing unless we feel confident that the user space client using
530 * the video driver can handle hot-plug events. So the first time modes
531 * are queried after a "master" switch we tell the host that we do not,
532 * and immediately after we send the client a hot-plug notification as
533 * a test to see if they will respond and query again.
534 * That is also the reason why capabilities are reported to the host at
535 * this place in the code rather than elsewhere.
536 * We need to report the flags location before reporting the IRQ
537 * capability.
538 */
539 hgsmi_report_flags_location(vbox->guest_pool, GUEST_HEAP_OFFSET(vbox) +
540 HOST_FLAGS_OFFSET);
541 if (vbox_connector->vbox_crtc->crtc_id == 0)
542 vbox_report_caps(vbox);
543 if (!vbox->initial_mode_queried) {
544 if (vbox_connector->vbox_crtc->crtc_id == 0) {
545 vbox->initial_mode_queried = true;
546 vbox_report_hotplug(vbox);
547 }
548 return drm_add_modes_noedid(connector, 800, 600);
549 }
550 num_modes = drm_add_modes_noedid(connector, 2560, 1600);
551 preferred_width = vbox_connector->mode_hint.width ?
552 vbox_connector->mode_hint.width : 1024;
553 preferred_height = vbox_connector->mode_hint.height ?
554 vbox_connector->mode_hint.height : 768;
555 mode = drm_cvt_mode(connector->dev, preferred_width, preferred_height,
556 60, false, false, false);
557 if (mode) {
558 mode->type |= DRM_MODE_TYPE_PREFERRED;
559 drm_mode_probed_add(connector, mode);
560 ++num_modes;
561 }
562 vbox_set_edid(connector, preferred_width, preferred_height);
563 drm_object_property_set_value(
564 &connector->base, vbox->dev->mode_config.suggested_x_property,
565 vbox_connector->vbox_crtc->x_hint);
566 drm_object_property_set_value(
567 &connector->base, vbox->dev->mode_config.suggested_y_property,
568 vbox_connector->vbox_crtc->y_hint);
569
570 return num_modes;
571}
572
573static int vbox_mode_valid(struct drm_connector *connector,
574 struct drm_display_mode *mode)
575{
576 return MODE_OK;
577}
578
579static void vbox_connector_destroy(struct drm_connector *connector)
580{
581 struct vbox_connector *vbox_connector;
582
583 vbox_connector = to_vbox_connector(connector);
584 drm_connector_unregister(connector);
585 drm_connector_cleanup(connector);
586 kfree(connector);
587}
588
589static enum drm_connector_status
590vbox_connector_detect(struct drm_connector *connector, bool force)
591{
592 struct vbox_connector *vbox_connector;
593
594 vbox_connector = to_vbox_connector(connector);
595
596 return vbox_connector->mode_hint.disconnected ?
597 connector_status_disconnected : connector_status_connected;
598}
599
600static int vbox_fill_modes(struct drm_connector *connector, u32 max_x,
601 u32 max_y)
602{
603 struct vbox_connector *vbox_connector;
604 struct drm_device *dev;
605 struct drm_display_mode *mode, *iterator;
606
607 vbox_connector = to_vbox_connector(connector);
608 dev = vbox_connector->base.dev;
609 list_for_each_entry_safe(mode, iterator, &connector->modes, head) {
610 list_del(&mode->head);
611 drm_mode_destroy(dev, mode);
612 }
613
614 return drm_helper_probe_single_connector_modes(connector, max_x, max_y);
615}
616
617static const struct drm_connector_helper_funcs vbox_connector_helper_funcs = {
618 .mode_valid = vbox_mode_valid,
619 .get_modes = vbox_get_modes,
620 .best_encoder = vbox_best_single_encoder,
621};
622
623static const struct drm_connector_funcs vbox_connector_funcs = {
624 .dpms = drm_helper_connector_dpms,
625 .detect = vbox_connector_detect,
626 .fill_modes = vbox_fill_modes,
627 .destroy = vbox_connector_destroy,
628};
629
630static int vbox_connector_init(struct drm_device *dev,
631 struct vbox_crtc *vbox_crtc,
632 struct drm_encoder *encoder)
633{
634 struct vbox_connector *vbox_connector;
635 struct drm_connector *connector;
636
637 vbox_connector = kzalloc(sizeof(*vbox_connector), GFP_KERNEL);
638 if (!vbox_connector)
639 return -ENOMEM;
640
641 connector = &vbox_connector->base;
642 vbox_connector->vbox_crtc = vbox_crtc;
643
644 drm_connector_init(dev, connector, &vbox_connector_funcs,
645 DRM_MODE_CONNECTOR_VGA);
646 drm_connector_helper_add(connector, &vbox_connector_helper_funcs);
647
648 connector->interlace_allowed = 0;
649 connector->doublescan_allowed = 0;
650
651 drm_mode_create_suggested_offset_properties(dev);
652 drm_object_attach_property(&connector->base,
653 dev->mode_config.suggested_x_property, -1);
654 drm_object_attach_property(&connector->base,
655 dev->mode_config.suggested_y_property, -1);
656 drm_connector_register(connector);
657
658 drm_mode_connector_attach_encoder(connector, encoder);
659
660 return 0;
661}
662
663int vbox_mode_init(struct drm_device *dev)
664{
665 struct vbox_private *vbox = dev->dev_private;
666 struct drm_encoder *encoder;
667 struct vbox_crtc *vbox_crtc;
668 unsigned int i;
669 int ret;
670
671 /* vbox_cursor_init(dev); */
672 for (i = 0; i < vbox->num_crtcs; ++i) {
673 vbox_crtc = vbox_crtc_init(dev, i);
674 if (!vbox_crtc)
675 return -ENOMEM;
676 encoder = vbox_encoder_init(dev, i);
677 if (!encoder)
678 return -ENOMEM;
679 ret = vbox_connector_init(dev, vbox_crtc, encoder);
680 if (ret)
681 return ret;
682 }
683
684 return 0;
685}
686
687void vbox_mode_fini(struct drm_device *dev)
688{
689 /* vbox_cursor_fini(dev); */
690}
691
692/**
693 * Copy the ARGB image and generate the mask, which is needed in case the host
694 * does not support ARGB cursors. The mask is a 1BPP bitmap with the bit set
695 * if the corresponding alpha value in the ARGB image is greater than 0xF0.
696 */
697static void copy_cursor_image(u8 *src, u8 *dst, u32 width, u32 height,
698 size_t mask_size)
699{
700 size_t line_size = (width + 7) / 8;
701 u32 i, j;
702
703 memcpy(dst + mask_size, src, width * height * 4);
704 for (i = 0; i < height; ++i)
705 for (j = 0; j < width; ++j)
706 if (((u32 *)src)[i * width + j] > 0xf0000000)
707 dst[i * line_size + j / 8] |= (0x80 >> (j % 8));
708}
709
710static int vbox_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
711 u32 handle, u32 width, u32 height,
712 s32 hot_x, s32 hot_y)
713{
714 struct vbox_private *vbox = crtc->dev->dev_private;
715 struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
716 struct ttm_bo_kmap_obj uobj_map;
717 size_t data_size, mask_size;
718 struct drm_gem_object *obj;
719 u32 flags, caps = 0;
720 struct vbox_bo *bo;
721 bool src_isiomem;
722 u8 *dst = NULL;
723 u8 *src;
724 int ret;
725
726 /*
727 * Re-set this regularly as in 5.0.20 and earlier the information was
728 * lost on save and restore.
729 */
730 hgsmi_update_input_mapping(vbox->guest_pool, 0, 0,
731 vbox->input_mapping_width,
732 vbox->input_mapping_height);
733 if (!handle) {
734 bool cursor_enabled = false;
735 struct drm_crtc *crtci;
736
737 /* Hide cursor. */
738 vbox_crtc->cursor_enabled = false;
739 list_for_each_entry(crtci, &vbox->dev->mode_config.crtc_list,
740 head) {
741 if (to_vbox_crtc(crtci)->cursor_enabled)
742 cursor_enabled = true;
743 }
744
745 if (!cursor_enabled)
746 hgsmi_update_pointer_shape(vbox->guest_pool, 0, 0, 0,
747 0, 0, NULL, 0);
748 return 0;
749 }
750
751 vbox_crtc->cursor_enabled = true;
752
753 if (width > VBOX_MAX_CURSOR_WIDTH || height > VBOX_MAX_CURSOR_HEIGHT ||
754 width == 0 || height == 0)
755 return -EINVAL;
756
757 ret = hgsmi_query_conf(vbox->guest_pool,
758 VBOX_VBVA_CONF32_CURSOR_CAPABILITIES, &caps);
759 if (ret)
760 return ret;
761
762 if (!(caps & VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE)) {
763 /*
764 * -EINVAL means cursor_set2() not supported, -EAGAIN means
765 * retry at once.
766 */
767 return -EBUSY;
768 }
769
770 obj = drm_gem_object_lookup(file_priv, handle);
771 if (!obj) {
772 DRM_ERROR("Cannot find cursor object %x for crtc\n", handle);
773 return -ENOENT;
774 }
775
776 bo = gem_to_vbox_bo(obj);
777 ret = vbox_bo_reserve(bo, false);
778 if (ret)
779 goto out_unref_obj;
780
781 /*
782 * The mask must be calculated based on the alpha
783 * channel, one bit per ARGB word, and must be 32-bit
784 * padded.
785 */
786 mask_size = ((width + 7) / 8 * height + 3) & ~3;
787 data_size = width * height * 4 + mask_size;
788 vbox->cursor_hot_x = min_t(u32, max(hot_x, 0), width);
789 vbox->cursor_hot_y = min_t(u32, max(hot_y, 0), height);
790 vbox->cursor_width = width;
791 vbox->cursor_height = height;
792 vbox->cursor_data_size = data_size;
793 dst = vbox->cursor_data;
794
795 ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &uobj_map);
796 if (ret) {
797 vbox->cursor_data_size = 0;
798 goto out_unreserve_bo;
799 }
800
801 src = ttm_kmap_obj_virtual(&uobj_map, &src_isiomem);
802 if (src_isiomem) {
803 DRM_ERROR("src cursor bo not in main memory\n");
804 ret = -EIO;
805 goto out_unmap_bo;
806 }
807
808 copy_cursor_image(src, dst, width, height, mask_size);
809
810 flags = VBOX_MOUSE_POINTER_VISIBLE | VBOX_MOUSE_POINTER_SHAPE |
811 VBOX_MOUSE_POINTER_ALPHA;
812 ret = hgsmi_update_pointer_shape(vbox->guest_pool, flags,
813 vbox->cursor_hot_x, vbox->cursor_hot_y,
814 width, height, dst, data_size);
815out_unmap_bo:
816 ttm_bo_kunmap(&uobj_map);
817out_unreserve_bo:
818 vbox_bo_unreserve(bo);
819out_unref_obj:
820 drm_gem_object_unreference_unlocked(obj);
821
822 return ret;
823}
824
825static int vbox_cursor_move(struct drm_crtc *crtc, int x, int y)
826{
827 struct vbox_private *vbox = crtc->dev->dev_private;
828 u32 flags = VBOX_MOUSE_POINTER_VISIBLE |
829 VBOX_MOUSE_POINTER_SHAPE | VBOX_MOUSE_POINTER_ALPHA;
830 s32 crtc_x =
831 vbox->single_framebuffer ? crtc->x : to_vbox_crtc(crtc)->x_hint;
832 s32 crtc_y =
833 vbox->single_framebuffer ? crtc->y : to_vbox_crtc(crtc)->y_hint;
834 u32 host_x, host_y;
835 u32 hot_x = 0;
836 u32 hot_y = 0;
837 int ret;
838
839 /*
840 * We compare these to unsigned later and don't
841 * need to handle negative.
842 */
843 if (x + crtc_x < 0 || y + crtc_y < 0 || vbox->cursor_data_size == 0)
844 return 0;
845
846 ret = hgsmi_cursor_position(vbox->guest_pool, true, x + crtc_x,
847 y + crtc_y, &host_x, &host_y);
848
849 /*
850 * The only reason we have vbox_cursor_move() is that some older clients
851 * might use DRM_IOCTL_MODE_CURSOR instead of DRM_IOCTL_MODE_CURSOR2 and
852 * use DRM_MODE_CURSOR_MOVE to set the hot-spot.
853 *
854 * However VirtualBox 5.0.20 and earlier has a bug causing it to return
855 * 0,0 as host cursor location after a save and restore.
856 *
857 * To work around this we ignore a 0, 0 return, since missing the odd
858 * time when it legitimately happens is not going to hurt much.
859 */
860 if (ret || (host_x == 0 && host_y == 0))
861 return ret;
862
863 if (x + crtc_x < host_x)
864 hot_x = min(host_x - x - crtc_x, vbox->cursor_width);
865 if (y + crtc_y < host_y)
866 hot_y = min(host_y - y - crtc_y, vbox->cursor_height);
867
868 if (hot_x == vbox->cursor_hot_x && hot_y == vbox->cursor_hot_y)
869 return 0;
870
871 vbox->cursor_hot_x = hot_x;
872 vbox->cursor_hot_y = hot_y;
873
874 return hgsmi_update_pointer_shape(vbox->guest_pool, flags,
875 hot_x, hot_y, vbox->cursor_width, vbox->cursor_height,
876 vbox->cursor_data, vbox->cursor_data_size);
877}
diff --git a/drivers/staging/vboxvideo/vbox_prime.c b/drivers/staging/vboxvideo/vbox_prime.c
new file mode 100644
index 000000000000..b7453e427a1d
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_prime.c
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 2017 Oracle Corporation
3 * Copyright 2017 Canonical
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 *
23 * Authors: Andreas Pokorny
24 */
25
26#include "vbox_drv.h"
27
28/*
29 * Based on qxl_prime.c:
30 * Empty Implementations as there should not be any other driver for a virtual
31 * device that might share buffers with vboxvideo
32 */
33
34int vbox_gem_prime_pin(struct drm_gem_object *obj)
35{
36 WARN_ONCE(1, "not implemented");
37 return -ENOSYS;
38}
39
40void vbox_gem_prime_unpin(struct drm_gem_object *obj)
41{
42 WARN_ONCE(1, "not implemented");
43}
44
45struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj)
46{
47 WARN_ONCE(1, "not implemented");
48 return ERR_PTR(-ENOSYS);
49}
50
51struct drm_gem_object *vbox_gem_prime_import_sg_table(
52 struct drm_device *dev, struct dma_buf_attachment *attach,
53 struct sg_table *table)
54{
55 WARN_ONCE(1, "not implemented");
56 return ERR_PTR(-ENOSYS);
57}
58
59void *vbox_gem_prime_vmap(struct drm_gem_object *obj)
60{
61 WARN_ONCE(1, "not implemented");
62 return ERR_PTR(-ENOSYS);
63}
64
65void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
66{
67 WARN_ONCE(1, "not implemented");
68}
69
70int vbox_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *area)
71{
72 WARN_ONCE(1, "not implemented");
73 return -ENOSYS;
74}
diff --git a/drivers/staging/vboxvideo/vbox_ttm.c b/drivers/staging/vboxvideo/vbox_ttm.c
new file mode 100644
index 000000000000..34a905d40735
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbox_ttm.c
@@ -0,0 +1,472 @@
1/*
2 * Copyright (C) 2013-2017 Oracle Corporation
3 * This file is based on ast_ttm.c
4 * Copyright 2012 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 *
27 * Authors: Dave Airlie <airlied@redhat.com>
28 * Michael Thayer <michael.thayer@oracle.com>
29 */
30#include "vbox_drv.h"
31#include <ttm/ttm_page_alloc.h>
32
33static inline struct vbox_private *vbox_bdev(struct ttm_bo_device *bd)
34{
35 return container_of(bd, struct vbox_private, ttm.bdev);
36}
37
38static int vbox_ttm_mem_global_init(struct drm_global_reference *ref)
39{
40 return ttm_mem_global_init(ref->object);
41}
42
43static void vbox_ttm_mem_global_release(struct drm_global_reference *ref)
44{
45 ttm_mem_global_release(ref->object);
46}
47
48/**
49 * Adds the vbox memory manager object/structures to the global memory manager.
50 */
51static int vbox_ttm_global_init(struct vbox_private *vbox)
52{
53 struct drm_global_reference *global_ref;
54 int ret;
55
56 global_ref = &vbox->ttm.mem_global_ref;
57 global_ref->global_type = DRM_GLOBAL_TTM_MEM;
58 global_ref->size = sizeof(struct ttm_mem_global);
59 global_ref->init = &vbox_ttm_mem_global_init;
60 global_ref->release = &vbox_ttm_mem_global_release;
61 ret = drm_global_item_ref(global_ref);
62 if (ret) {
63 DRM_ERROR("Failed setting up TTM memory subsystem.\n");
64 return ret;
65 }
66
67 vbox->ttm.bo_global_ref.mem_glob = vbox->ttm.mem_global_ref.object;
68 global_ref = &vbox->ttm.bo_global_ref.ref;
69 global_ref->global_type = DRM_GLOBAL_TTM_BO;
70 global_ref->size = sizeof(struct ttm_bo_global);
71 global_ref->init = &ttm_bo_global_init;
72 global_ref->release = &ttm_bo_global_release;
73
74 ret = drm_global_item_ref(global_ref);
75 if (ret) {
76 DRM_ERROR("Failed setting up TTM BO subsystem.\n");
77 drm_global_item_unref(&vbox->ttm.mem_global_ref);
78 return ret;
79 }
80
81 return 0;
82}
83
84/**
85 * Removes the vbox memory manager object from the global memory manager.
86 */
87static void vbox_ttm_global_release(struct vbox_private *vbox)
88{
89 drm_global_item_unref(&vbox->ttm.bo_global_ref.ref);
90 drm_global_item_unref(&vbox->ttm.mem_global_ref);
91}
92
93static void vbox_bo_ttm_destroy(struct ttm_buffer_object *tbo)
94{
95 struct vbox_bo *bo;
96
97 bo = container_of(tbo, struct vbox_bo, bo);
98
99 drm_gem_object_release(&bo->gem);
100 kfree(bo);
101}
102
103static bool vbox_ttm_bo_is_vbox_bo(struct ttm_buffer_object *bo)
104{
105 if (bo->destroy == &vbox_bo_ttm_destroy)
106 return true;
107
108 return false;
109}
110
111static int
112vbox_bo_init_mem_type(struct ttm_bo_device *bdev, u32 type,
113 struct ttm_mem_type_manager *man)
114{
115 switch (type) {
116 case TTM_PL_SYSTEM:
117 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
118 man->available_caching = TTM_PL_MASK_CACHING;
119 man->default_caching = TTM_PL_FLAG_CACHED;
120 break;
121 case TTM_PL_VRAM:
122 man->func = &ttm_bo_manager_func;
123 man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE;
124 man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
125 man->default_caching = TTM_PL_FLAG_WC;
126 break;
127 default:
128 DRM_ERROR("Unsupported memory type %u\n", (unsigned int)type);
129 return -EINVAL;
130 }
131
132 return 0;
133}
134
135static void
136vbox_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
137{
138 struct vbox_bo *vboxbo = vbox_bo(bo);
139
140 if (!vbox_ttm_bo_is_vbox_bo(bo))
141 return;
142
143 vbox_ttm_placement(vboxbo, TTM_PL_FLAG_SYSTEM);
144 *pl = vboxbo->placement;
145}
146
147static int vbox_bo_verify_access(struct ttm_buffer_object *bo,
148 struct file *filp)
149{
150 return 0;
151}
152
153static int vbox_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
154 struct ttm_mem_reg *mem)
155{
156 struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
157 struct vbox_private *vbox = vbox_bdev(bdev);
158
159 mem->bus.addr = NULL;
160 mem->bus.offset = 0;
161 mem->bus.size = mem->num_pages << PAGE_SHIFT;
162 mem->bus.base = 0;
163 mem->bus.is_iomem = false;
164 if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
165 return -EINVAL;
166 switch (mem->mem_type) {
167 case TTM_PL_SYSTEM:
168 /* system memory */
169 return 0;
170 case TTM_PL_VRAM:
171 mem->bus.offset = mem->start << PAGE_SHIFT;
172 mem->bus.base = pci_resource_start(vbox->dev->pdev, 0);
173 mem->bus.is_iomem = true;
174 break;
175 default:
176 return -EINVAL;
177 }
178 return 0;
179}
180
181static void vbox_ttm_io_mem_free(struct ttm_bo_device *bdev,
182 struct ttm_mem_reg *mem)
183{
184}
185
186static int vbox_bo_move(struct ttm_buffer_object *bo,
187 bool evict, bool interruptible,
188 bool no_wait_gpu, struct ttm_mem_reg *new_mem)
189{
190 return ttm_bo_move_memcpy(bo, interruptible, no_wait_gpu, new_mem);
191}
192
193static void vbox_ttm_backend_destroy(struct ttm_tt *tt)
194{
195 ttm_tt_fini(tt);
196 kfree(tt);
197}
198
199static struct ttm_backend_func vbox_tt_backend_func = {
200 .destroy = &vbox_ttm_backend_destroy,
201};
202
203static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
204 unsigned long size,
205 u32 page_flags,
206 struct page *dummy_read_page)
207{
208 struct ttm_tt *tt;
209
210 tt = kzalloc(sizeof(*tt), GFP_KERNEL);
211 if (!tt)
212 return NULL;
213
214 tt->func = &vbox_tt_backend_func;
215 if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
216 kfree(tt);
217 return NULL;
218 }
219
220 return tt;
221}
222
223static int vbox_ttm_tt_populate(struct ttm_tt *ttm)
224{
225 return ttm_pool_populate(ttm);
226}
227
228static void vbox_ttm_tt_unpopulate(struct ttm_tt *ttm)
229{
230 ttm_pool_unpopulate(ttm);
231}
232
233struct ttm_bo_driver vbox_bo_driver = {
234 .ttm_tt_create = vbox_ttm_tt_create,
235 .ttm_tt_populate = vbox_ttm_tt_populate,
236 .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate,
237 .init_mem_type = vbox_bo_init_mem_type,
238 .eviction_valuable = ttm_bo_eviction_valuable,
239 .evict_flags = vbox_bo_evict_flags,
240 .move = vbox_bo_move,
241 .verify_access = vbox_bo_verify_access,
242 .io_mem_reserve = &vbox_ttm_io_mem_reserve,
243 .io_mem_free = &vbox_ttm_io_mem_free,
244 .io_mem_pfn = ttm_bo_default_io_mem_pfn,
245};
246
247int vbox_mm_init(struct vbox_private *vbox)
248{
249 int ret;
250 struct drm_device *dev = vbox->dev;
251 struct ttm_bo_device *bdev = &vbox->ttm.bdev;
252
253 ret = vbox_ttm_global_init(vbox);
254 if (ret)
255 return ret;
256
257 ret = ttm_bo_device_init(&vbox->ttm.bdev,
258 vbox->ttm.bo_global_ref.ref.object,
259 &vbox_bo_driver,
260 dev->anon_inode->i_mapping,
261 DRM_FILE_PAGE_OFFSET, true);
262 if (ret) {
263 DRM_ERROR("Error initialising bo driver; %d\n", ret);
264 goto err_ttm_global_release;
265 }
266
267 ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM,
268 vbox->available_vram_size >> PAGE_SHIFT);
269 if (ret) {
270 DRM_ERROR("Failed ttm VRAM init: %d\n", ret);
271 goto err_device_release;
272 }
273
274#ifdef DRM_MTRR_WC
275 vbox->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0),
276 pci_resource_len(dev->pdev, 0),
277 DRM_MTRR_WC);
278#else
279 vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
280 pci_resource_len(dev->pdev, 0));
281#endif
282 return 0;
283
284err_device_release:
285 ttm_bo_device_release(&vbox->ttm.bdev);
286err_ttm_global_release:
287 vbox_ttm_global_release(vbox);
288 return ret;
289}
290
291void vbox_mm_fini(struct vbox_private *vbox)
292{
293#ifdef DRM_MTRR_WC
294 drm_mtrr_del(vbox->fb_mtrr,
295 pci_resource_start(vbox->dev->pdev, 0),
296 pci_resource_len(vbox->dev->pdev, 0), DRM_MTRR_WC);
297#else
298 arch_phys_wc_del(vbox->fb_mtrr);
299#endif
300 ttm_bo_device_release(&vbox->ttm.bdev);
301 vbox_ttm_global_release(vbox);
302}
303
304void vbox_ttm_placement(struct vbox_bo *bo, int domain)
305{
306 unsigned int i;
307 u32 c = 0;
308
309 bo->placement.placement = bo->placements;
310 bo->placement.busy_placement = bo->placements;
311
312 if (domain & TTM_PL_FLAG_VRAM)
313 bo->placements[c++].flags =
314 TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM;
315 if (domain & TTM_PL_FLAG_SYSTEM)
316 bo->placements[c++].flags =
317 TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
318 if (!c)
319 bo->placements[c++].flags =
320 TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
321
322 bo->placement.num_placement = c;
323 bo->placement.num_busy_placement = c;
324
325 for (i = 0; i < c; ++i) {
326 bo->placements[i].fpfn = 0;
327 bo->placements[i].lpfn = 0;
328 }
329}
330
331int vbox_bo_create(struct drm_device *dev, int size, int align,
332 u32 flags, struct vbox_bo **pvboxbo)
333{
334 struct vbox_private *vbox = dev->dev_private;
335 struct vbox_bo *vboxbo;
336 size_t acc_size;
337 int ret;
338
339 vboxbo = kzalloc(sizeof(*vboxbo), GFP_KERNEL);
340 if (!vboxbo)
341 return -ENOMEM;
342
343 ret = drm_gem_object_init(dev, &vboxbo->gem, size);
344 if (ret)
345 goto err_free_vboxbo;
346
347 vboxbo->bo.bdev = &vbox->ttm.bdev;
348
349 vbox_ttm_placement(vboxbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
350
351 acc_size = ttm_bo_dma_acc_size(&vbox->ttm.bdev, size,
352 sizeof(struct vbox_bo));
353
354 ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size,
355 ttm_bo_type_device, &vboxbo->placement,
356 align >> PAGE_SHIFT, false, NULL, acc_size,
357 NULL, NULL, vbox_bo_ttm_destroy);
358 if (ret)
359 goto err_free_vboxbo;
360
361 *pvboxbo = vboxbo;
362
363 return 0;
364
365err_free_vboxbo:
366 kfree(vboxbo);
367 return ret;
368}
369
370static inline u64 vbox_bo_gpu_offset(struct vbox_bo *bo)
371{
372 return bo->bo.offset;
373}
374
375int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr)
376{
377 int i, ret;
378
379 if (bo->pin_count) {
380 bo->pin_count++;
381 if (gpu_addr)
382 *gpu_addr = vbox_bo_gpu_offset(bo);
383
384 return 0;
385 }
386
387 vbox_ttm_placement(bo, pl_flag);
388
389 for (i = 0; i < bo->placement.num_placement; i++)
390 bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
391
392 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
393 if (ret)
394 return ret;
395
396 bo->pin_count = 1;
397
398 if (gpu_addr)
399 *gpu_addr = vbox_bo_gpu_offset(bo);
400
401 return 0;
402}
403
404int vbox_bo_unpin(struct vbox_bo *bo)
405{
406 int i, ret;
407
408 if (!bo->pin_count) {
409 DRM_ERROR("unpin bad %p\n", bo);
410 return 0;
411 }
412 bo->pin_count--;
413 if (bo->pin_count)
414 return 0;
415
416 for (i = 0; i < bo->placement.num_placement; i++)
417 bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT;
418
419 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
420 if (ret)
421 return ret;
422
423 return 0;
424}
425
426/*
427 * Move a vbox-owned buffer object to system memory if no one else has it
428 * pinned. The caller must have pinned it previously, and this call will
429 * release the caller's pin.
430 */
431int vbox_bo_push_sysram(struct vbox_bo *bo)
432{
433 int i, ret;
434
435 if (!bo->pin_count) {
436 DRM_ERROR("unpin bad %p\n", bo);
437 return 0;
438 }
439 bo->pin_count--;
440 if (bo->pin_count)
441 return 0;
442
443 if (bo->kmap.virtual)
444 ttm_bo_kunmap(&bo->kmap);
445
446 vbox_ttm_placement(bo, TTM_PL_FLAG_SYSTEM);
447
448 for (i = 0; i < bo->placement.num_placement; i++)
449 bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
450
451 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
452 if (ret) {
453 DRM_ERROR("pushing to VRAM failed\n");
454 return ret;
455 }
456
457 return 0;
458}
459
460int vbox_mmap(struct file *filp, struct vm_area_struct *vma)
461{
462 struct drm_file *file_priv;
463 struct vbox_private *vbox;
464
465 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
466 return -EINVAL;
467
468 file_priv = filp->private_data;
469 vbox = file_priv->minor->dev->dev_private;
470
471 return ttm_bo_mmap(filp, vma, &vbox->ttm.bdev);
472}
diff --git a/drivers/staging/vboxvideo/vboxvideo.h b/drivers/staging/vboxvideo/vboxvideo.h
new file mode 100644
index 000000000000..d835d75d761c
--- /dev/null
+++ b/drivers/staging/vboxvideo/vboxvideo.h
@@ -0,0 +1,491 @@
1/*
2 * Copyright (C) 2006-2016 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
15 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18 * USE OR OTHER DEALINGS IN THE SOFTWARE.
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 */
23
24#ifndef __VBOXVIDEO_H__
25#define __VBOXVIDEO_H__
26
27/*
28 * This should be in sync with monitorCount <xsd:maxInclusive value="64"/> in
29 * src/VBox/Main/xml/VirtualBox-settings-common.xsd
30 */
31#define VBOX_VIDEO_MAX_SCREENS 64
32
33/*
34 * The last 4096 bytes of the guest VRAM contains the generic info for all
35 * DualView chunks: sizes and offsets of chunks. This is filled by miniport.
36 *
37 * Last 4096 bytes of each chunk contain chunk specific data: framebuffer info,
38 * etc. This is used exclusively by the corresponding instance of a display
39 * driver.
40 *
41 * The VRAM layout:
42 * Last 4096 bytes - Adapter information area.
43 * 4096 bytes aligned miniport heap (value specified in the config rouded up).
44 * Slack - what left after dividing the VRAM.
45 * 4096 bytes aligned framebuffers:
46 * last 4096 bytes of each framebuffer is the display information area.
47 *
48 * The Virtual Graphics Adapter information in the guest VRAM is stored by the
49 * guest video driver using structures prepended by VBOXVIDEOINFOHDR.
50 *
51 * When the guest driver writes dword 0 to the VBE_DISPI_INDEX_VBOX_VIDEO
52 * the host starts to process the info. The first element at the start of
53 * the 4096 bytes region should be normally be a LINK that points to
54 * actual information chain. That way the guest driver can have some
55 * fixed layout of the information memory block and just rewrite
56 * the link to point to relevant memory chain.
57 *
58 * The processing stops at the END element.
59 *
60 * The host can access the memory only when the port IO is processed.
61 * All data that will be needed later must be copied from these 4096 bytes.
62 * But other VRAM can be used by host until the mode is disabled.
63 *
64 * The guest driver writes dword 0xffffffff to the VBE_DISPI_INDEX_VBOX_VIDEO
65 * to disable the mode.
66 *
67 * VBE_DISPI_INDEX_VBOX_VIDEO is used to read the configuration information
68 * from the host and issue commands to the host.
69 *
70 * The guest writes the VBE_DISPI_INDEX_VBOX_VIDEO index register, the the
71 * following operations with the VBE data register can be performed:
72 *
73 * Operation Result
74 * write 16 bit value NOP
75 * read 16 bit value count of monitors
76 * write 32 bit value set the vbox cmd value and the cmd processed by the host
77 * read 32 bit value result of the last vbox command is returned
78 */
79
80/**
81 * VBVA command header.
82 *
83 * @todo Where does this fit in?
84 */
85struct vbva_cmd_hdr {
86 /** Coordinates of affected rectangle. */
87 s16 x;
88 s16 y;
89 u16 w;
90 u16 h;
91} __packed;
92
93/** @name VBVA ring defines.
94 *
95 * The VBVA ring buffer is suitable for transferring large (< 2GB) amount of
96 * data. For example big bitmaps which do not fit to the buffer.
97 *
98 * Guest starts writing to the buffer by initializing a record entry in the
99 * records queue. VBVA_F_RECORD_PARTIAL indicates that the record is being
100 * written. As data is written to the ring buffer, the guest increases
101 * free_offset.
102 *
103 * The host reads the records on flushes and processes all completed records.
104 * When host encounters situation when only a partial record presents and
105 * len_and_flags & ~VBVA_F_RECORD_PARTIAL >= VBVA_RING_BUFFER_SIZE -
106 * VBVA_RING_BUFFER_THRESHOLD, the host fetched all record data and updates
107 * data_offset. After that on each flush the host continues fetching the data
108 * until the record is completed.
109 *
110 */
111#define VBVA_RING_BUFFER_SIZE (4194304 - 1024)
112#define VBVA_RING_BUFFER_THRESHOLD (4096)
113
114#define VBVA_MAX_RECORDS (64)
115
116#define VBVA_F_MODE_ENABLED 0x00000001u
117#define VBVA_F_MODE_VRDP 0x00000002u
118#define VBVA_F_MODE_VRDP_RESET 0x00000004u
119#define VBVA_F_MODE_VRDP_ORDER_MASK 0x00000008u
120
121#define VBVA_F_STATE_PROCESSING 0x00010000u
122
123#define VBVA_F_RECORD_PARTIAL 0x80000000u
124
125/**
126 * VBVA record.
127 */
128struct vbva_record {
129 /** The length of the record. Changed by guest. */
130 u32 len_and_flags;
131} __packed;
132
133/*
134 * The minimum HGSMI heap size is PAGE_SIZE (4096 bytes) and is a restriction of
135 * the runtime heapsimple API. Use minimum 2 pages here, because the info area
136 * also may contain other data (for example hgsmi_host_flags structure).
137 */
138#define VBVA_ADAPTER_INFORMATION_SIZE 65536
139#define VBVA_MIN_BUFFER_SIZE 65536
140
141/* The value for port IO to let the adapter to interpret the adapter memory. */
142#define VBOX_VIDEO_DISABLE_ADAPTER_MEMORY 0xFFFFFFFF
143
144/* The value for port IO to let the adapter to interpret the adapter memory. */
145#define VBOX_VIDEO_INTERPRET_ADAPTER_MEMORY 0x00000000
146
147/* The value for port IO to let the adapter to interpret the display memory.
148 * The display number is encoded in low 16 bits.
149 */
150#define VBOX_VIDEO_INTERPRET_DISPLAY_MEMORY_BASE 0x00010000
151
152struct vbva_host_flags {
153 u32 host_events;
154 u32 supported_orders;
155} __packed;
156
157struct vbva_buffer {
158 struct vbva_host_flags host_flags;
159
160 /* The offset where the data start in the buffer. */
161 u32 data_offset;
162 /* The offset where next data must be placed in the buffer. */
163 u32 free_offset;
164
165 /* The queue of record descriptions. */
166 struct vbva_record records[VBVA_MAX_RECORDS];
167 u32 record_first_index;
168 u32 record_free_index;
169
170 /* Space to leave free when large partial records are transferred. */
171 u32 partial_write_tresh;
172
173 u32 data_len;
174 /* variable size for the rest of the vbva_buffer area in VRAM. */
175 u8 data[0];
176} __packed;
177
178#define VBVA_MAX_RECORD_SIZE (128 * 1024 * 1024)
179
180/* guest->host commands */
181#define VBVA_QUERY_CONF32 1
182#define VBVA_SET_CONF32 2
183#define VBVA_INFO_VIEW 3
184#define VBVA_INFO_HEAP 4
185#define VBVA_FLUSH 5
186#define VBVA_INFO_SCREEN 6
187#define VBVA_ENABLE 7
188#define VBVA_MOUSE_POINTER_SHAPE 8
189/* informs host about HGSMI caps. see vbva_caps below */
190#define VBVA_INFO_CAPS 12
191/* configures scanline, see VBVASCANLINECFG below */
192#define VBVA_SCANLINE_CFG 13
193/* requests scanline info, see VBVASCANLINEINFO below */
194#define VBVA_SCANLINE_INFO 14
195/* inform host about VBVA Command submission */
196#define VBVA_CMDVBVA_SUBMIT 16
197/* inform host about VBVA Command submission */
198#define VBVA_CMDVBVA_FLUSH 17
199/* G->H DMA command */
200#define VBVA_CMDVBVA_CTL 18
201/* Query most recent mode hints sent */
202#define VBVA_QUERY_MODE_HINTS 19
203/**
204 * Report the guest virtual desktop position and size for mapping host and
205 * guest pointer positions.
206 */
207#define VBVA_REPORT_INPUT_MAPPING 20
208/** Report the guest cursor position and query the host position. */
209#define VBVA_CURSOR_POSITION 21
210
211/* host->guest commands */
212#define VBVAHG_EVENT 1
213#define VBVAHG_DISPLAY_CUSTOM 2
214
215/* vbva_conf32::index */
216#define VBOX_VBVA_CONF32_MONITOR_COUNT 0
217#define VBOX_VBVA_CONF32_HOST_HEAP_SIZE 1
218/**
219 * Returns VINF_SUCCESS if the host can report mode hints via VBVA.
220 * Set value to VERR_NOT_SUPPORTED before calling.
221 */
222#define VBOX_VBVA_CONF32_MODE_HINT_REPORTING 2
223/**
224 * Returns VINF_SUCCESS if the host can report guest cursor enabled status via
225 * VBVA. Set value to VERR_NOT_SUPPORTED before calling.
226 */
227#define VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING 3
228/**
229 * Returns the currently available host cursor capabilities. Available if
230 * vbva_conf32::VBOX_VBVA_CONF32_GUEST_CURSOR_REPORTING returns success.
231 * @see VMMDevReqMouseStatus::mouseFeatures.
232 */
233#define VBOX_VBVA_CONF32_CURSOR_CAPABILITIES 4
234/** Returns the supported flags in vbva_infoscreen::flags. */
235#define VBOX_VBVA_CONF32_SCREEN_FLAGS 5
236/** Returns the max size of VBVA record. */
237#define VBOX_VBVA_CONF32_MAX_RECORD_SIZE 6
238
239struct vbva_conf32 {
240 u32 index;
241 u32 value;
242} __packed;
243
244/** Reserved for historical reasons. */
245#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED0 BIT(0)
246/**
247 * Guest cursor capability: can the host show a hardware cursor at the host
248 * pointer location?
249 */
250#define VBOX_VBVA_CURSOR_CAPABILITY_HARDWARE BIT(1)
251/** Reserved for historical reasons. */
252#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED2 BIT(2)
253/** Reserved for historical reasons. Must always be unset. */
254#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED3 BIT(3)
255/** Reserved for historical reasons. */
256#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED4 BIT(4)
257/** Reserved for historical reasons. */
258#define VBOX_VBVA_CURSOR_CAPABILITY_RESERVED5 BIT(5)
259
260struct vbva_infoview {
261 /* Index of the screen, assigned by the guest. */
262 u32 view_index;
263
264 /* The screen offset in VRAM, the framebuffer starts here. */
265 u32 view_offset;
266
267 /* The size of the VRAM memory that can be used for the view. */
268 u32 view_size;
269
270 /* The recommended maximum size of the VRAM memory for the screen. */
271 u32 max_screen_size;
272} __packed;
273
274struct vbva_flush {
275 u32 reserved;
276} __packed;
277
278/* vbva_infoscreen::flags */
279#define VBVA_SCREEN_F_NONE 0x0000
280#define VBVA_SCREEN_F_ACTIVE 0x0001
281/**
282 * The virtual monitor has been disabled by the guest and should be removed
283 * by the host and ignored for purposes of pointer position calculation.
284 */
285#define VBVA_SCREEN_F_DISABLED 0x0002
286/**
287 * The virtual monitor has been blanked by the guest and should be blacked
288 * out by the host using width, height, etc values from the vbva_infoscreen
289 * request.
290 */
291#define VBVA_SCREEN_F_BLANK 0x0004
292/**
293 * The virtual monitor has been blanked by the guest and should be blacked
294 * out by the host using the previous mode values for width. height, etc.
295 */
296#define VBVA_SCREEN_F_BLANK2 0x0008
297
298struct vbva_infoscreen {
299 /* Which view contains the screen. */
300 u32 view_index;
301
302 /* Physical X origin relative to the primary screen. */
303 s32 origin_x;
304
305 /* Physical Y origin relative to the primary screen. */
306 s32 origin_y;
307
308 /* Offset of visible framebuffer relative to the framebuffer start. */
309 u32 start_offset;
310
311 /* The scan line size in bytes. */
312 u32 line_size;
313
314 /* Width of the screen. */
315 u32 width;
316
317 /* Height of the screen. */
318 u32 height;
319
320 /* Color depth. */
321 u16 bits_per_pixel;
322
323 /* VBVA_SCREEN_F_* */
324 u16 flags;
325} __packed;
326
327/* vbva_enable::flags */
328#define VBVA_F_NONE 0x00000000
329#define VBVA_F_ENABLE 0x00000001
330#define VBVA_F_DISABLE 0x00000002
331/* extended VBVA to be used with WDDM */
332#define VBVA_F_EXTENDED 0x00000004
333/* vbva offset is absolute VRAM offset */
334#define VBVA_F_ABSOFFSET 0x00000008
335
336struct vbva_enable {
337 u32 flags;
338 u32 offset;
339 s32 result;
340} __packed;
341
342struct vbva_enable_ex {
343 struct vbva_enable base;
344 u32 screen_id;
345} __packed;
346
347struct vbva_mouse_pointer_shape {
348 /* The host result. */
349 s32 result;
350
351 /* VBOX_MOUSE_POINTER_* bit flags. */
352 u32 flags;
353
354 /* X coordinate of the hot spot. */
355 u32 hot_X;
356
357 /* Y coordinate of the hot spot. */
358 u32 hot_y;
359
360 /* Width of the pointer in pixels. */
361 u32 width;
362
363 /* Height of the pointer in scanlines. */
364 u32 height;
365
366 /* Pointer data.
367 *
368 ****
369 * The data consists of 1 bpp AND mask followed by 32 bpp XOR (color)
370 * mask.
371 *
372 * For pointers without alpha channel the XOR mask pixels are 32 bit
373 * values: (lsb)BGR0(msb). For pointers with alpha channel the XOR mask
374 * consists of (lsb)BGRA(msb) 32 bit values.
375 *
376 * Guest driver must create the AND mask for pointers with alpha chan.,
377 * so if host does not support alpha, the pointer could be displayed as
378 * a normal color pointer. The AND mask can be constructed from alpha
379 * values. For example alpha value >= 0xf0 means bit 0 in the AND mask.
380 *
381 * The AND mask is 1 bpp bitmap with byte aligned scanlines. Size of AND
382 * mask, therefore, is and_len = (width + 7) / 8 * height. The padding
383 * bits at the end of any scanline are undefined.
384 *
385 * The XOR mask follows the AND mask on the next 4 bytes aligned offset:
386 * u8 *xor = and + (and_len + 3) & ~3
387 * Bytes in the gap between the AND and the XOR mask are undefined.
388 * XOR mask scanlines have no gap between them and size of XOR mask is:
389 * xor_len = width * 4 * height.
390 ****
391 *
392 * Preallocate 4 bytes for accessing actual data as p->data.
393 */
394 u8 data[4];
395} __packed;
396
397/**
398 * @name vbva_mouse_pointer_shape::flags
399 * @note The VBOX_MOUSE_POINTER_* flags are used in the guest video driver,
400 * values must be <= 0x8000 and must not be changed. (try make more sense
401 * of this, please).
402 * @{
403 */
404
405/** pointer is visible */
406#define VBOX_MOUSE_POINTER_VISIBLE 0x0001
407/** pointer has alpha channel */
408#define VBOX_MOUSE_POINTER_ALPHA 0x0002
409/** pointerData contains new pointer shape */
410#define VBOX_MOUSE_POINTER_SHAPE 0x0004
411
412/** @} */
413
414/*
415 * The guest driver can handle asynch guest cmd completion by reading the
416 * command offset from io port.
417 */
418#define VBVACAPS_COMPLETEGCMD_BY_IOREAD 0x00000001
419/* the guest driver can handle video adapter IRQs */
420#define VBVACAPS_IRQ 0x00000002
421/** The guest can read video mode hints sent via VBVA. */
422#define VBVACAPS_VIDEO_MODE_HINTS 0x00000004
423/** The guest can switch to a software cursor on demand. */
424#define VBVACAPS_DISABLE_CURSOR_INTEGRATION 0x00000008
425/** The guest does not depend on host handling the VBE registers. */
426#define VBVACAPS_USE_VBVA_ONLY 0x00000010
427
428struct vbva_caps {
429 s32 rc;
430 u32 caps;
431} __packed;
432
433/** Query the most recent mode hints received from the host. */
434struct vbva_query_mode_hints {
435 /** The maximum number of screens to return hints for. */
436 u16 hints_queried_count;
437 /** The size of the mode hint structures directly following this one. */
438 u16 hint_structure_guest_size;
439 /** Return code for the operation. Initialise to VERR_NOT_SUPPORTED. */
440 s32 rc;
441} __packed;
442
443/**
444 * Structure in which a mode hint is returned. The guest allocates an array
445 * of these immediately after the vbva_query_mode_hints structure.
446 * To accommodate future extensions, the vbva_query_mode_hints structure
447 * specifies the size of the vbva_modehint structures allocated by the guest,
448 * and the host only fills out structure elements which fit into that size. The
449 * host should fill any unused members (e.g. dx, dy) or structure space on the
450 * end with ~0. The whole structure can legally be set to ~0 to skip a screen.
451 */
452struct vbva_modehint {
453 u32 magic;
454 u32 cx;
455 u32 cy;
456 u32 bpp; /* Which has never been used... */
457 u32 display;
458 u32 dx; /**< X offset into the virtual frame-buffer. */
459 u32 dy; /**< Y offset into the virtual frame-buffer. */
460 u32 enabled; /* Not flags. Add new members for new flags. */
461} __packed;
462
463#define VBVAMODEHINT_MAGIC 0x0801add9u
464
465/**
466 * Report the rectangle relative to which absolute pointer events should be
467 * expressed. This information remains valid until the next VBVA resize event
468 * for any screen, at which time it is reset to the bounding rectangle of all
469 * virtual screens and must be re-set.
470 * @see VBVA_REPORT_INPUT_MAPPING.
471 */
472struct vbva_report_input_mapping {
473 s32 x; /**< Upper left X co-ordinate relative to the first screen. */
474 s32 y; /**< Upper left Y co-ordinate relative to the first screen. */
475 u32 cx; /**< Rectangle width. */
476 u32 cy; /**< Rectangle height. */
477} __packed;
478
479/**
480 * Report the guest cursor position and query the host one. The host may wish
481 * to use the guest information to re-position its own cursor (though this is
482 * currently unlikely).
483 * @see VBVA_CURSOR_POSITION
484 */
485struct vbva_cursor_position {
486 u32 report_position; /**< Are we reporting a position? */
487 u32 x; /**< Guest cursor X position */
488 u32 y; /**< Guest cursor Y position */
489} __packed;
490
491#endif
diff --git a/drivers/staging/vboxvideo/vboxvideo_guest.h b/drivers/staging/vboxvideo/vboxvideo_guest.h
new file mode 100644
index 000000000000..d09da841711a
--- /dev/null
+++ b/drivers/staging/vboxvideo/vboxvideo_guest.h
@@ -0,0 +1,95 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __VBOXVIDEO_GUEST_H__
24#define __VBOXVIDEO_GUEST_H__
25
26#include <linux/genalloc.h>
27#include "vboxvideo.h"
28
29/**
30 * Structure grouping the context needed for sending graphics acceleration
31 * information to the host via VBVA. Each screen has its own VBVA buffer.
32 */
33struct vbva_buf_ctx {
34 /** Offset of the buffer in the VRAM section for the screen */
35 u32 buffer_offset;
36 /** Length of the buffer in bytes */
37 u32 buffer_length;
38 /** Set if we wrote to the buffer faster than the host could read it */
39 bool buffer_overflow;
40 /** VBVA record that we are currently preparing for the host, or NULL */
41 struct vbva_record *record;
42 /**
43 * Pointer to the VBVA buffer mapped into the current address space.
44 * Will be NULL if VBVA is not enabled.
45 */
46 struct vbva_buffer *vbva;
47};
48
49/**
50 * @name Base HGSMI APIs
51 * @{
52 */
53int hgsmi_report_flags_location(struct gen_pool *ctx, u32 location);
54int hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps);
55int hgsmi_test_query_conf(struct gen_pool *ctx);
56int hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret);
57int hgsmi_update_pointer_shape(struct gen_pool *ctx, u32 flags,
58 u32 hot_x, u32 hot_y, u32 width, u32 height,
59 u8 *pixels, u32 len);
60int hgsmi_cursor_position(struct gen_pool *ctx, bool report_position,
61 u32 x, u32 y, u32 *x_host, u32 *y_host);
62/** @} */
63
64/**
65 * @name VBVA APIs
66 * @{
67 */
68bool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
69 struct vbva_buffer *vbva, s32 screen);
70void vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
71 s32 screen);
72bool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx,
73 struct gen_pool *ctx);
74void vbva_buffer_end_update(struct vbva_buf_ctx *vbva_ctx);
75bool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
76 const void *p, u32 len);
77void vbva_setup_buffer_context(struct vbva_buf_ctx *vbva_ctx,
78 u32 buffer_offset, u32 buffer_length);
79/** @} */
80
81/**
82 * @name Modesetting APIs
83 * @{
84 */
85void hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
86 s32 origin_x, s32 origin_y, u32 start_offset,
87 u32 pitch, u32 width, u32 height,
88 u16 bpp, u16 flags);
89int hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
90 u32 width, u32 height);
91int hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
92 struct vbva_modehint *hints);
93/** @} */
94
95#endif
diff --git a/drivers/staging/vboxvideo/vboxvideo_vbe.h b/drivers/staging/vboxvideo/vboxvideo_vbe.h
new file mode 100644
index 000000000000..f842f4d9c80a
--- /dev/null
+++ b/drivers/staging/vboxvideo/vboxvideo_vbe.h
@@ -0,0 +1,84 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef __VBOXVIDEO_VBE_H__
24#define __VBOXVIDEO_VBE_H__
25
26/* GUEST <-> HOST Communication API */
27
28/**
29 * @todo FIXME: Either dynamicly ask host for this or put somewhere high in
30 * physical memory like 0xE0000000.
31 */
32
33#define VBE_DISPI_BANK_ADDRESS 0xA0000
34#define VBE_DISPI_BANK_SIZE_KB 64
35
36#define VBE_DISPI_MAX_XRES 16384
37#define VBE_DISPI_MAX_YRES 16384
38#define VBE_DISPI_MAX_BPP 32
39
40#define VBE_DISPI_IOPORT_INDEX 0x01CE
41#define VBE_DISPI_IOPORT_DATA 0x01CF
42
43#define VBE_DISPI_IOPORT_DAC_WRITE_INDEX 0x03C8
44#define VBE_DISPI_IOPORT_DAC_DATA 0x03C9
45
46#define VBE_DISPI_INDEX_ID 0x0
47#define VBE_DISPI_INDEX_XRES 0x1
48#define VBE_DISPI_INDEX_YRES 0x2
49#define VBE_DISPI_INDEX_BPP 0x3
50#define VBE_DISPI_INDEX_ENABLE 0x4
51#define VBE_DISPI_INDEX_BANK 0x5
52#define VBE_DISPI_INDEX_VIRT_WIDTH 0x6
53#define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7
54#define VBE_DISPI_INDEX_X_OFFSET 0x8
55#define VBE_DISPI_INDEX_Y_OFFSET 0x9
56#define VBE_DISPI_INDEX_VBOX_VIDEO 0xa
57#define VBE_DISPI_INDEX_FB_BASE_HI 0xb
58
59#define VBE_DISPI_ID0 0xB0C0
60#define VBE_DISPI_ID1 0xB0C1
61#define VBE_DISPI_ID2 0xB0C2
62#define VBE_DISPI_ID3 0xB0C3
63#define VBE_DISPI_ID4 0xB0C4
64
65#define VBE_DISPI_ID_VBOX_VIDEO 0xBE00
66/* The VBOX interface id. Indicates support for VBVA shared memory interface. */
67#define VBE_DISPI_ID_HGSMI 0xBE01
68#define VBE_DISPI_ID_ANYX 0xBE02
69
70#define VBE_DISPI_DISABLED 0x00
71#define VBE_DISPI_ENABLED 0x01
72#define VBE_DISPI_GETCAPS 0x02
73#define VBE_DISPI_8BIT_DAC 0x20
74/**
75 * @note this definition is a BOCHS legacy, used only in the video BIOS
76 * code and ignored by the emulated hardware.
77 */
78#define VBE_DISPI_LFB_ENABLED 0x40
79#define VBE_DISPI_NOCLEARMEM 0x80
80
81#define VGA_PORT_HGSMI_HOST 0x3b0
82#define VGA_PORT_HGSMI_GUEST 0x3d0
83
84#endif
diff --git a/drivers/staging/vboxvideo/vbva_base.c b/drivers/staging/vboxvideo/vbva_base.c
new file mode 100644
index 000000000000..c10c782f94e1
--- /dev/null
+++ b/drivers/staging/vboxvideo/vbva_base.c
@@ -0,0 +1,233 @@
1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#include "vbox_drv.h"
24#include "vbox_err.h"
25#include "vboxvideo_guest.h"
26#include "hgsmi_channels.h"
27
28/*
29 * There is a hardware ring buffer in the graphics device video RAM, formerly
30 * in the VBox VMMDev PCI memory space.
31 * All graphics commands go there serialized by vbva_buffer_begin_update.
32 * and vbva_buffer_end_update.
33 *
34 * free_offset is writing position. data_offset is reading position.
35 * free_offset == data_offset means buffer is empty.
36 * There must be always gap between data_offset and free_offset when data
37 * are in the buffer.
38 * Guest only changes free_offset, host changes data_offset.
39 */
40
41static u32 vbva_buffer_available(const struct vbva_buffer *vbva)
42{
43 s32 diff = vbva->data_offset - vbva->free_offset;
44
45 return diff > 0 ? diff : vbva->data_len + diff;
46}
47
48static void vbva_buffer_place_data_at(struct vbva_buf_ctx *vbva_ctx,
49 const void *p, u32 len, u32 offset)
50{
51 struct vbva_buffer *vbva = vbva_ctx->vbva;
52 u32 bytes_till_boundary = vbva->data_len - offset;
53 u8 *dst = &vbva->data[offset];
54 s32 diff = len - bytes_till_boundary;
55
56 if (diff <= 0) {
57 /* Chunk will not cross buffer boundary. */
58 memcpy(dst, p, len);
59 } else {
60 /* Chunk crosses buffer boundary. */
61 memcpy(dst, p, bytes_till_boundary);
62 memcpy(&vbva->data[0], (u8 *)p + bytes_till_boundary, diff);
63 }
64}
65
66static void vbva_buffer_flush(struct gen_pool *ctx)
67{
68 struct vbva_flush *p;
69
70 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA, VBVA_FLUSH);
71 if (!p)
72 return;
73
74 p->reserved = 0;
75
76 hgsmi_buffer_submit(ctx, p);
77 hgsmi_buffer_free(ctx, p);
78}
79
80bool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
81 const void *p, u32 len)
82{
83 struct vbva_record *record;
84 struct vbva_buffer *vbva;
85 u32 available;
86
87 vbva = vbva_ctx->vbva;
88 record = vbva_ctx->record;
89
90 if (!vbva || vbva_ctx->buffer_overflow ||
91 !record || !(record->len_and_flags & VBVA_F_RECORD_PARTIAL))
92 return false;
93
94 available = vbva_buffer_available(vbva);
95
96 while (len > 0) {
97 u32 chunk = len;
98
99 if (chunk >= available) {
100 vbva_buffer_flush(ctx);
101 available = vbva_buffer_available(vbva);
102 }
103
104 if (chunk >= available) {
105 if (WARN_ON(available <= vbva->partial_write_tresh)) {
106 vbva_ctx->buffer_overflow = true;
107 return false;
108 }
109 chunk = available - vbva->partial_write_tresh;
110 }
111
112 vbva_buffer_place_data_at(vbva_ctx, p, chunk,
113 vbva->free_offset);
114
115 vbva->free_offset = (vbva->free_offset + chunk) %
116 vbva->data_len;
117 record->len_and_flags += chunk;
118 available -= chunk;
119 len -= chunk;
120 p += chunk;
121 }
122
123 return true;
124}
125
126static bool vbva_inform_host(struct vbva_buf_ctx *vbva_ctx,
127 struct gen_pool *ctx, s32 screen, bool enable)
128{
129 struct vbva_enable_ex *p;
130 bool ret;
131
132 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA, VBVA_ENABLE);
133 if (!p)
134 return false;
135
136 p->base.flags = enable ? VBVA_F_ENABLE : VBVA_F_DISABLE;
137 p->base.offset = vbva_ctx->buffer_offset;
138 p->base.result = VERR_NOT_SUPPORTED;
139 if (screen >= 0) {
140 p->base.flags |= VBVA_F_EXTENDED | VBVA_F_ABSOFFSET;
141 p->screen_id = screen;
142 }
143
144 hgsmi_buffer_submit(ctx, p);
145
146 if (enable)
147 ret = RT_SUCCESS(p->base.result);
148 else
149 ret = true;
150
151 hgsmi_buffer_free(ctx, p);
152
153 return ret;
154}
155
156bool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
157 struct vbva_buffer *vbva, s32 screen)
158{
159 bool ret = false;
160
161 memset(vbva, 0, sizeof(*vbva));
162 vbva->partial_write_tresh = 256;
163 vbva->data_len = vbva_ctx->buffer_length - sizeof(struct vbva_buffer);
164 vbva_ctx->vbva = vbva;
165
166 ret = vbva_inform_host(vbva_ctx, ctx, screen, true);
167 if (!ret)
168 vbva_disable(vbva_ctx, ctx, screen);
169
170 return ret;
171}
172
173void vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
174 s32 screen)
175{
176 vbva_ctx->buffer_overflow = false;
177 vbva_ctx->record = NULL;
178 vbva_ctx->vbva = NULL;
179
180 vbva_inform_host(vbva_ctx, ctx, screen, false);
181}
182
183bool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx,
184 struct gen_pool *ctx)
185{
186 struct vbva_record *record;
187 u32 next;
188
189 if (!vbva_ctx->vbva ||
190 !(vbva_ctx->vbva->host_flags.host_events & VBVA_F_MODE_ENABLED))
191 return false;
192
193 WARN_ON(vbva_ctx->buffer_overflow || vbva_ctx->record);
194
195 next = (vbva_ctx->vbva->record_free_index + 1) % VBVA_MAX_RECORDS;
196
197 /* Flush if all slots in the records queue are used */
198 if (next == vbva_ctx->vbva->record_first_index)
199 vbva_buffer_flush(ctx);
200
201 /* If even after flush there is no place then fail the request */
202 if (next == vbva_ctx->vbva->record_first_index)
203 return false;
204
205 record = &vbva_ctx->vbva->records[vbva_ctx->vbva->record_free_index];
206 record->len_and_flags = VBVA_F_RECORD_PARTIAL;
207 vbva_ctx->vbva->record_free_index = next;
208 /* Remember which record we are using. */
209 vbva_ctx->record = record;
210
211 return true;
212}
213
214void vbva_buffer_end_update(struct vbva_buf_ctx *vbva_ctx)
215{
216 struct vbva_record *record = vbva_ctx->record;
217
218 WARN_ON(!vbva_ctx->vbva || !record ||
219 !(record->len_and_flags & VBVA_F_RECORD_PARTIAL));
220
221 /* Mark the record completed. */
222 record->len_and_flags &= ~VBVA_F_RECORD_PARTIAL;
223
224 vbva_ctx->buffer_overflow = false;
225 vbva_ctx->record = NULL;
226}
227
228void vbva_setup_buffer_context(struct vbva_buf_ctx *vbva_ctx,
229 u32 buffer_offset, u32 buffer_length)
230{
231 vbva_ctx->buffer_offset = buffer_offset;
232 vbva_ctx->buffer_length = buffer_length;
233}
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 030bec855d86..314ffac50bb8 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -3391,7 +3391,6 @@ static int vchiq_probe(struct platform_device *pdev)
3391 struct device_node *fw_node; 3391 struct device_node *fw_node;
3392 struct rpi_firmware *fw; 3392 struct rpi_firmware *fw;
3393 int err; 3393 int err;
3394 void *ptr_err;
3395 3394
3396 fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0); 3395 fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0);
3397 if (!fw_node) { 3396 if (!fw_node) {
@@ -3427,14 +3426,14 @@ static int vchiq_probe(struct platform_device *pdev)
3427 3426
3428 /* create sysfs entries */ 3427 /* create sysfs entries */
3429 vchiq_class = class_create(THIS_MODULE, DEVICE_NAME); 3428 vchiq_class = class_create(THIS_MODULE, DEVICE_NAME);
3430 ptr_err = vchiq_class; 3429 err = PTR_ERR(vchiq_class);
3431 if (IS_ERR(ptr_err)) 3430 if (IS_ERR(vchiq_class))
3432 goto failed_class_create; 3431 goto failed_class_create;
3433 3432
3434 vchiq_dev = device_create(vchiq_class, NULL, 3433 vchiq_dev = device_create(vchiq_class, NULL,
3435 vchiq_devid, NULL, "vchiq"); 3434 vchiq_devid, NULL, "vchiq");
3436 ptr_err = vchiq_dev; 3435 err = PTR_ERR(vchiq_dev);
3437 if (IS_ERR(ptr_err)) 3436 if (IS_ERR(vchiq_dev))
3438 goto failed_device_create; 3437 goto failed_device_create;
3439 3438
3440 /* create debugfs entries */ 3439 /* create debugfs entries */
@@ -3455,7 +3454,6 @@ failed_device_create:
3455 class_destroy(vchiq_class); 3454 class_destroy(vchiq_class);
3456failed_class_create: 3455failed_class_create:
3457 cdev_del(&vchiq_cdev); 3456 cdev_del(&vchiq_cdev);
3458 err = PTR_ERR(ptr_err);
3459failed_cdev_add: 3457failed_cdev_add:
3460 unregister_chrdev_region(vchiq_devid, 1); 3458 unregister_chrdev_region(vchiq_devid, 1);
3461failed_platform_init: 3459failed_platform_init:
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index ab3e8f410444..e9391bbd4036 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -30,7 +30,7 @@ static DEFINE_IDA(nvm_ida);
30 30
31struct nvm_auth_status { 31struct nvm_auth_status {
32 struct list_head list; 32 struct list_head list;
33 uuid_be uuid; 33 uuid_t uuid;
34 u32 status; 34 u32 status;
35}; 35};
36 36
@@ -47,7 +47,7 @@ static struct nvm_auth_status *__nvm_get_auth_status(const struct tb_switch *sw)
47 struct nvm_auth_status *st; 47 struct nvm_auth_status *st;
48 48
49 list_for_each_entry(st, &nvm_auth_status_cache, list) { 49 list_for_each_entry(st, &nvm_auth_status_cache, list) {
50 if (!uuid_be_cmp(st->uuid, *sw->uuid)) 50 if (uuid_equal(&st->uuid, sw->uuid))
51 return st; 51 return st;
52 } 52 }
53 53
@@ -281,9 +281,11 @@ static struct nvmem_device *register_nvmem(struct tb_switch *sw, int id,
281 if (active) { 281 if (active) {
282 config.name = "nvm_active"; 282 config.name = "nvm_active";
283 config.reg_read = tb_switch_nvm_read; 283 config.reg_read = tb_switch_nvm_read;
284 config.read_only = true;
284 } else { 285 } else {
285 config.name = "nvm_non_active"; 286 config.name = "nvm_non_active";
286 config.reg_write = tb_switch_nvm_write; 287 config.reg_write = tb_switch_nvm_write;
288 config.root_only = true;
287 } 289 }
288 290
289 config.id = id; 291 config.id = id;
@@ -292,7 +294,6 @@ static struct nvmem_device *register_nvmem(struct tb_switch *sw, int id,
292 config.size = size; 294 config.size = size;
293 config.dev = &sw->dev; 295 config.dev = &sw->dev;
294 config.owner = THIS_MODULE; 296 config.owner = THIS_MODULE;
295 config.root_only = true;
296 config.priv = sw; 297 config.priv = sw;
297 298
298 return nvmem_register(&config); 299 return nvmem_register(&config);
@@ -1460,7 +1461,7 @@ struct tb_sw_lookup {
1460 struct tb *tb; 1461 struct tb *tb;
1461 u8 link; 1462 u8 link;
1462 u8 depth; 1463 u8 depth;
1463 const uuid_be *uuid; 1464 const uuid_t *uuid;
1464}; 1465};
1465 1466
1466static int tb_switch_match(struct device *dev, void *data) 1467static int tb_switch_match(struct device *dev, void *data)
@@ -1517,7 +1518,7 @@ struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link, u8 depth)
1517 * Returned switch has reference count increased so the caller needs to 1518 * Returned switch has reference count increased so the caller needs to
1518 * call tb_switch_put() when done with the switch. 1519 * call tb_switch_put() when done with the switch.
1519 */ 1520 */
1520struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_be *uuid) 1521struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid)
1521{ 1522{
1522 struct tb_sw_lookup lookup; 1523 struct tb_sw_lookup lookup;
1523 struct device *dev; 1524 struct device *dev;
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 3d9f64676e58..e0deee4f1eb0 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -101,7 +101,7 @@ struct tb_switch {
101 struct tb_dma_port *dma_port; 101 struct tb_dma_port *dma_port;
102 struct tb *tb; 102 struct tb *tb;
103 u64 uid; 103 u64 uid;
104 uuid_be *uuid; 104 uuid_t *uuid;
105 u16 vendor; 105 u16 vendor;
106 u16 device; 106 u16 device;
107 const char *vendor_name; 107 const char *vendor_name;
@@ -407,7 +407,7 @@ void tb_sw_set_unplugged(struct tb_switch *sw);
407struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route); 407struct tb_switch *get_switch_at_route(struct tb_switch *sw, u64 route);
408struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link, 408struct tb_switch *tb_switch_find_by_link_depth(struct tb *tb, u8 link,
409 u8 depth); 409 u8 depth);
410struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_be *uuid); 410struct tb_switch *tb_switch_find_by_uuid(struct tb *tb, const uuid_t *uuid);
411 411
412static inline unsigned int tb_switch_phy_port_from_link(unsigned int link) 412static inline unsigned int tb_switch_phy_port_from_link(unsigned int link)
413{ 413{
diff --git a/drivers/thunderbolt/tb_msgs.h b/drivers/thunderbolt/tb_msgs.h
index 85b6d33c0919..de6441e4a060 100644
--- a/drivers/thunderbolt/tb_msgs.h
+++ b/drivers/thunderbolt/tb_msgs.h
@@ -179,7 +179,7 @@ struct icm_fr_pkg_get_topology_response {
179 179
180struct icm_fr_event_device_connected { 180struct icm_fr_event_device_connected {
181 struct icm_pkg_header hdr; 181 struct icm_pkg_header hdr;
182 uuid_be ep_uuid; 182 uuid_t ep_uuid;
183 u8 connection_key; 183 u8 connection_key;
184 u8 connection_id; 184 u8 connection_id;
185 u16 link_info; 185 u16 link_info;
@@ -193,7 +193,7 @@ struct icm_fr_event_device_connected {
193 193
194struct icm_fr_pkg_approve_device { 194struct icm_fr_pkg_approve_device {
195 struct icm_pkg_header hdr; 195 struct icm_pkg_header hdr;
196 uuid_be ep_uuid; 196 uuid_t ep_uuid;
197 u8 connection_key; 197 u8 connection_key;
198 u8 connection_id; 198 u8 connection_id;
199 u16 reserved; 199 u16 reserved;
@@ -207,7 +207,7 @@ struct icm_fr_event_device_disconnected {
207 207
208struct icm_fr_pkg_add_device_key { 208struct icm_fr_pkg_add_device_key {
209 struct icm_pkg_header hdr; 209 struct icm_pkg_header hdr;
210 uuid_be ep_uuid; 210 uuid_t ep_uuid;
211 u8 connection_key; 211 u8 connection_key;
212 u8 connection_id; 212 u8 connection_id;
213 u16 reserved; 213 u16 reserved;
@@ -216,7 +216,7 @@ struct icm_fr_pkg_add_device_key {
216 216
217struct icm_fr_pkg_add_device_key_response { 217struct icm_fr_pkg_add_device_key_response {
218 struct icm_pkg_header hdr; 218 struct icm_pkg_header hdr;
219 uuid_be ep_uuid; 219 uuid_t ep_uuid;
220 u8 connection_key; 220 u8 connection_key;
221 u8 connection_id; 221 u8 connection_id;
222 u16 reserved; 222 u16 reserved;
@@ -224,7 +224,7 @@ struct icm_fr_pkg_add_device_key_response {
224 224
225struct icm_fr_pkg_challenge_device { 225struct icm_fr_pkg_challenge_device {
226 struct icm_pkg_header hdr; 226 struct icm_pkg_header hdr;
227 uuid_be ep_uuid; 227 uuid_t ep_uuid;
228 u8 connection_key; 228 u8 connection_key;
229 u8 connection_id; 229 u8 connection_id;
230 u16 reserved; 230 u16 reserved;
@@ -233,7 +233,7 @@ struct icm_fr_pkg_challenge_device {
233 233
234struct icm_fr_pkg_challenge_device_response { 234struct icm_fr_pkg_challenge_device_response {
235 struct icm_pkg_header hdr; 235 struct icm_pkg_header hdr;
236 uuid_be ep_uuid; 236 uuid_t ep_uuid;
237 u8 connection_key; 237 u8 connection_key;
238 u8 connection_id; 238 u8 connection_id;
239 u16 reserved; 239 u16 reserved;
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d1399aac05a1..284749fb0f6b 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -448,48 +448,6 @@ err:
448 return retval; 448 return retval;
449} 449}
450 450
451/**
452 * pty_open_peer - open the peer of a pty
453 * @tty: the peer of the pty being opened
454 *
455 * Open the cached dentry in tty->link, providing a safe way for userspace
456 * to get the slave end of a pty (where they have the master fd and cannot
457 * access or trust the mount namespace /dev/pts was mounted inside).
458 */
459static struct file *pty_open_peer(struct tty_struct *tty, int flags)
460{
461 if (tty->driver->subtype != PTY_TYPE_MASTER)
462 return ERR_PTR(-EIO);
463 return dentry_open(tty->link->driver_data, flags, current_cred());
464}
465
466static int pty_get_peer(struct tty_struct *tty, int flags)
467{
468 int fd = -1;
469 struct file *filp = NULL;
470 int retval = -EINVAL;
471
472 fd = get_unused_fd_flags(0);
473 if (fd < 0) {
474 retval = fd;
475 goto err;
476 }
477
478 filp = pty_open_peer(tty, flags);
479 if (IS_ERR(filp)) {
480 retval = PTR_ERR(filp);
481 goto err_put;
482 }
483
484 fd_install(fd, filp);
485 return fd;
486
487err_put:
488 put_unused_fd(fd);
489err:
490 return retval;
491}
492
493static void pty_cleanup(struct tty_struct *tty) 451static void pty_cleanup(struct tty_struct *tty)
494{ 452{
495 tty_port_put(tty->port); 453 tty_port_put(tty->port);
@@ -646,9 +604,50 @@ static inline void legacy_pty_init(void) { }
646 604
647/* Unix98 devices */ 605/* Unix98 devices */
648#ifdef CONFIG_UNIX98_PTYS 606#ifdef CONFIG_UNIX98_PTYS
649
650static struct cdev ptmx_cdev; 607static struct cdev ptmx_cdev;
651 608
609/**
610 * pty_open_peer - open the peer of a pty
611 * @tty: the peer of the pty being opened
612 *
613 * Open the cached dentry in tty->link, providing a safe way for userspace
614 * to get the slave end of a pty (where they have the master fd and cannot
615 * access or trust the mount namespace /dev/pts was mounted inside).
616 */
617static struct file *pty_open_peer(struct tty_struct *tty, int flags)
618{
619 if (tty->driver->subtype != PTY_TYPE_MASTER)
620 return ERR_PTR(-EIO);
621 return dentry_open(tty->link->driver_data, flags, current_cred());
622}
623
624static int pty_get_peer(struct tty_struct *tty, int flags)
625{
626 int fd = -1;
627 struct file *filp = NULL;
628 int retval = -EINVAL;
629
630 fd = get_unused_fd_flags(0);
631 if (fd < 0) {
632 retval = fd;
633 goto err;
634 }
635
636 filp = pty_open_peer(tty, flags);
637 if (IS_ERR(filp)) {
638 retval = PTR_ERR(filp);
639 goto err_put;
640 }
641
642 fd_install(fd, filp);
643 return fd;
644
645err_put:
646 put_unused_fd(fd);
647err:
648 return retval;
649}
650
652static int pty_unix98_ioctl(struct tty_struct *tty, 651static int pty_unix98_ioctl(struct tty_struct *tty,
653 unsigned int cmd, unsigned long arg) 652 unsigned int cmd, unsigned long arg)
654{ 653{
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 343de8c384b0..898dcb091a27 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -619,6 +619,12 @@ static unsigned int lpuart32_tx_empty(struct uart_port *port)
619 TIOCSER_TEMT : 0; 619 TIOCSER_TEMT : 0;
620} 620}
621 621
622static bool lpuart_is_32(struct lpuart_port *sport)
623{
624 return sport->port.iotype == UPIO_MEM32 ||
625 sport->port.iotype == UPIO_MEM32BE;
626}
627
622static irqreturn_t lpuart_txint(int irq, void *dev_id) 628static irqreturn_t lpuart_txint(int irq, void *dev_id)
623{ 629{
624 struct lpuart_port *sport = dev_id; 630 struct lpuart_port *sport = dev_id;
@@ -627,7 +633,7 @@ static irqreturn_t lpuart_txint(int irq, void *dev_id)
627 633
628 spin_lock_irqsave(&sport->port.lock, flags); 634 spin_lock_irqsave(&sport->port.lock, flags);
629 if (sport->port.x_char) { 635 if (sport->port.x_char) {
630 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 636 if (lpuart_is_32(sport))
631 lpuart32_write(&sport->port, sport->port.x_char, UARTDATA); 637 lpuart32_write(&sport->port, sport->port.x_char, UARTDATA);
632 else 638 else
633 writeb(sport->port.x_char, sport->port.membase + UARTDR); 639 writeb(sport->port.x_char, sport->port.membase + UARTDR);
@@ -635,14 +641,14 @@ static irqreturn_t lpuart_txint(int irq, void *dev_id)
635 } 641 }
636 642
637 if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) { 643 if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) {
638 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 644 if (lpuart_is_32(sport))
639 lpuart32_stop_tx(&sport->port); 645 lpuart32_stop_tx(&sport->port);
640 else 646 else
641 lpuart_stop_tx(&sport->port); 647 lpuart_stop_tx(&sport->port);
642 goto out; 648 goto out;
643 } 649 }
644 650
645 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 651 if (lpuart_is_32(sport))
646 lpuart32_transmit_buffer(sport); 652 lpuart32_transmit_buffer(sport);
647 else 653 else
648 lpuart_transmit_buffer(sport); 654 lpuart_transmit_buffer(sport);
@@ -1978,12 +1984,12 @@ static int __init lpuart_console_setup(struct console *co, char *options)
1978 if (options) 1984 if (options)
1979 uart_parse_options(options, &baud, &parity, &bits, &flow); 1985 uart_parse_options(options, &baud, &parity, &bits, &flow);
1980 else 1986 else
1981 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 1987 if (lpuart_is_32(sport))
1982 lpuart32_console_get_options(sport, &baud, &parity, &bits); 1988 lpuart32_console_get_options(sport, &baud, &parity, &bits);
1983 else 1989 else
1984 lpuart_console_get_options(sport, &baud, &parity, &bits); 1990 lpuart_console_get_options(sport, &baud, &parity, &bits);
1985 1991
1986 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 1992 if (lpuart_is_32(sport))
1987 lpuart32_setup_watermark(sport); 1993 lpuart32_setup_watermark(sport);
1988 else 1994 else
1989 lpuart_setup_watermark(sport); 1995 lpuart_setup_watermark(sport);
@@ -2118,7 +2124,7 @@ static int lpuart_probe(struct platform_device *pdev)
2118 } 2124 }
2119 sport->port.irq = ret; 2125 sport->port.irq = ret;
2120 sport->port.iotype = sdata->iotype; 2126 sport->port.iotype = sdata->iotype;
2121 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 2127 if (lpuart_is_32(sport))
2122 sport->port.ops = &lpuart32_pops; 2128 sport->port.ops = &lpuart32_pops;
2123 else 2129 else
2124 sport->port.ops = &lpuart_pops; 2130 sport->port.ops = &lpuart_pops;
@@ -2145,7 +2151,7 @@ static int lpuart_probe(struct platform_device *pdev)
2145 2151
2146 platform_set_drvdata(pdev, &sport->port); 2152 platform_set_drvdata(pdev, &sport->port);
2147 2153
2148 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) 2154 if (lpuart_is_32(sport))
2149 lpuart_reg.cons = LPUART32_CONSOLE; 2155 lpuart_reg.cons = LPUART32_CONSOLE;
2150 else 2156 else
2151 lpuart_reg.cons = LPUART_CONSOLE; 2157 lpuart_reg.cons = LPUART_CONSOLE;
@@ -2198,7 +2204,7 @@ static int lpuart_suspend(struct device *dev)
2198 struct lpuart_port *sport = dev_get_drvdata(dev); 2204 struct lpuart_port *sport = dev_get_drvdata(dev);
2199 unsigned long temp; 2205 unsigned long temp;
2200 2206
2201 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) { 2207 if (lpuart_is_32(sport)) {
2202 /* disable Rx/Tx and interrupts */ 2208 /* disable Rx/Tx and interrupts */
2203 temp = lpuart32_read(&sport->port, UARTCTRL); 2209 temp = lpuart32_read(&sport->port, UARTCTRL);
2204 temp &= ~(UARTCTRL_TE | UARTCTRL_TIE | UARTCTRL_TCIE); 2210 temp &= ~(UARTCTRL_TE | UARTCTRL_TIE | UARTCTRL_TCIE);
@@ -2249,7 +2255,7 @@ static int lpuart_resume(struct device *dev)
2249 if (sport->port.suspended && !sport->port.irq_wake) 2255 if (sport->port.suspended && !sport->port.irq_wake)
2250 clk_prepare_enable(sport->clk); 2256 clk_prepare_enable(sport->clk);
2251 2257
2252 if (sport->port.iotype & (UPIO_MEM32 | UPIO_MEM32BE)) { 2258 if (lpuart_is_32(sport)) {
2253 lpuart32_setup_watermark(sport); 2259 lpuart32_setup_watermark(sport);
2254 temp = lpuart32_read(&sport->port, UARTCTRL); 2260 temp = lpuart32_read(&sport->port, UARTCTRL);
2255 temp |= (UARTCTRL_RIE | UARTCTRL_TIE | UARTCTRL_RE | 2261 temp |= (UARTCTRL_RIE | UARTCTRL_TIE | UARTCTRL_RE |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 9e3162bf3bd1..80934e7bd67f 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -186,11 +186,6 @@
186 186
187#define UART_NR 8 187#define UART_NR 8
188 188
189/* RX DMA buffer periods */
190#define RX_DMA_PERIODS 4
191#define RX_BUF_SIZE (PAGE_SIZE)
192
193
194/* i.MX21 type uart runs on all i.mx except i.MX1 and i.MX6q */ 189/* i.MX21 type uart runs on all i.mx except i.MX1 and i.MX6q */
195enum imx_uart_type { 190enum imx_uart_type {
196 IMX1_UART, 191 IMX1_UART,
@@ -226,7 +221,6 @@ struct imx_port {
226 struct dma_chan *dma_chan_rx, *dma_chan_tx; 221 struct dma_chan *dma_chan_rx, *dma_chan_tx;
227 struct scatterlist rx_sgl, tx_sgl[2]; 222 struct scatterlist rx_sgl, tx_sgl[2];
228 void *rx_buf; 223 void *rx_buf;
229 unsigned int rx_buf_size;
230 struct circ_buf rx_ring; 224 struct circ_buf rx_ring;
231 unsigned int rx_periods; 225 unsigned int rx_periods;
232 dma_cookie_t rx_cookie; 226 dma_cookie_t rx_cookie;
@@ -464,7 +458,7 @@ static inline void imx_transmit_buffer(struct imx_port *sport)
464 } 458 }
465 } 459 }
466 460
467 while (!uart_circ_empty(xmit) && 461 while (!uart_circ_empty(xmit) && !sport->dma_is_txing &&
468 !(readl(sport->port.membase + uts_reg(sport)) & UTS_TXFULL)) { 462 !(readl(sport->port.membase + uts_reg(sport)) & UTS_TXFULL)) {
469 /* send xmit->buf[xmit->tail] 463 /* send xmit->buf[xmit->tail]
470 * out the port here */ 464 * out the port here */
@@ -967,6 +961,8 @@ static void imx_timeout(unsigned long data)
967 } 961 }
968} 962}
969 963
964#define RX_BUF_SIZE (PAGE_SIZE)
965
970/* 966/*
971 * There are two kinds of RX DMA interrupts(such as in the MX6Q): 967 * There are two kinds of RX DMA interrupts(such as in the MX6Q):
972 * [1] the RX DMA buffer is full. 968 * [1] the RX DMA buffer is full.
@@ -1049,6 +1045,9 @@ static void dma_rx_callback(void *data)
1049 } 1045 }
1050} 1046}
1051 1047
1048/* RX DMA buffer periods */
1049#define RX_DMA_PERIODS 4
1050
1052static int start_rx_dma(struct imx_port *sport) 1051static int start_rx_dma(struct imx_port *sport)
1053{ 1052{
1054 struct scatterlist *sgl = &sport->rx_sgl; 1053 struct scatterlist *sgl = &sport->rx_sgl;
@@ -1059,8 +1058,9 @@ static int start_rx_dma(struct imx_port *sport)
1059 1058
1060 sport->rx_ring.head = 0; 1059 sport->rx_ring.head = 0;
1061 sport->rx_ring.tail = 0; 1060 sport->rx_ring.tail = 0;
1061 sport->rx_periods = RX_DMA_PERIODS;
1062 1062
1063 sg_init_one(sgl, sport->rx_buf, sport->rx_buf_size); 1063 sg_init_one(sgl, sport->rx_buf, RX_BUF_SIZE);
1064 ret = dma_map_sg(dev, sgl, 1, DMA_FROM_DEVICE); 1064 ret = dma_map_sg(dev, sgl, 1, DMA_FROM_DEVICE);
1065 if (ret == 0) { 1065 if (ret == 0) {
1066 dev_err(dev, "DMA mapping error for RX.\n"); 1066 dev_err(dev, "DMA mapping error for RX.\n");
@@ -1171,7 +1171,7 @@ static int imx_uart_dma_init(struct imx_port *sport)
1171 goto err; 1171 goto err;
1172 } 1172 }
1173 1173
1174 sport->rx_buf = kzalloc(sport->rx_buf_size, GFP_KERNEL); 1174 sport->rx_buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
1175 if (!sport->rx_buf) { 1175 if (!sport->rx_buf) {
1176 ret = -ENOMEM; 1176 ret = -ENOMEM;
1177 goto err; 1177 goto err;
@@ -2036,7 +2036,6 @@ static int serial_imx_probe_dt(struct imx_port *sport,
2036{ 2036{
2037 struct device_node *np = pdev->dev.of_node; 2037 struct device_node *np = pdev->dev.of_node;
2038 int ret; 2038 int ret;
2039 u32 dma_buf_size[2];
2040 2039
2041 sport->devdata = of_device_get_match_data(&pdev->dev); 2040 sport->devdata = of_device_get_match_data(&pdev->dev);
2042 if (!sport->devdata) 2041 if (!sport->devdata)
@@ -2060,14 +2059,6 @@ static int serial_imx_probe_dt(struct imx_port *sport,
2060 if (of_get_property(np, "rts-gpios", NULL)) 2059 if (of_get_property(np, "rts-gpios", NULL))
2061 sport->have_rtsgpio = 1; 2060 sport->have_rtsgpio = 1;
2062 2061
2063 if (!of_property_read_u32_array(np, "fsl,dma-size", dma_buf_size, 2)) {
2064 sport->rx_buf_size = dma_buf_size[0] * dma_buf_size[1];
2065 sport->rx_periods = dma_buf_size[1];
2066 } else {
2067 sport->rx_buf_size = RX_BUF_SIZE;
2068 sport->rx_periods = RX_DMA_PERIODS;
2069 }
2070
2071 return 0; 2062 return 0;
2072} 2063}
2073#else 2064#else
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index da5ddfc14778..e08b16b070c0 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1085,10 +1085,12 @@ static ssize_t rx_trigger_store(struct device *dev,
1085{ 1085{
1086 struct uart_port *port = dev_get_drvdata(dev); 1086 struct uart_port *port = dev_get_drvdata(dev);
1087 struct sci_port *sci = to_sci_port(port); 1087 struct sci_port *sci = to_sci_port(port);
1088 int ret;
1088 long r; 1089 long r;
1089 1090
1090 if (kstrtol(buf, 0, &r) == -EINVAL) 1091 ret = kstrtol(buf, 0, &r);
1091 return -EINVAL; 1092 if (ret)
1093 return ret;
1092 1094
1093 sci->rx_trigger = scif_set_rtrg(port, r); 1095 sci->rx_trigger = scif_set_rtrg(port, r);
1094 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) 1096 if (port->type == PORT_SCIFA || port->type == PORT_SCIFB)
@@ -1116,10 +1118,12 @@ static ssize_t rx_fifo_timeout_store(struct device *dev,
1116{ 1118{
1117 struct uart_port *port = dev_get_drvdata(dev); 1119 struct uart_port *port = dev_get_drvdata(dev);
1118 struct sci_port *sci = to_sci_port(port); 1120 struct sci_port *sci = to_sci_port(port);
1121 int ret;
1119 long r; 1122 long r;
1120 1123
1121 if (kstrtol(buf, 0, &r) == -EINVAL) 1124 ret = kstrtol(buf, 0, &r);
1122 return -EINVAL; 1125 if (ret)
1126 return ret;
1123 sci->rx_fifo_timeout = r; 1127 sci->rx_fifo_timeout = r;
1124 scif_set_rtrg(port, 1); 1128 scif_set_rtrg(port, 1);
1125 if (r > 0) 1129 if (r > 0)
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index f5335be344f6..6b0ca65027d0 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -758,6 +758,7 @@ static int asc_init_port(struct asc_port *ascport,
758 if (IS_ERR(ascport->pinctrl)) { 758 if (IS_ERR(ascport->pinctrl)) {
759 ret = PTR_ERR(ascport->pinctrl); 759 ret = PTR_ERR(ascport->pinctrl);
760 dev_err(&pdev->dev, "Failed to get Pinctrl: %d\n", ret); 760 dev_err(&pdev->dev, "Failed to get Pinctrl: %d\n", ret);
761 return ret;
761 } 762 }
762 763
763 ascport->states[DEFAULT] = 764 ascport->states[DEFAULT] =
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 5357d83bbda2..5e056064259c 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1829,6 +1829,9 @@ static const struct usb_device_id acm_ids[] = {
1829 { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */ 1829 { USB_DEVICE(0x1576, 0x03b1), /* Maretron USB100 */
1830 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ 1830 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1831 }, 1831 },
1832 { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */
1833 .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1834 },
1832 1835
1833 { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ 1836 { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */
1834 .driver_info = CLEAR_HALT_CONDITIONS, 1837 .driver_info = CLEAR_HALT_CONDITIONS,
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index bc3b3fda5000..c4066cd77e47 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3573,6 +3573,9 @@ irq_retry:
3573 /* Report disconnection if it is not already done. */ 3573 /* Report disconnection if it is not already done. */
3574 dwc2_hsotg_disconnect(hsotg); 3574 dwc2_hsotg_disconnect(hsotg);
3575 3575
3576 /* Reset device address to zero */
3577 __bic32(hsotg->regs + DCFG, DCFG_DEVADDR_MASK);
3578
3576 if (usb_status & GOTGCTL_BSESVLD && connected) 3579 if (usb_status & GOTGCTL_BSESVLD && connected)
3577 dwc2_hsotg_core_init_disconnected(hsotg, true); 3580 dwc2_hsotg_core_init_disconnected(hsotg, true);
3578 } 3581 }
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 326b302fc440..03474d3575ab 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -766,15 +766,15 @@ static int dwc3_core_init(struct dwc3 *dwc)
766 dwc->maximum_speed = USB_SPEED_HIGH; 766 dwc->maximum_speed = USB_SPEED_HIGH;
767 } 767 }
768 768
769 ret = dwc3_core_soft_reset(dwc); 769 ret = dwc3_core_get_phy(dwc);
770 if (ret) 770 if (ret)
771 goto err0; 771 goto err0;
772 772
773 ret = dwc3_phy_setup(dwc); 773 ret = dwc3_core_soft_reset(dwc);
774 if (ret) 774 if (ret)
775 goto err0; 775 goto err0;
776 776
777 ret = dwc3_core_get_phy(dwc); 777 ret = dwc3_phy_setup(dwc);
778 if (ret) 778 if (ret)
779 goto err0; 779 goto err0;
780 780
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 98926504b55b..f5aaa0cf3873 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -512,15 +512,6 @@ static int dwc3_omap_probe(struct platform_device *pdev)
512 512
513 /* check the DMA Status */ 513 /* check the DMA Status */
514 reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG); 514 reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
515 irq_set_status_flags(omap->irq, IRQ_NOAUTOEN);
516 ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
517 dwc3_omap_interrupt_thread, IRQF_SHARED,
518 "dwc3-omap", omap);
519 if (ret) {
520 dev_err(dev, "failed to request IRQ #%d --> %d\n",
521 omap->irq, ret);
522 goto err1;
523 }
524 515
525 ret = dwc3_omap_extcon_register(omap); 516 ret = dwc3_omap_extcon_register(omap);
526 if (ret < 0) 517 if (ret < 0)
@@ -532,8 +523,15 @@ static int dwc3_omap_probe(struct platform_device *pdev)
532 goto err1; 523 goto err1;
533 } 524 }
534 525
526 ret = devm_request_threaded_irq(dev, omap->irq, dwc3_omap_interrupt,
527 dwc3_omap_interrupt_thread, IRQF_SHARED,
528 "dwc3-omap", omap);
529 if (ret) {
530 dev_err(dev, "failed to request IRQ #%d --> %d\n",
531 omap->irq, ret);
532 goto err1;
533 }
535 dwc3_omap_enable_irqs(omap); 534 dwc3_omap_enable_irqs(omap);
536 enable_irq(omap->irq);
537 return 0; 535 return 0;
538 536
539err1: 537err1:
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 9e41605a276b..6b299c7b7656 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -191,14 +191,16 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
191 191
192 req->started = false; 192 req->started = false;
193 list_del(&req->list); 193 list_del(&req->list);
194 req->trb = NULL;
195 req->remaining = 0; 194 req->remaining = 0;
196 195
197 if (req->request.status == -EINPROGRESS) 196 if (req->request.status == -EINPROGRESS)
198 req->request.status = status; 197 req->request.status = status;
199 198
200 usb_gadget_unmap_request_by_dev(dwc->sysdev, 199 if (req->trb)
201 &req->request, req->direction); 200 usb_gadget_unmap_request_by_dev(dwc->sysdev,
201 &req->request, req->direction);
202
203 req->trb = NULL;
202 204
203 trace_dwc3_gadget_giveback(req); 205 trace_dwc3_gadget_giveback(req);
204 206
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index e80b9c123a9d..f95bddd6513f 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -2490,7 +2490,7 @@ static int fsg_main_thread(void *common_)
2490 int i; 2490 int i;
2491 2491
2492 down_write(&common->filesem); 2492 down_write(&common->filesem);
2493 for (i = 0; i < ARRAY_SIZE(common->luns); --i) { 2493 for (i = 0; i < ARRAY_SIZE(common->luns); i++) {
2494 struct fsg_lun *curlun = common->luns[i]; 2494 struct fsg_lun *curlun = common->luns[i];
2495 if (!curlun || !fsg_lun_is_open(curlun)) 2495 if (!curlun || !fsg_lun_is_open(curlun))
2496 continue; 2496 continue;
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 8656f84e17d9..29efbedc91f9 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -92,9 +92,9 @@ static struct uac_input_terminal_descriptor usb_out_it_desc = {
92 .bDescriptorType = USB_DT_CS_INTERFACE, 92 .bDescriptorType = USB_DT_CS_INTERFACE,
93 .bDescriptorSubtype = UAC_INPUT_TERMINAL, 93 .bDescriptorSubtype = UAC_INPUT_TERMINAL,
94 .bTerminalID = USB_OUT_IT_ID, 94 .bTerminalID = USB_OUT_IT_ID,
95 .wTerminalType = UAC_TERMINAL_STREAMING, 95 .wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING),
96 .bAssocTerminal = 0, 96 .bAssocTerminal = 0,
97 .wChannelConfig = 0x3, 97 .wChannelConfig = cpu_to_le16(0x3),
98}; 98};
99 99
100#define IO_OUT_OT_ID 2 100#define IO_OUT_OT_ID 2
@@ -103,7 +103,7 @@ static struct uac1_output_terminal_descriptor io_out_ot_desc = {
103 .bDescriptorType = USB_DT_CS_INTERFACE, 103 .bDescriptorType = USB_DT_CS_INTERFACE,
104 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, 104 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
105 .bTerminalID = IO_OUT_OT_ID, 105 .bTerminalID = IO_OUT_OT_ID,
106 .wTerminalType = UAC_OUTPUT_TERMINAL_SPEAKER, 106 .wTerminalType = cpu_to_le16(UAC_OUTPUT_TERMINAL_SPEAKER),
107 .bAssocTerminal = 0, 107 .bAssocTerminal = 0,
108 .bSourceID = USB_OUT_IT_ID, 108 .bSourceID = USB_OUT_IT_ID,
109}; 109};
@@ -114,9 +114,9 @@ static struct uac_input_terminal_descriptor io_in_it_desc = {
114 .bDescriptorType = USB_DT_CS_INTERFACE, 114 .bDescriptorType = USB_DT_CS_INTERFACE,
115 .bDescriptorSubtype = UAC_INPUT_TERMINAL, 115 .bDescriptorSubtype = UAC_INPUT_TERMINAL,
116 .bTerminalID = IO_IN_IT_ID, 116 .bTerminalID = IO_IN_IT_ID,
117 .wTerminalType = UAC_INPUT_TERMINAL_MICROPHONE, 117 .wTerminalType = cpu_to_le16(UAC_INPUT_TERMINAL_MICROPHONE),
118 .bAssocTerminal = 0, 118 .bAssocTerminal = 0,
119 .wChannelConfig = 0x3, 119 .wChannelConfig = cpu_to_le16(0x3),
120}; 120};
121 121
122#define USB_IN_OT_ID 4 122#define USB_IN_OT_ID 4
@@ -125,7 +125,7 @@ static struct uac1_output_terminal_descriptor usb_in_ot_desc = {
125 .bDescriptorType = USB_DT_CS_INTERFACE, 125 .bDescriptorType = USB_DT_CS_INTERFACE,
126 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, 126 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL,
127 .bTerminalID = USB_IN_OT_ID, 127 .bTerminalID = USB_IN_OT_ID,
128 .wTerminalType = UAC_TERMINAL_STREAMING, 128 .wTerminalType = cpu_to_le16(UAC_TERMINAL_STREAMING),
129 .bAssocTerminal = 0, 129 .bAssocTerminal = 0,
130 .bSourceID = IO_IN_IT_ID, 130 .bSourceID = IO_IN_IT_ID,
131}; 131};
@@ -174,7 +174,7 @@ static struct uac1_as_header_descriptor as_out_header_desc = {
174 .bDescriptorSubtype = UAC_AS_GENERAL, 174 .bDescriptorSubtype = UAC_AS_GENERAL,
175 .bTerminalLink = USB_OUT_IT_ID, 175 .bTerminalLink = USB_OUT_IT_ID,
176 .bDelay = 1, 176 .bDelay = 1,
177 .wFormatTag = UAC_FORMAT_TYPE_I_PCM, 177 .wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM),
178}; 178};
179 179
180static struct uac1_as_header_descriptor as_in_header_desc = { 180static struct uac1_as_header_descriptor as_in_header_desc = {
@@ -183,7 +183,7 @@ static struct uac1_as_header_descriptor as_in_header_desc = {
183 .bDescriptorSubtype = UAC_AS_GENERAL, 183 .bDescriptorSubtype = UAC_AS_GENERAL,
184 .bTerminalLink = USB_IN_OT_ID, 184 .bTerminalLink = USB_IN_OT_ID,
185 .bDelay = 1, 185 .bDelay = 1,
186 .wFormatTag = UAC_FORMAT_TYPE_I_PCM, 186 .wFormatTag = cpu_to_le16(UAC_FORMAT_TYPE_I_PCM),
187}; 187};
188 188
189DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1); 189DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(1);
@@ -606,8 +606,8 @@ static int f_audio_bind(struct usb_configuration *c, struct usb_function *f)
606 if (status) 606 if (status)
607 goto fail; 607 goto fail;
608 608
609 audio->out_ep_maxpsize = as_out_ep_desc.wMaxPacketSize; 609 audio->out_ep_maxpsize = le16_to_cpu(as_out_ep_desc.wMaxPacketSize);
610 audio->in_ep_maxpsize = as_in_ep_desc.wMaxPacketSize; 610 audio->in_ep_maxpsize = le16_to_cpu(as_in_ep_desc.wMaxPacketSize);
611 audio->params.c_chmask = audio_opts->c_chmask; 611 audio->params.c_chmask = audio_opts->c_chmask;
612 audio->params.c_srate = audio_opts->c_srate; 612 audio->params.c_srate = audio_opts->c_srate;
613 audio->params.c_ssize = audio_opts->c_ssize; 613 audio->params.c_ssize = audio_opts->c_ssize;
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 9082ce261e70..f05c3f3e6103 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -168,7 +168,7 @@ static struct uac2_input_terminal_descriptor usb_out_it_desc = {
168 .bAssocTerminal = 0, 168 .bAssocTerminal = 0,
169 .bCSourceID = USB_OUT_CLK_ID, 169 .bCSourceID = USB_OUT_CLK_ID,
170 .iChannelNames = 0, 170 .iChannelNames = 0,
171 .bmControls = (CONTROL_RDWR << COPY_CTRL), 171 .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
172}; 172};
173 173
174/* Input Terminal for I/O-In */ 174/* Input Terminal for I/O-In */
@@ -182,7 +182,7 @@ static struct uac2_input_terminal_descriptor io_in_it_desc = {
182 .bAssocTerminal = 0, 182 .bAssocTerminal = 0,
183 .bCSourceID = USB_IN_CLK_ID, 183 .bCSourceID = USB_IN_CLK_ID,
184 .iChannelNames = 0, 184 .iChannelNames = 0,
185 .bmControls = (CONTROL_RDWR << COPY_CTRL), 185 .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
186}; 186};
187 187
188/* Ouput Terminal for USB_IN */ 188/* Ouput Terminal for USB_IN */
@@ -196,7 +196,7 @@ static struct uac2_output_terminal_descriptor usb_in_ot_desc = {
196 .bAssocTerminal = 0, 196 .bAssocTerminal = 0,
197 .bSourceID = IO_IN_IT_ID, 197 .bSourceID = IO_IN_IT_ID,
198 .bCSourceID = USB_IN_CLK_ID, 198 .bCSourceID = USB_IN_CLK_ID,
199 .bmControls = (CONTROL_RDWR << COPY_CTRL), 199 .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
200}; 200};
201 201
202/* Ouput Terminal for I/O-Out */ 202/* Ouput Terminal for I/O-Out */
@@ -210,7 +210,7 @@ static struct uac2_output_terminal_descriptor io_out_ot_desc = {
210 .bAssocTerminal = 0, 210 .bAssocTerminal = 0,
211 .bSourceID = USB_OUT_IT_ID, 211 .bSourceID = USB_OUT_IT_ID,
212 .bCSourceID = USB_OUT_CLK_ID, 212 .bCSourceID = USB_OUT_CLK_ID,
213 .bmControls = (CONTROL_RDWR << COPY_CTRL), 213 .bmControls = cpu_to_le16(CONTROL_RDWR << COPY_CTRL),
214}; 214};
215 215
216static struct uac2_ac_header_descriptor ac_hdr_desc = { 216static struct uac2_ac_header_descriptor ac_hdr_desc = {
@@ -220,9 +220,10 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = {
220 .bDescriptorSubtype = UAC_MS_HEADER, 220 .bDescriptorSubtype = UAC_MS_HEADER,
221 .bcdADC = cpu_to_le16(0x200), 221 .bcdADC = cpu_to_le16(0x200),
222 .bCategory = UAC2_FUNCTION_IO_BOX, 222 .bCategory = UAC2_FUNCTION_IO_BOX,
223 .wTotalLength = sizeof in_clk_src_desc + sizeof out_clk_src_desc 223 .wTotalLength = cpu_to_le16(sizeof in_clk_src_desc
224 + sizeof usb_out_it_desc + sizeof io_in_it_desc 224 + sizeof out_clk_src_desc + sizeof usb_out_it_desc
225 + sizeof usb_in_ot_desc + sizeof io_out_ot_desc, 225 + sizeof io_in_it_desc + sizeof usb_in_ot_desc
226 + sizeof io_out_ot_desc),
226 .bmControls = 0, 227 .bmControls = 0,
227}; 228};
228 229
@@ -569,10 +570,12 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn)
569 return ret; 570 return ret;
570 } 571 }
571 572
572 agdev->in_ep_maxpsize = max(fs_epin_desc.wMaxPacketSize, 573 agdev->in_ep_maxpsize = max_t(u16,
573 hs_epin_desc.wMaxPacketSize); 574 le16_to_cpu(fs_epin_desc.wMaxPacketSize),
574 agdev->out_ep_maxpsize = max(fs_epout_desc.wMaxPacketSize, 575 le16_to_cpu(hs_epin_desc.wMaxPacketSize));
575 hs_epout_desc.wMaxPacketSize); 576 agdev->out_ep_maxpsize = max_t(u16,
577 le16_to_cpu(fs_epout_desc.wMaxPacketSize),
578 le16_to_cpu(hs_epout_desc.wMaxPacketSize));
576 579
577 hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress; 580 hs_epout_desc.bEndpointAddress = fs_epout_desc.bEndpointAddress;
578 hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress; 581 hs_epin_desc.bEndpointAddress = fs_epin_desc.bEndpointAddress;
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 9ffb11ec9ed9..7cd5c969fcbe 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -192,7 +192,7 @@ config USB_RENESAS_USBHS_UDC
192config USB_RENESAS_USB3 192config USB_RENESAS_USB3
193 tristate 'Renesas USB3.0 Peripheral controller' 193 tristate 'Renesas USB3.0 Peripheral controller'
194 depends on ARCH_RENESAS || COMPILE_TEST 194 depends on ARCH_RENESAS || COMPILE_TEST
195 depends on EXTCON 195 depends on EXTCON && HAS_DMA
196 help 196 help
197 Renesas USB3.0 Peripheral controller is a USB peripheral controller 197 Renesas USB3.0 Peripheral controller is a USB peripheral controller
198 that supports super, high, and full speed USB 3.0 data transfers. 198 that supports super, high, and full speed USB 3.0 data transfers.
@@ -257,6 +257,7 @@ config USB_MV_U3D
257 257
258config USB_SNP_CORE 258config USB_SNP_CORE
259 depends on (USB_AMD5536UDC || USB_SNP_UDC_PLAT) 259 depends on (USB_AMD5536UDC || USB_SNP_UDC_PLAT)
260 depends on HAS_DMA
260 tristate 261 tristate
261 help 262 help
262 This enables core driver support for Synopsys USB 2.0 Device 263 This enables core driver support for Synopsys USB 2.0 Device
@@ -271,7 +272,7 @@ config USB_SNP_CORE
271 272
272config USB_SNP_UDC_PLAT 273config USB_SNP_UDC_PLAT
273 tristate "Synopsys USB 2.0 Device controller" 274 tristate "Synopsys USB 2.0 Device controller"
274 depends on (USB_GADGET && OF) 275 depends on USB_GADGET && OF && HAS_DMA
275 select USB_GADGET_DUALSPEED 276 select USB_GADGET_DUALSPEED
276 select USB_SNP_CORE 277 select USB_SNP_CORE
277 default ARCH_BCM_IPROC 278 default ARCH_BCM_IPROC
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index d8278322d5ac..62dc9c7798e7 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -89,6 +89,9 @@
89 89
90/* USB_COM_CON */ 90/* USB_COM_CON */
91#define USB_COM_CON_CONF BIT(24) 91#define USB_COM_CON_CONF BIT(24)
92#define USB_COM_CON_PN_WDATAIF_NL BIT(23)
93#define USB_COM_CON_PN_RDATAIF_NL BIT(22)
94#define USB_COM_CON_PN_LSTTR_PP BIT(21)
92#define USB_COM_CON_SPD_MODE BIT(17) 95#define USB_COM_CON_SPD_MODE BIT(17)
93#define USB_COM_CON_EP0_EN BIT(16) 96#define USB_COM_CON_EP0_EN BIT(16)
94#define USB_COM_CON_DEV_ADDR_SHIFT 8 97#define USB_COM_CON_DEV_ADDR_SHIFT 8
@@ -686,6 +689,9 @@ static void renesas_usb3_init_controller(struct renesas_usb3 *usb3)
686{ 689{
687 usb3_init_axi_bridge(usb3); 690 usb3_init_axi_bridge(usb3);
688 usb3_init_epc_registers(usb3); 691 usb3_init_epc_registers(usb3);
692 usb3_set_bit(usb3, USB_COM_CON_PN_WDATAIF_NL |
693 USB_COM_CON_PN_RDATAIF_NL | USB_COM_CON_PN_LSTTR_PP,
694 USB3_USB_COM_CON);
689 usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA); 695 usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_STA);
690 usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA); 696 usb3_write(usb3, USB_OTG_IDMON, USB3_USB_OTG_INT_ENA);
691 697
@@ -1369,7 +1375,7 @@ static int renesas_usb3_dma_free_prd(struct renesas_usb3 *usb3,
1369 1375
1370 usb3_for_each_dma(usb3, dma, i) { 1376 usb3_for_each_dma(usb3, dma, i) {
1371 if (dma->prd) { 1377 if (dma->prd) {
1372 dma_free_coherent(dev, USB3_DMA_MAX_XFER_SIZE, 1378 dma_free_coherent(dev, USB3_DMA_PRD_SIZE,
1373 dma->prd, dma->prd_dma); 1379 dma->prd, dma->prd_dma);
1374 dma->prd = NULL; 1380 dma->prd = NULL;
1375 } 1381 }
@@ -1409,12 +1415,12 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep,
1409 int ret = -EAGAIN; 1415 int ret = -EAGAIN;
1410 u32 enable_bits = 0; 1416 u32 enable_bits = 0;
1411 1417
1418 spin_lock_irqsave(&usb3->lock, flags);
1412 if (usb3_ep->halt || usb3_ep->started) 1419 if (usb3_ep->halt || usb3_ep->started)
1413 return; 1420 goto out;
1414 if (usb3_req != usb3_req_first) 1421 if (usb3_req != usb3_req_first)
1415 return; 1422 goto out;
1416 1423
1417 spin_lock_irqsave(&usb3->lock, flags);
1418 if (usb3_pn_change(usb3, usb3_ep->num) < 0) 1424 if (usb3_pn_change(usb3, usb3_ep->num) < 0)
1419 goto out; 1425 goto out;
1420 1426
diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c
index 2e11f19e07ae..f7b4d0f159e4 100644
--- a/drivers/usb/gadget/udc/snps_udc_plat.c
+++ b/drivers/usb/gadget/udc/snps_udc_plat.c
@@ -28,7 +28,7 @@
28/* description */ 28/* description */
29#define UDC_MOD_DESCRIPTION "Synopsys UDC platform driver" 29#define UDC_MOD_DESCRIPTION "Synopsys UDC platform driver"
30 30
31void start_udc(struct udc *udc) 31static void start_udc(struct udc *udc)
32{ 32{
33 if (udc->driver) { 33 if (udc->driver) {
34 dev_info(udc->dev, "Connecting...\n"); 34 dev_info(udc->dev, "Connecting...\n");
@@ -38,7 +38,7 @@ void start_udc(struct udc *udc)
38 } 38 }
39} 39}
40 40
41void stop_udc(struct udc *udc) 41static void stop_udc(struct udc *udc)
42{ 42{
43 int tmp; 43 int tmp;
44 u32 reg; 44 u32 reg;
@@ -76,7 +76,7 @@ void stop_udc(struct udc *udc)
76 dev_info(udc->dev, "Device disconnected\n"); 76 dev_info(udc->dev, "Device disconnected\n");
77} 77}
78 78
79void udc_drd_work(struct work_struct *work) 79static void udc_drd_work(struct work_struct *work)
80{ 80{
81 struct udc *udc; 81 struct udc *udc;
82 82
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index a9a1e4c40480..c8989c62a262 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -77,6 +77,16 @@
77#define USB_INTEL_USB3_PSSEN 0xD8 77#define USB_INTEL_USB3_PSSEN 0xD8
78#define USB_INTEL_USB3PRM 0xDC 78#define USB_INTEL_USB3PRM 0xDC
79 79
80/* ASMEDIA quirk use */
81#define ASMT_DATA_WRITE0_REG 0xF8
82#define ASMT_DATA_WRITE1_REG 0xFC
83#define ASMT_CONTROL_REG 0xE0
84#define ASMT_CONTROL_WRITE_BIT 0x02
85#define ASMT_WRITEREG_CMD 0x10423
86#define ASMT_FLOWCTL_ADDR 0xFA30
87#define ASMT_FLOWCTL_DATA 0xBA
88#define ASMT_PSEUDO_DATA 0
89
80/* 90/*
81 * amd_chipset_gen values represent AMD different chipset generations 91 * amd_chipset_gen values represent AMD different chipset generations
82 */ 92 */
@@ -412,6 +422,50 @@ void usb_amd_quirk_pll_disable(void)
412} 422}
413EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable); 423EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable);
414 424
425static int usb_asmedia_wait_write(struct pci_dev *pdev)
426{
427 unsigned long retry_count;
428 unsigned char value;
429
430 for (retry_count = 1000; retry_count > 0; --retry_count) {
431
432 pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
433
434 if (value == 0xff) {
435 dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
436 return -EIO;
437 }
438
439 if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
440 return 0;
441
442 usleep_range(40, 60);
443 }
444
445 dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
446 return -ETIMEDOUT;
447}
448
449void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
450{
451 if (usb_asmedia_wait_write(pdev) != 0)
452 return;
453
454 /* send command and address to device */
455 pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
456 pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
457 pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
458
459 if (usb_asmedia_wait_write(pdev) != 0)
460 return;
461
462 /* send data to device */
463 pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
464 pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
465 pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
466}
467EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
468
415void usb_amd_quirk_pll_enable(void) 469void usb_amd_quirk_pll_enable(void)
416{ 470{
417 usb_amd_quirk_pll(0); 471 usb_amd_quirk_pll(0);
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index 0222195bd5b0..655994480198 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -11,6 +11,7 @@ bool usb_amd_prefetch_quirk(void);
11void usb_amd_dev_put(void); 11void usb_amd_dev_put(void);
12void usb_amd_quirk_pll_disable(void); 12void usb_amd_quirk_pll_disable(void);
13void usb_amd_quirk_pll_enable(void); 13void usb_amd_quirk_pll_enable(void);
14void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
14void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev); 15void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
15void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); 16void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
16void sb800_prefetch(struct device *dev, int on); 17void sb800_prefetch(struct device *dev, int on);
@@ -18,6 +19,7 @@ void sb800_prefetch(struct device *dev, int on);
18struct pci_dev; 19struct pci_dev;
19static inline void usb_amd_quirk_pll_disable(void) {} 20static inline void usb_amd_quirk_pll_disable(void) {}
20static inline void usb_amd_quirk_pll_enable(void) {} 21static inline void usb_amd_quirk_pll_enable(void) {}
22static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
21static inline void usb_amd_dev_put(void) {} 23static inline void usb_amd_dev_put(void) {}
22static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} 24static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
23static inline void sb800_prefetch(struct device *dev, int on) {} 25static inline void sb800_prefetch(struct device *dev, int on) {}
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 1adae9eab831..00721e8807ab 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -398,14 +398,21 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
398 spin_lock_irqsave(&xhci->lock, flags); 398 spin_lock_irqsave(&xhci->lock, flags);
399 for (i = LAST_EP_INDEX; i > 0; i--) { 399 for (i = LAST_EP_INDEX; i > 0; i--) {
400 if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) { 400 if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue) {
401 struct xhci_ep_ctx *ep_ctx;
401 struct xhci_command *command; 402 struct xhci_command *command;
403
404 ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->out_ctx, i);
405
406 /* Check ep is running, required by AMD SNPS 3.1 xHC */
407 if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING)
408 continue;
409
402 command = xhci_alloc_command(xhci, false, false, 410 command = xhci_alloc_command(xhci, false, false,
403 GFP_NOWAIT); 411 GFP_NOWAIT);
404 if (!command) { 412 if (!command) {
405 spin_unlock_irqrestore(&xhci->lock, flags); 413 spin_unlock_irqrestore(&xhci->lock, flags);
406 xhci_free_command(xhci, cmd); 414 xhci_free_command(xhci, cmd);
407 return -ENOMEM; 415 return -ENOMEM;
408
409 } 416 }
410 xhci_queue_stop_endpoint(xhci, command, slot_id, i, 417 xhci_queue_stop_endpoint(xhci, command, slot_id, i,
411 suspend); 418 suspend);
@@ -603,12 +610,14 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci,
603 610
604 /* Disable all Device Slots */ 611 /* Disable all Device Slots */
605 xhci_dbg(xhci, "Disable all slots\n"); 612 xhci_dbg(xhci, "Disable all slots\n");
613 spin_unlock_irqrestore(&xhci->lock, *flags);
606 for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) { 614 for (i = 1; i <= HCS_MAX_SLOTS(xhci->hcs_params1); i++) {
607 retval = xhci_disable_slot(xhci, NULL, i); 615 retval = xhci_disable_slot(xhci, NULL, i);
608 if (retval) 616 if (retval)
609 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n", 617 xhci_err(xhci, "Failed to disable slot %d, %d. Enter test mode anyway\n",
610 i, retval); 618 i, retval);
611 } 619 }
620 spin_lock_irqsave(&xhci->lock, *flags);
612 /* Put all ports to the Disable state by clear PP */ 621 /* Put all ports to the Disable state by clear PP */
613 xhci_dbg(xhci, "Disable all port (PP = 0)\n"); 622 xhci_dbg(xhci, "Disable all port (PP = 0)\n");
614 /* Power off USB3 ports*/ 623 /* Power off USB3 ports*/
@@ -897,6 +906,9 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
897 clear_bit(wIndex, &bus_state->resuming_ports); 906 clear_bit(wIndex, &bus_state->resuming_ports);
898 907
899 set_bit(wIndex, &bus_state->rexit_ports); 908 set_bit(wIndex, &bus_state->rexit_ports);
909
910 xhci_test_and_clear_bit(xhci, port_array, wIndex,
911 PORT_PLC);
900 xhci_set_link_state(xhci, port_array, wIndex, 912 xhci_set_link_state(xhci, port_array, wIndex,
901 XDEV_U0); 913 XDEV_U0);
902 914
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 53882e2babbb..5b0fa553c8bc 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -59,6 +59,8 @@
59#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb 59#define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb
60#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc 60#define PCI_DEVICE_ID_AMD_PROMONTORYA_1 0x43bc
61 61
62#define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142
63
62static const char hcd_name[] = "xhci_hcd"; 64static const char hcd_name[] = "xhci_hcd";
63 65
64static struct hc_driver __read_mostly xhci_pci_hc_driver; 66static struct hc_driver __read_mostly xhci_pci_hc_driver;
@@ -217,6 +219,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
217 pdev->device == 0x1142) 219 pdev->device == 0x1142)
218 xhci->quirks |= XHCI_TRUST_TX_LENGTH; 220 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
219 221
222 if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
223 pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI)
224 xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL;
225
220 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) 226 if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241)
221 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; 227 xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7;
222 228
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index c50c902d009e..cc368ad2b51e 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -864,13 +864,16 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,
864 (ep->ep_state & EP_GETTING_NO_STREAMS)) { 864 (ep->ep_state & EP_GETTING_NO_STREAMS)) {
865 int stream_id; 865 int stream_id;
866 866
867 for (stream_id = 0; stream_id < ep->stream_info->num_streams; 867 for (stream_id = 1; stream_id < ep->stream_info->num_streams;
868 stream_id++) { 868 stream_id++) {
869 ring = ep->stream_info->stream_rings[stream_id];
870 if (!ring)
871 continue;
872
869 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, 873 xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
870 "Killing URBs for slot ID %u, ep index %u, stream %u", 874 "Killing URBs for slot ID %u, ep index %u, stream %u",
871 slot_id, ep_index, stream_id + 1); 875 slot_id, ep_index, stream_id);
872 xhci_kill_ring_urbs(xhci, 876 xhci_kill_ring_urbs(xhci, ring);
873 ep->stream_info->stream_rings[stream_id]);
874 } 877 }
875 } else { 878 } else {
876 ring = ep->ring; 879 ring = ep->ring;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 56f85df013db..b2ff1ff1a02f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -198,6 +198,9 @@ int xhci_reset(struct xhci_hcd *xhci)
198 if (ret) 198 if (ret)
199 return ret; 199 return ret;
200 200
201 if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL)
202 usb_asmedia_modifyflowcontrol(to_pci_dev(xhci_to_hcd(xhci)->self.controller));
203
201 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 204 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
202 "Wait for controller to be ready for doorbell rings"); 205 "Wait for controller to be ready for doorbell rings");
203 /* 206 /*
@@ -622,8 +625,10 @@ int xhci_run(struct usb_hcd *hcd)
622 if (!command) 625 if (!command)
623 return -ENOMEM; 626 return -ENOMEM;
624 627
625 xhci_queue_vendor_command(xhci, command, 0, 0, 0, 628 ret = xhci_queue_vendor_command(xhci, command, 0, 0, 0,
626 TRB_TYPE(TRB_NEC_GET_FW)); 629 TRB_TYPE(TRB_NEC_GET_FW));
630 if (ret)
631 xhci_free_command(xhci, command);
627 } 632 }
628 xhci_dbg_trace(xhci, trace_xhci_dbg_init, 633 xhci_dbg_trace(xhci, trace_xhci_dbg_init,
629 "Finished xhci_run for USB2 roothub"); 634 "Finished xhci_run for USB2 roothub");
@@ -1085,6 +1090,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
1085 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running) 1090 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running)
1086 compliance_mode_recovery_timer_init(xhci); 1091 compliance_mode_recovery_timer_init(xhci);
1087 1092
1093 if (xhci->quirks & XHCI_ASMEDIA_MODIFY_FLOWCONTROL)
1094 usb_asmedia_modifyflowcontrol(to_pci_dev(hcd->self.controller));
1095
1088 /* Re-enable port polling. */ 1096 /* Re-enable port polling. */
1089 xhci_dbg(xhci, "%s: starting port polling.\n", __func__); 1097 xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
1090 set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); 1098 set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 3c6da1f93c84..e3e935291ed6 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1820,6 +1820,7 @@ struct xhci_hcd {
1820#define XHCI_BROKEN_PORT_PED (1 << 25) 1820#define XHCI_BROKEN_PORT_PED (1 << 25)
1821#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26) 1821#define XHCI_LIMIT_ENDPOINT_INTERVAL_7 (1 << 26)
1822#define XHCI_U2_DISABLE_WAKE (1 << 27) 1822#define XHCI_U2_DISABLE_WAKE (1 << 27)
1823#define XHCI_ASMEDIA_MODIFY_FLOWCONTROL (1 << 28)
1823 1824
1824 unsigned int num_active_eps; 1825 unsigned int num_active_eps;
1825 unsigned int limit_active_eps; 1826 unsigned int limit_active_eps;
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 623c51300393..f0ce304c5aaf 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -752,8 +752,10 @@ static int usbhsc_resume(struct device *dev)
752 struct usbhs_priv *priv = dev_get_drvdata(dev); 752 struct usbhs_priv *priv = dev_get_drvdata(dev);
753 struct platform_device *pdev = usbhs_priv_to_pdev(priv); 753 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
754 754
755 if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) 755 if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) {
756 usbhsc_power_ctrl(priv, 1); 756 usbhsc_power_ctrl(priv, 1);
757 usbhs_mod_autonomy_mode(priv);
758 }
757 759
758 usbhs_platform_call(priv, phy_reset, pdev); 760 usbhs_platform_call(priv, phy_reset, pdev);
759 761
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 5bc7a6138855..93fba9033b00 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -37,6 +37,7 @@ struct usbhsg_gpriv;
37struct usbhsg_uep { 37struct usbhsg_uep {
38 struct usb_ep ep; 38 struct usb_ep ep;
39 struct usbhs_pipe *pipe; 39 struct usbhs_pipe *pipe;
40 spinlock_t lock; /* protect the pipe */
40 41
41 char ep_name[EP_NAME_SIZE]; 42 char ep_name[EP_NAME_SIZE];
42 43
@@ -636,10 +637,16 @@ usbhsg_ep_enable_end:
636static int usbhsg_ep_disable(struct usb_ep *ep) 637static int usbhsg_ep_disable(struct usb_ep *ep)
637{ 638{
638 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); 639 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
639 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); 640 struct usbhs_pipe *pipe;
641 unsigned long flags;
642 int ret = 0;
640 643
641 if (!pipe) 644 spin_lock_irqsave(&uep->lock, flags);
642 return -EINVAL; 645 pipe = usbhsg_uep_to_pipe(uep);
646 if (!pipe) {
647 ret = -EINVAL;
648 goto out;
649 }
643 650
644 usbhsg_pipe_disable(uep); 651 usbhsg_pipe_disable(uep);
645 usbhs_pipe_free(pipe); 652 usbhs_pipe_free(pipe);
@@ -647,6 +654,9 @@ static int usbhsg_ep_disable(struct usb_ep *ep)
647 uep->pipe->mod_private = NULL; 654 uep->pipe->mod_private = NULL;
648 uep->pipe = NULL; 655 uep->pipe = NULL;
649 656
657out:
658 spin_unlock_irqrestore(&uep->lock, flags);
659
650 return 0; 660 return 0;
651} 661}
652 662
@@ -696,8 +706,11 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
696{ 706{
697 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); 707 struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep);
698 struct usbhsg_request *ureq = usbhsg_req_to_ureq(req); 708 struct usbhsg_request *ureq = usbhsg_req_to_ureq(req);
699 struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); 709 struct usbhs_pipe *pipe;
710 unsigned long flags;
700 711
712 spin_lock_irqsave(&uep->lock, flags);
713 pipe = usbhsg_uep_to_pipe(uep);
701 if (pipe) 714 if (pipe)
702 usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq)); 715 usbhs_pkt_pop(pipe, usbhsg_ureq_to_pkt(ureq));
703 716
@@ -706,6 +719,7 @@ static int usbhsg_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
706 * even if the pipe is NULL. 719 * even if the pipe is NULL.
707 */ 720 */
708 usbhsg_queue_pop(uep, ureq, -ECONNRESET); 721 usbhsg_queue_pop(uep, ureq, -ECONNRESET);
722 spin_unlock_irqrestore(&uep->lock, flags);
709 723
710 return 0; 724 return 0;
711} 725}
@@ -852,10 +866,10 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
852{ 866{
853 struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); 867 struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv);
854 struct usbhs_mod *mod = usbhs_mod_get_current(priv); 868 struct usbhs_mod *mod = usbhs_mod_get_current(priv);
855 struct usbhsg_uep *dcp = usbhsg_gpriv_to_dcp(gpriv); 869 struct usbhsg_uep *uep;
856 struct device *dev = usbhs_priv_to_dev(priv); 870 struct device *dev = usbhs_priv_to_dev(priv);
857 unsigned long flags; 871 unsigned long flags;
858 int ret = 0; 872 int ret = 0, i;
859 873
860 /******************** spin lock ********************/ 874 /******************** spin lock ********************/
861 usbhs_lock(priv, flags); 875 usbhs_lock(priv, flags);
@@ -887,7 +901,9 @@ static int usbhsg_try_stop(struct usbhs_priv *priv, u32 status)
887 usbhs_sys_set_test_mode(priv, 0); 901 usbhs_sys_set_test_mode(priv, 0);
888 usbhs_sys_function_ctrl(priv, 0); 902 usbhs_sys_function_ctrl(priv, 0);
889 903
890 usbhsg_ep_disable(&dcp->ep); 904 /* disable all eps */
905 usbhsg_for_each_uep_with_dcp(uep, gpriv, i)
906 usbhsg_ep_disable(&uep->ep);
891 907
892 dev_dbg(dev, "stop gadget\n"); 908 dev_dbg(dev, "stop gadget\n");
893 909
@@ -1069,6 +1085,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
1069 ret = -ENOMEM; 1085 ret = -ENOMEM;
1070 goto usbhs_mod_gadget_probe_err_gpriv; 1086 goto usbhs_mod_gadget_probe_err_gpriv;
1071 } 1087 }
1088 spin_lock_init(&uep->lock);
1072 1089
1073 gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED); 1090 gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
1074 dev_info(dev, "%stransceiver found\n", 1091 dev_info(dev, "%stransceiver found\n",
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index fba4005dd737..6a7720e66595 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -1529,8 +1529,11 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
1529 1529
1530 /* Make sure driver was initialized */ 1530 /* Make sure driver was initialized */
1531 1531
1532 if (us->extra == NULL) 1532 if (us->extra == NULL) {
1533 usb_stor_dbg(us, "ERROR Driver not initialized\n"); 1533 usb_stor_dbg(us, "ERROR Driver not initialized\n");
1534 srb->result = DID_ERROR << 16;
1535 return;
1536 }
1534 1537
1535 scsi_set_resid(srb, 0); 1538 scsi_set_resid(srb, 0);
1536 /* scsi_bufflen might change in protocol translation to ata */ 1539 /* scsi_bufflen might change in protocol translation to ata */
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 6b0d2f0918c6..8a88f45822e3 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -3,6 +3,7 @@
3#define __DRIVER_USB_TYPEC_UCSI_H 3#define __DRIVER_USB_TYPEC_UCSI_H
4 4
5#include <linux/bitops.h> 5#include <linux/bitops.h>
6#include <linux/device.h>
6#include <linux/types.h> 7#include <linux/types.h>
7 8
8/* -------------------------------------------------------------------------- */ 9/* -------------------------------------------------------------------------- */
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 22caf808bfab..f0b3a0b9d42f 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -104,12 +104,6 @@ static u32 page_to_balloon_pfn(struct page *page)
104 return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE; 104 return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE;
105} 105}
106 106
107static struct page *balloon_pfn_to_page(u32 pfn)
108{
109 BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE);
110 return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE);
111}
112
113static void balloon_ack(struct virtqueue *vq) 107static void balloon_ack(struct virtqueue *vq)
114{ 108{
115 struct virtio_balloon *vb = vq->vdev->priv; 109 struct virtio_balloon *vb = vq->vdev->priv;
@@ -138,8 +132,10 @@ static void set_page_pfns(struct virtio_balloon *vb,
138{ 132{
139 unsigned int i; 133 unsigned int i;
140 134
141 /* Set balloon pfns pointing at this page. 135 /*
142 * Note that the first pfn points at start of the page. */ 136 * Set balloon pfns pointing at this page.
137 * Note that the first pfn points at start of the page.
138 */
143 for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++) 139 for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++)
144 pfns[i] = cpu_to_virtio32(vb->vdev, 140 pfns[i] = cpu_to_virtio32(vb->vdev,
145 page_to_balloon_pfn(page) + i); 141 page_to_balloon_pfn(page) + i);
@@ -182,18 +178,16 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
182 return num_allocated_pages; 178 return num_allocated_pages;
183} 179}
184 180
185static void release_pages_balloon(struct virtio_balloon *vb) 181static void release_pages_balloon(struct virtio_balloon *vb,
182 struct list_head *pages)
186{ 183{
187 unsigned int i; 184 struct page *page, *next;
188 struct page *page;
189 185
190 /* Find pfns pointing at start of each page, get pages and free them. */ 186 list_for_each_entry_safe(page, next, pages, lru) {
191 for (i = 0; i < vb->num_pfns; i += VIRTIO_BALLOON_PAGES_PER_PAGE) {
192 page = balloon_pfn_to_page(virtio32_to_cpu(vb->vdev,
193 vb->pfns[i]));
194 if (!virtio_has_feature(vb->vdev, 187 if (!virtio_has_feature(vb->vdev,
195 VIRTIO_BALLOON_F_DEFLATE_ON_OOM)) 188 VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
196 adjust_managed_page_count(page, 1); 189 adjust_managed_page_count(page, 1);
190 list_del(&page->lru);
197 put_page(page); /* balloon reference */ 191 put_page(page); /* balloon reference */
198 } 192 }
199} 193}
@@ -203,6 +197,7 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
203 unsigned num_freed_pages; 197 unsigned num_freed_pages;
204 struct page *page; 198 struct page *page;
205 struct balloon_dev_info *vb_dev_info = &vb->vb_dev_info; 199 struct balloon_dev_info *vb_dev_info = &vb->vb_dev_info;
200 LIST_HEAD(pages);
206 201
207 /* We can only do one array worth at a time. */ 202 /* We can only do one array worth at a time. */
208 num = min(num, ARRAY_SIZE(vb->pfns)); 203 num = min(num, ARRAY_SIZE(vb->pfns));
@@ -216,6 +211,7 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
216 if (!page) 211 if (!page)
217 break; 212 break;
218 set_page_pfns(vb, vb->pfns + vb->num_pfns, page); 213 set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
214 list_add(&page->lru, &pages);
219 vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; 215 vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
220 } 216 }
221 217
@@ -227,7 +223,7 @@ static unsigned leak_balloon(struct virtio_balloon *vb, size_t num)
227 */ 223 */
228 if (vb->num_pfns != 0) 224 if (vb->num_pfns != 0)
229 tell_host(vb, vb->deflate_vq); 225 tell_host(vb, vb->deflate_vq);
230 release_pages_balloon(vb); 226 release_pages_balloon(vb, &pages);
231 mutex_unlock(&vb->balloon_lock); 227 mutex_unlock(&vb->balloon_lock);
232 return num_freed_pages; 228 return num_freed_pages;
233} 229}
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index 3612542b6044..83fc9aab34e8 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -704,7 +704,8 @@ static int omap_hdq_probe(struct platform_device *pdev)
704 704
705 irq = platform_get_irq(pdev, 0); 705 irq = platform_get_irq(pdev, 0);
706 if (irq < 0) { 706 if (irq < 0) {
707 ret = -ENXIO; 707 dev_dbg(&pdev->dev, "Failed to get IRQ: %d\n", irq);
708 ret = irq;
708 goto err_irq; 709 goto err_irq;
709 } 710 }
710 711
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 95ea7e6b1d99..74471e7aa5cc 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -728,6 +728,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
728 memcpy(&sl->reg_num, rn, sizeof(sl->reg_num)); 728 memcpy(&sl->reg_num, rn, sizeof(sl->reg_num));
729 atomic_set(&sl->refcnt, 1); 729 atomic_set(&sl->refcnt, 1);
730 atomic_inc(&sl->master->refcnt); 730 atomic_inc(&sl->master->refcnt);
731 dev->slave_count++;
731 732
732 /* slave modules need to be loaded in a context with unlocked mutex */ 733 /* slave modules need to be loaded in a context with unlocked mutex */
733 mutex_unlock(&dev->mutex); 734 mutex_unlock(&dev->mutex);
@@ -747,11 +748,11 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
747 748
748 sl->family = f; 749 sl->family = f;
749 750
750
751 err = __w1_attach_slave_device(sl); 751 err = __w1_attach_slave_device(sl);
752 if (err < 0) { 752 if (err < 0) {
753 dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__, 753 dev_err(&dev->dev, "%s: Attaching %s failed.\n", __func__,
754 sl->name); 754 sl->name);
755 dev->slave_count--;
755 w1_family_put(sl->family); 756 w1_family_put(sl->family);
756 atomic_dec(&sl->master->refcnt); 757 atomic_dec(&sl->master->refcnt);
757 kfree(sl); 758 kfree(sl);
@@ -759,7 +760,6 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
759 } 760 }
760 761
761 sl->ttl = dev->slave_ttl; 762 sl->ttl = dev->slave_ttl;
762 dev->slave_count++;
763 763
764 memcpy(msg.id.id, rn, sizeof(msg.id)); 764 memcpy(msg.id.id, rn, sizeof(msg.id));
765 msg.type = W1_SLAVE_ADD; 765 msg.type = W1_SLAVE_ADD;
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 50dcb68d8070..ab609255a0f3 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -780,6 +780,9 @@ static int __init balloon_init(void)
780 } 780 }
781#endif 781#endif
782 782
783 /* Init the xen-balloon driver. */
784 xen_balloon_init();
785
783 return 0; 786 return 0;
784} 787}
785subsys_initcall(balloon_init); 788subsys_initcall(balloon_init);
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index b241bfa529ce..bae1f5d36c26 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -343,14 +343,6 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
343 info->cpu = cpu; 343 info->cpu = cpu;
344} 344}
345 345
346static void xen_evtchn_mask_all(void)
347{
348 unsigned int evtchn;
349
350 for (evtchn = 0; evtchn < xen_evtchn_nr_channels(); evtchn++)
351 mask_evtchn(evtchn);
352}
353
354/** 346/**
355 * notify_remote_via_irq - send event to remote end of event channel via irq 347 * notify_remote_via_irq - send event to remote end of event channel via irq
356 * @irq: irq of event channel to send event to 348 * @irq: irq of event channel to send event to
@@ -1573,7 +1565,6 @@ void xen_irq_resume(void)
1573 struct irq_info *info; 1565 struct irq_info *info;
1574 1566
1575 /* New event-channel space is not 'live' yet. */ 1567 /* New event-channel space is not 'live' yet. */
1576 xen_evtchn_mask_all();
1577 xen_evtchn_resume(); 1568 xen_evtchn_resume();
1578 1569
1579 /* No IRQ <-> event-channel mappings. */ 1570 /* No IRQ <-> event-channel mappings. */
@@ -1681,6 +1672,7 @@ module_param(fifo_events, bool, 0);
1681void __init xen_init_IRQ(void) 1672void __init xen_init_IRQ(void)
1682{ 1673{
1683 int ret = -EINVAL; 1674 int ret = -EINVAL;
1675 unsigned int evtchn;
1684 1676
1685 if (fifo_events) 1677 if (fifo_events)
1686 ret = xen_evtchn_fifo_init(); 1678 ret = xen_evtchn_fifo_init();
@@ -1692,7 +1684,8 @@ void __init xen_init_IRQ(void)
1692 BUG_ON(!evtchn_to_irq); 1684 BUG_ON(!evtchn_to_irq);
1693 1685
1694 /* No event channels are 'live' right now. */ 1686 /* No event channels are 'live' right now. */
1695 xen_evtchn_mask_all(); 1687 for (evtchn = 0; evtchn < xen_evtchn_nr_channels(); evtchn++)
1688 mask_evtchn(evtchn);
1696 1689
1697 pirq_needs_eoi = pirq_needs_eoi_flag; 1690 pirq_needs_eoi = pirq_needs_eoi_flag;
1698 1691
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index d6786b87e13b..2c6a9114d332 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -42,6 +42,7 @@
42#include <linux/delay.h> 42#include <linux/delay.h>
43#include <linux/hardirq.h> 43#include <linux/hardirq.h>
44#include <linux/workqueue.h> 44#include <linux/workqueue.h>
45#include <linux/ratelimit.h>
45 46
46#include <xen/xen.h> 47#include <xen/xen.h>
47#include <xen/interface/xen.h> 48#include <xen/interface/xen.h>
@@ -1072,8 +1073,14 @@ static int gnttab_expand(unsigned int req_entries)
1072 cur = nr_grant_frames; 1073 cur = nr_grant_frames;
1073 extra = ((req_entries + (grefs_per_grant_frame-1)) / 1074 extra = ((req_entries + (grefs_per_grant_frame-1)) /
1074 grefs_per_grant_frame); 1075 grefs_per_grant_frame);
1075 if (cur + extra > gnttab_max_grant_frames()) 1076 if (cur + extra > gnttab_max_grant_frames()) {
1077 pr_warn_ratelimited("xen/grant-table: max_grant_frames reached"
1078 " cur=%u extra=%u limit=%u"
1079 " gnttab_free_count=%u req_entries=%u\n",
1080 cur, extra, gnttab_max_grant_frames(),
1081 gnttab_free_count, req_entries);
1076 return -ENOSPC; 1082 return -ENOSPC;
1083 }
1077 1084
1078 rc = gnttab_map(cur, cur + extra - 1); 1085 rc = gnttab_map(cur, cur + extra - 1);
1079 if (rc == 0) 1086 if (rc == 0)
diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
index e7715cb62eef..e89136ab851e 100644
--- a/drivers/xen/xen-balloon.c
+++ b/drivers/xen/xen-balloon.c
@@ -59,6 +59,8 @@ static void watch_target(struct xenbus_watch *watch,
59{ 59{
60 unsigned long long new_target; 60 unsigned long long new_target;
61 int err; 61 int err;
62 static bool watch_fired;
63 static long target_diff;
62 64
63 err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target); 65 err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
64 if (err != 1) { 66 if (err != 1) {
@@ -69,7 +71,14 @@ static void watch_target(struct xenbus_watch *watch,
69 /* The given memory/target value is in KiB, so it needs converting to 71 /* The given memory/target value is in KiB, so it needs converting to
70 * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. 72 * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
71 */ 73 */
72 balloon_set_new_target(new_target >> (PAGE_SHIFT - 10)); 74 new_target >>= PAGE_SHIFT - 10;
75 if (watch_fired) {
76 balloon_set_new_target(new_target - target_diff);
77 return;
78 }
79
80 watch_fired = true;
81 target_diff = new_target - balloon_stats.target_pages;
73} 82}
74static struct xenbus_watch target_watch = { 83static struct xenbus_watch target_watch = {
75 .node = "memory/target", 84 .node = "memory/target",
@@ -94,22 +103,15 @@ static struct notifier_block xenstore_notifier = {
94 .notifier_call = balloon_init_watcher, 103 .notifier_call = balloon_init_watcher,
95}; 104};
96 105
97static int __init balloon_init(void) 106void xen_balloon_init(void)
98{ 107{
99 if (!xen_domain())
100 return -ENODEV;
101
102 pr_info("Initialising balloon driver\n");
103
104 register_balloon(&balloon_dev); 108 register_balloon(&balloon_dev);
105 109
106 register_xen_selfballooning(&balloon_dev); 110 register_xen_selfballooning(&balloon_dev);
107 111
108 register_xenstore_notifier(&xenstore_notifier); 112 register_xenstore_notifier(&xenstore_notifier);
109
110 return 0;
111} 113}
112subsys_initcall(balloon_init); 114EXPORT_SYMBOL_GPL(xen_balloon_init);
113 115
114#define BALLOON_SHOW(name, format, args...) \ 116#define BALLOON_SHOW(name, format, args...) \
115 static ssize_t show_##name(struct device *dev, \ 117 static ssize_t show_##name(struct device *dev, \
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c
index 66620713242a..a67e955cacd1 100644
--- a/drivers/xen/xen-selfballoon.c
+++ b/drivers/xen/xen-selfballoon.c
@@ -151,8 +151,8 @@ static unsigned long frontswap_inertia_counter;
151static void frontswap_selfshrink(void) 151static void frontswap_selfshrink(void)
152{ 152{
153 static unsigned long cur_frontswap_pages; 153 static unsigned long cur_frontswap_pages;
154 static unsigned long last_frontswap_pages; 154 unsigned long last_frontswap_pages;
155 static unsigned long tgt_frontswap_pages; 155 unsigned long tgt_frontswap_pages;
156 156
157 last_frontswap_pages = cur_frontswap_pages; 157 last_frontswap_pages = cur_frontswap_pages;
158 cur_frontswap_pages = frontswap_curr_pages(); 158 cur_frontswap_pages = frontswap_curr_pages();
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c
index 967f069385d0..71ddfb4cf61c 100644
--- a/drivers/xen/xenfs/super.c
+++ b/drivers/xen/xenfs/super.c
@@ -87,7 +87,6 @@ static int __init xenfs_init(void)
87 if (xen_domain()) 87 if (xen_domain())
88 return register_filesystem(&xenfs_type); 88 return register_filesystem(&xenfs_type);
89 89
90 pr_info("not registering filesystem on non-xen platform\n");
91 return 0; 90 return 0;
92} 91}
93 92
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 69ec23daa25e..a1e6860b6f46 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -574,7 +574,7 @@ static int load_flat_file(struct linux_binprm *bprm,
574 MAX_SHARED_LIBS * sizeof(unsigned long), 574 MAX_SHARED_LIBS * sizeof(unsigned long),
575 FLAT_DATA_ALIGN); 575 FLAT_DATA_ALIGN);
576 576
577 pr_debug("Allocated data+bss+stack (%ld bytes): %lx\n", 577 pr_debug("Allocated data+bss+stack (%u bytes): %lx\n",
578 data_len + bss_len + stack_len, datapos); 578 data_len + bss_len + stack_len, datapos);
579 579
580 fpos = ntohl(hdr->data_start); 580 fpos = ntohl(hdr->data_start);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 375f8c728d91..e3b0b4196d3d 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4825,10 +4825,6 @@ skip_async:
4825 else 4825 else
4826 flush = BTRFS_RESERVE_NO_FLUSH; 4826 flush = BTRFS_RESERVE_NO_FLUSH;
4827 spin_lock(&space_info->lock); 4827 spin_lock(&space_info->lock);
4828 if (can_overcommit(fs_info, space_info, orig, flush, false)) {
4829 spin_unlock(&space_info->lock);
4830 break;
4831 }
4832 if (list_empty(&space_info->tickets) && 4828 if (list_empty(&space_info->tickets) &&
4833 list_empty(&space_info->priority_tickets)) { 4829 list_empty(&space_info->priority_tickets)) {
4834 spin_unlock(&space_info->lock); 4830 spin_unlock(&space_info->lock);
@@ -7589,6 +7585,10 @@ search:
7589 u64 offset; 7585 u64 offset;
7590 int cached; 7586 int cached;
7591 7587
7588 /* If the block group is read-only, we can skip it entirely. */
7589 if (unlikely(block_group->ro))
7590 continue;
7591
7592 btrfs_grab_block_group(block_group, delalloc); 7592 btrfs_grab_block_group(block_group, delalloc);
7593 search_start = block_group->key.objectid; 7593 search_start = block_group->key.objectid;
7594 7594
@@ -7624,8 +7624,6 @@ have_block_group:
7624 7624
7625 if (unlikely(block_group->cached == BTRFS_CACHE_ERROR)) 7625 if (unlikely(block_group->cached == BTRFS_CACHE_ERROR))
7626 goto loop; 7626 goto loop;
7627 if (unlikely(block_group->ro))
7628 goto loop;
7629 7627
7630 /* 7628 /*
7631 * Ok we want to try and use the cluster allocator, so 7629 * Ok we want to try and use the cluster allocator, so
@@ -7839,6 +7837,7 @@ loop:
7839 failed_alloc = false; 7837 failed_alloc = false;
7840 BUG_ON(index != get_block_group_index(block_group)); 7838 BUG_ON(index != get_block_group_index(block_group));
7841 btrfs_release_block_group(block_group, delalloc); 7839 btrfs_release_block_group(block_group, delalloc);
7840 cond_resched();
7842 } 7841 }
7843 up_read(&space_info->groups_sem); 7842 up_read(&space_info->groups_sem);
7844 7843
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index f20ef211a73d..3a11ae63676e 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2153,8 +2153,7 @@ process_leaf:
2153 u32 this_len = sizeof(*di) + name_len + data_len; 2153 u32 this_len = sizeof(*di) + name_len + data_len;
2154 char *name; 2154 char *name;
2155 2155
2156 ret = verify_dir_item(fs_info, path->nodes[0], 2156 ret = verify_dir_item(fs_info, path->nodes[0], i, di);
2157 path->slots[0], di);
2158 if (ret) { 2157 if (ret) {
2159 ret = -EIO; 2158 ret = -EIO;
2160 goto out; 2159 goto out;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5eb7217738ed..e8b9a269fdde 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2702,7 +2702,7 @@ int btrfs_grow_device(struct btrfs_trans_handle *trans,
2702 2702
2703 mutex_lock(&fs_info->chunk_mutex); 2703 mutex_lock(&fs_info->chunk_mutex);
2704 old_total = btrfs_super_total_bytes(super_copy); 2704 old_total = btrfs_super_total_bytes(super_copy);
2705 diff = new_size - device->total_bytes; 2705 diff = round_down(new_size - device->total_bytes, fs_info->sectorsize);
2706 2706
2707 if (new_size <= device->total_bytes || 2707 if (new_size <= device->total_bytes ||
2708 device->is_tgtdev_for_dev_replace) { 2708 device->is_tgtdev_for_dev_replace) {
@@ -4406,7 +4406,7 @@ int btrfs_shrink_device(struct btrfs_device *device, u64 new_size)
4406 u64 diff; 4406 u64 diff;
4407 4407
4408 new_size = round_down(new_size, fs_info->sectorsize); 4408 new_size = round_down(new_size, fs_info->sectorsize);
4409 diff = old_size - new_size; 4409 diff = round_down(old_size - new_size, fs_info->sectorsize);
4410 4410
4411 if (device->is_tgtdev_for_dev_replace) 4411 if (device->is_tgtdev_for_dev_replace)
4412 return -EINVAL; 4412 return -EINVAL;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index e071d23f6148..ef7240ace576 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -271,6 +271,11 @@ out:
271 if (ret < 0) 271 if (ret < 0)
272 err = ret; 272 err = ret;
273 dput(last); 273 dput(last);
274 /* last_name no longer match cache index */
275 if (fi->readdir_cache_idx >= 0) {
276 fi->readdir_cache_idx = -1;
277 fi->dir_release_count = 0;
278 }
274 } 279 }
275 return err; 280 return err;
276} 281}
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 79dafa71effd..51f0aea70cb4 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -175,11 +175,8 @@ ext2_get_acl(struct inode *inode, int type)
175 return acl; 175 return acl;
176} 176}
177 177
178/* 178static int
179 * inode->i_mutex: down 179__ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
180 */
181int
182ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
183{ 180{
184 int name_index; 181 int name_index;
185 void *value = NULL; 182 void *value = NULL;
@@ -189,13 +186,6 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
189 switch(type) { 186 switch(type) {
190 case ACL_TYPE_ACCESS: 187 case ACL_TYPE_ACCESS:
191 name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS; 188 name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
192 if (acl) {
193 error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
194 if (error)
195 return error;
196 inode->i_ctime = current_time(inode);
197 mark_inode_dirty(inode);
198 }
199 break; 189 break;
200 190
201 case ACL_TYPE_DEFAULT: 191 case ACL_TYPE_DEFAULT:
@@ -222,6 +212,31 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
222} 212}
223 213
224/* 214/*
215 * inode->i_mutex: down
216 */
217int
218ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
219{
220 int error;
221 int update_mode = 0;
222 umode_t mode = inode->i_mode;
223
224 if (type == ACL_TYPE_ACCESS && acl) {
225 error = posix_acl_update_mode(inode, &mode, &acl);
226 if (error)
227 return error;
228 update_mode = 1;
229 }
230 error = __ext2_set_acl(inode, acl, type);
231 if (!error && update_mode) {
232 inode->i_mode = mode;
233 inode->i_ctime = current_time(inode);
234 mark_inode_dirty(inode);
235 }
236 return error;
237}
238
239/*
225 * Initialize the ACLs of a new inode. Called from ext2_new_inode. 240 * Initialize the ACLs of a new inode. Called from ext2_new_inode.
226 * 241 *
227 * dir->i_mutex: down 242 * dir->i_mutex: down
@@ -238,12 +253,12 @@ ext2_init_acl(struct inode *inode, struct inode *dir)
238 return error; 253 return error;
239 254
240 if (default_acl) { 255 if (default_acl) {
241 error = ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); 256 error = __ext2_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
242 posix_acl_release(default_acl); 257 posix_acl_release(default_acl);
243 } 258 }
244 if (acl) { 259 if (acl) {
245 if (!error) 260 if (!error)
246 error = ext2_set_acl(inode, acl, ACL_TYPE_ACCESS); 261 error = __ext2_set_acl(inode, acl, ACL_TYPE_ACCESS);
247 posix_acl_release(acl); 262 posix_acl_release(acl);
248 } 263 }
249 return error; 264 return error;
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index a140c5e3dc54..b4b8438c42ef 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -211,7 +211,7 @@ static int __f2fs_set_acl(struct inode *inode, int type,
211 switch (type) { 211 switch (type) {
212 case ACL_TYPE_ACCESS: 212 case ACL_TYPE_ACCESS:
213 name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS; 213 name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
214 if (acl) { 214 if (acl && !ipage) {
215 error = posix_acl_update_mode(inode, &inode->i_mode, &acl); 215 error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
216 if (error) 216 if (error)
217 return error; 217 return error;
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 56bbf592e487..5b876f6d3f6b 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -879,6 +879,7 @@ int sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type)
879 struct inode *inode; 879 struct inode *inode;
880 struct f2fs_inode_info *fi; 880 struct f2fs_inode_info *fi;
881 bool is_dir = (type == DIR_INODE); 881 bool is_dir = (type == DIR_INODE);
882 unsigned long ino = 0;
882 883
883 trace_f2fs_sync_dirty_inodes_enter(sbi->sb, is_dir, 884 trace_f2fs_sync_dirty_inodes_enter(sbi->sb, is_dir,
884 get_pages(sbi, is_dir ? 885 get_pages(sbi, is_dir ?
@@ -901,8 +902,17 @@ retry:
901 inode = igrab(&fi->vfs_inode); 902 inode = igrab(&fi->vfs_inode);
902 spin_unlock(&sbi->inode_lock[type]); 903 spin_unlock(&sbi->inode_lock[type]);
903 if (inode) { 904 if (inode) {
905 unsigned long cur_ino = inode->i_ino;
906
904 filemap_fdatawrite(inode->i_mapping); 907 filemap_fdatawrite(inode->i_mapping);
905 iput(inode); 908 iput(inode);
909 /* We need to give cpu to another writers. */
910 if (ino == cur_ino) {
911 congestion_wait(BLK_RW_ASYNC, HZ/50);
912 cond_resched();
913 } else {
914 ino = cur_ino;
915 }
906 } else { 916 } else {
907 /* 917 /*
908 * We should submit bio, since it exists several 918 * We should submit bio, since it exists several
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index a0e6d2c65a9e..2706130c261b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1538,7 +1538,6 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg)
1538 1538
1539 /* Is it quota file? Do not allow user to mess with it */ 1539 /* Is it quota file? Do not allow user to mess with it */
1540 if (IS_NOQUOTA(inode)) { 1540 if (IS_NOQUOTA(inode)) {
1541 inode_unlock(inode);
1542 ret = -EPERM; 1541 ret = -EPERM;
1543 goto unlock_out; 1542 goto unlock_out;
1544 } 1543 }
@@ -1549,9 +1548,8 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg)
1549 1548
1550 if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { 1549 if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
1551 if (!capable(CAP_LINUX_IMMUTABLE)) { 1550 if (!capable(CAP_LINUX_IMMUTABLE)) {
1552 inode_unlock(inode);
1553 ret = -EPERM; 1551 ret = -EPERM;
1554 goto out; 1552 goto unlock_out;
1555 } 1553 }
1556 } 1554 }
1557 1555
@@ -1564,7 +1562,6 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg)
1564 f2fs_mark_inode_dirty_sync(inode, false); 1562 f2fs_mark_inode_dirty_sync(inode, false);
1565unlock_out: 1563unlock_out:
1566 inode_unlock(inode); 1564 inode_unlock(inode);
1567out:
1568 mnt_drop_write_file(filp); 1565 mnt_drop_write_file(filp);
1569 return ret; 1566 return ret;
1570} 1567}
diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
index 9adc202fcd6f..71191d89917d 100644
--- a/fs/f2fs/sysfs.c
+++ b/fs/f2fs/sysfs.c
@@ -11,6 +11,7 @@
11 */ 11 */
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13#include <linux/f2fs_fs.h> 13#include <linux/f2fs_fs.h>
14#include <linux/seq_file.h>
14 15
15#include "f2fs.h" 16#include "f2fs.h"
16#include "segment.h" 17#include "segment.h"
diff --git a/fs/hfsplus/posix_acl.c b/fs/hfsplus/posix_acl.c
index 9b92058a1240..6bb5d7c42888 100644
--- a/fs/hfsplus/posix_acl.c
+++ b/fs/hfsplus/posix_acl.c
@@ -51,8 +51,8 @@ struct posix_acl *hfsplus_get_posix_acl(struct inode *inode, int type)
51 return acl; 51 return acl;
52} 52}
53 53
54int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, 54static int __hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
55 int type) 55 int type)
56{ 56{
57 int err; 57 int err;
58 char *xattr_name; 58 char *xattr_name;
@@ -64,12 +64,6 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
64 switch (type) { 64 switch (type) {
65 case ACL_TYPE_ACCESS: 65 case ACL_TYPE_ACCESS:
66 xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; 66 xattr_name = XATTR_NAME_POSIX_ACL_ACCESS;
67 if (acl) {
68 err = posix_acl_update_mode(inode, &inode->i_mode, &acl);
69 if (err)
70 return err;
71 }
72 err = 0;
73 break; 67 break;
74 68
75 case ACL_TYPE_DEFAULT: 69 case ACL_TYPE_DEFAULT:
@@ -105,6 +99,18 @@ end_set_acl:
105 return err; 99 return err;
106} 100}
107 101
102int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl, int type)
103{
104 int err;
105
106 if (type == ACL_TYPE_ACCESS && acl) {
107 err = posix_acl_update_mode(inode, &inode->i_mode, &acl);
108 if (err)
109 return err;
110 }
111 return __hfsplus_set_posix_acl(inode, acl, type);
112}
113
108int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir) 114int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir)
109{ 115{
110 int err = 0; 116 int err = 0;
@@ -122,15 +128,15 @@ int hfsplus_init_posix_acl(struct inode *inode, struct inode *dir)
122 return err; 128 return err;
123 129
124 if (default_acl) { 130 if (default_acl) {
125 err = hfsplus_set_posix_acl(inode, default_acl, 131 err = __hfsplus_set_posix_acl(inode, default_acl,
126 ACL_TYPE_DEFAULT); 132 ACL_TYPE_DEFAULT);
127 posix_acl_release(default_acl); 133 posix_acl_release(default_acl);
128 } 134 }
129 135
130 if (acl) { 136 if (acl) {
131 if (!err) 137 if (!err)
132 err = hfsplus_set_posix_acl(inode, acl, 138 err = __hfsplus_set_posix_acl(inode, acl,
133 ACL_TYPE_ACCESS); 139 ACL_TYPE_ACCESS);
134 posix_acl_release(acl); 140 posix_acl_release(acl);
135 } 141 }
136 return err; 142 return err;
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 8cf898a59730..217a5e7815da 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -410,7 +410,11 @@ static int parse_options(char *options, struct iso9660_options *popt)
410 if (match_int(&args[0], &option)) 410 if (match_int(&args[0], &option))
411 return 0; 411 return 0;
412 n = option; 412 n = option;
413 if (n > 99) 413 /*
414 * Track numbers are supposed to be in range 1-99, the
415 * mount option starts indexing at 0.
416 */
417 if (n >= 99)
414 return 0; 418 return 0;
415 popt->session = n + 1; 419 popt->session = n + 1;
416 break; 420 break;
@@ -543,7 +547,7 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
543 547
544 vol_desc_start=0; 548 vol_desc_start=0;
545 ms_info.addr_format=CDROM_LBA; 549 ms_info.addr_format=CDROM_LBA;
546 if(session >= 0 && session <= 99) { 550 if (session > 0) {
547 struct cdrom_tocentry Te; 551 struct cdrom_tocentry Te;
548 Te.cdte_track=session; 552 Te.cdte_track=session;
549 Te.cdte_format=CDROM_LBA; 553 Te.cdte_format=CDROM_LBA;
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 7bc186f4ed4d..2e71b6e7e646 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -77,13 +77,6 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
77 switch (type) { 77 switch (type) {
78 case ACL_TYPE_ACCESS: 78 case ACL_TYPE_ACCESS:
79 ea_name = XATTR_NAME_POSIX_ACL_ACCESS; 79 ea_name = XATTR_NAME_POSIX_ACL_ACCESS;
80 if (acl) {
81 rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
82 if (rc)
83 return rc;
84 inode->i_ctime = current_time(inode);
85 mark_inode_dirty(inode);
86 }
87 break; 80 break;
88 case ACL_TYPE_DEFAULT: 81 case ACL_TYPE_DEFAULT:
89 ea_name = XATTR_NAME_POSIX_ACL_DEFAULT; 82 ea_name = XATTR_NAME_POSIX_ACL_DEFAULT;
@@ -115,12 +108,27 @@ int jfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
115{ 108{
116 int rc; 109 int rc;
117 tid_t tid; 110 tid_t tid;
111 int update_mode = 0;
112 umode_t mode = inode->i_mode;
118 113
119 tid = txBegin(inode->i_sb, 0); 114 tid = txBegin(inode->i_sb, 0);
120 mutex_lock(&JFS_IP(inode)->commit_mutex); 115 mutex_lock(&JFS_IP(inode)->commit_mutex);
116 if (type == ACL_TYPE_ACCESS && acl) {
117 rc = posix_acl_update_mode(inode, &mode, &acl);
118 if (rc)
119 goto end_tx;
120 update_mode = 1;
121 }
121 rc = __jfs_set_acl(tid, inode, type, acl); 122 rc = __jfs_set_acl(tid, inode, type, acl);
122 if (!rc) 123 if (!rc) {
124 if (update_mode) {
125 inode->i_mode = mode;
126 inode->i_ctime = current_time(inode);
127 mark_inode_dirty(inode);
128 }
123 rc = txCommit(tid, 1, &inode, 0); 129 rc = txCommit(tid, 1, &inode, 0);
130 }
131end_tx:
124 txEnd(tid); 132 txEnd(tid);
125 mutex_unlock(&JFS_IP(inode)->commit_mutex); 133 mutex_unlock(&JFS_IP(inode)->commit_mutex);
126 return rc; 134 return rc;
diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
index bd9b641ada2c..7ddcb445a3d9 100644
--- a/fs/jfs/resize.c
+++ b/fs/jfs/resize.c
@@ -98,7 +98,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
98 goto out; 98 goto out;
99 } 99 }
100 100
101 VolumeSize = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; 101 VolumeSize = i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits;
102 102
103 if (VolumeSize) { 103 if (VolumeSize) {
104 if (newLVSize > VolumeSize) { 104 if (newLVSize > VolumeSize) {
@@ -211,7 +211,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize, int newLogSize)
211 txQuiesce(sb); 211 txQuiesce(sb);
212 212
213 /* Reset size of direct inode */ 213 /* Reset size of direct inode */
214 sbi->direct_inode->i_size = sb->s_bdev->bd_inode->i_size; 214 sbi->direct_inode->i_size = i_size_read(sb->s_bdev->bd_inode);
215 215
216 if (sbi->mntflag & JFS_INLINELOG) { 216 if (sbi->mntflag & JFS_INLINELOG) {
217 /* 217 /*
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index e8aad7d87b8c..78b41e1d5c67 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -313,7 +313,7 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
313 } 313 }
314 case Opt_resize_nosize: 314 case Opt_resize_nosize:
315 { 315 {
316 *newLVSize = sb->s_bdev->bd_inode->i_size >> 316 *newLVSize = i_size_read(sb->s_bdev->bd_inode) >>
317 sb->s_blocksize_bits; 317 sb->s_blocksize_bits;
318 if (*newLVSize == 0) 318 if (*newLVSize == 0)
319 pr_err("JFS: Cannot determine volume size\n"); 319 pr_err("JFS: Cannot determine volume size\n");
@@ -579,7 +579,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
579 goto out_unload; 579 goto out_unload;
580 } 580 }
581 inode->i_ino = 0; 581 inode->i_ino = 0;
582 inode->i_size = sb->s_bdev->bd_inode->i_size; 582 inode->i_size = i_size_read(sb->s_bdev->bd_inode);
583 inode->i_mapping->a_ops = &jfs_metapage_aops; 583 inode->i_mapping->a_ops = &jfs_metapage_aops;
584 hlist_add_fake(&inode->i_hash); 584 hlist_add_fake(&inode->i_hash);
585 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); 585 mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
diff --git a/fs/mount.h b/fs/mount.h
index de45d9e76748..6790767d1883 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -16,7 +16,7 @@ struct mnt_namespace {
16 u64 event; 16 u64 event;
17 unsigned int mounts; /* # of mounts in the namespace */ 17 unsigned int mounts; /* # of mounts in the namespace */
18 unsigned int pending_mounts; 18 unsigned int pending_mounts;
19}; 19} __randomize_layout;
20 20
21struct mnt_pcp { 21struct mnt_pcp {
22 int mnt_count; 22 int mnt_count;
@@ -69,7 +69,7 @@ struct mount {
69 struct hlist_head mnt_pins; 69 struct hlist_head mnt_pins;
70 struct fs_pin mnt_umount; 70 struct fs_pin mnt_umount;
71 struct dentry *mnt_ex_mountpoint; 71 struct dentry *mnt_ex_mountpoint;
72}; 72} __randomize_layout;
73 73
74#define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */ 74#define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */
75 75
diff --git a/fs/namei.c b/fs/namei.c
index 88fd38d1e3e7..ddb6a7c2b3d4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -524,7 +524,7 @@ struct nameidata {
524 struct inode *link_inode; 524 struct inode *link_inode;
525 unsigned root_seq; 525 unsigned root_seq;
526 int dfd; 526 int dfd;
527}; 527} __randomize_layout;
528 528
529static void set_nameidata(struct nameidata *p, int dfd, struct filename *name) 529static void set_nameidata(struct nameidata *p, int dfd, struct filename *name)
530{ 530{
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index ee5ddbd36088..efebe6cf4378 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -820,6 +820,7 @@ void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *sour
820 target->caps = source->caps; 820 target->caps = source->caps;
821 target->options = source->options; 821 target->options = source->options;
822 target->auth_info = source->auth_info; 822 target->auth_info = source->auth_info;
823 target->port = source->port;
823} 824}
824EXPORT_SYMBOL_GPL(nfs_server_copy_userdata); 825EXPORT_SYMBOL_GPL(nfs_server_copy_userdata);
825 826
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 5ac484fe0dee..3522b1249019 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2372,16 +2372,40 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set)
2372} 2372}
2373EXPORT_SYMBOL_GPL(nfs_access_add_cache); 2373EXPORT_SYMBOL_GPL(nfs_access_add_cache);
2374 2374
2375#define NFS_MAY_READ (NFS4_ACCESS_READ)
2376#define NFS_MAY_WRITE (NFS4_ACCESS_MODIFY | \
2377 NFS4_ACCESS_EXTEND | \
2378 NFS4_ACCESS_DELETE)
2379#define NFS_FILE_MAY_WRITE (NFS4_ACCESS_MODIFY | \
2380 NFS4_ACCESS_EXTEND)
2381#define NFS_DIR_MAY_WRITE NFS_MAY_WRITE
2382#define NFS_MAY_LOOKUP (NFS4_ACCESS_LOOKUP)
2383#define NFS_MAY_EXECUTE (NFS4_ACCESS_EXECUTE)
2384static int
2385nfs_access_calc_mask(u32 access_result, umode_t umode)
2386{
2387 int mask = 0;
2388
2389 if (access_result & NFS_MAY_READ)
2390 mask |= MAY_READ;
2391 if (S_ISDIR(umode)) {
2392 if ((access_result & NFS_DIR_MAY_WRITE) == NFS_DIR_MAY_WRITE)
2393 mask |= MAY_WRITE;
2394 if ((access_result & NFS_MAY_LOOKUP) == NFS_MAY_LOOKUP)
2395 mask |= MAY_EXEC;
2396 } else if (S_ISREG(umode)) {
2397 if ((access_result & NFS_FILE_MAY_WRITE) == NFS_FILE_MAY_WRITE)
2398 mask |= MAY_WRITE;
2399 if ((access_result & NFS_MAY_EXECUTE) == NFS_MAY_EXECUTE)
2400 mask |= MAY_EXEC;
2401 } else if (access_result & NFS_MAY_WRITE)
2402 mask |= MAY_WRITE;
2403 return mask;
2404}
2405
2375void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result) 2406void nfs_access_set_mask(struct nfs_access_entry *entry, u32 access_result)
2376{ 2407{
2377 entry->mask = 0; 2408 entry->mask = access_result;
2378 if (access_result & NFS4_ACCESS_READ)
2379 entry->mask |= MAY_READ;
2380 if (access_result &
2381 (NFS4_ACCESS_MODIFY | NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE))
2382 entry->mask |= MAY_WRITE;
2383 if (access_result & (NFS4_ACCESS_LOOKUP|NFS4_ACCESS_EXECUTE))
2384 entry->mask |= MAY_EXEC;
2385} 2409}
2386EXPORT_SYMBOL_GPL(nfs_access_set_mask); 2410EXPORT_SYMBOL_GPL(nfs_access_set_mask);
2387 2411
@@ -2389,6 +2413,7 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
2389{ 2413{
2390 struct nfs_access_entry cache; 2414 struct nfs_access_entry cache;
2391 bool may_block = (mask & MAY_NOT_BLOCK) == 0; 2415 bool may_block = (mask & MAY_NOT_BLOCK) == 0;
2416 int cache_mask;
2392 int status; 2417 int status;
2393 2418
2394 trace_nfs_access_enter(inode); 2419 trace_nfs_access_enter(inode);
@@ -2404,7 +2429,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
2404 goto out; 2429 goto out;
2405 2430
2406 /* Be clever: ask server to check for all possible rights */ 2431 /* Be clever: ask server to check for all possible rights */
2407 cache.mask = MAY_EXEC | MAY_WRITE | MAY_READ; 2432 cache.mask = NFS_MAY_LOOKUP | NFS_MAY_EXECUTE
2433 | NFS_MAY_WRITE | NFS_MAY_READ;
2408 cache.cred = cred; 2434 cache.cred = cred;
2409 cache.jiffies = jiffies; 2435 cache.jiffies = jiffies;
2410 status = NFS_PROTO(inode)->access(inode, &cache); 2436 status = NFS_PROTO(inode)->access(inode, &cache);
@@ -2418,7 +2444,8 @@ static int nfs_do_access(struct inode *inode, struct rpc_cred *cred, int mask)
2418 } 2444 }
2419 nfs_access_add_cache(inode, &cache); 2445 nfs_access_add_cache(inode, &cache);
2420out_cached: 2446out_cached:
2421 if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0) 2447 cache_mask = nfs_access_calc_mask(cache.mask, inode->i_mode);
2448 if ((mask & ~cache_mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) != 0)
2422 status = -EACCES; 2449 status = -EACCES;
2423out: 2450out:
2424 trace_nfs_access_exit(inode, status); 2451 trace_nfs_access_exit(inode, status);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 5713eb32a45e..af330c31f627 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -617,6 +617,8 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from)
617 if (result) 617 if (result)
618 goto out; 618 goto out;
619 } 619 }
620 if (iocb->ki_pos > i_size_read(inode))
621 nfs_revalidate_mapping(inode, file->f_mapping);
620 622
621 nfs_start_io_write(inode); 623 nfs_start_io_write(inode);
622 result = generic_write_checks(iocb, from); 624 result = generic_write_checks(iocb, from);
@@ -750,7 +752,7 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
750 */ 752 */
751 nfs_sync_mapping(filp->f_mapping); 753 nfs_sync_mapping(filp->f_mapping);
752 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) 754 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ))
753 nfs_zap_mapping(inode, filp->f_mapping); 755 nfs_zap_caches(inode);
754out: 756out:
755 return status; 757 return status;
756} 758}
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index 080fc6b278bd..44c638b7876c 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -542,6 +542,10 @@ filelayout_check_deviceid(struct pnfs_layout_hdr *lo,
542 struct nfs4_file_layout_dsaddr *dsaddr; 542 struct nfs4_file_layout_dsaddr *dsaddr;
543 int status = -EINVAL; 543 int status = -EINVAL;
544 544
545 /* Is the deviceid already set? If so, we're good. */
546 if (fl->dsaddr != NULL)
547 return 0;
548
545 /* find and reference the deviceid */ 549 /* find and reference the deviceid */
546 d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode), &fl->deviceid, 550 d = nfs4_find_get_deviceid(NFS_SERVER(lo->plh_inode), &fl->deviceid,
547 lo->plh_lc_cred, gfp_flags); 551 lo->plh_lc_cred, gfp_flags);
@@ -553,8 +557,6 @@ filelayout_check_deviceid(struct pnfs_layout_hdr *lo,
553 if (filelayout_test_devid_unavailable(&dsaddr->id_node)) 557 if (filelayout_test_devid_unavailable(&dsaddr->id_node))
554 goto out_put; 558 goto out_put;
555 559
556 fl->dsaddr = dsaddr;
557
558 if (fl->first_stripe_index >= dsaddr->stripe_count) { 560 if (fl->first_stripe_index >= dsaddr->stripe_count) {
559 dprintk("%s Bad first_stripe_index %u\n", 561 dprintk("%s Bad first_stripe_index %u\n",
560 __func__, fl->first_stripe_index); 562 __func__, fl->first_stripe_index);
@@ -570,6 +572,13 @@ filelayout_check_deviceid(struct pnfs_layout_hdr *lo,
570 goto out_put; 572 goto out_put;
571 } 573 }
572 status = 0; 574 status = 0;
575
576 /*
577 * Atomic compare and xchange to ensure we don't scribble
578 * over a non-NULL pointer.
579 */
580 if (cmpxchg(&fl->dsaddr, NULL, dsaddr) != NULL)
581 goto out_put;
573out: 582out:
574 return status; 583 return status;
575out_put: 584out_put:
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 1f2ac3dd0fe5..b0fa83a60754 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -1842,6 +1842,10 @@ static int ff_layout_initiate_commit(struct nfs_commit_data *data, int how)
1842 int vers, ret; 1842 int vers, ret;
1843 struct nfs_fh *fh; 1843 struct nfs_fh *fh;
1844 1844
1845 if (!lseg || !(pnfs_is_valid_lseg(lseg) ||
1846 test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags)))
1847 goto out_err;
1848
1845 idx = calc_ds_index_from_commit(lseg, data->ds_commit_index); 1849 idx = calc_ds_index_from_commit(lseg, data->ds_commit_index);
1846 ds = nfs4_ff_layout_prepare_ds(lseg, idx, true); 1850 ds = nfs4_ff_layout_prepare_ds(lseg, idx, true);
1847 if (!ds) 1851 if (!ds)
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c
index 3efe946672be..60bad882c123 100644
--- a/fs/nfs/mount_clnt.c
+++ b/fs/nfs/mount_clnt.c
@@ -512,7 +512,7 @@ static const struct rpc_version mnt_version1 = {
512 .counts = mnt_counts, 512 .counts = mnt_counts,
513}; 513};
514 514
515static unsigned int mnt3_counts[ARRAY_SIZE(mnt_procedures)]; 515static unsigned int mnt3_counts[ARRAY_SIZE(mnt3_procedures)];
516static const struct rpc_version mnt_version3 = { 516static const struct rpc_version mnt_version3 = {
517 .number = 3, 517 .number = 3,
518 .nrprocs = ARRAY_SIZE(mnt3_procedures), 518 .nrprocs = ARRAY_SIZE(mnt3_procedures),
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index df4a7d3ab915..d1e87ec0df84 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -220,15 +220,8 @@ static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry)
220 220
221 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0); 221 status = rpc_call_sync(NFS_CLIENT(inode), &msg, 0);
222 nfs_refresh_inode(inode, res.fattr); 222 nfs_refresh_inode(inode, res.fattr);
223 if (status == 0) { 223 if (status == 0)
224 entry->mask = 0; 224 nfs_access_set_mask(entry, res.access);
225 if (res.access & NFS3_ACCESS_READ)
226 entry->mask |= MAY_READ;
227 if (res.access & (NFS3_ACCESS_MODIFY | NFS3_ACCESS_EXTEND | NFS3_ACCESS_DELETE))
228 entry->mask |= MAY_WRITE;
229 if (res.access & (NFS3_ACCESS_LOOKUP|NFS3_ACCESS_EXECUTE))
230 entry->mask |= MAY_EXEC;
231 }
232 nfs_free_fattr(res.fattr); 225 nfs_free_fattr(res.fattr);
233out: 226out:
234 dprintk("NFS reply access: %d\n", status); 227 dprintk("NFS reply access: %d\n", status);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a0b4e1091340..18ca6879d8de 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2236,7 +2236,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
2236 int openflags) 2236 int openflags)
2237{ 2237{
2238 struct nfs_access_entry cache; 2238 struct nfs_access_entry cache;
2239 u32 mask; 2239 u32 mask, flags;
2240 2240
2241 /* access call failed or for some reason the server doesn't 2241 /* access call failed or for some reason the server doesn't
2242 * support any access modes -- defer access call until later */ 2242 * support any access modes -- defer access call until later */
@@ -2250,16 +2250,20 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
2250 */ 2250 */
2251 if (openflags & __FMODE_EXEC) { 2251 if (openflags & __FMODE_EXEC) {
2252 /* ONLY check for exec rights */ 2252 /* ONLY check for exec rights */
2253 mask = MAY_EXEC; 2253 if (S_ISDIR(state->inode->i_mode))
2254 mask = NFS4_ACCESS_LOOKUP;
2255 else
2256 mask = NFS4_ACCESS_EXECUTE;
2254 } else if ((fmode & FMODE_READ) && !opendata->file_created) 2257 } else if ((fmode & FMODE_READ) && !opendata->file_created)
2255 mask = MAY_READ; 2258 mask = NFS4_ACCESS_READ;
2256 2259
2257 cache.cred = cred; 2260 cache.cred = cred;
2258 cache.jiffies = jiffies; 2261 cache.jiffies = jiffies;
2259 nfs_access_set_mask(&cache, opendata->o_res.access_result); 2262 nfs_access_set_mask(&cache, opendata->o_res.access_result);
2260 nfs_access_add_cache(state->inode, &cache); 2263 nfs_access_add_cache(state->inode, &cache);
2261 2264
2262 if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0) 2265 flags = NFS4_ACCESS_READ | NFS4_ACCESS_EXECUTE | NFS4_ACCESS_LOOKUP;
2266 if ((mask & ~cache.mask & flags) == 0)
2263 return 0; 2267 return 0;
2264 2268
2265 return -EACCES; 2269 return -EACCES;
@@ -6492,7 +6496,7 @@ nfs4_retry_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
6492 set_current_state(TASK_INTERRUPTIBLE); 6496 set_current_state(TASK_INTERRUPTIBLE);
6493 spin_unlock_irqrestore(&q->lock, flags); 6497 spin_unlock_irqrestore(&q->lock, flags);
6494 6498
6495 freezable_schedule_timeout_interruptible(NFS4_LOCK_MAXTIMEOUT); 6499 freezable_schedule_timeout(NFS4_LOCK_MAXTIMEOUT);
6496 } 6500 }
6497 6501
6498 finish_wait(q, &wait); 6502 finish_wait(q, &wait);
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c
index d40755a0984b..25f28fa64c57 100644
--- a/fs/nfs/pnfs_nfs.c
+++ b/fs/nfs/pnfs_nfs.c
@@ -159,13 +159,18 @@ void pnfs_generic_recover_commit_reqs(struct list_head *dst,
159{ 159{
160 struct pnfs_commit_bucket *b; 160 struct pnfs_commit_bucket *b;
161 struct pnfs_layout_segment *freeme; 161 struct pnfs_layout_segment *freeme;
162 int nwritten;
162 int i; 163 int i;
163 164
164 lockdep_assert_held(&cinfo->inode->i_lock); 165 lockdep_assert_held(&cinfo->inode->i_lock);
165restart: 166restart:
166 for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) { 167 for (i = 0, b = cinfo->ds->buckets; i < cinfo->ds->nbuckets; i++, b++) {
167 if (pnfs_generic_transfer_commit_list(&b->written, dst, 168 nwritten = pnfs_generic_transfer_commit_list(&b->written,
168 cinfo, 0)) { 169 dst, cinfo, 0);
170 if (!nwritten)
171 continue;
172 cinfo->ds->nwritten -= nwritten;
173 if (list_empty(&b->written)) {
169 freeme = b->wlseg; 174 freeme = b->wlseg;
170 b->wlseg = NULL; 175 b->wlseg = NULL;
171 spin_unlock(&cinfo->inode->i_lock); 176 spin_unlock(&cinfo->inode->i_lock);
@@ -174,7 +179,6 @@ restart:
174 goto restart; 179 goto restart;
175 } 180 }
176 } 181 }
177 cinfo->ds->nwritten = 0;
178} 182}
179EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs); 183EXPORT_SYMBOL_GPL(pnfs_generic_recover_commit_reqs);
180 184
@@ -183,6 +187,7 @@ static void pnfs_generic_retry_commit(struct nfs_commit_info *cinfo, int idx)
183 struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; 187 struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds;
184 struct pnfs_commit_bucket *bucket; 188 struct pnfs_commit_bucket *bucket;
185 struct pnfs_layout_segment *freeme; 189 struct pnfs_layout_segment *freeme;
190 struct list_head *pos;
186 LIST_HEAD(pages); 191 LIST_HEAD(pages);
187 int i; 192 int i;
188 193
@@ -193,6 +198,8 @@ static void pnfs_generic_retry_commit(struct nfs_commit_info *cinfo, int idx)
193 continue; 198 continue;
194 freeme = bucket->clseg; 199 freeme = bucket->clseg;
195 bucket->clseg = NULL; 200 bucket->clseg = NULL;
201 list_for_each(pos, &bucket->committing)
202 cinfo->ds->ncommitting--;
196 list_splice_init(&bucket->committing, &pages); 203 list_splice_init(&bucket->committing, &pages);
197 spin_unlock(&cinfo->inode->i_lock); 204 spin_unlock(&cinfo->inode->i_lock);
198 nfs_retry_commit(&pages, freeme, cinfo, i); 205 nfs_retry_commit(&pages, freeme, cinfo, i);
@@ -217,13 +224,6 @@ pnfs_generic_alloc_ds_commits(struct nfs_commit_info *cinfo,
217 for (i = 0; i < fl_cinfo->nbuckets; i++, bucket++) { 224 for (i = 0; i < fl_cinfo->nbuckets; i++, bucket++) {
218 if (list_empty(&bucket->committing)) 225 if (list_empty(&bucket->committing))
219 continue; 226 continue;
220 /*
221 * If the layout segment is invalid, then let
222 * pnfs_generic_retry_commit() clean up the bucket.
223 */
224 if (bucket->clseg && !pnfs_is_valid_lseg(bucket->clseg) &&
225 !test_bit(NFS_LSEG_LAYOUTRETURN, &bucket->clseg->pls_flags))
226 break;
227 data = nfs_commitdata_alloc(false); 227 data = nfs_commitdata_alloc(false);
228 if (!data) 228 if (!data)
229 break; 229 break;
@@ -243,9 +243,12 @@ void pnfs_fetch_commit_bucket_list(struct list_head *pages,
243 struct nfs_commit_info *cinfo) 243 struct nfs_commit_info *cinfo)
244{ 244{
245 struct pnfs_commit_bucket *bucket; 245 struct pnfs_commit_bucket *bucket;
246 struct list_head *pos;
246 247
247 bucket = &cinfo->ds->buckets[data->ds_commit_index]; 248 bucket = &cinfo->ds->buckets[data->ds_commit_index];
248 spin_lock(&cinfo->inode->i_lock); 249 spin_lock(&cinfo->inode->i_lock);
250 list_for_each(pos, &bucket->committing)
251 cinfo->ds->ncommitting--;
249 list_splice_init(&bucket->committing, pages); 252 list_splice_init(&bucket->committing, pages);
250 data->lseg = bucket->clseg; 253 data->lseg = bucket->clseg;
251 bucket->clseg = NULL; 254 bucket->clseg = NULL;
@@ -330,7 +333,6 @@ pnfs_generic_commit_pagelist(struct inode *inode, struct list_head *mds_pages,
330 } 333 }
331 } 334 }
332out: 335out:
333 cinfo->ds->ncommitting = 0;
334 return PNFS_ATTEMPTED; 336 return PNFS_ATTEMPTED;
335} 337}
336EXPORT_SYMBOL_GPL(pnfs_generic_commit_pagelist); 338EXPORT_SYMBOL_GPL(pnfs_generic_commit_pagelist);
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index b45083c0f9ae..49b0a9e7ff18 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -720,8 +720,8 @@ static const struct rpc_version nfs_cb_version4 = {
720 .counts = nfs4_cb_counts, 720 .counts = nfs4_cb_counts,
721}; 721};
722 722
723static const struct rpc_version *nfs_cb_version[] = { 723static const struct rpc_version *nfs_cb_version[2] = {
724 &nfs_cb_version4, 724 [1] = &nfs_cb_version4,
725}; 725};
726 726
727static const struct rpc_program cb_program; 727static const struct rpc_program cb_program;
@@ -795,7 +795,7 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
795 .saddress = (struct sockaddr *) &conn->cb_saddr, 795 .saddress = (struct sockaddr *) &conn->cb_saddr,
796 .timeout = &timeparms, 796 .timeout = &timeparms,
797 .program = &cb_program, 797 .program = &cb_program,
798 .version = 0, 798 .version = 1,
799 .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET), 799 .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
800 }; 800 };
801 struct rpc_clnt *client; 801 struct rpc_clnt *client;
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 641d9ee97f91..48b70e6490f3 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -481,17 +481,30 @@ out_cleanup:
481} 481}
482 482
483static int ovl_create_or_link(struct dentry *dentry, struct inode *inode, 483static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
484 struct cattr *attr, struct dentry *hardlink) 484 struct cattr *attr, struct dentry *hardlink,
485 bool origin)
485{ 486{
486 int err; 487 int err;
487 const struct cred *old_cred; 488 const struct cred *old_cred;
488 struct cred *override_cred; 489 struct cred *override_cred;
490 struct dentry *parent = dentry->d_parent;
489 491
490 err = ovl_copy_up(dentry->d_parent); 492 err = ovl_copy_up(parent);
491 if (err) 493 if (err)
492 return err; 494 return err;
493 495
494 old_cred = ovl_override_creds(dentry->d_sb); 496 old_cred = ovl_override_creds(dentry->d_sb);
497
498 /*
499 * When linking a file with copy up origin into a new parent, mark the
500 * new parent dir "impure".
501 */
502 if (origin) {
503 err = ovl_set_impure(parent, ovl_dentry_upper(parent));
504 if (err)
505 goto out_revert_creds;
506 }
507
495 err = -ENOMEM; 508 err = -ENOMEM;
496 override_cred = prepare_creds(); 509 override_cred = prepare_creds();
497 if (override_cred) { 510 if (override_cred) {
@@ -550,7 +563,7 @@ static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev,
550 inode_init_owner(inode, dentry->d_parent->d_inode, mode); 563 inode_init_owner(inode, dentry->d_parent->d_inode, mode);
551 attr.mode = inode->i_mode; 564 attr.mode = inode->i_mode;
552 565
553 err = ovl_create_or_link(dentry, inode, &attr, NULL); 566 err = ovl_create_or_link(dentry, inode, &attr, NULL, false);
554 if (err) 567 if (err)
555 iput(inode); 568 iput(inode);
556 569
@@ -609,7 +622,8 @@ static int ovl_link(struct dentry *old, struct inode *newdir,
609 inode = d_inode(old); 622 inode = d_inode(old);
610 ihold(inode); 623 ihold(inode);
611 624
612 err = ovl_create_or_link(new, inode, NULL, ovl_dentry_upper(old)); 625 err = ovl_create_or_link(new, inode, NULL, ovl_dentry_upper(old),
626 ovl_type_origin(old));
613 if (err) 627 if (err)
614 iput(inode); 628 iput(inode);
615 629
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index 69f4fc26ee39..5bc71642b226 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -202,37 +202,38 @@ bool ovl_is_private_xattr(const char *name)
202 sizeof(OVL_XATTR_PREFIX) - 1) == 0; 202 sizeof(OVL_XATTR_PREFIX) - 1) == 0;
203} 203}
204 204
205int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value, 205int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
206 size_t size, int flags) 206 const void *value, size_t size, int flags)
207{ 207{
208 int err; 208 int err;
209 struct path realpath; 209 struct dentry *upperdentry = ovl_i_dentry_upper(inode);
210 enum ovl_path_type type = ovl_path_real(dentry, &realpath); 210 struct dentry *realdentry = upperdentry ?: ovl_dentry_lower(dentry);
211 const struct cred *old_cred; 211 const struct cred *old_cred;
212 212
213 err = ovl_want_write(dentry); 213 err = ovl_want_write(dentry);
214 if (err) 214 if (err)
215 goto out; 215 goto out;
216 216
217 if (!value && !OVL_TYPE_UPPER(type)) { 217 if (!value && !upperdentry) {
218 err = vfs_getxattr(realpath.dentry, name, NULL, 0); 218 err = vfs_getxattr(realdentry, name, NULL, 0);
219 if (err < 0) 219 if (err < 0)
220 goto out_drop_write; 220 goto out_drop_write;
221 } 221 }
222 222
223 err = ovl_copy_up(dentry); 223 if (!upperdentry) {
224 if (err) 224 err = ovl_copy_up(dentry);
225 goto out_drop_write; 225 if (err)
226 goto out_drop_write;
226 227
227 if (!OVL_TYPE_UPPER(type)) 228 realdentry = ovl_dentry_upper(dentry);
228 ovl_path_upper(dentry, &realpath); 229 }
229 230
230 old_cred = ovl_override_creds(dentry->d_sb); 231 old_cred = ovl_override_creds(dentry->d_sb);
231 if (value) 232 if (value)
232 err = vfs_setxattr(realpath.dentry, name, value, size, flags); 233 err = vfs_setxattr(realdentry, name, value, size, flags);
233 else { 234 else {
234 WARN_ON(flags != XATTR_REPLACE); 235 WARN_ON(flags != XATTR_REPLACE);
235 err = vfs_removexattr(realpath.dentry, name); 236 err = vfs_removexattr(realdentry, name);
236 } 237 }
237 revert_creds(old_cred); 238 revert_creds(old_cred);
238 239
@@ -242,12 +243,13 @@ out:
242 return err; 243 return err;
243} 244}
244 245
245int ovl_xattr_get(struct dentry *dentry, const char *name, 246int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
246 void *value, size_t size) 247 void *value, size_t size)
247{ 248{
248 struct dentry *realdentry = ovl_dentry_real(dentry);
249 ssize_t res; 249 ssize_t res;
250 const struct cred *old_cred; 250 const struct cred *old_cred;
251 struct dentry *realdentry =
252 ovl_i_dentry_upper(inode) ?: ovl_dentry_lower(dentry);
251 253
252 old_cred = ovl_override_creds(dentry->d_sb); 254 old_cred = ovl_override_creds(dentry->d_sb);
253 res = vfs_getxattr(realdentry, name, value, size); 255 res = vfs_getxattr(realdentry, name, value, size);
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 9bc0e580a5b3..8aef2b304b2d 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -397,8 +397,19 @@ int ovl_verify_index(struct dentry *index, struct path *lowerstack,
397 if (!d_inode(index)) 397 if (!d_inode(index))
398 return 0; 398 return 0;
399 399
400 err = -EISDIR; 400 /*
401 if (d_is_dir(index)) 401 * Directory index entries are going to be used for looking up
402 * redirected upper dirs by lower dir fh when decoding an overlay
403 * file handle of a merge dir. Whiteout index entries are going to be
404 * used as an indication that an exported overlay file handle should
405 * be treated as stale (i.e. after unlink of the overlay inode).
406 * We don't know the verification rules for directory and whiteout
407 * index entries, because they have not been implemented yet, so return
408 * EROFS if those entries are found to avoid corrupting an index that
409 * was created by a newer kernel.
410 */
411 err = -EROFS;
412 if (d_is_dir(index) || ovl_is_whiteout(index))
402 goto fail; 413 goto fail;
403 414
404 err = -EINVAL; 415 err = -EINVAL;
@@ -436,8 +447,8 @@ out:
436 return err; 447 return err;
437 448
438fail: 449fail:
439 pr_warn_ratelimited("overlayfs: failed to verify index (%pd2, err=%i)\n", 450 pr_warn_ratelimited("overlayfs: failed to verify index (%pd2, ftype=%x, err=%i)\n",
440 index, err); 451 index, d_inode(index)->i_mode & S_IFMT, err);
441 goto out; 452 goto out;
442} 453}
443 454
@@ -502,6 +513,7 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry,
502 goto out; 513 goto out;
503 } 514 }
504 515
516 inode = d_inode(index);
505 if (d_is_negative(index)) { 517 if (d_is_negative(index)) {
506 if (upper && d_inode(origin)->i_nlink > 1) { 518 if (upper && d_inode(origin)->i_nlink > 1) {
507 pr_warn_ratelimited("overlayfs: hard link with origin but no index (ino=%lu).\n", 519 pr_warn_ratelimited("overlayfs: hard link with origin but no index (ino=%lu).\n",
@@ -511,11 +523,22 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry,
511 523
512 dput(index); 524 dput(index);
513 index = NULL; 525 index = NULL;
514 } else if (upper && d_inode(index) != d_inode(upper)) { 526 } else if (upper && d_inode(upper) != inode) {
515 inode = d_inode(index); 527 pr_warn_ratelimited("overlayfs: wrong index found (index=%pd2, ino=%lu, upper ino=%lu).\n",
516 pr_warn_ratelimited("overlayfs: wrong index found (index ino: %lu, upper ino: %lu).\n", 528 index, inode->i_ino, d_inode(upper)->i_ino);
517 d_inode(index)->i_ino, 529 goto fail;
518 d_inode(upper)->i_ino); 530 } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) ||
531 ((inode->i_mode ^ d_inode(origin)->i_mode) & S_IFMT)) {
532 /*
533 * Index should always be of the same file type as origin
534 * except for the case of a whiteout index. A whiteout
535 * index should only exist if all lower aliases have been
536 * unlinked, which means that finding a lower origin on lookup
537 * whose index is a whiteout should be treated as an error.
538 */
539 pr_warn_ratelimited("overlayfs: bad index found (index=%pd2, ftype=%x, origin ftype=%x).\n",
540 index, d_inode(index)->i_mode & S_IFMT,
541 d_inode(origin)->i_mode & S_IFMT);
519 goto fail; 542 goto fail;
520 } 543 }
521 544
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 60d26605e039..e927a62c97ae 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -47,7 +47,8 @@ enum ovl_flag {
47/* Is the real inode encoded in fid an upper inode? */ 47/* Is the real inode encoded in fid an upper inode? */
48#define OVL_FH_FLAG_PATH_UPPER (1 << 2) 48#define OVL_FH_FLAG_PATH_UPPER (1 << 2)
49 49
50#define OVL_FH_FLAG_ALL (OVL_FH_FLAG_BIG_ENDIAN | OVL_FH_FLAG_ANY_ENDIAN) 50#define OVL_FH_FLAG_ALL (OVL_FH_FLAG_BIG_ENDIAN | OVL_FH_FLAG_ANY_ENDIAN | \
51 OVL_FH_FLAG_PATH_UPPER)
51 52
52#if defined(__LITTLE_ENDIAN) 53#if defined(__LITTLE_ENDIAN)
53#define OVL_FH_FLAG_CPU_ENDIAN 0 54#define OVL_FH_FLAG_CPU_ENDIAN 0
@@ -199,6 +200,7 @@ enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path);
199struct dentry *ovl_dentry_upper(struct dentry *dentry); 200struct dentry *ovl_dentry_upper(struct dentry *dentry);
200struct dentry *ovl_dentry_lower(struct dentry *dentry); 201struct dentry *ovl_dentry_lower(struct dentry *dentry);
201struct dentry *ovl_dentry_real(struct dentry *dentry); 202struct dentry *ovl_dentry_real(struct dentry *dentry);
203struct dentry *ovl_i_dentry_upper(struct inode *inode);
202struct inode *ovl_inode_upper(struct inode *inode); 204struct inode *ovl_inode_upper(struct inode *inode);
203struct inode *ovl_inode_lower(struct inode *inode); 205struct inode *ovl_inode_lower(struct inode *inode);
204struct inode *ovl_inode_real(struct inode *inode); 206struct inode *ovl_inode_real(struct inode *inode);
@@ -270,9 +272,9 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr);
270int ovl_getattr(const struct path *path, struct kstat *stat, 272int ovl_getattr(const struct path *path, struct kstat *stat,
271 u32 request_mask, unsigned int flags); 273 u32 request_mask, unsigned int flags);
272int ovl_permission(struct inode *inode, int mask); 274int ovl_permission(struct inode *inode, int mask);
273int ovl_xattr_set(struct dentry *dentry, const char *name, const void *value, 275int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
274 size_t size, int flags); 276 const void *value, size_t size, int flags);
275int ovl_xattr_get(struct dentry *dentry, const char *name, 277int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
276 void *value, size_t size); 278 void *value, size_t size);
277ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); 279ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
278struct posix_acl *ovl_get_acl(struct inode *inode, int type); 280struct posix_acl *ovl_get_acl(struct inode *inode, int type);
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 0298463cf9c3..3d424a51cabb 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -703,7 +703,10 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt,
703 err = PTR_ERR(index); 703 err = PTR_ERR(index);
704 break; 704 break;
705 } 705 }
706 if (ovl_verify_index(index, lowerstack, numlower)) { 706 err = ovl_verify_index(index, lowerstack, numlower);
707 if (err) {
708 if (err == -EROFS)
709 break;
707 err = ovl_cleanup(dir, index); 710 err = ovl_cleanup(dir, index);
708 if (err) 711 if (err)
709 break; 712 break;
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 44dc2d6ffe0f..d86e89f97201 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -692,7 +692,7 @@ ovl_posix_acl_xattr_get(const struct xattr_handler *handler,
692 struct dentry *dentry, struct inode *inode, 692 struct dentry *dentry, struct inode *inode,
693 const char *name, void *buffer, size_t size) 693 const char *name, void *buffer, size_t size)
694{ 694{
695 return ovl_xattr_get(dentry, handler->name, buffer, size); 695 return ovl_xattr_get(dentry, inode, handler->name, buffer, size);
696} 696}
697 697
698static int __maybe_unused 698static int __maybe_unused
@@ -742,7 +742,7 @@ ovl_posix_acl_xattr_set(const struct xattr_handler *handler,
742 return err; 742 return err;
743 } 743 }
744 744
745 err = ovl_xattr_set(dentry, handler->name, value, size, flags); 745 err = ovl_xattr_set(dentry, inode, handler->name, value, size, flags);
746 if (!err) 746 if (!err)
747 ovl_copyattr(ovl_inode_real(inode), inode); 747 ovl_copyattr(ovl_inode_real(inode), inode);
748 748
@@ -772,7 +772,7 @@ static int ovl_other_xattr_get(const struct xattr_handler *handler,
772 struct dentry *dentry, struct inode *inode, 772 struct dentry *dentry, struct inode *inode,
773 const char *name, void *buffer, size_t size) 773 const char *name, void *buffer, size_t size)
774{ 774{
775 return ovl_xattr_get(dentry, name, buffer, size); 775 return ovl_xattr_get(dentry, inode, name, buffer, size);
776} 776}
777 777
778static int ovl_other_xattr_set(const struct xattr_handler *handler, 778static int ovl_other_xattr_set(const struct xattr_handler *handler,
@@ -780,7 +780,7 @@ static int ovl_other_xattr_set(const struct xattr_handler *handler,
780 const char *name, const void *value, 780 const char *name, const void *value,
781 size_t size, int flags) 781 size_t size, int flags)
782{ 782{
783 return ovl_xattr_set(dentry, name, value, size, flags); 783 return ovl_xattr_set(dentry, inode, name, value, size, flags);
784} 784}
785 785
786static const struct xattr_handler __maybe_unused 786static const struct xattr_handler __maybe_unused
@@ -1058,10 +1058,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1058 1058
1059 ufs->indexdir = ovl_workdir_create(sb, ufs, workpath.dentry, 1059 ufs->indexdir = ovl_workdir_create(sb, ufs, workpath.dentry,
1060 OVL_INDEXDIR_NAME, true); 1060 OVL_INDEXDIR_NAME, true);
1061 err = PTR_ERR(ufs->indexdir);
1062 if (IS_ERR(ufs->indexdir))
1063 goto out_put_lower_mnt;
1064
1065 if (ufs->indexdir) { 1061 if (ufs->indexdir) {
1066 /* Verify upper root is index dir origin */ 1062 /* Verify upper root is index dir origin */
1067 err = ovl_verify_origin(ufs->indexdir, ufs->upper_mnt, 1063 err = ovl_verify_origin(ufs->indexdir, ufs->upper_mnt,
@@ -1090,6 +1086,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1090 else 1086 else
1091 sb->s_d_op = &ovl_dentry_operations; 1087 sb->s_d_op = &ovl_dentry_operations;
1092 1088
1089 err = -ENOMEM;
1093 ufs->creator_cred = cred = prepare_creds(); 1090 ufs->creator_cred = cred = prepare_creds();
1094 if (!cred) 1091 if (!cred)
1095 goto out_put_indexdir; 1092 goto out_put_indexdir;
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index c492ba75c659..f46ad75dc96a 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -157,9 +157,14 @@ struct dentry *ovl_dentry_real(struct dentry *dentry)
157 return ovl_dentry_upper(dentry) ?: ovl_dentry_lower(dentry); 157 return ovl_dentry_upper(dentry) ?: ovl_dentry_lower(dentry);
158} 158}
159 159
160struct dentry *ovl_i_dentry_upper(struct inode *inode)
161{
162 return ovl_upperdentry_dereference(OVL_I(inode));
163}
164
160struct inode *ovl_inode_upper(struct inode *inode) 165struct inode *ovl_inode_upper(struct inode *inode)
161{ 166{
162 struct dentry *upperdentry = ovl_upperdentry_dereference(OVL_I(inode)); 167 struct dentry *upperdentry = ovl_i_dentry_upper(inode);
163 168
164 return upperdentry ? d_inode(upperdentry) : NULL; 169 return upperdentry ? d_inode(upperdentry) : NULL;
165} 170}
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 18694598bebf..aa2b89071630 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -51,7 +51,7 @@ struct proc_dir_entry {
51 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 51 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
52 u8 namelen; 52 u8 namelen;
53 char name[]; 53 char name[];
54}; 54} __randomize_layout;
55 55
56union proc_op { 56union proc_op {
57 int (*proc_get_link)(struct dentry *, struct path *); 57 int (*proc_get_link)(struct dentry *, struct path *);
@@ -70,7 +70,7 @@ struct proc_inode {
70 struct hlist_node sysctl_inodes; 70 struct hlist_node sysctl_inodes;
71 const struct proc_ns_operations *ns_ops; 71 const struct proc_ns_operations *ns_ops;
72 struct inode vfs_inode; 72 struct inode vfs_inode;
73}; 73} __randomize_layout;
74 74
75/* 75/*
76 * General functions 76 * General functions
@@ -279,7 +279,7 @@ struct proc_maps_private {
279#ifdef CONFIG_NUMA 279#ifdef CONFIG_NUMA
280 struct mempolicy *task_mempolicy; 280 struct mempolicy *task_mempolicy;
281#endif 281#endif
282}; 282} __randomize_layout;
283 283
284struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode); 284struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode);
285 285
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 3d2256a425ee..54415f0e3d18 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -23,7 +23,8 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
23 struct reiserfs_transaction_handle th; 23 struct reiserfs_transaction_handle th;
24 size_t jcreate_blocks; 24 size_t jcreate_blocks;
25 int size = acl ? posix_acl_xattr_size(acl->a_count) : 0; 25 int size = acl ? posix_acl_xattr_size(acl->a_count) : 0;
26 26 int update_mode = 0;
27 umode_t mode = inode->i_mode;
27 28
28 /* 29 /*
29 * Pessimism: We can't assume that anything from the xattr root up 30 * Pessimism: We can't assume that anything from the xattr root up
@@ -37,7 +38,16 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
37 error = journal_begin(&th, inode->i_sb, jcreate_blocks); 38 error = journal_begin(&th, inode->i_sb, jcreate_blocks);
38 reiserfs_write_unlock(inode->i_sb); 39 reiserfs_write_unlock(inode->i_sb);
39 if (error == 0) { 40 if (error == 0) {
41 if (type == ACL_TYPE_ACCESS && acl) {
42 error = posix_acl_update_mode(inode, &mode, &acl);
43 if (error)
44 goto unlock;
45 update_mode = 1;
46 }
40 error = __reiserfs_set_acl(&th, inode, type, acl); 47 error = __reiserfs_set_acl(&th, inode, type, acl);
48 if (!error && update_mode)
49 inode->i_mode = mode;
50unlock:
41 reiserfs_write_lock(inode->i_sb); 51 reiserfs_write_lock(inode->i_sb);
42 error2 = journal_end(&th); 52 error2 = journal_end(&th);
43 reiserfs_write_unlock(inode->i_sb); 53 reiserfs_write_unlock(inode->i_sb);
@@ -241,11 +251,6 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
241 switch (type) { 251 switch (type) {
242 case ACL_TYPE_ACCESS: 252 case ACL_TYPE_ACCESS:
243 name = XATTR_NAME_POSIX_ACL_ACCESS; 253 name = XATTR_NAME_POSIX_ACL_ACCESS;
244 if (acl) {
245 error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
246 if (error)
247 return error;
248 }
249 break; 254 break;
250 case ACL_TYPE_DEFAULT: 255 case ACL_TYPE_DEFAULT:
251 name = XATTR_NAME_POSIX_ACL_DEFAULT; 256 name = XATTR_NAME_POSIX_ACL_DEFAULT;
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 0a9880777c9c..c09c16b1ad3b 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5435,6 +5435,7 @@ __xfs_bunmapi(
5435 xfs_fsblock_t sum; 5435 xfs_fsblock_t sum;
5436 xfs_filblks_t len = *rlen; /* length to unmap in file */ 5436 xfs_filblks_t len = *rlen; /* length to unmap in file */
5437 xfs_fileoff_t max_len; 5437 xfs_fileoff_t max_len;
5438 xfs_agnumber_t prev_agno = NULLAGNUMBER, agno;
5438 5439
5439 trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_); 5440 trace_xfs_bunmap(ip, bno, len, flags, _RET_IP_);
5440 5441
@@ -5534,6 +5535,17 @@ __xfs_bunmapi(
5534 */ 5535 */
5535 del = got; 5536 del = got;
5536 wasdel = isnullstartblock(del.br_startblock); 5537 wasdel = isnullstartblock(del.br_startblock);
5538
5539 /*
5540 * Make sure we don't touch multiple AGF headers out of order
5541 * in a single transaction, as that could cause AB-BA deadlocks.
5542 */
5543 if (!wasdel) {
5544 agno = XFS_FSB_TO_AGNO(mp, del.br_startblock);
5545 if (prev_agno != NULLAGNUMBER && prev_agno > agno)
5546 break;
5547 prev_agno = agno;
5548 }
5537 if (got.br_startoff < start) { 5549 if (got.br_startoff < start) {
5538 del.br_startoff = start; 5550 del.br_startoff = start;
5539 del.br_blockcount -= start - got.br_startoff; 5551 del.br_blockcount -= start - got.br_startoff;
@@ -6499,6 +6511,15 @@ xfs_bmap_finish_one(
6499 xfs_fsblock_t firstfsb; 6511 xfs_fsblock_t firstfsb;
6500 int error = 0; 6512 int error = 0;
6501 6513
6514 /*
6515 * firstfsb is tied to the transaction lifetime and is used to
6516 * ensure correct AG locking order and schedule work item
6517 * continuations. XFS_BUI_MAX_FAST_EXTENTS (== 1) restricts us
6518 * to only making one bmap call per transaction, so it should
6519 * be safe to have it as a local variable here.
6520 */
6521 firstfsb = NULLFSBLOCK;
6522
6502 trace_xfs_bmap_deferred(tp->t_mountp, 6523 trace_xfs_bmap_deferred(tp->t_mountp,
6503 XFS_FSB_TO_AGNO(tp->t_mountp, startblock), type, 6524 XFS_FSB_TO_AGNO(tp->t_mountp, startblock), type,
6504 XFS_FSB_TO_AGBNO(tp->t_mountp, startblock), 6525 XFS_FSB_TO_AGBNO(tp->t_mountp, startblock),
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 4da85fff69ad..e0bcc4a59efd 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -728,7 +728,8 @@ xfs_btree_firstrec(
728 * Get the block pointer for this level. 728 * Get the block pointer for this level.
729 */ 729 */
730 block = xfs_btree_get_block(cur, level, &bp); 730 block = xfs_btree_get_block(cur, level, &bp);
731 xfs_btree_check_block(cur, block, level, bp); 731 if (xfs_btree_check_block(cur, block, level, bp))
732 return 0;
732 /* 733 /*
733 * It's empty, there is no such record. 734 * It's empty, there is no such record.
734 */ 735 */
@@ -757,7 +758,8 @@ xfs_btree_lastrec(
757 * Get the block pointer for this level. 758 * Get the block pointer for this level.
758 */ 759 */
759 block = xfs_btree_get_block(cur, level, &bp); 760 block = xfs_btree_get_block(cur, level, &bp);
760 xfs_btree_check_block(cur, block, level, bp); 761 if (xfs_btree_check_block(cur, block, level, bp))
762 return 0;
761 /* 763 /*
762 * It's empty, there is no such record. 764 * It's empty, there is no such record.
763 */ 765 */
diff --git a/fs/xfs/libxfs/xfs_dir2_data.c b/fs/xfs/libxfs/xfs_dir2_data.c
index d478065b9544..8727a43115ef 100644
--- a/fs/xfs/libxfs/xfs_dir2_data.c
+++ b/fs/xfs/libxfs/xfs_dir2_data.c
@@ -136,6 +136,8 @@ __xfs_dir3_data_check(
136 */ 136 */
137 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { 137 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
138 XFS_WANT_CORRUPTED_RETURN(mp, lastfree == 0); 138 XFS_WANT_CORRUPTED_RETURN(mp, lastfree == 0);
139 XFS_WANT_CORRUPTED_RETURN(mp, endp >=
140 p + be16_to_cpu(dup->length));
139 XFS_WANT_CORRUPTED_RETURN(mp, 141 XFS_WANT_CORRUPTED_RETURN(mp,
140 be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) == 142 be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) ==
141 (char *)dup - (char *)hdr); 143 (char *)dup - (char *)hdr);
@@ -164,6 +166,8 @@ __xfs_dir3_data_check(
164 XFS_WANT_CORRUPTED_RETURN(mp, dep->namelen != 0); 166 XFS_WANT_CORRUPTED_RETURN(mp, dep->namelen != 0);
165 XFS_WANT_CORRUPTED_RETURN(mp, 167 XFS_WANT_CORRUPTED_RETURN(mp,
166 !xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber))); 168 !xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)));
169 XFS_WANT_CORRUPTED_RETURN(mp, endp >=
170 p + ops->data_entsize(dep->namelen));
167 XFS_WANT_CORRUPTED_RETURN(mp, 171 XFS_WANT_CORRUPTED_RETURN(mp,
168 be16_to_cpu(*ops->data_entry_tag_p(dep)) == 172 be16_to_cpu(*ops->data_entry_tag_p(dep)) ==
169 (char *)dep - (char *)hdr); 173 (char *)dep - (char *)hdr);
diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c
index 900ea231f9a3..45b1c3b4e047 100644
--- a/fs/xfs/libxfs/xfs_refcount.c
+++ b/fs/xfs/libxfs/xfs_refcount.c
@@ -1638,6 +1638,10 @@ xfs_refcount_recover_cow_leftovers(
1638 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); 1638 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
1639 if (error) 1639 if (error)
1640 goto out_trans; 1640 goto out_trans;
1641 if (!agbp) {
1642 error = -ENOMEM;
1643 goto out_trans;
1644 }
1641 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL); 1645 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL);
1642 1646
1643 /* Find all the leftover CoW staging extents. */ 1647 /* Find all the leftover CoW staging extents. */
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 6ce948c436d5..15751dc2a27d 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -111,6 +111,9 @@ restart:
111 skipped = 0; 111 skipped = 0;
112 break; 112 break;
113 } 113 }
114 /* we're done if id overflows back to zero */
115 if (!next_index)
116 break;
114 } 117 }
115 118
116 if (skipped) { 119 if (skipped) {
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index ab2270a87196..f45fbf0db9bb 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -170,6 +170,8 @@ xfs_reflink_find_shared(
170 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); 170 error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
171 if (error) 171 if (error)
172 return error; 172 return error;
173 if (!agbp)
174 return -ENOMEM;
173 175
174 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL); 176 cur = xfs_refcountbt_init_cursor(mp, tp, agbp, agno, NULL);
175 177
@@ -329,7 +331,7 @@ xfs_reflink_convert_cow_extent(
329 xfs_filblks_t count_fsb, 331 xfs_filblks_t count_fsb,
330 struct xfs_defer_ops *dfops) 332 struct xfs_defer_ops *dfops)
331{ 333{
332 xfs_fsblock_t first_block; 334 xfs_fsblock_t first_block = NULLFSBLOCK;
333 int nimaps = 1; 335 int nimaps = 1;
334 336
335 if (imap->br_state == XFS_EXT_NORM) 337 if (imap->br_state == XFS_EXT_NORM)
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index d4b72944ccda..1e3a74f94131 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -3,6 +3,7 @@
3 3
4#ifdef CONFIG_ACPI_NUMA 4#ifdef CONFIG_ACPI_NUMA
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/numa.h>
6 7
7/* Proximity bitmap length */ 8/* Proximity bitmap length */
8#if MAX_NUMNODES > 256 9#if MAX_NUMNODES > 256
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 05488da3aee9..3ae9013eeaaa 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -46,7 +46,7 @@ struct linux_binprm {
46 unsigned interp_flags; 46 unsigned interp_flags;
47 unsigned interp_data; 47 unsigned interp_data;
48 unsigned long loader, exec; 48 unsigned long loader, exec;
49}; 49} __randomize_layout;
50 50
51#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 51#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
52#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) 52#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
@@ -81,7 +81,7 @@ struct linux_binfmt {
81 int (*load_shlib)(struct file *); 81 int (*load_shlib)(struct file *);
82 int (*core_dump)(struct coredump_params *cprm); 82 int (*core_dump)(struct coredump_params *cprm);
83 unsigned long min_coredump; /* minimal dump size */ 83 unsigned long min_coredump; /* minimal dump size */
84}; 84} __randomize_layout;
85 85
86extern void __register_binfmt(struct linux_binfmt *fmt, int insert); 86extern void __register_binfmt(struct linux_binfmt *fmt, int insert);
87 87
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 360c082e885c..d41d40ac3efd 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -85,7 +85,7 @@ int __cgroup_bpf_run_filter_sock_ops(struct sock *sk,
85 int __ret = 0; \ 85 int __ret = 0; \
86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \ 86 if (cgroup_bpf_enabled && (sock_ops)->sk) { \
87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \ 87 typeof(sk) __sk = sk_to_full_sk((sock_ops)->sk); \
88 if (sk_fullsock(__sk)) \ 88 if (__sk && sk_fullsock(__sk)) \
89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \ 89 __ret = __cgroup_bpf_run_filter_sock_ops(__sk, \
90 sock_ops, \ 90 sock_ops, \
91 BPF_CGROUP_SOCK_OPS); \ 91 BPF_CGROUP_SOCK_OPS); \
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 621076f56251..8e5d31f6faef 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -43,6 +43,7 @@ struct bpf_reg_state {
43 u32 min_align; 43 u32 min_align;
44 u32 aux_off; 44 u32 aux_off;
45 u32 aux_off_align; 45 u32 aux_off_align;
46 bool value_from_signed;
46}; 47};
47 48
48enum bpf_stack_slot_type { 49enum bpf_stack_slot_type {
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 408bc09ce497..cb28eb21e3ca 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -17,7 +17,7 @@ struct cdev {
17 struct list_head list; 17 struct list_head list;
18 dev_t dev; 18 dev_t dev;
19 unsigned int count; 19 unsigned int count;
20}; 20} __randomize_layout;
21 21
22void cdev_init(struct cdev *, const struct file_operations *); 22void cdev_init(struct cdev *, const struct file_operations *);
23 23
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index f0f6c537b64c..040dd105c3e7 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -10,14 +10,14 @@
10#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL 10#define CEPH_FEATURE_INCARNATION_2 (1ull<<57) // CEPH_FEATURE_SERVER_JEWEL
11 11
12#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \ 12#define DEFINE_CEPH_FEATURE(bit, incarnation, name) \
13 const static uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \ 13 static const uint64_t CEPH_FEATURE_##name = (1ULL<<bit); \
14 const static uint64_t CEPH_FEATUREMASK_##name = \ 14 static const uint64_t CEPH_FEATUREMASK_##name = \
15 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); 15 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
16 16
17/* this bit is ignored but still advertised by release *when* */ 17/* this bit is ignored but still advertised by release *when* */
18#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \ 18#define DEFINE_CEPH_FEATURE_DEPRECATED(bit, incarnation, name, when) \
19 const static uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \ 19 static const uint64_t DEPRECATED_CEPH_FEATURE_##name = (1ULL<<bit); \
20 const static uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \ 20 static const uint64_t DEPRECATED_CEPH_FEATUREMASK_##name = \
21 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation); 21 (1ULL<<bit | CEPH_FEATURE_INCARNATION_##incarnation);
22 22
23/* 23/*
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index cd4bbe8242bd..bdb80c4aef6e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -235,6 +235,7 @@
235#endif /* GCC_VERSION >= 40500 */ 235#endif /* GCC_VERSION >= 40500 */
236 236
237#if GCC_VERSION >= 40600 237#if GCC_VERSION >= 40600
238
238/* 239/*
239 * When used with Link Time Optimization, gcc can optimize away C functions or 240 * When used with Link Time Optimization, gcc can optimize away C functions or
240 * variables which are referenced only from assembly code. __visible tells the 241 * variables which are referenced only from assembly code. __visible tells the
@@ -242,7 +243,17 @@
242 * this. 243 * this.
243 */ 244 */
244#define __visible __attribute__((externally_visible)) 245#define __visible __attribute__((externally_visible))
245#endif 246
247/*
248 * RANDSTRUCT_PLUGIN wants to use an anonymous struct, but it is only
249 * possible since GCC 4.6. To provide as much build testing coverage
250 * as possible, this is used for all GCC 4.6+ builds, and not just on
251 * RANDSTRUCT_PLUGIN builds.
252 */
253#define randomized_struct_fields_start struct {
254#define randomized_struct_fields_end } __randomize_layout;
255
256#endif /* GCC_VERSION >= 40600 */
246 257
247 258
248#if GCC_VERSION >= 40900 && !defined(__CHECKER__) 259#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 219f82f3ec1a..eca8ad75e28b 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -452,6 +452,11 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
452# define __no_randomize_layout 452# define __no_randomize_layout
453#endif 453#endif
454 454
455#ifndef randomized_struct_fields_start
456# define randomized_struct_fields_start
457# define randomized_struct_fields_end
458#endif
459
455/* 460/*
456 * Tell gcc if a function is cold. The compiler will assume any path 461 * Tell gcc if a function is cold. The compiler will assume any path
457 * directly leading to the call is unlikely. 462 * directly leading to the call is unlikely.
diff --git a/include/linux/cred.h b/include/linux/cred.h
index c728d515e5e2..099058e1178b 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -31,7 +31,7 @@ struct group_info {
31 atomic_t usage; 31 atomic_t usage;
32 int ngroups; 32 int ngroups;
33 kgid_t gid[0]; 33 kgid_t gid[0];
34}; 34} __randomize_layout;
35 35
36/** 36/**
37 * get_group_info - Get a reference to a group info structure 37 * get_group_info - Get a reference to a group info structure
@@ -145,7 +145,7 @@ struct cred {
145 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */ 145 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
146 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 146 struct group_info *group_info; /* supplementary groups for euid/fsgid */
147 struct rcu_head rcu; /* RCU deletion hook */ 147 struct rcu_head rcu; /* RCU deletion hook */
148}; 148} __randomize_layout;
149 149
150extern void __put_cred(struct cred *); 150extern void __put_cred(struct cred *);
151extern void exit_creds(struct task_struct *); 151extern void exit_creds(struct task_struct *);
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 794811875732..df97b7af7e2c 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -87,6 +87,7 @@ size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
87void dax_flush(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, 87void dax_flush(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
88 size_t size); 88 size_t size);
89void dax_write_cache(struct dax_device *dax_dev, bool wc); 89void dax_write_cache(struct dax_device *dax_dev, bool wc);
90bool dax_write_cache_enabled(struct dax_device *dax_dev);
90 91
91/* 92/*
92 * We use lowest available bit in exceptional entry for locking, one bit for 93 * We use lowest available bit in exceptional entry for locking, one bit for
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 3f3ff4ccdc3f..aae1cdb76851 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -118,7 +118,7 @@ struct dentry {
118 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ 118 struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */
119 struct rcu_head d_rcu; 119 struct rcu_head d_rcu;
120 } d_u; 120 } d_u;
121}; 121} __randomize_layout;
122 122
123/* 123/*
124 * dentry->d_lock spinlock nesting subclasses: 124 * dentry->d_lock spinlock nesting subclasses:
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index a5195a7d6f77..0a186c4f3981 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -55,6 +55,7 @@ struct dma_fence_cb;
55 * of the time. 55 * of the time.
56 * 56 *
57 * DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled 57 * DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled
58 * DMA_FENCE_FLAG_TIMESTAMP_BIT - timestamp recorded for fence signaling
58 * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called 59 * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called
59 * DMA_FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the 60 * DMA_FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
60 * implementer of the fence for its own purposes. Can be used in different 61 * implementer of the fence for its own purposes. Can be used in different
@@ -84,6 +85,7 @@ struct dma_fence {
84 85
85enum dma_fence_flag_bits { 86enum dma_fence_flag_bits {
86 DMA_FENCE_FLAG_SIGNALED_BIT, 87 DMA_FENCE_FLAG_SIGNALED_BIT,
88 DMA_FENCE_FLAG_TIMESTAMP_BIT,
87 DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, 89 DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
88 DMA_FENCE_FLAG_USER_BITS, /* must always be last member */ 90 DMA_FENCE_FLAG_USER_BITS, /* must always be last member */
89}; 91};
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 843ab866e0f4..03c0196a6f24 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -157,16 +157,40 @@ static inline int is_device_dma_capable(struct device *dev)
157 * These three functions are only for dma allocator. 157 * These three functions are only for dma allocator.
158 * Don't use them in device drivers. 158 * Don't use them in device drivers.
159 */ 159 */
160int dma_alloc_from_coherent(struct device *dev, ssize_t size, 160int dma_alloc_from_dev_coherent(struct device *dev, ssize_t size,
161 dma_addr_t *dma_handle, void **ret); 161 dma_addr_t *dma_handle, void **ret);
162int dma_release_from_coherent(struct device *dev, int order, void *vaddr); 162int dma_release_from_dev_coherent(struct device *dev, int order, void *vaddr);
163 163
164int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, 164int dma_mmap_from_dev_coherent(struct device *dev, struct vm_area_struct *vma,
165 void *cpu_addr, size_t size, int *ret); 165 void *cpu_addr, size_t size, int *ret);
166
167void *dma_alloc_from_global_coherent(ssize_t size, dma_addr_t *dma_handle);
168int dma_release_from_global_coherent(int order, void *vaddr);
169int dma_mmap_from_global_coherent(struct vm_area_struct *vma, void *cpu_addr,
170 size_t size, int *ret);
171
166#else 172#else
167#define dma_alloc_from_coherent(dev, size, handle, ret) (0) 173#define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
168#define dma_release_from_coherent(dev, order, vaddr) (0) 174#define dma_release_from_dev_coherent(dev, order, vaddr) (0)
169#define dma_mmap_from_coherent(dev, vma, vaddr, order, ret) (0) 175#define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
176
177static inline void *dma_alloc_from_global_coherent(ssize_t size,
178 dma_addr_t *dma_handle)
179{
180 return NULL;
181}
182
183static inline int dma_release_from_global_coherent(int order, void *vaddr)
184{
185 return 0;
186}
187
188static inline int dma_mmap_from_global_coherent(struct vm_area_struct *vma,
189 void *cpu_addr, size_t size,
190 int *ret)
191{
192 return 0;
193}
170#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */ 194#endif /* CONFIG_HAVE_GENERIC_DMA_COHERENT */
171 195
172#ifdef CONFIG_HAS_DMA 196#ifdef CONFIG_HAS_DMA
@@ -481,7 +505,7 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size,
481 505
482 BUG_ON(!ops); 506 BUG_ON(!ops);
483 507
484 if (dma_alloc_from_coherent(dev, size, dma_handle, &cpu_addr)) 508 if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr))
485 return cpu_addr; 509 return cpu_addr;
486 510
487 if (!arch_dma_alloc_attrs(&dev, &flag)) 511 if (!arch_dma_alloc_attrs(&dev, &flag))
@@ -503,7 +527,7 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
503 BUG_ON(!ops); 527 BUG_ON(!ops);
504 WARN_ON(irqs_disabled()); 528 WARN_ON(irqs_disabled());
505 529
506 if (dma_release_from_coherent(dev, get_order(size), cpu_addr)) 530 if (dma_release_from_dev_coherent(dev, get_order(size), cpu_addr))
507 return; 531 return;
508 532
509 if (!ops->free || !cpu_addr) 533 if (!ops->free || !cpu_addr)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7b5d6816542b..6e1fd5d21248 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -296,7 +296,7 @@ struct kiocb {
296 void *private; 296 void *private;
297 int ki_flags; 297 int ki_flags;
298 enum rw_hint ki_hint; 298 enum rw_hint ki_hint;
299}; 299} __randomize_layout;
300 300
301static inline bool is_sync_kiocb(struct kiocb *kiocb) 301static inline bool is_sync_kiocb(struct kiocb *kiocb)
302{ 302{
@@ -404,7 +404,7 @@ struct address_space {
404 struct list_head private_list; /* ditto */ 404 struct list_head private_list; /* ditto */
405 void *private_data; /* ditto */ 405 void *private_data; /* ditto */
406 errseq_t wb_err; 406 errseq_t wb_err;
407} __attribute__((aligned(sizeof(long)))); 407} __attribute__((aligned(sizeof(long)))) __randomize_layout;
408 /* 408 /*
409 * On most architectures that alignment is already the case; but 409 * On most architectures that alignment is already the case; but
410 * must be enforced here for CRIS, to let the least significant bit 410 * must be enforced here for CRIS, to let the least significant bit
@@ -447,7 +447,7 @@ struct block_device {
447 int bd_fsfreeze_count; 447 int bd_fsfreeze_count;
448 /* Mutex for freeze */ 448 /* Mutex for freeze */
449 struct mutex bd_fsfreeze_mutex; 449 struct mutex bd_fsfreeze_mutex;
450}; 450} __randomize_layout;
451 451
452/* 452/*
453 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 453 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
@@ -666,7 +666,7 @@ struct inode {
666#endif 666#endif
667 667
668 void *i_private; /* fs or device private pointer */ 668 void *i_private; /* fs or device private pointer */
669}; 669} __randomize_layout;
670 670
671static inline unsigned int i_blocksize(const struct inode *node) 671static inline unsigned int i_blocksize(const struct inode *node)
672{ 672{
@@ -883,7 +883,8 @@ struct file {
883#endif /* #ifdef CONFIG_EPOLL */ 883#endif /* #ifdef CONFIG_EPOLL */
884 struct address_space *f_mapping; 884 struct address_space *f_mapping;
885 errseq_t f_wb_err; 885 errseq_t f_wb_err;
886} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 886} __randomize_layout
887 __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
887 888
888struct file_handle { 889struct file_handle {
889 __u32 handle_bytes; 890 __u32 handle_bytes;
@@ -1020,7 +1021,7 @@ struct file_lock {
1020 int state; /* state of grant or error if -ve */ 1021 int state; /* state of grant or error if -ve */
1021 } afs; 1022 } afs;
1022 } fl_u; 1023 } fl_u;
1023}; 1024} __randomize_layout;
1024 1025
1025struct file_lock_context { 1026struct file_lock_context {
1026 spinlock_t flc_lock; 1027 spinlock_t flc_lock;
@@ -1412,7 +1413,7 @@ struct super_block {
1412 1413
1413 spinlock_t s_inode_wblist_lock; 1414 spinlock_t s_inode_wblist_lock;
1414 struct list_head s_inodes_wb; /* writeback inodes */ 1415 struct list_head s_inodes_wb; /* writeback inodes */
1415}; 1416} __randomize_layout;
1416 1417
1417/* Helper functions so that in most cases filesystems will 1418/* Helper functions so that in most cases filesystems will
1418 * not need to deal directly with kuid_t and kgid_t and can 1419 * not need to deal directly with kuid_t and kgid_t and can
@@ -1698,7 +1699,7 @@ struct file_operations {
1698 u64); 1699 u64);
1699 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *, 1700 ssize_t (*dedupe_file_range)(struct file *, u64, u64, struct file *,
1700 u64); 1701 u64);
1701}; 1702} __randomize_layout;
1702 1703
1703struct inode_operations { 1704struct inode_operations {
1704 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); 1705 struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 0efc3e62843a..7a026240cbb1 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -12,7 +12,7 @@ struct fs_struct {
12 int umask; 12 int umask;
13 int in_exec; 13 int in_exec;
14 struct path root, pwd; 14 struct path root, pwd;
15}; 15} __randomize_layout;
16 16
17extern struct kmem_cache *fs_cachep; 17extern struct kmem_cache *fs_cachep;
18 18
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 5857390ac35a..6383115e9d2c 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -145,8 +145,8 @@ enum {
145#ifdef CONFIG_DYNAMIC_FTRACE 145#ifdef CONFIG_DYNAMIC_FTRACE
146/* The hash used to know what functions callbacks trace */ 146/* The hash used to know what functions callbacks trace */
147struct ftrace_ops_hash { 147struct ftrace_ops_hash {
148 struct ftrace_hash *notrace_hash; 148 struct ftrace_hash __rcu *notrace_hash;
149 struct ftrace_hash *filter_hash; 149 struct ftrace_hash __rcu *filter_hash;
150 struct mutex regex_lock; 150 struct mutex regex_lock;
151}; 151};
152 152
@@ -168,7 +168,7 @@ static inline void ftrace_free_init_mem(void) { }
168 */ 168 */
169struct ftrace_ops { 169struct ftrace_ops {
170 ftrace_func_t func; 170 ftrace_func_t func;
171 struct ftrace_ops *next; 171 struct ftrace_ops __rcu *next;
172 unsigned long flags; 172 unsigned long flags;
173 void *private; 173 void *private;
174 ftrace_func_t saved_func; 174 ftrace_func_t saved_func;
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 5591f055e13f..fadd579d577d 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -23,6 +23,6 @@ struct kern_ipc_perm {
23 23
24 struct rcu_head rcu; 24 struct rcu_head rcu;
25 atomic_t refcount; 25 atomic_t refcount;
26} ____cacheline_aligned_in_smp; 26} ____cacheline_aligned_in_smp __randomize_layout;
27 27
28#endif /* _LINUX_IPC_H */ 28#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 848e5796400e..65327ee0936b 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -61,7 +61,7 @@ struct ipc_namespace {
61 struct ucounts *ucounts; 61 struct ucounts *ucounts;
62 62
63 struct ns_common ns; 63 struct ns_common ns;
64}; 64} __randomize_layout;
65 65
66extern struct ipc_namespace init_ipc_ns; 66extern struct ipc_namespace init_ipc_ns;
67extern spinlock_t mq_lock; 67extern spinlock_t mq_lock;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 00db35b61e9e..d2d543794093 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -388,7 +388,12 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
388 * @irq_mask_ack: ack and mask an interrupt source 388 * @irq_mask_ack: ack and mask an interrupt source
389 * @irq_unmask: unmask an interrupt source 389 * @irq_unmask: unmask an interrupt source
390 * @irq_eoi: end of interrupt 390 * @irq_eoi: end of interrupt
391 * @irq_set_affinity: set the CPU affinity on SMP machines 391 * @irq_set_affinity: Set the CPU affinity on SMP machines. If the force
392 * argument is true, it tells the driver to
393 * unconditionally apply the affinity setting. Sanity
394 * checks against the supplied affinity mask are not
395 * required. This is used for CPU hotplug where the
396 * target CPU is not yet set in the cpu_online_mask.
392 * @irq_retrigger: resend an IRQ to the CPU 397 * @irq_retrigger: resend an IRQ to the CPU
393 * @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ 398 * @irq_set_type: set the flow type (IRQ_TYPE_LEVEL/etc.) of an IRQ
394 * @irq_set_wake: enable/disable power-management wake-on of an IRQ 399 * @irq_set_wake: enable/disable power-management wake-on of an IRQ
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 348c6f47e4cc..8037850f3104 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
85 k += 12; 85 k += 12;
86 } 86 }
87 /* Last block: affect all 32 bits of (c) */ 87 /* Last block: affect all 32 bits of (c) */
88 /* All the case statements fall through */
89 switch (length) { 88 switch (length) {
90 case 12: c += (u32)k[11]<<24; 89 case 12: c += (u32)k[11]<<24; /* fall through */
91 case 11: c += (u32)k[10]<<16; 90 case 11: c += (u32)k[10]<<16; /* fall through */
92 case 10: c += (u32)k[9]<<8; 91 case 10: c += (u32)k[9]<<8; /* fall through */
93 case 9: c += k[8]; 92 case 9: c += k[8]; /* fall through */
94 case 8: b += (u32)k[7]<<24; 93 case 8: b += (u32)k[7]<<24; /* fall through */
95 case 7: b += (u32)k[6]<<16; 94 case 7: b += (u32)k[6]<<16; /* fall through */
96 case 6: b += (u32)k[5]<<8; 95 case 6: b += (u32)k[5]<<8; /* fall through */
97 case 5: b += k[4]; 96 case 5: b += k[4]; /* fall through */
98 case 4: a += (u32)k[3]<<24; 97 case 4: a += (u32)k[3]<<24; /* fall through */
99 case 3: a += (u32)k[2]<<16; 98 case 3: a += (u32)k[2]<<16; /* fall through */
100 case 2: a += (u32)k[1]<<8; 99 case 2: a += (u32)k[1]<<8; /* fall through */
101 case 1: a += k[0]; 100 case 1: a += k[0];
102 __jhash_final(a, b, c); 101 __jhash_final(a, b, c);
103 case 0: /* Nothing left to add */ 102 case 0: /* Nothing left to add */
@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
131 k += 3; 130 k += 3;
132 } 131 }
133 132
134 /* Handle the last 3 u32's: all the case statements fall through */ 133 /* Handle the last 3 u32's */
135 switch (length) { 134 switch (length) {
136 case 3: c += k[2]; 135 case 3: c += k[2]; /* fall through */
137 case 2: b += k[1]; 136 case 2: b += k[1]; /* fall through */
138 case 1: a += k[0]; 137 case 1: a += k[0];
139 __jhash_final(a, b, c); 138 __jhash_final(a, b, c);
140 case 0: /* Nothing left to add */ 139 case 0: /* Nothing left to add */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 8496cf64575c..9520fc3c3b9a 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -45,7 +45,7 @@ struct key_preparsed_payload {
45 size_t datalen; /* Raw datalen */ 45 size_t datalen; /* Raw datalen */
46 size_t quotalen; /* Quota length for proposed payload */ 46 size_t quotalen; /* Quota length for proposed payload */
47 time_t expiry; /* Expiry time of key */ 47 time_t expiry; /* Expiry time of key */
48}; 48} __randomize_layout;
49 49
50typedef int (*request_key_actor_t)(struct key_construction *key, 50typedef int (*request_key_actor_t)(struct key_construction *key,
51 const char *op, void *aux); 51 const char *op, void *aux);
@@ -158,7 +158,7 @@ struct key_type {
158 /* internal fields */ 158 /* internal fields */
159 struct list_head link; /* link in types list */ 159 struct list_head link; /* link in types list */
160 struct lock_class_key lock_class; /* key->sem lock class */ 160 struct lock_class_key lock_class; /* key->sem lock class */
161}; 161} __randomize_layout;
162 162
163extern struct key_type key_type_keyring; 163extern struct key_type key_type_keyring;
164 164
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index c4e441e00db5..655082c88fd9 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -64,7 +64,7 @@ struct subprocess_info {
64 int (*init)(struct subprocess_info *info, struct cred *new); 64 int (*init)(struct subprocess_info *info, struct cred *new);
65 void (*cleanup)(struct subprocess_info *info); 65 void (*cleanup)(struct subprocess_info *info);
66 void *data; 66 void *data;
67}; 67} __randomize_layout;
68 68
69extern int 69extern int
70call_usermodehelper(const char *path, char **argv, char **envp, int wait); 70call_usermodehelper(const char *path, char **argv, char **envp, int wait);
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index eeab34b0f589..4d800c79475a 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -172,7 +172,7 @@ struct kset {
172 spinlock_t list_lock; 172 spinlock_t list_lock;
173 struct kobject kobj; 173 struct kobject kobj;
174 const struct kset_uevent_ops *uevent_ops; 174 const struct kset_uevent_ops *uevent_ops;
175}; 175} __randomize_layout;
176 176
177extern void kset_init(struct kset *kset); 177extern void kset_init(struct kset *kset);
178extern int __must_check kset_register(struct kset *kset); 178extern int __must_check kset_register(struct kset *kset);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 648b34cabb38..890b706d1943 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -445,6 +445,7 @@ struct kvm {
445 struct kvm_stat_data **debugfs_stat_data; 445 struct kvm_stat_data **debugfs_stat_data;
446 struct srcu_struct srcu; 446 struct srcu_struct srcu;
447 struct srcu_struct irq_srcu; 447 struct srcu_struct irq_srcu;
448 pid_t userspace_pid;
448}; 449};
449 450
450#define kvm_err(fmt, ...) \ 451#define kvm_err(fmt, ...) \
diff --git a/include/linux/llist.h b/include/linux/llist.h
index d11738110a7a..1957635e6d5f 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -93,6 +93,23 @@ static inline void init_llist_head(struct llist_head *list)
93 container_of(ptr, type, member) 93 container_of(ptr, type, member)
94 94
95/** 95/**
96 * member_address_is_nonnull - check whether the member address is not NULL
97 * @ptr: the object pointer (struct type * that contains the llist_node)
98 * @member: the name of the llist_node within the struct.
99 *
100 * This macro is conceptually the same as
101 * &ptr->member != NULL
102 * but it works around the fact that compilers can decide that taking a member
103 * address is never a NULL pointer.
104 *
105 * Real objects that start at a high address and have a member at NULL are
106 * unlikely to exist, but such pointers may be returned e.g. by the
107 * container_of() macro.
108 */
109#define member_address_is_nonnull(ptr, member) \
110 ((uintptr_t)(ptr) + offsetof(typeof(*(ptr)), member) != 0)
111
112/**
96 * llist_for_each - iterate over some deleted entries of a lock-less list 113 * llist_for_each - iterate over some deleted entries of a lock-less list
97 * @pos: the &struct llist_node to use as a loop cursor 114 * @pos: the &struct llist_node to use as a loop cursor
98 * @node: the first entry of deleted list entries 115 * @node: the first entry of deleted list entries
@@ -145,7 +162,7 @@ static inline void init_llist_head(struct llist_head *list)
145 */ 162 */
146#define llist_for_each_entry(pos, node, member) \ 163#define llist_for_each_entry(pos, node, member) \
147 for ((pos) = llist_entry((node), typeof(*(pos)), member); \ 164 for ((pos) = llist_entry((node), typeof(*(pos)), member); \
148 &(pos)->member != NULL; \ 165 member_address_is_nonnull(pos, member); \
149 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member)) 166 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
150 167
151/** 168/**
@@ -167,7 +184,7 @@ static inline void init_llist_head(struct llist_head *list)
167 */ 184 */
168#define llist_for_each_entry_safe(pos, n, node, member) \ 185#define llist_for_each_entry_safe(pos, n, node, member) \
169 for (pos = llist_entry((node), typeof(*pos), member); \ 186 for (pos = llist_entry((node), typeof(*pos), member); \
170 &pos->member != NULL && \ 187 member_address_is_nonnull(pos, member) && \
171 (n = llist_entry(pos->member.next, typeof(*n), member), true); \ 188 (n = llist_entry(pos->member.next, typeof(*n), member), true); \
172 pos = n) 189 pos = n)
173 190
diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h
index 7a86925ba8f3..3a90febadbe2 100644
--- a/include/linux/lsm_hooks.h
+++ b/include/linux/lsm_hooks.h
@@ -1912,7 +1912,7 @@ struct security_hook_heads {
1912 struct list_head audit_rule_match; 1912 struct list_head audit_rule_match;
1913 struct list_head audit_rule_free; 1913 struct list_head audit_rule_free;
1914#endif /* CONFIG_AUDIT */ 1914#endif /* CONFIG_AUDIT */
1915}; 1915} __randomize_layout;
1916 1916
1917/* 1917/*
1918 * Security module hook list structure. 1918 * Security module hook list structure.
@@ -1923,7 +1923,7 @@ struct security_hook_list {
1923 struct list_head *head; 1923 struct list_head *head;
1924 union security_list_options hook; 1924 union security_list_options hook;
1925 char *lsm; 1925 char *lsm;
1926}; 1926} __randomize_layout;
1927 1927
1928/* 1928/*
1929 * Initializing a security_hook_list structure takes 1929 * Initializing a security_hook_list structure takes
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index d5bed0875d30..aad5d81dfb44 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -1068,7 +1068,7 @@ static inline int mlx4_is_eth(struct mlx4_dev *dev, int port)
1068} 1068}
1069 1069
1070int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 1070int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
1071 struct mlx4_buf *buf, gfp_t gfp); 1071 struct mlx4_buf *buf);
1072void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 1072void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
1073static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) 1073static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
1074{ 1074{
@@ -1105,10 +1105,9 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
1105int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 1105int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
1106 int start_index, int npages, u64 *page_list); 1106 int start_index, int npages, u64 *page_list);
1107int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 1107int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
1108 struct mlx4_buf *buf, gfp_t gfp); 1108 struct mlx4_buf *buf);
1109 1109
1110int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order, 1110int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order);
1111 gfp_t gfp);
1112void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); 1111void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db);
1113 1112
1114int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, 1113int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
@@ -1124,8 +1123,7 @@ int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align,
1124 int *base, u8 flags); 1123 int *base, u8 flags);
1125void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 1124void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
1126 1125
1127int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp, 1126int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp);
1128 gfp_t gfp);
1129void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 1127void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
1130 1128
1131int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, 1129int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn,
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 45cdb27791a3..ff151814a02d 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -342,7 +342,7 @@ struct vm_area_struct {
342 struct mempolicy *vm_policy; /* NUMA policy for the VMA */ 342 struct mempolicy *vm_policy; /* NUMA policy for the VMA */
343#endif 343#endif
344 struct vm_userfaultfd_ctx vm_userfaultfd_ctx; 344 struct vm_userfaultfd_ctx vm_userfaultfd_ctx;
345}; 345} __randomize_layout;
346 346
347struct core_thread { 347struct core_thread {
348 struct task_struct *task; 348 struct task_struct *task;
@@ -500,7 +500,7 @@ struct mm_struct {
500 atomic_long_t hugetlb_usage; 500 atomic_long_t hugetlb_usage;
501#endif 501#endif
502 struct work_struct async_put_work; 502 struct work_struct async_put_work;
503}; 503} __randomize_layout;
504 504
505extern struct mm_struct init_mm; 505extern struct mm_struct init_mm;
506 506
diff --git a/include/linux/module.h b/include/linux/module.h
index 8eb9a1e693e5..e7bdd549e527 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -45,7 +45,7 @@ struct module_kobject {
45 struct kobject *drivers_dir; 45 struct kobject *drivers_dir;
46 struct module_param_attrs *mp; 46 struct module_param_attrs *mp;
47 struct completion *kobj_completion; 47 struct completion *kobj_completion;
48}; 48} __randomize_layout;
49 49
50struct module_attribute { 50struct module_attribute {
51 struct attribute attr; 51 struct attribute attr;
@@ -475,7 +475,7 @@ struct module {
475 ctor_fn_t *ctors; 475 ctor_fn_t *ctors;
476 unsigned int num_ctors; 476 unsigned int num_ctors;
477#endif 477#endif
478} ____cacheline_aligned; 478} ____cacheline_aligned __randomize_layout;
479#ifndef MODULE_ARCH_INIT 479#ifndef MODULE_ARCH_INIT
480#define MODULE_ARCH_INIT {} 480#define MODULE_ARCH_INIT {}
481#endif 481#endif
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 8e0352af06b7..1ce85e6fd95f 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -67,7 +67,7 @@ struct vfsmount {
67 struct dentry *mnt_root; /* root of the mounted tree */ 67 struct dentry *mnt_root; /* root of the mounted tree */
68 struct super_block *mnt_sb; /* pointer to superblock */ 68 struct super_block *mnt_sb; /* pointer to superblock */
69 int mnt_flags; 69 int mnt_flags;
70}; 70} __randomize_layout;
71 71
72struct file; /* forward dec */ 72struct file; /* forward dec */
73struct path; 73struct path;
diff --git a/include/linux/msg.h b/include/linux/msg.h
index f3f302f9c197..a001305f5a79 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -29,7 +29,7 @@ struct msg_queue {
29 struct list_head q_messages; 29 struct list_head q_messages;
30 struct list_head q_receivers; 30 struct list_head q_receivers;
31 struct list_head q_senders; 31 struct list_head q_senders;
32}; 32} __randomize_layout;
33 33
34/* Helper routines for sys_msgsnd and sys_msgrcv */ 34/* Helper routines for sys_msgsnd and sys_msgrcv */
35extern long do_msgsnd(int msqid, long mtype, void __user *mtext, 35extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index a4b97be30b28..22f081065d49 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -61,8 +61,6 @@ typedef unsigned int nf_hookfn(void *priv,
61 struct sk_buff *skb, 61 struct sk_buff *skb,
62 const struct nf_hook_state *state); 62 const struct nf_hook_state *state);
63struct nf_hook_ops { 63struct nf_hook_ops {
64 struct list_head list;
65
66 /* User fills in from here down. */ 64 /* User fills in from here down. */
67 nf_hookfn *hook; 65 nf_hookfn *hook;
68 struct net_device *dev; 66 struct net_device *dev;
@@ -160,13 +158,6 @@ int nf_register_net_hooks(struct net *net, const struct nf_hook_ops *reg,
160void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg, 158void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg,
161 unsigned int n); 159 unsigned int n);
162 160
163int nf_register_hook(struct nf_hook_ops *reg);
164void nf_unregister_hook(struct nf_hook_ops *reg);
165int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
166void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
167int _nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
168void _nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
169
170/* Functions to register get/setsockopt ranges (non-inclusive). You 161/* Functions to register get/setsockopt ranges (non-inclusive). You
171 need to check permissions yourself! */ 162 need to check permissions yourself! */
172int nf_register_sockopt(struct nf_sockopt_ops *reg); 163int nf_register_sockopt(struct nf_sockopt_ops *reg);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e52cc55ac300..5cc91d6381a3 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -51,7 +51,7 @@ struct nfs_access_entry {
51 struct list_head lru; 51 struct list_head lru;
52 unsigned long jiffies; 52 unsigned long jiffies;
53 struct rpc_cred * cred; 53 struct rpc_cred * cred;
54 int mask; 54 __u32 mask;
55 struct rcu_head rcu_head; 55 struct rcu_head rcu_head;
56}; 56};
57 57
diff --git a/include/linux/nvme-fc.h b/include/linux/nvme-fc.h
index 21c37e39e41a..36cca93a5ff2 100644
--- a/include/linux/nvme-fc.h
+++ b/include/linux/nvme-fc.h
@@ -334,5 +334,24 @@ struct fcnvme_ls_disconnect_acc {
334#define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */ 334#define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */
335#define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */ 335#define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */
336 336
337/*
338 * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>"
339 * the string is allowed to be specified with or without a "0x" prefix
340 * infront of the <16hexdigits>. Without is considered the "min" string
341 * and with is considered the "max" string. The hexdigits may be upper
342 * or lower case.
343 */
344#define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */
345#define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */
346#define NVME_FC_TRADDR_HEXNAMELEN 16
347#define NVME_FC_TRADDR_MINLENGTH \
348 (2 * (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1)
349#define NVME_FC_TRADDR_MAXLENGTH \
350 (2 * (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1)
351#define NVME_FC_TRADDR_MIN_PN_OFFSET \
352 (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1)
353#define NVME_FC_TRADDR_MAX_PN_OFFSET \
354 (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1)
355
337 356
338#endif /* _NVME_FC_H */ 357#endif /* _NVME_FC_H */
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 6b8ee9e628e1..25d8225dbd04 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -963,14 +963,14 @@ struct nvme_dbbuf {
963}; 963};
964 964
965struct streams_directive_params { 965struct streams_directive_params {
966 __u16 msl; 966 __le16 msl;
967 __u16 nssa; 967 __le16 nssa;
968 __u16 nsso; 968 __le16 nsso;
969 __u8 rsvd[10]; 969 __u8 rsvd[10];
970 __u32 sws; 970 __le32 sws;
971 __u16 sgs; 971 __le16 sgs;
972 __u16 nsa; 972 __le16 nsa;
973 __u16 nso; 973 __le16 nso;
974 __u8 rsvd2[6]; 974 __u8 rsvd2[6];
975}; 975};
976 976
@@ -1006,7 +1006,7 @@ static inline bool nvme_is_write(struct nvme_command *cmd)
1006 * Why can't we simply have a Fabrics In and Fabrics out command? 1006 * Why can't we simply have a Fabrics In and Fabrics out command?
1007 */ 1007 */
1008 if (unlikely(cmd->common.opcode == nvme_fabrics_command)) 1008 if (unlikely(cmd->common.opcode == nvme_fabrics_command))
1009 return cmd->fabrics.opcode & 1; 1009 return cmd->fabrics.fctype & 1;
1010 return cmd->common.opcode & 1; 1010 return cmd->common.opcode & 1;
1011} 1011}
1012 1012
diff --git a/include/linux/path.h b/include/linux/path.h
index d1372186f431..cde895cc4af4 100644
--- a/include/linux/path.h
+++ b/include/linux/path.h
@@ -7,7 +7,7 @@ struct vfsmount;
7struct path { 7struct path {
8 struct vfsmount *mnt; 8 struct vfsmount *mnt;
9 struct dentry *dentry; 9 struct dentry *dentry;
10}; 10} __randomize_layout;
11 11
12extern void path_get(const struct path *); 12extern void path_get(const struct path *);
13extern void path_put(const struct path *); 13extern void path_put(const struct path *);
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h
index 1360dd6d5e61..af0f44effd44 100644
--- a/include/linux/perf/arm_pmu.h
+++ b/include/linux/perf/arm_pmu.h
@@ -24,10 +24,14 @@
24 * interrupt and passed the address of the low level handler, 24 * interrupt and passed the address of the low level handler,
25 * and can be used to implement any platform specific handling 25 * and can be used to implement any platform specific handling
26 * before or after calling it. 26 * before or after calling it.
27 *
28 * @irq_flags: if non-zero, these flags will be passed to request_irq
29 * when requesting interrupts for this PMU device.
27 */ 30 */
28struct arm_pmu_platdata { 31struct arm_pmu_platdata {
29 irqreturn_t (*handle_irq)(int irq, void *dev, 32 irqreturn_t (*handle_irq)(int irq, void *dev,
30 irq_handler_t pmu_handler); 33 irq_handler_t pmu_handler);
34 unsigned long irq_flags;
31}; 35};
32 36
33#ifdef CONFIG_ARM_PMU 37#ifdef CONFIG_ARM_PMU
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index c2a989dee876..b09136f88cf4 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -52,7 +52,7 @@ struct pid_namespace {
52 int hide_pid; 52 int hide_pid;
53 int reboot; /* group exit code if this pidns was rebooted */ 53 int reboot; /* group exit code if this pidns was rebooted */
54 struct ns_common ns; 54 struct ns_common ns;
55}; 55} __randomize_layout;
56 56
57extern struct pid_namespace init_pid_ns; 57extern struct pid_namespace init_pid_ns;
58 58
diff --git a/include/linux/platform_data/hsmmc-omap.h b/include/linux/platform_data/hsmmc-omap.h
index 8e981be2e2c2..0ff1e0dba720 100644
--- a/include/linux/platform_data/hsmmc-omap.h
+++ b/include/linux/platform_data/hsmmc-omap.h
@@ -55,9 +55,6 @@ struct omap_hsmmc_platform_data {
55 u32 caps; /* Used for the MMC driver on 2430 and later */ 55 u32 caps; /* Used for the MMC driver on 2430 and later */
56 u32 pm_caps; /* PM capabilities of the mmc */ 56 u32 pm_caps; /* PM capabilities of the mmc */
57 57
58 /* use the internal clock */
59 unsigned internal_clock:1;
60
61 /* nonremovable e.g. eMMC */ 58 /* nonremovable e.g. eMMC */
62 unsigned nonremovable:1; 59 unsigned nonremovable:1;
63 60
@@ -73,13 +70,6 @@ struct omap_hsmmc_platform_data {
73 int gpio_cd; /* gpio (card detect) */ 70 int gpio_cd; /* gpio (card detect) */
74 int gpio_cod; /* gpio (cover detect) */ 71 int gpio_cod; /* gpio (cover detect) */
75 int gpio_wp; /* gpio (write protect) */ 72 int gpio_wp; /* gpio (write protect) */
76
77 int (*set_power)(struct device *dev, int power_on, int vdd);
78 void (*remux)(struct device *dev, int power_on);
79 /* Call back before enabling / disabling regulators */
80 void (*before_set_reg)(struct device *dev, int power_on, int vdd);
81 /* Call back after enabling / disabling regulators */
82 void (*after_set_reg)(struct device *dev, int power_on, int vdd);
83 /* if we have special card, init it using this callback */ 73 /* if we have special card, init it using this callback */
84 void (*init_card)(struct mmc_card *card); 74 void (*init_card)(struct mmc_card *card);
85 75
diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h
index 58ab28d81fc2..06844b54dfc1 100644
--- a/include/linux/proc_ns.h
+++ b/include/linux/proc_ns.h
@@ -21,7 +21,7 @@ struct proc_ns_operations {
21 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns); 21 int (*install)(struct nsproxy *nsproxy, struct ns_common *ns);
22 struct user_namespace *(*owner)(struct ns_common *ns); 22 struct user_namespace *(*owner)(struct ns_common *ns);
23 struct ns_common *(*get_parent)(struct ns_common *ns); 23 struct ns_common *(*get_parent)(struct ns_common *ns);
24}; 24} __randomize_layout;
25 25
26extern const struct proc_ns_operations netns_operations; 26extern const struct proc_ns_operations netns_operations;
27extern const struct proc_ns_operations utsns_operations; 27extern const struct proc_ns_operations utsns_operations;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2ba9ec93423f..8337e2db0bb2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -426,7 +426,7 @@ struct sched_rt_entity {
426 /* rq "owned" by this entity/group: */ 426 /* rq "owned" by this entity/group: */
427 struct rt_rq *my_q; 427 struct rt_rq *my_q;
428#endif 428#endif
429}; 429} __randomize_layout;
430 430
431struct sched_dl_entity { 431struct sched_dl_entity {
432 struct rb_node rb_node; 432 struct rb_node rb_node;
@@ -526,6 +526,13 @@ struct task_struct {
526#endif 526#endif
527 /* -1 unrunnable, 0 runnable, >0 stopped: */ 527 /* -1 unrunnable, 0 runnable, >0 stopped: */
528 volatile long state; 528 volatile long state;
529
530 /*
531 * This begins the randomizable portion of task_struct. Only
532 * scheduling-critical items should be added above here.
533 */
534 randomized_struct_fields_start
535
529 void *stack; 536 void *stack;
530 atomic_t usage; 537 atomic_t usage;
531 /* Per task flags (PF_*), defined further below: */ 538 /* Per task flags (PF_*), defined further below: */
@@ -1079,6 +1086,13 @@ struct task_struct {
1079 /* Used by LSM modules for access restriction: */ 1086 /* Used by LSM modules for access restriction: */
1080 void *security; 1087 void *security;
1081#endif 1088#endif
1089
1090 /*
1091 * New fields for task_struct should be added above here, so that
1092 * they are included in the randomized portion of task_struct.
1093 */
1094 randomized_struct_fields_end
1095
1082 /* CPU-specific state of this task: */ 1096 /* CPU-specific state of this task: */
1083 struct thread_struct thread; 1097 struct thread_struct thread;
1084 1098
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index c06d63b3a583..2a0dd40b15db 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -222,7 +222,7 @@ struct signal_struct {
222 struct mutex cred_guard_mutex; /* guard against foreign influences on 222 struct mutex cred_guard_mutex; /* guard against foreign influences on
223 * credential calculations 223 * credential calculations
224 * (notably. ptrace) */ 224 * (notably. ptrace) */
225}; 225} __randomize_layout;
226 226
227/* 227/*
228 * Bits in flags field of signal_struct. 228 * Bits in flags field of signal_struct.
diff --git a/include/linux/sem.h b/include/linux/sem.h
index be5cf2ea14ad..de2deb8676bd 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -41,7 +41,7 @@ struct sem_array {
41 unsigned int use_global_lock;/* >0: global lock required */ 41 unsigned int use_global_lock;/* >0: global lock required */
42 42
43 struct sem sems[]; 43 struct sem sems[];
44}; 44} __randomize_layout;
45 45
46#ifdef CONFIG_SYSVIPC 46#ifdef CONFIG_SYSVIPC
47 47
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 04e881829625..0fb7061ec54c 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -22,7 +22,7 @@ struct shmid_kernel /* private to the kernel */
22 /* The task created the shm object. NULL if the task is dead. */ 22 /* The task created the shm object. NULL if the task is dead. */
23 struct task_struct *shm_creator; 23 struct task_struct *shm_creator;
24 struct list_head shm_clist; /* list by creator */ 24 struct list_head shm_clist; /* list by creator */
25}; 25} __randomize_layout;
26 26
27/* shm_mode upper byte flags */ 27/* shm_mode upper byte flags */
28#define SHM_DEST 01000 /* segment will be destroyed on last detach */ 28#define SHM_DEST 01000 /* segment will be destroyed on last detach */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 3a89b9ff4cdc..1d4dba490fb6 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -120,7 +120,7 @@ struct ctl_table
120 struct ctl_table_poll *poll; 120 struct ctl_table_poll *poll;
121 void *extra1; 121 void *extra1;
122 void *extra2; 122 void *extra2;
123}; 123} __randomize_layout;
124 124
125struct ctl_node { 125struct ctl_node {
126 struct rb_node node; 126 struct rb_node node;
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index f73cedfa2e0b..536c80ff7ad9 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -338,7 +338,7 @@ enum {
338struct trace_event_file { 338struct trace_event_file {
339 struct list_head list; 339 struct list_head list;
340 struct trace_event_call *event_call; 340 struct trace_event_call *event_call;
341 struct event_filter *filter; 341 struct event_filter __rcu *filter;
342 struct dentry *dir; 342 struct dentry *dir;
343 struct trace_array *tr; 343 struct trace_array *tr;
344 struct trace_subsystem_dir *system; 344 struct trace_subsystem_dir *system;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 69464c0d8068..79c30daf46a9 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -332,7 +332,7 @@ struct tty_struct {
332 /* If the tty has a pending do_SAK, queue it here - akpm */ 332 /* If the tty has a pending do_SAK, queue it here - akpm */
333 struct work_struct SAK_work; 333 struct work_struct SAK_work;
334 struct tty_port *port; 334 struct tty_port *port;
335}; 335} __randomize_layout;
336 336
337/* Each of a tty's open files has private_data pointing to tty_file_private */ 337/* Each of a tty's open files has private_data pointing to tty_file_private */
338struct tty_file_private { 338struct tty_file_private {
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b742b5e47cc2..00b2213f6a35 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -291,7 +291,7 @@ struct tty_operations {
291 void (*poll_put_char)(struct tty_driver *driver, int line, char ch); 291 void (*poll_put_char)(struct tty_driver *driver, int line, char ch);
292#endif 292#endif
293 const struct file_operations *proc_fops; 293 const struct file_operations *proc_fops;
294}; 294} __randomize_layout;
295 295
296struct tty_driver { 296struct tty_driver {
297 int magic; /* magic number for this structure */ 297 int magic; /* magic number for this structure */
@@ -325,7 +325,7 @@ struct tty_driver {
325 325
326 const struct tty_operations *ops; 326 const struct tty_operations *ops;
327 struct list_head tty_drivers; 327 struct list_head tty_drivers;
328}; 328} __randomize_layout;
329 329
330extern struct list_head tty_drivers; 330extern struct list_head tty_drivers;
331 331
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
index c5f2158ab00e..fd73bc0e9027 100644
--- a/include/linux/usb/audio-v2.h
+++ b/include/linux/usb/audio-v2.h
@@ -115,13 +115,13 @@ struct uac2_input_terminal_descriptor {
115 __u8 bDescriptorType; 115 __u8 bDescriptorType;
116 __u8 bDescriptorSubtype; 116 __u8 bDescriptorSubtype;
117 __u8 bTerminalID; 117 __u8 bTerminalID;
118 __u16 wTerminalType; 118 __le16 wTerminalType;
119 __u8 bAssocTerminal; 119 __u8 bAssocTerminal;
120 __u8 bCSourceID; 120 __u8 bCSourceID;
121 __u8 bNrChannels; 121 __u8 bNrChannels;
122 __u32 bmChannelConfig; 122 __le32 bmChannelConfig;
123 __u8 iChannelNames; 123 __u8 iChannelNames;
124 __u16 bmControls; 124 __le16 bmControls;
125 __u8 iTerminal; 125 __u8 iTerminal;
126} __attribute__((packed)); 126} __attribute__((packed));
127 127
@@ -132,11 +132,11 @@ struct uac2_output_terminal_descriptor {
132 __u8 bDescriptorType; 132 __u8 bDescriptorType;
133 __u8 bDescriptorSubtype; 133 __u8 bDescriptorSubtype;
134 __u8 bTerminalID; 134 __u8 bTerminalID;
135 __u16 wTerminalType; 135 __le16 wTerminalType;
136 __u8 bAssocTerminal; 136 __u8 bAssocTerminal;
137 __u8 bSourceID; 137 __u8 bSourceID;
138 __u8 bCSourceID; 138 __u8 bCSourceID;
139 __u16 bmControls; 139 __le16 bmControls;
140 __u8 iTerminal; 140 __u8 iTerminal;
141} __attribute__((packed)); 141} __attribute__((packed));
142 142
@@ -164,9 +164,9 @@ struct uac2_as_header_descriptor {
164 __u8 bTerminalLink; 164 __u8 bTerminalLink;
165 __u8 bmControls; 165 __u8 bmControls;
166 __u8 bFormatType; 166 __u8 bFormatType;
167 __u32 bmFormats; 167 __le32 bmFormats;
168 __u8 bNrChannels; 168 __u8 bNrChannels;
169 __u32 bmChannelConfig; 169 __le32 bmChannelConfig;
170 __u8 iChannelNames; 170 __u8 iChannelNames;
171} __attribute__((packed)); 171} __attribute__((packed));
172 172
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 021f7a88f52c..1a59699cf82a 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -83,6 +83,7 @@
83/* Driver flags */ 83/* Driver flags */
84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */ 84#define CDC_NCM_FLAG_NDP_TO_END 0x02 /* NDP is placed at end of frame */
85#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */ 85#define CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE 0x04 /* Avoid altsetting toggle during init */
86#define CDC_NCM_FLAG_RESET_NTB16 0x08 /* set NDP16 one more time after altsetting switch */
86 87
87#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ 88#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
88 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) 89 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 32354b4b4b2b..b3575ce29148 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -66,7 +66,7 @@ struct user_namespace {
66#endif 66#endif
67 struct ucounts *ucounts; 67 struct ucounts *ucounts;
68 int ucount_max[UCOUNT_COUNTS]; 68 int ucount_max[UCOUNT_COUNTS];
69}; 69} __randomize_layout;
70 70
71struct ucounts { 71struct ucounts {
72 struct hlist_node node; 72 struct hlist_node node;
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 60f0bb83b313..da826ed059cf 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -26,7 +26,7 @@ struct uts_namespace {
26 struct user_namespace *user_ns; 26 struct user_namespace *user_ns;
27 struct ucounts *ucounts; 27 struct ucounts *ucounts;
28 struct ns_common ns; 28 struct ns_common ns;
29}; 29} __randomize_layout;
30extern struct uts_namespace init_uts_ns; 30extern struct uts_namespace init_uts_ns;
31 31
32#ifdef CONFIG_UTS_NS 32#ifdef CONFIG_UTS_NS
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 2251e1925ea4..33b0bdbb613c 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -84,26 +84,12 @@ int guid_parse(const char *uuid, guid_t *u);
84int uuid_parse(const char *uuid, uuid_t *u); 84int uuid_parse(const char *uuid, uuid_t *u);
85 85
86/* backwards compatibility, don't use in new code */ 86/* backwards compatibility, don't use in new code */
87typedef uuid_t uuid_be;
88#define UUID_BE(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
89 UUID_INIT(a, _b, c, d0, d1, d2, d3, d4, d5, d6, d7)
90#define NULL_UUID_BE \
91 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
92 0x00, 0x00, 0x00, 0x00)
93
94#define uuid_le_gen(u) guid_gen(u) 87#define uuid_le_gen(u) guid_gen(u)
95#define uuid_be_gen(u) uuid_gen(u)
96#define uuid_le_to_bin(guid, u) guid_parse(guid, u) 88#define uuid_le_to_bin(guid, u) guid_parse(guid, u)
97#define uuid_be_to_bin(uuid, u) uuid_parse(uuid, u)
98 89
99static inline int uuid_le_cmp(const guid_t u1, const guid_t u2) 90static inline int uuid_le_cmp(const guid_t u1, const guid_t u2)
100{ 91{
101 return memcmp(&u1, &u2, sizeof(guid_t)); 92 return memcmp(&u1, &u2, sizeof(guid_t));
102} 93}
103 94
104static inline int uuid_be_cmp(const uuid_t u1, const uuid_t u2)
105{
106 return memcmp(&u1, &u2, sizeof(uuid_t));
107}
108
109#endif 95#endif
diff --git a/include/linux/wait.h b/include/linux/wait.h
index b289c96151ee..5b74e36c0ca8 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -529,13 +529,13 @@ do { \
529 529
530/** 530/**
531 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses 531 * wait_event_interruptible_hrtimeout - sleep until a condition gets true or a timeout elapses
532 * @wq_head: the waitqueue to wait on 532 * @wq: the waitqueue to wait on
533 * @condition: a C expression for the event to wait for 533 * @condition: a C expression for the event to wait for
534 * @timeout: timeout, as a ktime_t 534 * @timeout: timeout, as a ktime_t
535 * 535 *
536 * The process is put to sleep (TASK_INTERRUPTIBLE) until the 536 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
537 * @condition evaluates to true or a signal is received. 537 * @condition evaluates to true or a signal is received.
538 * The @condition is checked each time the waitqueue @wq_head is woken up. 538 * The @condition is checked each time the waitqueue @wq is woken up.
539 * 539 *
540 * wake_up() has to be called after changing any variable that could 540 * wake_up() has to be called after changing any variable that could
541 * change the result of the wait condition. 541 * change the result of the wait condition.
@@ -735,12 +735,12 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
735 735
736/** 736/**
737 * wait_event_killable - sleep until a condition gets true 737 * wait_event_killable - sleep until a condition gets true
738 * @wq: the waitqueue to wait on 738 * @wq_head: the waitqueue to wait on
739 * @condition: a C expression for the event to wait for 739 * @condition: a C expression for the event to wait for
740 * 740 *
741 * The process is put to sleep (TASK_KILLABLE) until the 741 * The process is put to sleep (TASK_KILLABLE) until the
742 * @condition evaluates to true or a signal is received. 742 * @condition evaluates to true or a signal is received.
743 * The @condition is checked each time the waitqueue @wq is woken up. 743 * The @condition is checked each time the waitqueue @wq_head is woken up.
744 * 744 *
745 * wake_up() has to be called after changing any variable that could 745 * wake_up() has to be called after changing any variable that could
746 * change the result of the wait condition. 746 * change the result of the wait condition.
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 678e4d6fa317..53b1a2cca421 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -37,7 +37,7 @@ struct unix_skb_parms {
37 u32 secid; /* Security ID */ 37 u32 secid; /* Security ID */
38#endif 38#endif
39 u32 consumed; 39 u32 consumed;
40}; 40} __randomize_layout;
41 41
42#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb)) 42#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
43 43
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index afc39e3a3f7c..9816df225af3 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -156,7 +156,7 @@ struct neighbour {
156 struct rcu_head rcu; 156 struct rcu_head rcu;
157 struct net_device *dev; 157 struct net_device *dev;
158 u8 primary_key[0]; 158 u8 primary_key[0];
159}; 159} __randomize_layout;
160 160
161struct neigh_ops { 161struct neigh_ops {
162 int family; 162 int family;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 31a2b51bef2c..1c401bd4c2e0 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -148,7 +148,7 @@ struct net {
148#endif 148#endif
149 struct sock *diag_nlsk; 149 struct sock *diag_nlsk;
150 atomic_t fnhe_genid; 150 atomic_t fnhe_genid;
151}; 151} __randomize_layout;
152 152
153#include <linux/seq_file_net.h> 153#include <linux/seq_file_net.h>
154 154
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 01709172b3d3..ef8e6c3a80a6 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -98,8 +98,8 @@
98 * nla_put_u8(skb, type, value) add u8 attribute to skb 98 * nla_put_u8(skb, type, value) add u8 attribute to skb
99 * nla_put_u16(skb, type, value) add u16 attribute to skb 99 * nla_put_u16(skb, type, value) add u16 attribute to skb
100 * nla_put_u32(skb, type, value) add u32 attribute to skb 100 * nla_put_u32(skb, type, value) add u32 attribute to skb
101 * nla_put_u64_64bits(skb, type, 101 * nla_put_u64_64bit(skb, type,
102 * value, padattr) add u64 attribute to skb 102 * value, padattr) add u64 attribute to skb
103 * nla_put_s8(skb, type, value) add s8 attribute to skb 103 * nla_put_s8(skb, type, value) add s8 attribute to skb
104 * nla_put_s16(skb, type, value) add s16 attribute to skb 104 * nla_put_s16(skb, type, value) add s16 attribute to skb
105 * nla_put_s32(skb, type, value) add s32 attribute to skb 105 * nla_put_s32(skb, type, value) add s32 attribute to skb
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a9519a06a23b..980807d7506f 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -469,6 +469,8 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member)
469 469
470#define _sctp_walk_params(pos, chunk, end, member)\ 470#define _sctp_walk_params(pos, chunk, end, member)\
471for (pos.v = chunk->member;\ 471for (pos.v = chunk->member;\
472 (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <\
473 (void *)chunk + end) &&\
472 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ 474 pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
473 ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\ 475 ntohs(pos.p->length) >= sizeof(struct sctp_paramhdr);\
474 pos.v += SCTP_PAD4(ntohs(pos.p->length))) 476 pos.v += SCTP_PAD4(ntohs(pos.p->length)))
@@ -479,6 +481,8 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length))
479#define _sctp_walk_errors(err, chunk_hdr, end)\ 481#define _sctp_walk_errors(err, chunk_hdr, end)\
480for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ 482for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \
481 sizeof(struct sctp_chunkhdr));\ 483 sizeof(struct sctp_chunkhdr));\
484 ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <\
485 (void *)chunk_hdr + end) &&\
482 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ 486 (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\
483 ntohs(err->length) >= sizeof(sctp_errhdr_t); \ 487 ntohs(err->length) >= sizeof(sctp_errhdr_t); \
484 err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) 488 err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length))))
diff --git a/include/net/sock.h b/include/net/sock.h
index f69c8c2782df..7c0632c7e870 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1128,7 +1128,7 @@ struct proto {
1128 atomic_t socks; 1128 atomic_t socks;
1129#endif 1129#endif
1130 int (*diag_destroy)(struct sock *sk, int err); 1130 int (*diag_destroy)(struct sock *sk, int err);
1131}; 1131} __randomize_layout;
1132 1132
1133int proto_register(struct proto *prot, int alloc_slab); 1133int proto_register(struct proto *prot, int alloc_slab);
1134void proto_unregister(struct proto *prot); 1134void proto_unregister(struct proto *prot);
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 4b34c51f859e..b73a14edc85e 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -205,11 +205,13 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr *dev_addr,
205 dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); 205 dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if);
206 if (dev) { 206 if (dev) {
207 ip4 = in_dev_get(dev); 207 ip4 = in_dev_get(dev);
208 if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) { 208 if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address)
209 ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address, 209 ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address,
210 (struct in6_addr *)gid); 210 (struct in6_addr *)gid);
211
212 if (ip4)
211 in_dev_put(ip4); 213 in_dev_put(ip4);
212 } 214
213 dev_put(dev); 215 dev_put(dev);
214 } 216 }
215} 217}
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 356953d3dbd1..b5732432bb29 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1056,7 +1056,7 @@ enum ib_qp_create_flags {
1056 IB_QP_CREATE_MANAGED_RECV = 1 << 4, 1056 IB_QP_CREATE_MANAGED_RECV = 1 << 4,
1057 IB_QP_CREATE_NETIF_QP = 1 << 5, 1057 IB_QP_CREATE_NETIF_QP = 1 << 5,
1058 IB_QP_CREATE_SIGNATURE_EN = 1 << 6, 1058 IB_QP_CREATE_SIGNATURE_EN = 1 << 6,
1059 IB_QP_CREATE_USE_GFP_NOIO = 1 << 7, 1059 /* FREE = 1 << 7, */
1060 IB_QP_CREATE_SCATTER_FCS = 1 << 8, 1060 IB_QP_CREATE_SCATTER_FCS = 1 << 8,
1061 IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9, 1061 IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9,
1062 /* reserve bits 26-31 for low level drivers' internal use */ 1062 /* reserve bits 26-31 for low level drivers' internal use */
@@ -2948,6 +2948,22 @@ struct ib_qp *ib_create_qp(struct ib_pd *pd,
2948 struct ib_qp_init_attr *qp_init_attr); 2948 struct ib_qp_init_attr *qp_init_attr);
2949 2949
2950/** 2950/**
2951 * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
2952 * @qp: The QP to modify.
2953 * @attr: On input, specifies the QP attributes to modify. On output,
2954 * the current values of selected QP attributes are returned.
2955 * @attr_mask: A bit-mask used to specify which attributes of the QP
2956 * are being modified.
2957 * @udata: pointer to user's input output buffer information
2958 * are being modified.
2959 * It returns 0 on success and returns appropriate error code on error.
2960 */
2961int ib_modify_qp_with_udata(struct ib_qp *qp,
2962 struct ib_qp_attr *attr,
2963 int attr_mask,
2964 struct ib_udata *udata);
2965
2966/**
2951 * ib_modify_qp - Modifies the attributes for the specified QP and then 2967 * ib_modify_qp - Modifies the attributes for the specified QP and then
2952 * transitions the QP to the given state. 2968 * transitions the QP to the given state.
2953 * @qp: The QP to modify. 2969 * @qp: The QP to modify.
diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h
index 4878aaf7bdff..55af69271053 100644
--- a/include/rdma/rdma_vt.h
+++ b/include/rdma/rdma_vt.h
@@ -229,8 +229,7 @@ struct rvt_driver_provided {
229 * ERR_PTR(err). The driver is free to return NULL or a valid 229 * ERR_PTR(err). The driver is free to return NULL or a valid
230 * pointer. 230 * pointer.
231 */ 231 */
232 void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp, 232 void * (*qp_priv_alloc)(struct rvt_dev_info *rdi, struct rvt_qp *qp);
233 gfp_t gfp);
234 233
235 /* 234 /*
236 * Free the driver's private qp structure. 235 * Free the driver's private qp structure.
@@ -319,7 +318,7 @@ struct rvt_driver_provided {
319 318
320 /* Let the driver pick the next queue pair number*/ 319 /* Let the driver pick the next queue pair number*/
321 int (*alloc_qpn)(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, 320 int (*alloc_qpn)(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt,
322 enum ib_qp_type type, u8 port_num, gfp_t gfp); 321 enum ib_qp_type type, u8 port_num);
323 322
324 /* Determine if its safe or allowed to modify the qp */ 323 /* Determine if its safe or allowed to modify the qp */
325 int (*check_modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr, 324 int (*check_modify_qp)(struct rvt_qp *qp, struct ib_qp_attr *attr,
diff --git a/include/rdma/rdmavt_qp.h b/include/rdma/rdmavt_qp.h
index be6472e5b06b..d664d2e76280 100644
--- a/include/rdma/rdmavt_qp.h
+++ b/include/rdma/rdmavt_qp.h
@@ -647,6 +647,20 @@ static inline u32 rvt_div_mtu(struct rvt_qp *qp, u32 len)
647 return len >> qp->log_pmtu; 647 return len >> qp->log_pmtu;
648} 648}
649 649
650/**
651 * rvt_timeout_to_jiffies - Convert a ULP timeout input into jiffies
652 * @timeout - timeout input(0 - 31).
653 *
654 * Return a timeout value in jiffies.
655 */
656static inline unsigned long rvt_timeout_to_jiffies(u8 timeout)
657{
658 if (timeout > 31)
659 timeout = 31;
660
661 return usecs_to_jiffies(1U << timeout) * 4096UL / 1000UL;
662}
663
650extern const int ib_rvt_state_ops[]; 664extern const int ib_rvt_state_ops[];
651 665
652struct rvt_dev_info; 666struct rvt_dev_info;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9c94b97c17f8..c4a8b1947566 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -795,10 +795,6 @@ struct snd_soc_component_driver {
795 int (*suspend)(struct snd_soc_component *); 795 int (*suspend)(struct snd_soc_component *);
796 int (*resume)(struct snd_soc_component *); 796 int (*resume)(struct snd_soc_component *);
797 797
798 /* pcm creation and destruction */
799 int (*pcm_new)(struct snd_soc_pcm_runtime *);
800 void (*pcm_free)(struct snd_pcm *);
801
802 /* DT */ 798 /* DT */
803 int (*of_xlate_dai_name)(struct snd_soc_component *component, 799 int (*of_xlate_dai_name)(struct snd_soc_component *component,
804 struct of_phandle_args *args, 800 struct of_phandle_args *args,
@@ -874,8 +870,6 @@ struct snd_soc_component {
874 void (*remove)(struct snd_soc_component *); 870 void (*remove)(struct snd_soc_component *);
875 int (*suspend)(struct snd_soc_component *); 871 int (*suspend)(struct snd_soc_component *);
876 int (*resume)(struct snd_soc_component *); 872 int (*resume)(struct snd_soc_component *);
877 int (*pcm_new)(struct snd_soc_pcm_runtime *);
878 void (*pcm_free)(struct snd_pcm *);
879 873
880 /* machine specific init */ 874 /* machine specific init */
881 int (*init)(struct snd_soc_component *component); 875 int (*init)(struct snd_soc_component *component);
diff --git a/include/uapi/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h
index 06d5f7ddf84e..14baf9f23a14 100644
--- a/include/uapi/asm-generic/ioctls.h
+++ b/include/uapi/asm-generic/ioctls.h
@@ -77,7 +77,7 @@
77#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */ 77#define TIOCGPKT _IOR('T', 0x38, int) /* Get packet mode state */
78#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */ 78#define TIOCGPTLCK _IOR('T', 0x39, int) /* Get Pty lock state */
79#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */ 79#define TIOCGEXCL _IOR('T', 0x40, int) /* Get exclusive mode state */
80#define TIOCGPTPEER _IOR('T', 0x41, int) /* Safely open the slave */ 80#define TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
81 81
82#define FIONCLEX 0x5450 82#define FIONCLEX 0x5450
83#define FIOCLEX 0x5451 83#define FIOCLEX 0x5451
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
index d2314be4f0c0..a4680a5bf5dd 100644
--- a/include/uapi/linux/usb/audio.h
+++ b/include/uapi/linux/usb/audio.h
@@ -333,7 +333,7 @@ struct uac_processing_unit_descriptor {
333 __u8 bDescriptorType; 333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype; 334 __u8 bDescriptorSubtype;
335 __u8 bUnitID; 335 __u8 bUnitID;
336 __u16 wProcessType; 336 __le16 wProcessType;
337 __u8 bNrInPins; 337 __u8 bNrInPins;
338 __u8 baSourceID[]; 338 __u8 baSourceID[];
339} __attribute__ ((packed)); 339} __attribute__ ((packed));
@@ -491,8 +491,8 @@ struct uac_format_type_ii_ext_descriptor {
491 __u8 bDescriptorType; 491 __u8 bDescriptorType;
492 __u8 bDescriptorSubtype; 492 __u8 bDescriptorSubtype;
493 __u8 bFormatType; 493 __u8 bFormatType;
494 __u16 wMaxBitRate; 494 __le16 wMaxBitRate;
495 __u16 wSamplesPerFrame; 495 __le16 wSamplesPerFrame;
496 __u8 bHeaderLength; 496 __u8 bHeaderLength;
497 __u8 bSideBandProtocol; 497 __u8 bSideBandProtocol;
498} __attribute__((packed)); 498} __attribute__((packed));
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
index d1767dfb0d95..8906361bb50c 100644
--- a/include/xen/balloon.h
+++ b/include/xen/balloon.h
@@ -35,3 +35,11 @@ static inline int register_xen_selfballooning(struct device *dev)
35 return -ENOSYS; 35 return -ENOSYS;
36} 36}
37#endif 37#endif
38
39#ifdef CONFIG_XEN_BALLOON
40void xen_balloon_init(void);
41#else
42static inline void xen_balloon_init(void)
43{
44}
45#endif
diff --git a/kernel/audit.c b/kernel/audit.c
index 833267bbd80b..6dd556931739 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -641,6 +641,7 @@ static int auditd_send_unicast_skb(struct sk_buff *skb)
641 ac = rcu_dereference(auditd_conn); 641 ac = rcu_dereference(auditd_conn);
642 if (!ac) { 642 if (!ac) {
643 rcu_read_unlock(); 643 rcu_read_unlock();
644 kfree_skb(skb);
644 rc = -ECONNREFUSED; 645 rc = -ECONNREFUSED;
645 goto err; 646 goto err;
646 } 647 }
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 6a86723c5b64..af9e84a4944e 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -504,6 +504,7 @@ static void reset_reg_range_values(struct bpf_reg_state *regs, u32 regno)
504{ 504{
505 regs[regno].min_value = BPF_REGISTER_MIN_RANGE; 505 regs[regno].min_value = BPF_REGISTER_MIN_RANGE;
506 regs[regno].max_value = BPF_REGISTER_MAX_RANGE; 506 regs[regno].max_value = BPF_REGISTER_MAX_RANGE;
507 regs[regno].value_from_signed = false;
507 regs[regno].min_align = 0; 508 regs[regno].min_align = 0;
508} 509}
509 510
@@ -777,12 +778,13 @@ static int check_ctx_access(struct bpf_verifier_env *env, int insn_idx, int off,
777 return -EACCES; 778 return -EACCES;
778} 779}
779 780
780static bool is_pointer_value(struct bpf_verifier_env *env, int regno) 781static bool __is_pointer_value(bool allow_ptr_leaks,
782 const struct bpf_reg_state *reg)
781{ 783{
782 if (env->allow_ptr_leaks) 784 if (allow_ptr_leaks)
783 return false; 785 return false;
784 786
785 switch (env->cur_state.regs[regno].type) { 787 switch (reg->type) {
786 case UNKNOWN_VALUE: 788 case UNKNOWN_VALUE:
787 case CONST_IMM: 789 case CONST_IMM:
788 return false; 790 return false;
@@ -791,6 +793,11 @@ static bool is_pointer_value(struct bpf_verifier_env *env, int regno)
791 } 793 }
792} 794}
793 795
796static bool is_pointer_value(struct bpf_verifier_env *env, int regno)
797{
798 return __is_pointer_value(env->allow_ptr_leaks, &env->cur_state.regs[regno]);
799}
800
794static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg, 801static int check_pkt_ptr_alignment(const struct bpf_reg_state *reg,
795 int off, int size, bool strict) 802 int off, int size, bool strict)
796{ 803{
@@ -1832,10 +1839,24 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
1832 dst_align = dst_reg->min_align; 1839 dst_align = dst_reg->min_align;
1833 1840
1834 /* We don't know anything about what was done to this register, mark it 1841 /* We don't know anything about what was done to this register, mark it
1835 * as unknown. 1842 * as unknown. Also, if both derived bounds came from signed/unsigned
1843 * mixed compares and one side is unbounded, we cannot really do anything
1844 * with them as boundaries cannot be trusted. Thus, arithmetic of two
1845 * regs of such kind will get invalidated bounds on the dst side.
1836 */ 1846 */
1837 if (min_val == BPF_REGISTER_MIN_RANGE && 1847 if ((min_val == BPF_REGISTER_MIN_RANGE &&
1838 max_val == BPF_REGISTER_MAX_RANGE) { 1848 max_val == BPF_REGISTER_MAX_RANGE) ||
1849 (BPF_SRC(insn->code) == BPF_X &&
1850 ((min_val != BPF_REGISTER_MIN_RANGE &&
1851 max_val == BPF_REGISTER_MAX_RANGE) ||
1852 (min_val == BPF_REGISTER_MIN_RANGE &&
1853 max_val != BPF_REGISTER_MAX_RANGE) ||
1854 (dst_reg->min_value != BPF_REGISTER_MIN_RANGE &&
1855 dst_reg->max_value == BPF_REGISTER_MAX_RANGE) ||
1856 (dst_reg->min_value == BPF_REGISTER_MIN_RANGE &&
1857 dst_reg->max_value != BPF_REGISTER_MAX_RANGE)) &&
1858 regs[insn->dst_reg].value_from_signed !=
1859 regs[insn->src_reg].value_from_signed)) {
1839 reset_reg_range_values(regs, insn->dst_reg); 1860 reset_reg_range_values(regs, insn->dst_reg);
1840 return; 1861 return;
1841 } 1862 }
@@ -2023,6 +2044,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
2023 regs[insn->dst_reg].max_value = insn->imm; 2044 regs[insn->dst_reg].max_value = insn->imm;
2024 regs[insn->dst_reg].min_value = insn->imm; 2045 regs[insn->dst_reg].min_value = insn->imm;
2025 regs[insn->dst_reg].min_align = calc_align(insn->imm); 2046 regs[insn->dst_reg].min_align = calc_align(insn->imm);
2047 regs[insn->dst_reg].value_from_signed = false;
2026 } 2048 }
2027 2049
2028 } else if (opcode > BPF_END) { 2050 } else if (opcode > BPF_END) {
@@ -2198,40 +2220,63 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg,
2198 struct bpf_reg_state *false_reg, u64 val, 2220 struct bpf_reg_state *false_reg, u64 val,
2199 u8 opcode) 2221 u8 opcode)
2200{ 2222{
2223 bool value_from_signed = true;
2224 bool is_range = true;
2225
2201 switch (opcode) { 2226 switch (opcode) {
2202 case BPF_JEQ: 2227 case BPF_JEQ:
2203 /* If this is false then we know nothing Jon Snow, but if it is 2228 /* If this is false then we know nothing Jon Snow, but if it is
2204 * true then we know for sure. 2229 * true then we know for sure.
2205 */ 2230 */
2206 true_reg->max_value = true_reg->min_value = val; 2231 true_reg->max_value = true_reg->min_value = val;
2232 is_range = false;
2207 break; 2233 break;
2208 case BPF_JNE: 2234 case BPF_JNE:
2209 /* If this is true we know nothing Jon Snow, but if it is false 2235 /* If this is true we know nothing Jon Snow, but if it is false
2210 * we know the value for sure; 2236 * we know the value for sure;
2211 */ 2237 */
2212 false_reg->max_value = false_reg->min_value = val; 2238 false_reg->max_value = false_reg->min_value = val;
2239 is_range = false;
2213 break; 2240 break;
2214 case BPF_JGT: 2241 case BPF_JGT:
2215 /* Unsigned comparison, the minimum value is 0. */ 2242 value_from_signed = false;
2216 false_reg->min_value = 0;
2217 /* fallthrough */ 2243 /* fallthrough */
2218 case BPF_JSGT: 2244 case BPF_JSGT:
2245 if (true_reg->value_from_signed != value_from_signed)
2246 reset_reg_range_values(true_reg, 0);
2247 if (false_reg->value_from_signed != value_from_signed)
2248 reset_reg_range_values(false_reg, 0);
2249 if (opcode == BPF_JGT) {
2250 /* Unsigned comparison, the minimum value is 0. */
2251 false_reg->min_value = 0;
2252 }
2219 /* If this is false then we know the maximum val is val, 2253 /* If this is false then we know the maximum val is val,
2220 * otherwise we know the min val is val+1. 2254 * otherwise we know the min val is val+1.
2221 */ 2255 */
2222 false_reg->max_value = val; 2256 false_reg->max_value = val;
2257 false_reg->value_from_signed = value_from_signed;
2223 true_reg->min_value = val + 1; 2258 true_reg->min_value = val + 1;
2259 true_reg->value_from_signed = value_from_signed;
2224 break; 2260 break;
2225 case BPF_JGE: 2261 case BPF_JGE:
2226 /* Unsigned comparison, the minimum value is 0. */ 2262 value_from_signed = false;
2227 false_reg->min_value = 0;
2228 /* fallthrough */ 2263 /* fallthrough */
2229 case BPF_JSGE: 2264 case BPF_JSGE:
2265 if (true_reg->value_from_signed != value_from_signed)
2266 reset_reg_range_values(true_reg, 0);
2267 if (false_reg->value_from_signed != value_from_signed)
2268 reset_reg_range_values(false_reg, 0);
2269 if (opcode == BPF_JGE) {
2270 /* Unsigned comparison, the minimum value is 0. */
2271 false_reg->min_value = 0;
2272 }
2230 /* If this is false then we know the maximum value is val - 1, 2273 /* If this is false then we know the maximum value is val - 1,
2231 * otherwise we know the mimimum value is val. 2274 * otherwise we know the mimimum value is val.
2232 */ 2275 */
2233 false_reg->max_value = val - 1; 2276 false_reg->max_value = val - 1;
2277 false_reg->value_from_signed = value_from_signed;
2234 true_reg->min_value = val; 2278 true_reg->min_value = val;
2279 true_reg->value_from_signed = value_from_signed;
2235 break; 2280 break;
2236 default: 2281 default:
2237 break; 2282 break;
@@ -2239,6 +2284,12 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg,
2239 2284
2240 check_reg_overflow(false_reg); 2285 check_reg_overflow(false_reg);
2241 check_reg_overflow(true_reg); 2286 check_reg_overflow(true_reg);
2287 if (is_range) {
2288 if (__is_pointer_value(false, false_reg))
2289 reset_reg_range_values(false_reg, 0);
2290 if (__is_pointer_value(false, true_reg))
2291 reset_reg_range_values(true_reg, 0);
2292 }
2242} 2293}
2243 2294
2244/* Same as above, but for the case that dst_reg is a CONST_IMM reg and src_reg 2295/* Same as above, but for the case that dst_reg is a CONST_IMM reg and src_reg
@@ -2248,41 +2299,64 @@ static void reg_set_min_max_inv(struct bpf_reg_state *true_reg,
2248 struct bpf_reg_state *false_reg, u64 val, 2299 struct bpf_reg_state *false_reg, u64 val,
2249 u8 opcode) 2300 u8 opcode)
2250{ 2301{
2302 bool value_from_signed = true;
2303 bool is_range = true;
2304
2251 switch (opcode) { 2305 switch (opcode) {
2252 case BPF_JEQ: 2306 case BPF_JEQ:
2253 /* If this is false then we know nothing Jon Snow, but if it is 2307 /* If this is false then we know nothing Jon Snow, but if it is
2254 * true then we know for sure. 2308 * true then we know for sure.
2255 */ 2309 */
2256 true_reg->max_value = true_reg->min_value = val; 2310 true_reg->max_value = true_reg->min_value = val;
2311 is_range = false;
2257 break; 2312 break;
2258 case BPF_JNE: 2313 case BPF_JNE:
2259 /* If this is true we know nothing Jon Snow, but if it is false 2314 /* If this is true we know nothing Jon Snow, but if it is false
2260 * we know the value for sure; 2315 * we know the value for sure;
2261 */ 2316 */
2262 false_reg->max_value = false_reg->min_value = val; 2317 false_reg->max_value = false_reg->min_value = val;
2318 is_range = false;
2263 break; 2319 break;
2264 case BPF_JGT: 2320 case BPF_JGT:
2265 /* Unsigned comparison, the minimum value is 0. */ 2321 value_from_signed = false;
2266 true_reg->min_value = 0;
2267 /* fallthrough */ 2322 /* fallthrough */
2268 case BPF_JSGT: 2323 case BPF_JSGT:
2324 if (true_reg->value_from_signed != value_from_signed)
2325 reset_reg_range_values(true_reg, 0);
2326 if (false_reg->value_from_signed != value_from_signed)
2327 reset_reg_range_values(false_reg, 0);
2328 if (opcode == BPF_JGT) {
2329 /* Unsigned comparison, the minimum value is 0. */
2330 true_reg->min_value = 0;
2331 }
2269 /* 2332 /*
2270 * If this is false, then the val is <= the register, if it is 2333 * If this is false, then the val is <= the register, if it is
2271 * true the register <= to the val. 2334 * true the register <= to the val.
2272 */ 2335 */
2273 false_reg->min_value = val; 2336 false_reg->min_value = val;
2337 false_reg->value_from_signed = value_from_signed;
2274 true_reg->max_value = val - 1; 2338 true_reg->max_value = val - 1;
2339 true_reg->value_from_signed = value_from_signed;
2275 break; 2340 break;
2276 case BPF_JGE: 2341 case BPF_JGE:
2277 /* Unsigned comparison, the minimum value is 0. */ 2342 value_from_signed = false;
2278 true_reg->min_value = 0;
2279 /* fallthrough */ 2343 /* fallthrough */
2280 case BPF_JSGE: 2344 case BPF_JSGE:
2345 if (true_reg->value_from_signed != value_from_signed)
2346 reset_reg_range_values(true_reg, 0);
2347 if (false_reg->value_from_signed != value_from_signed)
2348 reset_reg_range_values(false_reg, 0);
2349 if (opcode == BPF_JGE) {
2350 /* Unsigned comparison, the minimum value is 0. */
2351 true_reg->min_value = 0;
2352 }
2281 /* If this is false then constant < register, if it is true then 2353 /* If this is false then constant < register, if it is true then
2282 * the register < constant. 2354 * the register < constant.
2283 */ 2355 */
2284 false_reg->min_value = val + 1; 2356 false_reg->min_value = val + 1;
2357 false_reg->value_from_signed = value_from_signed;
2285 true_reg->max_value = val; 2358 true_reg->max_value = val;
2359 true_reg->value_from_signed = value_from_signed;
2286 break; 2360 break;
2287 default: 2361 default:
2288 break; 2362 break;
@@ -2290,6 +2364,12 @@ static void reg_set_min_max_inv(struct bpf_reg_state *true_reg,
2290 2364
2291 check_reg_overflow(false_reg); 2365 check_reg_overflow(false_reg);
2292 check_reg_overflow(true_reg); 2366 check_reg_overflow(true_reg);
2367 if (is_range) {
2368 if (__is_pointer_value(false, false_reg))
2369 reset_reg_range_values(false_reg, 0);
2370 if (__is_pointer_value(false, true_reg))
2371 reset_reg_range_values(true_reg, 0);
2372 }
2293} 2373}
2294 2374
2295static void mark_map_reg(struct bpf_reg_state *regs, u32 regno, u32 id, 2375static void mark_map_reg(struct bpf_reg_state *regs, u32 regno, u32 id,
diff --git a/kernel/cpu.c b/kernel/cpu.c
index ab860453841d..eee033134262 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -279,7 +279,8 @@ static int bringup_wait_for_ap(unsigned int cpu)
279 279
280 /* Wait for the CPU to reach CPUHP_AP_ONLINE_IDLE */ 280 /* Wait for the CPU to reach CPUHP_AP_ONLINE_IDLE */
281 wait_for_completion(&st->done); 281 wait_for_completion(&st->done);
282 BUG_ON(!cpu_online(cpu)); 282 if (WARN_ON_ONCE((!cpu_online(cpu))))
283 return -ECANCELED;
283 284
284 /* Unpark the stopper thread and the hotplug thread of the target cpu */ 285 /* Unpark the stopper thread and the hotplug thread of the target cpu */
285 stop_machine_unpark(cpu); 286 stop_machine_unpark(cpu);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 1538df9b2b65..426c2ffba16d 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1452,6 +1452,13 @@ static enum event_type_t get_event_type(struct perf_event *event)
1452 1452
1453 lockdep_assert_held(&ctx->lock); 1453 lockdep_assert_held(&ctx->lock);
1454 1454
1455 /*
1456 * It's 'group type', really, because if our group leader is
1457 * pinned, so are we.
1458 */
1459 if (event->group_leader != event)
1460 event = event->group_leader;
1461
1455 event_type = event->attr.pinned ? EVENT_PINNED : EVENT_FLEXIBLE; 1462 event_type = event->attr.pinned ? EVENT_PINNED : EVENT_FLEXIBLE;
1456 if (!ctx->task) 1463 if (!ctx->task)
1457 event_type |= EVENT_CPU; 1464 event_type |= EVENT_CPU;
@@ -4378,7 +4385,9 @@ EXPORT_SYMBOL_GPL(perf_event_read_value);
4378static int __perf_read_group_add(struct perf_event *leader, 4385static int __perf_read_group_add(struct perf_event *leader,
4379 u64 read_format, u64 *values) 4386 u64 read_format, u64 *values)
4380{ 4387{
4388 struct perf_event_context *ctx = leader->ctx;
4381 struct perf_event *sub; 4389 struct perf_event *sub;
4390 unsigned long flags;
4382 int n = 1; /* skip @nr */ 4391 int n = 1; /* skip @nr */
4383 int ret; 4392 int ret;
4384 4393
@@ -4408,12 +4417,15 @@ static int __perf_read_group_add(struct perf_event *leader,
4408 if (read_format & PERF_FORMAT_ID) 4417 if (read_format & PERF_FORMAT_ID)
4409 values[n++] = primary_event_id(leader); 4418 values[n++] = primary_event_id(leader);
4410 4419
4420 raw_spin_lock_irqsave(&ctx->lock, flags);
4421
4411 list_for_each_entry(sub, &leader->sibling_list, group_entry) { 4422 list_for_each_entry(sub, &leader->sibling_list, group_entry) {
4412 values[n++] += perf_event_count(sub); 4423 values[n++] += perf_event_count(sub);
4413 if (read_format & PERF_FORMAT_ID) 4424 if (read_format & PERF_FORMAT_ID)
4414 values[n++] = primary_event_id(sub); 4425 values[n++] = primary_event_id(sub);
4415 } 4426 }
4416 4427
4428 raw_spin_unlock_irqrestore(&ctx->lock, flags);
4417 return 0; 4429 return 0;
4418} 4430}
4419 4431
@@ -7321,21 +7333,6 @@ int perf_event_account_interrupt(struct perf_event *event)
7321 return __perf_event_account_interrupt(event, 1); 7333 return __perf_event_account_interrupt(event, 1);
7322} 7334}
7323 7335
7324static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs)
7325{
7326 /*
7327 * Due to interrupt latency (AKA "skid"), we may enter the
7328 * kernel before taking an overflow, even if the PMU is only
7329 * counting user events.
7330 * To avoid leaking information to userspace, we must always
7331 * reject kernel samples when exclude_kernel is set.
7332 */
7333 if (event->attr.exclude_kernel && !user_mode(regs))
7334 return false;
7335
7336 return true;
7337}
7338
7339/* 7336/*
7340 * Generic event overflow handling, sampling. 7337 * Generic event overflow handling, sampling.
7341 */ 7338 */
@@ -7357,12 +7354,6 @@ static int __perf_event_overflow(struct perf_event *event,
7357 ret = __perf_event_account_interrupt(event, throttle); 7354 ret = __perf_event_account_interrupt(event, throttle);
7358 7355
7359 /* 7356 /*
7360 * For security, drop the skid kernel samples if necessary.
7361 */
7362 if (!sample_is_allowed(event, regs))
7363 return ret;
7364
7365 /*
7366 * XXX event_limit might not quite work as expected on inherited 7357 * XXX event_limit might not quite work as expected on inherited
7367 * events 7358 * events
7368 */ 7359 */
diff --git a/kernel/futex.c b/kernel/futex.c
index c934689043b2..16dbe4c93895 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -212,7 +212,7 @@ struct futex_pi_state {
212 atomic_t refcount; 212 atomic_t refcount;
213 213
214 union futex_key key; 214 union futex_key key;
215}; 215} __randomize_layout;
216 216
217/** 217/**
218 * struct futex_q - The hashed futex queue entry, one per waiting task 218 * struct futex_q - The hashed futex queue entry, one per waiting task
@@ -246,7 +246,7 @@ struct futex_q {
246 struct rt_mutex_waiter *rt_waiter; 246 struct rt_mutex_waiter *rt_waiter;
247 union futex_key *requeue_pi_key; 247 union futex_key *requeue_pi_key;
248 u32 bitset; 248 u32 bitset;
249}; 249} __randomize_layout;
250 250
251static const struct futex_q futex_q_init = { 251static const struct futex_q futex_q_init = {
252 /* list gets initialized in queue_me()*/ 252 /* list gets initialized in queue_me()*/
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index d171bc57e1e0..a3cc37c0c85e 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -170,21 +170,11 @@ static void irq_state_clr_disabled(struct irq_desc *desc)
170 irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED); 170 irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED);
171} 171}
172 172
173static void irq_state_set_disabled(struct irq_desc *desc)
174{
175 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
176}
177
178static void irq_state_clr_masked(struct irq_desc *desc) 173static void irq_state_clr_masked(struct irq_desc *desc)
179{ 174{
180 irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED); 175 irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED);
181} 176}
182 177
183static void irq_state_set_masked(struct irq_desc *desc)
184{
185 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
186}
187
188static void irq_state_clr_started(struct irq_desc *desc) 178static void irq_state_clr_started(struct irq_desc *desc)
189{ 179{
190 irqd_clear(&desc->irq_data, IRQD_IRQ_STARTED); 180 irqd_clear(&desc->irq_data, IRQD_IRQ_STARTED);
diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
index aee8f7ec40af..638eb9c83d9f 100644
--- a/kernel/irq/cpuhotplug.c
+++ b/kernel/irq/cpuhotplug.c
@@ -95,8 +95,13 @@ static bool migrate_one_irq(struct irq_desc *desc)
95 affinity = cpu_online_mask; 95 affinity = cpu_online_mask;
96 brokeaff = true; 96 brokeaff = true;
97 } 97 }
98 98 /*
99 err = irq_do_set_affinity(d, affinity, true); 99 * Do not set the force argument of irq_do_set_affinity() as this
100 * disables the masking of offline CPUs from the supplied affinity
101 * mask and therefore might keep/reassign the irq to the outgoing
102 * CPU.
103 */
104 err = irq_do_set_affinity(d, affinity, false);
100 if (err) { 105 if (err) {
101 pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n", 106 pr_warn_ratelimited("IRQ%u: set affinity failed(%d).\n",
102 d->irq, err); 107 d->irq, err);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index dbfba9933ed2..a2c48058354c 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -227,6 +227,16 @@ static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
227 return __irqd_to_state(d) & mask; 227 return __irqd_to_state(d) & mask;
228} 228}
229 229
230static inline void irq_state_set_disabled(struct irq_desc *desc)
231{
232 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
233}
234
235static inline void irq_state_set_masked(struct irq_desc *desc)
236{
237 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
238}
239
230#undef __irqd_to_state 240#undef __irqd_to_state
231 241
232static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc) 242static inline void kstat_incr_irqs_this_cpu(struct irq_desc *desc)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 5624b2dd6b58..1d1a5b945ab4 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1090,6 +1090,16 @@ setup_irq_thread(struct irqaction *new, unsigned int irq, bool secondary)
1090/* 1090/*
1091 * Internal function to register an irqaction - typically used to 1091 * Internal function to register an irqaction - typically used to
1092 * allocate special interrupts that are part of the architecture. 1092 * allocate special interrupts that are part of the architecture.
1093 *
1094 * Locking rules:
1095 *
1096 * desc->request_mutex Provides serialization against a concurrent free_irq()
1097 * chip_bus_lock Provides serialization for slow bus operations
1098 * desc->lock Provides serialization against hard interrupts
1099 *
1100 * chip_bus_lock and desc->lock are sufficient for all other management and
1101 * interrupt related functions. desc->request_mutex solely serializes
1102 * request/free_irq().
1093 */ 1103 */
1094static int 1104static int
1095__setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) 1105__setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
@@ -1167,20 +1177,35 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1167 if (desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE) 1177 if (desc->irq_data.chip->flags & IRQCHIP_ONESHOT_SAFE)
1168 new->flags &= ~IRQF_ONESHOT; 1178 new->flags &= ~IRQF_ONESHOT;
1169 1179
1180 /*
1181 * Protects against a concurrent __free_irq() call which might wait
1182 * for synchronize_irq() to complete without holding the optional
1183 * chip bus lock and desc->lock.
1184 */
1170 mutex_lock(&desc->request_mutex); 1185 mutex_lock(&desc->request_mutex);
1186
1187 /*
1188 * Acquire bus lock as the irq_request_resources() callback below
1189 * might rely on the serialization or the magic power management
1190 * functions which are abusing the irq_bus_lock() callback,
1191 */
1192 chip_bus_lock(desc);
1193
1194 /* First installed action requests resources. */
1171 if (!desc->action) { 1195 if (!desc->action) {
1172 ret = irq_request_resources(desc); 1196 ret = irq_request_resources(desc);
1173 if (ret) { 1197 if (ret) {
1174 pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n", 1198 pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n",
1175 new->name, irq, desc->irq_data.chip->name); 1199 new->name, irq, desc->irq_data.chip->name);
1176 goto out_mutex; 1200 goto out_bus_unlock;
1177 } 1201 }
1178 } 1202 }
1179 1203
1180 chip_bus_lock(desc);
1181
1182 /* 1204 /*
1183 * The following block of code has to be executed atomically 1205 * The following block of code has to be executed atomically
1206 * protected against a concurrent interrupt and any of the other
1207 * management calls which are not serialized via
1208 * desc->request_mutex or the optional bus lock.
1184 */ 1209 */
1185 raw_spin_lock_irqsave(&desc->lock, flags); 1210 raw_spin_lock_irqsave(&desc->lock, flags);
1186 old_ptr = &desc->action; 1211 old_ptr = &desc->action;
@@ -1286,10 +1311,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1286 ret = __irq_set_trigger(desc, 1311 ret = __irq_set_trigger(desc,
1287 new->flags & IRQF_TRIGGER_MASK); 1312 new->flags & IRQF_TRIGGER_MASK);
1288 1313
1289 if (ret) { 1314 if (ret)
1290 irq_release_resources(desc);
1291 goto out_unlock; 1315 goto out_unlock;
1292 }
1293 } 1316 }
1294 1317
1295 desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \ 1318 desc->istate &= ~(IRQS_AUTODETECT | IRQS_SPURIOUS_DISABLED | \
@@ -1385,12 +1408,10 @@ mismatch:
1385out_unlock: 1408out_unlock:
1386 raw_spin_unlock_irqrestore(&desc->lock, flags); 1409 raw_spin_unlock_irqrestore(&desc->lock, flags);
1387 1410
1388 chip_bus_sync_unlock(desc);
1389
1390 if (!desc->action) 1411 if (!desc->action)
1391 irq_release_resources(desc); 1412 irq_release_resources(desc);
1392 1413out_bus_unlock:
1393out_mutex: 1414 chip_bus_sync_unlock(desc);
1394 mutex_unlock(&desc->request_mutex); 1415 mutex_unlock(&desc->request_mutex);
1395 1416
1396out_thread: 1417out_thread:
@@ -1472,6 +1493,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
1472 WARN(1, "Trying to free already-free IRQ %d\n", irq); 1493 WARN(1, "Trying to free already-free IRQ %d\n", irq);
1473 raw_spin_unlock_irqrestore(&desc->lock, flags); 1494 raw_spin_unlock_irqrestore(&desc->lock, flags);
1474 chip_bus_sync_unlock(desc); 1495 chip_bus_sync_unlock(desc);
1496 mutex_unlock(&desc->request_mutex);
1475 return NULL; 1497 return NULL;
1476 } 1498 }
1477 1499
@@ -1498,6 +1520,20 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
1498#endif 1520#endif
1499 1521
1500 raw_spin_unlock_irqrestore(&desc->lock, flags); 1522 raw_spin_unlock_irqrestore(&desc->lock, flags);
1523 /*
1524 * Drop bus_lock here so the changes which were done in the chip
1525 * callbacks above are synced out to the irq chips which hang
1526 * behind a slow bus (I2C, SPI) before calling synchronize_irq().
1527 *
1528 * Aside of that the bus_lock can also be taken from the threaded
1529 * handler in irq_finalize_oneshot() which results in a deadlock
1530 * because synchronize_irq() would wait forever for the thread to
1531 * complete, which is blocked on the bus lock.
1532 *
1533 * The still held desc->request_mutex() protects against a
1534 * concurrent request_irq() of this irq so the release of resources
1535 * and timing data is properly serialized.
1536 */
1501 chip_bus_sync_unlock(desc); 1537 chip_bus_sync_unlock(desc);
1502 1538
1503 unregister_handler_proc(irq, action); 1539 unregister_handler_proc(irq, action);
@@ -1530,8 +1566,15 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
1530 } 1566 }
1531 } 1567 }
1532 1568
1569 /* Last action releases resources */
1533 if (!desc->action) { 1570 if (!desc->action) {
1571 /*
1572 * Reaquire bus lock as irq_release_resources() might
1573 * require it to deallocate resources over the slow bus.
1574 */
1575 chip_bus_lock(desc);
1534 irq_release_resources(desc); 1576 irq_release_resources(desc);
1577 chip_bus_sync_unlock(desc);
1535 irq_remove_timings(desc); 1578 irq_remove_timings(desc);
1536 } 1579 }
1537 1580
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index cea1de0161f1..6bd9b58429cc 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -149,6 +149,8 @@ static void resume_irq(struct irq_desc *desc)
149 149
150 /* Pretend that it got disabled ! */ 150 /* Pretend that it got disabled ! */
151 desc->depth++; 151 desc->depth++;
152 irq_state_set_disabled(desc);
153 irq_state_set_masked(desc);
152resume: 154resume:
153 desc->istate &= ~IRQS_SUSPENDED; 155 desc->istate &= ~IRQS_SUSPENDED;
154 __enable_irq(desc); 156 __enable_irq(desc);
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 78069895032a..649dc9d3951a 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -963,7 +963,6 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
963 return -EDEADLK; 963 return -EDEADLK;
964 964
965 raw_spin_lock(&task->pi_lock); 965 raw_spin_lock(&task->pi_lock);
966 rt_mutex_adjust_prio(task);
967 waiter->task = task; 966 waiter->task = task;
968 waiter->lock = lock; 967 waiter->lock = lock;
969 waiter->prio = task->prio; 968 waiter->prio = task->prio;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 17c667b427b4..0869b20fba81 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2069,7 +2069,7 @@ out:
2069/** 2069/**
2070 * try_to_wake_up_local - try to wake up a local task with rq lock held 2070 * try_to_wake_up_local - try to wake up a local task with rq lock held
2071 * @p: the thread to be awakened 2071 * @p: the thread to be awakened
2072 * @cookie: context's cookie for pinning 2072 * @rf: request-queue flags for pinning
2073 * 2073 *
2074 * Put @p on the run-queue if it's not already there. The caller must 2074 * Put @p on the run-queue if it's not already there. The caller must
2075 * ensure that this_rq() is locked, @p is bound to this_rq() and not 2075 * ensure that this_rq() is locked, @p is bound to this_rq() and not
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 6e3ea4ac1bda..14d2dbf97c53 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -683,7 +683,7 @@ static u64 vtime_delta(struct vtime *vtime)
683{ 683{
684 unsigned long long clock; 684 unsigned long long clock;
685 685
686 clock = sched_clock_cpu(smp_processor_id()); 686 clock = sched_clock();
687 if (clock < vtime->starttime) 687 if (clock < vtime->starttime)
688 return 0; 688 return 0;
689 689
@@ -814,7 +814,7 @@ void arch_vtime_task_switch(struct task_struct *prev)
814 814
815 write_seqcount_begin(&vtime->seqcount); 815 write_seqcount_begin(&vtime->seqcount);
816 vtime->state = VTIME_SYS; 816 vtime->state = VTIME_SYS;
817 vtime->starttime = sched_clock_cpu(smp_processor_id()); 817 vtime->starttime = sched_clock();
818 write_seqcount_end(&vtime->seqcount); 818 write_seqcount_end(&vtime->seqcount);
819} 819}
820 820
@@ -826,7 +826,7 @@ void vtime_init_idle(struct task_struct *t, int cpu)
826 local_irq_save(flags); 826 local_irq_save(flags);
827 write_seqcount_begin(&vtime->seqcount); 827 write_seqcount_begin(&vtime->seqcount);
828 vtime->state = VTIME_SYS; 828 vtime->state = VTIME_SYS;
829 vtime->starttime = sched_clock_cpu(cpu); 829 vtime->starttime = sched_clock();
830 write_seqcount_end(&vtime->seqcount); 830 write_seqcount_end(&vtime->seqcount);
831 local_irq_restore(flags); 831 local_irq_restore(flags);
832} 832}
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index a84299f44b5d..755bd3f1a1a9 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1392,17 +1392,19 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
1392 struct sched_dl_entity *pi_se = &p->dl; 1392 struct sched_dl_entity *pi_se = &p->dl;
1393 1393
1394 /* 1394 /*
1395 * Use the scheduling parameters of the top pi-waiter 1395 * Use the scheduling parameters of the top pi-waiter task if:
1396 * task if we have one and its (absolute) deadline is 1396 * - we have a top pi-waiter which is a SCHED_DEADLINE task AND
1397 * smaller than our one... OTW we keep our runtime and 1397 * - our dl_boosted is set (i.e. the pi-waiter's (absolute) deadline is
1398 * deadline. 1398 * smaller than our deadline OR we are a !SCHED_DEADLINE task getting
1399 * boosted due to a SCHED_DEADLINE pi-waiter).
1400 * Otherwise we keep our runtime and deadline.
1399 */ 1401 */
1400 if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) { 1402 if (pi_task && dl_prio(pi_task->normal_prio) && p->dl.dl_boosted) {
1401 pi_se = &pi_task->dl; 1403 pi_se = &pi_task->dl;
1402 } else if (!dl_prio(p->normal_prio)) { 1404 } else if (!dl_prio(p->normal_prio)) {
1403 /* 1405 /*
1404 * Special case in which we have a !SCHED_DEADLINE task 1406 * Special case in which we have a !SCHED_DEADLINE task
1405 * that is going to be deboosted, but exceedes its 1407 * that is going to be deboosted, but exceeds its
1406 * runtime while doing so. No point in replenishing 1408 * runtime while doing so. No point in replenishing
1407 * it, as it's going to return back to its original 1409 * it, as it's going to return back to its original
1408 * scheduling class after this. 1410 * scheduling class after this.
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 53f6b6401cf0..02004ae91860 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -113,7 +113,7 @@ static int ftrace_disabled __read_mostly;
113 113
114static DEFINE_MUTEX(ftrace_lock); 114static DEFINE_MUTEX(ftrace_lock);
115 115
116static struct ftrace_ops *ftrace_ops_list __read_mostly = &ftrace_list_end; 116static struct ftrace_ops __rcu *ftrace_ops_list __read_mostly = &ftrace_list_end;
117ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub; 117ftrace_func_t ftrace_trace_function __read_mostly = ftrace_stub;
118static struct ftrace_ops global_ops; 118static struct ftrace_ops global_ops;
119 119
@@ -169,8 +169,11 @@ int ftrace_nr_registered_ops(void)
169 169
170 mutex_lock(&ftrace_lock); 170 mutex_lock(&ftrace_lock);
171 171
172 for (ops = ftrace_ops_list; 172 for (ops = rcu_dereference_protected(ftrace_ops_list,
173 ops != &ftrace_list_end; ops = ops->next) 173 lockdep_is_held(&ftrace_lock));
174 ops != &ftrace_list_end;
175 ops = rcu_dereference_protected(ops->next,
176 lockdep_is_held(&ftrace_lock)))
174 cnt++; 177 cnt++;
175 178
176 mutex_unlock(&ftrace_lock); 179 mutex_unlock(&ftrace_lock);
@@ -275,10 +278,11 @@ static void update_ftrace_function(void)
275 * If there's only one ftrace_ops registered, the ftrace_ops_list 278 * If there's only one ftrace_ops registered, the ftrace_ops_list
276 * will point to the ops we want. 279 * will point to the ops we want.
277 */ 280 */
278 set_function_trace_op = ftrace_ops_list; 281 set_function_trace_op = rcu_dereference_protected(ftrace_ops_list,
282 lockdep_is_held(&ftrace_lock));
279 283
280 /* If there's no ftrace_ops registered, just call the stub function */ 284 /* If there's no ftrace_ops registered, just call the stub function */
281 if (ftrace_ops_list == &ftrace_list_end) { 285 if (set_function_trace_op == &ftrace_list_end) {
282 func = ftrace_stub; 286 func = ftrace_stub;
283 287
284 /* 288 /*
@@ -286,7 +290,8 @@ static void update_ftrace_function(void)
286 * recursion safe and not dynamic and the arch supports passing ops, 290 * recursion safe and not dynamic and the arch supports passing ops,
287 * then have the mcount trampoline call the function directly. 291 * then have the mcount trampoline call the function directly.
288 */ 292 */
289 } else if (ftrace_ops_list->next == &ftrace_list_end) { 293 } else if (rcu_dereference_protected(ftrace_ops_list->next,
294 lockdep_is_held(&ftrace_lock)) == &ftrace_list_end) {
290 func = ftrace_ops_get_list_func(ftrace_ops_list); 295 func = ftrace_ops_get_list_func(ftrace_ops_list);
291 296
292 } else { 297 } else {
@@ -348,9 +353,11 @@ int using_ftrace_ops_list_func(void)
348 return ftrace_trace_function == ftrace_ops_list_func; 353 return ftrace_trace_function == ftrace_ops_list_func;
349} 354}
350 355
351static void add_ftrace_ops(struct ftrace_ops **list, struct ftrace_ops *ops) 356static void add_ftrace_ops(struct ftrace_ops __rcu **list,
357 struct ftrace_ops *ops)
352{ 358{
353 ops->next = *list; 359 rcu_assign_pointer(ops->next, *list);
360
354 /* 361 /*
355 * We are entering ops into the list but another 362 * We are entering ops into the list but another
356 * CPU might be walking that list. We need to make sure 363 * CPU might be walking that list. We need to make sure
@@ -360,7 +367,8 @@ static void add_ftrace_ops(struct ftrace_ops **list, struct ftrace_ops *ops)
360 rcu_assign_pointer(*list, ops); 367 rcu_assign_pointer(*list, ops);
361} 368}
362 369
363static int remove_ftrace_ops(struct ftrace_ops **list, struct ftrace_ops *ops) 370static int remove_ftrace_ops(struct ftrace_ops __rcu **list,
371 struct ftrace_ops *ops)
364{ 372{
365 struct ftrace_ops **p; 373 struct ftrace_ops **p;
366 374
@@ -368,7 +376,10 @@ static int remove_ftrace_ops(struct ftrace_ops **list, struct ftrace_ops *ops)
368 * If we are removing the last function, then simply point 376 * If we are removing the last function, then simply point
369 * to the ftrace_stub. 377 * to the ftrace_stub.
370 */ 378 */
371 if (*list == ops && ops->next == &ftrace_list_end) { 379 if (rcu_dereference_protected(*list,
380 lockdep_is_held(&ftrace_lock)) == ops &&
381 rcu_dereference_protected(ops->next,
382 lockdep_is_held(&ftrace_lock)) == &ftrace_list_end) {
372 *list = &ftrace_list_end; 383 *list = &ftrace_list_end;
373 return 0; 384 return 0;
374 } 385 }
@@ -1569,8 +1580,8 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
1569 return 0; 1580 return 0;
1570#endif 1581#endif
1571 1582
1572 hash.filter_hash = rcu_dereference_raw_notrace(ops->func_hash->filter_hash); 1583 rcu_assign_pointer(hash.filter_hash, ops->func_hash->filter_hash);
1573 hash.notrace_hash = rcu_dereference_raw_notrace(ops->func_hash->notrace_hash); 1584 rcu_assign_pointer(hash.notrace_hash, ops->func_hash->notrace_hash);
1574 1585
1575 if (hash_contains_ip(ip, &hash)) 1586 if (hash_contains_ip(ip, &hash))
1576 ret = 1; 1587 ret = 1;
@@ -2840,7 +2851,8 @@ static int ftrace_shutdown(struct ftrace_ops *ops, int command)
2840 * If there's no more ops registered with ftrace, run a 2851 * If there's no more ops registered with ftrace, run a
2841 * sanity check to make sure all rec flags are cleared. 2852 * sanity check to make sure all rec flags are cleared.
2842 */ 2853 */
2843 if (ftrace_ops_list == &ftrace_list_end) { 2854 if (rcu_dereference_protected(ftrace_ops_list,
2855 lockdep_is_held(&ftrace_lock)) == &ftrace_list_end) {
2844 struct ftrace_page *pg; 2856 struct ftrace_page *pg;
2845 struct dyn_ftrace *rec; 2857 struct dyn_ftrace *rec;
2846 2858
@@ -6453,7 +6465,8 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
6453 if (ftrace_enabled) { 6465 if (ftrace_enabled) {
6454 6466
6455 /* we are starting ftrace again */ 6467 /* we are starting ftrace again */
6456 if (ftrace_ops_list != &ftrace_list_end) 6468 if (rcu_dereference_protected(ftrace_ops_list,
6469 lockdep_is_held(&ftrace_lock)) != &ftrace_list_end)
6457 update_ftrace_function(); 6470 update_ftrace_function();
6458 6471
6459 ftrace_startup_sysctl(); 6472 ftrace_startup_sysctl();
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 4ae268e687fe..529cc50d7243 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1136,12 +1136,12 @@ static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)
1136 for (i = 0; i < nr_pages; i++) { 1136 for (i = 0; i < nr_pages; i++) {
1137 struct page *page; 1137 struct page *page;
1138 /* 1138 /*
1139 * __GFP_NORETRY flag makes sure that the allocation fails 1139 * __GFP_RETRY_MAYFAIL flag makes sure that the allocation fails
1140 * gracefully without invoking oom-killer and the system is 1140 * gracefully without invoking oom-killer and the system is not
1141 * not destabilized. 1141 * destabilized.
1142 */ 1142 */
1143 bpage = kzalloc_node(ALIGN(sizeof(*bpage), cache_line_size()), 1143 bpage = kzalloc_node(ALIGN(sizeof(*bpage), cache_line_size()),
1144 GFP_KERNEL | __GFP_NORETRY, 1144 GFP_KERNEL | __GFP_RETRY_MAYFAIL,
1145 cpu_to_node(cpu)); 1145 cpu_to_node(cpu));
1146 if (!bpage) 1146 if (!bpage)
1147 goto free_pages; 1147 goto free_pages;
@@ -1149,7 +1149,7 @@ static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)
1149 list_add(&bpage->list, pages); 1149 list_add(&bpage->list, pages);
1150 1150
1151 page = alloc_pages_node(cpu_to_node(cpu), 1151 page = alloc_pages_node(cpu_to_node(cpu),
1152 GFP_KERNEL | __GFP_NORETRY, 0); 1152 GFP_KERNEL | __GFP_RETRY_MAYFAIL, 0);
1153 if (!page) 1153 if (!page)
1154 goto free_pages; 1154 goto free_pages;
1155 bpage->page = page_address(page); 1155 bpage->page = page_address(page);
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2d0ffcc49dba..42b9355033d4 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7774,6 +7774,7 @@ static int instance_rmdir(const char *name)
7774 } 7774 }
7775 kfree(tr->topts); 7775 kfree(tr->topts);
7776 7776
7777 free_cpumask_var(tr->tracing_cpumask);
7777 kfree(tr->name); 7778 kfree(tr->name);
7778 kfree(tr); 7779 kfree(tr);
7779 7780
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 6ade1c55cc3a..490ba229931d 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1210,9 +1210,9 @@ struct ftrace_event_field {
1210struct event_filter { 1210struct event_filter {
1211 int n_preds; /* Number assigned */ 1211 int n_preds; /* Number assigned */
1212 int a_preds; /* allocated */ 1212 int a_preds; /* allocated */
1213 struct filter_pred *preds; 1213 struct filter_pred __rcu *preds;
1214 struct filter_pred *root; 1214 struct filter_pred __rcu *root;
1215 char *filter_string; 1215 char *filter_string;
1216}; 1216};
1217 1217
1218struct event_subsystem { 1218struct event_subsystem {
diff --git a/lib/test_uuid.c b/lib/test_uuid.c
index 478c049630b5..cd819c397dc7 100644
--- a/lib/test_uuid.c
+++ b/lib/test_uuid.c
@@ -82,7 +82,7 @@ static void __init test_uuid_test(const struct test_uuid_data *data)
82 test_uuid_failed("conversion", false, true, data->uuid, NULL); 82 test_uuid_failed("conversion", false, true, data->uuid, NULL);
83 83
84 total_tests++; 84 total_tests++;
85 if (uuid_equal(&data->be, &be)) { 85 if (!uuid_equal(&data->be, &be)) {
86 sprintf(buf, "%pUb", &be); 86 sprintf(buf, "%pUb", &be);
87 test_uuid_failed("cmp", false, true, data->uuid, buf); 87 test_uuid_failed("cmp", false, true, data->uuid, buf);
88 } 88 }
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index f0f3447e8aa4..861ae2a165f4 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -34,11 +34,11 @@ static struct lock_class_key bridge_netdev_addr_lock_key;
34netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) 34netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
35{ 35{
36 struct net_bridge *br = netdev_priv(dev); 36 struct net_bridge *br = netdev_priv(dev);
37 const unsigned char *dest = skb->data;
38 struct net_bridge_fdb_entry *dst; 37 struct net_bridge_fdb_entry *dst;
39 struct net_bridge_mdb_entry *mdst; 38 struct net_bridge_mdb_entry *mdst;
40 struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats); 39 struct pcpu_sw_netstats *brstats = this_cpu_ptr(br->stats);
41 const struct nf_br_ops *nf_ops; 40 const struct nf_br_ops *nf_ops;
41 const unsigned char *dest;
42 u16 vid = 0; 42 u16 vid = 0;
43 43
44 rcu_read_lock(); 44 rcu_read_lock();
@@ -61,6 +61,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
61 if (!br_allowed_ingress(br, br_vlan_group_rcu(br), skb, &vid)) 61 if (!br_allowed_ingress(br, br_vlan_group_rcu(br), skb, &vid))
62 goto out; 62 goto out;
63 63
64 dest = eth_hdr(skb)->h_dest;
64 if (is_broadcast_ether_addr(dest)) { 65 if (is_broadcast_ether_addr(dest)) {
65 br_flood(br, skb, BR_PKT_BROADCAST, false, true); 66 br_flood(br, skb, BR_PKT_BROADCAST, false, true);
66 } else if (is_multicast_ether_addr(dest)) { 67 } else if (is_multicast_ether_addr(dest)) {
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 013f2290bfa5..7637f58c1226 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -131,11 +131,11 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br,
131int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb) 131int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
132{ 132{
133 struct net_bridge_port *p = br_port_get_rcu(skb->dev); 133 struct net_bridge_port *p = br_port_get_rcu(skb->dev);
134 const unsigned char *dest = eth_hdr(skb)->h_dest;
135 enum br_pkt_type pkt_type = BR_PKT_UNICAST; 134 enum br_pkt_type pkt_type = BR_PKT_UNICAST;
136 struct net_bridge_fdb_entry *dst = NULL; 135 struct net_bridge_fdb_entry *dst = NULL;
137 struct net_bridge_mdb_entry *mdst; 136 struct net_bridge_mdb_entry *mdst;
138 bool local_rcv, mcast_hit = false; 137 bool local_rcv, mcast_hit = false;
138 const unsigned char *dest;
139 struct net_bridge *br; 139 struct net_bridge *br;
140 u16 vid = 0; 140 u16 vid = 0;
141 141
@@ -153,6 +153,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb
153 br_fdb_update(br, p, eth_hdr(skb)->h_source, vid, false); 153 br_fdb_update(br, p, eth_hdr(skb)->h_source, vid, false);
154 154
155 local_rcv = !!(br->dev->flags & IFF_PROMISC); 155 local_rcv = !!(br->dev->flags & IFF_PROMISC);
156 dest = eth_hdr(skb)->h_dest;
156 if (is_multicast_ether_addr(dest)) { 157 if (is_multicast_ether_addr(dest)) {
157 /* by definition the broadcast is also a multicast address */ 158 /* by definition the broadcast is also a multicast address */
158 if (is_broadcast_ether_addr(dest)) { 159 if (is_broadcast_ether_addr(dest)) {
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 0c31035bbfee..b7cc615d42ef 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -3203,8 +3203,10 @@ static struct ceph_msg_data *ceph_msg_data_create(enum ceph_msg_data_type type)
3203 return NULL; 3203 return NULL;
3204 3204
3205 data = kmem_cache_zalloc(ceph_msg_data_cache, GFP_NOFS); 3205 data = kmem_cache_zalloc(ceph_msg_data_cache, GFP_NOFS);
3206 if (data) 3206 if (!data)
3207 data->type = type; 3207 return NULL;
3208
3209 data->type = type;
3208 INIT_LIST_HEAD(&data->links); 3210 INIT_LIST_HEAD(&data->links);
3209 3211
3210 return data; 3212 return data;
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 86a9737d8e3f..901bb8221366 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -5310,7 +5310,10 @@ static int invalidate_authorizer(struct ceph_connection *con)
5310 5310
5311static void osd_reencode_message(struct ceph_msg *msg) 5311static void osd_reencode_message(struct ceph_msg *msg)
5312{ 5312{
5313 encode_request_finish(msg); 5313 int type = le16_to_cpu(msg->hdr.type);
5314
5315 if (type == CEPH_MSG_OSD_OP)
5316 encode_request_finish(msg);
5314} 5317}
5315 5318
5316static int osd_sign_message(struct ceph_msg *msg) 5319static int osd_sign_message(struct ceph_msg *msg)
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 864789c5974e..64ae9f89773a 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -338,7 +338,7 @@ static void crush_finalize(struct crush_map *c)
338static struct crush_map *crush_decode(void *pbyval, void *end) 338static struct crush_map *crush_decode(void *pbyval, void *end)
339{ 339{
340 struct crush_map *c; 340 struct crush_map *c;
341 int err = -EINVAL; 341 int err;
342 int i, j; 342 int i, j;
343 void **p = &pbyval; 343 void **p = &pbyval;
344 void *start = pbyval; 344 void *start = pbyval;
@@ -407,7 +407,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
407 size = sizeof(struct crush_bucket_straw2); 407 size = sizeof(struct crush_bucket_straw2);
408 break; 408 break;
409 default: 409 default:
410 err = -EINVAL;
411 goto bad; 410 goto bad;
412 } 411 }
413 BUG_ON(size == 0); 412 BUG_ON(size == 0);
@@ -439,31 +438,31 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
439 err = crush_decode_uniform_bucket(p, end, 438 err = crush_decode_uniform_bucket(p, end,
440 (struct crush_bucket_uniform *)b); 439 (struct crush_bucket_uniform *)b);
441 if (err < 0) 440 if (err < 0)
442 goto bad; 441 goto fail;
443 break; 442 break;
444 case CRUSH_BUCKET_LIST: 443 case CRUSH_BUCKET_LIST:
445 err = crush_decode_list_bucket(p, end, 444 err = crush_decode_list_bucket(p, end,
446 (struct crush_bucket_list *)b); 445 (struct crush_bucket_list *)b);
447 if (err < 0) 446 if (err < 0)
448 goto bad; 447 goto fail;
449 break; 448 break;
450 case CRUSH_BUCKET_TREE: 449 case CRUSH_BUCKET_TREE:
451 err = crush_decode_tree_bucket(p, end, 450 err = crush_decode_tree_bucket(p, end,
452 (struct crush_bucket_tree *)b); 451 (struct crush_bucket_tree *)b);
453 if (err < 0) 452 if (err < 0)
454 goto bad; 453 goto fail;
455 break; 454 break;
456 case CRUSH_BUCKET_STRAW: 455 case CRUSH_BUCKET_STRAW:
457 err = crush_decode_straw_bucket(p, end, 456 err = crush_decode_straw_bucket(p, end,
458 (struct crush_bucket_straw *)b); 457 (struct crush_bucket_straw *)b);
459 if (err < 0) 458 if (err < 0)
460 goto bad; 459 goto fail;
461 break; 460 break;
462 case CRUSH_BUCKET_STRAW2: 461 case CRUSH_BUCKET_STRAW2:
463 err = crush_decode_straw2_bucket(p, end, 462 err = crush_decode_straw2_bucket(p, end,
464 (struct crush_bucket_straw2 *)b); 463 (struct crush_bucket_straw2 *)b);
465 if (err < 0) 464 if (err < 0)
466 goto bad; 465 goto fail;
467 break; 466 break;
468 } 467 }
469 } 468 }
@@ -474,7 +473,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
474 u32 yes; 473 u32 yes;
475 struct crush_rule *r; 474 struct crush_rule *r;
476 475
477 err = -EINVAL;
478 ceph_decode_32_safe(p, end, yes, bad); 476 ceph_decode_32_safe(p, end, yes, bad);
479 if (!yes) { 477 if (!yes) {
480 dout("crush_decode NO rule %d off %x %p to %p\n", 478 dout("crush_decode NO rule %d off %x %p to %p\n",
@@ -489,7 +487,6 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
489 /* len */ 487 /* len */
490 ceph_decode_32_safe(p, end, yes, bad); 488 ceph_decode_32_safe(p, end, yes, bad);
491#if BITS_PER_LONG == 32 489#if BITS_PER_LONG == 32
492 err = -EINVAL;
493 if (yes > (ULONG_MAX - sizeof(*r)) 490 if (yes > (ULONG_MAX - sizeof(*r))
494 / sizeof(struct crush_rule_step)) 491 / sizeof(struct crush_rule_step))
495 goto bad; 492 goto bad;
@@ -557,7 +554,7 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
557 if (*p != end) { 554 if (*p != end) {
558 err = decode_choose_args(p, end, c); 555 err = decode_choose_args(p, end, c);
559 if (err) 556 if (err)
560 goto bad; 557 goto fail;
561 } 558 }
562 559
563done: 560done:
@@ -567,10 +564,14 @@ done:
567 564
568badmem: 565badmem:
569 err = -ENOMEM; 566 err = -ENOMEM;
570bad: 567fail:
571 dout("crush_decode fail %d\n", err); 568 dout("crush_decode fail %d\n", err);
572 crush_destroy(c); 569 crush_destroy(c);
573 return ERR_PTR(err); 570 return ERR_PTR(err);
571
572bad:
573 err = -EINVAL;
574 goto fail;
574} 575}
575 576
576int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs) 577int ceph_pg_compare(const struct ceph_pg *lhs, const struct ceph_pg *rhs)
@@ -1399,7 +1400,7 @@ static struct ceph_pg_mapping *__decode_pg_upmap_items(void **p, void *end,
1399 return ERR_PTR(-EINVAL); 1400 return ERR_PTR(-EINVAL);
1400 1401
1401 ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval); 1402 ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval);
1402 pg = kzalloc(sizeof(*pg) + 2 * len * sizeof(u32), GFP_NOIO); 1403 pg = alloc_pg_mapping(2 * len * sizeof(u32));
1403 if (!pg) 1404 if (!pg)
1404 return ERR_PTR(-ENOMEM); 1405 return ERR_PTR(-ENOMEM);
1405 1406
@@ -1544,7 +1545,7 @@ static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
1544 if (struct_v >= 3) { 1545 if (struct_v >= 3) {
1545 /* erasure_code_profiles */ 1546 /* erasure_code_profiles */
1546 ceph_decode_skip_map_of_map(p, end, string, string, string, 1547 ceph_decode_skip_map_of_map(p, end, string, string, string,
1547 bad); 1548 e_inval);
1548 } 1549 }
1549 1550
1550 if (struct_v >= 4) { 1551 if (struct_v >= 4) {
@@ -1825,9 +1826,9 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
1825 if (struct_v >= 3) { 1826 if (struct_v >= 3) {
1826 /* new_erasure_code_profiles */ 1827 /* new_erasure_code_profiles */
1827 ceph_decode_skip_map_of_map(p, end, string, string, string, 1828 ceph_decode_skip_map_of_map(p, end, string, string, string,
1828 bad); 1829 e_inval);
1829 /* old_erasure_code_profiles */ 1830 /* old_erasure_code_profiles */
1830 ceph_decode_skip_set(p, end, string, bad); 1831 ceph_decode_skip_set(p, end, string, e_inval);
1831 } 1832 }
1832 1833
1833 if (struct_v >= 4) { 1834 if (struct_v >= 4) {
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 82fd4c9c4a1b..06b147d7d9e2 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -28,6 +28,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
28 28
29 if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) 29 if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
30 return -EFAULT; 30 return -EFAULT;
31 ifr.ifr_name[IFNAMSIZ-1] = 0;
31 32
32 error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex); 33 error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex);
33 if (error) 34 if (error)
@@ -424,6 +425,8 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
424 if (copy_from_user(&iwr, arg, sizeof(iwr))) 425 if (copy_from_user(&iwr, arg, sizeof(iwr)))
425 return -EFAULT; 426 return -EFAULT;
426 427
428 iwr.ifr_name[sizeof(iwr.ifr_name) - 1] = 0;
429
427 return wext_handle_ioctl(net, &iwr, cmd, arg); 430 return wext_handle_ioctl(net, &iwr, cmd, arg);
428 } 431 }
429 432
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index a0093e1b0235..fdcb1bcd2afa 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -400,6 +400,7 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
400 err = -ENOMEM; 400 err = -ENOMEM;
401 goto errout; 401 goto errout;
402 } 402 }
403 refcount_set(&rule->refcnt, 1);
403 rule->fr_net = net; 404 rule->fr_net = net;
404 405
405 rule->pref = tb[FRA_PRIORITY] ? nla_get_u32(tb[FRA_PRIORITY]) 406 rule->pref = tb[FRA_PRIORITY] ? nla_get_u32(tb[FRA_PRIORITY])
@@ -517,8 +518,6 @@ int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
517 last = r; 518 last = r;
518 } 519 }
519 520
520 refcount_set(&rule->refcnt, 1);
521
522 if (last) 521 if (last)
523 list_add_rcu(&rule->list, &last->list); 522 list_add_rcu(&rule->list, &last->list);
524 else 523 else
diff --git a/net/core/filter.c b/net/core/filter.c
index c7f737058d89..f44fc22fd45a 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2248,7 +2248,7 @@ static int bpf_skb_adjust_net(struct sk_buff *skb, s32 len_diff)
2248 bpf_skb_net_grow(skb, len_diff_abs); 2248 bpf_skb_net_grow(skb, len_diff_abs);
2249 2249
2250 bpf_compute_data_end(skb); 2250 bpf_compute_data_end(skb);
2251 return 0; 2251 return ret;
2252} 2252}
2253 2253
2254BPF_CALL_4(bpf_skb_adjust_room, struct sk_buff *, skb, s32, len_diff, 2254BPF_CALL_4(bpf_skb_adjust_room, struct sk_buff *, skb, s32, len_diff,
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index d3408a693166..8357f164c660 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -277,7 +277,7 @@ static void zap_completion_queue(void)
277 struct sk_buff *skb = clist; 277 struct sk_buff *skb = clist;
278 clist = clist->next; 278 clist = clist->next;
279 if (!skb_irq_freeable(skb)) { 279 if (!skb_irq_freeable(skb)) {
280 refcount_inc(&skb->users); 280 refcount_set(&skb->users, 1);
281 dev_kfree_skb_any(skb); /* put this one back */ 281 dev_kfree_skb_any(skb); /* put this one back */
282 } else { 282 } else {
283 __kfree_skb(skb); 283 __kfree_skb(skb);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d1ba90980be1..9201e3621351 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2031,7 +2031,8 @@ static int do_setlink(const struct sk_buff *skb,
2031 struct sockaddr *sa; 2031 struct sockaddr *sa;
2032 int len; 2032 int len;
2033 2033
2034 len = sizeof(sa_family_t) + dev->addr_len; 2034 len = sizeof(sa_family_t) + max_t(size_t, dev->addr_len,
2035 sizeof(*sa));
2035 sa = kmalloc(len, GFP_KERNEL); 2036 sa = kmalloc(len, GFP_KERNEL);
2036 if (!sa) { 2037 if (!sa) {
2037 err = -ENOMEM; 2038 err = -ENOMEM;
@@ -4241,6 +4242,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
4241 4242
4242 switch (event) { 4243 switch (event) {
4243 case NETDEV_REBOOT: 4244 case NETDEV_REBOOT:
4245 case NETDEV_CHANGEADDR:
4244 case NETDEV_CHANGENAME: 4246 case NETDEV_CHANGENAME:
4245 case NETDEV_FEAT_CHANGE: 4247 case NETDEV_FEAT_CHANGE:
4246 case NETDEV_BONDING_FAILOVER: 4248 case NETDEV_BONDING_FAILOVER:
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 4a05d7876850..fa6be9750bb4 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -126,7 +126,7 @@ static int dccp_rcv_closereq(struct sock *sk, struct sk_buff *skb)
126 126
127static u16 dccp_reset_code_convert(const u8 code) 127static u16 dccp_reset_code_convert(const u8 code)
128{ 128{
129 const u16 error_code[] = { 129 static const u16 error_code[] = {
130 [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */ 130 [DCCP_RESET_CODE_CLOSED] = 0, /* normal termination */
131 [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */ 131 [DCCP_RESET_CODE_UNSPECIFIED] = 0, /* nothing known */
132 [DCCP_RESET_CODE_ABORTED] = ECONNRESET, 132 [DCCP_RESET_CODE_ABORTED] = ECONNRESET,
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4e678fa892dd..044d2a159a3c 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1334,13 +1334,14 @@ static struct pernet_operations fib_net_ops = {
1334 1334
1335void __init ip_fib_init(void) 1335void __init ip_fib_init(void)
1336{ 1336{
1337 rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL, NULL); 1337 fib_trie_init();
1338 rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL, NULL);
1339 rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib, NULL);
1340 1338
1341 register_pernet_subsys(&fib_net_ops); 1339 register_pernet_subsys(&fib_net_ops);
1340
1342 register_netdevice_notifier(&fib_netdev_notifier); 1341 register_netdevice_notifier(&fib_netdev_notifier);
1343 register_inetaddr_notifier(&fib_inetaddr_notifier); 1342 register_inetaddr_notifier(&fib_inetaddr_notifier);
1344 1343
1345 fib_trie_init(); 1344 rtnl_register(PF_INET, RTM_NEWROUTE, inet_rtm_newroute, NULL, NULL);
1345 rtnl_register(PF_INET, RTM_DELROUTE, inet_rtm_delroute, NULL, NULL);
1346 rtnl_register(PF_INET, RTM_GETROUTE, NULL, inet_dump_fib, NULL);
1346} 1347}
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 7eb252dcecee..50c74cd890bc 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -599,6 +599,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
599 hlen = iph->ihl * 4; 599 hlen = iph->ihl * 4;
600 mtu = mtu - hlen; /* Size of data space */ 600 mtu = mtu - hlen; /* Size of data space */
601 IPCB(skb)->flags |= IPSKB_FRAG_COMPLETE; 601 IPCB(skb)->flags |= IPSKB_FRAG_COMPLETE;
602 ll_rs = LL_RESERVED_SPACE(rt->dst.dev);
602 603
603 /* When frag_list is given, use it. First, check its validity: 604 /* When frag_list is given, use it. First, check its validity:
604 * some transformers could create wrong frag_list or break existing 605 * some transformers could create wrong frag_list or break existing
@@ -614,14 +615,15 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
614 if (first_len - hlen > mtu || 615 if (first_len - hlen > mtu ||
615 ((first_len - hlen) & 7) || 616 ((first_len - hlen) & 7) ||
616 ip_is_fragment(iph) || 617 ip_is_fragment(iph) ||
617 skb_cloned(skb)) 618 skb_cloned(skb) ||
619 skb_headroom(skb) < ll_rs)
618 goto slow_path; 620 goto slow_path;
619 621
620 skb_walk_frags(skb, frag) { 622 skb_walk_frags(skb, frag) {
621 /* Correct geometry. */ 623 /* Correct geometry. */
622 if (frag->len > mtu || 624 if (frag->len > mtu ||
623 ((frag->len & 7) && frag->next) || 625 ((frag->len & 7) && frag->next) ||
624 skb_headroom(frag) < hlen) 626 skb_headroom(frag) < hlen + ll_rs)
625 goto slow_path_clean; 627 goto slow_path_clean;
626 628
627 /* Partially cloned skb? */ 629 /* Partially cloned skb? */
@@ -711,8 +713,6 @@ slow_path:
711 left = skb->len - hlen; /* Space per frame */ 713 left = skb->len - hlen; /* Space per frame */
712 ptr = hlen; /* Where to start from */ 714 ptr = hlen; /* Where to start from */
713 715
714 ll_rs = LL_RESERVED_SPACE(rt->dst.dev);
715
716 /* 716 /*
717 * Fragment the datagram. 717 * Fragment the datagram.
718 */ 718 */
diff --git a/net/ipv4/netfilter/nf_tables_arp.c b/net/ipv4/netfilter/nf_tables_arp.c
index 805c8ddfe860..4bbc273b45e8 100644
--- a/net/ipv4/netfilter/nf_tables_arp.c
+++ b/net/ipv4/netfilter/nf_tables_arp.c
@@ -72,8 +72,7 @@ static const struct nf_chain_type filter_arp = {
72 .family = NFPROTO_ARP, 72 .family = NFPROTO_ARP,
73 .owner = THIS_MODULE, 73 .owner = THIS_MODULE,
74 .hook_mask = (1 << NF_ARP_IN) | 74 .hook_mask = (1 << NF_ARP_IN) |
75 (1 << NF_ARP_OUT) | 75 (1 << NF_ARP_OUT),
76 (1 << NF_ARP_FORWARD),
77}; 76};
78 77
79static int __init nf_tables_arp_init(void) 78static int __init nf_tables_arp_init(void)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 0905cf04c2a4..03ad8778c395 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -335,6 +335,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
335 treq->rcv_isn = ntohl(th->seq) - 1; 335 treq->rcv_isn = ntohl(th->seq) - 1;
336 treq->snt_isn = cookie; 336 treq->snt_isn = cookie;
337 treq->ts_off = 0; 337 treq->ts_off = 0;
338 treq->txhash = net_tx_rndhash();
338 req->mss = mss; 339 req->mss = mss;
339 ireq->ir_num = ntohs(th->dest); 340 ireq->ir_num = ntohs(th->dest);
340 ireq->ir_rmt_port = th->source; 341 ireq->ir_rmt_port = th->source;
diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
index dbcc9352a48f..69ee877574d0 100644
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
@@ -112,7 +112,8 @@ struct bbr {
112 cwnd_gain:10, /* current gain for setting cwnd */ 112 cwnd_gain:10, /* current gain for setting cwnd */
113 full_bw_cnt:3, /* number of rounds without large bw gains */ 113 full_bw_cnt:3, /* number of rounds without large bw gains */
114 cycle_idx:3, /* current index in pacing_gain cycle array */ 114 cycle_idx:3, /* current index in pacing_gain cycle array */
115 unused_b:6; 115 has_seen_rtt:1, /* have we seen an RTT sample yet? */
116 unused_b:5;
116 u32 prior_cwnd; /* prior cwnd upon entering loss recovery */ 117 u32 prior_cwnd; /* prior cwnd upon entering loss recovery */
117 u32 full_bw; /* recent bw, to estimate if pipe is full */ 118 u32 full_bw; /* recent bw, to estimate if pipe is full */
118}; 119};
@@ -211,6 +212,35 @@ static u64 bbr_rate_bytes_per_sec(struct sock *sk, u64 rate, int gain)
211 return rate >> BW_SCALE; 212 return rate >> BW_SCALE;
212} 213}
213 214
215/* Convert a BBR bw and gain factor to a pacing rate in bytes per second. */
216static u32 bbr_bw_to_pacing_rate(struct sock *sk, u32 bw, int gain)
217{
218 u64 rate = bw;
219
220 rate = bbr_rate_bytes_per_sec(sk, rate, gain);
221 rate = min_t(u64, rate, sk->sk_max_pacing_rate);
222 return rate;
223}
224
225/* Initialize pacing rate to: high_gain * init_cwnd / RTT. */
226static void bbr_init_pacing_rate_from_rtt(struct sock *sk)
227{
228 struct tcp_sock *tp = tcp_sk(sk);
229 struct bbr *bbr = inet_csk_ca(sk);
230 u64 bw;
231 u32 rtt_us;
232
233 if (tp->srtt_us) { /* any RTT sample yet? */
234 rtt_us = max(tp->srtt_us >> 3, 1U);
235 bbr->has_seen_rtt = 1;
236 } else { /* no RTT sample yet */
237 rtt_us = USEC_PER_MSEC; /* use nominal default RTT */
238 }
239 bw = (u64)tp->snd_cwnd * BW_UNIT;
240 do_div(bw, rtt_us);
241 sk->sk_pacing_rate = bbr_bw_to_pacing_rate(sk, bw, bbr_high_gain);
242}
243
214/* Pace using current bw estimate and a gain factor. In order to help drive the 244/* Pace using current bw estimate and a gain factor. In order to help drive the
215 * network toward lower queues while maintaining high utilization and low 245 * network toward lower queues while maintaining high utilization and low
216 * latency, the average pacing rate aims to be slightly (~1%) lower than the 246 * latency, the average pacing rate aims to be slightly (~1%) lower than the
@@ -220,12 +250,13 @@ static u64 bbr_rate_bytes_per_sec(struct sock *sk, u64 rate, int gain)
220 */ 250 */
221static void bbr_set_pacing_rate(struct sock *sk, u32 bw, int gain) 251static void bbr_set_pacing_rate(struct sock *sk, u32 bw, int gain)
222{ 252{
253 struct tcp_sock *tp = tcp_sk(sk);
223 struct bbr *bbr = inet_csk_ca(sk); 254 struct bbr *bbr = inet_csk_ca(sk);
224 u64 rate = bw; 255 u32 rate = bbr_bw_to_pacing_rate(sk, bw, gain);
225 256
226 rate = bbr_rate_bytes_per_sec(sk, rate, gain); 257 if (unlikely(!bbr->has_seen_rtt && tp->srtt_us))
227 rate = min_t(u64, rate, sk->sk_max_pacing_rate); 258 bbr_init_pacing_rate_from_rtt(sk);
228 if (bbr->mode != BBR_STARTUP || rate > sk->sk_pacing_rate) 259 if (bbr_full_bw_reached(sk) || rate > sk->sk_pacing_rate)
229 sk->sk_pacing_rate = rate; 260 sk->sk_pacing_rate = rate;
230} 261}
231 262
@@ -798,7 +829,6 @@ static void bbr_init(struct sock *sk)
798{ 829{
799 struct tcp_sock *tp = tcp_sk(sk); 830 struct tcp_sock *tp = tcp_sk(sk);
800 struct bbr *bbr = inet_csk_ca(sk); 831 struct bbr *bbr = inet_csk_ca(sk);
801 u64 bw;
802 832
803 bbr->prior_cwnd = 0; 833 bbr->prior_cwnd = 0;
804 bbr->tso_segs_goal = 0; /* default segs per skb until first ACK */ 834 bbr->tso_segs_goal = 0; /* default segs per skb until first ACK */
@@ -814,11 +844,8 @@ static void bbr_init(struct sock *sk)
814 844
815 minmax_reset(&bbr->bw, bbr->rtt_cnt, 0); /* init max bw to 0 */ 845 minmax_reset(&bbr->bw, bbr->rtt_cnt, 0); /* init max bw to 0 */
816 846
817 /* Initialize pacing rate to: high_gain * init_cwnd / RTT. */ 847 bbr->has_seen_rtt = 0;
818 bw = (u64)tp->snd_cwnd * BW_UNIT; 848 bbr_init_pacing_rate_from_rtt(sk);
819 do_div(bw, (tp->srtt_us >> 3) ? : USEC_PER_MSEC);
820 sk->sk_pacing_rate = 0; /* force an update of sk_pacing_rate */
821 bbr_set_pacing_rate(sk, bw, bbr_high_gain);
822 849
823 bbr->restore_cwnd = 0; 850 bbr->restore_cwnd = 0;
824 bbr->round_start = 0; 851 bbr->round_start = 0;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 25294d43e147..b057653ceca9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1388,6 +1388,11 @@ void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len)
1388 unlock_sock_fast(sk, slow); 1388 unlock_sock_fast(sk, slow);
1389 } 1389 }
1390 1390
1391 /* we cleared the head states previously only if the skb lacks any IP
1392 * options, see __udp_queue_rcv_skb().
1393 */
1394 if (unlikely(IPCB(skb)->opt.optlen > 0))
1395 skb_release_head_state(skb);
1391 consume_stateless_skb(skb); 1396 consume_stateless_skb(skb);
1392} 1397}
1393EXPORT_SYMBOL_GPL(skb_consume_udp); 1398EXPORT_SYMBOL_GPL(skb_consume_udp);
@@ -1779,8 +1784,12 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1779 sk_mark_napi_id_once(sk, skb); 1784 sk_mark_napi_id_once(sk, skb);
1780 } 1785 }
1781 1786
1782 /* clear all pending head states while they are hot in the cache */ 1787 /* At recvmsg() time we need skb->dst to process IP options-related
1783 skb_release_head_state(skb); 1788 * cmsg, elsewhere can we clear all pending head states while they are
1789 * hot in the cache
1790 */
1791 if (likely(IPCB(skb)->opt.optlen == 0))
1792 skb_release_head_state(skb);
1784 1793
1785 rc = __udp_enqueue_schedule_skb(sk, skb); 1794 rc = __udp_enqueue_schedule_skb(sk, skb);
1786 if (rc < 0) { 1795 if (rc < 0) {
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
index e9065b8d3af8..abb2c307fbe8 100644
--- a/net/ipv6/output_core.c
+++ b/net/ipv6/output_core.c
@@ -78,7 +78,7 @@ EXPORT_SYMBOL(ipv6_select_ident);
78 78
79int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) 79int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
80{ 80{
81 u16 offset = sizeof(struct ipv6hdr); 81 unsigned int offset = sizeof(struct ipv6hdr);
82 unsigned int packet_len = skb_tail_pointer(skb) - 82 unsigned int packet_len = skb_tail_pointer(skb) -
83 skb_network_header(skb); 83 skb_network_header(skb);
84 int found_rhdr = 0; 84 int found_rhdr = 0;
@@ -86,6 +86,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
86 86
87 while (offset <= packet_len) { 87 while (offset <= packet_len) {
88 struct ipv6_opt_hdr *exthdr; 88 struct ipv6_opt_hdr *exthdr;
89 unsigned int len;
89 90
90 switch (**nexthdr) { 91 switch (**nexthdr) {
91 92
@@ -111,7 +112,10 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
111 112
112 exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) + 113 exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) +
113 offset); 114 offset);
114 offset += ipv6_optlen(exthdr); 115 len = ipv6_optlen(exthdr);
116 if (len + offset >= IPV6_MAXPLEN)
117 return -EINVAL;
118 offset += len;
115 *nexthdr = &exthdr->nexthdr; 119 *nexthdr = &exthdr->nexthdr;
116 } 120 }
117 121
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 7b75b0620730..4e7817abc0b9 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -216,6 +216,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
216 treq->rcv_isn = ntohl(th->seq) - 1; 216 treq->rcv_isn = ntohl(th->seq) - 1;
217 treq->snt_isn = cookie; 217 treq->snt_isn = cookie;
218 treq->ts_off = 0; 218 treq->ts_off = 0;
219 treq->txhash = net_tx_rndhash();
219 220
220 /* 221 /*
221 * We need to lookup the dst_entry to get the correct window size. 222 * We need to lookup the dst_entry to get the correct window size.
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 552d606e57ca..974cf2a3795a 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -227,114 +227,6 @@ void nf_unregister_net_hooks(struct net *net, const struct nf_hook_ops *reg,
227} 227}
228EXPORT_SYMBOL(nf_unregister_net_hooks); 228EXPORT_SYMBOL(nf_unregister_net_hooks);
229 229
230static LIST_HEAD(nf_hook_list);
231
232static int _nf_register_hook(struct nf_hook_ops *reg)
233{
234 struct net *net, *last;
235 int ret;
236
237 for_each_net(net) {
238 ret = nf_register_net_hook(net, reg);
239 if (ret && ret != -ENOENT)
240 goto rollback;
241 }
242 list_add_tail(&reg->list, &nf_hook_list);
243
244 return 0;
245rollback:
246 last = net;
247 for_each_net(net) {
248 if (net == last)
249 break;
250 nf_unregister_net_hook(net, reg);
251 }
252 return ret;
253}
254
255int nf_register_hook(struct nf_hook_ops *reg)
256{
257 int ret;
258
259 rtnl_lock();
260 ret = _nf_register_hook(reg);
261 rtnl_unlock();
262
263 return ret;
264}
265EXPORT_SYMBOL(nf_register_hook);
266
267static void _nf_unregister_hook(struct nf_hook_ops *reg)
268{
269 struct net *net;
270
271 list_del(&reg->list);
272 for_each_net(net)
273 nf_unregister_net_hook(net, reg);
274}
275
276void nf_unregister_hook(struct nf_hook_ops *reg)
277{
278 rtnl_lock();
279 _nf_unregister_hook(reg);
280 rtnl_unlock();
281}
282EXPORT_SYMBOL(nf_unregister_hook);
283
284int nf_register_hooks(struct nf_hook_ops *reg, unsigned int n)
285{
286 unsigned int i;
287 int err = 0;
288
289 for (i = 0; i < n; i++) {
290 err = nf_register_hook(&reg[i]);
291 if (err)
292 goto err;
293 }
294 return err;
295
296err:
297 if (i > 0)
298 nf_unregister_hooks(reg, i);
299 return err;
300}
301EXPORT_SYMBOL(nf_register_hooks);
302
303/* Caller MUST take rtnl_lock() */
304int _nf_register_hooks(struct nf_hook_ops *reg, unsigned int n)
305{
306 unsigned int i;
307 int err = 0;
308
309 for (i = 0; i < n; i++) {
310 err = _nf_register_hook(&reg[i]);
311 if (err)
312 goto err;
313 }
314 return err;
315
316err:
317 if (i > 0)
318 _nf_unregister_hooks(reg, i);
319 return err;
320}
321EXPORT_SYMBOL(_nf_register_hooks);
322
323void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n)
324{
325 while (n-- > 0)
326 nf_unregister_hook(&reg[n]);
327}
328EXPORT_SYMBOL(nf_unregister_hooks);
329
330/* Caller MUST take rtnl_lock */
331void _nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n)
332{
333 while (n-- > 0)
334 _nf_unregister_hook(&reg[n]);
335}
336EXPORT_SYMBOL(_nf_unregister_hooks);
337
338/* Returns 1 if okfn() needs to be executed by the caller, 230/* Returns 1 if okfn() needs to be executed by the caller,
339 * -EPERM for NF_DROP, 0 otherwise. Caller must hold rcu_read_lock. */ 231 * -EPERM for NF_DROP, 0 otherwise. Caller must hold rcu_read_lock. */
340int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state, 232int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state,
@@ -450,40 +342,9 @@ void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *);
450EXPORT_SYMBOL(nf_nat_decode_session_hook); 342EXPORT_SYMBOL(nf_nat_decode_session_hook);
451#endif 343#endif
452 344
453static int nf_register_hook_list(struct net *net)
454{
455 struct nf_hook_ops *elem;
456 int ret;
457
458 rtnl_lock();
459 list_for_each_entry(elem, &nf_hook_list, list) {
460 ret = nf_register_net_hook(net, elem);
461 if (ret && ret != -ENOENT)
462 goto out_undo;
463 }
464 rtnl_unlock();
465 return 0;
466
467out_undo:
468 list_for_each_entry_continue_reverse(elem, &nf_hook_list, list)
469 nf_unregister_net_hook(net, elem);
470 rtnl_unlock();
471 return ret;
472}
473
474static void nf_unregister_hook_list(struct net *net)
475{
476 struct nf_hook_ops *elem;
477
478 rtnl_lock();
479 list_for_each_entry(elem, &nf_hook_list, list)
480 nf_unregister_net_hook(net, elem);
481 rtnl_unlock();
482}
483
484static int __net_init netfilter_net_init(struct net *net) 345static int __net_init netfilter_net_init(struct net *net)
485{ 346{
486 int i, h, ret; 347 int i, h;
487 348
488 for (i = 0; i < ARRAY_SIZE(net->nf.hooks); i++) { 349 for (i = 0; i < ARRAY_SIZE(net->nf.hooks); i++) {
489 for (h = 0; h < NF_MAX_HOOKS; h++) 350 for (h = 0; h < NF_MAX_HOOKS; h++)
@@ -500,16 +361,12 @@ static int __net_init netfilter_net_init(struct net *net)
500 return -ENOMEM; 361 return -ENOMEM;
501 } 362 }
502#endif 363#endif
503 ret = nf_register_hook_list(net);
504 if (ret)
505 remove_proc_entry("netfilter", net->proc_net);
506 364
507 return ret; 365 return 0;
508} 366}
509 367
510static void __net_exit netfilter_net_exit(struct net *net) 368static void __net_exit netfilter_net_exit(struct net *net)
511{ 369{
512 nf_unregister_hook_list(net);
513 remove_proc_entry("netfilter", net->proc_net); 370 remove_proc_entry("netfilter", net->proc_net);
514} 371}
515 372
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index e03d16ed550d..899c2c36da13 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -422,7 +422,7 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect)
422 h = nf_ct_expect_dst_hash(net, &expect->tuple); 422 h = nf_ct_expect_dst_hash(net, &expect->tuple);
423 hlist_for_each_entry_safe(i, next, &nf_ct_expect_hash[h], hnode) { 423 hlist_for_each_entry_safe(i, next, &nf_ct_expect_hash[h], hnode) {
424 if (expect_matches(i, expect)) { 424 if (expect_matches(i, expect)) {
425 if (nf_ct_remove_expect(expect)) 425 if (nf_ct_remove_expect(i))
426 break; 426 break;
427 } else if (expect_clash(i, expect)) { 427 } else if (expect_clash(i, expect)) {
428 ret = -EBUSY; 428 ret = -EBUSY;
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 832c5a08d9a5..eb541786ccb7 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -222,20 +222,21 @@ find_appropriate_src(struct net *net,
222 .tuple = tuple, 222 .tuple = tuple,
223 .zone = zone 223 .zone = zone
224 }; 224 };
225 struct rhlist_head *hl; 225 struct rhlist_head *hl, *h;
226 226
227 hl = rhltable_lookup(&nf_nat_bysource_table, &key, 227 hl = rhltable_lookup(&nf_nat_bysource_table, &key,
228 nf_nat_bysource_params); 228 nf_nat_bysource_params);
229 if (!hl)
230 return 0;
231 229
232 ct = container_of(hl, typeof(*ct), nat_bysource); 230 rhl_for_each_entry_rcu(ct, h, hl, nat_bysource) {
231 nf_ct_invert_tuplepr(result,
232 &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
233 result->dst = tuple->dst;
233 234
234 nf_ct_invert_tuplepr(result, 235 if (in_range(l3proto, l4proto, result, range))
235 &ct->tuplehash[IP_CT_DIR_REPLY].tuple); 236 return 1;
236 result->dst = tuple->dst; 237 }
237 238
238 return in_range(l3proto, l4proto, result, range); 239 return 0;
239} 240}
240 241
241/* For [FUTURE] fragmentation handling, we want the least-used 242/* For [FUTURE] fragmentation handling, we want the least-used
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 92b05e188fd1..733d3e4a30d8 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -472,8 +472,7 @@ static void nfnetlink_rcv_skb_batch(struct sk_buff *skb, struct nlmsghdr *nlh)
472 if (msglen > skb->len) 472 if (msglen > skb->len)
473 msglen = skb->len; 473 msglen = skb->len;
474 474
475 if (nlh->nlmsg_len < NLMSG_HDRLEN || 475 if (skb->len < NLMSG_HDRLEN + sizeof(struct nfgenmsg))
476 skb->len < NLMSG_HDRLEN + sizeof(struct nfgenmsg))
477 return; 476 return;
478 477
479 err = nla_parse(cda, NFNL_BATCH_MAX, attr, attrlen, nfnl_batch_policy, 478 err = nla_parse(cda, NFNL_BATCH_MAX, attr, attrlen, nfnl_batch_policy,
@@ -500,7 +499,8 @@ static void nfnetlink_rcv(struct sk_buff *skb)
500{ 499{
501 struct nlmsghdr *nlh = nlmsg_hdr(skb); 500 struct nlmsghdr *nlh = nlmsg_hdr(skb);
502 501
503 if (nlh->nlmsg_len < NLMSG_HDRLEN || 502 if (skb->len < NLMSG_HDRLEN ||
503 nlh->nlmsg_len < NLMSG_HDRLEN ||
504 skb->len < nlh->nlmsg_len) 504 skb->len < nlh->nlmsg_len)
505 return; 505 return;
506 506
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c
index 08679ebb3068..e3c4c6c3fef7 100644
--- a/net/openvswitch/conntrack.c
+++ b/net/openvswitch/conntrack.c
@@ -629,6 +629,34 @@ ovs_ct_find_existing(struct net *net, const struct nf_conntrack_zone *zone,
629 return ct; 629 return ct;
630} 630}
631 631
632static
633struct nf_conn *ovs_ct_executed(struct net *net,
634 const struct sw_flow_key *key,
635 const struct ovs_conntrack_info *info,
636 struct sk_buff *skb,
637 bool *ct_executed)
638{
639 struct nf_conn *ct = NULL;
640
641 /* If no ct, check if we have evidence that an existing conntrack entry
642 * might be found for this skb. This happens when we lose a skb->_nfct
643 * due to an upcall, or if the direction is being forced. If the
644 * connection was not confirmed, it is not cached and needs to be run
645 * through conntrack again.
646 */
647 *ct_executed = (key->ct_state & OVS_CS_F_TRACKED) &&
648 !(key->ct_state & OVS_CS_F_INVALID) &&
649 (key->ct_zone == info->zone.id);
650
651 if (*ct_executed || (!key->ct_state && info->force)) {
652 ct = ovs_ct_find_existing(net, &info->zone, info->family, skb,
653 !!(key->ct_state &
654 OVS_CS_F_NAT_MASK));
655 }
656
657 return ct;
658}
659
632/* Determine whether skb->_nfct is equal to the result of conntrack lookup. */ 660/* Determine whether skb->_nfct is equal to the result of conntrack lookup. */
633static bool skb_nfct_cached(struct net *net, 661static bool skb_nfct_cached(struct net *net,
634 const struct sw_flow_key *key, 662 const struct sw_flow_key *key,
@@ -637,24 +665,17 @@ static bool skb_nfct_cached(struct net *net,
637{ 665{
638 enum ip_conntrack_info ctinfo; 666 enum ip_conntrack_info ctinfo;
639 struct nf_conn *ct; 667 struct nf_conn *ct;
668 bool ct_executed = true;
640 669
641 ct = nf_ct_get(skb, &ctinfo); 670 ct = nf_ct_get(skb, &ctinfo);
642 /* If no ct, check if we have evidence that an existing conntrack entry
643 * might be found for this skb. This happens when we lose a skb->_nfct
644 * due to an upcall. If the connection was not confirmed, it is not
645 * cached and needs to be run through conntrack again.
646 */
647 if (!ct && key->ct_state & OVS_CS_F_TRACKED &&
648 !(key->ct_state & OVS_CS_F_INVALID) &&
649 key->ct_zone == info->zone.id) {
650 ct = ovs_ct_find_existing(net, &info->zone, info->family, skb,
651 !!(key->ct_state
652 & OVS_CS_F_NAT_MASK));
653 if (ct)
654 nf_ct_get(skb, &ctinfo);
655 }
656 if (!ct) 671 if (!ct)
672 ct = ovs_ct_executed(net, key, info, skb, &ct_executed);
673
674 if (ct)
675 nf_ct_get(skb, &ctinfo);
676 else
657 return false; 677 return false;
678
658 if (!net_eq(net, read_pnet(&ct->ct_net))) 679 if (!net_eq(net, read_pnet(&ct->ct_net)))
659 return false; 680 return false;
660 if (!nf_ct_zone_equal_any(info->ct, nf_ct_zone(ct))) 681 if (!nf_ct_zone_equal_any(info->ct, nf_ct_zone(ct)))
@@ -679,7 +700,7 @@ static bool skb_nfct_cached(struct net *net,
679 return false; 700 return false;
680 } 701 }
681 702
682 return true; 703 return ct_executed;
683} 704}
684 705
685#ifdef CONFIG_NF_NAT_NEEDED 706#ifdef CONFIG_NF_NAT_NEEDED
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e3beb28203eb..008bb34ee324 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -214,6 +214,7 @@ static void prb_clear_rxhash(struct tpacket_kbdq_core *,
214static void prb_fill_vlan_info(struct tpacket_kbdq_core *, 214static void prb_fill_vlan_info(struct tpacket_kbdq_core *,
215 struct tpacket3_hdr *); 215 struct tpacket3_hdr *);
216static void packet_flush_mclist(struct sock *sk); 216static void packet_flush_mclist(struct sock *sk);
217static void packet_pick_tx_queue(struct net_device *dev, struct sk_buff *skb);
217 218
218struct packet_skb_cb { 219struct packet_skb_cb {
219 union { 220 union {
@@ -260,6 +261,7 @@ static int packet_direct_xmit(struct sk_buff *skb)
260 if (skb != orig_skb) 261 if (skb != orig_skb)
261 goto drop; 262 goto drop;
262 263
264 packet_pick_tx_queue(dev, skb);
263 txq = skb_get_tx_queue(dev, skb); 265 txq = skb_get_tx_queue(dev, skb);
264 266
265 local_bh_disable(); 267 local_bh_disable();
@@ -2747,8 +2749,6 @@ tpacket_error:
2747 goto tpacket_error; 2749 goto tpacket_error;
2748 } 2750 }
2749 2751
2750 packet_pick_tx_queue(dev, skb);
2751
2752 skb->destructor = tpacket_destruct_skb; 2752 skb->destructor = tpacket_destruct_skb;
2753 __packet_set_status(po, ph, TP_STATUS_SENDING); 2753 __packet_set_status(po, ph, TP_STATUS_SENDING);
2754 packet_inc_pending(&po->tx_ring); 2754 packet_inc_pending(&po->tx_ring);
@@ -2931,8 +2931,6 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
2931 skb->priority = sk->sk_priority; 2931 skb->priority = sk->sk_priority;
2932 skb->mark = sockc.mark; 2932 skb->mark = sockc.mark;
2933 2933
2934 packet_pick_tx_queue(dev, skb);
2935
2936 if (po->has_vnet_hdr) { 2934 if (po->has_vnet_hdr) {
2937 err = virtio_net_hdr_to_skb(skb, &vnet_hdr, vio_le()); 2935 err = virtio_net_hdr_to_skb(skb, &vnet_hdr, vio_le());
2938 if (err) 2936 if (err)
diff --git a/net/rds/send.c b/net/rds/send.c
index e81aa176f4e2..41b9f0f5bb9c 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -170,8 +170,8 @@ restart:
170 * The acquire_in_xmit() check above ensures that only one 170 * The acquire_in_xmit() check above ensures that only one
171 * caller can increment c_send_gen at any time. 171 * caller can increment c_send_gen at any time.
172 */ 172 */
173 cp->cp_send_gen++; 173 send_gen = READ_ONCE(cp->cp_send_gen) + 1;
174 send_gen = cp->cp_send_gen; 174 WRITE_ONCE(cp->cp_send_gen, send_gen);
175 175
176 /* 176 /*
177 * rds_conn_shutdown() sets the conn state and then tests RDS_IN_XMIT, 177 * rds_conn_shutdown() sets the conn state and then tests RDS_IN_XMIT,
@@ -431,7 +431,7 @@ over_batch:
431 smp_mb(); 431 smp_mb();
432 if ((test_bit(0, &conn->c_map_queued) || 432 if ((test_bit(0, &conn->c_map_queued) ||
433 !list_empty(&cp->cp_send_queue)) && 433 !list_empty(&cp->cp_send_queue)) &&
434 send_gen == cp->cp_send_gen) { 434 send_gen == READ_ONCE(cp->cp_send_gen)) {
435 rds_stats_inc(s_send_lock_queue_raced); 435 rds_stats_inc(s_send_lock_queue_raced);
436 if (batch_count < send_batch_count) 436 if (batch_count < send_batch_count)
437 goto restart; 437 goto restart;
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index aed6cf2e9fd8..f2e9ed34a963 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -835,7 +835,7 @@ out_nlmsg_trim:
835} 835}
836 836
837static int 837static int
838act_get_notify(struct net *net, u32 portid, struct nlmsghdr *n, 838tcf_get_notify(struct net *net, u32 portid, struct nlmsghdr *n,
839 struct list_head *actions, int event) 839 struct list_head *actions, int event)
840{ 840{
841 struct sk_buff *skb; 841 struct sk_buff *skb;
@@ -1018,7 +1018,7 @@ tca_action_gd(struct net *net, struct nlattr *nla, struct nlmsghdr *n,
1018 } 1018 }
1019 1019
1020 if (event == RTM_GETACTION) 1020 if (event == RTM_GETACTION)
1021 ret = act_get_notify(net, portid, n, &actions, event); 1021 ret = tcf_get_notify(net, portid, n, &actions, event);
1022 else { /* delete */ 1022 else { /* delete */
1023 ret = tcf_del_notify(net, n, &actions, portid); 1023 ret = tcf_del_notify(net, n, &actions, portid);
1024 if (ret) 1024 if (ret)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 4e16b02ed832..6110447fe51d 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -228,7 +228,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
228 sctp_adaptation_ind_param_t aiparam; 228 sctp_adaptation_ind_param_t aiparam;
229 sctp_supported_ext_param_t ext_param; 229 sctp_supported_ext_param_t ext_param;
230 int num_ext = 0; 230 int num_ext = 0;
231 __u8 extensions[3]; 231 __u8 extensions[4];
232 struct sctp_paramhdr *auth_chunks = NULL, 232 struct sctp_paramhdr *auth_chunks = NULL,
233 *auth_hmacs = NULL; 233 *auth_hmacs = NULL;
234 234
@@ -396,7 +396,7 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
396 sctp_adaptation_ind_param_t aiparam; 396 sctp_adaptation_ind_param_t aiparam;
397 sctp_supported_ext_param_t ext_param; 397 sctp_supported_ext_param_t ext_param;
398 int num_ext = 0; 398 int num_ext = 0;
399 __u8 extensions[3]; 399 __u8 extensions[4];
400 struct sctp_paramhdr *auth_chunks = NULL, 400 struct sctp_paramhdr *auth_chunks = NULL,
401 *auth_hmacs = NULL, 401 *auth_hmacs = NULL,
402 *auth_random = NULL; 402 *auth_random = NULL;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index d5b54c020dec..4f154d388748 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1624,6 +1624,8 @@ static void xs_tcp_state_change(struct sock *sk)
1624 if (test_and_clear_bit(XPRT_SOCK_CONNECTING, 1624 if (test_and_clear_bit(XPRT_SOCK_CONNECTING,
1625 &transport->sock_state)) 1625 &transport->sock_state))
1626 xprt_clear_connecting(xprt); 1626 xprt_clear_connecting(xprt);
1627 if (sk->sk_err)
1628 xprt_wake_pending_tasks(xprt, -sk->sk_err);
1627 xs_sock_mark_closed(xprt); 1629 xs_sock_mark_closed(xprt);
1628 } 1630 }
1629 out: 1631 out:
diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff
index fb86f3899e16..f9a3d8d23c64 100755
--- a/scripts/dtc/dtx_diff
+++ b/scripts/dtc/dtx_diff
@@ -321,7 +321,7 @@ fi
321cpp_flags="\ 321cpp_flags="\
322 -nostdinc \ 322 -nostdinc \
323 -I${srctree}/arch/${ARCH}/boot/dts \ 323 -I${srctree}/arch/${ARCH}/boot/dts \
324 -I${srctree}/arch/${ARCH}/boot/dts/include \ 324 -I${srctree}/scripts/dtc/include-prefixes \
325 -I${srctree}/drivers/of/testcase-data \ 325 -I${srctree}/drivers/of/testcase-data \
326 -undef -D__DTS__" 326 -undef -D__DTS__"
327 327
diff --git a/scripts/parse-maintainers.pl b/scripts/parse-maintainers.pl
new file mode 100644
index 000000000000..a0fe34349b24
--- /dev/null
+++ b/scripts/parse-maintainers.pl
@@ -0,0 +1,77 @@
1#!/usr/bin/perl -w
2
3use strict;
4
5my %map;
6
7# sort comparison function
8sub by_category($$) {
9 my ($a, $b) = @_;
10
11 $a = uc $a;
12 $b = uc $b;
13
14 # This always sorts last
15 $a =~ s/THE REST/ZZZZZZ/g;
16 $b =~ s/THE REST/ZZZZZZ/g;
17
18 $a cmp $b;
19}
20
21sub alpha_output {
22 my $key;
23 my $sort_method = \&by_category;
24 my $sep = "";
25
26 foreach $key (sort $sort_method keys %map) {
27 if ($key ne " ") {
28 print $sep . $key . "\n";
29 $sep = "\n";
30 }
31 print $map{$key};
32 }
33}
34
35sub trim {
36 my $s = shift;
37 $s =~ s/\s+$//;
38 $s =~ s/^\s+//;
39 return $s;
40}
41
42sub file_input {
43 my $lastline = "";
44 my $case = " ";
45 $map{$case} = "";
46
47 while (<>) {
48 my $line = $_;
49
50 # Pattern line?
51 if ($line =~ m/^([A-Z]):\s*(.*)/) {
52 $line = $1 . ":\t" . trim($2) . "\n";
53 if ($lastline eq "") {
54 $map{$case} = $map{$case} . $line;
55 next;
56 }
57 $case = trim($lastline);
58 exists $map{$case} and die "Header '$case' already exists";
59 $map{$case} = $line;
60 $lastline = "";
61 next;
62 }
63
64 if ($case eq " ") {
65 $map{$case} = $map{$case} . $lastline;
66 $lastline = $line;
67 next;
68 }
69 trim($lastline) eq "" or die ("Odd non-pattern line '$lastline' for '$case'");
70 $lastline = $line;
71 }
72 $map{$case} = $map{$case} . $lastline;
73}
74
75&file_input;
76&alpha_output;
77exit(0);
diff --git a/security/keys/internal.h b/security/keys/internal.h
index 91bc6214ae57..1c02c6547038 100644
--- a/security/keys/internal.h
+++ b/security/keys/internal.h
@@ -198,7 +198,7 @@ struct request_key_auth {
198 void *callout_info; 198 void *callout_info;
199 size_t callout_len; 199 size_t callout_len;
200 pid_t pid; 200 pid_t pid;
201}; 201} __randomize_layout;
202 202
203extern struct key_type key_type_request_key_auth; 203extern struct key_type key_type_request_key_auth;
204extern struct key *request_key_auth_new(struct key *target, 204extern struct key *request_key_auth_new(struct key *target,
diff --git a/sound/core/control.c b/sound/core/control.c
index 3c6be1452e35..4525e127afd9 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1137,7 +1137,7 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol,
1137 mutex_lock(&ue->card->user_ctl_lock); 1137 mutex_lock(&ue->card->user_ctl_lock);
1138 change = ue->tlv_data_size != size; 1138 change = ue->tlv_data_size != size;
1139 if (!change) 1139 if (!change)
1140 change = memcmp(ue->tlv_data, new_data, size); 1140 change = memcmp(ue->tlv_data, new_data, size) != 0;
1141 kfree(ue->tlv_data); 1141 kfree(ue->tlv_data);
1142 ue->tlv_data = new_data; 1142 ue->tlv_data = new_data;
1143 ue->tlv_data_size = size; 1143 ue->tlv_data_size = size;
diff --git a/sound/core/seq/Kconfig b/sound/core/seq/Kconfig
index a536760a94c2..45c1336c6597 100644
--- a/sound/core/seq/Kconfig
+++ b/sound/core/seq/Kconfig
@@ -47,10 +47,10 @@ config SND_SEQ_HRTIMER_DEFAULT
47 timer. 47 timer.
48 48
49config SND_SEQ_MIDI_EVENT 49config SND_SEQ_MIDI_EVENT
50 def_tristate SND_RAWMIDI 50 tristate
51 51
52config SND_SEQ_MIDI 52config SND_SEQ_MIDI
53 tristate 53 def_tristate SND_RAWMIDI
54 select SND_SEQ_MIDI_EVENT 54 select SND_SEQ_MIDI_EVENT
55 55
56config SND_SEQ_MIDI_EMUL 56config SND_SEQ_MIDI_EMUL
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 272c55fe17c8..ea2d0ae85bd3 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1502,16 +1502,11 @@ static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client,
1502static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg) 1502static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg)
1503{ 1503{
1504 struct snd_seq_queue_info *info = arg; 1504 struct snd_seq_queue_info *info = arg;
1505 int result;
1506 struct snd_seq_queue *q; 1505 struct snd_seq_queue *q;
1507 1506
1508 result = snd_seq_queue_alloc(client->number, info->locked, info->flags); 1507 q = snd_seq_queue_alloc(client->number, info->locked, info->flags);
1509 if (result < 0) 1508 if (IS_ERR(q))
1510 return result; 1509 return PTR_ERR(q);
1511
1512 q = queueptr(result);
1513 if (q == NULL)
1514 return -EINVAL;
1515 1510
1516 info->queue = q->queue; 1511 info->queue = q->queue;
1517 info->locked = q->locked; 1512 info->locked = q->locked;
@@ -1521,7 +1516,7 @@ static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg)
1521 if (!info->name[0]) 1516 if (!info->name[0])
1522 snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue); 1517 snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue);
1523 strlcpy(q->name, info->name, sizeof(q->name)); 1518 strlcpy(q->name, info->name, sizeof(q->name));
1524 queuefree(q); 1519 snd_use_lock_free(&q->use_lock);
1525 1520
1526 return 0; 1521 return 0;
1527} 1522}
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 450c5187eecb..79e0c5604ef8 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -184,22 +184,26 @@ void __exit snd_seq_queues_delete(void)
184static void queue_use(struct snd_seq_queue *queue, int client, int use); 184static void queue_use(struct snd_seq_queue *queue, int client, int use);
185 185
186/* allocate a new queue - 186/* allocate a new queue -
187 * return queue index value or negative value for error 187 * return pointer to new queue or ERR_PTR(-errno) for error
188 * The new queue's use_lock is set to 1. It is the caller's responsibility to
189 * call snd_use_lock_free(&q->use_lock).
188 */ 190 */
189int snd_seq_queue_alloc(int client, int locked, unsigned int info_flags) 191struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int info_flags)
190{ 192{
191 struct snd_seq_queue *q; 193 struct snd_seq_queue *q;
192 194
193 q = queue_new(client, locked); 195 q = queue_new(client, locked);
194 if (q == NULL) 196 if (q == NULL)
195 return -ENOMEM; 197 return ERR_PTR(-ENOMEM);
196 q->info_flags = info_flags; 198 q->info_flags = info_flags;
197 queue_use(q, client, 1); 199 queue_use(q, client, 1);
200 snd_use_lock_use(&q->use_lock);
198 if (queue_list_add(q) < 0) { 201 if (queue_list_add(q) < 0) {
202 snd_use_lock_free(&q->use_lock);
199 queue_delete(q); 203 queue_delete(q);
200 return -ENOMEM; 204 return ERR_PTR(-ENOMEM);
201 } 205 }
202 return q->queue; 206 return q;
203} 207}
204 208
205/* delete a queue - queue must be owned by the client */ 209/* delete a queue - queue must be owned by the client */
diff --git a/sound/core/seq/seq_queue.h b/sound/core/seq/seq_queue.h
index 30c8111477f6..719093489a2c 100644
--- a/sound/core/seq/seq_queue.h
+++ b/sound/core/seq/seq_queue.h
@@ -71,7 +71,7 @@ void snd_seq_queues_delete(void);
71 71
72 72
73/* create new queue (constructor) */ 73/* create new queue (constructor) */
74int snd_seq_queue_alloc(int client, int locked, unsigned int flags); 74struct snd_seq_queue *snd_seq_queue_alloc(int client, int locked, unsigned int flags);
75 75
76/* delete queue (destructor) */ 76/* delete queue (destructor) */
77int snd_seq_queue_delete(int client, int queueid); 77int snd_seq_queue_delete(int client, int queueid);
diff --git a/sound/firewire/iso-resources.c b/sound/firewire/iso-resources.c
index f0e4d502d604..066b5df666f4 100644
--- a/sound/firewire/iso-resources.c
+++ b/sound/firewire/iso-resources.c
@@ -210,9 +210,14 @@ EXPORT_SYMBOL(fw_iso_resources_update);
210 */ 210 */
211void fw_iso_resources_free(struct fw_iso_resources *r) 211void fw_iso_resources_free(struct fw_iso_resources *r)
212{ 212{
213 struct fw_card *card = fw_parent_device(r->unit)->card; 213 struct fw_card *card;
214 int bandwidth, channel; 214 int bandwidth, channel;
215 215
216 /* Not initialized. */
217 if (r->unit == NULL)
218 return;
219 card = fw_parent_device(r->unit)->card;
220
216 mutex_lock(&r->mutex); 221 mutex_lock(&r->mutex);
217 222
218 if (r->allocated) { 223 if (r->allocated) {
diff --git a/sound/firewire/motu/motu.c b/sound/firewire/motu/motu.c
index bf779cfeef0d..59a270406353 100644
--- a/sound/firewire/motu/motu.c
+++ b/sound/firewire/motu/motu.c
@@ -128,6 +128,7 @@ static void do_registration(struct work_struct *work)
128 return; 128 return;
129error: 129error:
130 snd_motu_transaction_unregister(motu); 130 snd_motu_transaction_unregister(motu);
131 snd_motu_stream_destroy_duplex(motu);
131 snd_card_free(motu->card); 132 snd_card_free(motu->card);
132 dev_info(&motu->unit->device, 133 dev_info(&motu->unit->device,
133 "Sound card registration failed: %d\n", err); 134 "Sound card registration failed: %d\n", err);
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index dc585959ca32..a2b56b188be4 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -698,10 +698,18 @@ static int copy_gctl(struct snd_emu10k1 *emu,
698{ 698{
699 struct snd_emu10k1_fx8010_control_old_gpr __user *octl; 699 struct snd_emu10k1_fx8010_control_old_gpr __user *octl;
700 700
701 if (emu->support_tlv) 701 if (emu->support_tlv) {
702 return copy_from_user(gctl, &_gctl[idx], sizeof(*gctl)); 702 if (in_kernel)
703 memcpy(gctl, (void *)&_gctl[idx], sizeof(*gctl));
704 else if (copy_from_user(gctl, &_gctl[idx], sizeof(*gctl)))
705 return -EFAULT;
706 return 0;
707 }
708
703 octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl; 709 octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl;
704 if (copy_from_user(gctl, &octl[idx], sizeof(*octl))) 710 if (in_kernel)
711 memcpy(gctl, (void *)&octl[idx], sizeof(*octl));
712 else if (copy_from_user(gctl, &octl[idx], sizeof(*octl)))
705 return -EFAULT; 713 return -EFAULT;
706 gctl->tlv = NULL; 714 gctl->tlv = NULL;
707 return 0; 715 return 0;
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 2e402ece4c86..8e6b04b39dcc 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1235,8 +1235,6 @@ static int snd_fm801_create(struct snd_card *card,
1235 } 1235 }
1236 } 1236 }
1237 1237
1238 snd_fm801_chip_init(chip);
1239
1240 if ((chip->tea575x_tuner & TUNER_ONLY) == 0) { 1238 if ((chip->tea575x_tuner & TUNER_ONLY) == 0) {
1241 if (devm_request_irq(&pci->dev, pci->irq, snd_fm801_interrupt, 1239 if (devm_request_irq(&pci->dev, pci->irq, snd_fm801_interrupt,
1242 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1240 IRQF_SHARED, KBUILD_MODNAME, chip)) {
@@ -1248,6 +1246,8 @@ static int snd_fm801_create(struct snd_card *card,
1248 pci_set_master(pci); 1246 pci_set_master(pci);
1249 } 1247 }
1250 1248
1249 snd_fm801_chip_init(chip);
1250
1251 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { 1251 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
1252 snd_fm801_free(chip); 1252 snd_fm801_free(chip);
1253 return err; 1253 return err;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 63bc894ddf5e..a81aacf684b2 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -933,6 +933,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
933 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), 933 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE),
934 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), 934 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
935 SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), 935 SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
936 SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO),
936 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 937 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
937 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 938 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
938 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 939 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
@@ -946,6 +947,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
946 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), 947 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
947 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 948 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
948 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 949 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
950 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
949 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 951 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
950 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), 952 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
951 SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004), 953 SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index d549f35f39d3..53f9311370de 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -3733,11 +3733,15 @@ HDA_CODEC_ENTRY(0x1002aa01, "R6xx HDMI", patch_atihdmi),
3733HDA_CODEC_ENTRY(0x10951390, "SiI1390 HDMI", patch_generic_hdmi), 3733HDA_CODEC_ENTRY(0x10951390, "SiI1390 HDMI", patch_generic_hdmi),
3734HDA_CODEC_ENTRY(0x10951392, "SiI1392 HDMI", patch_generic_hdmi), 3734HDA_CODEC_ENTRY(0x10951392, "SiI1392 HDMI", patch_generic_hdmi),
3735HDA_CODEC_ENTRY(0x17e80047, "Chrontel HDMI", patch_generic_hdmi), 3735HDA_CODEC_ENTRY(0x17e80047, "Chrontel HDMI", patch_generic_hdmi),
3736HDA_CODEC_ENTRY(0x10de0001, "MCP73 HDMI", patch_nvhdmi_2ch),
3736HDA_CODEC_ENTRY(0x10de0002, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x), 3737HDA_CODEC_ENTRY(0x10de0002, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
3737HDA_CODEC_ENTRY(0x10de0003, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x), 3738HDA_CODEC_ENTRY(0x10de0003, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
3739HDA_CODEC_ENTRY(0x10de0004, "GPU 04 HDMI", patch_nvhdmi_8ch_7x),
3738HDA_CODEC_ENTRY(0x10de0005, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x), 3740HDA_CODEC_ENTRY(0x10de0005, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
3739HDA_CODEC_ENTRY(0x10de0006, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x), 3741HDA_CODEC_ENTRY(0x10de0006, "MCP77/78 HDMI", patch_nvhdmi_8ch_7x),
3740HDA_CODEC_ENTRY(0x10de0007, "MCP79/7A HDMI", patch_nvhdmi_8ch_7x), 3742HDA_CODEC_ENTRY(0x10de0007, "MCP79/7A HDMI", patch_nvhdmi_8ch_7x),
3743HDA_CODEC_ENTRY(0x10de0008, "GPU 08 HDMI/DP", patch_nvhdmi),
3744HDA_CODEC_ENTRY(0x10de0009, "GPU 09 HDMI/DP", patch_nvhdmi),
3741HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi), 3745HDA_CODEC_ENTRY(0x10de000a, "GPU 0a HDMI/DP", patch_nvhdmi),
3742HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi), 3746HDA_CODEC_ENTRY(0x10de000b, "GPU 0b HDMI/DP", patch_nvhdmi),
3743HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi), 3747HDA_CODEC_ENTRY(0x10de000c, "MCP89 HDMI", patch_nvhdmi),
@@ -3764,17 +3768,40 @@ HDA_CODEC_ENTRY(0x10de0041, "GPU 41 HDMI/DP", patch_nvhdmi),
3764HDA_CODEC_ENTRY(0x10de0042, "GPU 42 HDMI/DP", patch_nvhdmi), 3768HDA_CODEC_ENTRY(0x10de0042, "GPU 42 HDMI/DP", patch_nvhdmi),
3765HDA_CODEC_ENTRY(0x10de0043, "GPU 43 HDMI/DP", patch_nvhdmi), 3769HDA_CODEC_ENTRY(0x10de0043, "GPU 43 HDMI/DP", patch_nvhdmi),
3766HDA_CODEC_ENTRY(0x10de0044, "GPU 44 HDMI/DP", patch_nvhdmi), 3770HDA_CODEC_ENTRY(0x10de0044, "GPU 44 HDMI/DP", patch_nvhdmi),
3771HDA_CODEC_ENTRY(0x10de0045, "GPU 45 HDMI/DP", patch_nvhdmi),
3772HDA_CODEC_ENTRY(0x10de0050, "GPU 50 HDMI/DP", patch_nvhdmi),
3767HDA_CODEC_ENTRY(0x10de0051, "GPU 51 HDMI/DP", patch_nvhdmi), 3773HDA_CODEC_ENTRY(0x10de0051, "GPU 51 HDMI/DP", patch_nvhdmi),
3774HDA_CODEC_ENTRY(0x10de0052, "GPU 52 HDMI/DP", patch_nvhdmi),
3768HDA_CODEC_ENTRY(0x10de0060, "GPU 60 HDMI/DP", patch_nvhdmi), 3775HDA_CODEC_ENTRY(0x10de0060, "GPU 60 HDMI/DP", patch_nvhdmi),
3776HDA_CODEC_ENTRY(0x10de0061, "GPU 61 HDMI/DP", patch_nvhdmi),
3777HDA_CODEC_ENTRY(0x10de0062, "GPU 62 HDMI/DP", patch_nvhdmi),
3769HDA_CODEC_ENTRY(0x10de0067, "MCP67 HDMI", patch_nvhdmi_2ch), 3778HDA_CODEC_ENTRY(0x10de0067, "MCP67 HDMI", patch_nvhdmi_2ch),
3770HDA_CODEC_ENTRY(0x10de0070, "GPU 70 HDMI/DP", patch_nvhdmi), 3779HDA_CODEC_ENTRY(0x10de0070, "GPU 70 HDMI/DP", patch_nvhdmi),
3771HDA_CODEC_ENTRY(0x10de0071, "GPU 71 HDMI/DP", patch_nvhdmi), 3780HDA_CODEC_ENTRY(0x10de0071, "GPU 71 HDMI/DP", patch_nvhdmi),
3772HDA_CODEC_ENTRY(0x10de0072, "GPU 72 HDMI/DP", patch_nvhdmi), 3781HDA_CODEC_ENTRY(0x10de0072, "GPU 72 HDMI/DP", patch_nvhdmi),
3782HDA_CODEC_ENTRY(0x10de0073, "GPU 73 HDMI/DP", patch_nvhdmi),
3783HDA_CODEC_ENTRY(0x10de0074, "GPU 74 HDMI/DP", patch_nvhdmi),
3784HDA_CODEC_ENTRY(0x10de0076, "GPU 76 HDMI/DP", patch_nvhdmi),
3785HDA_CODEC_ENTRY(0x10de007b, "GPU 7b HDMI/DP", patch_nvhdmi),
3786HDA_CODEC_ENTRY(0x10de007c, "GPU 7c HDMI/DP", patch_nvhdmi),
3773HDA_CODEC_ENTRY(0x10de007d, "GPU 7d HDMI/DP", patch_nvhdmi), 3787HDA_CODEC_ENTRY(0x10de007d, "GPU 7d HDMI/DP", patch_nvhdmi),
3788HDA_CODEC_ENTRY(0x10de007e, "GPU 7e HDMI/DP", patch_nvhdmi),
3774HDA_CODEC_ENTRY(0x10de0080, "GPU 80 HDMI/DP", patch_nvhdmi), 3789HDA_CODEC_ENTRY(0x10de0080, "GPU 80 HDMI/DP", patch_nvhdmi),
3790HDA_CODEC_ENTRY(0x10de0081, "GPU 81 HDMI/DP", patch_nvhdmi),
3775HDA_CODEC_ENTRY(0x10de0082, "GPU 82 HDMI/DP", patch_nvhdmi), 3791HDA_CODEC_ENTRY(0x10de0082, "GPU 82 HDMI/DP", patch_nvhdmi),
3776HDA_CODEC_ENTRY(0x10de0083, "GPU 83 HDMI/DP", patch_nvhdmi), 3792HDA_CODEC_ENTRY(0x10de0083, "GPU 83 HDMI/DP", patch_nvhdmi),
3793HDA_CODEC_ENTRY(0x10de0084, "GPU 84 HDMI/DP", patch_nvhdmi),
3794HDA_CODEC_ENTRY(0x10de0090, "GPU 90 HDMI/DP", patch_nvhdmi),
3795HDA_CODEC_ENTRY(0x10de0091, "GPU 91 HDMI/DP", patch_nvhdmi),
3796HDA_CODEC_ENTRY(0x10de0092, "GPU 92 HDMI/DP", patch_nvhdmi),
3797HDA_CODEC_ENTRY(0x10de0093, "GPU 93 HDMI/DP", patch_nvhdmi),
3798HDA_CODEC_ENTRY(0x10de0094, "GPU 94 HDMI/DP", patch_nvhdmi),
3799HDA_CODEC_ENTRY(0x10de0095, "GPU 95 HDMI/DP", patch_nvhdmi),
3800HDA_CODEC_ENTRY(0x10de0097, "GPU 97 HDMI/DP", patch_nvhdmi),
3801HDA_CODEC_ENTRY(0x10de0098, "GPU 98 HDMI/DP", patch_nvhdmi),
3802HDA_CODEC_ENTRY(0x10de0099, "GPU 99 HDMI/DP", patch_nvhdmi),
3777HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI", patch_nvhdmi_2ch), 3803HDA_CODEC_ENTRY(0x10de8001, "MCP73 HDMI", patch_nvhdmi_2ch),
3804HDA_CODEC_ENTRY(0x10de8067, "MCP67/68 HDMI", patch_nvhdmi_2ch),
3778HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP", patch_via_hdmi), 3805HDA_CODEC_ENTRY(0x11069f80, "VX900 HDMI/DP", patch_via_hdmi),
3779HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP", patch_via_hdmi), 3806HDA_CODEC_ENTRY(0x11069f81, "VX900 HDMI/DP", patch_via_hdmi),
3780HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi), 3807HDA_CODEC_ENTRY(0x11069f84, "VX11 HDMI/DP", patch_generic_hdmi),
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 45d58fc1df39..217bb582aff1 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2296,6 +2296,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2296 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), 2296 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
2297 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), 2297 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
2298 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), 2298 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
2299 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
2299 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), 2300 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2300 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), 2301 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
2301 2302
@@ -3838,6 +3839,17 @@ static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3838 } 3839 }
3839} 3840}
3840 3841
3842static struct coef_fw alc225_pre_hsmode[] = {
3843 UPDATE_COEF(0x4a, 1<<8, 0),
3844 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3845 UPDATE_COEF(0x63, 3<<14, 3<<14),
3846 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3847 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3848 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3849 UPDATE_COEF(0x4a, 3<<10, 0),
3850 {}
3851};
3852
3841static void alc_headset_mode_unplugged(struct hda_codec *codec) 3853static void alc_headset_mode_unplugged(struct hda_codec *codec)
3842{ 3854{
3843 static struct coef_fw coef0255[] = { 3855 static struct coef_fw coef0255[] = {
@@ -3873,6 +3885,10 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
3873 UPDATE_COEF(0x67, 0x2000, 0), 3885 UPDATE_COEF(0x67, 0x2000, 0),
3874 {} 3886 {}
3875 }; 3887 };
3888 static struct coef_fw coef0298[] = {
3889 UPDATE_COEF(0x19, 0x1300, 0x0300),
3890 {}
3891 };
3876 static struct coef_fw coef0292[] = { 3892 static struct coef_fw coef0292[] = {
3877 WRITE_COEF(0x76, 0x000e), 3893 WRITE_COEF(0x76, 0x000e),
3878 WRITE_COEF(0x6c, 0x2400), 3894 WRITE_COEF(0x6c, 0x2400),
@@ -3895,13 +3911,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
3895 {} 3911 {}
3896 }; 3912 };
3897 static struct coef_fw coef0225[] = { 3913 static struct coef_fw coef0225[] = {
3898 UPDATE_COEF(0x4a, 1<<8, 0), 3914 UPDATE_COEF(0x63, 3<<14, 0),
3899 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3900 UPDATE_COEF(0x63, 3<<14, 3<<14),
3901 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3902 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3903 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3904 UPDATE_COEF(0x4a, 3<<10, 0),
3905 {} 3915 {}
3906 }; 3916 };
3907 static struct coef_fw coef0274[] = { 3917 static struct coef_fw coef0274[] = {
@@ -3935,7 +3945,10 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
3935 break; 3945 break;
3936 case 0x10ec0286: 3946 case 0x10ec0286:
3937 case 0x10ec0288: 3947 case 0x10ec0288:
3948 alc_process_coef_fw(codec, coef0288);
3949 break;
3938 case 0x10ec0298: 3950 case 0x10ec0298:
3951 alc_process_coef_fw(codec, coef0298);
3939 alc_process_coef_fw(codec, coef0288); 3952 alc_process_coef_fw(codec, coef0288);
3940 break; 3953 break;
3941 case 0x10ec0292: 3954 case 0x10ec0292:
@@ -3976,6 +3989,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3976 {} 3989 {}
3977 }; 3990 };
3978 static struct coef_fw coef0288[] = { 3991 static struct coef_fw coef0288[] = {
3992 UPDATE_COEF(0x4f, 0x00c0, 0),
3979 UPDATE_COEF(0x50, 0x2000, 0), 3993 UPDATE_COEF(0x50, 0x2000, 0),
3980 UPDATE_COEF(0x56, 0x0006, 0), 3994 UPDATE_COEF(0x56, 0x0006, 0),
3981 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), 3995 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
@@ -4039,7 +4053,6 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4039 case 0x10ec0286: 4053 case 0x10ec0286:
4040 case 0x10ec0288: 4054 case 0x10ec0288:
4041 case 0x10ec0298: 4055 case 0x10ec0298:
4042 alc_update_coef_idx(codec, 0x4f, 0x000c, 0);
4043 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); 4056 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4044 alc_process_coef_fw(codec, coef0288); 4057 alc_process_coef_fw(codec, coef0288);
4045 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); 4058 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
@@ -4072,6 +4085,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4072 case 0x10ec0225: 4085 case 0x10ec0225:
4073 case 0x10ec0295: 4086 case 0x10ec0295:
4074 case 0x10ec0299: 4087 case 0x10ec0299:
4088 alc_process_coef_fw(codec, alc225_pre_hsmode);
4075 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); 4089 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4076 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); 4090 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4077 alc_process_coef_fw(codec, coef0225); 4091 alc_process_coef_fw(codec, coef0225);
@@ -4084,7 +4098,12 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4084static void alc_headset_mode_default(struct hda_codec *codec) 4098static void alc_headset_mode_default(struct hda_codec *codec)
4085{ 4099{
4086 static struct coef_fw coef0225[] = { 4100 static struct coef_fw coef0225[] = {
4087 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10), 4101 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4102 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4103 UPDATE_COEF(0x49, 3<<8, 0<<8),
4104 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4105 UPDATE_COEF(0x63, 3<<14, 0),
4106 UPDATE_COEF(0x67, 0xf000, 0x3000),
4088 {} 4107 {}
4089 }; 4108 };
4090 static struct coef_fw coef0255[] = { 4109 static struct coef_fw coef0255[] = {
@@ -4138,6 +4157,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)
4138 case 0x10ec0225: 4157 case 0x10ec0225:
4139 case 0x10ec0295: 4158 case 0x10ec0295:
4140 case 0x10ec0299: 4159 case 0x10ec0299:
4160 alc_process_coef_fw(codec, alc225_pre_hsmode);
4141 alc_process_coef_fw(codec, coef0225); 4161 alc_process_coef_fw(codec, coef0225);
4142 break; 4162 break;
4143 case 0x10ec0255: 4163 case 0x10ec0255:
@@ -4177,6 +4197,8 @@ static void alc_headset_mode_default(struct hda_codec *codec)
4177/* Iphone type */ 4197/* Iphone type */
4178static void alc_headset_mode_ctia(struct hda_codec *codec) 4198static void alc_headset_mode_ctia(struct hda_codec *codec)
4179{ 4199{
4200 int val;
4201
4180 static struct coef_fw coef0255[] = { 4202 static struct coef_fw coef0255[] = {
4181 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ 4203 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4182 WRITE_COEF(0x1b, 0x0c2b), 4204 WRITE_COEF(0x1b, 0x0c2b),
@@ -4219,11 +4241,14 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
4219 WRITE_COEF(0xc3, 0x0000), 4241 WRITE_COEF(0xc3, 0x0000),
4220 {} 4242 {}
4221 }; 4243 };
4222 static struct coef_fw coef0225[] = { 4244 static struct coef_fw coef0225_1[] = {
4223 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10), 4245 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4224 UPDATE_COEF(0x49, 1<<8, 1<<8), 4246 UPDATE_COEF(0x63, 3<<14, 2<<14),
4225 UPDATE_COEF(0x4a, 7<<6, 7<<6), 4247 {}
4226 UPDATE_COEF(0x4a, 3<<4, 3<<4), 4248 };
4249 static struct coef_fw coef0225_2[] = {
4250 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4251 UPDATE_COEF(0x63, 3<<14, 1<<14),
4227 {} 4252 {}
4228 }; 4253 };
4229 4254
@@ -4244,8 +4269,17 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
4244 alc_process_coef_fw(codec, coef0233); 4269 alc_process_coef_fw(codec, coef0233);
4245 break; 4270 break;
4246 case 0x10ec0298: 4271 case 0x10ec0298:
4247 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);/* Headset output enable */ 4272 val = alc_read_coef_idx(codec, 0x50);
4248 /* ALC298 jack type setting is the same with ALC286/ALC288 */ 4273 if (val & (1 << 12)) {
4274 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4275 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4276 msleep(300);
4277 } else {
4278 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4279 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4280 msleep(300);
4281 }
4282 break;
4249 case 0x10ec0286: 4283 case 0x10ec0286:
4250 case 0x10ec0288: 4284 case 0x10ec0288:
4251 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); 4285 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
@@ -4264,7 +4298,11 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
4264 case 0x10ec0225: 4298 case 0x10ec0225:
4265 case 0x10ec0295: 4299 case 0x10ec0295:
4266 case 0x10ec0299: 4300 case 0x10ec0299:
4267 alc_process_coef_fw(codec, coef0225); 4301 val = alc_read_coef_idx(codec, 0x45);
4302 if (val & (1 << 9))
4303 alc_process_coef_fw(codec, coef0225_2);
4304 else
4305 alc_process_coef_fw(codec, coef0225_1);
4268 break; 4306 break;
4269 case 0x10ec0867: 4307 case 0x10ec0867:
4270 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); 4308 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
@@ -4320,9 +4358,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
4320 }; 4358 };
4321 static struct coef_fw coef0225[] = { 4359 static struct coef_fw coef0225[] = {
4322 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10), 4360 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
4323 UPDATE_COEF(0x49, 1<<8, 1<<8), 4361 UPDATE_COEF(0x63, 3<<14, 2<<14),
4324 UPDATE_COEF(0x4a, 7<<6, 7<<6),
4325 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4326 {} 4362 {}
4327 }; 4363 };
4328 4364
@@ -4344,7 +4380,9 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
4344 break; 4380 break;
4345 case 0x10ec0298: 4381 case 0x10ec0298:
4346 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ 4382 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
4347 /* ALC298 jack type setting is the same with ALC286/ALC288 */ 4383 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4384 msleep(300);
4385 break;
4348 case 0x10ec0286: 4386 case 0x10ec0286:
4349 case 0x10ec0288: 4387 case 0x10ec0288:
4350 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); 4388 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
@@ -4384,6 +4422,14 @@ static void alc_determine_headset_type(struct hda_codec *codec)
4384 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */ 4422 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4385 {} 4423 {}
4386 }; 4424 };
4425 static struct coef_fw coef0298[] = {
4426 UPDATE_COEF(0x50, 0x2000, 0x2000),
4427 UPDATE_COEF(0x56, 0x0006, 0x0006),
4428 UPDATE_COEF(0x66, 0x0008, 0),
4429 UPDATE_COEF(0x67, 0x2000, 0),
4430 UPDATE_COEF(0x19, 0x1300, 0x1300),
4431 {}
4432 };
4387 static struct coef_fw coef0293[] = { 4433 static struct coef_fw coef0293[] = {
4388 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */ 4434 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4389 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */ 4435 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
@@ -4396,11 +4442,6 @@ static void alc_determine_headset_type(struct hda_codec *codec)
4396 WRITE_COEF(0xc3, 0x0c00), 4442 WRITE_COEF(0xc3, 0x0c00),
4397 {} 4443 {}
4398 }; 4444 };
4399 static struct coef_fw coef0225[] = {
4400 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4401 UPDATE_COEF(0x49, 1<<8, 1<<8),
4402 {}
4403 };
4404 static struct coef_fw coef0274[] = { 4445 static struct coef_fw coef0274[] = {
4405 UPDATE_COEF(0x4a, 0x0010, 0), 4446 UPDATE_COEF(0x4a, 0x0010, 0),
4406 UPDATE_COEF(0x4a, 0x8000, 0), 4447 UPDATE_COEF(0x4a, 0x8000, 0),
@@ -4433,8 +4474,34 @@ static void alc_determine_headset_type(struct hda_codec *codec)
4433 is_ctia = (val & 0x0070) == 0x0070; 4474 is_ctia = (val & 0x0070) == 0x0070;
4434 break; 4475 break;
4435 case 0x10ec0298: 4476 case 0x10ec0298:
4436 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); /* Headset output enable */ 4477 snd_hda_codec_write(codec, 0x21, 0,
4437 /* ALC298 check jack type is the same with ALC286/ALC288 */ 4478 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4479 msleep(100);
4480 snd_hda_codec_write(codec, 0x21, 0,
4481 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4482 msleep(200);
4483
4484 val = alc_read_coef_idx(codec, 0x50);
4485 if (val & (1 << 12)) {
4486 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4487 alc_process_coef_fw(codec, coef0288);
4488 msleep(350);
4489 val = alc_read_coef_idx(codec, 0x50);
4490 is_ctia = (val & 0x0070) == 0x0070;
4491 } else {
4492 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4493 alc_process_coef_fw(codec, coef0288);
4494 msleep(350);
4495 val = alc_read_coef_idx(codec, 0x50);
4496 is_ctia = (val & 0x0070) == 0x0070;
4497 }
4498 alc_process_coef_fw(codec, coef0298);
4499 snd_hda_codec_write(codec, 0x21, 0,
4500 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4501 msleep(75);
4502 snd_hda_codec_write(codec, 0x21, 0,
4503 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4504 break;
4438 case 0x10ec0286: 4505 case 0x10ec0286:
4439 case 0x10ec0288: 4506 case 0x10ec0288:
4440 alc_process_coef_fw(codec, coef0288); 4507 alc_process_coef_fw(codec, coef0288);
@@ -4463,10 +4530,25 @@ static void alc_determine_headset_type(struct hda_codec *codec)
4463 case 0x10ec0225: 4530 case 0x10ec0225:
4464 case 0x10ec0295: 4531 case 0x10ec0295:
4465 case 0x10ec0299: 4532 case 0x10ec0299:
4466 alc_process_coef_fw(codec, coef0225); 4533 alc_process_coef_fw(codec, alc225_pre_hsmode);
4467 msleep(800); 4534 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4468 val = alc_read_coef_idx(codec, 0x46); 4535 val = alc_read_coef_idx(codec, 0x45);
4469 is_ctia = (val & 0x00f0) == 0x00f0; 4536 if (val & (1 << 9)) {
4537 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4538 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4539 msleep(800);
4540 val = alc_read_coef_idx(codec, 0x46);
4541 is_ctia = (val & 0x00f0) == 0x00f0;
4542 } else {
4543 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4544 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4545 msleep(800);
4546 val = alc_read_coef_idx(codec, 0x46);
4547 is_ctia = (val & 0x00f0) == 0x00f0;
4548 }
4549 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4550 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4551 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4470 break; 4552 break;
4471 case 0x10ec0867: 4553 case 0x10ec0867:
4472 is_ctia = true; 4554 is_ctia = true;
@@ -6565,7 +6647,6 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
6565 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, 6647 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6566 ALC225_STANDARD_PINS, 6648 ALC225_STANDARD_PINS,
6567 {0x12, 0xb7a60130}, 6649 {0x12, 0xb7a60130},
6568 {0x13, 0xb8a61140},
6569 {0x17, 0x90170110}), 6650 {0x17, 0x90170110}),
6570 {} 6651 {}
6571}; 6652};
@@ -6724,6 +6805,7 @@ static int patch_alc269(struct hda_codec *codec)
6724 case 0x10ec0225: 6805 case 0x10ec0225:
6725 case 0x10ec0295: 6806 case 0x10ec0295:
6726 spec->codec_variant = ALC269_TYPE_ALC225; 6807 spec->codec_variant = ALC269_TYPE_ALC225;
6808 spec->gen.mixer_nid = 0; /* no loopback on ALC225 ALC295 */
6727 break; 6809 break;
6728 case 0x10ec0299: 6810 case 0x10ec0299:
6729 spec->codec_variant = ALC269_TYPE_ALC225; 6811 spec->codec_variant = ALC269_TYPE_ALC225;
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
index a78802920c3c..5710fd440bcd 100644
--- a/sound/soc/codecs/msm8916-wcd-analog.c
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
@@ -36,7 +36,7 @@
36#define CDC_D_CDC_DIG_CLK_CTL (0xf04A) 36#define CDC_D_CDC_DIG_CLK_CTL (0xf04A)
37#define DIG_CLK_CTL_RXD1_CLK_EN BIT(0) 37#define DIG_CLK_CTL_RXD1_CLK_EN BIT(0)
38#define DIG_CLK_CTL_RXD2_CLK_EN BIT(1) 38#define DIG_CLK_CTL_RXD2_CLK_EN BIT(1)
39#define DIG_CLK_CTL_RXD3_CLK_EN BIT(3) 39#define DIG_CLK_CTL_RXD3_CLK_EN BIT(2)
40#define DIG_CLK_CTL_TXD_CLK_EN BIT(4) 40#define DIG_CLK_CTL_TXD_CLK_EN BIT(4)
41#define DIG_CLK_CTL_NCP_CLK_EN_MASK BIT(6) 41#define DIG_CLK_CTL_NCP_CLK_EN_MASK BIT(6)
42#define DIG_CLK_CTL_NCP_CLK_EN BIT(6) 42#define DIG_CLK_CTL_NCP_CLK_EN BIT(6)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index a33202affeb1..fa550e3c1332 100644
--- a/sound/soc/codecs/rt5663.c
+++ b/sound/soc/codecs/rt5663.c
@@ -466,7 +466,7 @@ static const struct reg_default rt5663_reg[] = {
466 { 0x0006, 0x1000 }, 466 { 0x0006, 0x1000 },
467 { 0x000a, 0x0000 }, 467 { 0x000a, 0x0000 },
468 { 0x0010, 0x000f }, 468 { 0x0010, 0x000f },
469 { 0x0015, 0x42c1 }, 469 { 0x0015, 0x42f1 },
470 { 0x0016, 0x0000 }, 470 { 0x0016, 0x0000 },
471 { 0x0018, 0x000b }, 471 { 0x0018, 0x000b },
472 { 0x0019, 0xafaf }, 472 { 0x0019, 0xafaf },
@@ -509,7 +509,7 @@ static const struct reg_default rt5663_reg[] = {
509 { 0x008a, 0x0000 }, 509 { 0x008a, 0x0000 },
510 { 0x008b, 0x0000 }, 510 { 0x008b, 0x0000 },
511 { 0x008c, 0x0003 }, 511 { 0x008c, 0x0003 },
512 { 0x008e, 0x0004 }, 512 { 0x008e, 0x0008 },
513 { 0x008f, 0x1000 }, 513 { 0x008f, 0x1000 },
514 { 0x0090, 0x0646 }, 514 { 0x0090, 0x0646 },
515 { 0x0091, 0x0e3e }, 515 { 0x0091, 0x0e3e },
@@ -520,7 +520,7 @@ static const struct reg_default rt5663_reg[] = {
520 { 0x0098, 0x0000 }, 520 { 0x0098, 0x0000 },
521 { 0x009a, 0x0000 }, 521 { 0x009a, 0x0000 },
522 { 0x009f, 0x0000 }, 522 { 0x009f, 0x0000 },
523 { 0x00ae, 0x2000 }, 523 { 0x00ae, 0x6000 },
524 { 0x00af, 0x0000 }, 524 { 0x00af, 0x0000 },
525 { 0x00b6, 0x0000 }, 525 { 0x00b6, 0x0000 },
526 { 0x00b7, 0x0000 }, 526 { 0x00b7, 0x0000 },
@@ -538,7 +538,7 @@ static const struct reg_default rt5663_reg[] = {
538 { 0x00d9, 0x08f9 }, 538 { 0x00d9, 0x08f9 },
539 { 0x00db, 0x0008 }, 539 { 0x00db, 0x0008 },
540 { 0x00dc, 0x00c0 }, 540 { 0x00dc, 0x00c0 },
541 { 0x00dd, 0x6724 }, 541 { 0x00dd, 0x6729 },
542 { 0x00de, 0x3131 }, 542 { 0x00de, 0x3131 },
543 { 0x00df, 0x0008 }, 543 { 0x00df, 0x0008 },
544 { 0x00e0, 0x4000 }, 544 { 0x00e0, 0x4000 },
@@ -578,7 +578,7 @@ static const struct reg_default rt5663_reg[] = {
578 { 0x0116, 0x0000 }, 578 { 0x0116, 0x0000 },
579 { 0x0117, 0x0f00 }, 579 { 0x0117, 0x0f00 },
580 { 0x0118, 0x0006 }, 580 { 0x0118, 0x0006 },
581 { 0x0125, 0x2224 }, 581 { 0x0125, 0x2424 },
582 { 0x0126, 0x5550 }, 582 { 0x0126, 0x5550 },
583 { 0x0127, 0x0400 }, 583 { 0x0127, 0x0400 },
584 { 0x0128, 0x7711 }, 584 { 0x0128, 0x7711 },
@@ -596,8 +596,8 @@ static const struct reg_default rt5663_reg[] = {
596 { 0x0145, 0x0002 }, 596 { 0x0145, 0x0002 },
597 { 0x0146, 0x0000 }, 597 { 0x0146, 0x0000 },
598 { 0x0160, 0x0e80 }, 598 { 0x0160, 0x0e80 },
599 { 0x0161, 0x0020 }, 599 { 0x0161, 0x0080 },
600 { 0x0162, 0x0080 }, 600 { 0x0162, 0x0200 },
601 { 0x0163, 0x0800 }, 601 { 0x0163, 0x0800 },
602 { 0x0164, 0x0000 }, 602 { 0x0164, 0x0000 },
603 { 0x0165, 0x0000 }, 603 { 0x0165, 0x0000 },
@@ -676,8 +676,8 @@ static const struct reg_default rt5663_reg[] = {
676 { 0x0251, 0x0000 }, 676 { 0x0251, 0x0000 },
677 { 0x0252, 0x028a }, 677 { 0x0252, 0x028a },
678 { 0x02fa, 0x0000 }, 678 { 0x02fa, 0x0000 },
679 { 0x02fb, 0x0000 }, 679 { 0x02fb, 0x00a4 },
680 { 0x02fc, 0x0000 }, 680 { 0x02fc, 0x0300 },
681 { 0x0300, 0x0000 }, 681 { 0x0300, 0x0000 },
682 { 0x03d0, 0x0000 }, 682 { 0x03d0, 0x0000 },
683 { 0x03d1, 0x0000 }, 683 { 0x03d1, 0x0000 },
diff --git a/sound/soc/codecs/rt5665.c b/sound/soc/codecs/rt5665.c
index 370ed54d1e15..e597c893536d 100644
--- a/sound/soc/codecs/rt5665.c
+++ b/sound/soc/codecs/rt5665.c
@@ -4368,12 +4368,12 @@ static int rt5665_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
4368 switch (dai->id) { 4368 switch (dai->id) {
4369 case RT5665_AIF2_1: 4369 case RT5665_AIF2_1:
4370 case RT5665_AIF2_2: 4370 case RT5665_AIF2_2:
4371 snd_soc_update_bits(codec, RT5665_ADDA_CLK_1, 4371 snd_soc_update_bits(codec, RT5665_ADDA_CLK_2,
4372 RT5665_I2S_BCLK_MS2_MASK, 4372 RT5665_I2S_BCLK_MS2_MASK,
4373 RT5665_I2S_BCLK_MS2_64); 4373 RT5665_I2S_BCLK_MS2_64);
4374 break; 4374 break;
4375 case RT5665_AIF3: 4375 case RT5665_AIF3:
4376 snd_soc_update_bits(codec, RT5665_ADDA_CLK_1, 4376 snd_soc_update_bits(codec, RT5665_ADDA_CLK_2,
4377 RT5665_I2S_BCLK_MS3_MASK, 4377 RT5665_I2S_BCLK_MS3_MASK,
4378 RT5665_I2S_BCLK_MS3_64); 4378 RT5665_I2S_BCLK_MS3_64);
4379 break; 4379 break;
diff --git a/sound/soc/codecs/rt5665.h b/sound/soc/codecs/rt5665.h
index 1db5c6a62a8e..d95249c4c47b 100644
--- a/sound/soc/codecs/rt5665.h
+++ b/sound/soc/codecs/rt5665.h
@@ -1692,8 +1692,8 @@
1692#define RT5665_GP6_PIN_MASK (0x3 << 5) 1692#define RT5665_GP6_PIN_MASK (0x3 << 5)
1693#define RT5665_GP6_PIN_SFT 5 1693#define RT5665_GP6_PIN_SFT 5
1694#define RT5665_GP6_PIN_GPIO6 (0x0 << 5) 1694#define RT5665_GP6_PIN_GPIO6 (0x0 << 5)
1695#define RT5665_GP6_PIN_BCLK3 (0x0 << 5) 1695#define RT5665_GP6_PIN_BCLK3 (0x1 << 5)
1696#define RT5665_GP6_PIN_PDM_SCL (0x1 << 5) 1696#define RT5665_GP6_PIN_PDM_SCL (0x2 << 5)
1697#define RT5665_GP7_PIN_MASK (0x3 << 3) 1697#define RT5665_GP7_PIN_MASK (0x3 << 3)
1698#define RT5665_GP7_PIN_SFT 3 1698#define RT5665_GP7_PIN_SFT 3
1699#define RT5665_GP7_PIN_GPIO7 (0x0 << 3) 1699#define RT5665_GP7_PIN_GPIO7 (0x0 << 3)
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 9e9de0e274ea..9875c8d05b5c 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -5010,6 +5010,8 @@ static const struct regmap_config rt5677_regmap = {
5010}; 5010};
5011 5011
5012static const struct i2c_device_id rt5677_i2c_id[] = { 5012static const struct i2c_device_id rt5677_i2c_id[] = {
5013 { "rt5677", RT5677 },
5014 { "rt5676", RT5676 },
5013 { } 5015 { }
5014}; 5016};
5015MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); 5017MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 8f6814c1eb6b..80f6d1da7095 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -409,7 +409,7 @@ static int dac_put_volsw(struct snd_kcontrol *kcontrol,
409static int avc_get_threshold(struct snd_kcontrol *kcontrol, 409static int avc_get_threshold(struct snd_kcontrol *kcontrol,
410 struct snd_ctl_elem_value *ucontrol) 410 struct snd_ctl_elem_value *ucontrol)
411{ 411{
412 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 412 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
413 int db, i; 413 int db, i;
414 u16 reg = snd_soc_read(codec, SGTL5000_DAP_AVC_THRESHOLD); 414 u16 reg = snd_soc_read(codec, SGTL5000_DAP_AVC_THRESHOLD);
415 415
@@ -442,7 +442,7 @@ static int avc_get_threshold(struct snd_kcontrol *kcontrol,
442static int avc_put_threshold(struct snd_kcontrol *kcontrol, 442static int avc_put_threshold(struct snd_kcontrol *kcontrol,
443 struct snd_ctl_elem_value *ucontrol) 443 struct snd_ctl_elem_value *ucontrol)
444{ 444{
445 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 445 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
446 int db; 446 int db;
447 u16 reg; 447 u16 reg;
448 448
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index b95132e2f9dc..06790615e04e 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -527,6 +527,10 @@ static int imx_ssi_probe(struct platform_device *pdev)
527 } 527 }
528 528
529 ssi->irq = platform_get_irq(pdev, 0); 529 ssi->irq = platform_get_irq(pdev, 0);
530 if (ssi->irq < 0) {
531 dev_err(&pdev->dev, "Failed to get IRQ: %d\n", ssi->irq);
532 return ssi->irq;
533 }
530 534
531 ssi->clk = devm_clk_get(&pdev->dev, NULL); 535 ssi->clk = devm_clk_get(&pdev->dev, NULL);
532 if (IS_ERR(ssi->clk)) { 536 if (IS_ERR(ssi->clk)) {
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 105ec3a6e30d..de2550c7a96b 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -224,9 +224,11 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
224 224
225 of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { 225 of_for_each_phandle(&it, rc, node, "dais", NULL, 0) {
226 ret = asoc_graph_card_dai_link_of(it.node, priv, idx++); 226 ret = asoc_graph_card_dai_link_of(it.node, priv, idx++);
227 of_node_put(it.node); 227 if (ret < 0) {
228 if (ret < 0) 228 of_node_put(it.node);
229
229 return ret; 230 return ret;
231 }
230 } 232 }
231 233
232 return asoc_simple_card_parse_card_name(card, NULL); 234 return asoc_simple_card_parse_card_name(card, NULL);
@@ -239,10 +241,8 @@ static int asoc_graph_get_dais_count(struct device *dev)
239 int count = 0; 241 int count = 0;
240 int rc; 242 int rc;
241 243
242 of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { 244 of_for_each_phandle(&it, rc, node, "dais", NULL, 0)
243 count++; 245 count++;
244 of_node_put(it.node);
245 }
246 246
247 return count; 247 return count;
248} 248}
diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c
index dcd2df37bc3b..758ac06f3a99 100644
--- a/sound/soc/generic/audio-graph-scu-card.c
+++ b/sound/soc/generic/audio-graph-scu-card.c
@@ -215,7 +215,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
215 codec_ep = of_graph_get_remote_endpoint(cpu_ep); 215 codec_ep = of_graph_get_remote_endpoint(cpu_ep);
216 rcpu_ep = of_graph_get_remote_endpoint(codec_ep); 216 rcpu_ep = of_graph_get_remote_endpoint(codec_ep);
217 217
218 of_node_put(cpu_port);
219 of_node_put(cpu_ep); 218 of_node_put(cpu_ep);
220 of_node_put(codec_ep); 219 of_node_put(codec_ep);
221 of_node_put(rcpu_ep); 220 of_node_put(rcpu_ep);
@@ -232,8 +231,10 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
232 231
233 ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep, 232 ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep,
234 NULL, &daifmt); 233 NULL, &daifmt);
235 if (ret < 0) 234 if (ret < 0) {
235 of_node_put(cpu_port);
236 goto parse_of_err; 236 goto parse_of_err;
237 }
237 } 238 }
238 239
239 dai_idx = 0; 240 dai_idx = 0;
@@ -250,7 +251,6 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
250 codec_ep = of_graph_get_remote_endpoint(cpu_ep); 251 codec_ep = of_graph_get_remote_endpoint(cpu_ep);
251 codec_port = of_graph_get_port_parent(codec_ep); 252 codec_port = of_graph_get_port_parent(codec_ep);
252 253
253 of_node_put(cpu_port);
254 of_node_put(cpu_ep); 254 of_node_put(cpu_ep);
255 of_node_put(codec_ep); 255 of_node_put(codec_ep);
256 of_node_put(codec_port); 256 of_node_put(codec_port);
@@ -266,13 +266,17 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv)
266 266
267 /* Back-End (= Codec) */ 267 /* Back-End (= Codec) */
268 ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0); 268 ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0);
269 if (ret < 0) 269 if (ret < 0) {
270 of_node_put(cpu_port);
270 goto parse_of_err; 271 goto parse_of_err;
272 }
271 } else { 273 } else {
272 /* Front-End (= CPU) */ 274 /* Front-End (= CPU) */
273 ret = asoc_graph_card_dai_link_of(cpu_ep, priv, daifmt, dai_idx++, 1); 275 ret = asoc_graph_card_dai_link_of(cpu_ep, priv, daifmt, dai_idx++, 1);
274 if (ret < 0) 276 if (ret < 0) {
277 of_node_put(cpu_port);
275 goto parse_of_err; 278 goto parse_of_err;
279 }
276 } 280 }
277 } 281 }
278 } 282 }
@@ -306,7 +310,6 @@ static int asoc_graph_get_dais_count(struct device *dev)
306 codec_ep = of_graph_get_remote_endpoint(cpu_ep); 310 codec_ep = of_graph_get_remote_endpoint(cpu_ep);
307 codec_port = of_graph_get_port_parent(codec_ep); 311 codec_port = of_graph_get_port_parent(codec_ep);
308 312
309 of_node_put(cpu_port);
310 of_node_put(cpu_ep); 313 of_node_put(cpu_ep);
311 of_node_put(codec_ep); 314 of_node_put(codec_ep);
312 of_node_put(codec_port); 315 of_node_put(codec_port);
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 26d64fa40c9c..7d7ab4aee42e 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -263,6 +263,9 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)
263 id = i; 263 id = i;
264 i++; 264 i++;
265 } 265 }
266
267 of_node_put(node);
268
266 if (id < 0) 269 if (id < 0)
267 return -ENODEV; 270 return -ENODEV;
268 271
@@ -282,11 +285,6 @@ int asoc_simple_card_parse_graph_dai(struct device_node *ep,
282 if (!dai_name) 285 if (!dai_name)
283 return 0; 286 return 0;
284 287
285 /*
286 * of_graph_get_port_parent() will call
287 * of_node_put(). So, call of_node_get() here
288 */
289 of_node_get(ep);
290 node = of_graph_get_port_parent(ep); 288 node = of_graph_get_port_parent(ep);
291 289
292 /* Get dai->name */ 290 /* Get dai->name */
diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
index 3fe4a0807095..cfd89ca6a18d 100644
--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
@@ -319,7 +319,9 @@ static int kabylake_rt5663_hw_params(struct snd_pcm_substream *substream,
319 int ret; 319 int ret;
320 320
321 /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */ 321 /* use ASRC for internal clocks, as PLL rate isn't multiple of BCLK */
322 rt5663_sel_asrc_clk_src(codec_dai->codec, RT5663_DA_STEREO_FILTER, 1); 322 rt5663_sel_asrc_clk_src(codec_dai->codec,
323 RT5663_DA_STEREO_FILTER | RT5663_AD_STEREO_FILTER,
324 RT5663_CLK_SEL_I2S1_ASRC);
323 325
324 ret = snd_soc_dai_set_sysclk(codec_dai, 326 ret = snd_soc_dai_set_sysclk(codec_dai,
325 RT5663_SCLK_S_MCLK, 24576000, SND_SOC_CLOCK_IN); 327 RT5663_SCLK_S_MCLK, 24576000, SND_SOC_CLOCK_IN);
@@ -349,19 +351,10 @@ static int kabylake_ssp0_hw_params(struct snd_pcm_substream *substream,
349 return ret; 351 return ret;
350 } 352 }
351 353
352 ret = snd_soc_dai_set_pll(codec_dai, 0,
353 RT5514_PLL1_S_BCLK, RT5514_AIF1_BCLK_FREQ,
354 RT5514_AIF1_SYSCLK_FREQ);
355 if (ret < 0) {
356 dev_err(rtd->dev, "set bclk err: %d\n", ret);
357 return ret;
358 }
359
360 ret = snd_soc_dai_set_sysclk(codec_dai, 354 ret = snd_soc_dai_set_sysclk(codec_dai,
361 RT5514_SCLK_S_PLL1, RT5514_AIF1_SYSCLK_FREQ, 355 RT5514_SCLK_S_MCLK, 24576000, SND_SOC_CLOCK_IN);
362 SND_SOC_CLOCK_IN);
363 if (ret < 0) { 356 if (ret < 0) {
364 dev_err(rtd->dev, "set sclk err: %d\n", ret); 357 dev_err(rtd->dev, "set sysclk err: %d\n", ret);
365 return ret; 358 return ret;
366 } 359 }
367 } 360 }
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index eca85827dbd2..fb2f1f603f3c 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -540,6 +540,14 @@ static void skl_setup_cpr_gateway_cfg(struct skl_sst *ctx,
540 cpr_mconfig->gtw_cfg.dma_buffer_size = 540 cpr_mconfig->gtw_cfg.dma_buffer_size =
541 mconfig->dma_buffer_size * dma_io_buf; 541 mconfig->dma_buffer_size * dma_io_buf;
542 542
543 /* fallback to 2ms default value */
544 if (!cpr_mconfig->gtw_cfg.dma_buffer_size) {
545 if (mconfig->hw_conn_type == SKL_CONN_SOURCE)
546 cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->obs;
547 else
548 cpr_mconfig->gtw_cfg.dma_buffer_size = 2 * mconfig->ibs;
549 }
550
543 cpr_mconfig->cpr_feature_mask = 0; 551 cpr_mconfig->cpr_feature_mask = 0;
544 cpr_mconfig->gtw_cfg.config_length = 0; 552 cpr_mconfig->gtw_cfg.config_length = 0;
545 553
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 334917ee41cf..9e3f8c04dd32 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -941,6 +941,7 @@ static struct sst_acpi_mach sst_bxtp_devdata[] = {
941 .machine_quirk = sst_acpi_codec_list, 941 .machine_quirk = sst_acpi_codec_list,
942 .quirk_data = &bxt_codecs, 942 .quirk_data = &bxt_codecs,
943 }, 943 },
944 {}
944}; 945};
945 946
946static struct sst_acpi_mach sst_kbl_devdata[] = { 947static struct sst_acpi_mach sst_kbl_devdata[] = {
@@ -991,6 +992,7 @@ static struct sst_acpi_mach sst_glk_devdata[] = {
991 .drv_name = "glk_alc298s_i2s", 992 .drv_name = "glk_alc298s_i2s",
992 .fw_filename = "intel/dsp_fw_glk.bin", 993 .fw_filename = "intel/dsp_fw_glk.bin",
993 }, 994 },
995 {}
994}; 996};
995 997
996/* PCI IDs */ 998/* PCI IDs */
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 960744e46edc..484ab3c2ad67 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -1,6 +1,7 @@
1config SND_PXA2XX_SOC 1config SND_PXA2XX_SOC
2 tristate "SoC Audio for the Intel PXA2xx chip" 2 tristate "SoC Audio for the Intel PXA2xx chip"
3 depends on ARCH_PXA || COMPILE_TEST 3 depends on ARCH_PXA || COMPILE_TEST
4 depends on HAS_DMA
4 select SND_PXA2XX_LIB 5 select SND_PXA2XX_LIB
5 help 6 help
6 Say Y or M if you want to add support for codecs attached to 7 Say Y or M if you want to add support for codecs attached to
diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c
index 0c0b00e40646..0834319ead42 100644
--- a/sound/soc/samsung/odroid.c
+++ b/sound/soc/samsung/odroid.c
@@ -42,17 +42,17 @@ static int odroid_card_hw_params(struct snd_pcm_substream *substream,
42 switch (params_rate(params)) { 42 switch (params_rate(params)) {
43 case 32000: 43 case 32000:
44 case 64000: 44 case 64000:
45 pll_freq = 131072000U; 45 pll_freq = 131072006U;
46 break; 46 break;
47 case 44100: 47 case 44100:
48 case 88200: 48 case 88200:
49 case 176400: 49 case 176400:
50 pll_freq = 180633600U; 50 pll_freq = 180633609U;
51 break; 51 break;
52 case 48000: 52 case 48000:
53 case 96000: 53 case 96000:
54 case 192000: 54 case 192000:
55 pll_freq = 196608000U; 55 pll_freq = 196608001U;
56 break; 56 break;
57 default: 57 default:
58 return -EINVAL; 58 return -EINVAL;
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
index 84c51037a7d0..624aaf569fef 100644
--- a/sound/soc/sh/hac.c
+++ b/sound/soc/sh/hac.c
@@ -315,6 +315,8 @@ static const struct snd_soc_component_driver sh4_hac_component = {
315 315
316static int hac_soc_platform_probe(struct platform_device *pdev) 316static int hac_soc_platform_probe(struct platform_device *pdev)
317{ 317{
318 int ret;
319
318 ret = snd_soc_set_ac97_ops(&hac_ac97_ops); 320 ret = snd_soc_set_ac97_ops(&hac_ac97_ops);
319 if (ret != 0) 321 if (ret != 0)
320 return ret; 322 return ret;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 921622a01944..13c875e2392a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3171,8 +3171,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
3171 component->remove = component->driver->remove; 3171 component->remove = component->driver->remove;
3172 component->suspend = component->driver->suspend; 3172 component->suspend = component->driver->suspend;
3173 component->resume = component->driver->resume; 3173 component->resume = component->driver->resume;
3174 component->pcm_new = component->driver->pcm_new;
3175 component->pcm_free = component->driver->pcm_free;
3176 3174
3177 dapm = &component->dapm; 3175 dapm = &component->dapm;
3178 dapm->dev = dev; 3176 dapm->dev = dev;
@@ -3360,25 +3358,6 @@ static void snd_soc_platform_drv_remove(struct snd_soc_component *component)
3360 platform->driver->remove(platform); 3358 platform->driver->remove(platform);
3361} 3359}
3362 3360
3363static int snd_soc_platform_drv_pcm_new(struct snd_soc_pcm_runtime *rtd)
3364{
3365 struct snd_soc_platform *platform = rtd->platform;
3366
3367 if (platform->driver->pcm_new)
3368 return platform->driver->pcm_new(rtd);
3369 else
3370 return 0;
3371}
3372
3373static void snd_soc_platform_drv_pcm_free(struct snd_pcm *pcm)
3374{
3375 struct snd_soc_pcm_runtime *rtd = pcm->private_data;
3376 struct snd_soc_platform *platform = rtd->platform;
3377
3378 if (platform->driver->pcm_free)
3379 platform->driver->pcm_free(pcm);
3380}
3381
3382/** 3361/**
3383 * snd_soc_add_platform - Add a platform to the ASoC core 3362 * snd_soc_add_platform - Add a platform to the ASoC core
3384 * @dev: The parent device for the platform 3363 * @dev: The parent device for the platform
@@ -3402,10 +3381,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
3402 platform->component.probe = snd_soc_platform_drv_probe; 3381 platform->component.probe = snd_soc_platform_drv_probe;
3403 if (platform_drv->remove) 3382 if (platform_drv->remove)
3404 platform->component.remove = snd_soc_platform_drv_remove; 3383 platform->component.remove = snd_soc_platform_drv_remove;
3405 if (platform_drv->pcm_new)
3406 platform->component.pcm_new = snd_soc_platform_drv_pcm_new;
3407 if (platform_drv->pcm_free)
3408 platform->component.pcm_free = snd_soc_platform_drv_pcm_free;
3409 3384
3410#ifdef CONFIG_DEBUG_FS 3385#ifdef CONFIG_DEBUG_FS
3411 platform->component.debugfs_prefix = "platform"; 3386 platform->component.debugfs_prefix = "platform";
@@ -4113,6 +4088,8 @@ int snd_soc_get_dai_id(struct device_node *ep)
4113 } 4088 }
4114 mutex_unlock(&client_mutex); 4089 mutex_unlock(&client_mutex);
4115 4090
4091 of_node_put(node);
4092
4116 return ret; 4093 return ret;
4117} 4094}
4118EXPORT_SYMBOL_GPL(snd_soc_get_dai_id); 4095EXPORT_SYMBOL_GPL(snd_soc_get_dai_id);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index dcc5ece08668..7d3859e1a7b9 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -181,6 +181,10 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
181 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n", 181 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
182 be->dai_link->name, event, dir); 182 be->dai_link->name, event, dir);
183 183
184 if ((event == SND_SOC_DAPM_STREAM_STOP) &&
185 (be->dpcm[dir].users >= 1))
186 continue;
187
184 snd_soc_dapm_stream_event(be, dir, event); 188 snd_soc_dapm_stream_event(be, dir, event);
185 } 189 }
186 190
@@ -2628,25 +2632,12 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
2628 return ret; 2632 return ret;
2629} 2633}
2630 2634
2631static void soc_pcm_free(struct snd_pcm *pcm)
2632{
2633 struct snd_soc_pcm_runtime *rtd = pcm->private_data;
2634 struct snd_soc_component *component;
2635
2636 list_for_each_entry(component, &rtd->card->component_dev_list,
2637 card_list) {
2638 if (component->pcm_free)
2639 component->pcm_free(pcm);
2640 }
2641}
2642
2643/* create a new pcm */ 2635/* create a new pcm */
2644int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) 2636int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
2645{ 2637{
2646 struct snd_soc_platform *platform = rtd->platform; 2638 struct snd_soc_platform *platform = rtd->platform;
2647 struct snd_soc_dai *codec_dai; 2639 struct snd_soc_dai *codec_dai;
2648 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 2640 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
2649 struct snd_soc_component *component;
2650 struct snd_pcm *pcm; 2641 struct snd_pcm *pcm;
2651 char new_name[64]; 2642 char new_name[64];
2652 int ret = 0, playback = 0, capture = 0; 2643 int ret = 0, playback = 0, capture = 0;
@@ -2756,18 +2747,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
2756 if (capture) 2747 if (capture)
2757 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops); 2748 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
2758 2749
2759 list_for_each_entry(component, &rtd->card->component_dev_list, card_list) { 2750 if (platform->driver->pcm_new) {
2760 if (component->pcm_new) { 2751 ret = platform->driver->pcm_new(rtd);
2761 ret = component->pcm_new(rtd); 2752 if (ret < 0) {
2762 if (ret < 0) { 2753 dev_err(platform->dev,
2763 dev_err(component->dev, 2754 "ASoC: pcm constructor failed: %d\n",
2764 "ASoC: pcm constructor failed: %d\n", 2755 ret);
2765 ret); 2756 return ret;
2766 return ret;
2767 }
2768 } 2757 }
2769 } 2758 }
2770 pcm->private_free = soc_pcm_free; 2759
2760 pcm->private_free = platform->driver->pcm_free;
2771out: 2761out:
2772 dev_info(rtd->card->dev, "%s <-> %s mapping ok\n", 2762 dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
2773 (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name, 2763 (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name,
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index b50f68a439ce..ba9fc099cf67 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -33,6 +33,7 @@ static struct snd_soc_dai_link mop500_dai_links[] = {
33 .stream_name = "ab8500_0", 33 .stream_name = "ab8500_0",
34 .cpu_dai_name = "ux500-msp-i2s.1", 34 .cpu_dai_name = "ux500-msp-i2s.1",
35 .codec_dai_name = "ab8500-codec-dai.0", 35 .codec_dai_name = "ab8500-codec-dai.0",
36 .platform_name = "ux500-msp-i2s.1",
36 .codec_name = "ab8500-codec.0", 37 .codec_name = "ab8500-codec.0",
37 .init = mop500_ab8500_machine_init, 38 .init = mop500_ab8500_machine_init,
38 .ops = mop500_ab8500_ops, 39 .ops = mop500_ab8500_ops,
@@ -42,6 +43,7 @@ static struct snd_soc_dai_link mop500_dai_links[] = {
42 .stream_name = "ab8500_1", 43 .stream_name = "ab8500_1",
43 .cpu_dai_name = "ux500-msp-i2s.3", 44 .cpu_dai_name = "ux500-msp-i2s.3",
44 .codec_dai_name = "ab8500-codec-dai.1", 45 .codec_dai_name = "ab8500-codec-dai.1",
46 .platform_name = "ux500-msp-i2s.3",
45 .codec_name = "ab8500-codec.0", 47 .codec_name = "ab8500-codec.0",
46 .init = NULL, 48 .init = NULL,
47 .ops = mop500_ab8500_ops, 49 .ops = mop500_ab8500_ops,
@@ -85,6 +87,8 @@ static int mop500_of_probe(struct platform_device *pdev,
85 for (i = 0; i < 2; i++) { 87 for (i = 0; i < 2; i++) {
86 mop500_dai_links[i].cpu_of_node = msp_np[i]; 88 mop500_dai_links[i].cpu_of_node = msp_np[i];
87 mop500_dai_links[i].cpu_dai_name = NULL; 89 mop500_dai_links[i].cpu_dai_name = NULL;
90 mop500_dai_links[i].platform_of_node = msp_np[i];
91 mop500_dai_links[i].platform_name = NULL;
88 mop500_dai_links[i].codec_of_node = codec_np; 92 mop500_dai_links[i].codec_of_node = codec_np;
89 mop500_dai_links[i].codec_name = NULL; 93 mop500_dai_links[i].codec_name = NULL;
90 } 94 }
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 082736c539bc..e630813c5008 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -542,6 +542,8 @@ int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
542 542
543 if (size < sizeof(scale)) 543 if (size < sizeof(scale))
544 return -ENOMEM; 544 return -ENOMEM;
545 if (cval->min_mute)
546 scale[0] = SNDRV_CTL_TLVT_DB_MINMAX_MUTE;
545 scale[2] = cval->dBmin; 547 scale[2] = cval->dBmin;
546 scale[3] = cval->dBmax; 548 scale[3] = cval->dBmax;
547 if (copy_to_user(_tlv, scale, sizeof(scale))) 549 if (copy_to_user(_tlv, scale, sizeof(scale)))
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 3417ef347e40..2b4b067646ab 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -64,6 +64,7 @@ struct usb_mixer_elem_info {
64 int cached; 64 int cached;
65 int cache_val[MAX_CHANNELS]; 65 int cache_val[MAX_CHANNELS];
66 u8 initialized; 66 u8 initialized;
67 u8 min_mute;
67 void *private_data; 68 void *private_data;
68}; 69};
69 70
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index e3d1dec48ee4..e1e7ce9ab217 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1878,6 +1878,12 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
1878 if (unitid == 7 && cval->control == UAC_FU_VOLUME) 1878 if (unitid == 7 && cval->control == UAC_FU_VOLUME)
1879 snd_dragonfly_quirk_db_scale(mixer, cval, kctl); 1879 snd_dragonfly_quirk_db_scale(mixer, cval, kctl);
1880 break; 1880 break;
1881 /* lowest playback value is muted on C-Media devices */
1882 case USB_ID(0x0d8c, 0x000c):
1883 case USB_ID(0x0d8c, 0x0014):
1884 if (strstr(kctl->id.name, "Playback"))
1885 cval->min_mute = 1;
1886 break;
1881 } 1887 }
1882} 1888}
1883 1889
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index d7b0b0a3a2db..5d2a63248b1d 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1142,6 +1142,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
1142 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */ 1142 case USB_ID(0x0556, 0x0014): /* Phoenix Audio TMX320VC */
1143 case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */ 1143 case USB_ID(0x05A3, 0x9420): /* ELP HD USB Camera */
1144 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ 1144 case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */
1145 case USB_ID(0x1395, 0x740a): /* Sennheiser DECT */
1145 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */ 1146 case USB_ID(0x1901, 0x0191): /* GE B850V3 CP2114 audio interface */
1146 case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */ 1147 case USB_ID(0x1de7, 0x0013): /* Phoenix Audio MT202exe */
1147 case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */ 1148 case USB_ID(0x1de7, 0x0014): /* Phoenix Audio TMX320 */
@@ -1308,10 +1309,13 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
1308 && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) 1309 && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
1309 mdelay(20); 1310 mdelay(20);
1310 1311
1311 /* Zoom R16/24 needs a tiny delay here, otherwise requests like 1312 /* Zoom R16/24, Logitech H650e, Jabra 550a needs a tiny delay here,
1312 * get/set frequency return as failed despite actually succeeding. 1313 * otherwise requests like get/set frequency return as failed despite
1314 * actually succeeding.
1313 */ 1315 */
1314 if (chip->usb_id == USB_ID(0x1686, 0x00dd) && 1316 if ((chip->usb_id == USB_ID(0x1686, 0x00dd) ||
1317 chip->usb_id == USB_ID(0x046d, 0x0a46) ||
1318 chip->usb_id == USB_ID(0x0b0e, 0x0349)) &&
1315 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) 1319 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
1316 mdelay(1); 1320 mdelay(1);
1317} 1321}
@@ -1374,6 +1378,10 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
1374 } 1378 }
1375 } 1379 }
1376 break; 1380 break;
1381 case USB_ID(0x16d0, 0x0a23):
1382 if (fp->altsetting == 2)
1383 return SNDRV_PCM_FMTBIT_DSD_U32_BE;
1384 break;
1377 1385
1378 default: 1386 default:
1379 break; 1387 break;
diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index dd8f00cfb8b4..32283d88701a 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -474,7 +474,7 @@ class Provider(object):
474 @staticmethod 474 @staticmethod
475 def is_field_wanted(fields_filter, field): 475 def is_field_wanted(fields_filter, field):
476 """Indicate whether field is valid according to fields_filter.""" 476 """Indicate whether field is valid according to fields_filter."""
477 if not fields_filter: 477 if not fields_filter or fields_filter == "help":
478 return True 478 return True
479 return re.match(fields_filter, field) is not None 479 return re.match(fields_filter, field) is not None
480 480
@@ -1413,8 +1413,8 @@ performance.
1413 1413
1414Requirements: 1414Requirements:
1415- Access to: 1415- Access to:
1416 /sys/kernel/debug/kvm 1416 %s
1417 /sys/kernel/debug/trace/events/* 1417 %s/events/*
1418 /proc/pid/task 1418 /proc/pid/task
1419- /proc/sys/kernel/perf_event_paranoid < 1 if user has no 1419- /proc/sys/kernel/perf_event_paranoid < 1 if user has no
1420 CAP_SYS_ADMIN and perf events are used. 1420 CAP_SYS_ADMIN and perf events are used.
@@ -1434,7 +1434,7 @@ Interactive Commands:
1434 s set update interval 1434 s set update interval
1435 x toggle reporting of stats for individual child trace events 1435 x toggle reporting of stats for individual child trace events
1436Press any other key to refresh statistics immediately. 1436Press any other key to refresh statistics immediately.
1437""" 1437""" % (PATH_DEBUGFS_KVM, PATH_DEBUGFS_TRACING)
1438 1438
1439 class PlainHelpFormatter(optparse.IndentedHelpFormatter): 1439 class PlainHelpFormatter(optparse.IndentedHelpFormatter):
1440 def format_description(self, description): 1440 def format_description(self, description):
@@ -1496,7 +1496,8 @@ Press any other key to refresh statistics immediately.
1496 action='store', 1496 action='store',
1497 default=DEFAULT_REGEX, 1497 default=DEFAULT_REGEX,
1498 dest='fields', 1498 dest='fields',
1499 help='fields to display (regex)', 1499 help='''fields to display (regex)
1500 "-f help" for a list of available events''',
1500 ) 1501 )
1501 optparser.add_option('-p', '--pid', 1502 optparser.add_option('-p', '--pid',
1502 action='store', 1503 action='store',
@@ -1559,6 +1560,17 @@ def main():
1559 1560
1560 stats = Stats(options) 1561 stats = Stats(options)
1561 1562
1563 if options.fields == "help":
1564 event_list = "\n"
1565 s = stats.get()
1566 for key in s.keys():
1567 if key.find('(') != -1:
1568 key = key[0:key.find('(')]
1569 if event_list.find('\n' + key + '\n') == -1:
1570 event_list += key + '\n'
1571 sys.stdout.write(event_list)
1572 return ""
1573
1562 if options.log: 1574 if options.log:
1563 log(stats) 1575 log(stats)
1564 elif not options.once: 1576 elif not options.once:
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 7e0405e1651d..412a7c82995a 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -120,7 +120,7 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
120int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, 120int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns,
121 size_t insns_cnt, int strict_alignment, 121 size_t insns_cnt, int strict_alignment,
122 const char *license, __u32 kern_version, 122 const char *license, __u32 kern_version,
123 char *log_buf, size_t log_buf_sz) 123 char *log_buf, size_t log_buf_sz, int log_level)
124{ 124{
125 union bpf_attr attr; 125 union bpf_attr attr;
126 126
@@ -131,7 +131,7 @@ int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns,
131 attr.license = ptr_to_u64(license); 131 attr.license = ptr_to_u64(license);
132 attr.log_buf = ptr_to_u64(log_buf); 132 attr.log_buf = ptr_to_u64(log_buf);
133 attr.log_size = log_buf_sz; 133 attr.log_size = log_buf_sz;
134 attr.log_level = 2; 134 attr.log_level = log_level;
135 log_buf[0] = 0; 135 log_buf[0] = 0;
136 attr.kern_version = kern_version; 136 attr.kern_version = kern_version;
137 attr.prog_flags = strict_alignment ? BPF_F_STRICT_ALIGNMENT : 0; 137 attr.prog_flags = strict_alignment ? BPF_F_STRICT_ALIGNMENT : 0;
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 16de44a14b48..418c86e69bcb 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -38,7 +38,7 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
38int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns, 38int bpf_verify_program(enum bpf_prog_type type, const struct bpf_insn *insns,
39 size_t insns_cnt, int strict_alignment, 39 size_t insns_cnt, int strict_alignment,
40 const char *license, __u32 kern_version, 40 const char *license, __u32 kern_version,
41 char *log_buf, size_t log_buf_sz); 41 char *log_buf, size_t log_buf_sz, int log_level);
42 42
43int bpf_map_update_elem(int fd, const void *key, const void *value, 43int bpf_map_update_elem(int fd, const void *key, const void *value,
44 __u64 flags); 44 __u64 flags);
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
index a4d3762cd825..83874b0e266c 100644
--- a/tools/perf/ui/browser.c
+++ b/tools/perf/ui/browser.c
@@ -704,7 +704,7 @@ static void __ui_browser__line_arrow_down(struct ui_browser *browser,
704 ui_browser__gotorc(browser, row, column + 1); 704 ui_browser__gotorc(browser, row, column + 1);
705 SLsmg_draw_hline(2); 705 SLsmg_draw_hline(2);
706 706
707 if (row++ == 0) 707 if (++row == 0)
708 goto out; 708 goto out;
709 } else 709 } else
710 row = 0; 710 row = 0;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 87b431886670..413f74df08de 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -273,7 +273,7 @@ struct perf_evsel *perf_evsel__new_cycles(void)
273 struct perf_event_attr attr = { 273 struct perf_event_attr attr = {
274 .type = PERF_TYPE_HARDWARE, 274 .type = PERF_TYPE_HARDWARE,
275 .config = PERF_COUNT_HW_CPU_CYCLES, 275 .config = PERF_COUNT_HW_CPU_CYCLES,
276 .exclude_kernel = 1, 276 .exclude_kernel = geteuid() != 0,
277 }; 277 };
278 struct perf_evsel *evsel; 278 struct perf_evsel *evsel;
279 279
@@ -298,8 +298,10 @@ struct perf_evsel *perf_evsel__new_cycles(void)
298 goto out; 298 goto out;
299 299
300 /* use asprintf() because free(evsel) assumes name is allocated */ 300 /* use asprintf() because free(evsel) assumes name is allocated */
301 if (asprintf(&evsel->name, "cycles%.*s", 301 if (asprintf(&evsel->name, "cycles%s%s%.*s",
302 attr.precise_ip ? attr.precise_ip + 1 : 0, ":ppp") < 0) 302 (attr.precise_ip || attr.exclude_kernel) ? ":" : "",
303 attr.exclude_kernel ? "u" : "",
304 attr.precise_ip ? attr.precise_ip + 1 : 0, "ppp") < 0)
303 goto error_free; 305 goto error_free;
304out: 306out:
305 return evsel; 307 return evsel;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 5de2b86b9880..2e9eb6aa3ce2 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -2209,7 +2209,7 @@ int machine__get_kernel_start(struct machine *machine)
2209 machine->kernel_start = 1ULL << 63; 2209 machine->kernel_start = 1ULL << 63;
2210 if (map) { 2210 if (map) {
2211 err = map__load(map); 2211 err = map__load(map);
2212 if (map->start) 2212 if (!err)
2213 machine->kernel_start = map->start; 2213 machine->kernel_start = map->start;
2214 } 2214 }
2215 return err; 2215 return err;
diff --git a/tools/testing/selftests/bpf/test_align.c b/tools/testing/selftests/bpf/test_align.c
index bccebd935907..29793694cbc7 100644
--- a/tools/testing/selftests/bpf/test_align.c
+++ b/tools/testing/selftests/bpf/test_align.c
@@ -380,7 +380,7 @@ static int do_test_single(struct bpf_align_test *test)
380 prog_len = probe_filter_length(prog); 380 prog_len = probe_filter_length(prog);
381 fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER, 381 fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER,
382 prog, prog_len, 1, "GPL", 0, 382 prog, prog_len, 1, "GPL", 0,
383 bpf_vlog, sizeof(bpf_vlog)); 383 bpf_vlog, sizeof(bpf_vlog), 2);
384 if (fd_prog < 0) { 384 if (fd_prog < 0) {
385 printf("Failed to load program.\n"); 385 printf("Failed to load program.\n");
386 printf("%s", bpf_vlog); 386 printf("%s", bpf_vlog);
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index 404aec520812..af7d173910f4 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -4969,7 +4969,7 @@ static struct bpf_test tests[] = {
4969 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2, 4969 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2,
4970 sizeof(struct test_val), 4), 4970 sizeof(struct test_val), 4),
4971 BPF_MOV64_IMM(BPF_REG_4, 0), 4971 BPF_MOV64_IMM(BPF_REG_4, 0),
4972 BPF_JMP_REG(BPF_JGE, BPF_REG_4, BPF_REG_2, 2), 4972 BPF_JMP_REG(BPF_JSGE, BPF_REG_4, BPF_REG_2, 2),
4973 BPF_MOV64_IMM(BPF_REG_3, 0), 4973 BPF_MOV64_IMM(BPF_REG_3, 0),
4974 BPF_EMIT_CALL(BPF_FUNC_probe_read), 4974 BPF_EMIT_CALL(BPF_FUNC_probe_read),
4975 BPF_MOV64_IMM(BPF_REG_0, 0), 4975 BPF_MOV64_IMM(BPF_REG_0, 0),
@@ -4995,7 +4995,7 @@ static struct bpf_test tests[] = {
4995 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2, 4995 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2,
4996 sizeof(struct test_val) + 1, 4), 4996 sizeof(struct test_val) + 1, 4),
4997 BPF_MOV64_IMM(BPF_REG_4, 0), 4997 BPF_MOV64_IMM(BPF_REG_4, 0),
4998 BPF_JMP_REG(BPF_JGE, BPF_REG_4, BPF_REG_2, 2), 4998 BPF_JMP_REG(BPF_JSGE, BPF_REG_4, BPF_REG_2, 2),
4999 BPF_MOV64_IMM(BPF_REG_3, 0), 4999 BPF_MOV64_IMM(BPF_REG_3, 0),
5000 BPF_EMIT_CALL(BPF_FUNC_probe_read), 5000 BPF_EMIT_CALL(BPF_FUNC_probe_read),
5001 BPF_MOV64_IMM(BPF_REG_0, 0), 5001 BPF_MOV64_IMM(BPF_REG_0, 0),
@@ -5023,7 +5023,7 @@ static struct bpf_test tests[] = {
5023 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2, 5023 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2,
5024 sizeof(struct test_val) - 20, 4), 5024 sizeof(struct test_val) - 20, 4),
5025 BPF_MOV64_IMM(BPF_REG_4, 0), 5025 BPF_MOV64_IMM(BPF_REG_4, 0),
5026 BPF_JMP_REG(BPF_JGE, BPF_REG_4, BPF_REG_2, 2), 5026 BPF_JMP_REG(BPF_JSGE, BPF_REG_4, BPF_REG_2, 2),
5027 BPF_MOV64_IMM(BPF_REG_3, 0), 5027 BPF_MOV64_IMM(BPF_REG_3, 0),
5028 BPF_EMIT_CALL(BPF_FUNC_probe_read), 5028 BPF_EMIT_CALL(BPF_FUNC_probe_read),
5029 BPF_MOV64_IMM(BPF_REG_0, 0), 5029 BPF_MOV64_IMM(BPF_REG_0, 0),
@@ -5050,7 +5050,7 @@ static struct bpf_test tests[] = {
5050 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2, 5050 BPF_JMP_IMM(BPF_JSGT, BPF_REG_2,
5051 sizeof(struct test_val) - 19, 4), 5051 sizeof(struct test_val) - 19, 4),
5052 BPF_MOV64_IMM(BPF_REG_4, 0), 5052 BPF_MOV64_IMM(BPF_REG_4, 0),
5053 BPF_JMP_REG(BPF_JGE, BPF_REG_4, BPF_REG_2, 2), 5053 BPF_JMP_REG(BPF_JSGE, BPF_REG_4, BPF_REG_2, 2),
5054 BPF_MOV64_IMM(BPF_REG_3, 0), 5054 BPF_MOV64_IMM(BPF_REG_3, 0),
5055 BPF_EMIT_CALL(BPF_FUNC_probe_read), 5055 BPF_EMIT_CALL(BPF_FUNC_probe_read),
5056 BPF_MOV64_IMM(BPF_REG_0, 0), 5056 BPF_MOV64_IMM(BPF_REG_0, 0),
@@ -5510,6 +5510,476 @@ static struct bpf_test tests[] = {
5510 .errstr = "invalid bpf_context access", 5510 .errstr = "invalid bpf_context access",
5511 .prog_type = BPF_PROG_TYPE_LWT_IN, 5511 .prog_type = BPF_PROG_TYPE_LWT_IN,
5512 }, 5512 },
5513 {
5514 "bounds checks mixing signed and unsigned, positive bounds",
5515 .insns = {
5516 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5517 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5518 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5519 BPF_LD_MAP_FD(BPF_REG_1, 0),
5520 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5521 BPF_FUNC_map_lookup_elem),
5522 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
5523 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5524 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5525 BPF_MOV64_IMM(BPF_REG_2, 2),
5526 BPF_JMP_REG(BPF_JGE, BPF_REG_2, BPF_REG_1, 3),
5527 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 4, 2),
5528 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5529 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5530 BPF_MOV64_IMM(BPF_REG_0, 0),
5531 BPF_EXIT_INSN(),
5532 },
5533 .fixup_map1 = { 3 },
5534 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5535 .errstr = "R0 min value is negative",
5536 .result = REJECT,
5537 .result_unpriv = REJECT,
5538 },
5539 {
5540 "bounds checks mixing signed and unsigned",
5541 .insns = {
5542 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5543 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5544 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5545 BPF_LD_MAP_FD(BPF_REG_1, 0),
5546 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5547 BPF_FUNC_map_lookup_elem),
5548 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
5549 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5550 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5551 BPF_MOV64_IMM(BPF_REG_2, -1),
5552 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 3),
5553 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5554 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5555 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5556 BPF_MOV64_IMM(BPF_REG_0, 0),
5557 BPF_EXIT_INSN(),
5558 },
5559 .fixup_map1 = { 3 },
5560 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5561 .errstr = "R0 min value is negative",
5562 .result = REJECT,
5563 .result_unpriv = REJECT,
5564 },
5565 {
5566 "bounds checks mixing signed and unsigned, variant 2",
5567 .insns = {
5568 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5569 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5570 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5571 BPF_LD_MAP_FD(BPF_REG_1, 0),
5572 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5573 BPF_FUNC_map_lookup_elem),
5574 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
5575 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5576 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5577 BPF_MOV64_IMM(BPF_REG_2, -1),
5578 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 5),
5579 BPF_MOV64_IMM(BPF_REG_8, 0),
5580 BPF_ALU64_REG(BPF_ADD, BPF_REG_8, BPF_REG_1),
5581 BPF_JMP_IMM(BPF_JSGT, BPF_REG_8, 1, 2),
5582 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_8),
5583 BPF_ST_MEM(BPF_B, BPF_REG_8, 0, 0),
5584 BPF_MOV64_IMM(BPF_REG_0, 0),
5585 BPF_EXIT_INSN(),
5586 },
5587 .fixup_map1 = { 3 },
5588 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5589 .errstr = "R8 invalid mem access 'inv'",
5590 .result = REJECT,
5591 .result_unpriv = REJECT,
5592 },
5593 {
5594 "bounds checks mixing signed and unsigned, variant 3",
5595 .insns = {
5596 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5597 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5598 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5599 BPF_LD_MAP_FD(BPF_REG_1, 0),
5600 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5601 BPF_FUNC_map_lookup_elem),
5602 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 8),
5603 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5604 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5605 BPF_MOV64_IMM(BPF_REG_2, -1),
5606 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 4),
5607 BPF_MOV64_REG(BPF_REG_8, BPF_REG_1),
5608 BPF_JMP_IMM(BPF_JSGT, BPF_REG_8, 1, 2),
5609 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_8),
5610 BPF_ST_MEM(BPF_B, BPF_REG_8, 0, 0),
5611 BPF_MOV64_IMM(BPF_REG_0, 0),
5612 BPF_EXIT_INSN(),
5613 },
5614 .fixup_map1 = { 3 },
5615 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5616 .errstr = "R8 invalid mem access 'inv'",
5617 .result = REJECT,
5618 .result_unpriv = REJECT,
5619 },
5620 {
5621 "bounds checks mixing signed and unsigned, variant 4",
5622 .insns = {
5623 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5624 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5625 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5626 BPF_LD_MAP_FD(BPF_REG_1, 0),
5627 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5628 BPF_FUNC_map_lookup_elem),
5629 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
5630 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5631 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5632 BPF_MOV64_IMM(BPF_REG_2, 1),
5633 BPF_ALU64_REG(BPF_AND, BPF_REG_1, BPF_REG_2),
5634 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5635 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5636 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5637 BPF_MOV64_IMM(BPF_REG_0, 0),
5638 BPF_EXIT_INSN(),
5639 },
5640 .fixup_map1 = { 3 },
5641 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5642 .errstr = "R0 min value is negative",
5643 .result = REJECT,
5644 .result_unpriv = REJECT,
5645 },
5646 {
5647 "bounds checks mixing signed and unsigned, variant 5",
5648 .insns = {
5649 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5650 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5651 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5652 BPF_LD_MAP_FD(BPF_REG_1, 0),
5653 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5654 BPF_FUNC_map_lookup_elem),
5655 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
5656 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5657 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5658 BPF_MOV64_IMM(BPF_REG_2, -1),
5659 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 5),
5660 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 4),
5661 BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 4),
5662 BPF_ALU64_REG(BPF_SUB, BPF_REG_0, BPF_REG_1),
5663 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5664 BPF_MOV64_IMM(BPF_REG_0, 0),
5665 BPF_EXIT_INSN(),
5666 },
5667 .fixup_map1 = { 3 },
5668 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5669 .errstr = "R0 invalid mem access",
5670 .result = REJECT,
5671 .result_unpriv = REJECT,
5672 },
5673 {
5674 "bounds checks mixing signed and unsigned, variant 6",
5675 .insns = {
5676 BPF_MOV64_IMM(BPF_REG_2, 0),
5677 BPF_MOV64_REG(BPF_REG_3, BPF_REG_10),
5678 BPF_ALU64_IMM(BPF_ADD, BPF_REG_3, -512),
5679 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5680 BPF_LDX_MEM(BPF_DW, BPF_REG_4, BPF_REG_10, -16),
5681 BPF_MOV64_IMM(BPF_REG_6, -1),
5682 BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_6, 5),
5683 BPF_JMP_IMM(BPF_JSGT, BPF_REG_4, 1, 4),
5684 BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 1),
5685 BPF_MOV64_IMM(BPF_REG_5, 0),
5686 BPF_ST_MEM(BPF_H, BPF_REG_10, -512, 0),
5687 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5688 BPF_FUNC_skb_load_bytes),
5689 BPF_MOV64_IMM(BPF_REG_0, 0),
5690 BPF_EXIT_INSN(),
5691 },
5692 .errstr_unpriv = "R4 min value is negative, either use unsigned",
5693 .errstr = "R4 min value is negative, either use unsigned",
5694 .result = REJECT,
5695 .result_unpriv = REJECT,
5696 },
5697 {
5698 "bounds checks mixing signed and unsigned, variant 7",
5699 .insns = {
5700 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5701 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5702 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5703 BPF_LD_MAP_FD(BPF_REG_1, 0),
5704 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5705 BPF_FUNC_map_lookup_elem),
5706 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
5707 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5708 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5709 BPF_MOV64_IMM(BPF_REG_2, 1024 * 1024 * 1024),
5710 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 3),
5711 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5712 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5713 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5714 BPF_MOV64_IMM(BPF_REG_0, 0),
5715 BPF_EXIT_INSN(),
5716 },
5717 .fixup_map1 = { 3 },
5718 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5719 .errstr = "R0 min value is negative",
5720 .result = REJECT,
5721 .result_unpriv = REJECT,
5722 },
5723 {
5724 "bounds checks mixing signed and unsigned, variant 8",
5725 .insns = {
5726 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5727 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5728 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5729 BPF_LD_MAP_FD(BPF_REG_1, 0),
5730 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5731 BPF_FUNC_map_lookup_elem),
5732 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
5733 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5734 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5735 BPF_MOV64_IMM(BPF_REG_2, 1024 * 1024 * 1024 + 1),
5736 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, 3),
5737 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5738 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5739 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5740 BPF_MOV64_IMM(BPF_REG_0, 0),
5741 BPF_EXIT_INSN(),
5742 },
5743 .fixup_map1 = { 3 },
5744 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5745 .errstr = "R0 min value is negative",
5746 .result = REJECT,
5747 .result_unpriv = REJECT,
5748 },
5749 {
5750 "bounds checks mixing signed and unsigned, variant 9",
5751 .insns = {
5752 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5753 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5754 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5755 BPF_LD_MAP_FD(BPF_REG_1, 0),
5756 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5757 BPF_FUNC_map_lookup_elem),
5758 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
5759 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5760 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5761 BPF_MOV64_IMM(BPF_REG_2, -1),
5762 BPF_JMP_REG(BPF_JGT, BPF_REG_2, BPF_REG_1, 2),
5763 BPF_MOV64_IMM(BPF_REG_0, 0),
5764 BPF_EXIT_INSN(),
5765 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5766 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5767 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5768 BPF_MOV64_IMM(BPF_REG_0, 0),
5769 BPF_EXIT_INSN(),
5770 },
5771 .fixup_map1 = { 3 },
5772 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5773 .errstr = "R0 min value is negative",
5774 .result = REJECT,
5775 .result_unpriv = REJECT,
5776 },
5777 {
5778 "bounds checks mixing signed and unsigned, variant 10",
5779 .insns = {
5780 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5781 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5782 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5783 BPF_LD_MAP_FD(BPF_REG_1, 0),
5784 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5785 BPF_FUNC_map_lookup_elem),
5786 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 10),
5787 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5788 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5789 BPF_LD_IMM64(BPF_REG_2, -9223372036854775808ULL),
5790 BPF_JMP_REG(BPF_JGT, BPF_REG_2, BPF_REG_1, 2),
5791 BPF_MOV64_IMM(BPF_REG_0, 0),
5792 BPF_EXIT_INSN(),
5793 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5794 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5795 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5796 BPF_MOV64_IMM(BPF_REG_0, 0),
5797 BPF_EXIT_INSN(),
5798 },
5799 .fixup_map1 = { 3 },
5800 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5801 .errstr = "R0 min value is negative",
5802 .result = REJECT,
5803 .result_unpriv = REJECT,
5804 },
5805 {
5806 "bounds checks mixing signed and unsigned, variant 11",
5807 .insns = {
5808 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5809 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5810 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5811 BPF_LD_MAP_FD(BPF_REG_1, 0),
5812 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5813 BPF_FUNC_map_lookup_elem),
5814 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
5815 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5816 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5817 BPF_MOV64_IMM(BPF_REG_2, 0),
5818 BPF_JMP_REG(BPF_JGT, BPF_REG_2, BPF_REG_1, 2),
5819 BPF_MOV64_IMM(BPF_REG_0, 0),
5820 BPF_EXIT_INSN(),
5821 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5822 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5823 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5824 BPF_MOV64_IMM(BPF_REG_0, 0),
5825 BPF_EXIT_INSN(),
5826 },
5827 .fixup_map1 = { 3 },
5828 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5829 .errstr = "R0 min value is negative",
5830 .result = REJECT,
5831 .result_unpriv = REJECT,
5832 },
5833 {
5834 "bounds checks mixing signed and unsigned, variant 12",
5835 .insns = {
5836 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5837 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5838 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5839 BPF_LD_MAP_FD(BPF_REG_1, 0),
5840 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5841 BPF_FUNC_map_lookup_elem),
5842 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
5843 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5844 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5845 BPF_MOV64_IMM(BPF_REG_2, -1),
5846 BPF_JMP_REG(BPF_JGE, BPF_REG_2, BPF_REG_1, 2),
5847 /* Dead branch. */
5848 BPF_MOV64_IMM(BPF_REG_0, 0),
5849 BPF_EXIT_INSN(),
5850 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5851 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5852 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5853 BPF_MOV64_IMM(BPF_REG_0, 0),
5854 BPF_EXIT_INSN(),
5855 },
5856 .fixup_map1 = { 3 },
5857 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5858 .errstr = "R0 min value is negative",
5859 .result = REJECT,
5860 .result_unpriv = REJECT,
5861 },
5862 {
5863 "bounds checks mixing signed and unsigned, variant 13",
5864 .insns = {
5865 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5866 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5867 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5868 BPF_LD_MAP_FD(BPF_REG_1, 0),
5869 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5870 BPF_FUNC_map_lookup_elem),
5871 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
5872 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5873 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5874 BPF_MOV64_IMM(BPF_REG_2, -6),
5875 BPF_JMP_REG(BPF_JGE, BPF_REG_2, BPF_REG_1, 2),
5876 BPF_MOV64_IMM(BPF_REG_0, 0),
5877 BPF_EXIT_INSN(),
5878 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5879 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5880 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5881 BPF_MOV64_IMM(BPF_REG_0, 0),
5882 BPF_EXIT_INSN(),
5883 },
5884 .fixup_map1 = { 3 },
5885 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5886 .errstr = "R0 min value is negative",
5887 .result = REJECT,
5888 .result_unpriv = REJECT,
5889 },
5890 {
5891 "bounds checks mixing signed and unsigned, variant 14",
5892 .insns = {
5893 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5894 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5895 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5896 BPF_LD_MAP_FD(BPF_REG_1, 0),
5897 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5898 BPF_FUNC_map_lookup_elem),
5899 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 6),
5900 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5901 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5902 BPF_MOV64_IMM(BPF_REG_2, 2),
5903 BPF_JMP_REG(BPF_JGE, BPF_REG_2, BPF_REG_1, 2),
5904 BPF_MOV64_IMM(BPF_REG_7, 1),
5905 BPF_JMP_IMM(BPF_JSGT, BPF_REG_7, 0, 2),
5906 BPF_MOV64_IMM(BPF_REG_0, 0),
5907 BPF_EXIT_INSN(),
5908 BPF_ALU64_REG(BPF_ADD, BPF_REG_7, BPF_REG_1),
5909 BPF_JMP_IMM(BPF_JSGT, BPF_REG_7, 4, 2),
5910 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_7),
5911 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5912 BPF_MOV64_IMM(BPF_REG_0, 0),
5913 BPF_EXIT_INSN(),
5914 },
5915 .fixup_map1 = { 3 },
5916 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5917 .errstr = "R0 min value is negative",
5918 .result = REJECT,
5919 .result_unpriv = REJECT,
5920 },
5921 {
5922 "bounds checks mixing signed and unsigned, variant 15",
5923 .insns = {
5924 BPF_LDX_MEM(BPF_W, BPF_REG_9, BPF_REG_1,
5925 offsetof(struct __sk_buff, mark)),
5926 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5927 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5928 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5929 BPF_LD_MAP_FD(BPF_REG_1, 0),
5930 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5931 BPF_FUNC_map_lookup_elem),
5932 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 8),
5933 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5934 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5935 BPF_MOV64_IMM(BPF_REG_2, -1),
5936 BPF_MOV64_IMM(BPF_REG_8, 2),
5937 BPF_JMP_IMM(BPF_JEQ, BPF_REG_9, 42, 6),
5938 BPF_JMP_REG(BPF_JSGT, BPF_REG_8, BPF_REG_1, 3),
5939 BPF_JMP_IMM(BPF_JSGT, BPF_REG_1, 1, 2),
5940 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5941 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5942 BPF_MOV64_IMM(BPF_REG_0, 0),
5943 BPF_EXIT_INSN(),
5944 BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_2, -3),
5945 BPF_JMP_IMM(BPF_JA, 0, 0, -7),
5946 },
5947 .fixup_map1 = { 4 },
5948 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5949 .errstr = "R0 min value is negative",
5950 .result = REJECT,
5951 .result_unpriv = REJECT,
5952 },
5953 {
5954 "bounds checks mixing signed and unsigned, variant 16",
5955 .insns = {
5956 BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
5957 BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
5958 BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
5959 BPF_LD_MAP_FD(BPF_REG_1, 0),
5960 BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
5961 BPF_FUNC_map_lookup_elem),
5962 BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 4),
5963 BPF_ST_MEM(BPF_DW, BPF_REG_10, -16, -8),
5964 BPF_LDX_MEM(BPF_DW, BPF_REG_1, BPF_REG_10, -16),
5965 BPF_MOV64_IMM(BPF_REG_2, -6),
5966 BPF_JMP_REG(BPF_JGE, BPF_REG_2, BPF_REG_1, 2),
5967 BPF_MOV64_IMM(BPF_REG_0, 0),
5968 BPF_EXIT_INSN(),
5969 BPF_ALU64_REG(BPF_ADD, BPF_REG_0, BPF_REG_1),
5970 BPF_JMP_IMM(BPF_JGT, BPF_REG_0, 1, 2),
5971 BPF_MOV64_IMM(BPF_REG_0, 0),
5972 BPF_EXIT_INSN(),
5973 BPF_ST_MEM(BPF_B, BPF_REG_0, 0, 0),
5974 BPF_MOV64_IMM(BPF_REG_0, 0),
5975 BPF_EXIT_INSN(),
5976 },
5977 .fixup_map1 = { 3 },
5978 .errstr_unpriv = "R0 pointer arithmetic prohibited",
5979 .errstr = "R0 min value is negative",
5980 .result = REJECT,
5981 .result_unpriv = REJECT,
5982 },
5513}; 5983};
5514 5984
5515static int probe_filter_length(const struct bpf_insn *fp) 5985static int probe_filter_length(const struct bpf_insn *fp)
@@ -5633,7 +6103,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
5633 6103
5634 fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER, 6104 fd_prog = bpf_verify_program(prog_type ? : BPF_PROG_TYPE_SOCKET_FILTER,
5635 prog, prog_len, test->flags & F_LOAD_WITH_STRICT_ALIGNMENT, 6105 prog, prog_len, test->flags & F_LOAD_WITH_STRICT_ALIGNMENT,
5636 "GPL", 0, bpf_vlog, sizeof(bpf_vlog)); 6106 "GPL", 0, bpf_vlog, sizeof(bpf_vlog), 1);
5637 6107
5638 expected_ret = unpriv && test->result_unpriv != UNDEF ? 6108 expected_ret = unpriv && test->result_unpriv != UNDEF ?
5639 test->result_unpriv : test->result; 6109 test->result_unpriv : test->result;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 82987d457b8b..f3f74271f1a9 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3883,7 +3883,6 @@ static const struct file_operations *stat_fops[] = {
3883static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) 3883static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
3884{ 3884{
3885 struct kobj_uevent_env *env; 3885 struct kobj_uevent_env *env;
3886 char *tmp, *pathbuf = NULL;
3887 unsigned long long created, active; 3886 unsigned long long created, active;
3888 3887
3889 if (!kvm_dev.this_device || !kvm) 3888 if (!kvm_dev.this_device || !kvm)
@@ -3907,38 +3906,28 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
3907 add_uevent_var(env, "CREATED=%llu", created); 3906 add_uevent_var(env, "CREATED=%llu", created);
3908 add_uevent_var(env, "COUNT=%llu", active); 3907 add_uevent_var(env, "COUNT=%llu", active);
3909 3908
3910 if (type == KVM_EVENT_CREATE_VM) 3909 if (type == KVM_EVENT_CREATE_VM) {
3911 add_uevent_var(env, "EVENT=create"); 3910 add_uevent_var(env, "EVENT=create");
3912 else if (type == KVM_EVENT_DESTROY_VM) 3911 kvm->userspace_pid = task_pid_nr(current);
3912 } else if (type == KVM_EVENT_DESTROY_VM) {
3913 add_uevent_var(env, "EVENT=destroy"); 3913 add_uevent_var(env, "EVENT=destroy");
3914 }
3915 add_uevent_var(env, "PID=%d", kvm->userspace_pid);
3914 3916
3915 if (kvm->debugfs_dentry) { 3917 if (kvm->debugfs_dentry) {
3916 char p[ITOA_MAX_LEN]; 3918 char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL);
3917 3919
3918 snprintf(p, sizeof(p), "%s", kvm->debugfs_dentry->d_name.name); 3920 if (p) {
3919 tmp = strchrnul(p + 1, '-'); 3921 tmp = dentry_path_raw(kvm->debugfs_dentry, p, PATH_MAX);
3920 *tmp = '\0'; 3922 if (!IS_ERR(tmp))
3921 add_uevent_var(env, "PID=%s", p); 3923 add_uevent_var(env, "STATS_PATH=%s", tmp);
3922 pathbuf = kmalloc(PATH_MAX, GFP_KERNEL); 3924 kfree(p);
3923 if (pathbuf) {
3924 /* sizeof counts the final '\0' */
3925 int len = sizeof("STATS_PATH=") - 1;
3926 const char *pvar = "STATS_PATH=";
3927
3928 tmp = dentry_path_raw(kvm->debugfs_dentry,
3929 pathbuf + len,
3930 PATH_MAX - len);
3931 if (!IS_ERR(tmp)) {
3932 memcpy(tmp - len, pvar, len);
3933 env->envp[env->envp_idx++] = tmp - len;
3934 }
3935 } 3925 }
3936 } 3926 }
3937 /* no need for checks, since we are adding at most only 5 keys */ 3927 /* no need for checks, since we are adding at most only 5 keys */
3938 env->envp[env->envp_idx++] = NULL; 3928 env->envp[env->envp_idx++] = NULL;
3939 kobject_uevent_env(&kvm_dev.this_device->kobj, KOBJ_CHANGE, env->envp); 3929 kobject_uevent_env(&kvm_dev.this_device->kobj, KOBJ_CHANGE, env->envp);
3940 kfree(env); 3930 kfree(env);
3941 kfree(pathbuf);
3942} 3931}
3943 3932
3944static int kvm_init_debug(void) 3933static int kvm_init_debug(void)