aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/admin-guide/pm/intel_pstate.rst2
-rw-r--r--Documentation/admin-guide/pm/sleep-states.rst2
-rw-r--r--Documentation/device-mapper/thin-provisioning.txt5
-rw-r--r--Documentation/devicetree/bindings/ata/ahci-platform.txt1
-rw-r--r--Documentation/devicetree/bindings/display/panel/panel-common.txt2
-rw-r--r--Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt1
-rw-r--r--Documentation/devicetree/bindings/net/can/rcar_canfd.txt4
-rw-r--r--Documentation/devicetree/bindings/net/renesas,ravb.txt1
-rw-r--r--Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt6
-rw-r--r--Documentation/devicetree/bindings/serial/renesas,sci-serial.txt2
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt1
-rw-r--r--Documentation/devicetree/overlay-notes.txt8
-rw-r--r--Documentation/doc-guide/parse-headers.rst4
-rw-r--r--Documentation/media/uapi/rc/keytable.c.rst2
-rw-r--r--Documentation/media/uapi/v4l/v4l2grab.c.rst2
-rwxr-xr-xDocumentation/sphinx/parse-headers.pl4
-rw-r--r--Documentation/translations/zh_CN/video4linux/v4l2-framework.txt4
-rw-r--r--MAINTAINERS27
-rw-r--r--Makefile4
-rw-r--r--arch/arm/boot/dts/imx35.dtsi4
-rw-r--r--arch/arm/boot/dts/imx53.dtsi4
-rw-r--r--arch/arm64/include/asm/cputype.h6
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h2
-rw-r--r--arch/arm64/kernel/cpu_errata.c1
-rw-r--r--arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c24
-rw-r--r--arch/arm64/mm/init.c4
-rw-r--r--arch/powerpc/include/asm/ftrace.h29
-rw-r--r--arch/powerpc/include/asm/paca.h1
-rw-r--r--arch/powerpc/include/asm/topology.h13
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/sh/kernel/cpu/sh2/probe.c4
-rw-r--r--arch/sh/kernel/setup.c1
-rw-r--r--arch/sh/mm/consistent.c11
-rw-r--r--arch/sh/mm/init.c68
-rw-r--r--arch/sh/mm/numa.c19
-rw-r--r--arch/x86/kernel/cpu/common.c6
-rw-r--r--arch/x86/kernel/tsc.c22
-rw-r--r--arch/x86/kvm/lapic.c37
-rw-r--r--arch/x86/xen/enlighten_hvm.c13
-rw-r--r--arch/x86/xen/enlighten_pv.c86
-rw-r--r--block/blk-mq.c40
-rw-r--r--block/blk-mq.h4
-rw-r--r--block/genhd.c12
-rw-r--r--block/partition-generic.c10
-rw-r--r--drivers/ata/ahci.c6
-rw-r--r--drivers/ata/ahci.h8
-rw-r--r--drivers/ata/ahci_mvebu.c56
-rw-r--r--drivers/ata/ahci_qoriq.c2
-rw-r--r--drivers/ata/ahci_xgene.c4
-rw-r--r--drivers/ata/libahci.c20
-rw-r--r--drivers/ata/libahci_platform.c24
-rw-r--r--drivers/ata/libata-core.c6
-rw-r--r--drivers/ata/libata-eh.c4
-rw-r--r--drivers/ata/sata_highbank.c2
-rw-r--r--drivers/ata/sata_sil24.c4
-rw-r--r--drivers/atm/firestream.c2
-rw-r--r--drivers/atm/zatm.c3
-rw-r--r--drivers/block/rbd.c4
-rw-r--r--drivers/bluetooth/btusb.c19
-rw-r--r--drivers/char/agp/uninorth-agp.c4
-rw-r--r--drivers/clk/clk-cs2000-cp.c2
-rw-r--r--drivers/clk/clk-mux.c10
-rw-r--r--drivers/clk/clk-stm32mp1.c54
-rw-r--r--drivers/clk/clk.c7
-rw-r--r--drivers/clk/meson/clk-regmap.c11
-rw-r--r--drivers/clk/meson/gxbb-aoclk.h2
-rw-r--r--drivers/clk/meson/meson8b.c5
-rw-r--r--drivers/cpufreq/cppc_cpufreq.c46
-rw-r--r--drivers/gpio/gpio-aspeed.c2
-rw-r--r--drivers/gpio/gpio-pci-idio-16.c8
-rw-r--r--drivers/gpio/gpio-pcie-idio-24.c22
-rw-r--r--drivers/gpio/gpiolib.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c6
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c20
-rw-r--r--drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c86
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c10
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_surface.c14
-rw-r--r--drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h5
-rw-r--r--drivers/gpu/drm/amd/display/include/dal_asic_id.h9
-rw-r--r--drivers/gpu/drm/amd/display/modules/color/color_gamma.c72
-rw-r--r--drivers/gpu/drm/amd/include/atomfirmware.h170
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c52
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h1
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c4
-rw-r--r--drivers/gpu/drm/bridge/Kconfig1
-rw-r--r--drivers/gpu/drm/bridge/dumb-vga-dac.c4
-rw-r--r--drivers/gpu/drm/drm_atomic.c8
-rw-r--r--drivers/gpu/drm/exynos/exynos_hdmi.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c22
-rw-r--r--drivers/gpu/drm/exynos/regs-mixer.h1
-rw-r--r--drivers/gpu/drm/i915/intel_cdclk.c41
-rw-r--r--drivers/gpu/drm/i915/intel_csr.c1
-rw-r--r--drivers/gpu/drm/i915/intel_display.c2
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c20
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_ttm.c6
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c7
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dispc.c20
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4.c2
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4_core.c7
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_connector.c10
-rw-r--r--drivers/gpu/drm/omapdrm/omap_dmm_tiler.c6
-rw-r--r--drivers/gpu/drm/omapdrm/tcm-sita.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc.c11
-rw-r--r--drivers/gpu/drm/ttm/ttm_page_alloc_dma.c3
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c46
-rw-r--r--drivers/gpu/drm/vc4/vc4_dpi.c25
-rw-r--r--drivers/gpu/drm/vc4/vc4_plane.c2
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fb.c31
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c14
-rw-r--r--drivers/hid/Kconfig7
-rw-r--r--drivers/hid/hid-ids.h9
-rw-r--r--drivers/hid/hid-lenovo.c36
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c2
-rw-r--r--drivers/hid/intel-ish-hid/ishtp-hid-client.c36
-rw-r--r--drivers/hid/intel-ish-hid/ishtp/bus.c2
-rw-r--r--drivers/hid/wacom_sys.c4
-rw-r--r--drivers/infiniband/Kconfig5
-rw-r--r--drivers/infiniband/core/cache.c55
-rw-r--r--drivers/infiniband/core/cma.c60
-rw-r--r--drivers/infiniband/core/iwpm_util.c5
-rw-r--r--drivers/infiniband/core/mad.c4
-rw-r--r--drivers/infiniband/core/roce_gid_mgmt.c26
-rw-r--r--drivers/infiniband/core/ucma.c44
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c6
-rw-r--r--drivers/infiniband/core/uverbs_ioctl.c9
-rw-r--r--drivers/infiniband/core/uverbs_std_types_flow_action.c12
-rw-r--r--drivers/infiniband/core/verbs.c1
-rw-r--r--drivers/infiniband/hw/cxgb4/cq.c11
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c9
-rw-r--r--drivers/infiniband/hw/cxgb4/iw_cxgb4.h6
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c4
-rw-r--r--drivers/infiniband/hw/cxgb4/resource.c26
-rw-r--r--drivers/infiniband/hw/hfi1/affinity.c11
-rw-r--r--drivers/infiniband/hw/hfi1/driver.c19
-rw-r--r--drivers/infiniband/hw/hfi1/hfi.h8
-rw-r--r--drivers/infiniband/hw/hfi1/init.c43
-rw-r--r--drivers/infiniband/hw/hfi1/pcie.c3
-rw-r--r--drivers/infiniband/hw/hfi1/platform.c1
-rw-r--r--drivers/infiniband/hw/hfi1/qsfp.c2
-rw-r--r--drivers/infiniband/hw/hfi1/ruc.c50
-rw-r--r--drivers/infiniband/hw/hfi1/ud.c4
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_hem.c12
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_hw_v2.c49
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_qp.c2
-rw-r--r--drivers/infiniband/hw/mlx4/mr.c2
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c3
-rw-r--r--drivers/infiniband/hw/mlx5/Kconfig1
-rw-r--r--drivers/infiniband/hw/mlx5/main.c7
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c32
-rw-r--r--drivers/infiniband/hw/mlx5/qp.c22
-rw-r--r--drivers/infiniband/hw/nes/nes_nic.c2
-rw-r--r--drivers/infiniband/sw/rxe/rxe_opcode.c2
-rw-r--r--drivers/infiniband/sw/rxe/rxe_req.c1
-rw-r--r--drivers/infiniband/sw/rxe/rxe_resp.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c2
-rw-r--r--drivers/infiniband/ulp/srp/Kconfig2
-rw-r--r--drivers/infiniband/ulp/srpt/Kconfig2
-rw-r--r--drivers/iommu/amd_iommu.c2
-rw-r--r--drivers/iommu/dma-iommu.c54
-rw-r--r--drivers/iommu/dmar.c2
-rw-r--r--drivers/iommu/intel_irq_remapping.c2
-rw-r--r--drivers/iommu/rockchip-iommu.c11
-rw-r--r--drivers/irqchip/qcom-irq-combiner.c4
-rw-r--r--drivers/md/bcache/alloc.c5
-rw-r--r--drivers/md/bcache/bcache.h4
-rw-r--r--drivers/md/bcache/debug.c3
-rw-r--r--drivers/md/bcache/io.c8
-rw-r--r--drivers/md/bcache/request.c5
-rw-r--r--drivers/md/bcache/super.c75
-rw-r--r--drivers/md/bcache/writeback.c4
-rw-r--r--drivers/md/dm-bufio.c5
-rw-r--r--drivers/md/dm-cache-background-tracker.c2
-rw-r--r--drivers/md/dm-integrity.c2
-rw-r--r--drivers/md/dm-raid1.c10
-rw-r--r--drivers/md/dm.c7
-rw-r--r--drivers/media/i2c/saa7115.c2
-rw-r--r--drivers/media/i2c/saa711x_regs.h2
-rw-r--r--drivers/media/i2c/tda7432.c2
-rw-r--r--drivers/media/i2c/tvp5150.c2
-rw-r--r--drivers/media/i2c/tvp5150_reg.h2
-rw-r--r--drivers/media/i2c/tvp7002.c2
-rw-r--r--drivers/media/i2c/tvp7002_reg.h2
-rw-r--r--drivers/media/media-devnode.c2
-rw-r--r--drivers/media/pci/bt8xx/bttv-audio-hook.c2
-rw-r--r--drivers/media/pci/bt8xx/bttv-audio-hook.h2
-rw-r--r--drivers/media/pci/bt8xx/bttv-cards.c4
-rw-r--r--drivers/media/pci/bt8xx/bttv-driver.c2
-rw-r--r--drivers/media/pci/bt8xx/bttv-i2c.c2
-rw-r--r--drivers/media/pci/cx23885/cx23885-input.c2
-rw-r--r--drivers/media/pci/cx88/cx88-alsa.c4
-rw-r--r--drivers/media/pci/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/pci/cx88/cx88-core.c2
-rw-r--r--drivers/media/pci/cx88/cx88-i2c.c2
-rw-r--r--drivers/media/pci/cx88/cx88-video.c2
-rw-r--r--drivers/media/radio/radio-aimslab.c2
-rw-r--r--drivers/media/radio/radio-aztech.c2
-rw-r--r--drivers/media/radio/radio-gemtek.c2
-rw-r--r--drivers/media/radio/radio-maxiradio.c2
-rw-r--r--drivers/media/radio/radio-rtrack2.c2
-rw-r--r--drivers/media/radio/radio-sf16fmi.c2
-rw-r--r--drivers/media/radio/radio-terratec.c2
-rw-r--r--drivers/media/radio/radio-trust.c2
-rw-r--r--drivers/media/radio/radio-typhoon.c2
-rw-r--r--drivers/media/radio/radio-zoltrix.c2
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-m135a.c2
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv-fm53.c2
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv2.c2
-rw-r--r--drivers/media/rc/keymaps/rc-kaiomy.c2
-rw-r--r--drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c2
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview-new.c2
-rw-r--r--drivers/media/tuners/tea5761.c4
-rw-r--r--drivers/media/tuners/tea5767.c4
-rw-r--r--drivers/media/tuners/tuner-xc2028-types.h2
-rw-r--r--drivers/media/tuners/tuner-xc2028.c4
-rw-r--r--drivers/media/tuners/tuner-xc2028.h2
-rw-r--r--drivers/media/usb/em28xx/em28xx-camera.c2
-rw-r--r--drivers/media/usb/em28xx/em28xx-cards.c2
-rw-r--r--drivers/media/usb/em28xx/em28xx-core.c4
-rw-r--r--drivers/media/usb/em28xx/em28xx-dvb.c4
-rw-r--r--drivers/media/usb/em28xx/em28xx-i2c.c2
-rw-r--r--drivers/media/usb/em28xx/em28xx-input.c2
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c4
-rw-r--r--drivers/media/usb/em28xx/em28xx.h2
-rw-r--r--drivers/media/usb/gspca/zc3xx-reg.h2
-rw-r--r--drivers/media/usb/tm6000/tm6000-cards.c2
-rw-r--r--drivers/media/usb/tm6000/tm6000-core.c2
-rw-r--r--drivers/media/usb/tm6000/tm6000-i2c.c2
-rw-r--r--drivers/media/usb/tm6000/tm6000-regs.h2
-rw-r--r--drivers/media/usb/tm6000/tm6000-usb-isoc.h2
-rw-r--r--drivers/media/usb/tm6000/tm6000-video.c2
-rw-r--r--drivers/media/usb/tm6000/tm6000.h2
-rw-r--r--drivers/media/v4l2-core/v4l2-dev.c4
-rw-r--r--drivers/media/v4l2-core/v4l2-ioctl.c2
-rw-r--r--drivers/media/v4l2-core/videobuf-core.c6
-rw-r--r--drivers/media/v4l2-core/videobuf-dma-contig.c2
-rw-r--r--drivers/media/v4l2-core/videobuf-dma-sg.c6
-rw-r--r--drivers/media/v4l2-core/videobuf-vmalloc.c4
-rw-r--r--drivers/mtd/nand/onenand/omap2.c105
-rw-r--r--drivers/mtd/nand/raw/marvell_nand.c12
-rw-r--r--drivers/mtd/nand/raw/nand_base.c5
-rw-r--r--drivers/net/bonding/bond_alb.c15
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/can/dev.c2
-rw-r--r--drivers/net/can/flexcan.c26
-rw-r--r--drivers/net/can/spi/hi311x.c11
-rw-r--r--drivers/net/can/usb/kvaser_usb.c2
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c26
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.h1
-rw-r--r--drivers/net/dsa/mv88e6xxx/global2.c2
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.c3
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_nic.h1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c20
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c9
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c7
-rw-r--r--drivers/net/ethernet/intel/ice/ice_controlq.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c3
-rw-r--r--drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h7
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eq.c28
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core.c4
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/main.c19
-rw-r--r--drivers/net/ethernet/ni/nixge.c10
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_l2.c6
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_main.c2
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_rdma.c2
-rw-r--r--drivers/net/ethernet/realtek/r8169.c3
-rw-r--r--drivers/net/ethernet/sun/niu.c5
-rw-r--r--drivers/net/hyperv/netvsc_drv.c3
-rw-r--r--drivers/net/hyperv/rndis_filter.c2
-rw-r--r--drivers/net/ieee802154/atusb.c2
-rw-r--r--drivers/net/ieee802154/mcr20a.c15
-rw-r--r--drivers/net/phy/broadcom.c10
-rw-r--r--drivers/net/phy/sfp-bus.c2
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c1
-rw-r--r--drivers/nvme/host/Kconfig2
-rw-r--r--drivers/nvme/host/core.c27
-rw-r--r--drivers/nvme/host/fabrics.c6
-rw-r--r--drivers/nvme/host/multipath.c24
-rw-r--r--drivers/nvme/host/nvme.h12
-rw-r--r--drivers/nvme/target/Kconfig2
-rw-r--r--drivers/nvme/target/loop.c6
-rw-r--r--drivers/of/overlay.c30
-rw-r--r--drivers/pci/pci.c37
-rw-r--r--drivers/pinctrl/intel/pinctrl-cherryview.c16
-rw-r--r--drivers/pinctrl/intel/pinctrl-sunrisepoint.c45
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson-axg.c2
-rw-r--r--drivers/platform/x86/Kconfig2
-rw-r--r--drivers/platform/x86/asus-wireless.c4
-rw-r--r--drivers/remoteproc/qcom_q6v5_pil.c2
-rw-r--r--drivers/remoteproc/remoteproc_core.c4
-rw-r--r--drivers/rpmsg/rpmsg_char.c2
-rw-r--r--drivers/staging/media/imx/imx-media-csi.c2
-rw-r--r--drivers/usb/core/config.c4
-rw-r--r--drivers/usb/dwc2/core.h2
-rw-r--r--drivers/usb/dwc2/gadget.c21
-rw-r--r--drivers/usb/dwc2/hcd.c13
-rw-r--r--drivers/usb/dwc2/pci.c4
-rw-r--r--drivers/usb/dwc3/gadget.c4
-rw-r--r--drivers/usb/gadget/function/f_phonet.c2
-rw-r--r--drivers/usb/host/ehci-mem.c3
-rw-r--r--drivers/usb/host/ehci-sched.c6
-rw-r--r--drivers/usb/host/xhci.c1
-rw-r--r--drivers/usb/musb/musb_gadget.c3
-rw-r--r--drivers/usb/musb/musb_host.c4
-rw-r--r--drivers/usb/serial/option.c5
-rw-r--r--drivers/usb/serial/visor.c69
-rw-r--r--drivers/usb/typec/tcpm.c1
-rw-r--r--drivers/usb/typec/tps6598x.c47
-rw-r--r--fs/btrfs/extent-tree.c7
-rw-r--r--fs/btrfs/relocation.c2
-rw-r--r--fs/btrfs/send.c4
-rw-r--r--fs/ceph/file.c205
-rw-r--r--fs/cifs/Kconfig2
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--fs/xfs/xfs_file.c10
-rw-r--r--include/dt-bindings/clock/stm32mp1-clks.h4
-rw-r--r--include/kvm/arm_vgic.h1
-rw-r--r--include/linux/brcmphy.h1
-rw-r--r--include/linux/ceph/osd_client.h12
-rw-r--r--include/linux/clk-provider.h3
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/remoteproc.h2
-rw-r--r--include/linux/usb/composite.h2
-rw-r--r--include/linux/wait_bit.h17
-rw-r--r--include/media/i2c/tvp7002.h2
-rw-r--r--include/media/videobuf-core.h4
-rw-r--r--include/media/videobuf-dma-sg.h4
-rw-r--r--include/media/videobuf-vmalloc.h2
-rw-r--r--include/net/bonding.h1
-rw-r--r--include/net/flow_dissector.h2
-rw-r--r--include/net/mac80211.h2
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/trace/events/rxrpc.h85
-rw-r--r--include/trace/events/sunrpc.h16
-rw-r--r--include/uapi/linux/if_infiniband.h2
-rw-r--r--include/uapi/linux/nl80211.h2
-rw-r--r--include/uapi/linux/rds.h2
-rw-r--r--include/uapi/linux/tls.h2
-rw-r--r--include/uapi/rdma/cxgb3-abi.h2
-rw-r--r--include/uapi/rdma/cxgb4-abi.h2
-rw-r--r--include/uapi/rdma/hns-abi.h2
-rw-r--r--include/uapi/rdma/ib_user_cm.h2
-rw-r--r--include/uapi/rdma/ib_user_ioctl_verbs.h2
-rw-r--r--include/uapi/rdma/ib_user_mad.h2
-rw-r--r--include/uapi/rdma/ib_user_sa.h2
-rw-r--r--include/uapi/rdma/ib_user_verbs.h2
-rw-r--r--include/uapi/rdma/mlx4-abi.h2
-rw-r--r--include/uapi/rdma/mlx5-abi.h2
-rw-r--r--include/uapi/rdma/mthca-abi.h2
-rw-r--r--include/uapi/rdma/nes-abi.h2
-rw-r--r--include/uapi/rdma/qedr-abi.h2
-rw-r--r--include/uapi/rdma/rdma_user_cm.h2
-rw-r--r--include/uapi/rdma/rdma_user_ioctl.h2
-rw-r--r--include/uapi/rdma/rdma_user_rxe.h2
-rw-r--r--init/main.c2
-rw-r--r--kernel/bpf/syscall.c19
-rw-r--r--kernel/compat.c1
-rw-r--r--kernel/sched/cpufreq_schedutil.c16
-rw-r--r--kernel/time/clocksource.c63
-rw-r--r--kernel/trace/ftrace.c4
-rw-r--r--kernel/trace/trace_events_filter.c3
-rw-r--r--kernel/trace/trace_stack.c2
-rw-r--r--mm/backing-dev.c3
-rw-r--r--mm/mmap.c32
-rw-r--r--net/9p/trans_common.c2
-rw-r--r--net/9p/trans_fd.c4
-rw-r--r--net/9p/trans_rdma.c4
-rw-r--r--net/9p/trans_virtio.c5
-rw-r--r--net/9p/trans_xen.c2
-rw-r--r--net/atm/lec.c9
-rw-r--r--net/ceph/osd_client.c27
-rw-r--r--net/ieee802154/6lowpan/6lowpan_i.h4
-rw-r--r--net/ieee802154/6lowpan/reassembly.c14
-rw-r--r--net/ipv4/ping.c7
-rw-r--r--net/ipv4/route.c1
-rw-r--r--net/ipv4/udp.c11
-rw-r--r--net/ipv6/Kconfig9
-rw-r--r--net/ipv6/ip6_vti.c4
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/ipv6/xfrm6_tunnel.c3
-rw-r--r--net/key/af_key.c45
-rw-r--r--net/llc/af_llc.c3
-rw-r--r--net/mac80211/agg-tx.c4
-rw-r--r--net/mac80211/mlme.c27
-rw-r--r--net/mac80211/tx.c3
-rw-r--r--net/netlink/af_netlink.c6
-rw-r--r--net/nsh/nsh.c4
-rw-r--r--net/openvswitch/flow_netlink.c9
-rw-r--r--net/rfkill/rfkill-gpio.c7
-rw-r--r--net/rxrpc/af_rxrpc.c2
-rw-r--r--net/rxrpc/ar-internal.h1
-rw-r--r--net/rxrpc/conn_event.c11
-rw-r--r--net/rxrpc/input.c2
-rw-r--r--net/rxrpc/local_event.c3
-rw-r--r--net/rxrpc/local_object.c57
-rw-r--r--net/rxrpc/output.c34
-rw-r--r--net/rxrpc/peer_event.c46
-rw-r--r--net/rxrpc/rxkad.c6
-rw-r--r--net/rxrpc/sendmsg.c10
-rw-r--r--net/sched/act_skbedit.c3
-rw-r--r--net/sched/act_skbmod.c5
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sctp/associola.c30
-rw-r--r--net/sctp/sm_make_chunk.c2
-rw-r--r--net/sctp/sm_statefuns.c86
-rw-r--r--net/sctp/ulpevent.c1
-rw-r--r--net/sunrpc/xprtrdma/fmr_ops.c5
-rw-r--r--net/sunrpc/xprtrdma/frwr_ops.c9
-rw-r--r--net/sunrpc/xprtrdma/verbs.c5
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h2
-rw-r--r--net/tipc/node.c15
-rw-r--r--net/tipc/socket.c3
-rw-r--r--net/tls/tls_main.c14
-rw-r--r--net/wireless/core.c3
-rw-r--r--net/wireless/nl80211.c1
-rw-r--r--net/wireless/reg.c1
-rw-r--r--net/xfrm/xfrm_state.c6
-rw-r--r--scripts/Makefile.gcc-plugins2
-rw-r--r--scripts/Makefile.lib2
-rw-r--r--scripts/dtc/checks.c5
-rwxr-xr-xscripts/extract_xc3028.pl2
-rw-r--r--scripts/genksyms/Makefile4
-rw-r--r--scripts/mod/sumversion.c9
-rwxr-xr-xscripts/split-man.pl2
-rw-r--r--sound/core/pcm_compat.c2
-rw-r--r--sound/core/seq/seq_virmidi.c4
-rw-r--r--sound/drivers/aloop.c17
-rw-r--r--sound/firewire/amdtp-stream.c5
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--tools/power/acpi/Makefile.config1
-rw-r--r--tools/testing/selftests/net/Makefile4
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json11
-rw-r--r--virt/kvm/arm/vgic/vgic-init.c2
-rw-r--r--virt/kvm/arm/vgic/vgic-mmio.c10
-rw-r--r--virt/kvm/arm/vgic/vgic-v2.c38
-rw-r--r--virt/kvm/arm/vgic/vgic-v3.c49
-rw-r--r--virt/kvm/arm/vgic/vgic.c30
-rw-r--r--virt/kvm/arm/vgic/vgic.h14
449 files changed, 3193 insertions, 1652 deletions
diff --git a/Documentation/admin-guide/pm/intel_pstate.rst b/Documentation/admin-guide/pm/intel_pstate.rst
index d2b6fda3d67b..ab2fe0eda1d7 100644
--- a/Documentation/admin-guide/pm/intel_pstate.rst
+++ b/Documentation/admin-guide/pm/intel_pstate.rst
@@ -145,7 +145,7 @@ feature enabled.]
145 145
146In this mode ``intel_pstate`` registers utilization update callbacks with the 146In this mode ``intel_pstate`` registers utilization update callbacks with the
147CPU scheduler in order to run a P-state selection algorithm, either 147CPU scheduler in order to run a P-state selection algorithm, either
148``powersave`` or ``performance``, depending on the ``scaling_cur_freq`` policy 148``powersave`` or ``performance``, depending on the ``scaling_governor`` policy
149setting in ``sysfs``. The current CPU frequency information to be made 149setting in ``sysfs``. The current CPU frequency information to be made
150available from the ``scaling_cur_freq`` policy attribute in ``sysfs`` is 150available from the ``scaling_cur_freq`` policy attribute in ``sysfs`` is
151periodically updated by those utilization update callbacks too. 151periodically updated by those utilization update callbacks too.
diff --git a/Documentation/admin-guide/pm/sleep-states.rst b/Documentation/admin-guide/pm/sleep-states.rst
index 1e5c0f00cb2f..dbf5acd49f35 100644
--- a/Documentation/admin-guide/pm/sleep-states.rst
+++ b/Documentation/admin-guide/pm/sleep-states.rst
@@ -15,7 +15,7 @@ Sleep States That Can Be Supported
15================================== 15==================================
16 16
17Depending on its configuration and the capabilities of the platform it runs on, 17Depending on its configuration and the capabilities of the platform it runs on,
18the Linux kernel can support up to four system sleep states, includig 18the Linux kernel can support up to four system sleep states, including
19hibernation and up to three variants of system suspend. The sleep states that 19hibernation and up to three variants of system suspend. The sleep states that
20can be supported by the kernel are listed below. 20can be supported by the kernel are listed below.
21 21
diff --git a/Documentation/device-mapper/thin-provisioning.txt b/Documentation/device-mapper/thin-provisioning.txt
index 4bcd4b7f79f9..3d01948ea061 100644
--- a/Documentation/device-mapper/thin-provisioning.txt
+++ b/Documentation/device-mapper/thin-provisioning.txt
@@ -264,7 +264,10 @@ i) Constructor
264 data device, but just remove the mapping. 264 data device, but just remove the mapping.
265 265
266 read_only: Don't allow any changes to be made to the pool 266 read_only: Don't allow any changes to be made to the pool
267 metadata. 267 metadata. This mode is only available after the
268 thin-pool has been created and first used in full
269 read/write mode. It cannot be specified on initial
270 thin-pool creation.
268 271
269 error_if_no_space: Error IOs, instead of queueing, if no space. 272 error_if_no_space: Error IOs, instead of queueing, if no space.
270 273
diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
index f4006d3c9fdf..c760ecb81381 100644
--- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
@@ -30,7 +30,6 @@ compatible:
30Optional properties: 30Optional properties:
31- dma-coherent : Present if dma operations are coherent 31- dma-coherent : Present if dma operations are coherent
32- clocks : a list of phandle + clock specifier pairs 32- clocks : a list of phandle + clock specifier pairs
33- resets : a list of phandle + reset specifier pairs
34- target-supply : regulator for SATA target power 33- target-supply : regulator for SATA target power
35- phys : reference to the SATA PHY node 34- phys : reference to the SATA PHY node
36- phy-names : must be "sata-phy" 35- phy-names : must be "sata-phy"
diff --git a/Documentation/devicetree/bindings/display/panel/panel-common.txt b/Documentation/devicetree/bindings/display/panel/panel-common.txt
index 557fa765adcb..5d2519af4bb5 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-common.txt
+++ b/Documentation/devicetree/bindings/display/panel/panel-common.txt
@@ -38,7 +38,7 @@ Display Timings
38 require specific display timings. The panel-timing subnode expresses those 38 require specific display timings. The panel-timing subnode expresses those
39 timings as specified in the timing subnode section of the display timing 39 timings as specified in the timing subnode section of the display timing
40 bindings defined in 40 bindings defined in
41 Documentation/devicetree/bindings/display/display-timing.txt. 41 Documentation/devicetree/bindings/display/panel/display-timing.txt.
42 42
43 43
44Connectivity 44Connectivity
diff --git a/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt b/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
index aadfb236d53a..61315eaa7660 100644
--- a/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
+++ b/Documentation/devicetree/bindings/dma/renesas,rcar-dmac.txt
@@ -26,6 +26,7 @@ Required Properties:
26 - "renesas,dmac-r8a7794" (R-Car E2) 26 - "renesas,dmac-r8a7794" (R-Car E2)
27 - "renesas,dmac-r8a7795" (R-Car H3) 27 - "renesas,dmac-r8a7795" (R-Car H3)
28 - "renesas,dmac-r8a7796" (R-Car M3-W) 28 - "renesas,dmac-r8a7796" (R-Car M3-W)
29 - "renesas,dmac-r8a77965" (R-Car M3-N)
29 - "renesas,dmac-r8a77970" (R-Car V3M) 30 - "renesas,dmac-r8a77970" (R-Car V3M)
30 - "renesas,dmac-r8a77980" (R-Car V3H) 31 - "renesas,dmac-r8a77980" (R-Car V3H)
31 32
diff --git a/Documentation/devicetree/bindings/net/can/rcar_canfd.txt b/Documentation/devicetree/bindings/net/can/rcar_canfd.txt
index 93c3a6ae32f9..ac71daa46195 100644
--- a/Documentation/devicetree/bindings/net/can/rcar_canfd.txt
+++ b/Documentation/devicetree/bindings/net/can/rcar_canfd.txt
@@ -5,7 +5,9 @@ Required properties:
5- compatible: Must contain one or more of the following: 5- compatible: Must contain one or more of the following:
6 - "renesas,rcar-gen3-canfd" for R-Car Gen3 compatible controller. 6 - "renesas,rcar-gen3-canfd" for R-Car Gen3 compatible controller.
7 - "renesas,r8a7795-canfd" for R8A7795 (R-Car H3) compatible controller. 7 - "renesas,r8a7795-canfd" for R8A7795 (R-Car H3) compatible controller.
8 - "renesas,r8a7796-canfd" for R8A7796 (R-Car M3) compatible controller. 8 - "renesas,r8a7796-canfd" for R8A7796 (R-Car M3-W) compatible controller.
9 - "renesas,r8a77970-canfd" for R8A77970 (R-Car V3M) compatible controller.
10 - "renesas,r8a77980-canfd" for R8A77980 (R-Car V3H) compatible controller.
9 11
10 When compatible with the generic version, nodes must list the 12 When compatible with the generic version, nodes must list the
11 SoC-specific version corresponding to the platform first, followed by the 13 SoC-specific version corresponding to the platform first, followed by the
diff --git a/Documentation/devicetree/bindings/net/renesas,ravb.txt b/Documentation/devicetree/bindings/net/renesas,ravb.txt
index c306f55d335b..890526dbfc26 100644
--- a/Documentation/devicetree/bindings/net/renesas,ravb.txt
+++ b/Documentation/devicetree/bindings/net/renesas,ravb.txt
@@ -18,6 +18,7 @@ Required properties:
18 18
19 - "renesas,etheravb-r8a7795" for the R8A7795 SoC. 19 - "renesas,etheravb-r8a7795" for the R8A7795 SoC.
20 - "renesas,etheravb-r8a7796" for the R8A7796 SoC. 20 - "renesas,etheravb-r8a7796" for the R8A7796 SoC.
21 - "renesas,etheravb-r8a77965" for the R8A77965 SoC.
21 - "renesas,etheravb-r8a77970" for the R8A77970 SoC. 22 - "renesas,etheravb-r8a77970" for the R8A77970 SoC.
22 - "renesas,etheravb-r8a77980" for the R8A77980 SoC. 23 - "renesas,etheravb-r8a77980" for the R8A77980 SoC.
23 - "renesas,etheravb-r8a77995" for the R8A77995 SoC. 24 - "renesas,etheravb-r8a77995" for the R8A77995 SoC.
diff --git a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
index ed5eb547afc8..64bc5c2a76da 100644
--- a/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
@@ -56,9 +56,9 @@ pins it needs, and how they should be configured, with regard to muxer
56configuration, drive strength and pullups. If one of these options is 56configuration, drive strength and pullups. If one of these options is
57not set, its actual value will be unspecified. 57not set, its actual value will be unspecified.
58 58
59This driver supports the generic pin multiplexing and configuration 59Allwinner A1X Pin Controller supports the generic pin multiplexing and
60bindings. For details on each properties, you can refer to 60configuration bindings. For details on each properties, you can refer to
61./pinctrl-bindings.txt. 61 ./pinctrl-bindings.txt.
62 62
63Required sub-node properties: 63Required sub-node properties:
64 - pins 64 - pins
diff --git a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
index a006ea4d065f..106808b55b6d 100644
--- a/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
+++ b/Documentation/devicetree/bindings/serial/renesas,sci-serial.txt
@@ -43,6 +43,8 @@ Required properties:
43 - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART. 43 - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART.
44 - "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART. 44 - "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART.
45 - "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART. 45 - "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART.
46 - "renesas,scif-r8a77965" for R8A77965 (R-Car M3-N) SCIF compatible UART.
47 - "renesas,hscif-r8a77965" for R8A77965 (R-Car M3-N) HSCIF compatible UART.
46 - "renesas,scif-r8a77970" for R8A77970 (R-Car V3M) SCIF compatible UART. 48 - "renesas,scif-r8a77970" for R8A77970 (R-Car V3M) SCIF compatible UART.
47 - "renesas,hscif-r8a77970" for R8A77970 (R-Car V3M) HSCIF compatible UART. 49 - "renesas,hscif-r8a77970" for R8A77970 (R-Car V3M) HSCIF compatible UART.
48 - "renesas,scif-r8a77980" for R8A77980 (R-Car V3H) SCIF compatible UART. 50 - "renesas,scif-r8a77980" for R8A77980 (R-Car V3H) SCIF compatible UART.
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index b5f978a4cac6..a38d8bfae19c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -182,6 +182,7 @@ karo Ka-Ro electronics GmbH
182keithkoep Keith & Koep GmbH 182keithkoep Keith & Koep GmbH
183keymile Keymile GmbH 183keymile Keymile GmbH
184khadas Khadas 184khadas Khadas
185kiebackpeter Kieback & Peter GmbH
185kinetic Kinetic Technologies 186kinetic Kinetic Technologies
186kingnovel Kingnovel Technology Co., Ltd. 187kingnovel Kingnovel Technology Co., Ltd.
187kosagi Sutajio Ko-Usagi PTE Ltd. 188kosagi Sutajio Ko-Usagi PTE Ltd.
diff --git a/Documentation/devicetree/overlay-notes.txt b/Documentation/devicetree/overlay-notes.txt
index a4feb6dde8cd..725fb8d255c1 100644
--- a/Documentation/devicetree/overlay-notes.txt
+++ b/Documentation/devicetree/overlay-notes.txt
@@ -98,6 +98,14 @@ Finally, if you need to remove all overlays in one-go, just call
98of_overlay_remove_all() which will remove every single one in the correct 98of_overlay_remove_all() which will remove every single one in the correct
99order. 99order.
100 100
101In addition, there is the option to register notifiers that get called on
102overlay operations. See of_overlay_notifier_register/unregister and
103enum of_overlay_notify_action for details.
104
105Note that a notifier callback is not supposed to store pointers to a device
106tree node or its content beyond OF_OVERLAY_POST_REMOVE corresponding to the
107respective node it received.
108
101Overlay DTS Format 109Overlay DTS Format
102------------------ 110------------------
103 111
diff --git a/Documentation/doc-guide/parse-headers.rst b/Documentation/doc-guide/parse-headers.rst
index 96a0423d5dba..82a3e43b6864 100644
--- a/Documentation/doc-guide/parse-headers.rst
+++ b/Documentation/doc-guide/parse-headers.rst
@@ -177,14 +177,14 @@ BUGS
177**** 177****
178 178
179 179
180Report bugs to Mauro Carvalho Chehab <mchehab@s-opensource.com> 180Report bugs to Mauro Carvalho Chehab <mchehab@kernel.org>
181 181
182 182
183COPYRIGHT 183COPYRIGHT
184********* 184*********
185 185
186 186
187Copyright (c) 2016 by Mauro Carvalho Chehab <mchehab@s-opensource.com>. 187Copyright (c) 2016 by Mauro Carvalho Chehab <mchehab+samsung@kernel.org>.
188 188
189License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>. 189License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
190 190
diff --git a/Documentation/media/uapi/rc/keytable.c.rst b/Documentation/media/uapi/rc/keytable.c.rst
index e6ce1e3f5a78..217237f93b37 100644
--- a/Documentation/media/uapi/rc/keytable.c.rst
+++ b/Documentation/media/uapi/rc/keytable.c.rst
@@ -7,7 +7,7 @@ file: uapi/v4l/keytable.c
7 7
8 /* keytable.c - This program allows checking/replacing keys at IR 8 /* keytable.c - This program allows checking/replacing keys at IR
9 9
10 Copyright (C) 2006-2009 Mauro Carvalho Chehab <mchehab@infradead.org> 10 Copyright (C) 2006-2009 Mauro Carvalho Chehab <mchehab@kernel.org>
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 13 it under the terms of the GNU General Public License as published by
diff --git a/Documentation/media/uapi/v4l/v4l2grab.c.rst b/Documentation/media/uapi/v4l/v4l2grab.c.rst
index 5aabd0b7b089..f0d0ab6abd41 100644
--- a/Documentation/media/uapi/v4l/v4l2grab.c.rst
+++ b/Documentation/media/uapi/v4l/v4l2grab.c.rst
@@ -6,7 +6,7 @@ file: media/v4l/v4l2grab.c
6.. code-block:: c 6.. code-block:: c
7 7
8 /* V4L2 video picture grabber 8 /* V4L2 video picture grabber
9 Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org> 9 Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@kernel.org>
10 10
11 This program is free software; you can redistribute it and/or modify 11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by 12 it under the terms of the GNU General Public License as published by
diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl
index a958d8b5e99d..d410f47567e9 100755
--- a/Documentation/sphinx/parse-headers.pl
+++ b/Documentation/sphinx/parse-headers.pl
@@ -387,11 +387,11 @@ tree for more details.
387 387
388=head1 BUGS 388=head1 BUGS
389 389
390Report bugs to Mauro Carvalho Chehab <mchehab@s-opensource.com> 390Report bugs to Mauro Carvalho Chehab <mchehab@kernel.org>
391 391
392=head1 COPYRIGHT 392=head1 COPYRIGHT
393 393
394Copyright (c) 2016 by Mauro Carvalho Chehab <mchehab@s-opensource.com>. 394Copyright (c) 2016 by Mauro Carvalho Chehab <mchehab+samsung@kernel.org>.
395 395
396License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>. 396License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>.
397 397
diff --git a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
index 698660b7f21f..c77c0f060864 100644
--- a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
@@ -6,7 +6,7 @@ communicating in English you can also ask the Chinese maintainer for
6help. Contact the Chinese maintainer if this translation is outdated 6help. Contact the Chinese maintainer if this translation is outdated
7or if there is a problem with the translation. 7or if there is a problem with the translation.
8 8
9Maintainer: Mauro Carvalho Chehab <mchehab@infradead.org> 9Maintainer: Mauro Carvalho Chehab <mchehab@kernel.org>
10Chinese maintainer: Fu Wei <tekkamanninja@gmail.com> 10Chinese maintainer: Fu Wei <tekkamanninja@gmail.com>
11--------------------------------------------------------------------- 11---------------------------------------------------------------------
12Documentation/video4linux/v4l2-framework.txt 的中文翻译 12Documentation/video4linux/v4l2-framework.txt 的中文翻译
@@ -14,7 +14,7 @@ Documentation/video4linux/v4l2-framework.txt 的中文翻译
14如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文 14如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
15交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻 15交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
16译存在问题,请联系中文版维护者。 16译存在问题,请联系中文版维护者。
17英文版维护者: Mauro Carvalho Chehab <mchehab@infradead.org> 17英文版维护者: Mauro Carvalho Chehab <mchehab@kernel.org>
18中文版维护者: 傅炜 Fu Wei <tekkamanninja@gmail.com> 18中文版维护者: 傅炜 Fu Wei <tekkamanninja@gmail.com>
19中文版翻译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> 19中文版翻译者: 傅炜 Fu Wei <tekkamanninja@gmail.com>
20中文版校译者: 傅炜 Fu Wei <tekkamanninja@gmail.com> 20中文版校译者: 傅炜 Fu Wei <tekkamanninja@gmail.com>
diff --git a/MAINTAINERS b/MAINTAINERS
index b22be10d5916..cecf461678b5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -137,9 +137,9 @@ Maintainers List (try to look for most precise areas first)
137 ----------------------------------- 137 -----------------------------------
138 138
1393C59X NETWORK DRIVER 1393C59X NETWORK DRIVER
140M: Steffen Klassert <klassert@mathematik.tu-chemnitz.de> 140M: Steffen Klassert <klassert@kernel.org>
141L: netdev@vger.kernel.org 141L: netdev@vger.kernel.org
142S: Maintained 142S: Odd Fixes
143F: Documentation/networking/vortex.txt 143F: Documentation/networking/vortex.txt
144F: drivers/net/ethernet/3com/3c59x.c 144F: drivers/net/ethernet/3com/3c59x.c
145 145
@@ -2554,7 +2554,6 @@ F: Documentation/devicetree/bindings/sound/axentia,*
2554F: sound/soc/atmel/tse850-pcm5142.c 2554F: sound/soc/atmel/tse850-pcm5142.c
2555 2555
2556AZ6007 DVB DRIVER 2556AZ6007 DVB DRIVER
2557M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2558M: Mauro Carvalho Chehab <mchehab@kernel.org> 2557M: Mauro Carvalho Chehab <mchehab@kernel.org>
2559L: linux-media@vger.kernel.org 2558L: linux-media@vger.kernel.org
2560W: https://linuxtv.org 2559W: https://linuxtv.org
@@ -3082,7 +3081,6 @@ F: include/linux/btrfs*
3082F: include/uapi/linux/btrfs* 3081F: include/uapi/linux/btrfs*
3083 3082
3084BTTV VIDEO4LINUX DRIVER 3083BTTV VIDEO4LINUX DRIVER
3085M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
3086M: Mauro Carvalho Chehab <mchehab@kernel.org> 3084M: Mauro Carvalho Chehab <mchehab@kernel.org>
3087L: linux-media@vger.kernel.org 3085L: linux-media@vger.kernel.org
3088W: https://linuxtv.org 3086W: https://linuxtv.org
@@ -3811,7 +3809,6 @@ S: Maintained
3811F: drivers/media/dvb-frontends/cx24120* 3809F: drivers/media/dvb-frontends/cx24120*
3812 3810
3813CX88 VIDEO4LINUX DRIVER 3811CX88 VIDEO4LINUX DRIVER
3814M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
3815M: Mauro Carvalho Chehab <mchehab@kernel.org> 3812M: Mauro Carvalho Chehab <mchehab@kernel.org>
3816L: linux-media@vger.kernel.org 3813L: linux-media@vger.kernel.org
3817W: https://linuxtv.org 3814W: https://linuxtv.org
@@ -5052,7 +5049,6 @@ F: drivers/edac/thunderx_edac*
5052 5049
5053EDAC-CORE 5050EDAC-CORE
5054M: Borislav Petkov <bp@alien8.de> 5051M: Borislav Petkov <bp@alien8.de>
5055M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5056M: Mauro Carvalho Chehab <mchehab@kernel.org> 5052M: Mauro Carvalho Chehab <mchehab@kernel.org>
5057L: linux-edac@vger.kernel.org 5053L: linux-edac@vger.kernel.org
5058T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next 5054T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
@@ -5081,7 +5077,6 @@ S: Maintained
5081F: drivers/edac/fsl_ddr_edac.* 5077F: drivers/edac/fsl_ddr_edac.*
5082 5078
5083EDAC-GHES 5079EDAC-GHES
5084M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5085M: Mauro Carvalho Chehab <mchehab@kernel.org> 5080M: Mauro Carvalho Chehab <mchehab@kernel.org>
5086L: linux-edac@vger.kernel.org 5081L: linux-edac@vger.kernel.org
5087S: Maintained 5082S: Maintained
@@ -5098,21 +5093,18 @@ S: Maintained
5098F: drivers/edac/i5000_edac.c 5093F: drivers/edac/i5000_edac.c
5099 5094
5100EDAC-I5400 5095EDAC-I5400
5101M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5102M: Mauro Carvalho Chehab <mchehab@kernel.org> 5096M: Mauro Carvalho Chehab <mchehab@kernel.org>
5103L: linux-edac@vger.kernel.org 5097L: linux-edac@vger.kernel.org
5104S: Maintained 5098S: Maintained
5105F: drivers/edac/i5400_edac.c 5099F: drivers/edac/i5400_edac.c
5106 5100
5107EDAC-I7300 5101EDAC-I7300
5108M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5109M: Mauro Carvalho Chehab <mchehab@kernel.org> 5102M: Mauro Carvalho Chehab <mchehab@kernel.org>
5110L: linux-edac@vger.kernel.org 5103L: linux-edac@vger.kernel.org
5111S: Maintained 5104S: Maintained
5112F: drivers/edac/i7300_edac.c 5105F: drivers/edac/i7300_edac.c
5113 5106
5114EDAC-I7CORE 5107EDAC-I7CORE
5115M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5116M: Mauro Carvalho Chehab <mchehab@kernel.org> 5108M: Mauro Carvalho Chehab <mchehab@kernel.org>
5117L: linux-edac@vger.kernel.org 5109L: linux-edac@vger.kernel.org
5118S: Maintained 5110S: Maintained
@@ -5162,7 +5154,6 @@ S: Maintained
5162F: drivers/edac/r82600_edac.c 5154F: drivers/edac/r82600_edac.c
5163 5155
5164EDAC-SBRIDGE 5156EDAC-SBRIDGE
5165M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5166M: Mauro Carvalho Chehab <mchehab@kernel.org> 5157M: Mauro Carvalho Chehab <mchehab@kernel.org>
5167L: linux-edac@vger.kernel.org 5158L: linux-edac@vger.kernel.org
5168S: Maintained 5159S: Maintained
@@ -5221,7 +5212,6 @@ S: Maintained
5221F: drivers/net/ethernet/ibm/ehea/ 5212F: drivers/net/ethernet/ibm/ehea/
5222 5213
5223EM28XX VIDEO4LINUX DRIVER 5214EM28XX VIDEO4LINUX DRIVER
5224M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5225M: Mauro Carvalho Chehab <mchehab@kernel.org> 5215M: Mauro Carvalho Chehab <mchehab@kernel.org>
5226L: linux-media@vger.kernel.org 5216L: linux-media@vger.kernel.org
5227W: https://linuxtv.org 5217W: https://linuxtv.org
@@ -7675,9 +7665,11 @@ L: linux-kbuild@vger.kernel.org
7675S: Maintained 7665S: Maintained
7676F: Documentation/kbuild/ 7666F: Documentation/kbuild/
7677F: Makefile 7667F: Makefile
7678F: scripts/Makefile.* 7668F: scripts/Kbuild*
7669F: scripts/Makefile*
7679F: scripts/basic/ 7670F: scripts/basic/
7680F: scripts/mk* 7671F: scripts/mk*
7672F: scripts/mod/
7681F: scripts/package/ 7673F: scripts/package/
7682 7674
7683KERNEL JANITORS 7675KERNEL JANITORS
@@ -8869,7 +8861,6 @@ F: Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
8869F: drivers/staging/media/tegra-vde/ 8861F: drivers/staging/media/tegra-vde/
8870 8862
8871MEDIA INPUT INFRASTRUCTURE (V4L/DVB) 8863MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
8872M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8873M: Mauro Carvalho Chehab <mchehab@kernel.org> 8864M: Mauro Carvalho Chehab <mchehab@kernel.org>
8874P: LinuxTV.org Project 8865P: LinuxTV.org Project
8875L: linux-media@vger.kernel.org 8866L: linux-media@vger.kernel.org
@@ -9871,7 +9862,7 @@ F: include/linux/platform_data/nxp-nci.h
9871F: Documentation/devicetree/bindings/net/nfc/ 9862F: Documentation/devicetree/bindings/net/nfc/
9872 9863
9873NFS, SUNRPC, AND LOCKD CLIENTS 9864NFS, SUNRPC, AND LOCKD CLIENTS
9874M: Trond Myklebust <trond.myklebust@primarydata.com> 9865M: Trond Myklebust <trond.myklebust@hammerspace.com>
9875M: Anna Schumaker <anna.schumaker@netapp.com> 9866M: Anna Schumaker <anna.schumaker@netapp.com>
9876L: linux-nfs@vger.kernel.org 9867L: linux-nfs@vger.kernel.org
9877W: http://client.linux-nfs.org 9868W: http://client.linux-nfs.org
@@ -12249,7 +12240,6 @@ S: Odd Fixes
12249F: drivers/media/i2c/saa6588* 12240F: drivers/media/i2c/saa6588*
12250 12241
12251SAA7134 VIDEO4LINUX DRIVER 12242SAA7134 VIDEO4LINUX DRIVER
12252M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
12253M: Mauro Carvalho Chehab <mchehab@kernel.org> 12243M: Mauro Carvalho Chehab <mchehab@kernel.org>
12254L: linux-media@vger.kernel.org 12244L: linux-media@vger.kernel.org
12255W: https://linuxtv.org 12245W: https://linuxtv.org
@@ -12754,7 +12744,6 @@ S: Maintained
12754F: drivers/media/radio/si4713/radio-usb-si4713.c 12744F: drivers/media/radio/si4713/radio-usb-si4713.c
12755 12745
12756SIANO DVB DRIVER 12746SIANO DVB DRIVER
12757M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
12758M: Mauro Carvalho Chehab <mchehab@kernel.org> 12747M: Mauro Carvalho Chehab <mchehab@kernel.org>
12759L: linux-media@vger.kernel.org 12748L: linux-media@vger.kernel.org
12760W: https://linuxtv.org 12749W: https://linuxtv.org
@@ -13745,7 +13734,6 @@ S: Maintained
13745F: drivers/media/i2c/tda9840* 13734F: drivers/media/i2c/tda9840*
13746 13735
13747TEA5761 TUNER DRIVER 13736TEA5761 TUNER DRIVER
13748M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13749M: Mauro Carvalho Chehab <mchehab@kernel.org> 13737M: Mauro Carvalho Chehab <mchehab@kernel.org>
13750L: linux-media@vger.kernel.org 13738L: linux-media@vger.kernel.org
13751W: https://linuxtv.org 13739W: https://linuxtv.org
@@ -13754,7 +13742,6 @@ S: Odd fixes
13754F: drivers/media/tuners/tea5761.* 13742F: drivers/media/tuners/tea5761.*
13755 13743
13756TEA5767 TUNER DRIVER 13744TEA5767 TUNER DRIVER
13757M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13758M: Mauro Carvalho Chehab <mchehab@kernel.org> 13745M: Mauro Carvalho Chehab <mchehab@kernel.org>
13759L: linux-media@vger.kernel.org 13746L: linux-media@vger.kernel.org
13760W: https://linuxtv.org 13747W: https://linuxtv.org
@@ -14170,7 +14157,6 @@ F: Documentation/networking/tlan.txt
14170F: drivers/net/ethernet/ti/tlan.* 14157F: drivers/net/ethernet/ti/tlan.*
14171 14158
14172TM6000 VIDEO4LINUX DRIVER 14159TM6000 VIDEO4LINUX DRIVER
14173M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
14174M: Mauro Carvalho Chehab <mchehab@kernel.org> 14160M: Mauro Carvalho Chehab <mchehab@kernel.org>
14175L: linux-media@vger.kernel.org 14161L: linux-media@vger.kernel.org
14176W: https://linuxtv.org 14162W: https://linuxtv.org
@@ -15399,7 +15385,6 @@ S: Maintained
15399F: arch/x86/entry/vdso/ 15385F: arch/x86/entry/vdso/
15400 15386
15401XC2028/3028 TUNER DRIVER 15387XC2028/3028 TUNER DRIVER
15402M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
15403M: Mauro Carvalho Chehab <mchehab@kernel.org> 15388M: Mauro Carvalho Chehab <mchehab@kernel.org>
15404L: linux-media@vger.kernel.org 15389L: linux-media@vger.kernel.org
15405W: https://linuxtv.org 15390W: https://linuxtv.org
diff --git a/Makefile b/Makefile
index 619a85ad716b..d0d2652db174 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,8 @@
2VERSION = 4 2VERSION = 4
3PATCHLEVEL = 17 3PATCHLEVEL = 17
4SUBLEVEL = 0 4SUBLEVEL = 0
5EXTRAVERSION = -rc3 5EXTRAVERSION = -rc4
6NAME = Fearless Coyote 6NAME = Merciless Moray
7 7
8# *DOCUMENTATION* 8# *DOCUMENTATION*
9# To see a list of typical targets execute "make help" 9# To see a list of typical targets execute "make help"
diff --git a/arch/arm/boot/dts/imx35.dtsi b/arch/arm/boot/dts/imx35.dtsi
index bf343195697e..54111ed218b1 100644
--- a/arch/arm/boot/dts/imx35.dtsi
+++ b/arch/arm/boot/dts/imx35.dtsi
@@ -303,7 +303,7 @@
303 }; 303 };
304 304
305 can1: can@53fe4000 { 305 can1: can@53fe4000 {
306 compatible = "fsl,imx35-flexcan"; 306 compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan";
307 reg = <0x53fe4000 0x1000>; 307 reg = <0x53fe4000 0x1000>;
308 clocks = <&clks 33>, <&clks 33>; 308 clocks = <&clks 33>, <&clks 33>;
309 clock-names = "ipg", "per"; 309 clock-names = "ipg", "per";
@@ -312,7 +312,7 @@
312 }; 312 };
313 313
314 can2: can@53fe8000 { 314 can2: can@53fe8000 {
315 compatible = "fsl,imx35-flexcan"; 315 compatible = "fsl,imx35-flexcan", "fsl,imx25-flexcan";
316 reg = <0x53fe8000 0x1000>; 316 reg = <0x53fe8000 0x1000>;
317 clocks = <&clks 34>, <&clks 34>; 317 clocks = <&clks 34>, <&clks 34>;
318 clock-names = "ipg", "per"; 318 clock-names = "ipg", "per";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 7d647d043f52..3d65c0192f69 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -551,7 +551,7 @@
551 }; 551 };
552 552
553 can1: can@53fc8000 { 553 can1: can@53fc8000 {
554 compatible = "fsl,imx53-flexcan"; 554 compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan";
555 reg = <0x53fc8000 0x4000>; 555 reg = <0x53fc8000 0x4000>;
556 interrupts = <82>; 556 interrupts = <82>;
557 clocks = <&clks IMX5_CLK_CAN1_IPG_GATE>, 557 clocks = <&clks IMX5_CLK_CAN1_IPG_GATE>,
@@ -561,7 +561,7 @@
561 }; 561 };
562 562
563 can2: can@53fcc000 { 563 can2: can@53fcc000 {
564 compatible = "fsl,imx53-flexcan"; 564 compatible = "fsl,imx53-flexcan", "fsl,imx25-flexcan";
565 reg = <0x53fcc000 0x4000>; 565 reg = <0x53fcc000 0x4000>;
566 interrupts = <83>; 566 interrupts = <83>;
567 clocks = <&clks IMX5_CLK_CAN2_IPG_GATE>, 567 clocks = <&clks IMX5_CLK_CAN2_IPG_GATE>,
diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h
index 30014a9f8f2b..ea690b3562af 100644
--- a/arch/arm64/include/asm/cputype.h
+++ b/arch/arm64/include/asm/cputype.h
@@ -75,6 +75,7 @@
75#define ARM_CPU_IMP_CAVIUM 0x43 75#define ARM_CPU_IMP_CAVIUM 0x43
76#define ARM_CPU_IMP_BRCM 0x42 76#define ARM_CPU_IMP_BRCM 0x42
77#define ARM_CPU_IMP_QCOM 0x51 77#define ARM_CPU_IMP_QCOM 0x51
78#define ARM_CPU_IMP_NVIDIA 0x4E
78 79
79#define ARM_CPU_PART_AEM_V8 0xD0F 80#define ARM_CPU_PART_AEM_V8 0xD0F
80#define ARM_CPU_PART_FOUNDATION 0xD00 81#define ARM_CPU_PART_FOUNDATION 0xD00
@@ -99,6 +100,9 @@
99#define QCOM_CPU_PART_FALKOR 0xC00 100#define QCOM_CPU_PART_FALKOR 0xC00
100#define QCOM_CPU_PART_KRYO 0x200 101#define QCOM_CPU_PART_KRYO 0x200
101 102
103#define NVIDIA_CPU_PART_DENVER 0x003
104#define NVIDIA_CPU_PART_CARMEL 0x004
105
102#define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) 106#define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53)
103#define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57) 107#define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)
104#define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72) 108#define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)
@@ -114,6 +118,8 @@
114#define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1) 118#define MIDR_QCOM_FALKOR_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR_V1)
115#define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR) 119#define MIDR_QCOM_FALKOR MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_FALKOR)
116#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO) 120#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)
121#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
122#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
117 123
118#ifndef __ASSEMBLY__ 124#ifndef __ASSEMBLY__
119 125
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 23b33e8ea03a..1dab3a984608 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -333,7 +333,7 @@ static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu)
333 } else { 333 } else {
334 u64 sctlr = vcpu_read_sys_reg(vcpu, SCTLR_EL1); 334 u64 sctlr = vcpu_read_sys_reg(vcpu, SCTLR_EL1);
335 sctlr |= (1 << 25); 335 sctlr |= (1 << 25);
336 vcpu_write_sys_reg(vcpu, SCTLR_EL1, sctlr); 336 vcpu_write_sys_reg(vcpu, sctlr, SCTLR_EL1);
337 } 337 }
338} 338}
339 339
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
index a900befadfe8..e4a1182deff7 100644
--- a/arch/arm64/kernel/cpu_errata.c
+++ b/arch/arm64/kernel/cpu_errata.c
@@ -316,6 +316,7 @@ static const struct midr_range arm64_bp_harden_smccc_cpus[] = {
316 MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), 316 MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
317 MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR_V1), 317 MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR_V1),
318 MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR), 318 MIDR_ALL_VERSIONS(MIDR_QCOM_FALKOR),
319 MIDR_ALL_VERSIONS(MIDR_NVIDIA_DENVER),
319 {}, 320 {},
320}; 321};
321 322
diff --git a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
index 86801b6055d6..39be799d0417 100644
--- a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
+++ b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
@@ -18,11 +18,20 @@
18#include <linux/compiler.h> 18#include <linux/compiler.h>
19#include <linux/irqchip/arm-gic.h> 19#include <linux/irqchip/arm-gic.h>
20#include <linux/kvm_host.h> 20#include <linux/kvm_host.h>
21#include <linux/swab.h>
21 22
22#include <asm/kvm_emulate.h> 23#include <asm/kvm_emulate.h>
23#include <asm/kvm_hyp.h> 24#include <asm/kvm_hyp.h>
24#include <asm/kvm_mmu.h> 25#include <asm/kvm_mmu.h>
25 26
27static bool __hyp_text __is_be(struct kvm_vcpu *vcpu)
28{
29 if (vcpu_mode_is_32bit(vcpu))
30 return !!(read_sysreg_el2(spsr) & COMPAT_PSR_E_BIT);
31
32 return !!(read_sysreg(SCTLR_EL1) & SCTLR_ELx_EE);
33}
34
26/* 35/*
27 * __vgic_v2_perform_cpuif_access -- perform a GICV access on behalf of the 36 * __vgic_v2_perform_cpuif_access -- perform a GICV access on behalf of the
28 * guest. 37 * guest.
@@ -64,14 +73,19 @@ int __hyp_text __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu)
64 addr += fault_ipa - vgic->vgic_cpu_base; 73 addr += fault_ipa - vgic->vgic_cpu_base;
65 74
66 if (kvm_vcpu_dabt_iswrite(vcpu)) { 75 if (kvm_vcpu_dabt_iswrite(vcpu)) {
67 u32 data = vcpu_data_guest_to_host(vcpu, 76 u32 data = vcpu_get_reg(vcpu, rd);
68 vcpu_get_reg(vcpu, rd), 77 if (__is_be(vcpu)) {
69 sizeof(u32)); 78 /* guest pre-swabbed data, undo this for writel() */
79 data = swab32(data);
80 }
70 writel_relaxed(data, addr); 81 writel_relaxed(data, addr);
71 } else { 82 } else {
72 u32 data = readl_relaxed(addr); 83 u32 data = readl_relaxed(addr);
73 vcpu_set_reg(vcpu, rd, vcpu_data_host_to_guest(vcpu, data, 84 if (__is_be(vcpu)) {
74 sizeof(u32))); 85 /* guest expects swabbed data */
86 data = swab32(data);
87 }
88 vcpu_set_reg(vcpu, rd, data);
75 } 89 }
76 90
77 return 1; 91 return 1;
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 9f3c47acf8ff..1b18b4722420 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -646,8 +646,10 @@ static int keep_initrd __initdata;
646 646
647void __init free_initrd_mem(unsigned long start, unsigned long end) 647void __init free_initrd_mem(unsigned long start, unsigned long end)
648{ 648{
649 if (!keep_initrd) 649 if (!keep_initrd) {
650 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 650 free_reserved_area((void *)start, (void *)end, 0, "initrd");
651 memblock_free(__virt_to_phys(start), end - start);
652 }
651} 653}
652 654
653static int __init keepinitrd_setup(char *__unused) 655static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index 9abddde372ab..b2dabd06659d 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -69,17 +69,30 @@ struct dyn_arch_ftrace {
69#endif 69#endif
70 70
71#if defined(CONFIG_FTRACE_SYSCALLS) && !defined(__ASSEMBLY__) 71#if defined(CONFIG_FTRACE_SYSCALLS) && !defined(__ASSEMBLY__)
72#ifdef PPC64_ELF_ABI_v1 72/*
73 * Some syscall entry functions on powerpc start with "ppc_" (fork and clone,
74 * for instance) or ppc32_/ppc64_. We should also match the sys_ variant with
75 * those.
76 */
73#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME 77#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
78#ifdef PPC64_ELF_ABI_v1
79static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
80{
81 /* We need to skip past the initial dot, and the __se_sys alias */
82 return !strcmp(sym + 1, name) ||
83 (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
84 (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
85 (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
86 (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
87}
88#else
74static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) 89static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
75{ 90{
76 /* 91 return !strcmp(sym, name) ||
77 * Compare the symbol name with the system call name. Skip the .sys or .SyS 92 (!strncmp(sym, "__se_sys", 8) && !strcmp(sym + 5, name)) ||
78 * prefix from the symbol name and the sys prefix from the system call name and 93 (!strncmp(sym, "ppc_", 4) && !strcmp(sym + 4, name + 4)) ||
79 * just match the rest. This is only needed on ppc64 since symbol names on 94 (!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
80 * 32bit do not start with a period so the generic function will work. 95 (!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
81 */
82 return !strcmp(sym + 4, name + 3);
83} 96}
84#endif 97#endif
85#endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */ 98#endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 4185f1c96125..3f109a3e3edb 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -165,7 +165,6 @@ struct paca_struct {
165 u64 saved_msr; /* MSR saved here by enter_rtas */ 165 u64 saved_msr; /* MSR saved here by enter_rtas */
166 u16 trap_save; /* Used when bad stack is encountered */ 166 u16 trap_save; /* Used when bad stack is encountered */
167 u8 irq_soft_mask; /* mask for irq soft masking */ 167 u8 irq_soft_mask; /* mask for irq soft masking */
168 u8 soft_enabled; /* irq soft-enable flag */
169 u8 irq_happened; /* irq happened while soft-disabled */ 168 u8 irq_happened; /* irq happened while soft-disabled */
170 u8 io_sync; /* writel() needs spin_unlock sync */ 169 u8 io_sync; /* writel() needs spin_unlock sync */
171 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ 170 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 9f421641a35c..16b077801a5f 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -91,6 +91,7 @@ extern int start_topology_update(void);
91extern int stop_topology_update(void); 91extern int stop_topology_update(void);
92extern int prrn_is_enabled(void); 92extern int prrn_is_enabled(void);
93extern int find_and_online_cpu_nid(int cpu); 93extern int find_and_online_cpu_nid(int cpu);
94extern int timed_topology_update(int nsecs);
94#else 95#else
95static inline int start_topology_update(void) 96static inline int start_topology_update(void)
96{ 97{
@@ -108,16 +109,12 @@ static inline int find_and_online_cpu_nid(int cpu)
108{ 109{
109 return 0; 110 return 0;
110} 111}
112static inline int timed_topology_update(int nsecs)
113{
114 return 0;
115}
111#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */ 116#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
112 117
113#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_NEED_MULTIPLE_NODES)
114#if defined(CONFIG_PPC_SPLPAR)
115extern int timed_topology_update(int nsecs);
116#else
117#define timed_topology_update(nsecs)
118#endif /* CONFIG_PPC_SPLPAR */
119#endif /* CONFIG_HOTPLUG_CPU || CONFIG_NEED_MULTIPLE_NODES */
120
121#include <asm-generic/topology.h> 118#include <asm-generic/topology.h>
122 119
123#ifdef CONFIG_SMP 120#ifdef CONFIG_SMP
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 97fe29316476..1851eaeee131 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -9,6 +9,7 @@ config SUPERH
9 select HAVE_IDE if HAS_IOPORT_MAP 9 select HAVE_IDE if HAS_IOPORT_MAP
10 select HAVE_MEMBLOCK 10 select HAVE_MEMBLOCK
11 select HAVE_MEMBLOCK_NODE_MAP 11 select HAVE_MEMBLOCK_NODE_MAP
12 select NO_BOOTMEM
12 select ARCH_DISCARD_MEMBLOCK 13 select ARCH_DISCARD_MEMBLOCK
13 select HAVE_OPROFILE 14 select HAVE_OPROFILE
14 select HAVE_GENERIC_DMA_COHERENT 15 select HAVE_GENERIC_DMA_COHERENT
diff --git a/arch/sh/kernel/cpu/sh2/probe.c b/arch/sh/kernel/cpu/sh2/probe.c
index 4205f6d42b69..a5bd03642678 100644
--- a/arch/sh/kernel/cpu/sh2/probe.c
+++ b/arch/sh/kernel/cpu/sh2/probe.c
@@ -43,7 +43,11 @@ void __ref cpu_probe(void)
43#endif 43#endif
44 44
45#if defined(CONFIG_CPU_J2) 45#if defined(CONFIG_CPU_J2)
46#if defined(CONFIG_SMP)
46 unsigned cpu = hard_smp_processor_id(); 47 unsigned cpu = hard_smp_processor_id();
48#else
49 unsigned cpu = 0;
50#endif
47 if (cpu == 0) of_scan_flat_dt(scan_cache, NULL); 51 if (cpu == 0) of_scan_flat_dt(scan_cache, NULL);
48 if (j2_ccr_base) __raw_writel(0x80000303, j2_ccr_base + 4*cpu); 52 if (j2_ccr_base) __raw_writel(0x80000303, j2_ccr_base + 4*cpu);
49 if (cpu != 0) return; 53 if (cpu != 0) return;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index d34e998b809f..c286cf5da6e7 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -11,7 +11,6 @@
11#include <linux/ioport.h> 11#include <linux/ioport.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/initrd.h> 13#include <linux/initrd.h>
14#include <linux/bootmem.h>
15#include <linux/console.h> 14#include <linux/console.h>
16#include <linux/root_dev.h> 15#include <linux/root_dev.h>
17#include <linux/utsname.h> 16#include <linux/utsname.h>
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 8ce98691d822..f1b44697ad68 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -59,7 +59,9 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
59 59
60 split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order); 60 split_page(pfn_to_page(virt_to_phys(ret) >> PAGE_SHIFT), order);
61 61
62 *dma_handle = virt_to_phys(ret) - PFN_PHYS(dev->dma_pfn_offset); 62 *dma_handle = virt_to_phys(ret);
63 if (!WARN_ON(!dev))
64 *dma_handle -= PFN_PHYS(dev->dma_pfn_offset);
63 65
64 return ret_nocache; 66 return ret_nocache;
65} 67}
@@ -69,9 +71,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
69 unsigned long attrs) 71 unsigned long attrs)
70{ 72{
71 int order = get_order(size); 73 int order = get_order(size);
72 unsigned long pfn = (dma_handle >> PAGE_SHIFT) + dev->dma_pfn_offset; 74 unsigned long pfn = dma_handle >> PAGE_SHIFT;
73 int k; 75 int k;
74 76
77 if (!WARN_ON(!dev))
78 pfn += dev->dma_pfn_offset;
79
75 for (k = 0; k < (1 << order); k++) 80 for (k = 0; k < (1 << order); k++)
76 __free_pages(pfn_to_page(pfn + k), 0); 81 __free_pages(pfn_to_page(pfn + k), 0);
77 82
@@ -143,7 +148,7 @@ int __init platform_resource_setup_memory(struct platform_device *pdev,
143 if (!memsize) 148 if (!memsize)
144 return 0; 149 return 0;
145 150
146 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL); 151 buf = dma_alloc_coherent(&pdev->dev, memsize, &dma_handle, GFP_KERNEL);
147 if (!buf) { 152 if (!buf) {
148 pr_warning("%s: unable to allocate memory\n", name); 153 pr_warning("%s: unable to allocate memory\n", name);
149 return -ENOMEM; 154 return -ENOMEM;
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..4034035fbede 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -211,59 +211,15 @@ void __init allocate_pgdat(unsigned int nid)
211 211
212 NODE_DATA(nid) = __va(phys); 212 NODE_DATA(nid) = __va(phys);
213 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); 213 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
214
215 NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
216#endif 214#endif
217 215
218 NODE_DATA(nid)->node_start_pfn = start_pfn; 216 NODE_DATA(nid)->node_start_pfn = start_pfn;
219 NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; 217 NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
220} 218}
221 219
222static void __init bootmem_init_one_node(unsigned int nid)
223{
224 unsigned long total_pages, paddr;
225 unsigned long end_pfn;
226 struct pglist_data *p;
227
228 p = NODE_DATA(nid);
229
230 /* Nothing to do.. */
231 if (!p->node_spanned_pages)
232 return;
233
234 end_pfn = pgdat_end_pfn(p);
235
236 total_pages = bootmem_bootmap_pages(p->node_spanned_pages);
237
238 paddr = memblock_alloc(total_pages << PAGE_SHIFT, PAGE_SIZE);
239 if (!paddr)
240 panic("Can't allocate bootmap for nid[%d]\n", nid);
241
242 init_bootmem_node(p, paddr >> PAGE_SHIFT, p->node_start_pfn, end_pfn);
243
244 free_bootmem_with_active_regions(nid, end_pfn);
245
246 /*
247 * XXX Handle initial reservations for the system memory node
248 * only for the moment, we'll refactor this later for handling
249 * reservations in other nodes.
250 */
251 if (nid == 0) {
252 struct memblock_region *reg;
253
254 /* Reserve the sections we're already using. */
255 for_each_memblock(reserved, reg) {
256 reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
257 }
258 }
259
260 sparse_memory_present_with_active_regions(nid);
261}
262
263static void __init do_init_bootmem(void) 220static void __init do_init_bootmem(void)
264{ 221{
265 struct memblock_region *reg; 222 struct memblock_region *reg;
266 int i;
267 223
268 /* Add active regions with valid PFNs. */ 224 /* Add active regions with valid PFNs. */
269 for_each_memblock(memory, reg) { 225 for_each_memblock(memory, reg) {
@@ -279,9 +235,12 @@ static void __init do_init_bootmem(void)
279 235
280 plat_mem_setup(); 236 plat_mem_setup();
281 237
282 for_each_online_node(i) 238 for_each_memblock(memory, reg) {
283 bootmem_init_one_node(i); 239 int nid = memblock_get_region_node(reg);
284 240
241 memory_present(nid, memblock_region_memory_base_pfn(reg),
242 memblock_region_memory_end_pfn(reg));
243 }
285 sparse_init(); 244 sparse_init();
286} 245}
287 246
@@ -322,7 +281,6 @@ void __init paging_init(void)
322{ 281{
323 unsigned long max_zone_pfns[MAX_NR_ZONES]; 282 unsigned long max_zone_pfns[MAX_NR_ZONES];
324 unsigned long vaddr, end; 283 unsigned long vaddr, end;
325 int nid;
326 284
327 sh_mv.mv_mem_init(); 285 sh_mv.mv_mem_init();
328 286
@@ -377,21 +335,7 @@ void __init paging_init(void)
377 kmap_coherent_init(); 335 kmap_coherent_init();
378 336
379 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 337 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
380 338 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
381 for_each_online_node(nid) {
382 pg_data_t *pgdat = NODE_DATA(nid);
383 unsigned long low, start_pfn;
384
385 start_pfn = pgdat->bdata->node_min_pfn;
386 low = pgdat->bdata->node_low_pfn;
387
388 if (max_zone_pfns[ZONE_NORMAL] < low)
389 max_zone_pfns[ZONE_NORMAL] = low;
390
391 printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n",
392 nid, start_pfn, low);
393 }
394
395 free_area_init_nodes(max_zone_pfns); 339 free_area_init_nodes(max_zone_pfns);
396} 340}
397 341
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 05713d190247..830e8b3684e4 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -8,7 +8,6 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/bootmem.h>
12#include <linux/memblock.h> 11#include <linux/memblock.h>
13#include <linux/mm.h> 12#include <linux/mm.h>
14#include <linux/numa.h> 13#include <linux/numa.h>
@@ -26,9 +25,7 @@ EXPORT_SYMBOL_GPL(node_data);
26 */ 25 */
27void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) 26void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
28{ 27{
29 unsigned long bootmap_pages;
30 unsigned long start_pfn, end_pfn; 28 unsigned long start_pfn, end_pfn;
31 unsigned long bootmem_paddr;
32 29
33 /* Don't allow bogus node assignment */ 30 /* Don't allow bogus node assignment */
34 BUG_ON(nid >= MAX_NUMNODES || nid <= 0); 31 BUG_ON(nid >= MAX_NUMNODES || nid <= 0);
@@ -48,25 +45,9 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
48 SMP_CACHE_BYTES, end)); 45 SMP_CACHE_BYTES, end));
49 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); 46 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
50 47
51 NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
52 NODE_DATA(nid)->node_start_pfn = start_pfn; 48 NODE_DATA(nid)->node_start_pfn = start_pfn;
53 NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; 49 NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
54 50
55 /* Node-local bootmap */
56 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
57 bootmem_paddr = memblock_alloc_base(bootmap_pages << PAGE_SHIFT,
58 PAGE_SIZE, end);
59 init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
60 start_pfn, end_pfn);
61
62 free_bootmem_with_active_regions(nid, end_pfn);
63
64 /* Reserve the pgdat and bootmap space with the bootmem allocator */
65 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
66 sizeof(struct pglist_data), BOOTMEM_DEFAULT);
67 reserve_bootmem_node(NODE_DATA(nid), bootmem_paddr,
68 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
69
70 /* It's up */ 51 /* It's up */
71 node_set_online(nid); 52 node_set_online(nid);
72 53
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8a5b185735e1..ce243f7d2d4e 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -848,6 +848,11 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
848 c->x86_power = edx; 848 c->x86_power = edx;
849 } 849 }
850 850
851 if (c->extended_cpuid_level >= 0x80000008) {
852 cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
853 c->x86_capability[CPUID_8000_0008_EBX] = ebx;
854 }
855
851 if (c->extended_cpuid_level >= 0x8000000a) 856 if (c->extended_cpuid_level >= 0x8000000a)
852 c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a); 857 c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a);
853 858
@@ -871,7 +876,6 @@ static void get_cpu_address_sizes(struct cpuinfo_x86 *c)
871 876
872 c->x86_virt_bits = (eax >> 8) & 0xff; 877 c->x86_virt_bits = (eax >> 8) & 0xff;
873 c->x86_phys_bits = eax & 0xff; 878 c->x86_phys_bits = eax & 0xff;
874 c->x86_capability[CPUID_8000_0008_EBX] = ebx;
875 } 879 }
876#ifdef CONFIG_X86_32 880#ifdef CONFIG_X86_32
877 else if (cpu_has(c, X86_FEATURE_PAE) || cpu_has(c, X86_FEATURE_PSE36)) 881 else if (cpu_has(c, X86_FEATURE_PAE) || cpu_has(c, X86_FEATURE_PSE36))
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 91e6da48cbb6..74392d9d51e0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1067,6 +1067,7 @@ static struct clocksource clocksource_tsc_early = {
1067 .resume = tsc_resume, 1067 .resume = tsc_resume,
1068 .mark_unstable = tsc_cs_mark_unstable, 1068 .mark_unstable = tsc_cs_mark_unstable,
1069 .tick_stable = tsc_cs_tick_stable, 1069 .tick_stable = tsc_cs_tick_stable,
1070 .list = LIST_HEAD_INIT(clocksource_tsc_early.list),
1070}; 1071};
1071 1072
1072/* 1073/*
@@ -1086,6 +1087,7 @@ static struct clocksource clocksource_tsc = {
1086 .resume = tsc_resume, 1087 .resume = tsc_resume,
1087 .mark_unstable = tsc_cs_mark_unstable, 1088 .mark_unstable = tsc_cs_mark_unstable,
1088 .tick_stable = tsc_cs_tick_stable, 1089 .tick_stable = tsc_cs_tick_stable,
1090 .list = LIST_HEAD_INIT(clocksource_tsc.list),
1089}; 1091};
1090 1092
1091void mark_tsc_unstable(char *reason) 1093void mark_tsc_unstable(char *reason)
@@ -1098,13 +1100,9 @@ void mark_tsc_unstable(char *reason)
1098 clear_sched_clock_stable(); 1100 clear_sched_clock_stable();
1099 disable_sched_clock_irqtime(); 1101 disable_sched_clock_irqtime();
1100 pr_info("Marking TSC unstable due to %s\n", reason); 1102 pr_info("Marking TSC unstable due to %s\n", reason);
1101 /* Change only the rating, when not registered */ 1103
1102 if (clocksource_tsc.mult) { 1104 clocksource_mark_unstable(&clocksource_tsc_early);
1103 clocksource_mark_unstable(&clocksource_tsc); 1105 clocksource_mark_unstable(&clocksource_tsc);
1104 } else {
1105 clocksource_tsc.flags |= CLOCK_SOURCE_UNSTABLE;
1106 clocksource_tsc.rating = 0;
1107 }
1108} 1106}
1109 1107
1110EXPORT_SYMBOL_GPL(mark_tsc_unstable); 1108EXPORT_SYMBOL_GPL(mark_tsc_unstable);
@@ -1244,7 +1242,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
1244 1242
1245 /* Don't bother refining TSC on unstable systems */ 1243 /* Don't bother refining TSC on unstable systems */
1246 if (tsc_unstable) 1244 if (tsc_unstable)
1247 return; 1245 goto unreg;
1248 1246
1249 /* 1247 /*
1250 * Since the work is started early in boot, we may be 1248 * Since the work is started early in boot, we may be
@@ -1297,11 +1295,12 @@ static void tsc_refine_calibration_work(struct work_struct *work)
1297 1295
1298out: 1296out:
1299 if (tsc_unstable) 1297 if (tsc_unstable)
1300 return; 1298 goto unreg;
1301 1299
1302 if (boot_cpu_has(X86_FEATURE_ART)) 1300 if (boot_cpu_has(X86_FEATURE_ART))
1303 art_related_clocksource = &clocksource_tsc; 1301 art_related_clocksource = &clocksource_tsc;
1304 clocksource_register_khz(&clocksource_tsc, tsc_khz); 1302 clocksource_register_khz(&clocksource_tsc, tsc_khz);
1303unreg:
1305 clocksource_unregister(&clocksource_tsc_early); 1304 clocksource_unregister(&clocksource_tsc_early);
1306} 1305}
1307 1306
@@ -1311,8 +1310,8 @@ static int __init init_tsc_clocksource(void)
1311 if (!boot_cpu_has(X86_FEATURE_TSC) || tsc_disabled > 0 || !tsc_khz) 1310 if (!boot_cpu_has(X86_FEATURE_TSC) || tsc_disabled > 0 || !tsc_khz)
1312 return 0; 1311 return 0;
1313 1312
1314 if (check_tsc_unstable()) 1313 if (tsc_unstable)
1315 return 0; 1314 goto unreg;
1316 1315
1317 if (tsc_clocksource_reliable) 1316 if (tsc_clocksource_reliable)
1318 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY; 1317 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
@@ -1328,6 +1327,7 @@ static int __init init_tsc_clocksource(void)
1328 if (boot_cpu_has(X86_FEATURE_ART)) 1327 if (boot_cpu_has(X86_FEATURE_ART))
1329 art_related_clocksource = &clocksource_tsc; 1328 art_related_clocksource = &clocksource_tsc;
1330 clocksource_register_khz(&clocksource_tsc, tsc_khz); 1329 clocksource_register_khz(&clocksource_tsc, tsc_khz);
1330unreg:
1331 clocksource_unregister(&clocksource_tsc_early); 1331 clocksource_unregister(&clocksource_tsc_early);
1332 return 0; 1332 return 0;
1333 } 1333 }
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 70dcb5548022..b74c9c1405b9 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -1463,23 +1463,6 @@ static void start_sw_tscdeadline(struct kvm_lapic *apic)
1463 local_irq_restore(flags); 1463 local_irq_restore(flags);
1464} 1464}
1465 1465
1466static void start_sw_period(struct kvm_lapic *apic)
1467{
1468 if (!apic->lapic_timer.period)
1469 return;
1470
1471 if (apic_lvtt_oneshot(apic) &&
1472 ktime_after(ktime_get(),
1473 apic->lapic_timer.target_expiration)) {
1474 apic_timer_expired(apic);
1475 return;
1476 }
1477
1478 hrtimer_start(&apic->lapic_timer.timer,
1479 apic->lapic_timer.target_expiration,
1480 HRTIMER_MODE_ABS_PINNED);
1481}
1482
1483static void update_target_expiration(struct kvm_lapic *apic, uint32_t old_divisor) 1466static void update_target_expiration(struct kvm_lapic *apic, uint32_t old_divisor)
1484{ 1467{
1485 ktime_t now, remaining; 1468 ktime_t now, remaining;
@@ -1546,6 +1529,26 @@ static void advance_periodic_target_expiration(struct kvm_lapic *apic)
1546 apic->lapic_timer.period); 1529 apic->lapic_timer.period);
1547} 1530}
1548 1531
1532static void start_sw_period(struct kvm_lapic *apic)
1533{
1534 if (!apic->lapic_timer.period)
1535 return;
1536
1537 if (ktime_after(ktime_get(),
1538 apic->lapic_timer.target_expiration)) {
1539 apic_timer_expired(apic);
1540
1541 if (apic_lvtt_oneshot(apic))
1542 return;
1543
1544 advance_periodic_target_expiration(apic);
1545 }
1546
1547 hrtimer_start(&apic->lapic_timer.timer,
1548 apic->lapic_timer.target_expiration,
1549 HRTIMER_MODE_ABS_PINNED);
1550}
1551
1549bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu) 1552bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
1550{ 1553{
1551 if (!lapic_in_kernel(vcpu)) 1554 if (!lapic_in_kernel(vcpu))
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index 826898701045..19c1ff542387 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -65,6 +65,19 @@ static void __init xen_hvm_init_mem_mapping(void)
65{ 65{
66 early_memunmap(HYPERVISOR_shared_info, PAGE_SIZE); 66 early_memunmap(HYPERVISOR_shared_info, PAGE_SIZE);
67 HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn)); 67 HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn));
68
69 /*
70 * The virtual address of the shared_info page has changed, so
71 * the vcpu_info pointer for VCPU 0 is now stale.
72 *
73 * The prepare_boot_cpu callback will re-initialize it via
74 * xen_vcpu_setup, but we can't rely on that to be called for
75 * old Xen versions (xen_have_vector_callback == 0).
76 *
77 * It is, in any case, bad to have a stale vcpu_info pointer
78 * so reset it now.
79 */
80 xen_vcpu_info_reset(0);
68} 81}
69 82
70static void __init init_hvm_pv_info(void) 83static void __init init_hvm_pv_info(void)
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index c36d23aa6c35..357969a3697c 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -421,45 +421,33 @@ static void xen_load_gdt(const struct desc_ptr *dtr)
421{ 421{
422 unsigned long va = dtr->address; 422 unsigned long va = dtr->address;
423 unsigned int size = dtr->size + 1; 423 unsigned int size = dtr->size + 1;
424 unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); 424 unsigned long pfn, mfn;
425 unsigned long frames[pages]; 425 int level;
426 int f; 426 pte_t *ptep;
427 427 void *virt;
428 /*
429 * A GDT can be up to 64k in size, which corresponds to 8192
430 * 8-byte entries, or 16 4k pages..
431 */
432 428
433 BUG_ON(size > 65536); 429 /* @size should be at most GDT_SIZE which is smaller than PAGE_SIZE. */
430 BUG_ON(size > PAGE_SIZE);
434 BUG_ON(va & ~PAGE_MASK); 431 BUG_ON(va & ~PAGE_MASK);
435 432
436 for (f = 0; va < dtr->address + size; va += PAGE_SIZE, f++) { 433 /*
437 int level; 434 * The GDT is per-cpu and is in the percpu data area.
438 pte_t *ptep; 435 * That can be virtually mapped, so we need to do a
439 unsigned long pfn, mfn; 436 * page-walk to get the underlying MFN for the
440 void *virt; 437 * hypercall. The page can also be in the kernel's
441 438 * linear range, so we need to RO that mapping too.
442 /* 439 */
443 * The GDT is per-cpu and is in the percpu data area. 440 ptep = lookup_address(va, &level);
444 * That can be virtually mapped, so we need to do a 441 BUG_ON(ptep == NULL);
445 * page-walk to get the underlying MFN for the
446 * hypercall. The page can also be in the kernel's
447 * linear range, so we need to RO that mapping too.
448 */
449 ptep = lookup_address(va, &level);
450 BUG_ON(ptep == NULL);
451
452 pfn = pte_pfn(*ptep);
453 mfn = pfn_to_mfn(pfn);
454 virt = __va(PFN_PHYS(pfn));
455 442
456 frames[f] = mfn; 443 pfn = pte_pfn(*ptep);
444 mfn = pfn_to_mfn(pfn);
445 virt = __va(PFN_PHYS(pfn));
457 446
458 make_lowmem_page_readonly((void *)va); 447 make_lowmem_page_readonly((void *)va);
459 make_lowmem_page_readonly(virt); 448 make_lowmem_page_readonly(virt);
460 }
461 449
462 if (HYPERVISOR_set_gdt(frames, size / sizeof(struct desc_struct))) 450 if (HYPERVISOR_set_gdt(&mfn, size / sizeof(struct desc_struct)))
463 BUG(); 451 BUG();
464} 452}
465 453
@@ -470,34 +458,22 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
470{ 458{
471 unsigned long va = dtr->address; 459 unsigned long va = dtr->address;
472 unsigned int size = dtr->size + 1; 460 unsigned int size = dtr->size + 1;
473 unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); 461 unsigned long pfn, mfn;
474 unsigned long frames[pages]; 462 pte_t pte;
475 int f;
476
477 /*
478 * A GDT can be up to 64k in size, which corresponds to 8192
479 * 8-byte entries, or 16 4k pages..
480 */
481 463
482 BUG_ON(size > 65536); 464 /* @size should be at most GDT_SIZE which is smaller than PAGE_SIZE. */
465 BUG_ON(size > PAGE_SIZE);
483 BUG_ON(va & ~PAGE_MASK); 466 BUG_ON(va & ~PAGE_MASK);
484 467
485 for (f = 0; va < dtr->address + size; va += PAGE_SIZE, f++) { 468 pfn = virt_to_pfn(va);
486 pte_t pte; 469 mfn = pfn_to_mfn(pfn);
487 unsigned long pfn, mfn;
488 470
489 pfn = virt_to_pfn(va); 471 pte = pfn_pte(pfn, PAGE_KERNEL_RO);
490 mfn = pfn_to_mfn(pfn);
491 472
492 pte = pfn_pte(pfn, PAGE_KERNEL_RO); 473 if (HYPERVISOR_update_va_mapping((unsigned long)va, pte, 0))
493 474 BUG();
494 if (HYPERVISOR_update_va_mapping((unsigned long)va, pte, 0))
495 BUG();
496
497 frames[f] = mfn;
498 }
499 475
500 if (HYPERVISOR_set_gdt(frames, size / sizeof(struct desc_struct))) 476 if (HYPERVISOR_set_gdt(&mfn, size / sizeof(struct desc_struct)))
501 BUG(); 477 BUG();
502} 478}
503 479
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c3621453ad87..9ce9cac16c3f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -95,18 +95,15 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx,
95{ 95{
96 struct mq_inflight *mi = priv; 96 struct mq_inflight *mi = priv;
97 97
98 if (blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) { 98 /*
99 /* 99 * index[0] counts the specific partition that was asked for. index[1]
100 * index[0] counts the specific partition that was asked 100 * counts the ones that are active on the whole device, so increment
101 * for. index[1] counts the ones that are active on the 101 * that if mi->part is indeed a partition, and not a whole device.
102 * whole device, so increment that if mi->part is indeed 102 */
103 * a partition, and not a whole device. 103 if (rq->part == mi->part)
104 */ 104 mi->inflight[0]++;
105 if (rq->part == mi->part) 105 if (mi->part->partno)
106 mi->inflight[0]++; 106 mi->inflight[1]++;
107 if (mi->part->partno)
108 mi->inflight[1]++;
109 }
110} 107}
111 108
112void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part, 109void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part,
@@ -118,6 +115,25 @@ void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part,
118 blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi); 115 blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi);
119} 116}
120 117
118static void blk_mq_check_inflight_rw(struct blk_mq_hw_ctx *hctx,
119 struct request *rq, void *priv,
120 bool reserved)
121{
122 struct mq_inflight *mi = priv;
123
124 if (rq->part == mi->part)
125 mi->inflight[rq_data_dir(rq)]++;
126}
127
128void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part,
129 unsigned int inflight[2])
130{
131 struct mq_inflight mi = { .part = part, .inflight = inflight, };
132
133 inflight[0] = inflight[1] = 0;
134 blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight_rw, &mi);
135}
136
121void blk_freeze_queue_start(struct request_queue *q) 137void blk_freeze_queue_start(struct request_queue *q)
122{ 138{
123 int freeze_depth; 139 int freeze_depth;
diff --git a/block/blk-mq.h b/block/blk-mq.h
index 89b5cd3a6c70..e1bb420dc5d6 100644
--- a/block/blk-mq.h
+++ b/block/blk-mq.h
@@ -188,7 +188,9 @@ static inline bool blk_mq_hw_queue_mapped(struct blk_mq_hw_ctx *hctx)
188} 188}
189 189
190void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part, 190void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part,
191 unsigned int inflight[2]); 191 unsigned int inflight[2]);
192void blk_mq_in_flight_rw(struct request_queue *q, struct hd_struct *part,
193 unsigned int inflight[2]);
192 194
193static inline void blk_mq_put_dispatch_budget(struct blk_mq_hw_ctx *hctx) 195static inline void blk_mq_put_dispatch_budget(struct blk_mq_hw_ctx *hctx)
194{ 196{
diff --git a/block/genhd.c b/block/genhd.c
index dc7e089373b9..c4513fe1adda 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -82,6 +82,18 @@ void part_in_flight(struct request_queue *q, struct hd_struct *part,
82 } 82 }
83} 83}
84 84
85void part_in_flight_rw(struct request_queue *q, struct hd_struct *part,
86 unsigned int inflight[2])
87{
88 if (q->mq_ops) {
89 blk_mq_in_flight_rw(q, part, inflight);
90 return;
91 }
92
93 inflight[0] = atomic_read(&part->in_flight[0]);
94 inflight[1] = atomic_read(&part->in_flight[1]);
95}
96
85struct hd_struct *__disk_get_part(struct gendisk *disk, int partno) 97struct hd_struct *__disk_get_part(struct gendisk *disk, int partno)
86{ 98{
87 struct disk_part_tbl *ptbl = rcu_dereference(disk->part_tbl); 99 struct disk_part_tbl *ptbl = rcu_dereference(disk->part_tbl);
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 08dabcd8b6ae..db57cced9b98 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -145,13 +145,15 @@ ssize_t part_stat_show(struct device *dev,
145 jiffies_to_msecs(part_stat_read(p, time_in_queue))); 145 jiffies_to_msecs(part_stat_read(p, time_in_queue)));
146} 146}
147 147
148ssize_t part_inflight_show(struct device *dev, 148ssize_t part_inflight_show(struct device *dev, struct device_attribute *attr,
149 struct device_attribute *attr, char *buf) 149 char *buf)
150{ 150{
151 struct hd_struct *p = dev_to_part(dev); 151 struct hd_struct *p = dev_to_part(dev);
152 struct request_queue *q = part_to_disk(p)->queue;
153 unsigned int inflight[2];
152 154
153 return sprintf(buf, "%8u %8u\n", atomic_read(&p->in_flight[0]), 155 part_in_flight_rw(q, p, inflight);
154 atomic_read(&p->in_flight[1])); 156 return sprintf(buf, "%8u %8u\n", inflight[0], inflight[1]);
155} 157}
156 158
157#ifdef CONFIG_FAIL_MAKE_REQUEST 159#ifdef CONFIG_FAIL_MAKE_REQUEST
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 1ff17799769d..6389c88b3500 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -698,7 +698,7 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
698 698
699 DPRINTK("ENTER\n"); 699 DPRINTK("ENTER\n");
700 700
701 ahci_stop_engine(ap); 701 hpriv->stop_engine(ap);
702 702
703 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), 703 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context),
704 deadline, &online, NULL); 704 deadline, &online, NULL);
@@ -724,7 +724,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
724 bool online; 724 bool online;
725 int rc; 725 int rc;
726 726
727 ahci_stop_engine(ap); 727 hpriv->stop_engine(ap);
728 728
729 /* clear D2H reception area to properly wait for D2H FIS */ 729 /* clear D2H reception area to properly wait for D2H FIS */
730 ata_tf_init(link->device, &tf); 730 ata_tf_init(link->device, &tf);
@@ -788,7 +788,7 @@ static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
788 788
789 DPRINTK("ENTER\n"); 789 DPRINTK("ENTER\n");
790 790
791 ahci_stop_engine(ap); 791 hpriv->stop_engine(ap);
792 792
793 for (i = 0; i < 2; i++) { 793 for (i = 0; i < 2; i++) {
794 u16 val; 794 u16 val;
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 4356ef1d28a8..824bd399f02e 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -350,7 +350,6 @@ struct ahci_host_priv {
350 u32 em_msg_type; /* EM message type */ 350 u32 em_msg_type; /* EM message type */
351 bool got_runtime_pm; /* Did we do pm_runtime_get? */ 351 bool got_runtime_pm; /* Did we do pm_runtime_get? */
352 struct clk *clks[AHCI_MAX_CLKS]; /* Optional */ 352 struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
353 struct reset_control *rsts; /* Optional */
354 struct regulator **target_pwrs; /* Optional */ 353 struct regulator **target_pwrs; /* Optional */
355 /* 354 /*
356 * If platform uses PHYs. There is a 1:1 relation between the port number and 355 * If platform uses PHYs. There is a 1:1 relation between the port number and
@@ -366,6 +365,13 @@ struct ahci_host_priv {
366 * be overridden anytime before the host is activated. 365 * be overridden anytime before the host is activated.
367 */ 366 */
368 void (*start_engine)(struct ata_port *ap); 367 void (*start_engine)(struct ata_port *ap);
368 /*
369 * Optional ahci_stop_engine override, if not set this gets set to the
370 * default ahci_stop_engine during ahci_save_initial_config, this can
371 * be overridden anytime before the host is activated.
372 */
373 int (*stop_engine)(struct ata_port *ap);
374
369 irqreturn_t (*irq_handler)(int irq, void *dev_instance); 375 irqreturn_t (*irq_handler)(int irq, void *dev_instance);
370 376
371 /* only required for per-port MSI(-X) support */ 377 /* only required for per-port MSI(-X) support */
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index de7128d81e9c..0045dacd814b 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -62,6 +62,60 @@ static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv)
62 writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA); 62 writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
63} 63}
64 64
65/**
66 * ahci_mvebu_stop_engine
67 *
68 * @ap: Target ata port
69 *
70 * Errata Ref#226 - SATA Disk HOT swap issue when connected through
71 * Port Multiplier in FIS-based Switching mode.
72 *
73 * To avoid the issue, according to design, the bits[11:8, 0] of
74 * register PxFBS are cleared when Port Command and Status (0x18) bit[0]
75 * changes its value from 1 to 0, i.e. falling edge of Port
76 * Command and Status bit[0] sends PULSE that resets PxFBS
77 * bits[11:8; 0].
78 *
79 * This function is used to override function of "ahci_stop_engine"
80 * from libahci.c by adding the mvebu work around(WA) to save PxFBS
81 * value before the PxCMD ST write of 0, then restore PxFBS value.
82 *
83 * Return: 0 on success; Error code otherwise.
84 */
85int ahci_mvebu_stop_engine(struct ata_port *ap)
86{
87 void __iomem *port_mmio = ahci_port_base(ap);
88 u32 tmp, port_fbs;
89
90 tmp = readl(port_mmio + PORT_CMD);
91
92 /* check if the HBA is idle */
93 if ((tmp & (PORT_CMD_START | PORT_CMD_LIST_ON)) == 0)
94 return 0;
95
96 /* save the port PxFBS register for later restore */
97 port_fbs = readl(port_mmio + PORT_FBS);
98
99 /* setting HBA to idle */
100 tmp &= ~PORT_CMD_START;
101 writel(tmp, port_mmio + PORT_CMD);
102
103 /*
104 * bit #15 PxCMD signal doesn't clear PxFBS,
105 * restore the PxFBS register right after clearing the PxCMD ST,
106 * no need to wait for the PxCMD bit #15.
107 */
108 writel(port_fbs, port_mmio + PORT_FBS);
109
110 /* wait for engine to stop. This could be as long as 500 msec */
111 tmp = ata_wait_register(ap, port_mmio + PORT_CMD,
112 PORT_CMD_LIST_ON, PORT_CMD_LIST_ON, 1, 500);
113 if (tmp & PORT_CMD_LIST_ON)
114 return -EIO;
115
116 return 0;
117}
118
65#ifdef CONFIG_PM_SLEEP 119#ifdef CONFIG_PM_SLEEP
66static int ahci_mvebu_suspend(struct platform_device *pdev, pm_message_t state) 120static int ahci_mvebu_suspend(struct platform_device *pdev, pm_message_t state)
67{ 121{
@@ -112,6 +166,8 @@ static int ahci_mvebu_probe(struct platform_device *pdev)
112 if (rc) 166 if (rc)
113 return rc; 167 return rc;
114 168
169 hpriv->stop_engine = ahci_mvebu_stop_engine;
170
115 if (of_device_is_compatible(pdev->dev.of_node, 171 if (of_device_is_compatible(pdev->dev.of_node,
116 "marvell,armada-380-ahci")) { 172 "marvell,armada-380-ahci")) {
117 dram = mv_mbus_dram_info(); 173 dram = mv_mbus_dram_info();
diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index 2685f28160f7..cfdef4d44ae9 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -96,7 +96,7 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
96 96
97 DPRINTK("ENTER\n"); 97 DPRINTK("ENTER\n");
98 98
99 ahci_stop_engine(ap); 99 hpriv->stop_engine(ap);
100 100
101 /* 101 /*
102 * There is a errata on ls1021a Rev1.0 and Rev2.0 which is: 102 * There is a errata on ls1021a Rev1.0 and Rev2.0 which is:
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index c2b5941d9184..ad58da7c9aff 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -165,7 +165,7 @@ static int xgene_ahci_restart_engine(struct ata_port *ap)
165 PORT_CMD_ISSUE, 0x0, 1, 100)) 165 PORT_CMD_ISSUE, 0x0, 1, 100))
166 return -EBUSY; 166 return -EBUSY;
167 167
168 ahci_stop_engine(ap); 168 hpriv->stop_engine(ap);
169 ahci_start_fis_rx(ap); 169 ahci_start_fis_rx(ap);
170 170
171 /* 171 /*
@@ -421,7 +421,7 @@ static int xgene_ahci_hardreset(struct ata_link *link, unsigned int *class,
421 portrxfis_saved = readl(port_mmio + PORT_FIS_ADDR); 421 portrxfis_saved = readl(port_mmio + PORT_FIS_ADDR);
422 portrxfishi_saved = readl(port_mmio + PORT_FIS_ADDR_HI); 422 portrxfishi_saved = readl(port_mmio + PORT_FIS_ADDR_HI);
423 423
424 ahci_stop_engine(ap); 424 hpriv->stop_engine(ap);
425 425
426 rc = xgene_ahci_do_hardreset(link, deadline, &online); 426 rc = xgene_ahci_do_hardreset(link, deadline, &online);
427 427
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 7adcf3caabd0..e5d90977caec 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -560,6 +560,9 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
560 if (!hpriv->start_engine) 560 if (!hpriv->start_engine)
561 hpriv->start_engine = ahci_start_engine; 561 hpriv->start_engine = ahci_start_engine;
562 562
563 if (!hpriv->stop_engine)
564 hpriv->stop_engine = ahci_stop_engine;
565
563 if (!hpriv->irq_handler) 566 if (!hpriv->irq_handler)
564 hpriv->irq_handler = ahci_single_level_irq_intr; 567 hpriv->irq_handler = ahci_single_level_irq_intr;
565} 568}
@@ -897,9 +900,10 @@ static void ahci_start_port(struct ata_port *ap)
897static int ahci_deinit_port(struct ata_port *ap, const char **emsg) 900static int ahci_deinit_port(struct ata_port *ap, const char **emsg)
898{ 901{
899 int rc; 902 int rc;
903 struct ahci_host_priv *hpriv = ap->host->private_data;
900 904
901 /* disable DMA */ 905 /* disable DMA */
902 rc = ahci_stop_engine(ap); 906 rc = hpriv->stop_engine(ap);
903 if (rc) { 907 if (rc) {
904 *emsg = "failed to stop engine"; 908 *emsg = "failed to stop engine";
905 return rc; 909 return rc;
@@ -1310,7 +1314,7 @@ int ahci_kick_engine(struct ata_port *ap)
1310 int busy, rc; 1314 int busy, rc;
1311 1315
1312 /* stop engine */ 1316 /* stop engine */
1313 rc = ahci_stop_engine(ap); 1317 rc = hpriv->stop_engine(ap);
1314 if (rc) 1318 if (rc)
1315 goto out_restart; 1319 goto out_restart;
1316 1320
@@ -1549,7 +1553,7 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class,
1549 1553
1550 DPRINTK("ENTER\n"); 1554 DPRINTK("ENTER\n");
1551 1555
1552 ahci_stop_engine(ap); 1556 hpriv->stop_engine(ap);
1553 1557
1554 /* clear D2H reception area to properly wait for D2H FIS */ 1558 /* clear D2H reception area to properly wait for D2H FIS */
1555 ata_tf_init(link->device, &tf); 1559 ata_tf_init(link->device, &tf);
@@ -2075,14 +2079,14 @@ void ahci_error_handler(struct ata_port *ap)
2075 2079
2076 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { 2080 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
2077 /* restart engine */ 2081 /* restart engine */
2078 ahci_stop_engine(ap); 2082 hpriv->stop_engine(ap);
2079 hpriv->start_engine(ap); 2083 hpriv->start_engine(ap);
2080 } 2084 }
2081 2085
2082 sata_pmp_error_handler(ap); 2086 sata_pmp_error_handler(ap);
2083 2087
2084 if (!ata_dev_enabled(ap->link.device)) 2088 if (!ata_dev_enabled(ap->link.device))
2085 ahci_stop_engine(ap); 2089 hpriv->stop_engine(ap);
2086} 2090}
2087EXPORT_SYMBOL_GPL(ahci_error_handler); 2091EXPORT_SYMBOL_GPL(ahci_error_handler);
2088 2092
@@ -2129,7 +2133,7 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
2129 return; 2133 return;
2130 2134
2131 /* set DITO, MDAT, DETO and enable DevSlp, need to stop engine first */ 2135 /* set DITO, MDAT, DETO and enable DevSlp, need to stop engine first */
2132 rc = ahci_stop_engine(ap); 2136 rc = hpriv->stop_engine(ap);
2133 if (rc) 2137 if (rc)
2134 return; 2138 return;
2135 2139
@@ -2189,7 +2193,7 @@ static void ahci_enable_fbs(struct ata_port *ap)
2189 return; 2193 return;
2190 } 2194 }
2191 2195
2192 rc = ahci_stop_engine(ap); 2196 rc = hpriv->stop_engine(ap);
2193 if (rc) 2197 if (rc)
2194 return; 2198 return;
2195 2199
@@ -2222,7 +2226,7 @@ static void ahci_disable_fbs(struct ata_port *ap)
2222 return; 2226 return;
2223 } 2227 }
2224 2228
2225 rc = ahci_stop_engine(ap); 2229 rc = hpriv->stop_engine(ap);
2226 if (rc) 2230 if (rc)
2227 return; 2231 return;
2228 2232
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index 46a762442dc5..30cc8f1a31e1 100644
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -25,7 +25,6 @@
25#include <linux/phy/phy.h> 25#include <linux/phy/phy.h>
26#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <linux/reset.h>
29#include "ahci.h" 28#include "ahci.h"
30 29
31static void ahci_host_stop(struct ata_host *host); 30static void ahci_host_stop(struct ata_host *host);
@@ -196,8 +195,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators);
196 * following order: 195 * following order:
197 * 1) Regulator 196 * 1) Regulator
198 * 2) Clocks (through ahci_platform_enable_clks) 197 * 2) Clocks (through ahci_platform_enable_clks)
199 * 3) Resets 198 * 3) Phys
200 * 4) Phys
201 * 199 *
202 * If resource enabling fails at any point the previous enabled resources 200 * If resource enabling fails at any point the previous enabled resources
203 * are disabled in reverse order. 201 * are disabled in reverse order.
@@ -217,19 +215,12 @@ int ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
217 if (rc) 215 if (rc)
218 goto disable_regulator; 216 goto disable_regulator;
219 217
220 rc = reset_control_deassert(hpriv->rsts);
221 if (rc)
222 goto disable_clks;
223
224 rc = ahci_platform_enable_phys(hpriv); 218 rc = ahci_platform_enable_phys(hpriv);
225 if (rc) 219 if (rc)
226 goto disable_resets; 220 goto disable_clks;
227 221
228 return 0; 222 return 0;
229 223
230disable_resets:
231 reset_control_assert(hpriv->rsts);
232
233disable_clks: 224disable_clks:
234 ahci_platform_disable_clks(hpriv); 225 ahci_platform_disable_clks(hpriv);
235 226
@@ -248,15 +239,12 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources);
248 * following order: 239 * following order:
249 * 1) Phys 240 * 1) Phys
250 * 2) Clocks (through ahci_platform_disable_clks) 241 * 2) Clocks (through ahci_platform_disable_clks)
251 * 3) Resets 242 * 3) Regulator
252 * 4) Regulator
253 */ 243 */
254void ahci_platform_disable_resources(struct ahci_host_priv *hpriv) 244void ahci_platform_disable_resources(struct ahci_host_priv *hpriv)
255{ 245{
256 ahci_platform_disable_phys(hpriv); 246 ahci_platform_disable_phys(hpriv);
257 247
258 reset_control_assert(hpriv->rsts);
259
260 ahci_platform_disable_clks(hpriv); 248 ahci_platform_disable_clks(hpriv);
261 249
262 ahci_platform_disable_regulators(hpriv); 250 ahci_platform_disable_regulators(hpriv);
@@ -405,12 +393,6 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
405 hpriv->clks[i] = clk; 393 hpriv->clks[i] = clk;
406 } 394 }
407 395
408 hpriv->rsts = devm_reset_control_array_get_optional_shared(dev);
409 if (IS_ERR(hpriv->rsts)) {
410 rc = PTR_ERR(hpriv->rsts);
411 goto err_out;
412 }
413
414 hpriv->nports = child_nodes = of_get_child_count(dev->of_node); 396 hpriv->nports = child_nodes = of_get_child_count(dev->of_node);
415 397
416 /* 398 /*
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8bc71ca61e7f..68596bd4cf06 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4549,6 +4549,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4549 ATA_HORKAGE_ZERO_AFTER_TRIM | 4549 ATA_HORKAGE_ZERO_AFTER_TRIM |
4550 ATA_HORKAGE_NOLPM, }, 4550 ATA_HORKAGE_NOLPM, },
4551 4551
4552 /* This specific Samsung model/firmware-rev does not handle LPM well */
4553 { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, },
4554
4555 /* Sandisk devices which are known to not handle LPM well */
4556 { "SanDisk SD7UB3Q*G1001", NULL, ATA_HORKAGE_NOLPM, },
4557
4552 /* devices that don't properly handle queued TRIM commands */ 4558 /* devices that don't properly handle queued TRIM commands */
4553 { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | 4559 { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
4554 ATA_HORKAGE_ZERO_AFTER_TRIM, }, 4560 ATA_HORKAGE_ZERO_AFTER_TRIM, },
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index c016829a38fd..513b260bcff1 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -175,8 +175,8 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
175{ } 175{ }
176#endif /* CONFIG_PM */ 176#endif /* CONFIG_PM */
177 177
178static void __ata_ehi_pushv_desc(struct ata_eh_info *ehi, const char *fmt, 178static __printf(2, 0) void __ata_ehi_pushv_desc(struct ata_eh_info *ehi,
179 va_list args) 179 const char *fmt, va_list args)
180{ 180{
181 ehi->desc_len += vscnprintf(ehi->desc + ehi->desc_len, 181 ehi->desc_len += vscnprintf(ehi->desc + ehi->desc_len,
182 ATA_EH_DESC_LEN - ehi->desc_len, 182 ATA_EH_DESC_LEN - ehi->desc_len,
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index aafb8cc03523..e67815b896fc 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -410,7 +410,7 @@ static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
410 int rc; 410 int rc;
411 int retry = 100; 411 int retry = 100;
412 412
413 ahci_stop_engine(ap); 413 hpriv->stop_engine(ap);
414 414
415 /* clear D2H reception area to properly wait for D2H FIS */ 415 /* clear D2H reception area to properly wait for D2H FIS */
416 ata_tf_init(link->device, &tf); 416 ata_tf_init(link->device, &tf);
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 4b1995e2d044..010ca101d412 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -285,13 +285,13 @@ static const struct sil24_cerr_info {
285 [PORT_CERR_INCONSISTENT] = { AC_ERR_HSM, ATA_EH_RESET, 285 [PORT_CERR_INCONSISTENT] = { AC_ERR_HSM, ATA_EH_RESET,
286 "protocol mismatch" }, 286 "protocol mismatch" },
287 [PORT_CERR_DIRECTION] = { AC_ERR_HSM, ATA_EH_RESET, 287 [PORT_CERR_DIRECTION] = { AC_ERR_HSM, ATA_EH_RESET,
288 "data directon mismatch" }, 288 "data direction mismatch" },
289 [PORT_CERR_UNDERRUN] = { AC_ERR_HSM, ATA_EH_RESET, 289 [PORT_CERR_UNDERRUN] = { AC_ERR_HSM, ATA_EH_RESET,
290 "ran out of SGEs while writing" }, 290 "ran out of SGEs while writing" },
291 [PORT_CERR_OVERRUN] = { AC_ERR_HSM, ATA_EH_RESET, 291 [PORT_CERR_OVERRUN] = { AC_ERR_HSM, ATA_EH_RESET,
292 "ran out of SGEs while reading" }, 292 "ran out of SGEs while reading" },
293 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_RESET, 293 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_RESET,
294 "invalid data directon for ATAPI CDB" }, 294 "invalid data direction for ATAPI CDB" },
295 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_RESET, 295 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_RESET,
296 "SGT not on qword boundary" }, 296 "SGT not on qword boundary" },
297 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET, 297 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_RESET,
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index d97c05690faa..4e46dc9e41ad 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -191,7 +191,7 @@ static char *res_strings[] = {
191 "reserved 37", 191 "reserved 37",
192 "reserved 38", 192 "reserved 38",
193 "reserved 39", 193 "reserved 39",
194 "reseverd 40", 194 "reserved 40",
195 "reserved 41", 195 "reserved 41",
196 "reserved 42", 196 "reserved 42",
197 "reserved 43", 197 "reserved 43",
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 1ef67db03c8e..9c9a22958717 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -28,6 +28,7 @@
28#include <asm/io.h> 28#include <asm/io.h>
29#include <linux/atomic.h> 29#include <linux/atomic.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/nospec.h>
31 32
32#include "uPD98401.h" 33#include "uPD98401.h"
33#include "uPD98402.h" 34#include "uPD98402.h"
@@ -1458,6 +1459,8 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)
1458 return -EFAULT; 1459 return -EFAULT;
1459 if (pool < 0 || pool > ZATM_LAST_POOL) 1460 if (pool < 0 || pool > ZATM_LAST_POOL)
1460 return -EINVAL; 1461 return -EINVAL;
1462 pool = array_index_nospec(pool,
1463 ZATM_LAST_POOL + 1);
1461 spin_lock_irqsave(&zatm_dev->lock, flags); 1464 spin_lock_irqsave(&zatm_dev->lock, flags);
1462 info = zatm_dev->pool_info[pool]; 1465 info = zatm_dev->pool_info[pool];
1463 if (cmd == ZATM_GETPOOLZ) { 1466 if (cmd == ZATM_GETPOOLZ) {
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8e8b04cc569a..33b36fea1d73 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2366,7 +2366,9 @@ static int rbd_obj_issue_copyup(struct rbd_obj_request *obj_req, u32 bytes)
2366 osd_req_op_cls_init(obj_req->osd_req, 0, CEPH_OSD_OP_CALL, "rbd", 2366 osd_req_op_cls_init(obj_req->osd_req, 0, CEPH_OSD_OP_CALL, "rbd",
2367 "copyup"); 2367 "copyup");
2368 osd_req_op_cls_request_data_bvecs(obj_req->osd_req, 0, 2368 osd_req_op_cls_request_data_bvecs(obj_req->osd_req, 0,
2369 obj_req->copyup_bvecs, bytes); 2369 obj_req->copyup_bvecs,
2370 obj_req->copyup_bvec_count,
2371 bytes);
2370 2372
2371 switch (obj_req->img_request->op_type) { 2373 switch (obj_req->img_request->op_type) {
2372 case OBJ_OP_WRITE: 2374 case OBJ_OP_WRITE:
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index c8c8b0b8d333..b937cc1e2c07 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -231,6 +231,7 @@ static const struct usb_device_id blacklist_table[] = {
231 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, 231 { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
232 { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, 232 { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
233 { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, 233 { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
234 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
234 { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, 235 { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
235 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, 236 { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
236 { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, 237 { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 },
@@ -263,7 +264,6 @@ static const struct usb_device_id blacklist_table[] = {
263 { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, 264 { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
264 265
265 /* QCA ROME chipset */ 266 /* QCA ROME chipset */
266 { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_QCA_ROME },
267 { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME }, 267 { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME },
268 { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME }, 268 { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME },
269 { USB_DEVICE(0x0cf3, 0xe010), .driver_info = BTUSB_QCA_ROME }, 269 { USB_DEVICE(0x0cf3, 0xe010), .driver_info = BTUSB_QCA_ROME },
@@ -399,6 +399,13 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
399 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 3060"), 399 DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 3060"),
400 }, 400 },
401 }, 401 },
402 {
403 /* Dell XPS 9360 (QCA ROME device 0cf3:e300) */
404 .matches = {
405 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
406 DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"),
407 },
408 },
402 {} 409 {}
403}; 410};
404 411
@@ -2852,6 +2859,12 @@ static int btusb_config_oob_wake(struct hci_dev *hdev)
2852} 2859}
2853#endif 2860#endif
2854 2861
2862static void btusb_check_needs_reset_resume(struct usb_interface *intf)
2863{
2864 if (dmi_check_system(btusb_needs_reset_resume_table))
2865 interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
2866}
2867
2855static int btusb_probe(struct usb_interface *intf, 2868static int btusb_probe(struct usb_interface *intf,
2856 const struct usb_device_id *id) 2869 const struct usb_device_id *id)
2857{ 2870{
@@ -2974,9 +2987,6 @@ static int btusb_probe(struct usb_interface *intf,
2974 hdev->send = btusb_send_frame; 2987 hdev->send = btusb_send_frame;
2975 hdev->notify = btusb_notify; 2988 hdev->notify = btusb_notify;
2976 2989
2977 if (dmi_check_system(btusb_needs_reset_resume_table))
2978 interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
2979
2980#ifdef CONFIG_PM 2990#ifdef CONFIG_PM
2981 err = btusb_config_oob_wake(hdev); 2991 err = btusb_config_oob_wake(hdev);
2982 if (err) 2992 if (err)
@@ -3064,6 +3074,7 @@ static int btusb_probe(struct usb_interface *intf,
3064 data->setup_on_usb = btusb_setup_qca; 3074 data->setup_on_usb = btusb_setup_qca;
3065 hdev->set_bdaddr = btusb_set_bdaddr_ath3012; 3075 hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
3066 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); 3076 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
3077 btusb_check_needs_reset_resume(intf);
3067 } 3078 }
3068 3079
3069#ifdef CONFIG_BT_HCIBTUSB_RTL 3080#ifdef CONFIG_BT_HCIBTUSB_RTL
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index c381c8e396fc..79d8c84693a1 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -195,7 +195,7 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, int ty
195 return 0; 195 return 0;
196} 196}
197 197
198int uninorth_remove_memory(struct agp_memory *mem, off_t pg_start, int type) 198static int uninorth_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
199{ 199{
200 size_t i; 200 size_t i;
201 u32 *gp; 201 u32 *gp;
@@ -470,7 +470,7 @@ static int uninorth_free_gatt_table(struct agp_bridge_data *bridge)
470 return 0; 470 return 0;
471} 471}
472 472
473void null_cache_flush(void) 473static void null_cache_flush(void)
474{ 474{
475 mb(); 475 mb();
476} 476}
diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index c58019750b7e..a2f8c42e527a 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -541,7 +541,7 @@ probe_err:
541 return ret; 541 return ret;
542} 542}
543 543
544static int cs2000_resume(struct device *dev) 544static int __maybe_unused cs2000_resume(struct device *dev)
545{ 545{
546 struct cs2000_priv *priv = dev_get_drvdata(dev); 546 struct cs2000_priv *priv = dev_get_drvdata(dev);
547 547
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index ac4a042f8658..1628b93655ed 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -112,10 +112,18 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
112 return 0; 112 return 0;
113} 113}
114 114
115static int clk_mux_determine_rate(struct clk_hw *hw,
116 struct clk_rate_request *req)
117{
118 struct clk_mux *mux = to_clk_mux(hw);
119
120 return clk_mux_determine_rate_flags(hw, req, mux->flags);
121}
122
115const struct clk_ops clk_mux_ops = { 123const struct clk_ops clk_mux_ops = {
116 .get_parent = clk_mux_get_parent, 124 .get_parent = clk_mux_get_parent,
117 .set_parent = clk_mux_set_parent, 125 .set_parent = clk_mux_set_parent,
118 .determine_rate = __clk_mux_determine_rate, 126 .determine_rate = clk_mux_determine_rate,
119}; 127};
120EXPORT_SYMBOL_GPL(clk_mux_ops); 128EXPORT_SYMBOL_GPL(clk_mux_ops);
121 129
diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c
index f1d5967b4b39..edd3cf451401 100644
--- a/drivers/clk/clk-stm32mp1.c
+++ b/drivers/clk/clk-stm32mp1.c
@@ -216,7 +216,7 @@ static const char * const usart1_src[] = {
216 "pclk5", "pll3_q", "ck_hsi", "ck_csi", "pll4_q", "ck_hse" 216 "pclk5", "pll3_q", "ck_hsi", "ck_csi", "pll4_q", "ck_hse"
217}; 217};
218 218
219const char * const usart234578_src[] = { 219static const char * const usart234578_src[] = {
220 "pclk1", "pll4_q", "ck_hsi", "ck_csi", "ck_hse" 220 "pclk1", "pll4_q", "ck_hsi", "ck_csi", "ck_hse"
221}; 221};
222 222
@@ -224,10 +224,6 @@ static const char * const usart6_src[] = {
224 "pclk2", "pll4_q", "ck_hsi", "ck_csi", "ck_hse" 224 "pclk2", "pll4_q", "ck_hsi", "ck_csi", "ck_hse"
225}; 225};
226 226
227static const char * const dfsdm_src[] = {
228 "pclk2", "ck_mcu"
229};
230
231static const char * const fdcan_src[] = { 227static const char * const fdcan_src[] = {
232 "ck_hse", "pll3_q", "pll4_q" 228 "ck_hse", "pll3_q", "pll4_q"
233}; 229};
@@ -316,10 +312,8 @@ struct stm32_clk_mgate {
316struct clock_config { 312struct clock_config {
317 u32 id; 313 u32 id;
318 const char *name; 314 const char *name;
319 union { 315 const char *parent_name;
320 const char *parent_name; 316 const char * const *parent_names;
321 const char * const *parent_names;
322 };
323 int num_parents; 317 int num_parents;
324 unsigned long flags; 318 unsigned long flags;
325 void *cfg; 319 void *cfg;
@@ -469,7 +463,7 @@ static void mp1_gate_clk_disable(struct clk_hw *hw)
469 } 463 }
470} 464}
471 465
472const struct clk_ops mp1_gate_clk_ops = { 466static const struct clk_ops mp1_gate_clk_ops = {
473 .enable = mp1_gate_clk_enable, 467 .enable = mp1_gate_clk_enable,
474 .disable = mp1_gate_clk_disable, 468 .disable = mp1_gate_clk_disable,
475 .is_enabled = clk_gate_is_enabled, 469 .is_enabled = clk_gate_is_enabled,
@@ -698,7 +692,7 @@ static void mp1_mgate_clk_disable(struct clk_hw *hw)
698 mp1_gate_clk_disable(hw); 692 mp1_gate_clk_disable(hw);
699} 693}
700 694
701const struct clk_ops mp1_mgate_clk_ops = { 695static const struct clk_ops mp1_mgate_clk_ops = {
702 .enable = mp1_mgate_clk_enable, 696 .enable = mp1_mgate_clk_enable,
703 .disable = mp1_mgate_clk_disable, 697 .disable = mp1_mgate_clk_disable,
704 .is_enabled = clk_gate_is_enabled, 698 .is_enabled = clk_gate_is_enabled,
@@ -732,7 +726,7 @@ static int clk_mmux_set_parent(struct clk_hw *hw, u8 index)
732 return 0; 726 return 0;
733} 727}
734 728
735const struct clk_ops clk_mmux_ops = { 729static const struct clk_ops clk_mmux_ops = {
736 .get_parent = clk_mmux_get_parent, 730 .get_parent = clk_mmux_get_parent,
737 .set_parent = clk_mmux_set_parent, 731 .set_parent = clk_mmux_set_parent,
738 .determine_rate = __clk_mux_determine_rate, 732 .determine_rate = __clk_mux_determine_rate,
@@ -1048,10 +1042,10 @@ struct stm32_pll_cfg {
1048 u32 offset; 1042 u32 offset;
1049}; 1043};
1050 1044
1051struct clk_hw *_clk_register_pll(struct device *dev, 1045static struct clk_hw *_clk_register_pll(struct device *dev,
1052 struct clk_hw_onecell_data *clk_data, 1046 struct clk_hw_onecell_data *clk_data,
1053 void __iomem *base, spinlock_t *lock, 1047 void __iomem *base, spinlock_t *lock,
1054 const struct clock_config *cfg) 1048 const struct clock_config *cfg)
1055{ 1049{
1056 struct stm32_pll_cfg *stm_pll_cfg = cfg->cfg; 1050 struct stm32_pll_cfg *stm_pll_cfg = cfg->cfg;
1057 1051
@@ -1405,7 +1399,8 @@ enum {
1405 G_USBH, 1399 G_USBH,
1406 G_ETHSTP, 1400 G_ETHSTP,
1407 G_RTCAPB, 1401 G_RTCAPB,
1408 G_TZC, 1402 G_TZC1,
1403 G_TZC2,
1409 G_TZPC, 1404 G_TZPC,
1410 G_IWDG1, 1405 G_IWDG1,
1411 G_BSEC, 1406 G_BSEC,
@@ -1417,7 +1412,7 @@ enum {
1417 G_LAST 1412 G_LAST
1418}; 1413};
1419 1414
1420struct stm32_mgate mp1_mgate[G_LAST]; 1415static struct stm32_mgate mp1_mgate[G_LAST];
1421 1416
1422#define _K_GATE(_id, _gate_offset, _gate_bit_idx, _gate_flags,\ 1417#define _K_GATE(_id, _gate_offset, _gate_bit_idx, _gate_flags,\
1423 _mgate, _ops)\ 1418 _mgate, _ops)\
@@ -1440,7 +1435,7 @@ struct stm32_mgate mp1_mgate[G_LAST];
1440 &mp1_mgate[_id], &mp1_mgate_clk_ops) 1435 &mp1_mgate[_id], &mp1_mgate_clk_ops)
1441 1436
1442/* Peripheral gates */ 1437/* Peripheral gates */
1443struct stm32_gate_cfg per_gate_cfg[G_LAST] = { 1438static struct stm32_gate_cfg per_gate_cfg[G_LAST] = {
1444 /* Multi gates */ 1439 /* Multi gates */
1445 K_GATE(G_MDIO, RCC_APB1ENSETR, 31, 0), 1440 K_GATE(G_MDIO, RCC_APB1ENSETR, 31, 0),
1446 K_MGATE(G_DAC12, RCC_APB1ENSETR, 29, 0), 1441 K_MGATE(G_DAC12, RCC_APB1ENSETR, 29, 0),
@@ -1506,7 +1501,8 @@ struct stm32_gate_cfg per_gate_cfg[G_LAST] = {
1506 K_GATE(G_BSEC, RCC_APB5ENSETR, 16, 0), 1501 K_GATE(G_BSEC, RCC_APB5ENSETR, 16, 0),
1507 K_GATE(G_IWDG1, RCC_APB5ENSETR, 15, 0), 1502 K_GATE(G_IWDG1, RCC_APB5ENSETR, 15, 0),
1508 K_GATE(G_TZPC, RCC_APB5ENSETR, 13, 0), 1503 K_GATE(G_TZPC, RCC_APB5ENSETR, 13, 0),
1509 K_GATE(G_TZC, RCC_APB5ENSETR, 12, 0), 1504 K_GATE(G_TZC2, RCC_APB5ENSETR, 12, 0),
1505 K_GATE(G_TZC1, RCC_APB5ENSETR, 11, 0),
1510 K_GATE(G_RTCAPB, RCC_APB5ENSETR, 8, 0), 1506 K_GATE(G_RTCAPB, RCC_APB5ENSETR, 8, 0),
1511 K_MGATE(G_USART1, RCC_APB5ENSETR, 4, 0), 1507 K_MGATE(G_USART1, RCC_APB5ENSETR, 4, 0),
1512 K_MGATE(G_I2C6, RCC_APB5ENSETR, 3, 0), 1508 K_MGATE(G_I2C6, RCC_APB5ENSETR, 3, 0),
@@ -1600,7 +1596,7 @@ enum {
1600 M_LAST 1596 M_LAST
1601}; 1597};
1602 1598
1603struct stm32_mmux ker_mux[M_LAST]; 1599static struct stm32_mmux ker_mux[M_LAST];
1604 1600
1605#define _K_MUX(_id, _offset, _shift, _width, _mux_flags, _mmux, _ops)\ 1601#define _K_MUX(_id, _offset, _shift, _width, _mux_flags, _mmux, _ops)\
1606 [_id] = {\ 1602 [_id] = {\
@@ -1623,7 +1619,7 @@ struct stm32_mmux ker_mux[M_LAST];
1623 _K_MUX(_id, _offset, _shift, _width, _mux_flags,\ 1619 _K_MUX(_id, _offset, _shift, _width, _mux_flags,\
1624 &ker_mux[_id], &clk_mmux_ops) 1620 &ker_mux[_id], &clk_mmux_ops)
1625 1621
1626const struct stm32_mux_cfg ker_mux_cfg[M_LAST] = { 1622static const struct stm32_mux_cfg ker_mux_cfg[M_LAST] = {
1627 /* Kernel multi mux */ 1623 /* Kernel multi mux */
1628 K_MMUX(M_SDMMC12, RCC_SDMMC12CKSELR, 0, 3, 0), 1624 K_MMUX(M_SDMMC12, RCC_SDMMC12CKSELR, 0, 3, 0),
1629 K_MMUX(M_SPI23, RCC_SPI2S23CKSELR, 0, 3, 0), 1625 K_MMUX(M_SPI23, RCC_SPI2S23CKSELR, 0, 3, 0),
@@ -1860,7 +1856,8 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
1860 PCLK(USART1, "usart1", "pclk5", 0, G_USART1), 1856 PCLK(USART1, "usart1", "pclk5", 0, G_USART1),
1861 PCLK(RTCAPB, "rtcapb", "pclk5", CLK_IGNORE_UNUSED | 1857 PCLK(RTCAPB, "rtcapb", "pclk5", CLK_IGNORE_UNUSED |
1862 CLK_IS_CRITICAL, G_RTCAPB), 1858 CLK_IS_CRITICAL, G_RTCAPB),
1863 PCLK(TZC, "tzc", "pclk5", CLK_IGNORE_UNUSED, G_TZC), 1859 PCLK(TZC1, "tzc1", "ck_axi", CLK_IGNORE_UNUSED, G_TZC1),
1860 PCLK(TZC2, "tzc2", "ck_axi", CLK_IGNORE_UNUSED, G_TZC2),
1864 PCLK(TZPC, "tzpc", "pclk5", CLK_IGNORE_UNUSED, G_TZPC), 1861 PCLK(TZPC, "tzpc", "pclk5", CLK_IGNORE_UNUSED, G_TZPC),
1865 PCLK(IWDG1, "iwdg1", "pclk5", 0, G_IWDG1), 1862 PCLK(IWDG1, "iwdg1", "pclk5", 0, G_IWDG1),
1866 PCLK(BSEC, "bsec", "pclk5", CLK_IGNORE_UNUSED, G_BSEC), 1863 PCLK(BSEC, "bsec", "pclk5", CLK_IGNORE_UNUSED, G_BSEC),
@@ -1916,8 +1913,7 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
1916 KCLK(RNG1_K, "rng1_k", rng_src, 0, G_RNG1, M_RNG1), 1913 KCLK(RNG1_K, "rng1_k", rng_src, 0, G_RNG1, M_RNG1),
1917 KCLK(RNG2_K, "rng2_k", rng_src, 0, G_RNG2, M_RNG2), 1914 KCLK(RNG2_K, "rng2_k", rng_src, 0, G_RNG2, M_RNG2),
1918 KCLK(USBPHY_K, "usbphy_k", usbphy_src, 0, G_USBPHY, M_USBPHY), 1915 KCLK(USBPHY_K, "usbphy_k", usbphy_src, 0, G_USBPHY, M_USBPHY),
1919 KCLK(STGEN_K, "stgen_k", stgen_src, CLK_IGNORE_UNUSED, 1916 KCLK(STGEN_K, "stgen_k", stgen_src, CLK_IS_CRITICAL, G_STGEN, M_STGEN),
1920 G_STGEN, M_STGEN),
1921 KCLK(SPDIF_K, "spdif_k", spdif_src, 0, G_SPDIF, M_SPDIF), 1917 KCLK(SPDIF_K, "spdif_k", spdif_src, 0, G_SPDIF, M_SPDIF),
1922 KCLK(SPI1_K, "spi1_k", spi123_src, 0, G_SPI1, M_SPI1), 1918 KCLK(SPI1_K, "spi1_k", spi123_src, 0, G_SPI1, M_SPI1),
1923 KCLK(SPI2_K, "spi2_k", spi123_src, 0, G_SPI2, M_SPI23), 1919 KCLK(SPI2_K, "spi2_k", spi123_src, 0, G_SPI2, M_SPI23),
@@ -1948,8 +1944,8 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
1948 KCLK(FDCAN_K, "fdcan_k", fdcan_src, 0, G_FDCAN, M_FDCAN), 1944 KCLK(FDCAN_K, "fdcan_k", fdcan_src, 0, G_FDCAN, M_FDCAN),
1949 KCLK(SAI1_K, "sai1_k", sai_src, 0, G_SAI1, M_SAI1), 1945 KCLK(SAI1_K, "sai1_k", sai_src, 0, G_SAI1, M_SAI1),
1950 KCLK(SAI2_K, "sai2_k", sai2_src, 0, G_SAI2, M_SAI2), 1946 KCLK(SAI2_K, "sai2_k", sai2_src, 0, G_SAI2, M_SAI2),
1951 KCLK(SAI3_K, "sai3_k", sai_src, 0, G_SAI2, M_SAI3), 1947 KCLK(SAI3_K, "sai3_k", sai_src, 0, G_SAI3, M_SAI3),
1952 KCLK(SAI4_K, "sai4_k", sai_src, 0, G_SAI2, M_SAI4), 1948 KCLK(SAI4_K, "sai4_k", sai_src, 0, G_SAI4, M_SAI4),
1953 KCLK(ADC12_K, "adc12_k", adc12_src, 0, G_ADC12, M_ADC12), 1949 KCLK(ADC12_K, "adc12_k", adc12_src, 0, G_ADC12, M_ADC12),
1954 KCLK(DSI_K, "dsi_k", dsi_src, 0, G_DSI, M_DSI), 1950 KCLK(DSI_K, "dsi_k", dsi_src, 0, G_DSI, M_DSI),
1955 KCLK(ADFSDM_K, "adfsdm_k", sai_src, 0, G_ADFSDM, M_SAI1), 1951 KCLK(ADFSDM_K, "adfsdm_k", sai_src, 0, G_ADFSDM, M_SAI1),
@@ -1992,10 +1988,6 @@ static const struct clock_config stm32mp1_clock_cfg[] = {
1992 _DIV(RCC_MCO2CFGR, 4, 4, 0, NULL)), 1988 _DIV(RCC_MCO2CFGR, 4, 4, 0, NULL)),
1993 1989
1994 /* Debug clocks */ 1990 /* Debug clocks */
1995 FIXED_FACTOR(NO_ID, "ck_axi_div2", "ck_axi", 0, 1, 2),
1996
1997 GATE(DBG, "ck_apb_dbg", "ck_axi_div2", 0, RCC_DBGCFGR, 8, 0),
1998
1999 GATE(CK_DBG, "ck_sys_dbg", "ck_axi", 0, RCC_DBGCFGR, 8, 0), 1991 GATE(CK_DBG, "ck_sys_dbg", "ck_axi", 0, RCC_DBGCFGR, 8, 0),
2000 1992
2001 COMPOSITE(CK_TRACE, "ck_trace", ck_trace_src, CLK_OPS_PARENT_ENABLE, 1993 COMPOSITE(CK_TRACE, "ck_trace", ck_trace_src, CLK_OPS_PARENT_ENABLE,
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index ea67ac81c6f9..7af555f0e60c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -426,9 +426,9 @@ static bool mux_is_better_rate(unsigned long rate, unsigned long now,
426 return now <= rate && now > best; 426 return now <= rate && now > best;
427} 427}
428 428
429static int 429int clk_mux_determine_rate_flags(struct clk_hw *hw,
430clk_mux_determine_rate_flags(struct clk_hw *hw, struct clk_rate_request *req, 430 struct clk_rate_request *req,
431 unsigned long flags) 431 unsigned long flags)
432{ 432{
433 struct clk_core *core = hw->core, *parent, *best_parent = NULL; 433 struct clk_core *core = hw->core, *parent, *best_parent = NULL;
434 int i, num_parents, ret; 434 int i, num_parents, ret;
@@ -488,6 +488,7 @@ out:
488 488
489 return 0; 489 return 0;
490} 490}
491EXPORT_SYMBOL_GPL(clk_mux_determine_rate_flags);
491 492
492struct clk *__clk_lookup(const char *name) 493struct clk *__clk_lookup(const char *name)
493{ 494{
diff --git a/drivers/clk/meson/clk-regmap.c b/drivers/clk/meson/clk-regmap.c
index 3645fdb62343..ab7a3556f5b2 100644
--- a/drivers/clk/meson/clk-regmap.c
+++ b/drivers/clk/meson/clk-regmap.c
@@ -153,10 +153,19 @@ static int clk_regmap_mux_set_parent(struct clk_hw *hw, u8 index)
153 val << mux->shift); 153 val << mux->shift);
154} 154}
155 155
156static int clk_regmap_mux_determine_rate(struct clk_hw *hw,
157 struct clk_rate_request *req)
158{
159 struct clk_regmap *clk = to_clk_regmap(hw);
160 struct clk_regmap_mux_data *mux = clk_get_regmap_mux_data(clk);
161
162 return clk_mux_determine_rate_flags(hw, req, mux->flags);
163}
164
156const struct clk_ops clk_regmap_mux_ops = { 165const struct clk_ops clk_regmap_mux_ops = {
157 .get_parent = clk_regmap_mux_get_parent, 166 .get_parent = clk_regmap_mux_get_parent,
158 .set_parent = clk_regmap_mux_set_parent, 167 .set_parent = clk_regmap_mux_set_parent,
159 .determine_rate = __clk_mux_determine_rate, 168 .determine_rate = clk_regmap_mux_determine_rate,
160}; 169};
161EXPORT_SYMBOL_GPL(clk_regmap_mux_ops); 170EXPORT_SYMBOL_GPL(clk_regmap_mux_ops);
162 171
diff --git a/drivers/clk/meson/gxbb-aoclk.h b/drivers/clk/meson/gxbb-aoclk.h
index 0be78383f257..badc4c22b4ee 100644
--- a/drivers/clk/meson/gxbb-aoclk.h
+++ b/drivers/clk/meson/gxbb-aoclk.h
@@ -17,8 +17,6 @@
17#define AO_RTC_ALT_CLK_CNTL0 0x94 17#define AO_RTC_ALT_CLK_CNTL0 0x94
18#define AO_RTC_ALT_CLK_CNTL1 0x98 18#define AO_RTC_ALT_CLK_CNTL1 0x98
19 19
20extern const struct clk_ops meson_aoclk_gate_regmap_ops;
21
22struct aoclk_cec_32k { 20struct aoclk_cec_32k {
23 struct clk_hw hw; 21 struct clk_hw hw;
24 struct regmap *regmap; 22 struct regmap *regmap;
diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index cc2992493e0b..d0524ec71aad 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -253,7 +253,7 @@ static struct clk_fixed_factor meson8b_fclk_div3_div = {
253 .mult = 1, 253 .mult = 1,
254 .div = 3, 254 .div = 3,
255 .hw.init = &(struct clk_init_data){ 255 .hw.init = &(struct clk_init_data){
256 .name = "fclk_div_div3", 256 .name = "fclk_div3_div",
257 .ops = &clk_fixed_factor_ops, 257 .ops = &clk_fixed_factor_ops,
258 .parent_names = (const char *[]){ "fixed_pll" }, 258 .parent_names = (const char *[]){ "fixed_pll" },
259 .num_parents = 1, 259 .num_parents = 1,
@@ -632,7 +632,8 @@ static struct clk_regmap meson8b_cpu_clk = {
632 .hw.init = &(struct clk_init_data){ 632 .hw.init = &(struct clk_init_data){
633 .name = "cpu_clk", 633 .name = "cpu_clk",
634 .ops = &clk_regmap_mux_ro_ops, 634 .ops = &clk_regmap_mux_ro_ops,
635 .parent_names = (const char *[]){ "xtal", "cpu_out_sel" }, 635 .parent_names = (const char *[]){ "xtal",
636 "cpu_scale_out_sel" },
636 .num_parents = 2, 637 .num_parents = 2,
637 .flags = (CLK_SET_RATE_PARENT | 638 .flags = (CLK_SET_RATE_PARENT |
638 CLK_SET_RATE_NO_REPARENT), 639 CLK_SET_RATE_NO_REPARENT),
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index bc5fc1630876..b15115a48775 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -126,6 +126,49 @@ static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy)
126 cpu->perf_caps.lowest_perf, cpu_num, ret); 126 cpu->perf_caps.lowest_perf, cpu_num, ret);
127} 127}
128 128
129/*
130 * The PCC subspace describes the rate at which platform can accept commands
131 * on the shared PCC channel (including READs which do not count towards freq
132 * trasition requests), so ideally we need to use the PCC values as a fallback
133 * if we don't have a platform specific transition_delay_us
134 */
135#ifdef CONFIG_ARM64
136#include <asm/cputype.h>
137
138static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu)
139{
140 unsigned long implementor = read_cpuid_implementor();
141 unsigned long part_num = read_cpuid_part_number();
142 unsigned int delay_us = 0;
143
144 switch (implementor) {
145 case ARM_CPU_IMP_QCOM:
146 switch (part_num) {
147 case QCOM_CPU_PART_FALKOR_V1:
148 case QCOM_CPU_PART_FALKOR:
149 delay_us = 10000;
150 break;
151 default:
152 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
153 break;
154 }
155 break;
156 default:
157 delay_us = cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
158 break;
159 }
160
161 return delay_us;
162}
163
164#else
165
166static unsigned int cppc_cpufreq_get_transition_delay_us(int cpu)
167{
168 return cppc_get_transition_latency(cpu) / NSEC_PER_USEC;
169}
170#endif
171
129static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) 172static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
130{ 173{
131 struct cppc_cpudata *cpu; 174 struct cppc_cpudata *cpu;
@@ -162,8 +205,7 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
162 cpu->perf_caps.highest_perf; 205 cpu->perf_caps.highest_perf;
163 policy->cpuinfo.max_freq = cppc_dmi_max_khz; 206 policy->cpuinfo.max_freq = cppc_dmi_max_khz;
164 207
165 policy->transition_delay_us = cppc_get_transition_latency(cpu_num) / 208 policy->transition_delay_us = cppc_cpufreq_get_transition_delay_us(cpu_num);
166 NSEC_PER_USEC;
167 policy->shared_type = cpu->shared_type; 209 policy->shared_type = cpu->shared_type;
168 210
169 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { 211 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 77e485557498..6f693b7d5220 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -384,7 +384,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set)
384 if (set) 384 if (set)
385 reg |= bit; 385 reg |= bit;
386 else 386 else
387 reg &= bit; 387 reg &= ~bit;
388 iowrite32(reg, addr); 388 iowrite32(reg, addr);
389 389
390 spin_unlock_irqrestore(&gpio->lock, flags); 390 spin_unlock_irqrestore(&gpio->lock, flags);
diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-16.c
index 1948724d8c36..25d16b2af1c3 100644
--- a/drivers/gpio/gpio-pci-idio-16.c
+++ b/drivers/gpio/gpio-pci-idio-16.c
@@ -116,9 +116,9 @@ static int idio_16_gpio_get_multiple(struct gpio_chip *chip,
116 unsigned long word_mask; 116 unsigned long word_mask;
117 const unsigned long port_mask = GENMASK(gpio_reg_size - 1, 0); 117 const unsigned long port_mask = GENMASK(gpio_reg_size - 1, 0);
118 unsigned long port_state; 118 unsigned long port_state;
119 u8 __iomem ports[] = { 119 void __iomem *ports[] = {
120 idio16gpio->reg->out0_7, idio16gpio->reg->out8_15, 120 &idio16gpio->reg->out0_7, &idio16gpio->reg->out8_15,
121 idio16gpio->reg->in0_7, idio16gpio->reg->in8_15, 121 &idio16gpio->reg->in0_7, &idio16gpio->reg->in8_15,
122 }; 122 };
123 123
124 /* clear bits array to a clean slate */ 124 /* clear bits array to a clean slate */
@@ -143,7 +143,7 @@ static int idio_16_gpio_get_multiple(struct gpio_chip *chip,
143 } 143 }
144 144
145 /* read bits from current gpio port */ 145 /* read bits from current gpio port */
146 port_state = ioread8(ports + i); 146 port_state = ioread8(ports[i]);
147 147
148 /* store acquired bits at respective bits array offset */ 148 /* store acquired bits at respective bits array offset */
149 bits[word_index] |= port_state << word_offset; 149 bits[word_index] |= port_state << word_offset;
diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
index 835607ecf658..f953541e7890 100644
--- a/drivers/gpio/gpio-pcie-idio-24.c
+++ b/drivers/gpio/gpio-pcie-idio-24.c
@@ -206,10 +206,10 @@ static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
206 unsigned long word_mask; 206 unsigned long word_mask;
207 const unsigned long port_mask = GENMASK(gpio_reg_size - 1, 0); 207 const unsigned long port_mask = GENMASK(gpio_reg_size - 1, 0);
208 unsigned long port_state; 208 unsigned long port_state;
209 u8 __iomem ports[] = { 209 void __iomem *ports[] = {
210 idio24gpio->reg->out0_7, idio24gpio->reg->out8_15, 210 &idio24gpio->reg->out0_7, &idio24gpio->reg->out8_15,
211 idio24gpio->reg->out16_23, idio24gpio->reg->in0_7, 211 &idio24gpio->reg->out16_23, &idio24gpio->reg->in0_7,
212 idio24gpio->reg->in8_15, idio24gpio->reg->in16_23, 212 &idio24gpio->reg->in8_15, &idio24gpio->reg->in16_23,
213 }; 213 };
214 const unsigned long out_mode_mask = BIT(1); 214 const unsigned long out_mode_mask = BIT(1);
215 215
@@ -217,7 +217,7 @@ static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
217 bitmap_zero(bits, chip->ngpio); 217 bitmap_zero(bits, chip->ngpio);
218 218
219 /* get bits are evaluated a gpio port register at a time */ 219 /* get bits are evaluated a gpio port register at a time */
220 for (i = 0; i < ARRAY_SIZE(ports); i++) { 220 for (i = 0; i < ARRAY_SIZE(ports) + 1; i++) {
221 /* gpio offset in bits array */ 221 /* gpio offset in bits array */
222 bits_offset = i * gpio_reg_size; 222 bits_offset = i * gpio_reg_size;
223 223
@@ -236,7 +236,7 @@ static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
236 236
237 /* read bits from current gpio port (port 6 is TTL GPIO) */ 237 /* read bits from current gpio port (port 6 is TTL GPIO) */
238 if (i < 6) 238 if (i < 6)
239 port_state = ioread8(ports + i); 239 port_state = ioread8(ports[i]);
240 else if (ioread8(&idio24gpio->reg->ctl) & out_mode_mask) 240 else if (ioread8(&idio24gpio->reg->ctl) & out_mode_mask)
241 port_state = ioread8(&idio24gpio->reg->ttl_out0_7); 241 port_state = ioread8(&idio24gpio->reg->ttl_out0_7);
242 else 242 else
@@ -301,9 +301,9 @@ static void idio_24_gpio_set_multiple(struct gpio_chip *chip,
301 const unsigned long port_mask = GENMASK(gpio_reg_size, 0); 301 const unsigned long port_mask = GENMASK(gpio_reg_size, 0);
302 unsigned long flags; 302 unsigned long flags;
303 unsigned int out_state; 303 unsigned int out_state;
304 u8 __iomem ports[] = { 304 void __iomem *ports[] = {
305 idio24gpio->reg->out0_7, idio24gpio->reg->out8_15, 305 &idio24gpio->reg->out0_7, &idio24gpio->reg->out8_15,
306 idio24gpio->reg->out16_23 306 &idio24gpio->reg->out16_23
307 }; 307 };
308 const unsigned long out_mode_mask = BIT(1); 308 const unsigned long out_mode_mask = BIT(1);
309 const unsigned int ttl_offset = 48; 309 const unsigned int ttl_offset = 48;
@@ -327,9 +327,9 @@ static void idio_24_gpio_set_multiple(struct gpio_chip *chip,
327 raw_spin_lock_irqsave(&idio24gpio->lock, flags); 327 raw_spin_lock_irqsave(&idio24gpio->lock, flags);
328 328
329 /* process output lines */ 329 /* process output lines */
330 out_state = ioread8(ports + i) & ~gpio_mask; 330 out_state = ioread8(ports[i]) & ~gpio_mask;
331 out_state |= (*bits >> bits_offset) & gpio_mask; 331 out_state |= (*bits >> bits_offset) & gpio_mask;
332 iowrite8(out_state, ports + i); 332 iowrite8(out_state, ports[i]);
333 333
334 raw_spin_unlock_irqrestore(&idio24gpio->lock, flags); 334 raw_spin_unlock_irqrestore(&idio24gpio->lock, flags);
335 } 335 }
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 43aeb07343ec..d8ccb500872f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -497,7 +497,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
497 struct gpiohandle_request handlereq; 497 struct gpiohandle_request handlereq;
498 struct linehandle_state *lh; 498 struct linehandle_state *lh;
499 struct file *file; 499 struct file *file;
500 int fd, i, ret; 500 int fd, i, count = 0, ret;
501 u32 lflags; 501 u32 lflags;
502 502
503 if (copy_from_user(&handlereq, ip, sizeof(handlereq))) 503 if (copy_from_user(&handlereq, ip, sizeof(handlereq)))
@@ -558,6 +558,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
558 if (ret) 558 if (ret)
559 goto out_free_descs; 559 goto out_free_descs;
560 lh->descs[i] = desc; 560 lh->descs[i] = desc;
561 count = i;
561 562
562 if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW) 563 if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW)
563 set_bit(FLAG_ACTIVE_LOW, &desc->flags); 564 set_bit(FLAG_ACTIVE_LOW, &desc->flags);
@@ -628,7 +629,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
628out_put_unused_fd: 629out_put_unused_fd:
629 put_unused_fd(fd); 630 put_unused_fd(fd);
630out_free_descs: 631out_free_descs:
631 for (; i >= 0; i--) 632 for (i = 0; i < count; i++)
632 gpiod_free(lh->descs[i]); 633 gpiod_free(lh->descs[i]);
633 kfree(lh->label); 634 kfree(lh->label);
634out_free_lh: 635out_free_lh:
@@ -902,7 +903,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
902 desc = &gdev->descs[offset]; 903 desc = &gdev->descs[offset];
903 ret = gpiod_request(desc, le->label); 904 ret = gpiod_request(desc, le->label);
904 if (ret) 905 if (ret)
905 goto out_free_desc; 906 goto out_free_label;
906 le->desc = desc; 907 le->desc = desc;
907 le->eflags = eflags; 908 le->eflags = eflags;
908 909
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 09d35051fdd6..3fabf9f97022 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -419,9 +419,11 @@ int amdgpu_ctx_wait_prev_fence(struct amdgpu_ctx *ctx, unsigned ring_id)
419 419
420 if (other) { 420 if (other) {
421 signed long r; 421 signed long r;
422 r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT); 422 r = dma_fence_wait(other, true);
423 if (r < 0) { 423 if (r < 0) {
424 DRM_ERROR("Error (%ld) waiting for fence!\n", r); 424 if (r != -ERESTARTSYS)
425 DRM_ERROR("Error (%ld) waiting for fence!\n", r);
426
425 return r; 427 return r;
426 } 428 }
427 } 429 }
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index ace9ad578ca0..4304d9e408b8 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -83,21 +83,22 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
83 enum i2c_mot_mode mot = (msg->request & DP_AUX_I2C_MOT) ? 83 enum i2c_mot_mode mot = (msg->request & DP_AUX_I2C_MOT) ?
84 I2C_MOT_TRUE : I2C_MOT_FALSE; 84 I2C_MOT_TRUE : I2C_MOT_FALSE;
85 enum ddc_result res; 85 enum ddc_result res;
86 ssize_t read_bytes; 86 uint32_t read_bytes = msg->size;
87 87
88 if (WARN_ON(msg->size > 16)) 88 if (WARN_ON(msg->size > 16))
89 return -E2BIG; 89 return -E2BIG;
90 90
91 switch (msg->request & ~DP_AUX_I2C_MOT) { 91 switch (msg->request & ~DP_AUX_I2C_MOT) {
92 case DP_AUX_NATIVE_READ: 92 case DP_AUX_NATIVE_READ:
93 read_bytes = dal_ddc_service_read_dpcd_data( 93 res = dal_ddc_service_read_dpcd_data(
94 TO_DM_AUX(aux)->ddc_service, 94 TO_DM_AUX(aux)->ddc_service,
95 false, 95 false,
96 I2C_MOT_UNDEF, 96 I2C_MOT_UNDEF,
97 msg->address, 97 msg->address,
98 msg->buffer, 98 msg->buffer,
99 msg->size); 99 msg->size,
100 return read_bytes; 100 &read_bytes);
101 break;
101 case DP_AUX_NATIVE_WRITE: 102 case DP_AUX_NATIVE_WRITE:
102 res = dal_ddc_service_write_dpcd_data( 103 res = dal_ddc_service_write_dpcd_data(
103 TO_DM_AUX(aux)->ddc_service, 104 TO_DM_AUX(aux)->ddc_service,
@@ -108,14 +109,15 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
108 msg->size); 109 msg->size);
109 break; 110 break;
110 case DP_AUX_I2C_READ: 111 case DP_AUX_I2C_READ:
111 read_bytes = dal_ddc_service_read_dpcd_data( 112 res = dal_ddc_service_read_dpcd_data(
112 TO_DM_AUX(aux)->ddc_service, 113 TO_DM_AUX(aux)->ddc_service,
113 true, 114 true,
114 mot, 115 mot,
115 msg->address, 116 msg->address,
116 msg->buffer, 117 msg->buffer,
117 msg->size); 118 msg->size,
118 return read_bytes; 119 &read_bytes);
120 break;
119 case DP_AUX_I2C_WRITE: 121 case DP_AUX_I2C_WRITE:
120 res = dal_ddc_service_write_dpcd_data( 122 res = dal_ddc_service_write_dpcd_data(
121 TO_DM_AUX(aux)->ddc_service, 123 TO_DM_AUX(aux)->ddc_service,
@@ -137,7 +139,9 @@ static ssize_t dm_dp_aux_transfer(struct drm_dp_aux *aux,
137 r == DDC_RESULT_SUCESSFULL); 139 r == DDC_RESULT_SUCESSFULL);
138#endif 140#endif
139 141
140 return msg->size; 142 if (res != DDC_RESULT_SUCESSFULL)
143 return -EIO;
144 return read_bytes;
141} 145}
142 146
143static enum drm_connector_status 147static enum drm_connector_status
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 985fe8c22875..10a5807a7e8b 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -70,6 +70,10 @@ static enum bp_result get_firmware_info_v3_1(
70 struct bios_parser *bp, 70 struct bios_parser *bp,
71 struct dc_firmware_info *info); 71 struct dc_firmware_info *info);
72 72
73static enum bp_result get_firmware_info_v3_2(
74 struct bios_parser *bp,
75 struct dc_firmware_info *info);
76
73static struct atom_hpd_int_record *get_hpd_record(struct bios_parser *bp, 77static struct atom_hpd_int_record *get_hpd_record(struct bios_parser *bp,
74 struct atom_display_object_path_v2 *object); 78 struct atom_display_object_path_v2 *object);
75 79
@@ -1321,9 +1325,11 @@ static enum bp_result bios_parser_get_firmware_info(
1321 case 3: 1325 case 3:
1322 switch (revision.minor) { 1326 switch (revision.minor) {
1323 case 1: 1327 case 1:
1324 case 2:
1325 result = get_firmware_info_v3_1(bp, info); 1328 result = get_firmware_info_v3_1(bp, info);
1326 break; 1329 break;
1330 case 2:
1331 result = get_firmware_info_v3_2(bp, info);
1332 break;
1327 default: 1333 default:
1328 break; 1334 break;
1329 } 1335 }
@@ -1383,6 +1389,84 @@ static enum bp_result get_firmware_info_v3_1(
1383 return BP_RESULT_OK; 1389 return BP_RESULT_OK;
1384} 1390}
1385 1391
1392static enum bp_result get_firmware_info_v3_2(
1393 struct bios_parser *bp,
1394 struct dc_firmware_info *info)
1395{
1396 struct atom_firmware_info_v3_2 *firmware_info;
1397 struct atom_display_controller_info_v4_1 *dce_info = NULL;
1398 struct atom_common_table_header *header;
1399 struct atom_data_revision revision;
1400 struct atom_smu_info_v3_2 *smu_info_v3_2 = NULL;
1401 struct atom_smu_info_v3_3 *smu_info_v3_3 = NULL;
1402
1403 if (!info)
1404 return BP_RESULT_BADINPUT;
1405
1406 firmware_info = GET_IMAGE(struct atom_firmware_info_v3_2,
1407 DATA_TABLES(firmwareinfo));
1408
1409 dce_info = GET_IMAGE(struct atom_display_controller_info_v4_1,
1410 DATA_TABLES(dce_info));
1411
1412 if (!firmware_info || !dce_info)
1413 return BP_RESULT_BADBIOSTABLE;
1414
1415 memset(info, 0, sizeof(*info));
1416
1417 header = GET_IMAGE(struct atom_common_table_header,
1418 DATA_TABLES(smu_info));
1419 get_atom_data_table_revision(header, &revision);
1420
1421 if (revision.minor == 2) {
1422 /* Vega12 */
1423 smu_info_v3_2 = GET_IMAGE(struct atom_smu_info_v3_2,
1424 DATA_TABLES(smu_info));
1425
1426 if (!smu_info_v3_2)
1427 return BP_RESULT_BADBIOSTABLE;
1428
1429 info->default_engine_clk = smu_info_v3_2->bootup_dcefclk_10khz * 10;
1430 } else if (revision.minor == 3) {
1431 /* Vega20 */
1432 smu_info_v3_3 = GET_IMAGE(struct atom_smu_info_v3_3,
1433 DATA_TABLES(smu_info));
1434
1435 if (!smu_info_v3_3)
1436 return BP_RESULT_BADBIOSTABLE;
1437
1438 info->default_engine_clk = smu_info_v3_3->bootup_dcefclk_10khz * 10;
1439 }
1440
1441 // We need to convert from 10KHz units into KHz units.
1442 info->default_memory_clk = firmware_info->bootup_mclk_in10khz * 10;
1443
1444 /* 27MHz for Vega10 & Vega12; 100MHz for Vega20 */
1445 info->pll_info.crystal_frequency = dce_info->dce_refclk_10khz * 10;
1446 /* Hardcode frequency if BIOS gives no DCE Ref Clk */
1447 if (info->pll_info.crystal_frequency == 0) {
1448 if (revision.minor == 2)
1449 info->pll_info.crystal_frequency = 27000;
1450 else if (revision.minor == 3)
1451 info->pll_info.crystal_frequency = 100000;
1452 }
1453 /*dp_phy_ref_clk is not correct for atom_display_controller_info_v4_2, but we don't use it*/
1454 info->dp_phy_ref_clk = dce_info->dpphy_refclk_10khz * 10;
1455 info->i2c_engine_ref_clk = dce_info->i2c_engine_refclk_10khz * 10;
1456
1457 /* Get GPU PLL VCO Clock */
1458 if (bp->cmd_tbl.get_smu_clock_info != NULL) {
1459 if (revision.minor == 2)
1460 info->smu_gpu_pll_output_freq =
1461 bp->cmd_tbl.get_smu_clock_info(bp, SMU9_SYSPLL0_ID) * 10;
1462 else if (revision.minor == 3)
1463 info->smu_gpu_pll_output_freq =
1464 bp->cmd_tbl.get_smu_clock_info(bp, SMU11_SYSPLL3_0_ID) * 10;
1465 }
1466
1467 return BP_RESULT_OK;
1468}
1469
1386static enum bp_result bios_parser_get_encoder_cap_info( 1470static enum bp_result bios_parser_get_encoder_cap_info(
1387 struct dc_bios *dcb, 1471 struct dc_bios *dcb,
1388 struct graphics_object_id object_id, 1472 struct graphics_object_id object_id,
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index 49c2face1e7a..ae48d603ebd6 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -629,13 +629,14 @@ bool dal_ddc_service_query_ddc_data(
629 return ret; 629 return ret;
630} 630}
631 631
632ssize_t dal_ddc_service_read_dpcd_data( 632enum ddc_result dal_ddc_service_read_dpcd_data(
633 struct ddc_service *ddc, 633 struct ddc_service *ddc,
634 bool i2c, 634 bool i2c,
635 enum i2c_mot_mode mot, 635 enum i2c_mot_mode mot,
636 uint32_t address, 636 uint32_t address,
637 uint8_t *data, 637 uint8_t *data,
638 uint32_t len) 638 uint32_t len,
639 uint32_t *read)
639{ 640{
640 struct aux_payload read_payload = { 641 struct aux_payload read_payload = {
641 .i2c_over_aux = i2c, 642 .i2c_over_aux = i2c,
@@ -652,6 +653,8 @@ ssize_t dal_ddc_service_read_dpcd_data(
652 .mot = mot 653 .mot = mot
653 }; 654 };
654 655
656 *read = 0;
657
655 if (len > DEFAULT_AUX_MAX_DATA_SIZE) { 658 if (len > DEFAULT_AUX_MAX_DATA_SIZE) {
656 BREAK_TO_DEBUGGER(); 659 BREAK_TO_DEBUGGER();
657 return DDC_RESULT_FAILED_INVALID_OPERATION; 660 return DDC_RESULT_FAILED_INVALID_OPERATION;
@@ -661,7 +664,8 @@ ssize_t dal_ddc_service_read_dpcd_data(
661 ddc->ctx->i2caux, 664 ddc->ctx->i2caux,
662 ddc->ddc_pin, 665 ddc->ddc_pin,
663 &command)) { 666 &command)) {
664 return (ssize_t)command.payloads->length; 667 *read = command.payloads->length;
668 return DDC_RESULT_SUCESSFULL;
665 } 669 }
666 670
667 return DDC_RESULT_FAILED_OPERATION; 671 return DDC_RESULT_FAILED_OPERATION;
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index ade5b8ee9c3c..132eef3826e2 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -66,8 +66,8 @@ struct dc_plane_state *dc_create_plane_state(struct dc *dc)
66{ 66{
67 struct dc *core_dc = dc; 67 struct dc *core_dc = dc;
68 68
69 struct dc_plane_state *plane_state = kzalloc(sizeof(*plane_state), 69 struct dc_plane_state *plane_state = kvzalloc(sizeof(*plane_state),
70 GFP_KERNEL); 70 GFP_KERNEL);
71 71
72 if (NULL == plane_state) 72 if (NULL == plane_state)
73 return NULL; 73 return NULL;
@@ -120,7 +120,7 @@ static void dc_plane_state_free(struct kref *kref)
120{ 120{
121 struct dc_plane_state *plane_state = container_of(kref, struct dc_plane_state, refcount); 121 struct dc_plane_state *plane_state = container_of(kref, struct dc_plane_state, refcount);
122 destruct(plane_state); 122 destruct(plane_state);
123 kfree(plane_state); 123 kvfree(plane_state);
124} 124}
125 125
126void dc_plane_state_release(struct dc_plane_state *plane_state) 126void dc_plane_state_release(struct dc_plane_state *plane_state)
@@ -136,7 +136,7 @@ void dc_gamma_retain(struct dc_gamma *gamma)
136static void dc_gamma_free(struct kref *kref) 136static void dc_gamma_free(struct kref *kref)
137{ 137{
138 struct dc_gamma *gamma = container_of(kref, struct dc_gamma, refcount); 138 struct dc_gamma *gamma = container_of(kref, struct dc_gamma, refcount);
139 kfree(gamma); 139 kvfree(gamma);
140} 140}
141 141
142void dc_gamma_release(struct dc_gamma **gamma) 142void dc_gamma_release(struct dc_gamma **gamma)
@@ -147,7 +147,7 @@ void dc_gamma_release(struct dc_gamma **gamma)
147 147
148struct dc_gamma *dc_create_gamma(void) 148struct dc_gamma *dc_create_gamma(void)
149{ 149{
150 struct dc_gamma *gamma = kzalloc(sizeof(*gamma), GFP_KERNEL); 150 struct dc_gamma *gamma = kvzalloc(sizeof(*gamma), GFP_KERNEL);
151 151
152 if (gamma == NULL) 152 if (gamma == NULL)
153 goto alloc_fail; 153 goto alloc_fail;
@@ -167,7 +167,7 @@ void dc_transfer_func_retain(struct dc_transfer_func *tf)
167static void dc_transfer_func_free(struct kref *kref) 167static void dc_transfer_func_free(struct kref *kref)
168{ 168{
169 struct dc_transfer_func *tf = container_of(kref, struct dc_transfer_func, refcount); 169 struct dc_transfer_func *tf = container_of(kref, struct dc_transfer_func, refcount);
170 kfree(tf); 170 kvfree(tf);
171} 171}
172 172
173void dc_transfer_func_release(struct dc_transfer_func *tf) 173void dc_transfer_func_release(struct dc_transfer_func *tf)
@@ -177,7 +177,7 @@ void dc_transfer_func_release(struct dc_transfer_func *tf)
177 177
178struct dc_transfer_func *dc_create_transfer_func(void) 178struct dc_transfer_func *dc_create_transfer_func(void)
179{ 179{
180 struct dc_transfer_func *tf = kzalloc(sizeof(*tf), GFP_KERNEL); 180 struct dc_transfer_func *tf = kvzalloc(sizeof(*tf), GFP_KERNEL);
181 181
182 if (tf == NULL) 182 if (tf == NULL)
183 goto alloc_fail; 183 goto alloc_fail;
diff --git a/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h b/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h
index 090b7a8dd67b..30b3a08b91be 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/dc_link_ddc.h
@@ -102,13 +102,14 @@ bool dal_ddc_service_query_ddc_data(
102 uint8_t *read_buf, 102 uint8_t *read_buf,
103 uint32_t read_size); 103 uint32_t read_size);
104 104
105ssize_t dal_ddc_service_read_dpcd_data( 105enum ddc_result dal_ddc_service_read_dpcd_data(
106 struct ddc_service *ddc, 106 struct ddc_service *ddc,
107 bool i2c, 107 bool i2c,
108 enum i2c_mot_mode mot, 108 enum i2c_mot_mode mot,
109 uint32_t address, 109 uint32_t address,
110 uint8_t *data, 110 uint8_t *data,
111 uint32_t len); 111 uint32_t len,
112 uint32_t *read);
112 113
113enum ddc_result dal_ddc_service_write_dpcd_data( 114enum ddc_result dal_ddc_service_write_dpcd_data(
114 struct ddc_service *ddc, 115 struct ddc_service *ddc,
diff --git a/drivers/gpu/drm/amd/display/include/dal_asic_id.h b/drivers/gpu/drm/amd/display/include/dal_asic_id.h
index 9831cb5eaa7c..9b0a04f99ac8 100644
--- a/drivers/gpu/drm/amd/display/include/dal_asic_id.h
+++ b/drivers/gpu/drm/amd/display/include/dal_asic_id.h
@@ -113,9 +113,14 @@
113 113
114#define AI_GREENLAND_P_A0 1 114#define AI_GREENLAND_P_A0 1
115#define AI_GREENLAND_P_A1 2 115#define AI_GREENLAND_P_A1 2
116#define AI_UNKNOWN 0xFF
116 117
117#define ASICREV_IS_GREENLAND_M(eChipRev) (eChipRev < AI_UNKNOWN) 118#define AI_VEGA12_P_A0 20
118#define ASICREV_IS_GREENLAND_P(eChipRev) (eChipRev < AI_UNKNOWN) 119#define ASICREV_IS_GREENLAND_M(eChipRev) (eChipRev < AI_VEGA12_P_A0)
120#define ASICREV_IS_GREENLAND_P(eChipRev) (eChipRev < AI_VEGA12_P_A0)
121
122#define ASICREV_IS_VEGA12_P(eChipRev) ((eChipRev >= AI_VEGA12_P_A0) && (eChipRev < AI_UNKNOWN))
123#define ASICREV_IS_VEGA12_p(eChipRev) ((eChipRev >= AI_VEGA12_P_A0) && (eChipRev < AI_UNKNOWN))
119 124
120/* DCN1_0 */ 125/* DCN1_0 */
121#define INTERNAL_REV_RAVEN_A0 0x00 /* First spin of Raven */ 126#define INTERNAL_REV_RAVEN_A0 0x00 /* First spin of Raven */
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index e7e374f56864..b3747a019deb 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1093,19 +1093,19 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
1093 1093
1094 output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; 1094 output_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
1095 1095
1096 rgb_user = kzalloc(sizeof(*rgb_user) * (ramp->num_entries + _EXTRA_POINTS), 1096 rgb_user = kvzalloc(sizeof(*rgb_user) * (ramp->num_entries + _EXTRA_POINTS),
1097 GFP_KERNEL); 1097 GFP_KERNEL);
1098 if (!rgb_user) 1098 if (!rgb_user)
1099 goto rgb_user_alloc_fail; 1099 goto rgb_user_alloc_fail;
1100 rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS), 1100 rgb_regamma = kvzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS),
1101 GFP_KERNEL); 1101 GFP_KERNEL);
1102 if (!rgb_regamma) 1102 if (!rgb_regamma)
1103 goto rgb_regamma_alloc_fail; 1103 goto rgb_regamma_alloc_fail;
1104 axix_x = kzalloc(sizeof(*axix_x) * (ramp->num_entries + 3), 1104 axix_x = kvzalloc(sizeof(*axix_x) * (ramp->num_entries + 3),
1105 GFP_KERNEL); 1105 GFP_KERNEL);
1106 if (!axix_x) 1106 if (!axix_x)
1107 goto axix_x_alloc_fail; 1107 goto axix_x_alloc_fail;
1108 coeff = kzalloc(sizeof(*coeff) * (MAX_HW_POINTS + _EXTRA_POINTS), GFP_KERNEL); 1108 coeff = kvzalloc(sizeof(*coeff) * (MAX_HW_POINTS + _EXTRA_POINTS), GFP_KERNEL);
1109 if (!coeff) 1109 if (!coeff)
1110 goto coeff_alloc_fail; 1110 goto coeff_alloc_fail;
1111 1111
@@ -1157,13 +1157,13 @@ bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
1157 1157
1158 ret = true; 1158 ret = true;
1159 1159
1160 kfree(coeff); 1160 kvfree(coeff);
1161coeff_alloc_fail: 1161coeff_alloc_fail:
1162 kfree(axix_x); 1162 kvfree(axix_x);
1163axix_x_alloc_fail: 1163axix_x_alloc_fail:
1164 kfree(rgb_regamma); 1164 kvfree(rgb_regamma);
1165rgb_regamma_alloc_fail: 1165rgb_regamma_alloc_fail:
1166 kfree(rgb_user); 1166 kvfree(rgb_user);
1167rgb_user_alloc_fail: 1167rgb_user_alloc_fail:
1168 return ret; 1168 return ret;
1169} 1169}
@@ -1192,19 +1192,19 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,
1192 1192
1193 input_tf->type = TF_TYPE_DISTRIBUTED_POINTS; 1193 input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
1194 1194
1195 rgb_user = kzalloc(sizeof(*rgb_user) * (ramp->num_entries + _EXTRA_POINTS), 1195 rgb_user = kvzalloc(sizeof(*rgb_user) * (ramp->num_entries + _EXTRA_POINTS),
1196 GFP_KERNEL); 1196 GFP_KERNEL);
1197 if (!rgb_user) 1197 if (!rgb_user)
1198 goto rgb_user_alloc_fail; 1198 goto rgb_user_alloc_fail;
1199 curve = kzalloc(sizeof(*curve) * (MAX_HW_POINTS + _EXTRA_POINTS), 1199 curve = kvzalloc(sizeof(*curve) * (MAX_HW_POINTS + _EXTRA_POINTS),
1200 GFP_KERNEL); 1200 GFP_KERNEL);
1201 if (!curve) 1201 if (!curve)
1202 goto curve_alloc_fail; 1202 goto curve_alloc_fail;
1203 axix_x = kzalloc(sizeof(*axix_x) * (ramp->num_entries + _EXTRA_POINTS), 1203 axix_x = kvzalloc(sizeof(*axix_x) * (ramp->num_entries + _EXTRA_POINTS),
1204 GFP_KERNEL); 1204 GFP_KERNEL);
1205 if (!axix_x) 1205 if (!axix_x)
1206 goto axix_x_alloc_fail; 1206 goto axix_x_alloc_fail;
1207 coeff = kzalloc(sizeof(*coeff) * (MAX_HW_POINTS + _EXTRA_POINTS), GFP_KERNEL); 1207 coeff = kvzalloc(sizeof(*coeff) * (MAX_HW_POINTS + _EXTRA_POINTS), GFP_KERNEL);
1208 if (!coeff) 1208 if (!coeff)
1209 goto coeff_alloc_fail; 1209 goto coeff_alloc_fail;
1210 1210
@@ -1246,13 +1246,13 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,
1246 1246
1247 ret = true; 1247 ret = true;
1248 1248
1249 kfree(coeff); 1249 kvfree(coeff);
1250coeff_alloc_fail: 1250coeff_alloc_fail:
1251 kfree(axix_x); 1251 kvfree(axix_x);
1252axix_x_alloc_fail: 1252axix_x_alloc_fail:
1253 kfree(curve); 1253 kvfree(curve);
1254curve_alloc_fail: 1254curve_alloc_fail:
1255 kfree(rgb_user); 1255 kvfree(rgb_user);
1256rgb_user_alloc_fail: 1256rgb_user_alloc_fail:
1257 1257
1258 return ret; 1258 return ret;
@@ -1281,8 +1281,9 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans,
1281 } 1281 }
1282 ret = true; 1282 ret = true;
1283 } else if (trans == TRANSFER_FUNCTION_PQ) { 1283 } else if (trans == TRANSFER_FUNCTION_PQ) {
1284 rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + 1284 rgb_regamma = kvzalloc(sizeof(*rgb_regamma) *
1285 _EXTRA_POINTS), GFP_KERNEL); 1285 (MAX_HW_POINTS + _EXTRA_POINTS),
1286 GFP_KERNEL);
1286 if (!rgb_regamma) 1287 if (!rgb_regamma)
1287 goto rgb_regamma_alloc_fail; 1288 goto rgb_regamma_alloc_fail;
1288 points->end_exponent = 7; 1289 points->end_exponent = 7;
@@ -1302,11 +1303,12 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans,
1302 } 1303 }
1303 ret = true; 1304 ret = true;
1304 1305
1305 kfree(rgb_regamma); 1306 kvfree(rgb_regamma);
1306 } else if (trans == TRANSFER_FUNCTION_SRGB || 1307 } else if (trans == TRANSFER_FUNCTION_SRGB ||
1307 trans == TRANSFER_FUNCTION_BT709) { 1308 trans == TRANSFER_FUNCTION_BT709) {
1308 rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + 1309 rgb_regamma = kvzalloc(sizeof(*rgb_regamma) *
1309 _EXTRA_POINTS), GFP_KERNEL); 1310 (MAX_HW_POINTS + _EXTRA_POINTS),
1311 GFP_KERNEL);
1310 if (!rgb_regamma) 1312 if (!rgb_regamma)
1311 goto rgb_regamma_alloc_fail; 1313 goto rgb_regamma_alloc_fail;
1312 points->end_exponent = 0; 1314 points->end_exponent = 0;
@@ -1324,7 +1326,7 @@ bool mod_color_calculate_curve(enum dc_transfer_func_predefined trans,
1324 } 1326 }
1325 ret = true; 1327 ret = true;
1326 1328
1327 kfree(rgb_regamma); 1329 kvfree(rgb_regamma);
1328 } 1330 }
1329rgb_regamma_alloc_fail: 1331rgb_regamma_alloc_fail:
1330 return ret; 1332 return ret;
@@ -1348,8 +1350,9 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
1348 } 1350 }
1349 ret = true; 1351 ret = true;
1350 } else if (trans == TRANSFER_FUNCTION_PQ) { 1352 } else if (trans == TRANSFER_FUNCTION_PQ) {
1351 rgb_degamma = kzalloc(sizeof(*rgb_degamma) * (MAX_HW_POINTS + 1353 rgb_degamma = kvzalloc(sizeof(*rgb_degamma) *
1352 _EXTRA_POINTS), GFP_KERNEL); 1354 (MAX_HW_POINTS + _EXTRA_POINTS),
1355 GFP_KERNEL);
1353 if (!rgb_degamma) 1356 if (!rgb_degamma)
1354 goto rgb_degamma_alloc_fail; 1357 goto rgb_degamma_alloc_fail;
1355 1358
@@ -1364,11 +1367,12 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
1364 } 1367 }
1365 ret = true; 1368 ret = true;
1366 1369
1367 kfree(rgb_degamma); 1370 kvfree(rgb_degamma);
1368 } else if (trans == TRANSFER_FUNCTION_SRGB || 1371 } else if (trans == TRANSFER_FUNCTION_SRGB ||
1369 trans == TRANSFER_FUNCTION_BT709) { 1372 trans == TRANSFER_FUNCTION_BT709) {
1370 rgb_degamma = kzalloc(sizeof(*rgb_degamma) * (MAX_HW_POINTS + 1373 rgb_degamma = kvzalloc(sizeof(*rgb_degamma) *
1371 _EXTRA_POINTS), GFP_KERNEL); 1374 (MAX_HW_POINTS + _EXTRA_POINTS),
1375 GFP_KERNEL);
1372 if (!rgb_degamma) 1376 if (!rgb_degamma)
1373 goto rgb_degamma_alloc_fail; 1377 goto rgb_degamma_alloc_fail;
1374 1378
@@ -1382,7 +1386,7 @@ bool mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
1382 } 1386 }
1383 ret = true; 1387 ret = true;
1384 1388
1385 kfree(rgb_degamma); 1389 kvfree(rgb_degamma);
1386 } 1390 }
1387 points->end_exponent = 0; 1391 points->end_exponent = 0;
1388 points->x_point_at_y1_red = 1; 1392 points->x_point_at_y1_red = 1;
diff --git a/drivers/gpu/drm/amd/include/atomfirmware.h b/drivers/gpu/drm/amd/include/atomfirmware.h
index 0f5ad54d3fd3..de177ce8ca80 100644
--- a/drivers/gpu/drm/amd/include/atomfirmware.h
+++ b/drivers/gpu/drm/amd/include/atomfirmware.h
@@ -501,6 +501,32 @@ enum atom_cooling_solution_id{
501 LIQUID_COOLING = 0x01 501 LIQUID_COOLING = 0x01
502}; 502};
503 503
504struct atom_firmware_info_v3_2 {
505 struct atom_common_table_header table_header;
506 uint32_t firmware_revision;
507 uint32_t bootup_sclk_in10khz;
508 uint32_t bootup_mclk_in10khz;
509 uint32_t firmware_capability; // enum atombios_firmware_capability
510 uint32_t main_call_parser_entry; /* direct address of main parser call in VBIOS binary. */
511 uint32_t bios_scratch_reg_startaddr; // 1st bios scratch register dword address
512 uint16_t bootup_vddc_mv;
513 uint16_t bootup_vddci_mv;
514 uint16_t bootup_mvddc_mv;
515 uint16_t bootup_vddgfx_mv;
516 uint8_t mem_module_id;
517 uint8_t coolingsolution_id; /*0: Air cooling; 1: Liquid cooling ... */
518 uint8_t reserved1[2];
519 uint32_t mc_baseaddr_high;
520 uint32_t mc_baseaddr_low;
521 uint8_t board_i2c_feature_id; // enum of atom_board_i2c_feature_id_def
522 uint8_t board_i2c_feature_gpio_id; // i2c id find in gpio_lut data table gpio_id
523 uint8_t board_i2c_feature_slave_addr;
524 uint8_t reserved3;
525 uint16_t bootup_mvddq_mv;
526 uint16_t bootup_mvpp_mv;
527 uint32_t zfbstartaddrin16mb;
528 uint32_t reserved2[3];
529};
504 530
505/* 531/*
506 *************************************************************************** 532 ***************************************************************************
@@ -1169,7 +1195,29 @@ struct atom_gfx_info_v2_2
1169 uint32_t rlc_gpu_timer_refclk; 1195 uint32_t rlc_gpu_timer_refclk;
1170}; 1196};
1171 1197
1172 1198struct atom_gfx_info_v2_3 {
1199 struct atom_common_table_header table_header;
1200 uint8_t gfxip_min_ver;
1201 uint8_t gfxip_max_ver;
1202 uint8_t max_shader_engines;
1203 uint8_t max_tile_pipes;
1204 uint8_t max_cu_per_sh;
1205 uint8_t max_sh_per_se;
1206 uint8_t max_backends_per_se;
1207 uint8_t max_texture_channel_caches;
1208 uint32_t regaddr_cp_dma_src_addr;
1209 uint32_t regaddr_cp_dma_src_addr_hi;
1210 uint32_t regaddr_cp_dma_dst_addr;
1211 uint32_t regaddr_cp_dma_dst_addr_hi;
1212 uint32_t regaddr_cp_dma_command;
1213 uint32_t regaddr_cp_status;
1214 uint32_t regaddr_rlc_gpu_clock_32;
1215 uint32_t rlc_gpu_timer_refclk;
1216 uint8_t active_cu_per_sh;
1217 uint8_t active_rb_per_se;
1218 uint16_t gcgoldenoffset;
1219 uint32_t rm21_sram_vmin_value;
1220};
1173 1221
1174/* 1222/*
1175 *************************************************************************** 1223 ***************************************************************************
@@ -1198,6 +1246,76 @@ struct atom_smu_info_v3_1
1198 uint8_t fw_ctf_polarity; // GPIO polarity for CTF 1246 uint8_t fw_ctf_polarity; // GPIO polarity for CTF
1199}; 1247};
1200 1248
1249struct atom_smu_info_v3_2 {
1250 struct atom_common_table_header table_header;
1251 uint8_t smuip_min_ver;
1252 uint8_t smuip_max_ver;
1253 uint8_t smu_rsd1;
1254 uint8_t gpuclk_ss_mode;
1255 uint16_t sclk_ss_percentage;
1256 uint16_t sclk_ss_rate_10hz;
1257 uint16_t gpuclk_ss_percentage; // in unit of 0.001%
1258 uint16_t gpuclk_ss_rate_10hz;
1259 uint32_t core_refclk_10khz;
1260 uint8_t ac_dc_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for AC/DC switching, =0xff means invalid
1261 uint8_t ac_dc_polarity; // GPIO polarity for AC/DC switching
1262 uint8_t vr0hot_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for VR0 HOT event, =0xff means invalid
1263 uint8_t vr0hot_polarity; // GPIO polarity for VR0 HOT event
1264 uint8_t vr1hot_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for VR1 HOT event , =0xff means invalid
1265 uint8_t vr1hot_polarity; // GPIO polarity for VR1 HOT event
1266 uint8_t fw_ctf_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for CTF, =0xff means invalid
1267 uint8_t fw_ctf_polarity; // GPIO polarity for CTF
1268 uint8_t pcc_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for PCC, =0xff means invalid
1269 uint8_t pcc_gpio_polarity; // GPIO polarity for CTF
1270 uint16_t smugoldenoffset;
1271 uint32_t gpupll_vco_freq_10khz;
1272 uint32_t bootup_smnclk_10khz;
1273 uint32_t bootup_socclk_10khz;
1274 uint32_t bootup_mp0clk_10khz;
1275 uint32_t bootup_mp1clk_10khz;
1276 uint32_t bootup_lclk_10khz;
1277 uint32_t bootup_dcefclk_10khz;
1278 uint32_t ctf_threshold_override_value;
1279 uint32_t reserved[5];
1280};
1281
1282struct atom_smu_info_v3_3 {
1283 struct atom_common_table_header table_header;
1284 uint8_t smuip_min_ver;
1285 uint8_t smuip_max_ver;
1286 uint8_t smu_rsd1;
1287 uint8_t gpuclk_ss_mode;
1288 uint16_t sclk_ss_percentage;
1289 uint16_t sclk_ss_rate_10hz;
1290 uint16_t gpuclk_ss_percentage; // in unit of 0.001%
1291 uint16_t gpuclk_ss_rate_10hz;
1292 uint32_t core_refclk_10khz;
1293 uint8_t ac_dc_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for AC/DC switching, =0xff means invalid
1294 uint8_t ac_dc_polarity; // GPIO polarity for AC/DC switching
1295 uint8_t vr0hot_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for VR0 HOT event, =0xff means invalid
1296 uint8_t vr0hot_polarity; // GPIO polarity for VR0 HOT event
1297 uint8_t vr1hot_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for VR1 HOT event , =0xff means invalid
1298 uint8_t vr1hot_polarity; // GPIO polarity for VR1 HOT event
1299 uint8_t fw_ctf_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for CTF, =0xff means invalid
1300 uint8_t fw_ctf_polarity; // GPIO polarity for CTF
1301 uint8_t pcc_gpio_bit; // GPIO bit shift in SMU_GPIOPAD_A configured for PCC, =0xff means invalid
1302 uint8_t pcc_gpio_polarity; // GPIO polarity for CTF
1303 uint16_t smugoldenoffset;
1304 uint32_t gpupll_vco_freq_10khz;
1305 uint32_t bootup_smnclk_10khz;
1306 uint32_t bootup_socclk_10khz;
1307 uint32_t bootup_mp0clk_10khz;
1308 uint32_t bootup_mp1clk_10khz;
1309 uint32_t bootup_lclk_10khz;
1310 uint32_t bootup_dcefclk_10khz;
1311 uint32_t ctf_threshold_override_value;
1312 uint32_t syspll3_0_vco_freq_10khz;
1313 uint32_t syspll3_1_vco_freq_10khz;
1314 uint32_t bootup_fclk_10khz;
1315 uint32_t bootup_waflclk_10khz;
1316 uint32_t reserved[3];
1317};
1318
1201/* 1319/*
1202 *************************************************************************** 1320 ***************************************************************************
1203 Data Table smc_dpm_info structure 1321 Data Table smc_dpm_info structure
@@ -1283,7 +1401,6 @@ struct atom_smc_dpm_info_v4_1
1283 uint32_t boardreserved[10]; 1401 uint32_t boardreserved[10];
1284}; 1402};
1285 1403
1286
1287/* 1404/*
1288 *************************************************************************** 1405 ***************************************************************************
1289 Data Table asic_profiling_info structure 1406 Data Table asic_profiling_info structure
@@ -1864,6 +1981,55 @@ enum atom_smu9_syspll0_clock_id
1864 SMU9_SYSPLL0_DISPCLK_ID = 11, // DISPCLK 1981 SMU9_SYSPLL0_DISPCLK_ID = 11, // DISPCLK
1865}; 1982};
1866 1983
1984enum atom_smu11_syspll_id {
1985 SMU11_SYSPLL0_ID = 0,
1986 SMU11_SYSPLL1_0_ID = 1,
1987 SMU11_SYSPLL1_1_ID = 2,
1988 SMU11_SYSPLL1_2_ID = 3,
1989 SMU11_SYSPLL2_ID = 4,
1990 SMU11_SYSPLL3_0_ID = 5,
1991 SMU11_SYSPLL3_1_ID = 6,
1992};
1993
1994
1995enum atom_smu11_syspll0_clock_id {
1996 SMU11_SYSPLL0_SOCCLK_ID = 0, // SOCCLK
1997 SMU11_SYSPLL0_MP0CLK_ID = 1, // MP0CLK
1998 SMU11_SYSPLL0_DCLK_ID = 2, // DCLK
1999 SMU11_SYSPLL0_VCLK_ID = 3, // VCLK
2000 SMU11_SYSPLL0_ECLK_ID = 4, // ECLK
2001 SMU11_SYSPLL0_DCEFCLK_ID = 5, // DCEFCLK
2002};
2003
2004
2005enum atom_smu11_syspll1_0_clock_id {
2006 SMU11_SYSPLL1_0_UCLKA_ID = 0, // UCLK_a
2007};
2008
2009enum atom_smu11_syspll1_1_clock_id {
2010 SMU11_SYSPLL1_0_UCLKB_ID = 0, // UCLK_b
2011};
2012
2013enum atom_smu11_syspll1_2_clock_id {
2014 SMU11_SYSPLL1_0_FCLK_ID = 0, // FCLK
2015};
2016
2017enum atom_smu11_syspll2_clock_id {
2018 SMU11_SYSPLL2_GFXCLK_ID = 0, // GFXCLK
2019};
2020
2021enum atom_smu11_syspll3_0_clock_id {
2022 SMU11_SYSPLL3_0_WAFCLK_ID = 0, // WAFCLK
2023 SMU11_SYSPLL3_0_DISPCLK_ID = 1, // DISPCLK
2024 SMU11_SYSPLL3_0_DPREFCLK_ID = 2, // DPREFCLK
2025};
2026
2027enum atom_smu11_syspll3_1_clock_id {
2028 SMU11_SYSPLL3_1_MP1CLK_ID = 0, // MP1CLK
2029 SMU11_SYSPLL3_1_SMNCLK_ID = 1, // SMNCLK
2030 SMU11_SYSPLL3_1_LCLK_ID = 2, // LCLK
2031};
2032
1867struct atom_get_smu_clock_info_output_parameters_v3_1 2033struct atom_get_smu_clock_info_output_parameters_v3_1
1868{ 2034{
1869 union { 2035 union {
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 26fbeafc3c96..18b5b2ff47fe 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -79,12 +79,13 @@
79#define PCIE_BUS_CLK 10000 79#define PCIE_BUS_CLK 10000
80#define TCLK (PCIE_BUS_CLK / 10) 80#define TCLK (PCIE_BUS_CLK / 10)
81 81
82static const struct profile_mode_setting smu7_profiling[5] = 82static const struct profile_mode_setting smu7_profiling[6] =
83 {{1, 0, 100, 30, 1, 0, 100, 10}, 83 {{1, 0, 100, 30, 1, 0, 100, 10},
84 {1, 10, 0, 30, 0, 0, 0, 0}, 84 {1, 10, 0, 30, 0, 0, 0, 0},
85 {0, 0, 0, 0, 1, 10, 16, 31}, 85 {0, 0, 0, 0, 1, 10, 16, 31},
86 {1, 0, 11, 50, 1, 0, 100, 10}, 86 {1, 0, 11, 50, 1, 0, 100, 10},
87 {1, 0, 5, 30, 0, 0, 0, 0}, 87 {1, 0, 5, 30, 0, 0, 0, 0},
88 {0, 0, 0, 0, 0, 0, 0, 0},
88 }; 89 };
89 90
90/** Values for the CG_THERMAL_CTRL::DPM_EVENT_SRC field. */ 91/** Values for the CG_THERMAL_CTRL::DPM_EVENT_SRC field. */
@@ -4864,6 +4865,17 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
4864 len = sizeof(smu7_profiling) / sizeof(struct profile_mode_setting); 4865 len = sizeof(smu7_profiling) / sizeof(struct profile_mode_setting);
4865 4866
4866 for (i = 0; i < len; i++) { 4867 for (i = 0; i < len; i++) {
4868 if (i == hwmgr->power_profile_mode) {
4869 size += sprintf(buf + size, "%3d %14s %s: %8d %16d %16d %16d %16d %16d\n",
4870 i, profile_name[i], "*",
4871 data->current_profile_setting.sclk_up_hyst,
4872 data->current_profile_setting.sclk_down_hyst,
4873 data->current_profile_setting.sclk_activity,
4874 data->current_profile_setting.mclk_up_hyst,
4875 data->current_profile_setting.mclk_down_hyst,
4876 data->current_profile_setting.mclk_activity);
4877 continue;
4878 }
4867 if (smu7_profiling[i].bupdate_sclk) 4879 if (smu7_profiling[i].bupdate_sclk)
4868 size += sprintf(buf + size, "%3d %16s: %8d %16d %16d ", 4880 size += sprintf(buf + size, "%3d %16s: %8d %16d %16d ",
4869 i, profile_name[i], smu7_profiling[i].sclk_up_hyst, 4881 i, profile_name[i], smu7_profiling[i].sclk_up_hyst,
@@ -4883,24 +4895,6 @@ static int smu7_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
4883 "-", "-", "-"); 4895 "-", "-", "-");
4884 } 4896 }
4885 4897
4886 size += sprintf(buf + size, "%3d %16s: %8d %16d %16d %16d %16d %16d\n",
4887 i, profile_name[i],
4888 data->custom_profile_setting.sclk_up_hyst,
4889 data->custom_profile_setting.sclk_down_hyst,
4890 data->custom_profile_setting.sclk_activity,
4891 data->custom_profile_setting.mclk_up_hyst,
4892 data->custom_profile_setting.mclk_down_hyst,
4893 data->custom_profile_setting.mclk_activity);
4894
4895 size += sprintf(buf + size, "%3s %16s: %8d %16d %16d %16d %16d %16d\n",
4896 "*", "CURRENT",
4897 data->current_profile_setting.sclk_up_hyst,
4898 data->current_profile_setting.sclk_down_hyst,
4899 data->current_profile_setting.sclk_activity,
4900 data->current_profile_setting.mclk_up_hyst,
4901 data->current_profile_setting.mclk_down_hyst,
4902 data->current_profile_setting.mclk_activity);
4903
4904 return size; 4898 return size;
4905} 4899}
4906 4900
@@ -4939,16 +4933,16 @@ static int smu7_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint
4939 if (size < 8) 4933 if (size < 8)
4940 return -EINVAL; 4934 return -EINVAL;
4941 4935
4942 data->custom_profile_setting.bupdate_sclk = input[0]; 4936 tmp.bupdate_sclk = input[0];
4943 data->custom_profile_setting.sclk_up_hyst = input[1]; 4937 tmp.sclk_up_hyst = input[1];
4944 data->custom_profile_setting.sclk_down_hyst = input[2]; 4938 tmp.sclk_down_hyst = input[2];
4945 data->custom_profile_setting.sclk_activity = input[3]; 4939 tmp.sclk_activity = input[3];
4946 data->custom_profile_setting.bupdate_mclk = input[4]; 4940 tmp.bupdate_mclk = input[4];
4947 data->custom_profile_setting.mclk_up_hyst = input[5]; 4941 tmp.mclk_up_hyst = input[5];
4948 data->custom_profile_setting.mclk_down_hyst = input[6]; 4942 tmp.mclk_down_hyst = input[6];
4949 data->custom_profile_setting.mclk_activity = input[7]; 4943 tmp.mclk_activity = input[7];
4950 if (!smum_update_dpm_settings(hwmgr, &data->custom_profile_setting)) { 4944 if (!smum_update_dpm_settings(hwmgr, &tmp)) {
4951 memcpy(&data->current_profile_setting, &data->custom_profile_setting, sizeof(struct profile_mode_setting)); 4945 memcpy(&data->current_profile_setting, &tmp, sizeof(struct profile_mode_setting));
4952 hwmgr->power_profile_mode = mode; 4946 hwmgr->power_profile_mode = mode;
4953 } 4947 }
4954 break; 4948 break;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h
index f40179c9ca97..b8d0bb378595 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.h
@@ -325,7 +325,6 @@ struct smu7_hwmgr {
325 uint16_t mem_latency_high; 325 uint16_t mem_latency_high;
326 uint16_t mem_latency_low; 326 uint16_t mem_latency_low;
327 uint32_t vr_config; 327 uint32_t vr_config;
328 struct profile_mode_setting custom_profile_setting;
329 struct profile_mode_setting current_profile_setting; 328 struct profile_mode_setting current_profile_setting;
330}; 329};
331 330
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
index 03bc7453f3b1..d9e92e306535 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
@@ -852,12 +852,10 @@ int smu7_set_power_limit(struct pp_hwmgr *hwmgr, uint32_t n)
852{ 852{
853 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 853 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
854 854
855 n = (n & 0xff) << 8;
856
857 if (data->power_containment_features & 855 if (data->power_containment_features &
858 POWERCONTAINMENT_FEATURE_PkgPwrLimit) 856 POWERCONTAINMENT_FEATURE_PkgPwrLimit)
859 return smum_send_msg_to_smc_with_parameter(hwmgr, 857 return smum_send_msg_to_smc_with_parameter(hwmgr,
860 PPSMC_MSG_PkgPwrSetLimit, n); 858 PPSMC_MSG_PkgPwrSetLimit, n<<8);
861 return 0; 859 return 0;
862} 860}
863 861
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 3aa65bdecb0e..684ac626ac53 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -74,6 +74,7 @@ config DRM_SIL_SII8620
74 tristate "Silicon Image SII8620 HDMI/MHL bridge" 74 tristate "Silicon Image SII8620 HDMI/MHL bridge"
75 depends on OF && RC_CORE 75 depends on OF && RC_CORE
76 select DRM_KMS_HELPER 76 select DRM_KMS_HELPER
77 imply EXTCON
77 help 78 help
78 Silicon Image SII8620 HDMI/MHL bridge chip driver. 79 Silicon Image SII8620 HDMI/MHL bridge chip driver.
79 80
diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c
index 498d5948d1a8..9837c8d69e69 100644
--- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
+++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
@@ -56,7 +56,9 @@ static int dumb_vga_get_modes(struct drm_connector *connector)
56 } 56 }
57 57
58 drm_mode_connector_update_edid_property(connector, edid); 58 drm_mode_connector_update_edid_property(connector, edid);
59 return drm_add_edid_modes(connector, edid); 59 ret = drm_add_edid_modes(connector, edid);
60 kfree(edid);
61 return ret;
60 62
61fallback: 63fallback:
62 /* 64 /*
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 7d25c42f22db..c825c76edc1d 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -155,6 +155,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
155 state->connectors[i].state); 155 state->connectors[i].state);
156 state->connectors[i].ptr = NULL; 156 state->connectors[i].ptr = NULL;
157 state->connectors[i].state = NULL; 157 state->connectors[i].state = NULL;
158 state->connectors[i].old_state = NULL;
159 state->connectors[i].new_state = NULL;
158 drm_connector_put(connector); 160 drm_connector_put(connector);
159 } 161 }
160 162
@@ -169,6 +171,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
169 171
170 state->crtcs[i].ptr = NULL; 172 state->crtcs[i].ptr = NULL;
171 state->crtcs[i].state = NULL; 173 state->crtcs[i].state = NULL;
174 state->crtcs[i].old_state = NULL;
175 state->crtcs[i].new_state = NULL;
172 } 176 }
173 177
174 for (i = 0; i < config->num_total_plane; i++) { 178 for (i = 0; i < config->num_total_plane; i++) {
@@ -181,6 +185,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
181 state->planes[i].state); 185 state->planes[i].state);
182 state->planes[i].ptr = NULL; 186 state->planes[i].ptr = NULL;
183 state->planes[i].state = NULL; 187 state->planes[i].state = NULL;
188 state->planes[i].old_state = NULL;
189 state->planes[i].new_state = NULL;
184 } 190 }
185 191
186 for (i = 0; i < state->num_private_objs; i++) { 192 for (i = 0; i < state->num_private_objs; i++) {
@@ -190,6 +196,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state)
190 state->private_objs[i].state); 196 state->private_objs[i].state);
191 state->private_objs[i].ptr = NULL; 197 state->private_objs[i].ptr = NULL;
192 state->private_objs[i].state = NULL; 198 state->private_objs[i].state = NULL;
199 state->private_objs[i].old_state = NULL;
200 state->private_objs[i].new_state = NULL;
193 } 201 }
194 state->num_private_objs = 0; 202 state->num_private_objs = 0;
195 203
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index abd84cbcf1c2..09c4bc0b1859 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -954,8 +954,6 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
954 drm_mode_connector_attach_encoder(connector, encoder); 954 drm_mode_connector_attach_encoder(connector, encoder);
955 955
956 if (hdata->bridge) { 956 if (hdata->bridge) {
957 encoder->bridge = hdata->bridge;
958 hdata->bridge->encoder = encoder;
959 ret = drm_bridge_attach(encoder, hdata->bridge, NULL); 957 ret = drm_bridge_attach(encoder, hdata->bridge, NULL);
960 if (ret) 958 if (ret)
961 DRM_ERROR("Failed to attach bridge\n"); 959 DRM_ERROR("Failed to attach bridge\n");
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 257299ec95c4..272c79f5f5bf 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -473,7 +473,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
473 chroma_addr[1] = chroma_addr[0] + 0x40; 473 chroma_addr[1] = chroma_addr[0] + 0x40;
474 } else { 474 } else {
475 luma_addr[1] = luma_addr[0] + fb->pitches[0]; 475 luma_addr[1] = luma_addr[0] + fb->pitches[0];
476 chroma_addr[1] = chroma_addr[0] + fb->pitches[0]; 476 chroma_addr[1] = chroma_addr[0] + fb->pitches[1];
477 } 477 }
478 } else { 478 } else {
479 luma_addr[1] = 0; 479 luma_addr[1] = 0;
@@ -482,6 +482,7 @@ static void vp_video_buffer(struct mixer_context *ctx,
482 482
483 spin_lock_irqsave(&ctx->reg_slock, flags); 483 spin_lock_irqsave(&ctx->reg_slock, flags);
484 484
485 vp_reg_write(ctx, VP_SHADOW_UPDATE, 1);
485 /* interlace or progressive scan mode */ 486 /* interlace or progressive scan mode */
486 val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0); 487 val = (test_bit(MXR_BIT_INTERLACE, &ctx->flags) ? ~0 : 0);
487 vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP); 488 vp_reg_writemask(ctx, VP_MODE, val, VP_MODE_LINE_SKIP);
@@ -495,21 +496,23 @@ static void vp_video_buffer(struct mixer_context *ctx,
495 vp_reg_write(ctx, VP_IMG_SIZE_Y, VP_IMG_HSIZE(fb->pitches[0]) | 496 vp_reg_write(ctx, VP_IMG_SIZE_Y, VP_IMG_HSIZE(fb->pitches[0]) |
496 VP_IMG_VSIZE(fb->height)); 497 VP_IMG_VSIZE(fb->height));
497 /* chroma plane for NV12/NV21 is half the height of the luma plane */ 498 /* chroma plane for NV12/NV21 is half the height of the luma plane */
498 vp_reg_write(ctx, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | 499 vp_reg_write(ctx, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[1]) |
499 VP_IMG_VSIZE(fb->height / 2)); 500 VP_IMG_VSIZE(fb->height / 2));
500 501
501 vp_reg_write(ctx, VP_SRC_WIDTH, state->src.w); 502 vp_reg_write(ctx, VP_SRC_WIDTH, state->src.w);
502 vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h);
503 vp_reg_write(ctx, VP_SRC_H_POSITION, 503 vp_reg_write(ctx, VP_SRC_H_POSITION,
504 VP_SRC_H_POSITION_VAL(state->src.x)); 504 VP_SRC_H_POSITION_VAL(state->src.x));
505 vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y);
506
507 vp_reg_write(ctx, VP_DST_WIDTH, state->crtc.w); 505 vp_reg_write(ctx, VP_DST_WIDTH, state->crtc.w);
508 vp_reg_write(ctx, VP_DST_H_POSITION, state->crtc.x); 506 vp_reg_write(ctx, VP_DST_H_POSITION, state->crtc.x);
507
509 if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) { 508 if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) {
509 vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h / 2);
510 vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y / 2);
510 vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h / 2); 511 vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h / 2);
511 vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y / 2); 512 vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y / 2);
512 } else { 513 } else {
514 vp_reg_write(ctx, VP_SRC_HEIGHT, state->src.h);
515 vp_reg_write(ctx, VP_SRC_V_POSITION, state->src.y);
513 vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h); 516 vp_reg_write(ctx, VP_DST_HEIGHT, state->crtc.h);
514 vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y); 517 vp_reg_write(ctx, VP_DST_V_POSITION, state->crtc.y);
515 } 518 }
@@ -699,6 +702,15 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
699 702
700 /* interlace scan need to check shadow register */ 703 /* interlace scan need to check shadow register */
701 if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) { 704 if (test_bit(MXR_BIT_INTERLACE, &ctx->flags)) {
705 if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags) &&
706 vp_reg_read(ctx, VP_SHADOW_UPDATE))
707 goto out;
708
709 base = mixer_reg_read(ctx, MXR_CFG);
710 shadow = mixer_reg_read(ctx, MXR_CFG_S);
711 if (base != shadow)
712 goto out;
713
702 base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0)); 714 base = mixer_reg_read(ctx, MXR_GRAPHIC_BASE(0));
703 shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0)); 715 shadow = mixer_reg_read(ctx, MXR_GRAPHIC_BASE_S(0));
704 if (base != shadow) 716 if (base != shadow)
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h
index c311f571bdf9..189cfa2470a8 100644
--- a/drivers/gpu/drm/exynos/regs-mixer.h
+++ b/drivers/gpu/drm/exynos/regs-mixer.h
@@ -47,6 +47,7 @@
47#define MXR_MO 0x0304 47#define MXR_MO 0x0304
48#define MXR_RESOLUTION 0x0310 48#define MXR_RESOLUTION 0x0310
49 49
50#define MXR_CFG_S 0x2004
50#define MXR_GRAPHIC0_BASE_S 0x2024 51#define MXR_GRAPHIC0_BASE_S 0x2024
51#define MXR_GRAPHIC1_BASE_S 0x2044 52#define MXR_GRAPHIC1_BASE_S 0x2044
52 53
diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c
index 32d24c69da3c..704ddb4d3ca7 100644
--- a/drivers/gpu/drm/i915/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/intel_cdclk.c
@@ -2302,9 +2302,44 @@ static int bdw_modeset_calc_cdclk(struct drm_atomic_state *state)
2302 return 0; 2302 return 0;
2303} 2303}
2304 2304
2305static int skl_dpll0_vco(struct intel_atomic_state *intel_state)
2306{
2307 struct drm_i915_private *dev_priv = to_i915(intel_state->base.dev);
2308 struct intel_crtc *crtc;
2309 struct intel_crtc_state *crtc_state;
2310 int vco, i;
2311
2312 vco = intel_state->cdclk.logical.vco;
2313 if (!vco)
2314 vco = dev_priv->skl_preferred_vco_freq;
2315
2316 for_each_new_intel_crtc_in_state(intel_state, crtc, crtc_state, i) {
2317 if (!crtc_state->base.enable)
2318 continue;
2319
2320 if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
2321 continue;
2322
2323 /*
2324 * DPLL0 VCO may need to be adjusted to get the correct
2325 * clock for eDP. This will affect cdclk as well.
2326 */
2327 switch (crtc_state->port_clock / 2) {
2328 case 108000:
2329 case 216000:
2330 vco = 8640000;
2331 break;
2332 default:
2333 vco = 8100000;
2334 break;
2335 }
2336 }
2337
2338 return vco;
2339}
2340
2305static int skl_modeset_calc_cdclk(struct drm_atomic_state *state) 2341static int skl_modeset_calc_cdclk(struct drm_atomic_state *state)
2306{ 2342{
2307 struct drm_i915_private *dev_priv = to_i915(state->dev);
2308 struct intel_atomic_state *intel_state = to_intel_atomic_state(state); 2343 struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
2309 int min_cdclk, cdclk, vco; 2344 int min_cdclk, cdclk, vco;
2310 2345
@@ -2312,9 +2347,7 @@ static int skl_modeset_calc_cdclk(struct drm_atomic_state *state)
2312 if (min_cdclk < 0) 2347 if (min_cdclk < 0)
2313 return min_cdclk; 2348 return min_cdclk;
2314 2349
2315 vco = intel_state->cdclk.logical.vco; 2350 vco = skl_dpll0_vco(intel_state);
2316 if (!vco)
2317 vco = dev_priv->skl_preferred_vco_freq;
2318 2351
2319 /* 2352 /*
2320 * FIXME should also account for plane ratio 2353 * FIXME should also account for plane ratio
diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
index 41e6c75a7f3c..f9550ea46c26 100644
--- a/drivers/gpu/drm/i915/intel_csr.c
+++ b/drivers/gpu/drm/i915/intel_csr.c
@@ -35,6 +35,7 @@
35 */ 35 */
36 36
37#define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin" 37#define I915_CSR_GLK "i915/glk_dmc_ver1_04.bin"
38MODULE_FIRMWARE(I915_CSR_GLK);
38#define GLK_CSR_VERSION_REQUIRED CSR_VERSION(1, 4) 39#define GLK_CSR_VERSION_REQUIRED CSR_VERSION(1, 4)
39 40
40#define I915_CSR_CNL "i915/cnl_dmc_ver1_07.bin" 41#define I915_CSR_CNL "i915/cnl_dmc_ver1_07.bin"
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3b48fd2561fe..56004ffbd8bb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15178,6 +15178,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
15178 memset(&crtc->base.mode, 0, sizeof(crtc->base.mode)); 15178 memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));
15179 if (crtc_state->base.active) { 15179 if (crtc_state->base.active) {
15180 intel_mode_from_pipe_config(&crtc->base.mode, crtc_state); 15180 intel_mode_from_pipe_config(&crtc->base.mode, crtc_state);
15181 crtc->base.mode.hdisplay = crtc_state->pipe_src_w;
15182 crtc->base.mode.vdisplay = crtc_state->pipe_src_h;
15181 intel_mode_from_pipe_config(&crtc_state->base.adjusted_mode, crtc_state); 15183 intel_mode_from_pipe_config(&crtc_state->base.adjusted_mode, crtc_state);
15182 WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, &crtc->base.mode)); 15184 WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, &crtc->base.mode));
15183 15185
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 9a4a51e79fa1..b7b4cfdeb974 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1881,26 +1881,6 @@ found:
1881 reduce_m_n); 1881 reduce_m_n);
1882 } 1882 }
1883 1883
1884 /*
1885 * DPLL0 VCO may need to be adjusted to get the correct
1886 * clock for eDP. This will affect cdclk as well.
1887 */
1888 if (intel_dp_is_edp(intel_dp) && IS_GEN9_BC(dev_priv)) {
1889 int vco;
1890
1891 switch (pipe_config->port_clock / 2) {
1892 case 108000:
1893 case 216000:
1894 vco = 8640000;
1895 break;
1896 default:
1897 vco = 8100000;
1898 break;
1899 }
1900
1901 to_intel_atomic_state(pipe_config->base.state)->cdclk.logical.vco = vco;
1902 }
1903
1904 if (!HAS_DDI(dev_priv)) 1884 if (!HAS_DDI(dev_priv))
1905 intel_dp_set_clock(encoder, pipe_config); 1885 intel_dp_set_clock(encoder, pipe_config);
1906 1886
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index d35d2d50f595..8691c86f579c 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -326,7 +326,8 @@ static void intel_enable_lvds(struct intel_encoder *encoder,
326 326
327 I915_WRITE(PP_CONTROL(0), I915_READ(PP_CONTROL(0)) | PANEL_POWER_ON); 327 I915_WRITE(PP_CONTROL(0), I915_READ(PP_CONTROL(0)) | PANEL_POWER_ON);
328 POSTING_READ(lvds_encoder->reg); 328 POSTING_READ(lvds_encoder->reg);
329 if (intel_wait_for_register(dev_priv, PP_STATUS(0), PP_ON, PP_ON, 1000)) 329
330 if (intel_wait_for_register(dev_priv, PP_STATUS(0), PP_ON, PP_ON, 5000))
330 DRM_ERROR("timed out waiting for panel to power on\n"); 331 DRM_ERROR("timed out waiting for panel to power on\n");
331 332
332 intel_panel_enable_backlight(pipe_config, conn_state); 333 intel_panel_enable_backlight(pipe_config, conn_state);
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 6f402c4f2bdd..ab61c038f42c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -214,7 +214,6 @@ nouveau_bo_new(struct nouveau_cli *cli, u64 size, int align,
214 INIT_LIST_HEAD(&nvbo->entry); 214 INIT_LIST_HEAD(&nvbo->entry);
215 INIT_LIST_HEAD(&nvbo->vma_list); 215 INIT_LIST_HEAD(&nvbo->vma_list);
216 nvbo->bo.bdev = &drm->ttm.bdev; 216 nvbo->bo.bdev = &drm->ttm.bdev;
217 nvbo->cli = cli;
218 217
219 /* This is confusing, and doesn't actually mean we want an uncached 218 /* This is confusing, and doesn't actually mean we want an uncached
220 * mapping, but is what NOUVEAU_GEM_DOMAIN_COHERENT gets translated 219 * mapping, but is what NOUVEAU_GEM_DOMAIN_COHERENT gets translated
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.h b/drivers/gpu/drm/nouveau/nouveau_bo.h
index be8e00b49cde..73c48440d4d7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.h
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.h
@@ -26,8 +26,6 @@ struct nouveau_bo {
26 26
27 struct list_head vma_list; 27 struct list_head vma_list;
28 28
29 struct nouveau_cli *cli;
30
31 unsigned contig:1; 29 unsigned contig:1;
32 unsigned page:5; 30 unsigned page:5;
33 unsigned kind:8; 31 unsigned kind:8;
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index dff51a0ee028..8c093ca4222e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -63,7 +63,7 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
63 struct ttm_mem_reg *reg) 63 struct ttm_mem_reg *reg)
64{ 64{
65 struct nouveau_bo *nvbo = nouveau_bo(bo); 65 struct nouveau_bo *nvbo = nouveau_bo(bo);
66 struct nouveau_drm *drm = nvbo->cli->drm; 66 struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
67 struct nouveau_mem *mem; 67 struct nouveau_mem *mem;
68 int ret; 68 int ret;
69 69
@@ -103,7 +103,7 @@ nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
103 struct ttm_mem_reg *reg) 103 struct ttm_mem_reg *reg)
104{ 104{
105 struct nouveau_bo *nvbo = nouveau_bo(bo); 105 struct nouveau_bo *nvbo = nouveau_bo(bo);
106 struct nouveau_drm *drm = nvbo->cli->drm; 106 struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
107 struct nouveau_mem *mem; 107 struct nouveau_mem *mem;
108 int ret; 108 int ret;
109 109
@@ -131,7 +131,7 @@ nv04_gart_manager_new(struct ttm_mem_type_manager *man,
131 struct ttm_mem_reg *reg) 131 struct ttm_mem_reg *reg)
132{ 132{
133 struct nouveau_bo *nvbo = nouveau_bo(bo); 133 struct nouveau_bo *nvbo = nouveau_bo(bo);
134 struct nouveau_drm *drm = nvbo->cli->drm; 134 struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
135 struct nouveau_mem *mem; 135 struct nouveau_mem *mem;
136 int ret; 136 int ret;
137 137
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 8bd739cfd00d..2b3ccd850750 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -3264,10 +3264,11 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,
3264 3264
3265 drm_connector_unregister(&mstc->connector); 3265 drm_connector_unregister(&mstc->connector);
3266 3266
3267 drm_modeset_lock_all(drm->dev);
3268 drm_fb_helper_remove_one_connector(&drm->fbcon->helper, &mstc->connector); 3267 drm_fb_helper_remove_one_connector(&drm->fbcon->helper, &mstc->connector);
3268
3269 drm_modeset_lock(&drm->dev->mode_config.connection_mutex, NULL);
3269 mstc->port = NULL; 3270 mstc->port = NULL;
3270 drm_modeset_unlock_all(drm->dev); 3271 drm_modeset_unlock(&drm->dev->mode_config.connection_mutex);
3271 3272
3272 drm_connector_unreference(&mstc->connector); 3273 drm_connector_unreference(&mstc->connector);
3273} 3274}
@@ -3277,9 +3278,7 @@ nv50_mstm_register_connector(struct drm_connector *connector)
3277{ 3278{
3278 struct nouveau_drm *drm = nouveau_drm(connector->dev); 3279 struct nouveau_drm *drm = nouveau_drm(connector->dev);
3279 3280
3280 drm_modeset_lock_all(drm->dev);
3281 drm_fb_helper_add_one_connector(&drm->fbcon->helper, connector); 3281 drm_fb_helper_add_one_connector(&drm->fbcon->helper, connector);
3282 drm_modeset_unlock_all(drm->dev);
3283 3282
3284 drm_connector_register(connector); 3283 drm_connector_register(connector);
3285} 3284}
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 5e2e65e88847..7f3ac6b13b56 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -828,6 +828,12 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc,
828 h_coef = dispc_ovl_get_scale_coef(fir_hinc, true); 828 h_coef = dispc_ovl_get_scale_coef(fir_hinc, true);
829 v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps); 829 v_coef = dispc_ovl_get_scale_coef(fir_vinc, five_taps);
830 830
831 if (!h_coef || !v_coef) {
832 dev_err(&dispc->pdev->dev, "%s: failed to find scale coefs\n",
833 __func__);
834 return;
835 }
836
831 for (i = 0; i < 8; i++) { 837 for (i = 0; i < 8; i++) {
832 u32 h, hv; 838 u32 h, hv;
833 839
@@ -2342,7 +2348,7 @@ static int dispc_ovl_calc_scaling_24xx(struct dispc_device *dispc,
2342 } 2348 }
2343 2349
2344 if (in_width > maxsinglelinewidth) { 2350 if (in_width > maxsinglelinewidth) {
2345 DSSERR("Cannot scale max input width exceeded"); 2351 DSSERR("Cannot scale max input width exceeded\n");
2346 return -EINVAL; 2352 return -EINVAL;
2347 } 2353 }
2348 return 0; 2354 return 0;
@@ -2424,13 +2430,13 @@ again:
2424 } 2430 }
2425 2431
2426 if (in_width > (maxsinglelinewidth * 2)) { 2432 if (in_width > (maxsinglelinewidth * 2)) {
2427 DSSERR("Cannot setup scaling"); 2433 DSSERR("Cannot setup scaling\n");
2428 DSSERR("width exceeds maximum width possible"); 2434 DSSERR("width exceeds maximum width possible\n");
2429 return -EINVAL; 2435 return -EINVAL;
2430 } 2436 }
2431 2437
2432 if (in_width > maxsinglelinewidth && *five_taps) { 2438 if (in_width > maxsinglelinewidth && *five_taps) {
2433 DSSERR("cannot setup scaling with five taps"); 2439 DSSERR("cannot setup scaling with five taps\n");
2434 return -EINVAL; 2440 return -EINVAL;
2435 } 2441 }
2436 return 0; 2442 return 0;
@@ -2472,7 +2478,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
2472 in_width > maxsinglelinewidth && ++*decim_x); 2478 in_width > maxsinglelinewidth && ++*decim_x);
2473 2479
2474 if (in_width > maxsinglelinewidth) { 2480 if (in_width > maxsinglelinewidth) {
2475 DSSERR("Cannot scale width exceeds max line width"); 2481 DSSERR("Cannot scale width exceeds max line width\n");
2476 return -EINVAL; 2482 return -EINVAL;
2477 } 2483 }
2478 2484
@@ -2490,7 +2496,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
2490 * bandwidth. Despite what theory says this appears to 2496 * bandwidth. Despite what theory says this appears to
2491 * be true also for 16-bit color formats. 2497 * be true also for 16-bit color formats.
2492 */ 2498 */
2493 DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)", *decim_x); 2499 DSSERR("Not enough bandwidth, too much downscaling (x-decimation factor %d > 4)\n", *decim_x);
2494 2500
2495 return -EINVAL; 2501 return -EINVAL;
2496 } 2502 }
@@ -4633,7 +4639,7 @@ static int dispc_errata_i734_wa_init(struct dispc_device *dispc)
4633 i734_buf.size, &i734_buf.paddr, 4639 i734_buf.size, &i734_buf.paddr,
4634 GFP_KERNEL); 4640 GFP_KERNEL);
4635 if (!i734_buf.vaddr) { 4641 if (!i734_buf.vaddr) {
4636 dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed", 4642 dev_err(&dispc->pdev->dev, "%s: dma_alloc_writecombine failed\n",
4637 __func__); 4643 __func__);
4638 return -ENOMEM; 4644 return -ENOMEM;
4639 } 4645 }
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 97c88861d67a..5879f45f6fc9 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -679,7 +679,7 @@ static int hdmi_audio_config(struct device *dev,
679 struct omap_dss_audio *dss_audio) 679 struct omap_dss_audio *dss_audio)
680{ 680{
681 struct omap_hdmi *hd = dev_get_drvdata(dev); 681 struct omap_hdmi *hd = dev_get_drvdata(dev);
682 int ret; 682 int ret = 0;
683 683
684 mutex_lock(&hd->lock); 684 mutex_lock(&hd->lock);
685 685
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
index 35ed2add6189..813ba42f2753 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
@@ -922,8 +922,13 @@ int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core)
922{ 922{
923 const struct hdmi4_features *features; 923 const struct hdmi4_features *features;
924 struct resource *res; 924 struct resource *res;
925 const struct soc_device_attribute *soc;
925 926
926 features = soc_device_match(hdmi4_soc_devices)->data; 927 soc = soc_device_match(hdmi4_soc_devices);
928 if (!soc)
929 return -ENODEV;
930
931 features = soc->data;
927 core->cts_swmode = features->cts_swmode; 932 core->cts_swmode = features->cts_swmode;
928 core->audio_use_mclk = features->audio_use_mclk; 933 core->audio_use_mclk = features->audio_use_mclk;
929 934
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index d28da9ac3e90..ae1a001d1b83 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -671,7 +671,7 @@ static int hdmi_audio_config(struct device *dev,
671 struct omap_dss_audio *dss_audio) 671 struct omap_dss_audio *dss_audio)
672{ 672{
673 struct omap_hdmi *hd = dev_get_drvdata(dev); 673 struct omap_hdmi *hd = dev_get_drvdata(dev);
674 int ret; 674 int ret = 0;
675 675
676 mutex_lock(&hd->lock); 676 mutex_lock(&hd->lock);
677 677
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c
index a0d7b1d905e8..5cde26ac937b 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -121,6 +121,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
121 if (dssdrv->read_edid) { 121 if (dssdrv->read_edid) {
122 void *edid = kzalloc(MAX_EDID, GFP_KERNEL); 122 void *edid = kzalloc(MAX_EDID, GFP_KERNEL);
123 123
124 if (!edid)
125 return 0;
126
124 if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) && 127 if ((dssdrv->read_edid(dssdev, edid, MAX_EDID) > 0) &&
125 drm_edid_is_valid(edid)) { 128 drm_edid_is_valid(edid)) {
126 drm_mode_connector_update_edid_property( 129 drm_mode_connector_update_edid_property(
@@ -139,6 +142,9 @@ static int omap_connector_get_modes(struct drm_connector *connector)
139 struct drm_display_mode *mode = drm_mode_create(dev); 142 struct drm_display_mode *mode = drm_mode_create(dev);
140 struct videomode vm = {0}; 143 struct videomode vm = {0};
141 144
145 if (!mode)
146 return 0;
147
142 dssdrv->get_timings(dssdev, &vm); 148 dssdrv->get_timings(dssdev, &vm);
143 149
144 drm_display_mode_from_videomode(&vm, mode); 150 drm_display_mode_from_videomode(&vm, mode);
@@ -200,6 +206,10 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
200 if (!r) { 206 if (!r) {
201 /* check if vrefresh is still valid */ 207 /* check if vrefresh is still valid */
202 new_mode = drm_mode_duplicate(dev, mode); 208 new_mode = drm_mode_duplicate(dev, mode);
209
210 if (!new_mode)
211 return MODE_BAD;
212
203 new_mode->clock = vm.pixelclock / 1000; 213 new_mode->clock = vm.pixelclock / 1000;
204 new_mode->vrefresh = 0; 214 new_mode->vrefresh = 0;
205 if (mode->vrefresh == drm_mode_vrefresh(new_mode)) 215 if (mode->vrefresh == drm_mode_vrefresh(new_mode))
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
index f9fa1c90b35c..401c02e9e6b2 100644
--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
@@ -401,12 +401,16 @@ int tiler_unpin(struct tiler_block *block)
401struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w, 401struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, u16 w,
402 u16 h, u16 align) 402 u16 h, u16 align)
403{ 403{
404 struct tiler_block *block = kzalloc(sizeof(*block), GFP_KERNEL); 404 struct tiler_block *block;
405 u32 min_align = 128; 405 u32 min_align = 128;
406 int ret; 406 int ret;
407 unsigned long flags; 407 unsigned long flags;
408 u32 slot_bytes; 408 u32 slot_bytes;
409 409
410 block = kzalloc(sizeof(*block), GFP_KERNEL);
411 if (!block)
412 return ERR_PTR(-ENOMEM);
413
410 BUG_ON(!validfmt(fmt)); 414 BUG_ON(!validfmt(fmt));
411 415
412 /* convert width/height to slots */ 416 /* convert width/height to slots */
diff --git a/drivers/gpu/drm/omapdrm/tcm-sita.c b/drivers/gpu/drm/omapdrm/tcm-sita.c
index d7f7bc9f061a..817be3c41863 100644
--- a/drivers/gpu/drm/omapdrm/tcm-sita.c
+++ b/drivers/gpu/drm/omapdrm/tcm-sita.c
@@ -90,7 +90,7 @@ static int l2r_t2b(u16 w, u16 h, u16 a, s16 offset,
90{ 90{
91 int i; 91 int i;
92 unsigned long index; 92 unsigned long index;
93 bool area_free; 93 bool area_free = false;
94 unsigned long slots_per_band = PAGE_SIZE / slot_bytes; 94 unsigned long slots_per_band = PAGE_SIZE / slot_bytes;
95 unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0; 95 unsigned long bit_offset = (offset > 0) ? offset / slot_bytes : 0;
96 unsigned long curr_bit = bit_offset; 96 unsigned long curr_bit = bit_offset;
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index f0481b7b60c5..06c94e3a5f15 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -910,7 +910,8 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags,
910 while (npages >= HPAGE_PMD_NR) { 910 while (npages >= HPAGE_PMD_NR) {
911 gfp_t huge_flags = gfp_flags; 911 gfp_t huge_flags = gfp_flags;
912 912
913 huge_flags |= GFP_TRANSHUGE; 913 huge_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
914 __GFP_KSWAPD_RECLAIM;
914 huge_flags &= ~__GFP_MOVABLE; 915 huge_flags &= ~__GFP_MOVABLE;
915 huge_flags &= ~__GFP_COMP; 916 huge_flags &= ~__GFP_COMP;
916 p = alloc_pages(huge_flags, HPAGE_PMD_ORDER); 917 p = alloc_pages(huge_flags, HPAGE_PMD_ORDER);
@@ -1027,11 +1028,15 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
1027 GFP_USER | GFP_DMA32, "uc dma", 0); 1028 GFP_USER | GFP_DMA32, "uc dma", 0);
1028 1029
1029 ttm_page_pool_init_locked(&_manager->wc_pool_huge, 1030 ttm_page_pool_init_locked(&_manager->wc_pool_huge,
1030 GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP), 1031 (GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
1032 __GFP_KSWAPD_RECLAIM) &
1033 ~(__GFP_MOVABLE | __GFP_COMP),
1031 "wc huge", order); 1034 "wc huge", order);
1032 1035
1033 ttm_page_pool_init_locked(&_manager->uc_pool_huge, 1036 ttm_page_pool_init_locked(&_manager->uc_pool_huge,
1034 GFP_TRANSHUGE & ~(__GFP_MOVABLE | __GFP_COMP) 1037 (GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
1038 __GFP_KSWAPD_RECLAIM) &
1039 ~(__GFP_MOVABLE | __GFP_COMP)
1035 , "uc huge", order); 1040 , "uc huge", order);
1036 1041
1037 _manager->options.max_size = max_pages; 1042 _manager->options.max_size = max_pages;
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
index 8a25d1974385..f63d99c302e4 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
@@ -910,7 +910,8 @@ static gfp_t ttm_dma_pool_gfp_flags(struct ttm_dma_tt *ttm_dma, bool huge)
910 gfp_flags |= __GFP_ZERO; 910 gfp_flags |= __GFP_ZERO;
911 911
912 if (huge) { 912 if (huge) {
913 gfp_flags |= GFP_TRANSHUGE; 913 gfp_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
914 __GFP_KSWAPD_RECLAIM;
914 gfp_flags &= ~__GFP_MOVABLE; 915 gfp_flags &= ~__GFP_MOVABLE;
915 gfp_flags &= ~__GFP_COMP; 916 gfp_flags &= ~__GFP_COMP;
916 } 917 }
diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index bf4667481935..c61dff594195 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -760,6 +760,7 @@ static irqreturn_t vc4_crtc_irq_handler(int irq, void *data)
760struct vc4_async_flip_state { 760struct vc4_async_flip_state {
761 struct drm_crtc *crtc; 761 struct drm_crtc *crtc;
762 struct drm_framebuffer *fb; 762 struct drm_framebuffer *fb;
763 struct drm_framebuffer *old_fb;
763 struct drm_pending_vblank_event *event; 764 struct drm_pending_vblank_event *event;
764 765
765 struct vc4_seqno_cb cb; 766 struct vc4_seqno_cb cb;
@@ -789,6 +790,23 @@ vc4_async_page_flip_complete(struct vc4_seqno_cb *cb)
789 790
790 drm_crtc_vblank_put(crtc); 791 drm_crtc_vblank_put(crtc);
791 drm_framebuffer_put(flip_state->fb); 792 drm_framebuffer_put(flip_state->fb);
793
794 /* Decrement the BO usecnt in order to keep the inc/dec calls balanced
795 * when the planes are updated through the async update path.
796 * FIXME: we should move to generic async-page-flip when it's
797 * available, so that we can get rid of this hand-made cleanup_fb()
798 * logic.
799 */
800 if (flip_state->old_fb) {
801 struct drm_gem_cma_object *cma_bo;
802 struct vc4_bo *bo;
803
804 cma_bo = drm_fb_cma_get_gem_obj(flip_state->old_fb, 0);
805 bo = to_vc4_bo(&cma_bo->base);
806 vc4_bo_dec_usecnt(bo);
807 drm_framebuffer_put(flip_state->old_fb);
808 }
809
792 kfree(flip_state); 810 kfree(flip_state);
793 811
794 up(&vc4->async_modeset); 812 up(&vc4->async_modeset);
@@ -813,9 +831,22 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
813 struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0); 831 struct drm_gem_cma_object *cma_bo = drm_fb_cma_get_gem_obj(fb, 0);
814 struct vc4_bo *bo = to_vc4_bo(&cma_bo->base); 832 struct vc4_bo *bo = to_vc4_bo(&cma_bo->base);
815 833
834 /* Increment the BO usecnt here, so that we never end up with an
835 * unbalanced number of vc4_bo_{dec,inc}_usecnt() calls when the
836 * plane is later updated through the non-async path.
837 * FIXME: we should move to generic async-page-flip when it's
838 * available, so that we can get rid of this hand-made prepare_fb()
839 * logic.
840 */
841 ret = vc4_bo_inc_usecnt(bo);
842 if (ret)
843 return ret;
844
816 flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL); 845 flip_state = kzalloc(sizeof(*flip_state), GFP_KERNEL);
817 if (!flip_state) 846 if (!flip_state) {
847 vc4_bo_dec_usecnt(bo);
818 return -ENOMEM; 848 return -ENOMEM;
849 }
819 850
820 drm_framebuffer_get(fb); 851 drm_framebuffer_get(fb);
821 flip_state->fb = fb; 852 flip_state->fb = fb;
@@ -826,10 +857,23 @@ static int vc4_async_page_flip(struct drm_crtc *crtc,
826 ret = down_interruptible(&vc4->async_modeset); 857 ret = down_interruptible(&vc4->async_modeset);
827 if (ret) { 858 if (ret) {
828 drm_framebuffer_put(fb); 859 drm_framebuffer_put(fb);
860 vc4_bo_dec_usecnt(bo);
829 kfree(flip_state); 861 kfree(flip_state);
830 return ret; 862 return ret;
831 } 863 }
832 864
865 /* Save the current FB before it's replaced by the new one in
866 * drm_atomic_set_fb_for_plane(). We'll need the old FB in
867 * vc4_async_page_flip_complete() to decrement the BO usecnt and keep
868 * it consistent.
869 * FIXME: we should move to generic async-page-flip when it's
870 * available, so that we can get rid of this hand-made cleanup_fb()
871 * logic.
872 */
873 flip_state->old_fb = plane->state->fb;
874 if (flip_state->old_fb)
875 drm_framebuffer_get(flip_state->old_fb);
876
833 WARN_ON(drm_crtc_vblank_get(crtc) != 0); 877 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
834 878
835 /* Immediately update the plane's legacy fb pointer, so that later 879 /* Immediately update the plane's legacy fb pointer, so that later
diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c
index 72c9dbd81d7f..f185812970da 100644
--- a/drivers/gpu/drm/vc4/vc4_dpi.c
+++ b/drivers/gpu/drm/vc4/vc4_dpi.c
@@ -96,7 +96,6 @@ struct vc4_dpi {
96 struct platform_device *pdev; 96 struct platform_device *pdev;
97 97
98 struct drm_encoder *encoder; 98 struct drm_encoder *encoder;
99 struct drm_connector *connector;
100 99
101 void __iomem *regs; 100 void __iomem *regs;
102 101
@@ -164,14 +163,31 @@ static void vc4_dpi_encoder_disable(struct drm_encoder *encoder)
164 163
165static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) 164static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
166{ 165{
166 struct drm_device *dev = encoder->dev;
167 struct drm_display_mode *mode = &encoder->crtc->mode; 167 struct drm_display_mode *mode = &encoder->crtc->mode;
168 struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder); 168 struct vc4_dpi_encoder *vc4_encoder = to_vc4_dpi_encoder(encoder);
169 struct vc4_dpi *dpi = vc4_encoder->dpi; 169 struct vc4_dpi *dpi = vc4_encoder->dpi;
170 struct drm_connector_list_iter conn_iter;
171 struct drm_connector *connector = NULL, *connector_scan;
170 u32 dpi_c = DPI_ENABLE | DPI_OUTPUT_ENABLE_MODE; 172 u32 dpi_c = DPI_ENABLE | DPI_OUTPUT_ENABLE_MODE;
171 int ret; 173 int ret;
172 174
173 if (dpi->connector->display_info.num_bus_formats) { 175 /* Look up the connector attached to DPI so we can get the
174 u32 bus_format = dpi->connector->display_info.bus_formats[0]; 176 * bus_format. Ideally the bridge would tell us the
177 * bus_format we want, but it doesn't yet, so assume that it's
178 * uniform throughout the bridge chain.
179 */
180 drm_connector_list_iter_begin(dev, &conn_iter);
181 drm_for_each_connector_iter(connector_scan, &conn_iter) {
182 if (connector_scan->encoder == encoder) {
183 connector = connector_scan;
184 break;
185 }
186 }
187 drm_connector_list_iter_end(&conn_iter);
188
189 if (connector && connector->display_info.num_bus_formats) {
190 u32 bus_format = connector->display_info.bus_formats[0];
175 191
176 switch (bus_format) { 192 switch (bus_format) {
177 case MEDIA_BUS_FMT_RGB888_1X24: 193 case MEDIA_BUS_FMT_RGB888_1X24:
@@ -199,6 +215,9 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
199 DRM_ERROR("Unknown media bus format %d\n", bus_format); 215 DRM_ERROR("Unknown media bus format %d\n", bus_format);
200 break; 216 break;
201 } 217 }
218 } else {
219 /* Default to 24bit if no connector found. */
220 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_24BIT_888_RGB, DPI_FORMAT);
202 } 221 }
203 222
204 if (mode->flags & DRM_MODE_FLAG_NHSYNC) 223 if (mode->flags & DRM_MODE_FLAG_NHSYNC)
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index ce39390be389..13dcaad06798 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -503,7 +503,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
503 * the scl fields here. 503 * the scl fields here.
504 */ 504 */
505 if (num_planes == 1) { 505 if (num_planes == 1) {
506 scl0 = vc4_get_scl_field(state, 1); 506 scl0 = vc4_get_scl_field(state, 0);
507 scl1 = scl0; 507 scl1 = scl0;
508 } else { 508 } else {
509 scl0 = vc4_get_scl_field(state, 1); 509 scl0 = vc4_get_scl_field(state, 1);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 2582ffd36bb5..ba0cdb743c3e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -441,11 +441,11 @@ static int vmwgfx_set_config_internal(struct drm_mode_set *set)
441 struct drm_crtc *crtc = set->crtc; 441 struct drm_crtc *crtc = set->crtc;
442 struct drm_framebuffer *fb; 442 struct drm_framebuffer *fb;
443 struct drm_crtc *tmp; 443 struct drm_crtc *tmp;
444 struct drm_modeset_acquire_ctx *ctx;
445 struct drm_device *dev = set->crtc->dev; 444 struct drm_device *dev = set->crtc->dev;
445 struct drm_modeset_acquire_ctx ctx;
446 int ret; 446 int ret;
447 447
448 ctx = dev->mode_config.acquire_ctx; 448 drm_modeset_acquire_init(&ctx, 0);
449 449
450restart: 450restart:
451 /* 451 /*
@@ -458,7 +458,7 @@ restart:
458 458
459 fb = set->fb; 459 fb = set->fb;
460 460
461 ret = crtc->funcs->set_config(set, ctx); 461 ret = crtc->funcs->set_config(set, &ctx);
462 if (ret == 0) { 462 if (ret == 0) {
463 crtc->primary->crtc = crtc; 463 crtc->primary->crtc = crtc;
464 crtc->primary->fb = fb; 464 crtc->primary->fb = fb;
@@ -473,20 +473,13 @@ restart:
473 } 473 }
474 474
475 if (ret == -EDEADLK) { 475 if (ret == -EDEADLK) {
476 dev->mode_config.acquire_ctx = NULL; 476 drm_modeset_backoff(&ctx);
477
478retry_locking:
479 drm_modeset_backoff(ctx);
480
481 ret = drm_modeset_lock_all_ctx(dev, ctx);
482 if (ret)
483 goto retry_locking;
484
485 dev->mode_config.acquire_ctx = ctx;
486
487 goto restart; 477 goto restart;
488 } 478 }
489 479
480 drm_modeset_drop_locks(&ctx);
481 drm_modeset_acquire_fini(&ctx);
482
490 return ret; 483 return ret;
491} 484}
492 485
@@ -624,7 +617,6 @@ static int vmw_fb_set_par(struct fb_info *info)
624 } 617 }
625 618
626 mutex_lock(&par->bo_mutex); 619 mutex_lock(&par->bo_mutex);
627 drm_modeset_lock_all(vmw_priv->dev);
628 ret = vmw_fb_kms_framebuffer(info); 620 ret = vmw_fb_kms_framebuffer(info);
629 if (ret) 621 if (ret)
630 goto out_unlock; 622 goto out_unlock;
@@ -657,7 +649,6 @@ out_unlock:
657 drm_mode_destroy(vmw_priv->dev, old_mode); 649 drm_mode_destroy(vmw_priv->dev, old_mode);
658 par->set_mode = mode; 650 par->set_mode = mode;
659 651
660 drm_modeset_unlock_all(vmw_priv->dev);
661 mutex_unlock(&par->bo_mutex); 652 mutex_unlock(&par->bo_mutex);
662 653
663 return ret; 654 return ret;
@@ -713,18 +704,14 @@ int vmw_fb_init(struct vmw_private *vmw_priv)
713 par->max_width = fb_width; 704 par->max_width = fb_width;
714 par->max_height = fb_height; 705 par->max_height = fb_height;
715 706
716 drm_modeset_lock_all(vmw_priv->dev);
717 ret = vmw_kms_fbdev_init_data(vmw_priv, 0, par->max_width, 707 ret = vmw_kms_fbdev_init_data(vmw_priv, 0, par->max_width,
718 par->max_height, &par->con, 708 par->max_height, &par->con,
719 &par->crtc, &init_mode); 709 &par->crtc, &init_mode);
720 if (ret) { 710 if (ret)
721 drm_modeset_unlock_all(vmw_priv->dev);
722 goto err_kms; 711 goto err_kms;
723 }
724 712
725 info->var.xres = init_mode->hdisplay; 713 info->var.xres = init_mode->hdisplay;
726 info->var.yres = init_mode->vdisplay; 714 info->var.yres = init_mode->vdisplay;
727 drm_modeset_unlock_all(vmw_priv->dev);
728 715
729 /* 716 /*
730 * Create buffers and alloc memory 717 * Create buffers and alloc memory
@@ -832,7 +819,9 @@ int vmw_fb_close(struct vmw_private *vmw_priv)
832 cancel_delayed_work_sync(&par->local_work); 819 cancel_delayed_work_sync(&par->local_work);
833 unregister_framebuffer(info); 820 unregister_framebuffer(info);
834 821
822 mutex_lock(&par->bo_mutex);
835 (void) vmw_fb_kms_detach(par, true, true); 823 (void) vmw_fb_kms_detach(par, true, true);
824 mutex_unlock(&par->bo_mutex);
836 825
837 vfree(par->vmalloc); 826 vfree(par->vmalloc);
838 framebuffer_release(info); 827 framebuffer_release(info);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index f11601b6fd74..96fd7a03d2f8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -2595,6 +2595,7 @@ void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx,
2595 vmw_kms_helper_buffer_finish(res->dev_priv, NULL, ctx->buf, 2595 vmw_kms_helper_buffer_finish(res->dev_priv, NULL, ctx->buf,
2596 out_fence, NULL); 2596 out_fence, NULL);
2597 2597
2598 vmw_dmabuf_unreference(&ctx->buf);
2598 vmw_resource_unreserve(res, false, NULL, 0); 2599 vmw_resource_unreserve(res, false, NULL, 0);
2599 mutex_unlock(&res->dev_priv->cmdbuf_mutex); 2600 mutex_unlock(&res->dev_priv->cmdbuf_mutex);
2600} 2601}
@@ -2680,7 +2681,9 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
2680 struct vmw_display_unit *du; 2681 struct vmw_display_unit *du;
2681 struct drm_display_mode *mode; 2682 struct drm_display_mode *mode;
2682 int i = 0; 2683 int i = 0;
2684 int ret = 0;
2683 2685
2686 mutex_lock(&dev_priv->dev->mode_config.mutex);
2684 list_for_each_entry(con, &dev_priv->dev->mode_config.connector_list, 2687 list_for_each_entry(con, &dev_priv->dev->mode_config.connector_list,
2685 head) { 2688 head) {
2686 if (i == unit) 2689 if (i == unit)
@@ -2691,7 +2694,8 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
2691 2694
2692 if (i != unit) { 2695 if (i != unit) {
2693 DRM_ERROR("Could not find initial display unit.\n"); 2696 DRM_ERROR("Could not find initial display unit.\n");
2694 return -EINVAL; 2697 ret = -EINVAL;
2698 goto out_unlock;
2695 } 2699 }
2696 2700
2697 if (list_empty(&con->modes)) 2701 if (list_empty(&con->modes))
@@ -2699,7 +2703,8 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
2699 2703
2700 if (list_empty(&con->modes)) { 2704 if (list_empty(&con->modes)) {
2701 DRM_ERROR("Could not find initial display mode.\n"); 2705 DRM_ERROR("Could not find initial display mode.\n");
2702 return -EINVAL; 2706 ret = -EINVAL;
2707 goto out_unlock;
2703 } 2708 }
2704 2709
2705 du = vmw_connector_to_du(con); 2710 du = vmw_connector_to_du(con);
@@ -2720,7 +2725,10 @@ int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
2720 head); 2725 head);
2721 } 2726 }
2722 2727
2723 return 0; 2728 out_unlock:
2729 mutex_unlock(&dev_priv->dev->mode_config.mutex);
2730
2731 return ret;
2724} 2732}
2725 2733
2726/** 2734/**
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 60252fd796f6..0000434a1fbd 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -462,10 +462,11 @@ config HID_LENOVO
462 select NEW_LEDS 462 select NEW_LEDS
463 select LEDS_CLASS 463 select LEDS_CLASS
464 ---help--- 464 ---help---
465 Support for Lenovo devices that are not fully compliant with HID standard. 465 Support for IBM/Lenovo devices that are not fully compliant with HID standard.
466 466
467 Say Y if you want support for the non-compliant features of the Lenovo 467 Say Y if you want support for horizontal scrolling of the IBM/Lenovo
468 Thinkpad standalone keyboards, e.g: 468 Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad
469 standalone keyboards, e.g:
469 - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint 470 - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint
470 configuration) 471 configuration)
471 - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) 472 - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 0b5cc910f62e..46f5ecd11bf7 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -552,6 +552,13 @@
552#define USB_VENDOR_ID_HUION 0x256c 552#define USB_VENDOR_ID_HUION 0x256c
553#define USB_DEVICE_ID_HUION_TABLET 0x006e 553#define USB_DEVICE_ID_HUION_TABLET 0x006e
554 554
555#define USB_VENDOR_ID_IBM 0x04b3
556#define USB_DEVICE_ID_IBM_SCROLLPOINT_III 0x3100
557#define USB_DEVICE_ID_IBM_SCROLLPOINT_PRO 0x3103
558#define USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL 0x3105
559#define USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL 0x3108
560#define USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO 0x3109
561
555#define USB_VENDOR_ID_IDEACOM 0x1cb6 562#define USB_VENDOR_ID_IDEACOM 0x1cb6
556#define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650 563#define USB_DEVICE_ID_IDEACOM_IDC6650 0x6650
557#define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651 564#define USB_DEVICE_ID_IDEACOM_IDC6651 0x6651
@@ -684,6 +691,7 @@
684#define USB_DEVICE_ID_LENOVO_TPKBD 0x6009 691#define USB_DEVICE_ID_LENOVO_TPKBD 0x6009
685#define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047 692#define USB_DEVICE_ID_LENOVO_CUSBKBD 0x6047
686#define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048 693#define USB_DEVICE_ID_LENOVO_CBTKBD 0x6048
694#define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049
687#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 695#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067
688#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 696#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
689#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 697#define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
@@ -964,6 +972,7 @@
964#define USB_DEVICE_ID_SIS817_TOUCH 0x0817 972#define USB_DEVICE_ID_SIS817_TOUCH 0x0817
965#define USB_DEVICE_ID_SIS_TS 0x1013 973#define USB_DEVICE_ID_SIS_TS 0x1013
966#define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 974#define USB_DEVICE_ID_SIS1030_TOUCH 0x1030
975#define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb
967 976
968#define USB_VENDOR_ID_SKYCABLE 0x1223 977#define USB_VENDOR_ID_SKYCABLE 0x1223
969#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 978#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 1ac4ff4d57a6..643b6eb54442 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -6,6 +6,17 @@
6 * 6 *
7 * Copyright (c) 2012 Bernhard Seibold 7 * Copyright (c) 2012 Bernhard Seibold
8 * Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk> 8 * Copyright (c) 2014 Jamie Lentin <jm@lentin.co.uk>
9 *
10 * Linux IBM/Lenovo Scrollpoint mouse driver:
11 * - IBM Scrollpoint III
12 * - IBM Scrollpoint Pro
13 * - IBM Scrollpoint Optical
14 * - IBM Scrollpoint Optical 800dpi
15 * - IBM Scrollpoint Optical 800dpi Pro
16 * - Lenovo Scrollpoint Optical
17 *
18 * Copyright (c) 2012 Peter De Wachter <pdewacht@gmail.com>
19 * Copyright (c) 2018 Peter Ganzhorn <peter.ganzhorn@gmail.com>
9 */ 20 */
10 21
11/* 22/*
@@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
160 return 0; 171 return 0;
161} 172}
162 173
174static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev,
175 struct hid_input *hi, struct hid_field *field,
176 struct hid_usage *usage, unsigned long **bit, int *max)
177{
178 if (usage->hid == HID_GD_Z) {
179 hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL);
180 return 1;
181 }
182 return 0;
183}
184
163static int lenovo_input_mapping(struct hid_device *hdev, 185static int lenovo_input_mapping(struct hid_device *hdev,
164 struct hid_input *hi, struct hid_field *field, 186 struct hid_input *hi, struct hid_field *field,
165 struct hid_usage *usage, unsigned long **bit, int *max) 187 struct hid_usage *usage, unsigned long **bit, int *max)
@@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev,
172 case USB_DEVICE_ID_LENOVO_CBTKBD: 194 case USB_DEVICE_ID_LENOVO_CBTKBD:
173 return lenovo_input_mapping_cptkbd(hdev, hi, field, 195 return lenovo_input_mapping_cptkbd(hdev, hi, field,
174 usage, bit, max); 196 usage, bit, max);
197 case USB_DEVICE_ID_IBM_SCROLLPOINT_III:
198 case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO:
199 case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL:
200 case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL:
201 case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO:
202 case USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL:
203 return lenovo_input_mapping_scrollpoint(hdev, hi, field,
204 usage, bit, max);
175 default: 205 default:
176 return 0; 206 return 0;
177 } 207 }
@@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = {
883 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, 913 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) },
884 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, 914 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) },
885 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, 915 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) },
916 { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) },
917 { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) },
918 { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) },
919 { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) },
920 { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) },
921 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) },
886 { } 922 { }
887}; 923};
888 924
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 963328674e93..cc33622253aa 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -174,6 +174,8 @@ static const struct i2c_hid_quirks {
174 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, 174 I2C_HID_QUIRK_NO_IRQ_AFTER_RESET },
175 { I2C_VENDOR_ID_RAYD, I2C_PRODUCT_ID_RAYD_3118, 175 { I2C_VENDOR_ID_RAYD, I2C_PRODUCT_ID_RAYD_3118,
176 I2C_HID_QUIRK_RESEND_REPORT_DESCR }, 176 I2C_HID_QUIRK_RESEND_REPORT_DESCR },
177 { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH,
178 I2C_HID_QUIRK_RESEND_REPORT_DESCR },
177 { 0, 0 } 179 { 0, 0 }
178}; 180};
179 181
diff --git a/drivers/hid/intel-ish-hid/ishtp-hid-client.c b/drivers/hid/intel-ish-hid/ishtp-hid-client.c
index 157b44aacdff..acc2536c8094 100644
--- a/drivers/hid/intel-ish-hid/ishtp-hid-client.c
+++ b/drivers/hid/intel-ish-hid/ishtp-hid-client.c
@@ -77,21 +77,21 @@ static void process_recv(struct ishtp_cl *hid_ishtp_cl, void *recv_buf,
77 struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data; 77 struct ishtp_cl_data *client_data = hid_ishtp_cl->client_data;
78 int curr_hid_dev = client_data->cur_hid_dev; 78 int curr_hid_dev = client_data->cur_hid_dev;
79 79
80 if (data_len < sizeof(struct hostif_msg_hdr)) {
81 dev_err(&client_data->cl_device->dev,
82 "[hid-ish]: error, received %u which is less than data header %u\n",
83 (unsigned int)data_len,
84 (unsigned int)sizeof(struct hostif_msg_hdr));
85 ++client_data->bad_recv_cnt;
86 ish_hw_reset(hid_ishtp_cl->dev);
87 return;
88 }
89
90 payload = recv_buf + sizeof(struct hostif_msg_hdr); 80 payload = recv_buf + sizeof(struct hostif_msg_hdr);
91 total_len = data_len; 81 total_len = data_len;
92 cur_pos = 0; 82 cur_pos = 0;
93 83
94 do { 84 do {
85 if (cur_pos + sizeof(struct hostif_msg) > total_len) {
86 dev_err(&client_data->cl_device->dev,
87 "[hid-ish]: error, received %u which is less than data header %u\n",
88 (unsigned int)data_len,
89 (unsigned int)sizeof(struct hostif_msg_hdr));
90 ++client_data->bad_recv_cnt;
91 ish_hw_reset(hid_ishtp_cl->dev);
92 break;
93 }
94
95 recv_msg = (struct hostif_msg *)(recv_buf + cur_pos); 95 recv_msg = (struct hostif_msg *)(recv_buf + cur_pos);
96 payload_len = recv_msg->hdr.size; 96 payload_len = recv_msg->hdr.size;
97 97
@@ -412,9 +412,7 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id,
412{ 412{
413 struct ishtp_hid_data *hid_data = hid->driver_data; 413 struct ishtp_hid_data *hid_data = hid->driver_data;
414 struct ishtp_cl_data *client_data = hid_data->client_data; 414 struct ishtp_cl_data *client_data = hid_data->client_data;
415 static unsigned char buf[10]; 415 struct hostif_msg_to_sensor msg = {};
416 unsigned int len;
417 struct hostif_msg_to_sensor *msg = (struct hostif_msg_to_sensor *)buf;
418 int rv; 416 int rv;
419 int i; 417 int i;
420 418
@@ -426,14 +424,11 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id,
426 return; 424 return;
427 } 425 }
428 426
429 len = sizeof(struct hostif_msg_to_sensor); 427 msg.hdr.command = (report_type == HID_FEATURE_REPORT) ?
430
431 memset(msg, 0, sizeof(struct hostif_msg_to_sensor));
432 msg->hdr.command = (report_type == HID_FEATURE_REPORT) ?
433 HOSTIF_GET_FEATURE_REPORT : HOSTIF_GET_INPUT_REPORT; 428 HOSTIF_GET_FEATURE_REPORT : HOSTIF_GET_INPUT_REPORT;
434 for (i = 0; i < client_data->num_hid_devices; ++i) { 429 for (i = 0; i < client_data->num_hid_devices; ++i) {
435 if (hid == client_data->hid_sensor_hubs[i]) { 430 if (hid == client_data->hid_sensor_hubs[i]) {
436 msg->hdr.device_id = 431 msg.hdr.device_id =
437 client_data->hid_devices[i].dev_id; 432 client_data->hid_devices[i].dev_id;
438 break; 433 break;
439 } 434 }
@@ -442,8 +437,9 @@ void hid_ishtp_get_report(struct hid_device *hid, int report_id,
442 if (i == client_data->num_hid_devices) 437 if (i == client_data->num_hid_devices)
443 return; 438 return;
444 439
445 msg->report_id = report_id; 440 msg.report_id = report_id;
446 rv = ishtp_cl_send(client_data->hid_ishtp_cl, buf, len); 441 rv = ishtp_cl_send(client_data->hid_ishtp_cl, (uint8_t *)&msg,
442 sizeof(msg));
447 if (rv) 443 if (rv)
448 hid_ishtp_trace(client_data, "%s hid %p send failed\n", 444 hid_ishtp_trace(client_data, "%s hid %p send failed\n",
449 __func__, hid); 445 __func__, hid);
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index f272cdd9bd55..2623a567ffba 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -418,7 +418,7 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev,
418 list_del(&device->device_link); 418 list_del(&device->device_link);
419 spin_unlock_irqrestore(&dev->device_list_lock, flags); 419 spin_unlock_irqrestore(&dev->device_list_lock, flags);
420 dev_err(dev->devc, "Failed to register ISHTP client device\n"); 420 dev_err(dev->devc, "Failed to register ISHTP client device\n");
421 kfree(device); 421 put_device(&device->dev);
422 return NULL; 422 return NULL;
423 } 423 }
424 424
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index b54ef1ffcbec..ee7a37eb159a 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1213,8 +1213,10 @@ static int __wacom_devm_sysfs_create_group(struct wacom *wacom,
1213 devres->root = root; 1213 devres->root = root;
1214 1214
1215 error = sysfs_create_group(devres->root, group); 1215 error = sysfs_create_group(devres->root, group);
1216 if (error) 1216 if (error) {
1217 devres_free(devres);
1217 return error; 1218 return error;
1219 }
1218 1220
1219 devres_add(&wacom->hdev->dev, devres); 1221 devres_add(&wacom->hdev->dev, devres);
1220 1222
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index ee270e065ba9..2a972ed6851b 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -61,9 +61,12 @@ config INFINIBAND_ON_DEMAND_PAGING
61 pages on demand instead. 61 pages on demand instead.
62 62
63config INFINIBAND_ADDR_TRANS 63config INFINIBAND_ADDR_TRANS
64 bool 64 bool "RDMA/CM"
65 depends on INFINIBAND 65 depends on INFINIBAND
66 default y 66 default y
67 ---help---
68 Support for RDMA communication manager (CM).
69 This allows for a generic connection abstraction over RDMA.
67 70
68config INFINIBAND_ADDR_TRANS_CONFIGFS 71config INFINIBAND_ADDR_TRANS_CONFIGFS
69 bool 72 bool
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index e337b08de2ff..fb2d347f760f 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -291,14 +291,18 @@ static int find_gid(struct ib_gid_table *table, const union ib_gid *gid,
291 * so lookup free slot only if requested. 291 * so lookup free slot only if requested.
292 */ 292 */
293 if (pempty && empty < 0) { 293 if (pempty && empty < 0) {
294 if (data->props & GID_TABLE_ENTRY_INVALID) { 294 if (data->props & GID_TABLE_ENTRY_INVALID &&
295 /* Found an invalid (free) entry; allocate it */ 295 (default_gid ==
296 if (data->props & GID_TABLE_ENTRY_DEFAULT) { 296 !!(data->props & GID_TABLE_ENTRY_DEFAULT))) {
297 if (default_gid) 297 /*
298 empty = curr_index; 298 * Found an invalid (free) entry; allocate it.
299 } else { 299 * If default GID is requested, then our
300 empty = curr_index; 300 * found slot must be one of the DEFAULT
301 } 301 * reserved slots or we fail.
302 * This ensures that only DEFAULT reserved
303 * slots are used for default property GIDs.
304 */
305 empty = curr_index;
302 } 306 }
303 } 307 }
304 308
@@ -420,8 +424,10 @@ int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
420 return ret; 424 return ret;
421} 425}
422 426
423int ib_cache_gid_del(struct ib_device *ib_dev, u8 port, 427static int
424 union ib_gid *gid, struct ib_gid_attr *attr) 428_ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
429 union ib_gid *gid, struct ib_gid_attr *attr,
430 unsigned long mask, bool default_gid)
425{ 431{
426 struct ib_gid_table *table; 432 struct ib_gid_table *table;
427 int ret = 0; 433 int ret = 0;
@@ -431,11 +437,7 @@ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
431 437
432 mutex_lock(&table->lock); 438 mutex_lock(&table->lock);
433 439
434 ix = find_gid(table, gid, attr, false, 440 ix = find_gid(table, gid, attr, default_gid, mask, NULL);
435 GID_ATTR_FIND_MASK_GID |
436 GID_ATTR_FIND_MASK_GID_TYPE |
437 GID_ATTR_FIND_MASK_NETDEV,
438 NULL);
439 if (ix < 0) { 441 if (ix < 0) {
440 ret = -EINVAL; 442 ret = -EINVAL;
441 goto out_unlock; 443 goto out_unlock;
@@ -452,6 +454,17 @@ out_unlock:
452 return ret; 454 return ret;
453} 455}
454 456
457int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
458 union ib_gid *gid, struct ib_gid_attr *attr)
459{
460 unsigned long mask = GID_ATTR_FIND_MASK_GID |
461 GID_ATTR_FIND_MASK_GID_TYPE |
462 GID_ATTR_FIND_MASK_DEFAULT |
463 GID_ATTR_FIND_MASK_NETDEV;
464
465 return _ib_cache_gid_del(ib_dev, port, gid, attr, mask, false);
466}
467
455int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port, 468int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
456 struct net_device *ndev) 469 struct net_device *ndev)
457{ 470{
@@ -728,7 +741,7 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
728 unsigned long gid_type_mask, 741 unsigned long gid_type_mask,
729 enum ib_cache_gid_default_mode mode) 742 enum ib_cache_gid_default_mode mode)
730{ 743{
731 union ib_gid gid; 744 union ib_gid gid = { };
732 struct ib_gid_attr gid_attr; 745 struct ib_gid_attr gid_attr;
733 struct ib_gid_table *table; 746 struct ib_gid_table *table;
734 unsigned int gid_type; 747 unsigned int gid_type;
@@ -736,7 +749,9 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
736 749
737 table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid; 750 table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
738 751
739 make_default_gid(ndev, &gid); 752 mask = GID_ATTR_FIND_MASK_GID_TYPE |
753 GID_ATTR_FIND_MASK_DEFAULT |
754 GID_ATTR_FIND_MASK_NETDEV;
740 memset(&gid_attr, 0, sizeof(gid_attr)); 755 memset(&gid_attr, 0, sizeof(gid_attr));
741 gid_attr.ndev = ndev; 756 gid_attr.ndev = ndev;
742 757
@@ -747,12 +762,12 @@ void ib_cache_gid_set_default_gid(struct ib_device *ib_dev, u8 port,
747 gid_attr.gid_type = gid_type; 762 gid_attr.gid_type = gid_type;
748 763
749 if (mode == IB_CACHE_GID_DEFAULT_MODE_SET) { 764 if (mode == IB_CACHE_GID_DEFAULT_MODE_SET) {
750 mask = GID_ATTR_FIND_MASK_GID_TYPE | 765 make_default_gid(ndev, &gid);
751 GID_ATTR_FIND_MASK_DEFAULT;
752 __ib_cache_gid_add(ib_dev, port, &gid, 766 __ib_cache_gid_add(ib_dev, port, &gid,
753 &gid_attr, mask, true); 767 &gid_attr, mask, true);
754 } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) { 768 } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
755 ib_cache_gid_del(ib_dev, port, &gid, &gid_attr); 769 _ib_cache_gid_del(ib_dev, port, &gid,
770 &gid_attr, mask, true);
756 } 771 }
757 } 772 }
758} 773}
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 51a641002e10..a693fcd4c513 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -382,6 +382,8 @@ struct cma_hdr {
382#define CMA_VERSION 0x00 382#define CMA_VERSION 0x00
383 383
384struct cma_req_info { 384struct cma_req_info {
385 struct sockaddr_storage listen_addr_storage;
386 struct sockaddr_storage src_addr_storage;
385 struct ib_device *device; 387 struct ib_device *device;
386 int port; 388 int port;
387 union ib_gid local_gid; 389 union ib_gid local_gid;
@@ -866,7 +868,6 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,
866{ 868{
867 struct ib_qp_attr qp_attr; 869 struct ib_qp_attr qp_attr;
868 int qp_attr_mask, ret; 870 int qp_attr_mask, ret;
869 union ib_gid sgid;
870 871
871 mutex_lock(&id_priv->qp_mutex); 872 mutex_lock(&id_priv->qp_mutex);
872 if (!id_priv->id.qp) { 873 if (!id_priv->id.qp) {
@@ -889,12 +890,6 @@ static int cma_modify_qp_rtr(struct rdma_id_private *id_priv,
889 if (ret) 890 if (ret)
890 goto out; 891 goto out;
891 892
892 ret = ib_query_gid(id_priv->id.device, id_priv->id.port_num,
893 rdma_ah_read_grh(&qp_attr.ah_attr)->sgid_index,
894 &sgid, NULL);
895 if (ret)
896 goto out;
897
898 BUG_ON(id_priv->cma_dev->device != id_priv->id.device); 893 BUG_ON(id_priv->cma_dev->device != id_priv->id.device);
899 894
900 if (conn_param) 895 if (conn_param)
@@ -1340,11 +1335,11 @@ static bool validate_net_dev(struct net_device *net_dev,
1340} 1335}
1341 1336
1342static struct net_device *cma_get_net_dev(struct ib_cm_event *ib_event, 1337static struct net_device *cma_get_net_dev(struct ib_cm_event *ib_event,
1343 const struct cma_req_info *req) 1338 struct cma_req_info *req)
1344{ 1339{
1345 struct sockaddr_storage listen_addr_storage, src_addr_storage; 1340 struct sockaddr *listen_addr =
1346 struct sockaddr *listen_addr = (struct sockaddr *)&listen_addr_storage, 1341 (struct sockaddr *)&req->listen_addr_storage;
1347 *src_addr = (struct sockaddr *)&src_addr_storage; 1342 struct sockaddr *src_addr = (struct sockaddr *)&req->src_addr_storage;
1348 struct net_device *net_dev; 1343 struct net_device *net_dev;
1349 const union ib_gid *gid = req->has_gid ? &req->local_gid : NULL; 1344 const union ib_gid *gid = req->has_gid ? &req->local_gid : NULL;
1350 int err; 1345 int err;
@@ -1359,11 +1354,6 @@ static struct net_device *cma_get_net_dev(struct ib_cm_event *ib_event,
1359 if (!net_dev) 1354 if (!net_dev)
1360 return ERR_PTR(-ENODEV); 1355 return ERR_PTR(-ENODEV);
1361 1356
1362 if (!validate_net_dev(net_dev, listen_addr, src_addr)) {
1363 dev_put(net_dev);
1364 return ERR_PTR(-EHOSTUNREACH);
1365 }
1366
1367 return net_dev; 1357 return net_dev;
1368} 1358}
1369 1359
@@ -1490,15 +1480,51 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
1490 } 1480 }
1491 } 1481 }
1492 1482
1483 /*
1484 * Net namespace might be getting deleted while route lookup,
1485 * cm_id lookup is in progress. Therefore, perform netdevice
1486 * validation, cm_id lookup under rcu lock.
1487 * RCU lock along with netdevice state check, synchronizes with
1488 * netdevice migrating to different net namespace and also avoids
1489 * case where net namespace doesn't get deleted while lookup is in
1490 * progress.
1491 * If the device state is not IFF_UP, its properties such as ifindex
1492 * and nd_net cannot be trusted to remain valid without rcu lock.
1493 * net/core/dev.c change_net_namespace() ensures to synchronize with
1494 * ongoing operations on net device after device is closed using
1495 * synchronize_net().
1496 */
1497 rcu_read_lock();
1498 if (*net_dev) {
1499 /*
1500 * If netdevice is down, it is likely that it is administratively
1501 * down or it might be migrating to different namespace.
1502 * In that case avoid further processing, as the net namespace
1503 * or ifindex may change.
1504 */
1505 if (((*net_dev)->flags & IFF_UP) == 0) {
1506 id_priv = ERR_PTR(-EHOSTUNREACH);
1507 goto err;
1508 }
1509
1510 if (!validate_net_dev(*net_dev,
1511 (struct sockaddr *)&req.listen_addr_storage,
1512 (struct sockaddr *)&req.src_addr_storage)) {
1513 id_priv = ERR_PTR(-EHOSTUNREACH);
1514 goto err;
1515 }
1516 }
1517
1493 bind_list = cma_ps_find(*net_dev ? dev_net(*net_dev) : &init_net, 1518 bind_list = cma_ps_find(*net_dev ? dev_net(*net_dev) : &init_net,
1494 rdma_ps_from_service_id(req.service_id), 1519 rdma_ps_from_service_id(req.service_id),
1495 cma_port_from_service_id(req.service_id)); 1520 cma_port_from_service_id(req.service_id));
1496 id_priv = cma_find_listener(bind_list, cm_id, ib_event, &req, *net_dev); 1521 id_priv = cma_find_listener(bind_list, cm_id, ib_event, &req, *net_dev);
1522err:
1523 rcu_read_unlock();
1497 if (IS_ERR(id_priv) && *net_dev) { 1524 if (IS_ERR(id_priv) && *net_dev) {
1498 dev_put(*net_dev); 1525 dev_put(*net_dev);
1499 *net_dev = NULL; 1526 *net_dev = NULL;
1500 } 1527 }
1501
1502 return id_priv; 1528 return id_priv;
1503} 1529}
1504 1530
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index 9821ae900f6d..da12da1c36f6 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -114,7 +114,7 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
114 struct sockaddr_storage *mapped_sockaddr, 114 struct sockaddr_storage *mapped_sockaddr,
115 u8 nl_client) 115 u8 nl_client)
116{ 116{
117 struct hlist_head *hash_bucket_head; 117 struct hlist_head *hash_bucket_head = NULL;
118 struct iwpm_mapping_info *map_info; 118 struct iwpm_mapping_info *map_info;
119 unsigned long flags; 119 unsigned long flags;
120 int ret = -EINVAL; 120 int ret = -EINVAL;
@@ -142,6 +142,9 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,
142 } 142 }
143 } 143 }
144 spin_unlock_irqrestore(&iwpm_mapinfo_lock, flags); 144 spin_unlock_irqrestore(&iwpm_mapinfo_lock, flags);
145
146 if (!hash_bucket_head)
147 kfree(map_info);
145 return ret; 148 return ret;
146} 149}
147 150
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index c50596f7f98a..b28452a55a08 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -59,7 +59,7 @@ module_param_named(recv_queue_size, mad_recvq_size, int, 0444);
59MODULE_PARM_DESC(recv_queue_size, "Size of receive queue in number of work requests"); 59MODULE_PARM_DESC(recv_queue_size, "Size of receive queue in number of work requests");
60 60
61static struct list_head ib_mad_port_list; 61static struct list_head ib_mad_port_list;
62static u32 ib_mad_client_id = 0; 62static atomic_t ib_mad_client_id = ATOMIC_INIT(0);
63 63
64/* Port list lock */ 64/* Port list lock */
65static DEFINE_SPINLOCK(ib_mad_port_list_lock); 65static DEFINE_SPINLOCK(ib_mad_port_list_lock);
@@ -377,7 +377,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
377 } 377 }
378 378
379 spin_lock_irqsave(&port_priv->reg_lock, flags); 379 spin_lock_irqsave(&port_priv->reg_lock, flags);
380 mad_agent_priv->agent.hi_tid = ++ib_mad_client_id; 380 mad_agent_priv->agent.hi_tid = atomic_inc_return(&ib_mad_client_id);
381 381
382 /* 382 /*
383 * Make sure MAD registration (if supplied) 383 * Make sure MAD registration (if supplied)
diff --git a/drivers/infiniband/core/roce_gid_mgmt.c b/drivers/infiniband/core/roce_gid_mgmt.c
index cc2966380c0c..c0e4fd55e2cc 100644
--- a/drivers/infiniband/core/roce_gid_mgmt.c
+++ b/drivers/infiniband/core/roce_gid_mgmt.c
@@ -255,6 +255,7 @@ static void bond_delete_netdev_default_gids(struct ib_device *ib_dev,
255 struct net_device *rdma_ndev) 255 struct net_device *rdma_ndev)
256{ 256{
257 struct net_device *real_dev = rdma_vlan_dev_real_dev(event_ndev); 257 struct net_device *real_dev = rdma_vlan_dev_real_dev(event_ndev);
258 unsigned long gid_type_mask;
258 259
259 if (!rdma_ndev) 260 if (!rdma_ndev)
260 return; 261 return;
@@ -264,21 +265,22 @@ static void bond_delete_netdev_default_gids(struct ib_device *ib_dev,
264 265
265 rcu_read_lock(); 266 rcu_read_lock();
266 267
267 if (rdma_is_upper_dev_rcu(rdma_ndev, event_ndev) && 268 if (((rdma_ndev != event_ndev &&
268 is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev) == 269 !rdma_is_upper_dev_rcu(rdma_ndev, event_ndev)) ||
269 BONDING_SLAVE_STATE_INACTIVE) { 270 is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev)
270 unsigned long gid_type_mask; 271 ==
271 272 BONDING_SLAVE_STATE_INACTIVE)) {
272 rcu_read_unlock(); 273 rcu_read_unlock();
274 return;
275 }
273 276
274 gid_type_mask = roce_gid_type_mask_support(ib_dev, port); 277 rcu_read_unlock();
275 278
276 ib_cache_gid_set_default_gid(ib_dev, port, rdma_ndev, 279 gid_type_mask = roce_gid_type_mask_support(ib_dev, port);
277 gid_type_mask, 280
278 IB_CACHE_GID_DEFAULT_MODE_DELETE); 281 ib_cache_gid_set_default_gid(ib_dev, port, rdma_ndev,
279 } else { 282 gid_type_mask,
280 rcu_read_unlock(); 283 IB_CACHE_GID_DEFAULT_MODE_DELETE);
281 }
282} 284}
283 285
284static void enum_netdev_ipv4_ips(struct ib_device *ib_dev, 286static void enum_netdev_ipv4_ips(struct ib_device *ib_dev,
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index 74329483af6d..eab43b17e9cf 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -159,6 +159,23 @@ static void ucma_put_ctx(struct ucma_context *ctx)
159 complete(&ctx->comp); 159 complete(&ctx->comp);
160} 160}
161 161
162/*
163 * Same as ucm_get_ctx but requires that ->cm_id->device is valid, eg that the
164 * CM_ID is bound.
165 */
166static struct ucma_context *ucma_get_ctx_dev(struct ucma_file *file, int id)
167{
168 struct ucma_context *ctx = ucma_get_ctx(file, id);
169
170 if (IS_ERR(ctx))
171 return ctx;
172 if (!ctx->cm_id->device) {
173 ucma_put_ctx(ctx);
174 return ERR_PTR(-EINVAL);
175 }
176 return ctx;
177}
178
162static void ucma_close_event_id(struct work_struct *work) 179static void ucma_close_event_id(struct work_struct *work)
163{ 180{
164 struct ucma_event *uevent_close = container_of(work, struct ucma_event, close_work); 181 struct ucma_event *uevent_close = container_of(work, struct ucma_event, close_work);
@@ -683,7 +700,7 @@ static ssize_t ucma_resolve_ip(struct ucma_file *file,
683 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 700 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
684 return -EFAULT; 701 return -EFAULT;
685 702
686 if (!rdma_addr_size_in6(&cmd.src_addr) || 703 if ((cmd.src_addr.sin6_family && !rdma_addr_size_in6(&cmd.src_addr)) ||
687 !rdma_addr_size_in6(&cmd.dst_addr)) 704 !rdma_addr_size_in6(&cmd.dst_addr))
688 return -EINVAL; 705 return -EINVAL;
689 706
@@ -734,7 +751,7 @@ static ssize_t ucma_resolve_route(struct ucma_file *file,
734 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 751 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
735 return -EFAULT; 752 return -EFAULT;
736 753
737 ctx = ucma_get_ctx(file, cmd.id); 754 ctx = ucma_get_ctx_dev(file, cmd.id);
738 if (IS_ERR(ctx)) 755 if (IS_ERR(ctx))
739 return PTR_ERR(ctx); 756 return PTR_ERR(ctx);
740 757
@@ -1050,7 +1067,7 @@ static ssize_t ucma_connect(struct ucma_file *file, const char __user *inbuf,
1050 if (!cmd.conn_param.valid) 1067 if (!cmd.conn_param.valid)
1051 return -EINVAL; 1068 return -EINVAL;
1052 1069
1053 ctx = ucma_get_ctx(file, cmd.id); 1070 ctx = ucma_get_ctx_dev(file, cmd.id);
1054 if (IS_ERR(ctx)) 1071 if (IS_ERR(ctx))
1055 return PTR_ERR(ctx); 1072 return PTR_ERR(ctx);
1056 1073
@@ -1092,7 +1109,7 @@ static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf,
1092 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 1109 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1093 return -EFAULT; 1110 return -EFAULT;
1094 1111
1095 ctx = ucma_get_ctx(file, cmd.id); 1112 ctx = ucma_get_ctx_dev(file, cmd.id);
1096 if (IS_ERR(ctx)) 1113 if (IS_ERR(ctx))
1097 return PTR_ERR(ctx); 1114 return PTR_ERR(ctx);
1098 1115
@@ -1120,7 +1137,7 @@ static ssize_t ucma_reject(struct ucma_file *file, const char __user *inbuf,
1120 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 1137 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1121 return -EFAULT; 1138 return -EFAULT;
1122 1139
1123 ctx = ucma_get_ctx(file, cmd.id); 1140 ctx = ucma_get_ctx_dev(file, cmd.id);
1124 if (IS_ERR(ctx)) 1141 if (IS_ERR(ctx))
1125 return PTR_ERR(ctx); 1142 return PTR_ERR(ctx);
1126 1143
@@ -1139,7 +1156,7 @@ static ssize_t ucma_disconnect(struct ucma_file *file, const char __user *inbuf,
1139 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 1156 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1140 return -EFAULT; 1157 return -EFAULT;
1141 1158
1142 ctx = ucma_get_ctx(file, cmd.id); 1159 ctx = ucma_get_ctx_dev(file, cmd.id);
1143 if (IS_ERR(ctx)) 1160 if (IS_ERR(ctx))
1144 return PTR_ERR(ctx); 1161 return PTR_ERR(ctx);
1145 1162
@@ -1167,15 +1184,10 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,
1167 if (cmd.qp_state > IB_QPS_ERR) 1184 if (cmd.qp_state > IB_QPS_ERR)
1168 return -EINVAL; 1185 return -EINVAL;
1169 1186
1170 ctx = ucma_get_ctx(file, cmd.id); 1187 ctx = ucma_get_ctx_dev(file, cmd.id);
1171 if (IS_ERR(ctx)) 1188 if (IS_ERR(ctx))
1172 return PTR_ERR(ctx); 1189 return PTR_ERR(ctx);
1173 1190
1174 if (!ctx->cm_id->device) {
1175 ret = -EINVAL;
1176 goto out;
1177 }
1178
1179 resp.qp_attr_mask = 0; 1191 resp.qp_attr_mask = 0;
1180 memset(&qp_attr, 0, sizeof qp_attr); 1192 memset(&qp_attr, 0, sizeof qp_attr);
1181 qp_attr.qp_state = cmd.qp_state; 1193 qp_attr.qp_state = cmd.qp_state;
@@ -1316,13 +1328,13 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf,
1316 if (copy_from_user(&cmd, inbuf, sizeof(cmd))) 1328 if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
1317 return -EFAULT; 1329 return -EFAULT;
1318 1330
1331 if (unlikely(cmd.optlen > KMALLOC_MAX_SIZE))
1332 return -EINVAL;
1333
1319 ctx = ucma_get_ctx(file, cmd.id); 1334 ctx = ucma_get_ctx(file, cmd.id);
1320 if (IS_ERR(ctx)) 1335 if (IS_ERR(ctx))
1321 return PTR_ERR(ctx); 1336 return PTR_ERR(ctx);
1322 1337
1323 if (unlikely(cmd.optlen > KMALLOC_MAX_SIZE))
1324 return -EINVAL;
1325
1326 optval = memdup_user(u64_to_user_ptr(cmd.optval), 1338 optval = memdup_user(u64_to_user_ptr(cmd.optval),
1327 cmd.optlen); 1339 cmd.optlen);
1328 if (IS_ERR(optval)) { 1340 if (IS_ERR(optval)) {
@@ -1384,7 +1396,7 @@ static ssize_t ucma_process_join(struct ucma_file *file,
1384 else 1396 else
1385 return -EINVAL; 1397 return -EINVAL;
1386 1398
1387 ctx = ucma_get_ctx(file, cmd->id); 1399 ctx = ucma_get_ctx_dev(file, cmd->id);
1388 if (IS_ERR(ctx)) 1400 if (IS_ERR(ctx))
1389 return PTR_ERR(ctx); 1401 return PTR_ERR(ctx);
1390 1402
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 13cb5e4deb86..21a887c9523b 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -691,6 +691,7 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
691 691
692 mr->device = pd->device; 692 mr->device = pd->device;
693 mr->pd = pd; 693 mr->pd = pd;
694 mr->dm = NULL;
694 mr->uobject = uobj; 695 mr->uobject = uobj;
695 atomic_inc(&pd->usecnt); 696 atomic_inc(&pd->usecnt);
696 mr->res.type = RDMA_RESTRACK_MR; 697 mr->res.type = RDMA_RESTRACK_MR;
@@ -765,6 +766,11 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file,
765 766
766 mr = uobj->object; 767 mr = uobj->object;
767 768
769 if (mr->dm) {
770 ret = -EINVAL;
771 goto put_uobjs;
772 }
773
768 if (cmd.flags & IB_MR_REREG_ACCESS) { 774 if (cmd.flags & IB_MR_REREG_ACCESS) {
769 ret = ib_check_mr_access(cmd.access_flags); 775 ret = ib_check_mr_access(cmd.access_flags);
770 if (ret) 776 if (ret)
diff --git a/drivers/infiniband/core/uverbs_ioctl.c b/drivers/infiniband/core/uverbs_ioctl.c
index 8c93970dc8f1..8d32c4ae368c 100644
--- a/drivers/infiniband/core/uverbs_ioctl.c
+++ b/drivers/infiniband/core/uverbs_ioctl.c
@@ -234,6 +234,15 @@ static int uverbs_validate_kernel_mandatory(const struct uverbs_method_spec *met
234 return -EINVAL; 234 return -EINVAL;
235 } 235 }
236 236
237 for (; i < method_spec->num_buckets; i++) {
238 struct uverbs_attr_spec_hash *attr_spec_bucket =
239 method_spec->attr_buckets[i];
240
241 if (!bitmap_empty(attr_spec_bucket->mandatory_attrs_bitmask,
242 attr_spec_bucket->num_attrs))
243 return -EINVAL;
244 }
245
237 return 0; 246 return 0;
238} 247}
239 248
diff --git a/drivers/infiniband/core/uverbs_std_types_flow_action.c b/drivers/infiniband/core/uverbs_std_types_flow_action.c
index cbcec3da12f6..b4f016dfa23d 100644
--- a/drivers/infiniband/core/uverbs_std_types_flow_action.c
+++ b/drivers/infiniband/core/uverbs_std_types_flow_action.c
@@ -363,28 +363,28 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY)(struct ib_device
363 363
364static const struct uverbs_attr_spec uverbs_flow_action_esp_keymat[] = { 364static const struct uverbs_attr_spec uverbs_flow_action_esp_keymat[] = {
365 [IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM] = { 365 [IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM] = {
366 .ptr = { 366 { .ptr = {
367 .type = UVERBS_ATTR_TYPE_PTR_IN, 367 .type = UVERBS_ATTR_TYPE_PTR_IN,
368 UVERBS_ATTR_TYPE(struct ib_uverbs_flow_action_esp_keymat_aes_gcm), 368 UVERBS_ATTR_TYPE(struct ib_uverbs_flow_action_esp_keymat_aes_gcm),
369 .flags = UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO, 369 .flags = UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO,
370 }, 370 } },
371 }, 371 },
372}; 372};
373 373
374static const struct uverbs_attr_spec uverbs_flow_action_esp_replay[] = { 374static const struct uverbs_attr_spec uverbs_flow_action_esp_replay[] = {
375 [IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE] = { 375 [IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE] = {
376 .ptr = { 376 { .ptr = {
377 .type = UVERBS_ATTR_TYPE_PTR_IN, 377 .type = UVERBS_ATTR_TYPE_PTR_IN,
378 /* No need to specify any data */ 378 /* No need to specify any data */
379 .len = 0, 379 .len = 0,
380 } 380 } }
381 }, 381 },
382 [IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP] = { 382 [IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP] = {
383 .ptr = { 383 { .ptr = {
384 .type = UVERBS_ATTR_TYPE_PTR_IN, 384 .type = UVERBS_ATTR_TYPE_PTR_IN,
385 UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp_replay_bmp, size), 385 UVERBS_ATTR_STRUCT(struct ib_uverbs_flow_action_esp_replay_bmp, size),
386 .flags = UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO, 386 .flags = UVERBS_ATTR_SPEC_F_MIN_SZ_OR_ZERO,
387 } 387 } }
388 }, 388 },
389}; 389};
390 390
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 7eff3aeffe01..6ddfb1fade79 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1656,6 +1656,7 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
1656 if (!IS_ERR(mr)) { 1656 if (!IS_ERR(mr)) {
1657 mr->device = pd->device; 1657 mr->device = pd->device;
1658 mr->pd = pd; 1658 mr->pd = pd;
1659 mr->dm = NULL;
1659 mr->uobject = NULL; 1660 mr->uobject = NULL;
1660 atomic_inc(&pd->usecnt); 1661 atomic_inc(&pd->usecnt);
1661 mr->need_inval = false; 1662 mr->need_inval = false;
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index 6f2b26126c64..2be2e1ac1b5f 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -315,7 +315,7 @@ static void advance_oldest_read(struct t4_wq *wq)
315 * Deal with out-of-order and/or completions that complete 315 * Deal with out-of-order and/or completions that complete
316 * prior unsignalled WRs. 316 * prior unsignalled WRs.
317 */ 317 */
318void c4iw_flush_hw_cq(struct c4iw_cq *chp) 318void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp)
319{ 319{
320 struct t4_cqe *hw_cqe, *swcqe, read_cqe; 320 struct t4_cqe *hw_cqe, *swcqe, read_cqe;
321 struct c4iw_qp *qhp; 321 struct c4iw_qp *qhp;
@@ -339,6 +339,13 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)
339 if (qhp == NULL) 339 if (qhp == NULL)
340 goto next_cqe; 340 goto next_cqe;
341 341
342 if (flush_qhp != qhp) {
343 spin_lock(&qhp->lock);
344
345 if (qhp->wq.flushed == 1)
346 goto next_cqe;
347 }
348
342 if (CQE_OPCODE(hw_cqe) == FW_RI_TERMINATE) 349 if (CQE_OPCODE(hw_cqe) == FW_RI_TERMINATE)
343 goto next_cqe; 350 goto next_cqe;
344 351
@@ -390,6 +397,8 @@ void c4iw_flush_hw_cq(struct c4iw_cq *chp)
390next_cqe: 397next_cqe:
391 t4_hwcq_consume(&chp->cq); 398 t4_hwcq_consume(&chp->cq);
392 ret = t4_next_hw_cqe(&chp->cq, &hw_cqe); 399 ret = t4_next_hw_cqe(&chp->cq, &hw_cqe);
400 if (qhp && flush_qhp != qhp)
401 spin_unlock(&qhp->lock);
393 } 402 }
394} 403}
395 404
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index feeb8ee6f4a2..44161ca4d2a8 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -875,6 +875,11 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
875 875
876 rdev->status_page->db_off = 0; 876 rdev->status_page->db_off = 0;
877 877
878 init_completion(&rdev->rqt_compl);
879 init_completion(&rdev->pbl_compl);
880 kref_init(&rdev->rqt_kref);
881 kref_init(&rdev->pbl_kref);
882
878 return 0; 883 return 0;
879err_free_status_page_and_wr_log: 884err_free_status_page_and_wr_log:
880 if (c4iw_wr_log && rdev->wr_log) 885 if (c4iw_wr_log && rdev->wr_log)
@@ -893,13 +898,15 @@ destroy_resource:
893 898
894static void c4iw_rdev_close(struct c4iw_rdev *rdev) 899static void c4iw_rdev_close(struct c4iw_rdev *rdev)
895{ 900{
896 destroy_workqueue(rdev->free_workq);
897 kfree(rdev->wr_log); 901 kfree(rdev->wr_log);
898 c4iw_release_dev_ucontext(rdev, &rdev->uctx); 902 c4iw_release_dev_ucontext(rdev, &rdev->uctx);
899 free_page((unsigned long)rdev->status_page); 903 free_page((unsigned long)rdev->status_page);
900 c4iw_pblpool_destroy(rdev); 904 c4iw_pblpool_destroy(rdev);
901 c4iw_rqtpool_destroy(rdev); 905 c4iw_rqtpool_destroy(rdev);
906 wait_for_completion(&rdev->pbl_compl);
907 wait_for_completion(&rdev->rqt_compl);
902 c4iw_ocqp_pool_destroy(rdev); 908 c4iw_ocqp_pool_destroy(rdev);
909 destroy_workqueue(rdev->free_workq);
903 c4iw_destroy_resource(&rdev->resource); 910 c4iw_destroy_resource(&rdev->resource);
904} 911}
905 912
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index cc929002c05e..831027717121 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -185,6 +185,10 @@ struct c4iw_rdev {
185 struct wr_log_entry *wr_log; 185 struct wr_log_entry *wr_log;
186 int wr_log_size; 186 int wr_log_size;
187 struct workqueue_struct *free_workq; 187 struct workqueue_struct *free_workq;
188 struct completion rqt_compl;
189 struct completion pbl_compl;
190 struct kref rqt_kref;
191 struct kref pbl_kref;
188}; 192};
189 193
190static inline int c4iw_fatal_error(struct c4iw_rdev *rdev) 194static inline int c4iw_fatal_error(struct c4iw_rdev *rdev)
@@ -1049,7 +1053,7 @@ u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size);
1049void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size); 1053void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size);
1050u32 c4iw_ocqp_pool_alloc(struct c4iw_rdev *rdev, int size); 1054u32 c4iw_ocqp_pool_alloc(struct c4iw_rdev *rdev, int size);
1051void c4iw_ocqp_pool_free(struct c4iw_rdev *rdev, u32 addr, int size); 1055void c4iw_ocqp_pool_free(struct c4iw_rdev *rdev, u32 addr, int size);
1052void c4iw_flush_hw_cq(struct c4iw_cq *chp); 1056void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp);
1053void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count); 1057void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count);
1054int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp); 1058int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp);
1055int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count); 1059int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count);
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index de77b6027d69..ae167b686608 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1343,12 +1343,12 @@ static void __flush_qp(struct c4iw_qp *qhp, struct c4iw_cq *rchp,
1343 qhp->wq.flushed = 1; 1343 qhp->wq.flushed = 1;
1344 t4_set_wq_in_error(&qhp->wq); 1344 t4_set_wq_in_error(&qhp->wq);
1345 1345
1346 c4iw_flush_hw_cq(rchp); 1346 c4iw_flush_hw_cq(rchp, qhp);
1347 c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count); 1347 c4iw_count_rcqes(&rchp->cq, &qhp->wq, &count);
1348 rq_flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count); 1348 rq_flushed = c4iw_flush_rq(&qhp->wq, &rchp->cq, count);
1349 1349
1350 if (schp != rchp) 1350 if (schp != rchp)
1351 c4iw_flush_hw_cq(schp); 1351 c4iw_flush_hw_cq(schp, qhp);
1352 sq_flushed = c4iw_flush_sq(qhp); 1352 sq_flushed = c4iw_flush_sq(qhp);
1353 1353
1354 spin_unlock(&qhp->lock); 1354 spin_unlock(&qhp->lock);
diff --git a/drivers/infiniband/hw/cxgb4/resource.c b/drivers/infiniband/hw/cxgb4/resource.c
index 3cf25997ed2b..0ef25ae05e6f 100644
--- a/drivers/infiniband/hw/cxgb4/resource.c
+++ b/drivers/infiniband/hw/cxgb4/resource.c
@@ -260,12 +260,22 @@ u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size)
260 rdev->stats.pbl.cur += roundup(size, 1 << MIN_PBL_SHIFT); 260 rdev->stats.pbl.cur += roundup(size, 1 << MIN_PBL_SHIFT);
261 if (rdev->stats.pbl.cur > rdev->stats.pbl.max) 261 if (rdev->stats.pbl.cur > rdev->stats.pbl.max)
262 rdev->stats.pbl.max = rdev->stats.pbl.cur; 262 rdev->stats.pbl.max = rdev->stats.pbl.cur;
263 kref_get(&rdev->pbl_kref);
263 } else 264 } else
264 rdev->stats.pbl.fail++; 265 rdev->stats.pbl.fail++;
265 mutex_unlock(&rdev->stats.lock); 266 mutex_unlock(&rdev->stats.lock);
266 return (u32)addr; 267 return (u32)addr;
267} 268}
268 269
270static void destroy_pblpool(struct kref *kref)
271{
272 struct c4iw_rdev *rdev;
273
274 rdev = container_of(kref, struct c4iw_rdev, pbl_kref);
275 gen_pool_destroy(rdev->pbl_pool);
276 complete(&rdev->pbl_compl);
277}
278
269void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size) 279void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
270{ 280{
271 pr_debug("addr 0x%x size %d\n", addr, size); 281 pr_debug("addr 0x%x size %d\n", addr, size);
@@ -273,6 +283,7 @@ void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
273 rdev->stats.pbl.cur -= roundup(size, 1 << MIN_PBL_SHIFT); 283 rdev->stats.pbl.cur -= roundup(size, 1 << MIN_PBL_SHIFT);
274 mutex_unlock(&rdev->stats.lock); 284 mutex_unlock(&rdev->stats.lock);
275 gen_pool_free(rdev->pbl_pool, (unsigned long)addr, size); 285 gen_pool_free(rdev->pbl_pool, (unsigned long)addr, size);
286 kref_put(&rdev->pbl_kref, destroy_pblpool);
276} 287}
277 288
278int c4iw_pblpool_create(struct c4iw_rdev *rdev) 289int c4iw_pblpool_create(struct c4iw_rdev *rdev)
@@ -310,7 +321,7 @@ int c4iw_pblpool_create(struct c4iw_rdev *rdev)
310 321
311void c4iw_pblpool_destroy(struct c4iw_rdev *rdev) 322void c4iw_pblpool_destroy(struct c4iw_rdev *rdev)
312{ 323{
313 gen_pool_destroy(rdev->pbl_pool); 324 kref_put(&rdev->pbl_kref, destroy_pblpool);
314} 325}
315 326
316/* 327/*
@@ -331,12 +342,22 @@ u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size)
331 rdev->stats.rqt.cur += roundup(size << 6, 1 << MIN_RQT_SHIFT); 342 rdev->stats.rqt.cur += roundup(size << 6, 1 << MIN_RQT_SHIFT);
332 if (rdev->stats.rqt.cur > rdev->stats.rqt.max) 343 if (rdev->stats.rqt.cur > rdev->stats.rqt.max)
333 rdev->stats.rqt.max = rdev->stats.rqt.cur; 344 rdev->stats.rqt.max = rdev->stats.rqt.cur;
345 kref_get(&rdev->rqt_kref);
334 } else 346 } else
335 rdev->stats.rqt.fail++; 347 rdev->stats.rqt.fail++;
336 mutex_unlock(&rdev->stats.lock); 348 mutex_unlock(&rdev->stats.lock);
337 return (u32)addr; 349 return (u32)addr;
338} 350}
339 351
352static void destroy_rqtpool(struct kref *kref)
353{
354 struct c4iw_rdev *rdev;
355
356 rdev = container_of(kref, struct c4iw_rdev, rqt_kref);
357 gen_pool_destroy(rdev->rqt_pool);
358 complete(&rdev->rqt_compl);
359}
360
340void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size) 361void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
341{ 362{
342 pr_debug("addr 0x%x size %d\n", addr, size << 6); 363 pr_debug("addr 0x%x size %d\n", addr, size << 6);
@@ -344,6 +365,7 @@ void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size)
344 rdev->stats.rqt.cur -= roundup(size << 6, 1 << MIN_RQT_SHIFT); 365 rdev->stats.rqt.cur -= roundup(size << 6, 1 << MIN_RQT_SHIFT);
345 mutex_unlock(&rdev->stats.lock); 366 mutex_unlock(&rdev->stats.lock);
346 gen_pool_free(rdev->rqt_pool, (unsigned long)addr, size << 6); 367 gen_pool_free(rdev->rqt_pool, (unsigned long)addr, size << 6);
368 kref_put(&rdev->rqt_kref, destroy_rqtpool);
347} 369}
348 370
349int c4iw_rqtpool_create(struct c4iw_rdev *rdev) 371int c4iw_rqtpool_create(struct c4iw_rdev *rdev)
@@ -380,7 +402,7 @@ int c4iw_rqtpool_create(struct c4iw_rdev *rdev)
380 402
381void c4iw_rqtpool_destroy(struct c4iw_rdev *rdev) 403void c4iw_rqtpool_destroy(struct c4iw_rdev *rdev)
382{ 404{
383 gen_pool_destroy(rdev->rqt_pool); 405 kref_put(&rdev->rqt_kref, destroy_rqtpool);
384} 406}
385 407
386/* 408/*
diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
index a97055dd4fbd..b5fab55cc275 100644
--- a/drivers/infiniband/hw/hfi1/affinity.c
+++ b/drivers/infiniband/hw/hfi1/affinity.c
@@ -412,7 +412,6 @@ static void hfi1_cleanup_sdma_notifier(struct hfi1_msix_entry *msix)
412static int get_irq_affinity(struct hfi1_devdata *dd, 412static int get_irq_affinity(struct hfi1_devdata *dd,
413 struct hfi1_msix_entry *msix) 413 struct hfi1_msix_entry *msix)
414{ 414{
415 int ret;
416 cpumask_var_t diff; 415 cpumask_var_t diff;
417 struct hfi1_affinity_node *entry; 416 struct hfi1_affinity_node *entry;
418 struct cpu_mask_set *set = NULL; 417 struct cpu_mask_set *set = NULL;
@@ -424,10 +423,6 @@ static int get_irq_affinity(struct hfi1_devdata *dd,
424 extra[0] = '\0'; 423 extra[0] = '\0';
425 cpumask_clear(&msix->mask); 424 cpumask_clear(&msix->mask);
426 425
427 ret = zalloc_cpumask_var(&diff, GFP_KERNEL);
428 if (!ret)
429 return -ENOMEM;
430
431 entry = node_affinity_lookup(dd->node); 426 entry = node_affinity_lookup(dd->node);
432 427
433 switch (msix->type) { 428 switch (msix->type) {
@@ -458,6 +453,9 @@ static int get_irq_affinity(struct hfi1_devdata *dd,
458 * finds its CPU here. 453 * finds its CPU here.
459 */ 454 */
460 if (cpu == -1 && set) { 455 if (cpu == -1 && set) {
456 if (!zalloc_cpumask_var(&diff, GFP_KERNEL))
457 return -ENOMEM;
458
461 if (cpumask_equal(&set->mask, &set->used)) { 459 if (cpumask_equal(&set->mask, &set->used)) {
462 /* 460 /*
463 * We've used up all the CPUs, bump up the generation 461 * We've used up all the CPUs, bump up the generation
@@ -469,6 +467,8 @@ static int get_irq_affinity(struct hfi1_devdata *dd,
469 cpumask_andnot(diff, &set->mask, &set->used); 467 cpumask_andnot(diff, &set->mask, &set->used);
470 cpu = cpumask_first(diff); 468 cpu = cpumask_first(diff);
471 cpumask_set_cpu(cpu, &set->used); 469 cpumask_set_cpu(cpu, &set->used);
470
471 free_cpumask_var(diff);
472 } 472 }
473 473
474 cpumask_set_cpu(cpu, &msix->mask); 474 cpumask_set_cpu(cpu, &msix->mask);
@@ -482,7 +482,6 @@ static int get_irq_affinity(struct hfi1_devdata *dd,
482 hfi1_setup_sdma_notifier(msix); 482 hfi1_setup_sdma_notifier(msix);
483 } 483 }
484 484
485 free_cpumask_var(diff);
486 return 0; 485 return 0;
487} 486}
488 487
diff --git a/drivers/infiniband/hw/hfi1/driver.c b/drivers/infiniband/hw/hfi1/driver.c
index 46d1475b2154..bd837a048bf4 100644
--- a/drivers/infiniband/hw/hfi1/driver.c
+++ b/drivers/infiniband/hw/hfi1/driver.c
@@ -433,31 +433,43 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
433 bool do_cnp) 433 bool do_cnp)
434{ 434{
435 struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num); 435 struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
436 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
436 struct ib_other_headers *ohdr = pkt->ohdr; 437 struct ib_other_headers *ohdr = pkt->ohdr;
437 struct ib_grh *grh = pkt->grh; 438 struct ib_grh *grh = pkt->grh;
438 u32 rqpn = 0, bth1; 439 u32 rqpn = 0, bth1;
439 u16 pkey, rlid, dlid = ib_get_dlid(pkt->hdr); 440 u16 pkey;
441 u32 rlid, slid, dlid = 0;
440 u8 hdr_type, sc, svc_type; 442 u8 hdr_type, sc, svc_type;
441 bool is_mcast = false; 443 bool is_mcast = false;
442 444
445 /* can be called from prescan */
443 if (pkt->etype == RHF_RCV_TYPE_BYPASS) { 446 if (pkt->etype == RHF_RCV_TYPE_BYPASS) {
444 is_mcast = hfi1_is_16B_mcast(dlid); 447 is_mcast = hfi1_is_16B_mcast(dlid);
445 pkey = hfi1_16B_get_pkey(pkt->hdr); 448 pkey = hfi1_16B_get_pkey(pkt->hdr);
446 sc = hfi1_16B_get_sc(pkt->hdr); 449 sc = hfi1_16B_get_sc(pkt->hdr);
450 dlid = hfi1_16B_get_dlid(pkt->hdr);
451 slid = hfi1_16B_get_slid(pkt->hdr);
447 hdr_type = HFI1_PKT_TYPE_16B; 452 hdr_type = HFI1_PKT_TYPE_16B;
448 } else { 453 } else {
449 is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) && 454 is_mcast = (dlid > be16_to_cpu(IB_MULTICAST_LID_BASE)) &&
450 (dlid != be16_to_cpu(IB_LID_PERMISSIVE)); 455 (dlid != be16_to_cpu(IB_LID_PERMISSIVE));
451 pkey = ib_bth_get_pkey(ohdr); 456 pkey = ib_bth_get_pkey(ohdr);
452 sc = hfi1_9B_get_sc5(pkt->hdr, pkt->rhf); 457 sc = hfi1_9B_get_sc5(pkt->hdr, pkt->rhf);
458 dlid = ib_get_dlid(pkt->hdr);
459 slid = ib_get_slid(pkt->hdr);
453 hdr_type = HFI1_PKT_TYPE_9B; 460 hdr_type = HFI1_PKT_TYPE_9B;
454 } 461 }
455 462
456 switch (qp->ibqp.qp_type) { 463 switch (qp->ibqp.qp_type) {
464 case IB_QPT_UD:
465 dlid = ppd->lid;
466 rlid = slid;
467 rqpn = ib_get_sqpn(pkt->ohdr);
468 svc_type = IB_CC_SVCTYPE_UD;
469 break;
457 case IB_QPT_SMI: 470 case IB_QPT_SMI:
458 case IB_QPT_GSI: 471 case IB_QPT_GSI:
459 case IB_QPT_UD: 472 rlid = slid;
460 rlid = ib_get_slid(pkt->hdr);
461 rqpn = ib_get_sqpn(pkt->ohdr); 473 rqpn = ib_get_sqpn(pkt->ohdr);
462 svc_type = IB_CC_SVCTYPE_UD; 474 svc_type = IB_CC_SVCTYPE_UD;
463 break; 475 break;
@@ -482,7 +494,6 @@ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
482 dlid, rlid, sc, grh); 494 dlid, rlid, sc, grh);
483 495
484 if (!is_mcast && (bth1 & IB_BECN_SMASK)) { 496 if (!is_mcast && (bth1 & IB_BECN_SMASK)) {
485 struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
486 u32 lqpn = bth1 & RVT_QPN_MASK; 497 u32 lqpn = bth1 & RVT_QPN_MASK;
487 u8 sl = ibp->sc_to_sl[sc]; 498 u8 sl = ibp->sc_to_sl[sc];
488 499
diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h
index 32c48265405e..cac2c62bc42d 100644
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
@@ -1537,13 +1537,13 @@ void set_link_ipg(struct hfi1_pportdata *ppd);
1537void process_becn(struct hfi1_pportdata *ppd, u8 sl, u32 rlid, u32 lqpn, 1537void process_becn(struct hfi1_pportdata *ppd, u8 sl, u32 rlid, u32 lqpn,
1538 u32 rqpn, u8 svc_type); 1538 u32 rqpn, u8 svc_type);
1539void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, 1539void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,
1540 u32 pkey, u32 slid, u32 dlid, u8 sc5, 1540 u16 pkey, u32 slid, u32 dlid, u8 sc5,
1541 const struct ib_grh *old_grh); 1541 const struct ib_grh *old_grh);
1542void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, 1542void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,
1543 u32 remote_qpn, u32 pkey, u32 slid, u32 dlid, 1543 u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
1544 u8 sc5, const struct ib_grh *old_grh); 1544 u8 sc5, const struct ib_grh *old_grh);
1545typedef void (*hfi1_handle_cnp)(struct hfi1_ibport *ibp, struct rvt_qp *qp, 1545typedef void (*hfi1_handle_cnp)(struct hfi1_ibport *ibp, struct rvt_qp *qp,
1546 u32 remote_qpn, u32 pkey, u32 slid, u32 dlid, 1546 u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
1547 u8 sc5, const struct ib_grh *old_grh); 1547 u8 sc5, const struct ib_grh *old_grh);
1548 1548
1549#define PKEY_CHECK_INVALID -1 1549#define PKEY_CHECK_INVALID -1
@@ -2437,7 +2437,7 @@ static inline void hfi1_make_16b_hdr(struct hfi1_16b_header *hdr,
2437 ((slid >> OPA_16B_SLID_SHIFT) << OPA_16B_SLID_HIGH_SHIFT); 2437 ((slid >> OPA_16B_SLID_SHIFT) << OPA_16B_SLID_HIGH_SHIFT);
2438 lrh2 = (lrh2 & ~OPA_16B_DLID_MASK) | 2438 lrh2 = (lrh2 & ~OPA_16B_DLID_MASK) |
2439 ((dlid >> OPA_16B_DLID_SHIFT) << OPA_16B_DLID_HIGH_SHIFT); 2439 ((dlid >> OPA_16B_DLID_SHIFT) << OPA_16B_DLID_HIGH_SHIFT);
2440 lrh2 = (lrh2 & ~OPA_16B_PKEY_MASK) | (pkey << OPA_16B_PKEY_SHIFT); 2440 lrh2 = (lrh2 & ~OPA_16B_PKEY_MASK) | ((u32)pkey << OPA_16B_PKEY_SHIFT);
2441 lrh2 = (lrh2 & ~OPA_16B_L4_MASK) | l4; 2441 lrh2 = (lrh2 & ~OPA_16B_L4_MASK) | l4;
2442 2442
2443 hdr->lrh[0] = lrh0; 2443 hdr->lrh[0] = lrh0;
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index 33eba2356742..6309edf811df 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -88,9 +88,9 @@
88 * pio buffers per ctxt, etc.) Zero means use one user context per CPU. 88 * pio buffers per ctxt, etc.) Zero means use one user context per CPU.
89 */ 89 */
90int num_user_contexts = -1; 90int num_user_contexts = -1;
91module_param_named(num_user_contexts, num_user_contexts, uint, S_IRUGO); 91module_param_named(num_user_contexts, num_user_contexts, int, 0444);
92MODULE_PARM_DESC( 92MODULE_PARM_DESC(
93 num_user_contexts, "Set max number of user contexts to use"); 93 num_user_contexts, "Set max number of user contexts to use (default: -1 will use the real (non-HT) CPU count)");
94 94
95uint krcvqs[RXE_NUM_DATA_VL]; 95uint krcvqs[RXE_NUM_DATA_VL];
96int krcvqsset; 96int krcvqsset;
@@ -1209,30 +1209,49 @@ static void finalize_asic_data(struct hfi1_devdata *dd,
1209 kfree(ad); 1209 kfree(ad);
1210} 1210}
1211 1211
1212static void __hfi1_free_devdata(struct kobject *kobj) 1212/**
1213 * hfi1_clean_devdata - cleans up per-unit data structure
1214 * @dd: pointer to a valid devdata structure
1215 *
1216 * It cleans up all data structures set up by
1217 * by hfi1_alloc_devdata().
1218 */
1219static void hfi1_clean_devdata(struct hfi1_devdata *dd)
1213{ 1220{
1214 struct hfi1_devdata *dd =
1215 container_of(kobj, struct hfi1_devdata, kobj);
1216 struct hfi1_asic_data *ad; 1221 struct hfi1_asic_data *ad;
1217 unsigned long flags; 1222 unsigned long flags;
1218 1223
1219 spin_lock_irqsave(&hfi1_devs_lock, flags); 1224 spin_lock_irqsave(&hfi1_devs_lock, flags);
1220 idr_remove(&hfi1_unit_table, dd->unit); 1225 if (!list_empty(&dd->list)) {
1221 list_del(&dd->list); 1226 idr_remove(&hfi1_unit_table, dd->unit);
1227 list_del_init(&dd->list);
1228 }
1222 ad = release_asic_data(dd); 1229 ad = release_asic_data(dd);
1223 spin_unlock_irqrestore(&hfi1_devs_lock, flags); 1230 spin_unlock_irqrestore(&hfi1_devs_lock, flags);
1224 if (ad) 1231
1225 finalize_asic_data(dd, ad); 1232 finalize_asic_data(dd, ad);
1226 free_platform_config(dd); 1233 free_platform_config(dd);
1227 rcu_barrier(); /* wait for rcu callbacks to complete */ 1234 rcu_barrier(); /* wait for rcu callbacks to complete */
1228 free_percpu(dd->int_counter); 1235 free_percpu(dd->int_counter);
1229 free_percpu(dd->rcv_limit); 1236 free_percpu(dd->rcv_limit);
1230 free_percpu(dd->send_schedule); 1237 free_percpu(dd->send_schedule);
1231 free_percpu(dd->tx_opstats); 1238 free_percpu(dd->tx_opstats);
1239 dd->int_counter = NULL;
1240 dd->rcv_limit = NULL;
1241 dd->send_schedule = NULL;
1242 dd->tx_opstats = NULL;
1232 sdma_clean(dd, dd->num_sdma); 1243 sdma_clean(dd, dd->num_sdma);
1233 rvt_dealloc_device(&dd->verbs_dev.rdi); 1244 rvt_dealloc_device(&dd->verbs_dev.rdi);
1234} 1245}
1235 1246
1247static void __hfi1_free_devdata(struct kobject *kobj)
1248{
1249 struct hfi1_devdata *dd =
1250 container_of(kobj, struct hfi1_devdata, kobj);
1251
1252 hfi1_clean_devdata(dd);
1253}
1254
1236static struct kobj_type hfi1_devdata_type = { 1255static struct kobj_type hfi1_devdata_type = {
1237 .release = __hfi1_free_devdata, 1256 .release = __hfi1_free_devdata,
1238}; 1257};
@@ -1265,6 +1284,8 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra)
1265 return ERR_PTR(-ENOMEM); 1284 return ERR_PTR(-ENOMEM);
1266 dd->num_pports = nports; 1285 dd->num_pports = nports;
1267 dd->pport = (struct hfi1_pportdata *)(dd + 1); 1286 dd->pport = (struct hfi1_pportdata *)(dd + 1);
1287 dd->pcidev = pdev;
1288 pci_set_drvdata(pdev, dd);
1268 1289
1269 INIT_LIST_HEAD(&dd->list); 1290 INIT_LIST_HEAD(&dd->list);
1270 idr_preload(GFP_KERNEL); 1291 idr_preload(GFP_KERNEL);
@@ -1331,9 +1352,7 @@ struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra)
1331 return dd; 1352 return dd;
1332 1353
1333bail: 1354bail:
1334 if (!list_empty(&dd->list)) 1355 hfi1_clean_devdata(dd);
1335 list_del_init(&dd->list);
1336 rvt_dealloc_device(&dd->verbs_dev.rdi);
1337 return ERR_PTR(ret); 1356 return ERR_PTR(ret);
1338} 1357}
1339 1358
diff --git a/drivers/infiniband/hw/hfi1/pcie.c b/drivers/infiniband/hw/hfi1/pcie.c
index 83d66e862207..c1c982908b4b 100644
--- a/drivers/infiniband/hw/hfi1/pcie.c
+++ b/drivers/infiniband/hw/hfi1/pcie.c
@@ -163,9 +163,6 @@ int hfi1_pcie_ddinit(struct hfi1_devdata *dd, struct pci_dev *pdev)
163 resource_size_t addr; 163 resource_size_t addr;
164 int ret = 0; 164 int ret = 0;
165 165
166 dd->pcidev = pdev;
167 pci_set_drvdata(pdev, dd);
168
169 addr = pci_resource_start(pdev, 0); 166 addr = pci_resource_start(pdev, 0);
170 len = pci_resource_len(pdev, 0); 167 len = pci_resource_len(pdev, 0);
171 168
diff --git a/drivers/infiniband/hw/hfi1/platform.c b/drivers/infiniband/hw/hfi1/platform.c
index d486355880cb..cbf7faa5038c 100644
--- a/drivers/infiniband/hw/hfi1/platform.c
+++ b/drivers/infiniband/hw/hfi1/platform.c
@@ -199,6 +199,7 @@ void free_platform_config(struct hfi1_devdata *dd)
199{ 199{
200 /* Release memory allocated for eprom or fallback file read. */ 200 /* Release memory allocated for eprom or fallback file read. */
201 kfree(dd->platform_config.data); 201 kfree(dd->platform_config.data);
202 dd->platform_config.data = NULL;
202} 203}
203 204
204void get_port_type(struct hfi1_pportdata *ppd) 205void get_port_type(struct hfi1_pportdata *ppd)
diff --git a/drivers/infiniband/hw/hfi1/qsfp.c b/drivers/infiniband/hw/hfi1/qsfp.c
index 1869f639c3ae..b5966991d647 100644
--- a/drivers/infiniband/hw/hfi1/qsfp.c
+++ b/drivers/infiniband/hw/hfi1/qsfp.c
@@ -204,6 +204,8 @@ static void clean_i2c_bus(struct hfi1_i2c_bus *bus)
204 204
205void clean_up_i2c(struct hfi1_devdata *dd, struct hfi1_asic_data *ad) 205void clean_up_i2c(struct hfi1_devdata *dd, struct hfi1_asic_data *ad)
206{ 206{
207 if (!ad)
208 return;
207 clean_i2c_bus(ad->i2c_bus0); 209 clean_i2c_bus(ad->i2c_bus0);
208 ad->i2c_bus0 = NULL; 210 ad->i2c_bus0 = NULL;
209 clean_i2c_bus(ad->i2c_bus1); 211 clean_i2c_bus(ad->i2c_bus1);
diff --git a/drivers/infiniband/hw/hfi1/ruc.c b/drivers/infiniband/hw/hfi1/ruc.c
index 3daa94bdae3a..c0071ca4147a 100644
--- a/drivers/infiniband/hw/hfi1/ruc.c
+++ b/drivers/infiniband/hw/hfi1/ruc.c
@@ -733,6 +733,20 @@ static inline void hfi1_make_ruc_bth(struct rvt_qp *qp,
733 ohdr->bth[2] = cpu_to_be32(bth2); 733 ohdr->bth[2] = cpu_to_be32(bth2);
734} 734}
735 735
736/**
737 * hfi1_make_ruc_header_16B - build a 16B header
738 * @qp: the queue pair
739 * @ohdr: a pointer to the destination header memory
740 * @bth0: bth0 passed in from the RC/UC builder
741 * @bth2: bth2 passed in from the RC/UC builder
742 * @middle: non zero implies indicates ahg "could" be used
743 * @ps: the current packet state
744 *
745 * This routine may disarm ahg under these situations:
746 * - packet needs a GRH
747 * - BECN needed
748 * - migration state not IB_MIG_MIGRATED
749 */
736static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp, 750static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
737 struct ib_other_headers *ohdr, 751 struct ib_other_headers *ohdr,
738 u32 bth0, u32 bth2, int middle, 752 u32 bth0, u32 bth2, int middle,
@@ -777,6 +791,12 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
777 else 791 else
778 middle = 0; 792 middle = 0;
779 793
794 if (qp->s_flags & RVT_S_ECN) {
795 qp->s_flags &= ~RVT_S_ECN;
796 /* we recently received a FECN, so return a BECN */
797 becn = true;
798 middle = 0;
799 }
780 if (middle) 800 if (middle)
781 build_ahg(qp, bth2); 801 build_ahg(qp, bth2);
782 else 802 else
@@ -784,11 +804,6 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
784 804
785 bth0 |= pkey; 805 bth0 |= pkey;
786 bth0 |= extra_bytes << 20; 806 bth0 |= extra_bytes << 20;
787 if (qp->s_flags & RVT_S_ECN) {
788 qp->s_flags &= ~RVT_S_ECN;
789 /* we recently received a FECN, so return a BECN */
790 becn = true;
791 }
792 hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2); 807 hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
793 808
794 if (!ppd->lid) 809 if (!ppd->lid)
@@ -806,6 +821,20 @@ static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
806 pkey, becn, 0, l4, priv->s_sc); 821 pkey, becn, 0, l4, priv->s_sc);
807} 822}
808 823
824/**
825 * hfi1_make_ruc_header_9B - build a 9B header
826 * @qp: the queue pair
827 * @ohdr: a pointer to the destination header memory
828 * @bth0: bth0 passed in from the RC/UC builder
829 * @bth2: bth2 passed in from the RC/UC builder
830 * @middle: non zero implies indicates ahg "could" be used
831 * @ps: the current packet state
832 *
833 * This routine may disarm ahg under these situations:
834 * - packet needs a GRH
835 * - BECN needed
836 * - migration state not IB_MIG_MIGRATED
837 */
809static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp, 838static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
810 struct ib_other_headers *ohdr, 839 struct ib_other_headers *ohdr,
811 u32 bth0, u32 bth2, int middle, 840 u32 bth0, u32 bth2, int middle,
@@ -839,6 +868,12 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
839 else 868 else
840 middle = 0; 869 middle = 0;
841 870
871 if (qp->s_flags & RVT_S_ECN) {
872 qp->s_flags &= ~RVT_S_ECN;
873 /* we recently received a FECN, so return a BECN */
874 bth1 |= (IB_BECN_MASK << IB_BECN_SHIFT);
875 middle = 0;
876 }
842 if (middle) 877 if (middle)
843 build_ahg(qp, bth2); 878 build_ahg(qp, bth2);
844 else 879 else
@@ -846,11 +881,6 @@ static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
846 881
847 bth0 |= pkey; 882 bth0 |= pkey;
848 bth0 |= extra_bytes << 20; 883 bth0 |= extra_bytes << 20;
849 if (qp->s_flags & RVT_S_ECN) {
850 qp->s_flags &= ~RVT_S_ECN;
851 /* we recently received a FECN, so return a BECN */
852 bth1 |= (IB_BECN_MASK << IB_BECN_SHIFT);
853 }
854 hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2); 884 hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
855 hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh, 885 hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh,
856 lrh0, 886 lrh0,
diff --git a/drivers/infiniband/hw/hfi1/ud.c b/drivers/infiniband/hw/hfi1/ud.c
index bcf3b0bebac8..69c17a5ef038 100644
--- a/drivers/infiniband/hw/hfi1/ud.c
+++ b/drivers/infiniband/hw/hfi1/ud.c
@@ -628,7 +628,7 @@ int hfi1_lookup_pkey_idx(struct hfi1_ibport *ibp, u16 pkey)
628} 628}
629 629
630void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp, 630void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,
631 u32 remote_qpn, u32 pkey, u32 slid, u32 dlid, 631 u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
632 u8 sc5, const struct ib_grh *old_grh) 632 u8 sc5, const struct ib_grh *old_grh)
633{ 633{
634 u64 pbc, pbc_flags = 0; 634 u64 pbc, pbc_flags = 0;
@@ -687,7 +687,7 @@ void return_cnp_16B(struct hfi1_ibport *ibp, struct rvt_qp *qp,
687} 687}
688 688
689void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn, 689void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,
690 u32 pkey, u32 slid, u32 dlid, u8 sc5, 690 u16 pkey, u32 slid, u32 dlid, u8 sc5,
691 const struct ib_grh *old_grh) 691 const struct ib_grh *old_grh)
692{ 692{
693 u64 pbc, pbc_flags = 0; 693 u64 pbc, pbc_flags = 0;
diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c
index 0eeabfbee192..63b5b3edabcb 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hem.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
@@ -912,7 +912,7 @@ int hns_roce_init_hem_table(struct hns_roce_dev *hr_dev,
912 obj_per_chunk = buf_chunk_size / obj_size; 912 obj_per_chunk = buf_chunk_size / obj_size;
913 num_hem = (nobj + obj_per_chunk - 1) / obj_per_chunk; 913 num_hem = (nobj + obj_per_chunk - 1) / obj_per_chunk;
914 bt_chunk_num = bt_chunk_size / 8; 914 bt_chunk_num = bt_chunk_size / 8;
915 if (table->type >= HEM_TYPE_MTT) 915 if (type >= HEM_TYPE_MTT)
916 num_bt_l0 = bt_chunk_num; 916 num_bt_l0 = bt_chunk_num;
917 917
918 table->hem = kcalloc(num_hem, sizeof(*table->hem), 918 table->hem = kcalloc(num_hem, sizeof(*table->hem),
@@ -920,7 +920,7 @@ int hns_roce_init_hem_table(struct hns_roce_dev *hr_dev,
920 if (!table->hem) 920 if (!table->hem)
921 goto err_kcalloc_hem_buf; 921 goto err_kcalloc_hem_buf;
922 922
923 if (check_whether_bt_num_3(table->type, hop_num)) { 923 if (check_whether_bt_num_3(type, hop_num)) {
924 unsigned long num_bt_l1; 924 unsigned long num_bt_l1;
925 925
926 num_bt_l1 = (num_hem + bt_chunk_num - 1) / 926 num_bt_l1 = (num_hem + bt_chunk_num - 1) /
@@ -939,8 +939,8 @@ int hns_roce_init_hem_table(struct hns_roce_dev *hr_dev,
939 goto err_kcalloc_l1_dma; 939 goto err_kcalloc_l1_dma;
940 } 940 }
941 941
942 if (check_whether_bt_num_2(table->type, hop_num) || 942 if (check_whether_bt_num_2(type, hop_num) ||
943 check_whether_bt_num_3(table->type, hop_num)) { 943 check_whether_bt_num_3(type, hop_num)) {
944 table->bt_l0 = kcalloc(num_bt_l0, sizeof(*table->bt_l0), 944 table->bt_l0 = kcalloc(num_bt_l0, sizeof(*table->bt_l0),
945 GFP_KERNEL); 945 GFP_KERNEL);
946 if (!table->bt_l0) 946 if (!table->bt_l0)
@@ -1039,14 +1039,14 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,
1039void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev) 1039void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev)
1040{ 1040{
1041 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->cq_table.table); 1041 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->cq_table.table);
1042 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qp_table.irrl_table);
1043 if (hr_dev->caps.trrl_entry_sz) 1042 if (hr_dev->caps.trrl_entry_sz)
1044 hns_roce_cleanup_hem_table(hr_dev, 1043 hns_roce_cleanup_hem_table(hr_dev,
1045 &hr_dev->qp_table.trrl_table); 1044 &hr_dev->qp_table.trrl_table);
1045 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qp_table.irrl_table);
1046 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qp_table.qp_table); 1046 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qp_table.qp_table);
1047 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->mr_table.mtpt_table); 1047 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->mr_table.mtpt_table);
1048 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->mr_table.mtt_table);
1049 if (hns_roce_check_whether_mhop(hr_dev, HEM_TYPE_CQE)) 1048 if (hns_roce_check_whether_mhop(hr_dev, HEM_TYPE_CQE))
1050 hns_roce_cleanup_hem_table(hr_dev, 1049 hns_roce_cleanup_hem_table(hr_dev,
1051 &hr_dev->mr_table.mtt_cqe_table); 1050 &hr_dev->mr_table.mtt_cqe_table);
1051 hns_roce_cleanup_hem_table(hr_dev, &hr_dev->mr_table.mtt_table);
1052} 1052}
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 8b84ab7800d8..25916e8522ed 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -71,6 +71,11 @@ static int set_rwqe_data_seg(struct ib_qp *ibqp, struct ib_send_wr *wr,
71 return -EINVAL; 71 return -EINVAL;
72 } 72 }
73 73
74 if (wr->opcode == IB_WR_RDMA_READ) {
75 dev_err(hr_dev->dev, "Not support inline data!\n");
76 return -EINVAL;
77 }
78
74 for (i = 0; i < wr->num_sge; i++) { 79 for (i = 0; i < wr->num_sge; i++) {
75 memcpy(wqe, ((void *)wr->sg_list[i].addr), 80 memcpy(wqe, ((void *)wr->sg_list[i].addr),
76 wr->sg_list[i].length); 81 wr->sg_list[i].length);
@@ -148,7 +153,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
148 ibqp->qp_type != IB_QPT_GSI && 153 ibqp->qp_type != IB_QPT_GSI &&
149 ibqp->qp_type != IB_QPT_UD)) { 154 ibqp->qp_type != IB_QPT_UD)) {
150 dev_err(dev, "Not supported QP(0x%x)type!\n", ibqp->qp_type); 155 dev_err(dev, "Not supported QP(0x%x)type!\n", ibqp->qp_type);
151 *bad_wr = NULL; 156 *bad_wr = wr;
152 return -EOPNOTSUPP; 157 return -EOPNOTSUPP;
153 } 158 }
154 159
@@ -182,7 +187,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
182 qp->sq.wrid[(qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1)] = 187 qp->sq.wrid[(qp->sq.head + nreq) & (qp->sq.wqe_cnt - 1)] =
183 wr->wr_id; 188 wr->wr_id;
184 189
185 owner_bit = ~(qp->sq.head >> ilog2(qp->sq.wqe_cnt)) & 0x1; 190 owner_bit =
191 ~(((qp->sq.head + nreq) >> ilog2(qp->sq.wqe_cnt)) & 0x1);
186 192
187 /* Corresponding to the QP type, wqe process separately */ 193 /* Corresponding to the QP type, wqe process separately */
188 if (ibqp->qp_type == IB_QPT_GSI) { 194 if (ibqp->qp_type == IB_QPT_GSI) {
@@ -456,6 +462,7 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
456 } else { 462 } else {
457 dev_err(dev, "Illegal qp_type(0x%x)\n", ibqp->qp_type); 463 dev_err(dev, "Illegal qp_type(0x%x)\n", ibqp->qp_type);
458 spin_unlock_irqrestore(&qp->sq.lock, flags); 464 spin_unlock_irqrestore(&qp->sq.lock, flags);
465 *bad_wr = wr;
459 return -EOPNOTSUPP; 466 return -EOPNOTSUPP;
460 } 467 }
461 } 468 }
@@ -2592,10 +2599,12 @@ static void modify_qp_init_to_init(struct ib_qp *ibqp,
2592 roce_set_field(qpc_mask->byte_4_sqpn_tst, V2_QPC_BYTE_4_SQPN_M, 2599 roce_set_field(qpc_mask->byte_4_sqpn_tst, V2_QPC_BYTE_4_SQPN_M,
2593 V2_QPC_BYTE_4_SQPN_S, 0); 2600 V2_QPC_BYTE_4_SQPN_S, 0);
2594 2601
2595 roce_set_field(context->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M, 2602 if (attr_mask & IB_QP_DEST_QPN) {
2596 V2_QPC_BYTE_56_DQPN_S, hr_qp->qpn); 2603 roce_set_field(context->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M,
2597 roce_set_field(qpc_mask->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M, 2604 V2_QPC_BYTE_56_DQPN_S, hr_qp->qpn);
2598 V2_QPC_BYTE_56_DQPN_S, 0); 2605 roce_set_field(qpc_mask->byte_56_dqpn_err,
2606 V2_QPC_BYTE_56_DQPN_M, V2_QPC_BYTE_56_DQPN_S, 0);
2607 }
2599 roce_set_field(context->byte_168_irrl_idx, 2608 roce_set_field(context->byte_168_irrl_idx,
2600 V2_QPC_BYTE_168_SQ_SHIFT_BAK_M, 2609 V2_QPC_BYTE_168_SQ_SHIFT_BAK_M,
2601 V2_QPC_BYTE_168_SQ_SHIFT_BAK_S, 2610 V2_QPC_BYTE_168_SQ_SHIFT_BAK_S,
@@ -2650,8 +2659,7 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
2650 return -EINVAL; 2659 return -EINVAL;
2651 } 2660 }
2652 2661
2653 if ((attr_mask & IB_QP_ALT_PATH) || (attr_mask & IB_QP_ACCESS_FLAGS) || 2662 if (attr_mask & IB_QP_ALT_PATH) {
2654 (attr_mask & IB_QP_PKEY_INDEX) || (attr_mask & IB_QP_QKEY)) {
2655 dev_err(dev, "INIT2RTR attr_mask (0x%x) error\n", attr_mask); 2663 dev_err(dev, "INIT2RTR attr_mask (0x%x) error\n", attr_mask);
2656 return -EINVAL; 2664 return -EINVAL;
2657 } 2665 }
@@ -2800,10 +2808,12 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
2800 V2_QPC_BYTE_140_RR_MAX_S, 0); 2808 V2_QPC_BYTE_140_RR_MAX_S, 0);
2801 } 2809 }
2802 2810
2803 roce_set_field(context->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M, 2811 if (attr_mask & IB_QP_DEST_QPN) {
2804 V2_QPC_BYTE_56_DQPN_S, attr->dest_qp_num); 2812 roce_set_field(context->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M,
2805 roce_set_field(qpc_mask->byte_56_dqpn_err, V2_QPC_BYTE_56_DQPN_M, 2813 V2_QPC_BYTE_56_DQPN_S, attr->dest_qp_num);
2806 V2_QPC_BYTE_56_DQPN_S, 0); 2814 roce_set_field(qpc_mask->byte_56_dqpn_err,
2815 V2_QPC_BYTE_56_DQPN_M, V2_QPC_BYTE_56_DQPN_S, 0);
2816 }
2807 2817
2808 /* Configure GID index */ 2818 /* Configure GID index */
2809 port_num = rdma_ah_get_port_num(&attr->ah_attr); 2819 port_num = rdma_ah_get_port_num(&attr->ah_attr);
@@ -2845,7 +2855,7 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp,
2845 if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_UD) 2855 if (ibqp->qp_type == IB_QPT_GSI || ibqp->qp_type == IB_QPT_UD)
2846 roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_MTU_M, 2856 roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_MTU_M,
2847 V2_QPC_BYTE_24_MTU_S, IB_MTU_4096); 2857 V2_QPC_BYTE_24_MTU_S, IB_MTU_4096);
2848 else 2858 else if (attr_mask & IB_QP_PATH_MTU)
2849 roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_MTU_M, 2859 roce_set_field(context->byte_24_mtu_tc, V2_QPC_BYTE_24_MTU_M,
2850 V2_QPC_BYTE_24_MTU_S, attr->path_mtu); 2860 V2_QPC_BYTE_24_MTU_S, attr->path_mtu);
2851 2861
@@ -2922,11 +2932,9 @@ static int modify_qp_rtr_to_rts(struct ib_qp *ibqp,
2922 return -EINVAL; 2932 return -EINVAL;
2923 } 2933 }
2924 2934
2925 /* If exist optional param, return error */ 2935 /* Not support alternate path and path migration */
2926 if ((attr_mask & IB_QP_ALT_PATH) || (attr_mask & IB_QP_ACCESS_FLAGS) || 2936 if ((attr_mask & IB_QP_ALT_PATH) ||
2927 (attr_mask & IB_QP_QKEY) || (attr_mask & IB_QP_PATH_MIG_STATE) || 2937 (attr_mask & IB_QP_PATH_MIG_STATE)) {
2928 (attr_mask & IB_QP_CUR_STATE) ||
2929 (attr_mask & IB_QP_MIN_RNR_TIMER)) {
2930 dev_err(dev, "RTR2RTS attr_mask (0x%x)error\n", attr_mask); 2938 dev_err(dev, "RTR2RTS attr_mask (0x%x)error\n", attr_mask);
2931 return -EINVAL; 2939 return -EINVAL;
2932 } 2940 }
@@ -3161,7 +3169,8 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
3161 (cur_state == IB_QPS_RTR && new_state == IB_QPS_ERR) || 3169 (cur_state == IB_QPS_RTR && new_state == IB_QPS_ERR) ||
3162 (cur_state == IB_QPS_RTS && new_state == IB_QPS_ERR) || 3170 (cur_state == IB_QPS_RTS && new_state == IB_QPS_ERR) ||
3163 (cur_state == IB_QPS_SQD && new_state == IB_QPS_ERR) || 3171 (cur_state == IB_QPS_SQD && new_state == IB_QPS_ERR) ||
3164 (cur_state == IB_QPS_SQE && new_state == IB_QPS_ERR)) { 3172 (cur_state == IB_QPS_SQE && new_state == IB_QPS_ERR) ||
3173 (cur_state == IB_QPS_ERR && new_state == IB_QPS_ERR)) {
3165 /* Nothing */ 3174 /* Nothing */
3166 ; 3175 ;
3167 } else { 3176 } else {
@@ -4478,7 +4487,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev,
4478 ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, eq->eqn, 0, 4487 ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, eq->eqn, 0,
4479 eq_cmd, HNS_ROCE_CMD_TIMEOUT_MSECS); 4488 eq_cmd, HNS_ROCE_CMD_TIMEOUT_MSECS);
4480 if (ret) { 4489 if (ret) {
4481 dev_err(dev, "[mailbox cmd] creat eqc failed.\n"); 4490 dev_err(dev, "[mailbox cmd] create eqc failed.\n");
4482 goto err_cmd_mbox; 4491 goto err_cmd_mbox;
4483 } 4492 }
4484 4493
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index e289a924e789..d4aad34c21e2 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -620,7 +620,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
620 to_hr_ucontext(ib_pd->uobject->context), 620 to_hr_ucontext(ib_pd->uobject->context),
621 ucmd.db_addr, &hr_qp->rdb); 621 ucmd.db_addr, &hr_qp->rdb);
622 if (ret) { 622 if (ret) {
623 dev_err(dev, "rp record doorbell map failed!\n"); 623 dev_err(dev, "rq record doorbell map failed!\n");
624 goto err_mtt; 624 goto err_mtt;
625 } 625 }
626 } 626 }
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 17f4f151a97f..61d8b06375bb 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -346,7 +346,7 @@ int mlx4_ib_umem_calc_optimal_mtt_size(struct ib_umem *umem, u64 start_va,
346 /* Add to the first block the misalignment that it suffers from. */ 346 /* Add to the first block the misalignment that it suffers from. */
347 total_len += (first_block_start & ((1ULL << block_shift) - 1ULL)); 347 total_len += (first_block_start & ((1ULL << block_shift) - 1ULL));
348 last_block_end = current_block_start + current_block_len; 348 last_block_end = current_block_start + current_block_len;
349 last_block_aligned_end = round_up(last_block_end, 1 << block_shift); 349 last_block_aligned_end = round_up(last_block_end, 1ULL << block_shift);
350 total_len += (last_block_aligned_end - last_block_end); 350 total_len += (last_block_aligned_end - last_block_end);
351 351
352 if (total_len & ((1ULL << block_shift) - 1ULL)) 352 if (total_len & ((1ULL << block_shift) - 1ULL))
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 50af8915e7ec..199648adac74 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -673,7 +673,8 @@ static int set_qp_rss(struct mlx4_ib_dev *dev, struct mlx4_ib_rss *rss_ctx,
673 MLX4_IB_RX_HASH_SRC_PORT_TCP | 673 MLX4_IB_RX_HASH_SRC_PORT_TCP |
674 MLX4_IB_RX_HASH_DST_PORT_TCP | 674 MLX4_IB_RX_HASH_DST_PORT_TCP |
675 MLX4_IB_RX_HASH_SRC_PORT_UDP | 675 MLX4_IB_RX_HASH_SRC_PORT_UDP |
676 MLX4_IB_RX_HASH_DST_PORT_UDP)) { 676 MLX4_IB_RX_HASH_DST_PORT_UDP |
677 MLX4_IB_RX_HASH_INNER)) {
677 pr_debug("RX Hash fields_mask has unsupported mask (0x%llx)\n", 678 pr_debug("RX Hash fields_mask has unsupported mask (0x%llx)\n",
678 ucmd->rx_hash_fields_mask); 679 ucmd->rx_hash_fields_mask);
679 return (-EOPNOTSUPP); 680 return (-EOPNOTSUPP);
diff --git a/drivers/infiniband/hw/mlx5/Kconfig b/drivers/infiniband/hw/mlx5/Kconfig
index bce263b92821..fb4d77be019b 100644
--- a/drivers/infiniband/hw/mlx5/Kconfig
+++ b/drivers/infiniband/hw/mlx5/Kconfig
@@ -1,6 +1,7 @@
1config MLX5_INFINIBAND 1config MLX5_INFINIBAND
2 tristate "Mellanox Connect-IB HCA support" 2 tristate "Mellanox Connect-IB HCA support"
3 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE 3 depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
4 depends on INFINIBAND_USER_ACCESS || INFINIBAND_USER_ACCESS=n
4 ---help--- 5 ---help---
5 This driver provides low-level InfiniBand support for 6 This driver provides low-level InfiniBand support for
6 Mellanox Connect-IB PCI Express host channel adapters (HCAs). 7 Mellanox Connect-IB PCI Express host channel adapters (HCAs).
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 241cf4ff9901..b4d8ff8ab807 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -52,7 +52,6 @@
52#include <linux/mlx5/port.h> 52#include <linux/mlx5/port.h>
53#include <linux/mlx5/vport.h> 53#include <linux/mlx5/vport.h>
54#include <linux/mlx5/fs.h> 54#include <linux/mlx5/fs.h>
55#include <linux/mlx5/fs_helpers.h>
56#include <linux/list.h> 55#include <linux/list.h>
57#include <rdma/ib_smi.h> 56#include <rdma/ib_smi.h>
58#include <rdma/ib_umem.h> 57#include <rdma/ib_umem.h>
@@ -180,7 +179,7 @@ static int mlx5_netdev_event(struct notifier_block *this,
180 if (rep_ndev == ndev) 179 if (rep_ndev == ndev)
181 roce->netdev = (event == NETDEV_UNREGISTER) ? 180 roce->netdev = (event == NETDEV_UNREGISTER) ?
182 NULL : ndev; 181 NULL : ndev;
183 } else if (ndev->dev.parent == &ibdev->mdev->pdev->dev) { 182 } else if (ndev->dev.parent == &mdev->pdev->dev) {
184 roce->netdev = (event == NETDEV_UNREGISTER) ? 183 roce->netdev = (event == NETDEV_UNREGISTER) ?
185 NULL : ndev; 184 NULL : ndev;
186 } 185 }
@@ -5427,9 +5426,7 @@ static void mlx5_ib_stage_cong_debugfs_cleanup(struct mlx5_ib_dev *dev)
5427static int mlx5_ib_stage_uar_init(struct mlx5_ib_dev *dev) 5426static int mlx5_ib_stage_uar_init(struct mlx5_ib_dev *dev)
5428{ 5427{
5429 dev->mdev->priv.uar = mlx5_get_uars_page(dev->mdev); 5428 dev->mdev->priv.uar = mlx5_get_uars_page(dev->mdev);
5430 if (!dev->mdev->priv.uar) 5429 return PTR_ERR_OR_ZERO(dev->mdev->priv.uar);
5431 return -ENOMEM;
5432 return 0;
5433} 5430}
5434 5431
5435static void mlx5_ib_stage_uar_cleanup(struct mlx5_ib_dev *dev) 5432static void mlx5_ib_stage_uar_cleanup(struct mlx5_ib_dev *dev)
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 1520a2f20f98..90a9c461cedc 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -866,25 +866,28 @@ static int mr_umem_get(struct ib_pd *pd, u64 start, u64 length,
866 int *order) 866 int *order)
867{ 867{
868 struct mlx5_ib_dev *dev = to_mdev(pd->device); 868 struct mlx5_ib_dev *dev = to_mdev(pd->device);
869 struct ib_umem *u;
869 int err; 870 int err;
870 871
871 *umem = ib_umem_get(pd->uobject->context, start, length, 872 *umem = NULL;
872 access_flags, 0); 873
873 err = PTR_ERR_OR_ZERO(*umem); 874 u = ib_umem_get(pd->uobject->context, start, length, access_flags, 0);
875 err = PTR_ERR_OR_ZERO(u);
874 if (err) { 876 if (err) {
875 *umem = NULL; 877 mlx5_ib_dbg(dev, "umem get failed (%d)\n", err);
876 mlx5_ib_err(dev, "umem get failed (%d)\n", err);
877 return err; 878 return err;
878 } 879 }
879 880
880 mlx5_ib_cont_pages(*umem, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages, 881 mlx5_ib_cont_pages(u, start, MLX5_MKEY_PAGE_SHIFT_MASK, npages,
881 page_shift, ncont, order); 882 page_shift, ncont, order);
882 if (!*npages) { 883 if (!*npages) {
883 mlx5_ib_warn(dev, "avoid zero region\n"); 884 mlx5_ib_warn(dev, "avoid zero region\n");
884 ib_umem_release(*umem); 885 ib_umem_release(u);
885 return -EINVAL; 886 return -EINVAL;
886 } 887 }
887 888
889 *umem = u;
890
888 mlx5_ib_dbg(dev, "npages %d, ncont %d, order %d, page_shift %d\n", 891 mlx5_ib_dbg(dev, "npages %d, ncont %d, order %d, page_shift %d\n",
889 *npages, *ncont, *order, *page_shift); 892 *npages, *ncont, *order, *page_shift);
890 893
@@ -1458,13 +1461,12 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
1458 int access_flags = flags & IB_MR_REREG_ACCESS ? 1461 int access_flags = flags & IB_MR_REREG_ACCESS ?
1459 new_access_flags : 1462 new_access_flags :
1460 mr->access_flags; 1463 mr->access_flags;
1461 u64 addr = (flags & IB_MR_REREG_TRANS) ? virt_addr : mr->umem->address;
1462 u64 len = (flags & IB_MR_REREG_TRANS) ? length : mr->umem->length;
1463 int page_shift = 0; 1464 int page_shift = 0;
1464 int upd_flags = 0; 1465 int upd_flags = 0;
1465 int npages = 0; 1466 int npages = 0;
1466 int ncont = 0; 1467 int ncont = 0;
1467 int order = 0; 1468 int order = 0;
1469 u64 addr, len;
1468 int err; 1470 int err;
1469 1471
1470 mlx5_ib_dbg(dev, "start 0x%llx, virt_addr 0x%llx, length 0x%llx, access_flags 0x%x\n", 1472 mlx5_ib_dbg(dev, "start 0x%llx, virt_addr 0x%llx, length 0x%llx, access_flags 0x%x\n",
@@ -1472,6 +1474,17 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
1472 1474
1473 atomic_sub(mr->npages, &dev->mdev->priv.reg_pages); 1475 atomic_sub(mr->npages, &dev->mdev->priv.reg_pages);
1474 1476
1477 if (!mr->umem)
1478 return -EINVAL;
1479
1480 if (flags & IB_MR_REREG_TRANS) {
1481 addr = virt_addr;
1482 len = length;
1483 } else {
1484 addr = mr->umem->address;
1485 len = mr->umem->length;
1486 }
1487
1475 if (flags != IB_MR_REREG_PD) { 1488 if (flags != IB_MR_REREG_PD) {
1476 /* 1489 /*
1477 * Replace umem. This needs to be done whether or not UMR is 1490 * Replace umem. This needs to be done whether or not UMR is
@@ -1479,6 +1492,7 @@ int mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
1479 */ 1492 */
1480 flags |= IB_MR_REREG_TRANS; 1493 flags |= IB_MR_REREG_TRANS;
1481 ib_umem_release(mr->umem); 1494 ib_umem_release(mr->umem);
1495 mr->umem = NULL;
1482 err = mr_umem_get(pd, addr, len, access_flags, &mr->umem, 1496 err = mr_umem_get(pd, addr, len, access_flags, &mr->umem,
1483 &npages, &page_shift, &ncont, &order); 1497 &npages, &page_shift, &ncont, &order);
1484 if (err) 1498 if (err)
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 7ed4b70f6447..87b7c1be2a11 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -259,7 +259,11 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap,
259 } else { 259 } else {
260 if (ucmd) { 260 if (ucmd) {
261 qp->rq.wqe_cnt = ucmd->rq_wqe_count; 261 qp->rq.wqe_cnt = ucmd->rq_wqe_count;
262 if (ucmd->rq_wqe_shift > BITS_PER_BYTE * sizeof(ucmd->rq_wqe_shift))
263 return -EINVAL;
262 qp->rq.wqe_shift = ucmd->rq_wqe_shift; 264 qp->rq.wqe_shift = ucmd->rq_wqe_shift;
265 if ((1 << qp->rq.wqe_shift) / sizeof(struct mlx5_wqe_data_seg) < qp->wq_sig)
266 return -EINVAL;
263 qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof(struct mlx5_wqe_data_seg) - qp->wq_sig; 267 qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof(struct mlx5_wqe_data_seg) - qp->wq_sig;
264 qp->rq.max_post = qp->rq.wqe_cnt; 268 qp->rq.max_post = qp->rq.wqe_cnt;
265 } else { 269 } else {
@@ -2451,18 +2455,18 @@ enum {
2451 2455
2452static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate) 2456static int ib_rate_to_mlx5(struct mlx5_ib_dev *dev, u8 rate)
2453{ 2457{
2454 if (rate == IB_RATE_PORT_CURRENT) { 2458 if (rate == IB_RATE_PORT_CURRENT)
2455 return 0; 2459 return 0;
2456 } else if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS) { 2460
2461 if (rate < IB_RATE_2_5_GBPS || rate > IB_RATE_300_GBPS)
2457 return -EINVAL; 2462 return -EINVAL;
2458 } else {
2459 while (rate != IB_RATE_2_5_GBPS &&
2460 !(1 << (rate + MLX5_STAT_RATE_OFFSET) &
2461 MLX5_CAP_GEN(dev->mdev, stat_rate_support)))
2462 --rate;
2463 }
2464 2463
2465 return rate + MLX5_STAT_RATE_OFFSET; 2464 while (rate != IB_RATE_PORT_CURRENT &&
2465 !(1 << (rate + MLX5_STAT_RATE_OFFSET) &
2466 MLX5_CAP_GEN(dev->mdev, stat_rate_support)))
2467 --rate;
2468
2469 return rate ? rate + MLX5_STAT_RATE_OFFSET : rate;
2466} 2470}
2467 2471
2468static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev, 2472static int modify_raw_packet_eth_prio(struct mlx5_core_dev *dev,
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 0a75164cedea..007d5e8a0121 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -461,7 +461,7 @@ static bool nes_nic_send(struct sk_buff *skb, struct net_device *netdev)
461/** 461/**
462 * nes_netdev_start_xmit 462 * nes_netdev_start_xmit
463 */ 463 */
464static int nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev) 464static netdev_tx_t nes_netdev_start_xmit(struct sk_buff *skb, struct net_device *netdev)
465{ 465{
466 struct nes_vnic *nesvnic = netdev_priv(netdev); 466 struct nes_vnic *nesvnic = netdev_priv(netdev);
467 struct nes_device *nesdev = nesvnic->nesdev; 467 struct nes_device *nesdev = nesvnic->nesdev;
diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.c b/drivers/infiniband/sw/rxe/rxe_opcode.c
index 61927c165b59..4cf11063e0b5 100644
--- a/drivers/infiniband/sw/rxe/rxe_opcode.c
+++ b/drivers/infiniband/sw/rxe/rxe_opcode.c
@@ -390,7 +390,7 @@ struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE] = {
390 .name = "IB_OPCODE_RC_SEND_ONLY_INV", 390 .name = "IB_OPCODE_RC_SEND_ONLY_INV",
391 .mask = RXE_IETH_MASK | RXE_PAYLOAD_MASK | RXE_REQ_MASK 391 .mask = RXE_IETH_MASK | RXE_PAYLOAD_MASK | RXE_REQ_MASK
392 | RXE_COMP_MASK | RXE_RWR_MASK | RXE_SEND_MASK 392 | RXE_COMP_MASK | RXE_RWR_MASK | RXE_SEND_MASK
393 | RXE_END_MASK, 393 | RXE_END_MASK | RXE_START_MASK,
394 .length = RXE_BTH_BYTES + RXE_IETH_BYTES, 394 .length = RXE_BTH_BYTES + RXE_IETH_BYTES,
395 .offset = { 395 .offset = {
396 [RXE_BTH] = 0, 396 [RXE_BTH] = 0,
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 7bdaf71b8221..785199990457 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -728,7 +728,6 @@ next_wqe:
728 rollback_state(wqe, qp, &rollback_wqe, rollback_psn); 728 rollback_state(wqe, qp, &rollback_wqe, rollback_psn);
729 729
730 if (ret == -EAGAIN) { 730 if (ret == -EAGAIN) {
731 kfree_skb(skb);
732 rxe_run_task(&qp->req.task, 1); 731 rxe_run_task(&qp->req.task, 1);
733 goto exit; 732 goto exit;
734 } 733 }
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index a65c9969f7fc..955ff3b6da9c 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -742,7 +742,6 @@ static enum resp_states read_reply(struct rxe_qp *qp,
742 err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb); 742 err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
743 if (err) { 743 if (err) {
744 pr_err("Failed sending RDMA reply.\n"); 744 pr_err("Failed sending RDMA reply.\n");
745 kfree_skb(skb);
746 return RESPST_ERR_RNR; 745 return RESPST_ERR_RNR;
747 } 746 }
748 747
@@ -954,10 +953,8 @@ static int send_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
954 } 953 }
955 954
956 err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb); 955 err = rxe_xmit_packet(rxe, qp, &ack_pkt, skb);
957 if (err) { 956 if (err)
958 pr_err_ratelimited("Failed sending ack\n"); 957 pr_err_ratelimited("Failed sending ack\n");
959 kfree_skb(skb);
960 }
961 958
962err1: 959err1:
963 return err; 960 return err;
@@ -1141,7 +1138,6 @@ static enum resp_states duplicate_request(struct rxe_qp *qp,
1141 if (rc) { 1138 if (rc) {
1142 pr_err("Failed resending result. This flow is not handled - skb ignored\n"); 1139 pr_err("Failed resending result. This flow is not handled - skb ignored\n");
1143 rxe_drop_ref(qp); 1140 rxe_drop_ref(qp);
1144 kfree_skb(skb_copy);
1145 rc = RESPST_CLEANUP; 1141 rc = RESPST_CLEANUP;
1146 goto out; 1142 goto out;
1147 } 1143 }
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 161ba8c76285..cf291f90b58f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1094,7 +1094,7 @@ drop_and_unlock:
1094 spin_unlock_irqrestore(&priv->lock, flags); 1094 spin_unlock_irqrestore(&priv->lock, flags);
1095} 1095}
1096 1096
1097static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) 1097static netdev_tx_t ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
1098{ 1098{
1099 struct ipoib_dev_priv *priv = ipoib_priv(dev); 1099 struct ipoib_dev_priv *priv = ipoib_priv(dev);
1100 struct rdma_netdev *rn = netdev_priv(dev); 1100 struct rdma_netdev *rn = netdev_priv(dev);
diff --git a/drivers/infiniband/ulp/srp/Kconfig b/drivers/infiniband/ulp/srp/Kconfig
index c74ee9633041..99db8fe5173a 100644
--- a/drivers/infiniband/ulp/srp/Kconfig
+++ b/drivers/infiniband/ulp/srp/Kconfig
@@ -1,6 +1,6 @@
1config INFINIBAND_SRP 1config INFINIBAND_SRP
2 tristate "InfiniBand SCSI RDMA Protocol" 2 tristate "InfiniBand SCSI RDMA Protocol"
3 depends on SCSI 3 depends on SCSI && INFINIBAND_ADDR_TRANS
4 select SCSI_SRP_ATTRS 4 select SCSI_SRP_ATTRS
5 ---help--- 5 ---help---
6 Support for the SCSI RDMA Protocol over InfiniBand. This 6 Support for the SCSI RDMA Protocol over InfiniBand. This
diff --git a/drivers/infiniband/ulp/srpt/Kconfig b/drivers/infiniband/ulp/srpt/Kconfig
index 31ee83d528d9..fb8b7182f05e 100644
--- a/drivers/infiniband/ulp/srpt/Kconfig
+++ b/drivers/infiniband/ulp/srpt/Kconfig
@@ -1,6 +1,6 @@
1config INFINIBAND_SRPT 1config INFINIBAND_SRPT
2 tristate "InfiniBand SCSI RDMA Protocol target support" 2 tristate "InfiniBand SCSI RDMA Protocol target support"
3 depends on INFINIBAND && TARGET_CORE 3 depends on INFINIBAND && INFINIBAND_ADDR_TRANS && TARGET_CORE
4 ---help--- 4 ---help---
5 5
6 Support for the SCSI RDMA Protocol (SRP) Target driver. The 6 Support for the SCSI RDMA Protocol (SRP) Target driver. The
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 2a99f0f14795..8fb8c737fffe 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -83,7 +83,6 @@
83 83
84static DEFINE_SPINLOCK(amd_iommu_devtable_lock); 84static DEFINE_SPINLOCK(amd_iommu_devtable_lock);
85static DEFINE_SPINLOCK(pd_bitmap_lock); 85static DEFINE_SPINLOCK(pd_bitmap_lock);
86static DEFINE_SPINLOCK(iommu_table_lock);
87 86
88/* List of all available dev_data structures */ 87/* List of all available dev_data structures */
89static LLIST_HEAD(dev_data_list); 88static LLIST_HEAD(dev_data_list);
@@ -3562,6 +3561,7 @@ EXPORT_SYMBOL(amd_iommu_device_info);
3562 *****************************************************************************/ 3561 *****************************************************************************/
3563 3562
3564static struct irq_chip amd_ir_chip; 3563static struct irq_chip amd_ir_chip;
3564static DEFINE_SPINLOCK(iommu_table_lock);
3565 3565
3566static void set_dte_irq_entry(u16 devid, struct irq_remap_table *table) 3566static void set_dte_irq_entry(u16 devid, struct irq_remap_table *table)
3567{ 3567{
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index f05f3cf90756..ddcbbdb5d658 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -167,40 +167,16 @@ EXPORT_SYMBOL(iommu_put_dma_cookie);
167 * @list: Reserved region list from iommu_get_resv_regions() 167 * @list: Reserved region list from iommu_get_resv_regions()
168 * 168 *
169 * IOMMU drivers can use this to implement their .get_resv_regions callback 169 * IOMMU drivers can use this to implement their .get_resv_regions callback
170 * for general non-IOMMU-specific reservations. Currently, this covers host 170 * for general non-IOMMU-specific reservations. Currently, this covers GICv3
171 * bridge windows for PCI devices and GICv3 ITS region reservation on ACPI 171 * ITS region reservation on ACPI based ARM platforms that may require HW MSI
172 * based ARM platforms that may require HW MSI reservation. 172 * reservation.
173 */ 173 */
174void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) 174void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list)
175{ 175{
176 struct pci_host_bridge *bridge;
177 struct resource_entry *window;
178
179 if (!is_of_node(dev->iommu_fwspec->iommu_fwnode) &&
180 iort_iommu_msi_get_resv_regions(dev, list) < 0)
181 return;
182
183 if (!dev_is_pci(dev))
184 return;
185
186 bridge = pci_find_host_bridge(to_pci_dev(dev)->bus);
187 resource_list_for_each_entry(window, &bridge->windows) {
188 struct iommu_resv_region *region;
189 phys_addr_t start;
190 size_t length;
191
192 if (resource_type(window->res) != IORESOURCE_MEM)
193 continue;
194 176
195 start = window->res->start - window->offset; 177 if (!is_of_node(dev->iommu_fwspec->iommu_fwnode))
196 length = window->res->end - window->res->start + 1; 178 iort_iommu_msi_get_resv_regions(dev, list);
197 region = iommu_alloc_resv_region(start, length, 0,
198 IOMMU_RESV_RESERVED);
199 if (!region)
200 return;
201 179
202 list_add_tail(&region->list, list);
203 }
204} 180}
205EXPORT_SYMBOL(iommu_dma_get_resv_regions); 181EXPORT_SYMBOL(iommu_dma_get_resv_regions);
206 182
@@ -229,6 +205,23 @@ static int cookie_init_hw_msi_region(struct iommu_dma_cookie *cookie,
229 return 0; 205 return 0;
230} 206}
231 207
208static void iova_reserve_pci_windows(struct pci_dev *dev,
209 struct iova_domain *iovad)
210{
211 struct pci_host_bridge *bridge = pci_find_host_bridge(dev->bus);
212 struct resource_entry *window;
213 unsigned long lo, hi;
214
215 resource_list_for_each_entry(window, &bridge->windows) {
216 if (resource_type(window->res) != IORESOURCE_MEM)
217 continue;
218
219 lo = iova_pfn(iovad, window->res->start - window->offset);
220 hi = iova_pfn(iovad, window->res->end - window->offset);
221 reserve_iova(iovad, lo, hi);
222 }
223}
224
232static int iova_reserve_iommu_regions(struct device *dev, 225static int iova_reserve_iommu_regions(struct device *dev,
233 struct iommu_domain *domain) 226 struct iommu_domain *domain)
234{ 227{
@@ -238,6 +231,9 @@ static int iova_reserve_iommu_regions(struct device *dev,
238 LIST_HEAD(resv_regions); 231 LIST_HEAD(resv_regions);
239 int ret = 0; 232 int ret = 0;
240 233
234 if (dev_is_pci(dev))
235 iova_reserve_pci_windows(to_pci_dev(dev), iovad);
236
241 iommu_get_resv_regions(dev, &resv_regions); 237 iommu_get_resv_regions(dev, &resv_regions);
242 list_for_each_entry(region, &resv_regions, list) { 238 list_for_each_entry(region, &resv_regions, list) {
243 unsigned long lo, hi; 239 unsigned long lo, hi;
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index accf58388bdb..460bed4fc5b1 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1345,7 +1345,7 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
1345 struct qi_desc desc; 1345 struct qi_desc desc;
1346 1346
1347 if (mask) { 1347 if (mask) {
1348 BUG_ON(addr & ((1 << (VTD_PAGE_SHIFT + mask)) - 1)); 1348 WARN_ON_ONCE(addr & ((1ULL << (VTD_PAGE_SHIFT + mask)) - 1));
1349 addr |= (1ULL << (VTD_PAGE_SHIFT + mask - 1)) - 1; 1349 addr |= (1ULL << (VTD_PAGE_SHIFT + mask - 1)) - 1;
1350 desc.high = QI_DEV_IOTLB_ADDR(addr) | QI_DEV_IOTLB_SIZE; 1350 desc.high = QI_DEV_IOTLB_ADDR(addr) | QI_DEV_IOTLB_SIZE;
1351 } else 1351 } else
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 66f69af2c219..3062a154a9fb 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -1136,7 +1136,7 @@ static void intel_ir_reconfigure_irte(struct irq_data *irqd, bool force)
1136 irte->dest_id = IRTE_DEST(cfg->dest_apicid); 1136 irte->dest_id = IRTE_DEST(cfg->dest_apicid);
1137 1137
1138 /* Update the hardware only if the interrupt is in remapped mode. */ 1138 /* Update the hardware only if the interrupt is in remapped mode. */
1139 if (!force || ir_data->irq_2_iommu.mode == IRQ_REMAPPING) 1139 if (force || ir_data->irq_2_iommu.mode == IRQ_REMAPPING)
1140 modify_irte(&ir_data->irq_2_iommu, irte); 1140 modify_irte(&ir_data->irq_2_iommu, irte);
1141} 1141}
1142 1142
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index 5fc8656c60f9..0468acfa131f 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -1098,7 +1098,7 @@ static int rk_iommu_of_xlate(struct device *dev,
1098 data->iommu = platform_get_drvdata(iommu_dev); 1098 data->iommu = platform_get_drvdata(iommu_dev);
1099 dev->archdata.iommu = data; 1099 dev->archdata.iommu = data;
1100 1100
1101 of_dev_put(iommu_dev); 1101 platform_device_put(iommu_dev);
1102 1102
1103 return 0; 1103 return 0;
1104} 1104}
@@ -1175,8 +1175,15 @@ static int rk_iommu_probe(struct platform_device *pdev)
1175 for (i = 0; i < iommu->num_clocks; ++i) 1175 for (i = 0; i < iommu->num_clocks; ++i)
1176 iommu->clocks[i].id = rk_iommu_clocks[i]; 1176 iommu->clocks[i].id = rk_iommu_clocks[i];
1177 1177
1178 /*
1179 * iommu clocks should be present for all new devices and devicetrees
1180 * but there are older devicetrees without clocks out in the wild.
1181 * So clocks as optional for the time being.
1182 */
1178 err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks); 1183 err = devm_clk_bulk_get(iommu->dev, iommu->num_clocks, iommu->clocks);
1179 if (err) 1184 if (err == -ENOENT)
1185 iommu->num_clocks = 0;
1186 else if (err)
1180 return err; 1187 return err;
1181 1188
1182 err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks); 1189 err = clk_bulk_prepare(iommu->num_clocks, iommu->clocks);
diff --git a/drivers/irqchip/qcom-irq-combiner.c b/drivers/irqchip/qcom-irq-combiner.c
index f31265937439..7f0c0be322e0 100644
--- a/drivers/irqchip/qcom-irq-combiner.c
+++ b/drivers/irqchip/qcom-irq-combiner.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 1/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
2 * 2 *
3 * This program is free software; you can redistribute it and/or modify 3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and 4 * it under the terms of the GNU General Public License version 2 and
@@ -68,7 +68,7 @@ static void combiner_handle_irq(struct irq_desc *desc)
68 68
69 bit = readl_relaxed(combiner->regs[reg].addr); 69 bit = readl_relaxed(combiner->regs[reg].addr);
70 status = bit & combiner->regs[reg].enabled; 70 status = bit & combiner->regs[reg].enabled;
71 if (!status) 71 if (bit && !status)
72 pr_warn_ratelimited("Unexpected IRQ on CPU%d: (%08x %08lx %p)\n", 72 pr_warn_ratelimited("Unexpected IRQ on CPU%d: (%08x %08lx %p)\n",
73 smp_processor_id(), bit, 73 smp_processor_id(), bit,
74 combiner->regs[reg].enabled, 74 combiner->regs[reg].enabled,
diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c
index 004cc3cc6123..7fa2631b422c 100644
--- a/drivers/md/bcache/alloc.c
+++ b/drivers/md/bcache/alloc.c
@@ -290,7 +290,7 @@ do { \
290 if (kthread_should_stop() || \ 290 if (kthread_should_stop() || \
291 test_bit(CACHE_SET_IO_DISABLE, &ca->set->flags)) { \ 291 test_bit(CACHE_SET_IO_DISABLE, &ca->set->flags)) { \
292 set_current_state(TASK_RUNNING); \ 292 set_current_state(TASK_RUNNING); \
293 return 0; \ 293 goto out; \
294 } \ 294 } \
295 \ 295 \
296 schedule(); \ 296 schedule(); \
@@ -378,6 +378,9 @@ retry_invalidate:
378 bch_prio_write(ca); 378 bch_prio_write(ca);
379 } 379 }
380 } 380 }
381out:
382 wait_for_kthread_stop();
383 return 0;
381} 384}
382 385
383/* Allocation */ 386/* Allocation */
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index d338b7086013..3a0cfb237af9 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -392,6 +392,8 @@ struct cached_dev {
392#define DEFAULT_CACHED_DEV_ERROR_LIMIT 64 392#define DEFAULT_CACHED_DEV_ERROR_LIMIT 64
393 atomic_t io_errors; 393 atomic_t io_errors;
394 unsigned error_limit; 394 unsigned error_limit;
395
396 char backing_dev_name[BDEVNAME_SIZE];
395}; 397};
396 398
397enum alloc_reserve { 399enum alloc_reserve {
@@ -464,6 +466,8 @@ struct cache {
464 atomic_long_t meta_sectors_written; 466 atomic_long_t meta_sectors_written;
465 atomic_long_t btree_sectors_written; 467 atomic_long_t btree_sectors_written;
466 atomic_long_t sectors_written; 468 atomic_long_t sectors_written;
469
470 char cache_dev_name[BDEVNAME_SIZE];
467}; 471};
468 472
469struct gc_stat { 473struct gc_stat {
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
index 028f7b386e01..4e63c6f6c04d 100644
--- a/drivers/md/bcache/debug.c
+++ b/drivers/md/bcache/debug.c
@@ -106,7 +106,6 @@ void bch_btree_verify(struct btree *b)
106 106
107void bch_data_verify(struct cached_dev *dc, struct bio *bio) 107void bch_data_verify(struct cached_dev *dc, struct bio *bio)
108{ 108{
109 char name[BDEVNAME_SIZE];
110 struct bio *check; 109 struct bio *check;
111 struct bio_vec bv, cbv; 110 struct bio_vec bv, cbv;
112 struct bvec_iter iter, citer = { 0 }; 111 struct bvec_iter iter, citer = { 0 };
@@ -134,7 +133,7 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
134 bv.bv_len), 133 bv.bv_len),
135 dc->disk.c, 134 dc->disk.c,
136 "verify failed at dev %s sector %llu", 135 "verify failed at dev %s sector %llu",
137 bdevname(dc->bdev, name), 136 dc->backing_dev_name,
138 (uint64_t) bio->bi_iter.bi_sector); 137 (uint64_t) bio->bi_iter.bi_sector);
139 138
140 kunmap_atomic(p1); 139 kunmap_atomic(p1);
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index 7fac97ae036e..2ddf8515e6a5 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -52,7 +52,6 @@ void bch_submit_bbio(struct bio *bio, struct cache_set *c,
52/* IO errors */ 52/* IO errors */
53void bch_count_backing_io_errors(struct cached_dev *dc, struct bio *bio) 53void bch_count_backing_io_errors(struct cached_dev *dc, struct bio *bio)
54{ 54{
55 char buf[BDEVNAME_SIZE];
56 unsigned errors; 55 unsigned errors;
57 56
58 WARN_ONCE(!dc, "NULL pointer of struct cached_dev"); 57 WARN_ONCE(!dc, "NULL pointer of struct cached_dev");
@@ -60,7 +59,7 @@ void bch_count_backing_io_errors(struct cached_dev *dc, struct bio *bio)
60 errors = atomic_add_return(1, &dc->io_errors); 59 errors = atomic_add_return(1, &dc->io_errors);
61 if (errors < dc->error_limit) 60 if (errors < dc->error_limit)
62 pr_err("%s: IO error on backing device, unrecoverable", 61 pr_err("%s: IO error on backing device, unrecoverable",
63 bio_devname(bio, buf)); 62 dc->backing_dev_name);
64 else 63 else
65 bch_cached_dev_error(dc); 64 bch_cached_dev_error(dc);
66} 65}
@@ -105,19 +104,18 @@ void bch_count_io_errors(struct cache *ca,
105 } 104 }
106 105
107 if (error) { 106 if (error) {
108 char buf[BDEVNAME_SIZE];
109 unsigned errors = atomic_add_return(1 << IO_ERROR_SHIFT, 107 unsigned errors = atomic_add_return(1 << IO_ERROR_SHIFT,
110 &ca->io_errors); 108 &ca->io_errors);
111 errors >>= IO_ERROR_SHIFT; 109 errors >>= IO_ERROR_SHIFT;
112 110
113 if (errors < ca->set->error_limit) 111 if (errors < ca->set->error_limit)
114 pr_err("%s: IO error on %s%s", 112 pr_err("%s: IO error on %s%s",
115 bdevname(ca->bdev, buf), m, 113 ca->cache_dev_name, m,
116 is_read ? ", recovering." : "."); 114 is_read ? ", recovering." : ".");
117 else 115 else
118 bch_cache_set_error(ca->set, 116 bch_cache_set_error(ca->set,
119 "%s: too many IO errors %s", 117 "%s: too many IO errors %s",
120 bdevname(ca->bdev, buf), m); 118 ca->cache_dev_name, m);
121 } 119 }
122} 120}
123 121
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index a65e3365eeb9..8e3e8655ed63 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -649,11 +649,8 @@ static void backing_request_endio(struct bio *bio)
649 */ 649 */
650 if (unlikely(s->iop.writeback && 650 if (unlikely(s->iop.writeback &&
651 bio->bi_opf & REQ_PREFLUSH)) { 651 bio->bi_opf & REQ_PREFLUSH)) {
652 char buf[BDEVNAME_SIZE];
653
654 bio_devname(bio, buf);
655 pr_err("Can't flush %s: returned bi_status %i", 652 pr_err("Can't flush %s: returned bi_status %i",
656 buf, bio->bi_status); 653 dc->backing_dev_name, bio->bi_status);
657 } else { 654 } else {
658 /* set to orig_bio->bi_status in bio_complete() */ 655 /* set to orig_bio->bi_status in bio_complete() */
659 s->iop.status = bio->bi_status; 656 s->iop.status = bio->bi_status;
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index d90d9e59ca00..3dea06b41d43 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -936,7 +936,6 @@ static void cancel_writeback_rate_update_dwork(struct cached_dev *dc)
936static void cached_dev_detach_finish(struct work_struct *w) 936static void cached_dev_detach_finish(struct work_struct *w)
937{ 937{
938 struct cached_dev *dc = container_of(w, struct cached_dev, detach); 938 struct cached_dev *dc = container_of(w, struct cached_dev, detach);
939 char buf[BDEVNAME_SIZE];
940 struct closure cl; 939 struct closure cl;
941 closure_init_stack(&cl); 940 closure_init_stack(&cl);
942 941
@@ -967,7 +966,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
967 966
968 mutex_unlock(&bch_register_lock); 967 mutex_unlock(&bch_register_lock);
969 968
970 pr_info("Caching disabled for %s", bdevname(dc->bdev, buf)); 969 pr_info("Caching disabled for %s", dc->backing_dev_name);
971 970
972 /* Drop ref we took in cached_dev_detach() */ 971 /* Drop ref we took in cached_dev_detach() */
973 closure_put(&dc->disk.cl); 972 closure_put(&dc->disk.cl);
@@ -999,29 +998,28 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
999{ 998{
1000 uint32_t rtime = cpu_to_le32(get_seconds()); 999 uint32_t rtime = cpu_to_le32(get_seconds());
1001 struct uuid_entry *u; 1000 struct uuid_entry *u;
1002 char buf[BDEVNAME_SIZE];
1003 struct cached_dev *exist_dc, *t; 1001 struct cached_dev *exist_dc, *t;
1004 1002
1005 bdevname(dc->bdev, buf);
1006
1007 if ((set_uuid && memcmp(set_uuid, c->sb.set_uuid, 16)) || 1003 if ((set_uuid && memcmp(set_uuid, c->sb.set_uuid, 16)) ||
1008 (!set_uuid && memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16))) 1004 (!set_uuid && memcmp(dc->sb.set_uuid, c->sb.set_uuid, 16)))
1009 return -ENOENT; 1005 return -ENOENT;
1010 1006
1011 if (dc->disk.c) { 1007 if (dc->disk.c) {
1012 pr_err("Can't attach %s: already attached", buf); 1008 pr_err("Can't attach %s: already attached",
1009 dc->backing_dev_name);
1013 return -EINVAL; 1010 return -EINVAL;
1014 } 1011 }
1015 1012
1016 if (test_bit(CACHE_SET_STOPPING, &c->flags)) { 1013 if (test_bit(CACHE_SET_STOPPING, &c->flags)) {
1017 pr_err("Can't attach %s: shutting down", buf); 1014 pr_err("Can't attach %s: shutting down",
1015 dc->backing_dev_name);
1018 return -EINVAL; 1016 return -EINVAL;
1019 } 1017 }
1020 1018
1021 if (dc->sb.block_size < c->sb.block_size) { 1019 if (dc->sb.block_size < c->sb.block_size) {
1022 /* Will die */ 1020 /* Will die */
1023 pr_err("Couldn't attach %s: block size less than set's block size", 1021 pr_err("Couldn't attach %s: block size less than set's block size",
1024 buf); 1022 dc->backing_dev_name);
1025 return -EINVAL; 1023 return -EINVAL;
1026 } 1024 }
1027 1025
@@ -1029,7 +1027,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
1029 list_for_each_entry_safe(exist_dc, t, &c->cached_devs, list) { 1027 list_for_each_entry_safe(exist_dc, t, &c->cached_devs, list) {
1030 if (!memcmp(dc->sb.uuid, exist_dc->sb.uuid, 16)) { 1028 if (!memcmp(dc->sb.uuid, exist_dc->sb.uuid, 16)) {
1031 pr_err("Tried to attach %s but duplicate UUID already attached", 1029 pr_err("Tried to attach %s but duplicate UUID already attached",
1032 buf); 1030 dc->backing_dev_name);
1033 1031
1034 return -EINVAL; 1032 return -EINVAL;
1035 } 1033 }
@@ -1047,13 +1045,15 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
1047 1045
1048 if (!u) { 1046 if (!u) {
1049 if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) { 1047 if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) {
1050 pr_err("Couldn't find uuid for %s in set", buf); 1048 pr_err("Couldn't find uuid for %s in set",
1049 dc->backing_dev_name);
1051 return -ENOENT; 1050 return -ENOENT;
1052 } 1051 }
1053 1052
1054 u = uuid_find_empty(c); 1053 u = uuid_find_empty(c);
1055 if (!u) { 1054 if (!u) {
1056 pr_err("Not caching %s, no room for UUID", buf); 1055 pr_err("Not caching %s, no room for UUID",
1056 dc->backing_dev_name);
1057 return -EINVAL; 1057 return -EINVAL;
1058 } 1058 }
1059 } 1059 }
@@ -1112,7 +1112,8 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
1112 up_write(&dc->writeback_lock); 1112 up_write(&dc->writeback_lock);
1113 1113
1114 pr_info("Caching %s as %s on set %pU", 1114 pr_info("Caching %s as %s on set %pU",
1115 bdevname(dc->bdev, buf), dc->disk.disk->disk_name, 1115 dc->backing_dev_name,
1116 dc->disk.disk->disk_name,
1116 dc->disk.c->sb.set_uuid); 1117 dc->disk.c->sb.set_uuid);
1117 return 0; 1118 return 0;
1118} 1119}
@@ -1225,10 +1226,10 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
1225 struct block_device *bdev, 1226 struct block_device *bdev,
1226 struct cached_dev *dc) 1227 struct cached_dev *dc)
1227{ 1228{
1228 char name[BDEVNAME_SIZE];
1229 const char *err = "cannot allocate memory"; 1229 const char *err = "cannot allocate memory";
1230 struct cache_set *c; 1230 struct cache_set *c;
1231 1231
1232 bdevname(bdev, dc->backing_dev_name);
1232 memcpy(&dc->sb, sb, sizeof(struct cache_sb)); 1233 memcpy(&dc->sb, sb, sizeof(struct cache_sb));
1233 dc->bdev = bdev; 1234 dc->bdev = bdev;
1234 dc->bdev->bd_holder = dc; 1235 dc->bdev->bd_holder = dc;
@@ -1237,6 +1238,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
1237 bio_first_bvec_all(&dc->sb_bio)->bv_page = sb_page; 1238 bio_first_bvec_all(&dc->sb_bio)->bv_page = sb_page;
1238 get_page(sb_page); 1239 get_page(sb_page);
1239 1240
1241
1240 if (cached_dev_init(dc, sb->block_size << 9)) 1242 if (cached_dev_init(dc, sb->block_size << 9))
1241 goto err; 1243 goto err;
1242 1244
@@ -1247,7 +1249,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
1247 if (bch_cache_accounting_add_kobjs(&dc->accounting, &dc->disk.kobj)) 1249 if (bch_cache_accounting_add_kobjs(&dc->accounting, &dc->disk.kobj))
1248 goto err; 1250 goto err;
1249 1251
1250 pr_info("registered backing device %s", bdevname(bdev, name)); 1252 pr_info("registered backing device %s", dc->backing_dev_name);
1251 1253
1252 list_add(&dc->list, &uncached_devices); 1254 list_add(&dc->list, &uncached_devices);
1253 list_for_each_entry(c, &bch_cache_sets, list) 1255 list_for_each_entry(c, &bch_cache_sets, list)
@@ -1259,7 +1261,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,
1259 1261
1260 return; 1262 return;
1261err: 1263err:
1262 pr_notice("error %s: %s", bdevname(bdev, name), err); 1264 pr_notice("error %s: %s", dc->backing_dev_name, err);
1263 bcache_device_stop(&dc->disk); 1265 bcache_device_stop(&dc->disk);
1264} 1266}
1265 1267
@@ -1367,7 +1369,7 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t size)
1367 1369
1368bool bch_cached_dev_error(struct cached_dev *dc) 1370bool bch_cached_dev_error(struct cached_dev *dc)
1369{ 1371{
1370 char name[BDEVNAME_SIZE]; 1372 struct cache_set *c;
1371 1373
1372 if (!dc || test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags)) 1374 if (!dc || test_bit(BCACHE_DEV_CLOSING, &dc->disk.flags))
1373 return false; 1375 return false;
@@ -1377,7 +1379,22 @@ bool bch_cached_dev_error(struct cached_dev *dc)
1377 smp_mb(); 1379 smp_mb();
1378 1380
1379 pr_err("stop %s: too many IO errors on backing device %s\n", 1381 pr_err("stop %s: too many IO errors on backing device %s\n",
1380 dc->disk.disk->disk_name, bdevname(dc->bdev, name)); 1382 dc->disk.disk->disk_name, dc->backing_dev_name);
1383
1384 /*
1385 * If the cached device is still attached to a cache set,
1386 * even dc->io_disable is true and no more I/O requests
1387 * accepted, cache device internal I/O (writeback scan or
1388 * garbage collection) may still prevent bcache device from
1389 * being stopped. So here CACHE_SET_IO_DISABLE should be
1390 * set to c->flags too, to make the internal I/O to cache
1391 * device rejected and stopped immediately.
1392 * If c is NULL, that means the bcache device is not attached
1393 * to any cache set, then no CACHE_SET_IO_DISABLE bit to set.
1394 */
1395 c = dc->disk.c;
1396 if (c && test_and_set_bit(CACHE_SET_IO_DISABLE, &c->flags))
1397 pr_info("CACHE_SET_IO_DISABLE already set");
1381 1398
1382 bcache_device_stop(&dc->disk); 1399 bcache_device_stop(&dc->disk);
1383 return true; 1400 return true;
@@ -1395,7 +1412,7 @@ bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...)
1395 return false; 1412 return false;
1396 1413
1397 if (test_and_set_bit(CACHE_SET_IO_DISABLE, &c->flags)) 1414 if (test_and_set_bit(CACHE_SET_IO_DISABLE, &c->flags))
1398 pr_warn("CACHE_SET_IO_DISABLE already set"); 1415 pr_info("CACHE_SET_IO_DISABLE already set");
1399 1416
1400 /* XXX: we can be called from atomic context 1417 /* XXX: we can be called from atomic context
1401 acquire_console_sem(); 1418 acquire_console_sem();
@@ -1539,6 +1556,20 @@ static void conditional_stop_bcache_device(struct cache_set *c,
1539 */ 1556 */
1540 pr_warn("stop_when_cache_set_failed of %s is \"auto\" and cache is dirty, stop it to avoid potential data corruption.", 1557 pr_warn("stop_when_cache_set_failed of %s is \"auto\" and cache is dirty, stop it to avoid potential data corruption.",
1541 d->disk->disk_name); 1558 d->disk->disk_name);
1559 /*
1560 * There might be a small time gap that cache set is
1561 * released but bcache device is not. Inside this time
1562 * gap, regular I/O requests will directly go into
1563 * backing device as no cache set attached to. This
1564 * behavior may also introduce potential inconsistence
1565 * data in writeback mode while cache is dirty.
1566 * Therefore before calling bcache_device_stop() due
1567 * to a broken cache device, dc->io_disable should be
1568 * explicitly set to true.
1569 */
1570 dc->io_disable = true;
1571 /* make others know io_disable is true earlier */
1572 smp_mb();
1542 bcache_device_stop(d); 1573 bcache_device_stop(d);
1543 } else { 1574 } else {
1544 /* 1575 /*
@@ -2003,12 +2034,10 @@ static int cache_alloc(struct cache *ca)
2003static int register_cache(struct cache_sb *sb, struct page *sb_page, 2034static int register_cache(struct cache_sb *sb, struct page *sb_page,
2004 struct block_device *bdev, struct cache *ca) 2035 struct block_device *bdev, struct cache *ca)
2005{ 2036{
2006 char name[BDEVNAME_SIZE];
2007 const char *err = NULL; /* must be set for any error case */ 2037 const char *err = NULL; /* must be set for any error case */
2008 int ret = 0; 2038 int ret = 0;
2009 2039
2010 bdevname(bdev, name); 2040 bdevname(bdev, ca->cache_dev_name);
2011
2012 memcpy(&ca->sb, sb, sizeof(struct cache_sb)); 2041 memcpy(&ca->sb, sb, sizeof(struct cache_sb));
2013 ca->bdev = bdev; 2042 ca->bdev = bdev;
2014 ca->bdev->bd_holder = ca; 2043 ca->bdev->bd_holder = ca;
@@ -2045,14 +2074,14 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,
2045 goto out; 2074 goto out;
2046 } 2075 }
2047 2076
2048 pr_info("registered cache device %s", name); 2077 pr_info("registered cache device %s", ca->cache_dev_name);
2049 2078
2050out: 2079out:
2051 kobject_put(&ca->kobj); 2080 kobject_put(&ca->kobj);
2052 2081
2053err: 2082err:
2054 if (err) 2083 if (err)
2055 pr_notice("error %s: %s", name, err); 2084 pr_notice("error %s: %s", ca->cache_dev_name, err);
2056 2085
2057 return ret; 2086 return ret;
2058} 2087}
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 4a9547cdcdc5..ad45ebe1a74b 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -244,8 +244,10 @@ static void dirty_endio(struct bio *bio)
244 struct keybuf_key *w = bio->bi_private; 244 struct keybuf_key *w = bio->bi_private;
245 struct dirty_io *io = w->private; 245 struct dirty_io *io = w->private;
246 246
247 if (bio->bi_status) 247 if (bio->bi_status) {
248 SET_KEY_DIRTY(&w->key, false); 248 SET_KEY_DIRTY(&w->key, false);
249 bch_count_backing_io_errors(io->dc, bio);
250 }
249 251
250 closure_put(&io->cl); 252 closure_put(&io->cl);
251} 253}
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 12aa9ca21d8c..dc385b70e4c3 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1681,8 +1681,9 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign
1681 1681
1682 if (block_size <= KMALLOC_MAX_SIZE && 1682 if (block_size <= KMALLOC_MAX_SIZE &&
1683 (block_size < PAGE_SIZE || !is_power_of_2(block_size))) { 1683 (block_size < PAGE_SIZE || !is_power_of_2(block_size))) {
1684 snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", c->block_size); 1684 unsigned align = min(1U << __ffs(block_size), (unsigned)PAGE_SIZE);
1685 c->slab_cache = kmem_cache_create(slab_name, c->block_size, ARCH_KMALLOC_MINALIGN, 1685 snprintf(slab_name, sizeof slab_name, "dm_bufio_cache-%u", block_size);
1686 c->slab_cache = kmem_cache_create(slab_name, block_size, align,
1686 SLAB_RECLAIM_ACCOUNT, NULL); 1687 SLAB_RECLAIM_ACCOUNT, NULL);
1687 if (!c->slab_cache) { 1688 if (!c->slab_cache) {
1688 r = -ENOMEM; 1689 r = -ENOMEM;
diff --git a/drivers/md/dm-cache-background-tracker.c b/drivers/md/dm-cache-background-tracker.c
index 1d0af0a21fc7..84814e819e4c 100644
--- a/drivers/md/dm-cache-background-tracker.c
+++ b/drivers/md/dm-cache-background-tracker.c
@@ -166,7 +166,7 @@ static bool max_work_reached(struct background_tracker *b)
166 atomic_read(&b->pending_demotes) >= b->max_work; 166 atomic_read(&b->pending_demotes) >= b->max_work;
167} 167}
168 168
169struct bt_work *alloc_work(struct background_tracker *b) 169static struct bt_work *alloc_work(struct background_tracker *b)
170{ 170{
171 if (max_work_reached(b)) 171 if (max_work_reached(b))
172 return NULL; 172 return NULL;
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 77d9fe58dae2..514fb4aec5d1 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -2440,7 +2440,7 @@ static void dm_integrity_free_journal_scatterlist(struct dm_integrity_c *ic, str
2440 unsigned i; 2440 unsigned i;
2441 for (i = 0; i < ic->journal_sections; i++) 2441 for (i = 0; i < ic->journal_sections; i++)
2442 kvfree(sl[i]); 2442 kvfree(sl[i]);
2443 kfree(sl); 2443 kvfree(sl);
2444} 2444}
2445 2445
2446static struct scatterlist **dm_integrity_alloc_journal_scatterlist(struct dm_integrity_c *ic, struct page_list *pl) 2446static struct scatterlist **dm_integrity_alloc_journal_scatterlist(struct dm_integrity_c *ic, struct page_list *pl)
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 580c49cc8079..5903e492bb34 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -23,6 +23,8 @@
23 23
24#define MAX_RECOVERY 1 /* Maximum number of regions recovered in parallel. */ 24#define MAX_RECOVERY 1 /* Maximum number of regions recovered in parallel. */
25 25
26#define MAX_NR_MIRRORS (DM_KCOPYD_MAX_REGIONS + 1)
27
26#define DM_RAID1_HANDLE_ERRORS 0x01 28#define DM_RAID1_HANDLE_ERRORS 0x01
27#define DM_RAID1_KEEP_LOG 0x02 29#define DM_RAID1_KEEP_LOG 0x02
28#define errors_handled(p) ((p)->features & DM_RAID1_HANDLE_ERRORS) 30#define errors_handled(p) ((p)->features & DM_RAID1_HANDLE_ERRORS)
@@ -255,7 +257,7 @@ static int mirror_flush(struct dm_target *ti)
255 unsigned long error_bits; 257 unsigned long error_bits;
256 258
257 unsigned int i; 259 unsigned int i;
258 struct dm_io_region io[ms->nr_mirrors]; 260 struct dm_io_region io[MAX_NR_MIRRORS];
259 struct mirror *m; 261 struct mirror *m;
260 struct dm_io_request io_req = { 262 struct dm_io_request io_req = {
261 .bi_op = REQ_OP_WRITE, 263 .bi_op = REQ_OP_WRITE,
@@ -651,7 +653,7 @@ static void write_callback(unsigned long error, void *context)
651static void do_write(struct mirror_set *ms, struct bio *bio) 653static void do_write(struct mirror_set *ms, struct bio *bio)
652{ 654{
653 unsigned int i; 655 unsigned int i;
654 struct dm_io_region io[ms->nr_mirrors], *dest = io; 656 struct dm_io_region io[MAX_NR_MIRRORS], *dest = io;
655 struct mirror *m; 657 struct mirror *m;
656 struct dm_io_request io_req = { 658 struct dm_io_request io_req = {
657 .bi_op = REQ_OP_WRITE, 659 .bi_op = REQ_OP_WRITE,
@@ -1083,7 +1085,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1083 argc -= args_used; 1085 argc -= args_used;
1084 1086
1085 if (!argc || sscanf(argv[0], "%u%c", &nr_mirrors, &dummy) != 1 || 1087 if (!argc || sscanf(argv[0], "%u%c", &nr_mirrors, &dummy) != 1 ||
1086 nr_mirrors < 2 || nr_mirrors > DM_KCOPYD_MAX_REGIONS + 1) { 1088 nr_mirrors < 2 || nr_mirrors > MAX_NR_MIRRORS) {
1087 ti->error = "Invalid number of mirrors"; 1089 ti->error = "Invalid number of mirrors";
1088 dm_dirty_log_destroy(dl); 1090 dm_dirty_log_destroy(dl);
1089 return -EINVAL; 1091 return -EINVAL;
@@ -1404,7 +1406,7 @@ static void mirror_status(struct dm_target *ti, status_type_t type,
1404 int num_feature_args = 0; 1406 int num_feature_args = 0;
1405 struct mirror_set *ms = (struct mirror_set *) ti->private; 1407 struct mirror_set *ms = (struct mirror_set *) ti->private;
1406 struct dm_dirty_log *log = dm_rh_dirty_log(ms->rh); 1408 struct dm_dirty_log *log = dm_rh_dirty_log(ms->rh);
1407 char buffer[ms->nr_mirrors + 1]; 1409 char buffer[MAX_NR_MIRRORS + 1];
1408 1410
1409 switch (type) { 1411 switch (type) {
1410 case STATUSTYPE_INFO: 1412 case STATUSTYPE_INFO:
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 4ea404dbcf0b..0a7b0107ca78 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1020,7 +1020,8 @@ int dm_set_target_max_io_len(struct dm_target *ti, sector_t len)
1020EXPORT_SYMBOL_GPL(dm_set_target_max_io_len); 1020EXPORT_SYMBOL_GPL(dm_set_target_max_io_len);
1021 1021
1022static struct dm_target *dm_dax_get_live_target(struct mapped_device *md, 1022static struct dm_target *dm_dax_get_live_target(struct mapped_device *md,
1023 sector_t sector, int *srcu_idx) 1023 sector_t sector, int *srcu_idx)
1024 __acquires(md->io_barrier)
1024{ 1025{
1025 struct dm_table *map; 1026 struct dm_table *map;
1026 struct dm_target *ti; 1027 struct dm_target *ti;
@@ -1037,7 +1038,7 @@ static struct dm_target *dm_dax_get_live_target(struct mapped_device *md,
1037} 1038}
1038 1039
1039static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, 1040static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff,
1040 long nr_pages, void **kaddr, pfn_t *pfn) 1041 long nr_pages, void **kaddr, pfn_t *pfn)
1041{ 1042{
1042 struct mapped_device *md = dax_get_private(dax_dev); 1043 struct mapped_device *md = dax_get_private(dax_dev);
1043 sector_t sector = pgoff * PAGE_SECTORS; 1044 sector_t sector = pgoff * PAGE_SECTORS;
@@ -1065,7 +1066,7 @@ static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff,
1065} 1066}
1066 1067
1067static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, 1068static size_t dm_dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff,
1068 void *addr, size_t bytes, struct iov_iter *i) 1069 void *addr, size_t bytes, struct iov_iter *i)
1069{ 1070{
1070 struct mapped_device *md = dax_get_private(dax_dev); 1071 struct mapped_device *md = dax_get_private(dax_dev);
1071 sector_t sector = pgoff * PAGE_SECTORS; 1072 sector_t sector = pgoff * PAGE_SECTORS;
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index e216cd768409..b07114b5efb2 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -20,7 +20,7 @@
20// 20//
21// VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl> 21// VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl>
22// 22//
23// Copyright (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org> 23// Copyright (c) 2005-2006 Mauro Carvalho Chehab <mchehab@kernel.org>
24// SAA7111, SAA7113 and SAA7118 support 24// SAA7111, SAA7113 and SAA7118 support
25 25
26#include "saa711x_regs.h" 26#include "saa711x_regs.h"
diff --git a/drivers/media/i2c/saa711x_regs.h b/drivers/media/i2c/saa711x_regs.h
index a50d480e101a..44fabe08234d 100644
--- a/drivers/media/i2c/saa711x_regs.h
+++ b/drivers/media/i2c/saa711x_regs.h
@@ -2,7 +2,7 @@
2 * SPDX-License-Identifier: GPL-2.0+ 2 * SPDX-License-Identifier: GPL-2.0+
3 * saa711x - Philips SAA711x video decoder register specifications 3 * saa711x - Philips SAA711x video decoder register specifications
4 * 4 *
5 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> 5 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@kernel.org>
6 */ 6 */
7 7
8#define R_00_CHIP_VERSION 0x00 8#define R_00_CHIP_VERSION 0x00
diff --git a/drivers/media/i2c/tda7432.c b/drivers/media/i2c/tda7432.c
index 1c5c61d829d6..9b4f21237810 100644
--- a/drivers/media/i2c/tda7432.c
+++ b/drivers/media/i2c/tda7432.c
@@ -8,7 +8,7 @@
8 * Muting and tone control by Jonathan Isom <jisom@ematic.com> 8 * Muting and tone control by Jonathan Isom <jisom@ematic.com>
9 * 9 *
10 * Copyright (c) 2000 Eric Sandeen <eric_sandeen@bigfoot.com> 10 * Copyright (c) 2000 Eric Sandeen <eric_sandeen@bigfoot.com>
11 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> 11 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@kernel.org>
12 * This code is placed under the terms of the GNU General Public License 12 * This code is placed under the terms of the GNU General Public License
13 * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu) 13 * Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu)
14 * Which was based on tda8425.c by Greg Alexander (c) 1998 14 * Which was based on tda8425.c by Greg Alexander (c) 1998
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 2476d812f669..1734ed4ede33 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -2,7 +2,7 @@
2// 2//
3// tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver 3// tvp5150 - Texas Instruments TVP5150A/AM1 and TVP5151 video decoder driver
4// 4//
5// Copyright (c) 2005,2006 Mauro Carvalho Chehab <mchehab@infradead.org> 5// Copyright (c) 2005,2006 Mauro Carvalho Chehab <mchehab@kernel.org>
6 6
7#include <dt-bindings/media/tvp5150.h> 7#include <dt-bindings/media/tvp5150.h>
8#include <linux/i2c.h> 8#include <linux/i2c.h>
diff --git a/drivers/media/i2c/tvp5150_reg.h b/drivers/media/i2c/tvp5150_reg.h
index c43b7b844021..d3a764cae1a0 100644
--- a/drivers/media/i2c/tvp5150_reg.h
+++ b/drivers/media/i2c/tvp5150_reg.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder registers 4 * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder registers
5 * 5 *
6 * Copyright (c) 2005,2006 Mauro Carvalho Chehab <mchehab@infradead.org> 6 * Copyright (c) 2005,2006 Mauro Carvalho Chehab <mchehab@kernel.org>
7 */ 7 */
8 8
9#define TVP5150_VD_IN_SRC_SEL_1 0x00 /* Video input source selection #1 */ 9#define TVP5150_VD_IN_SRC_SEL_1 0x00 /* Video input source selection #1 */
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index a26c1a3f7183..4599b7e28a8d 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -5,7 +5,7 @@
5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com> 5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
6 * 6 *
7 * This code is partially based upon the TVP5150 driver 7 * This code is partially based upon the TVP5150 driver
8 * written by Mauro Carvalho Chehab (mchehab@infradead.org), 8 * written by Mauro Carvalho Chehab <mchehab@kernel.org>,
9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com> 9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
10 * and the TVP7002 driver in the TI LSP 2.10.00.14. Revisions by 10 * and the TVP7002 driver in the TI LSP 2.10.00.14. Revisions by
11 * Muralidharan Karicheri and Snehaprabha Narnakaje (TI). 11 * Muralidharan Karicheri and Snehaprabha Narnakaje (TI).
diff --git a/drivers/media/i2c/tvp7002_reg.h b/drivers/media/i2c/tvp7002_reg.h
index 3c8c8b0a6a4c..7f56ba689dfe 100644
--- a/drivers/media/i2c/tvp7002_reg.h
+++ b/drivers/media/i2c/tvp7002_reg.h
@@ -5,7 +5,7 @@
5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com> 5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
6 * 6 *
7 * This code is partially based upon the TVP5150 driver 7 * This code is partially based upon the TVP5150 driver
8 * written by Mauro Carvalho Chehab (mchehab@infradead.org), 8 * written by Mauro Carvalho Chehab <mchehab@kernel.org>,
9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com> 9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
10 * and the TVP7002 driver in the TI LSP 2.10.00.14 10 * and the TVP7002 driver in the TI LSP 2.10.00.14
11 * 11 *
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index 67ac51eff15c..6b87a721dc49 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -4,7 +4,7 @@
4 * Copyright (C) 2010 Nokia Corporation 4 * Copyright (C) 2010 Nokia Corporation
5 * 5 *
6 * Based on drivers/media/video/v4l2_dev.c code authored by 6 * Based on drivers/media/video/v4l2_dev.c code authored by
7 * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2) 7 * Mauro Carvalho Chehab <mchehab@kernel.org> (version 2)
8 * Alan Cox, <alan@lxorguk.ukuu.org.uk> (version 1) 8 * Alan Cox, <alan@lxorguk.ukuu.org.uk> (version 1)
9 * 9 *
10 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 10 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
diff --git a/drivers/media/pci/bt8xx/bttv-audio-hook.c b/drivers/media/pci/bt8xx/bttv-audio-hook.c
index 9f1f9169fb5b..346fc7f58839 100644
--- a/drivers/media/pci/bt8xx/bttv-audio-hook.c
+++ b/drivers/media/pci/bt8xx/bttv-audio-hook.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Handlers for board audio hooks, splitted from bttv-cards 2 * Handlers for board audio hooks, splitted from bttv-cards
3 * 3 *
4 * Copyright (c) 2006 Mauro Carvalho Chehab (mchehab@infradead.org) 4 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@kernel.org>
5 * This code is placed under the terms of the GNU General Public License 5 * This code is placed under the terms of the GNU General Public License
6 */ 6 */
7 7
diff --git a/drivers/media/pci/bt8xx/bttv-audio-hook.h b/drivers/media/pci/bt8xx/bttv-audio-hook.h
index 159d07adeff8..be16a537a03a 100644
--- a/drivers/media/pci/bt8xx/bttv-audio-hook.h
+++ b/drivers/media/pci/bt8xx/bttv-audio-hook.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Handlers for board audio hooks, splitted from bttv-cards 2 * Handlers for board audio hooks, splitted from bttv-cards
3 * 3 *
4 * Copyright (c) 2006 Mauro Carvalho Chehab (mchehab@infradead.org) 4 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@kernel.org>
5 * This code is placed under the terms of the GNU General Public License 5 * This code is placed under the terms of the GNU General Public License
6 */ 6 */
7 7
diff --git a/drivers/media/pci/bt8xx/bttv-cards.c b/drivers/media/pci/bt8xx/bttv-cards.c
index 1902732f90e1..2616243b2c49 100644
--- a/drivers/media/pci/bt8xx/bttv-cards.c
+++ b/drivers/media/pci/bt8xx/bttv-cards.c
@@ -2447,7 +2447,7 @@ struct tvcard bttv_tvcards[] = {
2447 }, 2447 },
2448 /* ---- card 0x88---------------------------------- */ 2448 /* ---- card 0x88---------------------------------- */
2449 [BTTV_BOARD_ACORP_Y878F] = { 2449 [BTTV_BOARD_ACORP_Y878F] = {
2450 /* Mauro Carvalho Chehab <mchehab@infradead.org> */ 2450 /* Mauro Carvalho Chehab <mchehab@kernel.org> */
2451 .name = "Acorp Y878F", 2451 .name = "Acorp Y878F",
2452 .video_inputs = 3, 2452 .video_inputs = 3,
2453 /* .audio_inputs= 1, */ 2453 /* .audio_inputs= 1, */
@@ -2688,7 +2688,7 @@ struct tvcard bttv_tvcards[] = {
2688 }, 2688 },
2689 [BTTV_BOARD_ENLTV_FM_2] = { 2689 [BTTV_BOARD_ENLTV_FM_2] = {
2690 /* Encore TV Tuner Pro ENL TV-FM-2 2690 /* Encore TV Tuner Pro ENL TV-FM-2
2691 Mauro Carvalho Chehab <mchehab@infradead.org */ 2691 Mauro Carvalho Chehab <mchehab@kernel.org> */
2692 .name = "Encore ENL TV-FM-2", 2692 .name = "Encore ENL TV-FM-2",
2693 .video_inputs = 3, 2693 .video_inputs = 3,
2694 /* .audio_inputs= 1, */ 2694 /* .audio_inputs= 1, */
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index 707f57a9f940..de3f44b8dec6 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -13,7 +13,7 @@
13 (c) 2005-2006 Nickolay V. Shmyrev <nshmyrev@yandex.ru> 13 (c) 2005-2006 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
14 14
15 Fixes to be fully V4L2 compliant by 15 Fixes to be fully V4L2 compliant by
16 (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> 16 (c) 2006 Mauro Carvalho Chehab <mchehab@kernel.org>
17 17
18 Cropping and overscan support 18 Cropping and overscan support
19 Copyright (C) 2005, 2006 Michael H. Schimek <mschimek@gmx.at> 19 Copyright (C) 2005, 2006 Michael H. Schimek <mschimek@gmx.at>
diff --git a/drivers/media/pci/bt8xx/bttv-i2c.c b/drivers/media/pci/bt8xx/bttv-i2c.c
index eccd1e3d717a..c76823eb399d 100644
--- a/drivers/media/pci/bt8xx/bttv-i2c.c
+++ b/drivers/media/pci/bt8xx/bttv-i2c.c
@@ -8,7 +8,7 @@
8 & Marcus Metzler (mocm@thp.uni-koeln.de) 8 & Marcus Metzler (mocm@thp.uni-koeln.de)
9 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 9 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
10 10
11 (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> 11 (c) 2005 Mauro Carvalho Chehab <mchehab@kernel.org>
12 - Multituner support and i2c address binding 12 - Multituner support and i2c address binding
13 13
14 This program is free software; you can redistribute it and/or modify 14 This program is free software; you can redistribute it and/or modify
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c
index be49589a61d2..395ff9bba759 100644
--- a/drivers/media/pci/cx23885/cx23885-input.c
+++ b/drivers/media/pci/cx23885/cx23885-input.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2008 <srinivasa.deevi at conexant dot com> 13 * Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
14 * Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> 14 * Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
15 * Markus Rechberger <mrechberger@gmail.com> 15 * Markus Rechberger <mrechberger@gmail.com>
16 * Mauro Carvalho Chehab <mchehab@infradead.org> 16 * Mauro Carvalho Chehab <mchehab@kernel.org>
17 * Sascha Sommer <saschasommer@freenet.de> 17 * Sascha Sommer <saschasommer@freenet.de>
18 * Copyright (C) 2004, 2005 Chris Pascoe 18 * Copyright (C) 2004, 2005 Chris Pascoe
19 * Copyright (C) 2003, 2004 Gerd Knorr 19 * Copyright (C) 2003, 2004 Gerd Knorr
diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c
index ab09bb55cf45..8a28fda703a2 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (c) 2007 Trent Piepho <xyzzy@speakeasy.org> 5 * (c) 2007 Trent Piepho <xyzzy@speakeasy.org>
6 * (c) 2005,2006 Ricardo Cerqueira <v4l@cerqueira.org> 6 * (c) 2005,2006 Ricardo Cerqueira <v4l@cerqueira.org>
7 * (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> 7 * (c) 2005 Mauro Carvalho Chehab <mchehab@kernel.org>
8 * Based on a dummy cx88 module by Gerd Knorr <kraxel@bytesex.org> 8 * Based on a dummy cx88 module by Gerd Knorr <kraxel@bytesex.org>
9 * Based on dummy.c by Jaroslav Kysela <perex@perex.cz> 9 * Based on dummy.c by Jaroslav Kysela <perex@perex.cz>
10 * 10 *
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(index, "Index value for cx88x capture interface(s).");
103 103
104MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards"); 104MODULE_DESCRIPTION("ALSA driver module for cx2388x based TV cards");
105MODULE_AUTHOR("Ricardo Cerqueira"); 105MODULE_AUTHOR("Ricardo Cerqueira");
106MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 106MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
107MODULE_LICENSE("GPL"); 107MODULE_LICENSE("GPL");
108MODULE_VERSION(CX88_VERSION); 108MODULE_VERSION(CX88_VERSION);
109 109
diff --git a/drivers/media/pci/cx88/cx88-blackbird.c b/drivers/media/pci/cx88/cx88-blackbird.c
index 0e0952e60795..7a4876cf9f08 100644
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -5,7 +5,7 @@
5 * (c) 2004 Jelle Foks <jelle@foks.us> 5 * (c) 2004 Jelle Foks <jelle@foks.us>
6 * (c) 2004 Gerd Knorr <kraxel@bytesex.org> 6 * (c) 2004 Gerd Knorr <kraxel@bytesex.org>
7 * 7 *
8 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org> 8 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@kernel.org>
9 * - video_ioctl2 conversion 9 * - video_ioctl2 conversion
10 * 10 *
11 * Includes parts from the ivtv driver <http://sourceforge.net/projects/ivtv/> 11 * Includes parts from the ivtv driver <http://sourceforge.net/projects/ivtv/>
diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c
index 8bfa5b7ed91b..60988e95b637 100644
--- a/drivers/media/pci/cx88/cx88-core.c
+++ b/drivers/media/pci/cx88/cx88-core.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 5 * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
6 * 6 *
7 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org> 7 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@kernel.org>
8 * - Multituner support 8 * - Multituner support
9 * - video_ioctl2 conversion 9 * - video_ioctl2 conversion
10 * - PAL/M fixes 10 * - PAL/M fixes
diff --git a/drivers/media/pci/cx88/cx88-i2c.c b/drivers/media/pci/cx88/cx88-i2c.c
index f7692775fb5a..99f88a05a7c9 100644
--- a/drivers/media/pci/cx88/cx88-i2c.c
+++ b/drivers/media/pci/cx88/cx88-i2c.c
@@ -8,7 +8,7 @@
8 * (c) 2002 Yurij Sysoev <yurij@naturesoft.net> 8 * (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
9 * (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 9 * (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
10 * 10 *
11 * (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> 11 * (c) 2005 Mauro Carvalho Chehab <mchehab@kernel.org>
12 * - Multituner support and i2c address binding 12 * - Multituner support and i2c address binding
13 * 13 *
14 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
index 9be682cdb644..7b113bad70d2 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * (c) 2003-04 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] 6 * (c) 2003-04 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7 * 7 *
8 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org> 8 * (c) 2005-2006 Mauro Carvalho Chehab <mchehab@kernel.org>
9 * - Multituner support 9 * - Multituner support
10 * - video_ioctl2 conversion 10 * - video_ioctl2 conversion
11 * - PAL/M fixes 11 * - PAL/M fixes
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 5ef635e72e10..4c52ac6d8bc5 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -4,7 +4,7 @@
4 * Copyright 1997 M. Kirkwood 4 * Copyright 1997 M. Kirkwood
5 * 5 *
6 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com> 6 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com>
7 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 7 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
8 * Converted to new API by Alan Cox <alan@lxorguk.ukuu.org.uk> 8 * Converted to new API by Alan Cox <alan@lxorguk.ukuu.org.uk>
9 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org> 9 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
10 * 10 *
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c
index 9e12c6027359..840b7d60462b 100644
--- a/drivers/media/radio/radio-aztech.c
+++ b/drivers/media/radio/radio-aztech.c
@@ -2,7 +2,7 @@
2 * radio-aztech.c - Aztech radio card driver 2 * radio-aztech.c - Aztech radio card driver
3 * 3 *
4 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@xs4all.nl> 4 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@xs4all.nl>
5 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 5 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
6 * Adapted to support the Video for Linux API by 6 * Adapted to support the Video for Linux API by
7 * Russell Kroll <rkroll@exploits.org>. Based on original tuner code by: 7 * Russell Kroll <rkroll@exploits.org>. Based on original tuner code by:
8 * 8 *
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c
index 3ff4c4e1435f..f051f8694ab9 100644
--- a/drivers/media/radio/radio-gemtek.c
+++ b/drivers/media/radio/radio-gemtek.c
@@ -15,7 +15,7 @@
15 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org> 15 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
16 * 16 *
17 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com> 17 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com>
18 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 18 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
19 * 19 *
20 * Note: this card seems to swap the left and right audio channels! 20 * Note: this card seems to swap the left and right audio channels!
21 * 21 *
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 95f06f3b35dc..e4e758739246 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -27,7 +27,7 @@
27 * BUGS: 27 * BUGS:
28 * - card unmutes if you change frequency 28 * - card unmutes if you change frequency
29 * 29 *
30 * (c) 2006, 2007 by Mauro Carvalho Chehab <mchehab@infradead.org>: 30 * (c) 2006, 2007 by Mauro Carvalho Chehab <mchehab@kernel.org>:
31 * - Conversion to V4L2 API 31 * - Conversion to V4L2 API
32 * - Uses video_ioctl2 for parsing and to add debug support 32 * - Uses video_ioctl2 for parsing and to add debug support
33 */ 33 */
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c
index abeaedd8d437..5a1470eb753e 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -7,7 +7,7 @@
7 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org> 7 * Various bugfixes and enhancements by Russell Kroll <rkroll@exploits.org>
8 * 8 *
9 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com> 9 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com>
10 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 10 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
11 * 11 *
12 * Fully tested with actual hardware and the v4l2-compliance tool. 12 * Fully tested with actual hardware and the v4l2-compliance tool.
13 */ 13 */
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index fc4e63d36e4c..4f9b97edd9eb 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -13,7 +13,7 @@
13 * No volume control - only mute/unmute - you have to use line volume 13 * No volume control - only mute/unmute - you have to use line volume
14 * control on SB-part of SF16-FMI/SF16-FMP/SF16-FMD 14 * control on SB-part of SF16-FMI/SF16-FMP/SF16-FMD
15 * 15 *
16 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 16 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
17 */ 17 */
18 18
19#include <linux/kernel.h> /* __setup */ 19#include <linux/kernel.h> /* __setup */
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c
index 4f116ea294fb..1af8f29cc7d1 100644
--- a/drivers/media/radio/radio-terratec.c
+++ b/drivers/media/radio/radio-terratec.c
@@ -17,7 +17,7 @@
17 * Volume Control is done digitally 17 * Volume Control is done digitally
18 * 18 *
19 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com> 19 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com>
20 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 20 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
21 */ 21 */
22 22
23#include <linux/module.h> /* Modules */ 23#include <linux/module.h> /* Modules */
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c
index 26a8c6002121..a4bad322ffff 100644
--- a/drivers/media/radio/radio-trust.c
+++ b/drivers/media/radio/radio-trust.c
@@ -12,7 +12,7 @@
12 * Scott McGrath (smcgrath@twilight.vtc.vsc.edu) 12 * Scott McGrath (smcgrath@twilight.vtc.vsc.edu)
13 * William McGrath (wmcgrath@twilight.vtc.vsc.edu) 13 * William McGrath (wmcgrath@twilight.vtc.vsc.edu)
14 * 14 *
15 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 15 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
16 */ 16 */
17 17
18#include <stdarg.h> 18#include <stdarg.h>
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
index eb72a4d13758..d0d67ad85b8f 100644
--- a/drivers/media/radio/radio-typhoon.c
+++ b/drivers/media/radio/radio-typhoon.c
@@ -25,7 +25,7 @@
25 * The frequency change is necessary since the card never seems to be 25 * The frequency change is necessary since the card never seems to be
26 * completely silent. 26 * completely silent.
27 * 27 *
28 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@infradead.org> 28 * Converted to V4L2 API by Mauro Carvalho Chehab <mchehab@kernel.org>
29 */ 29 */
30 30
31#include <linux/module.h> /* Modules */ 31#include <linux/module.h> /* Modules */
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c
index 026e88eef29c..6007cd09b328 100644
--- a/drivers/media/radio/radio-zoltrix.c
+++ b/drivers/media/radio/radio-zoltrix.c
@@ -27,7 +27,7 @@
27 * 2002-07-15 - Fix Stereo typo 27 * 2002-07-15 - Fix Stereo typo
28 * 28 *
29 * 2006-07-24 - Converted to V4L2 API 29 * 2006-07-24 - Converted to V4L2 API
30 * by Mauro Carvalho Chehab <mchehab@infradead.org> 30 * by Mauro Carvalho Chehab <mchehab@kernel.org>
31 * 31 *
32 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com> 32 * Converted to the radio-isa framework by Hans Verkuil <hans.verkuil@cisco.com>
33 * 33 *
diff --git a/drivers/media/rc/keymaps/rc-avermedia-m135a.c b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
index f6977df1a75b..d275d98d066a 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-m135a.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
@@ -12,7 +12,7 @@
12 * 12 *
13 * On Avermedia M135A with IR model RM-JX, the same codes exist on both 13 * On Avermedia M135A with IR model RM-JX, the same codes exist on both
14 * Positivo (BR) and original IR, initial version and remote control codes 14 * Positivo (BR) and original IR, initial version and remote control codes
15 * added by Mauro Carvalho Chehab <mchehab@infradead.org> 15 * added by Mauro Carvalho Chehab <mchehab@kernel.org>
16 * 16 *
17 * Positivo also ships Avermedia M135A with model RM-K6, extra control 17 * Positivo also ships Avermedia M135A with model RM-K6, extra control
18 * codes added by Herton Ronaldo Krzesinski <herton@mandriva.com.br> 18 * codes added by Herton Ronaldo Krzesinski <herton@mandriva.com.br>
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c
index e4e78c1f4123..057c13b765ef 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv-fm53.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10 10
11/* Encore ENLTV-FM v5.3 11/* Encore ENLTV-FM v5.3
12 Mauro Carvalho Chehab <mchehab@infradead.org> 12 Mauro Carvalho Chehab <mchehab@kernel.org>
13 */ 13 */
14 14
15static struct rc_map_table encore_enltv_fm53[] = { 15static struct rc_map_table encore_enltv_fm53[] = {
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv2.c b/drivers/media/rc/keymaps/rc-encore-enltv2.c
index c3d4437a6fda..cd0555924456 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv2.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv2.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10 10
11/* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton 11/* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton
12 Mauro Carvalho Chehab <mchehab@infradead.org> */ 12 Mauro Carvalho Chehab <mchehab@kernel.org> */
13 13
14static struct rc_map_table encore_enltv2[] = { 14static struct rc_map_table encore_enltv2[] = {
15 { 0x4c, KEY_POWER2 }, 15 { 0x4c, KEY_POWER2 },
diff --git a/drivers/media/rc/keymaps/rc-kaiomy.c b/drivers/media/rc/keymaps/rc-kaiomy.c
index f0f88df18606..a00051339842 100644
--- a/drivers/media/rc/keymaps/rc-kaiomy.c
+++ b/drivers/media/rc/keymaps/rc-kaiomy.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10 10
11/* Kaiomy TVnPC U2 11/* Kaiomy TVnPC U2
12 Mauro Carvalho Chehab <mchehab@infradead.org> 12 Mauro Carvalho Chehab <mchehab@kernel.org>
13 */ 13 */
14 14
15static struct rc_map_table kaiomy[] = { 15static struct rc_map_table kaiomy[] = {
diff --git a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
index 453e04377de7..db5edde3eeb1 100644
--- a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
+++ b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10 10
11/* Kworld Plus TV Analog Lite PCI IR 11/* Kworld Plus TV Analog Lite PCI IR
12 Mauro Carvalho Chehab <mchehab@infradead.org> 12 Mauro Carvalho Chehab <mchehab@kernel.org>
13 */ 13 */
14 14
15static struct rc_map_table kworld_plus_tv_analog[] = { 15static struct rc_map_table kworld_plus_tv_analog[] = {
diff --git a/drivers/media/rc/keymaps/rc-pixelview-new.c b/drivers/media/rc/keymaps/rc-pixelview-new.c
index 791130f108ff..e4e34f2ccf74 100644
--- a/drivers/media/rc/keymaps/rc-pixelview-new.c
+++ b/drivers/media/rc/keymaps/rc-pixelview-new.c
@@ -9,7 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10 10
11/* 11/*
12 Mauro Carvalho Chehab <mchehab@infradead.org> 12 Mauro Carvalho Chehab <mchehab@kernel.org>
13 present on PV MPEG 8000GT 13 present on PV MPEG 8000GT
14 */ 14 */
15 15
diff --git a/drivers/media/tuners/tea5761.c b/drivers/media/tuners/tea5761.c
index 88b3e80c38ad..d78a2bdb3e36 100644
--- a/drivers/media/tuners/tea5761.c
+++ b/drivers/media/tuners/tea5761.c
@@ -2,7 +2,7 @@
2// For Philips TEA5761 FM Chip 2// For Philips TEA5761 FM Chip
3// I2C address is always 0x20 (0x10 at 7-bit mode). 3// I2C address is always 0x20 (0x10 at 7-bit mode).
4// 4//
5// Copyright (c) 2005-2007 Mauro Carvalho Chehab (mchehab@infradead.org) 5// Copyright (c) 2005-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
6 6
7#include <linux/i2c.h> 7#include <linux/i2c.h>
8#include <linux/slab.h> 8#include <linux/slab.h>
@@ -337,5 +337,5 @@ EXPORT_SYMBOL_GPL(tea5761_attach);
337EXPORT_SYMBOL_GPL(tea5761_autodetection); 337EXPORT_SYMBOL_GPL(tea5761_autodetection);
338 338
339MODULE_DESCRIPTION("Philips TEA5761 FM tuner driver"); 339MODULE_DESCRIPTION("Philips TEA5761 FM tuner driver");
340MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 340MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
341MODULE_LICENSE("GPL v2"); 341MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/tuners/tea5767.c b/drivers/media/tuners/tea5767.c
index 2b2c064d7dc3..016d0d5ec50b 100644
--- a/drivers/media/tuners/tea5767.c
+++ b/drivers/media/tuners/tea5767.c
@@ -2,7 +2,7 @@
2// For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview 2// For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
3// I2C address is always 0xC0. 3// I2C address is always 0xC0.
4// 4//
5// Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@infradead.org) 5// Copyright (c) 2005 Mauro Carvalho Chehab <mchehab@kernel.org>
6// 6//
7// tea5767 autodetection thanks to Torsten Seeboth and Atsushi Nakagawa 7// tea5767 autodetection thanks to Torsten Seeboth and Atsushi Nakagawa
8// from their contributions on DScaler. 8// from their contributions on DScaler.
@@ -469,5 +469,5 @@ EXPORT_SYMBOL_GPL(tea5767_attach);
469EXPORT_SYMBOL_GPL(tea5767_autodetection); 469EXPORT_SYMBOL_GPL(tea5767_autodetection);
470 470
471MODULE_DESCRIPTION("Philips TEA5767 FM tuner driver"); 471MODULE_DESCRIPTION("Philips TEA5767 FM tuner driver");
472MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 472MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
473MODULE_LICENSE("GPL v2"); 473MODULE_LICENSE("GPL v2");
diff --git a/drivers/media/tuners/tuner-xc2028-types.h b/drivers/media/tuners/tuner-xc2028-types.h
index bb0437c36c03..50d017a4822a 100644
--- a/drivers/media/tuners/tuner-xc2028-types.h
+++ b/drivers/media/tuners/tuner-xc2028-types.h
@@ -5,7 +5,7 @@
5 * This file includes internal tipes to be used inside tuner-xc2028. 5 * This file includes internal tipes to be used inside tuner-xc2028.
6 * Shouldn't be included outside tuner-xc2028 6 * Shouldn't be included outside tuner-xc2028
7 * 7 *
8 * Copyright (c) 2007-2008 Mauro Carvalho Chehab (mchehab@infradead.org) 8 * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
9 */ 9 */
10 10
11/* xc3028 firmware types */ 11/* xc3028 firmware types */
diff --git a/drivers/media/tuners/tuner-xc2028.c b/drivers/media/tuners/tuner-xc2028.c
index fca85e08ebd7..84744e138982 100644
--- a/drivers/media/tuners/tuner-xc2028.c
+++ b/drivers/media/tuners/tuner-xc2028.c
@@ -1,7 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// tuner-xc2028 2// tuner-xc2028
3// 3//
4// Copyright (c) 2007-2008 Mauro Carvalho Chehab (mchehab@infradead.org) 4// Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
5// 5//
6// Copyright (c) 2007 Michel Ludwig (michel.ludwig@gmail.com) 6// Copyright (c) 2007 Michel Ludwig (michel.ludwig@gmail.com)
7// - frontend interface 7// - frontend interface
@@ -1518,7 +1518,7 @@ EXPORT_SYMBOL(xc2028_attach);
1518 1518
1519MODULE_DESCRIPTION("Xceive xc2028/xc3028 tuner driver"); 1519MODULE_DESCRIPTION("Xceive xc2028/xc3028 tuner driver");
1520MODULE_AUTHOR("Michel Ludwig <michel.ludwig@gmail.com>"); 1520MODULE_AUTHOR("Michel Ludwig <michel.ludwig@gmail.com>");
1521MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 1521MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
1522MODULE_LICENSE("GPL v2"); 1522MODULE_LICENSE("GPL v2");
1523MODULE_FIRMWARE(XC2028_DEFAULT_FIRMWARE); 1523MODULE_FIRMWARE(XC2028_DEFAULT_FIRMWARE);
1524MODULE_FIRMWARE(XC3028L_DEFAULT_FIRMWARE); 1524MODULE_FIRMWARE(XC3028L_DEFAULT_FIRMWARE);
diff --git a/drivers/media/tuners/tuner-xc2028.h b/drivers/media/tuners/tuner-xc2028.h
index 03fd6d4233a4..7b58bc06e35c 100644
--- a/drivers/media/tuners/tuner-xc2028.h
+++ b/drivers/media/tuners/tuner-xc2028.h
@@ -2,7 +2,7 @@
2 * SPDX-License-Identifier: GPL-2.0 2 * SPDX-License-Identifier: GPL-2.0
3 * tuner-xc2028 3 * tuner-xc2028
4 * 4 *
5 * Copyright (c) 2007-2008 Mauro Carvalho Chehab (mchehab@infradead.org) 5 * Copyright (c) 2007-2008 Mauro Carvalho Chehab <mchehab@kernel.org>
6 */ 6 */
7 7
8#ifndef __TUNER_XC2028_H__ 8#ifndef __TUNER_XC2028_H__
diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c
index 3c2694a16ed1..d1e66b503f4d 100644
--- a/drivers/media/usb/em28xx/em28xx-camera.c
+++ b/drivers/media/usb/em28xx/em28xx-camera.c
@@ -2,7 +2,7 @@
2// 2//
3// em28xx-camera.c - driver for Empia EM25xx/27xx/28xx USB video capture devices 3// em28xx-camera.c - driver for Empia EM25xx/27xx/28xx USB video capture devices
4// 4//
5// Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@infradead.org> 5// Copyright (C) 2009 Mauro Carvalho Chehab <mchehab@kernel.org>
6// Copyright (C) 2013 Frank Schäfer <fschaefer.oss@googlemail.com> 6// Copyright (C) 2013 Frank Schäfer <fschaefer.oss@googlemail.com>
7// 7//
8// This program is free software; you can redistribute it and/or modify 8// This program is free software; you can redistribute it and/or modify
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 6e0e67d23876..7c3203d7044b 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -5,7 +5,7 @@
5// 5//
6// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> 6// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
7// Markus Rechberger <mrechberger@gmail.com> 7// Markus Rechberger <mrechberger@gmail.com>
8// Mauro Carvalho Chehab <mchehab@infradead.org> 8// Mauro Carvalho Chehab <mchehab@kernel.org>
9// Sascha Sommer <saschasommer@freenet.de> 9// Sascha Sommer <saschasommer@freenet.de>
10// Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com> 10// Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
11// 11//
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 36d341fb65dd..f28995383090 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -4,7 +4,7 @@
4// 4//
5// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> 5// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6// Markus Rechberger <mrechberger@gmail.com> 6// Markus Rechberger <mrechberger@gmail.com>
7// Mauro Carvalho Chehab <mchehab@infradead.org> 7// Mauro Carvalho Chehab <mchehab@kernel.org>
8// Sascha Sommer <saschasommer@freenet.de> 8// Sascha Sommer <saschasommer@freenet.de>
9// Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com> 9// Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
10// 10//
@@ -32,7 +32,7 @@
32 32
33#define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ 33#define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \
34 "Markus Rechberger <mrechberger@gmail.com>, " \ 34 "Markus Rechberger <mrechberger@gmail.com>, " \
35 "Mauro Carvalho Chehab <mchehab@infradead.org>, " \ 35 "Mauro Carvalho Chehab <mchehab@kernel.org>, " \
36 "Sascha Sommer <saschasommer@freenet.de>" 36 "Sascha Sommer <saschasommer@freenet.de>"
37 37
38MODULE_AUTHOR(DRIVER_AUTHOR); 38MODULE_AUTHOR(DRIVER_AUTHOR);
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index a54cb8dc52c9..3f493e0b0716 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -2,7 +2,7 @@
2// 2//
3// DVB device driver for em28xx 3// DVB device driver for em28xx
4// 4//
5// (c) 2008-2011 Mauro Carvalho Chehab <mchehab@infradead.org> 5// (c) 2008-2011 Mauro Carvalho Chehab <mchehab@kernel.org>
6// 6//
7// (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com> 7// (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
8// - Fixes for the driver to properly work with HVR-950 8// - Fixes for the driver to properly work with HVR-950
@@ -63,7 +63,7 @@
63#include "tc90522.h" 63#include "tc90522.h"
64#include "qm1d1c0042.h" 64#include "qm1d1c0042.h"
65 65
66MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 66MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
67MODULE_LICENSE("GPL v2"); 67MODULE_LICENSE("GPL v2");
68MODULE_DESCRIPTION(DRIVER_DESC " - digital TV interface"); 68MODULE_DESCRIPTION(DRIVER_DESC " - digital TV interface");
69MODULE_VERSION(EM28XX_VERSION); 69MODULE_VERSION(EM28XX_VERSION);
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index 9151bccd859a..6458682bc6e2 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -4,7 +4,7 @@
4// 4//
5// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> 5// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6// Markus Rechberger <mrechberger@gmail.com> 6// Markus Rechberger <mrechberger@gmail.com>
7// Mauro Carvalho Chehab <mchehab@infradead.org> 7// Mauro Carvalho Chehab <mchehab@kernel.org>
8// Sascha Sommer <saschasommer@freenet.de> 8// Sascha Sommer <saschasommer@freenet.de>
9// Copyright (C) 2013 Frank Schäfer <fschaefer.oss@googlemail.com> 9// Copyright (C) 2013 Frank Schäfer <fschaefer.oss@googlemail.com>
10// 10//
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index 2dc1be00b8b8..f84a1208d5d3 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -4,7 +4,7 @@
4// 4//
5// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> 5// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
6// Markus Rechberger <mrechberger@gmail.com> 6// Markus Rechberger <mrechberger@gmail.com>
7// Mauro Carvalho Chehab <mchehab@infradead.org> 7// Mauro Carvalho Chehab <mchehab@kernel.org>
8// Sascha Sommer <saschasommer@freenet.de> 8// Sascha Sommer <saschasommer@freenet.de>
9// 9//
10// This program is free software; you can redistribute it and/or modify 10// This program is free software; you can redistribute it and/or modify
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index d70ee13cc52e..68571bf36d28 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -5,7 +5,7 @@
5// 5//
6// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it> 6// Copyright (C) 2005 Ludovico Cavedon <cavedon@sssup.it>
7// Markus Rechberger <mrechberger@gmail.com> 7// Markus Rechberger <mrechberger@gmail.com>
8// Mauro Carvalho Chehab <mchehab@infradead.org> 8// Mauro Carvalho Chehab <mchehab@kernel.org>
9// Sascha Sommer <saschasommer@freenet.de> 9// Sascha Sommer <saschasommer@freenet.de>
10// Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com> 10// Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
11// 11//
@@ -44,7 +44,7 @@
44 44
45#define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ 45#define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \
46 "Markus Rechberger <mrechberger@gmail.com>, " \ 46 "Markus Rechberger <mrechberger@gmail.com>, " \
47 "Mauro Carvalho Chehab <mchehab@infradead.org>, " \ 47 "Mauro Carvalho Chehab <mchehab@kernel.org>, " \
48 "Sascha Sommer <saschasommer@freenet.de>" 48 "Sascha Sommer <saschasommer@freenet.de>"
49 49
50static unsigned int isoc_debug; 50static unsigned int isoc_debug;
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 63c7c6124707..b0378e77ddff 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com> 5 * Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com>
6 * Ludovico Cavedon <cavedon@sssup.it> 6 * Ludovico Cavedon <cavedon@sssup.it>
7 * Mauro Carvalho Chehab <mchehab@infradead.org> 7 * Mauro Carvalho Chehab <mchehab@kernel.org>
8 * Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com> 8 * Copyright (C) 2012 Frank Schäfer <fschaefer.oss@googlemail.com>
9 * 9 *
10 * Based on the em2800 driver from Sascha Sommer <saschasommer@freenet.de> 10 * Based on the em2800 driver from Sascha Sommer <saschasommer@freenet.de>
diff --git a/drivers/media/usb/gspca/zc3xx-reg.h b/drivers/media/usb/gspca/zc3xx-reg.h
index a1bd94e8ce52..71fda38e85e0 100644
--- a/drivers/media/usb/gspca/zc3xx-reg.h
+++ b/drivers/media/usb/gspca/zc3xx-reg.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * zc030x registers 2 * zc030x registers
3 * 3 *
4 * Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@infradead.org> 4 * Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@kernel.org>
5 * 5 *
6 * The register aliases used here came from this driver: 6 * The register aliases used here came from this driver:
7 * http://zc0302.sourceforge.net/zc0302.php 7 * http://zc0302.sourceforge.net/zc0302.php
diff --git a/drivers/media/usb/tm6000/tm6000-cards.c b/drivers/media/usb/tm6000/tm6000-cards.c
index 70939e96b856..23df50aa0a4a 100644
--- a/drivers/media/usb/tm6000/tm6000-cards.c
+++ b/drivers/media/usb/tm6000/tm6000-cards.c
@@ -1,7 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// tm6000-cards.c - driver for TM5600/TM6000/TM6010 USB video capture devices 2// tm6000-cards.c - driver for TM5600/TM6000/TM6010 USB video capture devices
3// 3//
4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
5 5
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/module.h> 7#include <linux/module.h>
diff --git a/drivers/media/usb/tm6000/tm6000-core.c b/drivers/media/usb/tm6000/tm6000-core.c
index 23a1332d98e6..d3229aa45fcb 100644
--- a/drivers/media/usb/tm6000/tm6000-core.c
+++ b/drivers/media/usb/tm6000/tm6000-core.c
@@ -1,7 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// tm6000-core.c - driver for TM5600/TM6000/TM6010 USB video capture devices 2// tm6000-core.c - driver for TM5600/TM6000/TM6010 USB video capture devices
3// 3//
4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
5// 5//
6// Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com> 6// Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com>
7// - DVB-T support 7// - DVB-T support
diff --git a/drivers/media/usb/tm6000/tm6000-i2c.c b/drivers/media/usb/tm6000/tm6000-i2c.c
index c9a62bbff27a..659b63febf85 100644
--- a/drivers/media/usb/tm6000/tm6000-i2c.c
+++ b/drivers/media/usb/tm6000/tm6000-i2c.c
@@ -1,7 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// tm6000-i2c.c - driver for TM5600/TM6000/TM6010 USB video capture devices 2// tm6000-i2c.c - driver for TM5600/TM6000/TM6010 USB video capture devices
3// 3//
4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
5// 5//
6// Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com> 6// Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com>
7// - Fix SMBus Read Byte command 7// - Fix SMBus Read Byte command
diff --git a/drivers/media/usb/tm6000/tm6000-regs.h b/drivers/media/usb/tm6000/tm6000-regs.h
index 21587fcf11e3..d10424673db9 100644
--- a/drivers/media/usb/tm6000/tm6000-regs.h
+++ b/drivers/media/usb/tm6000/tm6000-regs.h
@@ -2,7 +2,7 @@
2 * SPDX-License-Identifier: GPL-2.0 2 * SPDX-License-Identifier: GPL-2.0
3 * tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices 3 * tm6000-regs.h - driver for TM5600/TM6000/TM6010 USB video capture devices
4 * 4 *
5 * Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 5 * Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
6 */ 6 */
7 7
8/* 8/*
diff --git a/drivers/media/usb/tm6000/tm6000-usb-isoc.h b/drivers/media/usb/tm6000/tm6000-usb-isoc.h
index 5c615b0a7a46..b275dbce3a1b 100644
--- a/drivers/media/usb/tm6000/tm6000-usb-isoc.h
+++ b/drivers/media/usb/tm6000/tm6000-usb-isoc.h
@@ -2,7 +2,7 @@
2 * SPDX-License-Identifier: GPL-2.0 2 * SPDX-License-Identifier: GPL-2.0
3 * tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices 3 * tm6000-buf.c - driver for TM5600/TM6000/TM6010 USB video capture devices
4 * 4 *
5 * Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 5 * Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
6 */ 6 */
7 7
8#include <linux/videodev2.h> 8#include <linux/videodev2.h>
diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index b2399d4266da..aa85fe31c835 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -1,7 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0 1// SPDX-License-Identifier: GPL-2.0
2// tm6000-video.c - driver for TM5600/TM6000/TM6010 USB video capture devices 2// tm6000-video.c - driver for TM5600/TM6000/TM6010 USB video capture devices
3// 3//
4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 4// Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
5// 5//
6// Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com> 6// Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com>
7// - Fixed module load/unload 7// - Fixed module load/unload
diff --git a/drivers/media/usb/tm6000/tm6000.h b/drivers/media/usb/tm6000/tm6000.h
index e1e45770e28d..0864ed7314eb 100644
--- a/drivers/media/usb/tm6000/tm6000.h
+++ b/drivers/media/usb/tm6000/tm6000.h
@@ -2,7 +2,7 @@
2 * SPDX-License-Identifier: GPL-2.0 2 * SPDX-License-Identifier: GPL-2.0
3 * tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices 3 * tm6000.h - driver for TM5600/TM6000/TM6010 USB video capture devices
4 * 4 *
5 * Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@infradead.org> 5 * Copyright (c) 2006-2007 Mauro Carvalho Chehab <mchehab@kernel.org>
6 * 6 *
7 * Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com> 7 * Copyright (c) 2007 Michel Ludwig <michel.ludwig@gmail.com>
8 * - DVB-T support 8 * - DVB-T support
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 1d0b2208e8fb..c080dcc75393 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * Authors: Alan Cox, <alan@lxorguk.ukuu.org.uk> (version 1) 12 * Authors: Alan Cox, <alan@lxorguk.ukuu.org.uk> (version 1)
13 * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2) 13 * Mauro Carvalho Chehab <mchehab@kernel.org> (version 2)
14 * 14 *
15 * Fixes: 20000516 Claudio Matsuoka <claudio@conectiva.com> 15 * Fixes: 20000516 Claudio Matsuoka <claudio@conectiva.com>
16 * - Added procfs support 16 * - Added procfs support
@@ -1072,7 +1072,7 @@ static void __exit videodev_exit(void)
1072subsys_initcall(videodev_init); 1072subsys_initcall(videodev_init);
1073module_exit(videodev_exit) 1073module_exit(videodev_exit)
1074 1074
1075MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); 1075MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@kernel.org>");
1076MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); 1076MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2");
1077MODULE_LICENSE("GPL"); 1077MODULE_LICENSE("GPL");
1078MODULE_ALIAS_CHARDEV_MAJOR(VIDEO_MAJOR); 1078MODULE_ALIAS_CHARDEV_MAJOR(VIDEO_MAJOR);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index f48c505550e0..de5d96dbe69e 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -9,7 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 * 10 *
11 * Authors: Alan Cox, <alan@lxorguk.ukuu.org.uk> (version 1) 11 * Authors: Alan Cox, <alan@lxorguk.ukuu.org.uk> (version 1)
12 * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2) 12 * Mauro Carvalho Chehab <mchehab@kernel.org> (version 2)
13 */ 13 */
14 14
15#include <linux/mm.h> 15#include <linux/mm.h>
diff --git a/drivers/media/v4l2-core/videobuf-core.c b/drivers/media/v4l2-core/videobuf-core.c
index 2b3981842b4b..7491b337002c 100644
--- a/drivers/media/v4l2-core/videobuf-core.c
+++ b/drivers/media/v4l2-core/videobuf-core.c
@@ -1,11 +1,11 @@
1/* 1/*
2 * generic helper functions for handling video4linux capture buffers 2 * generic helper functions for handling video4linux capture buffers
3 * 3 *
4 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 4 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
5 * 5 *
6 * Highly based on video-buf written originally by: 6 * Highly based on video-buf written originally by:
7 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> 7 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
8 * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> 8 * (c) 2006 Mauro Carvalho Chehab, <mchehab@kernel.org>
9 * (c) 2006 Ted Walther and John Sokol 9 * (c) 2006 Ted Walther and John Sokol
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -38,7 +38,7 @@ static int debug;
38module_param(debug, int, 0644); 38module_param(debug, int, 0644);
39 39
40MODULE_DESCRIPTION("helper module to manage video4linux buffers"); 40MODULE_DESCRIPTION("helper module to manage video4linux buffers");
41MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 41MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
42MODULE_LICENSE("GPL"); 42MODULE_LICENSE("GPL");
43 43
44#define dprintk(level, fmt, arg...) \ 44#define dprintk(level, fmt, arg...) \
diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c b/drivers/media/v4l2-core/videobuf-dma-contig.c
index e02353e340dd..f46132504d88 100644
--- a/drivers/media/v4l2-core/videobuf-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf-dma-contig.c
@@ -7,7 +7,7 @@
7 * Copyright (c) 2008 Magnus Damm 7 * Copyright (c) 2008 Magnus Damm
8 * 8 *
9 * Based on videobuf-vmalloc.c, 9 * Based on videobuf-vmalloc.c,
10 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 10 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c
index add2edb23eac..7770034aae28 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -6,11 +6,11 @@
6 * into PAGE_SIZE chunks). They also assume the driver does not need 6 * into PAGE_SIZE chunks). They also assume the driver does not need
7 * to touch the video data. 7 * to touch the video data.
8 * 8 *
9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
10 * 10 *
11 * Highly based on video-buf written originally by: 11 * Highly based on video-buf written originally by:
12 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> 12 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
13 * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> 13 * (c) 2006 Mauro Carvalho Chehab, <mchehab@kernel.org>
14 * (c) 2006 Ted Walther and John Sokol 14 * (c) 2006 Ted Walther and John Sokol
15 * 15 *
16 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
@@ -48,7 +48,7 @@ static int debug;
48module_param(debug, int, 0644); 48module_param(debug, int, 0644);
49 49
50MODULE_DESCRIPTION("helper module to manage video4linux dma sg buffers"); 50MODULE_DESCRIPTION("helper module to manage video4linux dma sg buffers");
51MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 51MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
52MODULE_LICENSE("GPL"); 52MODULE_LICENSE("GPL");
53 53
54#define dprintk(level, fmt, arg...) \ 54#define dprintk(level, fmt, arg...) \
diff --git a/drivers/media/v4l2-core/videobuf-vmalloc.c b/drivers/media/v4l2-core/videobuf-vmalloc.c
index 2ff7fcc77b11..45fe781aeeec 100644
--- a/drivers/media/v4l2-core/videobuf-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf-vmalloc.c
@@ -6,7 +6,7 @@
6 * into PAGE_SIZE chunks). They also assume the driver does not need 6 * into PAGE_SIZE chunks). They also assume the driver does not need
7 * to touch the video data. 7 * to touch the video data.
8 * 8 *
9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ static int debug;
41module_param(debug, int, 0644); 41module_param(debug, int, 0644);
42 42
43MODULE_DESCRIPTION("helper module to manage video4linux vmalloc buffers"); 43MODULE_DESCRIPTION("helper module to manage video4linux vmalloc buffers");
44MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@infradead.org>"); 44MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@kernel.org>");
45MODULE_LICENSE("GPL"); 45MODULE_LICENSE("GPL");
46 46
47#define dprintk(level, fmt, arg...) \ 47#define dprintk(level, fmt, arg...) \
diff --git a/drivers/mtd/nand/onenand/omap2.c b/drivers/mtd/nand/onenand/omap2.c
index 9c159f0dd9a6..321137158ff3 100644
--- a/drivers/mtd/nand/onenand/omap2.c
+++ b/drivers/mtd/nand/onenand/omap2.c
@@ -375,56 +375,42 @@ static int omap2_onenand_read_bufferram(struct mtd_info *mtd, int area,
375{ 375{
376 struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd); 376 struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
377 struct onenand_chip *this = mtd->priv; 377 struct onenand_chip *this = mtd->priv;
378 dma_addr_t dma_src, dma_dst; 378 struct device *dev = &c->pdev->dev;
379 int bram_offset;
380 void *buf = (void *)buffer; 379 void *buf = (void *)buffer;
380 dma_addr_t dma_src, dma_dst;
381 int bram_offset, err;
381 size_t xtra; 382 size_t xtra;
382 int ret;
383 383
384 bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset; 384 bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset;
385 if (bram_offset & 3 || (size_t)buf & 3 || count < 384) 385 /*
386 goto out_copy; 386 * If the buffer address is not DMA-able, len is not long enough to make
387 387 * DMA transfers profitable or panic_write() may be in an interrupt
388 /* panic_write() may be in an interrupt context */ 388 * context fallback to PIO mode.
389 if (in_interrupt() || oops_in_progress) 389 */
390 if (!virt_addr_valid(buf) || bram_offset & 3 || (size_t)buf & 3 ||
391 count < 384 || in_interrupt() || oops_in_progress )
390 goto out_copy; 392 goto out_copy;
391 393
392 if (buf >= high_memory) {
393 struct page *p1;
394
395 if (((size_t)buf & PAGE_MASK) !=
396 ((size_t)(buf + count - 1) & PAGE_MASK))
397 goto out_copy;
398 p1 = vmalloc_to_page(buf);
399 if (!p1)
400 goto out_copy;
401 buf = page_address(p1) + ((size_t)buf & ~PAGE_MASK);
402 }
403
404 xtra = count & 3; 394 xtra = count & 3;
405 if (xtra) { 395 if (xtra) {
406 count -= xtra; 396 count -= xtra;
407 memcpy(buf + count, this->base + bram_offset + count, xtra); 397 memcpy(buf + count, this->base + bram_offset + count, xtra);
408 } 398 }
409 399
400 dma_dst = dma_map_single(dev, buf, count, DMA_FROM_DEVICE);
410 dma_src = c->phys_base + bram_offset; 401 dma_src = c->phys_base + bram_offset;
411 dma_dst = dma_map_single(&c->pdev->dev, buf, count, DMA_FROM_DEVICE);
412 if (dma_mapping_error(&c->pdev->dev, dma_dst)) {
413 dev_err(&c->pdev->dev,
414 "Couldn't DMA map a %d byte buffer\n",
415 count);
416 goto out_copy;
417 }
418 402
419 ret = omap2_onenand_dma_transfer(c, dma_src, dma_dst, count); 403 if (dma_mapping_error(dev, dma_dst)) {
420 dma_unmap_single(&c->pdev->dev, dma_dst, count, DMA_FROM_DEVICE); 404 dev_err(dev, "Couldn't DMA map a %d byte buffer\n", count);
421
422 if (ret) {
423 dev_err(&c->pdev->dev, "timeout waiting for DMA\n");
424 goto out_copy; 405 goto out_copy;
425 } 406 }
426 407
427 return 0; 408 err = omap2_onenand_dma_transfer(c, dma_src, dma_dst, count);
409 dma_unmap_single(dev, dma_dst, count, DMA_FROM_DEVICE);
410 if (!err)
411 return 0;
412
413 dev_err(dev, "timeout waiting for DMA\n");
428 414
429out_copy: 415out_copy:
430 memcpy(buf, this->base + bram_offset, count); 416 memcpy(buf, this->base + bram_offset, count);
@@ -437,49 +423,34 @@ static int omap2_onenand_write_bufferram(struct mtd_info *mtd, int area,
437{ 423{
438 struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd); 424 struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
439 struct onenand_chip *this = mtd->priv; 425 struct onenand_chip *this = mtd->priv;
440 dma_addr_t dma_src, dma_dst; 426 struct device *dev = &c->pdev->dev;
441 int bram_offset;
442 void *buf = (void *)buffer; 427 void *buf = (void *)buffer;
443 int ret; 428 dma_addr_t dma_src, dma_dst;
429 int bram_offset, err;
444 430
445 bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset; 431 bram_offset = omap2_onenand_bufferram_offset(mtd, area) + area + offset;
446 if (bram_offset & 3 || (size_t)buf & 3 || count < 384) 432 /*
447 goto out_copy; 433 * If the buffer address is not DMA-able, len is not long enough to make
448 434 * DMA transfers profitable or panic_write() may be in an interrupt
449 /* panic_write() may be in an interrupt context */ 435 * context fallback to PIO mode.
450 if (in_interrupt() || oops_in_progress) 436 */
437 if (!virt_addr_valid(buf) || bram_offset & 3 || (size_t)buf & 3 ||
438 count < 384 || in_interrupt() || oops_in_progress )
451 goto out_copy; 439 goto out_copy;
452 440
453 if (buf >= high_memory) { 441 dma_src = dma_map_single(dev, buf, count, DMA_TO_DEVICE);
454 struct page *p1;
455
456 if (((size_t)buf & PAGE_MASK) !=
457 ((size_t)(buf + count - 1) & PAGE_MASK))
458 goto out_copy;
459 p1 = vmalloc_to_page(buf);
460 if (!p1)
461 goto out_copy;
462 buf = page_address(p1) + ((size_t)buf & ~PAGE_MASK);
463 }
464
465 dma_src = dma_map_single(&c->pdev->dev, buf, count, DMA_TO_DEVICE);
466 dma_dst = c->phys_base + bram_offset; 442 dma_dst = c->phys_base + bram_offset;
467 if (dma_mapping_error(&c->pdev->dev, dma_src)) { 443 if (dma_mapping_error(dev, dma_src)) {
468 dev_err(&c->pdev->dev, 444 dev_err(dev, "Couldn't DMA map a %d byte buffer\n", count);
469 "Couldn't DMA map a %d byte buffer\n",
470 count);
471 return -1;
472 }
473
474 ret = omap2_onenand_dma_transfer(c, dma_src, dma_dst, count);
475 dma_unmap_single(&c->pdev->dev, dma_src, count, DMA_TO_DEVICE);
476
477 if (ret) {
478 dev_err(&c->pdev->dev, "timeout waiting for DMA\n");
479 goto out_copy; 445 goto out_copy;
480 } 446 }
481 447
482 return 0; 448 err = omap2_onenand_dma_transfer(c, dma_src, dma_dst, count);
449 dma_unmap_page(dev, dma_src, count, DMA_TO_DEVICE);
450 if (!err)
451 return 0;
452
453 dev_err(dev, "timeout waiting for DMA\n");
483 454
484out_copy: 455out_copy:
485 memcpy(this->base + bram_offset, buf, count); 456 memcpy(this->base + bram_offset, buf, count);
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c
index 1d779a35ac8e..db5ec4e8bde9 100644
--- a/drivers/mtd/nand/raw/marvell_nand.c
+++ b/drivers/mtd/nand/raw/marvell_nand.c
@@ -1074,7 +1074,7 @@ static int marvell_nfc_hw_ecc_hmg_do_write_page(struct nand_chip *chip,
1074 return ret; 1074 return ret;
1075 1075
1076 ret = marvell_nfc_wait_op(chip, 1076 ret = marvell_nfc_wait_op(chip,
1077 chip->data_interface.timings.sdr.tPROG_max); 1077 PSEC_TO_MSEC(chip->data_interface.timings.sdr.tPROG_max));
1078 return ret; 1078 return ret;
1079} 1079}
1080 1080
@@ -1408,6 +1408,7 @@ marvell_nfc_hw_ecc_bch_write_chunk(struct nand_chip *chip, int chunk,
1408 struct marvell_nand_chip *marvell_nand = to_marvell_nand(chip); 1408 struct marvell_nand_chip *marvell_nand = to_marvell_nand(chip);
1409 struct marvell_nfc *nfc = to_marvell_nfc(chip->controller); 1409 struct marvell_nfc *nfc = to_marvell_nfc(chip->controller);
1410 const struct marvell_hw_ecc_layout *lt = to_marvell_nand(chip)->layout; 1410 const struct marvell_hw_ecc_layout *lt = to_marvell_nand(chip)->layout;
1411 u32 xtype;
1411 int ret; 1412 int ret;
1412 struct marvell_nfc_op nfc_op = { 1413 struct marvell_nfc_op nfc_op = {
1413 .ndcb[0] = NDCB0_CMD_TYPE(TYPE_WRITE) | NDCB0_LEN_OVRD, 1414 .ndcb[0] = NDCB0_CMD_TYPE(TYPE_WRITE) | NDCB0_LEN_OVRD,
@@ -1423,7 +1424,12 @@ marvell_nfc_hw_ecc_bch_write_chunk(struct nand_chip *chip, int chunk,
1423 * last naked write. 1424 * last naked write.
1424 */ 1425 */
1425 if (chunk == 0) { 1426 if (chunk == 0) {
1426 nfc_op.ndcb[0] |= NDCB0_CMD_XTYPE(XTYPE_WRITE_DISPATCH) | 1427 if (lt->nchunks == 1)
1428 xtype = XTYPE_MONOLITHIC_RW;
1429 else
1430 xtype = XTYPE_WRITE_DISPATCH;
1431
1432 nfc_op.ndcb[0] |= NDCB0_CMD_XTYPE(xtype) |
1427 NDCB0_ADDR_CYC(marvell_nand->addr_cyc) | 1433 NDCB0_ADDR_CYC(marvell_nand->addr_cyc) |
1428 NDCB0_CMD1(NAND_CMD_SEQIN); 1434 NDCB0_CMD1(NAND_CMD_SEQIN);
1429 nfc_op.ndcb[1] |= NDCB1_ADDRS_PAGE(page); 1435 nfc_op.ndcb[1] |= NDCB1_ADDRS_PAGE(page);
@@ -1494,7 +1500,7 @@ static int marvell_nfc_hw_ecc_bch_write_page(struct mtd_info *mtd,
1494 } 1500 }
1495 1501
1496 ret = marvell_nfc_wait_op(chip, 1502 ret = marvell_nfc_wait_op(chip,
1497 chip->data_interface.timings.sdr.tPROG_max); 1503 PSEC_TO_MSEC(chip->data_interface.timings.sdr.tPROG_max));
1498 1504
1499 marvell_nfc_disable_hw_ecc(chip); 1505 marvell_nfc_disable_hw_ecc(chip);
1500 1506
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 72f3a89da513..f28c3a555861 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -706,12 +706,17 @@ static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo)
706 */ 706 */
707int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms) 707int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms)
708{ 708{
709 const struct nand_sdr_timings *timings;
709 u8 status = 0; 710 u8 status = 0;
710 int ret; 711 int ret;
711 712
712 if (!chip->exec_op) 713 if (!chip->exec_op)
713 return -ENOTSUPP; 714 return -ENOTSUPP;
714 715
716 /* Wait tWB before polling the STATUS reg. */
717 timings = nand_get_sdr_timings(&chip->data_interface);
718 ndelay(PSEC_TO_NSEC(timings->tWB_max));
719
715 ret = nand_status_op(chip, NULL); 720 ret = nand_status_op(chip, NULL);
716 if (ret) 721 if (ret)
717 return ret; 722 return ret;
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 601f67872e58..a8f60982d483 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -450,7 +450,7 @@ static void rlb_update_client(struct rlb_client_info *client_info)
450{ 450{
451 int i; 451 int i;
452 452
453 if (!client_info->slave) 453 if (!client_info->slave || !is_valid_ether_addr(client_info->mac_dst))
454 return; 454 return;
455 455
456 for (i = 0; i < RLB_ARP_BURST_SIZE; i++) { 456 for (i = 0; i < RLB_ARP_BURST_SIZE; i++) {
@@ -943,6 +943,10 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
943 skb->priority = TC_PRIO_CONTROL; 943 skb->priority = TC_PRIO_CONTROL;
944 skb->dev = slave->dev; 944 skb->dev = slave->dev;
945 945
946 netdev_dbg(slave->bond->dev,
947 "Send learning packet: dev %s mac %pM vlan %d\n",
948 slave->dev->name, mac_addr, vid);
949
946 if (vid) 950 if (vid)
947 __vlan_hwaccel_put_tag(skb, vlan_proto, vid); 951 __vlan_hwaccel_put_tag(skb, vlan_proto, vid);
948 952
@@ -965,14 +969,13 @@ static int alb_upper_dev_walk(struct net_device *upper, void *_data)
965 u8 *mac_addr = data->mac_addr; 969 u8 *mac_addr = data->mac_addr;
966 struct bond_vlan_tag *tags; 970 struct bond_vlan_tag *tags;
967 971
968 if (is_vlan_dev(upper) && vlan_get_encap_level(upper) == 0) { 972 if (is_vlan_dev(upper) &&
969 if (strict_match && 973 bond->nest_level == vlan_get_encap_level(upper) - 1) {
970 ether_addr_equal_64bits(mac_addr, 974 if (upper->addr_assign_type == NET_ADDR_STOLEN) {
971 upper->dev_addr)) {
972 alb_send_lp_vid(slave, mac_addr, 975 alb_send_lp_vid(slave, mac_addr,
973 vlan_dev_vlan_proto(upper), 976 vlan_dev_vlan_proto(upper),
974 vlan_dev_vlan_id(upper)); 977 vlan_dev_vlan_id(upper));
975 } else if (!strict_match) { 978 } else {
976 alb_send_lp_vid(slave, upper->dev_addr, 979 alb_send_lp_vid(slave, upper->dev_addr,
977 vlan_dev_vlan_proto(upper), 980 vlan_dev_vlan_proto(upper),
978 vlan_dev_vlan_id(upper)); 981 vlan_dev_vlan_id(upper));
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 966d09183744..4176e1d95f47 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1738,6 +1738,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1738 if (bond_mode_uses_xmit_hash(bond)) 1738 if (bond_mode_uses_xmit_hash(bond))
1739 bond_update_slave_arr(bond, NULL); 1739 bond_update_slave_arr(bond, NULL);
1740 1740
1741 bond->nest_level = dev_get_nest_level(bond_dev);
1742
1741 netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n", 1743 netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n",
1742 slave_dev->name, 1744 slave_dev->name,
1743 bond_is_active_slave(new_slave) ? "an active" : "a backup", 1745 bond_is_active_slave(new_slave) ? "an active" : "a backup",
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index b1779566c5bb..3c71f1cb205f 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -605,7 +605,7 @@ void can_bus_off(struct net_device *dev)
605{ 605{
606 struct can_priv *priv = netdev_priv(dev); 606 struct can_priv *priv = netdev_priv(dev);
607 607
608 netdev_dbg(dev, "bus-off\n"); 608 netdev_info(dev, "bus-off\n");
609 609
610 netif_carrier_off(dev); 610 netif_carrier_off(dev);
611 611
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 634c51e6b8ae..d53a45bf2a72 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -200,6 +200,7 @@
200#define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) /* Disable Memory error detection */ 200#define FLEXCAN_QUIRK_DISABLE_MECR BIT(4) /* Disable Memory error detection */
201#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) /* Use timestamp based offloading */ 201#define FLEXCAN_QUIRK_USE_OFF_TIMESTAMP BIT(5) /* Use timestamp based offloading */
202#define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) /* No interrupt for error passive */ 202#define FLEXCAN_QUIRK_BROKEN_PERR_STATE BIT(6) /* No interrupt for error passive */
203#define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN BIT(7) /* default to BE register access */
203 204
204/* Structure of the message buffer */ 205/* Structure of the message buffer */
205struct flexcan_mb { 206struct flexcan_mb {
@@ -288,6 +289,12 @@ struct flexcan_priv {
288 289
289static const struct flexcan_devtype_data fsl_p1010_devtype_data = { 290static const struct flexcan_devtype_data fsl_p1010_devtype_data = {
290 .quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE | 291 .quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE |
292 FLEXCAN_QUIRK_BROKEN_PERR_STATE |
293 FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN,
294};
295
296static const struct flexcan_devtype_data fsl_imx25_devtype_data = {
297 .quirks = FLEXCAN_QUIRK_BROKEN_WERR_STATE |
291 FLEXCAN_QUIRK_BROKEN_PERR_STATE, 298 FLEXCAN_QUIRK_BROKEN_PERR_STATE,
292}; 299};
293 300
@@ -1251,9 +1258,9 @@ static void unregister_flexcandev(struct net_device *dev)
1251static const struct of_device_id flexcan_of_match[] = { 1258static const struct of_device_id flexcan_of_match[] = {
1252 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, 1259 { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, },
1253 { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, }, 1260 { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, },
1254 { .compatible = "fsl,imx53-flexcan", .data = &fsl_p1010_devtype_data, }, 1261 { .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, },
1255 { .compatible = "fsl,imx35-flexcan", .data = &fsl_p1010_devtype_data, }, 1262 { .compatible = "fsl,imx35-flexcan", .data = &fsl_imx25_devtype_data, },
1256 { .compatible = "fsl,imx25-flexcan", .data = &fsl_p1010_devtype_data, }, 1263 { .compatible = "fsl,imx25-flexcan", .data = &fsl_imx25_devtype_data, },
1257 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, }, 1264 { .compatible = "fsl,p1010-flexcan", .data = &fsl_p1010_devtype_data, },
1258 { .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, }, 1265 { .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, },
1259 { .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, }, 1266 { .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, },
@@ -1337,18 +1344,13 @@ static int flexcan_probe(struct platform_device *pdev)
1337 1344
1338 priv = netdev_priv(dev); 1345 priv = netdev_priv(dev);
1339 1346
1340 if (of_property_read_bool(pdev->dev.of_node, "big-endian")) { 1347 if (of_property_read_bool(pdev->dev.of_node, "big-endian") ||
1348 devtype_data->quirks & FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN) {
1341 priv->read = flexcan_read_be; 1349 priv->read = flexcan_read_be;
1342 priv->write = flexcan_write_be; 1350 priv->write = flexcan_write_be;
1343 } else { 1351 } else {
1344 if (of_device_is_compatible(pdev->dev.of_node, 1352 priv->read = flexcan_read_le;
1345 "fsl,p1010-flexcan")) { 1353 priv->write = flexcan_write_le;
1346 priv->read = flexcan_read_be;
1347 priv->write = flexcan_write_be;
1348 } else {
1349 priv->read = flexcan_read_le;
1350 priv->write = flexcan_write_le;
1351 }
1352 } 1354 }
1353 1355
1354 priv->can.clock.freq = clock_freq; 1356 priv->can.clock.freq = clock_freq;
diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index 5590c559a8ca..53e320c92a8b 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c
@@ -91,6 +91,7 @@
91#define HI3110_STAT_BUSOFF BIT(2) 91#define HI3110_STAT_BUSOFF BIT(2)
92#define HI3110_STAT_ERRP BIT(3) 92#define HI3110_STAT_ERRP BIT(3)
93#define HI3110_STAT_ERRW BIT(4) 93#define HI3110_STAT_ERRW BIT(4)
94#define HI3110_STAT_TXMTY BIT(7)
94 95
95#define HI3110_BTR0_SJW_SHIFT 6 96#define HI3110_BTR0_SJW_SHIFT 6
96#define HI3110_BTR0_BRP_SHIFT 0 97#define HI3110_BTR0_BRP_SHIFT 0
@@ -427,8 +428,10 @@ static int hi3110_get_berr_counter(const struct net_device *net,
427 struct hi3110_priv *priv = netdev_priv(net); 428 struct hi3110_priv *priv = netdev_priv(net);
428 struct spi_device *spi = priv->spi; 429 struct spi_device *spi = priv->spi;
429 430
431 mutex_lock(&priv->hi3110_lock);
430 bec->txerr = hi3110_read(spi, HI3110_READ_TEC); 432 bec->txerr = hi3110_read(spi, HI3110_READ_TEC);
431 bec->rxerr = hi3110_read(spi, HI3110_READ_REC); 433 bec->rxerr = hi3110_read(spi, HI3110_READ_REC);
434 mutex_unlock(&priv->hi3110_lock);
432 435
433 return 0; 436 return 0;
434} 437}
@@ -735,10 +738,7 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
735 } 738 }
736 } 739 }
737 740
738 if (intf == 0) 741 if (priv->tx_len && statf & HI3110_STAT_TXMTY) {
739 break;
740
741 if (intf & HI3110_INT_TXCPLT) {
742 net->stats.tx_packets++; 742 net->stats.tx_packets++;
743 net->stats.tx_bytes += priv->tx_len - 1; 743 net->stats.tx_bytes += priv->tx_len - 1;
744 can_led_event(net, CAN_LED_EVENT_TX); 744 can_led_event(net, CAN_LED_EVENT_TX);
@@ -748,6 +748,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)
748 } 748 }
749 netif_wake_queue(net); 749 netif_wake_queue(net);
750 } 750 }
751
752 if (intf == 0)
753 break;
751 } 754 }
752 mutex_unlock(&priv->hi3110_lock); 755 mutex_unlock(&priv->hi3110_lock);
753 return IRQ_HANDLED; 756 return IRQ_HANDLED;
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 63587b8e6825..daed57d3d209 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -1179,7 +1179,7 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev,
1179 1179
1180 skb = alloc_can_skb(priv->netdev, &cf); 1180 skb = alloc_can_skb(priv->netdev, &cf);
1181 if (!skb) { 1181 if (!skb) {
1182 stats->tx_dropped++; 1182 stats->rx_dropped++;
1183 return; 1183 return;
1184 } 1184 }
1185 1185
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 1cebde80b101..2910f68c0e5c 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3518,6 +3518,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3518 .num_internal_phys = 5, 3518 .num_internal_phys = 5,
3519 .max_vid = 4095, 3519 .max_vid = 4095,
3520 .port_base_addr = 0x10, 3520 .port_base_addr = 0x10,
3521 .phy_base_addr = 0x0,
3521 .global1_addr = 0x1b, 3522 .global1_addr = 0x1b,
3522 .global2_addr = 0x1c, 3523 .global2_addr = 0x1c,
3523 .age_time_coeff = 15000, 3524 .age_time_coeff = 15000,
@@ -3539,6 +3540,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3539 .num_internal_phys = 0, 3540 .num_internal_phys = 0,
3540 .max_vid = 4095, 3541 .max_vid = 4095,
3541 .port_base_addr = 0x10, 3542 .port_base_addr = 0x10,
3543 .phy_base_addr = 0x0,
3542 .global1_addr = 0x1b, 3544 .global1_addr = 0x1b,
3543 .global2_addr = 0x1c, 3545 .global2_addr = 0x1c,
3544 .age_time_coeff = 15000, 3546 .age_time_coeff = 15000,
@@ -3558,6 +3560,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3558 .num_internal_phys = 8, 3560 .num_internal_phys = 8,
3559 .max_vid = 4095, 3561 .max_vid = 4095,
3560 .port_base_addr = 0x10, 3562 .port_base_addr = 0x10,
3563 .phy_base_addr = 0x0,
3561 .global1_addr = 0x1b, 3564 .global1_addr = 0x1b,
3562 .global2_addr = 0x1c, 3565 .global2_addr = 0x1c,
3563 .age_time_coeff = 15000, 3566 .age_time_coeff = 15000,
@@ -3579,6 +3582,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3579 .num_internal_phys = 5, 3582 .num_internal_phys = 5,
3580 .max_vid = 4095, 3583 .max_vid = 4095,
3581 .port_base_addr = 0x10, 3584 .port_base_addr = 0x10,
3585 .phy_base_addr = 0x0,
3582 .global1_addr = 0x1b, 3586 .global1_addr = 0x1b,
3583 .global2_addr = 0x1c, 3587 .global2_addr = 0x1c,
3584 .age_time_coeff = 15000, 3588 .age_time_coeff = 15000,
@@ -3600,6 +3604,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3600 .num_internal_phys = 0, 3604 .num_internal_phys = 0,
3601 .max_vid = 4095, 3605 .max_vid = 4095,
3602 .port_base_addr = 0x10, 3606 .port_base_addr = 0x10,
3607 .phy_base_addr = 0x0,
3603 .global1_addr = 0x1b, 3608 .global1_addr = 0x1b,
3604 .global2_addr = 0x1c, 3609 .global2_addr = 0x1c,
3605 .age_time_coeff = 15000, 3610 .age_time_coeff = 15000,
@@ -3620,6 +3625,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3620 .num_gpio = 11, 3625 .num_gpio = 11,
3621 .max_vid = 4095, 3626 .max_vid = 4095,
3622 .port_base_addr = 0x10, 3627 .port_base_addr = 0x10,
3628 .phy_base_addr = 0x10,
3623 .global1_addr = 0x1b, 3629 .global1_addr = 0x1b,
3624 .global2_addr = 0x1c, 3630 .global2_addr = 0x1c,
3625 .age_time_coeff = 3750, 3631 .age_time_coeff = 3750,
@@ -3641,6 +3647,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3641 .num_internal_phys = 5, 3647 .num_internal_phys = 5,
3642 .max_vid = 4095, 3648 .max_vid = 4095,
3643 .port_base_addr = 0x10, 3649 .port_base_addr = 0x10,
3650 .phy_base_addr = 0x0,
3644 .global1_addr = 0x1b, 3651 .global1_addr = 0x1b,
3645 .global2_addr = 0x1c, 3652 .global2_addr = 0x1c,
3646 .age_time_coeff = 15000, 3653 .age_time_coeff = 15000,
@@ -3662,6 +3669,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3662 .num_internal_phys = 0, 3669 .num_internal_phys = 0,
3663 .max_vid = 4095, 3670 .max_vid = 4095,
3664 .port_base_addr = 0x10, 3671 .port_base_addr = 0x10,
3672 .phy_base_addr = 0x0,
3665 .global1_addr = 0x1b, 3673 .global1_addr = 0x1b,
3666 .global2_addr = 0x1c, 3674 .global2_addr = 0x1c,
3667 .age_time_coeff = 15000, 3675 .age_time_coeff = 15000,
@@ -3683,6 +3691,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3683 .num_internal_phys = 5, 3691 .num_internal_phys = 5,
3684 .max_vid = 4095, 3692 .max_vid = 4095,
3685 .port_base_addr = 0x10, 3693 .port_base_addr = 0x10,
3694 .phy_base_addr = 0x0,
3686 .global1_addr = 0x1b, 3695 .global1_addr = 0x1b,
3687 .global2_addr = 0x1c, 3696 .global2_addr = 0x1c,
3688 .age_time_coeff = 15000, 3697 .age_time_coeff = 15000,
@@ -3705,6 +3714,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3705 .num_gpio = 15, 3714 .num_gpio = 15,
3706 .max_vid = 4095, 3715 .max_vid = 4095,
3707 .port_base_addr = 0x10, 3716 .port_base_addr = 0x10,
3717 .phy_base_addr = 0x0,
3708 .global1_addr = 0x1b, 3718 .global1_addr = 0x1b,
3709 .global2_addr = 0x1c, 3719 .global2_addr = 0x1c,
3710 .age_time_coeff = 15000, 3720 .age_time_coeff = 15000,
@@ -3726,6 +3736,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3726 .num_internal_phys = 5, 3736 .num_internal_phys = 5,
3727 .max_vid = 4095, 3737 .max_vid = 4095,
3728 .port_base_addr = 0x10, 3738 .port_base_addr = 0x10,
3739 .phy_base_addr = 0x0,
3729 .global1_addr = 0x1b, 3740 .global1_addr = 0x1b,
3730 .global2_addr = 0x1c, 3741 .global2_addr = 0x1c,
3731 .age_time_coeff = 15000, 3742 .age_time_coeff = 15000,
@@ -3748,6 +3759,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3748 .num_gpio = 15, 3759 .num_gpio = 15,
3749 .max_vid = 4095, 3760 .max_vid = 4095,
3750 .port_base_addr = 0x10, 3761 .port_base_addr = 0x10,
3762 .phy_base_addr = 0x0,
3751 .global1_addr = 0x1b, 3763 .global1_addr = 0x1b,
3752 .global2_addr = 0x1c, 3764 .global2_addr = 0x1c,
3753 .age_time_coeff = 15000, 3765 .age_time_coeff = 15000,
@@ -3769,6 +3781,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3769 .num_internal_phys = 0, 3781 .num_internal_phys = 0,
3770 .max_vid = 4095, 3782 .max_vid = 4095,
3771 .port_base_addr = 0x10, 3783 .port_base_addr = 0x10,
3784 .phy_base_addr = 0x0,
3772 .global1_addr = 0x1b, 3785 .global1_addr = 0x1b,
3773 .global2_addr = 0x1c, 3786 .global2_addr = 0x1c,
3774 .age_time_coeff = 15000, 3787 .age_time_coeff = 15000,
@@ -3789,6 +3802,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3789 .num_gpio = 16, 3802 .num_gpio = 16,
3790 .max_vid = 8191, 3803 .max_vid = 8191,
3791 .port_base_addr = 0x0, 3804 .port_base_addr = 0x0,
3805 .phy_base_addr = 0x0,
3792 .global1_addr = 0x1b, 3806 .global1_addr = 0x1b,
3793 .global2_addr = 0x1c, 3807 .global2_addr = 0x1c,
3794 .tag_protocol = DSA_TAG_PROTO_DSA, 3808 .tag_protocol = DSA_TAG_PROTO_DSA,
@@ -3811,6 +3825,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3811 .num_gpio = 16, 3825 .num_gpio = 16,
3812 .max_vid = 8191, 3826 .max_vid = 8191,
3813 .port_base_addr = 0x0, 3827 .port_base_addr = 0x0,
3828 .phy_base_addr = 0x0,
3814 .global1_addr = 0x1b, 3829 .global1_addr = 0x1b,
3815 .global2_addr = 0x1c, 3830 .global2_addr = 0x1c,
3816 .age_time_coeff = 3750, 3831 .age_time_coeff = 3750,
@@ -3832,6 +3847,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3832 .num_internal_phys = 11, 3847 .num_internal_phys = 11,
3833 .max_vid = 8191, 3848 .max_vid = 8191,
3834 .port_base_addr = 0x0, 3849 .port_base_addr = 0x0,
3850 .phy_base_addr = 0x0,
3835 .global1_addr = 0x1b, 3851 .global1_addr = 0x1b,
3836 .global2_addr = 0x1c, 3852 .global2_addr = 0x1c,
3837 .age_time_coeff = 3750, 3853 .age_time_coeff = 3750,
@@ -3855,6 +3871,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3855 .num_gpio = 15, 3871 .num_gpio = 15,
3856 .max_vid = 4095, 3872 .max_vid = 4095,
3857 .port_base_addr = 0x10, 3873 .port_base_addr = 0x10,
3874 .phy_base_addr = 0x0,
3858 .global1_addr = 0x1b, 3875 .global1_addr = 0x1b,
3859 .global2_addr = 0x1c, 3876 .global2_addr = 0x1c,
3860 .age_time_coeff = 15000, 3877 .age_time_coeff = 15000,
@@ -3878,6 +3895,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3878 .num_gpio = 16, 3895 .num_gpio = 16,
3879 .max_vid = 8191, 3896 .max_vid = 8191,
3880 .port_base_addr = 0x0, 3897 .port_base_addr = 0x0,
3898 .phy_base_addr = 0x0,
3881 .global1_addr = 0x1b, 3899 .global1_addr = 0x1b,
3882 .global2_addr = 0x1c, 3900 .global2_addr = 0x1c,
3883 .age_time_coeff = 3750, 3901 .age_time_coeff = 3750,
@@ -3901,6 +3919,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3901 .num_gpio = 15, 3919 .num_gpio = 15,
3902 .max_vid = 4095, 3920 .max_vid = 4095,
3903 .port_base_addr = 0x10, 3921 .port_base_addr = 0x10,
3922 .phy_base_addr = 0x0,
3904 .global1_addr = 0x1b, 3923 .global1_addr = 0x1b,
3905 .global2_addr = 0x1c, 3924 .global2_addr = 0x1c,
3906 .age_time_coeff = 15000, 3925 .age_time_coeff = 15000,
@@ -3924,6 +3943,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3924 .num_gpio = 15, 3943 .num_gpio = 15,
3925 .max_vid = 4095, 3944 .max_vid = 4095,
3926 .port_base_addr = 0x10, 3945 .port_base_addr = 0x10,
3946 .phy_base_addr = 0x0,
3927 .global1_addr = 0x1b, 3947 .global1_addr = 0x1b,
3928 .global2_addr = 0x1c, 3948 .global2_addr = 0x1c,
3929 .age_time_coeff = 15000, 3949 .age_time_coeff = 15000,
@@ -3946,6 +3966,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3946 .num_gpio = 11, 3966 .num_gpio = 11,
3947 .max_vid = 4095, 3967 .max_vid = 4095,
3948 .port_base_addr = 0x10, 3968 .port_base_addr = 0x10,
3969 .phy_base_addr = 0x10,
3949 .global1_addr = 0x1b, 3970 .global1_addr = 0x1b,
3950 .global2_addr = 0x1c, 3971 .global2_addr = 0x1c,
3951 .age_time_coeff = 3750, 3972 .age_time_coeff = 3750,
@@ -3968,6 +3989,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3968 .num_internal_phys = 5, 3989 .num_internal_phys = 5,
3969 .max_vid = 4095, 3990 .max_vid = 4095,
3970 .port_base_addr = 0x10, 3991 .port_base_addr = 0x10,
3992 .phy_base_addr = 0x0,
3971 .global1_addr = 0x1b, 3993 .global1_addr = 0x1b,
3972 .global2_addr = 0x1c, 3994 .global2_addr = 0x1c,
3973 .age_time_coeff = 15000, 3995 .age_time_coeff = 15000,
@@ -3989,6 +4011,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
3989 .num_internal_phys = 5, 4011 .num_internal_phys = 5,
3990 .max_vid = 4095, 4012 .max_vid = 4095,
3991 .port_base_addr = 0x10, 4013 .port_base_addr = 0x10,
4014 .phy_base_addr = 0x0,
3992 .global1_addr = 0x1b, 4015 .global1_addr = 0x1b,
3993 .global2_addr = 0x1c, 4016 .global2_addr = 0x1c,
3994 .age_time_coeff = 15000, 4017 .age_time_coeff = 15000,
@@ -4011,6 +4034,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
4011 .num_gpio = 15, 4034 .num_gpio = 15,
4012 .max_vid = 4095, 4035 .max_vid = 4095,
4013 .port_base_addr = 0x10, 4036 .port_base_addr = 0x10,
4037 .phy_base_addr = 0x0,
4014 .global1_addr = 0x1b, 4038 .global1_addr = 0x1b,
4015 .global2_addr = 0x1c, 4039 .global2_addr = 0x1c,
4016 .age_time_coeff = 15000, 4040 .age_time_coeff = 15000,
@@ -4033,6 +4057,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
4033 .num_gpio = 16, 4057 .num_gpio = 16,
4034 .max_vid = 8191, 4058 .max_vid = 8191,
4035 .port_base_addr = 0x0, 4059 .port_base_addr = 0x0,
4060 .phy_base_addr = 0x0,
4036 .global1_addr = 0x1b, 4061 .global1_addr = 0x1b,
4037 .global2_addr = 0x1c, 4062 .global2_addr = 0x1c,
4038 .age_time_coeff = 3750, 4063 .age_time_coeff = 3750,
@@ -4055,6 +4080,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
4055 .num_gpio = 16, 4080 .num_gpio = 16,
4056 .max_vid = 8191, 4081 .max_vid = 8191,
4057 .port_base_addr = 0x0, 4082 .port_base_addr = 0x0,
4083 .phy_base_addr = 0x0,
4058 .global1_addr = 0x1b, 4084 .global1_addr = 0x1b,
4059 .global2_addr = 0x1c, 4085 .global2_addr = 0x1c,
4060 .age_time_coeff = 3750, 4086 .age_time_coeff = 3750,
diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h
index a1bedb0a888b..8eb5dfe17f5c 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.h
+++ b/drivers/net/dsa/mv88e6xxx/chip.h
@@ -110,6 +110,7 @@ struct mv88e6xxx_info {
110 unsigned int num_gpio; 110 unsigned int num_gpio;
111 unsigned int max_vid; 111 unsigned int max_vid;
112 unsigned int port_base_addr; 112 unsigned int port_base_addr;
113 unsigned int phy_base_addr;
113 unsigned int global1_addr; 114 unsigned int global1_addr;
114 unsigned int global2_addr; 115 unsigned int global2_addr;
115 unsigned int age_time_coeff; 116 unsigned int age_time_coeff;
diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c
index e6d658181b27..f9bde011a3e6 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.c
+++ b/drivers/net/dsa/mv88e6xxx/global2.c
@@ -1098,7 +1098,7 @@ int mv88e6xxx_g2_irq_mdio_setup(struct mv88e6xxx_chip *chip,
1098 err = irq; 1098 err = irq;
1099 goto out; 1099 goto out;
1100 } 1100 }
1101 bus->irq[chip->info->port_base_addr + phy] = irq; 1101 bus->irq[chip->info->phy_base_addr + phy] = irq;
1102 } 1102 }
1103 return 0; 1103 return 0;
1104out: 1104out:
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index 32f6d2e24d66..1a1a6380c128 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -95,6 +95,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self)
95 /*rss rings */ 95 /*rss rings */
96 cfg->vecs = min(cfg->aq_hw_caps->vecs, AQ_CFG_VECS_DEF); 96 cfg->vecs = min(cfg->aq_hw_caps->vecs, AQ_CFG_VECS_DEF);
97 cfg->vecs = min(cfg->vecs, num_online_cpus()); 97 cfg->vecs = min(cfg->vecs, num_online_cpus());
98 cfg->vecs = min(cfg->vecs, self->irqvecs);
98 /* cfg->vecs should be power of 2 for RSS */ 99 /* cfg->vecs should be power of 2 for RSS */
99 if (cfg->vecs >= 8U) 100 if (cfg->vecs >= 8U)
100 cfg->vecs = 8U; 101 cfg->vecs = 8U;
@@ -246,6 +247,8 @@ void aq_nic_ndev_init(struct aq_nic_s *self)
246 247
247 self->ndev->hw_features |= aq_hw_caps->hw_features; 248 self->ndev->hw_features |= aq_hw_caps->hw_features;
248 self->ndev->features = aq_hw_caps->hw_features; 249 self->ndev->features = aq_hw_caps->hw_features;
250 self->ndev->vlan_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM |
251 NETIF_F_RXHASH | NETIF_F_SG | NETIF_F_LRO;
249 self->ndev->priv_flags = aq_hw_caps->hw_priv_flags; 252 self->ndev->priv_flags = aq_hw_caps->hw_priv_flags;
250 self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 253 self->ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
251 254
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
index 219b550d1665..faa533a0ec47 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.h
@@ -80,6 +80,7 @@ struct aq_nic_s {
80 80
81 struct pci_dev *pdev; 81 struct pci_dev *pdev;
82 unsigned int msix_entry_mask; 82 unsigned int msix_entry_mask;
83 u32 irqvecs;
83}; 84};
84 85
85static inline struct device *aq_nic_get_dev(struct aq_nic_s *self) 86static inline struct device *aq_nic_get_dev(struct aq_nic_s *self)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
index ecc6306f940f..a50e08bb4748 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
@@ -267,16 +267,16 @@ static int aq_pci_probe(struct pci_dev *pdev,
267 numvecs = min(numvecs, num_online_cpus()); 267 numvecs = min(numvecs, num_online_cpus());
268 /*enable interrupts */ 268 /*enable interrupts */
269#if !AQ_CFG_FORCE_LEGACY_INT 269#if !AQ_CFG_FORCE_LEGACY_INT
270 err = pci_alloc_irq_vectors(self->pdev, numvecs, numvecs, 270 numvecs = pci_alloc_irq_vectors(self->pdev, 1, numvecs,
271 PCI_IRQ_MSIX); 271 PCI_IRQ_MSIX | PCI_IRQ_MSI |
272 272 PCI_IRQ_LEGACY);
273 if (err < 0) { 273
274 err = pci_alloc_irq_vectors(self->pdev, 1, 1, 274 if (numvecs < 0) {
275 PCI_IRQ_MSI | PCI_IRQ_LEGACY); 275 err = numvecs;
276 if (err < 0) 276 goto err_hwinit;
277 goto err_hwinit;
278 } 277 }
279#endif 278#endif
279 self->irqvecs = numvecs;
280 280
281 /* net device init */ 281 /* net device init */
282 aq_nic_cfg_start(self); 282 aq_nic_cfg_start(self);
@@ -298,9 +298,9 @@ err_free_aq_hw:
298 kfree(self->aq_hw); 298 kfree(self->aq_hw);
299err_ioremap: 299err_ioremap:
300 free_netdev(ndev); 300 free_netdev(ndev);
301err_pci_func:
302 pci_release_regions(pdev);
303err_ndev: 301err_ndev:
302 pci_release_regions(pdev);
303err_pci_func:
304 pci_disable_device(pdev); 304 pci_disable_device(pdev);
305 return err; 305 return err;
306} 306}
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 08bbb639be1a..9f59b1270a7c 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -8733,14 +8733,15 @@ static void tg3_free_consistent(struct tg3 *tp)
8733 tg3_mem_rx_release(tp); 8733 tg3_mem_rx_release(tp);
8734 tg3_mem_tx_release(tp); 8734 tg3_mem_tx_release(tp);
8735 8735
8736 /* Protect tg3_get_stats64() from reading freed tp->hw_stats. */ 8736 /* tp->hw_stats can be referenced safely:
8737 tg3_full_lock(tp, 0); 8737 * 1. under rtnl_lock
8738 * 2. or under tp->lock if TG3_FLAG_INIT_COMPLETE is set.
8739 */
8738 if (tp->hw_stats) { 8740 if (tp->hw_stats) {
8739 dma_free_coherent(&tp->pdev->dev, sizeof(struct tg3_hw_stats), 8741 dma_free_coherent(&tp->pdev->dev, sizeof(struct tg3_hw_stats),
8740 tp->hw_stats, tp->stats_mapping); 8742 tp->hw_stats, tp->stats_mapping);
8741 tp->hw_stats = NULL; 8743 tp->hw_stats = NULL;
8742 } 8744 }
8743 tg3_full_unlock(tp);
8744} 8745}
8745 8746
8746/* 8747/*
@@ -14178,7 +14179,7 @@ static void tg3_get_stats64(struct net_device *dev,
14178 struct tg3 *tp = netdev_priv(dev); 14179 struct tg3 *tp = netdev_priv(dev);
14179 14180
14180 spin_lock_bh(&tp->lock); 14181 spin_lock_bh(&tp->lock);
14181 if (!tp->hw_stats) { 14182 if (!tp->hw_stats || !tg3_flag(tp, INIT_COMPLETE)) {
14182 *stats = tp->net_stats_prev; 14183 *stats = tp->net_stats_prev;
14183 spin_unlock_bh(&tp->lock); 14184 spin_unlock_bh(&tp->lock);
14184 return; 14185 return;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 3e4c533c1622..c54fd189d835 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -3433,8 +3433,8 @@ static int adap_config_hma(struct adapter *adapter)
3433 sgl = adapter->hma.sgt->sgl; 3433 sgl = adapter->hma.sgt->sgl;
3434 node = dev_to_node(adapter->pdev_dev); 3434 node = dev_to_node(adapter->pdev_dev);
3435 for_each_sg(sgl, iter, sgt->orig_nents, i) { 3435 for_each_sg(sgl, iter, sgt->orig_nents, i) {
3436 newpage = alloc_pages_node(node, __GFP_NOWARN | GFP_KERNEL, 3436 newpage = alloc_pages_node(node, __GFP_NOWARN | GFP_KERNEL |
3437 page_order); 3437 __GFP_ZERO, page_order);
3438 if (!newpage) { 3438 if (!newpage) {
3439 dev_err(adapter->pdev_dev, 3439 dev_err(adapter->pdev_dev,
3440 "Not enough memory for HMA page allocation\n"); 3440 "Not enough memory for HMA page allocation\n");
@@ -5489,6 +5489,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
5489 } 5489 }
5490 spin_lock_init(&adapter->mbox_lock); 5490 spin_lock_init(&adapter->mbox_lock);
5491 INIT_LIST_HEAD(&adapter->mlist.list); 5491 INIT_LIST_HEAD(&adapter->mlist.list);
5492 adapter->mbox_log->size = T4_OS_LOG_MBOX_CMDS;
5492 pci_set_drvdata(pdev, adapter); 5493 pci_set_drvdata(pdev, adapter);
5493 5494
5494 if (func != ent->driver_data) { 5495 if (func != ent->driver_data) {
@@ -5523,8 +5524,6 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
5523 goto out_free_adapter; 5524 goto out_free_adapter;
5524 } 5525 }
5525 5526
5526 adapter->mbox_log->size = T4_OS_LOG_MBOX_CMDS;
5527
5528 /* PCI device has been enabled */ 5527 /* PCI device has been enabled */
5529 adapter->flags |= DEV_ENABLED; 5528 adapter->flags |= DEV_ENABLED;
5530 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map)); 5529 memset(adapter->chan_map, 0xff, sizeof(adapter->chan_map));
diff --git a/drivers/net/ethernet/intel/ice/ice_controlq.c b/drivers/net/ethernet/intel/ice/ice_controlq.c
index 5909a4407e38..7c511f144ed6 100644
--- a/drivers/net/ethernet/intel/ice/ice_controlq.c
+++ b/drivers/net/ethernet/intel/ice/ice_controlq.c
@@ -1014,10 +1014,10 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
1014 desc = ICE_CTL_Q_DESC(cq->rq, ntc); 1014 desc = ICE_CTL_Q_DESC(cq->rq, ntc);
1015 desc_idx = ntc; 1015 desc_idx = ntc;
1016 1016
1017 cq->rq_last_status = (enum ice_aq_err)le16_to_cpu(desc->retval);
1017 flags = le16_to_cpu(desc->flags); 1018 flags = le16_to_cpu(desc->flags);
1018 if (flags & ICE_AQ_FLAG_ERR) { 1019 if (flags & ICE_AQ_FLAG_ERR) {
1019 ret_code = ICE_ERR_AQ_ERROR; 1020 ret_code = ICE_ERR_AQ_ERROR;
1020 cq->rq_last_status = (enum ice_aq_err)le16_to_cpu(desc->retval);
1021 ice_debug(hw, ICE_DBG_AQ_MSG, 1021 ice_debug(hw, ICE_DBG_AQ_MSG,
1022 "Control Receive Queue Event received with error 0x%x\n", 1022 "Control Receive Queue Event received with error 0x%x\n",
1023 cq->rq_last_status); 1023 cq->rq_last_status);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index 41af2b81e960..195c0b65eee2 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -919,8 +919,8 @@ err2:
919 kfree(ipsec->ip_tbl); 919 kfree(ipsec->ip_tbl);
920 kfree(ipsec->rx_tbl); 920 kfree(ipsec->rx_tbl);
921 kfree(ipsec->tx_tbl); 921 kfree(ipsec->tx_tbl);
922 kfree(ipsec);
922err1: 923err1:
923 kfree(adapter->ipsec);
924 netdev_err(adapter->netdev, "Unable to allocate memory for SA tables"); 924 netdev_err(adapter->netdev, "Unable to allocate memory for SA tables");
925} 925}
926 926
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index 959a37599a6b..ac71ed76a54b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -3407,6 +3407,9 @@ static s32 ixgbe_reset_hw_X550em(struct ixgbe_hw *hw)
3407 hw->phy.sfp_setup_needed = false; 3407 hw->phy.sfp_setup_needed = false;
3408 } 3408 }
3409 3409
3410 if (status == IXGBE_ERR_SFP_NOT_SUPPORTED)
3411 return status;
3412
3410 /* Reset PHY */ 3413 /* Reset PHY */
3411 if (!hw->phy.reset_disable && hw->phy.ops.reset) 3414 if (!hw->phy.reset_disable && hw->phy.ops.reset)
3412 hw->phy.ops.reset(hw); 3415 hw->phy.ops.reset(hw);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index e91c3d1a43ce..1ccce6cd51fc 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -4114,7 +4114,7 @@ out_drop:
4114 return NETDEV_TX_OK; 4114 return NETDEV_TX_OK;
4115} 4115}
4116 4116
4117static int ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 4117static netdev_tx_t ixgbevf_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
4118{ 4118{
4119 struct ixgbevf_adapter *adapter = netdev_priv(netdev); 4119 struct ixgbevf_adapter *adapter = netdev_priv(netdev);
4120 struct ixgbevf_ring *tx_ring; 4120 struct ixgbevf_ring *tx_ring;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index a30a2e95d13f..f11b45001cad 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -1027,6 +1027,22 @@ static int mlx4_en_set_coalesce(struct net_device *dev,
1027 if (!coal->tx_max_coalesced_frames_irq) 1027 if (!coal->tx_max_coalesced_frames_irq)
1028 return -EINVAL; 1028 return -EINVAL;
1029 1029
1030 if (coal->tx_coalesce_usecs > MLX4_EN_MAX_COAL_TIME ||
1031 coal->rx_coalesce_usecs > MLX4_EN_MAX_COAL_TIME ||
1032 coal->rx_coalesce_usecs_low > MLX4_EN_MAX_COAL_TIME ||
1033 coal->rx_coalesce_usecs_high > MLX4_EN_MAX_COAL_TIME) {
1034 netdev_info(dev, "%s: maximum coalesce time supported is %d usecs\n",
1035 __func__, MLX4_EN_MAX_COAL_TIME);
1036 return -ERANGE;
1037 }
1038
1039 if (coal->tx_max_coalesced_frames > MLX4_EN_MAX_COAL_PKTS ||
1040 coal->rx_max_coalesced_frames > MLX4_EN_MAX_COAL_PKTS) {
1041 netdev_info(dev, "%s: maximum coalesced frames supported is %d\n",
1042 __func__, MLX4_EN_MAX_COAL_PKTS);
1043 return -ERANGE;
1044 }
1045
1030 priv->rx_frames = (coal->rx_max_coalesced_frames == 1046 priv->rx_frames = (coal->rx_max_coalesced_frames ==
1031 MLX4_EN_AUTO_CONF) ? 1047 MLX4_EN_AUTO_CONF) ?
1032 MLX4_EN_RX_COAL_TARGET : 1048 MLX4_EN_RX_COAL_TARGET :
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index e0adac4a9a19..9670b33fc9b1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -3324,12 +3324,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3324 MAX_TX_RINGS, GFP_KERNEL); 3324 MAX_TX_RINGS, GFP_KERNEL);
3325 if (!priv->tx_ring[t]) { 3325 if (!priv->tx_ring[t]) {
3326 err = -ENOMEM; 3326 err = -ENOMEM;
3327 goto err_free_tx; 3327 goto out;
3328 } 3328 }
3329 priv->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * 3329 priv->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) *
3330 MAX_TX_RINGS, GFP_KERNEL); 3330 MAX_TX_RINGS, GFP_KERNEL);
3331 if (!priv->tx_cq[t]) { 3331 if (!priv->tx_cq[t]) {
3332 kfree(priv->tx_ring[t]);
3333 err = -ENOMEM; 3332 err = -ENOMEM;
3334 goto out; 3333 goto out;
3335 } 3334 }
@@ -3582,11 +3581,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3582 3581
3583 return 0; 3582 return 0;
3584 3583
3585err_free_tx:
3586 while (t--) {
3587 kfree(priv->tx_ring[t]);
3588 kfree(priv->tx_cq[t]);
3589 }
3590out: 3584out:
3591 mlx4_en_destroy_netdev(dev); 3585 mlx4_en_destroy_netdev(dev);
3592 return err; 3586 return err;
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index f7c81133594f..ace6545f82e6 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -132,6 +132,9 @@
132#define MLX4_EN_TX_COAL_PKTS 16 132#define MLX4_EN_TX_COAL_PKTS 16
133#define MLX4_EN_TX_COAL_TIME 0x10 133#define MLX4_EN_TX_COAL_TIME 0x10
134 134
135#define MLX4_EN_MAX_COAL_PKTS U16_MAX
136#define MLX4_EN_MAX_COAL_TIME U16_MAX
137
135#define MLX4_EN_RX_RATE_LOW 400000 138#define MLX4_EN_RX_RATE_LOW 400000
136#define MLX4_EN_RX_COAL_TIME_LOW 0 139#define MLX4_EN_RX_COAL_TIME_LOW 0
137#define MLX4_EN_RX_RATE_HIGH 450000 140#define MLX4_EN_RX_RATE_HIGH 450000
@@ -552,8 +555,8 @@ struct mlx4_en_priv {
552 u16 rx_usecs_low; 555 u16 rx_usecs_low;
553 u32 pkt_rate_high; 556 u32 pkt_rate_high;
554 u16 rx_usecs_high; 557 u16 rx_usecs_high;
555 u16 sample_interval; 558 u32 sample_interval;
556 u16 adaptive_rx_coal; 559 u32 adaptive_rx_coal;
557 u32 msg_enable; 560 u32 msg_enable;
558 u32 loopback_ok; 561 u32 loopback_ok;
559 u32 validate_loopback; 562 u32 validate_loopback;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 3c534fc43400..b94276db3ce9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1261,6 +1261,10 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
1261 f->mask); 1261 f->mask);
1262 addr_type = key->addr_type; 1262 addr_type = key->addr_type;
1263 1263
1264 /* the HW doesn't support frag first/later */
1265 if (mask->flags & FLOW_DIS_FIRST_FRAG)
1266 return -EOPNOTSUPP;
1267
1264 if (mask->flags & FLOW_DIS_IS_FRAGMENT) { 1268 if (mask->flags & FLOW_DIS_IS_FRAGMENT) {
1265 MLX5_SET(fte_match_set_lyr_2_4, headers_c, frag, 1); 1269 MLX5_SET(fte_match_set_lyr_2_4, headers_c, frag, 1);
1266 MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 1270 MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index c1c94974e16b..1814f803bd2c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -34,6 +34,9 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/mlx5/driver.h> 35#include <linux/mlx5/driver.h>
36#include <linux/mlx5/cmd.h> 36#include <linux/mlx5/cmd.h>
37#ifdef CONFIG_RFS_ACCEL
38#include <linux/cpu_rmap.h>
39#endif
37#include "mlx5_core.h" 40#include "mlx5_core.h"
38#include "fpga/core.h" 41#include "fpga/core.h"
39#include "eswitch.h" 42#include "eswitch.h"
@@ -923,3 +926,28 @@ int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
923 MLX5_SET(query_eq_in, in, eq_number, eq->eqn); 926 MLX5_SET(query_eq_in, in, eq_number, eq->eqn);
924 return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); 927 return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
925} 928}
929
930/* This function should only be called after mlx5_cmd_force_teardown_hca */
931void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev)
932{
933 struct mlx5_eq_table *table = &dev->priv.eq_table;
934 struct mlx5_eq *eq;
935
936#ifdef CONFIG_RFS_ACCEL
937 if (dev->rmap) {
938 free_irq_cpu_rmap(dev->rmap);
939 dev->rmap = NULL;
940 }
941#endif
942 list_for_each_entry(eq, &table->comp_eqs_list, list)
943 free_irq(eq->irqn, eq);
944
945 free_irq(table->pages_eq.irqn, &table->pages_eq);
946 free_irq(table->async_eq.irqn, &table->async_eq);
947 free_irq(table->cmd_eq.irqn, &table->cmd_eq);
948#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
949 if (MLX5_CAP_GEN(dev, pg))
950 free_irq(table->pfault_eq.irqn, &table->pfault_eq);
951#endif
952 pci_free_irq_vectors(dev->pdev);
953}
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 332bc56306bf..1352d13eedb3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -2175,26 +2175,35 @@ int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
2175 memset(vf_stats, 0, sizeof(*vf_stats)); 2175 memset(vf_stats, 0, sizeof(*vf_stats));
2176 vf_stats->rx_packets = 2176 vf_stats->rx_packets =
2177 MLX5_GET_CTR(out, received_eth_unicast.packets) + 2177 MLX5_GET_CTR(out, received_eth_unicast.packets) +
2178 MLX5_GET_CTR(out, received_ib_unicast.packets) +
2178 MLX5_GET_CTR(out, received_eth_multicast.packets) + 2179 MLX5_GET_CTR(out, received_eth_multicast.packets) +
2180 MLX5_GET_CTR(out, received_ib_multicast.packets) +
2179 MLX5_GET_CTR(out, received_eth_broadcast.packets); 2181 MLX5_GET_CTR(out, received_eth_broadcast.packets);
2180 2182
2181 vf_stats->rx_bytes = 2183 vf_stats->rx_bytes =
2182 MLX5_GET_CTR(out, received_eth_unicast.octets) + 2184 MLX5_GET_CTR(out, received_eth_unicast.octets) +
2185 MLX5_GET_CTR(out, received_ib_unicast.octets) +
2183 MLX5_GET_CTR(out, received_eth_multicast.octets) + 2186 MLX5_GET_CTR(out, received_eth_multicast.octets) +
2187 MLX5_GET_CTR(out, received_ib_multicast.octets) +
2184 MLX5_GET_CTR(out, received_eth_broadcast.octets); 2188 MLX5_GET_CTR(out, received_eth_broadcast.octets);
2185 2189
2186 vf_stats->tx_packets = 2190 vf_stats->tx_packets =
2187 MLX5_GET_CTR(out, transmitted_eth_unicast.packets) + 2191 MLX5_GET_CTR(out, transmitted_eth_unicast.packets) +
2192 MLX5_GET_CTR(out, transmitted_ib_unicast.packets) +
2188 MLX5_GET_CTR(out, transmitted_eth_multicast.packets) + 2193 MLX5_GET_CTR(out, transmitted_eth_multicast.packets) +
2194 MLX5_GET_CTR(out, transmitted_ib_multicast.packets) +
2189 MLX5_GET_CTR(out, transmitted_eth_broadcast.packets); 2195 MLX5_GET_CTR(out, transmitted_eth_broadcast.packets);
2190 2196
2191 vf_stats->tx_bytes = 2197 vf_stats->tx_bytes =
2192 MLX5_GET_CTR(out, transmitted_eth_unicast.octets) + 2198 MLX5_GET_CTR(out, transmitted_eth_unicast.octets) +
2199 MLX5_GET_CTR(out, transmitted_ib_unicast.octets) +
2193 MLX5_GET_CTR(out, transmitted_eth_multicast.octets) + 2200 MLX5_GET_CTR(out, transmitted_eth_multicast.octets) +
2201 MLX5_GET_CTR(out, transmitted_ib_multicast.octets) +
2194 MLX5_GET_CTR(out, transmitted_eth_broadcast.octets); 2202 MLX5_GET_CTR(out, transmitted_eth_broadcast.octets);
2195 2203
2196 vf_stats->multicast = 2204 vf_stats->multicast =
2197 MLX5_GET_CTR(out, received_eth_multicast.packets); 2205 MLX5_GET_CTR(out, received_eth_multicast.packets) +
2206 MLX5_GET_CTR(out, received_ib_multicast.packets);
2198 2207
2199 vf_stats->broadcast = 2208 vf_stats->broadcast =
2200 MLX5_GET_CTR(out, received_eth_broadcast.packets); 2209 MLX5_GET_CTR(out, received_eth_broadcast.packets);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index b865597630ba..615005e63819 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1598,6 +1598,14 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
1598 1598
1599 mlx5_enter_error_state(dev, true); 1599 mlx5_enter_error_state(dev, true);
1600 1600
1601 /* Some platforms requiring freeing the IRQ's in the shutdown
1602 * flow. If they aren't freed they can't be allocated after
1603 * kexec. There is no need to cleanup the mlx5_core software
1604 * contexts.
1605 */
1606 mlx5_irq_clear_affinity_hints(dev);
1607 mlx5_core_eq_free_irqs(dev);
1608
1601 return 0; 1609 return 0;
1602} 1610}
1603 1611
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
index 7d001fe6e631..023882d9a22e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
@@ -128,6 +128,8 @@ int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
128 u32 *out, int outlen); 128 u32 *out, int outlen);
129int mlx5_start_eqs(struct mlx5_core_dev *dev); 129int mlx5_start_eqs(struct mlx5_core_dev *dev);
130void mlx5_stop_eqs(struct mlx5_core_dev *dev); 130void mlx5_stop_eqs(struct mlx5_core_dev *dev);
131/* This function should only be called after mlx5_cmd_force_teardown_hca */
132void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev);
131struct mlx5_eq *mlx5_eqn2eq(struct mlx5_core_dev *dev, int eqn); 133struct mlx5_eq *mlx5_eqn2eq(struct mlx5_core_dev *dev, int eqn);
132u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq *eq); 134u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq *eq);
133void mlx5_cq_tasklet_cb(unsigned long data); 135void mlx5_cq_tasklet_cb(unsigned long data);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 93ea56620a24..e13ac3b8dff7 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -1100,11 +1100,11 @@ err_emad_init:
1100err_alloc_lag_mapping: 1100err_alloc_lag_mapping:
1101 mlxsw_ports_fini(mlxsw_core); 1101 mlxsw_ports_fini(mlxsw_core);
1102err_ports_init: 1102err_ports_init:
1103 mlxsw_bus->fini(bus_priv);
1104err_bus_init:
1105 if (!reload) 1103 if (!reload)
1106 devlink_resources_unregister(devlink, NULL); 1104 devlink_resources_unregister(devlink, NULL);
1107err_register_resources: 1105err_register_resources:
1106 mlxsw_bus->fini(bus_priv);
1107err_bus_init:
1108 if (!reload) 1108 if (!reload)
1109 devlink_free(devlink); 1109 devlink_free(devlink);
1110err_devlink_alloc: 1110err_devlink_alloc:
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c
index a997e34bcec2..84e3b9f5abb1 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.c
@@ -52,8 +52,6 @@
52 52
53#define NFP_FLOWER_ALLOWED_VER 0x0001000000010000UL 53#define NFP_FLOWER_ALLOWED_VER 0x0001000000010000UL
54 54
55#define NFP_FLOWER_FRAME_HEADROOM 158
56
57static const char *nfp_flower_extra_cap(struct nfp_app *app, struct nfp_net *nn) 55static const char *nfp_flower_extra_cap(struct nfp_app *app, struct nfp_net *nn)
58{ 56{
59 return "FLOWER"; 57 return "FLOWER";
@@ -559,22 +557,6 @@ static void nfp_flower_clean(struct nfp_app *app)
559 app->priv = NULL; 557 app->priv = NULL;
560} 558}
561 559
562static int
563nfp_flower_check_mtu(struct nfp_app *app, struct net_device *netdev,
564 int new_mtu)
565{
566 /* The flower fw reserves NFP_FLOWER_FRAME_HEADROOM bytes of the
567 * supported max MTU to allow for appending tunnel headers. To prevent
568 * unexpected behaviour this needs to be accounted for.
569 */
570 if (new_mtu > netdev->max_mtu - NFP_FLOWER_FRAME_HEADROOM) {
571 nfp_err(app->cpp, "New MTU (%d) is not valid\n", new_mtu);
572 return -EINVAL;
573 }
574
575 return 0;
576}
577
578static bool nfp_flower_check_ack(struct nfp_flower_priv *app_priv) 560static bool nfp_flower_check_ack(struct nfp_flower_priv *app_priv)
579{ 561{
580 bool ret; 562 bool ret;
@@ -656,7 +638,6 @@ const struct nfp_app_type app_flower = {
656 .init = nfp_flower_init, 638 .init = nfp_flower_init,
657 .clean = nfp_flower_clean, 639 .clean = nfp_flower_clean,
658 640
659 .check_mtu = nfp_flower_check_mtu,
660 .repr_change_mtu = nfp_flower_repr_change_mtu, 641 .repr_change_mtu = nfp_flower_repr_change_mtu,
661 642
662 .vnic_alloc = nfp_flower_vnic_alloc, 643 .vnic_alloc = nfp_flower_vnic_alloc,
diff --git a/drivers/net/ethernet/ni/nixge.c b/drivers/net/ethernet/ni/nixge.c
index 27364b7572fc..b092894dd128 100644
--- a/drivers/net/ethernet/ni/nixge.c
+++ b/drivers/net/ethernet/ni/nixge.c
@@ -1170,7 +1170,7 @@ static void *nixge_get_nvmem_address(struct device *dev)
1170 1170
1171 cell = nvmem_cell_get(dev, "address"); 1171 cell = nvmem_cell_get(dev, "address");
1172 if (IS_ERR(cell)) 1172 if (IS_ERR(cell))
1173 return cell; 1173 return NULL;
1174 1174
1175 mac = nvmem_cell_read(cell, &cell_size); 1175 mac = nvmem_cell_read(cell, &cell_size);
1176 nvmem_cell_put(cell); 1176 nvmem_cell_put(cell);
@@ -1183,7 +1183,7 @@ static int nixge_probe(struct platform_device *pdev)
1183 struct nixge_priv *priv; 1183 struct nixge_priv *priv;
1184 struct net_device *ndev; 1184 struct net_device *ndev;
1185 struct resource *dmares; 1185 struct resource *dmares;
1186 const char *mac_addr; 1186 const u8 *mac_addr;
1187 int err; 1187 int err;
1188 1188
1189 ndev = alloc_etherdev(sizeof(*priv)); 1189 ndev = alloc_etherdev(sizeof(*priv));
@@ -1202,10 +1202,12 @@ static int nixge_probe(struct platform_device *pdev)
1202 ndev->max_mtu = NIXGE_JUMBO_MTU; 1202 ndev->max_mtu = NIXGE_JUMBO_MTU;
1203 1203
1204 mac_addr = nixge_get_nvmem_address(&pdev->dev); 1204 mac_addr = nixge_get_nvmem_address(&pdev->dev);
1205 if (mac_addr && is_valid_ether_addr(mac_addr)) 1205 if (mac_addr && is_valid_ether_addr(mac_addr)) {
1206 ether_addr_copy(ndev->dev_addr, mac_addr); 1206 ether_addr_copy(ndev->dev_addr, mac_addr);
1207 else 1207 kfree(mac_addr);
1208 } else {
1208 eth_hw_addr_random(ndev); 1209 eth_hw_addr_random(ndev);
1210 }
1209 1211
1210 priv = netdev_priv(ndev); 1212 priv = netdev_priv(ndev);
1211 priv->ndev = ndev; 1213 priv->ndev = ndev;
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
index 8b1b7e8ca56c..5e655c3601cf 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
@@ -115,8 +115,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfn)
115 115
116void qed_l2_setup(struct qed_hwfn *p_hwfn) 116void qed_l2_setup(struct qed_hwfn *p_hwfn)
117{ 117{
118 if (p_hwfn->hw_info.personality != QED_PCI_ETH && 118 if (!QED_IS_L2_PERSONALITY(p_hwfn))
119 p_hwfn->hw_info.personality != QED_PCI_ETH_ROCE)
120 return; 119 return;
121 120
122 mutex_init(&p_hwfn->p_l2_info->lock); 121 mutex_init(&p_hwfn->p_l2_info->lock);
@@ -126,8 +125,7 @@ void qed_l2_free(struct qed_hwfn *p_hwfn)
126{ 125{
127 u32 i; 126 u32 i;
128 127
129 if (p_hwfn->hw_info.personality != QED_PCI_ETH && 128 if (!QED_IS_L2_PERSONALITY(p_hwfn))
130 p_hwfn->hw_info.personality != QED_PCI_ETH_ROCE)
131 return; 129 return;
132 130
133 if (!p_hwfn->p_l2_info) 131 if (!p_hwfn->p_l2_info)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index 70bc5634675c..9feed3b79cd4 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -680,7 +680,7 @@ static int qed_nic_stop(struct qed_dev *cdev)
680 tasklet_disable(p_hwfn->sp_dpc); 680 tasklet_disable(p_hwfn->sp_dpc);
681 p_hwfn->b_sp_dpc_enabled = false; 681 p_hwfn->b_sp_dpc_enabled = false;
682 DP_VERBOSE(cdev, NETIF_MSG_IFDOWN, 682 DP_VERBOSE(cdev, NETIF_MSG_IFDOWN,
683 "Disabled sp taskelt [hwfn %d] at %p\n", 683 "Disabled sp tasklet [hwfn %d] at %p\n",
684 i, p_hwfn->sp_dpc); 684 i, p_hwfn->sp_dpc);
685 } 685 }
686 } 686 }
diff --git a/drivers/net/ethernet/qlogic/qede/qede_rdma.c b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
index 50b142fad6b8..1900bf7e67d1 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_rdma.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_rdma.c
@@ -238,7 +238,7 @@ qede_rdma_get_free_event_node(struct qede_dev *edev)
238 } 238 }
239 239
240 if (!found) { 240 if (!found) {
241 event_node = kzalloc(sizeof(*event_node), GFP_KERNEL); 241 event_node = kzalloc(sizeof(*event_node), GFP_ATOMIC);
242 if (!event_node) { 242 if (!event_node) {
243 DP_NOTICE(edev, 243 DP_NOTICE(edev,
244 "qedr: Could not allocate memory for rdma work\n"); 244 "qedr: Could not allocate memory for rdma work\n");
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 6d99b141a7aa..2c2f0c5b3f94 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4662,6 +4662,9 @@ static void r8168_phy_power_up(struct rtl8169_private *tp)
4662 break; 4662 break;
4663 } 4663 }
4664 rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE); 4664 rtl_writephy(tp, MII_BMCR, BMCR_ANENABLE);
4665
4666 /* give MAC/PHY some time to resume */
4667 msleep(20);
4665} 4668}
4666 4669
4667static void r8168_phy_power_down(struct rtl8169_private *tp) 4670static void r8168_phy_power_down(struct rtl8169_private *tp)
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index f081de4f38d7..88c12474a0c3 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3443,7 +3443,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3443 3443
3444 len = (val & RCR_ENTRY_L2_LEN) >> 3444 len = (val & RCR_ENTRY_L2_LEN) >>
3445 RCR_ENTRY_L2_LEN_SHIFT; 3445 RCR_ENTRY_L2_LEN_SHIFT;
3446 len -= ETH_FCS_LEN; 3446 append_size = len + ETH_HLEN + ETH_FCS_LEN;
3447 3447
3448 addr = (val & RCR_ENTRY_PKT_BUF_ADDR) << 3448 addr = (val & RCR_ENTRY_PKT_BUF_ADDR) <<
3449 RCR_ENTRY_PKT_BUF_ADDR_SHIFT; 3449 RCR_ENTRY_PKT_BUF_ADDR_SHIFT;
@@ -3453,7 +3453,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3453 RCR_ENTRY_PKTBUFSZ_SHIFT]; 3453 RCR_ENTRY_PKTBUFSZ_SHIFT];
3454 3454
3455 off = addr & ~PAGE_MASK; 3455 off = addr & ~PAGE_MASK;
3456 append_size = rcr_size;
3457 if (num_rcr == 1) { 3456 if (num_rcr == 1) {
3458 int ptype; 3457 int ptype;
3459 3458
@@ -3466,7 +3465,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3466 else 3465 else
3467 skb_checksum_none_assert(skb); 3466 skb_checksum_none_assert(skb);
3468 } else if (!(val & RCR_ENTRY_MULTI)) 3467 } else if (!(val & RCR_ENTRY_MULTI))
3469 append_size = len - skb->len; 3468 append_size = append_size - skb->len;
3470 3469
3471 niu_rx_skb_append(skb, page, off, append_size, rcr_size); 3470 niu_rx_skb_append(skb, page, off, append_size, rcr_size);
3472 if ((page->index + rp->rbr_block_size) - rcr_size == addr) { 3471 if ((page->index + rp->rbr_block_size) - rcr_size == addr) {
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index ecc84954c511..da07ccdf84bf 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1840,7 +1840,8 @@ static int netvsc_vf_join(struct net_device *vf_netdev,
1840 goto rx_handler_failed; 1840 goto rx_handler_failed;
1841 } 1841 }
1842 1842
1843 ret = netdev_upper_dev_link(vf_netdev, ndev, NULL); 1843 ret = netdev_master_upper_dev_link(vf_netdev, ndev,
1844 NULL, NULL, NULL);
1844 if (ret != 0) { 1845 if (ret != 0) {
1845 netdev_err(vf_netdev, 1846 netdev_err(vf_netdev,
1846 "can not set master device %s (err = %d)\n", 1847 "can not set master device %s (err = %d)\n",
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 3cb2c4666b2c..7f3dab4b4cbc 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -1316,7 +1316,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
1316 rndis_device->link_state ? "down" : "up"); 1316 rndis_device->link_state ? "down" : "up");
1317 1317
1318 if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) 1318 if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5)
1319 return net_device; 1319 goto out;
1320 1320
1321 rndis_filter_query_link_speed(rndis_device, net_device); 1321 rndis_filter_query_link_speed(rndis_device, net_device);
1322 1322
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 9fb9b565a002..4f684cbcdc57 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -1045,7 +1045,7 @@ static int atusb_probe(struct usb_interface *interface,
1045 atusb->tx_dr.bRequest = ATUSB_TX; 1045 atusb->tx_dr.bRequest = ATUSB_TX;
1046 atusb->tx_dr.wValue = cpu_to_le16(0); 1046 atusb->tx_dr.wValue = cpu_to_le16(0);
1047 1047
1048 atusb->tx_urb = usb_alloc_urb(0, GFP_ATOMIC); 1048 atusb->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
1049 if (!atusb->tx_urb) 1049 if (!atusb->tx_urb)
1050 goto fail; 1050 goto fail;
1051 1051
diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
index 55a22c761808..de0d7f28a181 100644
--- a/drivers/net/ieee802154/mcr20a.c
+++ b/drivers/net/ieee802154/mcr20a.c
@@ -1267,7 +1267,7 @@ mcr20a_probe(struct spi_device *spi)
1267 ret = mcr20a_get_platform_data(spi, pdata); 1267 ret = mcr20a_get_platform_data(spi, pdata);
1268 if (ret < 0) { 1268 if (ret < 0) {
1269 dev_crit(&spi->dev, "mcr20a_get_platform_data failed.\n"); 1269 dev_crit(&spi->dev, "mcr20a_get_platform_data failed.\n");
1270 return ret; 1270 goto free_pdata;
1271 } 1271 }
1272 1272
1273 /* init reset gpio */ 1273 /* init reset gpio */
@@ -1275,7 +1275,7 @@ mcr20a_probe(struct spi_device *spi)
1275 ret = devm_gpio_request_one(&spi->dev, pdata->rst_gpio, 1275 ret = devm_gpio_request_one(&spi->dev, pdata->rst_gpio,
1276 GPIOF_OUT_INIT_HIGH, "reset"); 1276 GPIOF_OUT_INIT_HIGH, "reset");
1277 if (ret) 1277 if (ret)
1278 return ret; 1278 goto free_pdata;
1279 } 1279 }
1280 1280
1281 /* reset mcr20a */ 1281 /* reset mcr20a */
@@ -1291,7 +1291,8 @@ mcr20a_probe(struct spi_device *spi)
1291 hw = ieee802154_alloc_hw(sizeof(*lp), &mcr20a_hw_ops); 1291 hw = ieee802154_alloc_hw(sizeof(*lp), &mcr20a_hw_ops);
1292 if (!hw) { 1292 if (!hw) {
1293 dev_crit(&spi->dev, "ieee802154_alloc_hw failed\n"); 1293 dev_crit(&spi->dev, "ieee802154_alloc_hw failed\n");
1294 return -ENOMEM; 1294 ret = -ENOMEM;
1295 goto free_pdata;
1295 } 1296 }
1296 1297
1297 /* init mcr20a local data */ 1298 /* init mcr20a local data */
@@ -1308,8 +1309,10 @@ mcr20a_probe(struct spi_device *spi)
1308 /* init buf */ 1309 /* init buf */
1309 lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL); 1310 lp->buf = devm_kzalloc(&spi->dev, SPI_COMMAND_BUFFER, GFP_KERNEL);
1310 1311
1311 if (!lp->buf) 1312 if (!lp->buf) {
1312 return -ENOMEM; 1313 ret = -ENOMEM;
1314 goto free_dev;
1315 }
1313 1316
1314 mcr20a_setup_tx_spi_messages(lp); 1317 mcr20a_setup_tx_spi_messages(lp);
1315 mcr20a_setup_rx_spi_messages(lp); 1318 mcr20a_setup_rx_spi_messages(lp);
@@ -1366,6 +1369,8 @@ mcr20a_probe(struct spi_device *spi)
1366 1369
1367free_dev: 1370free_dev:
1368 ieee802154_free_hw(lp->hw); 1371 ieee802154_free_hw(lp->hw);
1372free_pdata:
1373 kfree(pdata);
1369 1374
1370 return ret; 1375 return ret;
1371} 1376}
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 3bb6b66dc7bf..f9c25912eb98 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -720,6 +720,15 @@ static struct phy_driver broadcom_drivers[] = {
720 .get_strings = bcm_phy_get_strings, 720 .get_strings = bcm_phy_get_strings,
721 .get_stats = bcm53xx_phy_get_stats, 721 .get_stats = bcm53xx_phy_get_stats,
722 .probe = bcm53xx_phy_probe, 722 .probe = bcm53xx_phy_probe,
723}, {
724 .phy_id = PHY_ID_BCM89610,
725 .phy_id_mask = 0xfffffff0,
726 .name = "Broadcom BCM89610",
727 .features = PHY_GBIT_FEATURES,
728 .flags = PHY_HAS_INTERRUPT,
729 .config_init = bcm54xx_config_init,
730 .ack_interrupt = bcm_phy_ack_intr,
731 .config_intr = bcm_phy_config_intr,
723} }; 732} };
724 733
725module_phy_driver(broadcom_drivers); 734module_phy_driver(broadcom_drivers);
@@ -741,6 +750,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
741 { PHY_ID_BCMAC131, 0xfffffff0 }, 750 { PHY_ID_BCMAC131, 0xfffffff0 },
742 { PHY_ID_BCM5241, 0xfffffff0 }, 751 { PHY_ID_BCM5241, 0xfffffff0 },
743 { PHY_ID_BCM5395, 0xfffffff0 }, 752 { PHY_ID_BCM5395, 0xfffffff0 },
753 { PHY_ID_BCM89610, 0xfffffff0 },
744 { } 754 { }
745}; 755};
746 756
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index b2f4519dfb84..d437f4f5ed52 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -125,7 +125,7 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
125 if (id->base.br_nominal) { 125 if (id->base.br_nominal) {
126 if (id->base.br_nominal != 255) { 126 if (id->base.br_nominal != 255) {
127 br_nom = id->base.br_nominal * 100; 127 br_nom = id->base.br_nominal * 100;
128 br_min = br_nom + id->base.br_nominal * id->ext.br_min; 128 br_min = br_nom - id->base.br_nominal * id->ext.br_min;
129 br_max = br_nom + id->base.br_nominal * id->ext.br_max; 129 br_max = br_nom + id->base.br_nominal * id->ext.br_max;
130 } else if (id->ext.br_max) { 130 } else if (id->ext.br_max) {
131 br_nom = 250 * id->ext.br_max; 131 br_nom = 250 * id->ext.br_max;
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 96d26cfae90b..4a017a0d71ea 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3236,6 +3236,7 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
3236 GENL_SET_ERR_MSG(info,"MAC is no valid source addr"); 3236 GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
3237 NL_SET_BAD_ATTR(info->extack, 3237 NL_SET_BAD_ATTR(info->extack,
3238 info->attrs[HWSIM_ATTR_PERM_ADDR]); 3238 info->attrs[HWSIM_ATTR_PERM_ADDR]);
3239 kfree(hwname);
3239 return -EINVAL; 3240 return -EINVAL;
3240 } 3241 }
3241 3242
diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
index b979cf3bce65..88a8b5916624 100644
--- a/drivers/nvme/host/Kconfig
+++ b/drivers/nvme/host/Kconfig
@@ -27,7 +27,7 @@ config NVME_FABRICS
27 27
28config NVME_RDMA 28config NVME_RDMA
29 tristate "NVM Express over Fabrics RDMA host driver" 29 tristate "NVM Express over Fabrics RDMA host driver"
30 depends on INFINIBAND && BLOCK 30 depends on INFINIBAND && INFINIBAND_ADDR_TRANS && BLOCK
31 select NVME_CORE 31 select NVME_CORE
32 select NVME_FABRICS 32 select NVME_FABRICS
33 select SG_POOL 33 select SG_POOL
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9df4f71e58ca..a3771c5729f5 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -764,6 +764,7 @@ static int nvme_submit_user_cmd(struct request_queue *q,
764 ret = PTR_ERR(meta); 764 ret = PTR_ERR(meta);
765 goto out_unmap; 765 goto out_unmap;
766 } 766 }
767 req->cmd_flags |= REQ_INTEGRITY;
767 } 768 }
768 } 769 }
769 770
@@ -2997,31 +2998,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
2997 if (nvme_init_ns_head(ns, nsid, id)) 2998 if (nvme_init_ns_head(ns, nsid, id))
2998 goto out_free_id; 2999 goto out_free_id;
2999 nvme_setup_streams_ns(ctrl, ns); 3000 nvme_setup_streams_ns(ctrl, ns);
3000 3001 nvme_set_disk_name(disk_name, ns, ctrl, &flags);
3001#ifdef CONFIG_NVME_MULTIPATH
3002 /*
3003 * If multipathing is enabled we need to always use the subsystem
3004 * instance number for numbering our devices to avoid conflicts
3005 * between subsystems that have multiple controllers and thus use
3006 * the multipath-aware subsystem node and those that have a single
3007 * controller and use the controller node directly.
3008 */
3009 if (ns->head->disk) {
3010 sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
3011 ctrl->cntlid, ns->head->instance);
3012 flags = GENHD_FL_HIDDEN;
3013 } else {
3014 sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance,
3015 ns->head->instance);
3016 }
3017#else
3018 /*
3019 * But without the multipath code enabled, multiple controller per
3020 * subsystems are visible as devices and thus we cannot use the
3021 * subsystem instance.
3022 */
3023 sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
3024#endif
3025 3002
3026 if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) { 3003 if ((ctrl->quirks & NVME_QUIRK_LIGHTNVM) && id->vs[0] == 0x1) {
3027 if (nvme_nvm_register(ns, disk_name, node)) { 3004 if (nvme_nvm_register(ns, disk_name, node)) {
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 124c458806df..7ae732a77fe8 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -668,6 +668,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
668 ret = -ENOMEM; 668 ret = -ENOMEM;
669 goto out; 669 goto out;
670 } 670 }
671 kfree(opts->transport);
671 opts->transport = p; 672 opts->transport = p;
672 break; 673 break;
673 case NVMF_OPT_NQN: 674 case NVMF_OPT_NQN:
@@ -676,6 +677,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
676 ret = -ENOMEM; 677 ret = -ENOMEM;
677 goto out; 678 goto out;
678 } 679 }
680 kfree(opts->subsysnqn);
679 opts->subsysnqn = p; 681 opts->subsysnqn = p;
680 nqnlen = strlen(opts->subsysnqn); 682 nqnlen = strlen(opts->subsysnqn);
681 if (nqnlen >= NVMF_NQN_SIZE) { 683 if (nqnlen >= NVMF_NQN_SIZE) {
@@ -698,6 +700,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
698 ret = -ENOMEM; 700 ret = -ENOMEM;
699 goto out; 701 goto out;
700 } 702 }
703 kfree(opts->traddr);
701 opts->traddr = p; 704 opts->traddr = p;
702 break; 705 break;
703 case NVMF_OPT_TRSVCID: 706 case NVMF_OPT_TRSVCID:
@@ -706,6 +709,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
706 ret = -ENOMEM; 709 ret = -ENOMEM;
707 goto out; 710 goto out;
708 } 711 }
712 kfree(opts->trsvcid);
709 opts->trsvcid = p; 713 opts->trsvcid = p;
710 break; 714 break;
711 case NVMF_OPT_QUEUE_SIZE: 715 case NVMF_OPT_QUEUE_SIZE:
@@ -792,6 +796,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
792 ret = -EINVAL; 796 ret = -EINVAL;
793 goto out; 797 goto out;
794 } 798 }
799 nvmf_host_put(opts->host);
795 opts->host = nvmf_host_add(p); 800 opts->host = nvmf_host_add(p);
796 kfree(p); 801 kfree(p);
797 if (!opts->host) { 802 if (!opts->host) {
@@ -817,6 +822,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
817 ret = -ENOMEM; 822 ret = -ENOMEM;
818 goto out; 823 goto out;
819 } 824 }
825 kfree(opts->host_traddr);
820 opts->host_traddr = p; 826 opts->host_traddr = p;
821 break; 827 break;
822 case NVMF_OPT_HOST_ID: 828 case NVMF_OPT_HOST_ID:
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 956e0b8e9c4d..d7b664ae5923 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -15,10 +15,32 @@
15#include "nvme.h" 15#include "nvme.h"
16 16
17static bool multipath = true; 17static bool multipath = true;
18module_param(multipath, bool, 0644); 18module_param(multipath, bool, 0444);
19MODULE_PARM_DESC(multipath, 19MODULE_PARM_DESC(multipath,
20 "turn on native support for multiple controllers per subsystem"); 20 "turn on native support for multiple controllers per subsystem");
21 21
22/*
23 * If multipathing is enabled we need to always use the subsystem instance
24 * number for numbering our devices to avoid conflicts between subsystems that
25 * have multiple controllers and thus use the multipath-aware subsystem node
26 * and those that have a single controller and use the controller node
27 * directly.
28 */
29void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
30 struct nvme_ctrl *ctrl, int *flags)
31{
32 if (!multipath) {
33 sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
34 } else if (ns->head->disk) {
35 sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
36 ctrl->cntlid, ns->head->instance);
37 *flags = GENHD_FL_HIDDEN;
38 } else {
39 sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance,
40 ns->head->instance);
41 }
42}
43
22void nvme_failover_req(struct request *req) 44void nvme_failover_req(struct request *req)
23{ 45{
24 struct nvme_ns *ns = req->q->queuedata; 46 struct nvme_ns *ns = req->q->queuedata;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 061fecfd44f5..7ded7a51c430 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -436,6 +436,8 @@ extern const struct attribute_group nvme_ns_id_attr_group;
436extern const struct block_device_operations nvme_ns_head_ops; 436extern const struct block_device_operations nvme_ns_head_ops;
437 437
438#ifdef CONFIG_NVME_MULTIPATH 438#ifdef CONFIG_NVME_MULTIPATH
439void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
440 struct nvme_ctrl *ctrl, int *flags);
439void nvme_failover_req(struct request *req); 441void nvme_failover_req(struct request *req);
440bool nvme_req_needs_failover(struct request *req, blk_status_t error); 442bool nvme_req_needs_failover(struct request *req, blk_status_t error);
441void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); 443void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
@@ -461,6 +463,16 @@ static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
461} 463}
462 464
463#else 465#else
466/*
467 * Without the multipath code enabled, multiple controller per subsystems are
468 * visible as devices and thus we cannot use the subsystem instance.
469 */
470static inline void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
471 struct nvme_ctrl *ctrl, int *flags)
472{
473 sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
474}
475
464static inline void nvme_failover_req(struct request *req) 476static inline void nvme_failover_req(struct request *req)
465{ 477{
466} 478}
diff --git a/drivers/nvme/target/Kconfig b/drivers/nvme/target/Kconfig
index 5f4f8b16685f..3c7b61ddb0d1 100644
--- a/drivers/nvme/target/Kconfig
+++ b/drivers/nvme/target/Kconfig
@@ -27,7 +27,7 @@ config NVME_TARGET_LOOP
27 27
28config NVME_TARGET_RDMA 28config NVME_TARGET_RDMA
29 tristate "NVMe over Fabrics RDMA target support" 29 tristate "NVMe over Fabrics RDMA target support"
30 depends on INFINIBAND 30 depends on INFINIBAND && INFINIBAND_ADDR_TRANS
31 depends on NVME_TARGET 31 depends on NVME_TARGET
32 select SGL_ALLOC 32 select SGL_ALLOC
33 help 33 help
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index 31fdfba556a8..27a8561c0cb9 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -469,6 +469,12 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work)
469 nvme_stop_ctrl(&ctrl->ctrl); 469 nvme_stop_ctrl(&ctrl->ctrl);
470 nvme_loop_shutdown_ctrl(ctrl); 470 nvme_loop_shutdown_ctrl(ctrl);
471 471
472 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
473 /* state change failure should never happen */
474 WARN_ON_ONCE(1);
475 return;
476 }
477
472 ret = nvme_loop_configure_admin_queue(ctrl); 478 ret = nvme_loop_configure_admin_queue(ctrl);
473 if (ret) 479 if (ret)
474 goto out_disable; 480 goto out_disable;
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index b35fe88f1851..7baa53e5b1d7 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -102,12 +102,28 @@ static DEFINE_IDR(ovcs_idr);
102 102
103static BLOCKING_NOTIFIER_HEAD(overlay_notify_chain); 103static BLOCKING_NOTIFIER_HEAD(overlay_notify_chain);
104 104
105/**
106 * of_overlay_notifier_register() - Register notifier for overlay operations
107 * @nb: Notifier block to register
108 *
109 * Register for notification on overlay operations on device tree nodes. The
110 * reported actions definied by @of_reconfig_change. The notifier callback
111 * furthermore receives a pointer to the affected device tree node.
112 *
113 * Note that a notifier callback is not supposed to store pointers to a device
114 * tree node or its content beyond @OF_OVERLAY_POST_REMOVE corresponding to the
115 * respective node it received.
116 */
105int of_overlay_notifier_register(struct notifier_block *nb) 117int of_overlay_notifier_register(struct notifier_block *nb)
106{ 118{
107 return blocking_notifier_chain_register(&overlay_notify_chain, nb); 119 return blocking_notifier_chain_register(&overlay_notify_chain, nb);
108} 120}
109EXPORT_SYMBOL_GPL(of_overlay_notifier_register); 121EXPORT_SYMBOL_GPL(of_overlay_notifier_register);
110 122
123/**
124 * of_overlay_notifier_register() - Unregister notifier for overlay operations
125 * @nb: Notifier block to unregister
126 */
111int of_overlay_notifier_unregister(struct notifier_block *nb) 127int of_overlay_notifier_unregister(struct notifier_block *nb)
112{ 128{
113 return blocking_notifier_chain_unregister(&overlay_notify_chain, nb); 129 return blocking_notifier_chain_unregister(&overlay_notify_chain, nb);
@@ -671,17 +687,13 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs)
671 of_node_put(ovcs->fragments[i].overlay); 687 of_node_put(ovcs->fragments[i].overlay);
672 } 688 }
673 kfree(ovcs->fragments); 689 kfree(ovcs->fragments);
674
675 /* 690 /*
676 * TODO 691 * There should be no live pointers into ovcs->overlay_tree and
677 * 692 * ovcs->fdt due to the policy that overlay notifiers are not allowed
678 * would like to: kfree(ovcs->overlay_tree); 693 * to retain pointers into the overlay devicetree.
679 * but can not since drivers may have pointers into this data
680 *
681 * would like to: kfree(ovcs->fdt);
682 * but can not since drivers may have pointers into this data
683 */ 694 */
684 695 kfree(ovcs->overlay_tree);
696 kfree(ovcs->fdt);
685 kfree(ovcs); 697 kfree(ovcs);
686} 698}
687 699
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a04197ce767d..dbfe7c4f3776 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1910,7 +1910,7 @@ void pci_pme_active(struct pci_dev *dev, bool enable)
1910EXPORT_SYMBOL(pci_pme_active); 1910EXPORT_SYMBOL(pci_pme_active);
1911 1911
1912/** 1912/**
1913 * pci_enable_wake - enable PCI device as wakeup event source 1913 * __pci_enable_wake - enable PCI device as wakeup event source
1914 * @dev: PCI device affected 1914 * @dev: PCI device affected
1915 * @state: PCI state from which device will issue wakeup events 1915 * @state: PCI state from which device will issue wakeup events
1916 * @enable: True to enable event generation; false to disable 1916 * @enable: True to enable event generation; false to disable
@@ -1928,7 +1928,7 @@ EXPORT_SYMBOL(pci_pme_active);
1928 * Error code depending on the platform is returned if both the platform and 1928 * Error code depending on the platform is returned if both the platform and
1929 * the native mechanism fail to enable the generation of wake-up events 1929 * the native mechanism fail to enable the generation of wake-up events
1930 */ 1930 */
1931int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable) 1931static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
1932{ 1932{
1933 int ret = 0; 1933 int ret = 0;
1934 1934
@@ -1969,6 +1969,23 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
1969 1969
1970 return ret; 1970 return ret;
1971} 1971}
1972
1973/**
1974 * pci_enable_wake - change wakeup settings for a PCI device
1975 * @pci_dev: Target device
1976 * @state: PCI state from which device will issue wakeup events
1977 * @enable: Whether or not to enable event generation
1978 *
1979 * If @enable is set, check device_may_wakeup() for the device before calling
1980 * __pci_enable_wake() for it.
1981 */
1982int pci_enable_wake(struct pci_dev *pci_dev, pci_power_t state, bool enable)
1983{
1984 if (enable && !device_may_wakeup(&pci_dev->dev))
1985 return -EINVAL;
1986
1987 return __pci_enable_wake(pci_dev, state, enable);
1988}
1972EXPORT_SYMBOL(pci_enable_wake); 1989EXPORT_SYMBOL(pci_enable_wake);
1973 1990
1974/** 1991/**
@@ -1981,9 +1998,9 @@ EXPORT_SYMBOL(pci_enable_wake);
1981 * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI 1998 * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI
1982 * ordering constraints. 1999 * ordering constraints.
1983 * 2000 *
1984 * This function only returns error code if the device is not capable of 2001 * This function only returns error code if the device is not allowed to wake
1985 * generating PME# from both D3_hot and D3_cold, and the platform is unable to 2002 * up the system from sleep or it is not capable of generating PME# from both
1986 * enable wake-up power for it. 2003 * D3_hot and D3_cold and the platform is unable to enable wake-up power for it.
1987 */ 2004 */
1988int pci_wake_from_d3(struct pci_dev *dev, bool enable) 2005int pci_wake_from_d3(struct pci_dev *dev, bool enable)
1989{ 2006{
@@ -2114,7 +2131,7 @@ int pci_finish_runtime_suspend(struct pci_dev *dev)
2114 2131
2115 dev->runtime_d3cold = target_state == PCI_D3cold; 2132 dev->runtime_d3cold = target_state == PCI_D3cold;
2116 2133
2117 pci_enable_wake(dev, target_state, pci_dev_run_wake(dev)); 2134 __pci_enable_wake(dev, target_state, pci_dev_run_wake(dev));
2118 2135
2119 error = pci_set_power_state(dev, target_state); 2136 error = pci_set_power_state(dev, target_state);
2120 2137
@@ -2138,16 +2155,16 @@ bool pci_dev_run_wake(struct pci_dev *dev)
2138{ 2155{
2139 struct pci_bus *bus = dev->bus; 2156 struct pci_bus *bus = dev->bus;
2140 2157
2141 if (device_can_wakeup(&dev->dev))
2142 return true;
2143
2144 if (!dev->pme_support) 2158 if (!dev->pme_support)
2145 return false; 2159 return false;
2146 2160
2147 /* PME-capable in principle, but not from the target power state */ 2161 /* PME-capable in principle, but not from the target power state */
2148 if (!pci_pme_capable(dev, pci_target_state(dev, false))) 2162 if (!pci_pme_capable(dev, pci_target_state(dev, true)))
2149 return false; 2163 return false;
2150 2164
2165 if (device_can_wakeup(&dev->dev))
2166 return true;
2167
2151 while (bus->parent) { 2168 while (bus->parent) {
2152 struct pci_dev *bridge = bus->self; 2169 struct pci_dev *bridge = bus->self;
2153 2170
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c
index b1ae1618fefe..fee9225ca559 100644
--- a/drivers/pinctrl/intel/pinctrl-cherryview.c
+++ b/drivers/pinctrl/intel/pinctrl-cherryview.c
@@ -1622,22 +1622,30 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
1622 1622
1623 if (!need_valid_mask) { 1623 if (!need_valid_mask) {
1624 irq_base = devm_irq_alloc_descs(pctrl->dev, -1, 0, 1624 irq_base = devm_irq_alloc_descs(pctrl->dev, -1, 0,
1625 chip->ngpio, NUMA_NO_NODE); 1625 community->npins, NUMA_NO_NODE);
1626 if (irq_base < 0) { 1626 if (irq_base < 0) {
1627 dev_err(pctrl->dev, "Failed to allocate IRQ numbers\n"); 1627 dev_err(pctrl->dev, "Failed to allocate IRQ numbers\n");
1628 return irq_base; 1628 return irq_base;
1629 } 1629 }
1630 } else {
1631 irq_base = 0;
1632 } 1630 }
1633 1631
1634 ret = gpiochip_irqchip_add(chip, &chv_gpio_irqchip, irq_base, 1632 ret = gpiochip_irqchip_add(chip, &chv_gpio_irqchip, 0,
1635 handle_bad_irq, IRQ_TYPE_NONE); 1633 handle_bad_irq, IRQ_TYPE_NONE);
1636 if (ret) { 1634 if (ret) {
1637 dev_err(pctrl->dev, "failed to add IRQ chip\n"); 1635 dev_err(pctrl->dev, "failed to add IRQ chip\n");
1638 return ret; 1636 return ret;
1639 } 1637 }
1640 1638
1639 if (!need_valid_mask) {
1640 for (i = 0; i < community->ngpio_ranges; i++) {
1641 range = &community->gpio_ranges[i];
1642
1643 irq_domain_associate_many(chip->irq.domain, irq_base,
1644 range->base, range->npins);
1645 irq_base += range->npins;
1646 }
1647 }
1648
1641 gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq, 1649 gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq,
1642 chv_gpio_irq_handler); 1650 chv_gpio_irq_handler);
1643 return 0; 1651 return 0;
diff --git a/drivers/pinctrl/intel/pinctrl-sunrisepoint.c b/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
index 8870a4100164..fee3435a6f15 100644
--- a/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
+++ b/drivers/pinctrl/intel/pinctrl-sunrisepoint.c
@@ -36,6 +36,27 @@
36 .npins = ((e) - (s) + 1), \ 36 .npins = ((e) - (s) + 1), \
37 } 37 }
38 38
39#define SPTH_GPP(r, s, e, g) \
40 { \
41 .reg_num = (r), \
42 .base = (s), \
43 .size = ((e) - (s) + 1), \
44 .gpio_base = (g), \
45 }
46
47#define SPTH_COMMUNITY(b, s, e, g) \
48 { \
49 .barno = (b), \
50 .padown_offset = SPT_PAD_OWN, \
51 .padcfglock_offset = SPT_PADCFGLOCK, \
52 .hostown_offset = SPT_HOSTSW_OWN, \
53 .ie_offset = SPT_GPI_IE, \
54 .pin_base = (s), \
55 .npins = ((e) - (s) + 1), \
56 .gpps = (g), \
57 .ngpps = ARRAY_SIZE(g), \
58 }
59
39/* Sunrisepoint-LP */ 60/* Sunrisepoint-LP */
40static const struct pinctrl_pin_desc sptlp_pins[] = { 61static const struct pinctrl_pin_desc sptlp_pins[] = {
41 /* GPP_A */ 62 /* GPP_A */
@@ -531,10 +552,28 @@ static const struct intel_function spth_functions[] = {
531 FUNCTION("i2c2", spth_i2c2_groups), 552 FUNCTION("i2c2", spth_i2c2_groups),
532}; 553};
533 554
555static const struct intel_padgroup spth_community0_gpps[] = {
556 SPTH_GPP(0, 0, 23, 0), /* GPP_A */
557 SPTH_GPP(1, 24, 47, 24), /* GPP_B */
558};
559
560static const struct intel_padgroup spth_community1_gpps[] = {
561 SPTH_GPP(0, 48, 71, 48), /* GPP_C */
562 SPTH_GPP(1, 72, 95, 72), /* GPP_D */
563 SPTH_GPP(2, 96, 108, 96), /* GPP_E */
564 SPTH_GPP(3, 109, 132, 120), /* GPP_F */
565 SPTH_GPP(4, 133, 156, 144), /* GPP_G */
566 SPTH_GPP(5, 157, 180, 168), /* GPP_H */
567};
568
569static const struct intel_padgroup spth_community3_gpps[] = {
570 SPTH_GPP(0, 181, 191, 192), /* GPP_I */
571};
572
534static const struct intel_community spth_communities[] = { 573static const struct intel_community spth_communities[] = {
535 SPT_COMMUNITY(0, 0, 47), 574 SPTH_COMMUNITY(0, 0, 47, spth_community0_gpps),
536 SPT_COMMUNITY(1, 48, 180), 575 SPTH_COMMUNITY(1, 48, 180, spth_community1_gpps),
537 SPT_COMMUNITY(2, 181, 191), 576 SPTH_COMMUNITY(2, 181, 191, spth_community3_gpps),
538}; 577};
539 578
540static const struct intel_pinctrl_soc_data spth_soc_data = { 579static const struct intel_pinctrl_soc_data spth_soc_data = {
diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg.c b/drivers/pinctrl/meson/pinctrl-meson-axg.c
index 4b91ff74779b..99a6ceac8e53 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg.c
@@ -898,7 +898,7 @@ static struct meson_bank meson_axg_periphs_banks[] = {
898 898
899static struct meson_bank meson_axg_aobus_banks[] = { 899static struct meson_bank meson_axg_aobus_banks[] = {
900 /* name first last irq pullen pull dir out in */ 900 /* name first last irq pullen pull dir out in */
901 BANK("AO", GPIOAO_0, GPIOAO_9, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0), 901 BANK("AO", GPIOAO_0, GPIOAO_13, 0, 13, 0, 16, 0, 0, 0, 0, 0, 16, 1, 0),
902}; 902};
903 903
904static struct meson_pmx_bank meson_axg_periphs_pmx_banks[] = { 904static struct meson_pmx_bank meson_axg_periphs_pmx_banks[] = {
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 39d06dd1f63a..bc309c5327ff 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -154,7 +154,7 @@ config DELL_LAPTOP
154 depends on ACPI_VIDEO || ACPI_VIDEO = n 154 depends on ACPI_VIDEO || ACPI_VIDEO = n
155 depends on RFKILL || RFKILL = n 155 depends on RFKILL || RFKILL = n
156 depends on SERIO_I8042 156 depends on SERIO_I8042
157 select DELL_SMBIOS 157 depends on DELL_SMBIOS
158 select POWER_SUPPLY 158 select POWER_SUPPLY
159 select LEDS_CLASS 159 select LEDS_CLASS
160 select NEW_LEDS 160 select NEW_LEDS
diff --git a/drivers/platform/x86/asus-wireless.c b/drivers/platform/x86/asus-wireless.c
index d4aeac3477f5..f086469ea740 100644
--- a/drivers/platform/x86/asus-wireless.c
+++ b/drivers/platform/x86/asus-wireless.c
@@ -178,8 +178,10 @@ static int asus_wireless_remove(struct acpi_device *adev)
178{ 178{
179 struct asus_wireless_data *data = acpi_driver_data(adev); 179 struct asus_wireless_data *data = acpi_driver_data(adev);
180 180
181 if (data->wq) 181 if (data->wq) {
182 devm_led_classdev_unregister(&adev->dev, &data->led);
182 destroy_workqueue(data->wq); 183 destroy_workqueue(data->wq);
184 }
183 return 0; 185 return 0;
184} 186}
185 187
diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
index 8e70a627e0bb..cbbafdcaaecb 100644
--- a/drivers/remoteproc/qcom_q6v5_pil.c
+++ b/drivers/remoteproc/qcom_q6v5_pil.c
@@ -1083,6 +1083,7 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc)
1083 dev_err(qproc->dev, "unable to resolve mba region\n"); 1083 dev_err(qproc->dev, "unable to resolve mba region\n");
1084 return ret; 1084 return ret;
1085 } 1085 }
1086 of_node_put(node);
1086 1087
1087 qproc->mba_phys = r.start; 1088 qproc->mba_phys = r.start;
1088 qproc->mba_size = resource_size(&r); 1089 qproc->mba_size = resource_size(&r);
@@ -1100,6 +1101,7 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc)
1100 dev_err(qproc->dev, "unable to resolve mpss region\n"); 1101 dev_err(qproc->dev, "unable to resolve mpss region\n");
1101 return ret; 1102 return ret;
1102 } 1103 }
1104 of_node_put(node);
1103 1105
1104 qproc->mpss_phys = qproc->mpss_reloc = r.start; 1106 qproc->mpss_phys = qproc->mpss_reloc = r.start;
1105 qproc->mpss_size = resource_size(&r); 1107 qproc->mpss_size = resource_size(&r);
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 6d9c5832ce47..a9609d971f7f 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1163,7 +1163,7 @@ int rproc_trigger_recovery(struct rproc *rproc)
1163 if (ret) 1163 if (ret)
1164 return ret; 1164 return ret;
1165 1165
1166 ret = rproc_stop(rproc, false); 1166 ret = rproc_stop(rproc, true);
1167 if (ret) 1167 if (ret)
1168 goto unlock_mutex; 1168 goto unlock_mutex;
1169 1169
@@ -1316,7 +1316,7 @@ void rproc_shutdown(struct rproc *rproc)
1316 if (!atomic_dec_and_test(&rproc->power)) 1316 if (!atomic_dec_and_test(&rproc->power))
1317 goto out; 1317 goto out;
1318 1318
1319 ret = rproc_stop(rproc, true); 1319 ret = rproc_stop(rproc, false);
1320 if (ret) { 1320 if (ret) {
1321 atomic_inc(&rproc->power); 1321 atomic_inc(&rproc->power);
1322 goto out; 1322 goto out;
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 64b6de9763ee..1efdf9ff8679 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -581,4 +581,6 @@ static void rpmsg_chrdev_exit(void)
581 unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); 581 unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX);
582} 582}
583module_exit(rpmsg_chrdev_exit); 583module_exit(rpmsg_chrdev_exit);
584
585MODULE_ALIAS("rpmsg:rpmsg_chrdev");
584MODULE_LICENSE("GPL v2"); 586MODULE_LICENSE("GPL v2");
diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index 16cab40156ca..aeab05f682d9 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -1799,7 +1799,7 @@ static int imx_csi_probe(struct platform_device *pdev)
1799 priv->dev->of_node = pdata->of_node; 1799 priv->dev->of_node = pdata->of_node;
1800 pinctrl = devm_pinctrl_get_select_default(priv->dev); 1800 pinctrl = devm_pinctrl_get_select_default(priv->dev);
1801 if (IS_ERR(pinctrl)) { 1801 if (IS_ERR(pinctrl)) {
1802 ret = PTR_ERR(priv->vdev); 1802 ret = PTR_ERR(pinctrl);
1803 dev_dbg(priv->dev, 1803 dev_dbg(priv->dev,
1804 "devm_pinctrl_get_select_default() failed: %d\n", ret); 1804 "devm_pinctrl_get_select_default() failed: %d\n", ret);
1805 if (ret != -ENODEV) 1805 if (ret != -ENODEV)
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index c821b4b9647e..7b5cb28ffb35 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -191,7 +191,9 @@ static const unsigned short full_speed_maxpacket_maxes[4] = {
191static const unsigned short high_speed_maxpacket_maxes[4] = { 191static const unsigned short high_speed_maxpacket_maxes[4] = {
192 [USB_ENDPOINT_XFER_CONTROL] = 64, 192 [USB_ENDPOINT_XFER_CONTROL] = 64,
193 [USB_ENDPOINT_XFER_ISOC] = 1024, 193 [USB_ENDPOINT_XFER_ISOC] = 1024,
194 [USB_ENDPOINT_XFER_BULK] = 512, 194
195 /* Bulk should be 512, but some devices use 1024: we will warn below */
196 [USB_ENDPOINT_XFER_BULK] = 1024,
195 [USB_ENDPOINT_XFER_INT] = 1024, 197 [USB_ENDPOINT_XFER_INT] = 1024,
196}; 198};
197static const unsigned short super_speed_maxpacket_maxes[4] = { 199static const unsigned short super_speed_maxpacket_maxes[4] = {
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index d83be5651f87..a666e0758a99 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -985,6 +985,7 @@ struct dwc2_hsotg {
985 985
986 /* DWC OTG HW Release versions */ 986 /* DWC OTG HW Release versions */
987#define DWC2_CORE_REV_2_71a 0x4f54271a 987#define DWC2_CORE_REV_2_71a 0x4f54271a
988#define DWC2_CORE_REV_2_72a 0x4f54272a
988#define DWC2_CORE_REV_2_80a 0x4f54280a 989#define DWC2_CORE_REV_2_80a 0x4f54280a
989#define DWC2_CORE_REV_2_90a 0x4f54290a 990#define DWC2_CORE_REV_2_90a 0x4f54290a
990#define DWC2_CORE_REV_2_91a 0x4f54291a 991#define DWC2_CORE_REV_2_91a 0x4f54291a
@@ -992,6 +993,7 @@ struct dwc2_hsotg {
992#define DWC2_CORE_REV_2_94a 0x4f54294a 993#define DWC2_CORE_REV_2_94a 0x4f54294a
993#define DWC2_CORE_REV_3_00a 0x4f54300a 994#define DWC2_CORE_REV_3_00a 0x4f54300a
994#define DWC2_CORE_REV_3_10a 0x4f54310a 995#define DWC2_CORE_REV_3_10a 0x4f54310a
996#define DWC2_CORE_REV_4_00a 0x4f54400a
995#define DWC2_FS_IOT_REV_1_00a 0x5531100a 997#define DWC2_FS_IOT_REV_1_00a 0x5531100a
996#define DWC2_HS_IOT_REV_1_00a 0x5532100a 998#define DWC2_HS_IOT_REV_1_00a 0x5532100a
997 999
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 6c32bf26e48e..83cb5577a52f 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3928,6 +3928,27 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep,
3928 if (index && !hs_ep->isochronous) 3928 if (index && !hs_ep->isochronous)
3929 epctrl |= DXEPCTL_SETD0PID; 3929 epctrl |= DXEPCTL_SETD0PID;
3930 3930
3931 /* WA for Full speed ISOC IN in DDMA mode.
3932 * By Clear NAK status of EP, core will send ZLP
3933 * to IN token and assert NAK interrupt relying
3934 * on TxFIFO status only
3935 */
3936
3937 if (hsotg->gadget.speed == USB_SPEED_FULL &&
3938 hs_ep->isochronous && dir_in) {
3939 /* The WA applies only to core versions from 2.72a
3940 * to 4.00a (including both). Also for FS_IOT_1.00a
3941 * and HS_IOT_1.00a.
3942 */
3943 u32 gsnpsid = dwc2_readl(hsotg->regs + GSNPSID);
3944
3945 if ((gsnpsid >= DWC2_CORE_REV_2_72a &&
3946 gsnpsid <= DWC2_CORE_REV_4_00a) ||
3947 gsnpsid == DWC2_FS_IOT_REV_1_00a ||
3948 gsnpsid == DWC2_HS_IOT_REV_1_00a)
3949 epctrl |= DXEPCTL_CNAK;
3950 }
3951
3931 dev_dbg(hsotg->dev, "%s: write DxEPCTL=0x%08x\n", 3952 dev_dbg(hsotg->dev, "%s: write DxEPCTL=0x%08x\n",
3932 __func__, epctrl); 3953 __func__, epctrl);
3933 3954
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 190f95964000..c51b73b3e048 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -358,9 +358,14 @@ static void dwc2_gusbcfg_init(struct dwc2_hsotg *hsotg)
358 358
359static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg) 359static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg)
360{ 360{
361 int ret;
362
361 hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); 363 hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus");
362 if (IS_ERR(hsotg->vbus_supply)) 364 if (IS_ERR(hsotg->vbus_supply)) {
363 return 0; 365 ret = PTR_ERR(hsotg->vbus_supply);
366 hsotg->vbus_supply = NULL;
367 return ret == -ENODEV ? 0 : ret;
368 }
364 369
365 return regulator_enable(hsotg->vbus_supply); 370 return regulator_enable(hsotg->vbus_supply);
366} 371}
@@ -4342,9 +4347,7 @@ static int _dwc2_hcd_start(struct usb_hcd *hcd)
4342 4347
4343 spin_unlock_irqrestore(&hsotg->lock, flags); 4348 spin_unlock_irqrestore(&hsotg->lock, flags);
4344 4349
4345 dwc2_vbus_supply_init(hsotg); 4350 return dwc2_vbus_supply_init(hsotg);
4346
4347 return 0;
4348} 4351}
4349 4352
4350/* 4353/*
diff --git a/drivers/usb/dwc2/pci.c b/drivers/usb/dwc2/pci.c
index 7f21747007f1..bea2e8ec0369 100644
--- a/drivers/usb/dwc2/pci.c
+++ b/drivers/usb/dwc2/pci.c
@@ -141,8 +141,10 @@ static int dwc2_pci_probe(struct pci_dev *pci,
141 goto err; 141 goto err;
142 142
143 glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); 143 glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
144 if (!glue) 144 if (!glue) {
145 ret = -ENOMEM;
145 goto err; 146 goto err;
147 }
146 148
147 ret = platform_device_add(dwc2); 149 ret = platform_device_add(dwc2);
148 if (ret) { 150 if (ret) {
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 8796a5ee9bb9..0dedf8a799f4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -166,7 +166,7 @@ static void dwc3_ep_inc_deq(struct dwc3_ep *dep)
166 dwc3_ep_inc_trb(&dep->trb_dequeue); 166 dwc3_ep_inc_trb(&dep->trb_dequeue);
167} 167}
168 168
169void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep, 169static void dwc3_gadget_del_and_unmap_request(struct dwc3_ep *dep,
170 struct dwc3_request *req, int status) 170 struct dwc3_request *req, int status)
171{ 171{
172 struct dwc3 *dwc = dep->dwc; 172 struct dwc3 *dwc = dep->dwc;
@@ -1424,7 +1424,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
1424 dwc->lock); 1424 dwc->lock);
1425 1425
1426 if (!r->trb) 1426 if (!r->trb)
1427 goto out1; 1427 goto out0;
1428 1428
1429 if (r->num_pending_sgs) { 1429 if (r->num_pending_sgs) {
1430 struct dwc3_trb *trb; 1430 struct dwc3_trb *trb;
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c
index 7889bcc0509a..8b72b192c747 100644
--- a/drivers/usb/gadget/function/f_phonet.c
+++ b/drivers/usb/gadget/function/f_phonet.c
@@ -221,7 +221,7 @@ static void pn_tx_complete(struct usb_ep *ep, struct usb_request *req)
221 netif_wake_queue(dev); 221 netif_wake_queue(dev);
222} 222}
223 223
224static int pn_net_xmit(struct sk_buff *skb, struct net_device *dev) 224static netdev_tx_t pn_net_xmit(struct sk_buff *skb, struct net_device *dev)
225{ 225{
226 struct phonet_port *port = netdev_priv(dev); 226 struct phonet_port *port = netdev_priv(dev);
227 struct f_phonet *fp; 227 struct f_phonet *fp;
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 4c6c08b675b5..21307d862af6 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -73,9 +73,10 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
73 if (!qh) 73 if (!qh)
74 goto done; 74 goto done;
75 qh->hw = (struct ehci_qh_hw *) 75 qh->hw = (struct ehci_qh_hw *)
76 dma_pool_zalloc(ehci->qh_pool, flags, &dma); 76 dma_pool_alloc(ehci->qh_pool, flags, &dma);
77 if (!qh->hw) 77 if (!qh->hw)
78 goto fail; 78 goto fail;
79 memset(qh->hw, 0, sizeof *qh->hw);
79 qh->qh_dma = dma; 80 qh->qh_dma = dma;
80 // INIT_LIST_HEAD (&qh->qh_list); 81 // INIT_LIST_HEAD (&qh->qh_list);
81 INIT_LIST_HEAD (&qh->qtd_list); 82 INIT_LIST_HEAD (&qh->qtd_list);
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 28e2a338b481..e56db44708bc 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1287,7 +1287,7 @@ itd_urb_transaction(
1287 } else { 1287 } else {
1288 alloc_itd: 1288 alloc_itd:
1289 spin_unlock_irqrestore(&ehci->lock, flags); 1289 spin_unlock_irqrestore(&ehci->lock, flags);
1290 itd = dma_pool_zalloc(ehci->itd_pool, mem_flags, 1290 itd = dma_pool_alloc(ehci->itd_pool, mem_flags,
1291 &itd_dma); 1291 &itd_dma);
1292 spin_lock_irqsave(&ehci->lock, flags); 1292 spin_lock_irqsave(&ehci->lock, flags);
1293 if (!itd) { 1293 if (!itd) {
@@ -1297,6 +1297,7 @@ itd_urb_transaction(
1297 } 1297 }
1298 } 1298 }
1299 1299
1300 memset(itd, 0, sizeof(*itd));
1300 itd->itd_dma = itd_dma; 1301 itd->itd_dma = itd_dma;
1301 itd->frame = NO_FRAME; 1302 itd->frame = NO_FRAME;
1302 list_add(&itd->itd_list, &sched->td_list); 1303 list_add(&itd->itd_list, &sched->td_list);
@@ -2080,7 +2081,7 @@ sitd_urb_transaction(
2080 } else { 2081 } else {
2081 alloc_sitd: 2082 alloc_sitd:
2082 spin_unlock_irqrestore(&ehci->lock, flags); 2083 spin_unlock_irqrestore(&ehci->lock, flags);
2083 sitd = dma_pool_zalloc(ehci->sitd_pool, mem_flags, 2084 sitd = dma_pool_alloc(ehci->sitd_pool, mem_flags,
2084 &sitd_dma); 2085 &sitd_dma);
2085 spin_lock_irqsave(&ehci->lock, flags); 2086 spin_lock_irqsave(&ehci->lock, flags);
2086 if (!sitd) { 2087 if (!sitd) {
@@ -2090,6 +2091,7 @@ sitd_urb_transaction(
2090 } 2091 }
2091 } 2092 }
2092 2093
2094 memset(sitd, 0, sizeof(*sitd));
2093 sitd->sitd_dma = sitd_dma; 2095 sitd->sitd_dma = sitd_dma;
2094 sitd->frame = NO_FRAME; 2096 sitd->frame = NO_FRAME;
2095 list_add(&sitd->sitd_list, &iso_sched->td_list); 2097 list_add(&sitd->sitd_list, &iso_sched->td_list);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 9b27798ecce5..711da3306b14 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3621,6 +3621,7 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
3621 del_timer_sync(&virt_dev->eps[i].stop_cmd_timer); 3621 del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);
3622 } 3622 }
3623 xhci_debugfs_remove_slot(xhci, udev->slot_id); 3623 xhci_debugfs_remove_slot(xhci, udev->slot_id);
3624 virt_dev->udev = NULL;
3624 ret = xhci_disable_slot(xhci, udev->slot_id); 3625 ret = xhci_disable_slot(xhci, udev->slot_id);
3625 if (ret) 3626 if (ret)
3626 xhci_free_virt_device(xhci, udev->slot_id); 3627 xhci_free_virt_device(xhci, udev->slot_id);
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index e564695c6c8d..71c5835ea9cd 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -417,7 +417,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)
417 req = next_request(musb_ep); 417 req = next_request(musb_ep);
418 request = &req->request; 418 request = &req->request;
419 419
420 trace_musb_req_tx(req);
421 csr = musb_readw(epio, MUSB_TXCSR); 420 csr = musb_readw(epio, MUSB_TXCSR);
422 musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr); 421 musb_dbg(musb, "<== %s, txcsr %04x", musb_ep->end_point.name, csr);
423 422
@@ -456,6 +455,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
456 u8 is_dma = 0; 455 u8 is_dma = 0;
457 bool short_packet = false; 456 bool short_packet = false;
458 457
458 trace_musb_req_tx(req);
459
459 if (dma && (csr & MUSB_TXCSR_DMAENAB)) { 460 if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
460 is_dma = 1; 461 is_dma = 1;
461 csr |= MUSB_TXCSR_P_WZC_BITS; 462 csr |= MUSB_TXCSR_P_WZC_BITS;
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 4fa372c845e1..e7f99d55922a 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -990,7 +990,9 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep,
990 /* set tx_reinit and schedule the next qh */ 990 /* set tx_reinit and schedule the next qh */
991 ep->tx_reinit = 1; 991 ep->tx_reinit = 1;
992 } 992 }
993 musb_start_urb(musb, is_in, next_qh); 993
994 if (next_qh)
995 musb_start_urb(musb, is_in, next_qh);
994 } 996 }
995} 997}
996 998
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index c3f252283ab9..2058852a87fa 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -233,6 +233,8 @@ static void option_instat_callback(struct urb *urb);
233/* These Quectel products use Qualcomm's vendor ID */ 233/* These Quectel products use Qualcomm's vendor ID */
234#define QUECTEL_PRODUCT_UC20 0x9003 234#define QUECTEL_PRODUCT_UC20 0x9003
235#define QUECTEL_PRODUCT_UC15 0x9090 235#define QUECTEL_PRODUCT_UC15 0x9090
236/* These u-blox products use Qualcomm's vendor ID */
237#define UBLOX_PRODUCT_R410M 0x90b2
236/* These Yuga products use Qualcomm's vendor ID */ 238/* These Yuga products use Qualcomm's vendor ID */
237#define YUGA_PRODUCT_CLM920_NC5 0x9625 239#define YUGA_PRODUCT_CLM920_NC5 0x9625
238 240
@@ -1065,6 +1067,9 @@ static const struct usb_device_id option_ids[] = {
1065 /* Yuga products use Qualcomm vendor ID */ 1067 /* Yuga products use Qualcomm vendor ID */
1066 { USB_DEVICE(QUALCOMM_VENDOR_ID, YUGA_PRODUCT_CLM920_NC5), 1068 { USB_DEVICE(QUALCOMM_VENDOR_ID, YUGA_PRODUCT_CLM920_NC5),
1067 .driver_info = RSVD(1) | RSVD(4) }, 1069 .driver_info = RSVD(1) | RSVD(4) },
1070 /* u-blox products using Qualcomm vendor ID */
1071 { USB_DEVICE(QUALCOMM_VENDOR_ID, UBLOX_PRODUCT_R410M),
1072 .driver_info = RSVD(1) | RSVD(3) },
1068 /* Quectel products using Quectel vendor ID */ 1073 /* Quectel products using Quectel vendor ID */
1069 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21), 1074 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1070 .driver_info = RSVD(4) }, 1075 .driver_info = RSVD(4) },
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index f5373ed2cd45..8ddbecc25d89 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -335,47 +335,48 @@ static int palm_os_3_probe(struct usb_serial *serial,
335 goto exit; 335 goto exit;
336 } 336 }
337 337
338 if (retval == sizeof(*connection_info)) { 338 if (retval != sizeof(*connection_info)) {
339 connection_info = (struct visor_connection_info *) 339 dev_err(dev, "Invalid connection information received from device\n");
340 transfer_buffer; 340 retval = -ENODEV;
341 341 goto exit;
342 num_ports = le16_to_cpu(connection_info->num_ports);
343 for (i = 0; i < num_ports; ++i) {
344 switch (
345 connection_info->connections[i].port_function_id) {
346 case VISOR_FUNCTION_GENERIC:
347 string = "Generic";
348 break;
349 case VISOR_FUNCTION_DEBUGGER:
350 string = "Debugger";
351 break;
352 case VISOR_FUNCTION_HOTSYNC:
353 string = "HotSync";
354 break;
355 case VISOR_FUNCTION_CONSOLE:
356 string = "Console";
357 break;
358 case VISOR_FUNCTION_REMOTE_FILE_SYS:
359 string = "Remote File System";
360 break;
361 default:
362 string = "unknown";
363 break;
364 }
365 dev_info(dev, "%s: port %d, is for %s use\n",
366 serial->type->description,
367 connection_info->connections[i].port, string);
368 }
369 } 342 }
370 /* 343
371 * Handle devices that report invalid stuff here. 344 connection_info = (struct visor_connection_info *)transfer_buffer;
372 */ 345
346 num_ports = le16_to_cpu(connection_info->num_ports);
347
348 /* Handle devices that report invalid stuff here. */
373 if (num_ports == 0 || num_ports > 2) { 349 if (num_ports == 0 || num_ports > 2) {
374 dev_warn(dev, "%s: No valid connect info available\n", 350 dev_warn(dev, "%s: No valid connect info available\n",
375 serial->type->description); 351 serial->type->description);
376 num_ports = 2; 352 num_ports = 2;
377 } 353 }
378 354
355 for (i = 0; i < num_ports; ++i) {
356 switch (connection_info->connections[i].port_function_id) {
357 case VISOR_FUNCTION_GENERIC:
358 string = "Generic";
359 break;
360 case VISOR_FUNCTION_DEBUGGER:
361 string = "Debugger";
362 break;
363 case VISOR_FUNCTION_HOTSYNC:
364 string = "HotSync";
365 break;
366 case VISOR_FUNCTION_CONSOLE:
367 string = "Console";
368 break;
369 case VISOR_FUNCTION_REMOTE_FILE_SYS:
370 string = "Remote File System";
371 break;
372 default:
373 string = "unknown";
374 break;
375 }
376 dev_info(dev, "%s: port %d, is for %s use\n",
377 serial->type->description,
378 connection_info->connections[i].port, string);
379 }
379 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description, 380 dev_info(dev, "%s: Number of ports: %d\n", serial->type->description,
380 num_ports); 381 num_ports);
381 382
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 677d12138dbd..ded49e3bf2b0 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3725,6 +3725,7 @@ void tcpm_unregister_port(struct tcpm_port *port)
3725 for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++) 3725 for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++)
3726 typec_unregister_altmode(port->port_altmode[i]); 3726 typec_unregister_altmode(port->port_altmode[i]);
3727 typec_unregister_port(port->typec_port); 3727 typec_unregister_port(port->typec_port);
3728 usb_role_switch_put(port->role_sw);
3728 tcpm_debugfs_exit(port); 3729 tcpm_debugfs_exit(port);
3729 destroy_workqueue(port->wq); 3730 destroy_workqueue(port->wq);
3730} 3731}
diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
index 8b8406867c02..4b4c8d271b27 100644
--- a/drivers/usb/typec/tps6598x.c
+++ b/drivers/usb/typec/tps6598x.c
@@ -73,6 +73,7 @@ struct tps6598x {
73 struct device *dev; 73 struct device *dev;
74 struct regmap *regmap; 74 struct regmap *regmap;
75 struct mutex lock; /* device lock */ 75 struct mutex lock; /* device lock */
76 u8 i2c_protocol:1;
76 77
77 struct typec_port *port; 78 struct typec_port *port;
78 struct typec_partner *partner; 79 struct typec_partner *partner;
@@ -80,19 +81,39 @@ struct tps6598x {
80 struct typec_capability typec_cap; 81 struct typec_capability typec_cap;
81}; 82};
82 83
84static int
85tps6598x_block_read(struct tps6598x *tps, u8 reg, void *val, size_t len)
86{
87 u8 data[len + 1];
88 int ret;
89
90 if (!tps->i2c_protocol)
91 return regmap_raw_read(tps->regmap, reg, val, len);
92
93 ret = regmap_raw_read(tps->regmap, reg, data, sizeof(data));
94 if (ret)
95 return ret;
96
97 if (data[0] < len)
98 return -EIO;
99
100 memcpy(val, &data[1], len);
101 return 0;
102}
103
83static inline int tps6598x_read16(struct tps6598x *tps, u8 reg, u16 *val) 104static inline int tps6598x_read16(struct tps6598x *tps, u8 reg, u16 *val)
84{ 105{
85 return regmap_raw_read(tps->regmap, reg, val, sizeof(u16)); 106 return tps6598x_block_read(tps, reg, val, sizeof(u16));
86} 107}
87 108
88static inline int tps6598x_read32(struct tps6598x *tps, u8 reg, u32 *val) 109static inline int tps6598x_read32(struct tps6598x *tps, u8 reg, u32 *val)
89{ 110{
90 return regmap_raw_read(tps->regmap, reg, val, sizeof(u32)); 111 return tps6598x_block_read(tps, reg, val, sizeof(u32));
91} 112}
92 113
93static inline int tps6598x_read64(struct tps6598x *tps, u8 reg, u64 *val) 114static inline int tps6598x_read64(struct tps6598x *tps, u8 reg, u64 *val)
94{ 115{
95 return regmap_raw_read(tps->regmap, reg, val, sizeof(u64)); 116 return tps6598x_block_read(tps, reg, val, sizeof(u64));
96} 117}
97 118
98static inline int tps6598x_write16(struct tps6598x *tps, u8 reg, u16 val) 119static inline int tps6598x_write16(struct tps6598x *tps, u8 reg, u16 val)
@@ -121,8 +142,8 @@ static int tps6598x_read_partner_identity(struct tps6598x *tps)
121 struct tps6598x_rx_identity_reg id; 142 struct tps6598x_rx_identity_reg id;
122 int ret; 143 int ret;
123 144
124 ret = regmap_raw_read(tps->regmap, TPS_REG_RX_IDENTITY_SOP, 145 ret = tps6598x_block_read(tps, TPS_REG_RX_IDENTITY_SOP,
125 &id, sizeof(id)); 146 &id, sizeof(id));
126 if (ret) 147 if (ret)
127 return ret; 148 return ret;
128 149
@@ -224,13 +245,13 @@ static int tps6598x_exec_cmd(struct tps6598x *tps, const char *cmd,
224 } while (val); 245 } while (val);
225 246
226 if (out_len) { 247 if (out_len) {
227 ret = regmap_raw_read(tps->regmap, TPS_REG_DATA1, 248 ret = tps6598x_block_read(tps, TPS_REG_DATA1,
228 out_data, out_len); 249 out_data, out_len);
229 if (ret) 250 if (ret)
230 return ret; 251 return ret;
231 val = out_data[0]; 252 val = out_data[0];
232 } else { 253 } else {
233 ret = regmap_read(tps->regmap, TPS_REG_DATA1, &val); 254 ret = tps6598x_block_read(tps, TPS_REG_DATA1, &val, sizeof(u8));
234 if (ret) 255 if (ret)
235 return ret; 256 return ret;
236 } 257 }
@@ -385,6 +406,16 @@ static int tps6598x_probe(struct i2c_client *client)
385 if (!vid) 406 if (!vid)
386 return -ENODEV; 407 return -ENODEV;
387 408
409 /*
410 * Checking can the adapter handle SMBus protocol. If it can not, the
411 * driver needs to take care of block reads separately.
412 *
413 * FIXME: Testing with I2C_FUNC_I2C. regmap-i2c uses I2C protocol
414 * unconditionally if the adapter has I2C_FUNC_I2C set.
415 */
416 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
417 tps->i2c_protocol = true;
418
388 ret = tps6598x_read32(tps, TPS_REG_STATUS, &status); 419 ret = tps6598x_read32(tps, TPS_REG_STATUS, &status);
389 if (ret < 0) 420 if (ret < 0)
390 return ret; 421 return ret;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index e2f16b68fcbf..51b5e2da708c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3142,7 +3142,11 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
3142 struct rb_node *node; 3142 struct rb_node *node;
3143 int ret = 0; 3143 int ret = 0;
3144 3144
3145 spin_lock(&root->fs_info->trans_lock);
3145 cur_trans = root->fs_info->running_transaction; 3146 cur_trans = root->fs_info->running_transaction;
3147 if (cur_trans)
3148 refcount_inc(&cur_trans->use_count);
3149 spin_unlock(&root->fs_info->trans_lock);
3146 if (!cur_trans) 3150 if (!cur_trans)
3147 return 0; 3151 return 0;
3148 3152
@@ -3151,6 +3155,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
3151 head = btrfs_find_delayed_ref_head(delayed_refs, bytenr); 3155 head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
3152 if (!head) { 3156 if (!head) {
3153 spin_unlock(&delayed_refs->lock); 3157 spin_unlock(&delayed_refs->lock);
3158 btrfs_put_transaction(cur_trans);
3154 return 0; 3159 return 0;
3155 } 3160 }
3156 3161
@@ -3167,6 +3172,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
3167 mutex_lock(&head->mutex); 3172 mutex_lock(&head->mutex);
3168 mutex_unlock(&head->mutex); 3173 mutex_unlock(&head->mutex);
3169 btrfs_put_delayed_ref_head(head); 3174 btrfs_put_delayed_ref_head(head);
3175 btrfs_put_transaction(cur_trans);
3170 return -EAGAIN; 3176 return -EAGAIN;
3171 } 3177 }
3172 spin_unlock(&delayed_refs->lock); 3178 spin_unlock(&delayed_refs->lock);
@@ -3199,6 +3205,7 @@ static noinline int check_delayed_ref(struct btrfs_root *root,
3199 } 3205 }
3200 spin_unlock(&head->lock); 3206 spin_unlock(&head->lock);
3201 mutex_unlock(&head->mutex); 3207 mutex_unlock(&head->mutex);
3208 btrfs_put_transaction(cur_trans);
3202 return ret; 3209 return ret;
3203} 3210}
3204 3211
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 00b7d3231821..b041b945a7ae 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1841,7 +1841,7 @@ again:
1841 old_bytenr = btrfs_node_blockptr(parent, slot); 1841 old_bytenr = btrfs_node_blockptr(parent, slot);
1842 blocksize = fs_info->nodesize; 1842 blocksize = fs_info->nodesize;
1843 old_ptr_gen = btrfs_node_ptr_generation(parent, slot); 1843 old_ptr_gen = btrfs_node_ptr_generation(parent, slot);
1844 btrfs_node_key_to_cpu(parent, &key, slot); 1844 btrfs_node_key_to_cpu(parent, &first_key, slot);
1845 1845
1846 if (level <= max_level) { 1846 if (level <= max_level) {
1847 eb = path->nodes[level]; 1847 eb = path->nodes[level];
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 221e5cdb060b..c0074d2d7d6d 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5236,6 +5236,10 @@ static int send_write_or_clone(struct send_ctx *sctx,
5236 len = btrfs_file_extent_num_bytes(path->nodes[0], ei); 5236 len = btrfs_file_extent_num_bytes(path->nodes[0], ei);
5237 } 5237 }
5238 5238
5239 if (offset >= sctx->cur_inode_size) {
5240 ret = 0;
5241 goto out;
5242 }
5239 if (offset + len > sctx->cur_inode_size) 5243 if (offset + len > sctx->cur_inode_size)
5240 len = sctx->cur_inode_size - offset; 5244 len = sctx->cur_inode_size - offset;
5241 if (len == 0) { 5245 if (len == 0) {
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index f85040d73e3d..cf0e45b10121 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -70,69 +70,104 @@ static __le32 ceph_flags_sys2wire(u32 flags)
70 */ 70 */
71 71
72/* 72/*
73 * Calculate the length sum of direct io vectors that can 73 * How many pages to get in one call to iov_iter_get_pages(). This
74 * be combined into one page vector. 74 * determines the size of the on-stack array used as a buffer.
75 */ 75 */
76static size_t dio_get_pagev_size(const struct iov_iter *it) 76#define ITER_GET_BVECS_PAGES 64
77
78static ssize_t __iter_get_bvecs(struct iov_iter *iter, size_t maxsize,
79 struct bio_vec *bvecs)
77{ 80{
78 const struct iovec *iov = it->iov; 81 size_t size = 0;
79 const struct iovec *iovend = iov + it->nr_segs; 82 int bvec_idx = 0;
80 size_t size; 83
81 84 if (maxsize > iov_iter_count(iter))
82 size = iov->iov_len - it->iov_offset; 85 maxsize = iov_iter_count(iter);
83 /* 86
84 * An iov can be page vectored when both the current tail 87 while (size < maxsize) {
85 * and the next base are page aligned. 88 struct page *pages[ITER_GET_BVECS_PAGES];
86 */ 89 ssize_t bytes;
87 while (PAGE_ALIGNED((iov->iov_base + iov->iov_len)) && 90 size_t start;
88 (++iov < iovend && PAGE_ALIGNED((iov->iov_base)))) { 91 int idx = 0;
89 size += iov->iov_len; 92
90 } 93 bytes = iov_iter_get_pages(iter, pages, maxsize - size,
91 dout("dio_get_pagevlen len = %zu\n", size); 94 ITER_GET_BVECS_PAGES, &start);
92 return size; 95 if (bytes < 0)
96 return size ?: bytes;
97
98 iov_iter_advance(iter, bytes);
99 size += bytes;
100
101 for ( ; bytes; idx++, bvec_idx++) {
102 struct bio_vec bv = {
103 .bv_page = pages[idx],
104 .bv_len = min_t(int, bytes, PAGE_SIZE - start),
105 .bv_offset = start,
106 };
107
108 bvecs[bvec_idx] = bv;
109 bytes -= bv.bv_len;
110 start = 0;
111 }
112 }
113
114 return size;
93} 115}
94 116
95/* 117/*
96 * Allocate a page vector based on (@it, @nbytes). 118 * iov_iter_get_pages() only considers one iov_iter segment, no matter
97 * The return value is the tuple describing a page vector, 119 * what maxsize or maxpages are given. For ITER_BVEC that is a single
98 * that is (@pages, @page_align, @num_pages). 120 * page.
121 *
122 * Attempt to get up to @maxsize bytes worth of pages from @iter.
123 * Return the number of bytes in the created bio_vec array, or an error.
99 */ 124 */
100static struct page ** 125static ssize_t iter_get_bvecs_alloc(struct iov_iter *iter, size_t maxsize,
101dio_get_pages_alloc(const struct iov_iter *it, size_t nbytes, 126 struct bio_vec **bvecs, int *num_bvecs)
102 size_t *page_align, int *num_pages)
103{ 127{
104 struct iov_iter tmp_it = *it; 128 struct bio_vec *bv;
105 size_t align; 129 size_t orig_count = iov_iter_count(iter);
106 struct page **pages; 130 ssize_t bytes;
107 int ret = 0, idx, npages; 131 int npages;
108 132
109 align = (unsigned long)(it->iov->iov_base + it->iov_offset) & 133 iov_iter_truncate(iter, maxsize);
110 (PAGE_SIZE - 1); 134 npages = iov_iter_npages(iter, INT_MAX);
111 npages = calc_pages_for(align, nbytes); 135 iov_iter_reexpand(iter, orig_count);
112 pages = kvmalloc(sizeof(*pages) * npages, GFP_KERNEL);
113 if (!pages)
114 return ERR_PTR(-ENOMEM);
115 136
116 for (idx = 0; idx < npages; ) { 137 /*
117 size_t start; 138 * __iter_get_bvecs() may populate only part of the array -- zero it
118 ret = iov_iter_get_pages(&tmp_it, pages + idx, nbytes, 139 * out.
119 npages - idx, &start); 140 */
120 if (ret < 0) 141 bv = kvmalloc_array(npages, sizeof(*bv), GFP_KERNEL | __GFP_ZERO);
121 goto fail; 142 if (!bv)
143 return -ENOMEM;
122 144
123 iov_iter_advance(&tmp_it, ret); 145 bytes = __iter_get_bvecs(iter, maxsize, bv);
124 nbytes -= ret; 146 if (bytes < 0) {
125 idx += (ret + start + PAGE_SIZE - 1) / PAGE_SIZE; 147 /*
148 * No pages were pinned -- just free the array.
149 */
150 kvfree(bv);
151 return bytes;
126 } 152 }
127 153
128 BUG_ON(nbytes != 0); 154 *bvecs = bv;
129 *num_pages = npages; 155 *num_bvecs = npages;
130 *page_align = align; 156 return bytes;
131 dout("dio_get_pages_alloc: got %d pages align %zu\n", npages, align); 157}
132 return pages; 158
133fail: 159static void put_bvecs(struct bio_vec *bvecs, int num_bvecs, bool should_dirty)
134 ceph_put_page_vector(pages, idx, false); 160{
135 return ERR_PTR(ret); 161 int i;
162
163 for (i = 0; i < num_bvecs; i++) {
164 if (bvecs[i].bv_page) {
165 if (should_dirty)
166 set_page_dirty_lock(bvecs[i].bv_page);
167 put_page(bvecs[i].bv_page);
168 }
169 }
170 kvfree(bvecs);
136} 171}
137 172
138/* 173/*
@@ -746,11 +781,12 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
746 struct inode *inode = req->r_inode; 781 struct inode *inode = req->r_inode;
747 struct ceph_aio_request *aio_req = req->r_priv; 782 struct ceph_aio_request *aio_req = req->r_priv;
748 struct ceph_osd_data *osd_data = osd_req_op_extent_osd_data(req, 0); 783 struct ceph_osd_data *osd_data = osd_req_op_extent_osd_data(req, 0);
749 int num_pages = calc_pages_for((u64)osd_data->alignment,
750 osd_data->length);
751 784
752 dout("ceph_aio_complete_req %p rc %d bytes %llu\n", 785 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_BVECS);
753 inode, rc, osd_data->length); 786 BUG_ON(!osd_data->num_bvecs);
787
788 dout("ceph_aio_complete_req %p rc %d bytes %u\n",
789 inode, rc, osd_data->bvec_pos.iter.bi_size);
754 790
755 if (rc == -EOLDSNAPC) { 791 if (rc == -EOLDSNAPC) {
756 struct ceph_aio_work *aio_work; 792 struct ceph_aio_work *aio_work;
@@ -768,9 +804,10 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
768 } else if (!aio_req->write) { 804 } else if (!aio_req->write) {
769 if (rc == -ENOENT) 805 if (rc == -ENOENT)
770 rc = 0; 806 rc = 0;
771 if (rc >= 0 && osd_data->length > rc) { 807 if (rc >= 0 && osd_data->bvec_pos.iter.bi_size > rc) {
772 int zoff = osd_data->alignment + rc; 808 struct iov_iter i;
773 int zlen = osd_data->length - rc; 809 int zlen = osd_data->bvec_pos.iter.bi_size - rc;
810
774 /* 811 /*
775 * If read is satisfied by single OSD request, 812 * If read is satisfied by single OSD request,
776 * it can pass EOF. Otherwise read is within 813 * it can pass EOF. Otherwise read is within
@@ -785,13 +822,16 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
785 aio_req->total_len = rc + zlen; 822 aio_req->total_len = rc + zlen;
786 } 823 }
787 824
788 if (zlen > 0) 825 iov_iter_bvec(&i, ITER_BVEC, osd_data->bvec_pos.bvecs,
789 ceph_zero_page_vector_range(zoff, zlen, 826 osd_data->num_bvecs,
790 osd_data->pages); 827 osd_data->bvec_pos.iter.bi_size);
828 iov_iter_advance(&i, rc);
829 iov_iter_zero(zlen, &i);
791 } 830 }
792 } 831 }
793 832
794 ceph_put_page_vector(osd_data->pages, num_pages, aio_req->should_dirty); 833 put_bvecs(osd_data->bvec_pos.bvecs, osd_data->num_bvecs,
834 aio_req->should_dirty);
795 ceph_osdc_put_request(req); 835 ceph_osdc_put_request(req);
796 836
797 if (rc < 0) 837 if (rc < 0)
@@ -879,7 +919,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
879 struct ceph_fs_client *fsc = ceph_inode_to_client(inode); 919 struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
880 struct ceph_vino vino; 920 struct ceph_vino vino;
881 struct ceph_osd_request *req; 921 struct ceph_osd_request *req;
882 struct page **pages; 922 struct bio_vec *bvecs;
883 struct ceph_aio_request *aio_req = NULL; 923 struct ceph_aio_request *aio_req = NULL;
884 int num_pages = 0; 924 int num_pages = 0;
885 int flags; 925 int flags;
@@ -914,10 +954,14 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
914 } 954 }
915 955
916 while (iov_iter_count(iter) > 0) { 956 while (iov_iter_count(iter) > 0) {
917 u64 size = dio_get_pagev_size(iter); 957 u64 size = iov_iter_count(iter);
918 size_t start = 0;
919 ssize_t len; 958 ssize_t len;
920 959
960 if (write)
961 size = min_t(u64, size, fsc->mount_options->wsize);
962 else
963 size = min_t(u64, size, fsc->mount_options->rsize);
964
921 vino = ceph_vino(inode); 965 vino = ceph_vino(inode);
922 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, 966 req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout,
923 vino, pos, &size, 0, 967 vino, pos, &size, 0,
@@ -933,18 +977,14 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
933 break; 977 break;
934 } 978 }
935 979
936 if (write) 980 len = iter_get_bvecs_alloc(iter, size, &bvecs, &num_pages);
937 size = min_t(u64, size, fsc->mount_options->wsize); 981 if (len < 0) {
938 else
939 size = min_t(u64, size, fsc->mount_options->rsize);
940
941 len = size;
942 pages = dio_get_pages_alloc(iter, len, &start, &num_pages);
943 if (IS_ERR(pages)) {
944 ceph_osdc_put_request(req); 982 ceph_osdc_put_request(req);
945 ret = PTR_ERR(pages); 983 ret = len;
946 break; 984 break;
947 } 985 }
986 if (len != size)
987 osd_req_op_extent_update(req, 0, len);
948 988
949 /* 989 /*
950 * To simplify error handling, allow AIO when IO within i_size 990 * To simplify error handling, allow AIO when IO within i_size
@@ -977,8 +1017,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
977 req->r_mtime = mtime; 1017 req->r_mtime = mtime;
978 } 1018 }
979 1019
980 osd_req_op_extent_osd_data_pages(req, 0, pages, len, start, 1020 osd_req_op_extent_osd_data_bvecs(req, 0, bvecs, num_pages, len);
981 false, false);
982 1021
983 if (aio_req) { 1022 if (aio_req) {
984 aio_req->total_len += len; 1023 aio_req->total_len += len;
@@ -991,7 +1030,6 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
991 list_add_tail(&req->r_unsafe_item, &aio_req->osd_reqs); 1030 list_add_tail(&req->r_unsafe_item, &aio_req->osd_reqs);
992 1031
993 pos += len; 1032 pos += len;
994 iov_iter_advance(iter, len);
995 continue; 1033 continue;
996 } 1034 }
997 1035
@@ -1004,25 +1042,26 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
1004 if (ret == -ENOENT) 1042 if (ret == -ENOENT)
1005 ret = 0; 1043 ret = 0;
1006 if (ret >= 0 && ret < len && pos + ret < size) { 1044 if (ret >= 0 && ret < len && pos + ret < size) {
1045 struct iov_iter i;
1007 int zlen = min_t(size_t, len - ret, 1046 int zlen = min_t(size_t, len - ret,
1008 size - pos - ret); 1047 size - pos - ret);
1009 ceph_zero_page_vector_range(start + ret, zlen, 1048
1010 pages); 1049 iov_iter_bvec(&i, ITER_BVEC, bvecs, num_pages,
1050 len);
1051 iov_iter_advance(&i, ret);
1052 iov_iter_zero(zlen, &i);
1011 ret += zlen; 1053 ret += zlen;
1012 } 1054 }
1013 if (ret >= 0) 1055 if (ret >= 0)
1014 len = ret; 1056 len = ret;
1015 } 1057 }
1016 1058
1017 ceph_put_page_vector(pages, num_pages, should_dirty); 1059 put_bvecs(bvecs, num_pages, should_dirty);
1018
1019 ceph_osdc_put_request(req); 1060 ceph_osdc_put_request(req);
1020 if (ret < 0) 1061 if (ret < 0)
1021 break; 1062 break;
1022 1063
1023 pos += len; 1064 pos += len;
1024 iov_iter_advance(iter, len);
1025
1026 if (!write && pos >= size) 1065 if (!write && pos >= size)
1027 break; 1066 break;
1028 1067
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index 741749a98614..5f132d59dfc2 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -197,7 +197,7 @@ config CIFS_SMB311
197 197
198config CIFS_SMB_DIRECT 198config CIFS_SMB_DIRECT
199 bool "SMB Direct support (Experimental)" 199 bool "SMB Direct support (Experimental)"
200 depends on CIFS=m && INFINIBAND || CIFS=y && INFINIBAND=y 200 depends on CIFS=m && INFINIBAND && INFINIBAND_ADDR_TRANS || CIFS=y && INFINIBAND=y && INFINIBAND_ADDR_TRANS=y
201 help 201 help
202 Enables SMB Direct experimental support for SMB 3.0, 3.02 and 3.1.1. 202 Enables SMB Direct experimental support for SMB 3.0, 3.02 and 3.1.1.
203 SMB Direct allows transferring SMB packets over RDMA. If unsure, 203 SMB Direct allows transferring SMB packets over RDMA. If unsure,
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 47d7c151fcba..471d863958bc 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1961,7 +1961,7 @@ void wb_workfn(struct work_struct *work)
1961 } 1961 }
1962 1962
1963 if (!list_empty(&wb->work_list)) 1963 if (!list_empty(&wb->work_list))
1964 mod_delayed_work(bdi_wq, &wb->dwork, 0); 1964 wb_wakeup(wb);
1965 else if (wb_has_dirty_io(wb) && dirty_writeback_interval) 1965 else if (wb_has_dirty_io(wb) && dirty_writeback_interval)
1966 wb_wakeup_delayed(wb); 1966 wb_wakeup_delayed(wb);
1967 1967
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index eed073cc4778..e70fb8ccecea 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -880,8 +880,18 @@ xfs_file_dedupe_range(
880 struct file *dst_file, 880 struct file *dst_file,
881 u64 dst_loff) 881 u64 dst_loff)
882{ 882{
883 struct inode *srci = file_inode(src_file);
884 u64 max_dedupe;
883 int error; 885 int error;
884 886
887 /*
888 * Since we have to read all these pages in to compare them, cut
889 * it off at MAX_RW_COUNT/2 rounded down to the nearest block.
890 * That means we won't do more than MAX_RW_COUNT IO per request.
891 */
892 max_dedupe = (MAX_RW_COUNT >> 1) & ~(i_blocksize(srci) - 1);
893 if (len > max_dedupe)
894 len = max_dedupe;
885 error = xfs_reflink_remap_range(src_file, loff, dst_file, dst_loff, 895 error = xfs_reflink_remap_range(src_file, loff, dst_file, dst_loff,
886 len, true); 896 len, true);
887 if (error) 897 if (error)
diff --git a/include/dt-bindings/clock/stm32mp1-clks.h b/include/dt-bindings/clock/stm32mp1-clks.h
index 86e3ec662ef4..90ec780bfc68 100644
--- a/include/dt-bindings/clock/stm32mp1-clks.h
+++ b/include/dt-bindings/clock/stm32mp1-clks.h
@@ -76,7 +76,7 @@
76#define I2C6 63 76#define I2C6 63
77#define USART1 64 77#define USART1 64
78#define RTCAPB 65 78#define RTCAPB 65
79#define TZC 66 79#define TZC1 66
80#define TZPC 67 80#define TZPC 67
81#define IWDG1 68 81#define IWDG1 68
82#define BSEC 69 82#define BSEC 69
@@ -123,6 +123,7 @@
123#define CRC1 110 123#define CRC1 110
124#define USBH 111 124#define USBH 111
125#define ETHSTP 112 125#define ETHSTP 112
126#define TZC2 113
126 127
127/* Kernel clocks */ 128/* Kernel clocks */
128#define SDMMC1_K 118 129#define SDMMC1_K 118
@@ -228,7 +229,6 @@
228#define CK_MCO2 212 229#define CK_MCO2 212
229 230
230/* TRACE & DEBUG clocks */ 231/* TRACE & DEBUG clocks */
231#define DBG 213
232#define CK_DBG 214 232#define CK_DBG 214
233#define CK_TRACE 215 233#define CK_TRACE 215
234 234
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 24f03941ada8..e7efe12a81bd 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -131,6 +131,7 @@ struct vgic_irq {
131 u32 mpidr; /* GICv3 target VCPU */ 131 u32 mpidr; /* GICv3 target VCPU */
132 }; 132 };
133 u8 source; /* GICv2 SGIs only */ 133 u8 source; /* GICv2 SGIs only */
134 u8 active_source; /* GICv2 SGIs only */
134 u8 priority; 135 u8 priority;
135 enum vgic_irq_config config; /* Level or edge */ 136 enum vgic_irq_config config; /* Level or edge */
136 137
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index d3339dd48b1a..b324e01ccf2d 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -25,6 +25,7 @@
25#define PHY_ID_BCM54612E 0x03625e60 25#define PHY_ID_BCM54612E 0x03625e60
26#define PHY_ID_BCM54616S 0x03625d10 26#define PHY_ID_BCM54616S 0x03625d10
27#define PHY_ID_BCM57780 0x03625d90 27#define PHY_ID_BCM57780 0x03625d90
28#define PHY_ID_BCM89610 0x03625cd0
28 29
29#define PHY_ID_BCM7250 0xae025280 30#define PHY_ID_BCM7250 0xae025280
30#define PHY_ID_BCM7260 0xae025190 31#define PHY_ID_BCM7260 0xae025190
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index 528ccc943cee..96bb32285989 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -77,7 +77,10 @@ struct ceph_osd_data {
77 u32 bio_length; 77 u32 bio_length;
78 }; 78 };
79#endif /* CONFIG_BLOCK */ 79#endif /* CONFIG_BLOCK */
80 struct ceph_bvec_iter bvec_pos; 80 struct {
81 struct ceph_bvec_iter bvec_pos;
82 u32 num_bvecs;
83 };
81 }; 84 };
82}; 85};
83 86
@@ -412,6 +415,10 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req,
412 struct ceph_bio_iter *bio_pos, 415 struct ceph_bio_iter *bio_pos,
413 u32 bio_length); 416 u32 bio_length);
414#endif /* CONFIG_BLOCK */ 417#endif /* CONFIG_BLOCK */
418void osd_req_op_extent_osd_data_bvecs(struct ceph_osd_request *osd_req,
419 unsigned int which,
420 struct bio_vec *bvecs, u32 num_bvecs,
421 u32 bytes);
415void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, 422void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req,
416 unsigned int which, 423 unsigned int which,
417 struct ceph_bvec_iter *bvec_pos); 424 struct ceph_bvec_iter *bvec_pos);
@@ -426,7 +433,8 @@ extern void osd_req_op_cls_request_data_pages(struct ceph_osd_request *,
426 bool own_pages); 433 bool own_pages);
427void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, 434void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req,
428 unsigned int which, 435 unsigned int which,
429 struct bio_vec *bvecs, u32 bytes); 436 struct bio_vec *bvecs, u32 num_bvecs,
437 u32 bytes);
430extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *, 438extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
431 unsigned int which, 439 unsigned int which,
432 struct page **pages, u64 length, 440 struct page **pages, u64 length,
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 210a890008f9..1d25e149c1c5 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -765,6 +765,9 @@ int __clk_mux_determine_rate(struct clk_hw *hw,
765int __clk_determine_rate(struct clk_hw *core, struct clk_rate_request *req); 765int __clk_determine_rate(struct clk_hw *core, struct clk_rate_request *req);
766int __clk_mux_determine_rate_closest(struct clk_hw *hw, 766int __clk_mux_determine_rate_closest(struct clk_hw *hw,
767 struct clk_rate_request *req); 767 struct clk_rate_request *req);
768int clk_mux_determine_rate_flags(struct clk_hw *hw,
769 struct clk_rate_request *req,
770 unsigned long flags);
768void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent); 771void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent);
769void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate, 772void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate,
770 unsigned long max_rate); 773 unsigned long max_rate);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index c826b0b5232a..6cb8a5789668 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -368,7 +368,9 @@ static inline void free_part_stats(struct hd_struct *part)
368 part_stat_add(cpu, gendiskp, field, -subnd) 368 part_stat_add(cpu, gendiskp, field, -subnd)
369 369
370void part_in_flight(struct request_queue *q, struct hd_struct *part, 370void part_in_flight(struct request_queue *q, struct hd_struct *part,
371 unsigned int inflight[2]); 371 unsigned int inflight[2]);
372void part_in_flight_rw(struct request_queue *q, struct hd_struct *part,
373 unsigned int inflight[2]);
372void part_dec_in_flight(struct request_queue *q, struct hd_struct *part, 374void part_dec_in_flight(struct request_queue *q, struct hd_struct *part,
373 int rw); 375 int rw);
374void part_inc_in_flight(struct request_queue *q, struct hd_struct *part, 376void part_inc_in_flight(struct request_queue *q, struct hd_struct *part,
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index d09a9c7af109..dfdaede9139e 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -569,7 +569,7 @@ static inline struct rproc *vdev_to_rproc(struct virtio_device *vdev)
569void rproc_add_subdev(struct rproc *rproc, 569void rproc_add_subdev(struct rproc *rproc,
570 struct rproc_subdev *subdev, 570 struct rproc_subdev *subdev,
571 int (*probe)(struct rproc_subdev *subdev), 571 int (*probe)(struct rproc_subdev *subdev),
572 void (*remove)(struct rproc_subdev *subdev, bool graceful)); 572 void (*remove)(struct rproc_subdev *subdev, bool crashed));
573 573
574void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev); 574void rproc_remove_subdev(struct rproc *rproc, struct rproc_subdev *subdev);
575 575
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4b6b9283fa7b..8675e145ea8b 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -52,7 +52,7 @@
52#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */ 52#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
53 53
54/* big enough to hold our biggest descriptor */ 54/* big enough to hold our biggest descriptor */
55#define USB_COMP_EP0_BUFSIZ 1024 55#define USB_COMP_EP0_BUFSIZ 4096
56 56
57/* OS feature descriptor length <= 4kB */ 57/* OS feature descriptor length <= 4kB */
58#define USB_COMP_EP0_OS_DESC_BUFSIZ 4096 58#define USB_COMP_EP0_OS_DESC_BUFSIZ 4096
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
index 9318b2166439..2b0072fa5e92 100644
--- a/include/linux/wait_bit.h
+++ b/include/linux/wait_bit.h
@@ -305,4 +305,21 @@ do { \
305 __ret; \ 305 __ret; \
306}) 306})
307 307
308/**
309 * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit
310 *
311 * @bit: the bit of the word being waited on
312 * @word: the word being waited on, a kernel virtual address
313 *
314 * You can use this helper if bitflags are manipulated atomically rather than
315 * non-atomically under a lock.
316 */
317static inline void clear_and_wake_up_bit(int bit, void *word)
318{
319 clear_bit_unlock(bit, word);
320 /* See wake_up_bit() for which memory barrier you need to use. */
321 smp_mb__after_atomic();
322 wake_up_bit(word, bit);
323}
324
308#endif /* _LINUX_WAIT_BIT_H */ 325#endif /* _LINUX_WAIT_BIT_H */
diff --git a/include/media/i2c/tvp7002.h b/include/media/i2c/tvp7002.h
index 5ee007c1cead..cb213c136089 100644
--- a/include/media/i2c/tvp7002.h
+++ b/include/media/i2c/tvp7002.h
@@ -5,7 +5,7 @@
5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com> 5 * Author: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
6 * 6 *
7 * This code is partially based upon the TVP5150 driver 7 * This code is partially based upon the TVP5150 driver
8 * written by Mauro Carvalho Chehab (mchehab@infradead.org), 8 * written by Mauro Carvalho Chehab <mchehab@kernel.org>,
9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com> 9 * the TVP514x driver written by Vaibhav Hiremath <hvaibhav@ti.com>
10 * and the TVP7002 driver in the TI LSP 2.10.00.14 10 * and the TVP7002 driver in the TI LSP 2.10.00.14
11 * 11 *
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 0bda0adc744f..60a664febba0 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -1,11 +1,11 @@
1/* 1/*
2 * generic helper functions for handling video4linux capture buffers 2 * generic helper functions for handling video4linux capture buffers
3 * 3 *
4 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 4 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
5 * 5 *
6 * Highly based on video-buf written originally by: 6 * Highly based on video-buf written originally by:
7 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> 7 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
8 * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> 8 * (c) 2006 Mauro Carvalho Chehab, <mchehab@kernel.org>
9 * (c) 2006 Ted Walther and John Sokol 9 * (c) 2006 Ted Walther and John Sokol
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index d8b27854e3bf..01bd142b979d 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -6,11 +6,11 @@
6 * into PAGE_SIZE chunks). They also assume the driver does not need 6 * into PAGE_SIZE chunks). They also assume the driver does not need
7 * to touch the video data. 7 * to touch the video data.
8 * 8 *
9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
10 * 10 *
11 * Highly based on video-buf written originally by: 11 * Highly based on video-buf written originally by:
12 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> 12 * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org>
13 * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> 13 * (c) 2006 Mauro Carvalho Chehab, <mchehab@kernel.org>
14 * (c) 2006 Ted Walther and John Sokol 14 * (c) 2006 Ted Walther and John Sokol
15 * 15 *
16 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h
index 486a97efdb56..36c6a4ad3504 100644
--- a/include/media/videobuf-vmalloc.h
+++ b/include/media/videobuf-vmalloc.h
@@ -6,7 +6,7 @@
6 * into PAGE_SIZE chunks). They also assume the driver does not need 6 * into PAGE_SIZE chunks). They also assume the driver does not need
7 * to touch the video data. 7 * to touch the video data.
8 * 8 *
9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> 9 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
diff --git a/include/net/bonding.h b/include/net/bonding.h
index f801fc940b29..b52235158836 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -198,6 +198,7 @@ struct bonding {
198 struct slave __rcu *primary_slave; 198 struct slave __rcu *primary_slave;
199 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */ 199 struct bond_up_slave __rcu *slave_arr; /* Array of usable slaves */
200 bool force_primary; 200 bool force_primary;
201 u32 nest_level;
201 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ 202 s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
202 int (*recv_probe)(const struct sk_buff *, struct bonding *, 203 int (*recv_probe)(const struct sk_buff *, struct bonding *,
203 struct slave *); 204 struct slave *);
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index e2f6e5c928bb..adc24df56b90 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -256,7 +256,7 @@ extern struct flow_dissector flow_keys_basic_dissector;
256 * This structure is used to hold a digest of the full flow keys. This is a 256 * This structure is used to hold a digest of the full flow keys. This is a
257 * larger "hash" of a flow to allow definitively matching specific flows where 257 * larger "hash" of a flow to allow definitively matching specific flows where
258 * the 32 bit skb->hash is not large enough. The size is limited to 16 bytes so 258 * the 32 bit skb->hash is not large enough. The size is limited to 16 bytes so
259 * that it can by used in CB of skb (see sch_choke for an example). 259 * that it can be used in CB of skb (see sch_choke for an example).
260 */ 260 */
261#define FLOW_KEYS_DIGEST_LEN 16 261#define FLOW_KEYS_DIGEST_LEN 16
262struct flow_keys_digest { 262struct flow_keys_digest {
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index d2279b2d61aa..b2f3a0c018e7 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2080,7 +2080,7 @@ struct ieee80211_txq {
2080 * virtual interface might not be given air time for the transmission of 2080 * virtual interface might not be given air time for the transmission of
2081 * the frame, as it is not synced with the AP/P2P GO yet, and thus the 2081 * the frame, as it is not synced with the AP/P2P GO yet, and thus the
2082 * deauthentication frame might not be transmitted. 2082 * deauthentication frame might not be transmitted.
2083 > 2083 *
2084 * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't 2084 * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't
2085 * support QoS NDP for AP probing - that's most likely a driver bug. 2085 * support QoS NDP for AP probing - that's most likely a driver bug.
2086 * 2086 *
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index a872379b69da..45e75c36b738 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -375,6 +375,7 @@ struct xfrm_input_afinfo {
375int xfrm_input_register_afinfo(const struct xfrm_input_afinfo *afinfo); 375int xfrm_input_register_afinfo(const struct xfrm_input_afinfo *afinfo);
376int xfrm_input_unregister_afinfo(const struct xfrm_input_afinfo *afinfo); 376int xfrm_input_unregister_afinfo(const struct xfrm_input_afinfo *afinfo);
377 377
378void xfrm_flush_gc(void);
378void xfrm_state_delete_tunnel(struct xfrm_state *x); 379void xfrm_state_delete_tunnel(struct xfrm_state *x);
379 380
380struct xfrm_type { 381struct xfrm_type {
diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 9e96c2fe2793..077e664ac9a2 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -15,6 +15,7 @@
15#define _TRACE_RXRPC_H 15#define _TRACE_RXRPC_H
16 16
17#include <linux/tracepoint.h> 17#include <linux/tracepoint.h>
18#include <linux/errqueue.h>
18 19
19/* 20/*
20 * Define enums for tracing information. 21 * Define enums for tracing information.
@@ -210,6 +211,20 @@ enum rxrpc_congest_change {
210 rxrpc_cong_saw_nack, 211 rxrpc_cong_saw_nack,
211}; 212};
212 213
214enum rxrpc_tx_fail_trace {
215 rxrpc_tx_fail_call_abort,
216 rxrpc_tx_fail_call_ack,
217 rxrpc_tx_fail_call_data_frag,
218 rxrpc_tx_fail_call_data_nofrag,
219 rxrpc_tx_fail_call_final_resend,
220 rxrpc_tx_fail_conn_abort,
221 rxrpc_tx_fail_conn_challenge,
222 rxrpc_tx_fail_conn_response,
223 rxrpc_tx_fail_reject,
224 rxrpc_tx_fail_version_keepalive,
225 rxrpc_tx_fail_version_reply,
226};
227
213#endif /* end __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY */ 228#endif /* end __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY */
214 229
215/* 230/*
@@ -437,6 +452,19 @@ enum rxrpc_congest_change {
437 EM(RXRPC_CALL_LOCAL_ERROR, "LocalError") \ 452 EM(RXRPC_CALL_LOCAL_ERROR, "LocalError") \
438 E_(RXRPC_CALL_NETWORK_ERROR, "NetError") 453 E_(RXRPC_CALL_NETWORK_ERROR, "NetError")
439 454
455#define rxrpc_tx_fail_traces \
456 EM(rxrpc_tx_fail_call_abort, "CallAbort") \
457 EM(rxrpc_tx_fail_call_ack, "CallAck") \
458 EM(rxrpc_tx_fail_call_data_frag, "CallDataFrag") \
459 EM(rxrpc_tx_fail_call_data_nofrag, "CallDataNofrag") \
460 EM(rxrpc_tx_fail_call_final_resend, "CallFinalResend") \
461 EM(rxrpc_tx_fail_conn_abort, "ConnAbort") \
462 EM(rxrpc_tx_fail_conn_challenge, "ConnChall") \
463 EM(rxrpc_tx_fail_conn_response, "ConnResp") \
464 EM(rxrpc_tx_fail_reject, "Reject") \
465 EM(rxrpc_tx_fail_version_keepalive, "VerKeepalive") \
466 E_(rxrpc_tx_fail_version_reply, "VerReply")
467
440/* 468/*
441 * Export enum symbols via userspace. 469 * Export enum symbols via userspace.
442 */ 470 */
@@ -460,6 +488,7 @@ rxrpc_propose_ack_traces;
460rxrpc_propose_ack_outcomes; 488rxrpc_propose_ack_outcomes;
461rxrpc_congest_modes; 489rxrpc_congest_modes;
462rxrpc_congest_changes; 490rxrpc_congest_changes;
491rxrpc_tx_fail_traces;
463 492
464/* 493/*
465 * Now redefine the EM() and E_() macros to map the enums to the strings that 494 * Now redefine the EM() and E_() macros to map the enums to the strings that
@@ -1374,6 +1403,62 @@ TRACE_EVENT(rxrpc_resend,
1374 __entry->anno) 1403 __entry->anno)
1375 ); 1404 );
1376 1405
1406TRACE_EVENT(rxrpc_rx_icmp,
1407 TP_PROTO(struct rxrpc_peer *peer, struct sock_extended_err *ee,
1408 struct sockaddr_rxrpc *srx),
1409
1410 TP_ARGS(peer, ee, srx),
1411
1412 TP_STRUCT__entry(
1413 __field(unsigned int, peer )
1414 __field_struct(struct sock_extended_err, ee )
1415 __field_struct(struct sockaddr_rxrpc, srx )
1416 ),
1417
1418 TP_fast_assign(
1419 __entry->peer = peer->debug_id;
1420 memcpy(&__entry->ee, ee, sizeof(__entry->ee));
1421 memcpy(&__entry->srx, srx, sizeof(__entry->srx));
1422 ),
1423
1424 TP_printk("P=%08x o=%u t=%u c=%u i=%u d=%u e=%d %pISp",
1425 __entry->peer,
1426 __entry->ee.ee_origin,
1427 __entry->ee.ee_type,
1428 __entry->ee.ee_code,
1429 __entry->ee.ee_info,
1430 __entry->ee.ee_data,
1431 __entry->ee.ee_errno,
1432 &__entry->srx.transport)
1433 );
1434
1435TRACE_EVENT(rxrpc_tx_fail,
1436 TP_PROTO(unsigned int debug_id, rxrpc_serial_t serial, int ret,
1437 enum rxrpc_tx_fail_trace what),
1438
1439 TP_ARGS(debug_id, serial, ret, what),
1440
1441 TP_STRUCT__entry(
1442 __field(unsigned int, debug_id )
1443 __field(rxrpc_serial_t, serial )
1444 __field(int, ret )
1445 __field(enum rxrpc_tx_fail_trace, what )
1446 ),
1447
1448 TP_fast_assign(
1449 __entry->debug_id = debug_id;
1450 __entry->serial = serial;
1451 __entry->ret = ret;
1452 __entry->what = what;
1453 ),
1454
1455 TP_printk("c=%08x r=%x ret=%d %s",
1456 __entry->debug_id,
1457 __entry->serial,
1458 __entry->ret,
1459 __print_symbolic(__entry->what, rxrpc_tx_fail_traces))
1460 );
1461
1377#endif /* _TRACE_RXRPC_H */ 1462#endif /* _TRACE_RXRPC_H */
1378 1463
1379/* This part must be outside protection */ 1464/* This part must be outside protection */
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 335d87242439..bbb08a3ef5cc 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -224,6 +224,8 @@ TRACE_EVENT(rpc_stats_latency,
224 TP_ARGS(task, backlog, rtt, execute), 224 TP_ARGS(task, backlog, rtt, execute),
225 225
226 TP_STRUCT__entry( 226 TP_STRUCT__entry(
227 __field(unsigned int, task_id)
228 __field(unsigned int, client_id)
227 __field(u32, xid) 229 __field(u32, xid)
228 __field(int, version) 230 __field(int, version)
229 __string(progname, task->tk_client->cl_program->name) 231 __string(progname, task->tk_client->cl_program->name)
@@ -231,13 +233,11 @@ TRACE_EVENT(rpc_stats_latency,
231 __field(unsigned long, backlog) 233 __field(unsigned long, backlog)
232 __field(unsigned long, rtt) 234 __field(unsigned long, rtt)
233 __field(unsigned long, execute) 235 __field(unsigned long, execute)
234 __string(addr,
235 task->tk_xprt->address_strings[RPC_DISPLAY_ADDR])
236 __string(port,
237 task->tk_xprt->address_strings[RPC_DISPLAY_PORT])
238 ), 236 ),
239 237
240 TP_fast_assign( 238 TP_fast_assign(
239 __entry->client_id = task->tk_client->cl_clid;
240 __entry->task_id = task->tk_pid;
241 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 241 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
242 __entry->version = task->tk_client->cl_vers; 242 __entry->version = task->tk_client->cl_vers;
243 __assign_str(progname, task->tk_client->cl_program->name) 243 __assign_str(progname, task->tk_client->cl_program->name)
@@ -245,14 +245,10 @@ TRACE_EVENT(rpc_stats_latency,
245 __entry->backlog = ktime_to_us(backlog); 245 __entry->backlog = ktime_to_us(backlog);
246 __entry->rtt = ktime_to_us(rtt); 246 __entry->rtt = ktime_to_us(rtt);
247 __entry->execute = ktime_to_us(execute); 247 __entry->execute = ktime_to_us(execute);
248 __assign_str(addr,
249 task->tk_xprt->address_strings[RPC_DISPLAY_ADDR]);
250 __assign_str(port,
251 task->tk_xprt->address_strings[RPC_DISPLAY_PORT]);
252 ), 248 ),
253 249
254 TP_printk("peer=[%s]:%s xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 250 TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
255 __get_str(addr), __get_str(port), __entry->xid, 251 __entry->task_id, __entry->client_id, __entry->xid,
256 __get_str(progname), __entry->version, __get_str(procname), 252 __get_str(progname), __entry->version, __get_str(procname),
257 __entry->backlog, __entry->rtt, __entry->execute) 253 __entry->backlog, __entry->rtt, __entry->execute)
258); 254);
diff --git a/include/uapi/linux/if_infiniband.h b/include/uapi/linux/if_infiniband.h
index 050b92dcf8cf..0fc33bf30e45 100644
--- a/include/uapi/linux/if_infiniband.h
+++ b/include/uapi/linux/if_infiniband.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2/* 2/*
3 * This software is available to you under a choice of one of two 3 * This software is available to you under a choice of one of two
4 * licenses. You may choose to be licensed under the terms of the GNU 4 * licenses. You may choose to be licensed under the terms of the GNU
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 15daf5e2638d..9c3630146cec 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2698,6 +2698,8 @@ enum nl80211_attrs {
2698#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS 2698#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
2699#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS 2699#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
2700 2700
2701#define NL80211_WIPHY_NAME_MAXLEN 128
2702
2701#define NL80211_MAX_SUPP_RATES 32 2703#define NL80211_MAX_SUPP_RATES 32
2702#define NL80211_MAX_SUPP_HT_RATES 77 2704#define NL80211_MAX_SUPP_HT_RATES 77
2703#define NL80211_MAX_SUPP_REG_RULES 64 2705#define NL80211_MAX_SUPP_REG_RULES 64
diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h
index a66b213de3d7..20c6bd0b0007 100644
--- a/include/uapi/linux/rds.h
+++ b/include/uapi/linux/rds.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2008 Oracle. All rights reserved. 3 * Copyright (c) 2008 Oracle. All rights reserved.
4 * 4 *
diff --git a/include/uapi/linux/tls.h b/include/uapi/linux/tls.h
index c6633e97eca4..ff02287495ac 100644
--- a/include/uapi/linux/tls.h
+++ b/include/uapi/linux/tls.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved. 3 * Copyright (c) 2016-2017, Mellanox Technologies. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/cxgb3-abi.h b/include/uapi/rdma/cxgb3-abi.h
index 9acb4b7a6246..85aed672f43e 100644
--- a/include/uapi/rdma/cxgb3-abi.h
+++ b/include/uapi/rdma/cxgb3-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2006 Chelsio, Inc. All rights reserved. 3 * Copyright (c) 2006 Chelsio, Inc. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/cxgb4-abi.h b/include/uapi/rdma/cxgb4-abi.h
index 1fefd0140c26..a159ba8dcf8f 100644
--- a/include/uapi/rdma/cxgb4-abi.h
+++ b/include/uapi/rdma/cxgb4-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved. 3 * Copyright (c) 2009-2010 Chelsio, Inc. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h
index 7092c8de4bd8..78613b609fa8 100644
--- a/include/uapi/rdma/hns-abi.h
+++ b/include/uapi/rdma/hns-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2016 Hisilicon Limited. 3 * Copyright (c) 2016 Hisilicon Limited.
4 * 4 *
diff --git a/include/uapi/rdma/ib_user_cm.h b/include/uapi/rdma/ib_user_cm.h
index 4a8f9562f7cd..e2709bb8cb18 100644
--- a/include/uapi/rdma/ib_user_cm.h
+++ b/include/uapi/rdma/ib_user_cm.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2005 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Topspin Communications. All rights reserved.
4 * Copyright (c) 2005 Intel Corporation. All rights reserved. 4 * Copyright (c) 2005 Intel Corporation. All rights reserved.
diff --git a/include/uapi/rdma/ib_user_ioctl_verbs.h b/include/uapi/rdma/ib_user_ioctl_verbs.h
index 04e46ea517d3..625545d862d7 100644
--- a/include/uapi/rdma/ib_user_ioctl_verbs.h
+++ b/include/uapi/rdma/ib_user_ioctl_verbs.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2017-2018, Mellanox Technologies inc. All rights reserved. 3 * Copyright (c) 2017-2018, Mellanox Technologies inc. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/ib_user_mad.h b/include/uapi/rdma/ib_user_mad.h
index ef92118dad97..90c0cf228020 100644
--- a/include/uapi/rdma/ib_user_mad.h
+++ b/include/uapi/rdma/ib_user_mad.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2004 Topspin Communications. All rights reserved. 3 * Copyright (c) 2004 Topspin Communications. All rights reserved.
4 * Copyright (c) 2005 Voltaire, Inc. All rights reserved. 4 * Copyright (c) 2005 Voltaire, Inc. All rights reserved.
diff --git a/include/uapi/rdma/ib_user_sa.h b/include/uapi/rdma/ib_user_sa.h
index 0d2607f0cd20..435155d6e1c6 100644
--- a/include/uapi/rdma/ib_user_sa.h
+++ b/include/uapi/rdma/ib_user_sa.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2005 Intel Corporation. All rights reserved. 3 * Copyright (c) 2005 Intel Corporation. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 9be07394fdbe..6aeb03315b0b 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2005 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Topspin Communications. All rights reserved.
4 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. 4 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
diff --git a/include/uapi/rdma/mlx4-abi.h b/include/uapi/rdma/mlx4-abi.h
index 04f64bc4045f..f74557528175 100644
--- a/include/uapi/rdma/mlx4-abi.h
+++ b/include/uapi/rdma/mlx4-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. 3 * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
4 * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved. 4 * Copyright (c) 2007, 2008 Mellanox Technologies. All rights reserved.
diff --git a/include/uapi/rdma/mlx5-abi.h b/include/uapi/rdma/mlx5-abi.h
index cb4a02c4a1ce..fdaf00e20649 100644
--- a/include/uapi/rdma/mlx5-abi.h
+++ b/include/uapi/rdma/mlx5-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved. 3 * Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/mthca-abi.h b/include/uapi/rdma/mthca-abi.h
index ac756cd9e807..91b12e1a6f43 100644
--- a/include/uapi/rdma/mthca-abi.h
+++ b/include/uapi/rdma/mthca-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2005 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Topspin Communications. All rights reserved.
4 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. 4 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved.
diff --git a/include/uapi/rdma/nes-abi.h b/include/uapi/rdma/nes-abi.h
index 35bfd4015d07..f80495baa969 100644
--- a/include/uapi/rdma/nes-abi.h
+++ b/include/uapi/rdma/nes-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved. 3 * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved.
4 * Copyright (c) 2005 Topspin Communications. All rights reserved. 4 * Copyright (c) 2005 Topspin Communications. All rights reserved.
diff --git a/include/uapi/rdma/qedr-abi.h b/include/uapi/rdma/qedr-abi.h
index 8ba098900e9a..24c658b3c790 100644
--- a/include/uapi/rdma/qedr-abi.h
+++ b/include/uapi/rdma/qedr-abi.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* QLogic qedr NIC Driver 2/* QLogic qedr NIC Driver
3 * Copyright (c) 2015-2016 QLogic Corporation 3 * Copyright (c) 2015-2016 QLogic Corporation
4 * 4 *
diff --git a/include/uapi/rdma/rdma_user_cm.h b/include/uapi/rdma/rdma_user_cm.h
index e1269024af47..0d1e78ebad05 100644
--- a/include/uapi/rdma/rdma_user_cm.h
+++ b/include/uapi/rdma/rdma_user_cm.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2005-2006 Intel Corporation. All rights reserved. 3 * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/rdma_user_ioctl.h b/include/uapi/rdma/rdma_user_ioctl.h
index d223f4164a0f..d92d2721b28c 100644
--- a/include/uapi/rdma/rdma_user_ioctl.h
+++ b/include/uapi/rdma/rdma_user_ioctl.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved. 3 * Copyright (c) 2016 Mellanox Technologies, LTD. All rights reserved.
4 * 4 *
diff --git a/include/uapi/rdma/rdma_user_rxe.h b/include/uapi/rdma/rdma_user_rxe.h
index 1f8a9e7daea4..44ef6a3b7afc 100644
--- a/include/uapi/rdma/rdma_user_rxe.h
+++ b/include/uapi/rdma/rdma_user_rxe.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 1/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2/* 2/*
3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. 3 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
4 * 4 *
diff --git a/init/main.c b/init/main.c
index b795aa341a3a..a404936d85d8 100644
--- a/init/main.c
+++ b/init/main.c
@@ -423,7 +423,7 @@ static noinline void __ref rest_init(void)
423 423
424 /* 424 /*
425 * Enable might_sleep() and smp_processor_id() checks. 425 * Enable might_sleep() and smp_processor_id() checks.
426 * They cannot be enabled earlier because with CONFIG_PRREMPT=y 426 * They cannot be enabled earlier because with CONFIG_PREEMPT=y
427 * kernel_thread() would trigger might_sleep() splats. With 427 * kernel_thread() would trigger might_sleep() splats. With
428 * CONFIG_PREEMPT_VOLUNTARY=y the init task might have scheduled 428 * CONFIG_PREEMPT_VOLUNTARY=y the init task might have scheduled
429 * already, but it's stuck on the kthreadd_done completion. 429 * already, but it's stuck on the kthreadd_done completion.
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 9b87198deea2..c286e75ec087 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -28,6 +28,7 @@
28#include <linux/timekeeping.h> 28#include <linux/timekeeping.h>
29#include <linux/ctype.h> 29#include <linux/ctype.h>
30#include <linux/btf.h> 30#include <linux/btf.h>
31#include <linux/nospec.h>
31 32
32#define IS_FD_ARRAY(map) ((map)->map_type == BPF_MAP_TYPE_PROG_ARRAY || \ 33#define IS_FD_ARRAY(map) ((map)->map_type == BPF_MAP_TYPE_PROG_ARRAY || \
33 (map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \ 34 (map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \
@@ -104,12 +105,14 @@ const struct bpf_map_ops bpf_map_offload_ops = {
104static struct bpf_map *find_and_alloc_map(union bpf_attr *attr) 105static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
105{ 106{
106 const struct bpf_map_ops *ops; 107 const struct bpf_map_ops *ops;
108 u32 type = attr->map_type;
107 struct bpf_map *map; 109 struct bpf_map *map;
108 int err; 110 int err;
109 111
110 if (attr->map_type >= ARRAY_SIZE(bpf_map_types)) 112 if (type >= ARRAY_SIZE(bpf_map_types))
111 return ERR_PTR(-EINVAL); 113 return ERR_PTR(-EINVAL);
112 ops = bpf_map_types[attr->map_type]; 114 type = array_index_nospec(type, ARRAY_SIZE(bpf_map_types));
115 ops = bpf_map_types[type];
113 if (!ops) 116 if (!ops)
114 return ERR_PTR(-EINVAL); 117 return ERR_PTR(-EINVAL);
115 118
@@ -124,7 +127,7 @@ static struct bpf_map *find_and_alloc_map(union bpf_attr *attr)
124 if (IS_ERR(map)) 127 if (IS_ERR(map))
125 return map; 128 return map;
126 map->ops = ops; 129 map->ops = ops;
127 map->map_type = attr->map_type; 130 map->map_type = type;
128 return map; 131 return map;
129} 132}
130 133
@@ -897,11 +900,17 @@ static const struct bpf_prog_ops * const bpf_prog_types[] = {
897 900
898static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog) 901static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog)
899{ 902{
900 if (type >= ARRAY_SIZE(bpf_prog_types) || !bpf_prog_types[type]) 903 const struct bpf_prog_ops *ops;
904
905 if (type >= ARRAY_SIZE(bpf_prog_types))
906 return -EINVAL;
907 type = array_index_nospec(type, ARRAY_SIZE(bpf_prog_types));
908 ops = bpf_prog_types[type];
909 if (!ops)
901 return -EINVAL; 910 return -EINVAL;
902 911
903 if (!bpf_prog_is_dev_bound(prog->aux)) 912 if (!bpf_prog_is_dev_bound(prog->aux))
904 prog->aux->ops = bpf_prog_types[type]; 913 prog->aux->ops = ops;
905 else 914 else
906 prog->aux->ops = &bpf_offload_prog_ops; 915 prog->aux->ops = &bpf_offload_prog_ops;
907 prog->type = type; 916 prog->type = type;
diff --git a/kernel/compat.c b/kernel/compat.c
index 6d21894806b4..92d8c98c0f57 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -34,6 +34,7 @@ int compat_get_timex(struct timex *txc, const struct compat_timex __user *utp)
34{ 34{
35 struct compat_timex tx32; 35 struct compat_timex tx32;
36 36
37 memset(txc, 0, sizeof(struct timex));
37 if (copy_from_user(&tx32, utp, sizeof(struct compat_timex))) 38 if (copy_from_user(&tx32, utp, sizeof(struct compat_timex)))
38 return -EFAULT; 39 return -EFAULT;
39 40
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index d2c6083304b4..e13df951aca7 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -305,7 +305,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
305 * Do not reduce the frequency if the CPU has not been idle 305 * Do not reduce the frequency if the CPU has not been idle
306 * recently, as the reduction is likely to be premature then. 306 * recently, as the reduction is likely to be premature then.
307 */ 307 */
308 if (busy && next_f < sg_policy->next_freq) { 308 if (busy && next_f < sg_policy->next_freq &&
309 sg_policy->next_freq != UINT_MAX) {
309 next_f = sg_policy->next_freq; 310 next_f = sg_policy->next_freq;
310 311
311 /* Reset cached freq as next_freq has changed */ 312 /* Reset cached freq as next_freq has changed */
@@ -396,19 +397,6 @@ static void sugov_irq_work(struct irq_work *irq_work)
396 397
397 sg_policy = container_of(irq_work, struct sugov_policy, irq_work); 398 sg_policy = container_of(irq_work, struct sugov_policy, irq_work);
398 399
399 /*
400 * For RT tasks, the schedutil governor shoots the frequency to maximum.
401 * Special care must be taken to ensure that this kthread doesn't result
402 * in the same behavior.
403 *
404 * This is (mostly) guaranteed by the work_in_progress flag. The flag is
405 * updated only at the end of the sugov_work() function and before that
406 * the schedutil governor rejects all other frequency scaling requests.
407 *
408 * There is a very rare case though, where the RT thread yields right
409 * after the work_in_progress flag is cleared. The effects of that are
410 * neglected for now.
411 */
412 kthread_queue_work(&sg_policy->worker, &sg_policy->work); 400 kthread_queue_work(&sg_policy->worker, &sg_policy->work);
413} 401}
414 402
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 0e974cface0b..84f37420fcf5 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -119,6 +119,16 @@ static DEFINE_SPINLOCK(watchdog_lock);
119static int watchdog_running; 119static int watchdog_running;
120static atomic_t watchdog_reset_pending; 120static atomic_t watchdog_reset_pending;
121 121
122static void inline clocksource_watchdog_lock(unsigned long *flags)
123{
124 spin_lock_irqsave(&watchdog_lock, *flags);
125}
126
127static void inline clocksource_watchdog_unlock(unsigned long *flags)
128{
129 spin_unlock_irqrestore(&watchdog_lock, *flags);
130}
131
122static int clocksource_watchdog_kthread(void *data); 132static int clocksource_watchdog_kthread(void *data);
123static void __clocksource_change_rating(struct clocksource *cs, int rating); 133static void __clocksource_change_rating(struct clocksource *cs, int rating);
124 134
@@ -142,9 +152,19 @@ static void __clocksource_unstable(struct clocksource *cs)
142 cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG); 152 cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
143 cs->flags |= CLOCK_SOURCE_UNSTABLE; 153 cs->flags |= CLOCK_SOURCE_UNSTABLE;
144 154
155 /*
156 * If the clocksource is registered clocksource_watchdog_kthread() will
157 * re-rate and re-select.
158 */
159 if (list_empty(&cs->list)) {
160 cs->rating = 0;
161 return;
162 }
163
145 if (cs->mark_unstable) 164 if (cs->mark_unstable)
146 cs->mark_unstable(cs); 165 cs->mark_unstable(cs);
147 166
167 /* kick clocksource_watchdog_kthread() */
148 if (finished_booting) 168 if (finished_booting)
149 schedule_work(&watchdog_work); 169 schedule_work(&watchdog_work);
150} 170}
@@ -153,10 +173,8 @@ static void __clocksource_unstable(struct clocksource *cs)
153 * clocksource_mark_unstable - mark clocksource unstable via watchdog 173 * clocksource_mark_unstable - mark clocksource unstable via watchdog
154 * @cs: clocksource to be marked unstable 174 * @cs: clocksource to be marked unstable
155 * 175 *
156 * This function is called instead of clocksource_change_rating from 176 * This function is called by the x86 TSC code to mark clocksources as unstable;
157 * cpu hotplug code to avoid a deadlock between the clocksource mutex 177 * it defers demotion and re-selection to a kthread.
158 * and the cpu hotplug mutex. It defers the update of the clocksource
159 * to the watchdog thread.
160 */ 178 */
161void clocksource_mark_unstable(struct clocksource *cs) 179void clocksource_mark_unstable(struct clocksource *cs)
162{ 180{
@@ -164,7 +182,7 @@ void clocksource_mark_unstable(struct clocksource *cs)
164 182
165 spin_lock_irqsave(&watchdog_lock, flags); 183 spin_lock_irqsave(&watchdog_lock, flags);
166 if (!(cs->flags & CLOCK_SOURCE_UNSTABLE)) { 184 if (!(cs->flags & CLOCK_SOURCE_UNSTABLE)) {
167 if (list_empty(&cs->wd_list)) 185 if (!list_empty(&cs->list) && list_empty(&cs->wd_list))
168 list_add(&cs->wd_list, &watchdog_list); 186 list_add(&cs->wd_list, &watchdog_list);
169 __clocksource_unstable(cs); 187 __clocksource_unstable(cs);
170 } 188 }
@@ -319,9 +337,8 @@ static void clocksource_resume_watchdog(void)
319 337
320static void clocksource_enqueue_watchdog(struct clocksource *cs) 338static void clocksource_enqueue_watchdog(struct clocksource *cs)
321{ 339{
322 unsigned long flags; 340 INIT_LIST_HEAD(&cs->wd_list);
323 341
324 spin_lock_irqsave(&watchdog_lock, flags);
325 if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) { 342 if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
326 /* cs is a clocksource to be watched. */ 343 /* cs is a clocksource to be watched. */
327 list_add(&cs->wd_list, &watchdog_list); 344 list_add(&cs->wd_list, &watchdog_list);
@@ -331,7 +348,6 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs)
331 if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) 348 if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
332 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES; 349 cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
333 } 350 }
334 spin_unlock_irqrestore(&watchdog_lock, flags);
335} 351}
336 352
337static void clocksource_select_watchdog(bool fallback) 353static void clocksource_select_watchdog(bool fallback)
@@ -373,9 +389,6 @@ static void clocksource_select_watchdog(bool fallback)
373 389
374static void clocksource_dequeue_watchdog(struct clocksource *cs) 390static void clocksource_dequeue_watchdog(struct clocksource *cs)
375{ 391{
376 unsigned long flags;
377
378 spin_lock_irqsave(&watchdog_lock, flags);
379 if (cs != watchdog) { 392 if (cs != watchdog) {
380 if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) { 393 if (cs->flags & CLOCK_SOURCE_MUST_VERIFY) {
381 /* cs is a watched clocksource. */ 394 /* cs is a watched clocksource. */
@@ -384,21 +397,19 @@ static void clocksource_dequeue_watchdog(struct clocksource *cs)
384 clocksource_stop_watchdog(); 397 clocksource_stop_watchdog();
385 } 398 }
386 } 399 }
387 spin_unlock_irqrestore(&watchdog_lock, flags);
388} 400}
389 401
390static int __clocksource_watchdog_kthread(void) 402static int __clocksource_watchdog_kthread(void)
391{ 403{
392 struct clocksource *cs, *tmp; 404 struct clocksource *cs, *tmp;
393 unsigned long flags; 405 unsigned long flags;
394 LIST_HEAD(unstable);
395 int select = 0; 406 int select = 0;
396 407
397 spin_lock_irqsave(&watchdog_lock, flags); 408 spin_lock_irqsave(&watchdog_lock, flags);
398 list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) { 409 list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) {
399 if (cs->flags & CLOCK_SOURCE_UNSTABLE) { 410 if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
400 list_del_init(&cs->wd_list); 411 list_del_init(&cs->wd_list);
401 list_add(&cs->wd_list, &unstable); 412 __clocksource_change_rating(cs, 0);
402 select = 1; 413 select = 1;
403 } 414 }
404 if (cs->flags & CLOCK_SOURCE_RESELECT) { 415 if (cs->flags & CLOCK_SOURCE_RESELECT) {
@@ -410,11 +421,6 @@ static int __clocksource_watchdog_kthread(void)
410 clocksource_stop_watchdog(); 421 clocksource_stop_watchdog();
411 spin_unlock_irqrestore(&watchdog_lock, flags); 422 spin_unlock_irqrestore(&watchdog_lock, flags);
412 423
413 /* Needs to be done outside of watchdog lock */
414 list_for_each_entry_safe(cs, tmp, &unstable, wd_list) {
415 list_del_init(&cs->wd_list);
416 __clocksource_change_rating(cs, 0);
417 }
418 return select; 424 return select;
419} 425}
420 426
@@ -447,6 +453,9 @@ static inline int __clocksource_watchdog_kthread(void) { return 0; }
447static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } 453static bool clocksource_is_watchdog(struct clocksource *cs) { return false; }
448void clocksource_mark_unstable(struct clocksource *cs) { } 454void clocksource_mark_unstable(struct clocksource *cs) { }
449 455
456static void inline clocksource_watchdog_lock(unsigned long *flags) { }
457static void inline clocksource_watchdog_unlock(unsigned long *flags) { }
458
450#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */ 459#endif /* CONFIG_CLOCKSOURCE_WATCHDOG */
451 460
452/** 461/**
@@ -779,14 +788,19 @@ EXPORT_SYMBOL_GPL(__clocksource_update_freq_scale);
779 */ 788 */
780int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq) 789int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq)
781{ 790{
791 unsigned long flags;
782 792
783 /* Initialize mult/shift and max_idle_ns */ 793 /* Initialize mult/shift and max_idle_ns */
784 __clocksource_update_freq_scale(cs, scale, freq); 794 __clocksource_update_freq_scale(cs, scale, freq);
785 795
786 /* Add clocksource to the clocksource list */ 796 /* Add clocksource to the clocksource list */
787 mutex_lock(&clocksource_mutex); 797 mutex_lock(&clocksource_mutex);
798
799 clocksource_watchdog_lock(&flags);
788 clocksource_enqueue(cs); 800 clocksource_enqueue(cs);
789 clocksource_enqueue_watchdog(cs); 801 clocksource_enqueue_watchdog(cs);
802 clocksource_watchdog_unlock(&flags);
803
790 clocksource_select(); 804 clocksource_select();
791 clocksource_select_watchdog(false); 805 clocksource_select_watchdog(false);
792 mutex_unlock(&clocksource_mutex); 806 mutex_unlock(&clocksource_mutex);
@@ -808,8 +822,13 @@ static void __clocksource_change_rating(struct clocksource *cs, int rating)
808 */ 822 */
809void clocksource_change_rating(struct clocksource *cs, int rating) 823void clocksource_change_rating(struct clocksource *cs, int rating)
810{ 824{
825 unsigned long flags;
826
811 mutex_lock(&clocksource_mutex); 827 mutex_lock(&clocksource_mutex);
828 clocksource_watchdog_lock(&flags);
812 __clocksource_change_rating(cs, rating); 829 __clocksource_change_rating(cs, rating);
830 clocksource_watchdog_unlock(&flags);
831
813 clocksource_select(); 832 clocksource_select();
814 clocksource_select_watchdog(false); 833 clocksource_select_watchdog(false);
815 mutex_unlock(&clocksource_mutex); 834 mutex_unlock(&clocksource_mutex);
@@ -821,6 +840,8 @@ EXPORT_SYMBOL(clocksource_change_rating);
821 */ 840 */
822static int clocksource_unbind(struct clocksource *cs) 841static int clocksource_unbind(struct clocksource *cs)
823{ 842{
843 unsigned long flags;
844
824 if (clocksource_is_watchdog(cs)) { 845 if (clocksource_is_watchdog(cs)) {
825 /* Select and try to install a replacement watchdog. */ 846 /* Select and try to install a replacement watchdog. */
826 clocksource_select_watchdog(true); 847 clocksource_select_watchdog(true);
@@ -834,8 +855,12 @@ static int clocksource_unbind(struct clocksource *cs)
834 if (curr_clocksource == cs) 855 if (curr_clocksource == cs)
835 return -EBUSY; 856 return -EBUSY;
836 } 857 }
858
859 clocksource_watchdog_lock(&flags);
837 clocksource_dequeue_watchdog(cs); 860 clocksource_dequeue_watchdog(cs);
838 list_del_init(&cs->list); 861 list_del_init(&cs->list);
862 clocksource_watchdog_unlock(&flags);
863
839 return 0; 864 return 0;
840} 865}
841 866
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 16bbf062018f..8d83bcf9ef69 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5514,10 +5514,10 @@ static __init int ftrace_init_dyn_tracefs(struct dentry *d_tracer)
5514 ftrace_create_filter_files(&global_ops, d_tracer); 5514 ftrace_create_filter_files(&global_ops, d_tracer);
5515 5515
5516#ifdef CONFIG_FUNCTION_GRAPH_TRACER 5516#ifdef CONFIG_FUNCTION_GRAPH_TRACER
5517 trace_create_file("set_graph_function", 0444, d_tracer, 5517 trace_create_file("set_graph_function", 0644, d_tracer,
5518 NULL, 5518 NULL,
5519 &ftrace_graph_fops); 5519 &ftrace_graph_fops);
5520 trace_create_file("set_graph_notrace", 0444, d_tracer, 5520 trace_create_file("set_graph_notrace", 0644, d_tracer,
5521 NULL, 5521 NULL,
5522 &ftrace_graph_notrace_fops); 5522 &ftrace_graph_notrace_fops);
5523#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 5523#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 1f951b3df60c..7d306b74230f 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -762,6 +762,9 @@ static int regex_match_full(char *str, struct regex *r, int len)
762 762
763static int regex_match_front(char *str, struct regex *r, int len) 763static int regex_match_front(char *str, struct regex *r, int len)
764{ 764{
765 if (len < r->len)
766 return 0;
767
765 if (strncmp(str, r->pattern, r->len) == 0) 768 if (strncmp(str, r->pattern, r->len) == 0)
766 return 1; 769 return 1;
767 return 0; 770 return 0;
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 3c7bfc4bf5e9..4237eba4ef20 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -472,7 +472,7 @@ static __init int stack_trace_init(void)
472 NULL, &stack_trace_fops); 472 NULL, &stack_trace_fops);
473 473
474#ifdef CONFIG_DYNAMIC_FTRACE 474#ifdef CONFIG_DYNAMIC_FTRACE
475 trace_create_file("stack_trace_filter", 0444, d_tracer, 475 trace_create_file("stack_trace_filter", 0644, d_tracer,
476 &trace_ops, &stack_trace_filter_fops); 476 &trace_ops, &stack_trace_filter_fops);
477#endif 477#endif
478 478
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 023190c69dce..7441bd93b732 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -115,6 +115,7 @@ static int bdi_debug_register(struct backing_dev_info *bdi, const char *name)
115 bdi, &bdi_debug_stats_fops); 115 bdi, &bdi_debug_stats_fops);
116 if (!bdi->debug_stats) { 116 if (!bdi->debug_stats) {
117 debugfs_remove(bdi->debug_dir); 117 debugfs_remove(bdi->debug_dir);
118 bdi->debug_dir = NULL;
118 return -ENOMEM; 119 return -ENOMEM;
119 } 120 }
120 121
@@ -383,7 +384,7 @@ static void wb_shutdown(struct bdi_writeback *wb)
383 * the barrier provided by test_and_clear_bit() above. 384 * the barrier provided by test_and_clear_bit() above.
384 */ 385 */
385 smp_wmb(); 386 smp_wmb();
386 clear_bit(WB_shutting_down, &wb->state); 387 clear_and_wake_up_bit(WB_shutting_down, &wb->state);
387} 388}
388 389
389static void wb_exit(struct bdi_writeback *wb) 390static void wb_exit(struct bdi_writeback *wb)
diff --git a/mm/mmap.c b/mm/mmap.c
index 9d5968d1e8e3..6fc435760086 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1324,6 +1324,35 @@ static inline int mlock_future_check(struct mm_struct *mm,
1324 return 0; 1324 return 0;
1325} 1325}
1326 1326
1327static inline u64 file_mmap_size_max(struct file *file, struct inode *inode)
1328{
1329 if (S_ISREG(inode->i_mode))
1330 return inode->i_sb->s_maxbytes;
1331
1332 if (S_ISBLK(inode->i_mode))
1333 return MAX_LFS_FILESIZE;
1334
1335 /* Special "we do even unsigned file positions" case */
1336 if (file->f_mode & FMODE_UNSIGNED_OFFSET)
1337 return 0;
1338
1339 /* Yes, random drivers might want more. But I'm tired of buggy drivers */
1340 return ULONG_MAX;
1341}
1342
1343static inline bool file_mmap_ok(struct file *file, struct inode *inode,
1344 unsigned long pgoff, unsigned long len)
1345{
1346 u64 maxsize = file_mmap_size_max(file, inode);
1347
1348 if (maxsize && len > maxsize)
1349 return false;
1350 maxsize -= len;
1351 if (pgoff > maxsize >> PAGE_SHIFT)
1352 return false;
1353 return true;
1354}
1355
1327/* 1356/*
1328 * The caller must hold down_write(&current->mm->mmap_sem). 1357 * The caller must hold down_write(&current->mm->mmap_sem).
1329 */ 1358 */
@@ -1409,6 +1438,9 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
1409 struct inode *inode = file_inode(file); 1438 struct inode *inode = file_inode(file);
1410 unsigned long flags_mask; 1439 unsigned long flags_mask;
1411 1440
1441 if (!file_mmap_ok(file, inode, pgoff, len))
1442 return -EOVERFLOW;
1443
1412 flags_mask = LEGACY_MAP_MASK | file->f_op->mmap_supported_flags; 1444 flags_mask = LEGACY_MAP_MASK | file->f_op->mmap_supported_flags;
1413 1445
1414 switch (flags & MAP_TYPE) { 1446 switch (flags & MAP_TYPE) {
diff --git a/net/9p/trans_common.c b/net/9p/trans_common.c
index 38aa6345bdfa..b718db2085b2 100644
--- a/net/9p/trans_common.c
+++ b/net/9p/trans_common.c
@@ -16,7 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17 17
18/** 18/**
19 * p9_release_req_pages - Release pages after the transaction. 19 * p9_release_pages - Release pages after the transaction.
20 */ 20 */
21void p9_release_pages(struct page **pages, int nr_pages) 21void p9_release_pages(struct page **pages, int nr_pages)
22{ 22{
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 0cfba919d167..848969fe7979 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -1092,8 +1092,8 @@ static struct p9_trans_module p9_fd_trans = {
1092}; 1092};
1093 1093
1094/** 1094/**
1095 * p9_poll_proc - poll worker thread 1095 * p9_poll_workfn - poll worker thread
1096 * @a: thread state and arguments 1096 * @work: work queue
1097 * 1097 *
1098 * polls all v9fs transports for new events and queues the appropriate 1098 * polls all v9fs transports for new events and queues the appropriate
1099 * work to the work queue 1099 * work to the work queue
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 6d8e3031978f..3d414acb7015 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -68,8 +68,6 @@
68 * @pd: Protection Domain pointer 68 * @pd: Protection Domain pointer
69 * @qp: Queue Pair pointer 69 * @qp: Queue Pair pointer
70 * @cq: Completion Queue pointer 70 * @cq: Completion Queue pointer
71 * @dm_mr: DMA Memory Region pointer
72 * @lkey: The local access only memory region key
73 * @timeout: Number of uSecs to wait for connection management events 71 * @timeout: Number of uSecs to wait for connection management events
74 * @privport: Whether a privileged port may be used 72 * @privport: Whether a privileged port may be used
75 * @port: The port to use 73 * @port: The port to use
@@ -632,7 +630,7 @@ static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma)
632} 630}
633 631
634/** 632/**
635 * trans_create_rdma - Transport method for creating atransport instance 633 * rdma_create_trans - Transport method for creating a transport instance
636 * @client: client instance 634 * @client: client instance
637 * @addr: IP address string 635 * @addr: IP address string
638 * @args: Mount options string 636 * @args: Mount options string
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 3aa5a93ad107..4d0372263e5d 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -60,7 +60,6 @@ static atomic_t vp_pinned = ATOMIC_INIT(0);
60 60
61/** 61/**
62 * struct virtio_chan - per-instance transport information 62 * struct virtio_chan - per-instance transport information
63 * @initialized: whether the channel is initialized
64 * @inuse: whether the channel is in use 63 * @inuse: whether the channel is in use
65 * @lock: protects multiple elements within this structure 64 * @lock: protects multiple elements within this structure
66 * @client: client instance 65 * @client: client instance
@@ -385,8 +384,8 @@ static int p9_get_mapped_pages(struct virtio_chan *chan,
385 * @uidata: user bffer that should be ued for zero copy read 384 * @uidata: user bffer that should be ued for zero copy read
386 * @uodata: user buffer that shoud be user for zero copy write 385 * @uodata: user buffer that shoud be user for zero copy write
387 * @inlen: read buffer size 386 * @inlen: read buffer size
388 * @olen: write buffer size 387 * @outlen: write buffer size
389 * @hdrlen: reader header size, This is the size of response protocol data 388 * @in_hdr_len: reader header size, This is the size of response protocol data
390 * 389 *
391 */ 390 */
392static int 391static int
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 086a4abdfa7c..0f19960390a6 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -485,7 +485,7 @@ static int xen_9pfs_front_probe(struct xenbus_device *dev,
485 485
486static int xen_9pfs_front_resume(struct xenbus_device *dev) 486static int xen_9pfs_front_resume(struct xenbus_device *dev)
487{ 487{
488 dev_warn(&dev->dev, "suspsend/resume unsupported\n"); 488 dev_warn(&dev->dev, "suspend/resume unsupported\n");
489 return 0; 489 return 0;
490} 490}
491 491
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 01d5d20a6eb1..3138a869b5c0 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -41,6 +41,9 @@ static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 };
41#include <linux/module.h> 41#include <linux/module.h>
42#include <linux/init.h> 42#include <linux/init.h>
43 43
44/* Hardening for Spectre-v1 */
45#include <linux/nospec.h>
46
44#include "lec.h" 47#include "lec.h"
45#include "lec_arpc.h" 48#include "lec_arpc.h"
46#include "resources.h" 49#include "resources.h"
@@ -687,8 +690,10 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg)
687 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc)); 690 bytes_left = copy_from_user(&ioc_data, arg, sizeof(struct atmlec_ioc));
688 if (bytes_left != 0) 691 if (bytes_left != 0)
689 pr_info("copy from user failed for %d bytes\n", bytes_left); 692 pr_info("copy from user failed for %d bytes\n", bytes_left);
690 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF || 693 if (ioc_data.dev_num < 0 || ioc_data.dev_num >= MAX_LEC_ITF)
691 !dev_lec[ioc_data.dev_num]) 694 return -EINVAL;
695 ioc_data.dev_num = array_index_nospec(ioc_data.dev_num, MAX_LEC_ITF);
696 if (!dev_lec[ioc_data.dev_num])
692 return -EINVAL; 697 return -EINVAL;
693 vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL); 698 vpriv = kmalloc(sizeof(struct lec_vcc_priv), GFP_KERNEL);
694 if (!vpriv) 699 if (!vpriv)
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index ea2a6c9fb7ce..d2667e5dddc3 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -157,10 +157,12 @@ static void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data,
157#endif /* CONFIG_BLOCK */ 157#endif /* CONFIG_BLOCK */
158 158
159static void ceph_osd_data_bvecs_init(struct ceph_osd_data *osd_data, 159static void ceph_osd_data_bvecs_init(struct ceph_osd_data *osd_data,
160 struct ceph_bvec_iter *bvec_pos) 160 struct ceph_bvec_iter *bvec_pos,
161 u32 num_bvecs)
161{ 162{
162 osd_data->type = CEPH_OSD_DATA_TYPE_BVECS; 163 osd_data->type = CEPH_OSD_DATA_TYPE_BVECS;
163 osd_data->bvec_pos = *bvec_pos; 164 osd_data->bvec_pos = *bvec_pos;
165 osd_data->num_bvecs = num_bvecs;
164} 166}
165 167
166#define osd_req_op_data(oreq, whch, typ, fld) \ 168#define osd_req_op_data(oreq, whch, typ, fld) \
@@ -237,6 +239,22 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req,
237EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); 239EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio);
238#endif /* CONFIG_BLOCK */ 240#endif /* CONFIG_BLOCK */
239 241
242void osd_req_op_extent_osd_data_bvecs(struct ceph_osd_request *osd_req,
243 unsigned int which,
244 struct bio_vec *bvecs, u32 num_bvecs,
245 u32 bytes)
246{
247 struct ceph_osd_data *osd_data;
248 struct ceph_bvec_iter it = {
249 .bvecs = bvecs,
250 .iter = { .bi_size = bytes },
251 };
252
253 osd_data = osd_req_op_data(osd_req, which, extent, osd_data);
254 ceph_osd_data_bvecs_init(osd_data, &it, num_bvecs);
255}
256EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvecs);
257
240void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, 258void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req,
241 unsigned int which, 259 unsigned int which,
242 struct ceph_bvec_iter *bvec_pos) 260 struct ceph_bvec_iter *bvec_pos)
@@ -244,7 +262,7 @@ void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req,
244 struct ceph_osd_data *osd_data; 262 struct ceph_osd_data *osd_data;
245 263
246 osd_data = osd_req_op_data(osd_req, which, extent, osd_data); 264 osd_data = osd_req_op_data(osd_req, which, extent, osd_data);
247 ceph_osd_data_bvecs_init(osd_data, bvec_pos); 265 ceph_osd_data_bvecs_init(osd_data, bvec_pos, 0);
248} 266}
249EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvec_pos); 267EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvec_pos);
250 268
@@ -287,7 +305,8 @@ EXPORT_SYMBOL(osd_req_op_cls_request_data_pages);
287 305
288void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, 306void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req,
289 unsigned int which, 307 unsigned int which,
290 struct bio_vec *bvecs, u32 bytes) 308 struct bio_vec *bvecs, u32 num_bvecs,
309 u32 bytes)
291{ 310{
292 struct ceph_osd_data *osd_data; 311 struct ceph_osd_data *osd_data;
293 struct ceph_bvec_iter it = { 312 struct ceph_bvec_iter it = {
@@ -296,7 +315,7 @@ void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req,
296 }; 315 };
297 316
298 osd_data = osd_req_op_data(osd_req, which, cls, request_data); 317 osd_data = osd_req_op_data(osd_req, which, cls, request_data);
299 ceph_osd_data_bvecs_init(osd_data, &it); 318 ceph_osd_data_bvecs_init(osd_data, &it, num_bvecs);
300 osd_req->r_ops[which].cls.indata_len += bytes; 319 osd_req->r_ops[which].cls.indata_len += bytes;
301 osd_req->r_ops[which].indata_len += bytes; 320 osd_req->r_ops[which].indata_len += bytes;
302} 321}
diff --git a/net/ieee802154/6lowpan/6lowpan_i.h b/net/ieee802154/6lowpan/6lowpan_i.h
index b8d95cb71c25..44a7e16bf3b5 100644
--- a/net/ieee802154/6lowpan/6lowpan_i.h
+++ b/net/ieee802154/6lowpan/6lowpan_i.h
@@ -20,8 +20,8 @@ typedef unsigned __bitwise lowpan_rx_result;
20struct frag_lowpan_compare_key { 20struct frag_lowpan_compare_key {
21 u16 tag; 21 u16 tag;
22 u16 d_size; 22 u16 d_size;
23 const struct ieee802154_addr src; 23 struct ieee802154_addr src;
24 const struct ieee802154_addr dst; 24 struct ieee802154_addr dst;
25}; 25};
26 26
27/* Equivalent of ipv4 struct ipq 27/* Equivalent of ipv4 struct ipq
diff --git a/net/ieee802154/6lowpan/reassembly.c b/net/ieee802154/6lowpan/reassembly.c
index 1790b65944b3..2cc224106b69 100644
--- a/net/ieee802154/6lowpan/reassembly.c
+++ b/net/ieee802154/6lowpan/reassembly.c
@@ -75,14 +75,14 @@ fq_find(struct net *net, const struct lowpan_802154_cb *cb,
75{ 75{
76 struct netns_ieee802154_lowpan *ieee802154_lowpan = 76 struct netns_ieee802154_lowpan *ieee802154_lowpan =
77 net_ieee802154_lowpan(net); 77 net_ieee802154_lowpan(net);
78 struct frag_lowpan_compare_key key = { 78 struct frag_lowpan_compare_key key = {};
79 .tag = cb->d_tag,
80 .d_size = cb->d_size,
81 .src = *src,
82 .dst = *dst,
83 };
84 struct inet_frag_queue *q; 79 struct inet_frag_queue *q;
85 80
81 key.tag = cb->d_tag;
82 key.d_size = cb->d_size;
83 key.src = *src;
84 key.dst = *dst;
85
86 q = inet_frag_find(&ieee802154_lowpan->frags, &key); 86 q = inet_frag_find(&ieee802154_lowpan->frags, &key);
87 if (!q) 87 if (!q)
88 return NULL; 88 return NULL;
@@ -372,7 +372,7 @@ int lowpan_frag_rcv(struct sk_buff *skb, u8 frag_type)
372 struct lowpan_frag_queue *fq; 372 struct lowpan_frag_queue *fq;
373 struct net *net = dev_net(skb->dev); 373 struct net *net = dev_net(skb->dev);
374 struct lowpan_802154_cb *cb = lowpan_802154_cb(skb); 374 struct lowpan_802154_cb *cb = lowpan_802154_cb(skb);
375 struct ieee802154_hdr hdr; 375 struct ieee802154_hdr hdr = {};
376 int err; 376 int err;
377 377
378 if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0) 378 if (ieee802154_hdr_peek_addrs(skb, &hdr) < 0)
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 05e47d777009..56a010622f70 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -775,8 +775,10 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
775 ipc.addr = faddr = daddr; 775 ipc.addr = faddr = daddr;
776 776
777 if (ipc.opt && ipc.opt->opt.srr) { 777 if (ipc.opt && ipc.opt->opt.srr) {
778 if (!daddr) 778 if (!daddr) {
779 return -EINVAL; 779 err = -EINVAL;
780 goto out_free;
781 }
780 faddr = ipc.opt->opt.faddr; 782 faddr = ipc.opt->opt.faddr;
781 } 783 }
782 tos = get_rttos(&ipc, inet); 784 tos = get_rttos(&ipc, inet);
@@ -842,6 +844,7 @@ back_from_confirm:
842 844
843out: 845out:
844 ip_rt_put(rt); 846 ip_rt_put(rt);
847out_free:
845 if (free) 848 if (free)
846 kfree(ipc.opt); 849 kfree(ipc.opt);
847 if (!err) { 850 if (!err) {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1412a7baf0b9..29268efad247 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1375,6 +1375,7 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
1375 fnhe->fnhe_gw = 0; 1375 fnhe->fnhe_gw = 0;
1376 fnhe->fnhe_pmtu = 0; 1376 fnhe->fnhe_pmtu = 0;
1377 fnhe->fnhe_expires = 0; 1377 fnhe->fnhe_expires = 0;
1378 fnhe->fnhe_mtu_locked = false;
1378 fnhe_flush_routes(fnhe); 1379 fnhe_flush_routes(fnhe);
1379 orig = NULL; 1380 orig = NULL;
1380 } 1381 }
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 229e616fafc5..ff4d4ba67735 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -401,9 +401,9 @@ static int compute_score(struct sock *sk, struct net *net,
401 bool dev_match = (sk->sk_bound_dev_if == dif || 401 bool dev_match = (sk->sk_bound_dev_if == dif ||
402 sk->sk_bound_dev_if == sdif); 402 sk->sk_bound_dev_if == sdif);
403 403
404 if (exact_dif && !dev_match) 404 if (!dev_match)
405 return -1; 405 return -1;
406 if (sk->sk_bound_dev_if && dev_match) 406 if (sk->sk_bound_dev_if)
407 score += 4; 407 score += 4;
408 } 408 }
409 409
@@ -1015,8 +1015,10 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
1015 sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags); 1015 sock_tx_timestamp(sk, ipc.sockc.tsflags, &ipc.tx_flags);
1016 1016
1017 if (ipc.opt && ipc.opt->opt.srr) { 1017 if (ipc.opt && ipc.opt->opt.srr) {
1018 if (!daddr) 1018 if (!daddr) {
1019 return -EINVAL; 1019 err = -EINVAL;
1020 goto out_free;
1021 }
1020 faddr = ipc.opt->opt.faddr; 1022 faddr = ipc.opt->opt.faddr;
1021 connected = 0; 1023 connected = 0;
1022 } 1024 }
@@ -1139,6 +1141,7 @@ do_append_data:
1139 1141
1140out: 1142out:
1141 ip_rt_put(rt); 1143 ip_rt_put(rt);
1144out_free:
1142 if (free) 1145 if (free)
1143 kfree(ipc.opt); 1146 kfree(ipc.opt);
1144 if (!err) 1147 if (!err)
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index 6794ddf0547c..11e4e80cf7e9 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -34,16 +34,15 @@ config IPV6_ROUTE_INFO
34 bool "IPv6: Route Information (RFC 4191) support" 34 bool "IPv6: Route Information (RFC 4191) support"
35 depends on IPV6_ROUTER_PREF 35 depends on IPV6_ROUTER_PREF
36 ---help--- 36 ---help---
37 This is experimental support of Route Information. 37 Support of Route Information.
38 38
39 If unsure, say N. 39 If unsure, say N.
40 40
41config IPV6_OPTIMISTIC_DAD 41config IPV6_OPTIMISTIC_DAD
42 bool "IPv6: Enable RFC 4429 Optimistic DAD" 42 bool "IPv6: Enable RFC 4429 Optimistic DAD"
43 ---help--- 43 ---help---
44 This is experimental support for optimistic Duplicate 44 Support for optimistic Duplicate Address Detection. It allows for
45 Address Detection. It allows for autoconfigured addresses 45 autoconfigured addresses to be used more quickly.
46 to be used more quickly.
47 46
48 If unsure, say N. 47 If unsure, say N.
49 48
@@ -280,7 +279,7 @@ config IPV6_MROUTE
280 depends on IPV6 279 depends on IPV6
281 select IP_MROUTE_COMMON 280 select IP_MROUTE_COMMON
282 ---help--- 281 ---help---
283 Experimental support for IPv6 multicast forwarding. 282 Support for IPv6 multicast forwarding.
284 If unsure, say N. 283 If unsure, say N.
285 284
286config IPV6_MROUTE_MULTIPLE_TABLES 285config IPV6_MROUTE_MULTIPLE_TABLES
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index deadc4c3703b..b7f28deddaea 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -669,7 +669,7 @@ static void vti6_link_config(struct ip6_tnl *t, bool keep_mtu)
669 else 669 else
670 mtu = ETH_DATA_LEN - LL_MAX_HEADER - sizeof(struct ipv6hdr); 670 mtu = ETH_DATA_LEN - LL_MAX_HEADER - sizeof(struct ipv6hdr);
671 671
672 dev->mtu = max_t(int, mtu, IPV6_MIN_MTU); 672 dev->mtu = max_t(int, mtu, IPV4_MIN_MTU);
673} 673}
674 674
675/** 675/**
@@ -881,7 +881,7 @@ static void vti6_dev_setup(struct net_device *dev)
881 dev->priv_destructor = vti6_dev_free; 881 dev->priv_destructor = vti6_dev_free;
882 882
883 dev->type = ARPHRD_TUNNEL6; 883 dev->type = ARPHRD_TUNNEL6;
884 dev->min_mtu = IPV6_MIN_MTU; 884 dev->min_mtu = IPV4_MIN_MTU;
885 dev->max_mtu = IP_MAX_MTU - sizeof(struct ipv6hdr); 885 dev->max_mtu = IP_MAX_MTU - sizeof(struct ipv6hdr);
886 dev->flags |= IFF_NOARP; 886 dev->flags |= IFF_NOARP;
887 dev->addr_len = sizeof(struct in6_addr); 887 dev->addr_len = sizeof(struct in6_addr);
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 0056ae766d93..2839c1bd1e58 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -148,9 +148,9 @@ static int compute_score(struct sock *sk, struct net *net,
148 bool dev_match = (sk->sk_bound_dev_if == dif || 148 bool dev_match = (sk->sk_bound_dev_if == dif ||
149 sk->sk_bound_dev_if == sdif); 149 sk->sk_bound_dev_if == sdif);
150 150
151 if (exact_dif && !dev_match) 151 if (!dev_match)
152 return -1; 152 return -1;
153 if (sk->sk_bound_dev_if && dev_match) 153 if (sk->sk_bound_dev_if)
154 score++; 154 score++;
155 } 155 }
156 156
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index f85f0d7480ac..4a46df8441c9 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -341,6 +341,9 @@ static void __net_exit xfrm6_tunnel_net_exit(struct net *net)
341 struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); 341 struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
342 unsigned int i; 342 unsigned int i;
343 343
344 xfrm_state_flush(net, IPSEC_PROTO_ANY, false);
345 xfrm_flush_gc();
346
344 for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++) 347 for (i = 0; i < XFRM6_TUNNEL_SPI_BYADDR_HSIZE; i++)
345 WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i])); 348 WARN_ON_ONCE(!hlist_empty(&xfrm6_tn->spi_byaddr[i]));
346 349
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 7e2e7188e7f4..e62e52e8f141 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -437,6 +437,24 @@ static int verify_address_len(const void *p)
437 return 0; 437 return 0;
438} 438}
439 439
440static inline int sadb_key_len(const struct sadb_key *key)
441{
442 int key_bytes = DIV_ROUND_UP(key->sadb_key_bits, 8);
443
444 return DIV_ROUND_UP(sizeof(struct sadb_key) + key_bytes,
445 sizeof(uint64_t));
446}
447
448static int verify_key_len(const void *p)
449{
450 const struct sadb_key *key = p;
451
452 if (sadb_key_len(key) > key->sadb_key_len)
453 return -EINVAL;
454
455 return 0;
456}
457
440static inline int pfkey_sec_ctx_len(const struct sadb_x_sec_ctx *sec_ctx) 458static inline int pfkey_sec_ctx_len(const struct sadb_x_sec_ctx *sec_ctx)
441{ 459{
442 return DIV_ROUND_UP(sizeof(struct sadb_x_sec_ctx) + 460 return DIV_ROUND_UP(sizeof(struct sadb_x_sec_ctx) +
@@ -533,16 +551,25 @@ static int parse_exthdrs(struct sk_buff *skb, const struct sadb_msg *hdr, void *
533 return -EINVAL; 551 return -EINVAL;
534 if (ext_hdrs[ext_type-1] != NULL) 552 if (ext_hdrs[ext_type-1] != NULL)
535 return -EINVAL; 553 return -EINVAL;
536 if (ext_type == SADB_EXT_ADDRESS_SRC || 554 switch (ext_type) {
537 ext_type == SADB_EXT_ADDRESS_DST || 555 case SADB_EXT_ADDRESS_SRC:
538 ext_type == SADB_EXT_ADDRESS_PROXY || 556 case SADB_EXT_ADDRESS_DST:
539 ext_type == SADB_X_EXT_NAT_T_OA) { 557 case SADB_EXT_ADDRESS_PROXY:
558 case SADB_X_EXT_NAT_T_OA:
540 if (verify_address_len(p)) 559 if (verify_address_len(p))
541 return -EINVAL; 560 return -EINVAL;
542 } 561 break;
543 if (ext_type == SADB_X_EXT_SEC_CTX) { 562 case SADB_X_EXT_SEC_CTX:
544 if (verify_sec_ctx_len(p)) 563 if (verify_sec_ctx_len(p))
545 return -EINVAL; 564 return -EINVAL;
565 break;
566 case SADB_EXT_KEY_AUTH:
567 case SADB_EXT_KEY_ENCRYPT:
568 if (verify_key_len(p))
569 return -EINVAL;
570 break;
571 default:
572 break;
546 } 573 }
547 ext_hdrs[ext_type-1] = (void *) p; 574 ext_hdrs[ext_type-1] = (void *) p;
548 } 575 }
@@ -1104,14 +1131,12 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
1104 key = ext_hdrs[SADB_EXT_KEY_AUTH - 1]; 1131 key = ext_hdrs[SADB_EXT_KEY_AUTH - 1];
1105 if (key != NULL && 1132 if (key != NULL &&
1106 sa->sadb_sa_auth != SADB_X_AALG_NULL && 1133 sa->sadb_sa_auth != SADB_X_AALG_NULL &&
1107 ((key->sadb_key_bits+7) / 8 == 0 || 1134 key->sadb_key_bits == 0)
1108 (key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t)))
1109 return ERR_PTR(-EINVAL); 1135 return ERR_PTR(-EINVAL);
1110 key = ext_hdrs[SADB_EXT_KEY_ENCRYPT-1]; 1136 key = ext_hdrs[SADB_EXT_KEY_ENCRYPT-1];
1111 if (key != NULL && 1137 if (key != NULL &&
1112 sa->sadb_sa_encrypt != SADB_EALG_NULL && 1138 sa->sadb_sa_encrypt != SADB_EALG_NULL &&
1113 ((key->sadb_key_bits+7) / 8 == 0 || 1139 key->sadb_key_bits == 0)
1114 (key->sadb_key_bits+7) / 8 > key->sadb_key_len * sizeof(uint64_t)))
1115 return ERR_PTR(-EINVAL); 1140 return ERR_PTR(-EINVAL);
1116 1141
1117 x = xfrm_state_alloc(net); 1142 x = xfrm_state_alloc(net);
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index cb80ebb38311..1beeea9549fa 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -930,6 +930,9 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
930 if (size > llc->dev->mtu) 930 if (size > llc->dev->mtu)
931 size = llc->dev->mtu; 931 size = llc->dev->mtu;
932 copied = size - hdrlen; 932 copied = size - hdrlen;
933 rc = -EINVAL;
934 if (copied < 0)
935 goto release;
933 release_sock(sk); 936 release_sock(sk);
934 skb = sock_alloc_send_skb(sk, size, noblock, &rc); 937 skb = sock_alloc_send_skb(sk, size, noblock, &rc);
935 lock_sock(sk); 938 lock_sock(sk);
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 595c662a61e8..ac4295296514 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -8,6 +8,7 @@
8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net> 8 * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
9 * Copyright 2007-2010, Intel Corporation 9 * Copyright 2007-2010, Intel Corporation
10 * Copyright(c) 2015-2017 Intel Deutschland GmbH 10 * Copyright(c) 2015-2017 Intel Deutschland GmbH
11 * Copyright (C) 2018 Intel Corporation
11 * 12 *
12 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 14 * it under the terms of the GNU General Public License version 2 as
@@ -970,6 +971,9 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
970 971
971 sta->ampdu_mlme.addba_req_num[tid] = 0; 972 sta->ampdu_mlme.addba_req_num[tid] = 0;
972 973
974 tid_tx->timeout =
975 le16_to_cpu(mgmt->u.action.u.addba_resp.timeout);
976
973 if (tid_tx->timeout) { 977 if (tid_tx->timeout) {
974 mod_timer(&tid_tx->session_timer, 978 mod_timer(&tid_tx->session_timer,
975 TU_TO_EXP_TIME(tid_tx->timeout)); 979 TU_TO_EXP_TIME(tid_tx->timeout));
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 69449db7e283..233068756502 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -36,6 +36,7 @@
36#define IEEE80211_AUTH_TIMEOUT (HZ / 5) 36#define IEEE80211_AUTH_TIMEOUT (HZ / 5)
37#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2) 37#define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2)
38#define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) 38#define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10)
39#define IEEE80211_AUTH_TIMEOUT_SAE (HZ * 2)
39#define IEEE80211_AUTH_MAX_TRIES 3 40#define IEEE80211_AUTH_MAX_TRIES 3
40#define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) 41#define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5)
41#define IEEE80211_ASSOC_TIMEOUT (HZ / 5) 42#define IEEE80211_ASSOC_TIMEOUT (HZ / 5)
@@ -1787,7 +1788,7 @@ static bool ieee80211_sta_wmm_params(struct ieee80211_local *local,
1787 params[ac].acm = acm; 1788 params[ac].acm = acm;
1788 params[ac].uapsd = uapsd; 1789 params[ac].uapsd = uapsd;
1789 1790
1790 if (params->cw_min == 0 || 1791 if (params[ac].cw_min == 0 ||
1791 params[ac].cw_min > params[ac].cw_max) { 1792 params[ac].cw_min > params[ac].cw_max) {
1792 sdata_info(sdata, 1793 sdata_info(sdata,
1793 "AP has invalid WMM params (CWmin/max=%d/%d for ACI %d), using defaults\n", 1794 "AP has invalid WMM params (CWmin/max=%d/%d for ACI %d), using defaults\n",
@@ -3814,16 +3815,19 @@ static int ieee80211_auth(struct ieee80211_sub_if_data *sdata)
3814 tx_flags); 3815 tx_flags);
3815 3816
3816 if (tx_flags == 0) { 3817 if (tx_flags == 0) {
3817 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; 3818 if (auth_data->algorithm == WLAN_AUTH_SAE)
3818 auth_data->timeout_started = true; 3819 auth_data->timeout = jiffies +
3819 run_again(sdata, auth_data->timeout); 3820 IEEE80211_AUTH_TIMEOUT_SAE;
3821 else
3822 auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT;
3820 } else { 3823 } else {
3821 auth_data->timeout = 3824 auth_data->timeout =
3822 round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG); 3825 round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG);
3823 auth_data->timeout_started = true;
3824 run_again(sdata, auth_data->timeout);
3825 } 3826 }
3826 3827
3828 auth_data->timeout_started = true;
3829 run_again(sdata, auth_data->timeout);
3830
3827 return 0; 3831 return 0;
3828} 3832}
3829 3833
@@ -3894,8 +3898,15 @@ void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata)
3894 ifmgd->status_received = false; 3898 ifmgd->status_received = false;
3895 if (ifmgd->auth_data && ieee80211_is_auth(fc)) { 3899 if (ifmgd->auth_data && ieee80211_is_auth(fc)) {
3896 if (status_acked) { 3900 if (status_acked) {
3897 ifmgd->auth_data->timeout = 3901 if (ifmgd->auth_data->algorithm ==
3898 jiffies + IEEE80211_AUTH_TIMEOUT_SHORT; 3902 WLAN_AUTH_SAE)
3903 ifmgd->auth_data->timeout =
3904 jiffies +
3905 IEEE80211_AUTH_TIMEOUT_SAE;
3906 else
3907 ifmgd->auth_data->timeout =
3908 jiffies +
3909 IEEE80211_AUTH_TIMEOUT_SHORT;
3899 run_again(sdata, ifmgd->auth_data->timeout); 3910 run_again(sdata, ifmgd->auth_data->timeout);
3900 } else { 3911 } else {
3901 ifmgd->auth_data->timeout = jiffies - 1; 3912 ifmgd->auth_data->timeout = jiffies - 1;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 535de3161a78..05a265cd573d 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4,6 +4,7 @@
4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
6 * Copyright 2013-2014 Intel Mobile Communications GmbH 6 * Copyright 2013-2014 Intel Mobile Communications GmbH
7 * Copyright (C) 2018 Intel Corporation
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -1135,7 +1136,7 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx,
1135 } 1136 }
1136 1137
1137 /* reset session timer */ 1138 /* reset session timer */
1138 if (reset_agg_timer && tid_tx->timeout) 1139 if (reset_agg_timer)
1139 tid_tx->last_tx = jiffies; 1140 tid_tx->last_tx = jiffies;
1140 1141
1141 return queued; 1142 return queued;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 55342c4d5cec..2e2dd88fc79f 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2606,13 +2606,13 @@ static int netlink_seq_show(struct seq_file *seq, void *v)
2606{ 2606{
2607 if (v == SEQ_START_TOKEN) { 2607 if (v == SEQ_START_TOKEN) {
2608 seq_puts(seq, 2608 seq_puts(seq,
2609 "sk Eth Pid Groups " 2609 "sk Eth Pid Groups "
2610 "Rmem Wmem Dump Locks Drops Inode\n"); 2610 "Rmem Wmem Dump Locks Drops Inode\n");
2611 } else { 2611 } else {
2612 struct sock *s = v; 2612 struct sock *s = v;
2613 struct netlink_sock *nlk = nlk_sk(s); 2613 struct netlink_sock *nlk = nlk_sk(s);
2614 2614
2615 seq_printf(seq, "%pK %-3d %-6u %08x %-8d %-8d %d %-8d %-8d %-8lu\n", 2615 seq_printf(seq, "%pK %-3d %-10u %08x %-8d %-8d %-5d %-8d %-8d %-8lu\n",
2616 s, 2616 s,
2617 s->sk_protocol, 2617 s->sk_protocol,
2618 nlk->portid, 2618 nlk->portid,
diff --git a/net/nsh/nsh.c b/net/nsh/nsh.c
index d7da99a0b0b8..9696ef96b719 100644
--- a/net/nsh/nsh.c
+++ b/net/nsh/nsh.c
@@ -57,6 +57,8 @@ int nsh_pop(struct sk_buff *skb)
57 return -ENOMEM; 57 return -ENOMEM;
58 nh = (struct nshhdr *)(skb->data); 58 nh = (struct nshhdr *)(skb->data);
59 length = nsh_hdr_len(nh); 59 length = nsh_hdr_len(nh);
60 if (length < NSH_BASE_HDR_LEN)
61 return -EINVAL;
60 inner_proto = tun_p_to_eth_p(nh->np); 62 inner_proto = tun_p_to_eth_p(nh->np);
61 if (!pskb_may_pull(skb, length)) 63 if (!pskb_may_pull(skb, length))
62 return -ENOMEM; 64 return -ENOMEM;
@@ -90,6 +92,8 @@ static struct sk_buff *nsh_gso_segment(struct sk_buff *skb,
90 if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN))) 92 if (unlikely(!pskb_may_pull(skb, NSH_BASE_HDR_LEN)))
91 goto out; 93 goto out;
92 nsh_len = nsh_hdr_len(nsh_hdr(skb)); 94 nsh_len = nsh_hdr_len(nsh_hdr(skb));
95 if (nsh_len < NSH_BASE_HDR_LEN)
96 goto out;
93 if (unlikely(!pskb_may_pull(skb, nsh_len))) 97 if (unlikely(!pskb_may_pull(skb, nsh_len)))
94 goto out; 98 goto out;
95 99
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 7322aa1e382e..492ab0c36f7c 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -1712,13 +1712,10 @@ static void nlattr_set(struct nlattr *attr, u8 val,
1712 1712
1713 /* The nlattr stream should already have been validated */ 1713 /* The nlattr stream should already have been validated */
1714 nla_for_each_nested(nla, attr, rem) { 1714 nla_for_each_nested(nla, attr, rem) {
1715 if (tbl[nla_type(nla)].len == OVS_ATTR_NESTED) { 1715 if (tbl[nla_type(nla)].len == OVS_ATTR_NESTED)
1716 if (tbl[nla_type(nla)].next) 1716 nlattr_set(nla, val, tbl[nla_type(nla)].next ? : tbl);
1717 tbl = tbl[nla_type(nla)].next; 1717 else
1718 nlattr_set(nla, val, tbl);
1719 } else {
1720 memset(nla_data(nla), val, nla_len(nla)); 1718 memset(nla_data(nla), val, nla_len(nla));
1721 }
1722 1719
1723 if (nla_type(nla) == OVS_KEY_ATTR_CT_STATE) 1720 if (nla_type(nla) == OVS_KEY_ATTR_CT_STATE)
1724 *(u32 *)nla_data(nla) &= CT_SUPPORTED_MASK; 1721 *(u32 *)nla_data(nla) &= CT_SUPPORTED_MASK;
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 41bd496531d4..00192a996be0 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -137,13 +137,18 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
137 137
138 ret = rfkill_register(rfkill->rfkill_dev); 138 ret = rfkill_register(rfkill->rfkill_dev);
139 if (ret < 0) 139 if (ret < 0)
140 return ret; 140 goto err_destroy;
141 141
142 platform_set_drvdata(pdev, rfkill); 142 platform_set_drvdata(pdev, rfkill);
143 143
144 dev_info(&pdev->dev, "%s device registered.\n", rfkill->name); 144 dev_info(&pdev->dev, "%s device registered.\n", rfkill->name);
145 145
146 return 0; 146 return 0;
147
148err_destroy:
149 rfkill_destroy(rfkill->rfkill_dev);
150
151 return ret;
147} 152}
148 153
149static int rfkill_gpio_remove(struct platform_device *pdev) 154static int rfkill_gpio_remove(struct platform_device *pdev)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 9a2c8e7c000e..2b463047dd7b 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -313,7 +313,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
313 memset(&cp, 0, sizeof(cp)); 313 memset(&cp, 0, sizeof(cp));
314 cp.local = rx->local; 314 cp.local = rx->local;
315 cp.key = key; 315 cp.key = key;
316 cp.security_level = 0; 316 cp.security_level = rx->min_sec_level;
317 cp.exclusive = false; 317 cp.exclusive = false;
318 cp.upgrade = upgrade; 318 cp.upgrade = upgrade;
319 cp.service_id = srx->srx_service; 319 cp.service_id = srx->srx_service;
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 90d7079e0aa9..19975d2ca9a2 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -476,6 +476,7 @@ enum rxrpc_call_flag {
476 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */ 476 RXRPC_CALL_SEND_PING, /* A ping will need to be sent */
477 RXRPC_CALL_PINGING, /* Ping in process */ 477 RXRPC_CALL_PINGING, /* Ping in process */
478 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */ 478 RXRPC_CALL_RETRANS_TIMEOUT, /* Retransmission due to timeout occurred */
479 RXRPC_CALL_BEGAN_RX_TIMER, /* We began the expect_rx_by timer */
479}; 480};
480 481
481/* 482/*
diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c
index c717152070df..1350f1be8037 100644
--- a/net/rxrpc/conn_event.c
+++ b/net/rxrpc/conn_event.c
@@ -40,7 +40,7 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
40 } __attribute__((packed)) pkt; 40 } __attribute__((packed)) pkt;
41 struct rxrpc_ackinfo ack_info; 41 struct rxrpc_ackinfo ack_info;
42 size_t len; 42 size_t len;
43 int ioc; 43 int ret, ioc;
44 u32 serial, mtu, call_id, padding; 44 u32 serial, mtu, call_id, padding;
45 45
46 _enter("%d", conn->debug_id); 46 _enter("%d", conn->debug_id);
@@ -135,10 +135,13 @@ static void rxrpc_conn_retransmit_call(struct rxrpc_connection *conn,
135 break; 135 break;
136 } 136 }
137 137
138 kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len); 138 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, ioc, len);
139 conn->params.peer->last_tx_at = ktime_get_real(); 139 conn->params.peer->last_tx_at = ktime_get_real();
140 if (ret < 0)
141 trace_rxrpc_tx_fail(conn->debug_id, serial, ret,
142 rxrpc_tx_fail_call_final_resend);
143
140 _leave(""); 144 _leave("");
141 return;
142} 145}
143 146
144/* 147/*
@@ -236,6 +239,8 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
236 239
237 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); 240 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
238 if (ret < 0) { 241 if (ret < 0) {
242 trace_rxrpc_tx_fail(conn->debug_id, serial, ret,
243 rxrpc_tx_fail_conn_abort);
239 _debug("sendmsg failed: %d", ret); 244 _debug("sendmsg failed: %d", ret);
240 return -EAGAIN; 245 return -EAGAIN;
241 } 246 }
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 0410d2277ca2..b5fd6381313d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -971,7 +971,7 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call,
971 if (timo) { 971 if (timo) {
972 unsigned long now = jiffies, expect_rx_by; 972 unsigned long now = jiffies, expect_rx_by;
973 973
974 expect_rx_by = jiffies + timo; 974 expect_rx_by = now + timo;
975 WRITE_ONCE(call->expect_rx_by, expect_rx_by); 975 WRITE_ONCE(call->expect_rx_by, expect_rx_by);
976 rxrpc_reduce_call_timer(call, expect_rx_by, now, 976 rxrpc_reduce_call_timer(call, expect_rx_by, now,
977 rxrpc_timer_set_for_normal); 977 rxrpc_timer_set_for_normal);
diff --git a/net/rxrpc/local_event.c b/net/rxrpc/local_event.c
index 93b5d910b4a1..8325f1b86840 100644
--- a/net/rxrpc/local_event.c
+++ b/net/rxrpc/local_event.c
@@ -71,7 +71,8 @@ static void rxrpc_send_version_request(struct rxrpc_local *local,
71 71
72 ret = kernel_sendmsg(local->socket, &msg, iov, 2, len); 72 ret = kernel_sendmsg(local->socket, &msg, iov, 2, len);
73 if (ret < 0) 73 if (ret < 0)
74 _debug("sendmsg failed: %d", ret); 74 trace_rxrpc_tx_fail(local->debug_id, 0, ret,
75 rxrpc_tx_fail_version_reply);
75 76
76 _leave(""); 77 _leave("");
77} 78}
diff --git a/net/rxrpc/local_object.c b/net/rxrpc/local_object.c
index 8b54e9531d52..b493e6b62740 100644
--- a/net/rxrpc/local_object.c
+++ b/net/rxrpc/local_object.c
@@ -134,22 +134,49 @@ static int rxrpc_open_socket(struct rxrpc_local *local, struct net *net)
134 } 134 }
135 } 135 }
136 136
137 /* we want to receive ICMP errors */ 137 switch (local->srx.transport.family) {
138 opt = 1; 138 case AF_INET:
139 ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR, 139 /* we want to receive ICMP errors */
140 (char *) &opt, sizeof(opt)); 140 opt = 1;
141 if (ret < 0) { 141 ret = kernel_setsockopt(local->socket, SOL_IP, IP_RECVERR,
142 _debug("setsockopt failed"); 142 (char *) &opt, sizeof(opt));
143 goto error; 143 if (ret < 0) {
144 } 144 _debug("setsockopt failed");
145 goto error;
146 }
145 147
146 /* we want to set the don't fragment bit */ 148 /* we want to set the don't fragment bit */
147 opt = IP_PMTUDISC_DO; 149 opt = IP_PMTUDISC_DO;
148 ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER, 150 ret = kernel_setsockopt(local->socket, SOL_IP, IP_MTU_DISCOVER,
149 (char *) &opt, sizeof(opt)); 151 (char *) &opt, sizeof(opt));
150 if (ret < 0) { 152 if (ret < 0) {
151 _debug("setsockopt failed"); 153 _debug("setsockopt failed");
152 goto error; 154 goto error;
155 }
156 break;
157
158 case AF_INET6:
159 /* we want to receive ICMP errors */
160 opt = 1;
161 ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR,
162 (char *) &opt, sizeof(opt));
163 if (ret < 0) {
164 _debug("setsockopt failed");
165 goto error;
166 }
167
168 /* we want to set the don't fragment bit */
169 opt = IPV6_PMTUDISC_DO;
170 ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER,
171 (char *) &opt, sizeof(opt));
172 if (ret < 0) {
173 _debug("setsockopt failed");
174 goto error;
175 }
176 break;
177
178 default:
179 BUG();
153 } 180 }
154 181
155 /* set the socket up */ 182 /* set the socket up */
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 7f1fc04775b3..f03de1c59ba3 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -210,6 +210,9 @@ int rxrpc_send_ack_packet(struct rxrpc_call *call, bool ping,
210 if (ping) 210 if (ping)
211 call->ping_time = now; 211 call->ping_time = now;
212 conn->params.peer->last_tx_at = ktime_get_real(); 212 conn->params.peer->last_tx_at = ktime_get_real();
213 if (ret < 0)
214 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
215 rxrpc_tx_fail_call_ack);
213 216
214 if (call->state < RXRPC_CALL_COMPLETE) { 217 if (call->state < RXRPC_CALL_COMPLETE) {
215 if (ret < 0) { 218 if (ret < 0) {
@@ -294,6 +297,10 @@ int rxrpc_send_abort_packet(struct rxrpc_call *call)
294 ret = kernel_sendmsg(conn->params.local->socket, 297 ret = kernel_sendmsg(conn->params.local->socket,
295 &msg, iov, 1, sizeof(pkt)); 298 &msg, iov, 1, sizeof(pkt));
296 conn->params.peer->last_tx_at = ktime_get_real(); 299 conn->params.peer->last_tx_at = ktime_get_real();
300 if (ret < 0)
301 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
302 rxrpc_tx_fail_call_abort);
303
297 304
298 rxrpc_put_connection(conn); 305 rxrpc_put_connection(conn);
299 return ret; 306 return ret;
@@ -387,6 +394,9 @@ int rxrpc_send_data_packet(struct rxrpc_call *call, struct sk_buff *skb,
387 conn->params.peer->last_tx_at = ktime_get_real(); 394 conn->params.peer->last_tx_at = ktime_get_real();
388 395
389 up_read(&conn->params.local->defrag_sem); 396 up_read(&conn->params.local->defrag_sem);
397 if (ret < 0)
398 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
399 rxrpc_tx_fail_call_data_nofrag);
390 if (ret == -EMSGSIZE) 400 if (ret == -EMSGSIZE)
391 goto send_fragmentable; 401 goto send_fragmentable;
392 402
@@ -414,6 +424,17 @@ done:
414 rxrpc_timer_set_for_lost_ack); 424 rxrpc_timer_set_for_lost_ack);
415 } 425 }
416 } 426 }
427
428 if (sp->hdr.seq == 1 &&
429 !test_and_set_bit(RXRPC_CALL_BEGAN_RX_TIMER,
430 &call->flags)) {
431 unsigned long nowj = jiffies, expect_rx_by;
432
433 expect_rx_by = nowj + call->next_rx_timo;
434 WRITE_ONCE(call->expect_rx_by, expect_rx_by);
435 rxrpc_reduce_call_timer(call, expect_rx_by, nowj,
436 rxrpc_timer_set_for_normal);
437 }
417 } 438 }
418 439
419 rxrpc_set_keepalive(call); 440 rxrpc_set_keepalive(call);
@@ -465,6 +486,10 @@ send_fragmentable:
465#endif 486#endif
466 } 487 }
467 488
489 if (ret < 0)
490 trace_rxrpc_tx_fail(call->debug_id, serial, ret,
491 rxrpc_tx_fail_call_data_frag);
492
468 up_write(&conn->params.local->defrag_sem); 493 up_write(&conn->params.local->defrag_sem);
469 goto done; 494 goto done;
470} 495}
@@ -482,6 +507,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local)
482 struct kvec iov[2]; 507 struct kvec iov[2];
483 size_t size; 508 size_t size;
484 __be32 code; 509 __be32 code;
510 int ret;
485 511
486 _enter("%d", local->debug_id); 512 _enter("%d", local->debug_id);
487 513
@@ -516,7 +542,10 @@ void rxrpc_reject_packets(struct rxrpc_local *local)
516 whdr.flags ^= RXRPC_CLIENT_INITIATED; 542 whdr.flags ^= RXRPC_CLIENT_INITIATED;
517 whdr.flags &= RXRPC_CLIENT_INITIATED; 543 whdr.flags &= RXRPC_CLIENT_INITIATED;
518 544
519 kernel_sendmsg(local->socket, &msg, iov, 2, size); 545 ret = kernel_sendmsg(local->socket, &msg, iov, 2, size);
546 if (ret < 0)
547 trace_rxrpc_tx_fail(local->debug_id, 0, ret,
548 rxrpc_tx_fail_reject);
520 } 549 }
521 550
522 rxrpc_free_skb(skb, rxrpc_skb_rx_freed); 551 rxrpc_free_skb(skb, rxrpc_skb_rx_freed);
@@ -567,7 +596,8 @@ void rxrpc_send_keepalive(struct rxrpc_peer *peer)
567 596
568 ret = kernel_sendmsg(peer->local->socket, &msg, iov, 2, len); 597 ret = kernel_sendmsg(peer->local->socket, &msg, iov, 2, len);
569 if (ret < 0) 598 if (ret < 0)
570 _debug("sendmsg failed: %d", ret); 599 trace_rxrpc_tx_fail(peer->debug_id, 0, ret,
600 rxrpc_tx_fail_version_keepalive);
571 601
572 peer->last_tx_at = ktime_get_real(); 602 peer->last_tx_at = ktime_get_real();
573 _leave(""); 603 _leave("");
diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c
index 78c2f95d1f22..0ed8b651cec2 100644
--- a/net/rxrpc/peer_event.c
+++ b/net/rxrpc/peer_event.c
@@ -28,39 +28,39 @@ static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *);
28 * Find the peer associated with an ICMP packet. 28 * Find the peer associated with an ICMP packet.
29 */ 29 */
30static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local, 30static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local,
31 const struct sk_buff *skb) 31 const struct sk_buff *skb,
32 struct sockaddr_rxrpc *srx)
32{ 33{
33 struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); 34 struct sock_exterr_skb *serr = SKB_EXT_ERR(skb);
34 struct sockaddr_rxrpc srx;
35 35
36 _enter(""); 36 _enter("");
37 37
38 memset(&srx, 0, sizeof(srx)); 38 memset(srx, 0, sizeof(*srx));
39 srx.transport_type = local->srx.transport_type; 39 srx->transport_type = local->srx.transport_type;
40 srx.transport_len = local->srx.transport_len; 40 srx->transport_len = local->srx.transport_len;
41 srx.transport.family = local->srx.transport.family; 41 srx->transport.family = local->srx.transport.family;
42 42
43 /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice 43 /* Can we see an ICMP4 packet on an ICMP6 listening socket? and vice
44 * versa? 44 * versa?
45 */ 45 */
46 switch (srx.transport.family) { 46 switch (srx->transport.family) {
47 case AF_INET: 47 case AF_INET:
48 srx.transport.sin.sin_port = serr->port; 48 srx->transport.sin.sin_port = serr->port;
49 switch (serr->ee.ee_origin) { 49 switch (serr->ee.ee_origin) {
50 case SO_EE_ORIGIN_ICMP: 50 case SO_EE_ORIGIN_ICMP:
51 _net("Rx ICMP"); 51 _net("Rx ICMP");
52 memcpy(&srx.transport.sin.sin_addr, 52 memcpy(&srx->transport.sin.sin_addr,
53 skb_network_header(skb) + serr->addr_offset, 53 skb_network_header(skb) + serr->addr_offset,
54 sizeof(struct in_addr)); 54 sizeof(struct in_addr));
55 break; 55 break;
56 case SO_EE_ORIGIN_ICMP6: 56 case SO_EE_ORIGIN_ICMP6:
57 _net("Rx ICMP6 on v4 sock"); 57 _net("Rx ICMP6 on v4 sock");
58 memcpy(&srx.transport.sin.sin_addr, 58 memcpy(&srx->transport.sin.sin_addr,
59 skb_network_header(skb) + serr->addr_offset + 12, 59 skb_network_header(skb) + serr->addr_offset + 12,
60 sizeof(struct in_addr)); 60 sizeof(struct in_addr));
61 break; 61 break;
62 default: 62 default:
63 memcpy(&srx.transport.sin.sin_addr, &ip_hdr(skb)->saddr, 63 memcpy(&srx->transport.sin.sin_addr, &ip_hdr(skb)->saddr,
64 sizeof(struct in_addr)); 64 sizeof(struct in_addr));
65 break; 65 break;
66 } 66 }
@@ -68,25 +68,25 @@ static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local,
68 68
69#ifdef CONFIG_AF_RXRPC_IPV6 69#ifdef CONFIG_AF_RXRPC_IPV6
70 case AF_INET6: 70 case AF_INET6:
71 srx.transport.sin6.sin6_port = serr->port; 71 srx->transport.sin6.sin6_port = serr->port;
72 switch (serr->ee.ee_origin) { 72 switch (serr->ee.ee_origin) {
73 case SO_EE_ORIGIN_ICMP6: 73 case SO_EE_ORIGIN_ICMP6:
74 _net("Rx ICMP6"); 74 _net("Rx ICMP6");
75 memcpy(&srx.transport.sin6.sin6_addr, 75 memcpy(&srx->transport.sin6.sin6_addr,
76 skb_network_header(skb) + serr->addr_offset, 76 skb_network_header(skb) + serr->addr_offset,
77 sizeof(struct in6_addr)); 77 sizeof(struct in6_addr));
78 break; 78 break;
79 case SO_EE_ORIGIN_ICMP: 79 case SO_EE_ORIGIN_ICMP:
80 _net("Rx ICMP on v6 sock"); 80 _net("Rx ICMP on v6 sock");
81 srx.transport.sin6.sin6_addr.s6_addr32[0] = 0; 81 srx->transport.sin6.sin6_addr.s6_addr32[0] = 0;
82 srx.transport.sin6.sin6_addr.s6_addr32[1] = 0; 82 srx->transport.sin6.sin6_addr.s6_addr32[1] = 0;
83 srx.transport.sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); 83 srx->transport.sin6.sin6_addr.s6_addr32[2] = htonl(0xffff);
84 memcpy(srx.transport.sin6.sin6_addr.s6_addr + 12, 84 memcpy(srx->transport.sin6.sin6_addr.s6_addr + 12,
85 skb_network_header(skb) + serr->addr_offset, 85 skb_network_header(skb) + serr->addr_offset,
86 sizeof(struct in_addr)); 86 sizeof(struct in_addr));
87 break; 87 break;
88 default: 88 default:
89 memcpy(&srx.transport.sin6.sin6_addr, 89 memcpy(&srx->transport.sin6.sin6_addr,
90 &ipv6_hdr(skb)->saddr, 90 &ipv6_hdr(skb)->saddr,
91 sizeof(struct in6_addr)); 91 sizeof(struct in6_addr));
92 break; 92 break;
@@ -98,7 +98,7 @@ static struct rxrpc_peer *rxrpc_lookup_peer_icmp_rcu(struct rxrpc_local *local,
98 BUG(); 98 BUG();
99 } 99 }
100 100
101 return rxrpc_lookup_peer_rcu(local, &srx); 101 return rxrpc_lookup_peer_rcu(local, srx);
102} 102}
103 103
104/* 104/*
@@ -146,6 +146,7 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, struct sock_exterr_skb *se
146void rxrpc_error_report(struct sock *sk) 146void rxrpc_error_report(struct sock *sk)
147{ 147{
148 struct sock_exterr_skb *serr; 148 struct sock_exterr_skb *serr;
149 struct sockaddr_rxrpc srx;
149 struct rxrpc_local *local = sk->sk_user_data; 150 struct rxrpc_local *local = sk->sk_user_data;
150 struct rxrpc_peer *peer; 151 struct rxrpc_peer *peer;
151 struct sk_buff *skb; 152 struct sk_buff *skb;
@@ -166,7 +167,7 @@ void rxrpc_error_report(struct sock *sk)
166 } 167 }
167 168
168 rcu_read_lock(); 169 rcu_read_lock();
169 peer = rxrpc_lookup_peer_icmp_rcu(local, skb); 170 peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx);
170 if (peer && !rxrpc_get_peer_maybe(peer)) 171 if (peer && !rxrpc_get_peer_maybe(peer))
171 peer = NULL; 172 peer = NULL;
172 if (!peer) { 173 if (!peer) {
@@ -176,6 +177,8 @@ void rxrpc_error_report(struct sock *sk)
176 return; 177 return;
177 } 178 }
178 179
180 trace_rxrpc_rx_icmp(peer, &serr->ee, &srx);
181
179 if ((serr->ee.ee_origin == SO_EE_ORIGIN_ICMP && 182 if ((serr->ee.ee_origin == SO_EE_ORIGIN_ICMP &&
180 serr->ee.ee_type == ICMP_DEST_UNREACH && 183 serr->ee.ee_type == ICMP_DEST_UNREACH &&
181 serr->ee.ee_code == ICMP_FRAG_NEEDED)) { 184 serr->ee.ee_code == ICMP_FRAG_NEEDED)) {
@@ -209,9 +212,6 @@ static void rxrpc_store_error(struct rxrpc_peer *peer,
209 212
210 ee = &serr->ee; 213 ee = &serr->ee;
211 214
212 _net("Rx Error o=%d t=%d c=%d e=%d",
213 ee->ee_origin, ee->ee_type, ee->ee_code, ee->ee_errno);
214
215 err = ee->ee_errno; 215 err = ee->ee_errno;
216 216
217 switch (ee->ee_origin) { 217 switch (ee->ee_origin) {
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index 588fea0dd362..6c0ae27fff84 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -664,7 +664,8 @@ static int rxkad_issue_challenge(struct rxrpc_connection *conn)
664 664
665 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); 665 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len);
666 if (ret < 0) { 666 if (ret < 0) {
667 _debug("sendmsg failed: %d", ret); 667 trace_rxrpc_tx_fail(conn->debug_id, serial, ret,
668 rxrpc_tx_fail_conn_challenge);
668 return -EAGAIN; 669 return -EAGAIN;
669 } 670 }
670 671
@@ -719,7 +720,8 @@ static int rxkad_send_response(struct rxrpc_connection *conn,
719 720
720 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 3, len); 721 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 3, len);
721 if (ret < 0) { 722 if (ret < 0) {
722 _debug("sendmsg failed: %d", ret); 723 trace_rxrpc_tx_fail(conn->debug_id, serial, ret,
724 rxrpc_tx_fail_conn_response);
723 return -EAGAIN; 725 return -EAGAIN;
724 } 726 }
725 727
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 206e802ccbdc..be01f9c5d963 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -223,6 +223,15 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
223 223
224 ret = rxrpc_send_data_packet(call, skb, false); 224 ret = rxrpc_send_data_packet(call, skb, false);
225 if (ret < 0) { 225 if (ret < 0) {
226 switch (ret) {
227 case -ENETUNREACH:
228 case -EHOSTUNREACH:
229 case -ECONNREFUSED:
230 rxrpc_set_call_completion(call,
231 RXRPC_CALL_LOCAL_ERROR,
232 0, ret);
233 goto out;
234 }
226 _debug("need instant resend %d", ret); 235 _debug("need instant resend %d", ret);
227 rxrpc_instant_resend(call, ix); 236 rxrpc_instant_resend(call, ix);
228 } else { 237 } else {
@@ -241,6 +250,7 @@ static void rxrpc_queue_packet(struct rxrpc_sock *rx, struct rxrpc_call *call,
241 rxrpc_timer_set_for_send); 250 rxrpc_timer_set_for_send);
242 } 251 }
243 252
253out:
244 rxrpc_free_skb(skb, rxrpc_skb_tx_freed); 254 rxrpc_free_skb(skb, rxrpc_skb_tx_freed);
245 _leave(""); 255 _leave("");
246} 256}
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index ddf69fc01bdf..6138d1d71900 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -121,7 +121,8 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
121 return 0; 121 return 0;
122 122
123 if (!flags) { 123 if (!flags) {
124 tcf_idr_release(*a, bind); 124 if (exists)
125 tcf_idr_release(*a, bind);
125 return -EINVAL; 126 return -EINVAL;
126 } 127 }
127 128
diff --git a/net/sched/act_skbmod.c b/net/sched/act_skbmod.c
index bbcbdce732cc..ad050d7d4b46 100644
--- a/net/sched/act_skbmod.c
+++ b/net/sched/act_skbmod.c
@@ -131,8 +131,11 @@ static int tcf_skbmod_init(struct net *net, struct nlattr *nla,
131 if (exists && bind) 131 if (exists && bind)
132 return 0; 132 return 0;
133 133
134 if (!lflags) 134 if (!lflags) {
135 if (exists)
136 tcf_idr_release(*a, bind);
135 return -EINVAL; 137 return -EINVAL;
138 }
136 139
137 if (!exists) { 140 if (!exists) {
138 ret = tcf_idr_create(tn, parm->index, est, a, 141 ret = tcf_idr_create(tn, parm->index, est, a,
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index b66754f52a9f..963e4bf0aab8 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -152,8 +152,8 @@ static struct tcf_proto *tcf_proto_create(const char *kind, u32 protocol,
152 NL_SET_ERR_MSG(extack, "TC classifier not found"); 152 NL_SET_ERR_MSG(extack, "TC classifier not found");
153 err = -ENOENT; 153 err = -ENOENT;
154 } 154 }
155 goto errout;
156#endif 155#endif
156 goto errout;
157 } 157 }
158 tp->classify = tp->ops->classify; 158 tp->classify = tp->ops->classify;
159 tp->protocol = protocol; 159 tp->protocol = protocol;
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 039fdb862b17..5d5a16204d50 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -986,8 +986,9 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
986 struct sctp_endpoint *ep; 986 struct sctp_endpoint *ep;
987 struct sctp_chunk *chunk; 987 struct sctp_chunk *chunk;
988 struct sctp_inq *inqueue; 988 struct sctp_inq *inqueue;
989 int state; 989 int first_time = 1; /* is this the first time through the loop */
990 int error = 0; 990 int error = 0;
991 int state;
991 992
992 /* The association should be held so we should be safe. */ 993 /* The association should be held so we should be safe. */
993 ep = asoc->ep; 994 ep = asoc->ep;
@@ -998,6 +999,30 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
998 state = asoc->state; 999 state = asoc->state;
999 subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type); 1000 subtype = SCTP_ST_CHUNK(chunk->chunk_hdr->type);
1000 1001
1002 /* If the first chunk in the packet is AUTH, do special
1003 * processing specified in Section 6.3 of SCTP-AUTH spec
1004 */
1005 if (first_time && subtype.chunk == SCTP_CID_AUTH) {
1006 struct sctp_chunkhdr *next_hdr;
1007
1008 next_hdr = sctp_inq_peek(inqueue);
1009 if (!next_hdr)
1010 goto normal;
1011
1012 /* If the next chunk is COOKIE-ECHO, skip the AUTH
1013 * chunk while saving a pointer to it so we can do
1014 * Authentication later (during cookie-echo
1015 * processing).
1016 */
1017 if (next_hdr->type == SCTP_CID_COOKIE_ECHO) {
1018 chunk->auth_chunk = skb_clone(chunk->skb,
1019 GFP_ATOMIC);
1020 chunk->auth = 1;
1021 continue;
1022 }
1023 }
1024
1025normal:
1001 /* SCTP-AUTH, Section 6.3: 1026 /* SCTP-AUTH, Section 6.3:
1002 * The receiver has a list of chunk types which it expects 1027 * The receiver has a list of chunk types which it expects
1003 * to be received only after an AUTH-chunk. This list has 1028 * to be received only after an AUTH-chunk. This list has
@@ -1036,6 +1061,9 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
1036 /* If there is an error on chunk, discard this packet. */ 1061 /* If there is an error on chunk, discard this packet. */
1037 if (error && chunk) 1062 if (error && chunk)
1038 chunk->pdiscard = 1; 1063 chunk->pdiscard = 1;
1064
1065 if (first_time)
1066 first_time = 0;
1039 } 1067 }
1040 sctp_association_put(asoc); 1068 sctp_association_put(asoc);
1041} 1069}
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 4d7b3ccea078..4a4fd1971255 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1131,7 +1131,7 @@ struct sctp_chunk *sctp_make_violation_max_retrans(
1131 const struct sctp_association *asoc, 1131 const struct sctp_association *asoc,
1132 const struct sctp_chunk *chunk) 1132 const struct sctp_chunk *chunk)
1133{ 1133{
1134 static const char error[] = "Association exceeded its max_retans count"; 1134 static const char error[] = "Association exceeded its max_retrans count";
1135 size_t payload_len = sizeof(error) + sizeof(struct sctp_errhdr); 1135 size_t payload_len = sizeof(error) + sizeof(struct sctp_errhdr);
1136 struct sctp_chunk *retval; 1136 struct sctp_chunk *retval;
1137 1137
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 28c070e187c2..c9ae3404b1bb 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -153,10 +153,7 @@ static enum sctp_disposition sctp_sf_violation_chunk(
153 struct sctp_cmd_seq *commands); 153 struct sctp_cmd_seq *commands);
154 154
155static enum sctp_ierror sctp_sf_authenticate( 155static enum sctp_ierror sctp_sf_authenticate(
156 struct net *net,
157 const struct sctp_endpoint *ep,
158 const struct sctp_association *asoc, 156 const struct sctp_association *asoc,
159 const union sctp_subtype type,
160 struct sctp_chunk *chunk); 157 struct sctp_chunk *chunk);
161 158
162static enum sctp_disposition __sctp_sf_do_9_1_abort( 159static enum sctp_disposition __sctp_sf_do_9_1_abort(
@@ -626,6 +623,38 @@ enum sctp_disposition sctp_sf_do_5_1C_ack(struct net *net,
626 return SCTP_DISPOSITION_CONSUME; 623 return SCTP_DISPOSITION_CONSUME;
627} 624}
628 625
626static bool sctp_auth_chunk_verify(struct net *net, struct sctp_chunk *chunk,
627 const struct sctp_association *asoc)
628{
629 struct sctp_chunk auth;
630
631 if (!chunk->auth_chunk)
632 return true;
633
634 /* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo
635 * is supposed to be authenticated and we have to do delayed
636 * authentication. We've just recreated the association using
637 * the information in the cookie and now it's much easier to
638 * do the authentication.
639 */
640
641 /* Make sure that we and the peer are AUTH capable */
642 if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
643 return false;
644
645 /* set-up our fake chunk so that we can process it */
646 auth.skb = chunk->auth_chunk;
647 auth.asoc = chunk->asoc;
648 auth.sctp_hdr = chunk->sctp_hdr;
649 auth.chunk_hdr = (struct sctp_chunkhdr *)
650 skb_push(chunk->auth_chunk,
651 sizeof(struct sctp_chunkhdr));
652 skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr));
653 auth.transport = chunk->transport;
654
655 return sctp_sf_authenticate(asoc, &auth) == SCTP_IERROR_NO_ERROR;
656}
657
629/* 658/*
630 * Respond to a normal COOKIE ECHO chunk. 659 * Respond to a normal COOKIE ECHO chunk.
631 * We are the side that is being asked for an association. 660 * We are the side that is being asked for an association.
@@ -763,37 +792,9 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
763 if (error) 792 if (error)
764 goto nomem_init; 793 goto nomem_init;
765 794
766 /* SCTP-AUTH: auth_chunk pointer is only set when the cookie-echo 795 if (!sctp_auth_chunk_verify(net, chunk, new_asoc)) {
767 * is supposed to be authenticated and we have to do delayed 796 sctp_association_free(new_asoc);
768 * authentication. We've just recreated the association using 797 return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
769 * the information in the cookie and now it's much easier to
770 * do the authentication.
771 */
772 if (chunk->auth_chunk) {
773 struct sctp_chunk auth;
774 enum sctp_ierror ret;
775
776 /* Make sure that we and the peer are AUTH capable */
777 if (!net->sctp.auth_enable || !new_asoc->peer.auth_capable) {
778 sctp_association_free(new_asoc);
779 return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
780 }
781
782 /* set-up our fake chunk so that we can process it */
783 auth.skb = chunk->auth_chunk;
784 auth.asoc = chunk->asoc;
785 auth.sctp_hdr = chunk->sctp_hdr;
786 auth.chunk_hdr = (struct sctp_chunkhdr *)
787 skb_push(chunk->auth_chunk,
788 sizeof(struct sctp_chunkhdr));
789 skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr));
790 auth.transport = chunk->transport;
791
792 ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth);
793 if (ret != SCTP_IERROR_NO_ERROR) {
794 sctp_association_free(new_asoc);
795 return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
796 }
797 } 798 }
798 799
799 repl = sctp_make_cookie_ack(new_asoc, chunk); 800 repl = sctp_make_cookie_ack(new_asoc, chunk);
@@ -1797,13 +1798,15 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
1797 if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC)) 1798 if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
1798 goto nomem; 1799 goto nomem;
1799 1800
1801 if (!sctp_auth_chunk_verify(net, chunk, new_asoc))
1802 return SCTP_DISPOSITION_DISCARD;
1803
1800 /* Make sure no new addresses are being added during the 1804 /* Make sure no new addresses are being added during the
1801 * restart. Though this is a pretty complicated attack 1805 * restart. Though this is a pretty complicated attack
1802 * since you'd have to get inside the cookie. 1806 * since you'd have to get inside the cookie.
1803 */ 1807 */
1804 if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands)) { 1808 if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands))
1805 return SCTP_DISPOSITION_CONSUME; 1809 return SCTP_DISPOSITION_CONSUME;
1806 }
1807 1810
1808 /* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes 1811 /* If the endpoint is in the SHUTDOWN-ACK-SENT state and recognizes
1809 * the peer has restarted (Action A), it MUST NOT setup a new 1812 * the peer has restarted (Action A), it MUST NOT setup a new
@@ -1912,6 +1915,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
1912 if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC)) 1915 if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
1913 goto nomem; 1916 goto nomem;
1914 1917
1918 if (!sctp_auth_chunk_verify(net, chunk, new_asoc))
1919 return SCTP_DISPOSITION_DISCARD;
1920
1915 /* Update the content of current association. */ 1921 /* Update the content of current association. */
1916 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); 1922 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
1917 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 1923 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
@@ -2009,6 +2015,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_d(
2009 * a COOKIE ACK. 2015 * a COOKIE ACK.
2010 */ 2016 */
2011 2017
2018 if (!sctp_auth_chunk_verify(net, chunk, asoc))
2019 return SCTP_DISPOSITION_DISCARD;
2020
2012 /* Don't accidentally move back into established state. */ 2021 /* Don't accidentally move back into established state. */
2013 if (asoc->state < SCTP_STATE_ESTABLISHED) { 2022 if (asoc->state < SCTP_STATE_ESTABLISHED) {
2014 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, 2023 sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
@@ -4171,10 +4180,7 @@ gen_shutdown:
4171 * The return value is the disposition of the chunk. 4180 * The return value is the disposition of the chunk.
4172 */ 4181 */
4173static enum sctp_ierror sctp_sf_authenticate( 4182static enum sctp_ierror sctp_sf_authenticate(
4174 struct net *net,
4175 const struct sctp_endpoint *ep,
4176 const struct sctp_association *asoc, 4183 const struct sctp_association *asoc,
4177 const union sctp_subtype type,
4178 struct sctp_chunk *chunk) 4184 struct sctp_chunk *chunk)
4179{ 4185{
4180 struct sctp_shared_key *sh_key = NULL; 4186 struct sctp_shared_key *sh_key = NULL;
@@ -4275,7 +4281,7 @@ enum sctp_disposition sctp_sf_eat_auth(struct net *net,
4275 commands); 4281 commands);
4276 4282
4277 auth_hdr = (struct sctp_authhdr *)chunk->skb->data; 4283 auth_hdr = (struct sctp_authhdr *)chunk->skb->data;
4278 error = sctp_sf_authenticate(net, ep, asoc, type, chunk); 4284 error = sctp_sf_authenticate(asoc, chunk);
4279 switch (error) { 4285 switch (error) {
4280 case SCTP_IERROR_AUTH_BAD_HMAC: 4286 case SCTP_IERROR_AUTH_BAD_HMAC:
4281 /* Generate the ERROR chunk and discard the rest 4287 /* Generate the ERROR chunk and discard the rest
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 84207ad33e8e..8cb7d9858270 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -715,7 +715,6 @@ struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
715 return event; 715 return event;
716 716
717fail_mark: 717fail_mark:
718 sctp_chunk_put(chunk);
719 kfree_skb(skb); 718 kfree_skb(skb);
720fail: 719fail:
721 return NULL; 720 return NULL;
diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c
index 5cc68a824f45..f2f63959fddd 100644
--- a/net/sunrpc/xprtrdma/fmr_ops.c
+++ b/net/sunrpc/xprtrdma/fmr_ops.c
@@ -72,6 +72,7 @@ fmr_op_init_mr(struct rpcrdma_ia *ia, struct rpcrdma_mr *mr)
72 if (IS_ERR(mr->fmr.fm_mr)) 72 if (IS_ERR(mr->fmr.fm_mr))
73 goto out_fmr_err; 73 goto out_fmr_err;
74 74
75 INIT_LIST_HEAD(&mr->mr_list);
75 return 0; 76 return 0;
76 77
77out_fmr_err: 78out_fmr_err:
@@ -102,10 +103,6 @@ fmr_op_release_mr(struct rpcrdma_mr *mr)
102 LIST_HEAD(unmap_list); 103 LIST_HEAD(unmap_list);
103 int rc; 104 int rc;
104 105
105 /* Ensure MW is not on any rl_registered list */
106 if (!list_empty(&mr->mr_list))
107 list_del(&mr->mr_list);
108
109 kfree(mr->fmr.fm_physaddrs); 106 kfree(mr->fmr.fm_physaddrs);
110 kfree(mr->mr_sg); 107 kfree(mr->mr_sg);
111 108
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index c5743a0960be..c59c5c788db0 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -110,6 +110,7 @@ frwr_op_init_mr(struct rpcrdma_ia *ia, struct rpcrdma_mr *mr)
110 if (!mr->mr_sg) 110 if (!mr->mr_sg)
111 goto out_list_err; 111 goto out_list_err;
112 112
113 INIT_LIST_HEAD(&mr->mr_list);
113 sg_init_table(mr->mr_sg, depth); 114 sg_init_table(mr->mr_sg, depth);
114 init_completion(&frwr->fr_linv_done); 115 init_completion(&frwr->fr_linv_done);
115 return 0; 116 return 0;
@@ -133,10 +134,6 @@ frwr_op_release_mr(struct rpcrdma_mr *mr)
133{ 134{
134 int rc; 135 int rc;
135 136
136 /* Ensure MR is not on any rl_registered list */
137 if (!list_empty(&mr->mr_list))
138 list_del(&mr->mr_list);
139
140 rc = ib_dereg_mr(mr->frwr.fr_mr); 137 rc = ib_dereg_mr(mr->frwr.fr_mr);
141 if (rc) 138 if (rc)
142 pr_err("rpcrdma: final ib_dereg_mr for %p returned %i\n", 139 pr_err("rpcrdma: final ib_dereg_mr for %p returned %i\n",
@@ -195,7 +192,7 @@ frwr_op_recover_mr(struct rpcrdma_mr *mr)
195 return; 192 return;
196 193
197out_release: 194out_release:
198 pr_err("rpcrdma: FRWR reset failed %d, %p release\n", rc, mr); 195 pr_err("rpcrdma: FRWR reset failed %d, %p released\n", rc, mr);
199 r_xprt->rx_stats.mrs_orphaned++; 196 r_xprt->rx_stats.mrs_orphaned++;
200 197
201 spin_lock(&r_xprt->rx_buf.rb_mrlock); 198 spin_lock(&r_xprt->rx_buf.rb_mrlock);
@@ -476,7 +473,7 @@ frwr_op_reminv(struct rpcrdma_rep *rep, struct list_head *mrs)
476 473
477 list_for_each_entry(mr, mrs, mr_list) 474 list_for_each_entry(mr, mrs, mr_list)
478 if (mr->mr_handle == rep->rr_inv_rkey) { 475 if (mr->mr_handle == rep->rr_inv_rkey) {
479 list_del(&mr->mr_list); 476 list_del_init(&mr->mr_list);
480 trace_xprtrdma_remoteinv(mr); 477 trace_xprtrdma_remoteinv(mr);
481 mr->frwr.fr_state = FRWR_IS_INVALID; 478 mr->frwr.fr_state = FRWR_IS_INVALID;
482 rpcrdma_mr_unmap_and_put(mr); 479 rpcrdma_mr_unmap_and_put(mr);
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index fe5eaca2d197..c345d365af88 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1254,6 +1254,11 @@ rpcrdma_mrs_destroy(struct rpcrdma_buffer *buf)
1254 list_del(&mr->mr_all); 1254 list_del(&mr->mr_all);
1255 1255
1256 spin_unlock(&buf->rb_mrlock); 1256 spin_unlock(&buf->rb_mrlock);
1257
1258 /* Ensure MW is not on any rl_registered list */
1259 if (!list_empty(&mr->mr_list))
1260 list_del(&mr->mr_list);
1261
1257 ia->ri_ops->ro_release_mr(mr); 1262 ia->ri_ops->ro_release_mr(mr);
1258 count++; 1263 count++;
1259 spin_lock(&buf->rb_mrlock); 1264 spin_lock(&buf->rb_mrlock);
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index 3d3b423fa9c1..cb41b12a3bf8 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -380,7 +380,7 @@ rpcrdma_mr_pop(struct list_head *list)
380 struct rpcrdma_mr *mr; 380 struct rpcrdma_mr *mr;
381 381
382 mr = list_first_entry(list, struct rpcrdma_mr, mr_list); 382 mr = list_first_entry(list, struct rpcrdma_mr, mr_list);
383 list_del(&mr->mr_list); 383 list_del_init(&mr->mr_list);
384 return mr; 384 return mr;
385} 385}
386 386
diff --git a/net/tipc/node.c b/net/tipc/node.c
index b0b840084f0a..6a44eb812baf 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1977,6 +1977,7 @@ out:
1977int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info) 1977int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)
1978{ 1978{
1979 struct net *net = genl_info_net(info); 1979 struct net *net = genl_info_net(info);
1980 struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];
1980 struct tipc_nl_msg msg; 1981 struct tipc_nl_msg msg;
1981 char *name; 1982 char *name;
1982 int err; 1983 int err;
@@ -1984,9 +1985,19 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)
1984 msg.portid = info->snd_portid; 1985 msg.portid = info->snd_portid;
1985 msg.seq = info->snd_seq; 1986 msg.seq = info->snd_seq;
1986 1987
1987 if (!info->attrs[TIPC_NLA_LINK_NAME]) 1988 if (!info->attrs[TIPC_NLA_LINK])
1988 return -EINVAL; 1989 return -EINVAL;
1989 name = nla_data(info->attrs[TIPC_NLA_LINK_NAME]); 1990
1991 err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX,
1992 info->attrs[TIPC_NLA_LINK],
1993 tipc_nl_link_policy, info->extack);
1994 if (err)
1995 return err;
1996
1997 if (!attrs[TIPC_NLA_LINK_NAME])
1998 return -EINVAL;
1999
2000 name = nla_data(attrs[TIPC_NLA_LINK_NAME]);
1990 2001
1991 msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); 2002 msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
1992 if (!msg.skb) 2003 if (!msg.skb)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index c4992002fd68..930852c54d7a 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1516,10 +1516,10 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb)
1516 1516
1517 srcaddr->sock.family = AF_TIPC; 1517 srcaddr->sock.family = AF_TIPC;
1518 srcaddr->sock.addrtype = TIPC_ADDR_ID; 1518 srcaddr->sock.addrtype = TIPC_ADDR_ID;
1519 srcaddr->sock.scope = 0;
1519 srcaddr->sock.addr.id.ref = msg_origport(hdr); 1520 srcaddr->sock.addr.id.ref = msg_origport(hdr);
1520 srcaddr->sock.addr.id.node = msg_orignode(hdr); 1521 srcaddr->sock.addr.id.node = msg_orignode(hdr);
1521 srcaddr->sock.addr.name.domain = 0; 1522 srcaddr->sock.addr.name.domain = 0;
1522 srcaddr->sock.scope = 0;
1523 m->msg_namelen = sizeof(struct sockaddr_tipc); 1523 m->msg_namelen = sizeof(struct sockaddr_tipc);
1524 1524
1525 if (!msg_in_group(hdr)) 1525 if (!msg_in_group(hdr))
@@ -1528,6 +1528,7 @@ static void tipc_sk_set_orig_addr(struct msghdr *m, struct sk_buff *skb)
1528 /* Group message users may also want to know sending member's id */ 1528 /* Group message users may also want to know sending member's id */
1529 srcaddr->member.family = AF_TIPC; 1529 srcaddr->member.family = AF_TIPC;
1530 srcaddr->member.addrtype = TIPC_ADDR_NAME; 1530 srcaddr->member.addrtype = TIPC_ADDR_NAME;
1531 srcaddr->member.scope = 0;
1531 srcaddr->member.addr.name.name.type = msg_nametype(hdr); 1532 srcaddr->member.addr.name.name.type = msg_nametype(hdr);
1532 srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member; 1533 srcaddr->member.addr.name.name.instance = TIPC_SKB_CB(skb)->orig_member;
1533 srcaddr->member.addr.name.domain = 0; 1534 srcaddr->member.addr.name.domain = 0;
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 4b57ddd72f34..301f22430469 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -135,6 +135,7 @@ retry:
135 offset -= sg->offset; 135 offset -= sg->offset;
136 ctx->partially_sent_offset = offset; 136 ctx->partially_sent_offset = offset;
137 ctx->partially_sent_record = (void *)sg; 137 ctx->partially_sent_record = (void *)sg;
138 ctx->in_tcp_sendpages = false;
138 return ret; 139 return ret;
139 } 140 }
140 141
@@ -248,16 +249,14 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
248 struct tls_context *ctx = tls_get_ctx(sk); 249 struct tls_context *ctx = tls_get_ctx(sk);
249 long timeo = sock_sndtimeo(sk, 0); 250 long timeo = sock_sndtimeo(sk, 0);
250 void (*sk_proto_close)(struct sock *sk, long timeout); 251 void (*sk_proto_close)(struct sock *sk, long timeout);
252 bool free_ctx = false;
251 253
252 lock_sock(sk); 254 lock_sock(sk);
253 sk_proto_close = ctx->sk_proto_close; 255 sk_proto_close = ctx->sk_proto_close;
254 256
255 if (ctx->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) 257 if ((ctx->tx_conf == TLS_HW_RECORD && ctx->rx_conf == TLS_HW_RECORD) ||
256 goto skip_tx_cleanup; 258 (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE)) {
257 259 free_ctx = true;
258 if (ctx->tx_conf == TLS_BASE && ctx->rx_conf == TLS_BASE) {
259 kfree(ctx);
260 ctx = NULL;
261 goto skip_tx_cleanup; 260 goto skip_tx_cleanup;
262 } 261 }
263 262
@@ -305,8 +304,7 @@ skip_tx_cleanup:
305 /* free ctx for TLS_HW_RECORD, used by tcp_set_state 304 /* free ctx for TLS_HW_RECORD, used by tcp_set_state
306 * for sk->sk_prot->unhash [tls_hw_unhash] 305 * for sk->sk_prot->unhash [tls_hw_unhash]
307 */ 306 */
308 if (ctx && ctx->tx_conf == TLS_HW_RECORD && 307 if (free_ctx)
309 ctx->rx_conf == TLS_HW_RECORD)
310 kfree(ctx); 308 kfree(ctx);
311} 309}
312 310
diff --git a/net/wireless/core.c b/net/wireless/core.c
index a6f3cac8c640..c0fd8a85e7f7 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -95,6 +95,9 @@ static int cfg80211_dev_check_name(struct cfg80211_registered_device *rdev,
95 95
96 ASSERT_RTNL(); 96 ASSERT_RTNL();
97 97
98 if (strlen(newname) > NL80211_WIPHY_NAME_MAXLEN)
99 return -EINVAL;
100
98 /* prohibit calling the thing phy%d when %d is not its number */ 101 /* prohibit calling the thing phy%d when %d is not its number */
99 sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); 102 sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken);
100 if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) { 103 if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ff28f8feeb09..a052693c2e85 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9214,6 +9214,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
9214 9214
9215 if (nla_get_flag(info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])) { 9215 if (nla_get_flag(info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])) {
9216 if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) { 9216 if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) {
9217 kzfree(connkeys);
9217 GENL_SET_ERR_MSG(info, 9218 GENL_SET_ERR_MSG(info,
9218 "external auth requires connection ownership"); 9219 "external auth requires connection ownership");
9219 return -EINVAL; 9220 return -EINVAL;
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 16c7e4ef5820..ac3e12c32aa3 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1026,6 +1026,7 @@ static int regdb_query_country(const struct fwdb_header *db,
1026 1026
1027 if (!tmp_rd) { 1027 if (!tmp_rd) {
1028 kfree(regdom); 1028 kfree(regdom);
1029 kfree(wmm_ptrs);
1029 return -ENOMEM; 1030 return -ENOMEM;
1030 } 1031 }
1031 regdom = tmp_rd; 1032 regdom = tmp_rd;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index f595797a20ce..8308281f3253 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2176,6 +2176,12 @@ struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family)
2176 return afinfo; 2176 return afinfo;
2177} 2177}
2178 2178
2179void xfrm_flush_gc(void)
2180{
2181 flush_work(&xfrm_state_gc_work);
2182}
2183EXPORT_SYMBOL(xfrm_flush_gc);
2184
2179/* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */ 2185/* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */
2180void xfrm_state_delete_tunnel(struct xfrm_state *x) 2186void xfrm_state_delete_tunnel(struct xfrm_state *x)
2181{ 2187{
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins
index b2a95af7df18..7f5c86246138 100644
--- a/scripts/Makefile.gcc-plugins
+++ b/scripts/Makefile.gcc-plugins
@@ -14,7 +14,7 @@ ifdef CONFIG_GCC_PLUGINS
14 endif 14 endif
15 15
16 ifdef CONFIG_GCC_PLUGIN_SANCOV 16 ifdef CONFIG_GCC_PLUGIN_SANCOV
17 ifeq ($(CFLAGS_KCOV),) 17 ifeq ($(strip $(CFLAGS_KCOV)),)
18 # It is needed because of the gcc-plugin.sh and gcc version checks. 18 # It is needed because of the gcc-plugin.sh and gcc version checks.
19 gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so 19 gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so
20 20
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 07d07409f16f..5af34a2b0cd9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -196,7 +196,7 @@ $(obj)/%.tab.c: $(src)/%.y FORCE
196 $(call if_changed,bison) 196 $(call if_changed,bison)
197 197
198quiet_cmd_bison_h = YACC $@ 198quiet_cmd_bison_h = YACC $@
199 cmd_bison_h = bison -o/dev/null --defines=$@ -t -l $< 199 cmd_bison_h = $(YACC) -o/dev/null --defines=$@ -t -l $<
200 200
201$(obj)/%.tab.h: $(src)/%.y FORCE 201$(obj)/%.tab.h: $(src)/%.y FORCE
202 $(call if_changed,bison_h) 202 $(call if_changed,bison_h)
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
index c07ba4da9e36..815eaf140ab5 100644
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -787,10 +787,9 @@ static void check_pci_bridge(struct check *c, struct dt_info *dti, struct node *
787 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge"); 787 FAIL(c, dti, node, "incorrect #size-cells for PCI bridge");
788 788
789 prop = get_property(node, "bus-range"); 789 prop = get_property(node, "bus-range");
790 if (!prop) { 790 if (!prop)
791 FAIL(c, dti, node, "missing bus-range for PCI bridge");
792 return; 791 return;
793 } 792
794 if (prop->val.len != (sizeof(cell_t) * 2)) { 793 if (prop->val.len != (sizeof(cell_t) * 2)) {
795 FAIL_PROP(c, dti, node, prop, "value must be 2 cells"); 794 FAIL_PROP(c, dti, node, prop, "value must be 2 cells");
796 return; 795 return;
diff --git a/scripts/extract_xc3028.pl b/scripts/extract_xc3028.pl
index 61d9b256c658..a1c51b7e4baf 100755
--- a/scripts/extract_xc3028.pl
+++ b/scripts/extract_xc3028.pl
@@ -1,6 +1,6 @@
1#!/usr/bin/env perl 1#!/usr/bin/env perl
2 2
3# Copyright (c) Mauro Carvalho Chehab <mchehab@infradead.org> 3# Copyright (c) Mauro Carvalho Chehab <mchehab@kernel.org>
4# Released under GPLv2 4# Released under GPLv2
5# 5#
6# In order to use, you need to: 6# In order to use, you need to:
diff --git a/scripts/genksyms/Makefile b/scripts/genksyms/Makefile
index ef0287e42957..03b7ce97de14 100644
--- a/scripts/genksyms/Makefile
+++ b/scripts/genksyms/Makefile
@@ -14,14 +14,14 @@ genksyms-objs := genksyms.o parse.tab.o lex.lex.o
14# so that 'bison: not found' will be displayed if it is missing. 14# so that 'bison: not found' will be displayed if it is missing.
15ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),) 15ifeq ($(findstring 1,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
16 16
17quiet_cmd_bison_no_warn = $(quet_cmd_bison) 17quiet_cmd_bison_no_warn = $(quiet_cmd_bison)
18 cmd_bison_no_warn = $(YACC) --version >/dev/null; \ 18 cmd_bison_no_warn = $(YACC) --version >/dev/null; \
19 $(cmd_bison) 2>/dev/null 19 $(cmd_bison) 2>/dev/null
20 20
21$(obj)/parse.tab.c: $(src)/parse.y FORCE 21$(obj)/parse.tab.c: $(src)/parse.y FORCE
22 $(call if_changed,bison_no_warn) 22 $(call if_changed,bison_no_warn)
23 23
24quiet_cmd_bison_h_no_warn = $(quet_cmd_bison_h) 24quiet_cmd_bison_h_no_warn = $(quiet_cmd_bison_h)
25 cmd_bison_h_no_warn = $(YACC) --version >/dev/null; \ 25 cmd_bison_h_no_warn = $(YACC) --version >/dev/null; \
26 $(cmd_bison_h) 2>/dev/null 26 $(cmd_bison_h) 2>/dev/null
27 27
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 944418da9fe3..0f6dcb4011a8 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -330,14 +330,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
330 goto out; 330 goto out;
331 } 331 }
332 332
333 /* There will be a line like so: 333 /* Sum all files in the same dir or subdirs. */
334 deps_drivers/net/dummy.o := \
335 drivers/net/dummy.c \
336 $(wildcard include/config/net/fastroute.h) \
337 include/linux/module.h \
338
339 Sum all files in the same dir or subdirs.
340 */
341 while ((line = get_next_line(&pos, file, flen)) != NULL) { 334 while ((line = get_next_line(&pos, file, flen)) != NULL) {
342 char* p = line; 335 char* p = line;
343 336
diff --git a/scripts/split-man.pl b/scripts/split-man.pl
index bfe16cbe42df..c3db607ee9ec 100755
--- a/scripts/split-man.pl
+++ b/scripts/split-man.pl
@@ -1,7 +1,7 @@
1#!/usr/bin/perl 1#!/usr/bin/perl
2# SPDX-License-Identifier: GPL-2.0 2# SPDX-License-Identifier: GPL-2.0
3# 3#
4# Author: Mauro Carvalho Chehab <mchehab@s-opensource.com> 4# Author: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5# 5#
6# Produce manpages from kernel-doc. 6# Produce manpages from kernel-doc.
7# See Documentation/doc-guide/kernel-doc.rst for instructions 7# See Documentation/doc-guide/kernel-doc.rst for instructions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 06d7c40af570..6491afbb5fd5 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -423,6 +423,8 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
423 return -ENOTTY; 423 return -ENOTTY;
424 if (substream->stream != dir) 424 if (substream->stream != dir)
425 return -EINVAL; 425 return -EINVAL;
426 if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
427 return -EBADFD;
426 428
427 if ((ch = substream->runtime->channels) > 128) 429 if ((ch = substream->runtime->channels) > 128)
428 return -EINVAL; 430 return -EINVAL;
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index f48a4cd24ffc..289ae6bb81d9 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -174,12 +174,12 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
174 } 174 }
175 return; 175 return;
176 } 176 }
177 spin_lock_irqsave(&substream->runtime->lock, flags);
177 if (vmidi->event.type != SNDRV_SEQ_EVENT_NONE) { 178 if (vmidi->event.type != SNDRV_SEQ_EVENT_NONE) {
178 if (snd_seq_kernel_client_dispatch(vmidi->client, &vmidi->event, in_atomic(), 0) < 0) 179 if (snd_seq_kernel_client_dispatch(vmidi->client, &vmidi->event, in_atomic(), 0) < 0)
179 return; 180 goto out;
180 vmidi->event.type = SNDRV_SEQ_EVENT_NONE; 181 vmidi->event.type = SNDRV_SEQ_EVENT_NONE;
181 } 182 }
182 spin_lock_irqsave(&substream->runtime->lock, flags);
183 while (1) { 183 while (1) {
184 count = __snd_rawmidi_transmit_peek(substream, buf, sizeof(buf)); 184 count = __snd_rawmidi_transmit_peek(substream, buf, sizeof(buf));
185 if (count <= 0) 185 if (count <= 0)
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 58e349fc893f..eab7f594ebe7 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -831,9 +831,11 @@ static int loopback_rate_shift_get(struct snd_kcontrol *kcontrol,
831{ 831{
832 struct loopback *loopback = snd_kcontrol_chip(kcontrol); 832 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
833 833
834 mutex_lock(&loopback->cable_lock);
834 ucontrol->value.integer.value[0] = 835 ucontrol->value.integer.value[0] =
835 loopback->setup[kcontrol->id.subdevice] 836 loopback->setup[kcontrol->id.subdevice]
836 [kcontrol->id.device].rate_shift; 837 [kcontrol->id.device].rate_shift;
838 mutex_unlock(&loopback->cable_lock);
837 return 0; 839 return 0;
838} 840}
839 841
@@ -865,9 +867,11 @@ static int loopback_notify_get(struct snd_kcontrol *kcontrol,
865{ 867{
866 struct loopback *loopback = snd_kcontrol_chip(kcontrol); 868 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
867 869
870 mutex_lock(&loopback->cable_lock);
868 ucontrol->value.integer.value[0] = 871 ucontrol->value.integer.value[0] =
869 loopback->setup[kcontrol->id.subdevice] 872 loopback->setup[kcontrol->id.subdevice]
870 [kcontrol->id.device].notify; 873 [kcontrol->id.device].notify;
874 mutex_unlock(&loopback->cable_lock);
871 return 0; 875 return 0;
872} 876}
873 877
@@ -879,12 +883,14 @@ static int loopback_notify_put(struct snd_kcontrol *kcontrol,
879 int change = 0; 883 int change = 0;
880 884
881 val = ucontrol->value.integer.value[0] ? 1 : 0; 885 val = ucontrol->value.integer.value[0] ? 1 : 0;
886 mutex_lock(&loopback->cable_lock);
882 if (val != loopback->setup[kcontrol->id.subdevice] 887 if (val != loopback->setup[kcontrol->id.subdevice]
883 [kcontrol->id.device].notify) { 888 [kcontrol->id.device].notify) {
884 loopback->setup[kcontrol->id.subdevice] 889 loopback->setup[kcontrol->id.subdevice]
885 [kcontrol->id.device].notify = val; 890 [kcontrol->id.device].notify = val;
886 change = 1; 891 change = 1;
887 } 892 }
893 mutex_unlock(&loopback->cable_lock);
888 return change; 894 return change;
889} 895}
890 896
@@ -892,15 +898,18 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol,
892 struct snd_ctl_elem_value *ucontrol) 898 struct snd_ctl_elem_value *ucontrol)
893{ 899{
894 struct loopback *loopback = snd_kcontrol_chip(kcontrol); 900 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
895 struct loopback_cable *cable = loopback->cables 901 struct loopback_cable *cable;
896 [kcontrol->id.subdevice][kcontrol->id.device ^ 1]; 902
897 unsigned int val = 0; 903 unsigned int val = 0;
898 904
905 mutex_lock(&loopback->cable_lock);
906 cable = loopback->cables[kcontrol->id.subdevice][kcontrol->id.device ^ 1];
899 if (cable != NULL) { 907 if (cable != NULL) {
900 unsigned int running = cable->running ^ cable->pause; 908 unsigned int running = cable->running ^ cable->pause;
901 909
902 val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0; 910 val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0;
903 } 911 }
912 mutex_unlock(&loopback->cable_lock);
904 ucontrol->value.integer.value[0] = val; 913 ucontrol->value.integer.value[0] = val;
905 return 0; 914 return 0;
906} 915}
@@ -943,9 +952,11 @@ static int loopback_rate_get(struct snd_kcontrol *kcontrol,
943{ 952{
944 struct loopback *loopback = snd_kcontrol_chip(kcontrol); 953 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
945 954
955 mutex_lock(&loopback->cable_lock);
946 ucontrol->value.integer.value[0] = 956 ucontrol->value.integer.value[0] =
947 loopback->setup[kcontrol->id.subdevice] 957 loopback->setup[kcontrol->id.subdevice]
948 [kcontrol->id.device].rate; 958 [kcontrol->id.device].rate;
959 mutex_unlock(&loopback->cable_lock);
949 return 0; 960 return 0;
950} 961}
951 962
@@ -965,9 +976,11 @@ static int loopback_channels_get(struct snd_kcontrol *kcontrol,
965{ 976{
966 struct loopback *loopback = snd_kcontrol_chip(kcontrol); 977 struct loopback *loopback = snd_kcontrol_chip(kcontrol);
967 978
979 mutex_lock(&loopback->cable_lock);
968 ucontrol->value.integer.value[0] = 980 ucontrol->value.integer.value[0] =
969 loopback->setup[kcontrol->id.subdevice] 981 loopback->setup[kcontrol->id.subdevice]
970 [kcontrol->id.device].channels; 982 [kcontrol->id.device].channels;
983 mutex_unlock(&loopback->cable_lock);
971 return 0; 984 return 0;
972} 985}
973 986
diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
index 4a1dc145327b..cb9acfe60f6a 100644
--- a/sound/firewire/amdtp-stream.c
+++ b/sound/firewire/amdtp-stream.c
@@ -773,8 +773,6 @@ static void amdtp_stream_first_callback(struct fw_iso_context *context,
773 u32 cycle; 773 u32 cycle;
774 unsigned int packets; 774 unsigned int packets;
775 775
776 s->max_payload_length = amdtp_stream_get_max_payload(s);
777
778 /* 776 /*
779 * For in-stream, first packet has come. 777 * For in-stream, first packet has come.
780 * For out-stream, prepared to transmit first packet 778 * For out-stream, prepared to transmit first packet
@@ -879,6 +877,9 @@ int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed)
879 877
880 amdtp_stream_update(s); 878 amdtp_stream_update(s);
881 879
880 if (s->direction == AMDTP_IN_STREAM)
881 s->max_payload_length = amdtp_stream_get_max_payload(s);
882
882 if (s->flags & CIP_NO_HEADER) 883 if (s->flags & CIP_NO_HEADER)
883 s->tag = TAG_NO_CIP_HEADER; 884 s->tag = TAG_NO_CIP_HEADER;
884 else 885 else
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8c238e51bb5a..2dd34dd77447 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3832,7 +3832,7 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3832 } 3832 }
3833} 3833}
3834 3834
3835#if IS_REACHABLE(INPUT) 3835#if IS_REACHABLE(CONFIG_INPUT)
3836static void gpio2_mic_hotkey_event(struct hda_codec *codec, 3836static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3837 struct hda_jack_callback *event) 3837 struct hda_jack_callback *event)
3838{ 3838{
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
index 2cccbba64418..f304be71c278 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -56,6 +56,7 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
56# to compile vs uClibc, that can be done here as well. 56# to compile vs uClibc, that can be done here as well.
57CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- 57CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
58CROSS_COMPILE ?= $(CROSS) 58CROSS_COMPILE ?= $(CROSS)
59LD = $(CC)
59HOSTCC = gcc 60HOSTCC = gcc
60 61
61# check if compiler option is supported 62# check if compiler option is supported
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 73af45773938..e60dddbf963c 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -5,9 +5,9 @@ CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
5CFLAGS += -I../../../../usr/include/ 5CFLAGS += -I../../../../usr/include/
6 6
7TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh 7TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh rtnetlink.sh
8TEST_PROGS += fib_tests.sh fib-onlink-tests.sh in_netns.sh pmtu.sh udpgso.sh 8TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh udpgso.sh
9TEST_PROGS += udpgso_bench.sh 9TEST_PROGS += udpgso_bench.sh
10TEST_GEN_PROGS_EXTENDED := in_netns.sh 10TEST_PROGS_EXTENDED := in_netns.sh
11TEST_GEN_FILES = socket 11TEST_GEN_FILES = socket
12TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy 12TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
13TEST_GEN_FILES += tcp_mmap tcp_inq 13TEST_GEN_FILES += tcp_mmap tcp_inq
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
index 5b012f4981d4..6f289a49e5ec 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json
@@ -66,7 +66,7 @@
66 "cmdUnderTest": "$TC action add action bpf object-file _b.o index 667", 66 "cmdUnderTest": "$TC action add action bpf object-file _b.o index 667",
67 "expExitCode": "0", 67 "expExitCode": "0",
68 "verifyCmd": "$TC action get action bpf index 667", 68 "verifyCmd": "$TC action get action bpf index 667",
69 "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9]* tag 3b185187f1855c4c default-action pipe.*index 667 ref", 69 "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9]* tag 3b185187f1855c4c( jited)? default-action pipe.*index 667 ref",
70 "matchCount": "1", 70 "matchCount": "1",
71 "teardown": [ 71 "teardown": [
72 "$TC action flush action bpf", 72 "$TC action flush action bpf",
@@ -92,10 +92,15 @@
92 "cmdUnderTest": "$TC action add action bpf object-file _c.o index 667", 92 "cmdUnderTest": "$TC action add action bpf object-file _c.o index 667",
93 "expExitCode": "255", 93 "expExitCode": "255",
94 "verifyCmd": "$TC action get action bpf index 667", 94 "verifyCmd": "$TC action get action bpf index 667",
95 "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9].*index 667 ref", 95 "matchPattern": "action order [0-9]*: bpf _c.o:\\[action\\] id [0-9].*index 667 ref",
96 "matchCount": "0", 96 "matchCount": "0",
97 "teardown": [ 97 "teardown": [
98 "$TC action flush action bpf", 98 [
99 "$TC action flush action bpf",
100 0,
101 1,
102 255
103 ],
99 "rm -f _c.o" 104 "rm -f _c.o"
100 ] 105 ]
101 }, 106 },
diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c
index 68378fe17a0e..e07156c30323 100644
--- a/virt/kvm/arm/vgic/vgic-init.c
+++ b/virt/kvm/arm/vgic/vgic-init.c
@@ -423,7 +423,7 @@ static irqreturn_t vgic_maintenance_handler(int irq, void *data)
423 * We cannot rely on the vgic maintenance interrupt to be 423 * We cannot rely on the vgic maintenance interrupt to be
424 * delivered synchronously. This means we can only use it to 424 * delivered synchronously. This means we can only use it to
425 * exit the VM, and we perform the handling of EOIed 425 * exit the VM, and we perform the handling of EOIed
426 * interrupts on the exit path (see vgic_process_maintenance). 426 * interrupts on the exit path (see vgic_fold_lr_state).
427 */ 427 */
428 return IRQ_HANDLED; 428 return IRQ_HANDLED;
429} 429}
diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
index dbe99d635c80..ff9655cfeb2f 100644
--- a/virt/kvm/arm/vgic/vgic-mmio.c
+++ b/virt/kvm/arm/vgic/vgic-mmio.c
@@ -289,10 +289,16 @@ static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
289 irq->vcpu->cpu != -1) /* VCPU thread is running */ 289 irq->vcpu->cpu != -1) /* VCPU thread is running */
290 cond_resched_lock(&irq->irq_lock); 290 cond_resched_lock(&irq->irq_lock);
291 291
292 if (irq->hw) 292 if (irq->hw) {
293 vgic_hw_irq_change_active(vcpu, irq, active, !requester_vcpu); 293 vgic_hw_irq_change_active(vcpu, irq, active, !requester_vcpu);
294 else 294 } else {
295 u32 model = vcpu->kvm->arch.vgic.vgic_model;
296
295 irq->active = active; 297 irq->active = active;
298 if (model == KVM_DEV_TYPE_ARM_VGIC_V2 &&
299 active && vgic_irq_is_sgi(irq->intid))
300 irq->active_source = requester_vcpu->vcpu_id;
301 }
296 302
297 if (irq->active) 303 if (irq->active)
298 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); 304 vgic_queue_irq_unlock(vcpu->kvm, irq, flags);
diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c
index 45aa433f018f..a5f2e44f1c33 100644
--- a/virt/kvm/arm/vgic/vgic-v2.c
+++ b/virt/kvm/arm/vgic/vgic-v2.c
@@ -37,13 +37,6 @@ void vgic_v2_init_lrs(void)
37 vgic_v2_write_lr(i, 0); 37 vgic_v2_write_lr(i, 0);
38} 38}
39 39
40void vgic_v2_set_npie(struct kvm_vcpu *vcpu)
41{
42 struct vgic_v2_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v2;
43
44 cpuif->vgic_hcr |= GICH_HCR_NPIE;
45}
46
47void vgic_v2_set_underflow(struct kvm_vcpu *vcpu) 40void vgic_v2_set_underflow(struct kvm_vcpu *vcpu)
48{ 41{
49 struct vgic_v2_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v2; 42 struct vgic_v2_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v2;
@@ -71,13 +64,18 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu)
71 int lr; 64 int lr;
72 unsigned long flags; 65 unsigned long flags;
73 66
74 cpuif->vgic_hcr &= ~(GICH_HCR_UIE | GICH_HCR_NPIE); 67 cpuif->vgic_hcr &= ~GICH_HCR_UIE;
75 68
76 for (lr = 0; lr < vgic_cpu->used_lrs; lr++) { 69 for (lr = 0; lr < vgic_cpu->used_lrs; lr++) {
77 u32 val = cpuif->vgic_lr[lr]; 70 u32 val = cpuif->vgic_lr[lr];
78 u32 intid = val & GICH_LR_VIRTUALID; 71 u32 cpuid, intid = val & GICH_LR_VIRTUALID;
79 struct vgic_irq *irq; 72 struct vgic_irq *irq;
80 73
74 /* Extract the source vCPU id from the LR */
75 cpuid = val & GICH_LR_PHYSID_CPUID;
76 cpuid >>= GICH_LR_PHYSID_CPUID_SHIFT;
77 cpuid &= 7;
78
81 /* Notify fds when the guest EOI'ed a level-triggered SPI */ 79 /* Notify fds when the guest EOI'ed a level-triggered SPI */
82 if (lr_signals_eoi_mi(val) && vgic_valid_spi(vcpu->kvm, intid)) 80 if (lr_signals_eoi_mi(val) && vgic_valid_spi(vcpu->kvm, intid))
83 kvm_notify_acked_irq(vcpu->kvm, 0, 81 kvm_notify_acked_irq(vcpu->kvm, 0,
@@ -90,17 +88,16 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu)
90 /* Always preserve the active bit */ 88 /* Always preserve the active bit */
91 irq->active = !!(val & GICH_LR_ACTIVE_BIT); 89 irq->active = !!(val & GICH_LR_ACTIVE_BIT);
92 90
91 if (irq->active && vgic_irq_is_sgi(intid))
92 irq->active_source = cpuid;
93
93 /* Edge is the only case where we preserve the pending bit */ 94 /* Edge is the only case where we preserve the pending bit */
94 if (irq->config == VGIC_CONFIG_EDGE && 95 if (irq->config == VGIC_CONFIG_EDGE &&
95 (val & GICH_LR_PENDING_BIT)) { 96 (val & GICH_LR_PENDING_BIT)) {
96 irq->pending_latch = true; 97 irq->pending_latch = true;
97 98
98 if (vgic_irq_is_sgi(intid)) { 99 if (vgic_irq_is_sgi(intid))
99 u32 cpuid = val & GICH_LR_PHYSID_CPUID;
100
101 cpuid >>= GICH_LR_PHYSID_CPUID_SHIFT;
102 irq->source |= (1 << cpuid); 100 irq->source |= (1 << cpuid);
103 }
104 } 101 }
105 102
106 /* 103 /*
@@ -152,8 +149,15 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr)
152 u32 val = irq->intid; 149 u32 val = irq->intid;
153 bool allow_pending = true; 150 bool allow_pending = true;
154 151
155 if (irq->active) 152 if (irq->active) {
156 val |= GICH_LR_ACTIVE_BIT; 153 val |= GICH_LR_ACTIVE_BIT;
154 if (vgic_irq_is_sgi(irq->intid))
155 val |= irq->active_source << GICH_LR_PHYSID_CPUID_SHIFT;
156 if (vgic_irq_is_multi_sgi(irq)) {
157 allow_pending = false;
158 val |= GICH_LR_EOI;
159 }
160 }
157 161
158 if (irq->hw) { 162 if (irq->hw) {
159 val |= GICH_LR_HW; 163 val |= GICH_LR_HW;
@@ -190,8 +194,10 @@ void vgic_v2_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr)
190 BUG_ON(!src); 194 BUG_ON(!src);
191 val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; 195 val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT;
192 irq->source &= ~(1 << (src - 1)); 196 irq->source &= ~(1 << (src - 1));
193 if (irq->source) 197 if (irq->source) {
194 irq->pending_latch = true; 198 irq->pending_latch = true;
199 val |= GICH_LR_EOI;
200 }
195 } 201 }
196 } 202 }
197 203
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
index 8195f52ae6f0..c7423f3768e5 100644
--- a/virt/kvm/arm/vgic/vgic-v3.c
+++ b/virt/kvm/arm/vgic/vgic-v3.c
@@ -27,13 +27,6 @@ static bool group1_trap;
27static bool common_trap; 27static bool common_trap;
28static bool gicv4_enable; 28static bool gicv4_enable;
29 29
30void vgic_v3_set_npie(struct kvm_vcpu *vcpu)
31{
32 struct vgic_v3_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v3;
33
34 cpuif->vgic_hcr |= ICH_HCR_NPIE;
35}
36
37void vgic_v3_set_underflow(struct kvm_vcpu *vcpu) 30void vgic_v3_set_underflow(struct kvm_vcpu *vcpu)
38{ 31{
39 struct vgic_v3_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v3; 32 struct vgic_v3_cpu_if *cpuif = &vcpu->arch.vgic_cpu.vgic_v3;
@@ -55,17 +48,23 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu)
55 int lr; 48 int lr;
56 unsigned long flags; 49 unsigned long flags;
57 50
58 cpuif->vgic_hcr &= ~(ICH_HCR_UIE | ICH_HCR_NPIE); 51 cpuif->vgic_hcr &= ~ICH_HCR_UIE;
59 52
60 for (lr = 0; lr < vgic_cpu->used_lrs; lr++) { 53 for (lr = 0; lr < vgic_cpu->used_lrs; lr++) {
61 u64 val = cpuif->vgic_lr[lr]; 54 u64 val = cpuif->vgic_lr[lr];
62 u32 intid; 55 u32 intid, cpuid;
63 struct vgic_irq *irq; 56 struct vgic_irq *irq;
57 bool is_v2_sgi = false;
64 58
65 if (model == KVM_DEV_TYPE_ARM_VGIC_V3) 59 cpuid = val & GICH_LR_PHYSID_CPUID;
60 cpuid >>= GICH_LR_PHYSID_CPUID_SHIFT;
61
62 if (model == KVM_DEV_TYPE_ARM_VGIC_V3) {
66 intid = val & ICH_LR_VIRTUAL_ID_MASK; 63 intid = val & ICH_LR_VIRTUAL_ID_MASK;
67 else 64 } else {
68 intid = val & GICH_LR_VIRTUALID; 65 intid = val & GICH_LR_VIRTUALID;
66 is_v2_sgi = vgic_irq_is_sgi(intid);
67 }
69 68
70 /* Notify fds when the guest EOI'ed a level-triggered IRQ */ 69 /* Notify fds when the guest EOI'ed a level-triggered IRQ */
71 if (lr_signals_eoi_mi(val) && vgic_valid_spi(vcpu->kvm, intid)) 70 if (lr_signals_eoi_mi(val) && vgic_valid_spi(vcpu->kvm, intid))
@@ -81,18 +80,16 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu)
81 /* Always preserve the active bit */ 80 /* Always preserve the active bit */
82 irq->active = !!(val & ICH_LR_ACTIVE_BIT); 81 irq->active = !!(val & ICH_LR_ACTIVE_BIT);
83 82
83 if (irq->active && is_v2_sgi)
84 irq->active_source = cpuid;
85
84 /* Edge is the only case where we preserve the pending bit */ 86 /* Edge is the only case where we preserve the pending bit */
85 if (irq->config == VGIC_CONFIG_EDGE && 87 if (irq->config == VGIC_CONFIG_EDGE &&
86 (val & ICH_LR_PENDING_BIT)) { 88 (val & ICH_LR_PENDING_BIT)) {
87 irq->pending_latch = true; 89 irq->pending_latch = true;
88 90
89 if (vgic_irq_is_sgi(intid) && 91 if (is_v2_sgi)
90 model == KVM_DEV_TYPE_ARM_VGIC_V2) {
91 u32 cpuid = val & GICH_LR_PHYSID_CPUID;
92
93 cpuid >>= GICH_LR_PHYSID_CPUID_SHIFT;
94 irq->source |= (1 << cpuid); 92 irq->source |= (1 << cpuid);
95 }
96 } 93 }
97 94
98 /* 95 /*
@@ -133,10 +130,20 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr)
133{ 130{
134 u32 model = vcpu->kvm->arch.vgic.vgic_model; 131 u32 model = vcpu->kvm->arch.vgic.vgic_model;
135 u64 val = irq->intid; 132 u64 val = irq->intid;
136 bool allow_pending = true; 133 bool allow_pending = true, is_v2_sgi;
137 134
138 if (irq->active) 135 is_v2_sgi = (vgic_irq_is_sgi(irq->intid) &&
136 model == KVM_DEV_TYPE_ARM_VGIC_V2);
137
138 if (irq->active) {
139 val |= ICH_LR_ACTIVE_BIT; 139 val |= ICH_LR_ACTIVE_BIT;
140 if (is_v2_sgi)
141 val |= irq->active_source << GICH_LR_PHYSID_CPUID_SHIFT;
142 if (vgic_irq_is_multi_sgi(irq)) {
143 allow_pending = false;
144 val |= ICH_LR_EOI;
145 }
146 }
140 147
141 if (irq->hw) { 148 if (irq->hw) {
142 val |= ICH_LR_HW; 149 val |= ICH_LR_HW;
@@ -174,8 +181,10 @@ void vgic_v3_populate_lr(struct kvm_vcpu *vcpu, struct vgic_irq *irq, int lr)
174 BUG_ON(!src); 181 BUG_ON(!src);
175 val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT; 182 val |= (src - 1) << GICH_LR_PHYSID_CPUID_SHIFT;
176 irq->source &= ~(1 << (src - 1)); 183 irq->source &= ~(1 << (src - 1));
177 if (irq->source) 184 if (irq->source) {
178 irq->pending_latch = true; 185 irq->pending_latch = true;
186 val |= ICH_LR_EOI;
187 }
179 } 188 }
180 } 189 }
181 190
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index 702936cbe173..97bfba8d9a59 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -725,14 +725,6 @@ static inline void vgic_set_underflow(struct kvm_vcpu *vcpu)
725 vgic_v3_set_underflow(vcpu); 725 vgic_v3_set_underflow(vcpu);
726} 726}
727 727
728static inline void vgic_set_npie(struct kvm_vcpu *vcpu)
729{
730 if (kvm_vgic_global_state.type == VGIC_V2)
731 vgic_v2_set_npie(vcpu);
732 else
733 vgic_v3_set_npie(vcpu);
734}
735
736/* Requires the ap_list_lock to be held. */ 728/* Requires the ap_list_lock to be held. */
737static int compute_ap_list_depth(struct kvm_vcpu *vcpu, 729static int compute_ap_list_depth(struct kvm_vcpu *vcpu,
738 bool *multi_sgi) 730 bool *multi_sgi)
@@ -746,17 +738,15 @@ static int compute_ap_list_depth(struct kvm_vcpu *vcpu,
746 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock)); 738 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock));
747 739
748 list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) { 740 list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
741 int w;
742
749 spin_lock(&irq->irq_lock); 743 spin_lock(&irq->irq_lock);
750 /* GICv2 SGIs can count for more than one... */ 744 /* GICv2 SGIs can count for more than one... */
751 if (vgic_irq_is_sgi(irq->intid) && irq->source) { 745 w = vgic_irq_get_lr_count(irq);
752 int w = hweight8(irq->source);
753
754 count += w;
755 *multi_sgi |= (w > 1);
756 } else {
757 count++;
758 }
759 spin_unlock(&irq->irq_lock); 746 spin_unlock(&irq->irq_lock);
747
748 count += w;
749 *multi_sgi |= (w > 1);
760 } 750 }
761 return count; 751 return count;
762} 752}
@@ -767,7 +757,6 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
767 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; 757 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
768 struct vgic_irq *irq; 758 struct vgic_irq *irq;
769 int count; 759 int count;
770 bool npie = false;
771 bool multi_sgi; 760 bool multi_sgi;
772 u8 prio = 0xff; 761 u8 prio = 0xff;
773 762
@@ -797,10 +786,8 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
797 if (likely(vgic_target_oracle(irq) == vcpu)) { 786 if (likely(vgic_target_oracle(irq) == vcpu)) {
798 vgic_populate_lr(vcpu, irq, count++); 787 vgic_populate_lr(vcpu, irq, count++);
799 788
800 if (irq->source) { 789 if (irq->source)
801 npie = true;
802 prio = irq->priority; 790 prio = irq->priority;
803 }
804 } 791 }
805 792
806 spin_unlock(&irq->irq_lock); 793 spin_unlock(&irq->irq_lock);
@@ -813,9 +800,6 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
813 } 800 }
814 } 801 }
815 802
816 if (npie)
817 vgic_set_npie(vcpu);
818
819 vcpu->arch.vgic_cpu.used_lrs = count; 803 vcpu->arch.vgic_cpu.used_lrs = count;
820 804
821 /* Nuke remaining LRs */ 805 /* Nuke remaining LRs */
diff --git a/virt/kvm/arm/vgic/vgic.h b/virt/kvm/arm/vgic/vgic.h
index 830e815748a0..32c25d42c93f 100644
--- a/virt/kvm/arm/vgic/vgic.h
+++ b/virt/kvm/arm/vgic/vgic.h
@@ -110,6 +110,20 @@ static inline bool vgic_irq_is_mapped_level(struct vgic_irq *irq)
110 return irq->config == VGIC_CONFIG_LEVEL && irq->hw; 110 return irq->config == VGIC_CONFIG_LEVEL && irq->hw;
111} 111}
112 112
113static inline int vgic_irq_get_lr_count(struct vgic_irq *irq)
114{
115 /* Account for the active state as an interrupt */
116 if (vgic_irq_is_sgi(irq->intid) && irq->source)
117 return hweight8(irq->source) + irq->active;
118
119 return irq_is_pending(irq) || irq->active;
120}
121
122static inline bool vgic_irq_is_multi_sgi(struct vgic_irq *irq)
123{
124 return vgic_irq_get_lr_count(irq) > 1;
125}
126
113/* 127/*
114 * This struct provides an intermediate representation of the fields contained 128 * This struct provides an intermediate representation of the fields contained
115 * in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC 129 * in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC