diff options
author | David S. Miller <davem@davemloft.net> | 2017-10-30 01:10:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-30 08:09:24 -0400 |
commit | e1ea2f9856b765a2eaabb403a6751f70efc9ba4c (patch) | |
tree | 771f0f96fdab1b27757730e96d911c73f5499ee4 | |
parent | aad93c70b9a3b80dbc383a31e77a119f69bdd856 (diff) | |
parent | 0b07194bb55ed836c2cc7c22e866b87a14681984 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Several conflicts here.
NFP driver bug fix adding nfp_netdev_is_nfp_repr() check to
nfp_fl_output() needed some adjustments because the code block is in
an else block now.
Parallel additions to net/pkt_cls.h and net/sch_generic.h
A bug fix in __tcp_retransmit_skb() conflicted with some of
the rbtree changes in net-next.
The tc action RCU callback fixes in 'net' had some overlap with some
of the recent tcf_block reworking.
Signed-off-by: David S. Miller <davem@davemloft.net>
252 files changed, 2322 insertions, 2083 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 index 33e96f740639..147d4e8a1403 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 | |||
@@ -14,3 +14,11 @@ Description: | |||
14 | Show or set the gain boost of the amp, from 0-31 range. | 14 | Show or set the gain boost of the amp, from 0-31 range. |
15 | 18 = indoors (default) | 15 | 18 = indoors (default) |
16 | 14 = outdoors | 16 | 14 = outdoors |
17 | |||
18 | What /sys/bus/iio/devices/iio:deviceX/noise_level_tripped | ||
19 | Date: May 2017 | ||
20 | KernelVersion: 4.13 | ||
21 | Contact: Matt Ranostay <matt.ranostay@konsulko.com> | ||
22 | Description: | ||
23 | When 1 the noise level is over the trip level and not reporting | ||
24 | valid data | ||
diff --git a/Documentation/ABI/testing/sysfs-devices-power b/Documentation/ABI/testing/sysfs-devices-power index 676fdf5f2a99..5cbb6f038615 100644 --- a/Documentation/ABI/testing/sysfs-devices-power +++ b/Documentation/ABI/testing/sysfs-devices-power | |||
@@ -211,7 +211,9 @@ Description: | |||
211 | device, after it has been suspended at run time, from a resume | 211 | device, after it has been suspended at run time, from a resume |
212 | request to the moment the device will be ready to process I/O, | 212 | request to the moment the device will be ready to process I/O, |
213 | in microseconds. If it is equal to 0, however, this means that | 213 | in microseconds. If it is equal to 0, however, this means that |
214 | the PM QoS resume latency may be arbitrary. | 214 | the PM QoS resume latency may be arbitrary and the special value |
215 | "n/a" means that user space cannot accept any resume latency at | ||
216 | all for the given device. | ||
215 | 217 | ||
216 | Not all drivers support this attribute. If it isn't supported, | 218 | Not all drivers support this attribute. If it isn't supported, |
217 | it is not present. | 219 | it is not present. |
diff --git a/Documentation/devicetree/bindings/iio/proximity/as3935.txt b/Documentation/devicetree/bindings/iio/proximity/as3935.txt index 38d74314b7ab..b6c1afa6f02d 100644 --- a/Documentation/devicetree/bindings/iio/proximity/as3935.txt +++ b/Documentation/devicetree/bindings/iio/proximity/as3935.txt | |||
@@ -16,6 +16,10 @@ Optional properties: | |||
16 | - ams,tuning-capacitor-pf: Calibration tuning capacitor stepping | 16 | - ams,tuning-capacitor-pf: Calibration tuning capacitor stepping |
17 | value 0 - 120pF. This will require using the calibration data from | 17 | value 0 - 120pF. This will require using the calibration data from |
18 | the manufacturer. | 18 | the manufacturer. |
19 | - ams,nflwdth: Set the noise and watchdog threshold register on | ||
20 | startup. This will need to set according to the noise from the | ||
21 | MCU board, and possibly the local environment. Refer to the | ||
22 | datasheet for the threshold settings. | ||
19 | 23 | ||
20 | Example: | 24 | Example: |
21 | 25 | ||
@@ -27,4 +31,5 @@ as3935@0 { | |||
27 | interrupt-parent = <&gpio1>; | 31 | interrupt-parent = <&gpio1>; |
28 | interrupts = <16 1>; | 32 | interrupts = <16 1>; |
29 | ams,tuning-capacitor-pf = <80>; | 33 | ams,tuning-capacitor-pf = <80>; |
34 | ams,nflwdth = <0x44>; | ||
30 | }; | 35 | }; |
diff --git a/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt b/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt index 4c29cdab0ea5..5eb108e180fa 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt | |||
@@ -99,7 +99,7 @@ Examples: | |||
99 | compatible = "arm,gic-v3-its"; | 99 | compatible = "arm,gic-v3-its"; |
100 | msi-controller; | 100 | msi-controller; |
101 | #msi-cells = <1>; | 101 | #msi-cells = <1>; |
102 | reg = <0x0 0x2c200000 0 0x200000>; | 102 | reg = <0x0 0x2c200000 0 0x20000>; |
103 | }; | 103 | }; |
104 | }; | 104 | }; |
105 | 105 | ||
@@ -124,14 +124,14 @@ Examples: | |||
124 | compatible = "arm,gic-v3-its"; | 124 | compatible = "arm,gic-v3-its"; |
125 | msi-controller; | 125 | msi-controller; |
126 | #msi-cells = <1>; | 126 | #msi-cells = <1>; |
127 | reg = <0x0 0x2c200000 0 0x200000>; | 127 | reg = <0x0 0x2c200000 0 0x20000>; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | gic-its@2c400000 { | 130 | gic-its@2c400000 { |
131 | compatible = "arm,gic-v3-its"; | 131 | compatible = "arm,gic-v3-its"; |
132 | msi-controller; | 132 | msi-controller; |
133 | #msi-cells = <1>; | 133 | #msi-cells = <1>; |
134 | reg = <0x0 0x2c400000 0 0x200000>; | 134 | reg = <0x0 0x2c400000 0 0x20000>; |
135 | }; | 135 | }; |
136 | 136 | ||
137 | ppi-partitions { | 137 | ppi-partitions { |
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 329e740adea7..f6f80380dff2 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -1108,14 +1108,6 @@ When kbuild executes, the following steps are followed (roughly): | |||
1108 | ld | 1108 | ld |
1109 | Link target. Often, LDFLAGS_$@ is used to set specific options to ld. | 1109 | Link target. Often, LDFLAGS_$@ is used to set specific options to ld. |
1110 | 1110 | ||
1111 | objcopy | ||
1112 | Copy binary. Uses OBJCOPYFLAGS usually specified in | ||
1113 | arch/$(ARCH)/Makefile. | ||
1114 | OBJCOPYFLAGS_$@ may be used to set additional options. | ||
1115 | |||
1116 | gzip | ||
1117 | Compress target. Use maximum compression to compress target. | ||
1118 | |||
1119 | Example: | 1111 | Example: |
1120 | #arch/x86/boot/Makefile | 1112 | #arch/x86/boot/Makefile |
1121 | LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary | 1113 | LDFLAGS_bootsect := -Ttext 0x0 -s --oformat binary |
@@ -1139,6 +1131,19 @@ When kbuild executes, the following steps are followed (roughly): | |||
1139 | resulting in the target file being recompiled for no | 1131 | resulting in the target file being recompiled for no |
1140 | obvious reason. | 1132 | obvious reason. |
1141 | 1133 | ||
1134 | objcopy | ||
1135 | Copy binary. Uses OBJCOPYFLAGS usually specified in | ||
1136 | arch/$(ARCH)/Makefile. | ||
1137 | OBJCOPYFLAGS_$@ may be used to set additional options. | ||
1138 | |||
1139 | gzip | ||
1140 | Compress target. Use maximum compression to compress target. | ||
1141 | |||
1142 | Example: | ||
1143 | #arch/x86/boot/compressed/Makefile | ||
1144 | $(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE | ||
1145 | $(call if_changed,gzip) | ||
1146 | |||
1142 | dtc | 1147 | dtc |
1143 | Create flattened device tree blob object suitable for linking | 1148 | Create flattened device tree blob object suitable for linking |
1144 | into vmlinux. Device tree blobs linked into vmlinux are placed | 1149 | into vmlinux. Device tree blobs linked into vmlinux are placed |
@@ -1219,7 +1224,7 @@ When kbuild executes, the following steps are followed (roughly): | |||
1219 | that may be shared between individual architectures. | 1224 | that may be shared between individual architectures. |
1220 | The recommended approach how to use a generic header file is | 1225 | The recommended approach how to use a generic header file is |
1221 | to list the file in the Kbuild file. | 1226 | to list the file in the Kbuild file. |
1222 | See "7.3 generic-y" for further info on syntax etc. | 1227 | See "7.2 generic-y" for further info on syntax etc. |
1223 | 1228 | ||
1224 | --- 6.11 Post-link pass | 1229 | --- 6.11 Post-link pass |
1225 | 1230 | ||
@@ -1254,13 +1259,13 @@ A Kbuild file may be defined under arch/<arch>/include/uapi/asm/ and | |||
1254 | arch/<arch>/include/asm/ to list asm files coming from asm-generic. | 1259 | arch/<arch>/include/asm/ to list asm files coming from asm-generic. |
1255 | See subsequent chapter for the syntax of the Kbuild file. | 1260 | See subsequent chapter for the syntax of the Kbuild file. |
1256 | 1261 | ||
1257 | --- 7.1 no-export-headers | 1262 | --- 7.1 no-export-headers |
1258 | 1263 | ||
1259 | no-export-headers is essentially used by include/uapi/linux/Kbuild to | 1264 | no-export-headers is essentially used by include/uapi/linux/Kbuild to |
1260 | avoid exporting specific headers (e.g. kvm.h) on architectures that do | 1265 | avoid exporting specific headers (e.g. kvm.h) on architectures that do |
1261 | not support it. It should be avoided as much as possible. | 1266 | not support it. It should be avoided as much as possible. |
1262 | 1267 | ||
1263 | --- 7.2 generic-y | 1268 | --- 7.2 generic-y |
1264 | 1269 | ||
1265 | If an architecture uses a verbatim copy of a header from | 1270 | If an architecture uses a verbatim copy of a header from |
1266 | include/asm-generic then this is listed in the file | 1271 | include/asm-generic then this is listed in the file |
@@ -1287,7 +1292,7 @@ See subsequent chapter for the syntax of the Kbuild file. | |||
1287 | Example: termios.h | 1292 | Example: termios.h |
1288 | #include <asm-generic/termios.h> | 1293 | #include <asm-generic/termios.h> |
1289 | 1294 | ||
1290 | --- 7.3 generated-y | 1295 | --- 7.3 generated-y |
1291 | 1296 | ||
1292 | If an architecture generates other header files alongside generic-y | 1297 | If an architecture generates other header files alongside generic-y |
1293 | wrappers, generated-y specifies them. | 1298 | wrappers, generated-y specifies them. |
@@ -1299,7 +1304,7 @@ See subsequent chapter for the syntax of the Kbuild file. | |||
1299 | #arch/x86/include/asm/Kbuild | 1304 | #arch/x86/include/asm/Kbuild |
1300 | generated-y += syscalls_32.h | 1305 | generated-y += syscalls_32.h |
1301 | 1306 | ||
1302 | --- 7.5 mandatory-y | 1307 | --- 7.4 mandatory-y |
1303 | 1308 | ||
1304 | mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm | 1309 | mandatory-y is essentially used by include/uapi/asm-generic/Kbuild.asm |
1305 | to define the minimum set of headers that must be exported in | 1310 | to define the minimum set of headers that must be exported in |
diff --git a/MAINTAINERS b/MAINTAINERS index 3e95dd7db02c..c4d21b302409 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -9220,7 +9220,6 @@ F: include/linux/isicom.h | |||
9220 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER | 9220 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER |
9221 | M: Bin Liu <b-liu@ti.com> | 9221 | M: Bin Liu <b-liu@ti.com> |
9222 | L: linux-usb@vger.kernel.org | 9222 | L: linux-usb@vger.kernel.org |
9223 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git | ||
9224 | S: Maintained | 9223 | S: Maintained |
9225 | F: drivers/usb/musb/ | 9224 | F: drivers/usb/musb/ |
9226 | 9225 | ||
@@ -10187,7 +10186,6 @@ F: Documentation/parport*.txt | |||
10187 | 10186 | ||
10188 | PARAVIRT_OPS INTERFACE | 10187 | PARAVIRT_OPS INTERFACE |
10189 | M: Juergen Gross <jgross@suse.com> | 10188 | M: Juergen Gross <jgross@suse.com> |
10190 | M: Chris Wright <chrisw@sous-sol.org> | ||
10191 | M: Alok Kataria <akataria@vmware.com> | 10189 | M: Alok Kataria <akataria@vmware.com> |
10192 | M: Rusty Russell <rusty@rustcorp.com.au> | 10190 | M: Rusty Russell <rusty@rustcorp.com.au> |
10193 | L: virtualization@lists.linux-foundation.org | 10191 | L: virtualization@lists.linux-foundation.org |
@@ -10567,6 +10565,8 @@ M: Peter Zijlstra <peterz@infradead.org> | |||
10567 | M: Ingo Molnar <mingo@redhat.com> | 10565 | M: Ingo Molnar <mingo@redhat.com> |
10568 | M: Arnaldo Carvalho de Melo <acme@kernel.org> | 10566 | M: Arnaldo Carvalho de Melo <acme@kernel.org> |
10569 | R: Alexander Shishkin <alexander.shishkin@linux.intel.com> | 10567 | R: Alexander Shishkin <alexander.shishkin@linux.intel.com> |
10568 | R: Jiri Olsa <jolsa@redhat.com> | ||
10569 | R: Namhyung Kim <namhyung@kernel.org> | ||
10570 | L: linux-kernel@vger.kernel.org | 10570 | L: linux-kernel@vger.kernel.org |
10571 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core | 10571 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core |
10572 | S: Supported | 10572 | S: Supported |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 14 | 2 | PATCHLEVEL = 14 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Fearless Coyote | 5 | NAME = Fearless Coyote |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -130,8 +130,8 @@ endif | |||
130 | ifneq ($(KBUILD_OUTPUT),) | 130 | ifneq ($(KBUILD_OUTPUT),) |
131 | # check that the output directory actually exists | 131 | # check that the output directory actually exists |
132 | saved-output := $(KBUILD_OUTPUT) | 132 | saved-output := $(KBUILD_OUTPUT) |
133 | $(shell [ -d $(KBUILD_OUTPUT) ] || mkdir -p $(KBUILD_OUTPUT)) | 133 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ |
134 | KBUILD_OUTPUT := $(realpath $(KBUILD_OUTPUT)) | 134 | && /bin/pwd) |
135 | $(if $(KBUILD_OUTPUT),, \ | 135 | $(if $(KBUILD_OUTPUT),, \ |
136 | $(error failed to create output directory "$(saved-output)")) | 136 | $(error failed to create output directory "$(saved-output)")) |
137 | 137 | ||
@@ -697,11 +697,11 @@ KBUILD_CFLAGS += $(stackp-flag) | |||
697 | 697 | ||
698 | ifeq ($(cc-name),clang) | 698 | ifeq ($(cc-name),clang) |
699 | ifneq ($(CROSS_COMPILE),) | 699 | ifneq ($(CROSS_COMPILE),) |
700 | CLANG_TARGET := -target $(notdir $(CROSS_COMPILE:%-=%)) | 700 | CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) |
701 | GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) | 701 | GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..) |
702 | endif | 702 | endif |
703 | ifneq ($(GCC_TOOLCHAIN),) | 703 | ifneq ($(GCC_TOOLCHAIN),) |
704 | CLANG_GCC_TC := -gcc-toolchain $(GCC_TOOLCHAIN) | 704 | CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) |
705 | endif | 705 | endif |
706 | KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) | 706 | KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) |
707 | KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) | 707 | KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) |
@@ -1399,7 +1399,7 @@ help: | |||
1399 | @echo ' Build, install, and boot kernel before' | 1399 | @echo ' Build, install, and boot kernel before' |
1400 | @echo ' running kselftest on it' | 1400 | @echo ' running kselftest on it' |
1401 | @echo ' kselftest-clean - Remove all generated kselftest files' | 1401 | @echo ' kselftest-clean - Remove all generated kselftest files' |
1402 | @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existed' | 1402 | @echo ' kselftest-merge - Merge all the config dependencies of kselftest to existing' |
1403 | @echo ' .config.' | 1403 | @echo ' .config.' |
1404 | @echo '' | 1404 | @echo '' |
1405 | @echo 'Userspace tools targets:' | 1405 | @echo 'Userspace tools targets:' |
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c index 118dc6af1805..7ad074fd5ab5 100644 --- a/arch/alpha/kernel/sys_alcor.c +++ b/arch/alpha/kernel/sys_alcor.c | |||
@@ -181,10 +181,10 @@ alcor_init_irq(void) | |||
181 | * comes in on. This makes interrupt processing much easier. | 181 | * comes in on. This makes interrupt processing much easier. |
182 | */ | 182 | */ |
183 | 183 | ||
184 | static int __init | 184 | static int |
185 | alcor_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 185 | alcor_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
186 | { | 186 | { |
187 | static char irq_tab[7][5] __initdata = { | 187 | static char irq_tab[7][5] = { |
188 | /*INT INTA INTB INTC INTD */ | 188 | /*INT INTA INTB INTC INTD */ |
189 | /* note: IDSEL 17 is XLT only */ | 189 | /* note: IDSEL 17 is XLT only */ |
190 | {16+13, 16+13, 16+13, 16+13, 16+13}, /* IdSel 17, TULIP */ | 190 | {16+13, 16+13, 16+13, 16+13, 16+13}, /* IdSel 17, TULIP */ |
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c index 4c50f8f40cbb..c0fa1fe5ce77 100644 --- a/arch/alpha/kernel/sys_cabriolet.c +++ b/arch/alpha/kernel/sys_cabriolet.c | |||
@@ -173,10 +173,10 @@ pc164_init_irq(void) | |||
173 | * because it is the Saturn IO (SIO) PCI/ISA Bridge Chip. | 173 | * because it is the Saturn IO (SIO) PCI/ISA Bridge Chip. |
174 | */ | 174 | */ |
175 | 175 | ||
176 | static inline int __init | 176 | static inline int |
177 | eb66p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 177 | eb66p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
178 | { | 178 | { |
179 | static char irq_tab[5][5] __initdata = { | 179 | static char irq_tab[5][5] = { |
180 | /*INT INTA INTB INTC INTD */ | 180 | /*INT INTA INTB INTC INTD */ |
181 | {16+0, 16+0, 16+5, 16+9, 16+13}, /* IdSel 6, slot 0, J25 */ | 181 | {16+0, 16+0, 16+5, 16+9, 16+13}, /* IdSel 6, slot 0, J25 */ |
182 | {16+1, 16+1, 16+6, 16+10, 16+14}, /* IdSel 7, slot 1, J26 */ | 182 | {16+1, 16+1, 16+6, 16+10, 16+14}, /* IdSel 7, slot 1, J26 */ |
@@ -203,10 +203,10 @@ eb66p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
203 | * because it is the Saturn IO (SIO) PCI/ISA Bridge Chip. | 203 | * because it is the Saturn IO (SIO) PCI/ISA Bridge Chip. |
204 | */ | 204 | */ |
205 | 205 | ||
206 | static inline int __init | 206 | static inline int |
207 | cabriolet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 207 | cabriolet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
208 | { | 208 | { |
209 | static char irq_tab[5][5] __initdata = { | 209 | static char irq_tab[5][5] = { |
210 | /*INT INTA INTB INTC INTD */ | 210 | /*INT INTA INTB INTC INTD */ |
211 | { 16+2, 16+2, 16+7, 16+11, 16+15}, /* IdSel 5, slot 2, J21 */ | 211 | { 16+2, 16+2, 16+7, 16+11, 16+15}, /* IdSel 5, slot 2, J21 */ |
212 | { 16+0, 16+0, 16+5, 16+9, 16+13}, /* IdSel 6, slot 0, J19 */ | 212 | { 16+0, 16+0, 16+5, 16+9, 16+13}, /* IdSel 6, slot 0, J19 */ |
@@ -287,10 +287,10 @@ cia_cab_init_pci(void) | |||
287 | * | 287 | * |
288 | */ | 288 | */ |
289 | 289 | ||
290 | static inline int __init | 290 | static inline int |
291 | alphapc164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 291 | alphapc164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
292 | { | 292 | { |
293 | static char irq_tab[7][5] __initdata = { | 293 | static char irq_tab[7][5] = { |
294 | /*INT INTA INTB INTC INTD */ | 294 | /*INT INTA INTB INTC INTD */ |
295 | { 16+2, 16+2, 16+9, 16+13, 16+17}, /* IdSel 5, slot 2, J20 */ | 295 | { 16+2, 16+2, 16+9, 16+13, 16+17}, /* IdSel 5, slot 2, J20 */ |
296 | { 16+0, 16+0, 16+7, 16+11, 16+15}, /* IdSel 6, slot 0, J29 */ | 296 | { 16+0, 16+0, 16+7, 16+11, 16+15}, /* IdSel 6, slot 0, J29 */ |
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index 6c35159bc00e..9e1e40ea1d14 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c | |||
@@ -356,7 +356,7 @@ clipper_init_irq(void) | |||
356 | * 10 64 bit PCI option slot 3 (not bus 0) | 356 | * 10 64 bit PCI option slot 3 (not bus 0) |
357 | */ | 357 | */ |
358 | 358 | ||
359 | static int __init | 359 | static int |
360 | isa_irq_fixup(const struct pci_dev *dev, int irq) | 360 | isa_irq_fixup(const struct pci_dev *dev, int irq) |
361 | { | 361 | { |
362 | u8 irq8; | 362 | u8 irq8; |
@@ -372,10 +372,10 @@ isa_irq_fixup(const struct pci_dev *dev, int irq) | |||
372 | return irq8 & 0xf; | 372 | return irq8 & 0xf; |
373 | } | 373 | } |
374 | 374 | ||
375 | static int __init | 375 | static int |
376 | dp264_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 376 | dp264_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
377 | { | 377 | { |
378 | static char irq_tab[6][5] __initdata = { | 378 | static char irq_tab[6][5] = { |
379 | /*INT INTA INTB INTC INTD */ | 379 | /*INT INTA INTB INTC INTD */ |
380 | { -1, -1, -1, -1, -1}, /* IdSel 5 ISA Bridge */ | 380 | { -1, -1, -1, -1, -1}, /* IdSel 5 ISA Bridge */ |
381 | { 16+ 3, 16+ 3, 16+ 2, 16+ 2, 16+ 2}, /* IdSel 6 SCSI builtin*/ | 381 | { 16+ 3, 16+ 3, 16+ 2, 16+ 2, 16+ 2}, /* IdSel 6 SCSI builtin*/ |
@@ -394,10 +394,10 @@ dp264_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
394 | return isa_irq_fixup(dev, irq); | 394 | return isa_irq_fixup(dev, irq); |
395 | } | 395 | } |
396 | 396 | ||
397 | static int __init | 397 | static int |
398 | monet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 398 | monet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
399 | { | 399 | { |
400 | static char irq_tab[13][5] __initdata = { | 400 | static char irq_tab[13][5] = { |
401 | /*INT INTA INTB INTC INTD */ | 401 | /*INT INTA INTB INTC INTD */ |
402 | { 45, 45, 45, 45, 45}, /* IdSel 3 21143 PCI1 */ | 402 | { 45, 45, 45, 45, 45}, /* IdSel 3 21143 PCI1 */ |
403 | { -1, -1, -1, -1, -1}, /* IdSel 4 unused */ | 403 | { -1, -1, -1, -1, -1}, /* IdSel 4 unused */ |
@@ -423,7 +423,7 @@ monet_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
423 | return isa_irq_fixup(dev, COMMON_TABLE_LOOKUP); | 423 | return isa_irq_fixup(dev, COMMON_TABLE_LOOKUP); |
424 | } | 424 | } |
425 | 425 | ||
426 | static u8 __init | 426 | static u8 |
427 | monet_swizzle(struct pci_dev *dev, u8 *pinp) | 427 | monet_swizzle(struct pci_dev *dev, u8 *pinp) |
428 | { | 428 | { |
429 | struct pci_controller *hose = dev->sysdata; | 429 | struct pci_controller *hose = dev->sysdata; |
@@ -456,10 +456,10 @@ monet_swizzle(struct pci_dev *dev, u8 *pinp) | |||
456 | return slot; | 456 | return slot; |
457 | } | 457 | } |
458 | 458 | ||
459 | static int __init | 459 | static int |
460 | webbrick_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 460 | webbrick_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
461 | { | 461 | { |
462 | static char irq_tab[13][5] __initdata = { | 462 | static char irq_tab[13][5] = { |
463 | /*INT INTA INTB INTC INTD */ | 463 | /*INT INTA INTB INTC INTD */ |
464 | { -1, -1, -1, -1, -1}, /* IdSel 7 ISA Bridge */ | 464 | { -1, -1, -1, -1, -1}, /* IdSel 7 ISA Bridge */ |
465 | { -1, -1, -1, -1, -1}, /* IdSel 8 unused */ | 465 | { -1, -1, -1, -1, -1}, /* IdSel 8 unused */ |
@@ -478,10 +478,10 @@ webbrick_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
478 | return isa_irq_fixup(dev, COMMON_TABLE_LOOKUP); | 478 | return isa_irq_fixup(dev, COMMON_TABLE_LOOKUP); |
479 | } | 479 | } |
480 | 480 | ||
481 | static int __init | 481 | static int |
482 | clipper_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 482 | clipper_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
483 | { | 483 | { |
484 | static char irq_tab[7][5] __initdata = { | 484 | static char irq_tab[7][5] = { |
485 | /*INT INTA INTB INTC INTD */ | 485 | /*INT INTA INTB INTC INTD */ |
486 | { 16+ 8, 16+ 8, 16+ 9, 16+10, 16+11}, /* IdSel 1 slot 1 */ | 486 | { 16+ 8, 16+ 8, 16+ 9, 16+10, 16+11}, /* IdSel 1 slot 1 */ |
487 | { 16+12, 16+12, 16+13, 16+14, 16+15}, /* IdSel 2 slot 2 */ | 487 | { 16+12, 16+12, 16+13, 16+14, 16+15}, /* IdSel 2 slot 2 */ |
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c index ad40a425e841..372661c56537 100644 --- a/arch/alpha/kernel/sys_eb64p.c +++ b/arch/alpha/kernel/sys_eb64p.c | |||
@@ -167,10 +167,10 @@ eb64p_init_irq(void) | |||
167 | * comes in on. This makes interrupt processing much easier. | 167 | * comes in on. This makes interrupt processing much easier. |
168 | */ | 168 | */ |
169 | 169 | ||
170 | static int __init | 170 | static int |
171 | eb64p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 171 | eb64p_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
172 | { | 172 | { |
173 | static char irq_tab[5][5] __initdata = { | 173 | static char irq_tab[5][5] = { |
174 | /*INT INTA INTB INTC INTD */ | 174 | /*INT INTA INTB INTC INTD */ |
175 | {16+7, 16+7, 16+7, 16+7, 16+7}, /* IdSel 5, slot ?, ?? */ | 175 | {16+7, 16+7, 16+7, 16+7, 16+7}, /* IdSel 5, slot ?, ?? */ |
176 | {16+0, 16+0, 16+2, 16+4, 16+9}, /* IdSel 6, slot ?, ?? */ | 176 | {16+0, 16+0, 16+2, 16+4, 16+9}, /* IdSel 6, slot ?, ?? */ |
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c index 15f42083bdb3..2731738b5872 100644 --- a/arch/alpha/kernel/sys_eiger.c +++ b/arch/alpha/kernel/sys_eiger.c | |||
@@ -141,7 +141,7 @@ eiger_init_irq(void) | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | static int __init | 144 | static int |
145 | eiger_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 145 | eiger_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
146 | { | 146 | { |
147 | u8 irq_orig; | 147 | u8 irq_orig; |
@@ -158,7 +158,7 @@ eiger_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
158 | return irq_orig - 0x80; | 158 | return irq_orig - 0x80; |
159 | } | 159 | } |
160 | 160 | ||
161 | static u8 __init | 161 | static u8 |
162 | eiger_swizzle(struct pci_dev *dev, u8 *pinp) | 162 | eiger_swizzle(struct pci_dev *dev, u8 *pinp) |
163 | { | 163 | { |
164 | struct pci_controller *hose = dev->sysdata; | 164 | struct pci_controller *hose = dev->sysdata; |
diff --git a/arch/alpha/kernel/sys_miata.c b/arch/alpha/kernel/sys_miata.c index d5b9776a608d..731d693fa1f9 100644 --- a/arch/alpha/kernel/sys_miata.c +++ b/arch/alpha/kernel/sys_miata.c | |||
@@ -149,10 +149,10 @@ miata_init_irq(void) | |||
149 | * comes in on. This makes interrupt processing much easier. | 149 | * comes in on. This makes interrupt processing much easier. |
150 | */ | 150 | */ |
151 | 151 | ||
152 | static int __init | 152 | static int |
153 | miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 153 | miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
154 | { | 154 | { |
155 | static char irq_tab[18][5] __initdata = { | 155 | static char irq_tab[18][5] = { |
156 | /*INT INTA INTB INTC INTD */ | 156 | /*INT INTA INTB INTC INTD */ |
157 | {16+ 8, 16+ 8, 16+ 8, 16+ 8, 16+ 8}, /* IdSel 14, DC21142 */ | 157 | {16+ 8, 16+ 8, 16+ 8, 16+ 8, 16+ 8}, /* IdSel 14, DC21142 */ |
158 | { -1, -1, -1, -1, -1}, /* IdSel 15, EIDE */ | 158 | { -1, -1, -1, -1, -1}, /* IdSel 15, EIDE */ |
@@ -196,7 +196,7 @@ miata_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
196 | return COMMON_TABLE_LOOKUP; | 196 | return COMMON_TABLE_LOOKUP; |
197 | } | 197 | } |
198 | 198 | ||
199 | static u8 __init | 199 | static u8 |
200 | miata_swizzle(struct pci_dev *dev, u8 *pinp) | 200 | miata_swizzle(struct pci_dev *dev, u8 *pinp) |
201 | { | 201 | { |
202 | int slot, pin = *pinp; | 202 | int slot, pin = *pinp; |
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c index 5e82dc1ad6f2..350ec9c8335b 100644 --- a/arch/alpha/kernel/sys_mikasa.c +++ b/arch/alpha/kernel/sys_mikasa.c | |||
@@ -145,10 +145,10 @@ mikasa_init_irq(void) | |||
145 | * comes in on. This makes interrupt processing much easier. | 145 | * comes in on. This makes interrupt processing much easier. |
146 | */ | 146 | */ |
147 | 147 | ||
148 | static int __init | 148 | static int |
149 | mikasa_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 149 | mikasa_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
150 | { | 150 | { |
151 | static char irq_tab[8][5] __initdata = { | 151 | static char irq_tab[8][5] = { |
152 | /*INT INTA INTB INTC INTD */ | 152 | /*INT INTA INTB INTC INTD */ |
153 | {16+12, 16+12, 16+12, 16+12, 16+12}, /* IdSel 17, SCSI */ | 153 | {16+12, 16+12, 16+12, 16+12, 16+12}, /* IdSel 17, SCSI */ |
154 | { -1, -1, -1, -1, -1}, /* IdSel 18, PCEB */ | 154 | { -1, -1, -1, -1, -1}, /* IdSel 18, PCEB */ |
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c index 8ae04a121186..d019e4ce07bd 100644 --- a/arch/alpha/kernel/sys_nautilus.c +++ b/arch/alpha/kernel/sys_nautilus.c | |||
@@ -62,7 +62,7 @@ nautilus_init_irq(void) | |||
62 | common_init_isa_dma(); | 62 | common_init_isa_dma(); |
63 | } | 63 | } |
64 | 64 | ||
65 | static int __init | 65 | static int |
66 | nautilus_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 66 | nautilus_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
67 | { | 67 | { |
68 | /* Preserve the IRQ set up by the console. */ | 68 | /* Preserve the IRQ set up by the console. */ |
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c index 063e594fd969..2301678d9f9d 100644 --- a/arch/alpha/kernel/sys_noritake.c +++ b/arch/alpha/kernel/sys_noritake.c | |||
@@ -193,10 +193,10 @@ noritake_init_irq(void) | |||
193 | * comes in on. This makes interrupt processing much easier. | 193 | * comes in on. This makes interrupt processing much easier. |
194 | */ | 194 | */ |
195 | 195 | ||
196 | static int __init | 196 | static int |
197 | noritake_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 197 | noritake_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
198 | { | 198 | { |
199 | static char irq_tab[15][5] __initdata = { | 199 | static char irq_tab[15][5] = { |
200 | /*INT INTA INTB INTC INTD */ | 200 | /*INT INTA INTB INTC INTD */ |
201 | /* note: IDSELs 16, 17, and 25 are CORELLE only */ | 201 | /* note: IDSELs 16, 17, and 25 are CORELLE only */ |
202 | { 16+1, 16+1, 16+1, 16+1, 16+1}, /* IdSel 16, QLOGIC */ | 202 | { 16+1, 16+1, 16+1, 16+1, 16+1}, /* IdSel 16, QLOGIC */ |
@@ -221,7 +221,7 @@ noritake_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
221 | return COMMON_TABLE_LOOKUP; | 221 | return COMMON_TABLE_LOOKUP; |
222 | } | 222 | } |
223 | 223 | ||
224 | static u8 __init | 224 | static u8 |
225 | noritake_swizzle(struct pci_dev *dev, u8 *pinp) | 225 | noritake_swizzle(struct pci_dev *dev, u8 *pinp) |
226 | { | 226 | { |
227 | int slot, pin = *pinp; | 227 | int slot, pin = *pinp; |
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c index dfd510ae5d8c..546822d07dc7 100644 --- a/arch/alpha/kernel/sys_rawhide.c +++ b/arch/alpha/kernel/sys_rawhide.c | |||
@@ -221,10 +221,10 @@ rawhide_init_irq(void) | |||
221 | * | 221 | * |
222 | */ | 222 | */ |
223 | 223 | ||
224 | static int __init | 224 | static int |
225 | rawhide_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 225 | rawhide_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
226 | { | 226 | { |
227 | static char irq_tab[5][5] __initdata = { | 227 | static char irq_tab[5][5] = { |
228 | /*INT INTA INTB INTC INTD */ | 228 | /*INT INTA INTB INTC INTD */ |
229 | { 16+16, 16+16, 16+16, 16+16, 16+16}, /* IdSel 1 SCSI PCI 1 */ | 229 | { 16+16, 16+16, 16+16, 16+16, 16+16}, /* IdSel 1 SCSI PCI 1 */ |
230 | { 16+ 0, 16+ 0, 16+ 1, 16+ 2, 16+ 3}, /* IdSel 2 slot 2 */ | 230 | { 16+ 0, 16+ 0, 16+ 1, 16+ 2, 16+ 3}, /* IdSel 2 slot 2 */ |
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c index a3f485257170..3b35e1913492 100644 --- a/arch/alpha/kernel/sys_ruffian.c +++ b/arch/alpha/kernel/sys_ruffian.c | |||
@@ -117,10 +117,10 @@ ruffian_kill_arch (int mode) | |||
117 | * | 117 | * |
118 | */ | 118 | */ |
119 | 119 | ||
120 | static int __init | 120 | static int |
121 | ruffian_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 121 | ruffian_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
122 | { | 122 | { |
123 | static char irq_tab[11][5] __initdata = { | 123 | static char irq_tab[11][5] = { |
124 | /*INT INTA INTB INTC INTD */ | 124 | /*INT INTA INTB INTC INTD */ |
125 | {-1, -1, -1, -1, -1}, /* IdSel 13, 21052 */ | 125 | {-1, -1, -1, -1, -1}, /* IdSel 13, 21052 */ |
126 | {-1, -1, -1, -1, -1}, /* IdSel 14, SIO */ | 126 | {-1, -1, -1, -1, -1}, /* IdSel 14, SIO */ |
@@ -139,7 +139,7 @@ ruffian_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
139 | return COMMON_TABLE_LOOKUP; | 139 | return COMMON_TABLE_LOOKUP; |
140 | } | 140 | } |
141 | 141 | ||
142 | static u8 __init | 142 | static u8 |
143 | ruffian_swizzle(struct pci_dev *dev, u8 *pinp) | 143 | ruffian_swizzle(struct pci_dev *dev, u8 *pinp) |
144 | { | 144 | { |
145 | int slot, pin = *pinp; | 145 | int slot, pin = *pinp; |
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c index 08ee737d4fba..e178007107ef 100644 --- a/arch/alpha/kernel/sys_rx164.c +++ b/arch/alpha/kernel/sys_rx164.c | |||
@@ -142,7 +142,7 @@ rx164_init_irq(void) | |||
142 | * | 142 | * |
143 | */ | 143 | */ |
144 | 144 | ||
145 | static int __init | 145 | static int |
146 | rx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 146 | rx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
147 | { | 147 | { |
148 | #if 0 | 148 | #if 0 |
@@ -156,7 +156,7 @@ rx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
156 | { 16+1, 16+1, 16+6, 16+11, 16+16}, /* IdSel 10, slot 4 */ | 156 | { 16+1, 16+1, 16+6, 16+11, 16+16}, /* IdSel 10, slot 4 */ |
157 | }; | 157 | }; |
158 | #else | 158 | #else |
159 | static char irq_tab[6][5] __initdata = { | 159 | static char irq_tab[6][5] = { |
160 | /*INT INTA INTB INTC INTD */ | 160 | /*INT INTA INTB INTC INTD */ |
161 | { 16+0, 16+0, 16+6, 16+11, 16+16}, /* IdSel 5, slot 0 */ | 161 | { 16+0, 16+0, 16+6, 16+11, 16+16}, /* IdSel 5, slot 0 */ |
162 | { 16+1, 16+1, 16+7, 16+12, 16+17}, /* IdSel 6, slot 1 */ | 162 | { 16+1, 16+1, 16+7, 16+12, 16+17}, /* IdSel 6, slot 1 */ |
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c index 8a0aa6d67b53..86d259c2612d 100644 --- a/arch/alpha/kernel/sys_sable.c +++ b/arch/alpha/kernel/sys_sable.c | |||
@@ -192,10 +192,10 @@ sable_init_irq(void) | |||
192 | * with the values in the irq swizzling tables above. | 192 | * with the values in the irq swizzling tables above. |
193 | */ | 193 | */ |
194 | 194 | ||
195 | static int __init | 195 | static int |
196 | sable_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 196 | sable_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
197 | { | 197 | { |
198 | static char irq_tab[9][5] __initdata = { | 198 | static char irq_tab[9][5] = { |
199 | /*INT INTA INTB INTC INTD */ | 199 | /*INT INTA INTB INTC INTD */ |
200 | { 32+0, 32+0, 32+0, 32+0, 32+0}, /* IdSel 0, TULIP */ | 200 | { 32+0, 32+0, 32+0, 32+0, 32+0}, /* IdSel 0, TULIP */ |
201 | { 32+1, 32+1, 32+1, 32+1, 32+1}, /* IdSel 1, SCSI */ | 201 | { 32+1, 32+1, 32+1, 32+1, 32+1}, /* IdSel 1, SCSI */ |
@@ -374,10 +374,10 @@ lynx_init_irq(void) | |||
374 | * with the values in the irq swizzling tables above. | 374 | * with the values in the irq swizzling tables above. |
375 | */ | 375 | */ |
376 | 376 | ||
377 | static int __init | 377 | static int |
378 | lynx_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 378 | lynx_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
379 | { | 379 | { |
380 | static char irq_tab[19][5] __initdata = { | 380 | static char irq_tab[19][5] = { |
381 | /*INT INTA INTB INTC INTD */ | 381 | /*INT INTA INTB INTC INTD */ |
382 | { -1, -1, -1, -1, -1}, /* IdSel 13, PCEB */ | 382 | { -1, -1, -1, -1, -1}, /* IdSel 13, PCEB */ |
383 | { -1, -1, -1, -1, -1}, /* IdSel 14, PPB */ | 383 | { -1, -1, -1, -1, -1}, /* IdSel 14, PPB */ |
@@ -404,7 +404,7 @@ lynx_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
404 | return COMMON_TABLE_LOOKUP; | 404 | return COMMON_TABLE_LOOKUP; |
405 | } | 405 | } |
406 | 406 | ||
407 | static u8 __init | 407 | static u8 |
408 | lynx_swizzle(struct pci_dev *dev, u8 *pinp) | 408 | lynx_swizzle(struct pci_dev *dev, u8 *pinp) |
409 | { | 409 | { |
410 | int slot, pin = *pinp; | 410 | int slot, pin = *pinp; |
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c index febd24eba7a6..9fd2895639d5 100644 --- a/arch/alpha/kernel/sys_sio.c +++ b/arch/alpha/kernel/sys_sio.c | |||
@@ -144,7 +144,7 @@ sio_fixup_irq_levels(unsigned int level_bits) | |||
144 | outb((level_bits >> 8) & 0xff, 0x4d1); | 144 | outb((level_bits >> 8) & 0xff, 0x4d1); |
145 | } | 145 | } |
146 | 146 | ||
147 | static inline int __init | 147 | static inline int |
148 | noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 148 | noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
149 | { | 149 | { |
150 | /* | 150 | /* |
@@ -165,7 +165,7 @@ noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
165 | * that they use the default INTA line, if they are interrupt | 165 | * that they use the default INTA line, if they are interrupt |
166 | * driven at all). | 166 | * driven at all). |
167 | */ | 167 | */ |
168 | static char irq_tab[][5] __initdata = { | 168 | static char irq_tab[][5] = { |
169 | /*INT A B C D */ | 169 | /*INT A B C D */ |
170 | { 3, 3, 3, 3, 3}, /* idsel 6 (53c810) */ | 170 | { 3, 3, 3, 3, 3}, /* idsel 6 (53c810) */ |
171 | {-1, -1, -1, -1, -1}, /* idsel 7 (SIO: PCI/ISA bridge) */ | 171 | {-1, -1, -1, -1, -1}, /* idsel 7 (SIO: PCI/ISA bridge) */ |
@@ -183,10 +183,10 @@ noname_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
183 | return irq >= 0 ? tmp : -1; | 183 | return irq >= 0 ? tmp : -1; |
184 | } | 184 | } |
185 | 185 | ||
186 | static inline int __init | 186 | static inline int |
187 | p2k_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 187 | p2k_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
188 | { | 188 | { |
189 | static char irq_tab[][5] __initdata = { | 189 | static char irq_tab[][5] = { |
190 | /*INT A B C D */ | 190 | /*INT A B C D */ |
191 | { 0, 0, -1, -1, -1}, /* idsel 6 (53c810) */ | 191 | { 0, 0, -1, -1, -1}, /* idsel 6 (53c810) */ |
192 | {-1, -1, -1, -1, -1}, /* idsel 7 (SIO: PCI/ISA bridge) */ | 192 | {-1, -1, -1, -1, -1}, /* idsel 7 (SIO: PCI/ISA bridge) */ |
diff --git a/arch/alpha/kernel/sys_sx164.c b/arch/alpha/kernel/sys_sx164.c index d063b360efed..23eee54d714a 100644 --- a/arch/alpha/kernel/sys_sx164.c +++ b/arch/alpha/kernel/sys_sx164.c | |||
@@ -94,10 +94,10 @@ sx164_init_irq(void) | |||
94 | * 9 32 bit PCI option slot 3 | 94 | * 9 32 bit PCI option slot 3 |
95 | */ | 95 | */ |
96 | 96 | ||
97 | static int __init | 97 | static int |
98 | sx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 98 | sx164_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
99 | { | 99 | { |
100 | static char irq_tab[5][5] __initdata = { | 100 | static char irq_tab[5][5] = { |
101 | /*INT INTA INTB INTC INTD */ | 101 | /*INT INTA INTB INTC INTD */ |
102 | { 16+ 9, 16+ 9, 16+13, 16+17, 16+21}, /* IdSel 5 slot 2 J17 */ | 102 | { 16+ 9, 16+ 9, 16+13, 16+17, 16+21}, /* IdSel 5 slot 2 J17 */ |
103 | { 16+11, 16+11, 16+15, 16+19, 16+23}, /* IdSel 6 slot 0 J19 */ | 103 | { 16+11, 16+11, 16+15, 16+19, 16+23}, /* IdSel 6 slot 0 J19 */ |
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c index dd0f1eae3c68..9101f2bb6176 100644 --- a/arch/alpha/kernel/sys_takara.c +++ b/arch/alpha/kernel/sys_takara.c | |||
@@ -155,10 +155,10 @@ takara_init_irq(void) | |||
155 | * assign it whatever the hell IRQ we like and it doesn't matter. | 155 | * assign it whatever the hell IRQ we like and it doesn't matter. |
156 | */ | 156 | */ |
157 | 157 | ||
158 | static int __init | 158 | static int |
159 | takara_map_irq_srm(const struct pci_dev *dev, u8 slot, u8 pin) | 159 | takara_map_irq_srm(const struct pci_dev *dev, u8 slot, u8 pin) |
160 | { | 160 | { |
161 | static char irq_tab[15][5] __initdata = { | 161 | static char irq_tab[15][5] = { |
162 | { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ | 162 | { 16+3, 16+3, 16+3, 16+3, 16+3}, /* slot 6 == device 3 */ |
163 | { 16+2, 16+2, 16+2, 16+2, 16+2}, /* slot 7 == device 2 */ | 163 | { 16+2, 16+2, 16+2, 16+2, 16+2}, /* slot 7 == device 2 */ |
164 | { 16+1, 16+1, 16+1, 16+1, 16+1}, /* slot 8 == device 1 */ | 164 | { 16+1, 16+1, 16+1, 16+1, 16+1}, /* slot 8 == device 1 */ |
@@ -210,7 +210,7 @@ takara_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | |||
210 | return COMMON_TABLE_LOOKUP; | 210 | return COMMON_TABLE_LOOKUP; |
211 | } | 211 | } |
212 | 212 | ||
213 | static u8 __init | 213 | static u8 |
214 | takara_swizzle(struct pci_dev *dev, u8 *pinp) | 214 | takara_swizzle(struct pci_dev *dev, u8 *pinp) |
215 | { | 215 | { |
216 | int slot = PCI_SLOT(dev->devfn); | 216 | int slot = PCI_SLOT(dev->devfn); |
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c index ee1874887776..c3f8b79fe214 100644 --- a/arch/alpha/kernel/sys_wildfire.c +++ b/arch/alpha/kernel/sys_wildfire.c | |||
@@ -288,10 +288,10 @@ wildfire_device_interrupt(unsigned long vector) | |||
288 | * 7 64 bit PCI 1 option slot 7 | 288 | * 7 64 bit PCI 1 option slot 7 |
289 | */ | 289 | */ |
290 | 290 | ||
291 | static int __init | 291 | static int |
292 | wildfire_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | 292 | wildfire_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
293 | { | 293 | { |
294 | static char irq_tab[8][5] __initdata = { | 294 | static char irq_tab[8][5] = { |
295 | /*INT INTA INTB INTC INTD */ | 295 | /*INT INTA INTB INTC INTD */ |
296 | { -1, -1, -1, -1, -1}, /* IdSel 0 ISA Bridge */ | 296 | { -1, -1, -1, -1, -1}, /* IdSel 0 ISA Bridge */ |
297 | { 36, 36, 36+1, 36+2, 36+3}, /* IdSel 1 SCSI builtin */ | 297 | { 36, 36, 36+1, 36+2, 36+3}, /* IdSel 1 SCSI builtin */ |
diff --git a/arch/arc/boot/dts/hsdk.dts b/arch/arc/boot/dts/hsdk.dts index 8adde1b492f1..8f627c200d60 100644 --- a/arch/arc/boot/dts/hsdk.dts +++ b/arch/arc/boot/dts/hsdk.dts | |||
@@ -137,14 +137,15 @@ | |||
137 | /* | 137 | /* |
138 | * DW sdio controller has external ciu clock divider | 138 | * DW sdio controller has external ciu clock divider |
139 | * controlled via register in SDIO IP. Due to its | 139 | * controlled via register in SDIO IP. Due to its |
140 | * unexpected default value (it should devide by 1 | 140 | * unexpected default value (it should divide by 1 |
141 | * but it devides by 8) SDIO IP uses wrong clock and | 141 | * but it divides by 8) SDIO IP uses wrong clock and |
142 | * works unstable (see STAR 9001204800) | 142 | * works unstable (see STAR 9001204800) |
143 | * We switched to the minimum possible value of the | ||
144 | * divisor (div-by-2) in HSDK platform code. | ||
143 | * So add temporary fix and change clock frequency | 145 | * So add temporary fix and change clock frequency |
144 | * from 100000000 to 12500000 Hz until we fix dw sdio | 146 | * to 50000000 Hz until we fix dw sdio driver itself. |
145 | * driver itself. | ||
146 | */ | 147 | */ |
147 | clock-frequency = <12500000>; | 148 | clock-frequency = <50000000>; |
148 | #clock-cells = <0>; | 149 | #clock-cells = <0>; |
149 | }; | 150 | }; |
150 | 151 | ||
diff --git a/arch/arc/configs/hsdk_defconfig b/arch/arc/configs/hsdk_defconfig index 15f0f6b5fec1..7b8f8faf8a24 100644 --- a/arch/arc/configs/hsdk_defconfig +++ b/arch/arc/configs/hsdk_defconfig | |||
@@ -63,7 +63,6 @@ CONFIG_MMC_SDHCI=y | |||
63 | CONFIG_MMC_SDHCI_PLTFM=y | 63 | CONFIG_MMC_SDHCI_PLTFM=y |
64 | CONFIG_MMC_DW=y | 64 | CONFIG_MMC_DW=y |
65 | # CONFIG_IOMMU_SUPPORT is not set | 65 | # CONFIG_IOMMU_SUPPORT is not set |
66 | CONFIG_RESET_HSDK=y | ||
67 | CONFIG_EXT3_FS=y | 66 | CONFIG_EXT3_FS=y |
68 | CONFIG_VFAT_FS=y | 67 | CONFIG_VFAT_FS=y |
69 | CONFIG_TMPFS=y | 68 | CONFIG_TMPFS=y |
diff --git a/arch/arc/kernel/smp.c b/arch/arc/kernel/smp.c index f46267153ec2..6df9d94a9537 100644 --- a/arch/arc/kernel/smp.c +++ b/arch/arc/kernel/smp.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/cpumask.h> | 23 | #include <linux/cpumask.h> |
24 | #include <linux/reboot.h> | 24 | #include <linux/reboot.h> |
25 | #include <linux/irqdomain.h> | 25 | #include <linux/irqdomain.h> |
26 | #include <linux/export.h> | ||
27 | |||
26 | #include <asm/processor.h> | 28 | #include <asm/processor.h> |
27 | #include <asm/setup.h> | 29 | #include <asm/setup.h> |
28 | #include <asm/mach_desc.h> | 30 | #include <asm/mach_desc.h> |
@@ -30,6 +32,9 @@ | |||
30 | #ifndef CONFIG_ARC_HAS_LLSC | 32 | #ifndef CONFIG_ARC_HAS_LLSC |
31 | arch_spinlock_t smp_atomic_ops_lock = __ARCH_SPIN_LOCK_UNLOCKED; | 33 | arch_spinlock_t smp_atomic_ops_lock = __ARCH_SPIN_LOCK_UNLOCKED; |
32 | arch_spinlock_t smp_bitops_lock = __ARCH_SPIN_LOCK_UNLOCKED; | 34 | arch_spinlock_t smp_bitops_lock = __ARCH_SPIN_LOCK_UNLOCKED; |
35 | |||
36 | EXPORT_SYMBOL_GPL(smp_atomic_ops_lock); | ||
37 | EXPORT_SYMBOL_GPL(smp_bitops_lock); | ||
33 | #endif | 38 | #endif |
34 | 39 | ||
35 | struct plat_smp_ops __weak plat_smp_ops; | 40 | struct plat_smp_ops __weak plat_smp_ops; |
diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig index bd08de4be75e..19ab3cf98f0f 100644 --- a/arch/arc/plat-hsdk/Kconfig +++ b/arch/arc/plat-hsdk/Kconfig | |||
@@ -8,3 +8,4 @@ | |||
8 | menuconfig ARC_SOC_HSDK | 8 | menuconfig ARC_SOC_HSDK |
9 | bool "ARC HS Development Kit SOC" | 9 | bool "ARC HS Development Kit SOC" |
10 | select CLK_HSDK | 10 | select CLK_HSDK |
11 | select RESET_HSDK | ||
diff --git a/arch/arc/plat-hsdk/platform.c b/arch/arc/plat-hsdk/platform.c index 744e62e58788..fd0ae5e38639 100644 --- a/arch/arc/plat-hsdk/platform.c +++ b/arch/arc/plat-hsdk/platform.c | |||
@@ -74,6 +74,10 @@ static void __init hsdk_set_cpu_freq_1ghz(void) | |||
74 | pr_err("Failed to setup CPU frequency to 1GHz!"); | 74 | pr_err("Failed to setup CPU frequency to 1GHz!"); |
75 | } | 75 | } |
76 | 76 | ||
77 | #define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000) | ||
78 | #define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108) | ||
79 | #define SDIO_UHS_REG_EXT_DIV_2 (2 << 30) | ||
80 | |||
77 | static void __init hsdk_init_early(void) | 81 | static void __init hsdk_init_early(void) |
78 | { | 82 | { |
79 | /* | 83 | /* |
@@ -90,6 +94,12 @@ static void __init hsdk_init_early(void) | |||
90 | writel(1, (void __iomem *) CREG_PAE_UPDATE); | 94 | writel(1, (void __iomem *) CREG_PAE_UPDATE); |
91 | 95 | ||
92 | /* | 96 | /* |
97 | * Switch SDIO external ciu clock divider from default div-by-8 to | ||
98 | * minimum possible div-by-2. | ||
99 | */ | ||
100 | iowrite32(SDIO_UHS_REG_EXT_DIV_2, (void __iomem *) SDIO_UHS_REG_EXT); | ||
101 | |||
102 | /* | ||
93 | * Setup CPU frequency to 1GHz. | 103 | * Setup CPU frequency to 1GHz. |
94 | * TODO: remove it after smart hsdk pll driver will be introduced. | 104 | * TODO: remove it after smart hsdk pll driver will be introduced. |
95 | */ | 105 | */ |
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c index e71eefa2e427..0641ba54ab62 100644 --- a/arch/arm/xen/p2m.c +++ b/arch/arm/xen/p2m.c | |||
@@ -1,7 +1,7 @@ | |||
1 | #include <linux/bootmem.h> | 1 | #include <linux/bootmem.h> |
2 | #include <linux/gfp.h> | 2 | #include <linux/gfp.h> |
3 | #include <linux/export.h> | 3 | #include <linux/export.h> |
4 | #include <linux/rwlock.h> | 4 | #include <linux/spinlock.h> |
5 | #include <linux/slab.h> | 5 | #include <linux/slab.h> |
6 | #include <linux/types.h> | 6 | #include <linux/types.h> |
7 | #include <linux/dma-mapping.h> | 7 | #include <linux/dma-mapping.h> |
diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 8f2da8bba737..4dffa611376d 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c | |||
@@ -478,28 +478,30 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, | |||
478 | return ret; | 478 | return ret; |
479 | 479 | ||
480 | dir = iommu_tce_direction(tce); | 480 | dir = iommu_tce_direction(tce); |
481 | |||
482 | idx = srcu_read_lock(&vcpu->kvm->srcu); | ||
483 | |||
481 | if ((dir != DMA_NONE) && kvmppc_gpa_to_ua(vcpu->kvm, | 484 | if ((dir != DMA_NONE) && kvmppc_gpa_to_ua(vcpu->kvm, |
482 | tce & ~(TCE_PCI_READ | TCE_PCI_WRITE), &ua, NULL)) | 485 | tce & ~(TCE_PCI_READ | TCE_PCI_WRITE), &ua, NULL)) { |
483 | return H_PARAMETER; | 486 | ret = H_PARAMETER; |
487 | goto unlock_exit; | ||
488 | } | ||
484 | 489 | ||
485 | entry = ioba >> stt->page_shift; | 490 | entry = ioba >> stt->page_shift; |
486 | 491 | ||
487 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { | 492 | list_for_each_entry_lockless(stit, &stt->iommu_tables, next) { |
488 | if (dir == DMA_NONE) { | 493 | if (dir == DMA_NONE) |
489 | ret = kvmppc_tce_iommu_unmap(vcpu->kvm, | 494 | ret = kvmppc_tce_iommu_unmap(vcpu->kvm, |
490 | stit->tbl, entry); | 495 | stit->tbl, entry); |
491 | } else { | 496 | else |
492 | idx = srcu_read_lock(&vcpu->kvm->srcu); | ||
493 | ret = kvmppc_tce_iommu_map(vcpu->kvm, stit->tbl, | 497 | ret = kvmppc_tce_iommu_map(vcpu->kvm, stit->tbl, |
494 | entry, ua, dir); | 498 | entry, ua, dir); |
495 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | ||
496 | } | ||
497 | 499 | ||
498 | if (ret == H_SUCCESS) | 500 | if (ret == H_SUCCESS) |
499 | continue; | 501 | continue; |
500 | 502 | ||
501 | if (ret == H_TOO_HARD) | 503 | if (ret == H_TOO_HARD) |
502 | return ret; | 504 | goto unlock_exit; |
503 | 505 | ||
504 | WARN_ON_ONCE(1); | 506 | WARN_ON_ONCE(1); |
505 | kvmppc_clear_tce(stit->tbl, entry); | 507 | kvmppc_clear_tce(stit->tbl, entry); |
@@ -507,7 +509,10 @@ long kvmppc_h_put_tce(struct kvm_vcpu *vcpu, unsigned long liobn, | |||
507 | 509 | ||
508 | kvmppc_tce_put(stt, entry, tce); | 510 | kvmppc_tce_put(stt, entry, tce); |
509 | 511 | ||
510 | return H_SUCCESS; | 512 | unlock_exit: |
513 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | ||
514 | |||
515 | return ret; | ||
511 | } | 516 | } |
512 | EXPORT_SYMBOL_GPL(kvmppc_h_put_tce); | 517 | EXPORT_SYMBOL_GPL(kvmppc_h_put_tce); |
513 | 518 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index ec69fa45d5a2..42639fba89e8 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -989,13 +989,14 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300) | |||
989 | beq no_xive | 989 | beq no_xive |
990 | ld r11, VCPU_XIVE_SAVED_STATE(r4) | 990 | ld r11, VCPU_XIVE_SAVED_STATE(r4) |
991 | li r9, TM_QW1_OS | 991 | li r9, TM_QW1_OS |
992 | stdcix r11,r9,r10 | ||
993 | eieio | 992 | eieio |
993 | stdcix r11,r9,r10 | ||
994 | lwz r11, VCPU_XIVE_CAM_WORD(r4) | 994 | lwz r11, VCPU_XIVE_CAM_WORD(r4) |
995 | li r9, TM_QW1_OS + TM_WORD2 | 995 | li r9, TM_QW1_OS + TM_WORD2 |
996 | stwcix r11,r9,r10 | 996 | stwcix r11,r9,r10 |
997 | li r9, 1 | 997 | li r9, 1 |
998 | stw r9, VCPU_XIVE_PUSHED(r4) | 998 | stw r9, VCPU_XIVE_PUSHED(r4) |
999 | eieio | ||
999 | no_xive: | 1000 | no_xive: |
1000 | #endif /* CONFIG_KVM_XICS */ | 1001 | #endif /* CONFIG_KVM_XICS */ |
1001 | 1002 | ||
@@ -1310,6 +1311,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) | |||
1310 | bne 3f | 1311 | bne 3f |
1311 | BEGIN_FTR_SECTION | 1312 | BEGIN_FTR_SECTION |
1312 | PPC_MSGSYNC | 1313 | PPC_MSGSYNC |
1314 | lwsync | ||
1313 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) | 1315 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) |
1314 | lbz r0, HSTATE_HOST_IPI(r13) | 1316 | lbz r0, HSTATE_HOST_IPI(r13) |
1315 | cmpwi r0, 0 | 1317 | cmpwi r0, 0 |
@@ -1400,8 +1402,8 @@ guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */ | |||
1400 | cmpldi cr0, r10, 0 | 1402 | cmpldi cr0, r10, 0 |
1401 | beq 1f | 1403 | beq 1f |
1402 | /* First load to pull the context, we ignore the value */ | 1404 | /* First load to pull the context, we ignore the value */ |
1403 | lwzx r11, r7, r10 | ||
1404 | eieio | 1405 | eieio |
1406 | lwzx r11, r7, r10 | ||
1405 | /* Second load to recover the context state (Words 0 and 1) */ | 1407 | /* Second load to recover the context state (Words 0 and 1) */ |
1406 | ldx r11, r6, r10 | 1408 | ldx r11, r6, r10 |
1407 | b 3f | 1409 | b 3f |
@@ -1409,8 +1411,8 @@ guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */ | |||
1409 | cmpldi cr0, r10, 0 | 1411 | cmpldi cr0, r10, 0 |
1410 | beq 1f | 1412 | beq 1f |
1411 | /* First load to pull the context, we ignore the value */ | 1413 | /* First load to pull the context, we ignore the value */ |
1412 | lwzcix r11, r7, r10 | ||
1413 | eieio | 1414 | eieio |
1415 | lwzcix r11, r7, r10 | ||
1414 | /* Second load to recover the context state (Words 0 and 1) */ | 1416 | /* Second load to recover the context state (Words 0 and 1) */ |
1415 | ldcix r11, r6, r10 | 1417 | ldcix r11, r6, r10 |
1416 | 3: std r11, VCPU_XIVE_SAVED_STATE(r9) | 1418 | 3: std r11, VCPU_XIVE_SAVED_STATE(r9) |
@@ -1420,6 +1422,7 @@ guest_exit_cont: /* r9 = vcpu, r12 = trap, r13 = paca */ | |||
1420 | stw r10, VCPU_XIVE_PUSHED(r9) | 1422 | stw r10, VCPU_XIVE_PUSHED(r9) |
1421 | stb r10, (VCPU_XIVE_SAVED_STATE+3)(r9) | 1423 | stb r10, (VCPU_XIVE_SAVED_STATE+3)(r9) |
1422 | stb r0, (VCPU_XIVE_SAVED_STATE+4)(r9) | 1424 | stb r0, (VCPU_XIVE_SAVED_STATE+4)(r9) |
1425 | eieio | ||
1423 | 1: | 1426 | 1: |
1424 | #endif /* CONFIG_KVM_XICS */ | 1427 | #endif /* CONFIG_KVM_XICS */ |
1425 | /* Save more register state */ | 1428 | /* Save more register state */ |
@@ -2788,6 +2791,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | |||
2788 | PPC_MSGCLR(6) | 2791 | PPC_MSGCLR(6) |
2789 | /* see if it's a host IPI */ | 2792 | /* see if it's a host IPI */ |
2790 | li r3, 1 | 2793 | li r3, 1 |
2794 | BEGIN_FTR_SECTION | ||
2795 | PPC_MSGSYNC | ||
2796 | lwsync | ||
2797 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) | ||
2791 | lbz r0, HSTATE_HOST_IPI(r13) | 2798 | lbz r0, HSTATE_HOST_IPI(r13) |
2792 | cmpwi r0, 0 | 2799 | cmpwi r0, 0 |
2793 | bnelr | 2800 | bnelr |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 3480faaf1ef8..ee279c7f4802 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -644,8 +644,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) | |||
644 | break; | 644 | break; |
645 | #endif | 645 | #endif |
646 | case KVM_CAP_PPC_HTM: | 646 | case KVM_CAP_PPC_HTM: |
647 | r = cpu_has_feature(CPU_FTR_TM_COMP) && | 647 | r = cpu_has_feature(CPU_FTR_TM_COMP) && hv_enabled; |
648 | is_kvmppc_hv_enabled(kvm); | ||
649 | break; | 648 | break; |
650 | default: | 649 | default: |
651 | r = 0; | 650 | r = 0; |
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 21900e1cee9c..d185aa3965bf 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -521,12 +521,15 @@ ENTRY(pgm_check_handler) | |||
521 | tmhh %r8,0x0001 # test problem state bit | 521 | tmhh %r8,0x0001 # test problem state bit |
522 | jnz 2f # -> fault in user space | 522 | jnz 2f # -> fault in user space |
523 | #if IS_ENABLED(CONFIG_KVM) | 523 | #if IS_ENABLED(CONFIG_KVM) |
524 | # cleanup critical section for sie64a | 524 | # cleanup critical section for program checks in sie64a |
525 | lgr %r14,%r9 | 525 | lgr %r14,%r9 |
526 | slg %r14,BASED(.Lsie_critical_start) | 526 | slg %r14,BASED(.Lsie_critical_start) |
527 | clg %r14,BASED(.Lsie_critical_length) | 527 | clg %r14,BASED(.Lsie_critical_length) |
528 | jhe 0f | 528 | jhe 0f |
529 | brasl %r14,.Lcleanup_sie | 529 | lg %r14,__SF_EMPTY(%r15) # get control block pointer |
530 | ni __SIE_PROG0C+3(%r14),0xfe # no longer in SIE | ||
531 | lctlg %c1,%c1,__LC_USER_ASCE # load primary asce | ||
532 | larl %r9,sie_exit # skip forward to sie_exit | ||
530 | #endif | 533 | #endif |
531 | 0: tmhh %r8,0x4000 # PER bit set in old PSW ? | 534 | 0: tmhh %r8,0x4000 # PER bit set in old PSW ? |
532 | jnz 1f # -> enabled, can't be a double fault | 535 | jnz 1f # -> enabled, can't be a double fault |
diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 49167258d587..f6cdb7a1455e 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S | |||
@@ -808,7 +808,7 @@ apicinterrupt IRQ_WORK_VECTOR irq_work_interrupt smp_irq_work_interrupt | |||
808 | 808 | ||
809 | .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 | 809 | .macro idtentry sym do_sym has_error_code:req paranoid=0 shift_ist=-1 |
810 | ENTRY(\sym) | 810 | ENTRY(\sym) |
811 | UNWIND_HINT_IRET_REGS offset=8 | 811 | UNWIND_HINT_IRET_REGS offset=\has_error_code*8 |
812 | 812 | ||
813 | /* Sanity check */ | 813 | /* Sanity check */ |
814 | .if \shift_ist != -1 && \paranoid == 0 | 814 | .if \shift_ist != -1 && \paranoid == 0 |
diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 16076eb34699..141e07b06216 100644 --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c | |||
@@ -546,9 +546,6 @@ static int bts_event_init(struct perf_event *event) | |||
546 | if (event->attr.type != bts_pmu.type) | 546 | if (event->attr.type != bts_pmu.type) |
547 | return -ENOENT; | 547 | return -ENOENT; |
548 | 548 | ||
549 | if (x86_add_exclusive(x86_lbr_exclusive_bts)) | ||
550 | return -EBUSY; | ||
551 | |||
552 | /* | 549 | /* |
553 | * BTS leaks kernel addresses even when CPL0 tracing is | 550 | * BTS leaks kernel addresses even when CPL0 tracing is |
554 | * disabled, so disallow intel_bts driver for unprivileged | 551 | * disabled, so disallow intel_bts driver for unprivileged |
@@ -562,6 +559,9 @@ static int bts_event_init(struct perf_event *event) | |||
562 | !capable(CAP_SYS_ADMIN)) | 559 | !capable(CAP_SYS_ADMIN)) |
563 | return -EACCES; | 560 | return -EACCES; |
564 | 561 | ||
562 | if (x86_add_exclusive(x86_lbr_exclusive_bts)) | ||
563 | return -EBUSY; | ||
564 | |||
565 | ret = x86_reserve_hardware(); | 565 | ret = x86_reserve_hardware(); |
566 | if (ret) { | 566 | if (ret) { |
567 | x86_del_exclusive(x86_lbr_exclusive_bts); | 567 | x86_del_exclusive(x86_lbr_exclusive_bts); |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index d362161d3291..c4aed0de565e 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -82,12 +82,21 @@ static inline u64 inc_mm_tlb_gen(struct mm_struct *mm) | |||
82 | #define __flush_tlb_single(addr) __native_flush_tlb_single(addr) | 82 | #define __flush_tlb_single(addr) __native_flush_tlb_single(addr) |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | /* | 85 | static inline bool tlb_defer_switch_to_init_mm(void) |
86 | * If tlb_use_lazy_mode is true, then we try to avoid switching CR3 to point | 86 | { |
87 | * to init_mm when we switch to a kernel thread (e.g. the idle thread). If | 87 | /* |
88 | * it's false, then we immediately switch CR3 when entering a kernel thread. | 88 | * If we have PCID, then switching to init_mm is reasonably |
89 | */ | 89 | * fast. If we don't have PCID, then switching to init_mm is |
90 | DECLARE_STATIC_KEY_TRUE(tlb_use_lazy_mode); | 90 | * quite slow, so we try to defer it in the hopes that we can |
91 | * avoid it entirely. The latter approach runs the risk of | ||
92 | * receiving otherwise unnecessary IPIs. | ||
93 | * | ||
94 | * This choice is just a heuristic. The tlb code can handle this | ||
95 | * function returning true or false regardless of whether we have | ||
96 | * PCID. | ||
97 | */ | ||
98 | return !static_cpu_has(X86_FEATURE_PCID); | ||
99 | } | ||
91 | 100 | ||
92 | /* | 101 | /* |
93 | * 6 because 6 should be plenty and struct tlb_state will fit in | 102 | * 6 because 6 should be plenty and struct tlb_state will fit in |
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 458da8509b75..6db28f17ff28 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -27,6 +27,8 @@ static const struct pci_device_id amd_root_ids[] = { | |||
27 | {} | 27 | {} |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #define PCI_DEVICE_ID_AMD_CNB17H_F4 0x1704 | ||
31 | |||
30 | const struct pci_device_id amd_nb_misc_ids[] = { | 32 | const struct pci_device_id amd_nb_misc_ids[] = { |
31 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, | 33 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) }, |
32 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, | 34 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, |
@@ -37,6 +39,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { | |||
37 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, | 39 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, |
38 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | 40 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, |
39 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, | 41 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F3) }, |
42 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, | ||
40 | {} | 43 | {} |
41 | }; | 44 | }; |
42 | EXPORT_SYMBOL_GPL(amd_nb_misc_ids); | 45 | EXPORT_SYMBOL_GPL(amd_nb_misc_ids); |
@@ -48,6 +51,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { | |||
48 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, | 51 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, |
49 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, | 52 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, |
50 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) }, | 53 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_17H_DF_F4) }, |
54 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, | ||
51 | {} | 55 | {} |
52 | }; | 56 | }; |
53 | 57 | ||
@@ -402,11 +406,48 @@ void amd_flush_garts(void) | |||
402 | } | 406 | } |
403 | EXPORT_SYMBOL_GPL(amd_flush_garts); | 407 | EXPORT_SYMBOL_GPL(amd_flush_garts); |
404 | 408 | ||
409 | static void __fix_erratum_688(void *info) | ||
410 | { | ||
411 | #define MSR_AMD64_IC_CFG 0xC0011021 | ||
412 | |||
413 | msr_set_bit(MSR_AMD64_IC_CFG, 3); | ||
414 | msr_set_bit(MSR_AMD64_IC_CFG, 14); | ||
415 | } | ||
416 | |||
417 | /* Apply erratum 688 fix so machines without a BIOS fix work. */ | ||
418 | static __init void fix_erratum_688(void) | ||
419 | { | ||
420 | struct pci_dev *F4; | ||
421 | u32 val; | ||
422 | |||
423 | if (boot_cpu_data.x86 != 0x14) | ||
424 | return; | ||
425 | |||
426 | if (!amd_northbridges.num) | ||
427 | return; | ||
428 | |||
429 | F4 = node_to_amd_nb(0)->link; | ||
430 | if (!F4) | ||
431 | return; | ||
432 | |||
433 | if (pci_read_config_dword(F4, 0x164, &val)) | ||
434 | return; | ||
435 | |||
436 | if (val & BIT(2)) | ||
437 | return; | ||
438 | |||
439 | on_each_cpu(__fix_erratum_688, NULL, 0); | ||
440 | |||
441 | pr_info("x86/cpu/AMD: CPU erratum 688 worked around\n"); | ||
442 | } | ||
443 | |||
405 | static __init int init_amd_nbs(void) | 444 | static __init int init_amd_nbs(void) |
406 | { | 445 | { |
407 | amd_cache_northbridges(); | 446 | amd_cache_northbridges(); |
408 | amd_cache_gart(); | 447 | amd_cache_gart(); |
409 | 448 | ||
449 | fix_erratum_688(); | ||
450 | |||
410 | return 0; | 451 | return 0; |
411 | } | 452 | } |
412 | 453 | ||
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index 24f749324c0f..9990a71e311f 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -831,7 +831,6 @@ static int __cache_amd_cpumap_setup(unsigned int cpu, int index, | |||
831 | } else if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { | 831 | } else if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { |
832 | unsigned int apicid, nshared, first, last; | 832 | unsigned int apicid, nshared, first, last; |
833 | 833 | ||
834 | this_leaf = this_cpu_ci->info_list + index; | ||
835 | nshared = base->eax.split.num_threads_sharing + 1; | 834 | nshared = base->eax.split.num_threads_sharing + 1; |
836 | apicid = cpu_data(cpu).apicid; | 835 | apicid = cpu_data(cpu).apicid; |
837 | first = apicid - (apicid % nshared); | 836 | first = apicid - (apicid % nshared); |
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 8f7a9bbad514..7dbcb7adf797 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
35 | 35 | ||
36 | #include <asm/microcode_intel.h> | 36 | #include <asm/microcode_intel.h> |
37 | #include <asm/intel-family.h> | ||
37 | #include <asm/processor.h> | 38 | #include <asm/processor.h> |
38 | #include <asm/tlbflush.h> | 39 | #include <asm/tlbflush.h> |
39 | #include <asm/setup.h> | 40 | #include <asm/setup.h> |
@@ -918,6 +919,18 @@ static int get_ucode_fw(void *to, const void *from, size_t n) | |||
918 | return 0; | 919 | return 0; |
919 | } | 920 | } |
920 | 921 | ||
922 | static bool is_blacklisted(unsigned int cpu) | ||
923 | { | ||
924 | struct cpuinfo_x86 *c = &cpu_data(cpu); | ||
925 | |||
926 | if (c->x86 == 6 && c->x86_model == INTEL_FAM6_BROADWELL_X) { | ||
927 | pr_err_once("late loading on model 79 is disabled.\n"); | ||
928 | return true; | ||
929 | } | ||
930 | |||
931 | return false; | ||
932 | } | ||
933 | |||
921 | static enum ucode_state request_microcode_fw(int cpu, struct device *device, | 934 | static enum ucode_state request_microcode_fw(int cpu, struct device *device, |
922 | bool refresh_fw) | 935 | bool refresh_fw) |
923 | { | 936 | { |
@@ -926,6 +939,9 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device, | |||
926 | const struct firmware *firmware; | 939 | const struct firmware *firmware; |
927 | enum ucode_state ret; | 940 | enum ucode_state ret; |
928 | 941 | ||
942 | if (is_blacklisted(cpu)) | ||
943 | return UCODE_NFOUND; | ||
944 | |||
929 | sprintf(name, "intel-ucode/%02x-%02x-%02x", | 945 | sprintf(name, "intel-ucode/%02x-%02x-%02x", |
930 | c->x86, c->x86_model, c->x86_mask); | 946 | c->x86, c->x86_model, c->x86_mask); |
931 | 947 | ||
@@ -950,6 +966,9 @@ static int get_ucode_user(void *to, const void *from, size_t n) | |||
950 | static enum ucode_state | 966 | static enum ucode_state |
951 | request_microcode_user(int cpu, const void __user *buf, size_t size) | 967 | request_microcode_user(int cpu, const void __user *buf, size_t size) |
952 | { | 968 | { |
969 | if (is_blacklisted(cpu)) | ||
970 | return UCODE_NFOUND; | ||
971 | |||
953 | return generic_load_microcode(cpu, (void *)buf, size, &get_ucode_user); | 972 | return generic_load_microcode(cpu, (void *)buf, size, &get_ucode_user); |
954 | } | 973 | } |
955 | 974 | ||
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c index cf2ce063f65a..2902ca4d5993 100644 --- a/arch/x86/kernel/head32.c +++ b/arch/x86/kernel/head32.c | |||
@@ -30,10 +30,11 @@ static void __init i386_default_early_setup(void) | |||
30 | 30 | ||
31 | asmlinkage __visible void __init i386_start_kernel(void) | 31 | asmlinkage __visible void __init i386_start_kernel(void) |
32 | { | 32 | { |
33 | cr4_init_shadow(); | 33 | /* Make sure IDT is set up before any exception happens */ |
34 | |||
35 | idt_setup_early_handler(); | 34 | idt_setup_early_handler(); |
36 | 35 | ||
36 | cr4_init_shadow(); | ||
37 | |||
37 | sanitize_boot_params(&boot_params); | 38 | sanitize_boot_params(&boot_params); |
38 | 39 | ||
39 | x86_early_init_platform_quirks(); | 40 | x86_early_init_platform_quirks(); |
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c index 570b70d3f604..b95007e7c1b3 100644 --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c | |||
@@ -86,8 +86,8 @@ static struct orc_entry *orc_find(unsigned long ip) | |||
86 | idx = (ip - LOOKUP_START_IP) / LOOKUP_BLOCK_SIZE; | 86 | idx = (ip - LOOKUP_START_IP) / LOOKUP_BLOCK_SIZE; |
87 | 87 | ||
88 | if (unlikely((idx >= lookup_num_blocks-1))) { | 88 | if (unlikely((idx >= lookup_num_blocks-1))) { |
89 | orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%lx\n", | 89 | orc_warn("WARNING: bad lookup idx: idx=%u num=%u ip=%pB\n", |
90 | idx, lookup_num_blocks, ip); | 90 | idx, lookup_num_blocks, (void *)ip); |
91 | return NULL; | 91 | return NULL; |
92 | } | 92 | } |
93 | 93 | ||
@@ -96,8 +96,8 @@ static struct orc_entry *orc_find(unsigned long ip) | |||
96 | 96 | ||
97 | if (unlikely((__start_orc_unwind + start >= __stop_orc_unwind) || | 97 | if (unlikely((__start_orc_unwind + start >= __stop_orc_unwind) || |
98 | (__start_orc_unwind + stop > __stop_orc_unwind))) { | 98 | (__start_orc_unwind + stop > __stop_orc_unwind))) { |
99 | orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%lx\n", | 99 | orc_warn("WARNING: bad lookup value: idx=%u num=%u start=%u stop=%u ip=%pB\n", |
100 | idx, lookup_num_blocks, start, stop, ip); | 100 | idx, lookup_num_blocks, start, stop, (void *)ip); |
101 | return NULL; | 101 | return NULL; |
102 | } | 102 | } |
103 | 103 | ||
@@ -373,7 +373,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
373 | 373 | ||
374 | case ORC_REG_R10: | 374 | case ORC_REG_R10: |
375 | if (!state->regs || !state->full_regs) { | 375 | if (!state->regs || !state->full_regs) { |
376 | orc_warn("missing regs for base reg R10 at ip %p\n", | 376 | orc_warn("missing regs for base reg R10 at ip %pB\n", |
377 | (void *)state->ip); | 377 | (void *)state->ip); |
378 | goto done; | 378 | goto done; |
379 | } | 379 | } |
@@ -382,7 +382,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
382 | 382 | ||
383 | case ORC_REG_R13: | 383 | case ORC_REG_R13: |
384 | if (!state->regs || !state->full_regs) { | 384 | if (!state->regs || !state->full_regs) { |
385 | orc_warn("missing regs for base reg R13 at ip %p\n", | 385 | orc_warn("missing regs for base reg R13 at ip %pB\n", |
386 | (void *)state->ip); | 386 | (void *)state->ip); |
387 | goto done; | 387 | goto done; |
388 | } | 388 | } |
@@ -391,7 +391,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
391 | 391 | ||
392 | case ORC_REG_DI: | 392 | case ORC_REG_DI: |
393 | if (!state->regs || !state->full_regs) { | 393 | if (!state->regs || !state->full_regs) { |
394 | orc_warn("missing regs for base reg DI at ip %p\n", | 394 | orc_warn("missing regs for base reg DI at ip %pB\n", |
395 | (void *)state->ip); | 395 | (void *)state->ip); |
396 | goto done; | 396 | goto done; |
397 | } | 397 | } |
@@ -400,7 +400,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
400 | 400 | ||
401 | case ORC_REG_DX: | 401 | case ORC_REG_DX: |
402 | if (!state->regs || !state->full_regs) { | 402 | if (!state->regs || !state->full_regs) { |
403 | orc_warn("missing regs for base reg DX at ip %p\n", | 403 | orc_warn("missing regs for base reg DX at ip %pB\n", |
404 | (void *)state->ip); | 404 | (void *)state->ip); |
405 | goto done; | 405 | goto done; |
406 | } | 406 | } |
@@ -408,7 +408,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
408 | break; | 408 | break; |
409 | 409 | ||
410 | default: | 410 | default: |
411 | orc_warn("unknown SP base reg %d for ip %p\n", | 411 | orc_warn("unknown SP base reg %d for ip %pB\n", |
412 | orc->sp_reg, (void *)state->ip); | 412 | orc->sp_reg, (void *)state->ip); |
413 | goto done; | 413 | goto done; |
414 | } | 414 | } |
@@ -436,7 +436,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
436 | 436 | ||
437 | case ORC_TYPE_REGS: | 437 | case ORC_TYPE_REGS: |
438 | if (!deref_stack_regs(state, sp, &state->ip, &state->sp, true)) { | 438 | if (!deref_stack_regs(state, sp, &state->ip, &state->sp, true)) { |
439 | orc_warn("can't dereference registers at %p for ip %p\n", | 439 | orc_warn("can't dereference registers at %p for ip %pB\n", |
440 | (void *)sp, (void *)orig_ip); | 440 | (void *)sp, (void *)orig_ip); |
441 | goto done; | 441 | goto done; |
442 | } | 442 | } |
@@ -448,7 +448,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
448 | 448 | ||
449 | case ORC_TYPE_REGS_IRET: | 449 | case ORC_TYPE_REGS_IRET: |
450 | if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) { | 450 | if (!deref_stack_regs(state, sp, &state->ip, &state->sp, false)) { |
451 | orc_warn("can't dereference iret registers at %p for ip %p\n", | 451 | orc_warn("can't dereference iret registers at %p for ip %pB\n", |
452 | (void *)sp, (void *)orig_ip); | 452 | (void *)sp, (void *)orig_ip); |
453 | goto done; | 453 | goto done; |
454 | } | 454 | } |
@@ -465,7 +465,8 @@ bool unwind_next_frame(struct unwind_state *state) | |||
465 | break; | 465 | break; |
466 | 466 | ||
467 | default: | 467 | default: |
468 | orc_warn("unknown .orc_unwind entry type %d\n", orc->type); | 468 | orc_warn("unknown .orc_unwind entry type %d for ip %pB\n", |
469 | orc->type, (void *)orig_ip); | ||
469 | break; | 470 | break; |
470 | } | 471 | } |
471 | 472 | ||
@@ -487,7 +488,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
487 | break; | 488 | break; |
488 | 489 | ||
489 | default: | 490 | default: |
490 | orc_warn("unknown BP base reg %d for ip %p\n", | 491 | orc_warn("unknown BP base reg %d for ip %pB\n", |
491 | orc->bp_reg, (void *)orig_ip); | 492 | orc->bp_reg, (void *)orig_ip); |
492 | goto done; | 493 | goto done; |
493 | } | 494 | } |
@@ -496,7 +497,7 @@ bool unwind_next_frame(struct unwind_state *state) | |||
496 | if (state->stack_info.type == prev_type && | 497 | if (state->stack_info.type == prev_type && |
497 | on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) && | 498 | on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) && |
498 | state->sp <= prev_sp) { | 499 | state->sp <= prev_sp) { |
499 | orc_warn("stack going in the wrong direction? ip=%p\n", | 500 | orc_warn("stack going in the wrong direction? ip=%pB\n", |
500 | (void *)orig_ip); | 501 | (void *)orig_ip); |
501 | goto done; | 502 | goto done; |
502 | } | 503 | } |
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 658bf0090565..0f3d0cea4d00 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -30,7 +30,6 @@ | |||
30 | 30 | ||
31 | atomic64_t last_mm_ctx_id = ATOMIC64_INIT(1); | 31 | atomic64_t last_mm_ctx_id = ATOMIC64_INIT(1); |
32 | 32 | ||
33 | DEFINE_STATIC_KEY_TRUE(tlb_use_lazy_mode); | ||
34 | 33 | ||
35 | static void choose_new_asid(struct mm_struct *next, u64 next_tlb_gen, | 34 | static void choose_new_asid(struct mm_struct *next, u64 next_tlb_gen, |
36 | u16 *new_asid, bool *need_flush) | 35 | u16 *new_asid, bool *need_flush) |
@@ -147,8 +146,8 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, | |||
147 | this_cpu_write(cpu_tlbstate.is_lazy, false); | 146 | this_cpu_write(cpu_tlbstate.is_lazy, false); |
148 | 147 | ||
149 | if (real_prev == next) { | 148 | if (real_prev == next) { |
150 | VM_BUG_ON(this_cpu_read(cpu_tlbstate.ctxs[prev_asid].ctx_id) != | 149 | VM_WARN_ON(this_cpu_read(cpu_tlbstate.ctxs[prev_asid].ctx_id) != |
151 | next->context.ctx_id); | 150 | next->context.ctx_id); |
152 | 151 | ||
153 | /* | 152 | /* |
154 | * We don't currently support having a real mm loaded without | 153 | * We don't currently support having a real mm loaded without |
@@ -213,6 +212,9 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, | |||
213 | } | 212 | } |
214 | 213 | ||
215 | /* | 214 | /* |
215 | * Please ignore the name of this function. It should be called | ||
216 | * switch_to_kernel_thread(). | ||
217 | * | ||
216 | * enter_lazy_tlb() is a hint from the scheduler that we are entering a | 218 | * enter_lazy_tlb() is a hint from the scheduler that we are entering a |
217 | * kernel thread or other context without an mm. Acceptable implementations | 219 | * kernel thread or other context without an mm. Acceptable implementations |
218 | * include doing nothing whatsoever, switching to init_mm, or various clever | 220 | * include doing nothing whatsoever, switching to init_mm, or various clever |
@@ -227,7 +229,7 @@ void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | |||
227 | if (this_cpu_read(cpu_tlbstate.loaded_mm) == &init_mm) | 229 | if (this_cpu_read(cpu_tlbstate.loaded_mm) == &init_mm) |
228 | return; | 230 | return; |
229 | 231 | ||
230 | if (static_branch_unlikely(&tlb_use_lazy_mode)) { | 232 | if (tlb_defer_switch_to_init_mm()) { |
231 | /* | 233 | /* |
232 | * There's a significant optimization that may be possible | 234 | * There's a significant optimization that may be possible |
233 | * here. We have accurate enough TLB flush tracking that we | 235 | * here. We have accurate enough TLB flush tracking that we |
@@ -626,57 +628,3 @@ static int __init create_tlb_single_page_flush_ceiling(void) | |||
626 | return 0; | 628 | return 0; |
627 | } | 629 | } |
628 | late_initcall(create_tlb_single_page_flush_ceiling); | 630 | late_initcall(create_tlb_single_page_flush_ceiling); |
629 | |||
630 | static ssize_t tlblazy_read_file(struct file *file, char __user *user_buf, | ||
631 | size_t count, loff_t *ppos) | ||
632 | { | ||
633 | char buf[2]; | ||
634 | |||
635 | buf[0] = static_branch_likely(&tlb_use_lazy_mode) ? '1' : '0'; | ||
636 | buf[1] = '\n'; | ||
637 | |||
638 | return simple_read_from_buffer(user_buf, count, ppos, buf, 2); | ||
639 | } | ||
640 | |||
641 | static ssize_t tlblazy_write_file(struct file *file, | ||
642 | const char __user *user_buf, size_t count, loff_t *ppos) | ||
643 | { | ||
644 | bool val; | ||
645 | |||
646 | if (kstrtobool_from_user(user_buf, count, &val)) | ||
647 | return -EINVAL; | ||
648 | |||
649 | if (val) | ||
650 | static_branch_enable(&tlb_use_lazy_mode); | ||
651 | else | ||
652 | static_branch_disable(&tlb_use_lazy_mode); | ||
653 | |||
654 | return count; | ||
655 | } | ||
656 | |||
657 | static const struct file_operations fops_tlblazy = { | ||
658 | .read = tlblazy_read_file, | ||
659 | .write = tlblazy_write_file, | ||
660 | .llseek = default_llseek, | ||
661 | }; | ||
662 | |||
663 | static int __init init_tlb_use_lazy_mode(void) | ||
664 | { | ||
665 | if (boot_cpu_has(X86_FEATURE_PCID)) { | ||
666 | /* | ||
667 | * Heuristic: with PCID on, switching to and from | ||
668 | * init_mm is reasonably fast, but remote flush IPIs | ||
669 | * as expensive as ever, so turn off lazy TLB mode. | ||
670 | * | ||
671 | * We can't do this in setup_pcid() because static keys | ||
672 | * haven't been initialized yet, and it would blow up | ||
673 | * badly. | ||
674 | */ | ||
675 | static_branch_disable(&tlb_use_lazy_mode); | ||
676 | } | ||
677 | |||
678 | debugfs_create_file("tlb_use_lazy_mode", S_IRUSR | S_IWUSR, | ||
679 | arch_debugfs_dir, NULL, &fops_tlblazy); | ||
680 | return 0; | ||
681 | } | ||
682 | late_initcall(init_tlb_use_lazy_mode); | ||
diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 0621a95b8597..fddf76ef5bd6 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c | |||
@@ -3662,12 +3662,6 @@ static void binder_stat_br(struct binder_proc *proc, | |||
3662 | } | 3662 | } |
3663 | } | 3663 | } |
3664 | 3664 | ||
3665 | static int binder_has_thread_work(struct binder_thread *thread) | ||
3666 | { | ||
3667 | return !binder_worklist_empty(thread->proc, &thread->todo) || | ||
3668 | thread->looper_need_return; | ||
3669 | } | ||
3670 | |||
3671 | static int binder_put_node_cmd(struct binder_proc *proc, | 3665 | static int binder_put_node_cmd(struct binder_proc *proc, |
3672 | struct binder_thread *thread, | 3666 | struct binder_thread *thread, |
3673 | void __user **ptrp, | 3667 | void __user **ptrp, |
@@ -4297,12 +4291,9 @@ static unsigned int binder_poll(struct file *filp, | |||
4297 | 4291 | ||
4298 | binder_inner_proc_unlock(thread->proc); | 4292 | binder_inner_proc_unlock(thread->proc); |
4299 | 4293 | ||
4300 | if (binder_has_work(thread, wait_for_proc_work)) | ||
4301 | return POLLIN; | ||
4302 | |||
4303 | poll_wait(filp, &thread->wait, wait); | 4294 | poll_wait(filp, &thread->wait, wait); |
4304 | 4295 | ||
4305 | if (binder_has_thread_work(thread)) | 4296 | if (binder_has_work(thread, wait_for_proc_work)) |
4306 | return POLLIN; | 4297 | return POLLIN; |
4307 | 4298 | ||
4308 | return 0; | 4299 | return 0; |
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 064f5e31ec55..c2819a3d58a6 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c | |||
@@ -215,17 +215,12 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate, | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | if (!vma && need_mm) | 218 | if (!vma && need_mm && mmget_not_zero(alloc->vma_vm_mm)) |
219 | mm = get_task_mm(alloc->tsk); | 219 | mm = alloc->vma_vm_mm; |
220 | 220 | ||
221 | if (mm) { | 221 | if (mm) { |
222 | down_write(&mm->mmap_sem); | 222 | down_write(&mm->mmap_sem); |
223 | vma = alloc->vma; | 223 | vma = alloc->vma; |
224 | if (vma && mm != alloc->vma_vm_mm) { | ||
225 | pr_err("%d: vma mm and task mm mismatch\n", | ||
226 | alloc->pid); | ||
227 | vma = NULL; | ||
228 | } | ||
229 | } | 224 | } |
230 | 225 | ||
231 | if (!vma && need_mm) { | 226 | if (!vma && need_mm) { |
@@ -565,7 +560,7 @@ static void binder_delete_free_buffer(struct binder_alloc *alloc, | |||
565 | binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, | 560 | binder_alloc_debug(BINDER_DEBUG_BUFFER_ALLOC, |
566 | "%d: merge free, buffer %pK do not share page with %pK or %pK\n", | 561 | "%d: merge free, buffer %pK do not share page with %pK or %pK\n", |
567 | alloc->pid, buffer->data, | 562 | alloc->pid, buffer->data, |
568 | prev->data, next->data); | 563 | prev->data, next ? next->data : NULL); |
569 | binder_update_page_range(alloc, 0, buffer_start_page(buffer), | 564 | binder_update_page_range(alloc, 0, buffer_start_page(buffer), |
570 | buffer_start_page(buffer) + PAGE_SIZE, | 565 | buffer_start_page(buffer) + PAGE_SIZE, |
571 | NULL); | 566 | NULL); |
@@ -720,6 +715,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, | |||
720 | barrier(); | 715 | barrier(); |
721 | alloc->vma = vma; | 716 | alloc->vma = vma; |
722 | alloc->vma_vm_mm = vma->vm_mm; | 717 | alloc->vma_vm_mm = vma->vm_mm; |
718 | mmgrab(alloc->vma_vm_mm); | ||
723 | 719 | ||
724 | return 0; | 720 | return 0; |
725 | 721 | ||
@@ -795,6 +791,8 @@ void binder_alloc_deferred_release(struct binder_alloc *alloc) | |||
795 | vfree(alloc->buffer); | 791 | vfree(alloc->buffer); |
796 | } | 792 | } |
797 | mutex_unlock(&alloc->mutex); | 793 | mutex_unlock(&alloc->mutex); |
794 | if (alloc->vma_vm_mm) | ||
795 | mmdrop(alloc->vma_vm_mm); | ||
798 | 796 | ||
799 | binder_alloc_debug(BINDER_DEBUG_OPEN_CLOSE, | 797 | binder_alloc_debug(BINDER_DEBUG_OPEN_CLOSE, |
800 | "%s: %d buffers %d, pages %d\n", | 798 | "%s: %d buffers %d, pages %d\n", |
@@ -889,7 +887,6 @@ int binder_alloc_get_allocated_count(struct binder_alloc *alloc) | |||
889 | void binder_alloc_vma_close(struct binder_alloc *alloc) | 887 | void binder_alloc_vma_close(struct binder_alloc *alloc) |
890 | { | 888 | { |
891 | WRITE_ONCE(alloc->vma, NULL); | 889 | WRITE_ONCE(alloc->vma, NULL); |
892 | WRITE_ONCE(alloc->vma_vm_mm, NULL); | ||
893 | } | 890 | } |
894 | 891 | ||
895 | /** | 892 | /** |
@@ -926,9 +923,9 @@ enum lru_status binder_alloc_free_page(struct list_head *item, | |||
926 | page_addr = (uintptr_t)alloc->buffer + index * PAGE_SIZE; | 923 | page_addr = (uintptr_t)alloc->buffer + index * PAGE_SIZE; |
927 | vma = alloc->vma; | 924 | vma = alloc->vma; |
928 | if (vma) { | 925 | if (vma) { |
929 | mm = get_task_mm(alloc->tsk); | 926 | if (!mmget_not_zero(alloc->vma_vm_mm)) |
930 | if (!mm) | 927 | goto err_mmget; |
931 | goto err_get_task_mm_failed; | 928 | mm = alloc->vma_vm_mm; |
932 | if (!down_write_trylock(&mm->mmap_sem)) | 929 | if (!down_write_trylock(&mm->mmap_sem)) |
933 | goto err_down_write_mmap_sem_failed; | 930 | goto err_down_write_mmap_sem_failed; |
934 | } | 931 | } |
@@ -963,7 +960,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item, | |||
963 | 960 | ||
964 | err_down_write_mmap_sem_failed: | 961 | err_down_write_mmap_sem_failed: |
965 | mmput_async(mm); | 962 | mmput_async(mm); |
966 | err_get_task_mm_failed: | 963 | err_mmget: |
967 | err_page_already_freed: | 964 | err_page_already_freed: |
968 | mutex_unlock(&alloc->mutex); | 965 | mutex_unlock(&alloc->mutex); |
969 | err_get_alloc_mutex_failed: | 966 | err_get_alloc_mutex_failed: |
@@ -1002,7 +999,6 @@ struct shrinker binder_shrinker = { | |||
1002 | */ | 999 | */ |
1003 | void binder_alloc_init(struct binder_alloc *alloc) | 1000 | void binder_alloc_init(struct binder_alloc *alloc) |
1004 | { | 1001 | { |
1005 | alloc->tsk = current->group_leader; | ||
1006 | alloc->pid = current->group_leader->pid; | 1002 | alloc->pid = current->group_leader->pid; |
1007 | mutex_init(&alloc->mutex); | 1003 | mutex_init(&alloc->mutex); |
1008 | INIT_LIST_HEAD(&alloc->buffers); | 1004 | INIT_LIST_HEAD(&alloc->buffers); |
diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h index a3a3602c689c..2dd33b6df104 100644 --- a/drivers/android/binder_alloc.h +++ b/drivers/android/binder_alloc.h | |||
@@ -100,7 +100,6 @@ struct binder_lru_page { | |||
100 | */ | 100 | */ |
101 | struct binder_alloc { | 101 | struct binder_alloc { |
102 | struct mutex mutex; | 102 | struct mutex mutex; |
103 | struct task_struct *tsk; | ||
104 | struct vm_area_struct *vma; | 103 | struct vm_area_struct *vma; |
105 | struct mm_struct *vma_vm_mm; | 104 | struct mm_struct *vma_vm_mm; |
106 | void *buffer; | 105 | void *buffer; |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 321cd7b4d817..227bac5f1191 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -377,7 +377,8 @@ int register_cpu(struct cpu *cpu, int num) | |||
377 | 377 | ||
378 | per_cpu(cpu_sys_devices, num) = &cpu->dev; | 378 | per_cpu(cpu_sys_devices, num) = &cpu->dev; |
379 | register_cpu_under_node(num, cpu_to_node(num)); | 379 | register_cpu_under_node(num, cpu_to_node(num)); |
380 | dev_pm_qos_expose_latency_limit(&cpu->dev, 0); | 380 | dev_pm_qos_expose_latency_limit(&cpu->dev, |
381 | PM_QOS_RESUME_LATENCY_NO_CONSTRAINT); | ||
381 | 382 | ||
382 | return 0; | 383 | return 0; |
383 | } | 384 | } |
diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c index 281f949c5ffe..51751cc8c9e6 100644 --- a/drivers/base/power/domain_governor.c +++ b/drivers/base/power/domain_governor.c | |||
@@ -14,23 +14,20 @@ | |||
14 | static int dev_update_qos_constraint(struct device *dev, void *data) | 14 | static int dev_update_qos_constraint(struct device *dev, void *data) |
15 | { | 15 | { |
16 | s64 *constraint_ns_p = data; | 16 | s64 *constraint_ns_p = data; |
17 | s32 constraint_ns = -1; | 17 | s64 constraint_ns = -1; |
18 | 18 | ||
19 | if (dev->power.subsys_data && dev->power.subsys_data->domain_data) | 19 | if (dev->power.subsys_data && dev->power.subsys_data->domain_data) |
20 | constraint_ns = dev_gpd_data(dev)->td.effective_constraint_ns; | 20 | constraint_ns = dev_gpd_data(dev)->td.effective_constraint_ns; |
21 | 21 | ||
22 | if (constraint_ns < 0) { | 22 | if (constraint_ns < 0) |
23 | constraint_ns = dev_pm_qos_read_value(dev); | 23 | constraint_ns = dev_pm_qos_read_value(dev); |
24 | constraint_ns *= NSEC_PER_USEC; | 24 | |
25 | } | 25 | if (constraint_ns == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) |
26 | if (constraint_ns == 0) | ||
27 | return 0; | 26 | return 0; |
28 | 27 | ||
29 | /* | 28 | constraint_ns *= NSEC_PER_USEC; |
30 | * constraint_ns cannot be negative here, because the device has been | 29 | |
31 | * suspended. | 30 | if (constraint_ns < *constraint_ns_p || *constraint_ns_p < 0) |
32 | */ | ||
33 | if (constraint_ns < *constraint_ns_p || *constraint_ns_p == 0) | ||
34 | *constraint_ns_p = constraint_ns; | 31 | *constraint_ns_p = constraint_ns; |
35 | 32 | ||
36 | return 0; | 33 | return 0; |
@@ -63,10 +60,14 @@ static bool default_suspend_ok(struct device *dev) | |||
63 | 60 | ||
64 | spin_unlock_irqrestore(&dev->power.lock, flags); | 61 | spin_unlock_irqrestore(&dev->power.lock, flags); |
65 | 62 | ||
66 | if (constraint_ns < 0) | 63 | if (constraint_ns == 0) |
67 | return false; | 64 | return false; |
68 | 65 | ||
69 | constraint_ns *= NSEC_PER_USEC; | 66 | if (constraint_ns == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) |
67 | constraint_ns = -1; | ||
68 | else | ||
69 | constraint_ns *= NSEC_PER_USEC; | ||
70 | |||
70 | /* | 71 | /* |
71 | * We can walk the children without any additional locking, because | 72 | * We can walk the children without any additional locking, because |
72 | * they all have been suspended at this point and their | 73 | * they all have been suspended at this point and their |
@@ -76,14 +77,19 @@ static bool default_suspend_ok(struct device *dev) | |||
76 | device_for_each_child(dev, &constraint_ns, | 77 | device_for_each_child(dev, &constraint_ns, |
77 | dev_update_qos_constraint); | 78 | dev_update_qos_constraint); |
78 | 79 | ||
79 | if (constraint_ns > 0) { | 80 | if (constraint_ns < 0) { |
80 | constraint_ns -= td->suspend_latency_ns + | 81 | /* The children have no constraints. */ |
81 | td->resume_latency_ns; | 82 | td->effective_constraint_ns = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; |
82 | if (constraint_ns == 0) | 83 | td->cached_suspend_ok = true; |
83 | return false; | 84 | } else { |
85 | constraint_ns -= td->suspend_latency_ns + td->resume_latency_ns; | ||
86 | if (constraint_ns > 0) { | ||
87 | td->effective_constraint_ns = constraint_ns; | ||
88 | td->cached_suspend_ok = true; | ||
89 | } else { | ||
90 | td->effective_constraint_ns = 0; | ||
91 | } | ||
84 | } | 92 | } |
85 | td->effective_constraint_ns = constraint_ns; | ||
86 | td->cached_suspend_ok = constraint_ns >= 0; | ||
87 | 93 | ||
88 | /* | 94 | /* |
89 | * The children have been suspended already, so we don't need to take | 95 | * The children have been suspended already, so we don't need to take |
@@ -145,13 +151,14 @@ static bool __default_power_down_ok(struct dev_pm_domain *pd, | |||
145 | td = &to_gpd_data(pdd)->td; | 151 | td = &to_gpd_data(pdd)->td; |
146 | constraint_ns = td->effective_constraint_ns; | 152 | constraint_ns = td->effective_constraint_ns; |
147 | /* default_suspend_ok() need not be called before us. */ | 153 | /* default_suspend_ok() need not be called before us. */ |
148 | if (constraint_ns < 0) { | 154 | if (constraint_ns < 0) |
149 | constraint_ns = dev_pm_qos_read_value(pdd->dev); | 155 | constraint_ns = dev_pm_qos_read_value(pdd->dev); |
150 | constraint_ns *= NSEC_PER_USEC; | 156 | |
151 | } | 157 | if (constraint_ns == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) |
152 | if (constraint_ns == 0) | ||
153 | continue; | 158 | continue; |
154 | 159 | ||
160 | constraint_ns *= NSEC_PER_USEC; | ||
161 | |||
155 | /* | 162 | /* |
156 | * constraint_ns cannot be negative here, because the device has | 163 | * constraint_ns cannot be negative here, because the device has |
157 | * been suspended. | 164 | * been suspended. |
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 277d43a83f53..7d29286d9313 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c | |||
@@ -189,7 +189,7 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) | |||
189 | plist_head_init(&c->list); | 189 | plist_head_init(&c->list); |
190 | c->target_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | 190 | c->target_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; |
191 | c->default_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | 191 | c->default_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; |
192 | c->no_constraint_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE; | 192 | c->no_constraint_value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; |
193 | c->type = PM_QOS_MIN; | 193 | c->type = PM_QOS_MIN; |
194 | c->notifiers = n; | 194 | c->notifiers = n; |
195 | 195 | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 7bcf80fa9ada..13e015905543 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -253,7 +253,7 @@ static int rpm_check_suspend_allowed(struct device *dev) | |||
253 | || (dev->power.request_pending | 253 | || (dev->power.request_pending |
254 | && dev->power.request == RPM_REQ_RESUME)) | 254 | && dev->power.request == RPM_REQ_RESUME)) |
255 | retval = -EAGAIN; | 255 | retval = -EAGAIN; |
256 | else if (__dev_pm_qos_read_value(dev) < 0) | 256 | else if (__dev_pm_qos_read_value(dev) == 0) |
257 | retval = -EPERM; | 257 | retval = -EPERM; |
258 | else if (dev->power.runtime_status == RPM_SUSPENDED) | 258 | else if (dev->power.runtime_status == RPM_SUSPENDED) |
259 | retval = 1; | 259 | retval = 1; |
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c index 156ab57bca77..632077f05c57 100644 --- a/drivers/base/power/sysfs.c +++ b/drivers/base/power/sysfs.c | |||
@@ -218,7 +218,14 @@ static ssize_t pm_qos_resume_latency_show(struct device *dev, | |||
218 | struct device_attribute *attr, | 218 | struct device_attribute *attr, |
219 | char *buf) | 219 | char *buf) |
220 | { | 220 | { |
221 | return sprintf(buf, "%d\n", dev_pm_qos_requested_resume_latency(dev)); | 221 | s32 value = dev_pm_qos_requested_resume_latency(dev); |
222 | |||
223 | if (value == 0) | ||
224 | return sprintf(buf, "n/a\n"); | ||
225 | else if (value == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) | ||
226 | value = 0; | ||
227 | |||
228 | return sprintf(buf, "%d\n", value); | ||
222 | } | 229 | } |
223 | 230 | ||
224 | static ssize_t pm_qos_resume_latency_store(struct device *dev, | 231 | static ssize_t pm_qos_resume_latency_store(struct device *dev, |
@@ -228,11 +235,21 @@ static ssize_t pm_qos_resume_latency_store(struct device *dev, | |||
228 | s32 value; | 235 | s32 value; |
229 | int ret; | 236 | int ret; |
230 | 237 | ||
231 | if (kstrtos32(buf, 0, &value)) | 238 | if (!kstrtos32(buf, 0, &value)) { |
232 | return -EINVAL; | 239 | /* |
240 | * Prevent users from writing negative or "no constraint" values | ||
241 | * directly. | ||
242 | */ | ||
243 | if (value < 0 || value == PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) | ||
244 | return -EINVAL; | ||
233 | 245 | ||
234 | if (value < 0) | 246 | if (value == 0) |
247 | value = PM_QOS_RESUME_LATENCY_NO_CONSTRAINT; | ||
248 | } else if (!strcmp(buf, "n/a") || !strcmp(buf, "n/a\n")) { | ||
249 | value = 0; | ||
250 | } else { | ||
235 | return -EINVAL; | 251 | return -EINVAL; |
252 | } | ||
236 | 253 | ||
237 | ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req, | 254 | ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req, |
238 | value); | 255 | value); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index baebbdfd74d5..9adfb5445f8d 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -386,6 +386,15 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send, | |||
386 | return result; | 386 | return result; |
387 | } | 387 | } |
388 | 388 | ||
389 | /* | ||
390 | * Different settings for sk->sk_sndtimeo can result in different return values | ||
391 | * if there is a signal pending when we enter sendmsg, because reasons? | ||
392 | */ | ||
393 | static inline int was_interrupted(int result) | ||
394 | { | ||
395 | return result == -ERESTARTSYS || result == -EINTR; | ||
396 | } | ||
397 | |||
389 | /* always call with the tx_lock held */ | 398 | /* always call with the tx_lock held */ |
390 | static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) | 399 | static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) |
391 | { | 400 | { |
@@ -458,7 +467,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index) | |||
458 | result = sock_xmit(nbd, index, 1, &from, | 467 | result = sock_xmit(nbd, index, 1, &from, |
459 | (type == NBD_CMD_WRITE) ? MSG_MORE : 0, &sent); | 468 | (type == NBD_CMD_WRITE) ? MSG_MORE : 0, &sent); |
460 | if (result <= 0) { | 469 | if (result <= 0) { |
461 | if (result == -ERESTARTSYS) { | 470 | if (was_interrupted(result)) { |
462 | /* If we havne't sent anything we can just return BUSY, | 471 | /* If we havne't sent anything we can just return BUSY, |
463 | * however if we have sent something we need to make | 472 | * however if we have sent something we need to make |
464 | * sure we only allow this req to be sent until we are | 473 | * sure we only allow this req to be sent until we are |
@@ -502,7 +511,7 @@ send_pages: | |||
502 | } | 511 | } |
503 | result = sock_xmit(nbd, index, 1, &from, flags, &sent); | 512 | result = sock_xmit(nbd, index, 1, &from, flags, &sent); |
504 | if (result <= 0) { | 513 | if (result <= 0) { |
505 | if (result == -ERESTARTSYS) { | 514 | if (was_interrupted(result)) { |
506 | /* We've already sent the header, we | 515 | /* We've already sent the header, we |
507 | * have no choice but to set pending and | 516 | * have no choice but to set pending and |
508 | * return BUSY. | 517 | * return BUSY. |
diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c index a1df588343f2..1de8cac99a0e 100644 --- a/drivers/clocksource/cs5535-clockevt.c +++ b/drivers/clocksource/cs5535-clockevt.c | |||
@@ -117,7 +117,8 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id) | |||
117 | /* Turn off the clock (and clear the event) */ | 117 | /* Turn off the clock (and clear the event) */ |
118 | disable_timer(cs5535_event_clock); | 118 | disable_timer(cs5535_event_clock); |
119 | 119 | ||
120 | if (clockevent_state_shutdown(&cs5535_clockevent)) | 120 | if (clockevent_state_detached(&cs5535_clockevent) || |
121 | clockevent_state_shutdown(&cs5535_clockevent)) | ||
121 | return IRQ_HANDLED; | 122 | return IRQ_HANDLED; |
122 | 123 | ||
123 | /* Clear the counter */ | 124 | /* Clear the counter */ |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 48eaf2879228..aa390404e85f 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -298,8 +298,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
298 | data->needs_update = 0; | 298 | data->needs_update = 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | /* resume_latency is 0 means no restriction */ | 301 | if (resume_latency < latency_req && |
302 | if (resume_latency && resume_latency < latency_req) | 302 | resume_latency != PM_QOS_RESUME_LATENCY_NO_CONSTRAINT) |
303 | latency_req = resume_latency; | 303 | latency_req = resume_latency; |
304 | 304 | ||
305 | /* Special case when user has set very strict latency requirement */ | 305 | /* Special case when user has set very strict latency requirement */ |
diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 1cb2d1c070c3..a94601d5939e 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c | |||
@@ -238,7 +238,8 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table, | |||
238 | 238 | ||
239 | efi_random_get_seed(sys_table); | 239 | efi_random_get_seed(sys_table); |
240 | 240 | ||
241 | if (!nokaslr()) { | 241 | /* hibernation expects the runtime regions to stay in the same place */ |
242 | if (!IS_ENABLED(CONFIG_HIBERNATION) && !nokaslr()) { | ||
242 | /* | 243 | /* |
243 | * Randomize the base of the UEFI runtime services region. | 244 | * Randomize the base of the UEFI runtime services region. |
244 | * Preserve the 2 MB alignment of the region by taking a | 245 | * Preserve the 2 MB alignment of the region by taking a |
diff --git a/drivers/firmware/efi/test/efi_test.c b/drivers/firmware/efi/test/efi_test.c index 08129b7b80ab..41c48a1e8baa 100644 --- a/drivers/firmware/efi/test/efi_test.c +++ b/drivers/firmware/efi/test/efi_test.c | |||
@@ -593,6 +593,9 @@ static long efi_runtime_query_capsulecaps(unsigned long arg) | |||
593 | if (copy_from_user(&qcaps, qcaps_user, sizeof(qcaps))) | 593 | if (copy_from_user(&qcaps, qcaps_user, sizeof(qcaps))) |
594 | return -EFAULT; | 594 | return -EFAULT; |
595 | 595 | ||
596 | if (qcaps.capsule_count == ULONG_MAX) | ||
597 | return -EINVAL; | ||
598 | |||
596 | capsules = kcalloc(qcaps.capsule_count + 1, | 599 | capsules = kcalloc(qcaps.capsule_count + 1, |
597 | sizeof(efi_capsule_header_t), GFP_KERNEL); | 600 | sizeof(efi_capsule_header_t), GFP_KERNEL); |
598 | if (!capsules) | 601 | if (!capsules) |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index 31db356476f8..430a6b4dfac9 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | |||
@@ -225,11 +225,7 @@ static int uvd_v6_0_suspend(void *handle) | |||
225 | if (r) | 225 | if (r) |
226 | return r; | 226 | return r; |
227 | 227 | ||
228 | /* Skip this for APU for now */ | 228 | return amdgpu_uvd_suspend(adev); |
229 | if (!(adev->flags & AMD_IS_APU)) | ||
230 | r = amdgpu_uvd_suspend(adev); | ||
231 | |||
232 | return r; | ||
233 | } | 229 | } |
234 | 230 | ||
235 | static int uvd_v6_0_resume(void *handle) | 231 | static int uvd_v6_0_resume(void *handle) |
@@ -237,12 +233,10 @@ static int uvd_v6_0_resume(void *handle) | |||
237 | int r; | 233 | int r; |
238 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 234 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
239 | 235 | ||
240 | /* Skip this for APU for now */ | 236 | r = amdgpu_uvd_resume(adev); |
241 | if (!(adev->flags & AMD_IS_APU)) { | 237 | if (r) |
242 | r = amdgpu_uvd_resume(adev); | 238 | return r; |
243 | if (r) | 239 | |
244 | return r; | ||
245 | } | ||
246 | return uvd_v6_0_hw_init(adev); | 240 | return uvd_v6_0_hw_init(adev); |
247 | } | 241 | } |
248 | 242 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index c2743233ba10..b526f49be65d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | |||
@@ -830,7 +830,7 @@ uint32_t smu7_get_xclk(struct pp_hwmgr *hwmgr) | |||
830 | { | 830 | { |
831 | uint32_t reference_clock, tmp; | 831 | uint32_t reference_clock, tmp; |
832 | struct cgs_display_info info = {0}; | 832 | struct cgs_display_info info = {0}; |
833 | struct cgs_mode_info mode_info; | 833 | struct cgs_mode_info mode_info = {0}; |
834 | 834 | ||
835 | info.mode_info = &mode_info; | 835 | info.mode_info = &mode_info; |
836 | 836 | ||
@@ -3948,10 +3948,9 @@ static int smu7_program_display_gap(struct pp_hwmgr *hwmgr) | |||
3948 | uint32_t ref_clock; | 3948 | uint32_t ref_clock; |
3949 | uint32_t refresh_rate = 0; | 3949 | uint32_t refresh_rate = 0; |
3950 | struct cgs_display_info info = {0}; | 3950 | struct cgs_display_info info = {0}; |
3951 | struct cgs_mode_info mode_info; | 3951 | struct cgs_mode_info mode_info = {0}; |
3952 | 3952 | ||
3953 | info.mode_info = &mode_info; | 3953 | info.mode_info = &mode_info; |
3954 | |||
3955 | cgs_get_active_displays_info(hwmgr->device, &info); | 3954 | cgs_get_active_displays_info(hwmgr->device, &info); |
3956 | num_active_displays = info.display_count; | 3955 | num_active_displays = info.display_count; |
3957 | 3956 | ||
@@ -3967,6 +3966,7 @@ static int smu7_program_display_gap(struct pp_hwmgr *hwmgr) | |||
3967 | frame_time_in_us = 1000000 / refresh_rate; | 3966 | frame_time_in_us = 1000000 / refresh_rate; |
3968 | 3967 | ||
3969 | pre_vbi_time_in_us = frame_time_in_us - 200 - mode_info.vblank_time_us; | 3968 | pre_vbi_time_in_us = frame_time_in_us - 200 - mode_info.vblank_time_us; |
3969 | |||
3970 | data->frame_time_x2 = frame_time_in_us * 2 / 100; | 3970 | data->frame_time_x2 = frame_time_in_us * 2 / 100; |
3971 | 3971 | ||
3972 | display_gap2 = pre_vbi_time_in_us * (ref_clock / 100); | 3972 | display_gap2 = pre_vbi_time_in_us * (ref_clock / 100); |
diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c index 21c36e256884..d4726a3358a4 100644 --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c | |||
@@ -2723,6 +2723,9 @@ static int combine_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) | |||
2723 | uint32_t per_ctx_start[CACHELINE_DWORDS] = {0}; | 2723 | uint32_t per_ctx_start[CACHELINE_DWORDS] = {0}; |
2724 | unsigned char *bb_start_sva; | 2724 | unsigned char *bb_start_sva; |
2725 | 2725 | ||
2726 | if (!wa_ctx->per_ctx.valid) | ||
2727 | return 0; | ||
2728 | |||
2726 | per_ctx_start[0] = 0x18800001; | 2729 | per_ctx_start[0] = 0x18800001; |
2727 | per_ctx_start[1] = wa_ctx->per_ctx.guest_gma; | 2730 | per_ctx_start[1] = wa_ctx->per_ctx.guest_gma; |
2728 | 2731 | ||
diff --git a/drivers/gpu/drm/i915/gvt/execlist.c b/drivers/gpu/drm/i915/gvt/execlist.c index 91b4300f3b39..e5320b4eb698 100644 --- a/drivers/gpu/drm/i915/gvt/execlist.c +++ b/drivers/gpu/drm/i915/gvt/execlist.c | |||
@@ -701,8 +701,7 @@ static int submit_context(struct intel_vgpu *vgpu, int ring_id, | |||
701 | CACHELINE_BYTES; | 701 | CACHELINE_BYTES; |
702 | workload->wa_ctx.per_ctx.guest_gma = | 702 | workload->wa_ctx.per_ctx.guest_gma = |
703 | per_ctx & PER_CTX_ADDR_MASK; | 703 | per_ctx & PER_CTX_ADDR_MASK; |
704 | 704 | workload->wa_ctx.per_ctx.valid = per_ctx & 1; | |
705 | WARN_ON(workload->wa_ctx.indirect_ctx.size && !(per_ctx & 0x1)); | ||
706 | } | 705 | } |
707 | 706 | ||
708 | if (emulate_schedule_in) | 707 | if (emulate_schedule_in) |
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c index 2294466dd415..a5bed2e71b92 100644 --- a/drivers/gpu/drm/i915/gvt/handlers.c +++ b/drivers/gpu/drm/i915/gvt/handlers.c | |||
@@ -1429,18 +1429,7 @@ static int skl_lcpll_write(struct intel_vgpu *vgpu, unsigned int offset, | |||
1429 | return 0; | 1429 | return 0; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | static int ring_timestamp_mmio_read(struct intel_vgpu *vgpu, | 1432 | static int mmio_read_from_hw(struct intel_vgpu *vgpu, |
1433 | unsigned int offset, void *p_data, unsigned int bytes) | ||
1434 | { | ||
1435 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; | ||
1436 | |||
1437 | mmio_hw_access_pre(dev_priv); | ||
1438 | vgpu_vreg(vgpu, offset) = I915_READ(_MMIO(offset)); | ||
1439 | mmio_hw_access_post(dev_priv); | ||
1440 | return intel_vgpu_default_mmio_read(vgpu, offset, p_data, bytes); | ||
1441 | } | ||
1442 | |||
1443 | static int instdone_mmio_read(struct intel_vgpu *vgpu, | ||
1444 | unsigned int offset, void *p_data, unsigned int bytes) | 1433 | unsigned int offset, void *p_data, unsigned int bytes) |
1445 | { | 1434 | { |
1446 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; | 1435 | struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; |
@@ -1589,6 +1578,8 @@ static int ring_reset_ctl_write(struct intel_vgpu *vgpu, | |||
1589 | MMIO_F(prefix(BLT_RING_BASE), s, f, am, rm, d, r, w); \ | 1578 | MMIO_F(prefix(BLT_RING_BASE), s, f, am, rm, d, r, w); \ |
1590 | MMIO_F(prefix(GEN6_BSD_RING_BASE), s, f, am, rm, d, r, w); \ | 1579 | MMIO_F(prefix(GEN6_BSD_RING_BASE), s, f, am, rm, d, r, w); \ |
1591 | MMIO_F(prefix(VEBOX_RING_BASE), s, f, am, rm, d, r, w); \ | 1580 | MMIO_F(prefix(VEBOX_RING_BASE), s, f, am, rm, d, r, w); \ |
1581 | if (HAS_BSD2(dev_priv)) \ | ||
1582 | MMIO_F(prefix(GEN8_BSD2_RING_BASE), s, f, am, rm, d, r, w); \ | ||
1592 | } while (0) | 1583 | } while (0) |
1593 | 1584 | ||
1594 | #define MMIO_RING_D(prefix, d) \ | 1585 | #define MMIO_RING_D(prefix, d) \ |
@@ -1635,10 +1626,9 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) | |||
1635 | #undef RING_REG | 1626 | #undef RING_REG |
1636 | 1627 | ||
1637 | #define RING_REG(base) (base + 0x6c) | 1628 | #define RING_REG(base) (base + 0x6c) |
1638 | MMIO_RING_DFH(RING_REG, D_ALL, 0, instdone_mmio_read, NULL); | 1629 | MMIO_RING_DFH(RING_REG, D_ALL, 0, mmio_read_from_hw, NULL); |
1639 | MMIO_DH(RING_REG(GEN8_BSD2_RING_BASE), D_ALL, instdone_mmio_read, NULL); | ||
1640 | #undef RING_REG | 1630 | #undef RING_REG |
1641 | MMIO_DH(GEN7_SC_INSTDONE, D_BDW_PLUS, instdone_mmio_read, NULL); | 1631 | MMIO_DH(GEN7_SC_INSTDONE, D_BDW_PLUS, mmio_read_from_hw, NULL); |
1642 | 1632 | ||
1643 | MMIO_GM_RDR(0x2148, D_ALL, NULL, NULL); | 1633 | MMIO_GM_RDR(0x2148, D_ALL, NULL, NULL); |
1644 | MMIO_GM_RDR(CCID, D_ALL, NULL, NULL); | 1634 | MMIO_GM_RDR(CCID, D_ALL, NULL, NULL); |
@@ -1648,7 +1638,7 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) | |||
1648 | MMIO_RING_DFH(RING_TAIL, D_ALL, F_CMD_ACCESS, NULL, NULL); | 1638 | MMIO_RING_DFH(RING_TAIL, D_ALL, F_CMD_ACCESS, NULL, NULL); |
1649 | MMIO_RING_DFH(RING_HEAD, D_ALL, F_CMD_ACCESS, NULL, NULL); | 1639 | MMIO_RING_DFH(RING_HEAD, D_ALL, F_CMD_ACCESS, NULL, NULL); |
1650 | MMIO_RING_DFH(RING_CTL, D_ALL, F_CMD_ACCESS, NULL, NULL); | 1640 | MMIO_RING_DFH(RING_CTL, D_ALL, F_CMD_ACCESS, NULL, NULL); |
1651 | MMIO_RING_DFH(RING_ACTHD, D_ALL, F_CMD_ACCESS, NULL, NULL); | 1641 | MMIO_RING_DFH(RING_ACTHD, D_ALL, F_CMD_ACCESS, mmio_read_from_hw, NULL); |
1652 | MMIO_RING_GM_RDR(RING_START, D_ALL, NULL, NULL); | 1642 | MMIO_RING_GM_RDR(RING_START, D_ALL, NULL, NULL); |
1653 | 1643 | ||
1654 | /* RING MODE */ | 1644 | /* RING MODE */ |
@@ -1662,9 +1652,9 @@ static int init_generic_mmio_info(struct intel_gvt *gvt) | |||
1662 | MMIO_RING_DFH(RING_INSTPM, D_ALL, F_MODE_MASK | F_CMD_ACCESS, | 1652 | MMIO_RING_DFH(RING_INSTPM, D_ALL, F_MODE_MASK | F_CMD_ACCESS, |
1663 | NULL, NULL); | 1653 | NULL, NULL); |
1664 | MMIO_RING_DFH(RING_TIMESTAMP, D_ALL, F_CMD_ACCESS, | 1654 | MMIO_RING_DFH(RING_TIMESTAMP, D_ALL, F_CMD_ACCESS, |
1665 | ring_timestamp_mmio_read, NULL); | 1655 | mmio_read_from_hw, NULL); |
1666 | MMIO_RING_DFH(RING_TIMESTAMP_UDW, D_ALL, F_CMD_ACCESS, | 1656 | MMIO_RING_DFH(RING_TIMESTAMP_UDW, D_ALL, F_CMD_ACCESS, |
1667 | ring_timestamp_mmio_read, NULL); | 1657 | mmio_read_from_hw, NULL); |
1668 | 1658 | ||
1669 | MMIO_DFH(GEN7_GT_MODE, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL); | 1659 | MMIO_DFH(GEN7_GT_MODE, D_ALL, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL); |
1670 | MMIO_DFH(CACHE_MODE_0_GEN7, D_ALL, F_MODE_MASK | F_CMD_ACCESS, | 1660 | MMIO_DFH(CACHE_MODE_0_GEN7, D_ALL, F_MODE_MASK | F_CMD_ACCESS, |
@@ -2411,9 +2401,6 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) | |||
2411 | struct drm_i915_private *dev_priv = gvt->dev_priv; | 2401 | struct drm_i915_private *dev_priv = gvt->dev_priv; |
2412 | int ret; | 2402 | int ret; |
2413 | 2403 | ||
2414 | MMIO_DFH(RING_IMR(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS, NULL, | ||
2415 | intel_vgpu_reg_imr_handler); | ||
2416 | |||
2417 | MMIO_DH(GEN8_GT_IMR(0), D_BDW_PLUS, NULL, intel_vgpu_reg_imr_handler); | 2404 | MMIO_DH(GEN8_GT_IMR(0), D_BDW_PLUS, NULL, intel_vgpu_reg_imr_handler); |
2418 | MMIO_DH(GEN8_GT_IER(0), D_BDW_PLUS, NULL, intel_vgpu_reg_ier_handler); | 2405 | MMIO_DH(GEN8_GT_IER(0), D_BDW_PLUS, NULL, intel_vgpu_reg_ier_handler); |
2419 | MMIO_DH(GEN8_GT_IIR(0), D_BDW_PLUS, NULL, intel_vgpu_reg_iir_handler); | 2406 | MMIO_DH(GEN8_GT_IIR(0), D_BDW_PLUS, NULL, intel_vgpu_reg_iir_handler); |
@@ -2476,68 +2463,34 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) | |||
2476 | MMIO_DH(GEN8_MASTER_IRQ, D_BDW_PLUS, NULL, | 2463 | MMIO_DH(GEN8_MASTER_IRQ, D_BDW_PLUS, NULL, |
2477 | intel_vgpu_reg_master_irq_handler); | 2464 | intel_vgpu_reg_master_irq_handler); |
2478 | 2465 | ||
2479 | MMIO_DFH(RING_HWSTAM(GEN8_BSD2_RING_BASE), D_BDW_PLUS, | 2466 | MMIO_RING_DFH(RING_ACTHD_UDW, D_BDW_PLUS, F_CMD_ACCESS, |
2480 | F_CMD_ACCESS, NULL, NULL); | 2467 | mmio_read_from_hw, NULL); |
2481 | MMIO_DFH(0x1c134, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | ||
2482 | |||
2483 | MMIO_DFH(RING_TAIL(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS, | ||
2484 | NULL, NULL); | ||
2485 | MMIO_DFH(RING_HEAD(GEN8_BSD2_RING_BASE), D_BDW_PLUS, | ||
2486 | F_CMD_ACCESS, NULL, NULL); | ||
2487 | MMIO_GM_RDR(RING_START(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL, NULL); | ||
2488 | MMIO_DFH(RING_CTL(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS, | ||
2489 | NULL, NULL); | ||
2490 | MMIO_DFH(RING_ACTHD(GEN8_BSD2_RING_BASE), D_BDW_PLUS, | ||
2491 | F_CMD_ACCESS, NULL, NULL); | ||
2492 | MMIO_DFH(RING_ACTHD_UDW(GEN8_BSD2_RING_BASE), D_BDW_PLUS, | ||
2493 | F_CMD_ACCESS, NULL, NULL); | ||
2494 | MMIO_DFH(0x1c29c, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, | ||
2495 | ring_mode_mmio_write); | ||
2496 | MMIO_DFH(RING_MI_MODE(GEN8_BSD2_RING_BASE), D_BDW_PLUS, | ||
2497 | F_MODE_MASK | F_CMD_ACCESS, NULL, NULL); | ||
2498 | MMIO_DFH(RING_INSTPM(GEN8_BSD2_RING_BASE), D_BDW_PLUS, | ||
2499 | F_MODE_MASK | F_CMD_ACCESS, NULL, NULL); | ||
2500 | MMIO_DFH(RING_TIMESTAMP(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS, | ||
2501 | ring_timestamp_mmio_read, NULL); | ||
2502 | |||
2503 | MMIO_RING_DFH(RING_ACTHD_UDW, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | ||
2504 | 2468 | ||
2505 | #define RING_REG(base) (base + 0xd0) | 2469 | #define RING_REG(base) (base + 0xd0) |
2506 | MMIO_RING_F(RING_REG, 4, F_RO, 0, | 2470 | MMIO_RING_F(RING_REG, 4, F_RO, 0, |
2507 | ~_MASKED_BIT_ENABLE(RESET_CTL_REQUEST_RESET), D_BDW_PLUS, NULL, | 2471 | ~_MASKED_BIT_ENABLE(RESET_CTL_REQUEST_RESET), D_BDW_PLUS, NULL, |
2508 | ring_reset_ctl_write); | 2472 | ring_reset_ctl_write); |
2509 | MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 4, F_RO, 0, | ||
2510 | ~_MASKED_BIT_ENABLE(RESET_CTL_REQUEST_RESET), D_BDW_PLUS, NULL, | ||
2511 | ring_reset_ctl_write); | ||
2512 | #undef RING_REG | 2473 | #undef RING_REG |
2513 | 2474 | ||
2514 | #define RING_REG(base) (base + 0x230) | 2475 | #define RING_REG(base) (base + 0x230) |
2515 | MMIO_RING_DFH(RING_REG, D_BDW_PLUS, 0, NULL, elsp_mmio_write); | 2476 | MMIO_RING_DFH(RING_REG, D_BDW_PLUS, 0, NULL, elsp_mmio_write); |
2516 | MMIO_DH(RING_REG(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL, elsp_mmio_write); | ||
2517 | #undef RING_REG | 2477 | #undef RING_REG |
2518 | 2478 | ||
2519 | #define RING_REG(base) (base + 0x234) | 2479 | #define RING_REG(base) (base + 0x234) |
2520 | MMIO_RING_F(RING_REG, 8, F_RO | F_CMD_ACCESS, 0, ~0, D_BDW_PLUS, | 2480 | MMIO_RING_F(RING_REG, 8, F_RO | F_CMD_ACCESS, 0, ~0, D_BDW_PLUS, |
2521 | NULL, NULL); | 2481 | NULL, NULL); |
2522 | MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 4, F_RO | F_CMD_ACCESS, 0, | ||
2523 | ~0LL, D_BDW_PLUS, NULL, NULL); | ||
2524 | #undef RING_REG | 2482 | #undef RING_REG |
2525 | 2483 | ||
2526 | #define RING_REG(base) (base + 0x244) | 2484 | #define RING_REG(base) (base + 0x244) |
2527 | MMIO_RING_DFH(RING_REG, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); | 2485 | MMIO_RING_DFH(RING_REG, D_BDW_PLUS, F_CMD_ACCESS, NULL, NULL); |
2528 | MMIO_DFH(RING_REG(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_CMD_ACCESS, | ||
2529 | NULL, NULL); | ||
2530 | #undef RING_REG | 2486 | #undef RING_REG |
2531 | 2487 | ||
2532 | #define RING_REG(base) (base + 0x370) | 2488 | #define RING_REG(base) (base + 0x370) |
2533 | MMIO_RING_F(RING_REG, 48, F_RO, 0, ~0, D_BDW_PLUS, NULL, NULL); | 2489 | MMIO_RING_F(RING_REG, 48, F_RO, 0, ~0, D_BDW_PLUS, NULL, NULL); |
2534 | MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 48, F_RO, 0, ~0, D_BDW_PLUS, | ||
2535 | NULL, NULL); | ||
2536 | #undef RING_REG | 2490 | #undef RING_REG |
2537 | 2491 | ||
2538 | #define RING_REG(base) (base + 0x3a0) | 2492 | #define RING_REG(base) (base + 0x3a0) |
2539 | MMIO_RING_DFH(RING_REG, D_BDW_PLUS, F_MODE_MASK, NULL, NULL); | 2493 | MMIO_RING_DFH(RING_REG, D_BDW_PLUS, F_MODE_MASK, NULL, NULL); |
2540 | MMIO_DFH(RING_REG(GEN8_BSD2_RING_BASE), D_BDW_PLUS, F_MODE_MASK, NULL, NULL); | ||
2541 | #undef RING_REG | 2494 | #undef RING_REG |
2542 | 2495 | ||
2543 | MMIO_D(PIPEMISC(PIPE_A), D_BDW_PLUS); | 2496 | MMIO_D(PIPEMISC(PIPE_A), D_BDW_PLUS); |
@@ -2557,11 +2510,9 @@ static int init_broadwell_mmio_info(struct intel_gvt *gvt) | |||
2557 | 2510 | ||
2558 | #define RING_REG(base) (base + 0x270) | 2511 | #define RING_REG(base) (base + 0x270) |
2559 | MMIO_RING_F(RING_REG, 32, 0, 0, 0, D_BDW_PLUS, NULL, NULL); | 2512 | MMIO_RING_F(RING_REG, 32, 0, 0, 0, D_BDW_PLUS, NULL, NULL); |
2560 | MMIO_F(RING_REG(GEN8_BSD2_RING_BASE), 32, 0, 0, 0, D_BDW_PLUS, NULL, NULL); | ||
2561 | #undef RING_REG | 2513 | #undef RING_REG |
2562 | 2514 | ||
2563 | MMIO_RING_GM_RDR(RING_HWS_PGA, D_BDW_PLUS, NULL, NULL); | 2515 | MMIO_RING_GM_RDR(RING_HWS_PGA, D_BDW_PLUS, NULL, NULL); |
2564 | MMIO_GM_RDR(RING_HWS_PGA(GEN8_BSD2_RING_BASE), D_BDW_PLUS, NULL, NULL); | ||
2565 | 2516 | ||
2566 | MMIO_DFH(HDC_CHICKEN0, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL); | 2517 | MMIO_DFH(HDC_CHICKEN0, D_BDW_PLUS, F_MODE_MASK | F_CMD_ACCESS, NULL, NULL); |
2567 | 2518 | ||
@@ -2849,7 +2800,6 @@ static int init_skl_mmio_info(struct intel_gvt *gvt) | |||
2849 | MMIO_D(0x65f08, D_SKL | D_KBL); | 2800 | MMIO_D(0x65f08, D_SKL | D_KBL); |
2850 | MMIO_D(0x320f0, D_SKL | D_KBL); | 2801 | MMIO_D(0x320f0, D_SKL | D_KBL); |
2851 | 2802 | ||
2852 | MMIO_DFH(_REG_VCS2_EXCC, D_SKL_PLUS, F_CMD_ACCESS, NULL, NULL); | ||
2853 | MMIO_D(0x70034, D_SKL_PLUS); | 2803 | MMIO_D(0x70034, D_SKL_PLUS); |
2854 | MMIO_D(0x71034, D_SKL_PLUS); | 2804 | MMIO_D(0x71034, D_SKL_PLUS); |
2855 | MMIO_D(0x72034, D_SKL_PLUS); | 2805 | MMIO_D(0x72034, D_SKL_PLUS); |
diff --git a/drivers/gpu/drm/i915/gvt/reg.h b/drivers/gpu/drm/i915/gvt/reg.h index fbd023a16f18..7d01c77a0f7a 100644 --- a/drivers/gpu/drm/i915/gvt/reg.h +++ b/drivers/gpu/drm/i915/gvt/reg.h | |||
@@ -54,9 +54,6 @@ | |||
54 | 54 | ||
55 | #define VGT_SPRSTRIDE(pipe) _PIPE(pipe, _SPRA_STRIDE, _PLANE_STRIDE_2_B) | 55 | #define VGT_SPRSTRIDE(pipe) _PIPE(pipe, _SPRA_STRIDE, _PLANE_STRIDE_2_B) |
56 | 56 | ||
57 | #define _REG_VECS_EXCC 0x1A028 | ||
58 | #define _REG_VCS2_EXCC 0x1c028 | ||
59 | |||
60 | #define _REG_701C0(pipe, plane) (0x701c0 + pipe * 0x1000 + (plane - 1) * 0x100) | 57 | #define _REG_701C0(pipe, plane) (0x701c0 + pipe * 0x1000 + (plane - 1) * 0x100) |
61 | #define _REG_701C4(pipe, plane) (0x701c4 + pipe * 0x1000 + (plane - 1) * 0x100) | 58 | #define _REG_701C4(pipe, plane) (0x701c4 + pipe * 0x1000 + (plane - 1) * 0x100) |
62 | 59 | ||
diff --git a/drivers/gpu/drm/i915/gvt/scheduler.h b/drivers/gpu/drm/i915/gvt/scheduler.h index 0d431a968a32..93a49eb0209e 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.h +++ b/drivers/gpu/drm/i915/gvt/scheduler.h | |||
@@ -68,6 +68,7 @@ struct shadow_indirect_ctx { | |||
68 | struct shadow_per_ctx { | 68 | struct shadow_per_ctx { |
69 | unsigned long guest_gma; | 69 | unsigned long guest_gma; |
70 | unsigned long shadow_gma; | 70 | unsigned long shadow_gma; |
71 | unsigned valid; | ||
71 | }; | 72 | }; |
72 | 73 | ||
73 | struct intel_shadow_wa_ctx { | 74 | struct intel_shadow_wa_ctx { |
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 94185d610673..370b9d248fed 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c | |||
@@ -2537,6 +2537,10 @@ static const struct file_operations fops = { | |||
2537 | .poll = i915_perf_poll, | 2537 | .poll = i915_perf_poll, |
2538 | .read = i915_perf_read, | 2538 | .read = i915_perf_read, |
2539 | .unlocked_ioctl = i915_perf_ioctl, | 2539 | .unlocked_ioctl = i915_perf_ioctl, |
2540 | /* Our ioctl have no arguments, so it's safe to use the same function | ||
2541 | * to handle 32bits compatibility. | ||
2542 | */ | ||
2543 | .compat_ioctl = i915_perf_ioctl, | ||
2540 | }; | 2544 | }; |
2541 | 2545 | ||
2542 | 2546 | ||
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 018d2e0f8ec5..379b0df123be 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c | |||
@@ -937,7 +937,10 @@ void vmbus_hvsock_device_unregister(struct vmbus_channel *channel) | |||
937 | { | 937 | { |
938 | BUG_ON(!is_hvsock_channel(channel)); | 938 | BUG_ON(!is_hvsock_channel(channel)); |
939 | 939 | ||
940 | channel->rescind = true; | 940 | /* We always get a rescind msg when a connection is closed. */ |
941 | while (!READ_ONCE(channel->probe_done) || !READ_ONCE(channel->rescind)) | ||
942 | msleep(1); | ||
943 | |||
941 | vmbus_device_unregister(channel->device_obj); | 944 | vmbus_device_unregister(channel->device_obj); |
942 | } | 945 | } |
943 | EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister); | 946 | EXPORT_SYMBOL_GPL(vmbus_hvsock_device_unregister); |
diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c index 97a62f5b9ea4..a973eb6a2890 100644 --- a/drivers/hwmon/da9052-hwmon.c +++ b/drivers/hwmon/da9052-hwmon.c | |||
@@ -477,6 +477,11 @@ static int da9052_hwmon_probe(struct platform_device *pdev) | |||
477 | /* disable touchscreen features */ | 477 | /* disable touchscreen features */ |
478 | da9052_reg_write(hwmon->da9052, DA9052_TSI_CONT_A_REG, 0x00); | 478 | da9052_reg_write(hwmon->da9052, DA9052_TSI_CONT_A_REG, 0x00); |
479 | 479 | ||
480 | /* Sample every 1ms */ | ||
481 | da9052_reg_update(hwmon->da9052, DA9052_ADC_CONT_REG, | ||
482 | DA9052_ADCCONT_ADCMODE, | ||
483 | DA9052_ADCCONT_ADCMODE); | ||
484 | |||
480 | err = da9052_request_irq(hwmon->da9052, DA9052_IRQ_TSIREADY, | 485 | err = da9052_request_irq(hwmon->da9052, DA9052_IRQ_TSIREADY, |
481 | "tsiready-irq", da9052_tsi_datardy_irq, | 486 | "tsiready-irq", da9052_tsi_datardy_irq, |
482 | hwmon); | 487 | hwmon); |
diff --git a/drivers/hwmon/tmp102.c b/drivers/hwmon/tmp102.c index 5eafbaada795..dfc40c740d07 100644 --- a/drivers/hwmon/tmp102.c +++ b/drivers/hwmon/tmp102.c | |||
@@ -268,14 +268,11 @@ static int tmp102_probe(struct i2c_client *client, | |||
268 | return err; | 268 | return err; |
269 | } | 269 | } |
270 | 270 | ||
271 | tmp102->ready_time = jiffies; | 271 | /* |
272 | if (tmp102->config_orig & TMP102_CONF_SD) { | 272 | * Mark that we are not ready with data until the first |
273 | /* | 273 | * conversion is complete |
274 | * Mark that we are not ready with data until the first | 274 | */ |
275 | * conversion is complete | 275 | tmp102->ready_time = jiffies + msecs_to_jiffies(CONVERSION_TIME_MS); |
276 | */ | ||
277 | tmp102->ready_time += msecs_to_jiffies(CONVERSION_TIME_MS); | ||
278 | } | ||
279 | 276 | ||
280 | hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, | 277 | hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, |
281 | tmp102, | 278 | tmp102, |
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 57625653fcb6..1d13bf03c758 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig | |||
@@ -243,6 +243,8 @@ config DA9150_GPADC | |||
243 | config DLN2_ADC | 243 | config DLN2_ADC |
244 | tristate "Diolan DLN-2 ADC driver support" | 244 | tristate "Diolan DLN-2 ADC driver support" |
245 | depends on MFD_DLN2 | 245 | depends on MFD_DLN2 |
246 | select IIO_BUFFER | ||
247 | select IIO_TRIGGERED_BUFFER | ||
246 | help | 248 | help |
247 | Say yes here to build support for Diolan DLN-2 ADC. | 249 | Say yes here to build support for Diolan DLN-2 ADC. |
248 | 250 | ||
diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index bc5b38e3a147..a70ef7fec95f 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c | |||
@@ -225,6 +225,7 @@ struct at91_adc_trigger { | |||
225 | char *name; | 225 | char *name; |
226 | unsigned int trgmod_value; | 226 | unsigned int trgmod_value; |
227 | unsigned int edge_type; | 227 | unsigned int edge_type; |
228 | bool hw_trig; | ||
228 | }; | 229 | }; |
229 | 230 | ||
230 | struct at91_adc_state { | 231 | struct at91_adc_state { |
@@ -254,16 +255,25 @@ static const struct at91_adc_trigger at91_adc_trigger_list[] = { | |||
254 | .name = "external_rising", | 255 | .name = "external_rising", |
255 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_RISE, | 256 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_RISE, |
256 | .edge_type = IRQ_TYPE_EDGE_RISING, | 257 | .edge_type = IRQ_TYPE_EDGE_RISING, |
258 | .hw_trig = true, | ||
257 | }, | 259 | }, |
258 | { | 260 | { |
259 | .name = "external_falling", | 261 | .name = "external_falling", |
260 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_FALL, | 262 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_FALL, |
261 | .edge_type = IRQ_TYPE_EDGE_FALLING, | 263 | .edge_type = IRQ_TYPE_EDGE_FALLING, |
264 | .hw_trig = true, | ||
262 | }, | 265 | }, |
263 | { | 266 | { |
264 | .name = "external_any", | 267 | .name = "external_any", |
265 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_ANY, | 268 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_ANY, |
266 | .edge_type = IRQ_TYPE_EDGE_BOTH, | 269 | .edge_type = IRQ_TYPE_EDGE_BOTH, |
270 | .hw_trig = true, | ||
271 | }, | ||
272 | { | ||
273 | .name = "software", | ||
274 | .trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_NO_TRIGGER, | ||
275 | .edge_type = IRQ_TYPE_NONE, | ||
276 | .hw_trig = false, | ||
267 | }, | 277 | }, |
268 | }; | 278 | }; |
269 | 279 | ||
@@ -597,7 +607,7 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
597 | struct at91_adc_state *st; | 607 | struct at91_adc_state *st; |
598 | struct resource *res; | 608 | struct resource *res; |
599 | int ret, i; | 609 | int ret, i; |
600 | u32 edge_type; | 610 | u32 edge_type = IRQ_TYPE_NONE; |
601 | 611 | ||
602 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); | 612 | indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*st)); |
603 | if (!indio_dev) | 613 | if (!indio_dev) |
@@ -641,14 +651,14 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
641 | ret = of_property_read_u32(pdev->dev.of_node, | 651 | ret = of_property_read_u32(pdev->dev.of_node, |
642 | "atmel,trigger-edge-type", &edge_type); | 652 | "atmel,trigger-edge-type", &edge_type); |
643 | if (ret) { | 653 | if (ret) { |
644 | dev_err(&pdev->dev, | 654 | dev_dbg(&pdev->dev, |
645 | "invalid or missing value for atmel,trigger-edge-type\n"); | 655 | "atmel,trigger-edge-type not specified, only software trigger available\n"); |
646 | return ret; | ||
647 | } | 656 | } |
648 | 657 | ||
649 | st->selected_trig = NULL; | 658 | st->selected_trig = NULL; |
650 | 659 | ||
651 | for (i = 0; i < AT91_SAMA5D2_HW_TRIG_CNT; i++) | 660 | /* find the right trigger, or no trigger at all */ |
661 | for (i = 0; i < AT91_SAMA5D2_HW_TRIG_CNT + 1; i++) | ||
652 | if (at91_adc_trigger_list[i].edge_type == edge_type) { | 662 | if (at91_adc_trigger_list[i].edge_type == edge_type) { |
653 | st->selected_trig = &at91_adc_trigger_list[i]; | 663 | st->selected_trig = &at91_adc_trigger_list[i]; |
654 | break; | 664 | break; |
@@ -717,24 +727,27 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
717 | 727 | ||
718 | platform_set_drvdata(pdev, indio_dev); | 728 | platform_set_drvdata(pdev, indio_dev); |
719 | 729 | ||
720 | ret = at91_adc_buffer_init(indio_dev); | 730 | if (st->selected_trig->hw_trig) { |
721 | if (ret < 0) { | 731 | ret = at91_adc_buffer_init(indio_dev); |
722 | dev_err(&pdev->dev, "couldn't initialize the buffer.\n"); | 732 | if (ret < 0) { |
723 | goto per_clk_disable_unprepare; | 733 | dev_err(&pdev->dev, "couldn't initialize the buffer.\n"); |
724 | } | 734 | goto per_clk_disable_unprepare; |
735 | } | ||
725 | 736 | ||
726 | ret = at91_adc_trigger_init(indio_dev); | 737 | ret = at91_adc_trigger_init(indio_dev); |
727 | if (ret < 0) { | 738 | if (ret < 0) { |
728 | dev_err(&pdev->dev, "couldn't setup the triggers.\n"); | 739 | dev_err(&pdev->dev, "couldn't setup the triggers.\n"); |
729 | goto per_clk_disable_unprepare; | 740 | goto per_clk_disable_unprepare; |
741 | } | ||
730 | } | 742 | } |
731 | 743 | ||
732 | ret = iio_device_register(indio_dev); | 744 | ret = iio_device_register(indio_dev); |
733 | if (ret < 0) | 745 | if (ret < 0) |
734 | goto per_clk_disable_unprepare; | 746 | goto per_clk_disable_unprepare; |
735 | 747 | ||
736 | dev_info(&pdev->dev, "setting up trigger as %s\n", | 748 | if (st->selected_trig->hw_trig) |
737 | st->selected_trig->name); | 749 | dev_info(&pdev->dev, "setting up trigger as %s\n", |
750 | st->selected_trig->name); | ||
738 | 751 | ||
739 | dev_info(&pdev->dev, "version: %x\n", | 752 | dev_info(&pdev->dev, "version: %x\n", |
740 | readl_relaxed(st->base + AT91_SAMA5D2_VERSION)); | 753 | readl_relaxed(st->base + AT91_SAMA5D2_VERSION)); |
diff --git a/drivers/iio/dummy/iio_simple_dummy_events.c b/drivers/iio/dummy/iio_simple_dummy_events.c index ed63ffd849f8..7ec2a0bb0807 100644 --- a/drivers/iio/dummy/iio_simple_dummy_events.c +++ b/drivers/iio/dummy/iio_simple_dummy_events.c | |||
@@ -72,6 +72,7 @@ int iio_simple_dummy_write_event_config(struct iio_dev *indio_dev, | |||
72 | st->event_en = state; | 72 | st->event_en = state; |
73 | else | 73 | else |
74 | return -EINVAL; | 74 | return -EINVAL; |
75 | break; | ||
75 | default: | 76 | default: |
76 | return -EINVAL; | 77 | return -EINVAL; |
77 | } | 78 | } |
diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c index ebfb1de7377f..91431454eb85 100644 --- a/drivers/iio/pressure/zpa2326.c +++ b/drivers/iio/pressure/zpa2326.c | |||
@@ -865,7 +865,6 @@ complete: | |||
865 | static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, | 865 | static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, |
866 | struct zpa2326_private *private) | 866 | struct zpa2326_private *private) |
867 | { | 867 | { |
868 | int ret; | ||
869 | unsigned int val; | 868 | unsigned int val; |
870 | long timeout; | 869 | long timeout; |
871 | 870 | ||
@@ -887,14 +886,11 @@ static int zpa2326_wait_oneshot_completion(const struct iio_dev *indio_dev, | |||
887 | /* Timed out. */ | 886 | /* Timed out. */ |
888 | zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", | 887 | zpa2326_warn(indio_dev, "no one shot interrupt occurred (%ld)", |
889 | timeout); | 888 | timeout); |
890 | ret = -ETIME; | 889 | return -ETIME; |
891 | } else if (timeout < 0) { | ||
892 | zpa2326_warn(indio_dev, | ||
893 | "wait for one shot interrupt cancelled"); | ||
894 | ret = -ERESTARTSYS; | ||
895 | } | 890 | } |
896 | 891 | ||
897 | return ret; | 892 | zpa2326_warn(indio_dev, "wait for one shot interrupt cancelled"); |
893 | return -ERESTARTSYS; | ||
898 | } | 894 | } |
899 | 895 | ||
900 | static int zpa2326_init_managed_irq(struct device *parent, | 896 | static int zpa2326_init_managed_irq(struct device *parent, |
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index 0eeff29b61be..4a48b7ba3a1c 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c | |||
@@ -39,8 +39,12 @@ | |||
39 | #define AS3935_AFE_GAIN_MAX 0x1F | 39 | #define AS3935_AFE_GAIN_MAX 0x1F |
40 | #define AS3935_AFE_PWR_BIT BIT(0) | 40 | #define AS3935_AFE_PWR_BIT BIT(0) |
41 | 41 | ||
42 | #define AS3935_NFLWDTH 0x01 | ||
43 | #define AS3935_NFLWDTH_MASK 0x7f | ||
44 | |||
42 | #define AS3935_INT 0x03 | 45 | #define AS3935_INT 0x03 |
43 | #define AS3935_INT_MASK 0x0f | 46 | #define AS3935_INT_MASK 0x0f |
47 | #define AS3935_DISTURB_INT BIT(2) | ||
44 | #define AS3935_EVENT_INT BIT(3) | 48 | #define AS3935_EVENT_INT BIT(3) |
45 | #define AS3935_NOISE_INT BIT(0) | 49 | #define AS3935_NOISE_INT BIT(0) |
46 | 50 | ||
@@ -48,6 +52,7 @@ | |||
48 | #define AS3935_DATA_MASK 0x3F | 52 | #define AS3935_DATA_MASK 0x3F |
49 | 53 | ||
50 | #define AS3935_TUNE_CAP 0x08 | 54 | #define AS3935_TUNE_CAP 0x08 |
55 | #define AS3935_DEFAULTS 0x3C | ||
51 | #define AS3935_CALIBRATE 0x3D | 56 | #define AS3935_CALIBRATE 0x3D |
52 | 57 | ||
53 | #define AS3935_READ_DATA BIT(14) | 58 | #define AS3935_READ_DATA BIT(14) |
@@ -62,7 +67,9 @@ struct as3935_state { | |||
62 | struct mutex lock; | 67 | struct mutex lock; |
63 | struct delayed_work work; | 68 | struct delayed_work work; |
64 | 69 | ||
70 | unsigned long noise_tripped; | ||
65 | u32 tune_cap; | 71 | u32 tune_cap; |
72 | u32 nflwdth_reg; | ||
66 | u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */ | 73 | u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */ |
67 | u8 buf[2] ____cacheline_aligned; | 74 | u8 buf[2] ____cacheline_aligned; |
68 | }; | 75 | }; |
@@ -145,12 +152,29 @@ static ssize_t as3935_sensor_sensitivity_store(struct device *dev, | |||
145 | return len; | 152 | return len; |
146 | } | 153 | } |
147 | 154 | ||
155 | static ssize_t as3935_noise_level_tripped_show(struct device *dev, | ||
156 | struct device_attribute *attr, | ||
157 | char *buf) | ||
158 | { | ||
159 | struct as3935_state *st = iio_priv(dev_to_iio_dev(dev)); | ||
160 | int ret; | ||
161 | |||
162 | mutex_lock(&st->lock); | ||
163 | ret = sprintf(buf, "%d\n", !time_after(jiffies, st->noise_tripped + HZ)); | ||
164 | mutex_unlock(&st->lock); | ||
165 | |||
166 | return ret; | ||
167 | } | ||
168 | |||
148 | static IIO_DEVICE_ATTR(sensor_sensitivity, S_IRUGO | S_IWUSR, | 169 | static IIO_DEVICE_ATTR(sensor_sensitivity, S_IRUGO | S_IWUSR, |
149 | as3935_sensor_sensitivity_show, as3935_sensor_sensitivity_store, 0); | 170 | as3935_sensor_sensitivity_show, as3935_sensor_sensitivity_store, 0); |
150 | 171 | ||
172 | static IIO_DEVICE_ATTR(noise_level_tripped, S_IRUGO, | ||
173 | as3935_noise_level_tripped_show, NULL, 0); | ||
151 | 174 | ||
152 | static struct attribute *as3935_attributes[] = { | 175 | static struct attribute *as3935_attributes[] = { |
153 | &iio_dev_attr_sensor_sensitivity.dev_attr.attr, | 176 | &iio_dev_attr_sensor_sensitivity.dev_attr.attr, |
177 | &iio_dev_attr_noise_level_tripped.dev_attr.attr, | ||
154 | NULL, | 178 | NULL, |
155 | }; | 179 | }; |
156 | 180 | ||
@@ -246,7 +270,11 @@ static void as3935_event_work(struct work_struct *work) | |||
246 | case AS3935_EVENT_INT: | 270 | case AS3935_EVENT_INT: |
247 | iio_trigger_poll_chained(st->trig); | 271 | iio_trigger_poll_chained(st->trig); |
248 | break; | 272 | break; |
273 | case AS3935_DISTURB_INT: | ||
249 | case AS3935_NOISE_INT: | 274 | case AS3935_NOISE_INT: |
275 | mutex_lock(&st->lock); | ||
276 | st->noise_tripped = jiffies; | ||
277 | mutex_unlock(&st->lock); | ||
250 | dev_warn(&st->spi->dev, "noise level is too high\n"); | 278 | dev_warn(&st->spi->dev, "noise level is too high\n"); |
251 | break; | 279 | break; |
252 | } | 280 | } |
@@ -269,15 +297,14 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private) | |||
269 | 297 | ||
270 | static void calibrate_as3935(struct as3935_state *st) | 298 | static void calibrate_as3935(struct as3935_state *st) |
271 | { | 299 | { |
272 | /* mask disturber interrupt bit */ | 300 | as3935_write(st, AS3935_DEFAULTS, 0x96); |
273 | as3935_write(st, AS3935_INT, BIT(5)); | ||
274 | |||
275 | as3935_write(st, AS3935_CALIBRATE, 0x96); | 301 | as3935_write(st, AS3935_CALIBRATE, 0x96); |
276 | as3935_write(st, AS3935_TUNE_CAP, | 302 | as3935_write(st, AS3935_TUNE_CAP, |
277 | BIT(5) | (st->tune_cap / TUNE_CAP_DIV)); | 303 | BIT(5) | (st->tune_cap / TUNE_CAP_DIV)); |
278 | 304 | ||
279 | mdelay(2); | 305 | mdelay(2); |
280 | as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); | 306 | as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); |
307 | as3935_write(st, AS3935_NFLWDTH, st->nflwdth_reg); | ||
281 | } | 308 | } |
282 | 309 | ||
283 | #ifdef CONFIG_PM_SLEEP | 310 | #ifdef CONFIG_PM_SLEEP |
@@ -370,6 +397,15 @@ static int as3935_probe(struct spi_device *spi) | |||
370 | return -EINVAL; | 397 | return -EINVAL; |
371 | } | 398 | } |
372 | 399 | ||
400 | ret = of_property_read_u32(np, | ||
401 | "ams,nflwdth", &st->nflwdth_reg); | ||
402 | if (!ret && st->nflwdth_reg > AS3935_NFLWDTH_MASK) { | ||
403 | dev_err(&spi->dev, | ||
404 | "invalid nflwdth setting of %d\n", | ||
405 | st->nflwdth_reg); | ||
406 | return -EINVAL; | ||
407 | } | ||
408 | |||
373 | indio_dev->dev.parent = &spi->dev; | 409 | indio_dev->dev.parent = &spi->dev; |
374 | indio_dev->name = spi_get_device_id(spi)->name; | 410 | indio_dev->name = spi_get_device_id(spi)->name; |
375 | indio_dev->channels = as3935_channels; | 411 | indio_dev->channels = as3935_channels; |
@@ -384,6 +420,7 @@ static int as3935_probe(struct spi_device *spi) | |||
384 | return -ENOMEM; | 420 | return -ENOMEM; |
385 | 421 | ||
386 | st->trig = trig; | 422 | st->trig = trig; |
423 | st->noise_tripped = jiffies - HZ; | ||
387 | trig->dev.parent = indio_dev->dev.parent; | 424 | trig->dev.parent = indio_dev->dev.parent; |
388 | iio_trigger_set_drvdata(trig, indio_dev); | 425 | iio_trigger_set_drvdata(trig, indio_dev); |
389 | trig->ops = &iio_interrupt_trigger_ops; | 426 | trig->ops = &iio_interrupt_trigger_ops; |
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c index b12e58787c3d..1fb72c356e36 100644 --- a/drivers/infiniband/core/netlink.c +++ b/drivers/infiniband/core/netlink.c | |||
@@ -175,13 +175,24 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
175 | !netlink_capable(skb, CAP_NET_ADMIN)) | 175 | !netlink_capable(skb, CAP_NET_ADMIN)) |
176 | return -EPERM; | 176 | return -EPERM; |
177 | 177 | ||
178 | /* | ||
179 | * LS responses overload the 0x100 (NLM_F_ROOT) flag. Don't | ||
180 | * mistakenly call the .dump() function. | ||
181 | */ | ||
182 | if (index == RDMA_NL_LS) { | ||
183 | if (cb_table[op].doit) | ||
184 | return cb_table[op].doit(skb, nlh, extack); | ||
185 | return -EINVAL; | ||
186 | } | ||
178 | /* FIXME: Convert IWCM to properly handle doit callbacks */ | 187 | /* FIXME: Convert IWCM to properly handle doit callbacks */ |
179 | if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM || | 188 | if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM || |
180 | index == RDMA_NL_IWCM) { | 189 | index == RDMA_NL_IWCM) { |
181 | struct netlink_dump_control c = { | 190 | struct netlink_dump_control c = { |
182 | .dump = cb_table[op].dump, | 191 | .dump = cb_table[op].dump, |
183 | }; | 192 | }; |
184 | return netlink_dump_start(nls, skb, nlh, &c); | 193 | if (c.dump) |
194 | return netlink_dump_start(nls, skb, nlh, &c); | ||
195 | return -EINVAL; | ||
185 | } | 196 | } |
186 | 197 | ||
187 | if (cb_table[op].doit) | 198 | if (cb_table[op].doit) |
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index 0e761d079dc4..6d6b092e2da9 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c | |||
@@ -1258,6 +1258,7 @@ static const struct acpi_device_id elan_acpi_id[] = { | |||
1258 | { "ELAN0605", 0 }, | 1258 | { "ELAN0605", 0 }, |
1259 | { "ELAN0609", 0 }, | 1259 | { "ELAN0609", 0 }, |
1260 | { "ELAN060B", 0 }, | 1260 | { "ELAN060B", 0 }, |
1261 | { "ELAN0611", 0 }, | ||
1261 | { "ELAN1000", 0 }, | 1262 | { "ELAN1000", 0 }, |
1262 | { } | 1263 | { } |
1263 | }; | 1264 | }; |
diff --git a/drivers/input/rmi4/rmi_f30.c b/drivers/input/rmi4/rmi_f30.c index 34dfee555b20..82e0f0d43d55 100644 --- a/drivers/input/rmi4/rmi_f30.c +++ b/drivers/input/rmi4/rmi_f30.c | |||
@@ -232,9 +232,10 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, | |||
232 | unsigned int trackstick_button = BTN_LEFT; | 232 | unsigned int trackstick_button = BTN_LEFT; |
233 | bool button_mapped = false; | 233 | bool button_mapped = false; |
234 | int i; | 234 | int i; |
235 | int button_count = min_t(u8, f30->gpioled_count, TRACKSTICK_RANGE_END); | ||
235 | 236 | ||
236 | f30->gpioled_key_map = devm_kcalloc(&fn->dev, | 237 | f30->gpioled_key_map = devm_kcalloc(&fn->dev, |
237 | f30->gpioled_count, | 238 | button_count, |
238 | sizeof(f30->gpioled_key_map[0]), | 239 | sizeof(f30->gpioled_key_map[0]), |
239 | GFP_KERNEL); | 240 | GFP_KERNEL); |
240 | if (!f30->gpioled_key_map) { | 241 | if (!f30->gpioled_key_map) { |
@@ -242,7 +243,7 @@ static int rmi_f30_map_gpios(struct rmi_function *fn, | |||
242 | return -ENOMEM; | 243 | return -ENOMEM; |
243 | } | 244 | } |
244 | 245 | ||
245 | for (i = 0; i < f30->gpioled_count; i++) { | 246 | for (i = 0; i < button_count; i++) { |
246 | if (!rmi_f30_is_valid_button(i, f30->ctrl)) | 247 | if (!rmi_f30_is_valid_button(i, f30->ctrl)) |
247 | continue; | 248 | continue; |
248 | 249 | ||
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index b796e891e2ee..4b8b9d7aa75e 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -230,13 +230,17 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
230 | 230 | ||
231 | /* Walk this report and pull out the info we need */ | 231 | /* Walk this report and pull out the info we need */ |
232 | while (i < length) { | 232 | while (i < length) { |
233 | prefix = report[i]; | 233 | prefix = report[i++]; |
234 | |||
235 | /* Skip over prefix */ | ||
236 | i++; | ||
237 | 234 | ||
238 | /* Determine data size and save the data in the proper variable */ | 235 | /* Determine data size and save the data in the proper variable */ |
239 | size = PREF_SIZE(prefix); | 236 | size = (1U << PREF_SIZE(prefix)) >> 1; |
237 | if (i + size > length) { | ||
238 | dev_err(ddev, | ||
239 | "Not enough data (need %d, have %d)\n", | ||
240 | i + size, length); | ||
241 | break; | ||
242 | } | ||
243 | |||
240 | switch (size) { | 244 | switch (size) { |
241 | case 1: | 245 | case 1: |
242 | data = report[i]; | 246 | data = report[i]; |
@@ -244,8 +248,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
244 | case 2: | 248 | case 2: |
245 | data16 = get_unaligned_le16(&report[i]); | 249 | data16 = get_unaligned_le16(&report[i]); |
246 | break; | 250 | break; |
247 | case 3: | 251 | case 4: |
248 | size = 4; | ||
249 | data32 = get_unaligned_le32(&report[i]); | 252 | data32 = get_unaligned_le32(&report[i]); |
250 | break; | 253 | break; |
251 | } | 254 | } |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index e8d89343d613..e88395605e32 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -107,6 +107,10 @@ struct its_node { | |||
107 | 107 | ||
108 | #define ITS_ITT_ALIGN SZ_256 | 108 | #define ITS_ITT_ALIGN SZ_256 |
109 | 109 | ||
110 | /* The maximum number of VPEID bits supported by VLPI commands */ | ||
111 | #define ITS_MAX_VPEID_BITS (16) | ||
112 | #define ITS_MAX_VPEID (1 << (ITS_MAX_VPEID_BITS)) | ||
113 | |||
110 | /* Convert page order to size in bytes */ | 114 | /* Convert page order to size in bytes */ |
111 | #define PAGE_ORDER_TO_SIZE(o) (PAGE_SIZE << (o)) | 115 | #define PAGE_ORDER_TO_SIZE(o) (PAGE_SIZE << (o)) |
112 | 116 | ||
@@ -308,7 +312,7 @@ static void its_encode_size(struct its_cmd_block *cmd, u8 size) | |||
308 | 312 | ||
309 | static void its_encode_itt(struct its_cmd_block *cmd, u64 itt_addr) | 313 | static void its_encode_itt(struct its_cmd_block *cmd, u64 itt_addr) |
310 | { | 314 | { |
311 | its_mask_encode(&cmd->raw_cmd[2], itt_addr >> 8, 50, 8); | 315 | its_mask_encode(&cmd->raw_cmd[2], itt_addr >> 8, 51, 8); |
312 | } | 316 | } |
313 | 317 | ||
314 | static void its_encode_valid(struct its_cmd_block *cmd, int valid) | 318 | static void its_encode_valid(struct its_cmd_block *cmd, int valid) |
@@ -318,7 +322,7 @@ static void its_encode_valid(struct its_cmd_block *cmd, int valid) | |||
318 | 322 | ||
319 | static void its_encode_target(struct its_cmd_block *cmd, u64 target_addr) | 323 | static void its_encode_target(struct its_cmd_block *cmd, u64 target_addr) |
320 | { | 324 | { |
321 | its_mask_encode(&cmd->raw_cmd[2], target_addr >> 16, 50, 16); | 325 | its_mask_encode(&cmd->raw_cmd[2], target_addr >> 16, 51, 16); |
322 | } | 326 | } |
323 | 327 | ||
324 | static void its_encode_collection(struct its_cmd_block *cmd, u16 col) | 328 | static void its_encode_collection(struct its_cmd_block *cmd, u16 col) |
@@ -358,7 +362,7 @@ static void its_encode_its_list(struct its_cmd_block *cmd, u16 its_list) | |||
358 | 362 | ||
359 | static void its_encode_vpt_addr(struct its_cmd_block *cmd, u64 vpt_pa) | 363 | static void its_encode_vpt_addr(struct its_cmd_block *cmd, u64 vpt_pa) |
360 | { | 364 | { |
361 | its_mask_encode(&cmd->raw_cmd[3], vpt_pa >> 16, 50, 16); | 365 | its_mask_encode(&cmd->raw_cmd[3], vpt_pa >> 16, 51, 16); |
362 | } | 366 | } |
363 | 367 | ||
364 | static void its_encode_vpt_size(struct its_cmd_block *cmd, u8 vpt_size) | 368 | static void its_encode_vpt_size(struct its_cmd_block *cmd, u8 vpt_size) |
@@ -1478,9 +1482,9 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser, | |||
1478 | u64 val = its_read_baser(its, baser); | 1482 | u64 val = its_read_baser(its, baser); |
1479 | u64 esz = GITS_BASER_ENTRY_SIZE(val); | 1483 | u64 esz = GITS_BASER_ENTRY_SIZE(val); |
1480 | u64 type = GITS_BASER_TYPE(val); | 1484 | u64 type = GITS_BASER_TYPE(val); |
1485 | u64 baser_phys, tmp; | ||
1481 | u32 alloc_pages; | 1486 | u32 alloc_pages; |
1482 | void *base; | 1487 | void *base; |
1483 | u64 tmp; | ||
1484 | 1488 | ||
1485 | retry_alloc_baser: | 1489 | retry_alloc_baser: |
1486 | alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz); | 1490 | alloc_pages = (PAGE_ORDER_TO_SIZE(order) / psz); |
@@ -1496,8 +1500,24 @@ retry_alloc_baser: | |||
1496 | if (!base) | 1500 | if (!base) |
1497 | return -ENOMEM; | 1501 | return -ENOMEM; |
1498 | 1502 | ||
1503 | baser_phys = virt_to_phys(base); | ||
1504 | |||
1505 | /* Check if the physical address of the memory is above 48bits */ | ||
1506 | if (IS_ENABLED(CONFIG_ARM64_64K_PAGES) && (baser_phys >> 48)) { | ||
1507 | |||
1508 | /* 52bit PA is supported only when PageSize=64K */ | ||
1509 | if (psz != SZ_64K) { | ||
1510 | pr_err("ITS: no 52bit PA support when psz=%d\n", psz); | ||
1511 | free_pages((unsigned long)base, order); | ||
1512 | return -ENXIO; | ||
1513 | } | ||
1514 | |||
1515 | /* Convert 52bit PA to 48bit field */ | ||
1516 | baser_phys = GITS_BASER_PHYS_52_to_48(baser_phys); | ||
1517 | } | ||
1518 | |||
1499 | retry_baser: | 1519 | retry_baser: |
1500 | val = (virt_to_phys(base) | | 1520 | val = (baser_phys | |
1501 | (type << GITS_BASER_TYPE_SHIFT) | | 1521 | (type << GITS_BASER_TYPE_SHIFT) | |
1502 | ((esz - 1) << GITS_BASER_ENTRY_SIZE_SHIFT) | | 1522 | ((esz - 1) << GITS_BASER_ENTRY_SIZE_SHIFT) | |
1503 | ((alloc_pages - 1) << GITS_BASER_PAGES_SHIFT) | | 1523 | ((alloc_pages - 1) << GITS_BASER_PAGES_SHIFT) | |
@@ -1582,13 +1602,12 @@ retry_baser: | |||
1582 | 1602 | ||
1583 | static bool its_parse_indirect_baser(struct its_node *its, | 1603 | static bool its_parse_indirect_baser(struct its_node *its, |
1584 | struct its_baser *baser, | 1604 | struct its_baser *baser, |
1585 | u32 psz, u32 *order) | 1605 | u32 psz, u32 *order, u32 ids) |
1586 | { | 1606 | { |
1587 | u64 tmp = its_read_baser(its, baser); | 1607 | u64 tmp = its_read_baser(its, baser); |
1588 | u64 type = GITS_BASER_TYPE(tmp); | 1608 | u64 type = GITS_BASER_TYPE(tmp); |
1589 | u64 esz = GITS_BASER_ENTRY_SIZE(tmp); | 1609 | u64 esz = GITS_BASER_ENTRY_SIZE(tmp); |
1590 | u64 val = GITS_BASER_InnerShareable | GITS_BASER_RaWaWb; | 1610 | u64 val = GITS_BASER_InnerShareable | GITS_BASER_RaWaWb; |
1591 | u32 ids = its->device_ids; | ||
1592 | u32 new_order = *order; | 1611 | u32 new_order = *order; |
1593 | bool indirect = false; | 1612 | bool indirect = false; |
1594 | 1613 | ||
@@ -1680,9 +1699,13 @@ static int its_alloc_tables(struct its_node *its) | |||
1680 | continue; | 1699 | continue; |
1681 | 1700 | ||
1682 | case GITS_BASER_TYPE_DEVICE: | 1701 | case GITS_BASER_TYPE_DEVICE: |
1702 | indirect = its_parse_indirect_baser(its, baser, | ||
1703 | psz, &order, | ||
1704 | its->device_ids); | ||
1683 | case GITS_BASER_TYPE_VCPU: | 1705 | case GITS_BASER_TYPE_VCPU: |
1684 | indirect = its_parse_indirect_baser(its, baser, | 1706 | indirect = its_parse_indirect_baser(its, baser, |
1685 | psz, &order); | 1707 | psz, &order, |
1708 | ITS_MAX_VPEID_BITS); | ||
1686 | break; | 1709 | break; |
1687 | } | 1710 | } |
1688 | 1711 | ||
@@ -2551,7 +2574,7 @@ static struct irq_chip its_vpe_irq_chip = { | |||
2551 | 2574 | ||
2552 | static int its_vpe_id_alloc(void) | 2575 | static int its_vpe_id_alloc(void) |
2553 | { | 2576 | { |
2554 | return ida_simple_get(&its_vpeid_ida, 0, 1 << 16, GFP_KERNEL); | 2577 | return ida_simple_get(&its_vpeid_ida, 0, ITS_MAX_VPEID, GFP_KERNEL); |
2555 | } | 2578 | } |
2556 | 2579 | ||
2557 | static void its_vpe_id_free(u16 id) | 2580 | static void its_vpe_id_free(u16 id) |
@@ -2851,7 +2874,7 @@ static int its_init_vpe_domain(void) | |||
2851 | return -ENOMEM; | 2874 | return -ENOMEM; |
2852 | } | 2875 | } |
2853 | 2876 | ||
2854 | BUG_ON(entries != vpe_proxy.dev->nr_ites); | 2877 | BUG_ON(entries > vpe_proxy.dev->nr_ites); |
2855 | 2878 | ||
2856 | raw_spin_lock_init(&vpe_proxy.lock); | 2879 | raw_spin_lock_init(&vpe_proxy.lock); |
2857 | vpe_proxy.next_victim = 0; | 2880 | vpe_proxy.next_victim = 0; |
diff --git a/drivers/irqchip/irq-tango.c b/drivers/irqchip/irq-tango.c index bdbb5c0ff7fe..0c085303a583 100644 --- a/drivers/irqchip/irq-tango.c +++ b/drivers/irqchip/irq-tango.c | |||
@@ -141,7 +141,7 @@ static void __init tangox_irq_init_chip(struct irq_chip_generic *gc, | |||
141 | for (i = 0; i < 2; i++) { | 141 | for (i = 0; i < 2; i++) { |
142 | ct[i].chip.irq_ack = irq_gc_ack_set_bit; | 142 | ct[i].chip.irq_ack = irq_gc_ack_set_bit; |
143 | ct[i].chip.irq_mask = irq_gc_mask_disable_reg; | 143 | ct[i].chip.irq_mask = irq_gc_mask_disable_reg; |
144 | ct[i].chip.irq_mask_ack = irq_gc_mask_disable_reg_and_ack; | 144 | ct[i].chip.irq_mask_ack = irq_gc_mask_disable_and_ack_set; |
145 | ct[i].chip.irq_unmask = irq_gc_unmask_enable_reg; | 145 | ct[i].chip.irq_unmask = irq_gc_unmask_enable_reg; |
146 | ct[i].chip.irq_set_type = tangox_irq_set_type; | 146 | ct[i].chip.irq_set_type = tangox_irq_set_type; |
147 | ct[i].chip.name = gc->domain->name; | 147 | ct[i].chip.name = gc->domain->name; |
diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 68ef0a4cd821..b0c80859f746 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c | |||
@@ -342,7 +342,7 @@ static int sun4i_can_start(struct net_device *dev) | |||
342 | 342 | ||
343 | /* enter the selected mode */ | 343 | /* enter the selected mode */ |
344 | mod_reg_val = readl(priv->base + SUN4I_REG_MSEL_ADDR); | 344 | mod_reg_val = readl(priv->base + SUN4I_REG_MSEL_ADDR); |
345 | if (priv->can.ctrlmode & CAN_CTRLMODE_PRESUME_ACK) | 345 | if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK) |
346 | mod_reg_val |= SUN4I_MSEL_LOOPBACK_MODE; | 346 | mod_reg_val |= SUN4I_MSEL_LOOPBACK_MODE; |
347 | else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) | 347 | else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) |
348 | mod_reg_val |= SUN4I_MSEL_LISTEN_ONLY_MODE; | 348 | mod_reg_val |= SUN4I_MSEL_LISTEN_ONLY_MODE; |
@@ -811,7 +811,6 @@ static int sun4ican_probe(struct platform_device *pdev) | |||
811 | priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING | | 811 | priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING | |
812 | CAN_CTRLMODE_LISTENONLY | | 812 | CAN_CTRLMODE_LISTENONLY | |
813 | CAN_CTRLMODE_LOOPBACK | | 813 | CAN_CTRLMODE_LOOPBACK | |
814 | CAN_CTRLMODE_PRESUME_ACK | | ||
815 | CAN_CTRLMODE_3_SAMPLES; | 814 | CAN_CTRLMODE_3_SAMPLES; |
816 | priv->base = addr; | 815 | priv->base = addr; |
817 | priv->clk = clk; | 816 | priv->clk = clk; |
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index 18cc529fb807..9b18d96ef526 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
@@ -137,6 +137,7 @@ static inline bool kvaser_is_usbcan(const struct usb_device_id *id) | |||
137 | #define CMD_RESET_ERROR_COUNTER 49 | 137 | #define CMD_RESET_ERROR_COUNTER 49 |
138 | #define CMD_TX_ACKNOWLEDGE 50 | 138 | #define CMD_TX_ACKNOWLEDGE 50 |
139 | #define CMD_CAN_ERROR_EVENT 51 | 139 | #define CMD_CAN_ERROR_EVENT 51 |
140 | #define CMD_FLUSH_QUEUE_REPLY 68 | ||
140 | 141 | ||
141 | #define CMD_LEAF_USB_THROTTLE 77 | 142 | #define CMD_LEAF_USB_THROTTLE 77 |
142 | #define CMD_LEAF_LOG_MESSAGE 106 | 143 | #define CMD_LEAF_LOG_MESSAGE 106 |
@@ -1301,6 +1302,11 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev, | |||
1301 | goto warn; | 1302 | goto warn; |
1302 | break; | 1303 | break; |
1303 | 1304 | ||
1305 | case CMD_FLUSH_QUEUE_REPLY: | ||
1306 | if (dev->family != KVASER_LEAF) | ||
1307 | goto warn; | ||
1308 | break; | ||
1309 | |||
1304 | default: | 1310 | default: |
1305 | warn: dev_warn(dev->udev->dev.parent, | 1311 | warn: dev_warn(dev->udev->dev.parent, |
1306 | "Unhandled message (%d)\n", msg->id); | 1312 | "Unhandled message (%d)\n", msg->id); |
@@ -1609,7 +1615,8 @@ static int kvaser_usb_close(struct net_device *netdev) | |||
1609 | if (err) | 1615 | if (err) |
1610 | netdev_warn(netdev, "Cannot flush queue, error %d\n", err); | 1616 | netdev_warn(netdev, "Cannot flush queue, error %d\n", err); |
1611 | 1617 | ||
1612 | if (kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel)) | 1618 | err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel); |
1619 | if (err) | ||
1613 | netdev_warn(netdev, "Cannot reset card, error %d\n", err); | 1620 | netdev_warn(netdev, "Cannot reset card, error %d\n", err); |
1614 | 1621 | ||
1615 | err = kvaser_usb_stop_chip(priv); | 1622 | err = kvaser_usb_stop_chip(priv); |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c index ec8aa4562cc9..3b3983a1ffbb 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c +++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c | |||
@@ -1824,11 +1824,12 @@ static void e1000_get_ethtool_stats(struct net_device *netdev, | |||
1824 | { | 1824 | { |
1825 | struct e1000_adapter *adapter = netdev_priv(netdev); | 1825 | struct e1000_adapter *adapter = netdev_priv(netdev); |
1826 | int i; | 1826 | int i; |
1827 | char *p = NULL; | ||
1828 | const struct e1000_stats *stat = e1000_gstrings_stats; | 1827 | const struct e1000_stats *stat = e1000_gstrings_stats; |
1829 | 1828 | ||
1830 | e1000_update_stats(adapter); | 1829 | e1000_update_stats(adapter); |
1831 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) { | 1830 | for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++, stat++) { |
1831 | char *p; | ||
1832 | |||
1832 | switch (stat->type) { | 1833 | switch (stat->type) { |
1833 | case NETDEV_STATS: | 1834 | case NETDEV_STATS: |
1834 | p = (char *)netdev + stat->stat_offset; | 1835 | p = (char *)netdev + stat->stat_offset; |
@@ -1839,15 +1840,13 @@ static void e1000_get_ethtool_stats(struct net_device *netdev, | |||
1839 | default: | 1840 | default: |
1840 | WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n", | 1841 | WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n", |
1841 | stat->type, i); | 1842 | stat->type, i); |
1842 | break; | 1843 | continue; |
1843 | } | 1844 | } |
1844 | 1845 | ||
1845 | if (stat->sizeof_stat == sizeof(u64)) | 1846 | if (stat->sizeof_stat == sizeof(u64)) |
1846 | data[i] = *(u64 *)p; | 1847 | data[i] = *(u64 *)p; |
1847 | else | 1848 | else |
1848 | data[i] = *(u32 *)p; | 1849 | data[i] = *(u32 *)p; |
1849 | |||
1850 | stat++; | ||
1851 | } | 1850 | } |
1852 | /* BUG_ON(i != E1000_STATS_LEN); */ | 1851 | /* BUG_ON(i != E1000_STATS_LEN); */ |
1853 | } | 1852 | } |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 98375e1e1185..1982f7917a8d 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -520,8 +520,6 @@ void e1000_down(struct e1000_adapter *adapter) | |||
520 | struct net_device *netdev = adapter->netdev; | 520 | struct net_device *netdev = adapter->netdev; |
521 | u32 rctl, tctl; | 521 | u32 rctl, tctl; |
522 | 522 | ||
523 | netif_carrier_off(netdev); | ||
524 | |||
525 | /* disable receives in the hardware */ | 523 | /* disable receives in the hardware */ |
526 | rctl = er32(RCTL); | 524 | rctl = er32(RCTL); |
527 | ew32(RCTL, rctl & ~E1000_RCTL_EN); | 525 | ew32(RCTL, rctl & ~E1000_RCTL_EN); |
@@ -537,6 +535,15 @@ void e1000_down(struct e1000_adapter *adapter) | |||
537 | E1000_WRITE_FLUSH(); | 535 | E1000_WRITE_FLUSH(); |
538 | msleep(10); | 536 | msleep(10); |
539 | 537 | ||
538 | /* Set the carrier off after transmits have been disabled in the | ||
539 | * hardware, to avoid race conditions with e1000_watchdog() (which | ||
540 | * may be running concurrently to us, checking for the carrier | ||
541 | * bit to decide whether it should enable transmits again). Such | ||
542 | * a race condition would result into transmission being disabled | ||
543 | * in the hardware until the next IFF_DOWN+IFF_UP cycle. | ||
544 | */ | ||
545 | netif_carrier_off(netdev); | ||
546 | |||
540 | napi_disable(&adapter->napi); | 547 | napi_disable(&adapter->napi); |
541 | 548 | ||
542 | e1000_irq_disable(adapter); | 549 | e1000_irq_disable(adapter); |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index edbc94c4353d..c5cd233c8fee 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -2111,6 +2111,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) | |||
2111 | 2111 | ||
2112 | if (unlikely(i40e_rx_is_programming_status(qword))) { | 2112 | if (unlikely(i40e_rx_is_programming_status(qword))) { |
2113 | i40e_clean_programming_status(rx_ring, rx_desc, qword); | 2113 | i40e_clean_programming_status(rx_ring, rx_desc, qword); |
2114 | cleaned_count++; | ||
2114 | continue; | 2115 | continue; |
2115 | } | 2116 | } |
2116 | size = (qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >> | 2117 | size = (qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >> |
@@ -2277,7 +2278,7 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, | |||
2277 | goto enable_int; | 2278 | goto enable_int; |
2278 | } | 2279 | } |
2279 | 2280 | ||
2280 | if (ITR_IS_DYNAMIC(tx_itr_setting)) { | 2281 | if (ITR_IS_DYNAMIC(rx_itr_setting)) { |
2281 | rx = i40e_set_new_dynamic_itr(&q_vector->rx); | 2282 | rx = i40e_set_new_dynamic_itr(&q_vector->rx); |
2282 | rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr); | 2283 | rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr); |
2283 | } | 2284 | } |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index b3d730f4d695..e22bce7cdacd 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -5673,7 +5673,7 @@ dma_error: | |||
5673 | DMA_TO_DEVICE); | 5673 | DMA_TO_DEVICE); |
5674 | dma_unmap_len_set(tx_buffer, len, 0); | 5674 | dma_unmap_len_set(tx_buffer, len, 0); |
5675 | 5675 | ||
5676 | if (i--) | 5676 | if (i-- == 0) |
5677 | i += tx_ring->count; | 5677 | i += tx_ring->count; |
5678 | tx_buffer = &tx_ring->tx_buffer_info[i]; | 5678 | tx_buffer = &tx_ring->tx_buffer_info[i]; |
5679 | } | 5679 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 7f503d35eb1c..38bd2e339e48 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -8156,29 +8156,23 @@ static int ixgbe_tx_map(struct ixgbe_ring *tx_ring, | |||
8156 | return 0; | 8156 | return 0; |
8157 | dma_error: | 8157 | dma_error: |
8158 | dev_err(tx_ring->dev, "TX DMA map failed\n"); | 8158 | dev_err(tx_ring->dev, "TX DMA map failed\n"); |
8159 | tx_buffer = &tx_ring->tx_buffer_info[i]; | ||
8160 | 8159 | ||
8161 | /* clear dma mappings for failed tx_buffer_info map */ | 8160 | /* clear dma mappings for failed tx_buffer_info map */ |
8162 | while (tx_buffer != first) { | 8161 | for (;;) { |
8162 | tx_buffer = &tx_ring->tx_buffer_info[i]; | ||
8163 | if (dma_unmap_len(tx_buffer, len)) | 8163 | if (dma_unmap_len(tx_buffer, len)) |
8164 | dma_unmap_page(tx_ring->dev, | 8164 | dma_unmap_page(tx_ring->dev, |
8165 | dma_unmap_addr(tx_buffer, dma), | 8165 | dma_unmap_addr(tx_buffer, dma), |
8166 | dma_unmap_len(tx_buffer, len), | 8166 | dma_unmap_len(tx_buffer, len), |
8167 | DMA_TO_DEVICE); | 8167 | DMA_TO_DEVICE); |
8168 | dma_unmap_len_set(tx_buffer, len, 0); | 8168 | dma_unmap_len_set(tx_buffer, len, 0); |
8169 | 8169 | if (tx_buffer == first) | |
8170 | if (i--) | 8170 | break; |
8171 | if (i == 0) | ||
8171 | i += tx_ring->count; | 8172 | i += tx_ring->count; |
8172 | tx_buffer = &tx_ring->tx_buffer_info[i]; | 8173 | i--; |
8173 | } | 8174 | } |
8174 | 8175 | ||
8175 | if (dma_unmap_len(tx_buffer, len)) | ||
8176 | dma_unmap_single(tx_ring->dev, | ||
8177 | dma_unmap_addr(tx_buffer, dma), | ||
8178 | dma_unmap_len(tx_buffer, len), | ||
8179 | DMA_TO_DEVICE); | ||
8180 | dma_unmap_len_set(tx_buffer, len, 0); | ||
8181 | |||
8182 | dev_kfree_skb_any(first->skb); | 8176 | dev_kfree_skb_any(first->skb); |
8183 | first->skb = NULL; | 8177 | first->skb = NULL; |
8184 | 8178 | ||
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index 97efe4733661..794a3b6aa573 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c | |||
@@ -1167,6 +1167,11 @@ struct mvpp2_bm_pool { | |||
1167 | u32 port_map; | 1167 | u32 port_map; |
1168 | }; | 1168 | }; |
1169 | 1169 | ||
1170 | #define IS_TSO_HEADER(txq_pcpu, addr) \ | ||
1171 | ((addr) >= (txq_pcpu)->tso_headers_dma && \ | ||
1172 | (addr) < (txq_pcpu)->tso_headers_dma + \ | ||
1173 | (txq_pcpu)->size * TSO_HEADER_SIZE) | ||
1174 | |||
1170 | /* Queue modes */ | 1175 | /* Queue modes */ |
1171 | #define MVPP2_QDIST_SINGLE_MODE 0 | 1176 | #define MVPP2_QDIST_SINGLE_MODE 0 |
1172 | #define MVPP2_QDIST_MULTI_MODE 1 | 1177 | #define MVPP2_QDIST_MULTI_MODE 1 |
@@ -1534,7 +1539,7 @@ static bool mvpp2_prs_tcam_data_cmp(struct mvpp2_prs_entry *pe, int offs, | |||
1534 | int off = MVPP2_PRS_TCAM_DATA_BYTE(offs); | 1539 | int off = MVPP2_PRS_TCAM_DATA_BYTE(offs); |
1535 | u16 tcam_data; | 1540 | u16 tcam_data; |
1536 | 1541 | ||
1537 | tcam_data = (8 << pe->tcam.byte[off + 1]) | pe->tcam.byte[off]; | 1542 | tcam_data = (pe->tcam.byte[off + 1] << 8) | pe->tcam.byte[off]; |
1538 | if (tcam_data != data) | 1543 | if (tcam_data != data) |
1539 | return false; | 1544 | return false; |
1540 | return true; | 1545 | return true; |
@@ -2609,8 +2614,8 @@ static void mvpp2_prs_mac_init(struct mvpp2 *priv) | |||
2609 | /* place holders only - no ports */ | 2614 | /* place holders only - no ports */ |
2610 | mvpp2_prs_mac_drop_all_set(priv, 0, false); | 2615 | mvpp2_prs_mac_drop_all_set(priv, 0, false); |
2611 | mvpp2_prs_mac_promisc_set(priv, 0, false); | 2616 | mvpp2_prs_mac_promisc_set(priv, 0, false); |
2612 | mvpp2_prs_mac_multi_set(priv, MVPP2_PE_MAC_MC_ALL, 0, false); | 2617 | mvpp2_prs_mac_multi_set(priv, 0, MVPP2_PE_MAC_MC_ALL, false); |
2613 | mvpp2_prs_mac_multi_set(priv, MVPP2_PE_MAC_MC_IP6, 0, false); | 2618 | mvpp2_prs_mac_multi_set(priv, 0, MVPP2_PE_MAC_MC_IP6, false); |
2614 | } | 2619 | } |
2615 | 2620 | ||
2616 | /* Set default entries for various types of dsa packets */ | 2621 | /* Set default entries for various types of dsa packets */ |
@@ -3391,7 +3396,7 @@ mvpp2_prs_mac_da_range_find(struct mvpp2 *priv, int pmap, const u8 *da, | |||
3391 | struct mvpp2_prs_entry *pe; | 3396 | struct mvpp2_prs_entry *pe; |
3392 | int tid; | 3397 | int tid; |
3393 | 3398 | ||
3394 | pe = kzalloc(sizeof(*pe), GFP_KERNEL); | 3399 | pe = kzalloc(sizeof(*pe), GFP_ATOMIC); |
3395 | if (!pe) | 3400 | if (!pe) |
3396 | return NULL; | 3401 | return NULL; |
3397 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC); | 3402 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC); |
@@ -3453,7 +3458,7 @@ static int mvpp2_prs_mac_da_accept(struct mvpp2 *priv, int port, | |||
3453 | if (tid < 0) | 3458 | if (tid < 0) |
3454 | return tid; | 3459 | return tid; |
3455 | 3460 | ||
3456 | pe = kzalloc(sizeof(*pe), GFP_KERNEL); | 3461 | pe = kzalloc(sizeof(*pe), GFP_ATOMIC); |
3457 | if (!pe) | 3462 | if (!pe) |
3458 | return -ENOMEM; | 3463 | return -ENOMEM; |
3459 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC); | 3464 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC); |
@@ -5321,8 +5326,9 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, | |||
5321 | struct mvpp2_txq_pcpu_buf *tx_buf = | 5326 | struct mvpp2_txq_pcpu_buf *tx_buf = |
5322 | txq_pcpu->buffs + txq_pcpu->txq_get_index; | 5327 | txq_pcpu->buffs + txq_pcpu->txq_get_index; |
5323 | 5328 | ||
5324 | dma_unmap_single(port->dev->dev.parent, tx_buf->dma, | 5329 | if (!IS_TSO_HEADER(txq_pcpu, tx_buf->dma)) |
5325 | tx_buf->size, DMA_TO_DEVICE); | 5330 | dma_unmap_single(port->dev->dev.parent, tx_buf->dma, |
5331 | tx_buf->size, DMA_TO_DEVICE); | ||
5326 | if (tx_buf->skb) | 5332 | if (tx_buf->skb) |
5327 | dev_kfree_skb_any(tx_buf->skb); | 5333 | dev_kfree_skb_any(tx_buf->skb); |
5328 | 5334 | ||
@@ -5609,7 +5615,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port, | |||
5609 | 5615 | ||
5610 | txq_pcpu->tso_headers = | 5616 | txq_pcpu->tso_headers = |
5611 | dma_alloc_coherent(port->dev->dev.parent, | 5617 | dma_alloc_coherent(port->dev->dev.parent, |
5612 | MVPP2_AGGR_TXQ_SIZE * TSO_HEADER_SIZE, | 5618 | txq_pcpu->size * TSO_HEADER_SIZE, |
5613 | &txq_pcpu->tso_headers_dma, | 5619 | &txq_pcpu->tso_headers_dma, |
5614 | GFP_KERNEL); | 5620 | GFP_KERNEL); |
5615 | if (!txq_pcpu->tso_headers) | 5621 | if (!txq_pcpu->tso_headers) |
@@ -5623,7 +5629,7 @@ cleanup: | |||
5623 | kfree(txq_pcpu->buffs); | 5629 | kfree(txq_pcpu->buffs); |
5624 | 5630 | ||
5625 | dma_free_coherent(port->dev->dev.parent, | 5631 | dma_free_coherent(port->dev->dev.parent, |
5626 | MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE, | 5632 | txq_pcpu->size * TSO_HEADER_SIZE, |
5627 | txq_pcpu->tso_headers, | 5633 | txq_pcpu->tso_headers, |
5628 | txq_pcpu->tso_headers_dma); | 5634 | txq_pcpu->tso_headers_dma); |
5629 | } | 5635 | } |
@@ -5647,7 +5653,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, | |||
5647 | kfree(txq_pcpu->buffs); | 5653 | kfree(txq_pcpu->buffs); |
5648 | 5654 | ||
5649 | dma_free_coherent(port->dev->dev.parent, | 5655 | dma_free_coherent(port->dev->dev.parent, |
5650 | MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE, | 5656 | txq_pcpu->size * TSO_HEADER_SIZE, |
5651 | txq_pcpu->tso_headers, | 5657 | txq_pcpu->tso_headers, |
5652 | txq_pcpu->tso_headers_dma); | 5658 | txq_pcpu->tso_headers_dma); |
5653 | } | 5659 | } |
@@ -6212,12 +6218,15 @@ static inline void | |||
6212 | tx_desc_unmap_put(struct mvpp2_port *port, struct mvpp2_tx_queue *txq, | 6218 | tx_desc_unmap_put(struct mvpp2_port *port, struct mvpp2_tx_queue *txq, |
6213 | struct mvpp2_tx_desc *desc) | 6219 | struct mvpp2_tx_desc *desc) |
6214 | { | 6220 | { |
6221 | struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu); | ||
6222 | |||
6215 | dma_addr_t buf_dma_addr = | 6223 | dma_addr_t buf_dma_addr = |
6216 | mvpp2_txdesc_dma_addr_get(port, desc); | 6224 | mvpp2_txdesc_dma_addr_get(port, desc); |
6217 | size_t buf_sz = | 6225 | size_t buf_sz = |
6218 | mvpp2_txdesc_size_get(port, desc); | 6226 | mvpp2_txdesc_size_get(port, desc); |
6219 | dma_unmap_single(port->dev->dev.parent, buf_dma_addr, | 6227 | if (!IS_TSO_HEADER(txq_pcpu, buf_dma_addr)) |
6220 | buf_sz, DMA_TO_DEVICE); | 6228 | dma_unmap_single(port->dev->dev.parent, buf_dma_addr, |
6229 | buf_sz, DMA_TO_DEVICE); | ||
6221 | mvpp2_txq_desc_put(txq); | 6230 | mvpp2_txq_desc_put(txq); |
6222 | } | 6231 | } |
6223 | 6232 | ||
@@ -6489,7 +6498,7 @@ out: | |||
6489 | } | 6498 | } |
6490 | 6499 | ||
6491 | /* Finalize TX processing */ | 6500 | /* Finalize TX processing */ |
6492 | if (txq_pcpu->count >= txq->done_pkts_coal) | 6501 | if (!port->has_tx_irqs && txq_pcpu->count >= txq->done_pkts_coal) |
6493 | mvpp2_txq_done(port, txq, txq_pcpu); | 6502 | mvpp2_txq_done(port, txq, txq_pcpu); |
6494 | 6503 | ||
6495 | /* Set the timer in case not all frags were processed */ | 6504 | /* Set the timer in case not all frags were processed */ |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c index ff60cf7342ca..fc281712869b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c | |||
@@ -77,35 +77,41 @@ static void add_delayed_event(struct mlx5_priv *priv, | |||
77 | list_add_tail(&delayed_event->list, &priv->waiting_events_list); | 77 | list_add_tail(&delayed_event->list, &priv->waiting_events_list); |
78 | } | 78 | } |
79 | 79 | ||
80 | static void fire_delayed_event_locked(struct mlx5_device_context *dev_ctx, | 80 | static void delayed_event_release(struct mlx5_device_context *dev_ctx, |
81 | struct mlx5_core_dev *dev, | 81 | struct mlx5_priv *priv) |
82 | struct mlx5_priv *priv) | ||
83 | { | 82 | { |
83 | struct mlx5_core_dev *dev = container_of(priv, struct mlx5_core_dev, priv); | ||
84 | struct mlx5_delayed_event *de; | 84 | struct mlx5_delayed_event *de; |
85 | struct mlx5_delayed_event *n; | 85 | struct mlx5_delayed_event *n; |
86 | struct list_head temp; | ||
86 | 87 | ||
87 | /* stop delaying events */ | 88 | INIT_LIST_HEAD(&temp); |
88 | priv->is_accum_events = false; | 89 | |
90 | spin_lock_irq(&priv->ctx_lock); | ||
89 | 91 | ||
90 | /* fire all accumulated events before new event comes */ | 92 | priv->is_accum_events = false; |
91 | list_for_each_entry_safe(de, n, &priv->waiting_events_list, list) { | 93 | list_splice_init(&priv->waiting_events_list, &temp); |
94 | if (!dev_ctx->context) | ||
95 | goto out; | ||
96 | list_for_each_entry_safe(de, n, &priv->waiting_events_list, list) | ||
92 | dev_ctx->intf->event(dev, dev_ctx->context, de->event, de->param); | 97 | dev_ctx->intf->event(dev, dev_ctx->context, de->event, de->param); |
98 | |||
99 | out: | ||
100 | spin_unlock_irq(&priv->ctx_lock); | ||
101 | |||
102 | list_for_each_entry_safe(de, n, &temp, list) { | ||
93 | list_del(&de->list); | 103 | list_del(&de->list); |
94 | kfree(de); | 104 | kfree(de); |
95 | } | 105 | } |
96 | } | 106 | } |
97 | 107 | ||
98 | static void cleanup_delayed_evets(struct mlx5_priv *priv) | 108 | /* accumulating events that can come after mlx5_ib calls to |
109 | * ib_register_device, till adding that interface to the events list. | ||
110 | */ | ||
111 | static void delayed_event_start(struct mlx5_priv *priv) | ||
99 | { | 112 | { |
100 | struct mlx5_delayed_event *de; | ||
101 | struct mlx5_delayed_event *n; | ||
102 | |||
103 | spin_lock_irq(&priv->ctx_lock); | 113 | spin_lock_irq(&priv->ctx_lock); |
104 | priv->is_accum_events = false; | 114 | priv->is_accum_events = true; |
105 | list_for_each_entry_safe(de, n, &priv->waiting_events_list, list) { | ||
106 | list_del(&de->list); | ||
107 | kfree(de); | ||
108 | } | ||
109 | spin_unlock_irq(&priv->ctx_lock); | 115 | spin_unlock_irq(&priv->ctx_lock); |
110 | } | 116 | } |
111 | 117 | ||
@@ -122,11 +128,8 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) | |||
122 | return; | 128 | return; |
123 | 129 | ||
124 | dev_ctx->intf = intf; | 130 | dev_ctx->intf = intf; |
125 | /* accumulating events that can come after mlx5_ib calls to | ||
126 | * ib_register_device, till adding that interface to the events list. | ||
127 | */ | ||
128 | 131 | ||
129 | priv->is_accum_events = true; | 132 | delayed_event_start(priv); |
130 | 133 | ||
131 | dev_ctx->context = intf->add(dev); | 134 | dev_ctx->context = intf->add(dev); |
132 | set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); | 135 | set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); |
@@ -137,8 +140,6 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) | |||
137 | spin_lock_irq(&priv->ctx_lock); | 140 | spin_lock_irq(&priv->ctx_lock); |
138 | list_add_tail(&dev_ctx->list, &priv->ctx_list); | 141 | list_add_tail(&dev_ctx->list, &priv->ctx_list); |
139 | 142 | ||
140 | fire_delayed_event_locked(dev_ctx, dev, priv); | ||
141 | |||
142 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING | 143 | #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING |
143 | if (dev_ctx->intf->pfault) { | 144 | if (dev_ctx->intf->pfault) { |
144 | if (priv->pfault) { | 145 | if (priv->pfault) { |
@@ -150,11 +151,12 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv) | |||
150 | } | 151 | } |
151 | #endif | 152 | #endif |
152 | spin_unlock_irq(&priv->ctx_lock); | 153 | spin_unlock_irq(&priv->ctx_lock); |
153 | } else { | ||
154 | kfree(dev_ctx); | ||
155 | /* delete all accumulated events */ | ||
156 | cleanup_delayed_evets(priv); | ||
157 | } | 154 | } |
155 | |||
156 | delayed_event_release(dev_ctx, priv); | ||
157 | |||
158 | if (!dev_ctx->context) | ||
159 | kfree(dev_ctx); | ||
158 | } | 160 | } |
159 | 161 | ||
160 | static struct mlx5_device_context *mlx5_get_device(struct mlx5_interface *intf, | 162 | static struct mlx5_device_context *mlx5_get_device(struct mlx5_interface *intf, |
@@ -205,17 +207,21 @@ static void mlx5_attach_interface(struct mlx5_interface *intf, struct mlx5_priv | |||
205 | if (!dev_ctx) | 207 | if (!dev_ctx) |
206 | return; | 208 | return; |
207 | 209 | ||
210 | delayed_event_start(priv); | ||
208 | if (intf->attach) { | 211 | if (intf->attach) { |
209 | if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state)) | 212 | if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state)) |
210 | return; | 213 | goto out; |
211 | intf->attach(dev, dev_ctx->context); | 214 | intf->attach(dev, dev_ctx->context); |
212 | set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state); | 215 | set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state); |
213 | } else { | 216 | } else { |
214 | if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state)) | 217 | if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state)) |
215 | return; | 218 | goto out; |
216 | dev_ctx->context = intf->add(dev); | 219 | dev_ctx->context = intf->add(dev); |
217 | set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); | 220 | set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); |
218 | } | 221 | } |
222 | |||
223 | out: | ||
224 | delayed_event_release(dev_ctx, priv); | ||
219 | } | 225 | } |
220 | 226 | ||
221 | void mlx5_attach_device(struct mlx5_core_dev *dev) | 227 | void mlx5_attach_device(struct mlx5_core_dev *dev) |
@@ -414,8 +420,14 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event, | |||
414 | if (priv->is_accum_events) | 420 | if (priv->is_accum_events) |
415 | add_delayed_event(priv, dev, event, param); | 421 | add_delayed_event(priv, dev, event, param); |
416 | 422 | ||
423 | /* After mlx5_detach_device, the dev_ctx->intf is still set and dev_ctx is | ||
424 | * still in priv->ctx_list. In this case, only notify the dev_ctx if its | ||
425 | * ADDED or ATTACHED bit are set. | ||
426 | */ | ||
417 | list_for_each_entry(dev_ctx, &priv->ctx_list, list) | 427 | list_for_each_entry(dev_ctx, &priv->ctx_list, list) |
418 | if (dev_ctx->intf->event) | 428 | if (dev_ctx->intf->event && |
429 | (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state) || | ||
430 | test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state))) | ||
419 | dev_ctx->intf->event(dev, dev_ctx->context, event, param); | 431 | dev_ctx->intf->event(dev, dev_ctx->context, event, param); |
420 | 432 | ||
421 | spin_unlock_irqrestore(&priv->ctx_lock, flags); | 433 | spin_unlock_irqrestore(&priv->ctx_lock, flags); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c index c1d384fca4dc..51c4cc00a186 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | |||
@@ -41,6 +41,11 @@ | |||
41 | #define MLX5E_CEE_STATE_UP 1 | 41 | #define MLX5E_CEE_STATE_UP 1 |
42 | #define MLX5E_CEE_STATE_DOWN 0 | 42 | #define MLX5E_CEE_STATE_DOWN 0 |
43 | 43 | ||
44 | enum { | ||
45 | MLX5E_VENDOR_TC_GROUP_NUM = 7, | ||
46 | MLX5E_LOWEST_PRIO_GROUP = 0, | ||
47 | }; | ||
48 | |||
44 | /* If dcbx mode is non-host set the dcbx mode to host. | 49 | /* If dcbx mode is non-host set the dcbx mode to host. |
45 | */ | 50 | */ |
46 | static int mlx5e_dcbnl_set_dcbx_mode(struct mlx5e_priv *priv, | 51 | static int mlx5e_dcbnl_set_dcbx_mode(struct mlx5e_priv *priv, |
@@ -85,6 +90,9 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev, | |||
85 | { | 90 | { |
86 | struct mlx5e_priv *priv = netdev_priv(netdev); | 91 | struct mlx5e_priv *priv = netdev_priv(netdev); |
87 | struct mlx5_core_dev *mdev = priv->mdev; | 92 | struct mlx5_core_dev *mdev = priv->mdev; |
93 | u8 tc_group[IEEE_8021QAZ_MAX_TCS]; | ||
94 | bool is_tc_group_6_exist = false; | ||
95 | bool is_zero_bw_ets_tc = false; | ||
88 | int err = 0; | 96 | int err = 0; |
89 | int i; | 97 | int i; |
90 | 98 | ||
@@ -96,37 +104,64 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev, | |||
96 | err = mlx5_query_port_prio_tc(mdev, i, &ets->prio_tc[i]); | 104 | err = mlx5_query_port_prio_tc(mdev, i, &ets->prio_tc[i]); |
97 | if (err) | 105 | if (err) |
98 | return err; | 106 | return err; |
99 | } | ||
100 | 107 | ||
101 | for (i = 0; i < ets->ets_cap; i++) { | 108 | err = mlx5_query_port_tc_group(mdev, i, &tc_group[i]); |
109 | if (err) | ||
110 | return err; | ||
111 | |||
102 | err = mlx5_query_port_tc_bw_alloc(mdev, i, &ets->tc_tx_bw[i]); | 112 | err = mlx5_query_port_tc_bw_alloc(mdev, i, &ets->tc_tx_bw[i]); |
103 | if (err) | 113 | if (err) |
104 | return err; | 114 | return err; |
115 | |||
116 | if (ets->tc_tx_bw[i] < MLX5E_MAX_BW_ALLOC && | ||
117 | tc_group[i] == (MLX5E_LOWEST_PRIO_GROUP + 1)) | ||
118 | is_zero_bw_ets_tc = true; | ||
119 | |||
120 | if (tc_group[i] == (MLX5E_VENDOR_TC_GROUP_NUM - 1)) | ||
121 | is_tc_group_6_exist = true; | ||
122 | } | ||
123 | |||
124 | /* Report 0% ets tc if exits*/ | ||
125 | if (is_zero_bw_ets_tc) { | ||
126 | for (i = 0; i < ets->ets_cap; i++) | ||
127 | if (tc_group[i] == MLX5E_LOWEST_PRIO_GROUP) | ||
128 | ets->tc_tx_bw[i] = 0; | ||
129 | } | ||
130 | |||
131 | /* Update tc_tsa based on fw setting*/ | ||
132 | for (i = 0; i < ets->ets_cap; i++) { | ||
105 | if (ets->tc_tx_bw[i] < MLX5E_MAX_BW_ALLOC) | 133 | if (ets->tc_tx_bw[i] < MLX5E_MAX_BW_ALLOC) |
106 | priv->dcbx.tc_tsa[i] = IEEE_8021QAZ_TSA_ETS; | 134 | priv->dcbx.tc_tsa[i] = IEEE_8021QAZ_TSA_ETS; |
135 | else if (tc_group[i] == MLX5E_VENDOR_TC_GROUP_NUM && | ||
136 | !is_tc_group_6_exist) | ||
137 | priv->dcbx.tc_tsa[i] = IEEE_8021QAZ_TSA_VENDOR; | ||
107 | } | 138 | } |
108 | |||
109 | memcpy(ets->tc_tsa, priv->dcbx.tc_tsa, sizeof(ets->tc_tsa)); | 139 | memcpy(ets->tc_tsa, priv->dcbx.tc_tsa, sizeof(ets->tc_tsa)); |
110 | 140 | ||
111 | return err; | 141 | return err; |
112 | } | 142 | } |
113 | 143 | ||
114 | enum { | ||
115 | MLX5E_VENDOR_TC_GROUP_NUM = 7, | ||
116 | MLX5E_ETS_TC_GROUP_NUM = 0, | ||
117 | }; | ||
118 | |||
119 | static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc) | 144 | static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc) |
120 | { | 145 | { |
121 | bool any_tc_mapped_to_ets = false; | 146 | bool any_tc_mapped_to_ets = false; |
147 | bool ets_zero_bw = false; | ||
122 | int strict_group; | 148 | int strict_group; |
123 | int i; | 149 | int i; |
124 | 150 | ||
125 | for (i = 0; i <= max_tc; i++) | 151 | for (i = 0; i <= max_tc; i++) { |
126 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) | 152 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { |
127 | any_tc_mapped_to_ets = true; | 153 | any_tc_mapped_to_ets = true; |
154 | if (!ets->tc_tx_bw[i]) | ||
155 | ets_zero_bw = true; | ||
156 | } | ||
157 | } | ||
128 | 158 | ||
129 | strict_group = any_tc_mapped_to_ets ? 1 : 0; | 159 | /* strict group has higher priority than ets group */ |
160 | strict_group = MLX5E_LOWEST_PRIO_GROUP; | ||
161 | if (any_tc_mapped_to_ets) | ||
162 | strict_group++; | ||
163 | if (ets_zero_bw) | ||
164 | strict_group++; | ||
130 | 165 | ||
131 | for (i = 0; i <= max_tc; i++) { | 166 | for (i = 0; i <= max_tc; i++) { |
132 | switch (ets->tc_tsa[i]) { | 167 | switch (ets->tc_tsa[i]) { |
@@ -137,7 +172,9 @@ static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc) | |||
137 | tc_group[i] = strict_group++; | 172 | tc_group[i] = strict_group++; |
138 | break; | 173 | break; |
139 | case IEEE_8021QAZ_TSA_ETS: | 174 | case IEEE_8021QAZ_TSA_ETS: |
140 | tc_group[i] = MLX5E_ETS_TC_GROUP_NUM; | 175 | tc_group[i] = MLX5E_LOWEST_PRIO_GROUP; |
176 | if (ets->tc_tx_bw[i] && ets_zero_bw) | ||
177 | tc_group[i] = MLX5E_LOWEST_PRIO_GROUP + 1; | ||
141 | break; | 178 | break; |
142 | } | 179 | } |
143 | } | 180 | } |
@@ -146,9 +183,23 @@ static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc) | |||
146 | static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw, | 183 | static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw, |
147 | u8 *tc_group, int max_tc) | 184 | u8 *tc_group, int max_tc) |
148 | { | 185 | { |
186 | int bw_for_ets_zero_bw_tc = 0; | ||
187 | int last_ets_zero_bw_tc = -1; | ||
188 | int num_ets_zero_bw = 0; | ||
149 | int i; | 189 | int i; |
150 | 190 | ||
151 | for (i = 0; i <= max_tc; i++) { | 191 | for (i = 0; i <= max_tc; i++) { |
192 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS && | ||
193 | !ets->tc_tx_bw[i]) { | ||
194 | num_ets_zero_bw++; | ||
195 | last_ets_zero_bw_tc = i; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | if (num_ets_zero_bw) | ||
200 | bw_for_ets_zero_bw_tc = MLX5E_MAX_BW_ALLOC / num_ets_zero_bw; | ||
201 | |||
202 | for (i = 0; i <= max_tc; i++) { | ||
152 | switch (ets->tc_tsa[i]) { | 203 | switch (ets->tc_tsa[i]) { |
153 | case IEEE_8021QAZ_TSA_VENDOR: | 204 | case IEEE_8021QAZ_TSA_VENDOR: |
154 | tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; | 205 | tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; |
@@ -157,12 +208,26 @@ static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw, | |||
157 | tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; | 208 | tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; |
158 | break; | 209 | break; |
159 | case IEEE_8021QAZ_TSA_ETS: | 210 | case IEEE_8021QAZ_TSA_ETS: |
160 | tc_tx_bw[i] = ets->tc_tx_bw[i]; | 211 | tc_tx_bw[i] = ets->tc_tx_bw[i] ? |
212 | ets->tc_tx_bw[i] : | ||
213 | bw_for_ets_zero_bw_tc; | ||
161 | break; | 214 | break; |
162 | } | 215 | } |
163 | } | 216 | } |
217 | |||
218 | /* Make sure the total bw for ets zero bw group is 100% */ | ||
219 | if (last_ets_zero_bw_tc != -1) | ||
220 | tc_tx_bw[last_ets_zero_bw_tc] += | ||
221 | MLX5E_MAX_BW_ALLOC % num_ets_zero_bw; | ||
164 | } | 222 | } |
165 | 223 | ||
224 | /* If there are ETS BW 0, | ||
225 | * Set ETS group # to 1 for all ETS non zero BW tcs. Their sum must be 100%. | ||
226 | * Set group #0 to all the ETS BW 0 tcs and | ||
227 | * equally splits the 100% BW between them | ||
228 | * Report both group #0 and #1 as ETS type. | ||
229 | * All the tcs in group #0 will be reported with 0% BW. | ||
230 | */ | ||
166 | int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) | 231 | int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) |
167 | { | 232 | { |
168 | struct mlx5_core_dev *mdev = priv->mdev; | 233 | struct mlx5_core_dev *mdev = priv->mdev; |
@@ -188,7 +253,6 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) | |||
188 | return err; | 253 | return err; |
189 | 254 | ||
190 | memcpy(priv->dcbx.tc_tsa, ets->tc_tsa, sizeof(ets->tc_tsa)); | 255 | memcpy(priv->dcbx.tc_tsa, ets->tc_tsa, sizeof(ets->tc_tsa)); |
191 | |||
192 | return err; | 256 | return err; |
193 | } | 257 | } |
194 | 258 | ||
@@ -209,17 +273,9 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev, | |||
209 | } | 273 | } |
210 | 274 | ||
211 | /* Validate Bandwidth Sum */ | 275 | /* Validate Bandwidth Sum */ |
212 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { | 276 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) |
213 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { | 277 | if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) |
214 | if (!ets->tc_tx_bw[i]) { | ||
215 | netdev_err(netdev, | ||
216 | "Failed to validate ETS: BW 0 is illegal\n"); | ||
217 | return -EINVAL; | ||
218 | } | ||
219 | |||
220 | bw_sum += ets->tc_tx_bw[i]; | 278 | bw_sum += ets->tc_tx_bw[i]; |
221 | } | ||
222 | } | ||
223 | 279 | ||
224 | if (bw_sum != 0 && bw_sum != 100) { | 280 | if (bw_sum != 0 && bw_sum != 100) { |
225 | netdev_err(netdev, | 281 | netdev_err(netdev, |
@@ -533,8 +589,7 @@ static void mlx5e_dcbnl_getpgtccfgtx(struct net_device *netdev, | |||
533 | static void mlx5e_dcbnl_getpgbwgcfgtx(struct net_device *netdev, | 589 | static void mlx5e_dcbnl_getpgbwgcfgtx(struct net_device *netdev, |
534 | int pgid, u8 *bw_pct) | 590 | int pgid, u8 *bw_pct) |
535 | { | 591 | { |
536 | struct mlx5e_priv *priv = netdev_priv(netdev); | 592 | struct ieee_ets ets; |
537 | struct mlx5_core_dev *mdev = priv->mdev; | ||
538 | 593 | ||
539 | if (pgid >= CEE_DCBX_MAX_PGS) { | 594 | if (pgid >= CEE_DCBX_MAX_PGS) { |
540 | netdev_err(netdev, | 595 | netdev_err(netdev, |
@@ -542,8 +597,8 @@ static void mlx5e_dcbnl_getpgbwgcfgtx(struct net_device *netdev, | |||
542 | return; | 597 | return; |
543 | } | 598 | } |
544 | 599 | ||
545 | if (mlx5_query_port_tc_bw_alloc(mdev, pgid, bw_pct)) | 600 | mlx5e_dcbnl_ieee_getets(netdev, &ets); |
546 | *bw_pct = 0; | 601 | *bw_pct = ets.tc_tx_bw[pgid]; |
547 | } | 602 | } |
548 | 603 | ||
549 | static void mlx5e_dcbnl_setpfccfg(struct net_device *netdev, | 604 | static void mlx5e_dcbnl_setpfccfg(struct net_device *netdev, |
@@ -739,8 +794,6 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv) | |||
739 | ets.prio_tc[i] = i; | 794 | ets.prio_tc[i] = i; |
740 | } | 795 | } |
741 | 796 | ||
742 | memcpy(priv->dcbx.tc_tsa, ets.tc_tsa, sizeof(ets.tc_tsa)); | ||
743 | |||
744 | /* tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1) */ | 797 | /* tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1) */ |
745 | ets.prio_tc[0] = 1; | 798 | ets.prio_tc[0] = 1; |
746 | ets.prio_tc[1] = 0; | 799 | ets.prio_tc[1] = 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 1aa2028ed995..9ba1f72060aa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
@@ -78,9 +78,11 @@ struct mlx5e_tc_flow { | |||
78 | }; | 78 | }; |
79 | 79 | ||
80 | struct mlx5e_tc_flow_parse_attr { | 80 | struct mlx5e_tc_flow_parse_attr { |
81 | struct ip_tunnel_info tun_info; | ||
81 | struct mlx5_flow_spec spec; | 82 | struct mlx5_flow_spec spec; |
82 | int num_mod_hdr_actions; | 83 | int num_mod_hdr_actions; |
83 | void *mod_hdr_actions; | 84 | void *mod_hdr_actions; |
85 | int mirred_ifindex; | ||
84 | }; | 86 | }; |
85 | 87 | ||
86 | enum { | 88 | enum { |
@@ -322,6 +324,12 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv, | |||
322 | static void mlx5e_detach_encap(struct mlx5e_priv *priv, | 324 | static void mlx5e_detach_encap(struct mlx5e_priv *priv, |
323 | struct mlx5e_tc_flow *flow); | 325 | struct mlx5e_tc_flow *flow); |
324 | 326 | ||
327 | static int mlx5e_attach_encap(struct mlx5e_priv *priv, | ||
328 | struct ip_tunnel_info *tun_info, | ||
329 | struct net_device *mirred_dev, | ||
330 | struct net_device **encap_dev, | ||
331 | struct mlx5e_tc_flow *flow); | ||
332 | |||
325 | static struct mlx5_flow_handle * | 333 | static struct mlx5_flow_handle * |
326 | mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, | 334 | mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, |
327 | struct mlx5e_tc_flow_parse_attr *parse_attr, | 335 | struct mlx5e_tc_flow_parse_attr *parse_attr, |
@@ -329,9 +337,27 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, | |||
329 | { | 337 | { |
330 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | 338 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
331 | struct mlx5_esw_flow_attr *attr = flow->esw_attr; | 339 | struct mlx5_esw_flow_attr *attr = flow->esw_attr; |
332 | struct mlx5_flow_handle *rule; | 340 | struct net_device *out_dev, *encap_dev = NULL; |
341 | struct mlx5_flow_handle *rule = NULL; | ||
342 | struct mlx5e_rep_priv *rpriv; | ||
343 | struct mlx5e_priv *out_priv; | ||
333 | int err; | 344 | int err; |
334 | 345 | ||
346 | if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) { | ||
347 | out_dev = __dev_get_by_index(dev_net(priv->netdev), | ||
348 | attr->parse_attr->mirred_ifindex); | ||
349 | err = mlx5e_attach_encap(priv, &parse_attr->tun_info, | ||
350 | out_dev, &encap_dev, flow); | ||
351 | if (err) { | ||
352 | rule = ERR_PTR(err); | ||
353 | if (err != -EAGAIN) | ||
354 | goto err_attach_encap; | ||
355 | } | ||
356 | out_priv = netdev_priv(encap_dev); | ||
357 | rpriv = out_priv->ppriv; | ||
358 | attr->out_rep = rpriv->rep; | ||
359 | } | ||
360 | |||
335 | err = mlx5_eswitch_add_vlan_action(esw, attr); | 361 | err = mlx5_eswitch_add_vlan_action(esw, attr); |
336 | if (err) { | 362 | if (err) { |
337 | rule = ERR_PTR(err); | 363 | rule = ERR_PTR(err); |
@@ -347,10 +373,14 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, | |||
347 | } | 373 | } |
348 | } | 374 | } |
349 | 375 | ||
350 | rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr); | 376 | /* we get here if (1) there's no error (rule being null) or when |
351 | if (IS_ERR(rule)) | 377 | * (2) there's an encap action and we're on -EAGAIN (no valid neigh) |
352 | goto err_add_rule; | 378 | */ |
353 | 379 | if (rule != ERR_PTR(-EAGAIN)) { | |
380 | rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr); | ||
381 | if (IS_ERR(rule)) | ||
382 | goto err_add_rule; | ||
383 | } | ||
354 | return rule; | 384 | return rule; |
355 | 385 | ||
356 | err_add_rule: | 386 | err_add_rule: |
@@ -361,6 +391,7 @@ err_mod_hdr: | |||
361 | err_add_vlan: | 391 | err_add_vlan: |
362 | if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) | 392 | if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) |
363 | mlx5e_detach_encap(priv, flow); | 393 | mlx5e_detach_encap(priv, flow); |
394 | err_attach_encap: | ||
364 | return rule; | 395 | return rule; |
365 | } | 396 | } |
366 | 397 | ||
@@ -389,6 +420,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, | |||
389 | void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, | 420 | void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, |
390 | struct mlx5e_encap_entry *e) | 421 | struct mlx5e_encap_entry *e) |
391 | { | 422 | { |
423 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | ||
424 | struct mlx5_esw_flow_attr *esw_attr; | ||
392 | struct mlx5e_tc_flow *flow; | 425 | struct mlx5e_tc_flow *flow; |
393 | int err; | 426 | int err; |
394 | 427 | ||
@@ -404,10 +437,9 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, | |||
404 | mlx5e_rep_queue_neigh_stats_work(priv); | 437 | mlx5e_rep_queue_neigh_stats_work(priv); |
405 | 438 | ||
406 | list_for_each_entry(flow, &e->flows, encap) { | 439 | list_for_each_entry(flow, &e->flows, encap) { |
407 | flow->esw_attr->encap_id = e->encap_id; | 440 | esw_attr = flow->esw_attr; |
408 | flow->rule = mlx5e_tc_add_fdb_flow(priv, | 441 | esw_attr->encap_id = e->encap_id; |
409 | flow->esw_attr->parse_attr, | 442 | flow->rule = mlx5_eswitch_add_offloaded_rule(esw, &esw_attr->parse_attr->spec, esw_attr); |
410 | flow); | ||
411 | if (IS_ERR(flow->rule)) { | 443 | if (IS_ERR(flow->rule)) { |
412 | err = PTR_ERR(flow->rule); | 444 | err = PTR_ERR(flow->rule); |
413 | mlx5_core_warn(priv->mdev, "Failed to update cached encapsulation flow, %d\n", | 445 | mlx5_core_warn(priv->mdev, "Failed to update cached encapsulation flow, %d\n", |
@@ -421,15 +453,13 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, | |||
421 | void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, | 453 | void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, |
422 | struct mlx5e_encap_entry *e) | 454 | struct mlx5e_encap_entry *e) |
423 | { | 455 | { |
456 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | ||
424 | struct mlx5e_tc_flow *flow; | 457 | struct mlx5e_tc_flow *flow; |
425 | struct mlx5_fc *counter; | ||
426 | 458 | ||
427 | list_for_each_entry(flow, &e->flows, encap) { | 459 | list_for_each_entry(flow, &e->flows, encap) { |
428 | if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) { | 460 | if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) { |
429 | flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED; | 461 | flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED; |
430 | counter = mlx5_flow_rule_counter(flow->rule); | 462 | mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->esw_attr); |
431 | mlx5_del_flow_rules(flow->rule); | ||
432 | mlx5_fc_destroy(priv->mdev, counter); | ||
433 | } | 463 | } |
434 | } | 464 | } |
435 | 465 | ||
@@ -1942,7 +1972,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, | |||
1942 | 1972 | ||
1943 | if (is_tcf_mirred_egress_redirect(a)) { | 1973 | if (is_tcf_mirred_egress_redirect(a)) { |
1944 | int ifindex = tcf_mirred_ifindex(a); | 1974 | int ifindex = tcf_mirred_ifindex(a); |
1945 | struct net_device *out_dev, *encap_dev = NULL; | 1975 | struct net_device *out_dev; |
1946 | struct mlx5e_priv *out_priv; | 1976 | struct mlx5e_priv *out_priv; |
1947 | 1977 | ||
1948 | out_dev = __dev_get_by_index(dev_net(priv->netdev), ifindex); | 1978 | out_dev = __dev_get_by_index(dev_net(priv->netdev), ifindex); |
@@ -1955,17 +1985,13 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, | |||
1955 | rpriv = out_priv->ppriv; | 1985 | rpriv = out_priv->ppriv; |
1956 | attr->out_rep = rpriv->rep; | 1986 | attr->out_rep = rpriv->rep; |
1957 | } else if (encap) { | 1987 | } else if (encap) { |
1958 | err = mlx5e_attach_encap(priv, info, | 1988 | parse_attr->mirred_ifindex = ifindex; |
1959 | out_dev, &encap_dev, flow); | 1989 | parse_attr->tun_info = *info; |
1960 | if (err && err != -EAGAIN) | 1990 | attr->parse_attr = parse_attr; |
1961 | return err; | ||
1962 | attr->action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP | | 1991 | attr->action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP | |
1963 | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | | 1992 | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | |
1964 | MLX5_FLOW_CONTEXT_ACTION_COUNT; | 1993 | MLX5_FLOW_CONTEXT_ACTION_COUNT; |
1965 | out_priv = netdev_priv(encap_dev); | 1994 | /* attr->out_rep is resolved when we handle encap */ |
1966 | rpriv = out_priv->ppriv; | ||
1967 | attr->out_rep = rpriv->rep; | ||
1968 | attr->parse_attr = parse_attr; | ||
1969 | } else { | 1995 | } else { |
1970 | pr_err("devices %s %s not on same switch HW, can't offload forwarding\n", | 1996 | pr_err("devices %s %s not on same switch HW, can't offload forwarding\n", |
1971 | priv->netdev->name, out_dev->name); | 1997 | priv->netdev->name, out_dev->name); |
@@ -2047,7 +2073,7 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, | |||
2047 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { | 2073 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { |
2048 | err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow); | 2074 | err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow); |
2049 | if (err < 0) | 2075 | if (err < 0) |
2050 | goto err_handle_encap_flow; | 2076 | goto err_free; |
2051 | flow->rule = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow); | 2077 | flow->rule = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow); |
2052 | } else { | 2078 | } else { |
2053 | err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow); | 2079 | err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow); |
@@ -2058,10 +2084,13 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, | |||
2058 | 2084 | ||
2059 | if (IS_ERR(flow->rule)) { | 2085 | if (IS_ERR(flow->rule)) { |
2060 | err = PTR_ERR(flow->rule); | 2086 | err = PTR_ERR(flow->rule); |
2061 | goto err_free; | 2087 | if (err != -EAGAIN) |
2088 | goto err_free; | ||
2062 | } | 2089 | } |
2063 | 2090 | ||
2064 | flow->flags |= MLX5E_TC_FLOW_OFFLOADED; | 2091 | if (err != -EAGAIN) |
2092 | flow->flags |= MLX5E_TC_FLOW_OFFLOADED; | ||
2093 | |||
2065 | err = rhashtable_insert_fast(&tc->ht, &flow->node, | 2094 | err = rhashtable_insert_fast(&tc->ht, &flow->node, |
2066 | tc->ht_params); | 2095 | tc->ht_params); |
2067 | if (err) | 2096 | if (err) |
@@ -2075,16 +2104,6 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, | |||
2075 | err_del_rule: | 2104 | err_del_rule: |
2076 | mlx5e_tc_del_flow(priv, flow); | 2105 | mlx5e_tc_del_flow(priv, flow); |
2077 | 2106 | ||
2078 | err_handle_encap_flow: | ||
2079 | if (err == -EAGAIN) { | ||
2080 | err = rhashtable_insert_fast(&tc->ht, &flow->node, | ||
2081 | tc->ht_params); | ||
2082 | if (err) | ||
2083 | mlx5e_tc_del_flow(priv, flow); | ||
2084 | else | ||
2085 | return 0; | ||
2086 | } | ||
2087 | |||
2088 | err_free: | 2107 | err_free: |
2089 | kvfree(parse_attr); | 2108 | kvfree(parse_attr); |
2090 | kfree(flow); | 2109 | kfree(flow); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 185dcac0abe7..1a0e797ad001 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
@@ -354,10 +354,11 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev) | |||
354 | void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) | 354 | void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) |
355 | { | 355 | { |
356 | struct mlx5_core_health *health = &dev->priv.health; | 356 | struct mlx5_core_health *health = &dev->priv.health; |
357 | unsigned long flags; | ||
357 | 358 | ||
358 | spin_lock(&health->wq_lock); | 359 | spin_lock_irqsave(&health->wq_lock, flags); |
359 | set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); | 360 | set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); |
360 | spin_unlock(&health->wq_lock); | 361 | spin_unlock_irqrestore(&health->wq_lock, flags); |
361 | cancel_delayed_work_sync(&dev->priv.health.recover_work); | 362 | cancel_delayed_work_sync(&dev->priv.health.recover_work); |
362 | } | 363 | } |
363 | 364 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c index 1975d4388d4f..e07061f565d6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c | |||
@@ -677,6 +677,27 @@ int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, u8 *tc_group) | |||
677 | } | 677 | } |
678 | EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); | 678 | EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); |
679 | 679 | ||
680 | int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, | ||
681 | u8 tc, u8 *tc_group) | ||
682 | { | ||
683 | u32 out[MLX5_ST_SZ_DW(qetc_reg)]; | ||
684 | void *ets_tcn_conf; | ||
685 | int err; | ||
686 | |||
687 | err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out)); | ||
688 | if (err) | ||
689 | return err; | ||
690 | |||
691 | ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out, | ||
692 | tc_configuration[tc]); | ||
693 | |||
694 | *tc_group = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf, | ||
695 | group); | ||
696 | |||
697 | return 0; | ||
698 | } | ||
699 | EXPORT_SYMBOL_GPL(mlx5_query_port_tc_group); | ||
700 | |||
680 | int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw) | 701 | int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw) |
681 | { | 702 | { |
682 | u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {0}; | 703 | u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {0}; |
diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c index 0a5fc9f8545f..de64cedf8b26 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/action.c +++ b/drivers/net/ethernet/netronome/nfp/flower/action.c | |||
@@ -127,6 +127,8 @@ nfp_fl_output(struct nfp_fl_output *output, const struct tc_action *action, | |||
127 | */ | 127 | */ |
128 | if (!switchdev_port_same_parent_id(in_dev, out_dev)) | 128 | if (!switchdev_port_same_parent_id(in_dev, out_dev)) |
129 | return -EOPNOTSUPP; | 129 | return -EOPNOTSUPP; |
130 | if (!nfp_netdev_is_nfp_repr(out_dev)) | ||
131 | return -EOPNOTSUPP; | ||
130 | 132 | ||
131 | output->port = cpu_to_be32(nfp_repr_get_port_id(out_dev)); | 133 | output->port = cpu_to_be32(nfp_repr_get_port_id(out_dev)); |
132 | if (!output->port) | 134 | if (!output->port) |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index 5efef8001edf..3256e5cbad27 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | |||
@@ -74,7 +74,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, | |||
74 | plat_dat->axi->axi_wr_osr_lmt--; | 74 | plat_dat->axi->axi_wr_osr_lmt--; |
75 | } | 75 | } |
76 | 76 | ||
77 | if (of_property_read_u32(np, "read,read-requests", | 77 | if (of_property_read_u32(np, "snps,read-requests", |
78 | &plat_dat->axi->axi_rd_osr_lmt)) { | 78 | &plat_dat->axi->axi_rd_osr_lmt)) { |
79 | /** | 79 | /** |
80 | * Since the register has a reset value of 1, if property | 80 | * Since the register has a reset value of 1, if property |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 9e616da0745d..645ef949705f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
@@ -150,6 +150,13 @@ static void stmmac_mtl_setup(struct platform_device *pdev, | |||
150 | plat->rx_queues_to_use = 1; | 150 | plat->rx_queues_to_use = 1; |
151 | plat->tx_queues_to_use = 1; | 151 | plat->tx_queues_to_use = 1; |
152 | 152 | ||
153 | /* First Queue must always be in DCB mode. As MTL_QUEUE_DCB = 1 we need | ||
154 | * to always set this, otherwise Queue will be classified as AVB | ||
155 | * (because MTL_QUEUE_AVB = 0). | ||
156 | */ | ||
157 | plat->rx_queues_cfg[0].mode_to_use = MTL_QUEUE_DCB; | ||
158 | plat->tx_queues_cfg[0].mode_to_use = MTL_QUEUE_DCB; | ||
159 | |||
153 | rx_node = of_parse_phandle(pdev->dev.of_node, "snps,mtl-rx-config", 0); | 160 | rx_node = of_parse_phandle(pdev->dev.of_node, "snps,mtl-rx-config", 0); |
154 | if (!rx_node) | 161 | if (!rx_node) |
155 | return; | 162 | return; |
diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c index 5dea2063dbc8..0bcc07f346c3 100644 --- a/drivers/net/ipvlan/ipvtap.c +++ b/drivers/net/ipvlan/ipvtap.c | |||
@@ -197,8 +197,8 @@ static int ipvtap_init(void) | |||
197 | { | 197 | { |
198 | int err; | 198 | int err; |
199 | 199 | ||
200 | err = tap_create_cdev(&ipvtap_cdev, &ipvtap_major, "ipvtap"); | 200 | err = tap_create_cdev(&ipvtap_cdev, &ipvtap_major, "ipvtap", |
201 | 201 | THIS_MODULE); | |
202 | if (err) | 202 | if (err) |
203 | goto out1; | 203 | goto out1; |
204 | 204 | ||
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index f62aea2fcfa9..9a10029caf83 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -204,8 +204,8 @@ static int macvtap_init(void) | |||
204 | { | 204 | { |
205 | int err; | 205 | int err; |
206 | 206 | ||
207 | err = tap_create_cdev(&macvtap_cdev, &macvtap_major, "macvtap"); | 207 | err = tap_create_cdev(&macvtap_cdev, &macvtap_major, "macvtap", |
208 | 208 | THIS_MODULE); | |
209 | if (err) | 209 | if (err) |
210 | goto out1; | 210 | goto out1; |
211 | 211 | ||
diff --git a/drivers/net/tap.c b/drivers/net/tap.c index 21b71ae947fd..1b10fcc6a58d 100644 --- a/drivers/net/tap.c +++ b/drivers/net/tap.c | |||
@@ -517,6 +517,10 @@ static int tap_open(struct inode *inode, struct file *file) | |||
517 | &tap_proto, 0); | 517 | &tap_proto, 0); |
518 | if (!q) | 518 | if (!q) |
519 | goto err; | 519 | goto err; |
520 | if (skb_array_init(&q->skb_array, tap->dev->tx_queue_len, GFP_KERNEL)) { | ||
521 | sk_free(&q->sk); | ||
522 | goto err; | ||
523 | } | ||
520 | 524 | ||
521 | RCU_INIT_POINTER(q->sock.wq, &q->wq); | 525 | RCU_INIT_POINTER(q->sock.wq, &q->wq); |
522 | init_waitqueue_head(&q->wq.wait); | 526 | init_waitqueue_head(&q->wq.wait); |
@@ -540,22 +544,18 @@ static int tap_open(struct inode *inode, struct file *file) | |||
540 | if ((tap->dev->features & NETIF_F_HIGHDMA) && (tap->dev->features & NETIF_F_SG)) | 544 | if ((tap->dev->features & NETIF_F_HIGHDMA) && (tap->dev->features & NETIF_F_SG)) |
541 | sock_set_flag(&q->sk, SOCK_ZEROCOPY); | 545 | sock_set_flag(&q->sk, SOCK_ZEROCOPY); |
542 | 546 | ||
543 | err = -ENOMEM; | ||
544 | if (skb_array_init(&q->skb_array, tap->dev->tx_queue_len, GFP_KERNEL)) | ||
545 | goto err_array; | ||
546 | |||
547 | err = tap_set_queue(tap, file, q); | 547 | err = tap_set_queue(tap, file, q); |
548 | if (err) | 548 | if (err) { |
549 | goto err_queue; | 549 | /* tap_sock_destruct() will take care of freeing skb_array */ |
550 | goto err_put; | ||
551 | } | ||
550 | 552 | ||
551 | dev_put(tap->dev); | 553 | dev_put(tap->dev); |
552 | 554 | ||
553 | rtnl_unlock(); | 555 | rtnl_unlock(); |
554 | return err; | 556 | return err; |
555 | 557 | ||
556 | err_queue: | 558 | err_put: |
557 | skb_array_cleanup(&q->skb_array); | ||
558 | err_array: | ||
559 | sock_put(&q->sk); | 559 | sock_put(&q->sk); |
560 | err: | 560 | err: |
561 | if (tap) | 561 | if (tap) |
@@ -1249,8 +1249,8 @@ static int tap_list_add(dev_t major, const char *device_name) | |||
1249 | return 0; | 1249 | return 0; |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | int tap_create_cdev(struct cdev *tap_cdev, | 1252 | int tap_create_cdev(struct cdev *tap_cdev, dev_t *tap_major, |
1253 | dev_t *tap_major, const char *device_name) | 1253 | const char *device_name, struct module *module) |
1254 | { | 1254 | { |
1255 | int err; | 1255 | int err; |
1256 | 1256 | ||
@@ -1259,6 +1259,7 @@ int tap_create_cdev(struct cdev *tap_cdev, | |||
1259 | goto out1; | 1259 | goto out1; |
1260 | 1260 | ||
1261 | cdev_init(tap_cdev, &tap_fops); | 1261 | cdev_init(tap_cdev, &tap_fops); |
1262 | tap_cdev->owner = module; | ||
1262 | err = cdev_add(tap_cdev, *tap_major, TAP_NUM_DEVS); | 1263 | err = cdev_add(tap_cdev, *tap_major, TAP_NUM_DEVS); |
1263 | if (err) | 1264 | if (err) |
1264 | goto out2; | 1265 | goto out2; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index ea29da91ea5a..81d0787a6dab 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1444,6 +1444,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, | |||
1444 | buflen += SKB_DATA_ALIGN(len + pad); | 1444 | buflen += SKB_DATA_ALIGN(len + pad); |
1445 | rcu_read_unlock(); | 1445 | rcu_read_unlock(); |
1446 | 1446 | ||
1447 | alloc_frag->offset = ALIGN((u64)alloc_frag->offset, SMP_CACHE_BYTES); | ||
1447 | if (unlikely(!skb_page_frag_refill(buflen, alloc_frag, GFP_KERNEL))) | 1448 | if (unlikely(!skb_page_frag_refill(buflen, alloc_frag, GFP_KERNEL))) |
1448 | return ERR_PTR(-ENOMEM); | 1449 | return ERR_PTR(-ENOMEM); |
1449 | 1450 | ||
@@ -2253,7 +2254,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
2253 | if (!dev) | 2254 | if (!dev) |
2254 | return -ENOMEM; | 2255 | return -ENOMEM; |
2255 | err = dev_get_valid_name(net, dev, name); | 2256 | err = dev_get_valid_name(net, dev, name); |
2256 | if (err) | 2257 | if (err < 0) |
2257 | goto err_free_dev; | 2258 | goto err_free_dev; |
2258 | 2259 | ||
2259 | dev_net_set(dev, net); | 2260 | dev_net_set(dev, net); |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 52ea80bcd639..3e7a3ac3a362 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -561,6 +561,7 @@ static const struct driver_info wwan_info = { | |||
561 | #define HP_VENDOR_ID 0x03f0 | 561 | #define HP_VENDOR_ID 0x03f0 |
562 | #define MICROSOFT_VENDOR_ID 0x045e | 562 | #define MICROSOFT_VENDOR_ID 0x045e |
563 | #define UBLOX_VENDOR_ID 0x1546 | 563 | #define UBLOX_VENDOR_ID 0x1546 |
564 | #define TPLINK_VENDOR_ID 0x2357 | ||
564 | 565 | ||
565 | static const struct usb_device_id products[] = { | 566 | static const struct usb_device_id products[] = { |
566 | /* BLACKLIST !! | 567 | /* BLACKLIST !! |
@@ -813,6 +814,13 @@ static const struct usb_device_id products[] = { | |||
813 | .driver_info = 0, | 814 | .driver_info = 0, |
814 | }, | 815 | }, |
815 | 816 | ||
817 | /* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */ | ||
818 | { | ||
819 | USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM, | ||
820 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | ||
821 | .driver_info = 0, | ||
822 | }, | ||
823 | |||
816 | /* WHITELIST!!! | 824 | /* WHITELIST!!! |
817 | * | 825 | * |
818 | * CDC Ether uses two interfaces, not necessarily consecutive. | 826 | * CDC Ether uses two interfaces, not necessarily consecutive. |
@@ -864,6 +872,12 @@ static const struct usb_device_id products[] = { | |||
864 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | 872 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
865 | .driver_info = (kernel_ulong_t)&wwan_info, | 873 | .driver_info = (kernel_ulong_t)&wwan_info, |
866 | }, { | 874 | }, { |
875 | /* Huawei ME906 and ME909 */ | ||
876 | USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, USB_CLASS_COMM, | ||
877 | USB_CDC_SUBCLASS_ETHERNET, | ||
878 | USB_CDC_PROTO_NONE), | ||
879 | .driver_info = (unsigned long)&wwan_info, | ||
880 | }, { | ||
867 | /* ZTE modules */ | 881 | /* ZTE modules */ |
868 | USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, USB_CLASS_COMM, | 882 | USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, USB_CLASS_COMM, |
869 | USB_CDC_SUBCLASS_ETHERNET, | 883 | USB_CDC_SUBCLASS_ETHERNET, |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 941ece08ba78..d51d9abf7986 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -615,6 +615,7 @@ enum rtl8152_flags { | |||
615 | #define VENDOR_ID_LENOVO 0x17ef | 615 | #define VENDOR_ID_LENOVO 0x17ef |
616 | #define VENDOR_ID_LINKSYS 0x13b1 | 616 | #define VENDOR_ID_LINKSYS 0x13b1 |
617 | #define VENDOR_ID_NVIDIA 0x0955 | 617 | #define VENDOR_ID_NVIDIA 0x0955 |
618 | #define VENDOR_ID_TPLINK 0x2357 | ||
618 | 619 | ||
619 | #define MCU_TYPE_PLA 0x0100 | 620 | #define MCU_TYPE_PLA 0x0100 |
620 | #define MCU_TYPE_USB 0x0000 | 621 | #define MCU_TYPE_USB 0x0000 |
@@ -5319,6 +5320,7 @@ static const struct usb_device_id rtl8152_table[] = { | |||
5319 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)}, | 5320 | {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)}, |
5320 | {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, | 5321 | {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, |
5321 | {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, | 5322 | {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, |
5323 | {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)}, | ||
5322 | {} | 5324 | {} |
5323 | }; | 5325 | }; |
5324 | 5326 | ||
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index af075e998944..be49d0f79381 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c | |||
@@ -2545,10 +2545,10 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) | |||
2545 | nvme_fc_abort_aen_ops(ctrl); | 2545 | nvme_fc_abort_aen_ops(ctrl); |
2546 | 2546 | ||
2547 | /* wait for all io that had to be aborted */ | 2547 | /* wait for all io that had to be aborted */ |
2548 | spin_lock_irqsave(&ctrl->lock, flags); | 2548 | spin_lock_irq(&ctrl->lock); |
2549 | wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock); | 2549 | wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock); |
2550 | ctrl->flags &= ~FCCTRL_TERMIO; | 2550 | ctrl->flags &= ~FCCTRL_TERMIO; |
2551 | spin_unlock_irqrestore(&ctrl->lock, flags); | 2551 | spin_unlock_irq(&ctrl->lock); |
2552 | 2552 | ||
2553 | nvme_fc_term_aen_ops(ctrl); | 2553 | nvme_fc_term_aen_ops(ctrl); |
2554 | 2554 | ||
@@ -2734,7 +2734,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
2734 | { | 2734 | { |
2735 | struct nvme_fc_ctrl *ctrl; | 2735 | struct nvme_fc_ctrl *ctrl; |
2736 | unsigned long flags; | 2736 | unsigned long flags; |
2737 | int ret, idx; | 2737 | int ret, idx, retry; |
2738 | 2738 | ||
2739 | if (!(rport->remoteport.port_role & | 2739 | if (!(rport->remoteport.port_role & |
2740 | (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) { | 2740 | (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) { |
@@ -2760,6 +2760,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
2760 | ctrl->rport = rport; | 2760 | ctrl->rport = rport; |
2761 | ctrl->dev = lport->dev; | 2761 | ctrl->dev = lport->dev; |
2762 | ctrl->cnum = idx; | 2762 | ctrl->cnum = idx; |
2763 | init_waitqueue_head(&ctrl->ioabort_wait); | ||
2763 | 2764 | ||
2764 | get_device(ctrl->dev); | 2765 | get_device(ctrl->dev); |
2765 | kref_init(&ctrl->ref); | 2766 | kref_init(&ctrl->ref); |
@@ -2825,9 +2826,37 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, | |||
2825 | list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list); | 2826 | list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list); |
2826 | spin_unlock_irqrestore(&rport->lock, flags); | 2827 | spin_unlock_irqrestore(&rport->lock, flags); |
2827 | 2828 | ||
2828 | ret = nvme_fc_create_association(ctrl); | 2829 | /* |
2830 | * It's possible that transactions used to create the association | ||
2831 | * may fail. Examples: CreateAssociation LS or CreateIOConnection | ||
2832 | * LS gets dropped/corrupted/fails; or a frame gets dropped or a | ||
2833 | * command times out for one of the actions to init the controller | ||
2834 | * (Connect, Get/Set_Property, Set_Features, etc). Many of these | ||
2835 | * transport errors (frame drop, LS failure) inherently must kill | ||
2836 | * the association. The transport is coded so that any command used | ||
2837 | * to create the association (prior to a LIVE state transition | ||
2838 | * while NEW or RECONNECTING) will fail if it completes in error or | ||
2839 | * times out. | ||
2840 | * | ||
2841 | * As such: as the connect request was mostly likely due to a | ||
2842 | * udev event that discovered the remote port, meaning there is | ||
2843 | * not an admin or script there to restart if the connect | ||
2844 | * request fails, retry the initial connection creation up to | ||
2845 | * three times before giving up and declaring failure. | ||
2846 | */ | ||
2847 | for (retry = 0; retry < 3; retry++) { | ||
2848 | ret = nvme_fc_create_association(ctrl); | ||
2849 | if (!ret) | ||
2850 | break; | ||
2851 | } | ||
2852 | |||
2829 | if (ret) { | 2853 | if (ret) { |
2854 | /* couldn't schedule retry - fail out */ | ||
2855 | dev_err(ctrl->ctrl.device, | ||
2856 | "NVME-FC{%d}: Connect retry failed\n", ctrl->cnum); | ||
2857 | |||
2830 | ctrl->ctrl.opts = NULL; | 2858 | ctrl->ctrl.opts = NULL; |
2859 | |||
2831 | /* initiate nvme ctrl ref counting teardown */ | 2860 | /* initiate nvme ctrl ref counting teardown */ |
2832 | nvme_uninit_ctrl(&ctrl->ctrl); | 2861 | nvme_uninit_ctrl(&ctrl->ctrl); |
2833 | nvme_put_ctrl(&ctrl->ctrl); | 2862 | nvme_put_ctrl(&ctrl->ctrl); |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 92a03ff5fb4d..87bac27ec64b 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -571,6 +571,12 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) | |||
571 | if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags)) | 571 | if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags)) |
572 | return; | 572 | return; |
573 | 573 | ||
574 | if (nvme_rdma_queue_idx(queue) == 0) { | ||
575 | nvme_rdma_free_qe(queue->device->dev, | ||
576 | &queue->ctrl->async_event_sqe, | ||
577 | sizeof(struct nvme_command), DMA_TO_DEVICE); | ||
578 | } | ||
579 | |||
574 | nvme_rdma_destroy_queue_ib(queue); | 580 | nvme_rdma_destroy_queue_ib(queue); |
575 | rdma_destroy_id(queue->cm_id); | 581 | rdma_destroy_id(queue->cm_id); |
576 | } | 582 | } |
@@ -739,8 +745,6 @@ out: | |||
739 | static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl, | 745 | static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl, |
740 | bool remove) | 746 | bool remove) |
741 | { | 747 | { |
742 | nvme_rdma_free_qe(ctrl->queues[0].device->dev, &ctrl->async_event_sqe, | ||
743 | sizeof(struct nvme_command), DMA_TO_DEVICE); | ||
744 | nvme_rdma_stop_queue(&ctrl->queues[0]); | 748 | nvme_rdma_stop_queue(&ctrl->queues[0]); |
745 | if (remove) { | 749 | if (remove) { |
746 | blk_cleanup_queue(ctrl->ctrl.admin_q); | 750 | blk_cleanup_queue(ctrl->ctrl.admin_q); |
@@ -765,8 +769,10 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, | |||
765 | 769 | ||
766 | if (new) { | 770 | if (new) { |
767 | ctrl->ctrl.admin_tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, true); | 771 | ctrl->ctrl.admin_tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, true); |
768 | if (IS_ERR(ctrl->ctrl.admin_tagset)) | 772 | if (IS_ERR(ctrl->ctrl.admin_tagset)) { |
773 | error = PTR_ERR(ctrl->ctrl.admin_tagset); | ||
769 | goto out_free_queue; | 774 | goto out_free_queue; |
775 | } | ||
770 | 776 | ||
771 | ctrl->ctrl.admin_q = blk_mq_init_queue(&ctrl->admin_tag_set); | 777 | ctrl->ctrl.admin_q = blk_mq_init_queue(&ctrl->admin_tag_set); |
772 | if (IS_ERR(ctrl->ctrl.admin_q)) { | 778 | if (IS_ERR(ctrl->ctrl.admin_q)) { |
@@ -846,8 +852,10 @@ static int nvme_rdma_configure_io_queues(struct nvme_rdma_ctrl *ctrl, bool new) | |||
846 | 852 | ||
847 | if (new) { | 853 | if (new) { |
848 | ctrl->ctrl.tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, false); | 854 | ctrl->ctrl.tagset = nvme_rdma_alloc_tagset(&ctrl->ctrl, false); |
849 | if (IS_ERR(ctrl->ctrl.tagset)) | 855 | if (IS_ERR(ctrl->ctrl.tagset)) { |
856 | ret = PTR_ERR(ctrl->ctrl.tagset); | ||
850 | goto out_free_io_queues; | 857 | goto out_free_io_queues; |
858 | } | ||
851 | 859 | ||
852 | ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set); | 860 | ctrl->ctrl.connect_q = blk_mq_init_queue(&ctrl->tag_set); |
853 | if (IS_ERR(ctrl->ctrl.connect_q)) { | 861 | if (IS_ERR(ctrl->ctrl.connect_q)) { |
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 1b208beeef50..645ba7eee35d 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c | |||
@@ -387,12 +387,21 @@ struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid) | |||
387 | 387 | ||
388 | static void __nvmet_req_complete(struct nvmet_req *req, u16 status) | 388 | static void __nvmet_req_complete(struct nvmet_req *req, u16 status) |
389 | { | 389 | { |
390 | u32 old_sqhd, new_sqhd; | ||
391 | u16 sqhd; | ||
392 | |||
390 | if (status) | 393 | if (status) |
391 | nvmet_set_status(req, status); | 394 | nvmet_set_status(req, status); |
392 | 395 | ||
393 | if (req->sq->size) | 396 | if (req->sq->size) { |
394 | req->sq->sqhd = (req->sq->sqhd + 1) % req->sq->size; | 397 | do { |
395 | req->rsp->sq_head = cpu_to_le16(req->sq->sqhd); | 398 | old_sqhd = req->sq->sqhd; |
399 | new_sqhd = (old_sqhd + 1) % req->sq->size; | ||
400 | } while (cmpxchg(&req->sq->sqhd, old_sqhd, new_sqhd) != | ||
401 | old_sqhd); | ||
402 | } | ||
403 | sqhd = req->sq->sqhd & 0x0000FFFF; | ||
404 | req->rsp->sq_head = cpu_to_le16(sqhd); | ||
396 | req->rsp->sq_id = cpu_to_le16(req->sq->qid); | 405 | req->rsp->sq_id = cpu_to_le16(req->sq->qid); |
397 | req->rsp->command_id = req->cmd->common.command_id; | 406 | req->rsp->command_id = req->cmd->common.command_id; |
398 | 407 | ||
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 7b8e20adf760..87e429bfcd8a 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h | |||
@@ -74,7 +74,7 @@ struct nvmet_sq { | |||
74 | struct percpu_ref ref; | 74 | struct percpu_ref ref; |
75 | u16 qid; | 75 | u16 qid; |
76 | u16 size; | 76 | u16 size; |
77 | u16 sqhd; | 77 | u32 sqhd; |
78 | struct completion free_done; | 78 | struct completion free_done; |
79 | struct completion confirm_done; | 79 | struct completion confirm_done; |
80 | }; | 80 | }; |
diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c index 73ebad6634a7..89c887ea5557 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c | |||
@@ -111,6 +111,8 @@ | |||
111 | #define MVEBU_COMPHY_CONF6_40B BIT(18) | 111 | #define MVEBU_COMPHY_CONF6_40B BIT(18) |
112 | #define MVEBU_COMPHY_SELECTOR 0x1140 | 112 | #define MVEBU_COMPHY_SELECTOR 0x1140 |
113 | #define MVEBU_COMPHY_SELECTOR_PHY(n) ((n) * 0x4) | 113 | #define MVEBU_COMPHY_SELECTOR_PHY(n) ((n) * 0x4) |
114 | #define MVEBU_COMPHY_PIPE_SELECTOR 0x1144 | ||
115 | #define MVEBU_COMPHY_PIPE_SELECTOR_PIPE(n) ((n) * 0x4) | ||
114 | 116 | ||
115 | #define MVEBU_COMPHY_LANES 6 | 117 | #define MVEBU_COMPHY_LANES 6 |
116 | #define MVEBU_COMPHY_PORTS 3 | 118 | #define MVEBU_COMPHY_PORTS 3 |
@@ -468,13 +470,17 @@ static int mvebu_comphy_power_on(struct phy *phy) | |||
468 | { | 470 | { |
469 | struct mvebu_comphy_lane *lane = phy_get_drvdata(phy); | 471 | struct mvebu_comphy_lane *lane = phy_get_drvdata(phy); |
470 | struct mvebu_comphy_priv *priv = lane->priv; | 472 | struct mvebu_comphy_priv *priv = lane->priv; |
471 | int ret; | 473 | int ret, mux; |
472 | u32 mux, val; | 474 | u32 val; |
473 | 475 | ||
474 | mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode); | 476 | mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode); |
475 | if (mux < 0) | 477 | if (mux < 0) |
476 | return -ENOTSUPP; | 478 | return -ENOTSUPP; |
477 | 479 | ||
480 | regmap_read(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, &val); | ||
481 | val &= ~(0xf << MVEBU_COMPHY_PIPE_SELECTOR_PIPE(lane->id)); | ||
482 | regmap_write(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, val); | ||
483 | |||
478 | regmap_read(priv->regmap, MVEBU_COMPHY_SELECTOR, &val); | 484 | regmap_read(priv->regmap, MVEBU_COMPHY_SELECTOR, &val); |
479 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); | 485 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); |
480 | val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id); | 486 | val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id); |
@@ -526,6 +532,10 @@ static int mvebu_comphy_power_off(struct phy *phy) | |||
526 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); | 532 | val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id)); |
527 | regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val); | 533 | regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val); |
528 | 534 | ||
535 | regmap_read(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, &val); | ||
536 | val &= ~(0xf << MVEBU_COMPHY_PIPE_SELECTOR_PIPE(lane->id)); | ||
537 | regmap_write(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, val); | ||
538 | |||
529 | return 0; | 539 | return 0; |
530 | } | 540 | } |
531 | 541 | ||
@@ -576,8 +586,8 @@ static int mvebu_comphy_probe(struct platform_device *pdev) | |||
576 | return PTR_ERR(priv->regmap); | 586 | return PTR_ERR(priv->regmap); |
577 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 587 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
578 | priv->base = devm_ioremap_resource(&pdev->dev, res); | 588 | priv->base = devm_ioremap_resource(&pdev->dev, res); |
579 | if (!priv->base) | 589 | if (IS_ERR(priv->base)) |
580 | return -ENOMEM; | 590 | return PTR_ERR(priv->base); |
581 | 591 | ||
582 | for_each_available_child_of_node(pdev->dev.of_node, child) { | 592 | for_each_available_child_of_node(pdev->dev.of_node, child) { |
583 | struct mvebu_comphy_lane *lane; | 593 | struct mvebu_comphy_lane *lane; |
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c index e3baad78521f..721a2a1c97ef 100644 --- a/drivers/phy/mediatek/phy-mtk-tphy.c +++ b/drivers/phy/mediatek/phy-mtk-tphy.c | |||
@@ -27,6 +27,7 @@ | |||
27 | /* banks shared by multiple phys */ | 27 | /* banks shared by multiple phys */ |
28 | #define SSUSB_SIFSLV_V1_SPLLC 0x000 /* shared by u3 phys */ | 28 | #define SSUSB_SIFSLV_V1_SPLLC 0x000 /* shared by u3 phys */ |
29 | #define SSUSB_SIFSLV_V1_U2FREQ 0x100 /* shared by u2 phys */ | 29 | #define SSUSB_SIFSLV_V1_U2FREQ 0x100 /* shared by u2 phys */ |
30 | #define SSUSB_SIFSLV_V1_CHIP 0x300 /* shared by u3 phys */ | ||
30 | /* u2 phy bank */ | 31 | /* u2 phy bank */ |
31 | #define SSUSB_SIFSLV_V1_U2PHY_COM 0x000 | 32 | #define SSUSB_SIFSLV_V1_U2PHY_COM 0x000 |
32 | /* u3/pcie/sata phy banks */ | 33 | /* u3/pcie/sata phy banks */ |
@@ -762,7 +763,7 @@ static void phy_v1_banks_init(struct mtk_tphy *tphy, | |||
762 | case PHY_TYPE_USB3: | 763 | case PHY_TYPE_USB3: |
763 | case PHY_TYPE_PCIE: | 764 | case PHY_TYPE_PCIE: |
764 | u3_banks->spllc = tphy->sif_base + SSUSB_SIFSLV_V1_SPLLC; | 765 | u3_banks->spllc = tphy->sif_base + SSUSB_SIFSLV_V1_SPLLC; |
765 | u3_banks->chip = NULL; | 766 | u3_banks->chip = tphy->sif_base + SSUSB_SIFSLV_V1_CHIP; |
766 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; | 767 | u3_banks->phyd = instance->port_base + SSUSB_SIFSLV_V1_U3PHYD; |
767 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; | 768 | u3_banks->phya = instance->port_base + SSUSB_SIFSLV_V1_U3PHYA; |
768 | break; | 769 | break; |
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 4d2c57f21d76..a958c9bced01 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c | |||
@@ -443,14 +443,34 @@ static inline int property_enable(struct rockchip_typec_phy *tcphy, | |||
443 | return regmap_write(tcphy->grf_regs, reg->offset, val | mask); | 443 | return regmap_write(tcphy->grf_regs, reg->offset, val | mask); |
444 | } | 444 | } |
445 | 445 | ||
446 | static void tcphy_dp_aux_set_flip(struct rockchip_typec_phy *tcphy) | ||
447 | { | ||
448 | u16 tx_ana_ctrl_reg_1; | ||
449 | |||
450 | /* | ||
451 | * Select the polarity of the xcvr: | ||
452 | * 1, Reverses the polarity (If TYPEC, Pulls ups aux_p and pull | ||
453 | * down aux_m) | ||
454 | * 0, Normal polarity (if TYPEC, pulls up aux_m and pulls down | ||
455 | * aux_p) | ||
456 | */ | ||
457 | tx_ana_ctrl_reg_1 = readl(tcphy->base + TX_ANA_CTRL_REG_1); | ||
458 | if (!tcphy->flip) | ||
459 | tx_ana_ctrl_reg_1 |= BIT(12); | ||
460 | else | ||
461 | tx_ana_ctrl_reg_1 &= ~BIT(12); | ||
462 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
463 | } | ||
464 | |||
446 | static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | 465 | static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) |
447 | { | 466 | { |
467 | u16 tx_ana_ctrl_reg_1; | ||
448 | u16 rdata, rdata2, val; | 468 | u16 rdata, rdata2, val; |
449 | 469 | ||
450 | /* disable txda_cal_latch_en for rewrite the calibration values */ | 470 | /* disable txda_cal_latch_en for rewrite the calibration values */ |
451 | rdata = readl(tcphy->base + TX_ANA_CTRL_REG_1); | 471 | tx_ana_ctrl_reg_1 = readl(tcphy->base + TX_ANA_CTRL_REG_1); |
452 | val = rdata & 0xdfff; | 472 | tx_ana_ctrl_reg_1 &= ~BIT(13); |
453 | writel(val, tcphy->base + TX_ANA_CTRL_REG_1); | 473 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
454 | 474 | ||
455 | /* | 475 | /* |
456 | * read a resistor calibration code from CMN_TXPUCAL_CTRL[6:0] and | 476 | * read a resistor calibration code from CMN_TXPUCAL_CTRL[6:0] and |
@@ -472,9 +492,8 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
472 | * Activate this signal for 1 clock cycle to sample new calibration | 492 | * Activate this signal for 1 clock cycle to sample new calibration |
473 | * values. | 493 | * values. |
474 | */ | 494 | */ |
475 | rdata = readl(tcphy->base + TX_ANA_CTRL_REG_1); | 495 | tx_ana_ctrl_reg_1 |= BIT(13); |
476 | val = rdata | 0x2000; | 496 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
477 | writel(val, tcphy->base + TX_ANA_CTRL_REG_1); | ||
478 | usleep_range(150, 200); | 497 | usleep_range(150, 200); |
479 | 498 | ||
480 | /* set TX Voltage Level and TX Deemphasis to 0 */ | 499 | /* set TX Voltage Level and TX Deemphasis to 0 */ |
@@ -482,8 +501,10 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
482 | /* re-enable decap */ | 501 | /* re-enable decap */ |
483 | writel(0x100, tcphy->base + TX_ANA_CTRL_REG_2); | 502 | writel(0x100, tcphy->base + TX_ANA_CTRL_REG_2); |
484 | writel(0x300, tcphy->base + TX_ANA_CTRL_REG_2); | 503 | writel(0x300, tcphy->base + TX_ANA_CTRL_REG_2); |
485 | writel(0x2008, tcphy->base + TX_ANA_CTRL_REG_1); | 504 | tx_ana_ctrl_reg_1 |= BIT(3); |
486 | writel(0x2018, tcphy->base + TX_ANA_CTRL_REG_1); | 505 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
506 | tx_ana_ctrl_reg_1 |= BIT(4); | ||
507 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
487 | 508 | ||
488 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); | 509 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); |
489 | 510 | ||
@@ -494,8 +515,10 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
494 | writel(0x1001, tcphy->base + TX_ANA_CTRL_REG_4); | 515 | writel(0x1001, tcphy->base + TX_ANA_CTRL_REG_4); |
495 | 516 | ||
496 | /* re-enables Bandgap reference for LDO */ | 517 | /* re-enables Bandgap reference for LDO */ |
497 | writel(0x2098, tcphy->base + TX_ANA_CTRL_REG_1); | 518 | tx_ana_ctrl_reg_1 |= BIT(7); |
498 | writel(0x2198, tcphy->base + TX_ANA_CTRL_REG_1); | 519 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); |
520 | tx_ana_ctrl_reg_1 |= BIT(8); | ||
521 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
499 | 522 | ||
500 | /* | 523 | /* |
501 | * re-enables the transmitter pre-driver, driver data selection MUX, | 524 | * re-enables the transmitter pre-driver, driver data selection MUX, |
@@ -505,27 +528,26 @@ static void tcphy_dp_aux_calibration(struct rockchip_typec_phy *tcphy) | |||
505 | writel(0x303, tcphy->base + TX_ANA_CTRL_REG_2); | 528 | writel(0x303, tcphy->base + TX_ANA_CTRL_REG_2); |
506 | 529 | ||
507 | /* | 530 | /* |
508 | * BIT 12: Controls auxda_polarity, which selects the polarity of the | 531 | * Do some magic undocumented stuff, some of which appears to |
509 | * xcvr: | 532 | * undo the "re-enables Bandgap reference for LDO" above. |
510 | * 1, Reverses the polarity (If TYPEC, Pulls ups aux_p and pull | ||
511 | * down aux_m) | ||
512 | * 0, Normal polarity (if TYPE_C, pulls up aux_m and pulls down | ||
513 | * aux_p) | ||
514 | */ | 533 | */ |
515 | val = 0xa078; | 534 | tx_ana_ctrl_reg_1 |= BIT(15); |
516 | if (!tcphy->flip) | 535 | tx_ana_ctrl_reg_1 &= ~BIT(8); |
517 | val |= BIT(12); | 536 | tx_ana_ctrl_reg_1 &= ~BIT(7); |
518 | writel(val, tcphy->base + TX_ANA_CTRL_REG_1); | 537 | tx_ana_ctrl_reg_1 |= BIT(6); |
538 | tx_ana_ctrl_reg_1 |= BIT(5); | ||
539 | writel(tx_ana_ctrl_reg_1, tcphy->base + TX_ANA_CTRL_REG_1); | ||
519 | 540 | ||
520 | writel(0, tcphy->base + TX_ANA_CTRL_REG_3); | 541 | writel(0, tcphy->base + TX_ANA_CTRL_REG_3); |
521 | writel(0, tcphy->base + TX_ANA_CTRL_REG_4); | 542 | writel(0, tcphy->base + TX_ANA_CTRL_REG_4); |
522 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); | 543 | writel(0, tcphy->base + TX_ANA_CTRL_REG_5); |
523 | 544 | ||
524 | /* | 545 | /* |
525 | * Controls low_power_swing_en, set the voltage swing of the driver | 546 | * Controls low_power_swing_en, don't set the voltage swing of the |
526 | * to 400mv. The values below are peak to peak (differential) values. | 547 | * driver to 400mv. The values below are peak to peak (differential) |
548 | * values. | ||
527 | */ | 549 | */ |
528 | writel(4, tcphy->base + TXDA_COEFF_CALC_CTRL); | 550 | writel(0, tcphy->base + TXDA_COEFF_CALC_CTRL); |
529 | writel(0, tcphy->base + TXDA_CYA_AUXDA_CYA); | 551 | writel(0, tcphy->base + TXDA_CYA_AUXDA_CYA); |
530 | 552 | ||
531 | /* Controls tx_high_z_tm_en */ | 553 | /* Controls tx_high_z_tm_en */ |
@@ -555,6 +577,7 @@ static int tcphy_phy_init(struct rockchip_typec_phy *tcphy, u8 mode) | |||
555 | reset_control_deassert(tcphy->tcphy_rst); | 577 | reset_control_deassert(tcphy->tcphy_rst); |
556 | 578 | ||
557 | property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip); | 579 | property_enable(tcphy, &cfg->typec_conn_dir, tcphy->flip); |
580 | tcphy_dp_aux_set_flip(tcphy); | ||
558 | 581 | ||
559 | tcphy_cfg_24m(tcphy); | 582 | tcphy_cfg_24m(tcphy); |
560 | 583 | ||
@@ -685,8 +708,11 @@ static int rockchip_usb3_phy_power_on(struct phy *phy) | |||
685 | if (tcphy->mode == new_mode) | 708 | if (tcphy->mode == new_mode) |
686 | goto unlock_ret; | 709 | goto unlock_ret; |
687 | 710 | ||
688 | if (tcphy->mode == MODE_DISCONNECT) | 711 | if (tcphy->mode == MODE_DISCONNECT) { |
689 | tcphy_phy_init(tcphy, new_mode); | 712 | ret = tcphy_phy_init(tcphy, new_mode); |
713 | if (ret) | ||
714 | goto unlock_ret; | ||
715 | } | ||
690 | 716 | ||
691 | /* wait TCPHY for pipe ready */ | 717 | /* wait TCPHY for pipe ready */ |
692 | for (timeout = 0; timeout < 100; timeout++) { | 718 | for (timeout = 0; timeout < 100; timeout++) { |
@@ -760,10 +786,12 @@ static int rockchip_dp_phy_power_on(struct phy *phy) | |||
760 | */ | 786 | */ |
761 | if (new_mode == MODE_DFP_DP && tcphy->mode != MODE_DISCONNECT) { | 787 | if (new_mode == MODE_DFP_DP && tcphy->mode != MODE_DISCONNECT) { |
762 | tcphy_phy_deinit(tcphy); | 788 | tcphy_phy_deinit(tcphy); |
763 | tcphy_phy_init(tcphy, new_mode); | 789 | ret = tcphy_phy_init(tcphy, new_mode); |
764 | } else if (tcphy->mode == MODE_DISCONNECT) { | 790 | } else if (tcphy->mode == MODE_DISCONNECT) { |
765 | tcphy_phy_init(tcphy, new_mode); | 791 | ret = tcphy_phy_init(tcphy, new_mode); |
766 | } | 792 | } |
793 | if (ret) | ||
794 | goto unlock_ret; | ||
767 | 795 | ||
768 | ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, | 796 | ret = readx_poll_timeout(readl, tcphy->base + DP_MODE_CTL, |
769 | val, val & DP_MODE_A2, 1000, | 797 | val, val & DP_MODE_A2, 1000, |
diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c index 3cbcb2537657..4307bf0013e1 100644 --- a/drivers/phy/tegra/xusb.c +++ b/drivers/phy/tegra/xusb.c | |||
@@ -454,6 +454,8 @@ tegra_xusb_find_port_node(struct tegra_xusb_padctl *padctl, const char *type, | |||
454 | char *name; | 454 | char *name; |
455 | 455 | ||
456 | name = kasprintf(GFP_KERNEL, "%s-%u", type, index); | 456 | name = kasprintf(GFP_KERNEL, "%s-%u", type, index); |
457 | if (!name) | ||
458 | return ERR_PTR(-ENOMEM); | ||
457 | np = of_find_node_by_name(np, name); | 459 | np = of_find_node_by_name(np, name); |
458 | kfree(name); | 460 | kfree(name); |
459 | } | 461 | } |
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index 3f6b34febbf1..433af328d981 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c | |||
@@ -534,8 +534,16 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) | |||
534 | continue; | 534 | continue; |
535 | irq = irq_find_mapping(gc->irqdomain, irqnr + i); | 535 | irq = irq_find_mapping(gc->irqdomain, irqnr + i); |
536 | generic_handle_irq(irq); | 536 | generic_handle_irq(irq); |
537 | /* Clear interrupt */ | 537 | |
538 | /* Clear interrupt. | ||
539 | * We must read the pin register again, in case the | ||
540 | * value was changed while executing | ||
541 | * generic_handle_irq() above. | ||
542 | */ | ||
543 | raw_spin_lock_irqsave(&gpio_dev->lock, flags); | ||
544 | regval = readl(regs + i); | ||
538 | writel(regval, regs + i); | 545 | writel(regval, regs + i); |
546 | raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); | ||
539 | ret = IRQ_HANDLED; | 547 | ret = IRQ_HANDLED; |
540 | } | 548 | } |
541 | } | 549 | } |
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 3e40d4245512..9c950bbf07ba 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c | |||
@@ -407,10 +407,10 @@ static int mcp23s08_get(struct gpio_chip *chip, unsigned offset) | |||
407 | ret = mcp_read(mcp, MCP_GPIO, &status); | 407 | ret = mcp_read(mcp, MCP_GPIO, &status); |
408 | if (ret < 0) | 408 | if (ret < 0) |
409 | status = 0; | 409 | status = 0; |
410 | else | 410 | else { |
411 | mcp->cached_gpio = status; | ||
411 | status = !!(status & (1 << offset)); | 412 | status = !!(status & (1 << offset)); |
412 | 413 | } | |
413 | mcp->cached_gpio = status; | ||
414 | 414 | ||
415 | mutex_unlock(&mcp->lock); | 415 | mutex_unlock(&mcp->lock); |
416 | return status; | 416 | return status; |
diff --git a/drivers/platform/x86/intel_pmc_ipc.c b/drivers/platform/x86/intel_pmc_ipc.c index bb792a52248b..e03fa31446ca 100644 --- a/drivers/platform/x86/intel_pmc_ipc.c +++ b/drivers/platform/x86/intel_pmc_ipc.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/suspend.h> | 33 | #include <linux/suspend.h> |
34 | #include <linux/acpi.h> | 34 | #include <linux/acpi.h> |
35 | #include <linux/io-64-nonatomic-lo-hi.h> | 35 | #include <linux/io-64-nonatomic-lo-hi.h> |
36 | #include <linux/spinlock.h> | ||
36 | 37 | ||
37 | #include <asm/intel_pmc_ipc.h> | 38 | #include <asm/intel_pmc_ipc.h> |
38 | 39 | ||
@@ -131,6 +132,7 @@ static struct intel_pmc_ipc_dev { | |||
131 | /* gcr */ | 132 | /* gcr */ |
132 | void __iomem *gcr_mem_base; | 133 | void __iomem *gcr_mem_base; |
133 | bool has_gcr_regs; | 134 | bool has_gcr_regs; |
135 | spinlock_t gcr_lock; | ||
134 | 136 | ||
135 | /* punit */ | 137 | /* punit */ |
136 | struct platform_device *punit_dev; | 138 | struct platform_device *punit_dev; |
@@ -225,17 +227,17 @@ int intel_pmc_gcr_read(u32 offset, u32 *data) | |||
225 | { | 227 | { |
226 | int ret; | 228 | int ret; |
227 | 229 | ||
228 | mutex_lock(&ipclock); | 230 | spin_lock(&ipcdev.gcr_lock); |
229 | 231 | ||
230 | ret = is_gcr_valid(offset); | 232 | ret = is_gcr_valid(offset); |
231 | if (ret < 0) { | 233 | if (ret < 0) { |
232 | mutex_unlock(&ipclock); | 234 | spin_unlock(&ipcdev.gcr_lock); |
233 | return ret; | 235 | return ret; |
234 | } | 236 | } |
235 | 237 | ||
236 | *data = readl(ipcdev.gcr_mem_base + offset); | 238 | *data = readl(ipcdev.gcr_mem_base + offset); |
237 | 239 | ||
238 | mutex_unlock(&ipclock); | 240 | spin_unlock(&ipcdev.gcr_lock); |
239 | 241 | ||
240 | return 0; | 242 | return 0; |
241 | } | 243 | } |
@@ -255,17 +257,17 @@ int intel_pmc_gcr_write(u32 offset, u32 data) | |||
255 | { | 257 | { |
256 | int ret; | 258 | int ret; |
257 | 259 | ||
258 | mutex_lock(&ipclock); | 260 | spin_lock(&ipcdev.gcr_lock); |
259 | 261 | ||
260 | ret = is_gcr_valid(offset); | 262 | ret = is_gcr_valid(offset); |
261 | if (ret < 0) { | 263 | if (ret < 0) { |
262 | mutex_unlock(&ipclock); | 264 | spin_unlock(&ipcdev.gcr_lock); |
263 | return ret; | 265 | return ret; |
264 | } | 266 | } |
265 | 267 | ||
266 | writel(data, ipcdev.gcr_mem_base + offset); | 268 | writel(data, ipcdev.gcr_mem_base + offset); |
267 | 269 | ||
268 | mutex_unlock(&ipclock); | 270 | spin_unlock(&ipcdev.gcr_lock); |
269 | 271 | ||
270 | return 0; | 272 | return 0; |
271 | } | 273 | } |
@@ -287,7 +289,7 @@ int intel_pmc_gcr_update(u32 offset, u32 mask, u32 val) | |||
287 | u32 new_val; | 289 | u32 new_val; |
288 | int ret = 0; | 290 | int ret = 0; |
289 | 291 | ||
290 | mutex_lock(&ipclock); | 292 | spin_lock(&ipcdev.gcr_lock); |
291 | 293 | ||
292 | ret = is_gcr_valid(offset); | 294 | ret = is_gcr_valid(offset); |
293 | if (ret < 0) | 295 | if (ret < 0) |
@@ -309,7 +311,7 @@ int intel_pmc_gcr_update(u32 offset, u32 mask, u32 val) | |||
309 | } | 311 | } |
310 | 312 | ||
311 | gcr_ipc_unlock: | 313 | gcr_ipc_unlock: |
312 | mutex_unlock(&ipclock); | 314 | spin_unlock(&ipcdev.gcr_lock); |
313 | return ret; | 315 | return ret; |
314 | } | 316 | } |
315 | EXPORT_SYMBOL_GPL(intel_pmc_gcr_update); | 317 | EXPORT_SYMBOL_GPL(intel_pmc_gcr_update); |
@@ -480,52 +482,41 @@ static irqreturn_t ioc(int irq, void *dev_id) | |||
480 | 482 | ||
481 | static int ipc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 483 | static int ipc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
482 | { | 484 | { |
483 | resource_size_t pci_resource; | 485 | struct intel_pmc_ipc_dev *pmc = &ipcdev; |
484 | int ret; | 486 | int ret; |
485 | int len; | ||
486 | 487 | ||
487 | ipcdev.dev = &pci_dev_get(pdev)->dev; | 488 | /* Only one PMC is supported */ |
488 | ipcdev.irq_mode = IPC_TRIGGER_MODE_IRQ; | 489 | if (pmc->dev) |
490 | return -EBUSY; | ||
489 | 491 | ||
490 | ret = pci_enable_device(pdev); | 492 | pmc->irq_mode = IPC_TRIGGER_MODE_IRQ; |
493 | |||
494 | spin_lock_init(&ipcdev.gcr_lock); | ||
495 | |||
496 | ret = pcim_enable_device(pdev); | ||
491 | if (ret) | 497 | if (ret) |
492 | return ret; | 498 | return ret; |
493 | 499 | ||
494 | ret = pci_request_regions(pdev, "intel_pmc_ipc"); | 500 | ret = pcim_iomap_regions(pdev, 1 << 0, pci_name(pdev)); |
495 | if (ret) | 501 | if (ret) |
496 | return ret; | 502 | return ret; |
497 | 503 | ||
498 | pci_resource = pci_resource_start(pdev, 0); | 504 | init_completion(&pmc->cmd_complete); |
499 | len = pci_resource_len(pdev, 0); | ||
500 | if (!pci_resource || !len) { | ||
501 | dev_err(&pdev->dev, "Failed to get resource\n"); | ||
502 | return -ENOMEM; | ||
503 | } | ||
504 | 505 | ||
505 | init_completion(&ipcdev.cmd_complete); | 506 | pmc->ipc_base = pcim_iomap_table(pdev)[0]; |
506 | 507 | ||
507 | if (request_irq(pdev->irq, ioc, 0, "intel_pmc_ipc", &ipcdev)) { | 508 | ret = devm_request_irq(&pdev->dev, pdev->irq, ioc, 0, "intel_pmc_ipc", |
509 | pmc); | ||
510 | if (ret) { | ||
508 | dev_err(&pdev->dev, "Failed to request irq\n"); | 511 | dev_err(&pdev->dev, "Failed to request irq\n"); |
509 | return -EBUSY; | 512 | return ret; |
510 | } | 513 | } |
511 | 514 | ||
512 | ipcdev.ipc_base = ioremap_nocache(pci_resource, len); | 515 | pmc->dev = &pdev->dev; |
513 | if (!ipcdev.ipc_base) { | ||
514 | dev_err(&pdev->dev, "Failed to ioremap ipc base\n"); | ||
515 | free_irq(pdev->irq, &ipcdev); | ||
516 | ret = -ENOMEM; | ||
517 | } | ||
518 | 516 | ||
519 | return ret; | 517 | pci_set_drvdata(pdev, pmc); |
520 | } | ||
521 | 518 | ||
522 | static void ipc_pci_remove(struct pci_dev *pdev) | 519 | return 0; |
523 | { | ||
524 | free_irq(pdev->irq, &ipcdev); | ||
525 | pci_release_regions(pdev); | ||
526 | pci_dev_put(pdev); | ||
527 | iounmap(ipcdev.ipc_base); | ||
528 | ipcdev.dev = NULL; | ||
529 | } | 520 | } |
530 | 521 | ||
531 | static const struct pci_device_id ipc_pci_ids[] = { | 522 | static const struct pci_device_id ipc_pci_ids[] = { |
@@ -540,7 +531,6 @@ static struct pci_driver ipc_pci_driver = { | |||
540 | .name = "intel_pmc_ipc", | 531 | .name = "intel_pmc_ipc", |
541 | .id_table = ipc_pci_ids, | 532 | .id_table = ipc_pci_ids, |
542 | .probe = ipc_pci_probe, | 533 | .probe = ipc_pci_probe, |
543 | .remove = ipc_pci_remove, | ||
544 | }; | 534 | }; |
545 | 535 | ||
546 | static ssize_t intel_pmc_ipc_simple_cmd_store(struct device *dev, | 536 | static ssize_t intel_pmc_ipc_simple_cmd_store(struct device *dev, |
@@ -850,17 +840,12 @@ static int ipc_plat_get_res(struct platform_device *pdev) | |||
850 | return -ENXIO; | 840 | return -ENXIO; |
851 | } | 841 | } |
852 | size = PLAT_RESOURCE_IPC_SIZE + PLAT_RESOURCE_GCR_SIZE; | 842 | size = PLAT_RESOURCE_IPC_SIZE + PLAT_RESOURCE_GCR_SIZE; |
843 | res->end = res->start + size - 1; | ||
844 | |||
845 | addr = devm_ioremap_resource(&pdev->dev, res); | ||
846 | if (IS_ERR(addr)) | ||
847 | return PTR_ERR(addr); | ||
853 | 848 | ||
854 | if (!request_mem_region(res->start, size, pdev->name)) { | ||
855 | dev_err(&pdev->dev, "Failed to request ipc resource\n"); | ||
856 | return -EBUSY; | ||
857 | } | ||
858 | addr = ioremap_nocache(res->start, size); | ||
859 | if (!addr) { | ||
860 | dev_err(&pdev->dev, "I/O memory remapping failed\n"); | ||
861 | release_mem_region(res->start, size); | ||
862 | return -ENOMEM; | ||
863 | } | ||
864 | ipcdev.ipc_base = addr; | 849 | ipcdev.ipc_base = addr; |
865 | 850 | ||
866 | ipcdev.gcr_mem_base = addr + PLAT_RESOURCE_GCR_OFFSET; | 851 | ipcdev.gcr_mem_base = addr + PLAT_RESOURCE_GCR_OFFSET; |
@@ -917,12 +902,12 @@ MODULE_DEVICE_TABLE(acpi, ipc_acpi_ids); | |||
917 | 902 | ||
918 | static int ipc_plat_probe(struct platform_device *pdev) | 903 | static int ipc_plat_probe(struct platform_device *pdev) |
919 | { | 904 | { |
920 | struct resource *res; | ||
921 | int ret; | 905 | int ret; |
922 | 906 | ||
923 | ipcdev.dev = &pdev->dev; | 907 | ipcdev.dev = &pdev->dev; |
924 | ipcdev.irq_mode = IPC_TRIGGER_MODE_IRQ; | 908 | ipcdev.irq_mode = IPC_TRIGGER_MODE_IRQ; |
925 | init_completion(&ipcdev.cmd_complete); | 909 | init_completion(&ipcdev.cmd_complete); |
910 | spin_lock_init(&ipcdev.gcr_lock); | ||
926 | 911 | ||
927 | ipcdev.irq = platform_get_irq(pdev, 0); | 912 | ipcdev.irq = platform_get_irq(pdev, 0); |
928 | if (ipcdev.irq < 0) { | 913 | if (ipcdev.irq < 0) { |
@@ -939,11 +924,11 @@ static int ipc_plat_probe(struct platform_device *pdev) | |||
939 | ret = ipc_create_pmc_devices(); | 924 | ret = ipc_create_pmc_devices(); |
940 | if (ret) { | 925 | if (ret) { |
941 | dev_err(&pdev->dev, "Failed to create pmc devices\n"); | 926 | dev_err(&pdev->dev, "Failed to create pmc devices\n"); |
942 | goto err_device; | 927 | return ret; |
943 | } | 928 | } |
944 | 929 | ||
945 | if (request_irq(ipcdev.irq, ioc, IRQF_NO_SUSPEND, | 930 | if (devm_request_irq(&pdev->dev, ipcdev.irq, ioc, IRQF_NO_SUSPEND, |
946 | "intel_pmc_ipc", &ipcdev)) { | 931 | "intel_pmc_ipc", &ipcdev)) { |
947 | dev_err(&pdev->dev, "Failed to request irq\n"); | 932 | dev_err(&pdev->dev, "Failed to request irq\n"); |
948 | ret = -EBUSY; | 933 | ret = -EBUSY; |
949 | goto err_irq; | 934 | goto err_irq; |
@@ -960,40 +945,22 @@ static int ipc_plat_probe(struct platform_device *pdev) | |||
960 | 945 | ||
961 | return 0; | 946 | return 0; |
962 | err_sys: | 947 | err_sys: |
963 | free_irq(ipcdev.irq, &ipcdev); | 948 | devm_free_irq(&pdev->dev, ipcdev.irq, &ipcdev); |
964 | err_irq: | 949 | err_irq: |
965 | platform_device_unregister(ipcdev.tco_dev); | 950 | platform_device_unregister(ipcdev.tco_dev); |
966 | platform_device_unregister(ipcdev.punit_dev); | 951 | platform_device_unregister(ipcdev.punit_dev); |
967 | platform_device_unregister(ipcdev.telemetry_dev); | 952 | platform_device_unregister(ipcdev.telemetry_dev); |
968 | err_device: | 953 | |
969 | iounmap(ipcdev.ipc_base); | ||
970 | res = platform_get_resource(pdev, IORESOURCE_MEM, | ||
971 | PLAT_RESOURCE_IPC_INDEX); | ||
972 | if (res) { | ||
973 | release_mem_region(res->start, | ||
974 | PLAT_RESOURCE_IPC_SIZE + | ||
975 | PLAT_RESOURCE_GCR_SIZE); | ||
976 | } | ||
977 | return ret; | 954 | return ret; |
978 | } | 955 | } |
979 | 956 | ||
980 | static int ipc_plat_remove(struct platform_device *pdev) | 957 | static int ipc_plat_remove(struct platform_device *pdev) |
981 | { | 958 | { |
982 | struct resource *res; | ||
983 | |||
984 | sysfs_remove_group(&pdev->dev.kobj, &intel_ipc_group); | 959 | sysfs_remove_group(&pdev->dev.kobj, &intel_ipc_group); |
985 | free_irq(ipcdev.irq, &ipcdev); | 960 | devm_free_irq(&pdev->dev, ipcdev.irq, &ipcdev); |
986 | platform_device_unregister(ipcdev.tco_dev); | 961 | platform_device_unregister(ipcdev.tco_dev); |
987 | platform_device_unregister(ipcdev.punit_dev); | 962 | platform_device_unregister(ipcdev.punit_dev); |
988 | platform_device_unregister(ipcdev.telemetry_dev); | 963 | platform_device_unregister(ipcdev.telemetry_dev); |
989 | iounmap(ipcdev.ipc_base); | ||
990 | res = platform_get_resource(pdev, IORESOURCE_MEM, | ||
991 | PLAT_RESOURCE_IPC_INDEX); | ||
992 | if (res) { | ||
993 | release_mem_region(res->start, | ||
994 | PLAT_RESOURCE_IPC_SIZE + | ||
995 | PLAT_RESOURCE_GCR_SIZE); | ||
996 | } | ||
997 | ipcdev.dev = NULL; | 964 | ipcdev.dev = NULL; |
998 | return 0; | 965 | return 0; |
999 | } | 966 | } |
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index f18b36dd57dd..376a99b7cf5d 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c | |||
@@ -590,7 +590,7 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id) | |||
590 | case AXP803_DCDC3: | 590 | case AXP803_DCDC3: |
591 | return !!(reg & BIT(6)); | 591 | return !!(reg & BIT(6)); |
592 | case AXP803_DCDC6: | 592 | case AXP803_DCDC6: |
593 | return !!(reg & BIT(7)); | 593 | return !!(reg & BIT(5)); |
594 | } | 594 | } |
595 | break; | 595 | break; |
596 | 596 | ||
diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c index ef2be56460fe..790a4a73ea2c 100644 --- a/drivers/regulator/rn5t618-regulator.c +++ b/drivers/regulator/rn5t618-regulator.c | |||
@@ -29,7 +29,7 @@ static const struct regulator_ops rn5t618_reg_ops = { | |||
29 | }; | 29 | }; |
30 | 30 | ||
31 | #define REG(rid, ereg, emask, vreg, vmask, min, max, step) \ | 31 | #define REG(rid, ereg, emask, vreg, vmask, min, max, step) \ |
32 | [RN5T618_##rid] = { \ | 32 | { \ |
33 | .name = #rid, \ | 33 | .name = #rid, \ |
34 | .of_match = of_match_ptr(#rid), \ | 34 | .of_match = of_match_ptr(#rid), \ |
35 | .regulators_node = of_match_ptr("regulators"), \ | 35 | .regulators_node = of_match_ptr("regulators"), \ |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 82ac331d9125..84752152d41f 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -357,6 +357,8 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
357 | 357 | ||
358 | adapter->next_port_scan = jiffies; | 358 | adapter->next_port_scan = jiffies; |
359 | 359 | ||
360 | adapter->erp_action.adapter = adapter; | ||
361 | |||
360 | if (zfcp_qdio_setup(adapter)) | 362 | if (zfcp_qdio_setup(adapter)) |
361 | goto failed; | 363 | goto failed; |
362 | 364 | ||
@@ -513,6 +515,9 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, | |||
513 | port->dev.groups = zfcp_port_attr_groups; | 515 | port->dev.groups = zfcp_port_attr_groups; |
514 | port->dev.release = zfcp_port_release; | 516 | port->dev.release = zfcp_port_release; |
515 | 517 | ||
518 | port->erp_action.adapter = adapter; | ||
519 | port->erp_action.port = port; | ||
520 | |||
516 | if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) { | 521 | if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) { |
517 | kfree(port); | 522 | kfree(port); |
518 | goto err_out; | 523 | goto err_out; |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 37408f5f81ce..ec2532ee1822 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -193,9 +193,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
193 | atomic_or(ZFCP_STATUS_COMMON_ERP_INUSE, | 193 | atomic_or(ZFCP_STATUS_COMMON_ERP_INUSE, |
194 | &zfcp_sdev->status); | 194 | &zfcp_sdev->status); |
195 | erp_action = &zfcp_sdev->erp_action; | 195 | erp_action = &zfcp_sdev->erp_action; |
196 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | 196 | WARN_ON_ONCE(erp_action->port != port); |
197 | erp_action->port = port; | 197 | WARN_ON_ONCE(erp_action->sdev != sdev); |
198 | erp_action->sdev = sdev; | ||
199 | if (!(atomic_read(&zfcp_sdev->status) & | 198 | if (!(atomic_read(&zfcp_sdev->status) & |
200 | ZFCP_STATUS_COMMON_RUNNING)) | 199 | ZFCP_STATUS_COMMON_RUNNING)) |
201 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; | 200 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; |
@@ -208,8 +207,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
208 | zfcp_erp_action_dismiss_port(port); | 207 | zfcp_erp_action_dismiss_port(port); |
209 | atomic_or(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); | 208 | atomic_or(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); |
210 | erp_action = &port->erp_action; | 209 | erp_action = &port->erp_action; |
211 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | 210 | WARN_ON_ONCE(erp_action->port != port); |
212 | erp_action->port = port; | 211 | WARN_ON_ONCE(erp_action->sdev != NULL); |
213 | if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_RUNNING)) | 212 | if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_RUNNING)) |
214 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; | 213 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; |
215 | break; | 214 | break; |
@@ -219,7 +218,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
219 | zfcp_erp_action_dismiss_adapter(adapter); | 218 | zfcp_erp_action_dismiss_adapter(adapter); |
220 | atomic_or(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); | 219 | atomic_or(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); |
221 | erp_action = &adapter->erp_action; | 220 | erp_action = &adapter->erp_action; |
222 | memset(erp_action, 0, sizeof(struct zfcp_erp_action)); | 221 | WARN_ON_ONCE(erp_action->port != NULL); |
222 | WARN_ON_ONCE(erp_action->sdev != NULL); | ||
223 | if (!(atomic_read(&adapter->status) & | 223 | if (!(atomic_read(&adapter->status) & |
224 | ZFCP_STATUS_COMMON_RUNNING)) | 224 | ZFCP_STATUS_COMMON_RUNNING)) |
225 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; | 225 | act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; |
@@ -229,7 +229,11 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, | |||
229 | return NULL; | 229 | return NULL; |
230 | } | 230 | } |
231 | 231 | ||
232 | erp_action->adapter = adapter; | 232 | WARN_ON_ONCE(erp_action->adapter != adapter); |
233 | memset(&erp_action->list, 0, sizeof(erp_action->list)); | ||
234 | memset(&erp_action->timer, 0, sizeof(erp_action->timer)); | ||
235 | erp_action->step = ZFCP_ERP_STEP_UNINITIALIZED; | ||
236 | erp_action->fsf_req_id = 0; | ||
233 | erp_action->action = need; | 237 | erp_action->action = need; |
234 | erp_action->status = act_status; | 238 | erp_action->status = act_status; |
235 | 239 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index ec3ddd1d31d5..6cf8732627e0 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -115,10 +115,15 @@ static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) | |||
115 | struct zfcp_unit *unit; | 115 | struct zfcp_unit *unit; |
116 | int npiv = adapter->connection_features & FSF_FEATURE_NPIV_MODE; | 116 | int npiv = adapter->connection_features & FSF_FEATURE_NPIV_MODE; |
117 | 117 | ||
118 | zfcp_sdev->erp_action.adapter = adapter; | ||
119 | zfcp_sdev->erp_action.sdev = sdev; | ||
120 | |||
118 | port = zfcp_get_port_by_wwpn(adapter, rport->port_name); | 121 | port = zfcp_get_port_by_wwpn(adapter, rport->port_name); |
119 | if (!port) | 122 | if (!port) |
120 | return -ENXIO; | 123 | return -ENXIO; |
121 | 124 | ||
125 | zfcp_sdev->erp_action.port = port; | ||
126 | |||
122 | unit = zfcp_unit_find(port, zfcp_scsi_dev_lun(sdev)); | 127 | unit = zfcp_unit_find(port, zfcp_scsi_dev_lun(sdev)); |
123 | if (unit) | 128 | if (unit) |
124 | put_device(&unit->dev); | 129 | put_device(&unit->dev); |
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 97d269f16888..1bc623ad3faf 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -302,9 +302,11 @@ int aac_send_shutdown(struct aac_dev * dev) | |||
302 | return -ENOMEM; | 302 | return -ENOMEM; |
303 | aac_fib_init(fibctx); | 303 | aac_fib_init(fibctx); |
304 | 304 | ||
305 | mutex_lock(&dev->ioctl_mutex); | 305 | if (!dev->adapter_shutdown) { |
306 | dev->adapter_shutdown = 1; | 306 | mutex_lock(&dev->ioctl_mutex); |
307 | mutex_unlock(&dev->ioctl_mutex); | 307 | dev->adapter_shutdown = 1; |
308 | mutex_unlock(&dev->ioctl_mutex); | ||
309 | } | ||
308 | 310 | ||
309 | cmd = (struct aac_close *) fib_data(fibctx); | 311 | cmd = (struct aac_close *) fib_data(fibctx); |
310 | cmd->command = cpu_to_le32(VM_CloseAll); | 312 | cmd->command = cpu_to_le32(VM_CloseAll); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 62beb2596466..c9252b138c1f 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -1551,8 +1551,9 @@ static void __aac_shutdown(struct aac_dev * aac) | |||
1551 | { | 1551 | { |
1552 | int i; | 1552 | int i; |
1553 | 1553 | ||
1554 | mutex_lock(&aac->ioctl_mutex); | ||
1554 | aac->adapter_shutdown = 1; | 1555 | aac->adapter_shutdown = 1; |
1555 | aac_send_shutdown(aac); | 1556 | mutex_unlock(&aac->ioctl_mutex); |
1556 | 1557 | ||
1557 | if (aac->aif_thread) { | 1558 | if (aac->aif_thread) { |
1558 | int i; | 1559 | int i; |
@@ -1565,7 +1566,11 @@ static void __aac_shutdown(struct aac_dev * aac) | |||
1565 | } | 1566 | } |
1566 | kthread_stop(aac->thread); | 1567 | kthread_stop(aac->thread); |
1567 | } | 1568 | } |
1569 | |||
1570 | aac_send_shutdown(aac); | ||
1571 | |||
1568 | aac_adapter_disable_int(aac); | 1572 | aac_adapter_disable_int(aac); |
1573 | |||
1569 | if (aac_is_src(aac)) { | 1574 | if (aac_is_src(aac)) { |
1570 | if (aac->max_msix > 1) { | 1575 | if (aac->max_msix > 1) { |
1571 | for (i = 0; i < aac->max_msix; i++) { | 1576 | for (i = 0; i < aac->max_msix; i++) { |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 9abe81021484..4ed3d26ffdde 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -4091,7 +4091,7 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h, | |||
4091 | memset(id_ctlr, 0, sizeof(*id_ctlr)); | 4091 | memset(id_ctlr, 0, sizeof(*id_ctlr)); |
4092 | rc = hpsa_bmic_id_controller(h, id_ctlr, sizeof(*id_ctlr)); | 4092 | rc = hpsa_bmic_id_controller(h, id_ctlr, sizeof(*id_ctlr)); |
4093 | if (!rc) | 4093 | if (!rc) |
4094 | if (id_ctlr->configured_logical_drive_count < 256) | 4094 | if (id_ctlr->configured_logical_drive_count < 255) |
4095 | *nlocals = id_ctlr->configured_logical_drive_count; | 4095 | *nlocals = id_ctlr->configured_logical_drive_count; |
4096 | else | 4096 | else |
4097 | *nlocals = le16_to_cpu( | 4097 | *nlocals = le16_to_cpu( |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 937209805baf..3bd956d3bc5d 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -3061,6 +3061,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
3061 | host->max_cmd_len, host->max_channel, host->max_lun, | 3061 | host->max_cmd_len, host->max_channel, host->max_lun, |
3062 | host->transportt, sht->vendor_id); | 3062 | host->transportt, sht->vendor_id); |
3063 | 3063 | ||
3064 | INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); | ||
3065 | |||
3064 | /* Set up the irqs */ | 3066 | /* Set up the irqs */ |
3065 | ret = qla2x00_request_irqs(ha, rsp); | 3067 | ret = qla2x00_request_irqs(ha, rsp); |
3066 | if (ret) | 3068 | if (ret) |
@@ -3175,8 +3177,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
3175 | host->can_queue, base_vha->req, | 3177 | host->can_queue, base_vha->req, |
3176 | base_vha->mgmt_svr_loop_id, host->sg_tablesize); | 3178 | base_vha->mgmt_svr_loop_id, host->sg_tablesize); |
3177 | 3179 | ||
3178 | INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); | ||
3179 | |||
3180 | if (ha->mqenable) { | 3180 | if (ha->mqenable) { |
3181 | bool mq = false; | 3181 | bool mq = false; |
3182 | bool startit = false; | 3182 | bool startit = false; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9cf6a80fe297..ad3ea24f0885 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1379,8 +1379,6 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req) | |||
1379 | 1379 | ||
1380 | ret = scsi_setup_cmnd(sdev, req); | 1380 | ret = scsi_setup_cmnd(sdev, req); |
1381 | out: | 1381 | out: |
1382 | if (ret != BLKPREP_OK) | ||
1383 | cmd->flags &= ~SCMD_INITIALIZED; | ||
1384 | return scsi_prep_return(q, req, ret); | 1382 | return scsi_prep_return(q, req, ret); |
1385 | } | 1383 | } |
1386 | 1384 | ||
@@ -1900,7 +1898,6 @@ static int scsi_mq_prep_fn(struct request *req) | |||
1900 | struct scsi_device *sdev = req->q->queuedata; | 1898 | struct scsi_device *sdev = req->q->queuedata; |
1901 | struct Scsi_Host *shost = sdev->host; | 1899 | struct Scsi_Host *shost = sdev->host; |
1902 | struct scatterlist *sg; | 1900 | struct scatterlist *sg; |
1903 | int ret; | ||
1904 | 1901 | ||
1905 | scsi_init_command(sdev, cmd); | 1902 | scsi_init_command(sdev, cmd); |
1906 | 1903 | ||
@@ -1934,10 +1931,7 @@ static int scsi_mq_prep_fn(struct request *req) | |||
1934 | 1931 | ||
1935 | blk_mq_start_request(req); | 1932 | blk_mq_start_request(req); |
1936 | 1933 | ||
1937 | ret = scsi_setup_cmnd(sdev, req); | 1934 | return scsi_setup_cmnd(sdev, req); |
1938 | if (ret != BLK_STS_OK) | ||
1939 | cmd->flags &= ~SCMD_INITIALIZED; | ||
1940 | return ret; | ||
1941 | } | 1935 | } |
1942 | 1936 | ||
1943 | static void scsi_mq_done(struct scsi_cmnd *cmd) | 1937 | static void scsi_mq_done(struct scsi_cmnd *cmd) |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 0419c2298eab..aa28874e8fb9 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -837,7 +837,7 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo) | |||
837 | 837 | ||
838 | val = 0; | 838 | val = 0; |
839 | list_for_each_entry(srp, &sfp->rq_list, entry) { | 839 | list_for_each_entry(srp, &sfp->rq_list, entry) { |
840 | if (val > SG_MAX_QUEUE) | 840 | if (val >= SG_MAX_QUEUE) |
841 | break; | 841 | break; |
842 | rinfo[val].req_state = srp->done + 1; | 842 | rinfo[val].req_state = srp->done + 1; |
843 | rinfo[val].problem = | 843 | rinfo[val].problem = |
diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index 6c7d7a460689..568e1c65aa82 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c | |||
@@ -99,11 +99,6 @@ | |||
99 | /* A3700_SPI_IF_TIME_REG */ | 99 | /* A3700_SPI_IF_TIME_REG */ |
100 | #define A3700_SPI_CLK_CAPT_EDGE BIT(7) | 100 | #define A3700_SPI_CLK_CAPT_EDGE BIT(7) |
101 | 101 | ||
102 | /* Flags and macros for struct a3700_spi */ | ||
103 | #define A3700_INSTR_CNT 1 | ||
104 | #define A3700_ADDR_CNT 3 | ||
105 | #define A3700_DUMMY_CNT 1 | ||
106 | |||
107 | struct a3700_spi { | 102 | struct a3700_spi { |
108 | struct spi_master *master; | 103 | struct spi_master *master; |
109 | void __iomem *base; | 104 | void __iomem *base; |
@@ -117,9 +112,6 @@ struct a3700_spi { | |||
117 | u8 byte_len; | 112 | u8 byte_len; |
118 | u32 wait_mask; | 113 | u32 wait_mask; |
119 | struct completion done; | 114 | struct completion done; |
120 | u32 addr_cnt; | ||
121 | u32 instr_cnt; | ||
122 | size_t hdr_cnt; | ||
123 | }; | 115 | }; |
124 | 116 | ||
125 | static u32 spireg_read(struct a3700_spi *a3700_spi, u32 offset) | 117 | static u32 spireg_read(struct a3700_spi *a3700_spi, u32 offset) |
@@ -161,7 +153,7 @@ static void a3700_spi_deactivate_cs(struct a3700_spi *a3700_spi, | |||
161 | } | 153 | } |
162 | 154 | ||
163 | static int a3700_spi_pin_mode_set(struct a3700_spi *a3700_spi, | 155 | static int a3700_spi_pin_mode_set(struct a3700_spi *a3700_spi, |
164 | unsigned int pin_mode) | 156 | unsigned int pin_mode, bool receiving) |
165 | { | 157 | { |
166 | u32 val; | 158 | u32 val; |
167 | 159 | ||
@@ -177,6 +169,9 @@ static int a3700_spi_pin_mode_set(struct a3700_spi *a3700_spi, | |||
177 | break; | 169 | break; |
178 | case SPI_NBITS_QUAD: | 170 | case SPI_NBITS_QUAD: |
179 | val |= A3700_SPI_DATA_PIN1; | 171 | val |= A3700_SPI_DATA_PIN1; |
172 | /* RX during address reception uses 4-pin */ | ||
173 | if (receiving) | ||
174 | val |= A3700_SPI_ADDR_PIN; | ||
180 | break; | 175 | break; |
181 | default: | 176 | default: |
182 | dev_err(&a3700_spi->master->dev, "wrong pin mode %u", pin_mode); | 177 | dev_err(&a3700_spi->master->dev, "wrong pin mode %u", pin_mode); |
@@ -392,7 +387,8 @@ static bool a3700_spi_wait_completion(struct spi_device *spi) | |||
392 | 387 | ||
393 | spireg_write(a3700_spi, A3700_SPI_INT_MASK_REG, 0); | 388 | spireg_write(a3700_spi, A3700_SPI_INT_MASK_REG, 0); |
394 | 389 | ||
395 | return true; | 390 | /* Timeout was reached */ |
391 | return false; | ||
396 | } | 392 | } |
397 | 393 | ||
398 | static bool a3700_spi_transfer_wait(struct spi_device *spi, | 394 | static bool a3700_spi_transfer_wait(struct spi_device *spi, |
@@ -446,59 +442,43 @@ static void a3700_spi_set_cs(struct spi_device *spi, bool enable) | |||
446 | 442 | ||
447 | static void a3700_spi_header_set(struct a3700_spi *a3700_spi) | 443 | static void a3700_spi_header_set(struct a3700_spi *a3700_spi) |
448 | { | 444 | { |
449 | u32 instr_cnt = 0, addr_cnt = 0, dummy_cnt = 0; | 445 | unsigned int addr_cnt; |
450 | u32 val = 0; | 446 | u32 val = 0; |
451 | 447 | ||
452 | /* Clear the header registers */ | 448 | /* Clear the header registers */ |
453 | spireg_write(a3700_spi, A3700_SPI_IF_INST_REG, 0); | 449 | spireg_write(a3700_spi, A3700_SPI_IF_INST_REG, 0); |
454 | spireg_write(a3700_spi, A3700_SPI_IF_ADDR_REG, 0); | 450 | spireg_write(a3700_spi, A3700_SPI_IF_ADDR_REG, 0); |
455 | spireg_write(a3700_spi, A3700_SPI_IF_RMODE_REG, 0); | 451 | spireg_write(a3700_spi, A3700_SPI_IF_RMODE_REG, 0); |
452 | spireg_write(a3700_spi, A3700_SPI_IF_HDR_CNT_REG, 0); | ||
456 | 453 | ||
457 | /* Set header counters */ | 454 | /* Set header counters */ |
458 | if (a3700_spi->tx_buf) { | 455 | if (a3700_spi->tx_buf) { |
459 | if (a3700_spi->buf_len <= a3700_spi->instr_cnt) { | 456 | /* |
460 | instr_cnt = a3700_spi->buf_len; | 457 | * when tx data is not 4 bytes aligned, there will be unexpected |
461 | } else if (a3700_spi->buf_len <= (a3700_spi->instr_cnt + | 458 | * bytes out of SPI output register, since it always shifts out |
462 | a3700_spi->addr_cnt)) { | 459 | * as whole 4 bytes. This might cause incorrect transaction with |
463 | instr_cnt = a3700_spi->instr_cnt; | 460 | * some devices. To avoid that, use SPI header count feature to |
464 | addr_cnt = a3700_spi->buf_len - instr_cnt; | 461 | * transfer up to 3 bytes of data first, and then make the rest |
465 | } else if (a3700_spi->buf_len <= a3700_spi->hdr_cnt) { | 462 | * of data 4-byte aligned. |
466 | instr_cnt = a3700_spi->instr_cnt; | 463 | */ |
467 | addr_cnt = a3700_spi->addr_cnt; | 464 | addr_cnt = a3700_spi->buf_len % 4; |
468 | /* Need to handle the normal write case with 1 byte | 465 | if (addr_cnt) { |
469 | * data | 466 | val = (addr_cnt & A3700_SPI_ADDR_CNT_MASK) |
470 | */ | 467 | << A3700_SPI_ADDR_CNT_BIT; |
471 | if (!a3700_spi->tx_buf[instr_cnt + addr_cnt]) | 468 | spireg_write(a3700_spi, A3700_SPI_IF_HDR_CNT_REG, val); |
472 | dummy_cnt = a3700_spi->buf_len - instr_cnt - | 469 | |
473 | addr_cnt; | 470 | /* Update the buffer length to be transferred */ |
471 | a3700_spi->buf_len -= addr_cnt; | ||
472 | |||
473 | /* transfer 1~3 bytes through address count */ | ||
474 | val = 0; | ||
475 | while (addr_cnt--) { | ||
476 | val = (val << 8) | a3700_spi->tx_buf[0]; | ||
477 | a3700_spi->tx_buf++; | ||
478 | } | ||
479 | spireg_write(a3700_spi, A3700_SPI_IF_ADDR_REG, val); | ||
474 | } | 480 | } |
475 | val |= ((instr_cnt & A3700_SPI_INSTR_CNT_MASK) | ||
476 | << A3700_SPI_INSTR_CNT_BIT); | ||
477 | val |= ((addr_cnt & A3700_SPI_ADDR_CNT_MASK) | ||
478 | << A3700_SPI_ADDR_CNT_BIT); | ||
479 | val |= ((dummy_cnt & A3700_SPI_DUMMY_CNT_MASK) | ||
480 | << A3700_SPI_DUMMY_CNT_BIT); | ||
481 | } | 481 | } |
482 | spireg_write(a3700_spi, A3700_SPI_IF_HDR_CNT_REG, val); | ||
483 | |||
484 | /* Update the buffer length to be transferred */ | ||
485 | a3700_spi->buf_len -= (instr_cnt + addr_cnt + dummy_cnt); | ||
486 | |||
487 | /* Set Instruction */ | ||
488 | val = 0; | ||
489 | while (instr_cnt--) { | ||
490 | val = (val << 8) | a3700_spi->tx_buf[0]; | ||
491 | a3700_spi->tx_buf++; | ||
492 | } | ||
493 | spireg_write(a3700_spi, A3700_SPI_IF_INST_REG, val); | ||
494 | |||
495 | /* Set Address */ | ||
496 | val = 0; | ||
497 | while (addr_cnt--) { | ||
498 | val = (val << 8) | a3700_spi->tx_buf[0]; | ||
499 | a3700_spi->tx_buf++; | ||
500 | } | ||
501 | spireg_write(a3700_spi, A3700_SPI_IF_ADDR_REG, val); | ||
502 | } | 482 | } |
503 | 483 | ||
504 | static int a3700_is_wfifo_full(struct a3700_spi *a3700_spi) | 484 | static int a3700_is_wfifo_full(struct a3700_spi *a3700_spi) |
@@ -512,35 +492,12 @@ static int a3700_is_wfifo_full(struct a3700_spi *a3700_spi) | |||
512 | static int a3700_spi_fifo_write(struct a3700_spi *a3700_spi) | 492 | static int a3700_spi_fifo_write(struct a3700_spi *a3700_spi) |
513 | { | 493 | { |
514 | u32 val; | 494 | u32 val; |
515 | int i = 0; | ||
516 | 495 | ||
517 | while (!a3700_is_wfifo_full(a3700_spi) && a3700_spi->buf_len) { | 496 | while (!a3700_is_wfifo_full(a3700_spi) && a3700_spi->buf_len) { |
518 | val = 0; | 497 | val = cpu_to_le32(*(u32 *)a3700_spi->tx_buf); |
519 | if (a3700_spi->buf_len >= 4) { | 498 | spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, val); |
520 | val = cpu_to_le32(*(u32 *)a3700_spi->tx_buf); | 499 | a3700_spi->buf_len -= 4; |
521 | spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, val); | 500 | a3700_spi->tx_buf += 4; |
522 | |||
523 | a3700_spi->buf_len -= 4; | ||
524 | a3700_spi->tx_buf += 4; | ||
525 | } else { | ||
526 | /* | ||
527 | * If the remained buffer length is less than 4-bytes, | ||
528 | * we should pad the write buffer with all ones. So that | ||
529 | * it avoids overwrite the unexpected bytes following | ||
530 | * the last one. | ||
531 | */ | ||
532 | val = GENMASK(31, 0); | ||
533 | while (a3700_spi->buf_len) { | ||
534 | val &= ~(0xff << (8 * i)); | ||
535 | val |= *a3700_spi->tx_buf++ << (8 * i); | ||
536 | i++; | ||
537 | a3700_spi->buf_len--; | ||
538 | |||
539 | spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, | ||
540 | val); | ||
541 | } | ||
542 | break; | ||
543 | } | ||
544 | } | 501 | } |
545 | 502 | ||
546 | return 0; | 503 | return 0; |
@@ -645,15 +602,18 @@ static int a3700_spi_transfer_one(struct spi_master *master, | |||
645 | a3700_spi->rx_buf = xfer->rx_buf; | 602 | a3700_spi->rx_buf = xfer->rx_buf; |
646 | a3700_spi->buf_len = xfer->len; | 603 | a3700_spi->buf_len = xfer->len; |
647 | 604 | ||
648 | /* SPI transfer headers */ | ||
649 | a3700_spi_header_set(a3700_spi); | ||
650 | |||
651 | if (xfer->tx_buf) | 605 | if (xfer->tx_buf) |
652 | nbits = xfer->tx_nbits; | 606 | nbits = xfer->tx_nbits; |
653 | else if (xfer->rx_buf) | 607 | else if (xfer->rx_buf) |
654 | nbits = xfer->rx_nbits; | 608 | nbits = xfer->rx_nbits; |
655 | 609 | ||
656 | a3700_spi_pin_mode_set(a3700_spi, nbits); | 610 | a3700_spi_pin_mode_set(a3700_spi, nbits, xfer->rx_buf ? true : false); |
611 | |||
612 | /* Flush the FIFOs */ | ||
613 | a3700_spi_fifo_flush(a3700_spi); | ||
614 | |||
615 | /* Transfer first bytes of data when buffer is not 4-byte aligned */ | ||
616 | a3700_spi_header_set(a3700_spi); | ||
657 | 617 | ||
658 | if (xfer->rx_buf) { | 618 | if (xfer->rx_buf) { |
659 | /* Set read data length */ | 619 | /* Set read data length */ |
@@ -733,16 +693,11 @@ static int a3700_spi_transfer_one(struct spi_master *master, | |||
733 | dev_err(&spi->dev, "wait wfifo empty timed out\n"); | 693 | dev_err(&spi->dev, "wait wfifo empty timed out\n"); |
734 | return -ETIMEDOUT; | 694 | return -ETIMEDOUT; |
735 | } | 695 | } |
736 | } else { | 696 | } |
737 | /* | 697 | |
738 | * If the instruction in SPI_INSTR does not require data | 698 | if (!a3700_spi_transfer_wait(spi, A3700_SPI_XFER_RDY)) { |
739 | * to be written to the SPI device, wait until SPI_RDY | 699 | dev_err(&spi->dev, "wait xfer ready timed out\n"); |
740 | * is 1 for the SPI interface to be in idle. | 700 | return -ETIMEDOUT; |
741 | */ | ||
742 | if (!a3700_spi_transfer_wait(spi, A3700_SPI_XFER_RDY)) { | ||
743 | dev_err(&spi->dev, "wait xfer ready timed out\n"); | ||
744 | return -ETIMEDOUT; | ||
745 | } | ||
746 | } | 701 | } |
747 | 702 | ||
748 | val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); | 703 | val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); |
@@ -834,10 +789,6 @@ static int a3700_spi_probe(struct platform_device *pdev) | |||
834 | memset(spi, 0, sizeof(struct a3700_spi)); | 789 | memset(spi, 0, sizeof(struct a3700_spi)); |
835 | 790 | ||
836 | spi->master = master; | 791 | spi->master = master; |
837 | spi->instr_cnt = A3700_INSTR_CNT; | ||
838 | spi->addr_cnt = A3700_ADDR_CNT; | ||
839 | spi->hdr_cnt = A3700_INSTR_CNT + A3700_ADDR_CNT + | ||
840 | A3700_DUMMY_CNT; | ||
841 | 792 | ||
842 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 793 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
843 | spi->base = devm_ioremap_resource(dev, res); | 794 | spi->base = devm_ioremap_resource(dev, res); |
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c index 6ef6c44f39f5..a172ab299e80 100644 --- a/drivers/spi/spi-bcm-qspi.c +++ b/drivers/spi/spi-bcm-qspi.c | |||
@@ -1250,7 +1250,7 @@ int bcm_qspi_probe(struct platform_device *pdev, | |||
1250 | goto qspi_probe_err; | 1250 | goto qspi_probe_err; |
1251 | } | 1251 | } |
1252 | } else { | 1252 | } else { |
1253 | goto qspi_probe_err; | 1253 | goto qspi_resource_err; |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bspi"); | 1256 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "bspi"); |
@@ -1272,7 +1272,7 @@ int bcm_qspi_probe(struct platform_device *pdev, | |||
1272 | qspi->base[CHIP_SELECT] = devm_ioremap_resource(dev, res); | 1272 | qspi->base[CHIP_SELECT] = devm_ioremap_resource(dev, res); |
1273 | if (IS_ERR(qspi->base[CHIP_SELECT])) { | 1273 | if (IS_ERR(qspi->base[CHIP_SELECT])) { |
1274 | ret = PTR_ERR(qspi->base[CHIP_SELECT]); | 1274 | ret = PTR_ERR(qspi->base[CHIP_SELECT]); |
1275 | goto qspi_probe_err; | 1275 | goto qspi_resource_err; |
1276 | } | 1276 | } |
1277 | } | 1277 | } |
1278 | 1278 | ||
@@ -1280,7 +1280,7 @@ int bcm_qspi_probe(struct platform_device *pdev, | |||
1280 | GFP_KERNEL); | 1280 | GFP_KERNEL); |
1281 | if (!qspi->dev_ids) { | 1281 | if (!qspi->dev_ids) { |
1282 | ret = -ENOMEM; | 1282 | ret = -ENOMEM; |
1283 | goto qspi_probe_err; | 1283 | goto qspi_resource_err; |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | for (val = 0; val < num_irqs; val++) { | 1286 | for (val = 0; val < num_irqs; val++) { |
@@ -1369,8 +1369,9 @@ qspi_reg_err: | |||
1369 | bcm_qspi_hw_uninit(qspi); | 1369 | bcm_qspi_hw_uninit(qspi); |
1370 | clk_disable_unprepare(qspi->clk); | 1370 | clk_disable_unprepare(qspi->clk); |
1371 | qspi_probe_err: | 1371 | qspi_probe_err: |
1372 | spi_master_put(master); | ||
1373 | kfree(qspi->dev_ids); | 1372 | kfree(qspi->dev_ids); |
1373 | qspi_resource_err: | ||
1374 | spi_master_put(master); | ||
1374 | return ret; | 1375 | return ret; |
1375 | } | 1376 | } |
1376 | /* probe function to be called by SoC specific platform driver probe */ | 1377 | /* probe function to be called by SoC specific platform driver probe */ |
diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index 680cdf549506..ba9743fa2326 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c | |||
@@ -263,8 +263,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz) | |||
263 | * no need to check it there. | 263 | * no need to check it there. |
264 | * However, we need to ensure the following calculations. | 264 | * However, we need to ensure the following calculations. |
265 | */ | 265 | */ |
266 | if ((div < SPI_MBR_DIV_MIN) && | 266 | if (div < SPI_MBR_DIV_MIN || |
267 | (div > SPI_MBR_DIV_MAX)) | 267 | div > SPI_MBR_DIV_MAX) |
268 | return -EINVAL; | 268 | return -EINVAL; |
269 | 269 | ||
270 | /* Determine the first power of 2 greater than or equal to div */ | 270 | /* Determine the first power of 2 greater than or equal to div */ |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6e65524cbfd9..e8b5a5e21b2e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -45,7 +45,6 @@ | |||
45 | 45 | ||
46 | #define CREATE_TRACE_POINTS | 46 | #define CREATE_TRACE_POINTS |
47 | #include <trace/events/spi.h> | 47 | #include <trace/events/spi.h> |
48 | #define SPI_DYN_FIRST_BUS_NUM 0 | ||
49 | 48 | ||
50 | static DEFINE_IDR(spi_master_idr); | 49 | static DEFINE_IDR(spi_master_idr); |
51 | 50 | ||
@@ -2086,7 +2085,7 @@ int spi_register_controller(struct spi_controller *ctlr) | |||
2086 | struct device *dev = ctlr->dev.parent; | 2085 | struct device *dev = ctlr->dev.parent; |
2087 | struct boardinfo *bi; | 2086 | struct boardinfo *bi; |
2088 | int status = -ENODEV; | 2087 | int status = -ENODEV; |
2089 | int id; | 2088 | int id, first_dynamic; |
2090 | 2089 | ||
2091 | if (!dev) | 2090 | if (!dev) |
2092 | return -ENODEV; | 2091 | return -ENODEV; |
@@ -2116,9 +2115,15 @@ int spi_register_controller(struct spi_controller *ctlr) | |||
2116 | } | 2115 | } |
2117 | } | 2116 | } |
2118 | if (ctlr->bus_num < 0) { | 2117 | if (ctlr->bus_num < 0) { |
2118 | first_dynamic = of_alias_get_highest_id("spi"); | ||
2119 | if (first_dynamic < 0) | ||
2120 | first_dynamic = 0; | ||
2121 | else | ||
2122 | first_dynamic++; | ||
2123 | |||
2119 | mutex_lock(&board_lock); | 2124 | mutex_lock(&board_lock); |
2120 | id = idr_alloc(&spi_master_idr, ctlr, SPI_DYN_FIRST_BUS_NUM, 0, | 2125 | id = idr_alloc(&spi_master_idr, ctlr, first_dynamic, |
2121 | GFP_KERNEL); | 2126 | 0, GFP_KERNEL); |
2122 | mutex_unlock(&board_lock); | 2127 | mutex_unlock(&board_lock); |
2123 | if (WARN(id < 0, "couldn't get idr")) | 2128 | if (WARN(id < 0, "couldn't get idr")) |
2124 | return id; | 2129 | return id; |
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c index 1691760339da..02573c517d9d 100644 --- a/drivers/staging/iio/meter/ade7759.c +++ b/drivers/staging/iio/meter/ade7759.c | |||
@@ -172,7 +172,7 @@ static int ade7759_spi_read_reg_40(struct device *dev, | |||
172 | reg_address); | 172 | reg_address); |
173 | goto error_ret; | 173 | goto error_ret; |
174 | } | 174 | } |
175 | *val = ((u64)st->rx[1] << 32) | (st->rx[2] << 24) | | 175 | *val = ((u64)st->rx[1] << 32) | ((u64)st->rx[2] << 24) | |
176 | (st->rx[3] << 16) | (st->rx[4] << 8) | st->rx[5]; | 176 | (st->rx[3] << 16) | (st->rx[4] << 8) | st->rx[5]; |
177 | 177 | ||
178 | error_ret: | 178 | error_ret: |
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c index 5f3d8f2339e3..4be864dbd41c 100644 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | |||
@@ -390,8 +390,7 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream | |||
390 | __func__, instance); | 390 | __func__, instance); |
391 | instance->alsa_stream = alsa_stream; | 391 | instance->alsa_stream = alsa_stream; |
392 | alsa_stream->instance = instance; | 392 | alsa_stream->instance = instance; |
393 | ret = 0; // xxx todo -1; | 393 | return 0; |
394 | goto err_free_mem; | ||
395 | } | 394 | } |
396 | 395 | ||
397 | /* Initialize and create a VCHI connection */ | 396 | /* Initialize and create a VCHI connection */ |
@@ -401,16 +400,15 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream | |||
401 | LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", | 400 | LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", |
402 | __func__, ret); | 401 | __func__, ret); |
403 | 402 | ||
404 | ret = -EIO; | 403 | return -EIO; |
405 | goto err_free_mem; | ||
406 | } | 404 | } |
407 | ret = vchi_connect(NULL, 0, vchi_instance); | 405 | ret = vchi_connect(NULL, 0, vchi_instance); |
408 | if (ret) { | 406 | if (ret) { |
409 | LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", | 407 | LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", |
410 | __func__, ret); | 408 | __func__, ret); |
411 | 409 | ||
412 | ret = -EIO; | 410 | kfree(vchi_instance); |
413 | goto err_free_mem; | 411 | return -EIO; |
414 | } | 412 | } |
415 | initted = 1; | 413 | initted = 1; |
416 | } | 414 | } |
@@ -421,19 +419,16 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream | |||
421 | if (IS_ERR(instance)) { | 419 | if (IS_ERR(instance)) { |
422 | LOG_ERR("%s: failed to initialize audio service\n", __func__); | 420 | LOG_ERR("%s: failed to initialize audio service\n", __func__); |
423 | 421 | ||
424 | ret = PTR_ERR(instance); | 422 | /* vchi_instance is retained for use the next time. */ |
425 | goto err_free_mem; | 423 | return PTR_ERR(instance); |
426 | } | 424 | } |
427 | 425 | ||
428 | instance->alsa_stream = alsa_stream; | 426 | instance->alsa_stream = alsa_stream; |
429 | alsa_stream->instance = instance; | 427 | alsa_stream->instance = instance; |
430 | 428 | ||
431 | LOG_DBG(" success !\n"); | 429 | LOG_DBG(" success !\n"); |
432 | ret = 0; | ||
433 | err_free_mem: | ||
434 | kfree(vchi_instance); | ||
435 | 430 | ||
436 | return ret; | 431 | return 0; |
437 | } | 432 | } |
438 | 433 | ||
439 | int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) | 434 | int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream) |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 5e056064259c..18c923a4c16e 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1832,6 +1832,9 @@ static const struct usb_device_id acm_ids[] = { | |||
1832 | { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */ | 1832 | { USB_DEVICE(0xfff0, 0x0100), /* DATECS FP-2000 */ |
1833 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ | 1833 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ |
1834 | }, | 1834 | }, |
1835 | { USB_DEVICE(0x09d8, 0x0320), /* Elatec GmbH TWN3 */ | ||
1836 | .driver_info = NO_UNION_NORMAL, /* has misplaced union descriptor */ | ||
1837 | }, | ||
1835 | 1838 | ||
1836 | { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ | 1839 | { USB_DEVICE(0x2912, 0x0001), /* ATOL FPrint */ |
1837 | .driver_info = CLEAR_HALT_CONDITIONS, | 1840 | .driver_info = CLEAR_HALT_CONDITIONS, |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 68b54bd88d1e..883549ee946c 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -960,10 +960,12 @@ int usb_get_bos_descriptor(struct usb_device *dev) | |||
960 | for (i = 0; i < num; i++) { | 960 | for (i = 0; i < num; i++) { |
961 | buffer += length; | 961 | buffer += length; |
962 | cap = (struct usb_dev_cap_header *)buffer; | 962 | cap = (struct usb_dev_cap_header *)buffer; |
963 | length = cap->bLength; | ||
964 | 963 | ||
965 | if (total_len < length) | 964 | if (total_len < sizeof(*cap) || total_len < cap->bLength) { |
965 | dev->bos->desc->bNumDeviceCaps = i; | ||
966 | break; | 966 | break; |
967 | } | ||
968 | length = cap->bLength; | ||
967 | total_len -= length; | 969 | total_len -= length; |
968 | 970 | ||
969 | if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { | 971 | if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 4664e543cf2f..e9326f31db8d 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -1576,11 +1576,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb | |||
1576 | totlen += isopkt[u].length; | 1576 | totlen += isopkt[u].length; |
1577 | } | 1577 | } |
1578 | u *= sizeof(struct usb_iso_packet_descriptor); | 1578 | u *= sizeof(struct usb_iso_packet_descriptor); |
1579 | if (totlen <= uurb->buffer_length) | 1579 | uurb->buffer_length = totlen; |
1580 | uurb->buffer_length = totlen; | ||
1581 | else | ||
1582 | WARN_ONCE(1, "uurb->buffer_length is too short %d vs %d", | ||
1583 | totlen, uurb->buffer_length); | ||
1584 | break; | 1580 | break; |
1585 | 1581 | ||
1586 | default: | 1582 | default: |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b5c733613823..e9ce6bb0b22d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2710,13 +2710,16 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
2710 | if (!(portstatus & USB_PORT_STAT_CONNECTION)) | 2710 | if (!(portstatus & USB_PORT_STAT_CONNECTION)) |
2711 | return -ENOTCONN; | 2711 | return -ENOTCONN; |
2712 | 2712 | ||
2713 | /* bomb out completely if the connection bounced. A USB 3.0 | 2713 | /* Retry if connect change is set but status is still connected. |
2714 | * connection may bounce if multiple warm resets were issued, | 2714 | * A USB 3.0 connection may bounce if multiple warm resets were issued, |
2715 | * but the device may have successfully re-connected. Ignore it. | 2715 | * but the device may have successfully re-connected. Ignore it. |
2716 | */ | 2716 | */ |
2717 | if (!hub_is_superspeed(hub->hdev) && | 2717 | if (!hub_is_superspeed(hub->hdev) && |
2718 | (portchange & USB_PORT_STAT_C_CONNECTION)) | 2718 | (portchange & USB_PORT_STAT_C_CONNECTION)) { |
2719 | return -ENOTCONN; | 2719 | usb_clear_port_feature(hub->hdev, port1, |
2720 | USB_PORT_FEAT_C_CONNECTION); | ||
2721 | return -EAGAIN; | ||
2722 | } | ||
2720 | 2723 | ||
2721 | if (!(portstatus & USB_PORT_STAT_ENABLE)) | 2724 | if (!(portstatus & USB_PORT_STAT_ENABLE)) |
2722 | return -EBUSY; | 2725 | return -EBUSY; |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 82806e311202..a6aaf2f193a4 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -221,6 +221,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
221 | /* Corsair Strafe RGB */ | 221 | /* Corsair Strafe RGB */ |
222 | { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, | 222 | { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, |
223 | 223 | ||
224 | /* MIDI keyboard WORLDE MINI */ | ||
225 | { USB_DEVICE(0x1c75, 0x0204), .driver_info = | ||
226 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
227 | |||
224 | /* Acer C120 LED Projector */ | 228 | /* Acer C120 LED Projector */ |
225 | { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, | 229 | { USB_DEVICE(0x1de1, 0xc102), .driver_info = USB_QUIRK_NO_LPM }, |
226 | 230 | ||
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index da9158f171cb..a2336deb5e36 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -420,14 +420,25 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
420 | GFP_NOWAIT); | 420 | GFP_NOWAIT); |
421 | if (!command) { | 421 | if (!command) { |
422 | spin_unlock_irqrestore(&xhci->lock, flags); | 422 | spin_unlock_irqrestore(&xhci->lock, flags); |
423 | xhci_free_command(xhci, cmd); | 423 | ret = -ENOMEM; |
424 | return -ENOMEM; | 424 | goto cmd_cleanup; |
425 | } | ||
426 | |||
427 | ret = xhci_queue_stop_endpoint(xhci, command, slot_id, | ||
428 | i, suspend); | ||
429 | if (ret) { | ||
430 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
431 | xhci_free_command(xhci, command); | ||
432 | goto cmd_cleanup; | ||
425 | } | 433 | } |
426 | xhci_queue_stop_endpoint(xhci, command, slot_id, i, | ||
427 | suspend); | ||
428 | } | 434 | } |
429 | } | 435 | } |
430 | xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend); | 436 | ret = xhci_queue_stop_endpoint(xhci, cmd, slot_id, 0, suspend); |
437 | if (ret) { | ||
438 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
439 | goto cmd_cleanup; | ||
440 | } | ||
441 | |||
431 | xhci_ring_cmd_db(xhci); | 442 | xhci_ring_cmd_db(xhci); |
432 | spin_unlock_irqrestore(&xhci->lock, flags); | 443 | spin_unlock_irqrestore(&xhci->lock, flags); |
433 | 444 | ||
@@ -439,6 +450,8 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend) | |||
439 | xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); | 450 | xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n"); |
440 | ret = -ETIME; | 451 | ret = -ETIME; |
441 | } | 452 | } |
453 | |||
454 | cmd_cleanup: | ||
442 | xhci_free_command(xhci, cmd); | 455 | xhci_free_command(xhci, cmd); |
443 | return ret; | 456 | return ret; |
444 | } | 457 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a9443651ce0f..82c746e2d85c 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -1309,6 +1309,7 @@ static void xhci_complete_del_and_free_cmd(struct xhci_command *cmd, u32 status) | |||
1309 | void xhci_cleanup_command_queue(struct xhci_hcd *xhci) | 1309 | void xhci_cleanup_command_queue(struct xhci_hcd *xhci) |
1310 | { | 1310 | { |
1311 | struct xhci_command *cur_cmd, *tmp_cmd; | 1311 | struct xhci_command *cur_cmd, *tmp_cmd; |
1312 | xhci->current_cmd = NULL; | ||
1312 | list_for_each_entry_safe(cur_cmd, tmp_cmd, &xhci->cmd_list, cmd_list) | 1313 | list_for_each_entry_safe(cur_cmd, tmp_cmd, &xhci->cmd_list, cmd_list) |
1313 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_COMMAND_ABORTED); | 1314 | xhci_complete_del_and_free_cmd(cur_cmd, COMP_COMMAND_ABORTED); |
1314 | } | 1315 | } |
@@ -2579,15 +2580,21 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
2579 | (struct xhci_generic_trb *) ep_trb); | 2580 | (struct xhci_generic_trb *) ep_trb); |
2580 | 2581 | ||
2581 | /* | 2582 | /* |
2582 | * No-op TRB should not trigger interrupts. | 2583 | * No-op TRB could trigger interrupts in a case where |
2583 | * If ep_trb is a no-op TRB, it means the | 2584 | * a URB was killed and a STALL_ERROR happens right |
2584 | * corresponding TD has been cancelled. Just ignore | 2585 | * after the endpoint ring stopped. Reset the halted |
2585 | * the TD. | 2586 | * endpoint. Otherwise, the endpoint remains stalled |
2587 | * indefinitely. | ||
2586 | */ | 2588 | */ |
2587 | if (trb_is_noop(ep_trb)) { | 2589 | if (trb_is_noop(ep_trb)) { |
2588 | xhci_dbg(xhci, | 2590 | if (trb_comp_code == COMP_STALL_ERROR || |
2589 | "ep_trb is a no-op TRB. Skip it for slot %u ep %u\n", | 2591 | xhci_requires_manual_halt_cleanup(xhci, ep_ctx, |
2590 | slot_id, ep_index); | 2592 | trb_comp_code)) |
2593 | xhci_cleanup_halted_endpoint(xhci, slot_id, | ||
2594 | ep_index, | ||
2595 | ep_ring->stream_id, | ||
2596 | td, ep_trb, | ||
2597 | EP_HARD_RESET); | ||
2591 | goto cleanup; | 2598 | goto cleanup; |
2592 | } | 2599 | } |
2593 | 2600 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ee198ea47f49..51535ba2bcd4 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -4805,7 +4805,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4805 | */ | 4805 | */ |
4806 | hcd->has_tt = 1; | 4806 | hcd->has_tt = 1; |
4807 | } else { | 4807 | } else { |
4808 | if (xhci->sbrn == 0x31) { | 4808 | /* Some 3.1 hosts return sbrn 0x30, can't rely on sbrn alone */ |
4809 | if (xhci->sbrn == 0x31 || xhci->usb3_rhub.min_rev >= 1) { | ||
4809 | xhci_info(xhci, "Host supports USB 3.1 Enhanced SuperSpeed\n"); | 4810 | xhci_info(xhci, "Host supports USB 3.1 Enhanced SuperSpeed\n"); |
4810 | hcd->speed = HCD_USB31; | 4811 | hcd->speed = HCD_USB31; |
4811 | hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; | 4812 | hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 029692053dd3..ff5a1a8989d5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -906,7 +906,7 @@ b_host: | |||
906 | */ | 906 | */ |
907 | if (int_usb & MUSB_INTR_RESET) { | 907 | if (int_usb & MUSB_INTR_RESET) { |
908 | handled = IRQ_HANDLED; | 908 | handled = IRQ_HANDLED; |
909 | if (devctl & MUSB_DEVCTL_HM) { | 909 | if (is_host_active(musb)) { |
910 | /* | 910 | /* |
911 | * When BABBLE happens what we can depends on which | 911 | * When BABBLE happens what we can depends on which |
912 | * platform MUSB is running, because some platforms | 912 | * platform MUSB is running, because some platforms |
@@ -916,9 +916,7 @@ b_host: | |||
916 | * drop the session. | 916 | * drop the session. |
917 | */ | 917 | */ |
918 | dev_err(musb->controller, "Babble\n"); | 918 | dev_err(musb->controller, "Babble\n"); |
919 | 919 | musb_recover_from_babble(musb); | |
920 | if (is_host_active(musb)) | ||
921 | musb_recover_from_babble(musb); | ||
922 | } else { | 920 | } else { |
923 | musb_dbg(musb, "BUS RESET as %s", | 921 | musb_dbg(musb, "BUS RESET as %s", |
924 | usb_otg_state_string(musb->xceiv->otg->state)); | 922 | usb_otg_state_string(musb->xceiv->otg->state)); |
@@ -1861,22 +1859,22 @@ static void musb_pm_runtime_check_session(struct musb *musb) | |||
1861 | MUSB_DEVCTL_HR; | 1859 | MUSB_DEVCTL_HR; |
1862 | switch (devctl & ~s) { | 1860 | switch (devctl & ~s) { |
1863 | case MUSB_QUIRK_B_INVALID_VBUS_91: | 1861 | case MUSB_QUIRK_B_INVALID_VBUS_91: |
1864 | if (musb->quirk_retries--) { | 1862 | if (musb->quirk_retries && !musb->flush_irq_work) { |
1865 | musb_dbg(musb, | 1863 | musb_dbg(musb, |
1866 | "Poll devctl on invalid vbus, assume no session"); | 1864 | "Poll devctl on invalid vbus, assume no session"); |
1867 | schedule_delayed_work(&musb->irq_work, | 1865 | schedule_delayed_work(&musb->irq_work, |
1868 | msecs_to_jiffies(1000)); | 1866 | msecs_to_jiffies(1000)); |
1869 | 1867 | musb->quirk_retries--; | |
1870 | return; | 1868 | return; |
1871 | } | 1869 | } |
1872 | /* fall through */ | 1870 | /* fall through */ |
1873 | case MUSB_QUIRK_A_DISCONNECT_19: | 1871 | case MUSB_QUIRK_A_DISCONNECT_19: |
1874 | if (musb->quirk_retries--) { | 1872 | if (musb->quirk_retries && !musb->flush_irq_work) { |
1875 | musb_dbg(musb, | 1873 | musb_dbg(musb, |
1876 | "Poll devctl on possible host mode disconnect"); | 1874 | "Poll devctl on possible host mode disconnect"); |
1877 | schedule_delayed_work(&musb->irq_work, | 1875 | schedule_delayed_work(&musb->irq_work, |
1878 | msecs_to_jiffies(1000)); | 1876 | msecs_to_jiffies(1000)); |
1879 | 1877 | musb->quirk_retries--; | |
1880 | return; | 1878 | return; |
1881 | } | 1879 | } |
1882 | if (!musb->session) | 1880 | if (!musb->session) |
@@ -2681,8 +2679,15 @@ static int musb_suspend(struct device *dev) | |||
2681 | 2679 | ||
2682 | musb_platform_disable(musb); | 2680 | musb_platform_disable(musb); |
2683 | musb_disable_interrupts(musb); | 2681 | musb_disable_interrupts(musb); |
2682 | |||
2683 | musb->flush_irq_work = true; | ||
2684 | while (flush_delayed_work(&musb->irq_work)) | ||
2685 | ; | ||
2686 | musb->flush_irq_work = false; | ||
2687 | |||
2684 | if (!(musb->io.quirks & MUSB_PRESERVE_SESSION)) | 2688 | if (!(musb->io.quirks & MUSB_PRESERVE_SESSION)) |
2685 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); | 2689 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
2690 | |||
2686 | WARN_ON(!list_empty(&musb->pending_list)); | 2691 | WARN_ON(!list_empty(&musb->pending_list)); |
2687 | 2692 | ||
2688 | spin_lock_irqsave(&musb->lock, flags); | 2693 | spin_lock_irqsave(&musb->lock, flags); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index c748f4ac1154..20f4614178d9 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -428,6 +428,8 @@ struct musb { | |||
428 | unsigned test_mode:1; | 428 | unsigned test_mode:1; |
429 | unsigned softconnect:1; | 429 | unsigned softconnect:1; |
430 | 430 | ||
431 | unsigned flush_irq_work:1; | ||
432 | |||
431 | u8 address; | 433 | u8 address; |
432 | u8 test_mode_nr; | 434 | u8 test_mode_nr; |
433 | u16 ackpend; /* ep0 */ | 435 | u16 ackpend; /* ep0 */ |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index ba255280a624..1ec0a4947b6b 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -26,15 +26,28 @@ | |||
26 | 26 | ||
27 | #define MUSB_DMA_NUM_CHANNELS 15 | 27 | #define MUSB_DMA_NUM_CHANNELS 15 |
28 | 28 | ||
29 | #define DA8XX_USB_MODE 0x10 | ||
30 | #define DA8XX_USB_AUTOREQ 0x14 | ||
31 | #define DA8XX_USB_TEARDOWN 0x1c | ||
32 | |||
33 | #define DA8XX_DMA_NUM_CHANNELS 4 | ||
34 | |||
29 | struct cppi41_dma_controller { | 35 | struct cppi41_dma_controller { |
30 | struct dma_controller controller; | 36 | struct dma_controller controller; |
31 | struct cppi41_dma_channel rx_channel[MUSB_DMA_NUM_CHANNELS]; | 37 | struct cppi41_dma_channel *rx_channel; |
32 | struct cppi41_dma_channel tx_channel[MUSB_DMA_NUM_CHANNELS]; | 38 | struct cppi41_dma_channel *tx_channel; |
33 | struct hrtimer early_tx; | 39 | struct hrtimer early_tx; |
34 | struct list_head early_tx_list; | 40 | struct list_head early_tx_list; |
35 | u32 rx_mode; | 41 | u32 rx_mode; |
36 | u32 tx_mode; | 42 | u32 tx_mode; |
37 | u32 auto_req; | 43 | u32 auto_req; |
44 | |||
45 | u32 tdown_reg; | ||
46 | u32 autoreq_reg; | ||
47 | |||
48 | void (*set_dma_mode)(struct cppi41_dma_channel *cppi41_channel, | ||
49 | unsigned int mode); | ||
50 | u8 num_channels; | ||
38 | }; | 51 | }; |
39 | 52 | ||
40 | static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel) | 53 | static void save_rx_toggle(struct cppi41_dma_channel *cppi41_channel) |
@@ -349,6 +362,32 @@ static void cppi41_set_dma_mode(struct cppi41_dma_channel *cppi41_channel, | |||
349 | } | 362 | } |
350 | } | 363 | } |
351 | 364 | ||
365 | static void da8xx_set_dma_mode(struct cppi41_dma_channel *cppi41_channel, | ||
366 | unsigned int mode) | ||
367 | { | ||
368 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | ||
369 | struct musb *musb = controller->controller.musb; | ||
370 | unsigned int shift; | ||
371 | u32 port; | ||
372 | u32 new_mode; | ||
373 | u32 old_mode; | ||
374 | |||
375 | old_mode = controller->tx_mode; | ||
376 | port = cppi41_channel->port_num; | ||
377 | |||
378 | shift = (port - 1) * 4; | ||
379 | if (!cppi41_channel->is_tx) | ||
380 | shift += 16; | ||
381 | new_mode = old_mode & ~(3 << shift); | ||
382 | new_mode |= mode << shift; | ||
383 | |||
384 | if (new_mode == old_mode) | ||
385 | return; | ||
386 | controller->tx_mode = new_mode; | ||
387 | musb_writel(musb->ctrl_base, DA8XX_USB_MODE, new_mode); | ||
388 | } | ||
389 | |||
390 | |||
352 | static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, | 391 | static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, |
353 | unsigned mode) | 392 | unsigned mode) |
354 | { | 393 | { |
@@ -364,8 +403,8 @@ static void cppi41_set_autoreq_mode(struct cppi41_dma_channel *cppi41_channel, | |||
364 | if (new_mode == old_mode) | 403 | if (new_mode == old_mode) |
365 | return; | 404 | return; |
366 | controller->auto_req = new_mode; | 405 | controller->auto_req = new_mode; |
367 | musb_writel(controller->controller.musb->ctrl_base, USB_CTRL_AUTOREQ, | 406 | musb_writel(controller->controller.musb->ctrl_base, |
368 | new_mode); | 407 | controller->autoreq_reg, new_mode); |
369 | } | 408 | } |
370 | 409 | ||
371 | static bool cppi41_configure_channel(struct dma_channel *channel, | 410 | static bool cppi41_configure_channel(struct dma_channel *channel, |
@@ -373,6 +412,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
373 | dma_addr_t dma_addr, u32 len) | 412 | dma_addr_t dma_addr, u32 len) |
374 | { | 413 | { |
375 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; | 414 | struct cppi41_dma_channel *cppi41_channel = channel->private_data; |
415 | struct cppi41_dma_controller *controller = cppi41_channel->controller; | ||
376 | struct dma_chan *dc = cppi41_channel->dc; | 416 | struct dma_chan *dc = cppi41_channel->dc; |
377 | struct dma_async_tx_descriptor *dma_desc; | 417 | struct dma_async_tx_descriptor *dma_desc; |
378 | enum dma_transfer_direction direction; | 418 | enum dma_transfer_direction direction; |
@@ -398,7 +438,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
398 | musb_writel(musb->ctrl_base, | 438 | musb_writel(musb->ctrl_base, |
399 | RNDIS_REG(cppi41_channel->port_num), len); | 439 | RNDIS_REG(cppi41_channel->port_num), len); |
400 | /* gen rndis */ | 440 | /* gen rndis */ |
401 | cppi41_set_dma_mode(cppi41_channel, | 441 | controller->set_dma_mode(cppi41_channel, |
402 | EP_MODE_DMA_GEN_RNDIS); | 442 | EP_MODE_DMA_GEN_RNDIS); |
403 | 443 | ||
404 | /* auto req */ | 444 | /* auto req */ |
@@ -407,14 +447,15 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
407 | } else { | 447 | } else { |
408 | musb_writel(musb->ctrl_base, | 448 | musb_writel(musb->ctrl_base, |
409 | RNDIS_REG(cppi41_channel->port_num), 0); | 449 | RNDIS_REG(cppi41_channel->port_num), 0); |
410 | cppi41_set_dma_mode(cppi41_channel, | 450 | controller->set_dma_mode(cppi41_channel, |
411 | EP_MODE_DMA_TRANSPARENT); | 451 | EP_MODE_DMA_TRANSPARENT); |
412 | cppi41_set_autoreq_mode(cppi41_channel, | 452 | cppi41_set_autoreq_mode(cppi41_channel, |
413 | EP_MODE_AUTOREQ_NONE); | 453 | EP_MODE_AUTOREQ_NONE); |
414 | } | 454 | } |
415 | } else { | 455 | } else { |
416 | /* fallback mode */ | 456 | /* fallback mode */ |
417 | cppi41_set_dma_mode(cppi41_channel, EP_MODE_DMA_TRANSPARENT); | 457 | controller->set_dma_mode(cppi41_channel, |
458 | EP_MODE_DMA_TRANSPARENT); | ||
418 | cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREQ_NONE); | 459 | cppi41_set_autoreq_mode(cppi41_channel, EP_MODE_AUTOREQ_NONE); |
419 | len = min_t(u32, packet_sz, len); | 460 | len = min_t(u32, packet_sz, len); |
420 | } | 461 | } |
@@ -445,7 +486,7 @@ static struct dma_channel *cppi41_dma_channel_allocate(struct dma_controller *c, | |||
445 | struct cppi41_dma_channel *cppi41_channel = NULL; | 486 | struct cppi41_dma_channel *cppi41_channel = NULL; |
446 | u8 ch_num = hw_ep->epnum - 1; | 487 | u8 ch_num = hw_ep->epnum - 1; |
447 | 488 | ||
448 | if (ch_num >= MUSB_DMA_NUM_CHANNELS) | 489 | if (ch_num >= controller->num_channels) |
449 | return NULL; | 490 | return NULL; |
450 | 491 | ||
451 | if (is_tx) | 492 | if (is_tx) |
@@ -581,12 +622,13 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel) | |||
581 | 622 | ||
582 | do { | 623 | do { |
583 | if (is_tx) | 624 | if (is_tx) |
584 | musb_writel(musb->ctrl_base, USB_TDOWN, tdbit); | 625 | musb_writel(musb->ctrl_base, controller->tdown_reg, |
626 | tdbit); | ||
585 | ret = dmaengine_terminate_all(cppi41_channel->dc); | 627 | ret = dmaengine_terminate_all(cppi41_channel->dc); |
586 | } while (ret == -EAGAIN); | 628 | } while (ret == -EAGAIN); |
587 | 629 | ||
588 | if (is_tx) { | 630 | if (is_tx) { |
589 | musb_writel(musb->ctrl_base, USB_TDOWN, tdbit); | 631 | musb_writel(musb->ctrl_base, controller->tdown_reg, tdbit); |
590 | 632 | ||
591 | csr = musb_readw(epio, MUSB_TXCSR); | 633 | csr = musb_readw(epio, MUSB_TXCSR); |
592 | if (csr & MUSB_TXCSR_TXPKTRDY) { | 634 | if (csr & MUSB_TXCSR_TXPKTRDY) { |
@@ -604,7 +646,7 @@ static void cppi41_release_all_dma_chans(struct cppi41_dma_controller *ctrl) | |||
604 | struct dma_chan *dc; | 646 | struct dma_chan *dc; |
605 | int i; | 647 | int i; |
606 | 648 | ||
607 | for (i = 0; i < MUSB_DMA_NUM_CHANNELS; i++) { | 649 | for (i = 0; i < ctrl->num_channels; i++) { |
608 | dc = ctrl->tx_channel[i].dc; | 650 | dc = ctrl->tx_channel[i].dc; |
609 | if (dc) | 651 | if (dc) |
610 | dma_release_channel(dc); | 652 | dma_release_channel(dc); |
@@ -656,7 +698,7 @@ static int cppi41_dma_controller_start(struct cppi41_dma_controller *controller) | |||
656 | goto err; | 698 | goto err; |
657 | 699 | ||
658 | ret = -EINVAL; | 700 | ret = -EINVAL; |
659 | if (port > MUSB_DMA_NUM_CHANNELS || !port) | 701 | if (port > controller->num_channels || !port) |
660 | goto err; | 702 | goto err; |
661 | if (is_tx) | 703 | if (is_tx) |
662 | cppi41_channel = &controller->tx_channel[port - 1]; | 704 | cppi41_channel = &controller->tx_channel[port - 1]; |
@@ -697,6 +739,8 @@ void cppi41_dma_controller_destroy(struct dma_controller *c) | |||
697 | 739 | ||
698 | hrtimer_cancel(&controller->early_tx); | 740 | hrtimer_cancel(&controller->early_tx); |
699 | cppi41_dma_controller_stop(controller); | 741 | cppi41_dma_controller_stop(controller); |
742 | kfree(controller->rx_channel); | ||
743 | kfree(controller->tx_channel); | ||
700 | kfree(controller); | 744 | kfree(controller); |
701 | } | 745 | } |
702 | EXPORT_SYMBOL_GPL(cppi41_dma_controller_destroy); | 746 | EXPORT_SYMBOL_GPL(cppi41_dma_controller_destroy); |
@@ -705,6 +749,7 @@ struct dma_controller * | |||
705 | cppi41_dma_controller_create(struct musb *musb, void __iomem *base) | 749 | cppi41_dma_controller_create(struct musb *musb, void __iomem *base) |
706 | { | 750 | { |
707 | struct cppi41_dma_controller *controller; | 751 | struct cppi41_dma_controller *controller; |
752 | int channel_size; | ||
708 | int ret = 0; | 753 | int ret = 0; |
709 | 754 | ||
710 | if (!musb->controller->parent->of_node) { | 755 | if (!musb->controller->parent->of_node) { |
@@ -727,12 +772,37 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base) | |||
727 | controller->controller.is_compatible = cppi41_is_compatible; | 772 | controller->controller.is_compatible = cppi41_is_compatible; |
728 | controller->controller.musb = musb; | 773 | controller->controller.musb = musb; |
729 | 774 | ||
775 | if (musb->io.quirks & MUSB_DA8XX) { | ||
776 | controller->tdown_reg = DA8XX_USB_TEARDOWN; | ||
777 | controller->autoreq_reg = DA8XX_USB_AUTOREQ; | ||
778 | controller->set_dma_mode = da8xx_set_dma_mode; | ||
779 | controller->num_channels = DA8XX_DMA_NUM_CHANNELS; | ||
780 | } else { | ||
781 | controller->tdown_reg = USB_TDOWN; | ||
782 | controller->autoreq_reg = USB_CTRL_AUTOREQ; | ||
783 | controller->set_dma_mode = cppi41_set_dma_mode; | ||
784 | controller->num_channels = MUSB_DMA_NUM_CHANNELS; | ||
785 | } | ||
786 | |||
787 | channel_size = controller->num_channels * | ||
788 | sizeof(struct cppi41_dma_channel); | ||
789 | controller->rx_channel = kzalloc(channel_size, GFP_KERNEL); | ||
790 | if (!controller->rx_channel) | ||
791 | goto rx_channel_alloc_fail; | ||
792 | controller->tx_channel = kzalloc(channel_size, GFP_KERNEL); | ||
793 | if (!controller->tx_channel) | ||
794 | goto tx_channel_alloc_fail; | ||
795 | |||
730 | ret = cppi41_dma_controller_start(controller); | 796 | ret = cppi41_dma_controller_start(controller); |
731 | if (ret) | 797 | if (ret) |
732 | goto plat_get_fail; | 798 | goto plat_get_fail; |
733 | return &controller->controller; | 799 | return &controller->controller; |
734 | 800 | ||
735 | plat_get_fail: | 801 | plat_get_fail: |
802 | kfree(controller->tx_channel); | ||
803 | tx_channel_alloc_fail: | ||
804 | kfree(controller->rx_channel); | ||
805 | rx_channel_alloc_fail: | ||
736 | kfree(controller); | 806 | kfree(controller); |
737 | kzalloc_fail: | 807 | kzalloc_fail: |
738 | if (ret == -EPROBE_DEFER) | 808 | if (ret == -EPROBE_DEFER) |
diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index c9a09b5bb6e5..dc353e24d53c 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c | |||
@@ -297,6 +297,8 @@ static int sunxi_musb_exit(struct musb *musb) | |||
297 | if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) | 297 | if (test_bit(SUNXI_MUSB_FL_HAS_SRAM, &glue->flags)) |
298 | sunxi_sram_release(musb->controller->parent); | 298 | sunxi_sram_release(musb->controller->parent); |
299 | 299 | ||
300 | devm_usb_put_phy(glue->dev, glue->xceiv); | ||
301 | |||
300 | return 0; | 302 | return 0; |
301 | } | 303 | } |
302 | 304 | ||
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index cc84da8dbb84..14511d6a7d44 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -45,6 +45,7 @@ struct metrousb_private { | |||
45 | static const struct usb_device_id id_table[] = { | 45 | static const struct usb_device_id id_table[] = { |
46 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, | 46 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, |
47 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, | 47 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, |
48 | { USB_DEVICE_INTERFACE_CLASS(0x0c2e, 0x0730, 0xff) }, /* MS7820 */ | ||
48 | { }, /* Terminating entry. */ | 49 | { }, /* Terminating entry. */ |
49 | }; | 50 | }; |
50 | MODULE_DEVICE_TABLE(usb, id_table); | 51 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 82360594fa8e..57efbd3b053b 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -1024,6 +1024,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
1024 | mutex_unlock(&priv->lock); | 1024 | mutex_unlock(&priv->lock); |
1025 | 1025 | ||
1026 | if (use_ptemod) { | 1026 | if (use_ptemod) { |
1027 | map->pages_vm_start = vma->vm_start; | ||
1027 | err = apply_to_page_range(vma->vm_mm, vma->vm_start, | 1028 | err = apply_to_page_range(vma->vm_mm, vma->vm_start, |
1028 | vma->vm_end - vma->vm_start, | 1029 | vma->vm_end - vma->vm_start, |
1029 | find_grant_ptes, map); | 1030 | find_grant_ptes, map); |
@@ -1061,7 +1062,6 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
1061 | set_grant_ptes_as_special, NULL); | 1062 | set_grant_ptes_as_special, NULL); |
1062 | } | 1063 | } |
1063 | #endif | 1064 | #endif |
1064 | map->pages_vm_start = vma->vm_start; | ||
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | return 0; | 1067 | return 0; |
diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c index e89136ab851e..b437fccd4e62 100644 --- a/drivers/xen/xen-balloon.c +++ b/drivers/xen/xen-balloon.c | |||
@@ -57,7 +57,7 @@ static int register_balloon(struct device *dev); | |||
57 | static void watch_target(struct xenbus_watch *watch, | 57 | static void watch_target(struct xenbus_watch *watch, |
58 | const char *path, const char *token) | 58 | const char *path, const char *token) |
59 | { | 59 | { |
60 | unsigned long long new_target; | 60 | unsigned long long new_target, static_max; |
61 | int err; | 61 | int err; |
62 | static bool watch_fired; | 62 | static bool watch_fired; |
63 | static long target_diff; | 63 | static long target_diff; |
@@ -72,13 +72,20 @@ static void watch_target(struct xenbus_watch *watch, | |||
72 | * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. | 72 | * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10. |
73 | */ | 73 | */ |
74 | new_target >>= PAGE_SHIFT - 10; | 74 | new_target >>= PAGE_SHIFT - 10; |
75 | if (watch_fired) { | 75 | |
76 | balloon_set_new_target(new_target - target_diff); | 76 | if (!watch_fired) { |
77 | return; | 77 | watch_fired = true; |
78 | err = xenbus_scanf(XBT_NIL, "memory", "static-max", "%llu", | ||
79 | &static_max); | ||
80 | if (err != 1) | ||
81 | static_max = new_target; | ||
82 | else | ||
83 | static_max >>= PAGE_SHIFT - 10; | ||
84 | target_diff = xen_pv_domain() ? 0 | ||
85 | : static_max - balloon_stats.target_pages; | ||
78 | } | 86 | } |
79 | 87 | ||
80 | watch_fired = true; | 88 | balloon_set_new_target(new_target - target_diff); |
81 | target_diff = new_target - balloon_stats.target_pages; | ||
82 | } | 89 | } |
83 | static struct xenbus_watch target_watch = { | 90 | static struct xenbus_watch target_watch = { |
84 | .node = "memory/target", | 91 | .node = "memory/target", |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 157fe59fbabe..1978a8cb1cb1 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1991,6 +1991,7 @@ static int try_flush_caps(struct inode *inode, u64 *ptid) | |||
1991 | retry: | 1991 | retry: |
1992 | spin_lock(&ci->i_ceph_lock); | 1992 | spin_lock(&ci->i_ceph_lock); |
1993 | if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { | 1993 | if (ci->i_ceph_flags & CEPH_I_NOFLUSH) { |
1994 | spin_unlock(&ci->i_ceph_lock); | ||
1994 | dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); | 1995 | dout("try_flush_caps skipping %p I_NOFLUSH set\n", inode); |
1995 | goto out; | 1996 | goto out; |
1996 | } | 1997 | } |
@@ -2008,8 +2009,10 @@ retry: | |||
2008 | mutex_lock(&session->s_mutex); | 2009 | mutex_lock(&session->s_mutex); |
2009 | goto retry; | 2010 | goto retry; |
2010 | } | 2011 | } |
2011 | if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) | 2012 | if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) { |
2013 | spin_unlock(&ci->i_ceph_lock); | ||
2012 | goto out; | 2014 | goto out; |
2015 | } | ||
2013 | 2016 | ||
2014 | flushing = __mark_caps_flushing(inode, session, true, | 2017 | flushing = __mark_caps_flushing(inode, session, true, |
2015 | &flush_tid, &oldest_flush_tid); | 2018 | &flush_tid, &oldest_flush_tid); |
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index f7243617316c..d5b2e12b5d02 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig | |||
@@ -5,9 +5,14 @@ config CIFS | |||
5 | select CRYPTO | 5 | select CRYPTO |
6 | select CRYPTO_MD4 | 6 | select CRYPTO_MD4 |
7 | select CRYPTO_MD5 | 7 | select CRYPTO_MD5 |
8 | select CRYPTO_SHA256 | ||
9 | select CRYPTO_CMAC | ||
8 | select CRYPTO_HMAC | 10 | select CRYPTO_HMAC |
9 | select CRYPTO_ARC4 | 11 | select CRYPTO_ARC4 |
12 | select CRYPTO_AEAD2 | ||
13 | select CRYPTO_CCM | ||
10 | select CRYPTO_ECB | 14 | select CRYPTO_ECB |
15 | select CRYPTO_AES | ||
11 | select CRYPTO_DES | 16 | select CRYPTO_DES |
12 | help | 17 | help |
13 | This is the client VFS module for the SMB3 family of NAS protocols, | 18 | This is the client VFS module for the SMB3 family of NAS protocols, |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index de5b2e1fcce5..e185b2853eab 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -661,7 +661,9 @@ struct TCP_Server_Info { | |||
661 | #endif | 661 | #endif |
662 | unsigned int max_read; | 662 | unsigned int max_read; |
663 | unsigned int max_write; | 663 | unsigned int max_write; |
664 | __u8 preauth_hash[512]; | 664 | #ifdef CONFIG_CIFS_SMB311 |
665 | __u8 preauth_sha_hash[64]; /* save initital negprot hash */ | ||
666 | #endif /* 3.1.1 */ | ||
665 | struct delayed_work reconnect; /* reconnect workqueue job */ | 667 | struct delayed_work reconnect; /* reconnect workqueue job */ |
666 | struct mutex reconnect_mutex; /* prevent simultaneous reconnects */ | 668 | struct mutex reconnect_mutex; /* prevent simultaneous reconnects */ |
667 | unsigned long echo_interval; | 669 | unsigned long echo_interval; |
@@ -849,7 +851,9 @@ struct cifs_ses { | |||
849 | __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE]; | 851 | __u8 smb3signingkey[SMB3_SIGN_KEY_SIZE]; |
850 | __u8 smb3encryptionkey[SMB3_SIGN_KEY_SIZE]; | 852 | __u8 smb3encryptionkey[SMB3_SIGN_KEY_SIZE]; |
851 | __u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE]; | 853 | __u8 smb3decryptionkey[SMB3_SIGN_KEY_SIZE]; |
852 | __u8 preauth_hash[512]; | 854 | #ifdef CONFIG_CIFS_SMB311 |
855 | __u8 preauth_sha_hash[64]; | ||
856 | #endif /* 3.1.1 */ | ||
853 | }; | 857 | }; |
854 | 858 | ||
855 | static inline bool | 859 | static inline bool |
diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c index 7ca9808a0daa..62c88dfed57b 100644 --- a/fs/cifs/smb2maperror.c +++ b/fs/cifs/smb2maperror.c | |||
@@ -214,7 +214,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = { | |||
214 | {STATUS_DATATYPE_MISALIGNMENT, -EIO, "STATUS_DATATYPE_MISALIGNMENT"}, | 214 | {STATUS_DATATYPE_MISALIGNMENT, -EIO, "STATUS_DATATYPE_MISALIGNMENT"}, |
215 | {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, | 215 | {STATUS_BREAKPOINT, -EIO, "STATUS_BREAKPOINT"}, |
216 | {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, | 216 | {STATUS_SINGLE_STEP, -EIO, "STATUS_SINGLE_STEP"}, |
217 | {STATUS_BUFFER_OVERFLOW, -EIO, "STATUS_BUFFER_OVERFLOW"}, | 217 | {STATUS_BUFFER_OVERFLOW, -E2BIG, "STATUS_BUFFER_OVERFLOW"}, |
218 | {STATUS_NO_MORE_FILES, -ENODATA, "STATUS_NO_MORE_FILES"}, | 218 | {STATUS_NO_MORE_FILES, -ENODATA, "STATUS_NO_MORE_FILES"}, |
219 | {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, | 219 | {STATUS_WAKE_SYSTEM_DEBUGGER, -EIO, "STATUS_WAKE_SYSTEM_DEBUGGER"}, |
220 | {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, | 220 | {STATUS_HANDLES_CLOSED, -EIO, "STATUS_HANDLES_CLOSED"}, |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 0dafdbae1f8c..bdb963d0ba32 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
@@ -522,6 +522,7 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | |||
522 | struct cifs_open_parms oparms; | 522 | struct cifs_open_parms oparms; |
523 | struct cifs_fid fid; | 523 | struct cifs_fid fid; |
524 | struct smb2_file_full_ea_info *smb2_data; | 524 | struct smb2_file_full_ea_info *smb2_data; |
525 | int ea_buf_size = SMB2_MIN_EA_BUF; | ||
525 | 526 | ||
526 | utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); | 527 | utf16_path = cifs_convert_path_to_utf16(path, cifs_sb); |
527 | if (!utf16_path) | 528 | if (!utf16_path) |
@@ -541,14 +542,32 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | |||
541 | return rc; | 542 | return rc; |
542 | } | 543 | } |
543 | 544 | ||
544 | smb2_data = kzalloc(SMB2_MAX_EA_BUF, GFP_KERNEL); | 545 | while (1) { |
545 | if (smb2_data == NULL) { | 546 | smb2_data = kzalloc(ea_buf_size, GFP_KERNEL); |
546 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | 547 | if (smb2_data == NULL) { |
547 | return -ENOMEM; | 548 | SMB2_close(xid, tcon, fid.persistent_fid, |
549 | fid.volatile_fid); | ||
550 | return -ENOMEM; | ||
551 | } | ||
552 | |||
553 | rc = SMB2_query_eas(xid, tcon, fid.persistent_fid, | ||
554 | fid.volatile_fid, | ||
555 | ea_buf_size, smb2_data); | ||
556 | |||
557 | if (rc != -E2BIG) | ||
558 | break; | ||
559 | |||
560 | kfree(smb2_data); | ||
561 | ea_buf_size <<= 1; | ||
562 | |||
563 | if (ea_buf_size > SMB2_MAX_EA_BUF) { | ||
564 | cifs_dbg(VFS, "EA size is too large\n"); | ||
565 | SMB2_close(xid, tcon, fid.persistent_fid, | ||
566 | fid.volatile_fid); | ||
567 | return -ENOMEM; | ||
568 | } | ||
548 | } | 569 | } |
549 | 570 | ||
550 | rc = SMB2_query_eas(xid, tcon, fid.persistent_fid, fid.volatile_fid, | ||
551 | smb2_data); | ||
552 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | 571 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); |
553 | 572 | ||
554 | if (!rc) | 573 | if (!rc) |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 6f0e6343c15e..5331631386a2 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -648,7 +648,7 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) | |||
648 | { | 648 | { |
649 | int rc = 0; | 649 | int rc = 0; |
650 | struct validate_negotiate_info_req vneg_inbuf; | 650 | struct validate_negotiate_info_req vneg_inbuf; |
651 | struct validate_negotiate_info_rsp *pneg_rsp; | 651 | struct validate_negotiate_info_rsp *pneg_rsp = NULL; |
652 | u32 rsplen; | 652 | u32 rsplen; |
653 | u32 inbuflen; /* max of 4 dialects */ | 653 | u32 inbuflen; /* max of 4 dialects */ |
654 | 654 | ||
@@ -727,8 +727,9 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) | |||
727 | rsplen); | 727 | rsplen); |
728 | 728 | ||
729 | /* relax check since Mac returns max bufsize allowed on ioctl */ | 729 | /* relax check since Mac returns max bufsize allowed on ioctl */ |
730 | if (rsplen > CIFSMaxBufSize) | 730 | if ((rsplen > CIFSMaxBufSize) |
731 | return -EIO; | 731 | || (rsplen < sizeof(struct validate_negotiate_info_rsp))) |
732 | goto err_rsp_free; | ||
732 | } | 733 | } |
733 | 734 | ||
734 | /* check validate negotiate info response matches what we got earlier */ | 735 | /* check validate negotiate info response matches what we got earlier */ |
@@ -747,10 +748,13 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) | |||
747 | 748 | ||
748 | /* validate negotiate successful */ | 749 | /* validate negotiate successful */ |
749 | cifs_dbg(FYI, "validate negotiate info successful\n"); | 750 | cifs_dbg(FYI, "validate negotiate info successful\n"); |
751 | kfree(pneg_rsp); | ||
750 | return 0; | 752 | return 0; |
751 | 753 | ||
752 | vneg_out: | 754 | vneg_out: |
753 | cifs_dbg(VFS, "protocol revalidation - security settings mismatch\n"); | 755 | cifs_dbg(VFS, "protocol revalidation - security settings mismatch\n"); |
756 | err_rsp_free: | ||
757 | kfree(pneg_rsp); | ||
754 | return -EIO; | 758 | return -EIO; |
755 | } | 759 | } |
756 | 760 | ||
@@ -1255,7 +1259,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree, | |||
1255 | struct smb2_tree_connect_req *req; | 1259 | struct smb2_tree_connect_req *req; |
1256 | struct smb2_tree_connect_rsp *rsp = NULL; | 1260 | struct smb2_tree_connect_rsp *rsp = NULL; |
1257 | struct kvec iov[2]; | 1261 | struct kvec iov[2]; |
1258 | struct kvec rsp_iov; | 1262 | struct kvec rsp_iov = { NULL, 0 }; |
1259 | int rc = 0; | 1263 | int rc = 0; |
1260 | int resp_buftype; | 1264 | int resp_buftype; |
1261 | int unc_path_len; | 1265 | int unc_path_len; |
@@ -1372,7 +1376,7 @@ tcon_exit: | |||
1372 | return rc; | 1376 | return rc; |
1373 | 1377 | ||
1374 | tcon_error_exit: | 1378 | tcon_error_exit: |
1375 | if (rsp->hdr.sync_hdr.Status == STATUS_BAD_NETWORK_NAME) { | 1379 | if (rsp && rsp->hdr.sync_hdr.Status == STATUS_BAD_NETWORK_NAME) { |
1376 | cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); | 1380 | cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree); |
1377 | } | 1381 | } |
1378 | goto tcon_exit; | 1382 | goto tcon_exit; |
@@ -1975,6 +1979,9 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, | |||
1975 | } else | 1979 | } else |
1976 | iov[0].iov_len = get_rfc1002_length(req) + 4; | 1980 | iov[0].iov_len = get_rfc1002_length(req) + 4; |
1977 | 1981 | ||
1982 | /* validate negotiate request must be signed - see MS-SMB2 3.2.5.5 */ | ||
1983 | if (opcode == FSCTL_VALIDATE_NEGOTIATE_INFO) | ||
1984 | req->hdr.sync_hdr.Flags |= SMB2_FLAGS_SIGNED; | ||
1978 | 1985 | ||
1979 | rc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov); | 1986 | rc = SendReceive2(xid, ses, iov, n_iov, &resp_buftype, flags, &rsp_iov); |
1980 | cifs_small_buf_release(req); | 1987 | cifs_small_buf_release(req); |
@@ -2191,9 +2198,13 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, | |||
2191 | req->PersistentFileId = persistent_fid; | 2198 | req->PersistentFileId = persistent_fid; |
2192 | req->VolatileFileId = volatile_fid; | 2199 | req->VolatileFileId = volatile_fid; |
2193 | req->AdditionalInformation = cpu_to_le32(additional_info); | 2200 | req->AdditionalInformation = cpu_to_le32(additional_info); |
2194 | /* 4 for rfc1002 length field and 1 for Buffer */ | 2201 | |
2195 | req->InputBufferOffset = | 2202 | /* |
2196 | cpu_to_le16(sizeof(struct smb2_query_info_req) - 1 - 4); | 2203 | * We do not use the input buffer (do not send extra byte) |
2204 | */ | ||
2205 | req->InputBufferOffset = 0; | ||
2206 | inc_rfc1001_len(req, -1); | ||
2207 | |||
2197 | req->OutputBufferLength = cpu_to_le32(output_len); | 2208 | req->OutputBufferLength = cpu_to_le32(output_len); |
2198 | 2209 | ||
2199 | iov[0].iov_base = (char *)req; | 2210 | iov[0].iov_base = (char *)req; |
@@ -2233,12 +2244,12 @@ qinf_exit: | |||
2233 | } | 2244 | } |
2234 | 2245 | ||
2235 | int SMB2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | 2246 | int SMB2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, |
2236 | u64 persistent_fid, u64 volatile_fid, | 2247 | u64 persistent_fid, u64 volatile_fid, |
2237 | struct smb2_file_full_ea_info *data) | 2248 | int ea_buf_size, struct smb2_file_full_ea_info *data) |
2238 | { | 2249 | { |
2239 | return query_info(xid, tcon, persistent_fid, volatile_fid, | 2250 | return query_info(xid, tcon, persistent_fid, volatile_fid, |
2240 | FILE_FULL_EA_INFORMATION, SMB2_O_INFO_FILE, 0, | 2251 | FILE_FULL_EA_INFORMATION, SMB2_O_INFO_FILE, 0, |
2241 | SMB2_MAX_EA_BUF, | 2252 | ea_buf_size, |
2242 | sizeof(struct smb2_file_full_ea_info), | 2253 | sizeof(struct smb2_file_full_ea_info), |
2243 | (void **)&data, | 2254 | (void **)&data, |
2244 | NULL); | 2255 | NULL); |
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 6c9653a130c8..c2ec934be968 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h | |||
@@ -832,7 +832,7 @@ struct smb2_flush_rsp { | |||
832 | /* Channel field for read and write: exactly one of following flags can be set*/ | 832 | /* Channel field for read and write: exactly one of following flags can be set*/ |
833 | #define SMB2_CHANNEL_NONE 0x00000000 | 833 | #define SMB2_CHANNEL_NONE 0x00000000 |
834 | #define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */ | 834 | #define SMB2_CHANNEL_RDMA_V1 0x00000001 /* SMB3 or later */ |
835 | #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000001 /* SMB3.02 or later */ | 835 | #define SMB2_CHANNEL_RDMA_V1_INVALIDATE 0x00000002 /* SMB3.02 or later */ |
836 | 836 | ||
837 | /* SMB2 read request without RFC1001 length at the beginning */ | 837 | /* SMB2 read request without RFC1001 length at the beginning */ |
838 | struct smb2_read_plain_req { | 838 | struct smb2_read_plain_req { |
@@ -1178,7 +1178,8 @@ struct smb2_file_link_info { /* encoding of request for level 11 */ | |||
1178 | char FileName[0]; /* Name to be assigned to new link */ | 1178 | char FileName[0]; /* Name to be assigned to new link */ |
1179 | } __packed; /* level 11 Set */ | 1179 | } __packed; /* level 11 Set */ |
1180 | 1180 | ||
1181 | #define SMB2_MAX_EA_BUF 2048 | 1181 | #define SMB2_MIN_EA_BUF 2048 |
1182 | #define SMB2_MAX_EA_BUF 65536 | ||
1182 | 1183 | ||
1183 | struct smb2_file_full_ea_info { /* encoding of response for level 15 */ | 1184 | struct smb2_file_full_ea_info { /* encoding of response for level 15 */ |
1184 | __le32 next_entry_offset; | 1185 | __le32 next_entry_offset; |
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h index 003217099ef3..e9ab5227e7a8 100644 --- a/fs/cifs/smb2proto.h +++ b/fs/cifs/smb2proto.h | |||
@@ -134,6 +134,7 @@ extern int SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, | |||
134 | u64 persistent_file_id, u64 volatile_file_id); | 134 | u64 persistent_file_id, u64 volatile_file_id); |
135 | extern int SMB2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, | 135 | extern int SMB2_query_eas(const unsigned int xid, struct cifs_tcon *tcon, |
136 | u64 persistent_file_id, u64 volatile_file_id, | 136 | u64 persistent_file_id, u64 volatile_file_id, |
137 | int ea_buf_size, | ||
137 | struct smb2_file_full_ea_info *data); | 138 | struct smb2_file_full_ea_info *data); |
138 | extern int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon, | 139 | extern int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon, |
139 | u64 persistent_file_id, u64 volatile_file_id, | 140 | u64 persistent_file_id, u64 volatile_file_id, |
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c index 67367cf1f8cd..99493946e2f9 100644 --- a/fs/cifs/smb2transport.c +++ b/fs/cifs/smb2transport.c | |||
@@ -390,6 +390,7 @@ generate_smb30signingkey(struct cifs_ses *ses) | |||
390 | return generate_smb3signingkey(ses, &triplet); | 390 | return generate_smb3signingkey(ses, &triplet); |
391 | } | 391 | } |
392 | 392 | ||
393 | #ifdef CONFIG_CIFS_SMB311 | ||
393 | int | 394 | int |
394 | generate_smb311signingkey(struct cifs_ses *ses) | 395 | generate_smb311signingkey(struct cifs_ses *ses) |
395 | 396 | ||
@@ -398,25 +399,26 @@ generate_smb311signingkey(struct cifs_ses *ses) | |||
398 | struct derivation *d; | 399 | struct derivation *d; |
399 | 400 | ||
400 | d = &triplet.signing; | 401 | d = &triplet.signing; |
401 | d->label.iov_base = "SMB2AESCMAC"; | 402 | d->label.iov_base = "SMBSigningKey"; |
402 | d->label.iov_len = 12; | 403 | d->label.iov_len = 14; |
403 | d->context.iov_base = "SmbSign"; | 404 | d->context.iov_base = ses->preauth_sha_hash; |
404 | d->context.iov_len = 8; | 405 | d->context.iov_len = 64; |
405 | 406 | ||
406 | d = &triplet.encryption; | 407 | d = &triplet.encryption; |
407 | d->label.iov_base = "SMB2AESCCM"; | 408 | d->label.iov_base = "SMBC2SCipherKey"; |
408 | d->label.iov_len = 11; | 409 | d->label.iov_len = 16; |
409 | d->context.iov_base = "ServerIn "; | 410 | d->context.iov_base = ses->preauth_sha_hash; |
410 | d->context.iov_len = 10; | 411 | d->context.iov_len = 64; |
411 | 412 | ||
412 | d = &triplet.decryption; | 413 | d = &triplet.decryption; |
413 | d->label.iov_base = "SMB2AESCCM"; | 414 | d->label.iov_base = "SMBS2CCipherKey"; |
414 | d->label.iov_len = 11; | 415 | d->label.iov_len = 16; |
415 | d->context.iov_base = "ServerOut"; | 416 | d->context.iov_base = ses->preauth_sha_hash; |
416 | d->context.iov_len = 10; | 417 | d->context.iov_len = 64; |
417 | 418 | ||
418 | return generate_smb3signingkey(ses, &triplet); | 419 | return generate_smb3signingkey(ses, &triplet); |
419 | } | 420 | } |
421 | #endif /* 311 */ | ||
420 | 422 | ||
421 | int | 423 | int |
422 | smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server) | 424 | smb3_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server) |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 622081b97426..24967382a7b1 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1308,7 +1308,8 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file, | |||
1308 | */ | 1308 | */ |
1309 | over = !dir_emit(ctx, dirent->name, dirent->namelen, | 1309 | over = !dir_emit(ctx, dirent->name, dirent->namelen, |
1310 | dirent->ino, dirent->type); | 1310 | dirent->ino, dirent->type); |
1311 | ctx->pos = dirent->off; | 1311 | if (!over) |
1312 | ctx->pos = dirent->off; | ||
1312 | } | 1313 | } |
1313 | 1314 | ||
1314 | buf += reclen; | 1315 | buf += reclen; |
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index a619addecafc..321511ed8c42 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c | |||
@@ -598,18 +598,30 @@ static bool ovl_verify_inode(struct inode *inode, struct dentry *lowerdentry, | |||
598 | return true; | 598 | return true; |
599 | } | 599 | } |
600 | 600 | ||
601 | struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry) | 601 | struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry, |
602 | struct dentry *index) | ||
602 | { | 603 | { |
603 | struct dentry *lowerdentry = ovl_dentry_lower(dentry); | 604 | struct dentry *lowerdentry = ovl_dentry_lower(dentry); |
604 | struct inode *realinode = upperdentry ? d_inode(upperdentry) : NULL; | 605 | struct inode *realinode = upperdentry ? d_inode(upperdentry) : NULL; |
605 | struct inode *inode; | 606 | struct inode *inode; |
607 | /* Already indexed or could be indexed on copy up? */ | ||
608 | bool indexed = (index || (ovl_indexdir(dentry->d_sb) && !upperdentry)); | ||
609 | |||
610 | if (WARN_ON(upperdentry && indexed && !lowerdentry)) | ||
611 | return ERR_PTR(-EIO); | ||
606 | 612 | ||
607 | if (!realinode) | 613 | if (!realinode) |
608 | realinode = d_inode(lowerdentry); | 614 | realinode = d_inode(lowerdentry); |
609 | 615 | ||
610 | if (!S_ISDIR(realinode->i_mode) && | 616 | /* |
611 | (upperdentry || (lowerdentry && ovl_indexdir(dentry->d_sb)))) { | 617 | * Copy up origin (lower) may exist for non-indexed upper, but we must |
612 | struct inode *key = d_inode(lowerdentry ?: upperdentry); | 618 | * not use lower as hash key in that case. |
619 | * Hash inodes that are or could be indexed by origin inode and | ||
620 | * non-indexed upper inodes that could be hard linked by upper inode. | ||
621 | */ | ||
622 | if (!S_ISDIR(realinode->i_mode) && (upperdentry || indexed)) { | ||
623 | struct inode *key = d_inode(indexed ? lowerdentry : | ||
624 | upperdentry); | ||
613 | unsigned int nlink; | 625 | unsigned int nlink; |
614 | 626 | ||
615 | inode = iget5_locked(dentry->d_sb, (unsigned long) key, | 627 | inode = iget5_locked(dentry->d_sb, (unsigned long) key, |
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index 654bea1a5ac9..a12dc10bf726 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c | |||
@@ -405,14 +405,13 @@ int ovl_verify_index(struct dentry *index, struct path *lowerstack, | |||
405 | * be treated as stale (i.e. after unlink of the overlay inode). | 405 | * be treated as stale (i.e. after unlink of the overlay inode). |
406 | * We don't know the verification rules for directory and whiteout | 406 | * We don't know the verification rules for directory and whiteout |
407 | * index entries, because they have not been implemented yet, so return | 407 | * index entries, because they have not been implemented yet, so return |
408 | * EROFS if those entries are found to avoid corrupting an index that | 408 | * EINVAL if those entries are found to abort the mount to avoid |
409 | * was created by a newer kernel. | 409 | * corrupting an index that was created by a newer kernel. |
410 | */ | 410 | */ |
411 | err = -EROFS; | 411 | err = -EINVAL; |
412 | if (d_is_dir(index) || ovl_is_whiteout(index)) | 412 | if (d_is_dir(index) || ovl_is_whiteout(index)) |
413 | goto fail; | 413 | goto fail; |
414 | 414 | ||
415 | err = -EINVAL; | ||
416 | if (index->d_name.len < sizeof(struct ovl_fh)*2) | 415 | if (index->d_name.len < sizeof(struct ovl_fh)*2) |
417 | goto fail; | 416 | goto fail; |
418 | 417 | ||
@@ -507,6 +506,10 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry, | |||
507 | index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len); | 506 | index = lookup_one_len_unlocked(name.name, ofs->indexdir, name.len); |
508 | if (IS_ERR(index)) { | 507 | if (IS_ERR(index)) { |
509 | err = PTR_ERR(index); | 508 | err = PTR_ERR(index); |
509 | if (err == -ENOENT) { | ||
510 | index = NULL; | ||
511 | goto out; | ||
512 | } | ||
510 | pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" | 513 | pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" |
511 | "overlayfs: mount with '-o index=off' to disable inodes index.\n", | 514 | "overlayfs: mount with '-o index=off' to disable inodes index.\n", |
512 | d_inode(origin)->i_ino, name.len, name.name, | 515 | d_inode(origin)->i_ino, name.len, name.name, |
@@ -516,18 +519,9 @@ static struct dentry *ovl_lookup_index(struct dentry *dentry, | |||
516 | 519 | ||
517 | inode = d_inode(index); | 520 | inode = d_inode(index); |
518 | if (d_is_negative(index)) { | 521 | if (d_is_negative(index)) { |
519 | if (upper && d_inode(origin)->i_nlink > 1) { | 522 | goto out_dput; |
520 | pr_warn_ratelimited("overlayfs: hard link with origin but no index (ino=%lu).\n", | ||
521 | d_inode(origin)->i_ino); | ||
522 | goto fail; | ||
523 | } | ||
524 | |||
525 | dput(index); | ||
526 | index = NULL; | ||
527 | } else if (upper && d_inode(upper) != inode) { | 523 | } else if (upper && d_inode(upper) != inode) { |
528 | pr_warn_ratelimited("overlayfs: wrong index found (index=%pd2, ino=%lu, upper ino=%lu).\n", | 524 | goto out_dput; |
529 | index, inode->i_ino, d_inode(upper)->i_ino); | ||
530 | goto fail; | ||
531 | } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) || | 525 | } else if (ovl_dentry_weird(index) || ovl_is_whiteout(index) || |
532 | ((inode->i_mode ^ d_inode(origin)->i_mode) & S_IFMT)) { | 526 | ((inode->i_mode ^ d_inode(origin)->i_mode) & S_IFMT)) { |
533 | /* | 527 | /* |
@@ -547,6 +541,11 @@ out: | |||
547 | kfree(name.name); | 541 | kfree(name.name); |
548 | return index; | 542 | return index; |
549 | 543 | ||
544 | out_dput: | ||
545 | dput(index); | ||
546 | index = NULL; | ||
547 | goto out; | ||
548 | |||
550 | fail: | 549 | fail: |
551 | dput(index); | 550 | dput(index); |
552 | index = ERR_PTR(-EIO); | 551 | index = ERR_PTR(-EIO); |
@@ -635,6 +634,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, | |||
635 | } | 634 | } |
636 | 635 | ||
637 | if (d.redirect) { | 636 | if (d.redirect) { |
637 | err = -ENOMEM; | ||
638 | upperredirect = kstrdup(d.redirect, GFP_KERNEL); | 638 | upperredirect = kstrdup(d.redirect, GFP_KERNEL); |
639 | if (!upperredirect) | 639 | if (!upperredirect) |
640 | goto out_put_upper; | 640 | goto out_put_upper; |
@@ -709,7 +709,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, | |||
709 | upperdentry = dget(index); | 709 | upperdentry = dget(index); |
710 | 710 | ||
711 | if (upperdentry || ctr) { | 711 | if (upperdentry || ctr) { |
712 | inode = ovl_get_inode(dentry, upperdentry); | 712 | inode = ovl_get_inode(dentry, upperdentry, index); |
713 | err = PTR_ERR(inode); | 713 | err = PTR_ERR(inode); |
714 | if (IS_ERR(inode)) | 714 | if (IS_ERR(inode)) |
715 | goto out_free_oe; | 715 | goto out_free_oe; |
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index c706a6f99928..d9a0edd4e57e 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h | |||
@@ -286,7 +286,8 @@ int ovl_update_time(struct inode *inode, struct timespec *ts, int flags); | |||
286 | bool ovl_is_private_xattr(const char *name); | 286 | bool ovl_is_private_xattr(const char *name); |
287 | 287 | ||
288 | struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, dev_t rdev); | 288 | struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, dev_t rdev); |
289 | struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry); | 289 | struct inode *ovl_get_inode(struct dentry *dentry, struct dentry *upperdentry, |
290 | struct dentry *index); | ||
290 | static inline void ovl_copyattr(struct inode *from, struct inode *to) | 291 | static inline void ovl_copyattr(struct inode *from, struct inode *to) |
291 | { | 292 | { |
292 | to->i_uid = from->i_uid; | 293 | to->i_uid = from->i_uid; |
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index 0f85ee9c3268..698b74dd750e 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c | |||
@@ -1021,13 +1021,12 @@ int ovl_indexdir_cleanup(struct dentry *dentry, struct vfsmount *mnt, | |||
1021 | break; | 1021 | break; |
1022 | } | 1022 | } |
1023 | err = ovl_verify_index(index, lowerstack, numlower); | 1023 | err = ovl_verify_index(index, lowerstack, numlower); |
1024 | if (err) { | 1024 | /* Cleanup stale and orphan index entries */ |
1025 | if (err == -EROFS) | 1025 | if (err && (err == -ESTALE || err == -ENOENT)) |
1026 | break; | ||
1027 | err = ovl_cleanup(dir, index); | 1026 | err = ovl_cleanup(dir, index); |
1028 | if (err) | 1027 | if (err) |
1029 | break; | 1028 | break; |
1030 | } | 1029 | |
1031 | dput(index); | 1030 | dput(index); |
1032 | index = NULL; | 1031 | index = NULL; |
1033 | } | 1032 | } |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 092d150643c1..f5738e96a052 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -174,6 +174,9 @@ static struct inode *ovl_alloc_inode(struct super_block *sb) | |||
174 | { | 174 | { |
175 | struct ovl_inode *oi = kmem_cache_alloc(ovl_inode_cachep, GFP_KERNEL); | 175 | struct ovl_inode *oi = kmem_cache_alloc(ovl_inode_cachep, GFP_KERNEL); |
176 | 176 | ||
177 | if (!oi) | ||
178 | return NULL; | ||
179 | |||
177 | oi->cache = NULL; | 180 | oi->cache = NULL; |
178 | oi->redirect = NULL; | 181 | oi->redirect = NULL; |
179 | oi->version = 0; | 182 | oi->version = 0; |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 56d0e526870c..6526ef0e2a23 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -237,11 +237,13 @@ xfs_file_dax_read( | |||
237 | if (!count) | 237 | if (!count) |
238 | return 0; /* skip atime */ | 238 | return 0; /* skip atime */ |
239 | 239 | ||
240 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) { | 240 | if (iocb->ki_flags & IOCB_NOWAIT) { |
241 | if (iocb->ki_flags & IOCB_NOWAIT) | 241 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) |
242 | return -EAGAIN; | 242 | return -EAGAIN; |
243 | } else { | ||
243 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | 244 | xfs_ilock(ip, XFS_IOLOCK_SHARED); |
244 | } | 245 | } |
246 | |||
245 | ret = dax_iomap_rw(iocb, to, &xfs_iomap_ops); | 247 | ret = dax_iomap_rw(iocb, to, &xfs_iomap_ops); |
246 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | 248 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); |
247 | 249 | ||
@@ -259,9 +261,10 @@ xfs_file_buffered_aio_read( | |||
259 | 261 | ||
260 | trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos); | 262 | trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos); |
261 | 263 | ||
262 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) { | 264 | if (iocb->ki_flags & IOCB_NOWAIT) { |
263 | if (iocb->ki_flags & IOCB_NOWAIT) | 265 | if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) |
264 | return -EAGAIN; | 266 | return -EAGAIN; |
267 | } else { | ||
265 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | 268 | xfs_ilock(ip, XFS_IOLOCK_SHARED); |
266 | } | 269 | } |
267 | ret = generic_file_read_iter(iocb, to); | 270 | ret = generic_file_read_iter(iocb, to); |
@@ -552,9 +555,10 @@ xfs_file_dio_aio_write( | |||
552 | iolock = XFS_IOLOCK_SHARED; | 555 | iolock = XFS_IOLOCK_SHARED; |
553 | } | 556 | } |
554 | 557 | ||
555 | if (!xfs_ilock_nowait(ip, iolock)) { | 558 | if (iocb->ki_flags & IOCB_NOWAIT) { |
556 | if (iocb->ki_flags & IOCB_NOWAIT) | 559 | if (!xfs_ilock_nowait(ip, iolock)) |
557 | return -EAGAIN; | 560 | return -EAGAIN; |
561 | } else { | ||
558 | xfs_ilock(ip, iolock); | 562 | xfs_ilock(ip, iolock); |
559 | } | 563 | } |
560 | 564 | ||
@@ -606,9 +610,10 @@ xfs_file_dax_write( | |||
606 | size_t count; | 610 | size_t count; |
607 | loff_t pos; | 611 | loff_t pos; |
608 | 612 | ||
609 | if (!xfs_ilock_nowait(ip, iolock)) { | 613 | if (iocb->ki_flags & IOCB_NOWAIT) { |
610 | if (iocb->ki_flags & IOCB_NOWAIT) | 614 | if (!xfs_ilock_nowait(ip, iolock)) |
611 | return -EAGAIN; | 615 | return -EAGAIN; |
616 | } else { | ||
612 | xfs_ilock(ip, iolock); | 617 | xfs_ilock(ip, iolock); |
613 | } | 618 | } |
614 | 619 | ||
diff --git a/include/linux/if_tap.h b/include/linux/if_tap.h index d1b5173ad8f0..d8ca8270f62d 100644 --- a/include/linux/if_tap.h +++ b/include/linux/if_tap.h | |||
@@ -77,8 +77,8 @@ void tap_del_queues(struct tap_dev *tap); | |||
77 | int tap_get_minor(dev_t major, struct tap_dev *tap); | 77 | int tap_get_minor(dev_t major, struct tap_dev *tap); |
78 | void tap_free_minor(dev_t major, struct tap_dev *tap); | 78 | void tap_free_minor(dev_t major, struct tap_dev *tap); |
79 | int tap_queue_resize(struct tap_dev *tap); | 79 | int tap_queue_resize(struct tap_dev *tap); |
80 | int tap_create_cdev(struct cdev *tap_cdev, | 80 | int tap_create_cdev(struct cdev *tap_cdev, dev_t *tap_major, |
81 | dev_t *tap_major, const char *device_name); | 81 | const char *device_name, struct module *module); |
82 | void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev); | 82 | void tap_destroy_cdev(dev_t major, struct cdev *tap_cdev); |
83 | 83 | ||
84 | #endif /*_LINUX_IF_TAP_H_*/ | 84 | #endif /*_LINUX_IF_TAP_H_*/ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index d4728bf6a537..5ad10948ea95 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -1009,7 +1009,7 @@ void irq_gc_mask_clr_bit(struct irq_data *d); | |||
1009 | void irq_gc_unmask_enable_reg(struct irq_data *d); | 1009 | void irq_gc_unmask_enable_reg(struct irq_data *d); |
1010 | void irq_gc_ack_set_bit(struct irq_data *d); | 1010 | void irq_gc_ack_set_bit(struct irq_data *d); |
1011 | void irq_gc_ack_clr_bit(struct irq_data *d); | 1011 | void irq_gc_ack_clr_bit(struct irq_data *d); |
1012 | void irq_gc_mask_disable_reg_and_ack(struct irq_data *d); | 1012 | void irq_gc_mask_disable_and_ack_set(struct irq_data *d); |
1013 | void irq_gc_eoi(struct irq_data *d); | 1013 | void irq_gc_eoi(struct irq_data *d); |
1014 | int irq_gc_set_wake(struct irq_data *d, unsigned int on); | 1014 | int irq_gc_set_wake(struct irq_data *d, unsigned int on); |
1015 | 1015 | ||
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 1ea576c8126f..14b74f22d43c 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
@@ -372,6 +372,8 @@ | |||
372 | #define GITS_BASER_ENTRY_SIZE_SHIFT (48) | 372 | #define GITS_BASER_ENTRY_SIZE_SHIFT (48) |
373 | #define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1) | 373 | #define GITS_BASER_ENTRY_SIZE(r) ((((r) >> GITS_BASER_ENTRY_SIZE_SHIFT) & 0x1f) + 1) |
374 | #define GITS_BASER_ENTRY_SIZE_MASK GENMASK_ULL(52, 48) | 374 | #define GITS_BASER_ENTRY_SIZE_MASK GENMASK_ULL(52, 48) |
375 | #define GITS_BASER_PHYS_52_to_48(phys) \ | ||
376 | (((phys) & GENMASK_ULL(47, 16)) | (((phys) >> 48) & 0xf) << 12) | ||
375 | #define GITS_BASER_SHAREABILITY_SHIFT (10) | 377 | #define GITS_BASER_SHAREABILITY_SHIFT (10) |
376 | #define GITS_BASER_InnerShareable \ | 378 | #define GITS_BASER_InnerShareable \ |
377 | GIC_BASER_SHAREABILITY(GITS_BASER, InnerShareable) | 379 | GIC_BASER_SHAREABILITY(GITS_BASER, InnerShareable) |
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h index c57d4b7de3a8..c59af8ab753a 100644 --- a/include/linux/mlx5/port.h +++ b/include/linux/mlx5/port.h | |||
@@ -157,6 +157,8 @@ int mlx5_set_port_prio_tc(struct mlx5_core_dev *mdev, u8 *prio_tc); | |||
157 | int mlx5_query_port_prio_tc(struct mlx5_core_dev *mdev, | 157 | int mlx5_query_port_prio_tc(struct mlx5_core_dev *mdev, |
158 | u8 prio, u8 *tc); | 158 | u8 prio, u8 *tc); |
159 | int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, u8 *tc_group); | 159 | int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, u8 *tc_group); |
160 | int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev, | ||
161 | u8 tc, u8 *tc_group); | ||
160 | int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw); | 162 | int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw); |
161 | int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, | 163 | int mlx5_query_port_tc_bw_alloc(struct mlx5_core_dev *mdev, |
162 | u8 tc, u8 *bw_pct); | 164 | u8 tc, u8 *bw_pct); |
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 032b55909145..6737a8c9e8c6 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
@@ -27,16 +27,17 @@ enum pm_qos_flags_status { | |||
27 | PM_QOS_FLAGS_ALL, | 27 | PM_QOS_FLAGS_ALL, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #define PM_QOS_DEFAULT_VALUE -1 | 30 | #define PM_QOS_DEFAULT_VALUE (-1) |
31 | #define PM_QOS_LATENCY_ANY S32_MAX | ||
31 | 32 | ||
32 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 33 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
33 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 34 | #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
34 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 | 35 | #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 |
35 | #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0 | 36 | #define PM_QOS_MEMORY_BANDWIDTH_DEFAULT_VALUE 0 |
36 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 | 37 | #define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0 |
38 | #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY | ||
37 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 | 39 | #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0 |
38 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) | 40 | #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1) |
39 | #define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1)) | ||
40 | 41 | ||
41 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) | 42 | #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) |
42 | #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) | 43 | #define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) |
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 82b171e1aa0b..da803dfc7a39 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -231,7 +231,7 @@ struct sctp_datahdr { | |||
231 | __be32 tsn; | 231 | __be32 tsn; |
232 | __be16 stream; | 232 | __be16 stream; |
233 | __be16 ssn; | 233 | __be16 ssn; |
234 | __be32 ppid; | 234 | __u32 ppid; |
235 | __u8 payload[0]; | 235 | __u8 payload[0]; |
236 | }; | 236 | }; |
237 | 237 | ||
@@ -716,28 +716,28 @@ struct sctp_reconf_chunk { | |||
716 | 716 | ||
717 | struct sctp_strreset_outreq { | 717 | struct sctp_strreset_outreq { |
718 | struct sctp_paramhdr param_hdr; | 718 | struct sctp_paramhdr param_hdr; |
719 | __u32 request_seq; | 719 | __be32 request_seq; |
720 | __u32 response_seq; | 720 | __be32 response_seq; |
721 | __u32 send_reset_at_tsn; | 721 | __be32 send_reset_at_tsn; |
722 | __u16 list_of_streams[0]; | 722 | __be16 list_of_streams[0]; |
723 | }; | 723 | }; |
724 | 724 | ||
725 | struct sctp_strreset_inreq { | 725 | struct sctp_strreset_inreq { |
726 | struct sctp_paramhdr param_hdr; | 726 | struct sctp_paramhdr param_hdr; |
727 | __u32 request_seq; | 727 | __be32 request_seq; |
728 | __u16 list_of_streams[0]; | 728 | __be16 list_of_streams[0]; |
729 | }; | 729 | }; |
730 | 730 | ||
731 | struct sctp_strreset_tsnreq { | 731 | struct sctp_strreset_tsnreq { |
732 | struct sctp_paramhdr param_hdr; | 732 | struct sctp_paramhdr param_hdr; |
733 | __u32 request_seq; | 733 | __be32 request_seq; |
734 | }; | 734 | }; |
735 | 735 | ||
736 | struct sctp_strreset_addstrm { | 736 | struct sctp_strreset_addstrm { |
737 | struct sctp_paramhdr param_hdr; | 737 | struct sctp_paramhdr param_hdr; |
738 | __u32 request_seq; | 738 | __be32 request_seq; |
739 | __u16 number_of_streams; | 739 | __be16 number_of_streams; |
740 | __u16 reserved; | 740 | __be16 reserved; |
741 | }; | 741 | }; |
742 | 742 | ||
743 | enum { | 743 | enum { |
@@ -752,16 +752,16 @@ enum { | |||
752 | 752 | ||
753 | struct sctp_strreset_resp { | 753 | struct sctp_strreset_resp { |
754 | struct sctp_paramhdr param_hdr; | 754 | struct sctp_paramhdr param_hdr; |
755 | __u32 response_seq; | 755 | __be32 response_seq; |
756 | __u32 result; | 756 | __be32 result; |
757 | }; | 757 | }; |
758 | 758 | ||
759 | struct sctp_strreset_resptsn { | 759 | struct sctp_strreset_resptsn { |
760 | struct sctp_paramhdr param_hdr; | 760 | struct sctp_paramhdr param_hdr; |
761 | __u32 response_seq; | 761 | __be32 response_seq; |
762 | __u32 result; | 762 | __be32 result; |
763 | __u32 senders_next_tsn; | 763 | __be32 senders_next_tsn; |
764 | __u32 receivers_next_tsn; | 764 | __be32 receivers_next_tsn; |
765 | }; | 765 | }; |
766 | 766 | ||
767 | #endif /* __LINUX_SCTP_H__ */ | 767 | #endif /* __LINUX_SCTP_H__ */ |
diff --git a/include/linux/swait.h b/include/linux/swait.h index 73e97a08d3d0..cf30f5022472 100644 --- a/include/linux/swait.h +++ b/include/linux/swait.h | |||
@@ -9,13 +9,16 @@ | |||
9 | /* | 9 | /* |
10 | * Simple wait queues | 10 | * Simple wait queues |
11 | * | 11 | * |
12 | * While these are very similar to the other/complex wait queues (wait.h) the | 12 | * While these are very similar to regular wait queues (wait.h) the most |
13 | * most important difference is that the simple waitqueue allows for | 13 | * important difference is that the simple waitqueue allows for deterministic |
14 | * deterministic behaviour -- IOW it has strictly bounded IRQ and lock hold | 14 | * behaviour -- IOW it has strictly bounded IRQ and lock hold times. |
15 | * times. | ||
16 | * | 15 | * |
17 | * In order to make this so, we had to drop a fair number of features of the | 16 | * Mainly, this is accomplished by two things. Firstly not allowing swake_up_all |
18 | * other waitqueue code; notably: | 17 | * from IRQ disabled, and dropping the lock upon every wakeup, giving a higher |
18 | * priority task a chance to run. | ||
19 | * | ||
20 | * Secondly, we had to drop a fair number of features of the other waitqueue | ||
21 | * code; notably: | ||
19 | * | 22 | * |
20 | * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue; | 23 | * - mixing INTERRUPTIBLE and UNINTERRUPTIBLE sleeps on the same waitqueue; |
21 | * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right | 24 | * all wakeups are TASK_NORMAL in order to avoid O(n) lookups for the right |
@@ -24,12 +27,14 @@ | |||
24 | * - the exclusive mode; because this requires preserving the list order | 27 | * - the exclusive mode; because this requires preserving the list order |
25 | * and this is hard. | 28 | * and this is hard. |
26 | * | 29 | * |
27 | * - custom wake functions; because you cannot give any guarantees about | 30 | * - custom wake callback functions; because you cannot give any guarantees |
28 | * random code. | 31 | * about random code. This also allows swait to be used in RT, such that |
29 | * | 32 | * raw spinlock can be used for the swait queue head. |
30 | * As a side effect of this; the data structures are slimmer. | ||
31 | * | 33 | * |
32 | * One would recommend using this wait queue where possible. | 34 | * As a side effect of these; the data structures are slimmer albeit more ad-hoc. |
35 | * For all the above, note that simple wait queues should _only_ be used under | ||
36 | * very specific realtime constraints -- it is best to stick with the regular | ||
37 | * wait queues in most cases. | ||
33 | */ | 38 | */ |
34 | 39 | ||
35 | struct task_struct; | 40 | struct task_struct; |
diff --git a/include/net/fq_impl.h b/include/net/fq_impl.h index 8b237e4afee6..be7c0fab3478 100644 --- a/include/net/fq_impl.h +++ b/include/net/fq_impl.h | |||
@@ -159,6 +159,7 @@ static void fq_tin_enqueue(struct fq *fq, | |||
159 | fq_flow_get_default_t get_default_func) | 159 | fq_flow_get_default_t get_default_func) |
160 | { | 160 | { |
161 | struct fq_flow *flow; | 161 | struct fq_flow *flow; |
162 | bool oom; | ||
162 | 163 | ||
163 | lockdep_assert_held(&fq->lock); | 164 | lockdep_assert_held(&fq->lock); |
164 | 165 | ||
@@ -180,8 +181,8 @@ static void fq_tin_enqueue(struct fq *fq, | |||
180 | } | 181 | } |
181 | 182 | ||
182 | __skb_queue_tail(&flow->queue, skb); | 183 | __skb_queue_tail(&flow->queue, skb); |
183 | 184 | oom = (fq->memory_usage > fq->memory_limit); | |
184 | if (fq->backlog > fq->limit || fq->memory_usage > fq->memory_limit) { | 185 | while (fq->backlog > fq->limit || oom) { |
185 | flow = list_first_entry_or_null(&fq->backlogs, | 186 | flow = list_first_entry_or_null(&fq->backlogs, |
186 | struct fq_flow, | 187 | struct fq_flow, |
187 | backlogchain); | 188 | backlogchain); |
@@ -196,8 +197,10 @@ static void fq_tin_enqueue(struct fq *fq, | |||
196 | 197 | ||
197 | flow->tin->overlimit++; | 198 | flow->tin->overlimit++; |
198 | fq->overlimit++; | 199 | fq->overlimit++; |
199 | if (fq->memory_usage > fq->memory_limit) | 200 | if (oom) { |
200 | fq->overmemory++; | 201 | fq->overmemory++; |
202 | oom = (fq->memory_usage > fq->memory_limit); | ||
203 | } | ||
201 | } | 204 | } |
202 | } | 205 | } |
203 | 206 | ||
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index c49938d1481a..2135c9ba6ac3 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -133,6 +133,12 @@ static inline int inet_request_bound_dev_if(const struct sock *sk, | |||
133 | return sk->sk_bound_dev_if; | 133 | return sk->sk_bound_dev_if; |
134 | } | 134 | } |
135 | 135 | ||
136 | static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq) | ||
137 | { | ||
138 | return rcu_dereference_check(ireq->ireq_opt, | ||
139 | refcount_read(&ireq->req.rsk_refcnt) > 0); | ||
140 | } | ||
141 | |||
136 | struct inet_cork { | 142 | struct inet_cork { |
137 | unsigned int flags; | 143 | unsigned int flags; |
138 | __be32 addr; | 144 | __be32 addr; |
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 04caa246e747..bf73e1675519 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_PKT_CLS_H | 2 | #define __NET_PKT_CLS_H |
3 | 3 | ||
4 | #include <linux/pkt_cls.h> | 4 | #include <linux/pkt_cls.h> |
5 | #include <linux/workqueue.h> | ||
5 | #include <net/sch_generic.h> | 6 | #include <net/sch_generic.h> |
6 | #include <net/act_api.h> | 7 | #include <net/act_api.h> |
7 | 8 | ||
@@ -28,6 +29,7 @@ struct tcf_block_ext_info { | |||
28 | }; | 29 | }; |
29 | 30 | ||
30 | struct tcf_block_cb; | 31 | struct tcf_block_cb; |
32 | bool tcf_queue_work(struct work_struct *work); | ||
31 | 33 | ||
32 | #ifdef CONFIG_NET_CLS | 34 | #ifdef CONFIG_NET_CLS |
33 | struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, | 35 | struct tcf_chain *tcf_chain_get(struct tcf_block *block, u32 chain_index, |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 031dffd5836c..07c179dab478 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/dynamic_queue_limits.h> | 10 | #include <linux/dynamic_queue_limits.h> |
11 | #include <linux/list.h> | 11 | #include <linux/list.h> |
12 | #include <linux/refcount.h> | 12 | #include <linux/refcount.h> |
13 | #include <linux/workqueue.h> | ||
13 | #include <net/gen_stats.h> | 14 | #include <net/gen_stats.h> |
14 | #include <net/rtnetlink.h> | 15 | #include <net/rtnetlink.h> |
15 | 16 | ||
@@ -273,6 +274,7 @@ struct tcf_block { | |||
273 | struct net *net; | 274 | struct net *net; |
274 | struct Qdisc *q; | 275 | struct Qdisc *q; |
275 | struct list_head cb_list; | 276 | struct list_head cb_list; |
277 | struct work_struct work; | ||
276 | }; | 278 | }; |
277 | 279 | ||
278 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) | 280 | static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz) |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 13cc4963e905..70fb397f65b0 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -261,7 +261,7 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, | |||
261 | struct sctp_fwdtsn_skip *skiplist); | 261 | struct sctp_fwdtsn_skip *skiplist); |
262 | struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc); | 262 | struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc); |
263 | struct sctp_chunk *sctp_make_strreset_req(const struct sctp_association *asoc, | 263 | struct sctp_chunk *sctp_make_strreset_req(const struct sctp_association *asoc, |
264 | __u16 stream_num, __u16 *stream_list, | 264 | __u16 stream_num, __be16 *stream_list, |
265 | bool out, bool in); | 265 | bool out, bool in); |
266 | struct sctp_chunk *sctp_make_strreset_tsnreq( | 266 | struct sctp_chunk *sctp_make_strreset_tsnreq( |
267 | const struct sctp_association *asoc); | 267 | const struct sctp_association *asoc); |
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index b8c86ec1a8f5..231dc42f1da6 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -130,7 +130,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( | |||
130 | 130 | ||
131 | struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( | 131 | struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( |
132 | const struct sctp_association *asoc, __u16 flags, | 132 | const struct sctp_association *asoc, __u16 flags, |
133 | __u16 stream_num, __u16 *stream_list, gfp_t gfp); | 133 | __u16 stream_num, __be16 *stream_list, gfp_t gfp); |
134 | 134 | ||
135 | struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event( | 135 | struct sctp_ulpevent *sctp_ulpevent_make_assoc_reset_event( |
136 | const struct sctp_association *asoc, __u16 flags, | 136 | const struct sctp_association *asoc, __u16 flags, |
diff --git a/include/net/strparser.h b/include/net/strparser.h index 7dc131d62ad5..d96b59f45eba 100644 --- a/include/net/strparser.h +++ b/include/net/strparser.h | |||
@@ -74,10 +74,9 @@ struct strparser { | |||
74 | u32 unrecov_intr : 1; | 74 | u32 unrecov_intr : 1; |
75 | 75 | ||
76 | struct sk_buff **skb_nextp; | 76 | struct sk_buff **skb_nextp; |
77 | struct timer_list msg_timer; | ||
78 | struct sk_buff *skb_head; | 77 | struct sk_buff *skb_head; |
79 | unsigned int need_bytes; | 78 | unsigned int need_bytes; |
80 | struct delayed_work delayed_work; | 79 | struct delayed_work msg_timer_work; |
81 | struct work_struct work; | 80 | struct work_struct work; |
82 | struct strp_stats stats; | 81 | struct strp_stats stats; |
83 | struct strp_callbacks cb; | 82 | struct strp_callbacks cb; |
diff --git a/include/net/tcp.h b/include/net/tcp.h index aa1cc90fdc02..a2510cdef4b5 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -816,6 +816,7 @@ struct tcp_skb_cb { | |||
816 | __u32 key; | 816 | __u32 key; |
817 | __u32 flags; | 817 | __u32 flags; |
818 | struct bpf_map *map; | 818 | struct bpf_map *map; |
819 | void *data_end; | ||
819 | } bpf; | 820 | } bpf; |
820 | }; | 821 | }; |
821 | }; | 822 | }; |
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index f650346aaa1a..0b7b54d898bd 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
@@ -645,7 +645,7 @@ union bpf_attr { | |||
645 | * @map: pointer to sockmap | 645 | * @map: pointer to sockmap |
646 | * @key: key to lookup sock in map | 646 | * @key: key to lookup sock in map |
647 | * @flags: reserved for future use | 647 | * @flags: reserved for future use |
648 | * Return: SK_REDIRECT | 648 | * Return: SK_PASS |
649 | * | 649 | * |
650 | * int bpf_sock_map_update(skops, map, key, flags) | 650 | * int bpf_sock_map_update(skops, map, key, flags) |
651 | * @skops: pointer to bpf_sock_ops | 651 | * @skops: pointer to bpf_sock_ops |
@@ -887,8 +887,8 @@ struct xdp_md { | |||
887 | }; | 887 | }; |
888 | 888 | ||
889 | enum sk_action { | 889 | enum sk_action { |
890 | SK_ABORTED = 0, | 890 | SK_DROP = 0, |
891 | SK_DROP, | 891 | SK_PASS, |
892 | SK_REDIRECT, | 892 | SK_REDIRECT, |
893 | }; | 893 | }; |
894 | 894 | ||
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h index 6cd7d416ca40..48c84a84721e 100644 --- a/include/uapi/linux/sctp.h +++ b/include/uapi/linux/sctp.h | |||
@@ -378,7 +378,7 @@ struct sctp_remote_error { | |||
378 | __u16 sre_type; | 378 | __u16 sre_type; |
379 | __u16 sre_flags; | 379 | __u16 sre_flags; |
380 | __u32 sre_length; | 380 | __u32 sre_length; |
381 | __u16 sre_error; | 381 | __be16 sre_error; |
382 | sctp_assoc_t sre_assoc_id; | 382 | sctp_assoc_t sre_assoc_id; |
383 | __u8 sre_data[0]; | 383 | __u8 sre_data[0]; |
384 | }; | 384 | }; |
diff --git a/include/uapi/linux/spi/spidev.h b/include/uapi/linux/spi/spidev.h index dd5f21e75805..856de39d0b89 100644 --- a/include/uapi/linux/spi/spidev.h +++ b/include/uapi/linux/spi/spidev.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define SPIDEV_H | 23 | #define SPIDEV_H |
24 | 24 | ||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/ioctl.h> | ||
26 | 27 | ||
27 | /* User space versions of kernel symbols for SPI clocking modes, | 28 | /* User space versions of kernel symbols for SPI clocking modes, |
28 | * matching <linux/spi/spi.h> | 29 | * matching <linux/spi/spi.h> |
diff --git a/init/Kconfig b/init/Kconfig index 78cb2461012e..3c1faaa2af4a 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1033,7 +1033,7 @@ endif | |||
1033 | 1033 | ||
1034 | choice | 1034 | choice |
1035 | prompt "Compiler optimization level" | 1035 | prompt "Compiler optimization level" |
1036 | default CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE | 1036 | default CC_OPTIMIZE_FOR_PERFORMANCE |
1037 | 1037 | ||
1038 | config CC_OPTIMIZE_FOR_PERFORMANCE | 1038 | config CC_OPTIMIZE_FOR_PERFORMANCE |
1039 | bool "Optimize for performance" | 1039 | bool "Optimize for performance" |
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index eef843c3b419..de8f66cad882 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c | |||
@@ -96,6 +96,14 @@ static inline struct smap_psock *smap_psock_sk(const struct sock *sk) | |||
96 | return rcu_dereference_sk_user_data(sk); | 96 | return rcu_dereference_sk_user_data(sk); |
97 | } | 97 | } |
98 | 98 | ||
99 | /* compute the linear packet data range [data, data_end) for skb when | ||
100 | * sk_skb type programs are in use. | ||
101 | */ | ||
102 | static inline void bpf_compute_data_end_sk_skb(struct sk_buff *skb) | ||
103 | { | ||
104 | TCP_SKB_CB(skb)->bpf.data_end = skb->data + skb_headlen(skb); | ||
105 | } | ||
106 | |||
99 | static int smap_verdict_func(struct smap_psock *psock, struct sk_buff *skb) | 107 | static int smap_verdict_func(struct smap_psock *psock, struct sk_buff *skb) |
100 | { | 108 | { |
101 | struct bpf_prog *prog = READ_ONCE(psock->bpf_verdict); | 109 | struct bpf_prog *prog = READ_ONCE(psock->bpf_verdict); |
@@ -117,7 +125,8 @@ static int smap_verdict_func(struct smap_psock *psock, struct sk_buff *skb) | |||
117 | preempt_enable(); | 125 | preempt_enable(); |
118 | skb->sk = NULL; | 126 | skb->sk = NULL; |
119 | 127 | ||
120 | return rc; | 128 | return rc == SK_PASS ? |
129 | (TCP_SKB_CB(skb)->bpf.map ? SK_REDIRECT : SK_PASS) : SK_DROP; | ||
121 | } | 130 | } |
122 | 131 | ||
123 | static void smap_do_verdict(struct smap_psock *psock, struct sk_buff *skb) | 132 | static void smap_do_verdict(struct smap_psock *psock, struct sk_buff *skb) |
diff --git a/kernel/cpu.c b/kernel/cpu.c index d851df22f5c5..04892a82f6ac 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -632,6 +632,11 @@ cpuhp_invoke_ap_callback(int cpu, enum cpuhp_state state, bool bringup, | |||
632 | __cpuhp_kick_ap(st); | 632 | __cpuhp_kick_ap(st); |
633 | } | 633 | } |
634 | 634 | ||
635 | /* | ||
636 | * Clean up the leftovers so the next hotplug operation wont use stale | ||
637 | * data. | ||
638 | */ | ||
639 | st->node = st->last = NULL; | ||
635 | return ret; | 640 | return ret; |
636 | } | 641 | } |
637 | 642 | ||
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 5270a54b9fa4..c26c5bb6b491 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
@@ -135,17 +135,26 @@ void irq_gc_ack_clr_bit(struct irq_data *d) | |||
135 | } | 135 | } |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * irq_gc_mask_disable_reg_and_ack - Mask and ack pending interrupt | 138 | * irq_gc_mask_disable_and_ack_set - Mask and ack pending interrupt |
139 | * @d: irq_data | 139 | * @d: irq_data |
140 | * | ||
141 | * This generic implementation of the irq_mask_ack method is for chips | ||
142 | * with separate enable/disable registers instead of a single mask | ||
143 | * register and where a pending interrupt is acknowledged by setting a | ||
144 | * bit. | ||
145 | * | ||
146 | * Note: This is the only permutation currently used. Similar generic | ||
147 | * functions should be added here if other permutations are required. | ||
140 | */ | 148 | */ |
141 | void irq_gc_mask_disable_reg_and_ack(struct irq_data *d) | 149 | void irq_gc_mask_disable_and_ack_set(struct irq_data *d) |
142 | { | 150 | { |
143 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 151 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
144 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | 152 | struct irq_chip_type *ct = irq_data_get_chip_type(d); |
145 | u32 mask = d->mask; | 153 | u32 mask = d->mask; |
146 | 154 | ||
147 | irq_gc_lock(gc); | 155 | irq_gc_lock(gc); |
148 | irq_reg_writel(gc, mask, ct->regs.mask); | 156 | irq_reg_writel(gc, mask, ct->regs.disable); |
157 | *ct->mask_cache &= ~mask; | ||
149 | irq_reg_writel(gc, mask, ct->regs.ack); | 158 | irq_reg_writel(gc, mask, ct->regs.ack); |
150 | irq_gc_unlock(gc); | 159 | irq_gc_unlock(gc); |
151 | } | 160 | } |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 64d0edf428f8..a2dccfe1acec 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -68,6 +68,7 @@ enum { | |||
68 | * attach_mutex to avoid changing binding state while | 68 | * attach_mutex to avoid changing binding state while |
69 | * worker_attach_to_pool() is in progress. | 69 | * worker_attach_to_pool() is in progress. |
70 | */ | 70 | */ |
71 | POOL_MANAGER_ACTIVE = 1 << 0, /* being managed */ | ||
71 | POOL_DISASSOCIATED = 1 << 2, /* cpu can't serve workers */ | 72 | POOL_DISASSOCIATED = 1 << 2, /* cpu can't serve workers */ |
72 | 73 | ||
73 | /* worker flags */ | 74 | /* worker flags */ |
@@ -165,7 +166,6 @@ struct worker_pool { | |||
165 | /* L: hash of busy workers */ | 166 | /* L: hash of busy workers */ |
166 | 167 | ||
167 | /* see manage_workers() for details on the two manager mutexes */ | 168 | /* see manage_workers() for details on the two manager mutexes */ |
168 | struct mutex manager_arb; /* manager arbitration */ | ||
169 | struct worker *manager; /* L: purely informational */ | 169 | struct worker *manager; /* L: purely informational */ |
170 | struct mutex attach_mutex; /* attach/detach exclusion */ | 170 | struct mutex attach_mutex; /* attach/detach exclusion */ |
171 | struct list_head workers; /* A: attached workers */ | 171 | struct list_head workers; /* A: attached workers */ |
@@ -299,6 +299,7 @@ static struct workqueue_attrs *wq_update_unbound_numa_attrs_buf; | |||
299 | 299 | ||
300 | static DEFINE_MUTEX(wq_pool_mutex); /* protects pools and workqueues list */ | 300 | static DEFINE_MUTEX(wq_pool_mutex); /* protects pools and workqueues list */ |
301 | static DEFINE_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ | 301 | static DEFINE_SPINLOCK(wq_mayday_lock); /* protects wq->maydays list */ |
302 | static DECLARE_WAIT_QUEUE_HEAD(wq_manager_wait); /* wait for manager to go away */ | ||
302 | 303 | ||
303 | static LIST_HEAD(workqueues); /* PR: list of all workqueues */ | 304 | static LIST_HEAD(workqueues); /* PR: list of all workqueues */ |
304 | static bool workqueue_freezing; /* PL: have wqs started freezing? */ | 305 | static bool workqueue_freezing; /* PL: have wqs started freezing? */ |
@@ -801,7 +802,7 @@ static bool need_to_create_worker(struct worker_pool *pool) | |||
801 | /* Do we have too many workers and should some go away? */ | 802 | /* Do we have too many workers and should some go away? */ |
802 | static bool too_many_workers(struct worker_pool *pool) | 803 | static bool too_many_workers(struct worker_pool *pool) |
803 | { | 804 | { |
804 | bool managing = mutex_is_locked(&pool->manager_arb); | 805 | bool managing = pool->flags & POOL_MANAGER_ACTIVE; |
805 | int nr_idle = pool->nr_idle + managing; /* manager is considered idle */ | 806 | int nr_idle = pool->nr_idle + managing; /* manager is considered idle */ |
806 | int nr_busy = pool->nr_workers - nr_idle; | 807 | int nr_busy = pool->nr_workers - nr_idle; |
807 | 808 | ||
@@ -1980,24 +1981,17 @@ static bool manage_workers(struct worker *worker) | |||
1980 | { | 1981 | { |
1981 | struct worker_pool *pool = worker->pool; | 1982 | struct worker_pool *pool = worker->pool; |
1982 | 1983 | ||
1983 | /* | 1984 | if (pool->flags & POOL_MANAGER_ACTIVE) |
1984 | * Anyone who successfully grabs manager_arb wins the arbitration | ||
1985 | * and becomes the manager. mutex_trylock() on pool->manager_arb | ||
1986 | * failure while holding pool->lock reliably indicates that someone | ||
1987 | * else is managing the pool and the worker which failed trylock | ||
1988 | * can proceed to executing work items. This means that anyone | ||
1989 | * grabbing manager_arb is responsible for actually performing | ||
1990 | * manager duties. If manager_arb is grabbed and released without | ||
1991 | * actual management, the pool may stall indefinitely. | ||
1992 | */ | ||
1993 | if (!mutex_trylock(&pool->manager_arb)) | ||
1994 | return false; | 1985 | return false; |
1986 | |||
1987 | pool->flags |= POOL_MANAGER_ACTIVE; | ||
1995 | pool->manager = worker; | 1988 | pool->manager = worker; |
1996 | 1989 | ||
1997 | maybe_create_worker(pool); | 1990 | maybe_create_worker(pool); |
1998 | 1991 | ||
1999 | pool->manager = NULL; | 1992 | pool->manager = NULL; |
2000 | mutex_unlock(&pool->manager_arb); | 1993 | pool->flags &= ~POOL_MANAGER_ACTIVE; |
1994 | wake_up(&wq_manager_wait); | ||
2001 | return true; | 1995 | return true; |
2002 | } | 1996 | } |
2003 | 1997 | ||
@@ -3248,7 +3242,6 @@ static int init_worker_pool(struct worker_pool *pool) | |||
3248 | setup_timer(&pool->mayday_timer, pool_mayday_timeout, | 3242 | setup_timer(&pool->mayday_timer, pool_mayday_timeout, |
3249 | (unsigned long)pool); | 3243 | (unsigned long)pool); |
3250 | 3244 | ||
3251 | mutex_init(&pool->manager_arb); | ||
3252 | mutex_init(&pool->attach_mutex); | 3245 | mutex_init(&pool->attach_mutex); |
3253 | INIT_LIST_HEAD(&pool->workers); | 3246 | INIT_LIST_HEAD(&pool->workers); |
3254 | 3247 | ||
@@ -3318,13 +3311,15 @@ static void put_unbound_pool(struct worker_pool *pool) | |||
3318 | hash_del(&pool->hash_node); | 3311 | hash_del(&pool->hash_node); |
3319 | 3312 | ||
3320 | /* | 3313 | /* |
3321 | * Become the manager and destroy all workers. Grabbing | 3314 | * Become the manager and destroy all workers. This prevents |
3322 | * manager_arb prevents @pool's workers from blocking on | 3315 | * @pool's workers from blocking on attach_mutex. We're the last |
3323 | * attach_mutex. | 3316 | * manager and @pool gets freed with the flag set. |
3324 | */ | 3317 | */ |
3325 | mutex_lock(&pool->manager_arb); | ||
3326 | |||
3327 | spin_lock_irq(&pool->lock); | 3318 | spin_lock_irq(&pool->lock); |
3319 | wait_event_lock_irq(wq_manager_wait, | ||
3320 | !(pool->flags & POOL_MANAGER_ACTIVE), pool->lock); | ||
3321 | pool->flags |= POOL_MANAGER_ACTIVE; | ||
3322 | |||
3328 | while ((worker = first_idle_worker(pool))) | 3323 | while ((worker = first_idle_worker(pool))) |
3329 | destroy_worker(worker); | 3324 | destroy_worker(worker); |
3330 | WARN_ON(pool->nr_workers || pool->nr_idle); | 3325 | WARN_ON(pool->nr_workers || pool->nr_idle); |
@@ -3338,8 +3333,6 @@ static void put_unbound_pool(struct worker_pool *pool) | |||
3338 | if (pool->detach_completion) | 3333 | if (pool->detach_completion) |
3339 | wait_for_completion(pool->detach_completion); | 3334 | wait_for_completion(pool->detach_completion); |
3340 | 3335 | ||
3341 | mutex_unlock(&pool->manager_arb); | ||
3342 | |||
3343 | /* shut down the timers */ | 3336 | /* shut down the timers */ |
3344 | del_timer_sync(&pool->idle_timer); | 3337 | del_timer_sync(&pool->idle_timer); |
3345 | del_timer_sync(&pool->mayday_timer); | 3338 | del_timer_sync(&pool->mayday_timer); |
diff --git a/lib/assoc_array.c b/lib/assoc_array.c index 155c55d8db5f..4e53be8bc590 100644 --- a/lib/assoc_array.c +++ b/lib/assoc_array.c | |||
@@ -598,21 +598,31 @@ static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit, | |||
598 | if ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0) | 598 | if ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT] ^ base_seg) == 0) |
599 | goto all_leaves_cluster_together; | 599 | goto all_leaves_cluster_together; |
600 | 600 | ||
601 | /* Otherwise we can just insert a new node ahead of the old | 601 | /* Otherwise all the old leaves cluster in the same slot, but |
602 | * one. | 602 | * the new leaf wants to go into a different slot - so we |
603 | * create a new node (n0) to hold the new leaf and a pointer to | ||
604 | * a new node (n1) holding all the old leaves. | ||
605 | * | ||
606 | * This can be done by falling through to the node splitting | ||
607 | * path. | ||
603 | */ | 608 | */ |
604 | goto present_leaves_cluster_but_not_new_leaf; | 609 | pr_devel("present leaves cluster but not new leaf\n"); |
605 | } | 610 | } |
606 | 611 | ||
607 | split_node: | 612 | split_node: |
608 | pr_devel("split node\n"); | 613 | pr_devel("split node\n"); |
609 | 614 | ||
610 | /* We need to split the current node; we know that the node doesn't | 615 | /* We need to split the current node. The node must contain anything |
611 | * simply contain a full set of leaves that cluster together (it | 616 | * from a single leaf (in the one leaf case, this leaf will cluster |
612 | * contains meta pointers and/or non-clustering leaves). | 617 | * with the new leaf) and the rest meta-pointers, to all leaves, some |
618 | * of which may cluster. | ||
619 | * | ||
620 | * It won't contain the case in which all the current leaves plus the | ||
621 | * new leaves want to cluster in the same slot. | ||
613 | * | 622 | * |
614 | * We need to expel at least two leaves out of a set consisting of the | 623 | * We need to expel at least two leaves out of a set consisting of the |
615 | * leaves in the node and the new leaf. | 624 | * leaves in the node and the new leaf. The current meta pointers can |
625 | * just be copied as they shouldn't cluster with any of the leaves. | ||
616 | * | 626 | * |
617 | * We need a new node (n0) to replace the current one and a new node to | 627 | * We need a new node (n0) to replace the current one and a new node to |
618 | * take the expelled nodes (n1). | 628 | * take the expelled nodes (n1). |
@@ -717,33 +727,6 @@ found_slot_for_multiple_occupancy: | |||
717 | pr_devel("<--%s() = ok [split node]\n", __func__); | 727 | pr_devel("<--%s() = ok [split node]\n", __func__); |
718 | return true; | 728 | return true; |
719 | 729 | ||
720 | present_leaves_cluster_but_not_new_leaf: | ||
721 | /* All the old leaves cluster in the same slot, but the new leaf wants | ||
722 | * to go into a different slot, so we create a new node to hold the new | ||
723 | * leaf and a pointer to a new node holding all the old leaves. | ||
724 | */ | ||
725 | pr_devel("present leaves cluster but not new leaf\n"); | ||
726 | |||
727 | new_n0->back_pointer = node->back_pointer; | ||
728 | new_n0->parent_slot = node->parent_slot; | ||
729 | new_n0->nr_leaves_on_branch = node->nr_leaves_on_branch; | ||
730 | new_n1->back_pointer = assoc_array_node_to_ptr(new_n0); | ||
731 | new_n1->parent_slot = edit->segment_cache[0]; | ||
732 | new_n1->nr_leaves_on_branch = node->nr_leaves_on_branch; | ||
733 | edit->adjust_count_on = new_n0; | ||
734 | |||
735 | for (i = 0; i < ASSOC_ARRAY_FAN_OUT; i++) | ||
736 | new_n1->slots[i] = node->slots[i]; | ||
737 | |||
738 | new_n0->slots[edit->segment_cache[0]] = assoc_array_node_to_ptr(new_n0); | ||
739 | edit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT]]; | ||
740 | |||
741 | edit->set[0].ptr = &assoc_array_ptr_to_node(node->back_pointer)->slots[node->parent_slot]; | ||
742 | edit->set[0].to = assoc_array_node_to_ptr(new_n0); | ||
743 | edit->excised_meta[0] = assoc_array_node_to_ptr(node); | ||
744 | pr_devel("<--%s() = ok [insert node before]\n", __func__); | ||
745 | return true; | ||
746 | |||
747 | all_leaves_cluster_together: | 730 | all_leaves_cluster_together: |
748 | /* All the leaves, new and old, want to cluster together in this node | 731 | /* All the leaves, new and old, want to cluster together in this node |
749 | * in the same slot, so we have to replace this node with a shortcut to | 732 | * in the same slot, so we have to replace this node with a shortcut to |
diff --git a/net/core/filter.c b/net/core/filter.c index b79c44cc8145..721c30889033 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -1845,14 +1845,15 @@ BPF_CALL_4(bpf_sk_redirect_map, struct sk_buff *, skb, | |||
1845 | { | 1845 | { |
1846 | struct tcp_skb_cb *tcb = TCP_SKB_CB(skb); | 1846 | struct tcp_skb_cb *tcb = TCP_SKB_CB(skb); |
1847 | 1847 | ||
1848 | /* If user passes invalid input drop the packet. */ | ||
1848 | if (unlikely(flags)) | 1849 | if (unlikely(flags)) |
1849 | return SK_ABORTED; | 1850 | return SK_DROP; |
1850 | 1851 | ||
1851 | tcb->bpf.key = key; | 1852 | tcb->bpf.key = key; |
1852 | tcb->bpf.flags = flags; | 1853 | tcb->bpf.flags = flags; |
1853 | tcb->bpf.map = map; | 1854 | tcb->bpf.map = map; |
1854 | 1855 | ||
1855 | return SK_REDIRECT; | 1856 | return SK_PASS; |
1856 | } | 1857 | } |
1857 | 1858 | ||
1858 | struct sock *do_sk_redirect_map(struct sk_buff *skb) | 1859 | struct sock *do_sk_redirect_map(struct sk_buff *skb) |
@@ -4475,6 +4476,31 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type, | |||
4475 | return insn - insn_buf; | 4476 | return insn - insn_buf; |
4476 | } | 4477 | } |
4477 | 4478 | ||
4479 | static u32 sk_skb_convert_ctx_access(enum bpf_access_type type, | ||
4480 | const struct bpf_insn *si, | ||
4481 | struct bpf_insn *insn_buf, | ||
4482 | struct bpf_prog *prog, u32 *target_size) | ||
4483 | { | ||
4484 | struct bpf_insn *insn = insn_buf; | ||
4485 | int off; | ||
4486 | |||
4487 | switch (si->off) { | ||
4488 | case offsetof(struct __sk_buff, data_end): | ||
4489 | off = si->off; | ||
4490 | off -= offsetof(struct __sk_buff, data_end); | ||
4491 | off += offsetof(struct sk_buff, cb); | ||
4492 | off += offsetof(struct tcp_skb_cb, bpf.data_end); | ||
4493 | *insn++ = BPF_LDX_MEM(BPF_SIZEOF(void *), si->dst_reg, | ||
4494 | si->src_reg, off); | ||
4495 | break; | ||
4496 | default: | ||
4497 | return bpf_convert_ctx_access(type, si, insn_buf, prog, | ||
4498 | target_size); | ||
4499 | } | ||
4500 | |||
4501 | return insn - insn_buf; | ||
4502 | } | ||
4503 | |||
4478 | const struct bpf_verifier_ops sk_filter_verifier_ops = { | 4504 | const struct bpf_verifier_ops sk_filter_verifier_ops = { |
4479 | .get_func_proto = sk_filter_func_proto, | 4505 | .get_func_proto = sk_filter_func_proto, |
4480 | .is_valid_access = sk_filter_is_valid_access, | 4506 | .is_valid_access = sk_filter_is_valid_access, |
@@ -4565,7 +4591,7 @@ const struct bpf_prog_ops sock_ops_prog_ops = { | |||
4565 | const struct bpf_verifier_ops sk_skb_verifier_ops = { | 4591 | const struct bpf_verifier_ops sk_skb_verifier_ops = { |
4566 | .get_func_proto = sk_skb_func_proto, | 4592 | .get_func_proto = sk_skb_func_proto, |
4567 | .is_valid_access = sk_skb_is_valid_access, | 4593 | .is_valid_access = sk_skb_is_valid_access, |
4568 | .convert_ctx_access = bpf_convert_ctx_access, | 4594 | .convert_ctx_access = sk_skb_convert_ctx_access, |
4569 | .gen_prologue = sk_skb_prologue, | 4595 | .gen_prologue = sk_skb_prologue, |
4570 | }; | 4596 | }; |
4571 | 4597 | ||
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 0490916864f9..e65fcb45c3f6 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -495,7 +495,7 @@ static int dccp_v4_send_response(const struct sock *sk, struct request_sock *req | |||
495 | ireq->ir_rmt_addr); | 495 | ireq->ir_rmt_addr); |
496 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, | 496 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
497 | ireq->ir_rmt_addr, | 497 | ireq->ir_rmt_addr, |
498 | rcu_dereference(ireq->ireq_opt)); | 498 | ireq_opt_deref(ireq)); |
499 | err = net_xmit_eval(err); | 499 | err = net_xmit_eval(err); |
500 | } | 500 | } |
501 | 501 | ||
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index de91c48b6806..4d1ccf87c59c 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c | |||
@@ -486,14 +486,15 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index, | |||
486 | if (!ethernet) | 486 | if (!ethernet) |
487 | return -EINVAL; | 487 | return -EINVAL; |
488 | ethernet_dev = of_find_net_device_by_node(ethernet); | 488 | ethernet_dev = of_find_net_device_by_node(ethernet); |
489 | if (!ethernet_dev) | ||
490 | return -EPROBE_DEFER; | ||
489 | } else { | 491 | } else { |
490 | ethernet_dev = dsa_dev_to_net_device(ds->cd->netdev[index]); | 492 | ethernet_dev = dsa_dev_to_net_device(ds->cd->netdev[index]); |
493 | if (!ethernet_dev) | ||
494 | return -EPROBE_DEFER; | ||
491 | dev_put(ethernet_dev); | 495 | dev_put(ethernet_dev); |
492 | } | 496 | } |
493 | 497 | ||
494 | if (!ethernet_dev) | ||
495 | return -EPROBE_DEFER; | ||
496 | |||
497 | if (!dst->cpu_dp) { | 498 | if (!dst->cpu_dp) { |
498 | dst->cpu_dp = port; | 499 | dst->cpu_dp = port; |
499 | dst->cpu_dp->master = ethernet_dev; | 500 | dst->cpu_dp->master = ethernet_dev; |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index ca03a1dcbc8f..4ca46dc08e63 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -541,7 +541,8 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, | |||
541 | struct ip_options_rcu *opt; | 541 | struct ip_options_rcu *opt; |
542 | struct rtable *rt; | 542 | struct rtable *rt; |
543 | 543 | ||
544 | opt = rcu_dereference(ireq->ireq_opt); | 544 | opt = ireq_opt_deref(ireq); |
545 | |||
545 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, | 546 | flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, |
546 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, | 547 | RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, |
547 | sk->sk_protocol, inet_sk_flowi_flags(sk), | 548 | sk->sk_protocol, inet_sk_flowi_flags(sk), |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 1e47818e38c7..c891235b4966 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -128,43 +128,68 @@ static struct rtnl_link_ops ipip_link_ops __read_mostly; | |||
128 | 128 | ||
129 | static int ipip_err(struct sk_buff *skb, u32 info) | 129 | static int ipip_err(struct sk_buff *skb, u32 info) |
130 | { | 130 | { |
131 | 131 | /* All the routers (except for Linux) return only | |
132 | /* All the routers (except for Linux) return only | 132 | * 8 bytes of packet payload. It means, that precise relaying of |
133 | 8 bytes of packet payload. It means, that precise relaying of | 133 | * ICMP in the real Internet is absolutely infeasible. |
134 | ICMP in the real Internet is absolutely infeasible. | 134 | */ |
135 | */ | ||
136 | struct net *net = dev_net(skb->dev); | 135 | struct net *net = dev_net(skb->dev); |
137 | struct ip_tunnel_net *itn = net_generic(net, ipip_net_id); | 136 | struct ip_tunnel_net *itn = net_generic(net, ipip_net_id); |
138 | const struct iphdr *iph = (const struct iphdr *)skb->data; | 137 | const struct iphdr *iph = (const struct iphdr *)skb->data; |
139 | struct ip_tunnel *t; | ||
140 | int err; | ||
141 | const int type = icmp_hdr(skb)->type; | 138 | const int type = icmp_hdr(skb)->type; |
142 | const int code = icmp_hdr(skb)->code; | 139 | const int code = icmp_hdr(skb)->code; |
140 | struct ip_tunnel *t; | ||
141 | int err = 0; | ||
142 | |||
143 | switch (type) { | ||
144 | case ICMP_DEST_UNREACH: | ||
145 | switch (code) { | ||
146 | case ICMP_SR_FAILED: | ||
147 | /* Impossible event. */ | ||
148 | goto out; | ||
149 | default: | ||
150 | /* All others are translated to HOST_UNREACH. | ||
151 | * rfc2003 contains "deep thoughts" about NET_UNREACH, | ||
152 | * I believe they are just ether pollution. --ANK | ||
153 | */ | ||
154 | break; | ||
155 | } | ||
156 | break; | ||
157 | |||
158 | case ICMP_TIME_EXCEEDED: | ||
159 | if (code != ICMP_EXC_TTL) | ||
160 | goto out; | ||
161 | break; | ||
162 | |||
163 | case ICMP_REDIRECT: | ||
164 | break; | ||
165 | |||
166 | default: | ||
167 | goto out; | ||
168 | } | ||
143 | 169 | ||
144 | err = -ENOENT; | ||
145 | t = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, | 170 | t = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY, |
146 | iph->daddr, iph->saddr, 0); | 171 | iph->daddr, iph->saddr, 0); |
147 | if (!t) | 172 | if (!t) { |
173 | err = -ENOENT; | ||
148 | goto out; | 174 | goto out; |
175 | } | ||
149 | 176 | ||
150 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { | 177 | if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { |
151 | ipv4_update_pmtu(skb, dev_net(skb->dev), info, | 178 | ipv4_update_pmtu(skb, net, info, t->parms.link, 0, |
152 | t->parms.link, 0, iph->protocol, 0); | 179 | iph->protocol, 0); |
153 | err = 0; | ||
154 | goto out; | 180 | goto out; |
155 | } | 181 | } |
156 | 182 | ||
157 | if (type == ICMP_REDIRECT) { | 183 | if (type == ICMP_REDIRECT) { |
158 | ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0, | 184 | ipv4_redirect(skb, net, t->parms.link, 0, iph->protocol, 0); |
159 | iph->protocol, 0); | ||
160 | err = 0; | ||
161 | goto out; | 185 | goto out; |
162 | } | 186 | } |
163 | 187 | ||
164 | if (t->parms.iph.daddr == 0) | 188 | if (t->parms.iph.daddr == 0) { |
189 | err = -ENOENT; | ||
165 | goto out; | 190 | goto out; |
191 | } | ||
166 | 192 | ||
167 | err = 0; | ||
168 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) | 193 | if (t->parms.iph.ttl == 0 && type == ICMP_TIME_EXCEEDED) |
169 | goto out; | 194 | goto out; |
170 | 195 | ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 7c1dae6493c3..0162c577bb9c 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -881,7 +881,7 @@ static int tcp_v4_send_synack(const struct sock *sk, struct dst_entry *dst, | |||
881 | 881 | ||
882 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, | 882 | err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, |
883 | ireq->ir_rmt_addr, | 883 | ireq->ir_rmt_addr, |
884 | rcu_dereference(ireq->ireq_opt)); | 884 | ireq_opt_deref(ireq)); |
885 | err = net_xmit_eval(err); | 885 | err = net_xmit_eval(err); |
886 | } | 886 | } |
887 | 887 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index aab6e7145013..a69a34f57330 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -781,8 +781,10 @@ static void tcp_tsq_handler(struct sock *sk) | |||
781 | struct tcp_sock *tp = tcp_sk(sk); | 781 | struct tcp_sock *tp = tcp_sk(sk); |
782 | 782 | ||
783 | if (tp->lost_out > tp->retrans_out && | 783 | if (tp->lost_out > tp->retrans_out && |
784 | tp->snd_cwnd > tcp_packets_in_flight(tp)) | 784 | tp->snd_cwnd > tcp_packets_in_flight(tp)) { |
785 | tcp_mstamp_refresh(tp); | ||
785 | tcp_xmit_retransmit_queue(sk); | 786 | tcp_xmit_retransmit_queue(sk); |
787 | } | ||
786 | 788 | ||
787 | tcp_write_xmit(sk, tcp_current_mss(sk), tp->nonagle, | 789 | tcp_write_xmit(sk, tcp_current_mss(sk), tp->nonagle, |
788 | 0, GFP_ATOMIC); | 790 | 0, GFP_ATOMIC); |
@@ -2307,6 +2309,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, | |||
2307 | 2309 | ||
2308 | sent_pkts = 0; | 2310 | sent_pkts = 0; |
2309 | 2311 | ||
2312 | tcp_mstamp_refresh(tp); | ||
2310 | if (!push_one) { | 2313 | if (!push_one) { |
2311 | /* Do MTU probing. */ | 2314 | /* Do MTU probing. */ |
2312 | result = tcp_mtu_probe(sk); | 2315 | result = tcp_mtu_probe(sk); |
@@ -2318,7 +2321,6 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, | |||
2318 | } | 2321 | } |
2319 | 2322 | ||
2320 | max_segs = tcp_tso_segs(sk, mss_now); | 2323 | max_segs = tcp_tso_segs(sk, mss_now); |
2321 | tcp_mstamp_refresh(tp); | ||
2322 | while ((skb = tcp_send_head(sk))) { | 2324 | while ((skb = tcp_send_head(sk))) { |
2323 | unsigned int limit; | 2325 | unsigned int limit; |
2324 | 2326 | ||
@@ -2911,8 +2913,10 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) | |||
2911 | -ENOBUFS; | 2913 | -ENOBUFS; |
2912 | } tcp_skb_tsorted_restore(skb); | 2914 | } tcp_skb_tsorted_restore(skb); |
2913 | 2915 | ||
2914 | if (!err) | 2916 | if (!err) { |
2915 | tcp_update_skb_after_send(tp, skb); | 2917 | tcp_update_skb_after_send(tp, skb); |
2918 | tcp_rate_skb_sent(sk, skb); | ||
2919 | } | ||
2916 | } else { | 2920 | } else { |
2917 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); | 2921 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); |
2918 | } | 2922 | } |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 241841fb479c..3e10c51e7e0c 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -408,13 +408,16 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
408 | case ICMPV6_DEST_UNREACH: | 408 | case ICMPV6_DEST_UNREACH: |
409 | net_dbg_ratelimited("%s: Path to destination invalid or inactive!\n", | 409 | net_dbg_ratelimited("%s: Path to destination invalid or inactive!\n", |
410 | t->parms.name); | 410 | t->parms.name); |
411 | break; | 411 | if (code != ICMPV6_PORT_UNREACH) |
412 | break; | ||
413 | return; | ||
412 | case ICMPV6_TIME_EXCEED: | 414 | case ICMPV6_TIME_EXCEED: |
413 | if (code == ICMPV6_EXC_HOPLIMIT) { | 415 | if (code == ICMPV6_EXC_HOPLIMIT) { |
414 | net_dbg_ratelimited("%s: Too small hop limit or routing loop in tunnel!\n", | 416 | net_dbg_ratelimited("%s: Too small hop limit or routing loop in tunnel!\n", |
415 | t->parms.name); | 417 | t->parms.name); |
418 | break; | ||
416 | } | 419 | } |
417 | break; | 420 | return; |
418 | case ICMPV6_PARAMPROB: | 421 | case ICMPV6_PARAMPROB: |
419 | teli = 0; | 422 | teli = 0; |
420 | if (code == ICMPV6_HDR_FIELD) | 423 | if (code == ICMPV6_HDR_FIELD) |
@@ -430,7 +433,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
430 | net_dbg_ratelimited("%s: Recipient unable to parse tunneled packet!\n", | 433 | net_dbg_ratelimited("%s: Recipient unable to parse tunneled packet!\n", |
431 | t->parms.name); | 434 | t->parms.name); |
432 | } | 435 | } |
433 | break; | 436 | return; |
434 | case ICMPV6_PKT_TOOBIG: | 437 | case ICMPV6_PKT_TOOBIG: |
435 | mtu = be32_to_cpu(info) - offset - t->tun_hlen; | 438 | mtu = be32_to_cpu(info) - offset - t->tun_hlen; |
436 | if (t->dev->type == ARPHRD_ETHER) | 439 | if (t->dev->type == ARPHRD_ETHER) |
@@ -438,7 +441,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
438 | if (mtu < IPV6_MIN_MTU) | 441 | if (mtu < IPV6_MIN_MTU) |
439 | mtu = IPV6_MIN_MTU; | 442 | mtu = IPV6_MIN_MTU; |
440 | t->dev->mtu = mtu; | 443 | t->dev->mtu = mtu; |
441 | break; | 444 | return; |
442 | } | 445 | } |
443 | 446 | ||
444 | if (time_before(jiffies, t->err_time + IP6TUNNEL_ERR_TIMEO)) | 447 | if (time_before(jiffies, t->err_time + IP6TUNNEL_ERR_TIMEO)) |
@@ -500,8 +503,8 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, | |||
500 | __u32 *pmtu, __be16 proto) | 503 | __u32 *pmtu, __be16 proto) |
501 | { | 504 | { |
502 | struct ip6_tnl *tunnel = netdev_priv(dev); | 505 | struct ip6_tnl *tunnel = netdev_priv(dev); |
503 | __be16 protocol = (dev->type == ARPHRD_ETHER) ? | 506 | struct dst_entry *dst = skb_dst(skb); |
504 | htons(ETH_P_TEB) : proto; | 507 | __be16 protocol; |
505 | 508 | ||
506 | if (dev->type == ARPHRD_ETHER) | 509 | if (dev->type == ARPHRD_ETHER) |
507 | IPCB(skb)->flags = 0; | 510 | IPCB(skb)->flags = 0; |
@@ -515,9 +518,14 @@ static netdev_tx_t __gre6_xmit(struct sk_buff *skb, | |||
515 | tunnel->o_seqno++; | 518 | tunnel->o_seqno++; |
516 | 519 | ||
517 | /* Push GRE header. */ | 520 | /* Push GRE header. */ |
521 | protocol = (dev->type == ARPHRD_ETHER) ? htons(ETH_P_TEB) : proto; | ||
518 | gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, | 522 | gre_build_header(skb, tunnel->tun_hlen, tunnel->parms.o_flags, |
519 | protocol, tunnel->parms.o_key, htonl(tunnel->o_seqno)); | 523 | protocol, tunnel->parms.o_key, htonl(tunnel->o_seqno)); |
520 | 524 | ||
525 | /* TooBig packet may have updated dst->dev's mtu */ | ||
526 | if (dst && dst_mtu(dst) > dst->dev->mtu) | ||
527 | dst->ops->update_pmtu(dst, NULL, skb, dst->dev->mtu); | ||
528 | |||
521 | return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, | 529 | return ip6_tnl_xmit(skb, dev, dsfield, fl6, encap_limit, pmtu, |
522 | NEXTHDR_GRE); | 530 | NEXTHDR_GRE); |
523 | } | 531 | } |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a354f1939e49..fb15d3b97cb2 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -2727,12 +2727,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
2727 | if (!ieee80211_sdata_running(sdata)) | 2727 | if (!ieee80211_sdata_running(sdata)) |
2728 | return -ENETDOWN; | 2728 | return -ENETDOWN; |
2729 | 2729 | ||
2730 | if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { | ||
2731 | ret = drv_set_bitrate_mask(local, sdata, mask); | ||
2732 | if (ret) | ||
2733 | return ret; | ||
2734 | } | ||
2735 | |||
2736 | /* | 2730 | /* |
2737 | * If active validate the setting and reject it if it doesn't leave | 2731 | * If active validate the setting and reject it if it doesn't leave |
2738 | * at least one basic rate usable, since we really have to be able | 2732 | * at least one basic rate usable, since we really have to be able |
@@ -2748,6 +2742,12 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
2748 | return -EINVAL; | 2742 | return -EINVAL; |
2749 | } | 2743 | } |
2750 | 2744 | ||
2745 | if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) { | ||
2746 | ret = drv_set_bitrate_mask(local, sdata, mask); | ||
2747 | if (ret) | ||
2748 | return ret; | ||
2749 | } | ||
2750 | |||
2751 | for (i = 0; i < NUM_NL80211_BANDS; i++) { | 2751 | for (i = 0; i < NUM_NL80211_BANDS; i++) { |
2752 | struct ieee80211_supported_band *sband = wiphy->bands[i]; | 2752 | struct ieee80211_supported_band *sband = wiphy->bands[i]; |
2753 | int j; | 2753 | int j; |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index ae995c8480db..938049395f90 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/export.h> | 20 | #include <linux/export.h> |
21 | #include <net/mac80211.h> | 21 | #include <net/mac80211.h> |
22 | #include <crypto/algapi.h> | ||
22 | #include <asm/unaligned.h> | 23 | #include <asm/unaligned.h> |
23 | #include "ieee80211_i.h" | 24 | #include "ieee80211_i.h" |
24 | #include "driver-ops.h" | 25 | #include "driver-ops.h" |
@@ -609,6 +610,39 @@ void ieee80211_key_free_unused(struct ieee80211_key *key) | |||
609 | ieee80211_key_free_common(key); | 610 | ieee80211_key_free_common(key); |
610 | } | 611 | } |
611 | 612 | ||
613 | static bool ieee80211_key_identical(struct ieee80211_sub_if_data *sdata, | ||
614 | struct ieee80211_key *old, | ||
615 | struct ieee80211_key *new) | ||
616 | { | ||
617 | u8 tkip_old[WLAN_KEY_LEN_TKIP], tkip_new[WLAN_KEY_LEN_TKIP]; | ||
618 | u8 *tk_old, *tk_new; | ||
619 | |||
620 | if (!old || new->conf.keylen != old->conf.keylen) | ||
621 | return false; | ||
622 | |||
623 | tk_old = old->conf.key; | ||
624 | tk_new = new->conf.key; | ||
625 | |||
626 | /* | ||
627 | * In station mode, don't compare the TX MIC key, as it's never used | ||
628 | * and offloaded rekeying may not care to send it to the host. This | ||
629 | * is the case in iwlwifi, for example. | ||
630 | */ | ||
631 | if (sdata->vif.type == NL80211_IFTYPE_STATION && | ||
632 | new->conf.cipher == WLAN_CIPHER_SUITE_TKIP && | ||
633 | new->conf.keylen == WLAN_KEY_LEN_TKIP && | ||
634 | !(new->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) { | ||
635 | memcpy(tkip_old, tk_old, WLAN_KEY_LEN_TKIP); | ||
636 | memcpy(tkip_new, tk_new, WLAN_KEY_LEN_TKIP); | ||
637 | memset(tkip_old + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, 0, 8); | ||
638 | memset(tkip_new + NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, 0, 8); | ||
639 | tk_old = tkip_old; | ||
640 | tk_new = tkip_new; | ||
641 | } | ||
642 | |||
643 | return !crypto_memneq(tk_old, tk_new, new->conf.keylen); | ||
644 | } | ||
645 | |||
612 | int ieee80211_key_link(struct ieee80211_key *key, | 646 | int ieee80211_key_link(struct ieee80211_key *key, |
613 | struct ieee80211_sub_if_data *sdata, | 647 | struct ieee80211_sub_if_data *sdata, |
614 | struct sta_info *sta) | 648 | struct sta_info *sta) |
@@ -634,8 +668,7 @@ int ieee80211_key_link(struct ieee80211_key *key, | |||
634 | * Silently accept key re-installation without really installing the | 668 | * Silently accept key re-installation without really installing the |
635 | * new version of the key to avoid nonce reuse or replay issues. | 669 | * new version of the key to avoid nonce reuse or replay issues. |
636 | */ | 670 | */ |
637 | if (old_key && key->conf.keylen == old_key->conf.keylen && | 671 | if (ieee80211_key_identical(sdata, old_key, key)) { |
638 | !memcmp(key->conf.key, old_key->conf.key, key->conf.keylen)) { | ||
639 | ieee80211_key_free_unused(key); | 672 | ieee80211_key_free_unused(key); |
640 | ret = 0; | 673 | ret = 0; |
641 | goto out; | 674 | goto out; |
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c index 6ab39dbcca01..8557a1cae041 100644 --- a/net/rds/ib_send.c +++ b/net/rds/ib_send.c | |||
@@ -661,13 +661,15 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
661 | } | 661 | } |
662 | } | 662 | } |
663 | 663 | ||
664 | rds_ib_set_wr_signal_state(ic, send, 0); | 664 | rds_ib_set_wr_signal_state(ic, send, false); |
665 | 665 | ||
666 | /* | 666 | /* |
667 | * Always signal the last one if we're stopping due to flow control. | 667 | * Always signal the last one if we're stopping due to flow control. |
668 | */ | 668 | */ |
669 | if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) | 669 | if (ic->i_flowctl && flow_controlled && i == (work_alloc - 1)) { |
670 | send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED; | 670 | rds_ib_set_wr_signal_state(ic, send, true); |
671 | send->s_wr.send_flags |= IB_SEND_SOLICITED; | ||
672 | } | ||
671 | 673 | ||
672 | if (send->s_wr.send_flags & IB_SEND_SIGNALED) | 674 | if (send->s_wr.send_flags & IB_SEND_SIGNALED) |
673 | nr_sig++; | 675 | nr_sig++; |
@@ -705,11 +707,8 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
705 | if (scat == &rm->data.op_sg[rm->data.op_count]) { | 707 | if (scat == &rm->data.op_sg[rm->data.op_count]) { |
706 | prev->s_op = ic->i_data_op; | 708 | prev->s_op = ic->i_data_op; |
707 | prev->s_wr.send_flags |= IB_SEND_SOLICITED; | 709 | prev->s_wr.send_flags |= IB_SEND_SOLICITED; |
708 | if (!(prev->s_wr.send_flags & IB_SEND_SIGNALED)) { | 710 | if (!(prev->s_wr.send_flags & IB_SEND_SIGNALED)) |
709 | ic->i_unsignaled_wrs = rds_ib_sysctl_max_unsig_wrs; | 711 | nr_sig += rds_ib_set_wr_signal_state(ic, prev, true); |
710 | prev->s_wr.send_flags |= IB_SEND_SIGNALED; | ||
711 | nr_sig++; | ||
712 | } | ||
713 | ic->i_data_op = NULL; | 712 | ic->i_data_op = NULL; |
714 | } | 713 | } |
715 | 714 | ||
@@ -792,6 +791,7 @@ int rds_ib_xmit_atomic(struct rds_connection *conn, struct rm_atomic_op *op) | |||
792 | send->s_atomic_wr.compare_add_mask = op->op_m_fadd.nocarry_mask; | 791 | send->s_atomic_wr.compare_add_mask = op->op_m_fadd.nocarry_mask; |
793 | send->s_atomic_wr.swap_mask = 0; | 792 | send->s_atomic_wr.swap_mask = 0; |
794 | } | 793 | } |
794 | send->s_wr.send_flags = 0; | ||
795 | nr_sig = rds_ib_set_wr_signal_state(ic, send, op->op_notify); | 795 | nr_sig = rds_ib_set_wr_signal_state(ic, send, op->op_notify); |
796 | send->s_atomic_wr.wr.num_sge = 1; | 796 | send->s_atomic_wr.wr.num_sge = 1; |
797 | send->s_atomic_wr.wr.next = NULL; | 797 | send->s_atomic_wr.wr.next = NULL; |
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index ec986ae52808..a9f9a2ccc664 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c | |||
@@ -264,6 +264,7 @@ static int __init sample_init_module(void) | |||
264 | 264 | ||
265 | static void __exit sample_cleanup_module(void) | 265 | static void __exit sample_cleanup_module(void) |
266 | { | 266 | { |
267 | rcu_barrier(); | ||
267 | tcf_unregister_action(&act_sample_ops, &sample_net_ops); | 268 | tcf_unregister_action(&act_sample_ops, &sample_net_ops); |
268 | } | 269 | } |
269 | 270 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 0e96cdae9995..d9d54b367d23 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -77,6 +77,8 @@ out: | |||
77 | } | 77 | } |
78 | EXPORT_SYMBOL(register_tcf_proto_ops); | 78 | EXPORT_SYMBOL(register_tcf_proto_ops); |
79 | 79 | ||
80 | static struct workqueue_struct *tc_filter_wq; | ||
81 | |||
80 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | 82 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) |
81 | { | 83 | { |
82 | struct tcf_proto_ops *t; | 84 | struct tcf_proto_ops *t; |
@@ -86,6 +88,7 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
86 | * tcf_proto_ops's destroy() handler. | 88 | * tcf_proto_ops's destroy() handler. |
87 | */ | 89 | */ |
88 | rcu_barrier(); | 90 | rcu_barrier(); |
91 | flush_workqueue(tc_filter_wq); | ||
89 | 92 | ||
90 | write_lock(&cls_mod_lock); | 93 | write_lock(&cls_mod_lock); |
91 | list_for_each_entry(t, &tcf_proto_base, head) { | 94 | list_for_each_entry(t, &tcf_proto_base, head) { |
@@ -100,6 +103,12 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
100 | } | 103 | } |
101 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | 104 | EXPORT_SYMBOL(unregister_tcf_proto_ops); |
102 | 105 | ||
106 | bool tcf_queue_work(struct work_struct *work) | ||
107 | { | ||
108 | return queue_work(tc_filter_wq, work); | ||
109 | } | ||
110 | EXPORT_SYMBOL(tcf_queue_work); | ||
111 | |||
103 | /* Select new prio value from the range, managed by kernel. */ | 112 | /* Select new prio value from the range, managed by kernel. */ |
104 | 113 | ||
105 | static inline u32 tcf_auto_prio(struct tcf_proto *tp) | 114 | static inline u32 tcf_auto_prio(struct tcf_proto *tp) |
@@ -308,27 +317,30 @@ int tcf_block_get(struct tcf_block **p_block, | |||
308 | } | 317 | } |
309 | EXPORT_SYMBOL(tcf_block_get); | 318 | EXPORT_SYMBOL(tcf_block_get); |
310 | 319 | ||
311 | void tcf_block_put_ext(struct tcf_block *block, | 320 | static void tcf_block_put_final(struct work_struct *work) |
312 | struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q, | ||
313 | struct tcf_block_ext_info *ei) | ||
314 | { | 321 | { |
322 | struct tcf_block *block = container_of(work, struct tcf_block, work); | ||
315 | struct tcf_chain *chain, *tmp; | 323 | struct tcf_chain *chain, *tmp; |
316 | 324 | ||
317 | if (!block) | 325 | /* At this point, all the chains should have refcnt == 1. */ |
318 | return; | 326 | rtnl_lock(); |
319 | 327 | list_for_each_entry_safe(chain, tmp, &block->chain_list, list) | |
320 | tcf_block_offload_unbind(block, q, ei); | 328 | tcf_chain_put(chain); |
321 | 329 | rtnl_unlock(); | |
322 | /* XXX: Standalone actions are not allowed to jump to any chain, and | 330 | kfree(block); |
323 | * bound actions should be all removed after flushing. However, | 331 | } |
324 | * filters are destroyed in RCU callbacks, we have to hold the chains | ||
325 | * first, otherwise we would always race with RCU callbacks on this list | ||
326 | * without proper locking. | ||
327 | */ | ||
328 | 332 | ||
329 | /* Wait for existing RCU callbacks to cool down. */ | 333 | /* XXX: Standalone actions are not allowed to jump to any chain, and bound |
330 | rcu_barrier(); | 334 | * actions should be all removed after flushing. However, filters are destroyed |
335 | * in RCU callbacks, we have to hold the chains first, otherwise we would | ||
336 | * always race with RCU callbacks on this list without proper locking. | ||
337 | */ | ||
338 | static void tcf_block_put_deferred(struct work_struct *work) | ||
339 | { | ||
340 | struct tcf_block *block = container_of(work, struct tcf_block, work); | ||
341 | struct tcf_chain *chain; | ||
331 | 342 | ||
343 | rtnl_lock(); | ||
332 | /* Hold a refcnt for all chains, except 0, in case they are gone. */ | 344 | /* Hold a refcnt for all chains, except 0, in case they are gone. */ |
333 | list_for_each_entry(chain, &block->chain_list, list) | 345 | list_for_each_entry(chain, &block->chain_list, list) |
334 | if (chain->index) | 346 | if (chain->index) |
@@ -338,13 +350,31 @@ void tcf_block_put_ext(struct tcf_block *block, | |||
338 | list_for_each_entry(chain, &block->chain_list, list) | 350 | list_for_each_entry(chain, &block->chain_list, list) |
339 | tcf_chain_flush(chain); | 351 | tcf_chain_flush(chain); |
340 | 352 | ||
341 | /* Wait for RCU callbacks to release the reference count. */ | 353 | INIT_WORK(&block->work, tcf_block_put_final); |
354 | /* Wait for RCU callbacks to release the reference count and make | ||
355 | * sure their works have been queued before this. | ||
356 | */ | ||
342 | rcu_barrier(); | 357 | rcu_barrier(); |
358 | tcf_queue_work(&block->work); | ||
359 | rtnl_unlock(); | ||
360 | } | ||
343 | 361 | ||
344 | /* At this point, all the chains should have refcnt == 1. */ | 362 | void tcf_block_put_ext(struct tcf_block *block, |
345 | list_for_each_entry_safe(chain, tmp, &block->chain_list, list) | 363 | struct tcf_proto __rcu **p_filter_chain, struct Qdisc *q, |
346 | tcf_chain_put(chain); | 364 | struct tcf_block_ext_info *ei) |
347 | kfree(block); | 365 | { |
366 | if (!block) | ||
367 | return; | ||
368 | |||
369 | tcf_block_offload_unbind(block, q, ei); | ||
370 | |||
371 | INIT_WORK(&block->work, tcf_block_put_deferred); | ||
372 | /* Wait for existing RCU callbacks to cool down, make sure their works | ||
373 | * have been queued before this. We can not flush pending works here | ||
374 | * because we are holding the RTNL lock. | ||
375 | */ | ||
376 | rcu_barrier(); | ||
377 | tcf_queue_work(&block->work); | ||
348 | } | 378 | } |
349 | EXPORT_SYMBOL(tcf_block_put_ext); | 379 | EXPORT_SYMBOL(tcf_block_put_ext); |
350 | 380 | ||
@@ -354,6 +384,7 @@ void tcf_block_put(struct tcf_block *block) | |||
354 | 384 | ||
355 | tcf_block_put_ext(block, NULL, block->q, &ei); | 385 | tcf_block_put_ext(block, NULL, block->q, &ei); |
356 | } | 386 | } |
387 | |||
357 | EXPORT_SYMBOL(tcf_block_put); | 388 | EXPORT_SYMBOL(tcf_block_put); |
358 | 389 | ||
359 | struct tcf_block_cb { | 390 | struct tcf_block_cb { |
@@ -1051,6 +1082,7 @@ void tcf_exts_destroy(struct tcf_exts *exts) | |||
1051 | #ifdef CONFIG_NET_CLS_ACT | 1082 | #ifdef CONFIG_NET_CLS_ACT |
1052 | LIST_HEAD(actions); | 1083 | LIST_HEAD(actions); |
1053 | 1084 | ||
1085 | ASSERT_RTNL(); | ||
1054 | tcf_exts_to_list(exts, &actions); | 1086 | tcf_exts_to_list(exts, &actions); |
1055 | tcf_action_destroy(&actions, TCA_ACT_UNBIND); | 1087 | tcf_action_destroy(&actions, TCA_ACT_UNBIND); |
1056 | kfree(exts->actions); | 1088 | kfree(exts->actions); |
@@ -1229,6 +1261,10 @@ EXPORT_SYMBOL(tc_setup_cb_call); | |||
1229 | 1261 | ||
1230 | static int __init tc_filter_init(void) | 1262 | static int __init tc_filter_init(void) |
1231 | { | 1263 | { |
1264 | tc_filter_wq = alloc_ordered_workqueue("tc_filter_workqueue", 0); | ||
1265 | if (!tc_filter_wq) | ||
1266 | return -ENOMEM; | ||
1267 | |||
1232 | rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_ctl_tfilter, NULL, 0); | 1268 | rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_ctl_tfilter, NULL, 0); |
1233 | rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_ctl_tfilter, NULL, 0); | 1269 | rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_ctl_tfilter, NULL, 0); |
1234 | rtnl_register(PF_UNSPEC, RTM_GETTFILTER, tc_ctl_tfilter, | 1270 | rtnl_register(PF_UNSPEC, RTM_GETTFILTER, tc_ctl_tfilter, |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 700b345b07f9..871351358c10 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -35,7 +35,10 @@ struct basic_filter { | |||
35 | struct tcf_result res; | 35 | struct tcf_result res; |
36 | struct tcf_proto *tp; | 36 | struct tcf_proto *tp; |
37 | struct list_head link; | 37 | struct list_head link; |
38 | struct rcu_head rcu; | 38 | union { |
39 | struct work_struct work; | ||
40 | struct rcu_head rcu; | ||
41 | }; | ||
39 | }; | 42 | }; |
40 | 43 | ||
41 | static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 44 | static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
@@ -84,15 +87,26 @@ static int basic_init(struct tcf_proto *tp) | |||
84 | return 0; | 87 | return 0; |
85 | } | 88 | } |
86 | 89 | ||
87 | static void basic_delete_filter(struct rcu_head *head) | 90 | static void basic_delete_filter_work(struct work_struct *work) |
88 | { | 91 | { |
89 | struct basic_filter *f = container_of(head, struct basic_filter, rcu); | 92 | struct basic_filter *f = container_of(work, struct basic_filter, work); |
90 | 93 | ||
94 | rtnl_lock(); | ||
91 | tcf_exts_destroy(&f->exts); | 95 | tcf_exts_destroy(&f->exts); |
92 | tcf_em_tree_destroy(&f->ematches); | 96 | tcf_em_tree_destroy(&f->ematches); |
97 | rtnl_unlock(); | ||
98 | |||
93 | kfree(f); | 99 | kfree(f); |
94 | } | 100 | } |
95 | 101 | ||
102 | static void basic_delete_filter(struct rcu_head *head) | ||
103 | { | ||
104 | struct basic_filter *f = container_of(head, struct basic_filter, rcu); | ||
105 | |||
106 | INIT_WORK(&f->work, basic_delete_filter_work); | ||
107 | tcf_queue_work(&f->work); | ||
108 | } | ||
109 | |||
96 | static void basic_destroy(struct tcf_proto *tp) | 110 | static void basic_destroy(struct tcf_proto *tp) |
97 | { | 111 | { |
98 | struct basic_head *head = rtnl_dereference(tp->root); | 112 | struct basic_head *head = rtnl_dereference(tp->root); |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 0f8b51061c39..5f701c8670a2 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
@@ -50,7 +50,10 @@ struct cls_bpf_prog { | |||
50 | struct sock_filter *bpf_ops; | 50 | struct sock_filter *bpf_ops; |
51 | const char *bpf_name; | 51 | const char *bpf_name; |
52 | struct tcf_proto *tp; | 52 | struct tcf_proto *tp; |
53 | struct rcu_head rcu; | 53 | union { |
54 | struct work_struct work; | ||
55 | struct rcu_head rcu; | ||
56 | }; | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { | 59 | static const struct nla_policy bpf_policy[TCA_BPF_MAX + 1] = { |
@@ -269,9 +272,21 @@ static void __cls_bpf_delete_prog(struct cls_bpf_prog *prog) | |||
269 | kfree(prog); | 272 | kfree(prog); |
270 | } | 273 | } |
271 | 274 | ||
275 | static void cls_bpf_delete_prog_work(struct work_struct *work) | ||
276 | { | ||
277 | struct cls_bpf_prog *prog = container_of(work, struct cls_bpf_prog, work); | ||
278 | |||
279 | rtnl_lock(); | ||
280 | __cls_bpf_delete_prog(prog); | ||
281 | rtnl_unlock(); | ||
282 | } | ||
283 | |||
272 | static void cls_bpf_delete_prog_rcu(struct rcu_head *rcu) | 284 | static void cls_bpf_delete_prog_rcu(struct rcu_head *rcu) |
273 | { | 285 | { |
274 | __cls_bpf_delete_prog(container_of(rcu, struct cls_bpf_prog, rcu)); | 286 | struct cls_bpf_prog *prog = container_of(rcu, struct cls_bpf_prog, rcu); |
287 | |||
288 | INIT_WORK(&prog->work, cls_bpf_delete_prog_work); | ||
289 | tcf_queue_work(&prog->work); | ||
275 | } | 290 | } |
276 | 291 | ||
277 | static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) | 292 | static void __cls_bpf_delete(struct tcf_proto *tp, struct cls_bpf_prog *prog) |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index d48452f87975..a97e069bee89 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -23,7 +23,10 @@ struct cls_cgroup_head { | |||
23 | struct tcf_exts exts; | 23 | struct tcf_exts exts; |
24 | struct tcf_ematch_tree ematches; | 24 | struct tcf_ematch_tree ematches; |
25 | struct tcf_proto *tp; | 25 | struct tcf_proto *tp; |
26 | struct rcu_head rcu; | 26 | union { |
27 | struct work_struct work; | ||
28 | struct rcu_head rcu; | ||
29 | }; | ||
27 | }; | 30 | }; |
28 | 31 | ||
29 | static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 32 | static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
@@ -57,15 +60,26 @@ static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = { | |||
57 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, | 60 | [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED }, |
58 | }; | 61 | }; |
59 | 62 | ||
63 | static void cls_cgroup_destroy_work(struct work_struct *work) | ||
64 | { | ||
65 | struct cls_cgroup_head *head = container_of(work, | ||
66 | struct cls_cgroup_head, | ||
67 | work); | ||
68 | rtnl_lock(); | ||
69 | tcf_exts_destroy(&head->exts); | ||
70 | tcf_em_tree_destroy(&head->ematches); | ||
71 | kfree(head); | ||
72 | rtnl_unlock(); | ||
73 | } | ||
74 | |||
60 | static void cls_cgroup_destroy_rcu(struct rcu_head *root) | 75 | static void cls_cgroup_destroy_rcu(struct rcu_head *root) |
61 | { | 76 | { |
62 | struct cls_cgroup_head *head = container_of(root, | 77 | struct cls_cgroup_head *head = container_of(root, |
63 | struct cls_cgroup_head, | 78 | struct cls_cgroup_head, |
64 | rcu); | 79 | rcu); |
65 | 80 | ||
66 | tcf_exts_destroy(&head->exts); | 81 | INIT_WORK(&head->work, cls_cgroup_destroy_work); |
67 | tcf_em_tree_destroy(&head->ematches); | 82 | tcf_queue_work(&head->work); |
68 | kfree(head); | ||
69 | } | 83 | } |
70 | 84 | ||
71 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, | 85 | static int cls_cgroup_change(struct net *net, struct sk_buff *in_skb, |
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 6b29cef90bec..9c08fcdaf41c 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c | |||
@@ -57,7 +57,10 @@ struct flow_filter { | |||
57 | u32 divisor; | 57 | u32 divisor; |
58 | u32 baseclass; | 58 | u32 baseclass; |
59 | u32 hashrnd; | 59 | u32 hashrnd; |
60 | struct rcu_head rcu; | 60 | union { |
61 | struct work_struct work; | ||
62 | struct rcu_head rcu; | ||
63 | }; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | static inline u32 addr_fold(void *addr) | 66 | static inline u32 addr_fold(void *addr) |
@@ -369,14 +372,24 @@ static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = { | |||
369 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, | 372 | [TCA_FLOW_PERTURB] = { .type = NLA_U32 }, |
370 | }; | 373 | }; |
371 | 374 | ||
372 | static void flow_destroy_filter(struct rcu_head *head) | 375 | static void flow_destroy_filter_work(struct work_struct *work) |
373 | { | 376 | { |
374 | struct flow_filter *f = container_of(head, struct flow_filter, rcu); | 377 | struct flow_filter *f = container_of(work, struct flow_filter, work); |
375 | 378 | ||
379 | rtnl_lock(); | ||
376 | del_timer_sync(&f->perturb_timer); | 380 | del_timer_sync(&f->perturb_timer); |
377 | tcf_exts_destroy(&f->exts); | 381 | tcf_exts_destroy(&f->exts); |
378 | tcf_em_tree_destroy(&f->ematches); | 382 | tcf_em_tree_destroy(&f->ematches); |
379 | kfree(f); | 383 | kfree(f); |
384 | rtnl_unlock(); | ||
385 | } | ||
386 | |||
387 | static void flow_destroy_filter(struct rcu_head *head) | ||
388 | { | ||
389 | struct flow_filter *f = container_of(head, struct flow_filter, rcu); | ||
390 | |||
391 | INIT_WORK(&f->work, flow_destroy_filter_work); | ||
392 | tcf_queue_work(&f->work); | ||
380 | } | 393 | } |
381 | 394 | ||
382 | static int flow_change(struct net *net, struct sk_buff *in_skb, | 395 | static int flow_change(struct net *net, struct sk_buff *in_skb, |
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 16f58abaa697..35cb6d684e44 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c | |||
@@ -87,7 +87,11 @@ struct cls_fl_filter { | |||
87 | struct list_head list; | 87 | struct list_head list; |
88 | u32 handle; | 88 | u32 handle; |
89 | u32 flags; | 89 | u32 flags; |
90 | struct rcu_head rcu; | 90 | union { |
91 | struct work_struct work; | ||
92 | struct rcu_head rcu; | ||
93 | }; | ||
94 | struct net_device *hw_dev; | ||
91 | }; | 95 | }; |
92 | 96 | ||
93 | static unsigned short int fl_mask_range(const struct fl_flow_mask *mask) | 97 | static unsigned short int fl_mask_range(const struct fl_flow_mask *mask) |
@@ -189,12 +193,22 @@ static int fl_init(struct tcf_proto *tp) | |||
189 | return 0; | 193 | return 0; |
190 | } | 194 | } |
191 | 195 | ||
192 | static void fl_destroy_filter(struct rcu_head *head) | 196 | static void fl_destroy_filter_work(struct work_struct *work) |
193 | { | 197 | { |
194 | struct cls_fl_filter *f = container_of(head, struct cls_fl_filter, rcu); | 198 | struct cls_fl_filter *f = container_of(work, struct cls_fl_filter, work); |
195 | 199 | ||
200 | rtnl_lock(); | ||
196 | tcf_exts_destroy(&f->exts); | 201 | tcf_exts_destroy(&f->exts); |
197 | kfree(f); | 202 | kfree(f); |
203 | rtnl_unlock(); | ||
204 | } | ||
205 | |||
206 | static void fl_destroy_filter(struct rcu_head *head) | ||
207 | { | ||
208 | struct cls_fl_filter *f = container_of(head, struct cls_fl_filter, rcu); | ||
209 | |||
210 | INIT_WORK(&f->work, fl_destroy_filter_work); | ||
211 | tcf_queue_work(&f->work); | ||
198 | } | 212 | } |
199 | 213 | ||
200 | static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f) | 214 | static void fl_hw_destroy_filter(struct tcf_proto *tp, struct cls_fl_filter *f) |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index aa1e1f3bd20c..5908f56f76da 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -47,7 +47,10 @@ struct fw_filter { | |||
47 | #endif /* CONFIG_NET_CLS_IND */ | 47 | #endif /* CONFIG_NET_CLS_IND */ |
48 | struct tcf_exts exts; | 48 | struct tcf_exts exts; |
49 | struct tcf_proto *tp; | 49 | struct tcf_proto *tp; |
50 | struct rcu_head rcu; | 50 | union { |
51 | struct work_struct work; | ||
52 | struct rcu_head rcu; | ||
53 | }; | ||
51 | }; | 54 | }; |
52 | 55 | ||
53 | static u32 fw_hash(u32 handle) | 56 | static u32 fw_hash(u32 handle) |
@@ -122,12 +125,22 @@ static int fw_init(struct tcf_proto *tp) | |||
122 | return 0; | 125 | return 0; |
123 | } | 126 | } |
124 | 127 | ||
125 | static void fw_delete_filter(struct rcu_head *head) | 128 | static void fw_delete_filter_work(struct work_struct *work) |
126 | { | 129 | { |
127 | struct fw_filter *f = container_of(head, struct fw_filter, rcu); | 130 | struct fw_filter *f = container_of(work, struct fw_filter, work); |
128 | 131 | ||
132 | rtnl_lock(); | ||
129 | tcf_exts_destroy(&f->exts); | 133 | tcf_exts_destroy(&f->exts); |
130 | kfree(f); | 134 | kfree(f); |
135 | rtnl_unlock(); | ||
136 | } | ||
137 | |||
138 | static void fw_delete_filter(struct rcu_head *head) | ||
139 | { | ||
140 | struct fw_filter *f = container_of(head, struct fw_filter, rcu); | ||
141 | |||
142 | INIT_WORK(&f->work, fw_delete_filter_work); | ||
143 | tcf_queue_work(&f->work); | ||
131 | } | 144 | } |
132 | 145 | ||
133 | static void fw_destroy(struct tcf_proto *tp) | 146 | static void fw_destroy(struct tcf_proto *tp) |
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c index 70e78d74f6d3..95dc997873e8 100644 --- a/net/sched/cls_matchall.c +++ b/net/sched/cls_matchall.c | |||
@@ -21,7 +21,10 @@ struct cls_mall_head { | |||
21 | struct tcf_result res; | 21 | struct tcf_result res; |
22 | u32 handle; | 22 | u32 handle; |
23 | u32 flags; | 23 | u32 flags; |
24 | struct rcu_head rcu; | 24 | union { |
25 | struct work_struct work; | ||
26 | struct rcu_head rcu; | ||
27 | }; | ||
25 | }; | 28 | }; |
26 | 29 | ||
27 | static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, | 30 | static int mall_classify(struct sk_buff *skb, const struct tcf_proto *tp, |
@@ -41,13 +44,23 @@ static int mall_init(struct tcf_proto *tp) | |||
41 | return 0; | 44 | return 0; |
42 | } | 45 | } |
43 | 46 | ||
47 | static void mall_destroy_work(struct work_struct *work) | ||
48 | { | ||
49 | struct cls_mall_head *head = container_of(work, struct cls_mall_head, | ||
50 | work); | ||
51 | rtnl_lock(); | ||
52 | tcf_exts_destroy(&head->exts); | ||
53 | kfree(head); | ||
54 | rtnl_unlock(); | ||
55 | } | ||
56 | |||
44 | static void mall_destroy_rcu(struct rcu_head *rcu) | 57 | static void mall_destroy_rcu(struct rcu_head *rcu) |
45 | { | 58 | { |
46 | struct cls_mall_head *head = container_of(rcu, struct cls_mall_head, | 59 | struct cls_mall_head *head = container_of(rcu, struct cls_mall_head, |
47 | rcu); | 60 | rcu); |
48 | 61 | ||
49 | tcf_exts_destroy(&head->exts); | 62 | INIT_WORK(&head->work, mall_destroy_work); |
50 | kfree(head); | 63 | tcf_queue_work(&head->work); |
51 | } | 64 | } |
52 | 65 | ||
53 | static void mall_destroy_hw_filter(struct tcf_proto *tp, | 66 | static void mall_destroy_hw_filter(struct tcf_proto *tp, |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 9ddde65915d2..4b14ccd8b8f2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -57,7 +57,10 @@ struct route4_filter { | |||
57 | u32 handle; | 57 | u32 handle; |
58 | struct route4_bucket *bkt; | 58 | struct route4_bucket *bkt; |
59 | struct tcf_proto *tp; | 59 | struct tcf_proto *tp; |
60 | struct rcu_head rcu; | 60 | union { |
61 | struct work_struct work; | ||
62 | struct rcu_head rcu; | ||
63 | }; | ||
61 | }; | 64 | }; |
62 | 65 | ||
63 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) | 66 | #define ROUTE4_FAILURE ((struct route4_filter *)(-1L)) |
@@ -254,12 +257,22 @@ static int route4_init(struct tcf_proto *tp) | |||
254 | return 0; | 257 | return 0; |
255 | } | 258 | } |
256 | 259 | ||
257 | static void route4_delete_filter(struct rcu_head *head) | 260 | static void route4_delete_filter_work(struct work_struct *work) |
258 | { | 261 | { |
259 | struct route4_filter *f = container_of(head, struct route4_filter, rcu); | 262 | struct route4_filter *f = container_of(work, struct route4_filter, work); |
260 | 263 | ||
264 | rtnl_lock(); | ||
261 | tcf_exts_destroy(&f->exts); | 265 | tcf_exts_destroy(&f->exts); |
262 | kfree(f); | 266 | kfree(f); |
267 | rtnl_unlock(); | ||
268 | } | ||
269 | |||
270 | static void route4_delete_filter(struct rcu_head *head) | ||
271 | { | ||
272 | struct route4_filter *f = container_of(head, struct route4_filter, rcu); | ||
273 | |||
274 | INIT_WORK(&f->work, route4_delete_filter_work); | ||
275 | tcf_queue_work(&f->work); | ||
263 | } | 276 | } |
264 | 277 | ||
265 | static void route4_destroy(struct tcf_proto *tp) | 278 | static void route4_destroy(struct tcf_proto *tp) |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index b1f6ed48bc72..bdbc541787f8 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -97,7 +97,10 @@ struct rsvp_filter { | |||
97 | 97 | ||
98 | u32 handle; | 98 | u32 handle; |
99 | struct rsvp_session *sess; | 99 | struct rsvp_session *sess; |
100 | struct rcu_head rcu; | 100 | union { |
101 | struct work_struct work; | ||
102 | struct rcu_head rcu; | ||
103 | }; | ||
101 | }; | 104 | }; |
102 | 105 | ||
103 | static inline unsigned int hash_dst(__be32 *dst, u8 protocol, u8 tunnelid) | 106 | static inline unsigned int hash_dst(__be32 *dst, u8 protocol, u8 tunnelid) |
@@ -282,12 +285,22 @@ static int rsvp_init(struct tcf_proto *tp) | |||
282 | return -ENOBUFS; | 285 | return -ENOBUFS; |
283 | } | 286 | } |
284 | 287 | ||
285 | static void rsvp_delete_filter_rcu(struct rcu_head *head) | 288 | static void rsvp_delete_filter_work(struct work_struct *work) |
286 | { | 289 | { |
287 | struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu); | 290 | struct rsvp_filter *f = container_of(work, struct rsvp_filter, work); |
288 | 291 | ||
292 | rtnl_lock(); | ||
289 | tcf_exts_destroy(&f->exts); | 293 | tcf_exts_destroy(&f->exts); |
290 | kfree(f); | 294 | kfree(f); |
295 | rtnl_unlock(); | ||
296 | } | ||
297 | |||
298 | static void rsvp_delete_filter_rcu(struct rcu_head *head) | ||
299 | { | ||
300 | struct rsvp_filter *f = container_of(head, struct rsvp_filter, rcu); | ||
301 | |||
302 | INIT_WORK(&f->work, rsvp_delete_filter_work); | ||
303 | tcf_queue_work(&f->work); | ||
291 | } | 304 | } |
292 | 305 | ||
293 | static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) | 306 | static void rsvp_delete_filter(struct tcf_proto *tp, struct rsvp_filter *f) |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index d732b5474a4d..d6abfa6757f2 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -28,14 +28,20 @@ | |||
28 | struct tcindex_filter_result { | 28 | struct tcindex_filter_result { |
29 | struct tcf_exts exts; | 29 | struct tcf_exts exts; |
30 | struct tcf_result res; | 30 | struct tcf_result res; |
31 | struct rcu_head rcu; | 31 | union { |
32 | struct work_struct work; | ||
33 | struct rcu_head rcu; | ||
34 | }; | ||
32 | }; | 35 | }; |
33 | 36 | ||
34 | struct tcindex_filter { | 37 | struct tcindex_filter { |
35 | u16 key; | 38 | u16 key; |
36 | struct tcindex_filter_result result; | 39 | struct tcindex_filter_result result; |
37 | struct tcindex_filter __rcu *next; | 40 | struct tcindex_filter __rcu *next; |
38 | struct rcu_head rcu; | 41 | union { |
42 | struct work_struct work; | ||
43 | struct rcu_head rcu; | ||
44 | }; | ||
39 | }; | 45 | }; |
40 | 46 | ||
41 | 47 | ||
@@ -136,12 +142,34 @@ static int tcindex_init(struct tcf_proto *tp) | |||
136 | return 0; | 142 | return 0; |
137 | } | 143 | } |
138 | 144 | ||
145 | static void tcindex_destroy_rexts_work(struct work_struct *work) | ||
146 | { | ||
147 | struct tcindex_filter_result *r; | ||
148 | |||
149 | r = container_of(work, struct tcindex_filter_result, work); | ||
150 | rtnl_lock(); | ||
151 | tcf_exts_destroy(&r->exts); | ||
152 | rtnl_unlock(); | ||
153 | } | ||
154 | |||
139 | static void tcindex_destroy_rexts(struct rcu_head *head) | 155 | static void tcindex_destroy_rexts(struct rcu_head *head) |
140 | { | 156 | { |
141 | struct tcindex_filter_result *r; | 157 | struct tcindex_filter_result *r; |
142 | 158 | ||
143 | r = container_of(head, struct tcindex_filter_result, rcu); | 159 | r = container_of(head, struct tcindex_filter_result, rcu); |
144 | tcf_exts_destroy(&r->exts); | 160 | INIT_WORK(&r->work, tcindex_destroy_rexts_work); |
161 | tcf_queue_work(&r->work); | ||
162 | } | ||
163 | |||
164 | static void tcindex_destroy_fexts_work(struct work_struct *work) | ||
165 | { | ||
166 | struct tcindex_filter *f = container_of(work, struct tcindex_filter, | ||
167 | work); | ||
168 | |||
169 | rtnl_lock(); | ||
170 | tcf_exts_destroy(&f->result.exts); | ||
171 | kfree(f); | ||
172 | rtnl_unlock(); | ||
145 | } | 173 | } |
146 | 174 | ||
147 | static void tcindex_destroy_fexts(struct rcu_head *head) | 175 | static void tcindex_destroy_fexts(struct rcu_head *head) |
@@ -149,8 +177,8 @@ static void tcindex_destroy_fexts(struct rcu_head *head) | |||
149 | struct tcindex_filter *f = container_of(head, struct tcindex_filter, | 177 | struct tcindex_filter *f = container_of(head, struct tcindex_filter, |
150 | rcu); | 178 | rcu); |
151 | 179 | ||
152 | tcf_exts_destroy(&f->result.exts); | 180 | INIT_WORK(&f->work, tcindex_destroy_fexts_work); |
153 | kfree(f); | 181 | tcf_queue_work(&f->work); |
154 | } | 182 | } |
155 | 183 | ||
156 | static int tcindex_delete(struct tcf_proto *tp, void *arg, bool *last) | 184 | static int tcindex_delete(struct tcf_proto *tp, void *arg, bool *last) |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 9ff17159fb61..86145867b424 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -69,7 +69,10 @@ struct tc_u_knode { | |||
69 | u32 __percpu *pcpu_success; | 69 | u32 __percpu *pcpu_success; |
70 | #endif | 70 | #endif |
71 | struct tcf_proto *tp; | 71 | struct tcf_proto *tp; |
72 | struct rcu_head rcu; | 72 | union { |
73 | struct work_struct work; | ||
74 | struct rcu_head rcu; | ||
75 | }; | ||
73 | /* The 'sel' field MUST be the last field in structure to allow for | 76 | /* The 'sel' field MUST be the last field in structure to allow for |
74 | * tc_u32_keys allocated at end of structure. | 77 | * tc_u32_keys allocated at end of structure. |
75 | */ | 78 | */ |
@@ -418,11 +421,21 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n, | |||
418 | * this the u32_delete_key_rcu variant does not free the percpu | 421 | * this the u32_delete_key_rcu variant does not free the percpu |
419 | * statistics. | 422 | * statistics. |
420 | */ | 423 | */ |
424 | static void u32_delete_key_work(struct work_struct *work) | ||
425 | { | ||
426 | struct tc_u_knode *key = container_of(work, struct tc_u_knode, work); | ||
427 | |||
428 | rtnl_lock(); | ||
429 | u32_destroy_key(key->tp, key, false); | ||
430 | rtnl_unlock(); | ||
431 | } | ||
432 | |||
421 | static void u32_delete_key_rcu(struct rcu_head *rcu) | 433 | static void u32_delete_key_rcu(struct rcu_head *rcu) |
422 | { | 434 | { |
423 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); | 435 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); |
424 | 436 | ||
425 | u32_destroy_key(key->tp, key, false); | 437 | INIT_WORK(&key->work, u32_delete_key_work); |
438 | tcf_queue_work(&key->work); | ||
426 | } | 439 | } |
427 | 440 | ||
428 | /* u32_delete_key_freepf_rcu is the rcu callback variant | 441 | /* u32_delete_key_freepf_rcu is the rcu callback variant |
@@ -432,11 +445,21 @@ static void u32_delete_key_rcu(struct rcu_head *rcu) | |||
432 | * for the variant that should be used with keys return from | 445 | * for the variant that should be used with keys return from |
433 | * u32_init_knode() | 446 | * u32_init_knode() |
434 | */ | 447 | */ |
448 | static void u32_delete_key_freepf_work(struct work_struct *work) | ||
449 | { | ||
450 | struct tc_u_knode *key = container_of(work, struct tc_u_knode, work); | ||
451 | |||
452 | rtnl_lock(); | ||
453 | u32_destroy_key(key->tp, key, true); | ||
454 | rtnl_unlock(); | ||
455 | } | ||
456 | |||
435 | static void u32_delete_key_freepf_rcu(struct rcu_head *rcu) | 457 | static void u32_delete_key_freepf_rcu(struct rcu_head *rcu) |
436 | { | 458 | { |
437 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); | 459 | struct tc_u_knode *key = container_of(rcu, struct tc_u_knode, rcu); |
438 | 460 | ||
439 | u32_destroy_key(key->tp, key, true); | 461 | INIT_WORK(&key->work, u32_delete_key_freepf_work); |
462 | tcf_queue_work(&key->work); | ||
440 | } | 463 | } |
441 | 464 | ||
442 | static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key) | 465 | static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key) |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index a9ac912f1d67..b6c4f536876b 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -301,6 +301,8 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) | |||
301 | { | 301 | { |
302 | struct Qdisc *q; | 302 | struct Qdisc *q; |
303 | 303 | ||
304 | if (!handle) | ||
305 | return NULL; | ||
304 | q = qdisc_match_from_root(dev->qdisc, handle); | 306 | q = qdisc_match_from_root(dev->qdisc, handle); |
305 | if (q) | 307 | if (q) |
306 | goto out; | 308 | goto out; |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 34f10e75f3b9..621b5ca3fd1c 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -794,7 +794,7 @@ hit: | |||
794 | struct sctp_hash_cmp_arg { | 794 | struct sctp_hash_cmp_arg { |
795 | const union sctp_addr *paddr; | 795 | const union sctp_addr *paddr; |
796 | const struct net *net; | 796 | const struct net *net; |
797 | u16 lport; | 797 | __be16 lport; |
798 | }; | 798 | }; |
799 | 799 | ||
800 | static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, | 800 | static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, |
@@ -820,37 +820,37 @@ out: | |||
820 | return err; | 820 | return err; |
821 | } | 821 | } |
822 | 822 | ||
823 | static inline u32 sctp_hash_obj(const void *data, u32 len, u32 seed) | 823 | static inline __u32 sctp_hash_obj(const void *data, u32 len, u32 seed) |
824 | { | 824 | { |
825 | const struct sctp_transport *t = data; | 825 | const struct sctp_transport *t = data; |
826 | const union sctp_addr *paddr = &t->ipaddr; | 826 | const union sctp_addr *paddr = &t->ipaddr; |
827 | const struct net *net = sock_net(t->asoc->base.sk); | 827 | const struct net *net = sock_net(t->asoc->base.sk); |
828 | u16 lport = htons(t->asoc->base.bind_addr.port); | 828 | __be16 lport = htons(t->asoc->base.bind_addr.port); |
829 | u32 addr; | 829 | __u32 addr; |
830 | 830 | ||
831 | if (paddr->sa.sa_family == AF_INET6) | 831 | if (paddr->sa.sa_family == AF_INET6) |
832 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); | 832 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); |
833 | else | 833 | else |
834 | addr = paddr->v4.sin_addr.s_addr; | 834 | addr = (__force __u32)paddr->v4.sin_addr.s_addr; |
835 | 835 | ||
836 | return jhash_3words(addr, ((__u32)paddr->v4.sin_port) << 16 | | 836 | return jhash_3words(addr, ((__force __u32)paddr->v4.sin_port) << 16 | |
837 | (__force __u32)lport, net_hash_mix(net), seed); | 837 | (__force __u32)lport, net_hash_mix(net), seed); |
838 | } | 838 | } |
839 | 839 | ||
840 | static inline u32 sctp_hash_key(const void *data, u32 len, u32 seed) | 840 | static inline __u32 sctp_hash_key(const void *data, u32 len, u32 seed) |
841 | { | 841 | { |
842 | const struct sctp_hash_cmp_arg *x = data; | 842 | const struct sctp_hash_cmp_arg *x = data; |
843 | const union sctp_addr *paddr = x->paddr; | 843 | const union sctp_addr *paddr = x->paddr; |
844 | const struct net *net = x->net; | 844 | const struct net *net = x->net; |
845 | u16 lport = x->lport; | 845 | __be16 lport = x->lport; |
846 | u32 addr; | 846 | __u32 addr; |
847 | 847 | ||
848 | if (paddr->sa.sa_family == AF_INET6) | 848 | if (paddr->sa.sa_family == AF_INET6) |
849 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); | 849 | addr = jhash(&paddr->v6.sin6_addr, 16, seed); |
850 | else | 850 | else |
851 | addr = paddr->v4.sin_addr.s_addr; | 851 | addr = (__force __u32)paddr->v4.sin_addr.s_addr; |
852 | 852 | ||
853 | return jhash_3words(addr, ((__u32)paddr->v4.sin_port) << 16 | | 853 | return jhash_3words(addr, ((__force __u32)paddr->v4.sin_port) << 16 | |
854 | (__force __u32)lport, net_hash_mix(net), seed); | 854 | (__force __u32)lport, net_hash_mix(net), seed); |
855 | } | 855 | } |
856 | 856 | ||
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 51c488769590..a6dfa86c0201 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -738,7 +738,7 @@ static int sctp_v6_skb_iif(const struct sk_buff *skb) | |||
738 | /* Was this packet marked by Explicit Congestion Notification? */ | 738 | /* Was this packet marked by Explicit Congestion Notification? */ |
739 | static int sctp_v6_is_ce(const struct sk_buff *skb) | 739 | static int sctp_v6_is_ce(const struct sk_buff *skb) |
740 | { | 740 | { |
741 | return *((__u32 *)(ipv6_hdr(skb))) & htonl(1 << 20); | 741 | return *((__u32 *)(ipv6_hdr(skb))) & (__force __u32)htonl(1 << 20); |
742 | } | 742 | } |
743 | 743 | ||
744 | /* Dump the v6 addr to the seq file. */ | 744 | /* Dump the v6 addr to the seq file. */ |
@@ -882,8 +882,10 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
882 | net = sock_net(&opt->inet.sk); | 882 | net = sock_net(&opt->inet.sk); |
883 | rcu_read_lock(); | 883 | rcu_read_lock(); |
884 | dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); | 884 | dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); |
885 | if (!dev || | 885 | if (!dev || !(opt->inet.freebind || |
886 | !ipv6_chk_addr(net, &addr->v6.sin6_addr, dev, 0)) { | 886 | net->ipv6.sysctl.ip_nonlocal_bind || |
887 | ipv6_chk_addr(net, &addr->v6.sin6_addr, | ||
888 | dev, 0))) { | ||
887 | rcu_read_unlock(); | 889 | rcu_read_unlock(); |
888 | return 0; | 890 | return 0; |
889 | } | 891 | } |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index ca8f196b6c6c..514465b03829 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2854,7 +2854,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, | |||
2854 | addr_param_len = af->to_addr_param(addr, &addr_param); | 2854 | addr_param_len = af->to_addr_param(addr, &addr_param); |
2855 | param.param_hdr.type = flags; | 2855 | param.param_hdr.type = flags; |
2856 | param.param_hdr.length = htons(paramlen + addr_param_len); | 2856 | param.param_hdr.length = htons(paramlen + addr_param_len); |
2857 | param.crr_id = i; | 2857 | param.crr_id = htonl(i); |
2858 | 2858 | ||
2859 | sctp_addto_chunk(retval, paramlen, ¶m); | 2859 | sctp_addto_chunk(retval, paramlen, ¶m); |
2860 | sctp_addto_chunk(retval, addr_param_len, &addr_param); | 2860 | sctp_addto_chunk(retval, addr_param_len, &addr_param); |
@@ -2867,7 +2867,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc, | |||
2867 | addr_param_len = af->to_addr_param(addr, &addr_param); | 2867 | addr_param_len = af->to_addr_param(addr, &addr_param); |
2868 | param.param_hdr.type = SCTP_PARAM_DEL_IP; | 2868 | param.param_hdr.type = SCTP_PARAM_DEL_IP; |
2869 | param.param_hdr.length = htons(paramlen + addr_param_len); | 2869 | param.param_hdr.length = htons(paramlen + addr_param_len); |
2870 | param.crr_id = i; | 2870 | param.crr_id = htonl(i); |
2871 | 2871 | ||
2872 | sctp_addto_chunk(retval, paramlen, ¶m); | 2872 | sctp_addto_chunk(retval, paramlen, ¶m); |
2873 | sctp_addto_chunk(retval, addr_param_len, &addr_param); | 2873 | sctp_addto_chunk(retval, addr_param_len, &addr_param); |
@@ -3591,7 +3591,7 @@ static struct sctp_chunk *sctp_make_reconf(const struct sctp_association *asoc, | |||
3591 | */ | 3591 | */ |
3592 | struct sctp_chunk *sctp_make_strreset_req( | 3592 | struct sctp_chunk *sctp_make_strreset_req( |
3593 | const struct sctp_association *asoc, | 3593 | const struct sctp_association *asoc, |
3594 | __u16 stream_num, __u16 *stream_list, | 3594 | __u16 stream_num, __be16 *stream_list, |
3595 | bool out, bool in) | 3595 | bool out, bool in) |
3596 | { | 3596 | { |
3597 | struct sctp_strreset_outreq outreq; | 3597 | struct sctp_strreset_outreq outreq; |
@@ -3788,7 +3788,8 @@ bool sctp_verify_reconf(const struct sctp_association *asoc, | |||
3788 | { | 3788 | { |
3789 | struct sctp_reconf_chunk *hdr; | 3789 | struct sctp_reconf_chunk *hdr; |
3790 | union sctp_params param; | 3790 | union sctp_params param; |
3791 | __u16 last = 0, cnt = 0; | 3791 | __be16 last = 0; |
3792 | __u16 cnt = 0; | ||
3792 | 3793 | ||
3793 | hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; | 3794 | hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; |
3794 | sctp_walk_params(param, hdr, params) { | 3795 | sctp_walk_params(param, hdr, params) { |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 1c2699b424af..df94d77401e7 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -1629,12 +1629,12 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, | |||
1629 | break; | 1629 | break; |
1630 | 1630 | ||
1631 | case SCTP_CMD_INIT_FAILED: | 1631 | case SCTP_CMD_INIT_FAILED: |
1632 | sctp_cmd_init_failed(commands, asoc, cmd->obj.err); | 1632 | sctp_cmd_init_failed(commands, asoc, cmd->obj.u32); |
1633 | break; | 1633 | break; |
1634 | 1634 | ||
1635 | case SCTP_CMD_ASSOC_FAILED: | 1635 | case SCTP_CMD_ASSOC_FAILED: |
1636 | sctp_cmd_assoc_failed(commands, asoc, event_type, | 1636 | sctp_cmd_assoc_failed(commands, asoc, event_type, |
1637 | subtype, chunk, cmd->obj.err); | 1637 | subtype, chunk, cmd->obj.u32); |
1638 | break; | 1638 | break; |
1639 | 1639 | ||
1640 | case SCTP_CMD_INIT_COUNTER_INC: | 1640 | case SCTP_CMD_INIT_COUNTER_INC: |
@@ -1702,8 +1702,8 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, | |||
1702 | case SCTP_CMD_PROCESS_CTSN: | 1702 | case SCTP_CMD_PROCESS_CTSN: |
1703 | /* Dummy up a SACK for processing. */ | 1703 | /* Dummy up a SACK for processing. */ |
1704 | sackh.cum_tsn_ack = cmd->obj.be32; | 1704 | sackh.cum_tsn_ack = cmd->obj.be32; |
1705 | sackh.a_rwnd = asoc->peer.rwnd + | 1705 | sackh.a_rwnd = htonl(asoc->peer.rwnd + |
1706 | asoc->outqueue.outstanding_bytes; | 1706 | asoc->outqueue.outstanding_bytes); |
1707 | sackh.num_gap_ack_blocks = 0; | 1707 | sackh.num_gap_ack_blocks = 0; |
1708 | sackh.num_dup_tsns = 0; | 1708 | sackh.num_dup_tsns = 0; |
1709 | chunk->subh.sack_hdr = &sackh; | 1709 | chunk->subh.sack_hdr = &sackh; |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index c75acdf71a6f..b029757bea03 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -171,6 +171,36 @@ static inline void sctp_set_owner_w(struct sctp_chunk *chunk) | |||
171 | sk_mem_charge(sk, chunk->skb->truesize); | 171 | sk_mem_charge(sk, chunk->skb->truesize); |
172 | } | 172 | } |
173 | 173 | ||
174 | static void sctp_clear_owner_w(struct sctp_chunk *chunk) | ||
175 | { | ||
176 | skb_orphan(chunk->skb); | ||
177 | } | ||
178 | |||
179 | static void sctp_for_each_tx_datachunk(struct sctp_association *asoc, | ||
180 | void (*cb)(struct sctp_chunk *)) | ||
181 | |||
182 | { | ||
183 | struct sctp_outq *q = &asoc->outqueue; | ||
184 | struct sctp_transport *t; | ||
185 | struct sctp_chunk *chunk; | ||
186 | |||
187 | list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) | ||
188 | list_for_each_entry(chunk, &t->transmitted, transmitted_list) | ||
189 | cb(chunk); | ||
190 | |||
191 | list_for_each_entry(chunk, &q->retransmit, list) | ||
192 | cb(chunk); | ||
193 | |||
194 | list_for_each_entry(chunk, &q->sacked, list) | ||
195 | cb(chunk); | ||
196 | |||
197 | list_for_each_entry(chunk, &q->abandoned, list) | ||
198 | cb(chunk); | ||
199 | |||
200 | list_for_each_entry(chunk, &q->out_chunk_list, list) | ||
201 | cb(chunk); | ||
202 | } | ||
203 | |||
174 | /* Verify that this is a valid address. */ | 204 | /* Verify that this is a valid address. */ |
175 | static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr, | 205 | static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr, |
176 | int len) | 206 | int len) |
@@ -8379,7 +8409,9 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
8379 | * paths won't try to lock it and then oldsk. | 8409 | * paths won't try to lock it and then oldsk. |
8380 | */ | 8410 | */ |
8381 | lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); | 8411 | lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); |
8412 | sctp_for_each_tx_datachunk(assoc, sctp_clear_owner_w); | ||
8382 | sctp_assoc_migrate(assoc, newsk); | 8413 | sctp_assoc_migrate(assoc, newsk); |
8414 | sctp_for_each_tx_datachunk(assoc, sctp_set_owner_w); | ||
8383 | 8415 | ||
8384 | /* If the association on the newsk is already closed before accept() | 8416 | /* If the association on the newsk is already closed before accept() |
8385 | * is called, set RCV_SHUTDOWN flag. | 8417 | * is called, set RCV_SHUTDOWN flag. |
diff --git a/net/sctp/stream.c b/net/sctp/stream.c index 5ea33a2c453b..03764fc2b652 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c | |||
@@ -261,6 +261,7 @@ int sctp_send_reset_streams(struct sctp_association *asoc, | |||
261 | __u16 i, str_nums, *str_list; | 261 | __u16 i, str_nums, *str_list; |
262 | struct sctp_chunk *chunk; | 262 | struct sctp_chunk *chunk; |
263 | int retval = -EINVAL; | 263 | int retval = -EINVAL; |
264 | __be16 *nstr_list; | ||
264 | bool out, in; | 265 | bool out, in; |
265 | 266 | ||
266 | if (!asoc->peer.reconf_capable || | 267 | if (!asoc->peer.reconf_capable || |
@@ -291,13 +292,18 @@ int sctp_send_reset_streams(struct sctp_association *asoc, | |||
291 | if (str_list[i] >= stream->incnt) | 292 | if (str_list[i] >= stream->incnt) |
292 | goto out; | 293 | goto out; |
293 | 294 | ||
295 | nstr_list = kcalloc(str_nums, sizeof(__be16), GFP_KERNEL); | ||
296 | if (!nstr_list) { | ||
297 | retval = -ENOMEM; | ||
298 | goto out; | ||
299 | } | ||
300 | |||
294 | for (i = 0; i < str_nums; i++) | 301 | for (i = 0; i < str_nums; i++) |
295 | str_list[i] = htons(str_list[i]); | 302 | nstr_list[i] = htons(str_list[i]); |
296 | 303 | ||
297 | chunk = sctp_make_strreset_req(asoc, str_nums, str_list, out, in); | 304 | chunk = sctp_make_strreset_req(asoc, str_nums, nstr_list, out, in); |
298 | 305 | ||
299 | for (i = 0; i < str_nums; i++) | 306 | kfree(nstr_list); |
300 | str_list[i] = ntohs(str_list[i]); | ||
301 | 307 | ||
302 | if (!chunk) { | 308 | if (!chunk) { |
303 | retval = -ENOMEM; | 309 | retval = -ENOMEM; |
@@ -442,7 +448,7 @@ out: | |||
442 | } | 448 | } |
443 | 449 | ||
444 | static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param( | 450 | static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param( |
445 | struct sctp_association *asoc, __u32 resp_seq, | 451 | struct sctp_association *asoc, __be32 resp_seq, |
446 | __be16 type) | 452 | __be16 type) |
447 | { | 453 | { |
448 | struct sctp_chunk *chunk = asoc->strreset_chunk; | 454 | struct sctp_chunk *chunk = asoc->strreset_chunk; |
@@ -482,8 +488,9 @@ struct sctp_chunk *sctp_process_strreset_outreq( | |||
482 | { | 488 | { |
483 | struct sctp_strreset_outreq *outreq = param.v; | 489 | struct sctp_strreset_outreq *outreq = param.v; |
484 | struct sctp_stream *stream = &asoc->stream; | 490 | struct sctp_stream *stream = &asoc->stream; |
485 | __u16 i, nums, flags = 0, *str_p = NULL; | ||
486 | __u32 result = SCTP_STRRESET_DENIED; | 491 | __u32 result = SCTP_STRRESET_DENIED; |
492 | __u16 i, nums, flags = 0; | ||
493 | __be16 *str_p = NULL; | ||
487 | __u32 request_seq; | 494 | __u32 request_seq; |
488 | 495 | ||
489 | request_seq = ntohl(outreq->request_seq); | 496 | request_seq = ntohl(outreq->request_seq); |
@@ -576,8 +583,9 @@ struct sctp_chunk *sctp_process_strreset_inreq( | |||
576 | struct sctp_stream *stream = &asoc->stream; | 583 | struct sctp_stream *stream = &asoc->stream; |
577 | __u32 result = SCTP_STRRESET_DENIED; | 584 | __u32 result = SCTP_STRRESET_DENIED; |
578 | struct sctp_chunk *chunk = NULL; | 585 | struct sctp_chunk *chunk = NULL; |
579 | __u16 i, nums, *str_p; | ||
580 | __u32 request_seq; | 586 | __u32 request_seq; |
587 | __u16 i, nums; | ||
588 | __be16 *str_p; | ||
581 | 589 | ||
582 | request_seq = ntohl(inreq->request_seq); | 590 | request_seq = ntohl(inreq->request_seq); |
583 | if (TSN_lt(asoc->strreset_inseq, request_seq) || | 591 | if (TSN_lt(asoc->strreset_inseq, request_seq) || |
@@ -897,7 +905,7 @@ struct sctp_chunk *sctp_process_strreset_resp( | |||
897 | 905 | ||
898 | if (req->type == SCTP_PARAM_RESET_OUT_REQUEST) { | 906 | if (req->type == SCTP_PARAM_RESET_OUT_REQUEST) { |
899 | struct sctp_strreset_outreq *outreq; | 907 | struct sctp_strreset_outreq *outreq; |
900 | __u16 *str_p; | 908 | __be16 *str_p; |
901 | 909 | ||
902 | outreq = (struct sctp_strreset_outreq *)req; | 910 | outreq = (struct sctp_strreset_outreq *)req; |
903 | str_p = outreq->list_of_streams; | 911 | str_p = outreq->list_of_streams; |
@@ -922,7 +930,7 @@ struct sctp_chunk *sctp_process_strreset_resp( | |||
922 | nums, str_p, GFP_ATOMIC); | 930 | nums, str_p, GFP_ATOMIC); |
923 | } else if (req->type == SCTP_PARAM_RESET_IN_REQUEST) { | 931 | } else if (req->type == SCTP_PARAM_RESET_IN_REQUEST) { |
924 | struct sctp_strreset_inreq *inreq; | 932 | struct sctp_strreset_inreq *inreq; |
925 | __u16 *str_p; | 933 | __be16 *str_p; |
926 | 934 | ||
927 | /* if the result is performed, it's impossible for inreq */ | 935 | /* if the result is performed, it's impossible for inreq */ |
928 | if (result == SCTP_STRRESET_PERFORMED) | 936 | if (result == SCTP_STRRESET_PERFORMED) |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 67abc0194f30..5447228bf1a0 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -847,7 +847,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( | |||
847 | 847 | ||
848 | struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( | 848 | struct sctp_ulpevent *sctp_ulpevent_make_stream_reset_event( |
849 | const struct sctp_association *asoc, __u16 flags, __u16 stream_num, | 849 | const struct sctp_association *asoc, __u16 flags, __u16 stream_num, |
850 | __u16 *stream_list, gfp_t gfp) | 850 | __be16 *stream_list, gfp_t gfp) |
851 | { | 851 | { |
852 | struct sctp_stream_reset_event *sreset; | 852 | struct sctp_stream_reset_event *sreset; |
853 | struct sctp_ulpevent *event; | 853 | struct sctp_ulpevent *event; |
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c index d4ea46a5f233..c5fda15ba319 100644 --- a/net/strparser/strparser.c +++ b/net/strparser/strparser.c | |||
@@ -49,7 +49,7 @@ static void strp_abort_strp(struct strparser *strp, int err) | |||
49 | { | 49 | { |
50 | /* Unrecoverable error in receive */ | 50 | /* Unrecoverable error in receive */ |
51 | 51 | ||
52 | del_timer(&strp->msg_timer); | 52 | cancel_delayed_work(&strp->msg_timer_work); |
53 | 53 | ||
54 | if (strp->stopped) | 54 | if (strp->stopped) |
55 | return; | 55 | return; |
@@ -68,7 +68,7 @@ static void strp_abort_strp(struct strparser *strp, int err) | |||
68 | static void strp_start_timer(struct strparser *strp, long timeo) | 68 | static void strp_start_timer(struct strparser *strp, long timeo) |
69 | { | 69 | { |
70 | if (timeo) | 70 | if (timeo) |
71 | mod_timer(&strp->msg_timer, timeo); | 71 | mod_delayed_work(strp_wq, &strp->msg_timer_work, timeo); |
72 | } | 72 | } |
73 | 73 | ||
74 | /* Lower lock held */ | 74 | /* Lower lock held */ |
@@ -319,7 +319,7 @@ static int __strp_recv(read_descriptor_t *desc, struct sk_buff *orig_skb, | |||
319 | eaten += (cand_len - extra); | 319 | eaten += (cand_len - extra); |
320 | 320 | ||
321 | /* Hurray, we have a new message! */ | 321 | /* Hurray, we have a new message! */ |
322 | del_timer(&strp->msg_timer); | 322 | cancel_delayed_work(&strp->msg_timer_work); |
323 | strp->skb_head = NULL; | 323 | strp->skb_head = NULL; |
324 | STRP_STATS_INCR(strp->stats.msgs); | 324 | STRP_STATS_INCR(strp->stats.msgs); |
325 | 325 | ||
@@ -450,9 +450,10 @@ static void strp_work(struct work_struct *w) | |||
450 | do_strp_work(container_of(w, struct strparser, work)); | 450 | do_strp_work(container_of(w, struct strparser, work)); |
451 | } | 451 | } |
452 | 452 | ||
453 | static void strp_msg_timeout(unsigned long arg) | 453 | static void strp_msg_timeout(struct work_struct *w) |
454 | { | 454 | { |
455 | struct strparser *strp = (struct strparser *)arg; | 455 | struct strparser *strp = container_of(w, struct strparser, |
456 | msg_timer_work.work); | ||
456 | 457 | ||
457 | /* Message assembly timed out */ | 458 | /* Message assembly timed out */ |
458 | STRP_STATS_INCR(strp->stats.msg_timeouts); | 459 | STRP_STATS_INCR(strp->stats.msg_timeouts); |
@@ -505,9 +506,7 @@ int strp_init(struct strparser *strp, struct sock *sk, | |||
505 | strp->cb.read_sock_done = cb->read_sock_done ? : default_read_sock_done; | 506 | strp->cb.read_sock_done = cb->read_sock_done ? : default_read_sock_done; |
506 | strp->cb.abort_parser = cb->abort_parser ? : strp_abort_strp; | 507 | strp->cb.abort_parser = cb->abort_parser ? : strp_abort_strp; |
507 | 508 | ||
508 | setup_timer(&strp->msg_timer, strp_msg_timeout, | 509 | INIT_DELAYED_WORK(&strp->msg_timer_work, strp_msg_timeout); |
509 | (unsigned long)strp); | ||
510 | |||
511 | INIT_WORK(&strp->work, strp_work); | 510 | INIT_WORK(&strp->work, strp_work); |
512 | 511 | ||
513 | return 0; | 512 | return 0; |
@@ -532,7 +531,7 @@ void strp_done(struct strparser *strp) | |||
532 | { | 531 | { |
533 | WARN_ON(!strp->stopped); | 532 | WARN_ON(!strp->stopped); |
534 | 533 | ||
535 | del_timer_sync(&strp->msg_timer); | 534 | cancel_delayed_work_sync(&strp->msg_timer_work); |
536 | cancel_work_sync(&strp->work); | 535 | cancel_work_sync(&strp->work); |
537 | 536 | ||
538 | if (strp->skb_head) { | 537 | if (strp->skb_head) { |
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 4b00302e1867..6160d17a31c4 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c | |||
@@ -1333,7 +1333,7 @@ void xprt_release(struct rpc_task *task) | |||
1333 | rpc_count_iostats(task, task->tk_client->cl_metrics); | 1333 | rpc_count_iostats(task, task->tk_client->cl_metrics); |
1334 | spin_lock(&xprt->recv_lock); | 1334 | spin_lock(&xprt->recv_lock); |
1335 | if (!list_empty(&req->rq_list)) { | 1335 | if (!list_empty(&req->rq_list)) { |
1336 | list_del(&req->rq_list); | 1336 | list_del_init(&req->rq_list); |
1337 | xprt_wait_on_pinned_rqst(req); | 1337 | xprt_wait_on_pinned_rqst(req); |
1338 | } | 1338 | } |
1339 | spin_unlock(&xprt->recv_lock); | 1339 | spin_unlock(&xprt->recv_lock); |
@@ -1444,6 +1444,23 @@ out: | |||
1444 | return xprt; | 1444 | return xprt; |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | static void xprt_destroy_cb(struct work_struct *work) | ||
1448 | { | ||
1449 | struct rpc_xprt *xprt = | ||
1450 | container_of(work, struct rpc_xprt, task_cleanup); | ||
1451 | |||
1452 | rpc_xprt_debugfs_unregister(xprt); | ||
1453 | rpc_destroy_wait_queue(&xprt->binding); | ||
1454 | rpc_destroy_wait_queue(&xprt->pending); | ||
1455 | rpc_destroy_wait_queue(&xprt->sending); | ||
1456 | rpc_destroy_wait_queue(&xprt->backlog); | ||
1457 | kfree(xprt->servername); | ||
1458 | /* | ||
1459 | * Tear down transport state and free the rpc_xprt | ||
1460 | */ | ||
1461 | xprt->ops->destroy(xprt); | ||
1462 | } | ||
1463 | |||
1447 | /** | 1464 | /** |
1448 | * xprt_destroy - destroy an RPC transport, killing off all requests. | 1465 | * xprt_destroy - destroy an RPC transport, killing off all requests. |
1449 | * @xprt: transport to destroy | 1466 | * @xprt: transport to destroy |
@@ -1453,22 +1470,19 @@ static void xprt_destroy(struct rpc_xprt *xprt) | |||
1453 | { | 1470 | { |
1454 | dprintk("RPC: destroying transport %p\n", xprt); | 1471 | dprintk("RPC: destroying transport %p\n", xprt); |
1455 | 1472 | ||
1456 | /* Exclude transport connect/disconnect handlers */ | 1473 | /* |
1474 | * Exclude transport connect/disconnect handlers and autoclose | ||
1475 | */ | ||
1457 | wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); | 1476 | wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_UNINTERRUPTIBLE); |
1458 | 1477 | ||
1459 | del_timer_sync(&xprt->timer); | 1478 | del_timer_sync(&xprt->timer); |
1460 | 1479 | ||
1461 | rpc_xprt_debugfs_unregister(xprt); | ||
1462 | rpc_destroy_wait_queue(&xprt->binding); | ||
1463 | rpc_destroy_wait_queue(&xprt->pending); | ||
1464 | rpc_destroy_wait_queue(&xprt->sending); | ||
1465 | rpc_destroy_wait_queue(&xprt->backlog); | ||
1466 | cancel_work_sync(&xprt->task_cleanup); | ||
1467 | kfree(xprt->servername); | ||
1468 | /* | 1480 | /* |
1469 | * Tear down transport state and free the rpc_xprt | 1481 | * Destroy sockets etc from the system workqueue so they can |
1482 | * safely flush receive work running on rpciod. | ||
1470 | */ | 1483 | */ |
1471 | xprt->ops->destroy(xprt); | 1484 | INIT_WORK(&xprt->task_cleanup, xprt_destroy_cb); |
1485 | schedule_work(&xprt->task_cleanup); | ||
1472 | } | 1486 | } |
1473 | 1487 | ||
1474 | static void xprt_destroy_kref(struct kref *kref) | 1488 | static void xprt_destroy_kref(struct kref *kref) |
diff --git a/net/unix/diag.c b/net/unix/diag.c index 4d9679701a6d..384c84e83462 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
@@ -257,6 +257,8 @@ static int unix_diag_get_exact(struct sk_buff *in_skb, | |||
257 | err = -ENOENT; | 257 | err = -ENOENT; |
258 | if (sk == NULL) | 258 | if (sk == NULL) |
259 | goto out_nosk; | 259 | goto out_nosk; |
260 | if (!net_eq(sock_net(sk), net)) | ||
261 | goto out; | ||
260 | 262 | ||
261 | err = sock_diag_check_cookie(sk, req->udiag_cookie); | 263 | err = sock_diag_check_cookie(sk, req->udiag_cookie); |
262 | if (err) | 264 | if (err) |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index f38ed490e42b..29bf453a0d5f 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -522,11 +522,6 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev, | |||
522 | return -EOPNOTSUPP; | 522 | return -EOPNOTSUPP; |
523 | 523 | ||
524 | if (wdev->current_bss) { | 524 | if (wdev->current_bss) { |
525 | if (!prev_bssid) | ||
526 | return -EALREADY; | ||
527 | if (prev_bssid && | ||
528 | !ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid)) | ||
529 | return -ENOTCONN; | ||
530 | cfg80211_unhold_bss(wdev->current_bss); | 525 | cfg80211_unhold_bss(wdev->current_bss); |
531 | cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); | 526 | cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); |
532 | wdev->current_bss = NULL; | 527 | wdev->current_bss = NULL; |
@@ -1106,11 +1101,35 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
1106 | 1101 | ||
1107 | ASSERT_WDEV_LOCK(wdev); | 1102 | ASSERT_WDEV_LOCK(wdev); |
1108 | 1103 | ||
1109 | if (WARN_ON(wdev->connect_keys)) { | 1104 | /* |
1110 | kzfree(wdev->connect_keys); | 1105 | * If we have an ssid_len, we're trying to connect or are |
1111 | wdev->connect_keys = NULL; | 1106 | * already connected, so reject a new SSID unless it's the |
1107 | * same (which is the case for re-association.) | ||
1108 | */ | ||
1109 | if (wdev->ssid_len && | ||
1110 | (wdev->ssid_len != connect->ssid_len || | ||
1111 | memcmp(wdev->ssid, connect->ssid, wdev->ssid_len))) | ||
1112 | return -EALREADY; | ||
1113 | |||
1114 | /* | ||
1115 | * If connected, reject (re-)association unless prev_bssid | ||
1116 | * matches the current BSSID. | ||
1117 | */ | ||
1118 | if (wdev->current_bss) { | ||
1119 | if (!prev_bssid) | ||
1120 | return -EALREADY; | ||
1121 | if (!ether_addr_equal(prev_bssid, wdev->current_bss->pub.bssid)) | ||
1122 | return -ENOTCONN; | ||
1112 | } | 1123 | } |
1113 | 1124 | ||
1125 | /* | ||
1126 | * Reject if we're in the process of connecting with WEP, | ||
1127 | * this case isn't very interesting and trying to handle | ||
1128 | * it would make the code much more complex. | ||
1129 | */ | ||
1130 | if (wdev->connect_keys) | ||
1131 | return -EINPROGRESS; | ||
1132 | |||
1114 | cfg80211_oper_and_ht_capa(&connect->ht_capa_mask, | 1133 | cfg80211_oper_and_ht_capa(&connect->ht_capa_mask, |
1115 | rdev->wiphy.ht_capa_mod_mask); | 1134 | rdev->wiphy.ht_capa_mod_mask); |
1116 | 1135 | ||
@@ -1161,7 +1180,12 @@ int cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
1161 | 1180 | ||
1162 | if (err) { | 1181 | if (err) { |
1163 | wdev->connect_keys = NULL; | 1182 | wdev->connect_keys = NULL; |
1164 | wdev->ssid_len = 0; | 1183 | /* |
1184 | * This could be reassoc getting refused, don't clear | ||
1185 | * ssid_len in that case. | ||
1186 | */ | ||
1187 | if (!wdev->current_bss) | ||
1188 | wdev->ssid_len = 0; | ||
1165 | return err; | 1189 | return err; |
1166 | } | 1190 | } |
1167 | 1191 | ||
@@ -1188,6 +1212,14 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev, | |||
1188 | else if (wdev->ssid_len) | 1212 | else if (wdev->ssid_len) |
1189 | err = rdev_disconnect(rdev, dev, reason); | 1213 | err = rdev_disconnect(rdev, dev, reason); |
1190 | 1214 | ||
1215 | /* | ||
1216 | * Clear ssid_len unless we actually were fully connected, | ||
1217 | * in which case cfg80211_disconnected() will take care of | ||
1218 | * this later. | ||
1219 | */ | ||
1220 | if (!wdev->current_bss) | ||
1221 | wdev->ssid_len = 0; | ||
1222 | |||
1191 | return err; | 1223 | return err; |
1192 | } | 1224 | } |
1193 | 1225 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 4838329bb43a..b669c624a1ec 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1572,6 +1572,14 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1572 | goto put_states; | 1572 | goto put_states; |
1573 | } | 1573 | } |
1574 | 1574 | ||
1575 | if (!dst_prev) | ||
1576 | dst0 = dst1; | ||
1577 | else | ||
1578 | /* Ref count is taken during xfrm_alloc_dst() | ||
1579 | * No need to do dst_clone() on dst1 | ||
1580 | */ | ||
1581 | dst_prev->child = dst1; | ||
1582 | |||
1575 | if (xfrm[i]->sel.family == AF_UNSPEC) { | 1583 | if (xfrm[i]->sel.family == AF_UNSPEC) { |
1576 | inner_mode = xfrm_ip2inner_mode(xfrm[i], | 1584 | inner_mode = xfrm_ip2inner_mode(xfrm[i], |
1577 | xfrm_af2proto(family)); | 1585 | xfrm_af2proto(family)); |
@@ -1583,14 +1591,6 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1583 | } else | 1591 | } else |
1584 | inner_mode = xfrm[i]->inner_mode; | 1592 | inner_mode = xfrm[i]->inner_mode; |
1585 | 1593 | ||
1586 | if (!dst_prev) | ||
1587 | dst0 = dst1; | ||
1588 | else | ||
1589 | /* Ref count is taken during xfrm_alloc_dst() | ||
1590 | * No need to do dst_clone() on dst1 | ||
1591 | */ | ||
1592 | dst_prev->child = dst1; | ||
1593 | |||
1594 | xdst->route = dst; | 1594 | xdst->route = dst; |
1595 | dst_copy_metrics(dst1, dst); | 1595 | dst_copy_metrics(dst1, dst); |
1596 | 1596 | ||
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index b997f1395357..e44a0fed48dd 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1693,32 +1693,34 @@ static int dump_one_policy(struct xfrm_policy *xp, int dir, int count, void *ptr | |||
1693 | 1693 | ||
1694 | static int xfrm_dump_policy_done(struct netlink_callback *cb) | 1694 | static int xfrm_dump_policy_done(struct netlink_callback *cb) |
1695 | { | 1695 | { |
1696 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1]; | 1696 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args; |
1697 | struct net *net = sock_net(cb->skb->sk); | 1697 | struct net *net = sock_net(cb->skb->sk); |
1698 | 1698 | ||
1699 | xfrm_policy_walk_done(walk, net); | 1699 | xfrm_policy_walk_done(walk, net); |
1700 | return 0; | 1700 | return 0; |
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | static int xfrm_dump_policy_start(struct netlink_callback *cb) | ||
1704 | { | ||
1705 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args; | ||
1706 | |||
1707 | BUILD_BUG_ON(sizeof(*walk) > sizeof(cb->args)); | ||
1708 | |||
1709 | xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY); | ||
1710 | return 0; | ||
1711 | } | ||
1712 | |||
1703 | static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb) | 1713 | static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb) |
1704 | { | 1714 | { |
1705 | struct net *net = sock_net(skb->sk); | 1715 | struct net *net = sock_net(skb->sk); |
1706 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1]; | 1716 | struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *)cb->args; |
1707 | struct xfrm_dump_info info; | 1717 | struct xfrm_dump_info info; |
1708 | 1718 | ||
1709 | BUILD_BUG_ON(sizeof(struct xfrm_policy_walk) > | ||
1710 | sizeof(cb->args) - sizeof(cb->args[0])); | ||
1711 | |||
1712 | info.in_skb = cb->skb; | 1719 | info.in_skb = cb->skb; |
1713 | info.out_skb = skb; | 1720 | info.out_skb = skb; |
1714 | info.nlmsg_seq = cb->nlh->nlmsg_seq; | 1721 | info.nlmsg_seq = cb->nlh->nlmsg_seq; |
1715 | info.nlmsg_flags = NLM_F_MULTI; | 1722 | info.nlmsg_flags = NLM_F_MULTI; |
1716 | 1723 | ||
1717 | if (!cb->args[0]) { | ||
1718 | cb->args[0] = 1; | ||
1719 | xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY); | ||
1720 | } | ||
1721 | |||
1722 | (void) xfrm_policy_walk(net, walk, dump_one_policy, &info); | 1724 | (void) xfrm_policy_walk(net, walk, dump_one_policy, &info); |
1723 | 1725 | ||
1724 | return skb->len; | 1726 | return skb->len; |
@@ -2474,6 +2476,7 @@ static const struct nla_policy xfrma_spd_policy[XFRMA_SPD_MAX+1] = { | |||
2474 | 2476 | ||
2475 | static const struct xfrm_link { | 2477 | static const struct xfrm_link { |
2476 | int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **); | 2478 | int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **); |
2479 | int (*start)(struct netlink_callback *); | ||
2477 | int (*dump)(struct sk_buff *, struct netlink_callback *); | 2480 | int (*dump)(struct sk_buff *, struct netlink_callback *); |
2478 | int (*done)(struct netlink_callback *); | 2481 | int (*done)(struct netlink_callback *); |
2479 | const struct nla_policy *nla_pol; | 2482 | const struct nla_policy *nla_pol; |
@@ -2487,6 +2490,7 @@ static const struct xfrm_link { | |||
2487 | [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy }, | 2490 | [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_add_policy }, |
2488 | [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy }, | 2491 | [XFRM_MSG_DELPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy }, |
2489 | [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy, | 2492 | [XFRM_MSG_GETPOLICY - XFRM_MSG_BASE] = { .doit = xfrm_get_policy, |
2493 | .start = xfrm_dump_policy_start, | ||
2490 | .dump = xfrm_dump_policy, | 2494 | .dump = xfrm_dump_policy, |
2491 | .done = xfrm_dump_policy_done }, | 2495 | .done = xfrm_dump_policy_done }, |
2492 | [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi }, | 2496 | [XFRM_MSG_ALLOCSPI - XFRM_MSG_BASE] = { .doit = xfrm_alloc_userspi }, |
@@ -2539,6 +2543,7 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2539 | 2543 | ||
2540 | { | 2544 | { |
2541 | struct netlink_dump_control c = { | 2545 | struct netlink_dump_control c = { |
2546 | .start = link->start, | ||
2542 | .dump = link->dump, | 2547 | .dump = link->dump, |
2543 | .done = link->done, | 2548 | .done = link->done, |
2544 | }; | 2549 | }; |
diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c index 446beb7ac48d..5522692100ba 100644 --- a/samples/trace_events/trace-events-sample.c +++ b/samples/trace_events/trace-events-sample.c | |||
@@ -78,7 +78,7 @@ static int simple_thread_fn(void *arg) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | static DEFINE_MUTEX(thread_mutex); | 80 | static DEFINE_MUTEX(thread_mutex); |
81 | static bool simple_thread_cnt; | 81 | static int simple_thread_cnt; |
82 | 82 | ||
83 | int foo_bar_reg(void) | 83 | int foo_bar_reg(void) |
84 | { | 84 | { |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 16923ba4b5b1..756d14f0d763 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -97,7 +97,6 @@ vmlinux.o: FORCE | |||
97 | $(call cmd,kernel-mod) | 97 | $(call cmd,kernel-mod) |
98 | 98 | ||
99 | # Declare generated files as targets for modpost | 99 | # Declare generated files as targets for modpost |
100 | $(symverfile): __modpost ; | ||
101 | $(modules:.ko=.mod.c): __modpost ; | 100 | $(modules:.ko=.mod.c): __modpost ; |
102 | 101 | ||
103 | 102 | ||
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index c6ad9b1585a1..57263f2f8f2f 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -105,7 +105,6 @@ int main(void) | |||
105 | DEVID_FIELD(input_device_id, sndbit); | 105 | DEVID_FIELD(input_device_id, sndbit); |
106 | DEVID_FIELD(input_device_id, ffbit); | 106 | DEVID_FIELD(input_device_id, ffbit); |
107 | DEVID_FIELD(input_device_id, swbit); | 107 | DEVID_FIELD(input_device_id, swbit); |
108 | DEVID_FIELD(input_device_id, propbit); | ||
109 | 108 | ||
110 | DEVID(eisa_device_id); | 109 | DEVID(eisa_device_id); |
111 | DEVID_FIELD(eisa_device_id, sig); | 110 | DEVID_FIELD(eisa_device_id, sig); |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 2b9395501d81..6ef6e63f96fd 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -761,7 +761,7 @@ static void do_input(char *alias, | |||
761 | sprintf(alias + strlen(alias), "%X,*", i); | 761 | sprintf(alias + strlen(alias), "%X,*", i); |
762 | } | 762 | } |
763 | 763 | ||
764 | /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwXprX where X is comma-separated %02X. */ | 764 | /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ |
765 | static int do_input_entry(const char *filename, void *symval, | 765 | static int do_input_entry(const char *filename, void *symval, |
766 | char *alias) | 766 | char *alias) |
767 | { | 767 | { |
@@ -779,7 +779,6 @@ static int do_input_entry(const char *filename, void *symval, | |||
779 | DEF_FIELD_ADDR(symval, input_device_id, sndbit); | 779 | DEF_FIELD_ADDR(symval, input_device_id, sndbit); |
780 | DEF_FIELD_ADDR(symval, input_device_id, ffbit); | 780 | DEF_FIELD_ADDR(symval, input_device_id, ffbit); |
781 | DEF_FIELD_ADDR(symval, input_device_id, swbit); | 781 | DEF_FIELD_ADDR(symval, input_device_id, swbit); |
782 | DEF_FIELD_ADDR(symval, input_device_id, propbit); | ||
783 | 782 | ||
784 | sprintf(alias, "input:"); | 783 | sprintf(alias, "input:"); |
785 | 784 | ||
@@ -817,9 +816,6 @@ static int do_input_entry(const char *filename, void *symval, | |||
817 | sprintf(alias + strlen(alias), "w*"); | 816 | sprintf(alias + strlen(alias), "w*"); |
818 | if (flags & INPUT_DEVICE_ID_MATCH_SWBIT) | 817 | if (flags & INPUT_DEVICE_ID_MATCH_SWBIT) |
819 | do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX); | 818 | do_input(alias, *swbit, 0, INPUT_DEVICE_ID_SW_MAX); |
820 | sprintf(alias + strlen(alias), "pr*"); | ||
821 | if (flags & INPUT_DEVICE_ID_MATCH_PROPBIT) | ||
822 | do_input(alias, *propbit, 0, INPUT_DEVICE_ID_PROP_MAX); | ||
823 | return 1; | 819 | return 1; |
824 | } | 820 | } |
825 | ADD_TO_DEVTABLE("input", input_device_id, do_input_entry); | 821 | ADD_TO_DEVTABLE("input", input_device_id, do_input_entry); |
diff --git a/security/apparmor/.gitignore b/security/apparmor/.gitignore index d5b291e94264..9cdec70d72b8 100644 --- a/security/apparmor/.gitignore +++ b/security/apparmor/.gitignore | |||
@@ -1,6 +1,5 @@ | |||
1 | # | 1 | # |
2 | # Generated include files | 2 | # Generated include files |
3 | # | 3 | # |
4 | net_names.h | ||
5 | capability_names.h | 4 | capability_names.h |
6 | rlim_names.h | 5 | rlim_names.h |
diff --git a/security/apparmor/Makefile b/security/apparmor/Makefile index dafdd387d42b..81a34426d024 100644 --- a/security/apparmor/Makefile +++ b/security/apparmor/Makefile | |||
@@ -4,44 +4,11 @@ obj-$(CONFIG_SECURITY_APPARMOR) += apparmor.o | |||
4 | 4 | ||
5 | apparmor-y := apparmorfs.o audit.o capability.o context.o ipc.o lib.o match.o \ | 5 | apparmor-y := apparmorfs.o audit.o capability.o context.o ipc.o lib.o match.o \ |
6 | path.o domain.o policy.o policy_unpack.o procattr.o lsm.o \ | 6 | path.o domain.o policy.o policy_unpack.o procattr.o lsm.o \ |
7 | resource.o secid.o file.o policy_ns.o label.o mount.o net.o | 7 | resource.o secid.o file.o policy_ns.o label.o mount.o |
8 | apparmor-$(CONFIG_SECURITY_APPARMOR_HASH) += crypto.o | 8 | apparmor-$(CONFIG_SECURITY_APPARMOR_HASH) += crypto.o |
9 | 9 | ||
10 | clean-files := capability_names.h rlim_names.h net_names.h | 10 | clean-files := capability_names.h rlim_names.h |
11 | 11 | ||
12 | # Build a lower case string table of address family names | ||
13 | # Transform lines from | ||
14 | # #define AF_LOCAL 1 /* POSIX name for AF_UNIX */ | ||
15 | # #define AF_INET 2 /* Internet IP Protocol */ | ||
16 | # to | ||
17 | # [1] = "local", | ||
18 | # [2] = "inet", | ||
19 | # | ||
20 | # and build the securityfs entries for the mapping. | ||
21 | # Transforms lines from | ||
22 | # #define AF_INET 2 /* Internet IP Protocol */ | ||
23 | # to | ||
24 | # #define AA_SFS_AF_MASK "local inet" | ||
25 | quiet_cmd_make-af = GEN $@ | ||
26 | cmd_make-af = echo "static const char *address_family_names[] = {" > $@ ;\ | ||
27 | sed $< >>$@ -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e \ | ||
28 | 's/^\#define[ \t]+AF_([A-Z0-9_]+)[ \t]+([0-9]+)(.*)/[\2] = "\L\1",/p';\ | ||
29 | echo "};" >> $@ ;\ | ||
30 | printf '%s' '\#define AA_SFS_AF_MASK "' >> $@ ;\ | ||
31 | sed -r -n -e "/AF_MAX/d" -e "/AF_LOCAL/d" -e "/AF_ROUTE/d" -e \ | ||
32 | 's/^\#define[ \t]+AF_([A-Z0-9_]+)[ \t]+([0-9]+)(.*)/\L\1/p'\ | ||
33 | $< | tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@ | ||
34 | |||
35 | # Build a lower case string table of sock type names | ||
36 | # Transform lines from | ||
37 | # SOCK_STREAM = 1, | ||
38 | # to | ||
39 | # [1] = "stream", | ||
40 | quiet_cmd_make-sock = GEN $@ | ||
41 | cmd_make-sock = echo "static const char *sock_type_names[] = {" >> $@ ;\ | ||
42 | sed $^ >>$@ -r -n \ | ||
43 | -e 's/^\tSOCK_([A-Z0-9_]+)[\t]+=[ \t]+([0-9]+)(.*)/[\2] = "\L\1",/p';\ | ||
44 | echo "};" >> $@ | ||
45 | 12 | ||
46 | # Build a lower case string table of capability names | 13 | # Build a lower case string table of capability names |
47 | # Transforms lines from | 14 | # Transforms lines from |
@@ -94,7 +61,6 @@ cmd_make-rlim = echo "static const char *const rlim_names[RLIM_NLIMITS] = {" \ | |||
94 | tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@ | 61 | tr '\n' ' ' | sed -e 's/ $$/"\n/' >> $@ |
95 | 62 | ||
96 | $(obj)/capability.o : $(obj)/capability_names.h | 63 | $(obj)/capability.o : $(obj)/capability_names.h |
97 | $(obj)/net.o : $(obj)/net_names.h | ||
98 | $(obj)/resource.o : $(obj)/rlim_names.h | 64 | $(obj)/resource.o : $(obj)/rlim_names.h |
99 | $(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h \ | 65 | $(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h \ |
100 | $(src)/Makefile | 66 | $(src)/Makefile |
@@ -102,8 +68,3 @@ $(obj)/capability_names.h : $(srctree)/include/uapi/linux/capability.h \ | |||
102 | $(obj)/rlim_names.h : $(srctree)/include/uapi/asm-generic/resource.h \ | 68 | $(obj)/rlim_names.h : $(srctree)/include/uapi/asm-generic/resource.h \ |
103 | $(src)/Makefile | 69 | $(src)/Makefile |
104 | $(call cmd,make-rlim) | 70 | $(call cmd,make-rlim) |
105 | $(obj)/net_names.h : $(srctree)/include/linux/socket.h \ | ||
106 | $(srctree)/include/linux/net.h \ | ||
107 | $(src)/Makefile | ||
108 | $(call cmd,make-af) | ||
109 | $(call cmd,make-sock) | ||
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 518d5928661b..caaf51dda648 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c | |||
@@ -2202,7 +2202,6 @@ static struct aa_sfs_entry aa_sfs_entry_features[] = { | |||
2202 | AA_SFS_DIR("policy", aa_sfs_entry_policy), | 2202 | AA_SFS_DIR("policy", aa_sfs_entry_policy), |
2203 | AA_SFS_DIR("domain", aa_sfs_entry_domain), | 2203 | AA_SFS_DIR("domain", aa_sfs_entry_domain), |
2204 | AA_SFS_DIR("file", aa_sfs_entry_file), | 2204 | AA_SFS_DIR("file", aa_sfs_entry_file), |
2205 | AA_SFS_DIR("network", aa_sfs_entry_network), | ||
2206 | AA_SFS_DIR("mount", aa_sfs_entry_mount), | 2205 | AA_SFS_DIR("mount", aa_sfs_entry_mount), |
2207 | AA_SFS_DIR("namespaces", aa_sfs_entry_ns), | 2206 | AA_SFS_DIR("namespaces", aa_sfs_entry_ns), |
2208 | AA_SFS_FILE_U64("capability", VFS_CAP_FLAGS_MASK), | 2207 | AA_SFS_FILE_U64("capability", VFS_CAP_FLAGS_MASK), |
diff --git a/security/apparmor/file.c b/security/apparmor/file.c index db80221891c6..3382518b87fa 100644 --- a/security/apparmor/file.c +++ b/security/apparmor/file.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include "include/context.h" | 21 | #include "include/context.h" |
22 | #include "include/file.h" | 22 | #include "include/file.h" |
23 | #include "include/match.h" | 23 | #include "include/match.h" |
24 | #include "include/net.h" | ||
25 | #include "include/path.h" | 24 | #include "include/path.h" |
26 | #include "include/policy.h" | 25 | #include "include/policy.h" |
27 | #include "include/label.h" | 26 | #include "include/label.h" |
@@ -567,32 +566,6 @@ static int __file_path_perm(const char *op, struct aa_label *label, | |||
567 | return error; | 566 | return error; |
568 | } | 567 | } |
569 | 568 | ||
570 | static int __file_sock_perm(const char *op, struct aa_label *label, | ||
571 | struct aa_label *flabel, struct file *file, | ||
572 | u32 request, u32 denied) | ||
573 | { | ||
574 | struct socket *sock = (struct socket *) file->private_data; | ||
575 | int error; | ||
576 | |||
577 | AA_BUG(!sock); | ||
578 | |||
579 | /* revalidation due to label out of date. No revocation at this time */ | ||
580 | if (!denied && aa_label_is_subset(flabel, label)) | ||
581 | return 0; | ||
582 | |||
583 | /* TODO: improve to skip profiles cached in flabel */ | ||
584 | error = aa_sock_file_perm(label, op, request, sock); | ||
585 | if (denied) { | ||
586 | /* TODO: improve to skip profiles checked above */ | ||
587 | /* check every profile in file label to is cached */ | ||
588 | last_error(error, aa_sock_file_perm(flabel, op, request, sock)); | ||
589 | } | ||
590 | if (!error) | ||
591 | update_file_ctx(file_ctx(file), label, request); | ||
592 | |||
593 | return error; | ||
594 | } | ||
595 | |||
596 | /** | 569 | /** |
597 | * aa_file_perm - do permission revalidation check & audit for @file | 570 | * aa_file_perm - do permission revalidation check & audit for @file |
598 | * @op: operation being checked | 571 | * @op: operation being checked |
@@ -637,9 +610,6 @@ int aa_file_perm(const char *op, struct aa_label *label, struct file *file, | |||
637 | error = __file_path_perm(op, label, flabel, file, request, | 610 | error = __file_path_perm(op, label, flabel, file, request, |
638 | denied); | 611 | denied); |
639 | 612 | ||
640 | else if (S_ISSOCK(file_inode(file)->i_mode)) | ||
641 | error = __file_sock_perm(op, label, flabel, file, request, | ||
642 | denied); | ||
643 | done: | 613 | done: |
644 | rcu_read_unlock(); | 614 | rcu_read_unlock(); |
645 | 615 | ||
diff --git a/security/apparmor/include/audit.h b/security/apparmor/include/audit.h index ff4316e1068d..620e81169659 100644 --- a/security/apparmor/include/audit.h +++ b/security/apparmor/include/audit.h | |||
@@ -121,29 +121,21 @@ struct apparmor_audit_data { | |||
121 | /* these entries require a custom callback fn */ | 121 | /* these entries require a custom callback fn */ |
122 | struct { | 122 | struct { |
123 | struct aa_label *peer; | 123 | struct aa_label *peer; |
124 | union { | 124 | struct { |
125 | struct { | 125 | const char *target; |
126 | kuid_t ouid; | 126 | kuid_t ouid; |
127 | const char *target; | 127 | } fs; |
128 | } fs; | ||
129 | struct { | ||
130 | int type, protocol; | ||
131 | struct sock *peer_sk; | ||
132 | void *addr; | ||
133 | int addrlen; | ||
134 | } net; | ||
135 | int signal; | ||
136 | struct { | ||
137 | int rlim; | ||
138 | unsigned long max; | ||
139 | } rlim; | ||
140 | }; | ||
141 | }; | 128 | }; |
142 | struct { | 129 | struct { |
143 | struct aa_profile *profile; | 130 | struct aa_profile *profile; |
144 | const char *ns; | 131 | const char *ns; |
145 | long pos; | 132 | long pos; |
146 | } iface; | 133 | } iface; |
134 | int signal; | ||
135 | struct { | ||
136 | int rlim; | ||
137 | unsigned long max; | ||
138 | } rlim; | ||
147 | struct { | 139 | struct { |
148 | const char *src_name; | 140 | const char *src_name; |
149 | const char *type; | 141 | const char *type; |
diff --git a/security/apparmor/include/net.h b/security/apparmor/include/net.h deleted file mode 100644 index 140c8efcf364..000000000000 --- a/security/apparmor/include/net.h +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /* | ||
2 | * AppArmor security module | ||
3 | * | ||
4 | * This file contains AppArmor network mediation definitions. | ||
5 | * | ||
6 | * Copyright (C) 1998-2008 Novell/SUSE | ||
7 | * Copyright 2009-2017 Canonical Ltd. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License as | ||
11 | * published by the Free Software Foundation, version 2 of the | ||
12 | * License. | ||
13 | */ | ||
14 | |||
15 | #ifndef __AA_NET_H | ||
16 | #define __AA_NET_H | ||
17 | |||
18 | #include <net/sock.h> | ||
19 | #include <linux/path.h> | ||
20 | |||
21 | #include "apparmorfs.h" | ||
22 | #include "label.h" | ||
23 | #include "perms.h" | ||
24 | #include "policy.h" | ||
25 | |||
26 | #define AA_MAY_SEND AA_MAY_WRITE | ||
27 | #define AA_MAY_RECEIVE AA_MAY_READ | ||
28 | |||
29 | #define AA_MAY_SHUTDOWN AA_MAY_DELETE | ||
30 | |||
31 | #define AA_MAY_CONNECT AA_MAY_OPEN | ||
32 | #define AA_MAY_ACCEPT 0x00100000 | ||
33 | |||
34 | #define AA_MAY_BIND 0x00200000 | ||
35 | #define AA_MAY_LISTEN 0x00400000 | ||
36 | |||
37 | #define AA_MAY_SETOPT 0x01000000 | ||
38 | #define AA_MAY_GETOPT 0x02000000 | ||
39 | |||
40 | #define NET_PERMS_MASK (AA_MAY_SEND | AA_MAY_RECEIVE | AA_MAY_CREATE | \ | ||
41 | AA_MAY_SHUTDOWN | AA_MAY_BIND | AA_MAY_LISTEN | \ | ||
42 | AA_MAY_CONNECT | AA_MAY_ACCEPT | AA_MAY_SETATTR | \ | ||
43 | AA_MAY_GETATTR | AA_MAY_SETOPT | AA_MAY_GETOPT) | ||
44 | |||
45 | #define NET_FS_PERMS (AA_MAY_SEND | AA_MAY_RECEIVE | AA_MAY_CREATE | \ | ||
46 | AA_MAY_SHUTDOWN | AA_MAY_CONNECT | AA_MAY_RENAME |\ | ||
47 | AA_MAY_SETATTR | AA_MAY_GETATTR | AA_MAY_CHMOD | \ | ||
48 | AA_MAY_CHOWN | AA_MAY_CHGRP | AA_MAY_LOCK | \ | ||
49 | AA_MAY_MPROT) | ||
50 | |||
51 | #define NET_PEER_MASK (AA_MAY_SEND | AA_MAY_RECEIVE | AA_MAY_CONNECT | \ | ||
52 | AA_MAY_ACCEPT) | ||
53 | struct aa_sk_ctx { | ||
54 | struct aa_label *label; | ||
55 | struct aa_label *peer; | ||
56 | struct path path; | ||
57 | }; | ||
58 | |||
59 | #define SK_CTX(X) ((X)->sk_security) | ||
60 | #define SOCK_ctx(X) SOCK_INODE(X)->i_security | ||
61 | #define DEFINE_AUDIT_NET(NAME, OP, SK, F, T, P) \ | ||
62 | struct lsm_network_audit NAME ## _net = { .sk = (SK), \ | ||
63 | .family = (F)}; \ | ||
64 | DEFINE_AUDIT_DATA(NAME, \ | ||
65 | ((SK) && (F) != AF_UNIX) ? LSM_AUDIT_DATA_NET : \ | ||
66 | LSM_AUDIT_DATA_NONE, \ | ||
67 | OP); \ | ||
68 | NAME.u.net = &(NAME ## _net); \ | ||
69 | aad(&NAME)->net.type = (T); \ | ||
70 | aad(&NAME)->net.protocol = (P) | ||
71 | |||
72 | #define DEFINE_AUDIT_SK(NAME, OP, SK) \ | ||
73 | DEFINE_AUDIT_NET(NAME, OP, SK, (SK)->sk_family, (SK)->sk_type, \ | ||
74 | (SK)->sk_protocol) | ||
75 | |||
76 | /* struct aa_net - network confinement data | ||
77 | * @allow: basic network families permissions | ||
78 | * @audit: which network permissions to force audit | ||
79 | * @quiet: which network permissions to quiet rejects | ||
80 | */ | ||
81 | struct aa_net { | ||
82 | u16 allow[AF_MAX]; | ||
83 | u16 audit[AF_MAX]; | ||
84 | u16 quiet[AF_MAX]; | ||
85 | }; | ||
86 | |||
87 | |||
88 | extern struct aa_sfs_entry aa_sfs_entry_network[]; | ||
89 | |||
90 | void audit_net_cb(struct audit_buffer *ab, void *va); | ||
91 | int aa_profile_af_perm(struct aa_profile *profile, struct common_audit_data *sa, | ||
92 | u32 request, u16 family, int type); | ||
93 | int aa_af_perm(struct aa_label *label, const char *op, u32 request, u16 family, | ||
94 | int type, int protocol); | ||
95 | static inline int aa_profile_af_sk_perm(struct aa_profile *profile, | ||
96 | struct common_audit_data *sa, | ||
97 | u32 request, | ||
98 | struct sock *sk) | ||
99 | { | ||
100 | return aa_profile_af_perm(profile, sa, request, sk->sk_family, | ||
101 | sk->sk_type); | ||
102 | } | ||
103 | int aa_sk_perm(const char *op, u32 request, struct sock *sk); | ||
104 | |||
105 | int aa_sock_file_perm(struct aa_label *label, const char *op, u32 request, | ||
106 | struct socket *sock); | ||
107 | |||
108 | |||
109 | static inline void aa_free_net_rules(struct aa_net *new) | ||
110 | { | ||
111 | /* NOP */ | ||
112 | } | ||
113 | |||
114 | #endif /* __AA_NET_H */ | ||
diff --git a/security/apparmor/include/perms.h b/security/apparmor/include/perms.h index af04d5a7d73d..2b27bb79aec4 100644 --- a/security/apparmor/include/perms.h +++ b/security/apparmor/include/perms.h | |||
@@ -135,10 +135,9 @@ extern struct aa_perms allperms; | |||
135 | 135 | ||
136 | 136 | ||
137 | void aa_perm_mask_to_str(char *str, const char *chrs, u32 mask); | 137 | void aa_perm_mask_to_str(char *str, const char *chrs, u32 mask); |
138 | void aa_audit_perm_names(struct audit_buffer *ab, const char * const *names, | 138 | void aa_audit_perm_names(struct audit_buffer *ab, const char **names, u32 mask); |
139 | u32 mask); | ||
140 | void aa_audit_perm_mask(struct audit_buffer *ab, u32 mask, const char *chrs, | 139 | void aa_audit_perm_mask(struct audit_buffer *ab, u32 mask, const char *chrs, |
141 | u32 chrsmask, const char * const *names, u32 namesmask); | 140 | u32 chrsmask, const char **names, u32 namesmask); |
142 | void aa_apply_modes_to_perms(struct aa_profile *profile, | 141 | void aa_apply_modes_to_perms(struct aa_profile *profile, |
143 | struct aa_perms *perms); | 142 | struct aa_perms *perms); |
144 | void aa_compute_perms(struct aa_dfa *dfa, unsigned int state, | 143 | void aa_compute_perms(struct aa_dfa *dfa, unsigned int state, |
diff --git a/security/apparmor/include/policy.h b/security/apparmor/include/policy.h index 4364088a0b9e..17fe41a9cac3 100644 --- a/security/apparmor/include/policy.h +++ b/security/apparmor/include/policy.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #include "file.h" | 30 | #include "file.h" |
31 | #include "lib.h" | 31 | #include "lib.h" |
32 | #include "label.h" | 32 | #include "label.h" |
33 | #include "net.h" | ||
34 | #include "perms.h" | 33 | #include "perms.h" |
35 | #include "resource.h" | 34 | #include "resource.h" |
36 | 35 | ||
@@ -112,7 +111,6 @@ struct aa_data { | |||
112 | * @policy: general match rules governing policy | 111 | * @policy: general match rules governing policy |
113 | * @file: The set of rules governing basic file access and domain transitions | 112 | * @file: The set of rules governing basic file access and domain transitions |
114 | * @caps: capabilities for the profile | 113 | * @caps: capabilities for the profile |
115 | * @net: network controls for the profile | ||
116 | * @rlimits: rlimits for the profile | 114 | * @rlimits: rlimits for the profile |
117 | * | 115 | * |
118 | * @dents: dentries for the profiles file entries in apparmorfs | 116 | * @dents: dentries for the profiles file entries in apparmorfs |
@@ -150,7 +148,6 @@ struct aa_profile { | |||
150 | struct aa_policydb policy; | 148 | struct aa_policydb policy; |
151 | struct aa_file_rules file; | 149 | struct aa_file_rules file; |
152 | struct aa_caps caps; | 150 | struct aa_caps caps; |
153 | struct aa_net net; | ||
154 | struct aa_rlimit rlimits; | 151 | struct aa_rlimit rlimits; |
155 | 152 | ||
156 | struct aa_loaddata *rawdata; | 153 | struct aa_loaddata *rawdata; |
@@ -223,16 +220,6 @@ static inline unsigned int PROFILE_MEDIATES_SAFE(struct aa_profile *profile, | |||
223 | return 0; | 220 | return 0; |
224 | } | 221 | } |
225 | 222 | ||
226 | static inline unsigned int PROFILE_MEDIATES_AF(struct aa_profile *profile, | ||
227 | u16 AF) { | ||
228 | unsigned int state = PROFILE_MEDIATES(profile, AA_CLASS_NET); | ||
229 | u16 be_af = cpu_to_be16(AF); | ||
230 | |||
231 | if (!state) | ||
232 | return 0; | ||
233 | return aa_dfa_match_len(profile->policy.dfa, state, (char *) &be_af, 2); | ||
234 | } | ||
235 | |||
236 | /** | 223 | /** |
237 | * aa_get_profile - increment refcount on profile @p | 224 | * aa_get_profile - increment refcount on profile @p |
238 | * @p: profile (MAYBE NULL) | 225 | * @p: profile (MAYBE NULL) |
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c index 8818621b5d95..08ca26bcca77 100644 --- a/security/apparmor/lib.c +++ b/security/apparmor/lib.c | |||
@@ -211,8 +211,7 @@ void aa_perm_mask_to_str(char *str, const char *chrs, u32 mask) | |||
211 | *str = '\0'; | 211 | *str = '\0'; |
212 | } | 212 | } |
213 | 213 | ||
214 | void aa_audit_perm_names(struct audit_buffer *ab, const char * const *names, | 214 | void aa_audit_perm_names(struct audit_buffer *ab, const char **names, u32 mask) |
215 | u32 mask) | ||
216 | { | 215 | { |
217 | const char *fmt = "%s"; | 216 | const char *fmt = "%s"; |
218 | unsigned int i, perm = 1; | 217 | unsigned int i, perm = 1; |
@@ -230,7 +229,7 @@ void aa_audit_perm_names(struct audit_buffer *ab, const char * const *names, | |||
230 | } | 229 | } |
231 | 230 | ||
232 | void aa_audit_perm_mask(struct audit_buffer *ab, u32 mask, const char *chrs, | 231 | void aa_audit_perm_mask(struct audit_buffer *ab, u32 mask, const char *chrs, |
233 | u32 chrsmask, const char * const *names, u32 namesmask) | 232 | u32 chrsmask, const char **names, u32 namesmask) |
234 | { | 233 | { |
235 | char str[33]; | 234 | char str[33]; |
236 | 235 | ||
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index 72b915dfcaf7..1346ee5be04f 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "include/context.h" | 33 | #include "include/context.h" |
34 | #include "include/file.h" | 34 | #include "include/file.h" |
35 | #include "include/ipc.h" | 35 | #include "include/ipc.h" |
36 | #include "include/net.h" | ||
37 | #include "include/path.h" | 36 | #include "include/path.h" |
38 | #include "include/label.h" | 37 | #include "include/label.h" |
39 | #include "include/policy.h" | 38 | #include "include/policy.h" |
@@ -737,368 +736,6 @@ static int apparmor_task_kill(struct task_struct *target, struct siginfo *info, | |||
737 | return error; | 736 | return error; |
738 | } | 737 | } |
739 | 738 | ||
740 | /** | ||
741 | * apparmor_sk_alloc_security - allocate and attach the sk_security field | ||
742 | */ | ||
743 | static int apparmor_sk_alloc_security(struct sock *sk, int family, gfp_t flags) | ||
744 | { | ||
745 | struct aa_sk_ctx *ctx; | ||
746 | |||
747 | ctx = kzalloc(sizeof(*ctx), flags); | ||
748 | if (!ctx) | ||
749 | return -ENOMEM; | ||
750 | |||
751 | SK_CTX(sk) = ctx; | ||
752 | |||
753 | return 0; | ||
754 | } | ||
755 | |||
756 | /** | ||
757 | * apparmor_sk_free_security - free the sk_security field | ||
758 | */ | ||
759 | static void apparmor_sk_free_security(struct sock *sk) | ||
760 | { | ||
761 | struct aa_sk_ctx *ctx = SK_CTX(sk); | ||
762 | |||
763 | SK_CTX(sk) = NULL; | ||
764 | aa_put_label(ctx->label); | ||
765 | aa_put_label(ctx->peer); | ||
766 | path_put(&ctx->path); | ||
767 | kfree(ctx); | ||
768 | } | ||
769 | |||
770 | /** | ||
771 | * apparmor_clone_security - clone the sk_security field | ||
772 | */ | ||
773 | static void apparmor_sk_clone_security(const struct sock *sk, | ||
774 | struct sock *newsk) | ||
775 | { | ||
776 | struct aa_sk_ctx *ctx = SK_CTX(sk); | ||
777 | struct aa_sk_ctx *new = SK_CTX(newsk); | ||
778 | |||
779 | new->label = aa_get_label(ctx->label); | ||
780 | new->peer = aa_get_label(ctx->peer); | ||
781 | new->path = ctx->path; | ||
782 | path_get(&new->path); | ||
783 | } | ||
784 | |||
785 | static int aa_sock_create_perm(struct aa_label *label, int family, int type, | ||
786 | int protocol) | ||
787 | { | ||
788 | AA_BUG(!label); | ||
789 | AA_BUG(in_interrupt()); | ||
790 | |||
791 | return aa_af_perm(label, OP_CREATE, AA_MAY_CREATE, family, type, | ||
792 | protocol); | ||
793 | } | ||
794 | |||
795 | |||
796 | /** | ||
797 | * apparmor_socket_create - check perms before creating a new socket | ||
798 | */ | ||
799 | static int apparmor_socket_create(int family, int type, int protocol, int kern) | ||
800 | { | ||
801 | struct aa_label *label; | ||
802 | int error = 0; | ||
803 | |||
804 | label = begin_current_label_crit_section(); | ||
805 | if (!(kern || unconfined(label))) | ||
806 | error = aa_sock_create_perm(label, family, type, protocol); | ||
807 | end_current_label_crit_section(label); | ||
808 | |||
809 | return error; | ||
810 | } | ||
811 | |||
812 | /** | ||
813 | * apparmor_socket_post_create - setup the per-socket security struct | ||
814 | * | ||
815 | * Note: | ||
816 | * - kernel sockets currently labeled unconfined but we may want to | ||
817 | * move to a special kernel label | ||
818 | * - socket may not have sk here if created with sock_create_lite or | ||
819 | * sock_alloc. These should be accept cases which will be handled in | ||
820 | * sock_graft. | ||
821 | */ | ||
822 | static int apparmor_socket_post_create(struct socket *sock, int family, | ||
823 | int type, int protocol, int kern) | ||
824 | { | ||
825 | struct aa_label *label; | ||
826 | |||
827 | if (kern) { | ||
828 | struct aa_ns *ns = aa_get_current_ns(); | ||
829 | |||
830 | label = aa_get_label(ns_unconfined(ns)); | ||
831 | aa_put_ns(ns); | ||
832 | } else | ||
833 | label = aa_get_current_label(); | ||
834 | |||
835 | if (sock->sk) { | ||
836 | struct aa_sk_ctx *ctx = SK_CTX(sock->sk); | ||
837 | |||
838 | aa_put_label(ctx->label); | ||
839 | ctx->label = aa_get_label(label); | ||
840 | } | ||
841 | aa_put_label(label); | ||
842 | |||
843 | return 0; | ||
844 | } | ||
845 | |||
846 | /** | ||
847 | * apparmor_socket_bind - check perms before bind addr to socket | ||
848 | */ | ||
849 | static int apparmor_socket_bind(struct socket *sock, | ||
850 | struct sockaddr *address, int addrlen) | ||
851 | { | ||
852 | AA_BUG(!sock); | ||
853 | AA_BUG(!sock->sk); | ||
854 | AA_BUG(!address); | ||
855 | AA_BUG(in_interrupt()); | ||
856 | |||
857 | return aa_sk_perm(OP_BIND, AA_MAY_BIND, sock->sk); | ||
858 | } | ||
859 | |||
860 | /** | ||
861 | * apparmor_socket_connect - check perms before connecting @sock to @address | ||
862 | */ | ||
863 | static int apparmor_socket_connect(struct socket *sock, | ||
864 | struct sockaddr *address, int addrlen) | ||
865 | { | ||
866 | AA_BUG(!sock); | ||
867 | AA_BUG(!sock->sk); | ||
868 | AA_BUG(!address); | ||
869 | AA_BUG(in_interrupt()); | ||
870 | |||
871 | return aa_sk_perm(OP_CONNECT, AA_MAY_CONNECT, sock->sk); | ||
872 | } | ||
873 | |||
874 | /** | ||
875 | * apparmor_socket_list - check perms before allowing listen | ||
876 | */ | ||
877 | static int apparmor_socket_listen(struct socket *sock, int backlog) | ||
878 | { | ||
879 | AA_BUG(!sock); | ||
880 | AA_BUG(!sock->sk); | ||
881 | AA_BUG(in_interrupt()); | ||
882 | |||
883 | return aa_sk_perm(OP_LISTEN, AA_MAY_LISTEN, sock->sk); | ||
884 | } | ||
885 | |||
886 | /** | ||
887 | * apparmor_socket_accept - check perms before accepting a new connection. | ||
888 | * | ||
889 | * Note: while @newsock is created and has some information, the accept | ||
890 | * has not been done. | ||
891 | */ | ||
892 | static int apparmor_socket_accept(struct socket *sock, struct socket *newsock) | ||
893 | { | ||
894 | AA_BUG(!sock); | ||
895 | AA_BUG(!sock->sk); | ||
896 | AA_BUG(!newsock); | ||
897 | AA_BUG(in_interrupt()); | ||
898 | |||
899 | return aa_sk_perm(OP_ACCEPT, AA_MAY_ACCEPT, sock->sk); | ||
900 | } | ||
901 | |||
902 | static int aa_sock_msg_perm(const char *op, u32 request, struct socket *sock, | ||
903 | struct msghdr *msg, int size) | ||
904 | { | ||
905 | AA_BUG(!sock); | ||
906 | AA_BUG(!sock->sk); | ||
907 | AA_BUG(!msg); | ||
908 | AA_BUG(in_interrupt()); | ||
909 | |||
910 | return aa_sk_perm(op, request, sock->sk); | ||
911 | } | ||
912 | |||
913 | /** | ||
914 | * apparmor_socket_sendmsg - check perms before sending msg to another socket | ||
915 | */ | ||
916 | static int apparmor_socket_sendmsg(struct socket *sock, | ||
917 | struct msghdr *msg, int size) | ||
918 | { | ||
919 | return aa_sock_msg_perm(OP_SENDMSG, AA_MAY_SEND, sock, msg, size); | ||
920 | } | ||
921 | |||
922 | /** | ||
923 | * apparmor_socket_recvmsg - check perms before receiving a message | ||
924 | */ | ||
925 | static int apparmor_socket_recvmsg(struct socket *sock, | ||
926 | struct msghdr *msg, int size, int flags) | ||
927 | { | ||
928 | return aa_sock_msg_perm(OP_RECVMSG, AA_MAY_RECEIVE, sock, msg, size); | ||
929 | } | ||
930 | |||
931 | /* revaliation, get/set attr, shutdown */ | ||
932 | static int aa_sock_perm(const char *op, u32 request, struct socket *sock) | ||
933 | { | ||
934 | AA_BUG(!sock); | ||
935 | AA_BUG(!sock->sk); | ||
936 | AA_BUG(in_interrupt()); | ||
937 | |||
938 | return aa_sk_perm(op, request, sock->sk); | ||
939 | } | ||
940 | |||
941 | /** | ||
942 | * apparmor_socket_getsockname - check perms before getting the local address | ||
943 | */ | ||
944 | static int apparmor_socket_getsockname(struct socket *sock) | ||
945 | { | ||
946 | return aa_sock_perm(OP_GETSOCKNAME, AA_MAY_GETATTR, sock); | ||
947 | } | ||
948 | |||
949 | /** | ||
950 | * apparmor_socket_getpeername - check perms before getting remote address | ||
951 | */ | ||
952 | static int apparmor_socket_getpeername(struct socket *sock) | ||
953 | { | ||
954 | return aa_sock_perm(OP_GETPEERNAME, AA_MAY_GETATTR, sock); | ||
955 | } | ||
956 | |||
957 | /* revaliation, get/set attr, opt */ | ||
958 | static int aa_sock_opt_perm(const char *op, u32 request, struct socket *sock, | ||
959 | int level, int optname) | ||
960 | { | ||
961 | AA_BUG(!sock); | ||
962 | AA_BUG(!sock->sk); | ||
963 | AA_BUG(in_interrupt()); | ||
964 | |||
965 | return aa_sk_perm(op, request, sock->sk); | ||
966 | } | ||
967 | |||
968 | /** | ||
969 | * apparmor_getsockopt - check perms before getting socket options | ||
970 | */ | ||
971 | static int apparmor_socket_getsockopt(struct socket *sock, int level, | ||
972 | int optname) | ||
973 | { | ||
974 | return aa_sock_opt_perm(OP_GETSOCKOPT, AA_MAY_GETOPT, sock, | ||
975 | level, optname); | ||
976 | } | ||
977 | |||
978 | /** | ||
979 | * apparmor_setsockopt - check perms before setting socket options | ||
980 | */ | ||
981 | static int apparmor_socket_setsockopt(struct socket *sock, int level, | ||
982 | int optname) | ||
983 | { | ||
984 | return aa_sock_opt_perm(OP_SETSOCKOPT, AA_MAY_SETOPT, sock, | ||
985 | level, optname); | ||
986 | } | ||
987 | |||
988 | /** | ||
989 | * apparmor_socket_shutdown - check perms before shutting down @sock conn | ||
990 | */ | ||
991 | static int apparmor_socket_shutdown(struct socket *sock, int how) | ||
992 | { | ||
993 | return aa_sock_perm(OP_SHUTDOWN, AA_MAY_SHUTDOWN, sock); | ||
994 | } | ||
995 | |||
996 | /** | ||
997 | * apparmor_socket_sock_recv_skb - check perms before associating skb to sk | ||
998 | * | ||
999 | * Note: can not sleep may be called with locks held | ||
1000 | * | ||
1001 | * dont want protocol specific in __skb_recv_datagram() | ||
1002 | * to deny an incoming connection socket_sock_rcv_skb() | ||
1003 | */ | ||
1004 | static int apparmor_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) | ||
1005 | { | ||
1006 | return 0; | ||
1007 | } | ||
1008 | |||
1009 | |||
1010 | static struct aa_label *sk_peer_label(struct sock *sk) | ||
1011 | { | ||
1012 | struct aa_sk_ctx *ctx = SK_CTX(sk); | ||
1013 | |||
1014 | if (ctx->peer) | ||
1015 | return ctx->peer; | ||
1016 | |||
1017 | return ERR_PTR(-ENOPROTOOPT); | ||
1018 | } | ||
1019 | |||
1020 | /** | ||
1021 | * apparmor_socket_getpeersec_stream - get security context of peer | ||
1022 | * | ||
1023 | * Note: for tcp only valid if using ipsec or cipso on lan | ||
1024 | */ | ||
1025 | static int apparmor_socket_getpeersec_stream(struct socket *sock, | ||
1026 | char __user *optval, | ||
1027 | int __user *optlen, | ||
1028 | unsigned int len) | ||
1029 | { | ||
1030 | char *name; | ||
1031 | int slen, error = 0; | ||
1032 | struct aa_label *label; | ||
1033 | struct aa_label *peer; | ||
1034 | |||
1035 | label = begin_current_label_crit_section(); | ||
1036 | peer = sk_peer_label(sock->sk); | ||
1037 | if (IS_ERR(peer)) { | ||
1038 | error = PTR_ERR(peer); | ||
1039 | goto done; | ||
1040 | } | ||
1041 | slen = aa_label_asxprint(&name, labels_ns(label), peer, | ||
1042 | FLAG_SHOW_MODE | FLAG_VIEW_SUBNS | | ||
1043 | FLAG_HIDDEN_UNCONFINED, GFP_KERNEL); | ||
1044 | /* don't include terminating \0 in slen, it breaks some apps */ | ||
1045 | if (slen < 0) { | ||
1046 | error = -ENOMEM; | ||
1047 | } else { | ||
1048 | if (slen > len) { | ||
1049 | error = -ERANGE; | ||
1050 | } else if (copy_to_user(optval, name, slen)) { | ||
1051 | error = -EFAULT; | ||
1052 | goto out; | ||
1053 | } | ||
1054 | if (put_user(slen, optlen)) | ||
1055 | error = -EFAULT; | ||
1056 | out: | ||
1057 | kfree(name); | ||
1058 | |||
1059 | } | ||
1060 | |||
1061 | done: | ||
1062 | end_current_label_crit_section(label); | ||
1063 | |||
1064 | return error; | ||
1065 | } | ||
1066 | |||
1067 | /** | ||
1068 | * apparmor_socket_getpeersec_dgram - get security label of packet | ||
1069 | * @sock: the peer socket | ||
1070 | * @skb: packet data | ||
1071 | * @secid: pointer to where to put the secid of the packet | ||
1072 | * | ||
1073 | * Sets the netlabel socket state on sk from parent | ||
1074 | */ | ||
1075 | static int apparmor_socket_getpeersec_dgram(struct socket *sock, | ||
1076 | struct sk_buff *skb, u32 *secid) | ||
1077 | |||
1078 | { | ||
1079 | /* TODO: requires secid support */ | ||
1080 | return -ENOPROTOOPT; | ||
1081 | } | ||
1082 | |||
1083 | /** | ||
1084 | * apparmor_sock_graft - Initialize newly created socket | ||
1085 | * @sk: child sock | ||
1086 | * @parent: parent socket | ||
1087 | * | ||
1088 | * Note: could set off of SOCK_CTX(parent) but need to track inode and we can | ||
1089 | * just set sk security information off of current creating process label | ||
1090 | * Labeling of sk for accept case - probably should be sock based | ||
1091 | * instead of task, because of the case where an implicitly labeled | ||
1092 | * socket is shared by different tasks. | ||
1093 | */ | ||
1094 | static void apparmor_sock_graft(struct sock *sk, struct socket *parent) | ||
1095 | { | ||
1096 | struct aa_sk_ctx *ctx = SK_CTX(sk); | ||
1097 | |||
1098 | if (!ctx->label) | ||
1099 | ctx->label = aa_get_current_label(); | ||
1100 | } | ||
1101 | |||
1102 | static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = { | 739 | static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = { |
1103 | LSM_HOOK_INIT(ptrace_access_check, apparmor_ptrace_access_check), | 740 | LSM_HOOK_INIT(ptrace_access_check, apparmor_ptrace_access_check), |
1104 | LSM_HOOK_INIT(ptrace_traceme, apparmor_ptrace_traceme), | 741 | LSM_HOOK_INIT(ptrace_traceme, apparmor_ptrace_traceme), |
@@ -1133,30 +770,6 @@ static struct security_hook_list apparmor_hooks[] __lsm_ro_after_init = { | |||
1133 | LSM_HOOK_INIT(getprocattr, apparmor_getprocattr), | 770 | LSM_HOOK_INIT(getprocattr, apparmor_getprocattr), |
1134 | LSM_HOOK_INIT(setprocattr, apparmor_setprocattr), | 771 | LSM_HOOK_INIT(setprocattr, apparmor_setprocattr), |
1135 | 772 | ||
1136 | LSM_HOOK_INIT(sk_alloc_security, apparmor_sk_alloc_security), | ||
1137 | LSM_HOOK_INIT(sk_free_security, apparmor_sk_free_security), | ||
1138 | LSM_HOOK_INIT(sk_clone_security, apparmor_sk_clone_security), | ||
1139 | |||
1140 | LSM_HOOK_INIT(socket_create, apparmor_socket_create), | ||
1141 | LSM_HOOK_INIT(socket_post_create, apparmor_socket_post_create), | ||
1142 | LSM_HOOK_INIT(socket_bind, apparmor_socket_bind), | ||
1143 | LSM_HOOK_INIT(socket_connect, apparmor_socket_connect), | ||
1144 | LSM_HOOK_INIT(socket_listen, apparmor_socket_listen), | ||
1145 | LSM_HOOK_INIT(socket_accept, apparmor_socket_accept), | ||
1146 | LSM_HOOK_INIT(socket_sendmsg, apparmor_socket_sendmsg), | ||
1147 | LSM_HOOK_INIT(socket_recvmsg, apparmor_socket_recvmsg), | ||
1148 | LSM_HOOK_INIT(socket_getsockname, apparmor_socket_getsockname), | ||
1149 | LSM_HOOK_INIT(socket_getpeername, apparmor_socket_getpeername), | ||
1150 | LSM_HOOK_INIT(socket_getsockopt, apparmor_socket_getsockopt), | ||
1151 | LSM_HOOK_INIT(socket_setsockopt, apparmor_socket_setsockopt), | ||
1152 | LSM_HOOK_INIT(socket_shutdown, apparmor_socket_shutdown), | ||
1153 | LSM_HOOK_INIT(socket_sock_rcv_skb, apparmor_socket_sock_rcv_skb), | ||
1154 | LSM_HOOK_INIT(socket_getpeersec_stream, | ||
1155 | apparmor_socket_getpeersec_stream), | ||
1156 | LSM_HOOK_INIT(socket_getpeersec_dgram, | ||
1157 | apparmor_socket_getpeersec_dgram), | ||
1158 | LSM_HOOK_INIT(sock_graft, apparmor_sock_graft), | ||
1159 | |||
1160 | LSM_HOOK_INIT(cred_alloc_blank, apparmor_cred_alloc_blank), | 773 | LSM_HOOK_INIT(cred_alloc_blank, apparmor_cred_alloc_blank), |
1161 | LSM_HOOK_INIT(cred_free, apparmor_cred_free), | 774 | LSM_HOOK_INIT(cred_free, apparmor_cred_free), |
1162 | LSM_HOOK_INIT(cred_prepare, apparmor_cred_prepare), | 775 | LSM_HOOK_INIT(cred_prepare, apparmor_cred_prepare), |
diff --git a/security/apparmor/net.c b/security/apparmor/net.c deleted file mode 100644 index 33d54435f8d6..000000000000 --- a/security/apparmor/net.c +++ /dev/null | |||
@@ -1,184 +0,0 @@ | |||
1 | /* | ||
2 | * AppArmor security module | ||
3 | * | ||
4 | * This file contains AppArmor network mediation | ||
5 | * | ||
6 | * Copyright (C) 1998-2008 Novell/SUSE | ||
7 | * Copyright 2009-2017 Canonical Ltd. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License as | ||
11 | * published by the Free Software Foundation, version 2 of the | ||
12 | * License. | ||
13 | */ | ||
14 | |||
15 | #include "include/apparmor.h" | ||
16 | #include "include/audit.h" | ||
17 | #include "include/context.h" | ||
18 | #include "include/label.h" | ||
19 | #include "include/net.h" | ||
20 | #include "include/policy.h" | ||
21 | |||
22 | #include "net_names.h" | ||
23 | |||
24 | |||
25 | struct aa_sfs_entry aa_sfs_entry_network[] = { | ||
26 | AA_SFS_FILE_STRING("af_mask", AA_SFS_AF_MASK), | ||
27 | { } | ||
28 | }; | ||
29 | |||
30 | static const char * const net_mask_names[] = { | ||
31 | "unknown", | ||
32 | "send", | ||
33 | "receive", | ||
34 | "unknown", | ||
35 | |||
36 | "create", | ||
37 | "shutdown", | ||
38 | "connect", | ||
39 | "unknown", | ||
40 | |||
41 | "setattr", | ||
42 | "getattr", | ||
43 | "setcred", | ||
44 | "getcred", | ||
45 | |||
46 | "chmod", | ||
47 | "chown", | ||
48 | "chgrp", | ||
49 | "lock", | ||
50 | |||
51 | "mmap", | ||
52 | "mprot", | ||
53 | "unknown", | ||
54 | "unknown", | ||
55 | |||
56 | "accept", | ||
57 | "bind", | ||
58 | "listen", | ||
59 | "unknown", | ||
60 | |||
61 | "setopt", | ||
62 | "getopt", | ||
63 | "unknown", | ||
64 | "unknown", | ||
65 | |||
66 | "unknown", | ||
67 | "unknown", | ||
68 | "unknown", | ||
69 | "unknown", | ||
70 | }; | ||
71 | |||
72 | |||
73 | /* audit callback for net specific fields */ | ||
74 | void audit_net_cb(struct audit_buffer *ab, void *va) | ||
75 | { | ||
76 | struct common_audit_data *sa = va; | ||
77 | |||
78 | audit_log_format(ab, " family="); | ||
79 | if (address_family_names[sa->u.net->family]) | ||
80 | audit_log_string(ab, address_family_names[sa->u.net->family]); | ||
81 | else | ||
82 | audit_log_format(ab, "\"unknown(%d)\"", sa->u.net->family); | ||
83 | audit_log_format(ab, " sock_type="); | ||
84 | if (sock_type_names[aad(sa)->net.type]) | ||
85 | audit_log_string(ab, sock_type_names[aad(sa)->net.type]); | ||
86 | else | ||
87 | audit_log_format(ab, "\"unknown(%d)\"", aad(sa)->net.type); | ||
88 | audit_log_format(ab, " protocol=%d", aad(sa)->net.protocol); | ||
89 | |||
90 | if (aad(sa)->request & NET_PERMS_MASK) { | ||
91 | audit_log_format(ab, " requested_mask="); | ||
92 | aa_audit_perm_mask(ab, aad(sa)->request, NULL, 0, | ||
93 | net_mask_names, NET_PERMS_MASK); | ||
94 | |||
95 | if (aad(sa)->denied & NET_PERMS_MASK) { | ||
96 | audit_log_format(ab, " denied_mask="); | ||
97 | aa_audit_perm_mask(ab, aad(sa)->denied, NULL, 0, | ||
98 | net_mask_names, NET_PERMS_MASK); | ||
99 | } | ||
100 | } | ||
101 | if (aad(sa)->peer) { | ||
102 | audit_log_format(ab, " peer="); | ||
103 | aa_label_xaudit(ab, labels_ns(aad(sa)->label), aad(sa)->peer, | ||
104 | FLAGS_NONE, GFP_ATOMIC); | ||
105 | } | ||
106 | } | ||
107 | |||
108 | |||
109 | /* Generic af perm */ | ||
110 | int aa_profile_af_perm(struct aa_profile *profile, struct common_audit_data *sa, | ||
111 | u32 request, u16 family, int type) | ||
112 | { | ||
113 | struct aa_perms perms = { }; | ||
114 | |||
115 | AA_BUG(family >= AF_MAX); | ||
116 | AA_BUG(type < 0 || type >= SOCK_MAX); | ||
117 | |||
118 | if (profile_unconfined(profile)) | ||
119 | return 0; | ||
120 | |||
121 | perms.allow = (profile->net.allow[family] & (1 << type)) ? | ||
122 | ALL_PERMS_MASK : 0; | ||
123 | perms.audit = (profile->net.audit[family] & (1 << type)) ? | ||
124 | ALL_PERMS_MASK : 0; | ||
125 | perms.quiet = (profile->net.quiet[family] & (1 << type)) ? | ||
126 | ALL_PERMS_MASK : 0; | ||
127 | aa_apply_modes_to_perms(profile, &perms); | ||
128 | |||
129 | return aa_check_perms(profile, &perms, request, sa, audit_net_cb); | ||
130 | } | ||
131 | |||
132 | int aa_af_perm(struct aa_label *label, const char *op, u32 request, u16 family, | ||
133 | int type, int protocol) | ||
134 | { | ||
135 | struct aa_profile *profile; | ||
136 | DEFINE_AUDIT_NET(sa, op, NULL, family, type, protocol); | ||
137 | |||
138 | return fn_for_each_confined(label, profile, | ||
139 | aa_profile_af_perm(profile, &sa, request, family, | ||
140 | type)); | ||
141 | } | ||
142 | |||
143 | static int aa_label_sk_perm(struct aa_label *label, const char *op, u32 request, | ||
144 | struct sock *sk) | ||
145 | { | ||
146 | struct aa_profile *profile; | ||
147 | DEFINE_AUDIT_SK(sa, op, sk); | ||
148 | |||
149 | AA_BUG(!label); | ||
150 | AA_BUG(!sk); | ||
151 | |||
152 | if (unconfined(label)) | ||
153 | return 0; | ||
154 | |||
155 | return fn_for_each_confined(label, profile, | ||
156 | aa_profile_af_sk_perm(profile, &sa, request, sk)); | ||
157 | } | ||
158 | |||
159 | int aa_sk_perm(const char *op, u32 request, struct sock *sk) | ||
160 | { | ||
161 | struct aa_label *label; | ||
162 | int error; | ||
163 | |||
164 | AA_BUG(!sk); | ||
165 | AA_BUG(in_interrupt()); | ||
166 | |||
167 | /* TODO: switch to begin_current_label ???? */ | ||
168 | label = begin_current_label_crit_section(); | ||
169 | error = aa_label_sk_perm(label, op, request, sk); | ||
170 | end_current_label_crit_section(label); | ||
171 | |||
172 | return error; | ||
173 | } | ||
174 | |||
175 | |||
176 | int aa_sock_file_perm(struct aa_label *label, const char *op, u32 request, | ||
177 | struct socket *sock) | ||
178 | { | ||
179 | AA_BUG(!label); | ||
180 | AA_BUG(!sock); | ||
181 | AA_BUG(!sock->sk); | ||
182 | |||
183 | return aa_label_sk_perm(label, op, request, sock->sk); | ||
184 | } | ||
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 5a2aec358322..4ede87c30f8b 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c | |||
@@ -275,19 +275,6 @@ fail: | |||
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
277 | 277 | ||
278 | static bool unpack_u16(struct aa_ext *e, u16 *data, const char *name) | ||
279 | { | ||
280 | if (unpack_nameX(e, AA_U16, name)) { | ||
281 | if (!inbounds(e, sizeof(u16))) | ||
282 | return 0; | ||
283 | if (data) | ||
284 | *data = le16_to_cpu(get_unaligned((__le16 *) e->pos)); | ||
285 | e->pos += sizeof(u16); | ||
286 | return 1; | ||
287 | } | ||
288 | return 0; | ||
289 | } | ||
290 | |||
291 | static bool unpack_u32(struct aa_ext *e, u32 *data, const char *name) | 278 | static bool unpack_u32(struct aa_ext *e, u32 *data, const char *name) |
292 | { | 279 | { |
293 | if (unpack_nameX(e, AA_U32, name)) { | 280 | if (unpack_nameX(e, AA_U32, name)) { |
@@ -597,7 +584,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) | |||
597 | struct aa_profile *profile = NULL; | 584 | struct aa_profile *profile = NULL; |
598 | const char *tmpname, *tmpns = NULL, *name = NULL; | 585 | const char *tmpname, *tmpns = NULL, *name = NULL; |
599 | const char *info = "failed to unpack profile"; | 586 | const char *info = "failed to unpack profile"; |
600 | size_t size = 0, ns_len; | 587 | size_t ns_len; |
601 | struct rhashtable_params params = { 0 }; | 588 | struct rhashtable_params params = { 0 }; |
602 | char *key = NULL; | 589 | char *key = NULL; |
603 | struct aa_data *data; | 590 | struct aa_data *data; |
@@ -730,38 +717,6 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) | |||
730 | goto fail; | 717 | goto fail; |
731 | } | 718 | } |
732 | 719 | ||
733 | size = unpack_array(e, "net_allowed_af"); | ||
734 | if (size) { | ||
735 | |||
736 | for (i = 0; i < size; i++) { | ||
737 | /* discard extraneous rules that this kernel will | ||
738 | * never request | ||
739 | */ | ||
740 | if (i >= AF_MAX) { | ||
741 | u16 tmp; | ||
742 | |||
743 | if (!unpack_u16(e, &tmp, NULL) || | ||
744 | !unpack_u16(e, &tmp, NULL) || | ||
745 | !unpack_u16(e, &tmp, NULL)) | ||
746 | goto fail; | ||
747 | continue; | ||
748 | } | ||
749 | if (!unpack_u16(e, &profile->net.allow[i], NULL)) | ||
750 | goto fail; | ||
751 | if (!unpack_u16(e, &profile->net.audit[i], NULL)) | ||
752 | goto fail; | ||
753 | if (!unpack_u16(e, &profile->net.quiet[i], NULL)) | ||
754 | goto fail; | ||
755 | } | ||
756 | if (!unpack_nameX(e, AA_ARRAYEND, NULL)) | ||
757 | goto fail; | ||
758 | } | ||
759 | if (VERSION_LT(e->version, v7)) { | ||
760 | /* pre v7 policy always allowed these */ | ||
761 | profile->net.allow[AF_UNIX] = 0xffff; | ||
762 | profile->net.allow[AF_NETLINK] = 0xffff; | ||
763 | } | ||
764 | |||
765 | if (unpack_nameX(e, AA_STRUCT, "policydb")) { | 720 | if (unpack_nameX(e, AA_STRUCT, "policydb")) { |
766 | /* generic policy dfa - optional and may be NULL */ | 721 | /* generic policy dfa - optional and may be NULL */ |
767 | info = "failed to unpack policydb"; | 722 | info = "failed to unpack policydb"; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0ce71111b4e3..546d515f3c1f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -327,6 +327,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) | |||
327 | case 0x10ec0215: | 327 | case 0x10ec0215: |
328 | case 0x10ec0225: | 328 | case 0x10ec0225: |
329 | case 0x10ec0233: | 329 | case 0x10ec0233: |
330 | case 0x10ec0236: | ||
330 | case 0x10ec0255: | 331 | case 0x10ec0255: |
331 | case 0x10ec0256: | 332 | case 0x10ec0256: |
332 | case 0x10ec0282: | 333 | case 0x10ec0282: |
@@ -911,6 +912,7 @@ static struct alc_codec_rename_pci_table rename_pci_tbl[] = { | |||
911 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, | 912 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, |
912 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, | 913 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, |
913 | { 0x10ec0298, 0x1028, 0, "ALC3266" }, | 914 | { 0x10ec0298, 0x1028, 0, "ALC3266" }, |
915 | { 0x10ec0236, 0x1028, 0, "ALC3204" }, | ||
914 | { 0x10ec0256, 0x1028, 0, "ALC3246" }, | 916 | { 0x10ec0256, 0x1028, 0, "ALC3246" }, |
915 | { 0x10ec0225, 0x1028, 0, "ALC3253" }, | 917 | { 0x10ec0225, 0x1028, 0, "ALC3253" }, |
916 | { 0x10ec0295, 0x1028, 0, "ALC3254" }, | 918 | { 0x10ec0295, 0x1028, 0, "ALC3254" }, |
@@ -3930,6 +3932,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) | |||
3930 | alc_process_coef_fw(codec, coef0255_1); | 3932 | alc_process_coef_fw(codec, coef0255_1); |
3931 | alc_process_coef_fw(codec, coef0255); | 3933 | alc_process_coef_fw(codec, coef0255); |
3932 | break; | 3934 | break; |
3935 | case 0x10ec0236: | ||
3933 | case 0x10ec0256: | 3936 | case 0x10ec0256: |
3934 | alc_process_coef_fw(codec, coef0256); | 3937 | alc_process_coef_fw(codec, coef0256); |
3935 | alc_process_coef_fw(codec, coef0255); | 3938 | alc_process_coef_fw(codec, coef0255); |
@@ -4028,6 +4031,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, | |||
4028 | }; | 4031 | }; |
4029 | 4032 | ||
4030 | switch (codec->core.vendor_id) { | 4033 | switch (codec->core.vendor_id) { |
4034 | case 0x10ec0236: | ||
4031 | case 0x10ec0255: | 4035 | case 0x10ec0255: |
4032 | case 0x10ec0256: | 4036 | case 0x10ec0256: |
4033 | alc_write_coef_idx(codec, 0x45, 0xc489); | 4037 | alc_write_coef_idx(codec, 0x45, 0xc489); |
@@ -4160,6 +4164,7 @@ static void alc_headset_mode_default(struct hda_codec *codec) | |||
4160 | alc_process_coef_fw(codec, alc225_pre_hsmode); | 4164 | alc_process_coef_fw(codec, alc225_pre_hsmode); |
4161 | alc_process_coef_fw(codec, coef0225); | 4165 | alc_process_coef_fw(codec, coef0225); |
4162 | break; | 4166 | break; |
4167 | case 0x10ec0236: | ||
4163 | case 0x10ec0255: | 4168 | case 0x10ec0255: |
4164 | case 0x10ec0256: | 4169 | case 0x10ec0256: |
4165 | alc_process_coef_fw(codec, coef0255); | 4170 | alc_process_coef_fw(codec, coef0255); |
@@ -4256,6 +4261,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) | |||
4256 | case 0x10ec0255: | 4261 | case 0x10ec0255: |
4257 | alc_process_coef_fw(codec, coef0255); | 4262 | alc_process_coef_fw(codec, coef0255); |
4258 | break; | 4263 | break; |
4264 | case 0x10ec0236: | ||
4259 | case 0x10ec0256: | 4265 | case 0x10ec0256: |
4260 | alc_process_coef_fw(codec, coef0256); | 4266 | alc_process_coef_fw(codec, coef0256); |
4261 | break; | 4267 | break; |
@@ -4366,6 +4372,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec) | |||
4366 | case 0x10ec0255: | 4372 | case 0x10ec0255: |
4367 | alc_process_coef_fw(codec, coef0255); | 4373 | alc_process_coef_fw(codec, coef0255); |
4368 | break; | 4374 | break; |
4375 | case 0x10ec0236: | ||
4369 | case 0x10ec0256: | 4376 | case 0x10ec0256: |
4370 | alc_process_coef_fw(codec, coef0256); | 4377 | alc_process_coef_fw(codec, coef0256); |
4371 | break; | 4378 | break; |
@@ -4451,6 +4458,7 @@ static void alc_determine_headset_type(struct hda_codec *codec) | |||
4451 | }; | 4458 | }; |
4452 | 4459 | ||
4453 | switch (codec->core.vendor_id) { | 4460 | switch (codec->core.vendor_id) { |
4461 | case 0x10ec0236: | ||
4454 | case 0x10ec0255: | 4462 | case 0x10ec0255: |
4455 | case 0x10ec0256: | 4463 | case 0x10ec0256: |
4456 | alc_process_coef_fw(codec, coef0255); | 4464 | alc_process_coef_fw(codec, coef0255); |
@@ -4705,6 +4713,7 @@ static void alc255_set_default_jack_type(struct hda_codec *codec) | |||
4705 | case 0x10ec0255: | 4713 | case 0x10ec0255: |
4706 | alc_process_coef_fw(codec, alc255fw); | 4714 | alc_process_coef_fw(codec, alc255fw); |
4707 | break; | 4715 | break; |
4716 | case 0x10ec0236: | ||
4708 | case 0x10ec0256: | 4717 | case 0x10ec0256: |
4709 | alc_process_coef_fw(codec, alc256fw); | 4718 | alc_process_coef_fw(codec, alc256fw); |
4710 | break; | 4719 | break; |
@@ -6419,6 +6428,14 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
6419 | ALC225_STANDARD_PINS, | 6428 | ALC225_STANDARD_PINS, |
6420 | {0x12, 0xb7a60130}, | 6429 | {0x12, 0xb7a60130}, |
6421 | {0x1b, 0x90170110}), | 6430 | {0x1b, 0x90170110}), |
6431 | SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
6432 | {0x12, 0x90a60140}, | ||
6433 | {0x14, 0x90170110}, | ||
6434 | {0x21, 0x02211020}), | ||
6435 | SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
6436 | {0x12, 0x90a60140}, | ||
6437 | {0x14, 0x90170150}, | ||
6438 | {0x21, 0x02211020}), | ||
6422 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, | 6439 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, |
6423 | {0x14, 0x90170110}, | 6440 | {0x14, 0x90170110}, |
6424 | {0x21, 0x02211020}), | 6441 | {0x21, 0x02211020}), |
@@ -6806,6 +6823,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
6806 | case 0x10ec0255: | 6823 | case 0x10ec0255: |
6807 | spec->codec_variant = ALC269_TYPE_ALC255; | 6824 | spec->codec_variant = ALC269_TYPE_ALC255; |
6808 | break; | 6825 | break; |
6826 | case 0x10ec0236: | ||
6809 | case 0x10ec0256: | 6827 | case 0x10ec0256: |
6810 | spec->codec_variant = ALC269_TYPE_ALC256; | 6828 | spec->codec_variant = ALC269_TYPE_ALC256; |
6811 | spec->shutup = alc256_shutup; | 6829 | spec->shutup = alc256_shutup; |
@@ -7857,6 +7875,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { | |||
7857 | HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269), | 7875 | HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269), |
7858 | HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269), | 7876 | HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269), |
7859 | HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269), | 7877 | HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269), |
7878 | HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269), | ||
7860 | HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269), | 7879 | HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269), |
7861 | HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269), | 7880 | HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269), |
7862 | HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260), | 7881 | HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260), |
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index f650346aaa1a..4a4b6e78c977 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h | |||
@@ -887,8 +887,8 @@ struct xdp_md { | |||
887 | }; | 887 | }; |
888 | 888 | ||
889 | enum sk_action { | 889 | enum sk_action { |
890 | SK_ABORTED = 0, | 890 | SK_DROP = 0, |
891 | SK_DROP, | 891 | SK_PASS, |
892 | SK_REDIRECT, | 892 | SK_REDIRECT, |
893 | }; | 893 | }; |
894 | 894 | ||
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index a0c518ecf085..c0e26ad1fa7e 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c | |||
@@ -267,12 +267,13 @@ static int decode_instructions(struct objtool_file *file) | |||
267 | &insn->immediate, | 267 | &insn->immediate, |
268 | &insn->stack_op); | 268 | &insn->stack_op); |
269 | if (ret) | 269 | if (ret) |
270 | return ret; | 270 | goto err; |
271 | 271 | ||
272 | if (!insn->type || insn->type > INSN_LAST) { | 272 | if (!insn->type || insn->type > INSN_LAST) { |
273 | WARN_FUNC("invalid instruction type %d", | 273 | WARN_FUNC("invalid instruction type %d", |
274 | insn->sec, insn->offset, insn->type); | 274 | insn->sec, insn->offset, insn->type); |
275 | return -1; | 275 | ret = -1; |
276 | goto err; | ||
276 | } | 277 | } |
277 | 278 | ||
278 | hash_add(file->insn_hash, &insn->hash, insn->offset); | 279 | hash_add(file->insn_hash, &insn->hash, insn->offset); |
@@ -296,6 +297,10 @@ static int decode_instructions(struct objtool_file *file) | |||
296 | } | 297 | } |
297 | 298 | ||
298 | return 0; | 299 | return 0; |
300 | |||
301 | err: | ||
302 | free(insn); | ||
303 | return ret; | ||
299 | } | 304 | } |
300 | 305 | ||
301 | /* | 306 | /* |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index e397453e5a46..63526f4416ea 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -8,8 +8,8 @@ perf-record - Run a command and record its profile into perf.data | |||
8 | SYNOPSIS | 8 | SYNOPSIS |
9 | -------- | 9 | -------- |
10 | [verse] | 10 | [verse] |
11 | 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] <command> | 11 | 'perf record' [-e <EVENT> | --event=EVENT] [-a] <command> |
12 | 'perf record' [-e <EVENT> | --event=EVENT] [-l] [-a] -- <command> [<options>] | 12 | 'perf record' [-e <EVENT> | --event=EVENT] [-a] -- <command> [<options>] |
13 | 13 | ||
14 | DESCRIPTION | 14 | DESCRIPTION |
15 | ----------- | 15 | ----------- |
diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh index 462fc755092e..7a84d73324e3 100755 --- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | . $(dirname $0)/lib/probe.sh | 11 | . $(dirname $0)/lib/probe.sh |
12 | 12 | ||
13 | ld=$(realpath /lib64/ld*.so.* | uniq) | ||
14 | libc=$(echo $ld | sed 's/ld/libc/g') | ||
15 | |||
13 | trace_libc_inet_pton_backtrace() { | 16 | trace_libc_inet_pton_backtrace() { |
14 | idx=0 | 17 | idx=0 |
15 | expected[0]="PING.*bytes" | 18 | expected[0]="PING.*bytes" |
@@ -18,8 +21,8 @@ trace_libc_inet_pton_backtrace() { | |||
18 | expected[3]=".*packets transmitted.*" | 21 | expected[3]=".*packets transmitted.*" |
19 | expected[4]="rtt min.*" | 22 | expected[4]="rtt min.*" |
20 | expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" | 23 | expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" |
21 | expected[6]=".*inet_pton[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" | 24 | expected[6]=".*inet_pton[[:space:]]\($libc\)$" |
22 | expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" | 25 | expected[7]="getaddrinfo[[:space:]]\($libc\)$" |
23 | expected[8]=".*\(.*/bin/ping.*\)$" | 26 | expected[8]=".*\(.*/bin/ping.*\)$" |
24 | 27 | ||
25 | perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do | 28 | perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do |
@@ -35,7 +38,7 @@ trace_libc_inet_pton_backtrace() { | |||
35 | } | 38 | } |
36 | 39 | ||
37 | skip_if_no_perf_probe && \ | 40 | skip_if_no_perf_probe && \ |
38 | perf probe -q /lib64/libc-*.so inet_pton && \ | 41 | perf probe -q $libc inet_pton && \ |
39 | trace_libc_inet_pton_backtrace | 42 | trace_libc_inet_pton_backtrace |
40 | err=$? | 43 | err=$? |
41 | rm -f ${file} | 44 | rm -f ${file} |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index ddb2c6fbdf91..db79017a6e56 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -532,7 +532,7 @@ void perf_hpp_list__prepend_sort_field(struct perf_hpp_list *list, | |||
532 | 532 | ||
533 | void perf_hpp__column_unregister(struct perf_hpp_fmt *format) | 533 | void perf_hpp__column_unregister(struct perf_hpp_fmt *format) |
534 | { | 534 | { |
535 | list_del(&format->list); | 535 | list_del_init(&format->list); |
536 | } | 536 | } |
537 | 537 | ||
538 | void perf_hpp__cancel_cumulate(void) | 538 | void perf_hpp__cancel_cumulate(void) |
@@ -606,6 +606,13 @@ next: | |||
606 | 606 | ||
607 | static void fmt_free(struct perf_hpp_fmt *fmt) | 607 | static void fmt_free(struct perf_hpp_fmt *fmt) |
608 | { | 608 | { |
609 | /* | ||
610 | * At this point fmt should be completely | ||
611 | * unhooked, if not it's a bug. | ||
612 | */ | ||
613 | BUG_ON(!list_empty(&fmt->list)); | ||
614 | BUG_ON(!list_empty(&fmt->sort_list)); | ||
615 | |||
609 | if (fmt->free) | 616 | if (fmt->free) |
610 | fmt->free(fmt); | 617 | fmt->free(fmt); |
611 | } | 618 | } |
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index c42edeac451f..dcfdafdc2f1c 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l | |||
@@ -8,6 +8,9 @@ | |||
8 | 8 | ||
9 | %{ | 9 | %{ |
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | #include <sys/types.h> | ||
12 | #include <sys/stat.h> | ||
13 | #include <unistd.h> | ||
11 | #include "../perf.h" | 14 | #include "../perf.h" |
12 | #include "parse-events.h" | 15 | #include "parse-events.h" |
13 | #include "parse-events-bison.h" | 16 | #include "parse-events-bison.h" |
@@ -53,9 +56,8 @@ static int str(yyscan_t scanner, int token) | |||
53 | return token; | 56 | return token; |
54 | } | 57 | } |
55 | 58 | ||
56 | static bool isbpf(yyscan_t scanner) | 59 | static bool isbpf_suffix(char *text) |
57 | { | 60 | { |
58 | char *text = parse_events_get_text(scanner); | ||
59 | int len = strlen(text); | 61 | int len = strlen(text); |
60 | 62 | ||
61 | if (len < 2) | 63 | if (len < 2) |
@@ -68,6 +70,17 @@ static bool isbpf(yyscan_t scanner) | |||
68 | return false; | 70 | return false; |
69 | } | 71 | } |
70 | 72 | ||
73 | static bool isbpf(yyscan_t scanner) | ||
74 | { | ||
75 | char *text = parse_events_get_text(scanner); | ||
76 | struct stat st; | ||
77 | |||
78 | if (!isbpf_suffix(text)) | ||
79 | return false; | ||
80 | |||
81 | return stat(text, &st) == 0; | ||
82 | } | ||
83 | |||
71 | /* | 84 | /* |
72 | * This function is called when the parser gets two kind of input: | 85 | * This function is called when the parser gets two kind of input: |
73 | * | 86 | * |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index a7ebd9fe8e40..76ab0709a20c 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -374,6 +374,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool) | |||
374 | tool->mmap2 = process_event_stub; | 374 | tool->mmap2 = process_event_stub; |
375 | if (tool->comm == NULL) | 375 | if (tool->comm == NULL) |
376 | tool->comm = process_event_stub; | 376 | tool->comm = process_event_stub; |
377 | if (tool->namespaces == NULL) | ||
378 | tool->namespaces = process_event_stub; | ||
377 | if (tool->fork == NULL) | 379 | if (tool->fork == NULL) |
378 | tool->fork = process_event_stub; | 380 | tool->fork = process_event_stub; |
379 | if (tool->exit == NULL) | 381 | if (tool->exit == NULL) |
diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h index 4ba726c90870..54af60462130 100644 --- a/tools/perf/util/xyarray.h +++ b/tools/perf/util/xyarray.h | |||
@@ -23,12 +23,12 @@ static inline void *xyarray__entry(struct xyarray *xy, int x, int y) | |||
23 | 23 | ||
24 | static inline int xyarray__max_y(struct xyarray *xy) | 24 | static inline int xyarray__max_y(struct xyarray *xy) |
25 | { | 25 | { |
26 | return xy->max_x; | 26 | return xy->max_y; |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline int xyarray__max_x(struct xyarray *xy) | 29 | static inline int xyarray__max_x(struct xyarray *xy) |
30 | { | 30 | { |
31 | return xy->max_y; | 31 | return xy->max_x; |
32 | } | 32 | } |
33 | 33 | ||
34 | #endif /* _PERF_XYARRAY_H_ */ | 34 | #endif /* _PERF_XYARRAY_H_ */ |
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index 4c5a481a850c..d6e1c02ddcfe 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile | |||
@@ -26,7 +26,7 @@ endif | |||
26 | 26 | ||
27 | ifneq ($(OUTPUT),) | 27 | ifneq ($(OUTPUT),) |
28 | # check that the output directory actually exists | 28 | # check that the output directory actually exists |
29 | OUTDIR := $(realpath $(OUTPUT)) | 29 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) |
30 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | 30 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) |
31 | endif | 31 | endif |
32 | 32 | ||
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index 9dc8f078a83c..1e8b6116ba3c 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include | |||
@@ -1,7 +1,7 @@ | |||
1 | ifneq ($(O),) | 1 | ifneq ($(O),) |
2 | ifeq ($(origin O), command line) | 2 | ifeq ($(origin O), command line) |
3 | ABSOLUTE_O := $(realpath $(O)) | 3 | dummy := $(if $(shell test -d $(O) || echo $(O)),$(error O=$(O) does not exist),) |
4 | dummy := $(if $(ABSOLUTE_O),,$(error O=$(O) does not exist)) | 4 | ABSOLUTE_O := $(shell cd $(O) ; pwd) |
5 | OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) | 5 | OUTPUT := $(ABSOLUTE_O)/$(if $(subdir),$(subdir)/) |
6 | COMMAND_O := O=$(ABSOLUTE_O) | 6 | COMMAND_O := O=$(ABSOLUTE_O) |
7 | ifeq ($(objtree),) | 7 | ifeq ($(objtree),) |
@@ -12,7 +12,7 @@ endif | |||
12 | 12 | ||
13 | # check that the output directory actually exists | 13 | # check that the output directory actually exists |
14 | ifneq ($(OUTPUT),) | 14 | ifneq ($(OUTPUT),) |
15 | OUTDIR := $(realpath $(OUTPUT)) | 15 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) |
16 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | 16 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) |
17 | endif | 17 | endif |
18 | 18 | ||
diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json b/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json index c727b96a59b0..5fa02d86b35f 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/tests.json | |||
@@ -17,5 +17,26 @@ | |||
17 | "teardown": [ | 17 | "teardown": [ |
18 | "$TC qdisc del dev $DEV1 ingress" | 18 | "$TC qdisc del dev $DEV1 ingress" |
19 | ] | 19 | ] |
20 | }, | ||
21 | { | ||
22 | "id": "d052", | ||
23 | "name": "Add 1M filters with the same action", | ||
24 | "category": [ | ||
25 | "filter", | ||
26 | "flower" | ||
27 | ], | ||
28 | "setup": [ | ||
29 | "$TC qdisc add dev $DEV2 ingress", | ||
30 | "./tdc_batch.py $DEV2 $BATCH_FILE --share_action -n 1000000" | ||
31 | ], | ||
32 | "cmdUnderTest": "$TC -b $BATCH_FILE", | ||
33 | "expExitCode": "0", | ||
34 | "verifyCmd": "$TC actions list action gact", | ||
35 | "matchPattern": "action order 0: gact action drop.*index 1 ref 1000000 bind 1000000", | ||
36 | "matchCount": "1", | ||
37 | "teardown": [ | ||
38 | "$TC qdisc del dev $DEV2 ingress", | ||
39 | "/bin/rm $BATCH_FILE" | ||
40 | ] | ||
20 | } | 41 | } |
21 | ] \ No newline at end of file | 42 | ] |
diff --git a/tools/testing/selftests/tc-testing/tdc.py b/tools/testing/selftests/tc-testing/tdc.py index d2391df2cf7d..5508730ee1ea 100755 --- a/tools/testing/selftests/tc-testing/tdc.py +++ b/tools/testing/selftests/tc-testing/tdc.py | |||
@@ -88,7 +88,7 @@ def prepare_env(cmdlist): | |||
88 | exit(1) | 88 | exit(1) |
89 | 89 | ||
90 | 90 | ||
91 | def test_runner(filtered_tests): | 91 | def test_runner(filtered_tests, args): |
92 | """ | 92 | """ |
93 | Driver function for the unit tests. | 93 | Driver function for the unit tests. |
94 | 94 | ||
@@ -105,6 +105,8 @@ def test_runner(filtered_tests): | |||
105 | for tidx in testlist: | 105 | for tidx in testlist: |
106 | result = True | 106 | result = True |
107 | tresult = "" | 107 | tresult = "" |
108 | if "flower" in tidx["category"] and args.device == None: | ||
109 | continue | ||
108 | print("Test " + tidx["id"] + ": " + tidx["name"]) | 110 | print("Test " + tidx["id"] + ": " + tidx["name"]) |
109 | prepare_env(tidx["setup"]) | 111 | prepare_env(tidx["setup"]) |
110 | (p, procout) = exec_cmd(tidx["cmdUnderTest"]) | 112 | (p, procout) = exec_cmd(tidx["cmdUnderTest"]) |
@@ -152,6 +154,10 @@ def ns_create(): | |||
152 | exec_cmd(cmd, False) | 154 | exec_cmd(cmd, False) |
153 | cmd = 'ip -s $NS link set $DEV1 up' | 155 | cmd = 'ip -s $NS link set $DEV1 up' |
154 | exec_cmd(cmd, False) | 156 | exec_cmd(cmd, False) |
157 | cmd = 'ip link set $DEV2 netns $NS' | ||
158 | exec_cmd(cmd, False) | ||
159 | cmd = 'ip -s $NS link set $DEV2 up' | ||
160 | exec_cmd(cmd, False) | ||
155 | 161 | ||
156 | 162 | ||
157 | def ns_destroy(): | 163 | def ns_destroy(): |
@@ -211,7 +217,8 @@ def set_args(parser): | |||
211 | help='Execute the single test case with specified ID') | 217 | help='Execute the single test case with specified ID') |
212 | parser.add_argument('-i', '--id', action='store_true', dest='gen_id', | 218 | parser.add_argument('-i', '--id', action='store_true', dest='gen_id', |
213 | help='Generate ID numbers for new test cases') | 219 | help='Generate ID numbers for new test cases') |
214 | return parser | 220 | parser.add_argument('-d', '--device', |
221 | help='Execute the test case in flower category') | ||
215 | return parser | 222 | return parser |
216 | 223 | ||
217 | 224 | ||
@@ -225,6 +232,8 @@ def check_default_settings(args): | |||
225 | 232 | ||
226 | if args.path != None: | 233 | if args.path != None: |
227 | NAMES['TC'] = args.path | 234 | NAMES['TC'] = args.path |
235 | if args.device != None: | ||
236 | NAMES['DEV2'] = args.device | ||
228 | if not os.path.isfile(NAMES['TC']): | 237 | if not os.path.isfile(NAMES['TC']): |
229 | print("The specified tc path " + NAMES['TC'] + " does not exist.") | 238 | print("The specified tc path " + NAMES['TC'] + " does not exist.") |
230 | exit(1) | 239 | exit(1) |
@@ -381,14 +390,17 @@ def set_operation_mode(args): | |||
381 | if (len(alltests) == 0): | 390 | if (len(alltests) == 0): |
382 | print("Cannot find a test case with ID matching " + target_id) | 391 | print("Cannot find a test case with ID matching " + target_id) |
383 | exit(1) | 392 | exit(1) |
384 | catresults = test_runner(alltests) | 393 | catresults = test_runner(alltests, args) |
385 | print("All test results: " + "\n\n" + catresults) | 394 | print("All test results: " + "\n\n" + catresults) |
386 | elif (len(target_category) > 0): | 395 | elif (len(target_category) > 0): |
396 | if (target_category == "flower") and args.device == None: | ||
397 | print("Please specify a NIC device (-d) to run category flower") | ||
398 | exit(1) | ||
387 | if (target_category not in ucat): | 399 | if (target_category not in ucat): |
388 | print("Specified category is not present in this file.") | 400 | print("Specified category is not present in this file.") |
389 | exit(1) | 401 | exit(1) |
390 | else: | 402 | else: |
391 | catresults = test_runner(testcases[target_category]) | 403 | catresults = test_runner(testcases[target_category], args) |
392 | print("Category " + target_category + "\n\n" + catresults) | 404 | print("Category " + target_category + "\n\n" + catresults) |
393 | 405 | ||
394 | ns_destroy() | 406 | ns_destroy() |
diff --git a/tools/testing/selftests/tc-testing/tdc_batch.py b/tools/testing/selftests/tc-testing/tdc_batch.py new file mode 100755 index 000000000000..707c6bfef689 --- /dev/null +++ b/tools/testing/selftests/tc-testing/tdc_batch.py | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/usr/bin/python3 | ||
2 | |||
3 | """ | ||
4 | tdc_batch.py - a script to generate TC batch file | ||
5 | |||
6 | Copyright (C) 2017 Chris Mi <chrism@mellanox.com> | ||
7 | """ | ||
8 | |||
9 | import argparse | ||
10 | |||
11 | parser = argparse.ArgumentParser(description='TC batch file generator') | ||
12 | parser.add_argument("device", help="device name") | ||
13 | parser.add_argument("file", help="batch file name") | ||
14 | parser.add_argument("-n", "--number", type=int, | ||
15 | help="how many lines in batch file") | ||
16 | parser.add_argument("-o", "--skip_sw", | ||
17 | help="skip_sw (offload), by default skip_hw", | ||
18 | action="store_true") | ||
19 | parser.add_argument("-s", "--share_action", | ||
20 | help="all filters share the same action", | ||
21 | action="store_true") | ||
22 | parser.add_argument("-p", "--prio", | ||
23 | help="all filters have different prio", | ||
24 | action="store_true") | ||
25 | args = parser.parse_args() | ||
26 | |||
27 | device = args.device | ||
28 | file = open(args.file, 'w') | ||
29 | |||
30 | number = 1 | ||
31 | if args.number: | ||
32 | number = args.number | ||
33 | |||
34 | skip = "skip_hw" | ||
35 | if args.skip_sw: | ||
36 | skip = "skip_sw" | ||
37 | |||
38 | share_action = "" | ||
39 | if args.share_action: | ||
40 | share_action = "index 1" | ||
41 | |||
42 | prio = "prio 1" | ||
43 | if args.prio: | ||
44 | prio = "" | ||
45 | if number > 0x4000: | ||
46 | number = 0x4000 | ||
47 | |||
48 | index = 0 | ||
49 | for i in range(0x100): | ||
50 | for j in range(0x100): | ||
51 | for k in range(0x100): | ||
52 | mac = ("%02x:%02x:%02x" % (i, j, k)) | ||
53 | src_mac = "e4:11:00:" + mac | ||
54 | dst_mac = "e4:12:00:" + mac | ||
55 | cmd = ("filter add dev %s %s protocol ip parent ffff: flower %s " | ||
56 | "src_mac %s dst_mac %s action drop %s" % | ||
57 | (device, prio, skip, src_mac, dst_mac, share_action)) | ||
58 | file.write("%s\n" % cmd) | ||
59 | index += 1 | ||
60 | if index >= number: | ||
61 | file.close() | ||
62 | exit(0) | ||
diff --git a/tools/testing/selftests/tc-testing/tdc_config.py b/tools/testing/selftests/tc-testing/tdc_config.py index 01087375a7c3..b6352515c1b5 100644 --- a/tools/testing/selftests/tc-testing/tdc_config.py +++ b/tools/testing/selftests/tc-testing/tdc_config.py | |||
@@ -12,6 +12,8 @@ NAMES = { | |||
12 | # Name of veth devices to be created for the namespace | 12 | # Name of veth devices to be created for the namespace |
13 | 'DEV0': 'v0p0', | 13 | 'DEV0': 'v0p0', |
14 | 'DEV1': 'v0p1', | 14 | 'DEV1': 'v0p1', |
15 | 'DEV2': '', | ||
16 | 'BATCH_FILE': './batch.txt', | ||
15 | # Name of the namespace to use | 17 | # Name of the namespace to use |
16 | 'NS': 'tcut' | 18 | 'NS': 'tcut' |
17 | } | 19 | } |