aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-12-09 11:12:26 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-12-09 11:12:26 -0500
commit2941b0e91ba68b1f77140e556307e00616a5bb46 (patch)
tree01950b6ed12d06ebe4c39d1a2122050a9a570e93
parent818f2f57f20d0e9a9294180f304f34cd4e8f6066 (diff)
parent388f0c776781fe64ce951701bfe712b2182a31f2 (diff)
Merge tag 'nfs-for-3.19-1' into nfsd for-3.19 branch
Mainly what I need is 860a0d9e511f "sunrpc: add some tracepoints in svc_rqst handling functions", which subsequent server rpc patches from jlayton depend on. I'm merging this later tag on the assumption that's more likely to be a tested and stable point.
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/interrupts.txt4
-rw-r--r--Documentation/devicetree/bindings/pci/pci.txt11
-rw-r--r--Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt2
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt5
-rw-r--r--Documentation/filesystems/overlayfs.txt2
-rw-r--r--MAINTAINERS7
-rw-r--r--Makefile2
-rw-r--r--arch/arm/boot/dts/r8a7740.dtsi2
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi4
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi4
-rw-r--r--arch/arm/boot/dts/tegra114-dalmore.dts1
-rw-r--r--arch/arm/boot/dts/tegra114-roth.dts9
-rw-r--r--arch/arm/boot/dts/tegra114-tn7.dts5
-rw-r--r--arch/arm/boot/dts/tegra114.dtsi7
-rw-r--r--arch/arm/boot/dts/tegra124-jetson-tk1.dts1
-rw-r--r--arch/arm/boot/dts/tegra124-nyan-big.dts1
-rw-r--r--arch/arm/boot/dts/tegra124-venice2.dts1
-rw-r--r--arch/arm/boot/dts/tegra124.dtsi8
-rw-r--r--arch/arm/boot/dts/tegra20-harmony.dts1
-rw-r--r--arch/arm/boot/dts/tegra20-iris-512.dts5
-rw-r--r--arch/arm/boot/dts/tegra20-medcom-wide.dts4
-rw-r--r--arch/arm/boot/dts/tegra20-paz00.dts2
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts1
-rw-r--r--arch/arm/boot/dts/tegra20-tamonten.dtsi1
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts1
-rw-r--r--arch/arm/boot/dts/tegra20-ventana.dts1
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts1
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi8
-rw-r--r--arch/arm/boot/dts/tegra30-apalis-eval.dts4
-rw-r--r--arch/arm/boot/dts/tegra30-beaver.dts1
-rw-r--r--arch/arm/boot/dts/tegra30-cardhu.dtsi2
-rw-r--r--arch/arm/boot/dts/tegra30-colibri-eval-v3.dts3
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi8
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c9
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c2
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c20
-rw-r--r--arch/mips/include/asm/jump_label.h8
-rw-r--r--arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h2
-rw-r--r--arch/mips/include/asm/uaccess.h12
-rw-r--r--arch/mips/kernel/cpu-probe.c7
-rw-r--r--arch/mips/kernel/jump_label.c42
-rw-r--r--arch/mips/lib/memcpy.S1
-rw-r--r--arch/mips/loongson/loongson-3/numa.c1
-rw-r--r--arch/mips/mm/tlb-r4k.c4
-rw-r--r--arch/mips/oprofile/backtrace.c2
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c1
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c2
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/include/asm/page_32_types.h1
-rw-r--r--arch/x86/include/asm/page_64_types.h11
-rw-r--r--arch/x86/include/asm/thread_info.h2
-rw-r--r--arch/x86/include/asm/traps.h1
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/microcode/core.c8
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c49
-rw-r--r--arch/x86/kernel/dumpstack_64.c1
-rw-r--r--arch/x86/kernel/entry_64.S81
-rw-r--r--arch/x86/kernel/ptrace.c2
-rw-r--r--arch/x86/kernel/traps.c71
-rw-r--r--arch/x86/mm/init_64.c11
-rw-r--r--arch/x86/tools/calc_run_size.pl11
-rw-r--r--drivers/acpi/device_pm.c2
-rw-r--r--drivers/clocksource/sun4i_timer.c12
-rw-r--r--drivers/dma/pl330.c23
-rw-r--r--drivers/dma/sun6i-dma.c61
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c10
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c5
-rw-r--r--drivers/gpu/drm/radeon/r600_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c3
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.c44
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c8
-rw-r--r--drivers/net/bonding/bond_main.c3
-rw-r--r--drivers/net/can/dev.c4
-rw-r--r--drivers/net/can/m_can/Kconfig1
-rw-r--r--drivers/net/can/m_can/m_can.c219
-rw-r--r--drivers/net/can/rcar_can.c1
-rw-r--r--drivers/net/can/sja1000/kvaser_pci.c5
-rw-r--r--drivers/net/can/usb/ems_usb.c3
-rw-r--r--drivers/net/can/usb/esd_usb2.c3
-rw-r--r--drivers/net/can/usb/gs_usb.c1
-rw-r--r--drivers/net/can/xilinx_can.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c2
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c6
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c13
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c6
-rw-r--r--drivers/net/ethernet/ti/cpsw.c6
-rw-r--r--drivers/net/ieee802154/fakehard.c13
-rw-r--r--drivers/net/ppp/pptp.c4
-rw-r--r--drivers/net/usb/qmi_wwan.c1
-rw-r--r--drivers/net/virtio_net.c37
-rw-r--r--drivers/net/vxlan.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c13
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c9
-rw-r--r--drivers/net/wireless/b43/phy_common.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/of.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/pcie.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c6
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c6
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c20
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c3
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c50
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c19
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/hw.c7
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/phy.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/sw.c16
-rw-r--r--drivers/of/address.c19
-rw-r--r--drivers/of/dynamic.c2
-rw-r--r--drivers/of/fdt.c2
-rw-r--r--drivers/of/selftest.c11
-rw-r--r--drivers/pci/access.c2
-rw-r--r--drivers/pci/host/pci-xgene.c7
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/probe.c30
-rw-r--r--drivers/scsi/cxgbi/cxgb4i/cxgb4i.c2
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c2
-rw-r--r--drivers/target/iscsi/iscsi_target.c2
-rw-r--r--drivers/target/target_core_pr.c9
-rw-r--r--drivers/target/target_core_transport.c2
-rw-r--r--drivers/vhost/scsi.c24
-rw-r--r--fs/Makefile2
-rw-r--r--fs/btrfs/ctree.c14
-rw-r--r--fs/btrfs/locking.c24
-rw-r--r--fs/btrfs/locking.h2
-rw-r--r--fs/dcache.c1
-rw-r--r--fs/isofs/inode.c42
-rw-r--r--fs/lockd/svclock.c2
-rw-r--r--fs/nfs/blocklayout/blocklayout.c2
-rw-r--r--fs/nfs/callback_proc.c2
-rw-r--r--fs/nfs/filelayout/filelayoutdev.c3
-rw-r--r--fs/nfs/fscache.c24
-rw-r--r--fs/nfs/inode.c9
-rw-r--r--fs/nfs/iostat.h5
-rw-r--r--fs/nfs/nfs42.h2
-rw-r--r--fs/nfs/nfs42proc.c77
-rw-r--r--fs/nfs/nfs42xdr.c139
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4client.c46
-rw-r--r--fs/nfs/nfs4file.c31
-rw-r--r--fs/nfs/nfs4proc.c12
-rw-r--r--fs/nfs/nfs4xdr.c12
-rw-r--r--fs/nfs/pagelist.c11
-rw-r--r--fs/nfs/read.c2
-rw-r--r--fs/nfs/write.c19
-rw-r--r--fs/overlayfs/Kconfig2
-rw-r--r--fs/overlayfs/Makefile4
-rw-r--r--fs/overlayfs/dir.c31
-rw-r--r--fs/overlayfs/inode.c27
-rw-r--r--fs/overlayfs/readdir.c39
-rw-r--r--fs/overlayfs/super.c61
-rw-r--r--include/linux/bitops.h7
-rw-r--r--include/linux/can/dev.h6
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--include/linux/kernel_stat.h5
-rw-r--r--include/linux/lockd/debug.h6
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h4
-rw-r--r--include/linux/nfs_fs_sb.h2
-rw-r--r--include/linux/nfs_xdr.h14
-rw-r--r--include/linux/percpu-refcount.h8
-rw-r--r--include/linux/sunrpc/auth.h2
-rw-r--r--include/linux/sunrpc/clnt.h4
-rw-r--r--include/linux/sunrpc/debug.h64
-rw-r--r--include/linux/sunrpc/metrics.h3
-rw-r--r--include/linux/sunrpc/sched.h8
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/sunrpc/xprtsock.h59
-rw-r--r--include/net/netfilter/nf_tables.h2
-rw-r--r--include/net/vxlan.h18
-rw-r--r--include/sound/soc-dpcm.h2
-rw-r--r--include/trace/events/sunrpc.h160
-rw-r--r--include/uapi/linux/nfsd/debug.h2
-rw-r--r--kernel/events/core.c8
-rw-r--r--kernel/events/uprobes.c1
-rw-r--r--kernel/sched/core.c63
-rw-r--r--kernel/sched/deadline.c2
-rw-r--r--kernel/sched/fair.c14
-rw-r--r--kernel/sched/idle_task.c5
-rw-r--r--kernel/sched/rt.c2
-rw-r--r--kernel/sched/sched.h2
-rw-r--r--kernel/sched/stop_task.c5
-rw-r--r--kernel/time/posix-cpu-timers.c2
-rw-r--r--lib/Makefile4
-rw-r--r--net/bridge/br_multicast.c3
-rw-r--r--net/core/skbuff.c23
-rw-r--r--net/dcb/dcbnl.c36
-rw-r--r--net/ipv4/fib_rules.c4
-rw-r--r--net/ipv4/igmp.c11
-rw-r--r--net/ipv4/netfilter/nft_masq_ipv4.c1
-rw-r--r--net/ipv4/tcp_input.c4
-rw-r--r--net/ipv6/ip6mr.c4
-rw-r--r--net/ipv6/mcast.c9
-rw-r--r--net/ipv6/netfilter/nft_masq_ipv6.c1
-rw-r--r--net/ipx/af_ipx.c6
-rw-r--r--net/mac80211/aes_ccm.c3
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c15
-rw-r--r--net/netfilter/ipset/ip_set_core.c6
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c14
-rw-r--r--net/netfilter/nf_tables_api.c24
-rw-r--r--net/netfilter/nfnetlink.c12
-rw-r--r--net/netfilter/nft_compat.c40
-rw-r--r--net/openvswitch/actions.c10
-rw-r--r--net/openvswitch/datapath.c14
-rw-r--r--net/openvswitch/flow_netlink.c9
-rw-r--r--net/sunrpc/Kconfig1
-rw-r--r--net/sunrpc/Makefile1
-rw-r--r--net/sunrpc/auth.c4
-rw-r--r--net/sunrpc/auth_generic.c2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c2
-rw-r--r--net/sunrpc/auth_gss/gss_generic_token.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_keys.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_mech.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seal.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seqnum.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_unseal.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_wrap.c2
-rw-r--r--net/sunrpc/auth_gss/gss_mech_switch.c2
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_xdr.h2
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c2
-rw-r--r--net/sunrpc/auth_null.c4
-rw-r--r--net/sunrpc/auth_unix.c2
-rw-r--r--net/sunrpc/backchannel_rqst.c2
-rw-r--r--net/sunrpc/clnt.c16
-rw-r--r--net/sunrpc/debugfs.c292
-rw-r--r--net/sunrpc/rpcb_clnt.c2
-rw-r--r--net/sunrpc/sched.c4
-rw-r--r--net/sunrpc/stats.c21
-rw-r--r--net/sunrpc/sunrpc_syms.c12
-rw-r--r--net/sunrpc/svc.c23
-rw-r--r--net/sunrpc/svc_xprt.c31
-rw-r--r--net/sunrpc/sysctl.c2
-rw-r--r--net/sunrpc/xprt.c19
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c4
-rw-r--r--net/sunrpc/xprtrdma/transport.c12
-rw-r--r--net/sunrpc/xprtrdma/verbs.c122
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h6
-rw-r--r--net/sunrpc/xprtsock.c77
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/soc/codecs/cs42l51-i2c.c1
-rw-r--r--sound/soc/codecs/cs42l51.c4
-rw-r--r--sound/soc/codecs/cs42l51.h1
-rw-r--r--sound/soc/codecs/es8328-i2c.c2
-rw-r--r--sound/soc/codecs/max98090.c6
-rw-r--r--sound/soc/codecs/rt5645.c2
-rw-r--r--sound/soc/codecs/rt5670.c36
-rw-r--r--sound/soc/codecs/sgtl5000.c3
-rw-r--r--sound/soc/codecs/sgtl5000.h2
-rw-r--r--sound/soc/codecs/wm_adsp.c1
-rw-r--r--sound/soc/fsl/fsl_asrc.c26
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c4
-rw-r--r--sound/soc/samsung/snow.c1
-rw-r--r--sound/soc/sh/fsi.c3
-rw-r--r--sound/soc/sh/rcar/core.c3
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/soc/soc-pcm.c72
-rw-r--r--sound/usb/mixer.c7
-rw-r--r--sound/usb/quirks.c14
271 files changed, 2556 insertions, 1021 deletions
diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
index ce6a1a072028..8a3c40829899 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
@@ -30,10 +30,6 @@ should only be used when a device has multiple interrupt parents.
30 Example: 30 Example:
31 interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; 31 interrupts-extended = <&intc1 5 1>, <&intc2 1 0>;
32 32
33A device node may contain either "interrupts" or "interrupts-extended", but not
34both. If both properties are present, then the operating system should log an
35error and use only the data in "interrupts".
36
372) Interrupt controller nodes 332) Interrupt controller nodes
38----------------------------- 34-----------------------------
39 35
diff --git a/Documentation/devicetree/bindings/pci/pci.txt b/Documentation/devicetree/bindings/pci/pci.txt
index 41aeed38926d..f8fbe9af7b2f 100644
--- a/Documentation/devicetree/bindings/pci/pci.txt
+++ b/Documentation/devicetree/bindings/pci/pci.txt
@@ -7,3 +7,14 @@ And for the interrupt mapping part:
7 7
8Open Firmware Recommended Practice: Interrupt Mapping 8Open Firmware Recommended Practice: Interrupt Mapping
9http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf 9http://www.openfirmware.org/1275/practice/imap/imap0_9d.pdf
10
11Additionally to the properties specified in the above standards a host bridge
12driver implementation may support the following properties:
13
14- linux,pci-domain:
15 If present this property assigns a fixed PCI domain number to a host bridge,
16 otherwise an unstable (across boots) unique number will be assigned.
17 It is required to either not set this property at all or set it for all
18 host bridges in the system, otherwise potentially conflicting domain numbers
19 may be assigned to root buses behind different host bridges. The domain
20 number for each host bridge in the system must be unique.
diff --git a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt
index a186181c402b..51b943cc9770 100644
--- a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pdc-pinctrl.txt
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
9common pinctrl bindings used by client devices, including the meaning of the 9common pinctrl bindings used by client devices, including the meaning of the
10phrase "pin configuration node". 10phrase "pin configuration node".
11 11
12TZ1090-PDC's pin configuration nodes act as a container for an abitrary number 12TZ1090-PDC's pin configuration nodes act as a container for an arbitrary number
13of subnodes. Each of these subnodes represents some desired configuration for a 13of subnodes. Each of these subnodes represents some desired configuration for a
14pin, a group, or a list of pins or groups. This configuration can include the 14pin, a group, or a list of pins or groups. This configuration can include the
15mux function to select on those pin(s)/group(s), and various pin configuration 15mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt
index 4b27c99f7f9d..49d0e6050940 100644
--- a/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/img,tz1090-pinctrl.txt
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
9common pinctrl bindings used by client devices, including the meaning of the 9common pinctrl bindings used by client devices, including the meaning of the
10phrase "pin configuration node". 10phrase "pin configuration node".
11 11
12TZ1090's pin configuration nodes act as a container for an abitrary number of 12TZ1090's pin configuration nodes act as a container for an arbitrary number of
13subnodes. Each of these subnodes represents some desired configuration for a 13subnodes. Each of these subnodes represents some desired configuration for a
14pin, a group, or a list of pins or groups. This configuration can include the 14pin, a group, or a list of pins or groups. This configuration can include the
15mux function to select on those pin(s)/group(s), and various pin configuration 15mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt
index daa768956069..ac4da9fe07bd 100644
--- a/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt
+++ b/Documentation/devicetree/bindings/pinctrl/lantiq,falcon-pinumx.txt
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
9common pinctrl bindings used by client devices, including the meaning of the 9common pinctrl bindings used by client devices, including the meaning of the
10phrase "pin configuration node". 10phrase "pin configuration node".
11 11
12Lantiq's pin configuration nodes act as a container for an abitrary number of 12Lantiq's pin configuration nodes act as a container for an arbitrary number of
13subnodes. Each of these subnodes represents some desired configuration for a 13subnodes. Each of these subnodes represents some desired configuration for a
14pin, a group, or a list of pins or groups. This configuration can include the 14pin, a group, or a list of pins or groups. This configuration can include the
15mux function to select on those group(s), and two pin configuration parameters: 15mux function to select on those group(s), and two pin configuration parameters:
diff --git a/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt b/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt
index b5469db1d7ad..e89b4677567d 100644
--- a/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt
+++ b/Documentation/devicetree/bindings/pinctrl/lantiq,xway-pinumx.txt
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
9common pinctrl bindings used by client devices, including the meaning of the 9common pinctrl bindings used by client devices, including the meaning of the
10phrase "pin configuration node". 10phrase "pin configuration node".
11 11
12Lantiq's pin configuration nodes act as a container for an abitrary number of 12Lantiq's pin configuration nodes act as a container for an arbitrary number of
13subnodes. Each of these subnodes represents some desired configuration for a 13subnodes. Each of these subnodes represents some desired configuration for a
14pin, a group, or a list of pins or groups. This configuration can include the 14pin, a group, or a list of pins or groups. This configuration can include the
15mux function to select on those group(s), and two pin configuration parameters: 15mux function to select on those group(s), and two pin configuration parameters:
diff --git a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
index 61e73cde9ae9..3c8ce28baad6 100644
--- a/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
+++ b/Documentation/devicetree/bindings/pinctrl/nvidia,tegra20-pinmux.txt
@@ -9,7 +9,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
9common pinctrl bindings used by client devices, including the meaning of the 9common pinctrl bindings used by client devices, including the meaning of the
10phrase "pin configuration node". 10phrase "pin configuration node".
11 11
12Tegra's pin configuration nodes act as a container for an abitrary number of 12Tegra's pin configuration nodes act as a container for an arbitrary number of
13subnodes. Each of these subnodes represents some desired configuration for a 13subnodes. Each of these subnodes represents some desired configuration for a
14pin, a group, or a list of pins or groups. This configuration can include the 14pin, a group, or a list of pins or groups. This configuration can include the
15mux function to select on those pin(s)/group(s), and various pin configuration 15mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt
index c596a6ad3285..5f55be59d914 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-sirf.txt
@@ -13,7 +13,7 @@ Optional properties:
13Please refer to pinctrl-bindings.txt in this directory for details of the common 13Please refer to pinctrl-bindings.txt in this directory for details of the common
14pinctrl bindings used by client devices. 14pinctrl bindings used by client devices.
15 15
16SiRFprimaII's pinmux nodes act as a container for an abitrary number of subnodes. 16SiRFprimaII's pinmux nodes act as a container for an arbitrary number of subnodes.
17Each of these subnodes represents some desired configuration for a group of pins. 17Each of these subnodes represents some desired configuration for a group of pins.
18 18
19Required subnode-properties: 19Required subnode-properties:
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt
index b4480d5c3aca..458615596946 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl_spear.txt
@@ -32,7 +32,7 @@ Required properties:
32Please refer to pinctrl-bindings.txt in this directory for details of the common 32Please refer to pinctrl-bindings.txt in this directory for details of the common
33pinctrl bindings used by client devices. 33pinctrl bindings used by client devices.
34 34
35SPEAr's pinmux nodes act as a container for an abitrary number of subnodes. Each 35SPEAr's pinmux nodes act as a container for an arbitrary number of subnodes. Each
36of these subnodes represents muxing for a pin, a group, or a list of pins or 36of these subnodes represents muxing for a pin, a group, or a list of pins or
37groups. 37groups.
38 38
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index 2fb90b37aa09..a7bde64798c7 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
18common pinctrl bindings used by client devices, including the meaning of the 18common pinctrl bindings used by client devices, including the meaning of the
19phrase "pin configuration node". 19phrase "pin configuration node".
20 20
21Qualcomm's pin configuration nodes act as a container for an abitrary number of 21Qualcomm's pin configuration nodes act as a container for an arbitrary number of
22subnodes. Each of these subnodes represents some desired configuration for a 22subnodes. Each of these subnodes represents some desired configuration for a
23pin, a group, or a list of pins or groups. This configuration can include the 23pin, a group, or a list of pins or groups. This configuration can include the
24mux function to select on those pin(s)/group(s), and various pin configuration 24mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt
index ffafa1990a30..c4ea61ac56f2 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8084-pinctrl.txt
@@ -47,7 +47,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
47common pinctrl bindings used by client devices, including the meaning of the 47common pinctrl bindings used by client devices, including the meaning of the
48phrase "pin configuration node". 48phrase "pin configuration node".
49 49
50The pin configuration nodes act as a container for an abitrary number of 50The pin configuration nodes act as a container for an arbitrary number of
51subnodes. Each of these subnodes represents some desired configuration for a 51subnodes. Each of these subnodes represents some desired configuration for a
52pin, a group, or a list of pins or groups. This configuration can include the 52pin, a group, or a list of pins or groups. This configuration can include the
53mux function to select on those pin(s)/group(s), and various pin configuration 53mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt
index e33e4dcdce79..6e88e91feb11 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,ipq8064-pinctrl.txt
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
18common pinctrl bindings used by client devices, including the meaning of the 18common pinctrl bindings used by client devices, including the meaning of the
19phrase "pin configuration node". 19phrase "pin configuration node".
20 20
21Qualcomm's pin configuration nodes act as a container for an abitrary number of 21Qualcomm's pin configuration nodes act as a container for an arbitrary number of
22subnodes. Each of these subnodes represents some desired configuration for a 22subnodes. Each of these subnodes represents some desired configuration for a
23pin, a group, or a list of pins or groups. This configuration can include the 23pin, a group, or a list of pins or groups. This configuration can include the
24mux function to select on those pin(s)/group(s), and various pin configuration 24mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt
index 93b7de91b9f6..eb8d8aa41f20 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8960-pinctrl.txt
@@ -47,7 +47,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
47common pinctrl bindings used by client devices, including the meaning of the 47common pinctrl bindings used by client devices, including the meaning of the
48phrase "pin configuration node". 48phrase "pin configuration node".
49 49
50The pin configuration nodes act as a container for an abitrary number of 50The pin configuration nodes act as a container for an arbitrary number of
51subnodes. Each of these subnodes represents some desired configuration for a 51subnodes. Each of these subnodes represents some desired configuration for a
52pin, a group, or a list of pins or groups. This configuration can include the 52pin, a group, or a list of pins or groups. This configuration can include the
53mux function to select on those pin(s)/group(s), and various pin configuration 53mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
index d2ea80dc43eb..e4d6a9d20f7d 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
@@ -18,7 +18,7 @@ Please refer to pinctrl-bindings.txt in this directory for details of the
18common pinctrl bindings used by client devices, including the meaning of the 18common pinctrl bindings used by client devices, including the meaning of the
19phrase "pin configuration node". 19phrase "pin configuration node".
20 20
21Qualcomm's pin configuration nodes act as a container for an abitrary number of 21Qualcomm's pin configuration nodes act as a container for an arbitrary number of
22subnodes. Each of these subnodes represents some desired configuration for a 22subnodes. Each of these subnodes represents some desired configuration for a
23pin, a group, or a list of pins or groups. This configuration can include the 23pin, a group, or a list of pins or groups. This configuration can include the
24mux function to select on those pin(s)/group(s), and various pin configuration 24mux function to select on those pin(s)/group(s), and various pin configuration
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 723999d73744..a344ec2713a5 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -34,6 +34,7 @@ chipidea Chipidea, Inc
34chrp Common Hardware Reference Platform 34chrp Common Hardware Reference Platform
35chunghwa Chunghwa Picture Tubes Ltd. 35chunghwa Chunghwa Picture Tubes Ltd.
36cirrus Cirrus Logic, Inc. 36cirrus Cirrus Logic, Inc.
37cnm Chips&Media, Inc.
37cortina Cortina Systems, Inc. 38cortina Cortina Systems, Inc.
38crystalfontz Crystalfontz America, Inc. 39crystalfontz Crystalfontz America, Inc.
39dallas Maxim Integrated Products (formerly Dallas Semiconductor) 40dallas Maxim Integrated Products (formerly Dallas Semiconductor)
@@ -92,6 +93,7 @@ maxim Maxim Integrated Products
92mediatek MediaTek Inc. 93mediatek MediaTek Inc.
93micrel Micrel Inc. 94micrel Micrel Inc.
94microchip Microchip Technology Inc. 95microchip Microchip Technology Inc.
96micron Micron Technology Inc.
95mitsubishi Mitsubishi Electric Corporation 97mitsubishi Mitsubishi Electric Corporation
96mosaixtech Mosaix Technologies, Inc. 98mosaixtech Mosaix Technologies, Inc.
97moxa Moxa 99moxa Moxa
@@ -127,6 +129,7 @@ renesas Renesas Electronics Corporation
127ricoh Ricoh Co. Ltd. 129ricoh Ricoh Co. Ltd.
128rockchip Fuzhou Rockchip Electronics Co., Ltd 130rockchip Fuzhou Rockchip Electronics Co., Ltd
129samsung Samsung Semiconductor 131samsung Samsung Semiconductor
132sandisk Sandisk Corporation
130sbs Smart Battery System 133sbs Smart Battery System
131schindler Schindler 134schindler Schindler
132seagate Seagate Technology PLC 135seagate Seagate Technology PLC
@@ -138,7 +141,7 @@ silergy Silergy Corp.
138sirf SiRF Technology, Inc. 141sirf SiRF Technology, Inc.
139sitronix Sitronix Technology Corporation 142sitronix Sitronix Technology Corporation
140smsc Standard Microsystems Corporation 143smsc Standard Microsystems Corporation
141snps Synopsys, Inc. 144snps Synopsys, Inc.
142solidrun SolidRun 145solidrun SolidRun
143sony Sony Corporation 146sony Sony Corporation
144spansion Spansion Inc. 147spansion Spansion Inc.
diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt
index 530850a72735..a27c950ece61 100644
--- a/Documentation/filesystems/overlayfs.txt
+++ b/Documentation/filesystems/overlayfs.txt
@@ -64,7 +64,7 @@ is formed.
64At mount time, the two directories given as mount options "lowerdir" and 64At mount time, the two directories given as mount options "lowerdir" and
65"upperdir" are combined into a merged directory: 65"upperdir" are combined into a merged directory:
66 66
67 mount -t overlayfs overlayfs -olowerdir=/lower,upperdir=/upper,\ 67 mount -t overlay overlay -olowerdir=/lower,upperdir=/upper,\
68workdir=/work /merged 68workdir=/work /merged
69 69
70The "workdir" needs to be an empty directory on the same filesystem 70The "workdir" needs to be an empty directory on the same filesystem
diff --git a/MAINTAINERS b/MAINTAINERS
index c444907ccd69..0ff630de8a6d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6888,11 +6888,12 @@ F: drivers/scsi/osd/
6888F: include/scsi/osd_* 6888F: include/scsi/osd_*
6889F: fs/exofs/ 6889F: fs/exofs/
6890 6890
6891OVERLAYFS FILESYSTEM 6891OVERLAY FILESYSTEM
6892M: Miklos Szeredi <miklos@szeredi.hu> 6892M: Miklos Szeredi <miklos@szeredi.hu>
6893L: linux-fsdevel@vger.kernel.org 6893L: linux-unionfs@vger.kernel.org
6894T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git
6894S: Supported 6895S: Supported
6895F: fs/overlayfs/* 6896F: fs/overlayfs/
6896F: Documentation/filesystems/overlayfs.txt 6897F: Documentation/filesystems/overlayfs.txt
6897 6898
6898P54 WIRELESS DRIVER 6899P54 WIRELESS DRIVER
diff --git a/Makefile b/Makefile
index 00d618bbe8e7..2fd5c4e5c139 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 18 2PATCHLEVEL = 18
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc5 4EXTRAVERSION = -rc6
5NAME = Diseased Newt 5NAME = Diseased Newt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/boot/dts/r8a7740.dtsi b/arch/arm/boot/dts/r8a7740.dtsi
index d46c213a17ad..eed697a6bd6b 100644
--- a/arch/arm/boot/dts/r8a7740.dtsi
+++ b/arch/arm/boot/dts/r8a7740.dtsi
@@ -433,7 +433,7 @@
433 clocks = <&cpg_clocks R8A7740_CLK_S>, 433 clocks = <&cpg_clocks R8A7740_CLK_S>,
434 <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>, 434 <&cpg_clocks R8A7740_CLK_S>, <&sub_clk>,
435 <&cpg_clocks R8A7740_CLK_B>, 435 <&cpg_clocks R8A7740_CLK_B>,
436 <&sub_clk>, <&sub_clk>, 436 <&cpg_clocks R8A7740_CLK_HPP>, <&sub_clk>,
437 <&cpg_clocks R8A7740_CLK_B>; 437 <&cpg_clocks R8A7740_CLK_B>;
438 #clock-cells = <1>; 438 #clock-cells = <1>;
439 renesas,clock-indices = < 439 renesas,clock-indices = <
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index d0e17733dc1a..e20affe156c1 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -666,9 +666,9 @@
666 #clock-cells = <0>; 666 #clock-cells = <0>;
667 clock-output-names = "sd2"; 667 clock-output-names = "sd2";
668 }; 668 };
669 sd3_clk: sd3_clk@e615007c { 669 sd3_clk: sd3_clk@e615026c {
670 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock"; 670 compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
671 reg = <0 0xe615007c 0 4>; 671 reg = <0 0xe615026c 0 4>;
672 clocks = <&pll1_div2_clk>; 672 clocks = <&pll1_div2_clk>;
673 #clock-cells = <0>; 673 #clock-cells = <0>;
674 clock-output-names = "sd3"; 674 clock-output-names = "sd3";
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 543f895d18d3..2e652e2339e9 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -361,6 +361,10 @@
361 clocks = <&ahb1_gates 6>; 361 clocks = <&ahb1_gates 6>;
362 resets = <&ahb1_rst 6>; 362 resets = <&ahb1_rst 6>;
363 #dma-cells = <1>; 363 #dma-cells = <1>;
364
365 /* DMA controller requires AHB1 clocked from PLL6 */
366 assigned-clocks = <&ahb1_mux>;
367 assigned-clock-parents = <&pll6>;
364 }; 368 };
365 369
366 mmc0: mmc@01c0f000 { 370 mmc0: mmc@01c0f000 {
diff --git a/arch/arm/boot/dts/tegra114-dalmore.dts b/arch/arm/boot/dts/tegra114-dalmore.dts
index 5c21d216515a..8b7aa0dcdc6e 100644
--- a/arch/arm/boot/dts/tegra114-dalmore.dts
+++ b/arch/arm/boot/dts/tegra114-dalmore.dts
@@ -15,6 +15,7 @@
15 aliases { 15 aliases {
16 rtc0 = "/i2c@7000d000/tps65913@58"; 16 rtc0 = "/i2c@7000d000/tps65913@58";
17 rtc1 = "/rtc@7000e000"; 17 rtc1 = "/rtc@7000e000";
18 serial0 = &uartd;
18 }; 19 };
19 20
20 memory { 21 memory {
diff --git a/arch/arm/boot/dts/tegra114-roth.dts b/arch/arm/boot/dts/tegra114-roth.dts
index c7c6825f11fb..38acf78d7815 100644
--- a/arch/arm/boot/dts/tegra114-roth.dts
+++ b/arch/arm/boot/dts/tegra114-roth.dts
@@ -15,6 +15,10 @@
15 linux,initrd-end = <0x82800000>; 15 linux,initrd-end = <0x82800000>;
16 }; 16 };
17 17
18 aliases {
19 serial0 = &uartd;
20 };
21
18 firmware { 22 firmware {
19 trusted-foundations { 23 trusted-foundations {
20 compatible = "tlm,trusted-foundations"; 24 compatible = "tlm,trusted-foundations";
@@ -916,8 +920,6 @@
916 regulator-name = "vddio-sdmmc3"; 920 regulator-name = "vddio-sdmmc3";
917 regulator-min-microvolt = <1800000>; 921 regulator-min-microvolt = <1800000>;
918 regulator-max-microvolt = <3300000>; 922 regulator-max-microvolt = <3300000>;
919 regulator-always-on;
920 regulator-boot-on;
921 }; 923 };
922 924
923 ldousb { 925 ldousb {
@@ -962,7 +964,7 @@
962 sdhci@78000400 { 964 sdhci@78000400 {
963 status = "okay"; 965 status = "okay";
964 bus-width = <4>; 966 bus-width = <4>;
965 vmmc-supply = <&vddio_sdmmc3>; 967 vqmmc-supply = <&vddio_sdmmc3>;
966 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>; 968 cd-gpios = <&gpio TEGRA_GPIO(V, 2) GPIO_ACTIVE_LOW>;
967 power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>; 969 power-gpios = <&gpio TEGRA_GPIO(H, 0) GPIO_ACTIVE_HIGH>;
968 }; 970 };
@@ -971,7 +973,6 @@
971 sdhci@78000600 { 973 sdhci@78000600 {
972 status = "okay"; 974 status = "okay";
973 bus-width = <8>; 975 bus-width = <8>;
974 vmmc-supply = <&vdd_1v8>;
975 non-removable; 976 non-removable;
976 }; 977 };
977 978
diff --git a/arch/arm/boot/dts/tegra114-tn7.dts b/arch/arm/boot/dts/tegra114-tn7.dts
index 963662145635..f91c2c9b2f94 100644
--- a/arch/arm/boot/dts/tegra114-tn7.dts
+++ b/arch/arm/boot/dts/tegra114-tn7.dts
@@ -15,6 +15,10 @@
15 linux,initrd-end = <0x82800000>; 15 linux,initrd-end = <0x82800000>;
16 }; 16 };
17 17
18 aliases {
19 serial0 = &uartd;
20 };
21
18 firmware { 22 firmware {
19 trusted-foundations { 23 trusted-foundations {
20 compatible = "tlm,trusted-foundations"; 24 compatible = "tlm,trusted-foundations";
@@ -240,7 +244,6 @@
240 sdhci@78000600 { 244 sdhci@78000600 {
241 status = "okay"; 245 status = "okay";
242 bus-width = <8>; 246 bus-width = <8>;
243 vmmc-supply = <&vdd_1v8>;
244 non-removable; 247 non-removable;
245 }; 248 };
246 249
diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 2ca9c1807f72..222f3b3f4dd5 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -9,13 +9,6 @@
9 compatible = "nvidia,tegra114"; 9 compatible = "nvidia,tegra114";
10 interrupt-parent = <&gic>; 10 interrupt-parent = <&gic>;
11 11
12 aliases {
13 serial0 = &uarta;
14 serial1 = &uartb;
15 serial2 = &uartc;
16 serial3 = &uartd;
17 };
18
19 host1x@50000000 { 12 host1x@50000000 {
20 compatible = "nvidia,tegra114-host1x", "simple-bus"; 13 compatible = "nvidia,tegra114-host1x", "simple-bus";
21 reg = <0x50000000 0x00028000>; 14 reg = <0x50000000 0x00028000>;
diff --git a/arch/arm/boot/dts/tegra124-jetson-tk1.dts b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
index 029c9a021541..51b373ff1065 100644
--- a/arch/arm/boot/dts/tegra124-jetson-tk1.dts
+++ b/arch/arm/boot/dts/tegra124-jetson-tk1.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@0,7000d000/pmic@40"; 11 rtc0 = "/i2c@0,7000d000/pmic@40";
12 rtc1 = "/rtc@0,7000e000"; 12 rtc1 = "/rtc@0,7000e000";
13 serial0 = &uartd;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra124-nyan-big.dts b/arch/arm/boot/dts/tegra124-nyan-big.dts
index 7d0784ce4c74..53181d310247 100644
--- a/arch/arm/boot/dts/tegra124-nyan-big.dts
+++ b/arch/arm/boot/dts/tegra124-nyan-big.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@0,7000d000/pmic@40"; 11 rtc0 = "/i2c@0,7000d000/pmic@40";
12 rtc1 = "/rtc@0,7000e000"; 12 rtc1 = "/rtc@0,7000e000";
13 serial0 = &uarta;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra124-venice2.dts b/arch/arm/boot/dts/tegra124-venice2.dts
index 13008858e967..5c3f7813360d 100644
--- a/arch/arm/boot/dts/tegra124-venice2.dts
+++ b/arch/arm/boot/dts/tegra124-venice2.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@0,7000d000/pmic@40"; 11 rtc0 = "/i2c@0,7000d000/pmic@40";
12 rtc1 = "/rtc@0,7000e000"; 12 rtc1 = "/rtc@0,7000e000";
13 serial0 = &uarta;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
index 478c555ebd96..df2b06b29985 100644
--- a/arch/arm/boot/dts/tegra124.dtsi
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -286,7 +286,7 @@
286 * the APB DMA based serial driver, the comptible is 286 * the APB DMA based serial driver, the comptible is
287 * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart". 287 * "nvidia,tegra124-hsuart", "nvidia,tegra30-hsuart".
288 */ 288 */
289 serial@0,70006000 { 289 uarta: serial@0,70006000 {
290 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 290 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
291 reg = <0x0 0x70006000 0x0 0x40>; 291 reg = <0x0 0x70006000 0x0 0x40>;
292 reg-shift = <2>; 292 reg-shift = <2>;
@@ -299,7 +299,7 @@
299 status = "disabled"; 299 status = "disabled";
300 }; 300 };
301 301
302 serial@0,70006040 { 302 uartb: serial@0,70006040 {
303 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 303 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
304 reg = <0x0 0x70006040 0x0 0x40>; 304 reg = <0x0 0x70006040 0x0 0x40>;
305 reg-shift = <2>; 305 reg-shift = <2>;
@@ -312,7 +312,7 @@
312 status = "disabled"; 312 status = "disabled";
313 }; 313 };
314 314
315 serial@0,70006200 { 315 uartc: serial@0,70006200 {
316 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 316 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
317 reg = <0x0 0x70006200 0x0 0x40>; 317 reg = <0x0 0x70006200 0x0 0x40>;
318 reg-shift = <2>; 318 reg-shift = <2>;
@@ -325,7 +325,7 @@
325 status = "disabled"; 325 status = "disabled";
326 }; 326 };
327 327
328 serial@0,70006300 { 328 uartd: serial@0,70006300 {
329 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart"; 329 compatible = "nvidia,tegra124-uart", "nvidia,tegra20-uart";
330 reg = <0x0 0x70006300 0x0 0x40>; 330 reg = <0x0 0x70006300 0x0 0x40>;
331 reg-shift = <2>; 331 reg-shift = <2>;
diff --git a/arch/arm/boot/dts/tegra20-harmony.dts b/arch/arm/boot/dts/tegra20-harmony.dts
index a37279af687c..b926a07b9443 100644
--- a/arch/arm/boot/dts/tegra20-harmony.dts
+++ b/arch/arm/boot/dts/tegra20-harmony.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34"; 11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000"; 12 rtc1 = "/rtc@7000e000";
13 serial0 = &uartd;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra20-iris-512.dts b/arch/arm/boot/dts/tegra20-iris-512.dts
index 8cfb83f42e1f..1dd7d7bfdfcc 100644
--- a/arch/arm/boot/dts/tegra20-iris-512.dts
+++ b/arch/arm/boot/dts/tegra20-iris-512.dts
@@ -6,6 +6,11 @@
6 model = "Toradex Colibri T20 512MB on Iris"; 6 model = "Toradex Colibri T20 512MB on Iris";
7 compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20"; 7 compatible = "toradex,iris", "toradex,colibri_t20-512", "nvidia,tegra20";
8 8
9 aliases {
10 serial0 = &uarta;
11 serial1 = &uartd;
12 };
13
9 host1x@50000000 { 14 host1x@50000000 {
10 hdmi@54280000 { 15 hdmi@54280000 {
11 status = "okay"; 16 status = "okay";
diff --git a/arch/arm/boot/dts/tegra20-medcom-wide.dts b/arch/arm/boot/dts/tegra20-medcom-wide.dts
index 1b7c56b33aca..9b87526ab0b7 100644
--- a/arch/arm/boot/dts/tegra20-medcom-wide.dts
+++ b/arch/arm/boot/dts/tegra20-medcom-wide.dts
@@ -6,6 +6,10 @@
6 model = "Avionic Design Medcom-Wide board"; 6 model = "Avionic Design Medcom-Wide board";
7 compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20"; 7 compatible = "ad,medcom-wide", "ad,tamonten", "nvidia,tegra20";
8 8
9 aliases {
10 serial0 = &uartd;
11 };
12
9 pwm@7000a000 { 13 pwm@7000a000 {
10 status = "okay"; 14 status = "okay";
11 }; 15 };
diff --git a/arch/arm/boot/dts/tegra20-paz00.dts b/arch/arm/boot/dts/tegra20-paz00.dts
index d4438e30de45..ed7e1009326c 100644
--- a/arch/arm/boot/dts/tegra20-paz00.dts
+++ b/arch/arm/boot/dts/tegra20-paz00.dts
@@ -10,6 +10,8 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34"; 11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000"; 12 rtc1 = "/rtc@7000e000";
13 serial0 = &uarta;
14 serial1 = &uartc;
13 }; 15 };
14 16
15 memory { 17 memory {
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index a1d4bf9895d7..ea282c7c0ca5 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34"; 11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000"; 12 rtc1 = "/rtc@7000e000";
13 serial0 = &uartd;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
index 80e7d386ce34..13d4e6185275 100644
--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
+++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
@@ -7,6 +7,7 @@
7 aliases { 7 aliases {
8 rtc0 = "/i2c@7000d000/tps6586x@34"; 8 rtc0 = "/i2c@7000d000/tps6586x@34";
9 rtc1 = "/rtc@7000e000"; 9 rtc1 = "/rtc@7000e000";
10 serial0 = &uartd;
10 }; 11 };
11 12
12 memory { 13 memory {
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 5ad87979ab13..d99af4ef9c64 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@7000c500/rtc@56"; 11 rtc0 = "/i2c@7000c500/rtc@56";
12 rtc1 = "/rtc@7000e000"; 12 rtc1 = "/rtc@7000e000";
13 serial0 = &uarta;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra20-ventana.dts b/arch/arm/boot/dts/tegra20-ventana.dts
index ca8484cccddc..04c58e9ca490 100644
--- a/arch/arm/boot/dts/tegra20-ventana.dts
+++ b/arch/arm/boot/dts/tegra20-ventana.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@7000d000/tps6586x@34"; 11 rtc0 = "/i2c@7000d000/tps6586x@34";
12 rtc1 = "/rtc@7000e000"; 12 rtc1 = "/rtc@7000e000";
13 serial0 = &uartd;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index 1843725785c9..340d81108df1 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -10,6 +10,7 @@
10 aliases { 10 aliases {
11 rtc0 = "/i2c@7000d000/max8907@3c"; 11 rtc0 = "/i2c@7000d000/max8907@3c";
12 rtc1 = "/rtc@7000e000"; 12 rtc1 = "/rtc@7000e000";
13 serial0 = &uarta;
13 }; 14 };
14 15
15 memory { 16 memory {
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 3b374c49d04d..8acf5d85c99d 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -9,14 +9,6 @@
9 compatible = "nvidia,tegra20"; 9 compatible = "nvidia,tegra20";
10 interrupt-parent = <&intc>; 10 interrupt-parent = <&intc>;
11 11
12 aliases {
13 serial0 = &uarta;
14 serial1 = &uartb;
15 serial2 = &uartc;
16 serial3 = &uartd;
17 serial4 = &uarte;
18 };
19
20 host1x@50000000 { 12 host1x@50000000 {
21 compatible = "nvidia,tegra20-host1x", "simple-bus"; 13 compatible = "nvidia,tegra20-host1x", "simple-bus";
22 reg = <0x50000000 0x00024000>; 14 reg = <0x50000000 0x00024000>;
diff --git a/arch/arm/boot/dts/tegra30-apalis-eval.dts b/arch/arm/boot/dts/tegra30-apalis-eval.dts
index 45d40f024585..6236bdecb48b 100644
--- a/arch/arm/boot/dts/tegra30-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra30-apalis-eval.dts
@@ -11,6 +11,10 @@
11 rtc0 = "/i2c@7000c000/rtc@68"; 11 rtc0 = "/i2c@7000c000/rtc@68";
12 rtc1 = "/i2c@7000d000/tps65911@2d"; 12 rtc1 = "/i2c@7000d000/tps65911@2d";
13 rtc2 = "/rtc@7000e000"; 13 rtc2 = "/rtc@7000e000";
14 serial0 = &uarta;
15 serial1 = &uartb;
16 serial2 = &uartc;
17 serial3 = &uartd;
14 }; 18 };
15 19
16 pcie-controller@00003000 { 20 pcie-controller@00003000 {
diff --git a/arch/arm/boot/dts/tegra30-beaver.dts b/arch/arm/boot/dts/tegra30-beaver.dts
index cee8f2246fdb..6b157eeabcc5 100644
--- a/arch/arm/boot/dts/tegra30-beaver.dts
+++ b/arch/arm/boot/dts/tegra30-beaver.dts
@@ -9,6 +9,7 @@
9 aliases { 9 aliases {
10 rtc0 = "/i2c@7000d000/tps65911@2d"; 10 rtc0 = "/i2c@7000d000/tps65911@2d";
11 rtc1 = "/rtc@7000e000"; 11 rtc1 = "/rtc@7000e000";
12 serial0 = &uarta;
12 }; 13 };
13 14
14 memory { 15 memory {
diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi
index 206379546244..a1b682ea01bd 100644
--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi
+++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi
@@ -30,6 +30,8 @@
30 aliases { 30 aliases {
31 rtc0 = "/i2c@7000d000/tps65911@2d"; 31 rtc0 = "/i2c@7000d000/tps65911@2d";
32 rtc1 = "/rtc@7000e000"; 32 rtc1 = "/rtc@7000e000";
33 serial0 = &uarta;
34 serial1 = &uartc;
33 }; 35 };
34 36
35 memory { 37 memory {
diff --git a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
index 7793abd5bef1..4d3ddc585641 100644
--- a/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
+++ b/arch/arm/boot/dts/tegra30-colibri-eval-v3.dts
@@ -10,6 +10,9 @@
10 rtc0 = "/i2c@7000c000/rtc@68"; 10 rtc0 = "/i2c@7000c000/rtc@68";
11 rtc1 = "/i2c@7000d000/tps65911@2d"; 11 rtc1 = "/i2c@7000d000/tps65911@2d";
12 rtc2 = "/rtc@7000e000"; 12 rtc2 = "/rtc@7000e000";
13 serial0 = &uarta;
14 serial1 = &uartb;
15 serial2 = &uartd;
13 }; 16 };
14 17
15 host1x@50000000 { 18 host1x@50000000 {
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index aa6ccea13d30..b270b9e3d455 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -9,14 +9,6 @@
9 compatible = "nvidia,tegra30"; 9 compatible = "nvidia,tegra30";
10 interrupt-parent = <&intc>; 10 interrupt-parent = <&intc>;
11 11
12 aliases {
13 serial0 = &uarta;
14 serial1 = &uartb;
15 serial2 = &uartc;
16 serial3 = &uartd;
17 serial4 = &uarte;
18 };
19
20 pcie-controller@00003000 { 12 pcie-controller@00003000 {
21 compatible = "nvidia,tegra30-pcie"; 13 compatible = "nvidia,tegra30-pcie";
22 device_type = "pci"; 14 device_type = "pci";
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 3487046d8a78..9d7a32f93fcf 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -217,6 +217,7 @@ CONFIG_I2C_CADENCE=y
217CONFIG_I2C_DESIGNWARE_PLATFORM=y 217CONFIG_I2C_DESIGNWARE_PLATFORM=y
218CONFIG_I2C_EXYNOS5=y 218CONFIG_I2C_EXYNOS5=y
219CONFIG_I2C_MV64XXX=y 219CONFIG_I2C_MV64XXX=y
220CONFIG_I2C_S3C2410=y
220CONFIG_I2C_SIRF=y 221CONFIG_I2C_SIRF=y
221CONFIG_I2C_TEGRA=y 222CONFIG_I2C_TEGRA=y
222CONFIG_I2C_ST=y 223CONFIG_I2C_ST=y
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 0794f0426e70..19df9cb30495 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -455,7 +455,7 @@ enum {
455 MSTP128, MSTP127, MSTP125, 455 MSTP128, MSTP127, MSTP125,
456 MSTP116, MSTP111, MSTP100, MSTP117, 456 MSTP116, MSTP111, MSTP100, MSTP117,
457 457
458 MSTP230, 458 MSTP230, MSTP229,
459 MSTP222, 459 MSTP222,
460 MSTP218, MSTP217, MSTP216, MSTP214, 460 MSTP218, MSTP217, MSTP216, MSTP214,
461 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 461 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
@@ -474,11 +474,12 @@ static struct clk mstp_clks[MSTP_NR] = {
474 [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */ 474 [MSTP127] = SH_CLK_MSTP32(&div4_clks[DIV4_S], SMSTPCR1, 27, 0), /* CEU20 */
475 [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ 475 [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
476 [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ 476 [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */
477 [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ 477 [MSTP116] = SH_CLK_MSTP32(&div4_clks[DIV4_HPP], SMSTPCR1, 16, 0), /* IIC0 */
478 [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ 478 [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */
479 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */ 479 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
480 480
481 [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ 481 [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */
482 [MSTP229] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 29, 0), /* INTCA */
482 [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ 483 [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
483 [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */ 484 [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC1 */
484 [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */ 485 [MSTP217] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 17, 0), /* DMAC2 */
@@ -575,6 +576,10 @@ static struct clk_lookup lookups[] = {
575 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), 576 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
576 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]), 577 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP222]),
577 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]), 578 CLKDEV_DEV_ID("e6cd0000.serial", &mstp_clks[MSTP222]),
579 CLKDEV_DEV_ID("renesas_intc_irqpin.0", &mstp_clks[MSTP229]),
580 CLKDEV_DEV_ID("renesas_intc_irqpin.1", &mstp_clks[MSTP229]),
581 CLKDEV_DEV_ID("renesas_intc_irqpin.2", &mstp_clks[MSTP229]),
582 CLKDEV_DEV_ID("renesas_intc_irqpin.3", &mstp_clks[MSTP229]),
578 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]), 583 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP230]),
579 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]), 584 CLKDEV_DEV_ID("e6cc0000.serial", &mstp_clks[MSTP230]),
580 585
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index 126ddafad526..f62265200592 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -68,7 +68,7 @@
68 68
69#define SDCKCR 0xE6150074 69#define SDCKCR 0xE6150074
70#define SD2CKCR 0xE6150078 70#define SD2CKCR 0xE6150078
71#define SD3CKCR 0xE615007C 71#define SD3CKCR 0xE615026C
72#define MMC0CKCR 0xE6150240 72#define MMC0CKCR 0xE6150240
73#define MMC1CKCR 0xE6150244 73#define MMC1CKCR 0xE6150244
74#define SSPCKCR 0xE6150248 74#define SSPCKCR 0xE6150248
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index b7bd8e509668..328657d011d5 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -26,6 +26,7 @@
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/i2c/i2c-sh_mobile.h>
29#include <linux/io.h> 30#include <linux/io.h>
30#include <linux/serial_sci.h> 31#include <linux/serial_sci.h>
31#include <linux/sh_dma.h> 32#include <linux/sh_dma.h>
@@ -192,11 +193,18 @@ static struct resource i2c4_resources[] = {
192 }, 193 },
193}; 194};
194 195
196static struct i2c_sh_mobile_platform_data i2c_platform_data = {
197 .clks_per_count = 2,
198};
199
195static struct platform_device i2c0_device = { 200static struct platform_device i2c0_device = {
196 .name = "i2c-sh_mobile", 201 .name = "i2c-sh_mobile",
197 .id = 0, 202 .id = 0,
198 .resource = i2c0_resources, 203 .resource = i2c0_resources,
199 .num_resources = ARRAY_SIZE(i2c0_resources), 204 .num_resources = ARRAY_SIZE(i2c0_resources),
205 .dev = {
206 .platform_data = &i2c_platform_data,
207 },
200}; 208};
201 209
202static struct platform_device i2c1_device = { 210static struct platform_device i2c1_device = {
@@ -204,6 +212,9 @@ static struct platform_device i2c1_device = {
204 .id = 1, 212 .id = 1,
205 .resource = i2c1_resources, 213 .resource = i2c1_resources,
206 .num_resources = ARRAY_SIZE(i2c1_resources), 214 .num_resources = ARRAY_SIZE(i2c1_resources),
215 .dev = {
216 .platform_data = &i2c_platform_data,
217 },
207}; 218};
208 219
209static struct platform_device i2c2_device = { 220static struct platform_device i2c2_device = {
@@ -211,6 +222,9 @@ static struct platform_device i2c2_device = {
211 .id = 2, 222 .id = 2,
212 .resource = i2c2_resources, 223 .resource = i2c2_resources,
213 .num_resources = ARRAY_SIZE(i2c2_resources), 224 .num_resources = ARRAY_SIZE(i2c2_resources),
225 .dev = {
226 .platform_data = &i2c_platform_data,
227 },
214}; 228};
215 229
216static struct platform_device i2c3_device = { 230static struct platform_device i2c3_device = {
@@ -218,6 +232,9 @@ static struct platform_device i2c3_device = {
218 .id = 3, 232 .id = 3,
219 .resource = i2c3_resources, 233 .resource = i2c3_resources,
220 .num_resources = ARRAY_SIZE(i2c3_resources), 234 .num_resources = ARRAY_SIZE(i2c3_resources),
235 .dev = {
236 .platform_data = &i2c_platform_data,
237 },
221}; 238};
222 239
223static struct platform_device i2c4_device = { 240static struct platform_device i2c4_device = {
@@ -225,6 +242,9 @@ static struct platform_device i2c4_device = {
225 .id = 4, 242 .id = 4,
226 .resource = i2c4_resources, 243 .resource = i2c4_resources,
227 .num_resources = ARRAY_SIZE(i2c4_resources), 244 .num_resources = ARRAY_SIZE(i2c4_resources),
245 .dev = {
246 .platform_data = &i2c_platform_data,
247 },
228}; 248};
229 249
230static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = { 250static const struct sh_dmae_slave_config sh73a0_dmae_slaves[] = {
diff --git a/arch/mips/include/asm/jump_label.h b/arch/mips/include/asm/jump_label.h
index e194f957ca8c..fdbff44e5482 100644
--- a/arch/mips/include/asm/jump_label.h
+++ b/arch/mips/include/asm/jump_label.h
@@ -20,9 +20,15 @@
20#define WORD_INSN ".word" 20#define WORD_INSN ".word"
21#endif 21#endif
22 22
23#ifdef CONFIG_CPU_MICROMIPS
24#define NOP_INSN "nop32"
25#else
26#define NOP_INSN "nop"
27#endif
28
23static __always_inline bool arch_static_branch(struct static_key *key) 29static __always_inline bool arch_static_branch(struct static_key *key)
24{ 30{
25 asm_volatile_goto("1:\tnop\n\t" 31 asm_volatile_goto("1:\t" NOP_INSN "\n\t"
26 "nop\n\t" 32 "nop\n\t"
27 ".pushsection __jump_table, \"aw\"\n\t" 33 ".pushsection __jump_table, \"aw\"\n\t"
28 WORD_INSN " 1b, %l[l_yes], %0\n\t" 34 WORD_INSN " 1b, %l[l_yes], %0\n\t"
diff --git a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
index 7d28f95b0512..6d69332f21ec 100644
--- a/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
@@ -41,10 +41,8 @@
41#define cpu_has_mcheck 0 41#define cpu_has_mcheck 0
42#define cpu_has_mdmx 0 42#define cpu_has_mdmx 0
43#define cpu_has_mips16 0 43#define cpu_has_mips16 0
44#define cpu_has_mips32r1 0
45#define cpu_has_mips32r2 0 44#define cpu_has_mips32r2 0
46#define cpu_has_mips3d 0 45#define cpu_has_mips3d 0
47#define cpu_has_mips64r1 0
48#define cpu_has_mips64r2 0 46#define cpu_has_mips64r2 0
49#define cpu_has_mipsmt 0 47#define cpu_has_mipsmt 0
50#define cpu_has_prefetch 0 48#define cpu_has_prefetch 0
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index a10951090234..133678ab4eb8 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -301,7 +301,8 @@ do { \
301 __get_kernel_common((x), size, __gu_ptr); \ 301 __get_kernel_common((x), size, __gu_ptr); \
302 else \ 302 else \
303 __get_user_common((x), size, __gu_ptr); \ 303 __get_user_common((x), size, __gu_ptr); \
304 } \ 304 } else \
305 (x) = 0; \
305 \ 306 \
306 __gu_err; \ 307 __gu_err; \
307}) 308})
@@ -316,6 +317,7 @@ do { \
316 " .insn \n" \ 317 " .insn \n" \
317 " .section .fixup,\"ax\" \n" \ 318 " .section .fixup,\"ax\" \n" \
318 "3: li %0, %4 \n" \ 319 "3: li %0, %4 \n" \
320 " move %1, $0 \n" \
319 " j 2b \n" \ 321 " j 2b \n" \
320 " .previous \n" \ 322 " .previous \n" \
321 " .section __ex_table,\"a\" \n" \ 323 " .section __ex_table,\"a\" \n" \
@@ -630,6 +632,7 @@ do { \
630 " .insn \n" \ 632 " .insn \n" \
631 " .section .fixup,\"ax\" \n" \ 633 " .section .fixup,\"ax\" \n" \
632 "3: li %0, %4 \n" \ 634 "3: li %0, %4 \n" \
635 " move %1, $0 \n" \
633 " j 2b \n" \ 636 " j 2b \n" \
634 " .previous \n" \ 637 " .previous \n" \
635 " .section __ex_table,\"a\" \n" \ 638 " .section __ex_table,\"a\" \n" \
@@ -773,10 +776,11 @@ extern void __put_user_unaligned_unknown(void);
773 "jal\t" #destination "\n\t" 776 "jal\t" #destination "\n\t"
774#endif 777#endif
775 778
776#ifndef CONFIG_CPU_DADDI_WORKAROUNDS 779#if defined(CONFIG_CPU_DADDI_WORKAROUNDS) || (defined(CONFIG_EVA) && \
777#define DADDI_SCRATCH "$0" 780 defined(CONFIG_CPU_HAS_PREFETCH))
778#else
779#define DADDI_SCRATCH "$3" 781#define DADDI_SCRATCH "$3"
782#else
783#define DADDI_SCRATCH "$0"
780#endif 784#endif
781 785
782extern size_t __copy_user(void *__to, const void *__from, size_t __n); 786extern size_t __copy_user(void *__to, const void *__from, size_t __n);
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 94c4a0c0a577..d5a4f380b019 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -757,31 +757,34 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
757 c->cputype = CPU_LOONGSON2; 757 c->cputype = CPU_LOONGSON2;
758 __cpu_name[cpu] = "ICT Loongson-2"; 758 __cpu_name[cpu] = "ICT Loongson-2";
759 set_elf_platform(cpu, "loongson2e"); 759 set_elf_platform(cpu, "loongson2e");
760 set_isa(c, MIPS_CPU_ISA_III);
760 break; 761 break;
761 case PRID_REV_LOONGSON2F: 762 case PRID_REV_LOONGSON2F:
762 c->cputype = CPU_LOONGSON2; 763 c->cputype = CPU_LOONGSON2;
763 __cpu_name[cpu] = "ICT Loongson-2"; 764 __cpu_name[cpu] = "ICT Loongson-2";
764 set_elf_platform(cpu, "loongson2f"); 765 set_elf_platform(cpu, "loongson2f");
766 set_isa(c, MIPS_CPU_ISA_III);
765 break; 767 break;
766 case PRID_REV_LOONGSON3A: 768 case PRID_REV_LOONGSON3A:
767 c->cputype = CPU_LOONGSON3; 769 c->cputype = CPU_LOONGSON3;
768 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
769 __cpu_name[cpu] = "ICT Loongson-3"; 770 __cpu_name[cpu] = "ICT Loongson-3";
770 set_elf_platform(cpu, "loongson3a"); 771 set_elf_platform(cpu, "loongson3a");
772 set_isa(c, MIPS_CPU_ISA_M64R1);
771 break; 773 break;
772 case PRID_REV_LOONGSON3B_R1: 774 case PRID_REV_LOONGSON3B_R1:
773 case PRID_REV_LOONGSON3B_R2: 775 case PRID_REV_LOONGSON3B_R2:
774 c->cputype = CPU_LOONGSON3; 776 c->cputype = CPU_LOONGSON3;
775 __cpu_name[cpu] = "ICT Loongson-3"; 777 __cpu_name[cpu] = "ICT Loongson-3";
776 set_elf_platform(cpu, "loongson3b"); 778 set_elf_platform(cpu, "loongson3b");
779 set_isa(c, MIPS_CPU_ISA_M64R1);
777 break; 780 break;
778 } 781 }
779 782
780 set_isa(c, MIPS_CPU_ISA_III);
781 c->options = R4K_OPTS | 783 c->options = R4K_OPTS |
782 MIPS_CPU_FPU | MIPS_CPU_LLSC | 784 MIPS_CPU_FPU | MIPS_CPU_LLSC |
783 MIPS_CPU_32FPR; 785 MIPS_CPU_32FPR;
784 c->tlbsize = 64; 786 c->tlbsize = 64;
787 c->writecombine = _CACHE_UNCACHED_ACCELERATED;
785 break; 788 break;
786 case PRID_IMP_LOONGSON_32: /* Loongson-1 */ 789 case PRID_IMP_LOONGSON_32: /* Loongson-1 */
787 decode_configs(c); 790 decode_configs(c);
diff --git a/arch/mips/kernel/jump_label.c b/arch/mips/kernel/jump_label.c
index 6001610cfe55..dda800e9e731 100644
--- a/arch/mips/kernel/jump_label.c
+++ b/arch/mips/kernel/jump_label.c
@@ -18,31 +18,53 @@
18 18
19#ifdef HAVE_JUMP_LABEL 19#ifdef HAVE_JUMP_LABEL
20 20
21#define J_RANGE_MASK ((1ul << 28) - 1) 21/*
22 * Define parameters for the standard MIPS and the microMIPS jump
23 * instruction encoding respectively:
24 *
25 * - the ISA bit of the target, either 0 or 1 respectively,
26 *
27 * - the amount the jump target address is shifted right to fit in the
28 * immediate field of the machine instruction, either 2 or 1,
29 *
30 * - the mask determining the size of the jump region relative to the
31 * delay-slot instruction, either 256MB or 128MB,
32 *
33 * - the jump target alignment, either 4 or 2 bytes.
34 */
35#define J_ISA_BIT IS_ENABLED(CONFIG_CPU_MICROMIPS)
36#define J_RANGE_SHIFT (2 - J_ISA_BIT)
37#define J_RANGE_MASK ((1ul << (26 + J_RANGE_SHIFT)) - 1)
38#define J_ALIGN_MASK ((1ul << J_RANGE_SHIFT) - 1)
22 39
23void arch_jump_label_transform(struct jump_entry *e, 40void arch_jump_label_transform(struct jump_entry *e,
24 enum jump_label_type type) 41 enum jump_label_type type)
25{ 42{
43 union mips_instruction *insn_p;
26 union mips_instruction insn; 44 union mips_instruction insn;
27 union mips_instruction *insn_p =
28 (union mips_instruction *)(unsigned long)e->code;
29 45
30 /* Jump only works within a 256MB aligned region. */ 46 insn_p = (union mips_instruction *)msk_isa16_mode(e->code);
31 BUG_ON((e->target & ~J_RANGE_MASK) != (e->code & ~J_RANGE_MASK)); 47
48 /* Jump only works within an aligned region its delay slot is in. */
49 BUG_ON((e->target & ~J_RANGE_MASK) != ((e->code + 4) & ~J_RANGE_MASK));
32 50
33 /* Target must have 4 byte alignment. */ 51 /* Target must have the right alignment and ISA must be preserved. */
34 BUG_ON((e->target & 3) != 0); 52 BUG_ON((e->target & J_ALIGN_MASK) != J_ISA_BIT);
35 53
36 if (type == JUMP_LABEL_ENABLE) { 54 if (type == JUMP_LABEL_ENABLE) {
37 insn.j_format.opcode = j_op; 55 insn.j_format.opcode = J_ISA_BIT ? mm_j32_op : j_op;
38 insn.j_format.target = (e->target & J_RANGE_MASK) >> 2; 56 insn.j_format.target = e->target >> J_RANGE_SHIFT;
39 } else { 57 } else {
40 insn.word = 0; /* nop */ 58 insn.word = 0; /* nop */
41 } 59 }
42 60
43 get_online_cpus(); 61 get_online_cpus();
44 mutex_lock(&text_mutex); 62 mutex_lock(&text_mutex);
45 *insn_p = insn; 63 if (IS_ENABLED(CONFIG_CPU_MICROMIPS)) {
64 insn_p->halfword[0] = insn.word >> 16;
65 insn_p->halfword[1] = insn.word;
66 } else
67 *insn_p = insn;
46 68
47 flush_icache_range((unsigned long)insn_p, 69 flush_icache_range((unsigned long)insn_p,
48 (unsigned long)insn_p + sizeof(*insn_p)); 70 (unsigned long)insn_p + sizeof(*insn_p));
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
index c17ef80cf65a..5d3238af9b5c 100644
--- a/arch/mips/lib/memcpy.S
+++ b/arch/mips/lib/memcpy.S
@@ -503,6 +503,7 @@
503 STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@) 503 STOREB(t0, NBYTES-2(dst), .Ls_exc_p1\@)
504.Ldone\@: 504.Ldone\@:
505 jr ra 505 jr ra
506 nop
506 .if __memcpy == 1 507 .if __memcpy == 1
507 END(memcpy) 508 END(memcpy)
508 .set __memcpy, 0 509 .set __memcpy, 0
diff --git a/arch/mips/loongson/loongson-3/numa.c b/arch/mips/loongson/loongson-3/numa.c
index 37ed184398c6..42323bcc5d28 100644
--- a/arch/mips/loongson/loongson-3/numa.c
+++ b/arch/mips/loongson/loongson-3/numa.c
@@ -33,6 +33,7 @@
33 33
34static struct node_data prealloc__node_data[MAX_NUMNODES]; 34static struct node_data prealloc__node_data[MAX_NUMNODES];
35unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; 35unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
36EXPORT_SYMBOL(__node_distances);
36struct node_data *__node_data[MAX_NUMNODES]; 37struct node_data *__node_data[MAX_NUMNODES];
37EXPORT_SYMBOL(__node_data); 38EXPORT_SYMBOL(__node_data);
38 39
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index fa6ebd4bc9e9..c3917e251f59 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -299,6 +299,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
299 299
300 local_irq_save(flags); 300 local_irq_save(flags);
301 301
302 htw_stop();
302 pid = read_c0_entryhi() & ASID_MASK; 303 pid = read_c0_entryhi() & ASID_MASK;
303 address &= (PAGE_MASK << 1); 304 address &= (PAGE_MASK << 1);
304 write_c0_entryhi(address | pid); 305 write_c0_entryhi(address | pid);
@@ -346,6 +347,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
346 tlb_write_indexed(); 347 tlb_write_indexed();
347 } 348 }
348 tlbw_use_hazard(); 349 tlbw_use_hazard();
350 htw_start();
349 flush_itlb_vm(vma); 351 flush_itlb_vm(vma);
350 local_irq_restore(flags); 352 local_irq_restore(flags);
351} 353}
@@ -422,6 +424,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
422 424
423 local_irq_save(flags); 425 local_irq_save(flags);
424 /* Save old context and create impossible VPN2 value */ 426 /* Save old context and create impossible VPN2 value */
427 htw_stop();
425 old_ctx = read_c0_entryhi(); 428 old_ctx = read_c0_entryhi();
426 old_pagemask = read_c0_pagemask(); 429 old_pagemask = read_c0_pagemask();
427 wired = read_c0_wired(); 430 wired = read_c0_wired();
@@ -443,6 +446,7 @@ __init int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
443 446
444 write_c0_entryhi(old_ctx); 447 write_c0_entryhi(old_ctx);
445 write_c0_pagemask(old_pagemask); 448 write_c0_pagemask(old_pagemask);
449 htw_start();
446out: 450out:
447 local_irq_restore(flags); 451 local_irq_restore(flags);
448 return ret; 452 return ret;
diff --git a/arch/mips/oprofile/backtrace.c b/arch/mips/oprofile/backtrace.c
index 6854ed5097d2..83a1dfd8f0e3 100644
--- a/arch/mips/oprofile/backtrace.c
+++ b/arch/mips/oprofile/backtrace.c
@@ -92,7 +92,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame,
92 /* This marks the end of the previous function, 92 /* This marks the end of the previous function,
93 which means we overran. */ 93 which means we overran. */
94 break; 94 break;
95 stack_size = (unsigned) stack_adjustment; 95 stack_size = (unsigned long) stack_adjustment;
96 } else if (is_ra_save_ins(&ip)) { 96 } else if (is_ra_save_ins(&ip)) {
97 int ra_slot = ip.i_format.simmediate; 97 int ra_slot = ip.i_format.simmediate;
98 if (ra_slot < 0) 98 if (ra_slot < 0)
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index a95c00f5fb96..a304bcc37e4f 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -107,6 +107,7 @@ static void router_recurse(klrou_t *router_a, klrou_t *router_b, int depth)
107} 107}
108 108
109unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES]; 109unsigned char __node_distances[MAX_COMPACT_NODES][MAX_COMPACT_NODES];
110EXPORT_SYMBOL(__node_distances);
110 111
111static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) 112static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
112{ 113{
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index de40b48b460e..da08ed088157 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -361,7 +361,7 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct platform_device *dev,
361 cascade_data->virq = virt_msir; 361 cascade_data->virq = virt_msir;
362 msi->cascade_array[irq_index] = cascade_data; 362 msi->cascade_array[irq_index] = cascade_data;
363 363
364 ret = request_irq(virt_msir, fsl_msi_cascade, 0, 364 ret = request_irq(virt_msir, fsl_msi_cascade, IRQF_NO_THREAD,
365 "fsl-msi-cascade", cascade_data); 365 "fsl-msi-cascade", cascade_data);
366 if (ret) { 366 if (ret) {
367 dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n", 367 dev_err(&dev->dev, "failed to request_irq(%d), ret = %d\n",
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ded8a6774ac9..41a503c15862 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -144,7 +144,7 @@ config INSTRUCTION_DECODER
144 144
145config PERF_EVENTS_INTEL_UNCORE 145config PERF_EVENTS_INTEL_UNCORE
146 def_bool y 146 def_bool y
147 depends on PERF_EVENTS && SUP_SUP_INTEL && PCI 147 depends on PERF_EVENTS && CPU_SUP_INTEL && PCI
148 148
149config OUTPUT_FORMAT 149config OUTPUT_FORMAT
150 string 150 string
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h
index f48b17df4224..3a52ee0e726d 100644
--- a/arch/x86/include/asm/page_32_types.h
+++ b/arch/x86/include/asm/page_32_types.h
@@ -20,7 +20,6 @@
20#define THREAD_SIZE_ORDER 1 20#define THREAD_SIZE_ORDER 1
21#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 21#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
22 22
23#define STACKFAULT_STACK 0
24#define DOUBLEFAULT_STACK 1 23#define DOUBLEFAULT_STACK 1
25#define NMI_STACK 0 24#define NMI_STACK 0
26#define DEBUG_STACK 0 25#define DEBUG_STACK 0
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index 678205195ae1..75450b2c7be4 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -14,12 +14,11 @@
14#define IRQ_STACK_ORDER 2 14#define IRQ_STACK_ORDER 2
15#define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) 15#define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER)
16 16
17#define STACKFAULT_STACK 1 17#define DOUBLEFAULT_STACK 1
18#define DOUBLEFAULT_STACK 2 18#define NMI_STACK 2
19#define NMI_STACK 3 19#define DEBUG_STACK 3
20#define DEBUG_STACK 4 20#define MCE_STACK 4
21#define MCE_STACK 5 21#define N_EXCEPTION_STACKS 4 /* hw limit: 7 */
22#define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
23 22
24#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) 23#define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT)
25#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) 24#define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1))
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 854053889d4d..547e344a6dc6 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -141,7 +141,7 @@ struct thread_info {
141/* Only used for 64 bit */ 141/* Only used for 64 bit */
142#define _TIF_DO_NOTIFY_MASK \ 142#define _TIF_DO_NOTIFY_MASK \
143 (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \ 143 (_TIF_SIGPENDING | _TIF_MCE_NOTIFY | _TIF_NOTIFY_RESUME | \
144 _TIF_USER_RETURN_NOTIFY) 144 _TIF_USER_RETURN_NOTIFY | _TIF_UPROBE)
145 145
146/* flags to check in __switch_to() */ 146/* flags to check in __switch_to() */
147#define _TIF_WORK_CTXSW \ 147#define _TIF_WORK_CTXSW \
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index bc8352e7010a..707adc6549d8 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -39,6 +39,7 @@ asmlinkage void simd_coprocessor_error(void);
39 39
40#ifdef CONFIG_TRACING 40#ifdef CONFIG_TRACING
41asmlinkage void trace_page_fault(void); 41asmlinkage void trace_page_fault(void);
42#define trace_stack_segment stack_segment
42#define trace_divide_error divide_error 43#define trace_divide_error divide_error
43#define trace_bounds bounds 44#define trace_bounds bounds
44#define trace_invalid_op invalid_op 45#define trace_invalid_op invalid_op
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4b4f78c9ba19..cfa9b5b2c27a 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
146 146
147static int __init x86_xsave_setup(char *s) 147static int __init x86_xsave_setup(char *s)
148{ 148{
149 if (strlen(s))
150 return 0;
149 setup_clear_cpu_cap(X86_FEATURE_XSAVE); 151 setup_clear_cpu_cap(X86_FEATURE_XSAVE);
150 setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT); 152 setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
151 setup_clear_cpu_cap(X86_FEATURE_XSAVES); 153 setup_clear_cpu_cap(X86_FEATURE_XSAVES);
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index dd9d6190b08d..2ce9051174e6 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -465,6 +465,14 @@ static void mc_bp_resume(void)
465 465
466 if (uci->valid && uci->mc) 466 if (uci->valid && uci->mc)
467 microcode_ops->apply_microcode(cpu); 467 microcode_ops->apply_microcode(cpu);
468 else if (!uci->mc)
469 /*
470 * We might resume and not have applied late microcode but still
471 * have a newer patch stashed from the early loader. We don't
472 * have it in uci->mc so we have to load it the same way we're
473 * applying patches early on the APs.
474 */
475 load_ucode_ap();
468} 476}
469 477
470static struct syscore_ops mc_syscore_ops = { 478static struct syscore_ops mc_syscore_ops = {
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
index adf138eac85c..f9ed429d6e4f 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
@@ -486,14 +486,17 @@ static struct attribute_group snbep_uncore_qpi_format_group = {
486 .attrs = snbep_uncore_qpi_formats_attr, 486 .attrs = snbep_uncore_qpi_formats_attr,
487}; 487};
488 488
489#define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \ 489#define __SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \
490 .init_box = snbep_uncore_msr_init_box, \
491 .disable_box = snbep_uncore_msr_disable_box, \ 490 .disable_box = snbep_uncore_msr_disable_box, \
492 .enable_box = snbep_uncore_msr_enable_box, \ 491 .enable_box = snbep_uncore_msr_enable_box, \
493 .disable_event = snbep_uncore_msr_disable_event, \ 492 .disable_event = snbep_uncore_msr_disable_event, \
494 .enable_event = snbep_uncore_msr_enable_event, \ 493 .enable_event = snbep_uncore_msr_enable_event, \
495 .read_counter = uncore_msr_read_counter 494 .read_counter = uncore_msr_read_counter
496 495
496#define SNBEP_UNCORE_MSR_OPS_COMMON_INIT() \
497 __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), \
498 .init_box = snbep_uncore_msr_init_box \
499
497static struct intel_uncore_ops snbep_uncore_msr_ops = { 500static struct intel_uncore_ops snbep_uncore_msr_ops = {
498 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(), 501 SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
499}; 502};
@@ -1919,6 +1922,30 @@ static struct intel_uncore_type hswep_uncore_cbox = {
1919 .format_group = &hswep_uncore_cbox_format_group, 1922 .format_group = &hswep_uncore_cbox_format_group,
1920}; 1923};
1921 1924
1925/*
1926 * Write SBOX Initialization register bit by bit to avoid spurious #GPs
1927 */
1928static void hswep_uncore_sbox_msr_init_box(struct intel_uncore_box *box)
1929{
1930 unsigned msr = uncore_msr_box_ctl(box);
1931
1932 if (msr) {
1933 u64 init = SNBEP_PMON_BOX_CTL_INT;
1934 u64 flags = 0;
1935 int i;
1936
1937 for_each_set_bit(i, (unsigned long *)&init, 64) {
1938 flags |= (1ULL << i);
1939 wrmsrl(msr, flags);
1940 }
1941 }
1942}
1943
1944static struct intel_uncore_ops hswep_uncore_sbox_msr_ops = {
1945 __SNBEP_UNCORE_MSR_OPS_COMMON_INIT(),
1946 .init_box = hswep_uncore_sbox_msr_init_box
1947};
1948
1922static struct attribute *hswep_uncore_sbox_formats_attr[] = { 1949static struct attribute *hswep_uncore_sbox_formats_attr[] = {
1923 &format_attr_event.attr, 1950 &format_attr_event.attr,
1924 &format_attr_umask.attr, 1951 &format_attr_umask.attr,
@@ -1944,7 +1971,7 @@ static struct intel_uncore_type hswep_uncore_sbox = {
1944 .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK, 1971 .event_mask = HSWEP_S_MSR_PMON_RAW_EVENT_MASK,
1945 .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL, 1972 .box_ctl = HSWEP_S0_MSR_PMON_BOX_CTL,
1946 .msr_offset = HSWEP_SBOX_MSR_OFFSET, 1973 .msr_offset = HSWEP_SBOX_MSR_OFFSET,
1947 .ops = &snbep_uncore_msr_ops, 1974 .ops = &hswep_uncore_sbox_msr_ops,
1948 .format_group = &hswep_uncore_sbox_format_group, 1975 .format_group = &hswep_uncore_sbox_format_group,
1949}; 1976};
1950 1977
@@ -2025,13 +2052,27 @@ static struct intel_uncore_type hswep_uncore_imc = {
2025 SNBEP_UNCORE_PCI_COMMON_INIT(), 2052 SNBEP_UNCORE_PCI_COMMON_INIT(),
2026}; 2053};
2027 2054
2055static unsigned hswep_uncore_irp_ctrs[] = {0xa0, 0xa8, 0xb0, 0xb8};
2056
2057static u64 hswep_uncore_irp_read_counter(struct intel_uncore_box *box, struct perf_event *event)
2058{
2059 struct pci_dev *pdev = box->pci_dev;
2060 struct hw_perf_event *hwc = &event->hw;
2061 u64 count = 0;
2062
2063 pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx], (u32 *)&count);
2064 pci_read_config_dword(pdev, hswep_uncore_irp_ctrs[hwc->idx] + 4, (u32 *)&count + 1);
2065
2066 return count;
2067}
2068
2028static struct intel_uncore_ops hswep_uncore_irp_ops = { 2069static struct intel_uncore_ops hswep_uncore_irp_ops = {
2029 .init_box = snbep_uncore_pci_init_box, 2070 .init_box = snbep_uncore_pci_init_box,
2030 .disable_box = snbep_uncore_pci_disable_box, 2071 .disable_box = snbep_uncore_pci_disable_box,
2031 .enable_box = snbep_uncore_pci_enable_box, 2072 .enable_box = snbep_uncore_pci_enable_box,
2032 .disable_event = ivbep_uncore_irp_disable_event, 2073 .disable_event = ivbep_uncore_irp_disable_event,
2033 .enable_event = ivbep_uncore_irp_enable_event, 2074 .enable_event = ivbep_uncore_irp_enable_event,
2034 .read_counter = ivbep_uncore_irp_read_counter, 2075 .read_counter = hswep_uncore_irp_read_counter,
2035}; 2076};
2036 2077
2037static struct intel_uncore_type hswep_uncore_irp = { 2078static struct intel_uncore_type hswep_uncore_irp = {
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 1abcb50b48ae..ff86f19b5758 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -24,7 +24,6 @@ static char x86_stack_ids[][8] = {
24 [ DEBUG_STACK-1 ] = "#DB", 24 [ DEBUG_STACK-1 ] = "#DB",
25 [ NMI_STACK-1 ] = "NMI", 25 [ NMI_STACK-1 ] = "NMI",
26 [ DOUBLEFAULT_STACK-1 ] = "#DF", 26 [ DOUBLEFAULT_STACK-1 ] = "#DF",
27 [ STACKFAULT_STACK-1 ] = "#SS",
28 [ MCE_STACK-1 ] = "#MC", 27 [ MCE_STACK-1 ] = "#MC",
29#if DEBUG_STKSZ > EXCEPTION_STKSZ 28#if DEBUG_STKSZ > EXCEPTION_STKSZ
30 [ N_EXCEPTION_STACKS ... 29 [ N_EXCEPTION_STACKS ...
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index df088bb03fb3..c0226ab54106 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -828,9 +828,15 @@ ENTRY(native_iret)
828 jnz native_irq_return_ldt 828 jnz native_irq_return_ldt
829#endif 829#endif
830 830
831.global native_irq_return_iret
831native_irq_return_iret: 832native_irq_return_iret:
833 /*
834 * This may fault. Non-paranoid faults on return to userspace are
835 * handled by fixup_bad_iret. These include #SS, #GP, and #NP.
836 * Double-faults due to espfix64 are handled in do_double_fault.
837 * Other faults here are fatal.
838 */
832 iretq 839 iretq
833 _ASM_EXTABLE(native_irq_return_iret, bad_iret)
834 840
835#ifdef CONFIG_X86_ESPFIX64 841#ifdef CONFIG_X86_ESPFIX64
836native_irq_return_ldt: 842native_irq_return_ldt:
@@ -858,25 +864,6 @@ native_irq_return_ldt:
858 jmp native_irq_return_iret 864 jmp native_irq_return_iret
859#endif 865#endif
860 866
861 .section .fixup,"ax"
862bad_iret:
863 /*
864 * The iret traps when the %cs or %ss being restored is bogus.
865 * We've lost the original trap vector and error code.
866 * #GPF is the most likely one to get for an invalid selector.
867 * So pretend we completed the iret and took the #GPF in user mode.
868 *
869 * We are now running with the kernel GS after exception recovery.
870 * But error_entry expects us to have user GS to match the user %cs,
871 * so swap back.
872 */
873 pushq $0
874
875 SWAPGS
876 jmp general_protection
877
878 .previous
879
880 /* edi: workmask, edx: work */ 867 /* edi: workmask, edx: work */
881retint_careful: 868retint_careful:
882 CFI_RESTORE_STATE 869 CFI_RESTORE_STATE
@@ -922,37 +909,6 @@ ENTRY(retint_kernel)
922 CFI_ENDPROC 909 CFI_ENDPROC
923END(common_interrupt) 910END(common_interrupt)
924 911
925 /*
926 * If IRET takes a fault on the espfix stack, then we
927 * end up promoting it to a doublefault. In that case,
928 * modify the stack to make it look like we just entered
929 * the #GP handler from user space, similar to bad_iret.
930 */
931#ifdef CONFIG_X86_ESPFIX64
932 ALIGN
933__do_double_fault:
934 XCPT_FRAME 1 RDI+8
935 movq RSP(%rdi),%rax /* Trap on the espfix stack? */
936 sarq $PGDIR_SHIFT,%rax
937 cmpl $ESPFIX_PGD_ENTRY,%eax
938 jne do_double_fault /* No, just deliver the fault */
939 cmpl $__KERNEL_CS,CS(%rdi)
940 jne do_double_fault
941 movq RIP(%rdi),%rax
942 cmpq $native_irq_return_iret,%rax
943 jne do_double_fault /* This shouldn't happen... */
944 movq PER_CPU_VAR(kernel_stack),%rax
945 subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */
946 movq %rax,RSP(%rdi)
947 movq $0,(%rax) /* Missing (lost) #GP error code */
948 movq $general_protection,RIP(%rdi)
949 retq
950 CFI_ENDPROC
951END(__do_double_fault)
952#else
953# define __do_double_fault do_double_fault
954#endif
955
956/* 912/*
957 * APIC interrupts. 913 * APIC interrupts.
958 */ 914 */
@@ -1124,7 +1080,7 @@ idtentry overflow do_overflow has_error_code=0
1124idtentry bounds do_bounds has_error_code=0 1080idtentry bounds do_bounds has_error_code=0
1125idtentry invalid_op do_invalid_op has_error_code=0 1081idtentry invalid_op do_invalid_op has_error_code=0
1126idtentry device_not_available do_device_not_available has_error_code=0 1082idtentry device_not_available do_device_not_available has_error_code=0
1127idtentry double_fault __do_double_fault has_error_code=1 paranoid=1 1083idtentry double_fault do_double_fault has_error_code=1 paranoid=1
1128idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0 1084idtentry coprocessor_segment_overrun do_coprocessor_segment_overrun has_error_code=0
1129idtentry invalid_TSS do_invalid_TSS has_error_code=1 1085idtentry invalid_TSS do_invalid_TSS has_error_code=1
1130idtentry segment_not_present do_segment_not_present has_error_code=1 1086idtentry segment_not_present do_segment_not_present has_error_code=1
@@ -1289,7 +1245,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
1289 1245
1290idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK 1246idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
1291idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK 1247idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
1292idtentry stack_segment do_stack_segment has_error_code=1 paranoid=1 1248idtentry stack_segment do_stack_segment has_error_code=1
1293#ifdef CONFIG_XEN 1249#ifdef CONFIG_XEN
1294idtentry xen_debug do_debug has_error_code=0 1250idtentry xen_debug do_debug has_error_code=0
1295idtentry xen_int3 do_int3 has_error_code=0 1251idtentry xen_int3 do_int3 has_error_code=0
@@ -1399,17 +1355,16 @@ error_sti:
1399 1355
1400/* 1356/*
1401 * There are two places in the kernel that can potentially fault with 1357 * There are two places in the kernel that can potentially fault with
1402 * usergs. Handle them here. The exception handlers after iret run with 1358 * usergs. Handle them here. B stepping K8s sometimes report a
1403 * kernel gs again, so don't set the user space flag. B stepping K8s 1359 * truncated RIP for IRET exceptions returning to compat mode. Check
1404 * sometimes report an truncated RIP for IRET exceptions returning to 1360 * for these here too.
1405 * compat mode. Check for these here too.
1406 */ 1361 */
1407error_kernelspace: 1362error_kernelspace:
1408 CFI_REL_OFFSET rcx, RCX+8 1363 CFI_REL_OFFSET rcx, RCX+8
1409 incl %ebx 1364 incl %ebx
1410 leaq native_irq_return_iret(%rip),%rcx 1365 leaq native_irq_return_iret(%rip),%rcx
1411 cmpq %rcx,RIP+8(%rsp) 1366 cmpq %rcx,RIP+8(%rsp)
1412 je error_swapgs 1367 je error_bad_iret
1413 movl %ecx,%eax /* zero extend */ 1368 movl %ecx,%eax /* zero extend */
1414 cmpq %rax,RIP+8(%rsp) 1369 cmpq %rax,RIP+8(%rsp)
1415 je bstep_iret 1370 je bstep_iret
@@ -1420,7 +1375,15 @@ error_kernelspace:
1420bstep_iret: 1375bstep_iret:
1421 /* Fix truncated RIP */ 1376 /* Fix truncated RIP */
1422 movq %rcx,RIP+8(%rsp) 1377 movq %rcx,RIP+8(%rsp)
1423 jmp error_swapgs 1378 /* fall through */
1379
1380error_bad_iret:
1381 SWAPGS
1382 mov %rsp,%rdi
1383 call fixup_bad_iret
1384 mov %rax,%rsp
1385 decl %ebx /* Return to usergs */
1386 jmp error_sti
1424 CFI_ENDPROC 1387 CFI_ENDPROC
1425END(error_entry) 1388END(error_entry)
1426 1389
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 749b0e423419..e510618b2e91 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1484,7 +1484,7 @@ unsigned long syscall_trace_enter_phase1(struct pt_regs *regs, u32 arch)
1484 */ 1484 */
1485 if (work & _TIF_NOHZ) { 1485 if (work & _TIF_NOHZ) {
1486 user_exit(); 1486 user_exit();
1487 work &= ~TIF_NOHZ; 1487 work &= ~_TIF_NOHZ;
1488 } 1488 }
1489 1489
1490#ifdef CONFIG_SECCOMP 1490#ifdef CONFIG_SECCOMP
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 0d0e922fafc1..de801f22128a 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -233,32 +233,40 @@ DO_ERROR(X86_TRAP_UD, SIGILL, "invalid opcode", invalid_op)
233DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun) 233DO_ERROR(X86_TRAP_OLD_MF, SIGFPE, "coprocessor segment overrun",coprocessor_segment_overrun)
234DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS) 234DO_ERROR(X86_TRAP_TS, SIGSEGV, "invalid TSS", invalid_TSS)
235DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present) 235DO_ERROR(X86_TRAP_NP, SIGBUS, "segment not present", segment_not_present)
236#ifdef CONFIG_X86_32
237DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment) 236DO_ERROR(X86_TRAP_SS, SIGBUS, "stack segment", stack_segment)
238#endif
239DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check) 237DO_ERROR(X86_TRAP_AC, SIGBUS, "alignment check", alignment_check)
240 238
241#ifdef CONFIG_X86_64 239#ifdef CONFIG_X86_64
242/* Runs on IST stack */ 240/* Runs on IST stack */
243dotraplinkage void do_stack_segment(struct pt_regs *regs, long error_code)
244{
245 enum ctx_state prev_state;
246
247 prev_state = exception_enter();
248 if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
249 X86_TRAP_SS, SIGBUS) != NOTIFY_STOP) {
250 preempt_conditional_sti(regs);
251 do_trap(X86_TRAP_SS, SIGBUS, "stack segment", regs, error_code, NULL);
252 preempt_conditional_cli(regs);
253 }
254 exception_exit(prev_state);
255}
256
257dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) 241dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code)
258{ 242{
259 static const char str[] = "double fault"; 243 static const char str[] = "double fault";
260 struct task_struct *tsk = current; 244 struct task_struct *tsk = current;
261 245
246#ifdef CONFIG_X86_ESPFIX64
247 extern unsigned char native_irq_return_iret[];
248
249 /*
250 * If IRET takes a non-IST fault on the espfix64 stack, then we
251 * end up promoting it to a doublefault. In that case, modify
252 * the stack to make it look like we just entered the #GP
253 * handler from user space, similar to bad_iret.
254 */
255 if (((long)regs->sp >> PGDIR_SHIFT) == ESPFIX_PGD_ENTRY &&
256 regs->cs == __KERNEL_CS &&
257 regs->ip == (unsigned long)native_irq_return_iret)
258 {
259 struct pt_regs *normal_regs = task_pt_regs(current);
260
261 /* Fake a #GP(0) from userspace. */
262 memmove(&normal_regs->ip, (void *)regs->sp, 5*8);
263 normal_regs->orig_ax = 0; /* Missing (lost) #GP error code */
264 regs->ip = (unsigned long)general_protection;
265 regs->sp = (unsigned long)&normal_regs->orig_ax;
266 return;
267 }
268#endif
269
262 exception_enter(); 270 exception_enter();
263 /* Return not checked because double check cannot be ignored */ 271 /* Return not checked because double check cannot be ignored */
264 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV); 272 notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
@@ -399,6 +407,35 @@ asmlinkage __visible struct pt_regs *sync_regs(struct pt_regs *eregs)
399 return regs; 407 return regs;
400} 408}
401NOKPROBE_SYMBOL(sync_regs); 409NOKPROBE_SYMBOL(sync_regs);
410
411struct bad_iret_stack {
412 void *error_entry_ret;
413 struct pt_regs regs;
414};
415
416asmlinkage __visible
417struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
418{
419 /*
420 * This is called from entry_64.S early in handling a fault
421 * caused by a bad iret to user mode. To handle the fault
422 * correctly, we want move our stack frame to task_pt_regs
423 * and we want to pretend that the exception came from the
424 * iret target.
425 */
426 struct bad_iret_stack *new_stack =
427 container_of(task_pt_regs(current),
428 struct bad_iret_stack, regs);
429
430 /* Copy the IRET target to the new stack. */
431 memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8);
432
433 /* Copy the remainder of the stack from the current stack. */
434 memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip));
435
436 BUG_ON(!user_mode_vm(&new_stack->regs));
437 return new_stack;
438}
402#endif 439#endif
403 440
404/* 441/*
@@ -778,7 +815,7 @@ void __init trap_init(void)
778 set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun); 815 set_intr_gate(X86_TRAP_OLD_MF, coprocessor_segment_overrun);
779 set_intr_gate(X86_TRAP_TS, invalid_TSS); 816 set_intr_gate(X86_TRAP_TS, invalid_TSS);
780 set_intr_gate(X86_TRAP_NP, segment_not_present); 817 set_intr_gate(X86_TRAP_NP, segment_not_present);
781 set_intr_gate_ist(X86_TRAP_SS, &stack_segment, STACKFAULT_STACK); 818 set_intr_gate(X86_TRAP_SS, stack_segment);
782 set_intr_gate(X86_TRAP_GP, general_protection); 819 set_intr_gate(X86_TRAP_GP, general_protection);
783 set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug); 820 set_intr_gate(X86_TRAP_SPURIOUS, spurious_interrupt_bug);
784 set_intr_gate(X86_TRAP_MF, coprocessor_error); 821 set_intr_gate(X86_TRAP_MF, coprocessor_error);
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 4cb8763868fc..4e5dfec750fc 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1123,7 +1123,7 @@ void mark_rodata_ro(void)
1123 unsigned long end = (unsigned long) &__end_rodata_hpage_align; 1123 unsigned long end = (unsigned long) &__end_rodata_hpage_align;
1124 unsigned long text_end = PFN_ALIGN(&__stop___ex_table); 1124 unsigned long text_end = PFN_ALIGN(&__stop___ex_table);
1125 unsigned long rodata_end = PFN_ALIGN(&__end_rodata); 1125 unsigned long rodata_end = PFN_ALIGN(&__end_rodata);
1126 unsigned long all_end = PFN_ALIGN(&_end); 1126 unsigned long all_end;
1127 1127
1128 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n", 1128 printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
1129 (end - start) >> 10); 1129 (end - start) >> 10);
@@ -1134,7 +1134,16 @@ void mark_rodata_ro(void)
1134 /* 1134 /*
1135 * The rodata/data/bss/brk section (but not the kernel text!) 1135 * The rodata/data/bss/brk section (but not the kernel text!)
1136 * should also be not-executable. 1136 * should also be not-executable.
1137 *
1138 * We align all_end to PMD_SIZE because the existing mapping
1139 * is a full PMD. If we would align _brk_end to PAGE_SIZE we
1140 * split the PMD and the reminder between _brk_end and the end
1141 * of the PMD will remain mapped executable.
1142 *
1143 * Any PMD which was setup after the one which covers _brk_end
1144 * has been zapped already via cleanup_highmem().
1137 */ 1145 */
1146 all_end = roundup((unsigned long)_brk_end, PMD_SIZE);
1138 set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); 1147 set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT);
1139 1148
1140 rodata_test(); 1149 rodata_test();
diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl
index 0b0b124d3ece..23210baade2d 100644
--- a/arch/x86/tools/calc_run_size.pl
+++ b/arch/x86/tools/calc_run_size.pl
@@ -19,7 +19,16 @@ while (<>) {
19 if ($file_offset == 0) { 19 if ($file_offset == 0) {
20 $file_offset = $offset; 20 $file_offset = $offset;
21 } elsif ($file_offset != $offset) { 21 } elsif ($file_offset != $offset) {
22 die ".bss and .brk lack common file offset\n"; 22 # BFD linker shows the same file offset in ELF.
23 # Gold linker shows them as consecutive.
24 next if ($file_offset + $mem_size == $offset + $size);
25
26 printf STDERR "file_offset: 0x%lx\n", $file_offset;
27 printf STDERR "mem_size: 0x%lx\n", $mem_size;
28 printf STDERR "offset: 0x%lx\n", $offset;
29 printf STDERR "size: 0x%lx\n", $size;
30
31 die ".bss and .brk are non-contiguous\n";
23 } 32 }
24 } 33 }
25} 34}
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index 143ec6ea1468..7db193160766 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -878,7 +878,7 @@ int acpi_dev_suspend_late(struct device *dev)
878 return 0; 878 return 0;
879 879
880 target_state = acpi_target_system_state(); 880 target_state = acpi_target_system_state();
881 wakeup = device_may_wakeup(dev); 881 wakeup = device_may_wakeup(dev) && acpi_device_can_wakeup(adev);
882 error = acpi_device_wakeup(adev, target_state, wakeup); 882 error = acpi_device_wakeup(adev, target_state, wakeup);
883 if (wakeup && error) 883 if (wakeup && error)
884 return error; 884 return error;
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index efb17c3ee120..f4a9c0058b4d 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -182,6 +182,12 @@ static void __init sun4i_timer_init(struct device_node *node)
182 /* Make sure timer is stopped before playing with interrupts */ 182 /* Make sure timer is stopped before playing with interrupts */
183 sun4i_clkevt_time_stop(0); 183 sun4i_clkevt_time_stop(0);
184 184
185 sun4i_clockevent.cpumask = cpu_possible_mask;
186 sun4i_clockevent.irq = irq;
187
188 clockevents_config_and_register(&sun4i_clockevent, rate,
189 TIMER_SYNC_TICKS, 0xffffffff);
190
185 ret = setup_irq(irq, &sun4i_timer_irq); 191 ret = setup_irq(irq, &sun4i_timer_irq);
186 if (ret) 192 if (ret)
187 pr_warn("failed to setup irq %d\n", irq); 193 pr_warn("failed to setup irq %d\n", irq);
@@ -189,12 +195,6 @@ static void __init sun4i_timer_init(struct device_node *node)
189 /* Enable timer0 interrupt */ 195 /* Enable timer0 interrupt */
190 val = readl(timer_base + TIMER_IRQ_EN_REG); 196 val = readl(timer_base + TIMER_IRQ_EN_REG);
191 writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); 197 writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG);
192
193 sun4i_clockevent.cpumask = cpu_possible_mask;
194 sun4i_clockevent.irq = irq;
195
196 clockevents_config_and_register(&sun4i_clockevent, rate,
197 TIMER_SYNC_TICKS, 0xffffffff);
198} 198}
199CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer", 199CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer",
200 sun4i_timer_init); 200 sun4i_timer_init);
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 4839bfa74a10..19a99743cf52 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -271,7 +271,7 @@ struct pl330_config {
271#define DMAC_MODE_NS (1 << 0) 271#define DMAC_MODE_NS (1 << 0)
272 unsigned int mode; 272 unsigned int mode;
273 unsigned int data_bus_width:10; /* In number of bits */ 273 unsigned int data_bus_width:10; /* In number of bits */
274 unsigned int data_buf_dep:10; 274 unsigned int data_buf_dep:11;
275 unsigned int num_chan:4; 275 unsigned int num_chan:4;
276 unsigned int num_peri:6; 276 unsigned int num_peri:6;
277 u32 peri_ns; 277 u32 peri_ns;
@@ -2336,7 +2336,7 @@ static inline int get_burst_len(struct dma_pl330_desc *desc, size_t len)
2336 int burst_len; 2336 int burst_len;
2337 2337
2338 burst_len = pl330->pcfg.data_bus_width / 8; 2338 burst_len = pl330->pcfg.data_bus_width / 8;
2339 burst_len *= pl330->pcfg.data_buf_dep; 2339 burst_len *= pl330->pcfg.data_buf_dep / pl330->pcfg.num_chan;
2340 burst_len >>= desc->rqcfg.brst_size; 2340 burst_len >>= desc->rqcfg.brst_size;
2341 2341
2342 /* src/dst_burst_len can't be more than 16 */ 2342 /* src/dst_burst_len can't be more than 16 */
@@ -2459,16 +2459,25 @@ pl330_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dst,
2459 /* Select max possible burst size */ 2459 /* Select max possible burst size */
2460 burst = pl330->pcfg.data_bus_width / 8; 2460 burst = pl330->pcfg.data_bus_width / 8;
2461 2461
2462 while (burst > 1) { 2462 /*
2463 if (!(len % burst)) 2463 * Make sure we use a burst size that aligns with all the memcpy
2464 break; 2464 * parameters because our DMA programming algorithm doesn't cope with
2465 * transfers which straddle an entry in the DMA device's MFIFO.
2466 */
2467 while ((src | dst | len) & (burst - 1))
2465 burst /= 2; 2468 burst /= 2;
2466 }
2467 2469
2468 desc->rqcfg.brst_size = 0; 2470 desc->rqcfg.brst_size = 0;
2469 while (burst != (1 << desc->rqcfg.brst_size)) 2471 while (burst != (1 << desc->rqcfg.brst_size))
2470 desc->rqcfg.brst_size++; 2472 desc->rqcfg.brst_size++;
2471 2473
2474 /*
2475 * If burst size is smaller than bus width then make sure we only
2476 * transfer one at a time to avoid a burst stradling an MFIFO entry.
2477 */
2478 if (desc->rqcfg.brst_size * 8 < pl330->pcfg.data_bus_width)
2479 desc->rqcfg.brst_len = 1;
2480
2472 desc->rqcfg.brst_len = get_burst_len(desc, len); 2481 desc->rqcfg.brst_len = get_burst_len(desc, len);
2473 2482
2474 desc->txd.flags = flags; 2483 desc->txd.flags = flags;
@@ -2732,7 +2741,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2732 2741
2733 2742
2734 dev_info(&adev->dev, 2743 dev_info(&adev->dev,
2735 "Loaded driver for PL330 DMAC-%d\n", adev->periphid); 2744 "Loaded driver for PL330 DMAC-%x\n", adev->periphid);
2736 dev_info(&adev->dev, 2745 dev_info(&adev->dev,
2737 "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n", 2746 "\tDBUFF-%ux%ubytes Num_Chans-%u Num_Peri-%u Num_Events-%u\n",
2738 pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan, 2747 pcfg->data_buf_dep, pcfg->data_bus_width / 8, pcfg->num_chan,
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c
index 3aa10b328254..91292f5513ff 100644
--- a/drivers/dma/sun6i-dma.c
+++ b/drivers/dma/sun6i-dma.c
@@ -230,30 +230,25 @@ static inline void sun6i_dma_dump_chan_regs(struct sun6i_dma_dev *sdev,
230 readl(pchan->base + DMA_CHAN_CUR_PARA)); 230 readl(pchan->base + DMA_CHAN_CUR_PARA));
231} 231}
232 232
233static inline int convert_burst(u32 maxburst, u8 *burst) 233static inline s8 convert_burst(u32 maxburst)
234{ 234{
235 switch (maxburst) { 235 switch (maxburst) {
236 case 1: 236 case 1:
237 *burst = 0; 237 return 0;
238 break;
239 case 8: 238 case 8:
240 *burst = 2; 239 return 2;
241 break;
242 default: 240 default:
243 return -EINVAL; 241 return -EINVAL;
244 } 242 }
245
246 return 0;
247} 243}
248 244
249static inline int convert_buswidth(enum dma_slave_buswidth addr_width, u8 *width) 245static inline s8 convert_buswidth(enum dma_slave_buswidth addr_width)
250{ 246{
251 if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) || 247 if ((addr_width < DMA_SLAVE_BUSWIDTH_1_BYTE) ||
252 (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES)) 248 (addr_width > DMA_SLAVE_BUSWIDTH_4_BYTES))
253 return -EINVAL; 249 return -EINVAL;
254 250
255 *width = addr_width >> 1; 251 return addr_width >> 1;
256 return 0;
257} 252}
258 253
259static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev, 254static void *sun6i_dma_lli_add(struct sun6i_dma_lli *prev,
@@ -284,26 +279,25 @@ static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli,
284 struct dma_slave_config *config) 279 struct dma_slave_config *config)
285{ 280{
286 u8 src_width, dst_width, src_burst, dst_burst; 281 u8 src_width, dst_width, src_burst, dst_burst;
287 int ret;
288 282
289 if (!config) 283 if (!config)
290 return -EINVAL; 284 return -EINVAL;
291 285
292 ret = convert_burst(config->src_maxburst, &src_burst); 286 src_burst = convert_burst(config->src_maxburst);
293 if (ret) 287 if (src_burst)
294 return ret; 288 return src_burst;
295 289
296 ret = convert_burst(config->dst_maxburst, &dst_burst); 290 dst_burst = convert_burst(config->dst_maxburst);
297 if (ret) 291 if (dst_burst)
298 return ret; 292 return dst_burst;
299 293
300 ret = convert_buswidth(config->src_addr_width, &src_width); 294 src_width = convert_buswidth(config->src_addr_width);
301 if (ret) 295 if (src_width)
302 return ret; 296 return src_width;
303 297
304 ret = convert_buswidth(config->dst_addr_width, &dst_width); 298 dst_width = convert_buswidth(config->dst_addr_width);
305 if (ret) 299 if (dst_width)
306 return ret; 300 return dst_width;
307 301
308 lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) | 302 lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) |
309 DMA_CHAN_CFG_SRC_WIDTH(src_width) | 303 DMA_CHAN_CFG_SRC_WIDTH(src_width) |
@@ -542,11 +536,10 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy(
542{ 536{
543 struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device); 537 struct sun6i_dma_dev *sdev = to_sun6i_dma_dev(chan->device);
544 struct sun6i_vchan *vchan = to_sun6i_vchan(chan); 538 struct sun6i_vchan *vchan = to_sun6i_vchan(chan);
545 struct dma_slave_config *sconfig = &vchan->cfg;
546 struct sun6i_dma_lli *v_lli; 539 struct sun6i_dma_lli *v_lli;
547 struct sun6i_desc *txd; 540 struct sun6i_desc *txd;
548 dma_addr_t p_lli; 541 dma_addr_t p_lli;
549 int ret; 542 s8 burst, width;
550 543
551 dev_dbg(chan2dev(chan), 544 dev_dbg(chan2dev(chan),
552 "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n", 545 "%s; chan: %d, dest: %pad, src: %pad, len: %zu. flags: 0x%08lx\n",
@@ -565,14 +558,21 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy(
565 goto err_txd_free; 558 goto err_txd_free;
566 } 559 }
567 560
568 ret = sun6i_dma_cfg_lli(v_lli, src, dest, len, sconfig); 561 v_lli->src = src;
569 if (ret) 562 v_lli->dst = dest;
570 goto err_dma_free; 563 v_lli->len = len;
564 v_lli->para = NORMAL_WAIT;
571 565
566 burst = convert_burst(8);
567 width = convert_buswidth(DMA_SLAVE_BUSWIDTH_4_BYTES);
572 v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) | 568 v_lli->cfg |= DMA_CHAN_CFG_SRC_DRQ(DRQ_SDRAM) |
573 DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) | 569 DMA_CHAN_CFG_DST_DRQ(DRQ_SDRAM) |
574 DMA_CHAN_CFG_DST_LINEAR_MODE | 570 DMA_CHAN_CFG_DST_LINEAR_MODE |
575 DMA_CHAN_CFG_SRC_LINEAR_MODE; 571 DMA_CHAN_CFG_SRC_LINEAR_MODE |
572 DMA_CHAN_CFG_SRC_BURST(burst) |
573 DMA_CHAN_CFG_SRC_WIDTH(width) |
574 DMA_CHAN_CFG_DST_BURST(burst) |
575 DMA_CHAN_CFG_DST_WIDTH(width);
576 576
577 sun6i_dma_lli_add(NULL, v_lli, p_lli, txd); 577 sun6i_dma_lli_add(NULL, v_lli, p_lli, txd);
578 578
@@ -580,8 +580,6 @@ static struct dma_async_tx_descriptor *sun6i_dma_prep_dma_memcpy(
580 580
581 return vchan_tx_prep(&vchan->vc, &txd->vd, flags); 581 return vchan_tx_prep(&vchan->vc, &txd->vd, flags);
582 582
583err_dma_free:
584 dma_pool_free(sdev->pool, v_lli, p_lli);
585err_txd_free: 583err_txd_free:
586 kfree(txd); 584 kfree(txd);
587 return NULL; 585 return NULL;
@@ -915,6 +913,7 @@ static int sun6i_dma_probe(struct platform_device *pdev)
915 sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy; 913 sdc->slave.device_prep_dma_memcpy = sun6i_dma_prep_dma_memcpy;
916 sdc->slave.device_control = sun6i_dma_control; 914 sdc->slave.device_control = sun6i_dma_control;
917 sdc->slave.chancnt = NR_MAX_VCHANS; 915 sdc->slave.chancnt = NR_MAX_VCHANS;
916 sdc->slave.copy_align = 4;
918 917
919 sdc->slave.dev = &pdev->dev; 918 sdc->slave.dev = &pdev->dev;
920 919
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 1403b01e8216..318ade9bb5af 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1670,15 +1670,17 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1670 goto out_regs; 1670 goto out_regs;
1671 1671
1672 if (drm_core_check_feature(dev, DRIVER_MODESET)) { 1672 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1673 ret = i915_kick_out_vgacon(dev_priv); 1673 /* WARNING: Apparently we must kick fbdev drivers before vgacon,
1674 * otherwise the vga fbdev driver falls over. */
1675 ret = i915_kick_out_firmware_fb(dev_priv);
1674 if (ret) { 1676 if (ret) {
1675 DRM_ERROR("failed to remove conflicting VGA console\n"); 1677 DRM_ERROR("failed to remove conflicting framebuffer drivers\n");
1676 goto out_gtt; 1678 goto out_gtt;
1677 } 1679 }
1678 1680
1679 ret = i915_kick_out_firmware_fb(dev_priv); 1681 ret = i915_kick_out_vgacon(dev_priv);
1680 if (ret) { 1682 if (ret) {
1681 DRM_ERROR("failed to remove conflicting framebuffer drivers\n"); 1683 DRM_ERROR("failed to remove conflicting VGA console\n");
1682 goto out_gtt; 1684 goto out_gtt;
1683 } 1685 }
1684 } 1686 }
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index c27b6140bfd1..ad2fd605f76b 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5469,11 +5469,6 @@ static void gen6_init_clock_gating(struct drm_device *dev)
5469 I915_WRITE(_3D_CHICKEN, 5469 I915_WRITE(_3D_CHICKEN,
5470 _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); 5470 _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB));
5471 5471
5472 /* WaSetupGtModeTdRowDispatch:snb */
5473 if (IS_SNB_GT1(dev))
5474 I915_WRITE(GEN6_GT_MODE,
5475 _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE));
5476
5477 /* WaDisable_RenderCache_OperationalFlush:snb */ 5472 /* WaDisable_RenderCache_OperationalFlush:snb */
5478 I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE)); 5473 I915_WRITE(CACHE_MODE_0, _MASKED_BIT_DISABLE(RC_OP_FLUSH_ENABLE));
5479 5474
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index f6309bd23e01..b5c73df8e202 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -1256,7 +1256,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev)
1256 (mode_info->atom_context->bios + data_offset + 1256 (mode_info->atom_context->bios + data_offset +
1257 le16_to_cpu(ext_hdr->usPowerTuneTableOffset)); 1257 le16_to_cpu(ext_hdr->usPowerTuneTableOffset));
1258 rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit = 1258 rdev->pm.dpm.dyn_state.cac_tdp_table->maximum_power_delivery_limit =
1259 ppt->usMaximumPowerDeliveryLimit; 1259 le16_to_cpu(ppt->usMaximumPowerDeliveryLimit);
1260 pt = &ppt->power_tune_table; 1260 pt = &ppt->power_tune_table;
1261 } else { 1261 } else {
1262 ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *) 1262 ATOM_PPLIB_POWERTUNE_Table *ppt = (ATOM_PPLIB_POWERTUNE_Table *)
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 9a19e52cc655..6b670b0bc47b 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -179,6 +179,9 @@ static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder,
179 (rdev->pdev->subsystem_vendor == 0x1734) && 179 (rdev->pdev->subsystem_vendor == 0x1734) &&
180 (rdev->pdev->subsystem_device == 0x1107)) 180 (rdev->pdev->subsystem_device == 0x1107))
181 use_bl = false; 181 use_bl = false;
182 /* disable native backlight control on older asics */
183 else if (rdev->family < CHIP_R600)
184 use_bl = false;
182 else 185 else
183 use_bl = true; 186 use_bl = true;
184 } 187 }
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 3effa931fce2..10641b7816f4 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -115,9 +115,12 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id,
115 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS; 115 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS;
116 /* 116 /*
117 * FIXME: Use devattr.max_sge - 2 for max_send_sge as 117 * FIXME: Use devattr.max_sge - 2 for max_send_sge as
118 * work-around for RDMA_READ.. 118 * work-around for RDMA_READs with ConnectX-2.
119 *
120 * Also, still make sure to have at least two SGEs for
121 * outgoing control PDU responses.
119 */ 122 */
120 attr.cap.max_send_sge = device->dev_attr.max_sge - 2; 123 attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2);
121 isert_conn->max_sge = attr.cap.max_send_sge; 124 isert_conn->max_sge = attr.cap.max_send_sge;
122 125
123 attr.cap.max_recv_sge = 1; 126 attr.cap.max_recv_sge = 1;
@@ -225,12 +228,16 @@ isert_create_device_ib_res(struct isert_device *device)
225 struct isert_cq_desc *cq_desc; 228 struct isert_cq_desc *cq_desc;
226 struct ib_device_attr *dev_attr; 229 struct ib_device_attr *dev_attr;
227 int ret = 0, i, j; 230 int ret = 0, i, j;
231 int max_rx_cqe, max_tx_cqe;
228 232
229 dev_attr = &device->dev_attr; 233 dev_attr = &device->dev_attr;
230 ret = isert_query_device(ib_dev, dev_attr); 234 ret = isert_query_device(ib_dev, dev_attr);
231 if (ret) 235 if (ret)
232 return ret; 236 return ret;
233 237
238 max_rx_cqe = min(ISER_MAX_RX_CQ_LEN, dev_attr->max_cqe);
239 max_tx_cqe = min(ISER_MAX_TX_CQ_LEN, dev_attr->max_cqe);
240
234 /* asign function handlers */ 241 /* asign function handlers */
235 if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS && 242 if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS &&
236 dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) { 243 dev_attr->device_cap_flags & IB_DEVICE_SIGNATURE_HANDOVER) {
@@ -272,7 +279,7 @@ isert_create_device_ib_res(struct isert_device *device)
272 isert_cq_rx_callback, 279 isert_cq_rx_callback,
273 isert_cq_event_callback, 280 isert_cq_event_callback,
274 (void *)&cq_desc[i], 281 (void *)&cq_desc[i],
275 ISER_MAX_RX_CQ_LEN, i); 282 max_rx_cqe, i);
276 if (IS_ERR(device->dev_rx_cq[i])) { 283 if (IS_ERR(device->dev_rx_cq[i])) {
277 ret = PTR_ERR(device->dev_rx_cq[i]); 284 ret = PTR_ERR(device->dev_rx_cq[i]);
278 device->dev_rx_cq[i] = NULL; 285 device->dev_rx_cq[i] = NULL;
@@ -284,7 +291,7 @@ isert_create_device_ib_res(struct isert_device *device)
284 isert_cq_tx_callback, 291 isert_cq_tx_callback,
285 isert_cq_event_callback, 292 isert_cq_event_callback,
286 (void *)&cq_desc[i], 293 (void *)&cq_desc[i],
287 ISER_MAX_TX_CQ_LEN, i); 294 max_tx_cqe, i);
288 if (IS_ERR(device->dev_tx_cq[i])) { 295 if (IS_ERR(device->dev_tx_cq[i])) {
289 ret = PTR_ERR(device->dev_tx_cq[i]); 296 ret = PTR_ERR(device->dev_tx_cq[i]);
290 device->dev_tx_cq[i] = NULL; 297 device->dev_tx_cq[i] = NULL;
@@ -803,14 +810,25 @@ wake_up:
803 complete(&isert_conn->conn_wait); 810 complete(&isert_conn->conn_wait);
804} 811}
805 812
806static void 813static int
807isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect) 814isert_disconnected_handler(struct rdma_cm_id *cma_id, bool disconnect)
808{ 815{
809 struct isert_conn *isert_conn = (struct isert_conn *)cma_id->context; 816 struct isert_conn *isert_conn;
817
818 if (!cma_id->qp) {
819 struct isert_np *isert_np = cma_id->context;
820
821 isert_np->np_cm_id = NULL;
822 return -1;
823 }
824
825 isert_conn = (struct isert_conn *)cma_id->context;
810 826
811 isert_conn->disconnect = disconnect; 827 isert_conn->disconnect = disconnect;
812 INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work); 828 INIT_WORK(&isert_conn->conn_logout_work, isert_disconnect_work);
813 schedule_work(&isert_conn->conn_logout_work); 829 schedule_work(&isert_conn->conn_logout_work);
830
831 return 0;
814} 832}
815 833
816static int 834static int
@@ -825,6 +843,9 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
825 switch (event->event) { 843 switch (event->event) {
826 case RDMA_CM_EVENT_CONNECT_REQUEST: 844 case RDMA_CM_EVENT_CONNECT_REQUEST:
827 ret = isert_connect_request(cma_id, event); 845 ret = isert_connect_request(cma_id, event);
846 if (ret)
847 pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
848 event->event, ret);
828 break; 849 break;
829 case RDMA_CM_EVENT_ESTABLISHED: 850 case RDMA_CM_EVENT_ESTABLISHED:
830 isert_connected_handler(cma_id); 851 isert_connected_handler(cma_id);
@@ -834,7 +855,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
834 case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */ 855 case RDMA_CM_EVENT_DEVICE_REMOVAL: /* FALLTHRU */
835 disconnect = true; 856 disconnect = true;
836 case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */ 857 case RDMA_CM_EVENT_TIMEWAIT_EXIT: /* FALLTHRU */
837 isert_disconnected_handler(cma_id, disconnect); 858 ret = isert_disconnected_handler(cma_id, disconnect);
838 break; 859 break;
839 case RDMA_CM_EVENT_CONNECT_ERROR: 860 case RDMA_CM_EVENT_CONNECT_ERROR:
840 default: 861 default:
@@ -842,12 +863,6 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
842 break; 863 break;
843 } 864 }
844 865
845 if (ret != 0) {
846 pr_err("isert_cma_handler failed RDMA_CM_EVENT: 0x%08x %d\n",
847 event->event, ret);
848 dump_stack();
849 }
850
851 return ret; 866 return ret;
852} 867}
853 868
@@ -3190,7 +3205,8 @@ isert_free_np(struct iscsi_np *np)
3190{ 3205{
3191 struct isert_np *isert_np = (struct isert_np *)np->np_context; 3206 struct isert_np *isert_np = (struct isert_np *)np->np_context;
3192 3207
3193 rdma_destroy_id(isert_np->np_cm_id); 3208 if (isert_np->np_cm_id)
3209 rdma_destroy_id(isert_np->np_cm_id);
3194 3210
3195 np->np_context = NULL; 3211 np->np_context = NULL;
3196 kfree(isert_np); 3212 kfree(isert_np);
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 7206547c13ce..dc829682701a 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2092,6 +2092,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
2092 if (!qp_init) 2092 if (!qp_init)
2093 goto out; 2093 goto out;
2094 2094
2095retry:
2095 ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, 2096 ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
2096 ch->rq_size + srp_sq_size, 0); 2097 ch->rq_size + srp_sq_size, 0);
2097 if (IS_ERR(ch->cq)) { 2098 if (IS_ERR(ch->cq)) {
@@ -2115,6 +2116,13 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
2115 ch->qp = ib_create_qp(sdev->pd, qp_init); 2116 ch->qp = ib_create_qp(sdev->pd, qp_init);
2116 if (IS_ERR(ch->qp)) { 2117 if (IS_ERR(ch->qp)) {
2117 ret = PTR_ERR(ch->qp); 2118 ret = PTR_ERR(ch->qp);
2119 if (ret == -ENOMEM) {
2120 srp_sq_size /= 2;
2121 if (srp_sq_size >= MIN_SRPT_SQ_SIZE) {
2122 ib_destroy_cq(ch->cq);
2123 goto retry;
2124 }
2125 }
2118 printk(KERN_ERR "failed to create_qp ret= %d\n", ret); 2126 printk(KERN_ERR "failed to create_qp ret= %d\n", ret);
2119 goto err_destroy_cq; 2127 goto err_destroy_cq;
2120 } 2128 }
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c9ac06cfe6b7..a5115fb7cf33 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2471,7 +2471,8 @@ static void bond_loadbalance_arp_mon(struct work_struct *work)
2471 bond_slave_state_change(bond); 2471 bond_slave_state_change(bond);
2472 if (BOND_MODE(bond) == BOND_MODE_XOR) 2472 if (BOND_MODE(bond) == BOND_MODE_XOR)
2473 bond_update_slave_arr(bond, NULL); 2473 bond_update_slave_arr(bond, NULL);
2474 } else if (do_failover) { 2474 }
2475 if (do_failover) {
2475 block_netpoll_tx(); 2476 block_netpoll_tx();
2476 bond_select_active_slave(bond); 2477 bond_select_active_slave(bond);
2477 unblock_netpoll_tx(); 2478 unblock_netpoll_tx();
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 02492d241e4c..2cfe5012e4e5 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -110,7 +110,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt,
110 long rate; 110 long rate;
111 u64 v64; 111 u64 v64;
112 112
113 /* Use CIA recommended sample points */ 113 /* Use CiA recommended sample points */
114 if (bt->sample_point) { 114 if (bt->sample_point) {
115 sampl_pt = bt->sample_point; 115 sampl_pt = bt->sample_point;
116 } else { 116 } else {
@@ -382,7 +382,7 @@ void can_free_echo_skb(struct net_device *dev, unsigned int idx)
382 BUG_ON(idx >= priv->echo_skb_max); 382 BUG_ON(idx >= priv->echo_skb_max);
383 383
384 if (priv->echo_skb[idx]) { 384 if (priv->echo_skb[idx]) {
385 kfree_skb(priv->echo_skb[idx]); 385 dev_kfree_skb_any(priv->echo_skb[idx]);
386 priv->echo_skb[idx] = NULL; 386 priv->echo_skb[idx] = NULL;
387 } 387 }
388} 388}
diff --git a/drivers/net/can/m_can/Kconfig b/drivers/net/can/m_can/Kconfig
index fca5482c09ac..04f20dd39007 100644
--- a/drivers/net/can/m_can/Kconfig
+++ b/drivers/net/can/m_can/Kconfig
@@ -1,4 +1,5 @@
1config CAN_M_CAN 1config CAN_M_CAN
2 depends on HAS_IOMEM
2 tristate "Bosch M_CAN devices" 3 tristate "Bosch M_CAN devices"
3 ---help--- 4 ---help---
4 Say Y here if you want to support for Bosch M_CAN controller. 5 Say Y here if you want to support for Bosch M_CAN controller.
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 10d571eaed85..d7bc462aafdc 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -105,14 +105,36 @@ enum m_can_mram_cfg {
105 MRAM_CFG_NUM, 105 MRAM_CFG_NUM,
106}; 106};
107 107
108/* Fast Bit Timing & Prescaler Register (FBTP) */
109#define FBTR_FBRP_MASK 0x1f
110#define FBTR_FBRP_SHIFT 16
111#define FBTR_FTSEG1_SHIFT 8
112#define FBTR_FTSEG1_MASK (0xf << FBTR_FTSEG1_SHIFT)
113#define FBTR_FTSEG2_SHIFT 4
114#define FBTR_FTSEG2_MASK (0x7 << FBTR_FTSEG2_SHIFT)
115#define FBTR_FSJW_SHIFT 0
116#define FBTR_FSJW_MASK 0x3
117
108/* Test Register (TEST) */ 118/* Test Register (TEST) */
109#define TEST_LBCK BIT(4) 119#define TEST_LBCK BIT(4)
110 120
111/* CC Control Register(CCCR) */ 121/* CC Control Register(CCCR) */
112#define CCCR_TEST BIT(7) 122#define CCCR_TEST BIT(7)
113#define CCCR_MON BIT(5) 123#define CCCR_CMR_MASK 0x3
114#define CCCR_CCE BIT(1) 124#define CCCR_CMR_SHIFT 10
115#define CCCR_INIT BIT(0) 125#define CCCR_CMR_CANFD 0x1
126#define CCCR_CMR_CANFD_BRS 0x2
127#define CCCR_CMR_CAN 0x3
128#define CCCR_CME_MASK 0x3
129#define CCCR_CME_SHIFT 8
130#define CCCR_CME_CAN 0
131#define CCCR_CME_CANFD 0x1
132#define CCCR_CME_CANFD_BRS 0x2
133#define CCCR_TEST BIT(7)
134#define CCCR_MON BIT(5)
135#define CCCR_CCE BIT(1)
136#define CCCR_INIT BIT(0)
137#define CCCR_CANFD 0x10
116 138
117/* Bit Timing & Prescaler Register (BTP) */ 139/* Bit Timing & Prescaler Register (BTP) */
118#define BTR_BRP_MASK 0x3ff 140#define BTR_BRP_MASK 0x3ff
@@ -204,6 +226,7 @@ enum m_can_mram_cfg {
204 226
205/* Rx Buffer / FIFO Element Size Configuration (RXESC) */ 227/* Rx Buffer / FIFO Element Size Configuration (RXESC) */
206#define M_CAN_RXESC_8BYTES 0x0 228#define M_CAN_RXESC_8BYTES 0x0
229#define M_CAN_RXESC_64BYTES 0x777
207 230
208/* Tx Buffer Configuration(TXBC) */ 231/* Tx Buffer Configuration(TXBC) */
209#define TXBC_NDTB_OFF 16 232#define TXBC_NDTB_OFF 16
@@ -211,6 +234,7 @@ enum m_can_mram_cfg {
211 234
212/* Tx Buffer Element Size Configuration(TXESC) */ 235/* Tx Buffer Element Size Configuration(TXESC) */
213#define TXESC_TBDS_8BYTES 0x0 236#define TXESC_TBDS_8BYTES 0x0
237#define TXESC_TBDS_64BYTES 0x7
214 238
215/* Tx Event FIFO Con.guration (TXEFC) */ 239/* Tx Event FIFO Con.guration (TXEFC) */
216#define TXEFC_EFS_OFF 16 240#define TXEFC_EFS_OFF 16
@@ -219,11 +243,11 @@ enum m_can_mram_cfg {
219/* Message RAM Configuration (in bytes) */ 243/* Message RAM Configuration (in bytes) */
220#define SIDF_ELEMENT_SIZE 4 244#define SIDF_ELEMENT_SIZE 4
221#define XIDF_ELEMENT_SIZE 8 245#define XIDF_ELEMENT_SIZE 8
222#define RXF0_ELEMENT_SIZE 16 246#define RXF0_ELEMENT_SIZE 72
223#define RXF1_ELEMENT_SIZE 16 247#define RXF1_ELEMENT_SIZE 72
224#define RXB_ELEMENT_SIZE 16 248#define RXB_ELEMENT_SIZE 16
225#define TXE_ELEMENT_SIZE 8 249#define TXE_ELEMENT_SIZE 8
226#define TXB_ELEMENT_SIZE 16 250#define TXB_ELEMENT_SIZE 72
227 251
228/* Message RAM Elements */ 252/* Message RAM Elements */
229#define M_CAN_FIFO_ID 0x0 253#define M_CAN_FIFO_ID 0x0
@@ -231,11 +255,17 @@ enum m_can_mram_cfg {
231#define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2)) 255#define M_CAN_FIFO_DATA(n) (0x8 + ((n) << 2))
232 256
233/* Rx Buffer Element */ 257/* Rx Buffer Element */
258/* R0 */
234#define RX_BUF_ESI BIT(31) 259#define RX_BUF_ESI BIT(31)
235#define RX_BUF_XTD BIT(30) 260#define RX_BUF_XTD BIT(30)
236#define RX_BUF_RTR BIT(29) 261#define RX_BUF_RTR BIT(29)
262/* R1 */
263#define RX_BUF_ANMF BIT(31)
264#define RX_BUF_EDL BIT(21)
265#define RX_BUF_BRS BIT(20)
237 266
238/* Tx Buffer Element */ 267/* Tx Buffer Element */
268/* R0 */
239#define TX_BUF_XTD BIT(30) 269#define TX_BUF_XTD BIT(30)
240#define TX_BUF_RTR BIT(29) 270#define TX_BUF_RTR BIT(29)
241 271
@@ -296,6 +326,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv,
296 if (enable) { 326 if (enable) {
297 /* enable m_can configuration */ 327 /* enable m_can configuration */
298 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT); 328 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT);
329 udelay(5);
299 /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */ 330 /* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */
300 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE); 331 m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE);
301 } else { 332 } else {
@@ -326,41 +357,67 @@ static inline void m_can_disable_all_interrupts(const struct m_can_priv *priv)
326 m_can_write(priv, M_CAN_ILE, 0x0); 357 m_can_write(priv, M_CAN_ILE, 0x0);
327} 358}
328 359
329static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf, 360static void m_can_read_fifo(struct net_device *dev, u32 rxfs)
330 u32 rxfs)
331{ 361{
362 struct net_device_stats *stats = &dev->stats;
332 struct m_can_priv *priv = netdev_priv(dev); 363 struct m_can_priv *priv = netdev_priv(dev);
333 u32 id, fgi; 364 struct canfd_frame *cf;
365 struct sk_buff *skb;
366 u32 id, fgi, dlc;
367 int i;
334 368
335 /* calculate the fifo get index for where to read data */ 369 /* calculate the fifo get index for where to read data */
336 fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF; 370 fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF;
371 dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC);
372 if (dlc & RX_BUF_EDL)
373 skb = alloc_canfd_skb(dev, &cf);
374 else
375 skb = alloc_can_skb(dev, (struct can_frame **)&cf);
376 if (!skb) {
377 stats->rx_dropped++;
378 return;
379 }
380
381 if (dlc & RX_BUF_EDL)
382 cf->len = can_dlc2len((dlc >> 16) & 0x0F);
383 else
384 cf->len = get_can_dlc((dlc >> 16) & 0x0F);
385
337 id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID); 386 id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID);
338 if (id & RX_BUF_XTD) 387 if (id & RX_BUF_XTD)
339 cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG; 388 cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG;
340 else 389 else
341 cf->can_id = (id >> 18) & CAN_SFF_MASK; 390 cf->can_id = (id >> 18) & CAN_SFF_MASK;
342 391
343 if (id & RX_BUF_RTR) { 392 if (id & RX_BUF_ESI) {
393 cf->flags |= CANFD_ESI;
394 netdev_dbg(dev, "ESI Error\n");
395 }
396
397 if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) {
344 cf->can_id |= CAN_RTR_FLAG; 398 cf->can_id |= CAN_RTR_FLAG;
345 } else { 399 } else {
346 id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC); 400 if (dlc & RX_BUF_BRS)
347 cf->can_dlc = get_can_dlc((id >> 16) & 0x0F); 401 cf->flags |= CANFD_BRS;
348 *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi, 402
349 M_CAN_FIFO_DATA(0)); 403 for (i = 0; i < cf->len; i += 4)
350 *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi, 404 *(u32 *)(cf->data + i) =
351 M_CAN_FIFO_DATA(1)); 405 m_can_fifo_read(priv, fgi,
406 M_CAN_FIFO_DATA(i / 4));
352 } 407 }
353 408
354 /* acknowledge rx fifo 0 */ 409 /* acknowledge rx fifo 0 */
355 m_can_write(priv, M_CAN_RXF0A, fgi); 410 m_can_write(priv, M_CAN_RXF0A, fgi);
411
412 stats->rx_packets++;
413 stats->rx_bytes += cf->len;
414
415 netif_receive_skb(skb);
356} 416}
357 417
358static int m_can_do_rx_poll(struct net_device *dev, int quota) 418static int m_can_do_rx_poll(struct net_device *dev, int quota)
359{ 419{
360 struct m_can_priv *priv = netdev_priv(dev); 420 struct m_can_priv *priv = netdev_priv(dev);
361 struct net_device_stats *stats = &dev->stats;
362 struct sk_buff *skb;
363 struct can_frame *frame;
364 u32 pkts = 0; 421 u32 pkts = 0;
365 u32 rxfs; 422 u32 rxfs;
366 423
@@ -374,18 +431,7 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota)
374 if (rxfs & RXFS_RFL) 431 if (rxfs & RXFS_RFL)
375 netdev_warn(dev, "Rx FIFO 0 Message Lost\n"); 432 netdev_warn(dev, "Rx FIFO 0 Message Lost\n");
376 433
377 skb = alloc_can_skb(dev, &frame); 434 m_can_read_fifo(dev, rxfs);
378 if (!skb) {
379 stats->rx_dropped++;
380 return pkts;
381 }
382
383 m_can_read_fifo(dev, frame, rxfs);
384
385 stats->rx_packets++;
386 stats->rx_bytes += frame->can_dlc;
387
388 netif_receive_skb(skb);
389 435
390 quota--; 436 quota--;
391 pkts++; 437 pkts++;
@@ -481,11 +527,23 @@ static int m_can_handle_lec_err(struct net_device *dev,
481 return 1; 527 return 1;
482} 528}
483 529
530static int __m_can_get_berr_counter(const struct net_device *dev,
531 struct can_berr_counter *bec)
532{
533 struct m_can_priv *priv = netdev_priv(dev);
534 unsigned int ecr;
535
536 ecr = m_can_read(priv, M_CAN_ECR);
537 bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT;
538 bec->txerr = ecr & ECR_TEC_MASK;
539
540 return 0;
541}
542
484static int m_can_get_berr_counter(const struct net_device *dev, 543static int m_can_get_berr_counter(const struct net_device *dev,
485 struct can_berr_counter *bec) 544 struct can_berr_counter *bec)
486{ 545{
487 struct m_can_priv *priv = netdev_priv(dev); 546 struct m_can_priv *priv = netdev_priv(dev);
488 unsigned int ecr;
489 int err; 547 int err;
490 548
491 err = clk_prepare_enable(priv->hclk); 549 err = clk_prepare_enable(priv->hclk);
@@ -498,9 +556,7 @@ static int m_can_get_berr_counter(const struct net_device *dev,
498 return err; 556 return err;
499 } 557 }
500 558
501 ecr = m_can_read(priv, M_CAN_ECR); 559 __m_can_get_berr_counter(dev, bec);
502 bec->rxerr = (ecr & ECR_REC_MASK) >> ECR_REC_SHIFT;
503 bec->txerr = ecr & ECR_TEC_MASK;
504 560
505 clk_disable_unprepare(priv->cclk); 561 clk_disable_unprepare(priv->cclk);
506 clk_disable_unprepare(priv->hclk); 562 clk_disable_unprepare(priv->hclk);
@@ -544,7 +600,7 @@ static int m_can_handle_state_change(struct net_device *dev,
544 if (unlikely(!skb)) 600 if (unlikely(!skb))
545 return 0; 601 return 0;
546 602
547 m_can_get_berr_counter(dev, &bec); 603 __m_can_get_berr_counter(dev, &bec);
548 604
549 switch (new_state) { 605 switch (new_state) {
550 case CAN_STATE_ERROR_ACTIVE: 606 case CAN_STATE_ERROR_ACTIVE:
@@ -596,14 +652,14 @@ static int m_can_handle_state_errors(struct net_device *dev, u32 psr)
596 652
597 if ((psr & PSR_EP) && 653 if ((psr & PSR_EP) &&
598 (priv->can.state != CAN_STATE_ERROR_PASSIVE)) { 654 (priv->can.state != CAN_STATE_ERROR_PASSIVE)) {
599 netdev_dbg(dev, "entered error warning state\n"); 655 netdev_dbg(dev, "entered error passive state\n");
600 work_done += m_can_handle_state_change(dev, 656 work_done += m_can_handle_state_change(dev,
601 CAN_STATE_ERROR_PASSIVE); 657 CAN_STATE_ERROR_PASSIVE);
602 } 658 }
603 659
604 if ((psr & PSR_BO) && 660 if ((psr & PSR_BO) &&
605 (priv->can.state != CAN_STATE_BUS_OFF)) { 661 (priv->can.state != CAN_STATE_BUS_OFF)) {
606 netdev_dbg(dev, "entered error warning state\n"); 662 netdev_dbg(dev, "entered error bus off state\n");
607 work_done += m_can_handle_state_change(dev, 663 work_done += m_can_handle_state_change(dev,
608 CAN_STATE_BUS_OFF); 664 CAN_STATE_BUS_OFF);
609 } 665 }
@@ -615,7 +671,7 @@ static void m_can_handle_other_err(struct net_device *dev, u32 irqstatus)
615{ 671{
616 if (irqstatus & IR_WDI) 672 if (irqstatus & IR_WDI)
617 netdev_err(dev, "Message RAM Watchdog event due to missing READY\n"); 673 netdev_err(dev, "Message RAM Watchdog event due to missing READY\n");
618 if (irqstatus & IR_BEU) 674 if (irqstatus & IR_ELO)
619 netdev_err(dev, "Error Logging Overflow\n"); 675 netdev_err(dev, "Error Logging Overflow\n");
620 if (irqstatus & IR_BEU) 676 if (irqstatus & IR_BEU)
621 netdev_err(dev, "Bit Error Uncorrected\n"); 677 netdev_err(dev, "Bit Error Uncorrected\n");
@@ -733,10 +789,23 @@ static const struct can_bittiming_const m_can_bittiming_const = {
733 .brp_inc = 1, 789 .brp_inc = 1,
734}; 790};
735 791
792static const struct can_bittiming_const m_can_data_bittiming_const = {
793 .name = KBUILD_MODNAME,
794 .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */
795 .tseg1_max = 16,
796 .tseg2_min = 1, /* Time segment 2 = phase_seg2 */
797 .tseg2_max = 8,
798 .sjw_max = 4,
799 .brp_min = 1,
800 .brp_max = 32,
801 .brp_inc = 1,
802};
803
736static int m_can_set_bittiming(struct net_device *dev) 804static int m_can_set_bittiming(struct net_device *dev)
737{ 805{
738 struct m_can_priv *priv = netdev_priv(dev); 806 struct m_can_priv *priv = netdev_priv(dev);
739 const struct can_bittiming *bt = &priv->can.bittiming; 807 const struct can_bittiming *bt = &priv->can.bittiming;
808 const struct can_bittiming *dbt = &priv->can.data_bittiming;
740 u16 brp, sjw, tseg1, tseg2; 809 u16 brp, sjw, tseg1, tseg2;
741 u32 reg_btp; 810 u32 reg_btp;
742 811
@@ -747,7 +816,17 @@ static int m_can_set_bittiming(struct net_device *dev)
747 reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) | 816 reg_btp = (brp << BTR_BRP_SHIFT) | (sjw << BTR_SJW_SHIFT) |
748 (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT); 817 (tseg1 << BTR_TSEG1_SHIFT) | (tseg2 << BTR_TSEG2_SHIFT);
749 m_can_write(priv, M_CAN_BTP, reg_btp); 818 m_can_write(priv, M_CAN_BTP, reg_btp);
750 netdev_dbg(dev, "setting BTP 0x%x\n", reg_btp); 819
820 if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
821 brp = dbt->brp - 1;
822 sjw = dbt->sjw - 1;
823 tseg1 = dbt->prop_seg + dbt->phase_seg1 - 1;
824 tseg2 = dbt->phase_seg2 - 1;
825 reg_btp = (brp << FBTR_FBRP_SHIFT) | (sjw << FBTR_FSJW_SHIFT) |
826 (tseg1 << FBTR_FTSEG1_SHIFT) |
827 (tseg2 << FBTR_FTSEG2_SHIFT);
828 m_can_write(priv, M_CAN_FBTP, reg_btp);
829 }
751 830
752 return 0; 831 return 0;
753} 832}
@@ -767,8 +846,8 @@ static void m_can_chip_config(struct net_device *dev)
767 846
768 m_can_config_endisable(priv, true); 847 m_can_config_endisable(priv, true);
769 848
770 /* RX Buffer/FIFO Element Size 8 bytes data field */ 849 /* RX Buffer/FIFO Element Size 64 bytes data field */
771 m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_8BYTES); 850 m_can_write(priv, M_CAN_RXESC, M_CAN_RXESC_64BYTES);
772 851
773 /* Accept Non-matching Frames Into FIFO 0 */ 852 /* Accept Non-matching Frames Into FIFO 0 */
774 m_can_write(priv, M_CAN_GFC, 0x0); 853 m_can_write(priv, M_CAN_GFC, 0x0);
@@ -777,8 +856,8 @@ static void m_can_chip_config(struct net_device *dev)
777 m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) | 856 m_can_write(priv, M_CAN_TXBC, (1 << TXBC_NDTB_OFF) |
778 priv->mcfg[MRAM_TXB].off); 857 priv->mcfg[MRAM_TXB].off);
779 858
780 /* only support 8 bytes firstly */ 859 /* support 64 bytes payload */
781 m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_8BYTES); 860 m_can_write(priv, M_CAN_TXESC, TXESC_TBDS_64BYTES);
782 861
783 m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) | 862 m_can_write(priv, M_CAN_TXEFC, (1 << TXEFC_EFS_OFF) |
784 priv->mcfg[MRAM_TXE].off); 863 priv->mcfg[MRAM_TXE].off);
@@ -793,7 +872,8 @@ static void m_can_chip_config(struct net_device *dev)
793 RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off); 872 RXFC_FWM_1 | priv->mcfg[MRAM_RXF1].off);
794 873
795 cccr = m_can_read(priv, M_CAN_CCCR); 874 cccr = m_can_read(priv, M_CAN_CCCR);
796 cccr &= ~(CCCR_TEST | CCCR_MON); 875 cccr &= ~(CCCR_TEST | CCCR_MON | (CCCR_CMR_MASK << CCCR_CMR_SHIFT) |
876 (CCCR_CME_MASK << CCCR_CME_SHIFT));
797 test = m_can_read(priv, M_CAN_TEST); 877 test = m_can_read(priv, M_CAN_TEST);
798 test &= ~TEST_LBCK; 878 test &= ~TEST_LBCK;
799 879
@@ -805,6 +885,9 @@ static void m_can_chip_config(struct net_device *dev)
805 test |= TEST_LBCK; 885 test |= TEST_LBCK;
806 } 886 }
807 887
888 if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
889 cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT;
890
808 m_can_write(priv, M_CAN_CCCR, cccr); 891 m_can_write(priv, M_CAN_CCCR, cccr);
809 m_can_write(priv, M_CAN_TEST, test); 892 m_can_write(priv, M_CAN_TEST, test);
810 893
@@ -869,11 +952,13 @@ static struct net_device *alloc_m_can_dev(void)
869 952
870 priv->dev = dev; 953 priv->dev = dev;
871 priv->can.bittiming_const = &m_can_bittiming_const; 954 priv->can.bittiming_const = &m_can_bittiming_const;
955 priv->can.data_bittiming_const = &m_can_data_bittiming_const;
872 priv->can.do_set_mode = m_can_set_mode; 956 priv->can.do_set_mode = m_can_set_mode;
873 priv->can.do_get_berr_counter = m_can_get_berr_counter; 957 priv->can.do_get_berr_counter = m_can_get_berr_counter;
874 priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK | 958 priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
875 CAN_CTRLMODE_LISTENONLY | 959 CAN_CTRLMODE_LISTENONLY |
876 CAN_CTRLMODE_BERR_REPORTING; 960 CAN_CTRLMODE_BERR_REPORTING |
961 CAN_CTRLMODE_FD;
877 962
878 return dev; 963 return dev;
879} 964}
@@ -956,8 +1041,9 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
956 struct net_device *dev) 1041 struct net_device *dev)
957{ 1042{
958 struct m_can_priv *priv = netdev_priv(dev); 1043 struct m_can_priv *priv = netdev_priv(dev);
959 struct can_frame *cf = (struct can_frame *)skb->data; 1044 struct canfd_frame *cf = (struct canfd_frame *)skb->data;
960 u32 id; 1045 u32 id, cccr;
1046 int i;
961 1047
962 if (can_dropped_invalid_skb(dev, skb)) 1048 if (can_dropped_invalid_skb(dev, skb))
963 return NETDEV_TX_OK; 1049 return NETDEV_TX_OK;
@@ -976,11 +1062,28 @@ static netdev_tx_t m_can_start_xmit(struct sk_buff *skb,
976 1062
977 /* message ram configuration */ 1063 /* message ram configuration */
978 m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id); 1064 m_can_fifo_write(priv, 0, M_CAN_FIFO_ID, id);
979 m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, cf->can_dlc << 16); 1065 m_can_fifo_write(priv, 0, M_CAN_FIFO_DLC, can_len2dlc(cf->len) << 16);
980 m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(0), *(u32 *)(cf->data + 0)); 1066
981 m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(1), *(u32 *)(cf->data + 4)); 1067 for (i = 0; i < cf->len; i += 4)
1068 m_can_fifo_write(priv, 0, M_CAN_FIFO_DATA(i / 4),
1069 *(u32 *)(cf->data + i));
1070
982 can_put_echo_skb(skb, dev, 0); 1071 can_put_echo_skb(skb, dev, 0);
983 1072
1073 if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
1074 cccr = m_can_read(priv, M_CAN_CCCR);
1075 cccr &= ~(CCCR_CMR_MASK << CCCR_CMR_SHIFT);
1076 if (can_is_canfd_skb(skb)) {
1077 if (cf->flags & CANFD_BRS)
1078 cccr |= CCCR_CMR_CANFD_BRS << CCCR_CMR_SHIFT;
1079 else
1080 cccr |= CCCR_CMR_CANFD << CCCR_CMR_SHIFT;
1081 } else {
1082 cccr |= CCCR_CMR_CAN << CCCR_CMR_SHIFT;
1083 }
1084 m_can_write(priv, M_CAN_CCCR, cccr);
1085 }
1086
984 /* enable first TX buffer to start transfer */ 1087 /* enable first TX buffer to start transfer */
985 m_can_write(priv, M_CAN_TXBTIE, 0x1); 1088 m_can_write(priv, M_CAN_TXBTIE, 0x1);
986 m_can_write(priv, M_CAN_TXBAR, 0x1); 1089 m_can_write(priv, M_CAN_TXBAR, 0x1);
@@ -992,6 +1095,7 @@ static const struct net_device_ops m_can_netdev_ops = {
992 .ndo_open = m_can_open, 1095 .ndo_open = m_can_open,
993 .ndo_stop = m_can_close, 1096 .ndo_stop = m_can_close,
994 .ndo_start_xmit = m_can_start_xmit, 1097 .ndo_start_xmit = m_can_start_xmit,
1098 .ndo_change_mtu = can_change_mtu,
995}; 1099};
996 1100
997static int register_m_can_dev(struct net_device *dev) 1101static int register_m_can_dev(struct net_device *dev)
@@ -1009,7 +1113,7 @@ static int m_can_of_parse_mram(struct platform_device *pdev,
1009 struct resource *res; 1113 struct resource *res;
1010 void __iomem *addr; 1114 void __iomem *addr;
1011 u32 out_val[MRAM_CFG_LEN]; 1115 u32 out_val[MRAM_CFG_LEN];
1012 int ret; 1116 int i, start, end, ret;
1013 1117
1014 /* message ram could be shared */ 1118 /* message ram could be shared */
1015 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); 1119 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram");
@@ -1060,6 +1164,15 @@ static int m_can_of_parse_mram(struct platform_device *pdev,
1060 priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, 1164 priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num,
1061 priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); 1165 priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num);
1062 1166
1167 /* initialize the entire Message RAM in use to avoid possible
1168 * ECC/parity checksum errors when reading an uninitialized buffer
1169 */
1170 start = priv->mcfg[MRAM_SIDF].off;
1171 end = priv->mcfg[MRAM_TXB].off +
1172 priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE;
1173 for (i = start; i < end; i += 4)
1174 writel(0x0, priv->mram_base + i);
1175
1063 return 0; 1176 return 0;
1064} 1177}
1065 1178
diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c
index 1abe133d1594..9718248e55f1 100644
--- a/drivers/net/can/rcar_can.c
+++ b/drivers/net/can/rcar_can.c
@@ -628,6 +628,7 @@ static const struct net_device_ops rcar_can_netdev_ops = {
628 .ndo_open = rcar_can_open, 628 .ndo_open = rcar_can_open,
629 .ndo_stop = rcar_can_close, 629 .ndo_stop = rcar_can_close,
630 .ndo_start_xmit = rcar_can_start_xmit, 630 .ndo_start_xmit = rcar_can_start_xmit,
631 .ndo_change_mtu = can_change_mtu,
631}; 632};
632 633
633static void rcar_can_rx_pkt(struct rcar_can_priv *priv) 634static void rcar_can_rx_pkt(struct rcar_can_priv *priv)
diff --git a/drivers/net/can/sja1000/kvaser_pci.c b/drivers/net/can/sja1000/kvaser_pci.c
index 8ff3424d5147..15c00faeec61 100644
--- a/drivers/net/can/sja1000/kvaser_pci.c
+++ b/drivers/net/can/sja1000/kvaser_pci.c
@@ -214,7 +214,7 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
214 struct net_device *dev; 214 struct net_device *dev;
215 struct sja1000_priv *priv; 215 struct sja1000_priv *priv;
216 struct kvaser_pci *board; 216 struct kvaser_pci *board;
217 int err, init_step; 217 int err;
218 218
219 dev = alloc_sja1000dev(sizeof(struct kvaser_pci)); 219 dev = alloc_sja1000dev(sizeof(struct kvaser_pci));
220 if (dev == NULL) 220 if (dev == NULL)
@@ -235,7 +235,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
235 if (channel == 0) { 235 if (channel == 0) {
236 board->xilinx_ver = 236 board->xilinx_ver =
237 ioread8(board->res_addr + XILINX_VERINT) >> 4; 237 ioread8(board->res_addr + XILINX_VERINT) >> 4;
238 init_step = 2;
239 238
240 /* Assert PTADR# - we're in passive mode so the other bits are 239 /* Assert PTADR# - we're in passive mode so the other bits are
241 not important */ 240 not important */
@@ -264,8 +263,6 @@ static int kvaser_pci_add_chan(struct pci_dev *pdev, int channel,
264 priv->irq_flags = IRQF_SHARED; 263 priv->irq_flags = IRQF_SHARED;
265 dev->irq = pdev->irq; 264 dev->irq = pdev->irq;
266 265
267 init_step = 4;
268
269 dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", 266 dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n",
270 priv->reg_base, board->conf_addr, dev->irq); 267 priv->reg_base, board->conf_addr, dev->irq);
271 268
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 00f2534dde73..29d3f0938eb8 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -434,10 +434,9 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
434 if (urb->actual_length > CPC_HEADER_SIZE) { 434 if (urb->actual_length > CPC_HEADER_SIZE) {
435 struct ems_cpc_msg *msg; 435 struct ems_cpc_msg *msg;
436 u8 *ibuf = urb->transfer_buffer; 436 u8 *ibuf = urb->transfer_buffer;
437 u8 msg_count, again, start; 437 u8 msg_count, start;
438 438
439 msg_count = ibuf[0] & ~0x80; 439 msg_count = ibuf[0] & ~0x80;
440 again = ibuf[0] & 0x80;
441 440
442 start = CPC_HEADER_SIZE; 441 start = CPC_HEADER_SIZE;
443 442
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index b7c9e8b11460..c063a54ab8dd 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -464,7 +464,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
464{ 464{
465 struct esd_tx_urb_context *context = urb->context; 465 struct esd_tx_urb_context *context = urb->context;
466 struct esd_usb2_net_priv *priv; 466 struct esd_usb2_net_priv *priv;
467 struct esd_usb2 *dev;
468 struct net_device *netdev; 467 struct net_device *netdev;
469 size_t size = sizeof(struct esd_usb2_msg); 468 size_t size = sizeof(struct esd_usb2_msg);
470 469
@@ -472,7 +471,6 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
472 471
473 priv = context->priv; 472 priv = context->priv;
474 netdev = priv->netdev; 473 netdev = priv->netdev;
475 dev = priv->usb2;
476 474
477 /* free up our allocated buffer */ 475 /* free up our allocated buffer */
478 usb_free_coherent(urb->dev, size, 476 usb_free_coherent(urb->dev, size,
@@ -1143,6 +1141,7 @@ static void esd_usb2_disconnect(struct usb_interface *intf)
1143 } 1141 }
1144 } 1142 }
1145 unlink_all_urbs(dev); 1143 unlink_all_urbs(dev);
1144 kfree(dev);
1146 } 1145 }
1147} 1146}
1148 1147
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index 04b0f84612f0..009acc8641fc 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -718,6 +718,7 @@ static const struct net_device_ops gs_usb_netdev_ops = {
718 .ndo_open = gs_can_open, 718 .ndo_open = gs_can_open,
719 .ndo_stop = gs_can_close, 719 .ndo_stop = gs_can_close,
720 .ndo_start_xmit = gs_can_start_xmit, 720 .ndo_start_xmit = gs_can_start_xmit,
721 .ndo_change_mtu = can_change_mtu,
721}; 722};
722 723
723static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf) 724static struct gs_can *gs_make_candev(unsigned int channel, struct usb_interface *intf)
diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c
index 5e8b5609c067..8a998e3884ce 100644
--- a/drivers/net/can/xilinx_can.c
+++ b/drivers/net/can/xilinx_can.c
@@ -300,7 +300,8 @@ static int xcan_set_bittiming(struct net_device *ndev)
300static int xcan_chip_start(struct net_device *ndev) 300static int xcan_chip_start(struct net_device *ndev)
301{ 301{
302 struct xcan_priv *priv = netdev_priv(ndev); 302 struct xcan_priv *priv = netdev_priv(ndev);
303 u32 err, reg_msr, reg_sr_mask; 303 u32 reg_msr, reg_sr_mask;
304 int err;
304 unsigned long timeout; 305 unsigned long timeout;
305 306
306 /* Check if it is in reset mode */ 307 /* Check if it is in reset mode */
@@ -961,6 +962,7 @@ static const struct net_device_ops xcan_netdev_ops = {
961 .ndo_open = xcan_open, 962 .ndo_open = xcan_open,
962 .ndo_stop = xcan_close, 963 .ndo_stop = xcan_close,
963 .ndo_start_xmit = xcan_start_xmit, 964 .ndo_start_xmit = xcan_start_xmit,
965 .ndo_change_mtu = can_change_mtu,
964}; 966};
965 967
966/** 968/**
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
index cca604994003..4fe33606f372 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
@@ -1082,7 +1082,7 @@ static int cxgb4_cee_peer_getpg(struct net_device *dev, struct cee_pg *pg)
1082 pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); 1082 pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid);
1083 1083
1084 for (i = 0; i < CXGB4_MAX_PRIORITY; i++) 1084 for (i = 0; i < CXGB4_MAX_PRIORITY; i++)
1085 pg->prio_pg[i] = (pgid >> (i * 4)) & 0xF; 1085 pg->prio_pg[7 - i] = (pgid >> (i * 4)) & 0xF;
1086 1086
1087 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id); 1087 INIT_PORT_DCB_READ_PEER_CMD(pcmd, pi->port_id);
1088 pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE; 1088 pcmd.u.dcb.pgrate.type = FW_PORT_DCB_TYPE_PGRATE;
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 9a18e7930b31..3e8475cae4f9 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -4421,6 +4421,11 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family,
4421 "Disabled VxLAN offloads for UDP port %d\n", 4421 "Disabled VxLAN offloads for UDP port %d\n",
4422 be16_to_cpu(port)); 4422 be16_to_cpu(port));
4423} 4423}
4424
4425static bool be_gso_check(struct sk_buff *skb, struct net_device *dev)
4426{
4427 return vxlan_gso_check(skb);
4428}
4424#endif 4429#endif
4425 4430
4426static const struct net_device_ops be_netdev_ops = { 4431static const struct net_device_ops be_netdev_ops = {
@@ -4450,6 +4455,7 @@ static const struct net_device_ops be_netdev_ops = {
4450#ifdef CONFIG_BE2NET_VXLAN 4455#ifdef CONFIG_BE2NET_VXLAN
4451 .ndo_add_vxlan_port = be_add_vxlan_port, 4456 .ndo_add_vxlan_port = be_add_vxlan_port,
4452 .ndo_del_vxlan_port = be_del_vxlan_port, 4457 .ndo_del_vxlan_port = be_del_vxlan_port,
4458 .ndo_gso_check = be_gso_check,
4453#endif 4459#endif
4454}; 4460};
4455 4461
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 02266e3de514..4d69e382b4e5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1693,7 +1693,7 @@ int mlx4_en_start_port(struct net_device *dev)
1693 mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); 1693 mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap);
1694 1694
1695#ifdef CONFIG_MLX4_EN_VXLAN 1695#ifdef CONFIG_MLX4_EN_VXLAN
1696 if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_VXLAN_OFFLOADS) 1696 if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)
1697 vxlan_get_rx_port(dev); 1697 vxlan_get_rx_port(dev);
1698#endif 1698#endif
1699 priv->port_up = true; 1699 priv->port_up = true;
@@ -2355,6 +2355,11 @@ static void mlx4_en_del_vxlan_port(struct net_device *dev,
2355 2355
2356 queue_work(priv->mdev->workqueue, &priv->vxlan_del_task); 2356 queue_work(priv->mdev->workqueue, &priv->vxlan_del_task);
2357} 2357}
2358
2359static bool mlx4_en_gso_check(struct sk_buff *skb, struct net_device *dev)
2360{
2361 return vxlan_gso_check(skb);
2362}
2358#endif 2363#endif
2359 2364
2360static const struct net_device_ops mlx4_netdev_ops = { 2365static const struct net_device_ops mlx4_netdev_ops = {
@@ -2386,6 +2391,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
2386#ifdef CONFIG_MLX4_EN_VXLAN 2391#ifdef CONFIG_MLX4_EN_VXLAN
2387 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port, 2392 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port,
2388 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port, 2393 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port,
2394 .ndo_gso_check = mlx4_en_gso_check,
2389#endif 2395#endif
2390}; 2396};
2391 2397
@@ -2416,6 +2422,11 @@ static const struct net_device_ops mlx4_netdev_ops_master = {
2416 .ndo_rx_flow_steer = mlx4_en_filter_rfs, 2422 .ndo_rx_flow_steer = mlx4_en_filter_rfs,
2417#endif 2423#endif
2418 .ndo_get_phys_port_id = mlx4_en_get_phys_port_id, 2424 .ndo_get_phys_port_id = mlx4_en_get_phys_port_id,
2425#ifdef CONFIG_MLX4_EN_VXLAN
2426 .ndo_add_vxlan_port = mlx4_en_add_vxlan_port,
2427 .ndo_del_vxlan_port = mlx4_en_del_vxlan_port,
2428 .ndo_gso_check = mlx4_en_gso_check,
2429#endif
2419}; 2430};
2420 2431
2421int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, 2432int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index f5e29f7bdae3..a913b3ad2f89 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -503,6 +503,11 @@ static void qlcnic_del_vxlan_port(struct net_device *netdev,
503 503
504 adapter->flags |= QLCNIC_DEL_VXLAN_PORT; 504 adapter->flags |= QLCNIC_DEL_VXLAN_PORT;
505} 505}
506
507static bool qlcnic_gso_check(struct sk_buff *skb, struct net_device *dev)
508{
509 return vxlan_gso_check(skb);
510}
506#endif 511#endif
507 512
508static const struct net_device_ops qlcnic_netdev_ops = { 513static const struct net_device_ops qlcnic_netdev_ops = {
@@ -526,6 +531,7 @@ static const struct net_device_ops qlcnic_netdev_ops = {
526#ifdef CONFIG_QLCNIC_VXLAN 531#ifdef CONFIG_QLCNIC_VXLAN
527 .ndo_add_vxlan_port = qlcnic_add_vxlan_port, 532 .ndo_add_vxlan_port = qlcnic_add_vxlan_port,
528 .ndo_del_vxlan_port = qlcnic_del_vxlan_port, 533 .ndo_del_vxlan_port = qlcnic_del_vxlan_port,
534 .ndo_gso_check = qlcnic_gso_check,
529#endif 535#endif
530#ifdef CONFIG_NET_POLL_CONTROLLER 536#ifdef CONFIG_NET_POLL_CONTROLLER
531 .ndo_poll_controller = qlcnic_poll_controller, 537 .ndo_poll_controller = qlcnic_poll_controller,
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index d8794488f80a..c560f9aeb55d 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -129,9 +129,9 @@ do { \
129#define CPSW_VLAN_AWARE BIT(1) 129#define CPSW_VLAN_AWARE BIT(1)
130#define CPSW_ALE_VLAN_AWARE 1 130#define CPSW_ALE_VLAN_AWARE 1
131 131
132#define CPSW_FIFO_NORMAL_MODE (0 << 15) 132#define CPSW_FIFO_NORMAL_MODE (0 << 16)
133#define CPSW_FIFO_DUAL_MAC_MODE (1 << 15) 133#define CPSW_FIFO_DUAL_MAC_MODE (1 << 16)
134#define CPSW_FIFO_RATE_LIMIT_MODE (2 << 15) 134#define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16)
135 135
136#define CPSW_INTPACEEN (0x3f << 16) 136#define CPSW_INTPACEEN (0x3f << 16)
137#define CPSW_INTPRESCALE_MASK (0x7FF << 0) 137#define CPSW_INTPRESCALE_MASK (0x7FF << 0)
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c
index 9ce854f43917..6cbc56ad9ff4 100644
--- a/drivers/net/ieee802154/fakehard.c
+++ b/drivers/net/ieee802154/fakehard.c
@@ -377,17 +377,20 @@ static int ieee802154fake_probe(struct platform_device *pdev)
377 377
378 err = wpan_phy_register(phy); 378 err = wpan_phy_register(phy);
379 if (err) 379 if (err)
380 goto out; 380 goto err_phy_reg;
381 381
382 err = register_netdev(dev); 382 err = register_netdev(dev);
383 if (err < 0) 383 if (err)
384 goto out; 384 goto err_netdev_reg;
385 385
386 dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n"); 386 dev_info(&pdev->dev, "Added ieee802154 HardMAC hardware\n");
387 return 0; 387 return 0;
388 388
389out: 389err_netdev_reg:
390 unregister_netdev(dev); 390 wpan_phy_unregister(phy);
391err_phy_reg:
392 free_netdev(dev);
393 wpan_phy_free(phy);
391 return err; 394 return err;
392} 395}
393 396
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c
index 1aff970be33e..1dc628ffce2b 100644
--- a/drivers/net/ppp/pptp.c
+++ b/drivers/net/ppp/pptp.c
@@ -506,7 +506,9 @@ static int pptp_getname(struct socket *sock, struct sockaddr *uaddr,
506 int len = sizeof(struct sockaddr_pppox); 506 int len = sizeof(struct sockaddr_pppox);
507 struct sockaddr_pppox sp; 507 struct sockaddr_pppox sp;
508 508
509 sp.sa_family = AF_PPPOX; 509 memset(&sp.sa_addr, 0, sizeof(sp.sa_addr));
510
511 sp.sa_family = AF_PPPOX;
510 sp.sa_protocol = PX_PROTO_PPTP; 512 sp.sa_protocol = PX_PROTO_PPTP;
511 sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr; 513 sp.sa_addr.pptp = pppox_sk(sock->sk)->proto.pptp.src_addr;
512 514
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 22756db53dca..b8a82b86f909 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -780,6 +780,7 @@ static const struct usb_device_id products[] = {
780 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ 780 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
781 {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ 781 {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */
782 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ 782 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
783 {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */
783 784
784 /* 4. Gobi 1000 devices */ 785 /* 4. Gobi 1000 devices */
785 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ 786 {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index ec2a8b41ed41..b0bc8ead47de 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1673,6 +1673,40 @@ static const struct attribute_group virtio_net_mrg_rx_group = {
1673}; 1673};
1674#endif 1674#endif
1675 1675
1676static bool virtnet_fail_on_feature(struct virtio_device *vdev,
1677 unsigned int fbit,
1678 const char *fname, const char *dname)
1679{
1680 if (!virtio_has_feature(vdev, fbit))
1681 return false;
1682
1683 dev_err(&vdev->dev, "device advertises feature %s but not %s",
1684 fname, dname);
1685
1686 return true;
1687}
1688
1689#define VIRTNET_FAIL_ON(vdev, fbit, dbit) \
1690 virtnet_fail_on_feature(vdev, fbit, #fbit, dbit)
1691
1692static bool virtnet_validate_features(struct virtio_device *vdev)
1693{
1694 if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) &&
1695 (VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_RX,
1696 "VIRTIO_NET_F_CTRL_VQ") ||
1697 VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_VLAN,
1698 "VIRTIO_NET_F_CTRL_VQ") ||
1699 VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_GUEST_ANNOUNCE,
1700 "VIRTIO_NET_F_CTRL_VQ") ||
1701 VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_MQ, "VIRTIO_NET_F_CTRL_VQ") ||
1702 VIRTNET_FAIL_ON(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR,
1703 "VIRTIO_NET_F_CTRL_VQ"))) {
1704 return false;
1705 }
1706
1707 return true;
1708}
1709
1676static int virtnet_probe(struct virtio_device *vdev) 1710static int virtnet_probe(struct virtio_device *vdev)
1677{ 1711{
1678 int i, err; 1712 int i, err;
@@ -1680,6 +1714,9 @@ static int virtnet_probe(struct virtio_device *vdev)
1680 struct virtnet_info *vi; 1714 struct virtnet_info *vi;
1681 u16 max_queue_pairs; 1715 u16 max_queue_pairs;
1682 1716
1717 if (!virtnet_validate_features(vdev))
1718 return -EINVAL;
1719
1683 /* Find if host supports multiqueue virtio_net device */ 1720 /* Find if host supports multiqueue virtio_net device */
1684 err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ, 1721 err = virtio_cread_feature(vdev, VIRTIO_NET_F_MQ,
1685 struct virtio_net_config, 1722 struct virtio_net_config,
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index fa9dc45b75a6..e1e335c339e3 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -67,12 +67,6 @@
67 67
68#define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */ 68#define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */
69 69
70/* VXLAN protocol header */
71struct vxlanhdr {
72 __be32 vx_flags;
73 __be32 vx_vni;
74};
75
76/* UDP port for VXLAN traffic. 70/* UDP port for VXLAN traffic.
77 * The IANA assigned port is 4789, but the Linux default is 8472 71 * The IANA assigned port is 4789, but the Linux default is 8472
78 * for compatibility with early adopters. 72 * for compatibility with early adopters.
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 697c4ae90af0..1e8ea5e4d4ca 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -664,6 +664,19 @@ static void ar9003_hw_override_ini(struct ath_hw *ah)
664 ah->enabled_cals |= TX_CL_CAL; 664 ah->enabled_cals |= TX_CL_CAL;
665 else 665 else
666 ah->enabled_cals &= ~TX_CL_CAL; 666 ah->enabled_cals &= ~TX_CL_CAL;
667
668 if (AR_SREV_9340(ah) || AR_SREV_9531(ah) || AR_SREV_9550(ah)) {
669 if (ah->is_clk_25mhz) {
670 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
671 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
672 REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
673 } else {
674 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
675 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
676 REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
677 }
678 udelay(100);
679 }
667} 680}
668 681
669static void ar9003_hw_prog_ini(struct ath_hw *ah, 682static void ar9003_hw_prog_ini(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index 8be4b1453394..2ad605760e21 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -861,19 +861,6 @@ static void ath9k_hw_init_pll(struct ath_hw *ah,
861 udelay(RTC_PLL_SETTLE_DELAY); 861 udelay(RTC_PLL_SETTLE_DELAY);
862 862
863 REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK); 863 REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK);
864
865 if (AR_SREV_9340(ah) || AR_SREV_9550(ah)) {
866 if (ah->is_clk_25mhz) {
867 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x17c << 1);
868 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f3d7);
869 REG_WRITE(ah, AR_SLP32_INC, 0x0001e7ae);
870 } else {
871 REG_WRITE(ah, AR_RTC_DERIVED_CLK, 0x261 << 1);
872 REG_WRITE(ah, AR_SLP32_MODE, 0x0010f400);
873 REG_WRITE(ah, AR_SLP32_INC, 0x0001e800);
874 }
875 udelay(100);
876 }
877} 864}
878 865
879static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah, 866static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 30c66dfcd7a0..4f18a6be0c7d 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -974,9 +974,8 @@ void ath9k_calculate_iter_data(struct ath_softc *sc,
974 struct ath_vif *avp; 974 struct ath_vif *avp;
975 975
976 /* 976 /*
977 * Pick the MAC address of the first interface as the new hardware 977 * The hardware will use primary station addr together with the
978 * MAC address. The hardware will use it together with the BSSID mask 978 * BSSID mask when matching addresses.
979 * when matching addresses.
980 */ 979 */
981 memset(iter_data, 0, sizeof(*iter_data)); 980 memset(iter_data, 0, sizeof(*iter_data));
982 memset(&iter_data->mask, 0xff, ETH_ALEN); 981 memset(&iter_data->mask, 0xff, ETH_ALEN);
@@ -1205,6 +1204,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
1205 list_add_tail(&avp->list, &avp->chanctx->vifs); 1204 list_add_tail(&avp->list, &avp->chanctx->vifs);
1206 } 1205 }
1207 1206
1207 ath9k_calculate_summary_state(sc, avp->chanctx);
1208
1208 ath9k_assign_hw_queues(hw, vif); 1209 ath9k_assign_hw_queues(hw, vif);
1209 1210
1210 an->sc = sc; 1211 an->sc = sc;
@@ -1274,6 +1275,8 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
1274 1275
1275 ath_tx_node_cleanup(sc, &avp->mcast_node); 1276 ath_tx_node_cleanup(sc, &avp->mcast_node);
1276 1277
1278 ath9k_calculate_summary_state(sc, avp->chanctx);
1279
1277 mutex_unlock(&sc->mutex); 1280 mutex_unlock(&sc->mutex);
1278} 1281}
1279 1282
diff --git a/drivers/net/wireless/b43/phy_common.c b/drivers/net/wireless/b43/phy_common.c
index 1dfc682a8055..ee27b06074e1 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -300,9 +300,7 @@ void b43_phy_write(struct b43_wldev *dev, u16 reg, u16 value)
300 300
301void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg) 301void b43_phy_copy(struct b43_wldev *dev, u16 destreg, u16 srcreg)
302{ 302{
303 assert_mac_suspended(dev); 303 b43_phy_write(dev, destreg, b43_phy_read(dev, srcreg));
304 dev->phy.ops->phy_write(dev, destreg,
305 dev->phy.ops->phy_read(dev, srcreg));
306} 304}
307 305
308void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask) 306void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/of.c b/drivers/net/wireless/brcm80211/brcmfmac/of.c
index f05f5270fec1..927bffd5be64 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/of.c
@@ -40,8 +40,8 @@ void brcmf_of_probe(struct brcmf_sdio_dev *sdiodev)
40 return; 40 return;
41 41
42 irq = irq_of_parse_and_map(np, 0); 42 irq = irq_of_parse_and_map(np, 0);
43 if (irq < 0) { 43 if (!irq) {
44 brcmf_err("interrupt could not be mapped: err=%d\n", irq); 44 brcmf_err("interrupt could not be mapped\n");
45 devm_kfree(dev, sdiodev->pdata); 45 devm_kfree(dev, sdiodev->pdata);
46 return; 46 return;
47 } 47 }
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
index 8c0632ec9f7a..16fef3382019 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/pcie.c
@@ -19,10 +19,10 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/unaligned/access_ok.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/bcma/bcma.h> 23#include <linux/bcma/bcma.h>
25#include <linux/sched.h> 24#include <linux/sched.h>
25#include <asm/unaligned.h>
26 26
27#include <soc.h> 27#include <soc.h>
28#include <chipcommon.h> 28#include <chipcommon.h>
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index dc135915470d..875d1142c8b0 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -669,10 +669,12 @@ static int brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd,
669 goto finalize; 669 goto finalize;
670 } 670 }
671 671
672 if (!brcmf_usb_ioctl_resp_wait(devinfo)) 672 if (!brcmf_usb_ioctl_resp_wait(devinfo)) {
673 usb_kill_urb(devinfo->ctl_urb);
673 ret = -ETIMEDOUT; 674 ret = -ETIMEDOUT;
674 else 675 } else {
675 memcpy(buffer, tmpbuf, buflen); 676 memcpy(buffer, tmpbuf, buflen);
677 }
676 678
677finalize: 679finalize:
678 kfree(tmpbuf); 680 kfree(tmpbuf);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 28fa25b509db..39b45c038a93 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -299,6 +299,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
299 primary_offset = ch->center_freq1 - ch->chan->center_freq; 299 primary_offset = ch->center_freq1 - ch->chan->center_freq;
300 switch (ch->width) { 300 switch (ch->width) {
301 case NL80211_CHAN_WIDTH_20: 301 case NL80211_CHAN_WIDTH_20:
302 case NL80211_CHAN_WIDTH_20_NOHT:
302 ch_inf.bw = BRCMU_CHAN_BW_20; 303 ch_inf.bw = BRCMU_CHAN_BW_20;
303 WARN_ON(primary_offset != 0); 304 WARN_ON(primary_offset != 0);
304 break; 305 break;
@@ -323,6 +324,10 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
323 ch_inf.sb = BRCMU_CHAN_SB_LU; 324 ch_inf.sb = BRCMU_CHAN_SB_LU;
324 } 325 }
325 break; 326 break;
327 case NL80211_CHAN_WIDTH_80P80:
328 case NL80211_CHAN_WIDTH_160:
329 case NL80211_CHAN_WIDTH_5:
330 case NL80211_CHAN_WIDTH_10:
326 default: 331 default:
327 WARN_ON_ONCE(1); 332 WARN_ON_ONCE(1);
328 } 333 }
@@ -333,6 +338,7 @@ static u16 chandef_to_chanspec(struct brcmu_d11inf *d11inf,
333 case IEEE80211_BAND_5GHZ: 338 case IEEE80211_BAND_5GHZ:
334 ch_inf.band = BRCMU_CHAN_BAND_5G; 339 ch_inf.band = BRCMU_CHAN_BAND_5G;
335 break; 340 break;
341 case IEEE80211_BAND_60GHZ:
336 default: 342 default:
337 WARN_ON_ONCE(1); 343 WARN_ON_ONCE(1);
338 } 344 }
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index b280d5d87127..7554f7053830 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -602,16 +602,6 @@ static int iwl_mvm_cancel_regular_scan(struct iwl_mvm *mvm)
602 SCAN_COMPLETE_NOTIFICATION }; 602 SCAN_COMPLETE_NOTIFICATION };
603 int ret; 603 int ret;
604 604
605 if (mvm->scan_status == IWL_MVM_SCAN_NONE)
606 return 0;
607
608 if (iwl_mvm_is_radio_killed(mvm)) {
609 ieee80211_scan_completed(mvm->hw, true);
610 iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
611 mvm->scan_status = IWL_MVM_SCAN_NONE;
612 return 0;
613 }
614
615 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort, 605 iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_abort,
616 scan_abort_notif, 606 scan_abort_notif,
617 ARRAY_SIZE(scan_abort_notif), 607 ARRAY_SIZE(scan_abort_notif),
@@ -1400,6 +1390,16 @@ int iwl_mvm_unified_sched_scan_lmac(struct iwl_mvm *mvm,
1400 1390
1401int iwl_mvm_cancel_scan(struct iwl_mvm *mvm) 1391int iwl_mvm_cancel_scan(struct iwl_mvm *mvm)
1402{ 1392{
1393 if (mvm->scan_status == IWL_MVM_SCAN_NONE)
1394 return 0;
1395
1396 if (iwl_mvm_is_radio_killed(mvm)) {
1397 ieee80211_scan_completed(mvm->hw, true);
1398 iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);
1399 mvm->scan_status = IWL_MVM_SCAN_NONE;
1400 return 0;
1401 }
1402
1403 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) 1403 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN)
1404 return iwl_mvm_scan_offload_stop(mvm, true); 1404 return iwl_mvm_scan_offload_stop(mvm, true);
1405 return iwl_mvm_cancel_regular_scan(mvm); 1405 return iwl_mvm_cancel_regular_scan(mvm);
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 160c3ebc48d0..dd2f3f8baa9d 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1894,8 +1894,7 @@ static u32 iwl_trans_pcie_dump_prph(struct iwl_trans *trans,
1894 int reg; 1894 int reg;
1895 __le32 *val; 1895 __le32 *val;
1896 1896
1897 prph_len += sizeof(*data) + sizeof(*prph) + 1897 prph_len += sizeof(**data) + sizeof(*prph) + num_bytes_in_chunk;
1898 num_bytes_in_chunk;
1899 1898
1900 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); 1899 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH);
1901 (*data)->len = cpu_to_le32(sizeof(*prph) + 1900 (*data)->len = cpu_to_le32(sizeof(*prph) +
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 8e68f87ab13c..66ff36447b94 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -158,55 +158,29 @@ void rt2x00queue_align_frame(struct sk_buff *skb)
158 skb_trim(skb, frame_length); 158 skb_trim(skb, frame_length);
159} 159}
160 160
161void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int header_length) 161/*
162 * H/W needs L2 padding between the header and the paylod if header size
163 * is not 4 bytes aligned.
164 */
165void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len)
162{ 166{
163 unsigned int payload_length = skb->len - header_length; 167 unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
164 unsigned int header_align = ALIGN_SIZE(skb, 0);
165 unsigned int payload_align = ALIGN_SIZE(skb, header_length);
166 unsigned int l2pad = payload_length ? L2PAD_SIZE(header_length) : 0;
167 168
168 /* 169 if (!l2pad)
169 * Adjust the header alignment if the payload needs to be moved more
170 * than the header.
171 */
172 if (payload_align > header_align)
173 header_align += 4;
174
175 /* There is nothing to do if no alignment is needed */
176 if (!header_align)
177 return; 170 return;
178 171
179 /* Reserve the amount of space needed in front of the frame */ 172 skb_push(skb, l2pad);
180 skb_push(skb, header_align); 173 memmove(skb->data, skb->data + l2pad, hdr_len);
181
182 /*
183 * Move the header.
184 */
185 memmove(skb->data, skb->data + header_align, header_length);
186
187 /* Move the payload, if present and if required */
188 if (payload_length && payload_align)
189 memmove(skb->data + header_length + l2pad,
190 skb->data + header_length + l2pad + payload_align,
191 payload_length);
192
193 /* Trim the skb to the correct size */
194 skb_trim(skb, header_length + l2pad + payload_length);
195} 174}
196 175
197void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int header_length) 176void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len)
198{ 177{
199 /* 178 unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
200 * L2 padding is only present if the skb contains more than just the
201 * IEEE 802.11 header.
202 */
203 unsigned int l2pad = (skb->len > header_length) ?
204 L2PAD_SIZE(header_length) : 0;
205 179
206 if (!l2pad) 180 if (!l2pad)
207 return; 181 return;
208 182
209 memmove(skb->data + l2pad, skb->data, header_length); 183 memmove(skb->data + l2pad, skb->data, hdr_len);
210 skb_pull(skb, l2pad); 184 skb_pull(skb, l2pad);
211} 185}
212 186
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 25daa8715219..61f5d36eca6a 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -842,7 +842,8 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
842 break; 842 break;
843 } 843 }
844 /* handle command packet here */ 844 /* handle command packet here */
845 if (rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) { 845 if (rtlpriv->cfg->ops->rx_command_packet &&
846 rtlpriv->cfg->ops->rx_command_packet(hw, stats, skb)) {
846 dev_kfree_skb_any(skb); 847 dev_kfree_skb_any(skb);
847 goto end; 848 goto end;
848 } 849 }
@@ -1127,9 +1128,14 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw)
1127 1128
1128 __skb_queue_tail(&ring->queue, pskb); 1129 __skb_queue_tail(&ring->queue, pskb);
1129 1130
1130 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN, 1131 if (rtlpriv->use_new_trx_flow) {
1131 &temp_one); 1132 temp_one = 4;
1132 1133 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pbuffer_desc, true,
1134 HW_DESC_OWN, (u8 *)&temp_one);
1135 } else {
1136 rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc, true, HW_DESC_OWN,
1137 &temp_one);
1138 }
1133 return; 1139 return;
1134} 1140}
1135 1141
@@ -1370,9 +1376,9 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw,
1370 ring->desc = NULL; 1376 ring->desc = NULL;
1371 if (rtlpriv->use_new_trx_flow) { 1377 if (rtlpriv->use_new_trx_flow) {
1372 pci_free_consistent(rtlpci->pdev, 1378 pci_free_consistent(rtlpci->pdev,
1373 sizeof(*ring->desc) * ring->entries, 1379 sizeof(*ring->buffer_desc) * ring->entries,
1374 ring->buffer_desc, ring->buffer_desc_dma); 1380 ring->buffer_desc, ring->buffer_desc_dma);
1375 ring->desc = NULL; 1381 ring->buffer_desc = NULL;
1376 } 1382 }
1377} 1383}
1378 1384
@@ -1543,7 +1549,6 @@ int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw)
1543 true, 1549 true,
1544 HW_DESC_TXBUFF_ADDR), 1550 HW_DESC_TXBUFF_ADDR),
1545 skb->len, PCI_DMA_TODEVICE); 1551 skb->len, PCI_DMA_TODEVICE);
1546 ring->idx = (ring->idx + 1) % ring->entries;
1547 kfree_skb(skb); 1552 kfree_skb(skb);
1548 ring->idx = (ring->idx + 1) % ring->entries; 1553 ring->idx = (ring->idx + 1) % ring->entries;
1549 } 1554 }
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
index 00e067044c08..5761d5b49e39 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/hw.c
@@ -1201,6 +1201,9 @@ static int _rtl92se_set_media_status(struct ieee80211_hw *hw,
1201 1201
1202 } 1202 }
1203 1203
1204 if (type != NL80211_IFTYPE_AP &&
1205 rtlpriv->mac80211.link_state < MAC80211_LINKED)
1206 bt_msr = rtl_read_byte(rtlpriv, MSR) & ~MSR_LINK_MASK;
1204 rtl_write_byte(rtlpriv, (MSR), bt_msr); 1207 rtl_write_byte(rtlpriv, (MSR), bt_msr);
1205 1208
1206 temp = rtl_read_dword(rtlpriv, TCR); 1209 temp = rtl_read_dword(rtlpriv, TCR);
@@ -1262,6 +1265,7 @@ void rtl92se_enable_interrupt(struct ieee80211_hw *hw)
1262 rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]); 1265 rtl_write_dword(rtlpriv, INTA_MASK, rtlpci->irq_mask[0]);
1263 /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */ 1266 /* Support Bit 32-37(Assign as Bit 0-5) interrupt setting now */
1264 rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F); 1267 rtl_write_dword(rtlpriv, INTA_MASK + 4, rtlpci->irq_mask[1] & 0x3F);
1268 rtlpci->irq_enabled = true;
1265} 1269}
1266 1270
1267void rtl92se_disable_interrupt(struct ieee80211_hw *hw) 1271void rtl92se_disable_interrupt(struct ieee80211_hw *hw)
@@ -1276,8 +1280,7 @@ void rtl92se_disable_interrupt(struct ieee80211_hw *hw)
1276 rtlpci = rtl_pcidev(rtl_pcipriv(hw)); 1280 rtlpci = rtl_pcidev(rtl_pcipriv(hw));
1277 rtl_write_dword(rtlpriv, INTA_MASK, 0); 1281 rtl_write_dword(rtlpriv, INTA_MASK, 0);
1278 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0); 1282 rtl_write_dword(rtlpriv, INTA_MASK + 4, 0);
1279 1283 rtlpci->irq_enabled = false;
1280 synchronize_irq(rtlpci->pdev->irq);
1281} 1284}
1282 1285
1283static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data) 1286static u8 _rtl92s_set_sysclk(struct ieee80211_hw *hw, u8 data)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
index 77c5b5f35244..4b4612fe2fdb 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/phy.c
@@ -399,6 +399,8 @@ static bool _rtl92s_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
399 case 2: 399 case 2:
400 currentcmd = &postcommoncmd[*step]; 400 currentcmd = &postcommoncmd[*step];
401 break; 401 break;
402 default:
403 return true;
402 } 404 }
403 405
404 if (currentcmd->cmdid == CMDID_END) { 406 if (currentcmd->cmdid == CMDID_END) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
index aadba29c167a..fb003868bdef 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c
@@ -236,6 +236,19 @@ static void rtl92s_deinit_sw_vars(struct ieee80211_hw *hw)
236 } 236 }
237} 237}
238 238
239static bool rtl92se_is_tx_desc_closed(struct ieee80211_hw *hw, u8 hw_queue,
240 u16 index)
241{
242 struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
243 struct rtl8192_tx_ring *ring = &rtlpci->tx_ring[hw_queue];
244 u8 *entry = (u8 *)(&ring->desc[ring->idx]);
245 u8 own = (u8)rtl92se_get_desc(entry, true, HW_DESC_OWN);
246
247 if (own)
248 return false;
249 return true;
250}
251
239static struct rtl_hal_ops rtl8192se_hal_ops = { 252static struct rtl_hal_ops rtl8192se_hal_ops = {
240 .init_sw_vars = rtl92s_init_sw_vars, 253 .init_sw_vars = rtl92s_init_sw_vars,
241 .deinit_sw_vars = rtl92s_deinit_sw_vars, 254 .deinit_sw_vars = rtl92s_deinit_sw_vars,
@@ -269,6 +282,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = {
269 .led_control = rtl92se_led_control, 282 .led_control = rtl92se_led_control,
270 .set_desc = rtl92se_set_desc, 283 .set_desc = rtl92se_set_desc,
271 .get_desc = rtl92se_get_desc, 284 .get_desc = rtl92se_get_desc,
285 .is_tx_desc_closed = rtl92se_is_tx_desc_closed,
272 .tx_polling = rtl92se_tx_polling, 286 .tx_polling = rtl92se_tx_polling,
273 .enable_hw_sec = rtl92se_enable_hw_security_config, 287 .enable_hw_sec = rtl92se_enable_hw_security_config,
274 .set_key = rtl92se_set_key, 288 .set_key = rtl92se_set_key,
@@ -306,6 +320,8 @@ static struct rtl_hal_cfg rtl92se_hal_cfg = {
306 .maps[MAC_RCR_ACRC32] = RCR_ACRC32, 320 .maps[MAC_RCR_ACRC32] = RCR_ACRC32,
307 .maps[MAC_RCR_ACF] = RCR_ACF, 321 .maps[MAC_RCR_ACF] = RCR_ACF,
308 .maps[MAC_RCR_AAP] = RCR_AAP, 322 .maps[MAC_RCR_AAP] = RCR_AAP,
323 .maps[MAC_HIMR] = INTA_MASK,
324 .maps[MAC_HIMRE] = INTA_MASK + 4,
309 325
310 .maps[EFUSE_TEST] = REG_EFUSE_TEST, 326 .maps[EFUSE_TEST] = REG_EFUSE_TEST,
311 .maps[EFUSE_CTRL] = REG_EFUSE_CTRL, 327 .maps[EFUSE_CTRL] = REG_EFUSE_CTRL,
diff --git a/drivers/of/address.c b/drivers/of/address.c
index afdb78299f61..06af494184d6 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -450,6 +450,21 @@ static struct of_bus *of_match_bus(struct device_node *np)
450 return NULL; 450 return NULL;
451} 451}
452 452
453static int of_empty_ranges_quirk(void)
454{
455 if (IS_ENABLED(CONFIG_PPC)) {
456 /* To save cycles, we cache the result */
457 static int quirk_state = -1;
458
459 if (quirk_state < 0)
460 quirk_state =
461 of_machine_is_compatible("Power Macintosh") ||
462 of_machine_is_compatible("MacRISC");
463 return quirk_state;
464 }
465 return false;
466}
467
453static int of_translate_one(struct device_node *parent, struct of_bus *bus, 468static int of_translate_one(struct device_node *parent, struct of_bus *bus,
454 struct of_bus *pbus, __be32 *addr, 469 struct of_bus *pbus, __be32 *addr,
455 int na, int ns, int pna, const char *rprop) 470 int na, int ns, int pna, const char *rprop)
@@ -475,12 +490,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
475 * This code is only enabled on powerpc. --gcl 490 * This code is only enabled on powerpc. --gcl
476 */ 491 */
477 ranges = of_get_property(parent, rprop, &rlen); 492 ranges = of_get_property(parent, rprop, &rlen);
478#if !defined(CONFIG_PPC) 493 if (ranges == NULL && !of_empty_ranges_quirk()) {
479 if (ranges == NULL) {
480 pr_err("OF: no ranges; cannot translate\n"); 494 pr_err("OF: no ranges; cannot translate\n");
481 return 1; 495 return 1;
482 } 496 }
483#endif /* !defined(CONFIG_PPC) */
484 if (ranges == NULL || rlen == 0) { 497 if (ranges == NULL || rlen == 0) {
485 offset = of_read_number(addr, na); 498 offset = of_read_number(addr, na);
486 memset(addr, 0, pna * 4); 499 memset(addr, 0, pna * 4);
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index f297891d8529..d4994177dec2 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -247,7 +247,7 @@ void of_node_release(struct kobject *kobj)
247 * @allocflags: Allocation flags (typically pass GFP_KERNEL) 247 * @allocflags: Allocation flags (typically pass GFP_KERNEL)
248 * 248 *
249 * Copy a property by dynamically allocating the memory of both the 249 * Copy a property by dynamically allocating the memory of both the
250 * property stucture and the property name & contents. The property's 250 * property structure and the property name & contents. The property's
251 * flags have the OF_DYNAMIC bit set so that we can differentiate between 251 * flags have the OF_DYNAMIC bit set so that we can differentiate between
252 * dynamically allocated properties and not. 252 * dynamically allocated properties and not.
253 * Returns the newly allocated property or NULL on out of memory error. 253 * Returns the newly allocated property or NULL on out of memory error.
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d1ffca8b34ea..30e97bcc4f88 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -773,7 +773,7 @@ int __init early_init_dt_scan_chosen_serial(void)
773 if (offset < 0) 773 if (offset < 0)
774 return -ENODEV; 774 return -ENODEV;
775 775
776 while (match->compatible) { 776 while (match->compatible[0]) {
777 unsigned long addr; 777 unsigned long addr;
778 if (fdt_node_check_compatible(fdt, offset, match->compatible)) { 778 if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
779 match++; 779 match++;
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
index 11b873c54a77..e2d79afa9dc6 100644
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -896,10 +896,14 @@ static void selftest_data_remove(void)
896 return; 896 return;
897 } 897 }
898 898
899 while (last_node_index >= 0) { 899 while (last_node_index-- > 0) {
900 if (nodes[last_node_index]) { 900 if (nodes[last_node_index]) {
901 np = of_find_node_by_path(nodes[last_node_index]->full_name); 901 np = of_find_node_by_path(nodes[last_node_index]->full_name);
902 if (strcmp(np->full_name, "/aliases") != 0) { 902 if (np == nodes[last_node_index]) {
903 if (of_aliases == np) {
904 of_node_put(of_aliases);
905 of_aliases = NULL;
906 }
903 detach_node_and_children(np); 907 detach_node_and_children(np);
904 } else { 908 } else {
905 for_each_property_of_node(np, prop) { 909 for_each_property_of_node(np, prop) {
@@ -908,7 +912,6 @@ static void selftest_data_remove(void)
908 } 912 }
909 } 913 }
910 } 914 }
911 last_node_index--;
912 } 915 }
913} 916}
914 917
@@ -921,6 +924,8 @@ static int __init of_selftest(void)
921 res = selftest_data_add(); 924 res = selftest_data_add();
922 if (res) 925 if (res)
923 return res; 926 return res;
927 if (!of_aliases)
928 of_aliases = of_find_node_by_path("/aliases");
924 929
925 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 930 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
926 if (!np) { 931 if (!np) {
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index d292d7cb3417..49dd766852ba 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -444,7 +444,7 @@ static inline int pcie_cap_version(const struct pci_dev *dev)
444 return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS; 444 return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS;
445} 445}
446 446
447static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev) 447bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
448{ 448{
449 int type = pci_pcie_type(dev); 449 int type = pci_pcie_type(dev);
450 450
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index 9ecabfa8c634..2988fe136c1e 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -631,10 +631,15 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
631 if (ret) 631 if (ret)
632 return ret; 632 return ret;
633 633
634 bus = pci_scan_root_bus(&pdev->dev, 0, &xgene_pcie_ops, port, &res); 634 bus = pci_create_root_bus(&pdev->dev, 0,
635 &xgene_pcie_ops, port, &res);
635 if (!bus) 636 if (!bus)
636 return -ENOMEM; 637 return -ENOMEM;
637 638
639 pci_scan_child_bus(bus);
640 pci_assign_unassigned_bus_resources(bus);
641 pci_bus_add_devices(bus);
642
638 platform_set_drvdata(pdev, port); 643 platform_set_drvdata(pdev, port);
639 return 0; 644 return 0;
640} 645}
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 0601890db22d..4a3902d8e6fe 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -6,6 +6,8 @@
6 6
7extern const unsigned char pcie_link_speed[]; 7extern const unsigned char pcie_link_speed[];
8 8
9bool pcie_cap_has_lnkctl(const struct pci_dev *dev);
10
9/* Functions internal to the PCI core code */ 11/* Functions internal to the PCI core code */
10 12
11int pci_create_sysfs_dev_files(struct pci_dev *pdev); 13int pci_create_sysfs_dev_files(struct pci_dev *pdev);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 5ed99309c758..c8ca98c2b480 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -407,15 +407,16 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child)
407{ 407{
408 struct pci_dev *dev = child->self; 408 struct pci_dev *dev = child->self;
409 u16 mem_base_lo, mem_limit_lo; 409 u16 mem_base_lo, mem_limit_lo;
410 unsigned long base, limit; 410 u64 base64, limit64;
411 dma_addr_t base, limit;
411 struct pci_bus_region region; 412 struct pci_bus_region region;
412 struct resource *res; 413 struct resource *res;
413 414
414 res = child->resource[2]; 415 res = child->resource[2];
415 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); 416 pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo);
416 pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); 417 pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo);
417 base = ((unsigned long) mem_base_lo & PCI_PREF_RANGE_MASK) << 16; 418 base64 = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16;
418 limit = ((unsigned long) mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; 419 limit64 = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16;
419 420
420 if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { 421 if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) {
421 u32 mem_base_hi, mem_limit_hi; 422 u32 mem_base_hi, mem_limit_hi;
@@ -429,17 +430,20 @@ static void pci_read_bridge_mmio_pref(struct pci_bus *child)
429 * this, just assume they are not being used. 430 * this, just assume they are not being used.
430 */ 431 */
431 if (mem_base_hi <= mem_limit_hi) { 432 if (mem_base_hi <= mem_limit_hi) {
432#if BITS_PER_LONG == 64 433 base64 |= (u64) mem_base_hi << 32;
433 base |= ((unsigned long) mem_base_hi) << 32; 434 limit64 |= (u64) mem_limit_hi << 32;
434 limit |= ((unsigned long) mem_limit_hi) << 32;
435#else
436 if (mem_base_hi || mem_limit_hi) {
437 dev_err(&dev->dev, "can't handle 64-bit address space for bridge\n");
438 return;
439 }
440#endif
441 } 435 }
442 } 436 }
437
438 base = (dma_addr_t) base64;
439 limit = (dma_addr_t) limit64;
440
441 if (base != base64) {
442 dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n",
443 (unsigned long long) base64);
444 return;
445 }
446
443 if (base <= limit) { 447 if (base <= limit) {
444 res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | 448 res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) |
445 IORESOURCE_MEM | IORESOURCE_PREFETCH; 449 IORESOURCE_MEM | IORESOURCE_PREFETCH;
@@ -1323,7 +1327,7 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
1323 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or); 1327 ~hpp->pci_exp_devctl_and, hpp->pci_exp_devctl_or);
1324 1328
1325 /* Initialize Link Control Register */ 1329 /* Initialize Link Control Register */
1326 if (dev->subordinate) 1330 if (pcie_cap_has_lnkctl(dev))
1327 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL, 1331 pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
1328 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or); 1332 ~hpp->pci_exp_lnkctl_and, hpp->pci_exp_lnkctl_or);
1329 1333
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 81bb3bd7909d..15081257cfc8 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -828,6 +828,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
828 if (status == CPL_ERR_RTX_NEG_ADVICE) 828 if (status == CPL_ERR_RTX_NEG_ADVICE)
829 goto rel_skb; 829 goto rel_skb;
830 830
831 module_put(THIS_MODULE);
832
831 if (status && status != CPL_ERR_TCAM_FULL && 833 if (status && status != CPL_ERR_TCAM_FULL &&
832 status != CPL_ERR_CONN_EXIST && 834 status != CPL_ERR_CONN_EXIST &&
833 status != CPL_ERR_ARP_MISS) 835 status != CPL_ERR_ARP_MISS)
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index 13d869a92248..7da59c38a69e 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -816,7 +816,7 @@ static void cxgbi_inform_iscsi_conn_closing(struct cxgbi_sock *csk)
816 read_lock_bh(&csk->callback_lock); 816 read_lock_bh(&csk->callback_lock);
817 if (csk->user_data) 817 if (csk->user_data)
818 iscsi_conn_failure(csk->user_data, 818 iscsi_conn_failure(csk->user_data,
819 ISCSI_ERR_CONN_FAILED); 819 ISCSI_ERR_TCP_CONN_CLOSE);
820 read_unlock_bh(&csk->callback_lock); 820 read_unlock_bh(&csk->callback_lock);
821 } 821 }
822} 822}
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index b19e4329ba00..73e58d22e325 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3491,7 +3491,7 @@ iscsit_build_sendtargets_response(struct iscsi_cmd *cmd,
3491 len = sprintf(buf, "TargetAddress=" 3491 len = sprintf(buf, "TargetAddress="
3492 "%s:%hu,%hu", 3492 "%s:%hu,%hu",
3493 inaddr_any ? conn->local_ip : np->np_ip, 3493 inaddr_any ? conn->local_ip : np->np_ip,
3494 inaddr_any ? conn->local_port : np->np_port, 3494 np->np_port,
3495 tpg->tpgt); 3495 tpg->tpgt);
3496 len += 1; 3496 len += 1;
3497 3497
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 8c60a1a1ae8d..9f93b8234095 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -2738,7 +2738,8 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2738 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder; 2738 struct t10_pr_registration *pr_reg, *pr_reg_tmp, *pr_reg_n, *pr_res_holder;
2739 struct t10_reservation *pr_tmpl = &dev->t10_pr; 2739 struct t10_reservation *pr_tmpl = &dev->t10_pr;
2740 u32 pr_res_mapped_lun = 0; 2740 u32 pr_res_mapped_lun = 0;
2741 int all_reg = 0, calling_it_nexus = 0, released_regs = 0; 2741 int all_reg = 0, calling_it_nexus = 0;
2742 bool sa_res_key_unmatched = sa_res_key != 0;
2742 int prh_type = 0, prh_scope = 0; 2743 int prh_type = 0, prh_scope = 0;
2743 2744
2744 if (!se_sess) 2745 if (!se_sess)
@@ -2813,6 +2814,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2813 if (!all_reg) { 2814 if (!all_reg) {
2814 if (pr_reg->pr_res_key != sa_res_key) 2815 if (pr_reg->pr_res_key != sa_res_key)
2815 continue; 2816 continue;
2817 sa_res_key_unmatched = false;
2816 2818
2817 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; 2819 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0;
2818 pr_reg_nacl = pr_reg->pr_reg_nacl; 2820 pr_reg_nacl = pr_reg->pr_reg_nacl;
@@ -2820,7 +2822,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2820 __core_scsi3_free_registration(dev, pr_reg, 2822 __core_scsi3_free_registration(dev, pr_reg,
2821 (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : 2823 (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list :
2822 NULL, calling_it_nexus); 2824 NULL, calling_it_nexus);
2823 released_regs++;
2824 } else { 2825 } else {
2825 /* 2826 /*
2826 * Case for any existing all registrants type 2827 * Case for any existing all registrants type
@@ -2838,6 +2839,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2838 if ((sa_res_key) && 2839 if ((sa_res_key) &&
2839 (pr_reg->pr_res_key != sa_res_key)) 2840 (pr_reg->pr_res_key != sa_res_key))
2840 continue; 2841 continue;
2842 sa_res_key_unmatched = false;
2841 2843
2842 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0; 2844 calling_it_nexus = (pr_reg_n == pr_reg) ? 1 : 0;
2843 if (calling_it_nexus) 2845 if (calling_it_nexus)
@@ -2848,7 +2850,6 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2848 __core_scsi3_free_registration(dev, pr_reg, 2850 __core_scsi3_free_registration(dev, pr_reg,
2849 (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list : 2851 (preempt_type == PREEMPT_AND_ABORT) ? &preempt_and_abort_list :
2850 NULL, 0); 2852 NULL, 0);
2851 released_regs++;
2852 } 2853 }
2853 if (!calling_it_nexus) 2854 if (!calling_it_nexus)
2854 core_scsi3_ua_allocate(pr_reg_nacl, 2855 core_scsi3_ua_allocate(pr_reg_nacl,
@@ -2863,7 +2864,7 @@ core_scsi3_pro_preempt(struct se_cmd *cmd, int type, int scope, u64 res_key,
2863 * registered reservation key, then the device server shall 2864 * registered reservation key, then the device server shall
2864 * complete the command with RESERVATION CONFLICT status. 2865 * complete the command with RESERVATION CONFLICT status.
2865 */ 2866 */
2866 if (!released_regs) { 2867 if (sa_res_key_unmatched) {
2867 spin_unlock(&dev->dev_reservation_lock); 2868 spin_unlock(&dev->dev_reservation_lock);
2868 core_scsi3_put_pr_reg(pr_reg_n); 2869 core_scsi3_put_pr_reg(pr_reg_n);
2869 return TCM_RESERVATION_CONFLICT; 2870 return TCM_RESERVATION_CONFLICT;
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 9ea0d5f03f7a..be877bf6f730 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2292,7 +2292,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
2292 * and let it call back once the write buffers are ready. 2292 * and let it call back once the write buffers are ready.
2293 */ 2293 */
2294 target_add_to_state_list(cmd); 2294 target_add_to_state_list(cmd);
2295 if (cmd->data_direction != DMA_TO_DEVICE) { 2295 if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) {
2296 target_execute_cmd(cmd); 2296 target_execute_cmd(cmd);
2297 return 0; 2297 return 0;
2298 } 2298 }
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 69906cacd04f..a17f11850669 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1312,6 +1312,7 @@ static int
1312vhost_scsi_set_endpoint(struct vhost_scsi *vs, 1312vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1313 struct vhost_scsi_target *t) 1313 struct vhost_scsi_target *t)
1314{ 1314{
1315 struct se_portal_group *se_tpg;
1315 struct tcm_vhost_tport *tv_tport; 1316 struct tcm_vhost_tport *tv_tport;
1316 struct tcm_vhost_tpg *tpg; 1317 struct tcm_vhost_tpg *tpg;
1317 struct tcm_vhost_tpg **vs_tpg; 1318 struct tcm_vhost_tpg **vs_tpg;
@@ -1359,6 +1360,21 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
1359 ret = -EEXIST; 1360 ret = -EEXIST;
1360 goto out; 1361 goto out;
1361 } 1362 }
1363 /*
1364 * In order to ensure individual vhost-scsi configfs
1365 * groups cannot be removed while in use by vhost ioctl,
1366 * go ahead and take an explicit se_tpg->tpg_group.cg_item
1367 * dependency now.
1368 */
1369 se_tpg = &tpg->se_tpg;
1370 ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys,
1371 &se_tpg->tpg_group.cg_item);
1372 if (ret) {
1373 pr_warn("configfs_depend_item() failed: %d\n", ret);
1374 kfree(vs_tpg);
1375 mutex_unlock(&tpg->tv_tpg_mutex);
1376 goto out;
1377 }
1362 tpg->tv_tpg_vhost_count++; 1378 tpg->tv_tpg_vhost_count++;
1363 tpg->vhost_scsi = vs; 1379 tpg->vhost_scsi = vs;
1364 vs_tpg[tpg->tport_tpgt] = tpg; 1380 vs_tpg[tpg->tport_tpgt] = tpg;
@@ -1401,6 +1417,7 @@ static int
1401vhost_scsi_clear_endpoint(struct vhost_scsi *vs, 1417vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
1402 struct vhost_scsi_target *t) 1418 struct vhost_scsi_target *t)
1403{ 1419{
1420 struct se_portal_group *se_tpg;
1404 struct tcm_vhost_tport *tv_tport; 1421 struct tcm_vhost_tport *tv_tport;
1405 struct tcm_vhost_tpg *tpg; 1422 struct tcm_vhost_tpg *tpg;
1406 struct vhost_virtqueue *vq; 1423 struct vhost_virtqueue *vq;
@@ -1449,6 +1466,13 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
1449 vs->vs_tpg[target] = NULL; 1466 vs->vs_tpg[target] = NULL;
1450 match = true; 1467 match = true;
1451 mutex_unlock(&tpg->tv_tpg_mutex); 1468 mutex_unlock(&tpg->tv_tpg_mutex);
1469 /*
1470 * Release se_tpg->tpg_group.cg_item configfs dependency now
1471 * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur.
1472 */
1473 se_tpg = &tpg->se_tpg;
1474 configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys,
1475 &se_tpg->tpg_group.cg_item);
1452 } 1476 }
1453 if (match) { 1477 if (match) {
1454 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { 1478 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
diff --git a/fs/Makefile b/fs/Makefile
index 34a1b9dea6dd..da0bbb456d3f 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -104,7 +104,7 @@ obj-$(CONFIG_QNX6FS_FS) += qnx6/
104obj-$(CONFIG_AUTOFS4_FS) += autofs4/ 104obj-$(CONFIG_AUTOFS4_FS) += autofs4/
105obj-$(CONFIG_ADFS_FS) += adfs/ 105obj-$(CONFIG_ADFS_FS) += adfs/
106obj-$(CONFIG_FUSE_FS) += fuse/ 106obj-$(CONFIG_FUSE_FS) += fuse/
107obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ 107obj-$(CONFIG_OVERLAY_FS) += overlayfs/
108obj-$(CONFIG_UDF_FS) += udf/ 108obj-$(CONFIG_UDF_FS) += udf/
109obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ 109obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/
110obj-$(CONFIG_OMFS_FS) += omfs/ 110obj-$(CONFIG_OMFS_FS) += omfs/
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 19bc6162fb8e..150822ee0a0b 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -80,13 +80,6 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
80{ 80{
81 int i; 81 int i;
82 82
83#ifdef CONFIG_DEBUG_LOCK_ALLOC
84 /* lockdep really cares that we take all of these spinlocks
85 * in the right order. If any of the locks in the path are not
86 * currently blocking, it is going to complain. So, make really
87 * really sure by forcing the path to blocking before we clear
88 * the path blocking.
89 */
90 if (held) { 83 if (held) {
91 btrfs_set_lock_blocking_rw(held, held_rw); 84 btrfs_set_lock_blocking_rw(held, held_rw);
92 if (held_rw == BTRFS_WRITE_LOCK) 85 if (held_rw == BTRFS_WRITE_LOCK)
@@ -95,7 +88,6 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
95 held_rw = BTRFS_READ_LOCK_BLOCKING; 88 held_rw = BTRFS_READ_LOCK_BLOCKING;
96 } 89 }
97 btrfs_set_path_blocking(p); 90 btrfs_set_path_blocking(p);
98#endif
99 91
100 for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) { 92 for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) {
101 if (p->nodes[i] && p->locks[i]) { 93 if (p->nodes[i] && p->locks[i]) {
@@ -107,10 +99,8 @@ noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
107 } 99 }
108 } 100 }
109 101
110#ifdef CONFIG_DEBUG_LOCK_ALLOC
111 if (held) 102 if (held)
112 btrfs_clear_lock_blocking_rw(held, held_rw); 103 btrfs_clear_lock_blocking_rw(held, held_rw);
113#endif
114} 104}
115 105
116/* this also releases the path */ 106/* this also releases the path */
@@ -2893,7 +2883,7 @@ cow_done:
2893 } 2883 }
2894 p->locks[level] = BTRFS_WRITE_LOCK; 2884 p->locks[level] = BTRFS_WRITE_LOCK;
2895 } else { 2885 } else {
2896 err = btrfs_try_tree_read_lock(b); 2886 err = btrfs_tree_read_lock_atomic(b);
2897 if (!err) { 2887 if (!err) {
2898 btrfs_set_path_blocking(p); 2888 btrfs_set_path_blocking(p);
2899 btrfs_tree_read_lock(b); 2889 btrfs_tree_read_lock(b);
@@ -3025,7 +3015,7 @@ again:
3025 } 3015 }
3026 3016
3027 level = btrfs_header_level(b); 3017 level = btrfs_header_level(b);
3028 err = btrfs_try_tree_read_lock(b); 3018 err = btrfs_tree_read_lock_atomic(b);
3029 if (!err) { 3019 if (!err) {
3030 btrfs_set_path_blocking(p); 3020 btrfs_set_path_blocking(p);
3031 btrfs_tree_read_lock(b); 3021 btrfs_tree_read_lock(b);
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 5665d2149249..f8229ef1b46d 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -128,6 +128,26 @@ again:
128} 128}
129 129
130/* 130/*
131 * take a spinning read lock.
132 * returns 1 if we get the read lock and 0 if we don't
133 * this won't wait for blocking writers
134 */
135int btrfs_tree_read_lock_atomic(struct extent_buffer *eb)
136{
137 if (atomic_read(&eb->blocking_writers))
138 return 0;
139
140 read_lock(&eb->lock);
141 if (atomic_read(&eb->blocking_writers)) {
142 read_unlock(&eb->lock);
143 return 0;
144 }
145 atomic_inc(&eb->read_locks);
146 atomic_inc(&eb->spinning_readers);
147 return 1;
148}
149
150/*
131 * returns 1 if we get the read lock and 0 if we don't 151 * returns 1 if we get the read lock and 0 if we don't
132 * this won't wait for blocking writers 152 * this won't wait for blocking writers
133 */ 153 */
@@ -158,9 +178,7 @@ int btrfs_try_tree_write_lock(struct extent_buffer *eb)
158 atomic_read(&eb->blocking_readers)) 178 atomic_read(&eb->blocking_readers))
159 return 0; 179 return 0;
160 180
161 if (!write_trylock(&eb->lock)) 181 write_lock(&eb->lock);
162 return 0;
163
164 if (atomic_read(&eb->blocking_writers) || 182 if (atomic_read(&eb->blocking_writers) ||
165 atomic_read(&eb->blocking_readers)) { 183 atomic_read(&eb->blocking_readers)) {
166 write_unlock(&eb->lock); 184 write_unlock(&eb->lock);
diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h
index b81e0e9a4894..c44a9d5f5362 100644
--- a/fs/btrfs/locking.h
+++ b/fs/btrfs/locking.h
@@ -35,6 +35,8 @@ void btrfs_clear_lock_blocking_rw(struct extent_buffer *eb, int rw);
35void btrfs_assert_tree_locked(struct extent_buffer *eb); 35void btrfs_assert_tree_locked(struct extent_buffer *eb);
36int btrfs_try_tree_read_lock(struct extent_buffer *eb); 36int btrfs_try_tree_read_lock(struct extent_buffer *eb);
37int btrfs_try_tree_write_lock(struct extent_buffer *eb); 37int btrfs_try_tree_write_lock(struct extent_buffer *eb);
38int btrfs_tree_read_lock_atomic(struct extent_buffer *eb);
39
38 40
39static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw) 41static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw)
40{ 42{
diff --git a/fs/dcache.c b/fs/dcache.c
index 3ffef7f4e5cd..5bc72b07fde2 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -778,6 +778,7 @@ restart:
778 struct dentry *parent = lock_parent(dentry); 778 struct dentry *parent = lock_parent(dentry);
779 if (likely(!dentry->d_lockref.count)) { 779 if (likely(!dentry->d_lockref.count)) {
780 __dentry_kill(dentry); 780 __dentry_kill(dentry);
781 dput(parent);
781 goto restart; 782 goto restart;
782 } 783 }
783 if (parent) 784 if (parent)
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index fe839b915116..d67a16f2a45d 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -174,27 +174,6 @@ struct iso9660_options{
174 * Compute the hash for the isofs name corresponding to the dentry. 174 * Compute the hash for the isofs name corresponding to the dentry.
175 */ 175 */
176static int 176static int
177isofs_hash_common(struct qstr *qstr, int ms)
178{
179 const char *name;
180 int len;
181
182 len = qstr->len;
183 name = qstr->name;
184 if (ms) {
185 while (len && name[len-1] == '.')
186 len--;
187 }
188
189 qstr->hash = full_name_hash(name, len);
190
191 return 0;
192}
193
194/*
195 * Compute the hash for the isofs name corresponding to the dentry.
196 */
197static int
198isofs_hashi_common(struct qstr *qstr, int ms) 177isofs_hashi_common(struct qstr *qstr, int ms)
199{ 178{
200 const char *name; 179 const char *name;
@@ -263,6 +242,27 @@ isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry,
263} 242}
264 243
265#ifdef CONFIG_JOLIET 244#ifdef CONFIG_JOLIET
245/*
246 * Compute the hash for the isofs name corresponding to the dentry.
247 */
248static int
249isofs_hash_common(struct qstr *qstr, int ms)
250{
251 const char *name;
252 int len;
253
254 len = qstr->len;
255 name = qstr->name;
256 if (ms) {
257 while (len && name[len-1] == '.')
258 len--;
259 }
260
261 qstr->hash = full_name_hash(name, len);
262
263 return 0;
264}
265
266static int 266static int
267isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr) 267isofs_hash_ms(const struct dentry *dentry, struct qstr *qstr)
268{ 268{
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 13db95f54176..56598742dde4 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -53,7 +53,7 @@ static const struct rpc_call_ops nlmsvc_grant_ops;
53static LIST_HEAD(nlm_blocked); 53static LIST_HEAD(nlm_blocked);
54static DEFINE_SPINLOCK(nlm_blocked_lock); 54static DEFINE_SPINLOCK(nlm_blocked_lock);
55 55
56#ifdef LOCKD_DEBUG 56#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
57static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) 57static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
58{ 58{
59 /* 59 /*
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 4f46f7a05289..77fec6a55f57 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -812,7 +812,7 @@ static u64 pnfs_num_cont_bytes(struct inode *inode, pgoff_t idx)
812 812
813 /* Optimize common case that writes from 0 to end of file */ 813 /* Optimize common case that writes from 0 to end of file */
814 end = DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE); 814 end = DIV_ROUND_UP(i_size_read(inode), PAGE_CACHE_SIZE);
815 if (end != NFS_I(inode)->npages) { 815 if (end != inode->i_mapping->nrpages) {
816 rcu_read_lock(); 816 rcu_read_lock();
817 end = page_cache_next_hole(mapping, idx + 1, ULONG_MAX); 817 end = page_cache_next_hole(mapping, idx + 1, ULONG_MAX);
818 rcu_read_unlock(); 818 rcu_read_unlock();
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 73466b934090..e36a9d78ea49 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -49,7 +49,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
49 goto out_iput; 49 goto out_iput;
50 res->size = i_size_read(inode); 50 res->size = i_size_read(inode);
51 res->change_attr = delegation->change_attr; 51 res->change_attr = delegation->change_attr;
52 if (nfsi->npages != 0) 52 if (nfsi->nrequests != 0)
53 res->change_attr++; 53 res->change_attr++;
54 res->ctime = inode->i_ctime; 54 res->ctime = inode->i_ctime;
55 res->mtime = inode->i_mtime; 55 res->mtime = inode->i_mtime;
diff --git a/fs/nfs/filelayout/filelayoutdev.c b/fs/nfs/filelayout/filelayoutdev.c
index 9bb806a76d99..bfecac781f19 100644
--- a/fs/nfs/filelayout/filelayoutdev.c
+++ b/fs/nfs/filelayout/filelayoutdev.c
@@ -204,8 +204,7 @@ destroy_ds(struct nfs4_pnfs_ds *ds)
204 ifdebug(FACILITY) 204 ifdebug(FACILITY)
205 print_ds(ds); 205 print_ds(ds);
206 206
207 if (ds->ds_clp) 207 nfs_put_client(ds->ds_clp);
208 nfs_put_client(ds->ds_clp);
209 208
210 while (!list_empty(&ds->ds_addrs)) { 209 while (!list_empty(&ds->ds_addrs)) {
211 da = list_first_entry(&ds->ds_addrs, 210 da = list_first_entry(&ds->ds_addrs,
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index 3ef01f0ba0bc..d63bea8bbfbb 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -269,8 +269,8 @@ int nfs_fscache_release_page(struct page *page, gfp_t gfp)
269 if (!fscache_maybe_release_page(cookie, page, gfp)) 269 if (!fscache_maybe_release_page(cookie, page, gfp))
270 return 0; 270 return 0;
271 271
272 nfs_add_fscache_stats(page->mapping->host, 272 nfs_inc_fscache_stats(page->mapping->host,
273 NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 273 NFSIOS_FSCACHE_PAGES_UNCACHED);
274 } 274 }
275 275
276 return 1; 276 return 1;
@@ -293,8 +293,8 @@ void __nfs_fscache_invalidate_page(struct page *page, struct inode *inode)
293 293
294 BUG_ON(!PageLocked(page)); 294 BUG_ON(!PageLocked(page));
295 fscache_uncache_page(cookie, page); 295 fscache_uncache_page(cookie, page);
296 nfs_add_fscache_stats(page->mapping->host, 296 nfs_inc_fscache_stats(page->mapping->host,
297 NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 297 NFSIOS_FSCACHE_PAGES_UNCACHED);
298} 298}
299 299
300/* 300/*
@@ -343,19 +343,19 @@ int __nfs_readpage_from_fscache(struct nfs_open_context *ctx,
343 case 0: /* read BIO submitted (page in fscache) */ 343 case 0: /* read BIO submitted (page in fscache) */
344 dfprintk(FSCACHE, 344 dfprintk(FSCACHE,
345 "NFS: readpage_from_fscache: BIO submitted\n"); 345 "NFS: readpage_from_fscache: BIO submitted\n");
346 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK, 1); 346 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_OK);
347 return ret; 347 return ret;
348 348
349 case -ENOBUFS: /* inode not in cache */ 349 case -ENOBUFS: /* inode not in cache */
350 case -ENODATA: /* page not in cache */ 350 case -ENODATA: /* page not in cache */
351 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL, 1); 351 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL);
352 dfprintk(FSCACHE, 352 dfprintk(FSCACHE,
353 "NFS: readpage_from_fscache %d\n", ret); 353 "NFS: readpage_from_fscache %d\n", ret);
354 return 1; 354 return 1;
355 355
356 default: 356 default:
357 dfprintk(FSCACHE, "NFS: readpage_from_fscache %d\n", ret); 357 dfprintk(FSCACHE, "NFS: readpage_from_fscache %d\n", ret);
358 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL, 1); 358 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_READ_FAIL);
359 } 359 }
360 return ret; 360 return ret;
361} 361}
@@ -429,11 +429,11 @@ void __nfs_readpage_to_fscache(struct inode *inode, struct page *page, int sync)
429 429
430 if (ret != 0) { 430 if (ret != 0) {
431 fscache_uncache_page(nfs_i_fscache(inode), page); 431 fscache_uncache_page(nfs_i_fscache(inode), page);
432 nfs_add_fscache_stats(inode, 432 nfs_inc_fscache_stats(inode,
433 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL, 1); 433 NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL);
434 nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED, 1); 434 nfs_inc_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED);
435 } else { 435 } else {
436 nfs_add_fscache_stats(inode, 436 nfs_inc_fscache_stats(inode,
437 NFSIOS_FSCACHE_PAGES_WRITTEN_OK, 1); 437 NFSIOS_FSCACHE_PAGES_WRITTEN_OK);
438 } 438 }
439} 439}
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 00689a8a85e4..4bffe637ea32 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -192,6 +192,7 @@ void nfs_zap_caches(struct inode *inode)
192 nfs_zap_caches_locked(inode); 192 nfs_zap_caches_locked(inode);
193 spin_unlock(&inode->i_lock); 193 spin_unlock(&inode->i_lock);
194} 194}
195EXPORT_SYMBOL_GPL(nfs_zap_caches);
195 196
196void nfs_zap_mapping(struct inode *inode, struct address_space *mapping) 197void nfs_zap_mapping(struct inode *inode, struct address_space *mapping)
197{ 198{
@@ -1149,7 +1150,7 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr
1149 if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) 1150 if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE)
1150 && (fattr->valid & NFS_ATTR_FATTR_SIZE) 1151 && (fattr->valid & NFS_ATTR_FATTR_SIZE)
1151 && i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size) 1152 && i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size)
1152 && nfsi->npages == 0) { 1153 && nfsi->nrequests == 0) {
1153 i_size_write(inode, nfs_size_to_loff_t(fattr->size)); 1154 i_size_write(inode, nfs_size_to_loff_t(fattr->size));
1154 ret |= NFS_INO_INVALID_ATTR; 1155 ret |= NFS_INO_INVALID_ATTR;
1155 } 1156 }
@@ -1192,7 +1193,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
1192 if (fattr->valid & NFS_ATTR_FATTR_SIZE) { 1193 if (fattr->valid & NFS_ATTR_FATTR_SIZE) {
1193 cur_size = i_size_read(inode); 1194 cur_size = i_size_read(inode);
1194 new_isize = nfs_size_to_loff_t(fattr->size); 1195 new_isize = nfs_size_to_loff_t(fattr->size);
1195 if (cur_size != new_isize && nfsi->npages == 0) 1196 if (cur_size != new_isize && nfsi->nrequests == 0)
1196 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; 1197 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
1197 } 1198 }
1198 1199
@@ -1619,7 +1620,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1619 if (new_isize != cur_isize) { 1620 if (new_isize != cur_isize) {
1620 /* Do we perhaps have any outstanding writes, or has 1621 /* Do we perhaps have any outstanding writes, or has
1621 * the file grown beyond our last write? */ 1622 * the file grown beyond our last write? */
1622 if ((nfsi->npages == 0) || new_isize > cur_isize) { 1623 if ((nfsi->nrequests == 0) || new_isize > cur_isize) {
1623 i_size_write(inode, new_isize); 1624 i_size_write(inode, new_isize);
1624 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; 1625 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA;
1625 invalid &= ~NFS_INO_REVAL_PAGECACHE; 1626 invalid &= ~NFS_INO_REVAL_PAGECACHE;
@@ -1784,7 +1785,7 @@ static void init_once(void *foo)
1784 INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); 1785 INIT_LIST_HEAD(&nfsi->access_cache_entry_lru);
1785 INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); 1786 INIT_LIST_HEAD(&nfsi->access_cache_inode_lru);
1786 INIT_LIST_HEAD(&nfsi->commit_info.list); 1787 INIT_LIST_HEAD(&nfsi->commit_info.list);
1787 nfsi->npages = 0; 1788 nfsi->nrequests = 0;
1788 nfsi->commit_info.ncommit = 0; 1789 nfsi->commit_info.ncommit = 0;
1789 atomic_set(&nfsi->commit_info.rpcs_out, 0); 1790 atomic_set(&nfsi->commit_info.rpcs_out, 0);
1790 atomic_set(&nfsi->silly_count, 1); 1791 atomic_set(&nfsi->silly_count, 1);
diff --git a/fs/nfs/iostat.h b/fs/nfs/iostat.h
index c5832487c456..0cb806fbd4c4 100644
--- a/fs/nfs/iostat.h
+++ b/fs/nfs/iostat.h
@@ -55,6 +55,11 @@ static inline void nfs_add_fscache_stats(struct inode *inode,
55{ 55{
56 this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend); 56 this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend);
57} 57}
58static inline void nfs_inc_fscache_stats(struct inode *inode,
59 enum nfs_stat_fscachecounters stat)
60{
61 this_cpu_inc(NFS_SERVER(inode)->io_stats->fscache[stat]);
62}
58#endif 63#endif
59 64
60static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void) 65static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void)
diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h
index d10333a197bf..7afb8947dfdf 100644
--- a/fs/nfs/nfs42.h
+++ b/fs/nfs/nfs42.h
@@ -6,6 +6,8 @@
6#define __LINUX_FS_NFS_NFS4_2_H 6#define __LINUX_FS_NFS_NFS4_2_H
7 7
8/* nfs4.2proc.c */ 8/* nfs4.2proc.c */
9int nfs42_proc_allocate(struct file *, loff_t, loff_t);
10int nfs42_proc_deallocate(struct file *, loff_t, loff_t);
9loff_t nfs42_proc_llseek(struct file *, loff_t, int); 11loff_t nfs42_proc_llseek(struct file *, loff_t, int);
10 12
11/* nfs4.2xdr.h */ 13/* nfs4.2xdr.h */
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 0886f1db5917..cb170722769c 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -32,6 +32,81 @@ static int nfs42_set_rw_stateid(nfs4_stateid *dst, struct file *file,
32 return ret; 32 return ret;
33} 33}
34 34
35static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
36 loff_t offset, loff_t len)
37{
38 struct inode *inode = file_inode(filep);
39 struct nfs42_falloc_args args = {
40 .falloc_fh = NFS_FH(inode),
41 .falloc_offset = offset,
42 .falloc_length = len,
43 };
44 struct nfs42_falloc_res res;
45 struct nfs_server *server = NFS_SERVER(inode);
46 int status;
47
48 msg->rpc_argp = &args;
49 msg->rpc_resp = &res;
50
51 status = nfs42_set_rw_stateid(&args.falloc_stateid, filep, FMODE_WRITE);
52 if (status)
53 return status;
54
55 return nfs4_call_sync(server->client, server, msg,
56 &args.seq_args, &res.seq_res, 0);
57}
58
59static int nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
60 loff_t offset, loff_t len)
61{
62 struct nfs_server *server = NFS_SERVER(file_inode(filep));
63 struct nfs4_exception exception = { };
64 int err;
65
66 do {
67 err = _nfs42_proc_fallocate(msg, filep, offset, len);
68 if (err == -ENOTSUPP)
69 return -EOPNOTSUPP;
70 err = nfs4_handle_exception(server, err, &exception);
71 } while (exception.retry);
72
73 return err;
74}
75
76int nfs42_proc_allocate(struct file *filep, loff_t offset, loff_t len)
77{
78 struct rpc_message msg = {
79 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE],
80 };
81 struct inode *inode = file_inode(filep);
82 int err;
83
84 if (!nfs_server_capable(inode, NFS_CAP_ALLOCATE))
85 return -EOPNOTSUPP;
86
87 err = nfs42_proc_fallocate(&msg, filep, offset, len);
88 if (err == -EOPNOTSUPP)
89 NFS_SERVER(inode)->caps &= ~NFS_CAP_ALLOCATE;
90 return err;
91}
92
93int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len)
94{
95 struct rpc_message msg = {
96 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DEALLOCATE],
97 };
98 struct inode *inode = file_inode(filep);
99 int err;
100
101 if (!nfs_server_capable(inode, NFS_CAP_DEALLOCATE))
102 return -EOPNOTSUPP;
103
104 err = nfs42_proc_fallocate(&msg, filep, offset, len);
105 if (err == -EOPNOTSUPP)
106 NFS_SERVER(inode)->caps &= ~NFS_CAP_DEALLOCATE;
107 return err;
108}
109
35loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence) 110loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
36{ 111{
37 struct inode *inode = file_inode(filep); 112 struct inode *inode = file_inode(filep);
@@ -50,7 +125,7 @@ loff_t nfs42_proc_llseek(struct file *filep, loff_t offset, int whence)
50 struct nfs_server *server = NFS_SERVER(inode); 125 struct nfs_server *server = NFS_SERVER(inode);
51 int status; 126 int status;
52 127
53 if (!(server->caps & NFS_CAP_SEEK)) 128 if (!nfs_server_capable(inode, NFS_CAP_SEEK))
54 return -ENOTSUPP; 129 return -ENOTSUPP;
55 130
56 status = nfs42_set_rw_stateid(&args.sa_stateid, filep, FMODE_READ); 131 status = nfs42_set_rw_stateid(&args.sa_stateid, filep, FMODE_READ);
diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index c90469b604b8..038a7e1521fa 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -4,6 +4,15 @@
4#ifndef __LINUX_FS_NFS_NFS4_2XDR_H 4#ifndef __LINUX_FS_NFS_NFS4_2XDR_H
5#define __LINUX_FS_NFS_NFS4_2XDR_H 5#define __LINUX_FS_NFS_NFS4_2XDR_H
6 6
7#define encode_fallocate_maxsz (encode_stateid_maxsz + \
8 2 /* offset */ + \
9 2 /* length */)
10#define encode_allocate_maxsz (op_encode_hdr_maxsz + \
11 encode_fallocate_maxsz)
12#define decode_allocate_maxsz (op_decode_hdr_maxsz)
13#define encode_deallocate_maxsz (op_encode_hdr_maxsz + \
14 encode_fallocate_maxsz)
15#define decode_deallocate_maxsz (op_decode_hdr_maxsz)
7#define encode_seek_maxsz (op_encode_hdr_maxsz + \ 16#define encode_seek_maxsz (op_encode_hdr_maxsz + \
8 encode_stateid_maxsz + \ 17 encode_stateid_maxsz + \
9 2 /* offset */ + \ 18 2 /* offset */ + \
@@ -14,6 +23,18 @@
14 2 /* offset */ + \ 23 2 /* offset */ + \
15 2 /* length */) 24 2 /* length */)
16 25
26#define NFS4_enc_allocate_sz (compound_encode_hdr_maxsz + \
27 encode_putfh_maxsz + \
28 encode_allocate_maxsz)
29#define NFS4_dec_allocate_sz (compound_decode_hdr_maxsz + \
30 decode_putfh_maxsz + \
31 decode_allocate_maxsz)
32#define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \
33 encode_putfh_maxsz + \
34 encode_deallocate_maxsz)
35#define NFS4_dec_deallocate_sz (compound_decode_hdr_maxsz + \
36 decode_putfh_maxsz + \
37 decode_deallocate_maxsz)
17#define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \ 38#define NFS4_enc_seek_sz (compound_encode_hdr_maxsz + \
18 encode_putfh_maxsz + \ 39 encode_putfh_maxsz + \
19 encode_seek_maxsz) 40 encode_seek_maxsz)
@@ -22,6 +43,30 @@
22 decode_seek_maxsz) 43 decode_seek_maxsz)
23 44
24 45
46static void encode_fallocate(struct xdr_stream *xdr,
47 struct nfs42_falloc_args *args)
48{
49 encode_nfs4_stateid(xdr, &args->falloc_stateid);
50 encode_uint64(xdr, args->falloc_offset);
51 encode_uint64(xdr, args->falloc_length);
52}
53
54static void encode_allocate(struct xdr_stream *xdr,
55 struct nfs42_falloc_args *args,
56 struct compound_hdr *hdr)
57{
58 encode_op_hdr(xdr, OP_ALLOCATE, decode_allocate_maxsz, hdr);
59 encode_fallocate(xdr, args);
60}
61
62static void encode_deallocate(struct xdr_stream *xdr,
63 struct nfs42_falloc_args *args,
64 struct compound_hdr *hdr)
65{
66 encode_op_hdr(xdr, OP_DEALLOCATE, decode_deallocate_maxsz, hdr);
67 encode_fallocate(xdr, args);
68}
69
25static void encode_seek(struct xdr_stream *xdr, 70static void encode_seek(struct xdr_stream *xdr,
26 struct nfs42_seek_args *args, 71 struct nfs42_seek_args *args,
27 struct compound_hdr *hdr) 72 struct compound_hdr *hdr)
@@ -33,6 +78,42 @@ static void encode_seek(struct xdr_stream *xdr,
33} 78}
34 79
35/* 80/*
81 * Encode ALLOCATE request
82 */
83static void nfs4_xdr_enc_allocate(struct rpc_rqst *req,
84 struct xdr_stream *xdr,
85 struct nfs42_falloc_args *args)
86{
87 struct compound_hdr hdr = {
88 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
89 };
90
91 encode_compound_hdr(xdr, req, &hdr);
92 encode_sequence(xdr, &args->seq_args, &hdr);
93 encode_putfh(xdr, args->falloc_fh, &hdr);
94 encode_allocate(xdr, args, &hdr);
95 encode_nops(&hdr);
96}
97
98/*
99 * Encode DEALLOCATE request
100 */
101static void nfs4_xdr_enc_deallocate(struct rpc_rqst *req,
102 struct xdr_stream *xdr,
103 struct nfs42_falloc_args *args)
104{
105 struct compound_hdr hdr = {
106 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
107 };
108
109 encode_compound_hdr(xdr, req, &hdr);
110 encode_sequence(xdr, &args->seq_args, &hdr);
111 encode_putfh(xdr, args->falloc_fh, &hdr);
112 encode_deallocate(xdr, args, &hdr);
113 encode_nops(&hdr);
114}
115
116/*
36 * Encode SEEK request 117 * Encode SEEK request
37 */ 118 */
38static void nfs4_xdr_enc_seek(struct rpc_rqst *req, 119static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
@@ -50,6 +131,16 @@ static void nfs4_xdr_enc_seek(struct rpc_rqst *req,
50 encode_nops(&hdr); 131 encode_nops(&hdr);
51} 132}
52 133
134static int decode_allocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
135{
136 return decode_op_hdr(xdr, OP_ALLOCATE);
137}
138
139static int decode_deallocate(struct xdr_stream *xdr, struct nfs42_falloc_res *res)
140{
141 return decode_op_hdr(xdr, OP_DEALLOCATE);
142}
143
53static int decode_seek(struct xdr_stream *xdr, struct nfs42_seek_res *res) 144static int decode_seek(struct xdr_stream *xdr, struct nfs42_seek_res *res)
54{ 145{
55 int status; 146 int status;
@@ -73,6 +164,54 @@ out_overflow:
73} 164}
74 165
75/* 166/*
167 * Decode ALLOCATE request
168 */
169static int nfs4_xdr_dec_allocate(struct rpc_rqst *rqstp,
170 struct xdr_stream *xdr,
171 struct nfs42_falloc_res *res)
172{
173 struct compound_hdr hdr;
174 int status;
175
176 status = decode_compound_hdr(xdr, &hdr);
177 if (status)
178 goto out;
179 status = decode_sequence(xdr, &res->seq_res, rqstp);
180 if (status)
181 goto out;
182 status = decode_putfh(xdr);
183 if (status)
184 goto out;
185 status = decode_allocate(xdr, res);
186out:
187 return status;
188}
189
190/*
191 * Decode DEALLOCATE request
192 */
193static int nfs4_xdr_dec_deallocate(struct rpc_rqst *rqstp,
194 struct xdr_stream *xdr,
195 struct nfs42_falloc_res *res)
196{
197 struct compound_hdr hdr;
198 int status;
199
200 status = decode_compound_hdr(xdr, &hdr);
201 if (status)
202 goto out;
203 status = decode_sequence(xdr, &res->seq_res, rqstp);
204 if (status)
205 goto out;
206 status = decode_putfh(xdr);
207 if (status)
208 goto out;
209 status = decode_deallocate(xdr, res);
210out:
211 return status;
212}
213
214/*
76 * Decode SEEK request 215 * Decode SEEK request
77 */ 216 */
78static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp, 217static int nfs4_xdr_dec_seek(struct rpc_rqst *rqstp,
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index be6cac37ea10..a08178764cf9 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -226,6 +226,7 @@ int nfs4_replace_transport(struct nfs_server *server,
226 const struct nfs4_fs_locations *locations); 226 const struct nfs4_fs_locations *locations);
227 227
228/* nfs4proc.c */ 228/* nfs4proc.c */
229extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *);
229extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *, 230extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
230 struct rpc_message *, struct nfs4_sequence_args *, 231 struct rpc_message *, struct nfs4_sequence_args *,
231 struct nfs4_sequence_res *, int); 232 struct nfs4_sequence_res *, int);
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index ffdb28d86cf8..03311259b0c4 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -241,28 +241,25 @@ void nfs4_free_client(struct nfs_client *clp)
241 */ 241 */
242static int nfs4_init_callback(struct nfs_client *clp) 242static int nfs4_init_callback(struct nfs_client *clp)
243{ 243{
244 struct rpc_xprt *xprt;
244 int error; 245 int error;
245 246
246 if (clp->rpc_ops->version == 4) { 247 xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
247 struct rpc_xprt *xprt;
248 248
249 xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt); 249 if (nfs4_has_session(clp)) {
250 250 error = xprt_setup_backchannel(xprt, NFS41_BC_MIN_CALLBACKS);
251 if (nfs4_has_session(clp)) { 251 if (error < 0)
252 error = xprt_setup_backchannel(xprt,
253 NFS41_BC_MIN_CALLBACKS);
254 if (error < 0)
255 return error;
256 }
257
258 error = nfs_callback_up(clp->cl_mvops->minor_version, xprt);
259 if (error < 0) {
260 dprintk("%s: failed to start callback. Error = %d\n",
261 __func__, error);
262 return error; 252 return error;
263 }
264 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
265 } 253 }
254
255 error = nfs_callback_up(clp->cl_mvops->minor_version, xprt);
256 if (error < 0) {
257 dprintk("%s: failed to start callback. Error = %d\n",
258 __func__, error);
259 return error;
260 }
261 __set_bit(NFS_CS_CALLBACK, &clp->cl_res_state);
262
266 return 0; 263 return 0;
267} 264}
268 265
@@ -498,8 +495,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
498 atomic_inc(&pos->cl_count); 495 atomic_inc(&pos->cl_count);
499 spin_unlock(&nn->nfs_client_lock); 496 spin_unlock(&nn->nfs_client_lock);
500 497
501 if (prev) 498 nfs_put_client(prev);
502 nfs_put_client(prev);
503 prev = pos; 499 prev = pos;
504 500
505 status = nfs_wait_client_init_complete(pos); 501 status = nfs_wait_client_init_complete(pos);
@@ -517,8 +513,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
517 atomic_inc(&pos->cl_count); 513 atomic_inc(&pos->cl_count);
518 spin_unlock(&nn->nfs_client_lock); 514 spin_unlock(&nn->nfs_client_lock);
519 515
520 if (prev) 516 nfs_put_client(prev);
521 nfs_put_client(prev);
522 prev = pos; 517 prev = pos;
523 518
524 status = nfs4_proc_setclientid_confirm(pos, &clid, cred); 519 status = nfs4_proc_setclientid_confirm(pos, &clid, cred);
@@ -549,8 +544,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
549 544
550 /* No match found. The server lost our clientid */ 545 /* No match found. The server lost our clientid */
551out: 546out:
552 if (prev) 547 nfs_put_client(prev);
553 nfs_put_client(prev);
554 dprintk("NFS: <-- %s status = %d\n", __func__, status); 548 dprintk("NFS: <-- %s status = %d\n", __func__, status);
555 return status; 549 return status;
556} 550}
@@ -641,8 +635,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
641 atomic_inc(&pos->cl_count); 635 atomic_inc(&pos->cl_count);
642 spin_unlock(&nn->nfs_client_lock); 636 spin_unlock(&nn->nfs_client_lock);
643 637
644 if (prev) 638 nfs_put_client(prev);
645 nfs_put_client(prev);
646 prev = pos; 639 prev = pos;
647 640
648 status = nfs_wait_client_init_complete(pos); 641 status = nfs_wait_client_init_complete(pos);
@@ -675,8 +668,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
675 /* No matching nfs_client found. */ 668 /* No matching nfs_client found. */
676 spin_unlock(&nn->nfs_client_lock); 669 spin_unlock(&nn->nfs_client_lock);
677 dprintk("NFS: <-- %s status = %d\n", __func__, status); 670 dprintk("NFS: <-- %s status = %d\n", __func__, status);
678 if (prev) 671 nfs_put_client(prev);
679 nfs_put_client(prev);
680 return status; 672 return status;
681} 673}
682#endif /* CONFIG_NFS_V4_1 */ 674#endif /* CONFIG_NFS_V4_1 */
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index c51fb4db9bfe..8b46389c4c5b 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (C) 1992 Rick Sladkey 4 * Copyright (C) 1992 Rick Sladkey
5 */ 5 */
6#include <linux/fs.h>
7#include <linux/falloc.h>
6#include <linux/nfs_fs.h> 8#include <linux/nfs_fs.h>
7#include "internal.h" 9#include "internal.h"
8#include "fscache.h" 10#include "fscache.h"
@@ -134,6 +136,32 @@ static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence)
134 return nfs_file_llseek(filep, offset, whence); 136 return nfs_file_llseek(filep, offset, whence);
135 } 137 }
136} 138}
139
140static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t len)
141{
142 struct inode *inode = file_inode(filep);
143 long ret;
144
145 if (!S_ISREG(inode->i_mode))
146 return -EOPNOTSUPP;
147
148 if ((mode != 0) && (mode != (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE)))
149 return -EOPNOTSUPP;
150
151 ret = inode_newsize_ok(inode, offset + len);
152 if (ret < 0)
153 return ret;
154
155 mutex_lock(&inode->i_mutex);
156 if (mode & FALLOC_FL_PUNCH_HOLE)
157 ret = nfs42_proc_deallocate(filep, offset, len);
158 else
159 ret = nfs42_proc_allocate(filep, offset, len);
160 mutex_unlock(&inode->i_mutex);
161
162 nfs_zap_caches(inode);
163 return ret;
164}
137#endif /* CONFIG_NFS_V4_2 */ 165#endif /* CONFIG_NFS_V4_2 */
138 166
139const struct file_operations nfs4_file_operations = { 167const struct file_operations nfs4_file_operations = {
@@ -155,6 +183,9 @@ const struct file_operations nfs4_file_operations = {
155 .flock = nfs_flock, 183 .flock = nfs_flock,
156 .splice_read = nfs_file_splice_read, 184 .splice_read = nfs_file_splice_read,
157 .splice_write = iter_file_splice_write, 185 .splice_write = iter_file_splice_write,
186#ifdef CONFIG_NFS_V4_2
187 .fallocate = nfs42_fallocate,
188#endif /* CONFIG_NFS_V4_2 */
158 .check_flags = nfs_check_flags, 189 .check_flags = nfs_check_flags,
159 .setlease = simple_nosetlease, 190 .setlease = simple_nosetlease,
160}; 191};
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 69dc20a743f9..e7f8d5ff2581 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -158,8 +158,6 @@ static int nfs4_map_errors(int err)
158 return -EACCES; 158 return -EACCES;
159 case -NFS4ERR_MINOR_VERS_MISMATCH: 159 case -NFS4ERR_MINOR_VERS_MISMATCH:
160 return -EPROTONOSUPPORT; 160 return -EPROTONOSUPPORT;
161 case -NFS4ERR_ACCESS:
162 return -EACCES;
163 case -NFS4ERR_FILE_OPEN: 161 case -NFS4ERR_FILE_OPEN:
164 return -EBUSY; 162 return -EBUSY;
165 default: 163 default:
@@ -344,7 +342,7 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout)
344/* This is the error handling routine for processes that are allowed 342/* This is the error handling routine for processes that are allowed
345 * to sleep. 343 * to sleep.
346 */ 344 */
347static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_exception *exception) 345int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_exception *exception)
348{ 346{
349 struct nfs_client *clp = server->nfs_client; 347 struct nfs_client *clp = server->nfs_client;
350 struct nfs4_state *state = exception->state; 348 struct nfs4_state *state = exception->state;
@@ -7704,6 +7702,9 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
7704 7702
7705 dprintk("--> %s\n", __func__); 7703 dprintk("--> %s\n", __func__);
7706 7704
7705 /* nfs4_layoutget_release calls pnfs_put_layout_hdr */
7706 pnfs_get_layout_hdr(NFS_I(inode)->layout);
7707
7707 lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags); 7708 lgp->args.layout.pages = nfs4_alloc_pages(max_pages, gfp_flags);
7708 if (!lgp->args.layout.pages) { 7709 if (!lgp->args.layout.pages) {
7709 nfs4_layoutget_release(lgp); 7710 nfs4_layoutget_release(lgp);
@@ -7716,9 +7717,6 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, gfp_t gfp_flags)
7716 lgp->res.seq_res.sr_slot = NULL; 7717 lgp->res.seq_res.sr_slot = NULL;
7717 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0); 7718 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0);
7718 7719
7719 /* nfs4_layoutget_release calls pnfs_put_layout_hdr */
7720 pnfs_get_layout_hdr(NFS_I(inode)->layout);
7721
7722 task = rpc_run_task(&task_setup_data); 7720 task = rpc_run_task(&task_setup_data);
7723 if (IS_ERR(task)) 7721 if (IS_ERR(task))
7724 return ERR_CAST(task); 7722 return ERR_CAST(task);
@@ -8426,6 +8424,8 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
8426 | NFS_CAP_POSIX_LOCK 8424 | NFS_CAP_POSIX_LOCK
8427 | NFS_CAP_STATEID_NFSV41 8425 | NFS_CAP_STATEID_NFSV41
8428 | NFS_CAP_ATOMIC_OPEN_V1 8426 | NFS_CAP_ATOMIC_OPEN_V1
8427 | NFS_CAP_ALLOCATE
8428 | NFS_CAP_DEALLOCATE
8429 | NFS_CAP_SEEK, 8429 | NFS_CAP_SEEK,
8430 .init_client = nfs41_init_client, 8430 .init_client = nfs41_init_client,
8431 .shutdown_client = nfs41_shutdown_client, 8431 .shutdown_client = nfs41_shutdown_client,
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 206c08a60c7f..cb4376b78ed9 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -141,13 +141,15 @@ static int nfs4_stat_to_errno(int);
141 XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ 141 XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
142 XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \ 142 XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \
143 1 /* sc_prog */ + \ 143 1 /* sc_prog */ + \
144 XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ 144 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
145 XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \ 145 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
146 1) /* sc_cb_ident */ 146 1) /* sc_cb_ident */
147#define decode_setclientid_maxsz \ 147#define decode_setclientid_maxsz \
148 (op_decode_hdr_maxsz + \ 148 (op_decode_hdr_maxsz + \
149 2 + \ 149 2 /* clientid */ + \
150 1024) /* large value for CLID_INUSE */ 150 XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
151 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
152 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN))
151#define encode_setclientid_confirm_maxsz \ 153#define encode_setclientid_confirm_maxsz \
152 (op_encode_hdr_maxsz + \ 154 (op_encode_hdr_maxsz + \
153 3 + (NFS4_VERIFIER_SIZE >> 2)) 155 3 + (NFS4_VERIFIER_SIZE >> 2))
@@ -7394,6 +7396,8 @@ struct rpc_procinfo nfs4_procedures[] = {
7394#endif /* CONFIG_NFS_V4_1 */ 7396#endif /* CONFIG_NFS_V4_1 */
7395#ifdef CONFIG_NFS_V4_2 7397#ifdef CONFIG_NFS_V4_2
7396 PROC(SEEK, enc_seek, dec_seek), 7398 PROC(SEEK, enc_seek, dec_seek),
7399 PROC(ALLOCATE, enc_allocate, dec_allocate),
7400 PROC(DEALLOCATE, enc_deallocate, dec_deallocate),
7397#endif /* CONFIG_NFS_V4_2 */ 7401#endif /* CONFIG_NFS_V4_2 */
7398}; 7402};
7399 7403
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index ed0db61f8543..2b5e769beb16 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -258,6 +258,7 @@ bool nfs_page_group_sync_on_bit(struct nfs_page *req, unsigned int bit)
258static inline void 258static inline void
259nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev) 259nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev)
260{ 260{
261 struct inode *inode;
261 WARN_ON_ONCE(prev == req); 262 WARN_ON_ONCE(prev == req);
262 263
263 if (!prev) { 264 if (!prev) {
@@ -276,12 +277,16 @@ nfs_page_group_init(struct nfs_page *req, struct nfs_page *prev)
276 * nfs_page_group_destroy is called */ 277 * nfs_page_group_destroy is called */
277 kref_get(&req->wb_head->wb_kref); 278 kref_get(&req->wb_head->wb_kref);
278 279
279 /* grab extra ref if head request has extra ref from 280 /* grab extra ref and bump the request count if head request
280 * the write/commit path to handle handoff between write 281 * has extra ref from the write/commit path to handle handoff
281 * and commit lists */ 282 * between write and commit lists. */
282 if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) { 283 if (test_bit(PG_INODE_REF, &prev->wb_head->wb_flags)) {
284 inode = page_file_mapping(req->wb_page)->host;
283 set_bit(PG_INODE_REF, &req->wb_flags); 285 set_bit(PG_INODE_REF, &req->wb_flags);
284 kref_get(&req->wb_kref); 286 kref_get(&req->wb_kref);
287 spin_lock(&inode->i_lock);
288 NFS_I(inode)->nrequests++;
289 spin_unlock(&inode->i_lock);
285 } 290 }
286 } 291 }
287} 292}
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index beff2769c5c5..c91a4799c562 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -269,7 +269,7 @@ int nfs_readpage(struct file *file, struct page *page)
269 dprintk("NFS: nfs_readpage (%p %ld@%lu)\n", 269 dprintk("NFS: nfs_readpage (%p %ld@%lu)\n",
270 page, PAGE_CACHE_SIZE, page_file_index(page)); 270 page, PAGE_CACHE_SIZE, page_file_index(page));
271 nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); 271 nfs_inc_stats(inode, NFSIOS_VFSREADPAGE);
272 nfs_add_stats(inode, NFSIOS_READPAGES, 1); 272 nfs_inc_stats(inode, NFSIOS_READPAGES);
273 273
274 /* 274 /*
275 * Try to flush any pending writes to the file.. 275 * Try to flush any pending writes to the file..
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f83b02dc9166..af3af685a9e3 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -575,7 +575,7 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
575 int ret; 575 int ret;
576 576
577 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); 577 nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE);
578 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); 578 nfs_inc_stats(inode, NFSIOS_WRITEPAGES);
579 579
580 nfs_pageio_cond_complete(pgio, page_file_index(page)); 580 nfs_pageio_cond_complete(pgio, page_file_index(page));
581 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE); 581 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
@@ -670,7 +670,8 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
670 nfs_lock_request(req); 670 nfs_lock_request(req);
671 671
672 spin_lock(&inode->i_lock); 672 spin_lock(&inode->i_lock);
673 if (!nfsi->npages && NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE)) 673 if (!nfsi->nrequests &&
674 NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE))
674 inode->i_version++; 675 inode->i_version++;
675 /* 676 /*
676 * Swap-space should not get truncated. Hence no need to plug the race 677 * Swap-space should not get truncated. Hence no need to plug the race
@@ -681,9 +682,11 @@ static void nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
681 SetPagePrivate(req->wb_page); 682 SetPagePrivate(req->wb_page);
682 set_page_private(req->wb_page, (unsigned long)req); 683 set_page_private(req->wb_page, (unsigned long)req);
683 } 684 }
684 nfsi->npages++; 685 nfsi->nrequests++;
685 /* this a head request for a page group - mark it as having an 686 /* this a head request for a page group - mark it as having an
686 * extra reference so sub groups can follow suit */ 687 * extra reference so sub groups can follow suit.
688 * This flag also informs pgio layer when to bump nrequests when
689 * adding subrequests. */
687 WARN_ON(test_and_set_bit(PG_INODE_REF, &req->wb_flags)); 690 WARN_ON(test_and_set_bit(PG_INODE_REF, &req->wb_flags));
688 kref_get(&req->wb_kref); 691 kref_get(&req->wb_kref);
689 spin_unlock(&inode->i_lock); 692 spin_unlock(&inode->i_lock);
@@ -709,7 +712,11 @@ static void nfs_inode_remove_request(struct nfs_page *req)
709 wake_up_page(head->wb_page, PG_private); 712 wake_up_page(head->wb_page, PG_private);
710 clear_bit(PG_MAPPED, &head->wb_flags); 713 clear_bit(PG_MAPPED, &head->wb_flags);
711 } 714 }
712 nfsi->npages--; 715 nfsi->nrequests--;
716 spin_unlock(&inode->i_lock);
717 } else {
718 spin_lock(&inode->i_lock);
719 nfsi->nrequests--;
713 spin_unlock(&inode->i_lock); 720 spin_unlock(&inode->i_lock);
714 } 721 }
715 722
@@ -1735,7 +1742,7 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr
1735 /* Don't commit yet if this is a non-blocking flush and there 1742 /* Don't commit yet if this is a non-blocking flush and there
1736 * are a lot of outstanding writes for this mapping. 1743 * are a lot of outstanding writes for this mapping.
1737 */ 1744 */
1738 if (nfsi->commit_info.ncommit <= (nfsi->npages >> 1)) 1745 if (nfsi->commit_info.ncommit <= (nfsi->nrequests >> 1))
1739 goto out_mark_dirty; 1746 goto out_mark_dirty;
1740 1747
1741 /* don't wait for the COMMIT response */ 1748 /* don't wait for the COMMIT response */
diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig
index e60125976873..34355818a2e0 100644
--- a/fs/overlayfs/Kconfig
+++ b/fs/overlayfs/Kconfig
@@ -1,4 +1,4 @@
1config OVERLAYFS_FS 1config OVERLAY_FS
2 tristate "Overlay filesystem support" 2 tristate "Overlay filesystem support"
3 help 3 help
4 An overlay filesystem combines two filesystems - an 'upper' filesystem 4 An overlay filesystem combines two filesystems - an 'upper' filesystem
diff --git a/fs/overlayfs/Makefile b/fs/overlayfs/Makefile
index 8f91889480d0..900daed3e91d 100644
--- a/fs/overlayfs/Makefile
+++ b/fs/overlayfs/Makefile
@@ -2,6 +2,6 @@
2# Makefile for the overlay filesystem. 2# Makefile for the overlay filesystem.
3# 3#
4 4
5obj-$(CONFIG_OVERLAYFS_FS) += overlayfs.o 5obj-$(CONFIG_OVERLAY_FS) += overlay.o
6 6
7overlayfs-objs := super.o inode.o dir.o readdir.o copy_up.o 7overlay-objs := super.o inode.o dir.o readdir.o copy_up.o
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 15cd91ad9940..8ffc4b980f1b 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -284,8 +284,7 @@ out:
284 return ERR_PTR(err); 284 return ERR_PTR(err);
285} 285}
286 286
287static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry, 287static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry)
288 enum ovl_path_type type)
289{ 288{
290 int err; 289 int err;
291 struct dentry *ret = NULL; 290 struct dentry *ret = NULL;
@@ -294,8 +293,17 @@ static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry,
294 err = ovl_check_empty_dir(dentry, &list); 293 err = ovl_check_empty_dir(dentry, &list);
295 if (err) 294 if (err)
296 ret = ERR_PTR(err); 295 ret = ERR_PTR(err);
297 else if (type == OVL_PATH_MERGE) 296 else {
298 ret = ovl_clear_empty(dentry, &list); 297 /*
298 * If no upperdentry then skip clearing whiteouts.
299 *
300 * Can race with copy-up, since we don't hold the upperdir
301 * mutex. Doesn't matter, since copy-up can't create a
302 * non-empty directory from an empty one.
303 */
304 if (ovl_dentry_upper(dentry))
305 ret = ovl_clear_empty(dentry, &list);
306 }
299 307
300 ovl_cache_free(&list); 308 ovl_cache_free(&list);
301 309
@@ -487,8 +495,7 @@ out:
487 return err; 495 return err;
488} 496}
489 497
490static int ovl_remove_and_whiteout(struct dentry *dentry, 498static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir)
491 enum ovl_path_type type, bool is_dir)
492{ 499{
493 struct dentry *workdir = ovl_workdir(dentry); 500 struct dentry *workdir = ovl_workdir(dentry);
494 struct inode *wdir = workdir->d_inode; 501 struct inode *wdir = workdir->d_inode;
@@ -500,7 +507,7 @@ static int ovl_remove_and_whiteout(struct dentry *dentry,
500 int err; 507 int err;
501 508
502 if (is_dir) { 509 if (is_dir) {
503 opaquedir = ovl_check_empty_and_clear(dentry, type); 510 opaquedir = ovl_check_empty_and_clear(dentry);
504 err = PTR_ERR(opaquedir); 511 err = PTR_ERR(opaquedir);
505 if (IS_ERR(opaquedir)) 512 if (IS_ERR(opaquedir))
506 goto out; 513 goto out;
@@ -515,9 +522,10 @@ static int ovl_remove_and_whiteout(struct dentry *dentry,
515 if (IS_ERR(whiteout)) 522 if (IS_ERR(whiteout))
516 goto out_unlock; 523 goto out_unlock;
517 524
518 if (type == OVL_PATH_LOWER) { 525 upper = ovl_dentry_upper(dentry);
526 if (!upper) {
519 upper = lookup_one_len(dentry->d_name.name, upperdir, 527 upper = lookup_one_len(dentry->d_name.name, upperdir,
520 dentry->d_name.len); 528 dentry->d_name.len);
521 err = PTR_ERR(upper); 529 err = PTR_ERR(upper);
522 if (IS_ERR(upper)) 530 if (IS_ERR(upper))
523 goto kill_whiteout; 531 goto kill_whiteout;
@@ -529,7 +537,6 @@ static int ovl_remove_and_whiteout(struct dentry *dentry,
529 } else { 537 } else {
530 int flags = 0; 538 int flags = 0;
531 539
532 upper = ovl_dentry_upper(dentry);
533 if (opaquedir) 540 if (opaquedir)
534 upper = opaquedir; 541 upper = opaquedir;
535 err = -ESTALE; 542 err = -ESTALE;
@@ -648,7 +655,7 @@ static int ovl_do_remove(struct dentry *dentry, bool is_dir)
648 cap_raise(override_cred->cap_effective, CAP_CHOWN); 655 cap_raise(override_cred->cap_effective, CAP_CHOWN);
649 old_cred = override_creds(override_cred); 656 old_cred = override_creds(override_cred);
650 657
651 err = ovl_remove_and_whiteout(dentry, type, is_dir); 658 err = ovl_remove_and_whiteout(dentry, is_dir);
652 659
653 revert_creds(old_cred); 660 revert_creds(old_cred);
654 put_cred(override_cred); 661 put_cred(override_cred);
@@ -781,7 +788,7 @@ static int ovl_rename2(struct inode *olddir, struct dentry *old,
781 } 788 }
782 789
783 if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) { 790 if (overwrite && (new_type == OVL_PATH_LOWER || new_type == OVL_PATH_MERGE) && new_is_dir) {
784 opaquedir = ovl_check_empty_and_clear(new, new_type); 791 opaquedir = ovl_check_empty_and_clear(new);
785 err = PTR_ERR(opaquedir); 792 err = PTR_ERR(opaquedir);
786 if (IS_ERR(opaquedir)) { 793 if (IS_ERR(opaquedir)) {
787 opaquedir = NULL; 794 opaquedir = NULL;
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index af2d18c9fcee..07d74b24913b 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -235,26 +235,36 @@ out:
235 return err; 235 return err;
236} 236}
237 237
238static bool ovl_need_xattr_filter(struct dentry *dentry,
239 enum ovl_path_type type)
240{
241 return type == OVL_PATH_UPPER && S_ISDIR(dentry->d_inode->i_mode);
242}
243
238ssize_t ovl_getxattr(struct dentry *dentry, const char *name, 244ssize_t ovl_getxattr(struct dentry *dentry, const char *name,
239 void *value, size_t size) 245 void *value, size_t size)
240{ 246{
241 if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && 247 struct path realpath;
242 ovl_is_private_xattr(name)) 248 enum ovl_path_type type = ovl_path_real(dentry, &realpath);
249
250 if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
243 return -ENODATA; 251 return -ENODATA;
244 252
245 return vfs_getxattr(ovl_dentry_real(dentry), name, value, size); 253 return vfs_getxattr(realpath.dentry, name, value, size);
246} 254}
247 255
248ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) 256ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)
249{ 257{
258 struct path realpath;
259 enum ovl_path_type type = ovl_path_real(dentry, &realpath);
250 ssize_t res; 260 ssize_t res;
251 int off; 261 int off;
252 262
253 res = vfs_listxattr(ovl_dentry_real(dentry), list, size); 263 res = vfs_listxattr(realpath.dentry, list, size);
254 if (res <= 0 || size == 0) 264 if (res <= 0 || size == 0)
255 return res; 265 return res;
256 266
257 if (ovl_path_type(dentry->d_parent) != OVL_PATH_MERGE) 267 if (!ovl_need_xattr_filter(dentry, type))
258 return res; 268 return res;
259 269
260 /* filter out private xattrs */ 270 /* filter out private xattrs */
@@ -279,17 +289,16 @@ int ovl_removexattr(struct dentry *dentry, const char *name)
279{ 289{
280 int err; 290 int err;
281 struct path realpath; 291 struct path realpath;
282 enum ovl_path_type type; 292 enum ovl_path_type type = ovl_path_real(dentry, &realpath);
283 293
284 err = ovl_want_write(dentry); 294 err = ovl_want_write(dentry);
285 if (err) 295 if (err)
286 goto out; 296 goto out;
287 297
288 if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && 298 err = -ENODATA;
289 ovl_is_private_xattr(name)) 299 if (ovl_need_xattr_filter(dentry, type) && ovl_is_private_xattr(name))
290 goto out_drop_write; 300 goto out_drop_write;
291 301
292 type = ovl_path_real(dentry, &realpath);
293 if (type == OVL_PATH_LOWER) { 302 if (type == OVL_PATH_LOWER) {
294 err = vfs_getxattr(realpath.dentry, name, NULL, 0); 303 err = vfs_getxattr(realpath.dentry, name, NULL, 0);
295 if (err < 0) 304 if (err < 0)
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 2a7ef4f8e2a6..ab1e3dcbed95 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -274,11 +274,11 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir,
274 return 0; 274 return 0;
275} 275}
276 276
277static inline int ovl_dir_read_merged(struct path *upperpath, 277static int ovl_dir_read_merged(struct dentry *dentry, struct list_head *list)
278 struct path *lowerpath,
279 struct list_head *list)
280{ 278{
281 int err; 279 int err;
280 struct path lowerpath;
281 struct path upperpath;
282 struct ovl_readdir_data rdd = { 282 struct ovl_readdir_data rdd = {
283 .ctx.actor = ovl_fill_merge, 283 .ctx.actor = ovl_fill_merge,
284 .list = list, 284 .list = list,
@@ -286,25 +286,28 @@ static inline int ovl_dir_read_merged(struct path *upperpath,
286 .is_merge = false, 286 .is_merge = false,
287 }; 287 };
288 288
289 if (upperpath->dentry) { 289 ovl_path_lower(dentry, &lowerpath);
290 err = ovl_dir_read(upperpath, &rdd); 290 ovl_path_upper(dentry, &upperpath);
291
292 if (upperpath.dentry) {
293 err = ovl_dir_read(&upperpath, &rdd);
291 if (err) 294 if (err)
292 goto out; 295 goto out;
293 296
294 if (lowerpath->dentry) { 297 if (lowerpath.dentry) {
295 err = ovl_dir_mark_whiteouts(upperpath->dentry, &rdd); 298 err = ovl_dir_mark_whiteouts(upperpath.dentry, &rdd);
296 if (err) 299 if (err)
297 goto out; 300 goto out;
298 } 301 }
299 } 302 }
300 if (lowerpath->dentry) { 303 if (lowerpath.dentry) {
301 /* 304 /*
302 * Insert lowerpath entries before upperpath ones, this allows 305 * Insert lowerpath entries before upperpath ones, this allows
303 * offsets to be reasonably constant 306 * offsets to be reasonably constant
304 */ 307 */
305 list_add(&rdd.middle, rdd.list); 308 list_add(&rdd.middle, rdd.list);
306 rdd.is_merge = true; 309 rdd.is_merge = true;
307 err = ovl_dir_read(lowerpath, &rdd); 310 err = ovl_dir_read(&lowerpath, &rdd);
308 list_del(&rdd.middle); 311 list_del(&rdd.middle);
309 } 312 }
310out: 313out:
@@ -329,8 +332,6 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos)
329static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry) 332static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry)
330{ 333{
331 int res; 334 int res;
332 struct path lowerpath;
333 struct path upperpath;
334 struct ovl_dir_cache *cache; 335 struct ovl_dir_cache *cache;
335 336
336 cache = ovl_dir_cache(dentry); 337 cache = ovl_dir_cache(dentry);
@@ -347,10 +348,7 @@ static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry)
347 cache->refcount = 1; 348 cache->refcount = 1;
348 INIT_LIST_HEAD(&cache->entries); 349 INIT_LIST_HEAD(&cache->entries);
349 350
350 ovl_path_lower(dentry, &lowerpath); 351 res = ovl_dir_read_merged(dentry, &cache->entries);
351 ovl_path_upper(dentry, &upperpath);
352
353 res = ovl_dir_read_merged(&upperpath, &lowerpath, &cache->entries);
354 if (res) { 352 if (res) {
355 ovl_cache_free(&cache->entries); 353 ovl_cache_free(&cache->entries);
356 kfree(cache); 354 kfree(cache);
@@ -452,10 +450,10 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end,
452 /* 450 /*
453 * Need to check if we started out being a lower dir, but got copied up 451 * Need to check if we started out being a lower dir, but got copied up
454 */ 452 */
455 if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { 453 if (!od->is_upper && ovl_path_type(dentry) != OVL_PATH_LOWER) {
456 struct inode *inode = file_inode(file); 454 struct inode *inode = file_inode(file);
457 455
458 realfile =lockless_dereference(od->upperfile); 456 realfile = lockless_dereference(od->upperfile);
459 if (!realfile) { 457 if (!realfile) {
460 struct path upperpath; 458 struct path upperpath;
461 459
@@ -538,14 +536,9 @@ const struct file_operations ovl_dir_operations = {
538int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) 536int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list)
539{ 537{
540 int err; 538 int err;
541 struct path lowerpath;
542 struct path upperpath;
543 struct ovl_cache_entry *p; 539 struct ovl_cache_entry *p;
544 540
545 ovl_path_upper(dentry, &upperpath); 541 err = ovl_dir_read_merged(dentry, list);
546 ovl_path_lower(dentry, &lowerpath);
547
548 err = ovl_dir_read_merged(&upperpath, &lowerpath, list);
549 if (err) 542 if (err)
550 return err; 543 return err;
551 544
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 08b704cebfc4..f16d318b71f8 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -24,7 +24,7 @@ MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
24MODULE_DESCRIPTION("Overlay filesystem"); 24MODULE_DESCRIPTION("Overlay filesystem");
25MODULE_LICENSE("GPL"); 25MODULE_LICENSE("GPL");
26 26
27#define OVERLAYFS_SUPER_MAGIC 0x794c764f 27#define OVERLAYFS_SUPER_MAGIC 0x794c7630
28 28
29struct ovl_config { 29struct ovl_config {
30 char *lowerdir; 30 char *lowerdir;
@@ -84,12 +84,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentry)
84 84
85static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) 85static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe)
86{ 86{
87 struct dentry *upperdentry = ACCESS_ONCE(oe->__upperdentry); 87 return lockless_dereference(oe->__upperdentry);
88 /*
89 * Make sure to order reads to upperdentry wrt ovl_dentry_update()
90 */
91 smp_read_barrier_depends();
92 return upperdentry;
93} 88}
94 89
95void ovl_path_upper(struct dentry *dentry, struct path *path) 90void ovl_path_upper(struct dentry *dentry, struct path *path)
@@ -462,11 +457,34 @@ static const match_table_t ovl_tokens = {
462 {OPT_ERR, NULL} 457 {OPT_ERR, NULL}
463}; 458};
464 459
460static char *ovl_next_opt(char **s)
461{
462 char *sbegin = *s;
463 char *p;
464
465 if (sbegin == NULL)
466 return NULL;
467
468 for (p = sbegin; *p; p++) {
469 if (*p == '\\') {
470 p++;
471 if (!*p)
472 break;
473 } else if (*p == ',') {
474 *p = '\0';
475 *s = p + 1;
476 return sbegin;
477 }
478 }
479 *s = NULL;
480 return sbegin;
481}
482
465static int ovl_parse_opt(char *opt, struct ovl_config *config) 483static int ovl_parse_opt(char *opt, struct ovl_config *config)
466{ 484{
467 char *p; 485 char *p;
468 486
469 while ((p = strsep(&opt, ",")) != NULL) { 487 while ((p = ovl_next_opt(&opt)) != NULL) {
470 int token; 488 int token;
471 substring_t args[MAX_OPT_ARGS]; 489 substring_t args[MAX_OPT_ARGS];
472 490
@@ -554,15 +572,34 @@ out_dput:
554 goto out_unlock; 572 goto out_unlock;
555} 573}
556 574
575static void ovl_unescape(char *s)
576{
577 char *d = s;
578
579 for (;; s++, d++) {
580 if (*s == '\\')
581 s++;
582 *d = *s;
583 if (!*s)
584 break;
585 }
586}
587
557static int ovl_mount_dir(const char *name, struct path *path) 588static int ovl_mount_dir(const char *name, struct path *path)
558{ 589{
559 int err; 590 int err;
591 char *tmp = kstrdup(name, GFP_KERNEL);
592
593 if (!tmp)
594 return -ENOMEM;
560 595
561 err = kern_path(name, LOOKUP_FOLLOW, path); 596 ovl_unescape(tmp);
597 err = kern_path(tmp, LOOKUP_FOLLOW, path);
562 if (err) { 598 if (err) {
563 pr_err("overlayfs: failed to resolve '%s': %i\n", name, err); 599 pr_err("overlayfs: failed to resolve '%s': %i\n", tmp, err);
564 err = -EINVAL; 600 err = -EINVAL;
565 } 601 }
602 kfree(tmp);
566 return err; 603 return err;
567} 604}
568 605
@@ -776,11 +813,11 @@ static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags,
776 813
777static struct file_system_type ovl_fs_type = { 814static struct file_system_type ovl_fs_type = {
778 .owner = THIS_MODULE, 815 .owner = THIS_MODULE,
779 .name = "overlayfs", 816 .name = "overlay",
780 .mount = ovl_mount, 817 .mount = ovl_mount,
781 .kill_sb = kill_anon_super, 818 .kill_sb = kill_anon_super,
782}; 819};
783MODULE_ALIAS_FS("overlayfs"); 820MODULE_ALIAS_FS("overlay");
784 821
785static int __init ovl_init(void) 822static int __init ovl_init(void)
786{ 823{
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index be5fd38bd5a0..5d858e02997f 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -18,8 +18,11 @@
18 * position @h. For example 18 * position @h. For example
19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
20 */ 20 */
21#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) 21#define GENMASK(h, l) \
22#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) 22 (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
23
24#define GENMASK_ULL(h, l) \
25 (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h))))
23 26
24extern unsigned int __sw_hweight8(unsigned int w); 27extern unsigned int __sw_hweight8(unsigned int w);
25extern unsigned int __sw_hweight16(unsigned int w); 28extern unsigned int __sw_hweight16(unsigned int w);
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 6992afc6ba7f..b37ea95bc348 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -99,6 +99,12 @@ inval_skb:
99 return 1; 99 return 1;
100} 100}
101 101
102static inline bool can_is_canfd_skb(const struct sk_buff *skb)
103{
104 /* the CAN specific type of skb is identified by its data length */
105 return skb->len == CANFD_MTU;
106}
107
102/* get data length from can_dlc with sanitized can_dlc */ 108/* get data length from can_dlc with sanitized can_dlc */
103u8 can_dlc2len(u8 can_dlc); 109u8 can_dlc2len(u8 can_dlc);
104 110
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 0068708161ff..0a21fbefdfbe 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -242,7 +242,7 @@ static inline void in_dev_put(struct in_device *idev)
242static __inline__ __be32 inet_make_mask(int logmask) 242static __inline__ __be32 inet_make_mask(int logmask)
243{ 243{
244 if (logmask) 244 if (logmask)
245 return htonl(~((1<<(32-logmask))-1)); 245 return htonl(~((1U<<(32-logmask))-1));
246 return 0; 246 return 0;
247} 247}
248 248
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 8422b4ed6882..b9376cd5a187 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -77,11 +77,6 @@ static inline unsigned int kstat_cpu_irqs_sum(unsigned int cpu)
77 return kstat_cpu(cpu).irqs_sum; 77 return kstat_cpu(cpu).irqs_sum;
78} 78}
79 79
80/*
81 * Lock/unlock the current runqueue - to extract task statistics:
82 */
83extern unsigned long long task_delta_exec(struct task_struct *);
84
85extern void account_user_time(struct task_struct *, cputime_t, cputime_t); 80extern void account_user_time(struct task_struct *, cputime_t, cputime_t);
86extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); 81extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t);
87extern void account_steal_time(cputime_t); 82extern void account_steal_time(cputime_t);
diff --git a/include/linux/lockd/debug.h b/include/linux/lockd/debug.h
index 257d3779f2ab..0ca8109934e4 100644
--- a/include/linux/lockd/debug.h
+++ b/include/linux/lockd/debug.h
@@ -17,12 +17,8 @@
17 * Enable lockd debugging. 17 * Enable lockd debugging.
18 * Requires RPC_DEBUG. 18 * Requires RPC_DEBUG.
19 */ 19 */
20#ifdef RPC_DEBUG
21# define LOCKD_DEBUG 1
22#endif
23
24#undef ifdebug 20#undef ifdebug
25#if defined(RPC_DEBUG) && defined(LOCKD_DEBUG) 21#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
26# define ifdebug(flag) if (unlikely(nlm_debug & NLMDBG_##flag)) 22# define ifdebug(flag) if (unlikely(nlm_debug & NLMDBG_##flag))
27#else 23#else
28# define ifdebug(flag) if (0) 24# define ifdebug(flag) if (0)
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 356acc2846fd..022b761dbf0a 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -490,6 +490,8 @@ enum {
490 490
491 /* nfs42 */ 491 /* nfs42 */
492 NFSPROC4_CLNT_SEEK, 492 NFSPROC4_CLNT_SEEK,
493 NFSPROC4_CLNT_ALLOCATE,
494 NFSPROC4_CLNT_DEALLOCATE,
493}; 495};
494 496
495/* nfs41 types */ 497/* nfs41 types */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c72d1ad41ad4..6d627b92df53 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -163,7 +163,7 @@ struct nfs_inode {
163 */ 163 */
164 __be32 cookieverf[2]; 164 __be32 cookieverf[2];
165 165
166 unsigned long npages; 166 unsigned long nrequests;
167 struct nfs_mds_commit_info commit_info; 167 struct nfs_mds_commit_info commit_info;
168 168
169 /* Open contexts for shared mmap writes */ 169 /* Open contexts for shared mmap writes */
@@ -520,7 +520,7 @@ extern void nfs_commit_free(struct nfs_commit_data *data);
520static inline int 520static inline int
521nfs_have_writebacks(struct inode *inode) 521nfs_have_writebacks(struct inode *inode)
522{ 522{
523 return NFS_I(inode)->npages != 0; 523 return NFS_I(inode)->nrequests != 0;
524} 524}
525 525
526/* 526/*
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index a32ba0d7a98f..1e37fbb78f7a 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -231,5 +231,7 @@ struct nfs_server {
231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 231#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
232#define NFS_CAP_SECURITY_LABEL (1U << 18) 232#define NFS_CAP_SECURITY_LABEL (1U << 18)
233#define NFS_CAP_SEEK (1U << 19) 233#define NFS_CAP_SEEK (1U << 19)
234#define NFS_CAP_ALLOCATE (1U << 20)
235#define NFS_CAP_DEALLOCATE (1U << 21)
234 236
235#endif 237#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 47ebb4fafd87..467c84efb596 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1243,6 +1243,20 @@ nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
1243#endif /* CONFIG_NFS_V4_1 */ 1243#endif /* CONFIG_NFS_V4_1 */
1244 1244
1245#ifdef CONFIG_NFS_V4_2 1245#ifdef CONFIG_NFS_V4_2
1246struct nfs42_falloc_args {
1247 struct nfs4_sequence_args seq_args;
1248
1249 struct nfs_fh *falloc_fh;
1250 nfs4_stateid falloc_stateid;
1251 u64 falloc_offset;
1252 u64 falloc_length;
1253};
1254
1255struct nfs42_falloc_res {
1256 struct nfs4_sequence_res seq_res;
1257 unsigned int status;
1258};
1259
1246struct nfs42_seek_args { 1260struct nfs42_seek_args {
1247 struct nfs4_sequence_args seq_args; 1261 struct nfs4_sequence_args seq_args;
1248 1262
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index d5c89e0dd0e6..51ce60c35f4c 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -133,7 +133,13 @@ static inline bool __ref_is_percpu(struct percpu_ref *ref,
133 /* paired with smp_store_release() in percpu_ref_reinit() */ 133 /* paired with smp_store_release() in percpu_ref_reinit() */
134 smp_read_barrier_depends(); 134 smp_read_barrier_depends();
135 135
136 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC)) 136 /*
137 * Theoretically, the following could test just ATOMIC; however,
138 * then we'd have to mask off DEAD separately as DEAD may be
139 * visible without ATOMIC if we race with percpu_ref_kill(). DEAD
140 * implies ATOMIC anyway. Test them together.
141 */
142 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC_DEAD))
137 return false; 143 return false;
138 144
139 *percpu_countp = (unsigned long __percpu *)percpu_ptr; 145 *percpu_countp = (unsigned long __percpu *)percpu_ptr;
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 8e030075fe79..a7cbb570cc5c 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -53,7 +53,7 @@ struct rpc_cred {
53 struct rcu_head cr_rcu; 53 struct rcu_head cr_rcu;
54 struct rpc_auth * cr_auth; 54 struct rpc_auth * cr_auth;
55 const struct rpc_credops *cr_ops; 55 const struct rpc_credops *cr_ops;
56#ifdef RPC_DEBUG 56#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
57 unsigned long cr_magic; /* 0x0f4aa4f0 */ 57 unsigned long cr_magic; /* 0x0f4aa4f0 */
58#endif 58#endif
59 unsigned long cr_expire; /* when to gc */ 59 unsigned long cr_expire; /* when to gc */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 70736b98c721..d86acc63b25f 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -63,6 +63,9 @@ struct rpc_clnt {
63 struct rpc_rtt cl_rtt_default; 63 struct rpc_rtt cl_rtt_default;
64 struct rpc_timeout cl_timeout_default; 64 struct rpc_timeout cl_timeout_default;
65 const struct rpc_program *cl_program; 65 const struct rpc_program *cl_program;
66#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
67 struct dentry *cl_debugfs; /* debugfs directory */
68#endif
66}; 69};
67 70
68/* 71/*
@@ -176,5 +179,6 @@ size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
176const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 179const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
177int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t); 180int rpc_localaddr(struct rpc_clnt *, struct sockaddr *, size_t);
178 181
182const char *rpc_proc_name(const struct rpc_task *task);
179#endif /* __KERNEL__ */ 183#endif /* __KERNEL__ */
180#endif /* _LINUX_SUNRPC_CLNT_H */ 184#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 9385bd74c860..c57d8ea0716c 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -10,22 +10,10 @@
10 10
11#include <uapi/linux/sunrpc/debug.h> 11#include <uapi/linux/sunrpc/debug.h>
12 12
13
14/*
15 * Enable RPC debugging/profiling.
16 */
17#ifdef CONFIG_SUNRPC_DEBUG
18#define RPC_DEBUG
19#endif
20#ifdef CONFIG_TRACEPOINTS
21#define RPC_TRACEPOINTS
22#endif
23/* #define RPC_PROFILE */
24
25/* 13/*
26 * Debugging macros etc 14 * Debugging macros etc
27 */ 15 */
28#ifdef RPC_DEBUG 16#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
29extern unsigned int rpc_debug; 17extern unsigned int rpc_debug;
30extern unsigned int nfs_debug; 18extern unsigned int nfs_debug;
31extern unsigned int nfsd_debug; 19extern unsigned int nfsd_debug;
@@ -36,7 +24,7 @@ extern unsigned int nlm_debug;
36#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args) 24#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
37 25
38#undef ifdebug 26#undef ifdebug
39#ifdef RPC_DEBUG 27#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
40# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) 28# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
41 29
42# define dfprintk(fac, args...) \ 30# define dfprintk(fac, args...) \
@@ -65,9 +53,55 @@ extern unsigned int nlm_debug;
65/* 53/*
66 * Sysctl interface for RPC debugging 54 * Sysctl interface for RPC debugging
67 */ 55 */
68#ifdef RPC_DEBUG 56
57struct rpc_clnt;
58struct rpc_xprt;
59
60#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
69void rpc_register_sysctl(void); 61void rpc_register_sysctl(void);
70void rpc_unregister_sysctl(void); 62void rpc_unregister_sysctl(void);
63int sunrpc_debugfs_init(void);
64void sunrpc_debugfs_exit(void);
65int rpc_clnt_debugfs_register(struct rpc_clnt *);
66void rpc_clnt_debugfs_unregister(struct rpc_clnt *);
67int rpc_xprt_debugfs_register(struct rpc_xprt *);
68void rpc_xprt_debugfs_unregister(struct rpc_xprt *);
69#else
70static inline int
71sunrpc_debugfs_init(void)
72{
73 return 0;
74}
75
76static inline void
77sunrpc_debugfs_exit(void)
78{
79 return;
80}
81
82static inline int
83rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
84{
85 return 0;
86}
87
88static inline void
89rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
90{
91 return;
92}
93
94static inline int
95rpc_xprt_debugfs_register(struct rpc_xprt *xprt)
96{
97 return 0;
98}
99
100static inline void
101rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt)
102{
103 return;
104}
71#endif 105#endif
72 106
73#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 107#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 1565bbe86d51..eecb5a71e6c0 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -27,10 +27,13 @@
27 27
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/ktime.h> 29#include <linux/ktime.h>
30#include <linux/spinlock.h>
30 31
31#define RPC_IOSTATS_VERS "1.0" 32#define RPC_IOSTATS_VERS "1.0"
32 33
33struct rpc_iostats { 34struct rpc_iostats {
35 spinlock_t om_lock;
36
34 /* 37 /*
35 * These counters give an idea about how many request 38 * These counters give an idea about how many request
36 * transmissions are required, on average, to complete that 39 * transmissions are required, on average, to complete that
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 1a8959944c5f..5f1e6bd4c316 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -79,7 +79,7 @@ struct rpc_task {
79 unsigned short tk_flags; /* misc flags */ 79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */ 80 unsigned short tk_timeouts; /* maj timeouts */
81 81
82#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) 82#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
83 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
84#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */ 85 unsigned char tk_priority : 2,/* Task priority */
@@ -187,7 +187,7 @@ struct rpc_wait_queue {
187 unsigned char nr; /* # tasks remaining for cookie */ 187 unsigned char nr; /* # tasks remaining for cookie */
188 unsigned short qlen; /* total # tasks waiting in queue */ 188 unsigned short qlen; /* total # tasks waiting in queue */
189 struct rpc_timer timer_list; 189 struct rpc_timer timer_list;
190#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) 190#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
191 const char * name; 191 const char * name;
192#endif 192#endif
193}; 193};
@@ -237,7 +237,7 @@ void rpc_free(void *);
237int rpciod_up(void); 237int rpciod_up(void);
238void rpciod_down(void); 238void rpciod_down(void);
239int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *); 239int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *);
240#ifdef RPC_DEBUG 240#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
241struct net; 241struct net;
242void rpc_show_tasks(struct net *); 242void rpc_show_tasks(struct net *);
243#endif 243#endif
@@ -251,7 +251,7 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task)
251 return __rpc_wait_for_completion_task(task, NULL); 251 return __rpc_wait_for_completion_task(task, NULL);
252} 252}
253 253
254#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) 254#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
255static inline const char * rpc_qname(const struct rpc_wait_queue *q) 255static inline const char * rpc_qname(const struct rpc_wait_queue *q)
256{ 256{
257 return ((q && q->name) ? q->name : "unknown"); 257 return ((q && q->name) ? q->name : "unknown");
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index cf391eef2e6d..9d27ac45b909 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -239,6 +239,9 @@ struct rpc_xprt {
239 struct net *xprt_net; 239 struct net *xprt_net;
240 const char *servername; 240 const char *servername;
241 const char *address_strings[RPC_DISPLAY_MAX]; 241 const char *address_strings[RPC_DISPLAY_MAX];
242#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
243 struct dentry *debugfs; /* debugfs directory */
244#endif
242}; 245};
243 246
244#if defined(CONFIG_SUNRPC_BACKCHANNEL) 247#if defined(CONFIG_SUNRPC_BACKCHANNEL)
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 1ad36cc25b2e..7591788e9fbf 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -17,6 +17,65 @@ void cleanup_socket_xprt(void);
17#define RPC_DEF_MIN_RESVPORT (665U) 17#define RPC_DEF_MIN_RESVPORT (665U)
18#define RPC_DEF_MAX_RESVPORT (1023U) 18#define RPC_DEF_MAX_RESVPORT (1023U)
19 19
20struct sock_xprt {
21 struct rpc_xprt xprt;
22
23 /*
24 * Network layer
25 */
26 struct socket * sock;
27 struct sock * inet;
28
29 /*
30 * State of TCP reply receive
31 */
32 __be32 tcp_fraghdr,
33 tcp_xid,
34 tcp_calldir;
35
36 u32 tcp_offset,
37 tcp_reclen;
38
39 unsigned long tcp_copied,
40 tcp_flags;
41
42 /*
43 * Connection of transports
44 */
45 struct delayed_work connect_worker;
46 struct sockaddr_storage srcaddr;
47 unsigned short srcport;
48
49 /*
50 * UDP socket buffer size parameters
51 */
52 size_t rcvsize,
53 sndsize;
54
55 /*
56 * Saved socket callback addresses
57 */
58 void (*old_data_ready)(struct sock *);
59 void (*old_state_change)(struct sock *);
60 void (*old_write_space)(struct sock *);
61 void (*old_error_report)(struct sock *);
62};
63
64/*
65 * TCP receive state flags
66 */
67#define TCP_RCV_LAST_FRAG (1UL << 0)
68#define TCP_RCV_COPY_FRAGHDR (1UL << 1)
69#define TCP_RCV_COPY_XID (1UL << 2)
70#define TCP_RCV_COPY_DATA (1UL << 3)
71#define TCP_RCV_READ_CALLDIR (1UL << 4)
72#define TCP_RCV_COPY_CALLDIR (1UL << 5)
73
74/*
75 * TCP RPC flags
76 */
77#define TCP_RPC_REPLY (1UL << 6)
78
20#endif /* __KERNEL__ */ 79#endif /* __KERNEL__ */
21 80
22#endif /* _LINUX_SUNRPC_XPRTSOCK_H */ 81#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index 845c596bf594..3ae969e3acf0 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -396,14 +396,12 @@ struct nft_rule {
396/** 396/**
397 * struct nft_trans - nf_tables object update in transaction 397 * struct nft_trans - nf_tables object update in transaction
398 * 398 *
399 * @rcu_head: rcu head to defer release of transaction data
400 * @list: used internally 399 * @list: used internally
401 * @msg_type: message type 400 * @msg_type: message type
402 * @ctx: transaction context 401 * @ctx: transaction context
403 * @data: internal information related to the transaction 402 * @data: internal information related to the transaction
404 */ 403 */
405struct nft_trans { 404struct nft_trans {
406 struct rcu_head rcu_head;
407 struct list_head list; 405 struct list_head list;
408 int msg_type; 406 int msg_type;
409 struct nft_ctx ctx; 407 struct nft_ctx ctx;
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index d5f59f3fc35d..57cccd0052e5 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -8,6 +8,12 @@
8#define VNI_HASH_BITS 10 8#define VNI_HASH_BITS 10
9#define VNI_HASH_SIZE (1<<VNI_HASH_BITS) 9#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
10 10
11/* VXLAN protocol header */
12struct vxlanhdr {
13 __be32 vx_flags;
14 __be32 vx_vni;
15};
16
11struct vxlan_sock; 17struct vxlan_sock;
12typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key); 18typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key);
13 19
@@ -45,6 +51,18 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 51 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet); 52 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
47 53
54static inline bool vxlan_gso_check(struct sk_buff *skb)
55{
56 if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) &&
57 (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
58 skb->inner_protocol != htons(ETH_P_TEB) ||
59 (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
60 sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
61 return false;
62
63 return true;
64}
65
48/* IP header + UDP + VXLAN + Ethernet header */ 66/* IP header + UDP + VXLAN + Ethernet header */
49#define VXLAN_HEADROOM (20 + 8 + 8 + 14) 67#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
50/* IPv6 header + UDP + VXLAN + Ethernet header */ 68/* IPv6 header + UDP + VXLAN + Ethernet header */
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 2883a7a6f9f3..98f2ade0266e 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -102,6 +102,8 @@ struct snd_soc_dpcm_runtime {
102 /* state and update */ 102 /* state and update */
103 enum snd_soc_dpcm_update runtime_update; 103 enum snd_soc_dpcm_update runtime_update;
104 enum snd_soc_dpcm_state state; 104 enum snd_soc_dpcm_state state;
105
106 int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */
105}; 107};
106 108
107/* can this BE stop and free */ 109/* can this BE stop and free */
diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index 1fef3e6e9436..171ca4ff6d99 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -6,6 +6,8 @@
6 6
7#include <linux/sunrpc/sched.h> 7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h> 8#include <linux/sunrpc/clnt.h>
9#include <linux/sunrpc/svc.h>
10#include <linux/sunrpc/xprtsock.h>
9#include <net/tcp_states.h> 11#include <net/tcp_states.h>
10#include <linux/net.h> 12#include <linux/net.h>
11#include <linux/tracepoint.h> 13#include <linux/tracepoint.h>
@@ -306,6 +308,164 @@ DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
306DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); 308DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
307DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); 309DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
308 310
311DECLARE_EVENT_CLASS(rpc_xprt_event,
312 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
313
314 TP_ARGS(xprt, xid, status),
315
316 TP_STRUCT__entry(
317 __field(__be32, xid)
318 __field(int, status)
319 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
320 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
321 ),
322
323 TP_fast_assign(
324 __entry->xid = xid;
325 __entry->status = status;
326 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
327 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
328 ),
329
330 TP_printk("peer=[%s]:%s xid=0x%x status=%d", __get_str(addr),
331 __get_str(port), be32_to_cpu(__entry->xid),
332 __entry->status)
333);
334
335DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
336 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
337 TP_ARGS(xprt, xid, status));
338
339DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
340 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
341 TP_ARGS(xprt, xid, status));
342
343DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
344 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
345 TP_ARGS(xprt, xid, status));
346
347TRACE_EVENT(xs_tcp_data_ready,
348 TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
349
350 TP_ARGS(xprt, err, total),
351
352 TP_STRUCT__entry(
353 __field(int, err)
354 __field(unsigned int, total)
355 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
356 "(null)")
357 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
358 "(null)")
359 ),
360
361 TP_fast_assign(
362 __entry->err = err;
363 __entry->total = total;
364 __assign_str(addr, xprt ?
365 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
366 __assign_str(port, xprt ?
367 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
368 ),
369
370 TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
371 __get_str(port), __entry->err, __entry->total)
372);
373
374#define rpc_show_sock_xprt_flags(flags) \
375 __print_flags(flags, "|", \
376 { TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
377 { TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
378 { TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
379 { TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
380 { TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
381 { TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
382 { TCP_RPC_REPLY, "TCP_RPC_REPLY" })
383
384TRACE_EVENT(xs_tcp_data_recv,
385 TP_PROTO(struct sock_xprt *xs),
386
387 TP_ARGS(xs),
388
389 TP_STRUCT__entry(
390 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
391 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
392 __field(__be32, xid)
393 __field(unsigned long, flags)
394 __field(unsigned long, copied)
395 __field(unsigned int, reclen)
396 __field(unsigned long, offset)
397 ),
398
399 TP_fast_assign(
400 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
401 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
402 __entry->xid = xs->tcp_xid;
403 __entry->flags = xs->tcp_flags;
404 __entry->copied = xs->tcp_copied;
405 __entry->reclen = xs->tcp_reclen;
406 __entry->offset = xs->tcp_offset;
407 ),
408
409 TP_printk("peer=[%s]:%s xid=0x%x flags=%s copied=%lu reclen=%u offset=%lu",
410 __get_str(addr), __get_str(port), be32_to_cpu(__entry->xid),
411 rpc_show_sock_xprt_flags(__entry->flags),
412 __entry->copied, __entry->reclen, __entry->offset)
413);
414
415TRACE_EVENT(svc_recv,
416 TP_PROTO(struct svc_rqst *rqst, int status),
417
418 TP_ARGS(rqst, status),
419
420 TP_STRUCT__entry(
421 __field(struct sockaddr *, addr)
422 __field(__be32, xid)
423 __field(int, status)
424 ),
425
426 TP_fast_assign(
427 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
428 __entry->xid = status > 0 ? rqst->rq_xid : 0;
429 __entry->status = status;
430 ),
431
432 TP_printk("addr=%pIScp xid=0x%x status=%d", __entry->addr,
433 be32_to_cpu(__entry->xid), __entry->status)
434);
435
436DECLARE_EVENT_CLASS(svc_rqst_status,
437
438 TP_PROTO(struct svc_rqst *rqst, int status),
439
440 TP_ARGS(rqst, status),
441
442 TP_STRUCT__entry(
443 __field(struct sockaddr *, addr)
444 __field(__be32, xid)
445 __field(int, dropme)
446 __field(int, status)
447 ),
448
449 TP_fast_assign(
450 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
451 __entry->xid = rqst->rq_xid;
452 __entry->dropme = (int)rqst->rq_dropme;
453 __entry->status = status;
454 ),
455
456 TP_printk("addr=%pIScp rq_xid=0x%x dropme=%d status=%d",
457 __entry->addr, be32_to_cpu(__entry->xid), __entry->dropme,
458 __entry->status)
459);
460
461DEFINE_EVENT(svc_rqst_status, svc_process,
462 TP_PROTO(struct svc_rqst *rqst, int status),
463 TP_ARGS(rqst, status));
464
465DEFINE_EVENT(svc_rqst_status, svc_send,
466 TP_PROTO(struct svc_rqst *rqst, int status),
467 TP_ARGS(rqst, status));
468
309#endif /* _TRACE_SUNRPC_H */ 469#endif /* _TRACE_SUNRPC_H */
310 470
311#include <trace/define_trace.h> 471#include <trace/define_trace.h>
diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h
index a6f453c740b8..1fdc95bb2375 100644
--- a/include/uapi/linux/nfsd/debug.h
+++ b/include/uapi/linux/nfsd/debug.h
@@ -15,7 +15,7 @@
15 * Enable debugging for nfsd. 15 * Enable debugging for nfsd.
16 * Requires RPC_DEBUG. 16 * Requires RPC_DEBUG.
17 */ 17 */
18#ifdef RPC_DEBUG 18#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
19# define NFSD_DEBUG 1 19# define NFSD_DEBUG 1
20#endif 20#endif
21 21
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 2b02c9fda790..1cd5eef1fcdd 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -1562,8 +1562,10 @@ static void perf_remove_from_context(struct perf_event *event, bool detach_group
1562 1562
1563 if (!task) { 1563 if (!task) {
1564 /* 1564 /*
1565 * Per cpu events are removed via an smp call and 1565 * Per cpu events are removed via an smp call. The removal can
1566 * the removal is always successful. 1566 * fail if the CPU is currently offline, but in that case we
1567 * already called __perf_remove_from_context from
1568 * perf_event_exit_cpu.
1567 */ 1569 */
1568 cpu_function_call(event->cpu, __perf_remove_from_context, &re); 1570 cpu_function_call(event->cpu, __perf_remove_from_context, &re);
1569 return; 1571 return;
@@ -8117,7 +8119,7 @@ static void perf_pmu_rotate_stop(struct pmu *pmu)
8117 8119
8118static void __perf_event_exit_context(void *__info) 8120static void __perf_event_exit_context(void *__info)
8119{ 8121{
8120 struct remove_event re = { .detach_group = false }; 8122 struct remove_event re = { .detach_group = true };
8121 struct perf_event_context *ctx = __info; 8123 struct perf_event_context *ctx = __info;
8122 8124
8123 perf_pmu_rotate_stop(ctx->pmu); 8125 perf_pmu_rotate_stop(ctx->pmu);
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1d0af8a2c646..ed8f2cde34c5 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1640,7 +1640,6 @@ bool uprobe_deny_signal(void)
1640 if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) { 1640 if (__fatal_signal_pending(t) || arch_uprobe_xol_was_trapped(t)) {
1641 utask->state = UTASK_SSTEP_TRAPPED; 1641 utask->state = UTASK_SSTEP_TRAPPED;
1642 set_tsk_thread_flag(t, TIF_UPROBE); 1642 set_tsk_thread_flag(t, TIF_UPROBE);
1643 set_tsk_thread_flag(t, TIF_NOTIFY_RESUME);
1644 } 1643 }
1645 } 1644 }
1646 1645
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 240157c13ddc..24beb9bb4c3e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2475,44 +2475,6 @@ EXPORT_PER_CPU_SYMBOL(kstat);
2475EXPORT_PER_CPU_SYMBOL(kernel_cpustat); 2475EXPORT_PER_CPU_SYMBOL(kernel_cpustat);
2476 2476
2477/* 2477/*
2478 * Return any ns on the sched_clock that have not yet been accounted in
2479 * @p in case that task is currently running.
2480 *
2481 * Called with task_rq_lock() held on @rq.
2482 */
2483static u64 do_task_delta_exec(struct task_struct *p, struct rq *rq)
2484{
2485 u64 ns = 0;
2486
2487 /*
2488 * Must be ->curr _and_ ->on_rq. If dequeued, we would
2489 * project cycles that may never be accounted to this
2490 * thread, breaking clock_gettime().
2491 */
2492 if (task_current(rq, p) && task_on_rq_queued(p)) {
2493 update_rq_clock(rq);
2494 ns = rq_clock_task(rq) - p->se.exec_start;
2495 if ((s64)ns < 0)
2496 ns = 0;
2497 }
2498
2499 return ns;
2500}
2501
2502unsigned long long task_delta_exec(struct task_struct *p)
2503{
2504 unsigned long flags;
2505 struct rq *rq;
2506 u64 ns = 0;
2507
2508 rq = task_rq_lock(p, &flags);
2509 ns = do_task_delta_exec(p, rq);
2510 task_rq_unlock(rq, p, &flags);
2511
2512 return ns;
2513}
2514
2515/*
2516 * Return accounted runtime for the task. 2478 * Return accounted runtime for the task.
2517 * In case the task is currently running, return the runtime plus current's 2479 * In case the task is currently running, return the runtime plus current's
2518 * pending runtime that have not been accounted yet. 2480 * pending runtime that have not been accounted yet.
@@ -2521,7 +2483,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
2521{ 2483{
2522 unsigned long flags; 2484 unsigned long flags;
2523 struct rq *rq; 2485 struct rq *rq;
2524 u64 ns = 0; 2486 u64 ns;
2525 2487
2526#if defined(CONFIG_64BIT) && defined(CONFIG_SMP) 2488#if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
2527 /* 2489 /*
@@ -2540,7 +2502,16 @@ unsigned long long task_sched_runtime(struct task_struct *p)
2540#endif 2502#endif
2541 2503
2542 rq = task_rq_lock(p, &flags); 2504 rq = task_rq_lock(p, &flags);
2543 ns = p->se.sum_exec_runtime + do_task_delta_exec(p, rq); 2505 /*
2506 * Must be ->curr _and_ ->on_rq. If dequeued, we would
2507 * project cycles that may never be accounted to this
2508 * thread, breaking clock_gettime().
2509 */
2510 if (task_current(rq, p) && task_on_rq_queued(p)) {
2511 update_rq_clock(rq);
2512 p->sched_class->update_curr(rq);
2513 }
2514 ns = p->se.sum_exec_runtime;
2544 task_rq_unlock(rq, p, &flags); 2515 task_rq_unlock(rq, p, &flags);
2545 2516
2546 return ns; 2517 return ns;
@@ -6368,6 +6339,10 @@ static void sched_init_numa(void)
6368 if (!sched_debug()) 6339 if (!sched_debug())
6369 break; 6340 break;
6370 } 6341 }
6342
6343 if (!level)
6344 return;
6345
6371 /* 6346 /*
6372 * 'level' contains the number of unique distances, excluding the 6347 * 'level' contains the number of unique distances, excluding the
6373 * identity distance node_distance(i,i). 6348 * identity distance node_distance(i,i).
@@ -7444,8 +7419,12 @@ void sched_move_task(struct task_struct *tsk)
7444 if (unlikely(running)) 7419 if (unlikely(running))
7445 put_prev_task(rq, tsk); 7420 put_prev_task(rq, tsk);
7446 7421
7447 tg = container_of(task_css_check(tsk, cpu_cgrp_id, 7422 /*
7448 lockdep_is_held(&tsk->sighand->siglock)), 7423 * All callers are synchronized by task_rq_lock(); we do not use RCU
7424 * which is pointless here. Thus, we pass "true" to task_css_check()
7425 * to prevent lockdep warnings.
7426 */
7427 tg = container_of(task_css_check(tsk, cpu_cgrp_id, true),
7449 struct task_group, css); 7428 struct task_group, css);
7450 tg = autogroup_task_group(tsk, tg); 7429 tg = autogroup_task_group(tsk, tg);
7451 tsk->sched_task_group = tg; 7430 tsk->sched_task_group = tg;
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 5285332392d5..28fa9d9e9201 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1701,4 +1701,6 @@ const struct sched_class dl_sched_class = {
1701 .prio_changed = prio_changed_dl, 1701 .prio_changed = prio_changed_dl,
1702 .switched_from = switched_from_dl, 1702 .switched_from = switched_from_dl,
1703 .switched_to = switched_to_dl, 1703 .switched_to = switched_to_dl,
1704
1705 .update_curr = update_curr_dl,
1704}; 1706};
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 34baa60f8a7b..ef2b104b254c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -726,6 +726,11 @@ static void update_curr(struct cfs_rq *cfs_rq)
726 account_cfs_rq_runtime(cfs_rq, delta_exec); 726 account_cfs_rq_runtime(cfs_rq, delta_exec);
727} 727}
728 728
729static void update_curr_fair(struct rq *rq)
730{
731 update_curr(cfs_rq_of(&rq->curr->se));
732}
733
729static inline void 734static inline void
730update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se) 735update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
731{ 736{
@@ -1180,6 +1185,13 @@ static void task_numa_compare(struct task_numa_env *env,
1180 raw_spin_unlock_irq(&dst_rq->lock); 1185 raw_spin_unlock_irq(&dst_rq->lock);
1181 1186
1182 /* 1187 /*
1188 * Because we have preemption enabled we can get migrated around and
1189 * end try selecting ourselves (current == env->p) as a swap candidate.
1190 */
1191 if (cur == env->p)
1192 goto unlock;
1193
1194 /*
1183 * "imp" is the fault differential for the source task between the 1195 * "imp" is the fault differential for the source task between the
1184 * source and destination node. Calculate the total differential for 1196 * source and destination node. Calculate the total differential for
1185 * the source task and potential destination task. The more negative 1197 * the source task and potential destination task. The more negative
@@ -7949,6 +7961,8 @@ const struct sched_class fair_sched_class = {
7949 7961
7950 .get_rr_interval = get_rr_interval_fair, 7962 .get_rr_interval = get_rr_interval_fair,
7951 7963
7964 .update_curr = update_curr_fair,
7965
7952#ifdef CONFIG_FAIR_GROUP_SCHED 7966#ifdef CONFIG_FAIR_GROUP_SCHED
7953 .task_move_group = task_move_group_fair, 7967 .task_move_group = task_move_group_fair,
7954#endif 7968#endif
diff --git a/kernel/sched/idle_task.c b/kernel/sched/idle_task.c
index 67ad4e7f506a..c65dac8c97cd 100644
--- a/kernel/sched/idle_task.c
+++ b/kernel/sched/idle_task.c
@@ -75,6 +75,10 @@ static unsigned int get_rr_interval_idle(struct rq *rq, struct task_struct *task
75 return 0; 75 return 0;
76} 76}
77 77
78static void update_curr_idle(struct rq *rq)
79{
80}
81
78/* 82/*
79 * Simple, special scheduling class for the per-CPU idle tasks: 83 * Simple, special scheduling class for the per-CPU idle tasks:
80 */ 84 */
@@ -101,4 +105,5 @@ const struct sched_class idle_sched_class = {
101 105
102 .prio_changed = prio_changed_idle, 106 .prio_changed = prio_changed_idle,
103 .switched_to = switched_to_idle, 107 .switched_to = switched_to_idle,
108 .update_curr = update_curr_idle,
104}; 109};
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index d024e6ce30ba..20bca398084a 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2128,6 +2128,8 @@ const struct sched_class rt_sched_class = {
2128 2128
2129 .prio_changed = prio_changed_rt, 2129 .prio_changed = prio_changed_rt,
2130 .switched_to = switched_to_rt, 2130 .switched_to = switched_to_rt,
2131
2132 .update_curr = update_curr_rt,
2131}; 2133};
2132 2134
2133#ifdef CONFIG_SCHED_DEBUG 2135#ifdef CONFIG_SCHED_DEBUG
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 24156c8434d1..2df8ef067cc5 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1135,6 +1135,8 @@ struct sched_class {
1135 unsigned int (*get_rr_interval) (struct rq *rq, 1135 unsigned int (*get_rr_interval) (struct rq *rq,
1136 struct task_struct *task); 1136 struct task_struct *task);
1137 1137
1138 void (*update_curr) (struct rq *rq);
1139
1138#ifdef CONFIG_FAIR_GROUP_SCHED 1140#ifdef CONFIG_FAIR_GROUP_SCHED
1139 void (*task_move_group) (struct task_struct *p, int on_rq); 1141 void (*task_move_group) (struct task_struct *p, int on_rq);
1140#endif 1142#endif
diff --git a/kernel/sched/stop_task.c b/kernel/sched/stop_task.c
index 67426e529f59..79ffec45a6ac 100644
--- a/kernel/sched/stop_task.c
+++ b/kernel/sched/stop_task.c
@@ -102,6 +102,10 @@ get_rr_interval_stop(struct rq *rq, struct task_struct *task)
102 return 0; 102 return 0;
103} 103}
104 104
105static void update_curr_stop(struct rq *rq)
106{
107}
108
105/* 109/*
106 * Simple, special scheduling class for the per-CPU stop tasks: 110 * Simple, special scheduling class for the per-CPU stop tasks:
107 */ 111 */
@@ -128,4 +132,5 @@ const struct sched_class stop_sched_class = {
128 132
129 .prio_changed = prio_changed_stop, 133 .prio_changed = prio_changed_stop,
130 .switched_to = switched_to_stop, 134 .switched_to = switched_to_stop,
135 .update_curr = update_curr_stop,
131}; 136};
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 492b986195d5..a16b67859e2a 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -553,7 +553,7 @@ static int cpu_timer_sample_group(const clockid_t which_clock,
553 *sample = cputime_to_expires(cputime.utime); 553 *sample = cputime_to_expires(cputime.utime);
554 break; 554 break;
555 case CPUCLOCK_SCHED: 555 case CPUCLOCK_SCHED:
556 *sample = cputime.sum_exec_runtime + task_delta_exec(p); 556 *sample = cputime.sum_exec_runtime;
557 break; 557 break;
558 } 558 }
559 return 0; 559 return 0;
diff --git a/lib/Makefile b/lib/Makefile
index 7512dc978f18..0211d2bd5e17 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -10,7 +10,7 @@ endif
10lib-y := ctype.o string.o vsprintf.o cmdline.o \ 10lib-y := ctype.o string.o vsprintf.o cmdline.o \
11 rbtree.o radix-tree.o dump_stack.o timerqueue.o\ 11 rbtree.o radix-tree.o dump_stack.o timerqueue.o\
12 idr.o int_sqrt.o extable.o \ 12 idr.o int_sqrt.o extable.o \
13 sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \ 13 sha1.o md5.o irq_regs.o argv_split.o \
14 proportions.o flex_proportions.o ratelimit.o show_mem.o \ 14 proportions.o flex_proportions.o ratelimit.o show_mem.o \
15 is_single_threaded.o plist.o decompress.o kobject_uevent.o \ 15 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
16 earlycpio.o 16 earlycpio.o
@@ -26,7 +26,7 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
26 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ 26 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
27 gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ 27 gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \
28 bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ 28 bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \
29 percpu-refcount.o percpu_ida.o hash.o rhashtable.o 29 percpu-refcount.o percpu_ida.o hash.o rhashtable.o reciprocal_div.o
30obj-y += string_helpers.o 30obj-y += string_helpers.o
31obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o 31obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
32obj-y += kstrtox.o 32obj-y += kstrtox.o
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 648d79ccf462..c465876c7861 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -813,10 +813,9 @@ static void __br_multicast_send_query(struct net_bridge *br,
813 return; 813 return;
814 814
815 if (port) { 815 if (port) {
816 __skb_push(skb, sizeof(struct ethhdr));
817 skb->dev = port->dev; 816 skb->dev = port->dev;
818 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 817 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
819 dev_queue_xmit); 818 br_dev_queue_push_xmit);
820 } else { 819 } else {
821 br_multicast_select_own_querier(br, ip, skb); 820 br_multicast_select_own_querier(br, ip, skb);
822 netif_rx(skb); 821 netif_rx(skb);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index c16615bfb61e..32e31c299631 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -552,20 +552,13 @@ static void kfree_skbmem(struct sk_buff *skb)
552 case SKB_FCLONE_CLONE: 552 case SKB_FCLONE_CLONE:
553 fclones = container_of(skb, struct sk_buff_fclones, skb2); 553 fclones = container_of(skb, struct sk_buff_fclones, skb2);
554 554
555 /* Warning : We must perform the atomic_dec_and_test() before 555 /* The clone portion is available for
556 * setting skb->fclone back to SKB_FCLONE_FREE, otherwise 556 * fast-cloning again.
557 * skb_clone() could set clone_ref to 2 before our decrement.
558 * Anyway, if we are going to free the structure, no need to
559 * rewrite skb->fclone.
560 */ 557 */
561 if (atomic_dec_and_test(&fclones->fclone_ref)) { 558 skb->fclone = SKB_FCLONE_FREE;
559
560 if (atomic_dec_and_test(&fclones->fclone_ref))
562 kmem_cache_free(skbuff_fclone_cache, fclones); 561 kmem_cache_free(skbuff_fclone_cache, fclones);
563 } else {
564 /* The clone portion is available for
565 * fast-cloning again.
566 */
567 skb->fclone = SKB_FCLONE_FREE;
568 }
569 break; 562 break;
570 } 563 }
571} 564}
@@ -887,11 +880,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
887 if (skb->fclone == SKB_FCLONE_ORIG && 880 if (skb->fclone == SKB_FCLONE_ORIG &&
888 n->fclone == SKB_FCLONE_FREE) { 881 n->fclone == SKB_FCLONE_FREE) {
889 n->fclone = SKB_FCLONE_CLONE; 882 n->fclone = SKB_FCLONE_CLONE;
890 /* As our fastclone was free, clone_ref must be 1 at this point. 883 atomic_inc(&fclones->fclone_ref);
891 * We could use atomic_inc() here, but it is faster
892 * to set the final value.
893 */
894 atomic_set(&fclones->fclone_ref, 2);
895 } else { 884 } else {
896 if (skb_pfmemalloc(skb)) 885 if (skb_pfmemalloc(skb))
897 gfp_mask |= __GFP_MEMALLOC; 886 gfp_mask |= __GFP_MEMALLOC;
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ca11d283bbeb..93ea80196f0e 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1080,13 +1080,13 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1080 if (!app) 1080 if (!app)
1081 return -EMSGSIZE; 1081 return -EMSGSIZE;
1082 1082
1083 spin_lock(&dcb_lock); 1083 spin_lock_bh(&dcb_lock);
1084 list_for_each_entry(itr, &dcb_app_list, list) { 1084 list_for_each_entry(itr, &dcb_app_list, list) {
1085 if (itr->ifindex == netdev->ifindex) { 1085 if (itr->ifindex == netdev->ifindex) {
1086 err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app), 1086 err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app),
1087 &itr->app); 1087 &itr->app);
1088 if (err) { 1088 if (err) {
1089 spin_unlock(&dcb_lock); 1089 spin_unlock_bh(&dcb_lock);
1090 return -EMSGSIZE; 1090 return -EMSGSIZE;
1091 } 1091 }
1092 } 1092 }
@@ -1097,7 +1097,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
1097 else 1097 else
1098 dcbx = -EOPNOTSUPP; 1098 dcbx = -EOPNOTSUPP;
1099 1099
1100 spin_unlock(&dcb_lock); 1100 spin_unlock_bh(&dcb_lock);
1101 nla_nest_end(skb, app); 1101 nla_nest_end(skb, app);
1102 1102
1103 /* get peer info if available */ 1103 /* get peer info if available */
@@ -1234,7 +1234,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
1234 } 1234 }
1235 1235
1236 /* local app */ 1236 /* local app */
1237 spin_lock(&dcb_lock); 1237 spin_lock_bh(&dcb_lock);
1238 app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE); 1238 app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE);
1239 if (!app) 1239 if (!app)
1240 goto dcb_unlock; 1240 goto dcb_unlock;
@@ -1271,7 +1271,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
1271 else 1271 else
1272 dcbx = -EOPNOTSUPP; 1272 dcbx = -EOPNOTSUPP;
1273 1273
1274 spin_unlock(&dcb_lock); 1274 spin_unlock_bh(&dcb_lock);
1275 1275
1276 /* features flags */ 1276 /* features flags */
1277 if (ops->getfeatcfg) { 1277 if (ops->getfeatcfg) {
@@ -1326,7 +1326,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
1326 return 0; 1326 return 0;
1327 1327
1328dcb_unlock: 1328dcb_unlock:
1329 spin_unlock(&dcb_lock); 1329 spin_unlock_bh(&dcb_lock);
1330nla_put_failure: 1330nla_put_failure:
1331 return err; 1331 return err;
1332} 1332}
@@ -1762,10 +1762,10 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)
1762 struct dcb_app_type *itr; 1762 struct dcb_app_type *itr;
1763 u8 prio = 0; 1763 u8 prio = 0;
1764 1764
1765 spin_lock(&dcb_lock); 1765 spin_lock_bh(&dcb_lock);
1766 if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) 1766 if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
1767 prio = itr->app.priority; 1767 prio = itr->app.priority;
1768 spin_unlock(&dcb_lock); 1768 spin_unlock_bh(&dcb_lock);
1769 1769
1770 return prio; 1770 return prio;
1771} 1771}
@@ -1789,7 +1789,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
1789 if (dev->dcbnl_ops->getdcbx) 1789 if (dev->dcbnl_ops->getdcbx)
1790 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1790 event.dcbx = dev->dcbnl_ops->getdcbx(dev);
1791 1791
1792 spin_lock(&dcb_lock); 1792 spin_lock_bh(&dcb_lock);
1793 /* Search for existing match and replace */ 1793 /* Search for existing match and replace */
1794 if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { 1794 if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) {
1795 if (new->priority) 1795 if (new->priority)
@@ -1804,7 +1804,7 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
1804 if (new->priority) 1804 if (new->priority)
1805 err = dcb_app_add(new, dev->ifindex); 1805 err = dcb_app_add(new, dev->ifindex);
1806out: 1806out:
1807 spin_unlock(&dcb_lock); 1807 spin_unlock_bh(&dcb_lock);
1808 if (!err) 1808 if (!err)
1809 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1809 call_dcbevent_notifiers(DCB_APP_EVENT, &event);
1810 return err; 1810 return err;
@@ -1823,10 +1823,10 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app)
1823 struct dcb_app_type *itr; 1823 struct dcb_app_type *itr;
1824 u8 prio = 0; 1824 u8 prio = 0;
1825 1825
1826 spin_lock(&dcb_lock); 1826 spin_lock_bh(&dcb_lock);
1827 if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) 1827 if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
1828 prio |= 1 << itr->app.priority; 1828 prio |= 1 << itr->app.priority;
1829 spin_unlock(&dcb_lock); 1829 spin_unlock_bh(&dcb_lock);
1830 1830
1831 return prio; 1831 return prio;
1832} 1832}
@@ -1850,7 +1850,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
1850 if (dev->dcbnl_ops->getdcbx) 1850 if (dev->dcbnl_ops->getdcbx)
1851 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1851 event.dcbx = dev->dcbnl_ops->getdcbx(dev);
1852 1852
1853 spin_lock(&dcb_lock); 1853 spin_lock_bh(&dcb_lock);
1854 /* Search for existing match and abort if found */ 1854 /* Search for existing match and abort if found */
1855 if (dcb_app_lookup(new, dev->ifindex, new->priority)) { 1855 if (dcb_app_lookup(new, dev->ifindex, new->priority)) {
1856 err = -EEXIST; 1856 err = -EEXIST;
@@ -1859,7 +1859,7 @@ int dcb_ieee_setapp(struct net_device *dev, struct dcb_app *new)
1859 1859
1860 err = dcb_app_add(new, dev->ifindex); 1860 err = dcb_app_add(new, dev->ifindex);
1861out: 1861out:
1862 spin_unlock(&dcb_lock); 1862 spin_unlock_bh(&dcb_lock);
1863 if (!err) 1863 if (!err)
1864 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1864 call_dcbevent_notifiers(DCB_APP_EVENT, &event);
1865 return err; 1865 return err;
@@ -1882,7 +1882,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
1882 if (dev->dcbnl_ops->getdcbx) 1882 if (dev->dcbnl_ops->getdcbx)
1883 event.dcbx = dev->dcbnl_ops->getdcbx(dev); 1883 event.dcbx = dev->dcbnl_ops->getdcbx(dev);
1884 1884
1885 spin_lock(&dcb_lock); 1885 spin_lock_bh(&dcb_lock);
1886 /* Search for existing match and remove it. */ 1886 /* Search for existing match and remove it. */
1887 if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) { 1887 if ((itr = dcb_app_lookup(del, dev->ifindex, del->priority))) {
1888 list_del(&itr->list); 1888 list_del(&itr->list);
@@ -1890,7 +1890,7 @@ int dcb_ieee_delapp(struct net_device *dev, struct dcb_app *del)
1890 err = 0; 1890 err = 0;
1891 } 1891 }
1892 1892
1893 spin_unlock(&dcb_lock); 1893 spin_unlock_bh(&dcb_lock);
1894 if (!err) 1894 if (!err)
1895 call_dcbevent_notifiers(DCB_APP_EVENT, &event); 1895 call_dcbevent_notifiers(DCB_APP_EVENT, &event);
1896 return err; 1896 return err;
@@ -1902,12 +1902,12 @@ static void dcb_flushapp(void)
1902 struct dcb_app_type *app; 1902 struct dcb_app_type *app;
1903 struct dcb_app_type *tmp; 1903 struct dcb_app_type *tmp;
1904 1904
1905 spin_lock(&dcb_lock); 1905 spin_lock_bh(&dcb_lock);
1906 list_for_each_entry_safe(app, tmp, &dcb_app_list, list) { 1906 list_for_each_entry_safe(app, tmp, &dcb_app_list, list) {
1907 list_del(&app->list); 1907 list_del(&app->list);
1908 kfree(app); 1908 kfree(app);
1909 } 1909 }
1910 spin_unlock(&dcb_lock); 1910 spin_unlock_bh(&dcb_lock);
1911} 1911}
1912 1912
1913static int __init dcbnl_init(void) 1913static int __init dcbnl_init(void)
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index f2e15738534d..8f7bd56955b0 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -62,6 +62,10 @@ int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res)
62 else 62 else
63 res->tclassid = 0; 63 res->tclassid = 0;
64#endif 64#endif
65
66 if (err == -ESRCH)
67 err = -ENETUNREACH;
68
65 return err; 69 return err;
66} 70}
67EXPORT_SYMBOL_GPL(__fib_lookup); 71EXPORT_SYMBOL_GPL(__fib_lookup);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index fb70e3ecc3e4..bb15d0e03d4f 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -318,9 +318,7 @@ igmp_scount(struct ip_mc_list *pmc, int type, int gdeleted, int sdeleted)
318 return scount; 318 return scount;
319} 319}
320 320
321#define igmp_skb_size(skb) (*(unsigned int *)((skb)->cb)) 321static struct sk_buff *igmpv3_newpack(struct net_device *dev, unsigned int mtu)
322
323static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
324{ 322{
325 struct sk_buff *skb; 323 struct sk_buff *skb;
326 struct rtable *rt; 324 struct rtable *rt;
@@ -330,6 +328,7 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
330 struct flowi4 fl4; 328 struct flowi4 fl4;
331 int hlen = LL_RESERVED_SPACE(dev); 329 int hlen = LL_RESERVED_SPACE(dev);
332 int tlen = dev->needed_tailroom; 330 int tlen = dev->needed_tailroom;
331 unsigned int size = mtu;
333 332
334 while (1) { 333 while (1) {
335 skb = alloc_skb(size + hlen + tlen, 334 skb = alloc_skb(size + hlen + tlen,
@@ -341,7 +340,6 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
341 return NULL; 340 return NULL;
342 } 341 }
343 skb->priority = TC_PRIO_CONTROL; 342 skb->priority = TC_PRIO_CONTROL;
344 igmp_skb_size(skb) = size;
345 343
346 rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0, 344 rt = ip_route_output_ports(net, &fl4, NULL, IGMPV3_ALL_MCR, 0,
347 0, 0, 345 0, 0,
@@ -354,6 +352,8 @@ static struct sk_buff *igmpv3_newpack(struct net_device *dev, int size)
354 skb_dst_set(skb, &rt->dst); 352 skb_dst_set(skb, &rt->dst);
355 skb->dev = dev; 353 skb->dev = dev;
356 354
355 skb->reserved_tailroom = skb_end_offset(skb) -
356 min(mtu, skb_end_offset(skb));
357 skb_reserve(skb, hlen); 357 skb_reserve(skb, hlen);
358 358
359 skb_reset_network_header(skb); 359 skb_reset_network_header(skb);
@@ -423,8 +423,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ip_mc_list *pmc,
423 return skb; 423 return skb;
424} 424}
425 425
426#define AVAILABLE(skb) ((skb) ? ((skb)->dev ? igmp_skb_size(skb) - (skb)->len : \ 426#define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0)
427 skb_tailroom(skb)) : 0)
428 427
429static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc, 428static struct sk_buff *add_grec(struct sk_buff *skb, struct ip_mc_list *pmc,
430 int type, int gdeleted, int sdeleted) 429 int type, int gdeleted, int sdeleted)
diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c
index c1023c445920..665de06561cd 100644
--- a/net/ipv4/netfilter/nft_masq_ipv4.c
+++ b/net/ipv4/netfilter/nft_masq_ipv4.c
@@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr,
24 struct nf_nat_range range; 24 struct nf_nat_range range;
25 unsigned int verdict; 25 unsigned int verdict;
26 26
27 memset(&range, 0, sizeof(range));
27 range.flags = priv->flags; 28 range.flags = priv->flags;
28 29
29 verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, 30 verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum,
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 88fa2d160685..d107ee246a1d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5231,7 +5231,7 @@ slow_path:
5231 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) 5231 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb))
5232 goto csum_error; 5232 goto csum_error;
5233 5233
5234 if (!th->ack && !th->rst) 5234 if (!th->ack && !th->rst && !th->syn)
5235 goto discard; 5235 goto discard;
5236 5236
5237 /* 5237 /*
@@ -5650,7 +5650,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5650 goto discard; 5650 goto discard;
5651 } 5651 }
5652 5652
5653 if (!th->ack && !th->rst) 5653 if (!th->ack && !th->rst && !th->syn)
5654 goto discard; 5654 goto discard;
5655 5655
5656 if (!tcp_validate_incoming(sk, skb, th, 0)) 5656 if (!tcp_validate_incoming(sk, skb, th, 0))
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 0171f08325c3..1a01d79b8698 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1439,6 +1439,10 @@ reg_pernet_fail:
1439 1439
1440void ip6_mr_cleanup(void) 1440void ip6_mr_cleanup(void)
1441{ 1441{
1442 rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE);
1443#ifdef CONFIG_IPV6_PIMSM_V2
1444 inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
1445#endif
1442 unregister_netdevice_notifier(&ip6_mr_notifier); 1446 unregister_netdevice_notifier(&ip6_mr_notifier);
1443 unregister_pernet_subsys(&ip6mr_net_ops); 1447 unregister_pernet_subsys(&ip6mr_net_ops);
1444 kmem_cache_destroy(mrt_cachep); 1448 kmem_cache_destroy(mrt_cachep);
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 9648de2b6745..ed2c4e400b46 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1550,7 +1550,7 @@ static void ip6_mc_hdr(struct sock *sk, struct sk_buff *skb,
1550 hdr->daddr = *daddr; 1550 hdr->daddr = *daddr;
1551} 1551}
1552 1552
1553static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size) 1553static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu)
1554{ 1554{
1555 struct net_device *dev = idev->dev; 1555 struct net_device *dev = idev->dev;
1556 struct net *net = dev_net(dev); 1556 struct net *net = dev_net(dev);
@@ -1561,13 +1561,13 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size)
1561 const struct in6_addr *saddr; 1561 const struct in6_addr *saddr;
1562 int hlen = LL_RESERVED_SPACE(dev); 1562 int hlen = LL_RESERVED_SPACE(dev);
1563 int tlen = dev->needed_tailroom; 1563 int tlen = dev->needed_tailroom;
1564 unsigned int size = mtu + hlen + tlen;
1564 int err; 1565 int err;
1565 u8 ra[8] = { IPPROTO_ICMPV6, 0, 1566 u8 ra[8] = { IPPROTO_ICMPV6, 0,
1566 IPV6_TLV_ROUTERALERT, 2, 0, 0, 1567 IPV6_TLV_ROUTERALERT, 2, 0, 0,
1567 IPV6_TLV_PADN, 0 }; 1568 IPV6_TLV_PADN, 0 };
1568 1569
1569 /* we assume size > sizeof(ra) here */ 1570 /* we assume size > sizeof(ra) here */
1570 size += hlen + tlen;
1571 /* limit our allocations to order-0 page */ 1571 /* limit our allocations to order-0 page */
1572 size = min_t(int, size, SKB_MAX_ORDER(0, 0)); 1572 size = min_t(int, size, SKB_MAX_ORDER(0, 0));
1573 skb = sock_alloc_send_skb(sk, size, 1, &err); 1573 skb = sock_alloc_send_skb(sk, size, 1, &err);
@@ -1576,6 +1576,8 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, int size)
1576 return NULL; 1576 return NULL;
1577 1577
1578 skb->priority = TC_PRIO_CONTROL; 1578 skb->priority = TC_PRIO_CONTROL;
1579 skb->reserved_tailroom = skb_end_offset(skb) -
1580 min(mtu, skb_end_offset(skb));
1579 skb_reserve(skb, hlen); 1581 skb_reserve(skb, hlen);
1580 1582
1581 if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) { 1583 if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) {
@@ -1690,8 +1692,7 @@ static struct sk_buff *add_grhead(struct sk_buff *skb, struct ifmcaddr6 *pmc,
1690 return skb; 1692 return skb;
1691} 1693}
1692 1694
1693#define AVAILABLE(skb) ((skb) ? ((skb)->dev ? (skb)->dev->mtu - (skb)->len : \ 1695#define AVAILABLE(skb) ((skb) ? skb_availroom(skb) : 0)
1694 skb_tailroom(skb)) : 0)
1695 1696
1696static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc, 1697static struct sk_buff *add_grec(struct sk_buff *skb, struct ifmcaddr6 *pmc,
1697 int type, int gdeleted, int sdeleted, int crsend) 1698 int type, int gdeleted, int sdeleted, int crsend)
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c
index 8a7ac685076d..529c119cbb14 100644
--- a/net/ipv6/netfilter/nft_masq_ipv6.c
+++ b/net/ipv6/netfilter/nft_masq_ipv6.c
@@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr,
25 struct nf_nat_range range; 25 struct nf_nat_range range;
26 unsigned int verdict; 26 unsigned int verdict;
27 27
28 memset(&range, 0, sizeof(range));
28 range.flags = priv->flags; 29 range.flags = priv->flags;
29 30
30 verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); 31 verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out);
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 91729b807c7d..1b095ca37aa4 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1764,6 +1764,7 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1764 struct ipxhdr *ipx = NULL; 1764 struct ipxhdr *ipx = NULL;
1765 struct sk_buff *skb; 1765 struct sk_buff *skb;
1766 int copied, rc; 1766 int copied, rc;
1767 bool locked = true;
1767 1768
1768 lock_sock(sk); 1769 lock_sock(sk);
1769 /* put the autobinding in */ 1770 /* put the autobinding in */
@@ -1790,6 +1791,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1790 if (sock_flag(sk, SOCK_ZAPPED)) 1791 if (sock_flag(sk, SOCK_ZAPPED))
1791 goto out; 1792 goto out;
1792 1793
1794 release_sock(sk);
1795 locked = false;
1793 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 1796 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
1794 flags & MSG_DONTWAIT, &rc); 1797 flags & MSG_DONTWAIT, &rc);
1795 if (!skb) { 1798 if (!skb) {
@@ -1826,7 +1829,8 @@ static int ipx_recvmsg(struct kiocb *iocb, struct socket *sock,
1826out_free: 1829out_free:
1827 skb_free_datagram(sk, skb); 1830 skb_free_datagram(sk, skb);
1828out: 1831out:
1829 release_sock(sk); 1832 if (locked)
1833 release_sock(sk);
1830 return rc; 1834 return rc;
1831} 1835}
1832 1836
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index ec24378caaaf..09d9caaec591 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -53,6 +53,9 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
53 __aligned(__alignof__(struct aead_request)); 53 __aligned(__alignof__(struct aead_request));
54 struct aead_request *aead_req = (void *) aead_req_data; 54 struct aead_request *aead_req = (void *) aead_req_data;
55 55
56 if (data_len == 0)
57 return -EINVAL;
58
56 memset(aead_req, 0, sizeof(aead_req_data)); 59 memset(aead_req, 0, sizeof(aead_req_data));
57 60
58 sg_init_one(&pt, data, data_len); 61 sg_init_one(&pt, data, data_len);
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index df90ce2db00c..408fd8ab4eef 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -252,19 +252,16 @@ minstrel_ht_sort_best_tp_rates(struct minstrel_ht_sta *mi, u8 index,
252 cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp; 252 cur_thr = mi->groups[cur_group].rates[cur_idx].cur_tp;
253 cur_prob = mi->groups[cur_group].rates[cur_idx].probability; 253 cur_prob = mi->groups[cur_group].rates[cur_idx].probability;
254 254
255 tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; 255 do {
256 tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES;
257 tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp;
258 tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability;
259
260 while (j > 0 && (cur_thr > tmp_thr ||
261 (cur_thr == tmp_thr && cur_prob > tmp_prob))) {
262 j--;
263 tmp_group = tp_list[j - 1] / MCS_GROUP_RATES; 256 tmp_group = tp_list[j - 1] / MCS_GROUP_RATES;
264 tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES; 257 tmp_idx = tp_list[j - 1] % MCS_GROUP_RATES;
265 tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp; 258 tmp_thr = mi->groups[tmp_group].rates[tmp_idx].cur_tp;
266 tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability; 259 tmp_prob = mi->groups[tmp_group].rates[tmp_idx].probability;
267 } 260 if (cur_thr < tmp_thr ||
261 (cur_thr == tmp_thr && cur_prob <= tmp_prob))
262 break;
263 j--;
264 } while (j > 0);
268 265
269 if (j < MAX_THR_RATES - 1) { 266 if (j < MAX_THR_RATES - 1) {
270 memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) * 267 memmove(&tp_list[j + 1], &tp_list[j], (sizeof(*tp_list) *
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 86f9d76b1464..d259da3ce67a 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1863,6 +1863,12 @@ ip_set_sockfn_get(struct sock *sk, int optval, void __user *user, int *len)
1863 if (*op < IP_SET_OP_VERSION) { 1863 if (*op < IP_SET_OP_VERSION) {
1864 /* Check the version at the beginning of operations */ 1864 /* Check the version at the beginning of operations */
1865 struct ip_set_req_version *req_version = data; 1865 struct ip_set_req_version *req_version = data;
1866
1867 if (*len < sizeof(struct ip_set_req_version)) {
1868 ret = -EINVAL;
1869 goto done;
1870 }
1871
1866 if (req_version->version != IPSET_PROTOCOL) { 1872 if (req_version->version != IPSET_PROTOCOL) {
1867 ret = -EPROTO; 1873 ret = -EPROTO;
1868 goto done; 1874 goto done;
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index 437a3663ad03..bd90bf8107da 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -846,6 +846,8 @@ ip_vs_prepare_tunneled_skb(struct sk_buff *skb, int skb_af,
846 new_skb = skb_realloc_headroom(skb, max_headroom); 846 new_skb = skb_realloc_headroom(skb, max_headroom);
847 if (!new_skb) 847 if (!new_skb)
848 goto error; 848 goto error;
849 if (skb->sk)
850 skb_set_owner_w(new_skb, skb->sk);
849 consume_skb(skb); 851 consume_skb(skb);
850 skb = new_skb; 852 skb = new_skb;
851 } 853 }
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 5016a6929085..2c699757bccf 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -611,12 +611,16 @@ __nf_conntrack_confirm(struct sk_buff *skb)
611 */ 611 */
612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); 612 NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
613 pr_debug("Confirming conntrack %p\n", ct); 613 pr_debug("Confirming conntrack %p\n", ct);
614 /* We have to check the DYING flag inside the lock to prevent 614
615 a race against nf_ct_get_next_corpse() possibly called from 615 /* We have to check the DYING flag after unlink to prevent
616 user context, else we insert an already 'dead' hash, blocking 616 * a race against nf_ct_get_next_corpse() possibly called from
617 further use of that particular connection -JM */ 617 * user context, else we insert an already 'dead' hash, blocking
618 * further use of that particular connection -JM.
619 */
620 nf_ct_del_from_dying_or_unconfirmed_list(ct);
618 621
619 if (unlikely(nf_ct_is_dying(ct))) { 622 if (unlikely(nf_ct_is_dying(ct))) {
623 nf_ct_add_to_dying_list(ct);
620 nf_conntrack_double_unlock(hash, reply_hash); 624 nf_conntrack_double_unlock(hash, reply_hash);
621 local_bh_enable(); 625 local_bh_enable();
622 return NF_ACCEPT; 626 return NF_ACCEPT;
@@ -636,8 +640,6 @@ __nf_conntrack_confirm(struct sk_buff *skb)
636 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h))) 640 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
637 goto out; 641 goto out;
638 642
639 nf_ct_del_from_dying_or_unconfirmed_list(ct);
640
641 /* Timer relative to confirmation time, not original 643 /* Timer relative to confirmation time, not original
642 setting time, otherwise we'd get timer wrap in 644 setting time, otherwise we'd get timer wrap in
643 weird delay cases. */ 645 weird delay cases. */
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 11ab4b078f3b..66e8425dbfe7 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -3484,13 +3484,8 @@ static void nft_chain_commit_update(struct nft_trans *trans)
3484 } 3484 }
3485} 3485}
3486 3486
3487/* Schedule objects for release via rcu to make sure no packets are accesing 3487static void nf_tables_commit_release(struct nft_trans *trans)
3488 * removed rules.
3489 */
3490static void nf_tables_commit_release_rcu(struct rcu_head *rt)
3491{ 3488{
3492 struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head);
3493
3494 switch (trans->msg_type) { 3489 switch (trans->msg_type) {
3495 case NFT_MSG_DELTABLE: 3490 case NFT_MSG_DELTABLE:
3496 nf_tables_table_destroy(&trans->ctx); 3491 nf_tables_table_destroy(&trans->ctx);
@@ -3612,10 +3607,11 @@ static int nf_tables_commit(struct sk_buff *skb)
3612 } 3607 }
3613 } 3608 }
3614 3609
3610 synchronize_rcu();
3611
3615 list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { 3612 list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) {
3616 list_del(&trans->list); 3613 list_del(&trans->list);
3617 trans->ctx.nla = NULL; 3614 nf_tables_commit_release(trans);
3618 call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu);
3619 } 3615 }
3620 3616
3621 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); 3617 nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN);
@@ -3623,13 +3619,8 @@ static int nf_tables_commit(struct sk_buff *skb)
3623 return 0; 3619 return 0;
3624} 3620}
3625 3621
3626/* Schedule objects for release via rcu to make sure no packets are accesing 3622static void nf_tables_abort_release(struct nft_trans *trans)
3627 * aborted rules.
3628 */
3629static void nf_tables_abort_release_rcu(struct rcu_head *rt)
3630{ 3623{
3631 struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head);
3632
3633 switch (trans->msg_type) { 3624 switch (trans->msg_type) {
3634 case NFT_MSG_NEWTABLE: 3625 case NFT_MSG_NEWTABLE:
3635 nf_tables_table_destroy(&trans->ctx); 3626 nf_tables_table_destroy(&trans->ctx);
@@ -3725,11 +3716,12 @@ static int nf_tables_abort(struct sk_buff *skb)
3725 } 3716 }
3726 } 3717 }
3727 3718
3719 synchronize_rcu();
3720
3728 list_for_each_entry_safe_reverse(trans, next, 3721 list_for_each_entry_safe_reverse(trans, next,
3729 &net->nft.commit_list, list) { 3722 &net->nft.commit_list, list) {
3730 list_del(&trans->list); 3723 list_del(&trans->list);
3731 trans->ctx.nla = NULL; 3724 nf_tables_abort_release(trans);
3732 call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu);
3733 } 3725 }
3734 3726
3735 return 0; 3727 return 0;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 6c5a915cfa75..13c2e17bbe27 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -47,6 +47,8 @@ static const int nfnl_group2type[NFNLGRP_MAX+1] = {
47 [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP, 47 [NFNLGRP_CONNTRACK_EXP_NEW] = NFNL_SUBSYS_CTNETLINK_EXP,
48 [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP, 48 [NFNLGRP_CONNTRACK_EXP_UPDATE] = NFNL_SUBSYS_CTNETLINK_EXP,
49 [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP, 49 [NFNLGRP_CONNTRACK_EXP_DESTROY] = NFNL_SUBSYS_CTNETLINK_EXP,
50 [NFNLGRP_NFTABLES] = NFNL_SUBSYS_NFTABLES,
51 [NFNLGRP_ACCT_QUOTA] = NFNL_SUBSYS_ACCT,
50}; 52};
51 53
52void nfnl_lock(__u8 subsys_id) 54void nfnl_lock(__u8 subsys_id)
@@ -464,7 +466,12 @@ static void nfnetlink_rcv(struct sk_buff *skb)
464static int nfnetlink_bind(int group) 466static int nfnetlink_bind(int group)
465{ 467{
466 const struct nfnetlink_subsystem *ss; 468 const struct nfnetlink_subsystem *ss;
467 int type = nfnl_group2type[group]; 469 int type;
470
471 if (group <= NFNLGRP_NONE || group > NFNLGRP_MAX)
472 return -EINVAL;
473
474 type = nfnl_group2type[group];
468 475
469 rcu_read_lock(); 476 rcu_read_lock();
470 ss = nfnetlink_get_subsys(type); 477 ss = nfnetlink_get_subsys(type);
@@ -514,6 +521,9 @@ static int __init nfnetlink_init(void)
514{ 521{
515 int i; 522 int i;
516 523
524 for (i = NFNLGRP_NONE + 1; i <= NFNLGRP_MAX; i++)
525 BUG_ON(nfnl_group2type[i] == NFNL_SUBSYS_NONE);
526
517 for (i=0; i<NFNL_SUBSYS_COUNT; i++) 527 for (i=0; i<NFNL_SUBSYS_COUNT; i++)
518 mutex_init(&table[i].mutex); 528 mutex_init(&table[i].mutex);
519 529
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 9d6d6f60a80f..265e190f2218 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -21,45 +21,17 @@
21#include <linux/netfilter_ipv6/ip6_tables.h> 21#include <linux/netfilter_ipv6/ip6_tables.h>
22#include <net/netfilter/nf_tables.h> 22#include <net/netfilter/nf_tables.h>
23 23
24static const struct {
25 const char *name;
26 u8 type;
27} table_to_chaintype[] = {
28 { "filter", NFT_CHAIN_T_DEFAULT },
29 { "raw", NFT_CHAIN_T_DEFAULT },
30 { "security", NFT_CHAIN_T_DEFAULT },
31 { "mangle", NFT_CHAIN_T_ROUTE },
32 { "nat", NFT_CHAIN_T_NAT },
33 { },
34};
35
36static int nft_compat_table_to_chaintype(const char *table)
37{
38 int i;
39
40 for (i = 0; table_to_chaintype[i].name != NULL; i++) {
41 if (strcmp(table_to_chaintype[i].name, table) == 0)
42 return table_to_chaintype[i].type;
43 }
44
45 return -1;
46}
47
48static int nft_compat_chain_validate_dependency(const char *tablename, 24static int nft_compat_chain_validate_dependency(const char *tablename,
49 const struct nft_chain *chain) 25 const struct nft_chain *chain)
50{ 26{
51 enum nft_chain_type type;
52 const struct nft_base_chain *basechain; 27 const struct nft_base_chain *basechain;
53 28
54 if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) 29 if (!tablename || !(chain->flags & NFT_BASE_CHAIN))
55 return 0; 30 return 0;
56 31
57 type = nft_compat_table_to_chaintype(tablename);
58 if (type < 0)
59 return -EINVAL;
60
61 basechain = nft_base_chain(chain); 32 basechain = nft_base_chain(chain);
62 if (basechain->type->type != type) 33 if (strcmp(tablename, "nat") == 0 &&
34 basechain->type->type != NFT_CHAIN_T_NAT)
63 return -EINVAL; 35 return -EINVAL;
64 36
65 return 0; 37 return 0;
@@ -117,7 +89,7 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par,
117 struct xt_target *target, void *info, 89 struct xt_target *target, void *info,
118 union nft_entry *entry, u8 proto, bool inv) 90 union nft_entry *entry, u8 proto, bool inv)
119{ 91{
120 par->net = &init_net; 92 par->net = ctx->net;
121 par->table = ctx->table->name; 93 par->table = ctx->table->name;
122 switch (ctx->afi->family) { 94 switch (ctx->afi->family) {
123 case AF_INET: 95 case AF_INET:
@@ -324,7 +296,7 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx,
324 struct xt_match *match, void *info, 296 struct xt_match *match, void *info,
325 union nft_entry *entry, u8 proto, bool inv) 297 union nft_entry *entry, u8 proto, bool inv)
326{ 298{
327 par->net = &init_net; 299 par->net = ctx->net;
328 par->table = ctx->table->name; 300 par->table = ctx->table->name;
329 switch (ctx->afi->family) { 301 switch (ctx->afi->family) {
330 case AF_INET: 302 case AF_INET:
@@ -374,7 +346,7 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
374 union nft_entry e = {}; 346 union nft_entry e = {};
375 int ret; 347 int ret;
376 348
377 ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); 349 ret = nft_compat_chain_validate_dependency(match->table, ctx->chain);
378 if (ret < 0) 350 if (ret < 0)
379 goto err; 351 goto err;
380 352
@@ -448,7 +420,7 @@ static int nft_match_validate(const struct nft_ctx *ctx,
448 if (!(hook_mask & match->hooks)) 420 if (!(hook_mask & match->hooks))
449 return -EINVAL; 421 return -EINVAL;
450 422
451 ret = nft_compat_chain_validate_dependency(match->name, 423 ret = nft_compat_chain_validate_dependency(match->table,
452 ctx->chain); 424 ctx->chain);
453 if (ret < 0) 425 if (ret < 0)
454 return ret; 426 return ret;
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 006886dbee36..8c4229b11c34 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -246,11 +246,11 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto,
246{ 246{
247 int transport_len = skb->len - skb_transport_offset(skb); 247 int transport_len = skb->len - skb_transport_offset(skb);
248 248
249 if (l4_proto == IPPROTO_TCP) { 249 if (l4_proto == NEXTHDR_TCP) {
250 if (likely(transport_len >= sizeof(struct tcphdr))) 250 if (likely(transport_len >= sizeof(struct tcphdr)))
251 inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb, 251 inet_proto_csum_replace16(&tcp_hdr(skb)->check, skb,
252 addr, new_addr, 1); 252 addr, new_addr, 1);
253 } else if (l4_proto == IPPROTO_UDP) { 253 } else if (l4_proto == NEXTHDR_UDP) {
254 if (likely(transport_len >= sizeof(struct udphdr))) { 254 if (likely(transport_len >= sizeof(struct udphdr))) {
255 struct udphdr *uh = udp_hdr(skb); 255 struct udphdr *uh = udp_hdr(skb);
256 256
@@ -261,6 +261,10 @@ static void update_ipv6_checksum(struct sk_buff *skb, u8 l4_proto,
261 uh->check = CSUM_MANGLED_0; 261 uh->check = CSUM_MANGLED_0;
262 } 262 }
263 } 263 }
264 } else if (l4_proto == NEXTHDR_ICMP) {
265 if (likely(transport_len >= sizeof(struct icmp6hdr)))
266 inet_proto_csum_replace16(&icmp6_hdr(skb)->icmp6_cksum,
267 skb, addr, new_addr, 1);
264 } 268 }
265} 269}
266 270
@@ -722,8 +726,6 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
722 726
723 case OVS_ACTION_ATTR_SAMPLE: 727 case OVS_ACTION_ATTR_SAMPLE:
724 err = sample(dp, skb, key, a); 728 err = sample(dp, skb, key, a);
725 if (unlikely(err)) /* skb already freed. */
726 return err;
727 break; 729 break;
728 } 730 }
729 731
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index e6d7255183eb..f9e556b56086 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1265,7 +1265,7 @@ static size_t ovs_dp_cmd_msg_size(void)
1265 return msgsize; 1265 return msgsize;
1266} 1266}
1267 1267
1268/* Called with ovs_mutex or RCU read lock. */ 1268/* Called with ovs_mutex. */
1269static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb, 1269static int ovs_dp_cmd_fill_info(struct datapath *dp, struct sk_buff *skb,
1270 u32 portid, u32 seq, u32 flags, u8 cmd) 1270 u32 portid, u32 seq, u32 flags, u8 cmd)
1271{ 1271{
@@ -1555,7 +1555,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
1555 if (!reply) 1555 if (!reply)
1556 return -ENOMEM; 1556 return -ENOMEM;
1557 1557
1558 rcu_read_lock(); 1558 ovs_lock();
1559 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs); 1559 dp = lookup_datapath(sock_net(skb->sk), info->userhdr, info->attrs);
1560 if (IS_ERR(dp)) { 1560 if (IS_ERR(dp)) {
1561 err = PTR_ERR(dp); 1561 err = PTR_ERR(dp);
@@ -1564,12 +1564,12 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
1564 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid, 1564 err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
1565 info->snd_seq, 0, OVS_DP_CMD_NEW); 1565 info->snd_seq, 0, OVS_DP_CMD_NEW);
1566 BUG_ON(err < 0); 1566 BUG_ON(err < 0);
1567 rcu_read_unlock(); 1567 ovs_unlock();
1568 1568
1569 return genlmsg_reply(reply, info); 1569 return genlmsg_reply(reply, info);
1570 1570
1571err_unlock_free: 1571err_unlock_free:
1572 rcu_read_unlock(); 1572 ovs_unlock();
1573 kfree_skb(reply); 1573 kfree_skb(reply);
1574 return err; 1574 return err;
1575} 1575}
@@ -1581,8 +1581,8 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
1581 int skip = cb->args[0]; 1581 int skip = cb->args[0];
1582 int i = 0; 1582 int i = 0;
1583 1583
1584 rcu_read_lock(); 1584 ovs_lock();
1585 list_for_each_entry_rcu(dp, &ovs_net->dps, list_node) { 1585 list_for_each_entry(dp, &ovs_net->dps, list_node) {
1586 if (i >= skip && 1586 if (i >= skip &&
1587 ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid, 1587 ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid,
1588 cb->nlh->nlmsg_seq, NLM_F_MULTI, 1588 cb->nlh->nlmsg_seq, NLM_F_MULTI,
@@ -1590,7 +1590,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
1590 break; 1590 break;
1591 i++; 1591 i++;
1592 } 1592 }
1593 rcu_read_unlock(); 1593 ovs_unlock();
1594 1594
1595 cb->args[0] = i; 1595 cb->args[0] = i;
1596 1596
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index 939bcb32100f..089b195c064a 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -145,7 +145,7 @@ static bool match_validate(const struct sw_flow_match *match,
145 if (match->key->eth.type == htons(ETH_P_ARP) 145 if (match->key->eth.type == htons(ETH_P_ARP)
146 || match->key->eth.type == htons(ETH_P_RARP)) { 146 || match->key->eth.type == htons(ETH_P_RARP)) {
147 key_expected |= 1 << OVS_KEY_ATTR_ARP; 147 key_expected |= 1 << OVS_KEY_ATTR_ARP;
148 if (match->mask && (match->mask->key.eth.type == htons(0xffff))) 148 if (match->mask && (match->mask->key.tp.src == htons(0xff)))
149 mask_allowed |= 1 << OVS_KEY_ATTR_ARP; 149 mask_allowed |= 1 << OVS_KEY_ATTR_ARP;
150 } 150 }
151 151
@@ -689,6 +689,13 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs,
689 ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX); 689 ipv6_key->ipv6_frag, OVS_FRAG_TYPE_MAX);
690 return -EINVAL; 690 return -EINVAL;
691 } 691 }
692
693 if (!is_mask && ipv6_key->ipv6_label & htonl(0xFFF00000)) {
694 OVS_NLERR("IPv6 flow label %x is out of range (max=%x).\n",
695 ntohl(ipv6_key->ipv6_label), (1 << 20) - 1);
696 return -EINVAL;
697 }
698
692 SW_FLOW_KEY_PUT(match, ipv6.label, 699 SW_FLOW_KEY_PUT(match, ipv6.label,
693 ipv6_key->ipv6_label, is_mask); 700 ipv6_key->ipv6_label, is_mask);
694 SW_FLOW_KEY_PUT(match, ip.proto, 701 SW_FLOW_KEY_PUT(match, ip.proto,
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig
index 0754d0f466d2..fb78117b896c 100644
--- a/net/sunrpc/Kconfig
+++ b/net/sunrpc/Kconfig
@@ -35,6 +35,7 @@ config RPCSEC_GSS_KRB5
35config SUNRPC_DEBUG 35config SUNRPC_DEBUG
36 bool "RPC: Enable dprintk debugging" 36 bool "RPC: Enable dprintk debugging"
37 depends on SUNRPC && SYSCTL 37 depends on SUNRPC && SYSCTL
38 select DEBUG_FS
38 help 39 help
39 This option enables a sysctl-based debugging interface 40 This option enables a sysctl-based debugging interface
40 that is be used by the 'rpcdebug' utility to turn on or off 41 that is be used by the 'rpcdebug' utility to turn on or off
diff --git a/net/sunrpc/Makefile b/net/sunrpc/Makefile
index e5a7a1cac8f3..15e6f6c23c5d 100644
--- a/net/sunrpc/Makefile
+++ b/net/sunrpc/Makefile
@@ -14,6 +14,7 @@ sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
14 addr.o rpcb_clnt.o timer.o xdr.o \ 14 addr.o rpcb_clnt.o timer.o xdr.o \
15 sunrpc_syms.o cache.o rpc_pipe.o \ 15 sunrpc_syms.o cache.o rpc_pipe.o \
16 svc_xprt.o 16 svc_xprt.o
17sunrpc-$(CONFIG_SUNRPC_DEBUG) += debugfs.o
17sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o 18sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o
18sunrpc-$(CONFIG_PROC_FS) += stats.o 19sunrpc-$(CONFIG_PROC_FS) += stats.o
19sunrpc-$(CONFIG_SYSCTL) += sysctl.o 20sunrpc-$(CONFIG_SYSCTL) += sysctl.o
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 383eb919ac0b..47f38be4155f 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -16,7 +16,7 @@
16#include <linux/sunrpc/gss_api.h> 16#include <linux/sunrpc/gss_api.h>
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18 18
19#ifdef RPC_DEBUG 19#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
20# define RPCDBG_FACILITY RPCDBG_AUTH 20# define RPCDBG_FACILITY RPCDBG_AUTH
21#endif 21#endif
22 22
@@ -646,7 +646,7 @@ rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred,
646 cred->cr_auth = auth; 646 cred->cr_auth = auth;
647 cred->cr_ops = ops; 647 cred->cr_ops = ops;
648 cred->cr_expire = jiffies; 648 cred->cr_expire = jiffies;
649#ifdef RPC_DEBUG 649#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
650 cred->cr_magic = RPCAUTH_CRED_MAGIC; 650 cred->cr_magic = RPCAUTH_CRED_MAGIC;
651#endif 651#endif
652 cred->cr_uid = acred->uid; 652 cred->cr_uid = acred->uid;
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c
index 6f6b829c9e8e..41248b1820c7 100644
--- a/net/sunrpc/auth_generic.c
+++ b/net/sunrpc/auth_generic.c
@@ -14,7 +14,7 @@
14#include <linux/sunrpc/debug.h> 14#include <linux/sunrpc/debug.h>
15#include <linux/sunrpc/sched.h> 15#include <linux/sunrpc/sched.h>
16 16
17#ifdef RPC_DEBUG 17#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
18# define RPCDBG_FACILITY RPCDBG_AUTH 18# define RPCDBG_FACILITY RPCDBG_AUTH
19#endif 19#endif
20 20
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 53ed8d3f8897..dace13d7638e 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -66,7 +66,7 @@ static unsigned int gss_expired_cred_retry_delay = GSS_RETRY_EXPIRED;
66#define GSS_KEY_EXPIRE_TIMEO 240 66#define GSS_KEY_EXPIRE_TIMEO 240
67static unsigned int gss_key_expire_timeo = GSS_KEY_EXPIRE_TIMEO; 67static unsigned int gss_key_expire_timeo = GSS_KEY_EXPIRE_TIMEO;
68 68
69#ifdef RPC_DEBUG 69#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
70# define RPCDBG_FACILITY RPCDBG_AUTH 70# define RPCDBG_FACILITY RPCDBG_AUTH
71#endif 71#endif
72 72
diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c
index c586e92bcf76..254defe446a7 100644
--- a/net/sunrpc/auth_gss/gss_generic_token.c
+++ b/net/sunrpc/auth_gss/gss_generic_token.c
@@ -38,7 +38,7 @@
38#include <linux/sunrpc/gss_asn1.h> 38#include <linux/sunrpc/gss_asn1.h>
39 39
40 40
41#ifdef RPC_DEBUG 41#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
42# define RPCDBG_FACILITY RPCDBG_AUTH 42# define RPCDBG_FACILITY RPCDBG_AUTH
43#endif 43#endif
44 44
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index f5ed9f6ece06..b5408e8a37f2 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -45,7 +45,7 @@
45#include <linux/sunrpc/gss_krb5.h> 45#include <linux/sunrpc/gss_krb5.h>
46#include <linux/sunrpc/xdr.h> 46#include <linux/sunrpc/xdr.h>
47 47
48#ifdef RPC_DEBUG 48#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
49# define RPCDBG_FACILITY RPCDBG_AUTH 49# define RPCDBG_FACILITY RPCDBG_AUTH
50#endif 50#endif
51 51
diff --git a/net/sunrpc/auth_gss/gss_krb5_keys.c b/net/sunrpc/auth_gss/gss_krb5_keys.c
index 24589bd2a4b6..234fa8d0fd9b 100644
--- a/net/sunrpc/auth_gss/gss_krb5_keys.c
+++ b/net/sunrpc/auth_gss/gss_krb5_keys.c
@@ -61,7 +61,7 @@
61#include <linux/sunrpc/xdr.h> 61#include <linux/sunrpc/xdr.h>
62#include <linux/lcm.h> 62#include <linux/lcm.h>
63 63
64#ifdef RPC_DEBUG 64#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
65# define RPCDBG_FACILITY RPCDBG_AUTH 65# define RPCDBG_FACILITY RPCDBG_AUTH
66#endif 66#endif
67 67
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index 0d3c158ef8fa..28db442a0034 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -45,7 +45,7 @@
45#include <linux/crypto.h> 45#include <linux/crypto.h>
46#include <linux/sunrpc/gss_krb5_enctypes.h> 46#include <linux/sunrpc/gss_krb5_enctypes.h>
47 47
48#ifdef RPC_DEBUG 48#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
49# define RPCDBG_FACILITY RPCDBG_AUTH 49# define RPCDBG_FACILITY RPCDBG_AUTH
50#endif 50#endif
51 51
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index 42768e5c3994..1d74d653e6c0 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -64,7 +64,7 @@
64#include <linux/random.h> 64#include <linux/random.h>
65#include <linux/crypto.h> 65#include <linux/crypto.h>
66 66
67#ifdef RPC_DEBUG 67#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
68# define RPCDBG_FACILITY RPCDBG_AUTH 68# define RPCDBG_FACILITY RPCDBG_AUTH
69#endif 69#endif
70 70
diff --git a/net/sunrpc/auth_gss/gss_krb5_seqnum.c b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
index 62ac90c62cb1..20d55c793eb6 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seqnum.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seqnum.c
@@ -35,7 +35,7 @@
35#include <linux/sunrpc/gss_krb5.h> 35#include <linux/sunrpc/gss_krb5.h>
36#include <linux/crypto.h> 36#include <linux/crypto.h>
37 37
38#ifdef RPC_DEBUG 38#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
39# define RPCDBG_FACILITY RPCDBG_AUTH 39# define RPCDBG_FACILITY RPCDBG_AUTH
40#endif 40#endif
41 41
diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c
index 6c981ddc19f8..dcf9515d9aef 100644
--- a/net/sunrpc/auth_gss/gss_krb5_unseal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c
@@ -62,7 +62,7 @@
62#include <linux/sunrpc/gss_krb5.h> 62#include <linux/sunrpc/gss_krb5.h>
63#include <linux/crypto.h> 63#include <linux/crypto.h>
64 64
65#ifdef RPC_DEBUG 65#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
66# define RPCDBG_FACILITY RPCDBG_AUTH 66# define RPCDBG_FACILITY RPCDBG_AUTH
67#endif 67#endif
68 68
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 4b614c604fe0..ca7e92a32f84 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -35,7 +35,7 @@
35#include <linux/pagemap.h> 35#include <linux/pagemap.h>
36#include <linux/crypto.h> 36#include <linux/crypto.h>
37 37
38#ifdef RPC_DEBUG 38#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
39# define RPCDBG_FACILITY RPCDBG_AUTH 39# define RPCDBG_FACILITY RPCDBG_AUTH
40#endif 40#endif
41 41
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index 92d5ab99fbf3..7063d856a598 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -46,7 +46,7 @@
46#include <linux/sunrpc/gss_api.h> 46#include <linux/sunrpc/gss_api.h>
47#include <linux/sunrpc/clnt.h> 47#include <linux/sunrpc/clnt.h>
48 48
49#ifdef RPC_DEBUG 49#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
50# define RPCDBG_FACILITY RPCDBG_AUTH 50# define RPCDBG_FACILITY RPCDBG_AUTH
51#endif 51#endif
52 52
diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.h b/net/sunrpc/auth_gss/gss_rpc_xdr.h
index 685a688f3d8a..9d88c6239f01 100644
--- a/net/sunrpc/auth_gss/gss_rpc_xdr.h
+++ b/net/sunrpc/auth_gss/gss_rpc_xdr.h
@@ -25,7 +25,7 @@
25#include <linux/sunrpc/clnt.h> 25#include <linux/sunrpc/clnt.h>
26#include <linux/sunrpc/xprtsock.h> 26#include <linux/sunrpc/xprtsock.h>
27 27
28#ifdef RPC_DEBUG 28#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
29# define RPCDBG_FACILITY RPCDBG_AUTH 29# define RPCDBG_FACILITY RPCDBG_AUTH
30#endif 30#endif
31 31
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index c548ab213f76..de856ddf5fed 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -51,7 +51,7 @@
51#include "gss_rpc_upcall.h" 51#include "gss_rpc_upcall.h"
52 52
53 53
54#ifdef RPC_DEBUG 54#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
55# define RPCDBG_FACILITY RPCDBG_AUTH 55# define RPCDBG_FACILITY RPCDBG_AUTH
56#endif 56#endif
57 57
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index 712c123e04e9..c2a2b584a056 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -10,7 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/sunrpc/clnt.h> 11#include <linux/sunrpc/clnt.h>
12 12
13#ifdef RPC_DEBUG 13#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
14# define RPCDBG_FACILITY RPCDBG_AUTH 14# define RPCDBG_FACILITY RPCDBG_AUTH
15#endif 15#endif
16 16
@@ -138,7 +138,7 @@ struct rpc_cred null_cred = {
138 .cr_ops = &null_credops, 138 .cr_ops = &null_credops,
139 .cr_count = ATOMIC_INIT(1), 139 .cr_count = ATOMIC_INIT(1),
140 .cr_flags = 1UL << RPCAUTH_CRED_UPTODATE, 140 .cr_flags = 1UL << RPCAUTH_CRED_UPTODATE,
141#ifdef RPC_DEBUG 141#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
142 .cr_magic = RPCAUTH_CRED_MAGIC, 142 .cr_magic = RPCAUTH_CRED_MAGIC,
143#endif 143#endif
144}; 144};
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index d5d692366294..4feda2d0a833 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -25,7 +25,7 @@ struct unx_cred {
25 25
26#define UNX_WRITESLACK (21 + (UNX_MAXNODENAME >> 2)) 26#define UNX_WRITESLACK (21 + (UNX_MAXNODENAME >> 2))
27 27
28#ifdef RPC_DEBUG 28#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
29# define RPCDBG_FACILITY RPCDBG_AUTH 29# define RPCDBG_FACILITY RPCDBG_AUTH
30#endif 30#endif
31 31
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
index 9761a0da964d..651f49ab601f 100644
--- a/net/sunrpc/backchannel_rqst.c
+++ b/net/sunrpc/backchannel_rqst.c
@@ -27,7 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#include <linux/export.h> 27#include <linux/export.h>
28#include <linux/sunrpc/bc_xprt.h> 28#include <linux/sunrpc/bc_xprt.h>
29 29
30#ifdef RPC_DEBUG 30#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
31#define RPCDBG_FACILITY RPCDBG_TRANS 31#define RPCDBG_FACILITY RPCDBG_TRANS
32#endif 32#endif
33 33
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 9acd6ce88db7..05da12a33945 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -42,7 +42,7 @@
42#include "sunrpc.h" 42#include "sunrpc.h"
43#include "netns.h" 43#include "netns.h"
44 44
45#ifdef RPC_DEBUG 45#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
46# define RPCDBG_FACILITY RPCDBG_CALL 46# define RPCDBG_FACILITY RPCDBG_CALL
47#endif 47#endif
48 48
@@ -305,6 +305,10 @@ static int rpc_client_register(struct rpc_clnt *clnt,
305 struct super_block *pipefs_sb; 305 struct super_block *pipefs_sb;
306 int err; 306 int err;
307 307
308 err = rpc_clnt_debugfs_register(clnt);
309 if (err)
310 return err;
311
308 pipefs_sb = rpc_get_sb_net(net); 312 pipefs_sb = rpc_get_sb_net(net);
309 if (pipefs_sb) { 313 if (pipefs_sb) {
310 err = rpc_setup_pipedir(pipefs_sb, clnt); 314 err = rpc_setup_pipedir(pipefs_sb, clnt);
@@ -331,6 +335,7 @@ err_auth:
331out: 335out:
332 if (pipefs_sb) 336 if (pipefs_sb)
333 rpc_put_sb_net(net); 337 rpc_put_sb_net(net);
338 rpc_clnt_debugfs_unregister(clnt);
334 return err; 339 return err;
335} 340}
336 341
@@ -670,6 +675,7 @@ int rpc_switch_client_transport(struct rpc_clnt *clnt,
670 675
671 rpc_unregister_client(clnt); 676 rpc_unregister_client(clnt);
672 __rpc_clnt_remove_pipedir(clnt); 677 __rpc_clnt_remove_pipedir(clnt);
678 rpc_clnt_debugfs_unregister(clnt);
673 679
674 /* 680 /*
675 * A new transport was created. "clnt" therefore 681 * A new transport was created. "clnt" therefore
@@ -771,6 +777,7 @@ rpc_free_client(struct rpc_clnt *clnt)
771 rcu_dereference(clnt->cl_xprt)->servername); 777 rcu_dereference(clnt->cl_xprt)->servername);
772 if (clnt->cl_parent != clnt) 778 if (clnt->cl_parent != clnt)
773 parent = clnt->cl_parent; 779 parent = clnt->cl_parent;
780 rpc_clnt_debugfs_unregister(clnt);
774 rpc_clnt_remove_pipedir(clnt); 781 rpc_clnt_remove_pipedir(clnt);
775 rpc_unregister_client(clnt); 782 rpc_unregister_client(clnt);
776 rpc_free_iostats(clnt->cl_metrics); 783 rpc_free_iostats(clnt->cl_metrics);
@@ -1396,8 +1403,9 @@ rpc_restart_call(struct rpc_task *task)
1396} 1403}
1397EXPORT_SYMBOL_GPL(rpc_restart_call); 1404EXPORT_SYMBOL_GPL(rpc_restart_call);
1398 1405
1399#ifdef RPC_DEBUG 1406#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
1400static const char *rpc_proc_name(const struct rpc_task *task) 1407const char
1408*rpc_proc_name(const struct rpc_task *task)
1401{ 1409{
1402 const struct rpc_procinfo *proc = task->tk_msg.rpc_proc; 1410 const struct rpc_procinfo *proc = task->tk_msg.rpc_proc;
1403 1411
@@ -2421,7 +2429,7 @@ struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, int
2421} 2429}
2422EXPORT_SYMBOL_GPL(rpc_call_null); 2430EXPORT_SYMBOL_GPL(rpc_call_null);
2423 2431
2424#ifdef RPC_DEBUG 2432#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
2425static void rpc_show_header(void) 2433static void rpc_show_header(void)
2426{ 2434{
2427 printk(KERN_INFO "-pid- flgs status -client- --rqstp- " 2435 printk(KERN_INFO "-pid- flgs status -client- --rqstp- "
diff --git a/net/sunrpc/debugfs.c b/net/sunrpc/debugfs.c
new file mode 100644
index 000000000000..e811f390f9f6
--- /dev/null
+++ b/net/sunrpc/debugfs.c
@@ -0,0 +1,292 @@
1/**
2 * debugfs interface for sunrpc
3 *
4 * (c) 2014 Jeff Layton <jlayton@primarydata.com>
5 */
6
7#include <linux/debugfs.h>
8#include <linux/sunrpc/sched.h>
9#include <linux/sunrpc/clnt.h>
10#include "netns.h"
11
12static struct dentry *topdir;
13static struct dentry *rpc_clnt_dir;
14static struct dentry *rpc_xprt_dir;
15
16struct rpc_clnt_iter {
17 struct rpc_clnt *clnt;
18 loff_t pos;
19};
20
21static int
22tasks_show(struct seq_file *f, void *v)
23{
24 u32 xid = 0;
25 struct rpc_task *task = v;
26 struct rpc_clnt *clnt = task->tk_client;
27 const char *rpc_waitq = "none";
28
29 if (RPC_IS_QUEUED(task))
30 rpc_waitq = rpc_qname(task->tk_waitqueue);
31
32 if (task->tk_rqstp)
33 xid = be32_to_cpu(task->tk_rqstp->rq_xid);
34
35 seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n",
36 task->tk_pid, task->tk_flags, task->tk_status,
37 clnt->cl_clid, xid, task->tk_timeout, task->tk_ops,
38 clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task),
39 task->tk_action, rpc_waitq);
40 return 0;
41}
42
43static void *
44tasks_start(struct seq_file *f, loff_t *ppos)
45 __acquires(&clnt->cl_lock)
46{
47 struct rpc_clnt_iter *iter = f->private;
48 loff_t pos = *ppos;
49 struct rpc_clnt *clnt = iter->clnt;
50 struct rpc_task *task;
51
52 iter->pos = pos + 1;
53 spin_lock(&clnt->cl_lock);
54 list_for_each_entry(task, &clnt->cl_tasks, tk_task)
55 if (pos-- == 0)
56 return task;
57 return NULL;
58}
59
60static void *
61tasks_next(struct seq_file *f, void *v, loff_t *pos)
62{
63 struct rpc_clnt_iter *iter = f->private;
64 struct rpc_clnt *clnt = iter->clnt;
65 struct rpc_task *task = v;
66 struct list_head *next = task->tk_task.next;
67
68 ++iter->pos;
69 ++*pos;
70
71 /* If there's another task on list, return it */
72 if (next == &clnt->cl_tasks)
73 return NULL;
74 return list_entry(next, struct rpc_task, tk_task);
75}
76
77static void
78tasks_stop(struct seq_file *f, void *v)
79 __releases(&clnt->cl_lock)
80{
81 struct rpc_clnt_iter *iter = f->private;
82 struct rpc_clnt *clnt = iter->clnt;
83
84 spin_unlock(&clnt->cl_lock);
85}
86
87static const struct seq_operations tasks_seq_operations = {
88 .start = tasks_start,
89 .next = tasks_next,
90 .stop = tasks_stop,
91 .show = tasks_show,
92};
93
94static int tasks_open(struct inode *inode, struct file *filp)
95{
96 int ret = seq_open_private(filp, &tasks_seq_operations,
97 sizeof(struct rpc_clnt_iter));
98
99 if (!ret) {
100 struct seq_file *seq = filp->private_data;
101 struct rpc_clnt_iter *iter = seq->private;
102
103 iter->clnt = inode->i_private;
104
105 if (!atomic_inc_not_zero(&iter->clnt->cl_count)) {
106 seq_release_private(inode, filp);
107 ret = -EINVAL;
108 }
109 }
110
111 return ret;
112}
113
114static int
115tasks_release(struct inode *inode, struct file *filp)
116{
117 struct seq_file *seq = filp->private_data;
118 struct rpc_clnt_iter *iter = seq->private;
119
120 rpc_release_client(iter->clnt);
121 return seq_release_private(inode, filp);
122}
123
124static const struct file_operations tasks_fops = {
125 .owner = THIS_MODULE,
126 .open = tasks_open,
127 .read = seq_read,
128 .llseek = seq_lseek,
129 .release = tasks_release,
130};
131
132int
133rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
134{
135 int len, err;
136 char name[24]; /* enough for "../../rpc_xprt/ + 8 hex digits + NULL */
137
138 /* Already registered? */
139 if (clnt->cl_debugfs)
140 return 0;
141
142 len = snprintf(name, sizeof(name), "%x", clnt->cl_clid);
143 if (len >= sizeof(name))
144 return -EINVAL;
145
146 /* make the per-client dir */
147 clnt->cl_debugfs = debugfs_create_dir(name, rpc_clnt_dir);
148 if (!clnt->cl_debugfs)
149 return -ENOMEM;
150
151 /* make tasks file */
152 err = -ENOMEM;
153 if (!debugfs_create_file("tasks", S_IFREG | S_IRUSR, clnt->cl_debugfs,
154 clnt, &tasks_fops))
155 goto out_err;
156
157 err = -EINVAL;
158 rcu_read_lock();
159 len = snprintf(name, sizeof(name), "../../rpc_xprt/%s",
160 rcu_dereference(clnt->cl_xprt)->debugfs->d_name.name);
161 rcu_read_unlock();
162 if (len >= sizeof(name))
163 goto out_err;
164
165 err = -ENOMEM;
166 if (!debugfs_create_symlink("xprt", clnt->cl_debugfs, name))
167 goto out_err;
168
169 return 0;
170out_err:
171 debugfs_remove_recursive(clnt->cl_debugfs);
172 clnt->cl_debugfs = NULL;
173 return err;
174}
175
176void
177rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
178{
179 debugfs_remove_recursive(clnt->cl_debugfs);
180 clnt->cl_debugfs = NULL;
181}
182
183static int
184xprt_info_show(struct seq_file *f, void *v)
185{
186 struct rpc_xprt *xprt = f->private;
187
188 seq_printf(f, "netid: %s\n", xprt->address_strings[RPC_DISPLAY_NETID]);
189 seq_printf(f, "addr: %s\n", xprt->address_strings[RPC_DISPLAY_ADDR]);
190 seq_printf(f, "port: %s\n", xprt->address_strings[RPC_DISPLAY_PORT]);
191 seq_printf(f, "state: 0x%lx\n", xprt->state);
192 return 0;
193}
194
195static int
196xprt_info_open(struct inode *inode, struct file *filp)
197{
198 int ret;
199 struct rpc_xprt *xprt = inode->i_private;
200
201 ret = single_open(filp, xprt_info_show, xprt);
202
203 if (!ret) {
204 if (!xprt_get(xprt)) {
205 single_release(inode, filp);
206 ret = -EINVAL;
207 }
208 }
209 return ret;
210}
211
212static int
213xprt_info_release(struct inode *inode, struct file *filp)
214{
215 struct rpc_xprt *xprt = inode->i_private;
216
217 xprt_put(xprt);
218 return single_release(inode, filp);
219}
220
221static const struct file_operations xprt_info_fops = {
222 .owner = THIS_MODULE,
223 .open = xprt_info_open,
224 .read = seq_read,
225 .llseek = seq_lseek,
226 .release = xprt_info_release,
227};
228
229int
230rpc_xprt_debugfs_register(struct rpc_xprt *xprt)
231{
232 int len, id;
233 static atomic_t cur_id;
234 char name[9]; /* 8 hex digits + NULL term */
235
236 id = (unsigned int)atomic_inc_return(&cur_id);
237
238 len = snprintf(name, sizeof(name), "%x", id);
239 if (len >= sizeof(name))
240 return -EINVAL;
241
242 /* make the per-client dir */
243 xprt->debugfs = debugfs_create_dir(name, rpc_xprt_dir);
244 if (!xprt->debugfs)
245 return -ENOMEM;
246
247 /* make tasks file */
248 if (!debugfs_create_file("info", S_IFREG | S_IRUSR, xprt->debugfs,
249 xprt, &xprt_info_fops)) {
250 debugfs_remove_recursive(xprt->debugfs);
251 xprt->debugfs = NULL;
252 return -ENOMEM;
253 }
254
255 return 0;
256}
257
258void
259rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt)
260{
261 debugfs_remove_recursive(xprt->debugfs);
262 xprt->debugfs = NULL;
263}
264
265void __exit
266sunrpc_debugfs_exit(void)
267{
268 debugfs_remove_recursive(topdir);
269}
270
271int __init
272sunrpc_debugfs_init(void)
273{
274 topdir = debugfs_create_dir("sunrpc", NULL);
275 if (!topdir)
276 goto out;
277
278 rpc_clnt_dir = debugfs_create_dir("rpc_clnt", topdir);
279 if (!rpc_clnt_dir)
280 goto out_remove;
281
282 rpc_xprt_dir = debugfs_create_dir("rpc_xprt", topdir);
283 if (!rpc_xprt_dir)
284 goto out_remove;
285
286 return 0;
287out_remove:
288 debugfs_remove_recursive(topdir);
289 topdir = NULL;
290out:
291 return -ENOMEM;
292}
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index 1891a1022c17..05202012bcfc 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -32,7 +32,7 @@
32 32
33#include "netns.h" 33#include "netns.h"
34 34
35#ifdef RPC_DEBUG 35#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
36# define RPCDBG_FACILITY RPCDBG_BIND 36# define RPCDBG_FACILITY RPCDBG_BIND
37#endif 37#endif
38 38
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index fe3441abdbe5..d20f2329eea3 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -24,7 +24,7 @@
24 24
25#include "sunrpc.h" 25#include "sunrpc.h"
26 26
27#ifdef RPC_DEBUG 27#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
28#define RPCDBG_FACILITY RPCDBG_SCHED 28#define RPCDBG_FACILITY RPCDBG_SCHED
29#endif 29#endif
30 30
@@ -258,7 +258,7 @@ static int rpc_wait_bit_killable(struct wait_bit_key *key)
258 return 0; 258 return 0;
259} 259}
260 260
261#if defined(RPC_DEBUG) || defined(RPC_TRACEPOINTS) 261#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
262static void rpc_task_set_debuginfo(struct rpc_task *task) 262static void rpc_task_set_debuginfo(struct rpc_task *task)
263{ 263{
264 static atomic_t rpc_pid; 264 static atomic_t rpc_pid;
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 54530490944e..9711a155bc50 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -116,7 +116,15 @@ EXPORT_SYMBOL_GPL(svc_seq_show);
116 */ 116 */
117struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) 117struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt)
118{ 118{
119 return kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); 119 struct rpc_iostats *stats;
120 int i;
121
122 stats = kcalloc(clnt->cl_maxproc, sizeof(*stats), GFP_KERNEL);
123 if (stats) {
124 for (i = 0; i < clnt->cl_maxproc; i++)
125 spin_lock_init(&stats[i].om_lock);
126 }
127 return stats;
120} 128}
121EXPORT_SYMBOL_GPL(rpc_alloc_iostats); 129EXPORT_SYMBOL_GPL(rpc_alloc_iostats);
122 130
@@ -135,20 +143,21 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats);
135 * rpc_count_iostats - tally up per-task stats 143 * rpc_count_iostats - tally up per-task stats
136 * @task: completed rpc_task 144 * @task: completed rpc_task
137 * @stats: array of stat structures 145 * @stats: array of stat structures
138 *
139 * Relies on the caller for serialization.
140 */ 146 */
141void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats) 147void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
142{ 148{
143 struct rpc_rqst *req = task->tk_rqstp; 149 struct rpc_rqst *req = task->tk_rqstp;
144 struct rpc_iostats *op_metrics; 150 struct rpc_iostats *op_metrics;
145 ktime_t delta; 151 ktime_t delta, now;
146 152
147 if (!stats || !req) 153 if (!stats || !req)
148 return; 154 return;
149 155
156 now = ktime_get();
150 op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx]; 157 op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
151 158
159 spin_lock(&op_metrics->om_lock);
160
152 op_metrics->om_ops++; 161 op_metrics->om_ops++;
153 op_metrics->om_ntrans += req->rq_ntrans; 162 op_metrics->om_ntrans += req->rq_ntrans;
154 op_metrics->om_timeouts += task->tk_timeouts; 163 op_metrics->om_timeouts += task->tk_timeouts;
@@ -161,8 +170,10 @@ void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
161 170
162 op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt); 171 op_metrics->om_rtt = ktime_add(op_metrics->om_rtt, req->rq_rtt);
163 172
164 delta = ktime_sub(ktime_get(), task->tk_start); 173 delta = ktime_sub(now, task->tk_start);
165 op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta); 174 op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta);
175
176 spin_unlock(&op_metrics->om_lock);
166} 177}
167EXPORT_SYMBOL_GPL(rpc_count_iostats); 178EXPORT_SYMBOL_GPL(rpc_count_iostats);
168 179
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index cd30120de9e4..e37fbed87956 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -97,13 +97,20 @@ init_sunrpc(void)
97 err = register_rpc_pipefs(); 97 err = register_rpc_pipefs();
98 if (err) 98 if (err)
99 goto out4; 99 goto out4;
100#ifdef RPC_DEBUG 100
101 err = sunrpc_debugfs_init();
102 if (err)
103 goto out5;
104
105#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
101 rpc_register_sysctl(); 106 rpc_register_sysctl();
102#endif 107#endif
103 svc_init_xprt_sock(); /* svc sock transport */ 108 svc_init_xprt_sock(); /* svc sock transport */
104 init_socket_xprt(); /* clnt sock transport */ 109 init_socket_xprt(); /* clnt sock transport */
105 return 0; 110 return 0;
106 111
112out5:
113 unregister_rpc_pipefs();
107out4: 114out4:
108 unregister_pernet_subsys(&sunrpc_net_ops); 115 unregister_pernet_subsys(&sunrpc_net_ops);
109out3: 116out3:
@@ -120,10 +127,11 @@ cleanup_sunrpc(void)
120 rpcauth_remove_module(); 127 rpcauth_remove_module();
121 cleanup_socket_xprt(); 128 cleanup_socket_xprt();
122 svc_cleanup_xprt_sock(); 129 svc_cleanup_xprt_sock();
130 sunrpc_debugfs_exit();
123 unregister_rpc_pipefs(); 131 unregister_rpc_pipefs();
124 rpc_destroy_mempool(); 132 rpc_destroy_mempool();
125 unregister_pernet_subsys(&sunrpc_net_ops); 133 unregister_pernet_subsys(&sunrpc_net_ops);
126#ifdef RPC_DEBUG 134#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
127 rpc_unregister_sysctl(); 135 rpc_unregister_sysctl();
128#endif 136#endif
129 rcu_barrier(); /* Wait for completion of call_rcu()'s */ 137 rcu_barrier(); /* Wait for completion of call_rcu()'s */
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 537add5309cc..163df468d6d5 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -28,6 +28,8 @@
28#include <linux/sunrpc/clnt.h> 28#include <linux/sunrpc/clnt.h>
29#include <linux/sunrpc/bc_xprt.h> 29#include <linux/sunrpc/bc_xprt.h>
30 30
31#include <trace/events/sunrpc.h>
32
31#define RPCDBG_FACILITY RPCDBG_SVCDSP 33#define RPCDBG_FACILITY RPCDBG_SVCDSP
32 34
33static void svc_unregister(const struct svc_serv *serv, struct net *net); 35static void svc_unregister(const struct svc_serv *serv, struct net *net);
@@ -1042,7 +1044,7 @@ static void svc_unregister(const struct svc_serv *serv, struct net *net)
1042/* 1044/*
1043 * dprintk the given error with the address of the client that caused it. 1045 * dprintk the given error with the address of the client that caused it.
1044 */ 1046 */
1045#ifdef RPC_DEBUG 1047#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
1046static __printf(2, 3) 1048static __printf(2, 3)
1047void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) 1049void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
1048{ 1050{
@@ -1316,24 +1318,25 @@ svc_process(struct svc_rqst *rqstp)
1316 rqstp->rq_res.tail[0].iov_base = NULL; 1318 rqstp->rq_res.tail[0].iov_base = NULL;
1317 rqstp->rq_res.tail[0].iov_len = 0; 1319 rqstp->rq_res.tail[0].iov_len = 0;
1318 1320
1319 rqstp->rq_xid = svc_getu32(argv);
1320
1321 dir = svc_getnl(argv); 1321 dir = svc_getnl(argv);
1322 if (dir != 0) { 1322 if (dir != 0) {
1323 /* direction != CALL */ 1323 /* direction != CALL */
1324 svc_printk(rqstp, "bad direction %d, dropping request\n", dir); 1324 svc_printk(rqstp, "bad direction %d, dropping request\n", dir);
1325 serv->sv_stats->rpcbadfmt++; 1325 serv->sv_stats->rpcbadfmt++;
1326 svc_drop(rqstp); 1326 goto out_drop;
1327 return 0;
1328 } 1327 }
1329 1328
1330 /* Returns 1 for send, 0 for drop */ 1329 /* Returns 1 for send, 0 for drop */
1331 if (svc_process_common(rqstp, argv, resv)) 1330 if (likely(svc_process_common(rqstp, argv, resv))) {
1332 return svc_send(rqstp); 1331 int ret = svc_send(rqstp);
1333 else { 1332
1334 svc_drop(rqstp); 1333 trace_svc_process(rqstp, ret);
1335 return 0; 1334 return ret;
1336 } 1335 }
1336out_drop:
1337 trace_svc_process(rqstp, 0);
1338 svc_drop(rqstp);
1339 return 0;
1337} 1340}
1338 1341
1339#if defined(CONFIG_SUNRPC_BACKCHANNEL) 1342#if defined(CONFIG_SUNRPC_BACKCHANNEL)
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 97a75c17142b..5c71ccb9659d 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -15,6 +15,7 @@
15#include <linux/sunrpc/svcsock.h> 15#include <linux/sunrpc/svcsock.h>
16#include <linux/sunrpc/xprt.h> 16#include <linux/sunrpc/xprt.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <trace/events/sunrpc.h>
18 19
19#define RPCDBG_FACILITY RPCDBG_SVCXPRT 20#define RPCDBG_FACILITY RPCDBG_SVCXPRT
20 21
@@ -773,35 +774,43 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
773 774
774 err = svc_alloc_arg(rqstp); 775 err = svc_alloc_arg(rqstp);
775 if (err) 776 if (err)
776 return err; 777 goto out;
777 778
778 try_to_freeze(); 779 try_to_freeze();
779 cond_resched(); 780 cond_resched();
781 err = -EINTR;
780 if (signalled() || kthread_should_stop()) 782 if (signalled() || kthread_should_stop())
781 return -EINTR; 783 goto out;
782 784
783 xprt = svc_get_next_xprt(rqstp, timeout); 785 xprt = svc_get_next_xprt(rqstp, timeout);
784 if (IS_ERR(xprt)) 786 if (IS_ERR(xprt)) {
785 return PTR_ERR(xprt); 787 err = PTR_ERR(xprt);
788 goto out;
789 }
786 790
787 len = svc_handle_xprt(rqstp, xprt); 791 len = svc_handle_xprt(rqstp, xprt);
788 792
789 /* No data, incomplete (TCP) read, or accept() */ 793 /* No data, incomplete (TCP) read, or accept() */
794 err = -EAGAIN;
790 if (len <= 0) 795 if (len <= 0)
791 goto out; 796 goto out_release;
792 797
793 clear_bit(XPT_OLD, &xprt->xpt_flags); 798 clear_bit(XPT_OLD, &xprt->xpt_flags);
794 799
795 rqstp->rq_secure = xprt->xpt_ops->xpo_secure_port(rqstp); 800 rqstp->rq_secure = xprt->xpt_ops->xpo_secure_port(rqstp);
796 rqstp->rq_chandle.defer = svc_defer; 801 rqstp->rq_chandle.defer = svc_defer;
802 rqstp->rq_xid = svc_getu32(&rqstp->rq_arg.head[0]);
797 803
798 if (serv->sv_stats) 804 if (serv->sv_stats)
799 serv->sv_stats->netcnt++; 805 serv->sv_stats->netcnt++;
806 trace_svc_recv(rqstp, len);
800 return len; 807 return len;
801out: 808out_release:
802 rqstp->rq_res.len = 0; 809 rqstp->rq_res.len = 0;
803 svc_xprt_release(rqstp); 810 svc_xprt_release(rqstp);
804 return -EAGAIN; 811out:
812 trace_svc_recv(rqstp, err);
813 return err;
805} 814}
806EXPORT_SYMBOL_GPL(svc_recv); 815EXPORT_SYMBOL_GPL(svc_recv);
807 816
@@ -821,12 +830,12 @@ EXPORT_SYMBOL_GPL(svc_drop);
821int svc_send(struct svc_rqst *rqstp) 830int svc_send(struct svc_rqst *rqstp)
822{ 831{
823 struct svc_xprt *xprt; 832 struct svc_xprt *xprt;
824 int len; 833 int len = -EFAULT;
825 struct xdr_buf *xb; 834 struct xdr_buf *xb;
826 835
827 xprt = rqstp->rq_xprt; 836 xprt = rqstp->rq_xprt;
828 if (!xprt) 837 if (!xprt)
829 return -EFAULT; 838 goto out;
830 839
831 /* release the receive skb before sending the reply */ 840 /* release the receive skb before sending the reply */
832 rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp); 841 rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
@@ -849,7 +858,9 @@ int svc_send(struct svc_rqst *rqstp)
849 svc_xprt_release(rqstp); 858 svc_xprt_release(rqstp);
850 859
851 if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) 860 if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN)
852 return 0; 861 len = 0;
862out:
863 trace_svc_send(rqstp, len);
853 return len; 864 return len;
854} 865}
855 866
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index c99c58e2ee66..887f0183b4c6 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -37,7 +37,7 @@ EXPORT_SYMBOL_GPL(nfsd_debug);
37unsigned int nlm_debug; 37unsigned int nlm_debug;
38EXPORT_SYMBOL_GPL(nlm_debug); 38EXPORT_SYMBOL_GPL(nlm_debug);
39 39
40#ifdef RPC_DEBUG 40#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
41 41
42static struct ctl_table_header *sunrpc_table_header; 42static struct ctl_table_header *sunrpc_table_header;
43static struct ctl_table sunrpc_table[]; 43static struct ctl_table sunrpc_table[];
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 56e4e150e80e..ebbefad21a37 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -49,13 +49,15 @@
49#include <linux/sunrpc/metrics.h> 49#include <linux/sunrpc/metrics.h>
50#include <linux/sunrpc/bc_xprt.h> 50#include <linux/sunrpc/bc_xprt.h>
51 51
52#include <trace/events/sunrpc.h>
53
52#include "sunrpc.h" 54#include "sunrpc.h"
53 55
54/* 56/*
55 * Local variables 57 * Local variables
56 */ 58 */
57 59
58#ifdef RPC_DEBUG 60#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
59# define RPCDBG_FACILITY RPCDBG_XPRT 61# define RPCDBG_FACILITY RPCDBG_XPRT
60#endif 62#endif
61 63
@@ -772,11 +774,14 @@ struct rpc_rqst *xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid)
772 struct rpc_rqst *entry; 774 struct rpc_rqst *entry;
773 775
774 list_for_each_entry(entry, &xprt->recv, rq_list) 776 list_for_each_entry(entry, &xprt->recv, rq_list)
775 if (entry->rq_xid == xid) 777 if (entry->rq_xid == xid) {
778 trace_xprt_lookup_rqst(xprt, xid, 0);
776 return entry; 779 return entry;
780 }
777 781
778 dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n", 782 dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n",
779 ntohl(xid)); 783 ntohl(xid));
784 trace_xprt_lookup_rqst(xprt, xid, -ENOENT);
780 xprt->stat.bad_xids++; 785 xprt->stat.bad_xids++;
781 return NULL; 786 return NULL;
782} 787}
@@ -810,6 +815,7 @@ void xprt_complete_rqst(struct rpc_task *task, int copied)
810 815
811 dprintk("RPC: %5u xid %08x complete (%d bytes received)\n", 816 dprintk("RPC: %5u xid %08x complete (%d bytes received)\n",
812 task->tk_pid, ntohl(req->rq_xid), copied); 817 task->tk_pid, ntohl(req->rq_xid), copied);
818 trace_xprt_complete_rqst(xprt, req->rq_xid, copied);
813 819
814 xprt->stat.recvs++; 820 xprt->stat.recvs++;
815 req->rq_rtt = ktime_sub(ktime_get(), req->rq_xtime); 821 req->rq_rtt = ktime_sub(ktime_get(), req->rq_xtime);
@@ -926,6 +932,7 @@ void xprt_transmit(struct rpc_task *task)
926 932
927 req->rq_xtime = ktime_get(); 933 req->rq_xtime = ktime_get();
928 status = xprt->ops->send_request(task); 934 status = xprt->ops->send_request(task);
935 trace_xprt_transmit(xprt, req->rq_xid, status);
929 if (status != 0) { 936 if (status != 0) {
930 task->tk_status = status; 937 task->tk_status = status;
931 return; 938 return;
@@ -1296,6 +1303,7 @@ static void xprt_init(struct rpc_xprt *xprt, struct net *net)
1296 */ 1303 */
1297struct rpc_xprt *xprt_create_transport(struct xprt_create *args) 1304struct rpc_xprt *xprt_create_transport(struct xprt_create *args)
1298{ 1305{
1306 int err;
1299 struct rpc_xprt *xprt; 1307 struct rpc_xprt *xprt;
1300 struct xprt_class *t; 1308 struct xprt_class *t;
1301 1309
@@ -1336,6 +1344,12 @@ found:
1336 return ERR_PTR(-ENOMEM); 1344 return ERR_PTR(-ENOMEM);
1337 } 1345 }
1338 1346
1347 err = rpc_xprt_debugfs_register(xprt);
1348 if (err) {
1349 xprt_destroy(xprt);
1350 return ERR_PTR(err);
1351 }
1352
1339 dprintk("RPC: created transport %p with %u slots\n", xprt, 1353 dprintk("RPC: created transport %p with %u slots\n", xprt,
1340 xprt->max_reqs); 1354 xprt->max_reqs);
1341out: 1355out:
@@ -1352,6 +1366,7 @@ static void xprt_destroy(struct rpc_xprt *xprt)
1352 dprintk("RPC: destroying transport %p\n", xprt); 1366 dprintk("RPC: destroying transport %p\n", xprt);
1353 del_timer_sync(&xprt->timer); 1367 del_timer_sync(&xprt->timer);
1354 1368
1369 rpc_xprt_debugfs_unregister(xprt);
1355 rpc_destroy_wait_queue(&xprt->binding); 1370 rpc_destroy_wait_queue(&xprt->binding);
1356 rpc_destroy_wait_queue(&xprt->pending); 1371 rpc_destroy_wait_queue(&xprt->pending);
1357 rpc_destroy_wait_queue(&xprt->sending); 1372 rpc_destroy_wait_queue(&xprt->sending);
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 6166c985fe24..df01d124936c 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -49,11 +49,11 @@
49 49
50#include <linux/highmem.h> 50#include <linux/highmem.h>
51 51
52#ifdef RPC_DEBUG 52#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
53# define RPCDBG_FACILITY RPCDBG_TRANS 53# define RPCDBG_FACILITY RPCDBG_TRANS
54#endif 54#endif
55 55
56#ifdef RPC_DEBUG 56#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
57static const char transfertypes[][12] = { 57static const char transfertypes[][12] = {
58 "pure inline", /* no chunks */ 58 "pure inline", /* no chunks */
59 " read chunk", /* some argument via rdma read */ 59 " read chunk", /* some argument via rdma read */
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 6a4615dd0261..bbd6155d3e34 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -55,7 +55,7 @@
55 55
56#include "xprt_rdma.h" 56#include "xprt_rdma.h"
57 57
58#ifdef RPC_DEBUG 58#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
59# define RPCDBG_FACILITY RPCDBG_TRANS 59# define RPCDBG_FACILITY RPCDBG_TRANS
60#endif 60#endif
61 61
@@ -73,9 +73,9 @@ static unsigned int xprt_rdma_max_inline_read = RPCRDMA_DEF_INLINE;
73static unsigned int xprt_rdma_max_inline_write = RPCRDMA_DEF_INLINE; 73static unsigned int xprt_rdma_max_inline_write = RPCRDMA_DEF_INLINE;
74static unsigned int xprt_rdma_inline_write_padding; 74static unsigned int xprt_rdma_inline_write_padding;
75static unsigned int xprt_rdma_memreg_strategy = RPCRDMA_FRMR; 75static unsigned int xprt_rdma_memreg_strategy = RPCRDMA_FRMR;
76 int xprt_rdma_pad_optimize = 0; 76 int xprt_rdma_pad_optimize = 1;
77 77
78#ifdef RPC_DEBUG 78#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
79 79
80static unsigned int min_slot_table_size = RPCRDMA_MIN_SLOT_TABLE; 80static unsigned int min_slot_table_size = RPCRDMA_MIN_SLOT_TABLE;
81static unsigned int max_slot_table_size = RPCRDMA_MAX_SLOT_TABLE; 81static unsigned int max_slot_table_size = RPCRDMA_MAX_SLOT_TABLE;
@@ -599,7 +599,7 @@ xprt_rdma_send_request(struct rpc_task *task)
599 599
600 if (req->rl_niovs == 0) 600 if (req->rl_niovs == 0)
601 rc = rpcrdma_marshal_req(rqst); 601 rc = rpcrdma_marshal_req(rqst);
602 else if (r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR) 602 else if (r_xprt->rx_ia.ri_memreg_strategy != RPCRDMA_ALLPHYSICAL)
603 rc = rpcrdma_marshal_chunks(rqst, 0); 603 rc = rpcrdma_marshal_chunks(rqst, 0);
604 if (rc < 0) 604 if (rc < 0)
605 goto failed_marshal; 605 goto failed_marshal;
@@ -705,7 +705,7 @@ static void __exit xprt_rdma_cleanup(void)
705 int rc; 705 int rc;
706 706
707 dprintk("RPCRDMA Module Removed, deregister RPC RDMA transport\n"); 707 dprintk("RPCRDMA Module Removed, deregister RPC RDMA transport\n");
708#ifdef RPC_DEBUG 708#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
709 if (sunrpc_table_header) { 709 if (sunrpc_table_header) {
710 unregister_sysctl_table(sunrpc_table_header); 710 unregister_sysctl_table(sunrpc_table_header);
711 sunrpc_table_header = NULL; 711 sunrpc_table_header = NULL;
@@ -736,7 +736,7 @@ static int __init xprt_rdma_init(void)
736 dprintk("\tPadding %d\n\tMemreg %d\n", 736 dprintk("\tPadding %d\n\tMemreg %d\n",
737 xprt_rdma_inline_write_padding, xprt_rdma_memreg_strategy); 737 xprt_rdma_inline_write_padding, xprt_rdma_memreg_strategy);
738 738
739#ifdef RPC_DEBUG 739#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
740 if (!sunrpc_table_header) 740 if (!sunrpc_table_header)
741 sunrpc_table_header = register_sysctl_table(sunrpc_table); 741 sunrpc_table_header = register_sysctl_table(sunrpc_table);
742#endif 742#endif
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 61c41298b4ea..c98e40643910 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -57,11 +57,12 @@
57 * Globals/Macros 57 * Globals/Macros
58 */ 58 */
59 59
60#ifdef RPC_DEBUG 60#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
61# define RPCDBG_FACILITY RPCDBG_TRANS 61# define RPCDBG_FACILITY RPCDBG_TRANS
62#endif 62#endif
63 63
64static void rpcrdma_reset_frmrs(struct rpcrdma_ia *); 64static void rpcrdma_reset_frmrs(struct rpcrdma_ia *);
65static void rpcrdma_reset_fmrs(struct rpcrdma_ia *);
65 66
66/* 67/*
67 * internal functions 68 * internal functions
@@ -105,13 +106,51 @@ rpcrdma_run_tasklet(unsigned long data)
105 106
106static DECLARE_TASKLET(rpcrdma_tasklet_g, rpcrdma_run_tasklet, 0UL); 107static DECLARE_TASKLET(rpcrdma_tasklet_g, rpcrdma_run_tasklet, 0UL);
107 108
109static const char * const async_event[] = {
110 "CQ error",
111 "QP fatal error",
112 "QP request error",
113 "QP access error",
114 "communication established",
115 "send queue drained",
116 "path migration successful",
117 "path mig error",
118 "device fatal error",
119 "port active",
120 "port error",
121 "LID change",
122 "P_key change",
123 "SM change",
124 "SRQ error",
125 "SRQ limit reached",
126 "last WQE reached",
127 "client reregister",
128 "GID change",
129};
130
131#define ASYNC_MSG(status) \
132 ((status) < ARRAY_SIZE(async_event) ? \
133 async_event[(status)] : "unknown async error")
134
135static void
136rpcrdma_schedule_tasklet(struct list_head *sched_list)
137{
138 unsigned long flags;
139
140 spin_lock_irqsave(&rpcrdma_tk_lock_g, flags);
141 list_splice_tail(sched_list, &rpcrdma_tasklets_g);
142 spin_unlock_irqrestore(&rpcrdma_tk_lock_g, flags);
143 tasklet_schedule(&rpcrdma_tasklet_g);
144}
145
108static void 146static void
109rpcrdma_qp_async_error_upcall(struct ib_event *event, void *context) 147rpcrdma_qp_async_error_upcall(struct ib_event *event, void *context)
110{ 148{
111 struct rpcrdma_ep *ep = context; 149 struct rpcrdma_ep *ep = context;
112 150
113 dprintk("RPC: %s: QP error %X on device %s ep %p\n", 151 pr_err("RPC: %s: %s on device %s ep %p\n",
114 __func__, event->event, event->device->name, context); 152 __func__, ASYNC_MSG(event->event),
153 event->device->name, context);
115 if (ep->rep_connected == 1) { 154 if (ep->rep_connected == 1) {
116 ep->rep_connected = -EIO; 155 ep->rep_connected = -EIO;
117 ep->rep_func(ep); 156 ep->rep_func(ep);
@@ -124,8 +163,9 @@ rpcrdma_cq_async_error_upcall(struct ib_event *event, void *context)
124{ 163{
125 struct rpcrdma_ep *ep = context; 164 struct rpcrdma_ep *ep = context;
126 165
127 dprintk("RPC: %s: CQ error %X on device %s ep %p\n", 166 pr_err("RPC: %s: %s on device %s ep %p\n",
128 __func__, event->event, event->device->name, context); 167 __func__, ASYNC_MSG(event->event),
168 event->device->name, context);
129 if (ep->rep_connected == 1) { 169 if (ep->rep_connected == 1) {
130 ep->rep_connected = -EIO; 170 ep->rep_connected = -EIO;
131 ep->rep_func(ep); 171 ep->rep_func(ep);
@@ -243,7 +283,6 @@ rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
243 struct list_head sched_list; 283 struct list_head sched_list;
244 struct ib_wc *wcs; 284 struct ib_wc *wcs;
245 int budget, count, rc; 285 int budget, count, rc;
246 unsigned long flags;
247 286
248 INIT_LIST_HEAD(&sched_list); 287 INIT_LIST_HEAD(&sched_list);
249 budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE; 288 budget = RPCRDMA_WC_BUDGET / RPCRDMA_POLLSIZE;
@@ -261,10 +300,7 @@ rpcrdma_recvcq_poll(struct ib_cq *cq, struct rpcrdma_ep *ep)
261 rc = 0; 300 rc = 0;
262 301
263out_schedule: 302out_schedule:
264 spin_lock_irqsave(&rpcrdma_tk_lock_g, flags); 303 rpcrdma_schedule_tasklet(&sched_list);
265 list_splice_tail(&sched_list, &rpcrdma_tasklets_g);
266 spin_unlock_irqrestore(&rpcrdma_tk_lock_g, flags);
267 tasklet_schedule(&rpcrdma_tasklet_g);
268 return rc; 304 return rc;
269} 305}
270 306
@@ -309,11 +345,18 @@ rpcrdma_recvcq_upcall(struct ib_cq *cq, void *cq_context)
309static void 345static void
310rpcrdma_flush_cqs(struct rpcrdma_ep *ep) 346rpcrdma_flush_cqs(struct rpcrdma_ep *ep)
311{ 347{
312 rpcrdma_recvcq_upcall(ep->rep_attr.recv_cq, ep); 348 struct ib_wc wc;
313 rpcrdma_sendcq_upcall(ep->rep_attr.send_cq, ep); 349 LIST_HEAD(sched_list);
350
351 while (ib_poll_cq(ep->rep_attr.recv_cq, 1, &wc) > 0)
352 rpcrdma_recvcq_process_wc(&wc, &sched_list);
353 if (!list_empty(&sched_list))
354 rpcrdma_schedule_tasklet(&sched_list);
355 while (ib_poll_cq(ep->rep_attr.send_cq, 1, &wc) > 0)
356 rpcrdma_sendcq_process_wc(&wc);
314} 357}
315 358
316#ifdef RPC_DEBUG 359#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
317static const char * const conn[] = { 360static const char * const conn[] = {
318 "address resolved", 361 "address resolved",
319 "address error", 362 "address error",
@@ -344,7 +387,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
344 struct rpcrdma_xprt *xprt = id->context; 387 struct rpcrdma_xprt *xprt = id->context;
345 struct rpcrdma_ia *ia = &xprt->rx_ia; 388 struct rpcrdma_ia *ia = &xprt->rx_ia;
346 struct rpcrdma_ep *ep = &xprt->rx_ep; 389 struct rpcrdma_ep *ep = &xprt->rx_ep;
347#ifdef RPC_DEBUG 390#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
348 struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr; 391 struct sockaddr_in *addr = (struct sockaddr_in *) &ep->rep_remote_addr;
349#endif 392#endif
350 struct ib_qp_attr attr; 393 struct ib_qp_attr attr;
@@ -408,7 +451,7 @@ connected:
408 break; 451 break;
409 } 452 }
410 453
411#ifdef RPC_DEBUG 454#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
412 if (connstate == 1) { 455 if (connstate == 1) {
413 int ird = attr.max_dest_rd_atomic; 456 int ird = attr.max_dest_rd_atomic;
414 int tird = ep->rep_remote_cma.responder_resources; 457 int tird = ep->rep_remote_cma.responder_resources;
@@ -733,7 +776,9 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
733 776
734 /* set trigger for requesting send completion */ 777 /* set trigger for requesting send completion */
735 ep->rep_cqinit = ep->rep_attr.cap.max_send_wr/2 - 1; 778 ep->rep_cqinit = ep->rep_attr.cap.max_send_wr/2 - 1;
736 if (ep->rep_cqinit <= 2) 779 if (ep->rep_cqinit > RPCRDMA_MAX_UNSIGNALED_SENDS)
780 ep->rep_cqinit = RPCRDMA_MAX_UNSIGNALED_SENDS;
781 else if (ep->rep_cqinit <= 2)
737 ep->rep_cqinit = 0; 782 ep->rep_cqinit = 0;
738 INIT_CQCOUNT(ep); 783 INIT_CQCOUNT(ep);
739 ep->rep_ia = ia; 784 ep->rep_ia = ia;
@@ -866,8 +911,19 @@ retry:
866 rpcrdma_ep_disconnect(ep, ia); 911 rpcrdma_ep_disconnect(ep, ia);
867 rpcrdma_flush_cqs(ep); 912 rpcrdma_flush_cqs(ep);
868 913
869 if (ia->ri_memreg_strategy == RPCRDMA_FRMR) 914 switch (ia->ri_memreg_strategy) {
915 case RPCRDMA_FRMR:
870 rpcrdma_reset_frmrs(ia); 916 rpcrdma_reset_frmrs(ia);
917 break;
918 case RPCRDMA_MTHCAFMR:
919 rpcrdma_reset_fmrs(ia);
920 break;
921 case RPCRDMA_ALLPHYSICAL:
922 break;
923 default:
924 rc = -EIO;
925 goto out;
926 }
871 927
872 xprt = container_of(ia, struct rpcrdma_xprt, rx_ia); 928 xprt = container_of(ia, struct rpcrdma_xprt, rx_ia);
873 id = rpcrdma_create_id(xprt, ia, 929 id = rpcrdma_create_id(xprt, ia,
@@ -1287,6 +1343,34 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf)
1287 kfree(buf->rb_pool); 1343 kfree(buf->rb_pool);
1288} 1344}
1289 1345
1346/* After a disconnect, unmap all FMRs.
1347 *
1348 * This is invoked only in the transport connect worker in order
1349 * to serialize with rpcrdma_register_fmr_external().
1350 */
1351static void
1352rpcrdma_reset_fmrs(struct rpcrdma_ia *ia)
1353{
1354 struct rpcrdma_xprt *r_xprt =
1355 container_of(ia, struct rpcrdma_xprt, rx_ia);
1356 struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
1357 struct list_head *pos;
1358 struct rpcrdma_mw *r;
1359 LIST_HEAD(l);
1360 int rc;
1361
1362 list_for_each(pos, &buf->rb_all) {
1363 r = list_entry(pos, struct rpcrdma_mw, mw_all);
1364
1365 INIT_LIST_HEAD(&l);
1366 list_add(&r->r.fmr->list, &l);
1367 rc = ib_unmap_fmr(&l);
1368 if (rc)
1369 dprintk("RPC: %s: ib_unmap_fmr failed %i\n",
1370 __func__, rc);
1371 }
1372}
1373
1290/* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in 1374/* After a disconnect, a flushed FAST_REG_MR can leave an FRMR in
1291 * an unusable state. Find FRMRs in this state and dereg / reg 1375 * an unusable state. Find FRMRs in this state and dereg / reg
1292 * each. FRMRs that are VALID and attached to an rpcrdma_req are 1376 * each. FRMRs that are VALID and attached to an rpcrdma_req are
@@ -1918,10 +2002,10 @@ rpcrdma_register_external(struct rpcrdma_mr_seg *seg,
1918 break; 2002 break;
1919 2003
1920 default: 2004 default:
1921 return -1; 2005 return -EIO;
1922 } 2006 }
1923 if (rc) 2007 if (rc)
1924 return -1; 2008 return rc;
1925 2009
1926 return nsegs; 2010 return nsegs;
1927} 2011}
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index ac7fc9a31342..b799041b75bf 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -97,6 +97,12 @@ struct rpcrdma_ep {
97 struct ib_wc rep_recv_wcs[RPCRDMA_POLLSIZE]; 97 struct ib_wc rep_recv_wcs[RPCRDMA_POLLSIZE];
98}; 98};
99 99
100/*
101 * Force a signaled SEND Work Request every so often,
102 * in case the provider needs to do some housekeeping.
103 */
104#define RPCRDMA_MAX_UNSIGNALED_SENDS (32)
105
100#define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit) 106#define INIT_CQCOUNT(ep) atomic_set(&(ep)->rep_cqcount, (ep)->rep_cqinit)
101#define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount) 107#define DECR_CQCOUNT(ep) atomic_sub_return(1, &(ep)->rep_cqcount)
102 108
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 3b305ab17afe..87ce7e8bb8dc 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -75,7 +75,7 @@ static unsigned int xs_tcp_fin_timeout __read_mostly = XS_TCP_LINGER_TO;
75 * someone else's file names! 75 * someone else's file names!
76 */ 76 */
77 77
78#ifdef RPC_DEBUG 78#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
79 79
80static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE; 80static unsigned int min_slot_table_size = RPC_MIN_SLOT_TABLE;
81static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE; 81static unsigned int max_slot_table_size = RPC_MAX_SLOT_TABLE;
@@ -186,7 +186,7 @@ static struct ctl_table sunrpc_table[] = {
186 */ 186 */
187#define XS_IDLE_DISC_TO (5U * 60 * HZ) 187#define XS_IDLE_DISC_TO (5U * 60 * HZ)
188 188
189#ifdef RPC_DEBUG 189#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
190# undef RPC_DEBUG_DATA 190# undef RPC_DEBUG_DATA
191# define RPCDBG_FACILITY RPCDBG_TRANS 191# define RPCDBG_FACILITY RPCDBG_TRANS
192#endif 192#endif
@@ -216,65 +216,6 @@ static inline void xs_pktdump(char *msg, u32 *packet, unsigned int count)
216} 216}
217#endif 217#endif
218 218
219struct sock_xprt {
220 struct rpc_xprt xprt;
221
222 /*
223 * Network layer
224 */
225 struct socket * sock;
226 struct sock * inet;
227
228 /*
229 * State of TCP reply receive
230 */
231 __be32 tcp_fraghdr,
232 tcp_xid,
233 tcp_calldir;
234
235 u32 tcp_offset,
236 tcp_reclen;
237
238 unsigned long tcp_copied,
239 tcp_flags;
240
241 /*
242 * Connection of transports
243 */
244 struct delayed_work connect_worker;
245 struct sockaddr_storage srcaddr;
246 unsigned short srcport;
247
248 /*
249 * UDP socket buffer size parameters
250 */
251 size_t rcvsize,
252 sndsize;
253
254 /*
255 * Saved socket callback addresses
256 */
257 void (*old_data_ready)(struct sock *);
258 void (*old_state_change)(struct sock *);
259 void (*old_write_space)(struct sock *);
260 void (*old_error_report)(struct sock *);
261};
262
263/*
264 * TCP receive state flags
265 */
266#define TCP_RCV_LAST_FRAG (1UL << 0)
267#define TCP_RCV_COPY_FRAGHDR (1UL << 1)
268#define TCP_RCV_COPY_XID (1UL << 2)
269#define TCP_RCV_COPY_DATA (1UL << 3)
270#define TCP_RCV_READ_CALLDIR (1UL << 4)
271#define TCP_RCV_COPY_CALLDIR (1UL << 5)
272
273/*
274 * TCP RPC flags
275 */
276#define TCP_RPC_REPLY (1UL << 6)
277
278static inline struct rpc_xprt *xprt_from_sock(struct sock *sk) 219static inline struct rpc_xprt *xprt_from_sock(struct sock *sk)
279{ 220{
280 return (struct rpc_xprt *) sk->sk_user_data; 221 return (struct rpc_xprt *) sk->sk_user_data;
@@ -1415,6 +1356,7 @@ static int xs_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, uns
1415 1356
1416 dprintk("RPC: xs_tcp_data_recv started\n"); 1357 dprintk("RPC: xs_tcp_data_recv started\n");
1417 do { 1358 do {
1359 trace_xs_tcp_data_recv(transport);
1418 /* Read in a new fragment marker if necessary */ 1360 /* Read in a new fragment marker if necessary */
1419 /* Can we ever really expect to get completely empty fragments? */ 1361 /* Can we ever really expect to get completely empty fragments? */
1420 if (transport->tcp_flags & TCP_RCV_COPY_FRAGHDR) { 1362 if (transport->tcp_flags & TCP_RCV_COPY_FRAGHDR) {
@@ -1439,6 +1381,7 @@ static int xs_tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb, uns
1439 /* Skip over any trailing bytes on short reads */ 1381 /* Skip over any trailing bytes on short reads */
1440 xs_tcp_read_discard(transport, &desc); 1382 xs_tcp_read_discard(transport, &desc);
1441 } while (desc.count); 1383 } while (desc.count);
1384 trace_xs_tcp_data_recv(transport);
1442 dprintk("RPC: xs_tcp_data_recv done\n"); 1385 dprintk("RPC: xs_tcp_data_recv done\n");
1443 return len - desc.count; 1386 return len - desc.count;
1444} 1387}
@@ -1454,12 +1397,15 @@ static void xs_tcp_data_ready(struct sock *sk)
1454 struct rpc_xprt *xprt; 1397 struct rpc_xprt *xprt;
1455 read_descriptor_t rd_desc; 1398 read_descriptor_t rd_desc;
1456 int read; 1399 int read;
1400 unsigned long total = 0;
1457 1401
1458 dprintk("RPC: xs_tcp_data_ready...\n"); 1402 dprintk("RPC: xs_tcp_data_ready...\n");
1459 1403
1460 read_lock_bh(&sk->sk_callback_lock); 1404 read_lock_bh(&sk->sk_callback_lock);
1461 if (!(xprt = xprt_from_sock(sk))) 1405 if (!(xprt = xprt_from_sock(sk))) {
1406 read = 0;
1462 goto out; 1407 goto out;
1408 }
1463 /* Any data means we had a useful conversation, so 1409 /* Any data means we had a useful conversation, so
1464 * the we don't need to delay the next reconnect 1410 * the we don't need to delay the next reconnect
1465 */ 1411 */
@@ -1471,8 +1417,11 @@ static void xs_tcp_data_ready(struct sock *sk)
1471 do { 1417 do {
1472 rd_desc.count = 65536; 1418 rd_desc.count = 65536;
1473 read = tcp_read_sock(sk, &rd_desc, xs_tcp_data_recv); 1419 read = tcp_read_sock(sk, &rd_desc, xs_tcp_data_recv);
1420 if (read > 0)
1421 total += read;
1474 } while (read > 0); 1422 } while (read > 0);
1475out: 1423out:
1424 trace_xs_tcp_data_ready(xprt, read, total);
1476 read_unlock_bh(&sk->sk_callback_lock); 1425 read_unlock_bh(&sk->sk_callback_lock);
1477} 1426}
1478 1427
@@ -3042,7 +2991,7 @@ static struct xprt_class xs_bc_tcp_transport = {
3042 */ 2991 */
3043int init_socket_xprt(void) 2992int init_socket_xprt(void)
3044{ 2993{
3045#ifdef RPC_DEBUG 2994#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
3046 if (!sunrpc_table_header) 2995 if (!sunrpc_table_header)
3047 sunrpc_table_header = register_sysctl_table(sunrpc_table); 2996 sunrpc_table_header = register_sysctl_table(sunrpc_table);
3048#endif 2997#endif
@@ -3061,7 +3010,7 @@ int init_socket_xprt(void)
3061 */ 3010 */
3062void cleanup_socket_xprt(void) 3011void cleanup_socket_xprt(void)
3063{ 3012{
3064#ifdef RPC_DEBUG 3013#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
3065 if (sunrpc_table_header) { 3014 if (sunrpc_table_header) {
3066 unregister_sysctl_table(sunrpc_table_header); 3015 unregister_sysctl_table(sunrpc_table_header);
3067 sunrpc_table_header = NULL; 3016 sunrpc_table_header = NULL;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 172395465e8a..8fea1b86df25 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4520,6 +4520,8 @@ static const struct hda_fixup alc269_fixups[] = {
4520 [ALC269_FIXUP_HEADSET_MODE] = { 4520 [ALC269_FIXUP_HEADSET_MODE] = {
4521 .type = HDA_FIXUP_FUNC, 4521 .type = HDA_FIXUP_FUNC,
4522 .v.func = alc_fixup_headset_mode, 4522 .v.func = alc_fixup_headset_mode,
4523 .chained = true,
4524 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
4523 }, 4525 },
4524 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { 4526 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4525 .type = HDA_FIXUP_FUNC, 4527 .type = HDA_FIXUP_FUNC,
@@ -4709,6 +4711,8 @@ static const struct hda_fixup alc269_fixups[] = {
4709 [ALC255_FIXUP_HEADSET_MODE] = { 4711 [ALC255_FIXUP_HEADSET_MODE] = {
4710 .type = HDA_FIXUP_FUNC, 4712 .type = HDA_FIXUP_FUNC,
4711 .v.func = alc_fixup_headset_mode_alc255, 4713 .v.func = alc_fixup_headset_mode_alc255,
4714 .chained = true,
4715 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
4712 }, 4716 },
4713 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { 4717 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4714 .type = HDA_FIXUP_FUNC, 4718 .type = HDA_FIXUP_FUNC,
@@ -4744,8 +4748,6 @@ static const struct hda_fixup alc269_fixups[] = {
4744 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { 4748 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4745 .type = HDA_FIXUP_FUNC, 4749 .type = HDA_FIXUP_FUNC,
4746 .v.func = alc_fixup_dell_wmi, 4750 .v.func = alc_fixup_dell_wmi,
4747 .chained_before = true,
4748 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4749 }, 4751 },
4750 [ALC282_FIXUP_ASPIRE_V5_PINS] = { 4752 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4751 .type = HDA_FIXUP_PINS, 4753 .type = HDA_FIXUP_PINS,
@@ -4783,10 +4785,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4783 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4785 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4784 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4786 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4785 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4787 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4786 SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4787 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), 4788 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4788 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), 4789 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4789 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED),
4790 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), 4790 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4791 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 4791 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4792 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 4792 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c
index cee51ae177c1..c40428f25ba5 100644
--- a/sound/soc/codecs/cs42l51-i2c.c
+++ b/sound/soc/codecs/cs42l51-i2c.c
@@ -46,6 +46,7 @@ static struct i2c_driver cs42l51_i2c_driver = {
46 .driver = { 46 .driver = {
47 .name = "cs42l51", 47 .name = "cs42l51",
48 .owner = THIS_MODULE, 48 .owner = THIS_MODULE,
49 .of_match_table = cs42l51_of_match,
49 }, 50 },
50 .probe = cs42l51_i2c_probe, 51 .probe = cs42l51_i2c_probe,
51 .remove = cs42l51_i2c_remove, 52 .remove = cs42l51_i2c_remove,
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 09488d97de60..669c38fc3034 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -558,11 +558,13 @@ error:
558} 558}
559EXPORT_SYMBOL_GPL(cs42l51_probe); 559EXPORT_SYMBOL_GPL(cs42l51_probe);
560 560
561static const struct of_device_id cs42l51_of_match[] = { 561const struct of_device_id cs42l51_of_match[] = {
562 { .compatible = "cirrus,cs42l51", }, 562 { .compatible = "cirrus,cs42l51", },
563 { } 563 { }
564}; 564};
565MODULE_DEVICE_TABLE(of, cs42l51_of_match); 565MODULE_DEVICE_TABLE(of, cs42l51_of_match);
566EXPORT_SYMBOL_GPL(cs42l51_of_match);
567
566MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); 568MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
567MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); 569MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver");
568MODULE_LICENSE("GPL"); 570MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/cs42l51.h b/sound/soc/codecs/cs42l51.h
index 8c55bf384bc6..0ca805492ac4 100644
--- a/sound/soc/codecs/cs42l51.h
+++ b/sound/soc/codecs/cs42l51.h
@@ -22,6 +22,7 @@ struct device;
22 22
23extern const struct regmap_config cs42l51_regmap; 23extern const struct regmap_config cs42l51_regmap;
24int cs42l51_probe(struct device *dev, struct regmap *regmap); 24int cs42l51_probe(struct device *dev, struct regmap *regmap);
25extern const struct of_device_id cs42l51_of_match[];
25 26
26#define CS42L51_CHIP_ID 0x1B 27#define CS42L51_CHIP_ID 0x1B
27#define CS42L51_CHIP_REV_A 0x00 28#define CS42L51_CHIP_REV_A 0x00
diff --git a/sound/soc/codecs/es8328-i2c.c b/sound/soc/codecs/es8328-i2c.c
index aae410d122ee..2d05b5d3a6ce 100644
--- a/sound/soc/codecs/es8328-i2c.c
+++ b/sound/soc/codecs/es8328-i2c.c
@@ -19,7 +19,7 @@
19#include "es8328.h" 19#include "es8328.h"
20 20
21static const struct i2c_device_id es8328_id[] = { 21static const struct i2c_device_id es8328_id[] = {
22 { "everest,es8328", 0 }, 22 { "es8328", 0 },
23 { } 23 { }
24}; 24};
25MODULE_DEVICE_TABLE(i2c, es8328_id); 25MODULE_DEVICE_TABLE(i2c, es8328_id);
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index d519294f57c7..1229554f1464 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -1941,13 +1941,13 @@ static int max98090_dai_set_sysclk(struct snd_soc_dai *dai,
1941 * 0x02 (when master clk is 20MHz to 40MHz).. 1941 * 0x02 (when master clk is 20MHz to 40MHz)..
1942 * 0x03 (when master clk is 40MHz to 60MHz).. 1942 * 0x03 (when master clk is 40MHz to 60MHz)..
1943 */ 1943 */
1944 if ((freq >= 10000000) && (freq < 20000000)) { 1944 if ((freq >= 10000000) && (freq <= 20000000)) {
1945 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, 1945 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK,
1946 M98090_PSCLK_DIV1); 1946 M98090_PSCLK_DIV1);
1947 } else if ((freq >= 20000000) && (freq < 40000000)) { 1947 } else if ((freq > 20000000) && (freq <= 40000000)) {
1948 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, 1948 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK,
1949 M98090_PSCLK_DIV2); 1949 M98090_PSCLK_DIV2);
1950 } else if ((freq >= 40000000) && (freq < 60000000)) { 1950 } else if ((freq > 40000000) && (freq <= 60000000)) {
1951 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, 1951 snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK,
1952 M98090_PSCLK_DIV4); 1952 M98090_PSCLK_DIV4);
1953 } else { 1953 } else {
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 3fb83bf09768..d16331e0b64d 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -139,6 +139,7 @@ static const struct reg_default rt5645_reg[] = {
139 { 0x76, 0x000a }, 139 { 0x76, 0x000a },
140 { 0x77, 0x0c00 }, 140 { 0x77, 0x0c00 },
141 { 0x78, 0x0000 }, 141 { 0x78, 0x0000 },
142 { 0x79, 0x0123 },
142 { 0x80, 0x0000 }, 143 { 0x80, 0x0000 },
143 { 0x81, 0x0000 }, 144 { 0x81, 0x0000 },
144 { 0x82, 0x0000 }, 145 { 0x82, 0x0000 },
@@ -334,6 +335,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg)
334 case RT5645_DMIC_CTRL2: 335 case RT5645_DMIC_CTRL2:
335 case RT5645_TDM_CTRL_1: 336 case RT5645_TDM_CTRL_1:
336 case RT5645_TDM_CTRL_2: 337 case RT5645_TDM_CTRL_2:
338 case RT5645_TDM_CTRL_3:
337 case RT5645_GLB_CLK: 339 case RT5645_GLB_CLK:
338 case RT5645_PLL_CTRL1: 340 case RT5645_PLL_CTRL1:
339 case RT5645_PLL_CTRL2: 341 case RT5645_PLL_CTRL2:
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index ba9d9b4d4857..9bd8b4f63303 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -100,18 +100,18 @@ static const struct reg_default rt5670_reg[] = {
100 { 0x4c, 0x5380 }, 100 { 0x4c, 0x5380 },
101 { 0x4f, 0x0073 }, 101 { 0x4f, 0x0073 },
102 { 0x52, 0x00d3 }, 102 { 0x52, 0x00d3 },
103 { 0x53, 0xf0f0 }, 103 { 0x53, 0xf000 },
104 { 0x61, 0x0000 }, 104 { 0x61, 0x0000 },
105 { 0x62, 0x0001 }, 105 { 0x62, 0x0001 },
106 { 0x63, 0x00c3 }, 106 { 0x63, 0x00c3 },
107 { 0x64, 0x0000 }, 107 { 0x64, 0x0000 },
108 { 0x65, 0x0000 }, 108 { 0x65, 0x0001 },
109 { 0x66, 0x0000 }, 109 { 0x66, 0x0000 },
110 { 0x6f, 0x8000 }, 110 { 0x6f, 0x8000 },
111 { 0x70, 0x8000 }, 111 { 0x70, 0x8000 },
112 { 0x71, 0x8000 }, 112 { 0x71, 0x8000 },
113 { 0x72, 0x8000 }, 113 { 0x72, 0x8000 },
114 { 0x73, 0x1110 }, 114 { 0x73, 0x7770 },
115 { 0x74, 0x0e00 }, 115 { 0x74, 0x0e00 },
116 { 0x75, 0x1505 }, 116 { 0x75, 0x1505 },
117 { 0x76, 0x0015 }, 117 { 0x76, 0x0015 },
@@ -125,21 +125,21 @@ static const struct reg_default rt5670_reg[] = {
125 { 0x83, 0x0000 }, 125 { 0x83, 0x0000 },
126 { 0x84, 0x0000 }, 126 { 0x84, 0x0000 },
127 { 0x85, 0x0000 }, 127 { 0x85, 0x0000 },
128 { 0x86, 0x0008 }, 128 { 0x86, 0x0004 },
129 { 0x87, 0x0000 }, 129 { 0x87, 0x0000 },
130 { 0x88, 0x0000 }, 130 { 0x88, 0x0000 },
131 { 0x89, 0x0000 }, 131 { 0x89, 0x0000 },
132 { 0x8a, 0x0000 }, 132 { 0x8a, 0x0000 },
133 { 0x8b, 0x0000 }, 133 { 0x8b, 0x0000 },
134 { 0x8c, 0x0007 }, 134 { 0x8c, 0x0003 },
135 { 0x8d, 0x0000 }, 135 { 0x8d, 0x0000 },
136 { 0x8e, 0x0004 }, 136 { 0x8e, 0x0004 },
137 { 0x8f, 0x1100 }, 137 { 0x8f, 0x1100 },
138 { 0x90, 0x0646 }, 138 { 0x90, 0x0646 },
139 { 0x91, 0x0c06 }, 139 { 0x91, 0x0c06 },
140 { 0x93, 0x0000 }, 140 { 0x93, 0x0000 },
141 { 0x94, 0x0000 }, 141 { 0x94, 0x1270 },
142 { 0x95, 0x0000 }, 142 { 0x95, 0x1000 },
143 { 0x97, 0x0000 }, 143 { 0x97, 0x0000 },
144 { 0x98, 0x0000 }, 144 { 0x98, 0x0000 },
145 { 0x99, 0x0000 }, 145 { 0x99, 0x0000 },
@@ -150,11 +150,11 @@ static const struct reg_default rt5670_reg[] = {
150 { 0x9e, 0x0400 }, 150 { 0x9e, 0x0400 },
151 { 0xae, 0x7000 }, 151 { 0xae, 0x7000 },
152 { 0xaf, 0x0000 }, 152 { 0xaf, 0x0000 },
153 { 0xb0, 0x6000 }, 153 { 0xb0, 0x7000 },
154 { 0xb1, 0x0000 }, 154 { 0xb1, 0x0000 },
155 { 0xb2, 0x0000 }, 155 { 0xb2, 0x0000 },
156 { 0xb3, 0x001f }, 156 { 0xb3, 0x001f },
157 { 0xb4, 0x2206 }, 157 { 0xb4, 0x220c },
158 { 0xb5, 0x1f00 }, 158 { 0xb5, 0x1f00 },
159 { 0xb6, 0x0000 }, 159 { 0xb6, 0x0000 },
160 { 0xb7, 0x0000 }, 160 { 0xb7, 0x0000 },
@@ -171,25 +171,25 @@ static const struct reg_default rt5670_reg[] = {
171 { 0xcf, 0x1813 }, 171 { 0xcf, 0x1813 },
172 { 0xd0, 0x0690 }, 172 { 0xd0, 0x0690 },
173 { 0xd1, 0x1c17 }, 173 { 0xd1, 0x1c17 },
174 { 0xd3, 0xb320 }, 174 { 0xd3, 0xa220 },
175 { 0xd4, 0x0000 }, 175 { 0xd4, 0x0000 },
176 { 0xd6, 0x0400 }, 176 { 0xd6, 0x0400 },
177 { 0xd9, 0x0809 }, 177 { 0xd9, 0x0809 },
178 { 0xda, 0x0000 }, 178 { 0xda, 0x0000 },
179 { 0xdb, 0x0001 }, 179 { 0xdb, 0x0001 },
180 { 0xdc, 0x0049 }, 180 { 0xdc, 0x0049 },
181 { 0xdd, 0x0009 }, 181 { 0xdd, 0x0024 },
182 { 0xe6, 0x8000 }, 182 { 0xe6, 0x8000 },
183 { 0xe7, 0x0000 }, 183 { 0xe7, 0x0000 },
184 { 0xec, 0xb300 }, 184 { 0xec, 0xa200 },
185 { 0xed, 0x0000 }, 185 { 0xed, 0x0000 },
186 { 0xee, 0xb300 }, 186 { 0xee, 0xa200 },
187 { 0xef, 0x0000 }, 187 { 0xef, 0x0000 },
188 { 0xf8, 0x0000 }, 188 { 0xf8, 0x0000 },
189 { 0xf9, 0x0000 }, 189 { 0xf9, 0x0000 },
190 { 0xfa, 0x8010 }, 190 { 0xfa, 0x8010 },
191 { 0xfb, 0x0033 }, 191 { 0xfb, 0x0033 },
192 { 0xfc, 0x0080 }, 192 { 0xfc, 0x0100 },
193}; 193};
194 194
195static bool rt5670_volatile_register(struct device *dev, unsigned int reg) 195static bool rt5670_volatile_register(struct device *dev, unsigned int reg)
@@ -1877,6 +1877,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = {
1877 { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, 1877 { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" },
1878 { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, 1878 { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" },
1879 1879
1880 { "DAC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll },
1881 { "DAC Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll },
1882 { "DAC Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll },
1883
1880 { "DAC MIX", NULL, "DAC1 MIXL" }, 1884 { "DAC MIX", NULL, "DAC1 MIXL" },
1881 { "DAC MIX", NULL, "DAC1 MIXR" }, 1885 { "DAC MIX", NULL, "DAC1 MIXR" },
1882 1886
@@ -1926,14 +1930,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = {
1926 1930
1927 { "DAC L1", NULL, "DAC L1 Power" }, 1931 { "DAC L1", NULL, "DAC L1 Power" },
1928 { "DAC L1", NULL, "Stereo DAC MIXL" }, 1932 { "DAC L1", NULL, "Stereo DAC MIXL" },
1929 { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll },
1930 { "DAC R1", NULL, "DAC R1 Power" }, 1933 { "DAC R1", NULL, "DAC R1 Power" },
1931 { "DAC R1", NULL, "Stereo DAC MIXR" }, 1934 { "DAC R1", NULL, "Stereo DAC MIXR" },
1932 { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll },
1933 { "DAC L2", NULL, "Mono DAC MIXL" }, 1935 { "DAC L2", NULL, "Mono DAC MIXL" },
1934 { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll },
1935 { "DAC R2", NULL, "Mono DAC MIXR" }, 1936 { "DAC R2", NULL, "Mono DAC MIXR" },
1936 { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll },
1937 1937
1938 { "OUT MIXL", "BST1 Switch", "BST1" }, 1938 { "OUT MIXL", "BST1 Switch", "BST1" },
1939 { "OUT MIXL", "INL Switch", "INL VOL" }, 1939 { "OUT MIXL", "INL Switch", "INL VOL" },
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 6bb77d76561b..dab9b15304af 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1299,8 +1299,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1299 1299
1300 /* enable small pop, introduce 400ms delay in turning off */ 1300 /* enable small pop, introduce 400ms delay in turning off */
1301 snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, 1301 snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL,
1302 SGTL5000_SMALL_POP, 1302 SGTL5000_SMALL_POP, 1);
1303 SGTL5000_SMALL_POP);
1304 1303
1305 /* disable short cut detector */ 1304 /* disable short cut detector */
1306 snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); 1305 snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0);
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
index 2f8c88931f69..bd7a344bf8c5 100644
--- a/sound/soc/codecs/sgtl5000.h
+++ b/sound/soc/codecs/sgtl5000.h
@@ -275,7 +275,7 @@
275#define SGTL5000_BIAS_CTRL_MASK 0x000e 275#define SGTL5000_BIAS_CTRL_MASK 0x000e
276#define SGTL5000_BIAS_CTRL_SHIFT 1 276#define SGTL5000_BIAS_CTRL_SHIFT 1
277#define SGTL5000_BIAS_CTRL_WIDTH 3 277#define SGTL5000_BIAS_CTRL_WIDTH 3
278#define SGTL5000_SMALL_POP 0x0001 278#define SGTL5000_SMALL_POP 0
279 279
280/* 280/*
281 * SGTL5000_CHIP_MIC_CTRL 281 * SGTL5000_CHIP_MIC_CTRL
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f412a9911a75..67124783558a 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1355,6 +1355,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
1355 file, blocks, pos - firmware->size); 1355 file, blocks, pos - firmware->size);
1356 1356
1357out_fw: 1357out_fw:
1358 regmap_async_complete(regmap);
1358 release_firmware(firmware); 1359 release_firmware(firmware);
1359 wm_adsp_buf_free(&buf_list); 1360 wm_adsp_buf_free(&buf_list);
1360out: 1361out:
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index ed866e9a2928..9deabdd2b1a2 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -684,12 +684,38 @@ static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg)
684 } 684 }
685} 685}
686 686
687static struct reg_default fsl_asrc_reg[] = {
688 { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 },
689 { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 },
690 { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 },
691 { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 },
692 { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 },
693 { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 },
694 { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 },
695 { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 },
696 { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 },
697 { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 },
698 { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 },
699 { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 },
700 { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 },
701 { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 },
702 { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 },
703 { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 },
704 { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 },
705 { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 },
706 { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 },
707 { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 },
708 { REG_ASRMCR1C, 0x0000 },
709};
710
687static const struct regmap_config fsl_asrc_regmap_config = { 711static const struct regmap_config fsl_asrc_regmap_config = {
688 .reg_bits = 32, 712 .reg_bits = 32,
689 .reg_stride = 4, 713 .reg_stride = 4,
690 .val_bits = 32, 714 .val_bits = 32,
691 715
692 .max_register = REG_ASRMCR1C, 716 .max_register = REG_ASRMCR1C,
717 .reg_defaults = fsl_asrc_reg,
718 .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg),
693 .readable_reg = fsl_asrc_readable_reg, 719 .readable_reg = fsl_asrc_readable_reg,
694 .volatile_reg = fsl_asrc_volatile_reg, 720 .volatile_reg = fsl_asrc_volatile_reg,
695 .writeable_reg = fsl_asrc_writeable_reg, 721 .writeable_reg = fsl_asrc_writeable_reg,
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index f373e37f8305..c74ba37f862c 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -154,8 +154,10 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on)
154 while (val) { 154 while (val) {
155 regmap_read(i2s->regmap, I2S_CLR, &val); 155 regmap_read(i2s->regmap, I2S_CLR, &val);
156 retry--; 156 retry--;
157 if (!retry) 157 if (!retry) {
158 dev_warn(i2s->dev, "fail to clear\n"); 158 dev_warn(i2s->dev, "fail to clear\n");
159 break;
160 }
159 } 161 }
160 } 162 }
161 } 163 }
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c
index 0acf5d0eed53..72118a77dd5b 100644
--- a/sound/soc/samsung/snow.c
+++ b/sound/soc/samsung/snow.c
@@ -110,6 +110,7 @@ static const struct of_device_id snow_of_match[] = {
110 { .compatible = "google,snow-audio-max98095", }, 110 { .compatible = "google,snow-audio-max98095", },
111 {}, 111 {},
112}; 112};
113MODULE_DEVICE_TABLE(of, snow_of_match);
113 114
114static struct platform_driver snow_driver = { 115static struct platform_driver snow_driver = {
115 .driver = { 116 .driver = {
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 66fddec9543d..88e5df474ccf 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1711,8 +1711,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = {
1711static struct snd_pcm_hardware fsi_pcm_hardware = { 1711static struct snd_pcm_hardware fsi_pcm_hardware = {
1712 .info = SNDRV_PCM_INFO_INTERLEAVED | 1712 .info = SNDRV_PCM_INFO_INTERLEAVED |
1713 SNDRV_PCM_INFO_MMAP | 1713 SNDRV_PCM_INFO_MMAP |
1714 SNDRV_PCM_INFO_MMAP_VALID | 1714 SNDRV_PCM_INFO_MMAP_VALID,
1715 SNDRV_PCM_INFO_PAUSE,
1716 .buffer_bytes_max = 64 * 1024, 1715 .buffer_bytes_max = 64 * 1024,
1717 .period_bytes_min = 32, 1716 .period_bytes_min = 32,
1718 .period_bytes_max = 8192, 1717 .period_bytes_max = 8192,
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 1922ec57d10a..70042197f9e2 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -886,8 +886,7 @@ static int rsnd_dai_probe(struct platform_device *pdev,
886static struct snd_pcm_hardware rsnd_pcm_hardware = { 886static struct snd_pcm_hardware rsnd_pcm_hardware = {
887 .info = SNDRV_PCM_INFO_INTERLEAVED | 887 .info = SNDRV_PCM_INFO_INTERLEAVED |
888 SNDRV_PCM_INFO_MMAP | 888 SNDRV_PCM_INFO_MMAP |
889 SNDRV_PCM_INFO_MMAP_VALID | 889 SNDRV_PCM_INFO_MMAP_VALID,
890 SNDRV_PCM_INFO_PAUSE,
891 .buffer_bytes_max = 64 * 1024, 890 .buffer_bytes_max = 64 * 1024,
892 .period_bytes_min = 32, 891 .period_bytes_min = 32,
893 .period_bytes_max = 8192, 892 .period_bytes_max = 8192,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4c8f8a23a0e9..b60ff56ebc0f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -884,7 +884,7 @@ static struct snd_soc_dai *snd_soc_find_dai(
884 list_for_each_entry(component, &component_list, list) { 884 list_for_each_entry(component, &component_list, list) {
885 if (dlc->of_node && component->dev->of_node != dlc->of_node) 885 if (dlc->of_node && component->dev->of_node != dlc->of_node)
886 continue; 886 continue;
887 if (dlc->name && strcmp(dev_name(component->dev), dlc->name)) 887 if (dlc->name && strcmp(component->name, dlc->name))
888 continue; 888 continue;
889 list_for_each_entry(dai, &component->dai_list, list) { 889 list_for_each_entry(dai, &component->dai_list, list) {
890 if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) 890 if (dlc->dai_name && strcmp(dai->name, dlc->dai_name))
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 002311afdeaa..57277dd79e11 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1522,13 +1522,36 @@ static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
1522 dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); 1522 dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture);
1523} 1523}
1524 1524
1525static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd);
1526
1527/* Set FE's runtime_update state; the state is protected via PCM stream lock
1528 * for avoiding the race with trigger callback.
1529 * If the state is unset and a trigger is pending while the previous operation,
1530 * process the pending trigger action here.
1531 */
1532static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe,
1533 int stream, enum snd_soc_dpcm_update state)
1534{
1535 struct snd_pcm_substream *substream =
1536 snd_soc_dpcm_get_substream(fe, stream);
1537
1538 snd_pcm_stream_lock_irq(substream);
1539 if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) {
1540 dpcm_fe_dai_do_trigger(substream,
1541 fe->dpcm[stream].trigger_pending - 1);
1542 fe->dpcm[stream].trigger_pending = 0;
1543 }
1544 fe->dpcm[stream].runtime_update = state;
1545 snd_pcm_stream_unlock_irq(substream);
1546}
1547
1525static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) 1548static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
1526{ 1549{
1527 struct snd_soc_pcm_runtime *fe = fe_substream->private_data; 1550 struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
1528 struct snd_pcm_runtime *runtime = fe_substream->runtime; 1551 struct snd_pcm_runtime *runtime = fe_substream->runtime;
1529 int stream = fe_substream->stream, ret = 0; 1552 int stream = fe_substream->stream, ret = 0;
1530 1553
1531 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1554 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1532 1555
1533 ret = dpcm_be_dai_startup(fe, fe_substream->stream); 1556 ret = dpcm_be_dai_startup(fe, fe_substream->stream);
1534 if (ret < 0) { 1557 if (ret < 0) {
@@ -1550,13 +1573,13 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
1550 dpcm_set_fe_runtime(fe_substream); 1573 dpcm_set_fe_runtime(fe_substream);
1551 snd_pcm_limit_hw_rates(runtime); 1574 snd_pcm_limit_hw_rates(runtime);
1552 1575
1553 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1576 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1554 return 0; 1577 return 0;
1555 1578
1556unwind: 1579unwind:
1557 dpcm_be_dai_startup_unwind(fe, fe_substream->stream); 1580 dpcm_be_dai_startup_unwind(fe, fe_substream->stream);
1558be_err: 1581be_err:
1559 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1582 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1560 return ret; 1583 return ret;
1561} 1584}
1562 1585
@@ -1603,7 +1626,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
1603 struct snd_soc_pcm_runtime *fe = substream->private_data; 1626 struct snd_soc_pcm_runtime *fe = substream->private_data;
1604 int stream = substream->stream; 1627 int stream = substream->stream;
1605 1628
1606 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1629 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1607 1630
1608 /* shutdown the BEs */ 1631 /* shutdown the BEs */
1609 dpcm_be_dai_shutdown(fe, substream->stream); 1632 dpcm_be_dai_shutdown(fe, substream->stream);
@@ -1617,7 +1640,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
1617 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); 1640 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
1618 1641
1619 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; 1642 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
1620 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1643 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1621 return 0; 1644 return 0;
1622} 1645}
1623 1646
@@ -1665,7 +1688,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
1665 int err, stream = substream->stream; 1688 int err, stream = substream->stream;
1666 1689
1667 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 1690 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
1668 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1691 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1669 1692
1670 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); 1693 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
1671 1694
@@ -1680,7 +1703,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
1680 err = dpcm_be_dai_hw_free(fe, stream); 1703 err = dpcm_be_dai_hw_free(fe, stream);
1681 1704
1682 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; 1705 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE;
1683 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1706 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1684 1707
1685 mutex_unlock(&fe->card->mutex); 1708 mutex_unlock(&fe->card->mutex);
1686 return 0; 1709 return 0;
@@ -1773,7 +1796,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
1773 int ret, stream = substream->stream; 1796 int ret, stream = substream->stream;
1774 1797
1775 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 1798 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
1776 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1799 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
1777 1800
1778 memcpy(&fe->dpcm[substream->stream].hw_params, params, 1801 memcpy(&fe->dpcm[substream->stream].hw_params, params,
1779 sizeof(struct snd_pcm_hw_params)); 1802 sizeof(struct snd_pcm_hw_params));
@@ -1796,7 +1819,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
1796 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; 1819 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
1797 1820
1798out: 1821out:
1799 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1822 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
1800 mutex_unlock(&fe->card->mutex); 1823 mutex_unlock(&fe->card->mutex);
1801 return ret; 1824 return ret;
1802} 1825}
@@ -1910,7 +1933,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
1910} 1933}
1911EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); 1934EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
1912 1935
1913static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) 1936static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
1914{ 1937{
1915 struct snd_soc_pcm_runtime *fe = substream->private_data; 1938 struct snd_soc_pcm_runtime *fe = substream->private_data;
1916 int stream = substream->stream, ret; 1939 int stream = substream->stream, ret;
@@ -1984,6 +2007,23 @@ out:
1984 return ret; 2007 return ret;
1985} 2008}
1986 2009
2010static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
2011{
2012 struct snd_soc_pcm_runtime *fe = substream->private_data;
2013 int stream = substream->stream;
2014
2015 /* if FE's runtime_update is already set, we're in race;
2016 * process this trigger later at exit
2017 */
2018 if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) {
2019 fe->dpcm[stream].trigger_pending = cmd + 1;
2020 return 0; /* delayed, assuming it's successful */
2021 }
2022
2023 /* we're alone, let's trigger */
2024 return dpcm_fe_dai_do_trigger(substream, cmd);
2025}
2026
1987int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) 2027int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
1988{ 2028{
1989 struct snd_soc_dpcm *dpcm; 2029 struct snd_soc_dpcm *dpcm;
@@ -2027,7 +2067,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
2027 2067
2028 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); 2068 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name);
2029 2069
2030 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 2070 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
2031 2071
2032 /* there is no point preparing this FE if there are no BEs */ 2072 /* there is no point preparing this FE if there are no BEs */
2033 if (list_empty(&fe->dpcm[stream].be_clients)) { 2073 if (list_empty(&fe->dpcm[stream].be_clients)) {
@@ -2054,7 +2094,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
2054 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; 2094 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE;
2055 2095
2056out: 2096out:
2057 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 2097 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
2058 mutex_unlock(&fe->card->mutex); 2098 mutex_unlock(&fe->card->mutex);
2059 2099
2060 return ret; 2100 return ret;
@@ -2201,11 +2241,11 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream)
2201{ 2241{
2202 int ret; 2242 int ret;
2203 2243
2204 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; 2244 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
2205 ret = dpcm_run_update_startup(fe, stream); 2245 ret = dpcm_run_update_startup(fe, stream);
2206 if (ret < 0) 2246 if (ret < 0)
2207 dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); 2247 dev_err(fe->dev, "ASoC: failed to startup some BEs\n");
2208 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 2248 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
2209 2249
2210 return ret; 2250 return ret;
2211} 2251}
@@ -2214,11 +2254,11 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
2214{ 2254{
2215 int ret; 2255 int ret;
2216 2256
2217 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; 2257 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
2218 ret = dpcm_run_update_shutdown(fe, stream); 2258 ret = dpcm_run_update_shutdown(fe, stream);
2219 if (ret < 0) 2259 if (ret < 0)
2220 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); 2260 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
2221 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 2261 dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
2222 2262
2223 return ret; 2263 return ret;
2224} 2264}
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 2e4a9dbc51fa..6e354d326858 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2033,10 +2033,11 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid,
2033 cval->res = 1; 2033 cval->res = 1;
2034 cval->initialized = 1; 2034 cval->initialized = 1;
2035 2035
2036 if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) 2036 if (state->mixer->protocol == UAC_VERSION_1)
2037 cval->control = UAC2_CX_CLOCK_SELECTOR;
2038 else
2039 cval->control = 0; 2037 cval->control = 0;
2038 else /* UAC_VERSION_2 */
2039 cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ?
2040 UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR;
2040 2041
2041 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); 2042 namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL);
2042 if (!namelist) { 2043 if (!namelist) {
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index d2aa45a8d895..a5941f80fc5b 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1146,6 +1146,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
1146 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && 1146 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
1147 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) 1147 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
1148 mdelay(20); 1148 mdelay(20);
1149
1150 /* Marantz/Denon devices with USB DAC functionality need a delay
1151 * after each class compliant request
1152 */
1153 if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) &&
1154 (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) {
1155
1156 switch (le16_to_cpu(dev->descriptor.idProduct)) {
1157 case 0x3005: /* Marantz HD-DAC1 */
1158 case 0x3006: /* Marantz SA-14S1 */
1159 mdelay(20);
1160 break;
1161 }
1162 }
1149} 1163}
1150 1164
1151/* 1165/*