diff options
467 files changed, 4648 insertions, 2442 deletions
diff --git a/Documentation/devicetree/bindings/dma/rcar-audmapp.txt b/Documentation/devicetree/bindings/dma/rcar-audmapp.txt index 9f1d750d76de..61bca509d7b9 100644 --- a/Documentation/devicetree/bindings/dma/rcar-audmapp.txt +++ b/Documentation/devicetree/bindings/dma/rcar-audmapp.txt | |||
@@ -16,9 +16,9 @@ Example: | |||
16 | * DMA client | 16 | * DMA client |
17 | 17 | ||
18 | Required properties: | 18 | Required properties: |
19 | - dmas: a list of <[DMA multiplexer phandle] [SRS/DRS value]> pairs, | 19 | - dmas: a list of <[DMA multiplexer phandle] [SRS << 8 | DRS]> pairs. |
20 | where SRS/DRS values are fixed handles, specified in the SoC | 20 | where SRS/DRS are specified in the SoC manual. |
21 | manual as the value that would be written into the PDMACHCR. | 21 | It will be written into PDMACHCR as high 16-bit parts. |
22 | - dma-names: a list of DMA channel names, one per "dmas" entry | 22 | - dma-names: a list of DMA channel names, one per "dmas" entry |
23 | 23 | ||
24 | Example: | 24 | Example: |
diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt index 0ac23f2ed104..1852906517ab 100644 --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt | |||
@@ -11,10 +11,6 @@ Required properties: | |||
11 | 11 | ||
12 | Optional properties for main touchpad device: | 12 | Optional properties for main touchpad device: |
13 | 13 | ||
14 | - linux,gpio-keymap: An array of up to 4 entries indicating the Linux | ||
15 | keycode generated by each GPIO. Linux keycodes are defined in | ||
16 | <dt-bindings/input/input.h>. | ||
17 | |||
18 | - linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages | 14 | - linux,gpio-keymap: When enabled, the SPT_GPIOPWN_T19 object sends messages |
19 | on GPIO bit changes. An array of up to 8 entries can be provided | 15 | on GPIO bit changes. An array of up to 8 entries can be provided |
20 | indicating the Linux keycode mapped to each bit of the status byte, | 16 | indicating the Linux keycode mapped to each bit of the status byte, |
diff --git a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt index 6c55fcfe5e1d..9b82c20b306b 100644 --- a/Documentation/devicetree/bindings/sound/rockchip-i2s.txt +++ b/Documentation/devicetree/bindings/sound/rockchip-i2s.txt | |||
@@ -31,7 +31,7 @@ i2s@ff890000 { | |||
31 | #address-cells = <1>; | 31 | #address-cells = <1>; |
32 | #size-cells = <0>; | 32 | #size-cells = <0>; |
33 | dmas = <&pdma1 0>, <&pdma1 1>; | 33 | dmas = <&pdma1 0>, <&pdma1 1>; |
34 | dma-names = "rx", "tx"; | 34 | dma-names = "tx", "rx"; |
35 | clock-names = "i2s_hclk", "i2s_clk"; | 35 | clock-names = "i2s_hclk", "i2s_clk"; |
36 | clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; | 36 | clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>; |
37 | }; | 37 | }; |
diff --git a/Documentation/devicetree/bindings/spi/spi-rockchip.txt b/Documentation/devicetree/bindings/spi/spi-rockchip.txt index 7bab35575817..467dec441c62 100644 --- a/Documentation/devicetree/bindings/spi/spi-rockchip.txt +++ b/Documentation/devicetree/bindings/spi/spi-rockchip.txt | |||
@@ -16,11 +16,15 @@ Required Properties: | |||
16 | - clocks: Must contain an entry for each entry in clock-names. | 16 | - clocks: Must contain an entry for each entry in clock-names. |
17 | - clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for | 17 | - clock-names: Shall be "spiclk" for the transfer-clock, and "apb_pclk" for |
18 | the peripheral clock. | 18 | the peripheral clock. |
19 | - #address-cells: should be 1. | ||
20 | - #size-cells: should be 0. | ||
21 | |||
22 | Optional Properties: | ||
23 | |||
19 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, | 24 | - dmas: DMA specifiers for tx and rx dma. See the DMA client binding, |
20 | Documentation/devicetree/bindings/dma/dma.txt | 25 | Documentation/devicetree/bindings/dma/dma.txt |
21 | - dma-names: DMA request names should include "tx" and "rx" if present. | 26 | - dma-names: DMA request names should include "tx" and "rx" if present. |
22 | - #address-cells: should be 1. | 27 | |
23 | - #size-cells: should be 0. | ||
24 | 28 | ||
25 | Example: | 29 | Example: |
26 | 30 | ||
diff --git a/Documentation/devicetree/bindings/usb/mxs-phy.txt b/Documentation/devicetree/bindings/usb/mxs-phy.txt index cef181a9d8bd..96681c93b86d 100644 --- a/Documentation/devicetree/bindings/usb/mxs-phy.txt +++ b/Documentation/devicetree/bindings/usb/mxs-phy.txt | |||
@@ -5,6 +5,7 @@ Required properties: | |||
5 | * "fsl,imx23-usbphy" for imx23 and imx28 | 5 | * "fsl,imx23-usbphy" for imx23 and imx28 |
6 | * "fsl,imx6q-usbphy" for imx6dq and imx6dl | 6 | * "fsl,imx6q-usbphy" for imx6dq and imx6dl |
7 | * "fsl,imx6sl-usbphy" for imx6sl | 7 | * "fsl,imx6sl-usbphy" for imx6sl |
8 | * "fsl,imx6sx-usbphy" for imx6sx | ||
8 | "fsl,imx23-usbphy" is still a fallback for other strings | 9 | "fsl,imx23-usbphy" is still a fallback for other strings |
9 | - reg: Should contain registers location and length | 10 | - reg: Should contain registers location and length |
10 | - interrupts: Should contain phy interrupt | 11 | - interrupts: Should contain phy interrupt |
diff --git a/Documentation/devicetree/bindings/video/analog-tv-connector.txt b/Documentation/devicetree/bindings/video/analog-tv-connector.txt index 0218fcdc1299..0c0970c210ab 100644 --- a/Documentation/devicetree/bindings/video/analog-tv-connector.txt +++ b/Documentation/devicetree/bindings/video/analog-tv-connector.txt | |||
@@ -2,7 +2,7 @@ Analog TV Connector | |||
2 | =================== | 2 | =================== |
3 | 3 | ||
4 | Required properties: | 4 | Required properties: |
5 | - compatible: "composite-connector" or "svideo-connector" | 5 | - compatible: "composite-video-connector" or "svideo-connector" |
6 | 6 | ||
7 | Optional properties: | 7 | Optional properties: |
8 | - label: a symbolic name for the connector | 8 | - label: a symbolic name for the connector |
@@ -14,7 +14,7 @@ Example | |||
14 | ------- | 14 | ------- |
15 | 15 | ||
16 | tv: connector { | 16 | tv: connector { |
17 | compatible = "composite-connector"; | 17 | compatible = "composite-video-connector"; |
18 | label = "tv"; | 18 | label = "tv"; |
19 | 19 | ||
20 | port { | 20 | port { |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 5ae8608ca9f5..10d51c2f10d7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -3541,6 +3541,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3541 | bogus residue values); | 3541 | bogus residue values); |
3542 | s = SINGLE_LUN (the device has only one | 3542 | s = SINGLE_LUN (the device has only one |
3543 | Logical Unit); | 3543 | Logical Unit); |
3544 | u = IGNORE_UAS (don't bind to the uas driver); | ||
3544 | w = NO_WP_DETECT (don't test whether the | 3545 | w = NO_WP_DETECT (don't test whether the |
3545 | medium is write-protected). | 3546 | medium is write-protected). |
3546 | Example: quirks=0419:aaf5:rl,0421:0433:rc | 3547 | Example: quirks=0419:aaf5:rl,0421:0433:rc |
diff --git a/Documentation/networking/filter.txt b/Documentation/networking/filter.txt index 81916ab5d96f..014e0319a5c4 100644 --- a/Documentation/networking/filter.txt +++ b/Documentation/networking/filter.txt | |||
@@ -462,9 +462,9 @@ JIT compiler | |||
462 | ------------ | 462 | ------------ |
463 | 463 | ||
464 | The Linux kernel has a built-in BPF JIT compiler for x86_64, SPARC, PowerPC, | 464 | The Linux kernel has a built-in BPF JIT compiler for x86_64, SPARC, PowerPC, |
465 | ARM and s390 and can be enabled through CONFIG_BPF_JIT. The JIT compiler is | 465 | ARM, MIPS and s390 and can be enabled through CONFIG_BPF_JIT. The JIT compiler |
466 | transparently invoked for each attached filter from user space or for internal | 466 | is transparently invoked for each attached filter from user space or for |
467 | kernel users if it has been previously enabled by root: | 467 | internal kernel users if it has been previously enabled by root: |
468 | 468 | ||
469 | echo 1 > /proc/sys/net/core/bpf_jit_enable | 469 | echo 1 > /proc/sys/net/core/bpf_jit_enable |
470 | 470 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index b4e23acc6441..f8db3c3acc67 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -6425,7 +6425,8 @@ F: Documentation/scsi/NinjaSCSI.txt | |||
6425 | F: drivers/scsi/nsp32* | 6425 | F: drivers/scsi/nsp32* |
6426 | 6426 | ||
6427 | NTB DRIVER | 6427 | NTB DRIVER |
6428 | M: Jon Mason <jon.mason@intel.com> | 6428 | M: Jon Mason <jdmason@kudzu.us> |
6429 | M: Dave Jiang <dave.jiang@intel.com> | ||
6429 | S: Supported | 6430 | S: Supported |
6430 | W: https://github.com/jonmason/ntb/wiki | 6431 | W: https://github.com/jonmason/ntb/wiki |
6431 | T: git git://github.com/jonmason/ntb.git | 6432 | T: git git://github.com/jonmason/ntb.git |
@@ -6876,7 +6877,7 @@ F: arch/x86/kernel/quirks.c | |||
6876 | 6877 | ||
6877 | PCI DRIVER FOR IMX6 | 6878 | PCI DRIVER FOR IMX6 |
6878 | M: Richard Zhu <r65037@freescale.com> | 6879 | M: Richard Zhu <r65037@freescale.com> |
6879 | M: Shawn Guo <shawn.guo@freescale.com> | 6880 | M: Lucas Stach <l.stach@pengutronix.de> |
6880 | L: linux-pci@vger.kernel.org | 6881 | L: linux-pci@vger.kernel.org |
6881 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 6882 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
6882 | S: Maintained | 6883 | S: Maintained |
@@ -7054,7 +7055,7 @@ S: Maintained | |||
7054 | F: drivers/pinctrl/sh-pfc/ | 7055 | F: drivers/pinctrl/sh-pfc/ |
7055 | 7056 | ||
7056 | PIN CONTROLLER - SAMSUNG | 7057 | PIN CONTROLLER - SAMSUNG |
7057 | M: Tomasz Figa <t.figa@samsung.com> | 7058 | M: Tomasz Figa <tomasz.figa@gmail.com> |
7058 | M: Thomas Abraham <thomas.abraham@linaro.org> | 7059 | M: Thomas Abraham <thomas.abraham@linaro.org> |
7059 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 7060 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
7060 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 7061 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
@@ -7900,7 +7901,8 @@ S: Supported | |||
7900 | F: drivers/media/i2c/s5k5baf.c | 7901 | F: drivers/media/i2c/s5k5baf.c |
7901 | 7902 | ||
7902 | SAMSUNG SOC CLOCK DRIVERS | 7903 | SAMSUNG SOC CLOCK DRIVERS |
7903 | M: Tomasz Figa <t.figa@samsung.com> | 7904 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
7905 | M: Tomasz Figa <tomasz.figa@gmail.com> | ||
7904 | S: Supported | 7906 | S: Supported |
7905 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 7907 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
7906 | F: drivers/clk/samsung/ | 7908 | F: drivers/clk/samsung/ |
@@ -7913,6 +7915,19 @@ S: Supported | |||
7913 | L: netdev@vger.kernel.org | 7915 | L: netdev@vger.kernel.org |
7914 | F: drivers/net/ethernet/samsung/sxgbe/ | 7916 | F: drivers/net/ethernet/samsung/sxgbe/ |
7915 | 7917 | ||
7918 | SAMSUNG USB2 PHY DRIVER | ||
7919 | M: Kamil Debski <k.debski@samsung.com> | ||
7920 | L: linux-kernel@vger.kernel.org | ||
7921 | S: Supported | ||
7922 | F: Documentation/devicetree/bindings/phy/samsung-phy.txt | ||
7923 | F: Documentation/phy/samsung-usb2.txt | ||
7924 | F: drivers/phy/phy-exynos4210-usb2.c | ||
7925 | F: drivers/phy/phy-exynos4x12-usb2.c | ||
7926 | F: drivers/phy/phy-exynos5250-usb2.c | ||
7927 | F: drivers/phy/phy-s5pv210-usb2.c | ||
7928 | F: drivers/phy/phy-samsung-usb2.c | ||
7929 | F: drivers/phy/phy-samsung-usb2.h | ||
7930 | |||
7916 | SERIAL DRIVERS | 7931 | SERIAL DRIVERS |
7917 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 7932 | M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
7918 | L: linux-serial@vger.kernel.org | 7933 | L: linux-serial@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 17 | 2 | PATCHLEVEL = 17 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc6 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 1fe45d1f75ec..4361777a08d8 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -93,7 +93,7 @@ | |||
93 | }; | 93 | }; |
94 | 94 | ||
95 | tv: connector { | 95 | tv: connector { |
96 | compatible = "composite-connector"; | 96 | compatible = "composite-video-connector"; |
97 | label = "tv"; | 97 | label = "tv"; |
98 | 98 | ||
99 | port { | 99 | port { |
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h index 83259b873333..36172adda9d0 100644 --- a/arch/arm/include/asm/tls.h +++ b/arch/arm/include/asm/tls.h | |||
@@ -1,6 +1,9 @@ | |||
1 | #ifndef __ASMARM_TLS_H | 1 | #ifndef __ASMARM_TLS_H |
2 | #define __ASMARM_TLS_H | 2 | #define __ASMARM_TLS_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | ||
5 | #include <asm/thread_info.h> | ||
6 | |||
4 | #ifdef __ASSEMBLY__ | 7 | #ifdef __ASSEMBLY__ |
5 | #include <asm/asm-offsets.h> | 8 | #include <asm/asm-offsets.h> |
6 | .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2 | 9 | .macro switch_tls_none, base, tp, tpuser, tmp1, tmp2 |
@@ -50,6 +53,47 @@ | |||
50 | #endif | 53 | #endif |
51 | 54 | ||
52 | #ifndef __ASSEMBLY__ | 55 | #ifndef __ASSEMBLY__ |
56 | |||
57 | static inline void set_tls(unsigned long val) | ||
58 | { | ||
59 | struct thread_info *thread; | ||
60 | |||
61 | thread = current_thread_info(); | ||
62 | |||
63 | thread->tp_value[0] = val; | ||
64 | |||
65 | /* | ||
66 | * This code runs with preemption enabled and therefore must | ||
67 | * be reentrant with respect to switch_tls. | ||
68 | * | ||
69 | * We need to ensure ordering between the shadow state and the | ||
70 | * hardware state, so that we don't corrupt the hardware state | ||
71 | * with a stale shadow state during context switch. | ||
72 | * | ||
73 | * If we're preempted here, switch_tls will load TPIDRURO from | ||
74 | * thread_info upon resuming execution and the following mcr | ||
75 | * is merely redundant. | ||
76 | */ | ||
77 | barrier(); | ||
78 | |||
79 | if (!tls_emu) { | ||
80 | if (has_tls_reg) { | ||
81 | asm("mcr p15, 0, %0, c13, c0, 3" | ||
82 | : : "r" (val)); | ||
83 | } else { | ||
84 | /* | ||
85 | * User space must never try to access this | ||
86 | * directly. Expect your app to break | ||
87 | * eventually if you do so. The user helper | ||
88 | * at 0xffff0fe0 must be used instead. (see | ||
89 | * entry-armv.S for details) | ||
90 | */ | ||
91 | *((unsigned int *)0xffff0ff0) = val; | ||
92 | } | ||
93 | |||
94 | } | ||
95 | } | ||
96 | |||
53 | static inline unsigned long get_tpuser(void) | 97 | static inline unsigned long get_tpuser(void) |
54 | { | 98 | { |
55 | unsigned long reg = 0; | 99 | unsigned long reg = 0; |
@@ -59,5 +103,23 @@ static inline unsigned long get_tpuser(void) | |||
59 | 103 | ||
60 | return reg; | 104 | return reg; |
61 | } | 105 | } |
106 | |||
107 | static inline void set_tpuser(unsigned long val) | ||
108 | { | ||
109 | /* Since TPIDRURW is fully context-switched (unlike TPIDRURO), | ||
110 | * we need not update thread_info. | ||
111 | */ | ||
112 | if (has_tls_reg && !tls_emu) { | ||
113 | asm("mcr p15, 0, %0, c13, c0, 2" | ||
114 | : : "r" (val)); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | static inline void flush_tls(void) | ||
119 | { | ||
120 | set_tls(0); | ||
121 | set_tpuser(0); | ||
122 | } | ||
123 | |||
62 | #endif | 124 | #endif |
63 | #endif /* __ASMARM_TLS_H */ | 125 | #endif /* __ASMARM_TLS_H */ |
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index a4cd7af475e9..4767eb9caa78 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h | |||
@@ -107,8 +107,11 @@ static inline void set_fs(mm_segment_t fs) | |||
107 | extern int __get_user_1(void *); | 107 | extern int __get_user_1(void *); |
108 | extern int __get_user_2(void *); | 108 | extern int __get_user_2(void *); |
109 | extern int __get_user_4(void *); | 109 | extern int __get_user_4(void *); |
110 | extern int __get_user_lo8(void *); | 110 | extern int __get_user_32t_8(void *); |
111 | extern int __get_user_8(void *); | 111 | extern int __get_user_8(void *); |
112 | extern int __get_user_64t_1(void *); | ||
113 | extern int __get_user_64t_2(void *); | ||
114 | extern int __get_user_64t_4(void *); | ||
112 | 115 | ||
113 | #define __GUP_CLOBBER_1 "lr", "cc" | 116 | #define __GUP_CLOBBER_1 "lr", "cc" |
114 | #ifdef CONFIG_CPU_USE_DOMAINS | 117 | #ifdef CONFIG_CPU_USE_DOMAINS |
@@ -117,7 +120,7 @@ extern int __get_user_8(void *); | |||
117 | #define __GUP_CLOBBER_2 "lr", "cc" | 120 | #define __GUP_CLOBBER_2 "lr", "cc" |
118 | #endif | 121 | #endif |
119 | #define __GUP_CLOBBER_4 "lr", "cc" | 122 | #define __GUP_CLOBBER_4 "lr", "cc" |
120 | #define __GUP_CLOBBER_lo8 "lr", "cc" | 123 | #define __GUP_CLOBBER_32t_8 "lr", "cc" |
121 | #define __GUP_CLOBBER_8 "lr", "cc" | 124 | #define __GUP_CLOBBER_8 "lr", "cc" |
122 | 125 | ||
123 | #define __get_user_x(__r2,__p,__e,__l,__s) \ | 126 | #define __get_user_x(__r2,__p,__e,__l,__s) \ |
@@ -131,12 +134,30 @@ extern int __get_user_8(void *); | |||
131 | 134 | ||
132 | /* narrowing a double-word get into a single 32bit word register: */ | 135 | /* narrowing a double-word get into a single 32bit word register: */ |
133 | #ifdef __ARMEB__ | 136 | #ifdef __ARMEB__ |
134 | #define __get_user_xb(__r2, __p, __e, __l, __s) \ | 137 | #define __get_user_x_32t(__r2, __p, __e, __l, __s) \ |
135 | __get_user_x(__r2, __p, __e, __l, lo8) | 138 | __get_user_x(__r2, __p, __e, __l, 32t_8) |
136 | #else | 139 | #else |
137 | #define __get_user_xb __get_user_x | 140 | #define __get_user_x_32t __get_user_x |
138 | #endif | 141 | #endif |
139 | 142 | ||
143 | /* | ||
144 | * storing result into proper least significant word of 64bit target var, | ||
145 | * different only for big endian case where 64 bit __r2 lsw is r3: | ||
146 | */ | ||
147 | #ifdef __ARMEB__ | ||
148 | #define __get_user_x_64t(__r2, __p, __e, __l, __s) \ | ||
149 | __asm__ __volatile__ ( \ | ||
150 | __asmeq("%0", "r0") __asmeq("%1", "r2") \ | ||
151 | __asmeq("%3", "r1") \ | ||
152 | "bl __get_user_64t_" #__s \ | ||
153 | : "=&r" (__e), "=r" (__r2) \ | ||
154 | : "0" (__p), "r" (__l) \ | ||
155 | : __GUP_CLOBBER_##__s) | ||
156 | #else | ||
157 | #define __get_user_x_64t __get_user_x | ||
158 | #endif | ||
159 | |||
160 | |||
140 | #define __get_user_check(x,p) \ | 161 | #define __get_user_check(x,p) \ |
141 | ({ \ | 162 | ({ \ |
142 | unsigned long __limit = current_thread_info()->addr_limit - 1; \ | 163 | unsigned long __limit = current_thread_info()->addr_limit - 1; \ |
@@ -146,17 +167,26 @@ extern int __get_user_8(void *); | |||
146 | register int __e asm("r0"); \ | 167 | register int __e asm("r0"); \ |
147 | switch (sizeof(*(__p))) { \ | 168 | switch (sizeof(*(__p))) { \ |
148 | case 1: \ | 169 | case 1: \ |
149 | __get_user_x(__r2, __p, __e, __l, 1); \ | 170 | if (sizeof((x)) >= 8) \ |
171 | __get_user_x_64t(__r2, __p, __e, __l, 1); \ | ||
172 | else \ | ||
173 | __get_user_x(__r2, __p, __e, __l, 1); \ | ||
150 | break; \ | 174 | break; \ |
151 | case 2: \ | 175 | case 2: \ |
152 | __get_user_x(__r2, __p, __e, __l, 2); \ | 176 | if (sizeof((x)) >= 8) \ |
177 | __get_user_x_64t(__r2, __p, __e, __l, 2); \ | ||
178 | else \ | ||
179 | __get_user_x(__r2, __p, __e, __l, 2); \ | ||
153 | break; \ | 180 | break; \ |
154 | case 4: \ | 181 | case 4: \ |
155 | __get_user_x(__r2, __p, __e, __l, 4); \ | 182 | if (sizeof((x)) >= 8) \ |
183 | __get_user_x_64t(__r2, __p, __e, __l, 4); \ | ||
184 | else \ | ||
185 | __get_user_x(__r2, __p, __e, __l, 4); \ | ||
156 | break; \ | 186 | break; \ |
157 | case 8: \ | 187 | case 8: \ |
158 | if (sizeof((x)) < 8) \ | 188 | if (sizeof((x)) < 8) \ |
159 | __get_user_xb(__r2, __p, __e, __l, 4); \ | 189 | __get_user_x_32t(__r2, __p, __e, __l, 4); \ |
160 | else \ | 190 | else \ |
161 | __get_user_x(__r2, __p, __e, __l, 8); \ | 191 | __get_user_x(__r2, __p, __e, __l, 8); \ |
162 | break; \ | 192 | break; \ |
diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h index 1109017499e5..e8275ea88e88 100644 --- a/arch/arm/include/asm/xen/page-coherent.h +++ b/arch/arm/include/asm/xen/page-coherent.h | |||
@@ -26,25 +26,14 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | |||
26 | __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); | 26 | __generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | 29 | void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, |
30 | size_t size, enum dma_data_direction dir, | 30 | size_t size, enum dma_data_direction dir, |
31 | struct dma_attrs *attrs) | 31 | struct dma_attrs *attrs); |
32 | { | ||
33 | if (__generic_dma_ops(hwdev)->unmap_page) | ||
34 | __generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); | ||
35 | } | ||
36 | 32 | ||
37 | static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | 33 | void xen_dma_sync_single_for_cpu(struct device *hwdev, |
38 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | 34 | dma_addr_t handle, size_t size, enum dma_data_direction dir); |
39 | { | 35 | |
40 | if (__generic_dma_ops(hwdev)->sync_single_for_cpu) | 36 | void xen_dma_sync_single_for_device(struct device *hwdev, |
41 | __generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); | 37 | dma_addr_t handle, size_t size, enum dma_data_direction dir); |
42 | } | ||
43 | 38 | ||
44 | static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
45 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
46 | { | ||
47 | if (__generic_dma_ops(hwdev)->sync_single_for_device) | ||
48 | __generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); | ||
49 | } | ||
50 | #endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ | 39 | #endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ |
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index ded062f9b358..135c24a5ba26 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h | |||
@@ -33,7 +33,6 @@ typedef struct xpaddr { | |||
33 | #define INVALID_P2M_ENTRY (~0UL) | 33 | #define INVALID_P2M_ENTRY (~0UL) |
34 | 34 | ||
35 | unsigned long __pfn_to_mfn(unsigned long pfn); | 35 | unsigned long __pfn_to_mfn(unsigned long pfn); |
36 | unsigned long __mfn_to_pfn(unsigned long mfn); | ||
37 | extern struct rb_root phys_to_mach; | 36 | extern struct rb_root phys_to_mach; |
38 | 37 | ||
39 | static inline unsigned long pfn_to_mfn(unsigned long pfn) | 38 | static inline unsigned long pfn_to_mfn(unsigned long pfn) |
@@ -51,14 +50,6 @@ static inline unsigned long pfn_to_mfn(unsigned long pfn) | |||
51 | 50 | ||
52 | static inline unsigned long mfn_to_pfn(unsigned long mfn) | 51 | static inline unsigned long mfn_to_pfn(unsigned long mfn) |
53 | { | 52 | { |
54 | unsigned long pfn; | ||
55 | |||
56 | if (phys_to_mach.rb_node != NULL) { | ||
57 | pfn = __mfn_to_pfn(mfn); | ||
58 | if (pfn != INVALID_P2M_ENTRY) | ||
59 | return pfn; | ||
60 | } | ||
61 | |||
62 | return mfn; | 53 | return mfn; |
63 | } | 54 | } |
64 | 55 | ||
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index f7b450f97e68..a88671cfe1ff 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -98,6 +98,14 @@ EXPORT_SYMBOL(__clear_user); | |||
98 | EXPORT_SYMBOL(__get_user_1); | 98 | EXPORT_SYMBOL(__get_user_1); |
99 | EXPORT_SYMBOL(__get_user_2); | 99 | EXPORT_SYMBOL(__get_user_2); |
100 | EXPORT_SYMBOL(__get_user_4); | 100 | EXPORT_SYMBOL(__get_user_4); |
101 | EXPORT_SYMBOL(__get_user_8); | ||
102 | |||
103 | #ifdef __ARMEB__ | ||
104 | EXPORT_SYMBOL(__get_user_64t_1); | ||
105 | EXPORT_SYMBOL(__get_user_64t_2); | ||
106 | EXPORT_SYMBOL(__get_user_64t_4); | ||
107 | EXPORT_SYMBOL(__get_user_32t_8); | ||
108 | #endif | ||
101 | 109 | ||
102 | EXPORT_SYMBOL(__put_user_1); | 110 | EXPORT_SYMBOL(__put_user_1); |
103 | EXPORT_SYMBOL(__put_user_2); | 111 | EXPORT_SYMBOL(__put_user_2); |
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 2c4257604513..5c4d38e32a51 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
@@ -175,7 +175,7 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
175 | c = irq_data_get_irq_chip(d); | 175 | c = irq_data_get_irq_chip(d); |
176 | if (!c->irq_set_affinity) | 176 | if (!c->irq_set_affinity) |
177 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 177 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
178 | else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | 178 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) |
179 | cpumask_copy(d->affinity, affinity); | 179 | cpumask_copy(d->affinity, affinity); |
180 | 180 | ||
181 | return ret; | 181 | return ret; |
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index e6a6edbec613..4bf4cce759fe 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c | |||
@@ -76,21 +76,15 @@ static struct pmu_hw_events *cpu_pmu_get_cpu_events(void) | |||
76 | 76 | ||
77 | static void cpu_pmu_enable_percpu_irq(void *data) | 77 | static void cpu_pmu_enable_percpu_irq(void *data) |
78 | { | 78 | { |
79 | struct arm_pmu *cpu_pmu = data; | 79 | int irq = *(int *)data; |
80 | struct platform_device *pmu_device = cpu_pmu->plat_device; | ||
81 | int irq = platform_get_irq(pmu_device, 0); | ||
82 | 80 | ||
83 | enable_percpu_irq(irq, IRQ_TYPE_NONE); | 81 | enable_percpu_irq(irq, IRQ_TYPE_NONE); |
84 | cpumask_set_cpu(smp_processor_id(), &cpu_pmu->active_irqs); | ||
85 | } | 82 | } |
86 | 83 | ||
87 | static void cpu_pmu_disable_percpu_irq(void *data) | 84 | static void cpu_pmu_disable_percpu_irq(void *data) |
88 | { | 85 | { |
89 | struct arm_pmu *cpu_pmu = data; | 86 | int irq = *(int *)data; |
90 | struct platform_device *pmu_device = cpu_pmu->plat_device; | ||
91 | int irq = platform_get_irq(pmu_device, 0); | ||
92 | 87 | ||
93 | cpumask_clear_cpu(smp_processor_id(), &cpu_pmu->active_irqs); | ||
94 | disable_percpu_irq(irq); | 88 | disable_percpu_irq(irq); |
95 | } | 89 | } |
96 | 90 | ||
@@ -103,7 +97,7 @@ static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu) | |||
103 | 97 | ||
104 | irq = platform_get_irq(pmu_device, 0); | 98 | irq = platform_get_irq(pmu_device, 0); |
105 | if (irq >= 0 && irq_is_percpu(irq)) { | 99 | if (irq >= 0 && irq_is_percpu(irq)) { |
106 | on_each_cpu(cpu_pmu_disable_percpu_irq, cpu_pmu, 1); | 100 | on_each_cpu(cpu_pmu_disable_percpu_irq, &irq, 1); |
107 | free_percpu_irq(irq, &percpu_pmu); | 101 | free_percpu_irq(irq, &percpu_pmu); |
108 | } else { | 102 | } else { |
109 | for (i = 0; i < irqs; ++i) { | 103 | for (i = 0; i < irqs; ++i) { |
@@ -138,7 +132,7 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) | |||
138 | irq); | 132 | irq); |
139 | return err; | 133 | return err; |
140 | } | 134 | } |
141 | on_each_cpu(cpu_pmu_enable_percpu_irq, cpu_pmu, 1); | 135 | on_each_cpu(cpu_pmu_enable_percpu_irq, &irq, 1); |
142 | } else { | 136 | } else { |
143 | for (i = 0; i < irqs; ++i) { | 137 | for (i = 0; i < irqs; ++i) { |
144 | err = 0; | 138 | err = 0; |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 81ef686a91ca..a35f6ebbd2c2 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -334,6 +334,8 @@ void flush_thread(void) | |||
334 | memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); | 334 | memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); |
335 | memset(&thread->fpstate, 0, sizeof(union fp_state)); | 335 | memset(&thread->fpstate, 0, sizeof(union fp_state)); |
336 | 336 | ||
337 | flush_tls(); | ||
338 | |||
337 | thread_notify(THREAD_NOTIFY_FLUSH, thread); | 339 | thread_notify(THREAD_NOTIFY_FLUSH, thread); |
338 | } | 340 | } |
339 | 341 | ||
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c index 67ca8578c6d8..587fdfe1a72c 100644 --- a/arch/arm/kernel/swp_emulate.c +++ b/arch/arm/kernel/swp_emulate.c | |||
@@ -142,14 +142,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data, | |||
142 | while (1) { | 142 | while (1) { |
143 | unsigned long temp; | 143 | unsigned long temp; |
144 | 144 | ||
145 | /* | ||
146 | * Barrier required between accessing protected resource and | ||
147 | * releasing a lock for it. Legacy code might not have done | ||
148 | * this, and we cannot determine that this is not the case | ||
149 | * being emulated, so insert always. | ||
150 | */ | ||
151 | smp_mb(); | ||
152 | |||
153 | if (type == TYPE_SWPB) | 145 | if (type == TYPE_SWPB) |
154 | __user_swpb_asm(*data, address, res, temp); | 146 | __user_swpb_asm(*data, address, res, temp); |
155 | else | 147 | else |
@@ -162,13 +154,6 @@ static int emulate_swpX(unsigned int address, unsigned int *data, | |||
162 | } | 154 | } |
163 | 155 | ||
164 | if (res == 0) { | 156 | if (res == 0) { |
165 | /* | ||
166 | * Barrier also required between acquiring a lock for a | ||
167 | * protected resource and accessing the resource. Inserted for | ||
168 | * same reason as above. | ||
169 | */ | ||
170 | smp_mb(); | ||
171 | |||
172 | if (type == TYPE_SWPB) | 157 | if (type == TYPE_SWPB) |
173 | swpbcounter++; | 158 | swpbcounter++; |
174 | else | 159 | else |
diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c index 7b8403b76666..80f0d69205e7 100644 --- a/arch/arm/kernel/thumbee.c +++ b/arch/arm/kernel/thumbee.c | |||
@@ -45,7 +45,7 @@ static int thumbee_notifier(struct notifier_block *self, unsigned long cmd, void | |||
45 | 45 | ||
46 | switch (cmd) { | 46 | switch (cmd) { |
47 | case THREAD_NOTIFY_FLUSH: | 47 | case THREAD_NOTIFY_FLUSH: |
48 | thread->thumbee_state = 0; | 48 | teehbr_write(0); |
49 | break; | 49 | break; |
50 | case THREAD_NOTIFY_SWITCH: | 50 | case THREAD_NOTIFY_SWITCH: |
51 | current_thread_info()->thumbee_state = teehbr_read(); | 51 | current_thread_info()->thumbee_state = teehbr_read(); |
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index c8e4bb714944..a964c9f40f87 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -581,7 +581,6 @@ do_cache_op(unsigned long start, unsigned long end, int flags) | |||
581 | #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) | 581 | #define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE) |
582 | asmlinkage int arm_syscall(int no, struct pt_regs *regs) | 582 | asmlinkage int arm_syscall(int no, struct pt_regs *regs) |
583 | { | 583 | { |
584 | struct thread_info *thread = current_thread_info(); | ||
585 | siginfo_t info; | 584 | siginfo_t info; |
586 | 585 | ||
587 | if ((no >> 16) != (__ARM_NR_BASE>> 16)) | 586 | if ((no >> 16) != (__ARM_NR_BASE>> 16)) |
@@ -632,21 +631,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) | |||
632 | return regs->ARM_r0; | 631 | return regs->ARM_r0; |
633 | 632 | ||
634 | case NR(set_tls): | 633 | case NR(set_tls): |
635 | thread->tp_value[0] = regs->ARM_r0; | 634 | set_tls(regs->ARM_r0); |
636 | if (tls_emu) | ||
637 | return 0; | ||
638 | if (has_tls_reg) { | ||
639 | asm ("mcr p15, 0, %0, c13, c0, 3" | ||
640 | : : "r" (regs->ARM_r0)); | ||
641 | } else { | ||
642 | /* | ||
643 | * User space must never try to access this directly. | ||
644 | * Expect your app to break eventually if you do so. | ||
645 | * The user helper at 0xffff0fe0 must be used instead. | ||
646 | * (see entry-armv.S for details) | ||
647 | */ | ||
648 | *((unsigned int *)0xffff0ff0) = regs->ARM_r0; | ||
649 | } | ||
650 | return 0; | 635 | return 0; |
651 | 636 | ||
652 | #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG | 637 | #ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG |
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S index 938600098b88..8ecfd15c3a02 100644 --- a/arch/arm/lib/getuser.S +++ b/arch/arm/lib/getuser.S | |||
@@ -80,7 +80,7 @@ ENTRY(__get_user_8) | |||
80 | ENDPROC(__get_user_8) | 80 | ENDPROC(__get_user_8) |
81 | 81 | ||
82 | #ifdef __ARMEB__ | 82 | #ifdef __ARMEB__ |
83 | ENTRY(__get_user_lo8) | 83 | ENTRY(__get_user_32t_8) |
84 | check_uaccess r0, 8, r1, r2, __get_user_bad | 84 | check_uaccess r0, 8, r1, r2, __get_user_bad |
85 | #ifdef CONFIG_CPU_USE_DOMAINS | 85 | #ifdef CONFIG_CPU_USE_DOMAINS |
86 | add r0, r0, #4 | 86 | add r0, r0, #4 |
@@ -90,7 +90,37 @@ ENTRY(__get_user_lo8) | |||
90 | #endif | 90 | #endif |
91 | mov r0, #0 | 91 | mov r0, #0 |
92 | ret lr | 92 | ret lr |
93 | ENDPROC(__get_user_lo8) | 93 | ENDPROC(__get_user_32t_8) |
94 | |||
95 | ENTRY(__get_user_64t_1) | ||
96 | check_uaccess r0, 1, r1, r2, __get_user_bad8 | ||
97 | 8: TUSER(ldrb) r3, [r0] | ||
98 | mov r0, #0 | ||
99 | ret lr | ||
100 | ENDPROC(__get_user_64t_1) | ||
101 | |||
102 | ENTRY(__get_user_64t_2) | ||
103 | check_uaccess r0, 2, r1, r2, __get_user_bad8 | ||
104 | #ifdef CONFIG_CPU_USE_DOMAINS | ||
105 | rb .req ip | ||
106 | 9: ldrbt r3, [r0], #1 | ||
107 | 10: ldrbt rb, [r0], #0 | ||
108 | #else | ||
109 | rb .req r0 | ||
110 | 9: ldrb r3, [r0] | ||
111 | 10: ldrb rb, [r0, #1] | ||
112 | #endif | ||
113 | orr r3, rb, r3, lsl #8 | ||
114 | mov r0, #0 | ||
115 | ret lr | ||
116 | ENDPROC(__get_user_64t_2) | ||
117 | |||
118 | ENTRY(__get_user_64t_4) | ||
119 | check_uaccess r0, 4, r1, r2, __get_user_bad8 | ||
120 | 11: TUSER(ldr) r3, [r0] | ||
121 | mov r0, #0 | ||
122 | ret lr | ||
123 | ENDPROC(__get_user_64t_4) | ||
94 | #endif | 124 | #endif |
95 | 125 | ||
96 | __get_user_bad8: | 126 | __get_user_bad8: |
@@ -111,5 +141,9 @@ ENDPROC(__get_user_bad8) | |||
111 | .long 6b, __get_user_bad8 | 141 | .long 6b, __get_user_bad8 |
112 | #ifdef __ARMEB__ | 142 | #ifdef __ARMEB__ |
113 | .long 7b, __get_user_bad | 143 | .long 7b, __get_user_bad |
144 | .long 8b, __get_user_bad8 | ||
145 | .long 9b, __get_user_bad8 | ||
146 | .long 10b, __get_user_bad8 | ||
147 | .long 11b, __get_user_bad8 | ||
114 | #endif | 148 | #endif |
115 | .popsection | 149 | .popsection |
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S index 1a24e9232ec8..b64e67c7f176 100644 --- a/arch/arm/mm/proc-v7-3level.S +++ b/arch/arm/mm/proc-v7-3level.S | |||
@@ -146,7 +146,6 @@ ENDPROC(cpu_v7_set_pte_ext) | |||
146 | mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits | 146 | mov \tmp, \ttbr1, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits |
147 | mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits | 147 | mov \ttbr1, \ttbr1, lsl #ARCH_PGD_SHIFT @ lower bits |
148 | addls \ttbr1, \ttbr1, #TTBR1_OFFSET | 148 | addls \ttbr1, \ttbr1, #TTBR1_OFFSET |
149 | adcls \tmp, \tmp, #0 | ||
150 | mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1 | 149 | mcrr p15, 1, \ttbr1, \tmp, c2 @ load TTBR1 |
151 | mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits | 150 | mov \tmp, \ttbr0, lsr #(32 - ARCH_PGD_SHIFT) @ upper bits |
152 | mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits | 151 | mov \ttbr0, \ttbr0, lsl #ARCH_PGD_SHIFT @ lower bits |
diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile index 12969523414c..1f85bfe6b470 100644 --- a/arch/arm/xen/Makefile +++ b/arch/arm/xen/Makefile | |||
@@ -1 +1 @@ | |||
obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o | obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o mm32.o | ||
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 98544c5f86e9..0e15f011f9c8 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -260,6 +260,12 @@ static int __init xen_guest_init(void) | |||
260 | xen_domain_type = XEN_HVM_DOMAIN; | 260 | xen_domain_type = XEN_HVM_DOMAIN; |
261 | 261 | ||
262 | xen_setup_features(); | 262 | xen_setup_features(); |
263 | |||
264 | if (!xen_feature(XENFEAT_grant_map_identity)) { | ||
265 | pr_warn("Please upgrade your Xen.\n" | ||
266 | "If your platform has any non-coherent DMA devices, they won't work properly.\n"); | ||
267 | } | ||
268 | |||
263 | if (xen_feature(XENFEAT_dom0)) | 269 | if (xen_feature(XENFEAT_dom0)) |
264 | xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; | 270 | xen_start_info->flags |= SIF_INITDOMAIN|SIF_PRIVILEGED; |
265 | else | 271 | else |
diff --git a/arch/arm/xen/mm32.c b/arch/arm/xen/mm32.c new file mode 100644 index 000000000000..3b99860fd7ae --- /dev/null +++ b/arch/arm/xen/mm32.c | |||
@@ -0,0 +1,202 @@ | |||
1 | #include <linux/cpu.h> | ||
2 | #include <linux/dma-mapping.h> | ||
3 | #include <linux/gfp.h> | ||
4 | #include <linux/highmem.h> | ||
5 | |||
6 | #include <xen/features.h> | ||
7 | |||
8 | static DEFINE_PER_CPU(unsigned long, xen_mm32_scratch_virt); | ||
9 | static DEFINE_PER_CPU(pte_t *, xen_mm32_scratch_ptep); | ||
10 | |||
11 | static int alloc_xen_mm32_scratch_page(int cpu) | ||
12 | { | ||
13 | struct page *page; | ||
14 | unsigned long virt; | ||
15 | pmd_t *pmdp; | ||
16 | pte_t *ptep; | ||
17 | |||
18 | if (per_cpu(xen_mm32_scratch_ptep, cpu) != NULL) | ||
19 | return 0; | ||
20 | |||
21 | page = alloc_page(GFP_KERNEL); | ||
22 | if (page == NULL) { | ||
23 | pr_warn("Failed to allocate xen_mm32_scratch_page for cpu %d\n", cpu); | ||
24 | return -ENOMEM; | ||
25 | } | ||
26 | |||
27 | virt = (unsigned long)__va(page_to_phys(page)); | ||
28 | pmdp = pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); | ||
29 | ptep = pte_offset_kernel(pmdp, virt); | ||
30 | |||
31 | per_cpu(xen_mm32_scratch_virt, cpu) = virt; | ||
32 | per_cpu(xen_mm32_scratch_ptep, cpu) = ptep; | ||
33 | |||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static int xen_mm32_cpu_notify(struct notifier_block *self, | ||
38 | unsigned long action, void *hcpu) | ||
39 | { | ||
40 | int cpu = (long)hcpu; | ||
41 | switch (action) { | ||
42 | case CPU_UP_PREPARE: | ||
43 | if (alloc_xen_mm32_scratch_page(cpu)) | ||
44 | return NOTIFY_BAD; | ||
45 | break; | ||
46 | default: | ||
47 | break; | ||
48 | } | ||
49 | return NOTIFY_OK; | ||
50 | } | ||
51 | |||
52 | static struct notifier_block xen_mm32_cpu_notifier = { | ||
53 | .notifier_call = xen_mm32_cpu_notify, | ||
54 | }; | ||
55 | |||
56 | static void* xen_mm32_remap_page(dma_addr_t handle) | ||
57 | { | ||
58 | unsigned long virt = get_cpu_var(xen_mm32_scratch_virt); | ||
59 | pte_t *ptep = __get_cpu_var(xen_mm32_scratch_ptep); | ||
60 | |||
61 | *ptep = pfn_pte(handle >> PAGE_SHIFT, PAGE_KERNEL); | ||
62 | local_flush_tlb_kernel_page(virt); | ||
63 | |||
64 | return (void*)virt; | ||
65 | } | ||
66 | |||
67 | static void xen_mm32_unmap(void *vaddr) | ||
68 | { | ||
69 | put_cpu_var(xen_mm32_scratch_virt); | ||
70 | } | ||
71 | |||
72 | |||
73 | /* functions called by SWIOTLB */ | ||
74 | |||
75 | static void dma_cache_maint(dma_addr_t handle, unsigned long offset, | ||
76 | size_t size, enum dma_data_direction dir, | ||
77 | void (*op)(const void *, size_t, int)) | ||
78 | { | ||
79 | unsigned long pfn; | ||
80 | size_t left = size; | ||
81 | |||
82 | pfn = (handle >> PAGE_SHIFT) + offset / PAGE_SIZE; | ||
83 | offset %= PAGE_SIZE; | ||
84 | |||
85 | do { | ||
86 | size_t len = left; | ||
87 | void *vaddr; | ||
88 | |||
89 | if (!pfn_valid(pfn)) | ||
90 | { | ||
91 | /* Cannot map the page, we don't know its physical address. | ||
92 | * Return and hope for the best */ | ||
93 | if (!xen_feature(XENFEAT_grant_map_identity)) | ||
94 | return; | ||
95 | vaddr = xen_mm32_remap_page(handle) + offset; | ||
96 | op(vaddr, len, dir); | ||
97 | xen_mm32_unmap(vaddr - offset); | ||
98 | } else { | ||
99 | struct page *page = pfn_to_page(pfn); | ||
100 | |||
101 | if (PageHighMem(page)) { | ||
102 | if (len + offset > PAGE_SIZE) | ||
103 | len = PAGE_SIZE - offset; | ||
104 | |||
105 | if (cache_is_vipt_nonaliasing()) { | ||
106 | vaddr = kmap_atomic(page); | ||
107 | op(vaddr + offset, len, dir); | ||
108 | kunmap_atomic(vaddr); | ||
109 | } else { | ||
110 | vaddr = kmap_high_get(page); | ||
111 | if (vaddr) { | ||
112 | op(vaddr + offset, len, dir); | ||
113 | kunmap_high(page); | ||
114 | } | ||
115 | } | ||
116 | } else { | ||
117 | vaddr = page_address(page) + offset; | ||
118 | op(vaddr, len, dir); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | offset = 0; | ||
123 | pfn++; | ||
124 | left -= len; | ||
125 | } while (left); | ||
126 | } | ||
127 | |||
128 | static void __xen_dma_page_dev_to_cpu(struct device *hwdev, dma_addr_t handle, | ||
129 | size_t size, enum dma_data_direction dir) | ||
130 | { | ||
131 | /* Cannot use __dma_page_dev_to_cpu because we don't have a | ||
132 | * struct page for handle */ | ||
133 | |||
134 | if (dir != DMA_TO_DEVICE) | ||
135 | outer_inv_range(handle, handle + size); | ||
136 | |||
137 | dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, dmac_unmap_area); | ||
138 | } | ||
139 | |||
140 | static void __xen_dma_page_cpu_to_dev(struct device *hwdev, dma_addr_t handle, | ||
141 | size_t size, enum dma_data_direction dir) | ||
142 | { | ||
143 | |||
144 | dma_cache_maint(handle & PAGE_MASK, handle & ~PAGE_MASK, size, dir, dmac_map_area); | ||
145 | |||
146 | if (dir == DMA_FROM_DEVICE) { | ||
147 | outer_inv_range(handle, handle + size); | ||
148 | } else { | ||
149 | outer_clean_range(handle, handle + size); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
154 | size_t size, enum dma_data_direction dir, | ||
155 | struct dma_attrs *attrs) | ||
156 | |||
157 | { | ||
158 | if (!__generic_dma_ops(hwdev)->unmap_page) | ||
159 | return; | ||
160 | if (dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs)) | ||
161 | return; | ||
162 | |||
163 | __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); | ||
164 | } | ||
165 | |||
166 | void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
167 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
168 | { | ||
169 | if (!__generic_dma_ops(hwdev)->sync_single_for_cpu) | ||
170 | return; | ||
171 | __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); | ||
172 | } | ||
173 | |||
174 | void xen_dma_sync_single_for_device(struct device *hwdev, | ||
175 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
176 | { | ||
177 | if (!__generic_dma_ops(hwdev)->sync_single_for_device) | ||
178 | return; | ||
179 | __xen_dma_page_cpu_to_dev(hwdev, handle, size, dir); | ||
180 | } | ||
181 | |||
182 | int __init xen_mm32_init(void) | ||
183 | { | ||
184 | int cpu; | ||
185 | |||
186 | if (!xen_initial_domain()) | ||
187 | return 0; | ||
188 | |||
189 | register_cpu_notifier(&xen_mm32_cpu_notifier); | ||
190 | get_online_cpus(); | ||
191 | for_each_online_cpu(cpu) { | ||
192 | if (alloc_xen_mm32_scratch_page(cpu)) { | ||
193 | put_online_cpus(); | ||
194 | unregister_cpu_notifier(&xen_mm32_cpu_notifier); | ||
195 | return -ENOMEM; | ||
196 | } | ||
197 | } | ||
198 | put_online_cpus(); | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | arch_initcall(xen_mm32_init); | ||
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c index 97baf4427817..054857776254 100644 --- a/arch/arm/xen/p2m.c +++ b/arch/arm/xen/p2m.c | |||
@@ -21,14 +21,12 @@ struct xen_p2m_entry { | |||
21 | unsigned long pfn; | 21 | unsigned long pfn; |
22 | unsigned long mfn; | 22 | unsigned long mfn; |
23 | unsigned long nr_pages; | 23 | unsigned long nr_pages; |
24 | struct rb_node rbnode_mach; | ||
25 | struct rb_node rbnode_phys; | 24 | struct rb_node rbnode_phys; |
26 | }; | 25 | }; |
27 | 26 | ||
28 | static rwlock_t p2m_lock; | 27 | static rwlock_t p2m_lock; |
29 | struct rb_root phys_to_mach = RB_ROOT; | 28 | struct rb_root phys_to_mach = RB_ROOT; |
30 | EXPORT_SYMBOL_GPL(phys_to_mach); | 29 | EXPORT_SYMBOL_GPL(phys_to_mach); |
31 | static struct rb_root mach_to_phys = RB_ROOT; | ||
32 | 30 | ||
33 | static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) | 31 | static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) |
34 | { | 32 | { |
@@ -41,8 +39,6 @@ static int xen_add_phys_to_mach_entry(struct xen_p2m_entry *new) | |||
41 | parent = *link; | 39 | parent = *link; |
42 | entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys); | 40 | entry = rb_entry(parent, struct xen_p2m_entry, rbnode_phys); |
43 | 41 | ||
44 | if (new->mfn == entry->mfn) | ||
45 | goto err_out; | ||
46 | if (new->pfn == entry->pfn) | 42 | if (new->pfn == entry->pfn) |
47 | goto err_out; | 43 | goto err_out; |
48 | 44 | ||
@@ -88,64 +84,6 @@ unsigned long __pfn_to_mfn(unsigned long pfn) | |||
88 | } | 84 | } |
89 | EXPORT_SYMBOL_GPL(__pfn_to_mfn); | 85 | EXPORT_SYMBOL_GPL(__pfn_to_mfn); |
90 | 86 | ||
91 | static int xen_add_mach_to_phys_entry(struct xen_p2m_entry *new) | ||
92 | { | ||
93 | struct rb_node **link = &mach_to_phys.rb_node; | ||
94 | struct rb_node *parent = NULL; | ||
95 | struct xen_p2m_entry *entry; | ||
96 | int rc = 0; | ||
97 | |||
98 | while (*link) { | ||
99 | parent = *link; | ||
100 | entry = rb_entry(parent, struct xen_p2m_entry, rbnode_mach); | ||
101 | |||
102 | if (new->mfn == entry->mfn) | ||
103 | goto err_out; | ||
104 | if (new->pfn == entry->pfn) | ||
105 | goto err_out; | ||
106 | |||
107 | if (new->mfn < entry->mfn) | ||
108 | link = &(*link)->rb_left; | ||
109 | else | ||
110 | link = &(*link)->rb_right; | ||
111 | } | ||
112 | rb_link_node(&new->rbnode_mach, parent, link); | ||
113 | rb_insert_color(&new->rbnode_mach, &mach_to_phys); | ||
114 | goto out; | ||
115 | |||
116 | err_out: | ||
117 | rc = -EINVAL; | ||
118 | pr_warn("%s: cannot add pfn=%pa -> mfn=%pa: pfn=%pa -> mfn=%pa already exists\n", | ||
119 | __func__, &new->pfn, &new->mfn, &entry->pfn, &entry->mfn); | ||
120 | out: | ||
121 | return rc; | ||
122 | } | ||
123 | |||
124 | unsigned long __mfn_to_pfn(unsigned long mfn) | ||
125 | { | ||
126 | struct rb_node *n = mach_to_phys.rb_node; | ||
127 | struct xen_p2m_entry *entry; | ||
128 | unsigned long irqflags; | ||
129 | |||
130 | read_lock_irqsave(&p2m_lock, irqflags); | ||
131 | while (n) { | ||
132 | entry = rb_entry(n, struct xen_p2m_entry, rbnode_mach); | ||
133 | if (entry->mfn <= mfn && | ||
134 | entry->mfn + entry->nr_pages > mfn) { | ||
135 | read_unlock_irqrestore(&p2m_lock, irqflags); | ||
136 | return entry->pfn + (mfn - entry->mfn); | ||
137 | } | ||
138 | if (mfn < entry->mfn) | ||
139 | n = n->rb_left; | ||
140 | else | ||
141 | n = n->rb_right; | ||
142 | } | ||
143 | read_unlock_irqrestore(&p2m_lock, irqflags); | ||
144 | |||
145 | return INVALID_P2M_ENTRY; | ||
146 | } | ||
147 | EXPORT_SYMBOL_GPL(__mfn_to_pfn); | ||
148 | |||
149 | int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, | 87 | int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, |
150 | struct gnttab_map_grant_ref *kmap_ops, | 88 | struct gnttab_map_grant_ref *kmap_ops, |
151 | struct page **pages, unsigned int count) | 89 | struct page **pages, unsigned int count) |
@@ -192,7 +130,6 @@ bool __set_phys_to_machine_multi(unsigned long pfn, | |||
192 | p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys); | 130 | p2m_entry = rb_entry(n, struct xen_p2m_entry, rbnode_phys); |
193 | if (p2m_entry->pfn <= pfn && | 131 | if (p2m_entry->pfn <= pfn && |
194 | p2m_entry->pfn + p2m_entry->nr_pages > pfn) { | 132 | p2m_entry->pfn + p2m_entry->nr_pages > pfn) { |
195 | rb_erase(&p2m_entry->rbnode_mach, &mach_to_phys); | ||
196 | rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach); | 133 | rb_erase(&p2m_entry->rbnode_phys, &phys_to_mach); |
197 | write_unlock_irqrestore(&p2m_lock, irqflags); | 134 | write_unlock_irqrestore(&p2m_lock, irqflags); |
198 | kfree(p2m_entry); | 135 | kfree(p2m_entry); |
@@ -217,8 +154,7 @@ bool __set_phys_to_machine_multi(unsigned long pfn, | |||
217 | p2m_entry->mfn = mfn; | 154 | p2m_entry->mfn = mfn; |
218 | 155 | ||
219 | write_lock_irqsave(&p2m_lock, irqflags); | 156 | write_lock_irqsave(&p2m_lock, irqflags); |
220 | if ((rc = xen_add_phys_to_mach_entry(p2m_entry) < 0) || | 157 | if ((rc = xen_add_phys_to_mach_entry(p2m_entry)) < 0) { |
221 | (rc = xen_add_mach_to_phys_entry(p2m_entry) < 0)) { | ||
222 | write_unlock_irqrestore(&p2m_lock, irqflags); | 158 | write_unlock_irqrestore(&p2m_lock, irqflags); |
223 | return false; | 159 | return false; |
224 | } | 160 | } |
diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index 0f08dfd69ebc..dfa6e3e74fdd 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c | |||
@@ -97,19 +97,15 @@ static bool migrate_one_irq(struct irq_desc *desc) | |||
97 | if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) | 97 | if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) |
98 | return false; | 98 | return false; |
99 | 99 | ||
100 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) | 100 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { |
101 | affinity = cpu_online_mask; | ||
101 | ret = true; | 102 | ret = true; |
103 | } | ||
102 | 104 | ||
103 | /* | ||
104 | * when using forced irq_set_affinity we must ensure that the cpu | ||
105 | * being offlined is not present in the affinity mask, it may be | ||
106 | * selected as the target CPU otherwise | ||
107 | */ | ||
108 | affinity = cpu_online_mask; | ||
109 | c = irq_data_get_irq_chip(d); | 105 | c = irq_data_get_irq_chip(d); |
110 | if (!c->irq_set_affinity) | 106 | if (!c->irq_set_affinity) |
111 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | 107 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); |
112 | else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret) | 108 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) |
113 | cpumask_copy(d->affinity, affinity); | 109 | cpumask_copy(d->affinity, affinity); |
114 | 110 | ||
115 | return ret; | 111 | return ret; |
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 1309d64aa926..29d48690f2ac 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c | |||
@@ -230,9 +230,27 @@ void exit_thread(void) | |||
230 | { | 230 | { |
231 | } | 231 | } |
232 | 232 | ||
233 | static void tls_thread_flush(void) | ||
234 | { | ||
235 | asm ("msr tpidr_el0, xzr"); | ||
236 | |||
237 | if (is_compat_task()) { | ||
238 | current->thread.tp_value = 0; | ||
239 | |||
240 | /* | ||
241 | * We need to ensure ordering between the shadow state and the | ||
242 | * hardware state, so that we don't corrupt the hardware state | ||
243 | * with a stale shadow state during context switch. | ||
244 | */ | ||
245 | barrier(); | ||
246 | asm ("msr tpidrro_el0, xzr"); | ||
247 | } | ||
248 | } | ||
249 | |||
233 | void flush_thread(void) | 250 | void flush_thread(void) |
234 | { | 251 | { |
235 | fpsimd_flush_thread(); | 252 | fpsimd_flush_thread(); |
253 | tls_thread_flush(); | ||
236 | flush_ptrace_hw_breakpoint(current); | 254 | flush_ptrace_hw_breakpoint(current); |
237 | } | 255 | } |
238 | 256 | ||
diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index de2b0226e06d..dc47e53e9e28 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c | |||
@@ -79,6 +79,12 @@ long compat_arm_syscall(struct pt_regs *regs) | |||
79 | 79 | ||
80 | case __ARM_NR_compat_set_tls: | 80 | case __ARM_NR_compat_set_tls: |
81 | current->thread.tp_value = regs->regs[0]; | 81 | current->thread.tp_value = regs->regs[0]; |
82 | |||
83 | /* | ||
84 | * Protect against register corruption from context switch. | ||
85 | * See comment in tls_thread_flush. | ||
86 | */ | ||
87 | barrier(); | ||
82 | asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); | 88 | asm ("msr tpidrro_el0, %0" : : "r" (regs->regs[0])); |
83 | return 0; | 89 | return 0; |
84 | 90 | ||
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 5472c2401876..a83061f37e43 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -149,8 +149,7 @@ void __init arm64_memblock_init(void) | |||
149 | memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); | 149 | memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | if (!efi_enabled(EFI_MEMMAP)) | 152 | early_init_fdt_scan_reserved_mem(); |
153 | early_init_fdt_scan_reserved_mem(); | ||
154 | 153 | ||
155 | /* 4GB maximum for 32-bit only capable devices */ | 154 | /* 4GB maximum for 32-bit only capable devices */ |
156 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | 155 | if (IS_ENABLED(CONFIG_ZONE_DMA)) |
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h index 6a65bb7d0657..18026b2eb582 100644 --- a/arch/ia64/include/uapi/asm/unistd.h +++ b/arch/ia64/include/uapi/asm/unistd.h | |||
@@ -329,6 +329,6 @@ | |||
329 | #define __NR_sched_getattr 1337 | 329 | #define __NR_sched_getattr 1337 |
330 | #define __NR_renameat2 1338 | 330 | #define __NR_renameat2 1338 |
331 | #define __NR_getrandom 1339 | 331 | #define __NR_getrandom 1339 |
332 | #define __NR_memfd_create 1339 | 332 | #define __NR_memfd_create 1340 |
333 | 333 | ||
334 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ | 334 | #endif /* _UAPI_ASM_IA64_UNISTD_H */ |
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c index ec73b2cf912a..fc505d58f078 100644 --- a/arch/ia64/pci/fixup.c +++ b/arch/ia64/pci/fixup.c | |||
@@ -38,27 +38,6 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
38 | return; | 38 | return; |
39 | /* Maybe, this machine supports legacy memory map. */ | 39 | /* Maybe, this machine supports legacy memory map. */ |
40 | 40 | ||
41 | if (!vga_default_device()) { | ||
42 | resource_size_t start, end; | ||
43 | int i; | ||
44 | |||
45 | /* Does firmware framebuffer belong to us? */ | ||
46 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
47 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) | ||
48 | continue; | ||
49 | |||
50 | start = pci_resource_start(pdev, i); | ||
51 | end = pci_resource_end(pdev, i); | ||
52 | |||
53 | if (!start || !end) | ||
54 | continue; | ||
55 | |||
56 | if (screen_info.lfb_base >= start && | ||
57 | (screen_info.lfb_base + screen_info.lfb_size) < end) | ||
58 | vga_set_default_device(pdev); | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /* Is VGA routed to us? */ | 41 | /* Is VGA routed to us? */ |
63 | bus = pdev->bus; | 42 | bus = pdev->bus; |
64 | while (bus) { | 43 | while (bus) { |
@@ -83,8 +62,7 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
83 | pci_read_config_word(pdev, PCI_COMMAND, &config); | 62 | pci_read_config_word(pdev, PCI_COMMAND, &config); |
84 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { | 63 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { |
85 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; | 64 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; |
86 | dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); | 65 | dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); |
87 | vga_set_default_device(pdev); | ||
88 | } | 66 | } |
89 | } | 67 | } |
90 | } | 68 | } |
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 40e1c1dd0e24..6feded3b0c4c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -127,7 +127,7 @@ config SECCOMP | |||
127 | 127 | ||
128 | endmenu | 128 | endmenu |
129 | 129 | ||
130 | menu "Advanced setup" | 130 | menu "Kernel features" |
131 | 131 | ||
132 | config ADVANCED_OPTIONS | 132 | config ADVANCED_OPTIONS |
133 | bool "Prompt for advanced kernel configuration options" | 133 | bool "Prompt for advanced kernel configuration options" |
@@ -248,10 +248,10 @@ config MICROBLAZE_64K_PAGES | |||
248 | 248 | ||
249 | endchoice | 249 | endchoice |
250 | 250 | ||
251 | endmenu | ||
252 | |||
253 | source "mm/Kconfig" | 251 | source "mm/Kconfig" |
254 | 252 | ||
253 | endmenu | ||
254 | |||
255 | menu "Executable file formats" | 255 | menu "Executable file formats" |
256 | 256 | ||
257 | source "fs/Kconfig.binfmt" | 257 | source "fs/Kconfig.binfmt" |
diff --git a/arch/microblaze/include/asm/entry.h b/arch/microblaze/include/asm/entry.h index b4a4cb150aa9..596e485ae707 100644 --- a/arch/microblaze/include/asm/entry.h +++ b/arch/microblaze/include/asm/entry.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <asm/percpu.h> | 16 | #include <asm/percpu.h> |
17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
18 | #include <linux/linkage.h> | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * These are per-cpu variables required in entry.S, among other | 21 | * These are per-cpu variables required in entry.S, among other |
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 0aa005703a0b..59a89a64a865 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -98,13 +98,13 @@ static inline int access_ok(int type, const void __user *addr, | |||
98 | 98 | ||
99 | if ((get_fs().seg < ((unsigned long)addr)) || | 99 | if ((get_fs().seg < ((unsigned long)addr)) || |
100 | (get_fs().seg < ((unsigned long)addr + size - 1))) { | 100 | (get_fs().seg < ((unsigned long)addr + size - 1))) { |
101 | pr_debug("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n", | 101 | pr_devel("ACCESS fail: %s at 0x%08x (size 0x%x), seg 0x%08x\n", |
102 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, | 102 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, |
103 | (u32)get_fs().seg); | 103 | (u32)get_fs().seg); |
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | ok: | 106 | ok: |
107 | pr_debug("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n", | 107 | pr_devel("ACCESS OK: %s at 0x%08x (size 0x%x), seg 0x%08x\n", |
108 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, | 108 | type ? "WRITE" : "READ ", (__force u32)addr, (u32)size, |
109 | (u32)get_fs().seg); | 109 | (u32)get_fs().seg); |
110 | return 1; | 110 | return 1; |
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index fd56a8f66489..ea4b233647c1 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
@@ -38,6 +38,6 @@ | |||
38 | 38 | ||
39 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
40 | 40 | ||
41 | #define __NR_syscalls 381 | 41 | #define __NR_syscalls 387 |
42 | 42 | ||
43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ | 43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 900c7e5333b6..574c43000699 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -546,6 +546,7 @@ config SGI_IP28 | |||
546 | # select SYS_HAS_EARLY_PRINTK | 546 | # select SYS_HAS_EARLY_PRINTK |
547 | select SYS_SUPPORTS_64BIT_KERNEL | 547 | select SYS_SUPPORTS_64BIT_KERNEL |
548 | select SYS_SUPPORTS_BIG_ENDIAN | 548 | select SYS_SUPPORTS_BIG_ENDIAN |
549 | select MIPS_L1_CACHE_SHIFT_7 | ||
549 | help | 550 | help |
550 | This is the SGI Indigo2 with R10000 processor. To compile a Linux | 551 | This is the SGI Indigo2 with R10000 processor. To compile a Linux |
551 | kernel that runs on these, say Y here. | 552 | kernel that runs on these, say Y here. |
@@ -2029,7 +2030,9 @@ config MIPS_CMP | |||
2029 | bool "MIPS CMP framework support (DEPRECATED)" | 2030 | bool "MIPS CMP framework support (DEPRECATED)" |
2030 | depends on SYS_SUPPORTS_MIPS_CMP | 2031 | depends on SYS_SUPPORTS_MIPS_CMP |
2031 | select MIPS_GIC_IPI | 2032 | select MIPS_GIC_IPI |
2033 | select SMP | ||
2032 | select SYNC_R4K | 2034 | select SYNC_R4K |
2035 | select SYS_SUPPORTS_SMP | ||
2033 | select WEAK_ORDERING | 2036 | select WEAK_ORDERING |
2034 | default n | 2037 | default n |
2035 | help | 2038 | help |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 9336509f47ad..bbac51e11179 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -113,7 +113,16 @@ predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__ | |||
113 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) | 113 | cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be)) |
114 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) | 114 | cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le)) |
115 | 115 | ||
116 | cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) | 116 | # For smartmips configurations, there are hundreds of warnings due to ISA overrides |
117 | # in assembly and header files. smartmips is only supported for MIPS32r1 onwards | ||
118 | # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or | ||
119 | # similar directives in the kernel will spam the build logs with the following warnings: | ||
120 | # Warning: the `smartmips' extension requires MIPS32 revision 1 or greater | ||
121 | # or | ||
122 | # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension | ||
123 | # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has | ||
124 | # been fixed properly. | ||
125 | cflags-$(CONFIG_CPU_HAS_SMARTMIPS) += $(call cc-option,-msmartmips) -Wa,--no-warn | ||
117 | cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips) | 126 | cflags-$(CONFIG_CPU_MICROMIPS) += $(call cc-option,-mmicromips) |
118 | 127 | ||
119 | cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ | 128 | cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \ |
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c index 37eb2d1fa69a..b94bf44d8d8e 100644 --- a/arch/mips/bcm63xx/irq.c +++ b/arch/mips/bcm63xx/irq.c | |||
@@ -434,7 +434,7 @@ static void bcm63xx_init_irq(void) | |||
434 | irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; | 434 | irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; |
435 | irq_mask_addr[0] += PERF_IRQMASK_3368_REG; | 435 | irq_mask_addr[0] += PERF_IRQMASK_3368_REG; |
436 | irq_stat_addr[1] = 0; | 436 | irq_stat_addr[1] = 0; |
437 | irq_stat_addr[1] = 0; | 437 | irq_mask_addr[1] = 0; |
438 | irq_bits = 32; | 438 | irq_bits = 32; |
439 | ext_irq_count = 4; | 439 | ext_irq_count = 4; |
440 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; | 440 | ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; |
@@ -443,7 +443,7 @@ static void bcm63xx_init_irq(void) | |||
443 | irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); | 443 | irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); |
444 | irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); | 444 | irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); |
445 | irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); | 445 | irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); |
446 | irq_stat_addr[1] += PERF_IRQMASK_6328_REG(1); | 446 | irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1); |
447 | irq_bits = 64; | 447 | irq_bits = 64; |
448 | ext_irq_count = 4; | 448 | ext_irq_count = 4; |
449 | is_ext_irq_cascaded = 1; | 449 | is_ext_irq_cascaded = 1; |
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c index b49c7adbfa89..31903cf9709d 100644 --- a/arch/mips/boot/compressed/decompress.c +++ b/arch/mips/boot/compressed/decompress.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/string.h> | ||
16 | 17 | ||
17 | #include <asm/addrspace.h> | 18 | #include <asm/addrspace.h> |
18 | 19 | ||
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h index d0352983b94d..51f80bd36fcc 100644 --- a/arch/mips/include/asm/cop2.h +++ b/arch/mips/include/asm/cop2.h | |||
@@ -16,8 +16,8 @@ | |||
16 | extern void octeon_cop2_save(struct octeon_cop2_state *); | 16 | extern void octeon_cop2_save(struct octeon_cop2_state *); |
17 | extern void octeon_cop2_restore(struct octeon_cop2_state *); | 17 | extern void octeon_cop2_restore(struct octeon_cop2_state *); |
18 | 18 | ||
19 | #define cop2_save(r) octeon_cop2_save(r) | 19 | #define cop2_save(r) octeon_cop2_save(&(r)->thread.cp2) |
20 | #define cop2_restore(r) octeon_cop2_restore(r) | 20 | #define cop2_restore(r) octeon_cop2_restore(&(r)->thread.cp2) |
21 | 21 | ||
22 | #define cop2_present 1 | 22 | #define cop2_present 1 |
23 | #define cop2_lazy_restore 1 | 23 | #define cop2_lazy_restore 1 |
@@ -26,26 +26,26 @@ extern void octeon_cop2_restore(struct octeon_cop2_state *); | |||
26 | 26 | ||
27 | extern void nlm_cop2_save(struct nlm_cop2_state *); | 27 | extern void nlm_cop2_save(struct nlm_cop2_state *); |
28 | extern void nlm_cop2_restore(struct nlm_cop2_state *); | 28 | extern void nlm_cop2_restore(struct nlm_cop2_state *); |
29 | #define cop2_save(r) nlm_cop2_save(r) | 29 | |
30 | #define cop2_restore(r) nlm_cop2_restore(r) | 30 | #define cop2_save(r) nlm_cop2_save(&(r)->thread.cp2) |
31 | #define cop2_restore(r) nlm_cop2_restore(&(r)->thread.cp2) | ||
31 | 32 | ||
32 | #define cop2_present 1 | 33 | #define cop2_present 1 |
33 | #define cop2_lazy_restore 0 | 34 | #define cop2_lazy_restore 0 |
34 | 35 | ||
35 | #elif defined(CONFIG_CPU_LOONGSON3) | 36 | #elif defined(CONFIG_CPU_LOONGSON3) |
36 | 37 | ||
37 | #define cop2_save(r) | ||
38 | #define cop2_restore(r) | ||
39 | |||
40 | #define cop2_present 1 | 38 | #define cop2_present 1 |
41 | #define cop2_lazy_restore 1 | 39 | #define cop2_lazy_restore 1 |
40 | #define cop2_save(r) do { (r); } while (0) | ||
41 | #define cop2_restore(r) do { (r); } while (0) | ||
42 | 42 | ||
43 | #else | 43 | #else |
44 | 44 | ||
45 | #define cop2_present 0 | 45 | #define cop2_present 0 |
46 | #define cop2_lazy_restore 0 | 46 | #define cop2_lazy_restore 0 |
47 | #define cop2_save(r) | 47 | #define cop2_save(r) do { (r); } while (0) |
48 | #define cop2_restore(r) | 48 | #define cop2_restore(r) do { (r); } while (0) |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | enum cu2_ops { | 51 | enum cu2_ops { |
diff --git a/arch/mips/include/asm/mach-ip28/spaces.h b/arch/mips/include/asm/mach-ip28/spaces.h index 5d6a76434d00..c4a912733b65 100644 --- a/arch/mips/include/asm/mach-ip28/spaces.h +++ b/arch/mips/include/asm/mach-ip28/spaces.h | |||
@@ -11,15 +11,8 @@ | |||
11 | #ifndef _ASM_MACH_IP28_SPACES_H | 11 | #ifndef _ASM_MACH_IP28_SPACES_H |
12 | #define _ASM_MACH_IP28_SPACES_H | 12 | #define _ASM_MACH_IP28_SPACES_H |
13 | 13 | ||
14 | #define CAC_BASE _AC(0xa800000000000000, UL) | ||
15 | |||
16 | #define HIGHMEM_START (~0UL) | ||
17 | |||
18 | #define PHYS_OFFSET _AC(0x20000000, UL) | 14 | #define PHYS_OFFSET _AC(0x20000000, UL) |
19 | 15 | ||
20 | #define UNCAC_BASE _AC(0xc0000000, UL) /* 0xa0000000 + PHYS_OFFSET */ | ||
21 | #define IO_BASE UNCAC_BASE | ||
22 | |||
23 | #include <asm/mach-generic/spaces.h> | 16 | #include <asm/mach-generic/spaces.h> |
24 | 17 | ||
25 | #endif /* _ASM_MACH_IP28_SPACES_H */ | 18 | #endif /* _ASM_MACH_IP28_SPACES_H */ |
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h index 5699ec3a71af..3be81803595d 100644 --- a/arch/mips/include/asm/page.h +++ b/arch/mips/include/asm/page.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * This is used for calculating the real page sizes | 39 | * This is used for calculating the real page sizes |
40 | * for FTLB or VTLB + FTLB confugrations. | 40 | * for FTLB or VTLB + FTLB configurations. |
41 | */ | 41 | */ |
42 | static inline unsigned int page_size_ftlb(unsigned int mmuextdef) | 42 | static inline unsigned int page_size_ftlb(unsigned int mmuextdef) |
43 | { | 43 | { |
@@ -223,7 +223,8 @@ static inline int pfn_valid(unsigned long pfn) | |||
223 | 223 | ||
224 | #endif | 224 | #endif |
225 | 225 | ||
226 | #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) | 226 | #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys((void *) \ |
227 | (kaddr)))) | ||
227 | 228 | ||
228 | extern int __virt_addr_valid(const volatile void *kaddr); | 229 | extern int __virt_addr_valid(const volatile void *kaddr); |
229 | #define virt_addr_valid(kaddr) \ | 230 | #define virt_addr_valid(kaddr) \ |
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 1e0f20a9cdda..eacf865d21c2 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
@@ -37,11 +37,6 @@ extern int __cpu_logical_map[NR_CPUS]; | |||
37 | 37 | ||
38 | #define NO_PROC_ID (-1) | 38 | #define NO_PROC_ID (-1) |
39 | 39 | ||
40 | #define topology_physical_package_id(cpu) (cpu_data[cpu].package) | ||
41 | #define topology_core_id(cpu) (cpu_data[cpu].core) | ||
42 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) | ||
43 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | ||
44 | |||
45 | #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ | 40 | #define SMP_RESCHEDULE_YOURSELF 0x1 /* XXX braindead */ |
46 | #define SMP_CALL_FUNCTION 0x2 | 41 | #define SMP_CALL_FUNCTION 0x2 |
47 | /* Octeon - Tell another core to flush its icache */ | 42 | /* Octeon - Tell another core to flush its icache */ |
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h index 495c1041a2cc..b928b6f898cd 100644 --- a/arch/mips/include/asm/switch_to.h +++ b/arch/mips/include/asm/switch_to.h | |||
@@ -92,7 +92,7 @@ do { \ | |||
92 | KSTK_STATUS(prev) &= ~ST0_CU2; \ | 92 | KSTK_STATUS(prev) &= ~ST0_CU2; \ |
93 | __c0_stat = read_c0_status(); \ | 93 | __c0_stat = read_c0_status(); \ |
94 | write_c0_status(__c0_stat | ST0_CU2); \ | 94 | write_c0_status(__c0_stat | ST0_CU2); \ |
95 | cop2_save(&prev->thread.cp2); \ | 95 | cop2_save(prev); \ |
96 | write_c0_status(__c0_stat & ~ST0_CU2); \ | 96 | write_c0_status(__c0_stat & ~ST0_CU2); \ |
97 | } \ | 97 | } \ |
98 | __clear_software_ll_bit(); \ | 98 | __clear_software_ll_bit(); \ |
@@ -111,7 +111,7 @@ do { \ | |||
111 | (KSTK_STATUS(current) & ST0_CU2)) { \ | 111 | (KSTK_STATUS(current) & ST0_CU2)) { \ |
112 | __c0_stat = read_c0_status(); \ | 112 | __c0_stat = read_c0_status(); \ |
113 | write_c0_status(__c0_stat | ST0_CU2); \ | 113 | write_c0_status(__c0_stat | ST0_CU2); \ |
114 | cop2_restore(¤t->thread.cp2); \ | 114 | cop2_restore(current); \ |
115 | write_c0_status(__c0_stat & ~ST0_CU2); \ | 115 | write_c0_status(__c0_stat & ~ST0_CU2); \ |
116 | } \ | 116 | } \ |
117 | if (cpu_has_dsp) \ | 117 | if (cpu_has_dsp) \ |
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h index 20ea4859c822..3e307ec2afba 100644 --- a/arch/mips/include/asm/topology.h +++ b/arch/mips/include/asm/topology.h | |||
@@ -9,5 +9,13 @@ | |||
9 | #define __ASM_TOPOLOGY_H | 9 | #define __ASM_TOPOLOGY_H |
10 | 10 | ||
11 | #include <topology.h> | 11 | #include <topology.h> |
12 | #include <linux/smp.h> | ||
13 | |||
14 | #ifdef CONFIG_SMP | ||
15 | #define topology_physical_package_id(cpu) (cpu_data[cpu].package) | ||
16 | #define topology_core_id(cpu) (cpu_data[cpu].core) | ||
17 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) | ||
18 | #define topology_thread_cpumask(cpu) (&cpu_sibling_map[cpu]) | ||
19 | #endif | ||
12 | 20 | ||
13 | #endif /* __ASM_TOPOLOGY_H */ | 21 | #endif /* __ASM_TOPOLOGY_H */ |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index 9bc13eaf9d67..fdb4923777d1 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -373,16 +373,18 @@ | |||
373 | #define __NR_sched_getattr (__NR_Linux + 350) | 373 | #define __NR_sched_getattr (__NR_Linux + 350) |
374 | #define __NR_renameat2 (__NR_Linux + 351) | 374 | #define __NR_renameat2 (__NR_Linux + 351) |
375 | #define __NR_seccomp (__NR_Linux + 352) | 375 | #define __NR_seccomp (__NR_Linux + 352) |
376 | #define __NR_getrandom (__NR_Linux + 353) | ||
377 | #define __NR_memfd_create (__NR_Linux + 354) | ||
376 | 378 | ||
377 | /* | 379 | /* |
378 | * Offset of the last Linux o32 flavoured syscall | 380 | * Offset of the last Linux o32 flavoured syscall |
379 | */ | 381 | */ |
380 | #define __NR_Linux_syscalls 352 | 382 | #define __NR_Linux_syscalls 354 |
381 | 383 | ||
382 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 384 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
383 | 385 | ||
384 | #define __NR_O32_Linux 4000 | 386 | #define __NR_O32_Linux 4000 |
385 | #define __NR_O32_Linux_syscalls 352 | 387 | #define __NR_O32_Linux_syscalls 354 |
386 | 388 | ||
387 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 389 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
388 | 390 | ||
@@ -703,16 +705,18 @@ | |||
703 | #define __NR_sched_getattr (__NR_Linux + 310) | 705 | #define __NR_sched_getattr (__NR_Linux + 310) |
704 | #define __NR_renameat2 (__NR_Linux + 311) | 706 | #define __NR_renameat2 (__NR_Linux + 311) |
705 | #define __NR_seccomp (__NR_Linux + 312) | 707 | #define __NR_seccomp (__NR_Linux + 312) |
708 | #define __NR_getrandom (__NR_Linux + 313) | ||
709 | #define __NR_memfd_create (__NR_Linux + 314) | ||
706 | 710 | ||
707 | /* | 711 | /* |
708 | * Offset of the last Linux 64-bit flavoured syscall | 712 | * Offset of the last Linux 64-bit flavoured syscall |
709 | */ | 713 | */ |
710 | #define __NR_Linux_syscalls 312 | 714 | #define __NR_Linux_syscalls 314 |
711 | 715 | ||
712 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 716 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
713 | 717 | ||
714 | #define __NR_64_Linux 5000 | 718 | #define __NR_64_Linux 5000 |
715 | #define __NR_64_Linux_syscalls 312 | 719 | #define __NR_64_Linux_syscalls 314 |
716 | 720 | ||
717 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 721 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
718 | 722 | ||
@@ -1037,15 +1041,17 @@ | |||
1037 | #define __NR_sched_getattr (__NR_Linux + 314) | 1041 | #define __NR_sched_getattr (__NR_Linux + 314) |
1038 | #define __NR_renameat2 (__NR_Linux + 315) | 1042 | #define __NR_renameat2 (__NR_Linux + 315) |
1039 | #define __NR_seccomp (__NR_Linux + 316) | 1043 | #define __NR_seccomp (__NR_Linux + 316) |
1044 | #define __NR_getrandom (__NR_Linux + 317) | ||
1045 | #define __NR_memfd_create (__NR_Linux + 318) | ||
1040 | 1046 | ||
1041 | /* | 1047 | /* |
1042 | * Offset of the last N32 flavoured syscall | 1048 | * Offset of the last N32 flavoured syscall |
1043 | */ | 1049 | */ |
1044 | #define __NR_Linux_syscalls 316 | 1050 | #define __NR_Linux_syscalls 318 |
1045 | 1051 | ||
1046 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1052 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1047 | 1053 | ||
1048 | #define __NR_N32_Linux 6000 | 1054 | #define __NR_N32_Linux 6000 |
1049 | #define __NR_N32_Linux_syscalls 316 | 1055 | #define __NR_N32_Linux_syscalls 318 |
1050 | 1056 | ||
1051 | #endif /* _UAPI_ASM_UNISTD_H */ | 1057 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c index 992e18474da5..50980bf3983e 100644 --- a/arch/mips/kernel/machine_kexec.c +++ b/arch/mips/kernel/machine_kexec.c | |||
@@ -71,8 +71,12 @@ machine_kexec(struct kimage *image) | |||
71 | kexec_start_address = | 71 | kexec_start_address = |
72 | (unsigned long) phys_to_virt(image->start); | 72 | (unsigned long) phys_to_virt(image->start); |
73 | 73 | ||
74 | kexec_indirection_page = | 74 | if (image->type == KEXEC_TYPE_DEFAULT) { |
75 | (unsigned long) phys_to_virt(image->head & PAGE_MASK); | 75 | kexec_indirection_page = |
76 | (unsigned long) phys_to_virt(image->head & PAGE_MASK); | ||
77 | } else { | ||
78 | kexec_indirection_page = (unsigned long)&image->head; | ||
79 | } | ||
76 | 80 | ||
77 | memcpy((void*)reboot_code_buffer, relocate_new_kernel, | 81 | memcpy((void*)reboot_code_buffer, relocate_new_kernel, |
78 | relocate_new_kernel_size); | 82 | relocate_new_kernel_size); |
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index f93b4cbec739..744cd10ba599 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -577,3 +577,5 @@ EXPORT(sys_call_table) | |||
577 | PTR sys_sched_getattr /* 4350 */ | 577 | PTR sys_sched_getattr /* 4350 */ |
578 | PTR sys_renameat2 | 578 | PTR sys_renameat2 |
579 | PTR sys_seccomp | 579 | PTR sys_seccomp |
580 | PTR sys_getrandom | ||
581 | PTR sys_memfd_create | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 03ebd9979ad2..002b1bc09c38 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -432,4 +432,6 @@ EXPORT(sys_call_table) | |||
432 | PTR sys_sched_getattr /* 5310 */ | 432 | PTR sys_sched_getattr /* 5310 */ |
433 | PTR sys_renameat2 | 433 | PTR sys_renameat2 |
434 | PTR sys_seccomp | 434 | PTR sys_seccomp |
435 | PTR sys_getrandom | ||
436 | PTR sys_memfd_create | ||
435 | .size sys_call_table,.-sys_call_table | 437 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index ebc9228e2e15..ca6cbbe9805b 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -425,4 +425,6 @@ EXPORT(sysn32_call_table) | |||
425 | PTR sys_sched_getattr | 425 | PTR sys_sched_getattr |
426 | PTR sys_renameat2 /* 6315 */ | 426 | PTR sys_renameat2 /* 6315 */ |
427 | PTR sys_seccomp | 427 | PTR sys_seccomp |
428 | PTR sys_getrandom | ||
429 | PTR sys_memfd_create | ||
428 | .size sysn32_call_table,.-sysn32_call_table | 430 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 25bb8400156d..9e10d11fbb84 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -562,4 +562,6 @@ EXPORT(sys32_call_table) | |||
562 | PTR sys_sched_getattr /* 4350 */ | 562 | PTR sys_sched_getattr /* 4350 */ |
563 | PTR sys_renameat2 | 563 | PTR sys_renameat2 |
564 | PTR sys_seccomp | 564 | PTR sys_seccomp |
565 | PTR sys_getrandom | ||
566 | PTR sys_memfd_create | ||
565 | .size sys32_call_table,.-sys32_call_table | 567 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 571aab064936..f42e35e42790 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -53,6 +53,7 @@ | |||
53 | */ | 53 | */ |
54 | unsigned long empty_zero_page, zero_page_mask; | 54 | unsigned long empty_zero_page, zero_page_mask; |
55 | EXPORT_SYMBOL_GPL(empty_zero_page); | 55 | EXPORT_SYMBOL_GPL(empty_zero_page); |
56 | EXPORT_SYMBOL(zero_page_mask); | ||
56 | 57 | ||
57 | /* | 58 | /* |
58 | * Not static inline because used by IP27 special magic initialization code | 59 | * Not static inline because used by IP27 special magic initialization code |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 7edc08398c4a..64ecf9a4e526 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
@@ -772,6 +772,7 @@ static int build_body(struct jit_ctx *ctx) | |||
772 | const struct sock_filter *inst; | 772 | const struct sock_filter *inst; |
773 | unsigned int i, off, load_order, condt; | 773 | unsigned int i, off, load_order, condt; |
774 | u32 k, b_off __maybe_unused; | 774 | u32 k, b_off __maybe_unused; |
775 | int tmp; | ||
775 | 776 | ||
776 | for (i = 0; i < prog->len; i++) { | 777 | for (i = 0; i < prog->len; i++) { |
777 | u16 code; | 778 | u16 code; |
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 6e75e2030927..1554a6f2a5bb 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -321,6 +321,22 @@ source "fs/Kconfig" | |||
321 | 321 | ||
322 | source "arch/parisc/Kconfig.debug" | 322 | source "arch/parisc/Kconfig.debug" |
323 | 323 | ||
324 | config SECCOMP | ||
325 | def_bool y | ||
326 | prompt "Enable seccomp to safely compute untrusted bytecode" | ||
327 | ---help--- | ||
328 | This kernel feature is useful for number crunching applications | ||
329 | that may need to compute untrusted bytecode during their | ||
330 | execution. By using pipes or other transports made available to | ||
331 | the process as file descriptors supporting the read/write | ||
332 | syscalls, it's possible to isolate those applications in | ||
333 | their own address space using seccomp. Once seccomp is | ||
334 | enabled via prctl(PR_SET_SECCOMP), it cannot be disabled | ||
335 | and the task is only allowed to execute a few safe syscalls | ||
336 | defined by each seccomp mode. | ||
337 | |||
338 | If unsure, say Y. Only embedded should say N here. | ||
339 | |||
324 | source "security/Kconfig" | 340 | source "security/Kconfig" |
325 | 341 | ||
326 | source "crypto/Kconfig" | 342 | source "crypto/Kconfig" |
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index d9dc6cd3b7d2..e5c4da035810 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -456,7 +456,7 @@ int hpux_sysfs(int opcode, unsigned long arg1, unsigned long arg2) | |||
456 | } | 456 | } |
457 | 457 | ||
458 | /* String could be altered by userspace after strlen_user() */ | 458 | /* String could be altered by userspace after strlen_user() */ |
459 | fsname[len] = '\0'; | 459 | fsname[len - 1] = '\0'; |
460 | 460 | ||
461 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); | 461 | printk(KERN_DEBUG "that is '%s' as (char *)\n", fsname); |
462 | if ( !strcmp(fsname, "hfs") ) { | 462 | if ( !strcmp(fsname, "hfs") ) { |
diff --git a/arch/parisc/include/asm/seccomp.h b/arch/parisc/include/asm/seccomp.h new file mode 100644 index 000000000000..015f7887aa29 --- /dev/null +++ b/arch/parisc/include/asm/seccomp.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _ASM_PARISC_SECCOMP_H | ||
2 | #define _ASM_PARISC_SECCOMP_H | ||
3 | |||
4 | #include <linux/unistd.h> | ||
5 | |||
6 | #define __NR_seccomp_read __NR_read | ||
7 | #define __NR_seccomp_write __NR_write | ||
8 | #define __NR_seccomp_exit __NR_exit | ||
9 | #define __NR_seccomp_sigreturn __NR_rt_sigreturn | ||
10 | |||
11 | #define __NR_seccomp_read_32 __NR_read | ||
12 | #define __NR_seccomp_write_32 __NR_write | ||
13 | #define __NR_seccomp_exit_32 __NR_exit | ||
14 | #define __NR_seccomp_sigreturn_32 __NR_rt_sigreturn | ||
15 | |||
16 | #endif /* _ASM_PARISC_SECCOMP_H */ | ||
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 4b9b10ce1f9d..a84611835549 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h | |||
@@ -60,6 +60,7 @@ struct thread_info { | |||
60 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | 60 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ |
61 | #define TIF_SINGLESTEP 9 /* single stepping? */ | 61 | #define TIF_SINGLESTEP 9 /* single stepping? */ |
62 | #define TIF_BLOCKSTEP 10 /* branch stepping? */ | 62 | #define TIF_BLOCKSTEP 10 /* branch stepping? */ |
63 | #define TIF_SECCOMP 11 /* secure computing */ | ||
63 | 64 | ||
64 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 65 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
65 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 66 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
@@ -70,11 +71,13 @@ struct thread_info { | |||
70 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 71 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
71 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) | 72 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
72 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) | 73 | #define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) |
74 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) | ||
73 | 75 | ||
74 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ | 76 | #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ |
75 | _TIF_NEED_RESCHED) | 77 | _TIF_NEED_RESCHED) |
76 | #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ | 78 | #define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ |
77 | _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT) | 79 | _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \ |
80 | _TIF_SECCOMP) | ||
78 | 81 | ||
79 | #ifdef CONFIG_64BIT | 82 | #ifdef CONFIG_64BIT |
80 | # ifdef CONFIG_COMPAT | 83 | # ifdef CONFIG_COMPAT |
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index 47e0e21d2272..8667f18be238 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h | |||
@@ -830,8 +830,11 @@ | |||
830 | #define __NR_sched_getattr (__NR_Linux + 335) | 830 | #define __NR_sched_getattr (__NR_Linux + 335) |
831 | #define __NR_utimes (__NR_Linux + 336) | 831 | #define __NR_utimes (__NR_Linux + 336) |
832 | #define __NR_renameat2 (__NR_Linux + 337) | 832 | #define __NR_renameat2 (__NR_Linux + 337) |
833 | #define __NR_seccomp (__NR_Linux + 338) | ||
834 | #define __NR_getrandom (__NR_Linux + 339) | ||
835 | #define __NR_memfd_create (__NR_Linux + 340) | ||
833 | 836 | ||
834 | #define __NR_Linux_syscalls (__NR_renameat2 + 1) | 837 | #define __NR_Linux_syscalls (__NR_memfd_create + 1) |
835 | 838 | ||
836 | 839 | ||
837 | #define __IGNORE_select /* newselect */ | 840 | #define __IGNORE_select /* newselect */ |
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index e842ee233db4..3bab72462ab5 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
@@ -270,6 +270,12 @@ long do_syscall_trace_enter(struct pt_regs *regs) | |||
270 | { | 270 | { |
271 | long ret = 0; | 271 | long ret = 0; |
272 | 272 | ||
273 | /* Do the secure computing check first. */ | ||
274 | if (secure_computing(regs->gr[20])) { | ||
275 | /* seccomp failures shouldn't expose any additional code. */ | ||
276 | return -1; | ||
277 | } | ||
278 | |||
273 | if (test_thread_flag(TIF_SYSCALL_TRACE) && | 279 | if (test_thread_flag(TIF_SYSCALL_TRACE) && |
274 | tracehook_report_syscall_entry(regs)) | 280 | tracehook_report_syscall_entry(regs)) |
275 | ret = -1L; | 281 | ret = -1L; |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index 838786011037..7ef22e3387e0 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
@@ -74,7 +74,7 @@ ENTRY(linux_gateway_page) | |||
74 | /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */ | 74 | /* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */ |
75 | /* Light-weight-syscall entry must always be located at 0xb0 */ | 75 | /* Light-weight-syscall entry must always be located at 0xb0 */ |
76 | /* WARNING: Keep this number updated with table size changes */ | 76 | /* WARNING: Keep this number updated with table size changes */ |
77 | #define __NR_lws_entries (2) | 77 | #define __NR_lws_entries (3) |
78 | 78 | ||
79 | lws_entry: | 79 | lws_entry: |
80 | gate lws_start, %r0 /* increase privilege */ | 80 | gate lws_start, %r0 /* increase privilege */ |
@@ -502,7 +502,7 @@ lws_exit: | |||
502 | 502 | ||
503 | 503 | ||
504 | /*************************************************** | 504 | /*************************************************** |
505 | Implementing CAS as an atomic operation: | 505 | Implementing 32bit CAS as an atomic operation: |
506 | 506 | ||
507 | %r26 - Address to examine | 507 | %r26 - Address to examine |
508 | %r25 - Old value to check (old) | 508 | %r25 - Old value to check (old) |
@@ -659,6 +659,230 @@ cas_action: | |||
659 | ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) | 659 | ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) |
660 | 660 | ||
661 | 661 | ||
662 | /*************************************************** | ||
663 | New CAS implementation which uses pointers and variable size | ||
664 | information. The value pointed by old and new MUST NOT change | ||
665 | while performing CAS. The lock only protect the value at %r26. | ||
666 | |||
667 | %r26 - Address to examine | ||
668 | %r25 - Pointer to the value to check (old) | ||
669 | %r24 - Pointer to the value to set (new) | ||
670 | %r23 - Size of the variable (0/1/2/3 for 8/16/32/64 bit) | ||
671 | %r28 - Return non-zero on failure | ||
672 | %r21 - Kernel error code | ||
673 | |||
674 | %r21 has the following meanings: | ||
675 | |||
676 | EAGAIN - CAS is busy, ldcw failed, try again. | ||
677 | EFAULT - Read or write failed. | ||
678 | |||
679 | Scratch: r20, r22, r28, r29, r1, fr4 (32bit for 64bit CAS only) | ||
680 | |||
681 | ****************************************************/ | ||
682 | |||
683 | /* ELF32 Process entry path */ | ||
684 | lws_compare_and_swap_2: | ||
685 | #ifdef CONFIG_64BIT | ||
686 | /* Clip the input registers */ | ||
687 | depdi 0, 31, 32, %r26 | ||
688 | depdi 0, 31, 32, %r25 | ||
689 | depdi 0, 31, 32, %r24 | ||
690 | depdi 0, 31, 32, %r23 | ||
691 | #endif | ||
692 | |||
693 | /* Check the validity of the size pointer */ | ||
694 | subi,>>= 4, %r23, %r0 | ||
695 | b,n lws_exit_nosys | ||
696 | |||
697 | /* Jump to the functions which will load the old and new values into | ||
698 | registers depending on the their size */ | ||
699 | shlw %r23, 2, %r29 | ||
700 | blr %r29, %r0 | ||
701 | nop | ||
702 | |||
703 | /* 8bit load */ | ||
704 | 4: ldb 0(%sr3,%r25), %r25 | ||
705 | b cas2_lock_start | ||
706 | 5: ldb 0(%sr3,%r24), %r24 | ||
707 | nop | ||
708 | nop | ||
709 | nop | ||
710 | nop | ||
711 | nop | ||
712 | |||
713 | /* 16bit load */ | ||
714 | 6: ldh 0(%sr3,%r25), %r25 | ||
715 | b cas2_lock_start | ||
716 | 7: ldh 0(%sr3,%r24), %r24 | ||
717 | nop | ||
718 | nop | ||
719 | nop | ||
720 | nop | ||
721 | nop | ||
722 | |||
723 | /* 32bit load */ | ||
724 | 8: ldw 0(%sr3,%r25), %r25 | ||
725 | b cas2_lock_start | ||
726 | 9: ldw 0(%sr3,%r24), %r24 | ||
727 | nop | ||
728 | nop | ||
729 | nop | ||
730 | nop | ||
731 | nop | ||
732 | |||
733 | /* 64bit load */ | ||
734 | #ifdef CONFIG_64BIT | ||
735 | 10: ldd 0(%sr3,%r25), %r25 | ||
736 | 11: ldd 0(%sr3,%r24), %r24 | ||
737 | #else | ||
738 | /* Load new value into r22/r23 - high/low */ | ||
739 | 10: ldw 0(%sr3,%r25), %r22 | ||
740 | 11: ldw 4(%sr3,%r25), %r23 | ||
741 | /* Load new value into fr4 for atomic store later */ | ||
742 | 12: flddx 0(%sr3,%r24), %fr4 | ||
743 | #endif | ||
744 | |||
745 | cas2_lock_start: | ||
746 | /* Load start of lock table */ | ||
747 | ldil L%lws_lock_start, %r20 | ||
748 | ldo R%lws_lock_start(%r20), %r28 | ||
749 | |||
750 | /* Extract four bits from r26 and hash lock (Bits 4-7) */ | ||
751 | extru %r26, 27, 4, %r20 | ||
752 | |||
753 | /* Find lock to use, the hash is either one of 0 to | ||
754 | 15, multiplied by 16 (keep it 16-byte aligned) | ||
755 | and add to the lock table offset. */ | ||
756 | shlw %r20, 4, %r20 | ||
757 | add %r20, %r28, %r20 | ||
758 | |||
759 | rsm PSW_SM_I, %r0 /* Disable interrupts */ | ||
760 | /* COW breaks can cause contention on UP systems */ | ||
761 | LDCW 0(%sr2,%r20), %r28 /* Try to acquire the lock */ | ||
762 | cmpb,<>,n %r0, %r28, cas2_action /* Did we get it? */ | ||
763 | cas2_wouldblock: | ||
764 | ldo 2(%r0), %r28 /* 2nd case */ | ||
765 | ssm PSW_SM_I, %r0 | ||
766 | b lws_exit /* Contended... */ | ||
767 | ldo -EAGAIN(%r0), %r21 /* Spin in userspace */ | ||
768 | |||
769 | /* | ||
770 | prev = *addr; | ||
771 | if ( prev == old ) | ||
772 | *addr = new; | ||
773 | return prev; | ||
774 | */ | ||
775 | |||
776 | /* NOTES: | ||
777 | This all works becuse intr_do_signal | ||
778 | and schedule both check the return iasq | ||
779 | and see that we are on the kernel page | ||
780 | so this process is never scheduled off | ||
781 | or is ever sent any signal of any sort, | ||
782 | thus it is wholly atomic from usrspaces | ||
783 | perspective | ||
784 | */ | ||
785 | cas2_action: | ||
786 | /* Jump to the correct function */ | ||
787 | blr %r29, %r0 | ||
788 | /* Set %r28 as non-zero for now */ | ||
789 | ldo 1(%r0),%r28 | ||
790 | |||
791 | /* 8bit CAS */ | ||
792 | 13: ldb,ma 0(%sr3,%r26), %r29 | ||
793 | sub,= %r29, %r25, %r0 | ||
794 | b,n cas2_end | ||
795 | 14: stb,ma %r24, 0(%sr3,%r26) | ||
796 | b cas2_end | ||
797 | copy %r0, %r28 | ||
798 | nop | ||
799 | nop | ||
800 | |||
801 | /* 16bit CAS */ | ||
802 | 15: ldh,ma 0(%sr3,%r26), %r29 | ||
803 | sub,= %r29, %r25, %r0 | ||
804 | b,n cas2_end | ||
805 | 16: sth,ma %r24, 0(%sr3,%r26) | ||
806 | b cas2_end | ||
807 | copy %r0, %r28 | ||
808 | nop | ||
809 | nop | ||
810 | |||
811 | /* 32bit CAS */ | ||
812 | 17: ldw,ma 0(%sr3,%r26), %r29 | ||
813 | sub,= %r29, %r25, %r0 | ||
814 | b,n cas2_end | ||
815 | 18: stw,ma %r24, 0(%sr3,%r26) | ||
816 | b cas2_end | ||
817 | copy %r0, %r28 | ||
818 | nop | ||
819 | nop | ||
820 | |||
821 | /* 64bit CAS */ | ||
822 | #ifdef CONFIG_64BIT | ||
823 | 19: ldd,ma 0(%sr3,%r26), %r29 | ||
824 | sub,= %r29, %r25, %r0 | ||
825 | b,n cas2_end | ||
826 | 20: std,ma %r24, 0(%sr3,%r26) | ||
827 | copy %r0, %r28 | ||
828 | #else | ||
829 | /* Compare first word */ | ||
830 | 19: ldw,ma 0(%sr3,%r26), %r29 | ||
831 | sub,= %r29, %r22, %r0 | ||
832 | b,n cas2_end | ||
833 | /* Compare second word */ | ||
834 | 20: ldw,ma 4(%sr3,%r26), %r29 | ||
835 | sub,= %r29, %r23, %r0 | ||
836 | b,n cas2_end | ||
837 | /* Perform the store */ | ||
838 | 21: fstdx %fr4, 0(%sr3,%r26) | ||
839 | copy %r0, %r28 | ||
840 | #endif | ||
841 | |||
842 | cas2_end: | ||
843 | /* Free lock */ | ||
844 | stw,ma %r20, 0(%sr2,%r20) | ||
845 | /* Enable interrupts */ | ||
846 | ssm PSW_SM_I, %r0 | ||
847 | /* Return to userspace, set no error */ | ||
848 | b lws_exit | ||
849 | copy %r0, %r21 | ||
850 | |||
851 | 22: | ||
852 | /* Error occurred on load or store */ | ||
853 | /* Free lock */ | ||
854 | stw %r20, 0(%sr2,%r20) | ||
855 | ssm PSW_SM_I, %r0 | ||
856 | ldo 1(%r0),%r28 | ||
857 | b lws_exit | ||
858 | ldo -EFAULT(%r0),%r21 /* set errno */ | ||
859 | nop | ||
860 | nop | ||
861 | nop | ||
862 | |||
863 | /* Exception table entries, for the load and store, return EFAULT. | ||
864 | Each of the entries must be relocated. */ | ||
865 | ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 22b-linux_gateway_page) | ||
866 | ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 22b-linux_gateway_page) | ||
867 | ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 22b-linux_gateway_page) | ||
868 | ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 22b-linux_gateway_page) | ||
869 | ASM_EXCEPTIONTABLE_ENTRY(8b-linux_gateway_page, 22b-linux_gateway_page) | ||
870 | ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 22b-linux_gateway_page) | ||
871 | ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 22b-linux_gateway_page) | ||
872 | ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 22b-linux_gateway_page) | ||
873 | ASM_EXCEPTIONTABLE_ENTRY(13b-linux_gateway_page, 22b-linux_gateway_page) | ||
874 | ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 22b-linux_gateway_page) | ||
875 | ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 22b-linux_gateway_page) | ||
876 | ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 22b-linux_gateway_page) | ||
877 | ASM_EXCEPTIONTABLE_ENTRY(17b-linux_gateway_page, 22b-linux_gateway_page) | ||
878 | ASM_EXCEPTIONTABLE_ENTRY(18b-linux_gateway_page, 22b-linux_gateway_page) | ||
879 | ASM_EXCEPTIONTABLE_ENTRY(19b-linux_gateway_page, 22b-linux_gateway_page) | ||
880 | ASM_EXCEPTIONTABLE_ENTRY(20b-linux_gateway_page, 22b-linux_gateway_page) | ||
881 | #ifndef CONFIG_64BIT | ||
882 | ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 22b-linux_gateway_page) | ||
883 | ASM_EXCEPTIONTABLE_ENTRY(21b-linux_gateway_page, 22b-linux_gateway_page) | ||
884 | #endif | ||
885 | |||
662 | /* Make sure nothing else is placed on this page */ | 886 | /* Make sure nothing else is placed on this page */ |
663 | .align PAGE_SIZE | 887 | .align PAGE_SIZE |
664 | END(linux_gateway_page) | 888 | END(linux_gateway_page) |
@@ -675,8 +899,9 @@ ENTRY(end_linux_gateway_page) | |||
675 | /* Light-weight-syscall table */ | 899 | /* Light-weight-syscall table */ |
676 | /* Start of lws table. */ | 900 | /* Start of lws table. */ |
677 | ENTRY(lws_table) | 901 | ENTRY(lws_table) |
678 | LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic compare and swap */ | 902 | LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic 32bit CAS */ |
679 | LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic compare and swap */ | 903 | LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic 32bit CAS */ |
904 | LWS_ENTRY(compare_and_swap_2) /* 2 - ELF32 Atomic 64bit CAS */ | ||
680 | END(lws_table) | 905 | END(lws_table) |
681 | /* End of lws table */ | 906 | /* End of lws table */ |
682 | 907 | ||
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 84c5d3a58fa1..b563d9c8268b 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -433,6 +433,9 @@ | |||
433 | ENTRY_SAME(sched_getattr) /* 335 */ | 433 | ENTRY_SAME(sched_getattr) /* 335 */ |
434 | ENTRY_COMP(utimes) | 434 | ENTRY_COMP(utimes) |
435 | ENTRY_SAME(renameat2) | 435 | ENTRY_SAME(renameat2) |
436 | ENTRY_SAME(seccomp) | ||
437 | ENTRY_SAME(getrandom) | ||
438 | ENTRY_SAME(memfd_create) /* 340 */ | ||
436 | 439 | ||
437 | /* Nothing yet */ | 440 | /* Nothing yet */ |
438 | 441 | ||
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig index 4bee1a6d41d0..45fd06cdc3e8 100644 --- a/arch/powerpc/configs/cell_defconfig +++ b/arch/powerpc/configs/cell_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=4 | 5 | CONFIG_NR_CPUS=4 |
6 | CONFIG_EXPERIMENTAL=y | 6 | CONFIG_EXPERIMENTAL=y |
7 | CONFIG_SYSVIPC=y | 7 | CONFIG_SYSVIPC=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_IKCONFIG=y | 9 | CONFIG_IKCONFIG=y |
9 | CONFIG_IKCONFIG_PROC=y | 10 | CONFIG_IKCONFIG_PROC=y |
10 | CONFIG_LOG_BUF_SHIFT=15 | 11 | CONFIG_LOG_BUF_SHIFT=15 |
diff --git a/arch/powerpc/configs/celleb_defconfig b/arch/powerpc/configs/celleb_defconfig index 6d7b22f41b50..77d7bf3ca2ac 100644 --- a/arch/powerpc/configs/celleb_defconfig +++ b/arch/powerpc/configs/celleb_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=4 | 5 | CONFIG_NR_CPUS=4 |
6 | CONFIG_EXPERIMENTAL=y | 6 | CONFIG_EXPERIMENTAL=y |
7 | CONFIG_SYSVIPC=y | 7 | CONFIG_SYSVIPC=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_IKCONFIG=y | 9 | CONFIG_IKCONFIG=y |
9 | CONFIG_IKCONFIG_PROC=y | 10 | CONFIG_IKCONFIG_PROC=y |
10 | CONFIG_LOG_BUF_SHIFT=15 | 11 | CONFIG_LOG_BUF_SHIFT=15 |
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig index 4b07bade1ba9..269d6e47c67d 100644 --- a/arch/powerpc/configs/corenet64_smp_defconfig +++ b/arch/powerpc/configs/corenet64_smp_defconfig | |||
@@ -4,6 +4,7 @@ CONFIG_ALTIVEC=y | |||
4 | CONFIG_SMP=y | 4 | CONFIG_SMP=y |
5 | CONFIG_NR_CPUS=24 | 5 | CONFIG_NR_CPUS=24 |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_FHANDLE=y | ||
7 | CONFIG_IRQ_DOMAIN_DEBUG=y | 8 | CONFIG_IRQ_DOMAIN_DEBUG=y |
8 | CONFIG_NO_HZ=y | 9 | CONFIG_NO_HZ=y |
9 | CONFIG_HIGH_RES_TIMERS=y | 10 | CONFIG_HIGH_RES_TIMERS=y |
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig index 3c72fa615bd9..7594c5ac6481 100644 --- a/arch/powerpc/configs/g5_defconfig +++ b/arch/powerpc/configs/g5_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_NR_CPUS=4 | |||
5 | CONFIG_EXPERIMENTAL=y | 5 | CONFIG_EXPERIMENTAL=y |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_POSIX_MQUEUE=y | 7 | CONFIG_POSIX_MQUEUE=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_IKCONFIG=y | 9 | CONFIG_IKCONFIG=y |
9 | CONFIG_IKCONFIG_PROC=y | 10 | CONFIG_IKCONFIG_PROC=y |
10 | CONFIG_BLK_DEV_INITRD=y | 11 | CONFIG_BLK_DEV_INITRD=y |
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig index 95e545d9f25c..c8b6a9ddb21b 100644 --- a/arch/powerpc/configs/maple_defconfig +++ b/arch/powerpc/configs/maple_defconfig | |||
@@ -4,6 +4,7 @@ CONFIG_NR_CPUS=4 | |||
4 | CONFIG_EXPERIMENTAL=y | 4 | CONFIG_EXPERIMENTAL=y |
5 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
6 | CONFIG_POSIX_MQUEUE=y | 6 | CONFIG_POSIX_MQUEUE=y |
7 | CONFIG_FHANDLE=y | ||
7 | CONFIG_IKCONFIG=y | 8 | CONFIG_IKCONFIG=y |
8 | CONFIG_IKCONFIG_PROC=y | 9 | CONFIG_IKCONFIG_PROC=y |
9 | # CONFIG_COMPAT_BRK is not set | 10 | # CONFIG_COMPAT_BRK is not set |
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig index cec044a3ff69..e5e7838af008 100644 --- a/arch/powerpc/configs/pasemi_defconfig +++ b/arch/powerpc/configs/pasemi_defconfig | |||
@@ -3,6 +3,7 @@ CONFIG_ALTIVEC=y | |||
3 | CONFIG_SMP=y | 3 | CONFIG_SMP=y |
4 | CONFIG_NR_CPUS=2 | 4 | CONFIG_NR_CPUS=2 |
5 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
6 | CONFIG_FHANDLE=y | ||
6 | CONFIG_NO_HZ=y | 7 | CONFIG_NO_HZ=y |
7 | CONFIG_HIGH_RES_TIMERS=y | 8 | CONFIG_HIGH_RES_TIMERS=y |
8 | CONFIG_BLK_DEV_INITRD=y | 9 | CONFIG_BLK_DEV_INITRD=y |
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index f26b267eb71f..f6c02f8cdc62 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig | |||
@@ -4,6 +4,7 @@ CONFIG_VSX=y | |||
4 | CONFIG_SMP=y | 4 | CONFIG_SMP=y |
5 | CONFIG_SYSVIPC=y | 5 | CONFIG_SYSVIPC=y |
6 | CONFIG_POSIX_MQUEUE=y | 6 | CONFIG_POSIX_MQUEUE=y |
7 | CONFIG_FHANDLE=y | ||
7 | CONFIG_IRQ_DOMAIN_DEBUG=y | 8 | CONFIG_IRQ_DOMAIN_DEBUG=y |
8 | CONFIG_NO_HZ=y | 9 | CONFIG_NO_HZ=y |
9 | CONFIG_HIGH_RES_TIMERS=y | 10 | CONFIG_HIGH_RES_TIMERS=y |
diff --git a/arch/powerpc/configs/ppc64e_defconfig b/arch/powerpc/configs/ppc64e_defconfig index 438e813dc9cb..587f5514f9b1 100644 --- a/arch/powerpc/configs/ppc64e_defconfig +++ b/arch/powerpc/configs/ppc64e_defconfig | |||
@@ -3,6 +3,7 @@ CONFIG_PPC_BOOK3E_64=y | |||
3 | CONFIG_SMP=y | 3 | CONFIG_SMP=y |
4 | CONFIG_SYSVIPC=y | 4 | CONFIG_SYSVIPC=y |
5 | CONFIG_POSIX_MQUEUE=y | 5 | CONFIG_POSIX_MQUEUE=y |
6 | CONFIG_FHANDLE=y | ||
6 | CONFIG_NO_HZ=y | 7 | CONFIG_NO_HZ=y |
7 | CONFIG_HIGH_RES_TIMERS=y | 8 | CONFIG_HIGH_RES_TIMERS=y |
8 | CONFIG_TASKSTATS=y | 9 | CONFIG_TASKSTATS=y |
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig index fdee37fab81c..2e637c881d2b 100644 --- a/arch/powerpc/configs/ps3_defconfig +++ b/arch/powerpc/configs/ps3_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=2 | 5 | CONFIG_NR_CPUS=2 |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_POSIX_MQUEUE=y | 7 | CONFIG_POSIX_MQUEUE=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_HIGH_RES_TIMERS=y | 9 | CONFIG_HIGH_RES_TIMERS=y |
9 | CONFIG_BLK_DEV_INITRD=y | 10 | CONFIG_BLK_DEV_INITRD=y |
10 | CONFIG_RD_LZMA=y | 11 | CONFIG_RD_LZMA=y |
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig index a905063281cc..50375f1f59e7 100644 --- a/arch/powerpc/configs/pseries_defconfig +++ b/arch/powerpc/configs/pseries_defconfig | |||
@@ -5,6 +5,7 @@ CONFIG_SMP=y | |||
5 | CONFIG_NR_CPUS=2048 | 5 | CONFIG_NR_CPUS=2048 |
6 | CONFIG_SYSVIPC=y | 6 | CONFIG_SYSVIPC=y |
7 | CONFIG_POSIX_MQUEUE=y | 7 | CONFIG_POSIX_MQUEUE=y |
8 | CONFIG_FHANDLE=y | ||
8 | CONFIG_AUDIT=y | 9 | CONFIG_AUDIT=y |
9 | CONFIG_AUDITSYSCALL=y | 10 | CONFIG_AUDITSYSCALL=y |
10 | CONFIG_IRQ_DOMAIN_DEBUG=y | 11 | CONFIG_IRQ_DOMAIN_DEBUG=y |
diff --git a/arch/powerpc/configs/pseries_le_defconfig b/arch/powerpc/configs/pseries_le_defconfig index 58e3dbf43ca4..4428ee428f4e 100644 --- a/arch/powerpc/configs/pseries_le_defconfig +++ b/arch/powerpc/configs/pseries_le_defconfig | |||
@@ -6,6 +6,7 @@ CONFIG_NR_CPUS=2048 | |||
6 | CONFIG_CPU_LITTLE_ENDIAN=y | 6 | CONFIG_CPU_LITTLE_ENDIAN=y |
7 | CONFIG_SYSVIPC=y | 7 | CONFIG_SYSVIPC=y |
8 | CONFIG_POSIX_MQUEUE=y | 8 | CONFIG_POSIX_MQUEUE=y |
9 | CONFIG_FHANDLE=y | ||
9 | CONFIG_AUDIT=y | 10 | CONFIG_AUDIT=y |
10 | CONFIG_AUDITSYSCALL=y | 11 | CONFIG_AUDITSYSCALL=y |
11 | CONFIG_IRQ_DOMAIN_DEBUG=y | 12 | CONFIG_IRQ_DOMAIN_DEBUG=y |
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index 279b80f3bb29..c0c61fa9cd9e 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h | |||
@@ -47,6 +47,12 @@ | |||
47 | STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) | 47 | STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) |
48 | #define STACK_FRAME_MARKER 12 | 48 | #define STACK_FRAME_MARKER 12 |
49 | 49 | ||
50 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
51 | #define STACK_FRAME_MIN_SIZE 32 | ||
52 | #else | ||
53 | #define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD | ||
54 | #endif | ||
55 | |||
50 | /* Size of dummy stack frame allocated when calling signal handler. */ | 56 | /* Size of dummy stack frame allocated when calling signal handler. */ |
51 | #define __SIGNAL_FRAMESIZE 128 | 57 | #define __SIGNAL_FRAMESIZE 128 |
52 | #define __SIGNAL_FRAMESIZE32 64 | 58 | #define __SIGNAL_FRAMESIZE32 64 |
@@ -60,6 +66,7 @@ | |||
60 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) | 66 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) |
61 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) | 67 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) |
62 | #define STACK_FRAME_MARKER 2 | 68 | #define STACK_FRAME_MARKER 2 |
69 | #define STACK_FRAME_MIN_SIZE STACK_FRAME_OVERHEAD | ||
63 | 70 | ||
64 | /* Size of stack frame allocated when calling signal handler. */ | 71 | /* Size of stack frame allocated when calling signal handler. */ |
65 | #define __SIGNAL_FRAMESIZE 64 | 72 | #define __SIGNAL_FRAMESIZE 64 |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 542bc0f0673f..7d8a60068805 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -362,3 +362,6 @@ SYSCALL(ni_syscall) /* sys_kcmp */ | |||
362 | SYSCALL_SPU(sched_setattr) | 362 | SYSCALL_SPU(sched_setattr) |
363 | SYSCALL_SPU(sched_getattr) | 363 | SYSCALL_SPU(sched_getattr) |
364 | SYSCALL_SPU(renameat2) | 364 | SYSCALL_SPU(renameat2) |
365 | SYSCALL_SPU(seccomp) | ||
366 | SYSCALL_SPU(getrandom) | ||
367 | SYSCALL_SPU(memfd_create) | ||
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 5ce5552ab9f5..4e9af3fd43e7 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <uapi/asm/unistd.h> | 12 | #include <uapi/asm/unistd.h> |
13 | 13 | ||
14 | 14 | ||
15 | #define __NR_syscalls 358 | 15 | #define __NR_syscalls 361 |
16 | 16 | ||
17 | #define __NR__exit __NR_exit | 17 | #define __NR__exit __NR_exit |
18 | #define NR_syscalls __NR_syscalls | 18 | #define NR_syscalls __NR_syscalls |
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h index 2d526f7b48da..0688fc06e183 100644 --- a/arch/powerpc/include/uapi/asm/unistd.h +++ b/arch/powerpc/include/uapi/asm/unistd.h | |||
@@ -380,5 +380,8 @@ | |||
380 | #define __NR_sched_setattr 355 | 380 | #define __NR_sched_setattr 355 |
381 | #define __NR_sched_getattr 356 | 381 | #define __NR_sched_getattr 356 |
382 | #define __NR_renameat2 357 | 382 | #define __NR_renameat2 357 |
383 | #define __NR_seccomp 358 | ||
384 | #define __NR_getrandom 359 | ||
385 | #define __NR_memfd_create 360 | ||
383 | 386 | ||
384 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 387 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c index 74d1e780748b..2396dda282cd 100644 --- a/arch/powerpc/perf/callchain.c +++ b/arch/powerpc/perf/callchain.c | |||
@@ -35,7 +35,7 @@ static int valid_next_sp(unsigned long sp, unsigned long prev_sp) | |||
35 | return 0; /* must be 16-byte aligned */ | 35 | return 0; /* must be 16-byte aligned */ |
36 | if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) | 36 | if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) |
37 | return 0; | 37 | return 0; |
38 | if (sp >= prev_sp + STACK_FRAME_OVERHEAD) | 38 | if (sp >= prev_sp + STACK_FRAME_MIN_SIZE) |
39 | return 1; | 39 | return 1; |
40 | /* | 40 | /* |
41 | * sp could decrease when we jump off an interrupt stack | 41 | * sp could decrease when we jump off an interrupt stack |
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c index 97ac8dc33667..5e1ed1575aab 100644 --- a/arch/powerpc/platforms/powernv/opal-hmi.c +++ b/arch/powerpc/platforms/powernv/opal-hmi.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <asm/opal.h> | 29 | #include <asm/opal.h> |
30 | #include <asm/cputable.h> | 30 | #include <asm/cputable.h> |
31 | #include <asm/machdep.h> | ||
31 | 32 | ||
32 | static int opal_hmi_handler_nb_init; | 33 | static int opal_hmi_handler_nb_init; |
33 | struct OpalHmiEvtNode { | 34 | struct OpalHmiEvtNode { |
@@ -185,4 +186,4 @@ static int __init opal_hmi_handler_init(void) | |||
185 | } | 186 | } |
186 | return 0; | 187 | return 0; |
187 | } | 188 | } |
188 | subsys_initcall(opal_hmi_handler_init); | 189 | machine_subsys_initcall(powernv, opal_hmi_handler_init); |
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index c904583baf4b..17ee193960a0 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c | |||
@@ -113,7 +113,7 @@ out: | |||
113 | static int pseries_remove_mem_node(struct device_node *np) | 113 | static int pseries_remove_mem_node(struct device_node *np) |
114 | { | 114 | { |
115 | const char *type; | 115 | const char *type; |
116 | const unsigned int *regs; | 116 | const __be32 *regs; |
117 | unsigned long base; | 117 | unsigned long base; |
118 | unsigned int lmb_size; | 118 | unsigned int lmb_size; |
119 | int ret = -EINVAL; | 119 | int ret = -EINVAL; |
@@ -132,8 +132,8 @@ static int pseries_remove_mem_node(struct device_node *np) | |||
132 | if (!regs) | 132 | if (!regs) |
133 | return ret; | 133 | return ret; |
134 | 134 | ||
135 | base = *(unsigned long *)regs; | 135 | base = be64_to_cpu(*(unsigned long *)regs); |
136 | lmb_size = regs[3]; | 136 | lmb_size = be32_to_cpu(regs[3]); |
137 | 137 | ||
138 | pseries_remove_memblock(base, lmb_size); | 138 | pseries_remove_memblock(base, lmb_size); |
139 | return 0; | 139 | return 0; |
@@ -153,7 +153,7 @@ static inline int pseries_remove_mem_node(struct device_node *np) | |||
153 | static int pseries_add_mem_node(struct device_node *np) | 153 | static int pseries_add_mem_node(struct device_node *np) |
154 | { | 154 | { |
155 | const char *type; | 155 | const char *type; |
156 | const unsigned int *regs; | 156 | const __be32 *regs; |
157 | unsigned long base; | 157 | unsigned long base; |
158 | unsigned int lmb_size; | 158 | unsigned int lmb_size; |
159 | int ret = -EINVAL; | 159 | int ret = -EINVAL; |
@@ -172,8 +172,8 @@ static int pseries_add_mem_node(struct device_node *np) | |||
172 | if (!regs) | 172 | if (!regs) |
173 | return ret; | 173 | return ret; |
174 | 174 | ||
175 | base = *(unsigned long *)regs; | 175 | base = be64_to_cpu(*(unsigned long *)regs); |
176 | lmb_size = regs[3]; | 176 | lmb_size = be32_to_cpu(regs[3]); |
177 | 177 | ||
178 | /* | 178 | /* |
179 | * Update memory region to represent the memory add | 179 | * Update memory region to represent the memory add |
@@ -187,14 +187,14 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) | |||
187 | struct of_drconf_cell *new_drmem, *old_drmem; | 187 | struct of_drconf_cell *new_drmem, *old_drmem; |
188 | unsigned long memblock_size; | 188 | unsigned long memblock_size; |
189 | u32 entries; | 189 | u32 entries; |
190 | u32 *p; | 190 | __be32 *p; |
191 | int i, rc = -EINVAL; | 191 | int i, rc = -EINVAL; |
192 | 192 | ||
193 | memblock_size = pseries_memory_block_size(); | 193 | memblock_size = pseries_memory_block_size(); |
194 | if (!memblock_size) | 194 | if (!memblock_size) |
195 | return -EINVAL; | 195 | return -EINVAL; |
196 | 196 | ||
197 | p = (u32 *) pr->old_prop->value; | 197 | p = (__be32 *) pr->old_prop->value; |
198 | if (!p) | 198 | if (!p) |
199 | return -EINVAL; | 199 | return -EINVAL; |
200 | 200 | ||
@@ -203,28 +203,30 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) | |||
203 | * entries. Get the niumber of entries and skip to the array of | 203 | * entries. Get the niumber of entries and skip to the array of |
204 | * of_drconf_cell's. | 204 | * of_drconf_cell's. |
205 | */ | 205 | */ |
206 | entries = *p++; | 206 | entries = be32_to_cpu(*p++); |
207 | old_drmem = (struct of_drconf_cell *)p; | 207 | old_drmem = (struct of_drconf_cell *)p; |
208 | 208 | ||
209 | p = (u32 *)pr->prop->value; | 209 | p = (__be32 *)pr->prop->value; |
210 | p++; | 210 | p++; |
211 | new_drmem = (struct of_drconf_cell *)p; | 211 | new_drmem = (struct of_drconf_cell *)p; |
212 | 212 | ||
213 | for (i = 0; i < entries; i++) { | 213 | for (i = 0; i < entries; i++) { |
214 | if ((old_drmem[i].flags & DRCONF_MEM_ASSIGNED) && | 214 | if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) && |
215 | (!(new_drmem[i].flags & DRCONF_MEM_ASSIGNED))) { | 215 | (!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) { |
216 | rc = pseries_remove_memblock(old_drmem[i].base_addr, | 216 | rc = pseries_remove_memblock( |
217 | be64_to_cpu(old_drmem[i].base_addr), | ||
217 | memblock_size); | 218 | memblock_size); |
218 | break; | 219 | break; |
219 | } else if ((!(old_drmem[i].flags & DRCONF_MEM_ASSIGNED)) && | 220 | } else if ((!(be32_to_cpu(old_drmem[i].flags) & |
220 | (new_drmem[i].flags & DRCONF_MEM_ASSIGNED)) { | 221 | DRCONF_MEM_ASSIGNED)) && |
221 | rc = memblock_add(old_drmem[i].base_addr, | 222 | (be32_to_cpu(new_drmem[i].flags) & |
223 | DRCONF_MEM_ASSIGNED)) { | ||
224 | rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr), | ||
222 | memblock_size); | 225 | memblock_size); |
223 | rc = (rc < 0) ? -EINVAL : 0; | 226 | rc = (rc < 0) ? -EINVAL : 0; |
224 | break; | 227 | break; |
225 | } | 228 | } |
226 | } | 229 | } |
227 | |||
228 | return rc; | 230 | return rc; |
229 | } | 231 | } |
230 | 232 | ||
diff --git a/arch/s390/include/asm/ipl.h b/arch/s390/include/asm/ipl.h index 2fcccc0c997c..c81661e756a0 100644 --- a/arch/s390/include/asm/ipl.h +++ b/arch/s390/include/asm/ipl.h | |||
@@ -17,12 +17,12 @@ | |||
17 | #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ | 17 | #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \ |
18 | sizeof(struct ipl_block_fcp)) | 18 | sizeof(struct ipl_block_fcp)) |
19 | 19 | ||
20 | #define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 8) | 20 | #define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 16) |
21 | 21 | ||
22 | #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ | 22 | #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \ |
23 | sizeof(struct ipl_block_ccw)) | 23 | sizeof(struct ipl_block_ccw)) |
24 | 24 | ||
25 | #define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 8) | 25 | #define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 16) |
26 | 26 | ||
27 | #define IPL_MAX_SUPPORTED_VERSION (0) | 27 | #define IPL_MAX_SUPPORTED_VERSION (0) |
28 | 28 | ||
@@ -38,10 +38,11 @@ struct ipl_list_hdr { | |||
38 | u8 pbt; | 38 | u8 pbt; |
39 | u8 flags; | 39 | u8 flags; |
40 | u16 reserved2; | 40 | u16 reserved2; |
41 | u8 loadparm[8]; | ||
41 | } __attribute__((packed)); | 42 | } __attribute__((packed)); |
42 | 43 | ||
43 | struct ipl_block_fcp { | 44 | struct ipl_block_fcp { |
44 | u8 reserved1[313-1]; | 45 | u8 reserved1[305-1]; |
45 | u8 opt; | 46 | u8 opt; |
46 | u8 reserved2[3]; | 47 | u8 reserved2[3]; |
47 | u16 reserved3; | 48 | u16 reserved3; |
@@ -62,7 +63,6 @@ struct ipl_block_fcp { | |||
62 | offsetof(struct ipl_block_fcp, scp_data))) | 63 | offsetof(struct ipl_block_fcp, scp_data))) |
63 | 64 | ||
64 | struct ipl_block_ccw { | 65 | struct ipl_block_ccw { |
65 | u8 load_parm[8]; | ||
66 | u8 reserved1[84]; | 66 | u8 reserved1[84]; |
67 | u8 reserved2[2]; | 67 | u8 reserved2[2]; |
68 | u16 devno; | 68 | u16 devno; |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 22aac5885ba2..39badb9ca0b3 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -455,22 +455,6 @@ DEFINE_IPL_ATTR_RO(ipl_fcp, bootprog, "%lld\n", (unsigned long long) | |||
455 | DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long) | 455 | DEFINE_IPL_ATTR_RO(ipl_fcp, br_lba, "%lld\n", (unsigned long long) |
456 | IPL_PARMBLOCK_START->ipl_info.fcp.br_lba); | 456 | IPL_PARMBLOCK_START->ipl_info.fcp.br_lba); |
457 | 457 | ||
458 | static struct attribute *ipl_fcp_attrs[] = { | ||
459 | &sys_ipl_type_attr.attr, | ||
460 | &sys_ipl_device_attr.attr, | ||
461 | &sys_ipl_fcp_wwpn_attr.attr, | ||
462 | &sys_ipl_fcp_lun_attr.attr, | ||
463 | &sys_ipl_fcp_bootprog_attr.attr, | ||
464 | &sys_ipl_fcp_br_lba_attr.attr, | ||
465 | NULL, | ||
466 | }; | ||
467 | |||
468 | static struct attribute_group ipl_fcp_attr_group = { | ||
469 | .attrs = ipl_fcp_attrs, | ||
470 | }; | ||
471 | |||
472 | /* CCW ipl device attributes */ | ||
473 | |||
474 | static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, | 458 | static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, |
475 | struct kobj_attribute *attr, char *page) | 459 | struct kobj_attribute *attr, char *page) |
476 | { | 460 | { |
@@ -487,6 +471,23 @@ static ssize_t ipl_ccw_loadparm_show(struct kobject *kobj, | |||
487 | static struct kobj_attribute sys_ipl_ccw_loadparm_attr = | 471 | static struct kobj_attribute sys_ipl_ccw_loadparm_attr = |
488 | __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); | 472 | __ATTR(loadparm, 0444, ipl_ccw_loadparm_show, NULL); |
489 | 473 | ||
474 | static struct attribute *ipl_fcp_attrs[] = { | ||
475 | &sys_ipl_type_attr.attr, | ||
476 | &sys_ipl_device_attr.attr, | ||
477 | &sys_ipl_fcp_wwpn_attr.attr, | ||
478 | &sys_ipl_fcp_lun_attr.attr, | ||
479 | &sys_ipl_fcp_bootprog_attr.attr, | ||
480 | &sys_ipl_fcp_br_lba_attr.attr, | ||
481 | &sys_ipl_ccw_loadparm_attr.attr, | ||
482 | NULL, | ||
483 | }; | ||
484 | |||
485 | static struct attribute_group ipl_fcp_attr_group = { | ||
486 | .attrs = ipl_fcp_attrs, | ||
487 | }; | ||
488 | |||
489 | /* CCW ipl device attributes */ | ||
490 | |||
490 | static struct attribute *ipl_ccw_attrs_vm[] = { | 491 | static struct attribute *ipl_ccw_attrs_vm[] = { |
491 | &sys_ipl_type_attr.attr, | 492 | &sys_ipl_type_attr.attr, |
492 | &sys_ipl_device_attr.attr, | 493 | &sys_ipl_device_attr.attr, |
@@ -765,28 +766,10 @@ DEFINE_IPL_ATTR_RW(reipl_fcp, br_lba, "%lld\n", "%lld\n", | |||
765 | DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", | 766 | DEFINE_IPL_ATTR_RW(reipl_fcp, device, "0.0.%04llx\n", "0.0.%llx\n", |
766 | reipl_block_fcp->ipl_info.fcp.devno); | 767 | reipl_block_fcp->ipl_info.fcp.devno); |
767 | 768 | ||
768 | static struct attribute *reipl_fcp_attrs[] = { | ||
769 | &sys_reipl_fcp_device_attr.attr, | ||
770 | &sys_reipl_fcp_wwpn_attr.attr, | ||
771 | &sys_reipl_fcp_lun_attr.attr, | ||
772 | &sys_reipl_fcp_bootprog_attr.attr, | ||
773 | &sys_reipl_fcp_br_lba_attr.attr, | ||
774 | NULL, | ||
775 | }; | ||
776 | |||
777 | static struct attribute_group reipl_fcp_attr_group = { | ||
778 | .attrs = reipl_fcp_attrs, | ||
779 | }; | ||
780 | |||
781 | /* CCW reipl device attributes */ | ||
782 | |||
783 | DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n", | ||
784 | reipl_block_ccw->ipl_info.ccw.devno); | ||
785 | |||
786 | static void reipl_get_ascii_loadparm(char *loadparm, | 769 | static void reipl_get_ascii_loadparm(char *loadparm, |
787 | struct ipl_parameter_block *ibp) | 770 | struct ipl_parameter_block *ibp) |
788 | { | 771 | { |
789 | memcpy(loadparm, ibp->ipl_info.ccw.load_parm, LOADPARM_LEN); | 772 | memcpy(loadparm, ibp->hdr.loadparm, LOADPARM_LEN); |
790 | EBCASC(loadparm, LOADPARM_LEN); | 773 | EBCASC(loadparm, LOADPARM_LEN); |
791 | loadparm[LOADPARM_LEN] = 0; | 774 | loadparm[LOADPARM_LEN] = 0; |
792 | strim(loadparm); | 775 | strim(loadparm); |
@@ -821,13 +804,50 @@ static ssize_t reipl_generic_loadparm_store(struct ipl_parameter_block *ipb, | |||
821 | return -EINVAL; | 804 | return -EINVAL; |
822 | } | 805 | } |
823 | /* initialize loadparm with blanks */ | 806 | /* initialize loadparm with blanks */ |
824 | memset(ipb->ipl_info.ccw.load_parm, ' ', LOADPARM_LEN); | 807 | memset(ipb->hdr.loadparm, ' ', LOADPARM_LEN); |
825 | /* copy and convert to ebcdic */ | 808 | /* copy and convert to ebcdic */ |
826 | memcpy(ipb->ipl_info.ccw.load_parm, buf, lp_len); | 809 | memcpy(ipb->hdr.loadparm, buf, lp_len); |
827 | ASCEBC(ipb->ipl_info.ccw.load_parm, LOADPARM_LEN); | 810 | ASCEBC(ipb->hdr.loadparm, LOADPARM_LEN); |
828 | return len; | 811 | return len; |
829 | } | 812 | } |
830 | 813 | ||
814 | /* FCP wrapper */ | ||
815 | static ssize_t reipl_fcp_loadparm_show(struct kobject *kobj, | ||
816 | struct kobj_attribute *attr, char *page) | ||
817 | { | ||
818 | return reipl_generic_loadparm_show(reipl_block_fcp, page); | ||
819 | } | ||
820 | |||
821 | static ssize_t reipl_fcp_loadparm_store(struct kobject *kobj, | ||
822 | struct kobj_attribute *attr, | ||
823 | const char *buf, size_t len) | ||
824 | { | ||
825 | return reipl_generic_loadparm_store(reipl_block_fcp, buf, len); | ||
826 | } | ||
827 | |||
828 | static struct kobj_attribute sys_reipl_fcp_loadparm_attr = | ||
829 | __ATTR(loadparm, S_IRUGO | S_IWUSR, reipl_fcp_loadparm_show, | ||
830 | reipl_fcp_loadparm_store); | ||
831 | |||
832 | static struct attribute *reipl_fcp_attrs[] = { | ||
833 | &sys_reipl_fcp_device_attr.attr, | ||
834 | &sys_reipl_fcp_wwpn_attr.attr, | ||
835 | &sys_reipl_fcp_lun_attr.attr, | ||
836 | &sys_reipl_fcp_bootprog_attr.attr, | ||
837 | &sys_reipl_fcp_br_lba_attr.attr, | ||
838 | &sys_reipl_fcp_loadparm_attr.attr, | ||
839 | NULL, | ||
840 | }; | ||
841 | |||
842 | static struct attribute_group reipl_fcp_attr_group = { | ||
843 | .attrs = reipl_fcp_attrs, | ||
844 | }; | ||
845 | |||
846 | /* CCW reipl device attributes */ | ||
847 | |||
848 | DEFINE_IPL_ATTR_RW(reipl_ccw, device, "0.0.%04llx\n", "0.0.%llx\n", | ||
849 | reipl_block_ccw->ipl_info.ccw.devno); | ||
850 | |||
831 | /* NSS wrapper */ | 851 | /* NSS wrapper */ |
832 | static ssize_t reipl_nss_loadparm_show(struct kobject *kobj, | 852 | static ssize_t reipl_nss_loadparm_show(struct kobject *kobj, |
833 | struct kobj_attribute *attr, char *page) | 853 | struct kobj_attribute *attr, char *page) |
@@ -1125,11 +1145,10 @@ static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb) | |||
1125 | /* LOADPARM */ | 1145 | /* LOADPARM */ |
1126 | /* check if read scp info worked and set loadparm */ | 1146 | /* check if read scp info worked and set loadparm */ |
1127 | if (sclp_ipl_info.is_valid) | 1147 | if (sclp_ipl_info.is_valid) |
1128 | memcpy(ipb->ipl_info.ccw.load_parm, | 1148 | memcpy(ipb->hdr.loadparm, &sclp_ipl_info.loadparm, LOADPARM_LEN); |
1129 | &sclp_ipl_info.loadparm, LOADPARM_LEN); | ||
1130 | else | 1149 | else |
1131 | /* read scp info failed: set empty loadparm (EBCDIC blanks) */ | 1150 | /* read scp info failed: set empty loadparm (EBCDIC blanks) */ |
1132 | memset(ipb->ipl_info.ccw.load_parm, 0x40, LOADPARM_LEN); | 1151 | memset(ipb->hdr.loadparm, 0x40, LOADPARM_LEN); |
1133 | ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; | 1152 | ipb->hdr.flags = DIAG308_FLAGS_LP_VALID; |
1134 | 1153 | ||
1135 | /* VM PARM */ | 1154 | /* VM PARM */ |
@@ -1251,9 +1270,16 @@ static int __init reipl_fcp_init(void) | |||
1251 | return rc; | 1270 | return rc; |
1252 | } | 1271 | } |
1253 | 1272 | ||
1254 | if (ipl_info.type == IPL_TYPE_FCP) | 1273 | if (ipl_info.type == IPL_TYPE_FCP) { |
1255 | memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); | 1274 | memcpy(reipl_block_fcp, IPL_PARMBLOCK_START, PAGE_SIZE); |
1256 | else { | 1275 | /* |
1276 | * Fix loadparm: There are systems where the (SCSI) LOADPARM | ||
1277 | * is invalid in the SCSI IPL parameter block, so take it | ||
1278 | * always from sclp_ipl_info. | ||
1279 | */ | ||
1280 | memcpy(reipl_block_fcp->hdr.loadparm, sclp_ipl_info.loadparm, | ||
1281 | LOADPARM_LEN); | ||
1282 | } else { | ||
1257 | reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; | 1283 | reipl_block_fcp->hdr.len = IPL_PARM_BLK_FCP_LEN; |
1258 | reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; | 1284 | reipl_block_fcp->hdr.version = IPL_PARM_BLOCK_VERSION; |
1259 | reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; | 1285 | reipl_block_fcp->hdr.blk0_len = IPL_PARM_BLK0_FCP_LEN; |
@@ -1864,7 +1890,23 @@ static void __init shutdown_actions_init(void) | |||
1864 | 1890 | ||
1865 | static int __init s390_ipl_init(void) | 1891 | static int __init s390_ipl_init(void) |
1866 | { | 1892 | { |
1893 | char str[8] = {0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}; | ||
1894 | |||
1867 | sclp_get_ipl_info(&sclp_ipl_info); | 1895 | sclp_get_ipl_info(&sclp_ipl_info); |
1896 | /* | ||
1897 | * Fix loadparm: There are systems where the (SCSI) LOADPARM | ||
1898 | * returned by read SCP info is invalid (contains EBCDIC blanks) | ||
1899 | * when the system has been booted via diag308. In that case we use | ||
1900 | * the value from diag308, if available. | ||
1901 | * | ||
1902 | * There are also systems where diag308 store does not work in | ||
1903 | * case the system is booted from HMC. Fortunately in this case | ||
1904 | * READ SCP info provides the correct value. | ||
1905 | */ | ||
1906 | if (memcmp(sclp_ipl_info.loadparm, str, sizeof(str)) == 0 && | ||
1907 | diag308_set_works) | ||
1908 | memcpy(sclp_ipl_info.loadparm, ipl_block.hdr.loadparm, | ||
1909 | LOADPARM_LEN); | ||
1868 | shutdown_actions_init(); | 1910 | shutdown_actions_init(); |
1869 | shutdown_triggers_init(); | 1911 | shutdown_triggers_init(); |
1870 | return 0; | 1912 | return 0; |
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index 65fc3979c2f1..7cf18f8d4cb4 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S | |||
@@ -22,13 +22,11 @@ __kernel_clock_gettime: | |||
22 | basr %r5,0 | 22 | basr %r5,0 |
23 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ | 23 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ |
24 | chi %r2,__CLOCK_REALTIME | 24 | chi %r2,__CLOCK_REALTIME |
25 | je 10f | 25 | je 11f |
26 | chi %r2,__CLOCK_MONOTONIC | 26 | chi %r2,__CLOCK_MONOTONIC |
27 | jne 19f | 27 | jne 19f |
28 | 28 | ||
29 | /* CLOCK_MONOTONIC */ | 29 | /* CLOCK_MONOTONIC */ |
30 | ltr %r3,%r3 | ||
31 | jz 9f /* tp == NULL */ | ||
32 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 30 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
33 | tml %r4,0x0001 /* pending update ? loop */ | 31 | tml %r4,0x0001 /* pending update ? loop */ |
34 | jnz 1b | 32 | jnz 1b |
@@ -67,12 +65,10 @@ __kernel_clock_gettime: | |||
67 | j 6b | 65 | j 6b |
68 | 8: st %r2,0(%r3) /* store tp->tv_sec */ | 66 | 8: st %r2,0(%r3) /* store tp->tv_sec */ |
69 | st %r1,4(%r3) /* store tp->tv_nsec */ | 67 | st %r1,4(%r3) /* store tp->tv_nsec */ |
70 | 9: lhi %r2,0 | 68 | lhi %r2,0 |
71 | br %r14 | 69 | br %r14 |
72 | 70 | ||
73 | /* CLOCK_REALTIME */ | 71 | /* CLOCK_REALTIME */ |
74 | 10: ltr %r3,%r3 /* tp == NULL */ | ||
75 | jz 18f | ||
76 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 72 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
77 | tml %r4,0x0001 /* pending update ? loop */ | 73 | tml %r4,0x0001 /* pending update ? loop */ |
78 | jnz 11b | 74 | jnz 11b |
@@ -111,7 +107,7 @@ __kernel_clock_gettime: | |||
111 | j 15b | 107 | j 15b |
112 | 17: st %r2,0(%r3) /* store tp->tv_sec */ | 108 | 17: st %r2,0(%r3) /* store tp->tv_sec */ |
113 | st %r1,4(%r3) /* store tp->tv_nsec */ | 109 | st %r1,4(%r3) /* store tp->tv_nsec */ |
114 | 18: lhi %r2,0 | 110 | lhi %r2,0 |
115 | br %r14 | 111 | br %r14 |
116 | 112 | ||
117 | /* Fallback to system call */ | 113 | /* Fallback to system call */ |
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index 91940ed33a4a..3f34e09db5f4 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -21,7 +21,7 @@ __kernel_clock_gettime: | |||
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | larl %r5,_vdso_data | 22 | larl %r5,_vdso_data |
23 | cghi %r2,__CLOCK_REALTIME | 23 | cghi %r2,__CLOCK_REALTIME |
24 | je 4f | 24 | je 5f |
25 | cghi %r2,__CLOCK_THREAD_CPUTIME_ID | 25 | cghi %r2,__CLOCK_THREAD_CPUTIME_ID |
26 | je 9f | 26 | je 9f |
27 | cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ | 27 | cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */ |
@@ -30,8 +30,6 @@ __kernel_clock_gettime: | |||
30 | jne 12f | 30 | jne 12f |
31 | 31 | ||
32 | /* CLOCK_MONOTONIC */ | 32 | /* CLOCK_MONOTONIC */ |
33 | ltgr %r3,%r3 | ||
34 | jz 3f /* tp == NULL */ | ||
35 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 33 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
36 | tmll %r4,0x0001 /* pending update ? loop */ | 34 | tmll %r4,0x0001 /* pending update ? loop */ |
37 | jnz 0b | 35 | jnz 0b |
@@ -53,12 +51,10 @@ __kernel_clock_gettime: | |||
53 | j 1b | 51 | j 1b |
54 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ | 52 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ |
55 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 53 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
56 | 3: lghi %r2,0 | 54 | lghi %r2,0 |
57 | br %r14 | 55 | br %r14 |
58 | 56 | ||
59 | /* CLOCK_REALTIME */ | 57 | /* CLOCK_REALTIME */ |
60 | 4: ltr %r3,%r3 /* tp == NULL */ | ||
61 | jz 8f | ||
62 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 58 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
63 | tmll %r4,0x0001 /* pending update ? loop */ | 59 | tmll %r4,0x0001 /* pending update ? loop */ |
64 | jnz 5b | 60 | jnz 5b |
@@ -80,7 +76,7 @@ __kernel_clock_gettime: | |||
80 | j 6b | 76 | j 6b |
81 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ | 77 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ |
82 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 78 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
83 | 8: lghi %r2,0 | 79 | lghi %r2,0 |
84 | br %r14 | 80 | br %r14 |
85 | 81 | ||
86 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ | 82 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 0c1073ed1e84..c7235e01fd67 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -43,6 +43,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); | |||
43 | 43 | ||
44 | unsigned long empty_zero_page, zero_page_mask; | 44 | unsigned long empty_zero_page, zero_page_mask; |
45 | EXPORT_SYMBOL(empty_zero_page); | 45 | EXPORT_SYMBOL(empty_zero_page); |
46 | EXPORT_SYMBOL(zero_page_mask); | ||
46 | 47 | ||
47 | static void __init setup_zero_pages(void) | 48 | static void __init setup_zero_pages(void) |
48 | { | 49 | { |
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c index bf8daf9d9c9b..37458f38b220 100644 --- a/arch/sh/mm/gup.c +++ b/arch/sh/mm/gup.c | |||
@@ -105,6 +105,8 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, | |||
105 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | 105 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); |
106 | page = pte_page(pte); | 106 | page = pte_page(pte); |
107 | get_page(page); | 107 | get_page(page); |
108 | __flush_anon_page(page, addr); | ||
109 | flush_dcache_page(page); | ||
108 | pages[*nr] = page; | 110 | pages[*nr] = page; |
109 | (*nr)++; | 111 | (*nr)++; |
110 | 112 | ||
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c index 2dde48bdcc42..7c06f18150ab 100644 --- a/arch/sparc/net/bpf_jit_comp.c +++ b/arch/sparc/net/bpf_jit_comp.c | |||
@@ -234,12 +234,18 @@ do { BUILD_BUG_ON(FIELD_SIZEOF(STRUCT, FIELD) != sizeof(u8)); \ | |||
234 | __emit_load8(BASE, STRUCT, FIELD, DEST); \ | 234 | __emit_load8(BASE, STRUCT, FIELD, DEST); \ |
235 | } while (0) | 235 | } while (0) |
236 | 236 | ||
237 | #define emit_ldmem(OFF, DEST) \ | 237 | #ifdef CONFIG_SPARC64 |
238 | do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(DEST); \ | 238 | #define BIAS (STACK_BIAS - 4) |
239 | #else | ||
240 | #define BIAS (-4) | ||
241 | #endif | ||
242 | |||
243 | #define emit_ldmem(OFF, DEST) \ | ||
244 | do { *prog++ = LD32I | RS1(SP) | S13(BIAS - (OFF)) | RD(DEST); \ | ||
239 | } while (0) | 245 | } while (0) |
240 | 246 | ||
241 | #define emit_stmem(OFF, SRC) \ | 247 | #define emit_stmem(OFF, SRC) \ |
242 | do { *prog++ = LD32I | RS1(FP) | S13(-(OFF)) | RD(SRC); \ | 248 | do { *prog++ = ST32I | RS1(SP) | S13(BIAS - (OFF)) | RD(SRC); \ |
243 | } while (0) | 249 | } while (0) |
244 | 250 | ||
245 | #ifdef CONFIG_SMP | 251 | #ifdef CONFIG_SMP |
@@ -610,10 +616,11 @@ void bpf_jit_compile(struct bpf_prog *fp) | |||
610 | case BPF_ANC | SKF_AD_VLAN_TAG: | 616 | case BPF_ANC | SKF_AD_VLAN_TAG: |
611 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: | 617 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
612 | emit_skb_load16(vlan_tci, r_A); | 618 | emit_skb_load16(vlan_tci, r_A); |
613 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { | 619 | if (code != (BPF_ANC | SKF_AD_VLAN_TAG)) { |
614 | emit_andi(r_A, VLAN_VID_MASK, r_A); | 620 | emit_alu_K(SRL, 12); |
621 | emit_andi(r_A, 1, r_A); | ||
615 | } else { | 622 | } else { |
616 | emit_loadimm(VLAN_TAG_PRESENT, r_TMP); | 623 | emit_loadimm(~VLAN_TAG_PRESENT, r_TMP); |
617 | emit_and(r_A, r_TMP, r_A); | 624 | emit_and(r_A, r_TMP, r_A); |
618 | } | 625 | } |
619 | break; | 626 | break; |
@@ -625,15 +632,19 @@ void bpf_jit_compile(struct bpf_prog *fp) | |||
625 | emit_loadimm(K, r_X); | 632 | emit_loadimm(K, r_X); |
626 | break; | 633 | break; |
627 | case BPF_LD | BPF_MEM: | 634 | case BPF_LD | BPF_MEM: |
635 | seen |= SEEN_MEM; | ||
628 | emit_ldmem(K * 4, r_A); | 636 | emit_ldmem(K * 4, r_A); |
629 | break; | 637 | break; |
630 | case BPF_LDX | BPF_MEM: | 638 | case BPF_LDX | BPF_MEM: |
639 | seen |= SEEN_MEM | SEEN_XREG; | ||
631 | emit_ldmem(K * 4, r_X); | 640 | emit_ldmem(K * 4, r_X); |
632 | break; | 641 | break; |
633 | case BPF_ST: | 642 | case BPF_ST: |
643 | seen |= SEEN_MEM; | ||
634 | emit_stmem(K * 4, r_A); | 644 | emit_stmem(K * 4, r_A); |
635 | break; | 645 | break; |
636 | case BPF_STX: | 646 | case BPF_STX: |
647 | seen |= SEEN_MEM | SEEN_XREG; | ||
637 | emit_stmem(K * 4, r_X); | 648 | emit_stmem(K * 4, r_X); |
638 | break; | 649 | break; |
639 | 650 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 778178f4c7d1..36327438caf0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -23,6 +23,7 @@ config X86 | |||
23 | def_bool y | 23 | def_bool y |
24 | select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI | 24 | select ARCH_MIGHT_HAVE_ACPI_PDC if ACPI |
25 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | 25 | select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS |
26 | select ARCH_HAS_FAST_MULTIPLIER | ||
26 | select ARCH_MIGHT_HAVE_PC_PARPORT | 27 | select ARCH_MIGHT_HAVE_PC_PARPORT |
27 | select ARCH_MIGHT_HAVE_PC_SERIO | 28 | select ARCH_MIGHT_HAVE_PC_SERIO |
28 | select HAVE_AOUT if X86_32 | 29 | select HAVE_AOUT if X86_32 |
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index f277184e2ac1..dca9842d8f91 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -1032,7 +1032,6 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1032 | int i; | 1032 | int i; |
1033 | unsigned long ramdisk_addr; | 1033 | unsigned long ramdisk_addr; |
1034 | unsigned long ramdisk_size; | 1034 | unsigned long ramdisk_size; |
1035 | unsigned long initrd_addr_max; | ||
1036 | 1035 | ||
1037 | efi_early = c; | 1036 | efi_early = c; |
1038 | sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; | 1037 | sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; |
@@ -1095,15 +1094,20 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1095 | 1094 | ||
1096 | memset(sdt, 0, sizeof(*sdt)); | 1095 | memset(sdt, 0, sizeof(*sdt)); |
1097 | 1096 | ||
1098 | if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) | ||
1099 | initrd_addr_max = -1UL; | ||
1100 | else | ||
1101 | initrd_addr_max = hdr->initrd_addr_max; | ||
1102 | |||
1103 | status = handle_cmdline_files(sys_table, image, | 1097 | status = handle_cmdline_files(sys_table, image, |
1104 | (char *)(unsigned long)hdr->cmd_line_ptr, | 1098 | (char *)(unsigned long)hdr->cmd_line_ptr, |
1105 | "initrd=", initrd_addr_max, | 1099 | "initrd=", hdr->initrd_addr_max, |
1106 | &ramdisk_addr, &ramdisk_size); | 1100 | &ramdisk_addr, &ramdisk_size); |
1101 | |||
1102 | if (status != EFI_SUCCESS && | ||
1103 | hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) { | ||
1104 | efi_printk(sys_table, "Trying to load files to higher address\n"); | ||
1105 | status = handle_cmdline_files(sys_table, image, | ||
1106 | (char *)(unsigned long)hdr->cmd_line_ptr, | ||
1107 | "initrd=", -1UL, | ||
1108 | &ramdisk_addr, &ramdisk_size); | ||
1109 | } | ||
1110 | |||
1107 | if (status != EFI_SUCCESS) | 1111 | if (status != EFI_SUCCESS) |
1108 | goto fail2; | 1112 | goto fail2; |
1109 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; | 1113 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; |
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index cbed1407a5cd..d6b8aa4c986c 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S | |||
@@ -30,6 +30,33 @@ | |||
30 | #include <asm/boot.h> | 30 | #include <asm/boot.h> |
31 | #include <asm/asm-offsets.h> | 31 | #include <asm/asm-offsets.h> |
32 | 32 | ||
33 | /* | ||
34 | * Adjust our own GOT | ||
35 | * | ||
36 | * The relocation base must be in %ebx | ||
37 | * | ||
38 | * It is safe to call this macro more than once, because in some of the | ||
39 | * code paths multiple invocations are inevitable, e.g. via the efi* | ||
40 | * entry points. | ||
41 | * | ||
42 | * Relocation is only performed the first time. | ||
43 | */ | ||
44 | .macro FIXUP_GOT | ||
45 | cmpb $1, got_fixed(%ebx) | ||
46 | je 2f | ||
47 | |||
48 | leal _got(%ebx), %edx | ||
49 | leal _egot(%ebx), %ecx | ||
50 | 1: | ||
51 | cmpl %ecx, %edx | ||
52 | jae 2f | ||
53 | addl %ebx, (%edx) | ||
54 | addl $4, %edx | ||
55 | jmp 1b | ||
56 | 2: | ||
57 | movb $1, got_fixed(%ebx) | ||
58 | .endm | ||
59 | |||
33 | __HEAD | 60 | __HEAD |
34 | ENTRY(startup_32) | 61 | ENTRY(startup_32) |
35 | #ifdef CONFIG_EFI_STUB | 62 | #ifdef CONFIG_EFI_STUB |
@@ -56,6 +83,9 @@ ENTRY(efi_pe_entry) | |||
56 | add %esi, 88(%eax) | 83 | add %esi, 88(%eax) |
57 | pushl %eax | 84 | pushl %eax |
58 | 85 | ||
86 | movl %esi, %ebx | ||
87 | FIXUP_GOT | ||
88 | |||
59 | call make_boot_params | 89 | call make_boot_params |
60 | cmpl $0, %eax | 90 | cmpl $0, %eax |
61 | je fail | 91 | je fail |
@@ -81,6 +111,10 @@ ENTRY(efi32_stub_entry) | |||
81 | leal efi32_config(%esi), %eax | 111 | leal efi32_config(%esi), %eax |
82 | add %esi, 88(%eax) | 112 | add %esi, 88(%eax) |
83 | pushl %eax | 113 | pushl %eax |
114 | |||
115 | movl %esi, %ebx | ||
116 | FIXUP_GOT | ||
117 | |||
84 | 2: | 118 | 2: |
85 | call efi_main | 119 | call efi_main |
86 | cmpl $0, %eax | 120 | cmpl $0, %eax |
@@ -190,19 +224,7 @@ relocated: | |||
190 | shrl $2, %ecx | 224 | shrl $2, %ecx |
191 | rep stosl | 225 | rep stosl |
192 | 226 | ||
193 | /* | 227 | FIXUP_GOT |
194 | * Adjust our own GOT | ||
195 | */ | ||
196 | leal _got(%ebx), %edx | ||
197 | leal _egot(%ebx), %ecx | ||
198 | 1: | ||
199 | cmpl %ecx, %edx | ||
200 | jae 2f | ||
201 | addl %ebx, (%edx) | ||
202 | addl $4, %edx | ||
203 | jmp 1b | ||
204 | 2: | ||
205 | |||
206 | /* | 228 | /* |
207 | * Do the decompression, and jump to the new kernel.. | 229 | * Do the decompression, and jump to the new kernel.. |
208 | */ | 230 | */ |
@@ -225,8 +247,12 @@ relocated: | |||
225 | xorl %ebx, %ebx | 247 | xorl %ebx, %ebx |
226 | jmp *%eax | 248 | jmp *%eax |
227 | 249 | ||
228 | #ifdef CONFIG_EFI_STUB | ||
229 | .data | 250 | .data |
251 | /* Have we relocated the GOT? */ | ||
252 | got_fixed: | ||
253 | .byte 0 | ||
254 | |||
255 | #ifdef CONFIG_EFI_STUB | ||
230 | efi32_config: | 256 | efi32_config: |
231 | .fill 11,8,0 | 257 | .fill 11,8,0 |
232 | .long efi_call_phys | 258 | .long efi_call_phys |
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 2884e0c3e8a5..50f69c7eaaf4 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -32,6 +32,33 @@ | |||
32 | #include <asm/processor-flags.h> | 32 | #include <asm/processor-flags.h> |
33 | #include <asm/asm-offsets.h> | 33 | #include <asm/asm-offsets.h> |
34 | 34 | ||
35 | /* | ||
36 | * Adjust our own GOT | ||
37 | * | ||
38 | * The relocation base must be in %rbx | ||
39 | * | ||
40 | * It is safe to call this macro more than once, because in some of the | ||
41 | * code paths multiple invocations are inevitable, e.g. via the efi* | ||
42 | * entry points. | ||
43 | * | ||
44 | * Relocation is only performed the first time. | ||
45 | */ | ||
46 | .macro FIXUP_GOT | ||
47 | cmpb $1, got_fixed(%rip) | ||
48 | je 2f | ||
49 | |||
50 | leaq _got(%rip), %rdx | ||
51 | leaq _egot(%rip), %rcx | ||
52 | 1: | ||
53 | cmpq %rcx, %rdx | ||
54 | jae 2f | ||
55 | addq %rbx, (%rdx) | ||
56 | addq $8, %rdx | ||
57 | jmp 1b | ||
58 | 2: | ||
59 | movb $1, got_fixed(%rip) | ||
60 | .endm | ||
61 | |||
35 | __HEAD | 62 | __HEAD |
36 | .code32 | 63 | .code32 |
37 | ENTRY(startup_32) | 64 | ENTRY(startup_32) |
@@ -252,10 +279,13 @@ ENTRY(efi_pe_entry) | |||
252 | subq $1b, %rbp | 279 | subq $1b, %rbp |
253 | 280 | ||
254 | /* | 281 | /* |
255 | * Relocate efi_config->call(). | 282 | * Relocate efi_config->call() and the GOT entries. |
256 | */ | 283 | */ |
257 | addq %rbp, efi64_config+88(%rip) | 284 | addq %rbp, efi64_config+88(%rip) |
258 | 285 | ||
286 | movq %rbp, %rbx | ||
287 | FIXUP_GOT | ||
288 | |||
259 | movq %rax, %rdi | 289 | movq %rax, %rdi |
260 | call make_boot_params | 290 | call make_boot_params |
261 | cmpq $0,%rax | 291 | cmpq $0,%rax |
@@ -271,10 +301,13 @@ handover_entry: | |||
271 | subq $1b, %rbp | 301 | subq $1b, %rbp |
272 | 302 | ||
273 | /* | 303 | /* |
274 | * Relocate efi_config->call(). | 304 | * Relocate efi_config->call() and the GOT entries. |
275 | */ | 305 | */ |
276 | movq efi_config(%rip), %rax | 306 | movq efi_config(%rip), %rax |
277 | addq %rbp, 88(%rax) | 307 | addq %rbp, 88(%rax) |
308 | |||
309 | movq %rbp, %rbx | ||
310 | FIXUP_GOT | ||
278 | 2: | 311 | 2: |
279 | movq efi_config(%rip), %rdi | 312 | movq efi_config(%rip), %rdi |
280 | call efi_main | 313 | call efi_main |
@@ -385,19 +418,8 @@ relocated: | |||
385 | shrq $3, %rcx | 418 | shrq $3, %rcx |
386 | rep stosq | 419 | rep stosq |
387 | 420 | ||
388 | /* | 421 | FIXUP_GOT |
389 | * Adjust our own GOT | 422 | |
390 | */ | ||
391 | leaq _got(%rip), %rdx | ||
392 | leaq _egot(%rip), %rcx | ||
393 | 1: | ||
394 | cmpq %rcx, %rdx | ||
395 | jae 2f | ||
396 | addq %rbx, (%rdx) | ||
397 | addq $8, %rdx | ||
398 | jmp 1b | ||
399 | 2: | ||
400 | |||
401 | /* | 423 | /* |
402 | * Do the decompression, and jump to the new kernel.. | 424 | * Do the decompression, and jump to the new kernel.. |
403 | */ | 425 | */ |
@@ -437,6 +459,10 @@ gdt: | |||
437 | .quad 0x0000000000000000 /* TS continued */ | 459 | .quad 0x0000000000000000 /* TS continued */ |
438 | gdt_end: | 460 | gdt_end: |
439 | 461 | ||
462 | /* Have we relocated the GOT? */ | ||
463 | got_fixed: | ||
464 | .byte 0 | ||
465 | |||
440 | #ifdef CONFIG_EFI_STUB | 466 | #ifdef CONFIG_EFI_STUB |
441 | efi_config: | 467 | efi_config: |
442 | .quad 0 | 468 | .quad 0 |
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index afcd35d331de..cfe3b954d5e4 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -497,8 +497,6 @@ static __always_inline int fls64(__u64 x) | |||
497 | 497 | ||
498 | #include <asm-generic/bitops/sched.h> | 498 | #include <asm-generic/bitops/sched.h> |
499 | 499 | ||
500 | #define ARCH_HAS_FAST_MULTIPLIER 1 | ||
501 | |||
502 | #include <asm/arch_hweight.h> | 500 | #include <asm/arch_hweight.h> |
503 | 501 | ||
504 | #include <asm-generic/bitops/const_hweight.h> | 502 | #include <asm-generic/bitops/const_hweight.h> |
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 478c490f3654..1733ab49ac5e 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -239,6 +239,7 @@ static inline int mp_find_ioapic(u32 gsi) { return 0; } | |||
239 | static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } | 239 | static inline u32 mp_pin_to_gsi(int ioapic, int pin) { return UINT_MAX; } |
240 | static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } | 240 | static inline int mp_map_gsi_to_irq(u32 gsi, unsigned int flags) { return gsi; } |
241 | static inline void mp_unmap_irq(int irq) { } | 241 | static inline void mp_unmap_irq(int irq) { } |
242 | static inline bool mp_should_keep_irq(struct device *dev) { return 1; } | ||
242 | 243 | ||
243 | static inline int save_ioapic_entries(void) | 244 | static inline int save_ioapic_entries(void) |
244 | { | 245 | { |
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 5be9063545d2..3874693c0e53 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h | |||
@@ -19,6 +19,7 @@ extern pud_t level3_ident_pgt[512]; | |||
19 | extern pmd_t level2_kernel_pgt[512]; | 19 | extern pmd_t level2_kernel_pgt[512]; |
20 | extern pmd_t level2_fixmap_pgt[512]; | 20 | extern pmd_t level2_fixmap_pgt[512]; |
21 | extern pmd_t level2_ident_pgt[512]; | 21 | extern pmd_t level2_ident_pgt[512]; |
22 | extern pte_t level1_fixmap_pgt[512]; | ||
22 | extern pgd_t init_level4_pgt[]; | 23 | extern pgd_t init_level4_pgt[]; |
23 | 24 | ||
24 | #define swapper_pg_dir init_level4_pgt | 25 | #define swapper_pg_dir init_level4_pgt |
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c index f304773285ae..f1314d0bcf0a 100644 --- a/arch/x86/kernel/kprobes/opt.c +++ b/arch/x86/kernel/kprobes/opt.c | |||
@@ -338,8 +338,10 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op) | |||
338 | * a relative jump. | 338 | * a relative jump. |
339 | */ | 339 | */ |
340 | rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; | 340 | rel = (long)op->optinsn.insn - (long)op->kp.addr + RELATIVEJUMP_SIZE; |
341 | if (abs(rel) > 0x7fffffff) | 341 | if (abs(rel) > 0x7fffffff) { |
342 | __arch_remove_optimized_kprobe(op, 0); | ||
342 | return -ERANGE; | 343 | return -ERANGE; |
344 | } | ||
343 | 345 | ||
344 | buf = (u8 *)op->optinsn.insn; | 346 | buf = (u8 *)op->optinsn.insn; |
345 | 347 | ||
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 167ffcac16ed..95a427e57887 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c | |||
@@ -48,7 +48,9 @@ enum address_markers_idx { | |||
48 | LOW_KERNEL_NR, | 48 | LOW_KERNEL_NR, |
49 | VMALLOC_START_NR, | 49 | VMALLOC_START_NR, |
50 | VMEMMAP_START_NR, | 50 | VMEMMAP_START_NR, |
51 | # ifdef CONFIG_X86_ESPFIX64 | ||
51 | ESPFIX_START_NR, | 52 | ESPFIX_START_NR, |
53 | # endif | ||
52 | HIGH_KERNEL_NR, | 54 | HIGH_KERNEL_NR, |
53 | MODULES_VADDR_NR, | 55 | MODULES_VADDR_NR, |
54 | MODULES_END_NR, | 56 | MODULES_END_NR, |
@@ -71,7 +73,9 @@ static struct addr_marker address_markers[] = { | |||
71 | { PAGE_OFFSET, "Low Kernel Mapping" }, | 73 | { PAGE_OFFSET, "Low Kernel Mapping" }, |
72 | { VMALLOC_START, "vmalloc() Area" }, | 74 | { VMALLOC_START, "vmalloc() Area" }, |
73 | { VMEMMAP_START, "Vmemmap" }, | 75 | { VMEMMAP_START, "Vmemmap" }, |
76 | # ifdef CONFIG_X86_ESPFIX64 | ||
74 | { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, | 77 | { ESPFIX_BASE_ADDR, "ESPfix Area", 16 }, |
78 | # endif | ||
75 | { __START_KERNEL_map, "High Kernel Mapping" }, | 79 | { __START_KERNEL_map, "High Kernel Mapping" }, |
76 | { MODULES_VADDR, "Modules" }, | 80 | { MODULES_VADDR, "Modules" }, |
77 | { MODULES_END, "End Modules" }, | 81 | { MODULES_END, "End Modules" }, |
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c index 25e7e1372bb2..919b91205cd4 100644 --- a/arch/x86/mm/mmap.c +++ b/arch/x86/mm/mmap.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <asm/elf.h> | 32 | #include <asm/elf.h> |
33 | 33 | ||
34 | struct __read_mostly va_alignment va_align = { | 34 | struct va_alignment __read_mostly va_align = { |
35 | .flags = -1, | 35 | .flags = -1, |
36 | }; | 36 | }; |
37 | 37 | ||
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index c61ea57d1ba1..9a2b7101ae8a 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -326,27 +326,6 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
326 | struct pci_bus *bus; | 326 | struct pci_bus *bus; |
327 | u16 config; | 327 | u16 config; |
328 | 328 | ||
329 | if (!vga_default_device()) { | ||
330 | resource_size_t start, end; | ||
331 | int i; | ||
332 | |||
333 | /* Does firmware framebuffer belong to us? */ | ||
334 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
335 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) | ||
336 | continue; | ||
337 | |||
338 | start = pci_resource_start(pdev, i); | ||
339 | end = pci_resource_end(pdev, i); | ||
340 | |||
341 | if (!start || !end) | ||
342 | continue; | ||
343 | |||
344 | if (screen_info.lfb_base >= start && | ||
345 | (screen_info.lfb_base + screen_info.lfb_size) < end) | ||
346 | vga_set_default_device(pdev); | ||
347 | } | ||
348 | } | ||
349 | |||
350 | /* Is VGA routed to us? */ | 329 | /* Is VGA routed to us? */ |
351 | bus = pdev->bus; | 330 | bus = pdev->bus; |
352 | while (bus) { | 331 | while (bus) { |
@@ -371,8 +350,7 @@ static void pci_fixup_video(struct pci_dev *pdev) | |||
371 | pci_read_config_word(pdev, PCI_COMMAND, &config); | 350 | pci_read_config_word(pdev, PCI_COMMAND, &config); |
372 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { | 351 | if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { |
373 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; | 352 | pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; |
374 | dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); | 353 | dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); |
375 | vga_set_default_device(pdev); | ||
376 | } | 354 | } |
377 | } | 355 | } |
378 | } | 356 | } |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index e8a1201c3293..16fb0099b7f2 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1866,12 +1866,11 @@ static void __init check_pt_base(unsigned long *pt_base, unsigned long *pt_end, | |||
1866 | * | 1866 | * |
1867 | * We can construct this by grafting the Xen provided pagetable into | 1867 | * We can construct this by grafting the Xen provided pagetable into |
1868 | * head_64.S's preconstructed pagetables. We copy the Xen L2's into | 1868 | * head_64.S's preconstructed pagetables. We copy the Xen L2's into |
1869 | * level2_ident_pgt, level2_kernel_pgt and level2_fixmap_pgt. This | 1869 | * level2_ident_pgt, and level2_kernel_pgt. This means that only the |
1870 | * means that only the kernel has a physical mapping to start with - | 1870 | * kernel has a physical mapping to start with - but that's enough to |
1871 | * but that's enough to get __va working. We need to fill in the rest | 1871 | * get __va working. We need to fill in the rest of the physical |
1872 | * of the physical mapping once some sort of allocator has been set | 1872 | * mapping once some sort of allocator has been set up. NOTE: for |
1873 | * up. | 1873 | * PVH, the page tables are native. |
1874 | * NOTE: for PVH, the page tables are native. | ||
1875 | */ | 1874 | */ |
1876 | void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | 1875 | void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) |
1877 | { | 1876 | { |
@@ -1902,8 +1901,11 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1902 | /* L3_i[0] -> level2_ident_pgt */ | 1901 | /* L3_i[0] -> level2_ident_pgt */ |
1903 | convert_pfn_mfn(level3_ident_pgt); | 1902 | convert_pfn_mfn(level3_ident_pgt); |
1904 | /* L3_k[510] -> level2_kernel_pgt | 1903 | /* L3_k[510] -> level2_kernel_pgt |
1905 | * L3_i[511] -> level2_fixmap_pgt */ | 1904 | * L3_k[511] -> level2_fixmap_pgt */ |
1906 | convert_pfn_mfn(level3_kernel_pgt); | 1905 | convert_pfn_mfn(level3_kernel_pgt); |
1906 | |||
1907 | /* L3_k[511][506] -> level1_fixmap_pgt */ | ||
1908 | convert_pfn_mfn(level2_fixmap_pgt); | ||
1907 | } | 1909 | } |
1908 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ | 1910 | /* We get [511][511] and have Xen's version of level2_kernel_pgt */ |
1909 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); | 1911 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd); |
@@ -1913,21 +1915,15 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1913 | addr[1] = (unsigned long)l3; | 1915 | addr[1] = (unsigned long)l3; |
1914 | addr[2] = (unsigned long)l2; | 1916 | addr[2] = (unsigned long)l2; |
1915 | /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: | 1917 | /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: |
1916 | * Both L4[272][0] and L4[511][511] have entries that point to the same | 1918 | * Both L4[272][0] and L4[511][510] have entries that point to the same |
1917 | * L2 (PMD) tables. Meaning that if you modify it in __va space | 1919 | * L2 (PMD) tables. Meaning that if you modify it in __va space |
1918 | * it will be also modified in the __ka space! (But if you just | 1920 | * it will be also modified in the __ka space! (But if you just |
1919 | * modify the PMD table to point to other PTE's or none, then you | 1921 | * modify the PMD table to point to other PTE's or none, then you |
1920 | * are OK - which is what cleanup_highmap does) */ | 1922 | * are OK - which is what cleanup_highmap does) */ |
1921 | copy_page(level2_ident_pgt, l2); | 1923 | copy_page(level2_ident_pgt, l2); |
1922 | /* Graft it onto L4[511][511] */ | 1924 | /* Graft it onto L4[511][510] */ |
1923 | copy_page(level2_kernel_pgt, l2); | 1925 | copy_page(level2_kernel_pgt, l2); |
1924 | 1926 | ||
1925 | /* Get [511][510] and graft that in level2_fixmap_pgt */ | ||
1926 | l3 = m2v(pgd[pgd_index(__START_KERNEL_map + PMD_SIZE)].pgd); | ||
1927 | l2 = m2v(l3[pud_index(__START_KERNEL_map + PMD_SIZE)].pud); | ||
1928 | copy_page(level2_fixmap_pgt, l2); | ||
1929 | /* Note that we don't do anything with level1_fixmap_pgt which | ||
1930 | * we don't need. */ | ||
1931 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { | 1927 | if (!xen_feature(XENFEAT_auto_translated_physmap)) { |
1932 | /* Make pagetable pieces RO */ | 1928 | /* Make pagetable pieces RO */ |
1933 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); | 1929 | set_page_prot(init_level4_pgt, PAGE_KERNEL_RO); |
@@ -1937,6 +1933,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) | |||
1937 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); | 1933 | set_page_prot(level2_ident_pgt, PAGE_KERNEL_RO); |
1938 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); | 1934 | set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO); |
1939 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); | 1935 | set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO); |
1936 | set_page_prot(level1_fixmap_pgt, PAGE_KERNEL_RO); | ||
1940 | 1937 | ||
1941 | /* Pin down new L4 */ | 1938 | /* Pin down new L4 */ |
1942 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, | 1939 | pin_pagetable_pfn(MMUEXT_PIN_L4_TABLE, |
diff --git a/block/blk-merge.c b/block/blk-merge.c index 54535831f1e1..77881798f793 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -10,10 +10,11 @@ | |||
10 | #include "blk.h" | 10 | #include "blk.h" |
11 | 11 | ||
12 | static unsigned int __blk_recalc_rq_segments(struct request_queue *q, | 12 | static unsigned int __blk_recalc_rq_segments(struct request_queue *q, |
13 | struct bio *bio) | 13 | struct bio *bio, |
14 | bool no_sg_merge) | ||
14 | { | 15 | { |
15 | struct bio_vec bv, bvprv = { NULL }; | 16 | struct bio_vec bv, bvprv = { NULL }; |
16 | int cluster, high, highprv = 1, no_sg_merge; | 17 | int cluster, high, highprv = 1; |
17 | unsigned int seg_size, nr_phys_segs; | 18 | unsigned int seg_size, nr_phys_segs; |
18 | struct bio *fbio, *bbio; | 19 | struct bio *fbio, *bbio; |
19 | struct bvec_iter iter; | 20 | struct bvec_iter iter; |
@@ -35,7 +36,6 @@ static unsigned int __blk_recalc_rq_segments(struct request_queue *q, | |||
35 | cluster = blk_queue_cluster(q); | 36 | cluster = blk_queue_cluster(q); |
36 | seg_size = 0; | 37 | seg_size = 0; |
37 | nr_phys_segs = 0; | 38 | nr_phys_segs = 0; |
38 | no_sg_merge = test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags); | ||
39 | high = 0; | 39 | high = 0; |
40 | for_each_bio(bio) { | 40 | for_each_bio(bio) { |
41 | bio_for_each_segment(bv, bio, iter) { | 41 | bio_for_each_segment(bv, bio, iter) { |
@@ -88,18 +88,23 @@ new_segment: | |||
88 | 88 | ||
89 | void blk_recalc_rq_segments(struct request *rq) | 89 | void blk_recalc_rq_segments(struct request *rq) |
90 | { | 90 | { |
91 | rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio); | 91 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, |
92 | &rq->q->queue_flags); | ||
93 | |||
94 | rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio, | ||
95 | no_sg_merge); | ||
92 | } | 96 | } |
93 | 97 | ||
94 | void blk_recount_segments(struct request_queue *q, struct bio *bio) | 98 | void blk_recount_segments(struct request_queue *q, struct bio *bio) |
95 | { | 99 | { |
96 | if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags)) | 100 | if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) && |
101 | bio->bi_vcnt < queue_max_segments(q)) | ||
97 | bio->bi_phys_segments = bio->bi_vcnt; | 102 | bio->bi_phys_segments = bio->bi_vcnt; |
98 | else { | 103 | else { |
99 | struct bio *nxt = bio->bi_next; | 104 | struct bio *nxt = bio->bi_next; |
100 | 105 | ||
101 | bio->bi_next = NULL; | 106 | bio->bi_next = NULL; |
102 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio); | 107 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, false); |
103 | bio->bi_next = nxt; | 108 | bio->bi_next = nxt; |
104 | } | 109 | } |
105 | 110 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 4aac82615a46..383ea0cb1f0a 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -1321,6 +1321,7 @@ static void blk_mq_free_rq_map(struct blk_mq_tag_set *set, | |||
1321 | continue; | 1321 | continue; |
1322 | set->ops->exit_request(set->driver_data, tags->rqs[i], | 1322 | set->ops->exit_request(set->driver_data, tags->rqs[i], |
1323 | hctx_idx, i); | 1323 | hctx_idx, i); |
1324 | tags->rqs[i] = NULL; | ||
1324 | } | 1325 | } |
1325 | } | 1326 | } |
1326 | 1327 | ||
@@ -1354,8 +1355,9 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1354 | 1355 | ||
1355 | INIT_LIST_HEAD(&tags->page_list); | 1356 | INIT_LIST_HEAD(&tags->page_list); |
1356 | 1357 | ||
1357 | tags->rqs = kmalloc_node(set->queue_depth * sizeof(struct request *), | 1358 | tags->rqs = kzalloc_node(set->queue_depth * sizeof(struct request *), |
1358 | GFP_KERNEL, set->numa_node); | 1359 | GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, |
1360 | set->numa_node); | ||
1359 | if (!tags->rqs) { | 1361 | if (!tags->rqs) { |
1360 | blk_mq_free_tags(tags); | 1362 | blk_mq_free_tags(tags); |
1361 | return NULL; | 1363 | return NULL; |
@@ -1379,8 +1381,9 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1379 | this_order--; | 1381 | this_order--; |
1380 | 1382 | ||
1381 | do { | 1383 | do { |
1382 | page = alloc_pages_node(set->numa_node, GFP_KERNEL, | 1384 | page = alloc_pages_node(set->numa_node, |
1383 | this_order); | 1385 | GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, |
1386 | this_order); | ||
1384 | if (page) | 1387 | if (page) |
1385 | break; | 1388 | break; |
1386 | if (!this_order--) | 1389 | if (!this_order--) |
@@ -1404,8 +1407,10 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1404 | if (set->ops->init_request) { | 1407 | if (set->ops->init_request) { |
1405 | if (set->ops->init_request(set->driver_data, | 1408 | if (set->ops->init_request(set->driver_data, |
1406 | tags->rqs[i], hctx_idx, i, | 1409 | tags->rqs[i], hctx_idx, i, |
1407 | set->numa_node)) | 1410 | set->numa_node)) { |
1411 | tags->rqs[i] = NULL; | ||
1408 | goto fail; | 1412 | goto fail; |
1413 | } | ||
1409 | } | 1414 | } |
1410 | 1415 | ||
1411 | p += rq_size; | 1416 | p += rq_size; |
@@ -1416,7 +1421,6 @@ static struct blk_mq_tags *blk_mq_init_rq_map(struct blk_mq_tag_set *set, | |||
1416 | return tags; | 1421 | return tags; |
1417 | 1422 | ||
1418 | fail: | 1423 | fail: |
1419 | pr_warn("%s: failed to allocate requests\n", __func__); | ||
1420 | blk_mq_free_rq_map(set, tags, hctx_idx); | 1424 | blk_mq_free_rq_map(set, tags, hctx_idx); |
1421 | return NULL; | 1425 | return NULL; |
1422 | } | 1426 | } |
@@ -1936,6 +1940,61 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, | |||
1936 | return NOTIFY_OK; | 1940 | return NOTIFY_OK; |
1937 | } | 1941 | } |
1938 | 1942 | ||
1943 | static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) | ||
1944 | { | ||
1945 | int i; | ||
1946 | |||
1947 | for (i = 0; i < set->nr_hw_queues; i++) { | ||
1948 | set->tags[i] = blk_mq_init_rq_map(set, i); | ||
1949 | if (!set->tags[i]) | ||
1950 | goto out_unwind; | ||
1951 | } | ||
1952 | |||
1953 | return 0; | ||
1954 | |||
1955 | out_unwind: | ||
1956 | while (--i >= 0) | ||
1957 | blk_mq_free_rq_map(set, set->tags[i], i); | ||
1958 | |||
1959 | set->tags = NULL; | ||
1960 | return -ENOMEM; | ||
1961 | } | ||
1962 | |||
1963 | /* | ||
1964 | * Allocate the request maps associated with this tag_set. Note that this | ||
1965 | * may reduce the depth asked for, if memory is tight. set->queue_depth | ||
1966 | * will be updated to reflect the allocated depth. | ||
1967 | */ | ||
1968 | static int blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set) | ||
1969 | { | ||
1970 | unsigned int depth; | ||
1971 | int err; | ||
1972 | |||
1973 | depth = set->queue_depth; | ||
1974 | do { | ||
1975 | err = __blk_mq_alloc_rq_maps(set); | ||
1976 | if (!err) | ||
1977 | break; | ||
1978 | |||
1979 | set->queue_depth >>= 1; | ||
1980 | if (set->queue_depth < set->reserved_tags + BLK_MQ_TAG_MIN) { | ||
1981 | err = -ENOMEM; | ||
1982 | break; | ||
1983 | } | ||
1984 | } while (set->queue_depth); | ||
1985 | |||
1986 | if (!set->queue_depth || err) { | ||
1987 | pr_err("blk-mq: failed to allocate request map\n"); | ||
1988 | return -ENOMEM; | ||
1989 | } | ||
1990 | |||
1991 | if (depth != set->queue_depth) | ||
1992 | pr_info("blk-mq: reduced tag depth (%u -> %u)\n", | ||
1993 | depth, set->queue_depth); | ||
1994 | |||
1995 | return 0; | ||
1996 | } | ||
1997 | |||
1939 | /* | 1998 | /* |
1940 | * Alloc a tag set to be associated with one or more request queues. | 1999 | * Alloc a tag set to be associated with one or more request queues. |
1941 | * May fail with EINVAL for various error conditions. May adjust the | 2000 | * May fail with EINVAL for various error conditions. May adjust the |
@@ -1944,8 +2003,6 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, | |||
1944 | */ | 2003 | */ |
1945 | int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) | 2004 | int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) |
1946 | { | 2005 | { |
1947 | int i; | ||
1948 | |||
1949 | if (!set->nr_hw_queues) | 2006 | if (!set->nr_hw_queues) |
1950 | return -EINVAL; | 2007 | return -EINVAL; |
1951 | if (!set->queue_depth) | 2008 | if (!set->queue_depth) |
@@ -1966,23 +2023,18 @@ int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set) | |||
1966 | sizeof(struct blk_mq_tags *), | 2023 | sizeof(struct blk_mq_tags *), |
1967 | GFP_KERNEL, set->numa_node); | 2024 | GFP_KERNEL, set->numa_node); |
1968 | if (!set->tags) | 2025 | if (!set->tags) |
1969 | goto out; | 2026 | return -ENOMEM; |
1970 | 2027 | ||
1971 | for (i = 0; i < set->nr_hw_queues; i++) { | 2028 | if (blk_mq_alloc_rq_maps(set)) |
1972 | set->tags[i] = blk_mq_init_rq_map(set, i); | 2029 | goto enomem; |
1973 | if (!set->tags[i]) | ||
1974 | goto out_unwind; | ||
1975 | } | ||
1976 | 2030 | ||
1977 | mutex_init(&set->tag_list_lock); | 2031 | mutex_init(&set->tag_list_lock); |
1978 | INIT_LIST_HEAD(&set->tag_list); | 2032 | INIT_LIST_HEAD(&set->tag_list); |
1979 | 2033 | ||
1980 | return 0; | 2034 | return 0; |
1981 | 2035 | enomem: | |
1982 | out_unwind: | 2036 | kfree(set->tags); |
1983 | while (--i >= 0) | 2037 | set->tags = NULL; |
1984 | blk_mq_free_rq_map(set, set->tags[i], i); | ||
1985 | out: | ||
1986 | return -ENOMEM; | 2038 | return -ENOMEM; |
1987 | } | 2039 | } |
1988 | EXPORT_SYMBOL(blk_mq_alloc_tag_set); | 2040 | EXPORT_SYMBOL(blk_mq_alloc_tag_set); |
@@ -1997,6 +2049,7 @@ void blk_mq_free_tag_set(struct blk_mq_tag_set *set) | |||
1997 | } | 2049 | } |
1998 | 2050 | ||
1999 | kfree(set->tags); | 2051 | kfree(set->tags); |
2052 | set->tags = NULL; | ||
2000 | } | 2053 | } |
2001 | EXPORT_SYMBOL(blk_mq_free_tag_set); | 2054 | EXPORT_SYMBOL(blk_mq_free_tag_set); |
2002 | 2055 | ||
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 4db5abf96b9e..17f5c84ce7bf 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c | |||
@@ -554,8 +554,10 @@ int blk_register_queue(struct gendisk *disk) | |||
554 | * Initialization must be complete by now. Finish the initial | 554 | * Initialization must be complete by now. Finish the initial |
555 | * bypass from queue allocation. | 555 | * bypass from queue allocation. |
556 | */ | 556 | */ |
557 | queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q); | 557 | if (!blk_queue_init_done(q)) { |
558 | blk_queue_bypass_end(q); | 558 | queue_flag_set_unlocked(QUEUE_FLAG_INIT_DONE, q); |
559 | blk_queue_bypass_end(q); | ||
560 | } | ||
559 | 561 | ||
560 | ret = blk_trace_init_sysfs(dev); | 562 | ret = blk_trace_init_sysfs(dev); |
561 | if (ret) | 563 | if (ret) |
diff --git a/block/genhd.c b/block/genhd.c index 791f41943132..09da5e4a8e03 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -28,10 +28,10 @@ struct kobject *block_depr; | |||
28 | /* for extended dynamic devt allocation, currently only one major is used */ | 28 | /* for extended dynamic devt allocation, currently only one major is used */ |
29 | #define NR_EXT_DEVT (1 << MINORBITS) | 29 | #define NR_EXT_DEVT (1 << MINORBITS) |
30 | 30 | ||
31 | /* For extended devt allocation. ext_devt_mutex prevents look up | 31 | /* For extended devt allocation. ext_devt_lock prevents look up |
32 | * results from going away underneath its user. | 32 | * results from going away underneath its user. |
33 | */ | 33 | */ |
34 | static DEFINE_MUTEX(ext_devt_mutex); | 34 | static DEFINE_SPINLOCK(ext_devt_lock); |
35 | static DEFINE_IDR(ext_devt_idr); | 35 | static DEFINE_IDR(ext_devt_idr); |
36 | 36 | ||
37 | static struct device_type disk_type; | 37 | static struct device_type disk_type; |
@@ -420,9 +420,13 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) | |||
420 | } | 420 | } |
421 | 421 | ||
422 | /* allocate ext devt */ | 422 | /* allocate ext devt */ |
423 | mutex_lock(&ext_devt_mutex); | 423 | idr_preload(GFP_KERNEL); |
424 | idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_KERNEL); | 424 | |
425 | mutex_unlock(&ext_devt_mutex); | 425 | spin_lock(&ext_devt_lock); |
426 | idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT); | ||
427 | spin_unlock(&ext_devt_lock); | ||
428 | |||
429 | idr_preload_end(); | ||
426 | if (idx < 0) | 430 | if (idx < 0) |
427 | return idx == -ENOSPC ? -EBUSY : idx; | 431 | return idx == -ENOSPC ? -EBUSY : idx; |
428 | 432 | ||
@@ -447,9 +451,9 @@ void blk_free_devt(dev_t devt) | |||
447 | return; | 451 | return; |
448 | 452 | ||
449 | if (MAJOR(devt) == BLOCK_EXT_MAJOR) { | 453 | if (MAJOR(devt) == BLOCK_EXT_MAJOR) { |
450 | mutex_lock(&ext_devt_mutex); | 454 | spin_lock(&ext_devt_lock); |
451 | idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); | 455 | idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); |
452 | mutex_unlock(&ext_devt_mutex); | 456 | spin_unlock(&ext_devt_lock); |
453 | } | 457 | } |
454 | } | 458 | } |
455 | 459 | ||
@@ -665,7 +669,6 @@ void del_gendisk(struct gendisk *disk) | |||
665 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); | 669 | sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); |
666 | pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); | 670 | pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); |
667 | device_del(disk_to_dev(disk)); | 671 | device_del(disk_to_dev(disk)); |
668 | blk_free_devt(disk_to_dev(disk)->devt); | ||
669 | } | 672 | } |
670 | EXPORT_SYMBOL(del_gendisk); | 673 | EXPORT_SYMBOL(del_gendisk); |
671 | 674 | ||
@@ -690,13 +693,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno) | |||
690 | } else { | 693 | } else { |
691 | struct hd_struct *part; | 694 | struct hd_struct *part; |
692 | 695 | ||
693 | mutex_lock(&ext_devt_mutex); | 696 | spin_lock(&ext_devt_lock); |
694 | part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); | 697 | part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); |
695 | if (part && get_disk(part_to_disk(part))) { | 698 | if (part && get_disk(part_to_disk(part))) { |
696 | *partno = part->partno; | 699 | *partno = part->partno; |
697 | disk = part_to_disk(part); | 700 | disk = part_to_disk(part); |
698 | } | 701 | } |
699 | mutex_unlock(&ext_devt_mutex); | 702 | spin_unlock(&ext_devt_lock); |
700 | } | 703 | } |
701 | 704 | ||
702 | return disk; | 705 | return disk; |
@@ -1098,6 +1101,7 @@ static void disk_release(struct device *dev) | |||
1098 | { | 1101 | { |
1099 | struct gendisk *disk = dev_to_disk(dev); | 1102 | struct gendisk *disk = dev_to_disk(dev); |
1100 | 1103 | ||
1104 | blk_free_devt(dev->devt); | ||
1101 | disk_release_events(disk); | 1105 | disk_release_events(disk); |
1102 | kfree(disk->random); | 1106 | kfree(disk->random); |
1103 | disk_replace_part_tbl(disk, NULL); | 1107 | disk_replace_part_tbl(disk, NULL); |
diff --git a/block/partition-generic.c b/block/partition-generic.c index 789cdea05893..0d9e5f97f0a8 100644 --- a/block/partition-generic.c +++ b/block/partition-generic.c | |||
@@ -211,6 +211,7 @@ static const struct attribute_group *part_attr_groups[] = { | |||
211 | static void part_release(struct device *dev) | 211 | static void part_release(struct device *dev) |
212 | { | 212 | { |
213 | struct hd_struct *p = dev_to_part(dev); | 213 | struct hd_struct *p = dev_to_part(dev); |
214 | blk_free_devt(dev->devt); | ||
214 | free_part_stats(p); | 215 | free_part_stats(p); |
215 | free_part_info(p); | 216 | free_part_info(p); |
216 | kfree(p); | 217 | kfree(p); |
@@ -253,7 +254,6 @@ void delete_partition(struct gendisk *disk, int partno) | |||
253 | rcu_assign_pointer(ptbl->last_lookup, NULL); | 254 | rcu_assign_pointer(ptbl->last_lookup, NULL); |
254 | kobject_put(part->holder_dir); | 255 | kobject_put(part->holder_dir); |
255 | device_del(part_to_dev(part)); | 256 | device_del(part_to_dev(part)); |
256 | blk_free_devt(part_devt(part)); | ||
257 | 257 | ||
258 | hd_struct_put(part); | 258 | hd_struct_put(part); |
259 | } | 259 | } |
diff --git a/crypto/drbg.c b/crypto/drbg.c index 7894db9ca90b..a53ee099e281 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
@@ -1922,9 +1922,6 @@ static inline int __init drbg_healthcheck_sanity(void) | |||
1922 | /* overflow max addtllen with personalization string */ | 1922 | /* overflow max addtllen with personalization string */ |
1923 | ret = drbg_instantiate(drbg, &addtl, coreref, pr); | 1923 | ret = drbg_instantiate(drbg, &addtl, coreref, pr); |
1924 | BUG_ON(0 == ret); | 1924 | BUG_ON(0 == ret); |
1925 | /* test uninstantated DRBG */ | ||
1926 | len = drbg_generate(drbg, buf, (max_request_bytes + 1), NULL); | ||
1927 | BUG_ON(0 < len); | ||
1928 | /* all tests passed */ | 1925 | /* all tests passed */ |
1929 | rc = 0; | 1926 | rc = 0; |
1930 | 1927 | ||
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c index 2da8660262e5..81dc75033f15 100644 --- a/drivers/acpi/acpi_cmos_rtc.c +++ b/drivers/acpi/acpi_cmos_rtc.c | |||
@@ -33,7 +33,7 @@ acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address, | |||
33 | void *handler_context, void *region_context) | 33 | void *handler_context, void *region_context) |
34 | { | 34 | { |
35 | int i; | 35 | int i; |
36 | u8 *value = (u8 *)&value64; | 36 | u8 *value = (u8 *)value64; |
37 | 37 | ||
38 | if (address > 0xff || !value64) | 38 | if (address > 0xff || !value64) |
39 | return AE_BAD_PARAMETER; | 39 | return AE_BAD_PARAMETER; |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 9dfec48dd4e5..fddc1e86f9d0 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -610,7 +610,7 @@ static int acpi_lpss_suspend_late(struct device *dev) | |||
610 | return acpi_dev_suspend_late(dev); | 610 | return acpi_dev_suspend_late(dev); |
611 | } | 611 | } |
612 | 612 | ||
613 | static int acpi_lpss_restore_early(struct device *dev) | 613 | static int acpi_lpss_resume_early(struct device *dev) |
614 | { | 614 | { |
615 | int ret = acpi_dev_resume_early(dev); | 615 | int ret = acpi_dev_resume_early(dev); |
616 | 616 | ||
@@ -650,15 +650,15 @@ static int acpi_lpss_runtime_resume(struct device *dev) | |||
650 | static struct dev_pm_domain acpi_lpss_pm_domain = { | 650 | static struct dev_pm_domain acpi_lpss_pm_domain = { |
651 | .ops = { | 651 | .ops = { |
652 | #ifdef CONFIG_PM_SLEEP | 652 | #ifdef CONFIG_PM_SLEEP |
653 | .suspend_late = acpi_lpss_suspend_late, | ||
654 | .restore_early = acpi_lpss_restore_early, | ||
655 | .prepare = acpi_subsys_prepare, | 653 | .prepare = acpi_subsys_prepare, |
656 | .complete = acpi_subsys_complete, | 654 | .complete = acpi_subsys_complete, |
657 | .suspend = acpi_subsys_suspend, | 655 | .suspend = acpi_subsys_suspend, |
658 | .resume_early = acpi_subsys_resume_early, | 656 | .suspend_late = acpi_lpss_suspend_late, |
657 | .resume_early = acpi_lpss_resume_early, | ||
659 | .freeze = acpi_subsys_freeze, | 658 | .freeze = acpi_subsys_freeze, |
660 | .poweroff = acpi_subsys_suspend, | 659 | .poweroff = acpi_subsys_suspend, |
661 | .poweroff_late = acpi_subsys_suspend_late, | 660 | .poweroff_late = acpi_lpss_suspend_late, |
661 | .restore_early = acpi_lpss_resume_early, | ||
662 | #endif | 662 | #endif |
663 | #ifdef CONFIG_PM_RUNTIME | 663 | #ifdef CONFIG_PM_RUNTIME |
664 | .runtime_suspend = acpi_lpss_runtime_suspend, | 664 | .runtime_suspend = acpi_lpss_runtime_suspend, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1c162e7be045..5fdfe65fe165 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -534,20 +534,6 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
534 | " invalid.\n"); | 534 | " invalid.\n"); |
535 | } | 535 | } |
536 | 536 | ||
537 | /* | ||
538 | * When fully charged, some batteries wrongly report | ||
539 | * capacity_now = design_capacity instead of = full_charge_capacity | ||
540 | */ | ||
541 | if (battery->capacity_now > battery->full_charge_capacity | ||
542 | && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { | ||
543 | if (battery->capacity_now != battery->design_capacity) | ||
544 | printk_once(KERN_WARNING FW_BUG | ||
545 | "battery: reported current charge level (%d) " | ||
546 | "is higher than reported maximum charge level (%d).\n", | ||
547 | battery->capacity_now, battery->full_charge_capacity); | ||
548 | battery->capacity_now = battery->full_charge_capacity; | ||
549 | } | ||
550 | |||
551 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | 537 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) |
552 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | 538 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) |
553 | battery->capacity_now = (battery->capacity_now * | 539 | battery->capacity_now = (battery->capacity_now * |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 8581f5b84f48..8b67bd0f6bb5 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -177,16 +177,6 @@ void acpi_bus_detach_private_data(acpi_handle handle) | |||
177 | } | 177 | } |
178 | EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); | 178 | EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); |
179 | 179 | ||
180 | void acpi_bus_no_hotplug(acpi_handle handle) | ||
181 | { | ||
182 | struct acpi_device *adev = NULL; | ||
183 | |||
184 | acpi_bus_get_device(handle, &adev); | ||
185 | if (adev) | ||
186 | adev->flags.no_hotplug = true; | ||
187 | } | ||
188 | EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug); | ||
189 | |||
190 | static void acpi_print_osc_error(acpi_handle handle, | 180 | static void acpi_print_osc_error(acpi_handle handle, |
191 | struct acpi_osc_context *context, char *error) | 181 | struct acpi_osc_context *context, char *error) |
192 | { | 182 | { |
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 65ea7b256b3e..0c94b661c16f 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name) | |||
512 | map, ®map_reg_ranges_fops); | 512 | map, ®map_reg_ranges_fops); |
513 | 513 | ||
514 | if (map->max_register || regmap_readable(map, 0)) { | 514 | if (map->max_register || regmap_readable(map, 0)) { |
515 | debugfs_create_file("registers", 0400, map->debugfs, | 515 | umode_t registers_mode; |
516 | |||
517 | if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS)) | ||
518 | registers_mode = 0600; | ||
519 | else | ||
520 | registers_mode = 0400; | ||
521 | |||
522 | debugfs_create_file("registers", registers_mode, map->debugfs, | ||
516 | map, ®map_map_fops); | 523 | map, ®map_map_fops); |
517 | debugfs_create_file("access", 0400, map->debugfs, | 524 | debugfs_create_file("access", 0400, map->debugfs, |
518 | map, ®map_access_fops); | 525 | map, ®map_access_fops); |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index db1e9560d8a7..5c8e7fe07745 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -3918,7 +3918,6 @@ skip_create_disk: | |||
3918 | if (rv) { | 3918 | if (rv) { |
3919 | dev_err(&dd->pdev->dev, | 3919 | dev_err(&dd->pdev->dev, |
3920 | "Unable to allocate request queue\n"); | 3920 | "Unable to allocate request queue\n"); |
3921 | rv = -ENOMEM; | ||
3922 | goto block_queue_alloc_init_error; | 3921 | goto block_queue_alloc_init_error; |
3923 | } | 3922 | } |
3924 | 3923 | ||
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index a3b042c4d448..00d469c7f9f7 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -462,17 +462,21 @@ static int null_add_dev(void) | |||
462 | struct gendisk *disk; | 462 | struct gendisk *disk; |
463 | struct nullb *nullb; | 463 | struct nullb *nullb; |
464 | sector_t size; | 464 | sector_t size; |
465 | int rv; | ||
465 | 466 | ||
466 | nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, home_node); | 467 | nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, home_node); |
467 | if (!nullb) | 468 | if (!nullb) { |
469 | rv = -ENOMEM; | ||
468 | goto out; | 470 | goto out; |
471 | } | ||
469 | 472 | ||
470 | spin_lock_init(&nullb->lock); | 473 | spin_lock_init(&nullb->lock); |
471 | 474 | ||
472 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) | 475 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) |
473 | submit_queues = nr_online_nodes; | 476 | submit_queues = nr_online_nodes; |
474 | 477 | ||
475 | if (setup_queues(nullb)) | 478 | rv = setup_queues(nullb); |
479 | if (rv) | ||
476 | goto out_free_nullb; | 480 | goto out_free_nullb; |
477 | 481 | ||
478 | if (queue_mode == NULL_Q_MQ) { | 482 | if (queue_mode == NULL_Q_MQ) { |
@@ -484,22 +488,29 @@ static int null_add_dev(void) | |||
484 | nullb->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 488 | nullb->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
485 | nullb->tag_set.driver_data = nullb; | 489 | nullb->tag_set.driver_data = nullb; |
486 | 490 | ||
487 | if (blk_mq_alloc_tag_set(&nullb->tag_set)) | 491 | rv = blk_mq_alloc_tag_set(&nullb->tag_set); |
492 | if (rv) | ||
488 | goto out_cleanup_queues; | 493 | goto out_cleanup_queues; |
489 | 494 | ||
490 | nullb->q = blk_mq_init_queue(&nullb->tag_set); | 495 | nullb->q = blk_mq_init_queue(&nullb->tag_set); |
491 | if (!nullb->q) | 496 | if (!nullb->q) { |
497 | rv = -ENOMEM; | ||
492 | goto out_cleanup_tags; | 498 | goto out_cleanup_tags; |
499 | } | ||
493 | } else if (queue_mode == NULL_Q_BIO) { | 500 | } else if (queue_mode == NULL_Q_BIO) { |
494 | nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node); | 501 | nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node); |
495 | if (!nullb->q) | 502 | if (!nullb->q) { |
503 | rv = -ENOMEM; | ||
496 | goto out_cleanup_queues; | 504 | goto out_cleanup_queues; |
505 | } | ||
497 | blk_queue_make_request(nullb->q, null_queue_bio); | 506 | blk_queue_make_request(nullb->q, null_queue_bio); |
498 | init_driver_queues(nullb); | 507 | init_driver_queues(nullb); |
499 | } else { | 508 | } else { |
500 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); | 509 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); |
501 | if (!nullb->q) | 510 | if (!nullb->q) { |
511 | rv = -ENOMEM; | ||
502 | goto out_cleanup_queues; | 512 | goto out_cleanup_queues; |
513 | } | ||
503 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); | 514 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); |
504 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); | 515 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); |
505 | init_driver_queues(nullb); | 516 | init_driver_queues(nullb); |
@@ -509,8 +520,10 @@ static int null_add_dev(void) | |||
509 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); | 520 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); |
510 | 521 | ||
511 | disk = nullb->disk = alloc_disk_node(1, home_node); | 522 | disk = nullb->disk = alloc_disk_node(1, home_node); |
512 | if (!disk) | 523 | if (!disk) { |
524 | rv = -ENOMEM; | ||
513 | goto out_cleanup_blk_queue; | 525 | goto out_cleanup_blk_queue; |
526 | } | ||
514 | 527 | ||
515 | mutex_lock(&lock); | 528 | mutex_lock(&lock); |
516 | list_add_tail(&nullb->list, &nullb_list); | 529 | list_add_tail(&nullb->list, &nullb_list); |
@@ -544,7 +557,7 @@ out_cleanup_queues: | |||
544 | out_free_nullb: | 557 | out_free_nullb: |
545 | kfree(nullb); | 558 | kfree(nullb); |
546 | out: | 559 | out: |
547 | return -ENOMEM; | 560 | return rv; |
548 | } | 561 | } |
549 | 562 | ||
550 | static int __init null_init(void) | 563 | static int __init null_init(void) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 623c84145b79..4b97baf8afa3 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -5087,9 +5087,11 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
5087 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | 5087 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); |
5088 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); | 5088 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); |
5089 | 5089 | ||
5090 | rbd_dev->rq_wq = alloc_workqueue(rbd_dev->disk->disk_name, 0, 0); | 5090 | rbd_dev->rq_wq = alloc_workqueue("%s", 0, 0, rbd_dev->disk->disk_name); |
5091 | if (!rbd_dev->rq_wq) | 5091 | if (!rbd_dev->rq_wq) { |
5092 | ret = -ENOMEM; | ||
5092 | goto err_out_mapping; | 5093 | goto err_out_mapping; |
5094 | } | ||
5093 | 5095 | ||
5094 | ret = rbd_bus_add_dev(rbd_dev); | 5096 | ret = rbd_bus_add_dev(rbd_dev); |
5095 | if (ret) | 5097 | if (ret) |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 2e3139eda93b..132c9ccfdc62 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -36,6 +36,7 @@ struct virtrng_info { | |||
36 | int index; | 36 | int index; |
37 | bool busy; | 37 | bool busy; |
38 | bool hwrng_register_done; | 38 | bool hwrng_register_done; |
39 | bool hwrng_removed; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | 42 | ||
@@ -68,6 +69,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) | |||
68 | int ret; | 69 | int ret; |
69 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; | 70 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; |
70 | 71 | ||
72 | if (vi->hwrng_removed) | ||
73 | return -ENODEV; | ||
74 | |||
71 | if (!vi->busy) { | 75 | if (!vi->busy) { |
72 | vi->busy = true; | 76 | vi->busy = true; |
73 | init_completion(&vi->have_data); | 77 | init_completion(&vi->have_data); |
@@ -137,6 +141,9 @@ static void remove_common(struct virtio_device *vdev) | |||
137 | { | 141 | { |
138 | struct virtrng_info *vi = vdev->priv; | 142 | struct virtrng_info *vi = vdev->priv; |
139 | 143 | ||
144 | vi->hwrng_removed = true; | ||
145 | vi->data_avail = 0; | ||
146 | complete(&vi->have_data); | ||
140 | vdev->config->reset(vdev); | 147 | vdev->config->reset(vdev); |
141 | vi->busy = false; | 148 | vi->busy = false; |
142 | if (vi->hwrng_register_done) | 149 | if (vi->hwrng_register_done) |
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index 0300c46ee247..32f7c1b36204 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c | |||
@@ -447,7 +447,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np, | |||
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | 449 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); |
450 | if (num_parents <= 0 || num_parents > 1) | 450 | if (num_parents != 2) |
451 | return; | 451 | return; |
452 | 452 | ||
453 | for (i = 0; i < num_parents; ++i) { | 453 | for (i = 0; i < num_parents; ++i) { |
diff --git a/drivers/clk/clk-efm32gg.c b/drivers/clk/clk-efm32gg.c index bac2ddf49d02..73a8d0ff530c 100644 --- a/drivers/clk/clk-efm32gg.c +++ b/drivers/clk/clk-efm32gg.c | |||
@@ -22,7 +22,7 @@ static struct clk_onecell_data clk_data = { | |||
22 | .clk_num = ARRAY_SIZE(clk), | 22 | .clk_num = ARRAY_SIZE(clk), |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static int __init efm32gg_cmu_init(struct device_node *np) | 25 | static void __init efm32gg_cmu_init(struct device_node *np) |
26 | { | 26 | { |
27 | int i; | 27 | int i; |
28 | void __iomem *base; | 28 | void __iomem *base; |
@@ -33,7 +33,7 @@ static int __init efm32gg_cmu_init(struct device_node *np) | |||
33 | base = of_iomap(np, 0); | 33 | base = of_iomap(np, 0); |
34 | if (!base) { | 34 | if (!base) { |
35 | pr_warn("Failed to map address range for efm32gg,cmu node\n"); | 35 | pr_warn("Failed to map address range for efm32gg,cmu node\n"); |
36 | return -EADDRNOTAVAIL; | 36 | return; |
37 | } | 37 | } |
38 | 38 | ||
39 | clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL, | 39 | clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL, |
@@ -76,6 +76,6 @@ static int __init efm32gg_cmu_init(struct device_node *np) | |||
76 | clk[clk_HFPERCLKDAC0] = clk_register_gate(NULL, "HFPERCLK.DAC0", | 76 | clk[clk_HFPERCLKDAC0] = clk_register_gate(NULL, "HFPERCLK.DAC0", |
77 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); | 77 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); |
78 | 78 | ||
79 | return of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 79 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
80 | } | 80 | } |
81 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); | 81 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b76fa69b44cb..bacc06ff939b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1467,6 +1467,7 @@ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long even | |||
1467 | static void clk_change_rate(struct clk *clk) | 1467 | static void clk_change_rate(struct clk *clk) |
1468 | { | 1468 | { |
1469 | struct clk *child; | 1469 | struct clk *child; |
1470 | struct hlist_node *tmp; | ||
1470 | unsigned long old_rate; | 1471 | unsigned long old_rate; |
1471 | unsigned long best_parent_rate = 0; | 1472 | unsigned long best_parent_rate = 0; |
1472 | bool skip_set_rate = false; | 1473 | bool skip_set_rate = false; |
@@ -1502,7 +1503,11 @@ static void clk_change_rate(struct clk *clk) | |||
1502 | if (clk->notifier_count && old_rate != clk->rate) | 1503 | if (clk->notifier_count && old_rate != clk->rate) |
1503 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); | 1504 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); |
1504 | 1505 | ||
1505 | hlist_for_each_entry(child, &clk->children, child_node) { | 1506 | /* |
1507 | * Use safe iteration, as change_rate can actually swap parents | ||
1508 | * for certain clock types. | ||
1509 | */ | ||
1510 | hlist_for_each_entry_safe(child, tmp, &clk->children, child_node) { | ||
1506 | /* Skip children who will be reparented to another clock */ | 1511 | /* Skip children who will be reparented to another clock */ |
1507 | if (child->new_parent && child->new_parent != clk) | 1512 | if (child->new_parent && child->new_parent != clk) |
1508 | continue; | 1513 | continue; |
diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c index 4032e510d9aa..3b83b7dd78c7 100644 --- a/drivers/clk/qcom/gcc-ipq806x.c +++ b/drivers/clk/qcom/gcc-ipq806x.c | |||
@@ -1095,7 +1095,7 @@ static struct clk_branch prng_clk = { | |||
1095 | }; | 1095 | }; |
1096 | 1096 | ||
1097 | static const struct freq_tbl clk_tbl_sdc[] = { | 1097 | static const struct freq_tbl clk_tbl_sdc[] = { |
1098 | { 144000, P_PXO, 5, 18,625 }, | 1098 | { 200000, P_PXO, 2, 2, 125 }, |
1099 | { 400000, P_PLL8, 4, 1, 240 }, | 1099 | { 400000, P_PLL8, 4, 1, 240 }, |
1100 | { 16000000, P_PLL8, 4, 1, 6 }, | 1100 | { 16000000, P_PLL8, 4, 1, 6 }, |
1101 | { 17070000, P_PLL8, 1, 2, 45 }, | 1101 | { 17070000, P_PLL8, 1, 2, 45 }, |
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 0d8c6c59a75e..b22a2d2f21e9 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
@@ -545,7 +545,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
545 | GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS), | 545 | GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS), |
546 | GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS), | 546 | GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS), |
547 | GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS), | 547 | GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS), |
548 | GATE(PCLK_I2C1, "pclk_i2c1", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS), | 548 | GATE(PCLK_I2C2, "pclk_i2c2", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS), |
549 | GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS), | 549 | GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS), |
550 | GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS), | 550 | GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS), |
551 | GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS), | 551 | GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS), |
@@ -603,7 +603,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
603 | GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS), | 603 | GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS), |
604 | GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS), | 604 | GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS), |
605 | GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS), | 605 | GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS), |
606 | GATE(PCLK_I2C2, "pclk_i2c2", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS), | 606 | GATE(PCLK_I2C1, "pclk_i2c1", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS), |
607 | GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS), | 607 | GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS), |
608 | GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS), | 608 | GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS), |
609 | GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS), | 609 | GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS), |
diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index 4a65b410e4d5..af29359677da 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c | |||
@@ -139,9 +139,13 @@ static long atl_clk_round_rate(struct clk_hw *hw, unsigned long rate, | |||
139 | static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, | 139 | static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
140 | unsigned long parent_rate) | 140 | unsigned long parent_rate) |
141 | { | 141 | { |
142 | struct dra7_atl_desc *cdesc = to_atl_desc(hw); | 142 | struct dra7_atl_desc *cdesc; |
143 | u32 divider; | 143 | u32 divider; |
144 | 144 | ||
145 | if (!hw || !rate) | ||
146 | return -EINVAL; | ||
147 | |||
148 | cdesc = to_atl_desc(hw); | ||
145 | divider = ((parent_rate + rate / 2) / rate) - 1; | 149 | divider = ((parent_rate + rate / 2) / rate) - 1; |
146 | if (divider > DRA7_ATL_DIVIDER_MASK) | 150 | if (divider > DRA7_ATL_DIVIDER_MASK) |
147 | divider = DRA7_ATL_DIVIDER_MASK; | 151 | divider = DRA7_ATL_DIVIDER_MASK; |
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index e6aa10db7bba..a837f703be65 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
@@ -211,11 +211,16 @@ static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, | |||
211 | static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, | 211 | static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, |
212 | unsigned long parent_rate) | 212 | unsigned long parent_rate) |
213 | { | 213 | { |
214 | struct clk_divider *divider = to_clk_divider(hw); | 214 | struct clk_divider *divider; |
215 | unsigned int div, value; | 215 | unsigned int div, value; |
216 | unsigned long flags = 0; | 216 | unsigned long flags = 0; |
217 | u32 val; | 217 | u32 val; |
218 | 218 | ||
219 | if (!hw || !rate) | ||
220 | return -EINVAL; | ||
221 | |||
222 | divider = to_clk_divider(hw); | ||
223 | |||
219 | div = DIV_ROUND_UP(parent_rate, rate); | 224 | div = DIV_ROUND_UP(parent_rate, rate); |
220 | value = _get_val(divider, div); | 225 | value = _get_val(divider, div); |
221 | 226 | ||
diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index f7a32d2326c6..773bcde893c0 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c | |||
@@ -60,7 +60,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, | |||
60 | goto out; | 60 | goto out; |
61 | } | 61 | } |
62 | 62 | ||
63 | freq_table = kcalloc(sizeof(*freq_table), (max_opps + 1), GFP_ATOMIC); | 63 | freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_ATOMIC); |
64 | if (!freq_table) { | 64 | if (!freq_table) { |
65 | ret = -ENOMEM; | 65 | ret = -ENOMEM; |
66 | goto out; | 66 | goto out; |
diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c index 6a9d89c93b1f..ae2ab14e64b3 100644 --- a/drivers/dma/dma-jz4740.c +++ b/drivers/dma/dma-jz4740.c | |||
@@ -362,8 +362,9 @@ static void jz4740_dma_chan_irq(struct jz4740_dmaengine_chan *chan) | |||
362 | vchan_cyclic_callback(&chan->desc->vdesc); | 362 | vchan_cyclic_callback(&chan->desc->vdesc); |
363 | } else { | 363 | } else { |
364 | if (chan->next_sg == chan->desc->num_sgs) { | 364 | if (chan->next_sg == chan->desc->num_sgs) { |
365 | chan->desc = NULL; | 365 | list_del(&chan->desc->vdesc.node); |
366 | vchan_cookie_complete(&chan->desc->vdesc); | 366 | vchan_cookie_complete(&chan->desc->vdesc); |
367 | chan->desc = NULL; | ||
367 | } | 368 | } |
368 | } | 369 | } |
369 | } | 370 | } |
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index a56bb3528755..c846a9608cbd 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||
@@ -22,7 +22,7 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
22 | unsigned long map_size, unsigned long desc_size, | 22 | unsigned long map_size, unsigned long desc_size, |
23 | u32 desc_ver) | 23 | u32 desc_ver) |
24 | { | 24 | { |
25 | int node, prev; | 25 | int node, prev, num_rsv; |
26 | int status; | 26 | int status; |
27 | u32 fdt_val32; | 27 | u32 fdt_val32; |
28 | u64 fdt_val64; | 28 | u64 fdt_val64; |
@@ -73,6 +73,14 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
73 | prev = node; | 73 | prev = node; |
74 | } | 74 | } |
75 | 75 | ||
76 | /* | ||
77 | * Delete all memory reserve map entries. When booting via UEFI, | ||
78 | * kernel will use the UEFI memory map to find reserved regions. | ||
79 | */ | ||
80 | num_rsv = fdt_num_mem_rsv(fdt); | ||
81 | while (num_rsv-- > 0) | ||
82 | fdt_del_mem_rsv(fdt, num_rsv); | ||
83 | |||
76 | node = fdt_subnode_offset(fdt, 0, "chosen"); | 84 | node = fdt_subnode_offset(fdt, 0, "chosen"); |
77 | if (node < 0) { | 85 | if (node < 0) { |
78 | node = fdt_add_subnode(fdt, 0, "chosen"); | 86 | node = fdt_add_subnode(fdt, 0, "chosen"); |
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index a2cc6be97983..b792194e0d9c 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c | |||
@@ -67,6 +67,7 @@ static int ast_detect_chip(struct drm_device *dev) | |||
67 | { | 67 | { |
68 | struct ast_private *ast = dev->dev_private; | 68 | struct ast_private *ast = dev->dev_private; |
69 | uint32_t data, jreg; | 69 | uint32_t data, jreg; |
70 | ast_open_key(ast); | ||
70 | 71 | ||
71 | if (dev->pdev->device == PCI_CHIP_AST1180) { | 72 | if (dev->pdev->device == PCI_CHIP_AST1180) { |
72 | ast->chip = AST1100; | 73 | ast->chip = AST1100; |
@@ -104,7 +105,7 @@ static int ast_detect_chip(struct drm_device *dev) | |||
104 | } | 105 | } |
105 | ast->vga2_clone = false; | 106 | ast->vga2_clone = false; |
106 | } else { | 107 | } else { |
107 | ast->chip = 2000; | 108 | ast->chip = AST2000; |
108 | DRM_INFO("AST 2000 detected\n"); | 109 | DRM_INFO("AST 2000 detected\n"); |
109 | } | 110 | } |
110 | } | 111 | } |
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index 9d7346b92653..6b7efcf363d6 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c | |||
@@ -250,6 +250,7 @@ static void bochs_connector_init(struct drm_device *dev) | |||
250 | DRM_MODE_CONNECTOR_VIRTUAL); | 250 | DRM_MODE_CONNECTOR_VIRTUAL); |
251 | drm_connector_helper_add(connector, | 251 | drm_connector_helper_add(connector, |
252 | &bochs_connector_connector_helper_funcs); | 252 | &bochs_connector_connector_helper_funcs); |
253 | drm_connector_register(connector); | ||
253 | } | 254 | } |
254 | 255 | ||
255 | 256 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index e1c5c3222129..c7c5a9d91fa0 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -555,6 +555,7 @@ static struct drm_connector *cirrus_vga_init(struct drm_device *dev) | |||
555 | 555 | ||
556 | drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); | 556 | drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); |
557 | 557 | ||
558 | drm_connector_register(connector); | ||
558 | return connector; | 559 | return connector; |
559 | } | 560 | } |
560 | 561 | ||
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 2e7f03ad5ee2..9933c26017ed 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1336,12 +1336,17 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1336 | 1336 | ||
1337 | intel_power_domains_init_hw(dev_priv); | 1337 | intel_power_domains_init_hw(dev_priv); |
1338 | 1338 | ||
1339 | /* | ||
1340 | * We enable some interrupt sources in our postinstall hooks, so mark | ||
1341 | * interrupts as enabled _before_ actually enabling them to avoid | ||
1342 | * special cases in our ordering checks. | ||
1343 | */ | ||
1344 | dev_priv->pm._irqs_disabled = false; | ||
1345 | |||
1339 | ret = drm_irq_install(dev, dev->pdev->irq); | 1346 | ret = drm_irq_install(dev, dev->pdev->irq); |
1340 | if (ret) | 1347 | if (ret) |
1341 | goto cleanup_gem_stolen; | 1348 | goto cleanup_gem_stolen; |
1342 | 1349 | ||
1343 | dev_priv->pm._irqs_disabled = false; | ||
1344 | |||
1345 | /* Important: The output setup functions called by modeset_init need | 1350 | /* Important: The output setup functions called by modeset_init need |
1346 | * working irqs for e.g. gmbus and dp aux transfers. */ | 1351 | * working irqs for e.g. gmbus and dp aux transfers. */ |
1347 | intel_modeset_init(dev); | 1352 | intel_modeset_init(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7a830eac5ba3..3524306d8cfb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -184,6 +184,7 @@ enum hpd_pin { | |||
184 | if ((1 << (domain)) & (mask)) | 184 | if ((1 << (domain)) & (mask)) |
185 | 185 | ||
186 | struct drm_i915_private; | 186 | struct drm_i915_private; |
187 | struct i915_mm_struct; | ||
187 | struct i915_mmu_object; | 188 | struct i915_mmu_object; |
188 | 189 | ||
189 | enum intel_dpll_id { | 190 | enum intel_dpll_id { |
@@ -1506,9 +1507,8 @@ struct drm_i915_private { | |||
1506 | struct i915_gtt gtt; /* VM representing the global address space */ | 1507 | struct i915_gtt gtt; /* VM representing the global address space */ |
1507 | 1508 | ||
1508 | struct i915_gem_mm mm; | 1509 | struct i915_gem_mm mm; |
1509 | #if defined(CONFIG_MMU_NOTIFIER) | 1510 | DECLARE_HASHTABLE(mm_structs, 7); |
1510 | DECLARE_HASHTABLE(mmu_notifiers, 7); | 1511 | struct mutex mm_lock; |
1511 | #endif | ||
1512 | 1512 | ||
1513 | /* Kernel Modesetting */ | 1513 | /* Kernel Modesetting */ |
1514 | 1514 | ||
@@ -1814,8 +1814,8 @@ struct drm_i915_gem_object { | |||
1814 | unsigned workers :4; | 1814 | unsigned workers :4; |
1815 | #define I915_GEM_USERPTR_MAX_WORKERS 15 | 1815 | #define I915_GEM_USERPTR_MAX_WORKERS 15 |
1816 | 1816 | ||
1817 | struct mm_struct *mm; | 1817 | struct i915_mm_struct *mm; |
1818 | struct i915_mmu_object *mn; | 1818 | struct i915_mmu_object *mmu_object; |
1819 | struct work_struct *work; | 1819 | struct work_struct *work; |
1820 | } userptr; | 1820 | } userptr; |
1821 | }; | 1821 | }; |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ba7f5c6bb50d..ad55b06a3cb1 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1590,10 +1590,13 @@ unlock: | |||
1590 | out: | 1590 | out: |
1591 | switch (ret) { | 1591 | switch (ret) { |
1592 | case -EIO: | 1592 | case -EIO: |
1593 | /* If this -EIO is due to a gpu hang, give the reset code a | 1593 | /* |
1594 | * chance to clean up the mess. Otherwise return the proper | 1594 | * We eat errors when the gpu is terminally wedged to avoid |
1595 | * SIGBUS. */ | 1595 | * userspace unduly crashing (gl has no provisions for mmaps to |
1596 | if (i915_terminally_wedged(&dev_priv->gpu_error)) { | 1596 | * fail). But any other -EIO isn't ours (e.g. swap in failure) |
1597 | * and so needs to be reported. | ||
1598 | */ | ||
1599 | if (!i915_terminally_wedged(&dev_priv->gpu_error)) { | ||
1597 | ret = VM_FAULT_SIGBUS; | 1600 | ret = VM_FAULT_SIGBUS; |
1598 | break; | 1601 | break; |
1599 | } | 1602 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c index fe69fc837d9e..d38413997379 100644 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c | |||
@@ -32,6 +32,15 @@ | |||
32 | #include <linux/mempolicy.h> | 32 | #include <linux/mempolicy.h> |
33 | #include <linux/swap.h> | 33 | #include <linux/swap.h> |
34 | 34 | ||
35 | struct i915_mm_struct { | ||
36 | struct mm_struct *mm; | ||
37 | struct drm_device *dev; | ||
38 | struct i915_mmu_notifier *mn; | ||
39 | struct hlist_node node; | ||
40 | struct kref kref; | ||
41 | struct work_struct work; | ||
42 | }; | ||
43 | |||
35 | #if defined(CONFIG_MMU_NOTIFIER) | 44 | #if defined(CONFIG_MMU_NOTIFIER) |
36 | #include <linux/interval_tree.h> | 45 | #include <linux/interval_tree.h> |
37 | 46 | ||
@@ -41,16 +50,12 @@ struct i915_mmu_notifier { | |||
41 | struct mmu_notifier mn; | 50 | struct mmu_notifier mn; |
42 | struct rb_root objects; | 51 | struct rb_root objects; |
43 | struct list_head linear; | 52 | struct list_head linear; |
44 | struct drm_device *dev; | ||
45 | struct mm_struct *mm; | ||
46 | struct work_struct work; | ||
47 | unsigned long count; | ||
48 | unsigned long serial; | 53 | unsigned long serial; |
49 | bool has_linear; | 54 | bool has_linear; |
50 | }; | 55 | }; |
51 | 56 | ||
52 | struct i915_mmu_object { | 57 | struct i915_mmu_object { |
53 | struct i915_mmu_notifier *mmu; | 58 | struct i915_mmu_notifier *mn; |
54 | struct interval_tree_node it; | 59 | struct interval_tree_node it; |
55 | struct list_head link; | 60 | struct list_head link; |
56 | struct drm_i915_gem_object *obj; | 61 | struct drm_i915_gem_object *obj; |
@@ -96,18 +101,18 @@ static void *invalidate_range__linear(struct i915_mmu_notifier *mn, | |||
96 | unsigned long start, | 101 | unsigned long start, |
97 | unsigned long end) | 102 | unsigned long end) |
98 | { | 103 | { |
99 | struct i915_mmu_object *mmu; | 104 | struct i915_mmu_object *mo; |
100 | unsigned long serial; | 105 | unsigned long serial; |
101 | 106 | ||
102 | restart: | 107 | restart: |
103 | serial = mn->serial; | 108 | serial = mn->serial; |
104 | list_for_each_entry(mmu, &mn->linear, link) { | 109 | list_for_each_entry(mo, &mn->linear, link) { |
105 | struct drm_i915_gem_object *obj; | 110 | struct drm_i915_gem_object *obj; |
106 | 111 | ||
107 | if (mmu->it.last < start || mmu->it.start > end) | 112 | if (mo->it.last < start || mo->it.start > end) |
108 | continue; | 113 | continue; |
109 | 114 | ||
110 | obj = mmu->obj; | 115 | obj = mo->obj; |
111 | drm_gem_object_reference(&obj->base); | 116 | drm_gem_object_reference(&obj->base); |
112 | spin_unlock(&mn->lock); | 117 | spin_unlock(&mn->lock); |
113 | 118 | ||
@@ -160,130 +165,47 @@ static const struct mmu_notifier_ops i915_gem_userptr_notifier = { | |||
160 | }; | 165 | }; |
161 | 166 | ||
162 | static struct i915_mmu_notifier * | 167 | static struct i915_mmu_notifier * |
163 | __i915_mmu_notifier_lookup(struct drm_device *dev, struct mm_struct *mm) | 168 | i915_mmu_notifier_create(struct mm_struct *mm) |
164 | { | ||
165 | struct drm_i915_private *dev_priv = to_i915(dev); | ||
166 | struct i915_mmu_notifier *mmu; | ||
167 | |||
168 | /* Protected by dev->struct_mutex */ | ||
169 | hash_for_each_possible(dev_priv->mmu_notifiers, mmu, node, (unsigned long)mm) | ||
170 | if (mmu->mm == mm) | ||
171 | return mmu; | ||
172 | |||
173 | return NULL; | ||
174 | } | ||
175 | |||
176 | static struct i915_mmu_notifier * | ||
177 | i915_mmu_notifier_get(struct drm_device *dev, struct mm_struct *mm) | ||
178 | { | 169 | { |
179 | struct drm_i915_private *dev_priv = to_i915(dev); | 170 | struct i915_mmu_notifier *mn; |
180 | struct i915_mmu_notifier *mmu; | ||
181 | int ret; | 171 | int ret; |
182 | 172 | ||
183 | lockdep_assert_held(&dev->struct_mutex); | 173 | mn = kmalloc(sizeof(*mn), GFP_KERNEL); |
184 | 174 | if (mn == NULL) | |
185 | mmu = __i915_mmu_notifier_lookup(dev, mm); | ||
186 | if (mmu) | ||
187 | return mmu; | ||
188 | |||
189 | mmu = kmalloc(sizeof(*mmu), GFP_KERNEL); | ||
190 | if (mmu == NULL) | ||
191 | return ERR_PTR(-ENOMEM); | 175 | return ERR_PTR(-ENOMEM); |
192 | 176 | ||
193 | spin_lock_init(&mmu->lock); | 177 | spin_lock_init(&mn->lock); |
194 | mmu->dev = dev; | 178 | mn->mn.ops = &i915_gem_userptr_notifier; |
195 | mmu->mn.ops = &i915_gem_userptr_notifier; | 179 | mn->objects = RB_ROOT; |
196 | mmu->mm = mm; | 180 | mn->serial = 1; |
197 | mmu->objects = RB_ROOT; | 181 | INIT_LIST_HEAD(&mn->linear); |
198 | mmu->count = 0; | 182 | mn->has_linear = false; |
199 | mmu->serial = 1; | 183 | |
200 | INIT_LIST_HEAD(&mmu->linear); | 184 | /* Protected by mmap_sem (write-lock) */ |
201 | mmu->has_linear = false; | 185 | ret = __mmu_notifier_register(&mn->mn, mm); |
202 | |||
203 | /* Protected by mmap_sem (write-lock) */ | ||
204 | ret = __mmu_notifier_register(&mmu->mn, mm); | ||
205 | if (ret) { | 186 | if (ret) { |
206 | kfree(mmu); | 187 | kfree(mn); |
207 | return ERR_PTR(ret); | 188 | return ERR_PTR(ret); |
208 | } | 189 | } |
209 | 190 | ||
210 | /* Protected by dev->struct_mutex */ | 191 | return mn; |
211 | hash_add(dev_priv->mmu_notifiers, &mmu->node, (unsigned long)mm); | ||
212 | return mmu; | ||
213 | } | 192 | } |
214 | 193 | ||
215 | static void | 194 | static void __i915_mmu_notifier_update_serial(struct i915_mmu_notifier *mn) |
216 | __i915_mmu_notifier_destroy_worker(struct work_struct *work) | ||
217 | { | 195 | { |
218 | struct i915_mmu_notifier *mmu = container_of(work, typeof(*mmu), work); | 196 | if (++mn->serial == 0) |
219 | mmu_notifier_unregister(&mmu->mn, mmu->mm); | 197 | mn->serial = 1; |
220 | kfree(mmu); | ||
221 | } | ||
222 | |||
223 | static void | ||
224 | __i915_mmu_notifier_destroy(struct i915_mmu_notifier *mmu) | ||
225 | { | ||
226 | lockdep_assert_held(&mmu->dev->struct_mutex); | ||
227 | |||
228 | /* Protected by dev->struct_mutex */ | ||
229 | hash_del(&mmu->node); | ||
230 | |||
231 | /* Our lock ordering is: mmap_sem, mmu_notifier_scru, struct_mutex. | ||
232 | * We enter the function holding struct_mutex, therefore we need | ||
233 | * to drop our mutex prior to calling mmu_notifier_unregister in | ||
234 | * order to prevent lock inversion (and system-wide deadlock) | ||
235 | * between the mmap_sem and struct-mutex. Hence we defer the | ||
236 | * unregistration to a workqueue where we hold no locks. | ||
237 | */ | ||
238 | INIT_WORK(&mmu->work, __i915_mmu_notifier_destroy_worker); | ||
239 | schedule_work(&mmu->work); | ||
240 | } | ||
241 | |||
242 | static void __i915_mmu_notifier_update_serial(struct i915_mmu_notifier *mmu) | ||
243 | { | ||
244 | if (++mmu->serial == 0) | ||
245 | mmu->serial = 1; | ||
246 | } | ||
247 | |||
248 | static bool i915_mmu_notifier_has_linear(struct i915_mmu_notifier *mmu) | ||
249 | { | ||
250 | struct i915_mmu_object *mn; | ||
251 | |||
252 | list_for_each_entry(mn, &mmu->linear, link) | ||
253 | if (mn->is_linear) | ||
254 | return true; | ||
255 | |||
256 | return false; | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | i915_mmu_notifier_del(struct i915_mmu_notifier *mmu, | ||
261 | struct i915_mmu_object *mn) | ||
262 | { | ||
263 | lockdep_assert_held(&mmu->dev->struct_mutex); | ||
264 | |||
265 | spin_lock(&mmu->lock); | ||
266 | list_del(&mn->link); | ||
267 | if (mn->is_linear) | ||
268 | mmu->has_linear = i915_mmu_notifier_has_linear(mmu); | ||
269 | else | ||
270 | interval_tree_remove(&mn->it, &mmu->objects); | ||
271 | __i915_mmu_notifier_update_serial(mmu); | ||
272 | spin_unlock(&mmu->lock); | ||
273 | |||
274 | /* Protected against _add() by dev->struct_mutex */ | ||
275 | if (--mmu->count == 0) | ||
276 | __i915_mmu_notifier_destroy(mmu); | ||
277 | } | 198 | } |
278 | 199 | ||
279 | static int | 200 | static int |
280 | i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | 201 | i915_mmu_notifier_add(struct drm_device *dev, |
281 | struct i915_mmu_object *mn) | 202 | struct i915_mmu_notifier *mn, |
203 | struct i915_mmu_object *mo) | ||
282 | { | 204 | { |
283 | struct interval_tree_node *it; | 205 | struct interval_tree_node *it; |
284 | int ret; | 206 | int ret; |
285 | 207 | ||
286 | ret = i915_mutex_lock_interruptible(mmu->dev); | 208 | ret = i915_mutex_lock_interruptible(dev); |
287 | if (ret) | 209 | if (ret) |
288 | return ret; | 210 | return ret; |
289 | 211 | ||
@@ -291,11 +213,11 @@ i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | |||
291 | * remove the objects from the interval tree) before we do | 213 | * remove the objects from the interval tree) before we do |
292 | * the check for overlapping objects. | 214 | * the check for overlapping objects. |
293 | */ | 215 | */ |
294 | i915_gem_retire_requests(mmu->dev); | 216 | i915_gem_retire_requests(dev); |
295 | 217 | ||
296 | spin_lock(&mmu->lock); | 218 | spin_lock(&mn->lock); |
297 | it = interval_tree_iter_first(&mmu->objects, | 219 | it = interval_tree_iter_first(&mn->objects, |
298 | mn->it.start, mn->it.last); | 220 | mo->it.start, mo->it.last); |
299 | if (it) { | 221 | if (it) { |
300 | struct drm_i915_gem_object *obj; | 222 | struct drm_i915_gem_object *obj; |
301 | 223 | ||
@@ -312,86 +234,122 @@ i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | |||
312 | 234 | ||
313 | obj = container_of(it, struct i915_mmu_object, it)->obj; | 235 | obj = container_of(it, struct i915_mmu_object, it)->obj; |
314 | if (!obj->userptr.workers) | 236 | if (!obj->userptr.workers) |
315 | mmu->has_linear = mn->is_linear = true; | 237 | mn->has_linear = mo->is_linear = true; |
316 | else | 238 | else |
317 | ret = -EAGAIN; | 239 | ret = -EAGAIN; |
318 | } else | 240 | } else |
319 | interval_tree_insert(&mn->it, &mmu->objects); | 241 | interval_tree_insert(&mo->it, &mn->objects); |
320 | 242 | ||
321 | if (ret == 0) { | 243 | if (ret == 0) { |
322 | list_add(&mn->link, &mmu->linear); | 244 | list_add(&mo->link, &mn->linear); |
323 | __i915_mmu_notifier_update_serial(mmu); | 245 | __i915_mmu_notifier_update_serial(mn); |
324 | } | 246 | } |
325 | spin_unlock(&mmu->lock); | 247 | spin_unlock(&mn->lock); |
326 | mutex_unlock(&mmu->dev->struct_mutex); | 248 | mutex_unlock(&dev->struct_mutex); |
327 | 249 | ||
328 | return ret; | 250 | return ret; |
329 | } | 251 | } |
330 | 252 | ||
253 | static bool i915_mmu_notifier_has_linear(struct i915_mmu_notifier *mn) | ||
254 | { | ||
255 | struct i915_mmu_object *mo; | ||
256 | |||
257 | list_for_each_entry(mo, &mn->linear, link) | ||
258 | if (mo->is_linear) | ||
259 | return true; | ||
260 | |||
261 | return false; | ||
262 | } | ||
263 | |||
264 | static void | ||
265 | i915_mmu_notifier_del(struct i915_mmu_notifier *mn, | ||
266 | struct i915_mmu_object *mo) | ||
267 | { | ||
268 | spin_lock(&mn->lock); | ||
269 | list_del(&mo->link); | ||
270 | if (mo->is_linear) | ||
271 | mn->has_linear = i915_mmu_notifier_has_linear(mn); | ||
272 | else | ||
273 | interval_tree_remove(&mo->it, &mn->objects); | ||
274 | __i915_mmu_notifier_update_serial(mn); | ||
275 | spin_unlock(&mn->lock); | ||
276 | } | ||
277 | |||
331 | static void | 278 | static void |
332 | i915_gem_userptr_release__mmu_notifier(struct drm_i915_gem_object *obj) | 279 | i915_gem_userptr_release__mmu_notifier(struct drm_i915_gem_object *obj) |
333 | { | 280 | { |
334 | struct i915_mmu_object *mn; | 281 | struct i915_mmu_object *mo; |
335 | 282 | ||
336 | mn = obj->userptr.mn; | 283 | mo = obj->userptr.mmu_object; |
337 | if (mn == NULL) | 284 | if (mo == NULL) |
338 | return; | 285 | return; |
339 | 286 | ||
340 | i915_mmu_notifier_del(mn->mmu, mn); | 287 | i915_mmu_notifier_del(mo->mn, mo); |
341 | obj->userptr.mn = NULL; | 288 | kfree(mo); |
289 | |||
290 | obj->userptr.mmu_object = NULL; | ||
291 | } | ||
292 | |||
293 | static struct i915_mmu_notifier * | ||
294 | i915_mmu_notifier_find(struct i915_mm_struct *mm) | ||
295 | { | ||
296 | if (mm->mn == NULL) { | ||
297 | down_write(&mm->mm->mmap_sem); | ||
298 | mutex_lock(&to_i915(mm->dev)->mm_lock); | ||
299 | if (mm->mn == NULL) | ||
300 | mm->mn = i915_mmu_notifier_create(mm->mm); | ||
301 | mutex_unlock(&to_i915(mm->dev)->mm_lock); | ||
302 | up_write(&mm->mm->mmap_sem); | ||
303 | } | ||
304 | return mm->mn; | ||
342 | } | 305 | } |
343 | 306 | ||
344 | static int | 307 | static int |
345 | i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, | 308 | i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, |
346 | unsigned flags) | 309 | unsigned flags) |
347 | { | 310 | { |
348 | struct i915_mmu_notifier *mmu; | 311 | struct i915_mmu_notifier *mn; |
349 | struct i915_mmu_object *mn; | 312 | struct i915_mmu_object *mo; |
350 | int ret; | 313 | int ret; |
351 | 314 | ||
352 | if (flags & I915_USERPTR_UNSYNCHRONIZED) | 315 | if (flags & I915_USERPTR_UNSYNCHRONIZED) |
353 | return capable(CAP_SYS_ADMIN) ? 0 : -EPERM; | 316 | return capable(CAP_SYS_ADMIN) ? 0 : -EPERM; |
354 | 317 | ||
355 | down_write(&obj->userptr.mm->mmap_sem); | 318 | if (WARN_ON(obj->userptr.mm == NULL)) |
356 | ret = i915_mutex_lock_interruptible(obj->base.dev); | 319 | return -EINVAL; |
357 | if (ret == 0) { | ||
358 | mmu = i915_mmu_notifier_get(obj->base.dev, obj->userptr.mm); | ||
359 | if (!IS_ERR(mmu)) | ||
360 | mmu->count++; /* preemptive add to act as a refcount */ | ||
361 | else | ||
362 | ret = PTR_ERR(mmu); | ||
363 | mutex_unlock(&obj->base.dev->struct_mutex); | ||
364 | } | ||
365 | up_write(&obj->userptr.mm->mmap_sem); | ||
366 | if (ret) | ||
367 | return ret; | ||
368 | 320 | ||
369 | mn = kzalloc(sizeof(*mn), GFP_KERNEL); | 321 | mn = i915_mmu_notifier_find(obj->userptr.mm); |
370 | if (mn == NULL) { | 322 | if (IS_ERR(mn)) |
371 | ret = -ENOMEM; | 323 | return PTR_ERR(mn); |
372 | goto destroy_mmu; | ||
373 | } | ||
374 | 324 | ||
375 | mn->mmu = mmu; | 325 | mo = kzalloc(sizeof(*mo), GFP_KERNEL); |
376 | mn->it.start = obj->userptr.ptr; | 326 | if (mo == NULL) |
377 | mn->it.last = mn->it.start + obj->base.size - 1; | 327 | return -ENOMEM; |
378 | mn->obj = obj; | ||
379 | 328 | ||
380 | ret = i915_mmu_notifier_add(mmu, mn); | 329 | mo->mn = mn; |
381 | if (ret) | 330 | mo->it.start = obj->userptr.ptr; |
382 | goto free_mn; | 331 | mo->it.last = mo->it.start + obj->base.size - 1; |
332 | mo->obj = obj; | ||
383 | 333 | ||
384 | obj->userptr.mn = mn; | 334 | ret = i915_mmu_notifier_add(obj->base.dev, mn, mo); |
335 | if (ret) { | ||
336 | kfree(mo); | ||
337 | return ret; | ||
338 | } | ||
339 | |||
340 | obj->userptr.mmu_object = mo; | ||
385 | return 0; | 341 | return 0; |
342 | } | ||
343 | |||
344 | static void | ||
345 | i915_mmu_notifier_free(struct i915_mmu_notifier *mn, | ||
346 | struct mm_struct *mm) | ||
347 | { | ||
348 | if (mn == NULL) | ||
349 | return; | ||
386 | 350 | ||
387 | free_mn: | 351 | mmu_notifier_unregister(&mn->mn, mm); |
388 | kfree(mn); | 352 | kfree(mn); |
389 | destroy_mmu: | ||
390 | mutex_lock(&obj->base.dev->struct_mutex); | ||
391 | if (--mmu->count == 0) | ||
392 | __i915_mmu_notifier_destroy(mmu); | ||
393 | mutex_unlock(&obj->base.dev->struct_mutex); | ||
394 | return ret; | ||
395 | } | 353 | } |
396 | 354 | ||
397 | #else | 355 | #else |
@@ -413,15 +371,114 @@ i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, | |||
413 | 371 | ||
414 | return 0; | 372 | return 0; |
415 | } | 373 | } |
374 | |||
375 | static void | ||
376 | i915_mmu_notifier_free(struct i915_mmu_notifier *mn, | ||
377 | struct mm_struct *mm) | ||
378 | { | ||
379 | } | ||
380 | |||
416 | #endif | 381 | #endif |
417 | 382 | ||
383 | static struct i915_mm_struct * | ||
384 | __i915_mm_struct_find(struct drm_i915_private *dev_priv, struct mm_struct *real) | ||
385 | { | ||
386 | struct i915_mm_struct *mm; | ||
387 | |||
388 | /* Protected by dev_priv->mm_lock */ | ||
389 | hash_for_each_possible(dev_priv->mm_structs, mm, node, (unsigned long)real) | ||
390 | if (mm->mm == real) | ||
391 | return mm; | ||
392 | |||
393 | return NULL; | ||
394 | } | ||
395 | |||
396 | static int | ||
397 | i915_gem_userptr_init__mm_struct(struct drm_i915_gem_object *obj) | ||
398 | { | ||
399 | struct drm_i915_private *dev_priv = to_i915(obj->base.dev); | ||
400 | struct i915_mm_struct *mm; | ||
401 | int ret = 0; | ||
402 | |||
403 | /* During release of the GEM object we hold the struct_mutex. This | ||
404 | * precludes us from calling mmput() at that time as that may be | ||
405 | * the last reference and so call exit_mmap(). exit_mmap() will | ||
406 | * attempt to reap the vma, and if we were holding a GTT mmap | ||
407 | * would then call drm_gem_vm_close() and attempt to reacquire | ||
408 | * the struct mutex. So in order to avoid that recursion, we have | ||
409 | * to defer releasing the mm reference until after we drop the | ||
410 | * struct_mutex, i.e. we need to schedule a worker to do the clean | ||
411 | * up. | ||
412 | */ | ||
413 | mutex_lock(&dev_priv->mm_lock); | ||
414 | mm = __i915_mm_struct_find(dev_priv, current->mm); | ||
415 | if (mm == NULL) { | ||
416 | mm = kmalloc(sizeof(*mm), GFP_KERNEL); | ||
417 | if (mm == NULL) { | ||
418 | ret = -ENOMEM; | ||
419 | goto out; | ||
420 | } | ||
421 | |||
422 | kref_init(&mm->kref); | ||
423 | mm->dev = obj->base.dev; | ||
424 | |||
425 | mm->mm = current->mm; | ||
426 | atomic_inc(¤t->mm->mm_count); | ||
427 | |||
428 | mm->mn = NULL; | ||
429 | |||
430 | /* Protected by dev_priv->mm_lock */ | ||
431 | hash_add(dev_priv->mm_structs, | ||
432 | &mm->node, (unsigned long)mm->mm); | ||
433 | } else | ||
434 | kref_get(&mm->kref); | ||
435 | |||
436 | obj->userptr.mm = mm; | ||
437 | out: | ||
438 | mutex_unlock(&dev_priv->mm_lock); | ||
439 | return ret; | ||
440 | } | ||
441 | |||
442 | static void | ||
443 | __i915_mm_struct_free__worker(struct work_struct *work) | ||
444 | { | ||
445 | struct i915_mm_struct *mm = container_of(work, typeof(*mm), work); | ||
446 | i915_mmu_notifier_free(mm->mn, mm->mm); | ||
447 | mmdrop(mm->mm); | ||
448 | kfree(mm); | ||
449 | } | ||
450 | |||
451 | static void | ||
452 | __i915_mm_struct_free(struct kref *kref) | ||
453 | { | ||
454 | struct i915_mm_struct *mm = container_of(kref, typeof(*mm), kref); | ||
455 | |||
456 | /* Protected by dev_priv->mm_lock */ | ||
457 | hash_del(&mm->node); | ||
458 | mutex_unlock(&to_i915(mm->dev)->mm_lock); | ||
459 | |||
460 | INIT_WORK(&mm->work, __i915_mm_struct_free__worker); | ||
461 | schedule_work(&mm->work); | ||
462 | } | ||
463 | |||
464 | static void | ||
465 | i915_gem_userptr_release__mm_struct(struct drm_i915_gem_object *obj) | ||
466 | { | ||
467 | if (obj->userptr.mm == NULL) | ||
468 | return; | ||
469 | |||
470 | kref_put_mutex(&obj->userptr.mm->kref, | ||
471 | __i915_mm_struct_free, | ||
472 | &to_i915(obj->base.dev)->mm_lock); | ||
473 | obj->userptr.mm = NULL; | ||
474 | } | ||
475 | |||
418 | struct get_pages_work { | 476 | struct get_pages_work { |
419 | struct work_struct work; | 477 | struct work_struct work; |
420 | struct drm_i915_gem_object *obj; | 478 | struct drm_i915_gem_object *obj; |
421 | struct task_struct *task; | 479 | struct task_struct *task; |
422 | }; | 480 | }; |
423 | 481 | ||
424 | |||
425 | #if IS_ENABLED(CONFIG_SWIOTLB) | 482 | #if IS_ENABLED(CONFIG_SWIOTLB) |
426 | #define swiotlb_active() swiotlb_nr_tbl() | 483 | #define swiotlb_active() swiotlb_nr_tbl() |
427 | #else | 484 | #else |
@@ -479,7 +536,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) | |||
479 | if (pvec == NULL) | 536 | if (pvec == NULL) |
480 | pvec = drm_malloc_ab(num_pages, sizeof(struct page *)); | 537 | pvec = drm_malloc_ab(num_pages, sizeof(struct page *)); |
481 | if (pvec != NULL) { | 538 | if (pvec != NULL) { |
482 | struct mm_struct *mm = obj->userptr.mm; | 539 | struct mm_struct *mm = obj->userptr.mm->mm; |
483 | 540 | ||
484 | down_read(&mm->mmap_sem); | 541 | down_read(&mm->mmap_sem); |
485 | while (pinned < num_pages) { | 542 | while (pinned < num_pages) { |
@@ -545,7 +602,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) | |||
545 | 602 | ||
546 | pvec = NULL; | 603 | pvec = NULL; |
547 | pinned = 0; | 604 | pinned = 0; |
548 | if (obj->userptr.mm == current->mm) { | 605 | if (obj->userptr.mm->mm == current->mm) { |
549 | pvec = kmalloc(num_pages*sizeof(struct page *), | 606 | pvec = kmalloc(num_pages*sizeof(struct page *), |
550 | GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); | 607 | GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); |
551 | if (pvec == NULL) { | 608 | if (pvec == NULL) { |
@@ -651,17 +708,13 @@ static void | |||
651 | i915_gem_userptr_release(struct drm_i915_gem_object *obj) | 708 | i915_gem_userptr_release(struct drm_i915_gem_object *obj) |
652 | { | 709 | { |
653 | i915_gem_userptr_release__mmu_notifier(obj); | 710 | i915_gem_userptr_release__mmu_notifier(obj); |
654 | 711 | i915_gem_userptr_release__mm_struct(obj); | |
655 | if (obj->userptr.mm) { | ||
656 | mmput(obj->userptr.mm); | ||
657 | obj->userptr.mm = NULL; | ||
658 | } | ||
659 | } | 712 | } |
660 | 713 | ||
661 | static int | 714 | static int |
662 | i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) | 715 | i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) |
663 | { | 716 | { |
664 | if (obj->userptr.mn) | 717 | if (obj->userptr.mmu_object) |
665 | return 0; | 718 | return 0; |
666 | 719 | ||
667 | return i915_gem_userptr_init__mmu_notifier(obj, 0); | 720 | return i915_gem_userptr_init__mmu_notifier(obj, 0); |
@@ -736,7 +789,6 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
736 | return -ENODEV; | 789 | return -ENODEV; |
737 | } | 790 | } |
738 | 791 | ||
739 | /* Allocate the new object */ | ||
740 | obj = i915_gem_object_alloc(dev); | 792 | obj = i915_gem_object_alloc(dev); |
741 | if (obj == NULL) | 793 | if (obj == NULL) |
742 | return -ENOMEM; | 794 | return -ENOMEM; |
@@ -754,8 +806,8 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
754 | * at binding. This means that we need to hook into the mmu_notifier | 806 | * at binding. This means that we need to hook into the mmu_notifier |
755 | * in order to detect if the mmu is destroyed. | 807 | * in order to detect if the mmu is destroyed. |
756 | */ | 808 | */ |
757 | ret = -ENOMEM; | 809 | ret = i915_gem_userptr_init__mm_struct(obj); |
758 | if ((obj->userptr.mm = get_task_mm(current))) | 810 | if (ret == 0) |
759 | ret = i915_gem_userptr_init__mmu_notifier(obj, args->flags); | 811 | ret = i915_gem_userptr_init__mmu_notifier(obj, args->flags); |
760 | if (ret == 0) | 812 | if (ret == 0) |
761 | ret = drm_gem_handle_create(file, &obj->base, &handle); | 813 | ret = drm_gem_handle_create(file, &obj->base, &handle); |
@@ -772,9 +824,8 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
772 | int | 824 | int |
773 | i915_gem_init_userptr(struct drm_device *dev) | 825 | i915_gem_init_userptr(struct drm_device *dev) |
774 | { | 826 | { |
775 | #if defined(CONFIG_MMU_NOTIFIER) | ||
776 | struct drm_i915_private *dev_priv = to_i915(dev); | 827 | struct drm_i915_private *dev_priv = to_i915(dev); |
777 | hash_init(dev_priv->mmu_notifiers); | 828 | mutex_init(&dev_priv->mm_lock); |
778 | #endif | 829 | hash_init(dev_priv->mm_structs); |
779 | return 0; | 830 | return 0; |
780 | } | 831 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e4d7607da2c4..f29b44c86a2f 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -334,16 +334,20 @@ | |||
334 | #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) | 334 | #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) |
335 | #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) | 335 | #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) |
336 | #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2) | 336 | #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2) |
337 | #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4) | 337 | |
338 | #define COLOR_BLT_CMD (2<<29 | 0x40<<22 | (5-2)) | ||
339 | #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4) | ||
338 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) | 340 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) |
339 | #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5) | 341 | #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5) |
340 | #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) | 342 | #define BLT_WRITE_A (2<<20) |
341 | #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) | 343 | #define BLT_WRITE_RGB (1<<20) |
344 | #define BLT_WRITE_RGBA (BLT_WRITE_RGB | BLT_WRITE_A) | ||
342 | #define BLT_DEPTH_8 (0<<24) | 345 | #define BLT_DEPTH_8 (0<<24) |
343 | #define BLT_DEPTH_16_565 (1<<24) | 346 | #define BLT_DEPTH_16_565 (1<<24) |
344 | #define BLT_DEPTH_16_1555 (2<<24) | 347 | #define BLT_DEPTH_16_1555 (2<<24) |
345 | #define BLT_DEPTH_32 (3<<24) | 348 | #define BLT_DEPTH_32 (3<<24) |
346 | #define BLT_ROP_GXCOPY (0xcc<<16) | 349 | #define BLT_ROP_SRC_COPY (0xcc<<16) |
350 | #define BLT_ROP_COLOR_COPY (0xf0<<16) | ||
347 | #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */ | 351 | #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */ |
348 | #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */ | 352 | #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */ |
349 | #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) | 353 | #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 81d7681faa63..fdff1d420c14 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1631,6 +1631,10 @@ static void intel_dp_get_config(struct intel_encoder *encoder, | |||
1631 | 1631 | ||
1632 | pipe_config->adjusted_mode.flags |= flags; | 1632 | pipe_config->adjusted_mode.flags |= flags; |
1633 | 1633 | ||
1634 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev) && | ||
1635 | tmp & DP_COLOR_RANGE_16_235) | ||
1636 | pipe_config->limited_color_range = true; | ||
1637 | |||
1634 | pipe_config->has_dp_encoder = true; | 1638 | pipe_config->has_dp_encoder = true; |
1635 | 1639 | ||
1636 | intel_dp_get_m_n(crtc, pipe_config); | 1640 | intel_dp_get_m_n(crtc, pipe_config); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f9151f6641d9..ca34de7f6a7b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -712,7 +712,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
712 | struct intel_crtc_config *pipe_config) | 712 | struct intel_crtc_config *pipe_config) |
713 | { | 713 | { |
714 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); | 714 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
715 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 715 | struct drm_device *dev = encoder->base.dev; |
716 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
716 | u32 tmp, flags = 0; | 717 | u32 tmp, flags = 0; |
717 | int dotclock; | 718 | int dotclock; |
718 | 719 | ||
@@ -734,6 +735,10 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
734 | if (tmp & HDMI_MODE_SELECT_HDMI) | 735 | if (tmp & HDMI_MODE_SELECT_HDMI) |
735 | pipe_config->has_audio = true; | 736 | pipe_config->has_audio = true; |
736 | 737 | ||
738 | if (!HAS_PCH_SPLIT(dev) && | ||
739 | tmp & HDMI_COLOR_RANGE_16_235) | ||
740 | pipe_config->limited_color_range = true; | ||
741 | |||
737 | pipe_config->adjusted_mode.flags |= flags; | 742 | pipe_config->adjusted_mode.flags |= flags; |
738 | 743 | ||
739 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) | 744 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 16371a444426..47a126a0493f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1363,54 +1363,66 @@ i965_dispatch_execbuffer(struct intel_engine_cs *ring, | |||
1363 | 1363 | ||
1364 | /* Just userspace ABI convention to limit the wa batch bo to a resonable size */ | 1364 | /* Just userspace ABI convention to limit the wa batch bo to a resonable size */ |
1365 | #define I830_BATCH_LIMIT (256*1024) | 1365 | #define I830_BATCH_LIMIT (256*1024) |
1366 | #define I830_TLB_ENTRIES (2) | ||
1367 | #define I830_WA_SIZE max(I830_TLB_ENTRIES*4096, I830_BATCH_LIMIT) | ||
1366 | static int | 1368 | static int |
1367 | i830_dispatch_execbuffer(struct intel_engine_cs *ring, | 1369 | i830_dispatch_execbuffer(struct intel_engine_cs *ring, |
1368 | u64 offset, u32 len, | 1370 | u64 offset, u32 len, |
1369 | unsigned flags) | 1371 | unsigned flags) |
1370 | { | 1372 | { |
1373 | u32 cs_offset = ring->scratch.gtt_offset; | ||
1371 | int ret; | 1374 | int ret; |
1372 | 1375 | ||
1373 | if (flags & I915_DISPATCH_PINNED) { | 1376 | ret = intel_ring_begin(ring, 6); |
1374 | ret = intel_ring_begin(ring, 4); | 1377 | if (ret) |
1375 | if (ret) | 1378 | return ret; |
1376 | return ret; | ||
1377 | 1379 | ||
1378 | intel_ring_emit(ring, MI_BATCH_BUFFER); | 1380 | /* Evict the invalid PTE TLBs */ |
1379 | intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | 1381 | intel_ring_emit(ring, COLOR_BLT_CMD | BLT_WRITE_RGBA); |
1380 | intel_ring_emit(ring, offset + len - 8); | 1382 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_COLOR_COPY | 4096); |
1381 | intel_ring_emit(ring, MI_NOOP); | 1383 | intel_ring_emit(ring, I830_TLB_ENTRIES << 16 | 4); /* load each page */ |
1382 | intel_ring_advance(ring); | 1384 | intel_ring_emit(ring, cs_offset); |
1383 | } else { | 1385 | intel_ring_emit(ring, 0xdeadbeef); |
1384 | u32 cs_offset = ring->scratch.gtt_offset; | 1386 | intel_ring_emit(ring, MI_NOOP); |
1387 | intel_ring_advance(ring); | ||
1385 | 1388 | ||
1389 | if ((flags & I915_DISPATCH_PINNED) == 0) { | ||
1386 | if (len > I830_BATCH_LIMIT) | 1390 | if (len > I830_BATCH_LIMIT) |
1387 | return -ENOSPC; | 1391 | return -ENOSPC; |
1388 | 1392 | ||
1389 | ret = intel_ring_begin(ring, 9+3); | 1393 | ret = intel_ring_begin(ring, 6 + 2); |
1390 | if (ret) | 1394 | if (ret) |
1391 | return ret; | 1395 | return ret; |
1392 | /* Blit the batch (which has now all relocs applied) to the stable batch | 1396 | |
1393 | * scratch bo area (so that the CS never stumbles over its tlb | 1397 | /* Blit the batch (which has now all relocs applied) to the |
1394 | * invalidation bug) ... */ | 1398 | * stable batch scratch bo area (so that the CS never |
1395 | intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD | | 1399 | * stumbles over its tlb invalidation bug) ... |
1396 | XY_SRC_COPY_BLT_WRITE_ALPHA | | 1400 | */ |
1397 | XY_SRC_COPY_BLT_WRITE_RGB); | 1401 | intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA); |
1398 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096); | 1402 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096); |
1399 | intel_ring_emit(ring, 0); | 1403 | intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 4096); |
1400 | intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024); | ||
1401 | intel_ring_emit(ring, cs_offset); | 1404 | intel_ring_emit(ring, cs_offset); |
1402 | intel_ring_emit(ring, 0); | ||
1403 | intel_ring_emit(ring, 4096); | 1405 | intel_ring_emit(ring, 4096); |
1404 | intel_ring_emit(ring, offset); | 1406 | intel_ring_emit(ring, offset); |
1407 | |||
1405 | intel_ring_emit(ring, MI_FLUSH); | 1408 | intel_ring_emit(ring, MI_FLUSH); |
1409 | intel_ring_emit(ring, MI_NOOP); | ||
1410 | intel_ring_advance(ring); | ||
1406 | 1411 | ||
1407 | /* ... and execute it. */ | 1412 | /* ... and execute it. */ |
1408 | intel_ring_emit(ring, MI_BATCH_BUFFER); | 1413 | offset = cs_offset; |
1409 | intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | ||
1410 | intel_ring_emit(ring, cs_offset + len - 8); | ||
1411 | intel_ring_advance(ring); | ||
1412 | } | 1414 | } |
1413 | 1415 | ||
1416 | ret = intel_ring_begin(ring, 4); | ||
1417 | if (ret) | ||
1418 | return ret; | ||
1419 | |||
1420 | intel_ring_emit(ring, MI_BATCH_BUFFER); | ||
1421 | intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | ||
1422 | intel_ring_emit(ring, offset + len - 8); | ||
1423 | intel_ring_emit(ring, MI_NOOP); | ||
1424 | intel_ring_advance(ring); | ||
1425 | |||
1414 | return 0; | 1426 | return 0; |
1415 | } | 1427 | } |
1416 | 1428 | ||
@@ -2200,7 +2212,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) | |||
2200 | 2212 | ||
2201 | /* Workaround batchbuffer to combat CS tlb bug. */ | 2213 | /* Workaround batchbuffer to combat CS tlb bug. */ |
2202 | if (HAS_BROKEN_CS_TLB(dev)) { | 2214 | if (HAS_BROKEN_CS_TLB(dev)) { |
2203 | obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT); | 2215 | obj = i915_gem_alloc_object(dev, I830_WA_SIZE); |
2204 | if (obj == NULL) { | 2216 | if (obj == NULL) { |
2205 | DRM_ERROR("Failed to allocate batch bo\n"); | 2217 | DRM_ERROR("Failed to allocate batch bo\n"); |
2206 | return -ENOMEM; | 2218 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index c69d3ce1b3d6..c14341ca3ef9 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -854,6 +854,10 @@ intel_enable_tv(struct intel_encoder *encoder) | |||
854 | struct drm_device *dev = encoder->base.dev; | 854 | struct drm_device *dev = encoder->base.dev; |
855 | struct drm_i915_private *dev_priv = dev->dev_private; | 855 | struct drm_i915_private *dev_priv = dev->dev_private; |
856 | 856 | ||
857 | /* Prevents vblank waits from timing out in intel_tv_detect_type() */ | ||
858 | intel_wait_for_vblank(encoder->base.dev, | ||
859 | to_intel_crtc(encoder->base.crtc)->pipe); | ||
860 | |||
857 | I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); | 861 | I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); |
858 | } | 862 | } |
859 | 863 | ||
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index a125a7e32742..c6c9b02e0ada 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
@@ -258,28 +258,30 @@ static void set_hdmi_pdev(struct drm_device *dev, | |||
258 | priv->hdmi_pdev = pdev; | 258 | priv->hdmi_pdev = pdev; |
259 | } | 259 | } |
260 | 260 | ||
261 | #ifdef CONFIG_OF | ||
262 | static int get_gpio(struct device *dev, struct device_node *of_node, const char *name) | ||
263 | { | ||
264 | int gpio = of_get_named_gpio(of_node, name, 0); | ||
265 | if (gpio < 0) { | ||
266 | char name2[32]; | ||
267 | snprintf(name2, sizeof(name2), "%s-gpio", name); | ||
268 | gpio = of_get_named_gpio(of_node, name2, 0); | ||
269 | if (gpio < 0) { | ||
270 | dev_err(dev, "failed to get gpio: %s (%d)\n", | ||
271 | name, gpio); | ||
272 | gpio = -1; | ||
273 | } | ||
274 | } | ||
275 | return gpio; | ||
276 | } | ||
277 | #endif | ||
278 | |||
261 | static int hdmi_bind(struct device *dev, struct device *master, void *data) | 279 | static int hdmi_bind(struct device *dev, struct device *master, void *data) |
262 | { | 280 | { |
263 | static struct hdmi_platform_config config = {}; | 281 | static struct hdmi_platform_config config = {}; |
264 | #ifdef CONFIG_OF | 282 | #ifdef CONFIG_OF |
265 | struct device_node *of_node = dev->of_node; | 283 | struct device_node *of_node = dev->of_node; |
266 | 284 | ||
267 | int get_gpio(const char *name) | ||
268 | { | ||
269 | int gpio = of_get_named_gpio(of_node, name, 0); | ||
270 | if (gpio < 0) { | ||
271 | char name2[32]; | ||
272 | snprintf(name2, sizeof(name2), "%s-gpio", name); | ||
273 | gpio = of_get_named_gpio(of_node, name2, 0); | ||
274 | if (gpio < 0) { | ||
275 | dev_err(dev, "failed to get gpio: %s (%d)\n", | ||
276 | name, gpio); | ||
277 | gpio = -1; | ||
278 | } | ||
279 | } | ||
280 | return gpio; | ||
281 | } | ||
282 | |||
283 | if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { | 285 | if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { |
284 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; | 286 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; |
285 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; | 287 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; |
@@ -312,12 +314,12 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
312 | } | 314 | } |
313 | 315 | ||
314 | config.mmio_name = "core_physical"; | 316 | config.mmio_name = "core_physical"; |
315 | config.ddc_clk_gpio = get_gpio("qcom,hdmi-tx-ddc-clk"); | 317 | config.ddc_clk_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk"); |
316 | config.ddc_data_gpio = get_gpio("qcom,hdmi-tx-ddc-data"); | 318 | config.ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data"); |
317 | config.hpd_gpio = get_gpio("qcom,hdmi-tx-hpd"); | 319 | config.hpd_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd"); |
318 | config.mux_en_gpio = get_gpio("qcom,hdmi-tx-mux-en"); | 320 | config.mux_en_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en"); |
319 | config.mux_sel_gpio = get_gpio("qcom,hdmi-tx-mux-sel"); | 321 | config.mux_sel_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel"); |
320 | config.mux_lpm_gpio = get_gpio("qcom,hdmi-tx-mux-lpm"); | 322 | config.mux_lpm_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm"); |
321 | 323 | ||
322 | #else | 324 | #else |
323 | static const char *hpd_clk_names[] = { | 325 | static const char *hpd_clk_names[] = { |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c index 902d7685d441..f408b69486a8 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c | |||
@@ -15,19 +15,25 @@ | |||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifdef CONFIG_COMMON_CLK | ||
18 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
19 | #include <linux/clk-provider.h> | 20 | #include <linux/clk-provider.h> |
21 | #endif | ||
20 | 22 | ||
21 | #include "hdmi.h" | 23 | #include "hdmi.h" |
22 | 24 | ||
23 | struct hdmi_phy_8960 { | 25 | struct hdmi_phy_8960 { |
24 | struct hdmi_phy base; | 26 | struct hdmi_phy base; |
25 | struct hdmi *hdmi; | 27 | struct hdmi *hdmi; |
28 | #ifdef CONFIG_COMMON_CLK | ||
26 | struct clk_hw pll_hw; | 29 | struct clk_hw pll_hw; |
27 | struct clk *pll; | 30 | struct clk *pll; |
28 | unsigned long pixclk; | 31 | unsigned long pixclk; |
32 | #endif | ||
29 | }; | 33 | }; |
30 | #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) | 34 | #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) |
35 | |||
36 | #ifdef CONFIG_COMMON_CLK | ||
31 | #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) | 37 | #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) |
32 | 38 | ||
33 | /* | 39 | /* |
@@ -374,7 +380,7 @@ static struct clk_init_data pll_init = { | |||
374 | .parent_names = hdmi_pll_parents, | 380 | .parent_names = hdmi_pll_parents, |
375 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), | 381 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), |
376 | }; | 382 | }; |
377 | 383 | #endif | |
378 | 384 | ||
379 | /* | 385 | /* |
380 | * HDMI Phy: | 386 | * HDMI Phy: |
@@ -480,12 +486,15 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
480 | { | 486 | { |
481 | struct hdmi_phy_8960 *phy_8960; | 487 | struct hdmi_phy_8960 *phy_8960; |
482 | struct hdmi_phy *phy = NULL; | 488 | struct hdmi_phy *phy = NULL; |
483 | int ret, i; | 489 | int ret; |
490 | #ifdef CONFIG_COMMON_CLK | ||
491 | int i; | ||
484 | 492 | ||
485 | /* sanity check: */ | 493 | /* sanity check: */ |
486 | for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) | 494 | for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) |
487 | if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) | 495 | if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) |
488 | return ERR_PTR(-EINVAL); | 496 | return ERR_PTR(-EINVAL); |
497 | #endif | ||
489 | 498 | ||
490 | phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); | 499 | phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); |
491 | if (!phy_8960) { | 500 | if (!phy_8960) { |
@@ -499,6 +508,7 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
499 | 508 | ||
500 | phy_8960->hdmi = hdmi; | 509 | phy_8960->hdmi = hdmi; |
501 | 510 | ||
511 | #ifdef CONFIG_COMMON_CLK | ||
502 | phy_8960->pll_hw.init = &pll_init; | 512 | phy_8960->pll_hw.init = &pll_init; |
503 | phy_8960->pll = devm_clk_register(hdmi->dev->dev, &phy_8960->pll_hw); | 513 | phy_8960->pll = devm_clk_register(hdmi->dev->dev, &phy_8960->pll_hw); |
504 | if (IS_ERR(phy_8960->pll)) { | 514 | if (IS_ERR(phy_8960->pll)) { |
@@ -506,6 +516,7 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
506 | phy_8960->pll = NULL; | 516 | phy_8960->pll = NULL; |
507 | goto fail; | 517 | goto fail; |
508 | } | 518 | } |
519 | #endif | ||
509 | 520 | ||
510 | return phy; | 521 | return phy; |
511 | 522 | ||
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 26ee80db17af..fcf95680413d 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -52,7 +52,7 @@ module_param(reglog, bool, 0600); | |||
52 | #define reglog 0 | 52 | #define reglog 0 |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | static char *vram; | 55 | static char *vram = "16m"; |
56 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); | 56 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); |
57 | module_param(vram, charp, 0); | 57 | module_param(vram, charp, 0); |
58 | 58 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c index 0a44459844e3..05a278bab247 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | |||
@@ -200,7 +200,6 @@ nvc0_bar_init(struct nouveau_object *object) | |||
200 | 200 | ||
201 | nv_mask(priv, 0x000200, 0x00000100, 0x00000000); | 201 | nv_mask(priv, 0x000200, 0x00000100, 0x00000000); |
202 | nv_mask(priv, 0x000200, 0x00000100, 0x00000100); | 202 | nv_mask(priv, 0x000200, 0x00000100, 0x00000100); |
203 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); | ||
204 | 203 | ||
205 | nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); | 204 | nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); |
206 | if (priv->bar[0].mem) | 205 | if (priv->bar[0].mem) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c index b19a2b3c1081..32f28dc73ef2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c | |||
@@ -60,6 +60,7 @@ nvc0_fb_init(struct nouveau_object *object) | |||
60 | 60 | ||
61 | if (priv->r100c10_page) | 61 | if (priv->r100c10_page) |
62 | nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); | 62 | nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); |
63 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | ||
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c index b54b582e72c4..d5d65285efe5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c | |||
@@ -98,6 +98,7 @@ static int | |||
98 | gf100_ltc_init(struct nouveau_object *object) | 98 | gf100_ltc_init(struct nouveau_object *object) |
99 | { | 99 | { |
100 | struct nvkm_ltc_priv *priv = (void *)object; | 100 | struct nvkm_ltc_priv *priv = (void *)object; |
101 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
101 | int ret; | 102 | int ret; |
102 | 103 | ||
103 | ret = nvkm_ltc_init(priv); | 104 | ret = nvkm_ltc_init(priv); |
@@ -107,6 +108,7 @@ gf100_ltc_init(struct nouveau_object *object) | |||
107 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ | 108 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ |
108 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); | 109 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); |
109 | nv_wr32(priv, 0x17e8d4, priv->tag_base); | 110 | nv_wr32(priv, 0x17e8d4, priv->tag_base); |
111 | nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
110 | return 0; | 112 | return 0; |
111 | } | 113 | } |
112 | 114 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c index ea716569745d..b39b5d0eb8f9 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c | |||
@@ -28,6 +28,7 @@ static int | |||
28 | gk104_ltc_init(struct nouveau_object *object) | 28 | gk104_ltc_init(struct nouveau_object *object) |
29 | { | 29 | { |
30 | struct nvkm_ltc_priv *priv = (void *)object; | 30 | struct nvkm_ltc_priv *priv = (void *)object; |
31 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
31 | int ret; | 32 | int ret; |
32 | 33 | ||
33 | ret = nvkm_ltc_init(priv); | 34 | ret = nvkm_ltc_init(priv); |
@@ -37,6 +38,7 @@ gk104_ltc_init(struct nouveau_object *object) | |||
37 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); | 38 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); |
38 | nv_wr32(priv, 0x17e000, priv->ltc_nr); | 39 | nv_wr32(priv, 0x17e000, priv->ltc_nr); |
39 | nv_wr32(priv, 0x17e8d4, priv->tag_base); | 40 | nv_wr32(priv, 0x17e8d4, priv->tag_base); |
41 | nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
40 | return 0; | 42 | return 0; |
41 | } | 43 | } |
42 | 44 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c index 4761b2e9af00..a4de64289762 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c | |||
@@ -98,6 +98,7 @@ static int | |||
98 | gm107_ltc_init(struct nouveau_object *object) | 98 | gm107_ltc_init(struct nouveau_object *object) |
99 | { | 99 | { |
100 | struct nvkm_ltc_priv *priv = (void *)object; | 100 | struct nvkm_ltc_priv *priv = (void *)object; |
101 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
101 | int ret; | 102 | int ret; |
102 | 103 | ||
103 | ret = nvkm_ltc_init(priv); | 104 | ret = nvkm_ltc_init(priv); |
@@ -106,6 +107,7 @@ gm107_ltc_init(struct nouveau_object *object) | |||
106 | 107 | ||
107 | nv_wr32(priv, 0x17e27c, priv->ltc_nr); | 108 | nv_wr32(priv, 0x17e27c, priv->ltc_nr); |
108 | nv_wr32(priv, 0x17e278, priv->tag_base); | 109 | nv_wr32(priv, 0x17e278, priv->tag_base); |
110 | nv_mask(priv, 0x17e264, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
109 | return 0; | 111 | return 0; |
110 | } | 112 | } |
111 | 113 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 279206997e5c..622424692b3b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -46,7 +46,6 @@ static struct nouveau_dsm_priv { | |||
46 | bool dsm_detected; | 46 | bool dsm_detected; |
47 | bool optimus_detected; | 47 | bool optimus_detected; |
48 | acpi_handle dhandle; | 48 | acpi_handle dhandle; |
49 | acpi_handle other_handle; | ||
50 | acpi_handle rom_handle; | 49 | acpi_handle rom_handle; |
51 | } nouveau_dsm_priv; | 50 | } nouveau_dsm_priv; |
52 | 51 | ||
@@ -222,10 +221,9 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) | |||
222 | if (!dhandle) | 221 | if (!dhandle) |
223 | return false; | 222 | return false; |
224 | 223 | ||
225 | if (!acpi_has_method(dhandle, "_DSM")) { | 224 | if (!acpi_has_method(dhandle, "_DSM")) |
226 | nouveau_dsm_priv.other_handle = dhandle; | ||
227 | return false; | 225 | return false; |
228 | } | 226 | |
229 | if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, | 227 | if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, |
230 | 1 << NOUVEAU_DSM_POWER)) | 228 | 1 << NOUVEAU_DSM_POWER)) |
231 | retval |= NOUVEAU_DSM_HAS_MUX; | 229 | retval |= NOUVEAU_DSM_HAS_MUX; |
@@ -301,16 +299,6 @@ static bool nouveau_dsm_detect(void) | |||
301 | printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", | 299 | printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", |
302 | acpi_method_name); | 300 | acpi_method_name); |
303 | nouveau_dsm_priv.dsm_detected = true; | 301 | nouveau_dsm_priv.dsm_detected = true; |
304 | /* | ||
305 | * On some systems hotplug events are generated for the device | ||
306 | * being switched off when _DSM is executed. They cause ACPI | ||
307 | * hotplug to trigger and attempt to remove the device from | ||
308 | * the system, which causes it to break down. Prevent that from | ||
309 | * happening by setting the no_hotplug flag for the involved | ||
310 | * ACPI device objects. | ||
311 | */ | ||
312 | acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle); | ||
313 | acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle); | ||
314 | ret = true; | 302 | ret = true; |
315 | } | 303 | } |
316 | 304 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 250a5e88c751..9c3af96a7153 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -627,6 +627,7 @@ int nouveau_pmops_suspend(struct device *dev) | |||
627 | 627 | ||
628 | pci_save_state(pdev); | 628 | pci_save_state(pdev); |
629 | pci_disable_device(pdev); | 629 | pci_disable_device(pdev); |
630 | pci_ignore_hotplug(pdev); | ||
630 | pci_set_power_state(pdev, PCI_D3hot); | 631 | pci_set_power_state(pdev, PCI_D3hot); |
631 | return 0; | 632 | return 0; |
632 | } | 633 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index 18d55d447248..c7592ec8ecb8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c | |||
@@ -108,7 +108,16 @@ void | |||
108 | nouveau_vga_fini(struct nouveau_drm *drm) | 108 | nouveau_vga_fini(struct nouveau_drm *drm) |
109 | { | 109 | { |
110 | struct drm_device *dev = drm->dev; | 110 | struct drm_device *dev = drm->dev; |
111 | bool runtime = false; | ||
112 | |||
113 | if (nouveau_runtime_pm == 1) | ||
114 | runtime = true; | ||
115 | if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) | ||
116 | runtime = true; | ||
117 | |||
111 | vga_switcheroo_unregister_client(dev->pdev); | 118 | vga_switcheroo_unregister_client(dev->pdev); |
119 | if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) | ||
120 | vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); | ||
112 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 121 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
113 | } | 122 | } |
114 | 123 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index b1e11f8434e2..ac14b67621d3 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
406 | int ret; | 406 | int ret; |
407 | 407 | ||
408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
409 | |||
410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
411 | DP_DPCD_SIZE); | 409 | DP_DPCD_SIZE); |
412 | if (ret > 0) { | 410 | if (ret > 0) { |
413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
414 | 412 | ||
415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), | 413 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); | 414 | dig_connector->dpcd); |
417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); | ||
418 | 415 | ||
419 | radeon_dp_probe_oui(radeon_connector); | 416 | radeon_dp_probe_oui(radeon_connector); |
420 | 417 | ||
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 192278bc993c..c4ffa54b1e3d 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -489,13 +489,6 @@ int cik_sdma_resume(struct radeon_device *rdev) | |||
489 | { | 489 | { |
490 | int r; | 490 | int r; |
491 | 491 | ||
492 | /* Reset dma */ | ||
493 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1); | ||
494 | RREG32(SRBM_SOFT_RESET); | ||
495 | udelay(50); | ||
496 | WREG32(SRBM_SOFT_RESET, 0); | ||
497 | RREG32(SRBM_SOFT_RESET); | ||
498 | |||
499 | r = cik_sdma_load_microcode(rdev); | 492 | r = cik_sdma_load_microcode(rdev); |
500 | if (r) | 493 | if (r) |
501 | return r; | 494 | return r; |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 8b58e11b64fa..67cb472d188c 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #define KV_MINIMUM_ENGINE_CLOCK 800 | 33 | #define KV_MINIMUM_ENGINE_CLOCK 800 |
34 | #define SMC_RAM_END 0x40000 | 34 | #define SMC_RAM_END 0x40000 |
35 | 35 | ||
36 | static int kv_enable_nb_dpm(struct radeon_device *rdev, | ||
37 | bool enable); | ||
36 | static void kv_init_graphics_levels(struct radeon_device *rdev); | 38 | static void kv_init_graphics_levels(struct radeon_device *rdev); |
37 | static int kv_calculate_ds_divider(struct radeon_device *rdev); | 39 | static int kv_calculate_ds_divider(struct radeon_device *rdev); |
38 | static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); | 40 | static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); |
@@ -1295,6 +1297,9 @@ void kv_dpm_disable(struct radeon_device *rdev) | |||
1295 | { | 1297 | { |
1296 | kv_smc_bapm_enable(rdev, false); | 1298 | kv_smc_bapm_enable(rdev, false); |
1297 | 1299 | ||
1300 | if (rdev->family == CHIP_MULLINS) | ||
1301 | kv_enable_nb_dpm(rdev, false); | ||
1302 | |||
1298 | /* powerup blocks */ | 1303 | /* powerup blocks */ |
1299 | kv_dpm_powergate_acp(rdev, false); | 1304 | kv_dpm_powergate_acp(rdev, false); |
1300 | kv_dpm_powergate_samu(rdev, false); | 1305 | kv_dpm_powergate_samu(rdev, false); |
@@ -1769,15 +1774,24 @@ static int kv_update_dfs_bypass_settings(struct radeon_device *rdev, | |||
1769 | return ret; | 1774 | return ret; |
1770 | } | 1775 | } |
1771 | 1776 | ||
1772 | static int kv_enable_nb_dpm(struct radeon_device *rdev) | 1777 | static int kv_enable_nb_dpm(struct radeon_device *rdev, |
1778 | bool enable) | ||
1773 | { | 1779 | { |
1774 | struct kv_power_info *pi = kv_get_pi(rdev); | 1780 | struct kv_power_info *pi = kv_get_pi(rdev); |
1775 | int ret = 0; | 1781 | int ret = 0; |
1776 | 1782 | ||
1777 | if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { | 1783 | if (enable) { |
1778 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); | 1784 | if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { |
1779 | if (ret == 0) | 1785 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); |
1780 | pi->nb_dpm_enabled = true; | 1786 | if (ret == 0) |
1787 | pi->nb_dpm_enabled = true; | ||
1788 | } | ||
1789 | } else { | ||
1790 | if (pi->enable_nb_dpm && pi->nb_dpm_enabled) { | ||
1791 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Disable); | ||
1792 | if (ret == 0) | ||
1793 | pi->nb_dpm_enabled = false; | ||
1794 | } | ||
1781 | } | 1795 | } |
1782 | 1796 | ||
1783 | return ret; | 1797 | return ret; |
@@ -1864,7 +1878,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
1864 | } | 1878 | } |
1865 | kv_update_sclk_t(rdev); | 1879 | kv_update_sclk_t(rdev); |
1866 | if (rdev->family == CHIP_MULLINS) | 1880 | if (rdev->family == CHIP_MULLINS) |
1867 | kv_enable_nb_dpm(rdev); | 1881 | kv_enable_nb_dpm(rdev, true); |
1868 | } | 1882 | } |
1869 | } else { | 1883 | } else { |
1870 | if (pi->enable_dpm) { | 1884 | if (pi->enable_dpm) { |
@@ -1889,7 +1903,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
1889 | } | 1903 | } |
1890 | kv_update_acp_boot_level(rdev); | 1904 | kv_update_acp_boot_level(rdev); |
1891 | kv_update_sclk_t(rdev); | 1905 | kv_update_sclk_t(rdev); |
1892 | kv_enable_nb_dpm(rdev); | 1906 | kv_enable_nb_dpm(rdev, true); |
1893 | } | 1907 | } |
1894 | } | 1908 | } |
1895 | 1909 | ||
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c index 8a3e6221cece..f26f0a9fb522 100644 --- a/drivers/gpu/drm/radeon/ni_dma.c +++ b/drivers/gpu/drm/radeon/ni_dma.c | |||
@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev) | |||
191 | u32 reg_offset, wb_offset; | 191 | u32 reg_offset, wb_offset; |
192 | int i, r; | 192 | int i, r; |
193 | 193 | ||
194 | /* Reset dma */ | ||
195 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1); | ||
196 | RREG32(SRBM_SOFT_RESET); | ||
197 | udelay(50); | ||
198 | WREG32(SRBM_SOFT_RESET, 0); | ||
199 | |||
200 | for (i = 0; i < 2; i++) { | 194 | for (i = 0; i < 2; i++) { |
201 | if (i == 0) { | 195 | if (i == 0) { |
202 | ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; | 196 | ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 4c5ec44ff328..b0098e792e62 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -821,6 +821,20 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc) | |||
821 | return RREG32(RADEON_CRTC2_CRNT_FRAME); | 821 | return RREG32(RADEON_CRTC2_CRNT_FRAME); |
822 | } | 822 | } |
823 | 823 | ||
824 | /** | ||
825 | * r100_ring_hdp_flush - flush Host Data Path via the ring buffer | ||
826 | * rdev: radeon device structure | ||
827 | * ring: ring buffer struct for emitting packets | ||
828 | */ | ||
829 | static void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring) | ||
830 | { | ||
831 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
832 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl | | ||
833 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
834 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
835 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl); | ||
836 | } | ||
837 | |||
824 | /* Who ever call radeon_fence_emit should call ring_lock and ask | 838 | /* Who ever call radeon_fence_emit should call ring_lock and ask |
825 | * for enough space (today caller are ib schedule and buffer move) */ | 839 | * for enough space (today caller are ib schedule and buffer move) */ |
826 | void r100_fence_ring_emit(struct radeon_device *rdev, | 840 | void r100_fence_ring_emit(struct radeon_device *rdev, |
@@ -1056,20 +1070,6 @@ void r100_gfx_set_wptr(struct radeon_device *rdev, | |||
1056 | (void)RREG32(RADEON_CP_RB_WPTR); | 1070 | (void)RREG32(RADEON_CP_RB_WPTR); |
1057 | } | 1071 | } |
1058 | 1072 | ||
1059 | /** | ||
1060 | * r100_ring_hdp_flush - flush Host Data Path via the ring buffer | ||
1061 | * rdev: radeon device structure | ||
1062 | * ring: ring buffer struct for emitting packets | ||
1063 | */ | ||
1064 | void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring) | ||
1065 | { | ||
1066 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
1067 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl | | ||
1068 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
1069 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
1070 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl); | ||
1071 | } | ||
1072 | |||
1073 | static void r100_cp_load_microcode(struct radeon_device *rdev) | 1073 | static void r100_cp_load_microcode(struct radeon_device *rdev) |
1074 | { | 1074 | { |
1075 | const __be32 *fw_data; | 1075 | const __be32 *fw_data; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index e616eb5f6e7a..3cfb50056f7a 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2769,8 +2769,8 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev, | |||
2769 | radeon_ring_write(ring, lower_32_bits(addr)); | 2769 | radeon_ring_write(ring, lower_32_bits(addr)); |
2770 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); | 2770 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); |
2771 | 2771 | ||
2772 | /* PFP_SYNC_ME packet only exists on 7xx+ */ | 2772 | /* PFP_SYNC_ME packet only exists on 7xx+, only enable it on eg+ */ |
2773 | if (emit_wait && (rdev->family >= CHIP_RV770)) { | 2773 | if (emit_wait && (rdev->family >= CHIP_CEDAR)) { |
2774 | /* Prevent the PFP from running ahead of the semaphore wait */ | 2774 | /* Prevent the PFP from running ahead of the semaphore wait */ |
2775 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | 2775 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); |
2776 | radeon_ring_write(ring, 0x0); | 2776 | radeon_ring_write(ring, 0x0); |
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c index 51fd98553eaf..a908daa006d2 100644 --- a/drivers/gpu/drm/radeon/r600_dma.c +++ b/drivers/gpu/drm/radeon/r600_dma.c | |||
@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev) | |||
124 | u32 rb_bufsz; | 124 | u32 rb_bufsz; |
125 | int r; | 125 | int r; |
126 | 126 | ||
127 | /* Reset dma */ | ||
128 | if (rdev->family >= CHIP_RV770) | ||
129 | WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA); | ||
130 | else | ||
131 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA); | ||
132 | RREG32(SRBM_SOFT_RESET); | ||
133 | udelay(50); | ||
134 | WREG32(SRBM_SOFT_RESET, 0); | ||
135 | |||
136 | WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); | 127 | WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); |
137 | WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); | 128 | WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); |
138 | 129 | ||
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 0c4a7d8d93e0..31e1052ad3e3 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -44,13 +44,6 @@ | |||
44 | #define R6XX_MAX_PIPES 8 | 44 | #define R6XX_MAX_PIPES 8 |
45 | #define R6XX_MAX_PIPES_MASK 0xff | 45 | #define R6XX_MAX_PIPES_MASK 0xff |
46 | 46 | ||
47 | /* PTE flags */ | ||
48 | #define PTE_VALID (1 << 0) | ||
49 | #define PTE_SYSTEM (1 << 1) | ||
50 | #define PTE_SNOOPED (1 << 2) | ||
51 | #define PTE_READABLE (1 << 5) | ||
52 | #define PTE_WRITEABLE (1 << 6) | ||
53 | |||
54 | /* tiling bits */ | 47 | /* tiling bits */ |
55 | #define ARRAY_LINEAR_GENERAL 0x00000000 | 48 | #define ARRAY_LINEAR_GENERAL 0x00000000 |
56 | #define ARRAY_LINEAR_ALIGNED 0x00000001 | 49 | #define ARRAY_LINEAR_ALIGNED 0x00000001 |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index eeeeabe09758..2dd5847f9b98 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -185,7 +185,6 @@ static struct radeon_asic_ring r100_gfx_ring = { | |||
185 | .get_rptr = &r100_gfx_get_rptr, | 185 | .get_rptr = &r100_gfx_get_rptr, |
186 | .get_wptr = &r100_gfx_get_wptr, | 186 | .get_wptr = &r100_gfx_get_wptr, |
187 | .set_wptr = &r100_gfx_set_wptr, | 187 | .set_wptr = &r100_gfx_set_wptr, |
188 | .hdp_flush = &r100_ring_hdp_flush, | ||
189 | }; | 188 | }; |
190 | 189 | ||
191 | static struct radeon_asic r100_asic = { | 190 | static struct radeon_asic r100_asic = { |
@@ -332,7 +331,6 @@ static struct radeon_asic_ring r300_gfx_ring = { | |||
332 | .get_rptr = &r100_gfx_get_rptr, | 331 | .get_rptr = &r100_gfx_get_rptr, |
333 | .get_wptr = &r100_gfx_get_wptr, | 332 | .get_wptr = &r100_gfx_get_wptr, |
334 | .set_wptr = &r100_gfx_set_wptr, | 333 | .set_wptr = &r100_gfx_set_wptr, |
335 | .hdp_flush = &r100_ring_hdp_flush, | ||
336 | }; | 334 | }; |
337 | 335 | ||
338 | static struct radeon_asic r300_asic = { | 336 | static struct radeon_asic r300_asic = { |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 275a5dc01780..7756bc1e1cd3 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -148,8 +148,7 @@ u32 r100_gfx_get_wptr(struct radeon_device *rdev, | |||
148 | struct radeon_ring *ring); | 148 | struct radeon_ring *ring); |
149 | void r100_gfx_set_wptr(struct radeon_device *rdev, | 149 | void r100_gfx_set_wptr(struct radeon_device *rdev, |
150 | struct radeon_ring *ring); | 150 | struct radeon_ring *ring); |
151 | void r100_ring_hdp_flush(struct radeon_device *rdev, | 151 | |
152 | struct radeon_ring *ring); | ||
153 | /* | 152 | /* |
154 | * r200,rv250,rs300,rv280 | 153 | * r200,rv250,rs300,rv280 |
155 | */ | 154 | */ |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 92b2d8dd4735..e74c7e387dde 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -447,6 +447,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | /* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */ | ||
451 | if ((dev->pdev->device == 0x9805) && | ||
452 | (dev->pdev->subsystem_vendor == 0x1734) && | ||
453 | (dev->pdev->subsystem_device == 0x11bd)) { | ||
454 | if (*connector_type == DRM_MODE_CONNECTOR_VGA) | ||
455 | return false; | ||
456 | } | ||
450 | 457 | ||
451 | return true; | 458 | return true; |
452 | } | 459 | } |
@@ -2281,19 +2288,31 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r | |||
2281 | (controller->ucFanParameters & | 2288 | (controller->ucFanParameters & |
2282 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 2289 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2283 | rdev->pm.int_thermal_type = THERMAL_TYPE_KV; | 2290 | rdev->pm.int_thermal_type = THERMAL_TYPE_KV; |
2284 | } else if ((controller->ucType == | 2291 | } else if (controller->ucType == |
2285 | ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || | 2292 | ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) { |
2286 | (controller->ucType == | 2293 | DRM_INFO("External GPIO thermal controller %s fan control\n", |
2287 | ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) || | 2294 | (controller->ucFanParameters & |
2288 | (controller->ucType == | 2295 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2289 | ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL)) { | 2296 | rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO; |
2290 | DRM_INFO("Special thermal controller config\n"); | 2297 | } else if (controller->ucType == |
2298 | ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) { | ||
2299 | DRM_INFO("ADT7473 with internal thermal controller %s fan control\n", | ||
2300 | (controller->ucFanParameters & | ||
2301 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | ||
2302 | rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL; | ||
2303 | } else if (controller->ucType == | ||
2304 | ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL) { | ||
2305 | DRM_INFO("EMC2103 with internal thermal controller %s fan control\n", | ||
2306 | (controller->ucFanParameters & | ||
2307 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | ||
2308 | rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL; | ||
2291 | } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { | 2309 | } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { |
2292 | DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", | 2310 | DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", |
2293 | pp_lib_thermal_controller_names[controller->ucType], | 2311 | pp_lib_thermal_controller_names[controller->ucType], |
2294 | controller->ucI2cAddress >> 1, | 2312 | controller->ucI2cAddress >> 1, |
2295 | (controller->ucFanParameters & | 2313 | (controller->ucFanParameters & |
2296 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 2314 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2315 | rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL; | ||
2297 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); | 2316 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); |
2298 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); | 2317 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
2299 | if (rdev->pm.i2c_bus) { | 2318 | if (rdev->pm.i2c_bus) { |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index a9fb0d016d38..8bc7d0bbd3c8 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv { | |||
33 | bool atpx_detected; | 33 | bool atpx_detected; |
34 | /* handle for device - and atpx */ | 34 | /* handle for device - and atpx */ |
35 | acpi_handle dhandle; | 35 | acpi_handle dhandle; |
36 | acpi_handle other_handle; | ||
37 | struct radeon_atpx atpx; | 36 | struct radeon_atpx atpx; |
38 | } radeon_atpx_priv; | 37 | } radeon_atpx_priv; |
39 | 38 | ||
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
453 | return false; | 452 | return false; |
454 | 453 | ||
455 | status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); | 454 | status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); |
456 | if (ACPI_FAILURE(status)) { | 455 | if (ACPI_FAILURE(status)) |
457 | radeon_atpx_priv.other_handle = dhandle; | ||
458 | return false; | 456 | return false; |
459 | } | 457 | |
460 | radeon_atpx_priv.dhandle = dhandle; | 458 | radeon_atpx_priv.dhandle = dhandle; |
461 | radeon_atpx_priv.atpx.handle = atpx_handle; | 459 | radeon_atpx_priv.atpx.handle = atpx_handle; |
462 | return true; | 460 | return true; |
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void) | |||
540 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", | 538 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", |
541 | acpi_method_name); | 539 | acpi_method_name); |
542 | radeon_atpx_priv.atpx_detected = true; | 540 | radeon_atpx_priv.atpx_detected = true; |
543 | /* | ||
544 | * On some systems hotplug events are generated for the device | ||
545 | * being switched off when ATPX is executed. They cause ACPI | ||
546 | * hotplug to trigger and attempt to remove the device from | ||
547 | * the system, which causes it to break down. Prevent that from | ||
548 | * happening by setting the no_hotplug flag for the involved | ||
549 | * ACPI device objects. | ||
550 | */ | ||
551 | acpi_bus_no_hotplug(radeon_atpx_priv.dhandle); | ||
552 | acpi_bus_no_hotplug(radeon_atpx_priv.other_handle); | ||
553 | return true; | 541 | return true; |
554 | } | 542 | } |
555 | return false; | 543 | return false; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 6a219bcee66d..75223dd3a8a3 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1393,7 +1393,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1393 | 1393 | ||
1394 | r = radeon_init(rdev); | 1394 | r = radeon_init(rdev); |
1395 | if (r) | 1395 | if (r) |
1396 | return r; | 1396 | goto failed; |
1397 | 1397 | ||
1398 | r = radeon_ib_ring_tests(rdev); | 1398 | r = radeon_ib_ring_tests(rdev); |
1399 | if (r) | 1399 | if (r) |
@@ -1413,7 +1413,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1413 | radeon_agp_disable(rdev); | 1413 | radeon_agp_disable(rdev); |
1414 | r = radeon_init(rdev); | 1414 | r = radeon_init(rdev); |
1415 | if (r) | 1415 | if (r) |
1416 | return r; | 1416 | goto failed; |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | if ((radeon_testing & 1)) { | 1419 | if ((radeon_testing & 1)) { |
@@ -1435,6 +1435,11 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1435 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); | 1435 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); |
1436 | } | 1436 | } |
1437 | return 0; | 1437 | return 0; |
1438 | |||
1439 | failed: | ||
1440 | if (runtime) | ||
1441 | vga_switcheroo_fini_domain_pm_ops(rdev->dev); | ||
1442 | return r; | ||
1438 | } | 1443 | } |
1439 | 1444 | ||
1440 | static void radeon_debugfs_remove_files(struct radeon_device *rdev); | 1445 | static void radeon_debugfs_remove_files(struct radeon_device *rdev); |
@@ -1455,6 +1460,8 @@ void radeon_device_fini(struct radeon_device *rdev) | |||
1455 | radeon_bo_evict_vram(rdev); | 1460 | radeon_bo_evict_vram(rdev); |
1456 | radeon_fini(rdev); | 1461 | radeon_fini(rdev); |
1457 | vga_switcheroo_unregister_client(rdev->pdev); | 1462 | vga_switcheroo_unregister_client(rdev->pdev); |
1463 | if (rdev->flags & RADEON_IS_PX) | ||
1464 | vga_switcheroo_fini_domain_pm_ops(rdev->dev); | ||
1458 | vga_client_register(rdev->pdev, NULL, NULL, NULL); | 1465 | vga_client_register(rdev->pdev, NULL, NULL, NULL); |
1459 | if (rdev->rio_mem) | 1466 | if (rdev->rio_mem) |
1460 | pci_iounmap(rdev->pdev, rdev->rio_mem); | 1467 | pci_iounmap(rdev->pdev, rdev->rio_mem); |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 8df888908833..4126fd0937a2 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -83,7 +83,7 @@ | |||
83 | * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG | 83 | * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG |
84 | * 2.39.0 - Add INFO query for number of active CUs | 84 | * 2.39.0 - Add INFO query for number of active CUs |
85 | * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting | 85 | * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting |
86 | * CS to GPU | 86 | * CS to GPU on >= r600 |
87 | */ | 87 | */ |
88 | #define KMS_DRIVER_MAJOR 2 | 88 | #define KMS_DRIVER_MAJOR 2 |
89 | #define KMS_DRIVER_MINOR 40 | 89 | #define KMS_DRIVER_MINOR 40 |
@@ -440,6 +440,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev) | |||
440 | ret = radeon_suspend_kms(drm_dev, false, false); | 440 | ret = radeon_suspend_kms(drm_dev, false, false); |
441 | pci_save_state(pdev); | 441 | pci_save_state(pdev); |
442 | pci_disable_device(pdev); | 442 | pci_disable_device(pdev); |
443 | pci_ignore_hotplug(pdev); | ||
443 | pci_set_power_state(pdev, PCI_D3cold); | 444 | pci_set_power_state(pdev, PCI_D3cold); |
444 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; | 445 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; |
445 | 446 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index 56d9fd66d8ae..abd6753a570a 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c | |||
@@ -34,7 +34,7 @@ | |||
34 | int radeon_semaphore_create(struct radeon_device *rdev, | 34 | int radeon_semaphore_create(struct radeon_device *rdev, |
35 | struct radeon_semaphore **semaphore) | 35 | struct radeon_semaphore **semaphore) |
36 | { | 36 | { |
37 | uint32_t *cpu_addr; | 37 | uint64_t *cpu_addr; |
38 | int i, r; | 38 | int i, r; |
39 | 39 | ||
40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); | 40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 6c1fc339d228..c5799f16aa4b 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -221,9 +221,9 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i, | |||
221 | entry = (lower_32_bits(addr) & PAGE_MASK) | | 221 | entry = (lower_32_bits(addr) & PAGE_MASK) | |
222 | ((upper_32_bits(addr) & 0xff) << 4); | 222 | ((upper_32_bits(addr) & 0xff) << 4); |
223 | if (flags & RADEON_GART_PAGE_READ) | 223 | if (flags & RADEON_GART_PAGE_READ) |
224 | addr |= RS400_PTE_READABLE; | 224 | entry |= RS400_PTE_READABLE; |
225 | if (flags & RADEON_GART_PAGE_WRITE) | 225 | if (flags & RADEON_GART_PAGE_WRITE) |
226 | addr |= RS400_PTE_WRITEABLE; | 226 | entry |= RS400_PTE_WRITEABLE; |
227 | if (!(flags & RADEON_GART_PAGE_SNOOP)) | 227 | if (!(flags & RADEON_GART_PAGE_SNOOP)) |
228 | entry |= RS400_PTE_UNSNOOPED; | 228 | entry |= RS400_PTE_UNSNOOPED; |
229 | entry = cpu_to_le32(entry); | 229 | entry = cpu_to_le32(entry); |
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index ef93156a69c6..b22968c08d1f 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
@@ -298,7 +298,6 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi) | |||
298 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); | 298 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); |
299 | 299 | ||
300 | val = frame[0xC]; | 300 | val = frame[0xC]; |
301 | val |= frame[0xD] << 8; | ||
302 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); | 301 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); |
303 | 302 | ||
304 | /* Enable transmission slot for AVI infoframe | 303 | /* Enable transmission slot for AVI infoframe |
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 6866448083b2..37ac7b5dbd06 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c | |||
@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain * | |||
660 | } | 660 | } |
661 | EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); | 661 | EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); |
662 | 662 | ||
663 | void vga_switcheroo_fini_domain_pm_ops(struct device *dev) | ||
664 | { | ||
665 | dev->pm_domain = NULL; | ||
666 | } | ||
667 | EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops); | ||
668 | |||
663 | static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) | 669 | static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) |
664 | { | 670 | { |
665 | struct pci_dev *pdev = to_pci_dev(dev); | 671 | struct pci_dev *pdev = to_pci_dev(dev); |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index d2077f040f3e..77711623b973 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
42 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/screen_info.h> | ||
44 | 45 | ||
45 | #include <linux/uaccess.h> | 46 | #include <linux/uaccess.h> |
46 | 47 | ||
@@ -112,10 +113,8 @@ both: | |||
112 | return 1; | 113 | return 1; |
113 | } | 114 | } |
114 | 115 | ||
115 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
116 | /* this is only used a cookie - it should not be dereferenced */ | 116 | /* this is only used a cookie - it should not be dereferenced */ |
117 | static struct pci_dev *vga_default; | 117 | static struct pci_dev *vga_default; |
118 | #endif | ||
119 | 118 | ||
120 | static void vga_arb_device_card_gone(struct pci_dev *pdev); | 119 | static void vga_arb_device_card_gone(struct pci_dev *pdev); |
121 | 120 | ||
@@ -131,7 +130,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev) | |||
131 | } | 130 | } |
132 | 131 | ||
133 | /* Returns the default VGA device (vgacon's babe) */ | 132 | /* Returns the default VGA device (vgacon's babe) */ |
134 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
135 | struct pci_dev *vga_default_device(void) | 133 | struct pci_dev *vga_default_device(void) |
136 | { | 134 | { |
137 | return vga_default; | 135 | return vga_default; |
@@ -147,7 +145,6 @@ void vga_set_default_device(struct pci_dev *pdev) | |||
147 | pci_dev_put(vga_default); | 145 | pci_dev_put(vga_default); |
148 | vga_default = pci_dev_get(pdev); | 146 | vga_default = pci_dev_get(pdev); |
149 | } | 147 | } |
150 | #endif | ||
151 | 148 | ||
152 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) | 149 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) |
153 | { | 150 | { |
@@ -583,11 +580,12 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) | |||
583 | /* Deal with VGA default device. Use first enabled one | 580 | /* Deal with VGA default device. Use first enabled one |
584 | * by default if arch doesn't have it's own hook | 581 | * by default if arch doesn't have it's own hook |
585 | */ | 582 | */ |
586 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
587 | if (vga_default == NULL && | 583 | if (vga_default == NULL && |
588 | ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) | 584 | ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) { |
585 | pr_info("vgaarb: setting as boot device: PCI:%s\n", | ||
586 | pci_name(pdev)); | ||
589 | vga_set_default_device(pdev); | 587 | vga_set_default_device(pdev); |
590 | #endif | 588 | } |
591 | 589 | ||
592 | vga_arbiter_check_bridge_sharing(vgadev); | 590 | vga_arbiter_check_bridge_sharing(vgadev); |
593 | 591 | ||
@@ -621,10 +619,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev) | |||
621 | goto bail; | 619 | goto bail; |
622 | } | 620 | } |
623 | 621 | ||
624 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
625 | if (vga_default == pdev) | 622 | if (vga_default == pdev) |
626 | vga_set_default_device(NULL); | 623 | vga_set_default_device(NULL); |
627 | #endif | ||
628 | 624 | ||
629 | if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) | 625 | if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) |
630 | vga_decode_count--; | 626 | vga_decode_count--; |
@@ -1320,6 +1316,38 @@ static int __init vga_arb_device_init(void) | |||
1320 | pr_info("vgaarb: loaded\n"); | 1316 | pr_info("vgaarb: loaded\n"); |
1321 | 1317 | ||
1322 | list_for_each_entry(vgadev, &vga_list, list) { | 1318 | list_for_each_entry(vgadev, &vga_list, list) { |
1319 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1320 | /* Override I/O based detection done by vga_arbiter_add_pci_device() | ||
1321 | * as it may take the wrong device (e.g. on Apple system under EFI). | ||
1322 | * | ||
1323 | * Select the device owning the boot framebuffer if there is one. | ||
1324 | */ | ||
1325 | resource_size_t start, end; | ||
1326 | int i; | ||
1327 | |||
1328 | /* Does firmware framebuffer belong to us? */ | ||
1329 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
1330 | if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM)) | ||
1331 | continue; | ||
1332 | |||
1333 | start = pci_resource_start(vgadev->pdev, i); | ||
1334 | end = pci_resource_end(vgadev->pdev, i); | ||
1335 | |||
1336 | if (!start || !end) | ||
1337 | continue; | ||
1338 | |||
1339 | if (screen_info.lfb_base < start || | ||
1340 | (screen_info.lfb_base + screen_info.lfb_size) >= end) | ||
1341 | continue; | ||
1342 | if (!vga_default_device()) | ||
1343 | pr_info("vgaarb: setting as boot device: PCI:%s\n", | ||
1344 | pci_name(vgadev->pdev)); | ||
1345 | else if (vgadev->pdev != vga_default_device()) | ||
1346 | pr_info("vgaarb: overriding boot device: PCI:%s\n", | ||
1347 | pci_name(vgadev->pdev)); | ||
1348 | vga_set_default_device(vgadev->pdev); | ||
1349 | } | ||
1350 | #endif | ||
1323 | if (vgadev->bridge_has_one_vga) | 1351 | if (vgadev->bridge_has_one_vga) |
1324 | pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); | 1352 | pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); |
1325 | else | 1353 | else |
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index a077cc86421b..19100fddd2ed 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c | |||
@@ -571,7 +571,7 @@ static int bma180_probe(struct i2c_client *client, | |||
571 | trig->ops = &bma180_trigger_ops; | 571 | trig->ops = &bma180_trigger_ops; |
572 | iio_trigger_set_drvdata(trig, indio_dev); | 572 | iio_trigger_set_drvdata(trig, indio_dev); |
573 | data->trig = trig; | 573 | data->trig = trig; |
574 | indio_dev->trig = trig; | 574 | indio_dev->trig = iio_trigger_get(trig); |
575 | 575 | ||
576 | ret = iio_trigger_register(trig); | 576 | ret = iio_trigger_register(trig); |
577 | if (ret) | 577 | if (ret) |
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index c55b81f7f970..d10bd0c97233 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c | |||
@@ -472,7 +472,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev) | |||
472 | goto error_free_irq; | 472 | goto error_free_irq; |
473 | 473 | ||
474 | /* select default trigger */ | 474 | /* select default trigger */ |
475 | indio_dev->trig = sigma_delta->trig; | 475 | indio_dev->trig = iio_trigger_get(sigma_delta->trig); |
476 | 476 | ||
477 | return 0; | 477 | return 0; |
478 | 478 | ||
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 772e869c280e..7eadaf16adc1 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -196,6 +196,7 @@ struct at91_adc_state { | |||
196 | bool done; | 196 | bool done; |
197 | int irq; | 197 | int irq; |
198 | u16 last_value; | 198 | u16 last_value; |
199 | int chnb; | ||
199 | struct mutex lock; | 200 | struct mutex lock; |
200 | u8 num_channels; | 201 | u8 num_channels; |
201 | void __iomem *reg_base; | 202 | void __iomem *reg_base; |
@@ -274,7 +275,7 @@ void handle_adc_eoc_trigger(int irq, struct iio_dev *idev) | |||
274 | disable_irq_nosync(irq); | 275 | disable_irq_nosync(irq); |
275 | iio_trigger_poll(idev->trig); | 276 | iio_trigger_poll(idev->trig); |
276 | } else { | 277 | } else { |
277 | st->last_value = at91_adc_readl(st, AT91_ADC_LCDR); | 278 | st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb)); |
278 | st->done = true; | 279 | st->done = true; |
279 | wake_up_interruptible(&st->wq_data_avail); | 280 | wake_up_interruptible(&st->wq_data_avail); |
280 | } | 281 | } |
@@ -351,7 +352,7 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) | |||
351 | unsigned int reg; | 352 | unsigned int reg; |
352 | 353 | ||
353 | status &= at91_adc_readl(st, AT91_ADC_IMR); | 354 | status &= at91_adc_readl(st, AT91_ADC_IMR); |
354 | if (status & st->registers->drdy_mask) | 355 | if (status & GENMASK(st->num_channels - 1, 0)) |
355 | handle_adc_eoc_trigger(irq, idev); | 356 | handle_adc_eoc_trigger(irq, idev); |
356 | 357 | ||
357 | if (status & AT91RL_ADC_IER_PEN) { | 358 | if (status & AT91RL_ADC_IER_PEN) { |
@@ -418,7 +419,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private) | |||
418 | AT91_ADC_IER_YRDY | | 419 | AT91_ADC_IER_YRDY | |
419 | AT91_ADC_IER_PRDY; | 420 | AT91_ADC_IER_PRDY; |
420 | 421 | ||
421 | if (status & st->registers->drdy_mask) | 422 | if (status & GENMASK(st->num_channels - 1, 0)) |
422 | handle_adc_eoc_trigger(irq, idev); | 423 | handle_adc_eoc_trigger(irq, idev); |
423 | 424 | ||
424 | if (status & AT91_ADC_IER_PEN) { | 425 | if (status & AT91_ADC_IER_PEN) { |
@@ -689,9 +690,10 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
689 | case IIO_CHAN_INFO_RAW: | 690 | case IIO_CHAN_INFO_RAW: |
690 | mutex_lock(&st->lock); | 691 | mutex_lock(&st->lock); |
691 | 692 | ||
693 | st->chnb = chan->channel; | ||
692 | at91_adc_writel(st, AT91_ADC_CHER, | 694 | at91_adc_writel(st, AT91_ADC_CHER, |
693 | AT91_ADC_CH(chan->channel)); | 695 | AT91_ADC_CH(chan->channel)); |
694 | at91_adc_writel(st, AT91_ADC_IER, st->registers->drdy_mask); | 696 | at91_adc_writel(st, AT91_ADC_IER, BIT(chan->channel)); |
695 | at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); | 697 | at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); |
696 | 698 | ||
697 | ret = wait_event_interruptible_timeout(st->wq_data_avail, | 699 | ret = wait_event_interruptible_timeout(st->wq_data_avail, |
@@ -708,7 +710,7 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
708 | 710 | ||
709 | at91_adc_writel(st, AT91_ADC_CHDR, | 711 | at91_adc_writel(st, AT91_ADC_CHDR, |
710 | AT91_ADC_CH(chan->channel)); | 712 | AT91_ADC_CH(chan->channel)); |
711 | at91_adc_writel(st, AT91_ADC_IDR, st->registers->drdy_mask); | 713 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); |
712 | 714 | ||
713 | st->last_value = 0; | 715 | st->last_value = 0; |
714 | st->done = false; | 716 | st->done = false; |
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index fd2745c62943..626b39749767 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c | |||
@@ -1126,7 +1126,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np, | |||
1126 | chan->address = XADC_REG_VPVN; | 1126 | chan->address = XADC_REG_VPVN; |
1127 | } else { | 1127 | } else { |
1128 | chan->scan_index = 15 + reg; | 1128 | chan->scan_index = 15 + reg; |
1129 | chan->scan_index = XADC_REG_VAUX(reg - 1); | 1129 | chan->address = XADC_REG_VAUX(reg - 1); |
1130 | } | 1130 | } |
1131 | num_channels++; | 1131 | num_channels++; |
1132 | chan++; | 1132 | chan++; |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index a3109a6f4d86..92068cdbf8c7 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -122,7 +122,8 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, | |||
122 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); | 122 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); |
123 | goto error_free_trig; | 123 | goto error_free_trig; |
124 | } | 124 | } |
125 | indio_dev->trig = attrb->trigger = trig; | 125 | attrb->trigger = trig; |
126 | indio_dev->trig = iio_trigger_get(trig); | ||
126 | 127 | ||
127 | return ret; | 128 | return ret; |
128 | 129 | ||
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c index 8fc3a97eb266..8d8ca6f1e16a 100644 --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c | |||
@@ -49,7 +49,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
49 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); | 49 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); |
50 | goto iio_trigger_register_error; | 50 | goto iio_trigger_register_error; |
51 | } | 51 | } |
52 | indio_dev->trig = sdata->trig; | 52 | indio_dev->trig = iio_trigger_get(sdata->trig); |
53 | 53 | ||
54 | return 0; | 54 | return 0; |
55 | 55 | ||
diff --git a/drivers/iio/gyro/itg3200_buffer.c b/drivers/iio/gyro/itg3200_buffer.c index e3b3c5084070..eef50e91f17c 100644 --- a/drivers/iio/gyro/itg3200_buffer.c +++ b/drivers/iio/gyro/itg3200_buffer.c | |||
@@ -132,7 +132,7 @@ int itg3200_probe_trigger(struct iio_dev *indio_dev) | |||
132 | goto error_free_irq; | 132 | goto error_free_irq; |
133 | 133 | ||
134 | /* select default trigger */ | 134 | /* select default trigger */ |
135 | indio_dev->trig = st->trig; | 135 | indio_dev->trig = iio_trigger_get(st->trig); |
136 | 136 | ||
137 | return 0; | 137 | return 0; |
138 | 138 | ||
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c index 03b9372c1212..926fccea8de0 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | |||
@@ -135,7 +135,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) | |||
135 | ret = iio_trigger_register(st->trig); | 135 | ret = iio_trigger_register(st->trig); |
136 | if (ret) | 136 | if (ret) |
137 | goto error_free_irq; | 137 | goto error_free_irq; |
138 | indio_dev->trig = st->trig; | 138 | indio_dev->trig = iio_trigger_get(st->trig); |
139 | 139 | ||
140 | return 0; | 140 | return 0; |
141 | 141 | ||
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index c7497009d60a..f0846108d006 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -178,7 +178,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
178 | index = of_property_match_string(np, "io-channel-names", | 178 | index = of_property_match_string(np, "io-channel-names", |
179 | name); | 179 | name); |
180 | chan = of_iio_channel_get(np, index); | 180 | chan = of_iio_channel_get(np, index); |
181 | if (!IS_ERR(chan)) | 181 | if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER) |
182 | break; | 182 | break; |
183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index a4b64130ac2f..68cae86dbd29 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
@@ -42,7 +42,8 @@ | |||
42 | #define ST_MAGN_FS_AVL_5600MG 5600 | 42 | #define ST_MAGN_FS_AVL_5600MG 5600 |
43 | #define ST_MAGN_FS_AVL_8000MG 8000 | 43 | #define ST_MAGN_FS_AVL_8000MG 8000 |
44 | #define ST_MAGN_FS_AVL_8100MG 8100 | 44 | #define ST_MAGN_FS_AVL_8100MG 8100 |
45 | #define ST_MAGN_FS_AVL_10000MG 10000 | 45 | #define ST_MAGN_FS_AVL_12000MG 12000 |
46 | #define ST_MAGN_FS_AVL_16000MG 16000 | ||
46 | 47 | ||
47 | /* CUSTOM VALUES FOR SENSOR 1 */ | 48 | /* CUSTOM VALUES FOR SENSOR 1 */ |
48 | #define ST_MAGN_1_WAI_EXP 0x3c | 49 | #define ST_MAGN_1_WAI_EXP 0x3c |
@@ -69,20 +70,20 @@ | |||
69 | #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 | 70 | #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 |
70 | #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 | 71 | #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 |
71 | #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 | 72 | #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 |
72 | #define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100 | 73 | #define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909 |
73 | #define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855 | 74 | #define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169 |
74 | #define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670 | 75 | #define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492 |
75 | #define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450 | 76 | #define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222 |
76 | #define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400 | 77 | #define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500 |
77 | #define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330 | 78 | #define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030 |
78 | #define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230 | 79 | #define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347 |
79 | #define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980 | 80 | #define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020 |
80 | #define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760 | 81 | #define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315 |
81 | #define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600 | 82 | #define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666 |
82 | #define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400 | 83 | #define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500 |
83 | #define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355 | 84 | #define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816 |
84 | #define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295 | 85 | #define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389 |
85 | #define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205 | 86 | #define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878 |
86 | #define ST_MAGN_1_MULTIREAD_BIT false | 87 | #define ST_MAGN_1_MULTIREAD_BIT false |
87 | 88 | ||
88 | /* CUSTOM VALUES FOR SENSOR 2 */ | 89 | /* CUSTOM VALUES FOR SENSOR 2 */ |
@@ -105,10 +106,12 @@ | |||
105 | #define ST_MAGN_2_FS_MASK 0x60 | 106 | #define ST_MAGN_2_FS_MASK 0x60 |
106 | #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 | 107 | #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 |
107 | #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 | 108 | #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 |
108 | #define ST_MAGN_2_FS_AVL_10000_VAL 0x02 | 109 | #define ST_MAGN_2_FS_AVL_12000_VAL 0x02 |
109 | #define ST_MAGN_2_FS_AVL_4000_GAIN 430 | 110 | #define ST_MAGN_2_FS_AVL_16000_VAL 0x03 |
110 | #define ST_MAGN_2_FS_AVL_8000_GAIN 230 | 111 | #define ST_MAGN_2_FS_AVL_4000_GAIN 146 |
111 | #define ST_MAGN_2_FS_AVL_10000_GAIN 230 | 112 | #define ST_MAGN_2_FS_AVL_8000_GAIN 292 |
113 | #define ST_MAGN_2_FS_AVL_12000_GAIN 438 | ||
114 | #define ST_MAGN_2_FS_AVL_16000_GAIN 584 | ||
112 | #define ST_MAGN_2_MULTIREAD_BIT false | 115 | #define ST_MAGN_2_MULTIREAD_BIT false |
113 | #define ST_MAGN_2_OUT_X_L_ADDR 0x28 | 116 | #define ST_MAGN_2_OUT_X_L_ADDR 0x28 |
114 | #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a | 117 | #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a |
@@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = { | |||
266 | .gain = ST_MAGN_2_FS_AVL_8000_GAIN, | 269 | .gain = ST_MAGN_2_FS_AVL_8000_GAIN, |
267 | }, | 270 | }, |
268 | [2] = { | 271 | [2] = { |
269 | .num = ST_MAGN_FS_AVL_10000MG, | 272 | .num = ST_MAGN_FS_AVL_12000MG, |
270 | .value = ST_MAGN_2_FS_AVL_10000_VAL, | 273 | .value = ST_MAGN_2_FS_AVL_12000_VAL, |
271 | .gain = ST_MAGN_2_FS_AVL_10000_GAIN, | 274 | .gain = ST_MAGN_2_FS_AVL_12000_GAIN, |
275 | }, | ||
276 | [3] = { | ||
277 | .num = ST_MAGN_FS_AVL_16000MG, | ||
278 | .value = ST_MAGN_2_FS_AVL_16000_VAL, | ||
279 | .gain = ST_MAGN_2_FS_AVL_16000_GAIN, | ||
272 | }, | 280 | }, |
273 | }, | 281 | }, |
274 | }, | 282 | }, |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index af8256353c7d..162b82c1dde4 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1680,7 +1680,7 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev, | |||
1680 | goto unlock; | 1680 | goto unlock; |
1681 | 1681 | ||
1682 | update_params.smac_index = new_smac_index; | 1682 | update_params.smac_index = new_smac_index; |
1683 | if (mlx4_update_qp(ibdev->dev, &qp->mqp, MLX4_UPDATE_QP_SMAC, | 1683 | if (mlx4_update_qp(ibdev->dev, qp->mqp.qpn, MLX4_UPDATE_QP_SMAC, |
1684 | &update_params)) { | 1684 | &update_params)) { |
1685 | release_mac = new_smac; | 1685 | release_mac = new_smac; |
1686 | goto unlock; | 1686 | goto unlock; |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index efb9eff8906c..836503927dea 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1682,7 +1682,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1682 | MLX4_IB_LINK_TYPE_ETH; | 1682 | MLX4_IB_LINK_TYPE_ETH; |
1683 | if (dev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | 1683 | if (dev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { |
1684 | /* set QP to receive both tunneled & non-tunneled packets */ | 1684 | /* set QP to receive both tunneled & non-tunneled packets */ |
1685 | if (!(context->flags & (1 << MLX4_RSS_QPC_FLAG_OFFSET))) | 1685 | if (!(context->flags & cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET))) |
1686 | context->srqn = cpu_to_be32(7 << 28); | 1686 | context->srqn = cpu_to_be32(7 << 28); |
1687 | } | 1687 | } |
1688 | } | 1688 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 3edce617c31b..d7562beb5423 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -131,6 +131,12 @@ struct ipoib_cb { | |||
131 | u8 hwaddr[INFINIBAND_ALEN]; | 131 | u8 hwaddr[INFINIBAND_ALEN]; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | static inline struct ipoib_cb *ipoib_skb_cb(const struct sk_buff *skb) | ||
135 | { | ||
136 | BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct ipoib_cb)); | ||
137 | return (struct ipoib_cb *)skb->cb; | ||
138 | } | ||
139 | |||
134 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ | 140 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ |
135 | struct ipoib_mcast { | 141 | struct ipoib_mcast { |
136 | struct ib_sa_mcmember_rec mcmember; | 142 | struct ib_sa_mcmember_rec mcmember; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 1310acf6bf92..13e6e0431592 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -716,7 +716,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
716 | { | 716 | { |
717 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 717 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
718 | struct ipoib_neigh *neigh; | 718 | struct ipoib_neigh *neigh; |
719 | struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | 719 | struct ipoib_cb *cb = ipoib_skb_cb(skb); |
720 | struct ipoib_header *header; | 720 | struct ipoib_header *header; |
721 | unsigned long flags; | 721 | unsigned long flags; |
722 | 722 | ||
@@ -813,7 +813,7 @@ static int ipoib_hard_header(struct sk_buff *skb, | |||
813 | const void *daddr, const void *saddr, unsigned len) | 813 | const void *daddr, const void *saddr, unsigned len) |
814 | { | 814 | { |
815 | struct ipoib_header *header; | 815 | struct ipoib_header *header; |
816 | struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | 816 | struct ipoib_cb *cb = ipoib_skb_cb(skb); |
817 | 817 | ||
818 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); | 818 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); |
819 | 819 | ||
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index d4c7928a0f36..da8ff124762a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -586,17 +586,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
586 | init_completion(&isert_conn->conn_wait); | 586 | init_completion(&isert_conn->conn_wait); |
587 | init_completion(&isert_conn->conn_wait_comp_err); | 587 | init_completion(&isert_conn->conn_wait_comp_err); |
588 | kref_init(&isert_conn->conn_kref); | 588 | kref_init(&isert_conn->conn_kref); |
589 | kref_get(&isert_conn->conn_kref); | ||
590 | mutex_init(&isert_conn->conn_mutex); | 589 | mutex_init(&isert_conn->conn_mutex); |
591 | spin_lock_init(&isert_conn->conn_lock); | 590 | spin_lock_init(&isert_conn->conn_lock); |
592 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); | 591 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); |
593 | 592 | ||
594 | cma_id->context = isert_conn; | 593 | cma_id->context = isert_conn; |
595 | isert_conn->conn_cm_id = cma_id; | 594 | isert_conn->conn_cm_id = cma_id; |
596 | isert_conn->responder_resources = event->param.conn.responder_resources; | ||
597 | isert_conn->initiator_depth = event->param.conn.initiator_depth; | ||
598 | pr_debug("Using responder_resources: %u initiator_depth: %u\n", | ||
599 | isert_conn->responder_resources, isert_conn->initiator_depth); | ||
600 | 595 | ||
601 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + | 596 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + |
602 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); | 597 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); |
@@ -643,6 +638,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
643 | goto out_rsp_dma_map; | 638 | goto out_rsp_dma_map; |
644 | } | 639 | } |
645 | 640 | ||
641 | /* Set max inflight RDMA READ requests */ | ||
642 | isert_conn->initiator_depth = min_t(u8, | ||
643 | event->param.conn.initiator_depth, | ||
644 | device->dev_attr.max_qp_init_rd_atom); | ||
645 | pr_debug("Using initiator_depth: %u\n", isert_conn->initiator_depth); | ||
646 | |||
646 | isert_conn->conn_device = device; | 647 | isert_conn->conn_device = device; |
647 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); | 648 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); |
648 | if (IS_ERR(isert_conn->conn_pd)) { | 649 | if (IS_ERR(isert_conn->conn_pd)) { |
@@ -746,7 +747,9 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
746 | static void | 747 | static void |
747 | isert_connected_handler(struct rdma_cm_id *cma_id) | 748 | isert_connected_handler(struct rdma_cm_id *cma_id) |
748 | { | 749 | { |
749 | return; | 750 | struct isert_conn *isert_conn = cma_id->context; |
751 | |||
752 | kref_get(&isert_conn->conn_kref); | ||
750 | } | 753 | } |
751 | 754 | ||
752 | static void | 755 | static void |
@@ -798,7 +801,6 @@ isert_disconnect_work(struct work_struct *work) | |||
798 | 801 | ||
799 | wake_up: | 802 | wake_up: |
800 | complete(&isert_conn->conn_wait); | 803 | complete(&isert_conn->conn_wait); |
801 | isert_put_conn(isert_conn); | ||
802 | } | 804 | } |
803 | 805 | ||
804 | static void | 806 | static void |
@@ -3067,7 +3069,6 @@ isert_rdma_accept(struct isert_conn *isert_conn) | |||
3067 | int ret; | 3069 | int ret; |
3068 | 3070 | ||
3069 | memset(&cp, 0, sizeof(struct rdma_conn_param)); | 3071 | memset(&cp, 0, sizeof(struct rdma_conn_param)); |
3070 | cp.responder_resources = isert_conn->responder_resources; | ||
3071 | cp.initiator_depth = isert_conn->initiator_depth; | 3072 | cp.initiator_depth = isert_conn->initiator_depth; |
3072 | cp.retry_count = 7; | 3073 | cp.retry_count = 7; |
3073 | cp.rnr_retry_count = 7; | 3074 | cp.rnr_retry_count = 7; |
@@ -3215,7 +3216,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3215 | pr_debug("isert_wait_conn: Starting \n"); | 3216 | pr_debug("isert_wait_conn: Starting \n"); |
3216 | 3217 | ||
3217 | mutex_lock(&isert_conn->conn_mutex); | 3218 | mutex_lock(&isert_conn->conn_mutex); |
3218 | if (isert_conn->conn_cm_id) { | 3219 | if (isert_conn->conn_cm_id && !isert_conn->disconnect) { |
3219 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); | 3220 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); |
3220 | rdma_disconnect(isert_conn->conn_cm_id); | 3221 | rdma_disconnect(isert_conn->conn_cm_id); |
3221 | } | 3222 | } |
@@ -3234,6 +3235,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3234 | wait_for_completion(&isert_conn->conn_wait_comp_err); | 3235 | wait_for_completion(&isert_conn->conn_wait_comp_err); |
3235 | 3236 | ||
3236 | wait_for_completion(&isert_conn->conn_wait); | 3237 | wait_for_completion(&isert_conn->conn_wait); |
3238 | isert_put_conn(isert_conn); | ||
3237 | } | 3239 | } |
3238 | 3240 | ||
3239 | static void isert_free_conn(struct iscsi_conn *conn) | 3241 | static void isert_free_conn(struct iscsi_conn *conn) |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 2dd1d0dd4f7d..6f5d79569136 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -1791,14 +1791,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { | |||
1791 | { | 1791 | { |
1792 | .matches = { | 1792 | .matches = { |
1793 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | 1793 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), |
1794 | DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"), | ||
1795 | }, | ||
1796 | .callback = atkbd_deactivate_fixup, | ||
1797 | }, | ||
1798 | { | ||
1799 | .matches = { | ||
1800 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | ||
1801 | DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"), | ||
1802 | }, | 1794 | }, |
1803 | .callback = atkbd_deactivate_fixup, | 1795 | .callback = atkbd_deactivate_fixup, |
1804 | }, | 1796 | }, |
diff --git a/drivers/input/keyboard/cap1106.c b/drivers/input/keyboard/cap1106.c index 180b184ab90f..d70b65a14ced 100644 --- a/drivers/input/keyboard/cap1106.c +++ b/drivers/input/keyboard/cap1106.c | |||
@@ -33,8 +33,8 @@ | |||
33 | #define CAP1106_REG_SENSOR_CONFIG 0x22 | 33 | #define CAP1106_REG_SENSOR_CONFIG 0x22 |
34 | #define CAP1106_REG_SENSOR_CONFIG2 0x23 | 34 | #define CAP1106_REG_SENSOR_CONFIG2 0x23 |
35 | #define CAP1106_REG_SAMPLING_CONFIG 0x24 | 35 | #define CAP1106_REG_SAMPLING_CONFIG 0x24 |
36 | #define CAP1106_REG_CALIBRATION 0x25 | 36 | #define CAP1106_REG_CALIBRATION 0x26 |
37 | #define CAP1106_REG_INT_ENABLE 0x26 | 37 | #define CAP1106_REG_INT_ENABLE 0x27 |
38 | #define CAP1106_REG_REPEAT_RATE 0x28 | 38 | #define CAP1106_REG_REPEAT_RATE 0x28 |
39 | #define CAP1106_REG_MT_CONFIG 0x2a | 39 | #define CAP1106_REG_MT_CONFIG 0x2a |
40 | #define CAP1106_REG_MT_PATTERN_CONFIG 0x2b | 40 | #define CAP1106_REG_MT_PATTERN_CONFIG 0x2b |
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 8d2e19e81e1e..e651fa692afe 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -332,23 +332,24 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev, | |||
332 | } | 332 | } |
333 | 333 | ||
334 | if (pdata->clustered_irq > 0) { | 334 | if (pdata->clustered_irq > 0) { |
335 | err = request_irq(pdata->clustered_irq, | 335 | err = request_any_context_irq(pdata->clustered_irq, |
336 | matrix_keypad_interrupt, | 336 | matrix_keypad_interrupt, |
337 | pdata->clustered_irq_flags, | 337 | pdata->clustered_irq_flags, |
338 | "matrix-keypad", keypad); | 338 | "matrix-keypad", keypad); |
339 | if (err) { | 339 | if (err < 0) { |
340 | dev_err(&pdev->dev, | 340 | dev_err(&pdev->dev, |
341 | "Unable to acquire clustered interrupt\n"); | 341 | "Unable to acquire clustered interrupt\n"); |
342 | goto err_free_rows; | 342 | goto err_free_rows; |
343 | } | 343 | } |
344 | } else { | 344 | } else { |
345 | for (i = 0; i < pdata->num_row_gpios; i++) { | 345 | for (i = 0; i < pdata->num_row_gpios; i++) { |
346 | err = request_irq(gpio_to_irq(pdata->row_gpios[i]), | 346 | err = request_any_context_irq( |
347 | gpio_to_irq(pdata->row_gpios[i]), | ||
347 | matrix_keypad_interrupt, | 348 | matrix_keypad_interrupt, |
348 | IRQF_TRIGGER_RISING | | 349 | IRQF_TRIGGER_RISING | |
349 | IRQF_TRIGGER_FALLING, | 350 | IRQF_TRIGGER_FALLING, |
350 | "matrix-keypad", keypad); | 351 | "matrix-keypad", keypad); |
351 | if (err) { | 352 | if (err < 0) { |
352 | dev_err(&pdev->dev, | 353 | dev_err(&pdev->dev, |
353 | "Unable to acquire interrupt for GPIO line %i\n", | 354 | "Unable to acquire interrupt for GPIO line %i\n", |
354 | pdata->row_gpios[i]); | 355 | pdata->row_gpios[i]); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index a956b980ee73..35a49bf57227 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -2373,6 +2373,10 @@ int alps_init(struct psmouse *psmouse) | |||
2373 | dev2->keybit[BIT_WORD(BTN_LEFT)] = | 2373 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
2374 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 2374 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); |
2375 | 2375 | ||
2376 | __set_bit(INPUT_PROP_POINTER, dev2->propbit); | ||
2377 | if (priv->flags & ALPS_DUALPOINT) | ||
2378 | __set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit); | ||
2379 | |||
2376 | if (input_register_device(priv->dev2)) | 2380 | if (input_register_device(priv->dev2)) |
2377 | goto init_fail; | 2381 | goto init_fail; |
2378 | 2382 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index da51738eb59e..06fc6e76ffbe 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1331,6 +1331,13 @@ static bool elantech_is_signature_valid(const unsigned char *param) | |||
1331 | if (param[1] == 0) | 1331 | if (param[1] == 0) |
1332 | return true; | 1332 | return true; |
1333 | 1333 | ||
1334 | /* | ||
1335 | * Some models have a revision higher then 20. Meaning param[2] may | ||
1336 | * be 10 or 20, skip the rates check for these. | ||
1337 | */ | ||
1338 | if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40) | ||
1339 | return true; | ||
1340 | |||
1334 | for (i = 0; i < ARRAY_SIZE(rates); i++) | 1341 | for (i = 0; i < ARRAY_SIZE(rates); i++) |
1335 | if (param[2] == rates[i]) | 1342 | if (param[2] == rates[i]) |
1336 | return false; | 1343 | return false; |
@@ -1607,6 +1614,10 @@ int elantech_init(struct psmouse *psmouse) | |||
1607 | tp_dev->keybit[BIT_WORD(BTN_LEFT)] = | 1614 | tp_dev->keybit[BIT_WORD(BTN_LEFT)] = |
1608 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | | 1615 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | |
1609 | BIT_MASK(BTN_RIGHT); | 1616 | BIT_MASK(BTN_RIGHT); |
1617 | |||
1618 | __set_bit(INPUT_PROP_POINTER, tp_dev->propbit); | ||
1619 | __set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit); | ||
1620 | |||
1610 | error = input_register_device(etd->tp_dev); | 1621 | error = input_register_device(etd->tp_dev); |
1611 | if (error < 0) | 1622 | if (error < 0) |
1612 | goto init_fail_tp_reg; | 1623 | goto init_fail_tp_reg; |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index cff065f6261c..b4e1f014ddc2 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -670,6 +670,8 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) | |||
670 | __set_bit(REL_X, input_dev->relbit); | 670 | __set_bit(REL_X, input_dev->relbit); |
671 | __set_bit(REL_Y, input_dev->relbit); | 671 | __set_bit(REL_Y, input_dev->relbit); |
672 | 672 | ||
673 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
674 | |||
673 | psmouse->set_rate = psmouse_set_rate; | 675 | psmouse->set_rate = psmouse_set_rate; |
674 | psmouse->set_resolution = psmouse_set_resolution; | 676 | psmouse->set_resolution = psmouse_set_resolution; |
675 | psmouse->poll = psmouse_poll; | 677 | psmouse->poll = psmouse_poll; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index e8573c68f77e..fd23181c1fb7 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -629,10 +629,61 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
629 | ((buf[0] & 0x04) >> 1) | | 629 | ((buf[0] & 0x04) >> 1) | |
630 | ((buf[3] & 0x04) >> 2)); | 630 | ((buf[3] & 0x04) >> 2)); |
631 | 631 | ||
632 | if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
633 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && | ||
634 | hw->w == 2) { | ||
635 | synaptics_parse_agm(buf, priv, hw); | ||
636 | return 1; | ||
637 | } | ||
638 | |||
639 | hw->x = (((buf[3] & 0x10) << 8) | | ||
640 | ((buf[1] & 0x0f) << 8) | | ||
641 | buf[4]); | ||
642 | hw->y = (((buf[3] & 0x20) << 7) | | ||
643 | ((buf[1] & 0xf0) << 4) | | ||
644 | buf[5]); | ||
645 | hw->z = buf[2]; | ||
646 | |||
632 | hw->left = (buf[0] & 0x01) ? 1 : 0; | 647 | hw->left = (buf[0] & 0x01) ? 1 : 0; |
633 | hw->right = (buf[0] & 0x02) ? 1 : 0; | 648 | hw->right = (buf[0] & 0x02) ? 1 : 0; |
634 | 649 | ||
635 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 650 | if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) { |
651 | /* | ||
652 | * ForcePads, like Clickpads, use middle button | ||
653 | * bits to report primary button clicks. | ||
654 | * Unfortunately they report primary button not | ||
655 | * only when user presses on the pad above certain | ||
656 | * threshold, but also when there are more than one | ||
657 | * finger on the touchpad, which interferes with | ||
658 | * out multi-finger gestures. | ||
659 | */ | ||
660 | if (hw->z == 0) { | ||
661 | /* No contacts */ | ||
662 | priv->press = priv->report_press = false; | ||
663 | } else if (hw->w >= 4 && ((buf[0] ^ buf[3]) & 0x01)) { | ||
664 | /* | ||
665 | * Single-finger touch with pressure above | ||
666 | * the threshold. If pressure stays long | ||
667 | * enough, we'll start reporting primary | ||
668 | * button. We rely on the device continuing | ||
669 | * sending data even if finger does not | ||
670 | * move. | ||
671 | */ | ||
672 | if (!priv->press) { | ||
673 | priv->press_start = jiffies; | ||
674 | priv->press = true; | ||
675 | } else if (time_after(jiffies, | ||
676 | priv->press_start + | ||
677 | msecs_to_jiffies(50))) { | ||
678 | priv->report_press = true; | ||
679 | } | ||
680 | } else { | ||
681 | priv->press = false; | ||
682 | } | ||
683 | |||
684 | hw->left = priv->report_press; | ||
685 | |||
686 | } else if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | ||
636 | /* | 687 | /* |
637 | * Clickpad's button is transmitted as middle button, | 688 | * Clickpad's button is transmitted as middle button, |
638 | * however, since it is primary button, we will report | 689 | * however, since it is primary button, we will report |
@@ -651,21 +702,6 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
651 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; | 702 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; |
652 | } | 703 | } |
653 | 704 | ||
654 | if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
655 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && | ||
656 | hw->w == 2) { | ||
657 | synaptics_parse_agm(buf, priv, hw); | ||
658 | return 1; | ||
659 | } | ||
660 | |||
661 | hw->x = (((buf[3] & 0x10) << 8) | | ||
662 | ((buf[1] & 0x0f) << 8) | | ||
663 | buf[4]); | ||
664 | hw->y = (((buf[3] & 0x20) << 7) | | ||
665 | ((buf[1] & 0xf0) << 4) | | ||
666 | buf[5]); | ||
667 | hw->z = buf[2]; | ||
668 | |||
669 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && | 705 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && |
670 | ((buf[0] ^ buf[3]) & 0x02)) { | 706 | ((buf[0] ^ buf[3]) & 0x02)) { |
671 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { | 707 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index e594af0b264b..fb2e076738ae 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -78,6 +78,11 @@ | |||
78 | * 2 0x08 image sensor image sensor tracks 5 fingers, but only | 78 | * 2 0x08 image sensor image sensor tracks 5 fingers, but only |
79 | * reports 2. | 79 | * reports 2. |
80 | * 2 0x20 report min query 0x0f gives min coord reported | 80 | * 2 0x20 report min query 0x0f gives min coord reported |
81 | * 2 0x80 forcepad forcepad is a variant of clickpad that | ||
82 | * does not have physical buttons but rather | ||
83 | * uses pressure above certain threshold to | ||
84 | * report primary clicks. Forcepads also have | ||
85 | * clickpad bit set. | ||
81 | */ | 86 | */ |
82 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ | 87 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
83 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | 88 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ |
@@ -86,6 +91,7 @@ | |||
86 | #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) | 91 | #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) |
87 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) | 92 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) |
88 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) | 93 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) |
94 | #define SYN_CAP_FORCEPAD(ex0c) ((ex0c) & 0x008000) | ||
89 | 95 | ||
90 | /* synaptics modes query bits */ | 96 | /* synaptics modes query bits */ |
91 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) | 97 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) |
@@ -177,6 +183,11 @@ struct synaptics_data { | |||
177 | */ | 183 | */ |
178 | struct synaptics_hw_state agm; | 184 | struct synaptics_hw_state agm; |
179 | bool agm_pending; /* new AGM packet received */ | 185 | bool agm_pending; /* new AGM packet received */ |
186 | |||
187 | /* ForcePad handling */ | ||
188 | unsigned long press_start; | ||
189 | bool press; | ||
190 | bool report_press; | ||
180 | }; | 191 | }; |
181 | 192 | ||
182 | void synaptics_module_init(void); | 193 | void synaptics_module_init(void); |
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c index e122bda16aab..6bcc0189c1c9 100644 --- a/drivers/input/mouse/synaptics_usb.c +++ b/drivers/input/mouse/synaptics_usb.c | |||
@@ -387,6 +387,7 @@ static int synusb_probe(struct usb_interface *intf, | |||
387 | __set_bit(EV_REL, input_dev->evbit); | 387 | __set_bit(EV_REL, input_dev->evbit); |
388 | __set_bit(REL_X, input_dev->relbit); | 388 | __set_bit(REL_X, input_dev->relbit); |
389 | __set_bit(REL_Y, input_dev->relbit); | 389 | __set_bit(REL_Y, input_dev->relbit); |
390 | __set_bit(INPUT_PROP_POINTING_STICK, input_dev->propbit); | ||
390 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0); | 391 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0); |
391 | } else { | 392 | } else { |
392 | input_set_abs_params(input_dev, ABS_X, | 393 | input_set_abs_params(input_dev, ABS_X, |
@@ -401,6 +402,11 @@ static int synusb_probe(struct usb_interface *intf, | |||
401 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | 402 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
402 | } | 403 | } |
403 | 404 | ||
405 | if (synusb->flags & SYNUSB_TOUCHSCREEN) | ||
406 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
407 | else | ||
408 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
409 | |||
404 | __set_bit(BTN_LEFT, input_dev->keybit); | 410 | __set_bit(BTN_LEFT, input_dev->keybit); |
405 | __set_bit(BTN_RIGHT, input_dev->keybit); | 411 | __set_bit(BTN_RIGHT, input_dev->keybit); |
406 | __set_bit(BTN_MIDDLE, input_dev->keybit); | 412 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index ca843b6cf6bd..30c8b6998808 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -393,6 +393,9 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
393 | if ((button_info & 0x0f) >= 3) | 393 | if ((button_info & 0x0f) >= 3) |
394 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 394 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
395 | 395 | ||
396 | __set_bit(INPUT_PROP_POINTER, psmouse->dev->propbit); | ||
397 | __set_bit(INPUT_PROP_POINTING_STICK, psmouse->dev->propbit); | ||
398 | |||
396 | trackpoint_defaults(psmouse->private); | 399 | trackpoint_defaults(psmouse->private); |
397 | 400 | ||
398 | error = trackpoint_power_on_reset(&psmouse->ps2dev); | 401 | error = trackpoint_power_on_reset(&psmouse->ps2dev); |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 136b7b204f56..713e3ddb43bd 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -465,6 +465,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
465 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | 465 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), |
466 | }, | 466 | }, |
467 | }, | 467 | }, |
468 | { | ||
469 | /* Avatar AVIU-145A6 */ | ||
470 | .matches = { | ||
471 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), | ||
472 | DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), | ||
473 | }, | ||
474 | }, | ||
468 | { } | 475 | { } |
469 | }; | 476 | }; |
470 | 477 | ||
@@ -608,6 +615,14 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | |||
608 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | 615 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), |
609 | }, | 616 | }, |
610 | }, | 617 | }, |
618 | { | ||
619 | /* Fujitsu U574 laptop */ | ||
620 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ | ||
621 | .matches = { | ||
622 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
623 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"), | ||
624 | }, | ||
625 | }, | ||
611 | { } | 626 | { } |
612 | }; | 627 | }; |
613 | 628 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 3807c3e971cc..f5a98af3b325 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -1254,6 +1254,8 @@ static int __init i8042_create_aux_port(int idx) | |||
1254 | } else { | 1254 | } else { |
1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); | 1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); |
1256 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); | 1256 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); |
1257 | strlcpy(serio->firmware_id, i8042_aux_firmware_id, | ||
1258 | sizeof(serio->firmware_id)); | ||
1257 | } | 1259 | } |
1258 | 1260 | ||
1259 | port->serio = serio; | 1261 | port->serio = serio; |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 0cb7ef59071b..69175b825346 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/serio.h> | 22 | #include <linux/serio.h> |
23 | #include <linux/tty.h> | 23 | #include <linux/tty.h> |
24 | #include <linux/compat.h> | ||
24 | 25 | ||
25 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 26 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
26 | MODULE_DESCRIPTION("Input device TTY line discipline"); | 27 | MODULE_DESCRIPTION("Input device TTY line discipline"); |
@@ -198,28 +199,55 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u | |||
198 | return 0; | 199 | return 0; |
199 | } | 200 | } |
200 | 201 | ||
202 | static void serport_set_type(struct tty_struct *tty, unsigned long type) | ||
203 | { | ||
204 | struct serport *serport = tty->disc_data; | ||
205 | |||
206 | serport->id.proto = type & 0x000000ff; | ||
207 | serport->id.id = (type & 0x0000ff00) >> 8; | ||
208 | serport->id.extra = (type & 0x00ff0000) >> 16; | ||
209 | } | ||
210 | |||
201 | /* | 211 | /* |
202 | * serport_ldisc_ioctl() allows to set the port protocol, and device ID | 212 | * serport_ldisc_ioctl() allows to set the port protocol, and device ID |
203 | */ | 213 | */ |
204 | 214 | ||
205 | static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) | 215 | static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, |
216 | unsigned int cmd, unsigned long arg) | ||
206 | { | 217 | { |
207 | struct serport *serport = (struct serport*) tty->disc_data; | ||
208 | unsigned long type; | ||
209 | |||
210 | if (cmd == SPIOCSTYPE) { | 218 | if (cmd == SPIOCSTYPE) { |
219 | unsigned long type; | ||
220 | |||
211 | if (get_user(type, (unsigned long __user *) arg)) | 221 | if (get_user(type, (unsigned long __user *) arg)) |
212 | return -EFAULT; | 222 | return -EFAULT; |
213 | 223 | ||
214 | serport->id.proto = type & 0x000000ff; | 224 | serport_set_type(tty, type); |
215 | serport->id.id = (type & 0x0000ff00) >> 8; | 225 | return 0; |
216 | serport->id.extra = (type & 0x00ff0000) >> 16; | 226 | } |
227 | |||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | #ifdef CONFIG_COMPAT | ||
232 | #define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) | ||
233 | static long serport_ldisc_compat_ioctl(struct tty_struct *tty, | ||
234 | struct file *file, | ||
235 | unsigned int cmd, unsigned long arg) | ||
236 | { | ||
237 | if (cmd == COMPAT_SPIOCSTYPE) { | ||
238 | void __user *uarg = compat_ptr(arg); | ||
239 | compat_ulong_t compat_type; | ||
240 | |||
241 | if (get_user(compat_type, (compat_ulong_t __user *)uarg)) | ||
242 | return -EFAULT; | ||
217 | 243 | ||
244 | serport_set_type(tty, compat_type); | ||
218 | return 0; | 245 | return 0; |
219 | } | 246 | } |
220 | 247 | ||
221 | return -EINVAL; | 248 | return -EINVAL; |
222 | } | 249 | } |
250 | #endif | ||
223 | 251 | ||
224 | static void serport_ldisc_write_wakeup(struct tty_struct * tty) | 252 | static void serport_ldisc_write_wakeup(struct tty_struct * tty) |
225 | { | 253 | { |
@@ -243,6 +271,9 @@ static struct tty_ldisc_ops serport_ldisc = { | |||
243 | .close = serport_ldisc_close, | 271 | .close = serport_ldisc_close, |
244 | .read = serport_ldisc_read, | 272 | .read = serport_ldisc_read, |
245 | .ioctl = serport_ldisc_ioctl, | 273 | .ioctl = serport_ldisc_ioctl, |
274 | #ifdef CONFIG_COMPAT | ||
275 | .compat_ioctl = serport_ldisc_compat_ioctl, | ||
276 | #endif | ||
246 | .receive_buf = serport_ldisc_receive, | 277 | .receive_buf = serport_ldisc_receive, |
247 | .write_wakeup = serport_ldisc_write_wakeup | 278 | .write_wakeup = serport_ldisc_write_wakeup |
248 | }; | 279 | }; |
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index db178ed2b47e..aaacf8bfa61f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -837,7 +837,12 @@ static irqreturn_t mxt_process_messages_t44(struct mxt_data *data) | |||
837 | count = data->msg_buf[0]; | 837 | count = data->msg_buf[0]; |
838 | 838 | ||
839 | if (count == 0) { | 839 | if (count == 0) { |
840 | dev_warn(dev, "Interrupt triggered but zero messages\n"); | 840 | /* |
841 | * This condition is caused by the CHG line being configured | ||
842 | * in Mode 0. It results in unnecessary I2C operations but it | ||
843 | * is benign. | ||
844 | */ | ||
845 | dev_dbg(dev, "Interrupt triggered but zero messages\n"); | ||
841 | return IRQ_NONE; | 846 | return IRQ_NONE; |
842 | } else if (count > data->max_reportid) { | 847 | } else if (count > data->max_reportid) { |
843 | dev_err(dev, "T44 count %d exceeded max report id\n", count); | 848 | dev_err(dev, "T44 count %d exceeded max report id\n", count); |
@@ -1374,11 +1379,16 @@ static int mxt_get_info(struct mxt_data *data) | |||
1374 | return 0; | 1379 | return 0; |
1375 | } | 1380 | } |
1376 | 1381 | ||
1377 | static void mxt_free_object_table(struct mxt_data *data) | 1382 | static void mxt_free_input_device(struct mxt_data *data) |
1378 | { | 1383 | { |
1379 | input_unregister_device(data->input_dev); | 1384 | if (data->input_dev) { |
1380 | data->input_dev = NULL; | 1385 | input_unregister_device(data->input_dev); |
1386 | data->input_dev = NULL; | ||
1387 | } | ||
1388 | } | ||
1381 | 1389 | ||
1390 | static void mxt_free_object_table(struct mxt_data *data) | ||
1391 | { | ||
1382 | kfree(data->object_table); | 1392 | kfree(data->object_table); |
1383 | data->object_table = NULL; | 1393 | data->object_table = NULL; |
1384 | kfree(data->msg_buf); | 1394 | kfree(data->msg_buf); |
@@ -1957,11 +1967,13 @@ static int mxt_load_fw(struct device *dev, const char *fn) | |||
1957 | ret = mxt_lookup_bootloader_address(data, 0); | 1967 | ret = mxt_lookup_bootloader_address(data, 0); |
1958 | if (ret) | 1968 | if (ret) |
1959 | goto release_firmware; | 1969 | goto release_firmware; |
1970 | |||
1971 | mxt_free_input_device(data); | ||
1972 | mxt_free_object_table(data); | ||
1960 | } else { | 1973 | } else { |
1961 | enable_irq(data->irq); | 1974 | enable_irq(data->irq); |
1962 | } | 1975 | } |
1963 | 1976 | ||
1964 | mxt_free_object_table(data); | ||
1965 | reinit_completion(&data->bl_completion); | 1977 | reinit_completion(&data->bl_completion); |
1966 | 1978 | ||
1967 | ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false); | 1979 | ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false); |
@@ -2210,6 +2222,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
2210 | return 0; | 2222 | return 0; |
2211 | 2223 | ||
2212 | err_free_object: | 2224 | err_free_object: |
2225 | mxt_free_input_device(data); | ||
2213 | mxt_free_object_table(data); | 2226 | mxt_free_object_table(data); |
2214 | err_free_irq: | 2227 | err_free_irq: |
2215 | free_irq(client->irq, data); | 2228 | free_irq(client->irq, data); |
@@ -2224,7 +2237,7 @@ static int mxt_remove(struct i2c_client *client) | |||
2224 | 2237 | ||
2225 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); | 2238 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); |
2226 | free_irq(data->irq, data); | 2239 | free_irq(data->irq, data); |
2227 | input_unregister_device(data->input_dev); | 2240 | mxt_free_input_device(data); |
2228 | mxt_free_object_table(data); | 2241 | mxt_free_object_table(data); |
2229 | kfree(data); | 2242 | kfree(data); |
2230 | 2243 | ||
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index 16b52115c27f..705ffa1e064a 100644 --- a/drivers/input/touchscreen/wm9712.c +++ b/drivers/input/touchscreen/wm9712.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static int rpu = 8; | 42 | static int rpu = 8; |
43 | module_param(rpu, int, 0); | 43 | module_param(rpu, int, 0); |
44 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | 44 | MODULE_PARM_DESC(rpu, "Set internal pull up resistor for pen detect."); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Set current used for pressure measurement. | 47 | * Set current used for pressure measurement. |
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c index 7405353199d7..572a5a64face 100644 --- a/drivers/input/touchscreen/wm9713.c +++ b/drivers/input/touchscreen/wm9713.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static int rpu = 8; | 42 | static int rpu = 8; |
43 | module_param(rpu, int, 0); | 43 | module_param(rpu, int, 0); |
44 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | 44 | MODULE_PARM_DESC(rpu, "Set internal pull up resistor for pen detect."); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Set current used for pressure measurement. | 47 | * Set current used for pressure measurement. |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index ca18d6d42a9b..a83cc2a2a2ca 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -146,6 +146,8 @@ | |||
146 | #define ID0_CTTW (1 << 14) | 146 | #define ID0_CTTW (1 << 14) |
147 | #define ID0_NUMIRPT_SHIFT 16 | 147 | #define ID0_NUMIRPT_SHIFT 16 |
148 | #define ID0_NUMIRPT_MASK 0xff | 148 | #define ID0_NUMIRPT_MASK 0xff |
149 | #define ID0_NUMSIDB_SHIFT 9 | ||
150 | #define ID0_NUMSIDB_MASK 0xf | ||
149 | #define ID0_NUMSMRG_SHIFT 0 | 151 | #define ID0_NUMSMRG_SHIFT 0 |
150 | #define ID0_NUMSMRG_MASK 0xff | 152 | #define ID0_NUMSMRG_MASK 0xff |
151 | 153 | ||
@@ -524,9 +526,18 @@ static int register_smmu_master(struct arm_smmu_device *smmu, | |||
524 | master->of_node = masterspec->np; | 526 | master->of_node = masterspec->np; |
525 | master->cfg.num_streamids = masterspec->args_count; | 527 | master->cfg.num_streamids = masterspec->args_count; |
526 | 528 | ||
527 | for (i = 0; i < master->cfg.num_streamids; ++i) | 529 | for (i = 0; i < master->cfg.num_streamids; ++i) { |
528 | master->cfg.streamids[i] = masterspec->args[i]; | 530 | u16 streamid = masterspec->args[i]; |
529 | 531 | ||
532 | if (!(smmu->features & ARM_SMMU_FEAT_STREAM_MATCH) && | ||
533 | (streamid >= smmu->num_mapping_groups)) { | ||
534 | dev_err(dev, | ||
535 | "stream ID for master device %s greater than maximum allowed (%d)\n", | ||
536 | masterspec->np->name, smmu->num_mapping_groups); | ||
537 | return -ERANGE; | ||
538 | } | ||
539 | master->cfg.streamids[i] = streamid; | ||
540 | } | ||
530 | return insert_smmu_master(smmu, master); | 541 | return insert_smmu_master(smmu, master); |
531 | } | 542 | } |
532 | 543 | ||
@@ -623,7 +634,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) | |||
623 | 634 | ||
624 | if (fsr & FSR_IGN) | 635 | if (fsr & FSR_IGN) |
625 | dev_err_ratelimited(smmu->dev, | 636 | dev_err_ratelimited(smmu->dev, |
626 | "Unexpected context fault (fsr 0x%u)\n", | 637 | "Unexpected context fault (fsr 0x%x)\n", |
627 | fsr); | 638 | fsr); |
628 | 639 | ||
629 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); | 640 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); |
@@ -752,6 +763,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
752 | reg = (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); | 763 | reg = (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); |
753 | break; | 764 | break; |
754 | case 39: | 765 | case 39: |
766 | case 40: | ||
755 | reg = (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); | 767 | reg = (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); |
756 | break; | 768 | break; |
757 | case 42: | 769 | case 42: |
@@ -773,6 +785,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
773 | reg |= (TTBCR2_ADDR_36 << TTBCR2_PASIZE_SHIFT); | 785 | reg |= (TTBCR2_ADDR_36 << TTBCR2_PASIZE_SHIFT); |
774 | break; | 786 | break; |
775 | case 39: | 787 | case 39: |
788 | case 40: | ||
776 | reg |= (TTBCR2_ADDR_40 << TTBCR2_PASIZE_SHIFT); | 789 | reg |= (TTBCR2_ADDR_40 << TTBCR2_PASIZE_SHIFT); |
777 | break; | 790 | break; |
778 | case 42: | 791 | case 42: |
@@ -843,8 +856,11 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
843 | reg |= TTBCR_EAE | | 856 | reg |= TTBCR_EAE | |
844 | (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | | 857 | (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | |
845 | (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | | 858 | (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | |
846 | (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT) | | 859 | (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT); |
847 | (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); | 860 | |
861 | if (!stage1) | ||
862 | reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); | ||
863 | |||
848 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); | 864 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); |
849 | 865 | ||
850 | /* MAIR0 (stage-1 only) */ | 866 | /* MAIR0 (stage-1 only) */ |
@@ -868,10 +884,15 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
868 | static int arm_smmu_init_domain_context(struct iommu_domain *domain, | 884 | static int arm_smmu_init_domain_context(struct iommu_domain *domain, |
869 | struct arm_smmu_device *smmu) | 885 | struct arm_smmu_device *smmu) |
870 | { | 886 | { |
871 | int irq, ret, start; | 887 | int irq, start, ret = 0; |
888 | unsigned long flags; | ||
872 | struct arm_smmu_domain *smmu_domain = domain->priv; | 889 | struct arm_smmu_domain *smmu_domain = domain->priv; |
873 | struct arm_smmu_cfg *cfg = &smmu_domain->cfg; | 890 | struct arm_smmu_cfg *cfg = &smmu_domain->cfg; |
874 | 891 | ||
892 | spin_lock_irqsave(&smmu_domain->lock, flags); | ||
893 | if (smmu_domain->smmu) | ||
894 | goto out_unlock; | ||
895 | |||
875 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { | 896 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { |
876 | /* | 897 | /* |
877 | * We will likely want to change this if/when KVM gets | 898 | * We will likely want to change this if/when KVM gets |
@@ -890,7 +911,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
890 | ret = __arm_smmu_alloc_bitmap(smmu->context_map, start, | 911 | ret = __arm_smmu_alloc_bitmap(smmu->context_map, start, |
891 | smmu->num_context_banks); | 912 | smmu->num_context_banks); |
892 | if (IS_ERR_VALUE(ret)) | 913 | if (IS_ERR_VALUE(ret)) |
893 | return ret; | 914 | goto out_unlock; |
894 | 915 | ||
895 | cfg->cbndx = ret; | 916 | cfg->cbndx = ret; |
896 | if (smmu->version == 1) { | 917 | if (smmu->version == 1) { |
@@ -900,6 +921,10 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
900 | cfg->irptndx = cfg->cbndx; | 921 | cfg->irptndx = cfg->cbndx; |
901 | } | 922 | } |
902 | 923 | ||
924 | ACCESS_ONCE(smmu_domain->smmu) = smmu; | ||
925 | arm_smmu_init_context_bank(smmu_domain); | ||
926 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
927 | |||
903 | irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; | 928 | irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; |
904 | ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, | 929 | ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, |
905 | "arm-smmu-context-fault", domain); | 930 | "arm-smmu-context-fault", domain); |
@@ -907,15 +932,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
907 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", | 932 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", |
908 | cfg->irptndx, irq); | 933 | cfg->irptndx, irq); |
909 | cfg->irptndx = INVALID_IRPTNDX; | 934 | cfg->irptndx = INVALID_IRPTNDX; |
910 | goto out_free_context; | ||
911 | } | 935 | } |
912 | 936 | ||
913 | smmu_domain->smmu = smmu; | ||
914 | arm_smmu_init_context_bank(smmu_domain); | ||
915 | return 0; | 937 | return 0; |
916 | 938 | ||
917 | out_free_context: | 939 | out_unlock: |
918 | __arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx); | 940 | spin_unlock_irqrestore(&smmu_domain->lock, flags); |
919 | return ret; | 941 | return ret; |
920 | } | 942 | } |
921 | 943 | ||
@@ -975,7 +997,6 @@ static void arm_smmu_free_ptes(pmd_t *pmd) | |||
975 | { | 997 | { |
976 | pgtable_t table = pmd_pgtable(*pmd); | 998 | pgtable_t table = pmd_pgtable(*pmd); |
977 | 999 | ||
978 | pgtable_page_dtor(table); | ||
979 | __free_page(table); | 1000 | __free_page(table); |
980 | } | 1001 | } |
981 | 1002 | ||
@@ -1108,6 +1129,9 @@ static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu, | |||
1108 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | 1129 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); |
1109 | struct arm_smmu_smr *smrs = cfg->smrs; | 1130 | struct arm_smmu_smr *smrs = cfg->smrs; |
1110 | 1131 | ||
1132 | if (!smrs) | ||
1133 | return; | ||
1134 | |||
1111 | /* Invalidate the SMRs before freeing back to the allocator */ | 1135 | /* Invalidate the SMRs before freeing back to the allocator */ |
1112 | for (i = 0; i < cfg->num_streamids; ++i) { | 1136 | for (i = 0; i < cfg->num_streamids; ++i) { |
1113 | u8 idx = smrs[i].idx; | 1137 | u8 idx = smrs[i].idx; |
@@ -1120,20 +1144,6 @@ static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu, | |||
1120 | kfree(smrs); | 1144 | kfree(smrs); |
1121 | } | 1145 | } |
1122 | 1146 | ||
1123 | static void arm_smmu_bypass_stream_mapping(struct arm_smmu_device *smmu, | ||
1124 | struct arm_smmu_master_cfg *cfg) | ||
1125 | { | ||
1126 | int i; | ||
1127 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | ||
1128 | |||
1129 | for (i = 0; i < cfg->num_streamids; ++i) { | ||
1130 | u16 sid = cfg->streamids[i]; | ||
1131 | |||
1132 | writel_relaxed(S2CR_TYPE_BYPASS, | ||
1133 | gr0_base + ARM_SMMU_GR0_S2CR(sid)); | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, | 1147 | static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, |
1138 | struct arm_smmu_master_cfg *cfg) | 1148 | struct arm_smmu_master_cfg *cfg) |
1139 | { | 1149 | { |
@@ -1160,23 +1170,30 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, | |||
1160 | static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, | 1170 | static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, |
1161 | struct arm_smmu_master_cfg *cfg) | 1171 | struct arm_smmu_master_cfg *cfg) |
1162 | { | 1172 | { |
1173 | int i; | ||
1163 | struct arm_smmu_device *smmu = smmu_domain->smmu; | 1174 | struct arm_smmu_device *smmu = smmu_domain->smmu; |
1175 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | ||
1164 | 1176 | ||
1165 | /* | 1177 | /* |
1166 | * We *must* clear the S2CR first, because freeing the SMR means | 1178 | * We *must* clear the S2CR first, because freeing the SMR means |
1167 | * that it can be re-allocated immediately. | 1179 | * that it can be re-allocated immediately. |
1168 | */ | 1180 | */ |
1169 | arm_smmu_bypass_stream_mapping(smmu, cfg); | 1181 | for (i = 0; i < cfg->num_streamids; ++i) { |
1182 | u32 idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i]; | ||
1183 | |||
1184 | writel_relaxed(S2CR_TYPE_BYPASS, | ||
1185 | gr0_base + ARM_SMMU_GR0_S2CR(idx)); | ||
1186 | } | ||
1187 | |||
1170 | arm_smmu_master_free_smrs(smmu, cfg); | 1188 | arm_smmu_master_free_smrs(smmu, cfg); |
1171 | } | 1189 | } |
1172 | 1190 | ||
1173 | static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | 1191 | static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) |
1174 | { | 1192 | { |
1175 | int ret = -EINVAL; | 1193 | int ret; |
1176 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1194 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1177 | struct arm_smmu_device *smmu; | 1195 | struct arm_smmu_device *smmu, *dom_smmu; |
1178 | struct arm_smmu_master_cfg *cfg; | 1196 | struct arm_smmu_master_cfg *cfg; |
1179 | unsigned long flags; | ||
1180 | 1197 | ||
1181 | smmu = dev_get_master_dev(dev)->archdata.iommu; | 1198 | smmu = dev_get_master_dev(dev)->archdata.iommu; |
1182 | if (!smmu) { | 1199 | if (!smmu) { |
@@ -1188,20 +1205,22 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1188 | * Sanity check the domain. We don't support domains across | 1205 | * Sanity check the domain. We don't support domains across |
1189 | * different SMMUs. | 1206 | * different SMMUs. |
1190 | */ | 1207 | */ |
1191 | spin_lock_irqsave(&smmu_domain->lock, flags); | 1208 | dom_smmu = ACCESS_ONCE(smmu_domain->smmu); |
1192 | if (!smmu_domain->smmu) { | 1209 | if (!dom_smmu) { |
1193 | /* Now that we have a master, we can finalise the domain */ | 1210 | /* Now that we have a master, we can finalise the domain */ |
1194 | ret = arm_smmu_init_domain_context(domain, smmu); | 1211 | ret = arm_smmu_init_domain_context(domain, smmu); |
1195 | if (IS_ERR_VALUE(ret)) | 1212 | if (IS_ERR_VALUE(ret)) |
1196 | goto err_unlock; | 1213 | return ret; |
1197 | } else if (smmu_domain->smmu != smmu) { | 1214 | |
1215 | dom_smmu = smmu_domain->smmu; | ||
1216 | } | ||
1217 | |||
1218 | if (dom_smmu != smmu) { | ||
1198 | dev_err(dev, | 1219 | dev_err(dev, |
1199 | "cannot attach to SMMU %s whilst already attached to domain on SMMU %s\n", | 1220 | "cannot attach to SMMU %s whilst already attached to domain on SMMU %s\n", |
1200 | dev_name(smmu_domain->smmu->dev), | 1221 | dev_name(smmu_domain->smmu->dev), dev_name(smmu->dev)); |
1201 | dev_name(smmu->dev)); | 1222 | return -EINVAL; |
1202 | goto err_unlock; | ||
1203 | } | 1223 | } |
1204 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
1205 | 1224 | ||
1206 | /* Looks ok, so add the device to the domain */ | 1225 | /* Looks ok, so add the device to the domain */ |
1207 | cfg = find_smmu_master_cfg(smmu_domain->smmu, dev); | 1226 | cfg = find_smmu_master_cfg(smmu_domain->smmu, dev); |
@@ -1209,10 +1228,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1209 | return -ENODEV; | 1228 | return -ENODEV; |
1210 | 1229 | ||
1211 | return arm_smmu_domain_add_master(smmu_domain, cfg); | 1230 | return arm_smmu_domain_add_master(smmu_domain, cfg); |
1212 | |||
1213 | err_unlock: | ||
1214 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
1215 | return ret; | ||
1216 | } | 1231 | } |
1217 | 1232 | ||
1218 | static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) | 1233 | static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) |
@@ -1247,10 +1262,6 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, | |||
1247 | return -ENOMEM; | 1262 | return -ENOMEM; |
1248 | 1263 | ||
1249 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); | 1264 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); |
1250 | if (!pgtable_page_ctor(table)) { | ||
1251 | __free_page(table); | ||
1252 | return -ENOMEM; | ||
1253 | } | ||
1254 | pmd_populate(NULL, pmd, table); | 1265 | pmd_populate(NULL, pmd, table); |
1255 | arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); | 1266 | arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); |
1256 | } | 1267 | } |
@@ -1626,7 +1637,7 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) | |||
1626 | 1637 | ||
1627 | /* Mark all SMRn as invalid and all S2CRn as bypass */ | 1638 | /* Mark all SMRn as invalid and all S2CRn as bypass */ |
1628 | for (i = 0; i < smmu->num_mapping_groups; ++i) { | 1639 | for (i = 0; i < smmu->num_mapping_groups; ++i) { |
1629 | writel_relaxed(~SMR_VALID, gr0_base + ARM_SMMU_GR0_SMR(i)); | 1640 | writel_relaxed(0, gr0_base + ARM_SMMU_GR0_SMR(i)); |
1630 | writel_relaxed(S2CR_TYPE_BYPASS, | 1641 | writel_relaxed(S2CR_TYPE_BYPASS, |
1631 | gr0_base + ARM_SMMU_GR0_S2CR(i)); | 1642 | gr0_base + ARM_SMMU_GR0_S2CR(i)); |
1632 | } | 1643 | } |
@@ -1761,6 +1772,9 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1761 | dev_notice(smmu->dev, | 1772 | dev_notice(smmu->dev, |
1762 | "\tstream matching with %u register groups, mask 0x%x", | 1773 | "\tstream matching with %u register groups, mask 0x%x", |
1763 | smmu->num_mapping_groups, mask); | 1774 | smmu->num_mapping_groups, mask); |
1775 | } else { | ||
1776 | smmu->num_mapping_groups = (id >> ID0_NUMSIDB_SHIFT) & | ||
1777 | ID0_NUMSIDB_MASK; | ||
1764 | } | 1778 | } |
1765 | 1779 | ||
1766 | /* ID1 */ | 1780 | /* ID1 */ |
@@ -1794,11 +1808,16 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1794 | * Stage-1 output limited by stage-2 input size due to pgd | 1808 | * Stage-1 output limited by stage-2 input size due to pgd |
1795 | * allocation (PTRS_PER_PGD). | 1809 | * allocation (PTRS_PER_PGD). |
1796 | */ | 1810 | */ |
1811 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { | ||
1797 | #ifdef CONFIG_64BIT | 1812 | #ifdef CONFIG_64BIT |
1798 | smmu->s1_output_size = min_t(unsigned long, VA_BITS, size); | 1813 | smmu->s1_output_size = min_t(unsigned long, VA_BITS, size); |
1799 | #else | 1814 | #else |
1800 | smmu->s1_output_size = min(32UL, size); | 1815 | smmu->s1_output_size = min(32UL, size); |
1801 | #endif | 1816 | #endif |
1817 | } else { | ||
1818 | smmu->s1_output_size = min_t(unsigned long, PHYS_MASK_SHIFT, | ||
1819 | size); | ||
1820 | } | ||
1802 | 1821 | ||
1803 | /* The stage-2 output mask is also applied for bypass */ | 1822 | /* The stage-2 output mask is also applied for bypass */ |
1804 | size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK); | 1823 | size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK); |
@@ -1889,6 +1908,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1889 | smmu->irqs[i] = irq; | 1908 | smmu->irqs[i] = irq; |
1890 | } | 1909 | } |
1891 | 1910 | ||
1911 | err = arm_smmu_device_cfg_probe(smmu); | ||
1912 | if (err) | ||
1913 | return err; | ||
1914 | |||
1892 | i = 0; | 1915 | i = 0; |
1893 | smmu->masters = RB_ROOT; | 1916 | smmu->masters = RB_ROOT; |
1894 | while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", | 1917 | while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", |
@@ -1905,10 +1928,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1905 | } | 1928 | } |
1906 | dev_notice(dev, "registered %d master devices\n", i); | 1929 | dev_notice(dev, "registered %d master devices\n", i); |
1907 | 1930 | ||
1908 | err = arm_smmu_device_cfg_probe(smmu); | ||
1909 | if (err) | ||
1910 | goto out_put_masters; | ||
1911 | |||
1912 | parse_driver_options(smmu); | 1931 | parse_driver_options(smmu); |
1913 | 1932 | ||
1914 | if (smmu->version > 1 && | 1933 | if (smmu->version > 1 && |
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 60ab474bfff3..06d268abe951 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -678,8 +678,7 @@ static int __init dmar_acpi_dev_scope_init(void) | |||
678 | andd->device_name); | 678 | andd->device_name); |
679 | continue; | 679 | continue; |
680 | } | 680 | } |
681 | acpi_bus_get_device(h, &adev); | 681 | if (acpi_bus_get_device(h, &adev)) { |
682 | if (!adev) { | ||
683 | pr_err("Failed to get device for ACPI object %s\n", | 682 | pr_err("Failed to get device for ACPI object %s\n", |
684 | andd->device_name); | 683 | andd->device_name); |
685 | continue; | 684 | continue; |
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 61d1dafa242d..56feed7cec15 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
@@ -984,7 +984,7 @@ static int fsl_pamu_add_device(struct device *dev) | |||
984 | struct iommu_group *group = ERR_PTR(-ENODEV); | 984 | struct iommu_group *group = ERR_PTR(-ENODEV); |
985 | struct pci_dev *pdev; | 985 | struct pci_dev *pdev; |
986 | const u32 *prop; | 986 | const u32 *prop; |
987 | int ret, len; | 987 | int ret = 0, len; |
988 | 988 | ||
989 | /* | 989 | /* |
990 | * For platform devices we allocate a separate group for | 990 | * For platform devices we allocate a separate group for |
@@ -1007,7 +1007,13 @@ static int fsl_pamu_add_device(struct device *dev) | |||
1007 | if (IS_ERR(group)) | 1007 | if (IS_ERR(group)) |
1008 | return PTR_ERR(group); | 1008 | return PTR_ERR(group); |
1009 | 1009 | ||
1010 | ret = iommu_group_add_device(group, dev); | 1010 | /* |
1011 | * Check if device has already been added to an iommu group. | ||
1012 | * Group could have already been created for a PCI device in | ||
1013 | * the iommu_group_get_for_dev path. | ||
1014 | */ | ||
1015 | if (!dev->iommu_group) | ||
1016 | ret = iommu_group_add_device(group, dev); | ||
1011 | 1017 | ||
1012 | iommu_group_put(group); | 1018 | iommu_group_put(group); |
1013 | return ret; | 1019 | return ret; |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ac4adb337038..0639b9274b11 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -678,15 +678,17 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev) | |||
678 | */ | 678 | */ |
679 | struct iommu_group *iommu_group_get_for_dev(struct device *dev) | 679 | struct iommu_group *iommu_group_get_for_dev(struct device *dev) |
680 | { | 680 | { |
681 | struct iommu_group *group = ERR_PTR(-EIO); | 681 | struct iommu_group *group; |
682 | int ret; | 682 | int ret; |
683 | 683 | ||
684 | group = iommu_group_get(dev); | 684 | group = iommu_group_get(dev); |
685 | if (group) | 685 | if (group) |
686 | return group; | 686 | return group; |
687 | 687 | ||
688 | if (dev_is_pci(dev)) | 688 | if (!dev_is_pci(dev)) |
689 | group = iommu_group_get_for_pci_dev(to_pci_dev(dev)); | 689 | return ERR_PTR(-EINVAL); |
690 | |||
691 | group = iommu_group_get_for_pci_dev(to_pci_dev(dev)); | ||
690 | 692 | ||
691 | if (IS_ERR(group)) | 693 | if (IS_ERR(group)) |
692 | return group; | 694 | return group; |
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c index f8636a650cf6..5945223b73fa 100644 --- a/drivers/irqchip/exynos-combiner.c +++ b/drivers/irqchip/exynos-combiner.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | #include <linux/irqchip/chained_irq.h> | 17 | #include <linux/irqchip/chained_irq.h> |
18 | #include <linux/interrupt.h> | ||
18 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
19 | #include <linux/of_irq.h> | 20 | #include <linux/of_irq.h> |
20 | 21 | ||
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 85c2985d8bcb..bbbaf5de65d2 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c | |||
@@ -220,7 +220,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
220 | of_property_read_u32_index(node, | 220 | of_property_read_u32_index(node, |
221 | "ti,irqs-reserved", | 221 | "ti,irqs-reserved", |
222 | i, &entry); | 222 | i, &entry); |
223 | if (entry > max) { | 223 | if (entry >= max) { |
224 | pr_err("Invalid reserved entry\n"); | 224 | pr_err("Invalid reserved entry\n"); |
225 | ret = -EINVAL; | 225 | ret = -EINVAL; |
226 | goto err_irq_map; | 226 | goto err_irq_map; |
@@ -238,7 +238,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
238 | of_property_read_u32_index(node, | 238 | of_property_read_u32_index(node, |
239 | "ti,irqs-skip", | 239 | "ti,irqs-skip", |
240 | i, &entry); | 240 | i, &entry); |
241 | if (entry > max) { | 241 | if (entry >= max) { |
242 | pr_err("Invalid skip entry\n"); | 242 | pr_err("Invalid skip entry\n"); |
243 | ret = -EINVAL; | 243 | ret = -EINVAL; |
244 | goto err_irq_map; | 244 | goto err_irq_map; |
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 57eaa5a0b1e3..a0698b4f0303 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c | |||
@@ -36,7 +36,7 @@ | |||
36 | struct gic_chip_data { | 36 | struct gic_chip_data { |
37 | void __iomem *dist_base; | 37 | void __iomem *dist_base; |
38 | void __iomem **redist_base; | 38 | void __iomem **redist_base; |
39 | void __percpu __iomem **rdist; | 39 | void __iomem * __percpu *rdist; |
40 | struct irq_domain *domain; | 40 | struct irq_domain *domain; |
41 | u64 redist_stride; | 41 | u64 redist_stride; |
42 | u32 redist_regions; | 42 | u32 redist_regions; |
@@ -104,7 +104,7 @@ static void gic_redist_wait_for_rwp(void) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /* Low level accessors */ | 106 | /* Low level accessors */ |
107 | static u64 gic_read_iar(void) | 107 | static u64 __maybe_unused gic_read_iar(void) |
108 | { | 108 | { |
109 | u64 irqstat; | 109 | u64 irqstat; |
110 | 110 | ||
@@ -112,24 +112,24 @@ static u64 gic_read_iar(void) | |||
112 | return irqstat; | 112 | return irqstat; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void gic_write_pmr(u64 val) | 115 | static void __maybe_unused gic_write_pmr(u64 val) |
116 | { | 116 | { |
117 | asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val)); | 117 | asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val)); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void gic_write_ctlr(u64 val) | 120 | static void __maybe_unused gic_write_ctlr(u64 val) |
121 | { | 121 | { |
122 | asm volatile("msr_s " __stringify(ICC_CTLR_EL1) ", %0" : : "r" (val)); | 122 | asm volatile("msr_s " __stringify(ICC_CTLR_EL1) ", %0" : : "r" (val)); |
123 | isb(); | 123 | isb(); |
124 | } | 124 | } |
125 | 125 | ||
126 | static void gic_write_grpen1(u64 val) | 126 | static void __maybe_unused gic_write_grpen1(u64 val) |
127 | { | 127 | { |
128 | asm volatile("msr_s " __stringify(ICC_GRPEN1_EL1) ", %0" : : "r" (val)); | 128 | asm volatile("msr_s " __stringify(ICC_GRPEN1_EL1) ", %0" : : "r" (val)); |
129 | isb(); | 129 | isb(); |
130 | } | 130 | } |
131 | 131 | ||
132 | static void gic_write_sgi1r(u64 val) | 132 | static void __maybe_unused gic_write_sgi1r(u64 val) |
133 | { | 133 | { |
134 | asm volatile("msr_s " __stringify(ICC_SGI1R_EL1) ", %0" : : "r" (val)); | 134 | asm volatile("msr_s " __stringify(ICC_SGI1R_EL1) ", %0" : : "r" (val)); |
135 | } | 135 | } |
@@ -200,19 +200,6 @@ static void gic_poke_irq(struct irq_data *d, u32 offset) | |||
200 | rwp_wait(); | 200 | rwp_wait(); |
201 | } | 201 | } |
202 | 202 | ||
203 | static int gic_peek_irq(struct irq_data *d, u32 offset) | ||
204 | { | ||
205 | u32 mask = 1 << (gic_irq(d) % 32); | ||
206 | void __iomem *base; | ||
207 | |||
208 | if (gic_irq_in_rdist(d)) | ||
209 | base = gic_data_rdist_sgi_base(); | ||
210 | else | ||
211 | base = gic_data.dist_base; | ||
212 | |||
213 | return !!(readl_relaxed(base + offset + (gic_irq(d) / 32) * 4) & mask); | ||
214 | } | ||
215 | |||
216 | static void gic_mask_irq(struct irq_data *d) | 203 | static void gic_mask_irq(struct irq_data *d) |
217 | { | 204 | { |
218 | gic_poke_irq(d, GICD_ICENABLER); | 205 | gic_poke_irq(d, GICD_ICENABLER); |
@@ -401,6 +388,19 @@ static void gic_cpu_init(void) | |||
401 | } | 388 | } |
402 | 389 | ||
403 | #ifdef CONFIG_SMP | 390 | #ifdef CONFIG_SMP |
391 | static int gic_peek_irq(struct irq_data *d, u32 offset) | ||
392 | { | ||
393 | u32 mask = 1 << (gic_irq(d) % 32); | ||
394 | void __iomem *base; | ||
395 | |||
396 | if (gic_irq_in_rdist(d)) | ||
397 | base = gic_data_rdist_sgi_base(); | ||
398 | else | ||
399 | base = gic_data.dist_base; | ||
400 | |||
401 | return !!(readl_relaxed(base + offset + (gic_irq(d) / 32) * 4) & mask); | ||
402 | } | ||
403 | |||
404 | static int gic_secondary_init(struct notifier_block *nfb, | 404 | static int gic_secondary_init(struct notifier_block *nfb, |
405 | unsigned long action, void *hcpu) | 405 | unsigned long action, void *hcpu) |
406 | { | 406 | { |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 4b959e606fe8..dda6dbc23565 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -867,7 +867,7 @@ static int gic_routable_irq_domain_xlate(struct irq_domain *d, | |||
867 | return 0; | 867 | return 0; |
868 | } | 868 | } |
869 | 869 | ||
870 | const struct irq_domain_ops gic_default_routable_irq_domain_ops = { | 870 | static const struct irq_domain_ops gic_default_routable_irq_domain_ops = { |
871 | .map = gic_routable_irq_domain_map, | 871 | .map = gic_routable_irq_domain_map, |
872 | .unmap = gic_routable_irq_domain_unmap, | 872 | .unmap = gic_routable_irq_domain_unmap, |
873 | .xlate = gic_routable_irq_domain_xlate, | 873 | .xlate = gic_routable_irq_domain_xlate, |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1af40ee209e2..7130505c2425 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -895,8 +895,8 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) | |||
895 | struct cache *cache = mg->cache; | 895 | struct cache *cache = mg->cache; |
896 | 896 | ||
897 | if (mg->writeback) { | 897 | if (mg->writeback) { |
898 | cell_defer(cache, mg->old_ocell, false); | ||
899 | clear_dirty(cache, mg->old_oblock, mg->cblock); | 898 | clear_dirty(cache, mg->old_oblock, mg->cblock); |
899 | cell_defer(cache, mg->old_ocell, false); | ||
900 | cleanup_migration(mg); | 900 | cleanup_migration(mg); |
901 | return; | 901 | return; |
902 | 902 | ||
@@ -951,13 +951,13 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) | |||
951 | } | 951 | } |
952 | 952 | ||
953 | } else { | 953 | } else { |
954 | clear_dirty(cache, mg->new_oblock, mg->cblock); | ||
954 | if (mg->requeue_holder) | 955 | if (mg->requeue_holder) |
955 | cell_defer(cache, mg->new_ocell, true); | 956 | cell_defer(cache, mg->new_ocell, true); |
956 | else { | 957 | else { |
957 | bio_endio(mg->new_ocell->holder, 0); | 958 | bio_endio(mg->new_ocell->holder, 0); |
958 | cell_defer(cache, mg->new_ocell, false); | 959 | cell_defer(cache, mg->new_ocell, false); |
959 | } | 960 | } |
960 | clear_dirty(cache, mg->new_oblock, mg->cblock); | ||
961 | cleanup_migration(mg); | 961 | cleanup_migration(mg); |
962 | } | 962 | } |
963 | } | 963 | } |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index f60bad491eb6..3c89fcbc621e 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -182,7 +182,6 @@ config MEDIA_SUBDRV_AUTOSELECT | |||
182 | depends on HAS_IOMEM | 182 | depends on HAS_IOMEM |
183 | select I2C | 183 | select I2C |
184 | select I2C_MUX | 184 | select I2C_MUX |
185 | select SPI | ||
186 | default y | 185 | default y |
187 | help | 186 | help |
188 | By default, a media driver auto-selects all possible ancillary | 187 | By default, a media driver auto-selects all possible ancillary |
diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 5135a096bfa6..12ce19c98ded 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h | |||
@@ -280,6 +280,8 @@ | |||
280 | #define USB_PID_PCTV_400E 0x020f | 280 | #define USB_PID_PCTV_400E 0x020f |
281 | #define USB_PID_PCTV_450E 0x0222 | 281 | #define USB_PID_PCTV_450E 0x0222 |
282 | #define USB_PID_PCTV_452E 0x021f | 282 | #define USB_PID_PCTV_452E 0x021f |
283 | #define USB_PID_PCTV_78E 0x025a | ||
284 | #define USB_PID_PCTV_79E 0x0262 | ||
283 | #define USB_PID_REALTEK_RTL2831U 0x2831 | 285 | #define USB_PID_REALTEK_RTL2831U 0x2831 |
284 | #define USB_PID_REALTEK_RTL2832U 0x2832 | 286 | #define USB_PID_REALTEK_RTL2832U 0x2832 |
285 | #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 | 287 | #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 |
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index be4bec2a9640..5c90ea683a7e 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -314,6 +314,19 @@ static int af9033_init(struct dvb_frontend *fe) | |||
314 | goto err; | 314 | goto err; |
315 | } | 315 | } |
316 | 316 | ||
317 | /* feed clock to RF tuner */ | ||
318 | switch (state->cfg.tuner) { | ||
319 | case AF9033_TUNER_IT9135_38: | ||
320 | case AF9033_TUNER_IT9135_51: | ||
321 | case AF9033_TUNER_IT9135_52: | ||
322 | case AF9033_TUNER_IT9135_60: | ||
323 | case AF9033_TUNER_IT9135_61: | ||
324 | case AF9033_TUNER_IT9135_62: | ||
325 | ret = af9033_wr_reg(state, 0x80fba8, 0x00); | ||
326 | if (ret < 0) | ||
327 | goto err; | ||
328 | } | ||
329 | |||
317 | /* settings for TS interface */ | 330 | /* settings for TS interface */ |
318 | if (state->cfg.ts_mode == AF9033_TS_MODE_USB) { | 331 | if (state->cfg.ts_mode == AF9033_TS_MODE_USB) { |
319 | ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01); | 332 | ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01); |
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h index fc2ad581e302..ded7b67d7526 100644 --- a/drivers/media/dvb-frontends/af9033_priv.h +++ b/drivers/media/dvb-frontends/af9033_priv.h | |||
@@ -1418,7 +1418,7 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1418 | { 0x800068, 0x0a }, | 1418 | { 0x800068, 0x0a }, |
1419 | { 0x80006a, 0x03 }, | 1419 | { 0x80006a, 0x03 }, |
1420 | { 0x800070, 0x0a }, | 1420 | { 0x800070, 0x0a }, |
1421 | { 0x800071, 0x05 }, | 1421 | { 0x800071, 0x0a }, |
1422 | { 0x800072, 0x02 }, | 1422 | { 0x800072, 0x02 }, |
1423 | { 0x800075, 0x8c }, | 1423 | { 0x800075, 0x8c }, |
1424 | { 0x800076, 0x8c }, | 1424 | { 0x800076, 0x8c }, |
@@ -1484,7 +1484,6 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1484 | { 0x800104, 0x02 }, | 1484 | { 0x800104, 0x02 }, |
1485 | { 0x800105, 0xbe }, | 1485 | { 0x800105, 0xbe }, |
1486 | { 0x800106, 0x00 }, | 1486 | { 0x800106, 0x00 }, |
1487 | { 0x800109, 0x02 }, | ||
1488 | { 0x800115, 0x0a }, | 1487 | { 0x800115, 0x0a }, |
1489 | { 0x800116, 0x03 }, | 1488 | { 0x800116, 0x03 }, |
1490 | { 0x80011a, 0xbe }, | 1489 | { 0x80011a, 0xbe }, |
@@ -1510,7 +1509,6 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1510 | { 0x80014b, 0x8c }, | 1509 | { 0x80014b, 0x8c }, |
1511 | { 0x80014d, 0xac }, | 1510 | { 0x80014d, 0xac }, |
1512 | { 0x80014e, 0xc6 }, | 1511 | { 0x80014e, 0xc6 }, |
1513 | { 0x80014f, 0x03 }, | ||
1514 | { 0x800151, 0x1e }, | 1512 | { 0x800151, 0x1e }, |
1515 | { 0x800153, 0xbc }, | 1513 | { 0x800153, 0xbc }, |
1516 | { 0x800178, 0x09 }, | 1514 | { 0x800178, 0x09 }, |
@@ -1522,9 +1520,10 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1522 | { 0x80018d, 0x5f }, | 1520 | { 0x80018d, 0x5f }, |
1523 | { 0x80018f, 0xa0 }, | 1521 | { 0x80018f, 0xa0 }, |
1524 | { 0x800190, 0x5a }, | 1522 | { 0x800190, 0x5a }, |
1525 | { 0x80ed02, 0xff }, | 1523 | { 0x800191, 0x00 }, |
1526 | { 0x80ee42, 0xff }, | 1524 | { 0x80ed02, 0x40 }, |
1527 | { 0x80ee82, 0xff }, | 1525 | { 0x80ee42, 0x40 }, |
1526 | { 0x80ee82, 0x40 }, | ||
1528 | { 0x80f000, 0x0f }, | 1527 | { 0x80f000, 0x0f }, |
1529 | { 0x80f01f, 0x8c }, | 1528 | { 0x80f01f, 0x8c }, |
1530 | { 0x80f020, 0x00 }, | 1529 | { 0x80f020, 0x00 }, |
@@ -1699,7 +1698,6 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1699 | { 0x800104, 0x02 }, | 1698 | { 0x800104, 0x02 }, |
1700 | { 0x800105, 0xc8 }, | 1699 | { 0x800105, 0xc8 }, |
1701 | { 0x800106, 0x00 }, | 1700 | { 0x800106, 0x00 }, |
1702 | { 0x800109, 0x02 }, | ||
1703 | { 0x800115, 0x0a }, | 1701 | { 0x800115, 0x0a }, |
1704 | { 0x800116, 0x03 }, | 1702 | { 0x800116, 0x03 }, |
1705 | { 0x80011a, 0xc6 }, | 1703 | { 0x80011a, 0xc6 }, |
@@ -1725,7 +1723,6 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1725 | { 0x80014b, 0x8c }, | 1723 | { 0x80014b, 0x8c }, |
1726 | { 0x80014d, 0xa8 }, | 1724 | { 0x80014d, 0xa8 }, |
1727 | { 0x80014e, 0xc6 }, | 1725 | { 0x80014e, 0xc6 }, |
1728 | { 0x80014f, 0x03 }, | ||
1729 | { 0x800151, 0x28 }, | 1726 | { 0x800151, 0x28 }, |
1730 | { 0x800153, 0xcc }, | 1727 | { 0x800153, 0xcc }, |
1731 | { 0x800178, 0x09 }, | 1728 | { 0x800178, 0x09 }, |
@@ -1737,9 +1734,10 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1737 | { 0x80018d, 0x5f }, | 1734 | { 0x80018d, 0x5f }, |
1738 | { 0x80018f, 0xfb }, | 1735 | { 0x80018f, 0xfb }, |
1739 | { 0x800190, 0x5c }, | 1736 | { 0x800190, 0x5c }, |
1740 | { 0x80ed02, 0xff }, | 1737 | { 0x800191, 0x00 }, |
1741 | { 0x80ee42, 0xff }, | 1738 | { 0x80ed02, 0x40 }, |
1742 | { 0x80ee82, 0xff }, | 1739 | { 0x80ee42, 0x40 }, |
1740 | { 0x80ee82, 0x40 }, | ||
1743 | { 0x80f000, 0x0f }, | 1741 | { 0x80f000, 0x0f }, |
1744 | { 0x80f01f, 0x8c }, | 1742 | { 0x80f01f, 0x8c }, |
1745 | { 0x80f020, 0x00 }, | 1743 | { 0x80f020, 0x00 }, |
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 1eaf975d3612..62acb10630f9 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
@@ -1282,19 +1282,12 @@ static int smiapp_set_power(struct v4l2_subdev *subdev, int on) | |||
1282 | 1282 | ||
1283 | mutex_lock(&sensor->power_mutex); | 1283 | mutex_lock(&sensor->power_mutex); |
1284 | 1284 | ||
1285 | /* | 1285 | if (on && !sensor->power_count) { |
1286 | * If the power count is modified from 0 to != 0 or from != 0 | ||
1287 | * to 0, update the power state. | ||
1288 | */ | ||
1289 | if (!sensor->power_count == !on) | ||
1290 | goto out; | ||
1291 | |||
1292 | if (on) { | ||
1293 | /* Power on and perform initialisation. */ | 1286 | /* Power on and perform initialisation. */ |
1294 | ret = smiapp_power_on(sensor); | 1287 | ret = smiapp_power_on(sensor); |
1295 | if (ret < 0) | 1288 | if (ret < 0) |
1296 | goto out; | 1289 | goto out; |
1297 | } else { | 1290 | } else if (!on && sensor->power_count == 1) { |
1298 | smiapp_power_off(sensor); | 1291 | smiapp_power_off(sensor); |
1299 | } | 1292 | } |
1300 | 1293 | ||
@@ -2572,7 +2565,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
2572 | 2565 | ||
2573 | this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; | 2566 | this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; |
2574 | this->sd.internal_ops = &smiapp_internal_ops; | 2567 | this->sd.internal_ops = &smiapp_internal_ops; |
2575 | this->sd.owner = NULL; | 2568 | this->sd.owner = THIS_MODULE; |
2576 | v4l2_set_subdevdata(&this->sd, client); | 2569 | v4l2_set_subdevdata(&this->sd, client); |
2577 | 2570 | ||
2578 | rval = media_entity_init(&this->sd.entity, | 2571 | rval = media_entity_init(&this->sd.entity, |
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 716bdc57fac6..83f5074706f9 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
@@ -1091,6 +1091,7 @@ static int cx18_probe(struct pci_dev *pci_dev, | |||
1091 | setup.addr = ADDR_UNSET; | 1091 | setup.addr = ADDR_UNSET; |
1092 | setup.type = cx->options.tuner; | 1092 | setup.type = cx->options.tuner; |
1093 | setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ | 1093 | setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ |
1094 | setup.config = NULL; | ||
1094 | if (cx->options.radio > 0) | 1095 | if (cx->options.radio > 0) |
1095 | setup.mode_mask |= T_RADIO; | 1096 | setup.mode_mask |= T_RADIO; |
1096 | setup.tuner_callback = (setup.type == TUNER_XC2028) ? | 1097 | setup.tuner_callback = (setup.type == TUNER_XC2028) ? |
diff --git a/drivers/media/tuners/tuner_it913x.c b/drivers/media/tuners/tuner_it913x.c index 6f30d7e535b8..3d83c425bccf 100644 --- a/drivers/media/tuners/tuner_it913x.c +++ b/drivers/media/tuners/tuner_it913x.c | |||
@@ -396,6 +396,7 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, | |||
396 | struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config) | 396 | struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config) |
397 | { | 397 | { |
398 | struct it913x_state *state = NULL; | 398 | struct it913x_state *state = NULL; |
399 | int ret; | ||
399 | 400 | ||
400 | /* allocate memory for the internal state */ | 401 | /* allocate memory for the internal state */ |
401 | state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); | 402 | state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); |
@@ -425,6 +426,11 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, | |||
425 | state->tuner_type = config; | 426 | state->tuner_type = config; |
426 | state->firmware_ver = 1; | 427 | state->firmware_ver = 1; |
427 | 428 | ||
429 | /* tuner RF initial */ | ||
430 | ret = it913x_wr_reg(state, PRO_DMOD, 0xec4c, 0x68); | ||
431 | if (ret < 0) | ||
432 | goto error; | ||
433 | |||
428 | fe->tuner_priv = state; | 434 | fe->tuner_priv = state; |
429 | memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, | 435 | memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, |
430 | sizeof(struct dvb_tuner_ops)); | 436 | sizeof(struct dvb_tuner_ops)); |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 75ec1c659fdd..c82beac0e0cb 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -1575,6 +1575,10 @@ static const struct usb_device_id af9035_id_table[] = { | |||
1575 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, | 1575 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, |
1576 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, | 1576 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, |
1577 | &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, | 1577 | &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, |
1578 | { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_78E, | ||
1579 | &af9035_props, "PCTV 78e", RC_MAP_IT913X_V1) }, | ||
1580 | { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_79E, | ||
1581 | &af9035_props, "PCTV 79e", RC_MAP_IT913X_V2) }, | ||
1578 | { } | 1582 | { } |
1579 | }; | 1583 | }; |
1580 | MODULE_DEVICE_TABLE(usb, af9035_id_table); | 1584 | MODULE_DEVICE_TABLE(usb, af9035_id_table); |
diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig index a34a11d2fef2..63ca9841db10 100644 --- a/drivers/message/fusion/Kconfig +++ b/drivers/message/fusion/Kconfig | |||
@@ -29,7 +29,7 @@ config FUSION_SPI | |||
29 | config FUSION_FC | 29 | config FUSION_FC |
30 | tristate "Fusion MPT ScsiHost drivers for FC" | 30 | tristate "Fusion MPT ScsiHost drivers for FC" |
31 | depends on PCI && SCSI | 31 | depends on PCI && SCSI |
32 | select SCSI_FC_ATTRS | 32 | depends on SCSI_FC_ATTRS |
33 | ---help--- | 33 | ---help--- |
34 | SCSI HOST support for a Fiber Channel host adapters. | 34 | SCSI HOST support for a Fiber Channel host adapters. |
35 | 35 | ||
diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 7ffdb589841e..7e1efd5f58f0 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c | |||
@@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context) | |||
79 | u32 jedec_id; | 79 | u32 jedec_id; |
80 | u32 status; | 80 | u32 status; |
81 | 81 | ||
82 | if (fw == NULL) { | ||
83 | dev_err(&spi->dev, "Cannot load firmware, aborting\n"); | ||
84 | return; | ||
85 | } | ||
86 | |||
82 | if (fw->size == 0) { | 87 | if (fw->size == 0) { |
83 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); | 88 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
84 | return; | 89 | return; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 382a389b9bba..53904758d693 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to " | |||
175 | "the same MAC; 0 for none (default), " | 175 | "the same MAC; 0 for none (default), " |
176 | "1 for active, 2 for follow"); | 176 | "1 for active, 2 for follow"); |
177 | module_param(all_slaves_active, int, 0); | 177 | module_param(all_slaves_active, int, 0); |
178 | MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" | 178 | MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface " |
179 | "by setting active flag for all slaves; " | 179 | "by setting active flag for all slaves; " |
180 | "0 for never (default), 1 for always."); | 180 | "0 for never (default), 1 for always."); |
181 | module_param(resend_igmp, int, 0); | 181 | module_param(resend_igmp, int, 0); |
@@ -3531,8 +3531,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev | |||
3531 | else | 3531 | else |
3532 | bond_xmit_slave_id(bond, skb, 0); | 3532 | bond_xmit_slave_id(bond, skb, 0); |
3533 | } else { | 3533 | } else { |
3534 | slave_id = bond_rr_gen_slave_id(bond); | 3534 | int slave_cnt = ACCESS_ONCE(bond->slave_cnt); |
3535 | bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); | 3535 | |
3536 | if (likely(slave_cnt)) { | ||
3537 | slave_id = bond_rr_gen_slave_id(bond); | ||
3538 | bond_xmit_slave_id(bond, skb, slave_id % slave_cnt); | ||
3539 | } else { | ||
3540 | dev_kfree_skb_any(skb); | ||
3541 | } | ||
3536 | } | 3542 | } |
3537 | 3543 | ||
3538 | return NETDEV_TX_OK; | 3544 | return NETDEV_TX_OK; |
@@ -3562,8 +3568,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
3562 | static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) | 3568 | static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) |
3563 | { | 3569 | { |
3564 | struct bonding *bond = netdev_priv(bond_dev); | 3570 | struct bonding *bond = netdev_priv(bond_dev); |
3571 | int slave_cnt = ACCESS_ONCE(bond->slave_cnt); | ||
3565 | 3572 | ||
3566 | bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb) % bond->slave_cnt); | 3573 | if (likely(slave_cnt)) |
3574 | bond_xmit_slave_id(bond, skb, | ||
3575 | bond_xmit_hash(bond, skb) % slave_cnt); | ||
3576 | else | ||
3577 | dev_kfree_skb_any(skb); | ||
3567 | 3578 | ||
3568 | return NETDEV_TX_OK; | 3579 | return NETDEV_TX_OK; |
3569 | } | 3580 | } |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index f07fa89b5fd5..05e1aa090add 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -1123,7 +1123,9 @@ static int at91_open(struct net_device *dev) | |||
1123 | struct at91_priv *priv = netdev_priv(dev); | 1123 | struct at91_priv *priv = netdev_priv(dev); |
1124 | int err; | 1124 | int err; |
1125 | 1125 | ||
1126 | clk_enable(priv->clk); | 1126 | err = clk_prepare_enable(priv->clk); |
1127 | if (err) | ||
1128 | return err; | ||
1127 | 1129 | ||
1128 | /* check or determine and set bittime */ | 1130 | /* check or determine and set bittime */ |
1129 | err = open_candev(dev); | 1131 | err = open_candev(dev); |
@@ -1149,7 +1151,7 @@ static int at91_open(struct net_device *dev) | |||
1149 | out_close: | 1151 | out_close: |
1150 | close_candev(dev); | 1152 | close_candev(dev); |
1151 | out: | 1153 | out: |
1152 | clk_disable(priv->clk); | 1154 | clk_disable_unprepare(priv->clk); |
1153 | 1155 | ||
1154 | return err; | 1156 | return err; |
1155 | } | 1157 | } |
@@ -1166,7 +1168,7 @@ static int at91_close(struct net_device *dev) | |||
1166 | at91_chip_stop(dev, CAN_STATE_STOPPED); | 1168 | at91_chip_stop(dev, CAN_STATE_STOPPED); |
1167 | 1169 | ||
1168 | free_irq(dev->irq, dev); | 1170 | free_irq(dev->irq, dev); |
1169 | clk_disable(priv->clk); | 1171 | clk_disable_unprepare(priv->clk); |
1170 | 1172 | ||
1171 | close_candev(dev); | 1173 | close_candev(dev); |
1172 | 1174 | ||
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index 109cb44291f5..fb279d6ae484 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
@@ -97,14 +97,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable) | |||
97 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); | 97 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); |
98 | writel(ctrl, priv->raminit_ctrlreg); | 98 | writel(ctrl, priv->raminit_ctrlreg); |
99 | ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); | 99 | ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); |
100 | c_can_hw_raminit_wait_ti(priv, ctrl, mask); | 100 | c_can_hw_raminit_wait_ti(priv, mask, ctrl); |
101 | 101 | ||
102 | if (enable) { | 102 | if (enable) { |
103 | /* Set start bit and wait for the done bit. */ | 103 | /* Set start bit and wait for the done bit. */ |
104 | ctrl |= CAN_RAMINIT_START_MASK(priv->instance); | 104 | ctrl |= CAN_RAMINIT_START_MASK(priv->instance); |
105 | writel(ctrl, priv->raminit_ctrlreg); | 105 | writel(ctrl, priv->raminit_ctrlreg); |
106 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); | 106 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); |
107 | c_can_hw_raminit_wait_ti(priv, ctrl, mask); | 107 | c_can_hw_raminit_wait_ti(priv, mask, ctrl); |
108 | } | 108 | } |
109 | spin_unlock(&raminit_lock); | 109 | spin_unlock(&raminit_lock); |
110 | } | 110 | } |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 2700865efcad..60f86bd0434a 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #define FLEXCAN_MCR_BCC BIT(16) | 62 | #define FLEXCAN_MCR_BCC BIT(16) |
63 | #define FLEXCAN_MCR_LPRIO_EN BIT(13) | 63 | #define FLEXCAN_MCR_LPRIO_EN BIT(13) |
64 | #define FLEXCAN_MCR_AEN BIT(12) | 64 | #define FLEXCAN_MCR_AEN BIT(12) |
65 | #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x1f) | 65 | #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x7f) |
66 | #define FLEXCAN_MCR_IDAM_A (0 << 8) | 66 | #define FLEXCAN_MCR_IDAM_A (0 << 8) |
67 | #define FLEXCAN_MCR_IDAM_B (1 << 8) | 67 | #define FLEXCAN_MCR_IDAM_B (1 << 8) |
68 | #define FLEXCAN_MCR_IDAM_C (2 << 8) | 68 | #define FLEXCAN_MCR_IDAM_C (2 << 8) |
@@ -146,7 +146,9 @@ | |||
146 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) | 146 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) |
147 | 147 | ||
148 | /* FLEXCAN interrupt flag register (IFLAG) bits */ | 148 | /* FLEXCAN interrupt flag register (IFLAG) bits */ |
149 | #define FLEXCAN_TX_BUF_ID 8 | 149 | /* Errata ERR005829 step7: Reserve first valid MB */ |
150 | #define FLEXCAN_TX_BUF_RESERVED 8 | ||
151 | #define FLEXCAN_TX_BUF_ID 9 | ||
150 | #define FLEXCAN_IFLAG_BUF(x) BIT(x) | 152 | #define FLEXCAN_IFLAG_BUF(x) BIT(x) |
151 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) | 153 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) |
152 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) | 154 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) |
@@ -157,6 +159,17 @@ | |||
157 | 159 | ||
158 | /* FLEXCAN message buffers */ | 160 | /* FLEXCAN message buffers */ |
159 | #define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) | 161 | #define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) |
162 | #define FLEXCAN_MB_CODE_RX_INACTIVE (0x0 << 24) | ||
163 | #define FLEXCAN_MB_CODE_RX_EMPTY (0x4 << 24) | ||
164 | #define FLEXCAN_MB_CODE_RX_FULL (0x2 << 24) | ||
165 | #define FLEXCAN_MB_CODE_RX_OVERRRUN (0x6 << 24) | ||
166 | #define FLEXCAN_MB_CODE_RX_RANSWER (0xa << 24) | ||
167 | |||
168 | #define FLEXCAN_MB_CODE_TX_INACTIVE (0x8 << 24) | ||
169 | #define FLEXCAN_MB_CODE_TX_ABORT (0x9 << 24) | ||
170 | #define FLEXCAN_MB_CODE_TX_DATA (0xc << 24) | ||
171 | #define FLEXCAN_MB_CODE_TX_TANSWER (0xe << 24) | ||
172 | |||
160 | #define FLEXCAN_MB_CNT_SRR BIT(22) | 173 | #define FLEXCAN_MB_CNT_SRR BIT(22) |
161 | #define FLEXCAN_MB_CNT_IDE BIT(21) | 174 | #define FLEXCAN_MB_CNT_IDE BIT(21) |
162 | #define FLEXCAN_MB_CNT_RTR BIT(20) | 175 | #define FLEXCAN_MB_CNT_RTR BIT(20) |
@@ -333,7 +346,7 @@ static int flexcan_chip_enable(struct flexcan_priv *priv) | |||
333 | flexcan_write(reg, ®s->mcr); | 346 | flexcan_write(reg, ®s->mcr); |
334 | 347 | ||
335 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 348 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
336 | usleep_range(10, 20); | 349 | udelay(10); |
337 | 350 | ||
338 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) | 351 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) |
339 | return -ETIMEDOUT; | 352 | return -ETIMEDOUT; |
@@ -352,7 +365,7 @@ static int flexcan_chip_disable(struct flexcan_priv *priv) | |||
352 | flexcan_write(reg, ®s->mcr); | 365 | flexcan_write(reg, ®s->mcr); |
353 | 366 | ||
354 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 367 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
355 | usleep_range(10, 20); | 368 | udelay(10); |
356 | 369 | ||
357 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 370 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
358 | return -ETIMEDOUT; | 371 | return -ETIMEDOUT; |
@@ -371,7 +384,7 @@ static int flexcan_chip_freeze(struct flexcan_priv *priv) | |||
371 | flexcan_write(reg, ®s->mcr); | 384 | flexcan_write(reg, ®s->mcr); |
372 | 385 | ||
373 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 386 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
374 | usleep_range(100, 200); | 387 | udelay(100); |
375 | 388 | ||
376 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 389 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
377 | return -ETIMEDOUT; | 390 | return -ETIMEDOUT; |
@@ -390,7 +403,7 @@ static int flexcan_chip_unfreeze(struct flexcan_priv *priv) | |||
390 | flexcan_write(reg, ®s->mcr); | 403 | flexcan_write(reg, ®s->mcr); |
391 | 404 | ||
392 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 405 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
393 | usleep_range(10, 20); | 406 | udelay(10); |
394 | 407 | ||
395 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) | 408 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) |
396 | return -ETIMEDOUT; | 409 | return -ETIMEDOUT; |
@@ -405,7 +418,7 @@ static int flexcan_chip_softreset(struct flexcan_priv *priv) | |||
405 | 418 | ||
406 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | 419 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); |
407 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) | 420 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) |
408 | usleep_range(10, 20); | 421 | udelay(10); |
409 | 422 | ||
410 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) | 423 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) |
411 | return -ETIMEDOUT; | 424 | return -ETIMEDOUT; |
@@ -487,6 +500,14 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
487 | flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id); | 500 | flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id); |
488 | flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | 501 | flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); |
489 | 502 | ||
503 | /* Errata ERR005829 step8: | ||
504 | * Write twice INACTIVE(0x8) code to first MB. | ||
505 | */ | ||
506 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
507 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
508 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
509 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
510 | |||
490 | return NETDEV_TX_OK; | 511 | return NETDEV_TX_OK; |
491 | } | 512 | } |
492 | 513 | ||
@@ -803,6 +824,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | |||
803 | stats->tx_bytes += can_get_echo_skb(dev, 0); | 824 | stats->tx_bytes += can_get_echo_skb(dev, 0); |
804 | stats->tx_packets++; | 825 | stats->tx_packets++; |
805 | can_led_event(dev, CAN_LED_EVENT_TX); | 826 | can_led_event(dev, CAN_LED_EVENT_TX); |
827 | /* after sending a RTR frame mailbox is in RX mode */ | ||
828 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
829 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | ||
806 | flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); | 830 | flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); |
807 | netif_wake_queue(dev); | 831 | netif_wake_queue(dev); |
808 | } | 832 | } |
@@ -858,8 +882,8 @@ static int flexcan_chip_start(struct net_device *dev) | |||
858 | { | 882 | { |
859 | struct flexcan_priv *priv = netdev_priv(dev); | 883 | struct flexcan_priv *priv = netdev_priv(dev); |
860 | struct flexcan_regs __iomem *regs = priv->base; | 884 | struct flexcan_regs __iomem *regs = priv->base; |
861 | int err; | ||
862 | u32 reg_mcr, reg_ctrl, reg_crl2, reg_mecr; | 885 | u32 reg_mcr, reg_ctrl, reg_crl2, reg_mecr; |
886 | int err, i; | ||
863 | 887 | ||
864 | /* enable module */ | 888 | /* enable module */ |
865 | err = flexcan_chip_enable(priv); | 889 | err = flexcan_chip_enable(priv); |
@@ -926,8 +950,18 @@ static int flexcan_chip_start(struct net_device *dev) | |||
926 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); | 950 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); |
927 | flexcan_write(reg_ctrl, ®s->ctrl); | 951 | flexcan_write(reg_ctrl, ®s->ctrl); |
928 | 952 | ||
929 | /* Abort any pending TX, mark Mailbox as INACTIVE */ | 953 | /* clear and invalidate all mailboxes first */ |
930 | flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), | 954 | for (i = FLEXCAN_TX_BUF_ID; i < ARRAY_SIZE(regs->cantxfg); i++) { |
955 | flexcan_write(FLEXCAN_MB_CODE_RX_INACTIVE, | ||
956 | ®s->cantxfg[i].can_ctrl); | ||
957 | } | ||
958 | |||
959 | /* Errata ERR005829: mark first TX mailbox as INACTIVE */ | ||
960 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
961 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
962 | |||
963 | /* mark TX mailbox as INACTIVE */ | ||
964 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
931 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | 965 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); |
932 | 966 | ||
933 | /* acceptance mask/acceptance code (accept everything) */ | 967 | /* acceptance mask/acceptance code (accept everything) */ |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 7a85590fefb9..e5fac368068a 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -70,6 +70,8 @@ struct peak_pci_chan { | |||
70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ | 70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ |
71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ | 71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ |
72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ | 72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ |
73 | #define PEAK_PCIE_OEM_ID 0x0009 /* PCAN-PCI Express OEM */ | ||
74 | #define PEAK_PCIEC34_DEVICE_ID 0x000A /* PCAN-PCI Express 34 (one channel) */ | ||
73 | 75 | ||
74 | #define PEAK_PCI_CHAN_MAX 4 | 76 | #define PEAK_PCI_CHAN_MAX 4 |
75 | 77 | ||
@@ -87,6 +89,7 @@ static const struct pci_device_id peak_pci_tbl[] = { | |||
87 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 89 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
88 | #ifdef CONFIG_CAN_PEAK_PCIEC | 90 | #ifdef CONFIG_CAN_PEAK_PCIEC |
89 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 91 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
92 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
90 | #endif | 93 | #endif |
91 | {0,} | 94 | {0,} |
92 | }; | 95 | }; |
@@ -653,7 +656,8 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
653 | * This must be done *before* register_sja1000dev() but | 656 | * This must be done *before* register_sja1000dev() but |
654 | * *after* devices linkage | 657 | * *after* devices linkage |
655 | */ | 658 | */ |
656 | if (pdev->device == PEAK_PCIEC_DEVICE_ID) { | 659 | if (pdev->device == PEAK_PCIEC_DEVICE_ID || |
660 | pdev->device == PEAK_PCIEC34_DEVICE_ID) { | ||
657 | err = peak_pciec_probe(pdev, dev); | 661 | err = peak_pciec_probe(pdev, dev); |
658 | if (err) { | 662 | if (err) { |
659 | dev_err(&pdev->dev, | 663 | dev_err(&pdev->dev, |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 2b92d712f212..86e621142d5b 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -2128,6 +2128,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2128 | int entry = vp->cur_tx % TX_RING_SIZE; | 2128 | int entry = vp->cur_tx % TX_RING_SIZE; |
2129 | struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; | 2129 | struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; |
2130 | unsigned long flags; | 2130 | unsigned long flags; |
2131 | dma_addr_t dma_addr; | ||
2131 | 2132 | ||
2132 | if (vortex_debug > 6) { | 2133 | if (vortex_debug > 6) { |
2133 | pr_debug("boomerang_start_xmit()\n"); | 2134 | pr_debug("boomerang_start_xmit()\n"); |
@@ -2162,24 +2163,48 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2162 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); | 2163 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); |
2163 | 2164 | ||
2164 | if (!skb_shinfo(skb)->nr_frags) { | 2165 | if (!skb_shinfo(skb)->nr_frags) { |
2165 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, | 2166 | dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, |
2166 | skb->len, PCI_DMA_TODEVICE)); | 2167 | PCI_DMA_TODEVICE); |
2168 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2169 | goto out_dma_err; | ||
2170 | |||
2171 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); | ||
2167 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); | 2172 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); |
2168 | } else { | 2173 | } else { |
2169 | int i; | 2174 | int i; |
2170 | 2175 | ||
2171 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, | 2176 | dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, |
2172 | skb_headlen(skb), PCI_DMA_TODEVICE)); | 2177 | skb_headlen(skb), PCI_DMA_TODEVICE); |
2178 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2179 | goto out_dma_err; | ||
2180 | |||
2181 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); | ||
2173 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); | 2182 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); |
2174 | 2183 | ||
2175 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2184 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2176 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2185 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2177 | 2186 | ||
2187 | dma_addr = skb_frag_dma_map(&VORTEX_PCI(vp)->dev, frag, | ||
2188 | 0, | ||
2189 | frag->size, | ||
2190 | DMA_TO_DEVICE); | ||
2191 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) { | ||
2192 | for(i = i-1; i >= 0; i--) | ||
2193 | dma_unmap_page(&VORTEX_PCI(vp)->dev, | ||
2194 | le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr), | ||
2195 | le32_to_cpu(vp->tx_ring[entry].frag[i+1].length), | ||
2196 | DMA_TO_DEVICE); | ||
2197 | |||
2198 | pci_unmap_single(VORTEX_PCI(vp), | ||
2199 | le32_to_cpu(vp->tx_ring[entry].frag[0].addr), | ||
2200 | le32_to_cpu(vp->tx_ring[entry].frag[0].length), | ||
2201 | PCI_DMA_TODEVICE); | ||
2202 | |||
2203 | goto out_dma_err; | ||
2204 | } | ||
2205 | |||
2178 | vp->tx_ring[entry].frag[i+1].addr = | 2206 | vp->tx_ring[entry].frag[i+1].addr = |
2179 | cpu_to_le32(skb_frag_dma_map( | 2207 | cpu_to_le32(dma_addr); |
2180 | &VORTEX_PCI(vp)->dev, | ||
2181 | frag, | ||
2182 | frag->page_offset, frag->size, DMA_TO_DEVICE)); | ||
2183 | 2208 | ||
2184 | if (i == skb_shinfo(skb)->nr_frags-1) | 2209 | if (i == skb_shinfo(skb)->nr_frags-1) |
2185 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); | 2210 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); |
@@ -2188,7 +2213,10 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2188 | } | 2213 | } |
2189 | } | 2214 | } |
2190 | #else | 2215 | #else |
2191 | vp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); | 2216 | dma_addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); |
2217 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2218 | goto out_dma_err; | ||
2219 | vp->tx_ring[entry].addr = cpu_to_le32(dma_addr); | ||
2192 | vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); | 2220 | vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); |
2193 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); | 2221 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); |
2194 | #endif | 2222 | #endif |
@@ -2216,7 +2244,11 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2216 | skb_tx_timestamp(skb); | 2244 | skb_tx_timestamp(skb); |
2217 | iowrite16(DownUnstall, ioaddr + EL3_CMD); | 2245 | iowrite16(DownUnstall, ioaddr + EL3_CMD); |
2218 | spin_unlock_irqrestore(&vp->lock, flags); | 2246 | spin_unlock_irqrestore(&vp->lock, flags); |
2247 | out: | ||
2219 | return NETDEV_TX_OK; | 2248 | return NETDEV_TX_OK; |
2249 | out_dma_err: | ||
2250 | dev_err(&VORTEX_PCI(vp)->dev, "Error mapping dma buffer\n"); | ||
2251 | goto out; | ||
2220 | } | 2252 | } |
2221 | 2253 | ||
2222 | /* The interrupt handler does all of the Rx thread work and cleans up | 2254 | /* The interrupt handler does all of the Rx thread work and cleans up |
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index dbea8472bfb4..abe1eabc0171 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c | |||
@@ -28,6 +28,17 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * arc_emac_tx_avail - Return the number of available slots in the tx ring. | ||
32 | * @priv: Pointer to ARC EMAC private data structure. | ||
33 | * | ||
34 | * returns: the number of slots available for transmission in tx the ring. | ||
35 | */ | ||
36 | static inline int arc_emac_tx_avail(struct arc_emac_priv *priv) | ||
37 | { | ||
38 | return (priv->txbd_dirty + TX_BD_NUM - priv->txbd_curr - 1) % TX_BD_NUM; | ||
39 | } | ||
40 | |||
41 | /** | ||
31 | * arc_emac_adjust_link - Adjust the PHY link duplex. | 42 | * arc_emac_adjust_link - Adjust the PHY link duplex. |
32 | * @ndev: Pointer to the net_device structure. | 43 | * @ndev: Pointer to the net_device structure. |
33 | * | 44 | * |
@@ -182,10 +193,15 @@ static void arc_emac_tx_clean(struct net_device *ndev) | |||
182 | txbd->info = 0; | 193 | txbd->info = 0; |
183 | 194 | ||
184 | *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; | 195 | *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; |
185 | |||
186 | if (netif_queue_stopped(ndev)) | ||
187 | netif_wake_queue(ndev); | ||
188 | } | 196 | } |
197 | |||
198 | /* Ensure that txbd_dirty is visible to tx() before checking | ||
199 | * for queue stopped. | ||
200 | */ | ||
201 | smp_mb(); | ||
202 | |||
203 | if (netif_queue_stopped(ndev) && arc_emac_tx_avail(priv)) | ||
204 | netif_wake_queue(ndev); | ||
189 | } | 205 | } |
190 | 206 | ||
191 | /** | 207 | /** |
@@ -300,7 +316,7 @@ static int arc_emac_poll(struct napi_struct *napi, int budget) | |||
300 | work_done = arc_emac_rx(ndev, budget); | 316 | work_done = arc_emac_rx(ndev, budget); |
301 | if (work_done < budget) { | 317 | if (work_done < budget) { |
302 | napi_complete(napi); | 318 | napi_complete(napi); |
303 | arc_reg_or(priv, R_ENABLE, RXINT_MASK); | 319 | arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); |
304 | } | 320 | } |
305 | 321 | ||
306 | return work_done; | 322 | return work_done; |
@@ -329,9 +345,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance) | |||
329 | /* Reset all flags except "MDIO complete" */ | 345 | /* Reset all flags except "MDIO complete" */ |
330 | arc_reg_set(priv, R_STATUS, status); | 346 | arc_reg_set(priv, R_STATUS, status); |
331 | 347 | ||
332 | if (status & RXINT_MASK) { | 348 | if (status & (RXINT_MASK | TXINT_MASK)) { |
333 | if (likely(napi_schedule_prep(&priv->napi))) { | 349 | if (likely(napi_schedule_prep(&priv->napi))) { |
334 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK); | 350 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); |
335 | __napi_schedule(&priv->napi); | 351 | __napi_schedule(&priv->napi); |
336 | } | 352 | } |
337 | } | 353 | } |
@@ -442,7 +458,7 @@ static int arc_emac_open(struct net_device *ndev) | |||
442 | arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); | 458 | arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); |
443 | 459 | ||
444 | /* Enable interrupts */ | 460 | /* Enable interrupts */ |
445 | arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK); | 461 | arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); |
446 | 462 | ||
447 | /* Set CONTROL */ | 463 | /* Set CONTROL */ |
448 | arc_reg_set(priv, R_CTRL, | 464 | arc_reg_set(priv, R_CTRL, |
@@ -513,7 +529,7 @@ static int arc_emac_stop(struct net_device *ndev) | |||
513 | netif_stop_queue(ndev); | 529 | netif_stop_queue(ndev); |
514 | 530 | ||
515 | /* Disable interrupts */ | 531 | /* Disable interrupts */ |
516 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK); | 532 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); |
517 | 533 | ||
518 | /* Disable EMAC */ | 534 | /* Disable EMAC */ |
519 | arc_reg_clr(priv, R_CTRL, EN_MASK); | 535 | arc_reg_clr(priv, R_CTRL, EN_MASK); |
@@ -576,11 +592,9 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) | |||
576 | 592 | ||
577 | len = max_t(unsigned int, ETH_ZLEN, skb->len); | 593 | len = max_t(unsigned int, ETH_ZLEN, skb->len); |
578 | 594 | ||
579 | /* EMAC still holds this buffer in its possession. | 595 | if (unlikely(!arc_emac_tx_avail(priv))) { |
580 | * CPU must not modify this buffer descriptor | ||
581 | */ | ||
582 | if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) { | ||
583 | netif_stop_queue(ndev); | 596 | netif_stop_queue(ndev); |
597 | netdev_err(ndev, "BUG! Tx Ring full when queue awake!\n"); | ||
584 | return NETDEV_TX_BUSY; | 598 | return NETDEV_TX_BUSY; |
585 | } | 599 | } |
586 | 600 | ||
@@ -609,12 +623,19 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) | |||
609 | /* Increment index to point to the next BD */ | 623 | /* Increment index to point to the next BD */ |
610 | *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; | 624 | *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; |
611 | 625 | ||
612 | /* Get "info" of the next BD */ | 626 | /* Ensure that tx_clean() sees the new txbd_curr before |
613 | info = &priv->txbd[*txbd_curr].info; | 627 | * checking the queue status. This prevents an unneeded wake |
628 | * of the queue in tx_clean(). | ||
629 | */ | ||
630 | smp_mb(); | ||
614 | 631 | ||
615 | /* Check if if Tx BD ring is full - next BD is still owned by EMAC */ | 632 | if (!arc_emac_tx_avail(priv)) { |
616 | if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) | ||
617 | netif_stop_queue(ndev); | 633 | netif_stop_queue(ndev); |
634 | /* Refresh tx_dirty */ | ||
635 | smp_mb(); | ||
636 | if (arc_emac_tx_avail(priv)) | ||
637 | netif_start_queue(ndev); | ||
638 | } | ||
618 | 639 | ||
619 | arc_reg_set(priv, R_STATUS, TXPL_MASK); | 640 | arc_reg_set(priv, R_STATUS, TXPL_MASK); |
620 | 641 | ||
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 56fadbd4258a..416620fa8fac 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -1697,7 +1697,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev, | |||
1697 | hwstat->tx_underruns + | 1697 | hwstat->tx_underruns + |
1698 | hwstat->tx_excessive_cols + | 1698 | hwstat->tx_excessive_cols + |
1699 | hwstat->tx_late_cols); | 1699 | hwstat->tx_late_cols); |
1700 | nstat->multicast = hwstat->tx_multicast_pkts; | 1700 | nstat->multicast = hwstat->rx_multicast_pkts; |
1701 | nstat->collisions = hwstat->tx_total_cols; | 1701 | nstat->collisions = hwstat->tx_total_cols; |
1702 | 1702 | ||
1703 | nstat->rx_length_errors = (hwstat->rx_oversize_pkts + | 1703 | nstat->rx_length_errors = (hwstat->rx_oversize_pkts + |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 662cf2222873..77f1ff7396ac 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -543,6 +543,25 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, | |||
543 | while ((processed < to_process) && (processed < budget)) { | 543 | while ((processed < to_process) && (processed < budget)) { |
544 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | 544 | cb = &priv->rx_cbs[priv->rx_read_ptr]; |
545 | skb = cb->skb; | 545 | skb = cb->skb; |
546 | |||
547 | processed++; | ||
548 | priv->rx_read_ptr++; | ||
549 | |||
550 | if (priv->rx_read_ptr == priv->num_rx_bds) | ||
551 | priv->rx_read_ptr = 0; | ||
552 | |||
553 | /* We do not have a backing SKB, so we do not a corresponding | ||
554 | * DMA mapping for this incoming packet since | ||
555 | * bcm_sysport_rx_refill always either has both skb and mapping | ||
556 | * or none. | ||
557 | */ | ||
558 | if (unlikely(!skb)) { | ||
559 | netif_err(priv, rx_err, ndev, "out of memory!\n"); | ||
560 | ndev->stats.rx_dropped++; | ||
561 | ndev->stats.rx_errors++; | ||
562 | goto refill; | ||
563 | } | ||
564 | |||
546 | dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), | 565 | dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), |
547 | RX_BUF_LENGTH, DMA_FROM_DEVICE); | 566 | RX_BUF_LENGTH, DMA_FROM_DEVICE); |
548 | 567 | ||
@@ -552,23 +571,11 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, | |||
552 | status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & | 571 | status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & |
553 | DESC_STATUS_MASK; | 572 | DESC_STATUS_MASK; |
554 | 573 | ||
555 | processed++; | ||
556 | priv->rx_read_ptr++; | ||
557 | if (priv->rx_read_ptr == priv->num_rx_bds) | ||
558 | priv->rx_read_ptr = 0; | ||
559 | |||
560 | netif_dbg(priv, rx_status, ndev, | 574 | netif_dbg(priv, rx_status, ndev, |
561 | "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", | 575 | "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", |
562 | p_index, priv->rx_c_index, priv->rx_read_ptr, | 576 | p_index, priv->rx_c_index, priv->rx_read_ptr, |
563 | len, status); | 577 | len, status); |
564 | 578 | ||
565 | if (unlikely(!skb)) { | ||
566 | netif_err(priv, rx_err, ndev, "out of memory!\n"); | ||
567 | ndev->stats.rx_dropped++; | ||
568 | ndev->stats.rx_errors++; | ||
569 | goto refill; | ||
570 | } | ||
571 | |||
572 | if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { | 579 | if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { |
573 | netif_err(priv, rx_status, ndev, "fragmented packet!\n"); | 580 | netif_err(priv, rx_status, ndev, "fragmented packet!\n"); |
574 | ndev->stats.rx_dropped++; | 581 | ndev->stats.rx_dropped++; |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index a12c65604f9d..e8c601d26c64 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -875,6 +875,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
875 | int last_tx_cn, last_c_index, num_tx_bds; | 875 | int last_tx_cn, last_c_index, num_tx_bds; |
876 | struct enet_cb *tx_cb_ptr; | 876 | struct enet_cb *tx_cb_ptr; |
877 | struct netdev_queue *txq; | 877 | struct netdev_queue *txq; |
878 | unsigned int bds_compl; | ||
878 | unsigned int c_index; | 879 | unsigned int c_index; |
879 | 880 | ||
880 | /* Compute how many buffers are transmitted since last xmit call */ | 881 | /* Compute how many buffers are transmitted since last xmit call */ |
@@ -899,7 +900,9 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
899 | /* Reclaim transmitted buffers */ | 900 | /* Reclaim transmitted buffers */ |
900 | while (last_tx_cn-- > 0) { | 901 | while (last_tx_cn-- > 0) { |
901 | tx_cb_ptr = ring->cbs + last_c_index; | 902 | tx_cb_ptr = ring->cbs + last_c_index; |
903 | bds_compl = 0; | ||
902 | if (tx_cb_ptr->skb) { | 904 | if (tx_cb_ptr->skb) { |
905 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; | ||
903 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; | 906 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; |
904 | dma_unmap_single(&dev->dev, | 907 | dma_unmap_single(&dev->dev, |
905 | dma_unmap_addr(tx_cb_ptr, dma_addr), | 908 | dma_unmap_addr(tx_cb_ptr, dma_addr), |
@@ -916,7 +919,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
916 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); | 919 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); |
917 | } | 920 | } |
918 | dev->stats.tx_packets++; | 921 | dev->stats.tx_packets++; |
919 | ring->free_bds += 1; | 922 | ring->free_bds += bds_compl; |
920 | 923 | ||
921 | last_c_index++; | 924 | last_c_index++; |
922 | last_c_index &= (num_tx_bds - 1); | 925 | last_c_index &= (num_tx_bds - 1); |
@@ -1274,12 +1277,29 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, | |||
1274 | 1277 | ||
1275 | while ((rxpktprocessed < rxpkttoprocess) && | 1278 | while ((rxpktprocessed < rxpkttoprocess) && |
1276 | (rxpktprocessed < budget)) { | 1279 | (rxpktprocessed < budget)) { |
1280 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | ||
1281 | skb = cb->skb; | ||
1282 | |||
1283 | rxpktprocessed++; | ||
1284 | |||
1285 | priv->rx_read_ptr++; | ||
1286 | priv->rx_read_ptr &= (priv->num_rx_bds - 1); | ||
1287 | |||
1288 | /* We do not have a backing SKB, so we do not have a | ||
1289 | * corresponding DMA mapping for this incoming packet since | ||
1290 | * bcmgenet_rx_refill always either has both skb and mapping or | ||
1291 | * none. | ||
1292 | */ | ||
1293 | if (unlikely(!skb)) { | ||
1294 | dev->stats.rx_dropped++; | ||
1295 | dev->stats.rx_errors++; | ||
1296 | goto refill; | ||
1297 | } | ||
1298 | |||
1277 | /* Unmap the packet contents such that we can use the | 1299 | /* Unmap the packet contents such that we can use the |
1278 | * RSV from the 64 bytes descriptor when enabled and save | 1300 | * RSV from the 64 bytes descriptor when enabled and save |
1279 | * a 32-bits register read | 1301 | * a 32-bits register read |
1280 | */ | 1302 | */ |
1281 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | ||
1282 | skb = cb->skb; | ||
1283 | dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), | 1303 | dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), |
1284 | priv->rx_buf_len, DMA_FROM_DEVICE); | 1304 | priv->rx_buf_len, DMA_FROM_DEVICE); |
1285 | 1305 | ||
@@ -1307,18 +1327,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, | |||
1307 | __func__, p_index, priv->rx_c_index, | 1327 | __func__, p_index, priv->rx_c_index, |
1308 | priv->rx_read_ptr, dma_length_status); | 1328 | priv->rx_read_ptr, dma_length_status); |
1309 | 1329 | ||
1310 | rxpktprocessed++; | ||
1311 | |||
1312 | priv->rx_read_ptr++; | ||
1313 | priv->rx_read_ptr &= (priv->num_rx_bds - 1); | ||
1314 | |||
1315 | /* out of memory, just drop packets at the hardware level */ | ||
1316 | if (unlikely(!skb)) { | ||
1317 | dev->stats.rx_dropped++; | ||
1318 | dev->stats.rx_errors++; | ||
1319 | goto refill; | ||
1320 | } | ||
1321 | |||
1322 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { | 1330 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { |
1323 | netif_err(priv, rx_status, dev, | 1331 | netif_err(priv, rx_status, dev, |
1324 | "dropping fragmented packet!\n"); | 1332 | "dropping fragmented packet!\n"); |
@@ -1736,13 +1744,63 @@ static void bcmgenet_init_multiq(struct net_device *dev) | |||
1736 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | 1744 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); |
1737 | } | 1745 | } |
1738 | 1746 | ||
1747 | static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | ||
1748 | { | ||
1749 | int ret = 0; | ||
1750 | int timeout = 0; | ||
1751 | u32 reg; | ||
1752 | |||
1753 | /* Disable TDMA to stop add more frames in TX DMA */ | ||
1754 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
1755 | reg &= ~DMA_EN; | ||
1756 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
1757 | |||
1758 | /* Check TDMA status register to confirm TDMA is disabled */ | ||
1759 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
1760 | reg = bcmgenet_tdma_readl(priv, DMA_STATUS); | ||
1761 | if (reg & DMA_DISABLED) | ||
1762 | break; | ||
1763 | |||
1764 | udelay(1); | ||
1765 | } | ||
1766 | |||
1767 | if (timeout == DMA_TIMEOUT_VAL) { | ||
1768 | netdev_warn(priv->dev, "Timed out while disabling TX DMA\n"); | ||
1769 | ret = -ETIMEDOUT; | ||
1770 | } | ||
1771 | |||
1772 | /* Wait 10ms for packet drain in both tx and rx dma */ | ||
1773 | usleep_range(10000, 20000); | ||
1774 | |||
1775 | /* Disable RDMA */ | ||
1776 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
1777 | reg &= ~DMA_EN; | ||
1778 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
1779 | |||
1780 | timeout = 0; | ||
1781 | /* Check RDMA status register to confirm RDMA is disabled */ | ||
1782 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
1783 | reg = bcmgenet_rdma_readl(priv, DMA_STATUS); | ||
1784 | if (reg & DMA_DISABLED) | ||
1785 | break; | ||
1786 | |||
1787 | udelay(1); | ||
1788 | } | ||
1789 | |||
1790 | if (timeout == DMA_TIMEOUT_VAL) { | ||
1791 | netdev_warn(priv->dev, "Timed out while disabling RX DMA\n"); | ||
1792 | ret = -ETIMEDOUT; | ||
1793 | } | ||
1794 | |||
1795 | return ret; | ||
1796 | } | ||
1797 | |||
1739 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | 1798 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) |
1740 | { | 1799 | { |
1741 | int i; | 1800 | int i; |
1742 | 1801 | ||
1743 | /* disable DMA */ | 1802 | /* disable DMA */ |
1744 | bcmgenet_rdma_writel(priv, 0, DMA_CTRL); | 1803 | bcmgenet_dma_teardown(priv); |
1745 | bcmgenet_tdma_writel(priv, 0, DMA_CTRL); | ||
1746 | 1804 | ||
1747 | for (i = 0; i < priv->num_tx_bds; i++) { | 1805 | for (i = 0; i < priv->num_tx_bds; i++) { |
1748 | if (priv->tx_cbs[i].skb != NULL) { | 1806 | if (priv->tx_cbs[i].skb != NULL) { |
@@ -2101,57 +2159,6 @@ err_clk_disable: | |||
2101 | return ret; | 2159 | return ret; |
2102 | } | 2160 | } |
2103 | 2161 | ||
2104 | static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | ||
2105 | { | ||
2106 | int ret = 0; | ||
2107 | int timeout = 0; | ||
2108 | u32 reg; | ||
2109 | |||
2110 | /* Disable TDMA to stop add more frames in TX DMA */ | ||
2111 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
2112 | reg &= ~DMA_EN; | ||
2113 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
2114 | |||
2115 | /* Check TDMA status register to confirm TDMA is disabled */ | ||
2116 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
2117 | reg = bcmgenet_tdma_readl(priv, DMA_STATUS); | ||
2118 | if (reg & DMA_DISABLED) | ||
2119 | break; | ||
2120 | |||
2121 | udelay(1); | ||
2122 | } | ||
2123 | |||
2124 | if (timeout == DMA_TIMEOUT_VAL) { | ||
2125 | netdev_warn(priv->dev, "Timed out while disabling TX DMA\n"); | ||
2126 | ret = -ETIMEDOUT; | ||
2127 | } | ||
2128 | |||
2129 | /* Wait 10ms for packet drain in both tx and rx dma */ | ||
2130 | usleep_range(10000, 20000); | ||
2131 | |||
2132 | /* Disable RDMA */ | ||
2133 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
2134 | reg &= ~DMA_EN; | ||
2135 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
2136 | |||
2137 | timeout = 0; | ||
2138 | /* Check RDMA status register to confirm RDMA is disabled */ | ||
2139 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
2140 | reg = bcmgenet_rdma_readl(priv, DMA_STATUS); | ||
2141 | if (reg & DMA_DISABLED) | ||
2142 | break; | ||
2143 | |||
2144 | udelay(1); | ||
2145 | } | ||
2146 | |||
2147 | if (timeout == DMA_TIMEOUT_VAL) { | ||
2148 | netdev_warn(priv->dev, "Timed out while disabling RX DMA\n"); | ||
2149 | ret = -ETIMEDOUT; | ||
2150 | } | ||
2151 | |||
2152 | return ret; | ||
2153 | } | ||
2154 | |||
2155 | static void bcmgenet_netif_stop(struct net_device *dev) | 2162 | static void bcmgenet_netif_stop(struct net_device *dev) |
2156 | { | 2163 | { |
2157 | struct bcmgenet_priv *priv = netdev_priv(dev); | 2164 | struct bcmgenet_priv *priv = netdev_priv(dev); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index cb77ae93d89a..e7d3a620d96a 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7914 | 7914 | ||
7915 | entry = tnapi->tx_prod; | 7915 | entry = tnapi->tx_prod; |
7916 | base_flags = 0; | 7916 | base_flags = 0; |
7917 | if (skb->ip_summed == CHECKSUM_PARTIAL) | ||
7918 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | ||
7919 | 7917 | ||
7920 | mss = skb_shinfo(skb)->gso_size; | 7918 | mss = skb_shinfo(skb)->gso_size; |
7921 | if (mss) { | 7919 | if (mss) { |
@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7929 | 7927 | ||
7930 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; | 7928 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; |
7931 | 7929 | ||
7930 | /* HW/FW can not correctly segment packets that have been | ||
7931 | * vlan encapsulated. | ||
7932 | */ | ||
7933 | if (skb->protocol == htons(ETH_P_8021Q) || | ||
7934 | skb->protocol == htons(ETH_P_8021AD)) | ||
7935 | return tg3_tso_bug(tp, tnapi, txq, skb); | ||
7936 | |||
7932 | if (!skb_is_gso_v6(skb)) { | 7937 | if (!skb_is_gso_v6(skb)) { |
7933 | if (unlikely((ETH_HLEN + hdr_len) > 80) && | 7938 | if (unlikely((ETH_HLEN + hdr_len) > 80) && |
7934 | tg3_flag(tp, TSO_BUG)) | 7939 | tg3_flag(tp, TSO_BUG)) |
@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7979 | base_flags |= tsflags << 12; | 7984 | base_flags |= tsflags << 12; |
7980 | } | 7985 | } |
7981 | } | 7986 | } |
7987 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
7988 | /* HW/FW can not correctly checksum packets that have been | ||
7989 | * vlan encapsulated. | ||
7990 | */ | ||
7991 | if (skb->protocol == htons(ETH_P_8021Q) || | ||
7992 | skb->protocol == htons(ETH_P_8021AD)) { | ||
7993 | if (skb_checksum_help(skb)) | ||
7994 | goto drop; | ||
7995 | } else { | ||
7996 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | ||
7997 | } | ||
7982 | } | 7998 | } |
7983 | 7999 | ||
7984 | if (tg3_flag(tp, USE_JUMBO_BDFLAG) && | 8000 | if (tg3_flag(tp, USE_JUMBO_BDFLAG) && |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index f56b95af3fcf..eeec49540233 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -6478,6 +6478,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6478 | struct port_info *pi; | 6478 | struct port_info *pi; |
6479 | bool highdma = false; | 6479 | bool highdma = false; |
6480 | struct adapter *adapter = NULL; | 6480 | struct adapter *adapter = NULL; |
6481 | void __iomem *regs; | ||
6481 | 6482 | ||
6482 | printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); | 6483 | printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); |
6483 | 6484 | ||
@@ -6494,19 +6495,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6494 | goto out_release_regions; | 6495 | goto out_release_regions; |
6495 | } | 6496 | } |
6496 | 6497 | ||
6498 | regs = pci_ioremap_bar(pdev, 0); | ||
6499 | if (!regs) { | ||
6500 | dev_err(&pdev->dev, "cannot map device registers\n"); | ||
6501 | err = -ENOMEM; | ||
6502 | goto out_disable_device; | ||
6503 | } | ||
6504 | |||
6505 | /* We control everything through one PF */ | ||
6506 | func = SOURCEPF_GET(readl(regs + PL_WHOAMI)); | ||
6507 | if (func != ent->driver_data) { | ||
6508 | iounmap(regs); | ||
6509 | pci_disable_device(pdev); | ||
6510 | pci_save_state(pdev); /* to restore SR-IOV later */ | ||
6511 | goto sriov; | ||
6512 | } | ||
6513 | |||
6497 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | 6514 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
6498 | highdma = true; | 6515 | highdma = true; |
6499 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 6516 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
6500 | if (err) { | 6517 | if (err) { |
6501 | dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " | 6518 | dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " |
6502 | "coherent allocations\n"); | 6519 | "coherent allocations\n"); |
6503 | goto out_disable_device; | 6520 | goto out_unmap_bar0; |
6504 | } | 6521 | } |
6505 | } else { | 6522 | } else { |
6506 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 6523 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
6507 | if (err) { | 6524 | if (err) { |
6508 | dev_err(&pdev->dev, "no usable DMA configuration\n"); | 6525 | dev_err(&pdev->dev, "no usable DMA configuration\n"); |
6509 | goto out_disable_device; | 6526 | goto out_unmap_bar0; |
6510 | } | 6527 | } |
6511 | } | 6528 | } |
6512 | 6529 | ||
@@ -6518,7 +6535,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6518 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 6535 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
6519 | if (!adapter) { | 6536 | if (!adapter) { |
6520 | err = -ENOMEM; | 6537 | err = -ENOMEM; |
6521 | goto out_disable_device; | 6538 | goto out_unmap_bar0; |
6522 | } | 6539 | } |
6523 | 6540 | ||
6524 | adapter->workq = create_singlethread_workqueue("cxgb4"); | 6541 | adapter->workq = create_singlethread_workqueue("cxgb4"); |
@@ -6530,20 +6547,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6530 | /* PCI device has been enabled */ | 6547 | /* PCI device has been enabled */ |
6531 | adapter->flags |= DEV_ENABLED; | 6548 | adapter->flags |= DEV_ENABLED; |
6532 | 6549 | ||
6533 | adapter->regs = pci_ioremap_bar(pdev, 0); | 6550 | adapter->regs = regs; |
6534 | if (!adapter->regs) { | ||
6535 | dev_err(&pdev->dev, "cannot map device registers\n"); | ||
6536 | err = -ENOMEM; | ||
6537 | goto out_free_adapter; | ||
6538 | } | ||
6539 | |||
6540 | /* We control everything through one PF */ | ||
6541 | func = SOURCEPF_GET(readl(adapter->regs + PL_WHOAMI)); | ||
6542 | if (func != ent->driver_data) { | ||
6543 | pci_save_state(pdev); /* to restore SR-IOV later */ | ||
6544 | goto sriov; | ||
6545 | } | ||
6546 | |||
6547 | adapter->pdev = pdev; | 6551 | adapter->pdev = pdev; |
6548 | adapter->pdev_dev = &pdev->dev; | 6552 | adapter->pdev_dev = &pdev->dev; |
6549 | adapter->mbox = func; | 6553 | adapter->mbox = func; |
@@ -6560,7 +6564,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6560 | 6564 | ||
6561 | err = t4_prep_adapter(adapter); | 6565 | err = t4_prep_adapter(adapter); |
6562 | if (err) | 6566 | if (err) |
6563 | goto out_unmap_bar0; | 6567 | goto out_free_adapter; |
6568 | |||
6564 | 6569 | ||
6565 | if (!is_t4(adapter->params.chip)) { | 6570 | if (!is_t4(adapter->params.chip)) { |
6566 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; | 6571 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; |
@@ -6577,14 +6582,14 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6577 | dev_err(&pdev->dev, | 6582 | dev_err(&pdev->dev, |
6578 | "Incorrect number of egress queues per page\n"); | 6583 | "Incorrect number of egress queues per page\n"); |
6579 | err = -EINVAL; | 6584 | err = -EINVAL; |
6580 | goto out_unmap_bar0; | 6585 | goto out_free_adapter; |
6581 | } | 6586 | } |
6582 | adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), | 6587 | adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), |
6583 | pci_resource_len(pdev, 2)); | 6588 | pci_resource_len(pdev, 2)); |
6584 | if (!adapter->bar2) { | 6589 | if (!adapter->bar2) { |
6585 | dev_err(&pdev->dev, "cannot map device bar2 region\n"); | 6590 | dev_err(&pdev->dev, "cannot map device bar2 region\n"); |
6586 | err = -ENOMEM; | 6591 | err = -ENOMEM; |
6587 | goto out_unmap_bar0; | 6592 | goto out_free_adapter; |
6588 | } | 6593 | } |
6589 | } | 6594 | } |
6590 | 6595 | ||
@@ -6722,13 +6727,13 @@ sriov: | |||
6722 | out_unmap_bar: | 6727 | out_unmap_bar: |
6723 | if (!is_t4(adapter->params.chip)) | 6728 | if (!is_t4(adapter->params.chip)) |
6724 | iounmap(adapter->bar2); | 6729 | iounmap(adapter->bar2); |
6725 | out_unmap_bar0: | ||
6726 | iounmap(adapter->regs); | ||
6727 | out_free_adapter: | 6730 | out_free_adapter: |
6728 | if (adapter->workq) | 6731 | if (adapter->workq) |
6729 | destroy_workqueue(adapter->workq); | 6732 | destroy_workqueue(adapter->workq); |
6730 | 6733 | ||
6731 | kfree(adapter); | 6734 | kfree(adapter); |
6735 | out_unmap_bar0: | ||
6736 | iounmap(regs); | ||
6732 | out_disable_device: | 6737 | out_disable_device: |
6733 | pci_disable_pcie_error_reporting(pdev); | 6738 | pci_disable_pcie_error_reporting(pdev); |
6734 | pci_disable_device(pdev); | 6739 | pci_disable_device(pdev); |
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 9b33057a9477..70089c29d307 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -1399,7 +1399,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev) | |||
1399 | const void *mac_addr; | 1399 | const void *mac_addr; |
1400 | 1400 | ||
1401 | if (!IS_ENABLED(CONFIG_OF) || !np) | 1401 | if (!IS_ENABLED(CONFIG_OF) || !np) |
1402 | return NULL; | 1402 | return ERR_PTR(-ENXIO); |
1403 | 1403 | ||
1404 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 1404 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
1405 | if (!pdata) | 1405 | if (!pdata) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 65a4a0f88ea0..02a2e90d581a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -2389,6 +2389,22 @@ struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv( | |||
2389 | } | 2389 | } |
2390 | EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); | 2390 | EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); |
2391 | 2391 | ||
2392 | static int mlx4_slaves_closest_port(struct mlx4_dev *dev, int slave, int port) | ||
2393 | { | ||
2394 | struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave); | ||
2395 | int min_port = find_first_bit(actv_ports.ports, dev->caps.num_ports) | ||
2396 | + 1; | ||
2397 | int max_port = min_port + | ||
2398 | bitmap_weight(actv_ports.ports, dev->caps.num_ports); | ||
2399 | |||
2400 | if (port < min_port) | ||
2401 | port = min_port; | ||
2402 | else if (port >= max_port) | ||
2403 | port = max_port - 1; | ||
2404 | |||
2405 | return port; | ||
2406 | } | ||
2407 | |||
2392 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) | 2408 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) |
2393 | { | 2409 | { |
2394 | struct mlx4_priv *priv = mlx4_priv(dev); | 2410 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -2402,6 +2418,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) | |||
2402 | if (slave < 0) | 2418 | if (slave < 0) |
2403 | return -EINVAL; | 2419 | return -EINVAL; |
2404 | 2420 | ||
2421 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2405 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2422 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2406 | s_info->mac = mac; | 2423 | s_info->mac = mac; |
2407 | mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", | 2424 | mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", |
@@ -2428,6 +2445,7 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos) | |||
2428 | if (slave < 0) | 2445 | if (slave < 0) |
2429 | return -EINVAL; | 2446 | return -EINVAL; |
2430 | 2447 | ||
2448 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2431 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2449 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2432 | 2450 | ||
2433 | if ((0 == vlan) && (0 == qos)) | 2451 | if ((0 == vlan) && (0 == qos)) |
@@ -2455,6 +2473,7 @@ bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave, | |||
2455 | struct mlx4_priv *priv; | 2473 | struct mlx4_priv *priv; |
2456 | 2474 | ||
2457 | priv = mlx4_priv(dev); | 2475 | priv = mlx4_priv(dev); |
2476 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2458 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | 2477 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; |
2459 | 2478 | ||
2460 | if (MLX4_VGT != vp_oper->state.default_vlan) { | 2479 | if (MLX4_VGT != vp_oper->state.default_vlan) { |
@@ -2482,6 +2501,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) | |||
2482 | if (slave < 0) | 2501 | if (slave < 0) |
2483 | return -EINVAL; | 2502 | return -EINVAL; |
2484 | 2503 | ||
2504 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2485 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2505 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2486 | s_info->spoofchk = setting; | 2506 | s_info->spoofchk = setting; |
2487 | 2507 | ||
@@ -2535,6 +2555,7 @@ int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_stat | |||
2535 | if (slave < 0) | 2555 | if (slave < 0) |
2536 | return -EINVAL; | 2556 | return -EINVAL; |
2537 | 2557 | ||
2558 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2538 | switch (link_state) { | 2559 | switch (link_state) { |
2539 | case IFLA_VF_LINK_STATE_AUTO: | 2560 | case IFLA_VF_LINK_STATE_AUTO: |
2540 | /* get current link state */ | 2561 | /* get current link state */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index e22f24f784fc..35ff2925110a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -487,6 +487,9 @@ static int mlx4_en_set_pauseparam(struct net_device *dev, | |||
487 | struct mlx4_en_dev *mdev = priv->mdev; | 487 | struct mlx4_en_dev *mdev = priv->mdev; |
488 | int err; | 488 | int err; |
489 | 489 | ||
490 | if (pause->autoneg) | ||
491 | return -EINVAL; | ||
492 | |||
490 | priv->prof->tx_pause = pause->tx_pause != 0; | 493 | priv->prof->tx_pause = pause->tx_pause != 0; |
491 | priv->prof->rx_pause = pause->rx_pause != 0; | 494 | priv->prof->rx_pause = pause->rx_pause != 0; |
492 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 495 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 0dc31d85fc3b..2301365c79c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
@@ -390,13 +390,14 @@ err_icm: | |||
390 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); | 390 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); |
391 | 391 | ||
392 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC | 392 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC |
393 | int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | 393 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
394 | enum mlx4_update_qp_attr attr, | 394 | enum mlx4_update_qp_attr attr, |
395 | struct mlx4_update_qp_params *params) | 395 | struct mlx4_update_qp_params *params) |
396 | { | 396 | { |
397 | struct mlx4_cmd_mailbox *mailbox; | 397 | struct mlx4_cmd_mailbox *mailbox; |
398 | struct mlx4_update_qp_context *cmd; | 398 | struct mlx4_update_qp_context *cmd; |
399 | u64 pri_addr_path_mask = 0; | 399 | u64 pri_addr_path_mask = 0; |
400 | u64 qp_mask = 0; | ||
400 | int err = 0; | 401 | int err = 0; |
401 | 402 | ||
402 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 403 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
@@ -413,9 +414,16 @@ int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | |||
413 | cmd->qp_context.pri_path.grh_mylmc = params->smac_index; | 414 | cmd->qp_context.pri_path.grh_mylmc = params->smac_index; |
414 | } | 415 | } |
415 | 416 | ||
417 | if (attr & MLX4_UPDATE_QP_VSD) { | ||
418 | qp_mask |= 1ULL << MLX4_UPD_QP_MASK_VSD; | ||
419 | if (params->flags & MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE) | ||
420 | cmd->qp_context.param3 |= cpu_to_be32(MLX4_STRIP_VLAN); | ||
421 | } | ||
422 | |||
416 | cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); | 423 | cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); |
424 | cmd->qp_mask = cpu_to_be64(qp_mask); | ||
417 | 425 | ||
418 | err = mlx4_cmd(dev, mailbox->dma, qp->qpn & 0xffffff, 0, | 426 | err = mlx4_cmd(dev, mailbox->dma, qpn & 0xffffff, 0, |
419 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, | 427 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, |
420 | MLX4_CMD_NATIVE); | 428 | MLX4_CMD_NATIVE); |
421 | 429 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 1089367fed22..5d2498dcf536 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -702,11 +702,13 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
702 | struct mlx4_qp_context *qpc = inbox->buf + 8; | 702 | struct mlx4_qp_context *qpc = inbox->buf + 8; |
703 | struct mlx4_vport_oper_state *vp_oper; | 703 | struct mlx4_vport_oper_state *vp_oper; |
704 | struct mlx4_priv *priv; | 704 | struct mlx4_priv *priv; |
705 | u32 qp_type; | ||
705 | int port; | 706 | int port; |
706 | 707 | ||
707 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; | 708 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; |
708 | priv = mlx4_priv(dev); | 709 | priv = mlx4_priv(dev); |
709 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | 710 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; |
711 | qp_type = (be32_to_cpu(qpc->flags) >> 16) & 0xff; | ||
710 | 712 | ||
711 | if (MLX4_VGT != vp_oper->state.default_vlan) { | 713 | if (MLX4_VGT != vp_oper->state.default_vlan) { |
712 | /* the reserved QPs (special, proxy, tunnel) | 714 | /* the reserved QPs (special, proxy, tunnel) |
@@ -715,8 +717,20 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
715 | if (mlx4_is_qp_reserved(dev, qpn)) | 717 | if (mlx4_is_qp_reserved(dev, qpn)) |
716 | return 0; | 718 | return 0; |
717 | 719 | ||
718 | /* force strip vlan by clear vsd */ | 720 | /* force strip vlan by clear vsd, MLX QP refers to Raw Ethernet */ |
719 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | 721 | if (qp_type == MLX4_QP_ST_UD || |
722 | (qp_type == MLX4_QP_ST_MLX && mlx4_is_eth(dev, port))) { | ||
723 | if (dev->caps.bmme_flags & MLX4_BMME_FLAG_VSD_INIT2RTR) { | ||
724 | *(__be32 *)inbox->buf = | ||
725 | cpu_to_be32(be32_to_cpu(*(__be32 *)inbox->buf) | | ||
726 | MLX4_QP_OPTPAR_VLAN_STRIPPING); | ||
727 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | ||
728 | } else { | ||
729 | struct mlx4_update_qp_params params = {.flags = 0}; | ||
730 | |||
731 | mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); | ||
732 | } | ||
733 | } | ||
720 | 734 | ||
721 | if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && | 735 | if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && |
722 | dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { | 736 | dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { |
@@ -3998,13 +4012,17 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, | |||
3998 | } | 4012 | } |
3999 | 4013 | ||
4000 | port = (rqp->sched_queue >> 6 & 1) + 1; | 4014 | port = (rqp->sched_queue >> 6 & 1) + 1; |
4001 | smac_index = cmd->qp_context.pri_path.grh_mylmc; | 4015 | |
4002 | err = mac_find_smac_ix_in_slave(dev, slave, port, | 4016 | if (pri_addr_path_mask & (1ULL << MLX4_UPD_QP_PATH_MASK_MAC_INDEX)) { |
4003 | smac_index, &mac); | 4017 | smac_index = cmd->qp_context.pri_path.grh_mylmc; |
4004 | if (err) { | 4018 | err = mac_find_smac_ix_in_slave(dev, slave, port, |
4005 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | 4019 | smac_index, &mac); |
4006 | qpn, smac_index); | 4020 | |
4007 | goto err_mac; | 4021 | if (err) { |
4022 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | ||
4023 | qpn, smac_index); | ||
4024 | goto err_mac; | ||
4025 | } | ||
4008 | } | 4026 | } |
4009 | 4027 | ||
4010 | err = mlx4_cmd(dev, inbox->dma, | 4028 | err = mlx4_cmd(dev, inbox->dma, |
@@ -4818,7 +4836,7 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work) | |||
4818 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; | 4836 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; |
4819 | 4837 | ||
4820 | upd_context = mailbox->buf; | 4838 | upd_context = mailbox->buf; |
4821 | upd_context->qp_mask = cpu_to_be64(MLX4_UPD_QP_MASK_VSD); | 4839 | upd_context->qp_mask = cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_VSD); |
4822 | 4840 | ||
4823 | spin_lock_irq(mlx4_tlock(dev)); | 4841 | spin_lock_irq(mlx4_tlock(dev)); |
4824 | list_for_each_entry_safe(qp, tmp, qp_list, com.list) { | 4842 | list_for_each_entry_safe(qp, tmp, qp_list, com.list) { |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index 979c6980639f..a42293092ea4 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
@@ -290,9 +290,11 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | |||
290 | /* Read the hardware TX timestamp if one was recorded */ | 290 | /* Read the hardware TX timestamp if one was recorded */ |
291 | if (unlikely(re.s.tstamp)) { | 291 | if (unlikely(re.s.tstamp)) { |
292 | struct skb_shared_hwtstamps ts; | 292 | struct skb_shared_hwtstamps ts; |
293 | u64 ns; | ||
294 | |||
293 | memset(&ts, 0, sizeof(ts)); | 295 | memset(&ts, 0, sizeof(ts)); |
294 | /* Read the timestamp */ | 296 | /* Read the timestamp */ |
295 | u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); | 297 | ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); |
296 | /* Remove the timestamp from the FIFO */ | 298 | /* Remove the timestamp from the FIFO */ |
297 | cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); | 299 | cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); |
298 | /* Tell the kernel about the timestamp */ | 300 | /* Tell the kernel about the timestamp */ |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig index 44c8be1c6805..5f7a35212796 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | |||
@@ -7,6 +7,7 @@ config PCH_GBE | |||
7 | depends on PCI && (X86_32 || COMPILE_TEST) | 7 | depends on PCI && (X86_32 || COMPILE_TEST) |
8 | select MII | 8 | select MII |
9 | select PTP_1588_CLOCK_PCH | 9 | select PTP_1588_CLOCK_PCH |
10 | select NET_PTP_CLASSIFY | ||
10 | ---help--- | 11 | ---help--- |
11 | This is a gigabit ethernet driver for EG20T PCH. | 12 | This is a gigabit ethernet driver for EG20T PCH. |
12 | EG20T PCH is the platform controller hub that is used in Intel's | 13 | EG20T PCH is the platform controller hub that is used in Intel's |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 02dd92ac1764..1d81238fcb93 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1847,33 +1847,31 @@ static void __rtl8169_set_features(struct net_device *dev, | |||
1847 | netdev_features_t features) | 1847 | netdev_features_t features) |
1848 | { | 1848 | { |
1849 | struct rtl8169_private *tp = netdev_priv(dev); | 1849 | struct rtl8169_private *tp = netdev_priv(dev); |
1850 | netdev_features_t changed = features ^ dev->features; | ||
1851 | void __iomem *ioaddr = tp->mmio_addr; | 1850 | void __iomem *ioaddr = tp->mmio_addr; |
1851 | u32 rx_config; | ||
1852 | 1852 | ||
1853 | if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM | | 1853 | rx_config = RTL_R32(RxConfig); |
1854 | NETIF_F_HW_VLAN_CTAG_RX))) | 1854 | if (features & NETIF_F_RXALL) |
1855 | return; | 1855 | rx_config |= (AcceptErr | AcceptRunt); |
1856 | else | ||
1857 | rx_config &= ~(AcceptErr | AcceptRunt); | ||
1856 | 1858 | ||
1857 | if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) { | 1859 | RTL_W32(RxConfig, rx_config); |
1858 | if (features & NETIF_F_RXCSUM) | ||
1859 | tp->cp_cmd |= RxChkSum; | ||
1860 | else | ||
1861 | tp->cp_cmd &= ~RxChkSum; | ||
1862 | 1860 | ||
1863 | if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) | 1861 | if (features & NETIF_F_RXCSUM) |
1864 | tp->cp_cmd |= RxVlan; | 1862 | tp->cp_cmd |= RxChkSum; |
1865 | else | 1863 | else |
1866 | tp->cp_cmd &= ~RxVlan; | 1864 | tp->cp_cmd &= ~RxChkSum; |
1867 | 1865 | ||
1868 | RTL_W16(CPlusCmd, tp->cp_cmd); | 1866 | if (features & NETIF_F_HW_VLAN_CTAG_RX) |
1869 | RTL_R16(CPlusCmd); | 1867 | tp->cp_cmd |= RxVlan; |
1870 | } | 1868 | else |
1871 | if (changed & NETIF_F_RXALL) { | 1869 | tp->cp_cmd &= ~RxVlan; |
1872 | int tmp = (RTL_R32(RxConfig) & ~(AcceptErr | AcceptRunt)); | 1870 | |
1873 | if (features & NETIF_F_RXALL) | 1871 | tp->cp_cmd |= RTL_R16(CPlusCmd) & ~(RxVlan | RxChkSum); |
1874 | tmp |= (AcceptErr | AcceptRunt); | 1872 | |
1875 | RTL_W32(RxConfig, tmp); | 1873 | RTL_W16(CPlusCmd, tp->cp_cmd); |
1876 | } | 1874 | RTL_R16(CPlusCmd); |
1877 | } | 1875 | } |
1878 | 1876 | ||
1879 | static int rtl8169_set_features(struct net_device *dev, | 1877 | static int rtl8169_set_features(struct net_device *dev, |
@@ -1881,8 +1879,11 @@ static int rtl8169_set_features(struct net_device *dev, | |||
1881 | { | 1879 | { |
1882 | struct rtl8169_private *tp = netdev_priv(dev); | 1880 | struct rtl8169_private *tp = netdev_priv(dev); |
1883 | 1881 | ||
1882 | features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; | ||
1883 | |||
1884 | rtl_lock_work(tp); | 1884 | rtl_lock_work(tp); |
1885 | __rtl8169_set_features(dev, features); | 1885 | if (features ^ dev->features) |
1886 | __rtl8169_set_features(dev, features); | ||
1886 | rtl_unlock_work(tp); | 1887 | rtl_unlock_work(tp); |
1887 | 1888 | ||
1888 | return 0; | 1889 | return 0; |
@@ -7531,8 +7532,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp) | |||
7531 | } | 7532 | } |
7532 | } | 7533 | } |
7533 | 7534 | ||
7534 | static int | 7535 | static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
7535 | rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
7536 | { | 7536 | { |
7537 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; | 7537 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; |
7538 | const unsigned int region = cfg->region; | 7538 | const unsigned int region = cfg->region; |
@@ -7607,7 +7607,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7607 | goto err_out_mwi_2; | 7607 | goto err_out_mwi_2; |
7608 | } | 7608 | } |
7609 | 7609 | ||
7610 | tp->cp_cmd = RxChkSum; | 7610 | tp->cp_cmd = 0; |
7611 | 7611 | ||
7612 | if ((sizeof(dma_addr_t) > 4) && | 7612 | if ((sizeof(dma_addr_t) > 4) && |
7613 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | 7613 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
@@ -7648,13 +7648,6 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7648 | 7648 | ||
7649 | pci_set_master(pdev); | 7649 | pci_set_master(pdev); |
7650 | 7650 | ||
7651 | /* | ||
7652 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7653 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7654 | */ | ||
7655 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
7656 | tp->cp_cmd |= RxVlan; | ||
7657 | |||
7658 | rtl_init_mdio_ops(tp); | 7651 | rtl_init_mdio_ops(tp); |
7659 | rtl_init_pll_power_ops(tp); | 7652 | rtl_init_pll_power_ops(tp); |
7660 | rtl_init_jumbo_ops(tp); | 7653 | rtl_init_jumbo_ops(tp); |
@@ -7738,8 +7731,14 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7738 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | 7731 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | |
7739 | NETIF_F_HIGHDMA; | 7732 | NETIF_F_HIGHDMA; |
7740 | 7733 | ||
7734 | tp->cp_cmd |= RxChkSum | RxVlan; | ||
7735 | |||
7736 | /* | ||
7737 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7738 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7739 | */ | ||
7741 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | 7740 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) |
7742 | /* 8110SCd requires hardware Rx VLAN - disallow toggling */ | 7741 | /* Disallow toggling */ |
7743 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; | 7742 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; |
7744 | 7743 | ||
7745 | if (tp->txd_version == RTL_TD_0) | 7744 | if (tp->txd_version == RTL_TD_0) |
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 0537381cd2f6..6859437b59fb 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c | |||
@@ -2933,6 +2933,9 @@ void efx_farch_filter_sync_rx_mode(struct efx_nic *efx) | |||
2933 | u32 crc; | 2933 | u32 crc; |
2934 | int bit; | 2934 | int bit; |
2935 | 2935 | ||
2936 | if (!efx_dev_registered(efx)) | ||
2937 | return; | ||
2938 | |||
2936 | netif_addr_lock_bh(net_dev); | 2939 | netif_addr_lock_bh(net_dev); |
2937 | 2940 | ||
2938 | efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); | 2941 | efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); |
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 763cdfc228be..edb860947da4 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -360,14 +360,17 @@ static int vnet_walk_rx_one(struct vnet_port *port, | |||
360 | if (IS_ERR(desc)) | 360 | if (IS_ERR(desc)) |
361 | return PTR_ERR(desc); | 361 | return PTR_ERR(desc); |
362 | 362 | ||
363 | if (desc->hdr.state != VIO_DESC_READY) | ||
364 | return 1; | ||
365 | |||
366 | rmb(); | ||
367 | |||
363 | viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", | 368 | viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", |
364 | desc->hdr.state, desc->hdr.ack, | 369 | desc->hdr.state, desc->hdr.ack, |
365 | desc->size, desc->ncookies, | 370 | desc->size, desc->ncookies, |
366 | desc->cookies[0].cookie_addr, | 371 | desc->cookies[0].cookie_addr, |
367 | desc->cookies[0].cookie_size); | 372 | desc->cookies[0].cookie_size); |
368 | 373 | ||
369 | if (desc->hdr.state != VIO_DESC_READY) | ||
370 | return 1; | ||
371 | err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); | 374 | err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); |
372 | if (err == -ECONNRESET) | 375 | if (err == -ECONNRESET) |
373 | return err; | 376 | return err; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 5c3f1f3ad16f..45ba50e4eaec 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -701,6 +701,28 @@ static void cpsw_rx_handler(void *token, int len, int status) | |||
701 | cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); | 701 | cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); |
702 | 702 | ||
703 | if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { | 703 | if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { |
704 | bool ndev_status = false; | ||
705 | struct cpsw_slave *slave = priv->slaves; | ||
706 | int n; | ||
707 | |||
708 | if (priv->data.dual_emac) { | ||
709 | /* In dual emac mode check for all interfaces */ | ||
710 | for (n = priv->data.slaves; n; n--, slave++) | ||
711 | if (netif_running(slave->ndev)) | ||
712 | ndev_status = true; | ||
713 | } | ||
714 | |||
715 | if (ndev_status && (status >= 0)) { | ||
716 | /* The packet received is for the interface which | ||
717 | * is already down and the other interface is up | ||
718 | * and running, intead of freeing which results | ||
719 | * in reducing of the number of rx descriptor in | ||
720 | * DMA engine, requeue skb back to cpdma. | ||
721 | */ | ||
722 | new_skb = skb; | ||
723 | goto requeue; | ||
724 | } | ||
725 | |||
704 | /* the interface is going down, skbs are purged */ | 726 | /* the interface is going down, skbs are purged */ |
705 | dev_kfree_skb_any(skb); | 727 | dev_kfree_skb_any(skb); |
706 | return; | 728 | return; |
@@ -719,6 +741,7 @@ static void cpsw_rx_handler(void *token, int len, int status) | |||
719 | new_skb = skb; | 741 | new_skb = skb; |
720 | } | 742 | } |
721 | 743 | ||
744 | requeue: | ||
722 | ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, | 745 | ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, |
723 | skb_tailroom(new_skb), 0); | 746 | skb_tailroom(new_skb), 0); |
724 | if (WARN_ON(ret < 0)) | 747 | if (WARN_ON(ret < 0)) |
@@ -2354,10 +2377,19 @@ static int cpsw_suspend(struct device *dev) | |||
2354 | struct net_device *ndev = platform_get_drvdata(pdev); | 2377 | struct net_device *ndev = platform_get_drvdata(pdev); |
2355 | struct cpsw_priv *priv = netdev_priv(ndev); | 2378 | struct cpsw_priv *priv = netdev_priv(ndev); |
2356 | 2379 | ||
2357 | if (netif_running(ndev)) | 2380 | if (priv->data.dual_emac) { |
2358 | cpsw_ndo_stop(ndev); | 2381 | int i; |
2359 | 2382 | ||
2360 | for_each_slave(priv, soft_reset_slave); | 2383 | for (i = 0; i < priv->data.slaves; i++) { |
2384 | if (netif_running(priv->slaves[i].ndev)) | ||
2385 | cpsw_ndo_stop(priv->slaves[i].ndev); | ||
2386 | soft_reset_slave(priv->slaves + i); | ||
2387 | } | ||
2388 | } else { | ||
2389 | if (netif_running(ndev)) | ||
2390 | cpsw_ndo_stop(ndev); | ||
2391 | for_each_slave(priv, soft_reset_slave); | ||
2392 | } | ||
2361 | 2393 | ||
2362 | pm_runtime_put_sync(&pdev->dev); | 2394 | pm_runtime_put_sync(&pdev->dev); |
2363 | 2395 | ||
@@ -2371,14 +2403,24 @@ static int cpsw_resume(struct device *dev) | |||
2371 | { | 2403 | { |
2372 | struct platform_device *pdev = to_platform_device(dev); | 2404 | struct platform_device *pdev = to_platform_device(dev); |
2373 | struct net_device *ndev = platform_get_drvdata(pdev); | 2405 | struct net_device *ndev = platform_get_drvdata(pdev); |
2406 | struct cpsw_priv *priv = netdev_priv(ndev); | ||
2374 | 2407 | ||
2375 | pm_runtime_get_sync(&pdev->dev); | 2408 | pm_runtime_get_sync(&pdev->dev); |
2376 | 2409 | ||
2377 | /* Select default pin state */ | 2410 | /* Select default pin state */ |
2378 | pinctrl_pm_select_default_state(&pdev->dev); | 2411 | pinctrl_pm_select_default_state(&pdev->dev); |
2379 | 2412 | ||
2380 | if (netif_running(ndev)) | 2413 | if (priv->data.dual_emac) { |
2381 | cpsw_ndo_open(ndev); | 2414 | int i; |
2415 | |||
2416 | for (i = 0; i < priv->data.slaves; i++) { | ||
2417 | if (netif_running(priv->slaves[i].ndev)) | ||
2418 | cpsw_ndo_open(priv->slaves[i].ndev); | ||
2419 | } | ||
2420 | } else { | ||
2421 | if (netif_running(ndev)) | ||
2422 | cpsw_ndo_open(ndev); | ||
2423 | } | ||
2382 | return 0; | 2424 | return 0; |
2383 | } | 2425 | } |
2384 | 2426 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index a96955597755..726edabff26b 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/netpoll.h> | 36 | #include <linux/netpoll.h> |
37 | 37 | ||
38 | #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) | 38 | #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) |
39 | #define MACVLAN_BC_QUEUE_LEN 1000 | ||
39 | 40 | ||
40 | struct macvlan_port { | 41 | struct macvlan_port { |
41 | struct net_device *dev; | 42 | struct net_device *dev; |
@@ -248,7 +249,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port, | |||
248 | goto err; | 249 | goto err; |
249 | 250 | ||
250 | spin_lock(&port->bc_queue.lock); | 251 | spin_lock(&port->bc_queue.lock); |
251 | if (skb_queue_len(&port->bc_queue) < skb->dev->tx_queue_len) { | 252 | if (skb_queue_len(&port->bc_queue) < MACVLAN_BC_QUEUE_LEN) { |
252 | __skb_queue_tail(&port->bc_queue, nskb); | 253 | __skb_queue_tail(&port->bc_queue, nskb); |
253 | err = 0; | 254 | err = 0; |
254 | } | 255 | } |
@@ -806,6 +807,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, | |||
806 | features, | 807 | features, |
807 | mask); | 808 | mask); |
808 | features |= ALWAYS_ON_FEATURES; | 809 | features |= ALWAYS_ON_FEATURES; |
810 | features &= ~NETIF_F_NETNS_LOCAL; | ||
809 | 811 | ||
810 | return features; | 812 | return features; |
811 | } | 813 | } |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index fd0ea7c50ee6..011dbda2b2f1 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -592,8 +592,7 @@ static struct phy_driver ksphy_driver[] = { | |||
592 | .phy_id = PHY_ID_KSZ9031, | 592 | .phy_id = PHY_ID_KSZ9031, |
593 | .phy_id_mask = 0x00fffff0, | 593 | .phy_id_mask = 0x00fffff0, |
594 | .name = "Micrel KSZ9031 Gigabit PHY", | 594 | .name = "Micrel KSZ9031 Gigabit PHY", |
595 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | 595 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), |
596 | | SUPPORTED_Asym_Pause), | ||
597 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 596 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
598 | .config_init = ksz9031_config_init, | 597 | .config_init = ksz9031_config_init, |
599 | .config_aneg = genphy_config_aneg, | 598 | .config_aneg = genphy_config_aneg, |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 94032199800d..3d5c39a1e46f 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -2050,7 +2050,7 @@ static int rtl8153_enable(struct r8152 *tp) | |||
2050 | return rtl_enable(tp); | 2050 | return rtl_enable(tp); |
2051 | } | 2051 | } |
2052 | 2052 | ||
2053 | static void rtl8152_disable(struct r8152 *tp) | 2053 | static void rtl_disable(struct r8152 *tp) |
2054 | { | 2054 | { |
2055 | u32 ocp_data; | 2055 | u32 ocp_data; |
2056 | int i; | 2056 | int i; |
@@ -2291,6 +2291,13 @@ static inline void r8152b_enable_aldps(struct r8152 *tp) | |||
2291 | LINKENA | DIS_SDSAVE); | 2291 | LINKENA | DIS_SDSAVE); |
2292 | } | 2292 | } |
2293 | 2293 | ||
2294 | static void rtl8152_disable(struct r8152 *tp) | ||
2295 | { | ||
2296 | r8152b_disable_aldps(tp); | ||
2297 | rtl_disable(tp); | ||
2298 | r8152b_enable_aldps(tp); | ||
2299 | } | ||
2300 | |||
2294 | static void r8152b_hw_phy_cfg(struct r8152 *tp) | 2301 | static void r8152b_hw_phy_cfg(struct r8152 *tp) |
2295 | { | 2302 | { |
2296 | u16 data; | 2303 | u16 data; |
@@ -2301,11 +2308,8 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp) | |||
2301 | r8152_mdio_write(tp, MII_BMCR, data); | 2308 | r8152_mdio_write(tp, MII_BMCR, data); |
2302 | } | 2309 | } |
2303 | 2310 | ||
2304 | r8152b_disable_aldps(tp); | ||
2305 | |||
2306 | rtl_clear_bp(tp); | 2311 | rtl_clear_bp(tp); |
2307 | 2312 | ||
2308 | r8152b_enable_aldps(tp); | ||
2309 | set_bit(PHY_RESET, &tp->flags); | 2313 | set_bit(PHY_RESET, &tp->flags); |
2310 | } | 2314 | } |
2311 | 2315 | ||
@@ -2314,9 +2318,6 @@ static void r8152b_exit_oob(struct r8152 *tp) | |||
2314 | u32 ocp_data; | 2318 | u32 ocp_data; |
2315 | int i; | 2319 | int i; |
2316 | 2320 | ||
2317 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2318 | return; | ||
2319 | |||
2320 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); | 2321 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); |
2321 | ocp_data &= ~RCR_ACPT_ALL; | 2322 | ocp_data &= ~RCR_ACPT_ALL; |
2322 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 2323 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
@@ -2404,7 +2405,7 @@ static void r8152b_enter_oob(struct r8152 *tp) | |||
2404 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); | 2405 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); |
2405 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); | 2406 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); |
2406 | 2407 | ||
2407 | rtl8152_disable(tp); | 2408 | rtl_disable(tp); |
2408 | 2409 | ||
2409 | for (i = 0; i < 1000; i++) { | 2410 | for (i = 0; i < 1000; i++) { |
2410 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2411 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
@@ -2540,9 +2541,6 @@ static void r8153_first_init(struct r8152 *tp) | |||
2540 | u32 ocp_data; | 2541 | u32 ocp_data; |
2541 | int i; | 2542 | int i; |
2542 | 2543 | ||
2543 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2544 | return; | ||
2545 | |||
2546 | rxdy_gated_en(tp, true); | 2544 | rxdy_gated_en(tp, true); |
2547 | r8153_teredo_off(tp); | 2545 | r8153_teredo_off(tp); |
2548 | 2546 | ||
@@ -2613,7 +2611,7 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
2613 | ocp_data &= ~NOW_IS_OOB; | 2611 | ocp_data &= ~NOW_IS_OOB; |
2614 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); | 2612 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); |
2615 | 2613 | ||
2616 | rtl8152_disable(tp); | 2614 | rtl_disable(tp); |
2617 | 2615 | ||
2618 | for (i = 0; i < 1000; i++) { | 2616 | for (i = 0; i < 1000; i++) { |
2619 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2617 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
@@ -2675,6 +2673,13 @@ static void r8153_enable_aldps(struct r8152 *tp) | |||
2675 | ocp_reg_write(tp, OCP_POWER_CFG, data); | 2673 | ocp_reg_write(tp, OCP_POWER_CFG, data); |
2676 | } | 2674 | } |
2677 | 2675 | ||
2676 | static void rtl8153_disable(struct r8152 *tp) | ||
2677 | { | ||
2678 | r8153_disable_aldps(tp); | ||
2679 | rtl_disable(tp); | ||
2680 | r8153_enable_aldps(tp); | ||
2681 | } | ||
2682 | |||
2678 | static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) | 2683 | static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) |
2679 | { | 2684 | { |
2680 | u16 bmcr, anar, gbcr; | 2685 | u16 bmcr, anar, gbcr; |
@@ -2765,6 +2770,16 @@ out: | |||
2765 | return ret; | 2770 | return ret; |
2766 | } | 2771 | } |
2767 | 2772 | ||
2773 | static void rtl8152_up(struct r8152 *tp) | ||
2774 | { | ||
2775 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2776 | return; | ||
2777 | |||
2778 | r8152b_disable_aldps(tp); | ||
2779 | r8152b_exit_oob(tp); | ||
2780 | r8152b_enable_aldps(tp); | ||
2781 | } | ||
2782 | |||
2768 | static void rtl8152_down(struct r8152 *tp) | 2783 | static void rtl8152_down(struct r8152 *tp) |
2769 | { | 2784 | { |
2770 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { | 2785 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { |
@@ -2778,6 +2793,16 @@ static void rtl8152_down(struct r8152 *tp) | |||
2778 | r8152b_enable_aldps(tp); | 2793 | r8152b_enable_aldps(tp); |
2779 | } | 2794 | } |
2780 | 2795 | ||
2796 | static void rtl8153_up(struct r8152 *tp) | ||
2797 | { | ||
2798 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2799 | return; | ||
2800 | |||
2801 | r8153_disable_aldps(tp); | ||
2802 | r8153_first_init(tp); | ||
2803 | r8153_enable_aldps(tp); | ||
2804 | } | ||
2805 | |||
2781 | static void rtl8153_down(struct r8152 *tp) | 2806 | static void rtl8153_down(struct r8152 *tp) |
2782 | { | 2807 | { |
2783 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { | 2808 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { |
@@ -2996,6 +3021,8 @@ static void r8152b_init(struct r8152 *tp) | |||
2996 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3021 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
2997 | return; | 3022 | return; |
2998 | 3023 | ||
3024 | r8152b_disable_aldps(tp); | ||
3025 | |||
2999 | if (tp->version == RTL_VER_01) { | 3026 | if (tp->version == RTL_VER_01) { |
3000 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); | 3027 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); |
3001 | ocp_data &= ~LED_MODE_MASK; | 3028 | ocp_data &= ~LED_MODE_MASK; |
@@ -3034,6 +3061,7 @@ static void r8153_init(struct r8152 *tp) | |||
3034 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3061 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
3035 | return; | 3062 | return; |
3036 | 3063 | ||
3064 | r8153_disable_aldps(tp); | ||
3037 | r8153_u1u2en(tp, false); | 3065 | r8153_u1u2en(tp, false); |
3038 | 3066 | ||
3039 | for (i = 0; i < 500; i++) { | 3067 | for (i = 0; i < 500; i++) { |
@@ -3444,7 +3472,7 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3444 | ops->init = r8152b_init; | 3472 | ops->init = r8152b_init; |
3445 | ops->enable = rtl8152_enable; | 3473 | ops->enable = rtl8152_enable; |
3446 | ops->disable = rtl8152_disable; | 3474 | ops->disable = rtl8152_disable; |
3447 | ops->up = r8152b_exit_oob; | 3475 | ops->up = rtl8152_up; |
3448 | ops->down = rtl8152_down; | 3476 | ops->down = rtl8152_down; |
3449 | ops->unload = rtl8152_unload; | 3477 | ops->unload = rtl8152_unload; |
3450 | ret = 0; | 3478 | ret = 0; |
@@ -3452,8 +3480,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3452 | case PRODUCT_ID_RTL8153: | 3480 | case PRODUCT_ID_RTL8153: |
3453 | ops->init = r8153_init; | 3481 | ops->init = r8153_init; |
3454 | ops->enable = rtl8153_enable; | 3482 | ops->enable = rtl8153_enable; |
3455 | ops->disable = rtl8152_disable; | 3483 | ops->disable = rtl8153_disable; |
3456 | ops->up = r8153_first_init; | 3484 | ops->up = rtl8153_up; |
3457 | ops->down = rtl8153_down; | 3485 | ops->down = rtl8153_down; |
3458 | ops->unload = rtl8153_unload; | 3486 | ops->unload = rtl8153_unload; |
3459 | ret = 0; | 3487 | ret = 0; |
@@ -3468,8 +3496,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3468 | case PRODUCT_ID_SAMSUNG: | 3496 | case PRODUCT_ID_SAMSUNG: |
3469 | ops->init = r8153_init; | 3497 | ops->init = r8153_init; |
3470 | ops->enable = rtl8153_enable; | 3498 | ops->enable = rtl8153_enable; |
3471 | ops->disable = rtl8152_disable; | 3499 | ops->disable = rtl8153_disable; |
3472 | ops->up = r8153_first_init; | 3500 | ops->up = rtl8153_up; |
3473 | ops->down = rtl8153_down; | 3501 | ops->down = rtl8153_down; |
3474 | ops->unload = rtl8153_unload; | 3502 | ops->unload = rtl8153_unload; |
3475 | ret = 0; | 3503 | ret = 0; |
diff --git a/drivers/net/wireless/ath/ath9k/common-beacon.c b/drivers/net/wireless/ath/ath9k/common-beacon.c index 733be5178481..6ad44470d0f2 100644 --- a/drivers/net/wireless/ath/ath9k/common-beacon.c +++ b/drivers/net/wireless/ath/ath9k/common-beacon.c | |||
@@ -57,7 +57,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
57 | struct ath9k_beacon_state *bs) | 57 | struct ath9k_beacon_state *bs) |
58 | { | 58 | { |
59 | struct ath_common *common = ath9k_hw_common(ah); | 59 | struct ath_common *common = ath9k_hw_common(ah); |
60 | int dtim_intval, sleepduration; | 60 | int dtim_intval; |
61 | u64 tsf; | 61 | u64 tsf; |
62 | 62 | ||
63 | /* No need to configure beacon if we are not associated */ | 63 | /* No need to configure beacon if we are not associated */ |
@@ -75,7 +75,6 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
75 | * last beacon we received (which may be none). | 75 | * last beacon we received (which may be none). |
76 | */ | 76 | */ |
77 | dtim_intval = conf->intval * conf->dtim_period; | 77 | dtim_intval = conf->intval * conf->dtim_period; |
78 | sleepduration = ah->hw->conf.listen_interval * conf->intval; | ||
79 | 78 | ||
80 | /* | 79 | /* |
81 | * Pull nexttbtt forward to reflect the current | 80 | * Pull nexttbtt forward to reflect the current |
@@ -113,7 +112,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
113 | */ | 112 | */ |
114 | 113 | ||
115 | bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), | 114 | bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), |
116 | sleepduration)); | 115 | conf->intval)); |
117 | if (bs->bs_sleepduration > bs->bs_dtimperiod) | 116 | if (bs->bs_sleepduration > bs->bs_dtimperiod) |
118 | bs->bs_sleepduration = bs->bs_dtimperiod; | 117 | bs->bs_sleepduration = bs->bs_dtimperiod; |
119 | 118 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index bb86eb2ffc95..f0484b1b617e 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -978,7 +978,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
978 | struct ath_hw *ah = common->ah; | 978 | struct ath_hw *ah = common->ah; |
979 | struct ath_htc_rx_status *rxstatus; | 979 | struct ath_htc_rx_status *rxstatus; |
980 | struct ath_rx_status rx_stats; | 980 | struct ath_rx_status rx_stats; |
981 | bool decrypt_error; | 981 | bool decrypt_error = false; |
982 | 982 | ||
983 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { | 983 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { |
984 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", | 984 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", |
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig index b8e2561ea645..fe3dc126b149 100644 --- a/drivers/net/wireless/brcm80211/Kconfig +++ b/drivers/net/wireless/brcm80211/Kconfig | |||
@@ -27,10 +27,17 @@ config BRCMFMAC | |||
27 | one of the bus interface support. If you choose to build a module, | 27 | one of the bus interface support. If you choose to build a module, |
28 | it'll be called brcmfmac.ko. | 28 | it'll be called brcmfmac.ko. |
29 | 29 | ||
30 | config BRCMFMAC_PROTO_BCDC | ||
31 | bool | ||
32 | |||
33 | config BRCMFMAC_PROTO_MSGBUF | ||
34 | bool | ||
35 | |||
30 | config BRCMFMAC_SDIO | 36 | config BRCMFMAC_SDIO |
31 | bool "SDIO bus interface support for FullMAC driver" | 37 | bool "SDIO bus interface support for FullMAC driver" |
32 | depends on (MMC = y || MMC = BRCMFMAC) | 38 | depends on (MMC = y || MMC = BRCMFMAC) |
33 | depends on BRCMFMAC | 39 | depends on BRCMFMAC |
40 | select BRCMFMAC_PROTO_BCDC | ||
34 | select FW_LOADER | 41 | select FW_LOADER |
35 | default y | 42 | default y |
36 | ---help--- | 43 | ---help--- |
@@ -42,6 +49,7 @@ config BRCMFMAC_USB | |||
42 | bool "USB bus interface support for FullMAC driver" | 49 | bool "USB bus interface support for FullMAC driver" |
43 | depends on (USB = y || USB = BRCMFMAC) | 50 | depends on (USB = y || USB = BRCMFMAC) |
44 | depends on BRCMFMAC | 51 | depends on BRCMFMAC |
52 | select BRCMFMAC_PROTO_BCDC | ||
45 | select FW_LOADER | 53 | select FW_LOADER |
46 | ---help--- | 54 | ---help--- |
47 | This option enables the USB bus interface support for Broadcom | 55 | This option enables the USB bus interface support for Broadcom |
@@ -52,6 +60,8 @@ config BRCMFMAC_PCIE | |||
52 | bool "PCIE bus interface support for FullMAC driver" | 60 | bool "PCIE bus interface support for FullMAC driver" |
53 | depends on BRCMFMAC | 61 | depends on BRCMFMAC |
54 | depends on PCI | 62 | depends on PCI |
63 | depends on HAS_DMA | ||
64 | select BRCMFMAC_PROTO_MSGBUF | ||
55 | select FW_LOADER | 65 | select FW_LOADER |
56 | ---help--- | 66 | ---help--- |
57 | This option enables the PCIE bus interface support for Broadcom | 67 | This option enables the PCIE bus interface support for Broadcom |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/brcm80211/brcmfmac/Makefile index c35adf4bc70b..90a977fe9a64 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile | |||
@@ -30,16 +30,18 @@ brcmfmac-objs += \ | |||
30 | fwsignal.o \ | 30 | fwsignal.o \ |
31 | p2p.o \ | 31 | p2p.o \ |
32 | proto.o \ | 32 | proto.o \ |
33 | bcdc.o \ | ||
34 | commonring.o \ | ||
35 | flowring.o \ | ||
36 | msgbuf.o \ | ||
37 | dhd_common.o \ | 33 | dhd_common.o \ |
38 | dhd_linux.o \ | 34 | dhd_linux.o \ |
39 | firmware.o \ | 35 | firmware.o \ |
40 | feature.o \ | 36 | feature.o \ |
41 | btcoex.o \ | 37 | btcoex.o \ |
42 | vendor.o | 38 | vendor.o |
39 | brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \ | ||
40 | bcdc.o | ||
41 | brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \ | ||
42 | commonring.o \ | ||
43 | flowring.o \ | ||
44 | msgbuf.o | ||
43 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ | 45 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ |
44 | dhd_sdio.o \ | 46 | dhd_sdio.o \ |
45 | bcmsdh.o | 47 | bcmsdh.o |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h index 17e8c039ff32..6003179c0ceb 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h | |||
@@ -16,9 +16,12 @@ | |||
16 | #ifndef BRCMFMAC_BCDC_H | 16 | #ifndef BRCMFMAC_BCDC_H |
17 | #define BRCMFMAC_BCDC_H | 17 | #define BRCMFMAC_BCDC_H |
18 | 18 | ||
19 | 19 | #ifdef CONFIG_BRCMFMAC_PROTO_BCDC | |
20 | int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); | 20 | int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); |
21 | void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); | 21 | void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); |
22 | 22 | #else | |
23 | static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } | ||
24 | static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} | ||
25 | #endif | ||
23 | 26 | ||
24 | #endif /* BRCMFMAC_BCDC_H */ | 27 | #endif /* BRCMFMAC_BCDC_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 4f1daabc551b..44fc85f68f7a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c | |||
@@ -185,7 +185,13 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, | 185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, |
186 | ifevent->flags, ifevent->role); | 186 | ifevent->flags, ifevent->role); |
187 | 187 | ||
188 | if (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) { | 188 | /* The P2P Device interface event must not be ignored |
189 | * contrary to what firmware tells us. The only way to | ||
190 | * distinguish the P2P Device is by looking at the ifidx | ||
191 | * and bssidx received. | ||
192 | */ | ||
193 | if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) && | ||
194 | (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) { | ||
189 | brcmf_dbg(EVENT, "event can be ignored\n"); | 195 | brcmf_dbg(EVENT, "event can be ignored\n"); |
190 | return; | 196 | return; |
191 | } | 197 | } |
@@ -210,12 +216,12 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
210 | return; | 216 | return; |
211 | } | 217 | } |
212 | 218 | ||
213 | if (ifevent->action == BRCMF_E_IF_CHANGE) | 219 | if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) |
214 | brcmf_fws_reset_interface(ifp); | 220 | brcmf_fws_reset_interface(ifp); |
215 | 221 | ||
216 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); | 222 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); |
217 | 223 | ||
218 | if (ifevent->action == BRCMF_E_IF_DEL) { | 224 | if (ifp && ifevent->action == BRCMF_E_IF_DEL) { |
219 | brcmf_fws_del_interface(ifp); | 225 | brcmf_fws_del_interface(ifp); |
220 | brcmf_del_if(drvr, ifevent->bssidx); | 226 | brcmf_del_if(drvr, ifevent->bssidx); |
221 | } | 227 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h index dd20b1862d44..cbf033f59109 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h | |||
@@ -172,6 +172,8 @@ enum brcmf_fweh_event_code { | |||
172 | #define BRCMF_E_IF_ROLE_STA 0 | 172 | #define BRCMF_E_IF_ROLE_STA 0 |
173 | #define BRCMF_E_IF_ROLE_AP 1 | 173 | #define BRCMF_E_IF_ROLE_AP 1 |
174 | #define BRCMF_E_IF_ROLE_WDS 2 | 174 | #define BRCMF_E_IF_ROLE_WDS 2 |
175 | #define BRCMF_E_IF_ROLE_P2P_GO 3 | ||
176 | #define BRCMF_E_IF_ROLE_P2P_CLIENT 4 | ||
175 | 177 | ||
176 | /** | 178 | /** |
177 | * definitions for event packet validation. | 179 | * definitions for event packet validation. |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h index f901ae52bf2b..77a51b8c1e12 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #ifndef BRCMFMAC_MSGBUF_H | 15 | #ifndef BRCMFMAC_MSGBUF_H |
16 | #define BRCMFMAC_MSGBUF_H | 16 | #define BRCMFMAC_MSGBUF_H |
17 | 17 | ||
18 | #ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF | ||
18 | 19 | ||
19 | #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 | 20 | #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 |
20 | #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 | 21 | #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 |
@@ -32,9 +33,15 @@ | |||
32 | 33 | ||
33 | 34 | ||
34 | int brcmf_proto_msgbuf_rx_trigger(struct device *dev); | 35 | int brcmf_proto_msgbuf_rx_trigger(struct device *dev); |
36 | void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); | ||
35 | int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); | 37 | int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); |
36 | void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); | 38 | void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); |
37 | void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); | 39 | #else |
38 | 40 | static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) | |
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {} | ||
45 | #endif | ||
39 | 46 | ||
40 | #endif /* BRCMFMAC_MSGBUF_H */ | 47 | #endif /* BRCMFMAC_MSGBUF_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 12a60ca1462a..54fc1a1cb4f7 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -497,8 +497,11 @@ brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable) | |||
497 | static void | 497 | static void |
498 | brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) | 498 | brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) |
499 | { | 499 | { |
500 | struct net_device *ndev = wdev->netdev; | 500 | struct brcmf_cfg80211_vif *vif; |
501 | struct brcmf_if *ifp = netdev_priv(ndev); | 501 | struct brcmf_if *ifp; |
502 | |||
503 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); | ||
504 | ifp = vif->ifp; | ||
502 | 505 | ||
503 | if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || | 506 | if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || |
504 | (wdev->iftype == NL80211_IFTYPE_AP) || | 507 | (wdev->iftype == NL80211_IFTYPE_AP) || |
@@ -5149,6 +5152,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) | |||
5149 | 5152 | ||
5150 | ch.band = BRCMU_CHAN_BAND_2G; | 5153 | ch.band = BRCMU_CHAN_BAND_2G; |
5151 | ch.bw = BRCMU_CHAN_BW_40; | 5154 | ch.bw = BRCMU_CHAN_BW_40; |
5155 | ch.sb = BRCMU_CHAN_SB_NONE; | ||
5152 | ch.chnum = 0; | 5156 | ch.chnum = 0; |
5153 | cfg->d11inf.encchspec(&ch); | 5157 | cfg->d11inf.encchspec(&ch); |
5154 | 5158 | ||
@@ -5182,6 +5186,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) | |||
5182 | 5186 | ||
5183 | brcmf_update_bw40_channel_flag(&band->channels[j], &ch); | 5187 | brcmf_update_bw40_channel_flag(&band->channels[j], &ch); |
5184 | } | 5188 | } |
5189 | kfree(pbuf); | ||
5185 | } | 5190 | } |
5186 | return err; | 5191 | return err; |
5187 | } | 5192 | } |
diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c index 760c45c34ef3..1513dbc79c14 100644 --- a/drivers/net/wireless/iwlwifi/dvm/power.c +++ b/drivers/net/wireless/iwlwifi/dvm/power.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "commands.h" | 40 | #include "commands.h" |
41 | #include "power.h" | 41 | #include "power.h" |
42 | 42 | ||
43 | static bool force_cam; | 43 | static bool force_cam = true; |
44 | module_param(force_cam, bool, 0644); | 44 | module_param(force_cam, bool, 0644); |
45 | MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); | 45 | MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); |
46 | 46 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 7e26d0dbfcf7..8e99dffa88e8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -85,6 +85,8 @@ | |||
85 | #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ | 85 | #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ |
86 | #define IWL3160_NVM_VERSION 0x709 | 86 | #define IWL3160_NVM_VERSION 0x709 |
87 | #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ | 87 | #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ |
88 | #define IWL3165_NVM_VERSION 0x709 | ||
89 | #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */ | ||
88 | #define IWL7265_NVM_VERSION 0x0a1d | 90 | #define IWL7265_NVM_VERSION 0x0a1d |
89 | #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ | 91 | #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ |
90 | 92 | ||
@@ -94,6 +96,9 @@ | |||
94 | #define IWL3160_FW_PRE "iwlwifi-3160-" | 96 | #define IWL3160_FW_PRE "iwlwifi-3160-" |
95 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" | 97 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" |
96 | 98 | ||
99 | #define IWL3165_FW_PRE "iwlwifi-3165-" | ||
100 | #define IWL3165_MODULE_FIRMWARE(api) IWL3165_FW_PRE __stringify(api) ".ucode" | ||
101 | |||
97 | #define IWL7265_FW_PRE "iwlwifi-7265-" | 102 | #define IWL7265_FW_PRE "iwlwifi-7265-" |
98 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" | 103 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" |
99 | 104 | ||
@@ -215,6 +220,16 @@ static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = { | |||
215 | {0}, | 220 | {0}, |
216 | }; | 221 | }; |
217 | 222 | ||
223 | const struct iwl_cfg iwl3165_2ac_cfg = { | ||
224 | .name = "Intel(R) Dual Band Wireless AC 3165", | ||
225 | .fw_name_pre = IWL3165_FW_PRE, | ||
226 | IWL_DEVICE_7000, | ||
227 | .ht_params = &iwl7000_ht_params, | ||
228 | .nvm_ver = IWL3165_NVM_VERSION, | ||
229 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, | ||
230 | .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, | ||
231 | }; | ||
232 | |||
218 | const struct iwl_cfg iwl7265_2ac_cfg = { | 233 | const struct iwl_cfg iwl7265_2ac_cfg = { |
219 | .name = "Intel(R) Dual Band Wireless AC 7265", | 234 | .name = "Intel(R) Dual Band Wireless AC 7265", |
220 | .fw_name_pre = IWL7265_FW_PRE, | 235 | .fw_name_pre = IWL7265_FW_PRE, |
@@ -247,4 +262,5 @@ const struct iwl_cfg iwl7265_n_cfg = { | |||
247 | 262 | ||
248 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 263 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
249 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | 264 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
265 | MODULE_FIRMWARE(IWL3165_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | ||
250 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 266 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 8da596db9abe..3d7cc37420ae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -120,6 +120,8 @@ enum iwl_led_mode { | |||
120 | #define IWL_LONG_WD_TIMEOUT 10000 | 120 | #define IWL_LONG_WD_TIMEOUT 10000 |
121 | #define IWL_MAX_WD_TIMEOUT 120000 | 121 | #define IWL_MAX_WD_TIMEOUT 120000 |
122 | 122 | ||
123 | #define IWL_DEFAULT_MAX_TX_POWER 22 | ||
124 | |||
123 | /* Antenna presence definitions */ | 125 | /* Antenna presence definitions */ |
124 | #define ANT_NONE 0x0 | 126 | #define ANT_NONE 0x0 |
125 | #define ANT_A BIT(0) | 127 | #define ANT_A BIT(0) |
@@ -335,6 +337,7 @@ extern const struct iwl_cfg iwl7260_n_cfg; | |||
335 | extern const struct iwl_cfg iwl3160_2ac_cfg; | 337 | extern const struct iwl_cfg iwl3160_2ac_cfg; |
336 | extern const struct iwl_cfg iwl3160_2n_cfg; | 338 | extern const struct iwl_cfg iwl3160_2n_cfg; |
337 | extern const struct iwl_cfg iwl3160_n_cfg; | 339 | extern const struct iwl_cfg iwl3160_n_cfg; |
340 | extern const struct iwl_cfg iwl3165_2ac_cfg; | ||
338 | extern const struct iwl_cfg iwl7265_2ac_cfg; | 341 | extern const struct iwl_cfg iwl7265_2ac_cfg; |
339 | extern const struct iwl_cfg iwl7265_2n_cfg; | 342 | extern const struct iwl_cfg iwl7265_2n_cfg; |
340 | extern const struct iwl_cfg iwl7265_n_cfg; | 343 | extern const struct iwl_cfg iwl7265_n_cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 8e7af798abd1..40718f814f8d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -148,8 +148,6 @@ static const u8 iwl_nvm_channels_family_8000[] = { | |||
148 | #define LAST_2GHZ_HT_PLUS 9 | 148 | #define LAST_2GHZ_HT_PLUS 9 |
149 | #define LAST_5GHZ_HT 161 | 149 | #define LAST_5GHZ_HT 161 |
150 | 150 | ||
151 | #define DEFAULT_MAX_TX_POWER 16 | ||
152 | |||
153 | /* rate data (static) */ | 151 | /* rate data (static) */ |
154 | static struct ieee80211_rate iwl_cfg80211_rates[] = { | 152 | static struct ieee80211_rate iwl_cfg80211_rates[] = { |
155 | { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, | 153 | { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, |
@@ -297,7 +295,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
297 | * Default value - highest tx power value. max_power | 295 | * Default value - highest tx power value. max_power |
298 | * is not used in mvm, and is used for backwards compatibility | 296 | * is not used in mvm, and is used for backwards compatibility |
299 | */ | 297 | */ |
300 | channel->max_power = DEFAULT_MAX_TX_POWER; | 298 | channel->max_power = IWL_DEFAULT_MAX_TX_POWER; |
301 | is_5ghz = channel->band == IEEE80211_BAND_5GHZ; | 299 | is_5ghz = channel->band == IEEE80211_BAND_5GHZ; |
302 | IWL_DEBUG_EEPROM(dev, | 300 | IWL_DEBUG_EEPROM(dev, |
303 | "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", | 301 | "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 2262d6dc61ae..6e8f3e2aef74 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -587,8 +587,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
587 | lockdep_assert_held(&mvm->mutex); | 587 | lockdep_assert_held(&mvm->mutex); |
588 | 588 | ||
589 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { | 589 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { |
590 | u32 mode; | ||
591 | |||
592 | switch (mvm->bt_force_ant_mode) { | 590 | switch (mvm->bt_force_ant_mode) { |
593 | case BT_FORCE_ANT_BT: | 591 | case BT_FORCE_ANT_BT: |
594 | mode = BT_COEX_BT; | 592 | mode = BT_COEX_BT; |
@@ -758,7 +756,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
758 | struct iwl_bt_iterator_data *data = _data; | 756 | struct iwl_bt_iterator_data *data = _data; |
759 | struct iwl_mvm *mvm = data->mvm; | 757 | struct iwl_mvm *mvm = data->mvm; |
760 | struct ieee80211_chanctx_conf *chanctx_conf; | 758 | struct ieee80211_chanctx_conf *chanctx_conf; |
761 | enum ieee80211_smps_mode smps_mode; | 759 | /* default smps_mode is AUTOMATIC - only used for client modes */ |
760 | enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
762 | u32 bt_activity_grading; | 761 | u32 bt_activity_grading; |
763 | int ave_rssi; | 762 | int ave_rssi; |
764 | 763 | ||
@@ -766,8 +765,6 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
766 | 765 | ||
767 | switch (vif->type) { | 766 | switch (vif->type) { |
768 | case NL80211_IFTYPE_STATION: | 767 | case NL80211_IFTYPE_STATION: |
769 | /* default smps_mode for BSS / P2P client is AUTOMATIC */ | ||
770 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
771 | break; | 768 | break; |
772 | case NL80211_IFTYPE_AP: | 769 | case NL80211_IFTYPE_AP: |
773 | if (!mvmvif->ap_ibss_active) | 770 | if (!mvmvif->ap_ibss_active) |
@@ -799,7 +796,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
799 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) | 796 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) |
800 | smps_mode = IEEE80211_SMPS_DYNAMIC; | 797 | smps_mode = IEEE80211_SMPS_DYNAMIC; |
801 | 798 | ||
802 | /* relax SMPS contraints for next association */ | 799 | /* relax SMPS constraints for next association */ |
803 | if (!vif->bss_conf.assoc) | 800 | if (!vif->bss_conf.assoc) |
804 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 801 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
805 | 802 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c index d919b4ebc83c..9aa2311a776c 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | |||
@@ -76,8 +76,7 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm, | |||
76 | 76 | ||
77 | switch (param) { | 77 | switch (param) { |
78 | case MVM_DEBUGFS_PM_KEEP_ALIVE: { | 78 | case MVM_DEBUGFS_PM_KEEP_ALIVE: { |
79 | struct ieee80211_hw *hw = mvm->hw; | 79 | int dtimper = vif->bss_conf.dtim_period ?: 1; |
80 | int dtimper = hw->conf.ps_dtim_period ?: 1; | ||
81 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; | 80 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
82 | 81 | ||
83 | IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); | 82 | IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 9c975f9ecfcb..541b844c6b5d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -1603,14 +1603,14 @@ enum iwl_sf_scenario { | |||
1603 | 1603 | ||
1604 | /** | 1604 | /** |
1605 | * Smart Fifo configuration command. | 1605 | * Smart Fifo configuration command. |
1606 | * @state: smart fifo state, types listed in iwl_sf_sate. | 1606 | * @state: smart fifo state, types listed in enum %iwl_sf_sate. |
1607 | * @watermark: Minimum allowed availabe free space in RXF for transient state. | 1607 | * @watermark: Minimum allowed availabe free space in RXF for transient state. |
1608 | * @long_delay_timeouts: aging and idle timer values for each scenario | 1608 | * @long_delay_timeouts: aging and idle timer values for each scenario |
1609 | * in long delay state. | 1609 | * in long delay state. |
1610 | * @full_on_timeouts: timer values for each scenario in full on state. | 1610 | * @full_on_timeouts: timer values for each scenario in full on state. |
1611 | */ | 1611 | */ |
1612 | struct iwl_sf_cfg_cmd { | 1612 | struct iwl_sf_cfg_cmd { |
1613 | enum iwl_sf_state state; | 1613 | __le32 state; |
1614 | __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; | 1614 | __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; |
1615 | __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; | 1615 | __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; |
1616 | __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; | 1616 | __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 9cbb192f680e..158aed501473 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -727,11 +727,6 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, | |||
727 | !force_assoc_off) { | 727 | !force_assoc_off) { |
728 | u32 dtim_offs; | 728 | u32 dtim_offs; |
729 | 729 | ||
730 | /* Allow beacons to pass through as long as we are not | ||
731 | * associated, or we do not have dtim period information. | ||
732 | */ | ||
733 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
734 | |||
735 | /* | 730 | /* |
736 | * The DTIM count counts down, so when it is N that means N | 731 | * The DTIM count counts down, so when it is N that means N |
737 | * more beacon intervals happen until the DTIM TBTT. Therefore | 732 | * more beacon intervals happen until the DTIM TBTT. Therefore |
@@ -765,6 +760,11 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, | |||
765 | ctxt_sta->is_assoc = cpu_to_le32(1); | 760 | ctxt_sta->is_assoc = cpu_to_le32(1); |
766 | } else { | 761 | } else { |
767 | ctxt_sta->is_assoc = cpu_to_le32(0); | 762 | ctxt_sta->is_assoc = cpu_to_le32(0); |
763 | |||
764 | /* Allow beacons to pass through as long as we are not | ||
765 | * associated, or we do not have dtim period information. | ||
766 | */ | ||
767 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
768 | } | 768 | } |
769 | 769 | ||
770 | ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); | 770 | ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 8d1d4b40b0a3..069bb8e81c36 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -398,12 +398,14 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
398 | else | 398 | else |
399 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 399 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
400 | 400 | ||
401 | /* TODO: enable that only for firmwares that don't crash */ | 401 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 10) { |
402 | /* hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; */ | 402 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
403 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; | 403 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; |
404 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; | 404 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; |
405 | /* we create the 802.11 header and zero length SSID IE. */ | 405 | /* we create the 802.11 header and zero length SSID IE. */ |
406 | hw->wiphy->max_sched_scan_ie_len = SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | 406 | hw->wiphy->max_sched_scan_ie_len = |
407 | SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | ||
408 | } | ||
407 | 409 | ||
408 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | 410 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | |
409 | NL80211_FEATURE_LOW_PRIORITY_SCAN | | 411 | NL80211_FEATURE_LOW_PRIORITY_SCAN | |
@@ -1544,11 +1546,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1544 | */ | 1546 | */ |
1545 | iwl_mvm_remove_time_event(mvm, mvmvif, | 1547 | iwl_mvm_remove_time_event(mvm, mvmvif, |
1546 | &mvmvif->time_event_data); | 1548 | &mvmvif->time_event_data); |
1547 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | | ||
1548 | BSS_CHANGED_QOS)) { | ||
1549 | ret = iwl_mvm_power_update_mac(mvm); | ||
1550 | if (ret) | ||
1551 | IWL_ERR(mvm, "failed to update power mode\n"); | ||
1552 | } | 1549 | } |
1553 | 1550 | ||
1554 | if (changes & BSS_CHANGED_BEACON_INFO) { | 1551 | if (changes & BSS_CHANGED_BEACON_INFO) { |
@@ -1556,6 +1553,12 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1556 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); | 1553 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); |
1557 | } | 1554 | } |
1558 | 1555 | ||
1556 | if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | BSS_CHANGED_QOS)) { | ||
1557 | ret = iwl_mvm_power_update_mac(mvm); | ||
1558 | if (ret) | ||
1559 | IWL_ERR(mvm, "failed to update power mode\n"); | ||
1560 | } | ||
1561 | |||
1559 | if (changes & BSS_CHANGED_TXPOWER) { | 1562 | if (changes & BSS_CHANGED_TXPOWER) { |
1560 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", | 1563 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", |
1561 | bss_conf->txpower); | 1564 | bss_conf->txpower); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index e7a6626fe839..5a29c193b72a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c | |||
@@ -290,7 +290,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
290 | struct ieee80211_vif *vif, | 290 | struct ieee80211_vif *vif, |
291 | struct iwl_mac_power_cmd *cmd) | 291 | struct iwl_mac_power_cmd *cmd) |
292 | { | 292 | { |
293 | struct ieee80211_hw *hw = mvm->hw; | ||
294 | struct ieee80211_chanctx_conf *chanctx_conf; | 293 | struct ieee80211_chanctx_conf *chanctx_conf; |
295 | struct ieee80211_channel *chan; | 294 | struct ieee80211_channel *chan; |
296 | int dtimper, dtimper_msec; | 295 | int dtimper, dtimper_msec; |
@@ -301,7 +300,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
301 | 300 | ||
302 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, | 301 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
303 | mvmvif->color)); | 302 | mvmvif->color)); |
304 | dtimper = hw->conf.ps_dtim_period ?: 1; | 303 | dtimper = vif->bss_conf.dtim_period; |
305 | 304 | ||
306 | /* | 305 | /* |
307 | * Regardless of power management state the driver must set | 306 | * Regardless of power management state the driver must set |
@@ -963,7 +962,7 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, | |||
963 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); | 962 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); |
964 | if (enable) { | 963 | if (enable) { |
965 | /* configure skip over dtim up to 300 msec */ | 964 | /* configure skip over dtim up to 300 msec */ |
966 | int dtimper = mvm->hw->conf.ps_dtim_period ?: 1; | 965 | int dtimper = vif->bss_conf.dtim_period ?: 1; |
967 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; | 966 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
968 | 967 | ||
969 | if (WARN_ON(!dtimper_msec)) | 968 | if (WARN_ON(!dtimper_msec)) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c index 48144e3ad527..a6cb84ed653f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/iwlwifi/mvm/rx.c | |||
@@ -151,13 +151,13 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm, | |||
151 | le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); | 151 | le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); |
152 | energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> | 152 | energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> |
153 | IWL_RX_INFO_ENERGY_ANT_A_POS; | 153 | IWL_RX_INFO_ENERGY_ANT_A_POS; |
154 | energy_a = energy_a ? -energy_a : -256; | 154 | energy_a = energy_a ? -energy_a : S8_MIN; |
155 | energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> | 155 | energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> |
156 | IWL_RX_INFO_ENERGY_ANT_B_POS; | 156 | IWL_RX_INFO_ENERGY_ANT_B_POS; |
157 | energy_b = energy_b ? -energy_b : -256; | 157 | energy_b = energy_b ? -energy_b : S8_MIN; |
158 | energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> | 158 | energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> |
159 | IWL_RX_INFO_ENERGY_ANT_C_POS; | 159 | IWL_RX_INFO_ENERGY_ANT_C_POS; |
160 | energy_c = energy_c ? -energy_c : -256; | 160 | energy_c = energy_c ? -energy_c : S8_MIN; |
161 | max_energy = max(energy_a, energy_b); | 161 | max_energy = max(energy_a, energy_b); |
162 | max_energy = max(max_energy, energy_c); | 162 | max_energy = max(max_energy, energy_c); |
163 | 163 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c index d1922afe06f4..f88410c7cbfb 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/iwlwifi/mvm/sf.c | |||
@@ -174,7 +174,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, | |||
174 | enum iwl_sf_state new_state) | 174 | enum iwl_sf_state new_state) |
175 | { | 175 | { |
176 | struct iwl_sf_cfg_cmd sf_cmd = { | 176 | struct iwl_sf_cfg_cmd sf_cmd = { |
177 | .state = new_state, | 177 | .state = cpu_to_le32(new_state), |
178 | }; | 178 | }; |
179 | struct ieee80211_sta *sta; | 179 | struct ieee80211_sta *sta; |
180 | int ret = 0; | 180 | int ret = 0; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 963edb8656ad..ed0919465e0e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -170,10 +170,14 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, | |||
170 | 170 | ||
171 | /* | 171 | /* |
172 | * for data packets, rate info comes from the table inside the fw. This | 172 | * for data packets, rate info comes from the table inside the fw. This |
173 | * table is controlled by LINK_QUALITY commands | 173 | * table is controlled by LINK_QUALITY commands. Exclude ctrl port |
174 | * frames like EAPOLs which should be treated as mgmt frames. This | ||
175 | * avoids them being sent initially in high rates which increases the | ||
176 | * chances for completion of the 4-Way handshake. | ||
174 | */ | 177 | */ |
175 | 178 | ||
176 | if (ieee80211_is_data(fc) && sta) { | 179 | if (ieee80211_is_data(fc) && sta && |
180 | !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { | ||
177 | tx_cmd->initial_rate_index = 0; | 181 | tx_cmd->initial_rate_index = 0; |
178 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); | 182 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); |
179 | return; | 183 | return; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index dbbbf23082a2..b9d5049e52da 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -354,11 +354,17 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
354 | {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, | 354 | {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, |
355 | {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, | 355 | {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, |
356 | {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, | 356 | {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, |
357 | {IWL_PCI_DEVICE(0x08B4, 0x8370, iwl3160_2ac_cfg)}, | ||
358 | {IWL_PCI_DEVICE(0x08B4, 0x8272, iwl3160_2ac_cfg)}, | ||
357 | {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, | 359 | {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, |
358 | {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, | 360 | {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, |
359 | {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, | 361 | {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, |
360 | {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, | 362 | {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, |
361 | 363 | ||
364 | /* 3165 Series */ | ||
365 | {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, | ||
366 | {IWL_PCI_DEVICE(0x3165, 0x4210, iwl3165_2ac_cfg)}, | ||
367 | |||
362 | /* 7265 Series */ | 368 | /* 7265 Series */ |
363 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, | 369 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, |
364 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, | 370 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, |
@@ -380,6 +386,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
380 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, | 386 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, |
381 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, | 387 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, |
382 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, | 388 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, |
389 | {IWL_PCI_DEVICE(0x095A, 0x900A, iwl7265_2ac_cfg)}, | ||
383 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, | 390 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
384 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, | 391 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
385 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | 392 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 9dd63b822025..e9bf2f47b61a 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -510,7 +510,7 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt, | |||
510 | 510 | ||
511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); | 511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); |
512 | 512 | ||
513 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 513 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
514 | num_qps_mw = nt->max_qps / mw_max + 1; | 514 | num_qps_mw = nt->max_qps / mw_max + 1; |
515 | else | 515 | else |
516 | num_qps_mw = nt->max_qps / mw_max; | 516 | num_qps_mw = nt->max_qps / mw_max; |
@@ -576,6 +576,19 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) | |||
576 | return -ENOMEM; | 576 | return -ENOMEM; |
577 | } | 577 | } |
578 | 578 | ||
579 | /* | ||
580 | * we must ensure that the memory address allocated is BAR size | ||
581 | * aligned in order for the XLAT register to take the value. This | ||
582 | * is a requirement of the hardware. It is recommended to setup CMA | ||
583 | * for BAR sizes equal or greater than 4MB. | ||
584 | */ | ||
585 | if (!IS_ALIGNED(mw->dma_addr, mw->size)) { | ||
586 | dev_err(&pdev->dev, "DMA memory %pad not aligned to BAR size\n", | ||
587 | &mw->dma_addr); | ||
588 | ntb_free_mw(nt, num_mw); | ||
589 | return -ENOMEM; | ||
590 | } | ||
591 | |||
579 | /* Notify HW the memory location of the receive buffer */ | 592 | /* Notify HW the memory location of the receive buffer */ |
580 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); | 593 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); |
581 | 594 | ||
@@ -856,7 +869,7 @@ static int ntb_transport_init_queue(struct ntb_transport *nt, | |||
856 | qp->client_ready = NTB_LINK_DOWN; | 869 | qp->client_ready = NTB_LINK_DOWN; |
857 | qp->event_handler = NULL; | 870 | qp->event_handler = NULL; |
858 | 871 | ||
859 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 872 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
860 | num_qps_mw = nt->max_qps / mw_max + 1; | 873 | num_qps_mw = nt->max_qps / mw_max + 1; |
861 | else | 874 | else |
862 | num_qps_mw = nt->max_qps / mw_max; | 875 | num_qps_mw = nt->max_qps / mw_max; |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 9eae9834bcc7..a0580afe1713 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -913,7 +913,7 @@ static int __init dino_probe(struct parisc_device *dev) | |||
913 | printk("%s version %s found at 0x%lx\n", name, version, hpa); | 913 | printk("%s version %s found at 0x%lx\n", name, version, hpa); |
914 | 914 | ||
915 | if (!request_mem_region(hpa, PAGE_SIZE, name)) { | 915 | if (!request_mem_region(hpa, PAGE_SIZE, name)) { |
916 | printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%ld)!\n", | 916 | printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%lx)!\n", |
917 | hpa); | 917 | hpa); |
918 | return 1; | 918 | return 1; |
919 | } | 919 | } |
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index a568efaa331c..35fc73a8d0b3 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -49,6 +49,9 @@ struct imx6_pcie { | |||
49 | 49 | ||
50 | /* PCIe Port Logic registers (memory-mapped) */ | 50 | /* PCIe Port Logic registers (memory-mapped) */ |
51 | #define PL_OFFSET 0x700 | 51 | #define PL_OFFSET 0x700 |
52 | #define PCIE_PL_PFLR (PL_OFFSET + 0x08) | ||
53 | #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) | ||
54 | #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) | ||
52 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) | 55 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) |
53 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) | 56 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) |
54 | #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) | 57 | #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) |
@@ -214,6 +217,32 @@ static int imx6q_pcie_abort_handler(unsigned long addr, | |||
214 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) | 217 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) |
215 | { | 218 | { |
216 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | 219 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); |
220 | u32 val, gpr1, gpr12; | ||
221 | |||
222 | /* | ||
223 | * If the bootloader already enabled the link we need some special | ||
224 | * handling to get the core back into a state where it is safe to | ||
225 | * touch it for configuration. As there is no dedicated reset signal | ||
226 | * wired up for MX6QDL, we need to manually force LTSSM into "detect" | ||
227 | * state before completely disabling LTSSM, which is a prerequisite | ||
228 | * for core configuration. | ||
229 | * | ||
230 | * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong | ||
231 | * indication that the bootloader activated the link. | ||
232 | */ | ||
233 | regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1); | ||
234 | regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12); | ||
235 | |||
236 | if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) && | ||
237 | (gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) { | ||
238 | val = readl(pp->dbi_base + PCIE_PL_PFLR); | ||
239 | val &= ~PCIE_PL_PFLR_LINK_STATE_MASK; | ||
240 | val |= PCIE_PL_PFLR_FORCE_LINK; | ||
241 | writel(val, pp->dbi_base + PCIE_PL_PFLR); | ||
242 | |||
243 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
244 | IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); | ||
245 | } | ||
217 | 246 | ||
218 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 247 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
219 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); | 248 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); |
@@ -589,6 +618,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) | |||
589 | return 0; | 618 | return 0; |
590 | } | 619 | } |
591 | 620 | ||
621 | static void imx6_pcie_shutdown(struct platform_device *pdev) | ||
622 | { | ||
623 | struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); | ||
624 | |||
625 | /* bring down link, so bootloader gets clean state in case of reboot */ | ||
626 | imx6_pcie_assert_core_reset(&imx6_pcie->pp); | ||
627 | } | ||
628 | |||
592 | static const struct of_device_id imx6_pcie_of_match[] = { | 629 | static const struct of_device_id imx6_pcie_of_match[] = { |
593 | { .compatible = "fsl,imx6q-pcie", }, | 630 | { .compatible = "fsl,imx6q-pcie", }, |
594 | {}, | 631 | {}, |
@@ -601,6 +638,7 @@ static struct platform_driver imx6_pcie_driver = { | |||
601 | .owner = THIS_MODULE, | 638 | .owner = THIS_MODULE, |
602 | .of_match_table = imx6_pcie_of_match, | 639 | .of_match_table = imx6_pcie_of_match, |
603 | }, | 640 | }, |
641 | .shutdown = imx6_pcie_shutdown, | ||
604 | }; | 642 | }; |
605 | 643 | ||
606 | /* Freescale PCIe driver does not allow module unload */ | 644 | /* Freescale PCIe driver does not allow module unload */ |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 70741c8c46a0..6cd5160fc057 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -560,19 +560,15 @@ static void disable_slot(struct acpiphp_slot *slot) | |||
560 | slot->flags &= (~SLOT_ENABLED); | 560 | slot->flags &= (~SLOT_ENABLED); |
561 | } | 561 | } |
562 | 562 | ||
563 | static bool acpiphp_no_hotplug(struct acpi_device *adev) | ||
564 | { | ||
565 | return adev && adev->flags.no_hotplug; | ||
566 | } | ||
567 | |||
568 | static bool slot_no_hotplug(struct acpiphp_slot *slot) | 563 | static bool slot_no_hotplug(struct acpiphp_slot *slot) |
569 | { | 564 | { |
570 | struct acpiphp_func *func; | 565 | struct pci_bus *bus = slot->bus; |
566 | struct pci_dev *dev; | ||
571 | 567 | ||
572 | list_for_each_entry(func, &slot->funcs, sibling) | 568 | list_for_each_entry(dev, &bus->devices, bus_list) { |
573 | if (acpiphp_no_hotplug(func_to_acpi_device(func))) | 569 | if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug) |
574 | return true; | 570 | return true; |
575 | 571 | } | |
576 | return false; | 572 | return false; |
577 | } | 573 | } |
578 | 574 | ||
@@ -645,7 +641,7 @@ static void trim_stale_devices(struct pci_dev *dev) | |||
645 | 641 | ||
646 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); | 642 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); |
647 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) | 643 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) |
648 | || acpiphp_no_hotplug(adev); | 644 | || dev->ignore_hotplug; |
649 | } | 645 | } |
650 | if (!alive) | 646 | if (!alive) |
651 | alive = pci_device_is_present(dev); | 647 | alive = pci_device_is_present(dev); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 9da84b8b27d8..5e01ae39ec46 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -506,6 +506,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
506 | { | 506 | { |
507 | struct controller *ctrl = (struct controller *)dev_id; | 507 | struct controller *ctrl = (struct controller *)dev_id; |
508 | struct pci_dev *pdev = ctrl_dev(ctrl); | 508 | struct pci_dev *pdev = ctrl_dev(ctrl); |
509 | struct pci_bus *subordinate = pdev->subordinate; | ||
510 | struct pci_dev *dev; | ||
509 | struct slot *slot = ctrl->slot; | 511 | struct slot *slot = ctrl->slot; |
510 | u16 detected, intr_loc; | 512 | u16 detected, intr_loc; |
511 | 513 | ||
@@ -539,6 +541,16 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
539 | wake_up(&ctrl->queue); | 541 | wake_up(&ctrl->queue); |
540 | } | 542 | } |
541 | 543 | ||
544 | if (subordinate) { | ||
545 | list_for_each_entry(dev, &subordinate->devices, bus_list) { | ||
546 | if (dev->ignore_hotplug) { | ||
547 | ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n", | ||
548 | intr_loc, pci_name(dev)); | ||
549 | return IRQ_HANDLED; | ||
550 | } | ||
551 | } | ||
552 | } | ||
553 | |||
542 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) | 554 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) |
543 | return IRQ_HANDLED; | 555 | return IRQ_HANDLED; |
544 | 556 | ||
diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c index e246a10a0d2c..3e36ec8d708a 100644 --- a/drivers/pci/hotplug/pcihp_slot.c +++ b/drivers/pci/hotplug/pcihp_slot.c | |||
@@ -46,7 +46,6 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp) | |||
46 | */ | 46 | */ |
47 | if (pci_is_pcie(dev)) | 47 | if (pci_is_pcie(dev)) |
48 | return; | 48 | return; |
49 | dev_info(&dev->dev, "using default PCI settings\n"); | ||
50 | hpp = &pci_default_type0; | 49 | hpp = &pci_default_type0; |
51 | } | 50 | } |
52 | 51 | ||
@@ -153,7 +152,6 @@ void pci_configure_slot(struct pci_dev *dev) | |||
153 | { | 152 | { |
154 | struct pci_dev *cdev; | 153 | struct pci_dev *cdev; |
155 | struct hotplug_params hpp; | 154 | struct hotplug_params hpp; |
156 | int ret; | ||
157 | 155 | ||
158 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || | 156 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || |
159 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && | 157 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && |
@@ -163,9 +161,7 @@ void pci_configure_slot(struct pci_dev *dev) | |||
163 | pcie_bus_configure_settings(dev->bus); | 161 | pcie_bus_configure_settings(dev->bus); |
164 | 162 | ||
165 | memset(&hpp, 0, sizeof(hpp)); | 163 | memset(&hpp, 0, sizeof(hpp)); |
166 | ret = pci_get_hp_params(dev, &hpp); | 164 | pci_get_hp_params(dev, &hpp); |
167 | if (ret) | ||
168 | dev_warn(&dev->dev, "no hotplug settings from platform\n"); | ||
169 | 165 | ||
170 | program_hpp_type2(dev, hpp.t2); | 166 | program_hpp_type2(dev, hpp.t2); |
171 | program_hpp_type1(dev, hpp.t1); | 167 | program_hpp_type1(dev, hpp.t1); |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 0dd742719154..f833aa271a2e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -41,9 +41,9 @@ config PHY_MVEBU_SATA | |||
41 | config PHY_MIPHY365X | 41 | config PHY_MIPHY365X |
42 | tristate "STMicroelectronics MIPHY365X PHY driver for STiH41x series" | 42 | tristate "STMicroelectronics MIPHY365X PHY driver for STiH41x series" |
43 | depends on ARCH_STI | 43 | depends on ARCH_STI |
44 | depends on GENERIC_PHY | ||
45 | depends on HAS_IOMEM | 44 | depends on HAS_IOMEM |
46 | depends on OF | 45 | depends on OF |
46 | select GENERIC_PHY | ||
47 | help | 47 | help |
48 | Enable this to support the miphy transceiver (for SATA/PCIE) | 48 | Enable this to support the miphy transceiver (for SATA/PCIE) |
49 | that is part of STMicroelectronics STiH41x SoC series. | 49 | that is part of STMicroelectronics STiH41x SoC series. |
@@ -214,12 +214,14 @@ config PHY_QCOM_IPQ806X_SATA | |||
214 | config PHY_ST_SPEAR1310_MIPHY | 214 | config PHY_ST_SPEAR1310_MIPHY |
215 | tristate "ST SPEAR1310-MIPHY driver" | 215 | tristate "ST SPEAR1310-MIPHY driver" |
216 | select GENERIC_PHY | 216 | select GENERIC_PHY |
217 | depends on MACH_SPEAR1310 || COMPILE_TEST | ||
217 | help | 218 | help |
218 | Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA. | 219 | Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA. |
219 | 220 | ||
220 | config PHY_ST_SPEAR1340_MIPHY | 221 | config PHY_ST_SPEAR1340_MIPHY |
221 | tristate "ST SPEAR1340-MIPHY driver" | 222 | tristate "ST SPEAR1340-MIPHY driver" |
222 | select GENERIC_PHY | 223 | select GENERIC_PHY |
224 | depends on MACH_SPEAR1340 || COMPILE_TEST | ||
223 | help | 225 | help |
224 | Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA. | 226 | Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA. |
225 | 227 | ||
diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index b05302b09c9f..392101c8d6b0 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c | |||
@@ -542,6 +542,7 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { | |||
542 | }, | 542 | }, |
543 | { }, | 543 | { }, |
544 | }; | 544 | }; |
545 | MODULE_DEVICE_TABLE(of, exynos5_usbdrd_phy_of_match); | ||
545 | 546 | ||
546 | static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) | 547 | static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) |
547 | { | 548 | { |
diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c index e111baf187ce..e0fb7a1e5a5a 100644 --- a/drivers/phy/phy-miphy365x.c +++ b/drivers/phy/phy-miphy365x.c | |||
@@ -163,6 +163,7 @@ enum miphy_sata_gen { | |||
163 | }; | 163 | }; |
164 | 164 | ||
165 | static u8 rx_tx_spd[] = { | 165 | static u8 rx_tx_spd[] = { |
166 | 0, /* GEN0 doesn't exist. */ | ||
166 | TX_SPDSEL_GEN1_VAL | RX_SPDSEL_GEN1_VAL, | 167 | TX_SPDSEL_GEN1_VAL | RX_SPDSEL_GEN1_VAL, |
167 | TX_SPDSEL_GEN2_VAL | RX_SPDSEL_GEN2_VAL, | 168 | TX_SPDSEL_GEN2_VAL | RX_SPDSEL_GEN2_VAL, |
168 | TX_SPDSEL_GEN3_VAL | RX_SPDSEL_GEN3_VAL | 169 | TX_SPDSEL_GEN3_VAL | RX_SPDSEL_GEN3_VAL |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index e1a6623d4696..9cd33a4bcfb1 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/usb/otg.h> | 35 | #include <linux/usb/otg.h> |
36 | #include <linux/phy/phy.h> | 36 | #include <linux/phy/phy.h> |
37 | #include <linux/pm_runtime.h> | ||
37 | #include <linux/usb/musb-omap.h> | 38 | #include <linux/usb/musb-omap.h> |
38 | #include <linux/usb/ulpi.h> | 39 | #include <linux/usb/ulpi.h> |
39 | #include <linux/i2c/twl.h> | 40 | #include <linux/i2c/twl.h> |
@@ -422,37 +423,55 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) | |||
422 | } | 423 | } |
423 | } | 424 | } |
424 | 425 | ||
425 | static int twl4030_phy_power_off(struct phy *phy) | 426 | static int twl4030_usb_runtime_suspend(struct device *dev) |
426 | { | 427 | { |
427 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 428 | struct twl4030_usb *twl = dev_get_drvdata(dev); |
428 | 429 | ||
430 | dev_dbg(twl->dev, "%s\n", __func__); | ||
429 | if (twl->asleep) | 431 | if (twl->asleep) |
430 | return 0; | 432 | return 0; |
431 | 433 | ||
432 | twl4030_phy_power(twl, 0); | 434 | twl4030_phy_power(twl, 0); |
433 | twl->asleep = 1; | 435 | twl->asleep = 1; |
434 | dev_dbg(twl->dev, "%s\n", __func__); | 436 | |
435 | return 0; | 437 | return 0; |
436 | } | 438 | } |
437 | 439 | ||
438 | static void __twl4030_phy_power_on(struct twl4030_usb *twl) | 440 | static int twl4030_usb_runtime_resume(struct device *dev) |
439 | { | 441 | { |
442 | struct twl4030_usb *twl = dev_get_drvdata(dev); | ||
443 | |||
444 | dev_dbg(twl->dev, "%s\n", __func__); | ||
445 | if (!twl->asleep) | ||
446 | return 0; | ||
447 | |||
440 | twl4030_phy_power(twl, 1); | 448 | twl4030_phy_power(twl, 1); |
441 | twl4030_i2c_access(twl, 1); | 449 | twl->asleep = 0; |
442 | twl4030_usb_set_mode(twl, twl->usb_mode); | 450 | |
443 | if (twl->usb_mode == T2_USB_MODE_ULPI) | 451 | return 0; |
444 | twl4030_i2c_access(twl, 0); | 452 | } |
453 | |||
454 | static int twl4030_phy_power_off(struct phy *phy) | ||
455 | { | ||
456 | struct twl4030_usb *twl = phy_get_drvdata(phy); | ||
457 | |||
458 | dev_dbg(twl->dev, "%s\n", __func__); | ||
459 | pm_runtime_mark_last_busy(twl->dev); | ||
460 | pm_runtime_put_autosuspend(twl->dev); | ||
461 | |||
462 | return 0; | ||
445 | } | 463 | } |
446 | 464 | ||
447 | static int twl4030_phy_power_on(struct phy *phy) | 465 | static int twl4030_phy_power_on(struct phy *phy) |
448 | { | 466 | { |
449 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 467 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
450 | 468 | ||
451 | if (!twl->asleep) | ||
452 | return 0; | ||
453 | __twl4030_phy_power_on(twl); | ||
454 | twl->asleep = 0; | ||
455 | dev_dbg(twl->dev, "%s\n", __func__); | 469 | dev_dbg(twl->dev, "%s\n", __func__); |
470 | pm_runtime_get_sync(twl->dev); | ||
471 | twl4030_i2c_access(twl, 1); | ||
472 | twl4030_usb_set_mode(twl, twl->usb_mode); | ||
473 | if (twl->usb_mode == T2_USB_MODE_ULPI) | ||
474 | twl4030_i2c_access(twl, 0); | ||
456 | 475 | ||
457 | /* | 476 | /* |
458 | * XXX When VBUS gets driven after musb goes to A mode, | 477 | * XXX When VBUS gets driven after musb goes to A mode, |
@@ -558,9 +577,27 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
558 | * USB_LINK_VBUS state. musb_hdrc won't care until it | 577 | * USB_LINK_VBUS state. musb_hdrc won't care until it |
559 | * starts to handle softconnect right. | 578 | * starts to handle softconnect right. |
560 | */ | 579 | */ |
580 | if ((status == OMAP_MUSB_VBUS_VALID) || | ||
581 | (status == OMAP_MUSB_ID_GROUND)) { | ||
582 | if (twl->asleep) | ||
583 | pm_runtime_get_sync(twl->dev); | ||
584 | } else { | ||
585 | if (!twl->asleep) { | ||
586 | pm_runtime_mark_last_busy(twl->dev); | ||
587 | pm_runtime_put_autosuspend(twl->dev); | ||
588 | } | ||
589 | } | ||
561 | omap_musb_mailbox(status); | 590 | omap_musb_mailbox(status); |
562 | } | 591 | } |
563 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 592 | |
593 | /* don't schedule during sleep - irq works right then */ | ||
594 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | ||
595 | cancel_delayed_work(&twl->id_workaround_work); | ||
596 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
597 | } | ||
598 | |||
599 | if (irq) | ||
600 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | ||
564 | 601 | ||
565 | return IRQ_HANDLED; | 602 | return IRQ_HANDLED; |
566 | } | 603 | } |
@@ -569,29 +606,8 @@ static void twl4030_id_workaround_work(struct work_struct *work) | |||
569 | { | 606 | { |
570 | struct twl4030_usb *twl = container_of(work, struct twl4030_usb, | 607 | struct twl4030_usb *twl = container_of(work, struct twl4030_usb, |
571 | id_workaround_work.work); | 608 | id_workaround_work.work); |
572 | enum omap_musb_vbus_id_status status; | ||
573 | bool status_changed = false; | ||
574 | |||
575 | status = twl4030_usb_linkstat(twl); | ||
576 | |||
577 | spin_lock_irq(&twl->lock); | ||
578 | if (status >= 0 && status != twl->linkstat) { | ||
579 | twl->linkstat = status; | ||
580 | status_changed = true; | ||
581 | } | ||
582 | spin_unlock_irq(&twl->lock); | ||
583 | |||
584 | if (status_changed) { | ||
585 | dev_dbg(twl->dev, "handle missing status change to %d\n", | ||
586 | status); | ||
587 | omap_musb_mailbox(status); | ||
588 | } | ||
589 | 609 | ||
590 | /* don't schedule during sleep - irq works right then */ | 610 | twl4030_usb_irq(0, twl); |
591 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | ||
592 | cancel_delayed_work(&twl->id_workaround_work); | ||
593 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
594 | } | ||
595 | } | 611 | } |
596 | 612 | ||
597 | static int twl4030_phy_init(struct phy *phy) | 613 | static int twl4030_phy_init(struct phy *phy) |
@@ -599,22 +615,17 @@ static int twl4030_phy_init(struct phy *phy) | |||
599 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 615 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
600 | enum omap_musb_vbus_id_status status; | 616 | enum omap_musb_vbus_id_status status; |
601 | 617 | ||
602 | /* | 618 | pm_runtime_get_sync(twl->dev); |
603 | * Start in sleep state, we'll get called through set_suspend() | ||
604 | * callback when musb is runtime resumed and it's time to start. | ||
605 | */ | ||
606 | __twl4030_phy_power(twl, 0); | ||
607 | twl->asleep = 1; | ||
608 | |||
609 | status = twl4030_usb_linkstat(twl); | 619 | status = twl4030_usb_linkstat(twl); |
610 | twl->linkstat = status; | 620 | twl->linkstat = status; |
611 | 621 | ||
612 | if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { | 622 | if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) |
613 | omap_musb_mailbox(twl->linkstat); | 623 | omap_musb_mailbox(twl->linkstat); |
614 | twl4030_phy_power_on(phy); | ||
615 | } | ||
616 | 624 | ||
617 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 625 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); |
626 | pm_runtime_mark_last_busy(twl->dev); | ||
627 | pm_runtime_put_autosuspend(twl->dev); | ||
628 | |||
618 | return 0; | 629 | return 0; |
619 | } | 630 | } |
620 | 631 | ||
@@ -650,6 +661,11 @@ static const struct phy_ops ops = { | |||
650 | .owner = THIS_MODULE, | 661 | .owner = THIS_MODULE, |
651 | }; | 662 | }; |
652 | 663 | ||
664 | static const struct dev_pm_ops twl4030_usb_pm_ops = { | ||
665 | SET_RUNTIME_PM_OPS(twl4030_usb_runtime_suspend, | ||
666 | twl4030_usb_runtime_resume, NULL) | ||
667 | }; | ||
668 | |||
653 | static int twl4030_usb_probe(struct platform_device *pdev) | 669 | static int twl4030_usb_probe(struct platform_device *pdev) |
654 | { | 670 | { |
655 | struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); | 671 | struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); |
@@ -726,6 +742,11 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
726 | 742 | ||
727 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); | 743 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); |
728 | 744 | ||
745 | pm_runtime_use_autosuspend(&pdev->dev); | ||
746 | pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); | ||
747 | pm_runtime_enable(&pdev->dev); | ||
748 | pm_runtime_get_sync(&pdev->dev); | ||
749 | |||
729 | /* Our job is to use irqs and status from the power module | 750 | /* Our job is to use irqs and status from the power module |
730 | * to keep the transceiver disabled when nothing's connected. | 751 | * to keep the transceiver disabled when nothing's connected. |
731 | * | 752 | * |
@@ -744,6 +765,9 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
744 | return status; | 765 | return status; |
745 | } | 766 | } |
746 | 767 | ||
768 | pm_runtime_mark_last_busy(&pdev->dev); | ||
769 | pm_runtime_put_autosuspend(twl->dev); | ||
770 | |||
747 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); | 771 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); |
748 | return 0; | 772 | return 0; |
749 | } | 773 | } |
@@ -753,6 +777,7 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
753 | struct twl4030_usb *twl = platform_get_drvdata(pdev); | 777 | struct twl4030_usb *twl = platform_get_drvdata(pdev); |
754 | int val; | 778 | int val; |
755 | 779 | ||
780 | pm_runtime_get_sync(twl->dev); | ||
756 | cancel_delayed_work(&twl->id_workaround_work); | 781 | cancel_delayed_work(&twl->id_workaround_work); |
757 | device_remove_file(twl->dev, &dev_attr_vbus); | 782 | device_remove_file(twl->dev, &dev_attr_vbus); |
758 | 783 | ||
@@ -772,9 +797,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
772 | 797 | ||
773 | /* disable complete OTG block */ | 798 | /* disable complete OTG block */ |
774 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); | 799 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); |
775 | 800 | pm_runtime_mark_last_busy(twl->dev); | |
776 | if (!twl->asleep) | 801 | pm_runtime_put(twl->dev); |
777 | twl4030_phy_power(twl, 0); | ||
778 | 802 | ||
779 | return 0; | 803 | return 0; |
780 | } | 804 | } |
@@ -792,6 +816,7 @@ static struct platform_driver twl4030_usb_driver = { | |||
792 | .remove = twl4030_usb_remove, | 816 | .remove = twl4030_usb_remove, |
793 | .driver = { | 817 | .driver = { |
794 | .name = "twl4030_usb", | 818 | .name = "twl4030_usb", |
819 | .pm = &twl4030_usb_pm_ops, | ||
795 | .owner = THIS_MODULE, | 820 | .owner = THIS_MODULE, |
796 | .of_match_table = of_match_ptr(twl4030_usb_id_table), | 821 | .of_match_table = of_match_ptr(twl4030_usb_id_table), |
797 | }, | 822 | }, |
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 9ca59a018743..e12e5b07f6d7 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -461,6 +461,7 @@ static struct irq_chip byt_irqchip = { | |||
461 | .irq_mask = byt_irq_mask, | 461 | .irq_mask = byt_irq_mask, |
462 | .irq_unmask = byt_irq_unmask, | 462 | .irq_unmask = byt_irq_unmask, |
463 | .irq_set_type = byt_irq_type, | 463 | .irq_set_type = byt_irq_type, |
464 | .flags = IRQCHIP_SKIP_SET_WAKE, | ||
464 | }; | 465 | }; |
465 | 466 | ||
466 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) | 467 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) |
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 337634ad0562..6d77dcd7dcf6 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -319,7 +319,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
319 | struct regulator_config *config) | 319 | struct regulator_config *config) |
320 | { | 320 | { |
321 | struct device_node *nproot, *np; | 321 | struct device_node *nproot, *np; |
322 | nproot = of_node_get(pdev->dev.parent->of_node); | 322 | nproot = pdev->dev.parent->of_node; |
323 | if (!nproot) | 323 | if (!nproot) |
324 | return -ENODEV; | 324 | return -ENODEV; |
325 | nproot = of_get_child_by_name(nproot, "regulators"); | 325 | nproot = of_get_child_by_name(nproot, "regulators"); |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index fdb6ea8ae7e6..00033625a09c 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
@@ -422,9 +422,9 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
422 | config.init_data = pdata->regulators[pdev->id]; | 422 | config.init_data = pdata->regulators[pdev->id]; |
423 | } else { | 423 | } else { |
424 | #ifdef CONFIG_OF | 424 | #ifdef CONFIG_OF |
425 | struct device_node *nproot, *np; | 425 | struct device_node *nproot = da9052->dev->of_node; |
426 | struct device_node *np; | ||
426 | 427 | ||
427 | nproot = of_node_get(da9052->dev->of_node); | ||
428 | if (!nproot) | 428 | if (!nproot) |
429 | return -ENODEV; | 429 | return -ENODEV; |
430 | 430 | ||
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index 9623e9e290bf..3426be89c9f6 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -226,7 +226,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
226 | struct device_node *np, *regulators; | 226 | struct device_node *np, *regulators; |
227 | int ret; | 227 | int ret; |
228 | 228 | ||
229 | np = of_node_get(pdev->dev.parent->of_node); | 229 | np = pdev->dev.parent->of_node; |
230 | if (!np) | 230 | if (!np) |
231 | return 0; | 231 | return 0; |
232 | 232 | ||
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index dad2bcd14e96..7770777befc4 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -250,7 +250,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
250 | struct device_node *nproot, *np; | 250 | struct device_node *nproot, *np; |
251 | int rcount; | 251 | int rcount; |
252 | 252 | ||
253 | nproot = of_node_get(pdev->dev.parent->of_node); | 253 | nproot = pdev->dev.parent->of_node; |
254 | if (!nproot) | 254 | if (!nproot) |
255 | return -ENODEV; | 255 | return -ENODEV; |
256 | np = of_get_child_by_name(nproot, "regulators"); | 256 | np = of_get_child_by_name(nproot, "regulators"); |
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 90b4c530dee5..9c31e215a521 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -917,7 +917,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
917 | struct max8997_regulator_data *rdata; | 917 | struct max8997_regulator_data *rdata; |
918 | unsigned int i, dvs_voltage_nr = 1, ret; | 918 | unsigned int i, dvs_voltage_nr = 1, ret; |
919 | 919 | ||
920 | pmic_np = of_node_get(iodev->dev->of_node); | 920 | pmic_np = iodev->dev->of_node; |
921 | if (!pmic_np) { | 921 | if (!pmic_np) { |
922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); | 922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
923 | return -ENODEV; | 923 | return -ENODEV; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index a7ce34d1b5f2..1878e5b567ef 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -1427,7 +1427,6 @@ static void palmas_dt_to_pdata(struct device *dev, | |||
1427 | u32 prop; | 1427 | u32 prop; |
1428 | int idx, ret; | 1428 | int idx, ret; |
1429 | 1429 | ||
1430 | node = of_node_get(node); | ||
1431 | regulators = of_get_child_by_name(node, "regulators"); | 1430 | regulators = of_get_child_by_name(node, "regulators"); |
1432 | if (!regulators) { | 1431 | if (!regulators) { |
1433 | dev_info(dev, "regulator node not found\n"); | 1432 | dev_info(dev, "regulator node not found\n"); |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index fa7db8847578..e584c998b55f 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -1014,7 +1014,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
1014 | if (!pmic_plat_data) | 1014 | if (!pmic_plat_data) |
1015 | return NULL; | 1015 | return NULL; |
1016 | 1016 | ||
1017 | np = of_node_get(pdev->dev.parent->of_node); | 1017 | np = pdev->dev.parent->of_node; |
1018 | regulators = of_get_child_by_name(np, "regulators"); | 1018 | regulators = of_get_child_by_name(np, "regulators"); |
1019 | if (!regulators) { | 1019 | if (!regulators) { |
1020 | dev_err(&pdev->dev, "regulator node not found\n"); | 1020 | dev_err(&pdev->dev, "regulator node not found\n"); |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 2ead7e78c456..14ba80bfa571 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -77,7 +77,7 @@ EXPORT_SYMBOL_GPL(dasd_nofcx); | |||
77 | * strings when running as a module. | 77 | * strings when running as a module. |
78 | */ | 78 | */ |
79 | static char *dasd[256]; | 79 | static char *dasd[256]; |
80 | module_param_array(dasd, charp, NULL, 0); | 80 | module_param_array(dasd, charp, NULL, S_IRUGO); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Single spinlock to protect devmap and servermap structures and lists. | 83 | * Single spinlock to protect devmap and servermap structures and lists. |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 18a3358eb1d4..bd85fb4978e0 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -43,7 +43,7 @@ config SCSI_DMA | |||
43 | config SCSI_NETLINK | 43 | config SCSI_NETLINK |
44 | bool | 44 | bool |
45 | default n | 45 | default n |
46 | select NET | 46 | depends on NET |
47 | 47 | ||
48 | config SCSI_PROC_FS | 48 | config SCSI_PROC_FS |
49 | bool "legacy /proc/scsi/ support" | 49 | bool "legacy /proc/scsi/ support" |
@@ -257,7 +257,7 @@ config SCSI_SPI_ATTRS | |||
257 | 257 | ||
258 | config SCSI_FC_ATTRS | 258 | config SCSI_FC_ATTRS |
259 | tristate "FiberChannel Transport Attributes" | 259 | tristate "FiberChannel Transport Attributes" |
260 | depends on SCSI | 260 | depends on SCSI && NET |
261 | select SCSI_NETLINK | 261 | select SCSI_NETLINK |
262 | help | 262 | help |
263 | If you wish to export transport-specific information about | 263 | If you wish to export transport-specific information about |
@@ -585,28 +585,28 @@ config HYPERV_STORAGE | |||
585 | 585 | ||
586 | config LIBFC | 586 | config LIBFC |
587 | tristate "LibFC module" | 587 | tristate "LibFC module" |
588 | select SCSI_FC_ATTRS | 588 | depends on SCSI_FC_ATTRS |
589 | select CRC32 | 589 | select CRC32 |
590 | ---help--- | 590 | ---help--- |
591 | Fibre Channel library module | 591 | Fibre Channel library module |
592 | 592 | ||
593 | config LIBFCOE | 593 | config LIBFCOE |
594 | tristate "LibFCoE module" | 594 | tristate "LibFCoE module" |
595 | select LIBFC | 595 | depends on LIBFC |
596 | ---help--- | 596 | ---help--- |
597 | Library for Fibre Channel over Ethernet module | 597 | Library for Fibre Channel over Ethernet module |
598 | 598 | ||
599 | config FCOE | 599 | config FCOE |
600 | tristate "FCoE module" | 600 | tristate "FCoE module" |
601 | depends on PCI | 601 | depends on PCI |
602 | select LIBFCOE | 602 | depends on LIBFCOE |
603 | ---help--- | 603 | ---help--- |
604 | Fibre Channel over Ethernet module | 604 | Fibre Channel over Ethernet module |
605 | 605 | ||
606 | config FCOE_FNIC | 606 | config FCOE_FNIC |
607 | tristate "Cisco FNIC Driver" | 607 | tristate "Cisco FNIC Driver" |
608 | depends on PCI && X86 | 608 | depends on PCI && X86 |
609 | select LIBFCOE | 609 | depends on LIBFCOE |
610 | help | 610 | help |
611 | This is support for the Cisco PCI-Express FCoE HBA. | 611 | This is support for the Cisco PCI-Express FCoE HBA. |
612 | 612 | ||
@@ -816,7 +816,7 @@ config SCSI_IBMVSCSI | |||
816 | config SCSI_IBMVFC | 816 | config SCSI_IBMVFC |
817 | tristate "IBM Virtual FC support" | 817 | tristate "IBM Virtual FC support" |
818 | depends on PPC_PSERIES && SCSI | 818 | depends on PPC_PSERIES && SCSI |
819 | select SCSI_FC_ATTRS | 819 | depends on SCSI_FC_ATTRS |
820 | help | 820 | help |
821 | This is the IBM POWER Virtual FC Client | 821 | This is the IBM POWER Virtual FC Client |
822 | 822 | ||
@@ -1266,7 +1266,7 @@ source "drivers/scsi/qla4xxx/Kconfig" | |||
1266 | config SCSI_LPFC | 1266 | config SCSI_LPFC |
1267 | tristate "Emulex LightPulse Fibre Channel Support" | 1267 | tristate "Emulex LightPulse Fibre Channel Support" |
1268 | depends on PCI && SCSI | 1268 | depends on PCI && SCSI |
1269 | select SCSI_FC_ATTRS | 1269 | depends on SCSI_FC_ATTRS |
1270 | select CRC_T10DIF | 1270 | select CRC_T10DIF |
1271 | help | 1271 | help |
1272 | This lpfc driver supports the Emulex LightPulse | 1272 | This lpfc driver supports the Emulex LightPulse |
@@ -1676,7 +1676,7 @@ config SCSI_SUNESP | |||
1676 | config ZFCP | 1676 | config ZFCP |
1677 | tristate "FCP host bus adapter driver for IBM eServer zSeries" | 1677 | tristate "FCP host bus adapter driver for IBM eServer zSeries" |
1678 | depends on S390 && QDIO && SCSI | 1678 | depends on S390 && QDIO && SCSI |
1679 | select SCSI_FC_ATTRS | 1679 | depends on SCSI_FC_ATTRS |
1680 | help | 1680 | help |
1681 | If you want to access SCSI devices attached to your IBM eServer | 1681 | If you want to access SCSI devices attached to your IBM eServer |
1682 | zSeries by means of Fibre Channel interfaces say Y. | 1682 | zSeries by means of Fibre Channel interfaces say Y. |
@@ -1704,7 +1704,7 @@ config SCSI_PM8001 | |||
1704 | config SCSI_BFA_FC | 1704 | config SCSI_BFA_FC |
1705 | tristate "Brocade BFA Fibre Channel Support" | 1705 | tristate "Brocade BFA Fibre Channel Support" |
1706 | depends on PCI && SCSI | 1706 | depends on PCI && SCSI |
1707 | select SCSI_FC_ATTRS | 1707 | depends on SCSI_FC_ATTRS |
1708 | help | 1708 | help |
1709 | This bfa driver supports all Brocade PCIe FC/FCOE host adapters. | 1709 | This bfa driver supports all Brocade PCIe FC/FCOE host adapters. |
1710 | 1710 | ||
diff --git a/drivers/scsi/bnx2fc/Kconfig b/drivers/scsi/bnx2fc/Kconfig index f245d543d7b1..097882882649 100644 --- a/drivers/scsi/bnx2fc/Kconfig +++ b/drivers/scsi/bnx2fc/Kconfig | |||
@@ -1,11 +1,12 @@ | |||
1 | config SCSI_BNX2X_FCOE | 1 | config SCSI_BNX2X_FCOE |
2 | tristate "QLogic NetXtreme II FCoE support" | 2 | tristate "QLogic NetXtreme II FCoE support" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on (IPV6 || IPV6=n) | ||
5 | depends on LIBFC | ||
6 | depends on LIBFCOE | ||
4 | select NETDEVICES | 7 | select NETDEVICES |
5 | select ETHERNET | 8 | select ETHERNET |
6 | select NET_VENDOR_BROADCOM | 9 | select NET_VENDOR_BROADCOM |
7 | select LIBFC | ||
8 | select LIBFCOE | ||
9 | select CNIC | 10 | select CNIC |
10 | ---help--- | 11 | ---help--- |
11 | This driver supports FCoE offload for the QLogic NetXtreme II | 12 | This driver supports FCoE offload for the QLogic NetXtreme II |
diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig index 44ce54e536e5..ba30ff86d581 100644 --- a/drivers/scsi/bnx2i/Kconfig +++ b/drivers/scsi/bnx2i/Kconfig | |||
@@ -2,6 +2,7 @@ config SCSI_BNX2_ISCSI | |||
2 | tristate "QLogic NetXtreme II iSCSI support" | 2 | tristate "QLogic NetXtreme II iSCSI support" |
3 | depends on NET | 3 | depends on NET |
4 | depends on PCI | 4 | depends on PCI |
5 | depends on (IPV6 || IPV6=n) | ||
5 | select SCSI_ISCSI_ATTRS | 6 | select SCSI_ISCSI_ATTRS |
6 | select NETDEVICES | 7 | select NETDEVICES |
7 | select ETHERNET | 8 | select ETHERNET |
diff --git a/drivers/scsi/csiostor/Kconfig b/drivers/scsi/csiostor/Kconfig index 4d03b032aa10..7c7e5085968b 100644 --- a/drivers/scsi/csiostor/Kconfig +++ b/drivers/scsi/csiostor/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config SCSI_CHELSIO_FCOE | 1 | config SCSI_CHELSIO_FCOE |
2 | tristate "Chelsio Communications FCoE support" | 2 | tristate "Chelsio Communications FCoE support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI |
4 | select SCSI_FC_ATTRS | 4 | depends on SCSI_FC_ATTRS |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | help | 6 | help |
7 | This driver supports FCoE Offload functionality over | 7 | This driver supports FCoE Offload functionality over |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index ea025e4806b6..191b59793519 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
717 | return NULL; | 717 | return NULL; |
718 | } | 718 | } |
719 | 719 | ||
720 | if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) { | ||
721 | iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN); | ||
722 | return NULL; | ||
723 | } | ||
724 | |||
720 | task = conn->login_task; | 725 | task = conn->login_task; |
721 | } else { | 726 | } else { |
722 | if (session->state != ISCSI_STATE_LOGGED_IN) | 727 | if (session->state != ISCSI_STATE_LOGGED_IN) |
723 | return NULL; | 728 | return NULL; |
724 | 729 | ||
730 | if (data_size != 0) { | ||
731 | iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode); | ||
732 | return NULL; | ||
733 | } | ||
734 | |||
725 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); | 735 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); |
726 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); | 736 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); |
727 | 737 | ||
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig index 23d607218ae8..113e6c9826a1 100644 --- a/drivers/scsi/qla2xxx/Kconfig +++ b/drivers/scsi/qla2xxx/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config SCSI_QLA_FC | 1 | config SCSI_QLA_FC |
2 | tristate "QLogic QLA2XXX Fibre Channel Support" | 2 | tristate "QLogic QLA2XXX Fibre Channel Support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI |
4 | select SCSI_FC_ATTRS | 4 | depends on SCSI_FC_ATTRS |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | ---help--- | 6 | ---help--- |
7 | This qla2xxx driver supports all QLogic Fibre Channel | 7 | This qla2xxx driver supports all QLogic Fibre Channel |
@@ -31,7 +31,7 @@ config SCSI_QLA_FC | |||
31 | config TCM_QLA2XXX | 31 | config TCM_QLA2XXX |
32 | tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" | 32 | tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" |
33 | depends on SCSI_QLA_FC && TARGET_CORE | 33 | depends on SCSI_QLA_FC && TARGET_CORE |
34 | select LIBFC | 34 | depends on LIBFC |
35 | select BTREE | 35 | select BTREE |
36 | default n | 36 | default n |
37 | ---help--- | 37 | ---help--- |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d837dc180522..aaea4b98af16 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -733,12 +733,13 @@ static bool scsi_end_request(struct request *req, int error, | |||
733 | } else { | 733 | } else { |
734 | unsigned long flags; | 734 | unsigned long flags; |
735 | 735 | ||
736 | if (bidi_bytes) | ||
737 | scsi_release_bidi_buffers(cmd); | ||
738 | |||
736 | spin_lock_irqsave(q->queue_lock, flags); | 739 | spin_lock_irqsave(q->queue_lock, flags); |
737 | blk_finish_request(req, error); | 740 | blk_finish_request(req, error); |
738 | spin_unlock_irqrestore(q->queue_lock, flags); | 741 | spin_unlock_irqrestore(q->queue_lock, flags); |
739 | 742 | ||
740 | if (bidi_bytes) | ||
741 | scsi_release_bidi_buffers(cmd); | ||
742 | scsi_release_buffers(cmd); | 743 | scsi_release_buffers(cmd); |
743 | scsi_next_command(cmd); | 744 | scsi_next_command(cmd); |
744 | } | 745 | } |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 48f1d26e6ad9..134fb6eb7b19 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -397,24 +397,21 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
397 | struct spi_master *master = spi->master; | 397 | struct spi_master *master = spi->master; |
398 | struct device_node *np = spi->dev.of_node; | 398 | struct device_node *np = spi->dev.of_node; |
399 | bool internal_cs = true; | 399 | bool internal_cs = true; |
400 | unsigned long flags = GPIOF_DIR_OUT; | ||
401 | 400 | ||
402 | dspi = spi_master_get_devdata(spi->master); | 401 | dspi = spi_master_get_devdata(spi->master); |
403 | pdata = &dspi->pdata; | 402 | pdata = &dspi->pdata; |
404 | 403 | ||
405 | flags |= (spi->mode & SPI_CS_HIGH) ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH; | ||
406 | |||
407 | if (!(spi->mode & SPI_NO_CS)) { | 404 | if (!(spi->mode & SPI_NO_CS)) { |
408 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { | 405 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { |
409 | retval = gpio_request_one(spi->cs_gpio, | 406 | retval = gpio_direction_output( |
410 | flags, dev_name(&spi->dev)); | 407 | spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
411 | internal_cs = false; | 408 | internal_cs = false; |
412 | } else if (pdata->chip_sel && | 409 | } else if (pdata->chip_sel && |
413 | spi->chip_select < pdata->num_chipselect && | 410 | spi->chip_select < pdata->num_chipselect && |
414 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { | 411 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { |
415 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; | 412 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; |
416 | retval = gpio_request_one(spi->cs_gpio, | 413 | retval = gpio_direction_output( |
417 | flags, dev_name(&spi->dev)); | 414 | spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
418 | internal_cs = false; | 415 | internal_cs = false; |
419 | } | 416 | } |
420 | 417 | ||
@@ -439,12 +436,6 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
439 | return retval; | 436 | return retval; |
440 | } | 437 | } |
441 | 438 | ||
442 | static void davinci_spi_cleanup(struct spi_device *spi) | ||
443 | { | ||
444 | if (spi->cs_gpio >= 0) | ||
445 | gpio_free(spi->cs_gpio); | ||
446 | } | ||
447 | |||
448 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) | 439 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) |
449 | { | 440 | { |
450 | struct device *sdev = dspi->bitbang.master->dev.parent; | 441 | struct device *sdev = dspi->bitbang.master->dev.parent; |
@@ -956,7 +947,6 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
956 | master->num_chipselect = pdata->num_chipselect; | 947 | master->num_chipselect = pdata->num_chipselect; |
957 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); | 948 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); |
958 | master->setup = davinci_spi_setup; | 949 | master->setup = davinci_spi_setup; |
959 | master->cleanup = davinci_spi_cleanup; | ||
960 | 950 | ||
961 | dspi->bitbang.chipselect = davinci_spi_chipselect; | 951 | dspi->bitbang.chipselect = davinci_spi_chipselect; |
962 | dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; | 952 | dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; |
@@ -967,6 +957,27 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
967 | if (dspi->version == SPI_VERSION_2) | 957 | if (dspi->version == SPI_VERSION_2) |
968 | dspi->bitbang.flags |= SPI_READY; | 958 | dspi->bitbang.flags |= SPI_READY; |
969 | 959 | ||
960 | if (pdev->dev.of_node) { | ||
961 | int i; | ||
962 | |||
963 | for (i = 0; i < pdata->num_chipselect; i++) { | ||
964 | int cs_gpio = of_get_named_gpio(pdev->dev.of_node, | ||
965 | "cs-gpios", i); | ||
966 | |||
967 | if (cs_gpio == -EPROBE_DEFER) { | ||
968 | ret = cs_gpio; | ||
969 | goto free_clk; | ||
970 | } | ||
971 | |||
972 | if (gpio_is_valid(cs_gpio)) { | ||
973 | ret = devm_gpio_request(&pdev->dev, cs_gpio, | ||
974 | dev_name(&pdev->dev)); | ||
975 | if (ret) | ||
976 | goto free_clk; | ||
977 | } | ||
978 | } | ||
979 | } | ||
980 | |||
970 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 981 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
971 | if (r) | 982 | if (r) |
972 | dma_rx_chan = r->start; | 983 | dma_rx_chan = r->start; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 670f0627f3bf..0dd0623319b0 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -547,8 +547,7 @@ static int dw_spi_setup(struct spi_device *spi) | |||
547 | /* Only alloc on first setup */ | 547 | /* Only alloc on first setup */ |
548 | chip = spi_get_ctldata(spi); | 548 | chip = spi_get_ctldata(spi); |
549 | if (!chip) { | 549 | if (!chip) { |
550 | chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), | 550 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); |
551 | GFP_KERNEL); | ||
552 | if (!chip) | 551 | if (!chip) |
553 | return -ENOMEM; | 552 | return -ENOMEM; |
554 | spi_set_ctldata(spi, chip); | 553 | spi_set_ctldata(spi, chip); |
@@ -606,6 +605,14 @@ static int dw_spi_setup(struct spi_device *spi) | |||
606 | return 0; | 605 | return 0; |
607 | } | 606 | } |
608 | 607 | ||
608 | static void dw_spi_cleanup(struct spi_device *spi) | ||
609 | { | ||
610 | struct chip_data *chip = spi_get_ctldata(spi); | ||
611 | |||
612 | kfree(chip); | ||
613 | spi_set_ctldata(spi, NULL); | ||
614 | } | ||
615 | |||
609 | /* Restart the controller, disable all interrupts, clean rx fifo */ | 616 | /* Restart the controller, disable all interrupts, clean rx fifo */ |
610 | static void spi_hw_init(struct dw_spi *dws) | 617 | static void spi_hw_init(struct dw_spi *dws) |
611 | { | 618 | { |
@@ -661,6 +668,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
661 | master->bus_num = dws->bus_num; | 668 | master->bus_num = dws->bus_num; |
662 | master->num_chipselect = dws->num_cs; | 669 | master->num_chipselect = dws->num_cs; |
663 | master->setup = dw_spi_setup; | 670 | master->setup = dw_spi_setup; |
671 | master->cleanup = dw_spi_cleanup; | ||
664 | master->transfer_one_message = dw_spi_transfer_one_message; | 672 | master->transfer_one_message = dw_spi_transfer_one_message; |
665 | master->max_speed_hz = dws->max_freq; | 673 | master->max_speed_hz = dws->max_freq; |
666 | 674 | ||
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 8ebd724e4c59..429e11190265 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -452,16 +452,16 @@ static int fsl_espi_setup(struct spi_device *spi) | |||
452 | int retval; | 452 | int retval; |
453 | u32 hw_mode; | 453 | u32 hw_mode; |
454 | u32 loop_mode; | 454 | u32 loop_mode; |
455 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 455 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
456 | 456 | ||
457 | if (!spi->max_speed_hz) | 457 | if (!spi->max_speed_hz) |
458 | return -EINVAL; | 458 | return -EINVAL; |
459 | 459 | ||
460 | if (!cs) { | 460 | if (!cs) { |
461 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); | 461 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
462 | if (!cs) | 462 | if (!cs) |
463 | return -ENOMEM; | 463 | return -ENOMEM; |
464 | spi->controller_state = cs; | 464 | spi_set_ctldata(spi, cs); |
465 | } | 465 | } |
466 | 466 | ||
467 | mpc8xxx_spi = spi_master_get_devdata(spi->master); | 467 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
@@ -496,6 +496,14 @@ static int fsl_espi_setup(struct spi_device *spi) | |||
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | static void fsl_espi_cleanup(struct spi_device *spi) | ||
500 | { | ||
501 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); | ||
502 | |||
503 | kfree(cs); | ||
504 | spi_set_ctldata(spi, NULL); | ||
505 | } | ||
506 | |||
499 | void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | 507 | void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) |
500 | { | 508 | { |
501 | struct fsl_espi_reg *reg_base = mspi->reg_base; | 509 | struct fsl_espi_reg *reg_base = mspi->reg_base; |
@@ -605,6 +613,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, | |||
605 | 613 | ||
606 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); | 614 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); |
607 | master->setup = fsl_espi_setup; | 615 | master->setup = fsl_espi_setup; |
616 | master->cleanup = fsl_espi_cleanup; | ||
608 | 617 | ||
609 | mpc8xxx_spi = spi_master_get_devdata(master); | 618 | mpc8xxx_spi = spi_master_get_devdata(master); |
610 | mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; | 619 | mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 9452f6740997..590f31bc0aba 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -425,16 +425,16 @@ static int fsl_spi_setup(struct spi_device *spi) | |||
425 | struct fsl_spi_reg *reg_base; | 425 | struct fsl_spi_reg *reg_base; |
426 | int retval; | 426 | int retval; |
427 | u32 hw_mode; | 427 | u32 hw_mode; |
428 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 428 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
429 | 429 | ||
430 | if (!spi->max_speed_hz) | 430 | if (!spi->max_speed_hz) |
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | 432 | ||
433 | if (!cs) { | 433 | if (!cs) { |
434 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); | 434 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
435 | if (!cs) | 435 | if (!cs) |
436 | return -ENOMEM; | 436 | return -ENOMEM; |
437 | spi->controller_state = cs; | 437 | spi_set_ctldata(spi, cs); |
438 | } | 438 | } |
439 | mpc8xxx_spi = spi_master_get_devdata(spi->master); | 439 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
440 | 440 | ||
@@ -496,9 +496,13 @@ static int fsl_spi_setup(struct spi_device *spi) | |||
496 | static void fsl_spi_cleanup(struct spi_device *spi) | 496 | static void fsl_spi_cleanup(struct spi_device *spi) |
497 | { | 497 | { |
498 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 498 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
499 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); | ||
499 | 500 | ||
500 | if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) | 501 | if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) |
501 | gpio_free(spi->cs_gpio); | 502 | gpio_free(spi->cs_gpio); |
503 | |||
504 | kfree(cs); | ||
505 | spi_set_ctldata(spi, NULL); | ||
502 | } | 506 | } |
503 | 507 | ||
504 | static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | 508 | static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 1189cfd96477..f1f0a587e4fc 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2136,7 +2136,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2136 | cs_gpio); | 2136 | cs_gpio); |
2137 | else if (gpio_direction_output(cs_gpio, 1)) | 2137 | else if (gpio_direction_output(cs_gpio, 1)) |
2138 | dev_err(&adev->dev, | 2138 | dev_err(&adev->dev, |
2139 | "could set gpio %d as output\n", | 2139 | "could not set gpio %d as output\n", |
2140 | cs_gpio); | 2140 | cs_gpio); |
2141 | } | 2141 | } |
2142 | } | 2142 | } |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index cd0e08b0c9f6..3afc266b666d 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs) | |||
220 | do { | 220 | do { |
221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) | 221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) |
222 | return; | 222 | return; |
223 | } while (time_before(jiffies, timeout)); | 223 | } while (!time_after(jiffies, timeout)); |
224 | 224 | ||
225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); | 225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); |
226 | } | 226 | } |
@@ -529,7 +529,8 @@ static int rockchip_spi_transfer_one( | |||
529 | int ret = 0; | 529 | int ret = 0; |
530 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 530 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
531 | 531 | ||
532 | WARN_ON((readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | 532 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
533 | (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | ||
533 | 534 | ||
534 | if (!xfer->tx_buf && !xfer->rx_buf) { | 535 | if (!xfer->tx_buf && !xfer->rx_buf) { |
535 | dev_err(rs->dev, "No buffer for transfer\n"); | 536 | dev_err(rs->dev, "No buffer for transfer\n"); |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 95ac276eaafe..6f0602fd7401 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -312,6 +312,8 @@ static int spi_sirfsoc_cmd_transfer(struct spi_device *spi, | |||
312 | u32 cmd; | 312 | u32 cmd; |
313 | 313 | ||
314 | sspi = spi_master_get_devdata(spi->master); | 314 | sspi = spi_master_get_devdata(spi->master); |
315 | writel(SIRFSOC_SPI_FIFO_RESET, sspi->base + SIRFSOC_SPI_TXFIFO_OP); | ||
316 | writel(SIRFSOC_SPI_FIFO_START, sspi->base + SIRFSOC_SPI_TXFIFO_OP); | ||
315 | memcpy(&cmd, sspi->tx, t->len); | 317 | memcpy(&cmd, sspi->tx, t->len); |
316 | if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) | 318 | if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) |
317 | cmd = cpu_to_be32(cmd) >> | 319 | cmd = cpu_to_be32(cmd) >> |
@@ -438,7 +440,8 @@ static void spi_sirfsoc_pio_transfer(struct spi_device *spi, | |||
438 | sspi->tx_word(sspi); | 440 | sspi->tx_word(sspi); |
439 | writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | | 441 | writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | |
440 | SIRFSOC_SPI_TX_UFLOW_INT_EN | | 442 | SIRFSOC_SPI_TX_UFLOW_INT_EN | |
441 | SIRFSOC_SPI_RX_OFLOW_INT_EN, | 443 | SIRFSOC_SPI_RX_OFLOW_INT_EN | |
444 | SIRFSOC_SPI_RX_IO_DMA_INT_EN, | ||
442 | sspi->base + SIRFSOC_SPI_INT_EN); | 445 | sspi->base + SIRFSOC_SPI_INT_EN); |
443 | writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, | 446 | writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, |
444 | sspi->base + SIRFSOC_SPI_TX_RX_EN); | 447 | sspi->base + SIRFSOC_SPI_TX_RX_EN); |
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index e7b2e0234196..69139ce7420d 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c | |||
@@ -199,7 +199,6 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) | |||
199 | fence->num_fences = 1; | 199 | fence->num_fences = 1; |
200 | atomic_set(&fence->status, 1); | 200 | atomic_set(&fence->status, 1); |
201 | 201 | ||
202 | fence_get(&pt->base); | ||
203 | fence->cbs[0].sync_pt = &pt->base; | 202 | fence->cbs[0].sync_pt = &pt->base; |
204 | fence->cbs[0].fence = fence; | 203 | fence->cbs[0].fence = fence; |
205 | if (fence_add_callback(&pt->base, &fence->cbs[0].cb, | 204 | if (fence_add_callback(&pt->base, &fence->cbs[0].cb, |
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c index ea01b8f7a2c3..6f45ce0478d7 100644 --- a/drivers/staging/iio/meter/ade7758_trigger.c +++ b/drivers/staging/iio/meter/ade7758_trigger.c | |||
@@ -85,7 +85,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev) | |||
85 | ret = iio_trigger_register(st->trig); | 85 | ret = iio_trigger_register(st->trig); |
86 | 86 | ||
87 | /* select default trigger */ | 87 | /* select default trigger */ |
88 | indio_dev->trig = st->trig; | 88 | indio_dev->trig = iio_trigger_get(st->trig); |
89 | if (ret) | 89 | if (ret) |
90 | goto error_free_irq; | 90 | goto error_free_irq; |
91 | 91 | ||
diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 7e3f019d7e72..4662e00b456a 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c | |||
@@ -574,6 +574,9 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, | |||
574 | for (i = 0; i < 2; i++) { | 574 | for (i = 0; i < 2; i++) { |
575 | struct imx_ldb_channel *channel = &imx_ldb->channel[i]; | 575 | struct imx_ldb_channel *channel = &imx_ldb->channel[i]; |
576 | 576 | ||
577 | if (!channel->connector.funcs) | ||
578 | continue; | ||
579 | |||
577 | channel->connector.funcs->destroy(&channel->connector); | 580 | channel->connector.funcs->destroy(&channel->connector); |
578 | channel->encoder.funcs->destroy(&channel->encoder); | 581 | channel->encoder.funcs->destroy(&channel->encoder); |
579 | } | 582 | } |
diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c index 6f393a11f44d..50de10a550e9 100644 --- a/drivers/staging/imx-drm/ipuv3-plane.c +++ b/drivers/staging/imx-drm/ipuv3-plane.c | |||
@@ -281,7 +281,8 @@ static void ipu_plane_dpms(struct ipu_plane *ipu_plane, int mode) | |||
281 | 281 | ||
282 | ipu_idmac_put(ipu_plane->ipu_ch); | 282 | ipu_idmac_put(ipu_plane->ipu_ch); |
283 | ipu_dmfc_put(ipu_plane->dmfc); | 283 | ipu_dmfc_put(ipu_plane->dmfc); |
284 | ipu_dp_put(ipu_plane->dp); | 284 | if (ipu_plane->dp) |
285 | ipu_dp_put(ipu_plane->dp); | ||
285 | } | 286 | } |
286 | } | 287 | } |
287 | 288 | ||
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 0367f5a2cfe4..0c59e26c0805 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c | |||
@@ -568,7 +568,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, | |||
568 | if (sb->s_root == NULL) { | 568 | if (sb->s_root == NULL) { |
569 | CERROR("%s: can't make root dentry\n", | 569 | CERROR("%s: can't make root dentry\n", |
570 | ll_get_fsname(sb, NULL, 0)); | 570 | ll_get_fsname(sb, NULL, 0)); |
571 | GOTO(out_root, err = -ENOMEM); | 571 | GOTO(out_lock_cn_cb, err = -ENOMEM); |
572 | } | 572 | } |
573 | 573 | ||
574 | sbi->ll_sdev_orig = sb->s_dev; | 574 | sbi->ll_sdev_orig = sb->s_dev; |
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index f105c2ac091b..164136b07a68 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c | |||
@@ -350,6 +350,9 @@ static int hostap_set_generic_element(PSDevice pDevice, | |||
350 | { | 350 | { |
351 | PSMgmtObject pMgmt = pDevice->pMgmt; | 351 | PSMgmtObject pMgmt = pDevice->pMgmt; |
352 | 352 | ||
353 | if (param->u.generic_elem.len > sizeof(pMgmt->abyWPAIE)) | ||
354 | return -EINVAL; | ||
355 | |||
353 | memcpy(pMgmt->abyWPAIE, | 356 | memcpy(pMgmt->abyWPAIE, |
354 | param->u.generic_elem.data, | 357 | param->u.generic_elem.data, |
355 | param->u.generic_elem.len | 358 | param->u.generic_elem.len |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 1f4c794f5fcc..260c3e1e312c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid( | |||
4540 | { | 4540 | { |
4541 | struct iscsi_conn *l_conn; | 4541 | struct iscsi_conn *l_conn; |
4542 | struct iscsi_session *sess = conn->sess; | 4542 | struct iscsi_session *sess = conn->sess; |
4543 | bool conn_found = false; | ||
4543 | 4544 | ||
4544 | if (!sess) | 4545 | if (!sess) |
4545 | return; | 4546 | return; |
@@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid( | |||
4548 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { | 4549 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { |
4549 | if (l_conn->cid == cid) { | 4550 | if (l_conn->cid == cid) { |
4550 | iscsit_inc_conn_usage_count(l_conn); | 4551 | iscsit_inc_conn_usage_count(l_conn); |
4552 | conn_found = true; | ||
4551 | break; | 4553 | break; |
4552 | } | 4554 | } |
4553 | } | 4555 | } |
4554 | spin_unlock_bh(&sess->conn_lock); | 4556 | spin_unlock_bh(&sess->conn_lock); |
4555 | 4557 | ||
4556 | if (!l_conn) | 4558 | if (!conn_found) |
4557 | return; | 4559 | return; |
4558 | 4560 | ||
4559 | if (l_conn->sock) | 4561 | if (l_conn->sock) |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 02f9de26f38a..18c29260b4a2 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
@@ -601,7 +601,7 @@ int iscsi_copy_param_list( | |||
601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); | 601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); |
602 | if (!param_list) { | 602 | if (!param_list) { |
603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); | 603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); |
604 | goto err_out; | 604 | return -1; |
605 | } | 605 | } |
606 | INIT_LIST_HEAD(¶m_list->param_list); | 606 | INIT_LIST_HEAD(¶m_list->param_list); |
607 | INIT_LIST_HEAD(¶m_list->extra_response_list); | 607 | INIT_LIST_HEAD(¶m_list->extra_response_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index fd90b28f1d94..73355f4fca74 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -400,6 +400,8 @@ struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump( | |||
400 | 400 | ||
401 | spin_lock_bh(&conn->cmd_lock); | 401 | spin_lock_bh(&conn->cmd_lock); |
402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { | 402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { |
403 | if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) | ||
404 | continue; | ||
403 | if (cmd->init_task_tag == init_task_tag) { | 405 | if (cmd->init_task_tag == init_task_tag) { |
404 | spin_unlock_bh(&conn->cmd_lock); | 406 | spin_unlock_bh(&conn->cmd_lock); |
405 | return cmd; | 407 | return cmd; |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index bf55c5a04cfa..756def38c77a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -2363,7 +2363,7 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ | |||
2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ | 2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ |
2364 | return -EINVAL; \ | 2364 | return -EINVAL; \ |
2365 | } \ | 2365 | } \ |
2366 | if (!tmp) \ | 2366 | if (tmp) \ |
2367 | t->_var |= _bit; \ | 2367 | t->_var |= _bit; \ |
2368 | else \ | 2368 | else \ |
2369 | t->_var &= ~_bit; \ | 2369 | t->_var &= ~_bit; \ |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 6cd7222738fc..bc286a67af7c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -664,7 +664,7 @@ spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf) | |||
664 | buf[0] = dev->transport->get_device_type(dev); | 664 | buf[0] = dev->transport->get_device_type(dev); |
665 | buf[3] = 0x0c; | 665 | buf[3] = 0x0c; |
666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); | 666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); |
667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[12]); | 667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_multiplier, &buf[12]); |
668 | 668 | ||
669 | return 0; | 669 | return 0; |
670 | } | 670 | } |
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 4db7987ec225..57d9df84ce5d 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -540,6 +540,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = { | |||
540 | { "INT3434", 0 }, | 540 | { "INT3434", 0 }, |
541 | { "INT3435", 0 }, | 541 | { "INT3435", 0 }, |
542 | { "80860F0A", 0 }, | 542 | { "80860F0A", 0 }, |
543 | { "8086228A", 0 }, | ||
543 | { }, | 544 | { }, |
544 | }; | 545 | }; |
545 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); | 546 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 7b63677475c1..d7d4584549a5 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -527,6 +527,45 @@ static void atmel_enable_ms(struct uart_port *port) | |||
527 | } | 527 | } |
528 | 528 | ||
529 | /* | 529 | /* |
530 | * Disable modem status interrupts | ||
531 | */ | ||
532 | static void atmel_disable_ms(struct uart_port *port) | ||
533 | { | ||
534 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | ||
535 | uint32_t idr = 0; | ||
536 | |||
537 | /* | ||
538 | * Interrupt should not be disabled twice | ||
539 | */ | ||
540 | if (!atmel_port->ms_irq_enabled) | ||
541 | return; | ||
542 | |||
543 | atmel_port->ms_irq_enabled = false; | ||
544 | |||
545 | if (atmel_port->gpio_irq[UART_GPIO_CTS] >= 0) | ||
546 | disable_irq(atmel_port->gpio_irq[UART_GPIO_CTS]); | ||
547 | else | ||
548 | idr |= ATMEL_US_CTSIC; | ||
549 | |||
550 | if (atmel_port->gpio_irq[UART_GPIO_DSR] >= 0) | ||
551 | disable_irq(atmel_port->gpio_irq[UART_GPIO_DSR]); | ||
552 | else | ||
553 | idr |= ATMEL_US_DSRIC; | ||
554 | |||
555 | if (atmel_port->gpio_irq[UART_GPIO_RI] >= 0) | ||
556 | disable_irq(atmel_port->gpio_irq[UART_GPIO_RI]); | ||
557 | else | ||
558 | idr |= ATMEL_US_RIIC; | ||
559 | |||
560 | if (atmel_port->gpio_irq[UART_GPIO_DCD] >= 0) | ||
561 | disable_irq(atmel_port->gpio_irq[UART_GPIO_DCD]); | ||
562 | else | ||
563 | idr |= ATMEL_US_DCDIC; | ||
564 | |||
565 | UART_PUT_IDR(port, idr); | ||
566 | } | ||
567 | |||
568 | /* | ||
530 | * Control the transmission of a break signal | 569 | * Control the transmission of a break signal |
531 | */ | 570 | */ |
532 | static void atmel_break_ctl(struct uart_port *port, int break_state) | 571 | static void atmel_break_ctl(struct uart_port *port, int break_state) |
@@ -1993,7 +2032,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1993 | 2032 | ||
1994 | /* CTS flow-control and modem-status interrupts */ | 2033 | /* CTS flow-control and modem-status interrupts */ |
1995 | if (UART_ENABLE_MS(port, termios->c_cflag)) | 2034 | if (UART_ENABLE_MS(port, termios->c_cflag)) |
1996 | port->ops->enable_ms(port); | 2035 | atmel_enable_ms(port); |
2036 | else | ||
2037 | atmel_disable_ms(port); | ||
1997 | 2038 | ||
1998 | spin_unlock_irqrestore(&port->lock, flags); | 2039 | spin_unlock_irqrestore(&port->lock, flags); |
1999 | } | 2040 | } |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 01951d27cc03..806e4bcadbd7 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -581,7 +581,7 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port) | |||
581 | { | 581 | { |
582 | unsigned int status; | 582 | unsigned int status; |
583 | 583 | ||
584 | status = cdns_uart_readl(CDNS_UART_ISR_OFFSET) & CDNS_UART_IXR_TXEMPTY; | 584 | status = cdns_uart_readl(CDNS_UART_SR_OFFSET) & CDNS_UART_SR_TXEMPTY; |
585 | return status ? TIOCSER_TEMT : 0; | 585 | return status ? TIOCSER_TEMT : 0; |
586 | } | 586 | } |
587 | 587 | ||
diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index d72b9d2de2c5..4935ac38fd00 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c | |||
@@ -20,13 +20,13 @@ | |||
20 | static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | 20 | static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) |
21 | { | 21 | { |
22 | struct device *dev = ci->gadget.dev.parent; | 22 | struct device *dev = ci->gadget.dev.parent; |
23 | int val; | ||
24 | 23 | ||
25 | switch (event) { | 24 | switch (event) { |
26 | case CI_HDRC_CONTROLLER_RESET_EVENT: | 25 | case CI_HDRC_CONTROLLER_RESET_EVENT: |
27 | dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); | 26 | dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); |
28 | writel(0, USB_AHBBURST); | 27 | writel(0, USB_AHBBURST); |
29 | writel(0, USB_AHBMODE); | 28 | writel(0, USB_AHBMODE); |
29 | usb_phy_init(ci->transceiver); | ||
30 | break; | 30 | break; |
31 | case CI_HDRC_CONTROLLER_STOPPED_EVENT: | 31 | case CI_HDRC_CONTROLLER_STOPPED_EVENT: |
32 | dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); | 32 | dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); |
@@ -34,10 +34,7 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | |||
34 | * Put the transceiver in non-driving mode. Otherwise host | 34 | * Put the transceiver in non-driving mode. Otherwise host |
35 | * may not detect soft-disconnection. | 35 | * may not detect soft-disconnection. |
36 | */ | 36 | */ |
37 | val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); | 37 | usb_phy_notify_disconnect(ci->transceiver, USB_SPEED_UNKNOWN); |
38 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | ||
39 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | ||
40 | usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); | ||
41 | break; | 38 | break; |
42 | default: | 39 | default: |
43 | dev_dbg(dev, "unknown ci_hdrc event\n"); | 40 | dev_dbg(dev, "unknown ci_hdrc event\n"); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 46f5161c7891..d481c99a20d7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -5024,9 +5024,10 @@ static void hub_events(void) | |||
5024 | 5024 | ||
5025 | hub = list_entry(tmp, struct usb_hub, event_list); | 5025 | hub = list_entry(tmp, struct usb_hub, event_list); |
5026 | kref_get(&hub->kref); | 5026 | kref_get(&hub->kref); |
5027 | hdev = hub->hdev; | ||
5028 | usb_get_dev(hdev); | ||
5027 | spin_unlock_irq(&hub_event_lock); | 5029 | spin_unlock_irq(&hub_event_lock); |
5028 | 5030 | ||
5029 | hdev = hub->hdev; | ||
5030 | hub_dev = hub->intfdev; | 5031 | hub_dev = hub->intfdev; |
5031 | intf = to_usb_interface(hub_dev); | 5032 | intf = to_usb_interface(hub_dev); |
5032 | dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", | 5033 | dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", |
@@ -5139,6 +5140,7 @@ static void hub_events(void) | |||
5139 | usb_autopm_put_interface(intf); | 5140 | usb_autopm_put_interface(intf); |
5140 | loop_disconnected: | 5141 | loop_disconnected: |
5141 | usb_unlock_device(hdev); | 5142 | usb_unlock_device(hdev); |
5143 | usb_put_dev(hdev); | ||
5142 | kref_put(&hub->kref, hub_release); | 5144 | kref_put(&hub->kref, hub_release); |
5143 | 5145 | ||
5144 | } /* end while (1) */ | 5146 | } /* end while (1) */ |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7c9618e916e2..ce6071d65d51 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -1649,6 +1649,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx) | |||
1649 | dev_err(hsotg->dev, | 1649 | dev_err(hsotg->dev, |
1650 | "%s: timeout flushing fifo (GRSTCTL=%08x)\n", | 1650 | "%s: timeout flushing fifo (GRSTCTL=%08x)\n", |
1651 | __func__, val); | 1651 | __func__, val); |
1652 | break; | ||
1652 | } | 1653 | } |
1653 | 1654 | ||
1654 | udelay(1); | 1655 | udelay(1); |
@@ -2747,13 +2748,14 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) | |||
2747 | 2748 | ||
2748 | dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); | 2749 | dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); |
2749 | 2750 | ||
2750 | if (hsotg->phy) { | 2751 | if (hsotg->uphy) |
2751 | phy_init(hsotg->phy); | ||
2752 | phy_power_on(hsotg->phy); | ||
2753 | } else if (hsotg->uphy) | ||
2754 | usb_phy_init(hsotg->uphy); | 2752 | usb_phy_init(hsotg->uphy); |
2755 | else if (hsotg->plat->phy_init) | 2753 | else if (hsotg->plat && hsotg->plat->phy_init) |
2756 | hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); | 2754 | hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); |
2755 | else { | ||
2756 | phy_init(hsotg->phy); | ||
2757 | phy_power_on(hsotg->phy); | ||
2758 | } | ||
2757 | } | 2759 | } |
2758 | 2760 | ||
2759 | /** | 2761 | /** |
@@ -2767,13 +2769,14 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) | |||
2767 | { | 2769 | { |
2768 | struct platform_device *pdev = to_platform_device(hsotg->dev); | 2770 | struct platform_device *pdev = to_platform_device(hsotg->dev); |
2769 | 2771 | ||
2770 | if (hsotg->phy) { | 2772 | if (hsotg->uphy) |
2771 | phy_power_off(hsotg->phy); | ||
2772 | phy_exit(hsotg->phy); | ||
2773 | } else if (hsotg->uphy) | ||
2774 | usb_phy_shutdown(hsotg->uphy); | 2773 | usb_phy_shutdown(hsotg->uphy); |
2775 | else if (hsotg->plat->phy_exit) | 2774 | else if (hsotg->plat && hsotg->plat->phy_exit) |
2776 | hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); | 2775 | hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); |
2776 | else { | ||
2777 | phy_power_off(hsotg->phy); | ||
2778 | phy_exit(hsotg->phy); | ||
2779 | } | ||
2777 | } | 2780 | } |
2778 | 2781 | ||
2779 | /** | 2782 | /** |
@@ -2892,13 +2895,11 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2892 | return -ENODEV; | 2895 | return -ENODEV; |
2893 | 2896 | ||
2894 | /* all endpoints should be shutdown */ | 2897 | /* all endpoints should be shutdown */ |
2895 | for (ep = 0; ep < hsotg->num_of_eps; ep++) | 2898 | for (ep = 1; ep < hsotg->num_of_eps; ep++) |
2896 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2899 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); |
2897 | 2900 | ||
2898 | spin_lock_irqsave(&hsotg->lock, flags); | 2901 | spin_lock_irqsave(&hsotg->lock, flags); |
2899 | 2902 | ||
2900 | s3c_hsotg_phy_disable(hsotg); | ||
2901 | |||
2902 | if (!driver) | 2903 | if (!driver) |
2903 | hsotg->driver = NULL; | 2904 | hsotg->driver = NULL; |
2904 | 2905 | ||
@@ -2941,7 +2942,6 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) | |||
2941 | s3c_hsotg_phy_enable(hsotg); | 2942 | s3c_hsotg_phy_enable(hsotg); |
2942 | s3c_hsotg_core_init(hsotg); | 2943 | s3c_hsotg_core_init(hsotg); |
2943 | } else { | 2944 | } else { |
2944 | s3c_hsotg_disconnect(hsotg); | ||
2945 | s3c_hsotg_phy_disable(hsotg); | 2945 | s3c_hsotg_phy_disable(hsotg); |
2946 | } | 2946 | } |
2947 | 2947 | ||
@@ -3441,13 +3441,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3441 | 3441 | ||
3442 | hsotg->irq = ret; | 3442 | hsotg->irq = ret; |
3443 | 3443 | ||
3444 | ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, | ||
3445 | dev_name(dev), hsotg); | ||
3446 | if (ret < 0) { | ||
3447 | dev_err(dev, "cannot claim IRQ\n"); | ||
3448 | goto err_clk; | ||
3449 | } | ||
3450 | |||
3451 | dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); | 3444 | dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); |
3452 | 3445 | ||
3453 | hsotg->gadget.max_speed = USB_SPEED_HIGH; | 3446 | hsotg->gadget.max_speed = USB_SPEED_HIGH; |
@@ -3488,9 +3481,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3488 | if (hsotg->phy && (phy_get_bus_width(phy) == 8)) | 3481 | if (hsotg->phy && (phy_get_bus_width(phy) == 8)) |
3489 | hsotg->phyif = GUSBCFG_PHYIF8; | 3482 | hsotg->phyif = GUSBCFG_PHYIF8; |
3490 | 3483 | ||
3491 | if (hsotg->phy) | ||
3492 | phy_init(hsotg->phy); | ||
3493 | |||
3494 | /* usb phy enable */ | 3484 | /* usb phy enable */ |
3495 | s3c_hsotg_phy_enable(hsotg); | 3485 | s3c_hsotg_phy_enable(hsotg); |
3496 | 3486 | ||
@@ -3498,6 +3488,17 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3498 | s3c_hsotg_init(hsotg); | 3488 | s3c_hsotg_init(hsotg); |
3499 | s3c_hsotg_hw_cfg(hsotg); | 3489 | s3c_hsotg_hw_cfg(hsotg); |
3500 | 3490 | ||
3491 | ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, | ||
3492 | dev_name(dev), hsotg); | ||
3493 | if (ret < 0) { | ||
3494 | s3c_hsotg_phy_disable(hsotg); | ||
3495 | clk_disable_unprepare(hsotg->clk); | ||
3496 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | ||
3497 | hsotg->supplies); | ||
3498 | dev_err(dev, "cannot claim IRQ\n"); | ||
3499 | goto err_clk; | ||
3500 | } | ||
3501 | |||
3501 | /* hsotg->num_of_eps holds number of EPs other than ep0 */ | 3502 | /* hsotg->num_of_eps holds number of EPs other than ep0 */ |
3502 | 3503 | ||
3503 | if (hsotg->num_of_eps == 0) { | 3504 | if (hsotg->num_of_eps == 0) { |
@@ -3582,9 +3583,6 @@ static int s3c_hsotg_remove(struct platform_device *pdev) | |||
3582 | usb_gadget_unregister_driver(hsotg->driver); | 3583 | usb_gadget_unregister_driver(hsotg->driver); |
3583 | } | 3584 | } |
3584 | 3585 | ||
3585 | s3c_hsotg_phy_disable(hsotg); | ||
3586 | if (hsotg->phy) | ||
3587 | phy_exit(hsotg->phy); | ||
3588 | clk_disable_unprepare(hsotg->clk); | 3586 | clk_disable_unprepare(hsotg->clk); |
3589 | 3587 | ||
3590 | return 0; | 3588 | return 0; |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b769c1faaf03..9069984fe5cf 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -799,20 +799,21 @@ static int dwc3_remove(struct platform_device *pdev) | |||
799 | { | 799 | { |
800 | struct dwc3 *dwc = platform_get_drvdata(pdev); | 800 | struct dwc3 *dwc = platform_get_drvdata(pdev); |
801 | 801 | ||
802 | dwc3_debugfs_exit(dwc); | ||
803 | dwc3_core_exit_mode(dwc); | ||
804 | dwc3_event_buffers_cleanup(dwc); | ||
805 | dwc3_free_event_buffers(dwc); | ||
806 | |||
802 | usb_phy_set_suspend(dwc->usb2_phy, 1); | 807 | usb_phy_set_suspend(dwc->usb2_phy, 1); |
803 | usb_phy_set_suspend(dwc->usb3_phy, 1); | 808 | usb_phy_set_suspend(dwc->usb3_phy, 1); |
804 | phy_power_off(dwc->usb2_generic_phy); | 809 | phy_power_off(dwc->usb2_generic_phy); |
805 | phy_power_off(dwc->usb3_generic_phy); | 810 | phy_power_off(dwc->usb3_generic_phy); |
806 | 811 | ||
812 | dwc3_core_exit(dwc); | ||
813 | |||
807 | pm_runtime_put_sync(&pdev->dev); | 814 | pm_runtime_put_sync(&pdev->dev); |
808 | pm_runtime_disable(&pdev->dev); | 815 | pm_runtime_disable(&pdev->dev); |
809 | 816 | ||
810 | dwc3_debugfs_exit(dwc); | ||
811 | dwc3_core_exit_mode(dwc); | ||
812 | dwc3_event_buffers_cleanup(dwc); | ||
813 | dwc3_free_event_buffers(dwc); | ||
814 | dwc3_core_exit(dwc); | ||
815 | |||
816 | return 0; | 817 | return 0; |
817 | } | 818 | } |
818 | 819 | ||
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 9dcfbe7cd5f5..fc0de3753648 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -576,9 +576,9 @@ static int dwc3_omap_remove(struct platform_device *pdev) | |||
576 | if (omap->extcon_id_dev.edev) | 576 | if (omap->extcon_id_dev.edev) |
577 | extcon_unregister_interest(&omap->extcon_id_dev); | 577 | extcon_unregister_interest(&omap->extcon_id_dev); |
578 | dwc3_omap_disable_irqs(omap); | 578 | dwc3_omap_disable_irqs(omap); |
579 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | ||
579 | pm_runtime_put_sync(&pdev->dev); | 580 | pm_runtime_put_sync(&pdev->dev); |
580 | pm_runtime_disable(&pdev->dev); | 581 | pm_runtime_disable(&pdev->dev); |
581 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | ||
582 | 582 | ||
583 | return 0; | 583 | return 0; |
584 | } | 584 | } |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 349cacc577d8..490a6ca00733 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -527,7 +527,7 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, | |||
527 | dep->stream_capable = true; | 527 | dep->stream_capable = true; |
528 | } | 528 | } |
529 | 529 | ||
530 | if (usb_endpoint_xfer_isoc(desc)) | 530 | if (!usb_endpoint_xfer_control(desc)) |
531 | params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; | 531 | params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; |
532 | 532 | ||
533 | /* | 533 | /* |
@@ -1225,16 +1225,17 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, | |||
1225 | 1225 | ||
1226 | int ret; | 1226 | int ret; |
1227 | 1227 | ||
1228 | spin_lock_irqsave(&dwc->lock, flags); | ||
1228 | if (!dep->endpoint.desc) { | 1229 | if (!dep->endpoint.desc) { |
1229 | dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", | 1230 | dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", |
1230 | request, ep->name); | 1231 | request, ep->name); |
1232 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1231 | return -ESHUTDOWN; | 1233 | return -ESHUTDOWN; |
1232 | } | 1234 | } |
1233 | 1235 | ||
1234 | dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", | 1236 | dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", |
1235 | request, ep->name, request->length); | 1237 | request, ep->name, request->length); |
1236 | 1238 | ||
1237 | spin_lock_irqsave(&dwc->lock, flags); | ||
1238 | ret = __dwc3_gadget_ep_queue(dep, req); | 1239 | ret = __dwc3_gadget_ep_queue(dep, req); |
1239 | spin_unlock_irqrestore(&dwc->lock, flags); | 1240 | spin_unlock_irqrestore(&dwc->lock, flags); |
1240 | 1241 | ||
@@ -2041,12 +2042,6 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, | |||
2041 | dwc3_endpoint_transfer_complete(dwc, dep, event); | 2042 | dwc3_endpoint_transfer_complete(dwc, dep, event); |
2042 | break; | 2043 | break; |
2043 | case DWC3_DEPEVT_XFERINPROGRESS: | 2044 | case DWC3_DEPEVT_XFERINPROGRESS: |
2044 | if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
2045 | dev_dbg(dwc->dev, "%s is not an Isochronous endpoint\n", | ||
2046 | dep->name); | ||
2047 | return; | ||
2048 | } | ||
2049 | |||
2050 | dwc3_endpoint_transfer_complete(dwc, dep, event); | 2045 | dwc3_endpoint_transfer_complete(dwc, dep, event); |
2051 | break; | 2046 | break; |
2052 | case DWC3_DEPEVT_XFERNOTREADY: | 2047 | case DWC3_DEPEVT_XFERNOTREADY: |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index dc30adf15a01..0dc3552d1360 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -155,6 +155,12 @@ struct ffs_io_data { | |||
155 | struct usb_request *req; | 155 | struct usb_request *req; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | struct ffs_desc_helper { | ||
159 | struct ffs_data *ffs; | ||
160 | unsigned interfaces_count; | ||
161 | unsigned eps_count; | ||
162 | }; | ||
163 | |||
158 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); | 164 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); |
159 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); | 165 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); |
160 | 166 | ||
@@ -1830,7 +1836,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1830 | u8 *valuep, struct usb_descriptor_header *desc, | 1836 | u8 *valuep, struct usb_descriptor_header *desc, |
1831 | void *priv) | 1837 | void *priv) |
1832 | { | 1838 | { |
1833 | struct ffs_data *ffs = priv; | 1839 | struct ffs_desc_helper *helper = priv; |
1840 | struct usb_endpoint_descriptor *d; | ||
1834 | 1841 | ||
1835 | ENTER(); | 1842 | ENTER(); |
1836 | 1843 | ||
@@ -1844,8 +1851,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1844 | * encountered interface "n" then there are at least | 1851 | * encountered interface "n" then there are at least |
1845 | * "n+1" interfaces. | 1852 | * "n+1" interfaces. |
1846 | */ | 1853 | */ |
1847 | if (*valuep >= ffs->interfaces_count) | 1854 | if (*valuep >= helper->interfaces_count) |
1848 | ffs->interfaces_count = *valuep + 1; | 1855 | helper->interfaces_count = *valuep + 1; |
1849 | break; | 1856 | break; |
1850 | 1857 | ||
1851 | case FFS_STRING: | 1858 | case FFS_STRING: |
@@ -1853,14 +1860,22 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1853 | * Strings are indexed from 1 (0 is magic ;) reserved | 1860 | * Strings are indexed from 1 (0 is magic ;) reserved |
1854 | * for languages list or some such) | 1861 | * for languages list or some such) |
1855 | */ | 1862 | */ |
1856 | if (*valuep > ffs->strings_count) | 1863 | if (*valuep > helper->ffs->strings_count) |
1857 | ffs->strings_count = *valuep; | 1864 | helper->ffs->strings_count = *valuep; |
1858 | break; | 1865 | break; |
1859 | 1866 | ||
1860 | case FFS_ENDPOINT: | 1867 | case FFS_ENDPOINT: |
1861 | /* Endpoints are indexed from 1 as well. */ | 1868 | d = (void *)desc; |
1862 | if ((*valuep & USB_ENDPOINT_NUMBER_MASK) > ffs->eps_count) | 1869 | helper->eps_count++; |
1863 | ffs->eps_count = (*valuep & USB_ENDPOINT_NUMBER_MASK); | 1870 | if (helper->eps_count >= 15) |
1871 | return -EINVAL; | ||
1872 | /* Check if descriptors for any speed were already parsed */ | ||
1873 | if (!helper->ffs->eps_count && !helper->ffs->interfaces_count) | ||
1874 | helper->ffs->eps_addrmap[helper->eps_count] = | ||
1875 | d->bEndpointAddress; | ||
1876 | else if (helper->ffs->eps_addrmap[helper->eps_count] != | ||
1877 | d->bEndpointAddress) | ||
1878 | return -EINVAL; | ||
1864 | break; | 1879 | break; |
1865 | } | 1880 | } |
1866 | 1881 | ||
@@ -2053,6 +2068,7 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2053 | char *data = _data, *raw_descs; | 2068 | char *data = _data, *raw_descs; |
2054 | unsigned os_descs_count = 0, counts[3], flags; | 2069 | unsigned os_descs_count = 0, counts[3], flags; |
2055 | int ret = -EINVAL, i; | 2070 | int ret = -EINVAL, i; |
2071 | struct ffs_desc_helper helper; | ||
2056 | 2072 | ||
2057 | ENTER(); | 2073 | ENTER(); |
2058 | 2074 | ||
@@ -2101,13 +2117,29 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2101 | 2117 | ||
2102 | /* Read descriptors */ | 2118 | /* Read descriptors */ |
2103 | raw_descs = data; | 2119 | raw_descs = data; |
2120 | helper.ffs = ffs; | ||
2104 | for (i = 0; i < 3; ++i) { | 2121 | for (i = 0; i < 3; ++i) { |
2105 | if (!counts[i]) | 2122 | if (!counts[i]) |
2106 | continue; | 2123 | continue; |
2124 | helper.interfaces_count = 0; | ||
2125 | helper.eps_count = 0; | ||
2107 | ret = ffs_do_descs(counts[i], data, len, | 2126 | ret = ffs_do_descs(counts[i], data, len, |
2108 | __ffs_data_do_entity, ffs); | 2127 | __ffs_data_do_entity, &helper); |
2109 | if (ret < 0) | 2128 | if (ret < 0) |
2110 | goto error; | 2129 | goto error; |
2130 | if (!ffs->eps_count && !ffs->interfaces_count) { | ||
2131 | ffs->eps_count = helper.eps_count; | ||
2132 | ffs->interfaces_count = helper.interfaces_count; | ||
2133 | } else { | ||
2134 | if (ffs->eps_count != helper.eps_count) { | ||
2135 | ret = -EINVAL; | ||
2136 | goto error; | ||
2137 | } | ||
2138 | if (ffs->interfaces_count != helper.interfaces_count) { | ||
2139 | ret = -EINVAL; | ||
2140 | goto error; | ||
2141 | } | ||
2142 | } | ||
2111 | data += ret; | 2143 | data += ret; |
2112 | len -= ret; | 2144 | len -= ret; |
2113 | } | 2145 | } |
@@ -2342,9 +2374,18 @@ static void ffs_event_add(struct ffs_data *ffs, | |||
2342 | spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); | 2374 | spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); |
2343 | } | 2375 | } |
2344 | 2376 | ||
2345 | |||
2346 | /* Bind/unbind USB function hooks *******************************************/ | 2377 | /* Bind/unbind USB function hooks *******************************************/ |
2347 | 2378 | ||
2379 | static int ffs_ep_addr2idx(struct ffs_data *ffs, u8 endpoint_address) | ||
2380 | { | ||
2381 | int i; | ||
2382 | |||
2383 | for (i = 1; i < ARRAY_SIZE(ffs->eps_addrmap); ++i) | ||
2384 | if (ffs->eps_addrmap[i] == endpoint_address) | ||
2385 | return i; | ||
2386 | return -ENOENT; | ||
2387 | } | ||
2388 | |||
2348 | static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | 2389 | static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, |
2349 | struct usb_descriptor_header *desc, | 2390 | struct usb_descriptor_header *desc, |
2350 | void *priv) | 2391 | void *priv) |
@@ -2378,7 +2419,10 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2378 | if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT) | 2419 | if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT) |
2379 | return 0; | 2420 | return 0; |
2380 | 2421 | ||
2381 | idx = (ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) - 1; | 2422 | idx = ffs_ep_addr2idx(func->ffs, ds->bEndpointAddress) - 1; |
2423 | if (idx < 0) | ||
2424 | return idx; | ||
2425 | |||
2382 | ffs_ep = func->eps + idx; | 2426 | ffs_ep = func->eps + idx; |
2383 | 2427 | ||
2384 | if (unlikely(ffs_ep->descs[ep_desc_id])) { | 2428 | if (unlikely(ffs_ep->descs[ep_desc_id])) { |
diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h index 63d6e71569c1..d48897e8ffeb 100644 --- a/drivers/usb/gadget/function/u_fs.h +++ b/drivers/usb/gadget/function/u_fs.h | |||
@@ -224,6 +224,8 @@ struct ffs_data { | |||
224 | void *ms_os_descs_ext_prop_name_avail; | 224 | void *ms_os_descs_ext_prop_name_avail; |
225 | void *ms_os_descs_ext_prop_data_avail; | 225 | void *ms_os_descs_ext_prop_data_avail; |
226 | 226 | ||
227 | u8 eps_addrmap[15]; | ||
228 | |||
227 | unsigned short strings_count; | 229 | unsigned short strings_count; |
228 | unsigned short interfaces_count; | 230 | unsigned short interfaces_count; |
229 | unsigned short eps_count; | 231 | unsigned short eps_count; |
diff --git a/drivers/usb/gadget/udc/fusb300_udc.h b/drivers/usb/gadget/udc/fusb300_udc.h index ae811d8d38b4..ad39f892d200 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.h +++ b/drivers/usb/gadget/udc/fusb300_udc.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | 13 | ||
14 | #ifndef __FUSB300_UDC_H__ | 14 | #ifndef __FUSB300_UDC_H__ |
15 | #define __FUSB300_UDC_H_ | 15 | #define __FUSB300_UDC_H__ |
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | 18 | ||
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index f4eac113690e..2e95715b50c0 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c | |||
@@ -3320,7 +3320,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3320 | if (stat & tmp) { | 3320 | if (stat & tmp) { |
3321 | writel(tmp, &dev->regs->irqstat1); | 3321 | writel(tmp, &dev->regs->irqstat1); |
3322 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && | 3322 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && |
3323 | (readl(&dev->usb->usbstat) & mask)) || | 3323 | ((readl(&dev->usb->usbstat) & mask) == 0)) || |
3324 | ((readl(&dev->usb->usbctl) & | 3324 | ((readl(&dev->usb->usbctl) & |
3325 | BIT(VBUS_PIN)) == 0)) && | 3325 | BIT(VBUS_PIN)) == 0)) && |
3326 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { | 3326 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 81cda09b47e3..488a30836c36 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -965,8 +965,6 @@ rescan: | |||
965 | } | 965 | } |
966 | 966 | ||
967 | qh->exception = 1; | 967 | qh->exception = 1; |
968 | if (ehci->rh_state < EHCI_RH_RUNNING) | ||
969 | qh->qh_state = QH_STATE_IDLE; | ||
970 | switch (qh->qh_state) { | 968 | switch (qh->qh_state) { |
971 | case QH_STATE_LINKED: | 969 | case QH_STATE_LINKED: |
972 | WARN_ON(!list_empty(&qh->qtd_list)); | 970 | WARN_ON(!list_empty(&qh->qtd_list)); |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa79e8749040..69aece31143a 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -468,7 +468,8 @@ static void xhci_hub_report_usb2_link_state(u32 *status, u32 status_reg) | |||
468 | } | 468 | } |
469 | 469 | ||
470 | /* Updates Link Status for super Speed port */ | 470 | /* Updates Link Status for super Speed port */ |
471 | static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) | 471 | static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, |
472 | u32 *status, u32 status_reg) | ||
472 | { | 473 | { |
473 | u32 pls = status_reg & PORT_PLS_MASK; | 474 | u32 pls = status_reg & PORT_PLS_MASK; |
474 | 475 | ||
@@ -507,7 +508,8 @@ static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) | |||
507 | * in which sometimes the port enters compliance mode | 508 | * in which sometimes the port enters compliance mode |
508 | * caused by a delay on the host-device negotiation. | 509 | * caused by a delay on the host-device negotiation. |
509 | */ | 510 | */ |
510 | if (pls == USB_SS_PORT_LS_COMP_MOD) | 511 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
512 | (pls == USB_SS_PORT_LS_COMP_MOD)) | ||
511 | pls |= USB_PORT_STAT_CONNECTION; | 513 | pls |= USB_PORT_STAT_CONNECTION; |
512 | } | 514 | } |
513 | 515 | ||
@@ -666,7 +668,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | |||
666 | } | 668 | } |
667 | /* Update Port Link State */ | 669 | /* Update Port Link State */ |
668 | if (hcd->speed == HCD_USB3) { | 670 | if (hcd->speed == HCD_USB3) { |
669 | xhci_hub_report_usb3_link_state(&status, raw_port_status); | 671 | xhci_hub_report_usb3_link_state(xhci, &status, raw_port_status); |
670 | /* | 672 | /* |
671 | * Verify if all USB3 Ports Have entered U0 already. | 673 | * Verify if all USB3 Ports Have entered U0 already. |
672 | * Delete Compliance Mode Timer if so. | 674 | * Delete Compliance Mode Timer if so. |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 8056d90690ee..8936211b161d 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1812,6 +1812,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | 1812 | ||
1813 | if (xhci->lpm_command) | 1813 | if (xhci->lpm_command) |
1814 | xhci_free_command(xhci, xhci->lpm_command); | 1814 | xhci_free_command(xhci, xhci->lpm_command); |
1815 | xhci->lpm_command = NULL; | ||
1815 | if (xhci->cmd_ring) | 1816 | if (xhci->cmd_ring) |
1816 | xhci_ring_free(xhci, xhci->cmd_ring); | 1817 | xhci_ring_free(xhci, xhci->cmd_ring); |
1817 | xhci->cmd_ring = NULL; | 1818 | xhci->cmd_ring = NULL; |
@@ -1819,7 +1820,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1819 | xhci_cleanup_command_queue(xhci); | 1820 | xhci_cleanup_command_queue(xhci); |
1820 | 1821 | ||
1821 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1822 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1822 | for (i = 0; i < num_ports; i++) { | 1823 | for (i = 0; i < num_ports && xhci->rh_bw; i++) { |
1823 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; | 1824 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; |
1824 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { | 1825 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { |
1825 | struct list_head *ep = &bwt->interval_bw[j].endpoints; | 1826 | struct list_head *ep = &bwt->interval_bw[j].endpoints; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index c020b094fe7d..c4a8fca8ae93 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3971,13 +3971,21 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, | |||
3971 | int ret; | 3971 | int ret; |
3972 | 3972 | ||
3973 | spin_lock_irqsave(&xhci->lock, flags); | 3973 | spin_lock_irqsave(&xhci->lock, flags); |
3974 | if (max_exit_latency == xhci->devs[udev->slot_id]->current_mel) { | 3974 | |
3975 | virt_dev = xhci->devs[udev->slot_id]; | ||
3976 | |||
3977 | /* | ||
3978 | * virt_dev might not exists yet if xHC resumed from hibernate (S4) and | ||
3979 | * xHC was re-initialized. Exit latency will be set later after | ||
3980 | * hub_port_finish_reset() is done and xhci->devs[] are re-allocated | ||
3981 | */ | ||
3982 | |||
3983 | if (!virt_dev || max_exit_latency == virt_dev->current_mel) { | ||
3975 | spin_unlock_irqrestore(&xhci->lock, flags); | 3984 | spin_unlock_irqrestore(&xhci->lock, flags); |
3976 | return 0; | 3985 | return 0; |
3977 | } | 3986 | } |
3978 | 3987 | ||
3979 | /* Attempt to issue an Evaluate Context command to change the MEL. */ | 3988 | /* Attempt to issue an Evaluate Context command to change the MEL. */ |
3980 | virt_dev = xhci->devs[udev->slot_id]; | ||
3981 | command = xhci->lpm_command; | 3989 | command = xhci->lpm_command; |
3982 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 3990 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); |
3983 | if (!ctrl_ctx) { | 3991 | if (!ctrl_ctx) { |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 47ae6455d073..3ee133f675ab 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -39,6 +39,7 @@ struct cppi41_dma_channel { | |||
39 | u32 transferred; | 39 | u32 transferred; |
40 | u32 packet_sz; | 40 | u32 packet_sz; |
41 | struct list_head tx_check; | 41 | struct list_head tx_check; |
42 | int tx_zlp; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #define MUSB_DMA_NUM_CHANNELS 15 | 45 | #define MUSB_DMA_NUM_CHANNELS 15 |
@@ -122,6 +123,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
122 | { | 123 | { |
123 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; | 124 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; |
124 | struct musb *musb = hw_ep->musb; | 125 | struct musb *musb = hw_ep->musb; |
126 | void __iomem *epio = hw_ep->regs; | ||
127 | u16 csr; | ||
125 | 128 | ||
126 | if (!cppi41_channel->prog_len || | 129 | if (!cppi41_channel->prog_len || |
127 | (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)) { | 130 | (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)) { |
@@ -131,15 +134,24 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
131 | cppi41_channel->transferred; | 134 | cppi41_channel->transferred; |
132 | cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE; | 135 | cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE; |
133 | cppi41_channel->channel.rx_packet_done = true; | 136 | cppi41_channel->channel.rx_packet_done = true; |
137 | |||
138 | /* | ||
139 | * transmit ZLP using PIO mode for transfers which size is | ||
140 | * multiple of EP packet size. | ||
141 | */ | ||
142 | if (cppi41_channel->tx_zlp && (cppi41_channel->transferred % | ||
143 | cppi41_channel->packet_sz) == 0) { | ||
144 | musb_ep_select(musb->mregs, hw_ep->epnum); | ||
145 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; | ||
146 | musb_writew(epio, MUSB_TXCSR, csr); | ||
147 | } | ||
134 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); | 148 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); |
135 | } else { | 149 | } else { |
136 | /* next iteration, reload */ | 150 | /* next iteration, reload */ |
137 | struct dma_chan *dc = cppi41_channel->dc; | 151 | struct dma_chan *dc = cppi41_channel->dc; |
138 | struct dma_async_tx_descriptor *dma_desc; | 152 | struct dma_async_tx_descriptor *dma_desc; |
139 | enum dma_transfer_direction direction; | 153 | enum dma_transfer_direction direction; |
140 | u16 csr; | ||
141 | u32 remain_bytes; | 154 | u32 remain_bytes; |
142 | void __iomem *epio = cppi41_channel->hw_ep->regs; | ||
143 | 155 | ||
144 | cppi41_channel->buf_addr += cppi41_channel->packet_sz; | 156 | cppi41_channel->buf_addr += cppi41_channel->packet_sz; |
145 | 157 | ||
@@ -363,6 +375,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
363 | cppi41_channel->total_len = len; | 375 | cppi41_channel->total_len = len; |
364 | cppi41_channel->transferred = 0; | 376 | cppi41_channel->transferred = 0; |
365 | cppi41_channel->packet_sz = packet_sz; | 377 | cppi41_channel->packet_sz = packet_sz; |
378 | cppi41_channel->tx_zlp = (cppi41_channel->is_tx && mode) ? 1 : 0; | ||
366 | 379 | ||
367 | /* | 380 | /* |
368 | * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more | 381 | * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more |
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index c42bdf0c4a1f..00972eca04e7 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2012-2013 Freescale Semiconductor, Inc. | 2 | * Copyright 2012-2014 Freescale Semiconductor, Inc. |
3 | * Copyright (C) 2012 Marek Vasut <marex@denx.de> | 3 | * Copyright (C) 2012 Marek Vasut <marex@denx.de> |
4 | * on behalf of DENX Software Engineering GmbH | 4 | * on behalf of DENX Software Engineering GmbH |
5 | * | 5 | * |
@@ -125,7 +125,13 @@ static const struct mxs_phy_data imx6sl_phy_data = { | |||
125 | MXS_PHY_NEED_IP_FIX, | 125 | MXS_PHY_NEED_IP_FIX, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static const struct mxs_phy_data imx6sx_phy_data = { | ||
129 | .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | | ||
130 | MXS_PHY_NEED_IP_FIX, | ||
131 | }; | ||
132 | |||
128 | static const struct of_device_id mxs_phy_dt_ids[] = { | 133 | static const struct of_device_id mxs_phy_dt_ids[] = { |
134 | { .compatible = "fsl,imx6sx-usbphy", .data = &imx6sx_phy_data, }, | ||
129 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, | 135 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, |
130 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, | 136 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, |
131 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, | 137 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, |
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index 13b4fa287da8..886f1807a67b 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c | |||
@@ -878,8 +878,8 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, | |||
878 | return -ENOMEM; | 878 | return -ENOMEM; |
879 | } | 879 | } |
880 | 880 | ||
881 | tegra_phy->config = devm_kzalloc(&pdev->dev, | 881 | tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config), |
882 | sizeof(*tegra_phy->config), GFP_KERNEL); | 882 | GFP_KERNEL); |
883 | if (!tegra_phy->config) { | 883 | if (!tegra_phy->config) { |
884 | dev_err(&pdev->dev, | 884 | dev_err(&pdev->dev, |
885 | "unable to allocate memory for USB UTMIP config\n"); | 885 | "unable to allocate memory for USB UTMIP config\n"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 4fd36530bfa3..b0c97a3f1bfe 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -108,19 +108,45 @@ static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe) | |||
108 | return list_first_entry(&pipe->list, struct usbhs_pkt, node); | 108 | return list_first_entry(&pipe->list, struct usbhs_pkt, node); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void usbhsf_fifo_clear(struct usbhs_pipe *pipe, | ||
112 | struct usbhs_fifo *fifo); | ||
113 | static void usbhsf_fifo_unselect(struct usbhs_pipe *pipe, | ||
114 | struct usbhs_fifo *fifo); | ||
115 | static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo, | ||
116 | struct usbhs_pkt *pkt); | ||
117 | #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) | ||
118 | #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) | ||
119 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); | ||
111 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) | 120 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) |
112 | { | 121 | { |
113 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | 122 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
123 | struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe); | ||
114 | unsigned long flags; | 124 | unsigned long flags; |
115 | 125 | ||
116 | /******************** spin lock ********************/ | 126 | /******************** spin lock ********************/ |
117 | usbhs_lock(priv, flags); | 127 | usbhs_lock(priv, flags); |
118 | 128 | ||
129 | usbhs_pipe_disable(pipe); | ||
130 | |||
119 | if (!pkt) | 131 | if (!pkt) |
120 | pkt = __usbhsf_pkt_get(pipe); | 132 | pkt = __usbhsf_pkt_get(pipe); |
121 | 133 | ||
122 | if (pkt) | 134 | if (pkt) { |
135 | struct dma_chan *chan = NULL; | ||
136 | |||
137 | if (fifo) | ||
138 | chan = usbhsf_dma_chan_get(fifo, pkt); | ||
139 | if (chan) { | ||
140 | dmaengine_terminate_all(chan); | ||
141 | usbhsf_fifo_clear(pipe, fifo); | ||
142 | usbhsf_dma_unmap(pkt); | ||
143 | } | ||
144 | |||
123 | __usbhsf_pkt_del(pkt); | 145 | __usbhsf_pkt_del(pkt); |
146 | } | ||
147 | |||
148 | if (fifo) | ||
149 | usbhsf_fifo_unselect(pipe, fifo); | ||
124 | 150 | ||
125 | usbhs_unlock(priv, flags); | 151 | usbhs_unlock(priv, flags); |
126 | /******************** spin unlock ******************/ | 152 | /******************** spin unlock ******************/ |
@@ -544,6 +570,7 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done) | |||
544 | usbhsf_send_terminator(pipe, fifo); | 570 | usbhsf_send_terminator(pipe, fifo); |
545 | 571 | ||
546 | usbhsf_tx_irq_ctrl(pipe, !*is_done); | 572 | usbhsf_tx_irq_ctrl(pipe, !*is_done); |
573 | usbhs_pipe_running(pipe, !*is_done); | ||
547 | usbhs_pipe_enable(pipe); | 574 | usbhs_pipe_enable(pipe); |
548 | 575 | ||
549 | dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n", | 576 | dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n", |
@@ -570,12 +597,21 @@ usbhs_fifo_write_busy: | |||
570 | * retry in interrupt | 597 | * retry in interrupt |
571 | */ | 598 | */ |
572 | usbhsf_tx_irq_ctrl(pipe, 1); | 599 | usbhsf_tx_irq_ctrl(pipe, 1); |
600 | usbhs_pipe_running(pipe, 1); | ||
573 | 601 | ||
574 | return ret; | 602 | return ret; |
575 | } | 603 | } |
576 | 604 | ||
605 | static int usbhsf_pio_prepare_push(struct usbhs_pkt *pkt, int *is_done) | ||
606 | { | ||
607 | if (usbhs_pipe_is_running(pkt->pipe)) | ||
608 | return 0; | ||
609 | |||
610 | return usbhsf_pio_try_push(pkt, is_done); | ||
611 | } | ||
612 | |||
577 | struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { | 613 | struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { |
578 | .prepare = usbhsf_pio_try_push, | 614 | .prepare = usbhsf_pio_prepare_push, |
579 | .try_run = usbhsf_pio_try_push, | 615 | .try_run = usbhsf_pio_try_push, |
580 | }; | 616 | }; |
581 | 617 | ||
@@ -589,6 +625,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
589 | if (usbhs_pipe_is_busy(pipe)) | 625 | if (usbhs_pipe_is_busy(pipe)) |
590 | return 0; | 626 | return 0; |
591 | 627 | ||
628 | if (usbhs_pipe_is_running(pipe)) | ||
629 | return 0; | ||
630 | |||
592 | /* | 631 | /* |
593 | * pipe enable to prepare packet receive | 632 | * pipe enable to prepare packet receive |
594 | */ | 633 | */ |
@@ -597,6 +636,7 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
597 | 636 | ||
598 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); | 637 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); |
599 | usbhs_pipe_enable(pipe); | 638 | usbhs_pipe_enable(pipe); |
639 | usbhs_pipe_running(pipe, 1); | ||
600 | usbhsf_rx_irq_ctrl(pipe, 1); | 640 | usbhsf_rx_irq_ctrl(pipe, 1); |
601 | 641 | ||
602 | return 0; | 642 | return 0; |
@@ -642,6 +682,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done) | |||
642 | (total_len < maxp)) { /* short packet */ | 682 | (total_len < maxp)) { /* short packet */ |
643 | *is_done = 1; | 683 | *is_done = 1; |
644 | usbhsf_rx_irq_ctrl(pipe, 0); | 684 | usbhsf_rx_irq_ctrl(pipe, 0); |
685 | usbhs_pipe_running(pipe, 0); | ||
645 | usbhs_pipe_disable(pipe); /* disable pipe first */ | 686 | usbhs_pipe_disable(pipe); /* disable pipe first */ |
646 | } | 687 | } |
647 | 688 | ||
@@ -763,8 +804,6 @@ static void __usbhsf_dma_ctrl(struct usbhs_pipe *pipe, | |||
763 | usbhs_bset(priv, fifo->sel, DREQE, dreqe); | 804 | usbhs_bset(priv, fifo->sel, DREQE, dreqe); |
764 | } | 805 | } |
765 | 806 | ||
766 | #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) | ||
767 | #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) | ||
768 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map) | 807 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map) |
769 | { | 808 | { |
770 | struct usbhs_pipe *pipe = pkt->pipe; | 809 | struct usbhs_pipe *pipe = pkt->pipe; |
@@ -805,6 +844,7 @@ static void xfer_work(struct work_struct *work) | |||
805 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 844 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
806 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); | 845 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); |
807 | 846 | ||
847 | usbhs_pipe_running(pipe, 1); | ||
808 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); | 848 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); |
809 | usbhs_pipe_enable(pipe); | 849 | usbhs_pipe_enable(pipe); |
810 | usbhsf_dma_start(pipe, fifo); | 850 | usbhsf_dma_start(pipe, fifo); |
@@ -836,6 +876,10 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) | |||
836 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ | 876 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ |
837 | goto usbhsf_pio_prepare_push; | 877 | goto usbhsf_pio_prepare_push; |
838 | 878 | ||
879 | /* return at this time if the pipe is running */ | ||
880 | if (usbhs_pipe_is_running(pipe)) | ||
881 | return 0; | ||
882 | |||
839 | /* get enable DMA fifo */ | 883 | /* get enable DMA fifo */ |
840 | fifo = usbhsf_get_dma_fifo(priv, pkt); | 884 | fifo = usbhsf_get_dma_fifo(priv, pkt); |
841 | if (!fifo) | 885 | if (!fifo) |
@@ -869,15 +913,29 @@ usbhsf_pio_prepare_push: | |||
869 | static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) | 913 | static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) |
870 | { | 914 | { |
871 | struct usbhs_pipe *pipe = pkt->pipe; | 915 | struct usbhs_pipe *pipe = pkt->pipe; |
916 | int is_short = pkt->trans % usbhs_pipe_get_maxpacket(pipe); | ||
917 | |||
918 | pkt->actual += pkt->trans; | ||
872 | 919 | ||
873 | pkt->actual = pkt->trans; | 920 | if (pkt->actual < pkt->length) |
921 | *is_done = 0; /* there are remainder data */ | ||
922 | else if (is_short) | ||
923 | *is_done = 1; /* short packet */ | ||
924 | else | ||
925 | *is_done = !pkt->zero; /* send zero packet? */ | ||
874 | 926 | ||
875 | *is_done = !pkt->zero; /* send zero packet ? */ | 927 | usbhs_pipe_running(pipe, !*is_done); |
876 | 928 | ||
877 | usbhsf_dma_stop(pipe, pipe->fifo); | 929 | usbhsf_dma_stop(pipe, pipe->fifo); |
878 | usbhsf_dma_unmap(pkt); | 930 | usbhsf_dma_unmap(pkt); |
879 | usbhsf_fifo_unselect(pipe, pipe->fifo); | 931 | usbhsf_fifo_unselect(pipe, pipe->fifo); |
880 | 932 | ||
933 | if (!*is_done) { | ||
934 | /* change handler to PIO */ | ||
935 | pkt->handler = &usbhs_fifo_pio_push_handler; | ||
936 | return pkt->handler->try_run(pkt, is_done); | ||
937 | } | ||
938 | |||
881 | return 0; | 939 | return 0; |
882 | } | 940 | } |
883 | 941 | ||
@@ -972,8 +1030,10 @@ static int usbhsf_dma_pop_done(struct usbhs_pkt *pkt, int *is_done) | |||
972 | if ((pkt->actual == pkt->length) || /* receive all data */ | 1030 | if ((pkt->actual == pkt->length) || /* receive all data */ |
973 | (pkt->trans < maxp)) { /* short packet */ | 1031 | (pkt->trans < maxp)) { /* short packet */ |
974 | *is_done = 1; | 1032 | *is_done = 1; |
1033 | usbhs_pipe_running(pipe, 0); | ||
975 | } else { | 1034 | } else { |
976 | /* re-enable */ | 1035 | /* re-enable */ |
1036 | usbhs_pipe_running(pipe, 0); | ||
977 | usbhsf_prepare_pop(pkt, is_done); | 1037 | usbhsf_prepare_pop(pkt, is_done); |
978 | } | 1038 | } |
979 | 1039 | ||
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 6a030b931a3b..9a705b15b3a1 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
@@ -213,7 +213,10 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, | |||
213 | { | 213 | { |
214 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); | 214 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); |
215 | u16 intenb0, intenb1; | 215 | u16 intenb0, intenb1; |
216 | unsigned long flags; | ||
216 | 217 | ||
218 | /******************** spin lock ********************/ | ||
219 | usbhs_lock(priv, flags); | ||
217 | state->intsts0 = usbhs_read(priv, INTSTS0); | 220 | state->intsts0 = usbhs_read(priv, INTSTS0); |
218 | state->intsts1 = usbhs_read(priv, INTSTS1); | 221 | state->intsts1 = usbhs_read(priv, INTSTS1); |
219 | 222 | ||
@@ -229,6 +232,8 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, | |||
229 | state->bempsts &= mod->irq_bempsts; | 232 | state->bempsts &= mod->irq_bempsts; |
230 | state->brdysts &= mod->irq_brdysts; | 233 | state->brdysts &= mod->irq_brdysts; |
231 | } | 234 | } |
235 | usbhs_unlock(priv, flags); | ||
236 | /******************** spin unlock ******************/ | ||
232 | 237 | ||
233 | /* | 238 | /* |
234 | * Check whether the irq enable registers and the irq status are set | 239 | * Check whether the irq enable registers and the irq status are set |
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 75fbcf6b102e..040bcefcb040 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c | |||
@@ -578,6 +578,19 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe) | |||
578 | return usbhsp_flags_has(pipe, IS_DIR_HOST); | 578 | return usbhsp_flags_has(pipe, IS_DIR_HOST); |
579 | } | 579 | } |
580 | 580 | ||
581 | int usbhs_pipe_is_running(struct usbhs_pipe *pipe) | ||
582 | { | ||
583 | return usbhsp_flags_has(pipe, IS_RUNNING); | ||
584 | } | ||
585 | |||
586 | void usbhs_pipe_running(struct usbhs_pipe *pipe, int running) | ||
587 | { | ||
588 | if (running) | ||
589 | usbhsp_flags_set(pipe, IS_RUNNING); | ||
590 | else | ||
591 | usbhsp_flags_clr(pipe, IS_RUNNING); | ||
592 | } | ||
593 | |||
581 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) | 594 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) |
582 | { | 595 | { |
583 | u16 mask = (SQCLR | SQSET); | 596 | u16 mask = (SQCLR | SQSET); |
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h index 406f36d050e4..d24a05972370 100644 --- a/drivers/usb/renesas_usbhs/pipe.h +++ b/drivers/usb/renesas_usbhs/pipe.h | |||
@@ -36,6 +36,7 @@ struct usbhs_pipe { | |||
36 | #define USBHS_PIPE_FLAGS_IS_USED (1 << 0) | 36 | #define USBHS_PIPE_FLAGS_IS_USED (1 << 0) |
37 | #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) | 37 | #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) |
38 | #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) | 38 | #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) |
39 | #define USBHS_PIPE_FLAGS_IS_RUNNING (1 << 3) | ||
39 | 40 | ||
40 | struct usbhs_pkt_handle *handler; | 41 | struct usbhs_pkt_handle *handler; |
41 | 42 | ||
@@ -80,6 +81,9 @@ int usbhs_pipe_probe(struct usbhs_priv *priv); | |||
80 | void usbhs_pipe_remove(struct usbhs_priv *priv); | 81 | void usbhs_pipe_remove(struct usbhs_priv *priv); |
81 | int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe); | 82 | int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe); |
82 | int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); | 83 | int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); |
84 | int usbhs_pipe_is_running(struct usbhs_pipe *pipe); | ||
85 | void usbhs_pipe_running(struct usbhs_pipe *pipe, int running); | ||
86 | |||
83 | void usbhs_pipe_init(struct usbhs_priv *priv, | 87 | void usbhs_pipe_init(struct usbhs_priv *priv, |
84 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); | 88 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); |
85 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); | 89 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 824ea5e7ec8b..dc72b924c399 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -728,6 +728,7 @@ static const struct usb_device_id id_table_combined[] = { | |||
728 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 728 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
729 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 729 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
730 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 730 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
731 | { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, | ||
731 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, | 732 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
732 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, | 733 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
733 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, | 734 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
@@ -939,6 +940,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
939 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, | 940 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, |
940 | /* Infineon Devices */ | 941 | /* Infineon Devices */ |
941 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | 942 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, |
943 | /* GE Healthcare devices */ | ||
944 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, | ||
942 | { } /* Terminating entry */ | 945 | { } /* Terminating entry */ |
943 | }; | 946 | }; |
944 | 947 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 70b0b1d88ae9..5937b2d242f2 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -837,6 +837,12 @@ | |||
837 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 837 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
838 | 838 | ||
839 | /* | 839 | /* |
840 | * NOVITUS printers | ||
841 | */ | ||
842 | #define NOVITUS_VID 0x1a28 | ||
843 | #define NOVITUS_BONO_E_PID 0x6010 | ||
844 | |||
845 | /* | ||
840 | * RT Systems programming cables for various ham radios | 846 | * RT Systems programming cables for various ham radios |
841 | */ | 847 | */ |
842 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 848 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
@@ -1385,3 +1391,9 @@ | |||
1385 | * ekey biometric systems GmbH (http://ekey.net/) | 1391 | * ekey biometric systems GmbH (http://ekey.net/) |
1386 | */ | 1392 | */ |
1387 | #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ | 1393 | #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ |
1394 | |||
1395 | /* | ||
1396 | * GE Healthcare devices | ||
1397 | */ | ||
1398 | #define GE_HEALTHCARE_VID 0x1901 | ||
1399 | #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 6f7f01eb556a..46179a0828eb 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -282,14 +282,19 @@ static const struct usb_device_id id_table[] = { | |||
282 | /* Sierra Wireless HSPA Non-Composite Device */ | 282 | /* Sierra Wireless HSPA Non-Composite Device */ |
283 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 283 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
284 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 284 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
285 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 285 | /* Sierra Wireless Direct IP modems */ |
286 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), | ||
287 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
288 | }, | ||
289 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), | ||
286 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
287 | }, | 291 | }, |
288 | /* AT&T Direct IP LTE modems */ | 292 | /* AT&T Direct IP LTE modems */ |
289 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), | 293 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), |
290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 294 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
291 | }, | 295 | }, |
292 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | 296 | /* Airprime/Sierra Wireless Direct IP modems */ |
297 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68A3, 0xFF, 0xFF, 0xFF), | ||
293 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 298 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
294 | }, | 299 | }, |
295 | 300 | ||
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c index 1a132e9e947a..c9bb107d5e5c 100644 --- a/drivers/usb/serial/zte_ev.c +++ b/drivers/usb/serial/zte_ev.c | |||
@@ -272,6 +272,14 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | static const struct usb_device_id id_table[] = { | 274 | static const struct usb_device_id id_table[] = { |
275 | { USB_DEVICE(0x19d2, 0xffec) }, | ||
276 | { USB_DEVICE(0x19d2, 0xffee) }, | ||
277 | { USB_DEVICE(0x19d2, 0xfff6) }, | ||
278 | { USB_DEVICE(0x19d2, 0xfff7) }, | ||
279 | { USB_DEVICE(0x19d2, 0xfff8) }, | ||
280 | { USB_DEVICE(0x19d2, 0xfff9) }, | ||
281 | { USB_DEVICE(0x19d2, 0xfffb) }, | ||
282 | { USB_DEVICE(0x19d2, 0xfffc) }, | ||
275 | /* MG880 */ | 283 | /* MG880 */ |
276 | { USB_DEVICE(0x19d2, 0xfffd) }, | 284 | { USB_DEVICE(0x19d2, 0xfffd) }, |
277 | { }, | 285 | { }, |
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h index 503ac5c8d80f..8a6f371ed6e7 100644 --- a/drivers/usb/storage/uas-detect.h +++ b/drivers/usb/storage/uas-detect.h | |||
@@ -59,10 +59,6 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
59 | unsigned long flags = id->driver_info; | 59 | unsigned long flags = id->driver_info; |
60 | int r, alt; | 60 | int r, alt; |
61 | 61 | ||
62 | usb_stor_adjust_quirks(udev, &flags); | ||
63 | |||
64 | if (flags & US_FL_IGNORE_UAS) | ||
65 | return 0; | ||
66 | 62 | ||
67 | alt = uas_find_uas_alt_setting(intf); | 63 | alt = uas_find_uas_alt_setting(intf); |
68 | if (alt < 0) | 64 | if (alt < 0) |
@@ -72,6 +68,29 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
72 | if (r < 0) | 68 | if (r < 0) |
73 | return 0; | 69 | return 0; |
74 | 70 | ||
71 | /* | ||
72 | * ASM1051 and older ASM1053 devices have the same usb-id, and UAS is | ||
73 | * broken on the ASM1051, use the number of streams to differentiate. | ||
74 | * New ASM1053-s also support 32 streams, but have a different prod-id. | ||
75 | */ | ||
76 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && | ||
77 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa) { | ||
78 | if (udev->speed < USB_SPEED_SUPER) { | ||
79 | /* No streams info, assume ASM1051 */ | ||
80 | flags |= US_FL_IGNORE_UAS; | ||
81 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { | ||
82 | flags |= US_FL_IGNORE_UAS; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | usb_stor_adjust_quirks(udev, &flags); | ||
87 | |||
88 | if (flags & US_FL_IGNORE_UAS) { | ||
89 | dev_warn(&udev->dev, | ||
90 | "UAS is blacklisted for this device, using usb-storage instead\n"); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
75 | if (udev->bus->sg_tablesize == 0) { | 94 | if (udev->bus->sg_tablesize == 0) { |
76 | dev_warn(&udev->dev, | 95 | dev_warn(&udev->dev, |
77 | "The driver for the USB controller %s does not support scatter-gather which is\n", | 96 | "The driver for the USB controller %s does not support scatter-gather which is\n", |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 7ef99b2f3aaf..4a5c68a47e46 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -101,6 +101,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x0001, | |||
101 | "PhotoSmart R707", | 101 | "PhotoSmart R707", |
102 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), | 102 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), |
103 | 103 | ||
104 | UNUSUAL_DEV( 0x03f3, 0x0001, 0x0000, 0x9999, | ||
105 | "Adaptec", | ||
106 | "USBConnect 2000", | ||
107 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
108 | US_FL_SCM_MULT_TARG ), | ||
109 | |||
104 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> | 110 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> |
105 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) | 111 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) |
106 | * for USB floppies that need the SINGLE_LUN enforcement. | 112 | * for USB floppies that need the SINGLE_LUN enforcement. |
@@ -741,6 +747,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100, | |||
741 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 747 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
742 | US_FL_SINGLE_LUN ), | 748 | US_FL_SINGLE_LUN ), |
743 | 749 | ||
750 | UNUSUAL_DEV( 0x059b, 0x0040, 0x0100, 0x0100, | ||
751 | "Iomega", | ||
752 | "Jaz USB Adapter", | ||
753 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
754 | US_FL_SINGLE_LUN ), | ||
755 | |||
744 | /* Reported by <Hendryk.Pfeiffer@gmx.de> */ | 756 | /* Reported by <Hendryk.Pfeiffer@gmx.de> */ |
745 | UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, | 757 | UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, |
746 | "LaCie", | 758 | "LaCie", |
@@ -1119,6 +1131,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, | |||
1119 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1131 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1120 | US_FL_NOT_LOCKABLE), | 1132 | US_FL_NOT_LOCKABLE), |
1121 | 1133 | ||
1134 | UNUSUAL_DEV( 0x085a, 0x0026, 0x0100, 0x0133, | ||
1135 | "Xircom", | ||
1136 | "PortGear USB-SCSI (Mac USB Dock)", | ||
1137 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1138 | US_FL_SCM_MULT_TARG ), | ||
1139 | |||
1140 | UNUSUAL_DEV( 0x085a, 0x0028, 0x0100, 0x0133, | ||
1141 | "Xircom", | ||
1142 | "PortGear USB to SCSI Converter", | ||
1143 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1144 | US_FL_SCM_MULT_TARG ), | ||
1145 | |||
1122 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ | 1146 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ |
1123 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, | 1147 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, |
1124 | "CITIZEN", | 1148 | "CITIZEN", |
@@ -1958,6 +1982,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, | |||
1958 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1982 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1959 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | 1983 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), |
1960 | 1984 | ||
1985 | /* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) | ||
1986 | * and Mac USB Dock USB-SCSI */ | ||
1987 | UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133, | ||
1988 | "Entrega Technologies", | ||
1989 | "USB to SCSI Converter", | ||
1990 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1991 | US_FL_SCM_MULT_TARG ), | ||
1992 | |||
1961 | /* Reported by Robert Schedel <r.schedel@yahoo.de> | 1993 | /* Reported by Robert Schedel <r.schedel@yahoo.de> |
1962 | * Note: this is a 'super top' device like the above 14cd/6600 device */ | 1994 | * Note: this is a 'super top' device like the above 14cd/6600 device */ |
1963 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | 1995 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, |
@@ -1980,6 +2012,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000, | |||
1980 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2012 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1981 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), | 2013 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), |
1982 | 2014 | ||
2015 | UNUSUAL_DEV( 0x1822, 0x0001, 0x0000, 0x9999, | ||
2016 | "Ariston Technologies", | ||
2017 | "iConnect USB to SCSI adapter", | ||
2018 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
2019 | US_FL_SCM_MULT_TARG ), | ||
2020 | |||
1983 | /* Reported by Hans de Goede <hdegoede@redhat.com> | 2021 | /* Reported by Hans de Goede <hdegoede@redhat.com> |
1984 | * These Appotech controllers are found in Picture Frames, they provide a | 2022 | * These Appotech controllers are found in Picture Frames, they provide a |
1985 | * (buggy) emulation of a cdrom drive which contains the windows software | 2023 | * (buggy) emulation of a cdrom drive which contains the windows software |
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c index 80079b8fed15..d0303f0dbe15 100644 --- a/drivers/uwb/lc-dev.c +++ b/drivers/uwb/lc-dev.c | |||
@@ -431,16 +431,19 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) | |||
431 | uwb_dev->mac_addr = *bce->mac_addr; | 431 | uwb_dev->mac_addr = *bce->mac_addr; |
432 | uwb_dev->dev_addr = bce->dev_addr; | 432 | uwb_dev->dev_addr = bce->dev_addr; |
433 | dev_set_name(&uwb_dev->dev, "%s", macbuf); | 433 | dev_set_name(&uwb_dev->dev, "%s", macbuf); |
434 | |||
435 | /* plug the beacon cache */ | ||
436 | bce->uwb_dev = uwb_dev; | ||
437 | uwb_dev->bce = bce; | ||
438 | uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ | ||
439 | |||
434 | result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); | 440 | result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); |
435 | if (result < 0) { | 441 | if (result < 0) { |
436 | dev_err(dev, "new device %s: cannot instantiate device\n", | 442 | dev_err(dev, "new device %s: cannot instantiate device\n", |
437 | macbuf); | 443 | macbuf); |
438 | goto error_dev_add; | 444 | goto error_dev_add; |
439 | } | 445 | } |
440 | /* plug the beacon cache */ | 446 | |
441 | bce->uwb_dev = uwb_dev; | ||
442 | uwb_dev->bce = bce; | ||
443 | uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ | ||
444 | dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", | 447 | dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", |
445 | macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, | 448 | macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, |
446 | dev_name(rc->uwb_dev.dev.parent)); | 449 | dev_name(rc->uwb_dev.dev.parent)); |
@@ -448,6 +451,8 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) | |||
448 | return; | 451 | return; |
449 | 452 | ||
450 | error_dev_add: | 453 | error_dev_add: |
454 | bce->uwb_dev = NULL; | ||
455 | uwb_bce_put(bce); | ||
451 | kfree(uwb_dev); | 456 | kfree(uwb_dev); |
452 | return; | 457 | return; |
453 | } | 458 | } |
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index a7b6217ac87b..6ad23bd3523a 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c | |||
@@ -639,9 +639,7 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) | |||
639 | if (g0 != panels[i].g0) | 639 | if (g0 != panels[i].g0) |
640 | continue; | 640 | continue; |
641 | if (r0 == panels[i].r0 && b0 == panels[i].b0) | 641 | if (r0 == panels[i].r0 && b0 == panels[i].b0) |
642 | fb->panel->caps = panels[i].caps & CLCD_CAP_RGB; | 642 | fb->panel->caps = panels[i].caps; |
643 | if (r0 == panels[i].b0 && b0 == panels[i].r0) | ||
644 | fb->panel->caps = panels[i].caps & CLCD_CAP_BGR; | ||
645 | } | 643 | } |
646 | 644 | ||
647 | return fb->panel->caps ? 0 : -EINVAL; | 645 | return fb->panel->caps ? 0 : -EINVAL; |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 5c660c77f03b..1e0a317d3dcd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -230,8 +230,8 @@ static enum bp_state reserve_additional_memory(long credit) | |||
230 | rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); | 230 | rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); |
231 | 231 | ||
232 | if (rc) { | 232 | if (rc) { |
233 | pr_info("%s: add_memory() failed: %i\n", __func__, rc); | 233 | pr_warn("Cannot add additional memory (%i)\n", rc); |
234 | return BP_EAGAIN; | 234 | return BP_ECANCELED; |
235 | } | 235 | } |
236 | 236 | ||
237 | balloon_hotplug -= credit; | 237 | balloon_hotplug -= credit; |
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 787d17945418..e53fe191738c 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c | |||
@@ -124,7 +124,7 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
124 | int i, rc, readonly; | 124 | int i, rc, readonly; |
125 | LIST_HEAD(queue_gref); | 125 | LIST_HEAD(queue_gref); |
126 | LIST_HEAD(queue_file); | 126 | LIST_HEAD(queue_file); |
127 | struct gntalloc_gref *gref; | 127 | struct gntalloc_gref *gref, *next; |
128 | 128 | ||
129 | readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); | 129 | readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); |
130 | rc = -ENOMEM; | 130 | rc = -ENOMEM; |
@@ -141,13 +141,11 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
141 | goto undo; | 141 | goto undo; |
142 | 142 | ||
143 | /* Grant foreign access to the page. */ | 143 | /* Grant foreign access to the page. */ |
144 | gref->gref_id = gnttab_grant_foreign_access(op->domid, | 144 | rc = gnttab_grant_foreign_access(op->domid, |
145 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); | 145 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); |
146 | if ((int)gref->gref_id < 0) { | 146 | if (rc < 0) |
147 | rc = gref->gref_id; | ||
148 | goto undo; | 147 | goto undo; |
149 | } | 148 | gref_ids[i] = gref->gref_id = rc; |
150 | gref_ids[i] = gref->gref_id; | ||
151 | } | 149 | } |
152 | 150 | ||
153 | /* Add to gref lists. */ | 151 | /* Add to gref lists. */ |
@@ -162,8 +160,8 @@ undo: | |||
162 | mutex_lock(&gref_mutex); | 160 | mutex_lock(&gref_mutex); |
163 | gref_size -= (op->count - i); | 161 | gref_size -= (op->count - i); |
164 | 162 | ||
165 | list_for_each_entry(gref, &queue_file, next_file) { | 163 | list_for_each_entry_safe(gref, next, &queue_file, next_file) { |
166 | /* __del_gref does not remove from queue_file */ | 164 | list_del(&gref->next_file); |
167 | __del_gref(gref); | 165 | __del_gref(gref); |
168 | } | 166 | } |
169 | 167 | ||
@@ -193,7 +191,7 @@ static void __del_gref(struct gntalloc_gref *gref) | |||
193 | 191 | ||
194 | gref->notify.flags = 0; | 192 | gref->notify.flags = 0; |
195 | 193 | ||
196 | if (gref->gref_id > 0) { | 194 | if (gref->gref_id) { |
197 | if (gnttab_query_foreign_access(gref->gref_id)) | 195 | if (gnttab_query_foreign_access(gref->gref_id)) |
198 | return; | 196 | return; |
199 | 197 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 5f1e1f3cd186..f8bb36f9d9ce 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -103,16 +103,11 @@ static void do_suspend(void) | |||
103 | 103 | ||
104 | shutting_down = SHUTDOWN_SUSPEND; | 104 | shutting_down = SHUTDOWN_SUSPEND; |
105 | 105 | ||
106 | #ifdef CONFIG_PREEMPT | ||
107 | /* If the kernel is preemptible, we need to freeze all the processes | ||
108 | to prevent them from being in the middle of a pagetable update | ||
109 | during suspend. */ | ||
110 | err = freeze_processes(); | 106 | err = freeze_processes(); |
111 | if (err) { | 107 | if (err) { |
112 | pr_err("%s: freeze failed %d\n", __func__, err); | 108 | pr_err("%s: freeze failed %d\n", __func__, err); |
113 | goto out; | 109 | goto out; |
114 | } | 110 | } |
115 | #endif | ||
116 | 111 | ||
117 | err = dpm_suspend_start(PMSG_FREEZE); | 112 | err = dpm_suspend_start(PMSG_FREEZE); |
118 | if (err) { | 113 | if (err) { |
@@ -157,10 +152,8 @@ out_resume: | |||
157 | dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); | 152 | dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); |
158 | 153 | ||
159 | out_thaw: | 154 | out_thaw: |
160 | #ifdef CONFIG_PREEMPT | ||
161 | thaw_processes(); | 155 | thaw_processes(); |
162 | out: | 156 | out: |
163 | #endif | ||
164 | shutting_down = SHUTDOWN_INVALID; | 157 | shutting_down = SHUTDOWN_INVALID; |
165 | } | 158 | } |
166 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ | 159 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index 43527fd78825..56b8522d5767 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
@@ -234,8 +234,17 @@ static inline int btrfs_inode_in_log(struct inode *inode, u64 generation) | |||
234 | BTRFS_I(inode)->last_sub_trans <= | 234 | BTRFS_I(inode)->last_sub_trans <= |
235 | BTRFS_I(inode)->last_log_commit && | 235 | BTRFS_I(inode)->last_log_commit && |
236 | BTRFS_I(inode)->last_sub_trans <= | 236 | BTRFS_I(inode)->last_sub_trans <= |
237 | BTRFS_I(inode)->root->last_log_commit) | 237 | BTRFS_I(inode)->root->last_log_commit) { |
238 | return 1; | 238 | /* |
239 | * After a ranged fsync we might have left some extent maps | ||
240 | * (that fall outside the fsync's range). So return false | ||
241 | * here if the list isn't empty, to make sure btrfs_log_inode() | ||
242 | * will be called and process those extent maps. | ||
243 | */ | ||
244 | smp_mb(); | ||
245 | if (list_empty(&BTRFS_I(inode)->extent_tree.modified_extents)) | ||
246 | return 1; | ||
247 | } | ||
239 | return 0; | 248 | return 0; |
240 | } | 249 | } |
241 | 250 | ||
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 36861b7a6757..ff1cc0399b9a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1966,7 +1966,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
1966 | 1966 | ||
1967 | btrfs_init_log_ctx(&ctx); | 1967 | btrfs_init_log_ctx(&ctx); |
1968 | 1968 | ||
1969 | ret = btrfs_log_dentry_safe(trans, root, dentry, &ctx); | 1969 | ret = btrfs_log_dentry_safe(trans, root, dentry, start, end, &ctx); |
1970 | if (ret < 0) { | 1970 | if (ret < 0) { |
1971 | /* Fallthrough and commit/free transaction. */ | 1971 | /* Fallthrough and commit/free transaction. */ |
1972 | ret = 1; | 1972 | ret = 1; |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 9c194bd74d6e..016c403bfe7e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -778,8 +778,12 @@ retry: | |||
778 | ins.offset, | 778 | ins.offset, |
779 | BTRFS_ORDERED_COMPRESSED, | 779 | BTRFS_ORDERED_COMPRESSED, |
780 | async_extent->compress_type); | 780 | async_extent->compress_type); |
781 | if (ret) | 781 | if (ret) { |
782 | btrfs_drop_extent_cache(inode, async_extent->start, | ||
783 | async_extent->start + | ||
784 | async_extent->ram_size - 1, 0); | ||
782 | goto out_free_reserve; | 785 | goto out_free_reserve; |
786 | } | ||
783 | 787 | ||
784 | /* | 788 | /* |
785 | * clear dirty, set writeback and unlock the pages. | 789 | * clear dirty, set writeback and unlock the pages. |
@@ -971,14 +975,14 @@ static noinline int cow_file_range(struct inode *inode, | |||
971 | ret = btrfs_add_ordered_extent(inode, start, ins.objectid, | 975 | ret = btrfs_add_ordered_extent(inode, start, ins.objectid, |
972 | ram_size, cur_alloc_size, 0); | 976 | ram_size, cur_alloc_size, 0); |
973 | if (ret) | 977 | if (ret) |
974 | goto out_reserve; | 978 | goto out_drop_extent_cache; |
975 | 979 | ||
976 | if (root->root_key.objectid == | 980 | if (root->root_key.objectid == |
977 | BTRFS_DATA_RELOC_TREE_OBJECTID) { | 981 | BTRFS_DATA_RELOC_TREE_OBJECTID) { |
978 | ret = btrfs_reloc_clone_csums(inode, start, | 982 | ret = btrfs_reloc_clone_csums(inode, start, |
979 | cur_alloc_size); | 983 | cur_alloc_size); |
980 | if (ret) | 984 | if (ret) |
981 | goto out_reserve; | 985 | goto out_drop_extent_cache; |
982 | } | 986 | } |
983 | 987 | ||
984 | if (disk_num_bytes < cur_alloc_size) | 988 | if (disk_num_bytes < cur_alloc_size) |
@@ -1006,6 +1010,8 @@ static noinline int cow_file_range(struct inode *inode, | |||
1006 | out: | 1010 | out: |
1007 | return ret; | 1011 | return ret; |
1008 | 1012 | ||
1013 | out_drop_extent_cache: | ||
1014 | btrfs_drop_extent_cache(inode, start, start + ram_size - 1, 0); | ||
1009 | out_reserve: | 1015 | out_reserve: |
1010 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); | 1016 | btrfs_free_reserved_extent(root, ins.objectid, ins.offset, 1); |
1011 | out_unlock: | 1017 | out_unlock: |
@@ -4242,7 +4248,8 @@ out: | |||
4242 | btrfs_abort_transaction(trans, root, ret); | 4248 | btrfs_abort_transaction(trans, root, ret); |
4243 | } | 4249 | } |
4244 | error: | 4250 | error: |
4245 | if (last_size != (u64)-1) | 4251 | if (last_size != (u64)-1 && |
4252 | root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID) | ||
4246 | btrfs_ordered_update_i_size(inode, last_size, NULL); | 4253 | btrfs_ordered_update_i_size(inode, last_size, NULL); |
4247 | btrfs_free_path(path); | 4254 | btrfs_free_path(path); |
4248 | return err; | 4255 | return err; |
@@ -5627,6 +5634,17 @@ int btrfs_set_inode_index(struct inode *dir, u64 *index) | |||
5627 | return ret; | 5634 | return ret; |
5628 | } | 5635 | } |
5629 | 5636 | ||
5637 | static int btrfs_insert_inode_locked(struct inode *inode) | ||
5638 | { | ||
5639 | struct btrfs_iget_args args; | ||
5640 | args.location = &BTRFS_I(inode)->location; | ||
5641 | args.root = BTRFS_I(inode)->root; | ||
5642 | |||
5643 | return insert_inode_locked4(inode, | ||
5644 | btrfs_inode_hash(inode->i_ino, BTRFS_I(inode)->root), | ||
5645 | btrfs_find_actor, &args); | ||
5646 | } | ||
5647 | |||
5630 | static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | 5648 | static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, |
5631 | struct btrfs_root *root, | 5649 | struct btrfs_root *root, |
5632 | struct inode *dir, | 5650 | struct inode *dir, |
@@ -5719,10 +5737,19 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5719 | sizes[1] = name_len + sizeof(*ref); | 5737 | sizes[1] = name_len + sizeof(*ref); |
5720 | } | 5738 | } |
5721 | 5739 | ||
5740 | location = &BTRFS_I(inode)->location; | ||
5741 | location->objectid = objectid; | ||
5742 | location->offset = 0; | ||
5743 | btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY); | ||
5744 | |||
5745 | ret = btrfs_insert_inode_locked(inode); | ||
5746 | if (ret < 0) | ||
5747 | goto fail; | ||
5748 | |||
5722 | path->leave_spinning = 1; | 5749 | path->leave_spinning = 1; |
5723 | ret = btrfs_insert_empty_items(trans, root, path, key, sizes, nitems); | 5750 | ret = btrfs_insert_empty_items(trans, root, path, key, sizes, nitems); |
5724 | if (ret != 0) | 5751 | if (ret != 0) |
5725 | goto fail; | 5752 | goto fail_unlock; |
5726 | 5753 | ||
5727 | inode_init_owner(inode, dir, mode); | 5754 | inode_init_owner(inode, dir, mode); |
5728 | inode_set_bytes(inode, 0); | 5755 | inode_set_bytes(inode, 0); |
@@ -5745,11 +5772,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5745 | btrfs_mark_buffer_dirty(path->nodes[0]); | 5772 | btrfs_mark_buffer_dirty(path->nodes[0]); |
5746 | btrfs_free_path(path); | 5773 | btrfs_free_path(path); |
5747 | 5774 | ||
5748 | location = &BTRFS_I(inode)->location; | ||
5749 | location->objectid = objectid; | ||
5750 | location->offset = 0; | ||
5751 | btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY); | ||
5752 | |||
5753 | btrfs_inherit_iflags(inode, dir); | 5775 | btrfs_inherit_iflags(inode, dir); |
5754 | 5776 | ||
5755 | if (S_ISREG(mode)) { | 5777 | if (S_ISREG(mode)) { |
@@ -5760,7 +5782,6 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5760 | BTRFS_INODE_NODATASUM; | 5782 | BTRFS_INODE_NODATASUM; |
5761 | } | 5783 | } |
5762 | 5784 | ||
5763 | btrfs_insert_inode_hash(inode); | ||
5764 | inode_tree_add(inode); | 5785 | inode_tree_add(inode); |
5765 | 5786 | ||
5766 | trace_btrfs_inode_new(inode); | 5787 | trace_btrfs_inode_new(inode); |
@@ -5775,6 +5796,9 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
5775 | btrfs_ino(inode), root->root_key.objectid, ret); | 5796 | btrfs_ino(inode), root->root_key.objectid, ret); |
5776 | 5797 | ||
5777 | return inode; | 5798 | return inode; |
5799 | |||
5800 | fail_unlock: | ||
5801 | unlock_new_inode(inode); | ||
5778 | fail: | 5802 | fail: |
5779 | if (dir && name) | 5803 | if (dir && name) |
5780 | BTRFS_I(dir)->index_cnt--; | 5804 | BTRFS_I(dir)->index_cnt--; |
@@ -5909,28 +5933,28 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
5909 | goto out_unlock; | 5933 | goto out_unlock; |
5910 | } | 5934 | } |
5911 | 5935 | ||
5912 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
5913 | if (err) { | ||
5914 | drop_inode = 1; | ||
5915 | goto out_unlock; | ||
5916 | } | ||
5917 | |||
5918 | /* | 5936 | /* |
5919 | * If the active LSM wants to access the inode during | 5937 | * If the active LSM wants to access the inode during |
5920 | * d_instantiate it needs these. Smack checks to see | 5938 | * d_instantiate it needs these. Smack checks to see |
5921 | * if the filesystem supports xattrs by looking at the | 5939 | * if the filesystem supports xattrs by looking at the |
5922 | * ops vector. | 5940 | * ops vector. |
5923 | */ | 5941 | */ |
5924 | |||
5925 | inode->i_op = &btrfs_special_inode_operations; | 5942 | inode->i_op = &btrfs_special_inode_operations; |
5926 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 5943 | init_special_inode(inode, inode->i_mode, rdev); |
5944 | |||
5945 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
5927 | if (err) | 5946 | if (err) |
5928 | drop_inode = 1; | 5947 | goto out_unlock_inode; |
5929 | else { | 5948 | |
5930 | init_special_inode(inode, inode->i_mode, rdev); | 5949 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
5950 | if (err) { | ||
5951 | goto out_unlock_inode; | ||
5952 | } else { | ||
5931 | btrfs_update_inode(trans, root, inode); | 5953 | btrfs_update_inode(trans, root, inode); |
5954 | unlock_new_inode(inode); | ||
5932 | d_instantiate(dentry, inode); | 5955 | d_instantiate(dentry, inode); |
5933 | } | 5956 | } |
5957 | |||
5934 | out_unlock: | 5958 | out_unlock: |
5935 | btrfs_end_transaction(trans, root); | 5959 | btrfs_end_transaction(trans, root); |
5936 | btrfs_balance_delayed_items(root); | 5960 | btrfs_balance_delayed_items(root); |
@@ -5940,6 +5964,12 @@ out_unlock: | |||
5940 | iput(inode); | 5964 | iput(inode); |
5941 | } | 5965 | } |
5942 | return err; | 5966 | return err; |
5967 | |||
5968 | out_unlock_inode: | ||
5969 | drop_inode = 1; | ||
5970 | unlock_new_inode(inode); | ||
5971 | goto out_unlock; | ||
5972 | |||
5943 | } | 5973 | } |
5944 | 5974 | ||
5945 | static int btrfs_create(struct inode *dir, struct dentry *dentry, | 5975 | static int btrfs_create(struct inode *dir, struct dentry *dentry, |
@@ -5974,15 +6004,6 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
5974 | goto out_unlock; | 6004 | goto out_unlock; |
5975 | } | 6005 | } |
5976 | drop_inode_on_err = 1; | 6006 | drop_inode_on_err = 1; |
5977 | |||
5978 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
5979 | if (err) | ||
5980 | goto out_unlock; | ||
5981 | |||
5982 | err = btrfs_update_inode(trans, root, inode); | ||
5983 | if (err) | ||
5984 | goto out_unlock; | ||
5985 | |||
5986 | /* | 6007 | /* |
5987 | * If the active LSM wants to access the inode during | 6008 | * If the active LSM wants to access the inode during |
5988 | * d_instantiate it needs these. Smack checks to see | 6009 | * d_instantiate it needs these. Smack checks to see |
@@ -5991,14 +6012,23 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
5991 | */ | 6012 | */ |
5992 | inode->i_fop = &btrfs_file_operations; | 6013 | inode->i_fop = &btrfs_file_operations; |
5993 | inode->i_op = &btrfs_file_inode_operations; | 6014 | inode->i_op = &btrfs_file_inode_operations; |
6015 | inode->i_mapping->a_ops = &btrfs_aops; | ||
6016 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
6017 | |||
6018 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
6019 | if (err) | ||
6020 | goto out_unlock_inode; | ||
6021 | |||
6022 | err = btrfs_update_inode(trans, root, inode); | ||
6023 | if (err) | ||
6024 | goto out_unlock_inode; | ||
5994 | 6025 | ||
5995 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 6026 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
5996 | if (err) | 6027 | if (err) |
5997 | goto out_unlock; | 6028 | goto out_unlock_inode; |
5998 | 6029 | ||
5999 | inode->i_mapping->a_ops = &btrfs_aops; | ||
6000 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
6001 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 6030 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
6031 | unlock_new_inode(inode); | ||
6002 | d_instantiate(dentry, inode); | 6032 | d_instantiate(dentry, inode); |
6003 | 6033 | ||
6004 | out_unlock: | 6034 | out_unlock: |
@@ -6010,6 +6040,11 @@ out_unlock: | |||
6010 | btrfs_balance_delayed_items(root); | 6040 | btrfs_balance_delayed_items(root); |
6011 | btrfs_btree_balance_dirty(root); | 6041 | btrfs_btree_balance_dirty(root); |
6012 | return err; | 6042 | return err; |
6043 | |||
6044 | out_unlock_inode: | ||
6045 | unlock_new_inode(inode); | ||
6046 | goto out_unlock; | ||
6047 | |||
6013 | } | 6048 | } |
6014 | 6049 | ||
6015 | static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | 6050 | static int btrfs_link(struct dentry *old_dentry, struct inode *dir, |
@@ -6117,25 +6152,30 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
6117 | } | 6152 | } |
6118 | 6153 | ||
6119 | drop_on_err = 1; | 6154 | drop_on_err = 1; |
6155 | /* these must be set before we unlock the inode */ | ||
6156 | inode->i_op = &btrfs_dir_inode_operations; | ||
6157 | inode->i_fop = &btrfs_dir_file_operations; | ||
6120 | 6158 | ||
6121 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | 6159 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); |
6122 | if (err) | 6160 | if (err) |
6123 | goto out_fail; | 6161 | goto out_fail_inode; |
6124 | |||
6125 | inode->i_op = &btrfs_dir_inode_operations; | ||
6126 | inode->i_fop = &btrfs_dir_file_operations; | ||
6127 | 6162 | ||
6128 | btrfs_i_size_write(inode, 0); | 6163 | btrfs_i_size_write(inode, 0); |
6129 | err = btrfs_update_inode(trans, root, inode); | 6164 | err = btrfs_update_inode(trans, root, inode); |
6130 | if (err) | 6165 | if (err) |
6131 | goto out_fail; | 6166 | goto out_fail_inode; |
6132 | 6167 | ||
6133 | err = btrfs_add_link(trans, dir, inode, dentry->d_name.name, | 6168 | err = btrfs_add_link(trans, dir, inode, dentry->d_name.name, |
6134 | dentry->d_name.len, 0, index); | 6169 | dentry->d_name.len, 0, index); |
6135 | if (err) | 6170 | if (err) |
6136 | goto out_fail; | 6171 | goto out_fail_inode; |
6137 | 6172 | ||
6138 | d_instantiate(dentry, inode); | 6173 | d_instantiate(dentry, inode); |
6174 | /* | ||
6175 | * mkdir is special. We're unlocking after we call d_instantiate | ||
6176 | * to avoid a race with nfsd calling d_instantiate. | ||
6177 | */ | ||
6178 | unlock_new_inode(inode); | ||
6139 | drop_on_err = 0; | 6179 | drop_on_err = 0; |
6140 | 6180 | ||
6141 | out_fail: | 6181 | out_fail: |
@@ -6145,6 +6185,10 @@ out_fail: | |||
6145 | btrfs_balance_delayed_items(root); | 6185 | btrfs_balance_delayed_items(root); |
6146 | btrfs_btree_balance_dirty(root); | 6186 | btrfs_btree_balance_dirty(root); |
6147 | return err; | 6187 | return err; |
6188 | |||
6189 | out_fail_inode: | ||
6190 | unlock_new_inode(inode); | ||
6191 | goto out_fail; | ||
6148 | } | 6192 | } |
6149 | 6193 | ||
6150 | /* helper for btfs_get_extent. Given an existing extent in the tree, | 6194 | /* helper for btfs_get_extent. Given an existing extent in the tree, |
@@ -8100,6 +8144,7 @@ int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, | |||
8100 | 8144 | ||
8101 | set_nlink(inode, 1); | 8145 | set_nlink(inode, 1); |
8102 | btrfs_i_size_write(inode, 0); | 8146 | btrfs_i_size_write(inode, 0); |
8147 | unlock_new_inode(inode); | ||
8103 | 8148 | ||
8104 | err = btrfs_subvol_inherit_props(trans, new_root, parent_root); | 8149 | err = btrfs_subvol_inherit_props(trans, new_root, parent_root); |
8105 | if (err) | 8150 | if (err) |
@@ -8760,12 +8805,6 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8760 | goto out_unlock; | 8805 | goto out_unlock; |
8761 | } | 8806 | } |
8762 | 8807 | ||
8763 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
8764 | if (err) { | ||
8765 | drop_inode = 1; | ||
8766 | goto out_unlock; | ||
8767 | } | ||
8768 | |||
8769 | /* | 8808 | /* |
8770 | * If the active LSM wants to access the inode during | 8809 | * If the active LSM wants to access the inode during |
8771 | * d_instantiate it needs these. Smack checks to see | 8810 | * d_instantiate it needs these. Smack checks to see |
@@ -8774,23 +8813,22 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8774 | */ | 8813 | */ |
8775 | inode->i_fop = &btrfs_file_operations; | 8814 | inode->i_fop = &btrfs_file_operations; |
8776 | inode->i_op = &btrfs_file_inode_operations; | 8815 | inode->i_op = &btrfs_file_inode_operations; |
8816 | inode->i_mapping->a_ops = &btrfs_aops; | ||
8817 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
8818 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | ||
8819 | |||
8820 | err = btrfs_init_inode_security(trans, inode, dir, &dentry->d_name); | ||
8821 | if (err) | ||
8822 | goto out_unlock_inode; | ||
8777 | 8823 | ||
8778 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); | 8824 | err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); |
8779 | if (err) | 8825 | if (err) |
8780 | drop_inode = 1; | 8826 | goto out_unlock_inode; |
8781 | else { | ||
8782 | inode->i_mapping->a_ops = &btrfs_aops; | ||
8783 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | ||
8784 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | ||
8785 | } | ||
8786 | if (drop_inode) | ||
8787 | goto out_unlock; | ||
8788 | 8827 | ||
8789 | path = btrfs_alloc_path(); | 8828 | path = btrfs_alloc_path(); |
8790 | if (!path) { | 8829 | if (!path) { |
8791 | err = -ENOMEM; | 8830 | err = -ENOMEM; |
8792 | drop_inode = 1; | 8831 | goto out_unlock_inode; |
8793 | goto out_unlock; | ||
8794 | } | 8832 | } |
8795 | key.objectid = btrfs_ino(inode); | 8833 | key.objectid = btrfs_ino(inode); |
8796 | key.offset = 0; | 8834 | key.offset = 0; |
@@ -8799,9 +8837,8 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8799 | err = btrfs_insert_empty_item(trans, root, path, &key, | 8837 | err = btrfs_insert_empty_item(trans, root, path, &key, |
8800 | datasize); | 8838 | datasize); |
8801 | if (err) { | 8839 | if (err) { |
8802 | drop_inode = 1; | ||
8803 | btrfs_free_path(path); | 8840 | btrfs_free_path(path); |
8804 | goto out_unlock; | 8841 | goto out_unlock_inode; |
8805 | } | 8842 | } |
8806 | leaf = path->nodes[0]; | 8843 | leaf = path->nodes[0]; |
8807 | ei = btrfs_item_ptr(leaf, path->slots[0], | 8844 | ei = btrfs_item_ptr(leaf, path->slots[0], |
@@ -8825,12 +8862,15 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, | |||
8825 | inode_set_bytes(inode, name_len); | 8862 | inode_set_bytes(inode, name_len); |
8826 | btrfs_i_size_write(inode, name_len); | 8863 | btrfs_i_size_write(inode, name_len); |
8827 | err = btrfs_update_inode(trans, root, inode); | 8864 | err = btrfs_update_inode(trans, root, inode); |
8828 | if (err) | 8865 | if (err) { |
8829 | drop_inode = 1; | 8866 | drop_inode = 1; |
8867 | goto out_unlock_inode; | ||
8868 | } | ||
8869 | |||
8870 | unlock_new_inode(inode); | ||
8871 | d_instantiate(dentry, inode); | ||
8830 | 8872 | ||
8831 | out_unlock: | 8873 | out_unlock: |
8832 | if (!err) | ||
8833 | d_instantiate(dentry, inode); | ||
8834 | btrfs_end_transaction(trans, root); | 8874 | btrfs_end_transaction(trans, root); |
8835 | if (drop_inode) { | 8875 | if (drop_inode) { |
8836 | inode_dec_link_count(inode); | 8876 | inode_dec_link_count(inode); |
@@ -8838,6 +8878,11 @@ out_unlock: | |||
8838 | } | 8878 | } |
8839 | btrfs_btree_balance_dirty(root); | 8879 | btrfs_btree_balance_dirty(root); |
8840 | return err; | 8880 | return err; |
8881 | |||
8882 | out_unlock_inode: | ||
8883 | drop_inode = 1; | ||
8884 | unlock_new_inode(inode); | ||
8885 | goto out_unlock; | ||
8841 | } | 8886 | } |
8842 | 8887 | ||
8843 | static int __btrfs_prealloc_file_range(struct inode *inode, int mode, | 8888 | static int __btrfs_prealloc_file_range(struct inode *inode, int mode, |
@@ -9021,14 +9066,6 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
9021 | goto out; | 9066 | goto out; |
9022 | } | 9067 | } |
9023 | 9068 | ||
9024 | ret = btrfs_init_inode_security(trans, inode, dir, NULL); | ||
9025 | if (ret) | ||
9026 | goto out; | ||
9027 | |||
9028 | ret = btrfs_update_inode(trans, root, inode); | ||
9029 | if (ret) | ||
9030 | goto out; | ||
9031 | |||
9032 | inode->i_fop = &btrfs_file_operations; | 9069 | inode->i_fop = &btrfs_file_operations; |
9033 | inode->i_op = &btrfs_file_inode_operations; | 9070 | inode->i_op = &btrfs_file_inode_operations; |
9034 | 9071 | ||
@@ -9036,9 +9073,16 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
9036 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; | 9073 | inode->i_mapping->backing_dev_info = &root->fs_info->bdi; |
9037 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | 9074 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; |
9038 | 9075 | ||
9076 | ret = btrfs_init_inode_security(trans, inode, dir, NULL); | ||
9077 | if (ret) | ||
9078 | goto out_inode; | ||
9079 | |||
9080 | ret = btrfs_update_inode(trans, root, inode); | ||
9081 | if (ret) | ||
9082 | goto out_inode; | ||
9039 | ret = btrfs_orphan_add(trans, inode); | 9083 | ret = btrfs_orphan_add(trans, inode); |
9040 | if (ret) | 9084 | if (ret) |
9041 | goto out; | 9085 | goto out_inode; |
9042 | 9086 | ||
9043 | /* | 9087 | /* |
9044 | * We set number of links to 0 in btrfs_new_inode(), and here we set | 9088 | * We set number of links to 0 in btrfs_new_inode(), and here we set |
@@ -9048,6 +9092,7 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
9048 | * d_tmpfile() -> inode_dec_link_count() -> drop_nlink() | 9092 | * d_tmpfile() -> inode_dec_link_count() -> drop_nlink() |
9049 | */ | 9093 | */ |
9050 | set_nlink(inode, 1); | 9094 | set_nlink(inode, 1); |
9095 | unlock_new_inode(inode); | ||
9051 | d_tmpfile(dentry, inode); | 9096 | d_tmpfile(dentry, inode); |
9052 | mark_inode_dirty(inode); | 9097 | mark_inode_dirty(inode); |
9053 | 9098 | ||
@@ -9057,8 +9102,12 @@ out: | |||
9057 | iput(inode); | 9102 | iput(inode); |
9058 | btrfs_balance_delayed_items(root); | 9103 | btrfs_balance_delayed_items(root); |
9059 | btrfs_btree_balance_dirty(root); | 9104 | btrfs_btree_balance_dirty(root); |
9060 | |||
9061 | return ret; | 9105 | return ret; |
9106 | |||
9107 | out_inode: | ||
9108 | unlock_new_inode(inode); | ||
9109 | goto out; | ||
9110 | |||
9062 | } | 9111 | } |
9063 | 9112 | ||
9064 | static const struct inode_operations btrfs_dir_inode_operations = { | 9113 | static const struct inode_operations btrfs_dir_inode_operations = { |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fce6fd0e3f50..8a8e29878c34 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1019,8 +1019,10 @@ static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em) | |||
1019 | return false; | 1019 | return false; |
1020 | 1020 | ||
1021 | next = defrag_lookup_extent(inode, em->start + em->len); | 1021 | next = defrag_lookup_extent(inode, em->start + em->len); |
1022 | if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE || | 1022 | if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE) |
1023 | (em->block_start + em->block_len == next->block_start)) | 1023 | ret = false; |
1024 | else if ((em->block_start + em->block_len == next->block_start) && | ||
1025 | (em->block_len > 128 * 1024 && next->block_len > 128 * 1024)) | ||
1024 | ret = false; | 1026 | ret = false; |
1025 | 1027 | ||
1026 | free_extent_map(next); | 1028 | free_extent_map(next); |
@@ -1055,7 +1057,6 @@ static int should_defrag_range(struct inode *inode, u64 start, int thresh, | |||
1055 | } | 1057 | } |
1056 | 1058 | ||
1057 | next_mergeable = defrag_check_next_extent(inode, em); | 1059 | next_mergeable = defrag_check_next_extent(inode, em); |
1058 | |||
1059 | /* | 1060 | /* |
1060 | * we hit a real extent, if it is big or the next extent is not a | 1061 | * we hit a real extent, if it is big or the next extent is not a |
1061 | * real extent, don't bother defragging it | 1062 | * real extent, don't bother defragging it |
@@ -1702,7 +1703,7 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file, | |||
1702 | ~(BTRFS_SUBVOL_CREATE_ASYNC | BTRFS_SUBVOL_RDONLY | | 1703 | ~(BTRFS_SUBVOL_CREATE_ASYNC | BTRFS_SUBVOL_RDONLY | |
1703 | BTRFS_SUBVOL_QGROUP_INHERIT)) { | 1704 | BTRFS_SUBVOL_QGROUP_INHERIT)) { |
1704 | ret = -EOPNOTSUPP; | 1705 | ret = -EOPNOTSUPP; |
1705 | goto out; | 1706 | goto free_args; |
1706 | } | 1707 | } |
1707 | 1708 | ||
1708 | if (vol_args->flags & BTRFS_SUBVOL_CREATE_ASYNC) | 1709 | if (vol_args->flags & BTRFS_SUBVOL_CREATE_ASYNC) |
@@ -1712,27 +1713,31 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file, | |||
1712 | if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) { | 1713 | if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) { |
1713 | if (vol_args->size > PAGE_CACHE_SIZE) { | 1714 | if (vol_args->size > PAGE_CACHE_SIZE) { |
1714 | ret = -EINVAL; | 1715 | ret = -EINVAL; |
1715 | goto out; | 1716 | goto free_args; |
1716 | } | 1717 | } |
1717 | inherit = memdup_user(vol_args->qgroup_inherit, vol_args->size); | 1718 | inherit = memdup_user(vol_args->qgroup_inherit, vol_args->size); |
1718 | if (IS_ERR(inherit)) { | 1719 | if (IS_ERR(inherit)) { |
1719 | ret = PTR_ERR(inherit); | 1720 | ret = PTR_ERR(inherit); |
1720 | goto out; | 1721 | goto free_args; |
1721 | } | 1722 | } |
1722 | } | 1723 | } |
1723 | 1724 | ||
1724 | ret = btrfs_ioctl_snap_create_transid(file, vol_args->name, | 1725 | ret = btrfs_ioctl_snap_create_transid(file, vol_args->name, |
1725 | vol_args->fd, subvol, ptr, | 1726 | vol_args->fd, subvol, ptr, |
1726 | readonly, inherit); | 1727 | readonly, inherit); |
1728 | if (ret) | ||
1729 | goto free_inherit; | ||
1727 | 1730 | ||
1728 | if (ret == 0 && ptr && | 1731 | if (ptr && copy_to_user(arg + |
1729 | copy_to_user(arg + | 1732 | offsetof(struct btrfs_ioctl_vol_args_v2, |
1730 | offsetof(struct btrfs_ioctl_vol_args_v2, | 1733 | transid), |
1731 | transid), ptr, sizeof(*ptr))) | 1734 | ptr, sizeof(*ptr))) |
1732 | ret = -EFAULT; | 1735 | ret = -EFAULT; |
1733 | out: | 1736 | |
1734 | kfree(vol_args); | 1737 | free_inherit: |
1735 | kfree(inherit); | 1738 | kfree(inherit); |
1739 | free_args: | ||
1740 | kfree(vol_args); | ||
1736 | return ret; | 1741 | return ret; |
1737 | } | 1742 | } |
1738 | 1743 | ||
@@ -2652,7 +2657,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) | |||
2652 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 2657 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
2653 | if (IS_ERR(vol_args)) { | 2658 | if (IS_ERR(vol_args)) { |
2654 | ret = PTR_ERR(vol_args); | 2659 | ret = PTR_ERR(vol_args); |
2655 | goto out; | 2660 | goto err_drop; |
2656 | } | 2661 | } |
2657 | 2662 | ||
2658 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | 2663 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; |
@@ -2670,6 +2675,7 @@ static long btrfs_ioctl_rm_dev(struct file *file, void __user *arg) | |||
2670 | 2675 | ||
2671 | out: | 2676 | out: |
2672 | kfree(vol_args); | 2677 | kfree(vol_args); |
2678 | err_drop: | ||
2673 | mnt_drop_write_file(file); | 2679 | mnt_drop_write_file(file); |
2674 | return ret; | 2680 | return ret; |
2675 | } | 2681 | } |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 7e0e6e3029dd..1d1ba083ca6e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -94,8 +94,10 @@ | |||
94 | #define LOG_WALK_REPLAY_ALL 3 | 94 | #define LOG_WALK_REPLAY_ALL 3 |
95 | 95 | ||
96 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, | 96 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
97 | struct btrfs_root *root, struct inode *inode, | 97 | struct btrfs_root *root, struct inode *inode, |
98 | int inode_only); | 98 | int inode_only, |
99 | const loff_t start, | ||
100 | const loff_t end); | ||
99 | static int link_to_fixup_dir(struct btrfs_trans_handle *trans, | 101 | static int link_to_fixup_dir(struct btrfs_trans_handle *trans, |
100 | struct btrfs_root *root, | 102 | struct btrfs_root *root, |
101 | struct btrfs_path *path, u64 objectid); | 103 | struct btrfs_path *path, u64 objectid); |
@@ -3858,8 +3860,10 @@ process: | |||
3858 | * This handles both files and directories. | 3860 | * This handles both files and directories. |
3859 | */ | 3861 | */ |
3860 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, | 3862 | static int btrfs_log_inode(struct btrfs_trans_handle *trans, |
3861 | struct btrfs_root *root, struct inode *inode, | 3863 | struct btrfs_root *root, struct inode *inode, |
3862 | int inode_only) | 3864 | int inode_only, |
3865 | const loff_t start, | ||
3866 | const loff_t end) | ||
3863 | { | 3867 | { |
3864 | struct btrfs_path *path; | 3868 | struct btrfs_path *path; |
3865 | struct btrfs_path *dst_path; | 3869 | struct btrfs_path *dst_path; |
@@ -3876,6 +3880,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
3876 | int ins_nr; | 3880 | int ins_nr; |
3877 | bool fast_search = false; | 3881 | bool fast_search = false; |
3878 | u64 ino = btrfs_ino(inode); | 3882 | u64 ino = btrfs_ino(inode); |
3883 | struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; | ||
3879 | 3884 | ||
3880 | path = btrfs_alloc_path(); | 3885 | path = btrfs_alloc_path(); |
3881 | if (!path) | 3886 | if (!path) |
@@ -4049,13 +4054,35 @@ log_extents: | |||
4049 | goto out_unlock; | 4054 | goto out_unlock; |
4050 | } | 4055 | } |
4051 | } else if (inode_only == LOG_INODE_ALL) { | 4056 | } else if (inode_only == LOG_INODE_ALL) { |
4052 | struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree; | ||
4053 | struct extent_map *em, *n; | 4057 | struct extent_map *em, *n; |
4054 | 4058 | ||
4055 | write_lock(&tree->lock); | 4059 | write_lock(&em_tree->lock); |
4056 | list_for_each_entry_safe(em, n, &tree->modified_extents, list) | 4060 | /* |
4057 | list_del_init(&em->list); | 4061 | * We can't just remove every em if we're called for a ranged |
4058 | write_unlock(&tree->lock); | 4062 | * fsync - that is, one that doesn't cover the whole possible |
4063 | * file range (0 to LLONG_MAX). This is because we can have | ||
4064 | * em's that fall outside the range we're logging and therefore | ||
4065 | * their ordered operations haven't completed yet | ||
4066 | * (btrfs_finish_ordered_io() not invoked yet). This means we | ||
4067 | * didn't get their respective file extent item in the fs/subvol | ||
4068 | * tree yet, and need to let the next fast fsync (one which | ||
4069 | * consults the list of modified extent maps) find the em so | ||
4070 | * that it logs a matching file extent item and waits for the | ||
4071 | * respective ordered operation to complete (if it's still | ||
4072 | * running). | ||
4073 | * | ||
4074 | * Removing every em outside the range we're logging would make | ||
4075 | * the next fast fsync not log their matching file extent items, | ||
4076 | * therefore making us lose data after a log replay. | ||
4077 | */ | ||
4078 | list_for_each_entry_safe(em, n, &em_tree->modified_extents, | ||
4079 | list) { | ||
4080 | const u64 mod_end = em->mod_start + em->mod_len - 1; | ||
4081 | |||
4082 | if (em->mod_start >= start && mod_end <= end) | ||
4083 | list_del_init(&em->list); | ||
4084 | } | ||
4085 | write_unlock(&em_tree->lock); | ||
4059 | } | 4086 | } |
4060 | 4087 | ||
4061 | if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { | 4088 | if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) { |
@@ -4065,6 +4092,7 @@ log_extents: | |||
4065 | goto out_unlock; | 4092 | goto out_unlock; |
4066 | } | 4093 | } |
4067 | } | 4094 | } |
4095 | |||
4068 | BTRFS_I(inode)->logged_trans = trans->transid; | 4096 | BTRFS_I(inode)->logged_trans = trans->transid; |
4069 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; | 4097 | BTRFS_I(inode)->last_log_commit = BTRFS_I(inode)->last_sub_trans; |
4070 | out_unlock: | 4098 | out_unlock: |
@@ -4161,7 +4189,10 @@ out: | |||
4161 | */ | 4189 | */ |
4162 | static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | 4190 | static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, |
4163 | struct btrfs_root *root, struct inode *inode, | 4191 | struct btrfs_root *root, struct inode *inode, |
4164 | struct dentry *parent, int exists_only, | 4192 | struct dentry *parent, |
4193 | const loff_t start, | ||
4194 | const loff_t end, | ||
4195 | int exists_only, | ||
4165 | struct btrfs_log_ctx *ctx) | 4196 | struct btrfs_log_ctx *ctx) |
4166 | { | 4197 | { |
4167 | int inode_only = exists_only ? LOG_INODE_EXISTS : LOG_INODE_ALL; | 4198 | int inode_only = exists_only ? LOG_INODE_EXISTS : LOG_INODE_ALL; |
@@ -4207,7 +4238,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
4207 | if (ret) | 4238 | if (ret) |
4208 | goto end_no_trans; | 4239 | goto end_no_trans; |
4209 | 4240 | ||
4210 | ret = btrfs_log_inode(trans, root, inode, inode_only); | 4241 | ret = btrfs_log_inode(trans, root, inode, inode_only, start, end); |
4211 | if (ret) | 4242 | if (ret) |
4212 | goto end_trans; | 4243 | goto end_trans; |
4213 | 4244 | ||
@@ -4235,7 +4266,8 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
4235 | 4266 | ||
4236 | if (BTRFS_I(inode)->generation > | 4267 | if (BTRFS_I(inode)->generation > |
4237 | root->fs_info->last_trans_committed) { | 4268 | root->fs_info->last_trans_committed) { |
4238 | ret = btrfs_log_inode(trans, root, inode, inode_only); | 4269 | ret = btrfs_log_inode(trans, root, inode, inode_only, |
4270 | 0, LLONG_MAX); | ||
4239 | if (ret) | 4271 | if (ret) |
4240 | goto end_trans; | 4272 | goto end_trans; |
4241 | } | 4273 | } |
@@ -4269,13 +4301,15 @@ end_no_trans: | |||
4269 | */ | 4301 | */ |
4270 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, | 4302 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, |
4271 | struct btrfs_root *root, struct dentry *dentry, | 4303 | struct btrfs_root *root, struct dentry *dentry, |
4304 | const loff_t start, | ||
4305 | const loff_t end, | ||
4272 | struct btrfs_log_ctx *ctx) | 4306 | struct btrfs_log_ctx *ctx) |
4273 | { | 4307 | { |
4274 | struct dentry *parent = dget_parent(dentry); | 4308 | struct dentry *parent = dget_parent(dentry); |
4275 | int ret; | 4309 | int ret; |
4276 | 4310 | ||
4277 | ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, | 4311 | ret = btrfs_log_inode_parent(trans, root, dentry->d_inode, parent, |
4278 | 0, ctx); | 4312 | start, end, 0, ctx); |
4279 | dput(parent); | 4313 | dput(parent); |
4280 | 4314 | ||
4281 | return ret; | 4315 | return ret; |
@@ -4512,6 +4546,7 @@ int btrfs_log_new_name(struct btrfs_trans_handle *trans, | |||
4512 | root->fs_info->last_trans_committed)) | 4546 | root->fs_info->last_trans_committed)) |
4513 | return 0; | 4547 | return 0; |
4514 | 4548 | ||
4515 | return btrfs_log_inode_parent(trans, root, inode, parent, 1, NULL); | 4549 | return btrfs_log_inode_parent(trans, root, inode, parent, 0, |
4550 | LLONG_MAX, 1, NULL); | ||
4516 | } | 4551 | } |
4517 | 4552 | ||
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index 7f5b41bd5373..e2e798ae7cd7 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
@@ -59,6 +59,8 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans, | |||
59 | int btrfs_recover_log_trees(struct btrfs_root *tree_root); | 59 | int btrfs_recover_log_trees(struct btrfs_root *tree_root); |
60 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, | 60 | int btrfs_log_dentry_safe(struct btrfs_trans_handle *trans, |
61 | struct btrfs_root *root, struct dentry *dentry, | 61 | struct btrfs_root *root, struct dentry *dentry, |
62 | const loff_t start, | ||
63 | const loff_t end, | ||
62 | struct btrfs_log_ctx *ctx); | 64 | struct btrfs_log_ctx *ctx); |
63 | int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, | 65 | int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans, |
64 | struct btrfs_root *root, | 66 | struct btrfs_root *root, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 340a92d08e84..2c2d6d1d8eee 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -529,12 +529,12 @@ static noinline int device_list_add(const char *path, | |||
529 | */ | 529 | */ |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * As of now don't allow update to btrfs_fs_device through | 532 | * For now, we do allow update to btrfs_fs_device through the |
533 | * the btrfs dev scan cli, after FS has been mounted. | 533 | * btrfs dev scan cli after FS has been mounted. We're still |
534 | * tracking a problem where systems fail mount by subvolume id | ||
535 | * when we reject replacement on a mounted FS. | ||
534 | */ | 536 | */ |
535 | if (fs_devices->opened) { | 537 | if (!fs_devices->opened && found_transid < device->generation) { |
536 | return -EBUSY; | ||
537 | } else { | ||
538 | /* | 538 | /* |
539 | * That is if the FS is _not_ mounted and if you | 539 | * That is if the FS is _not_ mounted and if you |
540 | * are here, that means there is more than one | 540 | * are here, that means there is more than one |
@@ -542,8 +542,7 @@ static noinline int device_list_add(const char *path, | |||
542 | * with larger generation number or the last-in if | 542 | * with larger generation number or the last-in if |
543 | * generation are equal. | 543 | * generation are equal. |
544 | */ | 544 | */ |
545 | if (found_transid < device->generation) | 545 | return -EEXIST; |
546 | return -EEXIST; | ||
547 | } | 546 | } |
548 | 547 | ||
549 | name = rcu_string_strdup(path, GFP_NOFS); | 548 | name = rcu_string_strdup(path, GFP_NOFS); |
diff --git a/fs/buffer.c b/fs/buffer.c index 8f05111bbb8b..3588a80854b2 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1022,7 +1022,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
1022 | bh = page_buffers(page); | 1022 | bh = page_buffers(page); |
1023 | if (bh->b_size == size) { | 1023 | if (bh->b_size == size) { |
1024 | end_block = init_page_buffers(page, bdev, | 1024 | end_block = init_page_buffers(page, bdev, |
1025 | index << sizebits, size); | 1025 | (sector_t)index << sizebits, |
1026 | size); | ||
1026 | goto done; | 1027 | goto done; |
1027 | } | 1028 | } |
1028 | if (!try_to_free_buffers(page)) | 1029 | if (!try_to_free_buffers(page)) |
@@ -1043,7 +1044,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
1043 | */ | 1044 | */ |
1044 | spin_lock(&inode->i_mapping->private_lock); | 1045 | spin_lock(&inode->i_mapping->private_lock); |
1045 | link_dev_buffers(page, bh); | 1046 | link_dev_buffers(page, bh); |
1046 | end_block = init_page_buffers(page, bdev, index << sizebits, size); | 1047 | end_block = init_page_buffers(page, bdev, (sector_t)index << sizebits, |
1048 | size); | ||
1047 | spin_unlock(&inode->i_mapping->private_lock); | 1049 | spin_unlock(&inode->i_mapping->private_lock); |
1048 | done: | 1050 | done: |
1049 | ret = (block < end_block) ? 1 : -ENXIO; | 1051 | ret = (block < end_block) ? 1 : -ENXIO; |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 5bf2b41e66d3..83e9c94ca2cf 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -779,7 +779,8 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
779 | !subdir->d_inode->i_op->lookup || | 779 | !subdir->d_inode->i_op->lookup || |
780 | !subdir->d_inode->i_op->mkdir || | 780 | !subdir->d_inode->i_op->mkdir || |
781 | !subdir->d_inode->i_op->create || | 781 | !subdir->d_inode->i_op->create || |
782 | !subdir->d_inode->i_op->rename || | 782 | (!subdir->d_inode->i_op->rename && |
783 | !subdir->d_inode->i_op->rename2) || | ||
783 | !subdir->d_inode->i_op->rmdir || | 784 | !subdir->d_inode->i_op->rmdir || |
784 | !subdir->d_inode->i_op->unlink) | 785 | !subdir->d_inode->i_op->unlink) |
785 | goto check_error; | 786 | goto check_error; |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 4b1fb5ca65b8..25e745b8eb1b 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -151,7 +151,6 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
151 | struct cachefiles_one_read *monitor; | 151 | struct cachefiles_one_read *monitor; |
152 | struct cachefiles_object *object; | 152 | struct cachefiles_object *object; |
153 | struct fscache_retrieval *op; | 153 | struct fscache_retrieval *op; |
154 | struct pagevec pagevec; | ||
155 | int error, max; | 154 | int error, max; |
156 | 155 | ||
157 | op = container_of(_op, struct fscache_retrieval, op); | 156 | op = container_of(_op, struct fscache_retrieval, op); |
@@ -160,8 +159,6 @@ static void cachefiles_read_copier(struct fscache_operation *_op) | |||
160 | 159 | ||
161 | _enter("{ino=%lu}", object->backer->d_inode->i_ino); | 160 | _enter("{ino=%lu}", object->backer->d_inode->i_ino); |
162 | 161 | ||
163 | pagevec_init(&pagevec, 0); | ||
164 | |||
165 | max = 8; | 162 | max = 8; |
166 | spin_lock_irq(&object->work_lock); | 163 | spin_lock_irq(&object->work_lock); |
167 | 164 | ||
@@ -396,7 +393,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
396 | { | 393 | { |
397 | struct cachefiles_object *object; | 394 | struct cachefiles_object *object; |
398 | struct cachefiles_cache *cache; | 395 | struct cachefiles_cache *cache; |
399 | struct pagevec pagevec; | ||
400 | struct inode *inode; | 396 | struct inode *inode; |
401 | sector_t block0, block; | 397 | sector_t block0, block; |
402 | unsigned shift; | 398 | unsigned shift; |
@@ -427,8 +423,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
427 | op->op.flags |= FSCACHE_OP_ASYNC; | 423 | op->op.flags |= FSCACHE_OP_ASYNC; |
428 | op->op.processor = cachefiles_read_copier; | 424 | op->op.processor = cachefiles_read_copier; |
429 | 425 | ||
430 | pagevec_init(&pagevec, 0); | ||
431 | |||
432 | /* we assume the absence or presence of the first block is a good | 426 | /* we assume the absence or presence of the first block is a good |
433 | * enough indication for the page as a whole | 427 | * enough indication for the page as a whole |
434 | * - TODO: don't use bmap() for this as it is _not_ actually good | 428 | * - TODO: don't use bmap() for this as it is _not_ actually good |
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index 603f18a65c12..a2172f3f69e3 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig | |||
@@ -22,6 +22,11 @@ config CIFS | |||
22 | support for OS/2 and Windows ME and similar servers is provided as | 22 | support for OS/2 and Windows ME and similar servers is provided as |
23 | well. | 23 | well. |
24 | 24 | ||
25 | The module also provides optional support for the followon | ||
26 | protocols for CIFS including SMB3, which enables | ||
27 | useful performance and security features (see the description | ||
28 | of CONFIG_CIFS_SMB2). | ||
29 | |||
25 | The cifs module provides an advanced network file system | 30 | The cifs module provides an advanced network file system |
26 | client for mounting to CIFS compliant servers. It includes | 31 | client for mounting to CIFS compliant servers. It includes |
27 | support for DFS (hierarchical name space), secure per-user | 32 | support for DFS (hierarchical name space), secure per-user |
@@ -121,7 +126,8 @@ config CIFS_ACL | |||
121 | depends on CIFS_XATTR && KEYS | 126 | depends on CIFS_XATTR && KEYS |
122 | help | 127 | help |
123 | Allows fetching CIFS/NTFS ACL from the server. The DACL blob | 128 | Allows fetching CIFS/NTFS ACL from the server. The DACL blob |
124 | is handed over to the application/caller. | 129 | is handed over to the application/caller. See the man |
130 | page for getcifsacl for more information. | ||
125 | 131 | ||
126 | config CIFS_DEBUG | 132 | config CIFS_DEBUG |
127 | bool "Enable CIFS debugging routines" | 133 | bool "Enable CIFS debugging routines" |
@@ -162,7 +168,7 @@ config CIFS_NFSD_EXPORT | |||
162 | Allows NFS server to export a CIFS mounted share (nfsd over cifs) | 168 | Allows NFS server to export a CIFS mounted share (nfsd over cifs) |
163 | 169 | ||
164 | config CIFS_SMB2 | 170 | config CIFS_SMB2 |
165 | bool "SMB2 network file system support" | 171 | bool "SMB2 and SMB3 network file system support" |
166 | depends on CIFS && INET | 172 | depends on CIFS && INET |
167 | select NLS | 173 | select NLS |
168 | select KEYS | 174 | select KEYS |
@@ -170,16 +176,21 @@ config CIFS_SMB2 | |||
170 | select DNS_RESOLVER | 176 | select DNS_RESOLVER |
171 | 177 | ||
172 | help | 178 | help |
173 | This enables experimental support for the SMB2 (Server Message Block | 179 | This enables support for the Server Message Block version 2 |
174 | version 2) protocol. The SMB2 protocol is the successor to the | 180 | family of protocols, including SMB3. SMB3 support is |
175 | popular CIFS and SMB network file sharing protocols. SMB2 is the | 181 | enabled on mount by specifying "vers=3.0" in the mount |
176 | native file sharing mechanism for recent versions of Windows | 182 | options. These protocols are the successors to the popular |
177 | operating systems (since Vista). SMB2 enablement will eventually | 183 | CIFS and SMB network file sharing protocols. SMB3 is the |
178 | allow users better performance, security and features, than would be | 184 | native file sharing mechanism for the more recent |
179 | possible with cifs. Note that smb2 mount options also are simpler | 185 | versions of Windows (Windows 8 and Windows 2012 and |
180 | (compared to cifs) due to protocol improvements. | 186 | later) and Samba server and many others support SMB3 well. |
181 | 187 | In general SMB3 enables better performance, security | |
182 | Unless you are a developer or tester, say N. | 188 | and features, than would be possible with CIFS (Note that |
189 | when mounting to Samba, due to the CIFS POSIX extensions, | ||
190 | CIFS mounts can provide slightly better POSIX compatibility | ||
191 | than SMB3 mounts do though). Note that SMB2/SMB3 mount | ||
192 | options are also slightly simpler (compared to CIFS) due | ||
193 | to protocol improvements. | ||
183 | 194 | ||
184 | config CIFS_FSCACHE | 195 | config CIFS_FSCACHE |
185 | bool "Provide CIFS client caching support" | 196 | bool "Provide CIFS client caching support" |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index b0fafa499505..002e0c173939 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -136,5 +136,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
136 | extern const struct export_operations cifs_export_ops; | 136 | extern const struct export_operations cifs_export_ops; |
137 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ | 137 | #endif /* CONFIG_CIFS_NFSD_EXPORT */ |
138 | 138 | ||
139 | #define CIFS_VERSION "2.04" | 139 | #define CIFS_VERSION "2.05" |
140 | #endif /* _CIFSFS_H */ | 140 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index dfc731b02aa9..25b8392bfdd2 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -70,11 +70,6 @@ | |||
70 | #define SERVER_NAME_LENGTH 40 | 70 | #define SERVER_NAME_LENGTH 40 |
71 | #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) | 71 | #define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1) |
72 | 72 | ||
73 | /* used to define string lengths for reversing unicode strings */ | ||
74 | /* (256+1)*2 = 514 */ | ||
75 | /* (max path length + 1 for null) * 2 for unicode */ | ||
76 | #define MAX_NAME 514 | ||
77 | |||
78 | /* SMB echo "timeout" -- FIXME: tunable? */ | 73 | /* SMB echo "timeout" -- FIXME: tunable? */ |
79 | #define SMB_ECHO_INTERVAL (60 * HZ) | 74 | #define SMB_ECHO_INTERVAL (60 * HZ) |
80 | 75 | ||
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 03ed8a09581c..36ca2045009b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1600,6 +1600,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1600 | tmp_end++; | 1600 | tmp_end++; |
1601 | if (!(tmp_end < end && tmp_end[1] == delim)) { | 1601 | if (!(tmp_end < end && tmp_end[1] == delim)) { |
1602 | /* No it is not. Set the password to NULL */ | 1602 | /* No it is not. Set the password to NULL */ |
1603 | kfree(vol->password); | ||
1603 | vol->password = NULL; | 1604 | vol->password = NULL; |
1604 | break; | 1605 | break; |
1605 | } | 1606 | } |
@@ -1637,6 +1638,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1637 | options = end; | 1638 | options = end; |
1638 | } | 1639 | } |
1639 | 1640 | ||
1641 | kfree(vol->password); | ||
1640 | /* Now build new password string */ | 1642 | /* Now build new password string */ |
1641 | temp_len = strlen(value); | 1643 | temp_len = strlen(value); |
1642 | vol->password = kzalloc(temp_len+1, GFP_KERNEL); | 1644 | vol->password = kzalloc(temp_len+1, GFP_KERNEL); |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 3db0c5fd9a11..6cbd9c688cfe 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -497,6 +497,14 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, | |||
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
499 | 499 | ||
500 | if (file->f_flags & O_DIRECT && | ||
501 | CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) { | ||
502 | if (CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
503 | file->f_op = &cifs_file_direct_nobrl_ops; | ||
504 | else | ||
505 | file->f_op = &cifs_file_direct_ops; | ||
506 | } | ||
507 | |||
500 | file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); | 508 | file_info = cifs_new_fileinfo(&fid, file, tlink, oplock); |
501 | if (file_info == NULL) { | 509 | if (file_info == NULL) { |
502 | if (server->ops->close) | 510 | if (server->ops->close) |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index d5fec92e0360..7c018a1c52f7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -467,6 +467,14 @@ int cifs_open(struct inode *inode, struct file *file) | |||
467 | cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", | 467 | cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n", |
468 | inode, file->f_flags, full_path); | 468 | inode, file->f_flags, full_path); |
469 | 469 | ||
470 | if (file->f_flags & O_DIRECT && | ||
471 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) { | ||
472 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
473 | file->f_op = &cifs_file_direct_nobrl_ops; | ||
474 | else | ||
475 | file->f_op = &cifs_file_direct_ops; | ||
476 | } | ||
477 | |||
470 | if (server->oplocks) | 478 | if (server->oplocks) |
471 | oplock = REQ_OPLOCK; | 479 | oplock = REQ_OPLOCK; |
472 | else | 480 | else |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 949ec909ec9a..7899a40465b3 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1720,7 +1720,10 @@ cifs_rename2(struct inode *source_dir, struct dentry *source_dentry, | |||
1720 | unlink_target: | 1720 | unlink_target: |
1721 | /* Try unlinking the target dentry if it's not negative */ | 1721 | /* Try unlinking the target dentry if it's not negative */ |
1722 | if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { | 1722 | if (target_dentry->d_inode && (rc == -EACCES || rc == -EEXIST)) { |
1723 | tmprc = cifs_unlink(target_dir, target_dentry); | 1723 | if (d_is_dir(target_dentry)) |
1724 | tmprc = cifs_rmdir(target_dir, target_dentry); | ||
1725 | else | ||
1726 | tmprc = cifs_unlink(target_dir, target_dentry); | ||
1724 | if (tmprc) | 1727 | if (tmprc) |
1725 | goto cifs_rename_exit; | 1728 | goto cifs_rename_exit; |
1726 | rc = cifs_do_rename(xid, source_dentry, from_name, | 1729 | rc = cifs_do_rename(xid, source_dentry, from_name, |
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 68559fd557fb..5657416d3483 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -213,8 +213,12 @@ create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
213 | if (rc) | 213 | if (rc) |
214 | goto out; | 214 | goto out; |
215 | 215 | ||
216 | rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, cifs_sb, | 216 | if (tcon->ses->server->ops->create_mf_symlink) |
217 | fromName, buf, &bytes_written); | 217 | rc = tcon->ses->server->ops->create_mf_symlink(xid, tcon, |
218 | cifs_sb, fromName, buf, &bytes_written); | ||
219 | else | ||
220 | rc = -EOPNOTSUPP; | ||
221 | |||
218 | if (rc) | 222 | if (rc) |
219 | goto out; | 223 | goto out; |
220 | 224 | ||
@@ -339,9 +343,11 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, | |||
339 | if (rc) | 343 | if (rc) |
340 | return rc; | 344 | return rc; |
341 | 345 | ||
342 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) | 346 | if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) { |
347 | rc = -ENOENT; | ||
343 | /* it's not a symlink */ | 348 | /* it's not a symlink */ |
344 | goto out; | 349 | goto out; |
350 | } | ||
345 | 351 | ||
346 | io_parms.netfid = fid.netfid; | 352 | io_parms.netfid = fid.netfid; |
347 | io_parms.pid = current->tgid; | 353 | io_parms.pid = current->tgid; |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 6834b9c3bec1..b333ff60781d 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -925,11 +925,23 @@ cifs_NTtimeToUnix(__le64 ntutc) | |||
925 | /* BB what about the timezone? BB */ | 925 | /* BB what about the timezone? BB */ |
926 | 926 | ||
927 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ | 927 | /* Subtract the NTFS time offset, then convert to 1s intervals. */ |
928 | u64 t; | 928 | s64 t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; |
929 | |||
930 | /* | ||
931 | * Unfortunately can not use normal 64 bit division on 32 bit arch, but | ||
932 | * the alternative, do_div, does not work with negative numbers so have | ||
933 | * to special case them | ||
934 | */ | ||
935 | if (t < 0) { | ||
936 | t = -t; | ||
937 | ts.tv_nsec = (long)(do_div(t, 10000000) * 100); | ||
938 | ts.tv_nsec = -ts.tv_nsec; | ||
939 | ts.tv_sec = -t; | ||
940 | } else { | ||
941 | ts.tv_nsec = (long)do_div(t, 10000000) * 100; | ||
942 | ts.tv_sec = t; | ||
943 | } | ||
929 | 944 | ||
930 | t = le64_to_cpu(ntutc) - NTFS_TIME_OFFSET; | ||
931 | ts.tv_nsec = do_div(t, 10000000) * 100; | ||
932 | ts.tv_sec = t; | ||
933 | return ts; | 945 | return ts; |
934 | } | 946 | } |
935 | 947 | ||
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 798c80a41c88..b334a89d6a66 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -596,8 +596,8 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos, | |||
596 | if (server->ops->dir_needs_close(cfile)) { | 596 | if (server->ops->dir_needs_close(cfile)) { |
597 | cfile->invalidHandle = true; | 597 | cfile->invalidHandle = true; |
598 | spin_unlock(&cifs_file_list_lock); | 598 | spin_unlock(&cifs_file_list_lock); |
599 | if (server->ops->close) | 599 | if (server->ops->close_dir) |
600 | server->ops->close(xid, tcon, &cfile->fid); | 600 | server->ops->close_dir(xid, tcon, &cfile->fid); |
601 | } else | 601 | } else |
602 | spin_unlock(&cifs_file_list_lock); | 602 | spin_unlock(&cifs_file_list_lock); |
603 | if (cfile->srch_inf.ntwrk_buf_start) { | 603 | if (cfile->srch_inf.ntwrk_buf_start) { |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 39ee32688eac..57db63ff88da 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -243,10 +243,11 @@ static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft, | |||
243 | kfree(ses->serverOS); | 243 | kfree(ses->serverOS); |
244 | 244 | ||
245 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); | 245 | ses->serverOS = kzalloc(len + 1, GFP_KERNEL); |
246 | if (ses->serverOS) | 246 | if (ses->serverOS) { |
247 | strncpy(ses->serverOS, bcc_ptr, len); | 247 | strncpy(ses->serverOS, bcc_ptr, len); |
248 | if (strncmp(ses->serverOS, "OS/2", 4) == 0) | 248 | if (strncmp(ses->serverOS, "OS/2", 4) == 0) |
249 | cifs_dbg(FYI, "OS/2 server\n"); | 249 | cifs_dbg(FYI, "OS/2 server\n"); |
250 | } | ||
250 | 251 | ||
251 | bcc_ptr += len + 1; | 252 | bcc_ptr += len + 1; |
252 | bleft -= len + 1; | 253 | bleft -= len + 1; |
@@ -744,14 +745,6 @@ out: | |||
744 | sess_free_buffer(sess_data); | 745 | sess_free_buffer(sess_data); |
745 | } | 746 | } |
746 | 747 | ||
747 | #else | ||
748 | |||
749 | static void | ||
750 | sess_auth_lanman(struct sess_data *sess_data) | ||
751 | { | ||
752 | sess_data->result = -EOPNOTSUPP; | ||
753 | sess_data->func = NULL; | ||
754 | } | ||
755 | #endif | 748 | #endif |
756 | 749 | ||
757 | static void | 750 | static void |
@@ -1102,15 +1095,6 @@ out: | |||
1102 | ses->auth_key.response = NULL; | 1095 | ses->auth_key.response = NULL; |
1103 | } | 1096 | } |
1104 | 1097 | ||
1105 | #else | ||
1106 | |||
1107 | static void | ||
1108 | sess_auth_kerberos(struct sess_data *sess_data) | ||
1109 | { | ||
1110 | cifs_dbg(VFS, "Kerberos negotiated but upcall support disabled!\n"); | ||
1111 | sess_data->result = -ENOSYS; | ||
1112 | sess_data->func = NULL; | ||
1113 | } | ||
1114 | #endif /* ! CONFIG_CIFS_UPCALL */ | 1098 | #endif /* ! CONFIG_CIFS_UPCALL */ |
1115 | 1099 | ||
1116 | /* | 1100 | /* |
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index 3f17b4550831..45992944e238 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c | |||
@@ -50,7 +50,7 @@ smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, | |||
50 | goto out; | 50 | goto out; |
51 | } | 51 | } |
52 | 52 | ||
53 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 53 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
54 | GFP_KERNEL); | 54 | GFP_KERNEL); |
55 | if (smb2_data == NULL) { | 55 | if (smb2_data == NULL) { |
56 | rc = -ENOMEM; | 56 | rc = -ENOMEM; |
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 0150182a4494..899bbc86f73e 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c | |||
@@ -131,7 +131,7 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
131 | *adjust_tz = false; | 131 | *adjust_tz = false; |
132 | *symlink = false; | 132 | *symlink = false; |
133 | 133 | ||
134 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 134 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
135 | GFP_KERNEL); | 135 | GFP_KERNEL); |
136 | if (smb2_data == NULL) | 136 | if (smb2_data == NULL) |
137 | return -ENOMEM; | 137 | return -ENOMEM; |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 5a48aa290dfe..f522193b7184 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -389,7 +389,7 @@ smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
389 | int rc; | 389 | int rc; |
390 | struct smb2_file_all_info *smb2_data; | 390 | struct smb2_file_all_info *smb2_data; |
391 | 391 | ||
392 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 392 | smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
393 | GFP_KERNEL); | 393 | GFP_KERNEL); |
394 | if (smb2_data == NULL) | 394 | if (smb2_data == NULL) |
395 | return -ENOMEM; | 395 | return -ENOMEM; |
@@ -1035,7 +1035,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | |||
1035 | if (keep_size == false) | 1035 | if (keep_size == false) |
1036 | return -EOPNOTSUPP; | 1036 | return -EOPNOTSUPP; |
1037 | 1037 | ||
1038 | /* | 1038 | /* |
1039 | * Must check if file sparse since fallocate -z (zero range) assumes | 1039 | * Must check if file sparse since fallocate -z (zero range) assumes |
1040 | * non-sparse allocation | 1040 | * non-sparse allocation |
1041 | */ | 1041 | */ |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index fa0dd044213b..74b3a6684383 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -530,7 +530,7 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses, | |||
530 | struct smb2_sess_setup_rsp *rsp = NULL; | 530 | struct smb2_sess_setup_rsp *rsp = NULL; |
531 | struct kvec iov[2]; | 531 | struct kvec iov[2]; |
532 | int rc = 0; | 532 | int rc = 0; |
533 | int resp_buftype; | 533 | int resp_buftype = CIFS_NO_BUFFER; |
534 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ | 534 | __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ |
535 | struct TCP_Server_Info *server = ses->server; | 535 | struct TCP_Server_Info *server = ses->server; |
536 | u16 blob_length = 0; | 536 | u16 blob_length = 0; |
@@ -1403,8 +1403,7 @@ SMB2_close(const unsigned int xid, struct cifs_tcon *tcon, | |||
1403 | rsp = (struct smb2_close_rsp *)iov[0].iov_base; | 1403 | rsp = (struct smb2_close_rsp *)iov[0].iov_base; |
1404 | 1404 | ||
1405 | if (rc != 0) { | 1405 | if (rc != 0) { |
1406 | if (tcon) | 1406 | cifs_stats_fail_inc(tcon, SMB2_CLOSE_HE); |
1407 | cifs_stats_fail_inc(tcon, SMB2_CLOSE_HE); | ||
1408 | goto close_exit; | 1407 | goto close_exit; |
1409 | } | 1408 | } |
1410 | 1409 | ||
@@ -1533,7 +1532,7 @@ SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
1533 | { | 1532 | { |
1534 | return query_info(xid, tcon, persistent_fid, volatile_fid, | 1533 | return query_info(xid, tcon, persistent_fid, volatile_fid, |
1535 | FILE_ALL_INFORMATION, | 1534 | FILE_ALL_INFORMATION, |
1536 | sizeof(struct smb2_file_all_info) + MAX_NAME * 2, | 1535 | sizeof(struct smb2_file_all_info) + PATH_MAX * 2, |
1537 | sizeof(struct smb2_file_all_info), data); | 1536 | sizeof(struct smb2_file_all_info), data); |
1538 | } | 1537 | } |
1539 | 1538 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index d30ce699ae4b..7a5b51440afa 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -106,8 +106,7 @@ static inline struct hlist_bl_head *d_hash(const struct dentry *parent, | |||
106 | unsigned int hash) | 106 | unsigned int hash) |
107 | { | 107 | { |
108 | hash += (unsigned long) parent / L1_CACHE_BYTES; | 108 | hash += (unsigned long) parent / L1_CACHE_BYTES; |
109 | hash = hash + (hash >> d_hash_shift); | 109 | return dentry_hashtable + hash_32(hash, d_hash_shift); |
110 | return dentry_hashtable + (hash & d_hash_mask); | ||
111 | } | 110 | } |
112 | 111 | ||
113 | /* Statistics gathering. */ | 112 | /* Statistics gathering. */ |
@@ -2656,6 +2655,12 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | |||
2656 | dentry->d_parent = dentry; | 2655 | dentry->d_parent = dentry; |
2657 | list_del_init(&dentry->d_u.d_child); | 2656 | list_del_init(&dentry->d_u.d_child); |
2658 | anon->d_parent = dparent; | 2657 | anon->d_parent = dparent; |
2658 | if (likely(!d_unhashed(anon))) { | ||
2659 | hlist_bl_lock(&anon->d_sb->s_anon); | ||
2660 | __hlist_bl_del(&anon->d_hash); | ||
2661 | anon->d_hash.pprev = NULL; | ||
2662 | hlist_bl_unlock(&anon->d_sb->s_anon); | ||
2663 | } | ||
2659 | list_move(&anon->d_u.d_child, &dparent->d_subdirs); | 2664 | list_move(&anon->d_u.d_child, &dparent->d_subdirs); |
2660 | 2665 | ||
2661 | write_seqcount_end(&dentry->d_seq); | 2666 | write_seqcount_end(&dentry->d_seq); |
@@ -2714,7 +2719,6 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
2714 | write_seqlock(&rename_lock); | 2719 | write_seqlock(&rename_lock); |
2715 | __d_materialise_dentry(dentry, new); | 2720 | __d_materialise_dentry(dentry, new); |
2716 | write_sequnlock(&rename_lock); | 2721 | write_sequnlock(&rename_lock); |
2717 | __d_drop(new); | ||
2718 | _d_rehash(new); | 2722 | _d_rehash(new); |
2719 | spin_unlock(&new->d_lock); | 2723 | spin_unlock(&new->d_lock); |
2720 | spin_unlock(&inode->i_lock); | 2724 | spin_unlock(&inode->i_lock); |
@@ -2778,7 +2782,6 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) | |||
2778 | * could splice into our tree? */ | 2782 | * could splice into our tree? */ |
2779 | __d_materialise_dentry(dentry, alias); | 2783 | __d_materialise_dentry(dentry, alias); |
2780 | write_sequnlock(&rename_lock); | 2784 | write_sequnlock(&rename_lock); |
2781 | __d_drop(alias); | ||
2782 | goto found; | 2785 | goto found; |
2783 | } else { | 2786 | } else { |
2784 | /* Nope, but we must(!) avoid directory | 2787 | /* Nope, but we must(!) avoid directory |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index b10b48c2a7af..7bcfff900f05 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1852,7 +1852,8 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1852 | goto error_tgt_fput; | 1852 | goto error_tgt_fput; |
1853 | 1853 | ||
1854 | /* Check if EPOLLWAKEUP is allowed */ | 1854 | /* Check if EPOLLWAKEUP is allowed */ |
1855 | ep_take_care_of_epollwakeup(&epds); | 1855 | if (ep_op_has_event(op)) |
1856 | ep_take_care_of_epollwakeup(&epds); | ||
1856 | 1857 | ||
1857 | /* | 1858 | /* |
1858 | * We have to check that the file structure underneath the file descriptor | 1859 | * We have to check that the file structure underneath the file descriptor |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 90a3cdca3f88..603e4ebbd0ac 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -3240,6 +3240,7 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3240 | &new.de, &new.inlined); | 3240 | &new.de, &new.inlined); |
3241 | if (IS_ERR(new.bh)) { | 3241 | if (IS_ERR(new.bh)) { |
3242 | retval = PTR_ERR(new.bh); | 3242 | retval = PTR_ERR(new.bh); |
3243 | new.bh = NULL; | ||
3243 | goto end_rename; | 3244 | goto end_rename; |
3244 | } | 3245 | } |
3245 | if (new.bh) { | 3246 | if (new.bh) { |
@@ -3386,6 +3387,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
3386 | &new.de, &new.inlined); | 3387 | &new.de, &new.inlined); |
3387 | if (IS_ERR(new.bh)) { | 3388 | if (IS_ERR(new.bh)) { |
3388 | retval = PTR_ERR(new.bh); | 3389 | retval = PTR_ERR(new.bh); |
3390 | new.bh = NULL; | ||
3389 | goto end_rename; | 3391 | goto end_rename; |
3390 | } | 3392 | } |
3391 | 3393 | ||
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index bb0e80f03e2e..1e43b905ff98 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -575,6 +575,7 @@ handle_bb: | |||
575 | bh = bclean(handle, sb, block); | 575 | bh = bclean(handle, sb, block); |
576 | if (IS_ERR(bh)) { | 576 | if (IS_ERR(bh)) { |
577 | err = PTR_ERR(bh); | 577 | err = PTR_ERR(bh); |
578 | bh = NULL; | ||
578 | goto out; | 579 | goto out; |
579 | } | 580 | } |
580 | overhead = ext4_group_overhead_blocks(sb, group); | 581 | overhead = ext4_group_overhead_blocks(sb, group); |
@@ -603,6 +604,7 @@ handle_ib: | |||
603 | bh = bclean(handle, sb, block); | 604 | bh = bclean(handle, sb, block); |
604 | if (IS_ERR(bh)) { | 605 | if (IS_ERR(bh)) { |
605 | err = PTR_ERR(bh); | 606 | err = PTR_ERR(bh); |
607 | bh = NULL; | ||
606 | goto out; | 608 | goto out; |
607 | } | 609 | } |
608 | 610 | ||
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index d3b4539f1651..da032daf0e0d 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
@@ -982,6 +982,7 @@ nomem: | |||
982 | submit_op_failed: | 982 | submit_op_failed: |
983 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); | 983 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); |
984 | spin_unlock(&cookie->lock); | 984 | spin_unlock(&cookie->lock); |
985 | fscache_unuse_cookie(object); | ||
985 | kfree(op); | 986 | kfree(op); |
986 | _leave(" [EIO]"); | 987 | _leave(" [EIO]"); |
987 | return transit_to(KILL_OBJECT); | 988 | return transit_to(KILL_OBJECT); |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 85332b9d19d1..de33b3fccca6 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -44,6 +44,19 @@ void __fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *pa | |||
44 | EXPORT_SYMBOL(__fscache_wait_on_page_write); | 44 | EXPORT_SYMBOL(__fscache_wait_on_page_write); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * wait for a page to finish being written to the cache. Put a timeout here | ||
48 | * since we might be called recursively via parent fs. | ||
49 | */ | ||
50 | static | ||
51 | bool release_page_wait_timeout(struct fscache_cookie *cookie, struct page *page) | ||
52 | { | ||
53 | wait_queue_head_t *wq = bit_waitqueue(&cookie->flags, 0); | ||
54 | |||
55 | return wait_event_timeout(*wq, !__fscache_check_page_write(cookie, page), | ||
56 | HZ); | ||
57 | } | ||
58 | |||
59 | /* | ||
47 | * decide whether a page can be released, possibly by cancelling a store to it | 60 | * decide whether a page can be released, possibly by cancelling a store to it |
48 | * - we're allowed to sleep if __GFP_WAIT is flagged | 61 | * - we're allowed to sleep if __GFP_WAIT is flagged |
49 | */ | 62 | */ |
@@ -115,7 +128,10 @@ page_busy: | |||
115 | } | 128 | } |
116 | 129 | ||
117 | fscache_stat(&fscache_n_store_vmscan_wait); | 130 | fscache_stat(&fscache_n_store_vmscan_wait); |
118 | __fscache_wait_on_page_write(cookie, page); | 131 | if (!release_page_wait_timeout(cookie, page)) |
132 | _debug("fscache writeout timeout page: %p{%lx}", | ||
133 | page, page->index); | ||
134 | |||
119 | gfp &= ~__GFP_WAIT; | 135 | gfp &= ~__GFP_WAIT; |
120 | goto try_again; | 136 | goto try_again; |
121 | } | 137 | } |
@@ -182,7 +198,7 @@ int __fscache_attr_changed(struct fscache_cookie *cookie) | |||
182 | { | 198 | { |
183 | struct fscache_operation *op; | 199 | struct fscache_operation *op; |
184 | struct fscache_object *object; | 200 | struct fscache_object *object; |
185 | bool wake_cookie; | 201 | bool wake_cookie = false; |
186 | 202 | ||
187 | _enter("%p", cookie); | 203 | _enter("%p", cookie); |
188 | 204 | ||
@@ -212,15 +228,16 @@ int __fscache_attr_changed(struct fscache_cookie *cookie) | |||
212 | 228 | ||
213 | __fscache_use_cookie(cookie); | 229 | __fscache_use_cookie(cookie); |
214 | if (fscache_submit_exclusive_op(object, op) < 0) | 230 | if (fscache_submit_exclusive_op(object, op) < 0) |
215 | goto nobufs; | 231 | goto nobufs_dec; |
216 | spin_unlock(&cookie->lock); | 232 | spin_unlock(&cookie->lock); |
217 | fscache_stat(&fscache_n_attr_changed_ok); | 233 | fscache_stat(&fscache_n_attr_changed_ok); |
218 | fscache_put_operation(op); | 234 | fscache_put_operation(op); |
219 | _leave(" = 0"); | 235 | _leave(" = 0"); |
220 | return 0; | 236 | return 0; |
221 | 237 | ||
222 | nobufs: | 238 | nobufs_dec: |
223 | wake_cookie = __fscache_unuse_cookie(cookie); | 239 | wake_cookie = __fscache_unuse_cookie(cookie); |
240 | nobufs: | ||
224 | spin_unlock(&cookie->lock); | 241 | spin_unlock(&cookie->lock); |
225 | kfree(op); | 242 | kfree(op); |
226 | if (wake_cookie) | 243 | if (wake_cookie) |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index e6ee5b6e8d99..f0b945ab853e 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -359,7 +359,7 @@ static inline void release_metapath(struct metapath *mp) | |||
359 | * Returns: The length of the extent (minimum of one block) | 359 | * Returns: The length of the extent (minimum of one block) |
360 | */ | 360 | */ |
361 | 361 | ||
362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, unsigned limit, int *eob) | 362 | static inline unsigned int gfs2_extent_length(void *start, unsigned int len, __be64 *ptr, size_t limit, int *eob) |
363 | { | 363 | { |
364 | const __be64 *end = (start + len); | 364 | const __be64 *end = (start + len); |
365 | const __be64 *first = ptr; | 365 | const __be64 *first = ptr; |
@@ -449,7 +449,7 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
449 | struct buffer_head *bh_map, struct metapath *mp, | 449 | struct buffer_head *bh_map, struct metapath *mp, |
450 | const unsigned int sheight, | 450 | const unsigned int sheight, |
451 | const unsigned int height, | 451 | const unsigned int height, |
452 | const unsigned int maxlen) | 452 | const size_t maxlen) |
453 | { | 453 | { |
454 | struct gfs2_inode *ip = GFS2_I(inode); | 454 | struct gfs2_inode *ip = GFS2_I(inode); |
455 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 455 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -483,7 +483,8 @@ static int gfs2_bmap_alloc(struct inode *inode, const sector_t lblock, | |||
483 | } else { | 483 | } else { |
484 | /* Need to allocate indirect blocks */ | 484 | /* Need to allocate indirect blocks */ |
485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; | 485 | ptrs_per_blk = height > 1 ? sdp->sd_inptrs : sdp->sd_diptrs; |
486 | dblks = min(maxlen, ptrs_per_blk - mp->mp_list[end_of_metadata]); | 486 | dblks = min(maxlen, (size_t)(ptrs_per_blk - |
487 | mp->mp_list[end_of_metadata])); | ||
487 | if (height == ip->i_height) { | 488 | if (height == ip->i_height) { |
488 | /* Writing into existing tree, extend tree down */ | 489 | /* Writing into existing tree, extend tree down */ |
489 | iblks = height - sheight; | 490 | iblks = height - sheight; |
@@ -605,7 +606,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock, | |||
605 | struct gfs2_inode *ip = GFS2_I(inode); | 606 | struct gfs2_inode *ip = GFS2_I(inode); |
606 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 607 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
607 | unsigned int bsize = sdp->sd_sb.sb_bsize; | 608 | unsigned int bsize = sdp->sd_sb.sb_bsize; |
608 | const unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; | 609 | const size_t maxlen = bh_map->b_size >> inode->i_blkbits; |
609 | const u64 *arr = sdp->sd_heightsize; | 610 | const u64 *arr = sdp->sd_heightsize; |
610 | __be64 *ptr; | 611 | __be64 *ptr; |
611 | u64 size; | 612 | u64 size; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 26b3f952e6b1..7f4ed3daa38c 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/dlm.h> | 26 | #include <linux/dlm.h> |
27 | #include <linux/dlm_plock.h> | 27 | #include <linux/dlm_plock.h> |
28 | #include <linux/aio.h> | 28 | #include <linux/aio.h> |
29 | #include <linux/delay.h> | ||
29 | 30 | ||
30 | #include "gfs2.h" | 31 | #include "gfs2.h" |
31 | #include "incore.h" | 32 | #include "incore.h" |
@@ -979,9 +980,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
979 | unsigned int state; | 980 | unsigned int state; |
980 | int flags; | 981 | int flags; |
981 | int error = 0; | 982 | int error = 0; |
983 | int sleeptime; | ||
982 | 984 | ||
983 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; | 985 | state = (fl->fl_type == F_WRLCK) ? LM_ST_EXCLUSIVE : LM_ST_SHARED; |
984 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY) | GL_EXACT; | 986 | flags = (IS_SETLKW(cmd) ? 0 : LM_FLAG_TRY_1CB) | GL_EXACT; |
985 | 987 | ||
986 | mutex_lock(&fp->f_fl_mutex); | 988 | mutex_lock(&fp->f_fl_mutex); |
987 | 989 | ||
@@ -1001,7 +1003,14 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl) | |||
1001 | gfs2_holder_init(gl, state, flags, fl_gh); | 1003 | gfs2_holder_init(gl, state, flags, fl_gh); |
1002 | gfs2_glock_put(gl); | 1004 | gfs2_glock_put(gl); |
1003 | } | 1005 | } |
1004 | error = gfs2_glock_nq(fl_gh); | 1006 | for (sleeptime = 1; sleeptime <= 4; sleeptime <<= 1) { |
1007 | error = gfs2_glock_nq(fl_gh); | ||
1008 | if (error != GLR_TRYFAILED) | ||
1009 | break; | ||
1010 | fl_gh->gh_flags = LM_FLAG_TRY | GL_EXACT; | ||
1011 | fl_gh->gh_error = 0; | ||
1012 | msleep(sleeptime); | ||
1013 | } | ||
1005 | if (error) { | 1014 | if (error) { |
1006 | gfs2_holder_uninit(fl_gh); | 1015 | gfs2_holder_uninit(fl_gh); |
1007 | if (error == GLR_TRYFAILED) | 1016 | if (error == GLR_TRYFAILED) |
@@ -1024,7 +1033,7 @@ static void do_unflock(struct file *file, struct file_lock *fl) | |||
1024 | mutex_lock(&fp->f_fl_mutex); | 1033 | mutex_lock(&fp->f_fl_mutex); |
1025 | flock_lock_file_wait(file, fl); | 1034 | flock_lock_file_wait(file, fl); |
1026 | if (fl_gh->gh_gl) { | 1035 | if (fl_gh->gh_gl) { |
1027 | gfs2_glock_dq_wait(fl_gh); | 1036 | gfs2_glock_dq(fl_gh); |
1028 | gfs2_holder_uninit(fl_gh); | 1037 | gfs2_holder_uninit(fl_gh); |
1029 | } | 1038 | } |
1030 | mutex_unlock(&fp->f_fl_mutex); | 1039 | mutex_unlock(&fp->f_fl_mutex); |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 67d310c9ada3..39e7e9959b74 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -262,6 +262,9 @@ struct gfs2_holder { | |||
262 | unsigned long gh_ip; | 262 | unsigned long gh_ip; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /* Number of quota types we support */ | ||
266 | #define GFS2_MAXQUOTAS 2 | ||
267 | |||
265 | /* Resource group multi-block reservation, in order of appearance: | 268 | /* Resource group multi-block reservation, in order of appearance: |
266 | 269 | ||
267 | Step 1. Function prepares to write, allocates a mb, sets the size hint. | 270 | Step 1. Function prepares to write, allocates a mb, sets the size hint. |
@@ -282,8 +285,8 @@ struct gfs2_blkreserv { | |||
282 | u64 rs_inum; /* Inode number for reservation */ | 285 | u64 rs_inum; /* Inode number for reservation */ |
283 | 286 | ||
284 | /* ancillary quota stuff */ | 287 | /* ancillary quota stuff */ |
285 | struct gfs2_quota_data *rs_qa_qd[2 * MAXQUOTAS]; | 288 | struct gfs2_quota_data *rs_qa_qd[2 * GFS2_MAXQUOTAS]; |
286 | struct gfs2_holder rs_qa_qd_ghs[2 * MAXQUOTAS]; | 289 | struct gfs2_holder rs_qa_qd_ghs[2 * GFS2_MAXQUOTAS]; |
287 | unsigned int rs_qa_qd_num; | 290 | unsigned int rs_qa_qd_num; |
288 | }; | 291 | }; |
289 | 292 | ||
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index e62e59477884..fc8ac2ee0667 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -626,8 +626,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | |||
626 | if (!IS_ERR(inode)) { | 626 | if (!IS_ERR(inode)) { |
627 | d = d_splice_alias(inode, dentry); | 627 | d = d_splice_alias(inode, dentry); |
628 | error = PTR_ERR(d); | 628 | error = PTR_ERR(d); |
629 | if (IS_ERR(d)) | 629 | if (IS_ERR(d)) { |
630 | inode = ERR_CAST(d); | ||
630 | goto fail_gunlock; | 631 | goto fail_gunlock; |
632 | } | ||
631 | error = 0; | 633 | error = 0; |
632 | if (file) { | 634 | if (file) { |
633 | if (S_ISREG(inode->i_mode)) { | 635 | if (S_ISREG(inode->i_mode)) { |
@@ -840,8 +842,10 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
840 | int error; | 842 | int error; |
841 | 843 | ||
842 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); | 844 | inode = gfs2_lookupi(dir, &dentry->d_name, 0); |
843 | if (!inode) | 845 | if (inode == NULL) { |
846 | d_add(dentry, NULL); | ||
844 | return NULL; | 847 | return NULL; |
848 | } | ||
845 | if (IS_ERR(inode)) | 849 | if (IS_ERR(inode)) |
846 | return ERR_CAST(inode); | 850 | return ERR_CAST(inode); |
847 | 851 | ||
@@ -854,7 +858,6 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
854 | 858 | ||
855 | d = d_splice_alias(inode, dentry); | 859 | d = d_splice_alias(inode, dentry); |
856 | if (IS_ERR(d)) { | 860 | if (IS_ERR(d)) { |
857 | iput(inode); | ||
858 | gfs2_glock_dq_uninit(&gh); | 861 | gfs2_glock_dq_uninit(&gh); |
859 | return d; | 862 | return d; |
860 | } | 863 | } |
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 2607ff13d486..a346f56c4c6d 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c | |||
@@ -1294,7 +1294,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1294 | int val; | 1294 | int val; |
1295 | 1295 | ||
1296 | if (is_ancestor(root, sdp->sd_master_dir)) | 1296 | if (is_ancestor(root, sdp->sd_master_dir)) |
1297 | seq_printf(s, ",meta"); | 1297 | seq_puts(s, ",meta"); |
1298 | if (args->ar_lockproto[0]) | 1298 | if (args->ar_lockproto[0]) |
1299 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); | 1299 | seq_printf(s, ",lockproto=%s", args->ar_lockproto); |
1300 | if (args->ar_locktable[0]) | 1300 | if (args->ar_locktable[0]) |
@@ -1302,13 +1302,13 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1302 | if (args->ar_hostdata[0]) | 1302 | if (args->ar_hostdata[0]) |
1303 | seq_printf(s, ",hostdata=%s", args->ar_hostdata); | 1303 | seq_printf(s, ",hostdata=%s", args->ar_hostdata); |
1304 | if (args->ar_spectator) | 1304 | if (args->ar_spectator) |
1305 | seq_printf(s, ",spectator"); | 1305 | seq_puts(s, ",spectator"); |
1306 | if (args->ar_localflocks) | 1306 | if (args->ar_localflocks) |
1307 | seq_printf(s, ",localflocks"); | 1307 | seq_puts(s, ",localflocks"); |
1308 | if (args->ar_debug) | 1308 | if (args->ar_debug) |
1309 | seq_printf(s, ",debug"); | 1309 | seq_puts(s, ",debug"); |
1310 | if (args->ar_posix_acl) | 1310 | if (args->ar_posix_acl) |
1311 | seq_printf(s, ",acl"); | 1311 | seq_puts(s, ",acl"); |
1312 | if (args->ar_quota != GFS2_QUOTA_DEFAULT) { | 1312 | if (args->ar_quota != GFS2_QUOTA_DEFAULT) { |
1313 | char *state; | 1313 | char *state; |
1314 | switch (args->ar_quota) { | 1314 | switch (args->ar_quota) { |
@@ -1328,7 +1328,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1328 | seq_printf(s, ",quota=%s", state); | 1328 | seq_printf(s, ",quota=%s", state); |
1329 | } | 1329 | } |
1330 | if (args->ar_suiddir) | 1330 | if (args->ar_suiddir) |
1331 | seq_printf(s, ",suiddir"); | 1331 | seq_puts(s, ",suiddir"); |
1332 | if (args->ar_data != GFS2_DATA_DEFAULT) { | 1332 | if (args->ar_data != GFS2_DATA_DEFAULT) { |
1333 | char *state; | 1333 | char *state; |
1334 | switch (args->ar_data) { | 1334 | switch (args->ar_data) { |
@@ -1345,7 +1345,7 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1345 | seq_printf(s, ",data=%s", state); | 1345 | seq_printf(s, ",data=%s", state); |
1346 | } | 1346 | } |
1347 | if (args->ar_discard) | 1347 | if (args->ar_discard) |
1348 | seq_printf(s, ",discard"); | 1348 | seq_puts(s, ",discard"); |
1349 | val = sdp->sd_tune.gt_logd_secs; | 1349 | val = sdp->sd_tune.gt_logd_secs; |
1350 | if (val != 30) | 1350 | if (val != 30) |
1351 | seq_printf(s, ",commit=%d", val); | 1351 | seq_printf(s, ",commit=%d", val); |
@@ -1376,11 +1376,11 @@ static int gfs2_show_options(struct seq_file *s, struct dentry *root) | |||
1376 | seq_printf(s, ",errors=%s", state); | 1376 | seq_printf(s, ",errors=%s", state); |
1377 | } | 1377 | } |
1378 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) | 1378 | if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags)) |
1379 | seq_printf(s, ",nobarrier"); | 1379 | seq_puts(s, ",nobarrier"); |
1380 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) | 1380 | if (test_bit(SDF_DEMOTE, &sdp->sd_flags)) |
1381 | seq_printf(s, ",demote_interface_used"); | 1381 | seq_puts(s, ",demote_interface_used"); |
1382 | if (args->ar_rgrplvb) | 1382 | if (args->ar_rgrplvb) |
1383 | seq_printf(s, ",rgrplvb"); | 1383 | seq_puts(s, ",rgrplvb"); |
1384 | return 0; | 1384 | return 0; |
1385 | } | 1385 | } |
1386 | 1386 | ||
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 8f27c93f8d2e..ec9e082f9ecd 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c | |||
@@ -253,13 +253,11 @@ static int lockd_up_net(struct svc_serv *serv, struct net *net) | |||
253 | 253 | ||
254 | error = make_socks(serv, net); | 254 | error = make_socks(serv, net); |
255 | if (error < 0) | 255 | if (error < 0) |
256 | goto err_socks; | 256 | goto err_bind; |
257 | set_grace_period(net); | 257 | set_grace_period(net); |
258 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); | 258 | dprintk("lockd_up_net: per-net data created; net=%p\n", net); |
259 | return 0; | 259 | return 0; |
260 | 260 | ||
261 | err_socks: | ||
262 | svc_rpcb_cleanup(serv, net); | ||
263 | err_bind: | 261 | err_bind: |
264 | ln->nlmsvc_users--; | 262 | ln->nlmsvc_users--; |
265 | return error; | 263 | return error; |
diff --git a/fs/namei.c b/fs/namei.c index a996bb48dfab..a7b05bf82d31 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/device_cgroup.h> | 34 | #include <linux/device_cgroup.h> |
35 | #include <linux/fs_struct.h> | 35 | #include <linux/fs_struct.h> |
36 | #include <linux/posix_acl.h> | 36 | #include <linux/posix_acl.h> |
37 | #include <linux/hash.h> | ||
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
38 | 39 | ||
39 | #include "internal.h" | 40 | #include "internal.h" |
@@ -643,24 +644,22 @@ static int complete_walk(struct nameidata *nd) | |||
643 | 644 | ||
644 | static __always_inline void set_root(struct nameidata *nd) | 645 | static __always_inline void set_root(struct nameidata *nd) |
645 | { | 646 | { |
646 | if (!nd->root.mnt) | 647 | get_fs_root(current->fs, &nd->root); |
647 | get_fs_root(current->fs, &nd->root); | ||
648 | } | 648 | } |
649 | 649 | ||
650 | static int link_path_walk(const char *, struct nameidata *); | 650 | static int link_path_walk(const char *, struct nameidata *); |
651 | 651 | ||
652 | static __always_inline void set_root_rcu(struct nameidata *nd) | 652 | static __always_inline unsigned set_root_rcu(struct nameidata *nd) |
653 | { | 653 | { |
654 | if (!nd->root.mnt) { | 654 | struct fs_struct *fs = current->fs; |
655 | struct fs_struct *fs = current->fs; | 655 | unsigned seq, res; |
656 | unsigned seq; | ||
657 | 656 | ||
658 | do { | 657 | do { |
659 | seq = read_seqcount_begin(&fs->seq); | 658 | seq = read_seqcount_begin(&fs->seq); |
660 | nd->root = fs->root; | 659 | nd->root = fs->root; |
661 | nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq); | 660 | res = __read_seqcount_begin(&nd->root.dentry->d_seq); |
662 | } while (read_seqcount_retry(&fs->seq, seq)); | 661 | } while (read_seqcount_retry(&fs->seq, seq)); |
663 | } | 662 | return res; |
664 | } | 663 | } |
665 | 664 | ||
666 | static void path_put_conditional(struct path *path, struct nameidata *nd) | 665 | static void path_put_conditional(struct path *path, struct nameidata *nd) |
@@ -860,7 +859,8 @@ follow_link(struct path *link, struct nameidata *nd, void **p) | |||
860 | return PTR_ERR(s); | 859 | return PTR_ERR(s); |
861 | } | 860 | } |
862 | if (*s == '/') { | 861 | if (*s == '/') { |
863 | set_root(nd); | 862 | if (!nd->root.mnt) |
863 | set_root(nd); | ||
864 | path_put(&nd->path); | 864 | path_put(&nd->path); |
865 | nd->path = nd->root; | 865 | nd->path = nd->root; |
866 | path_get(&nd->root); | 866 | path_get(&nd->root); |
@@ -1137,13 +1137,15 @@ static bool __follow_mount_rcu(struct nameidata *nd, struct path *path, | |||
1137 | */ | 1137 | */ |
1138 | *inode = path->dentry->d_inode; | 1138 | *inode = path->dentry->d_inode; |
1139 | } | 1139 | } |
1140 | return read_seqretry(&mount_lock, nd->m_seq) && | 1140 | return !read_seqretry(&mount_lock, nd->m_seq) && |
1141 | !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); | 1141 | !(path->dentry->d_flags & DCACHE_NEED_AUTOMOUNT); |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | static int follow_dotdot_rcu(struct nameidata *nd) | 1144 | static int follow_dotdot_rcu(struct nameidata *nd) |
1145 | { | 1145 | { |
1146 | set_root_rcu(nd); | 1146 | struct inode *inode = nd->inode; |
1147 | if (!nd->root.mnt) | ||
1148 | set_root_rcu(nd); | ||
1147 | 1149 | ||
1148 | while (1) { | 1150 | while (1) { |
1149 | if (nd->path.dentry == nd->root.dentry && | 1151 | if (nd->path.dentry == nd->root.dentry && |
@@ -1155,6 +1157,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1155 | struct dentry *parent = old->d_parent; | 1157 | struct dentry *parent = old->d_parent; |
1156 | unsigned seq; | 1158 | unsigned seq; |
1157 | 1159 | ||
1160 | inode = parent->d_inode; | ||
1158 | seq = read_seqcount_begin(&parent->d_seq); | 1161 | seq = read_seqcount_begin(&parent->d_seq); |
1159 | if (read_seqcount_retry(&old->d_seq, nd->seq)) | 1162 | if (read_seqcount_retry(&old->d_seq, nd->seq)) |
1160 | goto failed; | 1163 | goto failed; |
@@ -1164,6 +1167,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1164 | } | 1167 | } |
1165 | if (!follow_up_rcu(&nd->path)) | 1168 | if (!follow_up_rcu(&nd->path)) |
1166 | break; | 1169 | break; |
1170 | inode = nd->path.dentry->d_inode; | ||
1167 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); | 1171 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); |
1168 | } | 1172 | } |
1169 | while (d_mountpoint(nd->path.dentry)) { | 1173 | while (d_mountpoint(nd->path.dentry)) { |
@@ -1173,11 +1177,12 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1173 | break; | 1177 | break; |
1174 | nd->path.mnt = &mounted->mnt; | 1178 | nd->path.mnt = &mounted->mnt; |
1175 | nd->path.dentry = mounted->mnt.mnt_root; | 1179 | nd->path.dentry = mounted->mnt.mnt_root; |
1180 | inode = nd->path.dentry->d_inode; | ||
1176 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); | 1181 | nd->seq = read_seqcount_begin(&nd->path.dentry->d_seq); |
1177 | if (!read_seqretry(&mount_lock, nd->m_seq)) | 1182 | if (read_seqretry(&mount_lock, nd->m_seq)) |
1178 | goto failed; | 1183 | goto failed; |
1179 | } | 1184 | } |
1180 | nd->inode = nd->path.dentry->d_inode; | 1185 | nd->inode = inode; |
1181 | return 0; | 1186 | return 0; |
1182 | 1187 | ||
1183 | failed: | 1188 | failed: |
@@ -1256,7 +1261,8 @@ static void follow_mount(struct path *path) | |||
1256 | 1261 | ||
1257 | static void follow_dotdot(struct nameidata *nd) | 1262 | static void follow_dotdot(struct nameidata *nd) |
1258 | { | 1263 | { |
1259 | set_root(nd); | 1264 | if (!nd->root.mnt) |
1265 | set_root(nd); | ||
1260 | 1266 | ||
1261 | while(1) { | 1267 | while(1) { |
1262 | struct dentry *old = nd->path.dentry; | 1268 | struct dentry *old = nd->path.dentry; |
@@ -1634,8 +1640,7 @@ static inline int nested_symlink(struct path *path, struct nameidata *nd) | |||
1634 | 1640 | ||
1635 | static inline unsigned int fold_hash(unsigned long hash) | 1641 | static inline unsigned int fold_hash(unsigned long hash) |
1636 | { | 1642 | { |
1637 | hash += hash >> (8*sizeof(int)); | 1643 | return hash_64(hash, 32); |
1638 | return hash; | ||
1639 | } | 1644 | } |
1640 | 1645 | ||
1641 | #else /* 32-bit case */ | 1646 | #else /* 32-bit case */ |
@@ -1669,9 +1674,9 @@ EXPORT_SYMBOL(full_name_hash); | |||
1669 | 1674 | ||
1670 | /* | 1675 | /* |
1671 | * Calculate the length and hash of the path component, and | 1676 | * Calculate the length and hash of the path component, and |
1672 | * return the length of the component; | 1677 | * return the "hash_len" as the result. |
1673 | */ | 1678 | */ |
1674 | static inline unsigned long hash_name(const char *name, unsigned int *hashp) | 1679 | static inline u64 hash_name(const char *name) |
1675 | { | 1680 | { |
1676 | unsigned long a, b, adata, bdata, mask, hash, len; | 1681 | unsigned long a, b, adata, bdata, mask, hash, len; |
1677 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; | 1682 | const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
@@ -1691,9 +1696,8 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
1691 | mask = create_zero_mask(adata | bdata); | 1696 | mask = create_zero_mask(adata | bdata); |
1692 | 1697 | ||
1693 | hash += a & zero_bytemask(mask); | 1698 | hash += a & zero_bytemask(mask); |
1694 | *hashp = fold_hash(hash); | 1699 | len += find_zero(mask); |
1695 | 1700 | return hashlen_create(fold_hash(hash), len); | |
1696 | return len + find_zero(mask); | ||
1697 | } | 1701 | } |
1698 | 1702 | ||
1699 | #else | 1703 | #else |
@@ -1711,7 +1715,7 @@ EXPORT_SYMBOL(full_name_hash); | |||
1711 | * We know there's a real path component here of at least | 1715 | * We know there's a real path component here of at least |
1712 | * one character. | 1716 | * one character. |
1713 | */ | 1717 | */ |
1714 | static inline unsigned long hash_name(const char *name, unsigned int *hashp) | 1718 | static inline u64 hash_name(const char *name) |
1715 | { | 1719 | { |
1716 | unsigned long hash = init_name_hash(); | 1720 | unsigned long hash = init_name_hash(); |
1717 | unsigned long len = 0, c; | 1721 | unsigned long len = 0, c; |
@@ -1722,8 +1726,7 @@ static inline unsigned long hash_name(const char *name, unsigned int *hashp) | |||
1722 | hash = partial_name_hash(c, hash); | 1726 | hash = partial_name_hash(c, hash); |
1723 | c = (unsigned char)name[len]; | 1727 | c = (unsigned char)name[len]; |
1724 | } while (c && c != '/'); | 1728 | } while (c && c != '/'); |
1725 | *hashp = end_name_hash(hash); | 1729 | return hashlen_create(end_name_hash(hash), len); |
1726 | return len; | ||
1727 | } | 1730 | } |
1728 | 1731 | ||
1729 | #endif | 1732 | #endif |
@@ -1748,20 +1751,17 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1748 | 1751 | ||
1749 | /* At this point we know we have a real path component. */ | 1752 | /* At this point we know we have a real path component. */ |
1750 | for(;;) { | 1753 | for(;;) { |
1751 | struct qstr this; | 1754 | u64 hash_len; |
1752 | long len; | ||
1753 | int type; | 1755 | int type; |
1754 | 1756 | ||
1755 | err = may_lookup(nd); | 1757 | err = may_lookup(nd); |
1756 | if (err) | 1758 | if (err) |
1757 | break; | 1759 | break; |
1758 | 1760 | ||
1759 | len = hash_name(name, &this.hash); | 1761 | hash_len = hash_name(name); |
1760 | this.name = name; | ||
1761 | this.len = len; | ||
1762 | 1762 | ||
1763 | type = LAST_NORM; | 1763 | type = LAST_NORM; |
1764 | if (name[0] == '.') switch (len) { | 1764 | if (name[0] == '.') switch (hashlen_len(hash_len)) { |
1765 | case 2: | 1765 | case 2: |
1766 | if (name[1] == '.') { | 1766 | if (name[1] == '.') { |
1767 | type = LAST_DOTDOT; | 1767 | type = LAST_DOTDOT; |
@@ -1775,29 +1775,32 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1775 | struct dentry *parent = nd->path.dentry; | 1775 | struct dentry *parent = nd->path.dentry; |
1776 | nd->flags &= ~LOOKUP_JUMPED; | 1776 | nd->flags &= ~LOOKUP_JUMPED; |
1777 | if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { | 1777 | if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { |
1778 | struct qstr this = { { .hash_len = hash_len }, .name = name }; | ||
1778 | err = parent->d_op->d_hash(parent, &this); | 1779 | err = parent->d_op->d_hash(parent, &this); |
1779 | if (err < 0) | 1780 | if (err < 0) |
1780 | break; | 1781 | break; |
1782 | hash_len = this.hash_len; | ||
1783 | name = this.name; | ||
1781 | } | 1784 | } |
1782 | } | 1785 | } |
1783 | 1786 | ||
1784 | nd->last = this; | 1787 | nd->last.hash_len = hash_len; |
1788 | nd->last.name = name; | ||
1785 | nd->last_type = type; | 1789 | nd->last_type = type; |
1786 | 1790 | ||
1787 | if (!name[len]) | 1791 | name += hashlen_len(hash_len); |
1792 | if (!*name) | ||
1788 | return 0; | 1793 | return 0; |
1789 | /* | 1794 | /* |
1790 | * If it wasn't NUL, we know it was '/'. Skip that | 1795 | * If it wasn't NUL, we know it was '/'. Skip that |
1791 | * slash, and continue until no more slashes. | 1796 | * slash, and continue until no more slashes. |
1792 | */ | 1797 | */ |
1793 | do { | 1798 | do { |
1794 | len++; | 1799 | name++; |
1795 | } while (unlikely(name[len] == '/')); | 1800 | } while (unlikely(*name == '/')); |
1796 | if (!name[len]) | 1801 | if (!*name) |
1797 | return 0; | 1802 | return 0; |
1798 | 1803 | ||
1799 | name += len; | ||
1800 | |||
1801 | err = walk_component(nd, &next, LOOKUP_FOLLOW); | 1804 | err = walk_component(nd, &next, LOOKUP_FOLLOW); |
1802 | if (err < 0) | 1805 | if (err < 0) |
1803 | return err; | 1806 | return err; |
@@ -1852,7 +1855,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, | |||
1852 | if (*name=='/') { | 1855 | if (*name=='/') { |
1853 | if (flags & LOOKUP_RCU) { | 1856 | if (flags & LOOKUP_RCU) { |
1854 | rcu_read_lock(); | 1857 | rcu_read_lock(); |
1855 | set_root_rcu(nd); | 1858 | nd->seq = set_root_rcu(nd); |
1856 | } else { | 1859 | } else { |
1857 | set_root(nd); | 1860 | set_root(nd); |
1858 | path_get(&nd->root); | 1861 | path_get(&nd->root); |
@@ -1903,7 +1906,14 @@ static int path_init(int dfd, const char *name, unsigned int flags, | |||
1903 | } | 1906 | } |
1904 | 1907 | ||
1905 | nd->inode = nd->path.dentry->d_inode; | 1908 | nd->inode = nd->path.dentry->d_inode; |
1906 | return 0; | 1909 | if (!(flags & LOOKUP_RCU)) |
1910 | return 0; | ||
1911 | if (likely(!read_seqcount_retry(&nd->path.dentry->d_seq, nd->seq))) | ||
1912 | return 0; | ||
1913 | if (!(nd->flags & LOOKUP_ROOT)) | ||
1914 | nd->root.mnt = NULL; | ||
1915 | rcu_read_unlock(); | ||
1916 | return -ECHILD; | ||
1907 | } | 1917 | } |
1908 | 1918 | ||
1909 | static inline int lookup_last(struct nameidata *nd, struct path *path) | 1919 | static inline int lookup_last(struct nameidata *nd, struct path *path) |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 1c5ff6d58385..6a4f3666e273 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -1412,24 +1412,18 @@ int nfs_fs_proc_net_init(struct net *net) | |||
1412 | p = proc_create("volumes", S_IFREG|S_IRUGO, | 1412 | p = proc_create("volumes", S_IFREG|S_IRUGO, |
1413 | nn->proc_nfsfs, &nfs_volume_list_fops); | 1413 | nn->proc_nfsfs, &nfs_volume_list_fops); |
1414 | if (!p) | 1414 | if (!p) |
1415 | goto error_2; | 1415 | goto error_1; |
1416 | return 0; | 1416 | return 0; |
1417 | 1417 | ||
1418 | error_2: | ||
1419 | remove_proc_entry("servers", nn->proc_nfsfs); | ||
1420 | error_1: | 1418 | error_1: |
1421 | remove_proc_entry("fs/nfsfs", NULL); | 1419 | remove_proc_subtree("nfsfs", net->proc_net); |
1422 | error_0: | 1420 | error_0: |
1423 | return -ENOMEM; | 1421 | return -ENOMEM; |
1424 | } | 1422 | } |
1425 | 1423 | ||
1426 | void nfs_fs_proc_net_exit(struct net *net) | 1424 | void nfs_fs_proc_net_exit(struct net *net) |
1427 | { | 1425 | { |
1428 | struct nfs_net *nn = net_generic(net, nfs_net_id); | 1426 | remove_proc_subtree("nfsfs", net->proc_net); |
1429 | |||
1430 | remove_proc_entry("volumes", nn->proc_nfsfs); | ||
1431 | remove_proc_entry("servers", nn->proc_nfsfs); | ||
1432 | remove_proc_entry("fs/nfsfs", NULL); | ||
1433 | } | 1427 | } |
1434 | 1428 | ||
1435 | /* | 1429 | /* |
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 1359c4a27393..90978075f730 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c | |||
@@ -1269,11 +1269,12 @@ filelayout_search_commit_reqs(struct nfs_commit_info *cinfo, struct page *page) | |||
1269 | static void filelayout_retry_commit(struct nfs_commit_info *cinfo, int idx) | 1269 | static void filelayout_retry_commit(struct nfs_commit_info *cinfo, int idx) |
1270 | { | 1270 | { |
1271 | struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; | 1271 | struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; |
1272 | struct pnfs_commit_bucket *bucket = fl_cinfo->buckets; | 1272 | struct pnfs_commit_bucket *bucket; |
1273 | struct pnfs_layout_segment *freeme; | 1273 | struct pnfs_layout_segment *freeme; |
1274 | int i; | 1274 | int i; |
1275 | 1275 | ||
1276 | for (i = idx; i < fl_cinfo->nbuckets; i++, bucket++) { | 1276 | for (i = idx; i < fl_cinfo->nbuckets; i++) { |
1277 | bucket = &fl_cinfo->buckets[i]; | ||
1277 | if (list_empty(&bucket->committing)) | 1278 | if (list_empty(&bucket->committing)) |
1278 | continue; | 1279 | continue; |
1279 | nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); | 1280 | nfs_retry_commit(&bucket->committing, bucket->clseg, cinfo); |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 92193eddb41d..a8b855ab4e22 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -130,16 +130,15 @@ enum { | |||
130 | */ | 130 | */ |
131 | 131 | ||
132 | struct nfs4_lock_state { | 132 | struct nfs4_lock_state { |
133 | struct list_head ls_locks; /* Other lock stateids */ | 133 | struct list_head ls_locks; /* Other lock stateids */ |
134 | struct nfs4_state * ls_state; /* Pointer to open state */ | 134 | struct nfs4_state * ls_state; /* Pointer to open state */ |
135 | #define NFS_LOCK_INITIALIZED 0 | 135 | #define NFS_LOCK_INITIALIZED 0 |
136 | #define NFS_LOCK_LOST 1 | 136 | #define NFS_LOCK_LOST 1 |
137 | unsigned long ls_flags; | 137 | unsigned long ls_flags; |
138 | struct nfs_seqid_counter ls_seqid; | 138 | struct nfs_seqid_counter ls_seqid; |
139 | nfs4_stateid ls_stateid; | 139 | nfs4_stateid ls_stateid; |
140 | atomic_t ls_count; | 140 | atomic_t ls_count; |
141 | fl_owner_t ls_owner; | 141 | fl_owner_t ls_owner; |
142 | struct work_struct ls_release; | ||
143 | }; | 142 | }; |
144 | 143 | ||
145 | /* bits for nfs4_state->flags */ | 144 | /* bits for nfs4_state->flags */ |
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 53e435a95260..ffdb28d86cf8 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -482,6 +482,16 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
482 | 482 | ||
483 | spin_lock(&nn->nfs_client_lock); | 483 | spin_lock(&nn->nfs_client_lock); |
484 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | 484 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { |
485 | |||
486 | if (pos->rpc_ops != new->rpc_ops) | ||
487 | continue; | ||
488 | |||
489 | if (pos->cl_proto != new->cl_proto) | ||
490 | continue; | ||
491 | |||
492 | if (pos->cl_minorversion != new->cl_minorversion) | ||
493 | continue; | ||
494 | |||
485 | /* If "pos" isn't marked ready, we can't trust the | 495 | /* If "pos" isn't marked ready, we can't trust the |
486 | * remaining fields in "pos" */ | 496 | * remaining fields in "pos" */ |
487 | if (pos->cl_cons_state > NFS_CS_READY) { | 497 | if (pos->cl_cons_state > NFS_CS_READY) { |
@@ -501,15 +511,6 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
501 | if (pos->cl_cons_state != NFS_CS_READY) | 511 | if (pos->cl_cons_state != NFS_CS_READY) |
502 | continue; | 512 | continue; |
503 | 513 | ||
504 | if (pos->rpc_ops != new->rpc_ops) | ||
505 | continue; | ||
506 | |||
507 | if (pos->cl_proto != new->cl_proto) | ||
508 | continue; | ||
509 | |||
510 | if (pos->cl_minorversion != new->cl_minorversion) | ||
511 | continue; | ||
512 | |||
513 | if (pos->cl_clientid != new->cl_clientid) | 514 | if (pos->cl_clientid != new->cl_clientid) |
514 | continue; | 515 | continue; |
515 | 516 | ||
@@ -622,6 +623,16 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
622 | 623 | ||
623 | spin_lock(&nn->nfs_client_lock); | 624 | spin_lock(&nn->nfs_client_lock); |
624 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { | 625 | list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) { |
626 | |||
627 | if (pos->rpc_ops != new->rpc_ops) | ||
628 | continue; | ||
629 | |||
630 | if (pos->cl_proto != new->cl_proto) | ||
631 | continue; | ||
632 | |||
633 | if (pos->cl_minorversion != new->cl_minorversion) | ||
634 | continue; | ||
635 | |||
625 | /* If "pos" isn't marked ready, we can't trust the | 636 | /* If "pos" isn't marked ready, we can't trust the |
626 | * remaining fields in "pos", especially the client | 637 | * remaining fields in "pos", especially the client |
627 | * ID and serverowner fields. Wait for CREATE_SESSION | 638 | * ID and serverowner fields. Wait for CREATE_SESSION |
@@ -647,15 +658,6 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
647 | if (pos->cl_cons_state != NFS_CS_READY) | 658 | if (pos->cl_cons_state != NFS_CS_READY) |
648 | continue; | 659 | continue; |
649 | 660 | ||
650 | if (pos->rpc_ops != new->rpc_ops) | ||
651 | continue; | ||
652 | |||
653 | if (pos->cl_proto != new->cl_proto) | ||
654 | continue; | ||
655 | |||
656 | if (pos->cl_minorversion != new->cl_minorversion) | ||
657 | continue; | ||
658 | |||
659 | if (!nfs4_match_clientids(pos, new)) | 661 | if (!nfs4_match_clientids(pos, new)) |
660 | continue; | 662 | continue; |
661 | 663 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 7dd8aca31c29..6ca0c8e7a945 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2226,9 +2226,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
2226 | ret = _nfs4_proc_open(opendata); | 2226 | ret = _nfs4_proc_open(opendata); |
2227 | if (ret != 0) { | 2227 | if (ret != 0) { |
2228 | if (ret == -ENOENT) { | 2228 | if (ret == -ENOENT) { |
2229 | d_drop(opendata->dentry); | 2229 | dentry = opendata->dentry; |
2230 | d_add(opendata->dentry, NULL); | 2230 | if (dentry->d_inode) |
2231 | nfs_set_verifier(opendata->dentry, | 2231 | d_delete(dentry); |
2232 | else if (d_unhashed(dentry)) | ||
2233 | d_add(dentry, NULL); | ||
2234 | |||
2235 | nfs_set_verifier(dentry, | ||
2232 | nfs_save_change_attribute(opendata->dir->d_inode)); | 2236 | nfs_save_change_attribute(opendata->dir->d_inode)); |
2233 | } | 2237 | } |
2234 | goto out; | 2238 | goto out; |
@@ -2614,23 +2618,23 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2614 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); | 2618 | is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags); |
2615 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); | 2619 | is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags); |
2616 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); | 2620 | is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags); |
2617 | /* Calculate the current open share mode */ | ||
2618 | calldata->arg.fmode = 0; | ||
2619 | if (is_rdonly || is_rdwr) | ||
2620 | calldata->arg.fmode |= FMODE_READ; | ||
2621 | if (is_wronly || is_rdwr) | ||
2622 | calldata->arg.fmode |= FMODE_WRITE; | ||
2623 | /* Calculate the change in open mode */ | 2621 | /* Calculate the change in open mode */ |
2622 | calldata->arg.fmode = 0; | ||
2624 | if (state->n_rdwr == 0) { | 2623 | if (state->n_rdwr == 0) { |
2625 | if (state->n_rdonly == 0) { | 2624 | if (state->n_rdonly == 0) |
2626 | call_close |= is_rdonly || is_rdwr; | 2625 | call_close |= is_rdonly; |
2627 | calldata->arg.fmode &= ~FMODE_READ; | 2626 | else if (is_rdonly) |
2628 | } | 2627 | calldata->arg.fmode |= FMODE_READ; |
2629 | if (state->n_wronly == 0) { | 2628 | if (state->n_wronly == 0) |
2630 | call_close |= is_wronly || is_rdwr; | 2629 | call_close |= is_wronly; |
2631 | calldata->arg.fmode &= ~FMODE_WRITE; | 2630 | else if (is_wronly) |
2632 | } | 2631 | calldata->arg.fmode |= FMODE_WRITE; |
2633 | } | 2632 | } else if (is_rdwr) |
2633 | calldata->arg.fmode |= FMODE_READ|FMODE_WRITE; | ||
2634 | |||
2635 | if (calldata->arg.fmode == 0) | ||
2636 | call_close |= is_rdwr; | ||
2637 | |||
2634 | if (!nfs4_valid_open_stateid(state)) | 2638 | if (!nfs4_valid_open_stateid(state)) |
2635 | call_close = 0; | 2639 | call_close = 0; |
2636 | spin_unlock(&state->owner->so_lock); | 2640 | spin_unlock(&state->owner->so_lock); |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a043f618cd5a..22fe35104c0c 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -799,18 +799,6 @@ __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner) | |||
799 | return NULL; | 799 | return NULL; |
800 | } | 800 | } |
801 | 801 | ||
802 | static void | ||
803 | free_lock_state_work(struct work_struct *work) | ||
804 | { | ||
805 | struct nfs4_lock_state *lsp = container_of(work, | ||
806 | struct nfs4_lock_state, ls_release); | ||
807 | struct nfs4_state *state = lsp->ls_state; | ||
808 | struct nfs_server *server = state->owner->so_server; | ||
809 | struct nfs_client *clp = server->nfs_client; | ||
810 | |||
811 | clp->cl_mvops->free_lock_state(server, lsp); | ||
812 | } | ||
813 | |||
814 | /* | 802 | /* |
815 | * Return a compatible lock_state. If no initialized lock_state structure | 803 | * Return a compatible lock_state. If no initialized lock_state structure |
816 | * exists, return an uninitialized one. | 804 | * exists, return an uninitialized one. |
@@ -832,7 +820,6 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f | |||
832 | if (lsp->ls_seqid.owner_id < 0) | 820 | if (lsp->ls_seqid.owner_id < 0) |
833 | goto out_free; | 821 | goto out_free; |
834 | INIT_LIST_HEAD(&lsp->ls_locks); | 822 | INIT_LIST_HEAD(&lsp->ls_locks); |
835 | INIT_WORK(&lsp->ls_release, free_lock_state_work); | ||
836 | return lsp; | 823 | return lsp; |
837 | out_free: | 824 | out_free: |
838 | kfree(lsp); | 825 | kfree(lsp); |
@@ -896,12 +883,13 @@ void nfs4_put_lock_state(struct nfs4_lock_state *lsp) | |||
896 | if (list_empty(&state->lock_states)) | 883 | if (list_empty(&state->lock_states)) |
897 | clear_bit(LK_STATE_IN_USE, &state->flags); | 884 | clear_bit(LK_STATE_IN_USE, &state->flags); |
898 | spin_unlock(&state->state_lock); | 885 | spin_unlock(&state->state_lock); |
899 | if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags)) | 886 | server = state->owner->so_server; |
900 | queue_work(nfsiod_workqueue, &lsp->ls_release); | 887 | if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags)) { |
901 | else { | 888 | struct nfs_client *clp = server->nfs_client; |
902 | server = state->owner->so_server; | 889 | |
890 | clp->cl_mvops->free_lock_state(server, lsp); | ||
891 | } else | ||
903 | nfs4_free_lock_state(server, lsp); | 892 | nfs4_free_lock_state(server, lsp); |
904 | } | ||
905 | } | 893 | } |
906 | 894 | ||
907 | static void nfs4_fl_copy_lock(struct file_lock *dst, struct file_lock *src) | 895 | static void nfs4_fl_copy_lock(struct file_lock *dst, struct file_lock *src) |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index f9821ce6658a..e94457c33ad6 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -2657,6 +2657,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, | |||
2657 | struct xdr_stream *xdr = cd->xdr; | 2657 | struct xdr_stream *xdr = cd->xdr; |
2658 | int start_offset = xdr->buf->len; | 2658 | int start_offset = xdr->buf->len; |
2659 | int cookie_offset; | 2659 | int cookie_offset; |
2660 | u32 name_and_cookie; | ||
2660 | int entry_bytes; | 2661 | int entry_bytes; |
2661 | __be32 nfserr = nfserr_toosmall; | 2662 | __be32 nfserr = nfserr_toosmall; |
2662 | __be64 wire_offset; | 2663 | __be64 wire_offset; |
@@ -2718,7 +2719,14 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, | |||
2718 | cd->rd_maxcount -= entry_bytes; | 2719 | cd->rd_maxcount -= entry_bytes; |
2719 | if (!cd->rd_dircount) | 2720 | if (!cd->rd_dircount) |
2720 | goto fail; | 2721 | goto fail; |
2721 | cd->rd_dircount--; | 2722 | /* |
2723 | * RFC 3530 14.2.24 describes rd_dircount as only a "hint", so | ||
2724 | * let's always let through the first entry, at least: | ||
2725 | */ | ||
2726 | name_and_cookie = 4 * XDR_QUADLEN(namlen) + 8; | ||
2727 | if (name_and_cookie > cd->rd_dircount && cd->cookie_offset) | ||
2728 | goto fail; | ||
2729 | cd->rd_dircount -= min(cd->rd_dircount, name_and_cookie); | ||
2722 | cd->cookie_offset = cookie_offset; | 2730 | cd->cookie_offset = cookie_offset; |
2723 | skip_entry: | 2731 | skip_entry: |
2724 | cd->common.err = nfs_ok; | 2732 | cd->common.err = nfs_ok; |
@@ -3321,6 +3329,10 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | |||
3321 | } | 3329 | } |
3322 | maxcount = min_t(int, maxcount-16, bytes_left); | 3330 | maxcount = min_t(int, maxcount-16, bytes_left); |
3323 | 3331 | ||
3332 | /* RFC 3530 14.2.24 allows us to ignore dircount when it's 0: */ | ||
3333 | if (!readdir->rd_dircount) | ||
3334 | readdir->rd_dircount = INT_MAX; | ||
3335 | |||
3324 | readdir->xdr = xdr; | 3336 | readdir->xdr = xdr; |
3325 | readdir->rd_maxcount = maxcount; | 3337 | readdir->rd_maxcount = maxcount; |
3326 | readdir->common.err = 0; | 3338 | readdir->common.err = 0; |
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c index 238a5930cb3c..9d7e2b9659cb 100644 --- a/fs/notify/fdinfo.c +++ b/fs/notify/fdinfo.c | |||
@@ -42,7 +42,7 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | |||
42 | { | 42 | { |
43 | struct { | 43 | struct { |
44 | struct file_handle handle; | 44 | struct file_handle handle; |
45 | u8 pad[64]; | 45 | u8 pad[MAX_HANDLE_SZ]; |
46 | } f; | 46 | } f; |
47 | int size, ret, i; | 47 | int size, ret, i; |
48 | 48 | ||
@@ -50,7 +50,7 @@ static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | |||
50 | size = f.handle.handle_bytes >> 2; | 50 | size = f.handle.handle_bytes >> 2; |
51 | 51 | ||
52 | ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); | 52 | ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); |
53 | if ((ret == 255) || (ret == -ENOSPC)) { | 53 | if ((ret == FILEID_INVALID) || (ret < 0)) { |
54 | WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); | 54 | WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 6eaf5edf1ea1..e77db621ec89 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -45,7 +45,7 @@ void udf_free_inode(struct inode *inode) | |||
45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); | 45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); |
46 | } | 46 | } |
47 | 47 | ||
48 | struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | 48 | struct inode *udf_new_inode(struct inode *dir, umode_t mode) |
49 | { | 49 | { |
50 | struct super_block *sb = dir->i_sb; | 50 | struct super_block *sb = dir->i_sb; |
51 | struct udf_sb_info *sbi = UDF_SB(sb); | 51 | struct udf_sb_info *sbi = UDF_SB(sb); |
@@ -55,14 +55,12 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
55 | struct udf_inode_info *iinfo; | 55 | struct udf_inode_info *iinfo; |
56 | struct udf_inode_info *dinfo = UDF_I(dir); | 56 | struct udf_inode_info *dinfo = UDF_I(dir); |
57 | struct logicalVolIntegrityDescImpUse *lvidiu; | 57 | struct logicalVolIntegrityDescImpUse *lvidiu; |
58 | int err; | ||
58 | 59 | ||
59 | inode = new_inode(sb); | 60 | inode = new_inode(sb); |
60 | 61 | ||
61 | if (!inode) { | 62 | if (!inode) |
62 | *err = -ENOMEM; | 63 | return ERR_PTR(-ENOMEM); |
63 | return NULL; | ||
64 | } | ||
65 | *err = -ENOSPC; | ||
66 | 64 | ||
67 | iinfo = UDF_I(inode); | 65 | iinfo = UDF_I(inode); |
68 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { | 66 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { |
@@ -80,21 +78,22 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
80 | } | 78 | } |
81 | if (!iinfo->i_ext.i_data) { | 79 | if (!iinfo->i_ext.i_data) { |
82 | iput(inode); | 80 | iput(inode); |
83 | *err = -ENOMEM; | 81 | return ERR_PTR(-ENOMEM); |
84 | return NULL; | ||
85 | } | 82 | } |
86 | 83 | ||
84 | err = -ENOSPC; | ||
87 | block = udf_new_block(dir->i_sb, NULL, | 85 | block = udf_new_block(dir->i_sb, NULL, |
88 | dinfo->i_location.partitionReferenceNum, | 86 | dinfo->i_location.partitionReferenceNum, |
89 | start, err); | 87 | start, &err); |
90 | if (*err) { | 88 | if (err) { |
91 | iput(inode); | 89 | iput(inode); |
92 | return NULL; | 90 | return ERR_PTR(err); |
93 | } | 91 | } |
94 | 92 | ||
95 | lvidiu = udf_sb_lvidiu(sb); | 93 | lvidiu = udf_sb_lvidiu(sb); |
96 | if (lvidiu) { | 94 | if (lvidiu) { |
97 | iinfo->i_unique = lvid_get_unique_id(sb); | 95 | iinfo->i_unique = lvid_get_unique_id(sb); |
96 | inode->i_generation = iinfo->i_unique; | ||
98 | mutex_lock(&sbi->s_alloc_mutex); | 97 | mutex_lock(&sbi->s_alloc_mutex); |
99 | if (S_ISDIR(mode)) | 98 | if (S_ISDIR(mode)) |
100 | le32_add_cpu(&lvidiu->numDirs, 1); | 99 | le32_add_cpu(&lvidiu->numDirs, 1); |
@@ -123,9 +122,12 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
123 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 122 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
124 | inode->i_mtime = inode->i_atime = inode->i_ctime = | 123 | inode->i_mtime = inode->i_atime = inode->i_ctime = |
125 | iinfo->i_crtime = current_fs_time(inode->i_sb); | 124 | iinfo->i_crtime = current_fs_time(inode->i_sb); |
126 | insert_inode_hash(inode); | 125 | if (unlikely(insert_inode_locked(inode) < 0)) { |
126 | make_bad_inode(inode); | ||
127 | iput(inode); | ||
128 | return ERR_PTR(-EIO); | ||
129 | } | ||
127 | mark_inode_dirty(inode); | 130 | mark_inode_dirty(inode); |
128 | 131 | ||
129 | *err = 0; | ||
130 | return inode; | 132 | return inode; |
131 | } | 133 | } |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 236cd48184c2..08598843288f 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -51,7 +51,6 @@ MODULE_LICENSE("GPL"); | |||
51 | 51 | ||
52 | static umode_t udf_convert_permissions(struct fileEntry *); | 52 | static umode_t udf_convert_permissions(struct fileEntry *); |
53 | static int udf_update_inode(struct inode *, int); | 53 | static int udf_update_inode(struct inode *, int); |
54 | static void udf_fill_inode(struct inode *, struct buffer_head *); | ||
55 | static int udf_sync_inode(struct inode *inode); | 54 | static int udf_sync_inode(struct inode *inode); |
56 | static int udf_alloc_i_data(struct inode *inode, size_t size); | 55 | static int udf_alloc_i_data(struct inode *inode, size_t size); |
57 | static sector_t inode_getblk(struct inode *, sector_t, int *, int *); | 56 | static sector_t inode_getblk(struct inode *, sector_t, int *, int *); |
@@ -1271,12 +1270,33 @@ update_time: | |||
1271 | return 0; | 1270 | return 0; |
1272 | } | 1271 | } |
1273 | 1272 | ||
1274 | static void __udf_read_inode(struct inode *inode) | 1273 | /* |
1274 | * Maximum length of linked list formed by ICB hierarchy. The chosen number is | ||
1275 | * arbitrary - just that we hopefully don't limit any real use of rewritten | ||
1276 | * inode on write-once media but avoid looping for too long on corrupted media. | ||
1277 | */ | ||
1278 | #define UDF_MAX_ICB_NESTING 1024 | ||
1279 | |||
1280 | static int udf_read_inode(struct inode *inode) | ||
1275 | { | 1281 | { |
1276 | struct buffer_head *bh = NULL; | 1282 | struct buffer_head *bh = NULL; |
1277 | struct fileEntry *fe; | 1283 | struct fileEntry *fe; |
1284 | struct extendedFileEntry *efe; | ||
1278 | uint16_t ident; | 1285 | uint16_t ident; |
1279 | struct udf_inode_info *iinfo = UDF_I(inode); | 1286 | struct udf_inode_info *iinfo = UDF_I(inode); |
1287 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | ||
1288 | struct kernel_lb_addr *iloc = &iinfo->i_location; | ||
1289 | unsigned int link_count; | ||
1290 | unsigned int indirections = 0; | ||
1291 | int ret = -EIO; | ||
1292 | |||
1293 | reread: | ||
1294 | if (iloc->logicalBlockNum >= | ||
1295 | sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) { | ||
1296 | udf_debug("block=%d, partition=%d out of range\n", | ||
1297 | iloc->logicalBlockNum, iloc->partitionReferenceNum); | ||
1298 | return -EIO; | ||
1299 | } | ||
1280 | 1300 | ||
1281 | /* | 1301 | /* |
1282 | * Set defaults, but the inode is still incomplete! | 1302 | * Set defaults, but the inode is still incomplete! |
@@ -1290,78 +1310,54 @@ static void __udf_read_inode(struct inode *inode) | |||
1290 | * i_nlink = 1 | 1310 | * i_nlink = 1 |
1291 | * i_op = NULL; | 1311 | * i_op = NULL; |
1292 | */ | 1312 | */ |
1293 | bh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 0, &ident); | 1313 | bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident); |
1294 | if (!bh) { | 1314 | if (!bh) { |
1295 | udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); | 1315 | udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); |
1296 | make_bad_inode(inode); | 1316 | return -EIO; |
1297 | return; | ||
1298 | } | 1317 | } |
1299 | 1318 | ||
1300 | if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && | 1319 | if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && |
1301 | ident != TAG_IDENT_USE) { | 1320 | ident != TAG_IDENT_USE) { |
1302 | udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", | 1321 | udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", |
1303 | inode->i_ino, ident); | 1322 | inode->i_ino, ident); |
1304 | brelse(bh); | 1323 | goto out; |
1305 | make_bad_inode(inode); | ||
1306 | return; | ||
1307 | } | 1324 | } |
1308 | 1325 | ||
1309 | fe = (struct fileEntry *)bh->b_data; | 1326 | fe = (struct fileEntry *)bh->b_data; |
1327 | efe = (struct extendedFileEntry *)bh->b_data; | ||
1310 | 1328 | ||
1311 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { | 1329 | if (fe->icbTag.strategyType == cpu_to_le16(4096)) { |
1312 | struct buffer_head *ibh; | 1330 | struct buffer_head *ibh; |
1313 | 1331 | ||
1314 | ibh = udf_read_ptagged(inode->i_sb, &iinfo->i_location, 1, | 1332 | ibh = udf_read_ptagged(inode->i_sb, iloc, 1, &ident); |
1315 | &ident); | ||
1316 | if (ident == TAG_IDENT_IE && ibh) { | 1333 | if (ident == TAG_IDENT_IE && ibh) { |
1317 | struct buffer_head *nbh = NULL; | ||
1318 | struct kernel_lb_addr loc; | 1334 | struct kernel_lb_addr loc; |
1319 | struct indirectEntry *ie; | 1335 | struct indirectEntry *ie; |
1320 | 1336 | ||
1321 | ie = (struct indirectEntry *)ibh->b_data; | 1337 | ie = (struct indirectEntry *)ibh->b_data; |
1322 | loc = lelb_to_cpu(ie->indirectICB.extLocation); | 1338 | loc = lelb_to_cpu(ie->indirectICB.extLocation); |
1323 | 1339 | ||
1324 | if (ie->indirectICB.extLength && | 1340 | if (ie->indirectICB.extLength) { |
1325 | (nbh = udf_read_ptagged(inode->i_sb, &loc, 0, | 1341 | brelse(ibh); |
1326 | &ident))) { | 1342 | memcpy(&iinfo->i_location, &loc, |
1327 | if (ident == TAG_IDENT_FE || | 1343 | sizeof(struct kernel_lb_addr)); |
1328 | ident == TAG_IDENT_EFE) { | 1344 | if (++indirections > UDF_MAX_ICB_NESTING) { |
1329 | memcpy(&iinfo->i_location, | 1345 | udf_err(inode->i_sb, |
1330 | &loc, | 1346 | "too many ICBs in ICB hierarchy" |
1331 | sizeof(struct kernel_lb_addr)); | 1347 | " (max %d supported)\n", |
1332 | brelse(bh); | 1348 | UDF_MAX_ICB_NESTING); |
1333 | brelse(ibh); | 1349 | goto out; |
1334 | brelse(nbh); | ||
1335 | __udf_read_inode(inode); | ||
1336 | return; | ||
1337 | } | 1350 | } |
1338 | brelse(nbh); | 1351 | brelse(bh); |
1352 | goto reread; | ||
1339 | } | 1353 | } |
1340 | } | 1354 | } |
1341 | brelse(ibh); | 1355 | brelse(ibh); |
1342 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { | 1356 | } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { |
1343 | udf_err(inode->i_sb, "unsupported strategy type: %d\n", | 1357 | udf_err(inode->i_sb, "unsupported strategy type: %d\n", |
1344 | le16_to_cpu(fe->icbTag.strategyType)); | 1358 | le16_to_cpu(fe->icbTag.strategyType)); |
1345 | brelse(bh); | 1359 | goto out; |
1346 | make_bad_inode(inode); | ||
1347 | return; | ||
1348 | } | 1360 | } |
1349 | udf_fill_inode(inode, bh); | ||
1350 | |||
1351 | brelse(bh); | ||
1352 | } | ||
1353 | |||
1354 | static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | ||
1355 | { | ||
1356 | struct fileEntry *fe; | ||
1357 | struct extendedFileEntry *efe; | ||
1358 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | ||
1359 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
1360 | unsigned int link_count; | ||
1361 | |||
1362 | fe = (struct fileEntry *)bh->b_data; | ||
1363 | efe = (struct extendedFileEntry *)bh->b_data; | ||
1364 | |||
1365 | if (fe->icbTag.strategyType == cpu_to_le16(4)) | 1361 | if (fe->icbTag.strategyType == cpu_to_le16(4)) |
1366 | iinfo->i_strat4096 = 0; | 1362 | iinfo->i_strat4096 = 0; |
1367 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ | 1363 | else /* if (fe->icbTag.strategyType == cpu_to_le16(4096)) */ |
@@ -1378,11 +1374,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1378 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { | 1374 | if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_EFE)) { |
1379 | iinfo->i_efe = 1; | 1375 | iinfo->i_efe = 1; |
1380 | iinfo->i_use = 0; | 1376 | iinfo->i_use = 0; |
1381 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1377 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1382 | sizeof(struct extendedFileEntry))) { | 1378 | sizeof(struct extendedFileEntry)); |
1383 | make_bad_inode(inode); | 1379 | if (ret) |
1384 | return; | 1380 | goto out; |
1385 | } | ||
1386 | memcpy(iinfo->i_ext.i_data, | 1381 | memcpy(iinfo->i_ext.i_data, |
1387 | bh->b_data + sizeof(struct extendedFileEntry), | 1382 | bh->b_data + sizeof(struct extendedFileEntry), |
1388 | inode->i_sb->s_blocksize - | 1383 | inode->i_sb->s_blocksize - |
@@ -1390,11 +1385,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1390 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { | 1385 | } else if (fe->descTag.tagIdent == cpu_to_le16(TAG_IDENT_FE)) { |
1391 | iinfo->i_efe = 0; | 1386 | iinfo->i_efe = 0; |
1392 | iinfo->i_use = 0; | 1387 | iinfo->i_use = 0; |
1393 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1388 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1394 | sizeof(struct fileEntry))) { | 1389 | sizeof(struct fileEntry)); |
1395 | make_bad_inode(inode); | 1390 | if (ret) |
1396 | return; | 1391 | goto out; |
1397 | } | ||
1398 | memcpy(iinfo->i_ext.i_data, | 1392 | memcpy(iinfo->i_ext.i_data, |
1399 | bh->b_data + sizeof(struct fileEntry), | 1393 | bh->b_data + sizeof(struct fileEntry), |
1400 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1394 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
@@ -1404,18 +1398,18 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1404 | iinfo->i_lenAlloc = le32_to_cpu( | 1398 | iinfo->i_lenAlloc = le32_to_cpu( |
1405 | ((struct unallocSpaceEntry *)bh->b_data)-> | 1399 | ((struct unallocSpaceEntry *)bh->b_data)-> |
1406 | lengthAllocDescs); | 1400 | lengthAllocDescs); |
1407 | if (udf_alloc_i_data(inode, inode->i_sb->s_blocksize - | 1401 | ret = udf_alloc_i_data(inode, inode->i_sb->s_blocksize - |
1408 | sizeof(struct unallocSpaceEntry))) { | 1402 | sizeof(struct unallocSpaceEntry)); |
1409 | make_bad_inode(inode); | 1403 | if (ret) |
1410 | return; | 1404 | goto out; |
1411 | } | ||
1412 | memcpy(iinfo->i_ext.i_data, | 1405 | memcpy(iinfo->i_ext.i_data, |
1413 | bh->b_data + sizeof(struct unallocSpaceEntry), | 1406 | bh->b_data + sizeof(struct unallocSpaceEntry), |
1414 | inode->i_sb->s_blocksize - | 1407 | inode->i_sb->s_blocksize - |
1415 | sizeof(struct unallocSpaceEntry)); | 1408 | sizeof(struct unallocSpaceEntry)); |
1416 | return; | 1409 | return 0; |
1417 | } | 1410 | } |
1418 | 1411 | ||
1412 | ret = -EIO; | ||
1419 | read_lock(&sbi->s_cred_lock); | 1413 | read_lock(&sbi->s_cred_lock); |
1420 | i_uid_write(inode, le32_to_cpu(fe->uid)); | 1414 | i_uid_write(inode, le32_to_cpu(fe->uid)); |
1421 | if (!uid_valid(inode->i_uid) || | 1415 | if (!uid_valid(inode->i_uid) || |
@@ -1441,8 +1435,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1441 | read_unlock(&sbi->s_cred_lock); | 1435 | read_unlock(&sbi->s_cred_lock); |
1442 | 1436 | ||
1443 | link_count = le16_to_cpu(fe->fileLinkCount); | 1437 | link_count = le16_to_cpu(fe->fileLinkCount); |
1444 | if (!link_count) | 1438 | if (!link_count) { |
1445 | link_count = 1; | 1439 | ret = -ESTALE; |
1440 | goto out; | ||
1441 | } | ||
1446 | set_nlink(inode, link_count); | 1442 | set_nlink(inode, link_count); |
1447 | 1443 | ||
1448 | inode->i_size = le64_to_cpu(fe->informationLength); | 1444 | inode->i_size = le64_to_cpu(fe->informationLength); |
@@ -1488,6 +1484,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1488 | iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); | 1484 | iinfo->i_lenAlloc = le32_to_cpu(efe->lengthAllocDescs); |
1489 | iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint); | 1485 | iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint); |
1490 | } | 1486 | } |
1487 | inode->i_generation = iinfo->i_unique; | ||
1491 | 1488 | ||
1492 | switch (fe->icbTag.fileType) { | 1489 | switch (fe->icbTag.fileType) { |
1493 | case ICBTAG_FILE_TYPE_DIRECTORY: | 1490 | case ICBTAG_FILE_TYPE_DIRECTORY: |
@@ -1537,8 +1534,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1537 | default: | 1534 | default: |
1538 | udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", | 1535 | udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", |
1539 | inode->i_ino, fe->icbTag.fileType); | 1536 | inode->i_ino, fe->icbTag.fileType); |
1540 | make_bad_inode(inode); | 1537 | goto out; |
1541 | return; | ||
1542 | } | 1538 | } |
1543 | if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { | 1539 | if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { |
1544 | struct deviceSpec *dsea = | 1540 | struct deviceSpec *dsea = |
@@ -1549,8 +1545,12 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1549 | le32_to_cpu(dsea->minorDeviceIdent))); | 1545 | le32_to_cpu(dsea->minorDeviceIdent))); |
1550 | /* Developer ID ??? */ | 1546 | /* Developer ID ??? */ |
1551 | } else | 1547 | } else |
1552 | make_bad_inode(inode); | 1548 | goto out; |
1553 | } | 1549 | } |
1550 | ret = 0; | ||
1551 | out: | ||
1552 | brelse(bh); | ||
1553 | return ret; | ||
1554 | } | 1554 | } |
1555 | 1555 | ||
1556 | static int udf_alloc_i_data(struct inode *inode, size_t size) | 1556 | static int udf_alloc_i_data(struct inode *inode, size_t size) |
@@ -1664,7 +1664,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1664 | FE_PERM_U_DELETE | FE_PERM_U_CHATTR)); | 1664 | FE_PERM_U_DELETE | FE_PERM_U_CHATTR)); |
1665 | fe->permissions = cpu_to_le32(udfperms); | 1665 | fe->permissions = cpu_to_le32(udfperms); |
1666 | 1666 | ||
1667 | if (S_ISDIR(inode->i_mode)) | 1667 | if (S_ISDIR(inode->i_mode) && inode->i_nlink > 0) |
1668 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink - 1); | 1668 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink - 1); |
1669 | else | 1669 | else |
1670 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink); | 1670 | fe->fileLinkCount = cpu_to_le16(inode->i_nlink); |
@@ -1830,32 +1830,23 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino) | |||
1830 | { | 1830 | { |
1831 | unsigned long block = udf_get_lb_pblock(sb, ino, 0); | 1831 | unsigned long block = udf_get_lb_pblock(sb, ino, 0); |
1832 | struct inode *inode = iget_locked(sb, block); | 1832 | struct inode *inode = iget_locked(sb, block); |
1833 | int err; | ||
1833 | 1834 | ||
1834 | if (!inode) | 1835 | if (!inode) |
1835 | return NULL; | 1836 | return ERR_PTR(-ENOMEM); |
1836 | |||
1837 | if (inode->i_state & I_NEW) { | ||
1838 | memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); | ||
1839 | __udf_read_inode(inode); | ||
1840 | unlock_new_inode(inode); | ||
1841 | } | ||
1842 | 1837 | ||
1843 | if (is_bad_inode(inode)) | 1838 | if (!(inode->i_state & I_NEW)) |
1844 | goto out_iput; | 1839 | return inode; |
1845 | 1840 | ||
1846 | if (ino->logicalBlockNum >= UDF_SB(sb)-> | 1841 | memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); |
1847 | s_partmaps[ino->partitionReferenceNum].s_partition_len) { | 1842 | err = udf_read_inode(inode); |
1848 | udf_debug("block=%d, partition=%d out of range\n", | 1843 | if (err < 0) { |
1849 | ino->logicalBlockNum, ino->partitionReferenceNum); | 1844 | iget_failed(inode); |
1850 | make_bad_inode(inode); | 1845 | return ERR_PTR(err); |
1851 | goto out_iput; | ||
1852 | } | 1846 | } |
1847 | unlock_new_inode(inode); | ||
1853 | 1848 | ||
1854 | return inode; | 1849 | return inode; |
1855 | |||
1856 | out_iput: | ||
1857 | iput(inode); | ||
1858 | return NULL; | ||
1859 | } | 1850 | } |
1860 | 1851 | ||
1861 | int udf_add_aext(struct inode *inode, struct extent_position *epos, | 1852 | int udf_add_aext(struct inode *inode, struct extent_position *epos, |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 83a06001742b..c12e260fd6c4 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -270,9 +270,8 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
270 | NULL, 0), | 270 | NULL, 0), |
271 | }; | 271 | }; |
272 | inode = udf_iget(dir->i_sb, lb); | 272 | inode = udf_iget(dir->i_sb, lb); |
273 | if (!inode) { | 273 | if (IS_ERR(inode)) |
274 | return ERR_PTR(-EACCES); | 274 | return inode; |
275 | } | ||
276 | } else | 275 | } else |
277 | #endif /* UDF_RECOVERY */ | 276 | #endif /* UDF_RECOVERY */ |
278 | 277 | ||
@@ -285,9 +284,8 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, | |||
285 | 284 | ||
286 | loc = lelb_to_cpu(cfi.icb.extLocation); | 285 | loc = lelb_to_cpu(cfi.icb.extLocation); |
287 | inode = udf_iget(dir->i_sb, &loc); | 286 | inode = udf_iget(dir->i_sb, &loc); |
288 | if (!inode) { | 287 | if (IS_ERR(inode)) |
289 | return ERR_PTR(-EACCES); | 288 | return ERR_CAST(inode); |
290 | } | ||
291 | } | 289 | } |
292 | 290 | ||
293 | return d_splice_alias(inode, dentry); | 291 | return d_splice_alias(inode, dentry); |
@@ -550,32 +548,18 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi, | |||
550 | return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); | 548 | return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); |
551 | } | 549 | } |
552 | 550 | ||
553 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, | 551 | static int udf_add_nondir(struct dentry *dentry, struct inode *inode) |
554 | bool excl) | ||
555 | { | 552 | { |
553 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
554 | struct inode *dir = dentry->d_parent->d_inode; | ||
556 | struct udf_fileident_bh fibh; | 555 | struct udf_fileident_bh fibh; |
557 | struct inode *inode; | ||
558 | struct fileIdentDesc cfi, *fi; | 556 | struct fileIdentDesc cfi, *fi; |
559 | int err; | 557 | int err; |
560 | struct udf_inode_info *iinfo; | ||
561 | |||
562 | inode = udf_new_inode(dir, mode, &err); | ||
563 | if (!inode) { | ||
564 | return err; | ||
565 | } | ||
566 | |||
567 | iinfo = UDF_I(inode); | ||
568 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
569 | inode->i_data.a_ops = &udf_adinicb_aops; | ||
570 | else | ||
571 | inode->i_data.a_ops = &udf_aops; | ||
572 | inode->i_op = &udf_file_inode_operations; | ||
573 | inode->i_fop = &udf_file_operations; | ||
574 | mark_inode_dirty(inode); | ||
575 | 558 | ||
576 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 559 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
577 | if (!fi) { | 560 | if (unlikely(!fi)) { |
578 | inode_dec_link_count(inode); | 561 | inode_dec_link_count(inode); |
562 | unlock_new_inode(inode); | ||
579 | iput(inode); | 563 | iput(inode); |
580 | return err; | 564 | return err; |
581 | } | 565 | } |
@@ -589,23 +573,21 @@ static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
589 | if (fibh.sbh != fibh.ebh) | 573 | if (fibh.sbh != fibh.ebh) |
590 | brelse(fibh.ebh); | 574 | brelse(fibh.ebh); |
591 | brelse(fibh.sbh); | 575 | brelse(fibh.sbh); |
576 | unlock_new_inode(inode); | ||
592 | d_instantiate(dentry, inode); | 577 | d_instantiate(dentry, inode); |
593 | 578 | ||
594 | return 0; | 579 | return 0; |
595 | } | 580 | } |
596 | 581 | ||
597 | static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | 582 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
583 | bool excl) | ||
598 | { | 584 | { |
599 | struct inode *inode; | 585 | struct inode *inode = udf_new_inode(dir, mode); |
600 | struct udf_inode_info *iinfo; | ||
601 | int err; | ||
602 | 586 | ||
603 | inode = udf_new_inode(dir, mode, &err); | 587 | if (IS_ERR(inode)) |
604 | if (!inode) | 588 | return PTR_ERR(inode); |
605 | return err; | ||
606 | 589 | ||
607 | iinfo = UDF_I(inode); | 590 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
608 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
609 | inode->i_data.a_ops = &udf_adinicb_aops; | 591 | inode->i_data.a_ops = &udf_adinicb_aops; |
610 | else | 592 | else |
611 | inode->i_data.a_ops = &udf_aops; | 593 | inode->i_data.a_ops = &udf_aops; |
@@ -613,7 +595,25 @@ static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
613 | inode->i_fop = &udf_file_operations; | 595 | inode->i_fop = &udf_file_operations; |
614 | mark_inode_dirty(inode); | 596 | mark_inode_dirty(inode); |
615 | 597 | ||
598 | return udf_add_nondir(dentry, inode); | ||
599 | } | ||
600 | |||
601 | static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | ||
602 | { | ||
603 | struct inode *inode = udf_new_inode(dir, mode); | ||
604 | |||
605 | if (IS_ERR(inode)) | ||
606 | return PTR_ERR(inode); | ||
607 | |||
608 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
609 | inode->i_data.a_ops = &udf_adinicb_aops; | ||
610 | else | ||
611 | inode->i_data.a_ops = &udf_aops; | ||
612 | inode->i_op = &udf_file_inode_operations; | ||
613 | inode->i_fop = &udf_file_operations; | ||
614 | mark_inode_dirty(inode); | ||
616 | d_tmpfile(dentry, inode); | 615 | d_tmpfile(dentry, inode); |
616 | unlock_new_inode(inode); | ||
617 | return 0; | 617 | return 0; |
618 | } | 618 | } |
619 | 619 | ||
@@ -621,44 +621,16 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
621 | dev_t rdev) | 621 | dev_t rdev) |
622 | { | 622 | { |
623 | struct inode *inode; | 623 | struct inode *inode; |
624 | struct udf_fileident_bh fibh; | ||
625 | struct fileIdentDesc cfi, *fi; | ||
626 | int err; | ||
627 | struct udf_inode_info *iinfo; | ||
628 | 624 | ||
629 | if (!old_valid_dev(rdev)) | 625 | if (!old_valid_dev(rdev)) |
630 | return -EINVAL; | 626 | return -EINVAL; |
631 | 627 | ||
632 | err = -EIO; | 628 | inode = udf_new_inode(dir, mode); |
633 | inode = udf_new_inode(dir, mode, &err); | 629 | if (IS_ERR(inode)) |
634 | if (!inode) | 630 | return PTR_ERR(inode); |
635 | goto out; | ||
636 | 631 | ||
637 | iinfo = UDF_I(inode); | ||
638 | init_special_inode(inode, mode, rdev); | 632 | init_special_inode(inode, mode, rdev); |
639 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 633 | return udf_add_nondir(dentry, inode); |
640 | if (!fi) { | ||
641 | inode_dec_link_count(inode); | ||
642 | iput(inode); | ||
643 | return err; | ||
644 | } | ||
645 | cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize); | ||
646 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | ||
647 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | ||
648 | cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); | ||
649 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | ||
650 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
651 | mark_inode_dirty(dir); | ||
652 | mark_inode_dirty(inode); | ||
653 | |||
654 | if (fibh.sbh != fibh.ebh) | ||
655 | brelse(fibh.ebh); | ||
656 | brelse(fibh.sbh); | ||
657 | d_instantiate(dentry, inode); | ||
658 | err = 0; | ||
659 | |||
660 | out: | ||
661 | return err; | ||
662 | } | 634 | } |
663 | 635 | ||
664 | static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 636 | static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
@@ -670,10 +642,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
670 | struct udf_inode_info *dinfo = UDF_I(dir); | 642 | struct udf_inode_info *dinfo = UDF_I(dir); |
671 | struct udf_inode_info *iinfo; | 643 | struct udf_inode_info *iinfo; |
672 | 644 | ||
673 | err = -EIO; | 645 | inode = udf_new_inode(dir, S_IFDIR | mode); |
674 | inode = udf_new_inode(dir, S_IFDIR | mode, &err); | 646 | if (IS_ERR(inode)) |
675 | if (!inode) | 647 | return PTR_ERR(inode); |
676 | goto out; | ||
677 | 648 | ||
678 | iinfo = UDF_I(inode); | 649 | iinfo = UDF_I(inode); |
679 | inode->i_op = &udf_dir_inode_operations; | 650 | inode->i_op = &udf_dir_inode_operations; |
@@ -681,6 +652,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
681 | fi = udf_add_entry(inode, NULL, &fibh, &cfi, &err); | 652 | fi = udf_add_entry(inode, NULL, &fibh, &cfi, &err); |
682 | if (!fi) { | 653 | if (!fi) { |
683 | inode_dec_link_count(inode); | 654 | inode_dec_link_count(inode); |
655 | unlock_new_inode(inode); | ||
684 | iput(inode); | 656 | iput(inode); |
685 | goto out; | 657 | goto out; |
686 | } | 658 | } |
@@ -699,6 +671,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
699 | if (!fi) { | 671 | if (!fi) { |
700 | clear_nlink(inode); | 672 | clear_nlink(inode); |
701 | mark_inode_dirty(inode); | 673 | mark_inode_dirty(inode); |
674 | unlock_new_inode(inode); | ||
702 | iput(inode); | 675 | iput(inode); |
703 | goto out; | 676 | goto out; |
704 | } | 677 | } |
@@ -710,6 +683,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
710 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | 683 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); |
711 | inc_nlink(dir); | 684 | inc_nlink(dir); |
712 | mark_inode_dirty(dir); | 685 | mark_inode_dirty(dir); |
686 | unlock_new_inode(inode); | ||
713 | d_instantiate(dentry, inode); | 687 | d_instantiate(dentry, inode); |
714 | if (fibh.sbh != fibh.ebh) | 688 | if (fibh.sbh != fibh.ebh) |
715 | brelse(fibh.ebh); | 689 | brelse(fibh.ebh); |
@@ -876,14 +850,11 @@ out: | |||
876 | static int udf_symlink(struct inode *dir, struct dentry *dentry, | 850 | static int udf_symlink(struct inode *dir, struct dentry *dentry, |
877 | const char *symname) | 851 | const char *symname) |
878 | { | 852 | { |
879 | struct inode *inode; | 853 | struct inode *inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO); |
880 | struct pathComponent *pc; | 854 | struct pathComponent *pc; |
881 | const char *compstart; | 855 | const char *compstart; |
882 | struct udf_fileident_bh fibh; | ||
883 | struct extent_position epos = {}; | 856 | struct extent_position epos = {}; |
884 | int eoffset, elen = 0; | 857 | int eoffset, elen = 0; |
885 | struct fileIdentDesc *fi; | ||
886 | struct fileIdentDesc cfi; | ||
887 | uint8_t *ea; | 858 | uint8_t *ea; |
888 | int err; | 859 | int err; |
889 | int block; | 860 | int block; |
@@ -892,9 +863,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
892 | struct udf_inode_info *iinfo; | 863 | struct udf_inode_info *iinfo; |
893 | struct super_block *sb = dir->i_sb; | 864 | struct super_block *sb = dir->i_sb; |
894 | 865 | ||
895 | inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); | 866 | if (IS_ERR(inode)) |
896 | if (!inode) | 867 | return PTR_ERR(inode); |
897 | goto out; | ||
898 | 868 | ||
899 | iinfo = UDF_I(inode); | 869 | iinfo = UDF_I(inode); |
900 | down_write(&iinfo->i_data_sem); | 870 | down_write(&iinfo->i_data_sem); |
@@ -1012,32 +982,15 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
1012 | mark_inode_dirty(inode); | 982 | mark_inode_dirty(inode); |
1013 | up_write(&iinfo->i_data_sem); | 983 | up_write(&iinfo->i_data_sem); |
1014 | 984 | ||
1015 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 985 | err = udf_add_nondir(dentry, inode); |
1016 | if (!fi) | ||
1017 | goto out_fail; | ||
1018 | cfi.icb.extLength = cpu_to_le32(sb->s_blocksize); | ||
1019 | cfi.icb.extLocation = cpu_to_lelb(iinfo->i_location); | ||
1020 | if (UDF_SB(inode->i_sb)->s_lvid_bh) { | ||
1021 | *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = | ||
1022 | cpu_to_le32(lvid_get_unique_id(sb)); | ||
1023 | } | ||
1024 | udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); | ||
1025 | if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
1026 | mark_inode_dirty(dir); | ||
1027 | if (fibh.sbh != fibh.ebh) | ||
1028 | brelse(fibh.ebh); | ||
1029 | brelse(fibh.sbh); | ||
1030 | d_instantiate(dentry, inode); | ||
1031 | err = 0; | ||
1032 | |||
1033 | out: | 986 | out: |
1034 | kfree(name); | 987 | kfree(name); |
1035 | return err; | 988 | return err; |
1036 | 989 | ||
1037 | out_no_entry: | 990 | out_no_entry: |
1038 | up_write(&iinfo->i_data_sem); | 991 | up_write(&iinfo->i_data_sem); |
1039 | out_fail: | ||
1040 | inode_dec_link_count(inode); | 992 | inode_dec_link_count(inode); |
993 | unlock_new_inode(inode); | ||
1041 | iput(inode); | 994 | iput(inode); |
1042 | goto out; | 995 | goto out; |
1043 | } | 996 | } |
@@ -1222,7 +1175,7 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
1222 | struct udf_fileident_bh fibh; | 1175 | struct udf_fileident_bh fibh; |
1223 | 1176 | ||
1224 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) | 1177 | if (!udf_find_entry(child->d_inode, &dotdot, &fibh, &cfi)) |
1225 | goto out_unlock; | 1178 | return ERR_PTR(-EACCES); |
1226 | 1179 | ||
1227 | if (fibh.sbh != fibh.ebh) | 1180 | if (fibh.sbh != fibh.ebh) |
1228 | brelse(fibh.ebh); | 1181 | brelse(fibh.ebh); |
@@ -1230,12 +1183,10 @@ static struct dentry *udf_get_parent(struct dentry *child) | |||
1230 | 1183 | ||
1231 | tloc = lelb_to_cpu(cfi.icb.extLocation); | 1184 | tloc = lelb_to_cpu(cfi.icb.extLocation); |
1232 | inode = udf_iget(child->d_inode->i_sb, &tloc); | 1185 | inode = udf_iget(child->d_inode->i_sb, &tloc); |
1233 | if (!inode) | 1186 | if (IS_ERR(inode)) |
1234 | goto out_unlock; | 1187 | return ERR_CAST(inode); |
1235 | 1188 | ||
1236 | return d_obtain_alias(inode); | 1189 | return d_obtain_alias(inode); |
1237 | out_unlock: | ||
1238 | return ERR_PTR(-EACCES); | ||
1239 | } | 1190 | } |
1240 | 1191 | ||
1241 | 1192 | ||
@@ -1252,8 +1203,8 @@ static struct dentry *udf_nfs_get_inode(struct super_block *sb, u32 block, | |||
1252 | loc.partitionReferenceNum = partref; | 1203 | loc.partitionReferenceNum = partref; |
1253 | inode = udf_iget(sb, &loc); | 1204 | inode = udf_iget(sb, &loc); |
1254 | 1205 | ||
1255 | if (inode == NULL) | 1206 | if (IS_ERR(inode)) |
1256 | return ERR_PTR(-ENOMEM); | 1207 | return ERR_CAST(inode); |
1257 | 1208 | ||
1258 | if (generation && inode->i_generation != generation) { | 1209 | if (generation && inode->i_generation != generation) { |
1259 | iput(inode); | 1210 | iput(inode); |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 813da94d447b..5401fc33f5cc 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -961,12 +961,14 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb, | |||
961 | 961 | ||
962 | metadata_fe = udf_iget(sb, &addr); | 962 | metadata_fe = udf_iget(sb, &addr); |
963 | 963 | ||
964 | if (metadata_fe == NULL) | 964 | if (IS_ERR(metadata_fe)) { |
965 | udf_warn(sb, "metadata inode efe not found\n"); | 965 | udf_warn(sb, "metadata inode efe not found\n"); |
966 | else if (UDF_I(metadata_fe)->i_alloc_type != ICBTAG_FLAG_AD_SHORT) { | 966 | return metadata_fe; |
967 | } | ||
968 | if (UDF_I(metadata_fe)->i_alloc_type != ICBTAG_FLAG_AD_SHORT) { | ||
967 | udf_warn(sb, "metadata inode efe does not have short allocation descriptors!\n"); | 969 | udf_warn(sb, "metadata inode efe does not have short allocation descriptors!\n"); |
968 | iput(metadata_fe); | 970 | iput(metadata_fe); |
969 | metadata_fe = NULL; | 971 | return ERR_PTR(-EIO); |
970 | } | 972 | } |
971 | 973 | ||
972 | return metadata_fe; | 974 | return metadata_fe; |
@@ -978,6 +980,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
978 | struct udf_part_map *map; | 980 | struct udf_part_map *map; |
979 | struct udf_meta_data *mdata; | 981 | struct udf_meta_data *mdata; |
980 | struct kernel_lb_addr addr; | 982 | struct kernel_lb_addr addr; |
983 | struct inode *fe; | ||
981 | 984 | ||
982 | map = &sbi->s_partmaps[partition]; | 985 | map = &sbi->s_partmaps[partition]; |
983 | mdata = &map->s_type_specific.s_metadata; | 986 | mdata = &map->s_type_specific.s_metadata; |
@@ -986,22 +989,24 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
986 | udf_debug("Metadata file location: block = %d part = %d\n", | 989 | udf_debug("Metadata file location: block = %d part = %d\n", |
987 | mdata->s_meta_file_loc, map->s_partition_num); | 990 | mdata->s_meta_file_loc, map->s_partition_num); |
988 | 991 | ||
989 | mdata->s_metadata_fe = udf_find_metadata_inode_efe(sb, | 992 | fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, |
990 | mdata->s_meta_file_loc, map->s_partition_num); | 993 | map->s_partition_num); |
991 | 994 | if (IS_ERR(fe)) { | |
992 | if (mdata->s_metadata_fe == NULL) { | ||
993 | /* mirror file entry */ | 995 | /* mirror file entry */ |
994 | udf_debug("Mirror metadata file location: block = %d part = %d\n", | 996 | udf_debug("Mirror metadata file location: block = %d part = %d\n", |
995 | mdata->s_mirror_file_loc, map->s_partition_num); | 997 | mdata->s_mirror_file_loc, map->s_partition_num); |
996 | 998 | ||
997 | mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb, | 999 | fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, |
998 | mdata->s_mirror_file_loc, map->s_partition_num); | 1000 | map->s_partition_num); |
999 | 1001 | ||
1000 | if (mdata->s_mirror_fe == NULL) { | 1002 | if (IS_ERR(fe)) { |
1001 | udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n"); | 1003 | udf_err(sb, "Both metadata and mirror metadata inode efe can not found\n"); |
1002 | return -EIO; | 1004 | return PTR_ERR(fe); |
1003 | } | 1005 | } |
1004 | } | 1006 | mdata->s_mirror_fe = fe; |
1007 | } else | ||
1008 | mdata->s_metadata_fe = fe; | ||
1009 | |||
1005 | 1010 | ||
1006 | /* | 1011 | /* |
1007 | * bitmap file entry | 1012 | * bitmap file entry |
@@ -1015,15 +1020,16 @@ static int udf_load_metadata_files(struct super_block *sb, int partition) | |||
1015 | udf_debug("Bitmap file location: block = %d part = %d\n", | 1020 | udf_debug("Bitmap file location: block = %d part = %d\n", |
1016 | addr.logicalBlockNum, addr.partitionReferenceNum); | 1021 | addr.logicalBlockNum, addr.partitionReferenceNum); |
1017 | 1022 | ||
1018 | mdata->s_bitmap_fe = udf_iget(sb, &addr); | 1023 | fe = udf_iget(sb, &addr); |
1019 | if (mdata->s_bitmap_fe == NULL) { | 1024 | if (IS_ERR(fe)) { |
1020 | if (sb->s_flags & MS_RDONLY) | 1025 | if (sb->s_flags & MS_RDONLY) |
1021 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); | 1026 | udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); |
1022 | else { | 1027 | else { |
1023 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); | 1028 | udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n"); |
1024 | return -EIO; | 1029 | return PTR_ERR(fe); |
1025 | } | 1030 | } |
1026 | } | 1031 | } else |
1032 | mdata->s_bitmap_fe = fe; | ||
1027 | } | 1033 | } |
1028 | 1034 | ||
1029 | udf_debug("udf_load_metadata_files Ok\n"); | 1035 | udf_debug("udf_load_metadata_files Ok\n"); |
@@ -1111,13 +1117,15 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1111 | phd->unallocSpaceTable.extPosition), | 1117 | phd->unallocSpaceTable.extPosition), |
1112 | .partitionReferenceNum = p_index, | 1118 | .partitionReferenceNum = p_index, |
1113 | }; | 1119 | }; |
1120 | struct inode *inode; | ||
1114 | 1121 | ||
1115 | map->s_uspace.s_table = udf_iget(sb, &loc); | 1122 | inode = udf_iget(sb, &loc); |
1116 | if (!map->s_uspace.s_table) { | 1123 | if (IS_ERR(inode)) { |
1117 | udf_debug("cannot load unallocSpaceTable (part %d)\n", | 1124 | udf_debug("cannot load unallocSpaceTable (part %d)\n", |
1118 | p_index); | 1125 | p_index); |
1119 | return -EIO; | 1126 | return PTR_ERR(inode); |
1120 | } | 1127 | } |
1128 | map->s_uspace.s_table = inode; | ||
1121 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; | 1129 | map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; |
1122 | udf_debug("unallocSpaceTable (part %d) @ %ld\n", | 1130 | udf_debug("unallocSpaceTable (part %d) @ %ld\n", |
1123 | p_index, map->s_uspace.s_table->i_ino); | 1131 | p_index, map->s_uspace.s_table->i_ino); |
@@ -1144,14 +1152,15 @@ static int udf_fill_partdesc_info(struct super_block *sb, | |||
1144 | phd->freedSpaceTable.extPosition), | 1152 | phd->freedSpaceTable.extPosition), |
1145 | .partitionReferenceNum = p_index, | 1153 | .partitionReferenceNum = p_index, |
1146 | }; | 1154 | }; |
1155 | struct inode *inode; | ||
1147 | 1156 | ||
1148 | map->s_fspace.s_table = udf_iget(sb, &loc); | 1157 | inode = udf_iget(sb, &loc); |
1149 | if (!map->s_fspace.s_table) { | 1158 | if (IS_ERR(inode)) { |
1150 | udf_debug("cannot load freedSpaceTable (part %d)\n", | 1159 | udf_debug("cannot load freedSpaceTable (part %d)\n", |
1151 | p_index); | 1160 | p_index); |
1152 | return -EIO; | 1161 | return PTR_ERR(inode); |
1153 | } | 1162 | } |
1154 | 1163 | map->s_fspace.s_table = inode; | |
1155 | map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; | 1164 | map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; |
1156 | udf_debug("freedSpaceTable (part %d) @ %ld\n", | 1165 | udf_debug("freedSpaceTable (part %d) @ %ld\n", |
1157 | p_index, map->s_fspace.s_table->i_ino); | 1166 | p_index, map->s_fspace.s_table->i_ino); |
@@ -1178,6 +1187,7 @@ static void udf_find_vat_block(struct super_block *sb, int p_index, | |||
1178 | struct udf_part_map *map = &sbi->s_partmaps[p_index]; | 1187 | struct udf_part_map *map = &sbi->s_partmaps[p_index]; |
1179 | sector_t vat_block; | 1188 | sector_t vat_block; |
1180 | struct kernel_lb_addr ino; | 1189 | struct kernel_lb_addr ino; |
1190 | struct inode *inode; | ||
1181 | 1191 | ||
1182 | /* | 1192 | /* |
1183 | * VAT file entry is in the last recorded block. Some broken disks have | 1193 | * VAT file entry is in the last recorded block. Some broken disks have |
@@ -1186,10 +1196,13 @@ static void udf_find_vat_block(struct super_block *sb, int p_index, | |||
1186 | ino.partitionReferenceNum = type1_index; | 1196 | ino.partitionReferenceNum = type1_index; |
1187 | for (vat_block = start_block; | 1197 | for (vat_block = start_block; |
1188 | vat_block >= map->s_partition_root && | 1198 | vat_block >= map->s_partition_root && |
1189 | vat_block >= start_block - 3 && | 1199 | vat_block >= start_block - 3; vat_block--) { |
1190 | !sbi->s_vat_inode; vat_block--) { | ||
1191 | ino.logicalBlockNum = vat_block - map->s_partition_root; | 1200 | ino.logicalBlockNum = vat_block - map->s_partition_root; |
1192 | sbi->s_vat_inode = udf_iget(sb, &ino); | 1201 | inode = udf_iget(sb, &ino); |
1202 | if (!IS_ERR(inode)) { | ||
1203 | sbi->s_vat_inode = inode; | ||
1204 | break; | ||
1205 | } | ||
1193 | } | 1206 | } |
1194 | } | 1207 | } |
1195 | 1208 | ||
@@ -2205,10 +2218,10 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
2205 | /* assign inodes by physical block number */ | 2218 | /* assign inodes by physical block number */ |
2206 | /* perhaps it's not extensible enough, but for now ... */ | 2219 | /* perhaps it's not extensible enough, but for now ... */ |
2207 | inode = udf_iget(sb, &rootdir); | 2220 | inode = udf_iget(sb, &rootdir); |
2208 | if (!inode) { | 2221 | if (IS_ERR(inode)) { |
2209 | udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", | 2222 | udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", |
2210 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); | 2223 | rootdir.logicalBlockNum, rootdir.partitionReferenceNum); |
2211 | ret = -EIO; | 2224 | ret = PTR_ERR(inode); |
2212 | goto error_out; | 2225 | goto error_out; |
2213 | } | 2226 | } |
2214 | 2227 | ||
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index be7dabbbcb49..742557be9936 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -143,7 +143,6 @@ extern int udf_expand_file_adinicb(struct inode *); | |||
143 | extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); | 143 | extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); |
144 | extern struct buffer_head *udf_bread(struct inode *, int, int, int *); | 144 | extern struct buffer_head *udf_bread(struct inode *, int, int, int *); |
145 | extern int udf_setsize(struct inode *, loff_t); | 145 | extern int udf_setsize(struct inode *, loff_t); |
146 | extern void udf_read_inode(struct inode *); | ||
147 | extern void udf_evict_inode(struct inode *); | 146 | extern void udf_evict_inode(struct inode *); |
148 | extern int udf_write_inode(struct inode *, struct writeback_control *wbc); | 147 | extern int udf_write_inode(struct inode *, struct writeback_control *wbc); |
149 | extern long udf_block_map(struct inode *, sector_t); | 148 | extern long udf_block_map(struct inode *, sector_t); |
@@ -209,7 +208,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *); | |||
209 | 208 | ||
210 | /* ialloc.c */ | 209 | /* ialloc.c */ |
211 | extern void udf_free_inode(struct inode *); | 210 | extern void udf_free_inode(struct inode *); |
212 | extern struct inode *udf_new_inode(struct inode *, umode_t, int *); | 211 | extern struct inode *udf_new_inode(struct inode *, umode_t); |
213 | 212 | ||
214 | /* truncate.c */ | 213 | /* truncate.c */ |
215 | extern void udf_truncate_tail_extent(struct inode *); | 214 | extern void udf_truncate_tail_extent(struct inode *); |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index c1c9de19edbe..d91e59b79f0d 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -204,10 +204,9 @@ struct acpi_device_flags { | |||
204 | u32 match_driver:1; | 204 | u32 match_driver:1; |
205 | u32 initialized:1; | 205 | u32 initialized:1; |
206 | u32 visited:1; | 206 | u32 visited:1; |
207 | u32 no_hotplug:1; | ||
208 | u32 hotplug_notify:1; | 207 | u32 hotplug_notify:1; |
209 | u32 is_dock_station:1; | 208 | u32 is_dock_station:1; |
210 | u32 reserved:22; | 209 | u32 reserved:23; |
211 | }; | 210 | }; |
212 | 211 | ||
213 | /* File System */ | 212 | /* File System */ |
@@ -411,7 +410,6 @@ void acpi_bus_private_data_handler(acpi_handle, void *); | |||
411 | int acpi_bus_get_private_data(acpi_handle, void **); | 410 | int acpi_bus_get_private_data(acpi_handle, void **); |
412 | int acpi_bus_attach_private_data(acpi_handle, void *); | 411 | int acpi_bus_attach_private_data(acpi_handle, void *); |
413 | void acpi_bus_detach_private_data(acpi_handle); | 412 | void acpi_bus_detach_private_data(acpi_handle); |
414 | void acpi_bus_no_hotplug(acpi_handle handle); | ||
415 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); | 413 | extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); |
416 | extern int register_acpi_notifier(struct notifier_block *); | 414 | extern int register_acpi_notifier(struct notifier_block *); |
417 | extern int unregister_acpi_notifier(struct notifier_block *); | 415 | extern int unregister_acpi_notifier(struct notifier_block *); |
diff --git a/include/crypto/drbg.h b/include/crypto/drbg.h index 831d786976c5..882675e7c055 100644 --- a/include/crypto/drbg.h +++ b/include/crypto/drbg.h | |||
@@ -162,12 +162,25 @@ static inline size_t drbg_max_request_bytes(struct drbg_state *drbg) | |||
162 | 162 | ||
163 | static inline size_t drbg_max_addtl(struct drbg_state *drbg) | 163 | static inline size_t drbg_max_addtl(struct drbg_state *drbg) |
164 | { | 164 | { |
165 | #if (__BITS_PER_LONG == 32) | ||
166 | /* | ||
167 | * SP800-90A allows smaller maximum numbers to be returned -- we | ||
168 | * return SIZE_MAX - 1 to allow the verification of the enforcement | ||
169 | * of this value in drbg_healthcheck_sanity. | ||
170 | */ | ||
171 | return (SIZE_MAX - 1); | ||
172 | #else | ||
165 | return (1UL<<(drbg->core->max_addtllen)); | 173 | return (1UL<<(drbg->core->max_addtllen)); |
174 | #endif | ||
166 | } | 175 | } |
167 | 176 | ||
168 | static inline size_t drbg_max_requests(struct drbg_state *drbg) | 177 | static inline size_t drbg_max_requests(struct drbg_state *drbg) |
169 | { | 178 | { |
179 | #if (__BITS_PER_LONG == 32) | ||
180 | return SIZE_MAX; | ||
181 | #else | ||
170 | return (1UL<<(drbg->core->max_req)); | 182 | return (1UL<<(drbg->core->max_req)); |
183 | #endif | ||
171 | } | 184 | } |
172 | 185 | ||
173 | /* | 186 | /* |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index e4ae2ad48d07..75a227cc7ce2 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -55,6 +55,7 @@ struct qstr { | |||
55 | #define QSTR_INIT(n,l) { { { .len = l } }, .name = n } | 55 | #define QSTR_INIT(n,l) { { { .len = l } }, .name = n } |
56 | #define hashlen_hash(hashlen) ((u32) (hashlen)) | 56 | #define hashlen_hash(hashlen) ((u32) (hashlen)) |
57 | #define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) | 57 | #define hashlen_len(hashlen) ((u32)((hashlen) >> 32)) |
58 | #define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash)) | ||
58 | 59 | ||
59 | struct dentry_stat_t { | 60 | struct dentry_stat_t { |
60 | long nr_dentry; | 61 | long nr_dentry; |
diff --git a/include/linux/hash.h b/include/linux/hash.h index bd1754c7ecef..d0494c399392 100644 --- a/include/linux/hash.h +++ b/include/linux/hash.h | |||
@@ -37,6 +37,9 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits) | |||
37 | { | 37 | { |
38 | u64 hash = val; | 38 | u64 hash = val; |
39 | 39 | ||
40 | #if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 | ||
41 | hash = hash * GOLDEN_RATIO_PRIME_64; | ||
42 | #else | ||
40 | /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ | 43 | /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ |
41 | u64 n = hash; | 44 | u64 n = hash; |
42 | n <<= 18; | 45 | n <<= 18; |
@@ -51,6 +54,7 @@ static __always_inline u64 hash_64(u64 val, unsigned int bits) | |||
51 | hash += n; | 54 | hash += n; |
52 | n <<= 2; | 55 | n <<= 2; |
53 | hash += n; | 56 | hash += n; |
57 | #endif | ||
54 | 58 | ||
55 | /* High bits are more random, so use them. */ | 59 | /* High bits are more random, so use them. */ |
56 | return hash >> (64 - bits); | 60 | return hash >> (64 - bits); |
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index 4b79ffe7b188..fa76c79a52a1 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h | |||
@@ -84,10 +84,12 @@ static inline void iio_trigger_put(struct iio_trigger *trig) | |||
84 | put_device(&trig->dev); | 84 | put_device(&trig->dev); |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline void iio_trigger_get(struct iio_trigger *trig) | 87 | static inline struct iio_trigger *iio_trigger_get(struct iio_trigger *trig) |
88 | { | 88 | { |
89 | get_device(&trig->dev); | 89 | get_device(&trig->dev); |
90 | __module_get(trig->ops->owner); | 90 | __module_get(trig->ops->owner); |
91 | |||
92 | return trig; | ||
91 | } | 93 | } |
92 | 94 | ||
93 | /** | 95 | /** |
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 1f44466c1e9d..c367cbdf73ab 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -258,23 +258,11 @@ extern unsigned long preset_lpj; | |||
258 | #define SEC_JIFFIE_SC (32 - SHIFT_HZ) | 258 | #define SEC_JIFFIE_SC (32 - SHIFT_HZ) |
259 | #endif | 259 | #endif |
260 | #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) | 260 | #define NSEC_JIFFIE_SC (SEC_JIFFIE_SC + 29) |
261 | #define USEC_JIFFIE_SC (SEC_JIFFIE_SC + 19) | ||
262 | #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ | 261 | #define SEC_CONVERSION ((unsigned long)((((u64)NSEC_PER_SEC << SEC_JIFFIE_SC) +\ |
263 | TICK_NSEC -1) / (u64)TICK_NSEC)) | 262 | TICK_NSEC -1) / (u64)TICK_NSEC)) |
264 | 263 | ||
265 | #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ | 264 | #define NSEC_CONVERSION ((unsigned long)((((u64)1 << NSEC_JIFFIE_SC) +\ |
266 | TICK_NSEC -1) / (u64)TICK_NSEC)) | 265 | TICK_NSEC -1) / (u64)TICK_NSEC)) |
267 | #define USEC_CONVERSION \ | ||
268 | ((unsigned long)((((u64)NSEC_PER_USEC << USEC_JIFFIE_SC) +\ | ||
269 | TICK_NSEC -1) / (u64)TICK_NSEC)) | ||
270 | /* | ||
271 | * USEC_ROUND is used in the timeval to jiffie conversion. See there | ||
272 | * for more details. It is the scaled resolution rounding value. Note | ||
273 | * that it is a 64-bit value. Since, when it is applied, we are already | ||
274 | * in jiffies (albit scaled), it is nothing but the bits we will shift | ||
275 | * off. | ||
276 | */ | ||
277 | #define USEC_ROUND (u64)(((u64)1 << USEC_JIFFIE_SC) - 1) | ||
278 | /* | 266 | /* |
279 | * The maximum jiffie value is (MAX_INT >> 1). Here we translate that | 267 | * The maximum jiffie value is (MAX_INT >> 1). Here we translate that |
280 | * into seconds. The 64-bit case will overflow if we are not careful, | 268 | * into seconds. The 64-bit case will overflow if we are not careful, |
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 7bcefe749a39..03b5608a4329 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h | |||
@@ -215,6 +215,7 @@ enum { | |||
215 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, | 215 | MLX4_BMME_FLAG_TYPE_2_WIN = 1 << 9, |
216 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, | 216 | MLX4_BMME_FLAG_RESERVED_LKEY = 1 << 10, |
217 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, | 217 | MLX4_BMME_FLAG_FAST_REG_WR = 1 << 11, |
218 | MLX4_BMME_FLAG_VSD_INIT2RTR = 1 << 28, | ||
218 | }; | 219 | }; |
219 | 220 | ||
220 | enum mlx4_event { | 221 | enum mlx4_event { |
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h index 7040dc98ff8b..5f4e36cf0091 100644 --- a/include/linux/mlx4/qp.h +++ b/include/linux/mlx4/qp.h | |||
@@ -56,7 +56,8 @@ enum mlx4_qp_optpar { | |||
56 | MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, | 56 | MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, |
57 | MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, | 57 | MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, |
58 | MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16, | 58 | MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16, |
59 | MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20 | 59 | MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20, |
60 | MLX4_QP_OPTPAR_VLAN_STRIPPING = 1 << 21, | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | enum mlx4_qp_state { | 63 | enum mlx4_qp_state { |
@@ -423,13 +424,20 @@ struct mlx4_wqe_inline_seg { | |||
423 | 424 | ||
424 | enum mlx4_update_qp_attr { | 425 | enum mlx4_update_qp_attr { |
425 | MLX4_UPDATE_QP_SMAC = 1 << 0, | 426 | MLX4_UPDATE_QP_SMAC = 1 << 0, |
427 | MLX4_UPDATE_QP_VSD = 1 << 2, | ||
428 | MLX4_UPDATE_QP_SUPPORTED_ATTRS = (1 << 2) - 1 | ||
429 | }; | ||
430 | |||
431 | enum mlx4_update_qp_params_flags { | ||
432 | MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE = 1 << 0, | ||
426 | }; | 433 | }; |
427 | 434 | ||
428 | struct mlx4_update_qp_params { | 435 | struct mlx4_update_qp_params { |
429 | u8 smac_index; | 436 | u8 smac_index; |
437 | u32 flags; | ||
430 | }; | 438 | }; |
431 | 439 | ||
432 | int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | 440 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
433 | enum mlx4_update_qp_attr attr, | 441 | enum mlx4_update_qp_attr attr, |
434 | struct mlx4_update_qp_params *params); | 442 | struct mlx4_update_qp_params *params); |
435 | int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | 443 | int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 61978a460841..96453f9bc8ba 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -303,6 +303,7 @@ struct pci_dev { | |||
303 | D3cold, not set for devices | 303 | D3cold, not set for devices |
304 | powered on/off by the | 304 | powered on/off by the |
305 | corresponding bridge */ | 305 | corresponding bridge */ |
306 | unsigned int ignore_hotplug:1; /* Ignore hotplug events */ | ||
306 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | 307 | unsigned int d3_delay; /* D3->D0 transition time in ms */ |
307 | unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ | 308 | unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ |
308 | 309 | ||
@@ -1021,6 +1022,11 @@ bool pci_dev_run_wake(struct pci_dev *dev); | |||
1021 | bool pci_check_pme_status(struct pci_dev *dev); | 1022 | bool pci_check_pme_status(struct pci_dev *dev); |
1022 | void pci_pme_wakeup_bus(struct pci_bus *bus); | 1023 | void pci_pme_wakeup_bus(struct pci_bus *bus); |
1023 | 1024 | ||
1025 | static inline void pci_ignore_hotplug(struct pci_dev *dev) | ||
1026 | { | ||
1027 | dev->ignore_hotplug = 1; | ||
1028 | } | ||
1029 | |||
1024 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | 1030 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
1025 | bool enable) | 1031 | bool enable) |
1026 | { | 1032 | { |
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h index 502073a53dd3..b483abd34493 100644 --- a/include/linux/vga_switcheroo.h +++ b/include/linux/vga_switcheroo.h | |||
@@ -64,6 +64,7 @@ int vga_switcheroo_get_client_state(struct pci_dev *dev); | |||
64 | void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); | 64 | void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic); |
65 | 65 | ||
66 | int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); | 66 | int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain); |
67 | void vga_switcheroo_fini_domain_pm_ops(struct device *dev); | ||
67 | int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); | 68 | int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain); |
68 | #else | 69 | #else |
69 | 70 | ||
@@ -82,6 +83,7 @@ static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return | |||
82 | static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} | 83 | static inline void vga_switcheroo_set_dynamic_switch(struct pci_dev *pdev, enum vga_switcheroo_state dynamic) {} |
83 | 84 | ||
84 | static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } | 85 | static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } |
86 | static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {} | ||
85 | static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } | 87 | static inline int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; } |
86 | 88 | ||
87 | #endif | 89 | #endif |
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index 2c02f3a8d2ba..c37bd4d06739 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h | |||
@@ -182,7 +182,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc); | |||
182 | * vga_get()... | 182 | * vga_get()... |
183 | */ | 183 | */ |
184 | 184 | ||
185 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
186 | #ifdef CONFIG_VGA_ARB | 185 | #ifdef CONFIG_VGA_ARB |
187 | extern struct pci_dev *vga_default_device(void); | 186 | extern struct pci_dev *vga_default_device(void); |
188 | extern void vga_set_default_device(struct pci_dev *pdev); | 187 | extern void vga_set_default_device(struct pci_dev *pdev); |
@@ -190,7 +189,6 @@ extern void vga_set_default_device(struct pci_dev *pdev); | |||
190 | static inline struct pci_dev *vga_default_device(void) { return NULL; }; | 189 | static inline struct pci_dev *vga_default_device(void) { return NULL; }; |
191 | static inline void vga_set_default_device(struct pci_dev *pdev) { }; | 190 | static inline void vga_set_default_device(struct pci_dev *pdev) { }; |
192 | #endif | 191 | #endif |
193 | #endif | ||
194 | 192 | ||
195 | /** | 193 | /** |
196 | * vga_conflicts | 194 | * vga_conflicts |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index a0cc2e95ed1b..b996e6cde6bb 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -419,7 +419,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, | |||
419 | alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ | 419 | alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \ |
420 | 1, (name)) | 420 | 1, (name)) |
421 | #define create_singlethread_workqueue(name) \ | 421 | #define create_singlethread_workqueue(name) \ |
422 | alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name)) | 422 | alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name) |
423 | 423 | ||
424 | extern void destroy_workqueue(struct workqueue_struct *wq); | 424 | extern void destroy_workqueue(struct workqueue_struct *wq); |
425 | 425 | ||
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 9b1d42e66cca..d13573bb879e 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -204,6 +204,7 @@ void ipv6_sock_ac_close(struct sock *sk); | |||
204 | 204 | ||
205 | int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr); | 205 | int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr); |
206 | int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); | 206 | int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); |
207 | void ipv6_ac_destroy_dev(struct inet6_dev *idev); | ||
207 | bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, | 208 | bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev, |
208 | const struct in6_addr *addr); | 209 | const struct in6_addr *addr); |
209 | bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev, | 210 | bool ipv6_chk_acast_addr_src(struct net *net, struct net_device *dev, |
diff --git a/include/net/dst.h b/include/net/dst.h index 71c60f42be48..a8ae4e760778 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -480,6 +480,7 @@ void dst_init(void); | |||
480 | /* Flags for xfrm_lookup flags argument. */ | 480 | /* Flags for xfrm_lookup flags argument. */ |
481 | enum { | 481 | enum { |
482 | XFRM_LOOKUP_ICMP = 1 << 0, | 482 | XFRM_LOOKUP_ICMP = 1 << 0, |
483 | XFRM_LOOKUP_QUEUE = 1 << 1, | ||
483 | }; | 484 | }; |
484 | 485 | ||
485 | struct flowi; | 486 | struct flowi; |
@@ -490,7 +491,16 @@ static inline struct dst_entry *xfrm_lookup(struct net *net, | |||
490 | int flags) | 491 | int flags) |
491 | { | 492 | { |
492 | return dst_orig; | 493 | return dst_orig; |
493 | } | 494 | } |
495 | |||
496 | static inline struct dst_entry *xfrm_lookup_route(struct net *net, | ||
497 | struct dst_entry *dst_orig, | ||
498 | const struct flowi *fl, | ||
499 | struct sock *sk, | ||
500 | int flags) | ||
501 | { | ||
502 | return dst_orig; | ||
503 | } | ||
494 | 504 | ||
495 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) | 505 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) |
496 | { | 506 | { |
@@ -502,6 +512,10 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
502 | const struct flowi *fl, struct sock *sk, | 512 | const struct flowi *fl, struct sock *sk, |
503 | int flags); | 513 | int flags); |
504 | 514 | ||
515 | struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, | ||
516 | const struct flowi *fl, struct sock *sk, | ||
517 | int flags); | ||
518 | |||
505 | /* skb attached with this dst needs transformation if dst->xfrm is valid */ | 519 | /* skb attached with this dst needs transformation if dst->xfrm is valid */ |
506 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) | 520 | static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) |
507 | { | 521 | { |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 93695f0e22a5..af10c2cf8a1d 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -394,4 +394,12 @@ static inline int genl_set_err(struct genl_family *family, struct net *net, | |||
394 | return netlink_set_err(net->genl_sock, portid, group, code); | 394 | return netlink_set_err(net->genl_sock, portid, group, code); |
395 | } | 395 | } |
396 | 396 | ||
397 | static inline int genl_has_listeners(struct genl_family *family, | ||
398 | struct sock *sk, unsigned int group) | ||
399 | { | ||
400 | if (WARN_ON_ONCE(group >= family->n_mcgrps)) | ||
401 | return -EINVAL; | ||
402 | group = family->mcgrp_offset + group; | ||
403 | return netlink_has_listeners(sk, group); | ||
404 | } | ||
397 | #endif /* __NET_GENERIC_NETLINK_H */ | 405 | #endif /* __NET_GENERIC_NETLINK_H */ |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 1e89b9ad3a4c..e65b8e0752af 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -232,7 +232,8 @@ struct qdisc_skb_cb { | |||
232 | unsigned int pkt_len; | 232 | unsigned int pkt_len; |
233 | u16 slave_dev_queue_mapping; | 233 | u16 slave_dev_queue_mapping; |
234 | u16 _pad; | 234 | u16 _pad; |
235 | unsigned char data[24]; | 235 | #define QDISC_CB_PRIV_LEN 20 |
236 | unsigned char data[QDISC_CB_PRIV_LEN]; | ||
236 | }; | 237 | }; |
237 | 238 | ||
238 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) | 239 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) |
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index cdcc90b07ecb..e64583560701 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -68,7 +68,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) | |||
68 | return; | 68 | return; |
69 | 69 | ||
70 | if (!shost_use_blk_mq(sdev->host) && | 70 | if (!shost_use_blk_mq(sdev->host) && |
71 | blk_queue_tagged(sdev->request_queue)) | 71 | !blk_queue_tagged(sdev->request_queue)) |
72 | blk_queue_init_tags(sdev->request_queue, depth, | 72 | blk_queue_init_tags(sdev->request_queue, depth, |
73 | sdev->host->bqt); | 73 | sdev->host->bqt); |
74 | 74 | ||
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index fb3f7b675229..70e150ebc6c9 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
@@ -241,6 +241,7 @@ header-y += matroxfb.h | |||
241 | header-y += mdio.h | 241 | header-y += mdio.h |
242 | header-y += media.h | 242 | header-y += media.h |
243 | header-y += mei.h | 243 | header-y += mei.h |
244 | header-y += memfd.h | ||
244 | header-y += mempolicy.h | 245 | header-y += mempolicy.h |
245 | header-y += meye.h | 246 | header-y += meye.h |
246 | header-y += mic_common.h | 247 | header-y += mic_common.h |
@@ -396,6 +397,7 @@ header-y += un.h | |||
396 | header-y += unistd.h | 397 | header-y += unistd.h |
397 | header-y += unix_diag.h | 398 | header-y += unix_diag.h |
398 | header-y += usbdevice_fs.h | 399 | header-y += usbdevice_fs.h |
400 | header-y += usbip.h | ||
399 | header-y += utime.h | 401 | header-y += utime.h |
400 | header-y += utsname.h | 402 | header-y += utsname.h |
401 | header-y += uuid.h | 403 | header-y += uuid.h |
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 19df18c9b8be..1874ebe9ac1e 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h | |||
@@ -165,6 +165,7 @@ struct input_keymap_entry { | |||
165 | #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ | 165 | #define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ |
166 | #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ | 166 | #define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ |
167 | #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ | 167 | #define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ |
168 | #define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ | ||
168 | 169 | ||
169 | #define INPUT_PROP_MAX 0x1f | 170 | #define INPUT_PROP_MAX 0x1f |
170 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) | 171 | #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) |
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h index 131a6ccdba25..14334d0161d5 100644 --- a/include/xen/interface/features.h +++ b/include/xen/interface/features.h | |||
@@ -53,6 +53,9 @@ | |||
53 | /* operation as Dom0 is supported */ | 53 | /* operation as Dom0 is supported */ |
54 | #define XENFEAT_dom0 11 | 54 | #define XENFEAT_dom0 11 |
55 | 55 | ||
56 | /* Xen also maps grant references at pfn = mfn */ | ||
57 | #define XENFEAT_grant_map_identity 12 | ||
58 | |||
56 | #define XENFEAT_NR_SUBMAPS 1 | 59 | #define XENFEAT_NR_SUBMAPS 1 |
57 | 60 | ||
58 | #endif /* __XEN_PUBLIC_FEATURES_H__ */ | 61 | #endif /* __XEN_PUBLIC_FEATURES_H__ */ |
diff --git a/init/do_mounts.c b/init/do_mounts.c index b6237c31b0e2..82f22885c87e 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
@@ -539,6 +539,12 @@ void __init prepare_namespace(void) | |||
539 | { | 539 | { |
540 | int is_floppy; | 540 | int is_floppy; |
541 | 541 | ||
542 | if (root_delay) { | ||
543 | printk(KERN_INFO "Waiting %d sec before mounting root device...\n", | ||
544 | root_delay); | ||
545 | ssleep(root_delay); | ||
546 | } | ||
547 | |||
542 | /* | 548 | /* |
543 | * wait for the known devices to complete their probing | 549 | * wait for the known devices to complete their probing |
544 | * | 550 | * |
@@ -565,12 +571,6 @@ void __init prepare_namespace(void) | |||
565 | if (initrd_load()) | 571 | if (initrd_load()) |
566 | goto out; | 572 | goto out; |
567 | 573 | ||
568 | if (root_delay) { | ||
569 | pr_info("Waiting %d sec before mounting root device...\n", | ||
570 | root_delay); | ||
571 | ssleep(root_delay); | ||
572 | } | ||
573 | |||
574 | /* wait for any asynchronous scanning to complete */ | 574 | /* wait for any asynchronous scanning to complete */ |
575 | if ((ROOT_DEV == 0) && root_wait) { | 575 | if ((ROOT_DEV == 0) && root_wait) { |
576 | printk(KERN_INFO "Waiting for root device %s...\n", | 576 | printk(KERN_INFO "Waiting for root device %s...\n", |
diff --git a/kernel/events/core.c b/kernel/events/core.c index f9c1ed002dbc..d640a8b4dcbc 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -1524,6 +1524,11 @@ retry: | |||
1524 | */ | 1524 | */ |
1525 | if (ctx->is_active) { | 1525 | if (ctx->is_active) { |
1526 | raw_spin_unlock_irq(&ctx->lock); | 1526 | raw_spin_unlock_irq(&ctx->lock); |
1527 | /* | ||
1528 | * Reload the task pointer, it might have been changed by | ||
1529 | * a concurrent perf_event_context_sched_out(). | ||
1530 | */ | ||
1531 | task = ctx->task; | ||
1527 | goto retry; | 1532 | goto retry; |
1528 | } | 1533 | } |
1529 | 1534 | ||
@@ -1967,6 +1972,11 @@ retry: | |||
1967 | */ | 1972 | */ |
1968 | if (ctx->is_active) { | 1973 | if (ctx->is_active) { |
1969 | raw_spin_unlock_irq(&ctx->lock); | 1974 | raw_spin_unlock_irq(&ctx->lock); |
1975 | /* | ||
1976 | * Reload the task pointer, it might have been changed by | ||
1977 | * a concurrent perf_event_context_sched_out(). | ||
1978 | */ | ||
1979 | task = ctx->task; | ||
1970 | goto retry; | 1980 | goto retry; |
1971 | } | 1981 | } |
1972 | 1982 | ||
diff --git a/kernel/futex.c b/kernel/futex.c index d3a9d946d0b7..815d7af2ffe8 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -2592,6 +2592,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, | |||
2592 | * shared futexes. We need to compare the keys: | 2592 | * shared futexes. We need to compare the keys: |
2593 | */ | 2593 | */ |
2594 | if (match_futex(&q.key, &key2)) { | 2594 | if (match_futex(&q.key, &key2)) { |
2595 | queue_unlock(hb); | ||
2595 | ret = -EINVAL; | 2596 | ret = -EINVAL; |
2596 | goto out_put_keys; | 2597 | goto out_put_keys; |
2597 | } | 2598 | } |
diff --git a/kernel/kcmp.c b/kernel/kcmp.c index e30ac0fe61c3..0aa69ea1d8fd 100644 --- a/kernel/kcmp.c +++ b/kernel/kcmp.c | |||
@@ -44,11 +44,12 @@ static long kptr_obfuscate(long v, int type) | |||
44 | */ | 44 | */ |
45 | static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type) | 45 | static int kcmp_ptr(void *v1, void *v2, enum kcmp_type type) |
46 | { | 46 | { |
47 | long ret; | 47 | long t1, t2; |
48 | 48 | ||
49 | ret = kptr_obfuscate((long)v1, type) - kptr_obfuscate((long)v2, type); | 49 | t1 = kptr_obfuscate((long)v1, type); |
50 | t2 = kptr_obfuscate((long)v2, type); | ||
50 | 51 | ||
51 | return (ret < 0) | ((ret > 0) << 1); | 52 | return (t1 < t2) | ((t1 > t2) << 1); |
52 | } | 53 | } |
53 | 54 | ||
54 | /* The caller must have pinned the task */ | 55 | /* The caller must have pinned the task */ |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e04c455a0e38..1ce770687ea8 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -1665,15 +1665,15 @@ asmlinkage int vprintk_emit(int facility, int level, | |||
1665 | raw_spin_lock(&logbuf_lock); | 1665 | raw_spin_lock(&logbuf_lock); |
1666 | logbuf_cpu = this_cpu; | 1666 | logbuf_cpu = this_cpu; |
1667 | 1667 | ||
1668 | if (recursion_bug) { | 1668 | if (unlikely(recursion_bug)) { |
1669 | static const char recursion_msg[] = | 1669 | static const char recursion_msg[] = |
1670 | "BUG: recent printk recursion!"; | 1670 | "BUG: recent printk recursion!"; |
1671 | 1671 | ||
1672 | recursion_bug = 0; | 1672 | recursion_bug = 0; |
1673 | text_len = strlen(recursion_msg); | ||
1674 | /* emit KERN_CRIT message */ | 1673 | /* emit KERN_CRIT message */ |
1675 | printed_len += log_store(0, 2, LOG_PREFIX|LOG_NEWLINE, 0, | 1674 | printed_len += log_store(0, 2, LOG_PREFIX|LOG_NEWLINE, 0, |
1676 | NULL, 0, recursion_msg, text_len); | 1675 | NULL, 0, recursion_msg, |
1676 | strlen(recursion_msg)); | ||
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | /* | 1679 | /* |
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 4aec4a457431..a7077d3ae52f 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
@@ -464,18 +464,26 @@ static enum alarmtimer_type clock2alarm(clockid_t clockid) | |||
464 | static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, | 464 | static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, |
465 | ktime_t now) | 465 | ktime_t now) |
466 | { | 466 | { |
467 | unsigned long flags; | ||
467 | struct k_itimer *ptr = container_of(alarm, struct k_itimer, | 468 | struct k_itimer *ptr = container_of(alarm, struct k_itimer, |
468 | it.alarm.alarmtimer); | 469 | it.alarm.alarmtimer); |
469 | if (posix_timer_event(ptr, 0) != 0) | 470 | enum alarmtimer_restart result = ALARMTIMER_NORESTART; |
470 | ptr->it_overrun++; | 471 | |
472 | spin_lock_irqsave(&ptr->it_lock, flags); | ||
473 | if ((ptr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) { | ||
474 | if (posix_timer_event(ptr, 0) != 0) | ||
475 | ptr->it_overrun++; | ||
476 | } | ||
471 | 477 | ||
472 | /* Re-add periodic timers */ | 478 | /* Re-add periodic timers */ |
473 | if (ptr->it.alarm.interval.tv64) { | 479 | if (ptr->it.alarm.interval.tv64) { |
474 | ptr->it_overrun += alarm_forward(alarm, now, | 480 | ptr->it_overrun += alarm_forward(alarm, now, |
475 | ptr->it.alarm.interval); | 481 | ptr->it.alarm.interval); |
476 | return ALARMTIMER_RESTART; | 482 | result = ALARMTIMER_RESTART; |
477 | } | 483 | } |
478 | return ALARMTIMER_NORESTART; | 484 | spin_unlock_irqrestore(&ptr->it_lock, flags); |
485 | |||
486 | return result; | ||
479 | } | 487 | } |
480 | 488 | ||
481 | /** | 489 | /** |
@@ -541,18 +549,22 @@ static int alarm_timer_create(struct k_itimer *new_timer) | |||
541 | * @new_timer: k_itimer pointer | 549 | * @new_timer: k_itimer pointer |
542 | * @cur_setting: itimerspec data to fill | 550 | * @cur_setting: itimerspec data to fill |
543 | * | 551 | * |
544 | * Copies the itimerspec data out from the k_itimer | 552 | * Copies out the current itimerspec data |
545 | */ | 553 | */ |
546 | static void alarm_timer_get(struct k_itimer *timr, | 554 | static void alarm_timer_get(struct k_itimer *timr, |
547 | struct itimerspec *cur_setting) | 555 | struct itimerspec *cur_setting) |
548 | { | 556 | { |
549 | memset(cur_setting, 0, sizeof(struct itimerspec)); | 557 | ktime_t relative_expiry_time = |
558 | alarm_expires_remaining(&(timr->it.alarm.alarmtimer)); | ||
559 | |||
560 | if (ktime_to_ns(relative_expiry_time) > 0) { | ||
561 | cur_setting->it_value = ktime_to_timespec(relative_expiry_time); | ||
562 | } else { | ||
563 | cur_setting->it_value.tv_sec = 0; | ||
564 | cur_setting->it_value.tv_nsec = 0; | ||
565 | } | ||
550 | 566 | ||
551 | cur_setting->it_interval = | 567 | cur_setting->it_interval = ktime_to_timespec(timr->it.alarm.interval); |
552 | ktime_to_timespec(timr->it.alarm.interval); | ||
553 | cur_setting->it_value = | ||
554 | ktime_to_timespec(timr->it.alarm.alarmtimer.node.expires); | ||
555 | return; | ||
556 | } | 568 | } |
557 | 569 | ||
558 | /** | 570 | /** |
diff --git a/kernel/time/time.c b/kernel/time/time.c index f0294ba14634..a9ae20fb0b11 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c | |||
@@ -559,17 +559,20 @@ EXPORT_SYMBOL(usecs_to_jiffies); | |||
559 | * that a remainder subtract here would not do the right thing as the | 559 | * that a remainder subtract here would not do the right thing as the |
560 | * resolution values don't fall on second boundries. I.e. the line: | 560 | * resolution values don't fall on second boundries. I.e. the line: |
561 | * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding. | 561 | * nsec -= nsec % TICK_NSEC; is NOT a correct resolution rounding. |
562 | * Note that due to the small error in the multiplier here, this | ||
563 | * rounding is incorrect for sufficiently large values of tv_nsec, but | ||
564 | * well formed timespecs should have tv_nsec < NSEC_PER_SEC, so we're | ||
565 | * OK. | ||
562 | * | 566 | * |
563 | * Rather, we just shift the bits off the right. | 567 | * Rather, we just shift the bits off the right. |
564 | * | 568 | * |
565 | * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec | 569 | * The >> (NSEC_JIFFIE_SC - SEC_JIFFIE_SC) converts the scaled nsec |
566 | * value to a scaled second value. | 570 | * value to a scaled second value. |
567 | */ | 571 | */ |
568 | unsigned long | 572 | static unsigned long |
569 | timespec_to_jiffies(const struct timespec *value) | 573 | __timespec_to_jiffies(unsigned long sec, long nsec) |
570 | { | 574 | { |
571 | unsigned long sec = value->tv_sec; | 575 | nsec = nsec + TICK_NSEC - 1; |
572 | long nsec = value->tv_nsec + TICK_NSEC - 1; | ||
573 | 576 | ||
574 | if (sec >= MAX_SEC_IN_JIFFIES){ | 577 | if (sec >= MAX_SEC_IN_JIFFIES){ |
575 | sec = MAX_SEC_IN_JIFFIES; | 578 | sec = MAX_SEC_IN_JIFFIES; |
@@ -580,6 +583,13 @@ timespec_to_jiffies(const struct timespec *value) | |||
580 | (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | 583 | (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; |
581 | 584 | ||
582 | } | 585 | } |
586 | |||
587 | unsigned long | ||
588 | timespec_to_jiffies(const struct timespec *value) | ||
589 | { | ||
590 | return __timespec_to_jiffies(value->tv_sec, value->tv_nsec); | ||
591 | } | ||
592 | |||
583 | EXPORT_SYMBOL(timespec_to_jiffies); | 593 | EXPORT_SYMBOL(timespec_to_jiffies); |
584 | 594 | ||
585 | void | 595 | void |
@@ -596,31 +606,27 @@ jiffies_to_timespec(const unsigned long jiffies, struct timespec *value) | |||
596 | } | 606 | } |
597 | EXPORT_SYMBOL(jiffies_to_timespec); | 607 | EXPORT_SYMBOL(jiffies_to_timespec); |
598 | 608 | ||
599 | /* Same for "timeval" | 609 | /* |
600 | * | 610 | * We could use a similar algorithm to timespec_to_jiffies (with a |
601 | * Well, almost. The problem here is that the real system resolution is | 611 | * different multiplier for usec instead of nsec). But this has a |
602 | * in nanoseconds and the value being converted is in micro seconds. | 612 | * problem with rounding: we can't exactly add TICK_NSEC - 1 to the |
603 | * Also for some machines (those that use HZ = 1024, in-particular), | 613 | * usec value, since it's not necessarily integral. |
604 | * there is a LARGE error in the tick size in microseconds. | 614 | * |
605 | 615 | * We could instead round in the intermediate scaled representation | |
606 | * The solution we use is to do the rounding AFTER we convert the | 616 | * (i.e. in units of 1/2^(large scale) jiffies) but that's also |
607 | * microsecond part. Thus the USEC_ROUND, the bits to be shifted off. | 617 | * perilous: the scaling introduces a small positive error, which |
608 | * Instruction wise, this should cost only an additional add with carry | 618 | * combined with a division-rounding-upward (i.e. adding 2^(scale) - 1 |
609 | * instruction above the way it was done above. | 619 | * units to the intermediate before shifting) leads to accidental |
620 | * overflow and overestimates. | ||
621 | * | ||
622 | * At the cost of one additional multiplication by a constant, just | ||
623 | * use the timespec implementation. | ||
610 | */ | 624 | */ |
611 | unsigned long | 625 | unsigned long |
612 | timeval_to_jiffies(const struct timeval *value) | 626 | timeval_to_jiffies(const struct timeval *value) |
613 | { | 627 | { |
614 | unsigned long sec = value->tv_sec; | 628 | return __timespec_to_jiffies(value->tv_sec, |
615 | long usec = value->tv_usec; | 629 | value->tv_usec * NSEC_PER_USEC); |
616 | |||
617 | if (sec >= MAX_SEC_IN_JIFFIES){ | ||
618 | sec = MAX_SEC_IN_JIFFIES; | ||
619 | usec = 0; | ||
620 | } | ||
621 | return (((u64)sec * SEC_CONVERSION) + | ||
622 | (((u64)usec * USEC_CONVERSION + USEC_ROUND) >> | ||
623 | (USEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | ||
624 | } | 630 | } |
625 | EXPORT_SYMBOL(timeval_to_jiffies); | 631 | EXPORT_SYMBOL(timeval_to_jiffies); |
626 | 632 | ||
diff --git a/lib/Kconfig b/lib/Kconfig index a5ce0c7f6c30..54cf309a92a5 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -51,6 +51,9 @@ config PERCPU_RWSEM | |||
51 | config ARCH_USE_CMPXCHG_LOCKREF | 51 | config ARCH_USE_CMPXCHG_LOCKREF |
52 | bool | 52 | bool |
53 | 53 | ||
54 | config ARCH_HAS_FAST_MULTIPLIER | ||
55 | bool | ||
56 | |||
54 | config CRC_CCITT | 57 | config CRC_CCITT |
55 | tristate "CRC-CCITT functions" | 58 | tristate "CRC-CCITT functions" |
56 | help | 59 | help |
diff --git a/lib/assoc_array.c b/lib/assoc_array.c index ae146f0734eb..2404d03e251a 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c | |||
@@ -1723,11 +1723,13 @@ ascend_old_tree: | |||
1723 | shortcut = assoc_array_ptr_to_shortcut(ptr); | 1723 | shortcut = assoc_array_ptr_to_shortcut(ptr); |
1724 | slot = shortcut->parent_slot; | 1724 | slot = shortcut->parent_slot; |
1725 | cursor = shortcut->back_pointer; | 1725 | cursor = shortcut->back_pointer; |
1726 | if (!cursor) | ||
1727 | goto gc_complete; | ||
1726 | } else { | 1728 | } else { |
1727 | slot = node->parent_slot; | 1729 | slot = node->parent_slot; |
1728 | cursor = ptr; | 1730 | cursor = ptr; |
1729 | } | 1731 | } |
1730 | BUG_ON(!ptr); | 1732 | BUG_ON(!cursor); |
1731 | node = assoc_array_ptr_to_node(cursor); | 1733 | node = assoc_array_ptr_to_node(cursor); |
1732 | slot++; | 1734 | slot++; |
1733 | goto continue_node; | 1735 | goto continue_node; |
diff --git a/lib/hweight.c b/lib/hweight.c index b7d81ba143d1..9a5c1f221558 100644 --- a/lib/hweight.c +++ b/lib/hweight.c | |||
@@ -11,7 +11,7 @@ | |||
11 | 11 | ||
12 | unsigned int __sw_hweight32(unsigned int w) | 12 | unsigned int __sw_hweight32(unsigned int w) |
13 | { | 13 | { |
14 | #ifdef ARCH_HAS_FAST_MULTIPLIER | 14 | #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER |
15 | w -= (w >> 1) & 0x55555555; | 15 | w -= (w >> 1) & 0x55555555; |
16 | w = (w & 0x33333333) + ((w >> 2) & 0x33333333); | 16 | w = (w & 0x33333333) + ((w >> 2) & 0x33333333); |
17 | w = (w + (w >> 4)) & 0x0f0f0f0f; | 17 | w = (w + (w >> 4)) & 0x0f0f0f0f; |
@@ -49,7 +49,7 @@ unsigned long __sw_hweight64(__u64 w) | |||
49 | return __sw_hweight32((unsigned int)(w >> 32)) + | 49 | return __sw_hweight32((unsigned int)(w >> 32)) + |
50 | __sw_hweight32((unsigned int)w); | 50 | __sw_hweight32((unsigned int)w); |
51 | #elif BITS_PER_LONG == 64 | 51 | #elif BITS_PER_LONG == 64 |
52 | #ifdef ARCH_HAS_FAST_MULTIPLIER | 52 | #ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER |
53 | w -= (w >> 1) & 0x5555555555555555ul; | 53 | w -= (w >> 1) & 0x5555555555555555ul; |
54 | w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); | 54 | w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); |
55 | w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; | 55 | w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 8dfec3f26d4c..25f14c586ad7 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/hash.h> | 23 | #include <linux/hash.h> |
24 | #include <linux/random.h> | 24 | #include <linux/random.h> |
25 | #include <linux/rhashtable.h> | 25 | #include <linux/rhashtable.h> |
26 | #include <linux/log2.h> | ||
27 | 26 | ||
28 | #define HASH_DEFAULT_SIZE 64UL | 27 | #define HASH_DEFAULT_SIZE 64UL |
29 | #define HASH_MIN_SIZE 4UL | 28 | #define HASH_MIN_SIZE 4UL |
diff --git a/lib/string.c b/lib/string.c index 992bf30af759..f3c6ff596414 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -807,9 +807,9 @@ void *memchr_inv(const void *start, int c, size_t bytes) | |||
807 | return check_bytes8(start, value, bytes); | 807 | return check_bytes8(start, value, bytes); |
808 | 808 | ||
809 | value64 = value; | 809 | value64 = value; |
810 | #if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 | 810 | #if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 |
811 | value64 *= 0x0101010101010101; | 811 | value64 *= 0x0101010101010101; |
812 | #elif defined(ARCH_HAS_FAST_MULTIPLIER) | 812 | #elif defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) |
813 | value64 *= 0x01010101; | 813 | value64 *= 0x01010101; |
814 | value64 |= value64 << 32; | 814 | value64 |= value64 << 32; |
815 | #else | 815 | #else |
diff --git a/mm/dmapool.c b/mm/dmapool.c index 306baa594f95..ba8019b063e1 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c | |||
@@ -176,7 +176,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev, | |||
176 | if (list_empty(&dev->dma_pools) && | 176 | if (list_empty(&dev->dma_pools) && |
177 | device_create_file(dev, &dev_attr_pools)) { | 177 | device_create_file(dev, &dev_attr_pools)) { |
178 | kfree(retval); | 178 | kfree(retval); |
179 | return NULL; | 179 | retval = NULL; |
180 | } else | 180 | } else |
181 | list_add(&retval->pools, &dev->dma_pools); | 181 | list_add(&retval->pools, &dev->dma_pools); |
182 | mutex_unlock(&pools_lock); | 182 | mutex_unlock(&pools_lock); |
diff --git a/mm/memblock.c b/mm/memblock.c index 70fad0c0dafb..6ecb0d937fb5 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -816,6 +816,10 @@ void __init_memblock __next_mem_range(u64 *idx, int nid, | |||
816 | if (nid != NUMA_NO_NODE && nid != m_nid) | 816 | if (nid != NUMA_NO_NODE && nid != m_nid) |
817 | continue; | 817 | continue; |
818 | 818 | ||
819 | /* skip hotpluggable memory regions if needed */ | ||
820 | if (movable_node_is_enabled() && memblock_is_hotpluggable(m)) | ||
821 | continue; | ||
822 | |||
819 | if (!type_b) { | 823 | if (!type_b) { |
820 | if (out_start) | 824 | if (out_start) |
821 | *out_start = m_start; | 825 | *out_start = m_start; |
diff --git a/mm/memory.c b/mm/memory.c index adeac306610f..d17f1bcd2a91 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -118,6 +118,8 @@ __setup("norandmaps", disable_randmaps); | |||
118 | unsigned long zero_pfn __read_mostly; | 118 | unsigned long zero_pfn __read_mostly; |
119 | unsigned long highest_memmap_pfn __read_mostly; | 119 | unsigned long highest_memmap_pfn __read_mostly; |
120 | 120 | ||
121 | EXPORT_SYMBOL(zero_pfn); | ||
122 | |||
121 | /* | 123 | /* |
122 | * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init() | 124 | * CONFIG_MMU architectures set up ZERO_PAGE in their paging_init() |
123 | */ | 125 | */ |
@@ -369,20 +369,20 @@ static int browse_rb(struct rb_root *root) | |||
369 | struct vm_area_struct *vma; | 369 | struct vm_area_struct *vma; |
370 | vma = rb_entry(nd, struct vm_area_struct, vm_rb); | 370 | vma = rb_entry(nd, struct vm_area_struct, vm_rb); |
371 | if (vma->vm_start < prev) { | 371 | if (vma->vm_start < prev) { |
372 | pr_info("vm_start %lx prev %lx\n", vma->vm_start, prev); | 372 | pr_emerg("vm_start %lx prev %lx\n", vma->vm_start, prev); |
373 | bug = 1; | 373 | bug = 1; |
374 | } | 374 | } |
375 | if (vma->vm_start < pend) { | 375 | if (vma->vm_start < pend) { |
376 | pr_info("vm_start %lx pend %lx\n", vma->vm_start, pend); | 376 | pr_emerg("vm_start %lx pend %lx\n", vma->vm_start, pend); |
377 | bug = 1; | 377 | bug = 1; |
378 | } | 378 | } |
379 | if (vma->vm_start > vma->vm_end) { | 379 | if (vma->vm_start > vma->vm_end) { |
380 | pr_info("vm_end %lx < vm_start %lx\n", | 380 | pr_emerg("vm_end %lx < vm_start %lx\n", |
381 | vma->vm_end, vma->vm_start); | 381 | vma->vm_end, vma->vm_start); |
382 | bug = 1; | 382 | bug = 1; |
383 | } | 383 | } |
384 | if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) { | 384 | if (vma->rb_subtree_gap != vma_compute_subtree_gap(vma)) { |
385 | pr_info("free gap %lx, correct %lx\n", | 385 | pr_emerg("free gap %lx, correct %lx\n", |
386 | vma->rb_subtree_gap, | 386 | vma->rb_subtree_gap, |
387 | vma_compute_subtree_gap(vma)); | 387 | vma_compute_subtree_gap(vma)); |
388 | bug = 1; | 388 | bug = 1; |
@@ -396,7 +396,7 @@ static int browse_rb(struct rb_root *root) | |||
396 | for (nd = pn; nd; nd = rb_prev(nd)) | 396 | for (nd = pn; nd; nd = rb_prev(nd)) |
397 | j++; | 397 | j++; |
398 | if (i != j) { | 398 | if (i != j) { |
399 | pr_info("backwards %d, forwards %d\n", j, i); | 399 | pr_emerg("backwards %d, forwards %d\n", j, i); |
400 | bug = 1; | 400 | bug = 1; |
401 | } | 401 | } |
402 | return bug ? -1 : i; | 402 | return bug ? -1 : i; |
@@ -431,17 +431,17 @@ static void validate_mm(struct mm_struct *mm) | |||
431 | i++; | 431 | i++; |
432 | } | 432 | } |
433 | if (i != mm->map_count) { | 433 | if (i != mm->map_count) { |
434 | pr_info("map_count %d vm_next %d\n", mm->map_count, i); | 434 | pr_emerg("map_count %d vm_next %d\n", mm->map_count, i); |
435 | bug = 1; | 435 | bug = 1; |
436 | } | 436 | } |
437 | if (highest_address != mm->highest_vm_end) { | 437 | if (highest_address != mm->highest_vm_end) { |
438 | pr_info("mm->highest_vm_end %lx, found %lx\n", | 438 | pr_emerg("mm->highest_vm_end %lx, found %lx\n", |
439 | mm->highest_vm_end, highest_address); | 439 | mm->highest_vm_end, highest_address); |
440 | bug = 1; | 440 | bug = 1; |
441 | } | 441 | } |
442 | i = browse_rb(&mm->mm_rb); | 442 | i = browse_rb(&mm->mm_rb); |
443 | if (i != mm->map_count) { | 443 | if (i != mm->map_count) { |
444 | pr_info("map_count %d rb %d\n", mm->map_count, i); | 444 | pr_emerg("map_count %d rb %d\n", mm->map_count, i); |
445 | bug = 1; | 445 | bug = 1; |
446 | } | 446 | } |
447 | BUG_ON(bug); | 447 | BUG_ON(bug); |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 7ed58602e71b..7c7ab32ee503 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -119,6 +119,8 @@ static unsigned long __init free_low_memory_core_early(void) | |||
119 | phys_addr_t start, end; | 119 | phys_addr_t start, end; |
120 | u64 i; | 120 | u64 i; |
121 | 121 | ||
122 | memblock_clear_hotplug(0, -1); | ||
123 | |||
122 | for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) | 124 | for_each_free_mem_range(i, NUMA_NO_NODE, &start, &end, NULL) |
123 | count += __free_memory_core(start, end); | 125 | count += __free_memory_core(start, end); |
124 | 126 | ||
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 62a7fa2e3569..b6c04cbcfdc5 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -309,6 +309,9 @@ struct br_input_skb_cb { | |||
309 | int igmp; | 309 | int igmp; |
310 | int mrouters_only; | 310 | int mrouters_only; |
311 | #endif | 311 | #endif |
312 | #ifdef CONFIG_BRIDGE_VLAN_FILTERING | ||
313 | bool vlan_filtered; | ||
314 | #endif | ||
312 | }; | 315 | }; |
313 | 316 | ||
314 | #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) | 317 | #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) |
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c index e1bcd653899b..3ba57fcdcd13 100644 --- a/net/bridge/br_vlan.c +++ b/net/bridge/br_vlan.c | |||
@@ -27,9 +27,13 @@ static void __vlan_add_flags(struct net_port_vlans *v, u16 vid, u16 flags) | |||
27 | { | 27 | { |
28 | if (flags & BRIDGE_VLAN_INFO_PVID) | 28 | if (flags & BRIDGE_VLAN_INFO_PVID) |
29 | __vlan_add_pvid(v, vid); | 29 | __vlan_add_pvid(v, vid); |
30 | else | ||
31 | __vlan_delete_pvid(v, vid); | ||
30 | 32 | ||
31 | if (flags & BRIDGE_VLAN_INFO_UNTAGGED) | 33 | if (flags & BRIDGE_VLAN_INFO_UNTAGGED) |
32 | set_bit(vid, v->untagged_bitmap); | 34 | set_bit(vid, v->untagged_bitmap); |
35 | else | ||
36 | clear_bit(vid, v->untagged_bitmap); | ||
33 | } | 37 | } |
34 | 38 | ||
35 | static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) | 39 | static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags) |
@@ -125,7 +129,8 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, | |||
125 | { | 129 | { |
126 | u16 vid; | 130 | u16 vid; |
127 | 131 | ||
128 | if (!br->vlan_enabled) | 132 | /* If this packet was not filtered at input, let it pass */ |
133 | if (!BR_INPUT_SKB_CB(skb)->vlan_filtered) | ||
129 | goto out; | 134 | goto out; |
130 | 135 | ||
131 | /* Vlan filter table must be configured at this point. The | 136 | /* Vlan filter table must be configured at this point. The |
@@ -164,8 +169,10 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, | |||
164 | /* If VLAN filtering is disabled on the bridge, all packets are | 169 | /* If VLAN filtering is disabled on the bridge, all packets are |
165 | * permitted. | 170 | * permitted. |
166 | */ | 171 | */ |
167 | if (!br->vlan_enabled) | 172 | if (!br->vlan_enabled) { |
173 | BR_INPUT_SKB_CB(skb)->vlan_filtered = false; | ||
168 | return true; | 174 | return true; |
175 | } | ||
169 | 176 | ||
170 | /* If there are no vlan in the permitted list, all packets are | 177 | /* If there are no vlan in the permitted list, all packets are |
171 | * rejected. | 178 | * rejected. |
@@ -173,6 +180,7 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v, | |||
173 | if (!v) | 180 | if (!v) |
174 | goto drop; | 181 | goto drop; |
175 | 182 | ||
183 | BR_INPUT_SKB_CB(skb)->vlan_filtered = true; | ||
176 | proto = br->vlan_proto; | 184 | proto = br->vlan_proto; |
177 | 185 | ||
178 | /* If vlan tx offload is disabled on bridge device and frame was | 186 | /* If vlan tx offload is disabled on bridge device and frame was |
@@ -251,7 +259,8 @@ bool br_allowed_egress(struct net_bridge *br, | |||
251 | { | 259 | { |
252 | u16 vid; | 260 | u16 vid; |
253 | 261 | ||
254 | if (!br->vlan_enabled) | 262 | /* If this packet was not filtered at input, let it pass */ |
263 | if (!BR_INPUT_SKB_CB(skb)->vlan_filtered) | ||
255 | return true; | 264 | return true; |
256 | 265 | ||
257 | if (!v) | 266 | if (!v) |
@@ -270,6 +279,7 @@ bool br_should_learn(struct net_bridge_port *p, struct sk_buff *skb, u16 *vid) | |||
270 | struct net_bridge *br = p->br; | 279 | struct net_bridge *br = p->br; |
271 | struct net_port_vlans *v; | 280 | struct net_port_vlans *v; |
272 | 281 | ||
282 | /* If filtering was disabled at input, let it pass. */ | ||
273 | if (!br->vlan_enabled) | 283 | if (!br->vlan_enabled) |
274 | return true; | 284 | return true; |
275 | 285 | ||
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index 96238ba95f2b..de6662b14e1f 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c | |||
@@ -13,8 +13,6 @@ | |||
13 | #include "auth_x.h" | 13 | #include "auth_x.h" |
14 | #include "auth_x_protocol.h" | 14 | #include "auth_x_protocol.h" |
15 | 15 | ||
16 | #define TEMP_TICKET_BUF_LEN 256 | ||
17 | |||
18 | static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); | 16 | static void ceph_x_validate_tickets(struct ceph_auth_client *ac, int *pneed); |
19 | 17 | ||
20 | static int ceph_x_is_authenticated(struct ceph_auth_client *ac) | 18 | static int ceph_x_is_authenticated(struct ceph_auth_client *ac) |
@@ -64,7 +62,7 @@ static int ceph_x_encrypt(struct ceph_crypto_key *secret, | |||
64 | } | 62 | } |
65 | 63 | ||
66 | static int ceph_x_decrypt(struct ceph_crypto_key *secret, | 64 | static int ceph_x_decrypt(struct ceph_crypto_key *secret, |
67 | void **p, void *end, void *obuf, size_t olen) | 65 | void **p, void *end, void **obuf, size_t olen) |
68 | { | 66 | { |
69 | struct ceph_x_encrypt_header head; | 67 | struct ceph_x_encrypt_header head; |
70 | size_t head_len = sizeof(head); | 68 | size_t head_len = sizeof(head); |
@@ -75,8 +73,14 @@ static int ceph_x_decrypt(struct ceph_crypto_key *secret, | |||
75 | return -EINVAL; | 73 | return -EINVAL; |
76 | 74 | ||
77 | dout("ceph_x_decrypt len %d\n", len); | 75 | dout("ceph_x_decrypt len %d\n", len); |
78 | ret = ceph_decrypt2(secret, &head, &head_len, obuf, &olen, | 76 | if (*obuf == NULL) { |
79 | *p, len); | 77 | *obuf = kmalloc(len, GFP_NOFS); |
78 | if (!*obuf) | ||
79 | return -ENOMEM; | ||
80 | olen = len; | ||
81 | } | ||
82 | |||
83 | ret = ceph_decrypt2(secret, &head, &head_len, *obuf, &olen, *p, len); | ||
80 | if (ret) | 84 | if (ret) |
81 | return ret; | 85 | return ret; |
82 | if (head.struct_v != 1 || le64_to_cpu(head.magic) != CEPHX_ENC_MAGIC) | 86 | if (head.struct_v != 1 || le64_to_cpu(head.magic) != CEPHX_ENC_MAGIC) |
@@ -129,139 +133,120 @@ static void remove_ticket_handler(struct ceph_auth_client *ac, | |||
129 | kfree(th); | 133 | kfree(th); |
130 | } | 134 | } |
131 | 135 | ||
132 | static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | 136 | static int process_one_ticket(struct ceph_auth_client *ac, |
133 | struct ceph_crypto_key *secret, | 137 | struct ceph_crypto_key *secret, |
134 | void *buf, void *end) | 138 | void **p, void *end) |
135 | { | 139 | { |
136 | struct ceph_x_info *xi = ac->private; | 140 | struct ceph_x_info *xi = ac->private; |
137 | int num; | 141 | int type; |
138 | void *p = buf; | 142 | u8 tkt_struct_v, blob_struct_v; |
143 | struct ceph_x_ticket_handler *th; | ||
144 | void *dbuf = NULL; | ||
145 | void *dp, *dend; | ||
146 | int dlen; | ||
147 | char is_enc; | ||
148 | struct timespec validity; | ||
149 | struct ceph_crypto_key old_key; | ||
150 | void *ticket_buf = NULL; | ||
151 | void *tp, *tpend; | ||
152 | struct ceph_timespec new_validity; | ||
153 | struct ceph_crypto_key new_session_key; | ||
154 | struct ceph_buffer *new_ticket_blob; | ||
155 | unsigned long new_expires, new_renew_after; | ||
156 | u64 new_secret_id; | ||
139 | int ret; | 157 | int ret; |
140 | char *dbuf; | ||
141 | char *ticket_buf; | ||
142 | u8 reply_struct_v; | ||
143 | 158 | ||
144 | dbuf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); | 159 | ceph_decode_need(p, end, sizeof(u32) + 1, bad); |
145 | if (!dbuf) | ||
146 | return -ENOMEM; | ||
147 | 160 | ||
148 | ret = -ENOMEM; | 161 | type = ceph_decode_32(p); |
149 | ticket_buf = kmalloc(TEMP_TICKET_BUF_LEN, GFP_NOFS); | 162 | dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); |
150 | if (!ticket_buf) | ||
151 | goto out_dbuf; | ||
152 | 163 | ||
153 | ceph_decode_need(&p, end, 1 + sizeof(u32), bad); | 164 | tkt_struct_v = ceph_decode_8(p); |
154 | reply_struct_v = ceph_decode_8(&p); | 165 | if (tkt_struct_v != 1) |
155 | if (reply_struct_v != 1) | ||
156 | goto bad; | 166 | goto bad; |
157 | num = ceph_decode_32(&p); | ||
158 | dout("%d tickets\n", num); | ||
159 | while (num--) { | ||
160 | int type; | ||
161 | u8 tkt_struct_v, blob_struct_v; | ||
162 | struct ceph_x_ticket_handler *th; | ||
163 | void *dp, *dend; | ||
164 | int dlen; | ||
165 | char is_enc; | ||
166 | struct timespec validity; | ||
167 | struct ceph_crypto_key old_key; | ||
168 | void *tp, *tpend; | ||
169 | struct ceph_timespec new_validity; | ||
170 | struct ceph_crypto_key new_session_key; | ||
171 | struct ceph_buffer *new_ticket_blob; | ||
172 | unsigned long new_expires, new_renew_after; | ||
173 | u64 new_secret_id; | ||
174 | |||
175 | ceph_decode_need(&p, end, sizeof(u32) + 1, bad); | ||
176 | |||
177 | type = ceph_decode_32(&p); | ||
178 | dout(" ticket type %d %s\n", type, ceph_entity_type_name(type)); | ||
179 | |||
180 | tkt_struct_v = ceph_decode_8(&p); | ||
181 | if (tkt_struct_v != 1) | ||
182 | goto bad; | ||
183 | |||
184 | th = get_ticket_handler(ac, type); | ||
185 | if (IS_ERR(th)) { | ||
186 | ret = PTR_ERR(th); | ||
187 | goto out; | ||
188 | } | ||
189 | 167 | ||
190 | /* blob for me */ | 168 | th = get_ticket_handler(ac, type); |
191 | dlen = ceph_x_decrypt(secret, &p, end, dbuf, | 169 | if (IS_ERR(th)) { |
192 | TEMP_TICKET_BUF_LEN); | 170 | ret = PTR_ERR(th); |
193 | if (dlen <= 0) { | 171 | goto out; |
194 | ret = dlen; | 172 | } |
195 | goto out; | ||
196 | } | ||
197 | dout(" decrypted %d bytes\n", dlen); | ||
198 | dend = dbuf + dlen; | ||
199 | dp = dbuf; | ||
200 | 173 | ||
201 | tkt_struct_v = ceph_decode_8(&dp); | 174 | /* blob for me */ |
202 | if (tkt_struct_v != 1) | 175 | dlen = ceph_x_decrypt(secret, p, end, &dbuf, 0); |
203 | goto bad; | 176 | if (dlen <= 0) { |
177 | ret = dlen; | ||
178 | goto out; | ||
179 | } | ||
180 | dout(" decrypted %d bytes\n", dlen); | ||
181 | dp = dbuf; | ||
182 | dend = dp + dlen; | ||
204 | 183 | ||
205 | memcpy(&old_key, &th->session_key, sizeof(old_key)); | 184 | tkt_struct_v = ceph_decode_8(&dp); |
206 | ret = ceph_crypto_key_decode(&new_session_key, &dp, dend); | 185 | if (tkt_struct_v != 1) |
207 | if (ret) | 186 | goto bad; |
208 | goto out; | ||
209 | 187 | ||
210 | ceph_decode_copy(&dp, &new_validity, sizeof(new_validity)); | 188 | memcpy(&old_key, &th->session_key, sizeof(old_key)); |
211 | ceph_decode_timespec(&validity, &new_validity); | 189 | ret = ceph_crypto_key_decode(&new_session_key, &dp, dend); |
212 | new_expires = get_seconds() + validity.tv_sec; | 190 | if (ret) |
213 | new_renew_after = new_expires - (validity.tv_sec / 4); | 191 | goto out; |
214 | dout(" expires=%lu renew_after=%lu\n", new_expires, | ||
215 | new_renew_after); | ||
216 | 192 | ||
217 | /* ticket blob for service */ | 193 | ceph_decode_copy(&dp, &new_validity, sizeof(new_validity)); |
218 | ceph_decode_8_safe(&p, end, is_enc, bad); | 194 | ceph_decode_timespec(&validity, &new_validity); |
219 | tp = ticket_buf; | 195 | new_expires = get_seconds() + validity.tv_sec; |
220 | if (is_enc) { | 196 | new_renew_after = new_expires - (validity.tv_sec / 4); |
221 | /* encrypted */ | 197 | dout(" expires=%lu renew_after=%lu\n", new_expires, |
222 | dout(" encrypted ticket\n"); | 198 | new_renew_after); |
223 | dlen = ceph_x_decrypt(&old_key, &p, end, ticket_buf, | 199 | |
224 | TEMP_TICKET_BUF_LEN); | 200 | /* ticket blob for service */ |
225 | if (dlen < 0) { | 201 | ceph_decode_8_safe(p, end, is_enc, bad); |
226 | ret = dlen; | 202 | if (is_enc) { |
227 | goto out; | 203 | /* encrypted */ |
228 | } | 204 | dout(" encrypted ticket\n"); |
229 | dlen = ceph_decode_32(&tp); | 205 | dlen = ceph_x_decrypt(&old_key, p, end, &ticket_buf, 0); |
230 | } else { | 206 | if (dlen < 0) { |
231 | /* unencrypted */ | 207 | ret = dlen; |
232 | ceph_decode_32_safe(&p, end, dlen, bad); | 208 | goto out; |
233 | ceph_decode_need(&p, end, dlen, bad); | ||
234 | ceph_decode_copy(&p, ticket_buf, dlen); | ||
235 | } | 209 | } |
236 | tpend = tp + dlen; | 210 | tp = ticket_buf; |
237 | dout(" ticket blob is %d bytes\n", dlen); | 211 | dlen = ceph_decode_32(&tp); |
238 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); | 212 | } else { |
239 | blob_struct_v = ceph_decode_8(&tp); | 213 | /* unencrypted */ |
240 | new_secret_id = ceph_decode_64(&tp); | 214 | ceph_decode_32_safe(p, end, dlen, bad); |
241 | ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); | 215 | ticket_buf = kmalloc(dlen, GFP_NOFS); |
242 | if (ret) | 216 | if (!ticket_buf) { |
217 | ret = -ENOMEM; | ||
243 | goto out; | 218 | goto out; |
244 | 219 | } | |
245 | /* all is well, update our ticket */ | 220 | tp = ticket_buf; |
246 | ceph_crypto_key_destroy(&th->session_key); | 221 | ceph_decode_need(p, end, dlen, bad); |
247 | if (th->ticket_blob) | 222 | ceph_decode_copy(p, ticket_buf, dlen); |
248 | ceph_buffer_put(th->ticket_blob); | ||
249 | th->session_key = new_session_key; | ||
250 | th->ticket_blob = new_ticket_blob; | ||
251 | th->validity = new_validity; | ||
252 | th->secret_id = new_secret_id; | ||
253 | th->expires = new_expires; | ||
254 | th->renew_after = new_renew_after; | ||
255 | dout(" got ticket service %d (%s) secret_id %lld len %d\n", | ||
256 | type, ceph_entity_type_name(type), th->secret_id, | ||
257 | (int)th->ticket_blob->vec.iov_len); | ||
258 | xi->have_keys |= th->service; | ||
259 | } | 223 | } |
224 | tpend = tp + dlen; | ||
225 | dout(" ticket blob is %d bytes\n", dlen); | ||
226 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); | ||
227 | blob_struct_v = ceph_decode_8(&tp); | ||
228 | new_secret_id = ceph_decode_64(&tp); | ||
229 | ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); | ||
230 | if (ret) | ||
231 | goto out; | ||
232 | |||
233 | /* all is well, update our ticket */ | ||
234 | ceph_crypto_key_destroy(&th->session_key); | ||
235 | if (th->ticket_blob) | ||
236 | ceph_buffer_put(th->ticket_blob); | ||
237 | th->session_key = new_session_key; | ||
238 | th->ticket_blob = new_ticket_blob; | ||
239 | th->validity = new_validity; | ||
240 | th->secret_id = new_secret_id; | ||
241 | th->expires = new_expires; | ||
242 | th->renew_after = new_renew_after; | ||
243 | dout(" got ticket service %d (%s) secret_id %lld len %d\n", | ||
244 | type, ceph_entity_type_name(type), th->secret_id, | ||
245 | (int)th->ticket_blob->vec.iov_len); | ||
246 | xi->have_keys |= th->service; | ||
260 | 247 | ||
261 | ret = 0; | ||
262 | out: | 248 | out: |
263 | kfree(ticket_buf); | 249 | kfree(ticket_buf); |
264 | out_dbuf: | ||
265 | kfree(dbuf); | 250 | kfree(dbuf); |
266 | return ret; | 251 | return ret; |
267 | 252 | ||
@@ -270,6 +255,34 @@ bad: | |||
270 | goto out; | 255 | goto out; |
271 | } | 256 | } |
272 | 257 | ||
258 | static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | ||
259 | struct ceph_crypto_key *secret, | ||
260 | void *buf, void *end) | ||
261 | { | ||
262 | void *p = buf; | ||
263 | u8 reply_struct_v; | ||
264 | u32 num; | ||
265 | int ret; | ||
266 | |||
267 | ceph_decode_8_safe(&p, end, reply_struct_v, bad); | ||
268 | if (reply_struct_v != 1) | ||
269 | return -EINVAL; | ||
270 | |||
271 | ceph_decode_32_safe(&p, end, num, bad); | ||
272 | dout("%d tickets\n", num); | ||
273 | |||
274 | while (num--) { | ||
275 | ret = process_one_ticket(ac, secret, &p, end); | ||
276 | if (ret) | ||
277 | return ret; | ||
278 | } | ||
279 | |||
280 | return 0; | ||
281 | |||
282 | bad: | ||
283 | return -EINVAL; | ||
284 | } | ||
285 | |||
273 | static int ceph_x_build_authorizer(struct ceph_auth_client *ac, | 286 | static int ceph_x_build_authorizer(struct ceph_auth_client *ac, |
274 | struct ceph_x_ticket_handler *th, | 287 | struct ceph_x_ticket_handler *th, |
275 | struct ceph_x_authorizer *au) | 288 | struct ceph_x_authorizer *au) |
@@ -583,13 +596,14 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, | |||
583 | struct ceph_x_ticket_handler *th; | 596 | struct ceph_x_ticket_handler *th; |
584 | int ret = 0; | 597 | int ret = 0; |
585 | struct ceph_x_authorize_reply reply; | 598 | struct ceph_x_authorize_reply reply; |
599 | void *preply = &reply; | ||
586 | void *p = au->reply_buf; | 600 | void *p = au->reply_buf; |
587 | void *end = p + sizeof(au->reply_buf); | 601 | void *end = p + sizeof(au->reply_buf); |
588 | 602 | ||
589 | th = get_ticket_handler(ac, au->service); | 603 | th = get_ticket_handler(ac, au->service); |
590 | if (IS_ERR(th)) | 604 | if (IS_ERR(th)) |
591 | return PTR_ERR(th); | 605 | return PTR_ERR(th); |
592 | ret = ceph_x_decrypt(&th->session_key, &p, end, &reply, sizeof(reply)); | 606 | ret = ceph_x_decrypt(&th->session_key, &p, end, &preply, sizeof(reply)); |
593 | if (ret < 0) | 607 | if (ret < 0) |
594 | return ret; | 608 | return ret; |
595 | if (ret != sizeof(reply)) | 609 | if (ret != sizeof(reply)) |
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 067d3af2eaf6..61fcfc304f68 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -1181,7 +1181,15 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, | |||
1181 | if (!m) { | 1181 | if (!m) { |
1182 | pr_info("alloc_msg unknown type %d\n", type); | 1182 | pr_info("alloc_msg unknown type %d\n", type); |
1183 | *skip = 1; | 1183 | *skip = 1; |
1184 | } else if (front_len > m->front_alloc_len) { | ||
1185 | pr_warning("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n", | ||
1186 | front_len, m->front_alloc_len, | ||
1187 | (unsigned int)con->peer_name.type, | ||
1188 | le64_to_cpu(con->peer_name.num)); | ||
1189 | ceph_msg_put(m); | ||
1190 | m = ceph_msg_new(type, front_len, GFP_NOFS, false); | ||
1184 | } | 1191 | } |
1192 | |||
1185 | return m; | 1193 | return m; |
1186 | } | 1194 | } |
1187 | 1195 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 52cd71a4a343..db0388607329 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4865,9 +4865,14 @@ static void netdev_adjacent_sysfs_del(struct net_device *dev, | |||
4865 | sysfs_remove_link(&(dev->dev.kobj), linkname); | 4865 | sysfs_remove_link(&(dev->dev.kobj), linkname); |
4866 | } | 4866 | } |
4867 | 4867 | ||
4868 | #define netdev_adjacent_is_neigh_list(dev, dev_list) \ | 4868 | static inline bool netdev_adjacent_is_neigh_list(struct net_device *dev, |
4869 | (dev_list == &dev->adj_list.upper || \ | 4869 | struct net_device *adj_dev, |
4870 | dev_list == &dev->adj_list.lower) | 4870 | struct list_head *dev_list) |
4871 | { | ||
4872 | return (dev_list == &dev->adj_list.upper || | ||
4873 | dev_list == &dev->adj_list.lower) && | ||
4874 | net_eq(dev_net(dev), dev_net(adj_dev)); | ||
4875 | } | ||
4871 | 4876 | ||
4872 | static int __netdev_adjacent_dev_insert(struct net_device *dev, | 4877 | static int __netdev_adjacent_dev_insert(struct net_device *dev, |
4873 | struct net_device *adj_dev, | 4878 | struct net_device *adj_dev, |
@@ -4897,7 +4902,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev, | |||
4897 | pr_debug("dev_hold for %s, because of link added from %s to %s\n", | 4902 | pr_debug("dev_hold for %s, because of link added from %s to %s\n", |
4898 | adj_dev->name, dev->name, adj_dev->name); | 4903 | adj_dev->name, dev->name, adj_dev->name); |
4899 | 4904 | ||
4900 | if (netdev_adjacent_is_neigh_list(dev, dev_list)) { | 4905 | if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) { |
4901 | ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); | 4906 | ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list); |
4902 | if (ret) | 4907 | if (ret) |
4903 | goto free_adj; | 4908 | goto free_adj; |
@@ -4918,7 +4923,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev, | |||
4918 | return 0; | 4923 | return 0; |
4919 | 4924 | ||
4920 | remove_symlinks: | 4925 | remove_symlinks: |
4921 | if (netdev_adjacent_is_neigh_list(dev, dev_list)) | 4926 | if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) |
4922 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); | 4927 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); |
4923 | free_adj: | 4928 | free_adj: |
4924 | kfree(adj); | 4929 | kfree(adj); |
@@ -4951,8 +4956,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev, | |||
4951 | if (adj->master) | 4956 | if (adj->master) |
4952 | sysfs_remove_link(&(dev->dev.kobj), "master"); | 4957 | sysfs_remove_link(&(dev->dev.kobj), "master"); |
4953 | 4958 | ||
4954 | if (netdev_adjacent_is_neigh_list(dev, dev_list) && | 4959 | if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) |
4955 | net_eq(dev_net(dev),dev_net(adj_dev))) | ||
4956 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); | 4960 | netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list); |
4957 | 4961 | ||
4958 | list_del_rcu(&adj->list); | 4962 | list_del_rcu(&adj->list); |
diff --git a/net/core/sock.c b/net/core/sock.c index de887c45c63b..e5ad7d31c3c2 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1816,7 +1816,7 @@ EXPORT_SYMBOL(sock_alloc_send_skb); | |||
1816 | * skb_page_frag_refill - check that a page_frag contains enough room | 1816 | * skb_page_frag_refill - check that a page_frag contains enough room |
1817 | * @sz: minimum size of the fragment we want to get | 1817 | * @sz: minimum size of the fragment we want to get |
1818 | * @pfrag: pointer to page_frag | 1818 | * @pfrag: pointer to page_frag |
1819 | * @prio: priority for memory allocation | 1819 | * @gfp: priority for memory allocation |
1820 | * | 1820 | * |
1821 | * Note: While this allocator tries to use high order pages, there is | 1821 | * Note: While this allocator tries to use high order pages, there is |
1822 | * no guarantee that allocations succeed. Therefore, @sz MUST be | 1822 | * no guarantee that allocations succeed. Therefore, @sz MUST be |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index e3a3dc91e49c..b75b47b0a223 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -80,10 +80,10 @@ static void __tunnel_dst_set(struct ip_tunnel_dst *idst, | |||
80 | idst->saddr = saddr; | 80 | idst->saddr = saddr; |
81 | } | 81 | } |
82 | 82 | ||
83 | static void tunnel_dst_set(struct ip_tunnel *t, | 83 | static noinline void tunnel_dst_set(struct ip_tunnel *t, |
84 | struct dst_entry *dst, __be32 saddr) | 84 | struct dst_entry *dst, __be32 saddr) |
85 | { | 85 | { |
86 | __tunnel_dst_set(this_cpu_ptr(t->dst_cache), dst, saddr); | 86 | __tunnel_dst_set(raw_cpu_ptr(t->dst_cache), dst, saddr); |
87 | } | 87 | } |
88 | 88 | ||
89 | static void tunnel_dst_reset(struct ip_tunnel *t) | 89 | static void tunnel_dst_reset(struct ip_tunnel *t) |
@@ -107,7 +107,7 @@ static struct rtable *tunnel_rtable_get(struct ip_tunnel *t, | |||
107 | struct dst_entry *dst; | 107 | struct dst_entry *dst; |
108 | 108 | ||
109 | rcu_read_lock(); | 109 | rcu_read_lock(); |
110 | idst = this_cpu_ptr(t->dst_cache); | 110 | idst = raw_cpu_ptr(t->dst_cache); |
111 | dst = rcu_dereference(idst->dst); | 111 | dst = rcu_dereference(idst->dst); |
112 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) | 112 | if (dst && !atomic_inc_not_zero(&dst->__refcnt)) |
113 | dst = NULL; | 113 | dst = NULL; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 234a43e233dc..d4bd68dcdc39 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2265,9 +2265,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, | |||
2265 | return rt; | 2265 | return rt; |
2266 | 2266 | ||
2267 | if (flp4->flowi4_proto) | 2267 | if (flp4->flowi4_proto) |
2268 | rt = (struct rtable *) xfrm_lookup(net, &rt->dst, | 2268 | rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst, |
2269 | flowi4_to_flowi(flp4), | 2269 | flowi4_to_flowi(flp4), |
2270 | sk, 0); | 2270 | sk, 0); |
2271 | 2271 | ||
2272 | return rt; | 2272 | return rt; |
2273 | } | 2273 | } |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 39d33355d7e8..e189480f8fd6 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3097,11 +3097,13 @@ restart: | |||
3097 | 3097 | ||
3098 | write_unlock_bh(&idev->lock); | 3098 | write_unlock_bh(&idev->lock); |
3099 | 3099 | ||
3100 | /* Step 5: Discard multicast list */ | 3100 | /* Step 5: Discard anycast and multicast list */ |
3101 | if (how) | 3101 | if (how) { |
3102 | ipv6_ac_destroy_dev(idev); | ||
3102 | ipv6_mc_destroy_dev(idev); | 3103 | ipv6_mc_destroy_dev(idev); |
3103 | else | 3104 | } else { |
3104 | ipv6_mc_down(idev); | 3105 | ipv6_mc_down(idev); |
3106 | } | ||
3105 | 3107 | ||
3106 | idev->tstamp = jiffies; | 3108 | idev->tstamp = jiffies; |
3107 | 3109 | ||
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 952c1fd06150..f5e319a8d4e2 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -345,6 +345,27 @@ static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr) | |||
345 | return __ipv6_dev_ac_dec(idev, addr); | 345 | return __ipv6_dev_ac_dec(idev, addr); |
346 | } | 346 | } |
347 | 347 | ||
348 | void ipv6_ac_destroy_dev(struct inet6_dev *idev) | ||
349 | { | ||
350 | struct ifacaddr6 *aca; | ||
351 | |||
352 | write_lock_bh(&idev->lock); | ||
353 | while ((aca = idev->ac_list) != NULL) { | ||
354 | idev->ac_list = aca->aca_next; | ||
355 | write_unlock_bh(&idev->lock); | ||
356 | |||
357 | addrconf_leave_solict(idev, &aca->aca_addr); | ||
358 | |||
359 | dst_hold(&aca->aca_rt->dst); | ||
360 | ip6_del_rt(aca->aca_rt); | ||
361 | |||
362 | aca_put(aca); | ||
363 | |||
364 | write_lock_bh(&idev->lock); | ||
365 | } | ||
366 | write_unlock_bh(&idev->lock); | ||
367 | } | ||
368 | |||
348 | /* | 369 | /* |
349 | * check if the interface has this anycast address | 370 | * check if the interface has this anycast address |
350 | * called with rcu_read_lock() | 371 | * called with rcu_read_lock() |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 2e6a0dbf7fb3..8e950c250ada 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1004,7 +1004,7 @@ struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, | |||
1004 | if (final_dst) | 1004 | if (final_dst) |
1005 | fl6->daddr = *final_dst; | 1005 | fl6->daddr = *final_dst; |
1006 | 1006 | ||
1007 | return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); | 1007 | return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); |
1008 | } | 1008 | } |
1009 | EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); | 1009 | EXPORT_SYMBOL_GPL(ip6_dst_lookup_flow); |
1010 | 1010 | ||
@@ -1036,7 +1036,7 @@ struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, | |||
1036 | if (final_dst) | 1036 | if (final_dst) |
1037 | fl6->daddr = *final_dst; | 1037 | fl6->daddr = *final_dst; |
1038 | 1038 | ||
1039 | return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); | 1039 | return xfrm_lookup_route(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); |
1040 | } | 1040 | } |
1041 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); | 1041 | EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup_flow); |
1042 | 1042 | ||
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 730030542024..4dd3badab259 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1822,7 +1822,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
1822 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; | 1822 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; |
1823 | if (sdata->vif.bss_conf.use_short_slot) | 1823 | if (sdata->vif.bss_conf.use_short_slot) |
1824 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; | 1824 | sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; |
1825 | sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period; | 1825 | sinfo->bss_param.dtim_period = sdata->vif.bss_conf.dtim_period; |
1826 | sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; | 1826 | sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; |
1827 | 1827 | ||
1828 | sinfo->sta_flags.set = 0; | 1828 | sinfo->sta_flags.set = 0; |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 16cad14fa81e..9e3a2fae6a8f 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -78,11 +78,12 @@ static const struct genl_multicast_group ovs_dp_vport_multicast_group = { | |||
78 | 78 | ||
79 | /* Check if need to build a reply message. | 79 | /* Check if need to build a reply message. |
80 | * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */ | 80 | * OVS userspace sets the NLM_F_ECHO flag if it needs the reply. */ |
81 | static bool ovs_must_notify(struct genl_info *info, | 81 | static bool ovs_must_notify(struct genl_family *family, struct genl_info *info, |
82 | const struct genl_multicast_group *grp) | 82 | unsigned int group) |
83 | { | 83 | { |
84 | return info->nlhdr->nlmsg_flags & NLM_F_ECHO || | 84 | return info->nlhdr->nlmsg_flags & NLM_F_ECHO || |
85 | netlink_has_listeners(genl_info_net(info)->genl_sock, 0); | 85 | genl_has_listeners(family, genl_info_net(info)->genl_sock, |
86 | group); | ||
86 | } | 87 | } |
87 | 88 | ||
88 | static void ovs_notify(struct genl_family *family, | 89 | static void ovs_notify(struct genl_family *family, |
@@ -762,7 +763,7 @@ static struct sk_buff *ovs_flow_cmd_alloc_info(const struct sw_flow_actions *act | |||
762 | { | 763 | { |
763 | struct sk_buff *skb; | 764 | struct sk_buff *skb; |
764 | 765 | ||
765 | if (!always && !ovs_must_notify(info, &ovs_dp_flow_multicast_group)) | 766 | if (!always && !ovs_must_notify(&dp_flow_genl_family, info, 0)) |
766 | return NULL; | 767 | return NULL; |
767 | 768 | ||
768 | skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL); | 769 | skb = genlmsg_new_unicast(ovs_flow_cmd_msg_size(acts), info, GFP_KERNEL); |
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c index 02a86a27fd84..5fa54dd78e25 100644 --- a/net/rfkill/rfkill-gpio.c +++ b/net/rfkill/rfkill-gpio.c | |||
@@ -163,6 +163,7 @@ static const struct acpi_device_id rfkill_acpi_match[] = { | |||
163 | { "LNV4752", RFKILL_TYPE_GPS }, | 163 | { "LNV4752", RFKILL_TYPE_GPS }, |
164 | { }, | 164 | { }, |
165 | }; | 165 | }; |
166 | MODULE_DEVICE_TABLE(acpi, rfkill_acpi_match); | ||
166 | #endif | 167 | #endif |
167 | 168 | ||
168 | static struct platform_driver rfkill_gpio_driver = { | 169 | static struct platform_driver rfkill_gpio_driver = { |
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c index b45d080e64a7..1b24191167f1 100644 --- a/net/rxrpc/ar-key.c +++ b/net/rxrpc/ar-key.c | |||
@@ -1143,7 +1143,7 @@ static long rxrpc_read(const struct key *key, | |||
1143 | if (copy_to_user(xdr, (s), _l) != 0) \ | 1143 | if (copy_to_user(xdr, (s), _l) != 0) \ |
1144 | goto fault; \ | 1144 | goto fault; \ |
1145 | if (_l & 3 && \ | 1145 | if (_l & 3 && \ |
1146 | copy_to_user((u8 *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ | 1146 | copy_to_user((u8 __user *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \ |
1147 | goto fault; \ | 1147 | goto fault; \ |
1148 | xdr += (_l + 3) >> 2; \ | 1148 | xdr += (_l + 3) >> 2; \ |
1149 | } while(0) | 1149 | } while(0) |
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index 74813e6b6ff6..8abc2625c3a1 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c | |||
@@ -133,10 +133,16 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx) | |||
133 | --sch->q.qlen; | 133 | --sch->q.qlen; |
134 | } | 134 | } |
135 | 135 | ||
136 | /* private part of skb->cb[] that a qdisc is allowed to use | ||
137 | * is limited to QDISC_CB_PRIV_LEN bytes. | ||
138 | * As a flow key might be too large, we store a part of it only. | ||
139 | */ | ||
140 | #define CHOKE_K_LEN min_t(u32, sizeof(struct flow_keys), QDISC_CB_PRIV_LEN - 3) | ||
141 | |||
136 | struct choke_skb_cb { | 142 | struct choke_skb_cb { |
137 | u16 classid; | 143 | u16 classid; |
138 | u8 keys_valid; | 144 | u8 keys_valid; |
139 | struct flow_keys keys; | 145 | u8 keys[QDISC_CB_PRIV_LEN - 3]; |
140 | }; | 146 | }; |
141 | 147 | ||
142 | static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) | 148 | static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) |
@@ -163,22 +169,26 @@ static u16 choke_get_classid(const struct sk_buff *skb) | |||
163 | static bool choke_match_flow(struct sk_buff *skb1, | 169 | static bool choke_match_flow(struct sk_buff *skb1, |
164 | struct sk_buff *skb2) | 170 | struct sk_buff *skb2) |
165 | { | 171 | { |
172 | struct flow_keys temp; | ||
173 | |||
166 | if (skb1->protocol != skb2->protocol) | 174 | if (skb1->protocol != skb2->protocol) |
167 | return false; | 175 | return false; |
168 | 176 | ||
169 | if (!choke_skb_cb(skb1)->keys_valid) { | 177 | if (!choke_skb_cb(skb1)->keys_valid) { |
170 | choke_skb_cb(skb1)->keys_valid = 1; | 178 | choke_skb_cb(skb1)->keys_valid = 1; |
171 | skb_flow_dissect(skb1, &choke_skb_cb(skb1)->keys); | 179 | skb_flow_dissect(skb1, &temp); |
180 | memcpy(&choke_skb_cb(skb1)->keys, &temp, CHOKE_K_LEN); | ||
172 | } | 181 | } |
173 | 182 | ||
174 | if (!choke_skb_cb(skb2)->keys_valid) { | 183 | if (!choke_skb_cb(skb2)->keys_valid) { |
175 | choke_skb_cb(skb2)->keys_valid = 1; | 184 | choke_skb_cb(skb2)->keys_valid = 1; |
176 | skb_flow_dissect(skb2, &choke_skb_cb(skb2)->keys); | 185 | skb_flow_dissect(skb2, &temp); |
186 | memcpy(&choke_skb_cb(skb2)->keys, &temp, CHOKE_K_LEN); | ||
177 | } | 187 | } |
178 | 188 | ||
179 | return !memcmp(&choke_skb_cb(skb1)->keys, | 189 | return !memcmp(&choke_skb_cb(skb1)->keys, |
180 | &choke_skb_cb(skb2)->keys, | 190 | &choke_skb_cb(skb2)->keys, |
181 | sizeof(struct flow_keys)); | 191 | CHOKE_K_LEN); |
182 | } | 192 | } |
183 | 193 | ||
184 | /* | 194 | /* |
diff --git a/net/socket.c b/net/socket.c index d40f522541aa..ffd9cb46902b 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1993,6 +1993,9 @@ static int copy_msghdr_from_user(struct msghdr *kmsg, | |||
1993 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) | 1993 | if (copy_from_user(kmsg, umsg, sizeof(struct msghdr))) |
1994 | return -EFAULT; | 1994 | return -EFAULT; |
1995 | 1995 | ||
1996 | if (kmsg->msg_name == NULL) | ||
1997 | kmsg->msg_namelen = 0; | ||
1998 | |||
1996 | if (kmsg->msg_namelen < 0) | 1999 | if (kmsg->msg_namelen < 0) |
1997 | return -EINVAL; | 2000 | return -EINVAL; |
1998 | 2001 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 3011401f52c0..233c54e45092 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6977,6 +6977,9 @@ void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp) | |||
6977 | struct nlattr *data = ((void **)skb->cb)[2]; | 6977 | struct nlattr *data = ((void **)skb->cb)[2]; |
6978 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; | 6978 | enum nl80211_multicast_groups mcgrp = NL80211_MCGRP_TESTMODE; |
6979 | 6979 | ||
6980 | /* clear CB data for netlink core to own from now on */ | ||
6981 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
6982 | |||
6980 | nla_nest_end(skb, data); | 6983 | nla_nest_end(skb, data); |
6981 | genlmsg_end(skb, hdr); | 6984 | genlmsg_end(skb, hdr); |
6982 | 6985 | ||
@@ -9302,6 +9305,9 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb) | |||
9302 | void *hdr = ((void **)skb->cb)[1]; | 9305 | void *hdr = ((void **)skb->cb)[1]; |
9303 | struct nlattr *data = ((void **)skb->cb)[2]; | 9306 | struct nlattr *data = ((void **)skb->cb)[2]; |
9304 | 9307 | ||
9308 | /* clear CB data for netlink core to own from now on */ | ||
9309 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
9310 | |||
9305 | if (WARN_ON(!rdev->cur_cmd_info)) { | 9311 | if (WARN_ON(!rdev->cur_cmd_info)) { |
9306 | kfree_skb(skb); | 9312 | kfree_skb(skb); |
9307 | return -EINVAL; | 9313 | return -EINVAL; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index beeed602aeb3..fdde51f4271a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -39,6 +39,11 @@ | |||
39 | #define XFRM_QUEUE_TMO_MAX ((unsigned)(60*HZ)) | 39 | #define XFRM_QUEUE_TMO_MAX ((unsigned)(60*HZ)) |
40 | #define XFRM_MAX_QUEUE_LEN 100 | 40 | #define XFRM_MAX_QUEUE_LEN 100 |
41 | 41 | ||
42 | struct xfrm_flo { | ||
43 | struct dst_entry *dst_orig; | ||
44 | u8 flags; | ||
45 | }; | ||
46 | |||
42 | static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock); | 47 | static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock); |
43 | static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO] | 48 | static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[NPROTO] |
44 | __read_mostly; | 49 | __read_mostly; |
@@ -1877,13 +1882,14 @@ static int xdst_queue_output(struct sock *sk, struct sk_buff *skb) | |||
1877 | } | 1882 | } |
1878 | 1883 | ||
1879 | static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, | 1884 | static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, |
1880 | struct dst_entry *dst, | 1885 | struct xfrm_flo *xflo, |
1881 | const struct flowi *fl, | 1886 | const struct flowi *fl, |
1882 | int num_xfrms, | 1887 | int num_xfrms, |
1883 | u16 family) | 1888 | u16 family) |
1884 | { | 1889 | { |
1885 | int err; | 1890 | int err; |
1886 | struct net_device *dev; | 1891 | struct net_device *dev; |
1892 | struct dst_entry *dst; | ||
1887 | struct dst_entry *dst1; | 1893 | struct dst_entry *dst1; |
1888 | struct xfrm_dst *xdst; | 1894 | struct xfrm_dst *xdst; |
1889 | 1895 | ||
@@ -1891,9 +1897,12 @@ static struct xfrm_dst *xfrm_create_dummy_bundle(struct net *net, | |||
1891 | if (IS_ERR(xdst)) | 1897 | if (IS_ERR(xdst)) |
1892 | return xdst; | 1898 | return xdst; |
1893 | 1899 | ||
1894 | if (net->xfrm.sysctl_larval_drop || num_xfrms <= 0) | 1900 | if (!(xflo->flags & XFRM_LOOKUP_QUEUE) || |
1901 | net->xfrm.sysctl_larval_drop || | ||
1902 | num_xfrms <= 0) | ||
1895 | return xdst; | 1903 | return xdst; |
1896 | 1904 | ||
1905 | dst = xflo->dst_orig; | ||
1897 | dst1 = &xdst->u.dst; | 1906 | dst1 = &xdst->u.dst; |
1898 | dst_hold(dst); | 1907 | dst_hold(dst); |
1899 | xdst->route = dst; | 1908 | xdst->route = dst; |
@@ -1935,7 +1944,7 @@ static struct flow_cache_object * | |||
1935 | xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, | 1944 | xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, |
1936 | struct flow_cache_object *oldflo, void *ctx) | 1945 | struct flow_cache_object *oldflo, void *ctx) |
1937 | { | 1946 | { |
1938 | struct dst_entry *dst_orig = (struct dst_entry *)ctx; | 1947 | struct xfrm_flo *xflo = (struct xfrm_flo *)ctx; |
1939 | struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; | 1948 | struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; |
1940 | struct xfrm_dst *xdst, *new_xdst; | 1949 | struct xfrm_dst *xdst, *new_xdst; |
1941 | int num_pols = 0, num_xfrms = 0, i, err, pol_dead; | 1950 | int num_pols = 0, num_xfrms = 0, i, err, pol_dead; |
@@ -1976,7 +1985,8 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir, | |||
1976 | goto make_dummy_bundle; | 1985 | goto make_dummy_bundle; |
1977 | } | 1986 | } |
1978 | 1987 | ||
1979 | new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, dst_orig); | 1988 | new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, |
1989 | xflo->dst_orig); | ||
1980 | if (IS_ERR(new_xdst)) { | 1990 | if (IS_ERR(new_xdst)) { |
1981 | err = PTR_ERR(new_xdst); | 1991 | err = PTR_ERR(new_xdst); |
1982 | if (err != -EAGAIN) | 1992 | if (err != -EAGAIN) |
@@ -2010,7 +2020,7 @@ make_dummy_bundle: | |||
2010 | /* We found policies, but there's no bundles to instantiate: | 2020 | /* We found policies, but there's no bundles to instantiate: |
2011 | * either because the policy blocks, has no transformations or | 2021 | * either because the policy blocks, has no transformations or |
2012 | * we could not build template (no xfrm_states).*/ | 2022 | * we could not build template (no xfrm_states).*/ |
2013 | xdst = xfrm_create_dummy_bundle(net, dst_orig, fl, num_xfrms, family); | 2023 | xdst = xfrm_create_dummy_bundle(net, xflo, fl, num_xfrms, family); |
2014 | if (IS_ERR(xdst)) { | 2024 | if (IS_ERR(xdst)) { |
2015 | xfrm_pols_put(pols, num_pols); | 2025 | xfrm_pols_put(pols, num_pols); |
2016 | return ERR_CAST(xdst); | 2026 | return ERR_CAST(xdst); |
@@ -2104,13 +2114,18 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
2104 | } | 2114 | } |
2105 | 2115 | ||
2106 | if (xdst == NULL) { | 2116 | if (xdst == NULL) { |
2117 | struct xfrm_flo xflo; | ||
2118 | |||
2119 | xflo.dst_orig = dst_orig; | ||
2120 | xflo.flags = flags; | ||
2121 | |||
2107 | /* To accelerate a bit... */ | 2122 | /* To accelerate a bit... */ |
2108 | if ((dst_orig->flags & DST_NOXFRM) || | 2123 | if ((dst_orig->flags & DST_NOXFRM) || |
2109 | !net->xfrm.policy_count[XFRM_POLICY_OUT]) | 2124 | !net->xfrm.policy_count[XFRM_POLICY_OUT]) |
2110 | goto nopol; | 2125 | goto nopol; |
2111 | 2126 | ||
2112 | flo = flow_cache_lookup(net, fl, family, dir, | 2127 | flo = flow_cache_lookup(net, fl, family, dir, |
2113 | xfrm_bundle_lookup, dst_orig); | 2128 | xfrm_bundle_lookup, &xflo); |
2114 | if (flo == NULL) | 2129 | if (flo == NULL) |
2115 | goto nopol; | 2130 | goto nopol; |
2116 | if (IS_ERR(flo)) { | 2131 | if (IS_ERR(flo)) { |
@@ -2138,7 +2153,7 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
2138 | xfrm_pols_put(pols, drop_pols); | 2153 | xfrm_pols_put(pols, drop_pols); |
2139 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); | 2154 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); |
2140 | 2155 | ||
2141 | return make_blackhole(net, family, dst_orig); | 2156 | return ERR_PTR(-EREMOTE); |
2142 | } | 2157 | } |
2143 | 2158 | ||
2144 | err = -EAGAIN; | 2159 | err = -EAGAIN; |
@@ -2195,6 +2210,23 @@ dropdst: | |||
2195 | } | 2210 | } |
2196 | EXPORT_SYMBOL(xfrm_lookup); | 2211 | EXPORT_SYMBOL(xfrm_lookup); |
2197 | 2212 | ||
2213 | /* Callers of xfrm_lookup_route() must ensure a call to dst_output(). | ||
2214 | * Otherwise we may send out blackholed packets. | ||
2215 | */ | ||
2216 | struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, | ||
2217 | const struct flowi *fl, | ||
2218 | struct sock *sk, int flags) | ||
2219 | { | ||
2220 | struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, | ||
2221 | flags | XFRM_LOOKUP_QUEUE); | ||
2222 | |||
2223 | if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) | ||
2224 | return make_blackhole(net, dst_orig->ops->family, dst_orig); | ||
2225 | |||
2226 | return dst; | ||
2227 | } | ||
2228 | EXPORT_SYMBOL(xfrm_lookup_route); | ||
2229 | |||
2198 | static inline int | 2230 | static inline int |
2199 | xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl) | 2231 | xfrm_secpath_reject(int idx, struct sk_buff *skb, const struct flowi *fl) |
2200 | { | 2232 | { |
@@ -2460,7 +2492,7 @@ int __xfrm_route_forward(struct sk_buff *skb, unsigned short family) | |||
2460 | 2492 | ||
2461 | skb_dst_force(skb); | 2493 | skb_dst_force(skb); |
2462 | 2494 | ||
2463 | dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, 0); | 2495 | dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE); |
2464 | if (IS_ERR(dst)) { | 2496 | if (IS_ERR(dst)) { |
2465 | res = 0; | 2497 | res = 0; |
2466 | dst = NULL; | 2498 | dst = NULL; |
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b385bcbbf2f5..4d08b398411f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -2133,7 +2133,10 @@ sub process { | |||
2133 | # Check for improperly formed commit descriptions | 2133 | # Check for improperly formed commit descriptions |
2134 | if ($in_commit_log && | 2134 | if ($in_commit_log && |
2135 | $line =~ /\bcommit\s+[0-9a-f]{5,}/i && | 2135 | $line =~ /\bcommit\s+[0-9a-f]{5,}/i && |
2136 | $line !~ /\b[Cc]ommit [0-9a-f]{12,40} \("/) { | 2136 | !($line =~ /\b[Cc]ommit [0-9a-f]{12,40} \("/ || |
2137 | ($line =~ /\b[Cc]ommit [0-9a-f]{12,40}\s*$/ && | ||
2138 | defined $rawlines[$linenr] && | ||
2139 | $rawlines[$linenr] =~ /^\s*\("/))) { | ||
2137 | $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i; | 2140 | $line =~ /\b(c)ommit\s+([0-9a-f]{5,})/i; |
2138 | my $init_char = $1; | 2141 | my $init_char = $1; |
2139 | my $orig_commit = lc($2); | 2142 | my $orig_commit = lc($2); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ea823e1100da..98cd1908c039 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -566,8 +566,8 @@ static void stac_init_power_map(struct hda_codec *codec) | |||
566 | if (snd_hda_jack_tbl_get(codec, nid)) | 566 | if (snd_hda_jack_tbl_get(codec, nid)) |
567 | continue; | 567 | continue; |
568 | if (def_conf == AC_JACK_PORT_COMPLEX && | 568 | if (def_conf == AC_JACK_PORT_COMPLEX && |
569 | !(spec->vref_mute_led_nid == nid || | 569 | spec->vref_mute_led_nid != nid && |
570 | is_jack_detectable(codec, nid))) { | 570 | is_jack_detectable(codec, nid)) { |
571 | snd_hda_jack_detect_enable_callback(codec, nid, | 571 | snd_hda_jack_detect_enable_callback(codec, nid, |
572 | STAC_PWR_EVENT, | 572 | STAC_PWR_EVENT, |
573 | jack_update_power); | 573 | jack_update_power); |
@@ -4276,11 +4276,18 @@ static int stac_parse_auto_config(struct hda_codec *codec) | |||
4276 | return err; | 4276 | return err; |
4277 | } | 4277 | } |
4278 | 4278 | ||
4279 | stac_init_power_map(codec); | ||
4280 | |||
4281 | return 0; | 4279 | return 0; |
4282 | } | 4280 | } |
4283 | 4281 | ||
4282 | static int stac_build_controls(struct hda_codec *codec) | ||
4283 | { | ||
4284 | int err = snd_hda_gen_build_controls(codec); | ||
4285 | |||
4286 | if (err < 0) | ||
4287 | return err; | ||
4288 | stac_init_power_map(codec); | ||
4289 | return 0; | ||
4290 | } | ||
4284 | 4291 | ||
4285 | static int stac_init(struct hda_codec *codec) | 4292 | static int stac_init(struct hda_codec *codec) |
4286 | { | 4293 | { |
@@ -4392,7 +4399,7 @@ static int stac_suspend(struct hda_codec *codec) | |||
4392 | #endif /* CONFIG_PM */ | 4399 | #endif /* CONFIG_PM */ |
4393 | 4400 | ||
4394 | static const struct hda_codec_ops stac_patch_ops = { | 4401 | static const struct hda_codec_ops stac_patch_ops = { |
4395 | .build_controls = snd_hda_gen_build_controls, | 4402 | .build_controls = stac_build_controls, |
4396 | .build_pcms = snd_hda_gen_build_pcms, | 4403 | .build_pcms = snd_hda_gen_build_pcms, |
4397 | .init = stac_init, | 4404 | .init = stac_init, |
4398 | .free = stac_free, | 4405 | .free = stac_free, |
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c index 98523209f739..69a85164357c 100644 --- a/sound/soc/codecs/cs4265.c +++ b/sound/soc/codecs/cs4265.c | |||
@@ -458,12 +458,12 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, | |||
458 | if (params_width(params) == 16) { | 458 | if (params_width(params) == 16) { |
459 | snd_soc_update_bits(codec, CS4265_DAC_CTL, | 459 | snd_soc_update_bits(codec, CS4265_DAC_CTL, |
460 | CS4265_DAC_CTL_DIF, (1 << 5)); | 460 | CS4265_DAC_CTL_DIF, (1 << 5)); |
461 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 461 | snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, |
462 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); | 462 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); |
463 | } else { | 463 | } else { |
464 | snd_soc_update_bits(codec, CS4265_DAC_CTL, | 464 | snd_soc_update_bits(codec, CS4265_DAC_CTL, |
465 | CS4265_DAC_CTL_DIF, (3 << 5)); | 465 | CS4265_DAC_CTL_DIF, (3 << 5)); |
466 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 466 | snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, |
467 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); | 467 | CS4265_SPDIF_CTL2_DIF, (1 << 7)); |
468 | } | 468 | } |
469 | break; | 469 | break; |
@@ -472,7 +472,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream, | |||
472 | CS4265_DAC_CTL_DIF, 0); | 472 | CS4265_DAC_CTL_DIF, 0); |
473 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 473 | snd_soc_update_bits(codec, CS4265_ADC_CTL, |
474 | CS4265_ADC_DIF, 0); | 474 | CS4265_ADC_DIF, 0); |
475 | snd_soc_update_bits(codec, CS4265_ADC_CTL, | 475 | snd_soc_update_bits(codec, CS4265_SPDIF_CTL2, |
476 | CS4265_SPDIF_CTL2_DIF, (1 << 6)); | 476 | CS4265_SPDIF_CTL2_DIF, (1 << 6)); |
477 | 477 | ||
478 | break; | 478 | break; |
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c index 9aa1323fb2ab..89c748dd3d6e 100644 --- a/sound/soc/codecs/sta529.c +++ b/sound/soc/codecs/sta529.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver | 4 | * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> | 7 | * Rajeev Kumar <rajeevkumar.linux@gmail.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -426,5 +426,5 @@ static struct i2c_driver sta529_i2c_driver = { | |||
426 | module_i2c_driver(sta529_i2c_driver); | 426 | module_i2c_driver(sta529_i2c_driver); |
427 | 427 | ||
428 | MODULE_DESCRIPTION("ASoC STA529 codec driver"); | 428 | MODULE_DESCRIPTION("ASoC STA529 codec driver"); |
429 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 429 | MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>"); |
430 | MODULE_LICENSE("GPL"); | 430 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c index 0f64c7890eed..aea9e1ff9126 100644 --- a/sound/soc/codecs/tlv320aic31xx.c +++ b/sound/soc/codecs/tlv320aic31xx.c | |||
@@ -189,46 +189,57 @@ static const struct aic31xx_rate_divs aic31xx_divs[] = { | |||
189 | /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */ | 189 | /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */ |
190 | /* 8k rate */ | 190 | /* 8k rate */ |
191 | {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2}, | 191 | {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2}, |
192 | {12000000, 8000, 1, 8, 1920, 128, 32, 3, 128, 32, 3}, | ||
192 | {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2}, | 193 | {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2}, |
193 | {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2}, | 194 | {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2}, |
194 | /* 11.025k rate */ | 195 | /* 11.025k rate */ |
195 | {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2}, | 196 | {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2}, |
197 | {12000000, 11025, 1, 8, 4672, 128, 24, 3, 128, 24, 3}, | ||
196 | {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2}, | 198 | {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2}, |
197 | {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2}, | 199 | {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2}, |
198 | /* 16k rate */ | 200 | /* 16k rate */ |
199 | {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2}, | 201 | {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2}, |
202 | {12000000, 16000, 1, 8, 1920, 128, 16, 3, 128, 16, 3}, | ||
200 | {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2}, | 203 | {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2}, |
201 | {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2}, | 204 | {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2}, |
202 | /* 22.05k rate */ | 205 | /* 22.05k rate */ |
203 | {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2}, | 206 | {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2}, |
207 | {12000000, 22050, 1, 8, 4672, 128, 12, 3, 128, 12, 3}, | ||
204 | {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2}, | 208 | {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2}, |
205 | {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2}, | 209 | {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2}, |
206 | /* 32k rate */ | 210 | /* 32k rate */ |
207 | {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2}, | 211 | {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2}, |
212 | {12000000, 32000, 1, 8, 1920, 128, 8, 3, 128, 8, 3}, | ||
208 | {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2}, | 213 | {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2}, |
209 | {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2}, | 214 | {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2}, |
210 | /* 44.1k rate */ | 215 | /* 44.1k rate */ |
211 | {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2}, | 216 | {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2}, |
217 | {12000000, 44100, 1, 8, 4672, 128, 6, 3, 128, 6, 3}, | ||
212 | {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2}, | 218 | {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2}, |
213 | {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2}, | 219 | {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2}, |
214 | /* 48k rate */ | 220 | /* 48k rate */ |
215 | {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2}, | 221 | {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2}, |
222 | {12000000, 48000, 1, 7, 6800, 96, 5, 4, 96, 5, 4}, | ||
216 | {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2}, | 223 | {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2}, |
217 | {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2}, | 224 | {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2}, |
218 | /* 88.2k rate */ | 225 | /* 88.2k rate */ |
219 | {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2}, | 226 | {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2}, |
227 | {12000000, 88200, 1, 8, 4672, 64, 6, 3, 64, 6, 3}, | ||
220 | {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2}, | 228 | {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2}, |
221 | {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2}, | 229 | {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2}, |
222 | /* 96k rate */ | 230 | /* 96k rate */ |
223 | {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2}, | 231 | {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2}, |
232 | {12000000, 96000, 1, 7, 6800, 48, 5, 4, 48, 5, 4}, | ||
224 | {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2}, | 233 | {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2}, |
225 | {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2}, | 234 | {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2}, |
226 | /* 176.4k rate */ | 235 | /* 176.4k rate */ |
227 | {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2}, | 236 | {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2}, |
237 | {12000000, 176400, 1, 8, 4672, 32, 6, 3, 32, 6, 3}, | ||
228 | {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2}, | 238 | {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2}, |
229 | {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2}, | 239 | {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2}, |
230 | /* 192k rate */ | 240 | /* 192k rate */ |
231 | {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2}, | 241 | {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2}, |
242 | {12000000, 192000, 1, 7, 6800, 24, 5, 4, 24, 5, 4}, | ||
232 | {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2}, | 243 | {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2}, |
233 | {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2}, | 244 | {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2}, |
234 | }; | 245 | }; |
@@ -680,7 +691,9 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, | |||
680 | struct snd_pcm_hw_params *params) | 691 | struct snd_pcm_hw_params *params) |
681 | { | 692 | { |
682 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); | 693 | struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); |
694 | int bclk_score = snd_soc_params_to_frame_size(params); | ||
683 | int bclk_n = 0; | 695 | int bclk_n = 0; |
696 | int match = -1; | ||
684 | int i; | 697 | int i; |
685 | 698 | ||
686 | /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ | 699 | /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ |
@@ -691,15 +704,37 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, | |||
691 | 704 | ||
692 | for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { | 705 | for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { |
693 | if (aic31xx_divs[i].rate == params_rate(params) && | 706 | if (aic31xx_divs[i].rate == params_rate(params) && |
694 | aic31xx_divs[i].mclk == aic31xx->sysclk) | 707 | aic31xx_divs[i].mclk == aic31xx->sysclk) { |
695 | break; | 708 | int s = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) % |
709 | snd_soc_params_to_frame_size(params); | ||
710 | int bn = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) / | ||
711 | snd_soc_params_to_frame_size(params); | ||
712 | if (s < bclk_score && bn > 0) { | ||
713 | match = i; | ||
714 | bclk_n = bn; | ||
715 | bclk_score = s; | ||
716 | } | ||
717 | } | ||
696 | } | 718 | } |
697 | 719 | ||
698 | if (i == ARRAY_SIZE(aic31xx_divs)) { | 720 | if (match == -1) { |
699 | dev_err(codec->dev, "%s: Sampling rate %u not supported\n", | 721 | dev_err(codec->dev, |
722 | "%s: Sample rate (%u) and format not supported\n", | ||
700 | __func__, params_rate(params)); | 723 | __func__, params_rate(params)); |
724 | /* See bellow for details how fix this. */ | ||
701 | return -EINVAL; | 725 | return -EINVAL; |
702 | } | 726 | } |
727 | if (bclk_score != 0) { | ||
728 | dev_warn(codec->dev, "Can not produce exact bitclock"); | ||
729 | /* This is fine if using dsp format, but if using i2s | ||
730 | there may be trouble. To fix the issue edit the | ||
731 | aic31xx_divs table for your mclk and sample | ||
732 | rate. Details can be found from: | ||
733 | http://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf | ||
734 | Section: 5.6 CLOCK Generation and PLL | ||
735 | */ | ||
736 | } | ||
737 | i = match; | ||
703 | 738 | ||
704 | /* PLL configuration */ | 739 | /* PLL configuration */ |
705 | snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, | 740 | snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, |
@@ -729,14 +764,6 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec, | |||
729 | snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); | 764 | snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); |
730 | 765 | ||
731 | /* Bit clock divider configuration. */ | 766 | /* Bit clock divider configuration. */ |
732 | bclk_n = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) | ||
733 | / snd_soc_params_to_frame_size(params); | ||
734 | if (bclk_n == 0) { | ||
735 | dev_err(codec->dev, "%s: Not enough BLCK bandwidth\n", | ||
736 | __func__); | ||
737 | return -EINVAL; | ||
738 | } | ||
739 | |||
740 | snd_soc_update_bits(codec, AIC31XX_BCLKN, | 767 | snd_soc_update_bits(codec, AIC31XX_BCLKN, |
741 | AIC31XX_PLL_MASK, bclk_n); | 768 | AIC31XX_PLL_MASK, bclk_n); |
742 | 769 | ||
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 6a6b2ff7d7d7..68347b55f6e1 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -467,8 +467,17 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp, | |||
467 | { | 467 | { |
468 | u32 fmt; | 468 | u32 fmt; |
469 | u32 tx_rotate = (word_length / 4) & 0x7; | 469 | u32 tx_rotate = (word_length / 4) & 0x7; |
470 | u32 rx_rotate = (32 - word_length) / 4; | ||
471 | u32 mask = (1ULL << word_length) - 1; | 470 | u32 mask = (1ULL << word_length) - 1; |
471 | /* | ||
472 | * For captured data we should not rotate, inversion and masking is | ||
473 | * enoguh to get the data to the right position: | ||
474 | * Format data from bus after reverse (XRBUF) | ||
475 | * S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB| | ||
476 | * S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| | ||
477 | * S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB| | ||
478 | * S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB| | ||
479 | */ | ||
480 | u32 rx_rotate = 0; | ||
472 | 481 | ||
473 | /* | 482 | /* |
474 | * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() | 483 | * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() |
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index 25c31f1655f6..e961388e6e9c 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * sound/soc/dwc/designware_i2s.c | 4 | * sound/soc/dwc/designware_i2s.c |
5 | * | 5 | * |
6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
7 | * Rajeev Kumar <rajeev-dlh.kumar@st.com> | 7 | * Rajeev Kumar <rajeevkumar.linux@gmail.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -455,7 +455,7 @@ static struct platform_driver dw_i2s_driver = { | |||
455 | 455 | ||
456 | module_platform_driver(dw_i2s_driver); | 456 | module_platform_driver(dw_i2s_driver); |
457 | 457 | ||
458 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 458 | MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>"); |
459 | MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface"); | 459 | MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface"); |
460 | MODULE_LICENSE("GPL"); | 460 | MODULE_LICENSE("GPL"); |
461 | MODULE_ALIAS("platform:designware_i2s"); | 461 | MODULE_ALIAS("platform:designware_i2s"); |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 8d8e4b59049f..fb9e05c9f471 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
@@ -165,13 +165,14 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
165 | struct rk_i2s_dev *i2s = to_info(cpu_dai); | 165 | struct rk_i2s_dev *i2s = to_info(cpu_dai); |
166 | unsigned int mask = 0, val = 0; | 166 | unsigned int mask = 0, val = 0; |
167 | 167 | ||
168 | mask = I2S_CKR_MSS_SLAVE; | 168 | mask = I2S_CKR_MSS_MASK; |
169 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 169 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
170 | case SND_SOC_DAIFMT_CBS_CFS: | 170 | case SND_SOC_DAIFMT_CBS_CFS: |
171 | val = I2S_CKR_MSS_SLAVE; | 171 | /* Set source clock in Master mode */ |
172 | val = I2S_CKR_MSS_MASTER; | ||
172 | break; | 173 | break; |
173 | case SND_SOC_DAIFMT_CBM_CFM: | 174 | case SND_SOC_DAIFMT_CBM_CFM: |
174 | val = I2S_CKR_MSS_MASTER; | 175 | val = I2S_CKR_MSS_SLAVE; |
175 | break; | 176 | break; |
176 | default: | 177 | default: |
177 | return -EINVAL; | 178 | return -EINVAL; |
@@ -361,6 +362,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg) | |||
361 | case I2S_XFER: | 362 | case I2S_XFER: |
362 | case I2S_CLR: | 363 | case I2S_CLR: |
363 | case I2S_RXDR: | 364 | case I2S_RXDR: |
365 | case I2S_FIFOLR: | ||
366 | case I2S_INTSR: | ||
364 | return true; | 367 | return true; |
365 | default: | 368 | default: |
366 | return false; | 369 | return false; |
@@ -370,8 +373,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg) | |||
370 | static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) | 373 | static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) |
371 | { | 374 | { |
372 | switch (reg) { | 375 | switch (reg) { |
373 | case I2S_FIFOLR: | ||
374 | case I2S_INTSR: | 376 | case I2S_INTSR: |
377 | case I2S_CLR: | ||
375 | return true; | 378 | return true; |
376 | default: | 379 | default: |
377 | return false; | 380 | return false; |
@@ -381,8 +384,6 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) | |||
381 | static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) | 384 | static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) |
382 | { | 385 | { |
383 | switch (reg) { | 386 | switch (reg) { |
384 | case I2S_FIFOLR: | ||
385 | return true; | ||
386 | default: | 387 | default: |
387 | return false; | 388 | return false; |
388 | } | 389 | } |
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 03eec22f0f46..9d513473b300 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -462,7 +462,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai, | |||
462 | if (dir == SND_SOC_CLOCK_IN) | 462 | if (dir == SND_SOC_CLOCK_IN) |
463 | rfs = 0; | 463 | rfs = 0; |
464 | 464 | ||
465 | if ((rfs && other->rfs && (other->rfs != rfs)) || | 465 | if ((rfs && other && other->rfs && (other->rfs != rfs)) || |
466 | (any_active(i2s) && | 466 | (any_active(i2s) && |
467 | (((dir == SND_SOC_CLOCK_IN) | 467 | (((dir == SND_SOC_CLOCK_IN) |
468 | && !(mod & MOD_CDCLKCON)) || | 468 | && !(mod & MOD_CDCLKCON)) || |
@@ -762,7 +762,8 @@ static void i2s_shutdown(struct snd_pcm_substream *substream, | |||
762 | } else { | 762 | } else { |
763 | u32 mod = readl(i2s->addr + I2SMOD); | 763 | u32 mod = readl(i2s->addr + I2SMOD); |
764 | i2s->cdclk_out = !(mod & MOD_CDCLKCON); | 764 | i2s->cdclk_out = !(mod & MOD_CDCLKCON); |
765 | other->cdclk_out = i2s->cdclk_out; | 765 | if (other) |
766 | other->cdclk_out = i2s->cdclk_out; | ||
766 | } | 767 | } |
767 | /* Reset any constraint on RFS and BFS */ | 768 | /* Reset any constraint on RFS and BFS */ |
768 | i2s->rfs = 0; | 769 | i2s->rfs = 0; |
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 27c06acce205..3092b58fede6 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
@@ -101,7 +101,11 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) | |||
101 | 101 | ||
102 | fe->dpcm[stream].runtime = fe_substream->runtime; | 102 | fe->dpcm[stream].runtime = fe_substream->runtime; |
103 | 103 | ||
104 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 104 | ret = dpcm_path_get(fe, stream, &list); |
105 | if (ret < 0) { | ||
106 | mutex_unlock(&fe->card->mutex); | ||
107 | goto fe_err; | ||
108 | } else if (ret == 0) { | ||
105 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 109 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
106 | fe->dai_link->name, stream ? "capture" : "playback"); | 110 | fe->dai_link->name, stream ? "capture" : "playback"); |
107 | } | 111 | } |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 731fdb5b5f9b..642c86240752 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -2352,7 +2352,11 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream) | |||
2352 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 2352 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
2353 | fe->dpcm[stream].runtime = fe_substream->runtime; | 2353 | fe->dpcm[stream].runtime = fe_substream->runtime; |
2354 | 2354 | ||
2355 | if (dpcm_path_get(fe, stream, &list) <= 0) { | 2355 | ret = dpcm_path_get(fe, stream, &list); |
2356 | if (ret < 0) { | ||
2357 | mutex_unlock(&fe->card->mutex); | ||
2358 | return ret; | ||
2359 | } else if (ret == 0) { | ||
2356 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", | 2360 | dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", |
2357 | fe->dai_link->name, stream ? "capture" : "playback"); | 2361 | fe->dai_link->name, stream ? "capture" : "playback"); |
2358 | } | 2362 | } |
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c index 0e5a8f35d0ad..a7dc3c56f44d 100644 --- a/sound/soc/spear/spear_pcm.c +++ b/sound/soc/spear/spear_pcm.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * sound/soc/spear/spear_pcm.c | 4 | * sound/soc/spear/spear_pcm.c |
5 | * | 5 | * |
6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | 7 | * Rajeev Kumar<rajeevkumar.linux@gmail.com> |
8 | * | 8 | * |
9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
@@ -50,6 +50,6 @@ int devm_spear_pcm_platform_register(struct device *dev, | |||
50 | } | 50 | } |
51 | EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); | 51 | EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); |
52 | 52 | ||
53 | MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); | 53 | MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>"); |
54 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); | 54 | MODULE_DESCRIPTION("SPEAr PCM DMA module"); |
55 | MODULE_LICENSE("GPL"); | 55 | MODULE_LICENSE("GPL"); |
diff --git a/tools/usb/usbip/libsrc/usbip_common.h b/tools/usb/usbip/libsrc/usbip_common.h index 5a0e95edf4df..15fe792e1e96 100644 --- a/tools/usb/usbip/libsrc/usbip_common.h +++ b/tools/usb/usbip/libsrc/usbip_common.h | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <syslog.h> | 15 | #include <syslog.h> |
16 | #include <unistd.h> | 16 | #include <unistd.h> |
17 | #include <linux/usb/ch9.h> | 17 | #include <linux/usb/ch9.h> |
18 | #include "../../uapi/usbip.h" | 18 | #include <linux/usbip.h> |
19 | 19 | ||
20 | #ifndef USBIDS_FILE | 20 | #ifndef USBIDS_FILE |
21 | #define USBIDS_FILE "/usr/share/hwdata/usb.ids" | 21 | #define USBIDS_FILE "/usr/share/hwdata/usb.ids" |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 33712fb26eb1..95519bc959ed 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -110,7 +110,7 @@ static bool largepages_enabled = true; | |||
110 | bool kvm_is_mmio_pfn(pfn_t pfn) | 110 | bool kvm_is_mmio_pfn(pfn_t pfn) |
111 | { | 111 | { |
112 | if (pfn_valid(pfn)) | 112 | if (pfn_valid(pfn)) |
113 | return PageReserved(pfn_to_page(pfn)); | 113 | return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn)); |
114 | 114 | ||
115 | return true; | 115 | return true; |
116 | } | 116 | } |
@@ -1725,7 +1725,7 @@ int kvm_vcpu_yield_to(struct kvm_vcpu *target) | |||
1725 | rcu_read_lock(); | 1725 | rcu_read_lock(); |
1726 | pid = rcu_dereference(target->pid); | 1726 | pid = rcu_dereference(target->pid); |
1727 | if (pid) | 1727 | if (pid) |
1728 | task = get_pid_task(target->pid, PIDTYPE_PID); | 1728 | task = get_pid_task(pid, PIDTYPE_PID); |
1729 | rcu_read_unlock(); | 1729 | rcu_read_unlock(); |
1730 | if (!task) | 1730 | if (!task) |
1731 | return ret; | 1731 | return ret; |