aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/block/queue-sysfs.txt6
-rw-r--r--Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt4
-rw-r--r--Documentation/devicetree/bindings/power/supply/tps65217_charger.txt7
-rw-r--r--Documentation/networking/mpls-sysctl.txt4
-rw-r--r--Documentation/unaligned-memory-access.txt2
-rw-r--r--MAINTAINERS19
-rw-r--r--Makefile2
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/boot/dts/Makefile1
-rw-r--r--arch/arm/boot/dts/am335x-bone-common.dtsi8
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi1
-rw-r--r--arch/arm/boot/dts/am4372.dtsi1
-rw-r--r--arch/arm/boot/dts/am571x-idk.dts10
-rw-r--r--arch/arm/boot/dts/am572x-idk.dts14
-rw-r--r--arch/arm/boot/dts/am57xx-idk-common.dtsi9
-rw-r--r--arch/arm/boot/dts/dm814x.dtsi1
-rw-r--r--arch/arm/boot/dts/dm816x.dtsi1
-rw-r--r--arch/arm/boot/dts/dra7.dtsi1
-rw-r--r--arch/arm/boot/dts/dra72-evm-tps65917.dtsi16
-rw-r--r--arch/arm/boot/dts/imx31.dtsi4
-rw-r--r--arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6sl.dtsi1
-rw-r--r--arch/arm/boot/dts/imx6sx.dtsi1
-rw-r--r--arch/arm/boot/dts/omap2.dtsi1
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts2
-rw-r--r--arch/arm/boot/dts/omap3.dtsi1
-rw-r--r--arch/arm/boot/dts/omap4.dtsi1
-rw-r--r--arch/arm/boot/dts/omap5.dtsi1
-rw-r--r--arch/arm/boot/dts/qcom-apq8064.dtsi4
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts2
-rw-r--r--arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts2
-rw-r--r--arch/arm/boot/dts/vf610-zii-dev-rev-b.dts3
-rw-r--r--arch/arm/mach-davinci/clock.c12
-rw-r--r--arch/arm/mach-davinci/clock.h2
-rw-r--r--arch/arm/mach-davinci/da850.c32
-rw-r--r--arch/arm/mach-davinci/usb-da8xx.c34
-rw-r--r--arch/arm/mach-exynos/platsmp.c31
-rw-r--r--arch/arm/mach-imx/mach-imx1.c1
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/board-generic.c2
-rw-r--r--arch/arm/mach-omap2/gpio.c160
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c8
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h4
-rw-r--r--arch/arm/mach-omap2/prm_common.c4
-rw-r--r--arch/arm/mach-omap2/timer.c9
-rw-r--r--arch/arm/mach-s3c24xx/common.c76
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gx.dtsi16
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts16
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi16
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi4
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts16
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxl.dtsi6
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts16
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxm.dtsi4
-rw-r--r--arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts2
-rw-r--r--arch/arm64/boot/dts/qcom/msm8996.dtsi10
-rw-r--r--arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts2
-rw-r--r--arch/arm64/configs/defconfig1
-rw-r--r--arch/arm64/include/asm/asm-uaccess.h65
-rw-r--r--arch/arm64/include/asm/uaccess.h64
-rw-r--r--arch/arm64/kernel/entry.S2
-rw-r--r--arch/arm64/lib/clear_user.S2
-rw-r--r--arch/arm64/lib/copy_from_user.S2
-rw-r--r--arch/arm64/lib/copy_in_user.S2
-rw-r--r--arch/arm64/lib/copy_to_user.S2
-rw-r--r--arch/arm64/mm/cache.S2
-rw-r--r--arch/arm64/xen/hypercall.S2
-rw-r--r--arch/openrisc/kernel/vmlinux.lds.S2
-rw-r--r--arch/parisc/include/asm/thread_info.h1
-rw-r--r--arch/parisc/kernel/time.c23
-rw-r--r--arch/parisc/mm/fault.c2
-rw-r--r--arch/s390/include/asm/asm-prototypes.h8
-rw-r--r--arch/s390/kernel/vtime.c8
-rw-r--r--arch/x86/include/asm/bitops.h13
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c3
-rw-r--r--arch/x86/xen/setup.c6
-rw-r--r--block/blk-wbt.c13
-rw-r--r--crypto/testmgr.c30
-rw-r--r--drivers/crypto/marvell/cesa.h3
-rw-r--r--drivers/crypto/marvell/hash.c34
-rw-r--r--drivers/crypto/marvell/tdma.c9
-rw-r--r--drivers/firmware/arm_scpi.c10
-rw-r--r--drivers/firmware/psci_checker.c4
-rw-r--r--drivers/hid/hid-asus.c17
-rw-r--r--drivers/hid/hid-ids.h4
-rw-r--r--drivers/hid/hid-sensor-hub.c3
-rw-r--r--drivers/hid/hid-sony.c36
-rw-r--r--drivers/hid/usbhid/hid-quirks.c2
-rw-r--r--drivers/infiniband/hw/mlx4/main.c14
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c23
-rw-r--r--drivers/net/ethernet/cadence/macb_pci.c27
-rw-r--r--drivers/net/ethernet/cavium/Kconfig2
-rw-r--r--drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c12
-rw-r--r--drivers/net/ethernet/emulex/benet/be_main.c4
-rw-r--r--drivers/net/ethernet/freescale/dpaa/dpaa_eth.c6
-rw-r--r--drivers/net/ethernet/korina.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_clock.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/icm.c7
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c28
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c3
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c51
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_stats.h32
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c11
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fs_core.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/main.c15
-rw-r--r--drivers/net/ethernet/realtek/r8169.c1
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c3
-rw-r--r--drivers/net/ethernet/sfc/ef10.c3
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c2
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h2
-rw-r--r--drivers/net/ethernet/sfc/siena.c1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c89
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c23
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c4
-rw-r--r--drivers/net/ipvlan/ipvlan.h5
-rw-r--r--drivers/net/ipvlan/ipvlan_core.c60
-rw-r--r--drivers/net/ipvlan/ipvlan_main.c7
-rw-r--r--drivers/net/usb/asix_devices.c1
-rw-r--r--drivers/net/vrf.c3
-rw-r--r--drivers/net/wan/slic_ds26522.c2
-rw-r--r--drivers/nvme/host/core.c17
-rw-r--r--drivers/nvme/host/fc.c19
-rw-r--r--drivers/nvme/host/nvme.h1
-rw-r--r--drivers/nvme/host/pci.c13
-rw-r--r--drivers/nvme/host/scsi.c27
-rw-r--r--drivers/nvme/target/admin-cmd.c4
-rw-r--r--drivers/nvme/target/fcloop.c4
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson.c2
-rw-r--r--drivers/pinctrl/pinctrl-amd.c19
-rw-r--r--drivers/pinctrl/samsung/pinctrl-exynos.c91
-rw-r--r--drivers/pinctrl/samsung/pinctrl-exynos.h31
-rw-r--r--drivers/video/fbdev/cobalt_lcdfb.c5
-rw-r--r--drivers/xen/arm-device.c8
-rw-r--r--drivers/xen/events/events_fifo.c3
-rw-r--r--drivers/xen/evtchn.c4
-rw-r--r--drivers/xen/xenbus/xenbus_comms.h1
-rw-r--r--drivers/xen/xenbus/xenbus_dev_frontend.c49
-rw-r--r--fs/block_dev.c3
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/crypto/keyinfo.c3
-rw-r--r--fs/crypto/policy.c5
-rw-r--r--fs/dax.c243
-rw-r--r--fs/ext2/inode.c3
-rw-r--r--fs/ext4/file.c48
-rw-r--r--fs/xfs/libxfs/xfs_ag_resv.c3
-rw-r--r--fs/xfs/libxfs/xfs_refcount_btree.c9
-rw-r--r--fs/xfs/libxfs/xfs_refcount_btree.h3
-rw-r--r--fs/xfs/libxfs/xfs_rmap_btree.c14
-rw-r--r--fs/xfs/libxfs/xfs_rmap_btree.h3
-rw-r--r--fs/xfs/xfs_fsops.c14
-rw-r--r--fs/xfs/xfs_icache.c3
-rw-r--r--fs/xfs/xfs_refcount_item.c3
-rw-r--r--fs/xfs/xfs_sysfs.c4
-rw-r--r--include/dt-bindings/mfd/tps65217.h26
-rw-r--r--include/linux/dax.h3
-rw-r--r--include/linux/filter.h1
-rw-r--r--include/linux/genhd.h9
-rw-r--r--include/linux/mlx4/device.h2
-rw-r--r--include/linux/mlx5/device.h5
-rw-r--r--include/linux/mlx5/driver.h1
-rw-r--r--include/linux/mlx5/mlx5_ifc.h93
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/net/netns/ipv4.h1
-rw-r--r--include/net/tcp.h1
-rw-r--r--kernel/cpu.c9
-rw-r--r--mm/filemap.c36
-rw-r--r--mm/truncate.c75
-rw-r--r--net/atm/lec.c2
-rw-r--r--net/core/drop_monitor.c39
-rw-r--r--net/core/filter.c6
-rw-r--r--net/core/flow_dissector.c5
-rw-r--r--net/core/rtnetlink.c6
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/igmp.c7
-rw-r--r--net/ipv4/ip_sockglue.c8
-rw-r--r--net/ipv4/route.c3
-rw-r--r--net/ipv4/sysctl_net_ipv4.c14
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/l2tp/l2tp_ip.c19
-rw-r--r--net/l2tp/l2tp_ip6.c24
-rw-r--r--net/mac80211/tx.c3
-rw-r--r--net/openvswitch/datapath.c1
-rw-r--r--net/openvswitch/flow.c54
-rw-r--r--net/sched/cls_api.c4
-rw-r--r--net/sched/cls_flower.c4
-rw-r--r--net/socket.c2
-rw-r--r--net/tipc/socket.c24
-rw-r--r--scripts/gcc-plugins/gcc-common.h85
-rw-r--r--scripts/gcc-plugins/latent_entropy_plugin.c4
-rw-r--r--usr/Makefile16
199 files changed, 1559 insertions, 1208 deletions
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index c75e5d6b8fa8..a6eb7dcd4dd5 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -12,7 +12,7 @@ DOCBOOKS := z8530book.xml \
12 kernel-api.xml filesystems.xml lsm.xml kgdb.xml \ 12 kernel-api.xml filesystems.xml lsm.xml kgdb.xml \
13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \ 13 gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
14 genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \ 14 genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
15 80211.xml sh.xml regulator.xml w1.xml \ 15 sh.xml regulator.xml w1.xml \
16 writing_musb_glue_layer.xml iio.xml 16 writing_musb_glue_layer.xml iio.xml
17 17
18ifeq ($(DOCBOOKS),) 18ifeq ($(DOCBOOKS),)
diff --git a/Documentation/block/queue-sysfs.txt b/Documentation/block/queue-sysfs.txt
index 51642159aedb..c0a3bb5a6e4e 100644
--- a/Documentation/block/queue-sysfs.txt
+++ b/Documentation/block/queue-sysfs.txt
@@ -54,9 +54,9 @@ This is the hardware sector size of the device, in bytes.
54 54
55io_poll (RW) 55io_poll (RW)
56------------ 56------------
57When read, this file shows the total number of block IO polls and how 57When read, this file shows whether polling is enabled (1) or disabled
58many returned success. Writing '0' to this file will disable polling 58(0). Writing '0' to this file will disable polling for this device.
59for this device. Writing any non-zero value will enable this feature. 59Writing any non-zero value will enable this feature.
60 60
61io_poll_delay (RW) 61io_poll_delay (RW)
62------------------ 62------------------
diff --git a/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt b/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt
index 3e5b9793341f..8682ab6d4a50 100644
--- a/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt
+++ b/Documentation/devicetree/bindings/input/tps65218-pwrbutton.txt
@@ -8,8 +8,9 @@ This driver provides a simple power button event via an Interrupt.
8Required properties: 8Required properties:
9- compatible: should be "ti,tps65217-pwrbutton" or "ti,tps65218-pwrbutton" 9- compatible: should be "ti,tps65217-pwrbutton" or "ti,tps65218-pwrbutton"
10 10
11Required properties for TPS65218: 11Required properties:
12- interrupts: should be one of the following 12- interrupts: should be one of the following
13 - <2>: For controllers compatible with tps65217
13 - <3 IRQ_TYPE_EDGE_BOTH>: For controllers compatible with tps65218 14 - <3 IRQ_TYPE_EDGE_BOTH>: For controllers compatible with tps65218
14 15
15Examples: 16Examples:
@@ -17,6 +18,7 @@ Examples:
17&tps { 18&tps {
18 tps65217-pwrbutton { 19 tps65217-pwrbutton {
19 compatible = "ti,tps65217-pwrbutton"; 20 compatible = "ti,tps65217-pwrbutton";
21 interrupts = <2>;
20 }; 22 };
21}; 23};
22 24
diff --git a/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt b/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt
index 98d131acee95..a11072c5a866 100644
--- a/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt
+++ b/Documentation/devicetree/bindings/power/supply/tps65217_charger.txt
@@ -2,11 +2,16 @@ TPS65217 Charger
2 2
3Required Properties: 3Required Properties:
4-compatible: "ti,tps65217-charger" 4-compatible: "ti,tps65217-charger"
5-interrupts: TPS65217 interrupt numbers for the AC and USB charger input change.
6 Should be <0> for the USB charger and <1> for the AC adapter.
7-interrupt-names: Should be "USB" and "AC"
5 8
6This node is a subnode of the tps65217 PMIC. 9This node is a subnode of the tps65217 PMIC.
7 10
8Example: 11Example:
9 12
10 tps65217-charger { 13 tps65217-charger {
11 compatible = "ti,tps65090-charger"; 14 compatible = "ti,tps65217-charger";
15 interrupts = <0>, <1>;
16 interrupt-names = "USB", "AC";
12 }; 17 };
diff --git a/Documentation/networking/mpls-sysctl.txt b/Documentation/networking/mpls-sysctl.txt
index 9ed15f86c17c..15d8d16934fd 100644
--- a/Documentation/networking/mpls-sysctl.txt
+++ b/Documentation/networking/mpls-sysctl.txt
@@ -5,8 +5,8 @@ platform_labels - INTEGER
5 possible to configure forwarding for label values equal to or 5 possible to configure forwarding for label values equal to or
6 greater than the number of platform labels. 6 greater than the number of platform labels.
7 7
8 A dense utliziation of the entries in the platform label table 8 A dense utilization of the entries in the platform label table
9 is possible and expected aas the platform labels are locally 9 is possible and expected as the platform labels are locally
10 allocated. 10 allocated.
11 11
12 If the number of platform label table entries is set to 0 no 12 If the number of platform label table entries is set to 0 no
diff --git a/Documentation/unaligned-memory-access.txt b/Documentation/unaligned-memory-access.txt
index a445da098bc6..3f76c0c37920 100644
--- a/Documentation/unaligned-memory-access.txt
+++ b/Documentation/unaligned-memory-access.txt
@@ -151,7 +151,7 @@ bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
151#else 151#else
152 const u16 *a = (const u16 *)addr1; 152 const u16 *a = (const u16 *)addr1;
153 const u16 *b = (const u16 *)addr2; 153 const u16 *b = (const u16 *)addr2;
154 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 154 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
155#endif 155#endif
156} 156}
157 157
diff --git a/MAINTAINERS b/MAINTAINERS
index cfff2c9e3d94..9267b8fad791 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5080,9 +5080,11 @@ F: drivers/net/wan/dlci.c
5080F: drivers/net/wan/sdla.c 5080F: drivers/net/wan/sdla.c
5081 5081
5082FRAMEBUFFER LAYER 5082FRAMEBUFFER LAYER
5083M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
5083L: linux-fbdev@vger.kernel.org 5084L: linux-fbdev@vger.kernel.org
5085T: git git://github.com/bzolnier/linux.git
5084Q: http://patchwork.kernel.org/project/linux-fbdev/list/ 5086Q: http://patchwork.kernel.org/project/linux-fbdev/list/
5085S: Orphan 5087S: Maintained
5086F: Documentation/fb/ 5088F: Documentation/fb/
5087F: drivers/video/ 5089F: drivers/video/
5088F: include/video/ 5090F: include/video/
@@ -8852,17 +8854,22 @@ F: drivers/video/fbdev/nvidia/
8852NVM EXPRESS DRIVER 8854NVM EXPRESS DRIVER
8853M: Keith Busch <keith.busch@intel.com> 8855M: Keith Busch <keith.busch@intel.com>
8854M: Jens Axboe <axboe@fb.com> 8856M: Jens Axboe <axboe@fb.com>
8857M: Christoph Hellwig <hch@lst.de>
8858M: Sagi Grimberg <sagi@grimberg.me>
8855L: linux-nvme@lists.infradead.org 8859L: linux-nvme@lists.infradead.org
8856T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git 8860T: git://git.infradead.org/nvme.git
8857W: https://kernel.googlesource.com/pub/scm/linux/kernel/git/axboe/linux-block/ 8861W: http://git.infradead.org/nvme.git
8858S: Supported 8862S: Supported
8859F: drivers/nvme/host/ 8863F: drivers/nvme/host/
8860F: include/linux/nvme.h 8864F: include/linux/nvme.h
8865F: include/uapi/linux/nvme_ioctl.h
8861 8866
8862NVM EXPRESS TARGET DRIVER 8867NVM EXPRESS TARGET DRIVER
8863M: Christoph Hellwig <hch@lst.de> 8868M: Christoph Hellwig <hch@lst.de>
8864M: Sagi Grimberg <sagi@grimberg.me> 8869M: Sagi Grimberg <sagi@grimberg.me>
8865L: linux-nvme@lists.infradead.org 8870L: linux-nvme@lists.infradead.org
8871T: git://git.infradead.org/nvme.git
8872W: http://git.infradead.org/nvme.git
8866S: Supported 8873S: Supported
8867F: drivers/nvme/target/ 8874F: drivers/nvme/target/
8868 8875
@@ -9842,7 +9849,7 @@ M: Mark Rutland <mark.rutland@arm.com>
9842M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> 9849M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
9843L: linux-arm-kernel@lists.infradead.org 9850L: linux-arm-kernel@lists.infradead.org
9844S: Maintained 9851S: Maintained
9845F: drivers/firmware/psci.c 9852F: drivers/firmware/psci*.c
9846F: include/linux/psci.h 9853F: include/linux/psci.h
9847F: include/uapi/linux/psci.h 9854F: include/uapi/linux/psci.h
9848 9855
@@ -13527,11 +13534,11 @@ F: arch/x86/xen/*swiotlb*
13527F: drivers/xen/*swiotlb* 13534F: drivers/xen/*swiotlb*
13528 13535
13529XFS FILESYSTEM 13536XFS FILESYSTEM
13530M: Dave Chinner <david@fromorbit.com> 13537M: Darrick J. Wong <darrick.wong@oracle.com>
13531M: linux-xfs@vger.kernel.org 13538M: linux-xfs@vger.kernel.org
13532L: linux-xfs@vger.kernel.org 13539L: linux-xfs@vger.kernel.org
13533W: http://xfs.org/ 13540W: http://xfs.org/
13534T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git 13541T: git git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git
13535S: Supported 13542S: Supported
13536F: Documentation/filesystems/xfs.txt 13543F: Documentation/filesystems/xfs.txt
13537F: fs/xfs/ 13544F: fs/xfs/
diff --git a/Makefile b/Makefile
index ec411ba9e40f..5470d599384a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 4 1VERSION = 4
2PATCHLEVEL = 10 2PATCHLEVEL = 10
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Roaring Lionus 5NAME = Roaring Lionus
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5fab553fd03a..186c4c214e0a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1502,8 +1502,7 @@ source kernel/Kconfig.preempt
1502 1502
1503config HZ_FIXED 1503config HZ_FIXED
1504 int 1504 int
1505 default 200 if ARCH_EBSA110 || ARCH_S3C24XX || \ 1505 default 200 if ARCH_EBSA110
1506 ARCH_S5PV210 || ARCH_EXYNOS4
1507 default 128 if SOC_AT91RM9200 1506 default 128 if SOC_AT91RM9200
1508 default 0 1507 default 0
1509 1508
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index cccdbcb557b6..7327250f0bb6 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -501,6 +501,7 @@ dtb-$(CONFIG_ARCH_OMAP3) += \
501 am3517-evm.dtb \ 501 am3517-evm.dtb \
502 am3517_mt_ventoux.dtb \ 502 am3517_mt_ventoux.dtb \
503 logicpd-torpedo-37xx-devkit.dtb \ 503 logicpd-torpedo-37xx-devkit.dtb \
504 logicpd-som-lv-37xx-devkit.dtb \
504 omap3430-sdp.dtb \ 505 omap3430-sdp.dtb \
505 omap3-beagle.dtb \ 506 omap3-beagle.dtb \
506 omap3-beagle-xm.dtb \ 507 omap3-beagle-xm.dtb \
diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index dc561d505bbe..3e32dd18fd25 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -6,8 +6,6 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <dt-bindings/mfd/tps65217.h>
10
11/ { 9/ {
12 cpus { 10 cpus {
13 cpu@0 { 11 cpu@0 {
@@ -319,13 +317,13 @@
319 ti,pmic-shutdown-controller; 317 ti,pmic-shutdown-controller;
320 318
321 charger { 319 charger {
322 interrupts = <TPS65217_IRQ_AC>, <TPS65217_IRQ_USB>; 320 interrupts = <0>, <1>;
323 interrupts-names = "AC", "USB"; 321 interrupt-names = "USB", "AC";
324 status = "okay"; 322 status = "okay";
325 }; 323 };
326 324
327 pwrbutton { 325 pwrbutton {
328 interrupts = <TPS65217_IRQ_PB>; 326 interrupts = <2>;
329 status = "okay"; 327 status = "okay";
330 }; 328 };
331 329
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 64c8aa9057a3..18d72a245e88 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -16,6 +16,7 @@
16 interrupt-parent = <&intc>; 16 interrupt-parent = <&intc>;
17 #address-cells = <1>; 17 #address-cells = <1>;
18 #size-cells = <1>; 18 #size-cells = <1>;
19 chosen { };
19 20
20 aliases { 21 aliases {
21 i2c0 = &i2c0; 22 i2c0 = &i2c0;
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index ac55f93fc91e..2df9e6050c2f 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -16,6 +16,7 @@
16 interrupt-parent = <&wakeupgen>; 16 interrupt-parent = <&wakeupgen>;
17 #address-cells = <1>; 17 #address-cells = <1>;
18 #size-cells = <1>; 18 #size-cells = <1>;
19 chosen { };
19 20
20 memory@0 { 21 memory@0 {
21 device_type = "memory"; 22 device_type = "memory";
diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts
index d6e43e5184c1..ad68d1eb3bc3 100644
--- a/arch/arm/boot/dts/am571x-idk.dts
+++ b/arch/arm/boot/dts/am571x-idk.dts
@@ -62,11 +62,6 @@
62 linux,default-trigger = "mmc0"; 62 linux,default-trigger = "mmc0";
63 }; 63 };
64 }; 64 };
65
66 extcon_usb2: extcon_usb2 {
67 compatible = "linux,extcon-usb-gpio";
68 id-gpio = <&gpio5 7 GPIO_ACTIVE_HIGH>;
69 };
70}; 65};
71 66
72&mmc1 { 67&mmc1 {
@@ -79,3 +74,8 @@
79&omap_dwc3_2 { 74&omap_dwc3_2 {
80 extcon = <&extcon_usb2>; 75 extcon = <&extcon_usb2>;
81}; 76};
77
78&extcon_usb2 {
79 id-gpio = <&gpio5 7 GPIO_ACTIVE_HIGH>;
80 vbus-gpio = <&gpio7 22 GPIO_ACTIVE_HIGH>;
81};
diff --git a/arch/arm/boot/dts/am572x-idk.dts b/arch/arm/boot/dts/am572x-idk.dts
index 27d9149cedba..8350b4b34b08 100644
--- a/arch/arm/boot/dts/am572x-idk.dts
+++ b/arch/arm/boot/dts/am572x-idk.dts
@@ -23,11 +23,6 @@
23 reg = <0x0 0x80000000 0x0 0x80000000>; 23 reg = <0x0 0x80000000 0x0 0x80000000>;
24 }; 24 };
25 25
26 extcon_usb2: extcon_usb2 {
27 compatible = "linux,extcon-usb-gpio";
28 id-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>;
29 };
30
31 status-leds { 26 status-leds {
32 compatible = "gpio-leds"; 27 compatible = "gpio-leds";
33 cpu0-led { 28 cpu0-led {
@@ -76,6 +71,11 @@
76 extcon = <&extcon_usb2>; 71 extcon = <&extcon_usb2>;
77}; 72};
78 73
74&extcon_usb2 {
75 id-gpio = <&gpio3 16 GPIO_ACTIVE_HIGH>;
76 vbus-gpio = <&gpio3 26 GPIO_ACTIVE_HIGH>;
77};
78
79&mmc1 { 79&mmc1 {
80 status = "okay"; 80 status = "okay";
81 vmmc-supply = <&v3_3d>; 81 vmmc-supply = <&v3_3d>;
@@ -87,3 +87,7 @@
87&sn65hvs882 { 87&sn65hvs882 {
88 load-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>; 88 load-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>;
89}; 89};
90
91&pcie1 {
92 gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
93};
diff --git a/arch/arm/boot/dts/am57xx-idk-common.dtsi b/arch/arm/boot/dts/am57xx-idk-common.dtsi
index 555ae21f2b9a..814a720d5c3d 100644
--- a/arch/arm/boot/dts/am57xx-idk-common.dtsi
+++ b/arch/arm/boot/dts/am57xx-idk-common.dtsi
@@ -303,6 +303,13 @@
303 gpio-controller; 303 gpio-controller;
304 #gpio-cells = <2>; 304 #gpio-cells = <2>;
305 }; 305 };
306
307 extcon_usb2: tps659038_usb {
308 compatible = "ti,palmas-usb-vid";
309 ti,enable-vbus-detection;
310 ti,enable-id-detection;
311 /* ID & VBUS GPIOs provided in board dts */
312 };
306 }; 313 };
307}; 314};
308 315
@@ -369,7 +376,7 @@
369}; 376};
370 377
371&usb2 { 378&usb2 {
372 dr_mode = "otg"; 379 dr_mode = "peripheral";
373}; 380};
374 381
375&mmc2 { 382&mmc2 {
diff --git a/arch/arm/boot/dts/dm814x.dtsi b/arch/arm/boot/dts/dm814x.dtsi
index 1facc5f12cef..81b8cecb5820 100644
--- a/arch/arm/boot/dts/dm814x.dtsi
+++ b/arch/arm/boot/dts/dm814x.dtsi
@@ -12,6 +12,7 @@
12 interrupt-parent = <&intc>; 12 interrupt-parent = <&intc>;
13 #address-cells = <1>; 13 #address-cells = <1>;
14 #size-cells = <1>; 14 #size-cells = <1>;
15 chosen { };
15 16
16 aliases { 17 aliases {
17 i2c0 = &i2c1; 18 i2c0 = &i2c1;
diff --git a/arch/arm/boot/dts/dm816x.dtsi b/arch/arm/boot/dts/dm816x.dtsi
index 61dd2f6b02bc..6db652ae9bd5 100644
--- a/arch/arm/boot/dts/dm816x.dtsi
+++ b/arch/arm/boot/dts/dm816x.dtsi
@@ -12,6 +12,7 @@
12 interrupt-parent = <&intc>; 12 interrupt-parent = <&intc>;
13 #address-cells = <1>; 13 #address-cells = <1>;
14 #size-cells = <1>; 14 #size-cells = <1>;
15 chosen { };
15 16
16 aliases { 17 aliases {
17 i2c0 = &i2c1; 18 i2c0 = &i2c1;
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index addb7530cfbe..1faf24acd521 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -18,6 +18,7 @@
18 18
19 compatible = "ti,dra7xx"; 19 compatible = "ti,dra7xx";
20 interrupt-parent = <&crossbar_mpu>; 20 interrupt-parent = <&crossbar_mpu>;
21 chosen { };
21 22
22 aliases { 23 aliases {
23 i2c0 = &i2c1; 24 i2c0 = &i2c1;
diff --git a/arch/arm/boot/dts/dra72-evm-tps65917.dtsi b/arch/arm/boot/dts/dra72-evm-tps65917.dtsi
index ee6dac44edf1..e6df676886c0 100644
--- a/arch/arm/boot/dts/dra72-evm-tps65917.dtsi
+++ b/arch/arm/boot/dts/dra72-evm-tps65917.dtsi
@@ -132,3 +132,19 @@
132 ti,palmas-long-press-seconds = <6>; 132 ti,palmas-long-press-seconds = <6>;
133 }; 133 };
134}; 134};
135
136&usb2_phy1 {
137 phy-supply = <&ldo4_reg>;
138};
139
140&usb2_phy2 {
141 phy-supply = <&ldo4_reg>;
142};
143
144&dss {
145 vdda_video-supply = <&ldo5_reg>;
146};
147
148&mmc1 {
149 vmmc_aux-supply = <&ldo1_reg>;
150};
diff --git a/arch/arm/boot/dts/imx31.dtsi b/arch/arm/boot/dts/imx31.dtsi
index 685916e3d8a1..85cd8be22f71 100644
--- a/arch/arm/boot/dts/imx31.dtsi
+++ b/arch/arm/boot/dts/imx31.dtsi
@@ -31,11 +31,11 @@
31 }; 31 };
32 }; 32 };
33 33
34 avic: avic-interrupt-controller@60000000 { 34 avic: interrupt-controller@68000000 {
35 compatible = "fsl,imx31-avic", "fsl,avic"; 35 compatible = "fsl,imx31-avic", "fsl,avic";
36 interrupt-controller; 36 interrupt-controller;
37 #interrupt-cells = <1>; 37 #interrupt-cells = <1>;
38 reg = <0x60000000 0x100000>; 38 reg = <0x68000000 0x100000>;
39 }; 39 };
40 40
41 soc { 41 soc {
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
index e476d01959ea..26d060484728 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi
@@ -533,7 +533,6 @@
533 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17071 533 MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17071
534 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17071 534 MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17071
535 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17071 535 MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17071
536 MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 0x000b0
537 >; 536 >;
538 }; 537 };
539 538
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 53e6e63cbb02..89b834f3fa17 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -1100,6 +1100,7 @@
1100 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; 1100 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
1101 clocks = <&clks IMX6QDL_CLK_EIM_SLOW>; 1101 clocks = <&clks IMX6QDL_CLK_EIM_SLOW>;
1102 fsl,weim-cs-gpr = <&gpr>; 1102 fsl,weim-cs-gpr = <&gpr>;
1103 status = "disabled";
1103 }; 1104 };
1104 1105
1105 ocotp: ocotp@021bc000 { 1106 ocotp: ocotp@021bc000 {
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 4fd6de29f07d..19cbd879c448 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -900,6 +900,7 @@
900 reg = <0x021b8000 0x4000>; 900 reg = <0x021b8000 0x4000>;
901 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>; 901 interrupts = <0 14 IRQ_TYPE_LEVEL_HIGH>;
902 fsl,weim-cs-gpr = <&gpr>; 902 fsl,weim-cs-gpr = <&gpr>;
903 status = "disabled";
903 }; 904 };
904 905
905 ocotp: ocotp@021bc000 { 906 ocotp: ocotp@021bc000 {
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 076a30f9bcae..10f333016197 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -977,6 +977,7 @@
977 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>; 977 interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
978 clocks = <&clks IMX6SX_CLK_EIM_SLOW>; 978 clocks = <&clks IMX6SX_CLK_EIM_SLOW>;
979 fsl,weim-cs-gpr = <&gpr>; 979 fsl,weim-cs-gpr = <&gpr>;
980 status = "disabled";
980 }; 981 };
981 982
982 ocotp: ocotp@021bc000 { 983 ocotp: ocotp@021bc000 {
diff --git a/arch/arm/boot/dts/omap2.dtsi b/arch/arm/boot/dts/omap2.dtsi
index 4f793a025a72..f1d6de8b3c19 100644
--- a/arch/arm/boot/dts/omap2.dtsi
+++ b/arch/arm/boot/dts/omap2.dtsi
@@ -17,6 +17,7 @@
17 interrupt-parent = <&intc>; 17 interrupt-parent = <&intc>;
18 #address-cells = <1>; 18 #address-cells = <1>;
19 #size-cells = <1>; 19 #size-cells = <1>;
20 chosen { };
20 21
21 aliases { 22 aliases {
22 serial0 = &uart1; 23 serial0 = &uart1;
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index 87ca50b53002..4d448f145ed1 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -734,6 +734,8 @@
734 vmmc_aux-supply = <&vsim>; 734 vmmc_aux-supply = <&vsim>;
735 bus-width = <8>; 735 bus-width = <8>;
736 non-removable; 736 non-removable;
737 no-sdio;
738 no-sd;
737}; 739};
738 740
739&mmc3 { 741&mmc3 {
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index ecf5eb584c75..a3ff4933dbc1 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -17,6 +17,7 @@
17 interrupt-parent = <&intc>; 17 interrupt-parent = <&intc>;
18 #address-cells = <1>; 18 #address-cells = <1>;
19 #size-cells = <1>; 19 #size-cells = <1>;
20 chosen { };
20 21
21 aliases { 22 aliases {
22 i2c0 = &i2c1; 23 i2c0 = &i2c1;
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 8087456b5fbe..578c53f08309 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -15,6 +15,7 @@
15 interrupt-parent = <&wakeupgen>; 15 interrupt-parent = <&wakeupgen>;
16 #address-cells = <1>; 16 #address-cells = <1>;
17 #size-cells = <1>; 17 #size-cells = <1>;
18 chosen { };
18 19
19 aliases { 20 aliases {
20 i2c0 = &i2c1; 21 i2c0 = &i2c1;
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
index 968c67a49dbd..7cd92babc41a 100644
--- a/arch/arm/boot/dts/omap5.dtsi
+++ b/arch/arm/boot/dts/omap5.dtsi
@@ -17,6 +17,7 @@
17 17
18 compatible = "ti,omap5"; 18 compatible = "ti,omap5";
19 interrupt-parent = <&wakeupgen>; 19 interrupt-parent = <&wakeupgen>;
20 chosen { };
20 21
21 aliases { 22 aliases {
22 i2c0 = &i2c1; 23 i2c0 = &i2c1;
diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index 268bd470c865..407a4610f4a7 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -4,6 +4,7 @@
4#include <dt-bindings/clock/qcom,gcc-msm8960.h> 4#include <dt-bindings/clock/qcom,gcc-msm8960.h>
5#include <dt-bindings/reset/qcom,gcc-msm8960.h> 5#include <dt-bindings/reset/qcom,gcc-msm8960.h>
6#include <dt-bindings/clock/qcom,mmcc-msm8960.h> 6#include <dt-bindings/clock/qcom,mmcc-msm8960.h>
7#include <dt-bindings/clock/qcom,rpmcc.h>
7#include <dt-bindings/soc/qcom,gsbi.h> 8#include <dt-bindings/soc/qcom,gsbi.h>
8#include <dt-bindings/interrupt-controller/irq.h> 9#include <dt-bindings/interrupt-controller/irq.h>
9#include <dt-bindings/interrupt-controller/arm-gic.h> 10#include <dt-bindings/interrupt-controller/arm-gic.h>
@@ -303,6 +304,9 @@
303 firmware { 304 firmware {
304 scm { 305 scm {
305 compatible = "qcom,scm-apq8064"; 306 compatible = "qcom,scm-apq8064";
307
308 clocks = <&rpmcc RPM_DAYTONA_FABRIC_CLK>;
309 clock-names = "core";
306 }; 310 };
307 }; 311 };
308 312
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
index 102838fcc588..15f4fd3f4695 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts
@@ -81,7 +81,7 @@
81 #address-cells = <0>; 81 #address-cells = <0>;
82 interrupt-controller; 82 interrupt-controller;
83 reg = <0 0x2c001000 0 0x1000>, 83 reg = <0 0x2c001000 0 0x1000>,
84 <0 0x2c002000 0 0x1000>, 84 <0 0x2c002000 0 0x2000>,
85 <0 0x2c004000 0 0x2000>, 85 <0 0x2c004000 0 0x2000>,
86 <0 0x2c006000 0 0x2000>; 86 <0 0x2c006000 0 0x2000>;
87 interrupts = <1 9 0xf04>; 87 interrupts = <1 9 0xf04>;
diff --git a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
index 45d08cc37b01..bd107c5a0226 100644
--- a/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
+++ b/arch/arm/boot/dts/vexpress-v2p-ca15_a7.dts
@@ -131,7 +131,7 @@
131 #address-cells = <0>; 131 #address-cells = <0>;
132 interrupt-controller; 132 interrupt-controller;
133 reg = <0 0x2c001000 0 0x1000>, 133 reg = <0 0x2c001000 0 0x1000>,
134 <0 0x2c002000 0 0x1000>, 134 <0 0x2c002000 0 0x2000>,
135 <0 0x2c004000 0 0x2000>, 135 <0 0x2c004000 0 0x2000>,
136 <0 0x2c006000 0 0x2000>; 136 <0 0x2c006000 0 0x2000>;
137 interrupts = <1 9 0xf04>; 137 interrupts = <1 9 0xf04>;
diff --git a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
index 7ea617e47fe4..958b4c42d320 100644
--- a/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
+++ b/arch/arm/boot/dts/vf610-zii-dev-rev-b.dts
@@ -153,7 +153,8 @@
153 switch0phy1: switch1phy0@1 { 153 switch0phy1: switch1phy0@1 {
154 reg = <1>; 154 reg = <1>;
155 interrupt-parent = <&switch0>; 155 interrupt-parent = <&switch0>;
156 interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; }; 156 interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
157 };
157 switch0phy2: switch1phy0@2 { 158 switch0phy2: switch1phy0@2 {
158 reg = <2>; 159 reg = <2>;
159 interrupt-parent = <&switch0>; 160 interrupt-parent = <&switch0>;
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index df42c93a93d6..f5dce9b4e617 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -31,10 +31,10 @@ static LIST_HEAD(clocks);
31static DEFINE_MUTEX(clocks_mutex); 31static DEFINE_MUTEX(clocks_mutex);
32static DEFINE_SPINLOCK(clockfw_lock); 32static DEFINE_SPINLOCK(clockfw_lock);
33 33
34static void __clk_enable(struct clk *clk) 34void davinci_clk_enable(struct clk *clk)
35{ 35{
36 if (clk->parent) 36 if (clk->parent)
37 __clk_enable(clk->parent); 37 davinci_clk_enable(clk->parent);
38 if (clk->usecount++ == 0) { 38 if (clk->usecount++ == 0) {
39 if (clk->flags & CLK_PSC) 39 if (clk->flags & CLK_PSC)
40 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 40 davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc,
@@ -44,7 +44,7 @@ static void __clk_enable(struct clk *clk)
44 } 44 }
45} 45}
46 46
47static void __clk_disable(struct clk *clk) 47void davinci_clk_disable(struct clk *clk)
48{ 48{
49 if (WARN_ON(clk->usecount == 0)) 49 if (WARN_ON(clk->usecount == 0))
50 return; 50 return;
@@ -56,7 +56,7 @@ static void __clk_disable(struct clk *clk)
56 clk->clk_disable(clk); 56 clk->clk_disable(clk);
57 } 57 }
58 if (clk->parent) 58 if (clk->parent)
59 __clk_disable(clk->parent); 59 davinci_clk_disable(clk->parent);
60} 60}
61 61
62int davinci_clk_reset(struct clk *clk, bool reset) 62int davinci_clk_reset(struct clk *clk, bool reset)
@@ -103,7 +103,7 @@ int clk_enable(struct clk *clk)
103 return -EINVAL; 103 return -EINVAL;
104 104
105 spin_lock_irqsave(&clockfw_lock, flags); 105 spin_lock_irqsave(&clockfw_lock, flags);
106 __clk_enable(clk); 106 davinci_clk_enable(clk);
107 spin_unlock_irqrestore(&clockfw_lock, flags); 107 spin_unlock_irqrestore(&clockfw_lock, flags);
108 108
109 return 0; 109 return 0;
@@ -118,7 +118,7 @@ void clk_disable(struct clk *clk)
118 return; 118 return;
119 119
120 spin_lock_irqsave(&clockfw_lock, flags); 120 spin_lock_irqsave(&clockfw_lock, flags);
121 __clk_disable(clk); 121 davinci_clk_disable(clk);
122 spin_unlock_irqrestore(&clockfw_lock, flags); 122 spin_unlock_irqrestore(&clockfw_lock, flags);
123} 123}
124EXPORT_SYMBOL(clk_disable); 124EXPORT_SYMBOL(clk_disable);
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index e2a5437a1aee..fa2b83752e03 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -132,6 +132,8 @@ int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
132int davinci_set_refclk_rate(unsigned long rate); 132int davinci_set_refclk_rate(unsigned long rate);
133int davinci_simple_set_rate(struct clk *clk, unsigned long rate); 133int davinci_simple_set_rate(struct clk *clk, unsigned long rate);
134int davinci_clk_reset(struct clk *clk, bool reset); 134int davinci_clk_reset(struct clk *clk, bool reset);
135void davinci_clk_enable(struct clk *clk);
136void davinci_clk_disable(struct clk *clk);
135 137
136extern struct platform_device davinci_wdt_device; 138extern struct platform_device davinci_wdt_device;
137extern void davinci_watchdog_reset(struct platform_device *); 139extern void davinci_watchdog_reset(struct platform_device *);
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index e770c97ea45c..1d873d15b545 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -319,6 +319,16 @@ static struct clk emac_clk = {
319 .gpsc = 1, 319 .gpsc = 1,
320}; 320};
321 321
322/*
323 * In order to avoid adding the emac_clk to the clock lookup table twice (and
324 * screwing up the linked list in the process) create a separate clock for
325 * mdio inheriting the rate from emac_clk.
326 */
327static struct clk mdio_clk = {
328 .name = "mdio",
329 .parent = &emac_clk,
330};
331
322static struct clk mcasp_clk = { 332static struct clk mcasp_clk = {
323 .name = "mcasp", 333 .name = "mcasp",
324 .parent = &async3_clk, 334 .parent = &async3_clk,
@@ -367,6 +377,16 @@ static struct clk aemif_clk = {
367 .flags = ALWAYS_ENABLED, 377 .flags = ALWAYS_ENABLED,
368}; 378};
369 379
380/*
381 * In order to avoid adding the aemif_clk to the clock lookup table twice (and
382 * screwing up the linked list in the process) create a separate clock for
383 * nand inheriting the rate from aemif_clk.
384 */
385static struct clk aemif_nand_clk = {
386 .name = "nand",
387 .parent = &aemif_clk,
388};
389
370static struct clk usb11_clk = { 390static struct clk usb11_clk = {
371 .name = "usb11", 391 .name = "usb11",
372 .parent = &pll0_sysclk4, 392 .parent = &pll0_sysclk4,
@@ -529,7 +549,7 @@ static struct clk_lookup da850_clks[] = {
529 CLK(NULL, "arm", &arm_clk), 549 CLK(NULL, "arm", &arm_clk),
530 CLK(NULL, "rmii", &rmii_clk), 550 CLK(NULL, "rmii", &rmii_clk),
531 CLK("davinci_emac.1", NULL, &emac_clk), 551 CLK("davinci_emac.1", NULL, &emac_clk),
532 CLK("davinci_mdio.0", "fck", &emac_clk), 552 CLK("davinci_mdio.0", "fck", &mdio_clk),
533 CLK("davinci-mcasp.0", NULL, &mcasp_clk), 553 CLK("davinci-mcasp.0", NULL, &mcasp_clk),
534 CLK("davinci-mcbsp.0", NULL, &mcbsp0_clk), 554 CLK("davinci-mcbsp.0", NULL, &mcbsp0_clk),
535 CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk), 555 CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk),
@@ -537,7 +557,15 @@ static struct clk_lookup da850_clks[] = {
537 CLK("da830-mmc.0", NULL, &mmcsd0_clk), 557 CLK("da830-mmc.0", NULL, &mmcsd0_clk),
538 CLK("da830-mmc.1", NULL, &mmcsd1_clk), 558 CLK("da830-mmc.1", NULL, &mmcsd1_clk),
539 CLK("ti-aemif", NULL, &aemif_clk), 559 CLK("ti-aemif", NULL, &aemif_clk),
540 CLK(NULL, "aemif", &aemif_clk), 560 /*
561 * The only user of this clock is davinci_nand and it get's it through
562 * con_id. The nand node itself is created from within the aemif
563 * driver to guarantee that it's probed after the aemif timing
564 * parameters are configured. of_dev_auxdata is not accessible from
565 * the aemif driver and can't be passed to of_platform_populate(). For
566 * that reason we're leaving the dev_id here as NULL.
567 */
568 CLK(NULL, "aemif", &aemif_nand_clk),
541 CLK("ohci-da8xx", "usb11", &usb11_clk), 569 CLK("ohci-da8xx", "usb11", &usb11_clk),
542 CLK("musb-da8xx", "usb20", &usb20_clk), 570 CLK("musb-da8xx", "usb20", &usb20_clk),
543 CLK("spi_davinci.0", NULL, &spi0_clk), 571 CLK("spi_davinci.0", NULL, &spi0_clk),
diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c
index c6feecf7ae24..9a6af0bd5dc3 100644
--- a/arch/arm/mach-davinci/usb-da8xx.c
+++ b/arch/arm/mach-davinci/usb-da8xx.c
@@ -22,6 +22,8 @@
22#define DA8XX_USB0_BASE 0x01e00000 22#define DA8XX_USB0_BASE 0x01e00000
23#define DA8XX_USB1_BASE 0x01e25000 23#define DA8XX_USB1_BASE 0x01e25000
24 24
25static struct clk *usb20_clk;
26
25static struct platform_device da8xx_usb_phy = { 27static struct platform_device da8xx_usb_phy = {
26 .name = "da8xx-usb-phy", 28 .name = "da8xx-usb-phy",
27 .id = -1, 29 .id = -1,
@@ -158,26 +160,13 @@ int __init da8xx_register_usb_refclkin(int rate)
158 160
159static void usb20_phy_clk_enable(struct clk *clk) 161static void usb20_phy_clk_enable(struct clk *clk)
160{ 162{
161 struct clk *usb20_clk;
162 int err;
163 u32 val; 163 u32 val;
164 u32 timeout = 500000; /* 500 msec */ 164 u32 timeout = 500000; /* 500 msec */
165 165
166 val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 166 val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
167 167
168 usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20");
169 if (IS_ERR(usb20_clk)) {
170 pr_err("could not get usb20 clk: %ld\n", PTR_ERR(usb20_clk));
171 return;
172 }
173
174 /* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */ 168 /* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */
175 err = clk_prepare_enable(usb20_clk); 169 davinci_clk_enable(usb20_clk);
176 if (err) {
177 pr_err("failed to enable usb20 clk: %d\n", err);
178 clk_put(usb20_clk);
179 return;
180 }
181 170
182 /* 171 /*
183 * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1 172 * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1
@@ -197,8 +186,7 @@ static void usb20_phy_clk_enable(struct clk *clk)
197 186
198 pr_err("Timeout waiting for USB 2.0 PHY clock good\n"); 187 pr_err("Timeout waiting for USB 2.0 PHY clock good\n");
199done: 188done:
200 clk_disable_unprepare(usb20_clk); 189 davinci_clk_disable(usb20_clk);
201 clk_put(usb20_clk);
202} 190}
203 191
204static void usb20_phy_clk_disable(struct clk *clk) 192static void usb20_phy_clk_disable(struct clk *clk)
@@ -285,11 +273,19 @@ static struct clk_lookup usb20_phy_clk_lookup =
285int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin) 273int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin)
286{ 274{
287 struct clk *parent; 275 struct clk *parent;
288 int ret = 0; 276 int ret;
277
278 usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20");
279 ret = PTR_ERR_OR_ZERO(usb20_clk);
280 if (ret)
281 return ret;
289 282
290 parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux"); 283 parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux");
291 if (IS_ERR(parent)) 284 ret = PTR_ERR_OR_ZERO(parent);
292 return PTR_ERR(parent); 285 if (ret) {
286 clk_put(usb20_clk);
287 return ret;
288 }
293 289
294 usb20_phy_clk.parent = parent; 290 usb20_phy_clk.parent = parent;
295 ret = clk_register(&usb20_phy_clk); 291 ret = clk_register(&usb20_phy_clk);
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 98ffe1e62ad5..a5d68411a037 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -385,36 +385,6 @@ fail:
385 return pen_release != -1 ? ret : 0; 385 return pen_release != -1 ? ret : 0;
386} 386}
387 387
388/*
389 * Initialise the CPU possible map early - this describes the CPUs
390 * which may be present or become present in the system.
391 */
392
393static void __init exynos_smp_init_cpus(void)
394{
395 void __iomem *scu_base = scu_base_addr();
396 unsigned int i, ncores;
397
398 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9)
399 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
400 else
401 /*
402 * CPU Nodes are passed thru DT and set_cpu_possible
403 * is set by "arm_dt_init_cpu_maps".
404 */
405 return;
406
407 /* sanity check */
408 if (ncores > nr_cpu_ids) {
409 pr_warn("SMP: %u cores greater than maximum (%u), clipping\n",
410 ncores, nr_cpu_ids);
411 ncores = nr_cpu_ids;
412 }
413
414 for (i = 0; i < ncores; i++)
415 set_cpu_possible(i, true);
416}
417
418static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) 388static void __init exynos_smp_prepare_cpus(unsigned int max_cpus)
419{ 389{
420 int i; 390 int i;
@@ -479,7 +449,6 @@ static void exynos_cpu_die(unsigned int cpu)
479#endif /* CONFIG_HOTPLUG_CPU */ 449#endif /* CONFIG_HOTPLUG_CPU */
480 450
481const struct smp_operations exynos_smp_ops __initconst = { 451const struct smp_operations exynos_smp_ops __initconst = {
482 .smp_init_cpus = exynos_smp_init_cpus,
483 .smp_prepare_cpus = exynos_smp_prepare_cpus, 452 .smp_prepare_cpus = exynos_smp_prepare_cpus,
484 .smp_secondary_init = exynos_secondary_init, 453 .smp_secondary_init = exynos_secondary_init,
485 .smp_boot_secondary = exynos_boot_secondary, 454 .smp_boot_secondary = exynos_boot_secondary,
diff --git a/arch/arm/mach-imx/mach-imx1.c b/arch/arm/mach-imx/mach-imx1.c
index de5ab8d88549..3a8406e45b65 100644
--- a/arch/arm/mach-imx/mach-imx1.c
+++ b/arch/arm/mach-imx/mach-imx1.c
@@ -37,7 +37,6 @@ static const char * const imx1_dt_board_compat[] __initconst = {
37}; 37};
38 38
39DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)") 39DT_MACHINE_START(IMX1_DT, "Freescale i.MX1 (Device Tree Support)")
40 .map_io = debug_ll_io_init,
41 .init_early = imx1_init_early, 40 .init_early = imx1_init_early,
42 .init_irq = imx1_init_irq, 41 .init_irq = imx1_init_irq,
43 .dt_compat = imx1_dt_board_compat, 42 .dt_compat = imx1_dt_board_compat,
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 469894082fea..093458b62c8d 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -7,7 +7,7 @@ ccflags-y := -I$(srctree)/$(src)/include \
7 7
8# Common support 8# Common support
9obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \ 9obj-y := id.o io.o control.o devices.o fb.o timer.o pm.o \
10 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 10 common.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
11 omap_device.o omap-headsmp.o sram.o drm.o 11 omap_device.o omap-headsmp.o sram.o drm.o
12 12
13hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ 13hwmod-common = omap_hwmod.o omap_hwmod_reset.o \
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 36d9943205ca..dc9e34e670a2 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -304,7 +304,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
304 .init_late = am43xx_init_late, 304 .init_late = am43xx_init_late,
305 .init_irq = omap_gic_of_init, 305 .init_irq = omap_gic_of_init,
306 .init_machine = omap_generic_init, 306 .init_machine = omap_generic_init,
307 .init_time = omap4_local_timer_init, 307 .init_time = omap3_gptimer_timer_init,
308 .dt_compat = am43_boards_compat, 308 .dt_compat = am43_boards_compat,
309 .restart = omap44xx_restart, 309 .restart = omap44xx_restart,
310MACHINE_END 310MACHINE_END
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
deleted file mode 100644
index 7a577145b68b..000000000000
--- a/arch/arm/mach-omap2/gpio.c
+++ /dev/null
@@ -1,160 +0,0 @@
1/*
2 * OMAP2+ specific gpio initialization
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Author:
7 * Charulatha V <charu@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/gpio.h>
20#include <linux/err.h>
21#include <linux/slab.h>
22#include <linux/interrupt.h>
23#include <linux/of.h>
24#include <linux/platform_data/gpio-omap.h>
25
26#include "soc.h"
27#include "omap_hwmod.h"
28#include "omap_device.h"
29#include "omap-pm.h"
30
31#include "powerdomain.h"
32
33static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
34{
35 struct platform_device *pdev;
36 struct omap_gpio_platform_data *pdata;
37 struct omap_gpio_dev_attr *dev_attr;
38 char *name = "omap_gpio";
39 int id;
40 struct powerdomain *pwrdm;
41
42 /*
43 * extract the device id from name field available in the
44 * hwmod database and use the same for constructing ids for
45 * gpio devices.
46 * CAUTION: Make sure the name in the hwmod database does
47 * not change. If changed, make corresponding change here
48 * or make use of static variable mechanism to handle this.
49 */
50 sscanf(oh->name, "gpio%d", &id);
51
52 pdata = kzalloc(sizeof(struct omap_gpio_platform_data), GFP_KERNEL);
53 if (!pdata) {
54 pr_err("gpio%d: Memory allocation failed\n", id);
55 return -ENOMEM;
56 }
57
58 dev_attr = (struct omap_gpio_dev_attr *)oh->dev_attr;
59 pdata->bank_width = dev_attr->bank_width;
60 pdata->dbck_flag = dev_attr->dbck_flag;
61 pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
62 pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
63 if (!pdata->regs) {
64 pr_err("gpio%d: Memory allocation failed\n", id);
65 kfree(pdata);
66 return -ENOMEM;
67 }
68
69 switch (oh->class->rev) {
70 case 0:
71 if (id == 1)
72 /* non-wakeup GPIO pins for OMAP2 Bank1 */
73 pdata->non_wakeup_gpios = 0xe203ffc0;
74 else if (id == 2)
75 /* non-wakeup GPIO pins for OMAP2 Bank2 */
76 pdata->non_wakeup_gpios = 0x08700040;
77 /* fall through */
78
79 case 1:
80 pdata->regs->revision = OMAP24XX_GPIO_REVISION;
81 pdata->regs->direction = OMAP24XX_GPIO_OE;
82 pdata->regs->datain = OMAP24XX_GPIO_DATAIN;
83 pdata->regs->dataout = OMAP24XX_GPIO_DATAOUT;
84 pdata->regs->set_dataout = OMAP24XX_GPIO_SETDATAOUT;
85 pdata->regs->clr_dataout = OMAP24XX_GPIO_CLEARDATAOUT;
86 pdata->regs->irqstatus = OMAP24XX_GPIO_IRQSTATUS1;
87 pdata->regs->irqstatus2 = OMAP24XX_GPIO_IRQSTATUS2;
88 pdata->regs->irqenable = OMAP24XX_GPIO_IRQENABLE1;
89 pdata->regs->irqenable2 = OMAP24XX_GPIO_IRQENABLE2;
90 pdata->regs->set_irqenable = OMAP24XX_GPIO_SETIRQENABLE1;
91 pdata->regs->clr_irqenable = OMAP24XX_GPIO_CLEARIRQENABLE1;
92 pdata->regs->debounce = OMAP24XX_GPIO_DEBOUNCE_VAL;
93 pdata->regs->debounce_en = OMAP24XX_GPIO_DEBOUNCE_EN;
94 pdata->regs->ctrl = OMAP24XX_GPIO_CTRL;
95 pdata->regs->wkup_en = OMAP24XX_GPIO_WAKE_EN;
96 pdata->regs->leveldetect0 = OMAP24XX_GPIO_LEVELDETECT0;
97 pdata->regs->leveldetect1 = OMAP24XX_GPIO_LEVELDETECT1;
98 pdata->regs->risingdetect = OMAP24XX_GPIO_RISINGDETECT;
99 pdata->regs->fallingdetect = OMAP24XX_GPIO_FALLINGDETECT;
100 break;
101 case 2:
102 pdata->regs->revision = OMAP4_GPIO_REVISION;
103 pdata->regs->direction = OMAP4_GPIO_OE;
104 pdata->regs->datain = OMAP4_GPIO_DATAIN;
105 pdata->regs->dataout = OMAP4_GPIO_DATAOUT;
106 pdata->regs->set_dataout = OMAP4_GPIO_SETDATAOUT;
107 pdata->regs->clr_dataout = OMAP4_GPIO_CLEARDATAOUT;
108 pdata->regs->irqstatus_raw0 = OMAP4_GPIO_IRQSTATUSRAW0;
109 pdata->regs->irqstatus_raw1 = OMAP4_GPIO_IRQSTATUSRAW1;
110 pdata->regs->irqstatus = OMAP4_GPIO_IRQSTATUS0;
111 pdata->regs->irqstatus2 = OMAP4_GPIO_IRQSTATUS1;
112 pdata->regs->irqenable = OMAP4_GPIO_IRQSTATUSSET0;
113 pdata->regs->irqenable2 = OMAP4_GPIO_IRQSTATUSSET1;
114 pdata->regs->set_irqenable = OMAP4_GPIO_IRQSTATUSSET0;
115 pdata->regs->clr_irqenable = OMAP4_GPIO_IRQSTATUSCLR0;
116 pdata->regs->debounce = OMAP4_GPIO_DEBOUNCINGTIME;
117 pdata->regs->debounce_en = OMAP4_GPIO_DEBOUNCENABLE;
118 pdata->regs->ctrl = OMAP4_GPIO_CTRL;
119 pdata->regs->wkup_en = OMAP4_GPIO_IRQWAKEN0;
120 pdata->regs->leveldetect0 = OMAP4_GPIO_LEVELDETECT0;
121 pdata->regs->leveldetect1 = OMAP4_GPIO_LEVELDETECT1;
122 pdata->regs->risingdetect = OMAP4_GPIO_RISINGDETECT;
123 pdata->regs->fallingdetect = OMAP4_GPIO_FALLINGDETECT;
124 break;
125 default:
126 WARN(1, "Invalid gpio bank_type\n");
127 kfree(pdata->regs);
128 kfree(pdata);
129 return -EINVAL;
130 }
131
132 pwrdm = omap_hwmod_get_pwrdm(oh);
133 pdata->loses_context = pwrdm_can_ever_lose_context(pwrdm);
134
135 pdev = omap_device_build(name, id - 1, oh, pdata, sizeof(*pdata));
136 kfree(pdata);
137
138 if (IS_ERR(pdev)) {
139 WARN(1, "Can't build omap_device for %s:%s.\n",
140 name, oh->name);
141 return PTR_ERR(pdev);
142 }
143
144 return 0;
145}
146
147/*
148 * gpio_init needs to be done before
149 * machine_init functions access gpio APIs.
150 * Hence gpio_init is a omap_postcore_initcall.
151 */
152static int __init omap2_gpio_init(void)
153{
154 /* If dtb is there, the devices will be created dynamically */
155 if (of_have_populated_dt())
156 return -ENODEV;
157
158 return omap_hwmod_for_each_by_class("gpio", omap2_gpio_dev_init, NULL);
159}
160omap_postcore_initcall(omap2_gpio_init);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 759e1d45ba25..e8b988714a09 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -741,14 +741,14 @@ static int _init_main_clk(struct omap_hwmod *oh)
741 int ret = 0; 741 int ret = 0;
742 char name[MOD_CLK_MAX_NAME_LEN]; 742 char name[MOD_CLK_MAX_NAME_LEN];
743 struct clk *clk; 743 struct clk *clk;
744 static const char modck[] = "_mod_ck";
744 745
745 /* +7 magic comes from '_mod_ck' suffix */ 746 if (strlen(oh->name) >= MOD_CLK_MAX_NAME_LEN - strlen(modck))
746 if (strlen(oh->name) + 7 > MOD_CLK_MAX_NAME_LEN)
747 pr_warn("%s: warning: cropping name for %s\n", __func__, 747 pr_warn("%s: warning: cropping name for %s\n", __func__,
748 oh->name); 748 oh->name);
749 749
750 strncpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - 7); 750 strlcpy(name, oh->name, MOD_CLK_MAX_NAME_LEN - strlen(modck));
751 strcat(name, "_mod_ck"); 751 strlcat(name, modck, MOD_CLK_MAX_NAME_LEN);
752 752
753 clk = clk_get(NULL, name); 753 clk = clk_get(NULL, name);
754 if (!IS_ERR(clk)) { 754 if (!IS_ERR(clk)) {
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index cdfbb44ceb0c..f22e9cb39f4a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -121,10 +121,6 @@ extern struct omap_hwmod_irq_info omap2_uart3_mpu_irqs[];
121extern struct omap_hwmod_irq_info omap2_dispc_irqs[]; 121extern struct omap_hwmod_irq_info omap2_dispc_irqs[];
122extern struct omap_hwmod_irq_info omap2_i2c1_mpu_irqs[]; 122extern struct omap_hwmod_irq_info omap2_i2c1_mpu_irqs[];
123extern struct omap_hwmod_irq_info omap2_i2c2_mpu_irqs[]; 123extern struct omap_hwmod_irq_info omap2_i2c2_mpu_irqs[];
124extern struct omap_hwmod_irq_info omap2_gpio1_irqs[];
125extern struct omap_hwmod_irq_info omap2_gpio2_irqs[];
126extern struct omap_hwmod_irq_info omap2_gpio3_irqs[];
127extern struct omap_hwmod_irq_info omap2_gpio4_irqs[];
128extern struct omap_hwmod_irq_info omap2_dma_system_irqs[]; 124extern struct omap_hwmod_irq_info omap2_dma_system_irqs[];
129extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[]; 125extern struct omap_hwmod_irq_info omap2_mcspi1_mpu_irqs[];
130extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[]; 126extern struct omap_hwmod_irq_info omap2_mcspi2_mpu_irqs[];
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 5b2f5138d938..2b138b65129a 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -295,10 +295,8 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
295 GFP_KERNEL); 295 GFP_KERNEL);
296 296
297 if (!prcm_irq_chips || !prcm_irq_setup->saved_mask || 297 if (!prcm_irq_chips || !prcm_irq_setup->saved_mask ||
298 !prcm_irq_setup->priority_mask) { 298 !prcm_irq_setup->priority_mask)
299 pr_err("PRCM: kzalloc failed\n");
300 goto err; 299 goto err;
301 }
302 300
303 memset(mask, 0, sizeof(mask)); 301 memset(mask, 0, sizeof(mask));
304 302
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 56128da23c3a..07dd692c4737 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -510,18 +510,19 @@ void __init omap3_secure_sync32k_timer_init(void)
510} 510}
511#endif /* CONFIG_ARCH_OMAP3 */ 511#endif /* CONFIG_ARCH_OMAP3 */
512 512
513#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) 513#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_SOC_AM33XX) || \
514 defined(CONFIG_SOC_AM43XX)
514void __init omap3_gptimer_timer_init(void) 515void __init omap3_gptimer_timer_init(void)
515{ 516{
516 __omap_sync32k_timer_init(2, "timer_sys_ck", NULL, 517 __omap_sync32k_timer_init(2, "timer_sys_ck", NULL,
517 1, "timer_sys_ck", "ti,timer-alwon", true); 518 1, "timer_sys_ck", "ti,timer-alwon", true);
518 519 if (of_have_populated_dt())
519 clocksource_probe(); 520 clocksource_probe();
520} 521}
521#endif 522#endif
522 523
523#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \ 524#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) || \
524 defined(CONFIG_SOC_DRA7XX) || defined(CONFIG_SOC_AM43XX) 525 defined(CONFIG_SOC_DRA7XX)
525static void __init omap4_sync32k_timer_init(void) 526static void __init omap4_sync32k_timer_init(void)
526{ 527{
527 __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon", 528 __omap_sync32k_timer_init(1, "timer_32k_ck", "ti,timer-alwon",
diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c
index f6c3f151d0d4..b59f4f4f256f 100644
--- a/arch/arm/mach-s3c24xx/common.c
+++ b/arch/arm/mach-s3c24xx/common.c
@@ -345,10 +345,40 @@ static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
345 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), }, 345 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
346}; 346};
347 347
348static const struct dma_slave_map s3c2410_dma_slave_map[] = {
349 { "s3c2410-sdi", "rx-tx", (void *)DMACH_SDI },
350 { "s3c2410-spi.0", "rx", (void *)DMACH_SPI0_RX },
351 { "s3c2410-spi.0", "tx", (void *)DMACH_SPI0_TX },
352 { "s3c2410-spi.1", "rx", (void *)DMACH_SPI1_RX },
353 { "s3c2410-spi.1", "tx", (void *)DMACH_SPI1_TX },
354 /*
355 * The DMA request source[1] (DMACH_UARTx_SRC2) are
356 * not used in the UART driver.
357 */
358 { "s3c2410-uart.0", "rx", (void *)DMACH_UART0 },
359 { "s3c2410-uart.0", "tx", (void *)DMACH_UART0 },
360 { "s3c2410-uart.1", "rx", (void *)DMACH_UART1 },
361 { "s3c2410-uart.1", "tx", (void *)DMACH_UART1 },
362 { "s3c2410-uart.2", "rx", (void *)DMACH_UART2 },
363 { "s3c2410-uart.2", "tx", (void *)DMACH_UART2 },
364 { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
365 { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
366 { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
367 { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
368 { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
369 { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
370 { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
371 { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
372 { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
373 { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
374};
375
348static struct s3c24xx_dma_platdata s3c2410_dma_platdata = { 376static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
349 .num_phy_channels = 4, 377 .num_phy_channels = 4,
350 .channels = s3c2410_dma_channels, 378 .channels = s3c2410_dma_channels,
351 .num_channels = DMACH_MAX, 379 .num_channels = DMACH_MAX,
380 .slave_map = s3c2410_dma_slave_map,
381 .slavecnt = ARRAY_SIZE(s3c2410_dma_slave_map),
352}; 382};
353 383
354struct platform_device s3c2410_device_dma = { 384struct platform_device s3c2410_device_dma = {
@@ -388,10 +418,36 @@ static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
388 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 }, 418 [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
389}; 419};
390 420
421static const struct dma_slave_map s3c2412_dma_slave_map[] = {
422 { "s3c2412-sdi", "rx-tx", (void *)DMACH_SDI },
423 { "s3c2412-spi.0", "rx", (void *)DMACH_SPI0_RX },
424 { "s3c2412-spi.0", "tx", (void *)DMACH_SPI0_TX },
425 { "s3c2412-spi.1", "rx", (void *)DMACH_SPI1_RX },
426 { "s3c2412-spi.1", "tx", (void *)DMACH_SPI1_TX },
427 { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
428 { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
429 { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
430 { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
431 { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
432 { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
433 { "s3c2412-iis", "rx", (void *)DMACH_I2S_IN },
434 { "s3c2412-iis", "tx", (void *)DMACH_I2S_OUT },
435 { "s3c-hsudc", "rx0", (void *)DMACH_USB_EP1 },
436 { "s3c-hsudc", "tx0", (void *)DMACH_USB_EP1 },
437 { "s3c-hsudc", "rx1", (void *)DMACH_USB_EP2 },
438 { "s3c-hsudc", "tx1", (void *)DMACH_USB_EP2 },
439 { "s3c-hsudc", "rx2", (void *)DMACH_USB_EP3 },
440 { "s3c-hsudc", "tx2", (void *)DMACH_USB_EP3 },
441 { "s3c-hsudc", "rx3", (void *)DMACH_USB_EP4 },
442 { "s3c-hsudc", "tx3", (void *)DMACH_USB_EP4 }
443};
444
391static struct s3c24xx_dma_platdata s3c2412_dma_platdata = { 445static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
392 .num_phy_channels = 4, 446 .num_phy_channels = 4,
393 .channels = s3c2412_dma_channels, 447 .channels = s3c2412_dma_channels,
394 .num_channels = DMACH_MAX, 448 .num_channels = DMACH_MAX,
449 .slave_map = s3c2412_dma_slave_map,
450 .slavecnt = ARRAY_SIZE(s3c2412_dma_slave_map),
395}; 451};
396 452
397struct platform_device s3c2412_device_dma = { 453struct platform_device s3c2412_device_dma = {
@@ -534,10 +590,30 @@ static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
534 [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 }, 590 [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
535}; 591};
536 592
593static const struct dma_slave_map s3c2443_dma_slave_map[] = {
594 { "s3c2440-sdi", "rx-tx", (void *)DMACH_SDI },
595 { "s3c2443-spi.0", "rx", (void *)DMACH_SPI0_RX },
596 { "s3c2443-spi.0", "tx", (void *)DMACH_SPI0_TX },
597 { "s3c2443-spi.1", "rx", (void *)DMACH_SPI1_RX },
598 { "s3c2443-spi.1", "tx", (void *)DMACH_SPI1_TX },
599 { "s3c2440-uart.0", "rx", (void *)DMACH_UART0 },
600 { "s3c2440-uart.0", "tx", (void *)DMACH_UART0 },
601 { "s3c2440-uart.1", "rx", (void *)DMACH_UART1 },
602 { "s3c2440-uart.1", "tx", (void *)DMACH_UART1 },
603 { "s3c2440-uart.2", "rx", (void *)DMACH_UART2 },
604 { "s3c2440-uart.2", "tx", (void *)DMACH_UART2 },
605 { "s3c2440-uart.3", "rx", (void *)DMACH_UART3 },
606 { "s3c2440-uart.3", "tx", (void *)DMACH_UART3 },
607 { "s3c24xx-iis", "rx", (void *)DMACH_I2S_IN },
608 { "s3c24xx-iis", "tx", (void *)DMACH_I2S_OUT },
609};
610
537static struct s3c24xx_dma_platdata s3c2443_dma_platdata = { 611static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
538 .num_phy_channels = 6, 612 .num_phy_channels = 6,
539 .channels = s3c2443_dma_channels, 613 .channels = s3c2443_dma_channels,
540 .num_channels = DMACH_MAX, 614 .num_channels = DMACH_MAX,
615 .slave_map = s3c2443_dma_slave_map,
616 .slavecnt = ARRAY_SIZE(s3c2443_dma_slave_map),
541}; 617};
542 618
543struct platform_device s3c2443_device_dma = { 619struct platform_device s3c2443_device_dma = {
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index fc033c0d2a0f..eada0b58ba1c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -356,5 +356,21 @@
356 status = "disabled"; 356 status = "disabled";
357 }; 357 };
358 }; 358 };
359
360 vpu: vpu@d0100000 {
361 compatible = "amlogic,meson-gx-vpu";
362 reg = <0x0 0xd0100000 0x0 0x100000>,
363 <0x0 0xc883c000 0x0 0x1000>,
364 <0x0 0xc8838000 0x0 0x1000>;
365 reg-names = "vpu", "hhi", "dmc";
366 interrupts = <GIC_SPI 3 IRQ_TYPE_EDGE_RISING>;
367 #address-cells = <1>;
368 #size-cells = <0>;
369
370 /* CVBS VDAC output port */
371 cvbs_vdac_port: port@0 {
372 reg = <0>;
373 };
374 };
359 }; 375 };
360}; 376};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
index 969682092e0f..4cbd626a9e88 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts
@@ -142,6 +142,16 @@
142 clocks = <&wifi32k>; 142 clocks = <&wifi32k>;
143 clock-names = "ext_clock"; 143 clock-names = "ext_clock";
144 }; 144 };
145
146 cvbs-connector {
147 compatible = "composite-video-connector";
148
149 port {
150 cvbs_connector_in: endpoint {
151 remote-endpoint = <&cvbs_vdac_out>;
152 };
153 };
154 };
145}; 155};
146 156
147&uart_AO { 157&uart_AO {
@@ -229,3 +239,9 @@
229 clocks = <&clkc CLKID_FCLK_DIV4>; 239 clocks = <&clkc CLKID_FCLK_DIV4>;
230 clock-names = "clkin0"; 240 clock-names = "clkin0";
231}; 241};
242
243&cvbs_vdac_port {
244 cvbs_vdac_out: endpoint {
245 remote-endpoint = <&cvbs_connector_in>;
246 };
247};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
index 203be28978d5..4a96e0f6f926 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi
@@ -125,6 +125,16 @@
125 clocks = <&wifi32k>; 125 clocks = <&wifi32k>;
126 clock-names = "ext_clock"; 126 clock-names = "ext_clock";
127 }; 127 };
128
129 cvbs-connector {
130 compatible = "composite-video-connector";
131
132 port {
133 cvbs_connector_in: endpoint {
134 remote-endpoint = <&cvbs_vdac_out>;
135 };
136 };
137 };
128}; 138};
129 139
130/* This UART is brought out to the DB9 connector */ 140/* This UART is brought out to the DB9 connector */
@@ -234,3 +244,9 @@
234 clocks = <&clkc CLKID_FCLK_DIV4>; 244 clocks = <&clkc CLKID_FCLK_DIV4>;
235 clock-names = "clkin0"; 245 clock-names = "clkin0";
236}; 246};
247
248&cvbs_vdac_port {
249 cvbs_vdac_out: endpoint {
250 remote-endpoint = <&cvbs_connector_in>;
251 };
252};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
index 51edd5b5c460..596240c38a9c 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -506,3 +506,7 @@
506 <&clkc CLKID_FCLK_DIV2>; 506 <&clkc CLKID_FCLK_DIV2>;
507 clock-names = "core", "clkin0", "clkin1"; 507 clock-names = "core", "clkin0", "clkin1";
508}; 508};
509
510&vpu {
511 compatible = "amlogic,meson-gxbb-vpu", "amlogic,meson-gx-vpu";
512};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts
index e99101ae9664..cea4a3eded9b 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-nexbox-a95x.dts
@@ -117,6 +117,16 @@
117 clocks = <&wifi32k>; 117 clocks = <&wifi32k>;
118 clock-names = "ext_clock"; 118 clock-names = "ext_clock";
119 }; 119 };
120
121 cvbs-connector {
122 compatible = "composite-video-connector";
123
124 port {
125 cvbs_connector_in: endpoint {
126 remote-endpoint = <&cvbs_vdac_out>;
127 };
128 };
129 };
120}; 130};
121 131
122&uart_AO { 132&uart_AO {
@@ -203,3 +213,9 @@
203 clocks = <&clkc CLKID_FCLK_DIV4>; 213 clocks = <&clkc CLKID_FCLK_DIV4>;
204 clock-names = "clkin0"; 214 clock-names = "clkin0";
205}; 215};
216
217&cvbs_vdac_port {
218 cvbs_vdac_out: endpoint {
219 remote-endpoint = <&cvbs_connector_in>;
220 };
221};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
index 9f89b99c4806..69216246275d 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl.dtsi
@@ -43,7 +43,7 @@
43 43
44#include "meson-gx.dtsi" 44#include "meson-gx.dtsi"
45#include <dt-bindings/clock/gxbb-clkc.h> 45#include <dt-bindings/clock/gxbb-clkc.h>
46#include <dt-bindings/gpio/meson-gxbb-gpio.h> 46#include <dt-bindings/gpio/meson-gxl-gpio.h>
47 47
48/ { 48/ {
49 compatible = "amlogic,meson-gxl"; 49 compatible = "amlogic,meson-gxl";
@@ -299,3 +299,7 @@
299 <&clkc CLKID_FCLK_DIV2>; 299 <&clkc CLKID_FCLK_DIV2>;
300 clock-names = "core", "clkin0", "clkin1"; 300 clock-names = "core", "clkin0", "clkin1";
301}; 301};
302
303&vpu {
304 compatible = "amlogic,meson-gxl-vpu", "amlogic,meson-gx-vpu";
305};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
index f859d75db8bd..5a337d339df1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts
@@ -90,6 +90,16 @@
90 compatible = "mmc-pwrseq-emmc"; 90 compatible = "mmc-pwrseq-emmc";
91 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; 91 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
92 }; 92 };
93
94 cvbs-connector {
95 compatible = "composite-video-connector";
96
97 port {
98 cvbs_connector_in: endpoint {
99 remote-endpoint = <&cvbs_vdac_out>;
100 };
101 };
102 };
93}; 103};
94 104
95/* This UART is brought out to the DB9 connector */ 105/* This UART is brought out to the DB9 connector */
@@ -167,3 +177,9 @@
167 max-speed = <1000>; 177 max-speed = <1000>;
168 }; 178 };
169}; 179};
180
181&cvbs_vdac_port {
182 cvbs_vdac_out: endpoint {
183 remote-endpoint = <&cvbs_connector_in>;
184 };
185};
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
index c1974bbbddea..eb2f0c3e5e53 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxm.dtsi
@@ -112,3 +112,7 @@
112 }; 112 };
113 }; 113 };
114}; 114};
115
116&vpu {
117 compatible = "amlogic,meson-gxm-vpu", "amlogic,meson-gx-vpu";
118};
diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
index a852e28a40e1..a83ed2c6bbf7 100644
--- a/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts
@@ -81,7 +81,7 @@
81 #address-cells = <0>; 81 #address-cells = <0>;
82 interrupt-controller; 82 interrupt-controller;
83 reg = <0x0 0x2c001000 0 0x1000>, 83 reg = <0x0 0x2c001000 0 0x1000>,
84 <0x0 0x2c002000 0 0x1000>, 84 <0x0 0x2c002000 0 0x2000>,
85 <0x0 0x2c004000 0 0x2000>, 85 <0x0 0x2c004000 0 0x2000>,
86 <0x0 0x2c006000 0 0x2000>; 86 <0x0 0x2c006000 0 0x2000>;
87 interrupts = <1 9 0xf04>; 87 interrupts = <1 9 0xf04>;
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi
index 9d1d7ad9b075..29ed6b61c737 100644
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -64,6 +64,16 @@
64 reg = <0x0 0x86000000 0x0 0x200000>; 64 reg = <0x0 0x86000000 0x0 0x200000>;
65 no-map; 65 no-map;
66 }; 66 };
67
68 memory@85800000 {
69 reg = <0x0 0x85800000 0x0 0x800000>;
70 no-map;
71 };
72
73 memory@86200000 {
74 reg = <0x0 0x86200000 0x0 0x2600000>;
75 no-map;
76 };
67 }; 77 };
68 78
69 cpus { 79 cpus {
diff --git a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
index 6ffb0517421a..dbea2c3d8f0c 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts
@@ -169,7 +169,7 @@
169 power-source = <3300>; 169 power-source = <3300>;
170 }; 170 };
171 171
172 sdhi0_pins_uhs: sd0 { 172 sdhi0_pins_uhs: sd0_uhs {
173 groups = "sdhi0_data4", "sdhi0_ctrl"; 173 groups = "sdhi0_data4", "sdhi0_ctrl";
174 function = "sdhi0"; 174 function = "sdhi0";
175 power-source = <1800>; 175 power-source = <1800>;
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 869dded0f09f..33b744d54739 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -331,6 +331,7 @@ CONFIG_DRM_VC4=m
331CONFIG_DRM_PANEL_SIMPLE=m 331CONFIG_DRM_PANEL_SIMPLE=m
332CONFIG_DRM_I2C_ADV7511=m 332CONFIG_DRM_I2C_ADV7511=m
333CONFIG_DRM_HISI_KIRIN=m 333CONFIG_DRM_HISI_KIRIN=m
334CONFIG_DRM_MESON=m
334CONFIG_FB=y 335CONFIG_FB=y
335CONFIG_FB_ARMCLCD=y 336CONFIG_FB_ARMCLCD=y
336CONFIG_BACKLIGHT_GENERIC=m 337CONFIG_BACKLIGHT_GENERIC=m
diff --git a/arch/arm64/include/asm/asm-uaccess.h b/arch/arm64/include/asm/asm-uaccess.h
new file mode 100644
index 000000000000..df411f3e083c
--- /dev/null
+++ b/arch/arm64/include/asm/asm-uaccess.h
@@ -0,0 +1,65 @@
1#ifndef __ASM_ASM_UACCESS_H
2#define __ASM_ASM_UACCESS_H
3
4#include <asm/alternative.h>
5#include <asm/kernel-pgtable.h>
6#include <asm/sysreg.h>
7#include <asm/assembler.h>
8
9/*
10 * User access enabling/disabling macros.
11 */
12#ifdef CONFIG_ARM64_SW_TTBR0_PAN
13 .macro __uaccess_ttbr0_disable, tmp1
14 mrs \tmp1, ttbr1_el1 // swapper_pg_dir
15 add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir
16 msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1
17 isb
18 .endm
19
20 .macro __uaccess_ttbr0_enable, tmp1
21 get_thread_info \tmp1
22 ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1
23 msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1
24 isb
25 .endm
26
27 .macro uaccess_ttbr0_disable, tmp1
28alternative_if_not ARM64_HAS_PAN
29 __uaccess_ttbr0_disable \tmp1
30alternative_else_nop_endif
31 .endm
32
33 .macro uaccess_ttbr0_enable, tmp1, tmp2
34alternative_if_not ARM64_HAS_PAN
35 save_and_disable_irq \tmp2 // avoid preemption
36 __uaccess_ttbr0_enable \tmp1
37 restore_irq \tmp2
38alternative_else_nop_endif
39 .endm
40#else
41 .macro uaccess_ttbr0_disable, tmp1
42 .endm
43
44 .macro uaccess_ttbr0_enable, tmp1, tmp2
45 .endm
46#endif
47
48/*
49 * These macros are no-ops when UAO is present.
50 */
51 .macro uaccess_disable_not_uao, tmp1
52 uaccess_ttbr0_disable \tmp1
53alternative_if ARM64_ALT_PAN_NOT_UAO
54 SET_PSTATE_PAN(1)
55alternative_else_nop_endif
56 .endm
57
58 .macro uaccess_enable_not_uao, tmp1, tmp2
59 uaccess_ttbr0_enable \tmp1, \tmp2
60alternative_if ARM64_ALT_PAN_NOT_UAO
61 SET_PSTATE_PAN(0)
62alternative_else_nop_endif
63 .endm
64
65#endif
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index d26750ca6e06..46da3ea638bb 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -22,8 +22,6 @@
22#include <asm/kernel-pgtable.h> 22#include <asm/kernel-pgtable.h>
23#include <asm/sysreg.h> 23#include <asm/sysreg.h>
24 24
25#ifndef __ASSEMBLY__
26
27/* 25/*
28 * User space memory access functions 26 * User space memory access functions
29 */ 27 */
@@ -424,66 +422,4 @@ extern long strncpy_from_user(char *dest, const char __user *src, long count);
424extern __must_check long strlen_user(const char __user *str); 422extern __must_check long strlen_user(const char __user *str);
425extern __must_check long strnlen_user(const char __user *str, long n); 423extern __must_check long strnlen_user(const char __user *str, long n);
426 424
427#else /* __ASSEMBLY__ */
428
429#include <asm/assembler.h>
430
431/*
432 * User access enabling/disabling macros.
433 */
434#ifdef CONFIG_ARM64_SW_TTBR0_PAN
435 .macro __uaccess_ttbr0_disable, tmp1
436 mrs \tmp1, ttbr1_el1 // swapper_pg_dir
437 add \tmp1, \tmp1, #SWAPPER_DIR_SIZE // reserved_ttbr0 at the end of swapper_pg_dir
438 msr ttbr0_el1, \tmp1 // set reserved TTBR0_EL1
439 isb
440 .endm
441
442 .macro __uaccess_ttbr0_enable, tmp1
443 get_thread_info \tmp1
444 ldr \tmp1, [\tmp1, #TSK_TI_TTBR0] // load saved TTBR0_EL1
445 msr ttbr0_el1, \tmp1 // set the non-PAN TTBR0_EL1
446 isb
447 .endm
448
449 .macro uaccess_ttbr0_disable, tmp1
450alternative_if_not ARM64_HAS_PAN
451 __uaccess_ttbr0_disable \tmp1
452alternative_else_nop_endif
453 .endm
454
455 .macro uaccess_ttbr0_enable, tmp1, tmp2
456alternative_if_not ARM64_HAS_PAN
457 save_and_disable_irq \tmp2 // avoid preemption
458 __uaccess_ttbr0_enable \tmp1
459 restore_irq \tmp2
460alternative_else_nop_endif
461 .endm
462#else
463 .macro uaccess_ttbr0_disable, tmp1
464 .endm
465
466 .macro uaccess_ttbr0_enable, tmp1, tmp2
467 .endm
468#endif
469
470/*
471 * These macros are no-ops when UAO is present.
472 */
473 .macro uaccess_disable_not_uao, tmp1
474 uaccess_ttbr0_disable \tmp1
475alternative_if ARM64_ALT_PAN_NOT_UAO
476 SET_PSTATE_PAN(1)
477alternative_else_nop_endif
478 .endm
479
480 .macro uaccess_enable_not_uao, tmp1, tmp2
481 uaccess_ttbr0_enable \tmp1, \tmp2
482alternative_if ARM64_ALT_PAN_NOT_UAO
483 SET_PSTATE_PAN(0)
484alternative_else_nop_endif
485 .endm
486
487#endif /* __ASSEMBLY__ */
488
489#endif /* __ASM_UACCESS_H */ 425#endif /* __ASM_UACCESS_H */
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index a7504f40d7ee..923841ffe4a9 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -31,7 +31,7 @@
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/thread_info.h> 33#include <asm/thread_info.h>
34#include <linux/uaccess.h> 34#include <asm/asm-uaccess.h>
35#include <asm/unistd.h> 35#include <asm/unistd.h>
36 36
37/* 37/*
diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S
index add4a1334085..e88fb99c1561 100644
--- a/arch/arm64/lib/clear_user.S
+++ b/arch/arm64/lib/clear_user.S
@@ -17,7 +17,7 @@
17 */ 17 */
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19 19
20#include <linux/uaccess.h> 20#include <asm/asm-uaccess.h>
21 21
22 .text 22 .text
23 23
diff --git a/arch/arm64/lib/copy_from_user.S b/arch/arm64/lib/copy_from_user.S
index fd6cd05593f9..4b5d826895ff 100644
--- a/arch/arm64/lib/copy_from_user.S
+++ b/arch/arm64/lib/copy_from_user.S
@@ -17,7 +17,7 @@
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18 18
19#include <asm/cache.h> 19#include <asm/cache.h>
20#include <linux/uaccess.h> 20#include <asm/asm-uaccess.h>
21 21
22/* 22/*
23 * Copy from user space to a kernel buffer (alignment handled by the hardware) 23 * Copy from user space to a kernel buffer (alignment handled by the hardware)
diff --git a/arch/arm64/lib/copy_in_user.S b/arch/arm64/lib/copy_in_user.S
index d828540ded6f..47184c3a97da 100644
--- a/arch/arm64/lib/copy_in_user.S
+++ b/arch/arm64/lib/copy_in_user.S
@@ -19,7 +19,7 @@
19#include <linux/linkage.h> 19#include <linux/linkage.h>
20 20
21#include <asm/cache.h> 21#include <asm/cache.h>
22#include <linux/uaccess.h> 22#include <asm/asm-uaccess.h>
23 23
24/* 24/*
25 * Copy from user space to user space (alignment handled by the hardware) 25 * Copy from user space to user space (alignment handled by the hardware)
diff --git a/arch/arm64/lib/copy_to_user.S b/arch/arm64/lib/copy_to_user.S
index 3e6ae2663b82..351f0766f7a6 100644
--- a/arch/arm64/lib/copy_to_user.S
+++ b/arch/arm64/lib/copy_to_user.S
@@ -17,7 +17,7 @@
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18 18
19#include <asm/cache.h> 19#include <asm/cache.h>
20#include <linux/uaccess.h> 20#include <asm/asm-uaccess.h>
21 21
22/* 22/*
23 * Copy to user space from a kernel buffer (alignment handled by the hardware) 23 * Copy to user space from a kernel buffer (alignment handled by the hardware)
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 17f422a4dc55..83c27b6e6dca 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -23,7 +23,7 @@
23#include <asm/assembler.h> 23#include <asm/assembler.h>
24#include <asm/cpufeature.h> 24#include <asm/cpufeature.h>
25#include <asm/alternative.h> 25#include <asm/alternative.h>
26#include <linux/uaccess.h> 26#include <asm/asm-uaccess.h>
27 27
28/* 28/*
29 * flush_icache_range(start,end) 29 * flush_icache_range(start,end)
diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S
index 47cf3f9d89ff..947830a459d2 100644
--- a/arch/arm64/xen/hypercall.S
+++ b/arch/arm64/xen/hypercall.S
@@ -49,7 +49,7 @@
49 49
50#include <linux/linkage.h> 50#include <linux/linkage.h>
51#include <asm/assembler.h> 51#include <asm/assembler.h>
52#include <linux/uaccess.h> 52#include <asm/asm-uaccess.h>
53#include <xen/interface/xen.h> 53#include <xen/interface/xen.h>
54 54
55 55
diff --git a/arch/openrisc/kernel/vmlinux.lds.S b/arch/openrisc/kernel/vmlinux.lds.S
index ef31fc24344e..552544616b9d 100644
--- a/arch/openrisc/kernel/vmlinux.lds.S
+++ b/arch/openrisc/kernel/vmlinux.lds.S
@@ -44,6 +44,8 @@ SECTIONS
44 /* Read-only sections, merged into text segment: */ 44 /* Read-only sections, merged into text segment: */
45 . = LOAD_BASE ; 45 . = LOAD_BASE ;
46 46
47 _text = .;
48
47 /* _s_kernel_ro must be page aligned */ 49 /* _s_kernel_ro must be page aligned */
48 . = ALIGN(PAGE_SIZE); 50 . = ALIGN(PAGE_SIZE);
49 _s_kernel_ro = .; 51 _s_kernel_ro = .;
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index 7581330ea35b..88fe0aad4390 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -49,7 +49,6 @@ struct thread_info {
49#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 49#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling TIF_NEED_RESCHED */
50#define TIF_32BIT 4 /* 32 bit binary */ 50#define TIF_32BIT 4 /* 32 bit binary */
51#define TIF_MEMDIE 5 /* is terminating due to OOM killer */ 51#define TIF_MEMDIE 5 /* is terminating due to OOM killer */
52#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */
53#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 52#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
54#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ 53#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
55#define TIF_SINGLESTEP 9 /* single stepping? */ 54#define TIF_SINGLESTEP 9 /* single stepping? */
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index da0d9cb63403..1e22f981cd81 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -235,9 +235,26 @@ void __init time_init(void)
235 235
236 cr16_hz = 100 * PAGE0->mem_10msec; /* Hz */ 236 cr16_hz = 100 * PAGE0->mem_10msec; /* Hz */
237 237
238 /* register at clocksource framework */
239 clocksource_register_hz(&clocksource_cr16, cr16_hz);
240
241 /* register as sched_clock source */ 238 /* register as sched_clock source */
242 sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_hz); 239 sched_clock_register(read_cr16_sched_clock, BITS_PER_LONG, cr16_hz);
243} 240}
241
242static int __init init_cr16_clocksource(void)
243{
244 /*
245 * The cr16 interval timers are not syncronized across CPUs, so mark
246 * them unstable and lower rating on SMP systems.
247 */
248 if (num_online_cpus() > 1) {
249 clocksource_cr16.flags = CLOCK_SOURCE_UNSTABLE;
250 clocksource_cr16.rating = 0;
251 }
252
253 /* register at clocksource framework */
254 clocksource_register_hz(&clocksource_cr16,
255 100 * PAGE0->mem_10msec);
256
257 return 0;
258}
259
260device_initcall(init_cr16_clocksource);
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 8ff9253930af..1a0b4f63f0e9 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -234,7 +234,7 @@ show_signal_msg(struct pt_regs *regs, unsigned long code,
234 tsk->comm, code, address); 234 tsk->comm, code, address);
235 print_vma_addr(KERN_CONT " in ", regs->iaoq[0]); 235 print_vma_addr(KERN_CONT " in ", regs->iaoq[0]);
236 236
237 pr_cont(" trap #%lu: %s%c", code, trap_name(code), 237 pr_cont("\ntrap #%lu: %s%c", code, trap_name(code),
238 vma ? ',':'\n'); 238 vma ? ',':'\n');
239 239
240 if (vma) 240 if (vma)
diff --git a/arch/s390/include/asm/asm-prototypes.h b/arch/s390/include/asm/asm-prototypes.h
new file mode 100644
index 000000000000..2c3413b0ca52
--- /dev/null
+++ b/arch/s390/include/asm/asm-prototypes.h
@@ -0,0 +1,8 @@
1#ifndef _ASM_S390_PROTOTYPES_H
2
3#include <linux/kvm_host.h>
4#include <linux/ftrace.h>
5#include <asm/fpu/api.h>
6#include <asm-generic/asm-prototypes.h>
7
8#endif /* _ASM_S390_PROTOTYPES_H */
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 6b246aadf311..1b5c5ee9fc1b 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -94,7 +94,7 @@ static void update_mt_scaling(void)
94 * Update process times based on virtual cpu times stored by entry.S 94 * Update process times based on virtual cpu times stored by entry.S
95 * to the lowcore fields user_timer, system_timer & steal_clock. 95 * to the lowcore fields user_timer, system_timer & steal_clock.
96 */ 96 */
97static int do_account_vtime(struct task_struct *tsk, int hardirq_offset) 97static int do_account_vtime(struct task_struct *tsk)
98{ 98{
99 u64 timer, clock, user, system, steal; 99 u64 timer, clock, user, system, steal;
100 u64 user_scaled, system_scaled; 100 u64 user_scaled, system_scaled;
@@ -138,7 +138,7 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
138 } 138 }
139 account_user_time(tsk, user); 139 account_user_time(tsk, user);
140 tsk->utimescaled += user_scaled; 140 tsk->utimescaled += user_scaled;
141 account_system_time(tsk, hardirq_offset, system); 141 account_system_time(tsk, 0, system);
142 tsk->stimescaled += system_scaled; 142 tsk->stimescaled += system_scaled;
143 143
144 steal = S390_lowcore.steal_timer; 144 steal = S390_lowcore.steal_timer;
@@ -152,7 +152,7 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
152 152
153void vtime_task_switch(struct task_struct *prev) 153void vtime_task_switch(struct task_struct *prev)
154{ 154{
155 do_account_vtime(prev, 0); 155 do_account_vtime(prev);
156 prev->thread.user_timer = S390_lowcore.user_timer; 156 prev->thread.user_timer = S390_lowcore.user_timer;
157 prev->thread.system_timer = S390_lowcore.system_timer; 157 prev->thread.system_timer = S390_lowcore.system_timer;
158 S390_lowcore.user_timer = current->thread.user_timer; 158 S390_lowcore.user_timer = current->thread.user_timer;
@@ -166,7 +166,7 @@ void vtime_task_switch(struct task_struct *prev)
166 */ 166 */
167void vtime_account_user(struct task_struct *tsk) 167void vtime_account_user(struct task_struct *tsk)
168{ 168{
169 if (do_account_vtime(tsk, HARDIRQ_OFFSET)) 169 if (do_account_vtime(tsk))
170 virt_timer_expire(); 170 virt_timer_expire();
171} 171}
172 172
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index 68557f52b961..854022772c5b 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -139,6 +139,19 @@ static __always_inline void __clear_bit(long nr, volatile unsigned long *addr)
139 asm volatile("btr %1,%0" : ADDR : "Ir" (nr)); 139 asm volatile("btr %1,%0" : ADDR : "Ir" (nr));
140} 140}
141 141
142static __always_inline bool clear_bit_unlock_is_negative_byte(long nr, volatile unsigned long *addr)
143{
144 bool negative;
145 asm volatile(LOCK_PREFIX "andb %2,%1\n\t"
146 CC_SET(s)
147 : CC_OUT(s) (negative), ADDR
148 : "ir" ((char) ~(1 << nr)) : "memory");
149 return negative;
150}
151
152// Let everybody know we have it
153#define clear_bit_unlock_is_negative_byte clear_bit_unlock_is_negative_byte
154
142/* 155/*
143 * __clear_bit_unlock - Clears a bit in memory 156 * __clear_bit_unlock - Clears a bit in memory
144 * @nr: Bit to clear 157 * @nr: Bit to clear
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index ffacfdcacb85..a5fd137417a2 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -1182,6 +1182,9 @@ static int threshold_create_bank(unsigned int cpu, unsigned int bank)
1182 const char *name = get_name(bank, NULL); 1182 const char *name = get_name(bank, NULL);
1183 int err = 0; 1183 int err = 0;
1184 1184
1185 if (!dev)
1186 return -ENODEV;
1187
1185 if (is_shared_bank(bank)) { 1188 if (is_shared_bank(bank)) {
1186 nb = node_to_amd_nb(amd_get_nb_id(cpu)); 1189 nb = node_to_amd_nb(amd_get_nb_id(cpu));
1187 1190
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 8c394e30e5fe..f3f7b41116f7 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -713,10 +713,9 @@ static void __init xen_reserve_xen_mfnlist(void)
713 size = PFN_PHYS(xen_start_info->nr_p2m_frames); 713 size = PFN_PHYS(xen_start_info->nr_p2m_frames);
714 } 714 }
715 715
716 if (!xen_is_e820_reserved(start, size)) { 716 memblock_reserve(start, size);
717 memblock_reserve(start, size); 717 if (!xen_is_e820_reserved(start, size))
718 return; 718 return;
719 }
720 719
721#ifdef CONFIG_X86_32 720#ifdef CONFIG_X86_32
722 /* 721 /*
@@ -727,6 +726,7 @@ static void __init xen_reserve_xen_mfnlist(void)
727 BUG(); 726 BUG();
728#else 727#else
729 xen_relocate_p2m(); 728 xen_relocate_p2m();
729 memblock_free(start, size);
730#endif 730#endif
731} 731}
732 732
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 6e82769f4042..f0a9c07b4c7a 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -544,6 +544,8 @@ static inline bool may_queue(struct rq_wb *rwb, struct rq_wait *rqw,
544 * the timer to kick off queuing again. 544 * the timer to kick off queuing again.
545 */ 545 */
546static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock) 546static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock)
547 __releases(lock)
548 __acquires(lock)
547{ 549{
548 struct rq_wait *rqw = get_rq_wait(rwb, current_is_kswapd()); 550 struct rq_wait *rqw = get_rq_wait(rwb, current_is_kswapd());
549 DEFINE_WAIT(wait); 551 DEFINE_WAIT(wait);
@@ -558,13 +560,12 @@ static void __wbt_wait(struct rq_wb *rwb, unsigned long rw, spinlock_t *lock)
558 if (may_queue(rwb, rqw, &wait, rw)) 560 if (may_queue(rwb, rqw, &wait, rw))
559 break; 561 break;
560 562
561 if (lock) 563 if (lock) {
562 spin_unlock_irq(lock); 564 spin_unlock_irq(lock);
563 565 io_schedule();
564 io_schedule();
565
566 if (lock)
567 spin_lock_irq(lock); 566 spin_lock_irq(lock);
567 } else
568 io_schedule();
568 } while (1); 569 } while (1);
569 570
570 finish_wait(&rqw->wait, &wait); 571 finish_wait(&rqw->wait, &wait);
@@ -595,7 +596,7 @@ static inline bool wbt_should_throttle(struct rq_wb *rwb, struct bio *bio)
595 * in an irq held spinlock, if it holds one when calling this function. 596 * in an irq held spinlock, if it holds one when calling this function.
596 * If we do sleep, we'll release and re-grab it. 597 * If we do sleep, we'll release and re-grab it.
597 */ 598 */
598unsigned int wbt_wait(struct rq_wb *rwb, struct bio *bio, spinlock_t *lock) 599enum wbt_flags wbt_wait(struct rq_wb *rwb, struct bio *bio, spinlock_t *lock)
599{ 600{
600 unsigned int ret = 0; 601 unsigned int ret = 0;
601 602
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index f616ad74cce7..44e888b0b041 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1461,16 +1461,25 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1461 for (i = 0; i < ctcount; i++) { 1461 for (i = 0; i < ctcount; i++) {
1462 unsigned int dlen = COMP_BUF_SIZE; 1462 unsigned int dlen = COMP_BUF_SIZE;
1463 int ilen = ctemplate[i].inlen; 1463 int ilen = ctemplate[i].inlen;
1464 void *input_vec;
1464 1465
1466 input_vec = kmalloc(ilen, GFP_KERNEL);
1467 if (!input_vec) {
1468 ret = -ENOMEM;
1469 goto out;
1470 }
1471
1472 memcpy(input_vec, ctemplate[i].input, ilen);
1465 memset(output, 0, dlen); 1473 memset(output, 0, dlen);
1466 init_completion(&result.completion); 1474 init_completion(&result.completion);
1467 sg_init_one(&src, ctemplate[i].input, ilen); 1475 sg_init_one(&src, input_vec, ilen);
1468 sg_init_one(&dst, output, dlen); 1476 sg_init_one(&dst, output, dlen);
1469 1477
1470 req = acomp_request_alloc(tfm); 1478 req = acomp_request_alloc(tfm);
1471 if (!req) { 1479 if (!req) {
1472 pr_err("alg: acomp: request alloc failed for %s\n", 1480 pr_err("alg: acomp: request alloc failed for %s\n",
1473 algo); 1481 algo);
1482 kfree(input_vec);
1474 ret = -ENOMEM; 1483 ret = -ENOMEM;
1475 goto out; 1484 goto out;
1476 } 1485 }
@@ -1483,6 +1492,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1483 if (ret) { 1492 if (ret) {
1484 pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n", 1493 pr_err("alg: acomp: compression failed on test %d for %s: ret=%d\n",
1485 i + 1, algo, -ret); 1494 i + 1, algo, -ret);
1495 kfree(input_vec);
1486 acomp_request_free(req); 1496 acomp_request_free(req);
1487 goto out; 1497 goto out;
1488 } 1498 }
@@ -1491,6 +1501,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1491 pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n", 1501 pr_err("alg: acomp: Compression test %d failed for %s: output len = %d\n",
1492 i + 1, algo, req->dlen); 1502 i + 1, algo, req->dlen);
1493 ret = -EINVAL; 1503 ret = -EINVAL;
1504 kfree(input_vec);
1494 acomp_request_free(req); 1505 acomp_request_free(req);
1495 goto out; 1506 goto out;
1496 } 1507 }
@@ -1500,26 +1511,37 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1500 i + 1, algo); 1511 i + 1, algo);
1501 hexdump(output, req->dlen); 1512 hexdump(output, req->dlen);
1502 ret = -EINVAL; 1513 ret = -EINVAL;
1514 kfree(input_vec);
1503 acomp_request_free(req); 1515 acomp_request_free(req);
1504 goto out; 1516 goto out;
1505 } 1517 }
1506 1518
1519 kfree(input_vec);
1507 acomp_request_free(req); 1520 acomp_request_free(req);
1508 } 1521 }
1509 1522
1510 for (i = 0; i < dtcount; i++) { 1523 for (i = 0; i < dtcount; i++) {
1511 unsigned int dlen = COMP_BUF_SIZE; 1524 unsigned int dlen = COMP_BUF_SIZE;
1512 int ilen = dtemplate[i].inlen; 1525 int ilen = dtemplate[i].inlen;
1526 void *input_vec;
1527
1528 input_vec = kmalloc(ilen, GFP_KERNEL);
1529 if (!input_vec) {
1530 ret = -ENOMEM;
1531 goto out;
1532 }
1513 1533
1534 memcpy(input_vec, dtemplate[i].input, ilen);
1514 memset(output, 0, dlen); 1535 memset(output, 0, dlen);
1515 init_completion(&result.completion); 1536 init_completion(&result.completion);
1516 sg_init_one(&src, dtemplate[i].input, ilen); 1537 sg_init_one(&src, input_vec, ilen);
1517 sg_init_one(&dst, output, dlen); 1538 sg_init_one(&dst, output, dlen);
1518 1539
1519 req = acomp_request_alloc(tfm); 1540 req = acomp_request_alloc(tfm);
1520 if (!req) { 1541 if (!req) {
1521 pr_err("alg: acomp: request alloc failed for %s\n", 1542 pr_err("alg: acomp: request alloc failed for %s\n",
1522 algo); 1543 algo);
1544 kfree(input_vec);
1523 ret = -ENOMEM; 1545 ret = -ENOMEM;
1524 goto out; 1546 goto out;
1525 } 1547 }
@@ -1532,6 +1554,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1532 if (ret) { 1554 if (ret) {
1533 pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n", 1555 pr_err("alg: acomp: decompression failed on test %d for %s: ret=%d\n",
1534 i + 1, algo, -ret); 1556 i + 1, algo, -ret);
1557 kfree(input_vec);
1535 acomp_request_free(req); 1558 acomp_request_free(req);
1536 goto out; 1559 goto out;
1537 } 1560 }
@@ -1540,6 +1563,7 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1540 pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n", 1563 pr_err("alg: acomp: Decompression test %d failed for %s: output len = %d\n",
1541 i + 1, algo, req->dlen); 1564 i + 1, algo, req->dlen);
1542 ret = -EINVAL; 1565 ret = -EINVAL;
1566 kfree(input_vec);
1543 acomp_request_free(req); 1567 acomp_request_free(req);
1544 goto out; 1568 goto out;
1545 } 1569 }
@@ -1549,10 +1573,12 @@ static int test_acomp(struct crypto_acomp *tfm, struct comp_testvec *ctemplate,
1549 i + 1, algo); 1573 i + 1, algo);
1550 hexdump(output, req->dlen); 1574 hexdump(output, req->dlen);
1551 ret = -EINVAL; 1575 ret = -EINVAL;
1576 kfree(input_vec);
1552 acomp_request_free(req); 1577 acomp_request_free(req);
1553 goto out; 1578 goto out;
1554 } 1579 }
1555 1580
1581 kfree(input_vec);
1556 acomp_request_free(req); 1582 acomp_request_free(req);
1557 } 1583 }
1558 1584
diff --git a/drivers/crypto/marvell/cesa.h b/drivers/crypto/marvell/cesa.h
index a768da7138a1..b7872f62f674 100644
--- a/drivers/crypto/marvell/cesa.h
+++ b/drivers/crypto/marvell/cesa.h
@@ -273,7 +273,8 @@ struct mv_cesa_op_ctx {
273#define CESA_TDMA_SRC_IN_SRAM BIT(30) 273#define CESA_TDMA_SRC_IN_SRAM BIT(30)
274#define CESA_TDMA_END_OF_REQ BIT(29) 274#define CESA_TDMA_END_OF_REQ BIT(29)
275#define CESA_TDMA_BREAK_CHAIN BIT(28) 275#define CESA_TDMA_BREAK_CHAIN BIT(28)
276#define CESA_TDMA_TYPE_MSK GENMASK(27, 0) 276#define CESA_TDMA_SET_STATE BIT(27)
277#define CESA_TDMA_TYPE_MSK GENMASK(26, 0)
277#define CESA_TDMA_DUMMY 0 278#define CESA_TDMA_DUMMY 0
278#define CESA_TDMA_DATA 1 279#define CESA_TDMA_DATA 1
279#define CESA_TDMA_OP 2 280#define CESA_TDMA_OP 2
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
index 317cf029c0cf..77c0fb936f47 100644
--- a/drivers/crypto/marvell/hash.c
+++ b/drivers/crypto/marvell/hash.c
@@ -280,13 +280,32 @@ static void mv_cesa_ahash_std_prepare(struct ahash_request *req)
280 sreq->offset = 0; 280 sreq->offset = 0;
281} 281}
282 282
283static void mv_cesa_ahash_dma_step(struct ahash_request *req)
284{
285 struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
286 struct mv_cesa_req *base = &creq->base;
287
288 /* We must explicitly set the digest state. */
289 if (base->chain.first->flags & CESA_TDMA_SET_STATE) {
290 struct mv_cesa_engine *engine = base->engine;
291 int i;
292
293 /* Set the hash state in the IVDIG regs. */
294 for (i = 0; i < ARRAY_SIZE(creq->state); i++)
295 writel_relaxed(creq->state[i], engine->regs +
296 CESA_IVDIG(i));
297 }
298
299 mv_cesa_dma_step(base);
300}
301
283static void mv_cesa_ahash_step(struct crypto_async_request *req) 302static void mv_cesa_ahash_step(struct crypto_async_request *req)
284{ 303{
285 struct ahash_request *ahashreq = ahash_request_cast(req); 304 struct ahash_request *ahashreq = ahash_request_cast(req);
286 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq); 305 struct mv_cesa_ahash_req *creq = ahash_request_ctx(ahashreq);
287 306
288 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) 307 if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ)
289 mv_cesa_dma_step(&creq->base); 308 mv_cesa_ahash_dma_step(ahashreq);
290 else 309 else
291 mv_cesa_ahash_std_step(ahashreq); 310 mv_cesa_ahash_std_step(ahashreq);
292} 311}
@@ -584,12 +603,16 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req)
584 struct mv_cesa_ahash_dma_iter iter; 603 struct mv_cesa_ahash_dma_iter iter;
585 struct mv_cesa_op_ctx *op = NULL; 604 struct mv_cesa_op_ctx *op = NULL;
586 unsigned int frag_len; 605 unsigned int frag_len;
606 bool set_state = false;
587 int ret; 607 int ret;
588 u32 type; 608 u32 type;
589 609
590 basereq->chain.first = NULL; 610 basereq->chain.first = NULL;
591 basereq->chain.last = NULL; 611 basereq->chain.last = NULL;
592 612
613 if (!mv_cesa_mac_op_is_first_frag(&creq->op_tmpl))
614 set_state = true;
615
593 if (creq->src_nents) { 616 if (creq->src_nents) {
594 ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, 617 ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents,
595 DMA_TO_DEVICE); 618 DMA_TO_DEVICE);
@@ -683,6 +706,15 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req)
683 if (type != CESA_TDMA_RESULT) 706 if (type != CESA_TDMA_RESULT)
684 basereq->chain.last->flags |= CESA_TDMA_BREAK_CHAIN; 707 basereq->chain.last->flags |= CESA_TDMA_BREAK_CHAIN;
685 708
709 if (set_state) {
710 /*
711 * Put the CESA_TDMA_SET_STATE flag on the first tdma desc to
712 * let the step logic know that the IVDIG registers should be
713 * explicitly set before launching a TDMA chain.
714 */
715 basereq->chain.first->flags |= CESA_TDMA_SET_STATE;
716 }
717
686 return 0; 718 return 0;
687 719
688err_free_tdma: 720err_free_tdma:
diff --git a/drivers/crypto/marvell/tdma.c b/drivers/crypto/marvell/tdma.c
index 4416b88eca70..c76375ff376d 100644
--- a/drivers/crypto/marvell/tdma.c
+++ b/drivers/crypto/marvell/tdma.c
@@ -109,7 +109,14 @@ void mv_cesa_tdma_chain(struct mv_cesa_engine *engine,
109 last->next = dreq->chain.first; 109 last->next = dreq->chain.first;
110 engine->chain.last = dreq->chain.last; 110 engine->chain.last = dreq->chain.last;
111 111
112 if (!(last->flags & CESA_TDMA_BREAK_CHAIN)) 112 /*
113 * Break the DMA chain if the CESA_TDMA_BREAK_CHAIN is set on
114 * the last element of the current chain, or if the request
115 * being queued needs the IV regs to be set before lauching
116 * the request.
117 */
118 if (!(last->flags & CESA_TDMA_BREAK_CHAIN) &&
119 !(dreq->chain.first->flags & CESA_TDMA_SET_STATE))
113 last->next_dma = dreq->chain.first->cur_dma; 120 last->next_dma = dreq->chain.first->cur_dma;
114 } 121 }
115} 122}
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index 70e13230d8db..9ad0b1934be9 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -721,11 +721,17 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val)
721 721
722 ret = scpi_send_message(CMD_SENSOR_VALUE, &id, sizeof(id), 722 ret = scpi_send_message(CMD_SENSOR_VALUE, &id, sizeof(id),
723 &buf, sizeof(buf)); 723 &buf, sizeof(buf));
724 if (!ret) 724 if (ret)
725 return ret;
726
727 if (scpi_info->is_legacy)
728 /* only 32-bits supported, hi_val can be junk */
729 *val = le32_to_cpu(buf.lo_val);
730 else
725 *val = (u64)le32_to_cpu(buf.hi_val) << 32 | 731 *val = (u64)le32_to_cpu(buf.hi_val) << 32 |
726 le32_to_cpu(buf.lo_val); 732 le32_to_cpu(buf.lo_val);
727 733
728 return ret; 734 return 0;
729} 735}
730 736
731static int scpi_device_get_power_state(u16 dev_id) 737static int scpi_device_get_power_state(u16 dev_id)
diff --git a/drivers/firmware/psci_checker.c b/drivers/firmware/psci_checker.c
index 44bdb78f837b..29d58feaf675 100644
--- a/drivers/firmware/psci_checker.c
+++ b/drivers/firmware/psci_checker.c
@@ -270,8 +270,7 @@ static int suspend_test_thread(void *arg)
270 struct cpuidle_device *dev; 270 struct cpuidle_device *dev;
271 struct cpuidle_driver *drv; 271 struct cpuidle_driver *drv;
272 /* No need for an actual callback, we just want to wake up the CPU. */ 272 /* No need for an actual callback, we just want to wake up the CPU. */
273 struct timer_list wakeup_timer = 273 struct timer_list wakeup_timer;
274 TIMER_INITIALIZER(dummy_callback, 0, 0);
275 274
276 /* Wait for the main thread to give the start signal. */ 275 /* Wait for the main thread to give the start signal. */
277 wait_for_completion(&suspend_threads_started); 276 wait_for_completion(&suspend_threads_started);
@@ -287,6 +286,7 @@ static int suspend_test_thread(void *arg)
287 pr_info("CPU %d entering suspend cycles, states 1 through %d\n", 286 pr_info("CPU %d entering suspend cycles, states 1 through %d\n",
288 cpu, drv->state_count - 1); 287 cpu, drv->state_count - 1);
289 288
289 setup_timer_on_stack(&wakeup_timer, dummy_callback, 0);
290 for (i = 0; i < NUM_SUSPEND_CYCLE; ++i) { 290 for (i = 0; i < NUM_SUSPEND_CYCLE; ++i) {
291 int index; 291 int index;
292 /* 292 /*
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index d40ed9fdf68d..70b12f89a193 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -64,7 +64,8 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
64#define QUIRK_SKIP_INPUT_MAPPING BIT(2) 64#define QUIRK_SKIP_INPUT_MAPPING BIT(2)
65#define QUIRK_IS_MULTITOUCH BIT(3) 65#define QUIRK_IS_MULTITOUCH BIT(3)
66 66
67#define NOTEBOOK_QUIRKS QUIRK_FIX_NOTEBOOK_REPORT 67#define KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
68 QUIRK_NO_INIT_REPORTS)
68#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \ 69#define TOUCHPAD_QUIRKS (QUIRK_NO_INIT_REPORTS | \
69 QUIRK_SKIP_INPUT_MAPPING | \ 70 QUIRK_SKIP_INPUT_MAPPING | \
70 QUIRK_IS_MULTITOUCH) 71 QUIRK_IS_MULTITOUCH)
@@ -170,11 +171,11 @@ static int asus_raw_event(struct hid_device *hdev,
170 171
171static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi) 172static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
172{ 173{
174 struct input_dev *input = hi->input;
173 struct asus_drvdata *drvdata = hid_get_drvdata(hdev); 175 struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
174 176
175 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { 177 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
176 int ret; 178 int ret;
177 struct input_dev *input = hi->input;
178 179
179 input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0); 180 input_set_abs_params(input, ABS_MT_POSITION_X, 0, MAX_X, 0, 0);
180 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0); 181 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, MAX_Y, 0, 0);
@@ -191,10 +192,10 @@ static int asus_input_configured(struct hid_device *hdev, struct hid_input *hi)
191 hid_err(hdev, "Asus input mt init slots failed: %d\n", ret); 192 hid_err(hdev, "Asus input mt init slots failed: %d\n", ret);
192 return ret; 193 return ret;
193 } 194 }
194
195 drvdata->input = input;
196 } 195 }
197 196
197 drvdata->input = input;
198
198 return 0; 199 return 0;
199} 200}
200 201
@@ -286,7 +287,11 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
286 goto err_stop_hw; 287 goto err_stop_hw;
287 } 288 }
288 289
289 drvdata->input->name = "Asus TouchPad"; 290 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
291 drvdata->input->name = "Asus TouchPad";
292 } else {
293 drvdata->input->name = "Asus Keyboard";
294 }
290 295
291 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) { 296 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) {
292 ret = asus_start_multitouch(hdev); 297 ret = asus_start_multitouch(hdev);
@@ -315,7 +320,7 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
315 320
316static const struct hid_device_id asus_devices[] = { 321static const struct hid_device_id asus_devices[] = {
317 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, 322 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
318 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), NOTEBOOK_QUIRKS}, 323 USB_DEVICE_ID_ASUSTEK_NOTEBOOK_KEYBOARD), KEYBOARD_QUIRKS},
319 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK, 324 { HID_I2C_DEVICE(USB_VENDOR_ID_ASUSTEK,
320 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS }, 325 USB_DEVICE_ID_ASUSTEK_TOUCHPAD), TOUCHPAD_QUIRKS },
321 { } 326 { }
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index ec277b96eaa1..54bd22dc1411 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -319,6 +319,7 @@
319#define USB_VENDOR_ID_DRAGONRISE 0x0079 319#define USB_VENDOR_ID_DRAGONRISE 0x0079
320#define USB_DEVICE_ID_DRAGONRISE_WIIU 0x1800 320#define USB_DEVICE_ID_DRAGONRISE_WIIU 0x1800
321#define USB_DEVICE_ID_DRAGONRISE_PS3 0x1801 321#define USB_DEVICE_ID_DRAGONRISE_PS3 0x1801
322#define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR 0x1803
322#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE 0x1843 323#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE 0x1843
323 324
324#define USB_VENDOR_ID_DWAV 0x0eef 325#define USB_VENDOR_ID_DWAV 0x0eef
@@ -365,6 +366,9 @@
365#define USB_VENDOR_ID_FLATFROG 0x25b5 366#define USB_VENDOR_ID_FLATFROG 0x25b5
366#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002 367#define USB_DEVICE_ID_MULTITOUCH_3200 0x0002
367 368
369#define USB_VENDOR_ID_FUTABA 0x0547
370#define USB_DEVICE_ID_LED_DISPLAY 0x7000
371
368#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 372#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
369#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 373#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
370 374
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 5c925228847c..4ef73374a8f9 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -212,7 +212,6 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
212 __s32 value; 212 __s32 value;
213 int ret = 0; 213 int ret = 0;
214 214
215 memset(buffer, 0, buffer_size);
216 mutex_lock(&data->mutex); 215 mutex_lock(&data->mutex);
217 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); 216 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
218 if (!report || (field_index >= report->maxfield)) { 217 if (!report || (field_index >= report->maxfield)) {
@@ -256,6 +255,8 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
256 int buffer_index = 0; 255 int buffer_index = 0;
257 int i; 256 int i;
258 257
258 memset(buffer, 0, buffer_size);
259
259 mutex_lock(&data->mutex); 260 mutex_lock(&data->mutex);
260 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); 261 report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT);
261 if (!report || (field_index >= report->maxfield) || 262 if (!report || (field_index >= report->maxfield) ||
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 7687c0875395..f405b07d0381 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1099,8 +1099,11 @@ struct sony_sc {
1099 u8 led_delay_on[MAX_LEDS]; 1099 u8 led_delay_on[MAX_LEDS];
1100 u8 led_delay_off[MAX_LEDS]; 1100 u8 led_delay_off[MAX_LEDS];
1101 u8 led_count; 1101 u8 led_count;
1102 bool ds4_dongle_connected;
1102}; 1103};
1103 1104
1105static void sony_set_leds(struct sony_sc *sc);
1106
1104static inline void sony_schedule_work(struct sony_sc *sc) 1107static inline void sony_schedule_work(struct sony_sc *sc)
1105{ 1108{
1106 if (!sc->defer_initialization) 1109 if (!sc->defer_initialization)
@@ -1430,6 +1433,31 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
1430 return -EILSEQ; 1433 return -EILSEQ;
1431 } 1434 }
1432 } 1435 }
1436
1437 /*
1438 * In the case of a DS4 USB dongle, bit[2] of byte 31 indicates
1439 * if a DS4 is actually connected (indicated by '0').
1440 * For non-dongle, this bit is always 0 (connected).
1441 */
1442 if (sc->hdev->vendor == USB_VENDOR_ID_SONY &&
1443 sc->hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE) {
1444 bool connected = (rd[31] & 0x04) ? false : true;
1445
1446 if (!sc->ds4_dongle_connected && connected) {
1447 hid_info(sc->hdev, "DualShock 4 USB dongle: controller connected\n");
1448 sony_set_leds(sc);
1449 sc->ds4_dongle_connected = true;
1450 } else if (sc->ds4_dongle_connected && !connected) {
1451 hid_info(sc->hdev, "DualShock 4 USB dongle: controller disconnected\n");
1452 sc->ds4_dongle_connected = false;
1453 /* Return 0, so hidraw can get the report. */
1454 return 0;
1455 } else if (!sc->ds4_dongle_connected) {
1456 /* Return 0, so hidraw can get the report. */
1457 return 0;
1458 }
1459 }
1460
1433 dualshock4_parse_report(sc, rd, size); 1461 dualshock4_parse_report(sc, rd, size);
1434 } 1462 }
1435 1463
@@ -2390,6 +2418,12 @@ static int sony_check_add(struct sony_sc *sc)
2390 } 2418 }
2391 2419
2392 memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); 2420 memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
2421
2422 snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
2423 "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
2424 sc->mac_address[5], sc->mac_address[4],
2425 sc->mac_address[3], sc->mac_address[2],
2426 sc->mac_address[1], sc->mac_address[0]);
2393 } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) || 2427 } else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) ||
2394 (sc->quirks & NAVIGATION_CONTROLLER_USB)) { 2428 (sc->quirks & NAVIGATION_CONTROLLER_USB)) {
2395 buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL); 2429 buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
@@ -2548,7 +2582,7 @@ static int sony_input_configured(struct hid_device *hdev,
2548 hid_err(sc->hdev, 2582 hid_err(sc->hdev,
2549 "Unable to initialize multi-touch slots: %d\n", 2583 "Unable to initialize multi-touch slots: %d\n",
2550 ret); 2584 ret);
2551 return ret; 2585 goto err_stop;
2552 } 2586 }
2553 2587
2554 sony_init_output_report(sc, dualshock4_send_output_report); 2588 sony_init_output_report(sc, dualshock4_send_output_report);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index b3e01c82af05..e9d6cc7cdfc5 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -83,11 +83,13 @@ static const struct hid_blacklist {
83 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, 83 { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
84 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, 84 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT },
85 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT }, 85 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3, HID_QUIRK_MULTI_INPUT },
86 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR, HID_QUIRK_MULTI_INPUT },
86 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT }, 87 { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE, HID_QUIRK_MULTI_INPUT },
87 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, 88 { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL },
88 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 89 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
89 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, 90 { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
90 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, 91 { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
92 { USB_VENDOR_ID_FUTABA, USB_DEVICE_ID_LED_DISPLAY, HID_QUIRK_NO_INIT_REPORTS },
91 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL }, 93 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL },
92 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL }, 94 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },
93 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, 95 { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index c8413fc120e6..7031a8dd4d14 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1682,9 +1682,19 @@ static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_att
1682 size += ret; 1682 size += ret;
1683 } 1683 }
1684 1684
1685 if (mlx4_is_master(mdev->dev) && flow_type == MLX4_FS_REGULAR &&
1686 flow_attr->num_of_specs == 1) {
1687 struct _rule_hw *rule_header = (struct _rule_hw *)(ctrl + 1);
1688 enum ib_flow_spec_type header_spec =
1689 ((union ib_flow_spec *)(flow_attr + 1))->type;
1690
1691 if (header_spec == IB_FLOW_SPEC_ETH)
1692 mlx4_handle_eth_header_mcast_prio(ctrl, rule_header);
1693 }
1694
1685 ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0, 1695 ret = mlx4_cmd_imm(mdev->dev, mailbox->dma, reg_id, size >> 2, 0,
1686 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, 1696 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
1687 MLX4_CMD_WRAPPED); 1697 MLX4_CMD_NATIVE);
1688 if (ret == -ENOMEM) 1698 if (ret == -ENOMEM)
1689 pr_err("mcg table is full. Fail to register network rule.\n"); 1699 pr_err("mcg table is full. Fail to register network rule.\n");
1690 else if (ret == -ENXIO) 1700 else if (ret == -ENXIO)
@@ -1701,7 +1711,7 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id)
1701 int err; 1711 int err;
1702 err = mlx4_cmd(dev, reg_id, 0, 0, 1712 err = mlx4_cmd(dev, reg_id, 0, 0,
1703 MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A, 1713 MLX4_QP_FLOW_STEERING_DETACH, MLX4_CMD_TIME_CLASS_A,
1704 MLX4_CMD_WRAPPED); 1714 MLX4_CMD_NATIVE);
1705 if (err) 1715 if (err)
1706 pr_err("Fail to detach network rule. registration id = 0x%llx\n", 1716 pr_err("Fail to detach network rule. registration id = 0x%llx\n",
1707 reg_id); 1717 reg_id);
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 25d1eb4933d0..7e8cf213fd81 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1012,15 +1012,6 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
1012 goto out; 1012 goto out;
1013 } 1013 }
1014 1014
1015 /* Insert TSB and checksum infos */
1016 if (priv->tsb_en) {
1017 skb = bcm_sysport_insert_tsb(skb, dev);
1018 if (!skb) {
1019 ret = NETDEV_TX_OK;
1020 goto out;
1021 }
1022 }
1023
1024 /* The Ethernet switch we are interfaced with needs packets to be at 1015 /* The Ethernet switch we are interfaced with needs packets to be at
1025 * least 64 bytes (including FCS) otherwise they will be discarded when 1016 * least 64 bytes (including FCS) otherwise they will be discarded when
1026 * they enter the switch port logic. When Broadcom tags are enabled, we 1017 * they enter the switch port logic. When Broadcom tags are enabled, we
@@ -1028,13 +1019,21 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
1028 * (including FCS and tag) because the length verification is done after 1019 * (including FCS and tag) because the length verification is done after
1029 * the Broadcom tag is stripped off the ingress packet. 1020 * the Broadcom tag is stripped off the ingress packet.
1030 */ 1021 */
1031 if (skb_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) { 1022 if (skb_put_padto(skb, ETH_ZLEN + ENET_BRCM_TAG_LEN)) {
1032 ret = NETDEV_TX_OK; 1023 ret = NETDEV_TX_OK;
1033 goto out; 1024 goto out;
1034 } 1025 }
1035 1026
1036 skb_len = skb->len < ETH_ZLEN + ENET_BRCM_TAG_LEN ? 1027 /* Insert TSB and checksum infos */
1037 ETH_ZLEN + ENET_BRCM_TAG_LEN : skb->len; 1028 if (priv->tsb_en) {
1029 skb = bcm_sysport_insert_tsb(skb, dev);
1030 if (!skb) {
1031 ret = NETDEV_TX_OK;
1032 goto out;
1033 }
1034 }
1035
1036 skb_len = skb->len;
1038 1037
1039 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE); 1038 mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
1040 if (dma_mapping_error(kdev, mapping)) { 1039 if (dma_mapping_error(kdev, mapping)) {
diff --git a/drivers/net/ethernet/cadence/macb_pci.c b/drivers/net/ethernet/cadence/macb_pci.c
index 92be2cd8f817..9906fda76087 100644
--- a/drivers/net/ethernet/cadence/macb_pci.c
+++ b/drivers/net/ethernet/cadence/macb_pci.c
@@ -1,5 +1,5 @@
1/** 1/**
2 * macb_pci.c - Cadence GEM PCI wrapper. 2 * Cadence GEM PCI wrapper.
3 * 3 *
4 * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com 4 * Copyright (C) 2016 Cadence Design Systems - http://www.cadence.com
5 * 5 *
@@ -45,32 +45,27 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
45 struct macb_platform_data plat_data; 45 struct macb_platform_data plat_data;
46 struct resource res[2]; 46 struct resource res[2];
47 47
48 /* sanity check */
49 if (!id)
50 return -EINVAL;
51
52 /* enable pci device */ 48 /* enable pci device */
53 err = pci_enable_device(pdev); 49 err = pcim_enable_device(pdev);
54 if (err < 0) { 50 if (err < 0) {
55 dev_err(&pdev->dev, "Enabling PCI device has failed: 0x%04X", 51 dev_err(&pdev->dev, "Enabling PCI device has failed: %d", err);
56 err); 52 return err;
57 return -EACCES;
58 } 53 }
59 54
60 pci_set_master(pdev); 55 pci_set_master(pdev);
61 56
62 /* set up resources */ 57 /* set up resources */
63 memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res)); 58 memset(res, 0x00, sizeof(struct resource) * ARRAY_SIZE(res));
64 res[0].start = pdev->resource[0].start; 59 res[0].start = pci_resource_start(pdev, 0);
65 res[0].end = pdev->resource[0].end; 60 res[0].end = pci_resource_end(pdev, 0);
66 res[0].name = PCI_DRIVER_NAME; 61 res[0].name = PCI_DRIVER_NAME;
67 res[0].flags = IORESOURCE_MEM; 62 res[0].flags = IORESOURCE_MEM;
68 res[1].start = pdev->irq; 63 res[1].start = pci_irq_vector(pdev, 0);
69 res[1].name = PCI_DRIVER_NAME; 64 res[1].name = PCI_DRIVER_NAME;
70 res[1].flags = IORESOURCE_IRQ; 65 res[1].flags = IORESOURCE_IRQ;
71 66
72 dev_info(&pdev->dev, "EMAC physical base addr = 0x%p\n", 67 dev_info(&pdev->dev, "EMAC physical base addr: %pa\n",
73 (void *)(uintptr_t)pci_resource_start(pdev, 0)); 68 &res[0].start);
74 69
75 /* set up macb platform data */ 70 /* set up macb platform data */
76 memset(&plat_data, 0, sizeof(plat_data)); 71 memset(&plat_data, 0, sizeof(plat_data));
@@ -100,7 +95,7 @@ static int macb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
100 plat_info.num_res = ARRAY_SIZE(res); 95 plat_info.num_res = ARRAY_SIZE(res);
101 plat_info.data = &plat_data; 96 plat_info.data = &plat_data;
102 plat_info.size_data = sizeof(plat_data); 97 plat_info.size_data = sizeof(plat_data);
103 plat_info.dma_mask = DMA_BIT_MASK(32); 98 plat_info.dma_mask = pdev->dma_mask;
104 99
105 /* register platform device */ 100 /* register platform device */
106 plat_dev = platform_device_register_full(&plat_info); 101 plat_dev = platform_device_register_full(&plat_info);
@@ -120,7 +115,6 @@ err_hclk_register:
120 clk_unregister(plat_data.pclk); 115 clk_unregister(plat_data.pclk);
121 116
122err_pclk_register: 117err_pclk_register:
123 pci_disable_device(pdev);
124 return err; 118 return err;
125} 119}
126 120
@@ -130,7 +124,6 @@ static void macb_remove(struct pci_dev *pdev)
130 struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); 124 struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev);
131 125
132 platform_device_unregister(plat_dev); 126 platform_device_unregister(plat_dev);
133 pci_disable_device(pdev);
134 clk_unregister(plat_data->pclk); 127 clk_unregister(plat_data->pclk);
135 clk_unregister(plat_data->hclk); 128 clk_unregister(plat_data->hclk);
136} 129}
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig
index bbc8bd16cb97..dcbce6cac63e 100644
--- a/drivers/net/ethernet/cavium/Kconfig
+++ b/drivers/net/ethernet/cavium/Kconfig
@@ -77,7 +77,7 @@ config OCTEON_MGMT_ETHERNET
77config LIQUIDIO_VF 77config LIQUIDIO_VF
78 tristate "Cavium LiquidIO VF support" 78 tristate "Cavium LiquidIO VF support"
79 depends on 64BIT && PCI_MSI 79 depends on 64BIT && PCI_MSI
80 select PTP_1588_CLOCK 80 imply PTP_1588_CLOCK
81 ---help--- 81 ---help---
82 This driver supports Cavium LiquidIO Intelligent Server Adapter 82 This driver supports Cavium LiquidIO Intelligent Server Adapter
83 based on CN23XX chips. 83 based on CN23XX chips.
diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
index 0f0de5b63622..d04a6c163445 100644
--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
+++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_cm.c
@@ -133,17 +133,15 @@ cxgb_find_route6(struct cxgb4_lld_info *lldi,
133 if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL) 133 if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
134 fl6.flowi6_oif = sin6_scope_id; 134 fl6.flowi6_oif = sin6_scope_id;
135 dst = ip6_route_output(&init_net, NULL, &fl6); 135 dst = ip6_route_output(&init_net, NULL, &fl6);
136 if (!dst) 136 if (dst->error ||
137 goto out; 137 (!cxgb_our_interface(lldi, get_real_dev,
138 if (!cxgb_our_interface(lldi, get_real_dev, 138 ip6_dst_idev(dst)->dev) &&
139 ip6_dst_idev(dst)->dev) && 139 !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK))) {
140 !(ip6_dst_idev(dst)->dev->flags & IFF_LOOPBACK)) {
141 dst_release(dst); 140 dst_release(dst);
142 dst = NULL; 141 return NULL;
143 } 142 }
144 } 143 }
145 144
146out:
147 return dst; 145 return dst;
148} 146}
149EXPORT_SYMBOL(cxgb_find_route6); 147EXPORT_SYMBOL(cxgb_find_route6);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 7e1633bf5a22..225e9a4877d7 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -5155,7 +5155,9 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
5155 skb->inner_protocol_type != ENCAP_TYPE_ETHER || 5155 skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
5156 skb->inner_protocol != htons(ETH_P_TEB) || 5156 skb->inner_protocol != htons(ETH_P_TEB) ||
5157 skb_inner_mac_header(skb) - skb_transport_header(skb) != 5157 skb_inner_mac_header(skb) - skb_transport_header(skb) !=
5158 sizeof(struct udphdr) + sizeof(struct vxlanhdr)) 5158 sizeof(struct udphdr) + sizeof(struct vxlanhdr) ||
5159 !adapter->vxlan_port ||
5160 udp_hdr(skb)->dest != adapter->vxlan_port)
5159 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK); 5161 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
5160 5162
5161 return features; 5163 return features;
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 624ba9058dc4..c9b7ad65e563 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -733,6 +733,7 @@ static int dpaa_eth_cgr_init(struct dpaa_priv *priv)
733 priv->cgr_data.cgr.cb = dpaa_eth_cgscn; 733 priv->cgr_data.cgr.cb = dpaa_eth_cgscn;
734 734
735 /* Enable Congestion State Change Notifications and CS taildrop */ 735 /* Enable Congestion State Change Notifications and CS taildrop */
736 memset(&initcgr, 0, sizeof(initcgr));
736 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES); 737 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CSCN_EN | QM_CGR_WE_CS_THRES);
737 initcgr.cgr.cscn_en = QM_CGR_EN; 738 initcgr.cgr.cscn_en = QM_CGR_EN;
738 739
@@ -2291,7 +2292,8 @@ static int dpaa_open(struct net_device *net_dev)
2291 net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev); 2292 net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
2292 if (!net_dev->phydev) { 2293 if (!net_dev->phydev) {
2293 netif_err(priv, ifup, net_dev, "init_phy() failed\n"); 2294 netif_err(priv, ifup, net_dev, "init_phy() failed\n");
2294 return -ENODEV; 2295 err = -ENODEV;
2296 goto phy_init_failed;
2295 } 2297 }
2296 2298
2297 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) { 2299 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
@@ -2314,6 +2316,7 @@ mac_start_failed:
2314 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) 2316 for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++)
2315 fman_port_disable(mac_dev->port[i]); 2317 fman_port_disable(mac_dev->port[i]);
2316 2318
2319phy_init_failed:
2317 dpaa_eth_napi_disable(priv); 2320 dpaa_eth_napi_disable(priv);
2318 2321
2319 return err; 2322 return err;
@@ -2420,6 +2423,7 @@ static int dpaa_ingress_cgr_init(struct dpaa_priv *priv)
2420 } 2423 }
2421 2424
2422 /* Enable CS TD, but disable Congestion State Change Notifications. */ 2425 /* Enable CS TD, but disable Congestion State Change Notifications. */
2426 memset(&initcgr, 0, sizeof(initcgr));
2423 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES); 2427 initcgr.we_mask = cpu_to_be16(QM_CGR_WE_CS_THRES);
2424 initcgr.cgr.cscn_en = QM_CGR_EN; 2428 initcgr.cgr.cscn_en = QM_CGR_EN;
2425 cs_th = DPAA_INGRESS_CS_THRESHOLD; 2429 cs_th = DPAA_INGRESS_CS_THRESHOLD;
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index cbeea915f026..8037426ec50f 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -900,10 +900,10 @@ static void korina_restart_task(struct work_struct *work)
900 DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR, 900 DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR,
901 &lp->rx_dma_regs->dmasm); 901 &lp->rx_dma_regs->dmasm);
902 902
903 korina_free_ring(dev);
904
905 napi_disable(&lp->napi); 903 napi_disable(&lp->napi);
906 904
905 korina_free_ring(dev);
906
907 if (korina_init(dev) < 0) { 907 if (korina_init(dev) < 0) {
908 printk(KERN_ERR "%s: cannot restart device\n", dev->name); 908 printk(KERN_ERR "%s: cannot restart device\n", dev->name);
909 return; 909 return;
@@ -1064,12 +1064,12 @@ static int korina_close(struct net_device *dev)
1064 tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR; 1064 tmp = tmp | DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR;
1065 writel(tmp, &lp->rx_dma_regs->dmasm); 1065 writel(tmp, &lp->rx_dma_regs->dmasm);
1066 1066
1067 korina_free_ring(dev);
1068
1069 napi_disable(&lp->napi); 1067 napi_disable(&lp->napi);
1070 1068
1071 cancel_work_sync(&lp->restart_task); 1069 cancel_work_sync(&lp->restart_task);
1072 1070
1071 korina_free_ring(dev);
1072
1073 free_irq(lp->rx_irq, dev); 1073 free_irq(lp->rx_irq, dev);
1074 free_irq(lp->tx_irq, dev); 1074 free_irq(lp->tx_irq, dev);
1075 free_irq(lp->ovr_irq, dev); 1075 free_irq(lp->ovr_irq, dev);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
index 015198c14fa8..504461a464c5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c
@@ -245,13 +245,9 @@ static u32 freq_to_shift(u16 freq)
245{ 245{
246 u32 freq_khz = freq * 1000; 246 u32 freq_khz = freq * 1000;
247 u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC; 247 u64 max_val_cycles = freq_khz * 1000 * MLX4_EN_WRAP_AROUND_SEC;
248 u64 tmp_rounded = 248 u64 max_val_cycles_rounded = 1ULL << fls64(max_val_cycles - 1);
249 roundup_pow_of_two(max_val_cycles) > max_val_cycles ?
250 roundup_pow_of_two(max_val_cycles) - 1 : UINT_MAX;
251 u64 max_val_cycles_rounded = is_power_of_2(max_val_cycles + 1) ?
252 max_val_cycles : tmp_rounded;
253 /* calculate max possible multiplier in order to fit in 64bit */ 249 /* calculate max possible multiplier in order to fit in 64bit */
254 u64 max_mul = div_u64(0xffffffffffffffffULL, max_val_cycles_rounded); 250 u64 max_mul = div64_u64(ULLONG_MAX, max_val_cycles_rounded);
255 251
256 /* This comes from the reverse of clocksource_khz2mult */ 252 /* This comes from the reverse of clocksource_khz2mult */
257 return ilog2(div_u64(max_mul * freq_khz, 1000000)); 253 return ilog2(div_u64(max_mul * freq_khz, 1000000));
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index bcd955339058..edbe200ac2fa 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1638,7 +1638,8 @@ int mlx4_en_start_port(struct net_device *dev)
1638 1638
1639 /* Configure tx cq's and rings */ 1639 /* Configure tx cq's and rings */
1640 for (t = 0 ; t < MLX4_EN_NUM_TX_TYPES; t++) { 1640 for (t = 0 ; t < MLX4_EN_NUM_TX_TYPES; t++) {
1641 u8 num_tx_rings_p_up = t == TX ? priv->num_tx_rings_p_up : 1; 1641 u8 num_tx_rings_p_up = t == TX ?
1642 priv->num_tx_rings_p_up : priv->tx_ring_num[t];
1642 1643
1643 for (i = 0; i < priv->tx_ring_num[t]; i++) { 1644 for (i = 0; i < priv->tx_ring_num[t]; i++) {
1644 /* Configure cq */ 1645 /* Configure cq */
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 3c37e216bbf3..eac527e25ec9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -445,8 +445,14 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv)
445 ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn; 445 ring->cqn = priv->rx_cq[ring_ind]->mcq.cqn;
446 446
447 ring->stride = stride; 447 ring->stride = stride;
448 if (ring->stride <= TXBB_SIZE) 448 if (ring->stride <= TXBB_SIZE) {
449 /* Stamp first unused send wqe */
450 __be32 *ptr = (__be32 *)ring->buf;
451 __be32 stamp = cpu_to_be32(1 << STAMP_SHIFT);
452 *ptr = stamp;
453 /* Move pointer to start of rx section */
449 ring->buf += TXBB_SIZE; 454 ring->buf += TXBB_SIZE;
455 }
450 456
451 ring->log_stride = ffs(ring->stride) - 1; 457 ring->log_stride = ffs(ring->stride) - 1;
452 ring->buf_size = ring->size * ring->stride; 458 ring->buf_size = ring->size * ring->stride;
diff --git a/drivers/net/ethernet/mellanox/mlx4/icm.c b/drivers/net/ethernet/mellanox/mlx4/icm.c
index 2a9dd460a95f..e1f9e7cebf8f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/icm.c
+++ b/drivers/net/ethernet/mellanox/mlx4/icm.c
@@ -118,8 +118,13 @@ static int mlx4_alloc_icm_coherent(struct device *dev, struct scatterlist *mem,
118 if (!buf) 118 if (!buf)
119 return -ENOMEM; 119 return -ENOMEM;
120 120
121 if (offset_in_page(buf)) {
122 dma_free_coherent(dev, PAGE_SIZE << order,
123 buf, sg_dma_address(mem));
124 return -ENOMEM;
125 }
126
121 sg_set_buf(mem, buf, PAGE_SIZE << order); 127 sg_set_buf(mem, buf, PAGE_SIZE << order);
122 BUG_ON(mem->offset);
123 sg_dma_len(mem) = PAGE_SIZE << order; 128 sg_dma_len(mem) = PAGE_SIZE << order;
124 return 0; 129 return 0;
125} 130}
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 5e7840a7a33b..bffa6f345f2f 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -42,6 +42,7 @@
42#include <linux/io-mapping.h> 42#include <linux/io-mapping.h>
43#include <linux/delay.h> 43#include <linux/delay.h>
44#include <linux/kmod.h> 44#include <linux/kmod.h>
45#include <linux/etherdevice.h>
45#include <net/devlink.h> 46#include <net/devlink.h>
46 47
47#include <linux/mlx4/device.h> 48#include <linux/mlx4/device.h>
@@ -782,6 +783,23 @@ int mlx4_is_slave_active(struct mlx4_dev *dev, int slave)
782} 783}
783EXPORT_SYMBOL(mlx4_is_slave_active); 784EXPORT_SYMBOL(mlx4_is_slave_active);
784 785
786void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
787 struct _rule_hw *eth_header)
788{
789 if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
790 is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
791 struct mlx4_net_trans_rule_hw_eth *eth =
792 (struct mlx4_net_trans_rule_hw_eth *)eth_header;
793 struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
794 bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
795 next_rule->rsvd == 0;
796
797 if (last_rule)
798 ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
799 }
800}
801EXPORT_SYMBOL(mlx4_handle_eth_header_mcast_prio);
802
785static void slave_adjust_steering_mode(struct mlx4_dev *dev, 803static void slave_adjust_steering_mode(struct mlx4_dev *dev,
786 struct mlx4_dev_cap *dev_cap, 804 struct mlx4_dev_cap *dev_cap,
787 struct mlx4_init_hca_param *hca_param) 805 struct mlx4_init_hca_param *hca_param)
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index c548beaaf910..56185a0b827d 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -4164,22 +4164,6 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header,
4164 return 0; 4164 return 0;
4165} 4165}
4166 4166
4167static void handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
4168 struct _rule_hw *eth_header)
4169{
4170 if (is_multicast_ether_addr(eth_header->eth.dst_mac) ||
4171 is_broadcast_ether_addr(eth_header->eth.dst_mac)) {
4172 struct mlx4_net_trans_rule_hw_eth *eth =
4173 (struct mlx4_net_trans_rule_hw_eth *)eth_header;
4174 struct _rule_hw *next_rule = (struct _rule_hw *)(eth + 1);
4175 bool last_rule = next_rule->size == 0 && next_rule->id == 0 &&
4176 next_rule->rsvd == 0;
4177
4178 if (last_rule)
4179 ctrl->prio = cpu_to_be16(MLX4_DOMAIN_NIC);
4180 }
4181}
4182
4183/* 4167/*
4184 * In case of missing eth header, append eth header with a MAC address 4168 * In case of missing eth header, append eth header with a MAC address
4185 * assigned to the VF. 4169 * assigned to the VF.
@@ -4363,10 +4347,7 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
4363 header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id)); 4347 header_id = map_hw_to_sw_id(be16_to_cpu(rule_header->id));
4364 4348
4365 if (header_id == MLX4_NET_TRANS_RULE_ID_ETH) 4349 if (header_id == MLX4_NET_TRANS_RULE_ID_ETH)
4366 handle_eth_header_mcast_prio(ctrl, rule_header); 4350 mlx4_handle_eth_header_mcast_prio(ctrl, rule_header);
4367
4368 if (slave == dev->caps.function)
4369 goto execute;
4370 4351
4371 switch (header_id) { 4352 switch (header_id) {
4372 case MLX4_NET_TRANS_RULE_ID_ETH: 4353 case MLX4_NET_TRANS_RULE_ID_ETH:
@@ -4394,7 +4375,6 @@ int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave,
4394 goto err_put_qp; 4375 goto err_put_qp;
4395 } 4376 }
4396 4377
4397execute:
4398 err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param, 4378 err = mlx4_cmd_imm(dev, inbox->dma, &vhcr->out_param,
4399 vhcr->in_modifier, 0, 4379 vhcr->in_modifier, 0,
4400 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A, 4380 MLX4_QP_FLOW_STEERING_ATTACH, MLX4_CMD_TIME_CLASS_A,
@@ -4473,6 +4453,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
4473 struct res_qp *rqp; 4453 struct res_qp *rqp;
4474 struct res_fs_rule *rrule; 4454 struct res_fs_rule *rrule;
4475 u64 mirr_reg_id; 4455 u64 mirr_reg_id;
4456 int qpn;
4476 4457
4477 if (dev->caps.steering_mode != 4458 if (dev->caps.steering_mode !=
4478 MLX4_STEERING_MODE_DEVICE_MANAGED) 4459 MLX4_STEERING_MODE_DEVICE_MANAGED)
@@ -4489,10 +4470,11 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
4489 } 4470 }
4490 mirr_reg_id = rrule->mirr_rule_id; 4471 mirr_reg_id = rrule->mirr_rule_id;
4491 kfree(rrule->mirr_mbox); 4472 kfree(rrule->mirr_mbox);
4473 qpn = rrule->qpn;
4492 4474
4493 /* Release the rule form busy state before removal */ 4475 /* Release the rule form busy state before removal */
4494 put_res(dev, slave, vhcr->in_param, RES_FS_RULE); 4476 put_res(dev, slave, vhcr->in_param, RES_FS_RULE);
4495 err = get_res(dev, slave, rrule->qpn, RES_QP, &rqp); 4477 err = get_res(dev, slave, qpn, RES_QP, &rqp);
4496 if (err) 4478 if (err)
4497 return err; 4479 return err;
4498 4480
@@ -4517,7 +4499,7 @@ int mlx4_QP_FLOW_STEERING_DETACH_wrapper(struct mlx4_dev *dev, int slave,
4517 if (!err) 4499 if (!err)
4518 atomic_dec(&rqp->ref_count); 4500 atomic_dec(&rqp->ref_count);
4519out: 4501out:
4520 put_res(dev, slave, rrule->qpn, RES_QP); 4502 put_res(dev, slave, qpn, RES_QP);
4521 return err; 4503 return err;
4522} 4504}
4523 4505
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 7f6c225666c1..f0b460f47f29 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -723,6 +723,9 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv)
723 int i; 723 int i;
724 struct ieee_ets ets; 724 struct ieee_ets ets;
725 725
726 if (!MLX5_CAP_GEN(priv->mdev, ets))
727 return;
728
726 memset(&ets, 0, sizeof(ets)); 729 memset(&ets, 0, sizeof(ets));
727 ets.ets_cap = mlx5_max_tc(priv->mdev) + 1; 730 ets.ets_cap = mlx5_max_tc(priv->mdev) + 1;
728 for (i = 0; i < ets.ets_cap; i++) { 731 for (i = 0; i < ets.ets_cap; i++) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index 352462af8d51..33a399a8b5d5 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -171,7 +171,6 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
171 return NUM_SW_COUNTERS + 171 return NUM_SW_COUNTERS +
172 MLX5E_NUM_Q_CNTRS(priv) + 172 MLX5E_NUM_Q_CNTRS(priv) +
173 NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS + 173 NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
174 NUM_PCIE_COUNTERS +
175 MLX5E_NUM_RQ_STATS(priv) + 174 MLX5E_NUM_RQ_STATS(priv) +
176 MLX5E_NUM_SQ_STATS(priv) + 175 MLX5E_NUM_SQ_STATS(priv) +
177 MLX5E_NUM_PFC_COUNTERS(priv) + 176 MLX5E_NUM_PFC_COUNTERS(priv) +
@@ -219,14 +218,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
219 strcpy(data + (idx++) * ETH_GSTRING_LEN, 218 strcpy(data + (idx++) * ETH_GSTRING_LEN,
220 pport_2819_stats_desc[i].format); 219 pport_2819_stats_desc[i].format);
221 220
222 for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
223 strcpy(data + (idx++) * ETH_GSTRING_LEN,
224 pcie_perf_stats_desc[i].format);
225
226 for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
227 strcpy(data + (idx++) * ETH_GSTRING_LEN,
228 pcie_tas_stats_desc[i].format);
229
230 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { 221 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
231 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) 222 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
232 sprintf(data + (idx++) * ETH_GSTRING_LEN, 223 sprintf(data + (idx++) * ETH_GSTRING_LEN,
@@ -339,14 +330,6 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
339 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters, 330 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
340 pport_2819_stats_desc, i); 331 pport_2819_stats_desc, i);
341 332
342 for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
343 data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
344 pcie_perf_stats_desc, i);
345
346 for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
347 data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_tas_counters,
348 pcie_tas_stats_desc, i);
349
350 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) { 333 for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
351 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++) 334 for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
352 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio], 335 data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
index 3691451c728c..d088effd7160 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c
@@ -247,6 +247,7 @@ static int set_flow_attrs(u32 *match_c, u32 *match_v,
247 } 247 }
248 if (fs->flow_type & FLOW_MAC_EXT && 248 if (fs->flow_type & FLOW_MAC_EXT &&
249 !is_zero_ether_addr(fs->m_ext.h_dest)) { 249 !is_zero_ether_addr(fs->m_ext.h_dest)) {
250 mask_spec(fs->m_ext.h_dest, fs->h_ext.h_dest, ETH_ALEN);
250 ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, 251 ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4,
251 outer_headers_c, dmac_47_16), 252 outer_headers_c, dmac_47_16),
252 fs->m_ext.h_dest); 253 fs->m_ext.h_dest);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index cbfa38fc72c0..1236b27b1493 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -291,36 +291,12 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
291 &qcnt->rx_out_of_buffer); 291 &qcnt->rx_out_of_buffer);
292} 292}
293 293
294static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv)
295{
296 struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie;
297 struct mlx5_core_dev *mdev = priv->mdev;
298 int sz = MLX5_ST_SZ_BYTES(mpcnt_reg);
299 void *out;
300 u32 *in;
301
302 in = mlx5_vzalloc(sz);
303 if (!in)
304 return;
305
306 out = pcie_stats->pcie_perf_counters;
307 MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP);
308 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
309
310 out = pcie_stats->pcie_tas_counters;
311 MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP);
312 mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
313
314 kvfree(in);
315}
316
317void mlx5e_update_stats(struct mlx5e_priv *priv) 294void mlx5e_update_stats(struct mlx5e_priv *priv)
318{ 295{
319 mlx5e_update_q_counter(priv); 296 mlx5e_update_q_counter(priv);
320 mlx5e_update_vport_counters(priv); 297 mlx5e_update_vport_counters(priv);
321 mlx5e_update_pport_counters(priv); 298 mlx5e_update_pport_counters(priv);
322 mlx5e_update_sw_counters(priv); 299 mlx5e_update_sw_counters(priv);
323 mlx5e_update_pcie_counters(priv);
324} 300}
325 301
326void mlx5e_update_stats_work(struct work_struct *work) 302void mlx5e_update_stats_work(struct work_struct *work)
@@ -3805,14 +3781,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
3805 3781
3806 mlx5_lag_add(mdev, netdev); 3782 mlx5_lag_add(mdev, netdev);
3807 3783
3808 if (mlx5e_vxlan_allowed(mdev)) {
3809 rtnl_lock();
3810 udp_tunnel_get_rx_info(netdev);
3811 rtnl_unlock();
3812 }
3813
3814 mlx5e_enable_async_events(priv); 3784 mlx5e_enable_async_events(priv);
3815 queue_work(priv->wq, &priv->set_rx_mode_work);
3816 3785
3817 if (MLX5_CAP_GEN(mdev, vport_group_manager)) { 3786 if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
3818 mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id); 3787 mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
@@ -3822,6 +3791,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
3822 rep.netdev = netdev; 3791 rep.netdev = netdev;
3823 mlx5_eswitch_register_vport_rep(esw, 0, &rep); 3792 mlx5_eswitch_register_vport_rep(esw, 0, &rep);
3824 } 3793 }
3794
3795 if (netdev->reg_state != NETREG_REGISTERED)
3796 return;
3797
3798 /* Device already registered: sync netdev system state */
3799 if (mlx5e_vxlan_allowed(mdev)) {
3800 rtnl_lock();
3801 udp_tunnel_get_rx_info(netdev);
3802 rtnl_unlock();
3803 }
3804
3805 queue_work(priv->wq, &priv->set_rx_mode_work);
3825} 3806}
3826 3807
3827static void mlx5e_nic_disable(struct mlx5e_priv *priv) 3808static void mlx5e_nic_disable(struct mlx5e_priv *priv)
@@ -3966,10 +3947,6 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
3966 const struct mlx5e_profile *profile = priv->profile; 3947 const struct mlx5e_profile *profile = priv->profile;
3967 3948
3968 set_bit(MLX5E_STATE_DESTROYING, &priv->state); 3949 set_bit(MLX5E_STATE_DESTROYING, &priv->state);
3969 if (profile->disable)
3970 profile->disable(priv);
3971
3972 flush_workqueue(priv->wq);
3973 3950
3974 rtnl_lock(); 3951 rtnl_lock();
3975 if (netif_running(netdev)) 3952 if (netif_running(netdev))
@@ -3977,6 +3954,10 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
3977 netif_device_detach(netdev); 3954 netif_device_detach(netdev);
3978 rtnl_unlock(); 3955 rtnl_unlock();
3979 3956
3957 if (profile->disable)
3958 profile->disable(priv);
3959 flush_workqueue(priv->wq);
3960
3980 mlx5e_destroy_q_counter(priv); 3961 mlx5e_destroy_q_counter(priv);
3981 profile->cleanup_rx(priv); 3962 profile->cleanup_rx(priv);
3982 mlx5e_close_drop_rq(priv); 3963 mlx5e_close_drop_rq(priv);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
index f202f872f57f..ba5db1dd23a9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
@@ -39,7 +39,7 @@
39#define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \ 39#define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \
40 (*(u32 *)((char *)ptr + dsc[i].offset)) 40 (*(u32 *)((char *)ptr + dsc[i].offset))
41#define MLX5E_READ_CTR32_BE(ptr, dsc, i) \ 41#define MLX5E_READ_CTR32_BE(ptr, dsc, i) \
42 be32_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset)) 42 be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
43 43
44#define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld) 44#define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld)
45#define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld) 45#define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld)
@@ -276,32 +276,6 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
276 { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) }, 276 { "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
277}; 277};
278 278
279#define PCIE_PERF_OFF(c) \
280 MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
281#define PCIE_PERF_GET(pcie_stats, c) \
282 MLX5_GET(mpcnt_reg, pcie_stats->pcie_perf_counters, \
283 counter_set.pcie_perf_cntrs_grp_data_layout.c)
284#define PCIE_TAS_OFF(c) \
285 MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_tas_cntrs_grp_data_layout.c)
286#define PCIE_TAS_GET(pcie_stats, c) \
287 MLX5_GET(mpcnt_reg, pcie_stats->pcie_tas_counters, \
288 counter_set.pcie_tas_cntrs_grp_data_layout.c)
289
290struct mlx5e_pcie_stats {
291 __be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
292 __be64 pcie_tas_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
293};
294
295static const struct counter_desc pcie_perf_stats_desc[] = {
296 { "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
297 { "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
298};
299
300static const struct counter_desc pcie_tas_stats_desc[] = {
301 { "tx_pci_transport_nonfatal_msg", PCIE_TAS_OFF(non_fatal_err_msg_sent) },
302 { "tx_pci_transport_fatal_msg", PCIE_TAS_OFF(fatal_err_msg_sent) },
303};
304
305struct mlx5e_rq_stats { 279struct mlx5e_rq_stats {
306 u64 packets; 280 u64 packets;
307 u64 bytes; 281 u64 bytes;
@@ -386,8 +360,6 @@ static const struct counter_desc sq_stats_desc[] = {
386#define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc) 360#define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc)
387#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc) 361#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
388#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc) 362#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
389#define NUM_PCIE_PERF_COUNTERS ARRAY_SIZE(pcie_perf_stats_desc)
390#define NUM_PCIE_TAS_COUNTERS ARRAY_SIZE(pcie_tas_stats_desc)
391#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \ 363#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
392 ARRAY_SIZE(pport_per_prio_traffic_stats_desc) 364 ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
393#define NUM_PPORT_PER_PRIO_PFC_COUNTERS \ 365#define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
@@ -397,7 +369,6 @@ static const struct counter_desc sq_stats_desc[] = {
397 NUM_PPORT_2819_COUNTERS + \ 369 NUM_PPORT_2819_COUNTERS + \
398 NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \ 370 NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
399 NUM_PPORT_PRIO) 371 NUM_PPORT_PRIO)
400#define NUM_PCIE_COUNTERS (NUM_PCIE_PERF_COUNTERS + NUM_PCIE_TAS_COUNTERS)
401#define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc) 372#define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc)
402#define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc) 373#define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc)
403 374
@@ -406,7 +377,6 @@ struct mlx5e_stats {
406 struct mlx5e_qcounter_stats qcnt; 377 struct mlx5e_qcounter_stats qcnt;
407 struct mlx5e_vport_stats vport; 378 struct mlx5e_vport_stats vport;
408 struct mlx5e_pport_stats pport; 379 struct mlx5e_pport_stats pport;
409 struct mlx5e_pcie_stats pcie;
410 struct rtnl_link_stats64 vf_vport; 380 struct rtnl_link_stats64 vf_vport;
411}; 381};
412 382
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index d6807c3cc461..f14d9c9ba773 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
1860 1860
1861 if (!ESW_ALLOWED(esw)) 1861 if (!ESW_ALLOWED(esw))
1862 return -EPERM; 1862 return -EPERM;
1863 if (!LEGAL_VPORT(esw, vport)) 1863 if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
1864 return -EINVAL; 1864 return -EINVAL;
1865 1865
1866 mutex_lock(&esw->state_lock); 1866 mutex_lock(&esw->state_lock);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 466e161010f7..03293ed1cc22 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -695,6 +695,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
695 if (err) 695 if (err)
696 goto err_reps; 696 goto err_reps;
697 } 697 }
698
699 /* disable PF RoCE so missed packets don't go through RoCE steering */
700 mlx5_dev_list_lock();
701 mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
702 mlx5_dev_list_unlock();
703
698 return 0; 704 return 0;
699 705
700err_reps: 706err_reps:
@@ -718,6 +724,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw)
718{ 724{
719 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; 725 int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
720 726
727 /* enable back PF RoCE */
728 mlx5_dev_list_lock();
729 mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
730 mlx5_dev_list_unlock();
731
721 mlx5_eswitch_disable_sriov(esw); 732 mlx5_eswitch_disable_sriov(esw);
722 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); 733 err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
723 if (err) { 734 if (err) {
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index a263d8904a4c..0ac7a2fc916c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1263,6 +1263,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
1263 nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD); 1263 nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
1264 handle = add_rule_fte(fte, fg, dest, dest_num, false); 1264 handle = add_rule_fte(fte, fg, dest, dest_num, false);
1265 if (IS_ERR(handle)) { 1265 if (IS_ERR(handle)) {
1266 unlock_ref_node(&fte->node);
1266 kfree(fte); 1267 kfree(fte);
1267 goto unlock_fg; 1268 goto unlock_fg;
1268 } 1269 }
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 54e5a786f191..6547f22e6b9b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -503,6 +503,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
503 MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size, 503 MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size,
504 to_fw_pkey_sz(dev, 128)); 504 to_fw_pkey_sz(dev, 128));
505 505
506 /* Check log_max_qp from HCA caps to set in current profile */
507 if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) {
508 mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
509 profile[prof_sel].log_max_qp,
510 MLX5_CAP_GEN_MAX(dev, log_max_qp));
511 profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
512 }
506 if (prof->mask & MLX5_PROF_MASK_QP_SIZE) 513 if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
507 MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp, 514 MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
508 prof->log_max_qp); 515 prof->log_max_qp);
@@ -575,7 +582,6 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
575 struct mlx5_priv *priv = &mdev->priv; 582 struct mlx5_priv *priv = &mdev->priv;
576 struct msix_entry *msix = priv->msix_arr; 583 struct msix_entry *msix = priv->msix_arr;
577 int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector; 584 int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector;
578 int numa_node = priv->numa_node;
579 int err; 585 int err;
580 586
581 if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) { 587 if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) {
@@ -583,7 +589,7 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
583 return -ENOMEM; 589 return -ENOMEM;
584 } 590 }
585 591
586 cpumask_set_cpu(cpumask_local_spread(i, numa_node), 592 cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
587 priv->irq_info[i].mask); 593 priv->irq_info[i].mask);
588 594
589 err = irq_set_affinity_hint(irq, priv->irq_info[i].mask); 595 err = irq_set_affinity_hint(irq, priv->irq_info[i].mask);
@@ -1189,6 +1195,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
1189{ 1195{
1190 int err = 0; 1196 int err = 0;
1191 1197
1198 mlx5_drain_health_wq(dev);
1199
1192 mutex_lock(&dev->intf_state_mutex); 1200 mutex_lock(&dev->intf_state_mutex);
1193 if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { 1201 if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
1194 dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", 1202 dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n",
@@ -1351,10 +1359,9 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
1351 1359
1352 mlx5_enter_error_state(dev); 1360 mlx5_enter_error_state(dev);
1353 mlx5_unload_one(dev, priv, false); 1361 mlx5_unload_one(dev, priv, false);
1354 /* In case of kernel call save the pci state and drain health wq */ 1362 /* In case of kernel call save the pci state */
1355 if (state) { 1363 if (state) {
1356 pci_save_state(pdev); 1364 pci_save_state(pdev);
1357 mlx5_drain_health_wq(dev);
1358 mlx5_pci_disable_device(dev); 1365 mlx5_pci_disable_device(dev);
1359 } 1366 }
1360 1367
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index f9b97f5946f8..44389c90056a 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -326,6 +326,7 @@ enum cfg_version {
326static const struct pci_device_id rtl8169_pci_tbl[] = { 326static const struct pci_device_id rtl8169_pci_tbl[] = {
327 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 }, 327 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8129), 0, 0, RTL_CFG_0 },
328 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 }, 328 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8136), 0, 0, RTL_CFG_2 },
329 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 },
329 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 }, 330 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 },
330 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 }, 331 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 },
331 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 }, 332 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 },
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index f341c1bc7001..00fafabab1d0 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -819,6 +819,7 @@ static struct sh_eth_cpu_data sh7734_data = {
819 .tsu = 1, 819 .tsu = 1,
820 .hw_crc = 1, 820 .hw_crc = 1,
821 .select_mii = 1, 821 .select_mii = 1,
822 .shift_rd0 = 1,
822}; 823};
823 824
824/* SH7763 */ 825/* SH7763 */
@@ -1656,7 +1657,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
1656 else 1657 else
1657 goto out; 1658 goto out;
1658 1659
1659 if (!likely(mdp->irq_enabled)) { 1660 if (unlikely(!mdp->irq_enabled)) {
1660 sh_eth_write(ndev, 0, EESIPR); 1661 sh_eth_write(ndev, 0, EESIPR);
1661 goto out; 1662 goto out;
1662 } 1663 }
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index de2947ccc5ad..5eb0e684fd76 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -1323,7 +1323,8 @@ static int efx_ef10_init_nic(struct efx_nic *efx)
1323 } 1323 }
1324 1324
1325 /* don't fail init if RSS setup doesn't work */ 1325 /* don't fail init if RSS setup doesn't work */
1326 efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table); 1326 rc = efx->type->rx_push_rss_config(efx, false, efx->rx_indir_table);
1327 efx->rss_active = (rc == 0);
1327 1328
1328 return 0; 1329 return 0;
1329} 1330}
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 87bdc56b4e3a..18ebaea44e82 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -975,6 +975,8 @@ efx_ethtool_get_rxnfc(struct net_device *net_dev,
975 975
976 case ETHTOOL_GRXFH: { 976 case ETHTOOL_GRXFH: {
977 info->data = 0; 977 info->data = 0;
978 if (!efx->rss_active) /* No RSS */
979 return 0;
978 switch (info->flow_type) { 980 switch (info->flow_type) {
979 case UDP_V4_FLOW: 981 case UDP_V4_FLOW:
980 if (efx->rx_hash_udp_4tuple) 982 if (efx->rx_hash_udp_4tuple)
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 1a635ced62d0..1c62c1a00fca 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -860,6 +860,7 @@ struct vfdi_status;
860 * @rx_hash_key: Toeplitz hash key for RSS 860 * @rx_hash_key: Toeplitz hash key for RSS
861 * @rx_indir_table: Indirection table for RSS 861 * @rx_indir_table: Indirection table for RSS
862 * @rx_scatter: Scatter mode enabled for receives 862 * @rx_scatter: Scatter mode enabled for receives
863 * @rss_active: RSS enabled on hardware
863 * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled 864 * @rx_hash_udp_4tuple: UDP 4-tuple hashing enabled
864 * @int_error_count: Number of internal errors seen recently 865 * @int_error_count: Number of internal errors seen recently
865 * @int_error_expire: Time at which error count will be expired 866 * @int_error_expire: Time at which error count will be expired
@@ -998,6 +999,7 @@ struct efx_nic {
998 u8 rx_hash_key[40]; 999 u8 rx_hash_key[40];
999 u32 rx_indir_table[128]; 1000 u32 rx_indir_table[128];
1000 bool rx_scatter; 1001 bool rx_scatter;
1002 bool rss_active;
1001 bool rx_hash_udp_4tuple; 1003 bool rx_hash_udp_4tuple;
1002 1004
1003 unsigned int_error_count; 1005 unsigned int_error_count;
diff --git a/drivers/net/ethernet/sfc/siena.c b/drivers/net/ethernet/sfc/siena.c
index a3901bc96586..4e54e5dc9fcb 100644
--- a/drivers/net/ethernet/sfc/siena.c
+++ b/drivers/net/ethernet/sfc/siena.c
@@ -403,6 +403,7 @@ static int siena_init_nic(struct efx_nic *efx)
403 efx_writeo(efx, &temp, FR_AZ_RX_CFG); 403 efx_writeo(efx, &temp, FR_AZ_RX_CFG);
404 404
405 siena_rx_push_rss_config(efx, false, efx->rx_indir_table); 405 siena_rx_push_rss_config(efx, false, efx->rx_indir_table);
406 efx->rss_active = true;
406 407
407 /* Enable event logging */ 408 /* Enable event logging */
408 rc = efx_mcdi_log_ctrl(efx, true, false, 0); 409 rc = efx_mcdi_log_ctrl(efx, true, false, 0);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
index c35597586121..3dc7d279f805 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
@@ -60,8 +60,9 @@ struct oxnas_dwmac {
60 struct regmap *regmap; 60 struct regmap *regmap;
61}; 61};
62 62
63static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac) 63static int oxnas_dwmac_init(struct platform_device *pdev, void *priv)
64{ 64{
65 struct oxnas_dwmac *dwmac = priv;
65 unsigned int value; 66 unsigned int value;
66 int ret; 67 int ret;
67 68
@@ -105,20 +106,20 @@ static int oxnas_dwmac_init(struct oxnas_dwmac *dwmac)
105 return 0; 106 return 0;
106} 107}
107 108
109static void oxnas_dwmac_exit(struct platform_device *pdev, void *priv)
110{
111 struct oxnas_dwmac *dwmac = priv;
112
113 clk_disable_unprepare(dwmac->clk);
114}
115
108static int oxnas_dwmac_probe(struct platform_device *pdev) 116static int oxnas_dwmac_probe(struct platform_device *pdev)
109{ 117{
110 struct plat_stmmacenet_data *plat_dat; 118 struct plat_stmmacenet_data *plat_dat;
111 struct stmmac_resources stmmac_res; 119 struct stmmac_resources stmmac_res;
112 struct device_node *sysctrl;
113 struct oxnas_dwmac *dwmac; 120 struct oxnas_dwmac *dwmac;
114 int ret; 121 int ret;
115 122
116 sysctrl = of_parse_phandle(pdev->dev.of_node, "oxsemi,sys-ctrl", 0);
117 if (!sysctrl) {
118 dev_err(&pdev->dev, "failed to get sys-ctrl node\n");
119 return -EINVAL;
120 }
121
122 ret = stmmac_get_platform_resources(pdev, &stmmac_res); 123 ret = stmmac_get_platform_resources(pdev, &stmmac_res);
123 if (ret) 124 if (ret)
124 return ret; 125 return ret;
@@ -128,72 +129,48 @@ static int oxnas_dwmac_probe(struct platform_device *pdev)
128 return PTR_ERR(plat_dat); 129 return PTR_ERR(plat_dat);
129 130
130 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); 131 dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
131 if (!dwmac) 132 if (!dwmac) {
132 return -ENOMEM; 133 ret = -ENOMEM;
134 goto err_remove_config_dt;
135 }
133 136
134 dwmac->dev = &pdev->dev; 137 dwmac->dev = &pdev->dev;
135 plat_dat->bsp_priv = dwmac; 138 plat_dat->bsp_priv = dwmac;
139 plat_dat->init = oxnas_dwmac_init;
140 plat_dat->exit = oxnas_dwmac_exit;
136 141
137 dwmac->regmap = syscon_node_to_regmap(sysctrl); 142 dwmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
143 "oxsemi,sys-ctrl");
138 if (IS_ERR(dwmac->regmap)) { 144 if (IS_ERR(dwmac->regmap)) {
139 dev_err(&pdev->dev, "failed to have sysctrl regmap\n"); 145 dev_err(&pdev->dev, "failed to have sysctrl regmap\n");
140 return PTR_ERR(dwmac->regmap); 146 ret = PTR_ERR(dwmac->regmap);
147 goto err_remove_config_dt;
141 } 148 }
142 149
143 dwmac->clk = devm_clk_get(&pdev->dev, "gmac"); 150 dwmac->clk = devm_clk_get(&pdev->dev, "gmac");
144 if (IS_ERR(dwmac->clk)) 151 if (IS_ERR(dwmac->clk)) {
145 return PTR_ERR(dwmac->clk); 152 ret = PTR_ERR(dwmac->clk);
153 goto err_remove_config_dt;
154 }
146 155
147 ret = oxnas_dwmac_init(dwmac); 156 ret = oxnas_dwmac_init(pdev, plat_dat->bsp_priv);
148 if (ret) 157 if (ret)
149 return ret; 158 goto err_remove_config_dt;
150 159
151 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); 160 ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
152 if (ret) 161 if (ret)
153 clk_disable_unprepare(dwmac->clk); 162 goto err_dwmac_exit;
154 163
155 return ret;
156}
157 164
158static int oxnas_dwmac_remove(struct platform_device *pdev) 165 return 0;
159{
160 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev);
161 int ret = stmmac_dvr_remove(&pdev->dev);
162
163 clk_disable_unprepare(dwmac->clk);
164
165 return ret;
166}
167
168#ifdef CONFIG_PM_SLEEP
169static int oxnas_dwmac_suspend(struct device *dev)
170{
171 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
172 int ret;
173
174 ret = stmmac_suspend(dev);
175 clk_disable_unprepare(dwmac->clk);
176
177 return ret;
178}
179
180static int oxnas_dwmac_resume(struct device *dev)
181{
182 struct oxnas_dwmac *dwmac = get_stmmac_bsp_priv(dev);
183 int ret;
184
185 ret = oxnas_dwmac_init(dwmac);
186 if (ret)
187 return ret;
188 166
189 ret = stmmac_resume(dev); 167err_dwmac_exit:
168 oxnas_dwmac_exit(pdev, plat_dat->bsp_priv);
169err_remove_config_dt:
170 stmmac_remove_config_dt(pdev, plat_dat);
190 171
191 return ret; 172 return ret;
192} 173}
193#endif /* CONFIG_PM_SLEEP */
194
195static SIMPLE_DEV_PM_OPS(oxnas_dwmac_pm_ops,
196 oxnas_dwmac_suspend, oxnas_dwmac_resume);
197 174
198static const struct of_device_id oxnas_dwmac_match[] = { 175static const struct of_device_id oxnas_dwmac_match[] = {
199 { .compatible = "oxsemi,ox820-dwmac" }, 176 { .compatible = "oxsemi,ox820-dwmac" },
@@ -203,10 +180,10 @@ MODULE_DEVICE_TABLE(of, oxnas_dwmac_match);
203 180
204static struct platform_driver oxnas_dwmac_driver = { 181static struct platform_driver oxnas_dwmac_driver = {
205 .probe = oxnas_dwmac_probe, 182 .probe = oxnas_dwmac_probe,
206 .remove = oxnas_dwmac_remove, 183 .remove = stmmac_pltfr_remove,
207 .driver = { 184 .driver = {
208 .name = "oxnas-dwmac", 185 .name = "oxnas-dwmac",
209 .pm = &oxnas_dwmac_pm_ops, 186 .pm = &stmmac_pltfr_pm_ops,
210 .of_match_table = oxnas_dwmac_match, 187 .of_match_table = oxnas_dwmac_match,
211 }, 188 },
212}; 189};
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bb40382e205d..39eb7a65bb9f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3339,13 +3339,6 @@ int stmmac_dvr_probe(struct device *device,
3339 3339
3340 spin_lock_init(&priv->lock); 3340 spin_lock_init(&priv->lock);
3341 3341
3342 ret = register_netdev(ndev);
3343 if (ret) {
3344 netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
3345 __func__, ret);
3346 goto error_netdev_register;
3347 }
3348
3349 /* If a specific clk_csr value is passed from the platform 3342 /* If a specific clk_csr value is passed from the platform
3350 * this means that the CSR Clock Range selection cannot be 3343 * this means that the CSR Clock Range selection cannot be
3351 * changed at run-time and it is fixed. Viceversa the driver'll try to 3344 * changed at run-time and it is fixed. Viceversa the driver'll try to
@@ -3372,11 +3365,21 @@ int stmmac_dvr_probe(struct device *device,
3372 } 3365 }
3373 } 3366 }
3374 3367
3375 return 0; 3368 ret = register_netdev(ndev);
3369 if (ret) {
3370 netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
3371 __func__, ret);
3372 goto error_netdev_register;
3373 }
3374
3375 return ret;
3376 3376
3377error_mdio_register:
3378 unregister_netdev(ndev);
3379error_netdev_register: 3377error_netdev_register:
3378 if (priv->hw->pcs != STMMAC_PCS_RGMII &&
3379 priv->hw->pcs != STMMAC_PCS_TBI &&
3380 priv->hw->pcs != STMMAC_PCS_RTBI)
3381 stmmac_mdio_unregister(ndev);
3382error_mdio_register:
3380 netif_napi_del(&priv->napi); 3383 netif_napi_del(&priv->napi);
3381error_hw_init: 3384error_hw_init:
3382 clk_disable_unprepare(priv->pclk); 3385 clk_disable_unprepare(priv->pclk);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index fda01f770eff..b0344c213752 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -116,7 +116,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
116 unsigned int mii_address = priv->hw->mii.addr; 116 unsigned int mii_address = priv->hw->mii.addr;
117 unsigned int mii_data = priv->hw->mii.data; 117 unsigned int mii_data = priv->hw->mii.data;
118 118
119 u32 value = MII_WRITE | MII_BUSY; 119 u32 value = MII_BUSY;
120 120
121 value |= (phyaddr << priv->hw->mii.addr_shift) 121 value |= (phyaddr << priv->hw->mii.addr_shift)
122 & priv->hw->mii.addr_mask; 122 & priv->hw->mii.addr_mask;
@@ -126,6 +126,8 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
126 & priv->hw->mii.clk_csr_mask; 126 & priv->hw->mii.clk_csr_mask;
127 if (priv->plat->has_gmac4) 127 if (priv->plat->has_gmac4)
128 value |= MII_GMAC4_WRITE; 128 value |= MII_GMAC4_WRITE;
129 else
130 value |= MII_WRITE;
129 131
130 /* Wait until any existing MII operation is complete */ 132 /* Wait until any existing MII operation is complete */
131 if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address)) 133 if (stmmac_mdio_busy_wait(priv->ioaddr, mii_address))
diff --git a/drivers/net/ipvlan/ipvlan.h b/drivers/net/ipvlan/ipvlan.h
index 031093e1c25f..dbfbb33ac66c 100644
--- a/drivers/net/ipvlan/ipvlan.h
+++ b/drivers/net/ipvlan/ipvlan.h
@@ -99,6 +99,11 @@ struct ipvl_port {
99 int count; 99 int count;
100}; 100};
101 101
102struct ipvl_skb_cb {
103 bool tx_pkt;
104};
105#define IPVL_SKB_CB(_skb) ((struct ipvl_skb_cb *)&((_skb)->cb[0]))
106
102static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d) 107static inline struct ipvl_port *ipvlan_port_get_rcu(const struct net_device *d)
103{ 108{
104 return rcu_dereference(d->rx_handler_data); 109 return rcu_dereference(d->rx_handler_data);
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index b4e990743e1d..83ce74acf82d 100644
--- a/drivers/net/ipvlan/ipvlan_core.c
+++ b/drivers/net/ipvlan/ipvlan_core.c
@@ -198,7 +198,7 @@ void ipvlan_process_multicast(struct work_struct *work)
198 unsigned int mac_hash; 198 unsigned int mac_hash;
199 int ret; 199 int ret;
200 u8 pkt_type; 200 u8 pkt_type;
201 bool hlocal, dlocal; 201 bool tx_pkt;
202 202
203 __skb_queue_head_init(&list); 203 __skb_queue_head_init(&list);
204 204
@@ -207,8 +207,11 @@ void ipvlan_process_multicast(struct work_struct *work)
207 spin_unlock_bh(&port->backlog.lock); 207 spin_unlock_bh(&port->backlog.lock);
208 208
209 while ((skb = __skb_dequeue(&list)) != NULL) { 209 while ((skb = __skb_dequeue(&list)) != NULL) {
210 struct net_device *dev = skb->dev;
211 bool consumed = false;
212
210 ethh = eth_hdr(skb); 213 ethh = eth_hdr(skb);
211 hlocal = ether_addr_equal(ethh->h_source, port->dev->dev_addr); 214 tx_pkt = IPVL_SKB_CB(skb)->tx_pkt;
212 mac_hash = ipvlan_mac_hash(ethh->h_dest); 215 mac_hash = ipvlan_mac_hash(ethh->h_dest);
213 216
214 if (ether_addr_equal(ethh->h_dest, port->dev->broadcast)) 217 if (ether_addr_equal(ethh->h_dest, port->dev->broadcast))
@@ -216,41 +219,45 @@ void ipvlan_process_multicast(struct work_struct *work)
216 else 219 else
217 pkt_type = PACKET_MULTICAST; 220 pkt_type = PACKET_MULTICAST;
218 221
219 dlocal = false;
220 rcu_read_lock(); 222 rcu_read_lock();
221 list_for_each_entry_rcu(ipvlan, &port->ipvlans, pnode) { 223 list_for_each_entry_rcu(ipvlan, &port->ipvlans, pnode) {
222 if (hlocal && (ipvlan->dev == skb->dev)) { 224 if (tx_pkt && (ipvlan->dev == skb->dev))
223 dlocal = true;
224 continue; 225 continue;
225 }
226 if (!test_bit(mac_hash, ipvlan->mac_filters)) 226 if (!test_bit(mac_hash, ipvlan->mac_filters))
227 continue; 227 continue;
228 228 if (!(ipvlan->dev->flags & IFF_UP))
229 continue;
229 ret = NET_RX_DROP; 230 ret = NET_RX_DROP;
230 len = skb->len + ETH_HLEN; 231 len = skb->len + ETH_HLEN;
231 nskb = skb_clone(skb, GFP_ATOMIC); 232 nskb = skb_clone(skb, GFP_ATOMIC);
232 if (!nskb) 233 local_bh_disable();
233 goto acct; 234 if (nskb) {
234 235 consumed = true;
235 nskb->pkt_type = pkt_type; 236 nskb->pkt_type = pkt_type;
236 nskb->dev = ipvlan->dev; 237 nskb->dev = ipvlan->dev;
237 if (hlocal) 238 if (tx_pkt)
238 ret = dev_forward_skb(ipvlan->dev, nskb); 239 ret = dev_forward_skb(ipvlan->dev, nskb);
239 else 240 else
240 ret = netif_rx(nskb); 241 ret = netif_rx(nskb);
241acct: 242 }
242 ipvlan_count_rx(ipvlan, len, ret == NET_RX_SUCCESS, true); 243 ipvlan_count_rx(ipvlan, len, ret == NET_RX_SUCCESS, true);
244 local_bh_enable();
243 } 245 }
244 rcu_read_unlock(); 246 rcu_read_unlock();
245 247
246 if (dlocal) { 248 if (tx_pkt) {
247 /* If the packet originated here, send it out. */ 249 /* If the packet originated here, send it out. */
248 skb->dev = port->dev; 250 skb->dev = port->dev;
249 skb->pkt_type = pkt_type; 251 skb->pkt_type = pkt_type;
250 dev_queue_xmit(skb); 252 dev_queue_xmit(skb);
251 } else { 253 } else {
252 kfree_skb(skb); 254 if (consumed)
255 consume_skb(skb);
256 else
257 kfree_skb(skb);
253 } 258 }
259 if (dev)
260 dev_put(dev);
254 } 261 }
255} 262}
256 263
@@ -470,15 +477,24 @@ out:
470} 477}
471 478
472static void ipvlan_multicast_enqueue(struct ipvl_port *port, 479static void ipvlan_multicast_enqueue(struct ipvl_port *port,
473 struct sk_buff *skb) 480 struct sk_buff *skb, bool tx_pkt)
474{ 481{
475 if (skb->protocol == htons(ETH_P_PAUSE)) { 482 if (skb->protocol == htons(ETH_P_PAUSE)) {
476 kfree_skb(skb); 483 kfree_skb(skb);
477 return; 484 return;
478 } 485 }
479 486
487 /* Record that the deferred packet is from TX or RX path. By
488 * looking at mac-addresses on packet will lead to erronus decisions.
489 * (This would be true for a loopback-mode on master device or a
490 * hair-pin mode of the switch.)
491 */
492 IPVL_SKB_CB(skb)->tx_pkt = tx_pkt;
493
480 spin_lock(&port->backlog.lock); 494 spin_lock(&port->backlog.lock);
481 if (skb_queue_len(&port->backlog) < IPVLAN_QBACKLOG_LIMIT) { 495 if (skb_queue_len(&port->backlog) < IPVLAN_QBACKLOG_LIMIT) {
496 if (skb->dev)
497 dev_hold(skb->dev);
482 __skb_queue_tail(&port->backlog, skb); 498 __skb_queue_tail(&port->backlog, skb);
483 spin_unlock(&port->backlog.lock); 499 spin_unlock(&port->backlog.lock);
484 schedule_work(&port->wq); 500 schedule_work(&port->wq);
@@ -537,7 +553,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
537 553
538 } else if (is_multicast_ether_addr(eth->h_dest)) { 554 } else if (is_multicast_ether_addr(eth->h_dest)) {
539 ipvlan_skb_crossing_ns(skb, NULL); 555 ipvlan_skb_crossing_ns(skb, NULL);
540 ipvlan_multicast_enqueue(ipvlan->port, skb); 556 ipvlan_multicast_enqueue(ipvlan->port, skb, true);
541 return NET_XMIT_SUCCESS; 557 return NET_XMIT_SUCCESS;
542 } 558 }
543 559
@@ -634,7 +650,7 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb,
634 */ 650 */
635 if (nskb) { 651 if (nskb) {
636 ipvlan_skb_crossing_ns(nskb, NULL); 652 ipvlan_skb_crossing_ns(nskb, NULL);
637 ipvlan_multicast_enqueue(port, nskb); 653 ipvlan_multicast_enqueue(port, nskb, false);
638 } 654 }
639 } 655 }
640 } else { 656 } else {
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 693ec5b66222..8b0f99300cbc 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -135,6 +135,7 @@ err:
135static void ipvlan_port_destroy(struct net_device *dev) 135static void ipvlan_port_destroy(struct net_device *dev)
136{ 136{
137 struct ipvl_port *port = ipvlan_port_get_rtnl(dev); 137 struct ipvl_port *port = ipvlan_port_get_rtnl(dev);
138 struct sk_buff *skb;
138 139
139 dev->priv_flags &= ~IFF_IPVLAN_MASTER; 140 dev->priv_flags &= ~IFF_IPVLAN_MASTER;
140 if (port->mode == IPVLAN_MODE_L3S) { 141 if (port->mode == IPVLAN_MODE_L3S) {
@@ -144,7 +145,11 @@ static void ipvlan_port_destroy(struct net_device *dev)
144 } 145 }
145 netdev_rx_handler_unregister(dev); 146 netdev_rx_handler_unregister(dev);
146 cancel_work_sync(&port->wq); 147 cancel_work_sync(&port->wq);
147 __skb_queue_purge(&port->backlog); 148 while ((skb = __skb_dequeue(&port->backlog)) != NULL) {
149 if (skb->dev)
150 dev_put(skb->dev);
151 kfree_skb(skb);
152 }
148 kfree(port); 153 kfree(port);
149} 154}
150 155
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 6c646e228833..6e98ede997d3 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -1367,6 +1367,7 @@ static struct usb_driver asix_driver = {
1367 .probe = usbnet_probe, 1367 .probe = usbnet_probe,
1368 .suspend = asix_suspend, 1368 .suspend = asix_suspend,
1369 .resume = asix_resume, 1369 .resume = asix_resume,
1370 .reset_resume = asix_resume,
1370 .disconnect = usbnet_disconnect, 1371 .disconnect = usbnet_disconnect,
1371 .supports_autosuspend = 1, 1372 .supports_autosuspend = 1,
1372 .disable_hub_initiated_lpm = 1, 1373 .disable_hub_initiated_lpm = 1,
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 7532646c3b7b..23dfb0eac098 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -967,6 +967,7 @@ static struct sk_buff *vrf_ip6_rcv(struct net_device *vrf_dev,
967 */ 967 */
968 need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr); 968 need_strict = rt6_need_strict(&ipv6_hdr(skb)->daddr);
969 if (!ipv6_ndisc_frame(skb) && !need_strict) { 969 if (!ipv6_ndisc_frame(skb) && !need_strict) {
970 vrf_rx_stats(vrf_dev, skb->len);
970 skb->dev = vrf_dev; 971 skb->dev = vrf_dev;
971 skb->skb_iif = vrf_dev->ifindex; 972 skb->skb_iif = vrf_dev->ifindex;
972 973
@@ -1011,6 +1012,8 @@ static struct sk_buff *vrf_ip_rcv(struct net_device *vrf_dev,
1011 goto out; 1012 goto out;
1012 } 1013 }
1013 1014
1015 vrf_rx_stats(vrf_dev, skb->len);
1016
1014 skb_push(skb, skb->mac_len); 1017 skb_push(skb, skb->mac_len);
1015 dev_queue_xmit_nit(skb, vrf_dev); 1018 dev_queue_xmit_nit(skb, vrf_dev);
1016 skb_pull(skb, skb->mac_len); 1019 skb_pull(skb, skb->mac_len);
diff --git a/drivers/net/wan/slic_ds26522.c b/drivers/net/wan/slic_ds26522.c
index b776a0ab106c..9d9b4e0def2a 100644
--- a/drivers/net/wan/slic_ds26522.c
+++ b/drivers/net/wan/slic_ds26522.c
@@ -218,7 +218,7 @@ static int slic_ds26522_probe(struct spi_device *spi)
218 218
219 ret = slic_ds26522_init_configure(spi); 219 ret = slic_ds26522_init_configure(spi);
220 if (ret == 0) 220 if (ret == 0)
221 pr_info("DS26522 cs%d configurated\n", spi->chip_select); 221 pr_info("DS26522 cs%d configured\n", spi->chip_select);
222 222
223 return ret; 223 return ret;
224} 224}
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b40cfb076f02..2fc86dc7a8df 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1193,8 +1193,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
1193 blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); 1193 blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors);
1194 blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX)); 1194 blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
1195 } 1195 }
1196 if (ctrl->stripe_size) 1196 if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE)
1197 blk_queue_chunk_sectors(q, ctrl->stripe_size >> 9); 1197 blk_queue_chunk_sectors(q, ctrl->max_hw_sectors);
1198 blk_queue_virt_boundary(q, ctrl->page_size - 1); 1198 blk_queue_virt_boundary(q, ctrl->page_size - 1);
1199 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) 1199 if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
1200 vwc = true; 1200 vwc = true;
@@ -1250,19 +1250,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
1250 ctrl->max_hw_sectors = 1250 ctrl->max_hw_sectors =
1251 min_not_zero(ctrl->max_hw_sectors, max_hw_sectors); 1251 min_not_zero(ctrl->max_hw_sectors, max_hw_sectors);
1252 1252
1253 if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) {
1254 unsigned int max_hw_sectors;
1255
1256 ctrl->stripe_size = 1 << (id->vs[3] + page_shift);
1257 max_hw_sectors = ctrl->stripe_size >> (page_shift - 9);
1258 if (ctrl->max_hw_sectors) {
1259 ctrl->max_hw_sectors = min(max_hw_sectors,
1260 ctrl->max_hw_sectors);
1261 } else {
1262 ctrl->max_hw_sectors = max_hw_sectors;
1263 }
1264 }
1265
1266 nvme_set_queue_limits(ctrl, ctrl->admin_q); 1253 nvme_set_queue_limits(ctrl, ctrl->admin_q);
1267 ctrl->sgls = le32_to_cpu(id->sgls); 1254 ctrl->sgls = le32_to_cpu(id->sgls);
1268 ctrl->kas = le16_to_cpu(id->kas); 1255 ctrl->kas = le16_to_cpu(id->kas);
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 771e2e761872..aa0bc60810a7 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1491,19 +1491,20 @@ static int
1491nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize) 1491nvme_fc_create_hw_io_queues(struct nvme_fc_ctrl *ctrl, u16 qsize)
1492{ 1492{
1493 struct nvme_fc_queue *queue = &ctrl->queues[1]; 1493 struct nvme_fc_queue *queue = &ctrl->queues[1];
1494 int i, j, ret; 1494 int i, ret;
1495 1495
1496 for (i = 1; i < ctrl->queue_count; i++, queue++) { 1496 for (i = 1; i < ctrl->queue_count; i++, queue++) {
1497 ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize); 1497 ret = __nvme_fc_create_hw_queue(ctrl, queue, i, qsize);
1498 if (ret) { 1498 if (ret)
1499 for (j = i-1; j >= 0; j--) 1499 goto delete_queues;
1500 __nvme_fc_delete_hw_queue(ctrl,
1501 &ctrl->queues[j], j);
1502 return ret;
1503 }
1504 } 1500 }
1505 1501
1506 return 0; 1502 return 0;
1503
1504delete_queues:
1505 for (; i >= 0; i--)
1506 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[i], i);
1507 return ret;
1507} 1508}
1508 1509
1509static int 1510static int
@@ -2401,8 +2402,8 @@ __nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
2401 WARN_ON_ONCE(!changed); 2402 WARN_ON_ONCE(!changed);
2402 2403
2403 dev_info(ctrl->ctrl.device, 2404 dev_info(ctrl->ctrl.device,
2404 "NVME-FC{%d}: new ctrl: NQN \"%s\" (%p)\n", 2405 "NVME-FC{%d}: new ctrl: NQN \"%s\"\n",
2405 ctrl->cnum, ctrl->ctrl.opts->subsysnqn, &ctrl); 2406 ctrl->cnum, ctrl->ctrl.opts->subsysnqn);
2406 2407
2407 kref_get(&ctrl->ctrl.kref); 2408 kref_get(&ctrl->ctrl.kref);
2408 2409
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index bd5321441d12..6377e14586dc 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -135,7 +135,6 @@ struct nvme_ctrl {
135 135
136 u32 page_size; 136 u32 page_size;
137 u32 max_hw_sectors; 137 u32 max_hw_sectors;
138 u32 stripe_size;
139 u16 oncs; 138 u16 oncs;
140 u16 vid; 139 u16 vid;
141 atomic_t abort_limit; 140 atomic_t abort_limit;
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 3d21a154dce7..19beeb7b2ac2 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -712,15 +712,8 @@ static void __nvme_process_cq(struct nvme_queue *nvmeq, unsigned int *tag)
712 req = blk_mq_tag_to_rq(*nvmeq->tags, cqe.command_id); 712 req = blk_mq_tag_to_rq(*nvmeq->tags, cqe.command_id);
713 nvme_req(req)->result = cqe.result; 713 nvme_req(req)->result = cqe.result;
714 blk_mq_complete_request(req, le16_to_cpu(cqe.status) >> 1); 714 blk_mq_complete_request(req, le16_to_cpu(cqe.status) >> 1);
715
716 } 715 }
717 716
718 /* If the controller ignores the cq head doorbell and continuously
719 * writes to the queue, it is theoretically possible to wrap around
720 * the queue twice and mistakenly return IRQ_NONE. Linux only
721 * requires that 0.1% of your interrupts are handled, so this isn't
722 * a big problem.
723 */
724 if (head == nvmeq->cq_head && phase == nvmeq->cq_phase) 717 if (head == nvmeq->cq_head && phase == nvmeq->cq_phase)
725 return; 718 return;
726 719
@@ -1909,10 +1902,10 @@ static int nvme_dev_map(struct nvme_dev *dev)
1909 if (!dev->bar) 1902 if (!dev->bar)
1910 goto release; 1903 goto release;
1911 1904
1912 return 0; 1905 return 0;
1913 release: 1906 release:
1914 pci_release_mem_regions(pdev); 1907 pci_release_mem_regions(pdev);
1915 return -ENODEV; 1908 return -ENODEV;
1916} 1909}
1917 1910
1918static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) 1911static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c
index b71e95044b43..a5c09e703bd8 100644
--- a/drivers/nvme/host/scsi.c
+++ b/drivers/nvme/host/scsi.c
@@ -2160,30 +2160,6 @@ static int nvme_trans_synchronize_cache(struct nvme_ns *ns,
2160 return nvme_trans_status_code(hdr, nvme_sc); 2160 return nvme_trans_status_code(hdr, nvme_sc);
2161} 2161}
2162 2162
2163static int nvme_trans_start_stop(struct nvme_ns *ns, struct sg_io_hdr *hdr,
2164 u8 *cmd)
2165{
2166 u8 immed, no_flush;
2167
2168 immed = cmd[1] & 0x01;
2169 no_flush = cmd[4] & 0x04;
2170
2171 if (immed != 0) {
2172 return nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION,
2173 ILLEGAL_REQUEST, SCSI_ASC_INVALID_CDB,
2174 SCSI_ASCQ_CAUSE_NOT_REPORTABLE);
2175 } else {
2176 if (no_flush == 0) {
2177 /* Issue NVME FLUSH command prior to START STOP UNIT */
2178 int res = nvme_trans_synchronize_cache(ns, hdr);
2179 if (res)
2180 return res;
2181 }
2182
2183 return 0;
2184 }
2185}
2186
2187static int nvme_trans_format_unit(struct nvme_ns *ns, struct sg_io_hdr *hdr, 2163static int nvme_trans_format_unit(struct nvme_ns *ns, struct sg_io_hdr *hdr,
2188 u8 *cmd) 2164 u8 *cmd)
2189{ 2165{
@@ -2439,9 +2415,6 @@ static int nvme_scsi_translate(struct nvme_ns *ns, struct sg_io_hdr *hdr)
2439 case SECURITY_PROTOCOL_OUT: 2415 case SECURITY_PROTOCOL_OUT:
2440 retcode = nvme_trans_security_protocol(ns, hdr, cmd); 2416 retcode = nvme_trans_security_protocol(ns, hdr, cmd);
2441 break; 2417 break;
2442 case START_STOP:
2443 retcode = nvme_trans_start_stop(ns, hdr, cmd);
2444 break;
2445 case SYNCHRONIZE_CACHE: 2418 case SYNCHRONIZE_CACHE:
2446 retcode = nvme_trans_synchronize_cache(ns, hdr); 2419 retcode = nvme_trans_synchronize_cache(ns, hdr);
2447 break; 2420 break;
diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
index ec1ad2aa0a4c..95ae52390478 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c
@@ -382,7 +382,6 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
382{ 382{
383 struct nvmet_subsys *subsys = req->sq->ctrl->subsys; 383 struct nvmet_subsys *subsys = req->sq->ctrl->subsys;
384 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]); 384 u32 cdw10 = le32_to_cpu(req->cmd->common.cdw10[0]);
385 u64 val;
386 u32 val32; 385 u32 val32;
387 u16 status = 0; 386 u16 status = 0;
388 387
@@ -392,8 +391,7 @@ static void nvmet_execute_set_features(struct nvmet_req *req)
392 (subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16)); 391 (subsys->max_qid - 1) | ((subsys->max_qid - 1) << 16));
393 break; 392 break;
394 case NVME_FEAT_KATO: 393 case NVME_FEAT_KATO:
395 val = le64_to_cpu(req->cmd->prop_set.value); 394 val32 = le32_to_cpu(req->cmd->common.cdw10[1]);
396 val32 = val & 0xffff;
397 req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000); 395 req->sq->ctrl->kato = DIV_ROUND_UP(val32, 1000);
398 nvmet_set_result(req, req->sq->ctrl->kato); 396 nvmet_set_result(req, req->sq->ctrl->kato);
399 break; 397 break;
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c
index bcb8ebeb01c5..4e8e6a22bce1 100644
--- a/drivers/nvme/target/fcloop.c
+++ b/drivers/nvme/target/fcloop.c
@@ -845,7 +845,7 @@ fcloop_create_remote_port(struct device *dev, struct device_attribute *attr,
845 rport->lport = nport->lport; 845 rport->lport = nport->lport;
846 nport->rport = rport; 846 nport->rport = rport;
847 847
848 return ret ? ret : count; 848 return count;
849} 849}
850 850
851 851
@@ -952,7 +952,7 @@ fcloop_create_target_port(struct device *dev, struct device_attribute *attr,
952 tport->lport = nport->lport; 952 tport->lport = nport->lport;
953 nport->tport = tport; 953 nport->tport = tport;
954 954
955 return ret ? ret : count; 955 return count;
956} 956}
957 957
958 958
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index a579126832af..620c231a2889 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -212,7 +212,7 @@ static int meson_pmx_request_gpio(struct pinctrl_dev *pcdev,
212{ 212{
213 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev); 213 struct meson_pinctrl *pc = pinctrl_dev_get_drvdata(pcdev);
214 214
215 meson_pmx_disable_other_groups(pc, range->pin_base + offset, -1); 215 meson_pmx_disable_other_groups(pc, offset, -1);
216 216
217 return 0; 217 return 0;
218} 218}
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index aea310a91821..c9a146948192 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -382,26 +382,21 @@ static int amd_gpio_irq_set_type(struct irq_data *d, unsigned int type)
382{ 382{
383 int ret = 0; 383 int ret = 0;
384 u32 pin_reg; 384 u32 pin_reg;
385 unsigned long flags; 385 unsigned long flags, irq_flags;
386 bool level_trig;
387 u32 active_level;
388 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 386 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
389 struct amd_gpio *gpio_dev = gpiochip_get_data(gc); 387 struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
390 388
391 spin_lock_irqsave(&gpio_dev->lock, flags); 389 spin_lock_irqsave(&gpio_dev->lock, flags);
392 pin_reg = readl(gpio_dev->base + (d->hwirq)*4); 390 pin_reg = readl(gpio_dev->base + (d->hwirq)*4);
393 391
394 /* 392 /* Ignore the settings coming from the client and
395 * When level_trig is set EDGE and active_level is set HIGH in BIOS 393 * read the values from the ACPI tables
396 * default settings, ignore incoming settings from client and use 394 * while setting the trigger type
397 * BIOS settings to configure GPIO register.
398 */ 395 */
399 level_trig = !(pin_reg & (LEVEL_TRIGGER << LEVEL_TRIG_OFF));
400 active_level = pin_reg & (ACTIVE_LEVEL_MASK << ACTIVE_LEVEL_OFF);
401 396
402 if(level_trig && 397 irq_flags = irq_get_trigger_type(d->irq);
403 ((active_level >> ACTIVE_LEVEL_OFF) == ACTIVE_HIGH)) 398 if (irq_flags != IRQ_TYPE_NONE)
404 type = IRQ_TYPE_EDGE_FALLING; 399 type = irq_flags;
405 400
406 switch (type & IRQ_TYPE_SENSE_MASK) { 401 switch (type & IRQ_TYPE_SENSE_MASK) {
407 case IRQ_TYPE_EDGE_RISING: 402 case IRQ_TYPE_EDGE_RISING:
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
index 12f7d1eb65bc..07409fde02b2 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
@@ -56,6 +56,17 @@ static const struct samsung_pin_bank_type bank_type_alive = {
56 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, }, 56 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
57}; 57};
58 58
59/* Exynos5433 has the 4bit widths for PINCFG_TYPE_DRV bitfields. */
60static const struct samsung_pin_bank_type exynos5433_bank_type_off = {
61 .fld_width = { 4, 1, 2, 4, 2, 2, },
62 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, },
63};
64
65static const struct samsung_pin_bank_type exynos5433_bank_type_alive = {
66 .fld_width = { 4, 1, 2, 4, },
67 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
68};
69
59static void exynos_irq_mask(struct irq_data *irqd) 70static void exynos_irq_mask(struct irq_data *irqd)
60{ 71{
61 struct irq_chip *chip = irq_data_get_irq_chip(irqd); 72 struct irq_chip *chip = irq_data_get_irq_chip(irqd);
@@ -1335,82 +1346,82 @@ const struct samsung_pin_ctrl exynos5420_pin_ctrl[] __initconst = {
1335 1346
1336/* pin banks of exynos5433 pin-controller - ALIVE */ 1347/* pin banks of exynos5433 pin-controller - ALIVE */
1337static const struct samsung_pin_bank_data exynos5433_pin_banks0[] = { 1348static const struct samsung_pin_bank_data exynos5433_pin_banks0[] = {
1338 EXYNOS_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00), 1349 EXYNOS5433_PIN_BANK_EINTW(8, 0x000, "gpa0", 0x00),
1339 EXYNOS_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04), 1350 EXYNOS5433_PIN_BANK_EINTW(8, 0x020, "gpa1", 0x04),
1340 EXYNOS_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08), 1351 EXYNOS5433_PIN_BANK_EINTW(8, 0x040, "gpa2", 0x08),
1341 EXYNOS_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c), 1352 EXYNOS5433_PIN_BANK_EINTW(8, 0x060, "gpa3", 0x0c),
1342 EXYNOS_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004, 1), 1353 EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x020, "gpf1", 0x1004, 1),
1343 EXYNOS_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008, 1), 1354 EXYNOS5433_PIN_BANK_EINTW_EXT(4, 0x040, "gpf2", 0x1008, 1),
1344 EXYNOS_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c, 1), 1355 EXYNOS5433_PIN_BANK_EINTW_EXT(4, 0x060, "gpf3", 0x100c, 1),
1345 EXYNOS_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010, 1), 1356 EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x080, "gpf4", 0x1010, 1),
1346 EXYNOS_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014, 1), 1357 EXYNOS5433_PIN_BANK_EINTW_EXT(8, 0x0a0, "gpf5", 0x1014, 1),
1347}; 1358};
1348 1359
1349/* pin banks of exynos5433 pin-controller - AUD */ 1360/* pin banks of exynos5433 pin-controller - AUD */
1350static const struct samsung_pin_bank_data exynos5433_pin_banks1[] = { 1361static const struct samsung_pin_bank_data exynos5433_pin_banks1[] = {
1351 EXYNOS_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00), 1362 EXYNOS5433_PIN_BANK_EINTG(7, 0x000, "gpz0", 0x00),
1352 EXYNOS_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04), 1363 EXYNOS5433_PIN_BANK_EINTG(4, 0x020, "gpz1", 0x04),
1353}; 1364};
1354 1365
1355/* pin banks of exynos5433 pin-controller - CPIF */ 1366/* pin banks of exynos5433 pin-controller - CPIF */
1356static const struct samsung_pin_bank_data exynos5433_pin_banks2[] = { 1367static const struct samsung_pin_bank_data exynos5433_pin_banks2[] = {
1357 EXYNOS_PIN_BANK_EINTG(2, 0x000, "gpv6", 0x00), 1368 EXYNOS5433_PIN_BANK_EINTG(2, 0x000, "gpv6", 0x00),
1358}; 1369};
1359 1370
1360/* pin banks of exynos5433 pin-controller - eSE */ 1371/* pin banks of exynos5433 pin-controller - eSE */
1361static const struct samsung_pin_bank_data exynos5433_pin_banks3[] = { 1372static const struct samsung_pin_bank_data exynos5433_pin_banks3[] = {
1362 EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj2", 0x00), 1373 EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj2", 0x00),
1363}; 1374};
1364 1375
1365/* pin banks of exynos5433 pin-controller - FINGER */ 1376/* pin banks of exynos5433 pin-controller - FINGER */
1366static const struct samsung_pin_bank_data exynos5433_pin_banks4[] = { 1377static const struct samsung_pin_bank_data exynos5433_pin_banks4[] = {
1367 EXYNOS_PIN_BANK_EINTG(4, 0x000, "gpd5", 0x00), 1378 EXYNOS5433_PIN_BANK_EINTG(4, 0x000, "gpd5", 0x00),
1368}; 1379};
1369 1380
1370/* pin banks of exynos5433 pin-controller - FSYS */ 1381/* pin banks of exynos5433 pin-controller - FSYS */
1371static const struct samsung_pin_bank_data exynos5433_pin_banks5[] = { 1382static const struct samsung_pin_bank_data exynos5433_pin_banks5[] = {
1372 EXYNOS_PIN_BANK_EINTG(6, 0x000, "gph1", 0x00), 1383 EXYNOS5433_PIN_BANK_EINTG(6, 0x000, "gph1", 0x00),
1373 EXYNOS_PIN_BANK_EINTG(7, 0x020, "gpr4", 0x04), 1384 EXYNOS5433_PIN_BANK_EINTG(7, 0x020, "gpr4", 0x04),
1374 EXYNOS_PIN_BANK_EINTG(5, 0x040, "gpr0", 0x08), 1385 EXYNOS5433_PIN_BANK_EINTG(5, 0x040, "gpr0", 0x08),
1375 EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpr1", 0x0c), 1386 EXYNOS5433_PIN_BANK_EINTG(8, 0x060, "gpr1", 0x0c),
1376 EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpr2", 0x10), 1387 EXYNOS5433_PIN_BANK_EINTG(2, 0x080, "gpr2", 0x10),
1377 EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpr3", 0x14), 1388 EXYNOS5433_PIN_BANK_EINTG(8, 0x0a0, "gpr3", 0x14),
1378}; 1389};
1379 1390
1380/* pin banks of exynos5433 pin-controller - IMEM */ 1391/* pin banks of exynos5433 pin-controller - IMEM */
1381static const struct samsung_pin_bank_data exynos5433_pin_banks6[] = { 1392static const struct samsung_pin_bank_data exynos5433_pin_banks6[] = {
1382 EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpf0", 0x00), 1393 EXYNOS5433_PIN_BANK_EINTG(8, 0x000, "gpf0", 0x00),
1383}; 1394};
1384 1395
1385/* pin banks of exynos5433 pin-controller - NFC */ 1396/* pin banks of exynos5433 pin-controller - NFC */
1386static const struct samsung_pin_bank_data exynos5433_pin_banks7[] = { 1397static const struct samsung_pin_bank_data exynos5433_pin_banks7[] = {
1387 EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj0", 0x00), 1398 EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj0", 0x00),
1388}; 1399};
1389 1400
1390/* pin banks of exynos5433 pin-controller - PERIC */ 1401/* pin banks of exynos5433 pin-controller - PERIC */
1391static const struct samsung_pin_bank_data exynos5433_pin_banks8[] = { 1402static const struct samsung_pin_bank_data exynos5433_pin_banks8[] = {
1392 EXYNOS_PIN_BANK_EINTG(6, 0x000, "gpv7", 0x00), 1403 EXYNOS5433_PIN_BANK_EINTG(6, 0x000, "gpv7", 0x00),
1393 EXYNOS_PIN_BANK_EINTG(5, 0x020, "gpb0", 0x04), 1404 EXYNOS5433_PIN_BANK_EINTG(5, 0x020, "gpb0", 0x04),
1394 EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpc0", 0x08), 1405 EXYNOS5433_PIN_BANK_EINTG(8, 0x040, "gpc0", 0x08),
1395 EXYNOS_PIN_BANK_EINTG(2, 0x060, "gpc1", 0x0c), 1406 EXYNOS5433_PIN_BANK_EINTG(2, 0x060, "gpc1", 0x0c),
1396 EXYNOS_PIN_BANK_EINTG(6, 0x080, "gpc2", 0x10), 1407 EXYNOS5433_PIN_BANK_EINTG(6, 0x080, "gpc2", 0x10),
1397 EXYNOS_PIN_BANK_EINTG(8, 0x0a0, "gpc3", 0x14), 1408 EXYNOS5433_PIN_BANK_EINTG(8, 0x0a0, "gpc3", 0x14),
1398 EXYNOS_PIN_BANK_EINTG(2, 0x0c0, "gpg0", 0x18), 1409 EXYNOS5433_PIN_BANK_EINTG(2, 0x0c0, "gpg0", 0x18),
1399 EXYNOS_PIN_BANK_EINTG(4, 0x0e0, "gpd0", 0x1c), 1410 EXYNOS5433_PIN_BANK_EINTG(4, 0x0e0, "gpd0", 0x1c),
1400 EXYNOS_PIN_BANK_EINTG(6, 0x100, "gpd1", 0x20), 1411 EXYNOS5433_PIN_BANK_EINTG(6, 0x100, "gpd1", 0x20),
1401 EXYNOS_PIN_BANK_EINTG(8, 0x120, "gpd2", 0x24), 1412 EXYNOS5433_PIN_BANK_EINTG(8, 0x120, "gpd2", 0x24),
1402 EXYNOS_PIN_BANK_EINTG(5, 0x140, "gpd4", 0x28), 1413 EXYNOS5433_PIN_BANK_EINTG(5, 0x140, "gpd4", 0x28),
1403 EXYNOS_PIN_BANK_EINTG(2, 0x160, "gpd8", 0x2c), 1414 EXYNOS5433_PIN_BANK_EINTG(2, 0x160, "gpd8", 0x2c),
1404 EXYNOS_PIN_BANK_EINTG(7, 0x180, "gpd6", 0x30), 1415 EXYNOS5433_PIN_BANK_EINTG(7, 0x180, "gpd6", 0x30),
1405 EXYNOS_PIN_BANK_EINTG(3, 0x1a0, "gpd7", 0x34), 1416 EXYNOS5433_PIN_BANK_EINTG(3, 0x1a0, "gpd7", 0x34),
1406 EXYNOS_PIN_BANK_EINTG(5, 0x1c0, "gpg1", 0x38), 1417 EXYNOS5433_PIN_BANK_EINTG(5, 0x1c0, "gpg1", 0x38),
1407 EXYNOS_PIN_BANK_EINTG(2, 0x1e0, "gpg2", 0x3c), 1418 EXYNOS5433_PIN_BANK_EINTG(2, 0x1e0, "gpg2", 0x3c),
1408 EXYNOS_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40), 1419 EXYNOS5433_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40),
1409}; 1420};
1410 1421
1411/* pin banks of exynos5433 pin-controller - TOUCH */ 1422/* pin banks of exynos5433 pin-controller - TOUCH */
1412static const struct samsung_pin_bank_data exynos5433_pin_banks9[] = { 1423static const struct samsung_pin_bank_data exynos5433_pin_banks9[] = {
1413 EXYNOS_PIN_BANK_EINTG(3, 0x000, "gpj1", 0x00), 1424 EXYNOS5433_PIN_BANK_EINTG(3, 0x000, "gpj1", 0x00),
1414}; 1425};
1415 1426
1416/* 1427/*
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.h b/drivers/pinctrl/samsung/pinctrl-exynos.h
index 5821525a2c84..a473092fb8d2 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.h
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.h
@@ -90,6 +90,37 @@
90 .pctl_res_idx = pctl_idx, \ 90 .pctl_res_idx = pctl_idx, \
91 } \ 91 } \
92 92
93#define EXYNOS5433_PIN_BANK_EINTG(pins, reg, id, offs) \
94 { \
95 .type = &exynos5433_bank_type_off, \
96 .pctl_offset = reg, \
97 .nr_pins = pins, \
98 .eint_type = EINT_TYPE_GPIO, \
99 .eint_offset = offs, \
100 .name = id \
101 }
102
103#define EXYNOS5433_PIN_BANK_EINTW(pins, reg, id, offs) \
104 { \
105 .type = &exynos5433_bank_type_alive, \
106 .pctl_offset = reg, \
107 .nr_pins = pins, \
108 .eint_type = EINT_TYPE_WKUP, \
109 .eint_offset = offs, \
110 .name = id \
111 }
112
113#define EXYNOS5433_PIN_BANK_EINTW_EXT(pins, reg, id, offs, pctl_idx) \
114 { \
115 .type = &exynos5433_bank_type_alive, \
116 .pctl_offset = reg, \
117 .nr_pins = pins, \
118 .eint_type = EINT_TYPE_WKUP, \
119 .eint_offset = offs, \
120 .name = id, \
121 .pctl_res_idx = pctl_idx, \
122 } \
123
93/** 124/**
94 * struct exynos_weint_data: irq specific data for all the wakeup interrupts 125 * struct exynos_weint_data: irq specific data for all the wakeup interrupts
95 * generated by the external wakeup interrupt controller. 126 * generated by the external wakeup interrupt controller.
diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c
index 2d3b691f3fc4..038ac6934fe9 100644
--- a/drivers/video/fbdev/cobalt_lcdfb.c
+++ b/drivers/video/fbdev/cobalt_lcdfb.c
@@ -308,6 +308,11 @@ static int cobalt_lcdfb_probe(struct platform_device *dev)
308 info->screen_size = resource_size(res); 308 info->screen_size = resource_size(res);
309 info->screen_base = devm_ioremap(&dev->dev, res->start, 309 info->screen_base = devm_ioremap(&dev->dev, res->start,
310 info->screen_size); 310 info->screen_size);
311 if (!info->screen_base) {
312 framebuffer_release(info);
313 return -ENOMEM;
314 }
315
311 info->fbops = &cobalt_lcd_fbops; 316 info->fbops = &cobalt_lcd_fbops;
312 info->fix = cobalt_lcdfb_fix; 317 info->fix = cobalt_lcdfb_fix;
313 info->fix.smem_start = res->start; 318 info->fix.smem_start = res->start;
diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c
index 778acf80aacb..85dd20e05726 100644
--- a/drivers/xen/arm-device.c
+++ b/drivers/xen/arm-device.c
@@ -58,9 +58,13 @@ static int xen_map_device_mmio(const struct resource *resources,
58 xen_pfn_t *gpfns; 58 xen_pfn_t *gpfns;
59 xen_ulong_t *idxs; 59 xen_ulong_t *idxs;
60 int *errs; 60 int *errs;
61 struct xen_add_to_physmap_range xatp;
62 61
63 for (i = 0; i < count; i++) { 62 for (i = 0; i < count; i++) {
63 struct xen_add_to_physmap_range xatp = {
64 .domid = DOMID_SELF,
65 .space = XENMAPSPACE_dev_mmio
66 };
67
64 r = &resources[i]; 68 r = &resources[i];
65 nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE); 69 nr = DIV_ROUND_UP(resource_size(r), XEN_PAGE_SIZE);
66 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) 70 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
@@ -87,9 +91,7 @@ static int xen_map_device_mmio(const struct resource *resources,
87 idxs[j] = XEN_PFN_DOWN(r->start) + j; 91 idxs[j] = XEN_PFN_DOWN(r->start) + j;
88 } 92 }
89 93
90 xatp.domid = DOMID_SELF;
91 xatp.size = nr; 94 xatp.size = nr;
92 xatp.space = XENMAPSPACE_dev_mmio;
93 95
94 set_xen_guest_handle(xatp.gpfns, gpfns); 96 set_xen_guest_handle(xatp.gpfns, gpfns);
95 set_xen_guest_handle(xatp.idxs, idxs); 97 set_xen_guest_handle(xatp.idxs, idxs);
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index c03f9c86c7e3..3c41470c7fc4 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -369,8 +369,7 @@ static void evtchn_fifo_resume(void)
369 } 369 }
370 370
371 ret = init_control_block(cpu, control_block); 371 ret = init_control_block(cpu, control_block);
372 if (ret < 0) 372 BUG_ON(ret < 0);
373 BUG();
374 } 373 }
375 374
376 /* 375 /*
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index e8c7f09d01be..6890897a6f30 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -125,7 +125,7 @@ static int add_evtchn(struct per_user_data *u, struct user_evtchn *evtchn)
125 while (*new) { 125 while (*new) {
126 struct user_evtchn *this; 126 struct user_evtchn *this;
127 127
128 this = container_of(*new, struct user_evtchn, node); 128 this = rb_entry(*new, struct user_evtchn, node);
129 129
130 parent = *new; 130 parent = *new;
131 if (this->port < evtchn->port) 131 if (this->port < evtchn->port)
@@ -157,7 +157,7 @@ static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned port)
157 while (node) { 157 while (node) {
158 struct user_evtchn *evtchn; 158 struct user_evtchn *evtchn;
159 159
160 evtchn = container_of(node, struct user_evtchn, node); 160 evtchn = rb_entry(node, struct user_evtchn, node);
161 161
162 if (evtchn->port < port) 162 if (evtchn->port < port)
163 node = node->rb_left; 163 node = node->rb_left;
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h
index e74f9c1fbd80..867a2e425208 100644
--- a/drivers/xen/xenbus/xenbus_comms.h
+++ b/drivers/xen/xenbus/xenbus_comms.h
@@ -42,7 +42,6 @@ int xb_write(const void *data, unsigned len);
42int xb_read(void *data, unsigned len); 42int xb_read(void *data, unsigned len);
43int xb_data_to_read(void); 43int xb_data_to_read(void);
44int xb_wait_for_data_to_read(void); 44int xb_wait_for_data_to_read(void);
45int xs_input_avail(void);
46extern struct xenstore_domain_interface *xen_store_interface; 45extern struct xenstore_domain_interface *xen_store_interface;
47extern int xen_store_evtchn; 46extern int xen_store_evtchn;
48extern enum xenstore_init xen_store_domain_type; 47extern enum xenstore_init xen_store_domain_type;
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 6c0ead4be784..79130b310247 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -302,6 +302,29 @@ static void watch_fired(struct xenbus_watch *watch,
302 mutex_unlock(&adap->dev_data->reply_mutex); 302 mutex_unlock(&adap->dev_data->reply_mutex);
303} 303}
304 304
305static int xenbus_command_reply(struct xenbus_file_priv *u,
306 unsigned int msg_type, const char *reply)
307{
308 struct {
309 struct xsd_sockmsg hdr;
310 const char body[16];
311 } msg;
312 int rc;
313
314 msg.hdr = u->u.msg;
315 msg.hdr.type = msg_type;
316 msg.hdr.len = strlen(reply) + 1;
317 if (msg.hdr.len > sizeof(msg.body))
318 return -E2BIG;
319
320 mutex_lock(&u->reply_mutex);
321 rc = queue_reply(&u->read_buffers, &msg, sizeof(msg.hdr) + msg.hdr.len);
322 wake_up(&u->read_waitq);
323 mutex_unlock(&u->reply_mutex);
324
325 return rc;
326}
327
305static int xenbus_write_transaction(unsigned msg_type, 328static int xenbus_write_transaction(unsigned msg_type,
306 struct xenbus_file_priv *u) 329 struct xenbus_file_priv *u)
307{ 330{
@@ -316,12 +339,12 @@ static int xenbus_write_transaction(unsigned msg_type,
316 rc = -ENOMEM; 339 rc = -ENOMEM;
317 goto out; 340 goto out;
318 } 341 }
319 } else if (msg_type == XS_TRANSACTION_END) { 342 } else if (u->u.msg.tx_id != 0) {
320 list_for_each_entry(trans, &u->transactions, list) 343 list_for_each_entry(trans, &u->transactions, list)
321 if (trans->handle.id == u->u.msg.tx_id) 344 if (trans->handle.id == u->u.msg.tx_id)
322 break; 345 break;
323 if (&trans->list == &u->transactions) 346 if (&trans->list == &u->transactions)
324 return -ESRCH; 347 return xenbus_command_reply(u, XS_ERROR, "ENOENT");
325 } 348 }
326 349
327 reply = xenbus_dev_request_and_reply(&u->u.msg); 350 reply = xenbus_dev_request_and_reply(&u->u.msg);
@@ -372,12 +395,12 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
372 path = u->u.buffer + sizeof(u->u.msg); 395 path = u->u.buffer + sizeof(u->u.msg);
373 token = memchr(path, 0, u->u.msg.len); 396 token = memchr(path, 0, u->u.msg.len);
374 if (token == NULL) { 397 if (token == NULL) {
375 rc = -EILSEQ; 398 rc = xenbus_command_reply(u, XS_ERROR, "EINVAL");
376 goto out; 399 goto out;
377 } 400 }
378 token++; 401 token++;
379 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) { 402 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) {
380 rc = -EILSEQ; 403 rc = xenbus_command_reply(u, XS_ERROR, "EINVAL");
381 goto out; 404 goto out;
382 } 405 }
383 406
@@ -411,23 +434,7 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
411 } 434 }
412 435
413 /* Success. Synthesize a reply to say all is OK. */ 436 /* Success. Synthesize a reply to say all is OK. */
414 { 437 rc = xenbus_command_reply(u, msg_type, "OK");
415 struct {
416 struct xsd_sockmsg hdr;
417 char body[3];
418 } __packed reply = {
419 {
420 .type = msg_type,
421 .len = sizeof(reply.body)
422 },
423 "OK"
424 };
425
426 mutex_lock(&u->reply_mutex);
427 rc = queue_reply(&u->read_buffers, &reply, sizeof(reply));
428 wake_up(&u->read_waitq);
429 mutex_unlock(&u->reply_mutex);
430 }
431 438
432out: 439out:
433 return rc; 440 return rc;
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 6254cee8f8f3..5db5d1340d69 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -328,6 +328,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
328 struct file *file = iocb->ki_filp; 328 struct file *file = iocb->ki_filp;
329 struct inode *inode = bdev_file_inode(file); 329 struct inode *inode = bdev_file_inode(file);
330 struct block_device *bdev = I_BDEV(inode); 330 struct block_device *bdev = I_BDEV(inode);
331 struct blk_plug plug;
331 struct blkdev_dio *dio; 332 struct blkdev_dio *dio;
332 struct bio *bio; 333 struct bio *bio;
333 bool is_read = (iov_iter_rw(iter) == READ); 334 bool is_read = (iov_iter_rw(iter) == READ);
@@ -353,6 +354,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
353 dio->multi_bio = false; 354 dio->multi_bio = false;
354 dio->should_dirty = is_read && (iter->type == ITER_IOVEC); 355 dio->should_dirty = is_read && (iter->type == ITER_IOVEC);
355 356
357 blk_start_plug(&plug);
356 for (;;) { 358 for (;;) {
357 bio->bi_bdev = bdev; 359 bio->bi_bdev = bdev;
358 bio->bi_iter.bi_sector = pos >> 9; 360 bio->bi_iter.bi_sector = pos >> 9;
@@ -394,6 +396,7 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
394 submit_bio(bio); 396 submit_bio(bio);
395 bio = bio_alloc(GFP_KERNEL, nr_pages); 397 bio = bio_alloc(GFP_KERNEL, nr_pages);
396 } 398 }
399 blk_finish_plug(&plug);
397 400
398 if (!dio->is_sync) 401 if (!dio->is_sync)
399 return -EIOCBQUEUED; 402 return -EIOCBQUEUED;
diff --git a/fs/buffer.c b/fs/buffer.c
index d21771fcf7d3..0e87401cf335 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len)
1660 head = page_buffers(page); 1660 head = page_buffers(page);
1661 bh = head; 1661 bh = head;
1662 do { 1662 do {
1663 if (!buffer_mapped(bh)) 1663 if (!buffer_mapped(bh) || (bh->b_blocknr < block))
1664 goto next; 1664 goto next;
1665 if (bh->b_blocknr >= block + len) 1665 if (bh->b_blocknr >= block + len)
1666 break; 1666 break;
diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c
index 6eeea1dcba41..95cd4c3b06c3 100644
--- a/fs/crypto/keyinfo.c
+++ b/fs/crypto/keyinfo.c
@@ -248,7 +248,8 @@ retry:
248 goto out; 248 goto out;
249 249
250 if (fscrypt_dummy_context_enabled(inode)) { 250 if (fscrypt_dummy_context_enabled(inode)) {
251 memset(raw_key, 0x42, FS_AES_256_XTS_KEY_SIZE); 251 memset(raw_key, 0x42, keysize/2);
252 memset(raw_key+keysize/2, 0x24, keysize - (keysize/2));
252 goto got_key; 253 goto got_key;
253 } 254 }
254 255
diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c
index 6ed7c2eebeec..d6cd7ea4851d 100644
--- a/fs/crypto/policy.c
+++ b/fs/crypto/policy.c
@@ -179,6 +179,11 @@ int fscrypt_has_permitted_context(struct inode *parent, struct inode *child)
179 BUG_ON(1); 179 BUG_ON(1);
180 } 180 }
181 181
182 /* No restrictions on file types which are never encrypted */
183 if (!S_ISREG(child->i_mode) && !S_ISDIR(child->i_mode) &&
184 !S_ISLNK(child->i_mode))
185 return 1;
186
182 /* no restrictions if the parent directory is not encrypted */ 187 /* no restrictions if the parent directory is not encrypted */
183 if (!parent->i_sb->s_cop->is_encrypted(parent)) 188 if (!parent->i_sb->s_cop->is_encrypted(parent))
184 return 1; 189 return 1;
diff --git a/fs/dax.c b/fs/dax.c
index a8732fbed381..5c74f60d0a50 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -451,16 +451,37 @@ void dax_wake_mapping_entry_waiter(struct address_space *mapping,
451 __wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key); 451 __wake_up(wq, TASK_NORMAL, wake_all ? 0 : 1, &key);
452} 452}
453 453
454static int __dax_invalidate_mapping_entry(struct address_space *mapping,
455 pgoff_t index, bool trunc)
456{
457 int ret = 0;
458 void *entry;
459 struct radix_tree_root *page_tree = &mapping->page_tree;
460
461 spin_lock_irq(&mapping->tree_lock);
462 entry = get_unlocked_mapping_entry(mapping, index, NULL);
463 if (!entry || !radix_tree_exceptional_entry(entry))
464 goto out;
465 if (!trunc &&
466 (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
467 radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE)))
468 goto out;
469 radix_tree_delete(page_tree, index);
470 mapping->nrexceptional--;
471 ret = 1;
472out:
473 put_unlocked_mapping_entry(mapping, index, entry);
474 spin_unlock_irq(&mapping->tree_lock);
475 return ret;
476}
454/* 477/*
455 * Delete exceptional DAX entry at @index from @mapping. Wait for radix tree 478 * Delete exceptional DAX entry at @index from @mapping. Wait for radix tree
456 * entry to get unlocked before deleting it. 479 * entry to get unlocked before deleting it.
457 */ 480 */
458int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index) 481int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
459{ 482{
460 void *entry; 483 int ret = __dax_invalidate_mapping_entry(mapping, index, true);
461 484
462 spin_lock_irq(&mapping->tree_lock);
463 entry = get_unlocked_mapping_entry(mapping, index, NULL);
464 /* 485 /*
465 * This gets called from truncate / punch_hole path. As such, the caller 486 * This gets called from truncate / punch_hole path. As such, the caller
466 * must hold locks protecting against concurrent modifications of the 487 * must hold locks protecting against concurrent modifications of the
@@ -468,16 +489,46 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
468 * caller has seen exceptional entry for this index, we better find it 489 * caller has seen exceptional entry for this index, we better find it
469 * at that index as well... 490 * at that index as well...
470 */ 491 */
471 if (WARN_ON_ONCE(!entry || !radix_tree_exceptional_entry(entry))) { 492 WARN_ON_ONCE(!ret);
472 spin_unlock_irq(&mapping->tree_lock); 493 return ret;
473 return 0; 494}
474 } 495
475 radix_tree_delete(&mapping->page_tree, index); 496/*
497 * Invalidate exceptional DAX entry if easily possible. This handles DAX
498 * entries for invalidate_inode_pages() so we evict the entry only if we can
499 * do so without blocking.
500 */
501int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index)
502{
503 int ret = 0;
504 void *entry, **slot;
505 struct radix_tree_root *page_tree = &mapping->page_tree;
506
507 spin_lock_irq(&mapping->tree_lock);
508 entry = __radix_tree_lookup(page_tree, index, NULL, &slot);
509 if (!entry || !radix_tree_exceptional_entry(entry) ||
510 slot_locked(mapping, slot))
511 goto out;
512 if (radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_DIRTY) ||
513 radix_tree_tag_get(page_tree, index, PAGECACHE_TAG_TOWRITE))
514 goto out;
515 radix_tree_delete(page_tree, index);
476 mapping->nrexceptional--; 516 mapping->nrexceptional--;
517 ret = 1;
518out:
477 spin_unlock_irq(&mapping->tree_lock); 519 spin_unlock_irq(&mapping->tree_lock);
478 dax_wake_mapping_entry_waiter(mapping, index, entry, true); 520 if (ret)
521 dax_wake_mapping_entry_waiter(mapping, index, entry, true);
522 return ret;
523}
479 524
480 return 1; 525/*
526 * Invalidate exceptional DAX entry if it is clean.
527 */
528int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
529 pgoff_t index)
530{
531 return __dax_invalidate_mapping_entry(mapping, index, false);
481} 532}
482 533
483/* 534/*
@@ -488,15 +539,16 @@ int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index)
488 * otherwise it will simply fall out of the page cache under memory 539 * otherwise it will simply fall out of the page cache under memory
489 * pressure without ever having been dirtied. 540 * pressure without ever having been dirtied.
490 */ 541 */
491static int dax_load_hole(struct address_space *mapping, void *entry, 542static int dax_load_hole(struct address_space *mapping, void **entry,
492 struct vm_fault *vmf) 543 struct vm_fault *vmf)
493{ 544{
494 struct page *page; 545 struct page *page;
546 int ret;
495 547
496 /* Hole page already exists? Return it... */ 548 /* Hole page already exists? Return it... */
497 if (!radix_tree_exceptional_entry(entry)) { 549 if (!radix_tree_exceptional_entry(*entry)) {
498 vmf->page = entry; 550 page = *entry;
499 return VM_FAULT_LOCKED; 551 goto out;
500 } 552 }
501 553
502 /* This will replace locked radix tree entry with a hole page */ 554 /* This will replace locked radix tree entry with a hole page */
@@ -504,8 +556,17 @@ static int dax_load_hole(struct address_space *mapping, void *entry,
504 vmf->gfp_mask | __GFP_ZERO); 556 vmf->gfp_mask | __GFP_ZERO);
505 if (!page) 557 if (!page)
506 return VM_FAULT_OOM; 558 return VM_FAULT_OOM;
559 out:
507 vmf->page = page; 560 vmf->page = page;
508 return VM_FAULT_LOCKED; 561 ret = finish_fault(vmf);
562 vmf->page = NULL;
563 *entry = page;
564 if (!ret) {
565 /* Grab reference for PTE that is now referencing the page */
566 get_page(page);
567 return VM_FAULT_NOPAGE;
568 }
569 return ret;
509} 570}
510 571
511static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size, 572static int copy_user_dax(struct block_device *bdev, sector_t sector, size_t size,
@@ -934,6 +995,17 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
934 if (WARN_ON_ONCE(iomap->type != IOMAP_MAPPED)) 995 if (WARN_ON_ONCE(iomap->type != IOMAP_MAPPED))
935 return -EIO; 996 return -EIO;
936 997
998 /*
999 * Write can allocate block for an area which has a hole page mapped
1000 * into page tables. We have to tear down these mappings so that data
1001 * written by write(2) is visible in mmap.
1002 */
1003 if ((iomap->flags & IOMAP_F_NEW) && inode->i_mapping->nrpages) {
1004 invalidate_inode_pages2_range(inode->i_mapping,
1005 pos >> PAGE_SHIFT,
1006 (end - 1) >> PAGE_SHIFT);
1007 }
1008
937 while (pos < end) { 1009 while (pos < end) {
938 unsigned offset = pos & (PAGE_SIZE - 1); 1010 unsigned offset = pos & (PAGE_SIZE - 1);
939 struct blk_dax_ctl dax = { 0 }; 1011 struct blk_dax_ctl dax = { 0 };
@@ -992,23 +1064,6 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
992 if (iov_iter_rw(iter) == WRITE) 1064 if (iov_iter_rw(iter) == WRITE)
993 flags |= IOMAP_WRITE; 1065 flags |= IOMAP_WRITE;
994 1066
995 /*
996 * Yes, even DAX files can have page cache attached to them: A zeroed
997 * page is inserted into the pagecache when we have to serve a write
998 * fault on a hole. It should never be dirtied and can simply be
999 * dropped from the pagecache once we get real data for the page.
1000 *
1001 * XXX: This is racy against mmap, and there's nothing we can do about
1002 * it. We'll eventually need to shift this down even further so that
1003 * we can check if we allocated blocks over a hole first.
1004 */
1005 if (mapping->nrpages) {
1006 ret = invalidate_inode_pages2_range(mapping,
1007 pos >> PAGE_SHIFT,
1008 (pos + iov_iter_count(iter) - 1) >> PAGE_SHIFT);
1009 WARN_ON_ONCE(ret);
1010 }
1011
1012 while (iov_iter_count(iter)) { 1067 while (iov_iter_count(iter)) {
1013 ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops, 1068 ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops,
1014 iter, dax_iomap_actor); 1069 iter, dax_iomap_actor);
@@ -1023,6 +1078,15 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
1023} 1078}
1024EXPORT_SYMBOL_GPL(dax_iomap_rw); 1079EXPORT_SYMBOL_GPL(dax_iomap_rw);
1025 1080
1081static int dax_fault_return(int error)
1082{
1083 if (error == 0)
1084 return VM_FAULT_NOPAGE;
1085 if (error == -ENOMEM)
1086 return VM_FAULT_OOM;
1087 return VM_FAULT_SIGBUS;
1088}
1089
1026/** 1090/**
1027 * dax_iomap_fault - handle a page fault on a DAX file 1091 * dax_iomap_fault - handle a page fault on a DAX file
1028 * @vma: The virtual memory area where the fault occurred 1092 * @vma: The virtual memory area where the fault occurred
@@ -1055,12 +1119,6 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
1055 if (pos >= i_size_read(inode)) 1119 if (pos >= i_size_read(inode))
1056 return VM_FAULT_SIGBUS; 1120 return VM_FAULT_SIGBUS;
1057 1121
1058 entry = grab_mapping_entry(mapping, vmf->pgoff, 0);
1059 if (IS_ERR(entry)) {
1060 error = PTR_ERR(entry);
1061 goto out;
1062 }
1063
1064 if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page) 1122 if ((vmf->flags & FAULT_FLAG_WRITE) && !vmf->cow_page)
1065 flags |= IOMAP_WRITE; 1123 flags |= IOMAP_WRITE;
1066 1124
@@ -1071,9 +1129,15 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
1071 */ 1129 */
1072 error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap); 1130 error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap);
1073 if (error) 1131 if (error)
1074 goto unlock_entry; 1132 return dax_fault_return(error);
1075 if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) { 1133 if (WARN_ON_ONCE(iomap.offset + iomap.length < pos + PAGE_SIZE)) {
1076 error = -EIO; /* fs corruption? */ 1134 vmf_ret = dax_fault_return(-EIO); /* fs corruption? */
1135 goto finish_iomap;
1136 }
1137
1138 entry = grab_mapping_entry(mapping, vmf->pgoff, 0);
1139 if (IS_ERR(entry)) {
1140 vmf_ret = dax_fault_return(PTR_ERR(entry));
1077 goto finish_iomap; 1141 goto finish_iomap;
1078 } 1142 }
1079 1143
@@ -1096,13 +1160,13 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
1096 } 1160 }
1097 1161
1098 if (error) 1162 if (error)
1099 goto finish_iomap; 1163 goto error_unlock_entry;
1100 1164
1101 __SetPageUptodate(vmf->cow_page); 1165 __SetPageUptodate(vmf->cow_page);
1102 vmf_ret = finish_fault(vmf); 1166 vmf_ret = finish_fault(vmf);
1103 if (!vmf_ret) 1167 if (!vmf_ret)
1104 vmf_ret = VM_FAULT_DONE_COW; 1168 vmf_ret = VM_FAULT_DONE_COW;
1105 goto finish_iomap; 1169 goto unlock_entry;
1106 } 1170 }
1107 1171
1108 switch (iomap.type) { 1172 switch (iomap.type) {
@@ -1114,12 +1178,15 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
1114 } 1178 }
1115 error = dax_insert_mapping(mapping, iomap.bdev, sector, 1179 error = dax_insert_mapping(mapping, iomap.bdev, sector,
1116 PAGE_SIZE, &entry, vma, vmf); 1180 PAGE_SIZE, &entry, vma, vmf);
1181 /* -EBUSY is fine, somebody else faulted on the same PTE */
1182 if (error == -EBUSY)
1183 error = 0;
1117 break; 1184 break;
1118 case IOMAP_UNWRITTEN: 1185 case IOMAP_UNWRITTEN:
1119 case IOMAP_HOLE: 1186 case IOMAP_HOLE:
1120 if (!(vmf->flags & FAULT_FLAG_WRITE)) { 1187 if (!(vmf->flags & FAULT_FLAG_WRITE)) {
1121 vmf_ret = dax_load_hole(mapping, entry, vmf); 1188 vmf_ret = dax_load_hole(mapping, &entry, vmf);
1122 break; 1189 goto unlock_entry;
1123 } 1190 }
1124 /*FALLTHRU*/ 1191 /*FALLTHRU*/
1125 default: 1192 default:
@@ -1128,31 +1195,25 @@ int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
1128 break; 1195 break;
1129 } 1196 }
1130 1197
1198 error_unlock_entry:
1199 vmf_ret = dax_fault_return(error) | major;
1200 unlock_entry:
1201 put_locked_mapping_entry(mapping, vmf->pgoff, entry);
1131 finish_iomap: 1202 finish_iomap:
1132 if (ops->iomap_end) { 1203 if (ops->iomap_end) {
1133 if (error || (vmf_ret & VM_FAULT_ERROR)) { 1204 int copied = PAGE_SIZE;
1134 /* keep previous error */ 1205
1135 ops->iomap_end(inode, pos, PAGE_SIZE, 0, flags, 1206 if (vmf_ret & VM_FAULT_ERROR)
1136 &iomap); 1207 copied = 0;
1137 } else { 1208 /*
1138 error = ops->iomap_end(inode, pos, PAGE_SIZE, 1209 * The fault is done by now and there's no way back (other
1139 PAGE_SIZE, flags, &iomap); 1210 * thread may be already happily using PTE we have installed).
1140 } 1211 * Just ignore error from ->iomap_end since we cannot do much
1141 } 1212 * with it.
1142 unlock_entry: 1213 */
1143 if (vmf_ret != VM_FAULT_LOCKED || error) 1214 ops->iomap_end(inode, pos, PAGE_SIZE, copied, flags, &iomap);
1144 put_locked_mapping_entry(mapping, vmf->pgoff, entry);
1145 out:
1146 if (error == -ENOMEM)
1147 return VM_FAULT_OOM | major;
1148 /* -EBUSY is fine, somebody else faulted on the same PTE */
1149 if (error < 0 && error != -EBUSY)
1150 return VM_FAULT_SIGBUS | major;
1151 if (vmf_ret) {
1152 WARN_ON_ONCE(error); /* -EBUSY from ops->iomap_end? */
1153 return vmf_ret;
1154 } 1215 }
1155 return VM_FAULT_NOPAGE | major; 1216 return vmf_ret;
1156} 1217}
1157EXPORT_SYMBOL_GPL(dax_iomap_fault); 1218EXPORT_SYMBOL_GPL(dax_iomap_fault);
1158 1219
@@ -1277,16 +1338,6 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
1277 goto fallback; 1338 goto fallback;
1278 1339
1279 /* 1340 /*
1280 * grab_mapping_entry() will make sure we get a 2M empty entry, a DAX
1281 * PMD or a HZP entry. If it can't (because a 4k page is already in
1282 * the tree, for instance), it will return -EEXIST and we just fall
1283 * back to 4k entries.
1284 */
1285 entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD);
1286 if (IS_ERR(entry))
1287 goto fallback;
1288
1289 /*
1290 * Note that we don't use iomap_apply here. We aren't doing I/O, only 1341 * Note that we don't use iomap_apply here. We aren't doing I/O, only
1291 * setting up a mapping, so really we're using iomap_begin() as a way 1342 * setting up a mapping, so really we're using iomap_begin() as a way
1292 * to look up our filesystem block. 1343 * to look up our filesystem block.
@@ -1294,10 +1345,21 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
1294 pos = (loff_t)pgoff << PAGE_SHIFT; 1345 pos = (loff_t)pgoff << PAGE_SHIFT;
1295 error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap); 1346 error = ops->iomap_begin(inode, pos, PMD_SIZE, iomap_flags, &iomap);
1296 if (error) 1347 if (error)
1297 goto unlock_entry; 1348 goto fallback;
1349
1298 if (iomap.offset + iomap.length < pos + PMD_SIZE) 1350 if (iomap.offset + iomap.length < pos + PMD_SIZE)
1299 goto finish_iomap; 1351 goto finish_iomap;
1300 1352
1353 /*
1354 * grab_mapping_entry() will make sure we get a 2M empty entry, a DAX
1355 * PMD or a HZP entry. If it can't (because a 4k page is already in
1356 * the tree, for instance), it will return -EEXIST and we just fall
1357 * back to 4k entries.
1358 */
1359 entry = grab_mapping_entry(mapping, pgoff, RADIX_DAX_PMD);
1360 if (IS_ERR(entry))
1361 goto finish_iomap;
1362
1301 vmf.pgoff = pgoff; 1363 vmf.pgoff = pgoff;
1302 vmf.flags = flags; 1364 vmf.flags = flags;
1303 vmf.gfp_mask = mapping_gfp_mask(mapping) | __GFP_IO; 1365 vmf.gfp_mask = mapping_gfp_mask(mapping) | __GFP_IO;
@@ -1310,7 +1372,7 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
1310 case IOMAP_UNWRITTEN: 1372 case IOMAP_UNWRITTEN:
1311 case IOMAP_HOLE: 1373 case IOMAP_HOLE:
1312 if (WARN_ON_ONCE(write)) 1374 if (WARN_ON_ONCE(write))
1313 goto finish_iomap; 1375 goto unlock_entry;
1314 result = dax_pmd_load_hole(vma, pmd, &vmf, address, &iomap, 1376 result = dax_pmd_load_hole(vma, pmd, &vmf, address, &iomap,
1315 &entry); 1377 &entry);
1316 break; 1378 break;
@@ -1319,20 +1381,23 @@ int dax_iomap_pmd_fault(struct vm_area_struct *vma, unsigned long address,
1319 break; 1381 break;
1320 } 1382 }
1321 1383
1384 unlock_entry:
1385 put_locked_mapping_entry(mapping, pgoff, entry);
1322 finish_iomap: 1386 finish_iomap:
1323 if (ops->iomap_end) { 1387 if (ops->iomap_end) {
1324 if (result == VM_FAULT_FALLBACK) { 1388 int copied = PMD_SIZE;
1325 ops->iomap_end(inode, pos, PMD_SIZE, 0, iomap_flags, 1389
1326 &iomap); 1390 if (result == VM_FAULT_FALLBACK)
1327 } else { 1391 copied = 0;
1328 error = ops->iomap_end(inode, pos, PMD_SIZE, PMD_SIZE, 1392 /*
1329 iomap_flags, &iomap); 1393 * The fault is done by now and there's no way back (other
1330 if (error) 1394 * thread may be already happily using PMD we have installed).
1331 result = VM_FAULT_FALLBACK; 1395 * Just ignore error from ->iomap_end since we cannot do much
1332 } 1396 * with it.
1397 */
1398 ops->iomap_end(inode, pos, PMD_SIZE, copied, iomap_flags,
1399 &iomap);
1333 } 1400 }
1334 unlock_entry:
1335 put_locked_mapping_entry(mapping, pgoff, entry);
1336 fallback: 1401 fallback:
1337 if (result == VM_FAULT_FALLBACK) { 1402 if (result == VM_FAULT_FALLBACK) {
1338 split_huge_pmd(vma, pmd, address); 1403 split_huge_pmd(vma, pmd, address);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 0093ea2512a8..f073bfca694b 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -751,9 +751,8 @@ static int ext2_get_blocks(struct inode *inode,
751 mutex_unlock(&ei->truncate_mutex); 751 mutex_unlock(&ei->truncate_mutex);
752 goto cleanup; 752 goto cleanup;
753 } 753 }
754 } else {
755 *new = true;
756 } 754 }
755 *new = true;
757 756
758 ext2_splice_branch(inode, iblock, partial, indirect_blks, count); 757 ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
759 mutex_unlock(&ei->truncate_mutex); 758 mutex_unlock(&ei->truncate_mutex);
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index b5f184493c57..d663d3d7c81c 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -258,7 +258,6 @@ out:
258static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 258static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
259{ 259{
260 int result; 260 int result;
261 handle_t *handle = NULL;
262 struct inode *inode = file_inode(vma->vm_file); 261 struct inode *inode = file_inode(vma->vm_file);
263 struct super_block *sb = inode->i_sb; 262 struct super_block *sb = inode->i_sb;
264 bool write = vmf->flags & FAULT_FLAG_WRITE; 263 bool write = vmf->flags & FAULT_FLAG_WRITE;
@@ -266,24 +265,12 @@ static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
266 if (write) { 265 if (write) {
267 sb_start_pagefault(sb); 266 sb_start_pagefault(sb);
268 file_update_time(vma->vm_file); 267 file_update_time(vma->vm_file);
269 down_read(&EXT4_I(inode)->i_mmap_sem); 268 }
270 handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, 269 down_read(&EXT4_I(inode)->i_mmap_sem);
271 EXT4_DATA_TRANS_BLOCKS(sb)); 270 result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops);
272 } else 271 up_read(&EXT4_I(inode)->i_mmap_sem);
273 down_read(&EXT4_I(inode)->i_mmap_sem); 272 if (write)
274
275 if (IS_ERR(handle))
276 result = VM_FAULT_SIGBUS;
277 else
278 result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops);
279
280 if (write) {
281 if (!IS_ERR(handle))
282 ext4_journal_stop(handle);
283 up_read(&EXT4_I(inode)->i_mmap_sem);
284 sb_end_pagefault(sb); 273 sb_end_pagefault(sb);
285 } else
286 up_read(&EXT4_I(inode)->i_mmap_sem);
287 274
288 return result; 275 return result;
289} 276}
@@ -292,7 +279,6 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
292 pmd_t *pmd, unsigned int flags) 279 pmd_t *pmd, unsigned int flags)
293{ 280{
294 int result; 281 int result;
295 handle_t *handle = NULL;
296 struct inode *inode = file_inode(vma->vm_file); 282 struct inode *inode = file_inode(vma->vm_file);
297 struct super_block *sb = inode->i_sb; 283 struct super_block *sb = inode->i_sb;
298 bool write = flags & FAULT_FLAG_WRITE; 284 bool write = flags & FAULT_FLAG_WRITE;
@@ -300,27 +286,13 @@ static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
300 if (write) { 286 if (write) {
301 sb_start_pagefault(sb); 287 sb_start_pagefault(sb);
302 file_update_time(vma->vm_file); 288 file_update_time(vma->vm_file);
303 down_read(&EXT4_I(inode)->i_mmap_sem);
304 handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE,
305 ext4_chunk_trans_blocks(inode,
306 PMD_SIZE / PAGE_SIZE));
307 } else
308 down_read(&EXT4_I(inode)->i_mmap_sem);
309
310 if (IS_ERR(handle))
311 result = VM_FAULT_SIGBUS;
312 else {
313 result = dax_iomap_pmd_fault(vma, addr, pmd, flags,
314 &ext4_iomap_ops);
315 } 289 }
316 290 down_read(&EXT4_I(inode)->i_mmap_sem);
317 if (write) { 291 result = dax_iomap_pmd_fault(vma, addr, pmd, flags,
318 if (!IS_ERR(handle)) 292 &ext4_iomap_ops);
319 ext4_journal_stop(handle); 293 up_read(&EXT4_I(inode)->i_mmap_sem);
320 up_read(&EXT4_I(inode)->i_mmap_sem); 294 if (write)
321 sb_end_pagefault(sb); 295 sb_end_pagefault(sb);
322 } else
323 up_read(&EXT4_I(inode)->i_mmap_sem);
324 296
325 return result; 297 return result;
326} 298}
diff --git a/fs/xfs/libxfs/xfs_ag_resv.c b/fs/xfs/libxfs/xfs_ag_resv.c
index e5ebc3770460..d346d42c54d1 100644
--- a/fs/xfs/libxfs/xfs_ag_resv.c
+++ b/fs/xfs/libxfs/xfs_ag_resv.c
@@ -256,6 +256,9 @@ xfs_ag_resv_init(
256 goto out; 256 goto out;
257 } 257 }
258 258
259 ASSERT(xfs_perag_resv(pag, XFS_AG_RESV_METADATA)->ar_reserved +
260 xfs_perag_resv(pag, XFS_AG_RESV_AGFL)->ar_reserved <=
261 pag->pagf_freeblks + pag->pagf_flcount);
259out: 262out:
260 return error; 263 return error;
261} 264}
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.c b/fs/xfs/libxfs/xfs_refcount_btree.c
index 6fb2215f8ff7..50add5272807 100644
--- a/fs/xfs/libxfs/xfs_refcount_btree.c
+++ b/fs/xfs/libxfs/xfs_refcount_btree.c
@@ -409,13 +409,14 @@ xfs_refcountbt_calc_size(
409 */ 409 */
410xfs_extlen_t 410xfs_extlen_t
411xfs_refcountbt_max_size( 411xfs_refcountbt_max_size(
412 struct xfs_mount *mp) 412 struct xfs_mount *mp,
413 xfs_agblock_t agblocks)
413{ 414{
414 /* Bail out if we're uninitialized, which can happen in mkfs. */ 415 /* Bail out if we're uninitialized, which can happen in mkfs. */
415 if (mp->m_refc_mxr[0] == 0) 416 if (mp->m_refc_mxr[0] == 0)
416 return 0; 417 return 0;
417 418
418 return xfs_refcountbt_calc_size(mp, mp->m_sb.sb_agblocks); 419 return xfs_refcountbt_calc_size(mp, agblocks);
419} 420}
420 421
421/* 422/*
@@ -430,22 +431,24 @@ xfs_refcountbt_calc_reserves(
430{ 431{
431 struct xfs_buf *agbp; 432 struct xfs_buf *agbp;
432 struct xfs_agf *agf; 433 struct xfs_agf *agf;
434 xfs_agblock_t agblocks;
433 xfs_extlen_t tree_len; 435 xfs_extlen_t tree_len;
434 int error; 436 int error;
435 437
436 if (!xfs_sb_version_hasreflink(&mp->m_sb)) 438 if (!xfs_sb_version_hasreflink(&mp->m_sb))
437 return 0; 439 return 0;
438 440
439 *ask += xfs_refcountbt_max_size(mp);
440 441
441 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); 442 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
442 if (error) 443 if (error)
443 return error; 444 return error;
444 445
445 agf = XFS_BUF_TO_AGF(agbp); 446 agf = XFS_BUF_TO_AGF(agbp);
447 agblocks = be32_to_cpu(agf->agf_length);
446 tree_len = be32_to_cpu(agf->agf_refcount_blocks); 448 tree_len = be32_to_cpu(agf->agf_refcount_blocks);
447 xfs_buf_relse(agbp); 449 xfs_buf_relse(agbp);
448 450
451 *ask += xfs_refcountbt_max_size(mp, agblocks);
449 *used += tree_len; 452 *used += tree_len;
450 453
451 return error; 454 return error;
diff --git a/fs/xfs/libxfs/xfs_refcount_btree.h b/fs/xfs/libxfs/xfs_refcount_btree.h
index 3be7768bd51a..9db008b955b7 100644
--- a/fs/xfs/libxfs/xfs_refcount_btree.h
+++ b/fs/xfs/libxfs/xfs_refcount_btree.h
@@ -66,7 +66,8 @@ extern void xfs_refcountbt_compute_maxlevels(struct xfs_mount *mp);
66 66
67extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp, 67extern xfs_extlen_t xfs_refcountbt_calc_size(struct xfs_mount *mp,
68 unsigned long long len); 68 unsigned long long len);
69extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp); 69extern xfs_extlen_t xfs_refcountbt_max_size(struct xfs_mount *mp,
70 xfs_agblock_t agblocks);
70 71
71extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp, 72extern int xfs_refcountbt_calc_reserves(struct xfs_mount *mp,
72 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); 73 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
index de25771764ba..74e5a54bc428 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.c
+++ b/fs/xfs/libxfs/xfs_rmap_btree.c
@@ -550,13 +550,14 @@ xfs_rmapbt_calc_size(
550 */ 550 */
551xfs_extlen_t 551xfs_extlen_t
552xfs_rmapbt_max_size( 552xfs_rmapbt_max_size(
553 struct xfs_mount *mp) 553 struct xfs_mount *mp,
554 xfs_agblock_t agblocks)
554{ 555{
555 /* Bail out if we're uninitialized, which can happen in mkfs. */ 556 /* Bail out if we're uninitialized, which can happen in mkfs. */
556 if (mp->m_rmap_mxr[0] == 0) 557 if (mp->m_rmap_mxr[0] == 0)
557 return 0; 558 return 0;
558 559
559 return xfs_rmapbt_calc_size(mp, mp->m_sb.sb_agblocks); 560 return xfs_rmapbt_calc_size(mp, agblocks);
560} 561}
561 562
562/* 563/*
@@ -571,25 +572,24 @@ xfs_rmapbt_calc_reserves(
571{ 572{
572 struct xfs_buf *agbp; 573 struct xfs_buf *agbp;
573 struct xfs_agf *agf; 574 struct xfs_agf *agf;
574 xfs_extlen_t pool_len; 575 xfs_agblock_t agblocks;
575 xfs_extlen_t tree_len; 576 xfs_extlen_t tree_len;
576 int error; 577 int error;
577 578
578 if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) 579 if (!xfs_sb_version_hasrmapbt(&mp->m_sb))
579 return 0; 580 return 0;
580 581
581 /* Reserve 1% of the AG or enough for 1 block per record. */
582 pool_len = max(mp->m_sb.sb_agblocks / 100, xfs_rmapbt_max_size(mp));
583 *ask += pool_len;
584
585 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp); 582 error = xfs_alloc_read_agf(mp, NULL, agno, 0, &agbp);
586 if (error) 583 if (error)
587 return error; 584 return error;
588 585
589 agf = XFS_BUF_TO_AGF(agbp); 586 agf = XFS_BUF_TO_AGF(agbp);
587 agblocks = be32_to_cpu(agf->agf_length);
590 tree_len = be32_to_cpu(agf->agf_rmap_blocks); 588 tree_len = be32_to_cpu(agf->agf_rmap_blocks);
591 xfs_buf_relse(agbp); 589 xfs_buf_relse(agbp);
592 590
591 /* Reserve 1% of the AG or enough for 1 block per record. */
592 *ask += max(agblocks / 100, xfs_rmapbt_max_size(mp, agblocks));
593 *used += tree_len; 593 *used += tree_len;
594 594
595 return error; 595 return error;
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.h b/fs/xfs/libxfs/xfs_rmap_btree.h
index 2a9ac472fb15..19c08e933049 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.h
+++ b/fs/xfs/libxfs/xfs_rmap_btree.h
@@ -60,7 +60,8 @@ extern void xfs_rmapbt_compute_maxlevels(struct xfs_mount *mp);
60 60
61extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp, 61extern xfs_extlen_t xfs_rmapbt_calc_size(struct xfs_mount *mp,
62 unsigned long long len); 62 unsigned long long len);
63extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp); 63extern xfs_extlen_t xfs_rmapbt_max_size(struct xfs_mount *mp,
64 xfs_agblock_t agblocks);
64 65
65extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp, 66extern int xfs_rmapbt_calc_reserves(struct xfs_mount *mp,
66 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used); 67 xfs_agnumber_t agno, xfs_extlen_t *ask, xfs_extlen_t *used);
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 93d12fa2670d..242e8091296d 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -631,6 +631,20 @@ xfs_growfs_data_private(
631 xfs_set_low_space_thresholds(mp); 631 xfs_set_low_space_thresholds(mp);
632 mp->m_alloc_set_aside = xfs_alloc_set_aside(mp); 632 mp->m_alloc_set_aside = xfs_alloc_set_aside(mp);
633 633
634 /*
635 * If we expanded the last AG, free the per-AG reservation
636 * so we can reinitialize it with the new size.
637 */
638 if (new) {
639 struct xfs_perag *pag;
640
641 pag = xfs_perag_get(mp, agno);
642 error = xfs_ag_resv_free(pag);
643 xfs_perag_put(pag);
644 if (error)
645 goto out;
646 }
647
634 /* Reserve AG metadata blocks. */ 648 /* Reserve AG metadata blocks. */
635 error = xfs_fs_reserve_ag_blocks(mp); 649 error = xfs_fs_reserve_ag_blocks(mp);
636 if (error && error != -ENOSPC) 650 if (error && error != -ENOSPC)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index ff4d6311c7f4..70ca4f608321 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1597,7 +1597,8 @@ xfs_inode_free_cowblocks(
1597 * If the mapping is dirty or under writeback we cannot touch the 1597 * If the mapping is dirty or under writeback we cannot touch the
1598 * CoW fork. Leave it alone if we're in the midst of a directio. 1598 * CoW fork. Leave it alone if we're in the midst of a directio.
1599 */ 1599 */
1600 if (mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) || 1600 if ((VFS_I(ip)->i_state & I_DIRTY_PAGES) ||
1601 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) ||
1601 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) || 1602 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) ||
1602 atomic_read(&VFS_I(ip)->i_dio_count)) 1603 atomic_read(&VFS_I(ip)->i_dio_count))
1603 return 0; 1604 return 0;
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index fe86a668a57e..6e4c7446c3d4 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -526,13 +526,14 @@ xfs_cui_recover(
526 xfs_refcount_finish_one_cleanup(tp, rcur, error); 526 xfs_refcount_finish_one_cleanup(tp, rcur, error);
527 error = xfs_defer_finish(&tp, &dfops, NULL); 527 error = xfs_defer_finish(&tp, &dfops, NULL);
528 if (error) 528 if (error)
529 goto abort_error; 529 goto abort_defer;
530 set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags); 530 set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
531 error = xfs_trans_commit(tp); 531 error = xfs_trans_commit(tp);
532 return error; 532 return error;
533 533
534abort_error: 534abort_error:
535 xfs_refcount_finish_one_cleanup(tp, rcur, error); 535 xfs_refcount_finish_one_cleanup(tp, rcur, error);
536abort_defer:
536 xfs_defer_cancel(&dfops); 537 xfs_defer_cancel(&dfops);
537 xfs_trans_cancel(tp); 538 xfs_trans_cancel(tp);
538 return error; 539 return error;
diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
index 276d3023d60f..de6195e38910 100644
--- a/fs/xfs/xfs_sysfs.c
+++ b/fs/xfs/xfs_sysfs.c
@@ -396,7 +396,7 @@ max_retries_show(
396 int retries; 396 int retries;
397 struct xfs_error_cfg *cfg = to_error_cfg(kobject); 397 struct xfs_error_cfg *cfg = to_error_cfg(kobject);
398 398
399 if (cfg->retry_timeout == XFS_ERR_RETRY_FOREVER) 399 if (cfg->max_retries == XFS_ERR_RETRY_FOREVER)
400 retries = -1; 400 retries = -1;
401 else 401 else
402 retries = cfg->max_retries; 402 retries = cfg->max_retries;
@@ -422,7 +422,7 @@ max_retries_store(
422 return -EINVAL; 422 return -EINVAL;
423 423
424 if (val == -1) 424 if (val == -1)
425 cfg->retry_timeout = XFS_ERR_RETRY_FOREVER; 425 cfg->max_retries = XFS_ERR_RETRY_FOREVER;
426 else 426 else
427 cfg->max_retries = val; 427 cfg->max_retries = val;
428 return count; 428 return count;
diff --git a/include/dt-bindings/mfd/tps65217.h b/include/dt-bindings/mfd/tps65217.h
deleted file mode 100644
index cafb9e60cf12..000000000000
--- a/include/dt-bindings/mfd/tps65217.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * This header provides macros for TI TPS65217 DT bindings.
3 *
4 * Copyright (C) 2016 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __DT_BINDINGS_TPS65217_H__
20#define __DT_BINDINGS_TPS65217_H__
21
22#define TPS65217_IRQ_USB 0
23#define TPS65217_IRQ_AC 1
24#define TPS65217_IRQ_PB 2
25
26#endif
diff --git a/include/linux/dax.h b/include/linux/dax.h
index f97bcfe79472..24ad71173995 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -41,6 +41,9 @@ ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
41int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf, 41int dax_iomap_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
42 struct iomap_ops *ops); 42 struct iomap_ops *ops);
43int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index); 43int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
44int dax_invalidate_mapping_entry(struct address_space *mapping, pgoff_t index);
45int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
46 pgoff_t index);
44void dax_wake_mapping_entry_waiter(struct address_space *mapping, 47void dax_wake_mapping_entry_waiter(struct address_space *mapping,
45 pgoff_t index, void *entry, bool wake_all); 48 pgoff_t index, void *entry, bool wake_all);
46 49
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 702314253797..a0934e6c9bab 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -610,7 +610,6 @@ bool bpf_helper_changes_pkt_data(void *func);
610struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, 610struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off,
611 const struct bpf_insn *patch, u32 len); 611 const struct bpf_insn *patch, u32 len);
612void bpf_warn_invalid_xdp_action(u32 act); 612void bpf_warn_invalid_xdp_action(u32 act);
613void bpf_warn_invalid_xdp_buffer(void);
614 613
615#ifdef CONFIG_BPF_JIT 614#ifdef CONFIG_BPF_JIT
616extern int bpf_jit_enable; 615extern int bpf_jit_enable;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e0341af6950e..76f39754e7b0 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -146,15 +146,6 @@ enum {
146 DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */ 146 DISK_EVENT_EJECT_REQUEST = 1 << 1, /* eject requested */
147}; 147};
148 148
149#define BLK_SCSI_MAX_CMDS (256)
150#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
151
152struct blk_scsi_cmd_filter {
153 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
154 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
155 struct kobject kobj;
156};
157
158struct disk_part_tbl { 149struct disk_part_tbl {
159 struct rcu_head rcu_head; 150 struct rcu_head rcu_head;
160 int len; 151 int len;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 93bdb3485192..6533c16e27ad 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -1384,6 +1384,8 @@ int set_phv_bit(struct mlx4_dev *dev, u8 port, int new_val);
1384int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv); 1384int get_phv_bit(struct mlx4_dev *dev, u8 port, int *phv);
1385int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port, 1385int mlx4_get_is_vlan_offload_disabled(struct mlx4_dev *dev, u8 port,
1386 bool *vlan_offload_disabled); 1386 bool *vlan_offload_disabled);
1387void mlx4_handle_eth_header_mcast_prio(struct mlx4_net_trans_rule_hw_ctrl *ctrl,
1388 struct _rule_hw *eth_header);
1387int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1389int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1388int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1390int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1389int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1391int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 9f489365b3d3..52b437431c6a 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1071,11 +1071,6 @@ enum {
1071 MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20, 1071 MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20,
1072}; 1072};
1073 1073
1074enum {
1075 MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP = 0x0,
1076 MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2,
1077};
1078
1079static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz) 1074static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
1080{ 1075{
1081 if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE) 1076 if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 0ae55361e674..735b36335f29 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -123,7 +123,6 @@ enum {
123 MLX5_REG_HOST_ENDIANNESS = 0x7004, 123 MLX5_REG_HOST_ENDIANNESS = 0x7004,
124 MLX5_REG_MCIA = 0x9014, 124 MLX5_REG_MCIA = 0x9014,
125 MLX5_REG_MLCR = 0x902b, 125 MLX5_REG_MLCR = 0x902b,
126 MLX5_REG_MPCNT = 0x9051,
127}; 126};
128 127
129enum mlx5_dcbx_oper_mode { 128enum mlx5_dcbx_oper_mode {
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 57bec544e20a..a852e9db6f0d 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -1757,80 +1757,6 @@ struct mlx5_ifc_eth_802_3_cntrs_grp_data_layout_bits {
1757 u8 reserved_at_4c0[0x300]; 1757 u8 reserved_at_4c0[0x300];
1758}; 1758};
1759 1759
1760struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits {
1761 u8 life_time_counter_high[0x20];
1762
1763 u8 life_time_counter_low[0x20];
1764
1765 u8 rx_errors[0x20];
1766
1767 u8 tx_errors[0x20];
1768
1769 u8 l0_to_recovery_eieos[0x20];
1770
1771 u8 l0_to_recovery_ts[0x20];
1772
1773 u8 l0_to_recovery_framing[0x20];
1774
1775 u8 l0_to_recovery_retrain[0x20];
1776
1777 u8 crc_error_dllp[0x20];
1778
1779 u8 crc_error_tlp[0x20];
1780
1781 u8 reserved_at_140[0x680];
1782};
1783
1784struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits {
1785 u8 life_time_counter_high[0x20];
1786
1787 u8 life_time_counter_low[0x20];
1788
1789 u8 time_to_boot_image_start[0x20];
1790
1791 u8 time_to_link_image[0x20];
1792
1793 u8 calibration_time[0x20];
1794
1795 u8 time_to_first_perst[0x20];
1796
1797 u8 time_to_detect_state[0x20];
1798
1799 u8 time_to_l0[0x20];
1800
1801 u8 time_to_crs_en[0x20];
1802
1803 u8 time_to_plastic_image_start[0x20];
1804
1805 u8 time_to_iron_image_start[0x20];
1806
1807 u8 perst_handler[0x20];
1808
1809 u8 times_in_l1[0x20];
1810
1811 u8 times_in_l23[0x20];
1812
1813 u8 dl_down[0x20];
1814
1815 u8 config_cycle1usec[0x20];
1816
1817 u8 config_cycle2to7usec[0x20];
1818
1819 u8 config_cycle_8to15usec[0x20];
1820
1821 u8 config_cycle_16_to_63usec[0x20];
1822
1823 u8 config_cycle_64usec[0x20];
1824
1825 u8 correctable_err_msg_sent[0x20];
1826
1827 u8 non_fatal_err_msg_sent[0x20];
1828
1829 u8 fatal_err_msg_sent[0x20];
1830
1831 u8 reserved_at_2e0[0x4e0];
1832};
1833
1834struct mlx5_ifc_cmd_inter_comp_event_bits { 1760struct mlx5_ifc_cmd_inter_comp_event_bits {
1835 u8 command_completion_vector[0x20]; 1761 u8 command_completion_vector[0x20];
1836 1762
@@ -2995,12 +2921,6 @@ union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits {
2995 u8 reserved_at_0[0x7c0]; 2921 u8 reserved_at_0[0x7c0];
2996}; 2922};
2997 2923
2998union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits {
2999 struct mlx5_ifc_pcie_perf_cntrs_grp_data_layout_bits pcie_perf_cntrs_grp_data_layout;
3000 struct mlx5_ifc_pcie_tas_cntrs_grp_data_layout_bits pcie_tas_cntrs_grp_data_layout;
3001 u8 reserved_at_0[0x7c0];
3002};
3003
3004union mlx5_ifc_event_auto_bits { 2924union mlx5_ifc_event_auto_bits {
3005 struct mlx5_ifc_comp_event_bits comp_event; 2925 struct mlx5_ifc_comp_event_bits comp_event;
3006 struct mlx5_ifc_dct_events_bits dct_events; 2926 struct mlx5_ifc_dct_events_bits dct_events;
@@ -7320,18 +7240,6 @@ struct mlx5_ifc_ppcnt_reg_bits {
7320 union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set; 7240 union mlx5_ifc_eth_cntrs_grp_data_layout_auto_bits counter_set;
7321}; 7241};
7322 7242
7323struct mlx5_ifc_mpcnt_reg_bits {
7324 u8 reserved_at_0[0x8];
7325 u8 pcie_index[0x8];
7326 u8 reserved_at_10[0xa];
7327 u8 grp[0x6];
7328
7329 u8 clr[0x1];
7330 u8 reserved_at_21[0x1f];
7331
7332 union mlx5_ifc_pcie_cntrs_grp_data_layout_auto_bits counter_set;
7333};
7334
7335struct mlx5_ifc_ppad_reg_bits { 7243struct mlx5_ifc_ppad_reg_bits {
7336 u8 reserved_at_0[0x3]; 7244 u8 reserved_at_0[0x3];
7337 u8 single_mac[0x1]; 7245 u8 single_mac[0x1];
@@ -7937,7 +7845,6 @@ union mlx5_ifc_ports_control_registers_document_bits {
7937 struct mlx5_ifc_pmtu_reg_bits pmtu_reg; 7845 struct mlx5_ifc_pmtu_reg_bits pmtu_reg;
7938 struct mlx5_ifc_ppad_reg_bits ppad_reg; 7846 struct mlx5_ifc_ppad_reg_bits ppad_reg;
7939 struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg; 7847 struct mlx5_ifc_ppcnt_reg_bits ppcnt_reg;
7940 struct mlx5_ifc_mpcnt_reg_bits mpcnt_reg;
7941 struct mlx5_ifc_pplm_reg_bits pplm_reg; 7848 struct mlx5_ifc_pplm_reg_bits pplm_reg;
7942 struct mlx5_ifc_pplr_reg_bits pplr_reg; 7849 struct mlx5_ifc_pplr_reg_bits pplr_reg;
7943 struct mlx5_ifc_ppsc_reg_bits ppsc_reg; 7850 struct mlx5_ifc_ppsc_reg_bits ppsc_reg;
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index c56b39890a41..6b5818d6de32 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -73,13 +73,13 @@
73 */ 73 */
74enum pageflags { 74enum pageflags {
75 PG_locked, /* Page is locked. Don't touch. */ 75 PG_locked, /* Page is locked. Don't touch. */
76 PG_waiters, /* Page has waiters, check its waitqueue */
77 PG_error, 76 PG_error,
78 PG_referenced, 77 PG_referenced,
79 PG_uptodate, 78 PG_uptodate,
80 PG_dirty, 79 PG_dirty,
81 PG_lru, 80 PG_lru,
82 PG_active, 81 PG_active,
82 PG_waiters, /* Page has waiters, check its waitqueue. Must be bit #7 and in the same byte as "PG_locked" */
83 PG_slab, 83 PG_slab,
84 PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/ 84 PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/
85 PG_arch_1, 85 PG_arch_1,
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index f0cf5a1b777e..0378e88f6fd3 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -110,6 +110,7 @@ struct netns_ipv4 {
110 int sysctl_tcp_orphan_retries; 110 int sysctl_tcp_orphan_retries;
111 int sysctl_tcp_fin_timeout; 111 int sysctl_tcp_fin_timeout;
112 unsigned int sysctl_tcp_notsent_lowat; 112 unsigned int sysctl_tcp_notsent_lowat;
113 int sysctl_tcp_tw_reuse;
113 114
114 int sysctl_igmp_max_memberships; 115 int sysctl_igmp_max_memberships;
115 int sysctl_igmp_max_msf; 116 int sysctl_igmp_max_msf;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 207147b4c6b2..6061963cca98 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -252,7 +252,6 @@ extern int sysctl_tcp_wmem[3];
252extern int sysctl_tcp_rmem[3]; 252extern int sysctl_tcp_rmem[3];
253extern int sysctl_tcp_app_win; 253extern int sysctl_tcp_app_win;
254extern int sysctl_tcp_adv_win_scale; 254extern int sysctl_tcp_adv_win_scale;
255extern int sysctl_tcp_tw_reuse;
256extern int sysctl_tcp_frto; 255extern int sysctl_tcp_frto;
257extern int sysctl_tcp_low_latency; 256extern int sysctl_tcp_low_latency;
258extern int sysctl_tcp_nometrics_save; 257extern int sysctl_tcp_nometrics_save;
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 042fd7e8e030..f75c4d031eeb 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -1471,6 +1471,7 @@ int __cpuhp_setup_state(enum cpuhp_state state,
1471 bool multi_instance) 1471 bool multi_instance)
1472{ 1472{
1473 int cpu, ret = 0; 1473 int cpu, ret = 0;
1474 bool dynstate;
1474 1475
1475 if (cpuhp_cb_check(state) || !name) 1476 if (cpuhp_cb_check(state) || !name)
1476 return -EINVAL; 1477 return -EINVAL;
@@ -1480,6 +1481,12 @@ int __cpuhp_setup_state(enum cpuhp_state state,
1480 ret = cpuhp_store_callbacks(state, name, startup, teardown, 1481 ret = cpuhp_store_callbacks(state, name, startup, teardown,
1481 multi_instance); 1482 multi_instance);
1482 1483
1484 dynstate = state == CPUHP_AP_ONLINE_DYN;
1485 if (ret > 0 && dynstate) {
1486 state = ret;
1487 ret = 0;
1488 }
1489
1483 if (ret || !invoke || !startup) 1490 if (ret || !invoke || !startup)
1484 goto out; 1491 goto out;
1485 1492
@@ -1508,7 +1515,7 @@ out:
1508 * If the requested state is CPUHP_AP_ONLINE_DYN, return the 1515 * If the requested state is CPUHP_AP_ONLINE_DYN, return the
1509 * dynamically allocated state in case of success. 1516 * dynamically allocated state in case of success.
1510 */ 1517 */
1511 if (!ret && state == CPUHP_AP_ONLINE_DYN) 1518 if (!ret && dynstate)
1512 return state; 1519 return state;
1513 return ret; 1520 return ret;
1514} 1521}
diff --git a/mm/filemap.c b/mm/filemap.c
index 82f26cde830c..d0e4d1002059 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -912,6 +912,29 @@ void add_page_wait_queue(struct page *page, wait_queue_t *waiter)
912} 912}
913EXPORT_SYMBOL_GPL(add_page_wait_queue); 913EXPORT_SYMBOL_GPL(add_page_wait_queue);
914 914
915#ifndef clear_bit_unlock_is_negative_byte
916
917/*
918 * PG_waiters is the high bit in the same byte as PG_lock.
919 *
920 * On x86 (and on many other architectures), we can clear PG_lock and
921 * test the sign bit at the same time. But if the architecture does
922 * not support that special operation, we just do this all by hand
923 * instead.
924 *
925 * The read of PG_waiters has to be after (or concurrently with) PG_locked
926 * being cleared, but a memory barrier should be unneccssary since it is
927 * in the same byte as PG_locked.
928 */
929static inline bool clear_bit_unlock_is_negative_byte(long nr, volatile void *mem)
930{
931 clear_bit_unlock(nr, mem);
932 /* smp_mb__after_atomic(); */
933 return test_bit(PG_waiters, mem);
934}
935
936#endif
937
915/** 938/**
916 * unlock_page - unlock a locked page 939 * unlock_page - unlock a locked page
917 * @page: the page 940 * @page: the page
@@ -921,16 +944,19 @@ EXPORT_SYMBOL_GPL(add_page_wait_queue);
921 * mechanism between PageLocked pages and PageWriteback pages is shared. 944 * mechanism between PageLocked pages and PageWriteback pages is shared.
922 * But that's OK - sleepers in wait_on_page_writeback() just go back to sleep. 945 * But that's OK - sleepers in wait_on_page_writeback() just go back to sleep.
923 * 946 *
924 * The mb is necessary to enforce ordering between the clear_bit and the read 947 * Note that this depends on PG_waiters being the sign bit in the byte
925 * of the waitqueue (to avoid SMP races with a parallel wait_on_page_locked()). 948 * that contains PG_locked - thus the BUILD_BUG_ON(). That allows us to
949 * clear the PG_locked bit and test PG_waiters at the same time fairly
950 * portably (architectures that do LL/SC can test any bit, while x86 can
951 * test the sign bit).
926 */ 952 */
927void unlock_page(struct page *page) 953void unlock_page(struct page *page)
928{ 954{
955 BUILD_BUG_ON(PG_waiters != 7);
929 page = compound_head(page); 956 page = compound_head(page);
930 VM_BUG_ON_PAGE(!PageLocked(page), page); 957 VM_BUG_ON_PAGE(!PageLocked(page), page);
931 clear_bit_unlock(PG_locked, &page->flags); 958 if (clear_bit_unlock_is_negative_byte(PG_locked, &page->flags))
932 smp_mb__after_atomic(); 959 wake_up_page_bit(page, PG_locked);
933 wake_up_page(page, PG_locked);
934} 960}
935EXPORT_SYMBOL(unlock_page); 961EXPORT_SYMBOL(unlock_page);
936 962
diff --git a/mm/truncate.c b/mm/truncate.c
index fd97f1dbce29..dd7b24e083c5 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -24,20 +24,12 @@
24#include <linux/rmap.h> 24#include <linux/rmap.h>
25#include "internal.h" 25#include "internal.h"
26 26
27static void clear_exceptional_entry(struct address_space *mapping, 27static void clear_shadow_entry(struct address_space *mapping, pgoff_t index,
28 pgoff_t index, void *entry) 28 void *entry)
29{ 29{
30 struct radix_tree_node *node; 30 struct radix_tree_node *node;
31 void **slot; 31 void **slot;
32 32
33 /* Handled by shmem itself */
34 if (shmem_mapping(mapping))
35 return;
36
37 if (dax_mapping(mapping)) {
38 dax_delete_mapping_entry(mapping, index);
39 return;
40 }
41 spin_lock_irq(&mapping->tree_lock); 33 spin_lock_irq(&mapping->tree_lock);
42 /* 34 /*
43 * Regular page slots are stabilized by the page lock even 35 * Regular page slots are stabilized by the page lock even
@@ -55,6 +47,56 @@ unlock:
55 spin_unlock_irq(&mapping->tree_lock); 47 spin_unlock_irq(&mapping->tree_lock);
56} 48}
57 49
50/*
51 * Unconditionally remove exceptional entry. Usually called from truncate path.
52 */
53static void truncate_exceptional_entry(struct address_space *mapping,
54 pgoff_t index, void *entry)
55{
56 /* Handled by shmem itself */
57 if (shmem_mapping(mapping))
58 return;
59
60 if (dax_mapping(mapping)) {
61 dax_delete_mapping_entry(mapping, index);
62 return;
63 }
64 clear_shadow_entry(mapping, index, entry);
65}
66
67/*
68 * Invalidate exceptional entry if easily possible. This handles exceptional
69 * entries for invalidate_inode_pages() so for DAX it evicts only unlocked and
70 * clean entries.
71 */
72static int invalidate_exceptional_entry(struct address_space *mapping,
73 pgoff_t index, void *entry)
74{
75 /* Handled by shmem itself */
76 if (shmem_mapping(mapping))
77 return 1;
78 if (dax_mapping(mapping))
79 return dax_invalidate_mapping_entry(mapping, index);
80 clear_shadow_entry(mapping, index, entry);
81 return 1;
82}
83
84/*
85 * Invalidate exceptional entry if clean. This handles exceptional entries for
86 * invalidate_inode_pages2() so for DAX it evicts only clean entries.
87 */
88static int invalidate_exceptional_entry2(struct address_space *mapping,
89 pgoff_t index, void *entry)
90{
91 /* Handled by shmem itself */
92 if (shmem_mapping(mapping))
93 return 1;
94 if (dax_mapping(mapping))
95 return dax_invalidate_mapping_entry_sync(mapping, index);
96 clear_shadow_entry(mapping, index, entry);
97 return 1;
98}
99
58/** 100/**
59 * do_invalidatepage - invalidate part or all of a page 101 * do_invalidatepage - invalidate part or all of a page
60 * @page: the page which is affected 102 * @page: the page which is affected
@@ -262,7 +304,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
262 break; 304 break;
263 305
264 if (radix_tree_exceptional_entry(page)) { 306 if (radix_tree_exceptional_entry(page)) {
265 clear_exceptional_entry(mapping, index, page); 307 truncate_exceptional_entry(mapping, index,
308 page);
266 continue; 309 continue;
267 } 310 }
268 311
@@ -351,7 +394,8 @@ void truncate_inode_pages_range(struct address_space *mapping,
351 } 394 }
352 395
353 if (radix_tree_exceptional_entry(page)) { 396 if (radix_tree_exceptional_entry(page)) {
354 clear_exceptional_entry(mapping, index, page); 397 truncate_exceptional_entry(mapping, index,
398 page);
355 continue; 399 continue;
356 } 400 }
357 401
@@ -470,7 +514,8 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping,
470 break; 514 break;
471 515
472 if (radix_tree_exceptional_entry(page)) { 516 if (radix_tree_exceptional_entry(page)) {
473 clear_exceptional_entry(mapping, index, page); 517 invalidate_exceptional_entry(mapping, index,
518 page);
474 continue; 519 continue;
475 } 520 }
476 521
@@ -592,7 +637,9 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
592 break; 637 break;
593 638
594 if (radix_tree_exceptional_entry(page)) { 639 if (radix_tree_exceptional_entry(page)) {
595 clear_exceptional_entry(mapping, index, page); 640 if (!invalidate_exceptional_entry2(mapping,
641 index, page))
642 ret = -EBUSY;
596 continue; 643 continue;
597 } 644 }
598 645
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 019557d0a11d..09cfe87f0a44 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1059,7 +1059,9 @@ static void __exit lane_module_cleanup(void)
1059{ 1059{
1060 int i; 1060 int i;
1061 1061
1062#ifdef CONFIG_PROC_FS
1062 remove_proc_entry("lec", atm_proc_root); 1063 remove_proc_entry("lec", atm_proc_root);
1064#endif
1063 1065
1064 deregister_atm_ioctl(&lane_ioctl_ops); 1066 deregister_atm_ioctl(&lane_ioctl_ops);
1065 1067
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 8e0c0635ee97..fb55327dcfea 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -75,6 +75,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
75 struct nlattr *nla; 75 struct nlattr *nla;
76 struct sk_buff *skb; 76 struct sk_buff *skb;
77 unsigned long flags; 77 unsigned long flags;
78 void *msg_header;
78 79
79 al = sizeof(struct net_dm_alert_msg); 80 al = sizeof(struct net_dm_alert_msg);
80 al += dm_hit_limit * sizeof(struct net_dm_drop_point); 81 al += dm_hit_limit * sizeof(struct net_dm_drop_point);
@@ -82,21 +83,41 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data)
82 83
83 skb = genlmsg_new(al, GFP_KERNEL); 84 skb = genlmsg_new(al, GFP_KERNEL);
84 85
85 if (skb) { 86 if (!skb)
86 genlmsg_put(skb, 0, 0, &net_drop_monitor_family, 87 goto err;
87 0, NET_DM_CMD_ALERT); 88
88 nla = nla_reserve(skb, NLA_UNSPEC, 89 msg_header = genlmsg_put(skb, 0, 0, &net_drop_monitor_family,
89 sizeof(struct net_dm_alert_msg)); 90 0, NET_DM_CMD_ALERT);
90 msg = nla_data(nla); 91 if (!msg_header) {
91 memset(msg, 0, al); 92 nlmsg_free(skb);
92 } else { 93 skb = NULL;
93 mod_timer(&data->send_timer, jiffies + HZ / 10); 94 goto err;
95 }
96 nla = nla_reserve(skb, NLA_UNSPEC,
97 sizeof(struct net_dm_alert_msg));
98 if (!nla) {
99 nlmsg_free(skb);
100 skb = NULL;
101 goto err;
94 } 102 }
103 msg = nla_data(nla);
104 memset(msg, 0, al);
105 goto out;
95 106
107err:
108 mod_timer(&data->send_timer, jiffies + HZ / 10);
109out:
96 spin_lock_irqsave(&data->lock, flags); 110 spin_lock_irqsave(&data->lock, flags);
97 swap(data->skb, skb); 111 swap(data->skb, skb);
98 spin_unlock_irqrestore(&data->lock, flags); 112 spin_unlock_irqrestore(&data->lock, flags);
99 113
114 if (skb) {
115 struct nlmsghdr *nlh = (struct nlmsghdr *)skb->data;
116 struct genlmsghdr *gnlh = (struct genlmsghdr *)nlmsg_data(nlh);
117
118 genlmsg_end(skb, genlmsg_data(gnlh));
119 }
120
100 return skb; 121 return skb;
101} 122}
102 123
diff --git a/net/core/filter.c b/net/core/filter.c
index e6c412b94dec..1969b3f118c1 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2972,12 +2972,6 @@ void bpf_warn_invalid_xdp_action(u32 act)
2972} 2972}
2973EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action); 2973EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
2974 2974
2975void bpf_warn_invalid_xdp_buffer(void)
2976{
2977 WARN_ONCE(1, "Illegal XDP buffer encountered, expect throughput degradation\n");
2978}
2979EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_buffer);
2980
2981static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg, 2975static u32 sk_filter_convert_ctx_access(enum bpf_access_type type, int dst_reg,
2982 int src_reg, int ctx_off, 2976 int src_reg, int ctx_off,
2983 struct bpf_insn *insn_buf, 2977 struct bpf_insn *insn_buf,
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index d6447dc10371..fe4e1531976c 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -468,8 +468,9 @@ ip_proto_again:
468 if (hdr->flags & GRE_ACK) 468 if (hdr->flags & GRE_ACK)
469 offset += sizeof(((struct pptp_gre_header *)0)->ack); 469 offset += sizeof(((struct pptp_gre_header *)0)->ack);
470 470
471 ppp_hdr = skb_header_pointer(skb, nhoff + offset, 471 ppp_hdr = __skb_header_pointer(skb, nhoff + offset,
472 sizeof(_ppp_hdr), _ppp_hdr); 472 sizeof(_ppp_hdr),
473 data, hlen, _ppp_hdr);
473 if (!ppp_hdr) 474 if (!ppp_hdr)
474 goto out_bad; 475 goto out_bad;
475 476
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 18b5aae99bec..75e3ea7bda08 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3898,6 +3898,9 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)
3898 u32 filter_mask; 3898 u32 filter_mask;
3899 int err; 3899 int err;
3900 3900
3901 if (nlmsg_len(nlh) < sizeof(*ifsm))
3902 return -EINVAL;
3903
3901 ifsm = nlmsg_data(nlh); 3904 ifsm = nlmsg_data(nlh);
3902 if (ifsm->ifindex > 0) 3905 if (ifsm->ifindex > 0)
3903 dev = __dev_get_by_index(net, ifsm->ifindex); 3906 dev = __dev_get_by_index(net, ifsm->ifindex);
@@ -3947,6 +3950,9 @@ static int rtnl_stats_dump(struct sk_buff *skb, struct netlink_callback *cb)
3947 3950
3948 cb->seq = net->dev_base_seq; 3951 cb->seq = net->dev_base_seq;
3949 3952
3953 if (nlmsg_len(cb->nlh) < sizeof(*ifsm))
3954 return -EINVAL;
3955
3950 ifsm = nlmsg_data(cb->nlh); 3956 ifsm = nlmsg_data(cb->nlh);
3951 filter_mask = ifsm->filter_mask; 3957 filter_mask = ifsm->filter_mask;
3952 if (!filter_mask) 3958 if (!filter_mask)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 3ff8938893ec..eae0332b0e8c 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -85,7 +85,7 @@ struct fib_table *fib_new_table(struct net *net, u32 id)
85 if (tb) 85 if (tb)
86 return tb; 86 return tb;
87 87
88 if (id == RT_TABLE_LOCAL) 88 if (id == RT_TABLE_LOCAL && !net->ipv4.fib_has_custom_rules)
89 alias = fib_new_table(net, RT_TABLE_MAIN); 89 alias = fib_new_table(net, RT_TABLE_MAIN);
90 90
91 tb = fib_trie_table(id, alias); 91 tb = fib_trie_table(id, alias);
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 68d622133f53..5b15459955f8 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -219,9 +219,14 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay)
219static void igmp_gq_start_timer(struct in_device *in_dev) 219static void igmp_gq_start_timer(struct in_device *in_dev)
220{ 220{
221 int tv = prandom_u32() % in_dev->mr_maxdelay; 221 int tv = prandom_u32() % in_dev->mr_maxdelay;
222 unsigned long exp = jiffies + tv + 2;
223
224 if (in_dev->mr_gq_running &&
225 time_after_eq(exp, (in_dev->mr_gq_timer).expires))
226 return;
222 227
223 in_dev->mr_gq_running = 1; 228 in_dev->mr_gq_running = 1;
224 if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) 229 if (!mod_timer(&in_dev->mr_gq_timer, exp))
225 in_dev_hold(in_dev); 230 in_dev_hold(in_dev);
226} 231}
227 232
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 57e1405e8282..53ae0c6315ad 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1225,8 +1225,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
1225 * which has interface index (iif) as the first member of the 1225 * which has interface index (iif) as the first member of the
1226 * underlying inet{6}_skb_parm struct. This code then overlays 1226 * underlying inet{6}_skb_parm struct. This code then overlays
1227 * PKTINFO_SKB_CB and in_pktinfo also has iif as the first 1227 * PKTINFO_SKB_CB and in_pktinfo also has iif as the first
1228 * element so the iif is picked up from the prior IPCB 1228 * element so the iif is picked up from the prior IPCB. If iif
1229 * is the loopback interface, then return the sending interface
1230 * (e.g., process binds socket to eth0 for Tx which is
1231 * redirected to loopback in the rtable/dst).
1229 */ 1232 */
1233 if (pktinfo->ipi_ifindex == LOOPBACK_IFINDEX)
1234 pktinfo->ipi_ifindex = inet_iif(skb);
1235
1230 pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb); 1236 pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
1231 } else { 1237 } else {
1232 pktinfo->ipi_ifindex = 0; 1238 pktinfo->ipi_ifindex = 0;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a82a11747b3f..0fcac8e7a2b2 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1914,7 +1914,8 @@ local_input:
1914 } 1914 }
1915 } 1915 }
1916 1916
1917 rth = rt_dst_alloc(net->loopback_dev, flags | RTCF_LOCAL, res.type, 1917 rth = rt_dst_alloc(l3mdev_master_dev_rcu(dev) ? : net->loopback_dev,
1918 flags | RTCF_LOCAL, res.type,
1918 IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache); 1919 IN_DEV_CONF_GET(in_dev, NOPOLICY), false, do_cache);
1919 if (!rth) 1920 if (!rth)
1920 goto e_nobufs; 1921 goto e_nobufs;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 80bc36b25de2..22cbd61079b5 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -433,13 +433,6 @@ static struct ctl_table ipv4_table[] = {
433 .extra2 = &tcp_adv_win_scale_max, 433 .extra2 = &tcp_adv_win_scale_max,
434 }, 434 },
435 { 435 {
436 .procname = "tcp_tw_reuse",
437 .data = &sysctl_tcp_tw_reuse,
438 .maxlen = sizeof(int),
439 .mode = 0644,
440 .proc_handler = proc_dointvec
441 },
442 {
443 .procname = "tcp_frto", 436 .procname = "tcp_frto",
444 .data = &sysctl_tcp_frto, 437 .data = &sysctl_tcp_frto,
445 .maxlen = sizeof(int), 438 .maxlen = sizeof(int),
@@ -960,6 +953,13 @@ static struct ctl_table ipv4_net_table[] = {
960 .mode = 0644, 953 .mode = 0644,
961 .proc_handler = proc_dointvec, 954 .proc_handler = proc_dointvec,
962 }, 955 },
956 {
957 .procname = "tcp_tw_reuse",
958 .data = &init_net.ipv4.sysctl_tcp_tw_reuse,
959 .maxlen = sizeof(int),
960 .mode = 0644,
961 .proc_handler = proc_dointvec
962 },
963#ifdef CONFIG_IP_ROUTE_MULTIPATH 963#ifdef CONFIG_IP_ROUTE_MULTIPATH
964 { 964 {
965 .procname = "fib_multipath_use_neigh", 965 .procname = "fib_multipath_use_neigh",
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 30d81f533ada..fe9da4fb96bf 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -84,7 +84,6 @@
84#include <crypto/hash.h> 84#include <crypto/hash.h>
85#include <linux/scatterlist.h> 85#include <linux/scatterlist.h>
86 86
87int sysctl_tcp_tw_reuse __read_mostly;
88int sysctl_tcp_low_latency __read_mostly; 87int sysctl_tcp_low_latency __read_mostly;
89 88
90#ifdef CONFIG_TCP_MD5SIG 89#ifdef CONFIG_TCP_MD5SIG
@@ -120,7 +119,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
120 and use initial timestamp retrieved from peer table. 119 and use initial timestamp retrieved from peer table.
121 */ 120 */
122 if (tcptw->tw_ts_recent_stamp && 121 if (tcptw->tw_ts_recent_stamp &&
123 (!twp || (sysctl_tcp_tw_reuse && 122 (!twp || (sock_net(sk)->ipv4.sysctl_tcp_tw_reuse &&
124 get_seconds() - tcptw->tw_ts_recent_stamp > 1))) { 123 get_seconds() - tcptw->tw_ts_recent_stamp > 1))) {
125 tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; 124 tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
126 if (tp->write_seq == 0) 125 if (tp->write_seq == 0)
@@ -2456,6 +2455,7 @@ static int __net_init tcp_sk_init(struct net *net)
2456 net->ipv4.sysctl_tcp_orphan_retries = 0; 2455 net->ipv4.sysctl_tcp_orphan_retries = 0;
2457 net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT; 2456 net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT;
2458 net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX; 2457 net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;
2458 net->ipv4.sysctl_tcp_tw_reuse = 0;
2459 2459
2460 return 0; 2460 return 0;
2461fail: 2461fail:
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 70d0de404197..38122d04fadc 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1373,7 +1373,7 @@ emsgsize:
1373 */ 1373 */
1374 1374
1375 cork->length += length; 1375 cork->length += length;
1376 if (((length > mtu) || 1376 if ((((length + fragheaderlen) > mtu) ||
1377 (skb && skb_is_gso(skb))) && 1377 (skb && skb_is_gso(skb))) &&
1378 (sk->sk_protocol == IPPROTO_UDP) && 1378 (sk->sk_protocol == IPPROTO_UDP) &&
1379 (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && 1379 (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index 8938b6ba57a0..3d73278b86ca 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -47,7 +47,8 @@ static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk)
47 return (struct l2tp_ip_sock *)sk; 47 return (struct l2tp_ip_sock *)sk;
48} 48}
49 49
50static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) 50static struct sock *__l2tp_ip_bind_lookup(const struct net *net, __be32 laddr,
51 __be32 raddr, int dif, u32 tunnel_id)
51{ 52{
52 struct sock *sk; 53 struct sock *sk;
53 54
@@ -61,6 +62,7 @@ static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif
61 if ((l2tp->conn_id == tunnel_id) && 62 if ((l2tp->conn_id == tunnel_id) &&
62 net_eq(sock_net(sk), net) && 63 net_eq(sock_net(sk), net) &&
63 !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && 64 !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
65 (!inet->inet_daddr || !raddr || inet->inet_daddr == raddr) &&
64 (!sk->sk_bound_dev_if || !dif || 66 (!sk->sk_bound_dev_if || !dif ||
65 sk->sk_bound_dev_if == dif)) 67 sk->sk_bound_dev_if == dif))
66 goto found; 68 goto found;
@@ -71,15 +73,6 @@ found:
71 return sk; 73 return sk;
72} 74}
73 75
74static inline struct sock *l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id)
75{
76 struct sock *sk = __l2tp_ip_bind_lookup(net, laddr, dif, tunnel_id);
77 if (sk)
78 sock_hold(sk);
79
80 return sk;
81}
82
83/* When processing receive frames, there are two cases to 76/* When processing receive frames, there are two cases to
84 * consider. Data frames consist of a non-zero session-id and an 77 * consider. Data frames consist of a non-zero session-id and an
85 * optional cookie. Control frames consist of a regular L2TP header 78 * optional cookie. Control frames consist of a regular L2TP header
@@ -183,8 +176,8 @@ pass_up:
183 struct iphdr *iph = (struct iphdr *) skb_network_header(skb); 176 struct iphdr *iph = (struct iphdr *) skb_network_header(skb);
184 177
185 read_lock_bh(&l2tp_ip_lock); 178 read_lock_bh(&l2tp_ip_lock);
186 sk = __l2tp_ip_bind_lookup(net, iph->daddr, inet_iif(skb), 179 sk = __l2tp_ip_bind_lookup(net, iph->daddr, iph->saddr,
187 tunnel_id); 180 inet_iif(skb), tunnel_id);
188 if (!sk) { 181 if (!sk) {
189 read_unlock_bh(&l2tp_ip_lock); 182 read_unlock_bh(&l2tp_ip_lock);
190 goto discard; 183 goto discard;
@@ -280,7 +273,7 @@ static int l2tp_ip_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
280 inet->inet_saddr = 0; /* Use device */ 273 inet->inet_saddr = 0; /* Use device */
281 274
282 write_lock_bh(&l2tp_ip_lock); 275 write_lock_bh(&l2tp_ip_lock);
283 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 276 if (__l2tp_ip_bind_lookup(net, addr->l2tp_addr.s_addr, 0,
284 sk->sk_bound_dev_if, addr->l2tp_conn_id)) { 277 sk->sk_bound_dev_if, addr->l2tp_conn_id)) {
285 write_unlock_bh(&l2tp_ip_lock); 278 write_unlock_bh(&l2tp_ip_lock);
286 ret = -EADDRINUSE; 279 ret = -EADDRINUSE;
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index f092ac441fdd..331ccf5a7bad 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -59,12 +59,14 @@ static inline struct l2tp_ip6_sock *l2tp_ip6_sk(const struct sock *sk)
59 59
60static struct sock *__l2tp_ip6_bind_lookup(struct net *net, 60static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
61 struct in6_addr *laddr, 61 struct in6_addr *laddr,
62 const struct in6_addr *raddr,
62 int dif, u32 tunnel_id) 63 int dif, u32 tunnel_id)
63{ 64{
64 struct sock *sk; 65 struct sock *sk;
65 66
66 sk_for_each_bound(sk, &l2tp_ip6_bind_table) { 67 sk_for_each_bound(sk, &l2tp_ip6_bind_table) {
67 const struct in6_addr *addr = inet6_rcv_saddr(sk); 68 const struct in6_addr *sk_laddr = inet6_rcv_saddr(sk);
69 const struct in6_addr *sk_raddr = &sk->sk_v6_daddr;
68 struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); 70 struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk);
69 71
70 if (l2tp == NULL) 72 if (l2tp == NULL)
@@ -72,7 +74,8 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
72 74
73 if ((l2tp->conn_id == tunnel_id) && 75 if ((l2tp->conn_id == tunnel_id) &&
74 net_eq(sock_net(sk), net) && 76 net_eq(sock_net(sk), net) &&
75 (!addr || ipv6_addr_equal(addr, laddr)) && 77 (!sk_laddr || ipv6_addr_any(sk_laddr) || ipv6_addr_equal(sk_laddr, laddr)) &&
78 (!raddr || ipv6_addr_any(sk_raddr) || ipv6_addr_equal(sk_raddr, raddr)) &&
76 (!sk->sk_bound_dev_if || !dif || 79 (!sk->sk_bound_dev_if || !dif ||
77 sk->sk_bound_dev_if == dif)) 80 sk->sk_bound_dev_if == dif))
78 goto found; 81 goto found;
@@ -83,17 +86,6 @@ found:
83 return sk; 86 return sk;
84} 87}
85 88
86static inline struct sock *l2tp_ip6_bind_lookup(struct net *net,
87 struct in6_addr *laddr,
88 int dif, u32 tunnel_id)
89{
90 struct sock *sk = __l2tp_ip6_bind_lookup(net, laddr, dif, tunnel_id);
91 if (sk)
92 sock_hold(sk);
93
94 return sk;
95}
96
97/* When processing receive frames, there are two cases to 89/* When processing receive frames, there are two cases to
98 * consider. Data frames consist of a non-zero session-id and an 90 * consider. Data frames consist of a non-zero session-id and an
99 * optional cookie. Control frames consist of a regular L2TP header 91 * optional cookie. Control frames consist of a regular L2TP header
@@ -197,8 +189,8 @@ pass_up:
197 struct ipv6hdr *iph = ipv6_hdr(skb); 189 struct ipv6hdr *iph = ipv6_hdr(skb);
198 190
199 read_lock_bh(&l2tp_ip6_lock); 191 read_lock_bh(&l2tp_ip6_lock);
200 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, inet6_iif(skb), 192 sk = __l2tp_ip6_bind_lookup(net, &iph->daddr, &iph->saddr,
201 tunnel_id); 193 inet6_iif(skb), tunnel_id);
202 if (!sk) { 194 if (!sk) {
203 read_unlock_bh(&l2tp_ip6_lock); 195 read_unlock_bh(&l2tp_ip6_lock);
204 goto discard; 196 goto discard;
@@ -330,7 +322,7 @@ static int l2tp_ip6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
330 rcu_read_unlock(); 322 rcu_read_unlock();
331 323
332 write_lock_bh(&l2tp_ip6_lock); 324 write_lock_bh(&l2tp_ip6_lock);
333 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, bound_dev_if, 325 if (__l2tp_ip6_bind_lookup(net, &addr->l2tp_addr, NULL, bound_dev_if,
334 addr->l2tp_conn_id)) { 326 addr->l2tp_conn_id)) {
335 write_unlock_bh(&l2tp_ip6_lock); 327 write_unlock_bh(&l2tp_ip6_lock);
336 err = -EADDRINUSE; 328 err = -EADDRINUSE;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 2c21b7039136..0d8b716e509e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3287,7 +3287,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3287 int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); 3287 int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
3288 int hw_headroom = sdata->local->hw.extra_tx_headroom; 3288 int hw_headroom = sdata->local->hw.extra_tx_headroom;
3289 struct ethhdr eth; 3289 struct ethhdr eth;
3290 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 3290 struct ieee80211_tx_info *info;
3291 struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; 3291 struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
3292 struct ieee80211_tx_data tx; 3292 struct ieee80211_tx_data tx;
3293 ieee80211_tx_result r; 3293 ieee80211_tx_result r;
@@ -3351,6 +3351,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3351 memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); 3351 memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN);
3352 memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); 3352 memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN);
3353 3353
3354 info = IEEE80211_SKB_CB(skb);
3354 memset(info, 0, sizeof(*info)); 3355 memset(info, 0, sizeof(*info));
3355 info->band = fast_tx->band; 3356 info->band = fast_tx->band;
3356 info->control.vif = &sdata->vif; 3357 info->control.vif = &sdata->vif;
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 2d4c4d3911c0..9c62b6325f7a 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -606,7 +606,6 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
606 rcu_assign_pointer(flow->sf_acts, acts); 606 rcu_assign_pointer(flow->sf_acts, acts);
607 packet->priority = flow->key.phy.priority; 607 packet->priority = flow->key.phy.priority;
608 packet->mark = flow->key.phy.skb_mark; 608 packet->mark = flow->key.phy.skb_mark;
609 packet->protocol = flow->key.eth.type;
610 609
611 rcu_read_lock(); 610 rcu_read_lock();
612 dp = get_dp_rcu(net, ovs_header->dp_ifindex); 611 dp = get_dp_rcu(net, ovs_header->dp_ifindex);
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 08aa926cd5cf..2c0a00f7f1b7 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -312,7 +312,8 @@ static bool icmp6hdr_ok(struct sk_buff *skb)
312 * Returns 0 if it encounters a non-vlan or incomplete packet. 312 * Returns 0 if it encounters a non-vlan or incomplete packet.
313 * Returns 1 after successfully parsing vlan tag. 313 * Returns 1 after successfully parsing vlan tag.
314 */ 314 */
315static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh) 315static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh,
316 bool untag_vlan)
316{ 317{
317 struct vlan_head *vh = (struct vlan_head *)skb->data; 318 struct vlan_head *vh = (struct vlan_head *)skb->data;
318 319
@@ -330,7 +331,20 @@ static int parse_vlan_tag(struct sk_buff *skb, struct vlan_head *key_vh)
330 key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT); 331 key_vh->tci = vh->tci | htons(VLAN_TAG_PRESENT);
331 key_vh->tpid = vh->tpid; 332 key_vh->tpid = vh->tpid;
332 333
333 __skb_pull(skb, sizeof(struct vlan_head)); 334 if (unlikely(untag_vlan)) {
335 int offset = skb->data - skb_mac_header(skb);
336 u16 tci;
337 int err;
338
339 __skb_push(skb, offset);
340 err = __skb_vlan_pop(skb, &tci);
341 __skb_pull(skb, offset);
342 if (err)
343 return err;
344 __vlan_hwaccel_put_tag(skb, key_vh->tpid, tci);
345 } else {
346 __skb_pull(skb, sizeof(struct vlan_head));
347 }
334 return 1; 348 return 1;
335} 349}
336 350
@@ -351,13 +365,13 @@ static int parse_vlan(struct sk_buff *skb, struct sw_flow_key *key)
351 key->eth.vlan.tpid = skb->vlan_proto; 365 key->eth.vlan.tpid = skb->vlan_proto;
352 } else { 366 } else {
353 /* Parse outer vlan tag in the non-accelerated case. */ 367 /* Parse outer vlan tag in the non-accelerated case. */
354 res = parse_vlan_tag(skb, &key->eth.vlan); 368 res = parse_vlan_tag(skb, &key->eth.vlan, true);
355 if (res <= 0) 369 if (res <= 0)
356 return res; 370 return res;
357 } 371 }
358 372
359 /* Parse inner vlan tag. */ 373 /* Parse inner vlan tag. */
360 res = parse_vlan_tag(skb, &key->eth.cvlan); 374 res = parse_vlan_tag(skb, &key->eth.cvlan, false);
361 if (res <= 0) 375 if (res <= 0)
362 return res; 376 return res;
363 377
@@ -800,29 +814,15 @@ int ovs_flow_key_extract_userspace(struct net *net, const struct nlattr *attr,
800 if (err) 814 if (err)
801 return err; 815 return err;
802 816
803 if (ovs_key_mac_proto(key) == MAC_PROTO_NONE) { 817 /* key_extract assumes that skb->protocol is set-up for
804 /* key_extract assumes that skb->protocol is set-up for 818 * layer 3 packets which is the case for other callers,
805 * layer 3 packets which is the case for other callers, 819 * in particular packets received from the network stack.
806 * in particular packets recieved from the network stack. 820 * Here the correct value can be set from the metadata
807 * Here the correct value can be set from the metadata 821 * extracted above.
808 * extracted above. 822 * For L2 packet key eth type would be zero. skb protocol
809 */ 823 * would be set to correct value later during key-extact.
810 skb->protocol = key->eth.type; 824 */
811 } else {
812 struct ethhdr *eth;
813
814 skb_reset_mac_header(skb);
815 eth = eth_hdr(skb);
816
817 /* Normally, setting the skb 'protocol' field would be
818 * handled by a call to eth_type_trans(), but it assumes
819 * there's a sending device, which we may not have.
820 */
821 if (eth_proto_is_802_3(eth->h_proto))
822 skb->protocol = eth->h_proto;
823 else
824 skb->protocol = htons(ETH_P_802_2);
825 }
826 825
826 skb->protocol = key->eth.type;
827 return key_extract(skb, key); 827 return key_extract(skb, key);
828} 828}
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 3fbba79a4ef0..1ecdf809b5fa 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -148,13 +148,15 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
148 unsigned long cl; 148 unsigned long cl;
149 unsigned long fh; 149 unsigned long fh;
150 int err; 150 int err;
151 int tp_created = 0; 151 int tp_created;
152 152
153 if ((n->nlmsg_type != RTM_GETTFILTER) && 153 if ((n->nlmsg_type != RTM_GETTFILTER) &&
154 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 154 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN))
155 return -EPERM; 155 return -EPERM;
156 156
157replay: 157replay:
158 tp_created = 0;
159
158 err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL); 160 err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL);
159 if (err < 0) 161 if (err < 0)
160 return err; 162 return err;
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 333f8e268431..970db7a41684 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -153,10 +153,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
153 153
154 switch (ip_tunnel_info_af(info)) { 154 switch (ip_tunnel_info_af(info)) {
155 case AF_INET: 155 case AF_INET:
156 skb_key.enc_control.addr_type =
157 FLOW_DISSECTOR_KEY_IPV4_ADDRS;
156 skb_key.enc_ipv4.src = key->u.ipv4.src; 158 skb_key.enc_ipv4.src = key->u.ipv4.src;
157 skb_key.enc_ipv4.dst = key->u.ipv4.dst; 159 skb_key.enc_ipv4.dst = key->u.ipv4.dst;
158 break; 160 break;
159 case AF_INET6: 161 case AF_INET6:
162 skb_key.enc_control.addr_type =
163 FLOW_DISSECTOR_KEY_IPV6_ADDRS;
160 skb_key.enc_ipv6.src = key->u.ipv6.src; 164 skb_key.enc_ipv6.src = key->u.ipv6.src;
161 skb_key.enc_ipv6.dst = key->u.ipv6.dst; 165 skb_key.enc_ipv6.dst = key->u.ipv6.dst;
162 break; 166 break;
diff --git a/net/socket.c b/net/socket.c
index 8487bf136e5c..a8c2307590b8 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -537,7 +537,7 @@ int sockfs_setattr(struct dentry *dentry, struct iattr *iattr)
537{ 537{
538 int err = simple_setattr(dentry, iattr); 538 int err = simple_setattr(dentry, iattr);
539 539
540 if (!err) { 540 if (!err && (iattr->ia_valid & ATTR_UID)) {
541 struct socket *sock = SOCKET_I(d_inode(dentry)); 541 struct socket *sock = SOCKET_I(d_inode(dentry));
542 542
543 sock->sk->sk_uid = iattr->ia_uid; 543 sock->sk->sk_uid = iattr->ia_uid;
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 333c5dae0072..800caaa699a1 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -441,15 +441,19 @@ static void __tipc_shutdown(struct socket *sock, int error)
441 while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) { 441 while ((skb = __skb_dequeue(&sk->sk_receive_queue)) != NULL) {
442 if (TIPC_SKB_CB(skb)->bytes_read) { 442 if (TIPC_SKB_CB(skb)->bytes_read) {
443 kfree_skb(skb); 443 kfree_skb(skb);
444 } else { 444 continue;
445 if (!tipc_sk_type_connectionless(sk) && 445 }
446 sk->sk_state != TIPC_DISCONNECTING) { 446 if (!tipc_sk_type_connectionless(sk) &&
447 tipc_set_sk_state(sk, TIPC_DISCONNECTING); 447 sk->sk_state != TIPC_DISCONNECTING) {
448 tipc_node_remove_conn(net, dnode, tsk->portid); 448 tipc_set_sk_state(sk, TIPC_DISCONNECTING);
449 } 449 tipc_node_remove_conn(net, dnode, tsk->portid);
450 tipc_sk_respond(sk, skb, error);
451 } 450 }
451 tipc_sk_respond(sk, skb, error);
452 } 452 }
453
454 if (tipc_sk_type_connectionless(sk))
455 return;
456
453 if (sk->sk_state != TIPC_DISCONNECTING) { 457 if (sk->sk_state != TIPC_DISCONNECTING) {
454 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, 458 skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE,
455 TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode, 459 TIPC_CONN_MSG, SHORT_H_SIZE, 0, dnode,
@@ -457,10 +461,8 @@ static void __tipc_shutdown(struct socket *sock, int error)
457 tsk->portid, error); 461 tsk->portid, error);
458 if (skb) 462 if (skb)
459 tipc_node_xmit_skb(net, skb, dnode, tsk->portid); 463 tipc_node_xmit_skb(net, skb, dnode, tsk->portid);
460 if (!tipc_sk_type_connectionless(sk)) { 464 tipc_node_remove_conn(net, dnode, tsk->portid);
461 tipc_node_remove_conn(net, dnode, tsk->portid); 465 tipc_set_sk_state(sk, TIPC_DISCONNECTING);
462 tipc_set_sk_state(sk, TIPC_DISCONNECTING);
463 }
464 } 466 }
465} 467}
466 468
diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
index 950fd2e64bb7..12262c0cc691 100644
--- a/scripts/gcc-plugins/gcc-common.h
+++ b/scripts/gcc-plugins/gcc-common.h
@@ -39,6 +39,9 @@
39#include "hash-map.h" 39#include "hash-map.h"
40#endif 40#endif
41 41
42#if BUILDING_GCC_VERSION >= 7000
43#include "memmodel.h"
44#endif
42#include "emit-rtl.h" 45#include "emit-rtl.h"
43#include "debug.h" 46#include "debug.h"
44#include "target.h" 47#include "target.h"
@@ -91,6 +94,9 @@
91#include "tree-ssa-alias.h" 94#include "tree-ssa-alias.h"
92#include "tree-ssa.h" 95#include "tree-ssa.h"
93#include "stringpool.h" 96#include "stringpool.h"
97#if BUILDING_GCC_VERSION >= 7000
98#include "tree-vrp.h"
99#endif
94#include "tree-ssanames.h" 100#include "tree-ssanames.h"
95#include "print-tree.h" 101#include "print-tree.h"
96#include "tree-eh.h" 102#include "tree-eh.h"
@@ -287,6 +293,22 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c
287 return NULL; 293 return NULL;
288} 294}
289 295
296static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
297{
298 cgraph_node_ptr alias;
299
300 if (callback(node, data))
301 return true;
302
303 for (alias = node->same_body; alias; alias = alias->next) {
304 if (include_overwritable || cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE)
305 if (cgraph_for_node_and_aliases(alias, callback, data, include_overwritable))
306 return true;
307 }
308
309 return false;
310}
311
290#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ 312#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
291 for ((node) = cgraph_first_function_with_gimple_body(); (node); \ 313 for ((node) = cgraph_first_function_with_gimple_body(); (node); \
292 (node) = cgraph_next_function_with_gimple_body(node)) 314 (node) = cgraph_next_function_with_gimple_body(node))
@@ -399,6 +421,7 @@ typedef union gimple_statement_d gassign;
399typedef union gimple_statement_d gcall; 421typedef union gimple_statement_d gcall;
400typedef union gimple_statement_d gcond; 422typedef union gimple_statement_d gcond;
401typedef union gimple_statement_d gdebug; 423typedef union gimple_statement_d gdebug;
424typedef union gimple_statement_d ggoto;
402typedef union gimple_statement_d gphi; 425typedef union gimple_statement_d gphi;
403typedef union gimple_statement_d greturn; 426typedef union gimple_statement_d greturn;
404 427
@@ -452,6 +475,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
452 return stmt; 475 return stmt;
453} 476}
454 477
478static inline ggoto *as_a_ggoto(gimple stmt)
479{
480 return stmt;
481}
482
483static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
484{
485 return stmt;
486}
487
455static inline gphi *as_a_gphi(gimple stmt) 488static inline gphi *as_a_gphi(gimple stmt)
456{ 489{
457 return stmt; 490 return stmt;
@@ -496,6 +529,14 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt)
496 529
497typedef struct rtx_def rtx_insn; 530typedef struct rtx_def rtx_insn;
498 531
532static inline const char *get_decl_section_name(const_tree decl)
533{
534 if (DECL_SECTION_NAME(decl) == NULL_TREE)
535 return NULL;
536
537 return TREE_STRING_POINTER(DECL_SECTION_NAME(decl));
538}
539
499static inline void set_decl_section_name(tree node, const char *value) 540static inline void set_decl_section_name(tree node, const char *value)
500{ 541{
501 if (value) 542 if (value)
@@ -511,6 +552,7 @@ typedef struct gimple_statement_base gassign;
511typedef struct gimple_statement_call gcall; 552typedef struct gimple_statement_call gcall;
512typedef struct gimple_statement_base gcond; 553typedef struct gimple_statement_base gcond;
513typedef struct gimple_statement_base gdebug; 554typedef struct gimple_statement_base gdebug;
555typedef struct gimple_statement_base ggoto;
514typedef struct gimple_statement_phi gphi; 556typedef struct gimple_statement_phi gphi;
515typedef struct gimple_statement_base greturn; 557typedef struct gimple_statement_base greturn;
516 558
@@ -564,6 +606,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
564 return stmt; 606 return stmt;
565} 607}
566 608
609static inline ggoto *as_a_ggoto(gimple stmt)
610{
611 return stmt;
612}
613
614static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
615{
616 return stmt;
617}
618
567static inline gphi *as_a_gphi(gimple stmt) 619static inline gphi *as_a_gphi(gimple stmt)
568{ 620{
569 return as_a<gphi>(stmt); 621 return as_a<gphi>(stmt);
@@ -611,6 +663,11 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
611 663
612#define INSN_DELETED_P(insn) (insn)->deleted() 664#define INSN_DELETED_P(insn) (insn)->deleted()
613 665
666static inline const char *get_decl_section_name(const_tree decl)
667{
668 return DECL_SECTION_NAME(decl);
669}
670
614/* symtab/cgraph related */ 671/* symtab/cgraph related */
615#define debug_cgraph_node(node) (node)->debug() 672#define debug_cgraph_node(node) (node)->debug()
616#define cgraph_get_node(decl) cgraph_node::get(decl) 673#define cgraph_get_node(decl) cgraph_node::get(decl)
@@ -619,6 +676,7 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
619#define cgraph_n_nodes symtab->cgraph_count 676#define cgraph_n_nodes symtab->cgraph_count
620#define cgraph_max_uid symtab->cgraph_max_uid 677#define cgraph_max_uid symtab->cgraph_max_uid
621#define varpool_get_node(decl) varpool_node::get(decl) 678#define varpool_get_node(decl) varpool_node::get(decl)
679#define dump_varpool_node(file, node) (node)->dump(file)
622 680
623#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ 681#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
624 (caller)->create_edge((callee), (call_stmt), (count), (freq)) 682 (caller)->create_edge((callee), (call_stmt), (count), (freq))
@@ -674,6 +732,11 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node)
674 return node->get_alias_target(); 732 return node->get_alias_target();
675} 733}
676 734
735static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
736{
737 return node->call_for_symbol_thunks_and_aliases(callback, data, include_overwritable);
738}
739
677static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data) 740static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
678{ 741{
679 return symtab->add_cgraph_insertion_hook(hook, data); 742 return symtab->add_cgraph_insertion_hook(hook, data);
@@ -731,6 +794,13 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
731 794
732template <> 795template <>
733template <> 796template <>
797inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
798{
799 return gs->code == GIMPLE_GOTO;
800}
801
802template <>
803template <>
734inline bool is_a_helper<const greturn *>::test(const_gimple gs) 804inline bool is_a_helper<const greturn *>::test(const_gimple gs)
735{ 805{
736 return gs->code == GIMPLE_RETURN; 806 return gs->code == GIMPLE_RETURN;
@@ -766,6 +836,16 @@ static inline const gcall *as_a_const_gcall(const_gimple stmt)
766 return as_a<const gcall *>(stmt); 836 return as_a<const gcall *>(stmt);
767} 837}
768 838
839static inline ggoto *as_a_ggoto(gimple stmt)
840{
841 return as_a<ggoto *>(stmt);
842}
843
844static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
845{
846 return as_a<const ggoto *>(stmt);
847}
848
769static inline gphi *as_a_gphi(gimple stmt) 849static inline gphi *as_a_gphi(gimple stmt)
770{ 850{
771 return as_a<gphi *>(stmt); 851 return as_a<gphi *>(stmt);
@@ -828,4 +908,9 @@ static inline void debug_gimple_stmt(const_gimple s)
828#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s)) 908#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
829#endif 909#endif
830 910
911#if BUILDING_GCC_VERSION >= 7000
912#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
913 get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep)
914#endif
915
831#endif 916#endif
diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c
index 12541126575b..8ff203ad4809 100644
--- a/scripts/gcc-plugins/latent_entropy_plugin.c
+++ b/scripts/gcc-plugins/latent_entropy_plugin.c
@@ -328,9 +328,9 @@ static enum tree_code get_op(tree *rhs)
328 op = LROTATE_EXPR; 328 op = LROTATE_EXPR;
329 /* 329 /*
330 * This code limits the value of random_const to 330 * This code limits the value of random_const to
331 * the size of a wide int for the rotation 331 * the size of a long for the rotation
332 */ 332 */
333 random_const &= HOST_BITS_PER_WIDE_INT - 1; 333 random_const %= TYPE_PRECISION(long_unsigned_type_node);
334 break; 334 break;
335 } 335 }
336 336
diff --git a/usr/Makefile b/usr/Makefile
index 17a513268325..0b87e71c00fc 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -5,8 +5,10 @@
5klibcdirs:; 5klibcdirs:;
6PHONY += klibcdirs 6PHONY += klibcdirs
7 7
8suffix_y = $(CONFIG_INITRAMFS_COMPRESSION) 8suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
9AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)" 9datafile_y = initramfs_data.cpio$(suffix_y)
10AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
11
10 12
11# Generate builtin.o based on initramfs_data.o 13# Generate builtin.o based on initramfs_data.o
12obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o 14obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
@@ -14,7 +16,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
14# initramfs_data.o contains the compressed initramfs_data.cpio image. 16# initramfs_data.o contains the compressed initramfs_data.cpio image.
15# The image is included using .incbin, a dependency which is not 17# The image is included using .incbin, a dependency which is not
16# tracked automatically. 18# tracked automatically.
17$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE 19$(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
18 20
19##### 21#####
20# Generate the initramfs cpio archive 22# Generate the initramfs cpio archive
@@ -38,10 +40,8 @@ endif
38quiet_cmd_initfs = GEN $@ 40quiet_cmd_initfs = GEN $@
39 cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) 41 cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
40 42
41targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \ 43targets := $(datafile_y)
42 initramfs_data.cpio.lzma initramfs_data.cpio.xz \ 44
43 initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \
44 initramfs_data.cpio
45# do not try to update files included in initramfs 45# do not try to update files included in initramfs
46$(deps_initramfs): ; 46$(deps_initramfs): ;
47 47
@@ -51,6 +51,6 @@ $(deps_initramfs): klibcdirs
51# 2) There are changes in which files are included (added or deleted) 51# 2) There are changes in which files are included (added or deleted)
52# 3) If gen_init_cpio are newer than initramfs_data.cpio 52# 3) If gen_init_cpio are newer than initramfs_data.cpio
53# 4) arguments to gen_initramfs.sh changes 53# 4) arguments to gen_initramfs.sh changes
54$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs 54$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
55 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d 55 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
56 $(call if_changed,initfs) 56 $(call if_changed,initfs)