aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2018-05-09 11:40:44 -0400
committerWolfram Sang <wsa@the-dreams.de>2018-05-09 11:40:44 -0400
commit4c0330208f6bfe5285bae239fdb2a7ec1ce1f78d (patch)
tree257c871b0be4c7eafa0e6911ab596bfb0f51a104
parent7781edaed63e9396fc913e0899cb197562e6f1a0 (diff)
parent76aa3de7095f15af7300012cb29ea8ab93eec348 (diff)
Merge tag 'at24-4.17-rc5-fixes-for-wolfram' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-current
Single bug-fix for a regression introduced during the 4.17 merge window.
-rw-r--r--Documentation/bpf/bpf_devel_QA.txt10
-rw-r--r--Documentation/devicetree/bindings/input/atmel,maxtouch.txt7
-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--MAINTAINERS24
-rw-r--r--Makefile4
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h2
-rw-r--r--arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c24
-rw-r--r--arch/hexagon/include/asm/io.h6
-rw-r--r--arch/hexagon/lib/checksum.c1
-rw-r--r--arch/parisc/Makefile3
-rw-r--r--arch/parisc/kernel/drivers.c7
-rw-r--r--arch/parisc/kernel/pci.c2
-rw-r--r--arch/parisc/kernel/time.c2
-rw-r--r--arch/parisc/kernel/traps.c11
-rw-r--r--arch/parisc/mm/init.c2
-rw-r--r--arch/sparc/include/uapi/asm/oradax.h2
-rw-r--r--arch/sparc/kernel/vio.c2
-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/net/bpf_jit_comp.c18
-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/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/gpu/drm/bridge/dumb-vga-dac.c4
-rw-r--r--drivers/gpu/drm/i915/intel_csr.c1
-rw-r--r--drivers/gpu/drm/vc4/vc4_crtc.c46
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fb.c31
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c14
-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.c9
-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/input/input-leds.c8
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/input/rmi4/rmi_spi.c7
-rw-r--r--drivers/input/touchscreen/Kconfig2
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c200
-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/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/misc/eeprom/at24.c2
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c18
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth_ethtool.c2
-rw-r--r--drivers/net/ethernet/marvell/mvpp2.c30
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tx.c20
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_core.c26
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c12
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/action.c10
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/cmsg.h5
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/main.c2
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_app_nic.c2
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_main.h4
-rw-r--r--drivers/net/ethernet/netronome/nfp/nfp_net_main.c31
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_ll2.c2
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_roce.c2
-rw-r--r--drivers/net/ethernet/realtek/8139too.c2
-rw-r--r--drivers/net/ethernet/sfc/ef10.c5
-rw-r--r--drivers/net/ethernet/sfc/rx.c2
-rw-r--r--drivers/net/ethernet/ti/cpsw.c2
-rw-r--r--drivers/net/phy/phy_device.c11
-rw-r--r--drivers/net/usb/qmi_wwan.c13
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c36
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/scan.h13
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c111
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h6
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c3
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c15
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c11
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/wifi.h5
-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/parisc/ccio-dma.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/sbus/char/oradax.c2
-rw-r--r--drivers/scsi/isci/port_config.c3
-rw-r--r--drivers/scsi/storvsc_drv.c7
-rw-r--r--drivers/staging/media/imx/imx-media-csi.c2
-rw-r--r--drivers/target/target_core_iblock.c8
-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/cifs/Kconfig2
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--fs/xfs/libxfs/xfs_attr.c9
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c4
-rw-r--r--fs/xfs/libxfs/xfs_inode_buf.c21
-rw-r--r--fs/xfs/xfs_file.c24
-rw-r--r--include/dt-bindings/clock/stm32mp1-clks.h4
-rw-r--r--include/kvm/arm_vgic.h1
-rw-r--r--include/linux/bpf.h4
-rw-r--r--include/linux/clk-provider.h3
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/mlx5/driver.h12
-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/tls.h1
-rw-r--r--include/trace/events/initcall.h14
-rw-r--r--include/uapi/linux/if_infiniband.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--kernel/bpf/arraymap.c3
-rw-r--r--kernel/bpf/sockmap.c99
-rw-r--r--kernel/bpf/syscall.c4
-rw-r--r--kernel/events/uprobes.c7
-rw-r--r--kernel/time/clocksource.c63
-rw-r--r--kernel/trace/ftrace.c4
-rw-r--r--kernel/trace/trace_events_hist.c12
-rw-r--r--kernel/trace/trace_stack.c2
-rw-r--r--kernel/trace/trace_uprobe.c35
-rw-r--r--kernel/tracepoint.c4
-rw-r--r--lib/errseq.c23
-rw-r--r--lib/swiotlb.c2
-rw-r--r--mm/backing-dev.c3
-rw-r--r--net/bridge/br_if.c4
-rw-r--r--net/compat.c6
-rw-r--r--net/core/ethtool.c5
-rw-r--r--net/core/filter.c1
-rw-r--r--net/dccp/ccids/ccid2.c14
-rw-r--r--net/dccp/timer.c2
-rw-r--r--net/ipv4/route.c118
-rw-r--r--net/ipv4/tcp.c7
-rw-r--r--net/ipv4/tcp_bbr.c4
-rw-r--r--net/ipv6/route.c7
-rw-r--r--net/rds/ib_cm.c3
-rw-r--r--net/rds/recv.c1
-rw-r--r--net/sched/sch_fq.c37
-rw-r--r--net/sctp/inqueue.c2
-rw-r--r--net/sctp/ipv6.c3
-rw-r--r--net/sctp/sm_statefuns.c8
-rw-r--r--net/sctp/stream.c2
-rw-r--r--net/smc/af_smc.c61
-rw-r--r--net/smc/smc_core.c22
-rw-r--r--net/smc/smc_core.h3
-rw-r--r--net/tipc/node.c2
-rw-r--r--net/tls/tls_main.c7
-rw-r--r--samples/sockmap/Makefile7
-rw-r--r--scripts/Makefile.gcc-plugins2
-rw-r--r--scripts/Makefile.lib2
-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/bpf/Makefile2
-rw-r--r--tools/bpf/bpf_dbg.c7
-rw-r--r--tools/power/acpi/Makefile.config1
-rw-r--r--tools/testing/selftests/bpf/test_progs.c4
-rw-r--r--tools/testing/selftests/lib.mk8
-rw-r--r--tools/testing/selftests/net/Makefile3
-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
334 files changed, 2198 insertions, 1242 deletions
diff --git a/Documentation/bpf/bpf_devel_QA.txt b/Documentation/bpf/bpf_devel_QA.txt
index 1a0b704e1a38..da57601153a0 100644
--- a/Documentation/bpf/bpf_devel_QA.txt
+++ b/Documentation/bpf/bpf_devel_QA.txt
@@ -557,6 +557,14 @@ A: Although LLVM IR generation and optimization try to stay architecture
557 pulls in some header files containing file scope host assembly codes. 557 pulls in some header files containing file scope host assembly codes.
558 - You can add "-fno-jump-tables" to work around the switch table issue. 558 - You can add "-fno-jump-tables" to work around the switch table issue.
559 559
560 Otherwise, you can use bpf target. 560 Otherwise, you can use bpf target. Additionally, you _must_ use bpf target
561 when:
562
563 - Your program uses data structures with pointer or long / unsigned long
564 types that interface with BPF helpers or context data structures. Access
565 into these structures is verified by the BPF verifier and may result
566 in verification failures if the native architecture is not aligned with
567 the BPF architecture, e.g. 64-bit. An example of this is
568 BPF_PROG_TYPE_SK_MSG require '-target bpf'
561 569
562Happy BPF hacking! 570Happy BPF hacking!
diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
index 23e3abc3fdef..c88919480d37 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
@@ -4,6 +4,13 @@ Required properties:
4- compatible: 4- compatible:
5 atmel,maxtouch 5 atmel,maxtouch
6 6
7 The following compatibles have been used in various products but are
8 deprecated:
9 atmel,qt602240_ts
10 atmel,atmel_mxt_ts
11 atmel,atmel_mxt_tp
12 atmel,mXT224
13
7- reg: The I2C address of the device 14- reg: The I2C address of the device
8 15
9- interrupts: The sink for the touchpad's IRQ output 16- interrupts: The sink for the touchpad's IRQ output
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 79bb02ff812f..df6e9bb2559a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
@@ -3083,7 +3082,6 @@ F: include/linux/btrfs*
3083F: include/uapi/linux/btrfs* 3082F: include/uapi/linux/btrfs*
3084 3083
3085BTTV VIDEO4LINUX DRIVER 3084BTTV VIDEO4LINUX DRIVER
3086M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
3087M: Mauro Carvalho Chehab <mchehab@kernel.org> 3085M: Mauro Carvalho Chehab <mchehab@kernel.org>
3088L: linux-media@vger.kernel.org 3086L: linux-media@vger.kernel.org
3089W: https://linuxtv.org 3087W: https://linuxtv.org
@@ -3812,7 +3810,6 @@ S: Maintained
3812F: drivers/media/dvb-frontends/cx24120* 3810F: drivers/media/dvb-frontends/cx24120*
3813 3811
3814CX88 VIDEO4LINUX DRIVER 3812CX88 VIDEO4LINUX DRIVER
3815M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
3816M: Mauro Carvalho Chehab <mchehab@kernel.org> 3813M: Mauro Carvalho Chehab <mchehab@kernel.org>
3817L: linux-media@vger.kernel.org 3814L: linux-media@vger.kernel.org
3818W: https://linuxtv.org 3815W: https://linuxtv.org
@@ -5053,7 +5050,6 @@ F: drivers/edac/thunderx_edac*
5053 5050
5054EDAC-CORE 5051EDAC-CORE
5055M: Borislav Petkov <bp@alien8.de> 5052M: Borislav Petkov <bp@alien8.de>
5056M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5057M: Mauro Carvalho Chehab <mchehab@kernel.org> 5053M: Mauro Carvalho Chehab <mchehab@kernel.org>
5058L: linux-edac@vger.kernel.org 5054L: linux-edac@vger.kernel.org
5059T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next 5055T: git git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git for-next
@@ -5082,7 +5078,6 @@ S: Maintained
5082F: drivers/edac/fsl_ddr_edac.* 5078F: drivers/edac/fsl_ddr_edac.*
5083 5079
5084EDAC-GHES 5080EDAC-GHES
5085M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5086M: Mauro Carvalho Chehab <mchehab@kernel.org> 5081M: Mauro Carvalho Chehab <mchehab@kernel.org>
5087L: linux-edac@vger.kernel.org 5082L: linux-edac@vger.kernel.org
5088S: Maintained 5083S: Maintained
@@ -5099,21 +5094,18 @@ S: Maintained
5099F: drivers/edac/i5000_edac.c 5094F: drivers/edac/i5000_edac.c
5100 5095
5101EDAC-I5400 5096EDAC-I5400
5102M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5103M: Mauro Carvalho Chehab <mchehab@kernel.org> 5097M: Mauro Carvalho Chehab <mchehab@kernel.org>
5104L: linux-edac@vger.kernel.org 5098L: linux-edac@vger.kernel.org
5105S: Maintained 5099S: Maintained
5106F: drivers/edac/i5400_edac.c 5100F: drivers/edac/i5400_edac.c
5107 5101
5108EDAC-I7300 5102EDAC-I7300
5109M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5110M: Mauro Carvalho Chehab <mchehab@kernel.org> 5103M: Mauro Carvalho Chehab <mchehab@kernel.org>
5111L: linux-edac@vger.kernel.org 5104L: linux-edac@vger.kernel.org
5112S: Maintained 5105S: Maintained
5113F: drivers/edac/i7300_edac.c 5106F: drivers/edac/i7300_edac.c
5114 5107
5115EDAC-I7CORE 5108EDAC-I7CORE
5116M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5117M: Mauro Carvalho Chehab <mchehab@kernel.org> 5109M: Mauro Carvalho Chehab <mchehab@kernel.org>
5118L: linux-edac@vger.kernel.org 5110L: linux-edac@vger.kernel.org
5119S: Maintained 5111S: Maintained
@@ -5163,7 +5155,6 @@ S: Maintained
5163F: drivers/edac/r82600_edac.c 5155F: drivers/edac/r82600_edac.c
5164 5156
5165EDAC-SBRIDGE 5157EDAC-SBRIDGE
5166M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5167M: Mauro Carvalho Chehab <mchehab@kernel.org> 5158M: Mauro Carvalho Chehab <mchehab@kernel.org>
5168L: linux-edac@vger.kernel.org 5159L: linux-edac@vger.kernel.org
5169S: Maintained 5160S: Maintained
@@ -5222,7 +5213,6 @@ S: Maintained
5222F: drivers/net/ethernet/ibm/ehea/ 5213F: drivers/net/ethernet/ibm/ehea/
5223 5214
5224EM28XX VIDEO4LINUX DRIVER 5215EM28XX VIDEO4LINUX DRIVER
5225M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
5226M: Mauro Carvalho Chehab <mchehab@kernel.org> 5216M: Mauro Carvalho Chehab <mchehab@kernel.org>
5227L: linux-media@vger.kernel.org 5217L: linux-media@vger.kernel.org
5228W: https://linuxtv.org 5218W: https://linuxtv.org
@@ -7677,9 +7667,11 @@ L: linux-kbuild@vger.kernel.org
7677S: Maintained 7667S: Maintained
7678F: Documentation/kbuild/ 7668F: Documentation/kbuild/
7679F: Makefile 7669F: Makefile
7680F: scripts/Makefile.* 7670F: scripts/Kbuild*
7671F: scripts/Makefile*
7681F: scripts/basic/ 7672F: scripts/basic/
7682F: scripts/mk* 7673F: scripts/mk*
7674F: scripts/mod/
7683F: scripts/package/ 7675F: scripts/package/
7684 7676
7685KERNEL JANITORS 7677KERNEL JANITORS
@@ -8871,7 +8863,6 @@ F: Documentation/devicetree/bindings/media/nvidia,tegra-vde.txt
8871F: drivers/staging/media/tegra-vde/ 8863F: drivers/staging/media/tegra-vde/
8872 8864
8873MEDIA INPUT INFRASTRUCTURE (V4L/DVB) 8865MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
8874M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
8875M: Mauro Carvalho Chehab <mchehab@kernel.org> 8866M: Mauro Carvalho Chehab <mchehab@kernel.org>
8876P: LinuxTV.org Project 8867P: LinuxTV.org Project
8877L: linux-media@vger.kernel.org 8868L: linux-media@vger.kernel.org
@@ -9725,6 +9716,7 @@ W: https://fedorahosted.org/dropwatch/
9725F: net/core/drop_monitor.c 9716F: net/core/drop_monitor.c
9726 9717
9727NETWORKING DRIVERS 9718NETWORKING DRIVERS
9719M: "David S. Miller" <davem@davemloft.net>
9728L: netdev@vger.kernel.org 9720L: netdev@vger.kernel.org
9729W: http://www.linuxfoundation.org/en/Net 9721W: http://www.linuxfoundation.org/en/Net
9730Q: http://patchwork.ozlabs.org/project/netdev/list/ 9722Q: http://patchwork.ozlabs.org/project/netdev/list/
@@ -12259,7 +12251,6 @@ S: Odd Fixes
12259F: drivers/media/i2c/saa6588* 12251F: drivers/media/i2c/saa6588*
12260 12252
12261SAA7134 VIDEO4LINUX DRIVER 12253SAA7134 VIDEO4LINUX DRIVER
12262M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
12263M: Mauro Carvalho Chehab <mchehab@kernel.org> 12254M: Mauro Carvalho Chehab <mchehab@kernel.org>
12264L: linux-media@vger.kernel.org 12255L: linux-media@vger.kernel.org
12265W: https://linuxtv.org 12256W: https://linuxtv.org
@@ -12498,6 +12489,7 @@ F: drivers/scsi/st_*.h
12498SCTP PROTOCOL 12489SCTP PROTOCOL
12499M: Vlad Yasevich <vyasevich@gmail.com> 12490M: Vlad Yasevich <vyasevich@gmail.com>
12500M: Neil Horman <nhorman@tuxdriver.com> 12491M: Neil Horman <nhorman@tuxdriver.com>
12492M: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
12501L: linux-sctp@vger.kernel.org 12493L: linux-sctp@vger.kernel.org
12502W: http://lksctp.sourceforge.net 12494W: http://lksctp.sourceforge.net
12503S: Maintained 12495S: Maintained
@@ -12763,7 +12755,6 @@ S: Maintained
12763F: drivers/media/radio/si4713/radio-usb-si4713.c 12755F: drivers/media/radio/si4713/radio-usb-si4713.c
12764 12756
12765SIANO DVB DRIVER 12757SIANO DVB DRIVER
12766M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
12767M: Mauro Carvalho Chehab <mchehab@kernel.org> 12758M: Mauro Carvalho Chehab <mchehab@kernel.org>
12768L: linux-media@vger.kernel.org 12759L: linux-media@vger.kernel.org
12769W: https://linuxtv.org 12760W: https://linuxtv.org
@@ -13754,7 +13745,6 @@ S: Maintained
13754F: drivers/media/i2c/tda9840* 13745F: drivers/media/i2c/tda9840*
13755 13746
13756TEA5761 TUNER DRIVER 13747TEA5761 TUNER DRIVER
13757M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13758M: Mauro Carvalho Chehab <mchehab@kernel.org> 13748M: Mauro Carvalho Chehab <mchehab@kernel.org>
13759L: linux-media@vger.kernel.org 13749L: linux-media@vger.kernel.org
13760W: https://linuxtv.org 13750W: https://linuxtv.org
@@ -13763,7 +13753,6 @@ S: Odd fixes
13763F: drivers/media/tuners/tea5761.* 13753F: drivers/media/tuners/tea5761.*
13764 13754
13765TEA5767 TUNER DRIVER 13755TEA5767 TUNER DRIVER
13766M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13767M: Mauro Carvalho Chehab <mchehab@kernel.org> 13756M: Mauro Carvalho Chehab <mchehab@kernel.org>
13768L: linux-media@vger.kernel.org 13757L: linux-media@vger.kernel.org
13769W: https://linuxtv.org 13758W: https://linuxtv.org
@@ -13853,7 +13842,6 @@ S: Supported
13853F: drivers/iommu/tegra* 13842F: drivers/iommu/tegra*
13854 13843
13855TEGRA KBC DRIVER 13844TEGRA KBC DRIVER
13856M: Rakesh Iyer <riyer@nvidia.com>
13857M: Laxman Dewangan <ldewangan@nvidia.com> 13845M: Laxman Dewangan <ldewangan@nvidia.com>
13858S: Supported 13846S: Supported
13859F: drivers/input/keyboard/tegra-kbc.c 13847F: drivers/input/keyboard/tegra-kbc.c
@@ -14180,7 +14168,6 @@ F: Documentation/networking/tlan.txt
14180F: drivers/net/ethernet/ti/tlan.* 14168F: drivers/net/ethernet/ti/tlan.*
14181 14169
14182TM6000 VIDEO4LINUX DRIVER 14170TM6000 VIDEO4LINUX DRIVER
14183M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
14184M: Mauro Carvalho Chehab <mchehab@kernel.org> 14171M: Mauro Carvalho Chehab <mchehab@kernel.org>
14185L: linux-media@vger.kernel.org 14172L: linux-media@vger.kernel.org
14186W: https://linuxtv.org 14173W: https://linuxtv.org
@@ -15407,7 +15394,6 @@ S: Maintained
15407F: arch/x86/entry/vdso/ 15394F: arch/x86/entry/vdso/
15408 15395
15409XC2028/3028 TUNER DRIVER 15396XC2028/3028 TUNER DRIVER
15410M: Mauro Carvalho Chehab <mchehab@s-opensource.com>
15411M: Mauro Carvalho Chehab <mchehab@kernel.org> 15397M: Mauro Carvalho Chehab <mchehab@kernel.org>
15412L: linux-media@vger.kernel.org 15398L: linux-media@vger.kernel.org
15413W: https://linuxtv.org 15399W: 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/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/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/hexagon/include/asm/io.h b/arch/hexagon/include/asm/io.h
index 9e8621d94ee9..e17262ad125e 100644
--- a/arch/hexagon/include/asm/io.h
+++ b/arch/hexagon/include/asm/io.h
@@ -216,6 +216,12 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
216 memcpy((void *) dst, src, count); 216 memcpy((void *) dst, src, count);
217} 217}
218 218
219static inline void memset_io(volatile void __iomem *addr, int value,
220 size_t size)
221{
222 memset((void __force *)addr, value, size);
223}
224
219#define PCI_IO_ADDR (volatile void __iomem *) 225#define PCI_IO_ADDR (volatile void __iomem *)
220 226
221/* 227/*
diff --git a/arch/hexagon/lib/checksum.c b/arch/hexagon/lib/checksum.c
index 617506d1a559..7cd0a2259269 100644
--- a/arch/hexagon/lib/checksum.c
+++ b/arch/hexagon/lib/checksum.c
@@ -199,3 +199,4 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
199 memcpy(dst, src, len); 199 memcpy(dst, src, len);
200 return csum_partial(dst, len, sum); 200 return csum_partial(dst, len, sum);
201} 201}
202EXPORT_SYMBOL(csum_partial_copy_nocheck);
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index e2364ff59180..34ac503e28ad 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -123,6 +123,9 @@ INSTALL_TARGETS = zinstall install
123 123
124PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) 124PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
125 125
126# Default kernel to build
127all: bzImage
128
126zImage: vmlinuz 129zImage: vmlinuz
127Image: vmlinux 130Image: vmlinux
128 131
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index 3b8507f71050..ee5a78a151a6 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -448,7 +448,8 @@ static int match_by_id(struct device * dev, void * data)
448 * Checks all the children of @parent for a matching @id. If none 448 * Checks all the children of @parent for a matching @id. If none
449 * found, it allocates a new device and returns it. 449 * found, it allocates a new device and returns it.
450 */ 450 */
451static struct parisc_device * alloc_tree_node(struct device *parent, char id) 451static struct parisc_device * __init alloc_tree_node(
452 struct device *parent, char id)
452{ 453{
453 struct match_id_data d = { 454 struct match_id_data d = {
454 .id = id, 455 .id = id,
@@ -825,8 +826,8 @@ static void walk_lower_bus(struct parisc_device *dev)
825 * devices which are not physically connected (such as extra serial & 826 * devices which are not physically connected (such as extra serial &
826 * keyboard ports). This problem is not yet solved. 827 * keyboard ports). This problem is not yet solved.
827 */ 828 */
828static void walk_native_bus(unsigned long io_io_low, unsigned long io_io_high, 829static void __init walk_native_bus(unsigned long io_io_low,
829 struct device *parent) 830 unsigned long io_io_high, struct device *parent)
830{ 831{
831 int i, devices_found = 0; 832 int i, devices_found = 0;
832 unsigned long hpa = io_io_low; 833 unsigned long hpa = io_io_low;
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 13ee3569959a..ae684ac6efb6 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -174,7 +174,7 @@ void pcibios_set_master(struct pci_dev *dev)
174 * pcibios_init_bridge() initializes cache line and default latency 174 * pcibios_init_bridge() initializes cache line and default latency
175 * for pci controllers and pci-pci bridges 175 * for pci controllers and pci-pci bridges
176 */ 176 */
177void __init pcibios_init_bridge(struct pci_dev *dev) 177void __ref pcibios_init_bridge(struct pci_dev *dev)
178{ 178{
179 unsigned short bridge_ctl, bridge_ctl_new; 179 unsigned short bridge_ctl, bridge_ctl_new;
180 180
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index c3830400ca28..a1e772f909cb 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -205,7 +205,7 @@ static int __init rtc_init(void)
205device_initcall(rtc_init); 205device_initcall(rtc_init);
206#endif 206#endif
207 207
208void read_persistent_clock(struct timespec *ts) 208void read_persistent_clock64(struct timespec64 *ts)
209{ 209{
210 static struct pdc_tod tod_data; 210 static struct pdc_tod tod_data;
211 if (pdc_tod_read(&tod_data) == 0) { 211 if (pdc_tod_read(&tod_data) == 0) {
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index 68e671a11987..71d31274d782 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -837,6 +837,17 @@ void __init initialize_ivt(const void *iva)
837 if (pdc_instr(&instr) == PDC_OK) 837 if (pdc_instr(&instr) == PDC_OK)
838 ivap[0] = instr; 838 ivap[0] = instr;
839 839
840 /*
841 * Rules for the checksum of the HPMC handler:
842 * 1. The IVA does not point to PDC/PDH space (ie: the OS has installed
843 * its own IVA).
844 * 2. The word at IVA + 32 is nonzero.
845 * 3. If Length (IVA + 60) is not zero, then Length (IVA + 60) and
846 * Address (IVA + 56) are word-aligned.
847 * 4. The checksum of the 8 words starting at IVA + 32 plus the sum of
848 * the Length/4 words starting at Address is zero.
849 */
850
840 /* Compute Checksum for HPMC handler */ 851 /* Compute Checksum for HPMC handler */
841 length = os_hpmc_size; 852 length = os_hpmc_size;
842 ivap[7] = length; 853 ivap[7] = length;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..2607d2d33405 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -516,7 +516,7 @@ static void __init map_pages(unsigned long start_vaddr,
516 } 516 }
517} 517}
518 518
519void free_initmem(void) 519void __ref free_initmem(void)
520{ 520{
521 unsigned long init_begin = (unsigned long)__init_begin; 521 unsigned long init_begin = (unsigned long)__init_begin;
522 unsigned long init_end = (unsigned long)__init_end; 522 unsigned long init_end = (unsigned long)__init_end;
diff --git a/arch/sparc/include/uapi/asm/oradax.h b/arch/sparc/include/uapi/asm/oradax.h
index 722951908b0a..4f6676fe4bcc 100644
--- a/arch/sparc/include/uapi/asm/oradax.h
+++ b/arch/sparc/include/uapi/asm/oradax.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * This program is free software: you can redistribute it and/or modify 4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or 6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index 1a0fa10cb6b7..32bae68e34c1 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -403,7 +403,7 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
403 if (err) { 403 if (err) {
404 printk(KERN_ERR "VIO: Could not register device %s, err=%d\n", 404 printk(KERN_ERR "VIO: Could not register device %s, err=%d\n",
405 dev_name(&vdev->dev), err); 405 dev_name(&vdev->dev), err);
406 kfree(vdev); 406 put_device(&vdev->dev);
407 return NULL; 407 return NULL;
408 } 408 }
409 if (vdev->dp) 409 if (vdev->dp)
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/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index b725154182cc..263c8453815e 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -1027,7 +1027,17 @@ emit_cond_jmp: /* convert BPF opcode to x86 */
1027 break; 1027 break;
1028 1028
1029 case BPF_JMP | BPF_JA: 1029 case BPF_JMP | BPF_JA:
1030 jmp_offset = addrs[i + insn->off] - addrs[i]; 1030 if (insn->off == -1)
1031 /* -1 jmp instructions will always jump
1032 * backwards two bytes. Explicitly handling
1033 * this case avoids wasting too many passes
1034 * when there are long sequences of replaced
1035 * dead code.
1036 */
1037 jmp_offset = -2;
1038 else
1039 jmp_offset = addrs[i + insn->off] - addrs[i];
1040
1031 if (!jmp_offset) 1041 if (!jmp_offset)
1032 /* optimize out nop jumps */ 1042 /* optimize out nop jumps */
1033 break; 1043 break;
@@ -1226,6 +1236,7 @@ skip_init_addrs:
1226 for (pass = 0; pass < 20 || image; pass++) { 1236 for (pass = 0; pass < 20 || image; pass++) {
1227 proglen = do_jit(prog, addrs, image, oldproglen, &ctx); 1237 proglen = do_jit(prog, addrs, image, oldproglen, &ctx);
1228 if (proglen <= 0) { 1238 if (proglen <= 0) {
1239out_image:
1229 image = NULL; 1240 image = NULL;
1230 if (header) 1241 if (header)
1231 bpf_jit_binary_free(header); 1242 bpf_jit_binary_free(header);
@@ -1236,8 +1247,7 @@ skip_init_addrs:
1236 if (proglen != oldproglen) { 1247 if (proglen != oldproglen) {
1237 pr_err("bpf_jit: proglen=%d != oldproglen=%d\n", 1248 pr_err("bpf_jit: proglen=%d != oldproglen=%d\n",
1238 proglen, oldproglen); 1249 proglen, oldproglen);
1239 prog = orig_prog; 1250 goto out_image;
1240 goto out_addrs;
1241 } 1251 }
1242 break; 1252 break;
1243 } 1253 }
@@ -1273,7 +1283,7 @@ skip_init_addrs:
1273 prog = orig_prog; 1283 prog = orig_prog;
1274 } 1284 }
1275 1285
1276 if (!prog->is_func || extra_pass) { 1286 if (!image || !prog->is_func || extra_pass) {
1277out_addrs: 1287out_addrs:
1278 kfree(addrs); 1288 kfree(addrs);
1279 kfree(jit_data); 1289 kfree(jit_data);
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/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/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/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/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/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/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 daa919e5a442..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 }
@@ -4757,7 +4756,7 @@ mlx5_ib_get_vector_affinity(struct ib_device *ibdev, int comp_vector)
4757{ 4756{
4758 struct mlx5_ib_dev *dev = to_mdev(ibdev); 4757 struct mlx5_ib_dev *dev = to_mdev(ibdev);
4759 4758
4760 return mlx5_get_vector_affinity(dev->mdev, comp_vector); 4759 return mlx5_get_vector_affinity_hint(dev->mdev, comp_vector);
4761} 4760}
4762 4761
4763/* The mlx5_ib_multiport_mutex should be held when calling this function */ 4762/* The mlx5_ib_multiport_mutex should be held when calling this function */
@@ -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/input/input-leds.c b/drivers/input/input-leds.c
index 766bf2660116..5f04b2d94635 100644
--- a/drivers/input/input-leds.c
+++ b/drivers/input/input-leds.c
@@ -88,6 +88,7 @@ static int input_leds_connect(struct input_handler *handler,
88 const struct input_device_id *id) 88 const struct input_device_id *id)
89{ 89{
90 struct input_leds *leds; 90 struct input_leds *leds;
91 struct input_led *led;
91 unsigned int num_leds; 92 unsigned int num_leds;
92 unsigned int led_code; 93 unsigned int led_code;
93 int led_no; 94 int led_no;
@@ -119,14 +120,13 @@ static int input_leds_connect(struct input_handler *handler,
119 120
120 led_no = 0; 121 led_no = 0;
121 for_each_set_bit(led_code, dev->ledbit, LED_CNT) { 122 for_each_set_bit(led_code, dev->ledbit, LED_CNT) {
122 struct input_led *led = &leds->leds[led_no]; 123 if (!input_led_info[led_code].name)
124 continue;
123 125
126 led = &leds->leds[led_no];
124 led->handle = &leds->handle; 127 led->handle = &leds->handle;
125 led->code = led_code; 128 led->code = led_code;
126 129
127 if (!input_led_info[led_code].name)
128 continue;
129
130 led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s", 130 led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",
131 dev_name(&dev->dev), 131 dev_name(&dev->dev),
132 input_led_info[led_code].name); 132 input_led_info[led_code].name);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 0a67f235ba88..38f9501acdf0 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -583,7 +583,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse)
583 583
584 x = (s8)(((packet[0] & 0x20) << 2) | (packet[1] & 0x7f)); 584 x = (s8)(((packet[0] & 0x20) << 2) | (packet[1] & 0x7f));
585 y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f)); 585 y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f));
586 z = packet[4] & 0x7c; 586 z = packet[4] & 0x7f;
587 587
588 /* 588 /*
589 * The x and y values tend to be quite large, and when used 589 * The x and y values tend to be quite large, and when used
diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c
index 76edbf2c1bce..082defc329a8 100644
--- a/drivers/input/rmi4/rmi_spi.c
+++ b/drivers/input/rmi4/rmi_spi.c
@@ -147,8 +147,11 @@ static int rmi_spi_xfer(struct rmi_spi_xport *rmi_spi,
147 if (len > RMI_SPI_XFER_SIZE_LIMIT) 147 if (len > RMI_SPI_XFER_SIZE_LIMIT)
148 return -EINVAL; 148 return -EINVAL;
149 149
150 if (rmi_spi->xfer_buf_size < len) 150 if (rmi_spi->xfer_buf_size < len) {
151 rmi_spi_manage_pools(rmi_spi, len); 151 ret = rmi_spi_manage_pools(rmi_spi, len);
152 if (ret < 0)
153 return ret;
154 }
152 155
153 if (addr == 0) 156 if (addr == 0)
154 /* 157 /*
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 4f15496fec8b..3e613afa10b4 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -362,7 +362,7 @@ config TOUCHSCREEN_HIDEEP
362 362
363 If unsure, say N. 363 If unsure, say N.
364 364
365 To compile this driver as a moudle, choose M here : the 365 To compile this driver as a module, choose M here : the
366 module will be called hideep_ts. 366 module will be called hideep_ts.
367 367
368config TOUCHSCREEN_ILI210X 368config TOUCHSCREEN_ILI210X
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 5d9699fe1b55..09194721aed2 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -280,7 +280,8 @@ struct mxt_data {
280 struct input_dev *input_dev; 280 struct input_dev *input_dev;
281 char phys[64]; /* device physical location */ 281 char phys[64]; /* device physical location */
282 struct mxt_object *object_table; 282 struct mxt_object *object_table;
283 struct mxt_info info; 283 struct mxt_info *info;
284 void *raw_info_block;
284 unsigned int irq; 285 unsigned int irq;
285 unsigned int max_x; 286 unsigned int max_x;
286 unsigned int max_y; 287 unsigned int max_y;
@@ -460,12 +461,13 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data, bool retry)
460{ 461{
461 u8 appmode = data->client->addr; 462 u8 appmode = data->client->addr;
462 u8 bootloader; 463 u8 bootloader;
464 u8 family_id = data->info ? data->info->family_id : 0;
463 465
464 switch (appmode) { 466 switch (appmode) {
465 case 0x4a: 467 case 0x4a:
466 case 0x4b: 468 case 0x4b:
467 /* Chips after 1664S use different scheme */ 469 /* Chips after 1664S use different scheme */
468 if (retry || data->info.family_id >= 0xa2) { 470 if (retry || family_id >= 0xa2) {
469 bootloader = appmode - 0x24; 471 bootloader = appmode - 0x24;
470 break; 472 break;
471 } 473 }
@@ -692,7 +694,7 @@ mxt_get_object(struct mxt_data *data, u8 type)
692 struct mxt_object *object; 694 struct mxt_object *object;
693 int i; 695 int i;
694 696
695 for (i = 0; i < data->info.object_num; i++) { 697 for (i = 0; i < data->info->object_num; i++) {
696 object = data->object_table + i; 698 object = data->object_table + i;
697 if (object->type == type) 699 if (object->type == type)
698 return object; 700 return object;
@@ -1462,12 +1464,12 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
1462 data_pos += offset; 1464 data_pos += offset;
1463 } 1465 }
1464 1466
1465 if (cfg_info.family_id != data->info.family_id) { 1467 if (cfg_info.family_id != data->info->family_id) {
1466 dev_err(dev, "Family ID mismatch!\n"); 1468 dev_err(dev, "Family ID mismatch!\n");
1467 return -EINVAL; 1469 return -EINVAL;
1468 } 1470 }
1469 1471
1470 if (cfg_info.variant_id != data->info.variant_id) { 1472 if (cfg_info.variant_id != data->info->variant_id) {
1471 dev_err(dev, "Variant ID mismatch!\n"); 1473 dev_err(dev, "Variant ID mismatch!\n");
1472 return -EINVAL; 1474 return -EINVAL;
1473 } 1475 }
@@ -1512,7 +1514,7 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
1512 1514
1513 /* Malloc memory to store configuration */ 1515 /* Malloc memory to store configuration */
1514 cfg_start_ofs = MXT_OBJECT_START + 1516 cfg_start_ofs = MXT_OBJECT_START +
1515 data->info.object_num * sizeof(struct mxt_object) + 1517 data->info->object_num * sizeof(struct mxt_object) +
1516 MXT_INFO_CHECKSUM_SIZE; 1518 MXT_INFO_CHECKSUM_SIZE;
1517 config_mem_size = data->mem_size - cfg_start_ofs; 1519 config_mem_size = data->mem_size - cfg_start_ofs;
1518 config_mem = kzalloc(config_mem_size, GFP_KERNEL); 1520 config_mem = kzalloc(config_mem_size, GFP_KERNEL);
@@ -1563,20 +1565,6 @@ release_mem:
1563 return ret; 1565 return ret;
1564} 1566}
1565 1567
1566static int mxt_get_info(struct mxt_data *data)
1567{
1568 struct i2c_client *client = data->client;
1569 struct mxt_info *info = &data->info;
1570 int error;
1571
1572 /* Read 7-byte info block starting at address 0 */
1573 error = __mxt_read_reg(client, 0, sizeof(*info), info);
1574 if (error)
1575 return error;
1576
1577 return 0;
1578}
1579
1580static void mxt_free_input_device(struct mxt_data *data) 1568static void mxt_free_input_device(struct mxt_data *data)
1581{ 1569{
1582 if (data->input_dev) { 1570 if (data->input_dev) {
@@ -1591,9 +1579,10 @@ static void mxt_free_object_table(struct mxt_data *data)
1591 video_unregister_device(&data->dbg.vdev); 1579 video_unregister_device(&data->dbg.vdev);
1592 v4l2_device_unregister(&data->dbg.v4l2); 1580 v4l2_device_unregister(&data->dbg.v4l2);
1593#endif 1581#endif
1594
1595 kfree(data->object_table);
1596 data->object_table = NULL; 1582 data->object_table = NULL;
1583 data->info = NULL;
1584 kfree(data->raw_info_block);
1585 data->raw_info_block = NULL;
1597 kfree(data->msg_buf); 1586 kfree(data->msg_buf);
1598 data->msg_buf = NULL; 1587 data->msg_buf = NULL;
1599 data->T5_address = 0; 1588 data->T5_address = 0;
@@ -1609,34 +1598,18 @@ static void mxt_free_object_table(struct mxt_data *data)
1609 data->max_reportid = 0; 1598 data->max_reportid = 0;
1610} 1599}
1611 1600
1612static int mxt_get_object_table(struct mxt_data *data) 1601static int mxt_parse_object_table(struct mxt_data *data,
1602 struct mxt_object *object_table)
1613{ 1603{
1614 struct i2c_client *client = data->client; 1604 struct i2c_client *client = data->client;
1615 size_t table_size;
1616 struct mxt_object *object_table;
1617 int error;
1618 int i; 1605 int i;
1619 u8 reportid; 1606 u8 reportid;
1620 u16 end_address; 1607 u16 end_address;
1621 1608
1622 table_size = data->info.object_num * sizeof(struct mxt_object);
1623 object_table = kzalloc(table_size, GFP_KERNEL);
1624 if (!object_table) {
1625 dev_err(&data->client->dev, "Failed to allocate memory\n");
1626 return -ENOMEM;
1627 }
1628
1629 error = __mxt_read_reg(client, MXT_OBJECT_START, table_size,
1630 object_table);
1631 if (error) {
1632 kfree(object_table);
1633 return error;
1634 }
1635
1636 /* Valid Report IDs start counting from 1 */ 1609 /* Valid Report IDs start counting from 1 */
1637 reportid = 1; 1610 reportid = 1;
1638 data->mem_size = 0; 1611 data->mem_size = 0;
1639 for (i = 0; i < data->info.object_num; i++) { 1612 for (i = 0; i < data->info->object_num; i++) {
1640 struct mxt_object *object = object_table + i; 1613 struct mxt_object *object = object_table + i;
1641 u8 min_id, max_id; 1614 u8 min_id, max_id;
1642 1615
@@ -1660,8 +1633,8 @@ static int mxt_get_object_table(struct mxt_data *data)
1660 1633
1661 switch (object->type) { 1634 switch (object->type) {
1662 case MXT_GEN_MESSAGE_T5: 1635 case MXT_GEN_MESSAGE_T5:
1663 if (data->info.family_id == 0x80 && 1636 if (data->info->family_id == 0x80 &&
1664 data->info.version < 0x20) { 1637 data->info->version < 0x20) {
1665 /* 1638 /*
1666 * On mXT224 firmware versions prior to V2.0 1639 * On mXT224 firmware versions prior to V2.0
1667 * read and discard unused CRC byte otherwise 1640 * read and discard unused CRC byte otherwise
@@ -1716,24 +1689,102 @@ static int mxt_get_object_table(struct mxt_data *data)
1716 /* If T44 exists, T5 position has to be directly after */ 1689 /* If T44 exists, T5 position has to be directly after */
1717 if (data->T44_address && (data->T5_address != data->T44_address + 1)) { 1690 if (data->T44_address && (data->T5_address != data->T44_address + 1)) {
1718 dev_err(&client->dev, "Invalid T44 position\n"); 1691 dev_err(&client->dev, "Invalid T44 position\n");
1719 error = -EINVAL; 1692 return -EINVAL;
1720 goto free_object_table;
1721 } 1693 }
1722 1694
1723 data->msg_buf = kcalloc(data->max_reportid, 1695 data->msg_buf = kcalloc(data->max_reportid,
1724 data->T5_msg_size, GFP_KERNEL); 1696 data->T5_msg_size, GFP_KERNEL);
1725 if (!data->msg_buf) { 1697 if (!data->msg_buf)
1726 dev_err(&client->dev, "Failed to allocate message buffer\n"); 1698 return -ENOMEM;
1699
1700 return 0;
1701}
1702
1703static int mxt_read_info_block(struct mxt_data *data)
1704{
1705 struct i2c_client *client = data->client;
1706 int error;
1707 size_t size;
1708 void *id_buf, *buf;
1709 uint8_t num_objects;
1710 u32 calculated_crc;
1711 u8 *crc_ptr;
1712
1713 /* If info block already allocated, free it */
1714 if (data->raw_info_block)
1715 mxt_free_object_table(data);
1716
1717 /* Read 7-byte ID information block starting at address 0 */
1718 size = sizeof(struct mxt_info);
1719 id_buf = kzalloc(size, GFP_KERNEL);
1720 if (!id_buf)
1721 return -ENOMEM;
1722
1723 error = __mxt_read_reg(client, 0, size, id_buf);
1724 if (error)
1725 goto err_free_mem;
1726
1727 /* Resize buffer to give space for rest of info block */
1728 num_objects = ((struct mxt_info *)id_buf)->object_num;
1729 size += (num_objects * sizeof(struct mxt_object))
1730 + MXT_INFO_CHECKSUM_SIZE;
1731
1732 buf = krealloc(id_buf, size, GFP_KERNEL);
1733 if (!buf) {
1727 error = -ENOMEM; 1734 error = -ENOMEM;
1728 goto free_object_table; 1735 goto err_free_mem;
1736 }
1737 id_buf = buf;
1738
1739 /* Read rest of info block */
1740 error = __mxt_read_reg(client, MXT_OBJECT_START,
1741 size - MXT_OBJECT_START,
1742 id_buf + MXT_OBJECT_START);
1743 if (error)
1744 goto err_free_mem;
1745
1746 /* Extract & calculate checksum */
1747 crc_ptr = id_buf + size - MXT_INFO_CHECKSUM_SIZE;
1748 data->info_crc = crc_ptr[0] | (crc_ptr[1] << 8) | (crc_ptr[2] << 16);
1749
1750 calculated_crc = mxt_calculate_crc(id_buf, 0,
1751 size - MXT_INFO_CHECKSUM_SIZE);
1752
1753 /*
1754 * CRC mismatch can be caused by data corruption due to I2C comms
1755 * issue or else device is not using Object Based Protocol (eg i2c-hid)
1756 */
1757 if ((data->info_crc == 0) || (data->info_crc != calculated_crc)) {
1758 dev_err(&client->dev,
1759 "Info Block CRC error calculated=0x%06X read=0x%06X\n",
1760 calculated_crc, data->info_crc);
1761 error = -EIO;
1762 goto err_free_mem;
1763 }
1764
1765 data->raw_info_block = id_buf;
1766 data->info = (struct mxt_info *)id_buf;
1767
1768 dev_info(&client->dev,
1769 "Family: %u Variant: %u Firmware V%u.%u.%02X Objects: %u\n",
1770 data->info->family_id, data->info->variant_id,
1771 data->info->version >> 4, data->info->version & 0xf,
1772 data->info->build, data->info->object_num);
1773
1774 /* Parse object table information */
1775 error = mxt_parse_object_table(data, id_buf + MXT_OBJECT_START);
1776 if (error) {
1777 dev_err(&client->dev, "Error %d parsing object table\n", error);
1778 mxt_free_object_table(data);
1779 goto err_free_mem;
1729 } 1780 }
1730 1781
1731 data->object_table = object_table; 1782 data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START);
1732 1783
1733 return 0; 1784 return 0;
1734 1785
1735free_object_table: 1786err_free_mem:
1736 mxt_free_object_table(data); 1787 kfree(id_buf);
1737 return error; 1788 return error;
1738} 1789}
1739 1790
@@ -2046,7 +2097,7 @@ static int mxt_initialize(struct mxt_data *data)
2046 int error; 2097 int error;
2047 2098
2048 while (1) { 2099 while (1) {
2049 error = mxt_get_info(data); 2100 error = mxt_read_info_block(data);
2050 if (!error) 2101 if (!error)
2051 break; 2102 break;
2052 2103
@@ -2077,16 +2128,9 @@ static int mxt_initialize(struct mxt_data *data)
2077 msleep(MXT_FW_RESET_TIME); 2128 msleep(MXT_FW_RESET_TIME);
2078 } 2129 }
2079 2130
2080 /* Get object table information */
2081 error = mxt_get_object_table(data);
2082 if (error) {
2083 dev_err(&client->dev, "Error %d reading object table\n", error);
2084 return error;
2085 }
2086
2087 error = mxt_acquire_irq(data); 2131 error = mxt_acquire_irq(data);
2088 if (error) 2132 if (error)
2089 goto err_free_object_table; 2133 return error;
2090 2134
2091 error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME, 2135 error = request_firmware_nowait(THIS_MODULE, true, MXT_CFG_NAME,
2092 &client->dev, GFP_KERNEL, data, 2136 &client->dev, GFP_KERNEL, data,
@@ -2094,14 +2138,10 @@ static int mxt_initialize(struct mxt_data *data)
2094 if (error) { 2138 if (error) {
2095 dev_err(&client->dev, "Failed to invoke firmware loader: %d\n", 2139 dev_err(&client->dev, "Failed to invoke firmware loader: %d\n",
2096 error); 2140 error);
2097 goto err_free_object_table; 2141 return error;
2098 } 2142 }
2099 2143
2100 return 0; 2144 return 0;
2101
2102err_free_object_table:
2103 mxt_free_object_table(data);
2104 return error;
2105} 2145}
2106 2146
2107static int mxt_set_t7_power_cfg(struct mxt_data *data, u8 sleep) 2147static int mxt_set_t7_power_cfg(struct mxt_data *data, u8 sleep)
@@ -2162,7 +2202,7 @@ recheck:
2162static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x, 2202static u16 mxt_get_debug_value(struct mxt_data *data, unsigned int x,
2163 unsigned int y) 2203 unsigned int y)
2164{ 2204{
2165 struct mxt_info *info = &data->info; 2205 struct mxt_info *info = data->info;
2166 struct mxt_dbg *dbg = &data->dbg; 2206 struct mxt_dbg *dbg = &data->dbg;
2167 unsigned int ofs, page; 2207 unsigned int ofs, page;
2168 unsigned int col = 0; 2208 unsigned int col = 0;
@@ -2490,7 +2530,7 @@ static const struct video_device mxt_video_device = {
2490 2530
2491static void mxt_debug_init(struct mxt_data *data) 2531static void mxt_debug_init(struct mxt_data *data)
2492{ 2532{
2493 struct mxt_info *info = &data->info; 2533 struct mxt_info *info = data->info;
2494 struct mxt_dbg *dbg = &data->dbg; 2534 struct mxt_dbg *dbg = &data->dbg;
2495 struct mxt_object *object; 2535 struct mxt_object *object;
2496 int error; 2536 int error;
@@ -2576,7 +2616,6 @@ static int mxt_configure_objects(struct mxt_data *data,
2576 const struct firmware *cfg) 2616 const struct firmware *cfg)
2577{ 2617{
2578 struct device *dev = &data->client->dev; 2618 struct device *dev = &data->client->dev;
2579 struct mxt_info *info = &data->info;
2580 int error; 2619 int error;
2581 2620
2582 error = mxt_init_t7_power_cfg(data); 2621 error = mxt_init_t7_power_cfg(data);
@@ -2601,11 +2640,6 @@ static int mxt_configure_objects(struct mxt_data *data,
2601 2640
2602 mxt_debug_init(data); 2641 mxt_debug_init(data);
2603 2642
2604 dev_info(dev,
2605 "Family: %u Variant: %u Firmware V%u.%u.%02X Objects: %u\n",
2606 info->family_id, info->variant_id, info->version >> 4,
2607 info->version & 0xf, info->build, info->object_num);
2608
2609 return 0; 2643 return 0;
2610} 2644}
2611 2645
@@ -2614,7 +2648,7 @@ static ssize_t mxt_fw_version_show(struct device *dev,
2614 struct device_attribute *attr, char *buf) 2648 struct device_attribute *attr, char *buf)
2615{ 2649{
2616 struct mxt_data *data = dev_get_drvdata(dev); 2650 struct mxt_data *data = dev_get_drvdata(dev);
2617 struct mxt_info *info = &data->info; 2651 struct mxt_info *info = data->info;
2618 return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n", 2652 return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n",
2619 info->version >> 4, info->version & 0xf, info->build); 2653 info->version >> 4, info->version & 0xf, info->build);
2620} 2654}
@@ -2624,7 +2658,7 @@ static ssize_t mxt_hw_version_show(struct device *dev,
2624 struct device_attribute *attr, char *buf) 2658 struct device_attribute *attr, char *buf)
2625{ 2659{
2626 struct mxt_data *data = dev_get_drvdata(dev); 2660 struct mxt_data *data = dev_get_drvdata(dev);
2627 struct mxt_info *info = &data->info; 2661 struct mxt_info *info = data->info;
2628 return scnprintf(buf, PAGE_SIZE, "%u.%u\n", 2662 return scnprintf(buf, PAGE_SIZE, "%u.%u\n",
2629 info->family_id, info->variant_id); 2663 info->family_id, info->variant_id);
2630} 2664}
@@ -2663,7 +2697,7 @@ static ssize_t mxt_object_show(struct device *dev,
2663 return -ENOMEM; 2697 return -ENOMEM;
2664 2698
2665 error = 0; 2699 error = 0;
2666 for (i = 0; i < data->info.object_num; i++) { 2700 for (i = 0; i < data->info->object_num; i++) {
2667 object = data->object_table + i; 2701 object = data->object_table + i;
2668 2702
2669 if (!mxt_object_readable(object->type)) 2703 if (!mxt_object_readable(object->type))
@@ -3035,6 +3069,15 @@ static const struct dmi_system_id mxt_dmi_table[] = {
3035 .driver_data = samus_platform_data, 3069 .driver_data = samus_platform_data,
3036 }, 3070 },
3037 { 3071 {
3072 /* Samsung Chromebook Pro */
3073 .ident = "Samsung Chromebook Pro",
3074 .matches = {
3075 DMI_MATCH(DMI_SYS_VENDOR, "Google"),
3076 DMI_MATCH(DMI_PRODUCT_NAME, "Caroline"),
3077 },
3078 .driver_data = samus_platform_data,
3079 },
3080 {
3038 /* Other Google Chromebooks */ 3081 /* Other Google Chromebooks */
3039 .ident = "Chromebook", 3082 .ident = "Chromebook",
3040 .matches = { 3083 .matches = {
@@ -3254,6 +3297,11 @@ static SIMPLE_DEV_PM_OPS(mxt_pm_ops, mxt_suspend, mxt_resume);
3254 3297
3255static const struct of_device_id mxt_of_match[] = { 3298static const struct of_device_id mxt_of_match[] = {
3256 { .compatible = "atmel,maxtouch", }, 3299 { .compatible = "atmel,maxtouch", },
3300 /* Compatibles listed below are deprecated */
3301 { .compatible = "atmel,qt602240_ts", },
3302 { .compatible = "atmel,atmel_mxt_ts", },
3303 { .compatible = "atmel,atmel_mxt_tp", },
3304 { .compatible = "atmel,mXT224", },
3257 {}, 3305 {},
3258}; 3306};
3259MODULE_DEVICE_TABLE(of, mxt_of_match); 3307MODULE_DEVICE_TABLE(of, mxt_of_match);
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/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/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 0c125f207aea..33053b0d1fdf 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -518,7 +518,7 @@ static int at24_get_pdata(struct device *dev, struct at24_platform_data *pdata)
518 if (of_node && of_match_device(at24_of_match, dev)) 518 if (of_node && of_match_device(at24_of_match, dev))
519 cdata = of_device_get_match_data(dev); 519 cdata = of_device_get_match_data(dev);
520 else if (id) 520 else if (id)
521 cdata = (void *)&id->driver_data; 521 cdata = (void *)id->driver_data;
522 else 522 else
523 cdata = acpi_device_get_match_data(dev); 523 cdata = acpi_device_get_match_data(dev);
524 524
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index f9a3c1a76d5d..f33b25fbca63 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2144,14 +2144,21 @@ static const struct net_device_ops bcm_sysport_netdev_ops = {
2144 .ndo_select_queue = bcm_sysport_select_queue, 2144 .ndo_select_queue = bcm_sysport_select_queue,
2145}; 2145};
2146 2146
2147static int bcm_sysport_map_queues(struct net_device *dev, 2147static int bcm_sysport_map_queues(struct notifier_block *nb,
2148 struct dsa_notifier_register_info *info) 2148 struct dsa_notifier_register_info *info)
2149{ 2149{
2150 struct bcm_sysport_priv *priv = netdev_priv(dev);
2151 struct bcm_sysport_tx_ring *ring; 2150 struct bcm_sysport_tx_ring *ring;
2151 struct bcm_sysport_priv *priv;
2152 struct net_device *slave_dev; 2152 struct net_device *slave_dev;
2153 unsigned int num_tx_queues; 2153 unsigned int num_tx_queues;
2154 unsigned int q, start, port; 2154 unsigned int q, start, port;
2155 struct net_device *dev;
2156
2157 priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier);
2158 if (priv->netdev != info->master)
2159 return 0;
2160
2161 dev = info->master;
2155 2162
2156 /* We can't be setting up queue inspection for non directly attached 2163 /* We can't be setting up queue inspection for non directly attached
2157 * switches 2164 * switches
@@ -2174,11 +2181,12 @@ static int bcm_sysport_map_queues(struct net_device *dev,
2174 if (priv->is_lite) 2181 if (priv->is_lite)
2175 netif_set_real_num_tx_queues(slave_dev, 2182 netif_set_real_num_tx_queues(slave_dev,
2176 slave_dev->num_tx_queues / 2); 2183 slave_dev->num_tx_queues / 2);
2184
2177 num_tx_queues = slave_dev->real_num_tx_queues; 2185 num_tx_queues = slave_dev->real_num_tx_queues;
2178 2186
2179 if (priv->per_port_num_tx_queues && 2187 if (priv->per_port_num_tx_queues &&
2180 priv->per_port_num_tx_queues != num_tx_queues) 2188 priv->per_port_num_tx_queues != num_tx_queues)
2181 netdev_warn(slave_dev, "asymetric number of per-port queues\n"); 2189 netdev_warn(slave_dev, "asymmetric number of per-port queues\n");
2182 2190
2183 priv->per_port_num_tx_queues = num_tx_queues; 2191 priv->per_port_num_tx_queues = num_tx_queues;
2184 2192
@@ -2201,7 +2209,7 @@ static int bcm_sysport_map_queues(struct net_device *dev,
2201 return 0; 2209 return 0;
2202} 2210}
2203 2211
2204static int bcm_sysport_dsa_notifier(struct notifier_block *unused, 2212static int bcm_sysport_dsa_notifier(struct notifier_block *nb,
2205 unsigned long event, void *ptr) 2213 unsigned long event, void *ptr)
2206{ 2214{
2207 struct dsa_notifier_register_info *info; 2215 struct dsa_notifier_register_info *info;
@@ -2211,7 +2219,7 @@ static int bcm_sysport_dsa_notifier(struct notifier_block *unused,
2211 2219
2212 info = ptr; 2220 info = ptr;
2213 2221
2214 return notifier_from_errno(bcm_sysport_map_queues(info->master, info)); 2222 return notifier_from_errno(bcm_sysport_map_queues(nb, info));
2215} 2223}
2216 2224
2217#define REV_FMT "v%2x.%02x" 2225#define REV_FMT "v%2x.%02x"
diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
index 4df282ed22c7..0beee2cc2ddd 100644
--- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
+++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
@@ -61,7 +61,7 @@ static const char hw_stat_gstrings[][ETH_GSTRING_LEN] = {
61static const char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = { 61static const char tx_fw_stat_gstrings[][ETH_GSTRING_LEN] = {
62 "tx-single-collision", 62 "tx-single-collision",
63 "tx-multiple-collision", 63 "tx-multiple-collision",
64 "tx-late-collsion", 64 "tx-late-collision",
65 "tx-aborted-frames", 65 "tx-aborted-frames",
66 "tx-lost-frames", 66 "tx-lost-frames",
67 "tx-carrier-sense-errors", 67 "tx-carrier-sense-errors",
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 4202f9b5b966..6f410235987c 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -942,6 +942,7 @@ struct mvpp2 {
942 struct clk *pp_clk; 942 struct clk *pp_clk;
943 struct clk *gop_clk; 943 struct clk *gop_clk;
944 struct clk *mg_clk; 944 struct clk *mg_clk;
945 struct clk *mg_core_clk;
945 struct clk *axi_clk; 946 struct clk *axi_clk;
946 947
947 /* List of pointers to port structures */ 948 /* List of pointers to port structures */
@@ -8768,18 +8769,27 @@ static int mvpp2_probe(struct platform_device *pdev)
8768 err = clk_prepare_enable(priv->mg_clk); 8769 err = clk_prepare_enable(priv->mg_clk);
8769 if (err < 0) 8770 if (err < 0)
8770 goto err_gop_clk; 8771 goto err_gop_clk;
8772
8773 priv->mg_core_clk = devm_clk_get(&pdev->dev, "mg_core_clk");
8774 if (IS_ERR(priv->mg_core_clk)) {
8775 priv->mg_core_clk = NULL;
8776 } else {
8777 err = clk_prepare_enable(priv->mg_core_clk);
8778 if (err < 0)
8779 goto err_mg_clk;
8780 }
8771 } 8781 }
8772 8782
8773 priv->axi_clk = devm_clk_get(&pdev->dev, "axi_clk"); 8783 priv->axi_clk = devm_clk_get(&pdev->dev, "axi_clk");
8774 if (IS_ERR(priv->axi_clk)) { 8784 if (IS_ERR(priv->axi_clk)) {
8775 err = PTR_ERR(priv->axi_clk); 8785 err = PTR_ERR(priv->axi_clk);
8776 if (err == -EPROBE_DEFER) 8786 if (err == -EPROBE_DEFER)
8777 goto err_gop_clk; 8787 goto err_mg_core_clk;
8778 priv->axi_clk = NULL; 8788 priv->axi_clk = NULL;
8779 } else { 8789 } else {
8780 err = clk_prepare_enable(priv->axi_clk); 8790 err = clk_prepare_enable(priv->axi_clk);
8781 if (err < 0) 8791 if (err < 0)
8782 goto err_gop_clk; 8792 goto err_mg_core_clk;
8783 } 8793 }
8784 8794
8785 /* Get system's tclk rate */ 8795 /* Get system's tclk rate */
@@ -8793,7 +8803,7 @@ static int mvpp2_probe(struct platform_device *pdev)
8793 if (priv->hw_version == MVPP22) { 8803 if (priv->hw_version == MVPP22) {
8794 err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK); 8804 err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK);
8795 if (err) 8805 if (err)
8796 goto err_mg_clk; 8806 goto err_axi_clk;
8797 /* Sadly, the BM pools all share the same register to 8807 /* Sadly, the BM pools all share the same register to
8798 * store the high 32 bits of their address. So they 8808 * store the high 32 bits of their address. So they
8799 * must all have the same high 32 bits, which forces 8809 * must all have the same high 32 bits, which forces
@@ -8801,14 +8811,14 @@ static int mvpp2_probe(struct platform_device *pdev)
8801 */ 8811 */
8802 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 8812 err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
8803 if (err) 8813 if (err)
8804 goto err_mg_clk; 8814 goto err_axi_clk;
8805 } 8815 }
8806 8816
8807 /* Initialize network controller */ 8817 /* Initialize network controller */
8808 err = mvpp2_init(pdev, priv); 8818 err = mvpp2_init(pdev, priv);
8809 if (err < 0) { 8819 if (err < 0) {
8810 dev_err(&pdev->dev, "failed to initialize controller\n"); 8820 dev_err(&pdev->dev, "failed to initialize controller\n");
8811 goto err_mg_clk; 8821 goto err_axi_clk;
8812 } 8822 }
8813 8823
8814 /* Initialize ports */ 8824 /* Initialize ports */
@@ -8821,7 +8831,7 @@ static int mvpp2_probe(struct platform_device *pdev)
8821 if (priv->port_count == 0) { 8831 if (priv->port_count == 0) {
8822 dev_err(&pdev->dev, "no ports enabled\n"); 8832 dev_err(&pdev->dev, "no ports enabled\n");
8823 err = -ENODEV; 8833 err = -ENODEV;
8824 goto err_mg_clk; 8834 goto err_axi_clk;
8825 } 8835 }
8826 8836
8827 /* Statistics must be gathered regularly because some of them (like 8837 /* Statistics must be gathered regularly because some of them (like
@@ -8849,8 +8859,13 @@ err_port_probe:
8849 mvpp2_port_remove(priv->port_list[i]); 8859 mvpp2_port_remove(priv->port_list[i]);
8850 i++; 8860 i++;
8851 } 8861 }
8852err_mg_clk: 8862err_axi_clk:
8853 clk_disable_unprepare(priv->axi_clk); 8863 clk_disable_unprepare(priv->axi_clk);
8864
8865err_mg_core_clk:
8866 if (priv->hw_version == MVPP22)
8867 clk_disable_unprepare(priv->mg_core_clk);
8868err_mg_clk:
8854 if (priv->hw_version == MVPP22) 8869 if (priv->hw_version == MVPP22)
8855 clk_disable_unprepare(priv->mg_clk); 8870 clk_disable_unprepare(priv->mg_clk);
8856err_gop_clk: 8871err_gop_clk:
@@ -8897,6 +8912,7 @@ static int mvpp2_remove(struct platform_device *pdev)
8897 return 0; 8912 return 0;
8898 8913
8899 clk_disable_unprepare(priv->axi_clk); 8914 clk_disable_unprepare(priv->axi_clk);
8915 clk_disable_unprepare(priv->mg_core_clk);
8900 clk_disable_unprepare(priv->mg_clk); 8916 clk_disable_unprepare(priv->mg_clk);
8901 clk_disable_unprepare(priv->pp_clk); 8917 clk_disable_unprepare(priv->pp_clk);
8902 clk_disable_unprepare(priv->gop_clk); 8918 clk_disable_unprepare(priv->gop_clk);
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index bfef69235d71..211578ffc70d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1317,7 +1317,7 @@ static int mlx4_mf_unbond(struct mlx4_dev *dev)
1317 1317
1318 ret = mlx4_unbond_fs_rules(dev); 1318 ret = mlx4_unbond_fs_rules(dev);
1319 if (ret) 1319 if (ret)
1320 mlx4_warn(dev, "multifunction unbond for flow rules failedi (%d)\n", ret); 1320 mlx4_warn(dev, "multifunction unbond for flow rules failed (%d)\n", ret);
1321 ret1 = mlx4_unbond_mac_table(dev); 1321 ret1 = mlx4_unbond_mac_table(dev);
1322 if (ret1) { 1322 if (ret1) {
1323 mlx4_warn(dev, "multifunction unbond for MAC table failed (%d)\n", ret1); 1323 mlx4_warn(dev, "multifunction unbond for MAC table failed (%d)\n", ret1);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 3d46ef48d5b8..c641d5656b2d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -1007,12 +1007,14 @@ static void mlx5e_trust_update_sq_inline_mode(struct mlx5e_priv *priv)
1007 1007
1008 mutex_lock(&priv->state_lock); 1008 mutex_lock(&priv->state_lock);
1009 1009
1010 if (!test_bit(MLX5E_STATE_OPENED, &priv->state))
1011 goto out;
1012
1013 new_channels.params = priv->channels.params; 1010 new_channels.params = priv->channels.params;
1014 mlx5e_trust_update_tx_min_inline_mode(priv, &new_channels.params); 1011 mlx5e_trust_update_tx_min_inline_mode(priv, &new_channels.params);
1015 1012
1013 if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
1014 priv->channels.params = new_channels.params;
1015 goto out;
1016 }
1017
1016 /* Skip if tx_min_inline is the same */ 1018 /* Skip if tx_min_inline is the same */
1017 if (new_channels.params.tx_min_inline_mode == 1019 if (new_channels.params.tx_min_inline_mode ==
1018 priv->channels.params.tx_min_inline_mode) 1020 priv->channels.params.tx_min_inline_mode)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index d8f68e4d1018..876c3e4c6193 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -877,13 +877,14 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = {
877}; 877};
878 878
879static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev, 879static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
880 struct mlx5e_params *params) 880 struct mlx5e_params *params, u16 mtu)
881{ 881{
882 u8 cq_period_mode = MLX5_CAP_GEN(mdev, cq_period_start_from_cqe) ? 882 u8 cq_period_mode = MLX5_CAP_GEN(mdev, cq_period_start_from_cqe) ?
883 MLX5_CQ_PERIOD_MODE_START_FROM_CQE : 883 MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
884 MLX5_CQ_PERIOD_MODE_START_FROM_EQE; 884 MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
885 885
886 params->hard_mtu = MLX5E_ETH_HARD_MTU; 886 params->hard_mtu = MLX5E_ETH_HARD_MTU;
887 params->sw_mtu = mtu;
887 params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE; 888 params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE;
888 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST; 889 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST;
889 params->log_rq_mtu_frames = MLX5E_REP_PARAMS_LOG_RQ_SIZE; 890 params->log_rq_mtu_frames = MLX5E_REP_PARAMS_LOG_RQ_SIZE;
@@ -931,7 +932,7 @@ static void mlx5e_init_rep(struct mlx5_core_dev *mdev,
931 932
932 priv->channels.params.num_channels = profile->max_nch(mdev); 933 priv->channels.params.num_channels = profile->max_nch(mdev);
933 934
934 mlx5e_build_rep_params(mdev, &priv->channels.params); 935 mlx5e_build_rep_params(mdev, &priv->channels.params, netdev->mtu);
935 mlx5e_build_rep_netdev(netdev); 936 mlx5e_build_rep_netdev(netdev);
936 937
937 mlx5e_timestamp_init(priv); 938 mlx5e_timestamp_init(priv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
index 707976482c09..027f54ac1ca2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
@@ -290,7 +290,7 @@ static int mlx5e_test_loopback(struct mlx5e_priv *priv)
290 290
291 if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) { 291 if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
292 netdev_err(priv->netdev, 292 netdev_err(priv->netdev,
293 "\tCan't perform loobpack test while device is down\n"); 293 "\tCan't perform loopback test while device is down\n");
294 return -ENODEV; 294 return -ENODEV;
295 } 295 }
296 296
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 4197001f9801..3c534fc43400 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -1864,7 +1864,8 @@ static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
1864 } 1864 }
1865 1865
1866 ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol); 1866 ip_proto = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ip_protocol);
1867 if (modify_ip_header && ip_proto != IPPROTO_TCP && ip_proto != IPPROTO_UDP) { 1867 if (modify_ip_header && ip_proto != IPPROTO_TCP &&
1868 ip_proto != IPPROTO_UDP && ip_proto != IPPROTO_ICMP) {
1868 pr_info("can't offload re-write of ip proto %d\n", ip_proto); 1869 pr_info("can't offload re-write of ip proto %d\n", ip_proto);
1869 return false; 1870 return false;
1870 } 1871 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 20297108528a..5532aa3675c7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -255,7 +255,7 @@ mlx5e_txwqe_build_dsegs(struct mlx5e_txqsq *sq, struct sk_buff *skb,
255 dma_addr = dma_map_single(sq->pdev, skb_data, headlen, 255 dma_addr = dma_map_single(sq->pdev, skb_data, headlen,
256 DMA_TO_DEVICE); 256 DMA_TO_DEVICE);
257 if (unlikely(dma_mapping_error(sq->pdev, dma_addr))) 257 if (unlikely(dma_mapping_error(sq->pdev, dma_addr)))
258 return -ENOMEM; 258 goto dma_unmap_wqe_err;
259 259
260 dseg->addr = cpu_to_be64(dma_addr); 260 dseg->addr = cpu_to_be64(dma_addr);
261 dseg->lkey = sq->mkey_be; 261 dseg->lkey = sq->mkey_be;
@@ -273,7 +273,7 @@ mlx5e_txwqe_build_dsegs(struct mlx5e_txqsq *sq, struct sk_buff *skb,
273 dma_addr = skb_frag_dma_map(sq->pdev, frag, 0, fsz, 273 dma_addr = skb_frag_dma_map(sq->pdev, frag, 0, fsz,
274 DMA_TO_DEVICE); 274 DMA_TO_DEVICE);
275 if (unlikely(dma_mapping_error(sq->pdev, dma_addr))) 275 if (unlikely(dma_mapping_error(sq->pdev, dma_addr)))
276 return -ENOMEM; 276 goto dma_unmap_wqe_err;
277 277
278 dseg->addr = cpu_to_be64(dma_addr); 278 dseg->addr = cpu_to_be64(dma_addr);
279 dseg->lkey = sq->mkey_be; 279 dseg->lkey = sq->mkey_be;
@@ -285,6 +285,10 @@ mlx5e_txwqe_build_dsegs(struct mlx5e_txqsq *sq, struct sk_buff *skb,
285 } 285 }
286 286
287 return num_dma; 287 return num_dma;
288
289dma_unmap_wqe_err:
290 mlx5e_dma_unmap_wqe_err(sq, num_dma);
291 return -ENOMEM;
288} 292}
289 293
290static inline void 294static inline void
@@ -380,17 +384,15 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
380 num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb_data, headlen, 384 num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb_data, headlen,
381 (struct mlx5_wqe_data_seg *)cseg + ds_cnt); 385 (struct mlx5_wqe_data_seg *)cseg + ds_cnt);
382 if (unlikely(num_dma < 0)) 386 if (unlikely(num_dma < 0))
383 goto dma_unmap_wqe_err; 387 goto err_drop;
384 388
385 mlx5e_txwqe_complete(sq, skb, opcode, ds_cnt + num_dma, 389 mlx5e_txwqe_complete(sq, skb, opcode, ds_cnt + num_dma,
386 num_bytes, num_dma, wi, cseg); 390 num_bytes, num_dma, wi, cseg);
387 391
388 return NETDEV_TX_OK; 392 return NETDEV_TX_OK;
389 393
390dma_unmap_wqe_err: 394err_drop:
391 sq->stats.dropped++; 395 sq->stats.dropped++;
392 mlx5e_dma_unmap_wqe_err(sq, wi->num_dma);
393
394 dev_kfree_skb_any(skb); 396 dev_kfree_skb_any(skb);
395 397
396 return NETDEV_TX_OK; 398 return NETDEV_TX_OK;
@@ -645,17 +647,15 @@ netdev_tx_t mlx5i_sq_xmit(struct mlx5e_txqsq *sq, struct sk_buff *skb,
645 num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb_data, headlen, 647 num_dma = mlx5e_txwqe_build_dsegs(sq, skb, skb_data, headlen,
646 (struct mlx5_wqe_data_seg *)cseg + ds_cnt); 648 (struct mlx5_wqe_data_seg *)cseg + ds_cnt);
647 if (unlikely(num_dma < 0)) 649 if (unlikely(num_dma < 0))
648 goto dma_unmap_wqe_err; 650 goto err_drop;
649 651
650 mlx5e_txwqe_complete(sq, skb, opcode, ds_cnt + num_dma, 652 mlx5e_txwqe_complete(sq, skb, opcode, ds_cnt + num_dma,
651 num_bytes, num_dma, wi, cseg); 653 num_bytes, num_dma, wi, cseg);
652 654
653 return NETDEV_TX_OK; 655 return NETDEV_TX_OK;
654 656
655dma_unmap_wqe_err: 657err_drop:
656 sq->stats.dropped++; 658 sq->stats.dropped++;
657 mlx5e_dma_unmap_wqe_err(sq, wi->num_dma);
658
659 dev_kfree_skb_any(skb); 659 dev_kfree_skb_any(skb);
660 660
661 return NETDEV_TX_OK; 661 return NETDEV_TX_OK;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index de51e7c39bc8..c39c1692e674 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -187,6 +187,7 @@ static void del_sw_ns(struct fs_node *node);
187static void del_sw_hw_rule(struct fs_node *node); 187static void del_sw_hw_rule(struct fs_node *node);
188static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1, 188static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
189 struct mlx5_flow_destination *d2); 189 struct mlx5_flow_destination *d2);
190static void cleanup_root_ns(struct mlx5_flow_root_namespace *root_ns);
190static struct mlx5_flow_rule * 191static struct mlx5_flow_rule *
191find_flow_rule(struct fs_fte *fte, 192find_flow_rule(struct fs_fte *fte,
192 struct mlx5_flow_destination *dest); 193 struct mlx5_flow_destination *dest);
@@ -481,7 +482,8 @@ static void del_sw_hw_rule(struct fs_node *node)
481 482
482 if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER && 483 if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER &&
483 --fte->dests_size) { 484 --fte->dests_size) {
484 modify_mask = BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION); 485 modify_mask = BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION) |
486 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_COUNTERS);
485 fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_COUNT; 487 fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_COUNT;
486 update_fte = true; 488 update_fte = true;
487 goto out; 489 goto out;
@@ -2351,23 +2353,27 @@ static int create_anchor_flow_table(struct mlx5_flow_steering *steering)
2351 2353
2352static int init_root_ns(struct mlx5_flow_steering *steering) 2354static int init_root_ns(struct mlx5_flow_steering *steering)
2353{ 2355{
2356 int err;
2357
2354 steering->root_ns = create_root_ns(steering, FS_FT_NIC_RX); 2358 steering->root_ns = create_root_ns(steering, FS_FT_NIC_RX);
2355 if (!steering->root_ns) 2359 if (!steering->root_ns)
2356 goto cleanup; 2360 return -ENOMEM;
2357 2361
2358 if (init_root_tree(steering, &root_fs, &steering->root_ns->ns.node)) 2362 err = init_root_tree(steering, &root_fs, &steering->root_ns->ns.node);
2359 goto cleanup; 2363 if (err)
2364 goto out_err;
2360 2365
2361 set_prio_attrs(steering->root_ns); 2366 set_prio_attrs(steering->root_ns);
2362 2367 err = create_anchor_flow_table(steering);
2363 if (create_anchor_flow_table(steering)) 2368 if (err)
2364 goto cleanup; 2369 goto out_err;
2365 2370
2366 return 0; 2371 return 0;
2367 2372
2368cleanup: 2373out_err:
2369 mlx5_cleanup_fs(steering->dev); 2374 cleanup_root_ns(steering->root_ns);
2370 return -ENOMEM; 2375 steering->root_ns = NULL;
2376 return err;
2371} 2377}
2372 2378
2373static void clean_tree(struct fs_node *node) 2379static void clean_tree(struct fs_node *node)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index c11c9a635866..4ed01182a82c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -1718,13 +1718,11 @@ __mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port,
1718 struct net_device *dev = mlxsw_sp_port->dev; 1718 struct net_device *dev = mlxsw_sp_port->dev;
1719 int err; 1719 int err;
1720 1720
1721 if (bridge_port->bridge_device->multicast_enabled) { 1721 if (bridge_port->bridge_device->multicast_enabled &&
1722 if (bridge_port->bridge_device->multicast_enabled) { 1722 !bridge_port->mrouter) {
1723 err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, 1723 err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, false);
1724 false); 1724 if (err)
1725 if (err) 1725 netdev_err(dev, "Unable to remove port from SMID\n");
1726 netdev_err(dev, "Unable to remove port from SMID\n");
1727 }
1728 } 1726 }
1729 1727
1730 err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid); 1728 err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid);
diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c
index b3567a596fc1..80df9a5d4217 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/action.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/action.c
@@ -183,17 +183,21 @@ static int
183nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun, 183nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun,
184 const struct tc_action *action, 184 const struct tc_action *action,
185 struct nfp_fl_pre_tunnel *pre_tun, 185 struct nfp_fl_pre_tunnel *pre_tun,
186 enum nfp_flower_tun_type tun_type) 186 enum nfp_flower_tun_type tun_type,
187 struct net_device *netdev)
187{ 188{
188 size_t act_size = sizeof(struct nfp_fl_set_ipv4_udp_tun); 189 size_t act_size = sizeof(struct nfp_fl_set_ipv4_udp_tun);
189 struct ip_tunnel_info *ip_tun = tcf_tunnel_info(action); 190 struct ip_tunnel_info *ip_tun = tcf_tunnel_info(action);
190 u32 tmp_set_ip_tun_type_index = 0; 191 u32 tmp_set_ip_tun_type_index = 0;
191 /* Currently support one pre-tunnel so index is always 0. */ 192 /* Currently support one pre-tunnel so index is always 0. */
192 int pretun_idx = 0; 193 int pretun_idx = 0;
194 struct net *net;
193 195
194 if (ip_tun->options_len) 196 if (ip_tun->options_len)
195 return -EOPNOTSUPP; 197 return -EOPNOTSUPP;
196 198
199 net = dev_net(netdev);
200
197 set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL; 201 set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_TUNNEL;
198 set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ; 202 set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ;
199 203
@@ -204,6 +208,7 @@ nfp_fl_set_ipv4_udp_tun(struct nfp_fl_set_ipv4_udp_tun *set_tun,
204 208
205 set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index); 209 set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index);
206 set_tun->tun_id = ip_tun->key.tun_id; 210 set_tun->tun_id = ip_tun->key.tun_id;
211 set_tun->ttl = net->ipv4.sysctl_ip_default_ttl;
207 212
208 /* Complete pre_tunnel action. */ 213 /* Complete pre_tunnel action. */
209 pre_tun->ipv4_dst = ip_tun->key.u.ipv4.dst; 214 pre_tun->ipv4_dst = ip_tun->key.u.ipv4.dst;
@@ -511,7 +516,8 @@ nfp_flower_loop_action(const struct tc_action *a,
511 *a_len += sizeof(struct nfp_fl_pre_tunnel); 516 *a_len += sizeof(struct nfp_fl_pre_tunnel);
512 517
513 set_tun = (void *)&nfp_fl->action_data[*a_len]; 518 set_tun = (void *)&nfp_fl->action_data[*a_len];
514 err = nfp_fl_set_ipv4_udp_tun(set_tun, a, pre_tun, *tun_type); 519 err = nfp_fl_set_ipv4_udp_tun(set_tun, a, pre_tun, *tun_type,
520 netdev);
515 if (err) 521 if (err)
516 return err; 522 return err;
517 *a_len += sizeof(struct nfp_fl_set_ipv4_udp_tun); 523 *a_len += sizeof(struct nfp_fl_set_ipv4_udp_tun);
diff --git a/drivers/net/ethernet/netronome/nfp/flower/cmsg.h b/drivers/net/ethernet/netronome/nfp/flower/cmsg.h
index b6c0fd053a50..bee4367a2c38 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/cmsg.h
+++ b/drivers/net/ethernet/netronome/nfp/flower/cmsg.h
@@ -190,7 +190,10 @@ struct nfp_fl_set_ipv4_udp_tun {
190 __be16 reserved; 190 __be16 reserved;
191 __be64 tun_id __packed; 191 __be64 tun_id __packed;
192 __be32 tun_type_index; 192 __be32 tun_type_index;
193 __be32 extra[3]; 193 __be16 reserved2;
194 u8 ttl;
195 u8 reserved3;
196 __be32 extra[2];
194}; 197};
195 198
196/* Metadata with L2 (1W/4B) 199/* Metadata with L2 (1W/4B)
diff --git a/drivers/net/ethernet/netronome/nfp/flower/main.c b/drivers/net/ethernet/netronome/nfp/flower/main.c
index ad02592a82b7..a997e34bcec2 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/main.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/main.c
@@ -360,7 +360,7 @@ nfp_flower_spawn_phy_reprs(struct nfp_app *app, struct nfp_flower_priv *priv)
360 } 360 }
361 361
362 SET_NETDEV_DEV(repr, &priv->nn->pdev->dev); 362 SET_NETDEV_DEV(repr, &priv->nn->pdev->dev);
363 nfp_net_get_mac_addr(app->pf, port); 363 nfp_net_get_mac_addr(app->pf, repr, port);
364 364
365 cmsg_port_id = nfp_flower_cmsg_phys_port(phys_port); 365 cmsg_port_id = nfp_flower_cmsg_phys_port(phys_port);
366 err = nfp_repr_init(app, repr, 366 err = nfp_repr_init(app, repr,
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c b/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c
index 2a2f2fbc8850..b9618c37403f 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_app_nic.c
@@ -69,7 +69,7 @@ int nfp_app_nic_vnic_alloc(struct nfp_app *app, struct nfp_net *nn,
69 if (err) 69 if (err)
70 return err < 0 ? err : 0; 70 return err < 0 ? err : 0;
71 71
72 nfp_net_get_mac_addr(app->pf, nn->port); 72 nfp_net_get_mac_addr(app->pf, nn->dp.netdev, nn->port);
73 73
74 return 0; 74 return 0;
75} 75}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_main.h b/drivers/net/ethernet/netronome/nfp/nfp_main.h
index add46e28212b..42211083b51f 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_main.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_main.h
@@ -171,7 +171,9 @@ void nfp_net_pci_remove(struct nfp_pf *pf);
171int nfp_hwmon_register(struct nfp_pf *pf); 171int nfp_hwmon_register(struct nfp_pf *pf);
172void nfp_hwmon_unregister(struct nfp_pf *pf); 172void nfp_hwmon_unregister(struct nfp_pf *pf);
173 173
174void nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_port *port); 174void
175nfp_net_get_mac_addr(struct nfp_pf *pf, struct net_device *netdev,
176 struct nfp_port *port);
175 177
176bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb); 178bool nfp_ctrl_tx(struct nfp_net *nn, struct sk_buff *skb);
177 179
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index 15fa47f622aa..45cd2092e498 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -67,23 +67,26 @@
67/** 67/**
68 * nfp_net_get_mac_addr() - Get the MAC address. 68 * nfp_net_get_mac_addr() - Get the MAC address.
69 * @pf: NFP PF handle 69 * @pf: NFP PF handle
70 * @netdev: net_device to set MAC address on
70 * @port: NFP port structure 71 * @port: NFP port structure
71 * 72 *
72 * First try to get the MAC address from NSP ETH table. If that 73 * First try to get the MAC address from NSP ETH table. If that
73 * fails generate a random address. 74 * fails generate a random address.
74 */ 75 */
75void nfp_net_get_mac_addr(struct nfp_pf *pf, struct nfp_port *port) 76void
77nfp_net_get_mac_addr(struct nfp_pf *pf, struct net_device *netdev,
78 struct nfp_port *port)
76{ 79{
77 struct nfp_eth_table_port *eth_port; 80 struct nfp_eth_table_port *eth_port;
78 81
79 eth_port = __nfp_port_get_eth_port(port); 82 eth_port = __nfp_port_get_eth_port(port);
80 if (!eth_port) { 83 if (!eth_port) {
81 eth_hw_addr_random(port->netdev); 84 eth_hw_addr_random(netdev);
82 return; 85 return;
83 } 86 }
84 87
85 ether_addr_copy(port->netdev->dev_addr, eth_port->mac_addr); 88 ether_addr_copy(netdev->dev_addr, eth_port->mac_addr);
86 ether_addr_copy(port->netdev->perm_addr, eth_port->mac_addr); 89 ether_addr_copy(netdev->perm_addr, eth_port->mac_addr);
87} 90}
88 91
89static struct nfp_eth_table_port * 92static struct nfp_eth_table_port *
@@ -511,16 +514,18 @@ static int nfp_net_pci_map_mem(struct nfp_pf *pf)
511 return PTR_ERR(mem); 514 return PTR_ERR(mem);
512 } 515 }
513 516
514 min_size = NFP_MAC_STATS_SIZE * (pf->eth_tbl->max_index + 1); 517 if (pf->eth_tbl) {
515 pf->mac_stats_mem = nfp_rtsym_map(pf->rtbl, "_mac_stats", 518 min_size = NFP_MAC_STATS_SIZE * (pf->eth_tbl->max_index + 1);
516 "net.macstats", min_size, 519 pf->mac_stats_mem = nfp_rtsym_map(pf->rtbl, "_mac_stats",
517 &pf->mac_stats_bar); 520 "net.macstats", min_size,
518 if (IS_ERR(pf->mac_stats_mem)) { 521 &pf->mac_stats_bar);
519 if (PTR_ERR(pf->mac_stats_mem) != -ENOENT) { 522 if (IS_ERR(pf->mac_stats_mem)) {
520 err = PTR_ERR(pf->mac_stats_mem); 523 if (PTR_ERR(pf->mac_stats_mem) != -ENOENT) {
521 goto err_unmap_ctrl; 524 err = PTR_ERR(pf->mac_stats_mem);
525 goto err_unmap_ctrl;
526 }
527 pf->mac_stats_mem = NULL;
522 } 528 }
523 pf->mac_stats_mem = NULL;
524 } 529 }
525 530
526 pf->vf_cfg_mem = nfp_net_pf_map_rtsym(pf, "net.vfcfg", 531 pf->vf_cfg_mem = nfp_net_pf_map_rtsym(pf, "net.vfcfg",
diff --git a/drivers/net/ethernet/qlogic/qed/qed_ll2.c b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
index 74fc626b1ec1..38502815d681 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_ll2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_ll2.c
@@ -2370,7 +2370,7 @@ static int qed_ll2_start_xmit(struct qed_dev *cdev, struct sk_buff *skb)
2370 u8 flags = 0; 2370 u8 flags = 0;
2371 2371
2372 if (unlikely(skb->ip_summed != CHECKSUM_NONE)) { 2372 if (unlikely(skb->ip_summed != CHECKSUM_NONE)) {
2373 DP_INFO(cdev, "Cannot transmit a checksumed packet\n"); 2373 DP_INFO(cdev, "Cannot transmit a checksummed packet\n");
2374 return -EINVAL; 2374 return -EINVAL;
2375 } 2375 }
2376 2376
diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
index fb7c2d1562ae..6acfd43c1a4f 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -848,7 +848,7 @@ int qed_roce_query_qp(struct qed_hwfn *p_hwfn,
848 848
849 if (!(qp->resp_offloaded)) { 849 if (!(qp->resp_offloaded)) {
850 DP_NOTICE(p_hwfn, 850 DP_NOTICE(p_hwfn,
851 "The responder's qp should be offloded before requester's\n"); 851 "The responder's qp should be offloaded before requester's\n");
852 return -EINVAL; 852 return -EINVAL;
853 } 853 }
854 854
diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index d24b47b8e0b2..d118da5a10a2 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -2224,7 +2224,7 @@ static void rtl8139_poll_controller(struct net_device *dev)
2224 struct rtl8139_private *tp = netdev_priv(dev); 2224 struct rtl8139_private *tp = netdev_priv(dev);
2225 const int irq = tp->pci_dev->irq; 2225 const int irq = tp->pci_dev->irq;
2226 2226
2227 disable_irq(irq); 2227 disable_irq_nosync(irq);
2228 rtl8139_interrupt(irq, dev); 2228 rtl8139_interrupt(irq, dev);
2229 enable_irq(irq); 2229 enable_irq(irq);
2230} 2230}
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 63036d9bf3e6..d90a7b1f4088 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -4784,8 +4784,9 @@ expire:
4784 * will set rule->filter_id to EFX_ARFS_FILTER_ID_PENDING, meaning that 4784 * will set rule->filter_id to EFX_ARFS_FILTER_ID_PENDING, meaning that
4785 * the rule is not removed by efx_rps_hash_del() below. 4785 * the rule is not removed by efx_rps_hash_del() below.
4786 */ 4786 */
4787 ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority, 4787 if (ret)
4788 filter_idx, true) == 0; 4788 ret = efx_ef10_filter_remove_internal(efx, 1U << spec->priority,
4789 filter_idx, true) == 0;
4789 /* While we can't safely dereference rule (we dropped the lock), we can 4790 /* While we can't safely dereference rule (we dropped the lock), we can
4790 * still test it for NULL. 4791 * still test it for NULL.
4791 */ 4792 */
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 64a94f242027..d2e254f2f72b 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -839,6 +839,8 @@ static void efx_filter_rfs_work(struct work_struct *data)
839 int rc; 839 int rc;
840 840
841 rc = efx->type->filter_insert(efx, &req->spec, true); 841 rc = efx->type->filter_insert(efx, &req->spec, true);
842 if (rc >= 0)
843 rc %= efx->type->max_rx_ip_filters;
842 if (efx->rps_hash_table) { 844 if (efx->rps_hash_table) {
843 spin_lock_bh(&efx->rps_hash_lock); 845 spin_lock_bh(&efx->rps_hash_lock);
844 rule = efx_rps_hash_find(efx, &req->spec); 846 rule = efx_rps_hash_find(efx, &req->spec);
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 74f828412055..28d893b93d30 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1340,6 +1340,8 @@ static inline void cpsw_add_dual_emac_def_ale_entries(
1340 cpsw_ale_add_ucast(cpsw->ale, priv->mac_addr, 1340 cpsw_ale_add_ucast(cpsw->ale, priv->mac_addr,
1341 HOST_PORT_NUM, ALE_VLAN | 1341 HOST_PORT_NUM, ALE_VLAN |
1342 ALE_SECURE, slave->port_vlan); 1342 ALE_SECURE, slave->port_vlan);
1343 cpsw_ale_control_set(cpsw->ale, slave_port,
1344 ALE_PORT_DROP_UNKNOWN_VLAN, 1);
1343} 1345}
1344 1346
1345static void soft_reset_slave(struct cpsw_slave *slave) 1347static void soft_reset_slave(struct cpsw_slave *slave)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ac23322a32e1..9e4ba8e80a18 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -535,8 +535,17 @@ static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id,
535 535
536 /* Grab the bits from PHYIR1, and put them in the upper half */ 536 /* Grab the bits from PHYIR1, and put them in the upper half */
537 phy_reg = mdiobus_read(bus, addr, MII_PHYSID1); 537 phy_reg = mdiobus_read(bus, addr, MII_PHYSID1);
538 if (phy_reg < 0) 538 if (phy_reg < 0) {
539 /* if there is no device, return without an error so scanning
540 * the bus works properly
541 */
542 if (phy_reg == -EIO || phy_reg == -ENODEV) {
543 *phy_id = 0xffffffff;
544 return 0;
545 }
546
539 return -EIO; 547 return -EIO;
548 }
540 549
541 *phy_id = (phy_reg & 0xffff) << 16; 550 *phy_id = (phy_reg & 0xffff) << 16;
542 551
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index c853e7410f5a..42565dd33aa6 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -1098,6 +1098,7 @@ static const struct usb_device_id products[] = {
1098 {QMI_FIXED_INTF(0x05c6, 0x9080, 8)}, 1098 {QMI_FIXED_INTF(0x05c6, 0x9080, 8)},
1099 {QMI_FIXED_INTF(0x05c6, 0x9083, 3)}, 1099 {QMI_FIXED_INTF(0x05c6, 0x9083, 3)},
1100 {QMI_FIXED_INTF(0x05c6, 0x9084, 4)}, 1100 {QMI_FIXED_INTF(0x05c6, 0x9084, 4)},
1101 {QMI_FIXED_INTF(0x05c6, 0x90b2, 3)}, /* ublox R410M */
1101 {QMI_FIXED_INTF(0x05c6, 0x920d, 0)}, 1102 {QMI_FIXED_INTF(0x05c6, 0x920d, 0)},
1102 {QMI_FIXED_INTF(0x05c6, 0x920d, 5)}, 1103 {QMI_FIXED_INTF(0x05c6, 0x920d, 5)},
1103 {QMI_QUIRK_SET_DTR(0x05c6, 0x9625, 4)}, /* YUGA CLM920-NC5 */ 1104 {QMI_QUIRK_SET_DTR(0x05c6, 0x9625, 4)}, /* YUGA CLM920-NC5 */
@@ -1343,6 +1344,18 @@ static int qmi_wwan_probe(struct usb_interface *intf,
1343 id->driver_info = (unsigned long)&qmi_wwan_info; 1344 id->driver_info = (unsigned long)&qmi_wwan_info;
1344 } 1345 }
1345 1346
1347 /* There are devices where the same interface number can be
1348 * configured as different functions. We should only bind to
1349 * vendor specific functions when matching on interface number
1350 */
1351 if (id->match_flags & USB_DEVICE_ID_MATCH_INT_NUMBER &&
1352 desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) {
1353 dev_dbg(&intf->dev,
1354 "Rejecting interface number match for class %02x\n",
1355 desc->bInterfaceClass);
1356 return -ENODEV;
1357 }
1358
1346 /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */ 1359 /* Quectel EC20 quirk where we've QMI on interface 4 instead of 0 */
1347 if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) { 1360 if (quectel_ec20_detected(intf) && desc->bInterfaceNumber == 0) {
1348 dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n"); 1361 dev_dbg(&intf->dev, "Quectel EC20 quirk, skipping interface 0\n");
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index 9277f4c2bfeb..94e177d7c9b5 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -459,7 +459,7 @@ static void brcmf_fw_free_request(struct brcmf_fw_request *req)
459 kfree(req); 459 kfree(req);
460} 460}
461 461
462static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx) 462static int brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
463{ 463{
464 struct brcmf_fw *fwctx = ctx; 464 struct brcmf_fw *fwctx = ctx;
465 struct brcmf_fw_item *cur; 465 struct brcmf_fw_item *cur;
@@ -498,13 +498,10 @@ static void brcmf_fw_request_nvram_done(const struct firmware *fw, void *ctx)
498 brcmf_dbg(TRACE, "nvram %p len %d\n", nvram, nvram_length); 498 brcmf_dbg(TRACE, "nvram %p len %d\n", nvram, nvram_length);
499 cur->nv_data.data = nvram; 499 cur->nv_data.data = nvram;
500 cur->nv_data.len = nvram_length; 500 cur->nv_data.len = nvram_length;
501 return; 501 return 0;
502 502
503fail: 503fail:
504 brcmf_dbg(TRACE, "failed: dev=%s\n", dev_name(fwctx->dev)); 504 return -ENOENT;
505 fwctx->done(fwctx->dev, -ENOENT, NULL);
506 brcmf_fw_free_request(fwctx->req);
507 kfree(fwctx);
508} 505}
509 506
510static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async) 507static int brcmf_fw_request_next_item(struct brcmf_fw *fwctx, bool async)
@@ -553,20 +550,27 @@ static void brcmf_fw_request_done(const struct firmware *fw, void *ctx)
553 brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path, 550 brcmf_dbg(TRACE, "enter: firmware %s %sfound\n", cur->path,
554 fw ? "" : "not "); 551 fw ? "" : "not ");
555 552
556 if (fw) { 553 if (!fw)
557 if (cur->type == BRCMF_FW_TYPE_BINARY)
558 cur->binary = fw;
559 else if (cur->type == BRCMF_FW_TYPE_NVRAM)
560 brcmf_fw_request_nvram_done(fw, fwctx);
561 else
562 release_firmware(fw);
563 } else if (cur->type == BRCMF_FW_TYPE_NVRAM) {
564 brcmf_fw_request_nvram_done(NULL, fwctx);
565 } else if (!(cur->flags & BRCMF_FW_REQF_OPTIONAL)) {
566 ret = -ENOENT; 554 ret = -ENOENT;
555
556 switch (cur->type) {
557 case BRCMF_FW_TYPE_NVRAM:
558 ret = brcmf_fw_request_nvram_done(fw, fwctx);
559 break;
560 case BRCMF_FW_TYPE_BINARY:
561 cur->binary = fw;
562 break;
563 default:
564 /* something fishy here so bail out early */
565 brcmf_err("unknown fw type: %d\n", cur->type);
566 release_firmware(fw);
567 ret = -EINVAL;
567 goto fail; 568 goto fail;
568 } 569 }
569 570
571 if (ret < 0 && !(cur->flags & BRCMF_FW_REQF_OPTIONAL))
572 goto fail;
573
570 do { 574 do {
571 if (++fwctx->curpos == fwctx->req->n_items) { 575 if (++fwctx->curpos == fwctx->req->n_items) {
572 ret = 0; 576 ret = 0;
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
index 7af3a0f51b77..a17c4a79b8d4 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/scan.h
@@ -8,6 +8,7 @@
8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 10 * Copyright(c) 2016 - 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 version 2 of the GNU General Public License as 14 * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +31,7 @@
30 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
33 * Copyright(c) 2018 Intel Corporation 34 * Copyright(c) 2018 Intel Corporation
34 * All rights reserved. 35 * All rights reserved.
35 * 36 *
36 * Redistribution and use in source and binary forms, with or without 37 * Redistribution and use in source and binary forms, with or without
@@ -749,13 +750,9 @@ struct iwl_scan_req_umac {
749} __packed; 750} __packed;
750 751
751#define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac) 752#define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac)
752#define IWL_SCAN_REQ_UMAC_SIZE_V7 (sizeof(struct iwl_scan_req_umac) - \ 753#define IWL_SCAN_REQ_UMAC_SIZE_V7 48
753 4 * sizeof(u8)) 754#define IWL_SCAN_REQ_UMAC_SIZE_V6 44
754#define IWL_SCAN_REQ_UMAC_SIZE_V6 (sizeof(struct iwl_scan_req_umac) - \ 755#define IWL_SCAN_REQ_UMAC_SIZE_V1 36
755 2 * sizeof(u8) - sizeof(__le16))
756#define IWL_SCAN_REQ_UMAC_SIZE_V1 (sizeof(struct iwl_scan_req_umac) - \
757 2 * sizeof(__le32) - 2 * sizeof(u8) - \
758 sizeof(__le16))
759 756
760/** 757/**
761 * struct iwl_umac_scan_abort 758 * struct iwl_umac_scan_abort
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index 8928613e033e..ca0174680af9 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -76,6 +76,7 @@
76#include "iwl-io.h" 76#include "iwl-io.h"
77#include "iwl-csr.h" 77#include "iwl-csr.h"
78#include "fw/acpi.h" 78#include "fw/acpi.h"
79#include "fw/api/nvm-reg.h"
79 80
80/* NVM offsets (in words) definitions */ 81/* NVM offsets (in words) definitions */
81enum nvm_offsets { 82enum nvm_offsets {
@@ -146,8 +147,8 @@ static const u8 iwl_ext_nvm_channels[] = {
146 149, 153, 157, 161, 165, 169, 173, 177, 181 147 149, 153, 157, 161, 165, 169, 173, 177, 181
147}; 148};
148 149
149#define IWL_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels) 150#define IWL_NVM_NUM_CHANNELS ARRAY_SIZE(iwl_nvm_channels)
150#define IWL_NUM_CHANNELS_EXT ARRAY_SIZE(iwl_ext_nvm_channels) 151#define IWL_NVM_NUM_CHANNELS_EXT ARRAY_SIZE(iwl_ext_nvm_channels)
151#define NUM_2GHZ_CHANNELS 14 152#define NUM_2GHZ_CHANNELS 14
152#define NUM_2GHZ_CHANNELS_EXT 14 153#define NUM_2GHZ_CHANNELS_EXT 14
153#define FIRST_2GHZ_HT_MINUS 5 154#define FIRST_2GHZ_HT_MINUS 5
@@ -301,11 +302,11 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg,
301 const u8 *nvm_chan; 302 const u8 *nvm_chan;
302 303
303 if (cfg->nvm_type != IWL_NVM_EXT) { 304 if (cfg->nvm_type != IWL_NVM_EXT) {
304 num_of_ch = IWL_NUM_CHANNELS; 305 num_of_ch = IWL_NVM_NUM_CHANNELS;
305 nvm_chan = &iwl_nvm_channels[0]; 306 nvm_chan = &iwl_nvm_channels[0];
306 num_2ghz_channels = NUM_2GHZ_CHANNELS; 307 num_2ghz_channels = NUM_2GHZ_CHANNELS;
307 } else { 308 } else {
308 num_of_ch = IWL_NUM_CHANNELS_EXT; 309 num_of_ch = IWL_NVM_NUM_CHANNELS_EXT;
309 nvm_chan = &iwl_ext_nvm_channels[0]; 310 nvm_chan = &iwl_ext_nvm_channels[0];
310 num_2ghz_channels = NUM_2GHZ_CHANNELS_EXT; 311 num_2ghz_channels = NUM_2GHZ_CHANNELS_EXT;
311 } 312 }
@@ -720,12 +721,12 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
720 if (cfg->nvm_type != IWL_NVM_EXT) 721 if (cfg->nvm_type != IWL_NVM_EXT)
721 data = kzalloc(sizeof(*data) + 722 data = kzalloc(sizeof(*data) +
722 sizeof(struct ieee80211_channel) * 723 sizeof(struct ieee80211_channel) *
723 IWL_NUM_CHANNELS, 724 IWL_NVM_NUM_CHANNELS,
724 GFP_KERNEL); 725 GFP_KERNEL);
725 else 726 else
726 data = kzalloc(sizeof(*data) + 727 data = kzalloc(sizeof(*data) +
727 sizeof(struct ieee80211_channel) * 728 sizeof(struct ieee80211_channel) *
728 IWL_NUM_CHANNELS_EXT, 729 IWL_NVM_NUM_CHANNELS_EXT,
729 GFP_KERNEL); 730 GFP_KERNEL);
730 if (!data) 731 if (!data)
731 return NULL; 732 return NULL;
@@ -842,24 +843,34 @@ static u32 iwl_nvm_get_regdom_bw_flags(const u8 *nvm_chan,
842 return flags; 843 return flags;
843} 844}
844 845
846struct regdb_ptrs {
847 struct ieee80211_wmm_rule *rule;
848 u32 token;
849};
850
845struct ieee80211_regdomain * 851struct ieee80211_regdomain *
846iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, 852iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
847 int num_of_ch, __le32 *channels, u16 fw_mcc) 853 int num_of_ch, __le32 *channels, u16 fw_mcc,
854 u16 geo_info)
848{ 855{
849 int ch_idx; 856 int ch_idx;
850 u16 ch_flags; 857 u16 ch_flags;
851 u32 reg_rule_flags, prev_reg_rule_flags = 0; 858 u32 reg_rule_flags, prev_reg_rule_flags = 0;
852 const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ? 859 const u8 *nvm_chan = cfg->nvm_type == IWL_NVM_EXT ?
853 iwl_ext_nvm_channels : iwl_nvm_channels; 860 iwl_ext_nvm_channels : iwl_nvm_channels;
854 struct ieee80211_regdomain *regd; 861 struct ieee80211_regdomain *regd, *copy_rd;
855 int size_of_regd; 862 int size_of_regd, regd_to_copy, wmms_to_copy;
863 int size_of_wmms = 0;
856 struct ieee80211_reg_rule *rule; 864 struct ieee80211_reg_rule *rule;
865 struct ieee80211_wmm_rule *wmm_rule, *d_wmm, *s_wmm;
866 struct regdb_ptrs *regdb_ptrs;
857 enum nl80211_band band; 867 enum nl80211_band band;
858 int center_freq, prev_center_freq = 0; 868 int center_freq, prev_center_freq = 0;
859 int valid_rules = 0; 869 int valid_rules = 0, n_wmms = 0;
870 int i;
860 bool new_rule; 871 bool new_rule;
861 int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ? 872 int max_num_ch = cfg->nvm_type == IWL_NVM_EXT ?
862 IWL_NUM_CHANNELS_EXT : IWL_NUM_CHANNELS; 873 IWL_NVM_NUM_CHANNELS_EXT : IWL_NVM_NUM_CHANNELS;
863 874
864 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES)) 875 if (WARN_ON_ONCE(num_of_ch > NL80211_MAX_SUPP_REG_RULES))
865 return ERR_PTR(-EINVAL); 876 return ERR_PTR(-EINVAL);
@@ -875,10 +886,26 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
875 sizeof(struct ieee80211_regdomain) + 886 sizeof(struct ieee80211_regdomain) +
876 num_of_ch * sizeof(struct ieee80211_reg_rule); 887 num_of_ch * sizeof(struct ieee80211_reg_rule);
877 888
878 regd = kzalloc(size_of_regd, GFP_KERNEL); 889 if (geo_info & GEO_WMM_ETSI_5GHZ_INFO)
890 size_of_wmms =
891 num_of_ch * sizeof(struct ieee80211_wmm_rule);
892
893 regd = kzalloc(size_of_regd + size_of_wmms, GFP_KERNEL);
879 if (!regd) 894 if (!regd)
880 return ERR_PTR(-ENOMEM); 895 return ERR_PTR(-ENOMEM);
881 896
897 regdb_ptrs = kcalloc(num_of_ch, sizeof(*regdb_ptrs), GFP_KERNEL);
898 if (!regdb_ptrs) {
899 copy_rd = ERR_PTR(-ENOMEM);
900 goto out;
901 }
902
903 /* set alpha2 from FW. */
904 regd->alpha2[0] = fw_mcc >> 8;
905 regd->alpha2[1] = fw_mcc & 0xff;
906
907 wmm_rule = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd);
908
882 for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) { 909 for (ch_idx = 0; ch_idx < num_of_ch; ch_idx++) {
883 ch_flags = (u16)__le32_to_cpup(channels + ch_idx); 910 ch_flags = (u16)__le32_to_cpup(channels + ch_idx);
884 band = (ch_idx < NUM_2GHZ_CHANNELS) ? 911 band = (ch_idx < NUM_2GHZ_CHANNELS) ?
@@ -927,14 +954,66 @@ iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
927 954
928 iwl_nvm_print_channel_flags(dev, IWL_DL_LAR, 955 iwl_nvm_print_channel_flags(dev, IWL_DL_LAR,
929 nvm_chan[ch_idx], ch_flags); 956 nvm_chan[ch_idx], ch_flags);
957
958 if (!(geo_info & GEO_WMM_ETSI_5GHZ_INFO) ||
959 band == NL80211_BAND_2GHZ)
960 continue;
961
962 if (!reg_query_regdb_wmm(regd->alpha2, center_freq,
963 &regdb_ptrs[n_wmms].token, wmm_rule)) {
964 /* Add only new rules */
965 for (i = 0; i < n_wmms; i++) {
966 if (regdb_ptrs[i].token ==
967 regdb_ptrs[n_wmms].token) {
968 rule->wmm_rule = regdb_ptrs[i].rule;
969 break;
970 }
971 }
972 if (i == n_wmms) {
973 rule->wmm_rule = wmm_rule;
974 regdb_ptrs[n_wmms++].rule = wmm_rule;
975 wmm_rule++;
976 }
977 }
930 } 978 }
931 979
932 regd->n_reg_rules = valid_rules; 980 regd->n_reg_rules = valid_rules;
981 regd->n_wmm_rules = n_wmms;
933 982
934 /* set alpha2 from FW. */ 983 /*
935 regd->alpha2[0] = fw_mcc >> 8; 984 * Narrow down regdom for unused regulatory rules to prevent hole
936 regd->alpha2[1] = fw_mcc & 0xff; 985 * between reg rules to wmm rules.
986 */
987 regd_to_copy = sizeof(struct ieee80211_regdomain) +
988 valid_rules * sizeof(struct ieee80211_reg_rule);
989
990 wmms_to_copy = sizeof(struct ieee80211_wmm_rule) * n_wmms;
991
992 copy_rd = kzalloc(regd_to_copy + wmms_to_copy, GFP_KERNEL);
993 if (!copy_rd) {
994 copy_rd = ERR_PTR(-ENOMEM);
995 goto out;
996 }
997
998 memcpy(copy_rd, regd, regd_to_copy);
999 memcpy((u8 *)copy_rd + regd_to_copy, (u8 *)regd + size_of_regd,
1000 wmms_to_copy);
1001
1002 d_wmm = (struct ieee80211_wmm_rule *)((u8 *)copy_rd + regd_to_copy);
1003 s_wmm = (struct ieee80211_wmm_rule *)((u8 *)regd + size_of_regd);
1004
1005 for (i = 0; i < regd->n_reg_rules; i++) {
1006 if (!regd->reg_rules[i].wmm_rule)
1007 continue;
1008
1009 copy_rd->reg_rules[i].wmm_rule = d_wmm +
1010 (regd->reg_rules[i].wmm_rule - s_wmm) /
1011 sizeof(struct ieee80211_wmm_rule);
1012 }
937 1013
938 return regd; 1014out:
1015 kfree(regdb_ptrs);
1016 kfree(regd);
1017 return copy_rd;
939} 1018}
940IWL_EXPORT_SYMBOL(iwl_parse_nvm_mcc_info); 1019IWL_EXPORT_SYMBOL(iwl_parse_nvm_mcc_info);
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
index 306736c7a042..3071a23b7606 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.h
@@ -101,12 +101,14 @@ void iwl_init_sbands(struct device *dev, const struct iwl_cfg *cfg,
101 * 101 *
102 * This function parses the regulatory channel data received as a 102 * This function parses the regulatory channel data received as a
103 * MCC_UPDATE_CMD command. It returns a newly allocation regulatory domain, 103 * MCC_UPDATE_CMD command. It returns a newly allocation regulatory domain,
104 * to be fed into the regulatory core. An ERR_PTR is returned on error. 104 * to be fed into the regulatory core. In case the geo_info is set handle
105 * accordingly. An ERR_PTR is returned on error.
105 * If not given to the regulatory core, the user is responsible for freeing 106 * If not given to the regulatory core, the user is responsible for freeing
106 * the regdomain returned here with kfree. 107 * the regdomain returned here with kfree.
107 */ 108 */
108struct ieee80211_regdomain * 109struct ieee80211_regdomain *
109iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg, 110iwl_parse_nvm_mcc_info(struct device *dev, const struct iwl_cfg *cfg,
110 int num_of_ch, __le32 *channels, u16 fw_mcc); 111 int num_of_ch, __le32 *channels, u16 fw_mcc,
112 u16 geo_info);
111 113
112#endif /* __iwl_nvm_parse_h__ */ 114#endif /* __iwl_nvm_parse_h__ */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 51b30424575b..90f8c89ea59c 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -311,7 +311,8 @@ struct ieee80211_regdomain *iwl_mvm_get_regdomain(struct wiphy *wiphy,
311 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg, 311 regd = iwl_parse_nvm_mcc_info(mvm->trans->dev, mvm->cfg,
312 __le32_to_cpu(resp->n_channels), 312 __le32_to_cpu(resp->n_channels),
313 resp->channels, 313 resp->channels,
314 __le16_to_cpu(resp->mcc)); 314 __le16_to_cpu(resp->mcc),
315 __le16_to_cpu(resp->geo_info));
315 /* Store the return source id */ 316 /* Store the return source id */
316 src_id = resp->source_id; 317 src_id = resp->source_id;
317 kfree(resp); 318 kfree(resp);
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
index 8b6b07a936f5..b026e80940a4 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtcoutsrc.c
@@ -158,16 +158,6 @@ static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)
158 158
159static u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv) 159static u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)
160{ 160{
161 struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
162
163 /* override ant_num / ant_path */
164 if (mod_params->ant_sel) {
165 rtlpriv->btcoexist.btc_info.ant_num =
166 (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1);
167
168 rtlpriv->btcoexist.btc_info.single_ant_path =
169 (mod_params->ant_sel == 1 ? 0 : 1);
170 }
171 return rtlpriv->btcoexist.btc_info.single_ant_path; 161 return rtlpriv->btcoexist.btc_info.single_ant_path;
172} 162}
173 163
@@ -178,7 +168,6 @@ static u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv)
178 168
179static u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv) 169static u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
180{ 170{
181 struct rtl_mod_params *mod_params = rtlpriv->cfg->mod_params;
182 u8 num; 171 u8 num;
183 172
184 if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2) 173 if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2)
@@ -186,10 +175,6 @@ static u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
186 else 175 else
187 num = 1; 176 num = 1;
188 177
189 /* override ant_num / ant_path */
190 if (mod_params->ant_sel)
191 num = (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1) + 1;
192
193 return num; 178 return num;
194} 179}
195 180
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
index e7bbbc95cdb1..b4f3f91b590e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
@@ -848,6 +848,9 @@ static bool _rtl8723be_init_mac(struct ieee80211_hw *hw)
848 return false; 848 return false;
849 } 849 }
850 850
851 if (rtlpriv->cfg->ops->get_btc_status())
852 rtlpriv->btcoexist.btc_ops->btc_power_on_setting(rtlpriv);
853
851 bytetmp = rtl_read_byte(rtlpriv, REG_MULTI_FUNC_CTRL); 854 bytetmp = rtl_read_byte(rtlpriv, REG_MULTI_FUNC_CTRL);
852 rtl_write_byte(rtlpriv, REG_MULTI_FUNC_CTRL, bytetmp | BIT(3)); 855 rtl_write_byte(rtlpriv, REG_MULTI_FUNC_CTRL, bytetmp | BIT(3));
853 856
@@ -2696,21 +2699,21 @@ void rtl8723be_read_bt_coexist_info_from_hwpg(struct ieee80211_hw *hw,
2696 rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8723B; 2699 rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8723B;
2697 rtlpriv->btcoexist.btc_info.ant_num = (value & 0x1); 2700 rtlpriv->btcoexist.btc_info.ant_num = (value & 0x1);
2698 rtlpriv->btcoexist.btc_info.single_ant_path = 2701 rtlpriv->btcoexist.btc_info.single_ant_path =
2699 (value & 0x40); /*0xc3[6]*/ 2702 (value & 0x40 ? ANT_AUX : ANT_MAIN); /*0xc3[6]*/
2700 } else { 2703 } else {
2701 rtlpriv->btcoexist.btc_info.btcoexist = 0; 2704 rtlpriv->btcoexist.btc_info.btcoexist = 0;
2702 rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8723B; 2705 rtlpriv->btcoexist.btc_info.bt_type = BT_RTL8723B;
2703 rtlpriv->btcoexist.btc_info.ant_num = ANT_X2; 2706 rtlpriv->btcoexist.btc_info.ant_num = ANT_X2;
2704 rtlpriv->btcoexist.btc_info.single_ant_path = 0; 2707 rtlpriv->btcoexist.btc_info.single_ant_path = ANT_MAIN;
2705 } 2708 }
2706 2709
2707 /* override ant_num / ant_path */ 2710 /* override ant_num / ant_path */
2708 if (mod_params->ant_sel) { 2711 if (mod_params->ant_sel) {
2709 rtlpriv->btcoexist.btc_info.ant_num = 2712 rtlpriv->btcoexist.btc_info.ant_num =
2710 (mod_params->ant_sel == 1 ? ANT_X2 : ANT_X1); 2713 (mod_params->ant_sel == 1 ? ANT_X1 : ANT_X2);
2711 2714
2712 rtlpriv->btcoexist.btc_info.single_ant_path = 2715 rtlpriv->btcoexist.btc_info.single_ant_path =
2713 (mod_params->ant_sel == 1 ? 0 : 1); 2716 (mod_params->ant_sel == 1 ? ANT_AUX : ANT_MAIN);
2714 } 2717 }
2715} 2718}
2716 2719
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index d27e33960e77..ce1754054a07 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -2823,6 +2823,11 @@ enum bt_ant_num {
2823 ANT_X1 = 1, 2823 ANT_X1 = 1,
2824}; 2824};
2825 2825
2826enum bt_ant_path {
2827 ANT_MAIN = 0,
2828 ANT_AUX = 1,
2829};
2830
2826enum bt_co_type { 2831enum bt_co_type {
2827 BT_2WIRE = 0, 2832 BT_2WIRE = 0,
2828 BT_ISSC_3WIRE = 1, 2833 BT_ISSC_3WIRE = 1,
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/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index acba1f56af3e..126cf19e869b 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1263,7 +1263,7 @@ static struct parisc_driver ccio_driver __refdata = {
1263 * I/O Page Directory, the resource map, and initalizing the 1263 * I/O Page Directory, the resource map, and initalizing the
1264 * U2/Uturn chip into virtual mode. 1264 * U2/Uturn chip into virtual mode.
1265 */ 1265 */
1266static void 1266static void __init
1267ccio_ioc_init(struct ioc *ioc) 1267ccio_ioc_init(struct ioc *ioc)
1268{ 1268{
1269 int i; 1269 int i;
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/sbus/char/oradax.c b/drivers/sbus/char/oradax.c
index c44d7c7ffc92..1754f55e2fac 100644
--- a/drivers/sbus/char/oradax.c
+++ b/drivers/sbus/char/oradax.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * This program is free software: you can redistribute it and/or modify 4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or 6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version. 7 * (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
diff --git a/drivers/scsi/isci/port_config.c b/drivers/scsi/isci/port_config.c
index edb7be786c65..9e8de1462593 100644
--- a/drivers/scsi/isci/port_config.c
+++ b/drivers/scsi/isci/port_config.c
@@ -291,7 +291,7 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost,
291 * Note: We have not moved the current phy_index so we will actually 291 * Note: We have not moved the current phy_index so we will actually
292 * compare the startting phy with itself. 292 * compare the startting phy with itself.
293 * This is expected and required to add the phy to the port. */ 293 * This is expected and required to add the phy to the port. */
294 while (phy_index < SCI_MAX_PHYS) { 294 for (; phy_index < SCI_MAX_PHYS; phy_index++) {
295 if ((phy_mask & (1 << phy_index)) == 0) 295 if ((phy_mask & (1 << phy_index)) == 0)
296 continue; 296 continue;
297 sci_phy_get_sas_address(&ihost->phys[phy_index], 297 sci_phy_get_sas_address(&ihost->phys[phy_index],
@@ -311,7 +311,6 @@ sci_mpc_agent_validate_phy_configuration(struct isci_host *ihost,
311 &ihost->phys[phy_index]); 311 &ihost->phys[phy_index]);
312 312
313 assigned_phy_mask |= (1 << phy_index); 313 assigned_phy_mask |= (1 << phy_index);
314 phy_index++;
315 } 314 }
316 315
317 } 316 }
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 8c51d628b52e..a2ec0bc9e9fa 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1722,11 +1722,14 @@ static int storvsc_probe(struct hv_device *device,
1722 max_targets = STORVSC_MAX_TARGETS; 1722 max_targets = STORVSC_MAX_TARGETS;
1723 max_channels = STORVSC_MAX_CHANNELS; 1723 max_channels = STORVSC_MAX_CHANNELS;
1724 /* 1724 /*
1725 * On Windows8 and above, we support sub-channels for storage. 1725 * On Windows8 and above, we support sub-channels for storage
1726 * on SCSI and FC controllers.
1726 * The number of sub-channels offerred is based on the number of 1727 * The number of sub-channels offerred is based on the number of
1727 * VCPUs in the guest. 1728 * VCPUs in the guest.
1728 */ 1729 */
1729 max_sub_channels = (num_cpus / storvsc_vcpus_per_sub_channel); 1730 if (!dev_is_ide)
1731 max_sub_channels =
1732 (num_cpus - 1) / storvsc_vcpus_per_sub_channel;
1730 } 1733 }
1731 1734
1732 scsi_driver.can_queue = (max_outstanding_req_per_channel * 1735 scsi_driver.can_queue = (max_outstanding_req_per_channel *
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/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 07c814c42648..60429011292a 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -427,8 +427,8 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
427{ 427{
428 struct se_device *dev = cmd->se_dev; 428 struct se_device *dev = cmd->se_dev;
429 struct scatterlist *sg = &cmd->t_data_sg[0]; 429 struct scatterlist *sg = &cmd->t_data_sg[0];
430 unsigned char *buf, zero = 0x00, *p = &zero; 430 unsigned char *buf, *not_zero;
431 int rc, ret; 431 int ret;
432 432
433 buf = kmap(sg_page(sg)) + sg->offset; 433 buf = kmap(sg_page(sg)) + sg->offset;
434 if (!buf) 434 if (!buf)
@@ -437,10 +437,10 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)
437 * Fall back to block_execute_write_same() slow-path if 437 * Fall back to block_execute_write_same() slow-path if
438 * incoming WRITE_SAME payload does not contain zeros. 438 * incoming WRITE_SAME payload does not contain zeros.
439 */ 439 */
440 rc = memcmp(buf, p, cmd->data_length); 440 not_zero = memchr_inv(buf, 0x00, cmd->data_length);
441 kunmap(sg_page(sg)); 441 kunmap(sg_page(sg));
442 442
443 if (rc) 443 if (not_zero)
444 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 444 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
445 445
446 ret = blkdev_issue_zeroout(bdev, 446 ret = blkdev_issue_zeroout(bdev,
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/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/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index ce4a34a2751d..35a124400d60 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -511,7 +511,14 @@ xfs_attr_shortform_addname(xfs_da_args_t *args)
511 if (args->flags & ATTR_CREATE) 511 if (args->flags & ATTR_CREATE)
512 return retval; 512 return retval;
513 retval = xfs_attr_shortform_remove(args); 513 retval = xfs_attr_shortform_remove(args);
514 ASSERT(retval == 0); 514 if (retval)
515 return retval;
516 /*
517 * Since we have removed the old attr, clear ATTR_REPLACE so
518 * that the leaf format add routine won't trip over the attr
519 * not being around.
520 */
521 args->flags &= ~ATTR_REPLACE;
515 } 522 }
516 523
517 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX || 524 if (args->namelen >= XFS_ATTR_SF_ENTSIZE_MAX ||
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 6a7c2f03ea11..040eeda8426f 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -725,12 +725,16 @@ xfs_bmap_extents_to_btree(
725 *logflagsp = 0; 725 *logflagsp = 0;
726 if ((error = xfs_alloc_vextent(&args))) { 726 if ((error = xfs_alloc_vextent(&args))) {
727 xfs_iroot_realloc(ip, -1, whichfork); 727 xfs_iroot_realloc(ip, -1, whichfork);
728 ASSERT(ifp->if_broot == NULL);
729 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
728 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); 730 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
729 return error; 731 return error;
730 } 732 }
731 733
732 if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) { 734 if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) {
733 xfs_iroot_realloc(ip, -1, whichfork); 735 xfs_iroot_realloc(ip, -1, whichfork);
736 ASSERT(ifp->if_broot == NULL);
737 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
734 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); 738 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR);
735 return -ENOSPC; 739 return -ENOSPC;
736 } 740 }
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
index ef68b1de006a..1201107eabc6 100644
--- a/fs/xfs/libxfs/xfs_inode_buf.c
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
@@ -466,6 +466,8 @@ xfs_dinode_verify(
466 return __this_address; 466 return __this_address;
467 if (di_size > XFS_DFORK_DSIZE(dip, mp)) 467 if (di_size > XFS_DFORK_DSIZE(dip, mp))
468 return __this_address; 468 return __this_address;
469 if (dip->di_nextents)
470 return __this_address;
469 /* fall through */ 471 /* fall through */
470 case XFS_DINODE_FMT_EXTENTS: 472 case XFS_DINODE_FMT_EXTENTS:
471 case XFS_DINODE_FMT_BTREE: 473 case XFS_DINODE_FMT_BTREE:
@@ -484,12 +486,31 @@ xfs_dinode_verify(
484 if (XFS_DFORK_Q(dip)) { 486 if (XFS_DFORK_Q(dip)) {
485 switch (dip->di_aformat) { 487 switch (dip->di_aformat) {
486 case XFS_DINODE_FMT_LOCAL: 488 case XFS_DINODE_FMT_LOCAL:
489 if (dip->di_anextents)
490 return __this_address;
491 /* fall through */
487 case XFS_DINODE_FMT_EXTENTS: 492 case XFS_DINODE_FMT_EXTENTS:
488 case XFS_DINODE_FMT_BTREE: 493 case XFS_DINODE_FMT_BTREE:
489 break; 494 break;
490 default: 495 default:
491 return __this_address; 496 return __this_address;
492 } 497 }
498 } else {
499 /*
500 * If there is no fork offset, this may be a freshly-made inode
501 * in a new disk cluster, in which case di_aformat is zeroed.
502 * Otherwise, such an inode must be in EXTENTS format; this goes
503 * for freed inodes as well.
504 */
505 switch (dip->di_aformat) {
506 case 0:
507 case XFS_DINODE_FMT_EXTENTS:
508 break;
509 default:
510 return __this_address;
511 }
512 if (dip->di_anextents)
513 return __this_address;
493 } 514 }
494 515
495 /* only version 3 or greater inodes are extensively verified here */ 516 /* only version 3 or greater inodes are extensively verified here */
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 299aee4b7b0b..e70fb8ccecea 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -778,22 +778,26 @@ xfs_file_fallocate(
778 if (error) 778 if (error)
779 goto out_unlock; 779 goto out_unlock;
780 } else if (mode & FALLOC_FL_INSERT_RANGE) { 780 } else if (mode & FALLOC_FL_INSERT_RANGE) {
781 unsigned int blksize_mask = i_blocksize(inode) - 1; 781 unsigned int blksize_mask = i_blocksize(inode) - 1;
782 loff_t isize = i_size_read(inode);
782 783
783 new_size = i_size_read(inode) + len;
784 if (offset & blksize_mask || len & blksize_mask) { 784 if (offset & blksize_mask || len & blksize_mask) {
785 error = -EINVAL; 785 error = -EINVAL;
786 goto out_unlock; 786 goto out_unlock;
787 } 787 }
788 788
789 /* check the new inode size does not wrap through zero */ 789 /*
790 if (new_size > inode->i_sb->s_maxbytes) { 790 * New inode size must not exceed ->s_maxbytes, accounting for
791 * possible signed overflow.
792 */
793 if (inode->i_sb->s_maxbytes - isize < len) {
791 error = -EFBIG; 794 error = -EFBIG;
792 goto out_unlock; 795 goto out_unlock;
793 } 796 }
797 new_size = isize + len;
794 798
795 /* Offset should be less than i_size */ 799 /* Offset should be less than i_size */
796 if (offset >= i_size_read(inode)) { 800 if (offset >= isize) {
797 error = -EINVAL; 801 error = -EINVAL;
798 goto out_unlock; 802 goto out_unlock;
799 } 803 }
@@ -876,8 +880,18 @@ xfs_file_dedupe_range(
876 struct file *dst_file, 880 struct file *dst_file,
877 u64 dst_loff) 881 u64 dst_loff)
878{ 882{
883 struct inode *srci = file_inode(src_file);
884 u64 max_dedupe;
879 int error; 885 int error;
880 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;
881 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,
882 len, true); 896 len, true);
883 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/bpf.h b/include/linux/bpf.h
index 486e65e3db26..469b20e1dd7e 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -31,6 +31,7 @@ struct bpf_map_ops {
31 void (*map_release)(struct bpf_map *map, struct file *map_file); 31 void (*map_release)(struct bpf_map *map, struct file *map_file);
32 void (*map_free)(struct bpf_map *map); 32 void (*map_free)(struct bpf_map *map);
33 int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key); 33 int (*map_get_next_key)(struct bpf_map *map, void *key, void *next_key);
34 void (*map_release_uref)(struct bpf_map *map);
34 35
35 /* funcs callable from userspace and from eBPF programs */ 36 /* funcs callable from userspace and from eBPF programs */
36 void *(*map_lookup_elem)(struct bpf_map *map, void *key); 37 void *(*map_lookup_elem)(struct bpf_map *map, void *key);
@@ -351,6 +352,7 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
351 struct bpf_prog **_prog, *__prog; \ 352 struct bpf_prog **_prog, *__prog; \
352 struct bpf_prog_array *_array; \ 353 struct bpf_prog_array *_array; \
353 u32 _ret = 1; \ 354 u32 _ret = 1; \
355 preempt_disable(); \
354 rcu_read_lock(); \ 356 rcu_read_lock(); \
355 _array = rcu_dereference(array); \ 357 _array = rcu_dereference(array); \
356 if (unlikely(check_non_null && !_array))\ 358 if (unlikely(check_non_null && !_array))\
@@ -362,6 +364,7 @@ int bpf_prog_array_copy(struct bpf_prog_array __rcu *old_array,
362 } \ 364 } \
363_out: \ 365_out: \
364 rcu_read_unlock(); \ 366 rcu_read_unlock(); \
367 preempt_enable_no_resched(); \
365 _ret; \ 368 _ret; \
366 }) 369 })
367 370
@@ -434,7 +437,6 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value);
434int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file, 437int bpf_fd_array_map_update_elem(struct bpf_map *map, struct file *map_file,
435 void *key, void *value, u64 map_flags); 438 void *key, void *value, u64 map_flags);
436int bpf_fd_array_map_lookup_elem(struct bpf_map *map, void *key, u32 *value); 439int bpf_fd_array_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
437void bpf_fd_array_map_clear(struct bpf_map *map);
438int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file, 440int bpf_fd_htab_map_update_elem(struct bpf_map *map, struct file *map_file,
439 void *key, void *value, u64 map_flags); 441 void *key, void *value, u64 map_flags);
440int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value); 442int bpf_fd_htab_map_lookup_elem(struct bpf_map *map, void *key, u32 *value);
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/mlx5/driver.h b/include/linux/mlx5/driver.h
index 767d193c269a..2a156c5dfadd 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -1284,25 +1284,19 @@ enum {
1284}; 1284};
1285 1285
1286static inline const struct cpumask * 1286static inline const struct cpumask *
1287mlx5_get_vector_affinity(struct mlx5_core_dev *dev, int vector) 1287mlx5_get_vector_affinity_hint(struct mlx5_core_dev *dev, int vector)
1288{ 1288{
1289 const struct cpumask *mask;
1290 struct irq_desc *desc; 1289 struct irq_desc *desc;
1291 unsigned int irq; 1290 unsigned int irq;
1292 int eqn; 1291 int eqn;
1293 int err; 1292 int err;
1294 1293
1295 err = mlx5_vector2eqn(dev, MLX5_EQ_VEC_COMP_BASE + vector, &eqn, &irq); 1294 err = mlx5_vector2eqn(dev, vector, &eqn, &irq);
1296 if (err) 1295 if (err)
1297 return NULL; 1296 return NULL;
1298 1297
1299 desc = irq_to_desc(irq); 1298 desc = irq_to_desc(irq);
1300#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK 1299 return desc->affinity_hint;
1301 mask = irq_data_get_effective_affinity_mask(&desc->irq_data);
1302#else
1303 mask = desc->irq_common_data.affinity;
1304#endif
1305 return mask;
1306} 1300}
1307 1301
1308#endif /* MLX5_DRIVER_H */ 1302#endif /* MLX5_DRIVER_H */
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/tls.h b/include/net/tls.h
index 3da8e13a6d96..b400d0bb7448 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -148,6 +148,7 @@ struct tls_context {
148 struct scatterlist *partially_sent_record; 148 struct scatterlist *partially_sent_record;
149 u16 partially_sent_offset; 149 u16 partially_sent_offset;
150 unsigned long flags; 150 unsigned long flags;
151 bool in_tcp_sendpages;
151 152
152 u16 pending_open_record_frags; 153 u16 pending_open_record_frags;
153 int (*push_pending_record)(struct sock *sk, int flags); 154 int (*push_pending_record)(struct sock *sk, int flags);
diff --git a/include/trace/events/initcall.h b/include/trace/events/initcall.h
index 8d6cf10d27c9..eb903c3f195f 100644
--- a/include/trace/events/initcall.h
+++ b/include/trace/events/initcall.h
@@ -31,7 +31,11 @@ TRACE_EVENT(initcall_start,
31 TP_ARGS(func), 31 TP_ARGS(func),
32 32
33 TP_STRUCT__entry( 33 TP_STRUCT__entry(
34 __field(initcall_t, func) 34 /*
35 * Use field_struct to avoid is_signed_type()
36 * comparison of a function pointer
37 */
38 __field_struct(initcall_t, func)
35 ), 39 ),
36 40
37 TP_fast_assign( 41 TP_fast_assign(
@@ -48,8 +52,12 @@ TRACE_EVENT(initcall_finish,
48 TP_ARGS(func, ret), 52 TP_ARGS(func, ret),
49 53
50 TP_STRUCT__entry( 54 TP_STRUCT__entry(
51 __field(initcall_t, func) 55 /*
52 __field(int, ret) 56 * Use field_struct to avoid is_signed_type()
57 * comparison of a function pointer
58 */
59 __field_struct(initcall_t, func)
60 __field(int, ret)
53 ), 61 ),
54 62
55 TP_fast_assign( 63 TP_fast_assign(
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/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/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 14750e7c5ee4..027107f4be53 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -476,7 +476,7 @@ static u32 prog_fd_array_sys_lookup_elem(void *ptr)
476} 476}
477 477
478/* decrement refcnt of all bpf_progs that are stored in this map */ 478/* decrement refcnt of all bpf_progs that are stored in this map */
479void bpf_fd_array_map_clear(struct bpf_map *map) 479static void bpf_fd_array_map_clear(struct bpf_map *map)
480{ 480{
481 struct bpf_array *array = container_of(map, struct bpf_array, map); 481 struct bpf_array *array = container_of(map, struct bpf_array, map);
482 int i; 482 int i;
@@ -495,6 +495,7 @@ const struct bpf_map_ops prog_array_map_ops = {
495 .map_fd_get_ptr = prog_fd_array_get_ptr, 495 .map_fd_get_ptr = prog_fd_array_get_ptr,
496 .map_fd_put_ptr = prog_fd_array_put_ptr, 496 .map_fd_put_ptr = prog_fd_array_put_ptr,
497 .map_fd_sys_lookup_elem = prog_fd_array_sys_lookup_elem, 497 .map_fd_sys_lookup_elem = prog_fd_array_sys_lookup_elem,
498 .map_release_uref = bpf_fd_array_map_clear,
498}; 499};
499 500
500static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file, 501static struct bpf_event_entry *bpf_event_entry_gen(struct file *perf_file,
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index a3b21385e947..098eca568c2b 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -43,6 +43,7 @@
43#include <net/tcp.h> 43#include <net/tcp.h>
44#include <linux/ptr_ring.h> 44#include <linux/ptr_ring.h>
45#include <net/inet_common.h> 45#include <net/inet_common.h>
46#include <linux/sched/signal.h>
46 47
47#define SOCK_CREATE_FLAG_MASK \ 48#define SOCK_CREATE_FLAG_MASK \
48 (BPF_F_NUMA_NODE | BPF_F_RDONLY | BPF_F_WRONLY) 49 (BPF_F_NUMA_NODE | BPF_F_RDONLY | BPF_F_WRONLY)
@@ -325,6 +326,9 @@ retry:
325 if (ret > 0) { 326 if (ret > 0) {
326 if (apply) 327 if (apply)
327 apply_bytes -= ret; 328 apply_bytes -= ret;
329
330 sg->offset += ret;
331 sg->length -= ret;
328 size -= ret; 332 size -= ret;
329 offset += ret; 333 offset += ret;
330 if (uncharge) 334 if (uncharge)
@@ -332,8 +336,6 @@ retry:
332 goto retry; 336 goto retry;
333 } 337 }
334 338
335 sg->length = size;
336 sg->offset = offset;
337 return ret; 339 return ret;
338 } 340 }
339 341
@@ -391,7 +393,8 @@ static void return_mem_sg(struct sock *sk, int bytes, struct sk_msg_buff *md)
391 } while (i != md->sg_end); 393 } while (i != md->sg_end);
392} 394}
393 395
394static void free_bytes_sg(struct sock *sk, int bytes, struct sk_msg_buff *md) 396static void free_bytes_sg(struct sock *sk, int bytes,
397 struct sk_msg_buff *md, bool charge)
395{ 398{
396 struct scatterlist *sg = md->sg_data; 399 struct scatterlist *sg = md->sg_data;
397 int i = md->sg_start, free; 400 int i = md->sg_start, free;
@@ -401,11 +404,13 @@ static void free_bytes_sg(struct sock *sk, int bytes, struct sk_msg_buff *md)
401 if (bytes < free) { 404 if (bytes < free) {
402 sg[i].length -= bytes; 405 sg[i].length -= bytes;
403 sg[i].offset += bytes; 406 sg[i].offset += bytes;
404 sk_mem_uncharge(sk, bytes); 407 if (charge)
408 sk_mem_uncharge(sk, bytes);
405 break; 409 break;
406 } 410 }
407 411
408 sk_mem_uncharge(sk, sg[i].length); 412 if (charge)
413 sk_mem_uncharge(sk, sg[i].length);
409 put_page(sg_page(&sg[i])); 414 put_page(sg_page(&sg[i]));
410 bytes -= sg[i].length; 415 bytes -= sg[i].length;
411 sg[i].length = 0; 416 sg[i].length = 0;
@@ -416,6 +421,7 @@ static void free_bytes_sg(struct sock *sk, int bytes, struct sk_msg_buff *md)
416 if (i == MAX_SKB_FRAGS) 421 if (i == MAX_SKB_FRAGS)
417 i = 0; 422 i = 0;
418 } 423 }
424 md->sg_start = i;
419} 425}
420 426
421static int free_sg(struct sock *sk, int start, struct sk_msg_buff *md) 427static int free_sg(struct sock *sk, int start, struct sk_msg_buff *md)
@@ -523,8 +529,6 @@ static int bpf_tcp_ingress(struct sock *sk, int apply_bytes,
523 i = md->sg_start; 529 i = md->sg_start;
524 530
525 do { 531 do {
526 r->sg_data[i] = md->sg_data[i];
527
528 size = (apply && apply_bytes < md->sg_data[i].length) ? 532 size = (apply && apply_bytes < md->sg_data[i].length) ?
529 apply_bytes : md->sg_data[i].length; 533 apply_bytes : md->sg_data[i].length;
530 534
@@ -535,6 +539,7 @@ static int bpf_tcp_ingress(struct sock *sk, int apply_bytes,
535 } 539 }
536 540
537 sk_mem_charge(sk, size); 541 sk_mem_charge(sk, size);
542 r->sg_data[i] = md->sg_data[i];
538 r->sg_data[i].length = size; 543 r->sg_data[i].length = size;
539 md->sg_data[i].length -= size; 544 md->sg_data[i].length -= size;
540 md->sg_data[i].offset += size; 545 md->sg_data[i].offset += size;
@@ -575,10 +580,10 @@ static int bpf_tcp_sendmsg_do_redirect(struct sock *sk, int send,
575 struct sk_msg_buff *md, 580 struct sk_msg_buff *md,
576 int flags) 581 int flags)
577{ 582{
583 bool ingress = !!(md->flags & BPF_F_INGRESS);
578 struct smap_psock *psock; 584 struct smap_psock *psock;
579 struct scatterlist *sg; 585 struct scatterlist *sg;
580 int i, err, free = 0; 586 int err = 0;
581 bool ingress = !!(md->flags & BPF_F_INGRESS);
582 587
583 sg = md->sg_data; 588 sg = md->sg_data;
584 589
@@ -606,16 +611,8 @@ static int bpf_tcp_sendmsg_do_redirect(struct sock *sk, int send,
606out_rcu: 611out_rcu:
607 rcu_read_unlock(); 612 rcu_read_unlock();
608out: 613out:
609 i = md->sg_start; 614 free_bytes_sg(NULL, send, md, false);
610 while (sg[i].length) { 615 return err;
611 free += sg[i].length;
612 put_page(sg_page(&sg[i]));
613 sg[i].length = 0;
614 i++;
615 if (i == MAX_SKB_FRAGS)
616 i = 0;
617 }
618 return free;
619} 616}
620 617
621static inline void bpf_md_init(struct smap_psock *psock) 618static inline void bpf_md_init(struct smap_psock *psock)
@@ -700,19 +697,26 @@ more_data:
700 err = bpf_tcp_sendmsg_do_redirect(redir, send, m, flags); 697 err = bpf_tcp_sendmsg_do_redirect(redir, send, m, flags);
701 lock_sock(sk); 698 lock_sock(sk);
702 699
700 if (unlikely(err < 0)) {
701 free_start_sg(sk, m);
702 psock->sg_size = 0;
703 if (!cork)
704 *copied -= send;
705 } else {
706 psock->sg_size -= send;
707 }
708
703 if (cork) { 709 if (cork) {
704 free_start_sg(sk, m); 710 free_start_sg(sk, m);
711 psock->sg_size = 0;
705 kfree(m); 712 kfree(m);
706 m = NULL; 713 m = NULL;
714 err = 0;
707 } 715 }
708 if (unlikely(err))
709 *copied -= err;
710 else
711 psock->sg_size -= send;
712 break; 716 break;
713 case __SK_DROP: 717 case __SK_DROP:
714 default: 718 default:
715 free_bytes_sg(sk, send, m); 719 free_bytes_sg(sk, send, m, true);
716 apply_bytes_dec(psock, send); 720 apply_bytes_dec(psock, send);
717 *copied -= send; 721 *copied -= send;
718 psock->sg_size -= send; 722 psock->sg_size -= send;
@@ -732,6 +736,26 @@ out_err:
732 return err; 736 return err;
733} 737}
734 738
739static int bpf_wait_data(struct sock *sk,
740 struct smap_psock *psk, int flags,
741 long timeo, int *err)
742{
743 int rc;
744
745 DEFINE_WAIT_FUNC(wait, woken_wake_function);
746
747 add_wait_queue(sk_sleep(sk), &wait);
748 sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
749 rc = sk_wait_event(sk, &timeo,
750 !list_empty(&psk->ingress) ||
751 !skb_queue_empty(&sk->sk_receive_queue),
752 &wait);
753 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
754 remove_wait_queue(sk_sleep(sk), &wait);
755
756 return rc;
757}
758
735static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 759static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
736 int nonblock, int flags, int *addr_len) 760 int nonblock, int flags, int *addr_len)
737{ 761{
@@ -755,6 +779,7 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
755 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len); 779 return tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
756 780
757 lock_sock(sk); 781 lock_sock(sk);
782bytes_ready:
758 while (copied != len) { 783 while (copied != len) {
759 struct scatterlist *sg; 784 struct scatterlist *sg;
760 struct sk_msg_buff *md; 785 struct sk_msg_buff *md;
@@ -809,6 +834,28 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
809 } 834 }
810 } 835 }
811 836
837 if (!copied) {
838 long timeo;
839 int data;
840 int err = 0;
841
842 timeo = sock_rcvtimeo(sk, nonblock);
843 data = bpf_wait_data(sk, psock, flags, timeo, &err);
844
845 if (data) {
846 if (!skb_queue_empty(&sk->sk_receive_queue)) {
847 release_sock(sk);
848 smap_release_sock(psock, sk);
849 copied = tcp_recvmsg(sk, msg, len, nonblock, flags, addr_len);
850 return copied;
851 }
852 goto bytes_ready;
853 }
854
855 if (err)
856 copied = err;
857 }
858
812 release_sock(sk); 859 release_sock(sk);
813 smap_release_sock(psock, sk); 860 smap_release_sock(psock, sk);
814 return copied; 861 return copied;
@@ -1831,7 +1878,7 @@ static int sock_map_update_elem(struct bpf_map *map,
1831 return err; 1878 return err;
1832} 1879}
1833 1880
1834static void sock_map_release(struct bpf_map *map, struct file *map_file) 1881static void sock_map_release(struct bpf_map *map)
1835{ 1882{
1836 struct bpf_stab *stab = container_of(map, struct bpf_stab, map); 1883 struct bpf_stab *stab = container_of(map, struct bpf_stab, map);
1837 struct bpf_prog *orig; 1884 struct bpf_prog *orig;
@@ -1855,7 +1902,7 @@ const struct bpf_map_ops sock_map_ops = {
1855 .map_get_next_key = sock_map_get_next_key, 1902 .map_get_next_key = sock_map_get_next_key,
1856 .map_update_elem = sock_map_update_elem, 1903 .map_update_elem = sock_map_update_elem,
1857 .map_delete_elem = sock_map_delete_elem, 1904 .map_delete_elem = sock_map_delete_elem,
1858 .map_release = sock_map_release, 1905 .map_release_uref = sock_map_release,
1859}; 1906};
1860 1907
1861BPF_CALL_4(bpf_sock_map_update, struct bpf_sock_ops_kern *, bpf_sock, 1908BPF_CALL_4(bpf_sock_map_update, struct bpf_sock_ops_kern *, bpf_sock,
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 4ca46df19c9a..ebfe9f29dae8 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -257,8 +257,8 @@ static void bpf_map_free_deferred(struct work_struct *work)
257static void bpf_map_put_uref(struct bpf_map *map) 257static void bpf_map_put_uref(struct bpf_map *map)
258{ 258{
259 if (atomic_dec_and_test(&map->usercnt)) { 259 if (atomic_dec_and_test(&map->usercnt)) {
260 if (map->map_type == BPF_MAP_TYPE_PROG_ARRAY) 260 if (map->ops->map_release_uref)
261 bpf_fd_array_map_clear(map); 261 map->ops->map_release_uref(map);
262 } 262 }
263} 263}
264 264
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index ce6848e46e94..1725b902983f 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -491,7 +491,7 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
491 if (!uprobe) 491 if (!uprobe)
492 return NULL; 492 return NULL;
493 493
494 uprobe->inode = igrab(inode); 494 uprobe->inode = inode;
495 uprobe->offset = offset; 495 uprobe->offset = offset;
496 init_rwsem(&uprobe->register_rwsem); 496 init_rwsem(&uprobe->register_rwsem);
497 init_rwsem(&uprobe->consumer_rwsem); 497 init_rwsem(&uprobe->consumer_rwsem);
@@ -502,7 +502,6 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
502 if (cur_uprobe) { 502 if (cur_uprobe) {
503 kfree(uprobe); 503 kfree(uprobe);
504 uprobe = cur_uprobe; 504 uprobe = cur_uprobe;
505 iput(inode);
506 } 505 }
507 506
508 return uprobe; 507 return uprobe;
@@ -701,7 +700,6 @@ static void delete_uprobe(struct uprobe *uprobe)
701 rb_erase(&uprobe->rb_node, &uprobes_tree); 700 rb_erase(&uprobe->rb_node, &uprobes_tree);
702 spin_unlock(&uprobes_treelock); 701 spin_unlock(&uprobes_treelock);
703 RB_CLEAR_NODE(&uprobe->rb_node); /* for uprobe_is_active() */ 702 RB_CLEAR_NODE(&uprobe->rb_node); /* for uprobe_is_active() */
704 iput(uprobe->inode);
705 put_uprobe(uprobe); 703 put_uprobe(uprobe);
706} 704}
707 705
@@ -873,7 +871,8 @@ static void __uprobe_unregister(struct uprobe *uprobe, struct uprobe_consumer *u
873 * tuple). Creation refcount stops uprobe_unregister from freeing the 871 * tuple). Creation refcount stops uprobe_unregister from freeing the
874 * @uprobe even before the register operation is complete. Creation 872 * @uprobe even before the register operation is complete. Creation
875 * refcount is released when the last @uc for the @uprobe 873 * refcount is released when the last @uc for the @uprobe
876 * unregisters. 874 * unregisters. Caller of uprobe_register() is required to keep @inode
875 * (and the containing mount) referenced.
877 * 876 *
878 * Return errno if it cannot successully install probes 877 * Return errno if it cannot successully install probes
879 * else return 0 (success) 878 * else return 0 (success)
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_hist.c b/kernel/trace/trace_events_hist.c
index 0d7b3ffbecc2..b9061ed59bbd 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -2466,6 +2466,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
2466 else if (strcmp(modifier, "usecs") == 0) 2466 else if (strcmp(modifier, "usecs") == 0)
2467 *flags |= HIST_FIELD_FL_TIMESTAMP_USECS; 2467 *flags |= HIST_FIELD_FL_TIMESTAMP_USECS;
2468 else { 2468 else {
2469 hist_err("Invalid field modifier: ", modifier);
2469 field = ERR_PTR(-EINVAL); 2470 field = ERR_PTR(-EINVAL);
2470 goto out; 2471 goto out;
2471 } 2472 }
@@ -2481,6 +2482,7 @@ parse_field(struct hist_trigger_data *hist_data, struct trace_event_file *file,
2481 else { 2482 else {
2482 field = trace_find_event_field(file->event_call, field_name); 2483 field = trace_find_event_field(file->event_call, field_name);
2483 if (!field || !field->size) { 2484 if (!field || !field->size) {
2485 hist_err("Couldn't find field: ", field_name);
2484 field = ERR_PTR(-EINVAL); 2486 field = ERR_PTR(-EINVAL);
2485 goto out; 2487 goto out;
2486 } 2488 }
@@ -4913,6 +4915,16 @@ static void hist_field_print(struct seq_file *m, struct hist_field *hist_field)
4913 seq_printf(m, "%s", field_name); 4915 seq_printf(m, "%s", field_name);
4914 } else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP) 4916 } else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP)
4915 seq_puts(m, "common_timestamp"); 4917 seq_puts(m, "common_timestamp");
4918
4919 if (hist_field->flags) {
4920 if (!(hist_field->flags & HIST_FIELD_FL_VAR_REF) &&
4921 !(hist_field->flags & HIST_FIELD_FL_EXPR)) {
4922 const char *flags = get_hist_field_flags(hist_field);
4923
4924 if (flags)
4925 seq_printf(m, ".%s", flags);
4926 }
4927 }
4916} 4928}
4917 4929
4918static int event_hist_trigger_print(struct seq_file *m, 4930static int event_hist_trigger_print(struct seq_file *m,
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/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 34fd0e0ec51d..ac892878dbe6 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -55,6 +55,7 @@ struct trace_uprobe {
55 struct list_head list; 55 struct list_head list;
56 struct trace_uprobe_filter filter; 56 struct trace_uprobe_filter filter;
57 struct uprobe_consumer consumer; 57 struct uprobe_consumer consumer;
58 struct path path;
58 struct inode *inode; 59 struct inode *inode;
59 char *filename; 60 char *filename;
60 unsigned long offset; 61 unsigned long offset;
@@ -289,7 +290,7 @@ static void free_trace_uprobe(struct trace_uprobe *tu)
289 for (i = 0; i < tu->tp.nr_args; i++) 290 for (i = 0; i < tu->tp.nr_args; i++)
290 traceprobe_free_probe_arg(&tu->tp.args[i]); 291 traceprobe_free_probe_arg(&tu->tp.args[i]);
291 292
292 iput(tu->inode); 293 path_put(&tu->path);
293 kfree(tu->tp.call.class->system); 294 kfree(tu->tp.call.class->system);
294 kfree(tu->tp.call.name); 295 kfree(tu->tp.call.name);
295 kfree(tu->filename); 296 kfree(tu->filename);
@@ -363,7 +364,6 @@ end:
363static int create_trace_uprobe(int argc, char **argv) 364static int create_trace_uprobe(int argc, char **argv)
364{ 365{
365 struct trace_uprobe *tu; 366 struct trace_uprobe *tu;
366 struct inode *inode;
367 char *arg, *event, *group, *filename; 367 char *arg, *event, *group, *filename;
368 char buf[MAX_EVENT_NAME_LEN]; 368 char buf[MAX_EVENT_NAME_LEN];
369 struct path path; 369 struct path path;
@@ -371,7 +371,6 @@ static int create_trace_uprobe(int argc, char **argv)
371 bool is_delete, is_return; 371 bool is_delete, is_return;
372 int i, ret; 372 int i, ret;
373 373
374 inode = NULL;
375 ret = 0; 374 ret = 0;
376 is_delete = false; 375 is_delete = false;
377 is_return = false; 376 is_return = false;
@@ -437,21 +436,16 @@ static int create_trace_uprobe(int argc, char **argv)
437 } 436 }
438 /* Find the last occurrence, in case the path contains ':' too. */ 437 /* Find the last occurrence, in case the path contains ':' too. */
439 arg = strrchr(argv[1], ':'); 438 arg = strrchr(argv[1], ':');
440 if (!arg) { 439 if (!arg)
441 ret = -EINVAL; 440 return -EINVAL;
442 goto fail_address_parse;
443 }
444 441
445 *arg++ = '\0'; 442 *arg++ = '\0';
446 filename = argv[1]; 443 filename = argv[1];
447 ret = kern_path(filename, LOOKUP_FOLLOW, &path); 444 ret = kern_path(filename, LOOKUP_FOLLOW, &path);
448 if (ret) 445 if (ret)
449 goto fail_address_parse; 446 return ret;
450
451 inode = igrab(d_real_inode(path.dentry));
452 path_put(&path);
453 447
454 if (!inode || !S_ISREG(inode->i_mode)) { 448 if (!d_is_reg(path.dentry)) {
455 ret = -EINVAL; 449 ret = -EINVAL;
456 goto fail_address_parse; 450 goto fail_address_parse;
457 } 451 }
@@ -490,7 +484,7 @@ static int create_trace_uprobe(int argc, char **argv)
490 goto fail_address_parse; 484 goto fail_address_parse;
491 } 485 }
492 tu->offset = offset; 486 tu->offset = offset;
493 tu->inode = inode; 487 tu->path = path;
494 tu->filename = kstrdup(filename, GFP_KERNEL); 488 tu->filename = kstrdup(filename, GFP_KERNEL);
495 489
496 if (!tu->filename) { 490 if (!tu->filename) {
@@ -558,7 +552,7 @@ error:
558 return ret; 552 return ret;
559 553
560fail_address_parse: 554fail_address_parse:
561 iput(inode); 555 path_put(&path);
562 556
563 pr_info("Failed to parse address or file.\n"); 557 pr_info("Failed to parse address or file.\n");
564 558
@@ -922,6 +916,7 @@ probe_event_enable(struct trace_uprobe *tu, struct trace_event_file *file,
922 goto err_flags; 916 goto err_flags;
923 917
924 tu->consumer.filter = filter; 918 tu->consumer.filter = filter;
919 tu->inode = d_real_inode(tu->path.dentry);
925 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer); 920 ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
926 if (ret) 921 if (ret)
927 goto err_buffer; 922 goto err_buffer;
@@ -967,6 +962,7 @@ probe_event_disable(struct trace_uprobe *tu, struct trace_event_file *file)
967 WARN_ON(!uprobe_filter_is_empty(&tu->filter)); 962 WARN_ON(!uprobe_filter_is_empty(&tu->filter));
968 963
969 uprobe_unregister(tu->inode, tu->offset, &tu->consumer); 964 uprobe_unregister(tu->inode, tu->offset, &tu->consumer);
965 tu->inode = NULL;
970 tu->tp.flags &= file ? ~TP_FLAG_TRACE : ~TP_FLAG_PROFILE; 966 tu->tp.flags &= file ? ~TP_FLAG_TRACE : ~TP_FLAG_PROFILE;
971 967
972 uprobe_buffer_disable(); 968 uprobe_buffer_disable();
@@ -1337,7 +1333,6 @@ struct trace_event_call *
1337create_local_trace_uprobe(char *name, unsigned long offs, bool is_return) 1333create_local_trace_uprobe(char *name, unsigned long offs, bool is_return)
1338{ 1334{
1339 struct trace_uprobe *tu; 1335 struct trace_uprobe *tu;
1340 struct inode *inode;
1341 struct path path; 1336 struct path path;
1342 int ret; 1337 int ret;
1343 1338
@@ -1345,11 +1340,8 @@ create_local_trace_uprobe(char *name, unsigned long offs, bool is_return)
1345 if (ret) 1340 if (ret)
1346 return ERR_PTR(ret); 1341 return ERR_PTR(ret);
1347 1342
1348 inode = igrab(d_inode(path.dentry)); 1343 if (!d_is_reg(path.dentry)) {
1349 path_put(&path); 1344 path_put(&path);
1350
1351 if (!inode || !S_ISREG(inode->i_mode)) {
1352 iput(inode);
1353 return ERR_PTR(-EINVAL); 1345 return ERR_PTR(-EINVAL);
1354 } 1346 }
1355 1347
@@ -1364,11 +1356,12 @@ create_local_trace_uprobe(char *name, unsigned long offs, bool is_return)
1364 if (IS_ERR(tu)) { 1356 if (IS_ERR(tu)) {
1365 pr_info("Failed to allocate trace_uprobe.(%d)\n", 1357 pr_info("Failed to allocate trace_uprobe.(%d)\n",
1366 (int)PTR_ERR(tu)); 1358 (int)PTR_ERR(tu));
1359 path_put(&path);
1367 return ERR_CAST(tu); 1360 return ERR_CAST(tu);
1368 } 1361 }
1369 1362
1370 tu->offset = offs; 1363 tu->offset = offs;
1371 tu->inode = inode; 1364 tu->path = path;
1372 tu->filename = kstrdup(name, GFP_KERNEL); 1365 tu->filename = kstrdup(name, GFP_KERNEL);
1373 init_trace_event_call(tu, &tu->tp.call); 1366 init_trace_event_call(tu, &tu->tp.call);
1374 1367
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 671b13457387..1e37da2e0c25 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -207,7 +207,7 @@ static int tracepoint_add_func(struct tracepoint *tp,
207 lockdep_is_held(&tracepoints_mutex)); 207 lockdep_is_held(&tracepoints_mutex));
208 old = func_add(&tp_funcs, func, prio); 208 old = func_add(&tp_funcs, func, prio);
209 if (IS_ERR(old)) { 209 if (IS_ERR(old)) {
210 WARN_ON_ONCE(1); 210 WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
211 return PTR_ERR(old); 211 return PTR_ERR(old);
212 } 212 }
213 213
@@ -239,7 +239,7 @@ static int tracepoint_remove_func(struct tracepoint *tp,
239 lockdep_is_held(&tracepoints_mutex)); 239 lockdep_is_held(&tracepoints_mutex));
240 old = func_remove(&tp_funcs, func); 240 old = func_remove(&tp_funcs, func);
241 if (IS_ERR(old)) { 241 if (IS_ERR(old)) {
242 WARN_ON_ONCE(1); 242 WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
243 return PTR_ERR(old); 243 return PTR_ERR(old);
244 } 244 }
245 245
diff --git a/lib/errseq.c b/lib/errseq.c
index df782418b333..81f9e33aa7e7 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -111,27 +111,22 @@ EXPORT_SYMBOL(errseq_set);
111 * errseq_sample() - Grab current errseq_t value. 111 * errseq_sample() - Grab current errseq_t value.
112 * @eseq: Pointer to errseq_t to be sampled. 112 * @eseq: Pointer to errseq_t to be sampled.
113 * 113 *
114 * This function allows callers to sample an errseq_t value, marking it as 114 * This function allows callers to initialise their errseq_t variable.
115 * "seen" if required. 115 * If the error has been "seen", new callers will not see an old error.
116 * If there is an unseen error in @eseq, the caller of this function will
117 * see it the next time it checks for an error.
116 * 118 *
119 * Context: Any context.
117 * Return: The current errseq value. 120 * Return: The current errseq value.
118 */ 121 */
119errseq_t errseq_sample(errseq_t *eseq) 122errseq_t errseq_sample(errseq_t *eseq)
120{ 123{
121 errseq_t old = READ_ONCE(*eseq); 124 errseq_t old = READ_ONCE(*eseq);
122 errseq_t new = old;
123 125
124 /* 126 /* If nobody has seen this error yet, then we can be the first. */
125 * For the common case of no errors ever having been set, we can skip 127 if (!(old & ERRSEQ_SEEN))
126 * marking the SEEN bit. Once an error has been set, the value will 128 old = 0;
127 * never go back to zero. 129 return old;
128 */
129 if (old != 0) {
130 new |= ERRSEQ_SEEN;
131 if (old != new)
132 cmpxchg(eseq, old, new);
133 }
134 return new;
135} 130}
136EXPORT_SYMBOL(errseq_sample); 131EXPORT_SYMBOL(errseq_sample);
137 132
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fece57566d45..12fbaa445637 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -737,7 +737,7 @@ out_unmap:
737 swiotlb_tbl_unmap_single(dev, phys_addr, size, DMA_TO_DEVICE, 737 swiotlb_tbl_unmap_single(dev, phys_addr, size, DMA_TO_DEVICE,
738 DMA_ATTR_SKIP_CPU_SYNC); 738 DMA_ATTR_SKIP_CPU_SYNC);
739out_warn: 739out_warn:
740 if ((attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) { 740 if (!(attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) {
741 dev_warn(dev, 741 dev_warn(dev,
742 "swiotlb: coherent allocation failed, size=%zu\n", 742 "swiotlb: coherent allocation failed, size=%zu\n",
743 size); 743 size);
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/net/bridge/br_if.c b/net/bridge/br_if.c
index 82c1a6f430b3..5bb6681fa91e 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -518,8 +518,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
518 return -ELOOP; 518 return -ELOOP;
519 } 519 }
520 520
521 /* Device is already being bridged */ 521 /* Device has master upper dev */
522 if (br_port_exists(dev)) 522 if (netdev_master_upper_dev_get(dev))
523 return -EBUSY; 523 return -EBUSY;
524 524
525 /* No bridging devices that dislike that (e.g. wireless) */ 525 /* No bridging devices that dislike that (e.g. wireless) */
diff --git a/net/compat.c b/net/compat.c
index 5ae7437d3853..7242cce5631b 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -377,7 +377,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
377 optname == SO_ATTACH_REUSEPORT_CBPF) 377 optname == SO_ATTACH_REUSEPORT_CBPF)
378 return do_set_attach_filter(sock, level, optname, 378 return do_set_attach_filter(sock, level, optname,
379 optval, optlen); 379 optval, optlen);
380 if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO) 380 if (!COMPAT_USE_64BIT_TIME &&
381 (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
381 return do_set_sock_timeout(sock, level, optname, optval, optlen); 382 return do_set_sock_timeout(sock, level, optname, optval, optlen);
382 383
383 return sock_setsockopt(sock, level, optname, optval, optlen); 384 return sock_setsockopt(sock, level, optname, optval, optlen);
@@ -448,7 +449,8 @@ static int do_get_sock_timeout(struct socket *sock, int level, int optname,
448static int compat_sock_getsockopt(struct socket *sock, int level, int optname, 449static int compat_sock_getsockopt(struct socket *sock, int level, int optname,
449 char __user *optval, int __user *optlen) 450 char __user *optval, int __user *optlen)
450{ 451{
451 if (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO) 452 if (!COMPAT_USE_64BIT_TIME &&
453 (optname == SO_RCVTIMEO || optname == SO_SNDTIMEO))
452 return do_get_sock_timeout(sock, level, optname, optval, optlen); 454 return do_get_sock_timeout(sock, level, optname, optval, optlen);
453 return sock_getsockopt(sock, level, optname, optval, optlen); 455 return sock_getsockopt(sock, level, optname, optval, optlen);
454} 456}
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 03416e6dd5d7..ba02f0dfe85c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1032,6 +1032,11 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
1032 info_size = sizeof(info); 1032 info_size = sizeof(info);
1033 if (copy_from_user(&info, useraddr, info_size)) 1033 if (copy_from_user(&info, useraddr, info_size))
1034 return -EFAULT; 1034 return -EFAULT;
1035 /* Since malicious users may modify the original data,
1036 * we need to check whether FLOW_RSS is still requested.
1037 */
1038 if (!(info.flow_type & FLOW_RSS))
1039 return -EINVAL;
1035 } 1040 }
1036 1041
1037 if (info.cmd == ETHTOOL_GRXCLSRLALL) { 1042 if (info.cmd == ETHTOOL_GRXCLSRLALL) {
diff --git a/net/core/filter.c b/net/core/filter.c
index d31aff93270d..e77c30ca491d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3240,6 +3240,7 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb,
3240 skb_dst_set(skb, (struct dst_entry *) md); 3240 skb_dst_set(skb, (struct dst_entry *) md);
3241 3241
3242 info = &md->u.tun_info; 3242 info = &md->u.tun_info;
3243 memset(info, 0, sizeof(*info));
3243 info->mode = IP_TUNNEL_INFO_TX; 3244 info->mode = IP_TUNNEL_INFO_TX;
3244 3245
3245 info->key.tun_flags = TUNNEL_KEY | TUNNEL_CSUM | TUNNEL_NOCACHE; 3246 info->key.tun_flags = TUNNEL_KEY | TUNNEL_CSUM | TUNNEL_NOCACHE;
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 92d016e87816..385f153fe031 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -126,6 +126,16 @@ static void ccid2_change_l_seq_window(struct sock *sk, u64 val)
126 DCCPF_SEQ_WMAX)); 126 DCCPF_SEQ_WMAX));
127} 127}
128 128
129static void dccp_tasklet_schedule(struct sock *sk)
130{
131 struct tasklet_struct *t = &dccp_sk(sk)->dccps_xmitlet;
132
133 if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state)) {
134 sock_hold(sk);
135 __tasklet_schedule(t);
136 }
137}
138
129static void ccid2_hc_tx_rto_expire(struct timer_list *t) 139static void ccid2_hc_tx_rto_expire(struct timer_list *t)
130{ 140{
131 struct ccid2_hc_tx_sock *hc = from_timer(hc, t, tx_rtotimer); 141 struct ccid2_hc_tx_sock *hc = from_timer(hc, t, tx_rtotimer);
@@ -166,7 +176,7 @@ static void ccid2_hc_tx_rto_expire(struct timer_list *t)
166 176
167 /* if we were blocked before, we may now send cwnd=1 packet */ 177 /* if we were blocked before, we may now send cwnd=1 packet */
168 if (sender_was_blocked) 178 if (sender_was_blocked)
169 tasklet_schedule(&dccp_sk(sk)->dccps_xmitlet); 179 dccp_tasklet_schedule(sk);
170 /* restart backed-off timer */ 180 /* restart backed-off timer */
171 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto); 181 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
172out: 182out:
@@ -706,7 +716,7 @@ static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
706done: 716done:
707 /* check if incoming Acks allow pending packets to be sent */ 717 /* check if incoming Acks allow pending packets to be sent */
708 if (sender_was_blocked && !ccid2_cwnd_network_limited(hc)) 718 if (sender_was_blocked && !ccid2_cwnd_network_limited(hc))
709 tasklet_schedule(&dccp_sk(sk)->dccps_xmitlet); 719 dccp_tasklet_schedule(sk);
710 dccp_ackvec_parsed_cleanup(&hc->tx_av_chunks); 720 dccp_ackvec_parsed_cleanup(&hc->tx_av_chunks);
711} 721}
712 722
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index b50a8732ff43..1501a20a94ca 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -232,6 +232,7 @@ static void dccp_write_xmitlet(unsigned long data)
232 else 232 else
233 dccp_write_xmit(sk); 233 dccp_write_xmit(sk);
234 bh_unlock_sock(sk); 234 bh_unlock_sock(sk);
235 sock_put(sk);
235} 236}
236 237
237static void dccp_write_xmit_timer(struct timer_list *t) 238static void dccp_write_xmit_timer(struct timer_list *t)
@@ -240,7 +241,6 @@ static void dccp_write_xmit_timer(struct timer_list *t)
240 struct sock *sk = &dp->dccps_inet_connection.icsk_inet.sk; 241 struct sock *sk = &dp->dccps_inet_connection.icsk_inet.sk;
241 242
242 dccp_write_xmitlet((unsigned long)sk); 243 dccp_write_xmitlet((unsigned long)sk);
243 sock_put(sk);
244} 244}
245 245
246void dccp_init_xmit_timers(struct sock *sk) 246void dccp_init_xmit_timers(struct sock *sk)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index ccb25d80f679..1412a7baf0b9 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -709,7 +709,7 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
709 fnhe->fnhe_gw = gw; 709 fnhe->fnhe_gw = gw;
710 fnhe->fnhe_pmtu = pmtu; 710 fnhe->fnhe_pmtu = pmtu;
711 fnhe->fnhe_mtu_locked = lock; 711 fnhe->fnhe_mtu_locked = lock;
712 fnhe->fnhe_expires = expires; 712 fnhe->fnhe_expires = max(1UL, expires);
713 713
714 /* Exception created; mark the cached routes for the nexthop 714 /* Exception created; mark the cached routes for the nexthop
715 * stale, so anyone caching it rechecks if this exception 715 * stale, so anyone caching it rechecks if this exception
@@ -1297,6 +1297,36 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
1297 return mtu - lwtunnel_headroom(dst->lwtstate, mtu); 1297 return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
1298} 1298}
1299 1299
1300static void ip_del_fnhe(struct fib_nh *nh, __be32 daddr)
1301{
1302 struct fnhe_hash_bucket *hash;
1303 struct fib_nh_exception *fnhe, __rcu **fnhe_p;
1304 u32 hval = fnhe_hashfun(daddr);
1305
1306 spin_lock_bh(&fnhe_lock);
1307
1308 hash = rcu_dereference_protected(nh->nh_exceptions,
1309 lockdep_is_held(&fnhe_lock));
1310 hash += hval;
1311
1312 fnhe_p = &hash->chain;
1313 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock));
1314 while (fnhe) {
1315 if (fnhe->fnhe_daddr == daddr) {
1316 rcu_assign_pointer(*fnhe_p, rcu_dereference_protected(
1317 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock)));
1318 fnhe_flush_routes(fnhe);
1319 kfree_rcu(fnhe, rcu);
1320 break;
1321 }
1322 fnhe_p = &fnhe->fnhe_next;
1323 fnhe = rcu_dereference_protected(fnhe->fnhe_next,
1324 lockdep_is_held(&fnhe_lock));
1325 }
1326
1327 spin_unlock_bh(&fnhe_lock);
1328}
1329
1300static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr) 1330static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr)
1301{ 1331{
1302 struct fnhe_hash_bucket *hash = rcu_dereference(nh->nh_exceptions); 1332 struct fnhe_hash_bucket *hash = rcu_dereference(nh->nh_exceptions);
@@ -1310,8 +1340,14 @@ static struct fib_nh_exception *find_exception(struct fib_nh *nh, __be32 daddr)
1310 1340
1311 for (fnhe = rcu_dereference(hash[hval].chain); fnhe; 1341 for (fnhe = rcu_dereference(hash[hval].chain); fnhe;
1312 fnhe = rcu_dereference(fnhe->fnhe_next)) { 1342 fnhe = rcu_dereference(fnhe->fnhe_next)) {
1313 if (fnhe->fnhe_daddr == daddr) 1343 if (fnhe->fnhe_daddr == daddr) {
1344 if (fnhe->fnhe_expires &&
1345 time_after(jiffies, fnhe->fnhe_expires)) {
1346 ip_del_fnhe(nh, daddr);
1347 break;
1348 }
1314 return fnhe; 1349 return fnhe;
1350 }
1315 } 1351 }
1316 return NULL; 1352 return NULL;
1317} 1353}
@@ -1636,36 +1672,6 @@ static void ip_handle_martian_source(struct net_device *dev,
1636#endif 1672#endif
1637} 1673}
1638 1674
1639static void ip_del_fnhe(struct fib_nh *nh, __be32 daddr)
1640{
1641 struct fnhe_hash_bucket *hash;
1642 struct fib_nh_exception *fnhe, __rcu **fnhe_p;
1643 u32 hval = fnhe_hashfun(daddr);
1644
1645 spin_lock_bh(&fnhe_lock);
1646
1647 hash = rcu_dereference_protected(nh->nh_exceptions,
1648 lockdep_is_held(&fnhe_lock));
1649 hash += hval;
1650
1651 fnhe_p = &hash->chain;
1652 fnhe = rcu_dereference_protected(*fnhe_p, lockdep_is_held(&fnhe_lock));
1653 while (fnhe) {
1654 if (fnhe->fnhe_daddr == daddr) {
1655 rcu_assign_pointer(*fnhe_p, rcu_dereference_protected(
1656 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock)));
1657 fnhe_flush_routes(fnhe);
1658 kfree_rcu(fnhe, rcu);
1659 break;
1660 }
1661 fnhe_p = &fnhe->fnhe_next;
1662 fnhe = rcu_dereference_protected(fnhe->fnhe_next,
1663 lockdep_is_held(&fnhe_lock));
1664 }
1665
1666 spin_unlock_bh(&fnhe_lock);
1667}
1668
1669/* called in rcu_read_lock() section */ 1675/* called in rcu_read_lock() section */
1670static int __mkroute_input(struct sk_buff *skb, 1676static int __mkroute_input(struct sk_buff *skb,
1671 const struct fib_result *res, 1677 const struct fib_result *res,
@@ -1719,20 +1725,10 @@ static int __mkroute_input(struct sk_buff *skb,
1719 1725
1720 fnhe = find_exception(&FIB_RES_NH(*res), daddr); 1726 fnhe = find_exception(&FIB_RES_NH(*res), daddr);
1721 if (do_cache) { 1727 if (do_cache) {
1722 if (fnhe) { 1728 if (fnhe)
1723 rth = rcu_dereference(fnhe->fnhe_rth_input); 1729 rth = rcu_dereference(fnhe->fnhe_rth_input);
1724 if (rth && rth->dst.expires && 1730 else
1725 time_after(jiffies, rth->dst.expires)) { 1731 rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
1726 ip_del_fnhe(&FIB_RES_NH(*res), daddr);
1727 fnhe = NULL;
1728 } else {
1729 goto rt_cache;
1730 }
1731 }
1732
1733 rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
1734
1735rt_cache:
1736 if (rt_cache_valid(rth)) { 1732 if (rt_cache_valid(rth)) {
1737 skb_dst_set_noref(skb, &rth->dst); 1733 skb_dst_set_noref(skb, &rth->dst);
1738 goto out; 1734 goto out;
@@ -2216,39 +2212,31 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
2216 * the loopback interface and the IP_PKTINFO ipi_ifindex will 2212 * the loopback interface and the IP_PKTINFO ipi_ifindex will
2217 * be set to the loopback interface as well. 2213 * be set to the loopback interface as well.
2218 */ 2214 */
2219 fi = NULL; 2215 do_cache = false;
2220 } 2216 }
2221 2217
2222 fnhe = NULL; 2218 fnhe = NULL;
2223 do_cache &= fi != NULL; 2219 do_cache &= fi != NULL;
2224 if (do_cache) { 2220 if (fi) {
2225 struct rtable __rcu **prth; 2221 struct rtable __rcu **prth;
2226 struct fib_nh *nh = &FIB_RES_NH(*res); 2222 struct fib_nh *nh = &FIB_RES_NH(*res);
2227 2223
2228 fnhe = find_exception(nh, fl4->daddr); 2224 fnhe = find_exception(nh, fl4->daddr);
2225 if (!do_cache)
2226 goto add;
2229 if (fnhe) { 2227 if (fnhe) {
2230 prth = &fnhe->fnhe_rth_output; 2228 prth = &fnhe->fnhe_rth_output;
2231 rth = rcu_dereference(*prth); 2229 } else {
2232 if (rth && rth->dst.expires && 2230 if (unlikely(fl4->flowi4_flags &
2233 time_after(jiffies, rth->dst.expires)) { 2231 FLOWI_FLAG_KNOWN_NH &&
2234 ip_del_fnhe(nh, fl4->daddr); 2232 !(nh->nh_gw &&
2235 fnhe = NULL; 2233 nh->nh_scope == RT_SCOPE_LINK))) {
2236 } else { 2234 do_cache = false;
2237 goto rt_cache; 2235 goto add;
2238 } 2236 }
2237 prth = raw_cpu_ptr(nh->nh_pcpu_rth_output);
2239 } 2238 }
2240
2241 if (unlikely(fl4->flowi4_flags &
2242 FLOWI_FLAG_KNOWN_NH &&
2243 !(nh->nh_gw &&
2244 nh->nh_scope == RT_SCOPE_LINK))) {
2245 do_cache = false;
2246 goto add;
2247 }
2248 prth = raw_cpu_ptr(nh->nh_pcpu_rth_output);
2249 rth = rcu_dereference(*prth); 2239 rth = rcu_dereference(*prth);
2250
2251rt_cache:
2252 if (rt_cache_valid(rth) && dst_hold_safe(&rth->dst)) 2240 if (rt_cache_valid(rth) && dst_hold_safe(&rth->dst))
2253 return rth; 2241 return rth;
2254 } 2242 }
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 9ce1c726185e..c9d00ef54dec 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -697,7 +697,7 @@ static bool tcp_should_autocork(struct sock *sk, struct sk_buff *skb,
697{ 697{
698 return skb->len < size_goal && 698 return skb->len < size_goal &&
699 sock_net(sk)->ipv4.sysctl_tcp_autocorking && 699 sock_net(sk)->ipv4.sysctl_tcp_autocorking &&
700 skb != tcp_write_queue_head(sk) && 700 !tcp_rtx_queue_empty(sk) &&
701 refcount_read(&sk->sk_wmem_alloc) > skb->truesize; 701 refcount_read(&sk->sk_wmem_alloc) > skb->truesize;
702} 702}
703 703
@@ -1204,7 +1204,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
1204 uarg->zerocopy = 0; 1204 uarg->zerocopy = 0;
1205 } 1205 }
1206 1206
1207 if (unlikely(flags & MSG_FASTOPEN || inet_sk(sk)->defer_connect)) { 1207 if (unlikely(flags & MSG_FASTOPEN || inet_sk(sk)->defer_connect) &&
1208 !tp->repair) {
1208 err = tcp_sendmsg_fastopen(sk, msg, &copied_syn, size); 1209 err = tcp_sendmsg_fastopen(sk, msg, &copied_syn, size);
1209 if (err == -EINPROGRESS && copied_syn > 0) 1210 if (err == -EINPROGRESS && copied_syn > 0)
1210 goto out; 1211 goto out;
@@ -2673,7 +2674,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
2673 case TCP_REPAIR_QUEUE: 2674 case TCP_REPAIR_QUEUE:
2674 if (!tp->repair) 2675 if (!tp->repair)
2675 err = -EPERM; 2676 err = -EPERM;
2676 else if (val < TCP_QUEUES_NR) 2677 else if ((unsigned int)val < TCP_QUEUES_NR)
2677 tp->repair_queue = val; 2678 tp->repair_queue = val;
2678 else 2679 else
2679 err = -EINVAL; 2680 err = -EINVAL;
diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c
index 158d105e76da..58e2f479ffb4 100644
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
@@ -806,7 +806,9 @@ static void bbr_update_min_rtt(struct sock *sk, const struct rate_sample *rs)
806 } 806 }
807 } 807 }
808 } 808 }
809 bbr->idle_restart = 0; 809 /* Restart after idle ends only once we process a new S/ACK for data */
810 if (rs->delivered > 0)
811 bbr->idle_restart = 0;
810} 812}
811 813
812static void bbr_update_model(struct sock *sk, const struct rate_sample *rs) 814static void bbr_update_model(struct sock *sk, const struct rate_sample *rs)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index cde7d8251377..f4d61736c41a 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1835,11 +1835,16 @@ static void ip6_multipath_l3_keys(const struct sk_buff *skb,
1835 const struct ipv6hdr *inner_iph; 1835 const struct ipv6hdr *inner_iph;
1836 const struct icmp6hdr *icmph; 1836 const struct icmp6hdr *icmph;
1837 struct ipv6hdr _inner_iph; 1837 struct ipv6hdr _inner_iph;
1838 struct icmp6hdr _icmph;
1838 1839
1839 if (likely(outer_iph->nexthdr != IPPROTO_ICMPV6)) 1840 if (likely(outer_iph->nexthdr != IPPROTO_ICMPV6))
1840 goto out; 1841 goto out;
1841 1842
1842 icmph = icmp6_hdr(skb); 1843 icmph = skb_header_pointer(skb, skb_transport_offset(skb),
1844 sizeof(_icmph), &_icmph);
1845 if (!icmph)
1846 goto out;
1847
1843 if (icmph->icmp6_type != ICMPV6_DEST_UNREACH && 1848 if (icmph->icmp6_type != ICMPV6_DEST_UNREACH &&
1844 icmph->icmp6_type != ICMPV6_PKT_TOOBIG && 1849 icmph->icmp6_type != ICMPV6_PKT_TOOBIG &&
1845 icmph->icmp6_type != ICMPV6_TIME_EXCEED && 1850 icmph->icmp6_type != ICMPV6_TIME_EXCEED &&
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index eea1d8611b20..13b38ad0fa4a 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -547,7 +547,7 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
547 rdsdebug("conn %p pd %p cq %p %p\n", conn, ic->i_pd, 547 rdsdebug("conn %p pd %p cq %p %p\n", conn, ic->i_pd,
548 ic->i_send_cq, ic->i_recv_cq); 548 ic->i_send_cq, ic->i_recv_cq);
549 549
550 return ret; 550 goto out;
551 551
552sends_out: 552sends_out:
553 vfree(ic->i_sends); 553 vfree(ic->i_sends);
@@ -572,6 +572,7 @@ send_cq_out:
572 ic->i_send_cq = NULL; 572 ic->i_send_cq = NULL;
573rds_ibdev_out: 573rds_ibdev_out:
574 rds_ib_remove_conn(rds_ibdev, conn); 574 rds_ib_remove_conn(rds_ibdev, conn);
575out:
575 rds_ib_dev_put(rds_ibdev); 576 rds_ib_dev_put(rds_ibdev);
576 577
577 return ret; 578 return ret;
diff --git a/net/rds/recv.c b/net/rds/recv.c
index de50e2126e40..dc67458b52f0 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -558,6 +558,7 @@ static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg,
558 struct rds_cmsg_rx_trace t; 558 struct rds_cmsg_rx_trace t;
559 int i, j; 559 int i, j;
560 560
561 memset(&t, 0, sizeof(t));
561 inc->i_rx_lat_trace[RDS_MSG_RX_CMSG] = local_clock(); 562 inc->i_rx_lat_trace[RDS_MSG_RX_CMSG] = local_clock();
562 t.rx_traces = rs->rs_rx_traces; 563 t.rx_traces = rs->rs_rx_traces;
563 for (i = 0; i < rs->rs_rx_traces; i++) { 564 for (i = 0; i < rs->rs_rx_traces; i++) {
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index a366e4c9413a..4808713c73b9 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -128,6 +128,28 @@ static bool fq_flow_is_detached(const struct fq_flow *f)
128 return f->next == &detached; 128 return f->next == &detached;
129} 129}
130 130
131static bool fq_flow_is_throttled(const struct fq_flow *f)
132{
133 return f->next == &throttled;
134}
135
136static void fq_flow_add_tail(struct fq_flow_head *head, struct fq_flow *flow)
137{
138 if (head->first)
139 head->last->next = flow;
140 else
141 head->first = flow;
142 head->last = flow;
143 flow->next = NULL;
144}
145
146static void fq_flow_unset_throttled(struct fq_sched_data *q, struct fq_flow *f)
147{
148 rb_erase(&f->rate_node, &q->delayed);
149 q->throttled_flows--;
150 fq_flow_add_tail(&q->old_flows, f);
151}
152
131static void fq_flow_set_throttled(struct fq_sched_data *q, struct fq_flow *f) 153static void fq_flow_set_throttled(struct fq_sched_data *q, struct fq_flow *f)
132{ 154{
133 struct rb_node **p = &q->delayed.rb_node, *parent = NULL; 155 struct rb_node **p = &q->delayed.rb_node, *parent = NULL;
@@ -155,15 +177,6 @@ static void fq_flow_set_throttled(struct fq_sched_data *q, struct fq_flow *f)
155 177
156static struct kmem_cache *fq_flow_cachep __read_mostly; 178static struct kmem_cache *fq_flow_cachep __read_mostly;
157 179
158static void fq_flow_add_tail(struct fq_flow_head *head, struct fq_flow *flow)
159{
160 if (head->first)
161 head->last->next = flow;
162 else
163 head->first = flow;
164 head->last = flow;
165 flow->next = NULL;
166}
167 180
168/* limit number of collected flows per round */ 181/* limit number of collected flows per round */
169#define FQ_GC_MAX 8 182#define FQ_GC_MAX 8
@@ -267,6 +280,8 @@ static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q)
267 f->socket_hash != sk->sk_hash)) { 280 f->socket_hash != sk->sk_hash)) {
268 f->credit = q->initial_quantum; 281 f->credit = q->initial_quantum;
269 f->socket_hash = sk->sk_hash; 282 f->socket_hash = sk->sk_hash;
283 if (fq_flow_is_throttled(f))
284 fq_flow_unset_throttled(q, f);
270 f->time_next_packet = 0ULL; 285 f->time_next_packet = 0ULL;
271 } 286 }
272 return f; 287 return f;
@@ -438,9 +453,7 @@ static void fq_check_throttled(struct fq_sched_data *q, u64 now)
438 q->time_next_delayed_flow = f->time_next_packet; 453 q->time_next_delayed_flow = f->time_next_packet;
439 break; 454 break;
440 } 455 }
441 rb_erase(p, &q->delayed); 456 fq_flow_unset_throttled(q, f);
442 q->throttled_flows--;
443 fq_flow_add_tail(&q->old_flows, f);
444 } 457 }
445} 458}
446 459
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index 23ebc5318edc..eb93ffe2408b 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -217,7 +217,7 @@ new_skb:
217 skb_pull(chunk->skb, sizeof(*ch)); 217 skb_pull(chunk->skb, sizeof(*ch));
218 chunk->subh.v = NULL; /* Subheader is no longer valid. */ 218 chunk->subh.v = NULL; /* Subheader is no longer valid. */
219 219
220 if (chunk->chunk_end + sizeof(*ch) < skb_tail_pointer(chunk->skb)) { 220 if (chunk->chunk_end + sizeof(*ch) <= skb_tail_pointer(chunk->skb)) {
221 /* This is not a singleton */ 221 /* This is not a singleton */
222 chunk->singleton = 0; 222 chunk->singleton = 0;
223 } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { 223 } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) {
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 2e3f7b75a8ec..42247110d842 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -895,6 +895,9 @@ static int sctp_inet6_cmp_addr(const union sctp_addr *addr1,
895 if (sctp_is_any(sk, addr1) || sctp_is_any(sk, addr2)) 895 if (sctp_is_any(sk, addr1) || sctp_is_any(sk, addr2))
896 return 1; 896 return 1;
897 897
898 if (addr1->sa.sa_family == AF_INET && addr2->sa.sa_family == AF_INET)
899 return addr1->v4.sin_addr.s_addr == addr2->v4.sin_addr.s_addr;
900
898 return __sctp_v6_cmp_addr(addr1, addr2); 901 return __sctp_v6_cmp_addr(addr1, addr2);
899} 902}
900 903
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index dd0594a10961..28c070e187c2 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1794,6 +1794,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
1794 GFP_ATOMIC)) 1794 GFP_ATOMIC))
1795 goto nomem; 1795 goto nomem;
1796 1796
1797 if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
1798 goto nomem;
1799
1797 /* Make sure no new addresses are being added during the 1800 /* Make sure no new addresses are being added during the
1798 * restart. Though this is a pretty complicated attack 1801 * restart. Though this is a pretty complicated attack
1799 * since you'd have to get inside the cookie. 1802 * since you'd have to get inside the cookie.
@@ -1906,6 +1909,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
1906 GFP_ATOMIC)) 1909 GFP_ATOMIC))
1907 goto nomem; 1910 goto nomem;
1908 1911
1912 if (sctp_auth_asoc_init_active_key(new_asoc, GFP_ATOMIC))
1913 goto nomem;
1914
1909 /* Update the content of current association. */ 1915 /* Update the content of current association. */
1910 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); 1916 sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
1911 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, 1917 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
@@ -2050,7 +2056,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_d(
2050 } 2056 }
2051 } 2057 }
2052 2058
2053 repl = sctp_make_cookie_ack(new_asoc, chunk); 2059 repl = sctp_make_cookie_ack(asoc, chunk);
2054 if (!repl) 2060 if (!repl)
2055 goto nomem; 2061 goto nomem;
2056 2062
diff --git a/net/sctp/stream.c b/net/sctp/stream.c
index f799043abec9..f1f1d1b232ba 100644
--- a/net/sctp/stream.c
+++ b/net/sctp/stream.c
@@ -240,6 +240,8 @@ void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new)
240 240
241 new->out = NULL; 241 new->out = NULL;
242 new->in = NULL; 242 new->in = NULL;
243 new->outcnt = 0;
244 new->incnt = 0;
243} 245}
244 246
245static int sctp_send_reconf(struct sctp_association *asoc, 247static int sctp_send_reconf(struct sctp_association *asoc,
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index f5d4b69dbabc..544bab42f925 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -292,6 +292,17 @@ static void smc_copy_sock_settings_to_smc(struct smc_sock *smc)
292 smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC); 292 smc_copy_sock_settings(&smc->sk, smc->clcsock->sk, SK_FLAGS_CLC_TO_SMC);
293} 293}
294 294
295/* register a new rmb */
296static int smc_reg_rmb(struct smc_link *link, struct smc_buf_desc *rmb_desc)
297{
298 /* register memory region for new rmb */
299 if (smc_wr_reg_send(link, rmb_desc->mr_rx[SMC_SINGLE_LINK])) {
300 rmb_desc->regerr = 1;
301 return -EFAULT;
302 }
303 return 0;
304}
305
295static int smc_clnt_conf_first_link(struct smc_sock *smc) 306static int smc_clnt_conf_first_link(struct smc_sock *smc)
296{ 307{
297 struct smc_link_group *lgr = smc->conn.lgr; 308 struct smc_link_group *lgr = smc->conn.lgr;
@@ -321,9 +332,7 @@ static int smc_clnt_conf_first_link(struct smc_sock *smc)
321 332
322 smc_wr_remember_qp_attr(link); 333 smc_wr_remember_qp_attr(link);
323 334
324 rc = smc_wr_reg_send(link, 335 if (smc_reg_rmb(link, smc->conn.rmb_desc))
325 smc->conn.rmb_desc->mr_rx[SMC_SINGLE_LINK]);
326 if (rc)
327 return SMC_CLC_DECL_INTERR; 336 return SMC_CLC_DECL_INTERR;
328 337
329 /* send CONFIRM LINK response over RoCE fabric */ 338 /* send CONFIRM LINK response over RoCE fabric */
@@ -473,13 +482,8 @@ static int smc_connect_rdma(struct smc_sock *smc)
473 goto decline_rdma_unlock; 482 goto decline_rdma_unlock;
474 } 483 }
475 } else { 484 } else {
476 struct smc_buf_desc *buf_desc = smc->conn.rmb_desc; 485 if (!smc->conn.rmb_desc->reused) {
477 486 if (smc_reg_rmb(link, smc->conn.rmb_desc)) {
478 if (!buf_desc->reused) {
479 /* register memory region for new rmb */
480 rc = smc_wr_reg_send(link,
481 buf_desc->mr_rx[SMC_SINGLE_LINK]);
482 if (rc) {
483 reason_code = SMC_CLC_DECL_INTERR; 487 reason_code = SMC_CLC_DECL_INTERR;
484 goto decline_rdma_unlock; 488 goto decline_rdma_unlock;
485 } 489 }
@@ -719,9 +723,7 @@ static int smc_serv_conf_first_link(struct smc_sock *smc)
719 723
720 link = &lgr->lnk[SMC_SINGLE_LINK]; 724 link = &lgr->lnk[SMC_SINGLE_LINK];
721 725
722 rc = smc_wr_reg_send(link, 726 if (smc_reg_rmb(link, smc->conn.rmb_desc))
723 smc->conn.rmb_desc->mr_rx[SMC_SINGLE_LINK]);
724 if (rc)
725 return SMC_CLC_DECL_INTERR; 727 return SMC_CLC_DECL_INTERR;
726 728
727 /* send CONFIRM LINK request to client over the RoCE fabric */ 729 /* send CONFIRM LINK request to client over the RoCE fabric */
@@ -854,13 +856,8 @@ static void smc_listen_work(struct work_struct *work)
854 smc_rx_init(new_smc); 856 smc_rx_init(new_smc);
855 857
856 if (local_contact != SMC_FIRST_CONTACT) { 858 if (local_contact != SMC_FIRST_CONTACT) {
857 struct smc_buf_desc *buf_desc = new_smc->conn.rmb_desc; 859 if (!new_smc->conn.rmb_desc->reused) {
858 860 if (smc_reg_rmb(link, new_smc->conn.rmb_desc)) {
859 if (!buf_desc->reused) {
860 /* register memory region for new rmb */
861 rc = smc_wr_reg_send(link,
862 buf_desc->mr_rx[SMC_SINGLE_LINK]);
863 if (rc) {
864 reason_code = SMC_CLC_DECL_INTERR; 861 reason_code = SMC_CLC_DECL_INTERR;
865 goto decline_rdma_unlock; 862 goto decline_rdma_unlock;
866 } 863 }
@@ -978,10 +975,6 @@ static void smc_tcp_listen_work(struct work_struct *work)
978 } 975 }
979 976
980out: 977out:
981 if (lsmc->clcsock) {
982 sock_release(lsmc->clcsock);
983 lsmc->clcsock = NULL;
984 }
985 release_sock(lsk); 978 release_sock(lsk);
986 sock_put(&lsmc->sk); /* sock_hold in smc_listen */ 979 sock_put(&lsmc->sk); /* sock_hold in smc_listen */
987} 980}
@@ -1170,13 +1163,15 @@ static __poll_t smc_poll(struct file *file, struct socket *sock,
1170 /* delegate to CLC child sock */ 1163 /* delegate to CLC child sock */
1171 release_sock(sk); 1164 release_sock(sk);
1172 mask = smc->clcsock->ops->poll(file, smc->clcsock, wait); 1165 mask = smc->clcsock->ops->poll(file, smc->clcsock, wait);
1173 /* if non-blocking connect finished ... */
1174 lock_sock(sk); 1166 lock_sock(sk);
1175 if ((sk->sk_state == SMC_INIT) && (mask & EPOLLOUT)) { 1167 sk->sk_err = smc->clcsock->sk->sk_err;
1176 sk->sk_err = smc->clcsock->sk->sk_err; 1168 if (sk->sk_err) {
1177 if (sk->sk_err) { 1169 mask |= EPOLLERR;
1178 mask |= EPOLLERR; 1170 } else {
1179 } else { 1171 /* if non-blocking connect finished ... */
1172 if (sk->sk_state == SMC_INIT &&
1173 mask & EPOLLOUT &&
1174 smc->clcsock->sk->sk_state != TCP_CLOSE) {
1180 rc = smc_connect_rdma(smc); 1175 rc = smc_connect_rdma(smc);
1181 if (rc < 0) 1176 if (rc < 0)
1182 mask |= EPOLLERR; 1177 mask |= EPOLLERR;
@@ -1320,8 +1315,11 @@ static ssize_t smc_sendpage(struct socket *sock, struct page *page,
1320 1315
1321 smc = smc_sk(sk); 1316 smc = smc_sk(sk);
1322 lock_sock(sk); 1317 lock_sock(sk);
1323 if (sk->sk_state != SMC_ACTIVE) 1318 if (sk->sk_state != SMC_ACTIVE) {
1319 release_sock(sk);
1324 goto out; 1320 goto out;
1321 }
1322 release_sock(sk);
1325 if (smc->use_fallback) 1323 if (smc->use_fallback)
1326 rc = kernel_sendpage(smc->clcsock, page, offset, 1324 rc = kernel_sendpage(smc->clcsock, page, offset,
1327 size, flags); 1325 size, flags);
@@ -1329,7 +1327,6 @@ static ssize_t smc_sendpage(struct socket *sock, struct page *page,
1329 rc = sock_no_sendpage(sock, page, offset, size, flags); 1327 rc = sock_no_sendpage(sock, page, offset, size, flags);
1330 1328
1331out: 1329out:
1332 release_sock(sk);
1333 return rc; 1330 return rc;
1334} 1331}
1335 1332
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index f44f6803f7ff..d4bd01bb44e1 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -32,6 +32,9 @@
32 32
33static u32 smc_lgr_num; /* unique link group number */ 33static u32 smc_lgr_num; /* unique link group number */
34 34
35static void smc_buf_free(struct smc_buf_desc *buf_desc, struct smc_link *lnk,
36 bool is_rmb);
37
35static void smc_lgr_schedule_free_work(struct smc_link_group *lgr) 38static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
36{ 39{
37 /* client link group creation always follows the server link group 40 /* client link group creation always follows the server link group
@@ -234,9 +237,22 @@ static void smc_buf_unuse(struct smc_connection *conn)
234 conn->sndbuf_size = 0; 237 conn->sndbuf_size = 0;
235 } 238 }
236 if (conn->rmb_desc) { 239 if (conn->rmb_desc) {
237 conn->rmb_desc->reused = true; 240 if (!conn->rmb_desc->regerr) {
238 conn->rmb_desc->used = 0; 241 conn->rmb_desc->reused = 1;
239 conn->rmbe_size = 0; 242 conn->rmb_desc->used = 0;
243 conn->rmbe_size = 0;
244 } else {
245 /* buf registration failed, reuse not possible */
246 struct smc_link_group *lgr = conn->lgr;
247 struct smc_link *lnk;
248
249 write_lock_bh(&lgr->rmbs_lock);
250 list_del(&conn->rmb_desc->list);
251 write_unlock_bh(&lgr->rmbs_lock);
252
253 lnk = &lgr->lnk[SMC_SINGLE_LINK];
254 smc_buf_free(conn->rmb_desc, lnk, true);
255 }
240 } 256 }
241} 257}
242 258
diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h
index 07e2a393e6d9..5dfcb15d529f 100644
--- a/net/smc/smc_core.h
+++ b/net/smc/smc_core.h
@@ -123,7 +123,8 @@ struct smc_buf_desc {
123 */ 123 */
124 u32 order; /* allocation order */ 124 u32 order; /* allocation order */
125 u32 used; /* currently used / unused */ 125 u32 used; /* currently used / unused */
126 bool reused; /* new created / reused */ 126 u8 reused : 1; /* new created / reused */
127 u8 regerr : 1; /* err during registration */
127}; 128};
128 129
129struct smc_rtoken { /* address/key of remote RMB */ 130struct smc_rtoken { /* address/key of remote RMB */
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 6f98b56dd48e..baaf93f12cbd 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -2244,7 +2244,7 @@ int tipc_nl_node_dump_monitor(struct sk_buff *skb, struct netlink_callback *cb)
2244 2244
2245 rtnl_lock(); 2245 rtnl_lock();
2246 for (bearer_id = prev_bearer; bearer_id < MAX_BEARERS; bearer_id++) { 2246 for (bearer_id = prev_bearer; bearer_id < MAX_BEARERS; bearer_id++) {
2247 err = __tipc_nl_add_monitor(net, &msg, prev_bearer); 2247 err = __tipc_nl_add_monitor(net, &msg, bearer_id);
2248 if (err) 2248 if (err)
2249 break; 2249 break;
2250 } 2250 }
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 0d379970960e..cc03e00785c7 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -114,6 +114,7 @@ int tls_push_sg(struct sock *sk,
114 size = sg->length - offset; 114 size = sg->length - offset;
115 offset += sg->offset; 115 offset += sg->offset;
116 116
117 ctx->in_tcp_sendpages = true;
117 while (1) { 118 while (1) {
118 if (sg_is_last(sg)) 119 if (sg_is_last(sg))
119 sendpage_flags = flags; 120 sendpage_flags = flags;
@@ -148,6 +149,8 @@ retry:
148 } 149 }
149 150
150 clear_bit(TLS_PENDING_CLOSED_RECORD, &ctx->flags); 151 clear_bit(TLS_PENDING_CLOSED_RECORD, &ctx->flags);
152 ctx->in_tcp_sendpages = false;
153 ctx->sk_write_space(sk);
151 154
152 return 0; 155 return 0;
153} 156}
@@ -217,6 +220,10 @@ static void tls_write_space(struct sock *sk)
217{ 220{
218 struct tls_context *ctx = tls_get_ctx(sk); 221 struct tls_context *ctx = tls_get_ctx(sk);
219 222
223 /* We are already sending pages, ignore notification */
224 if (ctx->in_tcp_sendpages)
225 return;
226
220 if (!sk->sk_write_pending && tls_is_pending_closed_record(ctx)) { 227 if (!sk->sk_write_pending && tls_is_pending_closed_record(ctx)) {
221 gfp_t sk_allocation = sk->sk_allocation; 228 gfp_t sk_allocation = sk->sk_allocation;
222 int rc; 229 int rc;
diff --git a/samples/sockmap/Makefile b/samples/sockmap/Makefile
index 9bf2881bd11b..fa53f4d77834 100644
--- a/samples/sockmap/Makefile
+++ b/samples/sockmap/Makefile
@@ -65,11 +65,14 @@ $(src)/*.c: verify_target_bpf
65# asm/sysreg.h - inline assembly used by it is incompatible with llvm. 65# asm/sysreg.h - inline assembly used by it is incompatible with llvm.
66# But, there is no easy way to fix it, so just exclude it since it is 66# But, there is no easy way to fix it, so just exclude it since it is
67# useless for BPF samples. 67# useless for BPF samples.
68#
69# -target bpf option required with SK_MSG programs, this is to ensure
70# reading 'void *' data types for data and data_end are __u64 reads.
68$(obj)/%.o: $(src)/%.c 71$(obj)/%.o: $(src)/%.c
69 $(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \ 72 $(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(EXTRA_CFLAGS) -I$(obj) \
70 -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \ 73 -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
71 -Wno-compare-distinct-pointer-types \ 74 -Wno-compare-distinct-pointer-types \
72 -Wno-gnu-variable-sized-type-not-at-end \ 75 -Wno-gnu-variable-sized-type-not-at-end \
73 -Wno-address-of-packed-member -Wno-tautological-compare \ 76 -Wno-address-of-packed-member -Wno-tautological-compare \
74 -Wno-unknown-warning-option \ 77 -Wno-unknown-warning-option -O2 -target bpf \
75 -O2 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@ 78 -emit-llvm -c $< -o -| $(LLC) -march=bpf -filetype=obj -o $@
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/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/bpf/Makefile b/tools/bpf/Makefile
index 1ea545965ee3..53b60ad452f5 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -76,6 +76,8 @@ $(OUTPUT)bpf_asm: $(OUTPUT)bpf_asm.o $(OUTPUT)bpf_exp.yacc.o $(OUTPUT)bpf_exp.le
76 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ 76 $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^
77 77
78$(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c 78$(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
79$(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
80$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
79 81
80clean: bpftool_clean 82clean: bpftool_clean
81 $(call QUIET_CLEAN, bpf-progs) 83 $(call QUIET_CLEAN, bpf-progs)
diff --git a/tools/bpf/bpf_dbg.c b/tools/bpf/bpf_dbg.c
index 4f254bcc4423..61b9aa5d6415 100644
--- a/tools/bpf/bpf_dbg.c
+++ b/tools/bpf/bpf_dbg.c
@@ -1063,7 +1063,7 @@ static int cmd_load_pcap(char *file)
1063 1063
1064static int cmd_load(char *arg) 1064static int cmd_load(char *arg)
1065{ 1065{
1066 char *subcmd, *cont, *tmp = strdup(arg); 1066 char *subcmd, *cont = NULL, *tmp = strdup(arg);
1067 int ret = CMD_OK; 1067 int ret = CMD_OK;
1068 1068
1069 subcmd = strtok_r(tmp, " ", &cont); 1069 subcmd = strtok_r(tmp, " ", &cont);
@@ -1073,7 +1073,10 @@ static int cmd_load(char *arg)
1073 bpf_reset(); 1073 bpf_reset();
1074 bpf_reset_breakpoints(); 1074 bpf_reset_breakpoints();
1075 1075
1076 ret = cmd_load_bpf(cont); 1076 if (!cont)
1077 ret = CMD_ERR;
1078 else
1079 ret = cmd_load_bpf(cont);
1077 } else if (matches(subcmd, "pcap") == 0) { 1080 } else if (matches(subcmd, "pcap") == 0) {
1078 ret = cmd_load_pcap(cont); 1081 ret = cmd_load_pcap(cont);
1079 } else { 1082 } else {
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/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index faadbe233966..4123d0ab90ba 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1108,7 +1108,7 @@ static void test_stacktrace_build_id(void)
1108 1108
1109 assert(system("dd if=/dev/urandom of=/dev/zero count=4 2> /dev/null") 1109 assert(system("dd if=/dev/urandom of=/dev/zero count=4 2> /dev/null")
1110 == 0); 1110 == 0);
1111 assert(system("./urandom_read if=/dev/urandom of=/dev/zero count=4 2> /dev/null") == 0); 1111 assert(system("./urandom_read") == 0);
1112 /* disable stack trace collection */ 1112 /* disable stack trace collection */
1113 key = 0; 1113 key = 0;
1114 val = 1; 1114 val = 1;
@@ -1158,7 +1158,7 @@ static void test_stacktrace_build_id(void)
1158 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0); 1158 } while (bpf_map_get_next_key(stackmap_fd, &previous_key, &key) == 0);
1159 1159
1160 CHECK(build_id_matches < 1, "build id match", 1160 CHECK(build_id_matches < 1, "build id match",
1161 "Didn't find expected build ID from the map"); 1161 "Didn't find expected build ID from the map\n");
1162 1162
1163disable_pmu: 1163disable_pmu:
1164 ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE); 1164 ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE);
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 195e9d4739a9..c1b1a4dc6a96 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -20,10 +20,10 @@ all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
20 20
21.ONESHELL: 21.ONESHELL:
22define RUN_TESTS 22define RUN_TESTS
23 @export KSFT_TAP_LEVEL=`echo 1`; 23 @export KSFT_TAP_LEVEL=`echo 1`; \
24 @test_num=`echo 0`; 24 test_num=`echo 0`; \
25 @echo "TAP version 13"; 25 echo "TAP version 13"; \
26 @for TEST in $(1); do \ 26 for TEST in $(1); do \
27 BASENAME_TEST=`basename $$TEST`; \ 27 BASENAME_TEST=`basename $$TEST`; \
28 test_num=`echo $$test_num+1 | bc`; \ 28 test_num=`echo $$test_num+1 | bc`; \
29 echo "selftests: $$BASENAME_TEST"; \ 29 echo "selftests: $$BASENAME_TEST"; \
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 8f1e13d2e547..daf5effec3f0 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -5,7 +5,8 @@ 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 8TEST_PROGS += fib_tests.sh fib-onlink-tests.sh pmtu.sh
9TEST_GEN_PROGS_EXTENDED := in_netns.sh
9TEST_GEN_FILES = socket 10TEST_GEN_FILES = socket
10TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy 11TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy
11TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa 12TEST_GEN_PROGS = reuseport_bpf reuseport_bpf_cpu reuseport_bpf_numa
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