aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/unaligned-memory-access.txt2
-rw-r--r--MAINTAINERS3
-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/bcm-nsp.dtsi2
-rw-r--r--arch/arm/boot/dts/imx31.dtsi4
-rw-r--r--arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi4
-rw-r--r--arch/arm/boot/dts/imx6qdl-nitrogen6_som2.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/qcom-apq8064.dtsi4
-rw-r--r--arch/arm/boot/dts/qcom-mdm9615.dtsi2
-rw-r--r--arch/arm/boot/dts/sun6i-a31-hummingbird.dts4
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi1
-rw-r--r--arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts2
-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/configs/multi_v7_defconfig4
-rw-r--r--arch/arm/configs/s3c2410_defconfig6
-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-s3c24xx/common.c76
-rw-r--r--arch/arm/mach-ux500/pm.c4
-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-odroidc2.dts4
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi16
-rw-r--r--arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi6
-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/exynos/exynos5433.dtsi2
-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/boot/dts/xilinx/zynqmp-ep108.dts2
-rw-r--r--arch/arm64/boot/dts/xilinx/zynqmp.dtsi6
-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/x86/include/asm/bitops.h13
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c3
-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/net/ethernet/korina.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c3
-rw-r--r--drivers/net/ethernet/realtek/r8169.c1
-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--fs/dax.c243
-rw-r--r--fs/ext2/inode.c3
-rw-r--r--fs/ext4/file.c48
-rw-r--r--include/linux/dax.h3
-rw-r--r--include/linux/filter.h1
-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/core/filter.c6
-rw-r--r--net/ipv4/sysctl_net_ipv4.c14
-rw-r--r--net/ipv4/tcp_ipv4.c4
-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/tipc/socket.c24
90 files changed, 834 insertions, 410 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/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..9effa390177d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1689,6 +1689,7 @@ M: Krzysztof Kozlowski <krzk@kernel.org>
1689R: Javier Martinez Canillas <javier@osg.samsung.com> 1689R: Javier Martinez Canillas <javier@osg.samsung.com>
1690L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1690L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1691L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 1691L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
1692Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/
1692S: Maintained 1693S: Maintained
1693F: arch/arm/boot/dts/s3c* 1694F: arch/arm/boot/dts/s3c*
1694F: arch/arm/boot/dts/s5p* 1695F: arch/arm/boot/dts/s5p*
@@ -9842,7 +9843,7 @@ M: Mark Rutland <mark.rutland@arm.com>
9842M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> 9843M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
9843L: linux-arm-kernel@lists.infradead.org 9844L: linux-arm-kernel@lists.infradead.org
9844S: Maintained 9845S: Maintained
9845F: drivers/firmware/psci.c 9846F: drivers/firmware/psci*.c
9846F: include/linux/psci.h 9847F: include/linux/psci.h
9847F: include/uapi/linux/psci.h 9848F: include/uapi/linux/psci.h
9848 9849
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 7327250f0bb6..f10fe8526239 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -846,6 +846,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
846 sun8i-a83t-allwinner-h8homlet-v2.dtb \ 846 sun8i-a83t-allwinner-h8homlet-v2.dtb \
847 sun8i-a83t-cubietruck-plus.dtb \ 847 sun8i-a83t-cubietruck-plus.dtb \
848 sun8i-h3-bananapi-m2-plus.dtb \ 848 sun8i-h3-bananapi-m2-plus.dtb \
849 sun8i-h3-nanopi-m1.dtb \
849 sun8i-h3-nanopi-neo.dtb \ 850 sun8i-h3-nanopi-neo.dtb \
850 sun8i-h3-orangepi-2.dtb \ 851 sun8i-h3-orangepi-2.dtb \
851 sun8i-h3-orangepi-lite.dtb \ 852 sun8i-h3-orangepi-lite.dtb \
diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
index b6142bda661e..15f07f9af3b3 100644
--- a/arch/arm/boot/dts/bcm-nsp.dtsi
+++ b/arch/arm/boot/dts/bcm-nsp.dtsi
@@ -160,7 +160,7 @@
160 160
161 axi { 161 axi {
162 compatible = "simple-bus"; 162 compatible = "simple-bus";
163 ranges = <0x00000000 0x18000000 0x0011c40a>; 163 ranges = <0x00000000 0x18000000 0x0011c40c>;
164 #address-cells = <1>; 164 #address-cells = <1>;
165 #size-cells = <1>; 165 #size-cells = <1>;
166 166
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-nitrogen6_max.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
index 34887a10c5f1..47ba97229a48 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
@@ -319,8 +319,6 @@
319 compatible = "fsl,imx6q-nitrogen6_max-sgtl5000", 319 compatible = "fsl,imx6q-nitrogen6_max-sgtl5000",
320 "fsl,imx-audio-sgtl5000"; 320 "fsl,imx-audio-sgtl5000";
321 model = "imx6q-nitrogen6_max-sgtl5000"; 321 model = "imx6q-nitrogen6_max-sgtl5000";
322 pinctrl-names = "default";
323 pinctrl-0 = <&pinctrl_sgtl5000>;
324 ssi-controller = <&ssi1>; 322 ssi-controller = <&ssi1>;
325 audio-codec = <&codec>; 323 audio-codec = <&codec>;
326 audio-routing = 324 audio-routing =
@@ -402,6 +400,8 @@
402 400
403 codec: sgtl5000@0a { 401 codec: sgtl5000@0a {
404 compatible = "fsl,sgtl5000"; 402 compatible = "fsl,sgtl5000";
403 pinctrl-names = "default";
404 pinctrl-0 = <&pinctrl_sgtl5000>;
405 reg = <0x0a>; 405 reg = <0x0a>;
406 clocks = <&clks IMX6QDL_CLK_CKO>; 406 clocks = <&clks IMX6QDL_CLK_CKO>;
407 VDDA-supply = <&reg_2p5v>; 407 VDDA-supply = <&reg_2p5v>;
diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi
index d80f21abea62..31d4cc62dbc7 100644
--- a/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi
@@ -250,8 +250,6 @@
250 compatible = "fsl,imx6q-nitrogen6_som2-sgtl5000", 250 compatible = "fsl,imx6q-nitrogen6_som2-sgtl5000",
251 "fsl,imx-audio-sgtl5000"; 251 "fsl,imx-audio-sgtl5000";
252 model = "imx6q-nitrogen6_som2-sgtl5000"; 252 model = "imx6q-nitrogen6_som2-sgtl5000";
253 pinctrl-names = "default";
254 pinctrl-0 = <&pinctrl_sgtl5000>;
255 ssi-controller = <&ssi1>; 253 ssi-controller = <&ssi1>;
256 audio-codec = <&codec>; 254 audio-codec = <&codec>;
257 audio-routing = 255 audio-routing =
@@ -320,6 +318,8 @@
320 318
321 codec: sgtl5000@0a { 319 codec: sgtl5000@0a {
322 compatible = "fsl,sgtl5000"; 320 compatible = "fsl,sgtl5000";
321 pinctrl-names = "default";
322 pinctrl-0 = <&pinctrl_sgtl5000>;
323 reg = <0x0a>; 323 reg = <0x0a>;
324 clocks = <&clks IMX6QDL_CLK_CKO>; 324 clocks = <&clks IMX6QDL_CLK_CKO>;
325 VDDA-supply = <&reg_2p5v>; 325 VDDA-supply = <&reg_2p5v>;
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/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/qcom-mdm9615.dtsi b/arch/arm/boot/dts/qcom-mdm9615.dtsi
index 5ae4ec59e6ea..c852b69229c9 100644
--- a/arch/arm/boot/dts/qcom-mdm9615.dtsi
+++ b/arch/arm/boot/dts/qcom-mdm9615.dtsi
@@ -357,7 +357,7 @@
357 }; 357 };
358 358
359 amba { 359 amba {
360 compatible = "arm,amba-bus"; 360 compatible = "simple-bus";
361 #address-cells = <1>; 361 #address-cells = <1>;
362 #size-cells = <1>; 362 #size-cells = <1>;
363 ranges; 363 ranges;
diff --git a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
index 735914f6ae44..7cae328398b1 100644
--- a/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
+++ b/arch/arm/boot/dts/sun6i-a31-hummingbird.dts
@@ -140,6 +140,10 @@
140 cpu-supply = <&reg_dcdc3>; 140 cpu-supply = <&reg_dcdc3>;
141}; 141};
142 142
143&de {
144 status = "okay";
145};
146
143&ehci0 { 147&ehci0 {
144 status = "okay"; 148 status = "okay";
145}; 149};
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 2b26175d55d1..e78faaf9243c 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -234,6 +234,7 @@
234 de: display-engine { 234 de: display-engine {
235 compatible = "allwinner,sun6i-a31-display-engine"; 235 compatible = "allwinner,sun6i-a31-display-engine";
236 allwinner,pipelines = <&fe0>; 236 allwinner,pipelines = <&fe0>;
237 status = "disabled";
237 }; 238 };
238 239
239 soc@01c00000 { 240 soc@01c00000 {
diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts
index 5ea4915f6d75..10d307408f23 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts
@@ -56,7 +56,7 @@
56}; 56};
57 57
58&pio { 58&pio {
59 mmc2_pins_nrst: mmc2@0 { 59 mmc2_pins_nrst: mmc2-rst-pin {
60 allwinner,pins = "PC16"; 60 allwinner,pins = "PC16";
61 allwinner,function = "gpio_out"; 61 allwinner,function = "gpio_out";
62 allwinner,drive = <SUN4I_PINCTRL_10_MA>; 62 allwinner,drive = <SUN4I_PINCTRL_10_MA>;
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/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index b01a43851294..028d2b70e3b5 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -471,7 +471,7 @@ CONFIG_MESON_WATCHDOG=y
471CONFIG_DW_WATCHDOG=y 471CONFIG_DW_WATCHDOG=y
472CONFIG_DIGICOLOR_WATCHDOG=y 472CONFIG_DIGICOLOR_WATCHDOG=y
473CONFIG_BCM2835_WDT=y 473CONFIG_BCM2835_WDT=y
474CONFIG_BCM47XX_WATCHDOG=y 474CONFIG_BCM47XX_WDT=y
475CONFIG_BCM7038_WDT=m 475CONFIG_BCM7038_WDT=m
476CONFIG_BCM_KONA_WDT=y 476CONFIG_BCM_KONA_WDT=y
477CONFIG_MFD_ACT8945A=y 477CONFIG_MFD_ACT8945A=y
@@ -893,7 +893,7 @@ CONFIG_BCM2835_MBOX=y
893CONFIG_RASPBERRYPI_FIRMWARE=y 893CONFIG_RASPBERRYPI_FIRMWARE=y
894CONFIG_EFI_VARS=m 894CONFIG_EFI_VARS=m
895CONFIG_EFI_CAPSULE_LOADER=m 895CONFIG_EFI_CAPSULE_LOADER=m
896CONFIG_CONFIG_BCM47XX_NVRAM=y 896CONFIG_BCM47XX_NVRAM=y
897CONFIG_BCM47XX_SPROM=y 897CONFIG_BCM47XX_SPROM=y
898CONFIG_EXT4_FS=y 898CONFIG_EXT4_FS=y
899CONFIG_AUTOFS4_FS=y 899CONFIG_AUTOFS4_FS=y
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index 4364040ed696..1e6c48dd7b11 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -86,9 +86,9 @@ CONFIG_IPV6_TUNNEL=m
86CONFIG_NETFILTER=y 86CONFIG_NETFILTER=y
87CONFIG_NF_CONNTRACK=m 87CONFIG_NF_CONNTRACK=m
88CONFIG_NF_CONNTRACK_EVENTS=y 88CONFIG_NF_CONNTRACK_EVENTS=y
89CONFIG_NF_CT_PROTO_DCCP=m 89CONFIG_NF_CT_PROTO_DCCP=y
90CONFIG_NF_CT_PROTO_SCTP=m 90CONFIG_NF_CT_PROTO_SCTP=y
91CONFIG_NF_CT_PROTO_UDPLITE=m 91CONFIG_NF_CT_PROTO_UDPLITE=y
92CONFIG_NF_CONNTRACK_AMANDA=m 92CONFIG_NF_CONNTRACK_AMANDA=m
93CONFIG_NF_CONNTRACK_FTP=m 93CONFIG_NF_CONNTRACK_FTP=m
94CONFIG_NF_CONNTRACK_H323=m 94CONFIG_NF_CONNTRACK_H323=m
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-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/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
index 8538910db202..a970e7fcba9e 100644
--- a/arch/arm/mach-ux500/pm.c
+++ b/arch/arm/mach-ux500/pm.c
@@ -134,8 +134,8 @@ bool prcmu_pending_irq(void)
134 */ 134 */
135bool prcmu_is_cpu_in_wfi(int cpu) 135bool prcmu_is_cpu_in_wfi(int cpu)
136{ 136{
137 return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : 137 return readl(PRCM_ARM_WFI_STANDBY) &
138 PRCM_ARM_WFI_STANDBY_WFI0; 138 (cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : PRCM_ARM_WFI_STANDBY_WFI0);
139} 139}
140 140
141/* 141/*
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-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
index 238fbeacd330..5d28e1cdc998 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
@@ -137,6 +137,10 @@
137 }; 137 };
138}; 138};
139 139
140&scpi_clocks {
141 status = "disabled";
142};
143
140&uart_AO { 144&uart_AO {
141 status = "okay"; 145 status = "okay";
142 pinctrl-0 = <&uart_ao_a_pins>; 146 pinctrl-0 = <&uart_ao_a_pins>;
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..b35307321b63 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi
@@ -55,7 +55,7 @@
55 mboxes = <&mailbox 1 &mailbox 2>; 55 mboxes = <&mailbox 1 &mailbox 2>;
56 shmem = <&cpu_scp_lpri &cpu_scp_hpri>; 56 shmem = <&cpu_scp_lpri &cpu_scp_hpri>;
57 57
58 clocks { 58 scpi_clocks: clocks {
59 compatible = "arm,scpi-clocks"; 59 compatible = "arm,scpi-clocks";
60 60
61 scpi_dvfs: scpi_clocks@0 { 61 scpi_dvfs: scpi_clocks@0 {
@@ -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/exynos/exynos5433.dtsi b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
index 64226d5ae471..135890cd8a85 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
@@ -1367,7 +1367,7 @@
1367 }; 1367 };
1368 1368
1369 amba { 1369 amba {
1370 compatible = "arm,amba-bus"; 1370 compatible = "simple-bus";
1371 #address-cells = <1>; 1371 #address-cells = <1>;
1372 #size-cells = <1>; 1372 #size-cells = <1>;
1373 ranges; 1373 ranges;
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/boot/dts/xilinx/zynqmp-ep108.dts b/arch/arm64/boot/dts/xilinx/zynqmp-ep108.dts
index 358089687a69..ef1b9e573af0 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp-ep108.dts
+++ b/arch/arm64/boot/dts/xilinx/zynqmp-ep108.dts
@@ -27,7 +27,7 @@
27 stdout-path = "serial0:115200n8"; 27 stdout-path = "serial0:115200n8";
28 }; 28 };
29 29
30 memory { 30 memory@0 {
31 device_type = "memory"; 31 device_type = "memory";
32 reg = <0x0 0x0 0x0 0x40000000>; 32 reg = <0x0 0x0 0x0 0x40000000>;
33 }; 33 };
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi
index 68a908334c7b..54dc28351c8c 100644
--- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi
+++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi
@@ -72,7 +72,7 @@
72 <1 10 0xf08>; 72 <1 10 0xf08>;
73 }; 73 };
74 74
75 amba_apu { 75 amba_apu: amba_apu@0 {
76 compatible = "simple-bus"; 76 compatible = "simple-bus";
77 #address-cells = <2>; 77 #address-cells = <2>;
78 #size-cells = <1>; 78 #size-cells = <1>;
@@ -175,7 +175,7 @@
175 }; 175 };
176 176
177 i2c0: i2c@ff020000 { 177 i2c0: i2c@ff020000 {
178 compatible = "cdns,i2c-r1p10"; 178 compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
179 status = "disabled"; 179 status = "disabled";
180 interrupt-parent = <&gic>; 180 interrupt-parent = <&gic>;
181 interrupts = <0 17 4>; 181 interrupts = <0 17 4>;
@@ -185,7 +185,7 @@
185 }; 185 };
186 186
187 i2c1: i2c@ff030000 { 187 i2c1: i2c@ff030000 {
188 compatible = "cdns,i2c-r1p10"; 188 compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
189 status = "disabled"; 189 status = "disabled";
190 interrupt-parent = <&gic>; 190 interrupt-parent = <&gic>;
191 interrupts = <0 18 4>; 191 interrupts = <0 18 4>;
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/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/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/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_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/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/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/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/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/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/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/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/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/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