diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-10 23:02:51 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-10 23:02:51 -0400 |
commit | 3873691e5ab34fa26948643d038a2b98c4437298 (patch) | |
tree | 5327469194c2167830bce38b56a618b754cdbeea | |
parent | c2050a454c7f123d7a57fa1d76ff61bd43643abb (diff) | |
parent | aadfa8019e8114539cfa0b1eb2e5a9c83094a590 (diff) |
Merge remote-tracking branch 'ovl/rename2' into for-linus
483 files changed, 4379 insertions, 2736 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/silead_gsl1680.txt b/Documentation/devicetree/bindings/input/touchscreen/silead_gsl1680.txt index 1112e0d794e1..820fee4b77b6 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/silead_gsl1680.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/silead_gsl1680.txt | |||
@@ -13,6 +13,7 @@ Required properties: | |||
13 | - touchscreen-size-y : See touchscreen.txt | 13 | - touchscreen-size-y : See touchscreen.txt |
14 | 14 | ||
15 | Optional properties: | 15 | Optional properties: |
16 | - firmware-name : File basename (string) for board specific firmware | ||
16 | - touchscreen-inverted-x : See touchscreen.txt | 17 | - touchscreen-inverted-x : See touchscreen.txt |
17 | - touchscreen-inverted-y : See touchscreen.txt | 18 | - touchscreen-inverted-y : See touchscreen.txt |
18 | - touchscreen-swapped-x-y : See touchscreen.txt | 19 | - touchscreen-swapped-x-y : See touchscreen.txt |
diff --git a/Documentation/devicetree/bindings/mmc/sdhci-st.txt b/Documentation/devicetree/bindings/mmc/sdhci-st.txt index 88faa91125bf..3cd4c43a3260 100644 --- a/Documentation/devicetree/bindings/mmc/sdhci-st.txt +++ b/Documentation/devicetree/bindings/mmc/sdhci-st.txt | |||
@@ -10,7 +10,7 @@ Required properties: | |||
10 | subsystem (mmcss) inside the FlashSS (available in STiH407 SoC | 10 | subsystem (mmcss) inside the FlashSS (available in STiH407 SoC |
11 | family). | 11 | family). |
12 | 12 | ||
13 | - clock-names: Should be "mmc". | 13 | - clock-names: Should be "mmc" and "icn". (NB: The latter is not compulsory) |
14 | See: Documentation/devicetree/bindings/resource-names.txt | 14 | See: Documentation/devicetree/bindings/resource-names.txt |
15 | - clocks: Phandle to the clock. | 15 | - clocks: Phandle to the clock. |
16 | See: Documentation/devicetree/bindings/clock/clock-bindings.txt | 16 | See: Documentation/devicetree/bindings/clock/clock-bindings.txt |
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index d30fb2cb5066..fe15682e8acd 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -51,8 +51,6 @@ prototypes: | |||
51 | int (*rmdir) (struct inode *,struct dentry *); | 51 | int (*rmdir) (struct inode *,struct dentry *); |
52 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); | 52 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); |
53 | int (*rename) (struct inode *, struct dentry *, | 53 | int (*rename) (struct inode *, struct dentry *, |
54 | struct inode *, struct dentry *); | ||
55 | int (*rename2) (struct inode *, struct dentry *, | ||
56 | struct inode *, struct dentry *, unsigned int); | 54 | struct inode *, struct dentry *, unsigned int); |
57 | int (*readlink) (struct dentry *, char __user *,int); | 55 | int (*readlink) (struct dentry *, char __user *,int); |
58 | const char *(*get_link) (struct dentry *, struct inode *, void **); | 56 | const char *(*get_link) (struct dentry *, struct inode *, void **); |
@@ -83,8 +81,7 @@ symlink: yes | |||
83 | mkdir: yes | 81 | mkdir: yes |
84 | unlink: yes (both) | 82 | unlink: yes (both) |
85 | rmdir: yes (both) (see below) | 83 | rmdir: yes (both) (see below) |
86 | rename: yes (all) (see below) | 84 | rename: yes (all) (see below) |
87 | rename2: yes (all) (see below) | ||
88 | readlink: no | 85 | readlink: no |
89 | get_link: no | 86 | get_link: no |
90 | setattr: yes | 87 | setattr: yes |
@@ -102,8 +99,7 @@ tmpfile: no | |||
102 | 99 | ||
103 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on | 100 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on |
104 | victim. | 101 | victim. |
105 | cross-directory ->rename() and rename2() has (per-superblock) | 102 | cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. |
106 | ->s_vfs_rename_sem. | ||
107 | 103 | ||
108 | See Documentation/filesystems/directory-locking for more detailed discussion | 104 | See Documentation/filesystems/directory-locking for more detailed discussion |
109 | of the locking scheme for directory operations. | 105 | of the locking scheme for directory operations. |
diff --git a/Documentation/filesystems/directory-locking b/Documentation/filesystems/directory-locking index c314badbcfc6..4e32cb961e5b 100644 --- a/Documentation/filesystems/directory-locking +++ b/Documentation/filesystems/directory-locking | |||
@@ -19,7 +19,7 @@ locks victim and calls the method. Locks are exclusive. | |||
19 | 19 | ||
20 | 4) rename() that is _not_ cross-directory. Locking rules: caller locks | 20 | 4) rename() that is _not_ cross-directory. Locking rules: caller locks |
21 | the parent and finds source and target. In case of exchange (with | 21 | the parent and finds source and target. In case of exchange (with |
22 | RENAME_EXCHANGE in rename2() flags argument) lock both. In any case, | 22 | RENAME_EXCHANGE in flags argument) lock both. In any case, |
23 | if the target already exists, lock it. If the source is a non-directory, | 23 | if the target already exists, lock it. If the source is a non-directory, |
24 | lock it. If we need to lock both, lock them in inode pointer order. | 24 | lock it. If we need to lock both, lock them in inode pointer order. |
25 | Then call the method. All locks are exclusive. | 25 | Then call the method. All locks are exclusive. |
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting index b1bd05ea66b2..1ab28d9b612a 100644 --- a/Documentation/filesystems/porting +++ b/Documentation/filesystems/porting | |||
@@ -592,3 +592,7 @@ in your dentry operations instead. | |||
592 | work just as well; if it's something more complicated, use dentry->d_parent. | 592 | work just as well; if it's something more complicated, use dentry->d_parent. |
593 | Just be careful not to assume that fetching it more than once will yield | 593 | Just be careful not to assume that fetching it more than once will yield |
594 | the same value - in RCU mode it could change under you. | 594 | the same value - in RCU mode it could change under you. |
595 | -- | ||
596 | [mandatory] | ||
597 | ->rename() has an added flags argument. Any flags not handled by the | ||
598 | filesystem should result in EINVAL being returned. | ||
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index 9ace359d6cc5..b6bfa0bc02f8 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -346,8 +346,6 @@ struct inode_operations { | |||
346 | int (*rmdir) (struct inode *,struct dentry *); | 346 | int (*rmdir) (struct inode *,struct dentry *); |
347 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); | 347 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); |
348 | int (*rename) (struct inode *, struct dentry *, | 348 | int (*rename) (struct inode *, struct dentry *, |
349 | struct inode *, struct dentry *); | ||
350 | int (*rename2) (struct inode *, struct dentry *, | ||
351 | struct inode *, struct dentry *, unsigned int); | 349 | struct inode *, struct dentry *, unsigned int); |
352 | int (*readlink) (struct dentry *, char __user *,int); | 350 | int (*readlink) (struct dentry *, char __user *,int); |
353 | const char *(*get_link) (struct dentry *, struct inode *, | 351 | const char *(*get_link) (struct dentry *, struct inode *, |
@@ -416,11 +414,8 @@ otherwise noted. | |||
416 | rename: called by the rename(2) system call to rename the object to | 414 | rename: called by the rename(2) system call to rename the object to |
417 | have the parent and name given by the second inode and dentry. | 415 | have the parent and name given by the second inode and dentry. |
418 | 416 | ||
419 | rename2: this has an additional flags argument compared to rename. | 417 | The filesystem must return -EINVAL for any unsupported or |
420 | If no flags are supported by the filesystem then this method | 418 | unknown flags. Currently the following flags are implemented: |
421 | need not be implemented. If some flags are supported then the | ||
422 | filesystem must return -EINVAL for any unsupported or unknown | ||
423 | flags. Currently the following flags are implemented: | ||
424 | (1) RENAME_NOREPLACE: this flag indicates that if the target | 419 | (1) RENAME_NOREPLACE: this flag indicates that if the target |
425 | of the rename exists the rename should fail with -EEXIST | 420 | of the rename exists the rename should fail with -EEXIST |
426 | instead of replacing the target. The VFS already checks for | 421 | instead of replacing the target. The VFS already checks for |
diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst index 04ee90099676..201d4839931c 100644 --- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst +++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | |||
@@ -144,7 +144,7 @@ logical address types are already defined will return with error ``EBUSY``. | |||
144 | 144 | ||
145 | - ``flags`` | 145 | - ``flags`` |
146 | 146 | ||
147 | - Flags. No flags are defined yet, so set this to 0. | 147 | - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags. |
148 | 148 | ||
149 | - .. row 7 | 149 | - .. row 7 |
150 | 150 | ||
@@ -201,6 +201,25 @@ logical address types are already defined will return with error ``EBUSY``. | |||
201 | give the CEC framework more information about the device type, even | 201 | give the CEC framework more information about the device type, even |
202 | though the framework won't use it directly in the CEC message. | 202 | though the framework won't use it directly in the CEC message. |
203 | 203 | ||
204 | .. _cec-log-addrs-flags: | ||
205 | |||
206 | .. flat-table:: Flags for struct cec_log_addrs | ||
207 | :header-rows: 0 | ||
208 | :stub-columns: 0 | ||
209 | :widths: 3 1 4 | ||
210 | |||
211 | |||
212 | - .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`: | ||
213 | |||
214 | - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK`` | ||
215 | |||
216 | - 1 | ||
217 | |||
218 | - By default if no logical address of the requested type can be claimed, then | ||
219 | it will go back to the unconfigured state. If this flag is set, then it will | ||
220 | fallback to the Unregistered logical address. Note that if the Unregistered | ||
221 | logical address was explicitly requested, then this flag has no effect. | ||
222 | |||
204 | .. _cec-versions: | 223 | .. _cec-versions: |
205 | 224 | ||
206 | .. flat-table:: CEC Versions | 225 | .. flat-table:: CEC Versions |
diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst index 7a6d6d00ce19..2e1e73928396 100644 --- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst +++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst | |||
@@ -64,7 +64,8 @@ it is guaranteed that the state did change in between the two events. | |||
64 | 64 | ||
65 | - ``phys_addr`` | 65 | - ``phys_addr`` |
66 | 66 | ||
67 | - The current physical address. | 67 | - The current physical address. This is ``CEC_PHYS_ADDR_INVALID`` if no |
68 | valid physical address is set. | ||
68 | 69 | ||
69 | - .. row 2 | 70 | - .. row 2 |
70 | 71 | ||
@@ -72,7 +73,10 @@ it is guaranteed that the state did change in between the two events. | |||
72 | 73 | ||
73 | - ``log_addr_mask`` | 74 | - ``log_addr_mask`` |
74 | 75 | ||
75 | - The current set of claimed logical addresses. | 76 | - The current set of claimed logical addresses. This is 0 if no logical |
77 | addresses are claimed or if ``phys_addr`` is ``CEC_PHYS_ADDR_INVALID``. | ||
78 | If bit 15 is set (``1 << CEC_LOG_ADDR_UNREGISTERED``) then this device | ||
79 | has the unregistered logical address. In that case all other bits are 0. | ||
76 | 80 | ||
77 | 81 | ||
78 | 82 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 6781a3febd59..01bff8ea28d8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1625,6 +1625,7 @@ N: rockchip | |||
1625 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES | 1625 | ARM/SAMSUNG EXYNOS ARM ARCHITECTURES |
1626 | M: Kukjin Kim <kgene@kernel.org> | 1626 | M: Kukjin Kim <kgene@kernel.org> |
1627 | M: Krzysztof Kozlowski <krzk@kernel.org> | 1627 | M: Krzysztof Kozlowski <krzk@kernel.org> |
1628 | R: Javier Martinez Canillas <javier@osg.samsung.com> | ||
1628 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1629 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1629 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | 1630 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) |
1630 | S: Maintained | 1631 | S: Maintained |
@@ -2485,7 +2486,7 @@ F: include/net/bluetooth/ | |||
2485 | BONDING DRIVER | 2486 | BONDING DRIVER |
2486 | M: Jay Vosburgh <j.vosburgh@gmail.com> | 2487 | M: Jay Vosburgh <j.vosburgh@gmail.com> |
2487 | M: Veaceslav Falico <vfalico@gmail.com> | 2488 | M: Veaceslav Falico <vfalico@gmail.com> |
2488 | M: Andy Gospodarek <gospo@cumulusnetworks.com> | 2489 | M: Andy Gospodarek <andy@greyhouse.net> |
2489 | L: netdev@vger.kernel.org | 2490 | L: netdev@vger.kernel.org |
2490 | W: http://sourceforge.net/projects/bonding/ | 2491 | W: http://sourceforge.net/projects/bonding/ |
2491 | S: Supported | 2492 | S: Supported |
@@ -2500,7 +2501,7 @@ S: Supported | |||
2500 | F: kernel/bpf/ | 2501 | F: kernel/bpf/ |
2501 | 2502 | ||
2502 | BROADCOM B44 10/100 ETHERNET DRIVER | 2503 | BROADCOM B44 10/100 ETHERNET DRIVER |
2503 | M: Gary Zambrano <zambrano@broadcom.com> | 2504 | M: Michael Chan <michael.chan@broadcom.com> |
2504 | L: netdev@vger.kernel.org | 2505 | L: netdev@vger.kernel.org |
2505 | S: Supported | 2506 | S: Supported |
2506 | F: drivers/net/ethernet/broadcom/b44.* | 2507 | F: drivers/net/ethernet/broadcom/b44.* |
@@ -3269,7 +3270,7 @@ S: Maintained | |||
3269 | F: drivers/net/wan/cosa* | 3270 | F: drivers/net/wan/cosa* |
3270 | 3271 | ||
3271 | CPMAC ETHERNET DRIVER | 3272 | CPMAC ETHERNET DRIVER |
3272 | M: Florian Fainelli <florian@openwrt.org> | 3273 | M: Florian Fainelli <f.fainelli@gmail.com> |
3273 | L: netdev@vger.kernel.org | 3274 | L: netdev@vger.kernel.org |
3274 | S: Maintained | 3275 | S: Maintained |
3275 | F: drivers/net/ethernet/ti/cpmac.c | 3276 | F: drivers/net/ethernet/ti/cpmac.c |
@@ -6102,7 +6103,7 @@ S: Supported | |||
6102 | F: drivers/cpufreq/intel_pstate.c | 6103 | F: drivers/cpufreq/intel_pstate.c |
6103 | 6104 | ||
6104 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) | 6105 | INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) |
6105 | M: Maik Broemme <mbroemme@plusserver.de> | 6106 | M: Maik Broemme <mbroemme@libmpq.org> |
6106 | L: linux-fbdev@vger.kernel.org | 6107 | L: linux-fbdev@vger.kernel.org |
6107 | S: Maintained | 6108 | S: Maintained |
6108 | F: Documentation/fb/intelfb.txt | 6109 | F: Documentation/fb/intelfb.txt |
@@ -8160,6 +8161,15 @@ S: Maintained | |||
8160 | W: https://fedorahosted.org/dropwatch/ | 8161 | W: https://fedorahosted.org/dropwatch/ |
8161 | F: net/core/drop_monitor.c | 8162 | F: net/core/drop_monitor.c |
8162 | 8163 | ||
8164 | NETWORKING [DSA] | ||
8165 | M: Andrew Lunn <andrew@lunn.ch> | ||
8166 | M: Vivien Didelot <vivien.didelot@savoirfairelinux.com> | ||
8167 | M: Florian Fainelli <f.fainelli@gmail.com> | ||
8168 | S: Maintained | ||
8169 | F: net/dsa/ | ||
8170 | F: include/net/dsa.h | ||
8171 | F: drivers/net/dsa/ | ||
8172 | |||
8163 | NETWORKING [GENERAL] | 8173 | NETWORKING [GENERAL] |
8164 | M: "David S. Miller" <davem@davemloft.net> | 8174 | M: "David S. Miller" <davem@davemloft.net> |
8165 | L: netdev@vger.kernel.org | 8175 | L: netdev@vger.kernel.org |
@@ -12568,7 +12578,7 @@ F: include/linux/if_*vlan.h | |||
12568 | F: net/8021q/ | 12578 | F: net/8021q/ |
12569 | 12579 | ||
12570 | VLYNQ BUS | 12580 | VLYNQ BUS |
12571 | M: Florian Fainelli <florian@openwrt.org> | 12581 | M: Florian Fainelli <f.fainelli@gmail.com> |
12572 | L: openwrt-devel@lists.openwrt.org (subscribers-only) | 12582 | L: openwrt-devel@lists.openwrt.org (subscribers-only) |
12573 | S: Maintained | 12583 | S: Maintained |
12574 | F: drivers/vlynq/vlynq.c | 12584 | F: drivers/vlynq/vlynq.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 8 | 2 | PATCHLEVEL = 8 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc8 |
5 | NAME = Psychotic Stoned Sheep | 5 | NAME = Psychotic Stoned Sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/include/asm/uaccess.h b/arch/alpha/include/asm/uaccess.h index c419b43c461d..466e42e96bfa 100644 --- a/arch/alpha/include/asm/uaccess.h +++ b/arch/alpha/include/asm/uaccess.h | |||
@@ -371,14 +371,6 @@ __copy_tofrom_user_nocheck(void *to, const void *from, long len) | |||
371 | return __cu_len; | 371 | return __cu_len; |
372 | } | 372 | } |
373 | 373 | ||
374 | extern inline long | ||
375 | __copy_tofrom_user(void *to, const void *from, long len, const void __user *validate) | ||
376 | { | ||
377 | if (__access_ok((unsigned long)validate, len, get_fs())) | ||
378 | len = __copy_tofrom_user_nocheck(to, from, len); | ||
379 | return len; | ||
380 | } | ||
381 | |||
382 | #define __copy_to_user(to, from, n) \ | 374 | #define __copy_to_user(to, from, n) \ |
383 | ({ \ | 375 | ({ \ |
384 | __chk_user_ptr(to); \ | 376 | __chk_user_ptr(to); \ |
@@ -393,17 +385,22 @@ __copy_tofrom_user(void *to, const void *from, long len, const void __user *vali | |||
393 | #define __copy_to_user_inatomic __copy_to_user | 385 | #define __copy_to_user_inatomic __copy_to_user |
394 | #define __copy_from_user_inatomic __copy_from_user | 386 | #define __copy_from_user_inatomic __copy_from_user |
395 | 387 | ||
396 | |||
397 | extern inline long | 388 | extern inline long |
398 | copy_to_user(void __user *to, const void *from, long n) | 389 | copy_to_user(void __user *to, const void *from, long n) |
399 | { | 390 | { |
400 | return __copy_tofrom_user((__force void *)to, from, n, to); | 391 | if (likely(__access_ok((unsigned long)to, n, get_fs()))) |
392 | n = __copy_tofrom_user_nocheck((__force void *)to, from, n); | ||
393 | return n; | ||
401 | } | 394 | } |
402 | 395 | ||
403 | extern inline long | 396 | extern inline long |
404 | copy_from_user(void *to, const void __user *from, long n) | 397 | copy_from_user(void *to, const void __user *from, long n) |
405 | { | 398 | { |
406 | return __copy_tofrom_user(to, (__force void *)from, n, from); | 399 | if (likely(__access_ok((unsigned long)from, n, get_fs()))) |
400 | n = __copy_tofrom_user_nocheck(to, (__force void *)from, n); | ||
401 | else | ||
402 | memset(to, 0, n); | ||
403 | return n; | ||
407 | } | 404 | } |
408 | 405 | ||
409 | extern void __do_clear_user(void); | 406 | extern void __do_clear_user(void); |
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index a78d5670884f..41faf17cd28d 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h | |||
@@ -83,7 +83,10 @@ | |||
83 | "2: ;nop\n" \ | 83 | "2: ;nop\n" \ |
84 | " .section .fixup, \"ax\"\n" \ | 84 | " .section .fixup, \"ax\"\n" \ |
85 | " .align 4\n" \ | 85 | " .align 4\n" \ |
86 | "3: mov %0, %3\n" \ | 86 | "3: # return -EFAULT\n" \ |
87 | " mov %0, %3\n" \ | ||
88 | " # zero out dst ptr\n" \ | ||
89 | " mov %1, 0\n" \ | ||
87 | " j 2b\n" \ | 90 | " j 2b\n" \ |
88 | " .previous\n" \ | 91 | " .previous\n" \ |
89 | " .section __ex_table, \"a\"\n" \ | 92 | " .section __ex_table, \"a\"\n" \ |
@@ -101,7 +104,11 @@ | |||
101 | "2: ;nop\n" \ | 104 | "2: ;nop\n" \ |
102 | " .section .fixup, \"ax\"\n" \ | 105 | " .section .fixup, \"ax\"\n" \ |
103 | " .align 4\n" \ | 106 | " .align 4\n" \ |
104 | "3: mov %0, %3\n" \ | 107 | "3: # return -EFAULT\n" \ |
108 | " mov %0, %3\n" \ | ||
109 | " # zero out dst ptr\n" \ | ||
110 | " mov %1, 0\n" \ | ||
111 | " mov %R1, 0\n" \ | ||
105 | " j 2b\n" \ | 112 | " j 2b\n" \ |
106 | " .previous\n" \ | 113 | " .previous\n" \ |
107 | " .section __ex_table, \"a\"\n" \ | 114 | " .section __ex_table, \"a\"\n" \ |
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi index caf2707680c1..e9b47b2bbc33 100644 --- a/arch/arm/boot/dts/bcm2835-rpi.dtsi +++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | / { | 3 | / { |
4 | memory { | 4 | memory { |
5 | device_type = "memory"; | ||
5 | reg = <0 0x10000000>; | 6 | reg = <0 0x10000000>; |
6 | }; | 7 | }; |
7 | 8 | ||
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi index b98252232d20..445624a1a1de 100644 --- a/arch/arm/boot/dts/bcm283x.dtsi +++ b/arch/arm/boot/dts/bcm283x.dtsi | |||
@@ -2,7 +2,6 @@ | |||
2 | #include <dt-bindings/clock/bcm2835.h> | 2 | #include <dt-bindings/clock/bcm2835.h> |
3 | #include <dt-bindings/clock/bcm2835-aux.h> | 3 | #include <dt-bindings/clock/bcm2835-aux.h> |
4 | #include <dt-bindings/gpio/gpio.h> | 4 | #include <dt-bindings/gpio/gpio.h> |
5 | #include "skeleton.dtsi" | ||
6 | 5 | ||
7 | /* This include file covers the common peripherals and configuration between | 6 | /* This include file covers the common peripherals and configuration between |
8 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to | 7 | * bcm2835 and bcm2836 implementations, leaving the CPU configuration to |
@@ -13,6 +12,8 @@ | |||
13 | compatible = "brcm,bcm2835"; | 12 | compatible = "brcm,bcm2835"; |
14 | model = "BCM2835"; | 13 | model = "BCM2835"; |
15 | interrupt-parent = <&intc>; | 14 | interrupt-parent = <&intc>; |
15 | #address-cells = <1>; | ||
16 | #size-cells = <1>; | ||
16 | 17 | ||
17 | chosen { | 18 | chosen { |
18 | bootargs = "earlyprintk console=ttyAMA0"; | 19 | bootargs = "earlyprintk console=ttyAMA0"; |
diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi index d294e82447a2..8b063ab10c19 100644 --- a/arch/arm/boot/dts/stih407-family.dtsi +++ b/arch/arm/boot/dts/stih407-family.dtsi | |||
@@ -550,8 +550,9 @@ | |||
550 | interrupt-names = "mmcirq"; | 550 | interrupt-names = "mmcirq"; |
551 | pinctrl-names = "default"; | 551 | pinctrl-names = "default"; |
552 | pinctrl-0 = <&pinctrl_mmc0>; | 552 | pinctrl-0 = <&pinctrl_mmc0>; |
553 | clock-names = "mmc"; | 553 | clock-names = "mmc", "icn"; |
554 | clocks = <&clk_s_c0_flexgen CLK_MMC_0>; | 554 | clocks = <&clk_s_c0_flexgen CLK_MMC_0>, |
555 | <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; | ||
555 | bus-width = <8>; | 556 | bus-width = <8>; |
556 | non-removable; | 557 | non-removable; |
557 | }; | 558 | }; |
@@ -565,8 +566,9 @@ | |||
565 | interrupt-names = "mmcirq"; | 566 | interrupt-names = "mmcirq"; |
566 | pinctrl-names = "default"; | 567 | pinctrl-names = "default"; |
567 | pinctrl-0 = <&pinctrl_sd1>; | 568 | pinctrl-0 = <&pinctrl_sd1>; |
568 | clock-names = "mmc"; | 569 | clock-names = "mmc", "icn"; |
569 | clocks = <&clk_s_c0_flexgen CLK_MMC_1>; | 570 | clocks = <&clk_s_c0_flexgen CLK_MMC_1>, |
571 | <&clk_s_c0_flexgen CLK_RX_ICN_HVA>; | ||
570 | resets = <&softreset STIH407_MMC1_SOFTRESET>; | 572 | resets = <&softreset STIH407_MMC1_SOFTRESET>; |
571 | bus-width = <4>; | 573 | bus-width = <4>; |
572 | }; | 574 | }; |
diff --git a/arch/arm/boot/dts/stih410.dtsi b/arch/arm/boot/dts/stih410.dtsi index 18ed1ad10d32..40318869c733 100644 --- a/arch/arm/boot/dts/stih410.dtsi +++ b/arch/arm/boot/dts/stih410.dtsi | |||
@@ -41,7 +41,8 @@ | |||
41 | compatible = "st,st-ohci-300x"; | 41 | compatible = "st,st-ohci-300x"; |
42 | reg = <0x9a03c00 0x100>; | 42 | reg = <0x9a03c00 0x100>; |
43 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; | 43 | interrupts = <GIC_SPI 180 IRQ_TYPE_NONE>; |
44 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 44 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
45 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
45 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | 46 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
46 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | 47 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
47 | reset-names = "power", "softreset"; | 48 | reset-names = "power", "softreset"; |
@@ -57,7 +58,8 @@ | |||
57 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; | 58 | interrupts = <GIC_SPI 151 IRQ_TYPE_NONE>; |
58 | pinctrl-names = "default"; | 59 | pinctrl-names = "default"; |
59 | pinctrl-0 = <&pinctrl_usb0>; | 60 | pinctrl-0 = <&pinctrl_usb0>; |
60 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 61 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
62 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
61 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, | 63 | resets = <&powerdown STIH407_USB2_PORT0_POWERDOWN>, |
62 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; | 64 | <&softreset STIH407_USB2_PORT0_SOFTRESET>; |
63 | reset-names = "power", "softreset"; | 65 | reset-names = "power", "softreset"; |
@@ -71,7 +73,8 @@ | |||
71 | compatible = "st,st-ohci-300x"; | 73 | compatible = "st,st-ohci-300x"; |
72 | reg = <0x9a83c00 0x100>; | 74 | reg = <0x9a83c00 0x100>; |
73 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; | 75 | interrupts = <GIC_SPI 181 IRQ_TYPE_NONE>; |
74 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 76 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
77 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
75 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | 78 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
76 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | 79 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
77 | reset-names = "power", "softreset"; | 80 | reset-names = "power", "softreset"; |
@@ -87,7 +90,8 @@ | |||
87 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; | 90 | interrupts = <GIC_SPI 153 IRQ_TYPE_NONE>; |
88 | pinctrl-names = "default"; | 91 | pinctrl-names = "default"; |
89 | pinctrl-0 = <&pinctrl_usb1>; | 92 | pinctrl-0 = <&pinctrl_usb1>; |
90 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>; | 93 | clocks = <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>, |
94 | <&clk_s_c0_flexgen CLK_RX_ICN_DISP_0>; | ||
91 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, | 95 | resets = <&powerdown STIH407_USB2_PORT1_POWERDOWN>, |
92 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; | 96 | <&softreset STIH407_USB2_PORT1_SOFTRESET>; |
93 | reset-names = "power", "softreset"; | 97 | reset-names = "power", "softreset"; |
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c index 0e97b4b871f9..6c7b06854fce 100644 --- a/arch/arm/common/locomo.c +++ b/arch/arm/common/locomo.c | |||
@@ -140,7 +140,7 @@ static struct locomo_dev_info locomo_devices[] = { | |||
140 | 140 | ||
141 | static void locomo_handler(struct irq_desc *desc) | 141 | static void locomo_handler(struct irq_desc *desc) |
142 | { | 142 | { |
143 | struct locomo *lchip = irq_desc_get_chip_data(desc); | 143 | struct locomo *lchip = irq_desc_get_handler_data(desc); |
144 | int req, i; | 144 | int req, i; |
145 | 145 | ||
146 | /* Acknowledge the parent IRQ */ | 146 | /* Acknowledge the parent IRQ */ |
@@ -200,8 +200,7 @@ static void locomo_setup_irq(struct locomo *lchip) | |||
200 | * Install handler for IRQ_LOCOMO_HW. | 200 | * Install handler for IRQ_LOCOMO_HW. |
201 | */ | 201 | */ |
202 | irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); | 202 | irq_set_irq_type(lchip->irq, IRQ_TYPE_EDGE_FALLING); |
203 | irq_set_chip_data(lchip->irq, lchip); | 203 | irq_set_chained_handler_and_data(lchip->irq, locomo_handler, lchip); |
204 | irq_set_chained_handler(lchip->irq, locomo_handler); | ||
205 | 204 | ||
206 | /* Install handlers for IRQ_LOCOMO_* */ | 205 | /* Install handlers for IRQ_LOCOMO_* */ |
207 | for ( ; irq <= lchip->irq_base + 3; irq++) { | 206 | for ( ; irq <= lchip->irq_base + 3; irq++) { |
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index fb0a0a4dfea4..2e076c492005 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
@@ -472,8 +472,8 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base) | |||
472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. | 472 | * specifies that S0ReadyInt and S1ReadyInt should be '1'. |
473 | */ | 473 | */ |
474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); | 474 | sa1111_writel(0, irqbase + SA1111_INTPOL0); |
475 | sa1111_writel(SA1111_IRQMASK_HI(IRQ_S0_READY_NINT) | | 475 | sa1111_writel(BIT(IRQ_S0_READY_NINT & 31) | |
476 | SA1111_IRQMASK_HI(IRQ_S1_READY_NINT), | 476 | BIT(IRQ_S1_READY_NINT & 31), |
477 | irqbase + SA1111_INTPOL1); | 477 | irqbase + SA1111_INTPOL1); |
478 | 478 | ||
479 | /* clear all IRQs */ | 479 | /* clear all IRQs */ |
@@ -754,7 +754,7 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
754 | if (sachip->irq != NO_IRQ) { | 754 | if (sachip->irq != NO_IRQ) { |
755 | ret = sa1111_setup_irq(sachip, pd->irq_base); | 755 | ret = sa1111_setup_irq(sachip, pd->irq_base); |
756 | if (ret) | 756 | if (ret) |
757 | goto err_unmap; | 757 | goto err_clk; |
758 | } | 758 | } |
759 | 759 | ||
760 | #ifdef CONFIG_ARCH_SA1100 | 760 | #ifdef CONFIG_ARCH_SA1100 |
@@ -799,6 +799,8 @@ static int __sa1111_probe(struct device *me, struct resource *mem, int irq) | |||
799 | 799 | ||
800 | return 0; | 800 | return 0; |
801 | 801 | ||
802 | err_clk: | ||
803 | clk_disable(sachip->clk); | ||
802 | err_unmap: | 804 | err_unmap: |
803 | iounmap(sachip->base); | 805 | iounmap(sachip->base); |
804 | err_clk_unprep: | 806 | err_clk_unprep: |
@@ -869,9 +871,9 @@ struct sa1111_save_data { | |||
869 | 871 | ||
870 | #ifdef CONFIG_PM | 872 | #ifdef CONFIG_PM |
871 | 873 | ||
872 | static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | 874 | static int sa1111_suspend_noirq(struct device *dev) |
873 | { | 875 | { |
874 | struct sa1111 *sachip = platform_get_drvdata(dev); | 876 | struct sa1111 *sachip = dev_get_drvdata(dev); |
875 | struct sa1111_save_data *save; | 877 | struct sa1111_save_data *save; |
876 | unsigned long flags; | 878 | unsigned long flags; |
877 | unsigned int val; | 879 | unsigned int val; |
@@ -934,9 +936,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state) | |||
934 | * restored by their respective drivers, and must be called | 936 | * restored by their respective drivers, and must be called |
935 | * via LDM after this function. | 937 | * via LDM after this function. |
936 | */ | 938 | */ |
937 | static int sa1111_resume(struct platform_device *dev) | 939 | static int sa1111_resume_noirq(struct device *dev) |
938 | { | 940 | { |
939 | struct sa1111 *sachip = platform_get_drvdata(dev); | 941 | struct sa1111 *sachip = dev_get_drvdata(dev); |
940 | struct sa1111_save_data *save; | 942 | struct sa1111_save_data *save; |
941 | unsigned long flags, id; | 943 | unsigned long flags, id; |
942 | void __iomem *base; | 944 | void __iomem *base; |
@@ -952,7 +954,7 @@ static int sa1111_resume(struct platform_device *dev) | |||
952 | id = sa1111_readl(sachip->base + SA1111_SKID); | 954 | id = sa1111_readl(sachip->base + SA1111_SKID); |
953 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { | 955 | if ((id & SKID_ID_MASK) != SKID_SA1111_ID) { |
954 | __sa1111_remove(sachip); | 956 | __sa1111_remove(sachip); |
955 | platform_set_drvdata(dev, NULL); | 957 | dev_set_drvdata(dev, NULL); |
956 | kfree(save); | 958 | kfree(save); |
957 | return 0; | 959 | return 0; |
958 | } | 960 | } |
@@ -1003,8 +1005,8 @@ static int sa1111_resume(struct platform_device *dev) | |||
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | #else | 1007 | #else |
1006 | #define sa1111_suspend NULL | 1008 | #define sa1111_suspend_noirq NULL |
1007 | #define sa1111_resume NULL | 1009 | #define sa1111_resume_noirq NULL |
1008 | #endif | 1010 | #endif |
1009 | 1011 | ||
1010 | static int sa1111_probe(struct platform_device *pdev) | 1012 | static int sa1111_probe(struct platform_device *pdev) |
@@ -1017,7 +1019,7 @@ static int sa1111_probe(struct platform_device *pdev) | |||
1017 | return -EINVAL; | 1019 | return -EINVAL; |
1018 | irq = platform_get_irq(pdev, 0); | 1020 | irq = platform_get_irq(pdev, 0); |
1019 | if (irq < 0) | 1021 | if (irq < 0) |
1020 | return -ENXIO; | 1022 | return irq; |
1021 | 1023 | ||
1022 | return __sa1111_probe(&pdev->dev, mem, irq); | 1024 | return __sa1111_probe(&pdev->dev, mem, irq); |
1023 | } | 1025 | } |
@@ -1038,6 +1040,11 @@ static int sa1111_remove(struct platform_device *pdev) | |||
1038 | return 0; | 1040 | return 0; |
1039 | } | 1041 | } |
1040 | 1042 | ||
1043 | static struct dev_pm_ops sa1111_pm_ops = { | ||
1044 | .suspend_noirq = sa1111_suspend_noirq, | ||
1045 | .resume_noirq = sa1111_resume_noirq, | ||
1046 | }; | ||
1047 | |||
1041 | /* | 1048 | /* |
1042 | * Not sure if this should be on the system bus or not yet. | 1049 | * Not sure if this should be on the system bus or not yet. |
1043 | * We really want some way to register a system device at | 1050 | * We really want some way to register a system device at |
@@ -1050,10 +1057,9 @@ static int sa1111_remove(struct platform_device *pdev) | |||
1050 | static struct platform_driver sa1111_device_driver = { | 1057 | static struct platform_driver sa1111_device_driver = { |
1051 | .probe = sa1111_probe, | 1058 | .probe = sa1111_probe, |
1052 | .remove = sa1111_remove, | 1059 | .remove = sa1111_remove, |
1053 | .suspend = sa1111_suspend, | ||
1054 | .resume = sa1111_resume, | ||
1055 | .driver = { | 1060 | .driver = { |
1056 | .name = "sa1111", | 1061 | .name = "sa1111", |
1062 | .pm = &sa1111_pm_ops, | ||
1057 | }, | 1063 | }, |
1058 | }; | 1064 | }; |
1059 | 1065 | ||
diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig index 71b42e66488a..78cd2f197e01 100644 --- a/arch/arm/configs/keystone_defconfig +++ b/arch/arm/configs/keystone_defconfig | |||
@@ -161,6 +161,7 @@ CONFIG_USB_MON=y | |||
161 | CONFIG_USB_XHCI_HCD=y | 161 | CONFIG_USB_XHCI_HCD=y |
162 | CONFIG_USB_STORAGE=y | 162 | CONFIG_USB_STORAGE=y |
163 | CONFIG_USB_DWC3=y | 163 | CONFIG_USB_DWC3=y |
164 | CONFIG_NOP_USB_XCEIV=y | ||
164 | CONFIG_KEYSTONE_USB_PHY=y | 165 | CONFIG_KEYSTONE_USB_PHY=y |
165 | CONFIG_NEW_LEDS=y | 166 | CONFIG_NEW_LEDS=y |
166 | CONFIG_LEDS_CLASS=y | 167 | CONFIG_LEDS_CLASS=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 2c8665cd9dc5..ea3566fb92e2 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -781,7 +781,7 @@ CONFIG_MXS_DMA=y | |||
781 | CONFIG_DMA_BCM2835=y | 781 | CONFIG_DMA_BCM2835=y |
782 | CONFIG_DMA_OMAP=y | 782 | CONFIG_DMA_OMAP=y |
783 | CONFIG_QCOM_BAM_DMA=y | 783 | CONFIG_QCOM_BAM_DMA=y |
784 | CONFIG_XILINX_VDMA=y | 784 | CONFIG_XILINX_DMA=y |
785 | CONFIG_DMA_SUN6I=y | 785 | CONFIG_DMA_SUN6I=y |
786 | CONFIG_STAGING=y | 786 | CONFIG_STAGING=y |
787 | CONFIG_SENSORS_ISL29018=y | 787 | CONFIG_SENSORS_ISL29018=y |
diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index da3c0428507b..aef022a87c53 100644 --- a/arch/arm/crypto/aes-ce-glue.c +++ b/arch/arm/crypto/aes-ce-glue.c | |||
@@ -284,7 +284,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
284 | err = blkcipher_walk_done(desc, &walk, | 284 | err = blkcipher_walk_done(desc, &walk, |
285 | walk.nbytes % AES_BLOCK_SIZE); | 285 | walk.nbytes % AES_BLOCK_SIZE); |
286 | } | 286 | } |
287 | if (nbytes) { | 287 | if (walk.nbytes % AES_BLOCK_SIZE) { |
288 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; | 288 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; |
289 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; | 289 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; |
290 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; | 290 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; |
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h index d0131ee6f6af..3f82e9da7cec 100644 --- a/arch/arm/include/asm/pgtable-2level-hwdef.h +++ b/arch/arm/include/asm/pgtable-2level-hwdef.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | 47 | #define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) |
48 | #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) | 48 | #define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE) |
49 | #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | 49 | #define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) |
50 | #define PMD_SECT_CACHE_MASK (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE) | ||
50 | #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) | 51 | #define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2)) |
51 | 52 | ||
52 | /* | 53 | /* |
diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h index f8f1cff62065..4cd664abfcd3 100644 --- a/arch/arm/include/asm/pgtable-3level-hwdef.h +++ b/arch/arm/include/asm/pgtable-3level-hwdef.h | |||
@@ -62,6 +62,7 @@ | |||
62 | #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ | 62 | #define PMD_SECT_WT (_AT(pmdval_t, 2) << 2) /* normal inner write-through */ |
63 | #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ | 63 | #define PMD_SECT_WB (_AT(pmdval_t, 3) << 2) /* normal inner write-back */ |
64 | #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ | 64 | #define PMD_SECT_WBWA (_AT(pmdval_t, 7) << 2) /* normal inner write-alloc */ |
65 | #define PMD_SECT_CACHE_MASK (_AT(pmdval_t, 7) << 2) | ||
65 | 66 | ||
66 | /* | 67 | /* |
67 | * + Level 3 descriptor (PTE) | 68 | * + Level 3 descriptor (PTE) |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 75f130ef6504..c94b90d43772 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -158,8 +158,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
158 | { | 158 | { |
159 | int i; | 159 | int i; |
160 | 160 | ||
161 | kvm_free_stage2_pgd(kvm); | ||
162 | |||
163 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | 161 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { |
164 | if (kvm->vcpus[i]) { | 162 | if (kvm->vcpus[i]) { |
165 | kvm_arch_vcpu_free(kvm->vcpus[i]); | 163 | kvm_arch_vcpu_free(kvm->vcpus[i]); |
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 29d0b23af2a9..e9a5c0e0c115 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
@@ -1714,7 +1714,8 @@ int kvm_mmu_init(void) | |||
1714 | kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); | 1714 | kern_hyp_va(PAGE_OFFSET), kern_hyp_va(~0UL)); |
1715 | 1715 | ||
1716 | if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && | 1716 | if (hyp_idmap_start >= kern_hyp_va(PAGE_OFFSET) && |
1717 | hyp_idmap_start < kern_hyp_va(~0UL)) { | 1717 | hyp_idmap_start < kern_hyp_va(~0UL) && |
1718 | hyp_idmap_start != (unsigned long)__hyp_idmap_text_start) { | ||
1718 | /* | 1719 | /* |
1719 | * The idmap page is intersecting with the VA space, | 1720 | * The idmap page is intersecting with the VA space, |
1720 | * it is not safe to continue further. | 1721 | * it is not safe to continue further. |
@@ -1893,6 +1894,7 @@ void kvm_arch_memslots_updated(struct kvm *kvm, struct kvm_memslots *slots) | |||
1893 | 1894 | ||
1894 | void kvm_arch_flush_shadow_all(struct kvm *kvm) | 1895 | void kvm_arch_flush_shadow_all(struct kvm *kvm) |
1895 | { | 1896 | { |
1897 | kvm_free_stage2_pgd(kvm); | ||
1896 | } | 1898 | } |
1897 | 1899 | ||
1898 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, | 1900 | void kvm_arch_flush_shadow_memslot(struct kvm *kvm, |
diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 3750575c73c5..06332f626565 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c | |||
@@ -255,6 +255,12 @@ static int __init exynos_pmu_irq_init(struct device_node *node, | |||
255 | return -ENOMEM; | 255 | return -ENOMEM; |
256 | } | 256 | } |
257 | 257 | ||
258 | /* | ||
259 | * Clear the OF_POPULATED flag set in of_irq_init so that | ||
260 | * later the Exynos PMU platform device won't be skipped. | ||
261 | */ | ||
262 | of_node_clear_flag(node, OF_POPULATED); | ||
263 | |||
258 | return 0; | 264 | return 0; |
259 | } | 265 | } |
260 | 266 | ||
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index 7245f3359564..d6159f8ef0c2 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -137,6 +137,18 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = { | |||
137 | // no D+ pullup; lubbock can't connect/disconnect in software | 137 | // no D+ pullup; lubbock can't connect/disconnect in software |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static void lubbock_init_pcmcia(void) | ||
141 | { | ||
142 | struct clk *clk; | ||
143 | |||
144 | /* Add an alias for the SA1111 PCMCIA clock */ | ||
145 | clk = clk_get_sys("pxa2xx-pcmcia", NULL); | ||
146 | if (!IS_ERR(clk)) { | ||
147 | clkdev_create(clk, NULL, "1800"); | ||
148 | clk_put(clk); | ||
149 | } | ||
150 | } | ||
151 | |||
140 | static struct resource sa1111_resources[] = { | 152 | static struct resource sa1111_resources[] = { |
141 | [0] = { | 153 | [0] = { |
142 | .start = 0x10000000, | 154 | .start = 0x10000000, |
@@ -467,6 +479,8 @@ static void __init lubbock_init(void) | |||
467 | pxa_set_btuart_info(NULL); | 479 | pxa_set_btuart_info(NULL); |
468 | pxa_set_stuart_info(NULL); | 480 | pxa_set_stuart_info(NULL); |
469 | 481 | ||
482 | lubbock_init_pcmcia(); | ||
483 | |||
470 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); | 484 | clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); |
471 | pxa_set_udc_info(&udc_info); | 485 | pxa_set_udc_info(&udc_info); |
472 | pxa_set_fb_info(NULL, &sharp_lm8v31); | 486 | pxa_set_fb_info(NULL, &sharp_lm8v31); |
diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c index 62437b57813e..73e3adbc1330 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | |||
@@ -41,39 +41,26 @@ | |||
41 | 41 | ||
42 | #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ | 42 | #define REGULATOR_IRQ_MASK BIT(2) /* IRQ2, active low */ |
43 | 43 | ||
44 | static void __iomem *irqc; | 44 | /* start of DA9210 System Control and Event Registers */ |
45 | |||
46 | static const u8 da9063_mask_regs[] = { | ||
47 | DA9063_REG_IRQ_MASK_A, | ||
48 | DA9063_REG_IRQ_MASK_B, | ||
49 | DA9063_REG_IRQ_MASK_C, | ||
50 | DA9063_REG_IRQ_MASK_D, | ||
51 | }; | ||
52 | |||
53 | /* DA9210 System Control and Event Registers */ | ||
54 | #define DA9210_REG_MASK_A 0x54 | 45 | #define DA9210_REG_MASK_A 0x54 |
55 | #define DA9210_REG_MASK_B 0x55 | ||
56 | |||
57 | static const u8 da9210_mask_regs[] = { | ||
58 | DA9210_REG_MASK_A, | ||
59 | DA9210_REG_MASK_B, | ||
60 | }; | ||
61 | |||
62 | static void da9xxx_mask_irqs(struct i2c_client *client, const u8 regs[], | ||
63 | unsigned int nregs) | ||
64 | { | ||
65 | unsigned int i; | ||
66 | 46 | ||
67 | dev_info(&client->dev, "Masking %s interrupt sources\n", client->name); | 47 | static void __iomem *irqc; |
68 | 48 | ||
69 | for (i = 0; i < nregs; i++) { | 49 | /* first byte sets the memory pointer, following are consecutive reg values */ |
70 | int error = i2c_smbus_write_byte_data(client, regs[i], ~0); | 50 | static u8 da9063_irq_clr[] = { DA9063_REG_IRQ_MASK_A, 0xff, 0xff, 0xff, 0xff }; |
71 | if (error) { | 51 | static u8 da9210_irq_clr[] = { DA9210_REG_MASK_A, 0xff, 0xff }; |
72 | dev_err(&client->dev, "i2c error %d\n", error); | 52 | |
73 | return; | 53 | static struct i2c_msg da9xxx_msgs[2] = { |
74 | } | 54 | { |
75 | } | 55 | .addr = 0x58, |
76 | } | 56 | .len = ARRAY_SIZE(da9063_irq_clr), |
57 | .buf = da9063_irq_clr, | ||
58 | }, { | ||
59 | .addr = 0x68, | ||
60 | .len = ARRAY_SIZE(da9210_irq_clr), | ||
61 | .buf = da9210_irq_clr, | ||
62 | }, | ||
63 | }; | ||
77 | 64 | ||
78 | static int regulator_quirk_notify(struct notifier_block *nb, | 65 | static int regulator_quirk_notify(struct notifier_block *nb, |
79 | unsigned long action, void *data) | 66 | unsigned long action, void *data) |
@@ -93,12 +80,15 @@ static int regulator_quirk_notify(struct notifier_block *nb, | |||
93 | client = to_i2c_client(dev); | 80 | client = to_i2c_client(dev); |
94 | dev_dbg(dev, "Detected %s\n", client->name); | 81 | dev_dbg(dev, "Detected %s\n", client->name); |
95 | 82 | ||
96 | if ((client->addr == 0x58 && !strcmp(client->name, "da9063"))) | 83 | if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) || |
97 | da9xxx_mask_irqs(client, da9063_mask_regs, | 84 | (client->addr == 0x68 && !strcmp(client->name, "da9210"))) { |
98 | ARRAY_SIZE(da9063_mask_regs)); | 85 | int ret; |
99 | else if (client->addr == 0x68 && !strcmp(client->name, "da9210")) | 86 | |
100 | da9xxx_mask_irqs(client, da9210_mask_regs, | 87 | dev_info(&client->dev, "clearing da9063/da9210 interrupts\n"); |
101 | ARRAY_SIZE(da9210_mask_regs)); | 88 | ret = i2c_transfer(client->adapter, da9xxx_msgs, ARRAY_SIZE(da9xxx_msgs)); |
89 | if (ret != ARRAY_SIZE(da9xxx_msgs)) | ||
90 | dev_err(&client->dev, "i2c error %d\n", ret); | ||
91 | } | ||
102 | 92 | ||
103 | mon = ioread32(irqc + IRQC_MONITOR); | 93 | mon = ioread32(irqc + IRQC_MONITOR); |
104 | if (mon & REGULATOR_IRQ_MASK) | 94 | if (mon & REGULATOR_IRQ_MASK) |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 6344913f0804..30fe03f95c85 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -137,7 +137,7 @@ void __init init_default_cache_policy(unsigned long pmd) | |||
137 | 137 | ||
138 | initial_pmd_value = pmd; | 138 | initial_pmd_value = pmd; |
139 | 139 | ||
140 | pmd &= PMD_SECT_TEX(1) | PMD_SECT_BUFFERABLE | PMD_SECT_CACHEABLE; | 140 | pmd &= PMD_SECT_CACHE_MASK; |
141 | 141 | ||
142 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) | 142 | for (i = 0; i < ARRAY_SIZE(cache_policies); i++) |
143 | if (cache_policies[i].pmd == pmd) { | 143 | if (cache_policies[i].pmd == pmd) { |
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 3d2cef6488ea..f193414d0f6f 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -170,9 +170,6 @@ static int xen_starting_cpu(unsigned int cpu) | |||
170 | pr_info("Xen: initializing cpu%d\n", cpu); | 170 | pr_info("Xen: initializing cpu%d\n", cpu); |
171 | vcpup = per_cpu_ptr(xen_vcpu_info, cpu); | 171 | vcpup = per_cpu_ptr(xen_vcpu_info, cpu); |
172 | 172 | ||
173 | /* Direct vCPU id mapping for ARM guests. */ | ||
174 | per_cpu(xen_vcpu_id, cpu) = cpu; | ||
175 | |||
176 | info.mfn = virt_to_gfn(vcpup); | 173 | info.mfn = virt_to_gfn(vcpup); |
177 | info.offset = xen_offset_in_page(vcpup); | 174 | info.offset = xen_offset_in_page(vcpup); |
178 | 175 | ||
@@ -330,6 +327,7 @@ static int __init xen_guest_init(void) | |||
330 | { | 327 | { |
331 | struct xen_add_to_physmap xatp; | 328 | struct xen_add_to_physmap xatp; |
332 | struct shared_info *shared_info_page = NULL; | 329 | struct shared_info *shared_info_page = NULL; |
330 | int cpu; | ||
333 | 331 | ||
334 | if (!xen_domain()) | 332 | if (!xen_domain()) |
335 | return 0; | 333 | return 0; |
@@ -380,7 +378,8 @@ static int __init xen_guest_init(void) | |||
380 | return -ENOMEM; | 378 | return -ENOMEM; |
381 | 379 | ||
382 | /* Direct vCPU id mapping for ARM guests. */ | 380 | /* Direct vCPU id mapping for ARM guests. */ |
383 | per_cpu(xen_vcpu_id, 0) = 0; | 381 | for_each_possible_cpu(cpu) |
382 | per_cpu(xen_vcpu_id, cpu) = cpu; | ||
384 | 383 | ||
385 | xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); | 384 | xen_auto_xlat_grant_frames.count = gnttab_max_grant_frames(); |
386 | if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, | 385 | if (xen_xlate_map_ballooned_pages(&xen_auto_xlat_grant_frames.pfn, |
diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi index 445aa678f914..c2b9bcb0ef61 100644 --- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | |||
@@ -255,10 +255,10 @@ | |||
255 | /* Local timer */ | 255 | /* Local timer */ |
256 | timer { | 256 | timer { |
257 | compatible = "arm,armv8-timer"; | 257 | compatible = "arm,armv8-timer"; |
258 | interrupts = <1 13 0xf01>, | 258 | interrupts = <1 13 0xf08>, |
259 | <1 14 0xf01>, | 259 | <1 14 0xf08>, |
260 | <1 11 0xf01>, | 260 | <1 11 0xf08>, |
261 | <1 10 0xf01>; | 261 | <1 10 0xf08>; |
262 | }; | 262 | }; |
263 | 263 | ||
264 | timer0: timer0@ffc03000 { | 264 | timer0: timer0@ffc03000 { |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi index e502c24b0ac7..bf6c8d051002 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | |||
@@ -102,13 +102,13 @@ | |||
102 | timer { | 102 | timer { |
103 | compatible = "arm,armv8-timer"; | 103 | compatible = "arm,armv8-timer"; |
104 | interrupts = <GIC_PPI 13 | 104 | interrupts = <GIC_PPI 13 |
105 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 105 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
106 | <GIC_PPI 14 | 106 | <GIC_PPI 14 |
107 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 107 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
108 | <GIC_PPI 11 | 108 | <GIC_PPI 11 |
109 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>, | 109 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>, |
110 | <GIC_PPI 10 | 110 | <GIC_PPI 10 |
111 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_EDGE_RISING)>; | 111 | (GIC_CPU_MASK_RAW(0xff) | IRQ_TYPE_LEVEL_LOW)>; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | xtal: xtal-clk { | 114 | xtal: xtal-clk { |
diff --git a/arch/arm64/boot/dts/apm/apm-storm.dtsi b/arch/arm64/boot/dts/apm/apm-storm.dtsi index f1c2c713f9b0..c29dab9d1834 100644 --- a/arch/arm64/boot/dts/apm/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm/apm-storm.dtsi | |||
@@ -110,10 +110,10 @@ | |||
110 | 110 | ||
111 | timer { | 111 | timer { |
112 | compatible = "arm,armv8-timer"; | 112 | compatible = "arm,armv8-timer"; |
113 | interrupts = <1 0 0xff01>, /* Secure Phys IRQ */ | 113 | interrupts = <1 0 0xff08>, /* Secure Phys IRQ */ |
114 | <1 13 0xff01>, /* Non-secure Phys IRQ */ | 114 | <1 13 0xff08>, /* Non-secure Phys IRQ */ |
115 | <1 14 0xff01>, /* Virt IRQ */ | 115 | <1 14 0xff08>, /* Virt IRQ */ |
116 | <1 15 0xff01>; /* Hyp IRQ */ | 116 | <1 15 0xff08>; /* Hyp IRQ */ |
117 | clock-frequency = <50000000>; | 117 | clock-frequency = <50000000>; |
118 | }; | 118 | }; |
119 | 119 | ||
diff --git a/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi b/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi new file mode 120000 index 000000000000..3937b77cb310 --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi | |||
@@ -0,0 +1 @@ | |||
../../../../arm/boot/dts/bcm2835-rpi.dtsi \ No newline at end of file | |||
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts index 6f47dd2bb1db..7841b724e340 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts | |||
@@ -1,7 +1,7 @@ | |||
1 | /dts-v1/; | 1 | /dts-v1/; |
2 | #include "bcm2837.dtsi" | 2 | #include "bcm2837.dtsi" |
3 | #include "../../../../arm/boot/dts/bcm2835-rpi.dtsi" | 3 | #include "bcm2835-rpi.dtsi" |
4 | #include "../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi" | 4 | #include "bcm283x-rpi-smsc9514.dtsi" |
5 | 5 | ||
6 | / { | 6 | / { |
7 | compatible = "raspberrypi,3-model-b", "brcm,bcm2837"; | 7 | compatible = "raspberrypi,3-model-b", "brcm,bcm2837"; |
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi index f2a31d06845d..8216bbb29fe0 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "../../../../arm/boot/dts/bcm283x.dtsi" | 1 | #include "bcm283x.dtsi" |
2 | 2 | ||
3 | / { | 3 | / { |
4 | compatible = "brcm,bcm2836"; | 4 | compatible = "brcm,bcm2836"; |
diff --git a/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi new file mode 120000 index 000000000000..dca7c057d5a5 --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi | |||
@@ -0,0 +1 @@ | |||
../../../../arm/boot/dts/bcm283x-rpi-smsc9514.dtsi \ No newline at end of file | |||
diff --git a/arch/arm64/boot/dts/broadcom/bcm283x.dtsi b/arch/arm64/boot/dts/broadcom/bcm283x.dtsi new file mode 120000 index 000000000000..5f54e4cab99b --- /dev/null +++ b/arch/arm64/boot/dts/broadcom/bcm283x.dtsi | |||
@@ -0,0 +1 @@ | |||
../../../../arm/boot/dts/bcm283x.dtsi \ No newline at end of file | |||
diff --git a/arch/arm64/boot/dts/broadcom/ns2.dtsi b/arch/arm64/boot/dts/broadcom/ns2.dtsi index f53b0955bfd3..d4a12fad8afd 100644 --- a/arch/arm64/boot/dts/broadcom/ns2.dtsi +++ b/arch/arm64/boot/dts/broadcom/ns2.dtsi | |||
@@ -88,13 +88,13 @@ | |||
88 | timer { | 88 | timer { |
89 | compatible = "arm,armv8-timer"; | 89 | compatible = "arm,armv8-timer"; |
90 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | | 90 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_RAW(0xff) | |
91 | IRQ_TYPE_EDGE_RISING)>, | 91 | IRQ_TYPE_LEVEL_LOW)>, |
92 | <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | | 92 | <GIC_PPI 14 (GIC_CPU_MASK_RAW(0xff) | |
93 | IRQ_TYPE_EDGE_RISING)>, | 93 | IRQ_TYPE_LEVEL_LOW)>, |
94 | <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | | 94 | <GIC_PPI 11 (GIC_CPU_MASK_RAW(0xff) | |
95 | IRQ_TYPE_EDGE_RISING)>, | 95 | IRQ_TYPE_LEVEL_LOW)>, |
96 | <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | | 96 | <GIC_PPI 10 (GIC_CPU_MASK_RAW(0xff) | |
97 | IRQ_TYPE_EDGE_RISING)>; | 97 | IRQ_TYPE_LEVEL_LOW)>; |
98 | }; | 98 | }; |
99 | 99 | ||
100 | pmu { | 100 | pmu { |
diff --git a/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi index 2eb9b225f0bc..04dc8a8d1539 100644 --- a/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi +++ b/arch/arm64/boot/dts/cavium/thunder-88xx.dtsi | |||
@@ -354,10 +354,10 @@ | |||
354 | 354 | ||
355 | timer { | 355 | timer { |
356 | compatible = "arm,armv8-timer"; | 356 | compatible = "arm,armv8-timer"; |
357 | interrupts = <1 13 0xff01>, | 357 | interrupts = <1 13 4>, |
358 | <1 14 0xff01>, | 358 | <1 14 4>, |
359 | <1 11 0xff01>, | 359 | <1 11 4>, |
360 | <1 10 0xff01>; | 360 | <1 10 4>; |
361 | }; | 361 | }; |
362 | 362 | ||
363 | pmu { | 363 | pmu { |
diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi index ca663dfe5189..162831546e18 100644 --- a/arch/arm64/boot/dts/exynos/exynos7.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi | |||
@@ -473,10 +473,10 @@ | |||
473 | 473 | ||
474 | timer { | 474 | timer { |
475 | compatible = "arm,armv8-timer"; | 475 | compatible = "arm,armv8-timer"; |
476 | interrupts = <1 13 0xff01>, | 476 | interrupts = <1 13 0xff08>, |
477 | <1 14 0xff01>, | 477 | <1 14 0xff08>, |
478 | <1 11 0xff01>, | 478 | <1 11 0xff08>, |
479 | <1 10 0xff01>; | 479 | <1 10 0xff08>; |
480 | }; | 480 | }; |
481 | 481 | ||
482 | pmu_system_controller: system-controller@105c0000 { | 482 | pmu_system_controller: system-controller@105c0000 { |
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi index e669fbd7f9c3..a67e210e2019 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi | |||
@@ -119,10 +119,10 @@ | |||
119 | 119 | ||
120 | timer { | 120 | timer { |
121 | compatible = "arm,armv8-timer"; | 121 | compatible = "arm,armv8-timer"; |
122 | interrupts = <1 13 0x1>, /* Physical Secure PPI */ | 122 | interrupts = <1 13 0xf08>, /* Physical Secure PPI */ |
123 | <1 14 0x1>, /* Physical Non-Secure PPI */ | 123 | <1 14 0xf08>, /* Physical Non-Secure PPI */ |
124 | <1 11 0x1>, /* Virtual PPI */ | 124 | <1 11 0xf08>, /* Virtual PPI */ |
125 | <1 10 0x1>; /* Hypervisor PPI */ | 125 | <1 10 0xf08>; /* Hypervisor PPI */ |
126 | }; | 126 | }; |
127 | 127 | ||
128 | pmu { | 128 | pmu { |
diff --git a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi index 21023a388c29..e3b6034ea5d9 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | |||
@@ -191,10 +191,10 @@ | |||
191 | 191 | ||
192 | timer { | 192 | timer { |
193 | compatible = "arm,armv8-timer"; | 193 | compatible = "arm,armv8-timer"; |
194 | interrupts = <1 13 0x8>, /* Physical Secure PPI, active-low */ | 194 | interrupts = <1 13 4>, /* Physical Secure PPI, active-low */ |
195 | <1 14 0x8>, /* Physical Non-Secure PPI, active-low */ | 195 | <1 14 4>, /* Physical Non-Secure PPI, active-low */ |
196 | <1 11 0x8>, /* Virtual PPI, active-low */ | 196 | <1 11 4>, /* Virtual PPI, active-low */ |
197 | <1 10 0x8>; /* Hypervisor PPI, active-low */ | 197 | <1 10 4>; /* Hypervisor PPI, active-low */ |
198 | }; | 198 | }; |
199 | 199 | ||
200 | pmu { | 200 | pmu { |
diff --git a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi index eab1a42fb934..c2a6745f168c 100644 --- a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi | |||
@@ -122,10 +122,10 @@ | |||
122 | 122 | ||
123 | timer { | 123 | timer { |
124 | compatible = "arm,armv8-timer"; | 124 | compatible = "arm,armv8-timer"; |
125 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 125 | interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
126 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 126 | <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
127 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>, | 127 | <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>, |
128 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; | 128 | <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | odmi: odmi@300000 { | 131 | odmi: odmi@300000 { |
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi b/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi index c223915f0907..d73bdc8c9115 100644 --- a/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-ph1-ld20.dtsi | |||
@@ -129,10 +129,10 @@ | |||
129 | 129 | ||
130 | timer { | 130 | timer { |
131 | compatible = "arm,armv8-timer"; | 131 | compatible = "arm,armv8-timer"; |
132 | interrupts = <1 13 0xf01>, | 132 | interrupts = <1 13 4>, |
133 | <1 14 0xf01>, | 133 | <1 14 4>, |
134 | <1 11 0xf01>, | 134 | <1 11 4>, |
135 | <1 10 0xf01>; | 135 | <1 10 4>; |
136 | }; | 136 | }; |
137 | 137 | ||
138 | soc { | 138 | soc { |
diff --git a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi index e595f22e7e4b..3e2e51fbd2bc 100644 --- a/arch/arm64/boot/dts/xilinx/zynqmp.dtsi +++ b/arch/arm64/boot/dts/xilinx/zynqmp.dtsi | |||
@@ -65,10 +65,10 @@ | |||
65 | timer { | 65 | timer { |
66 | compatible = "arm,armv8-timer"; | 66 | compatible = "arm,armv8-timer"; |
67 | interrupt-parent = <&gic>; | 67 | interrupt-parent = <&gic>; |
68 | interrupts = <1 13 0xf01>, | 68 | interrupts = <1 13 0xf08>, |
69 | <1 14 0xf01>, | 69 | <1 14 0xf08>, |
70 | <1 11 0xf01>, | 70 | <1 11 0xf08>, |
71 | <1 10 0xf01>; | 71 | <1 10 0xf08>; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | amba_apu { | 74 | amba_apu { |
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c index 5c888049d061..6b2aa0fd6cd0 100644 --- a/arch/arm64/crypto/aes-glue.c +++ b/arch/arm64/crypto/aes-glue.c | |||
@@ -216,7 +216,7 @@ static int ctr_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
216 | err = blkcipher_walk_done(desc, &walk, | 216 | err = blkcipher_walk_done(desc, &walk, |
217 | walk.nbytes % AES_BLOCK_SIZE); | 217 | walk.nbytes % AES_BLOCK_SIZE); |
218 | } | 218 | } |
219 | if (nbytes) { | 219 | if (walk.nbytes % AES_BLOCK_SIZE) { |
220 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; | 220 | u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE; |
221 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; | 221 | u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE; |
222 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; | 222 | u8 __aligned(8) tail[AES_BLOCK_SIZE]; |
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h index 4b6b3f72a215..b71420a12f26 100644 --- a/arch/arm64/include/asm/debug-monitors.h +++ b/arch/arm64/include/asm/debug-monitors.h | |||
@@ -61,8 +61,6 @@ | |||
61 | 61 | ||
62 | #define AARCH64_BREAK_KGDB_DYN_DBG \ | 62 | #define AARCH64_BREAK_KGDB_DYN_DBG \ |
63 | (AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5)) | 63 | (AARCH64_BREAK_MON | (KGDB_DYN_DBG_BRK_IMM << 5)) |
64 | #define KGDB_DYN_BRK_INS_BYTE(x) \ | ||
65 | ((AARCH64_BREAK_KGDB_DYN_DBG >> (8 * (x))) & 0xff) | ||
66 | 64 | ||
67 | #define CACHE_FLUSH_IS_SAFE 1 | 65 | #define CACHE_FLUSH_IS_SAFE 1 |
68 | 66 | ||
diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c index 8c57f6496e56..e017a9493b92 100644 --- a/arch/arm64/kernel/kgdb.c +++ b/arch/arm64/kernel/kgdb.c | |||
@@ -19,10 +19,13 @@ | |||
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/bug.h> | ||
22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
23 | #include <linux/kdebug.h> | 24 | #include <linux/kdebug.h> |
24 | #include <linux/kgdb.h> | 25 | #include <linux/kgdb.h> |
25 | #include <linux/kprobes.h> | 26 | #include <linux/kprobes.h> |
27 | #include <asm/debug-monitors.h> | ||
28 | #include <asm/insn.h> | ||
26 | #include <asm/traps.h> | 29 | #include <asm/traps.h> |
27 | 30 | ||
28 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { | 31 | struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { |
@@ -338,15 +341,24 @@ void kgdb_arch_exit(void) | |||
338 | unregister_die_notifier(&kgdb_notifier); | 341 | unregister_die_notifier(&kgdb_notifier); |
339 | } | 342 | } |
340 | 343 | ||
341 | /* | 344 | struct kgdb_arch arch_kgdb_ops; |
342 | * ARM instructions are always in LE. | 345 | |
343 | * Break instruction is encoded in LE format | 346 | int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt) |
344 | */ | 347 | { |
345 | struct kgdb_arch arch_kgdb_ops = { | 348 | int err; |
346 | .gdb_bpt_instr = { | 349 | |
347 | KGDB_DYN_BRK_INS_BYTE(0), | 350 | BUILD_BUG_ON(AARCH64_INSN_SIZE != BREAK_INSTR_SIZE); |
348 | KGDB_DYN_BRK_INS_BYTE(1), | 351 | |
349 | KGDB_DYN_BRK_INS_BYTE(2), | 352 | err = aarch64_insn_read((void *)bpt->bpt_addr, (u32 *)bpt->saved_instr); |
350 | KGDB_DYN_BRK_INS_BYTE(3), | 353 | if (err) |
351 | } | 354 | return err; |
352 | }; | 355 | |
356 | return aarch64_insn_write((void *)bpt->bpt_addr, | ||
357 | (u32)AARCH64_BREAK_KGDB_DYN_DBG); | ||
358 | } | ||
359 | |||
360 | int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt) | ||
361 | { | ||
362 | return aarch64_insn_write((void *)bpt->bpt_addr, | ||
363 | *(u32 *)bpt->saved_instr); | ||
364 | } | ||
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index d93d43352504..3ff173e92582 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c | |||
@@ -201,12 +201,6 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) | |||
201 | return ret; | 201 | return ret; |
202 | } | 202 | } |
203 | 203 | ||
204 | static void smp_store_cpu_info(unsigned int cpuid) | ||
205 | { | ||
206 | store_cpu_topology(cpuid); | ||
207 | numa_store_cpu_info(cpuid); | ||
208 | } | ||
209 | |||
210 | /* | 204 | /* |
211 | * This is the secondary CPU boot entry. We're using this CPUs | 205 | * This is the secondary CPU boot entry. We're using this CPUs |
212 | * idle thread stack, but a set of temporary page tables. | 206 | * idle thread stack, but a set of temporary page tables. |
@@ -254,7 +248,7 @@ asmlinkage void secondary_start_kernel(void) | |||
254 | */ | 248 | */ |
255 | notify_cpu_starting(cpu); | 249 | notify_cpu_starting(cpu); |
256 | 250 | ||
257 | smp_store_cpu_info(cpu); | 251 | store_cpu_topology(cpu); |
258 | 252 | ||
259 | /* | 253 | /* |
260 | * OK, now it's safe to let the boot CPU continue. Wait for | 254 | * OK, now it's safe to let the boot CPU continue. Wait for |
@@ -689,10 +683,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
689 | { | 683 | { |
690 | int err; | 684 | int err; |
691 | unsigned int cpu; | 685 | unsigned int cpu; |
686 | unsigned int this_cpu; | ||
692 | 687 | ||
693 | init_cpu_topology(); | 688 | init_cpu_topology(); |
694 | 689 | ||
695 | smp_store_cpu_info(smp_processor_id()); | 690 | this_cpu = smp_processor_id(); |
691 | store_cpu_topology(this_cpu); | ||
692 | numa_store_cpu_info(this_cpu); | ||
696 | 693 | ||
697 | /* | 694 | /* |
698 | * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set | 695 | * If UP is mandated by "nosmp" (which implies "maxcpus=0"), don't set |
@@ -719,6 +716,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
719 | continue; | 716 | continue; |
720 | 717 | ||
721 | set_cpu_present(cpu, true); | 718 | set_cpu_present(cpu, true); |
719 | numa_store_cpu_info(cpu); | ||
722 | } | 720 | } |
723 | } | 721 | } |
724 | 722 | ||
diff --git a/arch/avr32/include/asm/uaccess.h b/arch/avr32/include/asm/uaccess.h index 68cf638faf48..b1ec1fa06463 100644 --- a/arch/avr32/include/asm/uaccess.h +++ b/arch/avr32/include/asm/uaccess.h | |||
@@ -74,7 +74,7 @@ extern __kernel_size_t __copy_user(void *to, const void *from, | |||
74 | 74 | ||
75 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, | 75 | extern __kernel_size_t copy_to_user(void __user *to, const void *from, |
76 | __kernel_size_t n); | 76 | __kernel_size_t n); |
77 | extern __kernel_size_t copy_from_user(void *to, const void __user *from, | 77 | extern __kernel_size_t ___copy_from_user(void *to, const void __user *from, |
78 | __kernel_size_t n); | 78 | __kernel_size_t n); |
79 | 79 | ||
80 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, | 80 | static inline __kernel_size_t __copy_to_user(void __user *to, const void *from, |
@@ -88,6 +88,15 @@ static inline __kernel_size_t __copy_from_user(void *to, | |||
88 | { | 88 | { |
89 | return __copy_user(to, (const void __force *)from, n); | 89 | return __copy_user(to, (const void __force *)from, n); |
90 | } | 90 | } |
91 | static inline __kernel_size_t copy_from_user(void *to, | ||
92 | const void __user *from, | ||
93 | __kernel_size_t n) | ||
94 | { | ||
95 | size_t res = ___copy_from_user(to, from, n); | ||
96 | if (unlikely(res)) | ||
97 | memset(to + (n - res), 0, res); | ||
98 | return res; | ||
99 | } | ||
91 | 100 | ||
92 | #define __copy_to_user_inatomic __copy_to_user | 101 | #define __copy_to_user_inatomic __copy_to_user |
93 | #define __copy_from_user_inatomic __copy_from_user | 102 | #define __copy_from_user_inatomic __copy_from_user |
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c index d93ead02daed..7c6cf14f0985 100644 --- a/arch/avr32/kernel/avr32_ksyms.c +++ b/arch/avr32/kernel/avr32_ksyms.c | |||
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(copy_page); | |||
36 | /* | 36 | /* |
37 | * Userspace access stuff. | 37 | * Userspace access stuff. |
38 | */ | 38 | */ |
39 | EXPORT_SYMBOL(copy_from_user); | 39 | EXPORT_SYMBOL(___copy_from_user); |
40 | EXPORT_SYMBOL(copy_to_user); | 40 | EXPORT_SYMBOL(copy_to_user); |
41 | EXPORT_SYMBOL(__copy_user); | 41 | EXPORT_SYMBOL(__copy_user); |
42 | EXPORT_SYMBOL(strncpy_from_user); | 42 | EXPORT_SYMBOL(strncpy_from_user); |
diff --git a/arch/avr32/lib/copy_user.S b/arch/avr32/lib/copy_user.S index ea59c04b07de..075373471da1 100644 --- a/arch/avr32/lib/copy_user.S +++ b/arch/avr32/lib/copy_user.S | |||
@@ -23,13 +23,13 @@ | |||
23 | */ | 23 | */ |
24 | .text | 24 | .text |
25 | .align 1 | 25 | .align 1 |
26 | .global copy_from_user | 26 | .global ___copy_from_user |
27 | .type copy_from_user, @function | 27 | .type ___copy_from_user, @function |
28 | copy_from_user: | 28 | ___copy_from_user: |
29 | branch_if_kernel r8, __copy_user | 29 | branch_if_kernel r8, __copy_user |
30 | ret_if_privileged r8, r11, r10, r10 | 30 | ret_if_privileged r8, r11, r10, r10 |
31 | rjmp __copy_user | 31 | rjmp __copy_user |
32 | .size copy_from_user, . - copy_from_user | 32 | .size ___copy_from_user, . - ___copy_from_user |
33 | 33 | ||
34 | .global copy_to_user | 34 | .global copy_to_user |
35 | .type copy_to_user, @function | 35 | .type copy_to_user, @function |
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h index 12f5d6851bbc..0a2a70096d8b 100644 --- a/arch/blackfin/include/asm/uaccess.h +++ b/arch/blackfin/include/asm/uaccess.h | |||
@@ -171,11 +171,12 @@ static inline int bad_user_access_length(void) | |||
171 | static inline unsigned long __must_check | 171 | static inline unsigned long __must_check |
172 | copy_from_user(void *to, const void __user *from, unsigned long n) | 172 | copy_from_user(void *to, const void __user *from, unsigned long n) |
173 | { | 173 | { |
174 | if (access_ok(VERIFY_READ, from, n)) | 174 | if (likely(access_ok(VERIFY_READ, from, n))) { |
175 | memcpy(to, (const void __force *)from, n); | 175 | memcpy(to, (const void __force *)from, n); |
176 | else | 176 | return 0; |
177 | return n; | 177 | } |
178 | return 0; | 178 | memset(to, 0, n); |
179 | return n; | ||
179 | } | 180 | } |
180 | 181 | ||
181 | static inline unsigned long __must_check | 182 | static inline unsigned long __must_check |
diff --git a/arch/cris/include/asm/uaccess.h b/arch/cris/include/asm/uaccess.h index e3530d0f13ee..56c7d5750abd 100644 --- a/arch/cris/include/asm/uaccess.h +++ b/arch/cris/include/asm/uaccess.h | |||
@@ -194,30 +194,6 @@ extern unsigned long __copy_user(void __user *to, const void *from, unsigned lon | |||
194 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); | 194 | extern unsigned long __copy_user_zeroing(void *to, const void __user *from, unsigned long n); |
195 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); | 195 | extern unsigned long __do_clear_user(void __user *to, unsigned long n); |
196 | 196 | ||
197 | static inline unsigned long | ||
198 | __generic_copy_to_user(void __user *to, const void *from, unsigned long n) | ||
199 | { | ||
200 | if (access_ok(VERIFY_WRITE, to, n)) | ||
201 | return __copy_user(to, from, n); | ||
202 | return n; | ||
203 | } | ||
204 | |||
205 | static inline unsigned long | ||
206 | __generic_copy_from_user(void *to, const void __user *from, unsigned long n) | ||
207 | { | ||
208 | if (access_ok(VERIFY_READ, from, n)) | ||
209 | return __copy_user_zeroing(to, from, n); | ||
210 | return n; | ||
211 | } | ||
212 | |||
213 | static inline unsigned long | ||
214 | __generic_clear_user(void __user *to, unsigned long n) | ||
215 | { | ||
216 | if (access_ok(VERIFY_WRITE, to, n)) | ||
217 | return __do_clear_user(to, n); | ||
218 | return n; | ||
219 | } | ||
220 | |||
221 | static inline long | 197 | static inline long |
222 | __strncpy_from_user(char *dst, const char __user *src, long count) | 198 | __strncpy_from_user(char *dst, const char __user *src, long count) |
223 | { | 199 | { |
@@ -282,7 +258,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) | |||
282 | else if (n == 24) | 258 | else if (n == 24) |
283 | __asm_copy_from_user_24(to, from, ret); | 259 | __asm_copy_from_user_24(to, from, ret); |
284 | else | 260 | else |
285 | ret = __generic_copy_from_user(to, from, n); | 261 | ret = __copy_user_zeroing(to, from, n); |
286 | 262 | ||
287 | return ret; | 263 | return ret; |
288 | } | 264 | } |
@@ -333,7 +309,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
333 | else if (n == 24) | 309 | else if (n == 24) |
334 | __asm_copy_to_user_24(to, from, ret); | 310 | __asm_copy_to_user_24(to, from, ret); |
335 | else | 311 | else |
336 | ret = __generic_copy_to_user(to, from, n); | 312 | ret = __copy_user(to, from, n); |
337 | 313 | ||
338 | return ret; | 314 | return ret; |
339 | } | 315 | } |
@@ -366,26 +342,43 @@ __constant_clear_user(void __user *to, unsigned long n) | |||
366 | else if (n == 24) | 342 | else if (n == 24) |
367 | __asm_clear_24(to, ret); | 343 | __asm_clear_24(to, ret); |
368 | else | 344 | else |
369 | ret = __generic_clear_user(to, n); | 345 | ret = __do_clear_user(to, n); |
370 | 346 | ||
371 | return ret; | 347 | return ret; |
372 | } | 348 | } |
373 | 349 | ||
374 | 350 | ||
375 | #define clear_user(to, n) \ | 351 | static inline size_t clear_user(void __user *to, size_t n) |
376 | (__builtin_constant_p(n) ? \ | 352 | { |
377 | __constant_clear_user(to, n) : \ | 353 | if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
378 | __generic_clear_user(to, n)) | 354 | return n; |
355 | if (__builtin_constant_p(n)) | ||
356 | return __constant_clear_user(to, n); | ||
357 | else | ||
358 | return __do_clear_user(to, n); | ||
359 | } | ||
379 | 360 | ||
380 | #define copy_from_user(to, from, n) \ | 361 | static inline size_t copy_from_user(void *to, const void __user *from, size_t n) |
381 | (__builtin_constant_p(n) ? \ | 362 | { |
382 | __constant_copy_from_user(to, from, n) : \ | 363 | if (unlikely(!access_ok(VERIFY_READ, from, n))) { |
383 | __generic_copy_from_user(to, from, n)) | 364 | memset(to, 0, n); |
365 | return n; | ||
366 | } | ||
367 | if (__builtin_constant_p(n)) | ||
368 | return __constant_copy_from_user(to, from, n); | ||
369 | else | ||
370 | return __copy_user_zeroing(to, from, n); | ||
371 | } | ||
384 | 372 | ||
385 | #define copy_to_user(to, from, n) \ | 373 | static inline size_t copy_to_user(void __user *to, const void *from, size_t n) |
386 | (__builtin_constant_p(n) ? \ | 374 | { |
387 | __constant_copy_to_user(to, from, n) : \ | 375 | if (unlikely(!access_ok(VERIFY_WRITE, to, n))) |
388 | __generic_copy_to_user(to, from, n)) | 376 | return n; |
377 | if (__builtin_constant_p(n)) | ||
378 | return __constant_copy_to_user(to, from, n); | ||
379 | else | ||
380 | return __copy_user(to, from, n); | ||
381 | } | ||
389 | 382 | ||
390 | /* We let the __ versions of copy_from/to_user inline, because they're often | 383 | /* We let the __ versions of copy_from/to_user inline, because they're often |
391 | * used in fast paths and have only a small space overhead. | 384 | * used in fast paths and have only a small space overhead. |
diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h index 3ac9a59d65d4..87d9e34c5df8 100644 --- a/arch/frv/include/asm/uaccess.h +++ b/arch/frv/include/asm/uaccess.h | |||
@@ -263,19 +263,25 @@ do { \ | |||
263 | extern long __memset_user(void *dst, unsigned long count); | 263 | extern long __memset_user(void *dst, unsigned long count); |
264 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); | 264 | extern long __memcpy_user(void *dst, const void *src, unsigned long count); |
265 | 265 | ||
266 | #define clear_user(dst,count) __memset_user(____force(dst), (count)) | 266 | #define __clear_user(dst,count) __memset_user(____force(dst), (count)) |
267 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) | 267 | #define __copy_from_user_inatomic(to, from, n) __memcpy_user((to), ____force(from), (n)) |
268 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) | 268 | #define __copy_to_user_inatomic(to, from, n) __memcpy_user(____force(to), (from), (n)) |
269 | 269 | ||
270 | #else | 270 | #else |
271 | 271 | ||
272 | #define clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) | 272 | #define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) |
273 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) | 273 | #define __copy_from_user_inatomic(to, from, n) (memcpy((to), ____force(from), (n)), 0) |
274 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) | 274 | #define __copy_to_user_inatomic(to, from, n) (memcpy(____force(to), (from), (n)), 0) |
275 | 275 | ||
276 | #endif | 276 | #endif |
277 | 277 | ||
278 | #define __clear_user clear_user | 278 | static inline unsigned long __must_check |
279 | clear_user(void __user *to, unsigned long n) | ||
280 | { | ||
281 | if (likely(__access_ok(to, n))) | ||
282 | n = __clear_user(to, n); | ||
283 | return n; | ||
284 | } | ||
279 | 285 | ||
280 | static inline unsigned long __must_check | 286 | static inline unsigned long __must_check |
281 | __copy_to_user(void __user *to, const void *from, unsigned long n) | 287 | __copy_to_user(void __user *to, const void *from, unsigned long n) |
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h index f000a382bc7f..f61cfb28e9f2 100644 --- a/arch/hexagon/include/asm/uaccess.h +++ b/arch/hexagon/include/asm/uaccess.h | |||
@@ -103,7 +103,8 @@ static inline long hexagon_strncpy_from_user(char *dst, const char __user *src, | |||
103 | { | 103 | { |
104 | long res = __strnlen_user(src, n); | 104 | long res = __strnlen_user(src, n); |
105 | 105 | ||
106 | /* return from strnlen can't be zero -- that would be rubbish. */ | 106 | if (unlikely(!res)) |
107 | return -EFAULT; | ||
107 | 108 | ||
108 | if (res > n) { | 109 | if (res > n) { |
109 | copy_from_user(dst, src, n); | 110 | copy_from_user(dst, src, n); |
diff --git a/arch/ia64/include/asm/uaccess.h b/arch/ia64/include/asm/uaccess.h index 0472927ebb9b..bfe13196f770 100644 --- a/arch/ia64/include/asm/uaccess.h +++ b/arch/ia64/include/asm/uaccess.h | |||
@@ -269,19 +269,16 @@ __copy_from_user (void *to, const void __user *from, unsigned long count) | |||
269 | __cu_len; \ | 269 | __cu_len; \ |
270 | }) | 270 | }) |
271 | 271 | ||
272 | #define copy_from_user(to, from, n) \ | 272 | static inline unsigned long |
273 | ({ \ | 273 | copy_from_user(void *to, const void __user *from, unsigned long n) |
274 | void *__cu_to = (to); \ | 274 | { |
275 | const void __user *__cu_from = (from); \ | 275 | check_object_size(to, n, false); |
276 | long __cu_len = (n); \ | 276 | if (likely(__access_ok(from, n, get_fs()))) |
277 | \ | 277 | n = __copy_user((__force void __user *) to, from, n); |
278 | __chk_user_ptr(__cu_from); \ | 278 | else |
279 | if (__access_ok(__cu_from, __cu_len, get_fs())) { \ | 279 | memset(to, 0, n); |
280 | check_object_size(__cu_to, __cu_len, false); \ | 280 | return n; |
281 | __cu_len = __copy_user((__force void __user *) __cu_to, __cu_from, __cu_len); \ | 281 | } |
282 | } \ | ||
283 | __cu_len; \ | ||
284 | }) | ||
285 | 282 | ||
286 | #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) | 283 | #define __copy_in_user(to, from, size) __copy_user((to), (from), (size)) |
287 | 284 | ||
diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h index cac7014daef3..6f8982157a75 100644 --- a/arch/m32r/include/asm/uaccess.h +++ b/arch/m32r/include/asm/uaccess.h | |||
@@ -219,7 +219,7 @@ extern int fixup_exception(struct pt_regs *regs); | |||
219 | #define __get_user_nocheck(x, ptr, size) \ | 219 | #define __get_user_nocheck(x, ptr, size) \ |
220 | ({ \ | 220 | ({ \ |
221 | long __gu_err = 0; \ | 221 | long __gu_err = 0; \ |
222 | unsigned long __gu_val; \ | 222 | unsigned long __gu_val = 0; \ |
223 | might_fault(); \ | 223 | might_fault(); \ |
224 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ | 224 | __get_user_size(__gu_val, (ptr), (size), __gu_err); \ |
225 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ | 225 | (x) = (__force __typeof__(*(ptr)))__gu_val; \ |
diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h index 8282cbce7e39..273e61225c27 100644 --- a/arch/metag/include/asm/uaccess.h +++ b/arch/metag/include/asm/uaccess.h | |||
@@ -204,8 +204,9 @@ extern unsigned long __must_check __copy_user_zeroing(void *to, | |||
204 | static inline unsigned long | 204 | static inline unsigned long |
205 | copy_from_user(void *to, const void __user *from, unsigned long n) | 205 | copy_from_user(void *to, const void __user *from, unsigned long n) |
206 | { | 206 | { |
207 | if (access_ok(VERIFY_READ, from, n)) | 207 | if (likely(access_ok(VERIFY_READ, from, n))) |
208 | return __copy_user_zeroing(to, from, n); | 208 | return __copy_user_zeroing(to, from, n); |
209 | memset(to, 0, n); | ||
209 | return n; | 210 | return n; |
210 | } | 211 | } |
211 | 212 | ||
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h index 331b0d35f89c..826676778094 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h | |||
@@ -227,7 +227,7 @@ extern long __user_bad(void); | |||
227 | 227 | ||
228 | #define __get_user(x, ptr) \ | 228 | #define __get_user(x, ptr) \ |
229 | ({ \ | 229 | ({ \ |
230 | unsigned long __gu_val; \ | 230 | unsigned long __gu_val = 0; \ |
231 | /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ | 231 | /*unsigned long __gu_ptr = (unsigned long)(ptr);*/ \ |
232 | long __gu_err; \ | 232 | long __gu_err; \ |
233 | switch (sizeof(*(ptr))) { \ | 233 | switch (sizeof(*(ptr))) { \ |
@@ -373,10 +373,13 @@ extern long __user_bad(void); | |||
373 | static inline long copy_from_user(void *to, | 373 | static inline long copy_from_user(void *to, |
374 | const void __user *from, unsigned long n) | 374 | const void __user *from, unsigned long n) |
375 | { | 375 | { |
376 | unsigned long res = n; | ||
376 | might_fault(); | 377 | might_fault(); |
377 | if (access_ok(VERIFY_READ, from, n)) | 378 | if (likely(access_ok(VERIFY_READ, from, n))) |
378 | return __copy_from_user(to, from, n); | 379 | res = __copy_from_user(to, from, n); |
379 | return n; | 380 | if (unlikely(res)) |
381 | memset(to + (n - res), 0, res); | ||
382 | return res; | ||
380 | } | 383 | } |
381 | 384 | ||
382 | #define __copy_to_user(to, from, n) \ | 385 | #define __copy_to_user(to, from, n) \ |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 26388562e300..212ff92920d2 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -65,6 +65,7 @@ config MIPS | |||
65 | select ARCH_CLOCKSOURCE_DATA | 65 | select ARCH_CLOCKSOURCE_DATA |
66 | select HANDLE_DOMAIN_IRQ | 66 | select HANDLE_DOMAIN_IRQ |
67 | select HAVE_EXIT_THREAD | 67 | select HAVE_EXIT_THREAD |
68 | select HAVE_REGS_AND_STACK_ACCESS_API | ||
68 | 69 | ||
69 | menu "Machine selection" | 70 | menu "Machine selection" |
70 | 71 | ||
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index f0e314ceb8ba..7f975b20b20c 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug | |||
@@ -113,42 +113,6 @@ config SPINLOCK_TEST | |||
113 | help | 113 | help |
114 | Add several files to the debugfs to test spinlock speed. | 114 | Add several files to the debugfs to test spinlock speed. |
115 | 115 | ||
116 | if CPU_MIPSR6 | ||
117 | |||
118 | choice | ||
119 | prompt "Compact branch policy" | ||
120 | default MIPS_COMPACT_BRANCHES_OPTIMAL | ||
121 | |||
122 | config MIPS_COMPACT_BRANCHES_NEVER | ||
123 | bool "Never (force delay slot branches)" | ||
124 | help | ||
125 | Pass the -mcompact-branches=never flag to the compiler in order to | ||
126 | force it to always emit branches with delay slots, and make no use | ||
127 | of the compact branch instructions introduced by MIPSr6. This is | ||
128 | useful if you suspect there may be an issue with compact branches in | ||
129 | either the compiler or the CPU. | ||
130 | |||
131 | config MIPS_COMPACT_BRANCHES_OPTIMAL | ||
132 | bool "Optimal (use where beneficial)" | ||
133 | help | ||
134 | Pass the -mcompact-branches=optimal flag to the compiler in order for | ||
135 | it to make use of compact branch instructions where it deems them | ||
136 | beneficial, and use branches with delay slots elsewhere. This is the | ||
137 | default compiler behaviour, and should be used unless you have a | ||
138 | reason to choose otherwise. | ||
139 | |||
140 | config MIPS_COMPACT_BRANCHES_ALWAYS | ||
141 | bool "Always (force compact branches)" | ||
142 | help | ||
143 | Pass the -mcompact-branches=always flag to the compiler in order to | ||
144 | force it to always emit compact branches, making no use of branch | ||
145 | instructions with delay slots. This can result in more compact code | ||
146 | which may be beneficial in some scenarios. | ||
147 | |||
148 | endchoice | ||
149 | |||
150 | endif # CPU_MIPSR6 | ||
151 | |||
152 | config SCACHE_DEBUGFS | 116 | config SCACHE_DEBUGFS |
153 | bool "L2 cache debugfs entries" | 117 | bool "L2 cache debugfs entries" |
154 | depends on DEBUG_FS | 118 | depends on DEBUG_FS |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index efd7a9dc93c4..598ab2930fce 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -203,10 +203,6 @@ endif | |||
203 | toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) | 203 | toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt) |
204 | cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT | 204 | cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT |
205 | 205 | ||
206 | cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_NEVER) += -mcompact-branches=never | ||
207 | cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_OPTIMAL) += -mcompact-branches=optimal | ||
208 | cflags-$(CONFIG_MIPS_COMPACT_BRANCHES_ALWAYS) += -mcompact-branches=always | ||
209 | |||
210 | # | 206 | # |
211 | # Firmware support | 207 | # Firmware support |
212 | # | 208 | # |
diff --git a/arch/mips/ath79/clock.c b/arch/mips/ath79/clock.c index 2e7378467c5c..cc3a1e33a600 100644 --- a/arch/mips/ath79/clock.c +++ b/arch/mips/ath79/clock.c | |||
@@ -96,7 +96,7 @@ static struct clk * __init ath79_reg_ffclk(const char *name, | |||
96 | struct clk *clk; | 96 | struct clk *clk; |
97 | 97 | ||
98 | clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); | 98 | clk = clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div); |
99 | if (!clk) | 99 | if (IS_ERR(clk)) |
100 | panic("failed to allocate %s clock structure", name); | 100 | panic("failed to allocate %s clock structure", name); |
101 | 101 | ||
102 | return clk; | 102 | return clk; |
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index b31fbc9d6eae..37a932d9148c 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c | |||
@@ -1059,7 +1059,7 @@ static int __init octeon_publish_devices(void) | |||
1059 | { | 1059 | { |
1060 | return of_platform_bus_probe(NULL, octeon_ids, NULL); | 1060 | return of_platform_bus_probe(NULL, octeon_ids, NULL); |
1061 | } | 1061 | } |
1062 | device_initcall(octeon_publish_devices); | 1062 | arch_initcall(octeon_publish_devices); |
1063 | 1063 | ||
1064 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); | 1064 | MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); |
1065 | MODULE_LICENSE("GPL"); | 1065 | MODULE_LICENSE("GPL"); |
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index 56584a659183..83054f79f72a 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h | |||
@@ -157,6 +157,7 @@ | |||
157 | ldc1 $f28, THREAD_FPR28(\thread) | 157 | ldc1 $f28, THREAD_FPR28(\thread) |
158 | ldc1 $f30, THREAD_FPR30(\thread) | 158 | ldc1 $f30, THREAD_FPR30(\thread) |
159 | ctc1 \tmp, fcr31 | 159 | ctc1 \tmp, fcr31 |
160 | .set pop | ||
160 | .endm | 161 | .endm |
161 | 162 | ||
162 | .macro fpu_restore_16odd thread | 163 | .macro fpu_restore_16odd thread |
diff --git a/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h b/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h index 0cf5ac1f7245..8ff2cbdf2c3e 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h +++ b/arch/mips/include/asm/mach-cavium-octeon/mangle-port.h | |||
@@ -15,8 +15,8 @@ | |||
15 | static inline bool __should_swizzle_bits(volatile void *a) | 15 | static inline bool __should_swizzle_bits(volatile void *a) |
16 | { | 16 | { |
17 | extern const bool octeon_should_swizzle_table[]; | 17 | extern const bool octeon_should_swizzle_table[]; |
18 | u64 did = ((u64)(uintptr_t)a >> 40) & 0xff; | ||
18 | 19 | ||
19 | unsigned long did = ((unsigned long)a >> 40) & 0xff; | ||
20 | return octeon_should_swizzle_table[did]; | 20 | return octeon_should_swizzle_table[did]; |
21 | } | 21 | } |
22 | 22 | ||
@@ -29,7 +29,7 @@ static inline bool __should_swizzle_bits(volatile void *a) | |||
29 | 29 | ||
30 | #define __should_swizzle_bits(a) false | 30 | #define __should_swizzle_bits(a) false |
31 | 31 | ||
32 | static inline bool __should_swizzle_addr(unsigned long p) | 32 | static inline bool __should_swizzle_addr(u64 p) |
33 | { | 33 | { |
34 | /* boot bus? */ | 34 | /* boot bus? */ |
35 | return ((p >> 40) & 0xff) == 0; | 35 | return ((p >> 40) & 0xff) == 0; |
diff --git a/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h index 2f82bfa3a773..c9f5769dfc8f 100644 --- a/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-paravirt/kernel-entry-init.h | |||
@@ -11,11 +11,13 @@ | |||
11 | #define CP0_EBASE $15, 1 | 11 | #define CP0_EBASE $15, 1 |
12 | 12 | ||
13 | .macro kernel_entry_setup | 13 | .macro kernel_entry_setup |
14 | #ifdef CONFIG_SMP | ||
14 | mfc0 t0, CP0_EBASE | 15 | mfc0 t0, CP0_EBASE |
15 | andi t0, t0, 0x3ff # CPUNum | 16 | andi t0, t0, 0x3ff # CPUNum |
16 | beqz t0, 1f | 17 | beqz t0, 1f |
17 | # CPUs other than zero goto smp_bootstrap | 18 | # CPUs other than zero goto smp_bootstrap |
18 | j smp_bootstrap | 19 | j smp_bootstrap |
20 | #endif /* CONFIG_SMP */ | ||
19 | 21 | ||
20 | 1: | 22 | 1: |
21 | .endm | 23 | .endm |
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h index 11b965f98d95..21a2aaba20d5 100644 --- a/arch/mips/include/asm/uaccess.h +++ b/arch/mips/include/asm/uaccess.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/thread_info.h> | 16 | #include <linux/thread_info.h> |
17 | #include <linux/string.h> | ||
17 | #include <asm/asm-eva.h> | 18 | #include <asm/asm-eva.h> |
18 | 19 | ||
19 | /* | 20 | /* |
@@ -1170,6 +1171,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n); | |||
1170 | __cu_len = __invoke_copy_from_user(__cu_to, \ | 1171 | __cu_len = __invoke_copy_from_user(__cu_to, \ |
1171 | __cu_from, \ | 1172 | __cu_from, \ |
1172 | __cu_len); \ | 1173 | __cu_len); \ |
1174 | } else { \ | ||
1175 | memset(__cu_to, 0, __cu_len); \ | ||
1173 | } \ | 1176 | } \ |
1174 | } \ | 1177 | } \ |
1175 | __cu_len; \ | 1178 | __cu_len; \ |
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c index c3372cac6db2..0a7e10b5f9e3 100644 --- a/arch/mips/kernel/mips-r2-to-r6-emul.c +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c | |||
@@ -1164,7 +1164,9 @@ fpu_emul: | |||
1164 | regs->regs[31] = r31; | 1164 | regs->regs[31] = r31; |
1165 | regs->cp0_epc = epc; | 1165 | regs->cp0_epc = epc; |
1166 | if (!used_math()) { /* First time FPU user. */ | 1166 | if (!used_math()) { /* First time FPU user. */ |
1167 | preempt_disable(); | ||
1167 | err = init_fpu(); | 1168 | err = init_fpu(); |
1169 | preempt_enable(); | ||
1168 | set_used_math(); | 1170 | set_used_math(); |
1169 | } | 1171 | } |
1170 | lose_fpu(1); /* Save FPU state for the emulator. */ | 1172 | lose_fpu(1); /* Save FPU state for the emulator. */ |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 7429ad09fbe3..d2d061520a23 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -605,14 +605,14 @@ int mips_set_process_fp_mode(struct task_struct *task, unsigned int value) | |||
605 | return -EOPNOTSUPP; | 605 | return -EOPNOTSUPP; |
606 | 606 | ||
607 | /* Avoid inadvertently triggering emulation */ | 607 | /* Avoid inadvertently triggering emulation */ |
608 | if ((value & PR_FP_MODE_FR) && cpu_has_fpu && | 608 | if ((value & PR_FP_MODE_FR) && raw_cpu_has_fpu && |
609 | !(current_cpu_data.fpu_id & MIPS_FPIR_F64)) | 609 | !(raw_current_cpu_data.fpu_id & MIPS_FPIR_F64)) |
610 | return -EOPNOTSUPP; | 610 | return -EOPNOTSUPP; |
611 | if ((value & PR_FP_MODE_FRE) && cpu_has_fpu && !cpu_has_fre) | 611 | if ((value & PR_FP_MODE_FRE) && raw_cpu_has_fpu && !cpu_has_fre) |
612 | return -EOPNOTSUPP; | 612 | return -EOPNOTSUPP; |
613 | 613 | ||
614 | /* FR = 0 not supported in MIPS R6 */ | 614 | /* FR = 0 not supported in MIPS R6 */ |
615 | if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6) | 615 | if (!(value & PR_FP_MODE_FR) && raw_cpu_has_fpu && cpu_has_mips_r6) |
616 | return -EOPNOTSUPP; | 616 | return -EOPNOTSUPP; |
617 | 617 | ||
618 | /* Proceed with the mode switch */ | 618 | /* Proceed with the mode switch */ |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 36cf8d65c47d..3be0e6ba2797 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -87,6 +87,13 @@ void __init add_memory_region(phys_addr_t start, phys_addr_t size, long type) | |||
87 | int x = boot_mem_map.nr_map; | 87 | int x = boot_mem_map.nr_map; |
88 | int i; | 88 | int i; |
89 | 89 | ||
90 | /* | ||
91 | * If the region reaches the top of the physical address space, adjust | ||
92 | * the size slightly so that (start + size) doesn't overflow | ||
93 | */ | ||
94 | if (start + size - 1 == (phys_addr_t)ULLONG_MAX) | ||
95 | --size; | ||
96 | |||
90 | /* Sanity check */ | 97 | /* Sanity check */ |
91 | if (start + size < start) { | 98 | if (start + size < start) { |
92 | pr_warn("Trying to add an invalid memory region, skipped\n"); | 99 | pr_warn("Trying to add an invalid memory region, skipped\n"); |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index f95f094f36e4..b0baf48951fa 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -322,6 +322,9 @@ asmlinkage void start_secondary(void) | |||
322 | cpumask_set_cpu(cpu, &cpu_coherent_mask); | 322 | cpumask_set_cpu(cpu, &cpu_coherent_mask); |
323 | notify_cpu_starting(cpu); | 323 | notify_cpu_starting(cpu); |
324 | 324 | ||
325 | cpumask_set_cpu(cpu, &cpu_callin_map); | ||
326 | synchronise_count_slave(cpu); | ||
327 | |||
325 | set_cpu_online(cpu, true); | 328 | set_cpu_online(cpu, true); |
326 | 329 | ||
327 | set_cpu_sibling_map(cpu); | 330 | set_cpu_sibling_map(cpu); |
@@ -329,10 +332,6 @@ asmlinkage void start_secondary(void) | |||
329 | 332 | ||
330 | calculate_cpu_foreign_map(); | 333 | calculate_cpu_foreign_map(); |
331 | 334 | ||
332 | cpumask_set_cpu(cpu, &cpu_callin_map); | ||
333 | |||
334 | synchronise_count_slave(cpu); | ||
335 | |||
336 | /* | 335 | /* |
337 | * irq will be enabled in ->smp_finish(), enabling it too early | 336 | * irq will be enabled in ->smp_finish(), enabling it too early |
338 | * is dangerous. | 337 | * is dangerous. |
diff --git a/arch/mips/kernel/uprobes.c b/arch/mips/kernel/uprobes.c index 8452d933a645..1149b30c9aeb 100644 --- a/arch/mips/kernel/uprobes.c +++ b/arch/mips/kernel/uprobes.c | |||
@@ -222,7 +222,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self, | |||
222 | return NOTIFY_DONE; | 222 | return NOTIFY_DONE; |
223 | 223 | ||
224 | switch (val) { | 224 | switch (val) { |
225 | case DIE_BREAK: | 225 | case DIE_UPROBE: |
226 | if (uprobe_pre_sstep_notifier(regs)) | 226 | if (uprobe_pre_sstep_notifier(regs)) |
227 | return NOTIFY_STOP; | 227 | return NOTIFY_STOP; |
228 | break; | 228 | break; |
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 9abe447a4b48..f9dbfb14af33 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c | |||
@@ -39,16 +39,16 @@ static struct vm_special_mapping vdso_vvar_mapping = { | |||
39 | static void __init init_vdso_image(struct mips_vdso_image *image) | 39 | static void __init init_vdso_image(struct mips_vdso_image *image) |
40 | { | 40 | { |
41 | unsigned long num_pages, i; | 41 | unsigned long num_pages, i; |
42 | unsigned long data_pfn; | ||
42 | 43 | ||
43 | BUG_ON(!PAGE_ALIGNED(image->data)); | 44 | BUG_ON(!PAGE_ALIGNED(image->data)); |
44 | BUG_ON(!PAGE_ALIGNED(image->size)); | 45 | BUG_ON(!PAGE_ALIGNED(image->size)); |
45 | 46 | ||
46 | num_pages = image->size / PAGE_SIZE; | 47 | num_pages = image->size / PAGE_SIZE; |
47 | 48 | ||
48 | for (i = 0; i < num_pages; i++) { | 49 | data_pfn = __phys_to_pfn(__pa_symbol(image->data)); |
49 | image->mapping.pages[i] = | 50 | for (i = 0; i < num_pages; i++) |
50 | virt_to_page(image->data + (i * PAGE_SIZE)); | 51 | image->mapping.pages[i] = pfn_to_page(data_pfn + i); |
51 | } | ||
52 | } | 52 | } |
53 | 53 | ||
54 | static int __init init_vdso(void) | 54 | static int __init init_vdso(void) |
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c index 72a4642eee2c..4a094f7acb3d 100644 --- a/arch/mips/math-emu/dsemul.c +++ b/arch/mips/math-emu/dsemul.c | |||
@@ -298,5 +298,6 @@ bool do_dsemulret(struct pt_regs *xcp) | |||
298 | /* Set EPC to return to post-branch instruction */ | 298 | /* Set EPC to return to post-branch instruction */ |
299 | xcp->cp0_epc = current->thread.bd_emu_cont_pc; | 299 | xcp->cp0_epc = current->thread.bd_emu_cont_pc; |
300 | pr_debug("dsemulret to 0x%08lx\n", xcp->cp0_epc); | 300 | pr_debug("dsemulret to 0x%08lx\n", xcp->cp0_epc); |
301 | MIPS_FPU_EMU_INC_STATS(ds_emul); | ||
301 | return true; | 302 | return true; |
302 | } | 303 | } |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index cd72805b64a7..fa7d8d3790bf 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -800,7 +800,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end) | |||
800 | * If address-based cache ops don't require an SMP call, then | 800 | * If address-based cache ops don't require an SMP call, then |
801 | * use them exclusively for small flushes. | 801 | * use them exclusively for small flushes. |
802 | */ | 802 | */ |
803 | size = start - end; | 803 | size = end - start; |
804 | cache_size = icache_size; | 804 | cache_size = icache_size; |
805 | if (!cpu_has_ic_fills_f_dc) { | 805 | if (!cpu_has_ic_fills_f_dc) { |
806 | size *= 2; | 806 | size *= 2; |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index a5509e7dcad2..2c3749d98f04 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -261,7 +261,6 @@ unsigned __weak platform_maar_init(unsigned num_pairs) | |||
261 | { | 261 | { |
262 | struct maar_config cfg[BOOT_MEM_MAP_MAX]; | 262 | struct maar_config cfg[BOOT_MEM_MAP_MAX]; |
263 | unsigned i, num_configured, num_cfg = 0; | 263 | unsigned i, num_configured, num_cfg = 0; |
264 | phys_addr_t skip; | ||
265 | 264 | ||
266 | for (i = 0; i < boot_mem_map.nr_map; i++) { | 265 | for (i = 0; i < boot_mem_map.nr_map; i++) { |
267 | switch (boot_mem_map.map[i].type) { | 266 | switch (boot_mem_map.map[i].type) { |
@@ -272,14 +271,14 @@ unsigned __weak platform_maar_init(unsigned num_pairs) | |||
272 | continue; | 271 | continue; |
273 | } | 272 | } |
274 | 273 | ||
275 | skip = 0x10000 - (boot_mem_map.map[i].addr & 0xffff); | 274 | /* Round lower up */ |
276 | |||
277 | cfg[num_cfg].lower = boot_mem_map.map[i].addr; | 275 | cfg[num_cfg].lower = boot_mem_map.map[i].addr; |
278 | cfg[num_cfg].lower += skip; | 276 | cfg[num_cfg].lower = (cfg[num_cfg].lower + 0xffff) & ~0xffff; |
279 | 277 | ||
280 | cfg[num_cfg].upper = cfg[num_cfg].lower; | 278 | /* Round upper down */ |
281 | cfg[num_cfg].upper += boot_mem_map.map[i].size - 1; | 279 | cfg[num_cfg].upper = boot_mem_map.map[i].addr + |
282 | cfg[num_cfg].upper -= skip; | 280 | boot_mem_map.map[i].size; |
281 | cfg[num_cfg].upper = (cfg[num_cfg].upper & ~0xffff) - 1; | ||
283 | 282 | ||
284 | cfg[num_cfg].attrs = MIPS_MAAR_S; | 283 | cfg[num_cfg].attrs = MIPS_MAAR_S; |
285 | num_cfg++; | 284 | num_cfg++; |
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 20f7bf6de384..d012e877a95a 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -166,6 +166,7 @@ struct __large_struct { unsigned long buf[100]; }; | |||
166 | "2:\n" \ | 166 | "2:\n" \ |
167 | " .section .fixup,\"ax\"\n" \ | 167 | " .section .fixup,\"ax\"\n" \ |
168 | "3:\n\t" \ | 168 | "3:\n\t" \ |
169 | " mov 0,%1\n" \ | ||
169 | " mov %3,%0\n" \ | 170 | " mov %3,%0\n" \ |
170 | " jmp 2b\n" \ | 171 | " jmp 2b\n" \ |
171 | " .previous\n" \ | 172 | " .previous\n" \ |
diff --git a/arch/mn10300/lib/usercopy.c b/arch/mn10300/lib/usercopy.c index 7826e6c364e7..ce8899e5e171 100644 --- a/arch/mn10300/lib/usercopy.c +++ b/arch/mn10300/lib/usercopy.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * as published by the Free Software Foundation; either version | 9 | * as published by the Free Software Foundation; either version |
10 | * 2 of the Licence, or (at your option) any later version. | 10 | * 2 of the Licence, or (at your option) any later version. |
11 | */ | 11 | */ |
12 | #include <asm/uaccess.h> | 12 | #include <linux/uaccess.h> |
13 | 13 | ||
14 | unsigned long | 14 | unsigned long |
15 | __generic_copy_to_user(void *to, const void *from, unsigned long n) | 15 | __generic_copy_to_user(void *to, const void *from, unsigned long n) |
@@ -24,6 +24,8 @@ __generic_copy_from_user(void *to, const void *from, unsigned long n) | |||
24 | { | 24 | { |
25 | if (access_ok(VERIFY_READ, from, n)) | 25 | if (access_ok(VERIFY_READ, from, n)) |
26 | __copy_user_zeroing(to, from, n); | 26 | __copy_user_zeroing(to, from, n); |
27 | else | ||
28 | memset(to, 0, n); | ||
27 | return n; | 29 | return n; |
28 | } | 30 | } |
29 | 31 | ||
diff --git a/arch/nios2/include/asm/uaccess.h b/arch/nios2/include/asm/uaccess.h index caa51ff85a3c..0ab82324c817 100644 --- a/arch/nios2/include/asm/uaccess.h +++ b/arch/nios2/include/asm/uaccess.h | |||
@@ -102,9 +102,12 @@ extern long __copy_to_user(void __user *to, const void *from, unsigned long n); | |||
102 | static inline long copy_from_user(void *to, const void __user *from, | 102 | static inline long copy_from_user(void *to, const void __user *from, |
103 | unsigned long n) | 103 | unsigned long n) |
104 | { | 104 | { |
105 | if (!access_ok(VERIFY_READ, from, n)) | 105 | unsigned long res = n; |
106 | return n; | 106 | if (access_ok(VERIFY_READ, from, n)) |
107 | return __copy_from_user(to, from, n); | 107 | res = __copy_from_user(to, from, n); |
108 | if (unlikely(res)) | ||
109 | memset(to + (n - res), 0, res); | ||
110 | return res; | ||
108 | } | 111 | } |
109 | 112 | ||
110 | static inline long copy_to_user(void __user *to, const void *from, | 113 | static inline long copy_to_user(void __user *to, const void *from, |
@@ -139,7 +142,7 @@ extern long strnlen_user(const char __user *s, long n); | |||
139 | 142 | ||
140 | #define __get_user_unknown(val, size, ptr, err) do { \ | 143 | #define __get_user_unknown(val, size, ptr, err) do { \ |
141 | err = 0; \ | 144 | err = 0; \ |
142 | if (copy_from_user(&(val), ptr, size)) { \ | 145 | if (__copy_from_user(&(val), ptr, size)) { \ |
143 | err = -EFAULT; \ | 146 | err = -EFAULT; \ |
144 | } \ | 147 | } \ |
145 | } while (0) | 148 | } while (0) |
@@ -166,7 +169,7 @@ do { \ | |||
166 | ({ \ | 169 | ({ \ |
167 | long __gu_err = -EFAULT; \ | 170 | long __gu_err = -EFAULT; \ |
168 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ | 171 | const __typeof__(*(ptr)) __user *__gu_ptr = (ptr); \ |
169 | unsigned long __gu_val; \ | 172 | unsigned long __gu_val = 0; \ |
170 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ | 173 | __get_user_common(__gu_val, sizeof(*(ptr)), __gu_ptr, __gu_err);\ |
171 | (x) = (__force __typeof__(x))__gu_val; \ | 174 | (x) = (__force __typeof__(x))__gu_val; \ |
172 | __gu_err; \ | 175 | __gu_err; \ |
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index a6bd07ca3d6c..5cc6b4f1b795 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h | |||
@@ -273,28 +273,20 @@ __copy_tofrom_user(void *to, const void *from, unsigned long size); | |||
273 | static inline unsigned long | 273 | static inline unsigned long |
274 | copy_from_user(void *to, const void *from, unsigned long n) | 274 | copy_from_user(void *to, const void *from, unsigned long n) |
275 | { | 275 | { |
276 | unsigned long over; | 276 | unsigned long res = n; |
277 | 277 | ||
278 | if (access_ok(VERIFY_READ, from, n)) | 278 | if (likely(access_ok(VERIFY_READ, from, n))) |
279 | return __copy_tofrom_user(to, from, n); | 279 | res = __copy_tofrom_user(to, from, n); |
280 | if ((unsigned long)from < TASK_SIZE) { | 280 | if (unlikely(res)) |
281 | over = (unsigned long)from + n - TASK_SIZE; | 281 | memset(to + (n - res), 0, res); |
282 | return __copy_tofrom_user(to, from, n - over) + over; | 282 | return res; |
283 | } | ||
284 | return n; | ||
285 | } | 283 | } |
286 | 284 | ||
287 | static inline unsigned long | 285 | static inline unsigned long |
288 | copy_to_user(void *to, const void *from, unsigned long n) | 286 | copy_to_user(void *to, const void *from, unsigned long n) |
289 | { | 287 | { |
290 | unsigned long over; | 288 | if (likely(access_ok(VERIFY_WRITE, to, n))) |
291 | 289 | n = __copy_tofrom_user(to, from, n); | |
292 | if (access_ok(VERIFY_WRITE, to, n)) | ||
293 | return __copy_tofrom_user(to, from, n); | ||
294 | if ((unsigned long)to < TASK_SIZE) { | ||
295 | over = (unsigned long)to + n - TASK_SIZE; | ||
296 | return __copy_tofrom_user(to, from, n - over) + over; | ||
297 | } | ||
298 | return n; | 290 | return n; |
299 | } | 291 | } |
300 | 292 | ||
@@ -303,13 +295,8 @@ extern unsigned long __clear_user(void *addr, unsigned long size); | |||
303 | static inline __must_check unsigned long | 295 | static inline __must_check unsigned long |
304 | clear_user(void *addr, unsigned long size) | 296 | clear_user(void *addr, unsigned long size) |
305 | { | 297 | { |
306 | 298 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | |
307 | if (access_ok(VERIFY_WRITE, addr, size)) | 299 | size = __clear_user(addr, size); |
308 | return __clear_user(addr, size); | ||
309 | if ((unsigned long)addr < TASK_SIZE) { | ||
310 | unsigned long over = (unsigned long)addr + size - TASK_SIZE; | ||
311 | return __clear_user(addr, size - over) + over; | ||
312 | } | ||
313 | return size; | 300 | return size; |
314 | } | 301 | } |
315 | 302 | ||
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index e9150487e20d..482847865dac 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
11 | 11 | ||
12 | #include <linux/bug.h> | 12 | #include <linux/bug.h> |
13 | #include <linux/string.h> | ||
13 | 14 | ||
14 | #define VERIFY_READ 0 | 15 | #define VERIFY_READ 0 |
15 | #define VERIFY_WRITE 1 | 16 | #define VERIFY_WRITE 1 |
@@ -221,7 +222,7 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
221 | unsigned long n) | 222 | unsigned long n) |
222 | { | 223 | { |
223 | int sz = __compiletime_object_size(to); | 224 | int sz = __compiletime_object_size(to); |
224 | int ret = -EFAULT; | 225 | unsigned long ret = n; |
225 | 226 | ||
226 | if (likely(sz == -1 || sz >= n)) | 227 | if (likely(sz == -1 || sz >= n)) |
227 | ret = __copy_from_user(to, from, n); | 228 | ret = __copy_from_user(to, from, n); |
@@ -230,6 +231,8 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
230 | else | 231 | else |
231 | __bad_copy_user(); | 232 | __bad_copy_user(); |
232 | 233 | ||
234 | if (unlikely(ret)) | ||
235 | memset(to + (n - ret), 0, ret); | ||
233 | return ret; | 236 | return ret; |
234 | } | 237 | } |
235 | 238 | ||
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h index 2ef55f8968a2..b312b152461b 100644 --- a/arch/powerpc/include/asm/cpu_has_feature.h +++ b/arch/powerpc/include/asm/cpu_has_feature.h | |||
@@ -15,7 +15,7 @@ static inline bool early_cpu_has_feature(unsigned long feature) | |||
15 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS | 15 | #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS |
16 | #include <linux/jump_label.h> | 16 | #include <linux/jump_label.h> |
17 | 17 | ||
18 | #define NUM_CPU_FTR_KEYS 64 | 18 | #define NUM_CPU_FTR_KEYS BITS_PER_LONG |
19 | 19 | ||
20 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; | 20 | extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS]; |
21 | 21 | ||
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index f1e382498bbb..c266227fdd5b 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h | |||
@@ -308,36 +308,21 @@ extern unsigned long __copy_tofrom_user(void __user *to, | |||
308 | static inline unsigned long copy_from_user(void *to, | 308 | static inline unsigned long copy_from_user(void *to, |
309 | const void __user *from, unsigned long n) | 309 | const void __user *from, unsigned long n) |
310 | { | 310 | { |
311 | unsigned long over; | 311 | if (likely(access_ok(VERIFY_READ, from, n))) { |
312 | |||
313 | if (access_ok(VERIFY_READ, from, n)) { | ||
314 | check_object_size(to, n, false); | 312 | check_object_size(to, n, false); |
315 | return __copy_tofrom_user((__force void __user *)to, from, n); | 313 | return __copy_tofrom_user((__force void __user *)to, from, n); |
316 | } | 314 | } |
317 | if ((unsigned long)from < TASK_SIZE) { | 315 | memset(to, 0, n); |
318 | over = (unsigned long)from + n - TASK_SIZE; | ||
319 | check_object_size(to, n - over, false); | ||
320 | return __copy_tofrom_user((__force void __user *)to, from, | ||
321 | n - over) + over; | ||
322 | } | ||
323 | return n; | 316 | return n; |
324 | } | 317 | } |
325 | 318 | ||
326 | static inline unsigned long copy_to_user(void __user *to, | 319 | static inline unsigned long copy_to_user(void __user *to, |
327 | const void *from, unsigned long n) | 320 | const void *from, unsigned long n) |
328 | { | 321 | { |
329 | unsigned long over; | ||
330 | |||
331 | if (access_ok(VERIFY_WRITE, to, n)) { | 322 | if (access_ok(VERIFY_WRITE, to, n)) { |
332 | check_object_size(from, n, true); | 323 | check_object_size(from, n, true); |
333 | return __copy_tofrom_user(to, (__force void __user *)from, n); | 324 | return __copy_tofrom_user(to, (__force void __user *)from, n); |
334 | } | 325 | } |
335 | if ((unsigned long)to < TASK_SIZE) { | ||
336 | over = (unsigned long)to + n - TASK_SIZE; | ||
337 | check_object_size(from, n - over, true); | ||
338 | return __copy_tofrom_user(to, (__force void __user *)from, | ||
339 | n - over) + over; | ||
340 | } | ||
341 | return n; | 326 | return n; |
342 | } | 327 | } |
343 | 328 | ||
@@ -434,10 +419,6 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size) | |||
434 | might_fault(); | 419 | might_fault(); |
435 | if (likely(access_ok(VERIFY_WRITE, addr, size))) | 420 | if (likely(access_ok(VERIFY_WRITE, addr, size))) |
436 | return __clear_user(addr, size); | 421 | return __clear_user(addr, size); |
437 | if ((unsigned long)addr < TASK_SIZE) { | ||
438 | unsigned long over = (unsigned long)addr + size - TASK_SIZE; | ||
439 | return __clear_user(addr, size - over) + over; | ||
440 | } | ||
441 | return size; | 422 | return size; |
442 | } | 423 | } |
443 | 424 | ||
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S index 2265c6398a17..bd739fed26e3 100644 --- a/arch/powerpc/kernel/idle_book3s.S +++ b/arch/powerpc/kernel/idle_book3s.S | |||
@@ -411,7 +411,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) | |||
411 | * | 411 | * |
412 | * r13 - PACA | 412 | * r13 - PACA |
413 | * cr3 - gt if waking up with partial/complete hypervisor state loss | 413 | * cr3 - gt if waking up with partial/complete hypervisor state loss |
414 | * cr4 - eq if waking up from complete hypervisor state loss. | 414 | * cr4 - gt or eq if waking up from complete hypervisor state loss. |
415 | */ | 415 | */ |
416 | _GLOBAL(pnv_wakeup_tb_loss) | 416 | _GLOBAL(pnv_wakeup_tb_loss) |
417 | ld r1,PACAR1(r13) | 417 | ld r1,PACAR1(r13) |
@@ -453,7 +453,7 @@ lwarx_loop2: | |||
453 | * At this stage | 453 | * At this stage |
454 | * cr2 - eq if first thread to wakeup in core | 454 | * cr2 - eq if first thread to wakeup in core |
455 | * cr3- gt if waking up with partial/complete hypervisor state loss | 455 | * cr3- gt if waking up with partial/complete hypervisor state loss |
456 | * cr4 - eq if waking up from complete hypervisor state loss. | 456 | * cr4 - gt or eq if waking up from complete hypervisor state loss. |
457 | */ | 457 | */ |
458 | 458 | ||
459 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT | 459 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT |
@@ -481,7 +481,7 @@ first_thread_in_subcore: | |||
481 | * If waking up from sleep, subcore state is not lost. Hence | 481 | * If waking up from sleep, subcore state is not lost. Hence |
482 | * skip subcore state restore | 482 | * skip subcore state restore |
483 | */ | 483 | */ |
484 | bne cr4,subcore_state_restored | 484 | blt cr4,subcore_state_restored |
485 | 485 | ||
486 | /* Restore per-subcore state */ | 486 | /* Restore per-subcore state */ |
487 | ld r4,_SDR1(r1) | 487 | ld r4,_SDR1(r1) |
@@ -526,7 +526,7 @@ timebase_resync: | |||
526 | * If waking up from sleep, per core state is not lost, skip to | 526 | * If waking up from sleep, per core state is not lost, skip to |
527 | * clear_lock. | 527 | * clear_lock. |
528 | */ | 528 | */ |
529 | bne cr4,clear_lock | 529 | blt cr4,clear_lock |
530 | 530 | ||
531 | /* | 531 | /* |
532 | * First thread in the core to wake up and its waking up with | 532 | * First thread in the core to wake up and its waking up with |
@@ -557,7 +557,7 @@ common_exit: | |||
557 | * If waking up from sleep, hypervisor state is not lost. Hence | 557 | * If waking up from sleep, hypervisor state is not lost. Hence |
558 | * skip hypervisor state restore. | 558 | * skip hypervisor state restore. |
559 | */ | 559 | */ |
560 | bne cr4,hypervisor_state_restored | 560 | blt cr4,hypervisor_state_restored |
561 | 561 | ||
562 | /* Waking up from winkle */ | 562 | /* Waking up from winkle */ |
563 | 563 | ||
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index c16d790808f1..38a5c657ffd3 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -124,6 +124,13 @@ static inline bool pnv_pci_is_m64(struct pnv_phb *phb, struct resource *r) | |||
124 | r->start < (phb->ioda.m64_base + phb->ioda.m64_size)); | 124 | r->start < (phb->ioda.m64_base + phb->ioda.m64_size)); |
125 | } | 125 | } |
126 | 126 | ||
127 | static inline bool pnv_pci_is_m64_flags(unsigned long resource_flags) | ||
128 | { | ||
129 | unsigned long flags = (IORESOURCE_MEM_64 | IORESOURCE_PREFETCH); | ||
130 | |||
131 | return (resource_flags & flags) == flags; | ||
132 | } | ||
133 | |||
127 | static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no) | 134 | static struct pnv_ioda_pe *pnv_ioda_init_pe(struct pnv_phb *phb, int pe_no) |
128 | { | 135 | { |
129 | phb->ioda.pe_array[pe_no].phb = phb; | 136 | phb->ioda.pe_array[pe_no].phb = phb; |
@@ -2217,7 +2224,7 @@ static long pnv_pci_ioda2_set_window(struct iommu_table_group *table_group, | |||
2217 | 2224 | ||
2218 | pnv_pci_link_table_and_group(phb->hose->node, num, | 2225 | pnv_pci_link_table_and_group(phb->hose->node, num, |
2219 | tbl, &pe->table_group); | 2226 | tbl, &pe->table_group); |
2220 | pnv_pci_phb3_tce_invalidate_pe(pe); | 2227 | pnv_pci_ioda2_tce_invalidate_pe(pe); |
2221 | 2228 | ||
2222 | return 0; | 2229 | return 0; |
2223 | } | 2230 | } |
@@ -2355,7 +2362,7 @@ static long pnv_pci_ioda2_unset_window(struct iommu_table_group *table_group, | |||
2355 | if (ret) | 2362 | if (ret) |
2356 | pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); | 2363 | pe_warn(pe, "Unmapping failed, ret = %ld\n", ret); |
2357 | else | 2364 | else |
2358 | pnv_pci_phb3_tce_invalidate_pe(pe); | 2365 | pnv_pci_ioda2_tce_invalidate_pe(pe); |
2359 | 2366 | ||
2360 | pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); | 2367 | pnv_pci_unlink_table_and_group(table_group->tables[num], table_group); |
2361 | 2368 | ||
@@ -2871,7 +2878,7 @@ static void pnv_pci_ioda_fixup_iov_resources(struct pci_dev *pdev) | |||
2871 | res = &pdev->resource[i + PCI_IOV_RESOURCES]; | 2878 | res = &pdev->resource[i + PCI_IOV_RESOURCES]; |
2872 | if (!res->flags || res->parent) | 2879 | if (!res->flags || res->parent) |
2873 | continue; | 2880 | continue; |
2874 | if (!pnv_pci_is_m64(phb, res)) { | 2881 | if (!pnv_pci_is_m64_flags(res->flags)) { |
2875 | dev_warn(&pdev->dev, "Don't support SR-IOV with" | 2882 | dev_warn(&pdev->dev, "Don't support SR-IOV with" |
2876 | " non M64 VF BAR%d: %pR. \n", | 2883 | " non M64 VF BAR%d: %pR. \n", |
2877 | i, res); | 2884 | i, res); |
@@ -3096,7 +3103,7 @@ static resource_size_t pnv_pci_window_alignment(struct pci_bus *bus, | |||
3096 | * alignment for any 64-bit resource, PCIe doesn't care and | 3103 | * alignment for any 64-bit resource, PCIe doesn't care and |
3097 | * bridges only do 64-bit prefetchable anyway. | 3104 | * bridges only do 64-bit prefetchable anyway. |
3098 | */ | 3105 | */ |
3099 | if (phb->ioda.m64_segsize && (type & IORESOURCE_MEM_64)) | 3106 | if (phb->ioda.m64_segsize && pnv_pci_is_m64_flags(type)) |
3100 | return phb->ioda.m64_segsize; | 3107 | return phb->ioda.m64_segsize; |
3101 | if (type & IORESOURCE_MEM) | 3108 | if (type & IORESOURCE_MEM) |
3102 | return phb->ioda.m32_segsize; | 3109 | return phb->ioda.m32_segsize; |
@@ -3426,7 +3433,17 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe) | |||
3426 | } | 3433 | } |
3427 | } | 3434 | } |
3428 | 3435 | ||
3429 | pnv_ioda_free_pe(pe); | 3436 | /* |
3437 | * The PE for root bus can be removed because of hotplug in EEH | ||
3438 | * recovery for fenced PHB error. We need to mark the PE dead so | ||
3439 | * that it can be populated again in PCI hot add path. The PE | ||
3440 | * shouldn't be destroyed as it's the global reserved resource. | ||
3441 | */ | ||
3442 | if (phb->ioda.root_pe_populated && | ||
3443 | phb->ioda.root_pe_idx == pe->pe_number) | ||
3444 | phb->ioda.root_pe_populated = false; | ||
3445 | else | ||
3446 | pnv_ioda_free_pe(pe); | ||
3430 | } | 3447 | } |
3431 | 3448 | ||
3432 | static void pnv_pci_release_device(struct pci_dev *pdev) | 3449 | static void pnv_pci_release_device(struct pci_dev *pdev) |
@@ -3442,7 +3459,17 @@ static void pnv_pci_release_device(struct pci_dev *pdev) | |||
3442 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) | 3459 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) |
3443 | return; | 3460 | return; |
3444 | 3461 | ||
3462 | /* | ||
3463 | * PCI hotplug can happen as part of EEH error recovery. The @pdn | ||
3464 | * isn't removed and added afterwards in this scenario. We should | ||
3465 | * set the PE number in @pdn to an invalid one. Otherwise, the PE's | ||
3466 | * device count is decreased on removing devices while failing to | ||
3467 | * be increased on adding devices. It leads to unbalanced PE's device | ||
3468 | * count and eventually make normal PCI hotplug path broken. | ||
3469 | */ | ||
3445 | pe = &phb->ioda.pe_array[pdn->pe_number]; | 3470 | pe = &phb->ioda.pe_array[pdn->pe_number]; |
3471 | pdn->pe_number = IODA_INVALID_PE; | ||
3472 | |||
3446 | WARN_ON(--pe->device_count < 0); | 3473 | WARN_ON(--pe->device_count < 0); |
3447 | if (pe->device_count == 0) | 3474 | if (pe->device_count == 0) |
3448 | pnv_ioda_release_pe(pe); | 3475 | pnv_ioda_release_pe(pe); |
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h index 95aefdba4be2..52d7c8709279 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h | |||
@@ -266,28 +266,28 @@ int __put_user_bad(void) __attribute__((noreturn)); | |||
266 | __chk_user_ptr(ptr); \ | 266 | __chk_user_ptr(ptr); \ |
267 | switch (sizeof(*(ptr))) { \ | 267 | switch (sizeof(*(ptr))) { \ |
268 | case 1: { \ | 268 | case 1: { \ |
269 | unsigned char __x; \ | 269 | unsigned char __x = 0; \ |
270 | __gu_err = __get_user_fn(&__x, ptr, \ | 270 | __gu_err = __get_user_fn(&__x, ptr, \ |
271 | sizeof(*(ptr))); \ | 271 | sizeof(*(ptr))); \ |
272 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 272 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
273 | break; \ | 273 | break; \ |
274 | }; \ | 274 | }; \ |
275 | case 2: { \ | 275 | case 2: { \ |
276 | unsigned short __x; \ | 276 | unsigned short __x = 0; \ |
277 | __gu_err = __get_user_fn(&__x, ptr, \ | 277 | __gu_err = __get_user_fn(&__x, ptr, \ |
278 | sizeof(*(ptr))); \ | 278 | sizeof(*(ptr))); \ |
279 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 279 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
280 | break; \ | 280 | break; \ |
281 | }; \ | 281 | }; \ |
282 | case 4: { \ | 282 | case 4: { \ |
283 | unsigned int __x; \ | 283 | unsigned int __x = 0; \ |
284 | __gu_err = __get_user_fn(&__x, ptr, \ | 284 | __gu_err = __get_user_fn(&__x, ptr, \ |
285 | sizeof(*(ptr))); \ | 285 | sizeof(*(ptr))); \ |
286 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 286 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
287 | break; \ | 287 | break; \ |
288 | }; \ | 288 | }; \ |
289 | case 8: { \ | 289 | case 8: { \ |
290 | unsigned long long __x; \ | 290 | unsigned long long __x = 0; \ |
291 | __gu_err = __get_user_fn(&__x, ptr, \ | 291 | __gu_err = __get_user_fn(&__x, ptr, \ |
292 | sizeof(*(ptr))); \ | 292 | sizeof(*(ptr))); \ |
293 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ | 293 | (x) = *(__force __typeof__(*(ptr)) *) &__x; \ |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index f142215ed30d..607ec91966c7 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -2231,9 +2231,10 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | |||
2231 | return -EINVAL; | 2231 | return -EINVAL; |
2232 | current->thread.fpu.fpc = fpu->fpc; | 2232 | current->thread.fpu.fpc = fpu->fpc; |
2233 | if (MACHINE_HAS_VX) | 2233 | if (MACHINE_HAS_VX) |
2234 | convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs); | 2234 | convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs, |
2235 | (freg_t *) fpu->fprs); | ||
2235 | else | 2236 | else |
2236 | memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs)); | 2237 | memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs)); |
2237 | return 0; | 2238 | return 0; |
2238 | } | 2239 | } |
2239 | 2240 | ||
@@ -2242,9 +2243,10 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) | |||
2242 | /* make sure we have the latest values */ | 2243 | /* make sure we have the latest values */ |
2243 | save_fpu_regs(); | 2244 | save_fpu_regs(); |
2244 | if (MACHINE_HAS_VX) | 2245 | if (MACHINE_HAS_VX) |
2245 | convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs); | 2246 | convert_vx_to_fp((freg_t *) fpu->fprs, |
2247 | (__vector128 *) vcpu->run->s.regs.vrs); | ||
2246 | else | 2248 | else |
2247 | memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs)); | 2249 | memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs)); |
2248 | fpu->fpc = current->thread.fpu.fpc; | 2250 | fpu->fpc = current->thread.fpu.fpc; |
2249 | return 0; | 2251 | return 0; |
2250 | } | 2252 | } |
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index c106488b4137..d8673e243f13 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c | |||
@@ -584,7 +584,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) | |||
584 | /* Validity 0x0044 will be checked by SIE */ | 584 | /* Validity 0x0044 will be checked by SIE */ |
585 | if (rc) | 585 | if (rc) |
586 | goto unpin; | 586 | goto unpin; |
587 | scb_s->gvrd = hpa; | 587 | scb_s->riccbd = hpa; |
588 | } | 588 | } |
589 | return 0; | 589 | return 0; |
590 | unpin: | 590 | unpin: |
diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h index 20a3591225cc..01aec8ccde83 100644 --- a/arch/score/include/asm/uaccess.h +++ b/arch/score/include/asm/uaccess.h | |||
@@ -163,7 +163,7 @@ do { \ | |||
163 | __get_user_asm(val, "lw", ptr); \ | 163 | __get_user_asm(val, "lw", ptr); \ |
164 | break; \ | 164 | break; \ |
165 | case 8: \ | 165 | case 8: \ |
166 | if ((copy_from_user((void *)&val, ptr, 8)) == 0) \ | 166 | if (__copy_from_user((void *)&val, ptr, 8) == 0) \ |
167 | __gu_err = 0; \ | 167 | __gu_err = 0; \ |
168 | else \ | 168 | else \ |
169 | __gu_err = -EFAULT; \ | 169 | __gu_err = -EFAULT; \ |
@@ -188,6 +188,8 @@ do { \ | |||
188 | \ | 188 | \ |
189 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ | 189 | if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ |
190 | __get_user_common((x), size, __gu_ptr); \ | 190 | __get_user_common((x), size, __gu_ptr); \ |
191 | else \ | ||
192 | (x) = 0; \ | ||
191 | \ | 193 | \ |
192 | __gu_err; \ | 194 | __gu_err; \ |
193 | }) | 195 | }) |
@@ -201,6 +203,7 @@ do { \ | |||
201 | "2:\n" \ | 203 | "2:\n" \ |
202 | ".section .fixup,\"ax\"\n" \ | 204 | ".section .fixup,\"ax\"\n" \ |
203 | "3:li %0, %4\n" \ | 205 | "3:li %0, %4\n" \ |
206 | "li %1, 0\n" \ | ||
204 | "j 2b\n" \ | 207 | "j 2b\n" \ |
205 | ".previous\n" \ | 208 | ".previous\n" \ |
206 | ".section __ex_table,\"a\"\n" \ | 209 | ".section __ex_table,\"a\"\n" \ |
@@ -298,35 +301,34 @@ extern int __copy_tofrom_user(void *to, const void *from, unsigned long len); | |||
298 | static inline unsigned long | 301 | static inline unsigned long |
299 | copy_from_user(void *to, const void *from, unsigned long len) | 302 | copy_from_user(void *to, const void *from, unsigned long len) |
300 | { | 303 | { |
301 | unsigned long over; | 304 | unsigned long res = len; |
302 | 305 | ||
303 | if (access_ok(VERIFY_READ, from, len)) | 306 | if (likely(access_ok(VERIFY_READ, from, len))) |
304 | return __copy_tofrom_user(to, from, len); | 307 | res = __copy_tofrom_user(to, from, len); |
305 | 308 | ||
306 | if ((unsigned long)from < TASK_SIZE) { | 309 | if (unlikely(res)) |
307 | over = (unsigned long)from + len - TASK_SIZE; | 310 | memset(to + (len - res), 0, res); |
308 | return __copy_tofrom_user(to, from, len - over) + over; | 311 | |
309 | } | 312 | return res; |
310 | return len; | ||
311 | } | 313 | } |
312 | 314 | ||
313 | static inline unsigned long | 315 | static inline unsigned long |
314 | copy_to_user(void *to, const void *from, unsigned long len) | 316 | copy_to_user(void *to, const void *from, unsigned long len) |
315 | { | 317 | { |
316 | unsigned long over; | 318 | if (likely(access_ok(VERIFY_WRITE, to, len))) |
317 | 319 | len = __copy_tofrom_user(to, from, len); | |
318 | if (access_ok(VERIFY_WRITE, to, len)) | ||
319 | return __copy_tofrom_user(to, from, len); | ||
320 | 320 | ||
321 | if ((unsigned long)to < TASK_SIZE) { | ||
322 | over = (unsigned long)to + len - TASK_SIZE; | ||
323 | return __copy_tofrom_user(to, from, len - over) + over; | ||
324 | } | ||
325 | return len; | 321 | return len; |
326 | } | 322 | } |
327 | 323 | ||
328 | #define __copy_from_user(to, from, len) \ | 324 | static inline unsigned long |
329 | __copy_tofrom_user((to), (from), (len)) | 325 | __copy_from_user(void *to, const void *from, unsigned long len) |
326 | { | ||
327 | unsigned long left = __copy_tofrom_user(to, from, len); | ||
328 | if (unlikely(left)) | ||
329 | memset(to + (len - left), 0, left); | ||
330 | return left; | ||
331 | } | ||
330 | 332 | ||
331 | #define __copy_to_user(to, from, len) \ | 333 | #define __copy_to_user(to, from, len) \ |
332 | __copy_tofrom_user((to), (from), (len)) | 334 | __copy_tofrom_user((to), (from), (len)) |
@@ -340,17 +342,17 @@ __copy_to_user_inatomic(void *to, const void *from, unsigned long len) | |||
340 | static inline unsigned long | 342 | static inline unsigned long |
341 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) | 343 | __copy_from_user_inatomic(void *to, const void *from, unsigned long len) |
342 | { | 344 | { |
343 | return __copy_from_user(to, from, len); | 345 | return __copy_tofrom_user(to, from, len); |
344 | } | 346 | } |
345 | 347 | ||
346 | #define __copy_in_user(to, from, len) __copy_from_user(to, from, len) | 348 | #define __copy_in_user(to, from, len) __copy_tofrom_user(to, from, len) |
347 | 349 | ||
348 | static inline unsigned long | 350 | static inline unsigned long |
349 | copy_in_user(void *to, const void *from, unsigned long len) | 351 | copy_in_user(void *to, const void *from, unsigned long len) |
350 | { | 352 | { |
351 | if (access_ok(VERIFY_READ, from, len) && | 353 | if (access_ok(VERIFY_READ, from, len) && |
352 | access_ok(VERFITY_WRITE, to, len)) | 354 | access_ok(VERFITY_WRITE, to, len)) |
353 | return copy_from_user(to, from, len); | 355 | return __copy_tofrom_user(to, from, len); |
354 | } | 356 | } |
355 | 357 | ||
356 | /* | 358 | /* |
diff --git a/arch/sh/include/asm/atomic-llsc.h b/arch/sh/include/asm/atomic-llsc.h index caea2c45f6c2..1d159ce50f5a 100644 --- a/arch/sh/include/asm/atomic-llsc.h +++ b/arch/sh/include/asm/atomic-llsc.h | |||
@@ -60,7 +60,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ | |||
60 | " movco.l %0, @%3 \n" \ | 60 | " movco.l %0, @%3 \n" \ |
61 | " bf 1b \n" \ | 61 | " bf 1b \n" \ |
62 | " synco \n" \ | 62 | " synco \n" \ |
63 | : "=&z" (temp), "=&z" (res) \ | 63 | : "=&z" (temp), "=&r" (res) \ |
64 | : "r" (i), "r" (&v->counter) \ | 64 | : "r" (i), "r" (&v->counter) \ |
65 | : "t"); \ | 65 | : "t"); \ |
66 | \ | 66 | \ |
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index a49635c51266..92ade79ac427 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h | |||
@@ -151,7 +151,10 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
151 | __kernel_size_t __copy_size = (__kernel_size_t) n; | 151 | __kernel_size_t __copy_size = (__kernel_size_t) n; |
152 | 152 | ||
153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) | 153 | if (__copy_size && __access_ok(__copy_from, __copy_size)) |
154 | return __copy_user(to, from, __copy_size); | 154 | __copy_size = __copy_user(to, from, __copy_size); |
155 | |||
156 | if (unlikely(__copy_size)) | ||
157 | memset(to + (n - __copy_size), 0, __copy_size); | ||
155 | 158 | ||
156 | return __copy_size; | 159 | return __copy_size; |
157 | } | 160 | } |
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h index c01376c76b86..ca5073dd4596 100644 --- a/arch/sh/include/asm/uaccess_64.h +++ b/arch/sh/include/asm/uaccess_64.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define __get_user_size(x,ptr,size,retval) \ | 24 | #define __get_user_size(x,ptr,size,retval) \ |
25 | do { \ | 25 | do { \ |
26 | retval = 0; \ | 26 | retval = 0; \ |
27 | x = 0; \ | ||
27 | switch (size) { \ | 28 | switch (size) { \ |
28 | case 1: \ | 29 | case 1: \ |
29 | retval = __get_user_asm_b((void *)&x, \ | 30 | retval = __get_user_asm_b((void *)&x, \ |
diff --git a/arch/sparc/include/asm/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h index e722c510bb1b..ea55f86d7ccd 100644 --- a/arch/sparc/include/asm/uaccess_32.h +++ b/arch/sparc/include/asm/uaccess_32.h | |||
@@ -266,8 +266,10 @@ static inline unsigned long copy_from_user(void *to, const void __user *from, un | |||
266 | if (n && __access_ok((unsigned long) from, n)) { | 266 | if (n && __access_ok((unsigned long) from, n)) { |
267 | check_object_size(to, n, false); | 267 | check_object_size(to, n, false); |
268 | return __copy_user((__force void __user *) to, from, n); | 268 | return __copy_user((__force void __user *) to, from, n); |
269 | } else | 269 | } else { |
270 | memset(to, 0, n); | ||
270 | return n; | 271 | return n; |
272 | } | ||
271 | } | 273 | } |
272 | 274 | ||
273 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | 275 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) |
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index ff574dad95cc..94dd4a31f5b3 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -1004,79 +1004,87 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext, | |||
1004 | return status; | 1004 | return status; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | static efi_status_t exit_boot(struct boot_params *boot_params, | 1007 | struct exit_boot_struct { |
1008 | void *handle, bool is64) | 1008 | struct boot_params *boot_params; |
1009 | { | 1009 | struct efi_info *efi; |
1010 | struct efi_info *efi = &boot_params->efi_info; | ||
1011 | unsigned long map_sz, key, desc_size; | ||
1012 | efi_memory_desc_t *mem_map; | ||
1013 | struct setup_data *e820ext; | 1010 | struct setup_data *e820ext; |
1014 | const char *signature; | ||
1015 | __u32 e820ext_size; | 1011 | __u32 e820ext_size; |
1016 | __u32 nr_desc, prev_nr_desc; | 1012 | bool is64; |
1017 | efi_status_t status; | 1013 | }; |
1018 | __u32 desc_version; | ||
1019 | bool called_exit = false; | ||
1020 | u8 nr_entries; | ||
1021 | int i; | ||
1022 | |||
1023 | nr_desc = 0; | ||
1024 | e820ext = NULL; | ||
1025 | e820ext_size = 0; | ||
1026 | |||
1027 | get_map: | ||
1028 | status = efi_get_memory_map(sys_table, &mem_map, &map_sz, &desc_size, | ||
1029 | &desc_version, &key); | ||
1030 | |||
1031 | if (status != EFI_SUCCESS) | ||
1032 | return status; | ||
1033 | |||
1034 | prev_nr_desc = nr_desc; | ||
1035 | nr_desc = map_sz / desc_size; | ||
1036 | if (nr_desc > prev_nr_desc && | ||
1037 | nr_desc > ARRAY_SIZE(boot_params->e820_map)) { | ||
1038 | u32 nr_e820ext = nr_desc - ARRAY_SIZE(boot_params->e820_map); | ||
1039 | |||
1040 | status = alloc_e820ext(nr_e820ext, &e820ext, &e820ext_size); | ||
1041 | if (status != EFI_SUCCESS) | ||
1042 | goto free_mem_map; | ||
1043 | 1014 | ||
1044 | efi_call_early(free_pool, mem_map); | 1015 | static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, |
1045 | goto get_map; /* Allocated memory, get map again */ | 1016 | struct efi_boot_memmap *map, |
1017 | void *priv) | ||
1018 | { | ||
1019 | static bool first = true; | ||
1020 | const char *signature; | ||
1021 | __u32 nr_desc; | ||
1022 | efi_status_t status; | ||
1023 | struct exit_boot_struct *p = priv; | ||
1024 | |||
1025 | if (first) { | ||
1026 | nr_desc = *map->buff_size / *map->desc_size; | ||
1027 | if (nr_desc > ARRAY_SIZE(p->boot_params->e820_map)) { | ||
1028 | u32 nr_e820ext = nr_desc - | ||
1029 | ARRAY_SIZE(p->boot_params->e820_map); | ||
1030 | |||
1031 | status = alloc_e820ext(nr_e820ext, &p->e820ext, | ||
1032 | &p->e820ext_size); | ||
1033 | if (status != EFI_SUCCESS) | ||
1034 | return status; | ||
1035 | } | ||
1036 | first = false; | ||
1046 | } | 1037 | } |
1047 | 1038 | ||
1048 | signature = is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; | 1039 | signature = p->is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE; |
1049 | memcpy(&efi->efi_loader_signature, signature, sizeof(__u32)); | 1040 | memcpy(&p->efi->efi_loader_signature, signature, sizeof(__u32)); |
1050 | 1041 | ||
1051 | efi->efi_systab = (unsigned long)sys_table; | 1042 | p->efi->efi_systab = (unsigned long)sys_table_arg; |
1052 | efi->efi_memdesc_size = desc_size; | 1043 | p->efi->efi_memdesc_size = *map->desc_size; |
1053 | efi->efi_memdesc_version = desc_version; | 1044 | p->efi->efi_memdesc_version = *map->desc_ver; |
1054 | efi->efi_memmap = (unsigned long)mem_map; | 1045 | p->efi->efi_memmap = (unsigned long)*map->map; |
1055 | efi->efi_memmap_size = map_sz; | 1046 | p->efi->efi_memmap_size = *map->map_size; |
1056 | 1047 | ||
1057 | #ifdef CONFIG_X86_64 | 1048 | #ifdef CONFIG_X86_64 |
1058 | efi->efi_systab_hi = (unsigned long)sys_table >> 32; | 1049 | p->efi->efi_systab_hi = (unsigned long)sys_table_arg >> 32; |
1059 | efi->efi_memmap_hi = (unsigned long)mem_map >> 32; | 1050 | p->efi->efi_memmap_hi = (unsigned long)*map->map >> 32; |
1060 | #endif | 1051 | #endif |
1061 | 1052 | ||
1053 | return EFI_SUCCESS; | ||
1054 | } | ||
1055 | |||
1056 | static efi_status_t exit_boot(struct boot_params *boot_params, | ||
1057 | void *handle, bool is64) | ||
1058 | { | ||
1059 | unsigned long map_sz, key, desc_size, buff_size; | ||
1060 | efi_memory_desc_t *mem_map; | ||
1061 | struct setup_data *e820ext; | ||
1062 | __u32 e820ext_size; | ||
1063 | efi_status_t status; | ||
1064 | __u32 desc_version; | ||
1065 | struct efi_boot_memmap map; | ||
1066 | struct exit_boot_struct priv; | ||
1067 | |||
1068 | map.map = &mem_map; | ||
1069 | map.map_size = &map_sz; | ||
1070 | map.desc_size = &desc_size; | ||
1071 | map.desc_ver = &desc_version; | ||
1072 | map.key_ptr = &key; | ||
1073 | map.buff_size = &buff_size; | ||
1074 | priv.boot_params = boot_params; | ||
1075 | priv.efi = &boot_params->efi_info; | ||
1076 | priv.e820ext = NULL; | ||
1077 | priv.e820ext_size = 0; | ||
1078 | priv.is64 = is64; | ||
1079 | |||
1062 | /* Might as well exit boot services now */ | 1080 | /* Might as well exit boot services now */ |
1063 | status = efi_call_early(exit_boot_services, handle, key); | 1081 | status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
1064 | if (status != EFI_SUCCESS) { | 1082 | exit_boot_func); |
1065 | /* | 1083 | if (status != EFI_SUCCESS) |
1066 | * ExitBootServices() will fail if any of the event | 1084 | return status; |
1067 | * handlers change the memory map. In which case, we | ||
1068 | * must be prepared to retry, but only once so that | ||
1069 | * we're guaranteed to exit on repeated failures instead | ||
1070 | * of spinning forever. | ||
1071 | */ | ||
1072 | if (called_exit) | ||
1073 | goto free_mem_map; | ||
1074 | |||
1075 | called_exit = true; | ||
1076 | efi_call_early(free_pool, mem_map); | ||
1077 | goto get_map; | ||
1078 | } | ||
1079 | 1085 | ||
1086 | e820ext = priv.e820ext; | ||
1087 | e820ext_size = priv.e820ext_size; | ||
1080 | /* Historic? */ | 1088 | /* Historic? */ |
1081 | boot_params->alt_mem_k = 32 * 1024; | 1089 | boot_params->alt_mem_k = 32 * 1024; |
1082 | 1090 | ||
@@ -1085,10 +1093,6 @@ get_map: | |||
1085 | return status; | 1093 | return status; |
1086 | 1094 | ||
1087 | return EFI_SUCCESS; | 1095 | return EFI_SUCCESS; |
1088 | |||
1089 | free_mem_map: | ||
1090 | efi_call_early(free_pool, mem_map); | ||
1091 | return status; | ||
1092 | } | 1096 | } |
1093 | 1097 | ||
1094 | /* | 1098 | /* |
diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index e07a22bb9308..f5f4b3fbbbc2 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c | |||
@@ -119,8 +119,8 @@ static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = | |||
119 | { | 119 | { |
120 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 120 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
121 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 121 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
122 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, | 122 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
123 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, | 123 | [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
124 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | 124 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
125 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | 125 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
126 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ | 126 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index e6131d4454e6..65577f081d07 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | #define COUNTER_SHIFT 16 | 30 | #define COUNTER_SHIFT 16 |
31 | 31 | ||
32 | static HLIST_HEAD(uncore_unused_list); | ||
33 | |||
32 | struct amd_uncore { | 34 | struct amd_uncore { |
33 | int id; | 35 | int id; |
34 | int refcnt; | 36 | int refcnt; |
@@ -39,7 +41,7 @@ struct amd_uncore { | |||
39 | cpumask_t *active_mask; | 41 | cpumask_t *active_mask; |
40 | struct pmu *pmu; | 42 | struct pmu *pmu; |
41 | struct perf_event *events[MAX_COUNTERS]; | 43 | struct perf_event *events[MAX_COUNTERS]; |
42 | struct amd_uncore *free_when_cpu_online; | 44 | struct hlist_node node; |
43 | }; | 45 | }; |
44 | 46 | ||
45 | static struct amd_uncore * __percpu *amd_uncore_nb; | 47 | static struct amd_uncore * __percpu *amd_uncore_nb; |
@@ -306,6 +308,7 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu) | |||
306 | uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; | 308 | uncore_nb->msr_base = MSR_F15H_NB_PERF_CTL; |
307 | uncore_nb->active_mask = &amd_nb_active_mask; | 309 | uncore_nb->active_mask = &amd_nb_active_mask; |
308 | uncore_nb->pmu = &amd_nb_pmu; | 310 | uncore_nb->pmu = &amd_nb_pmu; |
311 | uncore_nb->id = -1; | ||
309 | *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; | 312 | *per_cpu_ptr(amd_uncore_nb, cpu) = uncore_nb; |
310 | } | 313 | } |
311 | 314 | ||
@@ -319,6 +322,7 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu) | |||
319 | uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; | 322 | uncore_l2->msr_base = MSR_F16H_L2I_PERF_CTL; |
320 | uncore_l2->active_mask = &amd_l2_active_mask; | 323 | uncore_l2->active_mask = &amd_l2_active_mask; |
321 | uncore_l2->pmu = &amd_l2_pmu; | 324 | uncore_l2->pmu = &amd_l2_pmu; |
325 | uncore_l2->id = -1; | ||
322 | *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; | 326 | *per_cpu_ptr(amd_uncore_l2, cpu) = uncore_l2; |
323 | } | 327 | } |
324 | 328 | ||
@@ -348,7 +352,7 @@ amd_uncore_find_online_sibling(struct amd_uncore *this, | |||
348 | continue; | 352 | continue; |
349 | 353 | ||
350 | if (this->id == that->id) { | 354 | if (this->id == that->id) { |
351 | that->free_when_cpu_online = this; | 355 | hlist_add_head(&this->node, &uncore_unused_list); |
352 | this = that; | 356 | this = that; |
353 | break; | 357 | break; |
354 | } | 358 | } |
@@ -388,13 +392,23 @@ static int amd_uncore_cpu_starting(unsigned int cpu) | |||
388 | return 0; | 392 | return 0; |
389 | } | 393 | } |
390 | 394 | ||
395 | static void uncore_clean_online(void) | ||
396 | { | ||
397 | struct amd_uncore *uncore; | ||
398 | struct hlist_node *n; | ||
399 | |||
400 | hlist_for_each_entry_safe(uncore, n, &uncore_unused_list, node) { | ||
401 | hlist_del(&uncore->node); | ||
402 | kfree(uncore); | ||
403 | } | ||
404 | } | ||
405 | |||
391 | static void uncore_online(unsigned int cpu, | 406 | static void uncore_online(unsigned int cpu, |
392 | struct amd_uncore * __percpu *uncores) | 407 | struct amd_uncore * __percpu *uncores) |
393 | { | 408 | { |
394 | struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); | 409 | struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); |
395 | 410 | ||
396 | kfree(uncore->free_when_cpu_online); | 411 | uncore_clean_online(); |
397 | uncore->free_when_cpu_online = NULL; | ||
398 | 412 | ||
399 | if (cpu == uncore->cpu) | 413 | if (cpu == uncore->cpu) |
400 | cpumask_set_cpu(cpu, uncore->active_mask); | 414 | cpumask_set_cpu(cpu, uncore->active_mask); |
diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c index 0a6e393a2e62..982c9e31daca 100644 --- a/arch/x86/events/intel/bts.c +++ b/arch/x86/events/intel/bts.c | |||
@@ -31,7 +31,17 @@ | |||
31 | struct bts_ctx { | 31 | struct bts_ctx { |
32 | struct perf_output_handle handle; | 32 | struct perf_output_handle handle; |
33 | struct debug_store ds_back; | 33 | struct debug_store ds_back; |
34 | int started; | 34 | int state; |
35 | }; | ||
36 | |||
37 | /* BTS context states: */ | ||
38 | enum { | ||
39 | /* no ongoing AUX transactions */ | ||
40 | BTS_STATE_STOPPED = 0, | ||
41 | /* AUX transaction is on, BTS tracing is disabled */ | ||
42 | BTS_STATE_INACTIVE, | ||
43 | /* AUX transaction is on, BTS tracing is running */ | ||
44 | BTS_STATE_ACTIVE, | ||
35 | }; | 45 | }; |
36 | 46 | ||
37 | static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); | 47 | static DEFINE_PER_CPU(struct bts_ctx, bts_ctx); |
@@ -204,6 +214,15 @@ static void bts_update(struct bts_ctx *bts) | |||
204 | static int | 214 | static int |
205 | bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); | 215 | bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle); |
206 | 216 | ||
217 | /* | ||
218 | * Ordering PMU callbacks wrt themselves and the PMI is done by means | ||
219 | * of bts::state, which: | ||
220 | * - is set when bts::handle::event is valid, that is, between | ||
221 | * perf_aux_output_begin() and perf_aux_output_end(); | ||
222 | * - is zero otherwise; | ||
223 | * - is ordered against bts::handle::event with a compiler barrier. | ||
224 | */ | ||
225 | |||
207 | static void __bts_event_start(struct perf_event *event) | 226 | static void __bts_event_start(struct perf_event *event) |
208 | { | 227 | { |
209 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 228 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
@@ -221,10 +240,13 @@ static void __bts_event_start(struct perf_event *event) | |||
221 | 240 | ||
222 | /* | 241 | /* |
223 | * local barrier to make sure that ds configuration made it | 242 | * local barrier to make sure that ds configuration made it |
224 | * before we enable BTS | 243 | * before we enable BTS and bts::state goes ACTIVE |
225 | */ | 244 | */ |
226 | wmb(); | 245 | wmb(); |
227 | 246 | ||
247 | /* INACTIVE/STOPPED -> ACTIVE */ | ||
248 | WRITE_ONCE(bts->state, BTS_STATE_ACTIVE); | ||
249 | |||
228 | intel_pmu_enable_bts(config); | 250 | intel_pmu_enable_bts(config); |
229 | 251 | ||
230 | } | 252 | } |
@@ -251,9 +273,6 @@ static void bts_event_start(struct perf_event *event, int flags) | |||
251 | 273 | ||
252 | __bts_event_start(event); | 274 | __bts_event_start(event); |
253 | 275 | ||
254 | /* PMI handler: this counter is running and likely generating PMIs */ | ||
255 | ACCESS_ONCE(bts->started) = 1; | ||
256 | |||
257 | return; | 276 | return; |
258 | 277 | ||
259 | fail_end_stop: | 278 | fail_end_stop: |
@@ -263,30 +282,34 @@ fail_stop: | |||
263 | event->hw.state = PERF_HES_STOPPED; | 282 | event->hw.state = PERF_HES_STOPPED; |
264 | } | 283 | } |
265 | 284 | ||
266 | static void __bts_event_stop(struct perf_event *event) | 285 | static void __bts_event_stop(struct perf_event *event, int state) |
267 | { | 286 | { |
287 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | ||
288 | |||
289 | /* ACTIVE -> INACTIVE(PMI)/STOPPED(->stop()) */ | ||
290 | WRITE_ONCE(bts->state, state); | ||
291 | |||
268 | /* | 292 | /* |
269 | * No extra synchronization is mandated by the documentation to have | 293 | * No extra synchronization is mandated by the documentation to have |
270 | * BTS data stores globally visible. | 294 | * BTS data stores globally visible. |
271 | */ | 295 | */ |
272 | intel_pmu_disable_bts(); | 296 | intel_pmu_disable_bts(); |
273 | |||
274 | if (event->hw.state & PERF_HES_STOPPED) | ||
275 | return; | ||
276 | |||
277 | ACCESS_ONCE(event->hw.state) |= PERF_HES_STOPPED; | ||
278 | } | 297 | } |
279 | 298 | ||
280 | static void bts_event_stop(struct perf_event *event, int flags) | 299 | static void bts_event_stop(struct perf_event *event, int flags) |
281 | { | 300 | { |
282 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | 301 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); |
283 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 302 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
284 | struct bts_buffer *buf = perf_get_aux(&bts->handle); | 303 | struct bts_buffer *buf = NULL; |
304 | int state = READ_ONCE(bts->state); | ||
285 | 305 | ||
286 | /* PMI handler: don't restart this counter */ | 306 | if (state == BTS_STATE_ACTIVE) |
287 | ACCESS_ONCE(bts->started) = 0; | 307 | __bts_event_stop(event, BTS_STATE_STOPPED); |
288 | 308 | ||
289 | __bts_event_stop(event); | 309 | if (state != BTS_STATE_STOPPED) |
310 | buf = perf_get_aux(&bts->handle); | ||
311 | |||
312 | event->hw.state |= PERF_HES_STOPPED; | ||
290 | 313 | ||
291 | if (flags & PERF_EF_UPDATE) { | 314 | if (flags & PERF_EF_UPDATE) { |
292 | bts_update(bts); | 315 | bts_update(bts); |
@@ -296,6 +319,7 @@ static void bts_event_stop(struct perf_event *event, int flags) | |||
296 | bts->handle.head = | 319 | bts->handle.head = |
297 | local_xchg(&buf->data_size, | 320 | local_xchg(&buf->data_size, |
298 | buf->nr_pages << PAGE_SHIFT); | 321 | buf->nr_pages << PAGE_SHIFT); |
322 | |||
299 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), | 323 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), |
300 | !!local_xchg(&buf->lost, 0)); | 324 | !!local_xchg(&buf->lost, 0)); |
301 | } | 325 | } |
@@ -310,8 +334,20 @@ static void bts_event_stop(struct perf_event *event, int flags) | |||
310 | void intel_bts_enable_local(void) | 334 | void intel_bts_enable_local(void) |
311 | { | 335 | { |
312 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 336 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
337 | int state = READ_ONCE(bts->state); | ||
338 | |||
339 | /* | ||
340 | * Here we transition from INACTIVE to ACTIVE; | ||
341 | * if we instead are STOPPED from the interrupt handler, | ||
342 | * stay that way. Can't be ACTIVE here though. | ||
343 | */ | ||
344 | if (WARN_ON_ONCE(state == BTS_STATE_ACTIVE)) | ||
345 | return; | ||
346 | |||
347 | if (state == BTS_STATE_STOPPED) | ||
348 | return; | ||
313 | 349 | ||
314 | if (bts->handle.event && bts->started) | 350 | if (bts->handle.event) |
315 | __bts_event_start(bts->handle.event); | 351 | __bts_event_start(bts->handle.event); |
316 | } | 352 | } |
317 | 353 | ||
@@ -319,8 +355,15 @@ void intel_bts_disable_local(void) | |||
319 | { | 355 | { |
320 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 356 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
321 | 357 | ||
358 | /* | ||
359 | * Here we transition from ACTIVE to INACTIVE; | ||
360 | * do nothing for STOPPED or INACTIVE. | ||
361 | */ | ||
362 | if (READ_ONCE(bts->state) != BTS_STATE_ACTIVE) | ||
363 | return; | ||
364 | |||
322 | if (bts->handle.event) | 365 | if (bts->handle.event) |
323 | __bts_event_stop(bts->handle.event); | 366 | __bts_event_stop(bts->handle.event, BTS_STATE_INACTIVE); |
324 | } | 367 | } |
325 | 368 | ||
326 | static int | 369 | static int |
@@ -335,8 +378,6 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle) | |||
335 | return 0; | 378 | return 0; |
336 | 379 | ||
337 | head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); | 380 | head = handle->head & ((buf->nr_pages << PAGE_SHIFT) - 1); |
338 | if (WARN_ON_ONCE(head != local_read(&buf->head))) | ||
339 | return -EINVAL; | ||
340 | 381 | ||
341 | phys = &buf->buf[buf->cur_buf]; | 382 | phys = &buf->buf[buf->cur_buf]; |
342 | space = phys->offset + phys->displacement + phys->size - head; | 383 | space = phys->offset + phys->displacement + phys->size - head; |
@@ -403,22 +444,37 @@ bts_buffer_reset(struct bts_buffer *buf, struct perf_output_handle *handle) | |||
403 | 444 | ||
404 | int intel_bts_interrupt(void) | 445 | int intel_bts_interrupt(void) |
405 | { | 446 | { |
447 | struct debug_store *ds = this_cpu_ptr(&cpu_hw_events)->ds; | ||
406 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); | 448 | struct bts_ctx *bts = this_cpu_ptr(&bts_ctx); |
407 | struct perf_event *event = bts->handle.event; | 449 | struct perf_event *event = bts->handle.event; |
408 | struct bts_buffer *buf; | 450 | struct bts_buffer *buf; |
409 | s64 old_head; | 451 | s64 old_head; |
410 | int err; | 452 | int err = -ENOSPC, handled = 0; |
411 | 453 | ||
412 | if (!event || !bts->started) | 454 | /* |
413 | return 0; | 455 | * The only surefire way of knowing if this NMI is ours is by checking |
456 | * the write ptr against the PMI threshold. | ||
457 | */ | ||
458 | if (ds && (ds->bts_index >= ds->bts_interrupt_threshold)) | ||
459 | handled = 1; | ||
460 | |||
461 | /* | ||
462 | * this is wrapped in intel_bts_enable_local/intel_bts_disable_local, | ||
463 | * so we can only be INACTIVE or STOPPED | ||
464 | */ | ||
465 | if (READ_ONCE(bts->state) == BTS_STATE_STOPPED) | ||
466 | return handled; | ||
414 | 467 | ||
415 | buf = perf_get_aux(&bts->handle); | 468 | buf = perf_get_aux(&bts->handle); |
469 | if (!buf) | ||
470 | return handled; | ||
471 | |||
416 | /* | 472 | /* |
417 | * Skip snapshot counters: they don't use the interrupt, but | 473 | * Skip snapshot counters: they don't use the interrupt, but |
418 | * there's no other way of telling, because the pointer will | 474 | * there's no other way of telling, because the pointer will |
419 | * keep moving | 475 | * keep moving |
420 | */ | 476 | */ |
421 | if (!buf || buf->snapshot) | 477 | if (buf->snapshot) |
422 | return 0; | 478 | return 0; |
423 | 479 | ||
424 | old_head = local_read(&buf->head); | 480 | old_head = local_read(&buf->head); |
@@ -426,18 +482,27 @@ int intel_bts_interrupt(void) | |||
426 | 482 | ||
427 | /* no new data */ | 483 | /* no new data */ |
428 | if (old_head == local_read(&buf->head)) | 484 | if (old_head == local_read(&buf->head)) |
429 | return 0; | 485 | return handled; |
430 | 486 | ||
431 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), | 487 | perf_aux_output_end(&bts->handle, local_xchg(&buf->data_size, 0), |
432 | !!local_xchg(&buf->lost, 0)); | 488 | !!local_xchg(&buf->lost, 0)); |
433 | 489 | ||
434 | buf = perf_aux_output_begin(&bts->handle, event); | 490 | buf = perf_aux_output_begin(&bts->handle, event); |
435 | if (!buf) | 491 | if (buf) |
436 | return 1; | 492 | err = bts_buffer_reset(buf, &bts->handle); |
493 | |||
494 | if (err) { | ||
495 | WRITE_ONCE(bts->state, BTS_STATE_STOPPED); | ||
437 | 496 | ||
438 | err = bts_buffer_reset(buf, &bts->handle); | 497 | if (buf) { |
439 | if (err) | 498 | /* |
440 | perf_aux_output_end(&bts->handle, 0, false); | 499 | * BTS_STATE_STOPPED should be visible before |
500 | * cleared handle::event | ||
501 | */ | ||
502 | barrier(); | ||
503 | perf_aux_output_end(&bts->handle, 0, false); | ||
504 | } | ||
505 | } | ||
441 | 506 | ||
442 | return 1; | 507 | return 1; |
443 | } | 508 | } |
@@ -519,7 +584,8 @@ static __init int bts_init(void) | |||
519 | if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts) | 584 | if (!boot_cpu_has(X86_FEATURE_DTES64) || !x86_pmu.bts) |
520 | return -ENODEV; | 585 | return -ENODEV; |
521 | 586 | ||
522 | bts_pmu.capabilities = PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE; | 587 | bts_pmu.capabilities = PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_ITRACE | |
588 | PERF_PMU_CAP_EXCLUSIVE; | ||
523 | bts_pmu.task_ctx_nr = perf_sw_context; | 589 | bts_pmu.task_ctx_nr = perf_sw_context; |
524 | bts_pmu.event_init = bts_event_init; | 590 | bts_pmu.event_init = bts_event_init; |
525 | bts_pmu.add = bts_event_add; | 591 | bts_pmu.add = bts_event_add; |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 2cbde2f449aa..4c9a79b9cd69 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
@@ -1730,9 +1730,11 @@ static __initconst const u64 knl_hw_cache_extra_regs | |||
1730 | * disabled state if called consecutively. | 1730 | * disabled state if called consecutively. |
1731 | * | 1731 | * |
1732 | * During consecutive calls, the same disable value will be written to related | 1732 | * During consecutive calls, the same disable value will be written to related |
1733 | * registers, so the PMU state remains unchanged. hw.state in | 1733 | * registers, so the PMU state remains unchanged. |
1734 | * intel_bts_disable_local will remain PERF_HES_STOPPED too in consecutive | 1734 | * |
1735 | * calls. | 1735 | * intel_bts events don't coexist with intel PMU's BTS events because of |
1736 | * x86_add_exclusive(x86_lbr_exclusive_lbr); there's no need to keep them | ||
1737 | * disabled around intel PMU's event batching etc, only inside the PMI handler. | ||
1736 | */ | 1738 | */ |
1737 | static void __intel_pmu_disable_all(void) | 1739 | static void __intel_pmu_disable_all(void) |
1738 | { | 1740 | { |
@@ -1742,8 +1744,6 @@ static void __intel_pmu_disable_all(void) | |||
1742 | 1744 | ||
1743 | if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) | 1745 | if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask)) |
1744 | intel_pmu_disable_bts(); | 1746 | intel_pmu_disable_bts(); |
1745 | else | ||
1746 | intel_bts_disable_local(); | ||
1747 | 1747 | ||
1748 | intel_pmu_pebs_disable_all(); | 1748 | intel_pmu_pebs_disable_all(); |
1749 | } | 1749 | } |
@@ -1771,8 +1771,7 @@ static void __intel_pmu_enable_all(int added, bool pmi) | |||
1771 | return; | 1771 | return; |
1772 | 1772 | ||
1773 | intel_pmu_enable_bts(event->hw.config); | 1773 | intel_pmu_enable_bts(event->hw.config); |
1774 | } else | 1774 | } |
1775 | intel_bts_enable_local(); | ||
1776 | } | 1775 | } |
1777 | 1776 | ||
1778 | static void intel_pmu_enable_all(int added) | 1777 | static void intel_pmu_enable_all(int added) |
@@ -2073,6 +2072,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) | |||
2073 | */ | 2072 | */ |
2074 | if (!x86_pmu.late_ack) | 2073 | if (!x86_pmu.late_ack) |
2075 | apic_write(APIC_LVTPC, APIC_DM_NMI); | 2074 | apic_write(APIC_LVTPC, APIC_DM_NMI); |
2075 | intel_bts_disable_local(); | ||
2076 | __intel_pmu_disable_all(); | 2076 | __intel_pmu_disable_all(); |
2077 | handled = intel_pmu_drain_bts_buffer(); | 2077 | handled = intel_pmu_drain_bts_buffer(); |
2078 | handled += intel_bts_interrupt(); | 2078 | handled += intel_bts_interrupt(); |
@@ -2172,6 +2172,7 @@ done: | |||
2172 | /* Only restore PMU state when it's active. See x86_pmu_disable(). */ | 2172 | /* Only restore PMU state when it's active. See x86_pmu_disable(). */ |
2173 | if (cpuc->enabled) | 2173 | if (cpuc->enabled) |
2174 | __intel_pmu_enable_all(0, true); | 2174 | __intel_pmu_enable_all(0, true); |
2175 | intel_bts_enable_local(); | ||
2175 | 2176 | ||
2176 | /* | 2177 | /* |
2177 | * Only unmask the NMI after the overflow counters | 2178 | * Only unmask the NMI after the overflow counters |
diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c index 783c49ddef29..8f82b02934fa 100644 --- a/arch/x86/events/intel/cqm.c +++ b/arch/x86/events/intel/cqm.c | |||
@@ -458,6 +458,11 @@ static void __intel_cqm_event_count(void *info); | |||
458 | static void init_mbm_sample(u32 rmid, u32 evt_type); | 458 | static void init_mbm_sample(u32 rmid, u32 evt_type); |
459 | static void __intel_mbm_event_count(void *info); | 459 | static void __intel_mbm_event_count(void *info); |
460 | 460 | ||
461 | static bool is_cqm_event(int e) | ||
462 | { | ||
463 | return (e == QOS_L3_OCCUP_EVENT_ID); | ||
464 | } | ||
465 | |||
461 | static bool is_mbm_event(int e) | 466 | static bool is_mbm_event(int e) |
462 | { | 467 | { |
463 | return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); | 468 | return (e >= QOS_MBM_TOTAL_EVENT_ID && e <= QOS_MBM_LOCAL_EVENT_ID); |
@@ -1366,6 +1371,10 @@ static int intel_cqm_event_init(struct perf_event *event) | |||
1366 | (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) | 1371 | (event->attr.config > QOS_MBM_LOCAL_EVENT_ID)) |
1367 | return -EINVAL; | 1372 | return -EINVAL; |
1368 | 1373 | ||
1374 | if ((is_cqm_event(event->attr.config) && !cqm_enabled) || | ||
1375 | (is_mbm_event(event->attr.config) && !mbm_enabled)) | ||
1376 | return -EINVAL; | ||
1377 | |||
1369 | /* unsupported modes and filters */ | 1378 | /* unsupported modes and filters */ |
1370 | if (event->attr.exclude_user || | 1379 | if (event->attr.exclude_user || |
1371 | event->attr.exclude_kernel || | 1380 | event->attr.exclude_kernel || |
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 7ce9f3f669e6..9b983a474253 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c | |||
@@ -1274,18 +1274,18 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) | |||
1274 | struct pebs_record_nhm *p = at; | 1274 | struct pebs_record_nhm *p = at; |
1275 | u64 pebs_status; | 1275 | u64 pebs_status; |
1276 | 1276 | ||
1277 | /* PEBS v3 has accurate status bits */ | 1277 | pebs_status = p->status & cpuc->pebs_enabled; |
1278 | pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; | ||
1279 | |||
1280 | /* PEBS v3 has more accurate status bits */ | ||
1278 | if (x86_pmu.intel_cap.pebs_format >= 3) { | 1281 | if (x86_pmu.intel_cap.pebs_format >= 3) { |
1279 | for_each_set_bit(bit, (unsigned long *)&p->status, | 1282 | for_each_set_bit(bit, (unsigned long *)&pebs_status, |
1280 | MAX_PEBS_EVENTS) | 1283 | x86_pmu.max_pebs_events) |
1281 | counts[bit]++; | 1284 | counts[bit]++; |
1282 | 1285 | ||
1283 | continue; | 1286 | continue; |
1284 | } | 1287 | } |
1285 | 1288 | ||
1286 | pebs_status = p->status & cpuc->pebs_enabled; | ||
1287 | pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; | ||
1288 | |||
1289 | /* | 1289 | /* |
1290 | * On some CPUs the PEBS status can be zero when PEBS is | 1290 | * On some CPUs the PEBS status can be zero when PEBS is |
1291 | * racing with clearing of GLOBAL_STATUS. | 1291 | * racing with clearing of GLOBAL_STATUS. |
@@ -1333,8 +1333,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs) | |||
1333 | continue; | 1333 | continue; |
1334 | 1334 | ||
1335 | event = cpuc->events[bit]; | 1335 | event = cpuc->events[bit]; |
1336 | WARN_ON_ONCE(!event); | 1336 | if (WARN_ON_ONCE(!event)) |
1337 | WARN_ON_ONCE(!event->attr.precise_ip); | 1337 | continue; |
1338 | |||
1339 | if (WARN_ON_ONCE(!event->attr.precise_ip)) | ||
1340 | continue; | ||
1338 | 1341 | ||
1339 | /* log dropped samples number */ | 1342 | /* log dropped samples number */ |
1340 | if (error[bit]) | 1343 | if (error[bit]) |
diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 04bb5fb5a8d7..861a7d9cb60f 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c | |||
@@ -1074,6 +1074,11 @@ static void pt_addr_filters_fini(struct perf_event *event) | |||
1074 | event->hw.addr_filters = NULL; | 1074 | event->hw.addr_filters = NULL; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | static inline bool valid_kernel_ip(unsigned long ip) | ||
1078 | { | ||
1079 | return virt_addr_valid(ip) && kernel_ip(ip); | ||
1080 | } | ||
1081 | |||
1077 | static int pt_event_addr_filters_validate(struct list_head *filters) | 1082 | static int pt_event_addr_filters_validate(struct list_head *filters) |
1078 | { | 1083 | { |
1079 | struct perf_addr_filter *filter; | 1084 | struct perf_addr_filter *filter; |
@@ -1081,11 +1086,16 @@ static int pt_event_addr_filters_validate(struct list_head *filters) | |||
1081 | 1086 | ||
1082 | list_for_each_entry(filter, filters, entry) { | 1087 | list_for_each_entry(filter, filters, entry) { |
1083 | /* PT doesn't support single address triggers */ | 1088 | /* PT doesn't support single address triggers */ |
1084 | if (!filter->range) | 1089 | if (!filter->range || !filter->size) |
1085 | return -EOPNOTSUPP; | 1090 | return -EOPNOTSUPP; |
1086 | 1091 | ||
1087 | if (!filter->inode && !kernel_ip(filter->offset)) | 1092 | if (!filter->inode) { |
1088 | return -EINVAL; | 1093 | if (!valid_kernel_ip(filter->offset)) |
1094 | return -EINVAL; | ||
1095 | |||
1096 | if (!valid_kernel_ip(filter->offset + filter->size)) | ||
1097 | return -EINVAL; | ||
1098 | } | ||
1089 | 1099 | ||
1090 | if (++range > pt_cap_get(PT_CAP_num_address_ranges)) | 1100 | if (++range > pt_cap_get(PT_CAP_num_address_ranges)) |
1091 | return -EOPNOTSUPP; | 1101 | return -EOPNOTSUPP; |
@@ -1111,7 +1121,7 @@ static void pt_event_addr_filters_sync(struct perf_event *event) | |||
1111 | } else { | 1121 | } else { |
1112 | /* apply the offset */ | 1122 | /* apply the offset */ |
1113 | msr_a = filter->offset + offs[range]; | 1123 | msr_a = filter->offset + offs[range]; |
1114 | msr_b = filter->size + msr_a; | 1124 | msr_b = filter->size + msr_a - 1; |
1115 | } | 1125 | } |
1116 | 1126 | ||
1117 | filters->filter[range].msr_a = msr_a; | 1127 | filters->filter[range].msr_a = msr_a; |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index e3af86f58eaf..2131c4ce7d8a 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -433,7 +433,11 @@ do { \ | |||
433 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ | 433 | #define __get_user_asm_ex(x, addr, itype, rtype, ltype) \ |
434 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ | 434 | asm volatile("1: mov"itype" %1,%"rtype"0\n" \ |
435 | "2:\n" \ | 435 | "2:\n" \ |
436 | _ASM_EXTABLE_EX(1b, 2b) \ | 436 | ".section .fixup,\"ax\"\n" \ |
437 | "3:xor"itype" %"rtype"0,%"rtype"0\n" \ | ||
438 | " jmp 2b\n" \ | ||
439 | ".previous\n" \ | ||
440 | _ASM_EXTABLE_EX(1b, 3b) \ | ||
437 | : ltype(x) : "m" (__m(addr))) | 441 | : ltype(x) : "m" (__m(addr))) |
438 | 442 | ||
439 | #define __put_user_nocheck(x, ptr, size) \ | 443 | #define __put_user_nocheck(x, ptr, size) \ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 50c95af0f017..f3e9b2df4b16 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2093,7 +2093,6 @@ int generic_processor_info(int apicid, int version) | |||
2093 | return -EINVAL; | 2093 | return -EINVAL; |
2094 | } | 2094 | } |
2095 | 2095 | ||
2096 | num_processors++; | ||
2097 | if (apicid == boot_cpu_physical_apicid) { | 2096 | if (apicid == boot_cpu_physical_apicid) { |
2098 | /* | 2097 | /* |
2099 | * x86_bios_cpu_apicid is required to have processors listed | 2098 | * x86_bios_cpu_apicid is required to have processors listed |
@@ -2116,10 +2115,13 @@ int generic_processor_info(int apicid, int version) | |||
2116 | 2115 | ||
2117 | pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", | 2116 | pr_warning("APIC: Package limit reached. Processor %d/0x%x ignored.\n", |
2118 | thiscpu, apicid); | 2117 | thiscpu, apicid); |
2118 | |||
2119 | disabled_cpus++; | 2119 | disabled_cpus++; |
2120 | return -ENOSPC; | 2120 | return -ENOSPC; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | num_processors++; | ||
2124 | |||
2123 | /* | 2125 | /* |
2124 | * Validate version | 2126 | * Validate version |
2125 | */ | 2127 | */ |
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index b816971f5da4..620ab06bcf45 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
@@ -54,6 +54,7 @@ static LIST_HEAD(pcache); | |||
54 | */ | 54 | */ |
55 | static u8 *container; | 55 | static u8 *container; |
56 | static size_t container_size; | 56 | static size_t container_size; |
57 | static bool ucode_builtin; | ||
57 | 58 | ||
58 | static u32 ucode_new_rev; | 59 | static u32 ucode_new_rev; |
59 | static u8 amd_ucode_patch[PATCH_MAX_SIZE]; | 60 | static u8 amd_ucode_patch[PATCH_MAX_SIZE]; |
@@ -281,18 +282,22 @@ static bool __init load_builtin_amd_microcode(struct cpio_data *cp, | |||
281 | void __init load_ucode_amd_bsp(unsigned int family) | 282 | void __init load_ucode_amd_bsp(unsigned int family) |
282 | { | 283 | { |
283 | struct cpio_data cp; | 284 | struct cpio_data cp; |
285 | bool *builtin; | ||
284 | void **data; | 286 | void **data; |
285 | size_t *size; | 287 | size_t *size; |
286 | 288 | ||
287 | #ifdef CONFIG_X86_32 | 289 | #ifdef CONFIG_X86_32 |
288 | data = (void **)__pa_nodebug(&ucode_cpio.data); | 290 | data = (void **)__pa_nodebug(&ucode_cpio.data); |
289 | size = (size_t *)__pa_nodebug(&ucode_cpio.size); | 291 | size = (size_t *)__pa_nodebug(&ucode_cpio.size); |
292 | builtin = (bool *)__pa_nodebug(&ucode_builtin); | ||
290 | #else | 293 | #else |
291 | data = &ucode_cpio.data; | 294 | data = &ucode_cpio.data; |
292 | size = &ucode_cpio.size; | 295 | size = &ucode_cpio.size; |
296 | builtin = &ucode_builtin; | ||
293 | #endif | 297 | #endif |
294 | 298 | ||
295 | if (!load_builtin_amd_microcode(&cp, family)) | 299 | *builtin = load_builtin_amd_microcode(&cp, family); |
300 | if (!*builtin) | ||
296 | cp = find_ucode_in_initrd(); | 301 | cp = find_ucode_in_initrd(); |
297 | 302 | ||
298 | if (!(cp.data && cp.size)) | 303 | if (!(cp.data && cp.size)) |
@@ -373,7 +378,8 @@ void load_ucode_amd_ap(void) | |||
373 | return; | 378 | return; |
374 | 379 | ||
375 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ | 380 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ |
376 | cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; | 381 | if (!ucode_builtin) |
382 | cont += PAGE_OFFSET - __PAGE_OFFSET_BASE; | ||
377 | 383 | ||
378 | eax = cpuid_eax(0x00000001); | 384 | eax = cpuid_eax(0x00000001); |
379 | eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); | 385 | eq = (struct equiv_cpu_entry *)(cont + CONTAINER_HDR_SZ); |
@@ -439,7 +445,8 @@ int __init save_microcode_in_initrd_amd(void) | |||
439 | container = cont_va; | 445 | container = cont_va; |
440 | 446 | ||
441 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ | 447 | /* Add CONFIG_RANDOMIZE_MEMORY offset. */ |
442 | container += PAGE_OFFSET - __PAGE_OFFSET_BASE; | 448 | if (!ucode_builtin) |
449 | container += PAGE_OFFSET - __PAGE_OFFSET_BASE; | ||
443 | 450 | ||
444 | eax = cpuid_eax(0x00000001); | 451 | eax = cpuid_eax(0x00000001); |
445 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); | 452 | eax = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 1d39bfbd26bb..3692249a70f1 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -289,6 +289,7 @@ void __init kvmclock_init(void) | |||
289 | put_cpu(); | 289 | put_cpu(); |
290 | 290 | ||
291 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; | 291 | x86_platform.calibrate_tsc = kvm_get_tsc_khz; |
292 | x86_platform.calibrate_cpu = kvm_get_tsc_khz; | ||
292 | x86_platform.get_wallclock = kvm_get_wallclock; | 293 | x86_platform.get_wallclock = kvm_get_wallclock; |
293 | x86_platform.set_wallclock = kvm_set_wallclock; | 294 | x86_platform.set_wallclock = kvm_set_wallclock; |
294 | #ifdef CONFIG_X86_LOCAL_APIC | 295 | #ifdef CONFIG_X86_LOCAL_APIC |
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c index 5f42d038fcb4..c7220ba94aa7 100644 --- a/arch/x86/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c | |||
@@ -109,6 +109,7 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | |||
109 | { | 109 | { |
110 | bool new_val, old_val; | 110 | bool new_val, old_val; |
111 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; | 111 | struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; |
112 | struct dest_map *dest_map = &ioapic->rtc_status.dest_map; | ||
112 | union kvm_ioapic_redirect_entry *e; | 113 | union kvm_ioapic_redirect_entry *e; |
113 | 114 | ||
114 | e = &ioapic->redirtbl[RTC_GSI]; | 115 | e = &ioapic->redirtbl[RTC_GSI]; |
@@ -117,16 +118,17 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu) | |||
117 | return; | 118 | return; |
118 | 119 | ||
119 | new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); | 120 | new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector); |
120 | old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 121 | old_val = test_bit(vcpu->vcpu_id, dest_map->map); |
121 | 122 | ||
122 | if (new_val == old_val) | 123 | if (new_val == old_val) |
123 | return; | 124 | return; |
124 | 125 | ||
125 | if (new_val) { | 126 | if (new_val) { |
126 | __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 127 | __set_bit(vcpu->vcpu_id, dest_map->map); |
128 | dest_map->vectors[vcpu->vcpu_id] = e->fields.vector; | ||
127 | ioapic->rtc_status.pending_eoi++; | 129 | ioapic->rtc_status.pending_eoi++; |
128 | } else { | 130 | } else { |
129 | __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map); | 131 | __clear_bit(vcpu->vcpu_id, dest_map->map); |
130 | ioapic->rtc_status.pending_eoi--; | 132 | ioapic->rtc_status.pending_eoi--; |
131 | rtc_status_pending_eoi_check_valid(ioapic); | 133 | rtc_status_pending_eoi_check_valid(ioapic); |
132 | } | 134 | } |
diff --git a/arch/x86/kvm/pmu_amd.c b/arch/x86/kvm/pmu_amd.c index 39b91127ef07..cd944435dfbd 100644 --- a/arch/x86/kvm/pmu_amd.c +++ b/arch/x86/kvm/pmu_amd.c | |||
@@ -23,8 +23,8 @@ | |||
23 | static struct kvm_event_hw_type_mapping amd_event_mapping[] = { | 23 | static struct kvm_event_hw_type_mapping amd_event_mapping[] = { |
24 | [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, | 24 | [0] = { 0x76, 0x00, PERF_COUNT_HW_CPU_CYCLES }, |
25 | [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, | 25 | [1] = { 0xc0, 0x00, PERF_COUNT_HW_INSTRUCTIONS }, |
26 | [2] = { 0x80, 0x00, PERF_COUNT_HW_CACHE_REFERENCES }, | 26 | [2] = { 0x7d, 0x07, PERF_COUNT_HW_CACHE_REFERENCES }, |
27 | [3] = { 0x81, 0x00, PERF_COUNT_HW_CACHE_MISSES }, | 27 | [3] = { 0x7e, 0x07, PERF_COUNT_HW_CACHE_MISSES }, |
28 | [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, | 28 | [4] = { 0xc2, 0x00, PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, |
29 | [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, | 29 | [5] = { 0xc3, 0x00, PERF_COUNT_HW_BRANCH_MISSES }, |
30 | [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, | 30 | [6] = { 0xd0, 0x00, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND }, |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 19f9f9e05c2a..699f8726539a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2743,16 +2743,16 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) | |||
2743 | if (tsc_delta < 0) | 2743 | if (tsc_delta < 0) |
2744 | mark_tsc_unstable("KVM discovered backwards TSC"); | 2744 | mark_tsc_unstable("KVM discovered backwards TSC"); |
2745 | 2745 | ||
2746 | if (kvm_lapic_hv_timer_in_use(vcpu) && | ||
2747 | kvm_x86_ops->set_hv_timer(vcpu, | ||
2748 | kvm_get_lapic_tscdeadline_msr(vcpu))) | ||
2749 | kvm_lapic_switch_to_sw_timer(vcpu); | ||
2750 | if (check_tsc_unstable()) { | 2746 | if (check_tsc_unstable()) { |
2751 | u64 offset = kvm_compute_tsc_offset(vcpu, | 2747 | u64 offset = kvm_compute_tsc_offset(vcpu, |
2752 | vcpu->arch.last_guest_tsc); | 2748 | vcpu->arch.last_guest_tsc); |
2753 | kvm_x86_ops->write_tsc_offset(vcpu, offset); | 2749 | kvm_x86_ops->write_tsc_offset(vcpu, offset); |
2754 | vcpu->arch.tsc_catchup = 1; | 2750 | vcpu->arch.tsc_catchup = 1; |
2755 | } | 2751 | } |
2752 | if (kvm_lapic_hv_timer_in_use(vcpu) && | ||
2753 | kvm_x86_ops->set_hv_timer(vcpu, | ||
2754 | kvm_get_lapic_tscdeadline_msr(vcpu))) | ||
2755 | kvm_lapic_switch_to_sw_timer(vcpu); | ||
2756 | /* | 2756 | /* |
2757 | * On a host with synchronized TSC, there is no need to update | 2757 | * On a host with synchronized TSC, there is no need to update |
2758 | * kvmclock on vcpu->cpu migration | 2758 | * kvmclock on vcpu->cpu migration |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 849dc09fa4f0..e3353c97d086 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -917,11 +917,11 @@ static void populate_pte(struct cpa_data *cpa, | |||
917 | } | 917 | } |
918 | } | 918 | } |
919 | 919 | ||
920 | static int populate_pmd(struct cpa_data *cpa, | 920 | static long populate_pmd(struct cpa_data *cpa, |
921 | unsigned long start, unsigned long end, | 921 | unsigned long start, unsigned long end, |
922 | unsigned num_pages, pud_t *pud, pgprot_t pgprot) | 922 | unsigned num_pages, pud_t *pud, pgprot_t pgprot) |
923 | { | 923 | { |
924 | unsigned int cur_pages = 0; | 924 | long cur_pages = 0; |
925 | pmd_t *pmd; | 925 | pmd_t *pmd; |
926 | pgprot_t pmd_pgprot; | 926 | pgprot_t pmd_pgprot; |
927 | 927 | ||
@@ -991,12 +991,12 @@ static int populate_pmd(struct cpa_data *cpa, | |||
991 | return num_pages; | 991 | return num_pages; |
992 | } | 992 | } |
993 | 993 | ||
994 | static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, | 994 | static long populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, |
995 | pgprot_t pgprot) | 995 | pgprot_t pgprot) |
996 | { | 996 | { |
997 | pud_t *pud; | 997 | pud_t *pud; |
998 | unsigned long end; | 998 | unsigned long end; |
999 | int cur_pages = 0; | 999 | long cur_pages = 0; |
1000 | pgprot_t pud_pgprot; | 1000 | pgprot_t pud_pgprot; |
1001 | 1001 | ||
1002 | end = start + (cpa->numpages << PAGE_SHIFT); | 1002 | end = start + (cpa->numpages << PAGE_SHIFT); |
@@ -1052,7 +1052,7 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd, | |||
1052 | 1052 | ||
1053 | /* Map trailing leftover */ | 1053 | /* Map trailing leftover */ |
1054 | if (start < end) { | 1054 | if (start < end) { |
1055 | int tmp; | 1055 | long tmp; |
1056 | 1056 | ||
1057 | pud = pud_offset(pgd, start); | 1057 | pud = pud_offset(pgd, start); |
1058 | if (pud_none(*pud)) | 1058 | if (pud_none(*pud)) |
@@ -1078,7 +1078,7 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr) | |||
1078 | pgprot_t pgprot = __pgprot(_KERNPG_TABLE); | 1078 | pgprot_t pgprot = __pgprot(_KERNPG_TABLE); |
1079 | pud_t *pud = NULL; /* shut up gcc */ | 1079 | pud_t *pud = NULL; /* shut up gcc */ |
1080 | pgd_t *pgd_entry; | 1080 | pgd_t *pgd_entry; |
1081 | int ret; | 1081 | long ret; |
1082 | 1082 | ||
1083 | pgd_entry = cpa->pgd + pgd_index(addr); | 1083 | pgd_entry = cpa->pgd + pgd_index(addr); |
1084 | 1084 | ||
@@ -1327,7 +1327,8 @@ static int cpa_process_alias(struct cpa_data *cpa) | |||
1327 | 1327 | ||
1328 | static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias) | 1328 | static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias) |
1329 | { | 1329 | { |
1330 | int ret, numpages = cpa->numpages; | 1330 | unsigned long numpages = cpa->numpages; |
1331 | int ret; | ||
1331 | 1332 | ||
1332 | while (numpages) { | 1333 | while (numpages) { |
1333 | /* | 1334 | /* |
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 837ea36a837d..6d52b94f4bb9 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c | |||
@@ -553,15 +553,21 @@ static void twinhead_reserve_killing_zone(struct pci_dev *dev) | |||
553 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); | 553 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); |
554 | 554 | ||
555 | /* | 555 | /* |
556 | * Broadwell EP Home Agent BARs erroneously return non-zero values when read. | 556 | * Device [8086:2fc0] |
557 | * Erratum HSE43 | ||
558 | * CONFIG_TDP_NOMINAL CSR Implemented at Incorrect Offset | ||
559 | * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v3-spec-update.html | ||
557 | * | 560 | * |
558 | * See http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html | 561 | * Devices [8086:6f60,6fa0,6fc0] |
559 | * entry BDF2. | 562 | * Erratum BDF2 |
563 | * PCI BARs in the Home Agent Will Return Non-Zero Values During Enumeration | ||
564 | * http://www.intel.com/content/www/us/en/processors/xeon/xeon-e5-v4-spec-update.html | ||
560 | */ | 565 | */ |
561 | static void pci_bdwep_bar(struct pci_dev *dev) | 566 | static void pci_invalid_bar(struct pci_dev *dev) |
562 | { | 567 | { |
563 | dev->non_compliant_bars = 1; | 568 | dev->non_compliant_bars = 1; |
564 | } | 569 | } |
565 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_bdwep_bar); | 570 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2fc0, pci_invalid_bar); |
566 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_bar); | 571 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_invalid_bar); |
567 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_bar); | 572 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_invalid_bar); |
573 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_invalid_bar); | ||
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 677e29e29473..8dd3784eb075 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -245,7 +245,7 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages) | |||
245 | * text and allocate a new stack because we can't rely on the | 245 | * text and allocate a new stack because we can't rely on the |
246 | * stack pointer being < 4GB. | 246 | * stack pointer being < 4GB. |
247 | */ | 247 | */ |
248 | if (!IS_ENABLED(CONFIG_EFI_MIXED)) | 248 | if (!IS_ENABLED(CONFIG_EFI_MIXED) || efi_is_native()) |
249 | return 0; | 249 | return 0; |
250 | 250 | ||
251 | /* | 251 | /* |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 13f5a6c1de76..c207fa9870eb 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -296,17 +296,29 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, int rw, | |||
296 | if (ret) | 296 | if (ret) |
297 | return ERR_PTR(ret); | 297 | return ERR_PTR(ret); |
298 | 298 | ||
299 | /* | ||
300 | * Check if the hardware context is actually mapped to anything. | ||
301 | * If not tell the caller that it should skip this queue. | ||
302 | */ | ||
299 | hctx = q->queue_hw_ctx[hctx_idx]; | 303 | hctx = q->queue_hw_ctx[hctx_idx]; |
304 | if (!blk_mq_hw_queue_mapped(hctx)) { | ||
305 | ret = -EXDEV; | ||
306 | goto out_queue_exit; | ||
307 | } | ||
300 | ctx = __blk_mq_get_ctx(q, cpumask_first(hctx->cpumask)); | 308 | ctx = __blk_mq_get_ctx(q, cpumask_first(hctx->cpumask)); |
301 | 309 | ||
302 | blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx); | 310 | blk_mq_set_alloc_data(&alloc_data, q, flags, ctx, hctx); |
303 | rq = __blk_mq_alloc_request(&alloc_data, rw, 0); | 311 | rq = __blk_mq_alloc_request(&alloc_data, rw, 0); |
304 | if (!rq) { | 312 | if (!rq) { |
305 | blk_queue_exit(q); | 313 | ret = -EWOULDBLOCK; |
306 | return ERR_PTR(-EWOULDBLOCK); | 314 | goto out_queue_exit; |
307 | } | 315 | } |
308 | 316 | ||
309 | return rq; | 317 | return rq; |
318 | |||
319 | out_queue_exit: | ||
320 | blk_queue_exit(q); | ||
321 | return ERR_PTR(ret); | ||
310 | } | 322 | } |
311 | EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx); | 323 | EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx); |
312 | 324 | ||
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index f1aba26f4719..a3ea8260c94c 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -780,9 +780,11 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio, | |||
780 | /* | 780 | /* |
781 | * If previous slice expired, start a new one otherwise renew/extend | 781 | * If previous slice expired, start a new one otherwise renew/extend |
782 | * existing slice to make sure it is at least throtl_slice interval | 782 | * existing slice to make sure it is at least throtl_slice interval |
783 | * long since now. | 783 | * long since now. New slice is started only for empty throttle group. |
784 | * If there is queued bio, that means there should be an active | ||
785 | * slice and it should be extended instead. | ||
784 | */ | 786 | */ |
785 | if (throtl_slice_used(tg, rw)) | 787 | if (throtl_slice_used(tg, rw) && !(tg->service_queue.nr_queued[rw])) |
786 | throtl_start_new_slice(tg, rw); | 788 | throtl_start_new_slice(tg, rw); |
787 | else { | 789 | else { |
788 | if (time_before(tg->slice_end[rw], jiffies + throtl_slice)) | 790 | if (time_before(tg->slice_end[rw], jiffies + throtl_slice)) |
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 369999530108..a832426820e8 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -233,6 +233,8 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, | |||
233 | return blkcipher_walk_done(desc, walk, -EINVAL); | 233 | return blkcipher_walk_done(desc, walk, -EINVAL); |
234 | } | 234 | } |
235 | 235 | ||
236 | bsize = min(walk->walk_blocksize, n); | ||
237 | |||
236 | walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY | | 238 | walk->flags &= ~(BLKCIPHER_WALK_SLOW | BLKCIPHER_WALK_COPY | |
237 | BLKCIPHER_WALK_DIFF); | 239 | BLKCIPHER_WALK_DIFF); |
238 | if (!scatterwalk_aligned(&walk->in, walk->alignmask) || | 240 | if (!scatterwalk_aligned(&walk->in, walk->alignmask) || |
@@ -245,7 +247,6 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc, | |||
245 | } | 247 | } |
246 | } | 248 | } |
247 | 249 | ||
248 | bsize = min(walk->walk_blocksize, n); | ||
249 | n = scatterwalk_clamp(&walk->in, n); | 250 | n = scatterwalk_clamp(&walk->in, n); |
250 | n = scatterwalk_clamp(&walk->out, n); | 251 | n = scatterwalk_clamp(&walk->out, n); |
251 | 252 | ||
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 77207b41940c..0c654e59f215 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
@@ -631,9 +631,14 @@ static int cryptd_hash_export(struct ahash_request *req, void *out) | |||
631 | 631 | ||
632 | static int cryptd_hash_import(struct ahash_request *req, const void *in) | 632 | static int cryptd_hash_import(struct ahash_request *req, const void *in) |
633 | { | 633 | { |
634 | struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); | 634 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); |
635 | struct cryptd_hash_ctx *ctx = crypto_ahash_ctx(tfm); | ||
636 | struct shash_desc *desc = cryptd_shash_desc(req); | ||
637 | |||
638 | desc->tfm = ctx->child; | ||
639 | desc->flags = req->base.flags; | ||
635 | 640 | ||
636 | return crypto_shash_import(&rctx->desc, in); | 641 | return crypto_shash_import(desc, in); |
637 | } | 642 | } |
638 | 643 | ||
639 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, | 644 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, |
diff --git a/crypto/echainiv.c b/crypto/echainiv.c index 1b01fe98e91f..e3d889b122e0 100644 --- a/crypto/echainiv.c +++ b/crypto/echainiv.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * echainiv: Encrypted Chain IV Generator | 2 | * echainiv: Encrypted Chain IV Generator |
3 | * | 3 | * |
4 | * This generator generates an IV based on a sequence number by xoring it | 4 | * This generator generates an IV based on a sequence number by multiplying |
5 | * with a salt and then encrypting it with the same key as used to encrypt | 5 | * it with a salt and then encrypting it with the same key as used to encrypt |
6 | * the plain text. This algorithm requires that the block size be equal | 6 | * the plain text. This algorithm requires that the block size be equal |
7 | * to the IV size. It is mainly useful for CBC. | 7 | * to the IV size. It is mainly useful for CBC. |
8 | * | 8 | * |
@@ -24,81 +24,17 @@ | |||
24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/mm.h> | ||
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
29 | #include <linux/percpu.h> | 28 | #include <linux/slab.h> |
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/string.h> | 29 | #include <linux/string.h> |
32 | 30 | ||
33 | #define MAX_IV_SIZE 16 | ||
34 | |||
35 | static DEFINE_PER_CPU(u32 [MAX_IV_SIZE / sizeof(u32)], echainiv_iv); | ||
36 | |||
37 | /* We don't care if we get preempted and read/write IVs from the next CPU. */ | ||
38 | static void echainiv_read_iv(u8 *dst, unsigned size) | ||
39 | { | ||
40 | u32 *a = (u32 *)dst; | ||
41 | u32 __percpu *b = echainiv_iv; | ||
42 | |||
43 | for (; size >= 4; size -= 4) { | ||
44 | *a++ = this_cpu_read(*b); | ||
45 | b++; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | static void echainiv_write_iv(const u8 *src, unsigned size) | ||
50 | { | ||
51 | const u32 *a = (const u32 *)src; | ||
52 | u32 __percpu *b = echainiv_iv; | ||
53 | |||
54 | for (; size >= 4; size -= 4) { | ||
55 | this_cpu_write(*b, *a); | ||
56 | a++; | ||
57 | b++; | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static void echainiv_encrypt_complete2(struct aead_request *req, int err) | ||
62 | { | ||
63 | struct aead_request *subreq = aead_request_ctx(req); | ||
64 | struct crypto_aead *geniv; | ||
65 | unsigned int ivsize; | ||
66 | |||
67 | if (err == -EINPROGRESS) | ||
68 | return; | ||
69 | |||
70 | if (err) | ||
71 | goto out; | ||
72 | |||
73 | geniv = crypto_aead_reqtfm(req); | ||
74 | ivsize = crypto_aead_ivsize(geniv); | ||
75 | |||
76 | echainiv_write_iv(subreq->iv, ivsize); | ||
77 | |||
78 | if (req->iv != subreq->iv) | ||
79 | memcpy(req->iv, subreq->iv, ivsize); | ||
80 | |||
81 | out: | ||
82 | if (req->iv != subreq->iv) | ||
83 | kzfree(subreq->iv); | ||
84 | } | ||
85 | |||
86 | static void echainiv_encrypt_complete(struct crypto_async_request *base, | ||
87 | int err) | ||
88 | { | ||
89 | struct aead_request *req = base->data; | ||
90 | |||
91 | echainiv_encrypt_complete2(req, err); | ||
92 | aead_request_complete(req, err); | ||
93 | } | ||
94 | |||
95 | static int echainiv_encrypt(struct aead_request *req) | 31 | static int echainiv_encrypt(struct aead_request *req) |
96 | { | 32 | { |
97 | struct crypto_aead *geniv = crypto_aead_reqtfm(req); | 33 | struct crypto_aead *geniv = crypto_aead_reqtfm(req); |
98 | struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); | 34 | struct aead_geniv_ctx *ctx = crypto_aead_ctx(geniv); |
99 | struct aead_request *subreq = aead_request_ctx(req); | 35 | struct aead_request *subreq = aead_request_ctx(req); |
100 | crypto_completion_t compl; | 36 | __be64 nseqno; |
101 | void *data; | 37 | u64 seqno; |
102 | u8 *info; | 38 | u8 *info; |
103 | unsigned int ivsize = crypto_aead_ivsize(geniv); | 39 | unsigned int ivsize = crypto_aead_ivsize(geniv); |
104 | int err; | 40 | int err; |
@@ -108,8 +44,6 @@ static int echainiv_encrypt(struct aead_request *req) | |||
108 | 44 | ||
109 | aead_request_set_tfm(subreq, ctx->child); | 45 | aead_request_set_tfm(subreq, ctx->child); |
110 | 46 | ||
111 | compl = echainiv_encrypt_complete; | ||
112 | data = req; | ||
113 | info = req->iv; | 47 | info = req->iv; |
114 | 48 | ||
115 | if (req->src != req->dst) { | 49 | if (req->src != req->dst) { |
@@ -127,29 +61,30 @@ static int echainiv_encrypt(struct aead_request *req) | |||
127 | return err; | 61 | return err; |
128 | } | 62 | } |
129 | 63 | ||
130 | if (unlikely(!IS_ALIGNED((unsigned long)info, | 64 | aead_request_set_callback(subreq, req->base.flags, |
131 | crypto_aead_alignmask(geniv) + 1))) { | 65 | req->base.complete, req->base.data); |
132 | info = kmalloc(ivsize, req->base.flags & | ||
133 | CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL: | ||
134 | GFP_ATOMIC); | ||
135 | if (!info) | ||
136 | return -ENOMEM; | ||
137 | |||
138 | memcpy(info, req->iv, ivsize); | ||
139 | } | ||
140 | |||
141 | aead_request_set_callback(subreq, req->base.flags, compl, data); | ||
142 | aead_request_set_crypt(subreq, req->dst, req->dst, | 66 | aead_request_set_crypt(subreq, req->dst, req->dst, |
143 | req->cryptlen, info); | 67 | req->cryptlen, info); |
144 | aead_request_set_ad(subreq, req->assoclen); | 68 | aead_request_set_ad(subreq, req->assoclen); |
145 | 69 | ||
146 | crypto_xor(info, ctx->salt, ivsize); | 70 | memcpy(&nseqno, info + ivsize - 8, 8); |
71 | seqno = be64_to_cpu(nseqno); | ||
72 | memset(info, 0, ivsize); | ||
73 | |||
147 | scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); | 74 | scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); |
148 | echainiv_read_iv(info, ivsize); | ||
149 | 75 | ||
150 | err = crypto_aead_encrypt(subreq); | 76 | do { |
151 | echainiv_encrypt_complete2(req, err); | 77 | u64 a; |
152 | return err; | 78 | |
79 | memcpy(&a, ctx->salt + ivsize - 8, 8); | ||
80 | |||
81 | a |= 1; | ||
82 | a *= seqno; | ||
83 | |||
84 | memcpy(info + ivsize - 8, &a, 8); | ||
85 | } while ((ivsize -= 8)); | ||
86 | |||
87 | return crypto_aead_encrypt(subreq); | ||
153 | } | 88 | } |
154 | 89 | ||
155 | static int echainiv_decrypt(struct aead_request *req) | 90 | static int echainiv_decrypt(struct aead_request *req) |
@@ -196,8 +131,7 @@ static int echainiv_aead_create(struct crypto_template *tmpl, | |||
196 | alg = crypto_spawn_aead_alg(spawn); | 131 | alg = crypto_spawn_aead_alg(spawn); |
197 | 132 | ||
198 | err = -EINVAL; | 133 | err = -EINVAL; |
199 | if (inst->alg.ivsize & (sizeof(u32) - 1) || | 134 | if (inst->alg.ivsize & (sizeof(u64) - 1) || !inst->alg.ivsize) |
200 | inst->alg.ivsize > MAX_IV_SIZE) | ||
201 | goto free_inst; | 135 | goto free_inst; |
202 | 136 | ||
203 | inst->alg.encrypt = echainiv_encrypt; | 137 | inst->alg.encrypt = echainiv_encrypt; |
@@ -206,7 +140,6 @@ static int echainiv_aead_create(struct crypto_template *tmpl, | |||
206 | inst->alg.init = aead_init_geniv; | 140 | inst->alg.init = aead_init_geniv; |
207 | inst->alg.exit = aead_exit_geniv; | 141 | inst->alg.exit = aead_exit_geniv; |
208 | 142 | ||
209 | inst->alg.base.cra_alignmask |= __alignof__(u32) - 1; | ||
210 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); | 143 | inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx); |
211 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; | 144 | inst->alg.base.cra_ctxsize += inst->alg.ivsize; |
212 | 145 | ||
diff --git a/crypto/rsa-pkcs1pad.c b/crypto/rsa-pkcs1pad.c index 877019a6d3ea..8baab4307f7b 100644 --- a/crypto/rsa-pkcs1pad.c +++ b/crypto/rsa-pkcs1pad.c | |||
@@ -298,41 +298,48 @@ static int pkcs1pad_decrypt_complete(struct akcipher_request *req, int err) | |||
298 | struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); | 298 | struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); |
299 | struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); | 299 | struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm); |
300 | struct pkcs1pad_request *req_ctx = akcipher_request_ctx(req); | 300 | struct pkcs1pad_request *req_ctx = akcipher_request_ctx(req); |
301 | unsigned int dst_len; | ||
301 | unsigned int pos; | 302 | unsigned int pos; |
302 | 303 | u8 *out_buf; | |
303 | if (err == -EOVERFLOW) | ||
304 | /* Decrypted value had no leading 0 byte */ | ||
305 | err = -EINVAL; | ||
306 | 304 | ||
307 | if (err) | 305 | if (err) |
308 | goto done; | 306 | goto done; |
309 | 307 | ||
310 | if (req_ctx->child_req.dst_len != ctx->key_size - 1) { | 308 | err = -EINVAL; |
311 | err = -EINVAL; | 309 | dst_len = req_ctx->child_req.dst_len; |
310 | if (dst_len < ctx->key_size - 1) | ||
312 | goto done; | 311 | goto done; |
312 | |||
313 | out_buf = req_ctx->out_buf; | ||
314 | if (dst_len == ctx->key_size) { | ||
315 | if (out_buf[0] != 0x00) | ||
316 | /* Decrypted value had no leading 0 byte */ | ||
317 | goto done; | ||
318 | |||
319 | dst_len--; | ||
320 | out_buf++; | ||
313 | } | 321 | } |
314 | 322 | ||
315 | if (req_ctx->out_buf[0] != 0x02) { | 323 | if (out_buf[0] != 0x02) |
316 | err = -EINVAL; | ||
317 | goto done; | 324 | goto done; |
318 | } | 325 | |
319 | for (pos = 1; pos < req_ctx->child_req.dst_len; pos++) | 326 | for (pos = 1; pos < dst_len; pos++) |
320 | if (req_ctx->out_buf[pos] == 0x00) | 327 | if (out_buf[pos] == 0x00) |
321 | break; | 328 | break; |
322 | if (pos < 9 || pos == req_ctx->child_req.dst_len) { | 329 | if (pos < 9 || pos == dst_len) |
323 | err = -EINVAL; | ||
324 | goto done; | 330 | goto done; |
325 | } | ||
326 | pos++; | 331 | pos++; |
327 | 332 | ||
328 | if (req->dst_len < req_ctx->child_req.dst_len - pos) | 333 | err = 0; |
334 | |||
335 | if (req->dst_len < dst_len - pos) | ||
329 | err = -EOVERFLOW; | 336 | err = -EOVERFLOW; |
330 | req->dst_len = req_ctx->child_req.dst_len - pos; | 337 | req->dst_len = dst_len - pos; |
331 | 338 | ||
332 | if (!err) | 339 | if (!err) |
333 | sg_copy_from_buffer(req->dst, | 340 | sg_copy_from_buffer(req->dst, |
334 | sg_nents_for_len(req->dst, req->dst_len), | 341 | sg_nents_for_len(req->dst, req->dst_len), |
335 | req_ctx->out_buf + pos, req->dst_len); | 342 | out_buf + pos, req->dst_len); |
336 | 343 | ||
337 | done: | 344 | done: |
338 | kzfree(req_ctx->out_buf); | 345 | kzfree(req_ctx->out_buf); |
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 17995fadebd7..82a081ea4317 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -419,7 +419,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
419 | struct device *parent = NULL; | 419 | struct device *parent = NULL; |
420 | int retval; | 420 | int retval; |
421 | 421 | ||
422 | trace_rpm_suspend(dev, rpmflags); | 422 | trace_rpm_suspend_rcuidle(dev, rpmflags); |
423 | 423 | ||
424 | repeat: | 424 | repeat: |
425 | retval = rpm_check_suspend_allowed(dev); | 425 | retval = rpm_check_suspend_allowed(dev); |
@@ -549,7 +549,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
549 | } | 549 | } |
550 | 550 | ||
551 | out: | 551 | out: |
552 | trace_rpm_return_int(dev, _THIS_IP_, retval); | 552 | trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); |
553 | 553 | ||
554 | return retval; | 554 | return retval; |
555 | 555 | ||
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 25d26bb18970..e964d068874d 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1475,7 +1475,11 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
1475 | 1475 | ||
1476 | kfree(buf); | 1476 | kfree(buf); |
1477 | } else if (ret != 0 && !map->cache_bypass && map->format.parse_val) { | 1477 | } else if (ret != 0 && !map->cache_bypass && map->format.parse_val) { |
1478 | regcache_drop_region(map, reg, reg + 1); | 1478 | /* regcache_drop_region() takes lock that we already have, |
1479 | * thus call map->cache_ops->drop() directly | ||
1480 | */ | ||
1481 | if (map->cache_ops && map->cache_ops->drop) | ||
1482 | map->cache_ops->drop(map, reg, reg + 1); | ||
1479 | } | 1483 | } |
1480 | 1484 | ||
1481 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); | 1485 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); |
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c index 9af359544110..267f99523fbe 100644 --- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c +++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c | |||
@@ -783,14 +783,14 @@ static struct ccu_reset_map sun8i_h3_ccu_resets[] = { | |||
783 | [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, | 783 | [RST_BUS_I2S1] = { 0x2d0, BIT(13) }, |
784 | [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, | 784 | [RST_BUS_I2S2] = { 0x2d0, BIT(14) }, |
785 | 785 | ||
786 | [RST_BUS_I2C0] = { 0x2d4, BIT(0) }, | 786 | [RST_BUS_I2C0] = { 0x2d8, BIT(0) }, |
787 | [RST_BUS_I2C1] = { 0x2d4, BIT(1) }, | 787 | [RST_BUS_I2C1] = { 0x2d8, BIT(1) }, |
788 | [RST_BUS_I2C2] = { 0x2d4, BIT(2) }, | 788 | [RST_BUS_I2C2] = { 0x2d8, BIT(2) }, |
789 | [RST_BUS_UART0] = { 0x2d4, BIT(16) }, | 789 | [RST_BUS_UART0] = { 0x2d8, BIT(16) }, |
790 | [RST_BUS_UART1] = { 0x2d4, BIT(17) }, | 790 | [RST_BUS_UART1] = { 0x2d8, BIT(17) }, |
791 | [RST_BUS_UART2] = { 0x2d4, BIT(18) }, | 791 | [RST_BUS_UART2] = { 0x2d8, BIT(18) }, |
792 | [RST_BUS_UART3] = { 0x2d4, BIT(19) }, | 792 | [RST_BUS_UART3] = { 0x2d8, BIT(19) }, |
793 | [RST_BUS_SCR] = { 0x2d4, BIT(20) }, | 793 | [RST_BUS_SCR] = { 0x2d8, BIT(20) }, |
794 | }; | 794 | }; |
795 | 795 | ||
796 | static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { | 796 | static const struct sunxi_ccu_desc sun8i_h3_ccu_desc = { |
diff --git a/drivers/clk/sunxi-ng/ccu_nk.c b/drivers/clk/sunxi-ng/ccu_nk.c index 4470ffc8cf0d..d6fafb397489 100644 --- a/drivers/clk/sunxi-ng/ccu_nk.c +++ b/drivers/clk/sunxi-ng/ccu_nk.c | |||
@@ -14,9 +14,9 @@ | |||
14 | #include "ccu_gate.h" | 14 | #include "ccu_gate.h" |
15 | #include "ccu_nk.h" | 15 | #include "ccu_nk.h" |
16 | 16 | ||
17 | void ccu_nk_find_best(unsigned long parent, unsigned long rate, | 17 | static void ccu_nk_find_best(unsigned long parent, unsigned long rate, |
18 | unsigned int max_n, unsigned int max_k, | 18 | unsigned int max_n, unsigned int max_k, |
19 | unsigned int *n, unsigned int *k) | 19 | unsigned int *n, unsigned int *k) |
20 | { | 20 | { |
21 | unsigned long best_rate = 0; | 21 | unsigned long best_rate = 0; |
22 | unsigned int best_k = 0, best_n = 0; | 22 | unsigned int best_k = 0, best_n = 0; |
diff --git a/drivers/clk/sunxi/clk-a10-pll2.c b/drivers/clk/sunxi/clk-a10-pll2.c index 0ee1f363e4be..d8eab90ae661 100644 --- a/drivers/clk/sunxi/clk-a10-pll2.c +++ b/drivers/clk/sunxi/clk-a10-pll2.c | |||
@@ -73,7 +73,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, | |||
73 | SUN4I_PLL2_PRE_DIV_WIDTH, | 73 | SUN4I_PLL2_PRE_DIV_WIDTH, |
74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, | 74 | CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO, |
75 | &sun4i_a10_pll2_lock); | 75 | &sun4i_a10_pll2_lock); |
76 | if (!prediv_clk) { | 76 | if (IS_ERR(prediv_clk)) { |
77 | pr_err("Couldn't register the prediv clock\n"); | 77 | pr_err("Couldn't register the prediv clock\n"); |
78 | goto err_free_array; | 78 | goto err_free_array; |
79 | } | 79 | } |
@@ -106,7 +106,7 @@ static void __init sun4i_pll2_setup(struct device_node *node, | |||
106 | &mult->hw, &clk_multiplier_ops, | 106 | &mult->hw, &clk_multiplier_ops, |
107 | &gate->hw, &clk_gate_ops, | 107 | &gate->hw, &clk_gate_ops, |
108 | CLK_SET_RATE_PARENT); | 108 | CLK_SET_RATE_PARENT); |
109 | if (!base_clk) { | 109 | if (IS_ERR(base_clk)) { |
110 | pr_err("Couldn't register the base multiplier clock\n"); | 110 | pr_err("Couldn't register the base multiplier clock\n"); |
111 | goto err_free_multiplier; | 111 | goto err_free_multiplier; |
112 | } | 112 | } |
diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 411d3033a96e..b200ebf159ee 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c | |||
@@ -48,7 +48,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) | |||
48 | return; | 48 | return; |
49 | 49 | ||
50 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); | 50 | reg = of_io_request_and_map(node, 0, of_node_full_name(node)); |
51 | if (!reg) { | 51 | if (IS_ERR(reg)) { |
52 | pr_err("Could not get registers for sun8i-mbus-clk\n"); | 52 | pr_err("Could not get registers for sun8i-mbus-clk\n"); |
53 | goto err_free_parents; | 53 | goto err_free_parents; |
54 | } | 54 | } |
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 5a2631af7410..7dd2e2d37231 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -657,9 +657,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, | |||
657 | } | 657 | } |
658 | 658 | ||
659 | if (subnode) { | 659 | if (subnode) { |
660 | node = of_get_flat_dt_subnode_by_name(node, subnode); | 660 | int err = of_get_flat_dt_subnode_by_name(node, subnode); |
661 | if (node < 0) | 661 | |
662 | if (err < 0) | ||
662 | return 0; | 663 | return 0; |
664 | |||
665 | node = err; | ||
663 | } | 666 | } |
664 | 667 | ||
665 | return __find_uefi_params(node, info, dt_params[i].params); | 668 | return __find_uefi_params(node, info, dt_params[i].params); |
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 3bd127f95315..aded10662020 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c | |||
@@ -41,6 +41,8 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; | |||
41 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE | 41 | #define EFI_ALLOC_ALIGN EFI_PAGE_SIZE |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define EFI_MMAP_NR_SLACK_SLOTS 8 | ||
45 | |||
44 | struct file_info { | 46 | struct file_info { |
45 | efi_file_handle_t *handle; | 47 | efi_file_handle_t *handle; |
46 | u64 size; | 48 | u64 size; |
@@ -63,49 +65,62 @@ void efi_printk(efi_system_table_t *sys_table_arg, char *str) | |||
63 | } | 65 | } |
64 | } | 66 | } |
65 | 67 | ||
68 | static inline bool mmap_has_headroom(unsigned long buff_size, | ||
69 | unsigned long map_size, | ||
70 | unsigned long desc_size) | ||
71 | { | ||
72 | unsigned long slack = buff_size - map_size; | ||
73 | |||
74 | return slack / desc_size >= EFI_MMAP_NR_SLACK_SLOTS; | ||
75 | } | ||
76 | |||
66 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, | 77 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, |
67 | efi_memory_desc_t **map, | 78 | struct efi_boot_memmap *map) |
68 | unsigned long *map_size, | ||
69 | unsigned long *desc_size, | ||
70 | u32 *desc_ver, | ||
71 | unsigned long *key_ptr) | ||
72 | { | 79 | { |
73 | efi_memory_desc_t *m = NULL; | 80 | efi_memory_desc_t *m = NULL; |
74 | efi_status_t status; | 81 | efi_status_t status; |
75 | unsigned long key; | 82 | unsigned long key; |
76 | u32 desc_version; | 83 | u32 desc_version; |
77 | 84 | ||
78 | *map_size = sizeof(*m) * 32; | 85 | *map->desc_size = sizeof(*m); |
86 | *map->map_size = *map->desc_size * 32; | ||
87 | *map->buff_size = *map->map_size; | ||
79 | again: | 88 | again: |
80 | /* | ||
81 | * Add an additional efi_memory_desc_t because we're doing an | ||
82 | * allocation which may be in a new descriptor region. | ||
83 | */ | ||
84 | *map_size += sizeof(*m); | ||
85 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, | 89 | status = efi_call_early(allocate_pool, EFI_LOADER_DATA, |
86 | *map_size, (void **)&m); | 90 | *map->map_size, (void **)&m); |
87 | if (status != EFI_SUCCESS) | 91 | if (status != EFI_SUCCESS) |
88 | goto fail; | 92 | goto fail; |
89 | 93 | ||
90 | *desc_size = 0; | 94 | *map->desc_size = 0; |
91 | key = 0; | 95 | key = 0; |
92 | status = efi_call_early(get_memory_map, map_size, m, | 96 | status = efi_call_early(get_memory_map, map->map_size, m, |
93 | &key, desc_size, &desc_version); | 97 | &key, map->desc_size, &desc_version); |
94 | if (status == EFI_BUFFER_TOO_SMALL) { | 98 | if (status == EFI_BUFFER_TOO_SMALL || |
99 | !mmap_has_headroom(*map->buff_size, *map->map_size, | ||
100 | *map->desc_size)) { | ||
95 | efi_call_early(free_pool, m); | 101 | efi_call_early(free_pool, m); |
102 | /* | ||
103 | * Make sure there is some entries of headroom so that the | ||
104 | * buffer can be reused for a new map after allocations are | ||
105 | * no longer permitted. Its unlikely that the map will grow to | ||
106 | * exceed this headroom once we are ready to trigger | ||
107 | * ExitBootServices() | ||
108 | */ | ||
109 | *map->map_size += *map->desc_size * EFI_MMAP_NR_SLACK_SLOTS; | ||
110 | *map->buff_size = *map->map_size; | ||
96 | goto again; | 111 | goto again; |
97 | } | 112 | } |
98 | 113 | ||
99 | if (status != EFI_SUCCESS) | 114 | if (status != EFI_SUCCESS) |
100 | efi_call_early(free_pool, m); | 115 | efi_call_early(free_pool, m); |
101 | 116 | ||
102 | if (key_ptr && status == EFI_SUCCESS) | 117 | if (map->key_ptr && status == EFI_SUCCESS) |
103 | *key_ptr = key; | 118 | *map->key_ptr = key; |
104 | if (desc_ver && status == EFI_SUCCESS) | 119 | if (map->desc_ver && status == EFI_SUCCESS) |
105 | *desc_ver = desc_version; | 120 | *map->desc_ver = desc_version; |
106 | 121 | ||
107 | fail: | 122 | fail: |
108 | *map = m; | 123 | *map->map = m; |
109 | return status; | 124 | return status; |
110 | } | 125 | } |
111 | 126 | ||
@@ -113,13 +128,20 @@ fail: | |||
113 | unsigned long get_dram_base(efi_system_table_t *sys_table_arg) | 128 | unsigned long get_dram_base(efi_system_table_t *sys_table_arg) |
114 | { | 129 | { |
115 | efi_status_t status; | 130 | efi_status_t status; |
116 | unsigned long map_size; | 131 | unsigned long map_size, buff_size; |
117 | unsigned long membase = EFI_ERROR; | 132 | unsigned long membase = EFI_ERROR; |
118 | struct efi_memory_map map; | 133 | struct efi_memory_map map; |
119 | efi_memory_desc_t *md; | 134 | efi_memory_desc_t *md; |
135 | struct efi_boot_memmap boot_map; | ||
120 | 136 | ||
121 | status = efi_get_memory_map(sys_table_arg, (efi_memory_desc_t **)&map.map, | 137 | boot_map.map = (efi_memory_desc_t **)&map.map; |
122 | &map_size, &map.desc_size, NULL, NULL); | 138 | boot_map.map_size = &map_size; |
139 | boot_map.desc_size = &map.desc_size; | ||
140 | boot_map.desc_ver = NULL; | ||
141 | boot_map.key_ptr = NULL; | ||
142 | boot_map.buff_size = &buff_size; | ||
143 | |||
144 | status = efi_get_memory_map(sys_table_arg, &boot_map); | ||
123 | if (status != EFI_SUCCESS) | 145 | if (status != EFI_SUCCESS) |
124 | return membase; | 146 | return membase; |
125 | 147 | ||
@@ -144,15 +166,22 @@ efi_status_t efi_high_alloc(efi_system_table_t *sys_table_arg, | |||
144 | unsigned long size, unsigned long align, | 166 | unsigned long size, unsigned long align, |
145 | unsigned long *addr, unsigned long max) | 167 | unsigned long *addr, unsigned long max) |
146 | { | 168 | { |
147 | unsigned long map_size, desc_size; | 169 | unsigned long map_size, desc_size, buff_size; |
148 | efi_memory_desc_t *map; | 170 | efi_memory_desc_t *map; |
149 | efi_status_t status; | 171 | efi_status_t status; |
150 | unsigned long nr_pages; | 172 | unsigned long nr_pages; |
151 | u64 max_addr = 0; | 173 | u64 max_addr = 0; |
152 | int i; | 174 | int i; |
175 | struct efi_boot_memmap boot_map; | ||
176 | |||
177 | boot_map.map = ↦ | ||
178 | boot_map.map_size = &map_size; | ||
179 | boot_map.desc_size = &desc_size; | ||
180 | boot_map.desc_ver = NULL; | ||
181 | boot_map.key_ptr = NULL; | ||
182 | boot_map.buff_size = &buff_size; | ||
153 | 183 | ||
154 | status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, | 184 | status = efi_get_memory_map(sys_table_arg, &boot_map); |
155 | NULL, NULL); | ||
156 | if (status != EFI_SUCCESS) | 185 | if (status != EFI_SUCCESS) |
157 | goto fail; | 186 | goto fail; |
158 | 187 | ||
@@ -230,14 +259,21 @@ efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, | |||
230 | unsigned long size, unsigned long align, | 259 | unsigned long size, unsigned long align, |
231 | unsigned long *addr) | 260 | unsigned long *addr) |
232 | { | 261 | { |
233 | unsigned long map_size, desc_size; | 262 | unsigned long map_size, desc_size, buff_size; |
234 | efi_memory_desc_t *map; | 263 | efi_memory_desc_t *map; |
235 | efi_status_t status; | 264 | efi_status_t status; |
236 | unsigned long nr_pages; | 265 | unsigned long nr_pages; |
237 | int i; | 266 | int i; |
267 | struct efi_boot_memmap boot_map; | ||
238 | 268 | ||
239 | status = efi_get_memory_map(sys_table_arg, &map, &map_size, &desc_size, | 269 | boot_map.map = ↦ |
240 | NULL, NULL); | 270 | boot_map.map_size = &map_size; |
271 | boot_map.desc_size = &desc_size; | ||
272 | boot_map.desc_ver = NULL; | ||
273 | boot_map.key_ptr = NULL; | ||
274 | boot_map.buff_size = &buff_size; | ||
275 | |||
276 | status = efi_get_memory_map(sys_table_arg, &boot_map); | ||
241 | if (status != EFI_SUCCESS) | 277 | if (status != EFI_SUCCESS) |
242 | goto fail; | 278 | goto fail; |
243 | 279 | ||
@@ -704,3 +740,76 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, | |||
704 | *cmd_line_len = options_bytes; | 740 | *cmd_line_len = options_bytes; |
705 | return (char *)cmdline_addr; | 741 | return (char *)cmdline_addr; |
706 | } | 742 | } |
743 | |||
744 | /* | ||
745 | * Handle calling ExitBootServices according to the requirements set out by the | ||
746 | * spec. Obtains the current memory map, and returns that info after calling | ||
747 | * ExitBootServices. The client must specify a function to perform any | ||
748 | * processing of the memory map data prior to ExitBootServices. A client | ||
749 | * specific structure may be passed to the function via priv. The client | ||
750 | * function may be called multiple times. | ||
751 | */ | ||
752 | efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table_arg, | ||
753 | void *handle, | ||
754 | struct efi_boot_memmap *map, | ||
755 | void *priv, | ||
756 | efi_exit_boot_map_processing priv_func) | ||
757 | { | ||
758 | efi_status_t status; | ||
759 | |||
760 | status = efi_get_memory_map(sys_table_arg, map); | ||
761 | |||
762 | if (status != EFI_SUCCESS) | ||
763 | goto fail; | ||
764 | |||
765 | status = priv_func(sys_table_arg, map, priv); | ||
766 | if (status != EFI_SUCCESS) | ||
767 | goto free_map; | ||
768 | |||
769 | status = efi_call_early(exit_boot_services, handle, *map->key_ptr); | ||
770 | |||
771 | if (status == EFI_INVALID_PARAMETER) { | ||
772 | /* | ||
773 | * The memory map changed between efi_get_memory_map() and | ||
774 | * exit_boot_services(). Per the UEFI Spec v2.6, Section 6.4: | ||
775 | * EFI_BOOT_SERVICES.ExitBootServices we need to get the | ||
776 | * updated map, and try again. The spec implies one retry | ||
777 | * should be sufficent, which is confirmed against the EDK2 | ||
778 | * implementation. Per the spec, we can only invoke | ||
779 | * get_memory_map() and exit_boot_services() - we cannot alloc | ||
780 | * so efi_get_memory_map() cannot be used, and we must reuse | ||
781 | * the buffer. For all practical purposes, the headroom in the | ||
782 | * buffer should account for any changes in the map so the call | ||
783 | * to get_memory_map() is expected to succeed here. | ||
784 | */ | ||
785 | *map->map_size = *map->buff_size; | ||
786 | status = efi_call_early(get_memory_map, | ||
787 | map->map_size, | ||
788 | *map->map, | ||
789 | map->key_ptr, | ||
790 | map->desc_size, | ||
791 | map->desc_ver); | ||
792 | |||
793 | /* exit_boot_services() was called, thus cannot free */ | ||
794 | if (status != EFI_SUCCESS) | ||
795 | goto fail; | ||
796 | |||
797 | status = priv_func(sys_table_arg, map, priv); | ||
798 | /* exit_boot_services() was called, thus cannot free */ | ||
799 | if (status != EFI_SUCCESS) | ||
800 | goto fail; | ||
801 | |||
802 | status = efi_call_early(exit_boot_services, handle, *map->key_ptr); | ||
803 | } | ||
804 | |||
805 | /* exit_boot_services() was called, thus cannot free */ | ||
806 | if (status != EFI_SUCCESS) | ||
807 | goto fail; | ||
808 | |||
809 | return EFI_SUCCESS; | ||
810 | |||
811 | free_map: | ||
812 | efi_call_early(free_pool, *map->map); | ||
813 | fail: | ||
814 | return status; | ||
815 | } | ||
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index e58abfa953cc..a6a93116a8f0 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||
@@ -152,6 +152,27 @@ fdt_set_fail: | |||
152 | #define EFI_FDT_ALIGN EFI_PAGE_SIZE | 152 | #define EFI_FDT_ALIGN EFI_PAGE_SIZE |
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | struct exit_boot_struct { | ||
156 | efi_memory_desc_t *runtime_map; | ||
157 | int *runtime_entry_count; | ||
158 | }; | ||
159 | |||
160 | static efi_status_t exit_boot_func(efi_system_table_t *sys_table_arg, | ||
161 | struct efi_boot_memmap *map, | ||
162 | void *priv) | ||
163 | { | ||
164 | struct exit_boot_struct *p = priv; | ||
165 | /* | ||
166 | * Update the memory map with virtual addresses. The function will also | ||
167 | * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME | ||
168 | * entries so that we can pass it straight to SetVirtualAddressMap() | ||
169 | */ | ||
170 | efi_get_virtmap(*map->map, *map->map_size, *map->desc_size, | ||
171 | p->runtime_map, p->runtime_entry_count); | ||
172 | |||
173 | return EFI_SUCCESS; | ||
174 | } | ||
175 | |||
155 | /* | 176 | /* |
156 | * Allocate memory for a new FDT, then add EFI, commandline, and | 177 | * Allocate memory for a new FDT, then add EFI, commandline, and |
157 | * initrd related fields to the FDT. This routine increases the | 178 | * initrd related fields to the FDT. This routine increases the |
@@ -175,13 +196,22 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, | |||
175 | unsigned long fdt_addr, | 196 | unsigned long fdt_addr, |
176 | unsigned long fdt_size) | 197 | unsigned long fdt_size) |
177 | { | 198 | { |
178 | unsigned long map_size, desc_size; | 199 | unsigned long map_size, desc_size, buff_size; |
179 | u32 desc_ver; | 200 | u32 desc_ver; |
180 | unsigned long mmap_key; | 201 | unsigned long mmap_key; |
181 | efi_memory_desc_t *memory_map, *runtime_map; | 202 | efi_memory_desc_t *memory_map, *runtime_map; |
182 | unsigned long new_fdt_size; | 203 | unsigned long new_fdt_size; |
183 | efi_status_t status; | 204 | efi_status_t status; |
184 | int runtime_entry_count = 0; | 205 | int runtime_entry_count = 0; |
206 | struct efi_boot_memmap map; | ||
207 | struct exit_boot_struct priv; | ||
208 | |||
209 | map.map = &runtime_map; | ||
210 | map.map_size = &map_size; | ||
211 | map.desc_size = &desc_size; | ||
212 | map.desc_ver = &desc_ver; | ||
213 | map.key_ptr = &mmap_key; | ||
214 | map.buff_size = &buff_size; | ||
185 | 215 | ||
186 | /* | 216 | /* |
187 | * Get a copy of the current memory map that we will use to prepare | 217 | * Get a copy of the current memory map that we will use to prepare |
@@ -189,8 +219,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, | |||
189 | * subsequent allocations adding entries, since they could not affect | 219 | * subsequent allocations adding entries, since they could not affect |
190 | * the number of EFI_MEMORY_RUNTIME regions. | 220 | * the number of EFI_MEMORY_RUNTIME regions. |
191 | */ | 221 | */ |
192 | status = efi_get_memory_map(sys_table, &runtime_map, &map_size, | 222 | status = efi_get_memory_map(sys_table, &map); |
193 | &desc_size, &desc_ver, &mmap_key); | ||
194 | if (status != EFI_SUCCESS) { | 223 | if (status != EFI_SUCCESS) { |
195 | pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n"); | 224 | pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n"); |
196 | return status; | 225 | return status; |
@@ -199,6 +228,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, | |||
199 | pr_efi(sys_table, | 228 | pr_efi(sys_table, |
200 | "Exiting boot services and installing virtual address map...\n"); | 229 | "Exiting boot services and installing virtual address map...\n"); |
201 | 230 | ||
231 | map.map = &memory_map; | ||
202 | /* | 232 | /* |
203 | * Estimate size of new FDT, and allocate memory for it. We | 233 | * Estimate size of new FDT, and allocate memory for it. We |
204 | * will allocate a bigger buffer if this ends up being too | 234 | * will allocate a bigger buffer if this ends up being too |
@@ -218,8 +248,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, | |||
218 | * we can get the memory map key needed for | 248 | * we can get the memory map key needed for |
219 | * exit_boot_services(). | 249 | * exit_boot_services(). |
220 | */ | 250 | */ |
221 | status = efi_get_memory_map(sys_table, &memory_map, &map_size, | 251 | status = efi_get_memory_map(sys_table, &map); |
222 | &desc_size, &desc_ver, &mmap_key); | ||
223 | if (status != EFI_SUCCESS) | 252 | if (status != EFI_SUCCESS) |
224 | goto fail_free_new_fdt; | 253 | goto fail_free_new_fdt; |
225 | 254 | ||
@@ -250,16 +279,11 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table, | |||
250 | } | 279 | } |
251 | } | 280 | } |
252 | 281 | ||
253 | /* | 282 | sys_table->boottime->free_pool(memory_map); |
254 | * Update the memory map with virtual addresses. The function will also | 283 | priv.runtime_map = runtime_map; |
255 | * populate @runtime_map with copies of just the EFI_MEMORY_RUNTIME | 284 | priv.runtime_entry_count = &runtime_entry_count; |
256 | * entries so that we can pass it straight into SetVirtualAddressMap() | 285 | status = efi_exit_boot_services(sys_table, handle, &map, &priv, |
257 | */ | 286 | exit_boot_func); |
258 | efi_get_virtmap(memory_map, map_size, desc_size, runtime_map, | ||
259 | &runtime_entry_count); | ||
260 | |||
261 | /* Now we are ready to exit_boot_services.*/ | ||
262 | status = sys_table->boottime->exit_boot_services(handle, mmap_key); | ||
263 | 287 | ||
264 | if (status == EFI_SUCCESS) { | 288 | if (status == EFI_SUCCESS) { |
265 | efi_set_virtual_address_map_t *svam; | 289 | efi_set_virtual_address_map_t *svam; |
diff --git a/drivers/firmware/efi/libstub/random.c b/drivers/firmware/efi/libstub/random.c index 53f6d3fe6d86..0c9f58c5ba50 100644 --- a/drivers/firmware/efi/libstub/random.c +++ b/drivers/firmware/efi/libstub/random.c | |||
@@ -73,12 +73,20 @@ efi_status_t efi_random_alloc(efi_system_table_t *sys_table_arg, | |||
73 | unsigned long random_seed) | 73 | unsigned long random_seed) |
74 | { | 74 | { |
75 | unsigned long map_size, desc_size, total_slots = 0, target_slot; | 75 | unsigned long map_size, desc_size, total_slots = 0, target_slot; |
76 | unsigned long buff_size; | ||
76 | efi_status_t status; | 77 | efi_status_t status; |
77 | efi_memory_desc_t *memory_map; | 78 | efi_memory_desc_t *memory_map; |
78 | int map_offset; | 79 | int map_offset; |
80 | struct efi_boot_memmap map; | ||
79 | 81 | ||
80 | status = efi_get_memory_map(sys_table_arg, &memory_map, &map_size, | 82 | map.map = &memory_map; |
81 | &desc_size, NULL, NULL); | 83 | map.map_size = &map_size; |
84 | map.desc_size = &desc_size; | ||
85 | map.desc_ver = NULL; | ||
86 | map.key_ptr = NULL; | ||
87 | map.buff_size = &buff_size; | ||
88 | |||
89 | status = efi_get_memory_map(sys_table_arg, &map); | ||
82 | if (status != EFI_SUCCESS) | 90 | if (status != EFI_SUCCESS) |
83 | return status; | 91 | return status; |
84 | 92 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index a978381ef95b..9b17a66cf0e1 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | |||
@@ -387,7 +387,7 @@ void atmel_hlcdc_crtc_irq(struct drm_crtc *c) | |||
387 | atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); | 387 | atmel_hlcdc_crtc_finish_page_flip(drm_crtc_to_atmel_hlcdc_crtc(c)); |
388 | } | 388 | } |
389 | 389 | ||
390 | void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) | 390 | static void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc) |
391 | { | 391 | { |
392 | struct atmel_hlcdc_crtc_state *state; | 392 | struct atmel_hlcdc_crtc_state *state; |
393 | 393 | ||
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 016c191221f3..52c527f6642a 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | |||
@@ -320,19 +320,19 @@ atmel_hlcdc_plane_update_pos_and_size(struct atmel_hlcdc_plane *plane, | |||
320 | u32 *coeff_tab = heo_upscaling_ycoef; | 320 | u32 *coeff_tab = heo_upscaling_ycoef; |
321 | u32 max_memsize; | 321 | u32 max_memsize; |
322 | 322 | ||
323 | if (state->crtc_w < state->src_w) | 323 | if (state->crtc_h < state->src_h) |
324 | coeff_tab = heo_downscaling_ycoef; | 324 | coeff_tab = heo_downscaling_ycoef; |
325 | for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) | 325 | for (i = 0; i < ARRAY_SIZE(heo_upscaling_ycoef); i++) |
326 | atmel_hlcdc_layer_update_cfg(&plane->layer, | 326 | atmel_hlcdc_layer_update_cfg(&plane->layer, |
327 | 33 + i, | 327 | 33 + i, |
328 | 0xffffffff, | 328 | 0xffffffff, |
329 | coeff_tab[i]); | 329 | coeff_tab[i]); |
330 | factor = ((8 * 256 * state->src_w) - (256 * 4)) / | 330 | factor = ((8 * 256 * state->src_h) - (256 * 4)) / |
331 | state->crtc_w; | 331 | state->crtc_h; |
332 | factor++; | 332 | factor++; |
333 | max_memsize = ((factor * state->crtc_w) + (256 * 4)) / | 333 | max_memsize = ((factor * state->crtc_h) + (256 * 4)) / |
334 | 2048; | 334 | 2048; |
335 | if (max_memsize > state->src_w) | 335 | if (max_memsize > state->src_h) |
336 | factor--; | 336 | factor--; |
337 | factor_reg |= (factor << 16) | 0x80000000; | 337 | factor_reg |= (factor << 16) | 0x80000000; |
338 | } | 338 | } |
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index 57676f8d7ecf..a6289752be16 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -1015,6 +1015,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, | |||
1015 | return 0; | 1015 | return 0; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1018 | typedef struct drm_mode_fb_cmd232 { | 1019 | typedef struct drm_mode_fb_cmd232 { |
1019 | u32 fb_id; | 1020 | u32 fb_id; |
1020 | u32 width; | 1021 | u32 width; |
@@ -1071,6 +1072,7 @@ static int compat_drm_mode_addfb2(struct file *file, unsigned int cmd, | |||
1071 | 1072 | ||
1072 | return 0; | 1073 | return 0; |
1073 | } | 1074 | } |
1075 | #endif | ||
1074 | 1076 | ||
1075 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { | 1077 | static drm_ioctl_compat_t *drm_compat_ioctls[] = { |
1076 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, | 1078 | [DRM_IOCTL_NR(DRM_IOCTL_VERSION32)] = compat_drm_version, |
@@ -1104,7 +1106,9 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { | |||
1104 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, | 1106 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW32)] = compat_drm_update_draw, |
1105 | #endif | 1107 | #endif |
1106 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, | 1108 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK32)] = compat_drm_wait_vblank, |
1109 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1107 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, | 1110 | [DRM_IOCTL_NR(DRM_IOCTL_MODE_ADDFB232)] = compat_drm_mode_addfb2, |
1111 | #endif | ||
1108 | }; | 1112 | }; |
1109 | 1113 | ||
1110 | /** | 1114 | /** |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index e0166403b4bd..40ce841eb952 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
@@ -55,11 +55,11 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, | |||
55 | flags = exynos_gem->flags; | 55 | flags = exynos_gem->flags; |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * without iommu support, not support physically non-continuous memory | 58 | * Physically non-contiguous memory type for framebuffer is not |
59 | * for framebuffer. | 59 | * supported without IOMMU. |
60 | */ | 60 | */ |
61 | if (IS_NONCONTIG_BUFFER(flags)) { | 61 | if (IS_NONCONTIG_BUFFER(flags)) { |
62 | DRM_ERROR("cannot use this gem memory type for fb.\n"); | 62 | DRM_ERROR("Non-contiguous GEM memory is not supported.\n"); |
63 | return -EINVAL; | 63 | return -EINVAL; |
64 | } | 64 | } |
65 | 65 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 0525c56145db..147ef0d298cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
@@ -1753,32 +1753,6 @@ static int fimc_clk_ctrl(struct fimc_context *ctx, bool enable) | |||
1753 | return 0; | 1753 | return 0; |
1754 | } | 1754 | } |
1755 | 1755 | ||
1756 | #ifdef CONFIG_PM_SLEEP | ||
1757 | static int fimc_suspend(struct device *dev) | ||
1758 | { | ||
1759 | struct fimc_context *ctx = get_fimc_context(dev); | ||
1760 | |||
1761 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1762 | |||
1763 | if (pm_runtime_suspended(dev)) | ||
1764 | return 0; | ||
1765 | |||
1766 | return fimc_clk_ctrl(ctx, false); | ||
1767 | } | ||
1768 | |||
1769 | static int fimc_resume(struct device *dev) | ||
1770 | { | ||
1771 | struct fimc_context *ctx = get_fimc_context(dev); | ||
1772 | |||
1773 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1774 | |||
1775 | if (!pm_runtime_suspended(dev)) | ||
1776 | return fimc_clk_ctrl(ctx, true); | ||
1777 | |||
1778 | return 0; | ||
1779 | } | ||
1780 | #endif | ||
1781 | |||
1782 | static int fimc_runtime_suspend(struct device *dev) | 1756 | static int fimc_runtime_suspend(struct device *dev) |
1783 | { | 1757 | { |
1784 | struct fimc_context *ctx = get_fimc_context(dev); | 1758 | struct fimc_context *ctx = get_fimc_context(dev); |
@@ -1799,7 +1773,8 @@ static int fimc_runtime_resume(struct device *dev) | |||
1799 | #endif | 1773 | #endif |
1800 | 1774 | ||
1801 | static const struct dev_pm_ops fimc_pm_ops = { | 1775 | static const struct dev_pm_ops fimc_pm_ops = { |
1802 | SET_SYSTEM_SLEEP_PM_OPS(fimc_suspend, fimc_resume) | 1776 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1777 | pm_runtime_force_resume) | ||
1803 | SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL) | 1778 | SET_RUNTIME_PM_OPS(fimc_runtime_suspend, fimc_runtime_resume, NULL) |
1804 | }; | 1779 | }; |
1805 | 1780 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 4bf00f57ffe8..6eca8bb88648 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -1475,8 +1475,8 @@ static int g2d_remove(struct platform_device *pdev) | |||
1475 | return 0; | 1475 | return 0; |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | #ifdef CONFIG_PM_SLEEP | 1478 | #ifdef CONFIG_PM |
1479 | static int g2d_suspend(struct device *dev) | 1479 | static int g2d_runtime_suspend(struct device *dev) |
1480 | { | 1480 | { |
1481 | struct g2d_data *g2d = dev_get_drvdata(dev); | 1481 | struct g2d_data *g2d = dev_get_drvdata(dev); |
1482 | 1482 | ||
@@ -1490,25 +1490,6 @@ static int g2d_suspend(struct device *dev) | |||
1490 | 1490 | ||
1491 | flush_work(&g2d->runqueue_work); | 1491 | flush_work(&g2d->runqueue_work); |
1492 | 1492 | ||
1493 | return 0; | ||
1494 | } | ||
1495 | |||
1496 | static int g2d_resume(struct device *dev) | ||
1497 | { | ||
1498 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
1499 | |||
1500 | g2d->suspended = false; | ||
1501 | g2d_exec_runqueue(g2d); | ||
1502 | |||
1503 | return 0; | ||
1504 | } | ||
1505 | #endif | ||
1506 | |||
1507 | #ifdef CONFIG_PM | ||
1508 | static int g2d_runtime_suspend(struct device *dev) | ||
1509 | { | ||
1510 | struct g2d_data *g2d = dev_get_drvdata(dev); | ||
1511 | |||
1512 | clk_disable_unprepare(g2d->gate_clk); | 1493 | clk_disable_unprepare(g2d->gate_clk); |
1513 | 1494 | ||
1514 | return 0; | 1495 | return 0; |
@@ -1523,12 +1504,16 @@ static int g2d_runtime_resume(struct device *dev) | |||
1523 | if (ret < 0) | 1504 | if (ret < 0) |
1524 | dev_warn(dev, "failed to enable clock.\n"); | 1505 | dev_warn(dev, "failed to enable clock.\n"); |
1525 | 1506 | ||
1507 | g2d->suspended = false; | ||
1508 | g2d_exec_runqueue(g2d); | ||
1509 | |||
1526 | return ret; | 1510 | return ret; |
1527 | } | 1511 | } |
1528 | #endif | 1512 | #endif |
1529 | 1513 | ||
1530 | static const struct dev_pm_ops g2d_pm_ops = { | 1514 | static const struct dev_pm_ops g2d_pm_ops = { |
1531 | SET_SYSTEM_SLEEP_PM_OPS(g2d_suspend, g2d_resume) | 1515 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1516 | pm_runtime_force_resume) | ||
1532 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) | 1517 | SET_RUNTIME_PM_OPS(g2d_runtime_suspend, g2d_runtime_resume, NULL) |
1533 | }; | 1518 | }; |
1534 | 1519 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 5d20da8f957e..52a9d269484e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
@@ -1760,34 +1760,7 @@ static int gsc_remove(struct platform_device *pdev) | |||
1760 | return 0; | 1760 | return 0; |
1761 | } | 1761 | } |
1762 | 1762 | ||
1763 | #ifdef CONFIG_PM_SLEEP | 1763 | static int __maybe_unused gsc_runtime_suspend(struct device *dev) |
1764 | static int gsc_suspend(struct device *dev) | ||
1765 | { | ||
1766 | struct gsc_context *ctx = get_gsc_context(dev); | ||
1767 | |||
1768 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1769 | |||
1770 | if (pm_runtime_suspended(dev)) | ||
1771 | return 0; | ||
1772 | |||
1773 | return gsc_clk_ctrl(ctx, false); | ||
1774 | } | ||
1775 | |||
1776 | static int gsc_resume(struct device *dev) | ||
1777 | { | ||
1778 | struct gsc_context *ctx = get_gsc_context(dev); | ||
1779 | |||
1780 | DRM_DEBUG_KMS("id[%d]\n", ctx->id); | ||
1781 | |||
1782 | if (!pm_runtime_suspended(dev)) | ||
1783 | return gsc_clk_ctrl(ctx, true); | ||
1784 | |||
1785 | return 0; | ||
1786 | } | ||
1787 | #endif | ||
1788 | |||
1789 | #ifdef CONFIG_PM | ||
1790 | static int gsc_runtime_suspend(struct device *dev) | ||
1791 | { | 1764 | { |
1792 | struct gsc_context *ctx = get_gsc_context(dev); | 1765 | struct gsc_context *ctx = get_gsc_context(dev); |
1793 | 1766 | ||
@@ -1796,7 +1769,7 @@ static int gsc_runtime_suspend(struct device *dev) | |||
1796 | return gsc_clk_ctrl(ctx, false); | 1769 | return gsc_clk_ctrl(ctx, false); |
1797 | } | 1770 | } |
1798 | 1771 | ||
1799 | static int gsc_runtime_resume(struct device *dev) | 1772 | static int __maybe_unused gsc_runtime_resume(struct device *dev) |
1800 | { | 1773 | { |
1801 | struct gsc_context *ctx = get_gsc_context(dev); | 1774 | struct gsc_context *ctx = get_gsc_context(dev); |
1802 | 1775 | ||
@@ -1804,10 +1777,10 @@ static int gsc_runtime_resume(struct device *dev) | |||
1804 | 1777 | ||
1805 | return gsc_clk_ctrl(ctx, true); | 1778 | return gsc_clk_ctrl(ctx, true); |
1806 | } | 1779 | } |
1807 | #endif | ||
1808 | 1780 | ||
1809 | static const struct dev_pm_ops gsc_pm_ops = { | 1781 | static const struct dev_pm_ops gsc_pm_ops = { |
1810 | SET_SYSTEM_SLEEP_PM_OPS(gsc_suspend, gsc_resume) | 1782 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
1783 | pm_runtime_force_resume) | ||
1811 | SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) | 1784 | SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) |
1812 | }; | 1785 | }; |
1813 | 1786 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 404367a430b5..6591e406084c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
@@ -794,29 +794,6 @@ static int rotator_clk_crtl(struct rot_context *rot, bool enable) | |||
794 | return 0; | 794 | return 0; |
795 | } | 795 | } |
796 | 796 | ||
797 | |||
798 | #ifdef CONFIG_PM_SLEEP | ||
799 | static int rotator_suspend(struct device *dev) | ||
800 | { | ||
801 | struct rot_context *rot = dev_get_drvdata(dev); | ||
802 | |||
803 | if (pm_runtime_suspended(dev)) | ||
804 | return 0; | ||
805 | |||
806 | return rotator_clk_crtl(rot, false); | ||
807 | } | ||
808 | |||
809 | static int rotator_resume(struct device *dev) | ||
810 | { | ||
811 | struct rot_context *rot = dev_get_drvdata(dev); | ||
812 | |||
813 | if (!pm_runtime_suspended(dev)) | ||
814 | return rotator_clk_crtl(rot, true); | ||
815 | |||
816 | return 0; | ||
817 | } | ||
818 | #endif | ||
819 | |||
820 | static int rotator_runtime_suspend(struct device *dev) | 797 | static int rotator_runtime_suspend(struct device *dev) |
821 | { | 798 | { |
822 | struct rot_context *rot = dev_get_drvdata(dev); | 799 | struct rot_context *rot = dev_get_drvdata(dev); |
@@ -833,7 +810,8 @@ static int rotator_runtime_resume(struct device *dev) | |||
833 | #endif | 810 | #endif |
834 | 811 | ||
835 | static const struct dev_pm_ops rotator_pm_ops = { | 812 | static const struct dev_pm_ops rotator_pm_ops = { |
836 | SET_SYSTEM_SLEEP_PM_OPS(rotator_suspend, rotator_resume) | 813 | SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, |
814 | pm_runtime_force_resume) | ||
837 | SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume, | 815 | SET_RUNTIME_PM_OPS(rotator_runtime_suspend, rotator_runtime_resume, |
838 | NULL) | 816 | NULL) |
839 | }; | 817 | }; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 95ddd56b89f0..5de36d8dcc68 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -1281,6 +1281,11 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1281 | 1281 | ||
1282 | intel_runtime_pm_enable(dev_priv); | 1282 | intel_runtime_pm_enable(dev_priv); |
1283 | 1283 | ||
1284 | /* Everything is in place, we can now relax! */ | ||
1285 | DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n", | ||
1286 | driver.name, driver.major, driver.minor, driver.patchlevel, | ||
1287 | driver.date, pci_name(pdev), dev_priv->drm.primary->index); | ||
1288 | |||
1284 | intel_runtime_pm_put(dev_priv); | 1289 | intel_runtime_pm_put(dev_priv); |
1285 | 1290 | ||
1286 | return 0; | 1291 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 7a30af79d799..f38ceffd82c3 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -122,8 +122,11 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, | |||
122 | has_full_48bit_ppgtt = | 122 | has_full_48bit_ppgtt = |
123 | IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; | 123 | IS_BROADWELL(dev_priv) || INTEL_GEN(dev_priv) >= 9; |
124 | 124 | ||
125 | if (intel_vgpu_active(dev_priv)) | 125 | if (intel_vgpu_active(dev_priv)) { |
126 | has_full_ppgtt = false; /* emulation is too hard */ | 126 | /* emulation is too hard */ |
127 | has_full_ppgtt = false; | ||
128 | has_full_48bit_ppgtt = false; | ||
129 | } | ||
127 | 130 | ||
128 | if (!has_aliasing_ppgtt) | 131 | if (!has_aliasing_ppgtt) |
129 | return 0; | 132 | return 0; |
@@ -158,7 +161,7 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, | |||
158 | return 0; | 161 | return 0; |
159 | } | 162 | } |
160 | 163 | ||
161 | if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists) | 164 | if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt) |
162 | return has_full_48bit_ppgtt ? 3 : 2; | 165 | return has_full_48bit_ppgtt ? 3 : 2; |
163 | else | 166 | else |
164 | return has_aliasing_ppgtt ? 1 : 0; | 167 | return has_aliasing_ppgtt ? 1 : 0; |
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c index f6acb5a0e701..b81cfb3b22ec 100644 --- a/drivers/gpu/drm/i915/i915_vgpu.c +++ b/drivers/gpu/drm/i915/i915_vgpu.c | |||
@@ -65,9 +65,6 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv) | |||
65 | 65 | ||
66 | BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); | 66 | BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); |
67 | 67 | ||
68 | if (!IS_HASWELL(dev_priv)) | ||
69 | return; | ||
70 | |||
71 | magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); | 68 | magic = __raw_i915_read64(dev_priv, vgtif_reg(magic)); |
72 | if (magic != VGT_MAGIC) | 69 | if (magic != VGT_MAGIC) |
73 | return; | 70 | return; |
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 47bdf9dad0d3..b9e5a63a7c9e 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -554,7 +554,6 @@ void intel_dvo_init(struct drm_device *dev) | |||
554 | return; | 554 | return; |
555 | } | 555 | } |
556 | 556 | ||
557 | drm_encoder_cleanup(&intel_encoder->base); | ||
558 | kfree(intel_dvo); | 557 | kfree(intel_dvo); |
559 | kfree(intel_connector); | 558 | kfree(intel_connector); |
560 | } | 559 | } |
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index adca262d591a..7acbbbf97833 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -1047,6 +1047,23 @@ err_out: | |||
1047 | return err; | 1047 | return err; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | static int intel_use_opregion_panel_type_callback(const struct dmi_system_id *id) | ||
1051 | { | ||
1052 | DRM_INFO("Using panel type from OpRegion on %s\n", id->ident); | ||
1053 | return 1; | ||
1054 | } | ||
1055 | |||
1056 | static const struct dmi_system_id intel_use_opregion_panel_type[] = { | ||
1057 | { | ||
1058 | .callback = intel_use_opregion_panel_type_callback, | ||
1059 | .ident = "Conrac GmbH IX45GM2", | ||
1060 | .matches = {DMI_MATCH(DMI_SYS_VENDOR, "Conrac GmbH"), | ||
1061 | DMI_MATCH(DMI_PRODUCT_NAME, "IX45GM2"), | ||
1062 | }, | ||
1063 | }, | ||
1064 | { } | ||
1065 | }; | ||
1066 | |||
1050 | int | 1067 | int |
1051 | intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) | 1068 | intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) |
1052 | { | 1069 | { |
@@ -1073,6 +1090,16 @@ intel_opregion_get_panel_type(struct drm_i915_private *dev_priv) | |||
1073 | } | 1090 | } |
1074 | 1091 | ||
1075 | /* | 1092 | /* |
1093 | * So far we know that some machined must use it, others must not use it. | ||
1094 | * There doesn't seem to be any way to determine which way to go, except | ||
1095 | * via a quirk list :( | ||
1096 | */ | ||
1097 | if (!dmi_check_system(intel_use_opregion_panel_type)) { | ||
1098 | DRM_DEBUG_KMS("Ignoring OpRegion panel type (%d)\n", ret - 1); | ||
1099 | return -ENODEV; | ||
1100 | } | ||
1101 | |||
1102 | /* | ||
1076 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us | 1103 | * FIXME On Dell XPS 13 9350 the OpRegion panel type (0) gives us |
1077 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal | 1104 | * low vswing for eDP, whereas the VBT panel type (2) gives us normal |
1078 | * vswing instead. Low vswing results in some display flickers, so | 1105 | * vswing instead. Low vswing results in some display flickers, so |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 53e13c10e4ea..2d2481392824 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -7859,6 +7859,7 @@ static inline int gen6_check_mailbox_status(struct drm_i915_private *dev_priv) | |||
7859 | case GEN6_PCODE_ILLEGAL_CMD: | 7859 | case GEN6_PCODE_ILLEGAL_CMD: |
7860 | return -ENXIO; | 7860 | return -ENXIO; |
7861 | case GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | 7861 | case GEN6_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: |
7862 | case GEN7_PCODE_MIN_FREQ_TABLE_GT_RATIO_OUT_OF_RANGE: | ||
7862 | return -EOVERFLOW; | 7863 | return -EOVERFLOW; |
7863 | case GEN6_PCODE_TIMEOUT: | 7864 | case GEN6_PCODE_TIMEOUT: |
7864 | return -ETIMEDOUT; | 7865 | return -ETIMEDOUT; |
diff --git a/drivers/gpu/drm/i915/intel_psr.c b/drivers/gpu/drm/i915/intel_psr.c index 2b0d1baf15b3..cf171b4b8c67 100644 --- a/drivers/gpu/drm/i915/intel_psr.c +++ b/drivers/gpu/drm/i915/intel_psr.c | |||
@@ -255,14 +255,14 @@ static void hsw_psr_enable_source(struct intel_dp *intel_dp) | |||
255 | struct drm_i915_private *dev_priv = to_i915(dev); | 255 | struct drm_i915_private *dev_priv = to_i915(dev); |
256 | 256 | ||
257 | uint32_t max_sleep_time = 0x1f; | 257 | uint32_t max_sleep_time = 0x1f; |
258 | /* Lately it was identified that depending on panel idle frame count | 258 | /* |
259 | * calculated at HW can be off by 1. So let's use what came | 259 | * Let's respect VBT in case VBT asks a higher idle_frame value. |
260 | * from VBT + 1. | 260 | * Let's use 6 as the minimum to cover all known cases including |
261 | * There are also other cases where panel demands at least 4 | 261 | * the off-by-one issue that HW has in some cases. Also there are |
262 | * but VBT is not being set. To cover these 2 cases lets use | 262 | * cases where sink should be able to train |
263 | * at least 5 when VBT isn't set to be on the safest side. | 263 | * with the 5 or 6 idle patterns. |
264 | */ | 264 | */ |
265 | uint32_t idle_frames = dev_priv->vbt.psr.idle_frames + 1; | 265 | uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames); |
266 | uint32_t val = EDP_PSR_ENABLE; | 266 | uint32_t val = EDP_PSR_ENABLE; |
267 | 267 | ||
268 | val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; | 268 | val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT; |
diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c index 59adcf8532dd..3f6704cf6608 100644 --- a/drivers/gpu/drm/vc4/vc4_bo.c +++ b/drivers/gpu/drm/vc4/vc4_bo.c | |||
@@ -144,7 +144,7 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, | |||
144 | return &vc4->bo_cache.size_list[page_index]; | 144 | return &vc4->bo_cache.size_list[page_index]; |
145 | } | 145 | } |
146 | 146 | ||
147 | void vc4_bo_cache_purge(struct drm_device *dev) | 147 | static void vc4_bo_cache_purge(struct drm_device *dev) |
148 | { | 148 | { |
149 | struct vc4_dev *vc4 = to_vc4_dev(dev); | 149 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
150 | 150 | ||
diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c index 46527e989ce3..2543cf5b8b51 100644 --- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c +++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c | |||
@@ -309,8 +309,14 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade | |||
309 | * of uniforms on each side. However, this scheme is easy to | 309 | * of uniforms on each side. However, this scheme is easy to |
310 | * validate so it's all we allow for now. | 310 | * validate so it's all we allow for now. |
311 | */ | 311 | */ |
312 | 312 | switch (QPU_GET_FIELD(inst, QPU_SIG)) { | |
313 | if (QPU_GET_FIELD(inst, QPU_SIG) != QPU_SIG_NONE) { | 313 | case QPU_SIG_NONE: |
314 | case QPU_SIG_SCOREBOARD_UNLOCK: | ||
315 | case QPU_SIG_COLOR_LOAD: | ||
316 | case QPU_SIG_LOAD_TMU0: | ||
317 | case QPU_SIG_LOAD_TMU1: | ||
318 | break; | ||
319 | default: | ||
314 | DRM_ERROR("uniforms address change must be " | 320 | DRM_ERROR("uniforms address change must be " |
315 | "normal math\n"); | 321 | "normal math\n"); |
316 | return false; | 322 | return false; |
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index 137125b5eae7..5ce71ce7b6c4 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
@@ -773,13 +773,6 @@ static int pch_i2c_probe(struct pci_dev *pdev, | |||
773 | /* Set the number of I2C channel instance */ | 773 | /* Set the number of I2C channel instance */ |
774 | adap_info->ch_num = id->driver_data; | 774 | adap_info->ch_num = id->driver_data; |
775 | 775 | ||
776 | ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, | ||
777 | KBUILD_MODNAME, adap_info); | ||
778 | if (ret) { | ||
779 | pch_pci_err(pdev, "request_irq FAILED\n"); | ||
780 | goto err_request_irq; | ||
781 | } | ||
782 | |||
783 | for (i = 0; i < adap_info->ch_num; i++) { | 776 | for (i = 0; i < adap_info->ch_num; i++) { |
784 | pch_adap = &adap_info->pch_data[i].pch_adapter; | 777 | pch_adap = &adap_info->pch_data[i].pch_adapter; |
785 | adap_info->pch_i2c_suspended = false; | 778 | adap_info->pch_i2c_suspended = false; |
@@ -797,6 +790,17 @@ static int pch_i2c_probe(struct pci_dev *pdev, | |||
797 | 790 | ||
798 | pch_adap->dev.of_node = pdev->dev.of_node; | 791 | pch_adap->dev.of_node = pdev->dev.of_node; |
799 | pch_adap->dev.parent = &pdev->dev; | 792 | pch_adap->dev.parent = &pdev->dev; |
793 | } | ||
794 | |||
795 | ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED, | ||
796 | KBUILD_MODNAME, adap_info); | ||
797 | if (ret) { | ||
798 | pch_pci_err(pdev, "request_irq FAILED\n"); | ||
799 | goto err_request_irq; | ||
800 | } | ||
801 | |||
802 | for (i = 0; i < adap_info->ch_num; i++) { | ||
803 | pch_adap = &adap_info->pch_data[i].pch_adapter; | ||
800 | 804 | ||
801 | pch_i2c_init(&adap_info->pch_data[i]); | 805 | pch_i2c_init(&adap_info->pch_data[i]); |
802 | 806 | ||
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 501bd15cb78e..a8497cfdae6f 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c | |||
@@ -1599,7 +1599,8 @@ static int qup_i2c_pm_resume_runtime(struct device *device) | |||
1599 | #ifdef CONFIG_PM_SLEEP | 1599 | #ifdef CONFIG_PM_SLEEP |
1600 | static int qup_i2c_suspend(struct device *device) | 1600 | static int qup_i2c_suspend(struct device *device) |
1601 | { | 1601 | { |
1602 | qup_i2c_pm_suspend_runtime(device); | 1602 | if (!pm_runtime_suspended(device)) |
1603 | return qup_i2c_pm_suspend_runtime(device); | ||
1603 | return 0; | 1604 | return 0; |
1604 | } | 1605 | } |
1605 | 1606 | ||
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 528e755c468f..3278ebf1cc5c 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c | |||
@@ -164,7 +164,7 @@ static int pca954x_select_chan(struct i2c_mux_core *muxc, u32 chan) | |||
164 | /* Only select the channel if its different from the last channel */ | 164 | /* Only select the channel if its different from the last channel */ |
165 | if (data->last_chan != regval) { | 165 | if (data->last_chan != regval) { |
166 | ret = pca954x_reg_write(muxc->parent, client, regval); | 166 | ret = pca954x_reg_write(muxc->parent, client, regval); |
167 | data->last_chan = regval; | 167 | data->last_chan = ret ? 0 : regval; |
168 | } | 168 | } |
169 | 169 | ||
170 | return ret; | 170 | return ret; |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b6a953aed7e8..80f988984f44 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -333,6 +333,8 @@ static void remove_ep_tid(struct c4iw_ep *ep) | |||
333 | 333 | ||
334 | spin_lock_irqsave(&ep->com.dev->lock, flags); | 334 | spin_lock_irqsave(&ep->com.dev->lock, flags); |
335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); | 335 | _remove_handle(ep->com.dev, &ep->com.dev->hwtid_idr, ep->hwtid, 0); |
336 | if (idr_is_empty(&ep->com.dev->hwtid_idr)) | ||
337 | wake_up(&ep->com.dev->wait); | ||
336 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); | 338 | spin_unlock_irqrestore(&ep->com.dev->lock, flags); |
337 | } | 339 | } |
338 | 340 | ||
@@ -2117,8 +2119,10 @@ static int import_ep(struct c4iw_ep *ep, int iptype, __u8 *peer_ip, | |||
2117 | } | 2119 | } |
2118 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, | 2120 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, |
2119 | n, pdev, rt_tos2priority(tos)); | 2121 | n, pdev, rt_tos2priority(tos)); |
2120 | if (!ep->l2t) | 2122 | if (!ep->l2t) { |
2123 | dev_put(pdev); | ||
2121 | goto out; | 2124 | goto out; |
2125 | } | ||
2122 | ep->mtu = pdev->mtu; | 2126 | ep->mtu = pdev->mtu; |
2123 | ep->tx_chan = cxgb4_port_chan(pdev); | 2127 | ep->tx_chan = cxgb4_port_chan(pdev); |
2124 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, | 2128 | ep->smac_idx = cxgb4_tp_smt_idx(adapter_type, |
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 071d7332ec06..3c4b2126e0d1 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
@@ -872,9 +872,13 @@ static void c4iw_rdev_close(struct c4iw_rdev *rdev) | |||
872 | static void c4iw_dealloc(struct uld_ctx *ctx) | 872 | static void c4iw_dealloc(struct uld_ctx *ctx) |
873 | { | 873 | { |
874 | c4iw_rdev_close(&ctx->dev->rdev); | 874 | c4iw_rdev_close(&ctx->dev->rdev); |
875 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->cqidr)); | ||
875 | idr_destroy(&ctx->dev->cqidr); | 876 | idr_destroy(&ctx->dev->cqidr); |
877 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->qpidr)); | ||
876 | idr_destroy(&ctx->dev->qpidr); | 878 | idr_destroy(&ctx->dev->qpidr); |
879 | WARN_ON_ONCE(!idr_is_empty(&ctx->dev->mmidr)); | ||
877 | idr_destroy(&ctx->dev->mmidr); | 880 | idr_destroy(&ctx->dev->mmidr); |
881 | wait_event(ctx->dev->wait, idr_is_empty(&ctx->dev->hwtid_idr)); | ||
878 | idr_destroy(&ctx->dev->hwtid_idr); | 882 | idr_destroy(&ctx->dev->hwtid_idr); |
879 | idr_destroy(&ctx->dev->stid_idr); | 883 | idr_destroy(&ctx->dev->stid_idr); |
880 | idr_destroy(&ctx->dev->atid_idr); | 884 | idr_destroy(&ctx->dev->atid_idr); |
@@ -992,6 +996,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
992 | mutex_init(&devp->rdev.stats.lock); | 996 | mutex_init(&devp->rdev.stats.lock); |
993 | mutex_init(&devp->db_mutex); | 997 | mutex_init(&devp->db_mutex); |
994 | INIT_LIST_HEAD(&devp->db_fc_list); | 998 | INIT_LIST_HEAD(&devp->db_fc_list); |
999 | init_waitqueue_head(&devp->wait); | ||
995 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; | 1000 | devp->avail_ird = devp->rdev.lldi.max_ird_adapter; |
996 | 1001 | ||
997 | if (c4iw_debugfs_root) { | 1002 | if (c4iw_debugfs_root) { |
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index aa47e0ae80bc..4b83b84f7ddf 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -263,6 +263,7 @@ struct c4iw_dev { | |||
263 | struct idr stid_idr; | 263 | struct idr stid_idr; |
264 | struct list_head db_fc_list; | 264 | struct list_head db_fc_list; |
265 | u32 avail_ird; | 265 | u32 avail_ird; |
266 | wait_queue_head_t wait; | ||
266 | }; | 267 | }; |
267 | 268 | ||
268 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) | 269 | static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 9c2e53d28f98..0f21c3a25552 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -1128,6 +1128,27 @@ void handle_port_mgmt_change_event(struct work_struct *work) | |||
1128 | 1128 | ||
1129 | /* Generate GUID changed event */ | 1129 | /* Generate GUID changed event */ |
1130 | if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { | 1130 | if (changed_attr & MLX4_EQ_PORT_INFO_GID_PFX_CHANGE_MASK) { |
1131 | if (mlx4_is_master(dev->dev)) { | ||
1132 | union ib_gid gid; | ||
1133 | int err = 0; | ||
1134 | |||
1135 | if (!eqe->event.port_mgmt_change.params.port_info.gid_prefix) | ||
1136 | err = __mlx4_ib_query_gid(&dev->ib_dev, port, 0, &gid, 1); | ||
1137 | else | ||
1138 | gid.global.subnet_prefix = | ||
1139 | eqe->event.port_mgmt_change.params.port_info.gid_prefix; | ||
1140 | if (err) { | ||
1141 | pr_warn("Could not change QP1 subnet prefix for port %d: query_gid error (%d)\n", | ||
1142 | port, err); | ||
1143 | } else { | ||
1144 | pr_debug("Changing QP1 subnet prefix for port %d. old=0x%llx. new=0x%llx\n", | ||
1145 | port, | ||
1146 | (u64)atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix), | ||
1147 | be64_to_cpu(gid.global.subnet_prefix)); | ||
1148 | atomic64_set(&dev->sriov.demux[port - 1].subnet_prefix, | ||
1149 | be64_to_cpu(gid.global.subnet_prefix)); | ||
1150 | } | ||
1151 | } | ||
1131 | mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); | 1152 | mlx4_ib_dispatch_event(dev, port, IB_EVENT_GID_CHANGE); |
1132 | /*if master, notify all slaves*/ | 1153 | /*if master, notify all slaves*/ |
1133 | if (mlx4_is_master(dev->dev)) | 1154 | if (mlx4_is_master(dev->dev)) |
@@ -2202,6 +2223,8 @@ int mlx4_ib_init_sriov(struct mlx4_ib_dev *dev) | |||
2202 | if (err) | 2223 | if (err) |
2203 | goto demux_err; | 2224 | goto demux_err; |
2204 | dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; | 2225 | dev->sriov.demux[i].guid_cache[0] = gid.global.interface_id; |
2226 | atomic64_set(&dev->sriov.demux[i].subnet_prefix, | ||
2227 | be64_to_cpu(gid.global.subnet_prefix)); | ||
2205 | err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, | 2228 | err = alloc_pv_object(dev, mlx4_master_func_num(dev->dev), i + 1, |
2206 | &dev->sriov.sqps[i]); | 2229 | &dev->sriov.sqps[i]); |
2207 | if (err) | 2230 | if (err) |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 2af44c2de262..87ba9bca4181 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -2202,6 +2202,9 @@ static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev) | |||
2202 | bool per_port = !!(ibdev->dev->caps.flags2 & | 2202 | bool per_port = !!(ibdev->dev->caps.flags2 & |
2203 | MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); | 2203 | MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT); |
2204 | 2204 | ||
2205 | if (mlx4_is_slave(ibdev->dev)) | ||
2206 | return 0; | ||
2207 | |||
2205 | for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { | 2208 | for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) { |
2206 | /* i == 1 means we are building port counters */ | 2209 | /* i == 1 means we are building port counters */ |
2207 | if (i && !per_port) | 2210 | if (i && !per_port) |
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c index 8f7ad07915b0..097bfcc4ee99 100644 --- a/drivers/infiniband/hw/mlx4/mcg.c +++ b/drivers/infiniband/hw/mlx4/mcg.c | |||
@@ -489,7 +489,7 @@ static u8 get_leave_state(struct mcast_group *group) | |||
489 | if (!group->members[i]) | 489 | if (!group->members[i]) |
490 | leave_state |= (1 << i); | 490 | leave_state |= (1 << i); |
491 | 491 | ||
492 | return leave_state & (group->rec.scope_join_state & 7); | 492 | return leave_state & (group->rec.scope_join_state & 0xf); |
493 | } | 493 | } |
494 | 494 | ||
495 | static int join_group(struct mcast_group *group, int slave, u8 join_mask) | 495 | static int join_group(struct mcast_group *group, int slave, u8 join_mask) |
@@ -564,8 +564,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work) | |||
564 | } else | 564 | } else |
565 | mcg_warn_group(group, "DRIVER BUG\n"); | 565 | mcg_warn_group(group, "DRIVER BUG\n"); |
566 | } else if (group->state == MCAST_LEAVE_SENT) { | 566 | } else if (group->state == MCAST_LEAVE_SENT) { |
567 | if (group->rec.scope_join_state & 7) | 567 | if (group->rec.scope_join_state & 0xf) |
568 | group->rec.scope_join_state &= 0xf8; | 568 | group->rec.scope_join_state &= 0xf0; |
569 | group->state = MCAST_IDLE; | 569 | group->state = MCAST_IDLE; |
570 | mutex_unlock(&group->lock); | 570 | mutex_unlock(&group->lock); |
571 | if (release_group(group, 1)) | 571 | if (release_group(group, 1)) |
@@ -605,7 +605,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask, | |||
605 | static int handle_join_req(struct mcast_group *group, u8 join_mask, | 605 | static int handle_join_req(struct mcast_group *group, u8 join_mask, |
606 | struct mcast_req *req) | 606 | struct mcast_req *req) |
607 | { | 607 | { |
608 | u8 group_join_state = group->rec.scope_join_state & 7; | 608 | u8 group_join_state = group->rec.scope_join_state & 0xf; |
609 | int ref = 0; | 609 | int ref = 0; |
610 | u16 status; | 610 | u16 status; |
611 | struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; | 611 | struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; |
@@ -690,8 +690,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work) | |||
690 | u8 cur_join_state; | 690 | u8 cur_join_state; |
691 | 691 | ||
692 | resp_join_state = ((struct ib_sa_mcmember_data *) | 692 | resp_join_state = ((struct ib_sa_mcmember_data *) |
693 | group->response_sa_mad.data)->scope_join_state & 7; | 693 | group->response_sa_mad.data)->scope_join_state & 0xf; |
694 | cur_join_state = group->rec.scope_join_state & 7; | 694 | cur_join_state = group->rec.scope_join_state & 0xf; |
695 | 695 | ||
696 | if (method == IB_MGMT_METHOD_GET_RESP) { | 696 | if (method == IB_MGMT_METHOD_GET_RESP) { |
697 | /* successfull join */ | 697 | /* successfull join */ |
@@ -710,7 +710,7 @@ process_requests: | |||
710 | req = list_first_entry(&group->pending_list, struct mcast_req, | 710 | req = list_first_entry(&group->pending_list, struct mcast_req, |
711 | group_list); | 711 | group_list); |
712 | sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; | 712 | sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data; |
713 | req_join_state = sa_data->scope_join_state & 0x7; | 713 | req_join_state = sa_data->scope_join_state & 0xf; |
714 | 714 | ||
715 | /* For a leave request, we will immediately answer the VF, and | 715 | /* For a leave request, we will immediately answer the VF, and |
716 | * update our internal counters. The actual leave will be sent | 716 | * update our internal counters. The actual leave will be sent |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index 7c5832ede4bd..686ab48ff644 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -448,7 +448,7 @@ struct mlx4_ib_demux_ctx { | |||
448 | struct workqueue_struct *wq; | 448 | struct workqueue_struct *wq; |
449 | struct workqueue_struct *ud_wq; | 449 | struct workqueue_struct *ud_wq; |
450 | spinlock_t ud_lock; | 450 | spinlock_t ud_lock; |
451 | __be64 subnet_prefix; | 451 | atomic64_t subnet_prefix; |
452 | __be64 guid_cache[128]; | 452 | __be64 guid_cache[128]; |
453 | struct mlx4_ib_dev *dev; | 453 | struct mlx4_ib_dev *dev; |
454 | /* the following lock protects both mcg_table and mcg_mgid0_list */ | 454 | /* the following lock protects both mcg_table and mcg_mgid0_list */ |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 768085f59566..7fb9629bd12b 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -2493,24 +2493,27 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_ud_wr *wr, | |||
2493 | sqp->ud_header.grh.flow_label = | 2493 | sqp->ud_header.grh.flow_label = |
2494 | ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); | 2494 | ah->av.ib.sl_tclass_flowlabel & cpu_to_be32(0xfffff); |
2495 | sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; | 2495 | sqp->ud_header.grh.hop_limit = ah->av.ib.hop_limit; |
2496 | if (is_eth) | 2496 | if (is_eth) { |
2497 | memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); | 2497 | memcpy(sqp->ud_header.grh.source_gid.raw, sgid.raw, 16); |
2498 | else { | 2498 | } else { |
2499 | if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { | 2499 | if (mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { |
2500 | /* When multi-function is enabled, the ib_core gid | 2500 | /* When multi-function is enabled, the ib_core gid |
2501 | * indexes don't necessarily match the hw ones, so | 2501 | * indexes don't necessarily match the hw ones, so |
2502 | * we must use our own cache */ | 2502 | * we must use our own cache |
2503 | sqp->ud_header.grh.source_gid.global.subnet_prefix = | 2503 | */ |
2504 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. | 2504 | sqp->ud_header.grh.source_gid.global.subnet_prefix = |
2505 | subnet_prefix; | 2505 | cpu_to_be64(atomic64_read(&(to_mdev(ib_dev)->sriov. |
2506 | sqp->ud_header.grh.source_gid.global.interface_id = | 2506 | demux[sqp->qp.port - 1]. |
2507 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. | 2507 | subnet_prefix))); |
2508 | guid_cache[ah->av.ib.gid_index]; | 2508 | sqp->ud_header.grh.source_gid.global.interface_id = |
2509 | } else | 2509 | to_mdev(ib_dev)->sriov.demux[sqp->qp.port - 1]. |
2510 | ib_get_cached_gid(ib_dev, | 2510 | guid_cache[ah->av.ib.gid_index]; |
2511 | be32_to_cpu(ah->av.ib.port_pd) >> 24, | 2511 | } else { |
2512 | ah->av.ib.gid_index, | 2512 | ib_get_cached_gid(ib_dev, |
2513 | &sqp->ud_header.grh.source_gid, NULL); | 2513 | be32_to_cpu(ah->av.ib.port_pd) >> 24, |
2514 | ah->av.ib.gid_index, | ||
2515 | &sqp->ud_header.grh.source_gid, NULL); | ||
2516 | } | ||
2514 | } | 2517 | } |
2515 | memcpy(sqp->ud_header.grh.destination_gid.raw, | 2518 | memcpy(sqp->ud_header.grh.destination_gid.raw, |
2516 | ah->av.ib.dgid, 16); | 2519 | ah->av.ib.dgid, 16); |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 8150ea372c53..e19537cf44ab 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -288,7 +288,9 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num, | |||
288 | 288 | ||
289 | static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) | 289 | static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev) |
290 | { | 290 | { |
291 | return !MLX5_CAP_GEN(dev->mdev, ib_virt); | 291 | if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB) |
292 | return !MLX5_CAP_GEN(dev->mdev, ib_virt); | ||
293 | return 0; | ||
292 | } | 294 | } |
293 | 295 | ||
294 | enum { | 296 | enum { |
@@ -1428,6 +1430,13 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v, | |||
1428 | dmac_47_16), | 1430 | dmac_47_16), |
1429 | ib_spec->eth.val.dst_mac); | 1431 | ib_spec->eth.val.dst_mac); |
1430 | 1432 | ||
1433 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_c, | ||
1434 | smac_47_16), | ||
1435 | ib_spec->eth.mask.src_mac); | ||
1436 | ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, outer_headers_v, | ||
1437 | smac_47_16), | ||
1438 | ib_spec->eth.val.src_mac); | ||
1439 | |||
1431 | if (ib_spec->eth.mask.vlan_tag) { | 1440 | if (ib_spec->eth.mask.vlan_tag) { |
1432 | MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c, | 1441 | MLX5_SET(fte_match_set_lyr_2_4, outer_headers_c, |
1433 | vlan_tag, 1); | 1442 | vlan_tag, 1); |
diff --git a/drivers/infiniband/sw/rdmavt/mr.c b/drivers/infiniband/sw/rdmavt/mr.c index 80c4b6b401b8..46b64970058e 100644 --- a/drivers/infiniband/sw/rdmavt/mr.c +++ b/drivers/infiniband/sw/rdmavt/mr.c | |||
@@ -294,7 +294,7 @@ static void __rvt_free_mr(struct rvt_mr *mr) | |||
294 | { | 294 | { |
295 | rvt_deinit_mregion(&mr->mr); | 295 | rvt_deinit_mregion(&mr->mr); |
296 | rvt_free_lkey(&mr->mr); | 296 | rvt_free_lkey(&mr->mr); |
297 | vfree(mr); | 297 | kfree(mr); |
298 | } | 298 | } |
299 | 299 | ||
300 | /** | 300 | /** |
diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c index 55f0e8f0ca79..ddd59270ff6d 100644 --- a/drivers/infiniband/sw/rxe/rxe.c +++ b/drivers/infiniband/sw/rxe/rxe.c | |||
@@ -362,15 +362,34 @@ static int __init rxe_module_init(void) | |||
362 | return err; | 362 | return err; |
363 | } | 363 | } |
364 | 364 | ||
365 | err = rxe_net_init(); | 365 | err = rxe_net_ipv4_init(); |
366 | if (err) { | 366 | if (err) { |
367 | pr_err("rxe: unable to init\n"); | 367 | pr_err("rxe: unable to init ipv4 tunnel\n"); |
368 | rxe_cache_exit(); | 368 | rxe_cache_exit(); |
369 | return err; | 369 | goto exit; |
370 | } | ||
371 | |||
372 | err = rxe_net_ipv6_init(); | ||
373 | if (err) { | ||
374 | pr_err("rxe: unable to init ipv6 tunnel\n"); | ||
375 | rxe_cache_exit(); | ||
376 | goto exit; | ||
370 | } | 377 | } |
378 | |||
379 | err = register_netdevice_notifier(&rxe_net_notifier); | ||
380 | if (err) { | ||
381 | pr_err("rxe: Failed to rigister netdev notifier\n"); | ||
382 | goto exit; | ||
383 | } | ||
384 | |||
371 | pr_info("rxe: loaded\n"); | 385 | pr_info("rxe: loaded\n"); |
372 | 386 | ||
373 | return 0; | 387 | return 0; |
388 | |||
389 | exit: | ||
390 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
391 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
392 | return err; | ||
374 | } | 393 | } |
375 | 394 | ||
376 | static void __exit rxe_module_exit(void) | 395 | static void __exit rxe_module_exit(void) |
diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index 36f67de44095..1c59ef2c67aa 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c | |||
@@ -689,7 +689,14 @@ int rxe_completer(void *arg) | |||
689 | qp->req.need_retry = 1; | 689 | qp->req.need_retry = 1; |
690 | rxe_run_task(&qp->req.task, 1); | 690 | rxe_run_task(&qp->req.task, 1); |
691 | } | 691 | } |
692 | |||
693 | if (pkt) { | ||
694 | rxe_drop_ref(pkt->qp); | ||
695 | kfree_skb(skb); | ||
696 | } | ||
697 | |||
692 | goto exit; | 698 | goto exit; |
699 | |||
693 | } else { | 700 | } else { |
694 | wqe->status = IB_WC_RETRY_EXC_ERR; | 701 | wqe->status = IB_WC_RETRY_EXC_ERR; |
695 | state = COMPST_ERROR; | 702 | state = COMPST_ERROR; |
@@ -716,6 +723,12 @@ int rxe_completer(void *arg) | |||
716 | case COMPST_ERROR: | 723 | case COMPST_ERROR: |
717 | do_complete(qp, wqe); | 724 | do_complete(qp, wqe); |
718 | rxe_qp_error(qp); | 725 | rxe_qp_error(qp); |
726 | |||
727 | if (pkt) { | ||
728 | rxe_drop_ref(pkt->qp); | ||
729 | kfree_skb(skb); | ||
730 | } | ||
731 | |||
719 | goto exit; | 732 | goto exit; |
720 | } | 733 | } |
721 | } | 734 | } |
diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c index 0b8d2ea8b41d..eedf2f1cafdf 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.c +++ b/drivers/infiniband/sw/rxe/rxe_net.c | |||
@@ -275,9 +275,10 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port, | |||
275 | return sock; | 275 | return sock; |
276 | } | 276 | } |
277 | 277 | ||
278 | static void rxe_release_udp_tunnel(struct socket *sk) | 278 | void rxe_release_udp_tunnel(struct socket *sk) |
279 | { | 279 | { |
280 | udp_tunnel_sock_release(sk); | 280 | if (sk) |
281 | udp_tunnel_sock_release(sk); | ||
281 | } | 282 | } |
282 | 283 | ||
283 | static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, | 284 | static void prepare_udp_hdr(struct sk_buff *skb, __be16 src_port, |
@@ -658,51 +659,45 @@ out: | |||
658 | return NOTIFY_OK; | 659 | return NOTIFY_OK; |
659 | } | 660 | } |
660 | 661 | ||
661 | static struct notifier_block rxe_net_notifier = { | 662 | struct notifier_block rxe_net_notifier = { |
662 | .notifier_call = rxe_notify, | 663 | .notifier_call = rxe_notify, |
663 | }; | 664 | }; |
664 | 665 | ||
665 | int rxe_net_init(void) | 666 | int rxe_net_ipv4_init(void) |
666 | { | 667 | { |
667 | int err; | ||
668 | |||
669 | spin_lock_init(&dev_list_lock); | 668 | spin_lock_init(&dev_list_lock); |
670 | 669 | ||
671 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, | ||
672 | htons(ROCE_V2_UDP_DPORT), true); | ||
673 | if (IS_ERR(recv_sockets.sk6)) { | ||
674 | recv_sockets.sk6 = NULL; | ||
675 | pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); | ||
676 | return -1; | ||
677 | } | ||
678 | |||
679 | recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, | 670 | recv_sockets.sk4 = rxe_setup_udp_tunnel(&init_net, |
680 | htons(ROCE_V2_UDP_DPORT), false); | 671 | htons(ROCE_V2_UDP_DPORT), false); |
681 | if (IS_ERR(recv_sockets.sk4)) { | 672 | if (IS_ERR(recv_sockets.sk4)) { |
682 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
683 | recv_sockets.sk4 = NULL; | 673 | recv_sockets.sk4 = NULL; |
684 | recv_sockets.sk6 = NULL; | ||
685 | pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); | 674 | pr_err("rxe: Failed to create IPv4 UDP tunnel\n"); |
686 | return -1; | 675 | return -1; |
687 | } | 676 | } |
688 | 677 | ||
689 | err = register_netdevice_notifier(&rxe_net_notifier); | 678 | return 0; |
690 | if (err) { | ||
691 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
692 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
693 | pr_err("rxe: Failed to rigister netdev notifier\n"); | ||
694 | } | ||
695 | |||
696 | return err; | ||
697 | } | 679 | } |
698 | 680 | ||
699 | void rxe_net_exit(void) | 681 | int rxe_net_ipv6_init(void) |
700 | { | 682 | { |
701 | if (recv_sockets.sk6) | 683 | #if IS_ENABLED(CONFIG_IPV6) |
702 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
703 | 684 | ||
704 | if (recv_sockets.sk4) | 685 | spin_lock_init(&dev_list_lock); |
705 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
706 | 686 | ||
687 | recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net, | ||
688 | htons(ROCE_V2_UDP_DPORT), true); | ||
689 | if (IS_ERR(recv_sockets.sk6)) { | ||
690 | recv_sockets.sk6 = NULL; | ||
691 | pr_err("rxe: Failed to create IPv6 UDP tunnel\n"); | ||
692 | return -1; | ||
693 | } | ||
694 | #endif | ||
695 | return 0; | ||
696 | } | ||
697 | |||
698 | void rxe_net_exit(void) | ||
699 | { | ||
700 | rxe_release_udp_tunnel(recv_sockets.sk6); | ||
701 | rxe_release_udp_tunnel(recv_sockets.sk4); | ||
707 | unregister_netdevice_notifier(&rxe_net_notifier); | 702 | unregister_netdevice_notifier(&rxe_net_notifier); |
708 | } | 703 | } |
diff --git a/drivers/infiniband/sw/rxe/rxe_net.h b/drivers/infiniband/sw/rxe/rxe_net.h index 7b06f76d16cc..0daf7f09e5b5 100644 --- a/drivers/infiniband/sw/rxe/rxe_net.h +++ b/drivers/infiniband/sw/rxe/rxe_net.h | |||
@@ -44,10 +44,13 @@ struct rxe_recv_sockets { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern struct rxe_recv_sockets recv_sockets; | 46 | extern struct rxe_recv_sockets recv_sockets; |
47 | extern struct notifier_block rxe_net_notifier; | ||
48 | void rxe_release_udp_tunnel(struct socket *sk); | ||
47 | 49 | ||
48 | struct rxe_dev *rxe_net_add(struct net_device *ndev); | 50 | struct rxe_dev *rxe_net_add(struct net_device *ndev); |
49 | 51 | ||
50 | int rxe_net_init(void); | 52 | int rxe_net_ipv4_init(void); |
53 | int rxe_net_ipv6_init(void); | ||
51 | void rxe_net_exit(void); | 54 | void rxe_net_exit(void); |
52 | 55 | ||
53 | #endif /* RXE_NET_H */ | 56 | #endif /* RXE_NET_H */ |
diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c index 3d464c23e08b..144d2f129fcd 100644 --- a/drivers/infiniband/sw/rxe/rxe_recv.c +++ b/drivers/infiniband/sw/rxe/rxe_recv.c | |||
@@ -312,7 +312,7 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb) | |||
312 | * make a copy of the skb to post to the next qp | 312 | * make a copy of the skb to post to the next qp |
313 | */ | 313 | */ |
314 | skb_copy = (mce->qp_list.next != &mcg->qp_list) ? | 314 | skb_copy = (mce->qp_list.next != &mcg->qp_list) ? |
315 | skb_clone(skb, GFP_KERNEL) : NULL; | 315 | skb_clone(skb, GFP_ATOMIC) : NULL; |
316 | 316 | ||
317 | pkt->qp = qp; | 317 | pkt->qp = qp; |
318 | rxe_add_ref(qp); | 318 | rxe_add_ref(qp); |
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 33b2d9d77021..13a848a518e8 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c | |||
@@ -511,24 +511,21 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | |||
511 | } | 511 | } |
512 | 512 | ||
513 | static void update_wqe_state(struct rxe_qp *qp, | 513 | static void update_wqe_state(struct rxe_qp *qp, |
514 | struct rxe_send_wqe *wqe, | 514 | struct rxe_send_wqe *wqe, |
515 | struct rxe_pkt_info *pkt, | 515 | struct rxe_pkt_info *pkt) |
516 | enum wqe_state *prev_state) | ||
517 | { | 516 | { |
518 | enum wqe_state prev_state_ = wqe->state; | ||
519 | |||
520 | if (pkt->mask & RXE_END_MASK) { | 517 | if (pkt->mask & RXE_END_MASK) { |
521 | if (qp_type(qp) == IB_QPT_RC) | 518 | if (qp_type(qp) == IB_QPT_RC) |
522 | wqe->state = wqe_state_pending; | 519 | wqe->state = wqe_state_pending; |
523 | } else { | 520 | } else { |
524 | wqe->state = wqe_state_processing; | 521 | wqe->state = wqe_state_processing; |
525 | } | 522 | } |
526 | |||
527 | *prev_state = prev_state_; | ||
528 | } | 523 | } |
529 | 524 | ||
530 | static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | 525 | static void update_wqe_psn(struct rxe_qp *qp, |
531 | struct rxe_pkt_info *pkt, int payload) | 526 | struct rxe_send_wqe *wqe, |
527 | struct rxe_pkt_info *pkt, | ||
528 | int payload) | ||
532 | { | 529 | { |
533 | /* number of packets left to send including current one */ | 530 | /* number of packets left to send including current one */ |
534 | int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; | 531 | int num_pkt = (wqe->dma.resid + payload + qp->mtu - 1) / qp->mtu; |
@@ -546,9 +543,34 @@ static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | |||
546 | qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; | 543 | qp->req.psn = (wqe->first_psn + num_pkt) & BTH_PSN_MASK; |
547 | else | 544 | else |
548 | qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; | 545 | qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK; |
546 | } | ||
549 | 547 | ||
550 | qp->req.opcode = pkt->opcode; | 548 | static void save_state(struct rxe_send_wqe *wqe, |
549 | struct rxe_qp *qp, | ||
550 | struct rxe_send_wqe *rollback_wqe, | ||
551 | struct rxe_qp *rollback_qp) | ||
552 | { | ||
553 | rollback_wqe->state = wqe->state; | ||
554 | rollback_wqe->first_psn = wqe->first_psn; | ||
555 | rollback_wqe->last_psn = wqe->last_psn; | ||
556 | rollback_qp->req.psn = qp->req.psn; | ||
557 | } | ||
551 | 558 | ||
559 | static void rollback_state(struct rxe_send_wqe *wqe, | ||
560 | struct rxe_qp *qp, | ||
561 | struct rxe_send_wqe *rollback_wqe, | ||
562 | struct rxe_qp *rollback_qp) | ||
563 | { | ||
564 | wqe->state = rollback_wqe->state; | ||
565 | wqe->first_psn = rollback_wqe->first_psn; | ||
566 | wqe->last_psn = rollback_wqe->last_psn; | ||
567 | qp->req.psn = rollback_qp->req.psn; | ||
568 | } | ||
569 | |||
570 | static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe, | ||
571 | struct rxe_pkt_info *pkt, int payload) | ||
572 | { | ||
573 | qp->req.opcode = pkt->opcode; | ||
552 | 574 | ||
553 | if (pkt->mask & RXE_END_MASK) | 575 | if (pkt->mask & RXE_END_MASK) |
554 | qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); | 576 | qp->req.wqe_index = next_index(qp->sq.queue, qp->req.wqe_index); |
@@ -571,7 +593,8 @@ int rxe_requester(void *arg) | |||
571 | int mtu; | 593 | int mtu; |
572 | int opcode; | 594 | int opcode; |
573 | int ret; | 595 | int ret; |
574 | enum wqe_state prev_state; | 596 | struct rxe_qp rollback_qp; |
597 | struct rxe_send_wqe rollback_wqe; | ||
575 | 598 | ||
576 | next_wqe: | 599 | next_wqe: |
577 | if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) | 600 | if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) |
@@ -688,13 +711,21 @@ next_wqe: | |||
688 | goto err; | 711 | goto err; |
689 | } | 712 | } |
690 | 713 | ||
691 | update_wqe_state(qp, wqe, &pkt, &prev_state); | 714 | /* |
715 | * To prevent a race on wqe access between requester and completer, | ||
716 | * wqe members state and psn need to be set before calling | ||
717 | * rxe_xmit_packet(). | ||
718 | * Otherwise, completer might initiate an unjustified retry flow. | ||
719 | */ | ||
720 | save_state(wqe, qp, &rollback_wqe, &rollback_qp); | ||
721 | update_wqe_state(qp, wqe, &pkt); | ||
722 | update_wqe_psn(qp, wqe, &pkt, payload); | ||
692 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); | 723 | ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb); |
693 | if (ret) { | 724 | if (ret) { |
694 | qp->need_req_skb = 1; | 725 | qp->need_req_skb = 1; |
695 | kfree_skb(skb); | 726 | kfree_skb(skb); |
696 | 727 | ||
697 | wqe->state = prev_state; | 728 | rollback_state(wqe, qp, &rollback_wqe, &rollback_qp); |
698 | 729 | ||
699 | if (ret == -EAGAIN) { | 730 | if (ret == -EAGAIN) { |
700 | rxe_run_task(&qp->req.task, 1); | 731 | rxe_run_task(&qp->req.task, 1); |
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index ebb03b46e2ad..3e0f0f2baace 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c | |||
@@ -972,11 +972,13 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt, | |||
972 | free_rd_atomic_resource(qp, res); | 972 | free_rd_atomic_resource(qp, res); |
973 | rxe_advance_resp_resource(qp); | 973 | rxe_advance_resp_resource(qp); |
974 | 974 | ||
975 | memcpy(SKB_TO_PKT(skb), &ack_pkt, sizeof(skb->cb)); | ||
976 | |||
975 | res->type = RXE_ATOMIC_MASK; | 977 | res->type = RXE_ATOMIC_MASK; |
976 | res->atomic.skb = skb; | 978 | res->atomic.skb = skb; |
977 | res->first_psn = qp->resp.psn; | 979 | res->first_psn = ack_pkt.psn; |
978 | res->last_psn = qp->resp.psn; | 980 | res->last_psn = ack_pkt.psn; |
979 | res->cur_psn = qp->resp.psn; | 981 | res->cur_psn = ack_pkt.psn; |
980 | 982 | ||
981 | rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); | 983 | rc = rxe_xmit_packet(rxe, qp, &ack_pkt, skb_copy); |
982 | if (rc) { | 984 | if (rc) { |
@@ -1116,8 +1118,7 @@ static enum resp_states duplicate_request(struct rxe_qp *qp, | |||
1116 | rc = RESPST_CLEANUP; | 1118 | rc = RESPST_CLEANUP; |
1117 | goto out; | 1119 | goto out; |
1118 | } | 1120 | } |
1119 | bth_set_psn(SKB_TO_PKT(skb_copy), | 1121 | |
1120 | qp->resp.psn - 1); | ||
1121 | /* Resend the result. */ | 1122 | /* Resend the result. */ |
1122 | rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, | 1123 | rc = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, |
1123 | pkt, skb_copy); | 1124 | pkt, skb_copy); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index dc6d241b9406..be11d5d5b8c1 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -1161,8 +1161,17 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | if (level == IPOIB_FLUSH_LIGHT) { | 1163 | if (level == IPOIB_FLUSH_LIGHT) { |
1164 | int oper_up; | ||
1164 | ipoib_mark_paths_invalid(dev); | 1165 | ipoib_mark_paths_invalid(dev); |
1166 | /* Set IPoIB operation as down to prevent races between: | ||
1167 | * the flush flow which leaves MCG and on the fly joins | ||
1168 | * which can happen during that time. mcast restart task | ||
1169 | * should deal with join requests we missed. | ||
1170 | */ | ||
1171 | oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | ||
1165 | ipoib_mcast_dev_flush(dev); | 1172 | ipoib_mcast_dev_flush(dev); |
1173 | if (oper_up) | ||
1174 | set_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | ||
1166 | ipoib_flush_ah(dev); | 1175 | ipoib_flush_ah(dev); |
1167 | } | 1176 | } |
1168 | 1177 | ||
diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index b2744a64e933..f502c8488be8 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c | |||
@@ -390,9 +390,10 @@ static void silead_ts_read_props(struct i2c_client *client) | |||
390 | data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ | 390 | data->max_fingers = 5; /* Most devices handle up-to 5 fingers */ |
391 | } | 391 | } |
392 | 392 | ||
393 | error = device_property_read_string(dev, "touchscreen-fw-name", &str); | 393 | error = device_property_read_string(dev, "firmware-name", &str); |
394 | if (!error) | 394 | if (!error) |
395 | snprintf(data->fw_name, sizeof(data->fw_name), "%s", str); | 395 | snprintf(data->fw_name, sizeof(data->fw_name), |
396 | "silead/%s", str); | ||
396 | else | 397 | else |
397 | dev_dbg(dev, "Firmware file name read error. Using default."); | 398 | dev_dbg(dev, "Firmware file name read error. Using default."); |
398 | } | 399 | } |
@@ -410,14 +411,14 @@ static int silead_ts_set_default_fw_name(struct silead_ts_data *data, | |||
410 | if (!acpi_id) | 411 | if (!acpi_id) |
411 | return -ENODEV; | 412 | return -ENODEV; |
412 | 413 | ||
413 | snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", | 414 | snprintf(data->fw_name, sizeof(data->fw_name), |
414 | acpi_id->id); | 415 | "silead/%s.fw", acpi_id->id); |
415 | 416 | ||
416 | for (i = 0; i < strlen(data->fw_name); i++) | 417 | for (i = 0; i < strlen(data->fw_name); i++) |
417 | data->fw_name[i] = tolower(data->fw_name[i]); | 418 | data->fw_name[i] = tolower(data->fw_name[i]); |
418 | } else { | 419 | } else { |
419 | snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", | 420 | snprintf(data->fw_name, sizeof(data->fw_name), |
420 | id->name); | 421 | "silead/%s.fw", id->name); |
421 | } | 422 | } |
422 | 423 | ||
423 | return 0; | 424 | return 0; |
@@ -426,7 +427,8 @@ static int silead_ts_set_default_fw_name(struct silead_ts_data *data, | |||
426 | static int silead_ts_set_default_fw_name(struct silead_ts_data *data, | 427 | static int silead_ts_set_default_fw_name(struct silead_ts_data *data, |
427 | const struct i2c_device_id *id) | 428 | const struct i2c_device_id *id) |
428 | { | 429 | { |
429 | snprintf(data->fw_name, sizeof(data->fw_name), "%s.fw", id->name); | 430 | snprintf(data->fw_name, sizeof(data->fw_name), |
431 | "silead/%s.fw", id->name); | ||
430 | return 0; | 432 | return 0; |
431 | } | 433 | } |
432 | #endif | 434 | #endif |
diff --git a/drivers/irqchip/irq-atmel-aic.c b/drivers/irqchip/irq-atmel-aic.c index 112e17c2768b..37f952dd9fc9 100644 --- a/drivers/irqchip/irq-atmel-aic.c +++ b/drivers/irqchip/irq-atmel-aic.c | |||
@@ -176,6 +176,7 @@ static int aic_irq_domain_xlate(struct irq_domain *d, | |||
176 | { | 176 | { |
177 | struct irq_domain_chip_generic *dgc = d->gc; | 177 | struct irq_domain_chip_generic *dgc = d->gc; |
178 | struct irq_chip_generic *gc; | 178 | struct irq_chip_generic *gc; |
179 | unsigned long flags; | ||
179 | unsigned smr; | 180 | unsigned smr; |
180 | int idx; | 181 | int idx; |
181 | int ret; | 182 | int ret; |
@@ -194,11 +195,11 @@ static int aic_irq_domain_xlate(struct irq_domain *d, | |||
194 | 195 | ||
195 | gc = dgc->gc[idx]; | 196 | gc = dgc->gc[idx]; |
196 | 197 | ||
197 | irq_gc_lock(gc); | 198 | irq_gc_lock_irqsave(gc, flags); |
198 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); | 199 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); |
199 | aic_common_set_priority(intspec[2], &smr); | 200 | aic_common_set_priority(intspec[2], &smr); |
200 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); | 201 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); |
201 | irq_gc_unlock(gc); | 202 | irq_gc_unlock_irqrestore(gc, flags); |
202 | 203 | ||
203 | return ret; | 204 | return ret; |
204 | } | 205 | } |
diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c index 4f0d068e1abe..2a624d87a035 100644 --- a/drivers/irqchip/irq-atmel-aic5.c +++ b/drivers/irqchip/irq-atmel-aic5.c | |||
@@ -258,6 +258,7 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, | |||
258 | unsigned int *out_type) | 258 | unsigned int *out_type) |
259 | { | 259 | { |
260 | struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); | 260 | struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0); |
261 | unsigned long flags; | ||
261 | unsigned smr; | 262 | unsigned smr; |
262 | int ret; | 263 | int ret; |
263 | 264 | ||
@@ -269,12 +270,12 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, | |||
269 | if (ret) | 270 | if (ret) |
270 | return ret; | 271 | return ret; |
271 | 272 | ||
272 | irq_gc_lock(bgc); | 273 | irq_gc_lock_irqsave(bgc, flags); |
273 | irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); | 274 | irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR); |
274 | smr = irq_reg_readl(bgc, AT91_AIC5_SMR); | 275 | smr = irq_reg_readl(bgc, AT91_AIC5_SMR); |
275 | aic_common_set_priority(intspec[2], &smr); | 276 | aic_common_set_priority(intspec[2], &smr); |
276 | irq_reg_writel(bgc, smr, AT91_AIC5_SMR); | 277 | irq_reg_writel(bgc, smr, AT91_AIC5_SMR); |
277 | irq_gc_unlock(bgc); | 278 | irq_gc_unlock_irqrestore(bgc, flags); |
278 | 279 | ||
279 | return ret; | 280 | return ret; |
280 | } | 281 | } |
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index ede5672ab34d..da6c0ba61d4f 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c | |||
@@ -548,7 +548,7 @@ static int gic_starting_cpu(unsigned int cpu) | |||
548 | static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask, | 548 | static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask, |
549 | unsigned long cluster_id) | 549 | unsigned long cluster_id) |
550 | { | 550 | { |
551 | int cpu = *base_cpu; | 551 | int next_cpu, cpu = *base_cpu; |
552 | unsigned long mpidr = cpu_logical_map(cpu); | 552 | unsigned long mpidr = cpu_logical_map(cpu); |
553 | u16 tlist = 0; | 553 | u16 tlist = 0; |
554 | 554 | ||
@@ -562,9 +562,10 @@ static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask, | |||
562 | 562 | ||
563 | tlist |= 1 << (mpidr & 0xf); | 563 | tlist |= 1 << (mpidr & 0xf); |
564 | 564 | ||
565 | cpu = cpumask_next(cpu, mask); | 565 | next_cpu = cpumask_next(cpu, mask); |
566 | if (cpu >= nr_cpu_ids) | 566 | if (next_cpu >= nr_cpu_ids) |
567 | goto out; | 567 | goto out; |
568 | cpu = next_cpu; | ||
568 | 569 | ||
569 | mpidr = cpu_logical_map(cpu); | 570 | mpidr = cpu_logical_map(cpu); |
570 | 571 | ||
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index 83f498393a7f..6185696405d5 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c | |||
@@ -638,27 +638,6 @@ static int gic_local_irq_domain_map(struct irq_domain *d, unsigned int virq, | |||
638 | if (!gic_local_irq_is_routable(intr)) | 638 | if (!gic_local_irq_is_routable(intr)) |
639 | return -EPERM; | 639 | return -EPERM; |
640 | 640 | ||
641 | /* | ||
642 | * HACK: These are all really percpu interrupts, but the rest | ||
643 | * of the MIPS kernel code does not use the percpu IRQ API for | ||
644 | * the CP0 timer and performance counter interrupts. | ||
645 | */ | ||
646 | switch (intr) { | ||
647 | case GIC_LOCAL_INT_TIMER: | ||
648 | case GIC_LOCAL_INT_PERFCTR: | ||
649 | case GIC_LOCAL_INT_FDC: | ||
650 | irq_set_chip_and_handler(virq, | ||
651 | &gic_all_vpes_local_irq_controller, | ||
652 | handle_percpu_irq); | ||
653 | break; | ||
654 | default: | ||
655 | irq_set_chip_and_handler(virq, | ||
656 | &gic_local_irq_controller, | ||
657 | handle_percpu_devid_irq); | ||
658 | irq_set_percpu_devid(virq); | ||
659 | break; | ||
660 | } | ||
661 | |||
662 | spin_lock_irqsave(&gic_lock, flags); | 641 | spin_lock_irqsave(&gic_lock, flags); |
663 | for (i = 0; i < gic_vpes; i++) { | 642 | for (i = 0; i < gic_vpes; i++) { |
664 | u32 val = GIC_MAP_TO_PIN_MSK | gic_cpu_pin; | 643 | u32 val = GIC_MAP_TO_PIN_MSK | gic_cpu_pin; |
@@ -724,16 +703,42 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, | |||
724 | return 0; | 703 | return 0; |
725 | } | 704 | } |
726 | 705 | ||
727 | static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq, | 706 | static int gic_setup_dev_chip(struct irq_domain *d, unsigned int virq, |
728 | irq_hw_number_t hw) | 707 | unsigned int hwirq) |
729 | { | 708 | { |
730 | if (GIC_HWIRQ_TO_LOCAL(hw) < GIC_NUM_LOCAL_INTRS) | 709 | struct irq_chip *chip; |
731 | return gic_local_irq_domain_map(d, virq, hw); | 710 | int err; |
711 | |||
712 | if (hwirq >= GIC_SHARED_HWIRQ_BASE) { | ||
713 | err = irq_domain_set_hwirq_and_chip(d, virq, hwirq, | ||
714 | &gic_level_irq_controller, | ||
715 | NULL); | ||
716 | } else { | ||
717 | switch (GIC_HWIRQ_TO_LOCAL(hwirq)) { | ||
718 | case GIC_LOCAL_INT_TIMER: | ||
719 | case GIC_LOCAL_INT_PERFCTR: | ||
720 | case GIC_LOCAL_INT_FDC: | ||
721 | /* | ||
722 | * HACK: These are all really percpu interrupts, but | ||
723 | * the rest of the MIPS kernel code does not use the | ||
724 | * percpu IRQ API for them. | ||
725 | */ | ||
726 | chip = &gic_all_vpes_local_irq_controller; | ||
727 | irq_set_handler(virq, handle_percpu_irq); | ||
728 | break; | ||
729 | |||
730 | default: | ||
731 | chip = &gic_local_irq_controller; | ||
732 | irq_set_handler(virq, handle_percpu_devid_irq); | ||
733 | irq_set_percpu_devid(virq); | ||
734 | break; | ||
735 | } | ||
732 | 736 | ||
733 | irq_set_chip_and_handler(virq, &gic_level_irq_controller, | 737 | err = irq_domain_set_hwirq_and_chip(d, virq, hwirq, |
734 | handle_level_irq); | 738 | chip, NULL); |
739 | } | ||
735 | 740 | ||
736 | return gic_shared_irq_domain_map(d, virq, hw, 0); | 741 | return err; |
737 | } | 742 | } |
738 | 743 | ||
739 | static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, | 744 | static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, |
@@ -744,15 +749,12 @@ static int gic_irq_domain_alloc(struct irq_domain *d, unsigned int virq, | |||
744 | int cpu, ret, i; | 749 | int cpu, ret, i; |
745 | 750 | ||
746 | if (spec->type == GIC_DEVICE) { | 751 | if (spec->type == GIC_DEVICE) { |
747 | /* verify that it doesn't conflict with an IPI irq */ | 752 | /* verify that shared irqs don't conflict with an IPI irq */ |
748 | if (test_bit(spec->hwirq, ipi_resrv)) | 753 | if ((spec->hwirq >= GIC_SHARED_HWIRQ_BASE) && |
754 | test_bit(GIC_HWIRQ_TO_SHARED(spec->hwirq), ipi_resrv)) | ||
749 | return -EBUSY; | 755 | return -EBUSY; |
750 | 756 | ||
751 | hwirq = GIC_SHARED_TO_HWIRQ(spec->hwirq); | 757 | return gic_setup_dev_chip(d, virq, spec->hwirq); |
752 | |||
753 | return irq_domain_set_hwirq_and_chip(d, virq, hwirq, | ||
754 | &gic_level_irq_controller, | ||
755 | NULL); | ||
756 | } else { | 758 | } else { |
757 | base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs); | 759 | base_hwirq = find_first_bit(ipi_resrv, gic_shared_intrs); |
758 | if (base_hwirq == gic_shared_intrs) { | 760 | if (base_hwirq == gic_shared_intrs) { |
@@ -821,7 +823,6 @@ int gic_irq_domain_match(struct irq_domain *d, struct device_node *node, | |||
821 | } | 823 | } |
822 | 824 | ||
823 | static const struct irq_domain_ops gic_irq_domain_ops = { | 825 | static const struct irq_domain_ops gic_irq_domain_ops = { |
824 | .map = gic_irq_domain_map, | ||
825 | .alloc = gic_irq_domain_alloc, | 826 | .alloc = gic_irq_domain_alloc, |
826 | .free = gic_irq_domain_free, | 827 | .free = gic_irq_domain_free, |
827 | .match = gic_irq_domain_match, | 828 | .match = gic_irq_domain_match, |
@@ -852,29 +853,20 @@ static int gic_dev_domain_alloc(struct irq_domain *d, unsigned int virq, | |||
852 | struct irq_fwspec *fwspec = arg; | 853 | struct irq_fwspec *fwspec = arg; |
853 | struct gic_irq_spec spec = { | 854 | struct gic_irq_spec spec = { |
854 | .type = GIC_DEVICE, | 855 | .type = GIC_DEVICE, |
855 | .hwirq = fwspec->param[1], | ||
856 | }; | 856 | }; |
857 | int i, ret; | 857 | int i, ret; |
858 | bool is_shared = fwspec->param[0] == GIC_SHARED; | ||
859 | 858 | ||
860 | if (is_shared) { | 859 | if (fwspec->param[0] == GIC_SHARED) |
861 | ret = irq_domain_alloc_irqs_parent(d, virq, nr_irqs, &spec); | 860 | spec.hwirq = GIC_SHARED_TO_HWIRQ(fwspec->param[1]); |
862 | if (ret) | 861 | else |
863 | return ret; | 862 | spec.hwirq = GIC_LOCAL_TO_HWIRQ(fwspec->param[1]); |
864 | } | ||
865 | |||
866 | for (i = 0; i < nr_irqs; i++) { | ||
867 | irq_hw_number_t hwirq; | ||
868 | 863 | ||
869 | if (is_shared) | 864 | ret = irq_domain_alloc_irqs_parent(d, virq, nr_irqs, &spec); |
870 | hwirq = GIC_SHARED_TO_HWIRQ(spec.hwirq + i); | 865 | if (ret) |
871 | else | 866 | return ret; |
872 | hwirq = GIC_LOCAL_TO_HWIRQ(spec.hwirq + i); | ||
873 | 867 | ||
874 | ret = irq_domain_set_hwirq_and_chip(d, virq + i, | 868 | for (i = 0; i < nr_irqs; i++) { |
875 | hwirq, | 869 | ret = gic_setup_dev_chip(d, virq + i, spec.hwirq + i); |
876 | &gic_level_irq_controller, | ||
877 | NULL); | ||
878 | if (ret) | 870 | if (ret) |
879 | goto error; | 871 | goto error; |
880 | } | 872 | } |
@@ -896,7 +888,10 @@ void gic_dev_domain_free(struct irq_domain *d, unsigned int virq, | |||
896 | static void gic_dev_domain_activate(struct irq_domain *domain, | 888 | static void gic_dev_domain_activate(struct irq_domain *domain, |
897 | struct irq_data *d) | 889 | struct irq_data *d) |
898 | { | 890 | { |
899 | gic_shared_irq_domain_map(domain, d->irq, d->hwirq, 0); | 891 | if (GIC_HWIRQ_TO_LOCAL(d->hwirq) < GIC_NUM_LOCAL_INTRS) |
892 | gic_local_irq_domain_map(domain, d->irq, d->hwirq); | ||
893 | else | ||
894 | gic_shared_irq_domain_map(domain, d->irq, d->hwirq, 0); | ||
900 | } | 895 | } |
901 | 896 | ||
902 | static struct irq_domain_ops gic_dev_domain_ops = { | 897 | static struct irq_domain_ops gic_dev_domain_ops = { |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 67642bacd597..915e84d631a2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7610,16 +7610,12 @@ EXPORT_SYMBOL(unregister_md_cluster_operations); | |||
7610 | 7610 | ||
7611 | int md_setup_cluster(struct mddev *mddev, int nodes) | 7611 | int md_setup_cluster(struct mddev *mddev, int nodes) |
7612 | { | 7612 | { |
7613 | int err; | 7613 | if (!md_cluster_ops) |
7614 | 7614 | request_module("md-cluster"); | |
7615 | err = request_module("md-cluster"); | ||
7616 | if (err) { | ||
7617 | pr_err("md-cluster module not found.\n"); | ||
7618 | return -ENOENT; | ||
7619 | } | ||
7620 | |||
7621 | spin_lock(&pers_lock); | 7615 | spin_lock(&pers_lock); |
7616 | /* ensure module won't be unloaded */ | ||
7622 | if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { | 7617 | if (!md_cluster_ops || !try_module_get(md_cluster_mod)) { |
7618 | pr_err("can't find md-cluster module or get it's reference.\n"); | ||
7623 | spin_unlock(&pers_lock); | 7619 | spin_unlock(&pers_lock); |
7624 | return -ENOENT; | 7620 | return -ENOENT; |
7625 | } | 7621 | } |
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 51f76ddbe265..1b1ab4a1d132 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c | |||
@@ -96,7 +96,6 @@ struct r5l_log { | |||
96 | spinlock_t no_space_stripes_lock; | 96 | spinlock_t no_space_stripes_lock; |
97 | 97 | ||
98 | bool need_cache_flush; | 98 | bool need_cache_flush; |
99 | bool in_teardown; | ||
100 | }; | 99 | }; |
101 | 100 | ||
102 | /* | 101 | /* |
@@ -704,31 +703,22 @@ static void r5l_write_super_and_discard_space(struct r5l_log *log, | |||
704 | 703 | ||
705 | mddev = log->rdev->mddev; | 704 | mddev = log->rdev->mddev; |
706 | /* | 705 | /* |
707 | * This is to avoid a deadlock. r5l_quiesce holds reconfig_mutex and | 706 | * Discard could zero data, so before discard we must make sure |
708 | * wait for this thread to finish. This thread waits for | 707 | * superblock is updated to new log tail. Updating superblock (either |
709 | * MD_CHANGE_PENDING clear, which is supposed to be done in | 708 | * directly call md_update_sb() or depend on md thread) must hold |
710 | * md_check_recovery(). md_check_recovery() tries to get | 709 | * reconfig mutex. On the other hand, raid5_quiesce is called with |
711 | * reconfig_mutex. Since r5l_quiesce already holds the mutex, | 710 | * reconfig_mutex hold. The first step of raid5_quiesce() is waitting |
712 | * md_check_recovery() fails, so the PENDING never get cleared. The | 711 | * for all IO finish, hence waitting for reclaim thread, while reclaim |
713 | * in_teardown check workaround this issue. | 712 | * thread is calling this function and waitting for reconfig mutex. So |
713 | * there is a deadlock. We workaround this issue with a trylock. | ||
714 | * FIXME: we could miss discard if we can't take reconfig mutex | ||
714 | */ | 715 | */ |
715 | if (!log->in_teardown) { | 716 | set_mask_bits(&mddev->flags, 0, |
716 | set_mask_bits(&mddev->flags, 0, | 717 | BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); |
717 | BIT(MD_CHANGE_DEVS) | BIT(MD_CHANGE_PENDING)); | 718 | if (!mddev_trylock(mddev)) |
718 | md_wakeup_thread(mddev->thread); | 719 | return; |
719 | wait_event(mddev->sb_wait, | 720 | md_update_sb(mddev, 1); |
720 | !test_bit(MD_CHANGE_PENDING, &mddev->flags) || | 721 | mddev_unlock(mddev); |
721 | log->in_teardown); | ||
722 | /* | ||
723 | * r5l_quiesce could run after in_teardown check and hold | ||
724 | * mutex first. Superblock might get updated twice. | ||
725 | */ | ||
726 | if (log->in_teardown) | ||
727 | md_update_sb(mddev, 1); | ||
728 | } else { | ||
729 | WARN_ON(!mddev_is_locked(mddev)); | ||
730 | md_update_sb(mddev, 1); | ||
731 | } | ||
732 | 722 | ||
733 | /* discard IO error really doesn't matter, ignore it */ | 723 | /* discard IO error really doesn't matter, ignore it */ |
734 | if (log->last_checkpoint < end) { | 724 | if (log->last_checkpoint < end) { |
@@ -827,7 +817,6 @@ void r5l_quiesce(struct r5l_log *log, int state) | |||
827 | if (!log || state == 2) | 817 | if (!log || state == 2) |
828 | return; | 818 | return; |
829 | if (state == 0) { | 819 | if (state == 0) { |
830 | log->in_teardown = 0; | ||
831 | /* | 820 | /* |
832 | * This is a special case for hotadd. In suspend, the array has | 821 | * This is a special case for hotadd. In suspend, the array has |
833 | * no journal. In resume, journal is initialized as well as the | 822 | * no journal. In resume, journal is initialized as well as the |
@@ -838,11 +827,6 @@ void r5l_quiesce(struct r5l_log *log, int state) | |||
838 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, | 827 | log->reclaim_thread = md_register_thread(r5l_reclaim_thread, |
839 | log->rdev->mddev, "reclaim"); | 828 | log->rdev->mddev, "reclaim"); |
840 | } else if (state == 1) { | 829 | } else if (state == 1) { |
841 | /* | ||
842 | * at this point all stripes are finished, so io_unit is at | ||
843 | * least in STRIPE_END state | ||
844 | */ | ||
845 | log->in_teardown = 1; | ||
846 | /* make sure r5l_write_super_and_discard_space exits */ | 830 | /* make sure r5l_write_super_and_discard_space exits */ |
847 | mddev = log->rdev->mddev; | 831 | mddev = log->rdev->mddev; |
848 | wake_up(&mddev->sb_wait); | 832 | wake_up(&mddev->sb_wait); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index da583bb43c84..ee7fc3701700 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2423,10 +2423,10 @@ static void raid5_end_read_request(struct bio * bi) | |||
2423 | } | 2423 | } |
2424 | } | 2424 | } |
2425 | rdev_dec_pending(rdev, conf->mddev); | 2425 | rdev_dec_pending(rdev, conf->mddev); |
2426 | bio_reset(bi); | ||
2426 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 2427 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
2427 | set_bit(STRIPE_HANDLE, &sh->state); | 2428 | set_bit(STRIPE_HANDLE, &sh->state); |
2428 | raid5_release_stripe(sh); | 2429 | raid5_release_stripe(sh); |
2429 | bio_reset(bi); | ||
2430 | } | 2430 | } |
2431 | 2431 | ||
2432 | static void raid5_end_write_request(struct bio *bi) | 2432 | static void raid5_end_write_request(struct bio *bi) |
@@ -2498,6 +2498,7 @@ static void raid5_end_write_request(struct bio *bi) | |||
2498 | if (sh->batch_head && bi->bi_error && !replacement) | 2498 | if (sh->batch_head && bi->bi_error && !replacement) |
2499 | set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); | 2499 | set_bit(STRIPE_BATCH_ERR, &sh->batch_head->state); |
2500 | 2500 | ||
2501 | bio_reset(bi); | ||
2501 | if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) | 2502 | if (!test_and_clear_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags)) |
2502 | clear_bit(R5_LOCKED, &sh->dev[i].flags); | 2503 | clear_bit(R5_LOCKED, &sh->dev[i].flags); |
2503 | set_bit(STRIPE_HANDLE, &sh->state); | 2504 | set_bit(STRIPE_HANDLE, &sh->state); |
@@ -2505,7 +2506,6 @@ static void raid5_end_write_request(struct bio *bi) | |||
2505 | 2506 | ||
2506 | if (sh->batch_head && sh != sh->batch_head) | 2507 | if (sh->batch_head && sh != sh->batch_head) |
2507 | raid5_release_stripe(sh->batch_head); | 2508 | raid5_release_stripe(sh->batch_head); |
2508 | bio_reset(bi); | ||
2509 | } | 2509 | } |
2510 | 2510 | ||
2511 | static void raid5_build_block(struct stripe_head *sh, int i, int previous) | 2511 | static void raid5_build_block(struct stripe_head *sh, int i, int previous) |
@@ -6639,6 +6639,16 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
6639 | } | 6639 | } |
6640 | 6640 | ||
6641 | conf->min_nr_stripes = NR_STRIPES; | 6641 | conf->min_nr_stripes = NR_STRIPES; |
6642 | if (mddev->reshape_position != MaxSector) { | ||
6643 | int stripes = max_t(int, | ||
6644 | ((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4, | ||
6645 | ((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4); | ||
6646 | conf->min_nr_stripes = max(NR_STRIPES, stripes); | ||
6647 | if (conf->min_nr_stripes != NR_STRIPES) | ||
6648 | printk(KERN_INFO | ||
6649 | "md/raid:%s: force stripe size %d for reshape\n", | ||
6650 | mdname(mddev), conf->min_nr_stripes); | ||
6651 | } | ||
6642 | memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + | 6652 | memory = conf->min_nr_stripes * (sizeof(struct stripe_head) + |
6643 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; | 6653 | max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024; |
6644 | atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); | 6654 | atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS); |
diff --git a/drivers/media/cec-edid.c b/drivers/media/cec-edid.c index 70018247bdda..5719b991e340 100644 --- a/drivers/media/cec-edid.c +++ b/drivers/media/cec-edid.c | |||
@@ -70,7 +70,10 @@ static unsigned int cec_get_edid_spa_location(const u8 *edid, unsigned int size) | |||
70 | u8 tag = edid[i] >> 5; | 70 | u8 tag = edid[i] >> 5; |
71 | u8 len = edid[i] & 0x1f; | 71 | u8 len = edid[i] & 0x1f; |
72 | 72 | ||
73 | if (tag == 3 && len >= 5 && i + len <= end) | 73 | if (tag == 3 && len >= 5 && i + len <= end && |
74 | edid[i + 1] == 0x03 && | ||
75 | edid[i + 2] == 0x0c && | ||
76 | edid[i + 3] == 0x00) | ||
74 | return i + 4; | 77 | return i + 4; |
75 | i += len + 1; | 78 | i += len + 1; |
76 | } while (i < end); | 79 | } while (i < end); |
diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index efec2d1a7afd..4d080da7afaf 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c | |||
@@ -1552,6 +1552,7 @@ int cx23885_417_register(struct cx23885_dev *dev) | |||
1552 | q->mem_ops = &vb2_dma_sg_memops; | 1552 | q->mem_ops = &vb2_dma_sg_memops; |
1553 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1553 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1554 | q->lock = &dev->lock; | 1554 | q->lock = &dev->lock; |
1555 | q->dev = &dev->pci->dev; | ||
1555 | 1556 | ||
1556 | err = vb2_queue_init(q); | 1557 | err = vb2_queue_init(q); |
1557 | if (err < 0) | 1558 | if (err < 0) |
diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c b/drivers/media/pci/saa7134/saa7134-dvb.c index db987e5b93eb..59a4b5f7724e 100644 --- a/drivers/media/pci/saa7134/saa7134-dvb.c +++ b/drivers/media/pci/saa7134/saa7134-dvb.c | |||
@@ -1238,6 +1238,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1238 | q->buf_struct_size = sizeof(struct saa7134_buf); | 1238 | q->buf_struct_size = sizeof(struct saa7134_buf); |
1239 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1239 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1240 | q->lock = &dev->lock; | 1240 | q->lock = &dev->lock; |
1241 | q->dev = &dev->pci->dev; | ||
1241 | ret = vb2_queue_init(q); | 1242 | ret = vb2_queue_init(q); |
1242 | if (ret) { | 1243 | if (ret) { |
1243 | vb2_dvb_dealloc_frontends(&dev->frontends); | 1244 | vb2_dvb_dealloc_frontends(&dev->frontends); |
diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index ca417a454d67..791a5161809b 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c | |||
@@ -295,6 +295,7 @@ static int empress_init(struct saa7134_dev *dev) | |||
295 | q->buf_struct_size = sizeof(struct saa7134_buf); | 295 | q->buf_struct_size = sizeof(struct saa7134_buf); |
296 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 296 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
297 | q->lock = &dev->lock; | 297 | q->lock = &dev->lock; |
298 | q->dev = &dev->pci->dev; | ||
298 | err = vb2_queue_init(q); | 299 | err = vb2_queue_init(q); |
299 | if (err) | 300 | if (err) |
300 | return err; | 301 | return err; |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index f25344bc7912..552b635cfce7 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
@@ -169,7 +169,7 @@ config VIDEO_MEDIATEK_VPU | |||
169 | config VIDEO_MEDIATEK_VCODEC | 169 | config VIDEO_MEDIATEK_VCODEC |
170 | tristate "Mediatek Video Codec driver" | 170 | tristate "Mediatek Video Codec driver" |
171 | depends on MTK_IOMMU || COMPILE_TEST | 171 | depends on MTK_IOMMU || COMPILE_TEST |
172 | depends on VIDEO_DEV && VIDEO_V4L2 | 172 | depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA |
173 | depends on ARCH_MEDIATEK || COMPILE_TEST | 173 | depends on ARCH_MEDIATEK || COMPILE_TEST |
174 | select VIDEOBUF2_DMA_CONTIG | 174 | select VIDEOBUF2_DMA_CONTIG |
175 | select V4L2_MEM2MEM_DEV | 175 | select V4L2_MEM2MEM_DEV |
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index 94f0a425be42..3a8e6958adae 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <media/v4l2-ioctl.h> | 23 | #include <media/v4l2-ioctl.h> |
24 | #include <media/videobuf2-core.h> | 24 | #include <media/videobuf2-core.h> |
25 | 25 | ||
26 | #include "mtk_vcodec_util.h" | ||
27 | 26 | ||
28 | #define MTK_VCODEC_DRV_NAME "mtk_vcodec_drv" | 27 | #define MTK_VCODEC_DRV_NAME "mtk_vcodec_drv" |
29 | #define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" | 28 | #define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc" |
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 3ed3f2d31df5..2c5719ac23b2 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | |||
@@ -487,7 +487,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, | |||
487 | struct mtk_q_data *q_data; | 487 | struct mtk_q_data *q_data; |
488 | int ret, i; | 488 | int ret, i; |
489 | struct mtk_video_fmt *fmt; | 489 | struct mtk_video_fmt *fmt; |
490 | unsigned int pitch_w_div16; | ||
491 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 490 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
492 | 491 | ||
493 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); | 492 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); |
@@ -530,15 +529,6 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, | |||
530 | q_data->coded_width = f->fmt.pix_mp.width; | 529 | q_data->coded_width = f->fmt.pix_mp.width; |
531 | q_data->coded_height = f->fmt.pix_mp.height; | 530 | q_data->coded_height = f->fmt.pix_mp.height; |
532 | 531 | ||
533 | pitch_w_div16 = DIV_ROUND_UP(q_data->visible_width, 16); | ||
534 | if (pitch_w_div16 % 8 != 0) { | ||
535 | /* Adjust returned width/height, so application could correctly | ||
536 | * allocate hw required memory | ||
537 | */ | ||
538 | q_data->visible_height += 32; | ||
539 | vidioc_try_fmt(f, q_data->fmt); | ||
540 | } | ||
541 | |||
542 | q_data->field = f->fmt.pix_mp.field; | 532 | q_data->field = f->fmt.pix_mp.field; |
543 | ctx->colorspace = f->fmt.pix_mp.colorspace; | 533 | ctx->colorspace = f->fmt.pix_mp.colorspace; |
544 | ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; | 534 | ctx->ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; |
@@ -878,7 +868,8 @@ static int mtk_venc_encode_header(void *priv) | |||
878 | { | 868 | { |
879 | struct mtk_vcodec_ctx *ctx = priv; | 869 | struct mtk_vcodec_ctx *ctx = priv; |
880 | int ret; | 870 | int ret; |
881 | struct vb2_buffer *dst_buf; | 871 | struct vb2_buffer *src_buf, *dst_buf; |
872 | struct vb2_v4l2_buffer *dst_vb2_v4l2, *src_vb2_v4l2; | ||
882 | struct mtk_vcodec_mem bs_buf; | 873 | struct mtk_vcodec_mem bs_buf; |
883 | struct venc_done_result enc_result; | 874 | struct venc_done_result enc_result; |
884 | 875 | ||
@@ -911,6 +902,15 @@ static int mtk_venc_encode_header(void *priv) | |||
911 | mtk_v4l2_err("venc_if_encode failed=%d", ret); | 902 | mtk_v4l2_err("venc_if_encode failed=%d", ret); |
912 | return -EINVAL; | 903 | return -EINVAL; |
913 | } | 904 | } |
905 | src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx); | ||
906 | if (src_buf) { | ||
907 | src_vb2_v4l2 = to_vb2_v4l2_buffer(src_buf); | ||
908 | dst_vb2_v4l2 = to_vb2_v4l2_buffer(dst_buf); | ||
909 | dst_buf->timestamp = src_buf->timestamp; | ||
910 | dst_vb2_v4l2->timecode = src_vb2_v4l2->timecode; | ||
911 | } else { | ||
912 | mtk_v4l2_err("No timestamp for the header buffer."); | ||
913 | } | ||
914 | 914 | ||
915 | ctx->state = MTK_STATE_HEADER; | 915 | ctx->state = MTK_STATE_HEADER; |
916 | dst_buf->planes[0].bytesused = enc_result.bs_size; | 916 | dst_buf->planes[0].bytesused = enc_result.bs_size; |
@@ -1003,7 +1003,7 @@ static void mtk_venc_worker(struct work_struct *work) | |||
1003 | struct mtk_vcodec_mem bs_buf; | 1003 | struct mtk_vcodec_mem bs_buf; |
1004 | struct venc_done_result enc_result; | 1004 | struct venc_done_result enc_result; |
1005 | int ret, i; | 1005 | int ret, i; |
1006 | struct vb2_v4l2_buffer *vb2_v4l2; | 1006 | struct vb2_v4l2_buffer *dst_vb2_v4l2, *src_vb2_v4l2; |
1007 | 1007 | ||
1008 | /* check dst_buf, dst_buf may be removed in device_run | 1008 | /* check dst_buf, dst_buf may be removed in device_run |
1009 | * to stored encdoe header so we need check dst_buf and | 1009 | * to stored encdoe header so we need check dst_buf and |
@@ -1043,9 +1043,14 @@ static void mtk_venc_worker(struct work_struct *work) | |||
1043 | ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_FRAME, | 1043 | ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_FRAME, |
1044 | &frm_buf, &bs_buf, &enc_result); | 1044 | &frm_buf, &bs_buf, &enc_result); |
1045 | 1045 | ||
1046 | vb2_v4l2 = container_of(dst_buf, struct vb2_v4l2_buffer, vb2_buf); | 1046 | src_vb2_v4l2 = to_vb2_v4l2_buffer(src_buf); |
1047 | dst_vb2_v4l2 = to_vb2_v4l2_buffer(dst_buf); | ||
1048 | |||
1049 | dst_buf->timestamp = src_buf->timestamp; | ||
1050 | dst_vb2_v4l2->timecode = src_vb2_v4l2->timecode; | ||
1051 | |||
1047 | if (enc_result.is_key_frm) | 1052 | if (enc_result.is_key_frm) |
1048 | vb2_v4l2->flags |= V4L2_BUF_FLAG_KEYFRAME; | 1053 | dst_vb2_v4l2->flags |= V4L2_BUF_FLAG_KEYFRAME; |
1049 | 1054 | ||
1050 | if (ret) { | 1055 | if (ret) { |
1051 | v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf), | 1056 | v4l2_m2m_buf_done(to_vb2_v4l2_buffer(src_buf), |
@@ -1217,7 +1222,7 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) | |||
1217 | 0, V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE); | 1222 | 0, V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE); |
1218 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_PROFILE, | 1223 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_PROFILE, |
1219 | V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, | 1224 | V4L2_MPEG_VIDEO_H264_PROFILE_HIGH, |
1220 | 0, V4L2_MPEG_VIDEO_H264_PROFILE_MAIN); | 1225 | 0, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH); |
1221 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL, | 1226 | v4l2_ctrl_new_std_menu(handler, ops, V4L2_CID_MPEG_VIDEO_H264_LEVEL, |
1222 | V4L2_MPEG_VIDEO_H264_LEVEL_4_2, | 1227 | V4L2_MPEG_VIDEO_H264_LEVEL_4_2, |
1223 | 0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0); | 1228 | 0, V4L2_MPEG_VIDEO_H264_LEVEL_4_0); |
@@ -1288,5 +1293,10 @@ int mtk_venc_lock(struct mtk_vcodec_ctx *ctx) | |||
1288 | 1293 | ||
1289 | void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx) | 1294 | void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx) |
1290 | { | 1295 | { |
1291 | venc_if_deinit(ctx); | 1296 | int ret = venc_if_deinit(ctx); |
1297 | |||
1298 | if (ret) | ||
1299 | mtk_v4l2_err("venc_if_deinit failed=%d", ret); | ||
1300 | |||
1301 | ctx->state = MTK_STATE_FREE; | ||
1292 | } | 1302 | } |
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index c7806ecda2dd..5cd2151431bf 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | |||
@@ -218,11 +218,15 @@ static int fops_vcodec_release(struct file *file) | |||
218 | mtk_v4l2_debug(1, "[%d] encoder", ctx->id); | 218 | mtk_v4l2_debug(1, "[%d] encoder", ctx->id); |
219 | mutex_lock(&dev->dev_mutex); | 219 | mutex_lock(&dev->dev_mutex); |
220 | 220 | ||
221 | /* | ||
222 | * Call v4l2_m2m_ctx_release to make sure the worker thread is not | ||
223 | * running after venc_if_deinit. | ||
224 | */ | ||
225 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | ||
221 | mtk_vcodec_enc_release(ctx); | 226 | mtk_vcodec_enc_release(ctx); |
222 | v4l2_fh_del(&ctx->fh); | 227 | v4l2_fh_del(&ctx->fh); |
223 | v4l2_fh_exit(&ctx->fh); | 228 | v4l2_fh_exit(&ctx->fh); |
224 | v4l2_ctrl_handler_free(&ctx->ctrl_hdl); | 229 | v4l2_ctrl_handler_free(&ctx->ctrl_hdl); |
225 | v4l2_m2m_ctx_release(ctx->m2m_ctx); | ||
226 | 230 | ||
227 | list_del_init(&ctx->list); | 231 | list_del_init(&ctx->list); |
228 | dev->num_instances--; | 232 | dev->num_instances--; |
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h index 33e890f5aa9c..12131855b46a 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h | |||
@@ -16,7 +16,6 @@ | |||
16 | #define _MTK_VCODEC_INTR_H_ | 16 | #define _MTK_VCODEC_INTR_H_ |
17 | 17 | ||
18 | #define MTK_INST_IRQ_RECEIVED 0x1 | 18 | #define MTK_INST_IRQ_RECEIVED 0x1 |
19 | #define MTK_INST_WORK_THREAD_ABORT_DONE 0x2 | ||
20 | 19 | ||
21 | struct mtk_vcodec_ctx; | 20 | struct mtk_vcodec_ctx; |
22 | 21 | ||
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c index 9a600525b3c1..63d4be4ff327 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c | |||
@@ -61,6 +61,8 @@ enum venc_h264_bs_mode { | |||
61 | 61 | ||
62 | /* | 62 | /* |
63 | * struct venc_h264_vpu_config - Structure for h264 encoder configuration | 63 | * struct venc_h264_vpu_config - Structure for h264 encoder configuration |
64 | * AP-W/R : AP is writer/reader on this item | ||
65 | * VPU-W/R: VPU is write/reader on this item | ||
64 | * @input_fourcc: input fourcc | 66 | * @input_fourcc: input fourcc |
65 | * @bitrate: target bitrate (in bps) | 67 | * @bitrate: target bitrate (in bps) |
66 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, | 68 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, |
@@ -94,13 +96,13 @@ struct venc_h264_vpu_config { | |||
94 | 96 | ||
95 | /* | 97 | /* |
96 | * struct venc_h264_vpu_buf - Structure for buffer information | 98 | * struct venc_h264_vpu_buf - Structure for buffer information |
97 | * @align: buffer alignment (in bytes) | 99 | * AP-W/R : AP is writer/reader on this item |
100 | * VPU-W/R: VPU is write/reader on this item | ||
98 | * @iova: IO virtual address | 101 | * @iova: IO virtual address |
99 | * @vpua: VPU side memory addr which is used by RC_CODE | 102 | * @vpua: VPU side memory addr which is used by RC_CODE |
100 | * @size: buffer size (in bytes) | 103 | * @size: buffer size (in bytes) |
101 | */ | 104 | */ |
102 | struct venc_h264_vpu_buf { | 105 | struct venc_h264_vpu_buf { |
103 | u32 align; | ||
104 | u32 iova; | 106 | u32 iova; |
105 | u32 vpua; | 107 | u32 vpua; |
106 | u32 size; | 108 | u32 size; |
@@ -108,6 +110,8 @@ struct venc_h264_vpu_buf { | |||
108 | 110 | ||
109 | /* | 111 | /* |
110 | * struct venc_h264_vsi - Structure for VPU driver control and info share | 112 | * struct venc_h264_vsi - Structure for VPU driver control and info share |
113 | * AP-W/R : AP is writer/reader on this item | ||
114 | * VPU-W/R: VPU is write/reader on this item | ||
111 | * This structure is allocated in VPU side and shared to AP side. | 115 | * This structure is allocated in VPU side and shared to AP side. |
112 | * @config: h264 encoder configuration | 116 | * @config: h264 encoder configuration |
113 | * @work_bufs: working buffer information in VPU side | 117 | * @work_bufs: working buffer information in VPU side |
@@ -150,12 +154,6 @@ struct venc_h264_inst { | |||
150 | struct mtk_vcodec_ctx *ctx; | 154 | struct mtk_vcodec_ctx *ctx; |
151 | }; | 155 | }; |
152 | 156 | ||
153 | static inline void h264_write_reg(struct venc_h264_inst *inst, u32 addr, | ||
154 | u32 val) | ||
155 | { | ||
156 | writel(val, inst->hw_base + addr); | ||
157 | } | ||
158 | |||
159 | static inline u32 h264_read_reg(struct venc_h264_inst *inst, u32 addr) | 157 | static inline u32 h264_read_reg(struct venc_h264_inst *inst, u32 addr) |
160 | { | 158 | { |
161 | return readl(inst->hw_base + addr); | 159 | return readl(inst->hw_base + addr); |
@@ -214,6 +212,8 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst, | |||
214 | return 40; | 212 | return 40; |
215 | case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: | 213 | case V4L2_MPEG_VIDEO_H264_LEVEL_4_1: |
216 | return 41; | 214 | return 41; |
215 | case V4L2_MPEG_VIDEO_H264_LEVEL_4_2: | ||
216 | return 42; | ||
217 | default: | 217 | default: |
218 | mtk_vcodec_debug(inst, "unsupported level %d", level); | 218 | mtk_vcodec_debug(inst, "unsupported level %d", level); |
219 | return 31; | 219 | return 31; |
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c index 60bbcd2a0510..6d9758479f9a 100644 --- a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | |||
@@ -56,6 +56,8 @@ enum venc_vp8_vpu_work_buf { | |||
56 | 56 | ||
57 | /* | 57 | /* |
58 | * struct venc_vp8_vpu_config - Structure for vp8 encoder configuration | 58 | * struct venc_vp8_vpu_config - Structure for vp8 encoder configuration |
59 | * AP-W/R : AP is writer/reader on this item | ||
60 | * VPU-W/R: VPU is write/reader on this item | ||
59 | * @input_fourcc: input fourcc | 61 | * @input_fourcc: input fourcc |
60 | * @bitrate: target bitrate (in bps) | 62 | * @bitrate: target bitrate (in bps) |
61 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, | 63 | * @pic_w: picture width. Picture size is visible stream resolution, in pixels, |
@@ -83,14 +85,14 @@ struct venc_vp8_vpu_config { | |||
83 | }; | 85 | }; |
84 | 86 | ||
85 | /* | 87 | /* |
86 | * struct venc_vp8_vpu_buf -Structure for buffer information | 88 | * struct venc_vp8_vpu_buf - Structure for buffer information |
87 | * @align: buffer alignment (in bytes) | 89 | * AP-W/R : AP is writer/reader on this item |
90 | * VPU-W/R: VPU is write/reader on this item | ||
88 | * @iova: IO virtual address | 91 | * @iova: IO virtual address |
89 | * @vpua: VPU side memory addr which is used by RC_CODE | 92 | * @vpua: VPU side memory addr which is used by RC_CODE |
90 | * @size: buffer size (in bytes) | 93 | * @size: buffer size (in bytes) |
91 | */ | 94 | */ |
92 | struct venc_vp8_vpu_buf { | 95 | struct venc_vp8_vpu_buf { |
93 | u32 align; | ||
94 | u32 iova; | 96 | u32 iova; |
95 | u32 vpua; | 97 | u32 vpua; |
96 | u32 size; | 98 | u32 size; |
@@ -98,6 +100,8 @@ struct venc_vp8_vpu_buf { | |||
98 | 100 | ||
99 | /* | 101 | /* |
100 | * struct venc_vp8_vsi - Structure for VPU driver control and info share | 102 | * struct venc_vp8_vsi - Structure for VPU driver control and info share |
103 | * AP-W/R : AP is writer/reader on this item | ||
104 | * VPU-W/R: VPU is write/reader on this item | ||
101 | * This structure is allocated in VPU side and shared to AP side. | 105 | * This structure is allocated in VPU side and shared to AP side. |
102 | * @config: vp8 encoder configuration | 106 | * @config: vp8 encoder configuration |
103 | * @work_bufs: working buffer information in VPU side | 107 | * @work_bufs: working buffer information in VPU side |
@@ -138,12 +142,6 @@ struct venc_vp8_inst { | |||
138 | struct mtk_vcodec_ctx *ctx; | 142 | struct mtk_vcodec_ctx *ctx; |
139 | }; | 143 | }; |
140 | 144 | ||
141 | static inline void vp8_enc_write_reg(struct venc_vp8_inst *inst, u32 addr, | ||
142 | u32 val) | ||
143 | { | ||
144 | writel(val, inst->hw_base + addr); | ||
145 | } | ||
146 | |||
147 | static inline u32 vp8_enc_read_reg(struct venc_vp8_inst *inst, u32 addr) | 145 | static inline u32 vp8_enc_read_reg(struct venc_vp8_inst *inst, u32 addr) |
148 | { | 146 | { |
149 | return readl(inst->hw_base + addr); | 147 | return readl(inst->hw_base + addr); |
diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index 6a7bcc3028b1..bc50c69ee0c5 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c | |||
@@ -99,10 +99,16 @@ EXPORT_SYMBOL_GPL(rcar_fcp_put); | |||
99 | */ | 99 | */ |
100 | int rcar_fcp_enable(struct rcar_fcp_device *fcp) | 100 | int rcar_fcp_enable(struct rcar_fcp_device *fcp) |
101 | { | 101 | { |
102 | int error; | ||
103 | |||
102 | if (!fcp) | 104 | if (!fcp) |
103 | return 0; | 105 | return 0; |
104 | 106 | ||
105 | return pm_runtime_get_sync(fcp->dev); | 107 | error = pm_runtime_get_sync(fcp->dev); |
108 | if (error < 0) | ||
109 | return error; | ||
110 | |||
111 | return 0; | ||
106 | } | 112 | } |
107 | EXPORT_SYMBOL_GPL(rcar_fcp_enable); | 113 | EXPORT_SYMBOL_GPL(rcar_fcp_enable); |
108 | 114 | ||
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 32380d5d4f6b..767af2026f8b 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -1112,11 +1112,12 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) | |||
1112 | 1112 | ||
1113 | div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0; | 1113 | div = (host->bus_hz != clock) ? DIV_ROUND_UP(div, 2) : 0; |
1114 | 1114 | ||
1115 | dev_info(&slot->mmc->class_dev, | 1115 | if (clock != slot->__clk_old || force_clkinit) |
1116 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n", | 1116 | dev_info(&slot->mmc->class_dev, |
1117 | slot->id, host->bus_hz, clock, | 1117 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n", |
1118 | div ? ((host->bus_hz / div) >> 1) : | 1118 | slot->id, host->bus_hz, clock, |
1119 | host->bus_hz, div); | 1119 | div ? ((host->bus_hz / div) >> 1) : |
1120 | host->bus_hz, div); | ||
1120 | 1121 | ||
1121 | /* disable clock */ | 1122 | /* disable clock */ |
1122 | mci_writel(host, CLKENA, 0); | 1123 | mci_writel(host, CLKENA, 0); |
@@ -1139,6 +1140,9 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit) | |||
1139 | 1140 | ||
1140 | /* inform CIU */ | 1141 | /* inform CIU */ |
1141 | mci_send_cmd(slot, sdmmc_cmd_bits, 0); | 1142 | mci_send_cmd(slot, sdmmc_cmd_bits, 0); |
1143 | |||
1144 | /* keep the last clock value that was requested from core */ | ||
1145 | slot->__clk_old = clock; | ||
1142 | } | 1146 | } |
1143 | 1147 | ||
1144 | host->current_speed = clock; | 1148 | host->current_speed = clock; |
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h index 9e740bc232a8..e8cd2dec3263 100644 --- a/drivers/mmc/host/dw_mmc.h +++ b/drivers/mmc/host/dw_mmc.h | |||
@@ -249,6 +249,8 @@ extern int dw_mci_resume(struct dw_mci *host); | |||
249 | * @queue_node: List node for placing this node in the @queue list of | 249 | * @queue_node: List node for placing this node in the @queue list of |
250 | * &struct dw_mci. | 250 | * &struct dw_mci. |
251 | * @clock: Clock rate configured by set_ios(). Protected by host->lock. | 251 | * @clock: Clock rate configured by set_ios(). Protected by host->lock. |
252 | * @__clk_old: The last clock value that was requested from core. | ||
253 | * Keeping track of this helps us to avoid spamming the console. | ||
252 | * @flags: Random state bits associated with the slot. | 254 | * @flags: Random state bits associated with the slot. |
253 | * @id: Number of this slot. | 255 | * @id: Number of this slot. |
254 | * @sdio_id: Number of this slot in the SDIO interrupt registers. | 256 | * @sdio_id: Number of this slot in the SDIO interrupt registers. |
@@ -263,6 +265,7 @@ struct dw_mci_slot { | |||
263 | struct list_head queue_node; | 265 | struct list_head queue_node; |
264 | 266 | ||
265 | unsigned int clock; | 267 | unsigned int clock; |
268 | unsigned int __clk_old; | ||
266 | 269 | ||
267 | unsigned long flags; | 270 | unsigned long flags; |
268 | #define DW_MMC_CARD_PRESENT 0 | 271 | #define DW_MMC_CARD_PRESENT 0 |
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index f23d65eb070d..be3c49fa7382 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
@@ -1016,14 +1016,16 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req) | |||
1016 | 1016 | ||
1017 | /* Only reconfigure if we have a different burst size */ | 1017 | /* Only reconfigure if we have a different burst size */ |
1018 | if (*bp != burst) { | 1018 | if (*bp != burst) { |
1019 | struct dma_slave_config cfg; | 1019 | struct dma_slave_config cfg = { |
1020 | 1020 | .src_addr = host->phys_base + | |
1021 | cfg.src_addr = host->phys_base + OMAP_MMC_REG(host, DATA); | 1021 | OMAP_MMC_REG(host, DATA), |
1022 | cfg.dst_addr = host->phys_base + OMAP_MMC_REG(host, DATA); | 1022 | .dst_addr = host->phys_base + |
1023 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 1023 | OMAP_MMC_REG(host, DATA), |
1024 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | 1024 | .src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, |
1025 | cfg.src_maxburst = burst; | 1025 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES, |
1026 | cfg.dst_maxburst = burst; | 1026 | .src_maxburst = burst, |
1027 | .dst_maxburst = burst, | ||
1028 | }; | ||
1027 | 1029 | ||
1028 | if (dmaengine_slave_config(c, &cfg)) | 1030 | if (dmaengine_slave_config(c, &cfg)) |
1029 | goto use_pio; | 1031 | goto use_pio; |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 24ebc9a8de89..5f2f24a7360d 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -1409,11 +1409,18 @@ static int omap_hsmmc_pre_dma_transfer(struct omap_hsmmc_host *host, | |||
1409 | static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, | 1409 | static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, |
1410 | struct mmc_request *req) | 1410 | struct mmc_request *req) |
1411 | { | 1411 | { |
1412 | struct dma_slave_config cfg; | ||
1413 | struct dma_async_tx_descriptor *tx; | 1412 | struct dma_async_tx_descriptor *tx; |
1414 | int ret = 0, i; | 1413 | int ret = 0, i; |
1415 | struct mmc_data *data = req->data; | 1414 | struct mmc_data *data = req->data; |
1416 | struct dma_chan *chan; | 1415 | struct dma_chan *chan; |
1416 | struct dma_slave_config cfg = { | ||
1417 | .src_addr = host->mapbase + OMAP_HSMMC_DATA, | ||
1418 | .dst_addr = host->mapbase + OMAP_HSMMC_DATA, | ||
1419 | .src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, | ||
1420 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, | ||
1421 | .src_maxburst = data->blksz / 4, | ||
1422 | .dst_maxburst = data->blksz / 4, | ||
1423 | }; | ||
1417 | 1424 | ||
1418 | /* Sanity check: all the SG entries must be aligned by block size. */ | 1425 | /* Sanity check: all the SG entries must be aligned by block size. */ |
1419 | for (i = 0; i < data->sg_len; i++) { | 1426 | for (i = 0; i < data->sg_len; i++) { |
@@ -1433,13 +1440,6 @@ static int omap_hsmmc_setup_dma_transfer(struct omap_hsmmc_host *host, | |||
1433 | 1440 | ||
1434 | chan = omap_hsmmc_get_dma_chan(host, data); | 1441 | chan = omap_hsmmc_get_dma_chan(host, data); |
1435 | 1442 | ||
1436 | cfg.src_addr = host->mapbase + OMAP_HSMMC_DATA; | ||
1437 | cfg.dst_addr = host->mapbase + OMAP_HSMMC_DATA; | ||
1438 | cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1439 | cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | ||
1440 | cfg.src_maxburst = data->blksz / 4; | ||
1441 | cfg.dst_maxburst = data->blksz / 4; | ||
1442 | |||
1443 | ret = dmaengine_slave_config(chan, &cfg); | 1443 | ret = dmaengine_slave_config(chan, &cfg); |
1444 | if (ret) | 1444 | if (ret) |
1445 | return ret; | 1445 | return ret; |
diff --git a/drivers/mmc/host/sdhci-st.c b/drivers/mmc/host/sdhci-st.c index c95ba83366a0..ed92ce729dde 100644 --- a/drivers/mmc/host/sdhci-st.c +++ b/drivers/mmc/host/sdhci-st.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | struct st_mmc_platform_data { | 29 | struct st_mmc_platform_data { |
30 | struct reset_control *rstc; | 30 | struct reset_control *rstc; |
31 | struct clk *icnclk; | ||
31 | void __iomem *top_ioaddr; | 32 | void __iomem *top_ioaddr; |
32 | }; | 33 | }; |
33 | 34 | ||
@@ -353,7 +354,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
353 | struct sdhci_host *host; | 354 | struct sdhci_host *host; |
354 | struct st_mmc_platform_data *pdata; | 355 | struct st_mmc_platform_data *pdata; |
355 | struct sdhci_pltfm_host *pltfm_host; | 356 | struct sdhci_pltfm_host *pltfm_host; |
356 | struct clk *clk; | 357 | struct clk *clk, *icnclk; |
357 | int ret = 0; | 358 | int ret = 0; |
358 | u16 host_version; | 359 | u16 host_version; |
359 | struct resource *res; | 360 | struct resource *res; |
@@ -365,6 +366,11 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
365 | return PTR_ERR(clk); | 366 | return PTR_ERR(clk); |
366 | } | 367 | } |
367 | 368 | ||
369 | /* ICN clock isn't compulsory, but use it if it's provided. */ | ||
370 | icnclk = devm_clk_get(&pdev->dev, "icn"); | ||
371 | if (IS_ERR(icnclk)) | ||
372 | icnclk = NULL; | ||
373 | |||
368 | rstc = devm_reset_control_get(&pdev->dev, NULL); | 374 | rstc = devm_reset_control_get(&pdev->dev, NULL); |
369 | if (IS_ERR(rstc)) | 375 | if (IS_ERR(rstc)) |
370 | rstc = NULL; | 376 | rstc = NULL; |
@@ -389,6 +395,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
389 | } | 395 | } |
390 | 396 | ||
391 | clk_prepare_enable(clk); | 397 | clk_prepare_enable(clk); |
398 | clk_prepare_enable(icnclk); | ||
392 | 399 | ||
393 | /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ | 400 | /* Configure the FlashSS Top registers for setting eMMC TX/RX delay */ |
394 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 401 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -400,6 +407,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
400 | } | 407 | } |
401 | 408 | ||
402 | pltfm_host->clk = clk; | 409 | pltfm_host->clk = clk; |
410 | pdata->icnclk = icnclk; | ||
403 | 411 | ||
404 | /* Configure the Arasan HC inside the flashSS */ | 412 | /* Configure the Arasan HC inside the flashSS */ |
405 | st_mmcss_cconfig(np, host); | 413 | st_mmcss_cconfig(np, host); |
@@ -422,6 +430,7 @@ static int sdhci_st_probe(struct platform_device *pdev) | |||
422 | return 0; | 430 | return 0; |
423 | 431 | ||
424 | err_out: | 432 | err_out: |
433 | clk_disable_unprepare(icnclk); | ||
425 | clk_disable_unprepare(clk); | 434 | clk_disable_unprepare(clk); |
426 | err_of: | 435 | err_of: |
427 | sdhci_pltfm_free(pdev); | 436 | sdhci_pltfm_free(pdev); |
@@ -442,6 +451,8 @@ static int sdhci_st_remove(struct platform_device *pdev) | |||
442 | 451 | ||
443 | ret = sdhci_pltfm_unregister(pdev); | 452 | ret = sdhci_pltfm_unregister(pdev); |
444 | 453 | ||
454 | clk_disable_unprepare(pdata->icnclk); | ||
455 | |||
445 | if (rstc) | 456 | if (rstc) |
446 | reset_control_assert(rstc); | 457 | reset_control_assert(rstc); |
447 | 458 | ||
@@ -462,6 +473,7 @@ static int sdhci_st_suspend(struct device *dev) | |||
462 | if (pdata->rstc) | 473 | if (pdata->rstc) |
463 | reset_control_assert(pdata->rstc); | 474 | reset_control_assert(pdata->rstc); |
464 | 475 | ||
476 | clk_disable_unprepare(pdata->icnclk); | ||
465 | clk_disable_unprepare(pltfm_host->clk); | 477 | clk_disable_unprepare(pltfm_host->clk); |
466 | out: | 478 | out: |
467 | return ret; | 479 | return ret; |
@@ -475,6 +487,7 @@ static int sdhci_st_resume(struct device *dev) | |||
475 | struct device_node *np = dev->of_node; | 487 | struct device_node *np = dev->of_node; |
476 | 488 | ||
477 | clk_prepare_enable(pltfm_host->clk); | 489 | clk_prepare_enable(pltfm_host->clk); |
490 | clk_prepare_enable(pdata->icnclk); | ||
478 | 491 | ||
479 | if (pdata->rstc) | 492 | if (pdata->rstc) |
480 | reset_control_deassert(pdata->rstc); | 493 | reset_control_deassert(pdata->rstc); |
diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c index 25a4fbd4d24a..d54f666417e1 100644 --- a/drivers/mtd/nand/mtk_ecc.c +++ b/drivers/mtd/nand/mtk_ecc.c | |||
@@ -366,7 +366,8 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config, | |||
366 | u8 *data, u32 bytes) | 366 | u8 *data, u32 bytes) |
367 | { | 367 | { |
368 | dma_addr_t addr; | 368 | dma_addr_t addr; |
369 | u32 *p, len, i; | 369 | u8 *p; |
370 | u32 len, i, val; | ||
370 | int ret = 0; | 371 | int ret = 0; |
371 | 372 | ||
372 | addr = dma_map_single(ecc->dev, data, bytes, DMA_TO_DEVICE); | 373 | addr = dma_map_single(ecc->dev, data, bytes, DMA_TO_DEVICE); |
@@ -392,11 +393,14 @@ int mtk_ecc_encode(struct mtk_ecc *ecc, struct mtk_ecc_config *config, | |||
392 | 393 | ||
393 | /* Program ECC bytes to OOB: per sector oob = FDM + ECC + SPARE */ | 394 | /* Program ECC bytes to OOB: per sector oob = FDM + ECC + SPARE */ |
394 | len = (config->strength * ECC_PARITY_BITS + 7) >> 3; | 395 | len = (config->strength * ECC_PARITY_BITS + 7) >> 3; |
395 | p = (u32 *)(data + bytes); | 396 | p = data + bytes; |
396 | 397 | ||
397 | /* write the parity bytes generated by the ECC back to the OOB region */ | 398 | /* write the parity bytes generated by the ECC back to the OOB region */ |
398 | for (i = 0; i < len; i++) | 399 | for (i = 0; i < len; i++) { |
399 | p[i] = readl(ecc->regs + ECC_ENCPAR(i)); | 400 | if ((i % 4) == 0) |
401 | val = readl(ecc->regs + ECC_ENCPAR(i / 4)); | ||
402 | p[i] = (val >> ((i % 4) * 8)) & 0xff; | ||
403 | } | ||
400 | timeout: | 404 | timeout: |
401 | 405 | ||
402 | dma_unmap_single(ecc->dev, addr, bytes, DMA_TO_DEVICE); | 406 | dma_unmap_single(ecc->dev, addr, bytes, DMA_TO_DEVICE); |
diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c index ddaa2acb9dd7..5223a2182ee4 100644 --- a/drivers/mtd/nand/mtk_nand.c +++ b/drivers/mtd/nand/mtk_nand.c | |||
@@ -93,6 +93,9 @@ | |||
93 | #define NFI_FSM_MASK (0xf << 16) | 93 | #define NFI_FSM_MASK (0xf << 16) |
94 | #define NFI_ADDRCNTR (0x70) | 94 | #define NFI_ADDRCNTR (0x70) |
95 | #define CNTR_MASK GENMASK(16, 12) | 95 | #define CNTR_MASK GENMASK(16, 12) |
96 | #define ADDRCNTR_SEC_SHIFT (12) | ||
97 | #define ADDRCNTR_SEC(val) \ | ||
98 | (((val) & CNTR_MASK) >> ADDRCNTR_SEC_SHIFT) | ||
96 | #define NFI_STRADDR (0x80) | 99 | #define NFI_STRADDR (0x80) |
97 | #define NFI_BYTELEN (0x84) | 100 | #define NFI_BYTELEN (0x84) |
98 | #define NFI_CSEL (0x90) | 101 | #define NFI_CSEL (0x90) |
@@ -699,7 +702,7 @@ static int mtk_nfc_do_write_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
699 | } | 702 | } |
700 | 703 | ||
701 | ret = readl_poll_timeout_atomic(nfc->regs + NFI_ADDRCNTR, reg, | 704 | ret = readl_poll_timeout_atomic(nfc->regs + NFI_ADDRCNTR, reg, |
702 | (reg & CNTR_MASK) >= chip->ecc.steps, | 705 | ADDRCNTR_SEC(reg) >= chip->ecc.steps, |
703 | 10, MTK_TIMEOUT); | 706 | 10, MTK_TIMEOUT); |
704 | if (ret) | 707 | if (ret) |
705 | dev_err(dev, "hwecc write timeout\n"); | 708 | dev_err(dev, "hwecc write timeout\n"); |
@@ -902,7 +905,7 @@ static int mtk_nfc_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, | |||
902 | dev_warn(nfc->dev, "read ahb/dma done timeout\n"); | 905 | dev_warn(nfc->dev, "read ahb/dma done timeout\n"); |
903 | 906 | ||
904 | rc = readl_poll_timeout_atomic(nfc->regs + NFI_BYTELEN, reg, | 907 | rc = readl_poll_timeout_atomic(nfc->regs + NFI_BYTELEN, reg, |
905 | (reg & CNTR_MASK) >= sectors, 10, | 908 | ADDRCNTR_SEC(reg) >= sectors, 10, |
906 | MTK_TIMEOUT); | 909 | MTK_TIMEOUT); |
907 | if (rc < 0) { | 910 | if (rc < 0) { |
908 | dev_err(nfc->dev, "subpage done timeout\n"); | 911 | dev_err(nfc->dev, "subpage done timeout\n"); |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 5173fadc9a4e..57cbe2b83849 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -943,7 +943,7 @@ static int mxc_v2_ooblayout_free(struct mtd_info *mtd, int section, | |||
943 | struct nand_chip *nand_chip = mtd_to_nand(mtd); | 943 | struct nand_chip *nand_chip = mtd_to_nand(mtd); |
944 | int stepsize = nand_chip->ecc.bytes == 9 ? 16 : 26; | 944 | int stepsize = nand_chip->ecc.bytes == 9 ? 16 : 26; |
945 | 945 | ||
946 | if (section > nand_chip->ecc.steps) | 946 | if (section >= nand_chip->ecc.steps) |
947 | return -ERANGE; | 947 | return -ERANGE; |
948 | 948 | ||
949 | if (!section) { | 949 | if (!section) { |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 217e8da0628c..9599ed6f1213 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1341,9 +1341,10 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1341 | slave_dev->name); | 1341 | slave_dev->name); |
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | /* already enslaved */ | 1344 | /* already in-use? */ |
1345 | if (slave_dev->flags & IFF_SLAVE) { | 1345 | if (netdev_is_rx_handler_busy(slave_dev)) { |
1346 | netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); | 1346 | netdev_err(bond_dev, |
1347 | "Error: Device is in use and cannot be enslaved\n"); | ||
1347 | return -EBUSY; | 1348 | return -EBUSY; |
1348 | } | 1349 | } |
1349 | 1350 | ||
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 41c0fc9f3b14..16f7cadda5c3 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -1268,11 +1268,10 @@ static int __maybe_unused flexcan_suspend(struct device *device) | |||
1268 | struct flexcan_priv *priv = netdev_priv(dev); | 1268 | struct flexcan_priv *priv = netdev_priv(dev); |
1269 | int err; | 1269 | int err; |
1270 | 1270 | ||
1271 | err = flexcan_chip_disable(priv); | ||
1272 | if (err) | ||
1273 | return err; | ||
1274 | |||
1275 | if (netif_running(dev)) { | 1271 | if (netif_running(dev)) { |
1272 | err = flexcan_chip_disable(priv); | ||
1273 | if (err) | ||
1274 | return err; | ||
1276 | netif_stop_queue(dev); | 1275 | netif_stop_queue(dev); |
1277 | netif_device_detach(dev); | 1276 | netif_device_detach(dev); |
1278 | } | 1277 | } |
@@ -1285,13 +1284,17 @@ static int __maybe_unused flexcan_resume(struct device *device) | |||
1285 | { | 1284 | { |
1286 | struct net_device *dev = dev_get_drvdata(device); | 1285 | struct net_device *dev = dev_get_drvdata(device); |
1287 | struct flexcan_priv *priv = netdev_priv(dev); | 1286 | struct flexcan_priv *priv = netdev_priv(dev); |
1287 | int err; | ||
1288 | 1288 | ||
1289 | priv->can.state = CAN_STATE_ERROR_ACTIVE; | 1289 | priv->can.state = CAN_STATE_ERROR_ACTIVE; |
1290 | if (netif_running(dev)) { | 1290 | if (netif_running(dev)) { |
1291 | netif_device_attach(dev); | 1291 | netif_device_attach(dev); |
1292 | netif_start_queue(dev); | 1292 | netif_start_queue(dev); |
1293 | err = flexcan_chip_enable(priv); | ||
1294 | if (err) | ||
1295 | return err; | ||
1293 | } | 1296 | } |
1294 | return flexcan_chip_enable(priv); | 1297 | return 0; |
1295 | } | 1298 | } |
1296 | 1299 | ||
1297 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); | 1300 | static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend, flexcan_resume); |
diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c index 2d1d22eec750..368bb0710d8f 100644 --- a/drivers/net/can/ifi_canfd/ifi_canfd.c +++ b/drivers/net/can/ifi_canfd/ifi_canfd.c | |||
@@ -81,6 +81,10 @@ | |||
81 | #define IFI_CANFD_TIME_SET_TIMEA_4_12_6_6 BIT(15) | 81 | #define IFI_CANFD_TIME_SET_TIMEA_4_12_6_6 BIT(15) |
82 | 82 | ||
83 | #define IFI_CANFD_TDELAY 0x1c | 83 | #define IFI_CANFD_TDELAY 0x1c |
84 | #define IFI_CANFD_TDELAY_DEFAULT 0xb | ||
85 | #define IFI_CANFD_TDELAY_MASK 0x3fff | ||
86 | #define IFI_CANFD_TDELAY_ABS BIT(14) | ||
87 | #define IFI_CANFD_TDELAY_EN BIT(15) | ||
84 | 88 | ||
85 | #define IFI_CANFD_ERROR 0x20 | 89 | #define IFI_CANFD_ERROR 0x20 |
86 | #define IFI_CANFD_ERROR_TX_OFFSET 0 | 90 | #define IFI_CANFD_ERROR_TX_OFFSET 0 |
@@ -641,7 +645,7 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev) | |||
641 | struct ifi_canfd_priv *priv = netdev_priv(ndev); | 645 | struct ifi_canfd_priv *priv = netdev_priv(ndev); |
642 | const struct can_bittiming *bt = &priv->can.bittiming; | 646 | const struct can_bittiming *bt = &priv->can.bittiming; |
643 | const struct can_bittiming *dbt = &priv->can.data_bittiming; | 647 | const struct can_bittiming *dbt = &priv->can.data_bittiming; |
644 | u16 brp, sjw, tseg1, tseg2; | 648 | u16 brp, sjw, tseg1, tseg2, tdc; |
645 | 649 | ||
646 | /* Configure bit timing */ | 650 | /* Configure bit timing */ |
647 | brp = bt->brp - 2; | 651 | brp = bt->brp - 2; |
@@ -664,6 +668,11 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev) | |||
664 | (brp << IFI_CANFD_TIME_PRESCALE_OFF) | | 668 | (brp << IFI_CANFD_TIME_PRESCALE_OFF) | |
665 | (sjw << IFI_CANFD_TIME_SJW_OFF_7_9_8_8), | 669 | (sjw << IFI_CANFD_TIME_SJW_OFF_7_9_8_8), |
666 | priv->base + IFI_CANFD_FTIME); | 670 | priv->base + IFI_CANFD_FTIME); |
671 | |||
672 | /* Configure transmitter delay */ | ||
673 | tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK; | ||
674 | writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc, | ||
675 | priv->base + IFI_CANFD_TDELAY); | ||
667 | } | 676 | } |
668 | 677 | ||
669 | static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id, | 678 | static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id, |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 8fc3f3c137f8..505ceaf451e2 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -6356,10 +6356,6 @@ bnx2_open(struct net_device *dev) | |||
6356 | struct bnx2 *bp = netdev_priv(dev); | 6356 | struct bnx2 *bp = netdev_priv(dev); |
6357 | int rc; | 6357 | int rc; |
6358 | 6358 | ||
6359 | rc = bnx2_request_firmware(bp); | ||
6360 | if (rc < 0) | ||
6361 | goto out; | ||
6362 | |||
6363 | netif_carrier_off(dev); | 6359 | netif_carrier_off(dev); |
6364 | 6360 | ||
6365 | bnx2_disable_int(bp); | 6361 | bnx2_disable_int(bp); |
@@ -6428,7 +6424,6 @@ open_err: | |||
6428 | bnx2_free_irq(bp); | 6424 | bnx2_free_irq(bp); |
6429 | bnx2_free_mem(bp); | 6425 | bnx2_free_mem(bp); |
6430 | bnx2_del_napi(bp); | 6426 | bnx2_del_napi(bp); |
6431 | bnx2_release_firmware(bp); | ||
6432 | goto out; | 6427 | goto out; |
6433 | } | 6428 | } |
6434 | 6429 | ||
@@ -8575,6 +8570,12 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8575 | 8570 | ||
8576 | pci_set_drvdata(pdev, dev); | 8571 | pci_set_drvdata(pdev, dev); |
8577 | 8572 | ||
8573 | rc = bnx2_request_firmware(bp); | ||
8574 | if (rc < 0) | ||
8575 | goto error; | ||
8576 | |||
8577 | |||
8578 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); | ||
8578 | memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); | 8579 | memcpy(dev->dev_addr, bp->mac_addr, ETH_ALEN); |
8579 | 8580 | ||
8580 | dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | | 8581 | dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG | |
@@ -8607,6 +8608,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
8607 | return 0; | 8608 | return 0; |
8608 | 8609 | ||
8609 | error: | 8610 | error: |
8611 | bnx2_release_firmware(bp); | ||
8610 | pci_iounmap(pdev, bp->regview); | 8612 | pci_iounmap(pdev, bp->regview); |
8611 | pci_release_regions(pdev); | 8613 | pci_release_regions(pdev); |
8612 | pci_disable_device(pdev); | 8614 | pci_disable_device(pdev); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 97e892511666..fa3386bb14f7 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -772,6 +772,11 @@ void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl) | |||
772 | (bp->common.bc_ver & 0xff00) >> 8, | 772 | (bp->common.bc_ver & 0xff00) >> 8, |
773 | (bp->common.bc_ver & 0xff)); | 773 | (bp->common.bc_ver & 0xff)); |
774 | 774 | ||
775 | if (pci_channel_offline(bp->pdev)) { | ||
776 | BNX2X_ERR("Cannot dump MCP info while in PCI error\n"); | ||
777 | return; | ||
778 | } | ||
779 | |||
775 | val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); | 780 | val = REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER); |
776 | if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) | 781 | if (val == REG_RD(bp, MCP_REG_MCPR_CPU_PROGRAM_COUNTER)) |
777 | BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); | 782 | BNX2X_ERR("%s" "MCP PC at 0x%x\n", lvl, val); |
@@ -9415,10 +9420,16 @@ unload_error: | |||
9415 | /* Release IRQs */ | 9420 | /* Release IRQs */ |
9416 | bnx2x_free_irq(bp); | 9421 | bnx2x_free_irq(bp); |
9417 | 9422 | ||
9418 | /* Reset the chip */ | 9423 | /* Reset the chip, unless PCI function is offline. If we reach this |
9419 | rc = bnx2x_reset_hw(bp, reset_code); | 9424 | * point following a PCI error handling, it means device is really |
9420 | if (rc) | 9425 | * in a bad state and we're about to remove it, so reset the chip |
9421 | BNX2X_ERR("HW_RESET failed\n"); | 9426 | * is not a good idea. |
9427 | */ | ||
9428 | if (!pci_channel_offline(bp->pdev)) { | ||
9429 | rc = bnx2x_reset_hw(bp, reset_code); | ||
9430 | if (rc) | ||
9431 | BNX2X_ERR("HW_RESET failed\n"); | ||
9432 | } | ||
9422 | 9433 | ||
9423 | /* Report UNLOAD_DONE to MCP */ | 9434 | /* Report UNLOAD_DONE to MCP */ |
9424 | bnx2x_send_unload_done(bp, keep_link); | 9435 | bnx2x_send_unload_done(bp, keep_link); |
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 2cf79100c9cb..228c964e709a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
@@ -353,8 +353,8 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
353 | push_len = (length + sizeof(*tx_push) + 7) / 8; | 353 | push_len = (length + sizeof(*tx_push) + 7) / 8; |
354 | if (push_len > 16) { | 354 | if (push_len > 16) { |
355 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); | 355 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, 16); |
356 | __iowrite64_copy(txr->tx_doorbell + 4, tx_push_buf + 1, | 356 | __iowrite32_copy(txr->tx_doorbell + 4, tx_push_buf + 1, |
357 | push_len - 16); | 357 | (push_len - 16) << 1); |
358 | } else { | 358 | } else { |
359 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, | 359 | __iowrite64_copy(txr->tx_doorbell, tx_push_buf, |
360 | push_len); | 360 | push_len); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 659261218d9f..a2551bcd1027 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -14012,6 +14012,7 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | |||
14012 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || | 14012 | if ((ec->rx_coalesce_usecs > MAX_RXCOL_TICKS) || |
14013 | (!ec->rx_coalesce_usecs) || | 14013 | (!ec->rx_coalesce_usecs) || |
14014 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || | 14014 | (ec->tx_coalesce_usecs > MAX_TXCOL_TICKS) || |
14015 | (!ec->tx_coalesce_usecs) || | ||
14015 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || | 14016 | (ec->rx_max_coalesced_frames > MAX_RXMAX_FRAMES) || |
14016 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || | 14017 | (ec->tx_max_coalesced_frames > MAX_TXMAX_FRAMES) || |
14017 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || | 14018 | (ec->rx_coalesce_usecs_irq > max_rxcoal_tick_int) || |
@@ -14022,16 +14023,6 @@ static int tg3_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) | |||
14022 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) | 14023 | (ec->stats_block_coalesce_usecs < min_stat_coal_ticks)) |
14023 | return -EINVAL; | 14024 | return -EINVAL; |
14024 | 14025 | ||
14025 | /* No rx interrupts will be generated if both are zero */ | ||
14026 | if ((ec->rx_coalesce_usecs == 0) && | ||
14027 | (ec->rx_max_coalesced_frames == 0)) | ||
14028 | return -EINVAL; | ||
14029 | |||
14030 | /* No tx interrupts will be generated if both are zero */ | ||
14031 | if ((ec->tx_coalesce_usecs == 0) && | ||
14032 | (ec->tx_max_coalesced_frames == 0)) | ||
14033 | return -EINVAL; | ||
14034 | |||
14035 | /* Only copy relevant parameters, ignore all others. */ | 14026 | /* Only copy relevant parameters, ignore all others. */ |
14036 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; | 14027 | tp->coal.rx_coalesce_usecs = ec->rx_coalesce_usecs; |
14037 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; | 14028 | tp->coal.tx_coalesce_usecs = ec->tx_coalesce_usecs; |
diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c index 0e4fdc3dd729..31f61a744d66 100644 --- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c +++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c | |||
@@ -31,15 +31,10 @@ | |||
31 | #define BNAD_NUM_TXF_COUNTERS 12 | 31 | #define BNAD_NUM_TXF_COUNTERS 12 |
32 | #define BNAD_NUM_RXF_COUNTERS 10 | 32 | #define BNAD_NUM_RXF_COUNTERS 10 |
33 | #define BNAD_NUM_CQ_COUNTERS (3 + 5) | 33 | #define BNAD_NUM_CQ_COUNTERS (3 + 5) |
34 | #define BNAD_NUM_RXQ_COUNTERS 6 | 34 | #define BNAD_NUM_RXQ_COUNTERS 7 |
35 | #define BNAD_NUM_TXQ_COUNTERS 5 | 35 | #define BNAD_NUM_TXQ_COUNTERS 5 |
36 | 36 | ||
37 | #define BNAD_ETHTOOL_STATS_NUM \ | 37 | static const char *bnad_net_stats_strings[] = { |
38 | (sizeof(struct rtnl_link_stats64) / sizeof(u64) + \ | ||
39 | sizeof(struct bnad_drv_stats) / sizeof(u64) + \ | ||
40 | offsetof(struct bfi_enet_stats, rxf_stats[0]) / sizeof(u64)) | ||
41 | |||
42 | static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { | ||
43 | "rx_packets", | 38 | "rx_packets", |
44 | "tx_packets", | 39 | "tx_packets", |
45 | "rx_bytes", | 40 | "rx_bytes", |
@@ -50,22 +45,10 @@ static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { | |||
50 | "tx_dropped", | 45 | "tx_dropped", |
51 | "multicast", | 46 | "multicast", |
52 | "collisions", | 47 | "collisions", |
53 | |||
54 | "rx_length_errors", | 48 | "rx_length_errors", |
55 | "rx_over_errors", | ||
56 | "rx_crc_errors", | 49 | "rx_crc_errors", |
57 | "rx_frame_errors", | 50 | "rx_frame_errors", |
58 | "rx_fifo_errors", | ||
59 | "rx_missed_errors", | ||
60 | |||
61 | "tx_aborted_errors", | ||
62 | "tx_carrier_errors", | ||
63 | "tx_fifo_errors", | 51 | "tx_fifo_errors", |
64 | "tx_heartbeat_errors", | ||
65 | "tx_window_errors", | ||
66 | |||
67 | "rx_compressed", | ||
68 | "tx_compressed", | ||
69 | 52 | ||
70 | "netif_queue_stop", | 53 | "netif_queue_stop", |
71 | "netif_queue_wakeup", | 54 | "netif_queue_wakeup", |
@@ -254,6 +237,8 @@ static const char *bnad_net_stats_strings[BNAD_ETHTOOL_STATS_NUM] = { | |||
254 | "fc_tx_fid_parity_errors", | 237 | "fc_tx_fid_parity_errors", |
255 | }; | 238 | }; |
256 | 239 | ||
240 | #define BNAD_ETHTOOL_STATS_NUM ARRAY_SIZE(bnad_net_stats_strings) | ||
241 | |||
257 | static int | 242 | static int |
258 | bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) | 243 | bnad_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd) |
259 | { | 244 | { |
@@ -658,6 +643,8 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string) | |||
658 | string += ETH_GSTRING_LEN; | 643 | string += ETH_GSTRING_LEN; |
659 | sprintf(string, "rxq%d_allocbuf_failed", q_num); | 644 | sprintf(string, "rxq%d_allocbuf_failed", q_num); |
660 | string += ETH_GSTRING_LEN; | 645 | string += ETH_GSTRING_LEN; |
646 | sprintf(string, "rxq%d_mapbuf_failed", q_num); | ||
647 | string += ETH_GSTRING_LEN; | ||
661 | sprintf(string, "rxq%d_producer_index", q_num); | 648 | sprintf(string, "rxq%d_producer_index", q_num); |
662 | string += ETH_GSTRING_LEN; | 649 | string += ETH_GSTRING_LEN; |
663 | sprintf(string, "rxq%d_consumer_index", q_num); | 650 | sprintf(string, "rxq%d_consumer_index", q_num); |
@@ -678,6 +665,9 @@ bnad_get_strings(struct net_device *netdev, u32 stringset, u8 *string) | |||
678 | sprintf(string, "rxq%d_allocbuf_failed", | 665 | sprintf(string, "rxq%d_allocbuf_failed", |
679 | q_num); | 666 | q_num); |
680 | string += ETH_GSTRING_LEN; | 667 | string += ETH_GSTRING_LEN; |
668 | sprintf(string, "rxq%d_mapbuf_failed", | ||
669 | q_num); | ||
670 | string += ETH_GSTRING_LEN; | ||
681 | sprintf(string, "rxq%d_producer_index", | 671 | sprintf(string, "rxq%d_producer_index", |
682 | q_num); | 672 | q_num); |
683 | string += ETH_GSTRING_LEN; | 673 | string += ETH_GSTRING_LEN; |
@@ -854,9 +844,9 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, | |||
854 | u64 *buf) | 844 | u64 *buf) |
855 | { | 845 | { |
856 | struct bnad *bnad = netdev_priv(netdev); | 846 | struct bnad *bnad = netdev_priv(netdev); |
857 | int i, j, bi; | 847 | int i, j, bi = 0; |
858 | unsigned long flags; | 848 | unsigned long flags; |
859 | struct rtnl_link_stats64 *net_stats64; | 849 | struct rtnl_link_stats64 net_stats64; |
860 | u64 *stats64; | 850 | u64 *stats64; |
861 | u32 bmap; | 851 | u32 bmap; |
862 | 852 | ||
@@ -871,14 +861,25 @@ bnad_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, | |||
871 | * under the same lock | 861 | * under the same lock |
872 | */ | 862 | */ |
873 | spin_lock_irqsave(&bnad->bna_lock, flags); | 863 | spin_lock_irqsave(&bnad->bna_lock, flags); |
874 | bi = 0; | ||
875 | memset(buf, 0, stats->n_stats * sizeof(u64)); | ||
876 | |||
877 | net_stats64 = (struct rtnl_link_stats64 *)buf; | ||
878 | bnad_netdev_qstats_fill(bnad, net_stats64); | ||
879 | bnad_netdev_hwstats_fill(bnad, net_stats64); | ||
880 | 864 | ||
881 | bi = sizeof(*net_stats64) / sizeof(u64); | 865 | memset(&net_stats64, 0, sizeof(net_stats64)); |
866 | bnad_netdev_qstats_fill(bnad, &net_stats64); | ||
867 | bnad_netdev_hwstats_fill(bnad, &net_stats64); | ||
868 | |||
869 | buf[bi++] = net_stats64.rx_packets; | ||
870 | buf[bi++] = net_stats64.tx_packets; | ||
871 | buf[bi++] = net_stats64.rx_bytes; | ||
872 | buf[bi++] = net_stats64.tx_bytes; | ||
873 | buf[bi++] = net_stats64.rx_errors; | ||
874 | buf[bi++] = net_stats64.tx_errors; | ||
875 | buf[bi++] = net_stats64.rx_dropped; | ||
876 | buf[bi++] = net_stats64.tx_dropped; | ||
877 | buf[bi++] = net_stats64.multicast; | ||
878 | buf[bi++] = net_stats64.collisions; | ||
879 | buf[bi++] = net_stats64.rx_length_errors; | ||
880 | buf[bi++] = net_stats64.rx_crc_errors; | ||
881 | buf[bi++] = net_stats64.rx_frame_errors; | ||
882 | buf[bi++] = net_stats64.tx_fifo_errors; | ||
882 | 883 | ||
883 | /* Get netif_queue_stopped from stack */ | 884 | /* Get netif_queue_stopped from stack */ |
884 | bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev); | 885 | bnad->stats.drv_stats.netif_queue_stopped = netif_queue_stopped(netdev); |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 89c0cfa9719f..d954a97b0b0b 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -1323,6 +1323,24 @@ dma_error: | |||
1323 | return 0; | 1323 | return 0; |
1324 | } | 1324 | } |
1325 | 1325 | ||
1326 | static inline int macb_clear_csum(struct sk_buff *skb) | ||
1327 | { | ||
1328 | /* no change for packets without checksum offloading */ | ||
1329 | if (skb->ip_summed != CHECKSUM_PARTIAL) | ||
1330 | return 0; | ||
1331 | |||
1332 | /* make sure we can modify the header */ | ||
1333 | if (unlikely(skb_cow_head(skb, 0))) | ||
1334 | return -1; | ||
1335 | |||
1336 | /* initialize checksum field | ||
1337 | * This is required - at least for Zynq, which otherwise calculates | ||
1338 | * wrong UDP header checksums for UDP packets with UDP data len <=2 | ||
1339 | */ | ||
1340 | *(__sum16 *)(skb_checksum_start(skb) + skb->csum_offset) = 0; | ||
1341 | return 0; | ||
1342 | } | ||
1343 | |||
1326 | static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1344 | static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1327 | { | 1345 | { |
1328 | u16 queue_index = skb_get_queue_mapping(skb); | 1346 | u16 queue_index = skb_get_queue_mapping(skb); |
@@ -1362,6 +1380,11 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1362 | return NETDEV_TX_BUSY; | 1380 | return NETDEV_TX_BUSY; |
1363 | } | 1381 | } |
1364 | 1382 | ||
1383 | if (macb_clear_csum(skb)) { | ||
1384 | dev_kfree_skb_any(skb); | ||
1385 | return NETDEV_TX_OK; | ||
1386 | } | ||
1387 | |||
1365 | /* Map socket buffer for DMA transfer */ | 1388 | /* Map socket buffer for DMA transfer */ |
1366 | if (!macb_tx_map(bp, queue, skb)) { | 1389 | if (!macb_tx_map(bp, queue, skb)) { |
1367 | dev_kfree_skb_any(skb); | 1390 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h index 83025bb4737c..e29815d9e6f4 100644 --- a/drivers/net/ethernet/cavium/thunder/nic.h +++ b/drivers/net/ethernet/cavium/thunder/nic.h | |||
@@ -279,6 +279,7 @@ struct nicvf { | |||
279 | u8 sqs_id; | 279 | u8 sqs_id; |
280 | bool sqs_mode; | 280 | bool sqs_mode; |
281 | bool hw_tso; | 281 | bool hw_tso; |
282 | bool t88; | ||
282 | 283 | ||
283 | /* Receive buffer alloc */ | 284 | /* Receive buffer alloc */ |
284 | u32 rb_page_offset; | 285 | u32 rb_page_offset; |
diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c index 16ed20357c5c..85cc782b9060 100644 --- a/drivers/net/ethernet/cavium/thunder/nic_main.c +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c | |||
@@ -251,9 +251,14 @@ static void nic_set_tx_pkt_pad(struct nicpf *nic, int size) | |||
251 | int lmac; | 251 | int lmac; |
252 | u64 lmac_cfg; | 252 | u64 lmac_cfg; |
253 | 253 | ||
254 | /* Max value that can be set is 60 */ | 254 | /* There is a issue in HW where-in while sending GSO sized |
255 | if (size > 60) | 255 | * pkts as part of TSO, if pkt len falls below this size |
256 | size = 60; | 256 | * NIC will zero PAD packet and also updates IP total length. |
257 | * Hence set this value to lessthan min pkt size of MAC+IP+TCP | ||
258 | * headers, BGX will do the padding to transmit 64 byte pkt. | ||
259 | */ | ||
260 | if (size > 52) | ||
261 | size = 52; | ||
257 | 262 | ||
258 | for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { | 263 | for (lmac = 0; lmac < (MAX_BGX_PER_CN88XX * MAX_LMAC_PER_BGX); lmac++) { |
259 | lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3)); | 264 | lmac_cfg = nic_reg_read(nic, NIC_PF_LMAC_0_7_CFG | (lmac << 3)); |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c index a19e73f11d73..3240349615bd 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c | |||
@@ -513,6 +513,7 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, | |||
513 | struct nicvf *nic = netdev_priv(netdev); | 513 | struct nicvf *nic = netdev_priv(netdev); |
514 | struct snd_queue *sq; | 514 | struct snd_queue *sq; |
515 | struct sq_hdr_subdesc *hdr; | 515 | struct sq_hdr_subdesc *hdr; |
516 | struct sq_hdr_subdesc *tso_sqe; | ||
516 | 517 | ||
517 | sq = &nic->qs->sq[cqe_tx->sq_idx]; | 518 | sq = &nic->qs->sq[cqe_tx->sq_idx]; |
518 | 519 | ||
@@ -527,17 +528,21 @@ static void nicvf_snd_pkt_handler(struct net_device *netdev, | |||
527 | 528 | ||
528 | nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); | 529 | nicvf_check_cqe_tx_errs(nic, cq, cqe_tx); |
529 | skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; | 530 | skb = (struct sk_buff *)sq->skbuff[cqe_tx->sqe_ptr]; |
530 | /* For TSO offloaded packets only one SQE will have a valid SKB */ | ||
531 | if (skb) { | 531 | if (skb) { |
532 | /* Check for dummy descriptor used for HW TSO offload on 88xx */ | ||
533 | if (hdr->dont_send) { | ||
534 | /* Get actual TSO descriptors and free them */ | ||
535 | tso_sqe = | ||
536 | (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, hdr->rsvd2); | ||
537 | nicvf_put_sq_desc(sq, tso_sqe->subdesc_cnt + 1); | ||
538 | } | ||
532 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); | 539 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); |
533 | prefetch(skb); | 540 | prefetch(skb); |
534 | dev_consume_skb_any(skb); | 541 | dev_consume_skb_any(skb); |
535 | sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; | 542 | sq->skbuff[cqe_tx->sqe_ptr] = (u64)NULL; |
536 | } else { | 543 | } else { |
537 | /* In case of HW TSO, HW sends a CQE for each segment of a TSO | 544 | /* In case of SW TSO on 88xx, only last segment will have |
538 | * packet instead of a single CQE for the whole TSO packet | 545 | * a SKB attached, so just free SQEs here. |
539 | * transmitted. Each of this CQE points to the same SQE, so | ||
540 | * avoid freeing same SQE multiple times. | ||
541 | */ | 546 | */ |
542 | if (!nic->hw_tso) | 547 | if (!nic->hw_tso) |
543 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); | 548 | nicvf_put_sq_desc(sq, hdr->subdesc_cnt + 1); |
@@ -1502,6 +1507,7 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1502 | struct net_device *netdev; | 1507 | struct net_device *netdev; |
1503 | struct nicvf *nic; | 1508 | struct nicvf *nic; |
1504 | int err, qcount; | 1509 | int err, qcount; |
1510 | u16 sdevid; | ||
1505 | 1511 | ||
1506 | err = pci_enable_device(pdev); | 1512 | err = pci_enable_device(pdev); |
1507 | if (err) { | 1513 | if (err) { |
@@ -1575,6 +1581,10 @@ static int nicvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1575 | if (!pass1_silicon(nic->pdev)) | 1581 | if (!pass1_silicon(nic->pdev)) |
1576 | nic->hw_tso = true; | 1582 | nic->hw_tso = true; |
1577 | 1583 | ||
1584 | pci_read_config_word(nic->pdev, PCI_SUBSYSTEM_ID, &sdevid); | ||
1585 | if (sdevid == 0xA134) | ||
1586 | nic->t88 = true; | ||
1587 | |||
1578 | /* Check if this VF is in QS only mode */ | 1588 | /* Check if this VF is in QS only mode */ |
1579 | if (nic->sqs_mode) | 1589 | if (nic->sqs_mode) |
1580 | return 0; | 1590 | return 0; |
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c index 0ff8e60deccb..dda3ea3f3bb6 100644 --- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c +++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c | |||
@@ -938,6 +938,8 @@ static int nicvf_tso_count_subdescs(struct sk_buff *skb) | |||
938 | return num_edescs + sh->gso_segs; | 938 | return num_edescs + sh->gso_segs; |
939 | } | 939 | } |
940 | 940 | ||
941 | #define POST_CQE_DESC_COUNT 2 | ||
942 | |||
941 | /* Get the number of SQ descriptors needed to xmit this skb */ | 943 | /* Get the number of SQ descriptors needed to xmit this skb */ |
942 | static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) | 944 | static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) |
943 | { | 945 | { |
@@ -948,6 +950,10 @@ static int nicvf_sq_subdesc_required(struct nicvf *nic, struct sk_buff *skb) | |||
948 | return subdesc_cnt; | 950 | return subdesc_cnt; |
949 | } | 951 | } |
950 | 952 | ||
953 | /* Dummy descriptors to get TSO pkt completion notification */ | ||
954 | if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) | ||
955 | subdesc_cnt += POST_CQE_DESC_COUNT; | ||
956 | |||
951 | if (skb_shinfo(skb)->nr_frags) | 957 | if (skb_shinfo(skb)->nr_frags) |
952 | subdesc_cnt += skb_shinfo(skb)->nr_frags; | 958 | subdesc_cnt += skb_shinfo(skb)->nr_frags; |
953 | 959 | ||
@@ -965,14 +971,21 @@ nicvf_sq_add_hdr_subdesc(struct nicvf *nic, struct snd_queue *sq, int qentry, | |||
965 | struct sq_hdr_subdesc *hdr; | 971 | struct sq_hdr_subdesc *hdr; |
966 | 972 | ||
967 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); | 973 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); |
968 | sq->skbuff[qentry] = (u64)skb; | ||
969 | |||
970 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); | 974 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); |
971 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; | 975 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; |
972 | /* Enable notification via CQE after processing SQE */ | 976 | |
973 | hdr->post_cqe = 1; | 977 | if (nic->t88 && nic->hw_tso && skb_shinfo(skb)->gso_size) { |
974 | /* No of subdescriptors following this */ | 978 | /* post_cqe = 0, to avoid HW posting a CQE for every TSO |
975 | hdr->subdesc_cnt = subdesc_cnt; | 979 | * segment transmitted on 88xx. |
980 | */ | ||
981 | hdr->subdesc_cnt = subdesc_cnt - POST_CQE_DESC_COUNT; | ||
982 | } else { | ||
983 | sq->skbuff[qentry] = (u64)skb; | ||
984 | /* Enable notification via CQE after processing SQE */ | ||
985 | hdr->post_cqe = 1; | ||
986 | /* No of subdescriptors following this */ | ||
987 | hdr->subdesc_cnt = subdesc_cnt; | ||
988 | } | ||
976 | hdr->tot_len = len; | 989 | hdr->tot_len = len; |
977 | 990 | ||
978 | /* Offload checksum calculation to HW */ | 991 | /* Offload checksum calculation to HW */ |
@@ -1023,6 +1036,37 @@ static inline void nicvf_sq_add_gather_subdesc(struct snd_queue *sq, int qentry, | |||
1023 | gather->addr = data; | 1036 | gather->addr = data; |
1024 | } | 1037 | } |
1025 | 1038 | ||
1039 | /* Add HDR + IMMEDIATE subdescriptors right after descriptors of a TSO | ||
1040 | * packet so that a CQE is posted as a notifation for transmission of | ||
1041 | * TSO packet. | ||
1042 | */ | ||
1043 | static inline void nicvf_sq_add_cqe_subdesc(struct snd_queue *sq, int qentry, | ||
1044 | int tso_sqe, struct sk_buff *skb) | ||
1045 | { | ||
1046 | struct sq_imm_subdesc *imm; | ||
1047 | struct sq_hdr_subdesc *hdr; | ||
1048 | |||
1049 | sq->skbuff[qentry] = (u64)skb; | ||
1050 | |||
1051 | hdr = (struct sq_hdr_subdesc *)GET_SQ_DESC(sq, qentry); | ||
1052 | memset(hdr, 0, SND_QUEUE_DESC_SIZE); | ||
1053 | hdr->subdesc_type = SQ_DESC_TYPE_HEADER; | ||
1054 | /* Enable notification via CQE after processing SQE */ | ||
1055 | hdr->post_cqe = 1; | ||
1056 | /* There is no packet to transmit here */ | ||
1057 | hdr->dont_send = 1; | ||
1058 | hdr->subdesc_cnt = POST_CQE_DESC_COUNT - 1; | ||
1059 | hdr->tot_len = 1; | ||
1060 | /* Actual TSO header SQE index, needed for cleanup */ | ||
1061 | hdr->rsvd2 = tso_sqe; | ||
1062 | |||
1063 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | ||
1064 | imm = (struct sq_imm_subdesc *)GET_SQ_DESC(sq, qentry); | ||
1065 | memset(imm, 0, SND_QUEUE_DESC_SIZE); | ||
1066 | imm->subdesc_type = SQ_DESC_TYPE_IMMEDIATE; | ||
1067 | imm->len = 1; | ||
1068 | } | ||
1069 | |||
1026 | /* Segment a TSO packet into 'gso_size' segments and append | 1070 | /* Segment a TSO packet into 'gso_size' segments and append |
1027 | * them to SQ for transfer | 1071 | * them to SQ for transfer |
1028 | */ | 1072 | */ |
@@ -1096,7 +1140,7 @@ static int nicvf_sq_append_tso(struct nicvf *nic, struct snd_queue *sq, | |||
1096 | int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | 1140 | int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) |
1097 | { | 1141 | { |
1098 | int i, size; | 1142 | int i, size; |
1099 | int subdesc_cnt; | 1143 | int subdesc_cnt, tso_sqe = 0; |
1100 | int sq_num, qentry; | 1144 | int sq_num, qentry; |
1101 | struct queue_set *qs; | 1145 | struct queue_set *qs; |
1102 | struct snd_queue *sq; | 1146 | struct snd_queue *sq; |
@@ -1131,6 +1175,7 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | |||
1131 | /* Add SQ header subdesc */ | 1175 | /* Add SQ header subdesc */ |
1132 | nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, | 1176 | nicvf_sq_add_hdr_subdesc(nic, sq, qentry, subdesc_cnt - 1, |
1133 | skb, skb->len); | 1177 | skb, skb->len); |
1178 | tso_sqe = qentry; | ||
1134 | 1179 | ||
1135 | /* Add SQ gather subdescs */ | 1180 | /* Add SQ gather subdescs */ |
1136 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | 1181 | qentry = nicvf_get_nxt_sqentry(sq, qentry); |
@@ -1154,6 +1199,11 @@ int nicvf_sq_append_skb(struct nicvf *nic, struct sk_buff *skb) | |||
1154 | } | 1199 | } |
1155 | 1200 | ||
1156 | doorbell: | 1201 | doorbell: |
1202 | if (nic->t88 && skb_shinfo(skb)->gso_size) { | ||
1203 | qentry = nicvf_get_nxt_sqentry(sq, qentry); | ||
1204 | nicvf_sq_add_cqe_subdesc(sq, qentry, tso_sqe, skb); | ||
1205 | } | ||
1206 | |||
1157 | /* make sure all memory stores are done before ringing doorbell */ | 1207 | /* make sure all memory stores are done before ringing doorbell */ |
1158 | smp_wmb(); | 1208 | smp_wmb(); |
1159 | 1209 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index 2e2aa9fec9bb..edd23386b47d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -419,8 +419,8 @@ struct link_config { | |||
419 | unsigned short supported; /* link capabilities */ | 419 | unsigned short supported; /* link capabilities */ |
420 | unsigned short advertising; /* advertised capabilities */ | 420 | unsigned short advertising; /* advertised capabilities */ |
421 | unsigned short lp_advertising; /* peer advertised capabilities */ | 421 | unsigned short lp_advertising; /* peer advertised capabilities */ |
422 | unsigned short requested_speed; /* speed user has requested */ | 422 | unsigned int requested_speed; /* speed user has requested */ |
423 | unsigned short speed; /* actual link speed */ | 423 | unsigned int speed; /* actual link speed */ |
424 | unsigned char requested_fc; /* flow control user has requested */ | 424 | unsigned char requested_fc; /* flow control user has requested */ |
425 | unsigned char fc; /* actual link flow control */ | 425 | unsigned char fc; /* actual link flow control */ |
426 | unsigned char autoneg; /* autonegotiating? */ | 426 | unsigned char autoneg; /* autonegotiating? */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c762a8c8c954..3ceafb55d6da 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -4305,10 +4305,17 @@ static const struct pci_error_handlers cxgb4_eeh = { | |||
4305 | .resume = eeh_resume, | 4305 | .resume = eeh_resume, |
4306 | }; | 4306 | }; |
4307 | 4307 | ||
4308 | /* Return true if the Link Configuration supports "High Speeds" (those greater | ||
4309 | * than 1Gb/s). | ||
4310 | */ | ||
4308 | static inline bool is_x_10g_port(const struct link_config *lc) | 4311 | static inline bool is_x_10g_port(const struct link_config *lc) |
4309 | { | 4312 | { |
4310 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 || | 4313 | unsigned int speeds, high_speeds; |
4311 | (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; | 4314 | |
4315 | speeds = FW_PORT_CAP_SPEED_V(FW_PORT_CAP_SPEED_G(lc->supported)); | ||
4316 | high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G); | ||
4317 | |||
4318 | return high_speeds != 0; | ||
4312 | } | 4319 | } |
4313 | 4320 | ||
4314 | static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, | 4321 | static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, |
@@ -4756,8 +4763,12 @@ static void print_port_info(const struct net_device *dev) | |||
4756 | bufp += sprintf(bufp, "1000/"); | 4763 | bufp += sprintf(bufp, "1000/"); |
4757 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) | 4764 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_10G) |
4758 | bufp += sprintf(bufp, "10G/"); | 4765 | bufp += sprintf(bufp, "10G/"); |
4766 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_25G) | ||
4767 | bufp += sprintf(bufp, "25G/"); | ||
4759 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) | 4768 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_40G) |
4760 | bufp += sprintf(bufp, "40G/"); | 4769 | bufp += sprintf(bufp, "40G/"); |
4770 | if (pi->link_cfg.supported & FW_PORT_CAP_SPEED_100G) | ||
4771 | bufp += sprintf(bufp, "100G/"); | ||
4761 | if (bufp != buf) | 4772 | if (bufp != buf) |
4762 | --bufp; | 4773 | --bufp; |
4763 | sprintf(bufp, "BASE-%s", t4_get_port_type_description(pi->port_type)); | 4774 | sprintf(bufp, "BASE-%s", t4_get_port_type_description(pi->port_type)); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index dc92c80a75f4..660204bff726 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -3627,7 +3627,8 @@ void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf) | |||
3627 | } | 3627 | } |
3628 | 3628 | ||
3629 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ | 3629 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ |
3630 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ | 3630 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ |
3631 | FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ | ||
3631 | FW_PORT_CAP_ANEG) | 3632 | FW_PORT_CAP_ANEG) |
3632 | 3633 | ||
3633 | /** | 3634 | /** |
@@ -7196,8 +7197,12 @@ void t4_handle_get_port_info(struct port_info *pi, const __be64 *rpl) | |||
7196 | speed = 1000; | 7197 | speed = 1000; |
7197 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) | 7198 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) |
7198 | speed = 10000; | 7199 | speed = 10000; |
7200 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G)) | ||
7201 | speed = 25000; | ||
7199 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) | 7202 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) |
7200 | speed = 40000; | 7203 | speed = 40000; |
7204 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G)) | ||
7205 | speed = 100000; | ||
7201 | 7206 | ||
7202 | lc = &pi->link_cfg; | 7207 | lc = &pi->link_cfg; |
7203 | 7208 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index a89b30720e38..30507d44422c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | |||
@@ -2265,6 +2265,12 @@ enum fw_port_cap { | |||
2265 | FW_PORT_CAP_802_3_ASM_DIR = 0x8000, | 2265 | FW_PORT_CAP_802_3_ASM_DIR = 0x8000, |
2266 | }; | 2266 | }; |
2267 | 2267 | ||
2268 | #define FW_PORT_CAP_SPEED_S 0 | ||
2269 | #define FW_PORT_CAP_SPEED_M 0x3f | ||
2270 | #define FW_PORT_CAP_SPEED_V(x) ((x) << FW_PORT_CAP_SPEED_S) | ||
2271 | #define FW_PORT_CAP_SPEED_G(x) \ | ||
2272 | (((x) >> FW_PORT_CAP_SPEED_S) & FW_PORT_CAP_SPEED_M) | ||
2273 | |||
2268 | enum fw_port_mdi { | 2274 | enum fw_port_mdi { |
2269 | FW_PORT_CAP_MDI_UNCHANGED, | 2275 | FW_PORT_CAP_MDI_UNCHANGED, |
2270 | FW_PORT_CAP_MDI_AUTO, | 2276 | FW_PORT_CAP_MDI_AUTO, |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h index 8ee541431e8b..17a2bbcf93f0 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | |||
@@ -108,8 +108,8 @@ struct link_config { | |||
108 | unsigned int supported; /* link capabilities */ | 108 | unsigned int supported; /* link capabilities */ |
109 | unsigned int advertising; /* advertised capabilities */ | 109 | unsigned int advertising; /* advertised capabilities */ |
110 | unsigned short lp_advertising; /* peer advertised capabilities */ | 110 | unsigned short lp_advertising; /* peer advertised capabilities */ |
111 | unsigned short requested_speed; /* speed user has requested */ | 111 | unsigned int requested_speed; /* speed user has requested */ |
112 | unsigned short speed; /* actual link speed */ | 112 | unsigned int speed; /* actual link speed */ |
113 | unsigned char requested_fc; /* flow control user has requested */ | 113 | unsigned char requested_fc; /* flow control user has requested */ |
114 | unsigned char fc; /* actual link flow control */ | 114 | unsigned char fc; /* actual link flow control */ |
115 | unsigned char autoneg; /* autonegotiating? */ | 115 | unsigned char autoneg; /* autonegotiating? */ |
@@ -271,10 +271,17 @@ static inline bool is_10g_port(const struct link_config *lc) | |||
271 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0; | 271 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0; |
272 | } | 272 | } |
273 | 273 | ||
274 | /* Return true if the Link Configuration supports "High Speeds" (those greater | ||
275 | * than 1Gb/s). | ||
276 | */ | ||
274 | static inline bool is_x_10g_port(const struct link_config *lc) | 277 | static inline bool is_x_10g_port(const struct link_config *lc) |
275 | { | 278 | { |
276 | return (lc->supported & FW_PORT_CAP_SPEED_10G) != 0 || | 279 | unsigned int speeds, high_speeds; |
277 | (lc->supported & FW_PORT_CAP_SPEED_40G) != 0; | 280 | |
281 | speeds = FW_PORT_CAP_SPEED_V(FW_PORT_CAP_SPEED_G(lc->supported)); | ||
282 | high_speeds = speeds & ~(FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G); | ||
283 | |||
284 | return high_speeds != 0; | ||
278 | } | 285 | } |
279 | 286 | ||
280 | static inline unsigned int core_ticks_per_usec(const struct adapter *adapter) | 287 | static inline unsigned int core_ticks_per_usec(const struct adapter *adapter) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c index 427bfa71388b..b5622b1689e9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | |||
@@ -314,8 +314,9 @@ int t4vf_wr_mbox_core(struct adapter *adapter, const void *cmd, int size, | |||
314 | } | 314 | } |
315 | 315 | ||
316 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ | 316 | #define ADVERT_MASK (FW_PORT_CAP_SPEED_100M | FW_PORT_CAP_SPEED_1G |\ |
317 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_40G | \ | 317 | FW_PORT_CAP_SPEED_10G | FW_PORT_CAP_SPEED_25G | \ |
318 | FW_PORT_CAP_SPEED_100G | FW_PORT_CAP_ANEG) | 318 | FW_PORT_CAP_SPEED_40G | FW_PORT_CAP_SPEED_100G | \ |
319 | FW_PORT_CAP_ANEG) | ||
319 | 320 | ||
320 | /** | 321 | /** |
321 | * init_link_config - initialize a link's SW state | 322 | * init_link_config - initialize a link's SW state |
@@ -1712,8 +1713,12 @@ int t4vf_handle_fw_rpl(struct adapter *adapter, const __be64 *rpl) | |||
1712 | speed = 1000; | 1713 | speed = 1000; |
1713 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) | 1714 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_10G)) |
1714 | speed = 10000; | 1715 | speed = 10000; |
1716 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_25G)) | ||
1717 | speed = 25000; | ||
1715 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) | 1718 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_40G)) |
1716 | speed = 40000; | 1719 | speed = 40000; |
1720 | else if (stat & FW_PORT_CMD_LSPEED_V(FW_PORT_CAP_SPEED_100G)) | ||
1721 | speed = 100000; | ||
1717 | 1722 | ||
1718 | /* | 1723 | /* |
1719 | * Scan all of our "ports" (Virtual Interfaces) looking for | 1724 | * Scan all of our "ports" (Virtual Interfaces) looking for |
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index 4c9771d57d6e..7af09cbc53f0 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c | |||
@@ -977,7 +977,37 @@ static void emac_set_multicast_list(struct net_device *ndev) | |||
977 | dev->mcast_pending = 1; | 977 | dev->mcast_pending = 1; |
978 | return; | 978 | return; |
979 | } | 979 | } |
980 | |||
981 | mutex_lock(&dev->link_lock); | ||
980 | __emac_set_multicast_list(dev); | 982 | __emac_set_multicast_list(dev); |
983 | mutex_unlock(&dev->link_lock); | ||
984 | } | ||
985 | |||
986 | static int emac_set_mac_address(struct net_device *ndev, void *sa) | ||
987 | { | ||
988 | struct emac_instance *dev = netdev_priv(ndev); | ||
989 | struct sockaddr *addr = sa; | ||
990 | struct emac_regs __iomem *p = dev->emacp; | ||
991 | |||
992 | if (!is_valid_ether_addr(addr->sa_data)) | ||
993 | return -EADDRNOTAVAIL; | ||
994 | |||
995 | mutex_lock(&dev->link_lock); | ||
996 | |||
997 | memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); | ||
998 | |||
999 | emac_rx_disable(dev); | ||
1000 | emac_tx_disable(dev); | ||
1001 | out_be32(&p->iahr, (ndev->dev_addr[0] << 8) | ndev->dev_addr[1]); | ||
1002 | out_be32(&p->ialr, (ndev->dev_addr[2] << 24) | | ||
1003 | (ndev->dev_addr[3] << 16) | (ndev->dev_addr[4] << 8) | | ||
1004 | ndev->dev_addr[5]); | ||
1005 | emac_tx_enable(dev); | ||
1006 | emac_rx_enable(dev); | ||
1007 | |||
1008 | mutex_unlock(&dev->link_lock); | ||
1009 | |||
1010 | return 0; | ||
981 | } | 1011 | } |
982 | 1012 | ||
983 | static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu) | 1013 | static int emac_resize_rx_ring(struct emac_instance *dev, int new_mtu) |
@@ -2686,7 +2716,7 @@ static const struct net_device_ops emac_netdev_ops = { | |||
2686 | .ndo_do_ioctl = emac_ioctl, | 2716 | .ndo_do_ioctl = emac_ioctl, |
2687 | .ndo_tx_timeout = emac_tx_timeout, | 2717 | .ndo_tx_timeout = emac_tx_timeout, |
2688 | .ndo_validate_addr = eth_validate_addr, | 2718 | .ndo_validate_addr = eth_validate_addr, |
2689 | .ndo_set_mac_address = eth_mac_addr, | 2719 | .ndo_set_mac_address = emac_set_mac_address, |
2690 | .ndo_start_xmit = emac_start_xmit, | 2720 | .ndo_start_xmit = emac_start_xmit, |
2691 | .ndo_change_mtu = eth_change_mtu, | 2721 | .ndo_change_mtu = eth_change_mtu, |
2692 | }; | 2722 | }; |
@@ -2699,7 +2729,7 @@ static const struct net_device_ops emac_gige_netdev_ops = { | |||
2699 | .ndo_do_ioctl = emac_ioctl, | 2729 | .ndo_do_ioctl = emac_ioctl, |
2700 | .ndo_tx_timeout = emac_tx_timeout, | 2730 | .ndo_tx_timeout = emac_tx_timeout, |
2701 | .ndo_validate_addr = eth_validate_addr, | 2731 | .ndo_validate_addr = eth_validate_addr, |
2702 | .ndo_set_mac_address = eth_mac_addr, | 2732 | .ndo_set_mac_address = emac_set_mac_address, |
2703 | .ndo_start_xmit = emac_start_xmit_sg, | 2733 | .ndo_start_xmit = emac_start_xmit_sg, |
2704 | .ndo_change_mtu = emac_change_mtu, | 2734 | .ndo_change_mtu = emac_change_mtu, |
2705 | }; | 2735 | }; |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index 828ed28c3c14..d0b3a1bb82ca 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -5113,9 +5113,13 @@ static int i40e_init_pf_dcb(struct i40e_pf *pf) | |||
5113 | DCB_CAP_DCBX_VER_IEEE; | 5113 | DCB_CAP_DCBX_VER_IEEE; |
5114 | 5114 | ||
5115 | pf->flags |= I40E_FLAG_DCB_CAPABLE; | 5115 | pf->flags |= I40E_FLAG_DCB_CAPABLE; |
5116 | /* Enable DCB tagging only when more than one TC */ | 5116 | /* Enable DCB tagging only when more than one TC |
5117 | * or explicitly disable if only one TC | ||
5118 | */ | ||
5117 | if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) | 5119 | if (i40e_dcb_get_num_tc(&hw->local_dcbx_config) > 1) |
5118 | pf->flags |= I40E_FLAG_DCB_ENABLED; | 5120 | pf->flags |= I40E_FLAG_DCB_ENABLED; |
5121 | else | ||
5122 | pf->flags &= ~I40E_FLAG_DCB_ENABLED; | ||
5119 | dev_dbg(&pf->pdev->dev, | 5123 | dev_dbg(&pf->pdev->dev, |
5120 | "DCBX offload is supported for this PF.\n"); | 5124 | "DCBX offload is supported for this PF.\n"); |
5121 | } | 5125 | } |
@@ -5716,7 +5720,7 @@ static int i40e_handle_lldp_event(struct i40e_pf *pf, | |||
5716 | u8 type; | 5720 | u8 type; |
5717 | 5721 | ||
5718 | /* Not DCB capable or capability disabled */ | 5722 | /* Not DCB capable or capability disabled */ |
5719 | if (!(pf->flags & I40E_FLAG_DCB_CAPABLE)) | 5723 | if (!(pf->flags & I40E_FLAG_DCB_ENABLED)) |
5720 | return ret; | 5724 | return ret; |
5721 | 5725 | ||
5722 | /* Ignore if event is not for Nearest Bridge */ | 5726 | /* Ignore if event is not for Nearest Bridge */ |
@@ -7896,6 +7900,7 @@ static int i40e_init_interrupt_scheme(struct i40e_pf *pf) | |||
7896 | #endif | 7900 | #endif |
7897 | I40E_FLAG_RSS_ENABLED | | 7901 | I40E_FLAG_RSS_ENABLED | |
7898 | I40E_FLAG_DCB_CAPABLE | | 7902 | I40E_FLAG_DCB_CAPABLE | |
7903 | I40E_FLAG_DCB_ENABLED | | ||
7899 | I40E_FLAG_SRIOV_ENABLED | | 7904 | I40E_FLAG_SRIOV_ENABLED | |
7900 | I40E_FLAG_FD_SB_ENABLED | | 7905 | I40E_FLAG_FD_SB_ENABLED | |
7901 | I40E_FLAG_FD_ATR_ENABLED | | 7906 | I40E_FLAG_FD_ATR_ENABLED | |
@@ -10502,6 +10507,7 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
10502 | I40E_FLAG_FD_SB_ENABLED | | 10507 | I40E_FLAG_FD_SB_ENABLED | |
10503 | I40E_FLAG_FD_ATR_ENABLED | | 10508 | I40E_FLAG_FD_ATR_ENABLED | |
10504 | I40E_FLAG_DCB_CAPABLE | | 10509 | I40E_FLAG_DCB_CAPABLE | |
10510 | I40E_FLAG_DCB_ENABLED | | ||
10505 | I40E_FLAG_SRIOV_ENABLED | | 10511 | I40E_FLAG_SRIOV_ENABLED | |
10506 | I40E_FLAG_VMDQ_ENABLED); | 10512 | I40E_FLAG_VMDQ_ENABLED); |
10507 | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | | 10513 | } else if (!(pf->flags & (I40E_FLAG_RSS_ENABLED | |
@@ -10525,7 +10531,8 @@ static void i40e_determine_queue_usage(struct i40e_pf *pf) | |||
10525 | /* Not enough queues for all TCs */ | 10531 | /* Not enough queues for all TCs */ |
10526 | if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && | 10532 | if ((pf->flags & I40E_FLAG_DCB_CAPABLE) && |
10527 | (queues_left < I40E_MAX_TRAFFIC_CLASS)) { | 10533 | (queues_left < I40E_MAX_TRAFFIC_CLASS)) { |
10528 | pf->flags &= ~I40E_FLAG_DCB_CAPABLE; | 10534 | pf->flags &= ~(I40E_FLAG_DCB_CAPABLE | |
10535 | I40E_FLAG_DCB_ENABLED); | ||
10529 | dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); | 10536 | dev_info(&pf->pdev->dev, "not enough queues for DCB. DCB is disabled.\n"); |
10530 | } | 10537 | } |
10531 | pf->num_lan_qps = max_t(int, pf->rss_size_max, | 10538 | pf->num_lan_qps = max_t(int, pf->rss_size_max, |
@@ -10922,7 +10929,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
10922 | err = i40e_init_pf_dcb(pf); | 10929 | err = i40e_init_pf_dcb(pf); |
10923 | if (err) { | 10930 | if (err) { |
10924 | dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); | 10931 | dev_info(&pdev->dev, "DCB init failed %d, disabled\n", err); |
10925 | pf->flags &= ~I40E_FLAG_DCB_CAPABLE; | 10932 | pf->flags &= ~(I40E_FLAG_DCB_CAPABLE & I40E_FLAG_DCB_ENABLED); |
10926 | /* Continue without DCB enabled */ | 10933 | /* Continue without DCB enabled */ |
10927 | } | 10934 | } |
10928 | #endif /* CONFIG_I40E_DCB */ | 10935 | #endif /* CONFIG_I40E_DCB */ |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index f1609542adf1..3743af8f1ded 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c | |||
@@ -50,6 +50,10 @@ static const struct mtk_ethtool_stats { | |||
50 | MTK_ETHTOOL_STAT(rx_flow_control_packets), | 50 | MTK_ETHTOOL_STAT(rx_flow_control_packets), |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static const char * const mtk_clks_source_name[] = { | ||
54 | "ethif", "esw", "gp1", "gp2" | ||
55 | }; | ||
56 | |||
53 | void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) | 57 | void mtk_w32(struct mtk_eth *eth, u32 val, unsigned reg) |
54 | { | 58 | { |
55 | __raw_writel(val, eth->base + reg); | 59 | __raw_writel(val, eth->base + reg); |
@@ -291,7 +295,7 @@ err_phy: | |||
291 | static int mtk_mdio_init(struct mtk_eth *eth) | 295 | static int mtk_mdio_init(struct mtk_eth *eth) |
292 | { | 296 | { |
293 | struct device_node *mii_np; | 297 | struct device_node *mii_np; |
294 | int err; | 298 | int ret; |
295 | 299 | ||
296 | mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); | 300 | mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); |
297 | if (!mii_np) { | 301 | if (!mii_np) { |
@@ -300,13 +304,13 @@ static int mtk_mdio_init(struct mtk_eth *eth) | |||
300 | } | 304 | } |
301 | 305 | ||
302 | if (!of_device_is_available(mii_np)) { | 306 | if (!of_device_is_available(mii_np)) { |
303 | err = 0; | 307 | ret = -ENODEV; |
304 | goto err_put_node; | 308 | goto err_put_node; |
305 | } | 309 | } |
306 | 310 | ||
307 | eth->mii_bus = mdiobus_alloc(); | 311 | eth->mii_bus = devm_mdiobus_alloc(eth->dev); |
308 | if (!eth->mii_bus) { | 312 | if (!eth->mii_bus) { |
309 | err = -ENOMEM; | 313 | ret = -ENOMEM; |
310 | goto err_put_node; | 314 | goto err_put_node; |
311 | } | 315 | } |
312 | 316 | ||
@@ -317,19 +321,11 @@ static int mtk_mdio_init(struct mtk_eth *eth) | |||
317 | eth->mii_bus->parent = eth->dev; | 321 | eth->mii_bus->parent = eth->dev; |
318 | 322 | ||
319 | snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); | 323 | snprintf(eth->mii_bus->id, MII_BUS_ID_SIZE, "%s", mii_np->name); |
320 | err = of_mdiobus_register(eth->mii_bus, mii_np); | 324 | ret = of_mdiobus_register(eth->mii_bus, mii_np); |
321 | if (err) | ||
322 | goto err_free_bus; | ||
323 | |||
324 | return 0; | ||
325 | |||
326 | err_free_bus: | ||
327 | mdiobus_free(eth->mii_bus); | ||
328 | 325 | ||
329 | err_put_node: | 326 | err_put_node: |
330 | of_node_put(mii_np); | 327 | of_node_put(mii_np); |
331 | eth->mii_bus = NULL; | 328 | return ret; |
332 | return err; | ||
333 | } | 329 | } |
334 | 330 | ||
335 | static void mtk_mdio_cleanup(struct mtk_eth *eth) | 331 | static void mtk_mdio_cleanup(struct mtk_eth *eth) |
@@ -338,8 +334,6 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth) | |||
338 | return; | 334 | return; |
339 | 335 | ||
340 | mdiobus_unregister(eth->mii_bus); | 336 | mdiobus_unregister(eth->mii_bus); |
341 | of_node_put(eth->mii_bus->dev.of_node); | ||
342 | mdiobus_free(eth->mii_bus); | ||
343 | } | 337 | } |
344 | 338 | ||
345 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) | 339 | static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) |
@@ -588,14 +582,15 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
588 | dma_addr_t mapped_addr; | 582 | dma_addr_t mapped_addr; |
589 | unsigned int nr_frags; | 583 | unsigned int nr_frags; |
590 | int i, n_desc = 1; | 584 | int i, n_desc = 1; |
591 | u32 txd4 = 0; | 585 | u32 txd4 = 0, fport; |
592 | 586 | ||
593 | itxd = ring->next_free; | 587 | itxd = ring->next_free; |
594 | if (itxd == ring->last_free) | 588 | if (itxd == ring->last_free) |
595 | return -ENOMEM; | 589 | return -ENOMEM; |
596 | 590 | ||
597 | /* set the forward port */ | 591 | /* set the forward port */ |
598 | txd4 |= (mac->id + 1) << TX_DMA_FPORT_SHIFT; | 592 | fport = (mac->id + 1) << TX_DMA_FPORT_SHIFT; |
593 | txd4 |= fport; | ||
599 | 594 | ||
600 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); | 595 | tx_buf = mtk_desc_to_tx_buf(ring, itxd); |
601 | memset(tx_buf, 0, sizeof(*tx_buf)); | 596 | memset(tx_buf, 0, sizeof(*tx_buf)); |
@@ -653,7 +648,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, | |||
653 | WRITE_ONCE(txd->txd3, (TX_DMA_SWC | | 648 | WRITE_ONCE(txd->txd3, (TX_DMA_SWC | |
654 | TX_DMA_PLEN0(frag_map_size) | | 649 | TX_DMA_PLEN0(frag_map_size) | |
655 | last_frag * TX_DMA_LS0)); | 650 | last_frag * TX_DMA_LS0)); |
656 | WRITE_ONCE(txd->txd4, 0); | 651 | WRITE_ONCE(txd->txd4, fport); |
657 | 652 | ||
658 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; | 653 | tx_buf->skb = (struct sk_buff *)MTK_DMA_DUMMY_DESC; |
659 | tx_buf = mtk_desc_to_tx_buf(ring, txd); | 654 | tx_buf = mtk_desc_to_tx_buf(ring, txd); |
@@ -865,7 +860,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, | |||
865 | /* receive data */ | 860 | /* receive data */ |
866 | skb = build_skb(data, ring->frag_size); | 861 | skb = build_skb(data, ring->frag_size); |
867 | if (unlikely(!skb)) { | 862 | if (unlikely(!skb)) { |
868 | put_page(virt_to_head_page(new_data)); | 863 | skb_free_frag(new_data); |
869 | netdev->stats.rx_dropped++; | 864 | netdev->stats.rx_dropped++; |
870 | goto release_desc; | 865 | goto release_desc; |
871 | } | 866 | } |
@@ -1506,10 +1501,7 @@ static void mtk_uninit(struct net_device *dev) | |||
1506 | struct mtk_eth *eth = mac->hw; | 1501 | struct mtk_eth *eth = mac->hw; |
1507 | 1502 | ||
1508 | phy_disconnect(mac->phy_dev); | 1503 | phy_disconnect(mac->phy_dev); |
1509 | mtk_mdio_cleanup(eth); | ||
1510 | mtk_irq_disable(eth, ~0); | 1504 | mtk_irq_disable(eth, ~0); |
1511 | free_irq(eth->irq[1], dev); | ||
1512 | free_irq(eth->irq[2], dev); | ||
1513 | } | 1505 | } |
1514 | 1506 | ||
1515 | static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 1507 | static int mtk_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
@@ -1813,6 +1805,7 @@ static int mtk_probe(struct platform_device *pdev) | |||
1813 | if (!eth) | 1805 | if (!eth) |
1814 | return -ENOMEM; | 1806 | return -ENOMEM; |
1815 | 1807 | ||
1808 | eth->dev = &pdev->dev; | ||
1816 | eth->base = devm_ioremap_resource(&pdev->dev, res); | 1809 | eth->base = devm_ioremap_resource(&pdev->dev, res); |
1817 | if (IS_ERR(eth->base)) | 1810 | if (IS_ERR(eth->base)) |
1818 | return PTR_ERR(eth->base); | 1811 | return PTR_ERR(eth->base); |
@@ -1847,21 +1840,21 @@ static int mtk_probe(struct platform_device *pdev) | |||
1847 | return -ENXIO; | 1840 | return -ENXIO; |
1848 | } | 1841 | } |
1849 | } | 1842 | } |
1843 | for (i = 0; i < ARRAY_SIZE(eth->clks); i++) { | ||
1844 | eth->clks[i] = devm_clk_get(eth->dev, | ||
1845 | mtk_clks_source_name[i]); | ||
1846 | if (IS_ERR(eth->clks[i])) { | ||
1847 | if (PTR_ERR(eth->clks[i]) == -EPROBE_DEFER) | ||
1848 | return -EPROBE_DEFER; | ||
1849 | return -ENODEV; | ||
1850 | } | ||
1851 | } | ||
1850 | 1852 | ||
1851 | eth->clk_ethif = devm_clk_get(&pdev->dev, "ethif"); | 1853 | clk_prepare_enable(eth->clks[MTK_CLK_ETHIF]); |
1852 | eth->clk_esw = devm_clk_get(&pdev->dev, "esw"); | 1854 | clk_prepare_enable(eth->clks[MTK_CLK_ESW]); |
1853 | eth->clk_gp1 = devm_clk_get(&pdev->dev, "gp1"); | 1855 | clk_prepare_enable(eth->clks[MTK_CLK_GP1]); |
1854 | eth->clk_gp2 = devm_clk_get(&pdev->dev, "gp2"); | 1856 | clk_prepare_enable(eth->clks[MTK_CLK_GP2]); |
1855 | if (IS_ERR(eth->clk_esw) || IS_ERR(eth->clk_gp1) || | ||
1856 | IS_ERR(eth->clk_gp2) || IS_ERR(eth->clk_ethif)) | ||
1857 | return -ENODEV; | ||
1858 | |||
1859 | clk_prepare_enable(eth->clk_ethif); | ||
1860 | clk_prepare_enable(eth->clk_esw); | ||
1861 | clk_prepare_enable(eth->clk_gp1); | ||
1862 | clk_prepare_enable(eth->clk_gp2); | ||
1863 | 1857 | ||
1864 | eth->dev = &pdev->dev; | ||
1865 | eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); | 1858 | eth->msg_enable = netif_msg_init(mtk_msg_level, MTK_DEFAULT_MSG_ENABLE); |
1866 | INIT_WORK(ð->pending_work, mtk_pending_work); | 1859 | INIT_WORK(ð->pending_work, mtk_pending_work); |
1867 | 1860 | ||
@@ -1903,15 +1896,24 @@ err_free_dev: | |||
1903 | static int mtk_remove(struct platform_device *pdev) | 1896 | static int mtk_remove(struct platform_device *pdev) |
1904 | { | 1897 | { |
1905 | struct mtk_eth *eth = platform_get_drvdata(pdev); | 1898 | struct mtk_eth *eth = platform_get_drvdata(pdev); |
1899 | int i; | ||
1906 | 1900 | ||
1907 | clk_disable_unprepare(eth->clk_ethif); | 1901 | /* stop all devices to make sure that dma is properly shut down */ |
1908 | clk_disable_unprepare(eth->clk_esw); | 1902 | for (i = 0; i < MTK_MAC_COUNT; i++) { |
1909 | clk_disable_unprepare(eth->clk_gp1); | 1903 | if (!eth->netdev[i]) |
1910 | clk_disable_unprepare(eth->clk_gp2); | 1904 | continue; |
1905 | mtk_stop(eth->netdev[i]); | ||
1906 | } | ||
1907 | |||
1908 | clk_disable_unprepare(eth->clks[MTK_CLK_ETHIF]); | ||
1909 | clk_disable_unprepare(eth->clks[MTK_CLK_ESW]); | ||
1910 | clk_disable_unprepare(eth->clks[MTK_CLK_GP1]); | ||
1911 | clk_disable_unprepare(eth->clks[MTK_CLK_GP2]); | ||
1911 | 1912 | ||
1912 | netif_napi_del(ð->tx_napi); | 1913 | netif_napi_del(ð->tx_napi); |
1913 | netif_napi_del(ð->rx_napi); | 1914 | netif_napi_del(ð->rx_napi); |
1914 | mtk_cleanup(eth); | 1915 | mtk_cleanup(eth); |
1916 | mtk_mdio_cleanup(eth); | ||
1915 | platform_set_drvdata(pdev, NULL); | 1917 | platform_set_drvdata(pdev, NULL); |
1916 | 1918 | ||
1917 | return 0; | 1919 | return 0; |
@@ -1921,6 +1923,7 @@ const struct of_device_id of_mtk_match[] = { | |||
1921 | { .compatible = "mediatek,mt7623-eth" }, | 1923 | { .compatible = "mediatek,mt7623-eth" }, |
1922 | {}, | 1924 | {}, |
1923 | }; | 1925 | }; |
1926 | MODULE_DEVICE_TABLE(of, of_mtk_match); | ||
1924 | 1927 | ||
1925 | static struct platform_driver mtk_driver = { | 1928 | static struct platform_driver mtk_driver = { |
1926 | .probe = mtk_probe, | 1929 | .probe = mtk_probe, |
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index f82e3acb947b..6e1ade7a25c5 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h | |||
@@ -290,6 +290,17 @@ enum mtk_tx_flags { | |||
290 | MTK_TX_FLAGS_PAGE0 = 0x02, | 290 | MTK_TX_FLAGS_PAGE0 = 0x02, |
291 | }; | 291 | }; |
292 | 292 | ||
293 | /* This enum allows us to identify how the clock is defined on the array of the | ||
294 | * clock in the order | ||
295 | */ | ||
296 | enum mtk_clks_map { | ||
297 | MTK_CLK_ETHIF, | ||
298 | MTK_CLK_ESW, | ||
299 | MTK_CLK_GP1, | ||
300 | MTK_CLK_GP2, | ||
301 | MTK_CLK_MAX | ||
302 | }; | ||
303 | |||
293 | /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at | 304 | /* struct mtk_tx_buf - This struct holds the pointers to the memory pointed at |
294 | * by the TX descriptor s | 305 | * by the TX descriptor s |
295 | * @skb: The SKB pointer of the packet being sent | 306 | * @skb: The SKB pointer of the packet being sent |
@@ -370,10 +381,7 @@ struct mtk_rx_ring { | |||
370 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring | 381 | * @scratch_ring: Newer SoCs need memory for a second HW managed TX ring |
371 | * @phy_scratch_ring: physical address of scratch_ring | 382 | * @phy_scratch_ring: physical address of scratch_ring |
372 | * @scratch_head: The scratch memory that scratch_ring points to. | 383 | * @scratch_head: The scratch memory that scratch_ring points to. |
373 | * @clk_ethif: The ethif clock | 384 | * @clks: clock array for all clocks required |
374 | * @clk_esw: The switch clock | ||
375 | * @clk_gp1: The gmac1 clock | ||
376 | * @clk_gp2: The gmac2 clock | ||
377 | * @mii_bus: If there is a bus we need to create an instance for it | 385 | * @mii_bus: If there is a bus we need to create an instance for it |
378 | * @pending_work: The workqueue used to reset the dma ring | 386 | * @pending_work: The workqueue used to reset the dma ring |
379 | */ | 387 | */ |
@@ -400,10 +408,8 @@ struct mtk_eth { | |||
400 | struct mtk_tx_dma *scratch_ring; | 408 | struct mtk_tx_dma *scratch_ring; |
401 | dma_addr_t phy_scratch_ring; | 409 | dma_addr_t phy_scratch_ring; |
402 | void *scratch_head; | 410 | void *scratch_head; |
403 | struct clk *clk_ethif; | 411 | struct clk *clks[MTK_CLK_MAX]; |
404 | struct clk *clk_esw; | 412 | |
405 | struct clk *clk_gp1; | ||
406 | struct clk *clk_gp2; | ||
407 | struct mii_bus *mii_bus; | 413 | struct mii_bus *mii_bus; |
408 | struct work_struct pending_work; | 414 | struct work_struct pending_work; |
409 | }; | 415 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c index 99c6bbdff501..b04760a5034b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_dcb_nl.c | |||
@@ -94,7 +94,7 @@ static u8 mlx4_en_dcbnl_getcap(struct net_device *dev, int capid, u8 *cap) | |||
94 | *cap = true; | 94 | *cap = true; |
95 | break; | 95 | break; |
96 | case DCB_CAP_ATTR_DCBX: | 96 | case DCB_CAP_ATTR_DCBX: |
97 | *cap = priv->cee_params.dcbx_cap; | 97 | *cap = priv->dcbx_cap; |
98 | break; | 98 | break; |
99 | case DCB_CAP_ATTR_PFC_TCS: | 99 | case DCB_CAP_ATTR_PFC_TCS: |
100 | *cap = 1 << mlx4_max_tc(priv->mdev->dev); | 100 | *cap = 1 << mlx4_max_tc(priv->mdev->dev); |
@@ -111,14 +111,14 @@ static u8 mlx4_en_dcbnl_getpfcstate(struct net_device *netdev) | |||
111 | { | 111 | { |
112 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 112 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
113 | 113 | ||
114 | return priv->cee_params.dcb_cfg.pfc_state; | 114 | return priv->cee_config.pfc_state; |
115 | } | 115 | } |
116 | 116 | ||
117 | static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) | 117 | static void mlx4_en_dcbnl_setpfcstate(struct net_device *netdev, u8 state) |
118 | { | 118 | { |
119 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 119 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
120 | 120 | ||
121 | priv->cee_params.dcb_cfg.pfc_state = state; | 121 | priv->cee_config.pfc_state = state; |
122 | } | 122 | } |
123 | 123 | ||
124 | static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | 124 | static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
@@ -126,7 +126,7 @@ static void mlx4_en_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | |||
126 | { | 126 | { |
127 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 127 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
128 | 128 | ||
129 | *setting = priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc; | 129 | *setting = priv->cee_config.dcb_pfc[priority]; |
130 | } | 130 | } |
131 | 131 | ||
132 | static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | 132 | static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, |
@@ -134,8 +134,8 @@ static void mlx4_en_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | |||
134 | { | 134 | { |
135 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 135 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
136 | 136 | ||
137 | priv->cee_params.dcb_cfg.tc_config[priority].dcb_pfc = setting; | 137 | priv->cee_config.dcb_pfc[priority] = setting; |
138 | priv->cee_params.dcb_cfg.pfc_state = true; | 138 | priv->cee_config.pfc_state = true; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) | 141 | static int mlx4_en_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) |
@@ -157,13 +157,11 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) | |||
157 | { | 157 | { |
158 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 158 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
159 | struct mlx4_en_dev *mdev = priv->mdev; | 159 | struct mlx4_en_dev *mdev = priv->mdev; |
160 | struct mlx4_en_cee_config *dcb_cfg = &priv->cee_params.dcb_cfg; | ||
161 | int err = 0; | ||
162 | 160 | ||
163 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 161 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
164 | return -EINVAL; | 162 | return 1; |
165 | 163 | ||
166 | if (dcb_cfg->pfc_state) { | 164 | if (priv->cee_config.pfc_state) { |
167 | int tc; | 165 | int tc; |
168 | 166 | ||
169 | priv->prof->rx_pause = 0; | 167 | priv->prof->rx_pause = 0; |
@@ -171,7 +169,7 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) | |||
171 | for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { | 169 | for (tc = 0; tc < CEE_DCBX_MAX_PRIO; tc++) { |
172 | u8 tc_mask = 1 << tc; | 170 | u8 tc_mask = 1 << tc; |
173 | 171 | ||
174 | switch (dcb_cfg->tc_config[tc].dcb_pfc) { | 172 | switch (priv->cee_config.dcb_pfc[tc]) { |
175 | case pfc_disabled: | 173 | case pfc_disabled: |
176 | priv->prof->tx_ppp &= ~tc_mask; | 174 | priv->prof->tx_ppp &= ~tc_mask; |
177 | priv->prof->rx_ppp &= ~tc_mask; | 175 | priv->prof->rx_ppp &= ~tc_mask; |
@@ -199,15 +197,17 @@ static u8 mlx4_en_dcbnl_set_all(struct net_device *netdev) | |||
199 | en_dbg(DRV, priv, "Set pfc off\n"); | 197 | en_dbg(DRV, priv, "Set pfc off\n"); |
200 | } | 198 | } |
201 | 199 | ||
202 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 200 | if (mlx4_SET_PORT_general(mdev->dev, priv->port, |
203 | priv->rx_skb_size + ETH_FCS_LEN, | 201 | priv->rx_skb_size + ETH_FCS_LEN, |
204 | priv->prof->tx_pause, | 202 | priv->prof->tx_pause, |
205 | priv->prof->tx_ppp, | 203 | priv->prof->tx_ppp, |
206 | priv->prof->rx_pause, | 204 | priv->prof->rx_pause, |
207 | priv->prof->rx_ppp); | 205 | priv->prof->rx_ppp)) { |
208 | if (err) | ||
209 | en_err(priv, "Failed setting pause params\n"); | 206 | en_err(priv, "Failed setting pause params\n"); |
210 | return err; | 207 | return 1; |
208 | } | ||
209 | |||
210 | return 0; | ||
211 | } | 211 | } |
212 | 212 | ||
213 | static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) | 213 | static u8 mlx4_en_dcbnl_get_state(struct net_device *dev) |
@@ -225,7 +225,7 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) | |||
225 | struct mlx4_en_priv *priv = netdev_priv(dev); | 225 | struct mlx4_en_priv *priv = netdev_priv(dev); |
226 | int num_tcs = 0; | 226 | int num_tcs = 0; |
227 | 227 | ||
228 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 228 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
229 | return 1; | 229 | return 1; |
230 | 230 | ||
231 | if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) | 231 | if (!!(state) == !!(priv->flags & MLX4_EN_FLAG_DCB_ENABLED)) |
@@ -238,7 +238,10 @@ static u8 mlx4_en_dcbnl_set_state(struct net_device *dev, u8 state) | |||
238 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; | 238 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; |
239 | } | 239 | } |
240 | 240 | ||
241 | return mlx4_en_setup_tc(dev, num_tcs); | 241 | if (mlx4_en_setup_tc(dev, num_tcs)) |
242 | return 1; | ||
243 | |||
244 | return 0; | ||
242 | } | 245 | } |
243 | 246 | ||
244 | /* On success returns a non-zero 802.1p user priority bitmap | 247 | /* On success returns a non-zero 802.1p user priority bitmap |
@@ -252,7 +255,7 @@ static int mlx4_en_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) | |||
252 | .selector = idtype, | 255 | .selector = idtype, |
253 | .protocol = id, | 256 | .protocol = id, |
254 | }; | 257 | }; |
255 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 258 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
256 | return 0; | 259 | return 0; |
257 | 260 | ||
258 | return dcb_getapp(netdev, &app); | 261 | return dcb_getapp(netdev, &app); |
@@ -264,7 +267,7 @@ static int mlx4_en_dcbnl_setapp(struct net_device *netdev, u8 idtype, | |||
264 | struct mlx4_en_priv *priv = netdev_priv(netdev); | 267 | struct mlx4_en_priv *priv = netdev_priv(netdev); |
265 | struct dcb_app app; | 268 | struct dcb_app app; |
266 | 269 | ||
267 | if (!(priv->cee_params.dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 270 | if (!(priv->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
268 | return -EINVAL; | 271 | return -EINVAL; |
269 | 272 | ||
270 | memset(&app, 0, sizeof(struct dcb_app)); | 273 | memset(&app, 0, sizeof(struct dcb_app)); |
@@ -433,7 +436,7 @@ static u8 mlx4_en_dcbnl_getdcbx(struct net_device *dev) | |||
433 | { | 436 | { |
434 | struct mlx4_en_priv *priv = netdev_priv(dev); | 437 | struct mlx4_en_priv *priv = netdev_priv(dev); |
435 | 438 | ||
436 | return priv->cee_params.dcbx_cap; | 439 | return priv->dcbx_cap; |
437 | } | 440 | } |
438 | 441 | ||
439 | static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | 442 | static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) |
@@ -442,7 +445,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
442 | struct ieee_ets ets = {0}; | 445 | struct ieee_ets ets = {0}; |
443 | struct ieee_pfc pfc = {0}; | 446 | struct ieee_pfc pfc = {0}; |
444 | 447 | ||
445 | if (mode == priv->cee_params.dcbx_cap) | 448 | if (mode == priv->dcbx_cap) |
446 | return 0; | 449 | return 0; |
447 | 450 | ||
448 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || | 451 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || |
@@ -451,7 +454,7 @@ static u8 mlx4_en_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
451 | !(mode & DCB_CAP_DCBX_HOST)) | 454 | !(mode & DCB_CAP_DCBX_HOST)) |
452 | goto err; | 455 | goto err; |
453 | 456 | ||
454 | priv->cee_params.dcbx_cap = mode; | 457 | priv->dcbx_cap = mode; |
455 | 458 | ||
456 | ets.ets_cap = IEEE_8021QAZ_MAX_TCS; | 459 | ets.ets_cap = IEEE_8021QAZ_MAX_TCS; |
457 | pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; | 460 | pfc.pfc_cap = IEEE_8021QAZ_MAX_TCS; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 4198e9bf89d0..fedb829276f4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -71,10 +71,11 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) | |||
71 | #ifdef CONFIG_MLX4_EN_DCB | 71 | #ifdef CONFIG_MLX4_EN_DCB |
72 | if (!mlx4_is_slave(priv->mdev->dev)) { | 72 | if (!mlx4_is_slave(priv->mdev->dev)) { |
73 | if (up) { | 73 | if (up) { |
74 | priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; | 74 | if (priv->dcbx_cap) |
75 | priv->flags |= MLX4_EN_FLAG_DCB_ENABLED; | ||
75 | } else { | 76 | } else { |
76 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; | 77 | priv->flags &= ~MLX4_EN_FLAG_DCB_ENABLED; |
77 | priv->cee_params.dcb_cfg.pfc_state = false; | 78 | priv->cee_config.pfc_state = false; |
78 | } | 79 | } |
79 | } | 80 | } |
80 | #endif /* CONFIG_MLX4_EN_DCB */ | 81 | #endif /* CONFIG_MLX4_EN_DCB */ |
@@ -3048,9 +3049,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
3048 | struct mlx4_en_priv *priv; | 3049 | struct mlx4_en_priv *priv; |
3049 | int i; | 3050 | int i; |
3050 | int err; | 3051 | int err; |
3051 | #ifdef CONFIG_MLX4_EN_DCB | ||
3052 | struct tc_configuration *tc; | ||
3053 | #endif | ||
3054 | 3052 | ||
3055 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), | 3053 | dev = alloc_etherdev_mqs(sizeof(struct mlx4_en_priv), |
3056 | MAX_TX_RINGS, MAX_RX_RINGS); | 3054 | MAX_TX_RINGS, MAX_RX_RINGS); |
@@ -3117,16 +3115,13 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
3117 | priv->msg_enable = MLX4_EN_MSG_LEVEL; | 3115 | priv->msg_enable = MLX4_EN_MSG_LEVEL; |
3118 | #ifdef CONFIG_MLX4_EN_DCB | 3116 | #ifdef CONFIG_MLX4_EN_DCB |
3119 | if (!mlx4_is_slave(priv->mdev->dev)) { | 3117 | if (!mlx4_is_slave(priv->mdev->dev)) { |
3120 | priv->cee_params.dcbx_cap = DCB_CAP_DCBX_VER_CEE | | 3118 | priv->dcbx_cap = DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_HOST | |
3121 | DCB_CAP_DCBX_HOST | | 3119 | DCB_CAP_DCBX_VER_IEEE; |
3122 | DCB_CAP_DCBX_VER_IEEE; | ||
3123 | priv->flags |= MLX4_EN_DCB_ENABLED; | 3120 | priv->flags |= MLX4_EN_DCB_ENABLED; |
3124 | priv->cee_params.dcb_cfg.pfc_state = false; | 3121 | priv->cee_config.pfc_state = false; |
3125 | 3122 | ||
3126 | for (i = 0; i < MLX4_EN_NUM_UP; i++) { | 3123 | for (i = 0; i < MLX4_EN_NUM_UP; i++) |
3127 | tc = &priv->cee_params.dcb_cfg.tc_config[i]; | 3124 | priv->cee_config.dcb_pfc[i] = pfc_disabled; |
3128 | tc->dcb_pfc = pfc_disabled; | ||
3129 | } | ||
3130 | 3125 | ||
3131 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { | 3126 | if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETS_CFG) { |
3132 | dev->dcbnl_ops = &mlx4_en_dcbnl_ops; | 3127 | dev->dcbnl_ops = &mlx4_en_dcbnl_ops; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 9df87ca0515a..e2509bba3e7c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -818,7 +818,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
818 | real_size = get_real_size(skb, shinfo, dev, &lso_header_size, | 818 | real_size = get_real_size(skb, shinfo, dev, &lso_header_size, |
819 | &inline_ok, &fragptr); | 819 | &inline_ok, &fragptr); |
820 | if (unlikely(!real_size)) | 820 | if (unlikely(!real_size)) |
821 | goto tx_drop; | 821 | goto tx_drop_count; |
822 | 822 | ||
823 | /* Align descriptor to TXBB size */ | 823 | /* Align descriptor to TXBB size */ |
824 | desc_size = ALIGN(real_size, TXBB_SIZE); | 824 | desc_size = ALIGN(real_size, TXBB_SIZE); |
@@ -826,7 +826,7 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
826 | if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { | 826 | if (unlikely(nr_txbb > MAX_DESC_TXBBS)) { |
827 | if (netif_msg_tx_err(priv)) | 827 | if (netif_msg_tx_err(priv)) |
828 | en_warn(priv, "Oversized header or SG list\n"); | 828 | en_warn(priv, "Oversized header or SG list\n"); |
829 | goto tx_drop; | 829 | goto tx_drop_count; |
830 | } | 830 | } |
831 | 831 | ||
832 | bf_ok = ring->bf_enabled; | 832 | bf_ok = ring->bf_enabled; |
@@ -1071,9 +1071,10 @@ tx_drop_unmap: | |||
1071 | PCI_DMA_TODEVICE); | 1071 | PCI_DMA_TODEVICE); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | tx_drop_count: | ||
1075 | ring->tx_dropped++; | ||
1074 | tx_drop: | 1076 | tx_drop: |
1075 | dev_kfree_skb_any(skb); | 1077 | dev_kfree_skb_any(skb); |
1076 | ring->tx_dropped++; | ||
1077 | return NETDEV_TX_OK; | 1078 | return NETDEV_TX_OK; |
1078 | } | 1079 | } |
1079 | 1080 | ||
@@ -1106,7 +1107,7 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, | |||
1106 | goto tx_drop; | 1107 | goto tx_drop; |
1107 | 1108 | ||
1108 | if (mlx4_en_is_tx_ring_full(ring)) | 1109 | if (mlx4_en_is_tx_ring_full(ring)) |
1109 | goto tx_drop; | 1110 | goto tx_drop_count; |
1110 | 1111 | ||
1111 | /* fetch ring->cons far ahead before needing it to avoid stall */ | 1112 | /* fetch ring->cons far ahead before needing it to avoid stall */ |
1112 | ring_cons = READ_ONCE(ring->cons); | 1113 | ring_cons = READ_ONCE(ring->cons); |
@@ -1176,7 +1177,8 @@ netdev_tx_t mlx4_en_xmit_frame(struct mlx4_en_rx_alloc *frame, | |||
1176 | 1177 | ||
1177 | return NETDEV_TX_OK; | 1178 | return NETDEV_TX_OK; |
1178 | 1179 | ||
1179 | tx_drop: | 1180 | tx_drop_count: |
1180 | ring->tx_dropped++; | 1181 | ring->tx_dropped++; |
1182 | tx_drop: | ||
1181 | return NETDEV_TX_BUSY; | 1183 | return NETDEV_TX_BUSY; |
1182 | } | 1184 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index f613977455e0..cf8f8a72a801 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -1305,8 +1305,8 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) | |||
1305 | return 0; | 1305 | return 0; |
1306 | 1306 | ||
1307 | err_out_unmap: | 1307 | err_out_unmap: |
1308 | while (i >= 0) | 1308 | while (i > 0) |
1309 | mlx4_free_eq(dev, &priv->eq_table.eq[i--]); | 1309 | mlx4_free_eq(dev, &priv->eq_table.eq[--i]); |
1310 | #ifdef CONFIG_RFS_ACCEL | 1310 | #ifdef CONFIG_RFS_ACCEL |
1311 | for (i = 1; i <= dev->caps.num_ports; i++) { | 1311 | for (i = 1; i <= dev->caps.num_ports; i++) { |
1312 | if (mlx4_priv(dev)->port[i].rmap) { | 1312 | if (mlx4_priv(dev)->port[i].rmap) { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 75dd2e3d3059..7183ac4135d2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2970,6 +2970,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port) | |||
2970 | mlx4_err(dev, "Failed to create mtu file for port %d\n", port); | 2970 | mlx4_err(dev, "Failed to create mtu file for port %d\n", port); |
2971 | device_remove_file(&info->dev->persist->pdev->dev, | 2971 | device_remove_file(&info->dev->persist->pdev->dev, |
2972 | &info->port_attr); | 2972 | &info->port_attr); |
2973 | devlink_port_unregister(&info->devlink_port); | ||
2973 | info->port = -1; | 2974 | info->port = -1; |
2974 | } | 2975 | } |
2975 | 2976 | ||
@@ -2984,6 +2985,8 @@ static void mlx4_cleanup_port_info(struct mlx4_port_info *info) | |||
2984 | device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr); | 2985 | device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr); |
2985 | device_remove_file(&info->dev->persist->pdev->dev, | 2986 | device_remove_file(&info->dev->persist->pdev->dev, |
2986 | &info->port_mtu_attr); | 2987 | &info->port_mtu_attr); |
2988 | devlink_port_unregister(&info->devlink_port); | ||
2989 | |||
2987 | #ifdef CONFIG_RFS_ACCEL | 2990 | #ifdef CONFIG_RFS_ACCEL |
2988 | free_irq_cpu_rmap(info->rmap); | 2991 | free_irq_cpu_rmap(info->rmap); |
2989 | info->rmap = NULL; | 2992 | info->rmap = NULL; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 2c2913dcae98..9099dbd04951 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -482,20 +482,10 @@ enum dcb_pfc_type { | |||
482 | pfc_enabled_rx | 482 | pfc_enabled_rx |
483 | }; | 483 | }; |
484 | 484 | ||
485 | struct tc_configuration { | ||
486 | enum dcb_pfc_type dcb_pfc; | ||
487 | }; | ||
488 | |||
489 | struct mlx4_en_cee_config { | 485 | struct mlx4_en_cee_config { |
490 | bool pfc_state; | 486 | bool pfc_state; |
491 | struct tc_configuration tc_config[MLX4_EN_NUM_UP]; | 487 | enum dcb_pfc_type dcb_pfc[MLX4_EN_NUM_UP]; |
492 | }; | 488 | }; |
493 | |||
494 | struct mlx4_en_cee_params { | ||
495 | u8 dcbx_cap; | ||
496 | struct mlx4_en_cee_config dcb_cfg; | ||
497 | }; | ||
498 | |||
499 | #endif | 489 | #endif |
500 | 490 | ||
501 | struct ethtool_flow_id { | 491 | struct ethtool_flow_id { |
@@ -624,7 +614,8 @@ struct mlx4_en_priv { | |||
624 | struct ieee_ets ets; | 614 | struct ieee_ets ets; |
625 | u16 maxrate[IEEE_8021QAZ_MAX_TCS]; | 615 | u16 maxrate[IEEE_8021QAZ_MAX_TCS]; |
626 | enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; | 616 | enum dcbnl_cndd_states cndd_state[IEEE_8021QAZ_MAX_TCS]; |
627 | struct mlx4_en_cee_params cee_params; | 617 | struct mlx4_en_cee_config cee_config; |
618 | u8 dcbx_cap; | ||
628 | #endif | 619 | #endif |
629 | #ifdef CONFIG_RFS_ACCEL | 620 | #ifdef CONFIG_RFS_ACCEL |
630 | spinlock_t filters_lock; | 621 | spinlock_t filters_lock; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 3d2095e5c61c..c5b2064297a1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -52,7 +52,7 @@ | |||
52 | 52 | ||
53 | #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 | 53 | #define MLX4_FLAG_V_IGNORE_FCS_MASK 0x2 |
54 | #define MLX4_IGNORE_FCS_MASK 0x1 | 54 | #define MLX4_IGNORE_FCS_MASK 0x1 |
55 | #define MLNX4_TX_MAX_NUMBER 8 | 55 | #define MLX4_TC_MAX_NUMBER 8 |
56 | 56 | ||
57 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) | 57 | void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table) |
58 | { | 58 | { |
@@ -2022,7 +2022,7 @@ int mlx4_max_tc(struct mlx4_dev *dev) | |||
2022 | u8 num_tc = dev->caps.max_tc_eth; | 2022 | u8 num_tc = dev->caps.max_tc_eth; |
2023 | 2023 | ||
2024 | if (!num_tc) | 2024 | if (!num_tc) |
2025 | num_tc = MLNX4_TX_MAX_NUMBER; | 2025 | num_tc = MLX4_TC_MAX_NUMBER; |
2026 | 2026 | ||
2027 | return num_tc; | 2027 | return num_tc; |
2028 | } | 2028 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index d0cf8fa22659..7a346bb2ed00 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -331,7 +331,7 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev, | |||
331 | if (mlx5e_query_global_pause_combined(priv)) { | 331 | if (mlx5e_query_global_pause_combined(priv)) { |
332 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { | 332 | for (i = 0; i < NUM_PPORT_PER_PRIO_PFC_COUNTERS; i++) { |
333 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], | 333 | data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[0], |
334 | pport_per_prio_pfc_stats_desc, 0); | 334 | pport_per_prio_pfc_stats_desc, i); |
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
@@ -659,9 +659,10 @@ out: | |||
659 | static void ptys2ethtool_supported_link(unsigned long *supported_modes, | 659 | static void ptys2ethtool_supported_link(unsigned long *supported_modes, |
660 | u32 eth_proto_cap) | 660 | u32 eth_proto_cap) |
661 | { | 661 | { |
662 | unsigned long proto_cap = eth_proto_cap; | ||
662 | int proto; | 663 | int proto; |
663 | 664 | ||
664 | for_each_set_bit(proto, (unsigned long *)ð_proto_cap, MLX5E_LINK_MODES_NUMBER) | 665 | for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) |
665 | bitmap_or(supported_modes, supported_modes, | 666 | bitmap_or(supported_modes, supported_modes, |
666 | ptys2ethtool_table[proto].supported, | 667 | ptys2ethtool_table[proto].supported, |
667 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 668 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
@@ -670,9 +671,10 @@ static void ptys2ethtool_supported_link(unsigned long *supported_modes, | |||
670 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, | 671 | static void ptys2ethtool_adver_link(unsigned long *advertising_modes, |
671 | u32 eth_proto_cap) | 672 | u32 eth_proto_cap) |
672 | { | 673 | { |
674 | unsigned long proto_cap = eth_proto_cap; | ||
673 | int proto; | 675 | int proto; |
674 | 676 | ||
675 | for_each_set_bit(proto, (unsigned long *)ð_proto_cap, MLX5E_LINK_MODES_NUMBER) | 677 | for_each_set_bit(proto, &proto_cap, MLX5E_LINK_MODES_NUMBER) |
676 | bitmap_or(advertising_modes, advertising_modes, | 678 | bitmap_or(advertising_modes, advertising_modes, |
677 | ptys2ethtool_table[proto].advertised, | 679 | ptys2ethtool_table[proto].advertised, |
678 | __ETHTOOL_LINK_MODE_MASK_NBITS); | 680 | __ETHTOOL_LINK_MODE_MASK_NBITS); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c index b6f8ebbdb487..e7c969df3dad 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | |||
@@ -637,24 +637,32 @@ bool mlx5e_post_rx_wqes(struct mlx5e_rq *rq) | |||
637 | static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, | 637 | static void mlx5e_lro_update_hdr(struct sk_buff *skb, struct mlx5_cqe64 *cqe, |
638 | u32 cqe_bcnt) | 638 | u32 cqe_bcnt) |
639 | { | 639 | { |
640 | struct ethhdr *eth = (struct ethhdr *)(skb->data); | 640 | struct ethhdr *eth = (struct ethhdr *)(skb->data); |
641 | struct iphdr *ipv4 = (struct iphdr *)(skb->data + ETH_HLEN); | 641 | struct iphdr *ipv4; |
642 | struct ipv6hdr *ipv6 = (struct ipv6hdr *)(skb->data + ETH_HLEN); | 642 | struct ipv6hdr *ipv6; |
643 | struct tcphdr *tcp; | 643 | struct tcphdr *tcp; |
644 | int network_depth = 0; | ||
645 | __be16 proto; | ||
646 | u16 tot_len; | ||
644 | 647 | ||
645 | u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); | 648 | u8 l4_hdr_type = get_cqe_l4_hdr_type(cqe); |
646 | int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || | 649 | int tcp_ack = ((CQE_L4_HDR_TYPE_TCP_ACK_NO_DATA == l4_hdr_type) || |
647 | (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); | 650 | (CQE_L4_HDR_TYPE_TCP_ACK_AND_DATA == l4_hdr_type)); |
648 | 651 | ||
649 | u16 tot_len = cqe_bcnt - ETH_HLEN; | 652 | skb->mac_len = ETH_HLEN; |
653 | proto = __vlan_get_protocol(skb, eth->h_proto, &network_depth); | ||
650 | 654 | ||
651 | if (eth->h_proto == htons(ETH_P_IP)) { | 655 | ipv4 = (struct iphdr *)(skb->data + network_depth); |
652 | tcp = (struct tcphdr *)(skb->data + ETH_HLEN + | 656 | ipv6 = (struct ipv6hdr *)(skb->data + network_depth); |
657 | tot_len = cqe_bcnt - network_depth; | ||
658 | |||
659 | if (proto == htons(ETH_P_IP)) { | ||
660 | tcp = (struct tcphdr *)(skb->data + network_depth + | ||
653 | sizeof(struct iphdr)); | 661 | sizeof(struct iphdr)); |
654 | ipv6 = NULL; | 662 | ipv6 = NULL; |
655 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 663 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
656 | } else { | 664 | } else { |
657 | tcp = (struct tcphdr *)(skb->data + ETH_HLEN + | 665 | tcp = (struct tcphdr *)(skb->data + network_depth + |
658 | sizeof(struct ipv6hdr)); | 666 | sizeof(struct ipv6hdr)); |
659 | ipv4 = NULL; | 667 | ipv4 = NULL; |
660 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 668 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 988eca99ee0f..eb0e72537f10 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
@@ -356,6 +356,7 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) | |||
356 | sq->stats.stopped++; | 356 | sq->stats.stopped++; |
357 | } | 357 | } |
358 | 358 | ||
359 | sq->stats.xmit_more += skb->xmit_more; | ||
359 | if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { | 360 | if (!skb->xmit_more || netif_xmit_stopped(sq->txq)) { |
360 | int bf_sz = 0; | 361 | int bf_sz = 0; |
361 | 362 | ||
@@ -375,7 +376,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb) | |||
375 | 376 | ||
376 | sq->stats.packets++; | 377 | sq->stats.packets++; |
377 | sq->stats.bytes += num_bytes; | 378 | sq->stats.bytes += num_bytes; |
378 | sq->stats.xmit_more += skb->xmit_more; | ||
379 | return NETDEV_TX_OK; | 379 | return NETDEV_TX_OK; |
380 | 380 | ||
381 | dma_unmap_wqe_err: | 381 | dma_unmap_wqe_err: |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 8b78f156214e..b247949df135 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
@@ -1554,6 +1554,7 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) | |||
1554 | 1554 | ||
1555 | abort: | 1555 | abort: |
1556 | esw_enable_vport(esw, 0, UC_ADDR_CHANGE); | 1556 | esw_enable_vport(esw, 0, UC_ADDR_CHANGE); |
1557 | esw->mode = SRIOV_NONE; | ||
1557 | return err; | 1558 | return err; |
1558 | } | 1559 | } |
1559 | 1560 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 3dc83a9459a4..7de40e6b0c25 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | |||
@@ -446,7 +446,7 @@ out: | |||
446 | 446 | ||
447 | static int esw_offloads_start(struct mlx5_eswitch *esw) | 447 | static int esw_offloads_start(struct mlx5_eswitch *esw) |
448 | { | 448 | { |
449 | int err, num_vfs = esw->dev->priv.sriov.num_vfs; | 449 | int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; |
450 | 450 | ||
451 | if (esw->mode != SRIOV_LEGACY) { | 451 | if (esw->mode != SRIOV_LEGACY) { |
452 | esw_warn(esw->dev, "Can't set offloads mode, SRIOV legacy not enabled\n"); | 452 | esw_warn(esw->dev, "Can't set offloads mode, SRIOV legacy not enabled\n"); |
@@ -455,8 +455,12 @@ static int esw_offloads_start(struct mlx5_eswitch *esw) | |||
455 | 455 | ||
456 | mlx5_eswitch_disable_sriov(esw); | 456 | mlx5_eswitch_disable_sriov(esw); |
457 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); | 457 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); |
458 | if (err) | 458 | if (err) { |
459 | esw_warn(esw->dev, "Failed set eswitch to offloads, err %d\n", err); | 459 | esw_warn(esw->dev, "Failed setting eswitch to offloads, err %d\n", err); |
460 | err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); | ||
461 | if (err1) | ||
462 | esw_warn(esw->dev, "Failed setting eswitch back to legacy, err %d\n", err); | ||
463 | } | ||
460 | return err; | 464 | return err; |
461 | } | 465 | } |
462 | 466 | ||
@@ -508,12 +512,16 @@ create_ft_err: | |||
508 | 512 | ||
509 | static int esw_offloads_stop(struct mlx5_eswitch *esw) | 513 | static int esw_offloads_stop(struct mlx5_eswitch *esw) |
510 | { | 514 | { |
511 | int err, num_vfs = esw->dev->priv.sriov.num_vfs; | 515 | int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs; |
512 | 516 | ||
513 | mlx5_eswitch_disable_sriov(esw); | 517 | mlx5_eswitch_disable_sriov(esw); |
514 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); | 518 | err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY); |
515 | if (err) | 519 | if (err) { |
516 | esw_warn(esw->dev, "Failed set eswitch legacy mode. err %d\n", err); | 520 | esw_warn(esw->dev, "Failed setting eswitch to legacy, err %d\n", err); |
521 | err1 = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_OFFLOADS); | ||
522 | if (err1) | ||
523 | esw_warn(esw->dev, "Failed setting eswitch back to offloads, err %d\n", err); | ||
524 | } | ||
517 | 525 | ||
518 | return err; | 526 | return err; |
519 | } | 527 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c index 9134010e2921..287ade151ec8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | |||
@@ -425,11 +425,11 @@ struct mlx5_cmd_fc_bulk * | |||
425 | mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u16 id, int num) | 425 | mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, u16 id, int num) |
426 | { | 426 | { |
427 | struct mlx5_cmd_fc_bulk *b; | 427 | struct mlx5_cmd_fc_bulk *b; |
428 | int outlen = sizeof(*b) + | 428 | int outlen = |
429 | MLX5_ST_SZ_BYTES(query_flow_counter_out) + | 429 | MLX5_ST_SZ_BYTES(query_flow_counter_out) + |
430 | MLX5_ST_SZ_BYTES(traffic_counter) * num; | 430 | MLX5_ST_SZ_BYTES(traffic_counter) * num; |
431 | 431 | ||
432 | b = kzalloc(outlen, GFP_KERNEL); | 432 | b = kzalloc(sizeof(*b) + outlen, GFP_KERNEL); |
433 | if (!b) | 433 | if (!b) |
434 | return NULL; | 434 | return NULL; |
435 | 435 | ||
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c index 7291f2c4b0c7..d48873bcbddf 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include <generated/utsrelease.h> | 56 | #include <generated/utsrelease.h> |
57 | #include <net/pkt_cls.h> | 57 | #include <net/pkt_cls.h> |
58 | #include <net/tc_act/tc_mirred.h> | 58 | #include <net/tc_act/tc_mirred.h> |
59 | #include <net/netevent.h> | ||
59 | 60 | ||
60 | #include "spectrum.h" | 61 | #include "spectrum.h" |
61 | #include "core.h" | 62 | #include "core.h" |
@@ -2105,6 +2106,13 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | |||
2105 | dev->netdev_ops = &mlxsw_sp_port_netdev_ops; | 2106 | dev->netdev_ops = &mlxsw_sp_port_netdev_ops; |
2106 | dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; | 2107 | dev->ethtool_ops = &mlxsw_sp_port_ethtool_ops; |
2107 | 2108 | ||
2109 | err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); | ||
2110 | if (err) { | ||
2111 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", | ||
2112 | mlxsw_sp_port->local_port); | ||
2113 | goto err_port_swid_set; | ||
2114 | } | ||
2115 | |||
2108 | err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); | 2116 | err = mlxsw_sp_port_dev_addr_init(mlxsw_sp_port); |
2109 | if (err) { | 2117 | if (err) { |
2110 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", | 2118 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Unable to init port mac address\n", |
@@ -2130,13 +2138,6 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port, | |||
2130 | goto err_port_system_port_mapping_set; | 2138 | goto err_port_system_port_mapping_set; |
2131 | } | 2139 | } |
2132 | 2140 | ||
2133 | err = mlxsw_sp_port_swid_set(mlxsw_sp_port, 0); | ||
2134 | if (err) { | ||
2135 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to set SWID\n", | ||
2136 | mlxsw_sp_port->local_port); | ||
2137 | goto err_port_swid_set; | ||
2138 | } | ||
2139 | |||
2140 | err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); | 2141 | err = mlxsw_sp_port_speed_by_width_set(mlxsw_sp_port, width); |
2141 | if (err) { | 2142 | if (err) { |
2142 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", | 2143 | dev_err(mlxsw_sp->bus_info->dev, "Port %d: Failed to enable speeds\n", |
@@ -2218,10 +2219,10 @@ err_port_buffers_init: | |||
2218 | err_port_admin_status_set: | 2219 | err_port_admin_status_set: |
2219 | err_port_mtu_set: | 2220 | err_port_mtu_set: |
2220 | err_port_speed_by_width_set: | 2221 | err_port_speed_by_width_set: |
2221 | mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); | ||
2222 | err_port_swid_set: | ||
2223 | err_port_system_port_mapping_set: | 2222 | err_port_system_port_mapping_set: |
2224 | err_dev_addr_init: | 2223 | err_dev_addr_init: |
2224 | mlxsw_sp_port_swid_set(mlxsw_sp_port, MLXSW_PORT_SWID_DISABLED_PORT); | ||
2225 | err_port_swid_set: | ||
2225 | free_percpu(mlxsw_sp_port->pcpu_stats); | 2226 | free_percpu(mlxsw_sp_port->pcpu_stats); |
2226 | err_alloc_stats: | 2227 | err_alloc_stats: |
2227 | kfree(mlxsw_sp_port->untagged_vlans); | 2228 | kfree(mlxsw_sp_port->untagged_vlans); |
@@ -4541,18 +4542,26 @@ static struct notifier_block mlxsw_sp_inetaddr_nb __read_mostly = { | |||
4541 | .priority = 10, /* Must be called before FIB notifier block */ | 4542 | .priority = 10, /* Must be called before FIB notifier block */ |
4542 | }; | 4543 | }; |
4543 | 4544 | ||
4545 | static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { | ||
4546 | .notifier_call = mlxsw_sp_router_netevent_event, | ||
4547 | }; | ||
4548 | |||
4544 | static int __init mlxsw_sp_module_init(void) | 4549 | static int __init mlxsw_sp_module_init(void) |
4545 | { | 4550 | { |
4546 | int err; | 4551 | int err; |
4547 | 4552 | ||
4548 | register_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4553 | register_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
4549 | register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | 4554 | register_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); |
4555 | register_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
4556 | |||
4550 | err = mlxsw_core_driver_register(&mlxsw_sp_driver); | 4557 | err = mlxsw_core_driver_register(&mlxsw_sp_driver); |
4551 | if (err) | 4558 | if (err) |
4552 | goto err_core_driver_register; | 4559 | goto err_core_driver_register; |
4553 | return 0; | 4560 | return 0; |
4554 | 4561 | ||
4555 | err_core_driver_register: | 4562 | err_core_driver_register: |
4563 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
4564 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | ||
4556 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4565 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
4557 | return err; | 4566 | return err; |
4558 | } | 4567 | } |
@@ -4560,6 +4569,7 @@ err_core_driver_register: | |||
4560 | static void __exit mlxsw_sp_module_exit(void) | 4569 | static void __exit mlxsw_sp_module_exit(void) |
4561 | { | 4570 | { |
4562 | mlxsw_core_driver_unregister(&mlxsw_sp_driver); | 4571 | mlxsw_core_driver_unregister(&mlxsw_sp_driver); |
4572 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
4563 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); | 4573 | unregister_inetaddr_notifier(&mlxsw_sp_inetaddr_nb); |
4564 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); | 4574 | unregister_netdevice_notifier(&mlxsw_sp_netdevice_nb); |
4565 | } | 4575 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h index ab3feb81bd43..ac48abebe904 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h | |||
@@ -587,6 +587,8 @@ int mlxsw_sp_router_neigh_construct(struct net_device *dev, | |||
587 | struct neighbour *n); | 587 | struct neighbour *n); |
588 | void mlxsw_sp_router_neigh_destroy(struct net_device *dev, | 588 | void mlxsw_sp_router_neigh_destroy(struct net_device *dev, |
589 | struct neighbour *n); | 589 | struct neighbour *n); |
590 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | ||
591 | unsigned long event, void *ptr); | ||
590 | 592 | ||
591 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); | 593 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count); |
592 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); | 594 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c index 917ddd1e422f..3f5c51da6d3e 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | |||
@@ -107,6 +107,7 @@ mlxsw_sp_prefix_usage_clear(struct mlxsw_sp_prefix_usage *prefix_usage, | |||
107 | } | 107 | } |
108 | 108 | ||
109 | struct mlxsw_sp_fib_key { | 109 | struct mlxsw_sp_fib_key { |
110 | struct net_device *dev; | ||
110 | unsigned char addr[sizeof(struct in6_addr)]; | 111 | unsigned char addr[sizeof(struct in6_addr)]; |
111 | unsigned char prefix_len; | 112 | unsigned char prefix_len; |
112 | }; | 113 | }; |
@@ -123,7 +124,7 @@ struct mlxsw_sp_fib_entry { | |||
123 | struct rhash_head ht_node; | 124 | struct rhash_head ht_node; |
124 | struct mlxsw_sp_fib_key key; | 125 | struct mlxsw_sp_fib_key key; |
125 | enum mlxsw_sp_fib_entry_type type; | 126 | enum mlxsw_sp_fib_entry_type type; |
126 | u8 added:1; | 127 | unsigned int ref_count; |
127 | u16 rif; /* used for action local */ | 128 | u16 rif; /* used for action local */ |
128 | struct mlxsw_sp_vr *vr; | 129 | struct mlxsw_sp_vr *vr; |
129 | struct list_head nexthop_group_node; | 130 | struct list_head nexthop_group_node; |
@@ -171,13 +172,15 @@ static void mlxsw_sp_fib_entry_remove(struct mlxsw_sp_fib *fib, | |||
171 | 172 | ||
172 | static struct mlxsw_sp_fib_entry * | 173 | static struct mlxsw_sp_fib_entry * |
173 | mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, | 174 | mlxsw_sp_fib_entry_create(struct mlxsw_sp_fib *fib, const void *addr, |
174 | size_t addr_len, unsigned char prefix_len) | 175 | size_t addr_len, unsigned char prefix_len, |
176 | struct net_device *dev) | ||
175 | { | 177 | { |
176 | struct mlxsw_sp_fib_entry *fib_entry; | 178 | struct mlxsw_sp_fib_entry *fib_entry; |
177 | 179 | ||
178 | fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); | 180 | fib_entry = kzalloc(sizeof(*fib_entry), GFP_KERNEL); |
179 | if (!fib_entry) | 181 | if (!fib_entry) |
180 | return NULL; | 182 | return NULL; |
183 | fib_entry->key.dev = dev; | ||
181 | memcpy(fib_entry->key.addr, addr, addr_len); | 184 | memcpy(fib_entry->key.addr, addr, addr_len); |
182 | fib_entry->key.prefix_len = prefix_len; | 185 | fib_entry->key.prefix_len = prefix_len; |
183 | return fib_entry; | 186 | return fib_entry; |
@@ -190,10 +193,13 @@ static void mlxsw_sp_fib_entry_destroy(struct mlxsw_sp_fib_entry *fib_entry) | |||
190 | 193 | ||
191 | static struct mlxsw_sp_fib_entry * | 194 | static struct mlxsw_sp_fib_entry * |
192 | mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, | 195 | mlxsw_sp_fib_entry_lookup(struct mlxsw_sp_fib *fib, const void *addr, |
193 | size_t addr_len, unsigned char prefix_len) | 196 | size_t addr_len, unsigned char prefix_len, |
197 | struct net_device *dev) | ||
194 | { | 198 | { |
195 | struct mlxsw_sp_fib_key key = {{ 0 } }; | 199 | struct mlxsw_sp_fib_key key; |
196 | 200 | ||
201 | memset(&key, 0, sizeof(key)); | ||
202 | key.dev = dev; | ||
197 | memcpy(key.addr, addr, addr_len); | 203 | memcpy(key.addr, addr, addr_len); |
198 | key.prefix_len = prefix_len; | 204 | key.prefix_len = prefix_len; |
199 | return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); | 205 | return rhashtable_lookup_fast(&fib->ht, &key, mlxsw_sp_fib_ht_params); |
@@ -938,8 +944,8 @@ static void mlxsw_sp_router_neigh_update_hw(struct work_struct *work) | |||
938 | mlxsw_sp_port_dev_put(mlxsw_sp_port); | 944 | mlxsw_sp_port_dev_put(mlxsw_sp_port); |
939 | } | 945 | } |
940 | 946 | ||
941 | static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | 947 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, |
942 | unsigned long event, void *ptr) | 948 | unsigned long event, void *ptr) |
943 | { | 949 | { |
944 | struct mlxsw_sp_neigh_entry *neigh_entry; | 950 | struct mlxsw_sp_neigh_entry *neigh_entry; |
945 | struct mlxsw_sp_port *mlxsw_sp_port; | 951 | struct mlxsw_sp_port *mlxsw_sp_port; |
@@ -1009,10 +1015,6 @@ static int mlxsw_sp_router_netevent_event(struct notifier_block *unused, | |||
1009 | return NOTIFY_DONE; | 1015 | return NOTIFY_DONE; |
1010 | } | 1016 | } |
1011 | 1017 | ||
1012 | static struct notifier_block mlxsw_sp_router_netevent_nb __read_mostly = { | ||
1013 | .notifier_call = mlxsw_sp_router_netevent_event, | ||
1014 | }; | ||
1015 | |||
1016 | static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | 1018 | static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) |
1017 | { | 1019 | { |
1018 | int err; | 1020 | int err; |
@@ -1027,10 +1029,6 @@ static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | |||
1027 | */ | 1029 | */ |
1028 | mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); | 1030 | mlxsw_sp_router_neighs_update_interval_init(mlxsw_sp); |
1029 | 1031 | ||
1030 | err = register_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
1031 | if (err) | ||
1032 | goto err_register_netevent_notifier; | ||
1033 | |||
1034 | /* Create the delayed works for the activity_update */ | 1032 | /* Create the delayed works for the activity_update */ |
1035 | INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, | 1033 | INIT_DELAYED_WORK(&mlxsw_sp->router.neighs_update.dw, |
1036 | mlxsw_sp_router_neighs_update_work); | 1034 | mlxsw_sp_router_neighs_update_work); |
@@ -1039,17 +1037,12 @@ static int mlxsw_sp_neigh_init(struct mlxsw_sp *mlxsw_sp) | |||
1039 | mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); | 1037 | mlxsw_core_schedule_dw(&mlxsw_sp->router.neighs_update.dw, 0); |
1040 | mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); | 1038 | mlxsw_core_schedule_dw(&mlxsw_sp->router.nexthop_probe_dw, 0); |
1041 | return 0; | 1039 | return 0; |
1042 | |||
1043 | err_register_netevent_notifier: | ||
1044 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); | ||
1045 | return err; | ||
1046 | } | 1040 | } |
1047 | 1041 | ||
1048 | static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) | 1042 | static void mlxsw_sp_neigh_fini(struct mlxsw_sp *mlxsw_sp) |
1049 | { | 1043 | { |
1050 | cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); | 1044 | cancel_delayed_work_sync(&mlxsw_sp->router.neighs_update.dw); |
1051 | cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); | 1045 | cancel_delayed_work_sync(&mlxsw_sp->router.nexthop_probe_dw); |
1052 | unregister_netevent_notifier(&mlxsw_sp_router_netevent_nb); | ||
1053 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); | 1046 | rhashtable_destroy(&mlxsw_sp->router.neigh_ht); |
1054 | } | 1047 | } |
1055 | 1048 | ||
@@ -1524,7 +1517,14 @@ int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp) | |||
1524 | return err; | 1517 | return err; |
1525 | mlxsw_sp_lpm_init(mlxsw_sp); | 1518 | mlxsw_sp_lpm_init(mlxsw_sp); |
1526 | mlxsw_sp_vrs_init(mlxsw_sp); | 1519 | mlxsw_sp_vrs_init(mlxsw_sp); |
1527 | return mlxsw_sp_neigh_init(mlxsw_sp); | 1520 | err = mlxsw_sp_neigh_init(mlxsw_sp); |
1521 | if (err) | ||
1522 | goto err_neigh_init; | ||
1523 | return 0; | ||
1524 | |||
1525 | err_neigh_init: | ||
1526 | __mlxsw_sp_router_fini(mlxsw_sp); | ||
1527 | return err; | ||
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) | 1530 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp) |
@@ -1626,11 +1626,8 @@ static int mlxsw_sp_fib_entry_op(struct mlxsw_sp *mlxsw_sp, | |||
1626 | static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, | 1626 | static int mlxsw_sp_fib_entry_update(struct mlxsw_sp *mlxsw_sp, |
1627 | struct mlxsw_sp_fib_entry *fib_entry) | 1627 | struct mlxsw_sp_fib_entry *fib_entry) |
1628 | { | 1628 | { |
1629 | enum mlxsw_reg_ralue_op op; | 1629 | return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, |
1630 | 1630 | MLXSW_REG_RALUE_OP_WRITE_WRITE); | |
1631 | op = !fib_entry->added ? MLXSW_REG_RALUE_OP_WRITE_WRITE : | ||
1632 | MLXSW_REG_RALUE_OP_WRITE_UPDATE; | ||
1633 | return mlxsw_sp_fib_entry_op(mlxsw_sp, fib_entry, op); | ||
1634 | } | 1631 | } |
1635 | 1632 | ||
1636 | static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, | 1633 | static int mlxsw_sp_fib_entry_del(struct mlxsw_sp *mlxsw_sp, |
@@ -1695,34 +1692,93 @@ mlxsw_sp_router_fib4_entry_fini(struct mlxsw_sp *mlxsw_sp, | |||
1695 | mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); | 1692 | mlxsw_sp_nexthop_group_put(mlxsw_sp, fib_entry); |
1696 | } | 1693 | } |
1697 | 1694 | ||
1698 | static int | 1695 | static struct mlxsw_sp_fib_entry * |
1699 | mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | 1696 | mlxsw_sp_fib_entry_get(struct mlxsw_sp *mlxsw_sp, |
1700 | const struct switchdev_obj_ipv4_fib *fib4, | 1697 | const struct switchdev_obj_ipv4_fib *fib4) |
1701 | struct switchdev_trans *trans) | ||
1702 | { | 1698 | { |
1703 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
1704 | struct mlxsw_sp_router_fib4_add_info *info; | ||
1705 | struct mlxsw_sp_fib_entry *fib_entry; | 1699 | struct mlxsw_sp_fib_entry *fib_entry; |
1700 | struct fib_info *fi = fib4->fi; | ||
1706 | struct mlxsw_sp_vr *vr; | 1701 | struct mlxsw_sp_vr *vr; |
1707 | int err; | 1702 | int err; |
1708 | 1703 | ||
1709 | vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, | 1704 | vr = mlxsw_sp_vr_get(mlxsw_sp, fib4->dst_len, fib4->tb_id, |
1710 | MLXSW_SP_L3_PROTO_IPV4); | 1705 | MLXSW_SP_L3_PROTO_IPV4); |
1711 | if (IS_ERR(vr)) | 1706 | if (IS_ERR(vr)) |
1712 | return PTR_ERR(vr); | 1707 | return ERR_CAST(vr); |
1713 | 1708 | ||
1709 | fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
1710 | sizeof(fib4->dst), | ||
1711 | fib4->dst_len, fi->fib_dev); | ||
1712 | if (fib_entry) { | ||
1713 | /* Already exists, just take a reference */ | ||
1714 | fib_entry->ref_count++; | ||
1715 | return fib_entry; | ||
1716 | } | ||
1714 | fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, | 1717 | fib_entry = mlxsw_sp_fib_entry_create(vr->fib, &fib4->dst, |
1715 | sizeof(fib4->dst), fib4->dst_len); | 1718 | sizeof(fib4->dst), |
1719 | fib4->dst_len, fi->fib_dev); | ||
1716 | if (!fib_entry) { | 1720 | if (!fib_entry) { |
1717 | err = -ENOMEM; | 1721 | err = -ENOMEM; |
1718 | goto err_fib_entry_create; | 1722 | goto err_fib_entry_create; |
1719 | } | 1723 | } |
1720 | fib_entry->vr = vr; | 1724 | fib_entry->vr = vr; |
1725 | fib_entry->ref_count = 1; | ||
1721 | 1726 | ||
1722 | err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); | 1727 | err = mlxsw_sp_router_fib4_entry_init(mlxsw_sp, fib4, fib_entry); |
1723 | if (err) | 1728 | if (err) |
1724 | goto err_fib4_entry_init; | 1729 | goto err_fib4_entry_init; |
1725 | 1730 | ||
1731 | return fib_entry; | ||
1732 | |||
1733 | err_fib4_entry_init: | ||
1734 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1735 | err_fib_entry_create: | ||
1736 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1737 | |||
1738 | return ERR_PTR(err); | ||
1739 | } | ||
1740 | |||
1741 | static struct mlxsw_sp_fib_entry * | ||
1742 | mlxsw_sp_fib_entry_find(struct mlxsw_sp *mlxsw_sp, | ||
1743 | const struct switchdev_obj_ipv4_fib *fib4) | ||
1744 | { | ||
1745 | struct mlxsw_sp_vr *vr; | ||
1746 | |||
1747 | vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); | ||
1748 | if (!vr) | ||
1749 | return NULL; | ||
1750 | |||
1751 | return mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
1752 | sizeof(fib4->dst), fib4->dst_len, | ||
1753 | fib4->fi->fib_dev); | ||
1754 | } | ||
1755 | |||
1756 | void mlxsw_sp_fib_entry_put(struct mlxsw_sp *mlxsw_sp, | ||
1757 | struct mlxsw_sp_fib_entry *fib_entry) | ||
1758 | { | ||
1759 | struct mlxsw_sp_vr *vr = fib_entry->vr; | ||
1760 | |||
1761 | if (--fib_entry->ref_count == 0) { | ||
1762 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | ||
1763 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1764 | } | ||
1765 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1766 | } | ||
1767 | |||
1768 | static int | ||
1769 | mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | ||
1770 | const struct switchdev_obj_ipv4_fib *fib4, | ||
1771 | struct switchdev_trans *trans) | ||
1772 | { | ||
1773 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | ||
1774 | struct mlxsw_sp_router_fib4_add_info *info; | ||
1775 | struct mlxsw_sp_fib_entry *fib_entry; | ||
1776 | int err; | ||
1777 | |||
1778 | fib_entry = mlxsw_sp_fib_entry_get(mlxsw_sp, fib4); | ||
1779 | if (IS_ERR(fib_entry)) | ||
1780 | return PTR_ERR(fib_entry); | ||
1781 | |||
1726 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 1782 | info = kmalloc(sizeof(*info), GFP_KERNEL); |
1727 | if (!info) { | 1783 | if (!info) { |
1728 | err = -ENOMEM; | 1784 | err = -ENOMEM; |
@@ -1736,11 +1792,7 @@ mlxsw_sp_router_fib4_add_prepare(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1736 | return 0; | 1792 | return 0; |
1737 | 1793 | ||
1738 | err_alloc_info: | 1794 | err_alloc_info: |
1739 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1795 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); |
1740 | err_fib4_entry_init: | ||
1741 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1742 | err_fib_entry_create: | ||
1743 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1744 | return err; | 1796 | return err; |
1745 | } | 1797 | } |
1746 | 1798 | ||
@@ -1759,11 +1811,14 @@ mlxsw_sp_router_fib4_add_commit(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1759 | fib_entry = info->fib_entry; | 1811 | fib_entry = info->fib_entry; |
1760 | kfree(info); | 1812 | kfree(info); |
1761 | 1813 | ||
1814 | if (fib_entry->ref_count != 1) | ||
1815 | return 0; | ||
1816 | |||
1762 | vr = fib_entry->vr; | 1817 | vr = fib_entry->vr; |
1763 | err = mlxsw_sp_fib_entry_insert(fib_entry->vr->fib, fib_entry); | 1818 | err = mlxsw_sp_fib_entry_insert(vr->fib, fib_entry); |
1764 | if (err) | 1819 | if (err) |
1765 | goto err_fib_entry_insert; | 1820 | goto err_fib_entry_insert; |
1766 | err = mlxsw_sp_fib_entry_update(mlxsw_sp, fib_entry); | 1821 | err = mlxsw_sp_fib_entry_update(mlxsw_sp_port->mlxsw_sp, fib_entry); |
1767 | if (err) | 1822 | if (err) |
1768 | goto err_fib_entry_add; | 1823 | goto err_fib_entry_add; |
1769 | return 0; | 1824 | return 0; |
@@ -1771,9 +1826,7 @@ mlxsw_sp_router_fib4_add_commit(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1771 | err_fib_entry_add: | 1826 | err_fib_entry_add: |
1772 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); | 1827 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); |
1773 | err_fib_entry_insert: | 1828 | err_fib_entry_insert: |
1774 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1829 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); |
1775 | mlxsw_sp_fib_entry_destroy(fib_entry); | ||
1776 | mlxsw_sp_vr_put(mlxsw_sp, vr); | ||
1777 | return err; | 1830 | return err; |
1778 | } | 1831 | } |
1779 | 1832 | ||
@@ -1793,23 +1846,18 @@ int mlxsw_sp_router_fib4_del(struct mlxsw_sp_port *mlxsw_sp_port, | |||
1793 | { | 1846 | { |
1794 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | 1847 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
1795 | struct mlxsw_sp_fib_entry *fib_entry; | 1848 | struct mlxsw_sp_fib_entry *fib_entry; |
1796 | struct mlxsw_sp_vr *vr; | ||
1797 | 1849 | ||
1798 | vr = mlxsw_sp_vr_find(mlxsw_sp, fib4->tb_id, MLXSW_SP_L3_PROTO_IPV4); | 1850 | fib_entry = mlxsw_sp_fib_entry_find(mlxsw_sp, fib4); |
1799 | if (!vr) { | ||
1800 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find virtual router for FIB4 entry being removed.\n"); | ||
1801 | return -ENOENT; | ||
1802 | } | ||
1803 | fib_entry = mlxsw_sp_fib_entry_lookup(vr->fib, &fib4->dst, | ||
1804 | sizeof(fib4->dst), fib4->dst_len); | ||
1805 | if (!fib_entry) { | 1851 | if (!fib_entry) { |
1806 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); | 1852 | dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n"); |
1807 | return -ENOENT; | 1853 | return -ENOENT; |
1808 | } | 1854 | } |
1809 | mlxsw_sp_fib_entry_del(mlxsw_sp_port->mlxsw_sp, fib_entry); | 1855 | |
1810 | mlxsw_sp_fib_entry_remove(vr->fib, fib_entry); | 1856 | if (fib_entry->ref_count == 1) { |
1811 | mlxsw_sp_router_fib4_entry_fini(mlxsw_sp, fib_entry); | 1857 | mlxsw_sp_fib_entry_del(mlxsw_sp, fib_entry); |
1812 | mlxsw_sp_fib_entry_destroy(fib_entry); | 1858 | mlxsw_sp_fib_entry_remove(fib_entry->vr->fib, fib_entry); |
1813 | mlxsw_sp_vr_put(mlxsw_sp, vr); | 1859 | } |
1860 | |||
1861 | mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry); | ||
1814 | return 0; | 1862 | return 0; |
1815 | } | 1863 | } |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index d1b59cdfacc1..7b654c517b91 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | |||
@@ -167,8 +167,8 @@ static int mlxsw_sp_port_attr_stp_state_set(struct mlxsw_sp_port *mlxsw_sp_port, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, | 169 | static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, |
170 | u16 idx_begin, u16 idx_end, bool set, | 170 | u16 idx_begin, u16 idx_end, bool uc_set, |
171 | bool only_uc) | 171 | bool bm_set) |
172 | { | 172 | { |
173 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; | 173 | struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; |
174 | u16 local_port = mlxsw_sp_port->local_port; | 174 | u16 local_port = mlxsw_sp_port->local_port; |
@@ -187,28 +187,22 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, | |||
187 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | 188 | ||
189 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, | 189 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, |
190 | table_type, range, local_port, set); | 190 | table_type, range, local_port, uc_set); |
191 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 191 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
192 | if (err) | 192 | if (err) |
193 | goto buffer_out; | 193 | goto buffer_out; |
194 | 194 | ||
195 | /* Flooding control allows one to decide whether a given port will | ||
196 | * flood unicast traffic for which there is no FDB entry. | ||
197 | */ | ||
198 | if (only_uc) | ||
199 | goto buffer_out; | ||
200 | |||
201 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, | 195 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin, |
202 | table_type, range, local_port, set); | 196 | table_type, range, local_port, bm_set); |
203 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 197 | err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
204 | if (err) | 198 | if (err) |
205 | goto err_flood_bm_set; | 199 | goto err_flood_bm_set; |
206 | else | 200 | |
207 | goto buffer_out; | 201 | goto buffer_out; |
208 | 202 | ||
209 | err_flood_bm_set: | 203 | err_flood_bm_set: |
210 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, | 204 | mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin, |
211 | table_type, range, local_port, !set); | 205 | table_type, range, local_port, !uc_set); |
212 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); | 206 | mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); |
213 | buffer_out: | 207 | buffer_out: |
214 | kfree(sftr_pl); | 208 | kfree(sftr_pl); |
@@ -257,8 +251,7 @@ int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid, | |||
257 | * the start of the vFIDs range. | 251 | * the start of the vFIDs range. |
258 | */ | 252 | */ |
259 | vfid = mlxsw_sp_fid_to_vfid(fid); | 253 | vfid = mlxsw_sp_fid_to_vfid(fid); |
260 | return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, | 254 | return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, set); |
261 | false); | ||
262 | } | 255 | } |
263 | 256 | ||
264 | static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, | 257 | static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, |
@@ -460,6 +453,9 @@ static int __mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port, | |||
460 | { | 453 | { |
461 | struct mlxsw_sp_fid *f; | 454 | struct mlxsw_sp_fid *f; |
462 | 455 | ||
456 | if (test_bit(fid, mlxsw_sp_port->active_vlans)) | ||
457 | return 0; | ||
458 | |||
463 | f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); | 459 | f = mlxsw_sp_fid_find(mlxsw_sp_port->mlxsw_sp, fid); |
464 | if (!f) { | 460 | if (!f) { |
465 | f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); | 461 | f = mlxsw_sp_fid_create(mlxsw_sp_port->mlxsw_sp, fid); |
@@ -517,7 +513,7 @@ static int mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port, | |||
517 | } | 513 | } |
518 | 514 | ||
519 | err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, | 515 | err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end, |
520 | true, false); | 516 | mlxsw_sp_port->uc_flood, true); |
521 | if (err) | 517 | if (err) |
522 | goto err_port_flood_set; | 518 | goto err_port_flood_set; |
523 | 519 | ||
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c index 88678c172b19..39dadfca84ef 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * Chris Telfer <chris.telfer@netronome.com> | 41 | * Chris Telfer <chris.telfer@netronome.com> |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/version.h> | ||
45 | #include <linux/module.h> | 44 | #include <linux/module.h> |
46 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
47 | #include <linux/init.h> | 46 | #include <linux/init.h> |
@@ -1441,10 +1440,6 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget) | |||
1441 | 1440 | ||
1442 | nfp_net_set_hash(nn->netdev, skb, rxd); | 1441 | nfp_net_set_hash(nn->netdev, skb, rxd); |
1443 | 1442 | ||
1444 | /* Pad small frames to minimum */ | ||
1445 | if (skb_put_padto(skb, 60)) | ||
1446 | break; | ||
1447 | |||
1448 | /* Stats update */ | 1443 | /* Stats update */ |
1449 | u64_stats_update_begin(&r_vec->rx_sync); | 1444 | u64_stats_update_begin(&r_vec->rx_sync); |
1450 | r_vec->rx_pkts++; | 1445 | r_vec->rx_pkts++; |
@@ -2049,12 +2044,16 @@ static int nfp_net_netdev_open(struct net_device *netdev) | |||
2049 | 2044 | ||
2050 | nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), | 2045 | nn->rx_rings = kcalloc(nn->num_rx_rings, sizeof(*nn->rx_rings), |
2051 | GFP_KERNEL); | 2046 | GFP_KERNEL); |
2052 | if (!nn->rx_rings) | 2047 | if (!nn->rx_rings) { |
2048 | err = -ENOMEM; | ||
2053 | goto err_free_lsc; | 2049 | goto err_free_lsc; |
2050 | } | ||
2054 | nn->tx_rings = kcalloc(nn->num_tx_rings, sizeof(*nn->tx_rings), | 2051 | nn->tx_rings = kcalloc(nn->num_tx_rings, sizeof(*nn->tx_rings), |
2055 | GFP_KERNEL); | 2052 | GFP_KERNEL); |
2056 | if (!nn->tx_rings) | 2053 | if (!nn->tx_rings) { |
2054 | err = -ENOMEM; | ||
2057 | goto err_free_rx_rings; | 2055 | goto err_free_rx_rings; |
2056 | } | ||
2058 | 2057 | ||
2059 | for (r = 0; r < nn->num_r_vecs; r++) { | 2058 | for (r = 0; r < nn->num_r_vecs; r++) { |
2060 | err = nfp_net_prepare_vector(nn, &nn->r_vecs[r], r); | 2059 | err = nfp_net_prepare_vector(nn, &nn->r_vecs[r], r); |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c index 7d7933d00b8f..4c9897220969 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c | |||
@@ -40,7 +40,6 @@ | |||
40 | * Brad Petrus <brad.petrus@netronome.com> | 40 | * Brad Petrus <brad.petrus@netronome.com> |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #include <linux/version.h> | ||
44 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
45 | #include <linux/netdevice.h> | 44 | #include <linux/netdevice.h> |
46 | #include <linux/etherdevice.h> | 45 | #include <linux/etherdevice.h> |
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c b/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c index 37abef016a0a..f7062cb648e1 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_netvf_main.c | |||
@@ -38,7 +38,6 @@ | |||
38 | * Rolf Neugebauer <rolf.neugebauer@netronome.com> | 38 | * Rolf Neugebauer <rolf.neugebauer@netronome.com> |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include <linux/version.h> | ||
42 | #include <linux/module.h> | 41 | #include <linux/module.h> |
43 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
44 | #include <linux/init.h> | 43 | #include <linux/init.h> |
@@ -134,7 +133,7 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev, | |||
134 | } | 133 | } |
135 | 134 | ||
136 | nfp_net_get_fw_version(&fw_ver, ctrl_bar); | 135 | nfp_net_get_fw_version(&fw_ver, ctrl_bar); |
137 | if (fw_ver.class != NFP_NET_CFG_VERSION_CLASS_GENERIC) { | 136 | if (fw_ver.resv || fw_ver.class != NFP_NET_CFG_VERSION_CLASS_GENERIC) { |
138 | dev_err(&pdev->dev, "Unknown Firmware ABI %d.%d.%d.%d\n", | 137 | dev_err(&pdev->dev, "Unknown Firmware ABI %d.%d.%d.%d\n", |
139 | fw_ver.resv, fw_ver.class, fw_ver.major, fw_ver.minor); | 138 | fw_ver.resv, fw_ver.class, fw_ver.major, fw_ver.minor); |
140 | err = -EINVAL; | 139 | err = -EINVAL; |
@@ -142,9 +141,7 @@ static int nfp_netvf_pci_probe(struct pci_dev *pdev, | |||
142 | } | 141 | } |
143 | 142 | ||
144 | /* Determine stride */ | 143 | /* Determine stride */ |
145 | if (nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 0) || | 144 | if (nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 1)) { |
146 | nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0, 1) || | ||
147 | nfp_net_fw_ver_eq(&fw_ver, 0, 0, 0x12, 0x48)) { | ||
148 | stride = 2; | 145 | stride = 2; |
149 | tx_bar_no = NFP_NET_Q0_BAR; | 146 | tx_bar_no = NFP_NET_Q0_BAR; |
150 | rx_bar_no = NFP_NET_Q1_BAR; | 147 | rx_bar_no = NFP_NET_Q1_BAR; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c index 226cb08cc055..3656d2fd673d 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "qed_dcbx.h" | 19 | #include "qed_dcbx.h" |
20 | #include "qed_hsi.h" | 20 | #include "qed_hsi.h" |
21 | #include "qed_sp.h" | 21 | #include "qed_sp.h" |
22 | #include "qed_sriov.h" | ||
22 | #ifdef CONFIG_DCB | 23 | #ifdef CONFIG_DCB |
23 | #include <linux/qed/qed_eth_if.h> | 24 | #include <linux/qed/qed_eth_if.h> |
24 | #endif | 25 | #endif |
@@ -945,6 +946,9 @@ static int qed_dcbx_query_params(struct qed_hwfn *p_hwfn, | |||
945 | struct qed_ptt *p_ptt; | 946 | struct qed_ptt *p_ptt; |
946 | int rc; | 947 | int rc; |
947 | 948 | ||
949 | if (IS_VF(p_hwfn->cdev)) | ||
950 | return -EINVAL; | ||
951 | |||
948 | p_ptt = qed_ptt_acquire(p_hwfn); | 952 | p_ptt = qed_ptt_acquire(p_hwfn); |
949 | if (!p_ptt) | 953 | if (!p_ptt) |
950 | return -EBUSY; | 954 | return -EBUSY; |
@@ -984,6 +988,7 @@ qed_dcbx_set_pfc_data(struct qed_hwfn *p_hwfn, | |||
984 | if (p_params->pfc.prio[i]) | 988 | if (p_params->pfc.prio[i]) |
985 | pfc_map |= BIT(i); | 989 | pfc_map |= BIT(i); |
986 | 990 | ||
991 | *pfc &= ~DCBX_PFC_PRI_EN_BITMAP_MASK; | ||
987 | *pfc |= (pfc_map << DCBX_PFC_PRI_EN_BITMAP_SHIFT); | 992 | *pfc |= (pfc_map << DCBX_PFC_PRI_EN_BITMAP_SHIFT); |
988 | 993 | ||
989 | DP_VERBOSE(p_hwfn, QED_MSG_DCB, "pfc = 0x%x\n", *pfc); | 994 | DP_VERBOSE(p_hwfn, QED_MSG_DCB, "pfc = 0x%x\n", *pfc); |
@@ -1058,24 +1063,33 @@ qed_dcbx_set_app_data(struct qed_hwfn *p_hwfn, | |||
1058 | 1063 | ||
1059 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) { | 1064 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) { |
1060 | entry = &p_app->app_pri_tbl[i].entry; | 1065 | entry = &p_app->app_pri_tbl[i].entry; |
1066 | *entry = 0; | ||
1061 | if (ieee) { | 1067 | if (ieee) { |
1062 | *entry &= ~DCBX_APP_SF_IEEE_MASK; | 1068 | *entry &= ~(DCBX_APP_SF_IEEE_MASK | DCBX_APP_SF_MASK); |
1063 | switch (p_params->app_entry[i].sf_ieee) { | 1069 | switch (p_params->app_entry[i].sf_ieee) { |
1064 | case QED_DCBX_SF_IEEE_ETHTYPE: | 1070 | case QED_DCBX_SF_IEEE_ETHTYPE: |
1065 | *entry |= ((u32)DCBX_APP_SF_IEEE_ETHTYPE << | 1071 | *entry |= ((u32)DCBX_APP_SF_IEEE_ETHTYPE << |
1066 | DCBX_APP_SF_IEEE_SHIFT); | 1072 | DCBX_APP_SF_IEEE_SHIFT); |
1073 | *entry |= ((u32)DCBX_APP_SF_ETHTYPE << | ||
1074 | DCBX_APP_SF_SHIFT); | ||
1067 | break; | 1075 | break; |
1068 | case QED_DCBX_SF_IEEE_TCP_PORT: | 1076 | case QED_DCBX_SF_IEEE_TCP_PORT: |
1069 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_PORT << | 1077 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_PORT << |
1070 | DCBX_APP_SF_IEEE_SHIFT); | 1078 | DCBX_APP_SF_IEEE_SHIFT); |
1079 | *entry |= ((u32)DCBX_APP_SF_PORT << | ||
1080 | DCBX_APP_SF_SHIFT); | ||
1071 | break; | 1081 | break; |
1072 | case QED_DCBX_SF_IEEE_UDP_PORT: | 1082 | case QED_DCBX_SF_IEEE_UDP_PORT: |
1073 | *entry |= ((u32)DCBX_APP_SF_IEEE_UDP_PORT << | 1083 | *entry |= ((u32)DCBX_APP_SF_IEEE_UDP_PORT << |
1074 | DCBX_APP_SF_IEEE_SHIFT); | 1084 | DCBX_APP_SF_IEEE_SHIFT); |
1085 | *entry |= ((u32)DCBX_APP_SF_PORT << | ||
1086 | DCBX_APP_SF_SHIFT); | ||
1075 | break; | 1087 | break; |
1076 | case QED_DCBX_SF_IEEE_TCP_UDP_PORT: | 1088 | case QED_DCBX_SF_IEEE_TCP_UDP_PORT: |
1077 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_UDP_PORT << | 1089 | *entry |= ((u32)DCBX_APP_SF_IEEE_TCP_UDP_PORT << |
1078 | DCBX_APP_SF_IEEE_SHIFT); | 1090 | DCBX_APP_SF_IEEE_SHIFT); |
1091 | *entry |= ((u32)DCBX_APP_SF_PORT << | ||
1092 | DCBX_APP_SF_SHIFT); | ||
1079 | break; | 1093 | break; |
1080 | } | 1094 | } |
1081 | } else { | 1095 | } else { |
@@ -1175,7 +1189,7 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, | |||
1175 | return 0; | 1189 | return 0; |
1176 | } | 1190 | } |
1177 | 1191 | ||
1178 | dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_KERNEL); | 1192 | dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL); |
1179 | if (!dcbx_info) { | 1193 | if (!dcbx_info) { |
1180 | DP_ERR(p_hwfn, "Failed to allocate struct qed_dcbx_info\n"); | 1194 | DP_ERR(p_hwfn, "Failed to allocate struct qed_dcbx_info\n"); |
1181 | return -ENOMEM; | 1195 | return -ENOMEM; |
@@ -1212,7 +1226,7 @@ static struct qed_dcbx_get *qed_dcbnl_get_dcbx(struct qed_hwfn *hwfn, | |||
1212 | { | 1226 | { |
1213 | struct qed_dcbx_get *dcbx_info; | 1227 | struct qed_dcbx_get *dcbx_info; |
1214 | 1228 | ||
1215 | dcbx_info = kmalloc(sizeof(*dcbx_info), GFP_KERNEL); | 1229 | dcbx_info = kzalloc(sizeof(*dcbx_info), GFP_KERNEL); |
1216 | if (!dcbx_info) { | 1230 | if (!dcbx_info) { |
1217 | DP_ERR(hwfn->cdev, "Failed to allocate memory for dcbx_info\n"); | 1231 | DP_ERR(hwfn->cdev, "Failed to allocate memory for dcbx_info\n"); |
1218 | return NULL; | 1232 | return NULL; |
diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c index a240f26344a4..f776a77794c5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c +++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c | |||
@@ -1153,8 +1153,8 @@ qed_mcp_send_drv_version(struct qed_hwfn *p_hwfn, | |||
1153 | p_drv_version = &union_data.drv_version; | 1153 | p_drv_version = &union_data.drv_version; |
1154 | p_drv_version->version = p_ver->version; | 1154 | p_drv_version->version = p_ver->version; |
1155 | 1155 | ||
1156 | for (i = 0; i < MCP_DRV_VER_STR_SIZE - 1; i += 4) { | 1156 | for (i = 0; i < (MCP_DRV_VER_STR_SIZE - 4) / sizeof(u32); i++) { |
1157 | val = cpu_to_be32(p_ver->name[i]); | 1157 | val = cpu_to_be32(*((u32 *)&p_ver->name[i * sizeof(u32)])); |
1158 | *(__be32 *)&p_drv_version->name[i * sizeof(u32)] = val; | 1158 | *(__be32 *)&p_drv_version->name[i * sizeof(u32)] = val; |
1159 | } | 1159 | } |
1160 | 1160 | ||
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c index a6eb6af8cbe8..9544e4c41359 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_main.c +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c | |||
@@ -2520,7 +2520,8 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, | |||
2520 | edev->ops->register_ops(cdev, &qede_ll_ops, edev); | 2520 | edev->ops->register_ops(cdev, &qede_ll_ops, edev); |
2521 | 2521 | ||
2522 | #ifdef CONFIG_DCB | 2522 | #ifdef CONFIG_DCB |
2523 | qede_set_dcbnl_ops(edev->ndev); | 2523 | if (!IS_VF(edev)) |
2524 | qede_set_dcbnl_ops(edev->ndev); | ||
2524 | #endif | 2525 | #endif |
2525 | 2526 | ||
2526 | INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task); | 2527 | INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task); |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 799d58d86e6d..054e795df90f 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -201,9 +201,14 @@ static const u16 sh_eth_offset_fast_rz[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
201 | 201 | ||
202 | [ARSTR] = 0x0000, | 202 | [ARSTR] = 0x0000, |
203 | [TSU_CTRST] = 0x0004, | 203 | [TSU_CTRST] = 0x0004, |
204 | [TSU_FWSLC] = 0x0038, | ||
204 | [TSU_VTAG0] = 0x0058, | 205 | [TSU_VTAG0] = 0x0058, |
205 | [TSU_ADSBSY] = 0x0060, | 206 | [TSU_ADSBSY] = 0x0060, |
206 | [TSU_TEN] = 0x0064, | 207 | [TSU_TEN] = 0x0064, |
208 | [TSU_POST1] = 0x0070, | ||
209 | [TSU_POST2] = 0x0074, | ||
210 | [TSU_POST3] = 0x0078, | ||
211 | [TSU_POST4] = 0x007c, | ||
207 | [TSU_ADRH0] = 0x0100, | 212 | [TSU_ADRH0] = 0x0100, |
208 | 213 | ||
209 | [TXNLCR0] = 0x0080, | 214 | [TXNLCR0] = 0x0080, |
@@ -2786,6 +2791,8 @@ static void sh_eth_tsu_init(struct sh_eth_private *mdp) | |||
2786 | { | 2791 | { |
2787 | if (sh_eth_is_rz_fast_ether(mdp)) { | 2792 | if (sh_eth_is_rz_fast_ether(mdp)) { |
2788 | sh_eth_tsu_write(mdp, 0, TSU_TEN); /* Disable all CAM entry */ | 2793 | sh_eth_tsu_write(mdp, 0, TSU_TEN); /* Disable all CAM entry */ |
2794 | sh_eth_tsu_write(mdp, TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, | ||
2795 | TSU_FWSLC); /* Enable POST registers */ | ||
2789 | return; | 2796 | return; |
2790 | } | 2797 | } |
2791 | 2798 | ||
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index e17671c9d1b0..ea8465467469 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
@@ -470,7 +470,9 @@ smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma, | |||
470 | #endif | 470 | #endif |
471 | 471 | ||
472 | #if ! SMC_CAN_USE_8BIT | 472 | #if ! SMC_CAN_USE_8BIT |
473 | #undef SMC_inb | ||
473 | #define SMC_inb(ioaddr, reg) ({ BUG(); 0; }) | 474 | #define SMC_inb(ioaddr, reg) ({ BUG(); 0; }) |
475 | #undef SMC_outb | ||
474 | #define SMC_outb(x, ioaddr, reg) BUG() | 476 | #define SMC_outb(x, ioaddr, reg) BUG() |
475 | #define SMC_insb(a, r, p, l) BUG() | 477 | #define SMC_insb(a, r, p, l) BUG() |
476 | #define SMC_outsb(a, r, p, l) BUG() | 478 | #define SMC_outsb(a, r, p, l) BUG() |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index ca3134540d2d..4f8910b7db2e 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1099,15 +1099,8 @@ static int smsc911x_mii_init(struct platform_device *pdev, | |||
1099 | goto err_out_free_bus_2; | 1099 | goto err_out_free_bus_2; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | if (smsc911x_mii_probe(dev) < 0) { | ||
1103 | SMSC_WARN(pdata, probe, "Error registering mii bus"); | ||
1104 | goto err_out_unregister_bus_3; | ||
1105 | } | ||
1106 | |||
1107 | return 0; | 1102 | return 0; |
1108 | 1103 | ||
1109 | err_out_unregister_bus_3: | ||
1110 | mdiobus_unregister(pdata->mii_bus); | ||
1111 | err_out_free_bus_2: | 1104 | err_out_free_bus_2: |
1112 | mdiobus_free(pdata->mii_bus); | 1105 | mdiobus_free(pdata->mii_bus); |
1113 | err_out_1: | 1106 | err_out_1: |
@@ -1514,23 +1507,90 @@ static void smsc911x_disable_irq_chip(struct net_device *dev) | |||
1514 | smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); | 1507 | smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF); |
1515 | } | 1508 | } |
1516 | 1509 | ||
1510 | static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id) | ||
1511 | { | ||
1512 | struct net_device *dev = dev_id; | ||
1513 | struct smsc911x_data *pdata = netdev_priv(dev); | ||
1514 | u32 intsts = smsc911x_reg_read(pdata, INT_STS); | ||
1515 | u32 inten = smsc911x_reg_read(pdata, INT_EN); | ||
1516 | int serviced = IRQ_NONE; | ||
1517 | u32 temp; | ||
1518 | |||
1519 | if (unlikely(intsts & inten & INT_STS_SW_INT_)) { | ||
1520 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1521 | temp &= (~INT_EN_SW_INT_EN_); | ||
1522 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1523 | smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_); | ||
1524 | pdata->software_irq_signal = 1; | ||
1525 | smp_wmb(); | ||
1526 | serviced = IRQ_HANDLED; | ||
1527 | } | ||
1528 | |||
1529 | if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { | ||
1530 | /* Called when there is a multicast update scheduled and | ||
1531 | * it is now safe to complete the update */ | ||
1532 | SMSC_TRACE(pdata, intr, "RX Stop interrupt"); | ||
1533 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); | ||
1534 | if (pdata->multicast_update_pending) | ||
1535 | smsc911x_rx_multicast_update_workaround(pdata); | ||
1536 | serviced = IRQ_HANDLED; | ||
1537 | } | ||
1538 | |||
1539 | if (intsts & inten & INT_STS_TDFA_) { | ||
1540 | temp = smsc911x_reg_read(pdata, FIFO_INT); | ||
1541 | temp |= FIFO_INT_TX_AVAIL_LEVEL_; | ||
1542 | smsc911x_reg_write(pdata, FIFO_INT, temp); | ||
1543 | smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_); | ||
1544 | netif_wake_queue(dev); | ||
1545 | serviced = IRQ_HANDLED; | ||
1546 | } | ||
1547 | |||
1548 | if (unlikely(intsts & inten & INT_STS_RXE_)) { | ||
1549 | SMSC_TRACE(pdata, intr, "RX Error interrupt"); | ||
1550 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); | ||
1551 | serviced = IRQ_HANDLED; | ||
1552 | } | ||
1553 | |||
1554 | if (likely(intsts & inten & INT_STS_RSFL_)) { | ||
1555 | if (likely(napi_schedule_prep(&pdata->napi))) { | ||
1556 | /* Disable Rx interrupts */ | ||
1557 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1558 | temp &= (~INT_EN_RSFL_EN_); | ||
1559 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1560 | /* Schedule a NAPI poll */ | ||
1561 | __napi_schedule(&pdata->napi); | ||
1562 | } else { | ||
1563 | SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed"); | ||
1564 | } | ||
1565 | serviced = IRQ_HANDLED; | ||
1566 | } | ||
1567 | |||
1568 | return serviced; | ||
1569 | } | ||
1570 | |||
1517 | static int smsc911x_open(struct net_device *dev) | 1571 | static int smsc911x_open(struct net_device *dev) |
1518 | { | 1572 | { |
1519 | struct smsc911x_data *pdata = netdev_priv(dev); | 1573 | struct smsc911x_data *pdata = netdev_priv(dev); |
1520 | unsigned int timeout; | 1574 | unsigned int timeout; |
1521 | unsigned int temp; | 1575 | unsigned int temp; |
1522 | unsigned int intcfg; | 1576 | unsigned int intcfg; |
1577 | int retval; | ||
1578 | int irq_flags; | ||
1523 | 1579 | ||
1524 | /* if the phy is not yet registered, retry later*/ | 1580 | /* find and start the given phy */ |
1525 | if (!dev->phydev) { | 1581 | if (!dev->phydev) { |
1526 | SMSC_WARN(pdata, hw, "phy_dev is NULL"); | 1582 | retval = smsc911x_mii_probe(dev); |
1527 | return -EAGAIN; | 1583 | if (retval < 0) { |
1584 | SMSC_WARN(pdata, probe, "Error starting phy"); | ||
1585 | goto out; | ||
1586 | } | ||
1528 | } | 1587 | } |
1529 | 1588 | ||
1530 | /* Reset the LAN911x */ | 1589 | /* Reset the LAN911x */ |
1531 | if (smsc911x_soft_reset(pdata)) { | 1590 | retval = smsc911x_soft_reset(pdata); |
1591 | if (retval) { | ||
1532 | SMSC_WARN(pdata, hw, "soft reset failed"); | 1592 | SMSC_WARN(pdata, hw, "soft reset failed"); |
1533 | return -EIO; | 1593 | goto mii_free_out; |
1534 | } | 1594 | } |
1535 | 1595 | ||
1536 | smsc911x_reg_write(pdata, HW_CFG, 0x00050000); | 1596 | smsc911x_reg_write(pdata, HW_CFG, 0x00050000); |
@@ -1586,6 +1646,15 @@ static int smsc911x_open(struct net_device *dev) | |||
1586 | pdata->software_irq_signal = 0; | 1646 | pdata->software_irq_signal = 0; |
1587 | smp_wmb(); | 1647 | smp_wmb(); |
1588 | 1648 | ||
1649 | irq_flags = irq_get_trigger_type(dev->irq); | ||
1650 | retval = request_irq(dev->irq, smsc911x_irqhandler, | ||
1651 | irq_flags | IRQF_SHARED, dev->name, dev); | ||
1652 | if (retval) { | ||
1653 | SMSC_WARN(pdata, probe, | ||
1654 | "Unable to claim requested irq: %d", dev->irq); | ||
1655 | goto mii_free_out; | ||
1656 | } | ||
1657 | |||
1589 | temp = smsc911x_reg_read(pdata, INT_EN); | 1658 | temp = smsc911x_reg_read(pdata, INT_EN); |
1590 | temp |= INT_EN_SW_INT_EN_; | 1659 | temp |= INT_EN_SW_INT_EN_; |
1591 | smsc911x_reg_write(pdata, INT_EN, temp); | 1660 | smsc911x_reg_write(pdata, INT_EN, temp); |
@@ -1600,7 +1669,8 @@ static int smsc911x_open(struct net_device *dev) | |||
1600 | if (!pdata->software_irq_signal) { | 1669 | if (!pdata->software_irq_signal) { |
1601 | netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n", | 1670 | netdev_warn(dev, "ISR failed signaling test (IRQ %d)\n", |
1602 | dev->irq); | 1671 | dev->irq); |
1603 | return -ENODEV; | 1672 | retval = -ENODEV; |
1673 | goto irq_stop_out; | ||
1604 | } | 1674 | } |
1605 | SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d", | 1675 | SMSC_TRACE(pdata, ifup, "IRQ handler passed test using IRQ %d", |
1606 | dev->irq); | 1676 | dev->irq); |
@@ -1646,6 +1716,14 @@ static int smsc911x_open(struct net_device *dev) | |||
1646 | 1716 | ||
1647 | netif_start_queue(dev); | 1717 | netif_start_queue(dev); |
1648 | return 0; | 1718 | return 0; |
1719 | |||
1720 | irq_stop_out: | ||
1721 | free_irq(dev->irq, dev); | ||
1722 | mii_free_out: | ||
1723 | phy_disconnect(dev->phydev); | ||
1724 | dev->phydev = NULL; | ||
1725 | out: | ||
1726 | return retval; | ||
1649 | } | 1727 | } |
1650 | 1728 | ||
1651 | /* Entry point for stopping the interface */ | 1729 | /* Entry point for stopping the interface */ |
@@ -1667,9 +1745,15 @@ static int smsc911x_stop(struct net_device *dev) | |||
1667 | dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP); | 1745 | dev->stats.rx_dropped += smsc911x_reg_read(pdata, RX_DROP); |
1668 | smsc911x_tx_update_txcounters(dev); | 1746 | smsc911x_tx_update_txcounters(dev); |
1669 | 1747 | ||
1748 | free_irq(dev->irq, dev); | ||
1749 | |||
1670 | /* Bring the PHY down */ | 1750 | /* Bring the PHY down */ |
1671 | if (dev->phydev) | 1751 | if (dev->phydev) { |
1672 | phy_stop(dev->phydev); | 1752 | phy_stop(dev->phydev); |
1753 | phy_disconnect(dev->phydev); | ||
1754 | dev->phydev = NULL; | ||
1755 | } | ||
1756 | netif_carrier_off(dev); | ||
1673 | 1757 | ||
1674 | SMSC_TRACE(pdata, ifdown, "Interface stopped"); | 1758 | SMSC_TRACE(pdata, ifdown, "Interface stopped"); |
1675 | return 0; | 1759 | return 0; |
@@ -1811,67 +1895,6 @@ static void smsc911x_set_multicast_list(struct net_device *dev) | |||
1811 | spin_unlock_irqrestore(&pdata->mac_lock, flags); | 1895 | spin_unlock_irqrestore(&pdata->mac_lock, flags); |
1812 | } | 1896 | } |
1813 | 1897 | ||
1814 | static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id) | ||
1815 | { | ||
1816 | struct net_device *dev = dev_id; | ||
1817 | struct smsc911x_data *pdata = netdev_priv(dev); | ||
1818 | u32 intsts = smsc911x_reg_read(pdata, INT_STS); | ||
1819 | u32 inten = smsc911x_reg_read(pdata, INT_EN); | ||
1820 | int serviced = IRQ_NONE; | ||
1821 | u32 temp; | ||
1822 | |||
1823 | if (unlikely(intsts & inten & INT_STS_SW_INT_)) { | ||
1824 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1825 | temp &= (~INT_EN_SW_INT_EN_); | ||
1826 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1827 | smsc911x_reg_write(pdata, INT_STS, INT_STS_SW_INT_); | ||
1828 | pdata->software_irq_signal = 1; | ||
1829 | smp_wmb(); | ||
1830 | serviced = IRQ_HANDLED; | ||
1831 | } | ||
1832 | |||
1833 | if (unlikely(intsts & inten & INT_STS_RXSTOP_INT_)) { | ||
1834 | /* Called when there is a multicast update scheduled and | ||
1835 | * it is now safe to complete the update */ | ||
1836 | SMSC_TRACE(pdata, intr, "RX Stop interrupt"); | ||
1837 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_); | ||
1838 | if (pdata->multicast_update_pending) | ||
1839 | smsc911x_rx_multicast_update_workaround(pdata); | ||
1840 | serviced = IRQ_HANDLED; | ||
1841 | } | ||
1842 | |||
1843 | if (intsts & inten & INT_STS_TDFA_) { | ||
1844 | temp = smsc911x_reg_read(pdata, FIFO_INT); | ||
1845 | temp |= FIFO_INT_TX_AVAIL_LEVEL_; | ||
1846 | smsc911x_reg_write(pdata, FIFO_INT, temp); | ||
1847 | smsc911x_reg_write(pdata, INT_STS, INT_STS_TDFA_); | ||
1848 | netif_wake_queue(dev); | ||
1849 | serviced = IRQ_HANDLED; | ||
1850 | } | ||
1851 | |||
1852 | if (unlikely(intsts & inten & INT_STS_RXE_)) { | ||
1853 | SMSC_TRACE(pdata, intr, "RX Error interrupt"); | ||
1854 | smsc911x_reg_write(pdata, INT_STS, INT_STS_RXE_); | ||
1855 | serviced = IRQ_HANDLED; | ||
1856 | } | ||
1857 | |||
1858 | if (likely(intsts & inten & INT_STS_RSFL_)) { | ||
1859 | if (likely(napi_schedule_prep(&pdata->napi))) { | ||
1860 | /* Disable Rx interrupts */ | ||
1861 | temp = smsc911x_reg_read(pdata, INT_EN); | ||
1862 | temp &= (~INT_EN_RSFL_EN_); | ||
1863 | smsc911x_reg_write(pdata, INT_EN, temp); | ||
1864 | /* Schedule a NAPI poll */ | ||
1865 | __napi_schedule(&pdata->napi); | ||
1866 | } else { | ||
1867 | SMSC_WARN(pdata, rx_err, "napi_schedule_prep failed"); | ||
1868 | } | ||
1869 | serviced = IRQ_HANDLED; | ||
1870 | } | ||
1871 | |||
1872 | return serviced; | ||
1873 | } | ||
1874 | |||
1875 | #ifdef CONFIG_NET_POLL_CONTROLLER | 1898 | #ifdef CONFIG_NET_POLL_CONTROLLER |
1876 | static void smsc911x_poll_controller(struct net_device *dev) | 1899 | static void smsc911x_poll_controller(struct net_device *dev) |
1877 | { | 1900 | { |
@@ -2291,16 +2314,14 @@ static int smsc911x_drv_remove(struct platform_device *pdev) | |||
2291 | pdata = netdev_priv(dev); | 2314 | pdata = netdev_priv(dev); |
2292 | BUG_ON(!pdata); | 2315 | BUG_ON(!pdata); |
2293 | BUG_ON(!pdata->ioaddr); | 2316 | BUG_ON(!pdata->ioaddr); |
2294 | BUG_ON(!dev->phydev); | 2317 | WARN_ON(dev->phydev); |
2295 | 2318 | ||
2296 | SMSC_TRACE(pdata, ifdown, "Stopping driver"); | 2319 | SMSC_TRACE(pdata, ifdown, "Stopping driver"); |
2297 | 2320 | ||
2298 | phy_disconnect(dev->phydev); | ||
2299 | mdiobus_unregister(pdata->mii_bus); | 2321 | mdiobus_unregister(pdata->mii_bus); |
2300 | mdiobus_free(pdata->mii_bus); | 2322 | mdiobus_free(pdata->mii_bus); |
2301 | 2323 | ||
2302 | unregister_netdev(dev); | 2324 | unregister_netdev(dev); |
2303 | free_irq(dev->irq, dev); | ||
2304 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 2325 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
2305 | "smsc911x-memory"); | 2326 | "smsc911x-memory"); |
2306 | if (!res) | 2327 | if (!res) |
@@ -2385,8 +2406,7 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2385 | struct smsc911x_data *pdata; | 2406 | struct smsc911x_data *pdata; |
2386 | struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); | 2407 | struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev); |
2387 | struct resource *res; | 2408 | struct resource *res; |
2388 | unsigned int intcfg = 0; | 2409 | int res_size, irq; |
2389 | int res_size, irq, irq_flags; | ||
2390 | int retval; | 2410 | int retval; |
2391 | 2411 | ||
2392 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 2412 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |
@@ -2425,7 +2445,6 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2425 | 2445 | ||
2426 | pdata = netdev_priv(dev); | 2446 | pdata = netdev_priv(dev); |
2427 | dev->irq = irq; | 2447 | dev->irq = irq; |
2428 | irq_flags = irq_get_trigger_type(irq); | ||
2429 | pdata->ioaddr = ioremap_nocache(res->start, res_size); | 2448 | pdata->ioaddr = ioremap_nocache(res->start, res_size); |
2430 | 2449 | ||
2431 | pdata->dev = dev; | 2450 | pdata->dev = dev; |
@@ -2472,43 +2491,23 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2472 | if (retval < 0) | 2491 | if (retval < 0) |
2473 | goto out_disable_resources; | 2492 | goto out_disable_resources; |
2474 | 2493 | ||
2475 | /* configure irq polarity and type before connecting isr */ | 2494 | netif_carrier_off(dev); |
2476 | if (pdata->config.irq_polarity == SMSC911X_IRQ_POLARITY_ACTIVE_HIGH) | ||
2477 | intcfg |= INT_CFG_IRQ_POL_; | ||
2478 | |||
2479 | if (pdata->config.irq_type == SMSC911X_IRQ_TYPE_PUSH_PULL) | ||
2480 | intcfg |= INT_CFG_IRQ_TYPE_; | ||
2481 | |||
2482 | smsc911x_reg_write(pdata, INT_CFG, intcfg); | ||
2483 | |||
2484 | /* Ensure interrupts are globally disabled before connecting ISR */ | ||
2485 | smsc911x_disable_irq_chip(dev); | ||
2486 | 2495 | ||
2487 | retval = request_irq(dev->irq, smsc911x_irqhandler, | 2496 | retval = smsc911x_mii_init(pdev, dev); |
2488 | irq_flags | IRQF_SHARED, dev->name, dev); | ||
2489 | if (retval) { | 2497 | if (retval) { |
2490 | SMSC_WARN(pdata, probe, | 2498 | SMSC_WARN(pdata, probe, "Error %i initialising mii", retval); |
2491 | "Unable to claim requested irq: %d", dev->irq); | ||
2492 | goto out_disable_resources; | 2499 | goto out_disable_resources; |
2493 | } | 2500 | } |
2494 | 2501 | ||
2495 | netif_carrier_off(dev); | ||
2496 | |||
2497 | retval = register_netdev(dev); | 2502 | retval = register_netdev(dev); |
2498 | if (retval) { | 2503 | if (retval) { |
2499 | SMSC_WARN(pdata, probe, "Error %i registering device", retval); | 2504 | SMSC_WARN(pdata, probe, "Error %i registering device", retval); |
2500 | goto out_free_irq; | 2505 | goto out_disable_resources; |
2501 | } else { | 2506 | } else { |
2502 | SMSC_TRACE(pdata, probe, | 2507 | SMSC_TRACE(pdata, probe, |
2503 | "Network interface: \"%s\"", dev->name); | 2508 | "Network interface: \"%s\"", dev->name); |
2504 | } | 2509 | } |
2505 | 2510 | ||
2506 | retval = smsc911x_mii_init(pdev, dev); | ||
2507 | if (retval) { | ||
2508 | SMSC_WARN(pdata, probe, "Error %i initialising mii", retval); | ||
2509 | goto out_unregister_netdev_5; | ||
2510 | } | ||
2511 | |||
2512 | spin_lock_irq(&pdata->mac_lock); | 2511 | spin_lock_irq(&pdata->mac_lock); |
2513 | 2512 | ||
2514 | /* Check if mac address has been specified when bringing interface up */ | 2513 | /* Check if mac address has been specified when bringing interface up */ |
@@ -2544,10 +2543,6 @@ static int smsc911x_drv_probe(struct platform_device *pdev) | |||
2544 | 2543 | ||
2545 | return 0; | 2544 | return 0; |
2546 | 2545 | ||
2547 | out_unregister_netdev_5: | ||
2548 | unregister_netdev(dev); | ||
2549 | out_free_irq: | ||
2550 | free_irq(dev->irq, dev); | ||
2551 | out_disable_resources: | 2546 | out_disable_resources: |
2552 | pm_runtime_put(&pdev->dev); | 2547 | pm_runtime_put(&pdev->dev); |
2553 | pm_runtime_disable(&pdev->dev); | 2548 | pm_runtime_disable(&pdev->dev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index cbefe9e2207c..885a5e64519d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | |||
@@ -261,7 +261,7 @@ static void dwmac1000_pmt(struct mac_device_info *hw, unsigned long mode) | |||
261 | } | 261 | } |
262 | if (mode & WAKE_UCAST) { | 262 | if (mode & WAKE_UCAST) { |
263 | pr_debug("GMAC: WOL on global unicast\n"); | 263 | pr_debug("GMAC: WOL on global unicast\n"); |
264 | pmt |= global_unicast; | 264 | pmt |= power_down | global_unicast | wake_up_frame_en; |
265 | } | 265 | } |
266 | 266 | ||
267 | writel(pmt, ioaddr + GMAC_PMT); | 267 | writel(pmt, ioaddr + GMAC_PMT); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index df5580dcdfed..51019b794be5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | |||
@@ -102,7 +102,7 @@ static void dwmac4_pmt(struct mac_device_info *hw, unsigned long mode) | |||
102 | } | 102 | } |
103 | if (mode & WAKE_UCAST) { | 103 | if (mode & WAKE_UCAST) { |
104 | pr_debug("GMAC: WOL on global unicast\n"); | 104 | pr_debug("GMAC: WOL on global unicast\n"); |
105 | pmt |= global_unicast; | 105 | pmt |= power_down | global_unicast | wake_up_frame_en; |
106 | } | 106 | } |
107 | 107 | ||
108 | writel(pmt, ioaddr + GMAC_PMT); | 108 | writel(pmt, ioaddr + GMAC_PMT); |
diff --git a/drivers/net/ethernet/synopsys/dwc_eth_qos.c b/drivers/net/ethernet/synopsys/dwc_eth_qos.c index 5a3941bf250f..4490ebaed127 100644 --- a/drivers/net/ethernet/synopsys/dwc_eth_qos.c +++ b/drivers/net/ethernet/synopsys/dwc_eth_qos.c | |||
@@ -1246,7 +1246,7 @@ static int dwceqos_mii_init(struct net_local *lp) | |||
1246 | lp->mii_bus->read = &dwceqos_mdio_read; | 1246 | lp->mii_bus->read = &dwceqos_mdio_read; |
1247 | lp->mii_bus->write = &dwceqos_mdio_write; | 1247 | lp->mii_bus->write = &dwceqos_mdio_write; |
1248 | lp->mii_bus->priv = lp; | 1248 | lp->mii_bus->priv = lp; |
1249 | lp->mii_bus->parent = &lp->ndev->dev; | 1249 | lp->mii_bus->parent = &lp->pdev->dev; |
1250 | 1250 | ||
1251 | of_address_to_resource(lp->pdev->dev.of_node, 0, &res); | 1251 | of_address_to_resource(lp->pdev->dev.of_node, 0, &res); |
1252 | snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx", | 1252 | snprintf(lp->mii_bus->id, MII_BUS_ID_SIZE, "%.8llx", |
@@ -2853,25 +2853,17 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2853 | 2853 | ||
2854 | ndev->features = ndev->hw_features; | 2854 | ndev->features = ndev->hw_features; |
2855 | 2855 | ||
2856 | netif_napi_add(ndev, &lp->napi, dwceqos_rx_poll, NAPI_POLL_WEIGHT); | ||
2857 | |||
2858 | ret = register_netdev(ndev); | ||
2859 | if (ret) { | ||
2860 | dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); | ||
2861 | goto err_out_clk_dis_aper; | ||
2862 | } | ||
2863 | |||
2864 | lp->phy_ref_clk = devm_clk_get(&pdev->dev, "phy_ref_clk"); | 2856 | lp->phy_ref_clk = devm_clk_get(&pdev->dev, "phy_ref_clk"); |
2865 | if (IS_ERR(lp->phy_ref_clk)) { | 2857 | if (IS_ERR(lp->phy_ref_clk)) { |
2866 | dev_err(&pdev->dev, "phy_ref_clk clock not found.\n"); | 2858 | dev_err(&pdev->dev, "phy_ref_clk clock not found.\n"); |
2867 | ret = PTR_ERR(lp->phy_ref_clk); | 2859 | ret = PTR_ERR(lp->phy_ref_clk); |
2868 | goto err_out_unregister_netdev; | 2860 | goto err_out_clk_dis_aper; |
2869 | } | 2861 | } |
2870 | 2862 | ||
2871 | ret = clk_prepare_enable(lp->phy_ref_clk); | 2863 | ret = clk_prepare_enable(lp->phy_ref_clk); |
2872 | if (ret) { | 2864 | if (ret) { |
2873 | dev_err(&pdev->dev, "Unable to enable device clock.\n"); | 2865 | dev_err(&pdev->dev, "Unable to enable device clock.\n"); |
2874 | goto err_out_unregister_netdev; | 2866 | goto err_out_clk_dis_aper; |
2875 | } | 2867 | } |
2876 | 2868 | ||
2877 | lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node, | 2869 | lp->phy_node = of_parse_phandle(lp->pdev->dev.of_node, |
@@ -2880,7 +2872,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2880 | ret = of_phy_register_fixed_link(lp->pdev->dev.of_node); | 2872 | ret = of_phy_register_fixed_link(lp->pdev->dev.of_node); |
2881 | if (ret < 0) { | 2873 | if (ret < 0) { |
2882 | dev_err(&pdev->dev, "invalid fixed-link"); | 2874 | dev_err(&pdev->dev, "invalid fixed-link"); |
2883 | goto err_out_unregister_clk_notifier; | 2875 | goto err_out_clk_dis_phy; |
2884 | } | 2876 | } |
2885 | 2877 | ||
2886 | lp->phy_node = of_node_get(lp->pdev->dev.of_node); | 2878 | lp->phy_node = of_node_get(lp->pdev->dev.of_node); |
@@ -2889,7 +2881,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2889 | ret = of_get_phy_mode(lp->pdev->dev.of_node); | 2881 | ret = of_get_phy_mode(lp->pdev->dev.of_node); |
2890 | if (ret < 0) { | 2882 | if (ret < 0) { |
2891 | dev_err(&lp->pdev->dev, "error in getting phy i/f\n"); | 2883 | dev_err(&lp->pdev->dev, "error in getting phy i/f\n"); |
2892 | goto err_out_unregister_clk_notifier; | 2884 | goto err_out_clk_dis_phy; |
2893 | } | 2885 | } |
2894 | 2886 | ||
2895 | lp->phy_interface = ret; | 2887 | lp->phy_interface = ret; |
@@ -2897,14 +2889,14 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2897 | ret = dwceqos_mii_init(lp); | 2889 | ret = dwceqos_mii_init(lp); |
2898 | if (ret) { | 2890 | if (ret) { |
2899 | dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n"); | 2891 | dev_err(&lp->pdev->dev, "error in dwceqos_mii_init\n"); |
2900 | goto err_out_unregister_clk_notifier; | 2892 | goto err_out_clk_dis_phy; |
2901 | } | 2893 | } |
2902 | 2894 | ||
2903 | ret = dwceqos_mii_probe(ndev); | 2895 | ret = dwceqos_mii_probe(ndev); |
2904 | if (ret != 0) { | 2896 | if (ret != 0) { |
2905 | netdev_err(ndev, "mii_probe fail.\n"); | 2897 | netdev_err(ndev, "mii_probe fail.\n"); |
2906 | ret = -ENXIO; | 2898 | ret = -ENXIO; |
2907 | goto err_out_unregister_clk_notifier; | 2899 | goto err_out_clk_dis_phy; |
2908 | } | 2900 | } |
2909 | 2901 | ||
2910 | dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0); | 2902 | dwceqos_set_umac_addr(lp, lp->ndev->dev_addr, 0); |
@@ -2922,7 +2914,7 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2922 | if (ret) { | 2914 | if (ret) { |
2923 | dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n", | 2915 | dev_err(&lp->pdev->dev, "Unable to retrieve DT, error %d\n", |
2924 | ret); | 2916 | ret); |
2925 | goto err_out_unregister_clk_notifier; | 2917 | goto err_out_clk_dis_phy; |
2926 | } | 2918 | } |
2927 | dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n", | 2919 | dev_info(&lp->pdev->dev, "pdev->id %d, baseaddr 0x%08lx, irq %d\n", |
2928 | pdev->id, ndev->base_addr, ndev->irq); | 2920 | pdev->id, ndev->base_addr, ndev->irq); |
@@ -2932,18 +2924,24 @@ static int dwceqos_probe(struct platform_device *pdev) | |||
2932 | if (ret) { | 2924 | if (ret) { |
2933 | dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n", | 2925 | dev_err(&lp->pdev->dev, "Unable to request IRQ %d, error %d\n", |
2934 | ndev->irq, ret); | 2926 | ndev->irq, ret); |
2935 | goto err_out_unregister_clk_notifier; | 2927 | goto err_out_clk_dis_phy; |
2936 | } | 2928 | } |
2937 | 2929 | ||
2938 | if (netif_msg_probe(lp)) | 2930 | if (netif_msg_probe(lp)) |
2939 | netdev_dbg(ndev, "net_local@%p\n", lp); | 2931 | netdev_dbg(ndev, "net_local@%p\n", lp); |
2940 | 2932 | ||
2933 | netif_napi_add(ndev, &lp->napi, dwceqos_rx_poll, NAPI_POLL_WEIGHT); | ||
2934 | |||
2935 | ret = register_netdev(ndev); | ||
2936 | if (ret) { | ||
2937 | dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); | ||
2938 | goto err_out_clk_dis_phy; | ||
2939 | } | ||
2940 | |||
2941 | return 0; | 2941 | return 0; |
2942 | 2942 | ||
2943 | err_out_unregister_clk_notifier: | 2943 | err_out_clk_dis_phy: |
2944 | clk_disable_unprepare(lp->phy_ref_clk); | 2944 | clk_disable_unprepare(lp->phy_ref_clk); |
2945 | err_out_unregister_netdev: | ||
2946 | unregister_netdev(ndev); | ||
2947 | err_out_clk_dis_aper: | 2945 | err_out_clk_dis_aper: |
2948 | clk_disable_unprepare(lp->apb_pclk); | 2946 | clk_disable_unprepare(lp->apb_pclk); |
2949 | err_out_free_netdev: | 2947 | err_out_free_netdev: |
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 47a64342cc16..b4863e4e522b 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -303,6 +303,7 @@ config MDIO_HISI_FEMAC | |||
303 | 303 | ||
304 | config MDIO_XGENE | 304 | config MDIO_XGENE |
305 | tristate "APM X-Gene SoC MDIO bus controller" | 305 | tristate "APM X-Gene SoC MDIO bus controller" |
306 | depends on ARCH_XGENE || COMPILE_TEST | ||
306 | help | 307 | help |
307 | This module provides a driver for the MDIO busses found in the | 308 | This module provides a driver for the MDIO busses found in the |
308 | APM X-Gene SoC's. | 309 | APM X-Gene SoC's. |
diff --git a/drivers/net/phy/mdio-xgene.c b/drivers/net/phy/mdio-xgene.c index 775674808249..92af182951be 100644 --- a/drivers/net/phy/mdio-xgene.c +++ b/drivers/net/phy/mdio-xgene.c | |||
@@ -424,10 +424,8 @@ static int xgene_mdio_remove(struct platform_device *pdev) | |||
424 | mdiobus_unregister(mdio_bus); | 424 | mdiobus_unregister(mdio_bus); |
425 | mdiobus_free(mdio_bus); | 425 | mdiobus_free(mdio_bus); |
426 | 426 | ||
427 | if (dev->of_node) { | 427 | if (dev->of_node) |
428 | if (IS_ERR(pdata->clk)) | 428 | clk_disable_unprepare(pdata->clk); |
429 | clk_disable_unprepare(pdata->clk); | ||
430 | } | ||
431 | 429 | ||
432 | return 0; | 430 | return 0; |
433 | } | 431 | } |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index f41a8ad4740e..c254248863d4 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #define NETNEXT_VERSION "08" | 32 | #define NETNEXT_VERSION "08" |
33 | 33 | ||
34 | /* Information for net */ | 34 | /* Information for net */ |
35 | #define NET_VERSION "5" | 35 | #define NET_VERSION "6" |
36 | 36 | ||
37 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION | 37 | #define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION |
38 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" | 38 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
@@ -2552,6 +2552,77 @@ static void r8152_aldps_en(struct r8152 *tp, bool enable) | |||
2552 | } | 2552 | } |
2553 | } | 2553 | } |
2554 | 2554 | ||
2555 | static inline void r8152_mmd_indirect(struct r8152 *tp, u16 dev, u16 reg) | ||
2556 | { | ||
2557 | ocp_reg_write(tp, OCP_EEE_AR, FUN_ADDR | dev); | ||
2558 | ocp_reg_write(tp, OCP_EEE_DATA, reg); | ||
2559 | ocp_reg_write(tp, OCP_EEE_AR, FUN_DATA | dev); | ||
2560 | } | ||
2561 | |||
2562 | static u16 r8152_mmd_read(struct r8152 *tp, u16 dev, u16 reg) | ||
2563 | { | ||
2564 | u16 data; | ||
2565 | |||
2566 | r8152_mmd_indirect(tp, dev, reg); | ||
2567 | data = ocp_reg_read(tp, OCP_EEE_DATA); | ||
2568 | ocp_reg_write(tp, OCP_EEE_AR, 0x0000); | ||
2569 | |||
2570 | return data; | ||
2571 | } | ||
2572 | |||
2573 | static void r8152_mmd_write(struct r8152 *tp, u16 dev, u16 reg, u16 data) | ||
2574 | { | ||
2575 | r8152_mmd_indirect(tp, dev, reg); | ||
2576 | ocp_reg_write(tp, OCP_EEE_DATA, data); | ||
2577 | ocp_reg_write(tp, OCP_EEE_AR, 0x0000); | ||
2578 | } | ||
2579 | |||
2580 | static void r8152_eee_en(struct r8152 *tp, bool enable) | ||
2581 | { | ||
2582 | u16 config1, config2, config3; | ||
2583 | u32 ocp_data; | ||
2584 | |||
2585 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); | ||
2586 | config1 = ocp_reg_read(tp, OCP_EEE_CONFIG1) & ~sd_rise_time_mask; | ||
2587 | config2 = ocp_reg_read(tp, OCP_EEE_CONFIG2); | ||
2588 | config3 = ocp_reg_read(tp, OCP_EEE_CONFIG3) & ~fast_snr_mask; | ||
2589 | |||
2590 | if (enable) { | ||
2591 | ocp_data |= EEE_RX_EN | EEE_TX_EN; | ||
2592 | config1 |= EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | RX_QUIET_EN; | ||
2593 | config1 |= sd_rise_time(1); | ||
2594 | config2 |= RG_DACQUIET_EN | RG_LDVQUIET_EN; | ||
2595 | config3 |= fast_snr(42); | ||
2596 | } else { | ||
2597 | ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); | ||
2598 | config1 &= ~(EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | | ||
2599 | RX_QUIET_EN); | ||
2600 | config1 |= sd_rise_time(7); | ||
2601 | config2 &= ~(RG_DACQUIET_EN | RG_LDVQUIET_EN); | ||
2602 | config3 |= fast_snr(511); | ||
2603 | } | ||
2604 | |||
2605 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); | ||
2606 | ocp_reg_write(tp, OCP_EEE_CONFIG1, config1); | ||
2607 | ocp_reg_write(tp, OCP_EEE_CONFIG2, config2); | ||
2608 | ocp_reg_write(tp, OCP_EEE_CONFIG3, config3); | ||
2609 | } | ||
2610 | |||
2611 | static void r8152b_enable_eee(struct r8152 *tp) | ||
2612 | { | ||
2613 | r8152_eee_en(tp, true); | ||
2614 | r8152_mmd_write(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, MDIO_EEE_100TX); | ||
2615 | } | ||
2616 | |||
2617 | static void r8152b_enable_fc(struct r8152 *tp) | ||
2618 | { | ||
2619 | u16 anar; | ||
2620 | |||
2621 | anar = r8152_mdio_read(tp, MII_ADVERTISE); | ||
2622 | anar |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | ||
2623 | r8152_mdio_write(tp, MII_ADVERTISE, anar); | ||
2624 | } | ||
2625 | |||
2555 | static void rtl8152_disable(struct r8152 *tp) | 2626 | static void rtl8152_disable(struct r8152 *tp) |
2556 | { | 2627 | { |
2557 | r8152_aldps_en(tp, false); | 2628 | r8152_aldps_en(tp, false); |
@@ -2561,13 +2632,9 @@ static void rtl8152_disable(struct r8152 *tp) | |||
2561 | 2632 | ||
2562 | static void r8152b_hw_phy_cfg(struct r8152 *tp) | 2633 | static void r8152b_hw_phy_cfg(struct r8152 *tp) |
2563 | { | 2634 | { |
2564 | u16 data; | 2635 | r8152b_enable_eee(tp); |
2565 | 2636 | r8152_aldps_en(tp, true); | |
2566 | data = r8152_mdio_read(tp, MII_BMCR); | 2637 | r8152b_enable_fc(tp); |
2567 | if (data & BMCR_PDOWN) { | ||
2568 | data &= ~BMCR_PDOWN; | ||
2569 | r8152_mdio_write(tp, MII_BMCR, data); | ||
2570 | } | ||
2571 | 2638 | ||
2572 | set_bit(PHY_RESET, &tp->flags); | 2639 | set_bit(PHY_RESET, &tp->flags); |
2573 | } | 2640 | } |
@@ -2701,20 +2768,52 @@ static void r8152b_enter_oob(struct r8152 *tp) | |||
2701 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 2768 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
2702 | } | 2769 | } |
2703 | 2770 | ||
2771 | static void r8153_aldps_en(struct r8152 *tp, bool enable) | ||
2772 | { | ||
2773 | u16 data; | ||
2774 | |||
2775 | data = ocp_reg_read(tp, OCP_POWER_CFG); | ||
2776 | if (enable) { | ||
2777 | data |= EN_ALDPS; | ||
2778 | ocp_reg_write(tp, OCP_POWER_CFG, data); | ||
2779 | } else { | ||
2780 | data &= ~EN_ALDPS; | ||
2781 | ocp_reg_write(tp, OCP_POWER_CFG, data); | ||
2782 | msleep(20); | ||
2783 | } | ||
2784 | } | ||
2785 | |||
2786 | static void r8153_eee_en(struct r8152 *tp, bool enable) | ||
2787 | { | ||
2788 | u32 ocp_data; | ||
2789 | u16 config; | ||
2790 | |||
2791 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); | ||
2792 | config = ocp_reg_read(tp, OCP_EEE_CFG); | ||
2793 | |||
2794 | if (enable) { | ||
2795 | ocp_data |= EEE_RX_EN | EEE_TX_EN; | ||
2796 | config |= EEE10_EN; | ||
2797 | } else { | ||
2798 | ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); | ||
2799 | config &= ~EEE10_EN; | ||
2800 | } | ||
2801 | |||
2802 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); | ||
2803 | ocp_reg_write(tp, OCP_EEE_CFG, config); | ||
2804 | } | ||
2805 | |||
2704 | static void r8153_hw_phy_cfg(struct r8152 *tp) | 2806 | static void r8153_hw_phy_cfg(struct r8152 *tp) |
2705 | { | 2807 | { |
2706 | u32 ocp_data; | 2808 | u32 ocp_data; |
2707 | u16 data; | 2809 | u16 data; |
2708 | 2810 | ||
2709 | if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 || | 2811 | /* disable ALDPS before updating the PHY parameters */ |
2710 | tp->version == RTL_VER_05) | 2812 | r8153_aldps_en(tp, false); |
2711 | ocp_reg_write(tp, OCP_ADC_CFG, CKADSEL_L | ADC_EN | EN_EMI_L); | ||
2712 | 2813 | ||
2713 | data = r8152_mdio_read(tp, MII_BMCR); | 2814 | /* disable EEE before updating the PHY parameters */ |
2714 | if (data & BMCR_PDOWN) { | 2815 | r8153_eee_en(tp, false); |
2715 | data &= ~BMCR_PDOWN; | 2816 | ocp_reg_write(tp, OCP_EEE_ADV, 0); |
2716 | r8152_mdio_write(tp, MII_BMCR, data); | ||
2717 | } | ||
2718 | 2817 | ||
2719 | if (tp->version == RTL_VER_03) { | 2818 | if (tp->version == RTL_VER_03) { |
2720 | data = ocp_reg_read(tp, OCP_EEE_CFG); | 2819 | data = ocp_reg_read(tp, OCP_EEE_CFG); |
@@ -2745,6 +2844,12 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) | |||
2745 | sram_write(tp, SRAM_10M_AMP1, 0x00af); | 2844 | sram_write(tp, SRAM_10M_AMP1, 0x00af); |
2746 | sram_write(tp, SRAM_10M_AMP2, 0x0208); | 2845 | sram_write(tp, SRAM_10M_AMP2, 0x0208); |
2747 | 2846 | ||
2847 | r8153_eee_en(tp, true); | ||
2848 | ocp_reg_write(tp, OCP_EEE_ADV, MDIO_EEE_1000T | MDIO_EEE_100TX); | ||
2849 | |||
2850 | r8153_aldps_en(tp, true); | ||
2851 | r8152b_enable_fc(tp); | ||
2852 | |||
2748 | set_bit(PHY_RESET, &tp->flags); | 2853 | set_bit(PHY_RESET, &tp->flags); |
2749 | } | 2854 | } |
2750 | 2855 | ||
@@ -2866,21 +2971,6 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
2866 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 2971 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
2867 | } | 2972 | } |
2868 | 2973 | ||
2869 | static void r8153_aldps_en(struct r8152 *tp, bool enable) | ||
2870 | { | ||
2871 | u16 data; | ||
2872 | |||
2873 | data = ocp_reg_read(tp, OCP_POWER_CFG); | ||
2874 | if (enable) { | ||
2875 | data |= EN_ALDPS; | ||
2876 | ocp_reg_write(tp, OCP_POWER_CFG, data); | ||
2877 | } else { | ||
2878 | data &= ~EN_ALDPS; | ||
2879 | ocp_reg_write(tp, OCP_POWER_CFG, data); | ||
2880 | msleep(20); | ||
2881 | } | ||
2882 | } | ||
2883 | |||
2884 | static void rtl8153_disable(struct r8152 *tp) | 2974 | static void rtl8153_disable(struct r8152 *tp) |
2885 | { | 2975 | { |
2886 | r8153_aldps_en(tp, false); | 2976 | r8153_aldps_en(tp, false); |
@@ -3246,103 +3336,6 @@ static int rtl8152_close(struct net_device *netdev) | |||
3246 | return res; | 3336 | return res; |
3247 | } | 3337 | } |
3248 | 3338 | ||
3249 | static inline void r8152_mmd_indirect(struct r8152 *tp, u16 dev, u16 reg) | ||
3250 | { | ||
3251 | ocp_reg_write(tp, OCP_EEE_AR, FUN_ADDR | dev); | ||
3252 | ocp_reg_write(tp, OCP_EEE_DATA, reg); | ||
3253 | ocp_reg_write(tp, OCP_EEE_AR, FUN_DATA | dev); | ||
3254 | } | ||
3255 | |||
3256 | static u16 r8152_mmd_read(struct r8152 *tp, u16 dev, u16 reg) | ||
3257 | { | ||
3258 | u16 data; | ||
3259 | |||
3260 | r8152_mmd_indirect(tp, dev, reg); | ||
3261 | data = ocp_reg_read(tp, OCP_EEE_DATA); | ||
3262 | ocp_reg_write(tp, OCP_EEE_AR, 0x0000); | ||
3263 | |||
3264 | return data; | ||
3265 | } | ||
3266 | |||
3267 | static void r8152_mmd_write(struct r8152 *tp, u16 dev, u16 reg, u16 data) | ||
3268 | { | ||
3269 | r8152_mmd_indirect(tp, dev, reg); | ||
3270 | ocp_reg_write(tp, OCP_EEE_DATA, data); | ||
3271 | ocp_reg_write(tp, OCP_EEE_AR, 0x0000); | ||
3272 | } | ||
3273 | |||
3274 | static void r8152_eee_en(struct r8152 *tp, bool enable) | ||
3275 | { | ||
3276 | u16 config1, config2, config3; | ||
3277 | u32 ocp_data; | ||
3278 | |||
3279 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); | ||
3280 | config1 = ocp_reg_read(tp, OCP_EEE_CONFIG1) & ~sd_rise_time_mask; | ||
3281 | config2 = ocp_reg_read(tp, OCP_EEE_CONFIG2); | ||
3282 | config3 = ocp_reg_read(tp, OCP_EEE_CONFIG3) & ~fast_snr_mask; | ||
3283 | |||
3284 | if (enable) { | ||
3285 | ocp_data |= EEE_RX_EN | EEE_TX_EN; | ||
3286 | config1 |= EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | RX_QUIET_EN; | ||
3287 | config1 |= sd_rise_time(1); | ||
3288 | config2 |= RG_DACQUIET_EN | RG_LDVQUIET_EN; | ||
3289 | config3 |= fast_snr(42); | ||
3290 | } else { | ||
3291 | ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); | ||
3292 | config1 &= ~(EEE_10_CAP | EEE_NWAY_EN | TX_QUIET_EN | | ||
3293 | RX_QUIET_EN); | ||
3294 | config1 |= sd_rise_time(7); | ||
3295 | config2 &= ~(RG_DACQUIET_EN | RG_LDVQUIET_EN); | ||
3296 | config3 |= fast_snr(511); | ||
3297 | } | ||
3298 | |||
3299 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); | ||
3300 | ocp_reg_write(tp, OCP_EEE_CONFIG1, config1); | ||
3301 | ocp_reg_write(tp, OCP_EEE_CONFIG2, config2); | ||
3302 | ocp_reg_write(tp, OCP_EEE_CONFIG3, config3); | ||
3303 | } | ||
3304 | |||
3305 | static void r8152b_enable_eee(struct r8152 *tp) | ||
3306 | { | ||
3307 | r8152_eee_en(tp, true); | ||
3308 | r8152_mmd_write(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, MDIO_EEE_100TX); | ||
3309 | } | ||
3310 | |||
3311 | static void r8153_eee_en(struct r8152 *tp, bool enable) | ||
3312 | { | ||
3313 | u32 ocp_data; | ||
3314 | u16 config; | ||
3315 | |||
3316 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); | ||
3317 | config = ocp_reg_read(tp, OCP_EEE_CFG); | ||
3318 | |||
3319 | if (enable) { | ||
3320 | ocp_data |= EEE_RX_EN | EEE_TX_EN; | ||
3321 | config |= EEE10_EN; | ||
3322 | } else { | ||
3323 | ocp_data &= ~(EEE_RX_EN | EEE_TX_EN); | ||
3324 | config &= ~EEE10_EN; | ||
3325 | } | ||
3326 | |||
3327 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEE_CR, ocp_data); | ||
3328 | ocp_reg_write(tp, OCP_EEE_CFG, config); | ||
3329 | } | ||
3330 | |||
3331 | static void r8153_enable_eee(struct r8152 *tp) | ||
3332 | { | ||
3333 | r8153_eee_en(tp, true); | ||
3334 | ocp_reg_write(tp, OCP_EEE_ADV, MDIO_EEE_1000T | MDIO_EEE_100TX); | ||
3335 | } | ||
3336 | |||
3337 | static void r8152b_enable_fc(struct r8152 *tp) | ||
3338 | { | ||
3339 | u16 anar; | ||
3340 | |||
3341 | anar = r8152_mdio_read(tp, MII_ADVERTISE); | ||
3342 | anar |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; | ||
3343 | r8152_mdio_write(tp, MII_ADVERTISE, anar); | ||
3344 | } | ||
3345 | |||
3346 | static void rtl_tally_reset(struct r8152 *tp) | 3339 | static void rtl_tally_reset(struct r8152 *tp) |
3347 | { | 3340 | { |
3348 | u32 ocp_data; | 3341 | u32 ocp_data; |
@@ -3355,10 +3348,17 @@ static void rtl_tally_reset(struct r8152 *tp) | |||
3355 | static void r8152b_init(struct r8152 *tp) | 3348 | static void r8152b_init(struct r8152 *tp) |
3356 | { | 3349 | { |
3357 | u32 ocp_data; | 3350 | u32 ocp_data; |
3351 | u16 data; | ||
3358 | 3352 | ||
3359 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3353 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
3360 | return; | 3354 | return; |
3361 | 3355 | ||
3356 | data = r8152_mdio_read(tp, MII_BMCR); | ||
3357 | if (data & BMCR_PDOWN) { | ||
3358 | data &= ~BMCR_PDOWN; | ||
3359 | r8152_mdio_write(tp, MII_BMCR, data); | ||
3360 | } | ||
3361 | |||
3362 | r8152_aldps_en(tp, false); | 3362 | r8152_aldps_en(tp, false); |
3363 | 3363 | ||
3364 | if (tp->version == RTL_VER_01) { | 3364 | if (tp->version == RTL_VER_01) { |
@@ -3380,9 +3380,6 @@ static void r8152b_init(struct r8152 *tp) | |||
3380 | SPDWN_RXDV_MSK | SPDWN_LINKCHG_MSK; | 3380 | SPDWN_RXDV_MSK | SPDWN_LINKCHG_MSK; |
3381 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_GPHY_INTR_IMR, ocp_data); | 3381 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_GPHY_INTR_IMR, ocp_data); |
3382 | 3382 | ||
3383 | r8152b_enable_eee(tp); | ||
3384 | r8152_aldps_en(tp, true); | ||
3385 | r8152b_enable_fc(tp); | ||
3386 | rtl_tally_reset(tp); | 3383 | rtl_tally_reset(tp); |
3387 | 3384 | ||
3388 | /* enable rx aggregation */ | 3385 | /* enable rx aggregation */ |
@@ -3394,12 +3391,12 @@ static void r8152b_init(struct r8152 *tp) | |||
3394 | static void r8153_init(struct r8152 *tp) | 3391 | static void r8153_init(struct r8152 *tp) |
3395 | { | 3392 | { |
3396 | u32 ocp_data; | 3393 | u32 ocp_data; |
3394 | u16 data; | ||
3397 | int i; | 3395 | int i; |
3398 | 3396 | ||
3399 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3397 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
3400 | return; | 3398 | return; |
3401 | 3399 | ||
3402 | r8153_aldps_en(tp, false); | ||
3403 | r8153_u1u2en(tp, false); | 3400 | r8153_u1u2en(tp, false); |
3404 | 3401 | ||
3405 | for (i = 0; i < 500; i++) { | 3402 | for (i = 0; i < 500; i++) { |
@@ -3416,6 +3413,23 @@ static void r8153_init(struct r8152 *tp) | |||
3416 | msleep(20); | 3413 | msleep(20); |
3417 | } | 3414 | } |
3418 | 3415 | ||
3416 | if (tp->version == RTL_VER_03 || tp->version == RTL_VER_04 || | ||
3417 | tp->version == RTL_VER_05) | ||
3418 | ocp_reg_write(tp, OCP_ADC_CFG, CKADSEL_L | ADC_EN | EN_EMI_L); | ||
3419 | |||
3420 | data = r8152_mdio_read(tp, MII_BMCR); | ||
3421 | if (data & BMCR_PDOWN) { | ||
3422 | data &= ~BMCR_PDOWN; | ||
3423 | r8152_mdio_write(tp, MII_BMCR, data); | ||
3424 | } | ||
3425 | |||
3426 | for (i = 0; i < 500; i++) { | ||
3427 | ocp_data = ocp_reg_read(tp, OCP_PHY_STATUS) & PHY_STAT_MASK; | ||
3428 | if (ocp_data == PHY_STAT_LAN_ON) | ||
3429 | break; | ||
3430 | msleep(20); | ||
3431 | } | ||
3432 | |||
3419 | usb_disable_lpm(tp->udev); | 3433 | usb_disable_lpm(tp->udev); |
3420 | r8153_u2p3en(tp, false); | 3434 | r8153_u2p3en(tp, false); |
3421 | 3435 | ||
@@ -3483,9 +3497,6 @@ static void r8153_init(struct r8152 *tp) | |||
3483 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0); | 3497 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL3, 0); |
3484 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0); | 3498 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MAC_PWR_CTRL4, 0); |
3485 | 3499 | ||
3486 | r8153_enable_eee(tp); | ||
3487 | r8153_aldps_en(tp, true); | ||
3488 | r8152b_enable_fc(tp); | ||
3489 | rtl_tally_reset(tp); | 3500 | rtl_tally_reset(tp); |
3490 | r8153_u2p3en(tp, true); | 3501 | r8153_u2p3en(tp, true); |
3491 | } | 3502 | } |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index c0dda6fc0921..6e65832051d6 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2782,14 +2782,15 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
2782 | struct net_device *lowerdev = NULL; | 2782 | struct net_device *lowerdev = NULL; |
2783 | 2783 | ||
2784 | if (conf->flags & VXLAN_F_GPE) { | 2784 | if (conf->flags & VXLAN_F_GPE) { |
2785 | if (conf->flags & ~VXLAN_F_ALLOWED_GPE) | ||
2786 | return -EINVAL; | ||
2787 | /* For now, allow GPE only together with COLLECT_METADATA. | 2785 | /* For now, allow GPE only together with COLLECT_METADATA. |
2788 | * This can be relaxed later; in such case, the other side | 2786 | * This can be relaxed later; in such case, the other side |
2789 | * of the PtP link will have to be provided. | 2787 | * of the PtP link will have to be provided. |
2790 | */ | 2788 | */ |
2791 | if (!(conf->flags & VXLAN_F_COLLECT_METADATA)) | 2789 | if ((conf->flags & ~VXLAN_F_ALLOWED_GPE) || |
2790 | !(conf->flags & VXLAN_F_COLLECT_METADATA)) { | ||
2791 | pr_info("unsupported combination of extensions\n"); | ||
2792 | return -EINVAL; | 2792 | return -EINVAL; |
2793 | } | ||
2793 | 2794 | ||
2794 | vxlan_raw_setup(dev); | 2795 | vxlan_raw_setup(dev); |
2795 | } else { | 2796 | } else { |
@@ -2842,6 +2843,9 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
2842 | dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); | 2843 | dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); |
2843 | 2844 | ||
2844 | needed_headroom = lowerdev->hard_header_len; | 2845 | needed_headroom = lowerdev->hard_header_len; |
2846 | } else if (vxlan_addr_multicast(&dst->remote_ip)) { | ||
2847 | pr_info("multicast destination requires interface to be specified\n"); | ||
2848 | return -EINVAL; | ||
2845 | } | 2849 | } |
2846 | 2850 | ||
2847 | if (conf->mtu) { | 2851 | if (conf->mtu) { |
@@ -2874,8 +2878,10 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev, | |||
2874 | tmp->cfg.saddr.sa.sa_family == AF_INET6) == use_ipv6 && | 2878 | tmp->cfg.saddr.sa.sa_family == AF_INET6) == use_ipv6 && |
2875 | tmp->cfg.dst_port == vxlan->cfg.dst_port && | 2879 | tmp->cfg.dst_port == vxlan->cfg.dst_port && |
2876 | (tmp->flags & VXLAN_F_RCV_FLAGS) == | 2880 | (tmp->flags & VXLAN_F_RCV_FLAGS) == |
2877 | (vxlan->flags & VXLAN_F_RCV_FLAGS)) | 2881 | (vxlan->flags & VXLAN_F_RCV_FLAGS)) { |
2878 | return -EEXIST; | 2882 | pr_info("duplicate VNI %u\n", be32_to_cpu(conf->vni)); |
2883 | return -EEXIST; | ||
2884 | } | ||
2879 | } | 2885 | } |
2880 | 2886 | ||
2881 | dev->ethtool_ops = &vxlan_ethtool_ops; | 2887 | dev->ethtool_ops = &vxlan_ethtool_ops; |
@@ -2909,7 +2915,6 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, | |||
2909 | struct nlattr *tb[], struct nlattr *data[]) | 2915 | struct nlattr *tb[], struct nlattr *data[]) |
2910 | { | 2916 | { |
2911 | struct vxlan_config conf; | 2917 | struct vxlan_config conf; |
2912 | int err; | ||
2913 | 2918 | ||
2914 | memset(&conf, 0, sizeof(conf)); | 2919 | memset(&conf, 0, sizeof(conf)); |
2915 | 2920 | ||
@@ -3018,26 +3023,7 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, | |||
3018 | if (tb[IFLA_MTU]) | 3023 | if (tb[IFLA_MTU]) |
3019 | conf.mtu = nla_get_u32(tb[IFLA_MTU]); | 3024 | conf.mtu = nla_get_u32(tb[IFLA_MTU]); |
3020 | 3025 | ||
3021 | err = vxlan_dev_configure(src_net, dev, &conf); | 3026 | return vxlan_dev_configure(src_net, dev, &conf); |
3022 | switch (err) { | ||
3023 | case -ENODEV: | ||
3024 | pr_info("ifindex %d does not exist\n", conf.remote_ifindex); | ||
3025 | break; | ||
3026 | |||
3027 | case -EPERM: | ||
3028 | pr_info("IPv6 is disabled via sysctl\n"); | ||
3029 | break; | ||
3030 | |||
3031 | case -EEXIST: | ||
3032 | pr_info("duplicate VNI %u\n", be32_to_cpu(conf.vni)); | ||
3033 | break; | ||
3034 | |||
3035 | case -EINVAL: | ||
3036 | pr_info("unsupported combination of extensions\n"); | ||
3037 | break; | ||
3038 | } | ||
3039 | |||
3040 | return err; | ||
3041 | } | 3027 | } |
3042 | 3028 | ||
3043 | static void vxlan_dellink(struct net_device *dev, struct list_head *head) | 3029 | static void vxlan_dellink(struct net_device *dev, struct list_head *head) |
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 78db5d679f19..24c8d65bcf34 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c | |||
@@ -1525,7 +1525,7 @@ static void ath10k_htt_rx_h_filter(struct ath10k *ar, | |||
1525 | static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) | 1525 | static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) |
1526 | { | 1526 | { |
1527 | struct ath10k *ar = htt->ar; | 1527 | struct ath10k *ar = htt->ar; |
1528 | static struct ieee80211_rx_status rx_status; | 1528 | struct ieee80211_rx_status *rx_status = &htt->rx_status; |
1529 | struct sk_buff_head amsdu; | 1529 | struct sk_buff_head amsdu; |
1530 | int ret; | 1530 | int ret; |
1531 | 1531 | ||
@@ -1549,11 +1549,11 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) | |||
1549 | return ret; | 1549 | return ret; |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | ath10k_htt_rx_h_ppdu(ar, &amsdu, &rx_status, 0xffff); | 1552 | ath10k_htt_rx_h_ppdu(ar, &amsdu, rx_status, 0xffff); |
1553 | ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); | 1553 | ath10k_htt_rx_h_unchain(ar, &amsdu, ret > 0); |
1554 | ath10k_htt_rx_h_filter(ar, &amsdu, &rx_status); | 1554 | ath10k_htt_rx_h_filter(ar, &amsdu, rx_status); |
1555 | ath10k_htt_rx_h_mpdu(ar, &amsdu, &rx_status); | 1555 | ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status); |
1556 | ath10k_htt_rx_h_deliver(ar, &amsdu, &rx_status); | 1556 | ath10k_htt_rx_h_deliver(ar, &amsdu, rx_status); |
1557 | 1557 | ||
1558 | return 0; | 1558 | return 0; |
1559 | } | 1559 | } |
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 9a22c478dd1b..07933c51a850 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
@@ -3162,7 +3162,6 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
3162 | pci_hard_reset = ath10k_pci_qca988x_chip_reset; | 3162 | pci_hard_reset = ath10k_pci_qca988x_chip_reset; |
3163 | break; | 3163 | break; |
3164 | case QCA9887_1_0_DEVICE_ID: | 3164 | case QCA9887_1_0_DEVICE_ID: |
3165 | dev_warn(&pdev->dev, "QCA9887 support is still experimental, there are likely bugs. You have been warned.\n"); | ||
3166 | hw_rev = ATH10K_HW_QCA9887; | 3165 | hw_rev = ATH10K_HW_QCA9887; |
3167 | pci_ps = false; | 3166 | pci_ps = false; |
3168 | pci_soft_reset = ath10k_pci_warm_reset; | 3167 | pci_soft_reset = ath10k_pci_warm_reset; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index d1d0c06d627c..14b13f07cd1f 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -2482,6 +2482,8 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2482 | return -EINVAL; | 2482 | return -EINVAL; |
2483 | } | 2483 | } |
2484 | 2484 | ||
2485 | ath9k_gpio_cap_init(ah); | ||
2486 | |||
2485 | if (AR_SREV_9485(ah) || | 2487 | if (AR_SREV_9485(ah) || |
2486 | AR_SREV_9285(ah) || | 2488 | AR_SREV_9285(ah) || |
2487 | AR_SREV_9330(ah) || | 2489 | AR_SREV_9330(ah) || |
@@ -2531,8 +2533,6 @@ int ath9k_hw_fill_cap_info(struct ath_hw *ah) | |||
2531 | else | 2533 | else |
2532 | pCap->hw_caps &= ~ATH9K_HW_CAP_HT; | 2534 | pCap->hw_caps &= ~ATH9K_HW_CAP_HT; |
2533 | 2535 | ||
2534 | ath9k_gpio_cap_init(ah); | ||
2535 | |||
2536 | if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) | 2536 | if (AR_SREV_9160_10_OR_LATER(ah) || AR_SREV_9100(ah)) |
2537 | pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX; | 2537 | pCap->rts_aggr_limit = ATH_AMPDU_LIMIT_MAX; |
2538 | else | 2538 | else |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index a394622c9022..7cb65c303f8d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -718,9 +718,12 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
718 | if (!ath_complete_reset(sc, false)) | 718 | if (!ath_complete_reset(sc, false)) |
719 | ah->reset_power_on = false; | 719 | ah->reset_power_on = false; |
720 | 720 | ||
721 | if (ah->led_pin >= 0) | 721 | if (ah->led_pin >= 0) { |
722 | ath9k_hw_set_gpio(ah, ah->led_pin, | 722 | ath9k_hw_set_gpio(ah, ah->led_pin, |
723 | (ah->config.led_active_high) ? 1 : 0); | 723 | (ah->config.led_active_high) ? 1 : 0); |
724 | ath9k_hw_gpio_request_out(ah, ah->led_pin, NULL, | ||
725 | AR_GPIO_OUTPUT_MUX_AS_OUTPUT); | ||
726 | } | ||
724 | 727 | ||
725 | /* | 728 | /* |
726 | * Reset key cache to sane defaults (all entries cleared) instead of | 729 | * Reset key cache to sane defaults (all entries cleared) instead of |
@@ -864,9 +867,11 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
864 | 867 | ||
865 | spin_lock_bh(&sc->sc_pcu_lock); | 868 | spin_lock_bh(&sc->sc_pcu_lock); |
866 | 869 | ||
867 | if (ah->led_pin >= 0) | 870 | if (ah->led_pin >= 0) { |
868 | ath9k_hw_set_gpio(ah, ah->led_pin, | 871 | ath9k_hw_set_gpio(ah, ah->led_pin, |
869 | (ah->config.led_active_high) ? 0 : 1); | 872 | (ah->config.led_active_high) ? 0 : 1); |
873 | ath9k_hw_gpio_request_in(ah, ah->led_pin, NULL); | ||
874 | } | ||
870 | 875 | ||
871 | ath_prepare_reset(sc); | 876 | ath_prepare_reset(sc); |
872 | 877 | ||
@@ -1154,6 +1159,7 @@ void ath9k_calculate_summary_state(struct ath_softc *sc, | |||
1154 | bool changed = (iter_data.primary_sta != ctx->primary_sta); | 1159 | bool changed = (iter_data.primary_sta != ctx->primary_sta); |
1155 | 1160 | ||
1156 | if (iter_data.primary_sta) { | 1161 | if (iter_data.primary_sta) { |
1162 | iter_data.primary_beacon_vif = iter_data.primary_sta; | ||
1157 | iter_data.beacons = true; | 1163 | iter_data.beacons = true; |
1158 | ath9k_set_assoc_state(sc, iter_data.primary_sta, | 1164 | ath9k_set_assoc_state(sc, iter_data.primary_sta, |
1159 | changed); | 1165 | changed); |
@@ -1563,13 +1569,13 @@ static int ath9k_sta_state(struct ieee80211_hw *hw, | |||
1563 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1569 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1564 | int ret = 0; | 1570 | int ret = 0; |
1565 | 1571 | ||
1566 | if (old_state == IEEE80211_STA_AUTH && | 1572 | if (old_state == IEEE80211_STA_NOTEXIST && |
1567 | new_state == IEEE80211_STA_ASSOC) { | 1573 | new_state == IEEE80211_STA_NONE) { |
1568 | ret = ath9k_sta_add(hw, vif, sta); | 1574 | ret = ath9k_sta_add(hw, vif, sta); |
1569 | ath_dbg(common, CONFIG, | 1575 | ath_dbg(common, CONFIG, |
1570 | "Add station: %pM\n", sta->addr); | 1576 | "Add station: %pM\n", sta->addr); |
1571 | } else if (old_state == IEEE80211_STA_ASSOC && | 1577 | } else if (old_state == IEEE80211_STA_NONE && |
1572 | new_state == IEEE80211_STA_AUTH) { | 1578 | new_state == IEEE80211_STA_NOTEXIST) { |
1573 | ret = ath9k_sta_remove(hw, vif, sta); | 1579 | ret = ath9k_sta_remove(hw, vif, sta); |
1574 | ath_dbg(common, CONFIG, | 1580 | ath_dbg(common, CONFIG, |
1575 | "Remove station: %pM\n", sta->addr); | 1581 | "Remove station: %pM\n", sta->addr); |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 2628d5e12c64..b8aec5e5ef93 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | |||
@@ -4527,7 +4527,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, | |||
4527 | (u8 *)&settings->beacon.head[ie_offset], | 4527 | (u8 *)&settings->beacon.head[ie_offset], |
4528 | settings->beacon.head_len - ie_offset, | 4528 | settings->beacon.head_len - ie_offset, |
4529 | WLAN_EID_SSID); | 4529 | WLAN_EID_SSID); |
4530 | if (!ssid_ie) | 4530 | if (!ssid_ie || ssid_ie->len > IEEE80211_MAX_SSID_LEN) |
4531 | return -EINVAL; | 4531 | return -EINVAL; |
4532 | 4532 | ||
4533 | memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); | 4533 | memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); |
@@ -5635,7 +5635,7 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
5635 | ifevent->action, ifevent->flags, ifevent->ifidx, | 5635 | ifevent->action, ifevent->flags, ifevent->ifidx, |
5636 | ifevent->bsscfgidx); | 5636 | ifevent->bsscfgidx); |
5637 | 5637 | ||
5638 | mutex_lock(&event->vif_event_lock); | 5638 | spin_lock(&event->vif_event_lock); |
5639 | event->action = ifevent->action; | 5639 | event->action = ifevent->action; |
5640 | vif = event->vif; | 5640 | vif = event->vif; |
5641 | 5641 | ||
@@ -5643,7 +5643,7 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
5643 | case BRCMF_E_IF_ADD: | 5643 | case BRCMF_E_IF_ADD: |
5644 | /* waiting process may have timed out */ | 5644 | /* waiting process may have timed out */ |
5645 | if (!cfg->vif_event.vif) { | 5645 | if (!cfg->vif_event.vif) { |
5646 | mutex_unlock(&event->vif_event_lock); | 5646 | spin_unlock(&event->vif_event_lock); |
5647 | return -EBADF; | 5647 | return -EBADF; |
5648 | } | 5648 | } |
5649 | 5649 | ||
@@ -5654,24 +5654,24 @@ static s32 brcmf_notify_vif_event(struct brcmf_if *ifp, | |||
5654 | ifp->ndev->ieee80211_ptr = &vif->wdev; | 5654 | ifp->ndev->ieee80211_ptr = &vif->wdev; |
5655 | SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); | 5655 | SET_NETDEV_DEV(ifp->ndev, wiphy_dev(cfg->wiphy)); |
5656 | } | 5656 | } |
5657 | mutex_unlock(&event->vif_event_lock); | 5657 | spin_unlock(&event->vif_event_lock); |
5658 | wake_up(&event->vif_wq); | 5658 | wake_up(&event->vif_wq); |
5659 | return 0; | 5659 | return 0; |
5660 | 5660 | ||
5661 | case BRCMF_E_IF_DEL: | 5661 | case BRCMF_E_IF_DEL: |
5662 | mutex_unlock(&event->vif_event_lock); | 5662 | spin_unlock(&event->vif_event_lock); |
5663 | /* event may not be upon user request */ | 5663 | /* event may not be upon user request */ |
5664 | if (brcmf_cfg80211_vif_event_armed(cfg)) | 5664 | if (brcmf_cfg80211_vif_event_armed(cfg)) |
5665 | wake_up(&event->vif_wq); | 5665 | wake_up(&event->vif_wq); |
5666 | return 0; | 5666 | return 0; |
5667 | 5667 | ||
5668 | case BRCMF_E_IF_CHANGE: | 5668 | case BRCMF_E_IF_CHANGE: |
5669 | mutex_unlock(&event->vif_event_lock); | 5669 | spin_unlock(&event->vif_event_lock); |
5670 | wake_up(&event->vif_wq); | 5670 | wake_up(&event->vif_wq); |
5671 | return 0; | 5671 | return 0; |
5672 | 5672 | ||
5673 | default: | 5673 | default: |
5674 | mutex_unlock(&event->vif_event_lock); | 5674 | spin_unlock(&event->vif_event_lock); |
5675 | break; | 5675 | break; |
5676 | } | 5676 | } |
5677 | return -EINVAL; | 5677 | return -EINVAL; |
@@ -5792,7 +5792,7 @@ static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) | |||
5792 | static void init_vif_event(struct brcmf_cfg80211_vif_event *event) | 5792 | static void init_vif_event(struct brcmf_cfg80211_vif_event *event) |
5793 | { | 5793 | { |
5794 | init_waitqueue_head(&event->vif_wq); | 5794 | init_waitqueue_head(&event->vif_wq); |
5795 | mutex_init(&event->vif_event_lock); | 5795 | spin_lock_init(&event->vif_event_lock); |
5796 | } | 5796 | } |
5797 | 5797 | ||
5798 | static s32 brcmf_dongle_roam(struct brcmf_if *ifp) | 5798 | static s32 brcmf_dongle_roam(struct brcmf_if *ifp) |
@@ -6691,9 +6691,9 @@ static inline bool vif_event_equals(struct brcmf_cfg80211_vif_event *event, | |||
6691 | { | 6691 | { |
6692 | u8 evt_action; | 6692 | u8 evt_action; |
6693 | 6693 | ||
6694 | mutex_lock(&event->vif_event_lock); | 6694 | spin_lock(&event->vif_event_lock); |
6695 | evt_action = event->action; | 6695 | evt_action = event->action; |
6696 | mutex_unlock(&event->vif_event_lock); | 6696 | spin_unlock(&event->vif_event_lock); |
6697 | return evt_action == action; | 6697 | return evt_action == action; |
6698 | } | 6698 | } |
6699 | 6699 | ||
@@ -6702,10 +6702,10 @@ void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg, | |||
6702 | { | 6702 | { |
6703 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; | 6703 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; |
6704 | 6704 | ||
6705 | mutex_lock(&event->vif_event_lock); | 6705 | spin_lock(&event->vif_event_lock); |
6706 | event->vif = vif; | 6706 | event->vif = vif; |
6707 | event->action = 0; | 6707 | event->action = 0; |
6708 | mutex_unlock(&event->vif_event_lock); | 6708 | spin_unlock(&event->vif_event_lock); |
6709 | } | 6709 | } |
6710 | 6710 | ||
6711 | bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) | 6711 | bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) |
@@ -6713,9 +6713,9 @@ bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg) | |||
6713 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; | 6713 | struct brcmf_cfg80211_vif_event *event = &cfg->vif_event; |
6714 | bool armed; | 6714 | bool armed; |
6715 | 6715 | ||
6716 | mutex_lock(&event->vif_event_lock); | 6716 | spin_lock(&event->vif_event_lock); |
6717 | armed = event->vif != NULL; | 6717 | armed = event->vif != NULL; |
6718 | mutex_unlock(&event->vif_event_lock); | 6718 | spin_unlock(&event->vif_event_lock); |
6719 | 6719 | ||
6720 | return armed; | 6720 | return armed; |
6721 | } | 6721 | } |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h index 7d77f869b7f1..8889832c17e0 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h | |||
@@ -227,7 +227,7 @@ struct escan_info { | |||
227 | */ | 227 | */ |
228 | struct brcmf_cfg80211_vif_event { | 228 | struct brcmf_cfg80211_vif_event { |
229 | wait_queue_head_t vif_wq; | 229 | wait_queue_head_t vif_wq; |
230 | struct mutex vif_event_lock; | 230 | spinlock_t vif_event_lock; |
231 | u8 action; | 231 | u8 action; |
232 | struct brcmf_cfg80211_vif *vif; | 232 | struct brcmf_cfg80211_vif *vif; |
233 | }; | 233 | }; |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 8d16f0204985..65e8c8766441 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | |||
@@ -743,7 +743,7 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, | |||
743 | * serious troublesome side effects. The p2p module will clean | 743 | * serious troublesome side effects. The p2p module will clean |
744 | * up the ifp if needed. | 744 | * up the ifp if needed. |
745 | */ | 745 | */ |
746 | brcmf_p2p_ifp_removed(ifp); | 746 | brcmf_p2p_ifp_removed(ifp, rtnl_locked); |
747 | kfree(ifp); | 747 | kfree(ifp); |
748 | } | 748 | } |
749 | } | 749 | } |
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c index 66f942f7448e..de19c7c92bc6 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | |||
@@ -2297,7 +2297,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) | |||
2297 | return err; | 2297 | return err; |
2298 | } | 2298 | } |
2299 | 2299 | ||
2300 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp) | 2300 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked) |
2301 | { | 2301 | { |
2302 | struct brcmf_cfg80211_info *cfg; | 2302 | struct brcmf_cfg80211_info *cfg; |
2303 | struct brcmf_cfg80211_vif *vif; | 2303 | struct brcmf_cfg80211_vif *vif; |
@@ -2306,9 +2306,11 @@ void brcmf_p2p_ifp_removed(struct brcmf_if *ifp) | |||
2306 | vif = ifp->vif; | 2306 | vif = ifp->vif; |
2307 | cfg = wdev_to_cfg(&vif->wdev); | 2307 | cfg = wdev_to_cfg(&vif->wdev); |
2308 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; | 2308 | cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; |
2309 | rtnl_lock(); | 2309 | if (!rtnl_locked) |
2310 | rtnl_lock(); | ||
2310 | cfg80211_unregister_wdev(&vif->wdev); | 2311 | cfg80211_unregister_wdev(&vif->wdev); |
2311 | rtnl_unlock(); | 2312 | if (!rtnl_locked) |
2313 | rtnl_unlock(); | ||
2312 | brcmf_free_vif(vif); | 2314 | brcmf_free_vif(vif); |
2313 | } | 2315 | } |
2314 | 2316 | ||
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h index a3bd18c2360b..8ce9447533ef 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | |||
@@ -155,7 +155,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, | |||
155 | int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); | 155 | int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev); |
156 | int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, | 156 | int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg, |
157 | enum brcmf_fil_p2p_if_types if_type); | 157 | enum brcmf_fil_p2p_if_types if_type); |
158 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp); | 158 | void brcmf_p2p_ifp_removed(struct brcmf_if *ifp, bool rtnl_locked); |
159 | int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); | 159 | int brcmf_p2p_start_device(struct wiphy *wiphy, struct wireless_dev *wdev); |
160 | void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); | 160 | void brcmf_p2p_stop_device(struct wiphy *wiphy, struct wireless_dev *wdev); |
161 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, | 161 | int brcmf_p2p_scan_prep(struct wiphy *wiphy, |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c index 1abcabb9b6cd..46b52bf705fb 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c | |||
@@ -960,5 +960,6 @@ int iwl_mvm_start_fw_dbg_conf(struct iwl_mvm *mvm, u8 conf_id) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | mvm->fw_dbg_conf = conf_id; | 962 | mvm->fw_dbg_conf = conf_id; |
963 | return ret; | 963 | |
964 | return 0; | ||
964 | } | 965 | } |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h index f7dff7612c9c..e9f1be9da7d4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.h | |||
@@ -105,7 +105,8 @@ iwl_fw_dbg_trigger_vif_match(struct iwl_fw_dbg_trigger_tlv *trig, | |||
105 | { | 105 | { |
106 | u32 trig_vif = le32_to_cpu(trig->vif_type); | 106 | u32 trig_vif = le32_to_cpu(trig->vif_type); |
107 | 107 | ||
108 | return trig_vif == IWL_FW_DBG_CONF_VIF_ANY || vif->type == trig_vif; | 108 | return trig_vif == IWL_FW_DBG_CONF_VIF_ANY || |
109 | ieee80211_vif_type_p2p(vif) == trig_vif; | ||
109 | } | 110 | } |
110 | 111 | ||
111 | static inline bool | 112 | static inline bool |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c index 6d6064534d59..5dd77e336617 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | |||
@@ -624,6 +624,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
624 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | 624 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | |
625 | NL80211_FEATURE_LOW_PRIORITY_SCAN | | 625 | NL80211_FEATURE_LOW_PRIORITY_SCAN | |
626 | NL80211_FEATURE_P2P_GO_OPPPS | | 626 | NL80211_FEATURE_P2P_GO_OPPPS | |
627 | NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE | | ||
627 | NL80211_FEATURE_DYNAMIC_SMPS | | 628 | NL80211_FEATURE_DYNAMIC_SMPS | |
628 | NL80211_FEATURE_STATIC_SMPS | | 629 | NL80211_FEATURE_STATIC_SMPS | |
629 | NL80211_FEATURE_SUPPORTS_WMM_ADMISSION; | 630 | NL80211_FEATURE_SUPPORTS_WMM_ADMISSION; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index b4fc86d5d7ef..6a615bb73042 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
@@ -467,6 +467,8 @@ struct iwl_mvm_vif { | |||
467 | static inline struct iwl_mvm_vif * | 467 | static inline struct iwl_mvm_vif * |
468 | iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) | 468 | iwl_mvm_vif_from_mac80211(struct ieee80211_vif *vif) |
469 | { | 469 | { |
470 | if (!vif) | ||
471 | return NULL; | ||
470 | return (void *)vif->drv_priv; | 472 | return (void *)vif->drv_priv; |
471 | } | 473 | } |
472 | 474 | ||
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c index c6585ab48df3..b3a87a31de30 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c | |||
@@ -513,6 +513,15 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) | |||
513 | int hdrlen = ieee80211_hdrlen(hdr->frame_control); | 513 | int hdrlen = ieee80211_hdrlen(hdr->frame_control); |
514 | int queue; | 514 | int queue; |
515 | 515 | ||
516 | /* IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used | ||
517 | * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel | ||
518 | * queue. STATION (HS2.0) uses the auxiliary context of the FW, | ||
519 | * and hence needs to be sent on the aux queue | ||
520 | */ | ||
521 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && | ||
522 | skb_info->control.vif->type == NL80211_IFTYPE_STATION) | ||
523 | IEEE80211_SKB_CB(skb)->hw_queue = mvm->aux_queue; | ||
524 | |||
516 | memcpy(&info, skb->cb, sizeof(info)); | 525 | memcpy(&info, skb->cb, sizeof(info)); |
517 | 526 | ||
518 | if (WARN_ON_ONCE(info.flags & IEEE80211_TX_CTL_AMPDU)) | 527 | if (WARN_ON_ONCE(info.flags & IEEE80211_TX_CTL_AMPDU)) |
@@ -526,16 +535,6 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) | |||
526 | /* This holds the amsdu headers length */ | 535 | /* This holds the amsdu headers length */ |
527 | skb_info->driver_data[0] = (void *)(uintptr_t)0; | 536 | skb_info->driver_data[0] = (void *)(uintptr_t)0; |
528 | 537 | ||
529 | /* | ||
530 | * IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used | ||
531 | * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel | ||
532 | * queue. STATION (HS2.0) uses the auxiliary context of the FW, | ||
533 | * and hence needs to be sent on the aux queue | ||
534 | */ | ||
535 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && | ||
536 | info.control.vif->type == NL80211_IFTYPE_STATION) | ||
537 | IEEE80211_SKB_CB(skb)->hw_queue = mvm->aux_queue; | ||
538 | |||
539 | queue = info.hw_queue; | 538 | queue = info.hw_queue; |
540 | 539 | ||
541 | /* | 540 | /* |
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c index dc49c3de1f25..c47d6366875d 100644 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c | |||
@@ -205,7 +205,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
205 | 205 | ||
206 | do { | 206 | do { |
207 | /* Check if AMSDU can accommodate this MSDU */ | 207 | /* Check if AMSDU can accommodate this MSDU */ |
208 | if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) | 208 | if ((skb_aggr->len + skb_src->len + LLC_SNAP_LEN) > |
209 | adapter->tx_buf_size) | ||
209 | break; | 210 | break; |
210 | 211 | ||
211 | skb_src = skb_dequeue(&pra_list->skb_head); | 212 | skb_src = skb_dequeue(&pra_list->skb_head); |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 6a31f2610c23..daf4c7867102 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -271,6 +271,11 @@ static int netback_probe(struct xenbus_device *dev, | |||
271 | be->dev = dev; | 271 | be->dev = dev; |
272 | dev_set_drvdata(&dev->dev, be); | 272 | dev_set_drvdata(&dev->dev, be); |
273 | 273 | ||
274 | be->state = XenbusStateInitialising; | ||
275 | err = xenbus_switch_state(dev, XenbusStateInitialising); | ||
276 | if (err) | ||
277 | goto fail; | ||
278 | |||
274 | sg = 1; | 279 | sg = 1; |
275 | 280 | ||
276 | do { | 281 | do { |
@@ -383,11 +388,6 @@ static int netback_probe(struct xenbus_device *dev, | |||
383 | 388 | ||
384 | be->hotplug_script = script; | 389 | be->hotplug_script = script; |
385 | 390 | ||
386 | err = xenbus_switch_state(dev, XenbusStateInitWait); | ||
387 | if (err) | ||
388 | goto fail; | ||
389 | |||
390 | be->state = XenbusStateInitWait; | ||
391 | 391 | ||
392 | /* This kicks hotplug scripts, so do it immediately. */ | 392 | /* This kicks hotplug scripts, so do it immediately. */ |
393 | err = backend_create_xenvif(be); | 393 | err = backend_create_xenvif(be); |
@@ -492,20 +492,20 @@ static inline void backend_switch_state(struct backend_info *be, | |||
492 | 492 | ||
493 | /* Handle backend state transitions: | 493 | /* Handle backend state transitions: |
494 | * | 494 | * |
495 | * The backend state starts in InitWait and the following transitions are | 495 | * The backend state starts in Initialising and the following transitions are |
496 | * allowed. | 496 | * allowed. |
497 | * | 497 | * |
498 | * InitWait -> Connected | 498 | * Initialising -> InitWait -> Connected |
499 | * | 499 | * \ |
500 | * ^ \ | | 500 | * \ ^ \ | |
501 | * | \ | | 501 | * \ | \ | |
502 | * | \ | | 502 | * \ | \ | |
503 | * | \ | | 503 | * \ | \ | |
504 | * | \ | | 504 | * \ | \ | |
505 | * | \ | | 505 | * \ | \ | |
506 | * | V V | 506 | * V | V V |
507 | * | 507 | * |
508 | * Closed <-> Closing | 508 | * Closed <-> Closing |
509 | * | 509 | * |
510 | * The state argument specifies the eventual state of the backend and the | 510 | * The state argument specifies the eventual state of the backend and the |
511 | * function transitions to that state via the shortest path. | 511 | * function transitions to that state via the shortest path. |
@@ -515,6 +515,20 @@ static void set_backend_state(struct backend_info *be, | |||
515 | { | 515 | { |
516 | while (be->state != state) { | 516 | while (be->state != state) { |
517 | switch (be->state) { | 517 | switch (be->state) { |
518 | case XenbusStateInitialising: | ||
519 | switch (state) { | ||
520 | case XenbusStateInitWait: | ||
521 | case XenbusStateConnected: | ||
522 | case XenbusStateClosing: | ||
523 | backend_switch_state(be, XenbusStateInitWait); | ||
524 | break; | ||
525 | case XenbusStateClosed: | ||
526 | backend_switch_state(be, XenbusStateClosed); | ||
527 | break; | ||
528 | default: | ||
529 | BUG(); | ||
530 | } | ||
531 | break; | ||
518 | case XenbusStateClosed: | 532 | case XenbusStateClosed: |
519 | switch (state) { | 533 | switch (state) { |
520 | case XenbusStateInitWait: | 534 | case XenbusStateInitWait: |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 8dcf5a960951..60f7eab11865 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -1693,7 +1693,12 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) | |||
1693 | nvme_suspend_queue(dev->queues[i]); | 1693 | nvme_suspend_queue(dev->queues[i]); |
1694 | 1694 | ||
1695 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { | 1695 | if (csts & NVME_CSTS_CFS || !(csts & NVME_CSTS_RDY)) { |
1696 | nvme_suspend_queue(dev->queues[0]); | 1696 | /* A device might become IO incapable very soon during |
1697 | * probe, before the admin queue is configured. Thus, | ||
1698 | * queue_count can be 0 here. | ||
1699 | */ | ||
1700 | if (dev->queue_count) | ||
1701 | nvme_suspend_queue(dev->queues[0]); | ||
1697 | } else { | 1702 | } else { |
1698 | nvme_disable_io_queues(dev); | 1703 | nvme_disable_io_queues(dev); |
1699 | nvme_disable_admin_queue(dev, shutdown); | 1704 | nvme_disable_admin_queue(dev, shutdown); |
@@ -2112,6 +2117,8 @@ static const struct pci_device_id nvme_id_table[] = { | |||
2112 | .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, | 2117 | .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, |
2113 | { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ | 2118 | { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */ |
2114 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, | 2119 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, |
2120 | { PCI_DEVICE(0x1c5f, 0x0540), /* Memblaze Pblaze4 adapter */ | ||
2121 | .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, }, | ||
2115 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, | 2122 | { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, |
2116 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, | 2123 | { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, |
2117 | { 0, } | 2124 | { 0, } |
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index ab545fb347a0..fbdb2267e460 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c | |||
@@ -82,6 +82,8 @@ struct nvme_rdma_request { | |||
82 | 82 | ||
83 | enum nvme_rdma_queue_flags { | 83 | enum nvme_rdma_queue_flags { |
84 | NVME_RDMA_Q_CONNECTED = (1 << 0), | 84 | NVME_RDMA_Q_CONNECTED = (1 << 0), |
85 | NVME_RDMA_IB_QUEUE_ALLOCATED = (1 << 1), | ||
86 | NVME_RDMA_Q_DELETING = (1 << 2), | ||
85 | }; | 87 | }; |
86 | 88 | ||
87 | struct nvme_rdma_queue { | 89 | struct nvme_rdma_queue { |
@@ -291,6 +293,7 @@ static int nvme_rdma_reinit_request(void *data, struct request *rq) | |||
291 | if (IS_ERR(req->mr)) { | 293 | if (IS_ERR(req->mr)) { |
292 | ret = PTR_ERR(req->mr); | 294 | ret = PTR_ERR(req->mr); |
293 | req->mr = NULL; | 295 | req->mr = NULL; |
296 | goto out; | ||
294 | } | 297 | } |
295 | 298 | ||
296 | req->mr->need_inval = false; | 299 | req->mr->need_inval = false; |
@@ -480,9 +483,14 @@ out_err: | |||
480 | 483 | ||
481 | static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) | 484 | static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue) |
482 | { | 485 | { |
483 | struct nvme_rdma_device *dev = queue->device; | 486 | struct nvme_rdma_device *dev; |
484 | struct ib_device *ibdev = dev->dev; | 487 | struct ib_device *ibdev; |
488 | |||
489 | if (!test_and_clear_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags)) | ||
490 | return; | ||
485 | 491 | ||
492 | dev = queue->device; | ||
493 | ibdev = dev->dev; | ||
486 | rdma_destroy_qp(queue->cm_id); | 494 | rdma_destroy_qp(queue->cm_id); |
487 | ib_free_cq(queue->ib_cq); | 495 | ib_free_cq(queue->ib_cq); |
488 | 496 | ||
@@ -533,6 +541,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue, | |||
533 | ret = -ENOMEM; | 541 | ret = -ENOMEM; |
534 | goto out_destroy_qp; | 542 | goto out_destroy_qp; |
535 | } | 543 | } |
544 | set_bit(NVME_RDMA_IB_QUEUE_ALLOCATED, &queue->flags); | ||
536 | 545 | ||
537 | return 0; | 546 | return 0; |
538 | 547 | ||
@@ -585,11 +594,13 @@ static int nvme_rdma_init_queue(struct nvme_rdma_ctrl *ctrl, | |||
585 | goto out_destroy_cm_id; | 594 | goto out_destroy_cm_id; |
586 | } | 595 | } |
587 | 596 | ||
597 | clear_bit(NVME_RDMA_Q_DELETING, &queue->flags); | ||
588 | set_bit(NVME_RDMA_Q_CONNECTED, &queue->flags); | 598 | set_bit(NVME_RDMA_Q_CONNECTED, &queue->flags); |
589 | 599 | ||
590 | return 0; | 600 | return 0; |
591 | 601 | ||
592 | out_destroy_cm_id: | 602 | out_destroy_cm_id: |
603 | nvme_rdma_destroy_queue_ib(queue); | ||
593 | rdma_destroy_id(queue->cm_id); | 604 | rdma_destroy_id(queue->cm_id); |
594 | return ret; | 605 | return ret; |
595 | } | 606 | } |
@@ -608,7 +619,7 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) | |||
608 | 619 | ||
609 | static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) | 620 | static void nvme_rdma_stop_and_free_queue(struct nvme_rdma_queue *queue) |
610 | { | 621 | { |
611 | if (!test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) | 622 | if (test_and_set_bit(NVME_RDMA_Q_DELETING, &queue->flags)) |
612 | return; | 623 | return; |
613 | nvme_rdma_stop_queue(queue); | 624 | nvme_rdma_stop_queue(queue); |
614 | nvme_rdma_free_queue(queue); | 625 | nvme_rdma_free_queue(queue); |
@@ -652,7 +663,7 @@ static int nvme_rdma_init_io_queues(struct nvme_rdma_ctrl *ctrl) | |||
652 | return 0; | 663 | return 0; |
653 | 664 | ||
654 | out_free_queues: | 665 | out_free_queues: |
655 | for (; i >= 1; i--) | 666 | for (i--; i >= 1; i--) |
656 | nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); | 667 | nvme_rdma_stop_and_free_queue(&ctrl->queues[i]); |
657 | 668 | ||
658 | return ret; | 669 | return ret; |
@@ -761,8 +772,13 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) | |||
761 | { | 772 | { |
762 | struct nvme_rdma_ctrl *ctrl = container_of(work, | 773 | struct nvme_rdma_ctrl *ctrl = container_of(work, |
763 | struct nvme_rdma_ctrl, err_work); | 774 | struct nvme_rdma_ctrl, err_work); |
775 | int i; | ||
764 | 776 | ||
765 | nvme_stop_keep_alive(&ctrl->ctrl); | 777 | nvme_stop_keep_alive(&ctrl->ctrl); |
778 | |||
779 | for (i = 0; i < ctrl->queue_count; i++) | ||
780 | clear_bit(NVME_RDMA_Q_CONNECTED, &ctrl->queues[i].flags); | ||
781 | |||
766 | if (ctrl->queue_count > 1) | 782 | if (ctrl->queue_count > 1) |
767 | nvme_stop_queues(&ctrl->ctrl); | 783 | nvme_stop_queues(&ctrl->ctrl); |
768 | blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); | 784 | blk_mq_stop_hw_queues(ctrl->ctrl.admin_q); |
@@ -1305,58 +1321,6 @@ out_destroy_queue_ib: | |||
1305 | return ret; | 1321 | return ret; |
1306 | } | 1322 | } |
1307 | 1323 | ||
1308 | /** | ||
1309 | * nvme_rdma_device_unplug() - Handle RDMA device unplug | ||
1310 | * @queue: Queue that owns the cm_id that caught the event | ||
1311 | * | ||
1312 | * DEVICE_REMOVAL event notifies us that the RDMA device is about | ||
1313 | * to unplug so we should take care of destroying our RDMA resources. | ||
1314 | * This event will be generated for each allocated cm_id. | ||
1315 | * | ||
1316 | * In our case, the RDMA resources are managed per controller and not | ||
1317 | * only per queue. So the way we handle this is we trigger an implicit | ||
1318 | * controller deletion upon the first DEVICE_REMOVAL event we see, and | ||
1319 | * hold the event inflight until the controller deletion is completed. | ||
1320 | * | ||
1321 | * One exception that we need to handle is the destruction of the cm_id | ||
1322 | * that caught the event. Since we hold the callout until the controller | ||
1323 | * deletion is completed, we'll deadlock if the controller deletion will | ||
1324 | * call rdma_destroy_id on this queue's cm_id. Thus, we claim ownership | ||
1325 | * of destroying this queue before-hand, destroy the queue resources, | ||
1326 | * then queue the controller deletion which won't destroy this queue and | ||
1327 | * we destroy the cm_id implicitely by returning a non-zero rc to the callout. | ||
1328 | */ | ||
1329 | static int nvme_rdma_device_unplug(struct nvme_rdma_queue *queue) | ||
1330 | { | ||
1331 | struct nvme_rdma_ctrl *ctrl = queue->ctrl; | ||
1332 | int ret = 0; | ||
1333 | |||
1334 | /* Own the controller deletion */ | ||
1335 | if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_DELETING)) | ||
1336 | return 0; | ||
1337 | |||
1338 | dev_warn(ctrl->ctrl.device, | ||
1339 | "Got rdma device removal event, deleting ctrl\n"); | ||
1340 | |||
1341 | /* Get rid of reconnect work if its running */ | ||
1342 | cancel_delayed_work_sync(&ctrl->reconnect_work); | ||
1343 | |||
1344 | /* Disable the queue so ctrl delete won't free it */ | ||
1345 | if (test_and_clear_bit(NVME_RDMA_Q_CONNECTED, &queue->flags)) { | ||
1346 | /* Free this queue ourselves */ | ||
1347 | nvme_rdma_stop_queue(queue); | ||
1348 | nvme_rdma_destroy_queue_ib(queue); | ||
1349 | |||
1350 | /* Return non-zero so the cm_id will destroy implicitly */ | ||
1351 | ret = 1; | ||
1352 | } | ||
1353 | |||
1354 | /* Queue controller deletion */ | ||
1355 | queue_work(nvme_rdma_wq, &ctrl->delete_work); | ||
1356 | flush_work(&ctrl->delete_work); | ||
1357 | return ret; | ||
1358 | } | ||
1359 | |||
1360 | static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, | 1324 | static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, |
1361 | struct rdma_cm_event *ev) | 1325 | struct rdma_cm_event *ev) |
1362 | { | 1326 | { |
@@ -1398,8 +1362,8 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, | |||
1398 | nvme_rdma_error_recovery(queue->ctrl); | 1362 | nvme_rdma_error_recovery(queue->ctrl); |
1399 | break; | 1363 | break; |
1400 | case RDMA_CM_EVENT_DEVICE_REMOVAL: | 1364 | case RDMA_CM_EVENT_DEVICE_REMOVAL: |
1401 | /* return 1 means impliciy CM ID destroy */ | 1365 | /* device removal is handled via the ib_client API */ |
1402 | return nvme_rdma_device_unplug(queue); | 1366 | break; |
1403 | default: | 1367 | default: |
1404 | dev_err(queue->ctrl->ctrl.device, | 1368 | dev_err(queue->ctrl->ctrl.device, |
1405 | "Unexpected RDMA CM event (%d)\n", ev->event); | 1369 | "Unexpected RDMA CM event (%d)\n", ev->event); |
@@ -1700,15 +1664,19 @@ static int __nvme_rdma_del_ctrl(struct nvme_rdma_ctrl *ctrl) | |||
1700 | static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) | 1664 | static int nvme_rdma_del_ctrl(struct nvme_ctrl *nctrl) |
1701 | { | 1665 | { |
1702 | struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); | 1666 | struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl); |
1703 | int ret; | 1667 | int ret = 0; |
1704 | 1668 | ||
1669 | /* | ||
1670 | * Keep a reference until all work is flushed since | ||
1671 | * __nvme_rdma_del_ctrl can free the ctrl mem | ||
1672 | */ | ||
1673 | if (!kref_get_unless_zero(&ctrl->ctrl.kref)) | ||
1674 | return -EBUSY; | ||
1705 | ret = __nvme_rdma_del_ctrl(ctrl); | 1675 | ret = __nvme_rdma_del_ctrl(ctrl); |
1706 | if (ret) | 1676 | if (!ret) |
1707 | return ret; | 1677 | flush_work(&ctrl->delete_work); |
1708 | 1678 | nvme_put_ctrl(&ctrl->ctrl); | |
1709 | flush_work(&ctrl->delete_work); | 1679 | return ret; |
1710 | |||
1711 | return 0; | ||
1712 | } | 1680 | } |
1713 | 1681 | ||
1714 | static void nvme_rdma_remove_ctrl_work(struct work_struct *work) | 1682 | static void nvme_rdma_remove_ctrl_work(struct work_struct *work) |
@@ -2005,27 +1973,57 @@ static struct nvmf_transport_ops nvme_rdma_transport = { | |||
2005 | .create_ctrl = nvme_rdma_create_ctrl, | 1973 | .create_ctrl = nvme_rdma_create_ctrl, |
2006 | }; | 1974 | }; |
2007 | 1975 | ||
1976 | static void nvme_rdma_add_one(struct ib_device *ib_device) | ||
1977 | { | ||
1978 | } | ||
1979 | |||
1980 | static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data) | ||
1981 | { | ||
1982 | struct nvme_rdma_ctrl *ctrl; | ||
1983 | |||
1984 | /* Delete all controllers using this device */ | ||
1985 | mutex_lock(&nvme_rdma_ctrl_mutex); | ||
1986 | list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) { | ||
1987 | if (ctrl->device->dev != ib_device) | ||
1988 | continue; | ||
1989 | dev_info(ctrl->ctrl.device, | ||
1990 | "Removing ctrl: NQN \"%s\", addr %pISp\n", | ||
1991 | ctrl->ctrl.opts->subsysnqn, &ctrl->addr); | ||
1992 | __nvme_rdma_del_ctrl(ctrl); | ||
1993 | } | ||
1994 | mutex_unlock(&nvme_rdma_ctrl_mutex); | ||
1995 | |||
1996 | flush_workqueue(nvme_rdma_wq); | ||
1997 | } | ||
1998 | |||
1999 | static struct ib_client nvme_rdma_ib_client = { | ||
2000 | .name = "nvme_rdma", | ||
2001 | .add = nvme_rdma_add_one, | ||
2002 | .remove = nvme_rdma_remove_one | ||
2003 | }; | ||
2004 | |||
2008 | static int __init nvme_rdma_init_module(void) | 2005 | static int __init nvme_rdma_init_module(void) |
2009 | { | 2006 | { |
2007 | int ret; | ||
2008 | |||
2010 | nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); | 2009 | nvme_rdma_wq = create_workqueue("nvme_rdma_wq"); |
2011 | if (!nvme_rdma_wq) | 2010 | if (!nvme_rdma_wq) |
2012 | return -ENOMEM; | 2011 | return -ENOMEM; |
2013 | 2012 | ||
2013 | ret = ib_register_client(&nvme_rdma_ib_client); | ||
2014 | if (ret) { | ||
2015 | destroy_workqueue(nvme_rdma_wq); | ||
2016 | return ret; | ||
2017 | } | ||
2018 | |||
2014 | nvmf_register_transport(&nvme_rdma_transport); | 2019 | nvmf_register_transport(&nvme_rdma_transport); |
2015 | return 0; | 2020 | return 0; |
2016 | } | 2021 | } |
2017 | 2022 | ||
2018 | static void __exit nvme_rdma_cleanup_module(void) | 2023 | static void __exit nvme_rdma_cleanup_module(void) |
2019 | { | 2024 | { |
2020 | struct nvme_rdma_ctrl *ctrl; | ||
2021 | |||
2022 | nvmf_unregister_transport(&nvme_rdma_transport); | 2025 | nvmf_unregister_transport(&nvme_rdma_transport); |
2023 | 2026 | ib_unregister_client(&nvme_rdma_ib_client); | |
2024 | mutex_lock(&nvme_rdma_ctrl_mutex); | ||
2025 | list_for_each_entry(ctrl, &nvme_rdma_ctrl_list, list) | ||
2026 | __nvme_rdma_del_ctrl(ctrl); | ||
2027 | mutex_unlock(&nvme_rdma_ctrl_mutex); | ||
2028 | |||
2029 | destroy_workqueue(nvme_rdma_wq); | 2027 | destroy_workqueue(nvme_rdma_wq); |
2030 | } | 2028 | } |
2031 | 2029 | ||
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index d1ef7acf6930..f9357e09e9b3 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -40,6 +40,7 @@ static void pci_destroy_dev(struct pci_dev *dev) | |||
40 | list_del(&dev->bus_list); | 40 | list_del(&dev->bus_list); |
41 | up_write(&pci_bus_sem); | 41 | up_write(&pci_bus_sem); |
42 | 42 | ||
43 | pci_bridge_d3_device_removed(dev); | ||
43 | pci_free_resources(dev); | 44 | pci_free_resources(dev); |
44 | put_device(&dev->dev); | 45 | put_device(&dev->dev); |
45 | } | 46 | } |
@@ -96,8 +97,6 @@ static void pci_remove_bus_device(struct pci_dev *dev) | |||
96 | dev->subordinate = NULL; | 97 | dev->subordinate = NULL; |
97 | } | 98 | } |
98 | 99 | ||
99 | pci_bridge_d3_device_removed(dev); | ||
100 | |||
101 | pci_destroy_dev(dev); | 100 | pci_destroy_dev(dev); |
102 | } | 101 | } |
103 | 102 | ||
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 489ea1098c96..69b5e811ea2b 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -977,7 +977,7 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
977 | 977 | ||
978 | /************************ runtime PM support ***************************/ | 978 | /************************ runtime PM support ***************************/ |
979 | 979 | ||
980 | static int pcmcia_dev_suspend(struct device *dev, pm_message_t state); | 980 | static int pcmcia_dev_suspend(struct device *dev); |
981 | static int pcmcia_dev_resume(struct device *dev); | 981 | static int pcmcia_dev_resume(struct device *dev); |
982 | 982 | ||
983 | static int runtime_suspend(struct device *dev) | 983 | static int runtime_suspend(struct device *dev) |
@@ -985,7 +985,7 @@ static int runtime_suspend(struct device *dev) | |||
985 | int rc; | 985 | int rc; |
986 | 986 | ||
987 | device_lock(dev); | 987 | device_lock(dev); |
988 | rc = pcmcia_dev_suspend(dev, PMSG_SUSPEND); | 988 | rc = pcmcia_dev_suspend(dev); |
989 | device_unlock(dev); | 989 | device_unlock(dev); |
990 | return rc; | 990 | return rc; |
991 | } | 991 | } |
@@ -1135,7 +1135,7 @@ ATTRIBUTE_GROUPS(pcmcia_dev); | |||
1135 | 1135 | ||
1136 | /* PM support, also needed for reset */ | 1136 | /* PM support, also needed for reset */ |
1137 | 1137 | ||
1138 | static int pcmcia_dev_suspend(struct device *dev, pm_message_t state) | 1138 | static int pcmcia_dev_suspend(struct device *dev) |
1139 | { | 1139 | { |
1140 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); | 1140 | struct pcmcia_device *p_dev = to_pcmcia_dev(dev); |
1141 | struct pcmcia_driver *p_drv = NULL; | 1141 | struct pcmcia_driver *p_drv = NULL; |
@@ -1410,6 +1410,9 @@ static struct class_interface pcmcia_bus_interface __refdata = { | |||
1410 | .remove_dev = &pcmcia_bus_remove_socket, | 1410 | .remove_dev = &pcmcia_bus_remove_socket, |
1411 | }; | 1411 | }; |
1412 | 1412 | ||
1413 | static const struct dev_pm_ops pcmcia_bus_pm_ops = { | ||
1414 | SET_SYSTEM_SLEEP_PM_OPS(pcmcia_dev_suspend, pcmcia_dev_resume) | ||
1415 | }; | ||
1413 | 1416 | ||
1414 | struct bus_type pcmcia_bus_type = { | 1417 | struct bus_type pcmcia_bus_type = { |
1415 | .name = "pcmcia", | 1418 | .name = "pcmcia", |
@@ -1418,8 +1421,7 @@ struct bus_type pcmcia_bus_type = { | |||
1418 | .dev_groups = pcmcia_dev_groups, | 1421 | .dev_groups = pcmcia_dev_groups, |
1419 | .probe = pcmcia_device_probe, | 1422 | .probe = pcmcia_device_probe, |
1420 | .remove = pcmcia_device_remove, | 1423 | .remove = pcmcia_device_remove, |
1421 | .suspend = pcmcia_dev_suspend, | 1424 | .pm = &pcmcia_bus_pm_ops, |
1422 | .resume = pcmcia_dev_resume, | ||
1423 | }; | 1425 | }; |
1424 | 1426 | ||
1425 | 1427 | ||
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 483f919e0d2e..91b5f5724cba 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -214,9 +214,8 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, | |||
214 | } | 214 | } |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | void pxa2xx_configure_sockets(struct device *dev) | 217 | void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops) |
218 | { | 218 | { |
219 | struct pcmcia_low_level *ops = dev->platform_data; | ||
220 | /* | 219 | /* |
221 | * We have at least one socket, so set MECR:CIT | 220 | * We have at least one socket, so set MECR:CIT |
222 | * (Card Is There) | 221 | * (Card Is There) |
@@ -322,7 +321,7 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev) | |||
322 | goto err1; | 321 | goto err1; |
323 | } | 322 | } |
324 | 323 | ||
325 | pxa2xx_configure_sockets(&dev->dev); | 324 | pxa2xx_configure_sockets(&dev->dev, ops); |
326 | dev_set_drvdata(&dev->dev, sinfo); | 325 | dev_set_drvdata(&dev->dev, sinfo); |
327 | 326 | ||
328 | return 0; | 327 | return 0; |
@@ -348,7 +347,9 @@ static int pxa2xx_drv_pcmcia_remove(struct platform_device *dev) | |||
348 | 347 | ||
349 | static int pxa2xx_drv_pcmcia_resume(struct device *dev) | 348 | static int pxa2xx_drv_pcmcia_resume(struct device *dev) |
350 | { | 349 | { |
351 | pxa2xx_configure_sockets(dev); | 350 | struct pcmcia_low_level *ops = (struct pcmcia_low_level *)dev->platform_data; |
351 | |||
352 | pxa2xx_configure_sockets(dev, ops); | ||
352 | return 0; | 353 | return 0; |
353 | } | 354 | } |
354 | 355 | ||
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h index b609b45469ed..e58c7a415418 100644 --- a/drivers/pcmcia/pxa2xx_base.h +++ b/drivers/pcmcia/pxa2xx_base.h | |||
@@ -1,4 +1,4 @@ | |||
1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | 1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); |
2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | 2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); |
3 | void pxa2xx_configure_sockets(struct device *dev); | 3 | void pxa2xx_configure_sockets(struct device *dev, struct pcmcia_low_level *ops); |
4 | 4 | ||
diff --git a/drivers/pcmcia/sa1111_badge4.c b/drivers/pcmcia/sa1111_badge4.c index 12f0dd091477..2f490930430d 100644 --- a/drivers/pcmcia/sa1111_badge4.c +++ b/drivers/pcmcia/sa1111_badge4.c | |||
@@ -134,20 +134,14 @@ static struct pcmcia_low_level badge4_pcmcia_ops = { | |||
134 | 134 | ||
135 | int pcmcia_badge4_init(struct sa1111_dev *dev) | 135 | int pcmcia_badge4_init(struct sa1111_dev *dev) |
136 | { | 136 | { |
137 | int ret = -ENODEV; | 137 | printk(KERN_INFO |
138 | 138 | "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | |
139 | if (machine_is_badge4()) { | 139 | __func__, |
140 | printk(KERN_INFO | 140 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); |
141 | "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", | 141 | |
142 | __func__, | 142 | sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); |
143 | badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); | 143 | return sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, |
144 | 144 | sa11xx_drv_pcmcia_add_one); | |
145 | sa11xx_drv_pcmcia_ops(&badge4_pcmcia_ops); | ||
146 | ret = sa1111_pcmcia_add(dev, &badge4_pcmcia_ops, | ||
147 | sa11xx_drv_pcmcia_add_one); | ||
148 | } | ||
149 | |||
150 | return ret; | ||
151 | } | 145 | } |
152 | 146 | ||
153 | static int __init pcmv_setup(char *s) | 147 | static int __init pcmv_setup(char *s) |
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c index a1531feb8460..3d95dffcff7a 100644 --- a/drivers/pcmcia/sa1111_generic.c +++ b/drivers/pcmcia/sa1111_generic.c | |||
@@ -18,6 +18,7 @@ | |||
18 | 18 | ||
19 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
20 | #include <asm/hardware/sa1111.h> | 20 | #include <asm/hardware/sa1111.h> |
21 | #include <asm/mach-types.h> | ||
21 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
22 | 23 | ||
23 | #include "sa1111_generic.h" | 24 | #include "sa1111_generic.h" |
@@ -203,19 +204,30 @@ static int pcmcia_probe(struct sa1111_dev *dev) | |||
203 | sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); | 204 | sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR); |
204 | sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); | 205 | sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR); |
205 | 206 | ||
207 | ret = -ENODEV; | ||
206 | #ifdef CONFIG_SA1100_BADGE4 | 208 | #ifdef CONFIG_SA1100_BADGE4 |
207 | pcmcia_badge4_init(dev); | 209 | if (machine_is_badge4()) |
210 | ret = pcmcia_badge4_init(dev); | ||
208 | #endif | 211 | #endif |
209 | #ifdef CONFIG_SA1100_JORNADA720 | 212 | #ifdef CONFIG_SA1100_JORNADA720 |
210 | pcmcia_jornada720_init(dev); | 213 | if (machine_is_jornada720()) |
214 | ret = pcmcia_jornada720_init(dev); | ||
211 | #endif | 215 | #endif |
212 | #ifdef CONFIG_ARCH_LUBBOCK | 216 | #ifdef CONFIG_ARCH_LUBBOCK |
213 | pcmcia_lubbock_init(dev); | 217 | if (machine_is_lubbock()) |
218 | ret = pcmcia_lubbock_init(dev); | ||
214 | #endif | 219 | #endif |
215 | #ifdef CONFIG_ASSABET_NEPONSET | 220 | #ifdef CONFIG_ASSABET_NEPONSET |
216 | pcmcia_neponset_init(dev); | 221 | if (machine_is_assabet()) |
222 | ret = pcmcia_neponset_init(dev); | ||
217 | #endif | 223 | #endif |
218 | return 0; | 224 | |
225 | if (ret) { | ||
226 | release_mem_region(dev->res.start, 512); | ||
227 | sa1111_disable_device(dev); | ||
228 | } | ||
229 | |||
230 | return ret; | ||
219 | } | 231 | } |
220 | 232 | ||
221 | static int pcmcia_remove(struct sa1111_dev *dev) | 233 | static int pcmcia_remove(struct sa1111_dev *dev) |
diff --git a/drivers/pcmcia/sa1111_jornada720.c b/drivers/pcmcia/sa1111_jornada720.c index c2c30580c83f..480a3ede27c8 100644 --- a/drivers/pcmcia/sa1111_jornada720.c +++ b/drivers/pcmcia/sa1111_jornada720.c | |||
@@ -94,22 +94,17 @@ static struct pcmcia_low_level jornada720_pcmcia_ops = { | |||
94 | 94 | ||
95 | int pcmcia_jornada720_init(struct sa1111_dev *sadev) | 95 | int pcmcia_jornada720_init(struct sa1111_dev *sadev) |
96 | { | 96 | { |
97 | int ret = -ENODEV; | 97 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; |
98 | 98 | ||
99 | if (machine_is_jornada720()) { | 99 | /* Fixme: why messing around with SA11x0's GPIO1? */ |
100 | unsigned int pin = GPIO_A0 | GPIO_A1 | GPIO_A2 | GPIO_A3; | 100 | GRER |= 0x00000002; |
101 | 101 | ||
102 | GRER |= 0x00000002; | 102 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ |
103 | sa1111_set_io_dir(sadev, pin, 0, 0); | ||
104 | sa1111_set_io(sadev, pin, 0); | ||
105 | sa1111_set_sleep_io(sadev, pin, 0); | ||
103 | 106 | ||
104 | /* Set GPIO_A<3:1> to be outputs for PCMCIA/CF power controller: */ | 107 | sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); |
105 | sa1111_set_io_dir(sadev, pin, 0, 0); | 108 | return sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops, |
106 | sa1111_set_io(sadev, pin, 0); | 109 | sa11xx_drv_pcmcia_add_one); |
107 | sa1111_set_sleep_io(sadev, pin, 0); | ||
108 | |||
109 | sa11xx_drv_pcmcia_ops(&jornada720_pcmcia_ops); | ||
110 | ret = sa1111_pcmcia_add(sadev, &jornada720_pcmcia_ops, | ||
111 | sa11xx_drv_pcmcia_add_one); | ||
112 | } | ||
113 | |||
114 | return ret; | ||
115 | } | 110 | } |
diff --git a/drivers/pcmcia/sa1111_lubbock.c b/drivers/pcmcia/sa1111_lubbock.c index c5caf5790451..e741f499c875 100644 --- a/drivers/pcmcia/sa1111_lubbock.c +++ b/drivers/pcmcia/sa1111_lubbock.c | |||
@@ -210,27 +210,21 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = { | |||
210 | 210 | ||
211 | int pcmcia_lubbock_init(struct sa1111_dev *sadev) | 211 | int pcmcia_lubbock_init(struct sa1111_dev *sadev) |
212 | { | 212 | { |
213 | int ret = -ENODEV; | 213 | /* |
214 | 214 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
215 | if (machine_is_lubbock()) { | 215 | * and switch to standby mode. |
216 | /* | 216 | */ |
217 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | 217 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); |
218 | * and switch to standby mode. | 218 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
219 | */ | 219 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
220 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | ||
221 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | ||
222 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | ||
223 | |||
224 | /* Set CF Socket 1 power to standby mode. */ | ||
225 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | ||
226 | 220 | ||
227 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); | 221 | /* Set CF Socket 1 power to standby mode. */ |
228 | pxa2xx_configure_sockets(&sadev->dev); | 222 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); |
229 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | ||
230 | pxa2xx_drv_pcmcia_add_one); | ||
231 | } | ||
232 | 223 | ||
233 | return ret; | 224 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); |
225 | pxa2xx_configure_sockets(&sadev->dev, &lubbock_pcmcia_ops); | ||
226 | return sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | ||
227 | pxa2xx_drv_pcmcia_add_one); | ||
234 | } | 228 | } |
235 | 229 | ||
236 | MODULE_LICENSE("GPL"); | 230 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/pcmcia/sa1111_neponset.c b/drivers/pcmcia/sa1111_neponset.c index 1d78739c4c07..019c395eb4bf 100644 --- a/drivers/pcmcia/sa1111_neponset.c +++ b/drivers/pcmcia/sa1111_neponset.c | |||
@@ -110,20 +110,14 @@ static struct pcmcia_low_level neponset_pcmcia_ops = { | |||
110 | 110 | ||
111 | int pcmcia_neponset_init(struct sa1111_dev *sadev) | 111 | int pcmcia_neponset_init(struct sa1111_dev *sadev) |
112 | { | 112 | { |
113 | int ret = -ENODEV; | 113 | /* |
114 | 114 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | |
115 | if (machine_is_assabet()) { | 115 | * and switch to standby mode. |
116 | /* | 116 | */ |
117 | * Set GPIO_A<3:0> to be outputs for the MAX1600, | 117 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); |
118 | * and switch to standby mode. | 118 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
119 | */ | 119 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); |
120 | sa1111_set_io_dir(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0, 0); | 120 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); |
121 | sa1111_set_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 121 | return sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, |
122 | sa1111_set_sleep_io(sadev, GPIO_A0|GPIO_A1|GPIO_A2|GPIO_A3, 0); | 122 | sa11xx_drv_pcmcia_add_one); |
123 | sa11xx_drv_pcmcia_ops(&neponset_pcmcia_ops); | ||
124 | ret = sa1111_pcmcia_add(sadev, &neponset_pcmcia_ops, | ||
125 | sa11xx_drv_pcmcia_add_one); | ||
126 | } | ||
127 | |||
128 | return ret; | ||
129 | } | 123 | } |
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c index 9f6ec87b9f9e..48140ac73ed6 100644 --- a/drivers/pcmcia/sa11xx_base.c +++ b/drivers/pcmcia/sa11xx_base.c | |||
@@ -144,19 +144,19 @@ static int | |||
144 | sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) | 144 | sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) |
145 | { | 145 | { |
146 | struct soc_pcmcia_timing timing; | 146 | struct soc_pcmcia_timing timing; |
147 | unsigned int clock = clk_get_rate(skt->clk); | 147 | unsigned int clock = clk_get_rate(skt->clk) / 1000; |
148 | unsigned long mecr = MECR; | 148 | unsigned long mecr = MECR; |
149 | char *p = buf; | 149 | char *p = buf; |
150 | 150 | ||
151 | soc_common_pcmcia_get_timing(skt, &timing); | 151 | soc_common_pcmcia_get_timing(skt, &timing); |
152 | 152 | ||
153 | p+=sprintf(p, "I/O : %u (%u)\n", timing.io, | 153 | p+=sprintf(p, "I/O : %uns (%uns)\n", timing.io, |
154 | sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); | 154 | sa1100_pcmcia_cmd_time(clock, MECR_BSIO_GET(mecr, skt->nr))); |
155 | 155 | ||
156 | p+=sprintf(p, "attribute: %u (%u)\n", timing.attr, | 156 | p+=sprintf(p, "attribute: %uns (%uns)\n", timing.attr, |
157 | sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); | 157 | sa1100_pcmcia_cmd_time(clock, MECR_BSA_GET(mecr, skt->nr))); |
158 | 158 | ||
159 | p+=sprintf(p, "common : %u (%u)\n", timing.mem, | 159 | p+=sprintf(p, "common : %uns (%uns)\n", timing.mem, |
160 | sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); | 160 | sa1100_pcmcia_cmd_time(clock, MECR_BSM_GET(mecr, skt->nr))); |
161 | 161 | ||
162 | return p - buf; | 162 | return p - buf; |
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index eed5e9c05353..d5ca760c4eb2 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c | |||
@@ -235,7 +235,7 @@ static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt) | |||
235 | stat |= skt->cs_state.Vcc ? SS_POWERON : 0; | 235 | stat |= skt->cs_state.Vcc ? SS_POWERON : 0; |
236 | 236 | ||
237 | if (skt->cs_state.flags & SS_IOCARD) | 237 | if (skt->cs_state.flags & SS_IOCARD) |
238 | stat |= state.bvd1 ? SS_STSCHG : 0; | 238 | stat |= state.bvd1 ? 0 : SS_STSCHG; |
239 | else { | 239 | else { |
240 | if (state.bvd1 == 0) | 240 | if (state.bvd1 == 0) |
241 | stat |= SS_BATDEAD; | 241 | stat |= SS_BATDEAD; |
diff --git a/drivers/rapidio/rio_cm.c b/drivers/rapidio/rio_cm.c index 3fa17ac8df54..cebc296463ad 100644 --- a/drivers/rapidio/rio_cm.c +++ b/drivers/rapidio/rio_cm.c | |||
@@ -2247,17 +2247,30 @@ static int rio_cm_shutdown(struct notifier_block *nb, unsigned long code, | |||
2247 | { | 2247 | { |
2248 | struct rio_channel *ch; | 2248 | struct rio_channel *ch; |
2249 | unsigned int i; | 2249 | unsigned int i; |
2250 | LIST_HEAD(list); | ||
2250 | 2251 | ||
2251 | riocm_debug(EXIT, "."); | 2252 | riocm_debug(EXIT, "."); |
2252 | 2253 | ||
2254 | /* | ||
2255 | * If there are any channels left in connected state send | ||
2256 | * close notification to the connection partner. | ||
2257 | * First build a list of channels that require a closing | ||
2258 | * notification because function riocm_send_close() should | ||
2259 | * be called outside of spinlock protected code. | ||
2260 | */ | ||
2253 | spin_lock_bh(&idr_lock); | 2261 | spin_lock_bh(&idr_lock); |
2254 | idr_for_each_entry(&ch_idr, ch, i) { | 2262 | idr_for_each_entry(&ch_idr, ch, i) { |
2255 | riocm_debug(EXIT, "close ch %d", ch->id); | 2263 | if (ch->state == RIO_CM_CONNECTED) { |
2256 | if (ch->state == RIO_CM_CONNECTED) | 2264 | riocm_debug(EXIT, "close ch %d", ch->id); |
2257 | riocm_send_close(ch); | 2265 | idr_remove(&ch_idr, ch->id); |
2266 | list_add(&ch->ch_node, &list); | ||
2267 | } | ||
2258 | } | 2268 | } |
2259 | spin_unlock_bh(&idr_lock); | 2269 | spin_unlock_bh(&idr_lock); |
2260 | 2270 | ||
2271 | list_for_each_entry(ch, &list, ch_node) | ||
2272 | riocm_send_close(ch); | ||
2273 | |||
2261 | return NOTIFY_DONE; | 2274 | return NOTIFY_DONE; |
2262 | } | 2275 | } |
2263 | 2276 | ||
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index bf40063de202..6d4b68c483f3 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -999,6 +999,7 @@ struct qeth_cmd_buffer *qeth_get_setassparms_cmd(struct qeth_card *, | |||
999 | __u16, __u16, | 999 | __u16, __u16, |
1000 | enum qeth_prot_versions); | 1000 | enum qeth_prot_versions); |
1001 | int qeth_set_features(struct net_device *, netdev_features_t); | 1001 | int qeth_set_features(struct net_device *, netdev_features_t); |
1002 | int qeth_recover_features(struct net_device *); | ||
1002 | netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t); | 1003 | netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t); |
1003 | 1004 | ||
1004 | /* exports for OSN */ | 1005 | /* exports for OSN */ |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 7dba6c8537a1..20cf29613043 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -3619,7 +3619,8 @@ static void qeth_qdio_cq_handler(struct qeth_card *card, | |||
3619 | int e; | 3619 | int e; |
3620 | 3620 | ||
3621 | e = 0; | 3621 | e = 0; |
3622 | while (buffer->element[e].addr) { | 3622 | while ((e < QDIO_MAX_ELEMENTS_PER_BUFFER) && |
3623 | buffer->element[e].addr) { | ||
3623 | unsigned long phys_aob_addr; | 3624 | unsigned long phys_aob_addr; |
3624 | 3625 | ||
3625 | phys_aob_addr = (unsigned long) buffer->element[e].addr; | 3626 | phys_aob_addr = (unsigned long) buffer->element[e].addr; |
@@ -6131,6 +6132,35 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on) | |||
6131 | return rc; | 6132 | return rc; |
6132 | } | 6133 | } |
6133 | 6134 | ||
6135 | /* try to restore device features on a device after recovery */ | ||
6136 | int qeth_recover_features(struct net_device *dev) | ||
6137 | { | ||
6138 | struct qeth_card *card = dev->ml_priv; | ||
6139 | netdev_features_t recover = dev->features; | ||
6140 | |||
6141 | if (recover & NETIF_F_IP_CSUM) { | ||
6142 | if (qeth_set_ipa_csum(card, 1, IPA_OUTBOUND_CHECKSUM)) | ||
6143 | recover ^= NETIF_F_IP_CSUM; | ||
6144 | } | ||
6145 | if (recover & NETIF_F_RXCSUM) { | ||
6146 | if (qeth_set_ipa_csum(card, 1, IPA_INBOUND_CHECKSUM)) | ||
6147 | recover ^= NETIF_F_RXCSUM; | ||
6148 | } | ||
6149 | if (recover & NETIF_F_TSO) { | ||
6150 | if (qeth_set_ipa_tso(card, 1)) | ||
6151 | recover ^= NETIF_F_TSO; | ||
6152 | } | ||
6153 | |||
6154 | if (recover == dev->features) | ||
6155 | return 0; | ||
6156 | |||
6157 | dev_warn(&card->gdev->dev, | ||
6158 | "Device recovery failed to restore all offload features\n"); | ||
6159 | dev->features = recover; | ||
6160 | return -EIO; | ||
6161 | } | ||
6162 | EXPORT_SYMBOL_GPL(qeth_recover_features); | ||
6163 | |||
6134 | int qeth_set_features(struct net_device *dev, netdev_features_t features) | 6164 | int qeth_set_features(struct net_device *dev, netdev_features_t features) |
6135 | { | 6165 | { |
6136 | struct qeth_card *card = dev->ml_priv; | 6166 | struct qeth_card *card = dev->ml_priv; |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 7bc20c5188bc..bb27058fa9f0 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -1124,14 +1124,11 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) | |||
1124 | card->dev->hw_features |= NETIF_F_RXCSUM; | 1124 | card->dev->hw_features |= NETIF_F_RXCSUM; |
1125 | card->dev->vlan_features |= NETIF_F_RXCSUM; | 1125 | card->dev->vlan_features |= NETIF_F_RXCSUM; |
1126 | } | 1126 | } |
1127 | /* Turn on SG per default */ | ||
1128 | card->dev->features |= NETIF_F_SG; | ||
1129 | } | 1127 | } |
1130 | card->info.broadcast_capable = 1; | 1128 | card->info.broadcast_capable = 1; |
1131 | qeth_l2_request_initial_mac(card); | 1129 | qeth_l2_request_initial_mac(card); |
1132 | card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) * | 1130 | card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) * |
1133 | PAGE_SIZE; | 1131 | PAGE_SIZE; |
1134 | card->dev->gso_max_segs = (QETH_MAX_BUFFER_ELEMENTS(card) - 1); | ||
1135 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); | 1132 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); |
1136 | netif_napi_add(card->dev, &card->napi, qeth_l2_poll, QETH_NAPI_WEIGHT); | 1133 | netif_napi_add(card->dev, &card->napi, qeth_l2_poll, QETH_NAPI_WEIGHT); |
1137 | netif_carrier_off(card->dev); | 1134 | netif_carrier_off(card->dev); |
@@ -1246,6 +1243,9 @@ contin: | |||
1246 | } | 1243 | } |
1247 | /* this also sets saved unicast addresses */ | 1244 | /* this also sets saved unicast addresses */ |
1248 | qeth_l2_set_rx_mode(card->dev); | 1245 | qeth_l2_set_rx_mode(card->dev); |
1246 | rtnl_lock(); | ||
1247 | qeth_recover_features(card->dev); | ||
1248 | rtnl_unlock(); | ||
1249 | } | 1249 | } |
1250 | /* let user_space know that device is online */ | 1250 | /* let user_space know that device is online */ |
1251 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); | 1251 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 72934666fedf..272d9e7419be 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -257,6 +257,11 @@ int qeth_l3_delete_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr) | |||
257 | if (addr->in_progress) | 257 | if (addr->in_progress) |
258 | return -EINPROGRESS; | 258 | return -EINPROGRESS; |
259 | 259 | ||
260 | if (!qeth_card_hw_is_reachable(card)) { | ||
261 | addr->disp_flag = QETH_DISP_ADDR_DELETE; | ||
262 | return 0; | ||
263 | } | ||
264 | |||
260 | rc = qeth_l3_deregister_addr_entry(card, addr); | 265 | rc = qeth_l3_deregister_addr_entry(card, addr); |
261 | 266 | ||
262 | hash_del(&addr->hnode); | 267 | hash_del(&addr->hnode); |
@@ -296,6 +301,11 @@ int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr) | |||
296 | hash_add(card->ip_htable, &addr->hnode, | 301 | hash_add(card->ip_htable, &addr->hnode, |
297 | qeth_l3_ipaddr_hash(addr)); | 302 | qeth_l3_ipaddr_hash(addr)); |
298 | 303 | ||
304 | if (!qeth_card_hw_is_reachable(card)) { | ||
305 | addr->disp_flag = QETH_DISP_ADDR_ADD; | ||
306 | return 0; | ||
307 | } | ||
308 | |||
299 | /* qeth_l3_register_addr_entry can go to sleep | 309 | /* qeth_l3_register_addr_entry can go to sleep |
300 | * if we add a IPV4 addr. It is caused by the reason | 310 | * if we add a IPV4 addr. It is caused by the reason |
301 | * that SETIP ipa cmd starts ARP staff for IPV4 addr. | 311 | * that SETIP ipa cmd starts ARP staff for IPV4 addr. |
@@ -390,12 +400,16 @@ static void qeth_l3_recover_ip(struct qeth_card *card) | |||
390 | int i; | 400 | int i; |
391 | int rc; | 401 | int rc; |
392 | 402 | ||
393 | QETH_CARD_TEXT(card, 4, "recoverip"); | 403 | QETH_CARD_TEXT(card, 4, "recovrip"); |
394 | 404 | ||
395 | spin_lock_bh(&card->ip_lock); | 405 | spin_lock_bh(&card->ip_lock); |
396 | 406 | ||
397 | hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { | 407 | hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { |
398 | if (addr->disp_flag == QETH_DISP_ADDR_ADD) { | 408 | if (addr->disp_flag == QETH_DISP_ADDR_DELETE) { |
409 | qeth_l3_deregister_addr_entry(card, addr); | ||
410 | hash_del(&addr->hnode); | ||
411 | kfree(addr); | ||
412 | } else if (addr->disp_flag == QETH_DISP_ADDR_ADD) { | ||
399 | if (addr->proto == QETH_PROT_IPV4) { | 413 | if (addr->proto == QETH_PROT_IPV4) { |
400 | addr->in_progress = 1; | 414 | addr->in_progress = 1; |
401 | spin_unlock_bh(&card->ip_lock); | 415 | spin_unlock_bh(&card->ip_lock); |
@@ -407,10 +421,8 @@ static void qeth_l3_recover_ip(struct qeth_card *card) | |||
407 | 421 | ||
408 | if (!rc) { | 422 | if (!rc) { |
409 | addr->disp_flag = QETH_DISP_ADDR_DO_NOTHING; | 423 | addr->disp_flag = QETH_DISP_ADDR_DO_NOTHING; |
410 | if (addr->ref_counter < 1) { | 424 | if (addr->ref_counter < 1) |
411 | qeth_l3_delete_ip(card, addr); | 425 | qeth_l3_delete_ip(card, addr); |
412 | kfree(addr); | ||
413 | } | ||
414 | } else { | 426 | } else { |
415 | hash_del(&addr->hnode); | 427 | hash_del(&addr->hnode); |
416 | kfree(addr); | 428 | kfree(addr); |
@@ -689,7 +701,7 @@ int qeth_l3_add_vipa(struct qeth_card *card, enum qeth_prot_versions proto, | |||
689 | 701 | ||
690 | spin_lock_bh(&card->ip_lock); | 702 | spin_lock_bh(&card->ip_lock); |
691 | 703 | ||
692 | if (!qeth_l3_ip_from_hash(card, ipaddr)) | 704 | if (qeth_l3_ip_from_hash(card, ipaddr)) |
693 | rc = -EEXIST; | 705 | rc = -EEXIST; |
694 | else | 706 | else |
695 | qeth_l3_add_ip(card, ipaddr); | 707 | qeth_l3_add_ip(card, ipaddr); |
@@ -757,7 +769,7 @@ int qeth_l3_add_rxip(struct qeth_card *card, enum qeth_prot_versions proto, | |||
757 | 769 | ||
758 | spin_lock_bh(&card->ip_lock); | 770 | spin_lock_bh(&card->ip_lock); |
759 | 771 | ||
760 | if (!qeth_l3_ip_from_hash(card, ipaddr)) | 772 | if (qeth_l3_ip_from_hash(card, ipaddr)) |
761 | rc = -EEXIST; | 773 | rc = -EEXIST; |
762 | else | 774 | else |
763 | qeth_l3_add_ip(card, ipaddr); | 775 | qeth_l3_add_ip(card, ipaddr); |
@@ -3108,7 +3120,6 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) | |||
3108 | card->dev->vlan_features = NETIF_F_SG | | 3120 | card->dev->vlan_features = NETIF_F_SG | |
3109 | NETIF_F_RXCSUM | NETIF_F_IP_CSUM | | 3121 | NETIF_F_RXCSUM | NETIF_F_IP_CSUM | |
3110 | NETIF_F_TSO; | 3122 | NETIF_F_TSO; |
3111 | card->dev->features = NETIF_F_SG; | ||
3112 | } | 3123 | } |
3113 | } | 3124 | } |
3114 | } else if (card->info.type == QETH_CARD_TYPE_IQD) { | 3125 | } else if (card->info.type == QETH_CARD_TYPE_IQD) { |
@@ -3136,7 +3147,6 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) | |||
3136 | netif_keep_dst(card->dev); | 3147 | netif_keep_dst(card->dev); |
3137 | card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) * | 3148 | card->dev->gso_max_size = (QETH_MAX_BUFFER_ELEMENTS(card) - 1) * |
3138 | PAGE_SIZE; | 3149 | PAGE_SIZE; |
3139 | card->dev->gso_max_segs = (QETH_MAX_BUFFER_ELEMENTS(card) - 1); | ||
3140 | 3150 | ||
3141 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); | 3151 | SET_NETDEV_DEV(card->dev, &card->gdev->dev); |
3142 | netif_napi_add(card->dev, &card->napi, qeth_l3_poll, QETH_NAPI_WEIGHT); | 3152 | netif_napi_add(card->dev, &card->napi, qeth_l3_poll, QETH_NAPI_WEIGHT); |
@@ -3269,6 +3279,7 @@ contin: | |||
3269 | else | 3279 | else |
3270 | dev_open(card->dev); | 3280 | dev_open(card->dev); |
3271 | qeth_l3_set_multicast_list(card->dev); | 3281 | qeth_l3_set_multicast_list(card->dev); |
3282 | qeth_recover_features(card->dev); | ||
3272 | rtnl_unlock(); | 3283 | rtnl_unlock(); |
3273 | } | 3284 | } |
3274 | qeth_trace_features(card); | 3285 | qeth_trace_features(card); |
diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index 65645b11fc19..0e00a5ce0f00 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c | |||
@@ -297,7 +297,9 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, | |||
297 | addr->u.a6.pfxlen = 0; | 297 | addr->u.a6.pfxlen = 0; |
298 | addr->type = QETH_IP_TYPE_NORMAL; | 298 | addr->type = QETH_IP_TYPE_NORMAL; |
299 | 299 | ||
300 | spin_lock_bh(&card->ip_lock); | ||
300 | qeth_l3_delete_ip(card, addr); | 301 | qeth_l3_delete_ip(card, addr); |
302 | spin_unlock_bh(&card->ip_lock); | ||
301 | kfree(addr); | 303 | kfree(addr); |
302 | } | 304 | } |
303 | 305 | ||
@@ -329,7 +331,10 @@ static ssize_t qeth_l3_dev_hsuid_store(struct device *dev, | |||
329 | addr->type = QETH_IP_TYPE_NORMAL; | 331 | addr->type = QETH_IP_TYPE_NORMAL; |
330 | } else | 332 | } else |
331 | return -ENOMEM; | 333 | return -ENOMEM; |
334 | |||
335 | spin_lock_bh(&card->ip_lock); | ||
332 | qeth_l3_add_ip(card, addr); | 336 | qeth_l3_add_ip(card, addr); |
337 | spin_unlock_bh(&card->ip_lock); | ||
333 | kfree(addr); | 338 | kfree(addr); |
334 | 339 | ||
335 | return count; | 340 | return count; |
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 2c4dc69731e8..a603f29349f9 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c | |||
@@ -1050,13 +1050,17 @@ out: | |||
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | static int ll_rename(struct inode *src, struct dentry *src_dchild, | 1052 | static int ll_rename(struct inode *src, struct dentry *src_dchild, |
1053 | struct inode *tgt, struct dentry *tgt_dchild) | 1053 | struct inode *tgt, struct dentry *tgt_dchild, |
1054 | unsigned int flags) | ||
1054 | { | 1055 | { |
1055 | struct ptlrpc_request *request = NULL; | 1056 | struct ptlrpc_request *request = NULL; |
1056 | struct ll_sb_info *sbi = ll_i2sbi(src); | 1057 | struct ll_sb_info *sbi = ll_i2sbi(src); |
1057 | struct md_op_data *op_data; | 1058 | struct md_op_data *op_data; |
1058 | int err; | 1059 | int err; |
1059 | 1060 | ||
1061 | if (flags) | ||
1062 | return -EINVAL; | ||
1063 | |||
1060 | CDEBUG(D_VFSTRACE, | 1064 | CDEBUG(D_VFSTRACE, |
1061 | "VFS Op:oldname=%pd, src_dir="DFID"(%p), newname=%pd, tgt_dir="DFID"(%p)\n", | 1065 | "VFS Op:oldname=%pd, src_dir="DFID"(%p), newname=%pd, tgt_dir="DFID"(%p)\n", |
1062 | src_dchild, PFID(ll_inode2fid(src)), src, | 1066 | src_dchild, PFID(ll_inode2fid(src)), src, |
@@ -1102,7 +1106,7 @@ const struct inode_operations ll_dir_inode_operations = { | |||
1102 | .rmdir = ll_rmdir, | 1106 | .rmdir = ll_rmdir, |
1103 | .symlink = ll_symlink, | 1107 | .symlink = ll_symlink, |
1104 | .link = ll_link, | 1108 | .link = ll_link, |
1105 | .rename = ll_rename, | 1109 | .rename = ll_rename, |
1106 | .setattr = ll_setattr, | 1110 | .setattr = ll_setattr, |
1107 | .getattr = ll_getattr, | 1111 | .getattr = ll_getattr, |
1108 | .permission = ll_inode_permission, | 1112 | .permission = ll_inode_permission, |
diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO index a10d4f82b954..13224694a8ae 100644 --- a/drivers/staging/media/cec/TODO +++ b/drivers/staging/media/cec/TODO | |||
@@ -12,6 +12,7 @@ Hopefully this will happen later in 2016. | |||
12 | 12 | ||
13 | Other TODOs: | 13 | Other TODOs: |
14 | 14 | ||
15 | - There are two possible replies to CEC_MSG_INITIATE_ARC. How to handle that? | ||
15 | - Add a flag to inhibit passing CEC RC messages to the rc subsystem. | 16 | - Add a flag to inhibit passing CEC RC messages to the rc subsystem. |
16 | Applications should be able to choose this when calling S_LOG_ADDRS. | 17 | Applications should be able to choose this when calling S_LOG_ADDRS. |
17 | - If the reply field of cec_msg is set then when the reply arrives it | 18 | - If the reply field of cec_msg is set then when the reply arrives it |
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c index b2393bbacb26..946986f3ac0d 100644 --- a/drivers/staging/media/cec/cec-adap.c +++ b/drivers/staging/media/cec/cec-adap.c | |||
@@ -124,10 +124,10 @@ static void cec_queue_event(struct cec_adapter *adap, | |||
124 | u64 ts = ktime_get_ns(); | 124 | u64 ts = ktime_get_ns(); |
125 | struct cec_fh *fh; | 125 | struct cec_fh *fh; |
126 | 126 | ||
127 | mutex_lock(&adap->devnode.fhs_lock); | 127 | mutex_lock(&adap->devnode.lock); |
128 | list_for_each_entry(fh, &adap->devnode.fhs, list) | 128 | list_for_each_entry(fh, &adap->devnode.fhs, list) |
129 | cec_queue_event_fh(fh, ev, ts); | 129 | cec_queue_event_fh(fh, ev, ts); |
130 | mutex_unlock(&adap->devnode.fhs_lock); | 130 | mutex_unlock(&adap->devnode.lock); |
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
@@ -191,12 +191,12 @@ static void cec_queue_msg_monitor(struct cec_adapter *adap, | |||
191 | u32 monitor_mode = valid_la ? CEC_MODE_MONITOR : | 191 | u32 monitor_mode = valid_la ? CEC_MODE_MONITOR : |
192 | CEC_MODE_MONITOR_ALL; | 192 | CEC_MODE_MONITOR_ALL; |
193 | 193 | ||
194 | mutex_lock(&adap->devnode.fhs_lock); | 194 | mutex_lock(&adap->devnode.lock); |
195 | list_for_each_entry(fh, &adap->devnode.fhs, list) { | 195 | list_for_each_entry(fh, &adap->devnode.fhs, list) { |
196 | if (fh->mode_follower >= monitor_mode) | 196 | if (fh->mode_follower >= monitor_mode) |
197 | cec_queue_msg_fh(fh, msg); | 197 | cec_queue_msg_fh(fh, msg); |
198 | } | 198 | } |
199 | mutex_unlock(&adap->devnode.fhs_lock); | 199 | mutex_unlock(&adap->devnode.lock); |
200 | } | 200 | } |
201 | 201 | ||
202 | /* | 202 | /* |
@@ -207,12 +207,12 @@ static void cec_queue_msg_followers(struct cec_adapter *adap, | |||
207 | { | 207 | { |
208 | struct cec_fh *fh; | 208 | struct cec_fh *fh; |
209 | 209 | ||
210 | mutex_lock(&adap->devnode.fhs_lock); | 210 | mutex_lock(&adap->devnode.lock); |
211 | list_for_each_entry(fh, &adap->devnode.fhs, list) { | 211 | list_for_each_entry(fh, &adap->devnode.fhs, list) { |
212 | if (fh->mode_follower == CEC_MODE_FOLLOWER) | 212 | if (fh->mode_follower == CEC_MODE_FOLLOWER) |
213 | cec_queue_msg_fh(fh, msg); | 213 | cec_queue_msg_fh(fh, msg); |
214 | } | 214 | } |
215 | mutex_unlock(&adap->devnode.fhs_lock); | 215 | mutex_unlock(&adap->devnode.lock); |
216 | } | 216 | } |
217 | 217 | ||
218 | /* Notify userspace of an adapter state change. */ | 218 | /* Notify userspace of an adapter state change. */ |
@@ -851,6 +851,9 @@ void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg) | |||
851 | if (!valid_la || msg->len <= 1) | 851 | if (!valid_la || msg->len <= 1) |
852 | return; | 852 | return; |
853 | 853 | ||
854 | if (adap->log_addrs.log_addr_mask == 0) | ||
855 | return; | ||
856 | |||
854 | /* | 857 | /* |
855 | * Process the message on the protocol level. If is_reply is true, | 858 | * Process the message on the protocol level. If is_reply is true, |
856 | * then cec_receive_notify() won't pass on the reply to the listener(s) | 859 | * then cec_receive_notify() won't pass on the reply to the listener(s) |
@@ -1047,11 +1050,17 @@ static int cec_config_thread_func(void *arg) | |||
1047 | dprintk(1, "could not claim LA %d\n", i); | 1050 | dprintk(1, "could not claim LA %d\n", i); |
1048 | } | 1051 | } |
1049 | 1052 | ||
1053 | if (adap->log_addrs.log_addr_mask == 0 && | ||
1054 | !(las->flags & CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK)) | ||
1055 | goto unconfigure; | ||
1056 | |||
1050 | configured: | 1057 | configured: |
1051 | if (adap->log_addrs.log_addr_mask == 0) { | 1058 | if (adap->log_addrs.log_addr_mask == 0) { |
1052 | /* Fall back to unregistered */ | 1059 | /* Fall back to unregistered */ |
1053 | las->log_addr[0] = CEC_LOG_ADDR_UNREGISTERED; | 1060 | las->log_addr[0] = CEC_LOG_ADDR_UNREGISTERED; |
1054 | las->log_addr_mask = 1 << las->log_addr[0]; | 1061 | las->log_addr_mask = 1 << las->log_addr[0]; |
1062 | for (i = 1; i < las->num_log_addrs; i++) | ||
1063 | las->log_addr[i] = CEC_LOG_ADDR_INVALID; | ||
1055 | } | 1064 | } |
1056 | adap->is_configured = true; | 1065 | adap->is_configured = true; |
1057 | adap->is_configuring = false; | 1066 | adap->is_configuring = false; |
@@ -1070,6 +1079,8 @@ configured: | |||
1070 | cec_report_features(adap, i); | 1079 | cec_report_features(adap, i); |
1071 | cec_report_phys_addr(adap, i); | 1080 | cec_report_phys_addr(adap, i); |
1072 | } | 1081 | } |
1082 | for (i = las->num_log_addrs; i < CEC_MAX_LOG_ADDRS; i++) | ||
1083 | las->log_addr[i] = CEC_LOG_ADDR_INVALID; | ||
1073 | mutex_lock(&adap->lock); | 1084 | mutex_lock(&adap->lock); |
1074 | adap->kthread_config = NULL; | 1085 | adap->kthread_config = NULL; |
1075 | mutex_unlock(&adap->lock); | 1086 | mutex_unlock(&adap->lock); |
@@ -1398,7 +1409,6 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, | |||
1398 | u8 init_laddr = cec_msg_initiator(msg); | 1409 | u8 init_laddr = cec_msg_initiator(msg); |
1399 | u8 devtype = cec_log_addr2dev(adap, dest_laddr); | 1410 | u8 devtype = cec_log_addr2dev(adap, dest_laddr); |
1400 | int la_idx = cec_log_addr2idx(adap, dest_laddr); | 1411 | int la_idx = cec_log_addr2idx(adap, dest_laddr); |
1401 | bool is_directed = la_idx >= 0; | ||
1402 | bool from_unregistered = init_laddr == 0xf; | 1412 | bool from_unregistered = init_laddr == 0xf; |
1403 | struct cec_msg tx_cec_msg = { }; | 1413 | struct cec_msg tx_cec_msg = { }; |
1404 | 1414 | ||
@@ -1560,7 +1570,7 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg, | |||
1560 | * Unprocessed messages are aborted if userspace isn't doing | 1570 | * Unprocessed messages are aborted if userspace isn't doing |
1561 | * any processing either. | 1571 | * any processing either. |
1562 | */ | 1572 | */ |
1563 | if (is_directed && !is_reply && !adap->follower_cnt && | 1573 | if (!is_broadcast && !is_reply && !adap->follower_cnt && |
1564 | !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) | 1574 | !adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT) |
1565 | return cec_feature_abort(adap, msg); | 1575 | return cec_feature_abort(adap, msg); |
1566 | break; | 1576 | break; |
diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/staging/media/cec/cec-api.c index 7be7615a0fdf..e274e2f22398 100644 --- a/drivers/staging/media/cec/cec-api.c +++ b/drivers/staging/media/cec/cec-api.c | |||
@@ -162,7 +162,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh, | |||
162 | return -ENOTTY; | 162 | return -ENOTTY; |
163 | if (copy_from_user(&log_addrs, parg, sizeof(log_addrs))) | 163 | if (copy_from_user(&log_addrs, parg, sizeof(log_addrs))) |
164 | return -EFAULT; | 164 | return -EFAULT; |
165 | log_addrs.flags = 0; | 165 | log_addrs.flags &= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK; |
166 | mutex_lock(&adap->lock); | 166 | mutex_lock(&adap->lock); |
167 | if (!adap->is_configuring && | 167 | if (!adap->is_configuring && |
168 | (!log_addrs.num_log_addrs || !adap->is_configured) && | 168 | (!log_addrs.num_log_addrs || !adap->is_configured) && |
@@ -435,7 +435,7 @@ static long cec_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
435 | void __user *parg = (void __user *)arg; | 435 | void __user *parg = (void __user *)arg; |
436 | 436 | ||
437 | if (!devnode->registered) | 437 | if (!devnode->registered) |
438 | return -EIO; | 438 | return -ENODEV; |
439 | 439 | ||
440 | switch (cmd) { | 440 | switch (cmd) { |
441 | case CEC_ADAP_G_CAPS: | 441 | case CEC_ADAP_G_CAPS: |
@@ -508,14 +508,14 @@ static int cec_open(struct inode *inode, struct file *filp) | |||
508 | 508 | ||
509 | filp->private_data = fh; | 509 | filp->private_data = fh; |
510 | 510 | ||
511 | mutex_lock(&devnode->fhs_lock); | 511 | mutex_lock(&devnode->lock); |
512 | /* Queue up initial state events */ | 512 | /* Queue up initial state events */ |
513 | ev_state.state_change.phys_addr = adap->phys_addr; | 513 | ev_state.state_change.phys_addr = adap->phys_addr; |
514 | ev_state.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; | 514 | ev_state.state_change.log_addr_mask = adap->log_addrs.log_addr_mask; |
515 | cec_queue_event_fh(fh, &ev_state, 0); | 515 | cec_queue_event_fh(fh, &ev_state, 0); |
516 | 516 | ||
517 | list_add(&fh->list, &devnode->fhs); | 517 | list_add(&fh->list, &devnode->fhs); |
518 | mutex_unlock(&devnode->fhs_lock); | 518 | mutex_unlock(&devnode->lock); |
519 | 519 | ||
520 | return 0; | 520 | return 0; |
521 | } | 521 | } |
@@ -540,9 +540,9 @@ static int cec_release(struct inode *inode, struct file *filp) | |||
540 | cec_monitor_all_cnt_dec(adap); | 540 | cec_monitor_all_cnt_dec(adap); |
541 | mutex_unlock(&adap->lock); | 541 | mutex_unlock(&adap->lock); |
542 | 542 | ||
543 | mutex_lock(&devnode->fhs_lock); | 543 | mutex_lock(&devnode->lock); |
544 | list_del(&fh->list); | 544 | list_del(&fh->list); |
545 | mutex_unlock(&devnode->fhs_lock); | 545 | mutex_unlock(&devnode->lock); |
546 | 546 | ||
547 | /* Unhook pending transmits from this filehandle. */ | 547 | /* Unhook pending transmits from this filehandle. */ |
548 | mutex_lock(&adap->lock); | 548 | mutex_lock(&adap->lock); |
diff --git a/drivers/staging/media/cec/cec-core.c b/drivers/staging/media/cec/cec-core.c index 112a5fae12f5..3b1e4d2b190d 100644 --- a/drivers/staging/media/cec/cec-core.c +++ b/drivers/staging/media/cec/cec-core.c | |||
@@ -51,31 +51,29 @@ int cec_get_device(struct cec_devnode *devnode) | |||
51 | { | 51 | { |
52 | /* | 52 | /* |
53 | * Check if the cec device is available. This needs to be done with | 53 | * Check if the cec device is available. This needs to be done with |
54 | * the cec_devnode_lock held to prevent an open/unregister race: | 54 | * the devnode->lock held to prevent an open/unregister race: |
55 | * without the lock, the device could be unregistered and freed between | 55 | * without the lock, the device could be unregistered and freed between |
56 | * the devnode->registered check and get_device() calls, leading to | 56 | * the devnode->registered check and get_device() calls, leading to |
57 | * a crash. | 57 | * a crash. |
58 | */ | 58 | */ |
59 | mutex_lock(&cec_devnode_lock); | 59 | mutex_lock(&devnode->lock); |
60 | /* | 60 | /* |
61 | * return ENXIO if the cec device has been removed | 61 | * return ENXIO if the cec device has been removed |
62 | * already or if it is not registered anymore. | 62 | * already or if it is not registered anymore. |
63 | */ | 63 | */ |
64 | if (!devnode->registered) { | 64 | if (!devnode->registered) { |
65 | mutex_unlock(&cec_devnode_lock); | 65 | mutex_unlock(&devnode->lock); |
66 | return -ENXIO; | 66 | return -ENXIO; |
67 | } | 67 | } |
68 | /* and increase the device refcount */ | 68 | /* and increase the device refcount */ |
69 | get_device(&devnode->dev); | 69 | get_device(&devnode->dev); |
70 | mutex_unlock(&cec_devnode_lock); | 70 | mutex_unlock(&devnode->lock); |
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | void cec_put_device(struct cec_devnode *devnode) | 74 | void cec_put_device(struct cec_devnode *devnode) |
75 | { | 75 | { |
76 | mutex_lock(&cec_devnode_lock); | ||
77 | put_device(&devnode->dev); | 76 | put_device(&devnode->dev); |
78 | mutex_unlock(&cec_devnode_lock); | ||
79 | } | 77 | } |
80 | 78 | ||
81 | /* Called when the last user of the cec device exits. */ | 79 | /* Called when the last user of the cec device exits. */ |
@@ -84,11 +82,10 @@ static void cec_devnode_release(struct device *cd) | |||
84 | struct cec_devnode *devnode = to_cec_devnode(cd); | 82 | struct cec_devnode *devnode = to_cec_devnode(cd); |
85 | 83 | ||
86 | mutex_lock(&cec_devnode_lock); | 84 | mutex_lock(&cec_devnode_lock); |
87 | |||
88 | /* Mark device node number as free */ | 85 | /* Mark device node number as free */ |
89 | clear_bit(devnode->minor, cec_devnode_nums); | 86 | clear_bit(devnode->minor, cec_devnode_nums); |
90 | |||
91 | mutex_unlock(&cec_devnode_lock); | 87 | mutex_unlock(&cec_devnode_lock); |
88 | |||
92 | cec_delete_adapter(to_cec_adapter(devnode)); | 89 | cec_delete_adapter(to_cec_adapter(devnode)); |
93 | } | 90 | } |
94 | 91 | ||
@@ -117,7 +114,7 @@ static int __must_check cec_devnode_register(struct cec_devnode *devnode, | |||
117 | 114 | ||
118 | /* Initialization */ | 115 | /* Initialization */ |
119 | INIT_LIST_HEAD(&devnode->fhs); | 116 | INIT_LIST_HEAD(&devnode->fhs); |
120 | mutex_init(&devnode->fhs_lock); | 117 | mutex_init(&devnode->lock); |
121 | 118 | ||
122 | /* Part 1: Find a free minor number */ | 119 | /* Part 1: Find a free minor number */ |
123 | mutex_lock(&cec_devnode_lock); | 120 | mutex_lock(&cec_devnode_lock); |
@@ -160,7 +157,9 @@ static int __must_check cec_devnode_register(struct cec_devnode *devnode, | |||
160 | cdev_del: | 157 | cdev_del: |
161 | cdev_del(&devnode->cdev); | 158 | cdev_del(&devnode->cdev); |
162 | clr_bit: | 159 | clr_bit: |
160 | mutex_lock(&cec_devnode_lock); | ||
163 | clear_bit(devnode->minor, cec_devnode_nums); | 161 | clear_bit(devnode->minor, cec_devnode_nums); |
162 | mutex_unlock(&cec_devnode_lock); | ||
164 | return ret; | 163 | return ret; |
165 | } | 164 | } |
166 | 165 | ||
@@ -177,17 +176,21 @@ static void cec_devnode_unregister(struct cec_devnode *devnode) | |||
177 | { | 176 | { |
178 | struct cec_fh *fh; | 177 | struct cec_fh *fh; |
179 | 178 | ||
179 | mutex_lock(&devnode->lock); | ||
180 | |||
180 | /* Check if devnode was never registered or already unregistered */ | 181 | /* Check if devnode was never registered or already unregistered */ |
181 | if (!devnode->registered || devnode->unregistered) | 182 | if (!devnode->registered || devnode->unregistered) { |
183 | mutex_unlock(&devnode->lock); | ||
182 | return; | 184 | return; |
185 | } | ||
183 | 186 | ||
184 | mutex_lock(&devnode->fhs_lock); | ||
185 | list_for_each_entry(fh, &devnode->fhs, list) | 187 | list_for_each_entry(fh, &devnode->fhs, list) |
186 | wake_up_interruptible(&fh->wait); | 188 | wake_up_interruptible(&fh->wait); |
187 | mutex_unlock(&devnode->fhs_lock); | ||
188 | 189 | ||
189 | devnode->registered = false; | 190 | devnode->registered = false; |
190 | devnode->unregistered = true; | 191 | devnode->unregistered = true; |
192 | mutex_unlock(&devnode->lock); | ||
193 | |||
191 | device_del(&devnode->dev); | 194 | device_del(&devnode->dev); |
192 | cdev_del(&devnode->cdev); | 195 | cdev_del(&devnode->cdev); |
193 | put_device(&devnode->dev); | 196 | put_device(&devnode->dev); |
diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c index 94f8590492dc..ed8bd95ad6d0 100644 --- a/drivers/staging/media/pulse8-cec/pulse8-cec.c +++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c | |||
@@ -114,14 +114,11 @@ static void pulse8_irq_work_handler(struct work_struct *work) | |||
114 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_OK, | 114 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_OK, |
115 | 0, 0, 0, 0); | 115 | 0, 0, 0, 0); |
116 | break; | 116 | break; |
117 | case MSGCODE_TRANSMIT_FAILED_LINE: | ||
118 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_ARB_LOST, | ||
119 | 1, 0, 0, 0); | ||
120 | break; | ||
121 | case MSGCODE_TRANSMIT_FAILED_ACK: | 117 | case MSGCODE_TRANSMIT_FAILED_ACK: |
122 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_NACK, | 118 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_NACK, |
123 | 0, 1, 0, 0); | 119 | 0, 1, 0, 0); |
124 | break; | 120 | break; |
121 | case MSGCODE_TRANSMIT_FAILED_LINE: | ||
125 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: | 122 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: |
126 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: | 123 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: |
127 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_ERROR, | 124 | cec_transmit_done(pulse8->adap, CEC_TX_STATUS_ERROR, |
@@ -170,6 +167,9 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, | |||
170 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: | 167 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: |
171 | schedule_work(&pulse8->work); | 168 | schedule_work(&pulse8->work); |
172 | break; | 169 | break; |
170 | case MSGCODE_HIGH_ERROR: | ||
171 | case MSGCODE_LOW_ERROR: | ||
172 | case MSGCODE_RECEIVE_FAILED: | ||
173 | case MSGCODE_TIMEOUT_ERROR: | 173 | case MSGCODE_TIMEOUT_ERROR: |
174 | break; | 174 | break; |
175 | case MSGCODE_COMMAND_ACCEPTED: | 175 | case MSGCODE_COMMAND_ACCEPTED: |
@@ -388,7 +388,7 @@ static int pulse8_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, | |||
388 | int err; | 388 | int err; |
389 | 389 | ||
390 | cmd[0] = MSGCODE_TRANSMIT_IDLETIME; | 390 | cmd[0] = MSGCODE_TRANSMIT_IDLETIME; |
391 | cmd[1] = 3; | 391 | cmd[1] = signal_free_time; |
392 | err = pulse8_send_and_wait(pulse8, cmd, 2, | 392 | err = pulse8_send_and_wait(pulse8, cmd, 2, |
393 | MSGCODE_COMMAND_ACCEPTED, 1); | 393 | MSGCODE_COMMAND_ACCEPTED, 1); |
394 | cmd[0] = MSGCODE_TRANSMIT_ACK_POLARITY; | 394 | cmd[0] = MSGCODE_TRANSMIT_ACK_POLARITY; |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 15ce4ab11688..a2d90aca779f 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -240,8 +240,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
240 | memcpy(&endpoint->desc, d, n); | 240 | memcpy(&endpoint->desc, d, n); |
241 | INIT_LIST_HEAD(&endpoint->urb_list); | 241 | INIT_LIST_HEAD(&endpoint->urb_list); |
242 | 242 | ||
243 | /* Fix up bInterval values outside the legal range. Use 32 ms if no | 243 | /* |
244 | * proper value can be guessed. */ | 244 | * Fix up bInterval values outside the legal range. |
245 | * Use 10 or 8 ms if no proper value can be guessed. | ||
246 | */ | ||
245 | i = 0; /* i = min, j = max, n = default */ | 247 | i = 0; /* i = min, j = max, n = default */ |
246 | j = 255; | 248 | j = 255; |
247 | if (usb_endpoint_xfer_int(d)) { | 249 | if (usb_endpoint_xfer_int(d)) { |
@@ -250,13 +252,15 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
250 | case USB_SPEED_SUPER_PLUS: | 252 | case USB_SPEED_SUPER_PLUS: |
251 | case USB_SPEED_SUPER: | 253 | case USB_SPEED_SUPER: |
252 | case USB_SPEED_HIGH: | 254 | case USB_SPEED_HIGH: |
253 | /* Many device manufacturers are using full-speed | 255 | /* |
256 | * Many device manufacturers are using full-speed | ||
254 | * bInterval values in high-speed interrupt endpoint | 257 | * bInterval values in high-speed interrupt endpoint |
255 | * descriptors. Try to fix those and fall back to a | 258 | * descriptors. Try to fix those and fall back to an |
256 | * 32 ms default value otherwise. */ | 259 | * 8-ms default value otherwise. |
260 | */ | ||
257 | n = fls(d->bInterval*8); | 261 | n = fls(d->bInterval*8); |
258 | if (n == 0) | 262 | if (n == 0) |
259 | n = 9; /* 32 ms = 2^(9-1) uframes */ | 263 | n = 7; /* 8 ms = 2^(7-1) uframes */ |
260 | j = 16; | 264 | j = 16; |
261 | 265 | ||
262 | /* | 266 | /* |
@@ -271,10 +275,12 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
271 | } | 275 | } |
272 | break; | 276 | break; |
273 | default: /* USB_SPEED_FULL or _LOW */ | 277 | default: /* USB_SPEED_FULL or _LOW */ |
274 | /* For low-speed, 10 ms is the official minimum. | 278 | /* |
279 | * For low-speed, 10 ms is the official minimum. | ||
275 | * But some "overclocked" devices might want faster | 280 | * But some "overclocked" devices might want faster |
276 | * polling so we'll allow it. */ | 281 | * polling so we'll allow it. |
277 | n = 32; | 282 | */ |
283 | n = 10; | ||
278 | break; | 284 | break; |
279 | } | 285 | } |
280 | } else if (usb_endpoint_xfer_isoc(d)) { | 286 | } else if (usb_endpoint_xfer_isoc(d)) { |
@@ -282,10 +288,10 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
282 | j = 16; | 288 | j = 16; |
283 | switch (to_usb_device(ddev)->speed) { | 289 | switch (to_usb_device(ddev)->speed) { |
284 | case USB_SPEED_HIGH: | 290 | case USB_SPEED_HIGH: |
285 | n = 9; /* 32 ms = 2^(9-1) uframes */ | 291 | n = 7; /* 8 ms = 2^(7-1) uframes */ |
286 | break; | 292 | break; |
287 | default: /* USB_SPEED_FULL */ | 293 | default: /* USB_SPEED_FULL */ |
288 | n = 6; /* 32 ms = 2^(6-1) frames */ | 294 | n = 4; /* 8 ms = 2^(4-1) frames */ |
289 | break; | 295 | break; |
290 | } | 296 | } |
291 | } | 297 | } |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 886526b5fcdd..73cfa13fc0dc 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -87,7 +87,7 @@ config USB_MUSB_DA8XX | |||
87 | config USB_MUSB_TUSB6010 | 87 | config USB_MUSB_TUSB6010 |
88 | tristate "TUSB6010" | 88 | tristate "TUSB6010" |
89 | depends on HAS_IOMEM | 89 | depends on HAS_IOMEM |
90 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | 90 | depends on (ARCH_OMAP2PLUS || COMPILE_TEST) && !BLACKFIN |
91 | depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules | 91 | depends on NOP_USB_XCEIV = USB_MUSB_HDRC # both built-in or both modules |
92 | 92 | ||
93 | config USB_MUSB_OMAP2PLUS | 93 | config USB_MUSB_OMAP2PLUS |
diff --git a/drivers/usb/serial/usb-serial-simple.c b/drivers/usb/serial/usb-serial-simple.c index a204782ae530..e98b6e57b703 100644 --- a/drivers/usb/serial/usb-serial-simple.c +++ b/drivers/usb/serial/usb-serial-simple.c | |||
@@ -54,7 +54,8 @@ DEVICE(funsoft, FUNSOFT_IDS); | |||
54 | /* Infineon Flashloader driver */ | 54 | /* Infineon Flashloader driver */ |
55 | #define FLASHLOADER_IDS() \ | 55 | #define FLASHLOADER_IDS() \ |
56 | { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ | 56 | { USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \ |
57 | { USB_DEVICE(0x8087, 0x0716) } | 57 | { USB_DEVICE(0x8087, 0x0716) }, \ |
58 | { USB_DEVICE(0x8087, 0x0801) } | ||
58 | DEVICE(flashloader, FLASHLOADER_IDS); | 59 | DEVICE(flashloader, FLASHLOADER_IDS); |
59 | 60 | ||
60 | /* Google Serial USB SubClass */ | 61 | /* Google Serial USB SubClass */ |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 6877050384a1..443d12e02043 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -148,7 +148,8 @@ extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry, | |||
148 | extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d); | 148 | extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d); |
149 | extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d); | 149 | extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d); |
150 | extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 150 | extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
151 | struct inode *new_dir, struct dentry *new_dentry); | 151 | struct inode *new_dir, struct dentry *new_dentry, |
152 | unsigned int flags); | ||
152 | extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses, | 153 | extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses, |
153 | struct p9_fid *fid, | 154 | struct p9_fid *fid, |
154 | struct super_block *sb, int new); | 155 | struct super_block *sb, int new); |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 44fa598e6349..8bea369a2936 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -955,7 +955,8 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d) | |||
955 | 955 | ||
956 | int | 956 | int |
957 | v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 957 | v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
958 | struct inode *new_dir, struct dentry *new_dentry) | 958 | struct inode *new_dir, struct dentry *new_dentry, |
959 | unsigned int flags) | ||
959 | { | 960 | { |
960 | int retval; | 961 | int retval; |
961 | struct inode *old_inode; | 962 | struct inode *old_inode; |
@@ -966,6 +967,9 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
966 | struct p9_fid *newdirfid; | 967 | struct p9_fid *newdirfid; |
967 | struct p9_wstat wstat; | 968 | struct p9_wstat wstat; |
968 | 969 | ||
970 | if (flags) | ||
971 | return -EINVAL; | ||
972 | |||
969 | p9_debug(P9_DEBUG_VFS, "\n"); | 973 | p9_debug(P9_DEBUG_VFS, "\n"); |
970 | retval = 0; | 974 | retval = 0; |
971 | old_inode = d_inode(old_dentry); | 975 | old_inode = d_inode(old_dentry); |
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index cc2b2efc9211..2f088773f1c0 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -173,7 +173,8 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir, | |||
173 | extern int affs_symlink(struct inode *dir, struct dentry *dentry, | 173 | extern int affs_symlink(struct inode *dir, struct dentry *dentry, |
174 | const char *symname); | 174 | const char *symname); |
175 | extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, | 175 | extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, |
176 | struct inode *new_dir, struct dentry *new_dentry); | 176 | struct inode *new_dir, struct dentry *new_dentry, |
177 | unsigned int flags); | ||
177 | 178 | ||
178 | /* inode.c */ | 179 | /* inode.c */ |
179 | 180 | ||
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index a2d68f828d53..29186d29a3b6 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -414,12 +414,16 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) | |||
414 | 414 | ||
415 | int | 415 | int |
416 | affs_rename(struct inode *old_dir, struct dentry *old_dentry, | 416 | affs_rename(struct inode *old_dir, struct dentry *old_dentry, |
417 | struct inode *new_dir, struct dentry *new_dentry) | 417 | struct inode *new_dir, struct dentry *new_dentry, |
418 | unsigned int flags) | ||
418 | { | 419 | { |
419 | struct super_block *sb = old_dir->i_sb; | 420 | struct super_block *sb = old_dir->i_sb; |
420 | struct buffer_head *bh = NULL; | 421 | struct buffer_head *bh = NULL; |
421 | int retval; | 422 | int retval; |
422 | 423 | ||
424 | if (flags & ~RENAME_NOREPLACE) | ||
425 | return -EINVAL; | ||
426 | |||
423 | pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, | 427 | pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, |
424 | old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); | 428 | old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); |
425 | 429 | ||
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index eba541004d90..51a241e09fbb 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -38,7 +38,8 @@ static int afs_link(struct dentry *from, struct inode *dir, | |||
38 | static int afs_symlink(struct inode *dir, struct dentry *dentry, | 38 | static int afs_symlink(struct inode *dir, struct dentry *dentry, |
39 | const char *content); | 39 | const char *content); |
40 | static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, | 40 | static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
41 | struct inode *new_dir, struct dentry *new_dentry); | 41 | struct inode *new_dir, struct dentry *new_dentry, |
42 | unsigned int flags); | ||
42 | 43 | ||
43 | const struct file_operations afs_dir_file_operations = { | 44 | const struct file_operations afs_dir_file_operations = { |
44 | .open = afs_dir_open, | 45 | .open = afs_dir_open, |
@@ -1083,12 +1084,16 @@ error: | |||
1083 | * rename a file in an AFS filesystem and/or move it between directories | 1084 | * rename a file in an AFS filesystem and/or move it between directories |
1084 | */ | 1085 | */ |
1085 | static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, | 1086 | static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, |
1086 | struct inode *new_dir, struct dentry *new_dentry) | 1087 | struct inode *new_dir, struct dentry *new_dentry, |
1088 | unsigned int flags) | ||
1087 | { | 1089 | { |
1088 | struct afs_vnode *orig_dvnode, *new_dvnode, *vnode; | 1090 | struct afs_vnode *orig_dvnode, *new_dvnode, *vnode; |
1089 | struct key *key; | 1091 | struct key *key; |
1090 | int ret; | 1092 | int ret; |
1091 | 1093 | ||
1094 | if (flags) | ||
1095 | return -EINVAL; | ||
1096 | |||
1092 | vnode = AFS_FS_I(d_inode(old_dentry)); | 1097 | vnode = AFS_FS_I(d_inode(old_dentry)); |
1093 | orig_dvnode = AFS_FS_I(old_dir); | 1098 | orig_dvnode = AFS_FS_I(old_dir); |
1094 | new_dvnode = AFS_FS_I(new_dir); | 1099 | new_dvnode = AFS_FS_I(new_dir); |
@@ -239,7 +239,12 @@ static struct dentry *aio_mount(struct file_system_type *fs_type, | |||
239 | static const struct dentry_operations ops = { | 239 | static const struct dentry_operations ops = { |
240 | .d_dname = simple_dname, | 240 | .d_dname = simple_dname, |
241 | }; | 241 | }; |
242 | return mount_pseudo(fs_type, "aio:", NULL, &ops, AIO_RING_MAGIC); | 242 | struct dentry *root = mount_pseudo(fs_type, "aio:", NULL, &ops, |
243 | AIO_RING_MAGIC); | ||
244 | |||
245 | if (!IS_ERR(root)) | ||
246 | root->d_sb->s_iflags |= SB_I_NOEXEC; | ||
247 | return root; | ||
243 | } | 248 | } |
244 | 249 | ||
245 | /* aio_setup | 250 | /* aio_setup |
diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c index b493909e7492..d8e6d421c27f 100644 --- a/fs/autofs4/expire.c +++ b/fs/autofs4/expire.c | |||
@@ -417,6 +417,7 @@ static struct dentry *should_expire(struct dentry *dentry, | |||
417 | } | 417 | } |
418 | return NULL; | 418 | return NULL; |
419 | } | 419 | } |
420 | |||
420 | /* | 421 | /* |
421 | * Find an eligible tree to time-out | 422 | * Find an eligible tree to time-out |
422 | * A tree is eligible if :- | 423 | * A tree is eligible if :- |
@@ -432,6 +433,7 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
432 | struct dentry *root = sb->s_root; | 433 | struct dentry *root = sb->s_root; |
433 | struct dentry *dentry; | 434 | struct dentry *dentry; |
434 | struct dentry *expired; | 435 | struct dentry *expired; |
436 | struct dentry *found; | ||
435 | struct autofs_info *ino; | 437 | struct autofs_info *ino; |
436 | 438 | ||
437 | if (!root) | 439 | if (!root) |
@@ -442,31 +444,46 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, | |||
442 | 444 | ||
443 | dentry = NULL; | 445 | dentry = NULL; |
444 | while ((dentry = get_next_positive_subdir(dentry, root))) { | 446 | while ((dentry = get_next_positive_subdir(dentry, root))) { |
447 | int flags = how; | ||
448 | |||
445 | spin_lock(&sbi->fs_lock); | 449 | spin_lock(&sbi->fs_lock); |
446 | ino = autofs4_dentry_ino(dentry); | 450 | ino = autofs4_dentry_ino(dentry); |
447 | if (ino->flags & AUTOFS_INF_WANT_EXPIRE) | 451 | if (ino->flags & AUTOFS_INF_WANT_EXPIRE) { |
448 | expired = NULL; | ||
449 | else | ||
450 | expired = should_expire(dentry, mnt, timeout, how); | ||
451 | if (!expired) { | ||
452 | spin_unlock(&sbi->fs_lock); | 452 | spin_unlock(&sbi->fs_lock); |
453 | continue; | 453 | continue; |
454 | } | 454 | } |
455 | spin_unlock(&sbi->fs_lock); | ||
456 | |||
457 | expired = should_expire(dentry, mnt, timeout, flags); | ||
458 | if (!expired) | ||
459 | continue; | ||
460 | |||
461 | spin_lock(&sbi->fs_lock); | ||
455 | ino = autofs4_dentry_ino(expired); | 462 | ino = autofs4_dentry_ino(expired); |
456 | ino->flags |= AUTOFS_INF_WANT_EXPIRE; | 463 | ino->flags |= AUTOFS_INF_WANT_EXPIRE; |
457 | spin_unlock(&sbi->fs_lock); | 464 | spin_unlock(&sbi->fs_lock); |
458 | synchronize_rcu(); | 465 | synchronize_rcu(); |
459 | spin_lock(&sbi->fs_lock); | ||
460 | if (should_expire(expired, mnt, timeout, how)) { | ||
461 | if (expired != dentry) | ||
462 | dput(dentry); | ||
463 | goto found; | ||
464 | } | ||
465 | 466 | ||
467 | /* Make sure a reference is not taken on found if | ||
468 | * things have changed. | ||
469 | */ | ||
470 | flags &= ~AUTOFS_EXP_LEAVES; | ||
471 | found = should_expire(expired, mnt, timeout, how); | ||
472 | if (!found || found != expired) | ||
473 | /* Something has changed, continue */ | ||
474 | goto next; | ||
475 | |||
476 | if (expired != dentry) | ||
477 | dput(dentry); | ||
478 | |||
479 | spin_lock(&sbi->fs_lock); | ||
480 | goto found; | ||
481 | next: | ||
482 | spin_lock(&sbi->fs_lock); | ||
466 | ino->flags &= ~AUTOFS_INF_WANT_EXPIRE; | 483 | ino->flags &= ~AUTOFS_INF_WANT_EXPIRE; |
484 | spin_unlock(&sbi->fs_lock); | ||
467 | if (expired != dentry) | 485 | if (expired != dentry) |
468 | dput(expired); | 486 | dput(expired); |
469 | spin_unlock(&sbi->fs_lock); | ||
470 | } | 487 | } |
471 | return NULL; | 488 | return NULL; |
472 | 489 | ||
@@ -483,6 +500,7 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |||
483 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); | 500 | struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); |
484 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 501 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
485 | int status; | 502 | int status; |
503 | int state; | ||
486 | 504 | ||
487 | /* Block on any pending expire */ | 505 | /* Block on any pending expire */ |
488 | if (!(ino->flags & AUTOFS_INF_WANT_EXPIRE)) | 506 | if (!(ino->flags & AUTOFS_INF_WANT_EXPIRE)) |
@@ -490,8 +508,19 @@ int autofs4_expire_wait(struct dentry *dentry, int rcu_walk) | |||
490 | if (rcu_walk) | 508 | if (rcu_walk) |
491 | return -ECHILD; | 509 | return -ECHILD; |
492 | 510 | ||
511 | retry: | ||
493 | spin_lock(&sbi->fs_lock); | 512 | spin_lock(&sbi->fs_lock); |
494 | if (ino->flags & AUTOFS_INF_EXPIRING) { | 513 | state = ino->flags & (AUTOFS_INF_WANT_EXPIRE | AUTOFS_INF_EXPIRING); |
514 | if (state == AUTOFS_INF_WANT_EXPIRE) { | ||
515 | spin_unlock(&sbi->fs_lock); | ||
516 | /* | ||
517 | * Possibly being selected for expire, wait until | ||
518 | * it's selected or not. | ||
519 | */ | ||
520 | schedule_timeout_uninterruptible(HZ/10); | ||
521 | goto retry; | ||
522 | } | ||
523 | if (state & AUTOFS_INF_EXPIRING) { | ||
495 | spin_unlock(&sbi->fs_lock); | 524 | spin_unlock(&sbi->fs_lock); |
496 | 525 | ||
497 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); | 526 | pr_debug("waiting for expire %p name=%pd\n", dentry, dentry); |
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 3c8ec390b446..9fc451e9f987 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c | |||
@@ -133,7 +133,7 @@ static const struct inode_operations bad_inode_ops = | |||
133 | .mkdir = bad_inode_mkdir, | 133 | .mkdir = bad_inode_mkdir, |
134 | .rmdir = bad_inode_rmdir, | 134 | .rmdir = bad_inode_rmdir, |
135 | .mknod = bad_inode_mknod, | 135 | .mknod = bad_inode_mknod, |
136 | .rename2 = bad_inode_rename2, | 136 | .rename = bad_inode_rename2, |
137 | .readlink = bad_inode_readlink, | 137 | .readlink = bad_inode_readlink, |
138 | /* follow_link must be no-op, otherwise unmounting this inode | 138 | /* follow_link must be no-op, otherwise unmounting this inode |
139 | won't work */ | 139 | won't work */ |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 4206419a4bdf..3e5ac30e8b6f 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -207,7 +207,8 @@ out_brelse: | |||
207 | } | 207 | } |
208 | 208 | ||
209 | static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 209 | static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
210 | struct inode *new_dir, struct dentry *new_dentry) | 210 | struct inode *new_dir, struct dentry *new_dentry, |
211 | unsigned int flags) | ||
211 | { | 212 | { |
212 | struct inode *old_inode, *new_inode; | 213 | struct inode *old_inode, *new_inode; |
213 | struct buffer_head *old_bh, *new_bh; | 214 | struct buffer_head *old_bh, *new_bh; |
@@ -215,6 +216,9 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
215 | struct bfs_sb_info *info; | 216 | struct bfs_sb_info *info; |
216 | int error = -ENOENT; | 217 | int error = -ENOENT; |
217 | 218 | ||
219 | if (flags & ~RENAME_NOREPLACE) | ||
220 | return -EINVAL; | ||
221 | |||
218 | old_bh = new_bh = NULL; | 222 | old_bh = new_bh = NULL; |
219 | old_inode = d_inode(old_dentry); | 223 | old_inode = d_inode(old_dentry); |
220 | if (S_ISDIR(old_inode->i_mode)) | 224 | if (S_ISDIR(old_inode->i_mode)) |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 38c2df84cabd..665da8f66ff1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4271,13 +4271,10 @@ int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len) | |||
4271 | if (ret < 0) | 4271 | if (ret < 0) |
4272 | return ret; | 4272 | return ret; |
4273 | 4273 | ||
4274 | /* | 4274 | /* Use new btrfs_qgroup_reserve_data to reserve precious data space. */ |
4275 | * Use new btrfs_qgroup_reserve_data to reserve precious data space | ||
4276 | * | ||
4277 | * TODO: Find a good method to avoid reserve data space for NOCOW | ||
4278 | * range, but don't impact performance on quota disable case. | ||
4279 | */ | ||
4280 | ret = btrfs_qgroup_reserve_data(inode, start, len); | 4275 | ret = btrfs_qgroup_reserve_data(inode, start, len); |
4276 | if (ret) | ||
4277 | btrfs_free_reserved_data_space_noquota(inode, start, len); | ||
4281 | return ret; | 4278 | return ret; |
4282 | } | 4279 | } |
4283 | 4280 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2924774343e3..a240270dc045 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -10566,7 +10566,7 @@ static const struct inode_operations btrfs_dir_inode_operations = { | |||
10566 | .link = btrfs_link, | 10566 | .link = btrfs_link, |
10567 | .mkdir = btrfs_mkdir, | 10567 | .mkdir = btrfs_mkdir, |
10568 | .rmdir = btrfs_rmdir, | 10568 | .rmdir = btrfs_rmdir, |
10569 | .rename2 = btrfs_rename2, | 10569 | .rename = btrfs_rename2, |
10570 | .symlink = btrfs_symlink, | 10570 | .symlink = btrfs_symlink, |
10571 | .setattr = btrfs_setattr, | 10571 | .setattr = btrfs_setattr, |
10572 | .mknod = btrfs_mknod, | 10572 | .mknod = btrfs_mknod, |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c48e37444717..b182197f7091 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1634,6 +1634,9 @@ static noinline int btrfs_ioctl_snap_create_transid(struct file *file, | |||
1634 | int namelen; | 1634 | int namelen; |
1635 | int ret = 0; | 1635 | int ret = 0; |
1636 | 1636 | ||
1637 | if (!S_ISDIR(file_inode(file)->i_mode)) | ||
1638 | return -ENOTDIR; | ||
1639 | |||
1637 | ret = mnt_want_write_file(file); | 1640 | ret = mnt_want_write_file(file); |
1638 | if (ret) | 1641 | if (ret) |
1639 | goto out; | 1642 | goto out; |
@@ -1691,6 +1694,9 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, | |||
1691 | struct btrfs_ioctl_vol_args *vol_args; | 1694 | struct btrfs_ioctl_vol_args *vol_args; |
1692 | int ret; | 1695 | int ret; |
1693 | 1696 | ||
1697 | if (!S_ISDIR(file_inode(file)->i_mode)) | ||
1698 | return -ENOTDIR; | ||
1699 | |||
1694 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 1700 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
1695 | if (IS_ERR(vol_args)) | 1701 | if (IS_ERR(vol_args)) |
1696 | return PTR_ERR(vol_args); | 1702 | return PTR_ERR(vol_args); |
@@ -1714,6 +1720,9 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file, | |||
1714 | bool readonly = false; | 1720 | bool readonly = false; |
1715 | struct btrfs_qgroup_inherit *inherit = NULL; | 1721 | struct btrfs_qgroup_inherit *inherit = NULL; |
1716 | 1722 | ||
1723 | if (!S_ISDIR(file_inode(file)->i_mode)) | ||
1724 | return -ENOTDIR; | ||
1725 | |||
1717 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 1726 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
1718 | if (IS_ERR(vol_args)) | 1727 | if (IS_ERR(vol_args)) |
1719 | return PTR_ERR(vol_args); | 1728 | return PTR_ERR(vol_args); |
@@ -2357,6 +2366,9 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2357 | int ret; | 2366 | int ret; |
2358 | int err = 0; | 2367 | int err = 0; |
2359 | 2368 | ||
2369 | if (!S_ISDIR(dir->i_mode)) | ||
2370 | return -ENOTDIR; | ||
2371 | |||
2360 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 2372 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
2361 | if (IS_ERR(vol_args)) | 2373 | if (IS_ERR(vol_args)) |
2362 | return PTR_ERR(vol_args); | 2374 | return PTR_ERR(vol_args); |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 3f7c2cd41f8f..9828850d88de 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -804,8 +804,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
804 | !d_backing_inode(subdir)->i_op->lookup || | 804 | !d_backing_inode(subdir)->i_op->lookup || |
805 | !d_backing_inode(subdir)->i_op->mkdir || | 805 | !d_backing_inode(subdir)->i_op->mkdir || |
806 | !d_backing_inode(subdir)->i_op->create || | 806 | !d_backing_inode(subdir)->i_op->create || |
807 | (!d_backing_inode(subdir)->i_op->rename && | 807 | !d_backing_inode(subdir)->i_op->rename || |
808 | !d_backing_inode(subdir)->i_op->rename2) || | ||
809 | !d_backing_inode(subdir)->i_op->rmdir || | 808 | !d_backing_inode(subdir)->i_op->rmdir || |
810 | !d_backing_inode(subdir)->i_op->unlink) | 809 | !d_backing_inode(subdir)->i_op->unlink) |
811 | goto check_error; | 810 | goto check_error; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index df4b3e6fa563..291a4d59c5f7 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1061,7 +1061,8 @@ out: | |||
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, | 1063 | static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, |
1064 | struct inode *new_dir, struct dentry *new_dentry) | 1064 | struct inode *new_dir, struct dentry *new_dentry, |
1065 | unsigned int flags) | ||
1065 | { | 1066 | { |
1066 | struct ceph_fs_client *fsc = ceph_sb_to_client(old_dir->i_sb); | 1067 | struct ceph_fs_client *fsc = ceph_sb_to_client(old_dir->i_sb); |
1067 | struct ceph_mds_client *mdsc = fsc->mdsc; | 1068 | struct ceph_mds_client *mdsc = fsc->mdsc; |
@@ -1069,6 +1070,9 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1069 | int op = CEPH_MDS_OP_RENAME; | 1070 | int op = CEPH_MDS_OP_RENAME; |
1070 | int err; | 1071 | int err; |
1071 | 1072 | ||
1073 | if (flags) | ||
1074 | return -EINVAL; | ||
1075 | |||
1072 | if (ceph_snap(old_dir) != ceph_snap(new_dir)) | 1076 | if (ceph_snap(old_dir) != ceph_snap(new_dir)) |
1073 | return -EXDEV; | 1077 | return -EXDEV; |
1074 | if (ceph_snap(old_dir) != CEPH_NOSNAP) { | 1078 | if (ceph_snap(old_dir) != CEPH_NOSNAP) { |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 6bbec5e784cd..7d0e0f78da51 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -609,6 +609,9 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | |||
609 | char *s, *p; | 609 | char *s, *p; |
610 | char sep; | 610 | char sep; |
611 | 611 | ||
612 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) | ||
613 | return dget(sb->s_root); | ||
614 | |||
612 | full_path = cifs_build_path_to_root(vol, cifs_sb, | 615 | full_path = cifs_build_path_to_root(vol, cifs_sb, |
613 | cifs_sb_master_tcon(cifs_sb)); | 616 | cifs_sb_master_tcon(cifs_sb)); |
614 | if (full_path == NULL) | 617 | if (full_path == NULL) |
@@ -686,26 +689,22 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
686 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); | 689 | cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); |
687 | if (cifs_sb->mountdata == NULL) { | 690 | if (cifs_sb->mountdata == NULL) { |
688 | root = ERR_PTR(-ENOMEM); | 691 | root = ERR_PTR(-ENOMEM); |
689 | goto out_cifs_sb; | 692 | goto out_free; |
690 | } | 693 | } |
691 | 694 | ||
692 | if (volume_info->prepath) { | 695 | rc = cifs_setup_cifs_sb(volume_info, cifs_sb); |
693 | cifs_sb->prepath = kstrdup(volume_info->prepath, GFP_KERNEL); | 696 | if (rc) { |
694 | if (cifs_sb->prepath == NULL) { | 697 | root = ERR_PTR(rc); |
695 | root = ERR_PTR(-ENOMEM); | 698 | goto out_free; |
696 | goto out_cifs_sb; | ||
697 | } | ||
698 | } | 699 | } |
699 | 700 | ||
700 | cifs_setup_cifs_sb(volume_info, cifs_sb); | ||
701 | |||
702 | rc = cifs_mount(cifs_sb, volume_info); | 701 | rc = cifs_mount(cifs_sb, volume_info); |
703 | if (rc) { | 702 | if (rc) { |
704 | if (!(flags & MS_SILENT)) | 703 | if (!(flags & MS_SILENT)) |
705 | cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", | 704 | cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n", |
706 | rc); | 705 | rc); |
707 | root = ERR_PTR(rc); | 706 | root = ERR_PTR(rc); |
708 | goto out_mountdata; | 707 | goto out_free; |
709 | } | 708 | } |
710 | 709 | ||
711 | mnt_data.vol = volume_info; | 710 | mnt_data.vol = volume_info; |
@@ -735,11 +734,7 @@ cifs_do_mount(struct file_system_type *fs_type, | |||
735 | sb->s_flags |= MS_ACTIVE; | 734 | sb->s_flags |= MS_ACTIVE; |
736 | } | 735 | } |
737 | 736 | ||
738 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) | 737 | root = cifs_get_root(volume_info, sb); |
739 | root = dget(sb->s_root); | ||
740 | else | ||
741 | root = cifs_get_root(volume_info, sb); | ||
742 | |||
743 | if (IS_ERR(root)) | 738 | if (IS_ERR(root)) |
744 | goto out_super; | 739 | goto out_super; |
745 | 740 | ||
@@ -752,9 +747,9 @@ out: | |||
752 | cifs_cleanup_volume_info(volume_info); | 747 | cifs_cleanup_volume_info(volume_info); |
753 | return root; | 748 | return root; |
754 | 749 | ||
755 | out_mountdata: | 750 | out_free: |
751 | kfree(cifs_sb->prepath); | ||
756 | kfree(cifs_sb->mountdata); | 752 | kfree(cifs_sb->mountdata); |
757 | out_cifs_sb: | ||
758 | kfree(cifs_sb); | 753 | kfree(cifs_sb); |
759 | out_nls: | 754 | out_nls: |
760 | unload_nls(volume_info->local_nls); | 755 | unload_nls(volume_info->local_nls); |
@@ -901,7 +896,7 @@ const struct inode_operations cifs_dir_inode_ops = { | |||
901 | .link = cifs_hardlink, | 896 | .link = cifs_hardlink, |
902 | .mkdir = cifs_mkdir, | 897 | .mkdir = cifs_mkdir, |
903 | .rmdir = cifs_rmdir, | 898 | .rmdir = cifs_rmdir, |
904 | .rename2 = cifs_rename2, | 899 | .rename = cifs_rename2, |
905 | .permission = cifs_permission, | 900 | .permission = cifs_permission, |
906 | .setattr = cifs_setattr, | 901 | .setattr = cifs_setattr, |
907 | .symlink = cifs_symlink, | 902 | .symlink = cifs_symlink, |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1243bd326591..95dab43646f0 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -184,7 +184,7 @@ extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, | |||
184 | unsigned int to_read); | 184 | unsigned int to_read); |
185 | extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, | 185 | extern int cifs_read_page_from_socket(struct TCP_Server_Info *server, |
186 | struct page *page, unsigned int to_read); | 186 | struct page *page, unsigned int to_read); |
187 | extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 187 | extern int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
188 | struct cifs_sb_info *cifs_sb); | 188 | struct cifs_sb_info *cifs_sb); |
189 | extern int cifs_match_super(struct super_block *, void *); | 189 | extern int cifs_match_super(struct super_block *, void *); |
190 | extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); | 190 | extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 7ae03283bd61..2e4f4bad8b1e 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2781,6 +2781,24 @@ compare_mount_options(struct super_block *sb, struct cifs_mnt_data *mnt_data) | |||
2781 | return 1; | 2781 | return 1; |
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | static int | ||
2785 | match_prepath(struct super_block *sb, struct cifs_mnt_data *mnt_data) | ||
2786 | { | ||
2787 | struct cifs_sb_info *old = CIFS_SB(sb); | ||
2788 | struct cifs_sb_info *new = mnt_data->cifs_sb; | ||
2789 | |||
2790 | if (old->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) { | ||
2791 | if (!(new->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH)) | ||
2792 | return 0; | ||
2793 | /* The prepath should be null terminated strings */ | ||
2794 | if (strcmp(new->prepath, old->prepath)) | ||
2795 | return 0; | ||
2796 | |||
2797 | return 1; | ||
2798 | } | ||
2799 | return 0; | ||
2800 | } | ||
2801 | |||
2784 | int | 2802 | int |
2785 | cifs_match_super(struct super_block *sb, void *data) | 2803 | cifs_match_super(struct super_block *sb, void *data) |
2786 | { | 2804 | { |
@@ -2808,7 +2826,8 @@ cifs_match_super(struct super_block *sb, void *data) | |||
2808 | 2826 | ||
2809 | if (!match_server(tcp_srv, volume_info) || | 2827 | if (!match_server(tcp_srv, volume_info) || |
2810 | !match_session(ses, volume_info) || | 2828 | !match_session(ses, volume_info) || |
2811 | !match_tcon(tcon, volume_info->UNC)) { | 2829 | !match_tcon(tcon, volume_info->UNC) || |
2830 | !match_prepath(sb, mnt_data)) { | ||
2812 | rc = 0; | 2831 | rc = 0; |
2813 | goto out; | 2832 | goto out; |
2814 | } | 2833 | } |
@@ -3222,7 +3241,7 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, | |||
3222 | } | 3241 | } |
3223 | } | 3242 | } |
3224 | 3243 | ||
3225 | void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 3244 | int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
3226 | struct cifs_sb_info *cifs_sb) | 3245 | struct cifs_sb_info *cifs_sb) |
3227 | { | 3246 | { |
3228 | INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); | 3247 | INIT_DELAYED_WORK(&cifs_sb->prune_tlinks, cifs_prune_tlinks); |
@@ -3316,6 +3335,14 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
3316 | 3335 | ||
3317 | if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) | 3336 | if ((pvolume_info->cifs_acl) && (pvolume_info->dynperm)) |
3318 | cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); | 3337 | cifs_dbg(VFS, "mount option dynperm ignored if cifsacl mount option supported\n"); |
3338 | |||
3339 | if (pvolume_info->prepath) { | ||
3340 | cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); | ||
3341 | if (cifs_sb->prepath == NULL) | ||
3342 | return -ENOMEM; | ||
3343 | } | ||
3344 | |||
3345 | return 0; | ||
3319 | } | 3346 | } |
3320 | 3347 | ||
3321 | static void | 3348 | static void |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index b10a74bac58b..c0474ac6cbf2 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -291,7 +291,8 @@ static int coda_rmdir(struct inode *dir, struct dentry *de) | |||
291 | 291 | ||
292 | /* rename */ | 292 | /* rename */ |
293 | static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, | 293 | static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, |
294 | struct inode *new_dir, struct dentry *new_dentry) | 294 | struct inode *new_dir, struct dentry *new_dentry, |
295 | unsigned int flags) | ||
295 | { | 296 | { |
296 | const char *old_name = old_dentry->d_name.name; | 297 | const char *old_name = old_dentry->d_name.name; |
297 | const char *new_name = new_dentry->d_name.name; | 298 | const char *new_name = new_dentry->d_name.name; |
@@ -299,6 +300,9 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
299 | int new_length = new_dentry->d_name.len; | 300 | int new_length = new_dentry->d_name.len; |
300 | int error; | 301 | int error; |
301 | 302 | ||
303 | if (flags) | ||
304 | return -EINVAL; | ||
305 | |||
302 | error = venus_rename(old_dir->i_sb, coda_i2f(old_dir), | 306 | error = venus_rename(old_dir->i_sb, coda_i2f(old_dir), |
303 | coda_i2f(new_dir), old_length, new_length, | 307 | coda_i2f(new_dir), old_length, new_length, |
304 | (const char *) old_name, (const char *)new_name); | 308 | (const char *) old_name, (const char *)new_name); |
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index c30cf49b69d2..2c6312db8516 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c | |||
@@ -333,6 +333,7 @@ configfs_write_bin_file(struct file *file, const char __user *buf, | |||
333 | if (bin_attr->cb_max_size && | 333 | if (bin_attr->cb_max_size && |
334 | *ppos + count > bin_attr->cb_max_size) { | 334 | *ppos + count > bin_attr->cb_max_size) { |
335 | len = -EFBIG; | 335 | len = -EFBIG; |
336 | goto out; | ||
336 | } | 337 | } |
337 | 338 | ||
338 | tbuf = vmalloc(*ppos + count); | 339 | tbuf = vmalloc(*ppos + count); |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 56a3c82a5785..f17fcf89e18e 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -748,7 +748,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, | |||
748 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); | 748 | old_name = fsnotify_oldname_init(old_dentry->d_name.name); |
749 | 749 | ||
750 | error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir), | 750 | error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir), |
751 | dentry); | 751 | dentry, 0); |
752 | if (error) { | 752 | if (error) { |
753 | fsnotify_oldname_free(old_name); | 753 | fsnotify_oldname_free(old_name); |
754 | goto exit; | 754 | goto exit; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 9d153b6a1d72..fe83c1050048 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -577,7 +577,8 @@ out: | |||
577 | 577 | ||
578 | static int | 578 | static int |
579 | ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 579 | ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
580 | struct inode *new_dir, struct dentry *new_dentry) | 580 | struct inode *new_dir, struct dentry *new_dentry, |
581 | unsigned int flags) | ||
581 | { | 582 | { |
582 | int rc; | 583 | int rc; |
583 | struct dentry *lower_old_dentry; | 584 | struct dentry *lower_old_dentry; |
@@ -587,6 +588,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
587 | struct dentry *trap = NULL; | 588 | struct dentry *trap = NULL; |
588 | struct inode *target_inode; | 589 | struct inode *target_inode; |
589 | 590 | ||
591 | if (flags) | ||
592 | return -EINVAL; | ||
593 | |||
590 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); | 594 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); |
591 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); | 595 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); |
592 | dget(lower_old_dentry); | 596 | dget(lower_old_dentry); |
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index 80c8114d76a6..7295cd722770 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c | |||
@@ -227,7 +227,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, | 229 | static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, |
230 | struct inode *new_dir, struct dentry *new_dentry) | 230 | struct inode *new_dir, struct dentry *new_dentry, |
231 | unsigned int flags) | ||
231 | { | 232 | { |
232 | struct inode *old_inode = d_inode(old_dentry); | 233 | struct inode *old_inode = d_inode(old_dentry); |
233 | struct inode *new_inode = d_inode(new_dentry); | 234 | struct inode *new_inode = d_inode(new_dentry); |
@@ -237,6 +238,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
237 | struct exofs_dir_entry *old_de; | 238 | struct exofs_dir_entry *old_de; |
238 | int err = -ENOENT; | 239 | int err = -ENOENT; |
239 | 240 | ||
241 | if (flags & ~RENAME_NOREPLACE) | ||
242 | return -EINVAL; | ||
243 | |||
240 | old_de = exofs_find_entry(old_dir, old_dentry, &old_page); | 244 | old_de = exofs_find_entry(old_dir, old_dentry, &old_page); |
241 | if (!old_de) | 245 | if (!old_de) |
242 | goto out; | 246 | goto out; |
@@ -310,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = { | |||
310 | .mkdir = exofs_mkdir, | 314 | .mkdir = exofs_mkdir, |
311 | .rmdir = exofs_rmdir, | 315 | .rmdir = exofs_rmdir, |
312 | .mknod = exofs_mknod, | 316 | .mknod = exofs_mknod, |
313 | .rename = exofs_rename, | 317 | .rename = exofs_rename, |
314 | .setattr = exofs_setattr, | 318 | .setattr = exofs_setattr, |
315 | }; | 319 | }; |
316 | 320 | ||
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index edb7b8c116eb..7d66b2012e93 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -328,7 +328,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry) | |||
328 | } | 328 | } |
329 | 329 | ||
330 | static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | 330 | static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, |
331 | struct inode * new_dir, struct dentry * new_dentry ) | 331 | struct inode * new_dir, struct dentry * new_dentry, |
332 | unsigned int flags) | ||
332 | { | 333 | { |
333 | struct inode * old_inode = d_inode(old_dentry); | 334 | struct inode * old_inode = d_inode(old_dentry); |
334 | struct inode * new_inode = d_inode(new_dentry); | 335 | struct inode * new_inode = d_inode(new_dentry); |
@@ -338,6 +339,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
338 | struct ext2_dir_entry_2 * old_de; | 339 | struct ext2_dir_entry_2 * old_de; |
339 | int err; | 340 | int err; |
340 | 341 | ||
342 | if (flags & ~RENAME_NOREPLACE) | ||
343 | return -EINVAL; | ||
344 | |||
341 | err = dquot_initialize(old_dir); | 345 | err = dquot_initialize(old_dir); |
342 | if (err) | 346 | if (err) |
343 | goto out; | 347 | goto out; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 34c0142caf6a..0464e2c0d3fd 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -3880,7 +3880,7 @@ const struct inode_operations ext4_dir_inode_operations = { | |||
3880 | .rmdir = ext4_rmdir, | 3880 | .rmdir = ext4_rmdir, |
3881 | .mknod = ext4_mknod, | 3881 | .mknod = ext4_mknod, |
3882 | .tmpfile = ext4_tmpfile, | 3882 | .tmpfile = ext4_tmpfile, |
3883 | .rename2 = ext4_rename2, | 3883 | .rename = ext4_rename2, |
3884 | .setattr = ext4_setattr, | 3884 | .setattr = ext4_setattr, |
3885 | .setxattr = generic_setxattr, | 3885 | .setxattr = generic_setxattr, |
3886 | .getxattr = generic_getxattr, | 3886 | .getxattr = generic_getxattr, |
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index dfb622ad86dc..71e36a780c90 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -1093,7 +1093,7 @@ const struct inode_operations f2fs_dir_inode_operations = { | |||
1093 | .mkdir = f2fs_mkdir, | 1093 | .mkdir = f2fs_mkdir, |
1094 | .rmdir = f2fs_rmdir, | 1094 | .rmdir = f2fs_rmdir, |
1095 | .mknod = f2fs_mknod, | 1095 | .mknod = f2fs_mknod, |
1096 | .rename2 = f2fs_rename2, | 1096 | .rename = f2fs_rename2, |
1097 | .tmpfile = f2fs_tmpfile, | 1097 | .tmpfile = f2fs_tmpfile, |
1098 | .getattr = f2fs_getattr, | 1098 | .getattr = f2fs_getattr, |
1099 | .setattr = f2fs_setattr, | 1099 | .setattr = f2fs_setattr, |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index ccd9f83f9bb6..7d6a105d601b 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -596,12 +596,16 @@ error_inode: | |||
596 | 596 | ||
597 | /***** Rename, a wrapper for rename_same_dir & rename_diff_dir */ | 597 | /***** Rename, a wrapper for rename_same_dir & rename_diff_dir */ |
598 | static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, | 598 | static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, |
599 | struct inode *new_dir, struct dentry *new_dentry) | 599 | struct inode *new_dir, struct dentry *new_dentry, |
600 | unsigned int flags) | ||
600 | { | 601 | { |
601 | struct super_block *sb = old_dir->i_sb; | 602 | struct super_block *sb = old_dir->i_sb; |
602 | unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME]; | 603 | unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME]; |
603 | int err, is_hid; | 604 | int err, is_hid; |
604 | 605 | ||
606 | if (flags & ~RENAME_NOREPLACE) | ||
607 | return -EINVAL; | ||
608 | |||
605 | mutex_lock(&MSDOS_SB(sb)->s_lock); | 609 | mutex_lock(&MSDOS_SB(sb)->s_lock); |
606 | 610 | ||
607 | err = msdos_format_name(old_dentry->d_name.name, | 611 | err = msdos_format_name(old_dentry->d_name.name, |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index d4a1b2bfda64..bf46a2d7dc50 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -903,7 +903,8 @@ out: | |||
903 | } | 903 | } |
904 | 904 | ||
905 | static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, | 905 | static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, |
906 | struct inode *new_dir, struct dentry *new_dentry) | 906 | struct inode *new_dir, struct dentry *new_dentry, |
907 | unsigned int flags) | ||
907 | { | 908 | { |
908 | struct buffer_head *dotdot_bh; | 909 | struct buffer_head *dotdot_bh; |
909 | struct msdos_dir_entry *dotdot_de; | 910 | struct msdos_dir_entry *dotdot_de; |
@@ -914,6 +915,9 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
914 | int err, is_dir, update_dotdot, corrupt = 0; | 915 | int err, is_dir, update_dotdot, corrupt = 0; |
915 | struct super_block *sb = old_dir->i_sb; | 916 | struct super_block *sb = old_dir->i_sb; |
916 | 917 | ||
918 | if (flags & ~RENAME_NOREPLACE) | ||
919 | return -EINVAL; | ||
920 | |||
917 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; | 921 | old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; |
918 | old_inode = d_inode(old_dentry); | 922 | old_inode = d_inode(old_dentry); |
919 | new_inode = d_inode(new_dentry); | 923 | new_inode = d_inode(new_dentry); |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 8de80dc563c5..215b4beea2ef 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1876,7 +1876,7 @@ static const struct inode_operations fuse_dir_inode_operations = { | |||
1876 | .symlink = fuse_symlink, | 1876 | .symlink = fuse_symlink, |
1877 | .unlink = fuse_unlink, | 1877 | .unlink = fuse_unlink, |
1878 | .rmdir = fuse_rmdir, | 1878 | .rmdir = fuse_rmdir, |
1879 | .rename2 = fuse_rename2, | 1879 | .rename = fuse_rename2, |
1880 | .link = fuse_link, | 1880 | .link = fuse_link, |
1881 | .setattr = fuse_setattr, | 1881 | .setattr = fuse_setattr, |
1882 | .create = fuse_create, | 1882 | .create = fuse_create, |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index a197a219eed9..abc74e13502d 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -2054,7 +2054,7 @@ const struct inode_operations gfs2_dir_iops = { | |||
2054 | .mkdir = gfs2_mkdir, | 2054 | .mkdir = gfs2_mkdir, |
2055 | .rmdir = gfs2_unlink, | 2055 | .rmdir = gfs2_unlink, |
2056 | .mknod = gfs2_mknod, | 2056 | .mknod = gfs2_mknod, |
2057 | .rename2 = gfs2_rename2, | 2057 | .rename = gfs2_rename2, |
2058 | .permission = gfs2_permission, | 2058 | .permission = gfs2_permission, |
2059 | .setattr = gfs2_setattr, | 2059 | .setattr = gfs2_setattr, |
2060 | .getattr = gfs2_getattr, | 2060 | .getattr = gfs2_getattr, |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 4f379fb91691..5de5c48b418d 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -286,10 +286,14 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry) | |||
286 | * XXX: how do you handle must_be dir? | 286 | * XXX: how do you handle must_be dir? |
287 | */ | 287 | */ |
288 | static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 288 | static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
289 | struct inode *new_dir, struct dentry *new_dentry) | 289 | struct inode *new_dir, struct dentry *new_dentry, |
290 | unsigned int flags) | ||
290 | { | 291 | { |
291 | int res; | 292 | int res; |
292 | 293 | ||
294 | if (flags & ~RENAME_NOREPLACE) | ||
295 | return -EINVAL; | ||
296 | |||
293 | /* Unlink destination if it already exists */ | 297 | /* Unlink destination if it already exists */ |
294 | if (d_really_is_positive(new_dentry)) { | 298 | if (d_really_is_positive(new_dentry)) { |
295 | res = hfs_remove(new_dir, new_dentry); | 299 | res = hfs_remove(new_dir, new_dentry); |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 69c66c21113b..3cf088779589 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -530,10 +530,14 @@ static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
530 | } | 530 | } |
531 | 531 | ||
532 | static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, | 532 | static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, |
533 | struct inode *new_dir, struct dentry *new_dentry) | 533 | struct inode *new_dir, struct dentry *new_dentry, |
534 | unsigned int flags) | ||
534 | { | 535 | { |
535 | int res; | 536 | int res; |
536 | 537 | ||
538 | if (flags & ~RENAME_NOREPLACE) | ||
539 | return -EINVAL; | ||
540 | |||
537 | /* Unlink destination if it already exists */ | 541 | /* Unlink destination if it already exists */ |
538 | if (d_really_is_positive(new_dentry)) { | 542 | if (d_really_is_positive(new_dentry)) { |
539 | if (d_is_dir(new_dentry)) | 543 | if (d_is_dir(new_dentry)) |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 90e46cd752fe..530606169e49 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -885,7 +885,7 @@ static const struct inode_operations hostfs_dir_iops = { | |||
885 | .mkdir = hostfs_mkdir, | 885 | .mkdir = hostfs_mkdir, |
886 | .rmdir = hostfs_rmdir, | 886 | .rmdir = hostfs_rmdir, |
887 | .mknod = hostfs_mknod, | 887 | .mknod = hostfs_mknod, |
888 | .rename2 = hostfs_rename2, | 888 | .rename = hostfs_rename2, |
889 | .permission = hostfs_permission, | 889 | .permission = hostfs_permission, |
890 | .setattr = hostfs_setattr, | 890 | .setattr = hostfs_setattr, |
891 | }; | 891 | }; |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index bb8d67e2740a..f30c14414518 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -507,7 +507,8 @@ const struct address_space_operations hpfs_symlink_aops = { | |||
507 | }; | 507 | }; |
508 | 508 | ||
509 | static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 509 | static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
510 | struct inode *new_dir, struct dentry *new_dentry) | 510 | struct inode *new_dir, struct dentry *new_dentry, |
511 | unsigned int flags) | ||
511 | { | 512 | { |
512 | const unsigned char *old_name = old_dentry->d_name.name; | 513 | const unsigned char *old_name = old_dentry->d_name.name; |
513 | unsigned old_len = old_dentry->d_name.len; | 514 | unsigned old_len = old_dentry->d_name.len; |
@@ -524,6 +525,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
524 | struct fnode *fnode; | 525 | struct fnode *fnode; |
525 | int err; | 526 | int err; |
526 | 527 | ||
528 | if (flags & ~RENAME_NOREPLACE) | ||
529 | return -EINVAL; | ||
530 | |||
527 | if ((err = hpfs_chk_name(new_name, &new_len))) return err; | 531 | if ((err = hpfs_chk_name(new_name, &new_len))) return err; |
528 | err = 0; | 532 | err = 0; |
529 | hpfs_adjust_length(old_name, &old_len); | 533 | hpfs_adjust_length(old_name, &old_len); |
diff --git a/fs/ioctl.c b/fs/ioctl.c index 0f56deb24ce6..c415668c86d4 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -568,7 +568,7 @@ static int ioctl_fsthaw(struct file *filp) | |||
568 | return thaw_super(sb); | 568 | return thaw_super(sb); |
569 | } | 569 | } |
570 | 570 | ||
571 | static long ioctl_file_dedupe_range(struct file *file, void __user *arg) | 571 | static int ioctl_file_dedupe_range(struct file *file, void __user *arg) |
572 | { | 572 | { |
573 | struct file_dedupe_range __user *argp = arg; | 573 | struct file_dedupe_range __user *argp = arg; |
574 | struct file_dedupe_range *same = NULL; | 574 | struct file_dedupe_range *same = NULL; |
@@ -582,6 +582,10 @@ static long ioctl_file_dedupe_range(struct file *file, void __user *arg) | |||
582 | } | 582 | } |
583 | 583 | ||
584 | size = offsetof(struct file_dedupe_range __user, info[count]); | 584 | size = offsetof(struct file_dedupe_range __user, info[count]); |
585 | if (size > PAGE_SIZE) { | ||
586 | ret = -ENOMEM; | ||
587 | goto out; | ||
588 | } | ||
585 | 589 | ||
586 | same = memdup_user(argp, size); | 590 | same = memdup_user(argp, size); |
587 | if (IS_ERR(same)) { | 591 | if (IS_ERR(same)) { |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 30eb33ff8189..d957734a2adb 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -35,7 +35,8 @@ static int jffs2_mkdir (struct inode *,struct dentry *,umode_t); | |||
35 | static int jffs2_rmdir (struct inode *,struct dentry *); | 35 | static int jffs2_rmdir (struct inode *,struct dentry *); |
36 | static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); | 36 | static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); |
37 | static int jffs2_rename (struct inode *, struct dentry *, | 37 | static int jffs2_rename (struct inode *, struct dentry *, |
38 | struct inode *, struct dentry *); | 38 | struct inode *, struct dentry *, |
39 | unsigned int); | ||
39 | 40 | ||
40 | const struct file_operations jffs2_dir_operations = | 41 | const struct file_operations jffs2_dir_operations = |
41 | { | 42 | { |
@@ -759,7 +760,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode | |||
759 | } | 760 | } |
760 | 761 | ||
761 | static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | 762 | static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, |
762 | struct inode *new_dir_i, struct dentry *new_dentry) | 763 | struct inode *new_dir_i, struct dentry *new_dentry, |
764 | unsigned int flags) | ||
763 | { | 765 | { |
764 | int ret; | 766 | int ret; |
765 | struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); | 767 | struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); |
@@ -767,6 +769,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
767 | uint8_t type; | 769 | uint8_t type; |
768 | uint32_t now; | 770 | uint32_t now; |
769 | 771 | ||
772 | if (flags & ~RENAME_NOREPLACE) | ||
773 | return -EINVAL; | ||
774 | |||
770 | /* The VFS will check for us and prevent trying to rename a | 775 | /* The VFS will check for us and prevent trying to rename a |
771 | * file over a directory and vice versa, but if it's a directory, | 776 | * file over a directory and vice versa, but if it's a directory, |
772 | * the VFS can't check whether the victim is empty. The filesystem | 777 | * the VFS can't check whether the victim is empty. The filesystem |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 10449c1deac0..d1d7c43abb63 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -1078,7 +1078,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
1078 | * FUNCTION: rename a file or directory | 1078 | * FUNCTION: rename a file or directory |
1079 | */ | 1079 | */ |
1080 | static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 1080 | static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
1081 | struct inode *new_dir, struct dentry *new_dentry) | 1081 | struct inode *new_dir, struct dentry *new_dentry, |
1082 | unsigned int flags) | ||
1082 | { | 1083 | { |
1083 | struct btstack btstack; | 1084 | struct btstack btstack; |
1084 | ino_t ino; | 1085 | ino_t ino; |
@@ -1097,6 +1098,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1097 | s64 new_size = 0; | 1098 | s64 new_size = 0; |
1098 | int commit_flag; | 1099 | int commit_flag; |
1099 | 1100 | ||
1101 | if (flags & ~RENAME_NOREPLACE) | ||
1102 | return -EINVAL; | ||
1100 | 1103 | ||
1101 | jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); | 1104 | jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); |
1102 | 1105 | ||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index e57174d43683..390390212b43 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -1096,13 +1096,17 @@ static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry) | |||
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry, | 1098 | static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry, |
1099 | struct inode *new_dir, struct dentry *new_dentry) | 1099 | struct inode *new_dir, struct dentry *new_dentry, |
1100 | unsigned int flags) | ||
1100 | { | 1101 | { |
1101 | struct kernfs_node *kn = old_dentry->d_fsdata; | 1102 | struct kernfs_node *kn = old_dentry->d_fsdata; |
1102 | struct kernfs_node *new_parent = new_dir->i_private; | 1103 | struct kernfs_node *new_parent = new_dir->i_private; |
1103 | struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops; | 1104 | struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops; |
1104 | int ret; | 1105 | int ret; |
1105 | 1106 | ||
1107 | if (flags) | ||
1108 | return -EINVAL; | ||
1109 | |||
1106 | if (!scops || !scops->rename) | 1110 | if (!scops || !scops->rename) |
1107 | return -EPERM; | 1111 | return -EPERM; |
1108 | 1112 | ||
diff --git a/fs/libfs.c b/fs/libfs.c index cc9f7ef2a1ce..d8ee308de325 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -349,11 +349,15 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry) | |||
349 | EXPORT_SYMBOL(simple_rmdir); | 349 | EXPORT_SYMBOL(simple_rmdir); |
350 | 350 | ||
351 | int simple_rename(struct inode *old_dir, struct dentry *old_dentry, | 351 | int simple_rename(struct inode *old_dir, struct dentry *old_dentry, |
352 | struct inode *new_dir, struct dentry *new_dentry) | 352 | struct inode *new_dir, struct dentry *new_dentry, |
353 | unsigned int flags) | ||
353 | { | 354 | { |
354 | struct inode *inode = d_inode(old_dentry); | 355 | struct inode *inode = d_inode(old_dentry); |
355 | int they_are_dirs = d_is_dir(old_dentry); | 356 | int they_are_dirs = d_is_dir(old_dentry); |
356 | 357 | ||
358 | if (flags & ~RENAME_NOREPLACE) | ||
359 | return -EINVAL; | ||
360 | |||
357 | if (!simple_empty(new_dentry)) | 361 | if (!simple_empty(new_dentry)) |
358 | return -ENOTEMPTY; | 362 | return -ENOTEMPTY; |
359 | 363 | ||
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index a284dd8689a8..c87ea52de3d9 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c | |||
@@ -718,8 +718,12 @@ out: | |||
718 | } | 718 | } |
719 | 719 | ||
720 | static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 720 | static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
721 | struct inode *new_dir, struct dentry *new_dentry) | 721 | struct inode *new_dir, struct dentry *new_dentry, |
722 | unsigned int flags) | ||
722 | { | 723 | { |
724 | if (flags & ~RENAME_NOREPLACE) | ||
725 | return -EINVAL; | ||
726 | |||
723 | if (d_really_is_positive(new_dentry)) | 727 | if (d_really_is_positive(new_dentry)) |
724 | return logfs_rename_target(old_dir, old_dentry, | 728 | return logfs_rename_target(old_dir, old_dentry, |
725 | new_dir, new_dentry); | 729 | new_dir, new_dentry); |
diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 66ca51530278..1e0f11f5dac9 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c | |||
@@ -185,7 +185,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, | 187 | static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, |
188 | struct inode * new_dir, struct dentry *new_dentry) | 188 | struct inode * new_dir, struct dentry *new_dentry, |
189 | unsigned int flags) | ||
189 | { | 190 | { |
190 | struct inode * old_inode = d_inode(old_dentry); | 191 | struct inode * old_inode = d_inode(old_dentry); |
191 | struct inode * new_inode = d_inode(new_dentry); | 192 | struct inode * new_inode = d_inode(new_dentry); |
@@ -195,6 +196,9 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, | |||
195 | struct minix_dir_entry * old_de; | 196 | struct minix_dir_entry * old_de; |
196 | int err = -ENOENT; | 197 | int err = -ENOENT; |
197 | 198 | ||
199 | if (flags & ~RENAME_NOREPLACE) | ||
200 | return -EINVAL; | ||
201 | |||
198 | old_de = minix_find_entry(old_dentry, &old_page); | 202 | old_de = minix_find_entry(old_dentry, &old_page); |
199 | if (!old_de) | 203 | if (!old_de) |
200 | goto out; | 204 | goto out; |
diff --git a/fs/namei.c b/fs/namei.c index adb04146df09..cf3fc8db909c 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -4369,12 +4369,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
4369 | if (error) | 4369 | if (error) |
4370 | return error; | 4370 | return error; |
4371 | 4371 | ||
4372 | if (!old_dir->i_op->rename && !old_dir->i_op->rename2) | 4372 | if (!old_dir->i_op->rename) |
4373 | return -EPERM; | 4373 | return -EPERM; |
4374 | 4374 | ||
4375 | if (flags && !old_dir->i_op->rename2) | ||
4376 | return -EINVAL; | ||
4377 | |||
4378 | /* | 4375 | /* |
4379 | * If we are going to change the parent - check write permissions, | 4376 | * If we are going to change the parent - check write permissions, |
4380 | * we'll need to flip '..'. | 4377 | * we'll need to flip '..'. |
@@ -4428,14 +4425,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
4428 | if (error) | 4425 | if (error) |
4429 | goto out; | 4426 | goto out; |
4430 | } | 4427 | } |
4431 | if (!old_dir->i_op->rename2) { | 4428 | error = old_dir->i_op->rename(old_dir, old_dentry, |
4432 | error = old_dir->i_op->rename(old_dir, old_dentry, | 4429 | new_dir, new_dentry, flags); |
4433 | new_dir, new_dentry); | ||
4434 | } else { | ||
4435 | WARN_ON(old_dir->i_op->rename != NULL); | ||
4436 | error = old_dir->i_op->rename2(old_dir, old_dentry, | ||
4437 | new_dir, new_dentry, flags); | ||
4438 | } | ||
4439 | if (error) | 4430 | if (error) |
4440 | goto out; | 4431 | goto out; |
4441 | 4432 | ||
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 17de5c13dfae..6df2a3827574 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -36,7 +36,7 @@ static int ncp_unlink(struct inode *, struct dentry *); | |||
36 | static int ncp_mkdir(struct inode *, struct dentry *, umode_t); | 36 | static int ncp_mkdir(struct inode *, struct dentry *, umode_t); |
37 | static int ncp_rmdir(struct inode *, struct dentry *); | 37 | static int ncp_rmdir(struct inode *, struct dentry *); |
38 | static int ncp_rename(struct inode *, struct dentry *, | 38 | static int ncp_rename(struct inode *, struct dentry *, |
39 | struct inode *, struct dentry *); | 39 | struct inode *, struct dentry *, unsigned int); |
40 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, | 40 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, |
41 | umode_t mode, dev_t rdev); | 41 | umode_t mode, dev_t rdev); |
42 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) | 42 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) |
@@ -133,12 +133,11 @@ ncp_hash_dentry(const struct dentry *dentry, struct qstr *this) | |||
133 | return 0; | 133 | return 0; |
134 | 134 | ||
135 | if (!ncp_case_sensitive(inode)) { | 135 | if (!ncp_case_sensitive(inode)) { |
136 | struct super_block *sb = dentry->d_sb; | ||
137 | struct nls_table *t; | 136 | struct nls_table *t; |
138 | unsigned long hash; | 137 | unsigned long hash; |
139 | int i; | 138 | int i; |
140 | 139 | ||
141 | t = NCP_IO_TABLE(sb); | 140 | t = NCP_IO_TABLE(dentry->d_sb); |
142 | hash = init_name_hash(dentry); | 141 | hash = init_name_hash(dentry); |
143 | for (i=0; i<this->len ; i++) | 142 | for (i=0; i<this->len ; i++) |
144 | hash = partial_name_hash(ncp_tolower(t, this->name[i]), | 143 | hash = partial_name_hash(ncp_tolower(t, this->name[i]), |
@@ -1106,13 +1105,17 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry) | |||
1106 | } | 1105 | } |
1107 | 1106 | ||
1108 | static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, | 1107 | static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, |
1109 | struct inode *new_dir, struct dentry *new_dentry) | 1108 | struct inode *new_dir, struct dentry *new_dentry, |
1109 | unsigned int flags) | ||
1110 | { | 1110 | { |
1111 | struct ncp_server *server = NCP_SERVER(old_dir); | 1111 | struct ncp_server *server = NCP_SERVER(old_dir); |
1112 | int error; | 1112 | int error; |
1113 | int old_len, new_len; | 1113 | int old_len, new_len; |
1114 | __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; | 1114 | __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; |
1115 | 1115 | ||
1116 | if (flags) | ||
1117 | return -EINVAL; | ||
1118 | |||
1116 | ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry); | 1119 | ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry); |
1117 | 1120 | ||
1118 | ncp_age_dentry(server, old_dentry); | 1121 | ncp_age_dentry(server, old_dentry); |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 177fefb26c18..06e0bf092ba9 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -2013,7 +2013,8 @@ EXPORT_SYMBOL_GPL(nfs_link); | |||
2013 | * the rename. | 2013 | * the rename. |
2014 | */ | 2014 | */ |
2015 | int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 2015 | int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
2016 | struct inode *new_dir, struct dentry *new_dentry) | 2016 | struct inode *new_dir, struct dentry *new_dentry, |
2017 | unsigned int flags) | ||
2017 | { | 2018 | { |
2018 | struct inode *old_inode = d_inode(old_dentry); | 2019 | struct inode *old_inode = d_inode(old_dentry); |
2019 | struct inode *new_inode = d_inode(new_dentry); | 2020 | struct inode *new_inode = d_inode(new_dentry); |
@@ -2021,6 +2022,9 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
2021 | struct rpc_task *task; | 2022 | struct rpc_task *task; |
2022 | int error = -EBUSY; | 2023 | int error = -EBUSY; |
2023 | 2024 | ||
2025 | if (flags) | ||
2026 | return -EINVAL; | ||
2027 | |||
2024 | dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n", | 2028 | dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n", |
2025 | old_dentry, new_dentry, | 2029 | old_dentry, new_dentry, |
2026 | d_count(new_dentry)); | 2030 | d_count(new_dentry)); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 7d620970f2e1..ca699ddc11c1 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -657,7 +657,10 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from) | |||
657 | if (result <= 0) | 657 | if (result <= 0) |
658 | goto out; | 658 | goto out; |
659 | 659 | ||
660 | written = generic_write_sync(iocb, result); | 660 | result = generic_write_sync(iocb, result); |
661 | if (result < 0) | ||
662 | goto out; | ||
663 | written = result; | ||
661 | iocb->ki_pos += written; | 664 | iocb->ki_pos += written; |
662 | 665 | ||
663 | /* Return error values */ | 666 | /* Return error values */ |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 74935a19e4bf..48d1adfe25d6 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -359,7 +359,8 @@ int nfs_unlink(struct inode *, struct dentry *); | |||
359 | int nfs_symlink(struct inode *, struct dentry *, const char *); | 359 | int nfs_symlink(struct inode *, struct dentry *, const char *); |
360 | int nfs_link(struct dentry *, struct inode *, struct dentry *); | 360 | int nfs_link(struct dentry *, struct inode *, struct dentry *); |
361 | int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); | 361 | int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); |
362 | int nfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | 362 | int nfs_rename(struct inode *, struct dentry *, |
363 | struct inode *, struct dentry *, unsigned int); | ||
363 | 364 | ||
364 | /* file.c */ | 365 | /* file.c */ |
365 | int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); | 366 | int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f5aecaabcb7c..a9dec32ba9ba 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -7570,12 +7570,20 @@ static int _nfs4_proc_create_session(struct nfs_client *clp, | |||
7570 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 7570 | status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); |
7571 | trace_nfs4_create_session(clp, status); | 7571 | trace_nfs4_create_session(clp, status); |
7572 | 7572 | ||
7573 | switch (status) { | ||
7574 | case -NFS4ERR_STALE_CLIENTID: | ||
7575 | case -NFS4ERR_DELAY: | ||
7576 | case -ETIMEDOUT: | ||
7577 | case -EACCES: | ||
7578 | case -EAGAIN: | ||
7579 | goto out; | ||
7580 | }; | ||
7581 | |||
7582 | clp->cl_seqid++; | ||
7573 | if (!status) { | 7583 | if (!status) { |
7574 | /* Verify the session's negotiated channel_attrs values */ | 7584 | /* Verify the session's negotiated channel_attrs values */ |
7575 | status = nfs4_verify_channel_attrs(&args, &res); | 7585 | status = nfs4_verify_channel_attrs(&args, &res); |
7576 | /* Increment the clientid slot sequence id */ | 7586 | /* Increment the clientid slot sequence id */ |
7577 | if (clp->cl_seqid == res.seqid) | ||
7578 | clp->cl_seqid++; | ||
7579 | if (status) | 7587 | if (status) |
7580 | goto out; | 7588 | goto out; |
7581 | nfs4_update_session(session, &res); | 7589 | nfs4_update_session(session, &res); |
@@ -8190,10 +8198,13 @@ static void nfs4_layoutreturn_release(void *calldata) | |||
8190 | 8198 | ||
8191 | dprintk("--> %s\n", __func__); | 8199 | dprintk("--> %s\n", __func__); |
8192 | spin_lock(&lo->plh_inode->i_lock); | 8200 | spin_lock(&lo->plh_inode->i_lock); |
8193 | pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range, | 8201 | if (lrp->res.lrs_present) { |
8194 | be32_to_cpu(lrp->args.stateid.seqid)); | 8202 | pnfs_mark_matching_lsegs_invalid(lo, &freeme, |
8195 | if (lrp->res.lrs_present && pnfs_layout_is_valid(lo)) | 8203 | &lrp->args.range, |
8204 | be32_to_cpu(lrp->args.stateid.seqid)); | ||
8196 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); | 8205 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); |
8206 | } else | ||
8207 | pnfs_mark_layout_stateid_invalid(lo, &freeme); | ||
8197 | pnfs_clear_layoutreturn_waitbit(lo); | 8208 | pnfs_clear_layoutreturn_waitbit(lo); |
8198 | spin_unlock(&lo->plh_inode->i_lock); | 8209 | spin_unlock(&lo->plh_inode->i_lock); |
8199 | nfs4_sequence_free_slot(&lrp->res.seq_res); | 8210 | nfs4_sequence_free_slot(&lrp->res.seq_res); |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6daf034645c8..2c93a85eda51 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -365,7 +365,8 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo, | |||
365 | /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ | 365 | /* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */ |
366 | atomic_dec(&lo->plh_refcount); | 366 | atomic_dec(&lo->plh_refcount); |
367 | if (list_empty(&lo->plh_segs)) { | 367 | if (list_empty(&lo->plh_segs)) { |
368 | set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | 368 | if (atomic_read(&lo->plh_outstanding) == 0) |
369 | set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
369 | clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); | 370 | clear_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags); |
370 | } | 371 | } |
371 | rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); | 372 | rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); |
@@ -768,17 +769,32 @@ pnfs_destroy_all_layouts(struct nfs_client *clp) | |||
768 | pnfs_destroy_layouts_byclid(clp, false); | 769 | pnfs_destroy_layouts_byclid(clp, false); |
769 | } | 770 | } |
770 | 771 | ||
772 | static void | ||
773 | pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) | ||
774 | { | ||
775 | lo->plh_return_iomode = 0; | ||
776 | lo->plh_return_seq = 0; | ||
777 | clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); | ||
778 | } | ||
779 | |||
771 | /* update lo->plh_stateid with new if is more recent */ | 780 | /* update lo->plh_stateid with new if is more recent */ |
772 | void | 781 | void |
773 | pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, | 782 | pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, |
774 | bool update_barrier) | 783 | bool update_barrier) |
775 | { | 784 | { |
776 | u32 oldseq, newseq, new_barrier = 0; | 785 | u32 oldseq, newseq, new_barrier = 0; |
777 | bool invalid = !pnfs_layout_is_valid(lo); | ||
778 | 786 | ||
779 | oldseq = be32_to_cpu(lo->plh_stateid.seqid); | 787 | oldseq = be32_to_cpu(lo->plh_stateid.seqid); |
780 | newseq = be32_to_cpu(new->seqid); | 788 | newseq = be32_to_cpu(new->seqid); |
781 | if (invalid || pnfs_seqid_is_newer(newseq, oldseq)) { | 789 | |
790 | if (!pnfs_layout_is_valid(lo)) { | ||
791 | nfs4_stateid_copy(&lo->plh_stateid, new); | ||
792 | lo->plh_barrier = newseq; | ||
793 | pnfs_clear_layoutreturn_info(lo); | ||
794 | clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
795 | return; | ||
796 | } | ||
797 | if (pnfs_seqid_is_newer(newseq, oldseq)) { | ||
782 | nfs4_stateid_copy(&lo->plh_stateid, new); | 798 | nfs4_stateid_copy(&lo->plh_stateid, new); |
783 | /* | 799 | /* |
784 | * Because of wraparound, we want to keep the barrier | 800 | * Because of wraparound, we want to keep the barrier |
@@ -790,7 +806,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, | |||
790 | new_barrier = be32_to_cpu(new->seqid); | 806 | new_barrier = be32_to_cpu(new->seqid); |
791 | else if (new_barrier == 0) | 807 | else if (new_barrier == 0) |
792 | return; | 808 | return; |
793 | if (invalid || pnfs_seqid_is_newer(new_barrier, lo->plh_barrier)) | 809 | if (pnfs_seqid_is_newer(new_barrier, lo->plh_barrier)) |
794 | lo->plh_barrier = new_barrier; | 810 | lo->plh_barrier = new_barrier; |
795 | } | 811 | } |
796 | 812 | ||
@@ -886,19 +902,14 @@ void pnfs_clear_layoutreturn_waitbit(struct pnfs_layout_hdr *lo) | |||
886 | rpc_wake_up(&NFS_SERVER(lo->plh_inode)->roc_rpcwaitq); | 902 | rpc_wake_up(&NFS_SERVER(lo->plh_inode)->roc_rpcwaitq); |
887 | } | 903 | } |
888 | 904 | ||
889 | static void | ||
890 | pnfs_clear_layoutreturn_info(struct pnfs_layout_hdr *lo) | ||
891 | { | ||
892 | lo->plh_return_iomode = 0; | ||
893 | lo->plh_return_seq = 0; | ||
894 | clear_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags); | ||
895 | } | ||
896 | |||
897 | static bool | 905 | static bool |
898 | pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo, | 906 | pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo, |
899 | nfs4_stateid *stateid, | 907 | nfs4_stateid *stateid, |
900 | enum pnfs_iomode *iomode) | 908 | enum pnfs_iomode *iomode) |
901 | { | 909 | { |
910 | /* Serialise LAYOUTGET/LAYOUTRETURN */ | ||
911 | if (atomic_read(&lo->plh_outstanding) != 0) | ||
912 | return false; | ||
902 | if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) | 913 | if (test_and_set_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) |
903 | return false; | 914 | return false; |
904 | pnfs_get_layout_hdr(lo); | 915 | pnfs_get_layout_hdr(lo); |
@@ -1798,16 +1809,11 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) | |||
1798 | */ | 1809 | */ |
1799 | pnfs_mark_layout_stateid_invalid(lo, &free_me); | 1810 | pnfs_mark_layout_stateid_invalid(lo, &free_me); |
1800 | 1811 | ||
1801 | nfs4_stateid_copy(&lo->plh_stateid, &res->stateid); | 1812 | pnfs_set_layout_stateid(lo, &res->stateid, true); |
1802 | lo->plh_barrier = be32_to_cpu(res->stateid.seqid); | ||
1803 | } | 1813 | } |
1804 | 1814 | ||
1805 | pnfs_get_lseg(lseg); | 1815 | pnfs_get_lseg(lseg); |
1806 | pnfs_layout_insert_lseg(lo, lseg, &free_me); | 1816 | pnfs_layout_insert_lseg(lo, lseg, &free_me); |
1807 | if (!pnfs_layout_is_valid(lo)) { | ||
1808 | pnfs_clear_layoutreturn_info(lo); | ||
1809 | clear_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
1810 | } | ||
1811 | 1817 | ||
1812 | 1818 | ||
1813 | if (res->return_on_close) | 1819 | if (res->return_on_close) |
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index ace5ebf3b2a8..2b71c60fe982 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -350,7 +350,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
350 | } | 350 | } |
351 | 351 | ||
352 | static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 352 | static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
353 | struct inode *new_dir, struct dentry *new_dentry) | 353 | struct inode *new_dir, struct dentry *new_dentry, |
354 | unsigned int flags) | ||
354 | { | 355 | { |
355 | struct inode *old_inode = d_inode(old_dentry); | 356 | struct inode *old_inode = d_inode(old_dentry); |
356 | struct inode *new_inode = d_inode(new_dentry); | 357 | struct inode *new_inode = d_inode(new_dentry); |
@@ -361,6 +362,9 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
361 | struct nilfs_transaction_info ti; | 362 | struct nilfs_transaction_info ti; |
362 | int err; | 363 | int err; |
363 | 364 | ||
365 | if (flags & ~RENAME_NOREPLACE) | ||
366 | return -EINVAL; | ||
367 | |||
364 | err = nilfs_transaction_begin(old_dir->i_sb, &ti, 1); | 368 | err = nilfs_transaction_begin(old_dir->i_sb, &ti, 1); |
365 | if (unlikely(err)) | 369 | if (unlikely(err)) |
366 | return err; | 370 | return err; |
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index d2f97ecca6a5..e0e5f7c3c99f 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -67,18 +67,7 @@ static int fanotify_get_response(struct fsnotify_group *group, | |||
67 | 67 | ||
68 | pr_debug("%s: group=%p event=%p\n", __func__, group, event); | 68 | pr_debug("%s: group=%p event=%p\n", __func__, group, event); |
69 | 69 | ||
70 | wait_event(group->fanotify_data.access_waitq, event->response || | 70 | wait_event(group->fanotify_data.access_waitq, event->response); |
71 | atomic_read(&group->fanotify_data.bypass_perm)); | ||
72 | |||
73 | if (!event->response) { /* bypass_perm set */ | ||
74 | /* | ||
75 | * Event was canceled because group is being destroyed. Remove | ||
76 | * it from group's event list because we are responsible for | ||
77 | * freeing the permission event. | ||
78 | */ | ||
79 | fsnotify_remove_event(group, &event->fae.fse); | ||
80 | return 0; | ||
81 | } | ||
82 | 71 | ||
83 | /* userspace responded, convert to something usable */ | 72 | /* userspace responded, convert to something usable */ |
84 | switch (event->response) { | 73 | switch (event->response) { |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 8e8e6bcd1d43..a64313868d3a 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -358,16 +358,20 @@ static int fanotify_release(struct inode *ignored, struct file *file) | |||
358 | 358 | ||
359 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 359 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
360 | struct fanotify_perm_event_info *event, *next; | 360 | struct fanotify_perm_event_info *event, *next; |
361 | struct fsnotify_event *fsn_event; | ||
361 | 362 | ||
362 | /* | 363 | /* |
363 | * There may be still new events arriving in the notification queue | 364 | * Stop new events from arriving in the notification queue. since |
364 | * but since userspace cannot use fanotify fd anymore, no event can | 365 | * userspace cannot use fanotify fd anymore, no event can enter or |
365 | * enter or leave access_list by now. | 366 | * leave access_list by now either. |
366 | */ | 367 | */ |
367 | spin_lock(&group->fanotify_data.access_lock); | 368 | fsnotify_group_stop_queueing(group); |
368 | |||
369 | atomic_inc(&group->fanotify_data.bypass_perm); | ||
370 | 369 | ||
370 | /* | ||
371 | * Process all permission events on access_list and notification queue | ||
372 | * and simulate reply from userspace. | ||
373 | */ | ||
374 | spin_lock(&group->fanotify_data.access_lock); | ||
371 | list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, | 375 | list_for_each_entry_safe(event, next, &group->fanotify_data.access_list, |
372 | fae.fse.list) { | 376 | fae.fse.list) { |
373 | pr_debug("%s: found group=%p event=%p\n", __func__, group, | 377 | pr_debug("%s: found group=%p event=%p\n", __func__, group, |
@@ -379,12 +383,21 @@ static int fanotify_release(struct inode *ignored, struct file *file) | |||
379 | spin_unlock(&group->fanotify_data.access_lock); | 383 | spin_unlock(&group->fanotify_data.access_lock); |
380 | 384 | ||
381 | /* | 385 | /* |
382 | * Since bypass_perm is set, newly queued events will not wait for | 386 | * Destroy all non-permission events. For permission events just |
383 | * access response. Wake up the already sleeping ones now. | 387 | * dequeue them and set the response. They will be freed once the |
384 | * synchronize_srcu() in fsnotify_destroy_group() will wait for all | 388 | * response is consumed and fanotify_get_response() returns. |
385 | * processes sleeping in fanotify_handle_event() waiting for access | ||
386 | * response and thus also for all permission events to be freed. | ||
387 | */ | 389 | */ |
390 | mutex_lock(&group->notification_mutex); | ||
391 | while (!fsnotify_notify_queue_is_empty(group)) { | ||
392 | fsn_event = fsnotify_remove_first_event(group); | ||
393 | if (!(fsn_event->mask & FAN_ALL_PERM_EVENTS)) | ||
394 | fsnotify_destroy_event(group, fsn_event); | ||
395 | else | ||
396 | FANOTIFY_PE(fsn_event)->response = FAN_ALLOW; | ||
397 | } | ||
398 | mutex_unlock(&group->notification_mutex); | ||
399 | |||
400 | /* Response for all permission events it set, wakeup waiters */ | ||
388 | wake_up(&group->fanotify_data.access_waitq); | 401 | wake_up(&group->fanotify_data.access_waitq); |
389 | #endif | 402 | #endif |
390 | 403 | ||
@@ -755,7 +768,6 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
755 | spin_lock_init(&group->fanotify_data.access_lock); | 768 | spin_lock_init(&group->fanotify_data.access_lock); |
756 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 769 | init_waitqueue_head(&group->fanotify_data.access_waitq); |
757 | INIT_LIST_HEAD(&group->fanotify_data.access_list); | 770 | INIT_LIST_HEAD(&group->fanotify_data.access_list); |
758 | atomic_set(&group->fanotify_data.bypass_perm, 0); | ||
759 | #endif | 771 | #endif |
760 | switch (flags & FAN_ALL_CLASS_BITS) { | 772 | switch (flags & FAN_ALL_CLASS_BITS) { |
761 | case FAN_CLASS_NOTIF: | 773 | case FAN_CLASS_NOTIF: |
diff --git a/fs/notify/group.c b/fs/notify/group.c index 3e2dd85be5dd..b47f7cfdcaa4 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -40,6 +40,17 @@ static void fsnotify_final_destroy_group(struct fsnotify_group *group) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * Stop queueing new events for this group. Once this function returns | ||
44 | * fsnotify_add_event() will not add any new events to the group's queue. | ||
45 | */ | ||
46 | void fsnotify_group_stop_queueing(struct fsnotify_group *group) | ||
47 | { | ||
48 | mutex_lock(&group->notification_mutex); | ||
49 | group->shutdown = true; | ||
50 | mutex_unlock(&group->notification_mutex); | ||
51 | } | ||
52 | |||
53 | /* | ||
43 | * Trying to get rid of a group. Remove all marks, flush all events and release | 54 | * Trying to get rid of a group. Remove all marks, flush all events and release |
44 | * the group reference. | 55 | * the group reference. |
45 | * Note that another thread calling fsnotify_clear_marks_by_group() may still | 56 | * Note that another thread calling fsnotify_clear_marks_by_group() may still |
@@ -47,6 +58,14 @@ static void fsnotify_final_destroy_group(struct fsnotify_group *group) | |||
47 | */ | 58 | */ |
48 | void fsnotify_destroy_group(struct fsnotify_group *group) | 59 | void fsnotify_destroy_group(struct fsnotify_group *group) |
49 | { | 60 | { |
61 | /* | ||
62 | * Stop queueing new events. The code below is careful enough to not | ||
63 | * require this but fanotify needs to stop queuing events even before | ||
64 | * fsnotify_destroy_group() is called and this makes the other callers | ||
65 | * of fsnotify_destroy_group() to see the same behavior. | ||
66 | */ | ||
67 | fsnotify_group_stop_queueing(group); | ||
68 | |||
50 | /* clear all inode marks for this group, attach them to destroy_list */ | 69 | /* clear all inode marks for this group, attach them to destroy_list */ |
51 | fsnotify_detach_group_marks(group); | 70 | fsnotify_detach_group_marks(group); |
52 | 71 | ||
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index a95d8e037aeb..e455e83ceeeb 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -82,7 +82,8 @@ void fsnotify_destroy_event(struct fsnotify_group *group, | |||
82 | * Add an event to the group notification queue. The group can later pull this | 82 | * Add an event to the group notification queue. The group can later pull this |
83 | * event off the queue to deal with. The function returns 0 if the event was | 83 | * event off the queue to deal with. The function returns 0 if the event was |
84 | * added to the queue, 1 if the event was merged with some other queued event, | 84 | * added to the queue, 1 if the event was merged with some other queued event, |
85 | * 2 if the queue of events has overflown. | 85 | * 2 if the event was not queued - either the queue of events has overflown |
86 | * or the group is shutting down. | ||
86 | */ | 87 | */ |
87 | int fsnotify_add_event(struct fsnotify_group *group, | 88 | int fsnotify_add_event(struct fsnotify_group *group, |
88 | struct fsnotify_event *event, | 89 | struct fsnotify_event *event, |
@@ -96,6 +97,11 @@ int fsnotify_add_event(struct fsnotify_group *group, | |||
96 | 97 | ||
97 | mutex_lock(&group->notification_mutex); | 98 | mutex_lock(&group->notification_mutex); |
98 | 99 | ||
100 | if (group->shutdown) { | ||
101 | mutex_unlock(&group->notification_mutex); | ||
102 | return 2; | ||
103 | } | ||
104 | |||
99 | if (group->q_len >= group->max_events) { | 105 | if (group->q_len >= group->max_events) { |
100 | ret = 2; | 106 | ret = 2; |
101 | /* Queue overflow event only if it isn't already queued */ | 107 | /* Queue overflow event only if it isn't already queued */ |
@@ -126,21 +132,6 @@ queue: | |||
126 | } | 132 | } |
127 | 133 | ||
128 | /* | 134 | /* |
129 | * Remove @event from group's notification queue. It is the responsibility of | ||
130 | * the caller to destroy the event. | ||
131 | */ | ||
132 | void fsnotify_remove_event(struct fsnotify_group *group, | ||
133 | struct fsnotify_event *event) | ||
134 | { | ||
135 | mutex_lock(&group->notification_mutex); | ||
136 | if (!list_empty(&event->list)) { | ||
137 | list_del_init(&event->list); | ||
138 | group->q_len--; | ||
139 | } | ||
140 | mutex_unlock(&group->notification_mutex); | ||
141 | } | ||
142 | |||
143 | /* | ||
144 | * Remove and return the first event from the notification list. It is the | 135 | * Remove and return the first event from the notification list. It is the |
145 | * responsibility of the caller to destroy the obtained event | 136 | * responsibility of the caller to destroy the obtained event |
146 | */ | 137 | */ |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 498e71141b53..f72712f6c28d 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -5922,7 +5922,6 @@ bail: | |||
5922 | } | 5922 | } |
5923 | 5923 | ||
5924 | static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | 5924 | static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, |
5925 | handle_t *handle, | ||
5926 | struct inode *data_alloc_inode, | 5925 | struct inode *data_alloc_inode, |
5927 | struct buffer_head *data_alloc_bh) | 5926 | struct buffer_head *data_alloc_bh) |
5928 | { | 5927 | { |
@@ -5935,11 +5934,19 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5935 | struct ocfs2_truncate_log *tl; | 5934 | struct ocfs2_truncate_log *tl; |
5936 | struct inode *tl_inode = osb->osb_tl_inode; | 5935 | struct inode *tl_inode = osb->osb_tl_inode; |
5937 | struct buffer_head *tl_bh = osb->osb_tl_bh; | 5936 | struct buffer_head *tl_bh = osb->osb_tl_bh; |
5937 | handle_t *handle; | ||
5938 | 5938 | ||
5939 | di = (struct ocfs2_dinode *) tl_bh->b_data; | 5939 | di = (struct ocfs2_dinode *) tl_bh->b_data; |
5940 | tl = &di->id2.i_dealloc; | 5940 | tl = &di->id2.i_dealloc; |
5941 | i = le16_to_cpu(tl->tl_used) - 1; | 5941 | i = le16_to_cpu(tl->tl_used) - 1; |
5942 | while (i >= 0) { | 5942 | while (i >= 0) { |
5943 | handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); | ||
5944 | if (IS_ERR(handle)) { | ||
5945 | status = PTR_ERR(handle); | ||
5946 | mlog_errno(status); | ||
5947 | goto bail; | ||
5948 | } | ||
5949 | |||
5943 | /* Caller has given us at least enough credits to | 5950 | /* Caller has given us at least enough credits to |
5944 | * update the truncate log dinode */ | 5951 | * update the truncate log dinode */ |
5945 | status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh, | 5952 | status = ocfs2_journal_access_di(handle, INODE_CACHE(tl_inode), tl_bh, |
@@ -5974,12 +5981,7 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5974 | } | 5981 | } |
5975 | } | 5982 | } |
5976 | 5983 | ||
5977 | status = ocfs2_extend_trans(handle, | 5984 | ocfs2_commit_trans(osb, handle); |
5978 | OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); | ||
5979 | if (status < 0) { | ||
5980 | mlog_errno(status); | ||
5981 | goto bail; | ||
5982 | } | ||
5983 | i--; | 5985 | i--; |
5984 | } | 5986 | } |
5985 | 5987 | ||
@@ -5994,7 +5996,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
5994 | { | 5996 | { |
5995 | int status; | 5997 | int status; |
5996 | unsigned int num_to_flush; | 5998 | unsigned int num_to_flush; |
5997 | handle_t *handle; | ||
5998 | struct inode *tl_inode = osb->osb_tl_inode; | 5999 | struct inode *tl_inode = osb->osb_tl_inode; |
5999 | struct inode *data_alloc_inode = NULL; | 6000 | struct inode *data_alloc_inode = NULL; |
6000 | struct buffer_head *tl_bh = osb->osb_tl_bh; | 6001 | struct buffer_head *tl_bh = osb->osb_tl_bh; |
@@ -6038,21 +6039,11 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
6038 | goto out_mutex; | 6039 | goto out_mutex; |
6039 | } | 6040 | } |
6040 | 6041 | ||
6041 | handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC); | 6042 | status = ocfs2_replay_truncate_records(osb, data_alloc_inode, |
6042 | if (IS_ERR(handle)) { | ||
6043 | status = PTR_ERR(handle); | ||
6044 | mlog_errno(status); | ||
6045 | goto out_unlock; | ||
6046 | } | ||
6047 | |||
6048 | status = ocfs2_replay_truncate_records(osb, handle, data_alloc_inode, | ||
6049 | data_alloc_bh); | 6043 | data_alloc_bh); |
6050 | if (status < 0) | 6044 | if (status < 0) |
6051 | mlog_errno(status); | 6045 | mlog_errno(status); |
6052 | 6046 | ||
6053 | ocfs2_commit_trans(osb, handle); | ||
6054 | |||
6055 | out_unlock: | ||
6056 | brelse(data_alloc_bh); | 6047 | brelse(data_alloc_bh); |
6057 | ocfs2_inode_unlock(data_alloc_inode, 1); | 6048 | ocfs2_inode_unlock(data_alloc_inode, 1); |
6058 | 6049 | ||
@@ -6413,43 +6404,34 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, | |||
6413 | goto out_mutex; | 6404 | goto out_mutex; |
6414 | } | 6405 | } |
6415 | 6406 | ||
6416 | handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); | ||
6417 | if (IS_ERR(handle)) { | ||
6418 | ret = PTR_ERR(handle); | ||
6419 | mlog_errno(ret); | ||
6420 | goto out_unlock; | ||
6421 | } | ||
6422 | |||
6423 | while (head) { | 6407 | while (head) { |
6424 | if (head->free_bg) | 6408 | if (head->free_bg) |
6425 | bg_blkno = head->free_bg; | 6409 | bg_blkno = head->free_bg; |
6426 | else | 6410 | else |
6427 | bg_blkno = ocfs2_which_suballoc_group(head->free_blk, | 6411 | bg_blkno = ocfs2_which_suballoc_group(head->free_blk, |
6428 | head->free_bit); | 6412 | head->free_bit); |
6413 | handle = ocfs2_start_trans(osb, OCFS2_SUBALLOC_FREE); | ||
6414 | if (IS_ERR(handle)) { | ||
6415 | ret = PTR_ERR(handle); | ||
6416 | mlog_errno(ret); | ||
6417 | goto out_unlock; | ||
6418 | } | ||
6419 | |||
6429 | trace_ocfs2_free_cached_blocks( | 6420 | trace_ocfs2_free_cached_blocks( |
6430 | (unsigned long long)head->free_blk, head->free_bit); | 6421 | (unsigned long long)head->free_blk, head->free_bit); |
6431 | 6422 | ||
6432 | ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, | 6423 | ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, |
6433 | head->free_bit, bg_blkno, 1); | 6424 | head->free_bit, bg_blkno, 1); |
6434 | if (ret) { | 6425 | if (ret) |
6435 | mlog_errno(ret); | 6426 | mlog_errno(ret); |
6436 | goto out_journal; | ||
6437 | } | ||
6438 | 6427 | ||
6439 | ret = ocfs2_extend_trans(handle, OCFS2_SUBALLOC_FREE); | 6428 | ocfs2_commit_trans(osb, handle); |
6440 | if (ret) { | ||
6441 | mlog_errno(ret); | ||
6442 | goto out_journal; | ||
6443 | } | ||
6444 | 6429 | ||
6445 | tmp = head; | 6430 | tmp = head; |
6446 | head = head->free_next; | 6431 | head = head->free_next; |
6447 | kfree(tmp); | 6432 | kfree(tmp); |
6448 | } | 6433 | } |
6449 | 6434 | ||
6450 | out_journal: | ||
6451 | ocfs2_commit_trans(osb, handle); | ||
6452 | |||
6453 | out_unlock: | 6435 | out_unlock: |
6454 | ocfs2_inode_unlock(inode, 1); | 6436 | ocfs2_inode_unlock(inode, 1); |
6455 | brelse(di_bh); | 6437 | brelse(di_bh); |
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index 94b18369b1cc..b95e7df5b76a 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -44,9 +44,6 @@ | |||
44 | * version here in tcp_internal.h should not need to be bumped for | 44 | * version here in tcp_internal.h should not need to be bumped for |
45 | * filesystem locking changes. | 45 | * filesystem locking changes. |
46 | * | 46 | * |
47 | * New in version 12 | ||
48 | * - Negotiate hb timeout when storage is down. | ||
49 | * | ||
50 | * New in version 11 | 47 | * New in version 11 |
51 | * - Negotiation of filesystem locking in the dlm join. | 48 | * - Negotiation of filesystem locking in the dlm join. |
52 | * | 49 | * |
@@ -78,7 +75,7 @@ | |||
78 | * - full 64 bit i_size in the metadata lock lvbs | 75 | * - full 64 bit i_size in the metadata lock lvbs |
79 | * - introduction of "rw" lock and pushing meta/data locking down | 76 | * - introduction of "rw" lock and pushing meta/data locking down |
80 | */ | 77 | */ |
81 | #define O2NET_PROTOCOL_VERSION 12ULL | 78 | #define O2NET_PROTOCOL_VERSION 11ULL |
82 | struct o2net_handshake { | 79 | struct o2net_handshake { |
83 | __be64 protocol_version; | 80 | __be64 protocol_version; |
84 | __be64 connector_id; | 81 | __be64 connector_id; |
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index cdeafb4e7ed6..0bb128659d4b 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c | |||
@@ -268,7 +268,6 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, | |||
268 | struct dlm_lock *lock, int flags, int type) | 268 | struct dlm_lock *lock, int flags, int type) |
269 | { | 269 | { |
270 | enum dlm_status status; | 270 | enum dlm_status status; |
271 | u8 old_owner = res->owner; | ||
272 | 271 | ||
273 | mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type, | 272 | mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type, |
274 | lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS); | 273 | lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS); |
@@ -335,7 +334,6 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, | |||
335 | 334 | ||
336 | spin_lock(&res->spinlock); | 335 | spin_lock(&res->spinlock); |
337 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; | 336 | res->state &= ~DLM_LOCK_RES_IN_PROGRESS; |
338 | lock->convert_pending = 0; | ||
339 | /* if it failed, move it back to granted queue. | 337 | /* if it failed, move it back to granted queue. |
340 | * if master returns DLM_NORMAL and then down before sending ast, | 338 | * if master returns DLM_NORMAL and then down before sending ast, |
341 | * it may have already been moved to granted queue, reset to | 339 | * it may have already been moved to granted queue, reset to |
@@ -344,12 +342,14 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, | |||
344 | if (status != DLM_NOTQUEUED) | 342 | if (status != DLM_NOTQUEUED) |
345 | dlm_error(status); | 343 | dlm_error(status); |
346 | dlm_revert_pending_convert(res, lock); | 344 | dlm_revert_pending_convert(res, lock); |
347 | } else if ((res->state & DLM_LOCK_RES_RECOVERING) || | 345 | } else if (!lock->convert_pending) { |
348 | (old_owner != res->owner)) { | 346 | mlog(0, "%s: res %.*s, owner died and lock has been moved back " |
349 | mlog(0, "res %.*s is in recovering or has been recovered.\n", | 347 | "to granted list, retry convert.\n", |
350 | res->lockname.len, res->lockname.name); | 348 | dlm->name, res->lockname.len, res->lockname.name); |
351 | status = DLM_RECOVERING; | 349 | status = DLM_RECOVERING; |
352 | } | 350 | } |
351 | |||
352 | lock->convert_pending = 0; | ||
353 | bail: | 353 | bail: |
354 | spin_unlock(&res->spinlock); | 354 | spin_unlock(&res->spinlock); |
355 | 355 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 9adcac9dfda1..63bfc3b5260d 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1506,7 +1506,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1506 | u64 start, u64 len) | 1506 | u64 start, u64 len) |
1507 | { | 1507 | { |
1508 | int ret = 0; | 1508 | int ret = 0; |
1509 | u64 tmpend, end = start + len; | 1509 | u64 tmpend = 0; |
1510 | u64 end = start + len; | ||
1510 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1511 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1511 | unsigned int csize = osb->s_clustersize; | 1512 | unsigned int csize = osb->s_clustersize; |
1512 | handle_t *handle; | 1513 | handle_t *handle; |
@@ -1538,18 +1539,31 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1538 | } | 1539 | } |
1539 | 1540 | ||
1540 | /* | 1541 | /* |
1541 | * We want to get the byte offset of the end of the 1st cluster. | 1542 | * If start is on a cluster boundary and end is somewhere in another |
1543 | * cluster, we have not COWed the cluster starting at start, unless | ||
1544 | * end is also within the same cluster. So, in this case, we skip this | ||
1545 | * first call to ocfs2_zero_range_for_truncate() truncate and move on | ||
1546 | * to the next one. | ||
1542 | */ | 1547 | */ |
1543 | tmpend = (u64)osb->s_clustersize + (start & ~(osb->s_clustersize - 1)); | 1548 | if ((start & (csize - 1)) != 0) { |
1544 | if (tmpend > end) | 1549 | /* |
1545 | tmpend = end; | 1550 | * We want to get the byte offset of the end of the 1st |
1551 | * cluster. | ||
1552 | */ | ||
1553 | tmpend = (u64)osb->s_clustersize + | ||
1554 | (start & ~(osb->s_clustersize - 1)); | ||
1555 | if (tmpend > end) | ||
1556 | tmpend = end; | ||
1546 | 1557 | ||
1547 | trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start, | 1558 | trace_ocfs2_zero_partial_clusters_range1( |
1548 | (unsigned long long)tmpend); | 1559 | (unsigned long long)start, |
1560 | (unsigned long long)tmpend); | ||
1549 | 1561 | ||
1550 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend); | 1562 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, |
1551 | if (ret) | 1563 | tmpend); |
1552 | mlog_errno(ret); | 1564 | if (ret) |
1565 | mlog_errno(ret); | ||
1566 | } | ||
1553 | 1567 | ||
1554 | if (tmpend < end) { | 1568 | if (tmpend < end) { |
1555 | /* | 1569 | /* |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index e2747d8d0552..0e0e387f2da3 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -1203,7 +1203,8 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2) | |||
1203 | static int ocfs2_rename(struct inode *old_dir, | 1203 | static int ocfs2_rename(struct inode *old_dir, |
1204 | struct dentry *old_dentry, | 1204 | struct dentry *old_dentry, |
1205 | struct inode *new_dir, | 1205 | struct inode *new_dir, |
1206 | struct dentry *new_dentry) | 1206 | struct dentry *new_dentry, |
1207 | unsigned int flags) | ||
1207 | { | 1208 | { |
1208 | int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; | 1209 | int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; |
1209 | int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; | 1210 | int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; |
@@ -1228,6 +1229,9 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1228 | struct ocfs2_dir_lookup_result target_insert = { NULL, }; | 1229 | struct ocfs2_dir_lookup_result target_insert = { NULL, }; |
1229 | bool should_add_orphan = false; | 1230 | bool should_add_orphan = false; |
1230 | 1231 | ||
1232 | if (flags) | ||
1233 | return -EINVAL; | ||
1234 | |||
1231 | /* At some point it might be nice to break this function up a | 1235 | /* At some point it might be nice to break this function up a |
1232 | * bit. */ | 1236 | * bit. */ |
1233 | 1237 | ||
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index ea47120a85ff..6ad3533940ba 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -1199,14 +1199,24 @@ retry: | |||
1199 | inode_unlock((*ac)->ac_inode); | 1199 | inode_unlock((*ac)->ac_inode); |
1200 | 1200 | ||
1201 | ret = ocfs2_try_to_free_truncate_log(osb, bits_wanted); | 1201 | ret = ocfs2_try_to_free_truncate_log(osb, bits_wanted); |
1202 | if (ret == 1) | 1202 | if (ret == 1) { |
1203 | iput((*ac)->ac_inode); | ||
1204 | (*ac)->ac_inode = NULL; | ||
1203 | goto retry; | 1205 | goto retry; |
1206 | } | ||
1204 | 1207 | ||
1205 | if (ret < 0) | 1208 | if (ret < 0) |
1206 | mlog_errno(ret); | 1209 | mlog_errno(ret); |
1207 | 1210 | ||
1208 | inode_lock((*ac)->ac_inode); | 1211 | inode_lock((*ac)->ac_inode); |
1209 | ocfs2_inode_lock((*ac)->ac_inode, NULL, 1); | 1212 | ret = ocfs2_inode_lock((*ac)->ac_inode, NULL, 1); |
1213 | if (ret < 0) { | ||
1214 | mlog_errno(ret); | ||
1215 | inode_unlock((*ac)->ac_inode); | ||
1216 | iput((*ac)->ac_inode); | ||
1217 | (*ac)->ac_inode = NULL; | ||
1218 | goto bail; | ||
1219 | } | ||
1210 | } | 1220 | } |
1211 | if (status < 0) { | 1221 | if (status < 0) { |
1212 | if (status != -ENOSPC) | 1222 | if (status != -ENOSPC) |
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c index 9a89164de1cc..b7146526afff 100644 --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c | |||
@@ -371,12 +371,16 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx, | |||
371 | } | 371 | } |
372 | 372 | ||
373 | static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 373 | static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
374 | struct inode *new_dir, struct dentry *new_dentry) | 374 | struct inode *new_dir, struct dentry *new_dentry, |
375 | unsigned int flags) | ||
375 | { | 376 | { |
376 | struct inode *new_inode = d_inode(new_dentry); | 377 | struct inode *new_inode = d_inode(new_dentry); |
377 | struct inode *old_inode = d_inode(old_dentry); | 378 | struct inode *old_inode = d_inode(old_dentry); |
378 | int err; | 379 | int err; |
379 | 380 | ||
381 | if (flags & ~RENAME_NOREPLACE) | ||
382 | return -EINVAL; | ||
383 | |||
380 | if (new_inode) { | 384 | if (new_inode) { |
381 | /* overwriting existing file/dir */ | 385 | /* overwriting existing file/dir */ |
382 | err = omfs_remove(new_dir, new_dentry); | 386 | err = omfs_remove(new_dir, new_dentry); |
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index e1ab95529231..0dfa868a6d03 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c | |||
@@ -409,11 +409,15 @@ out: | |||
409 | static int orangefs_rename(struct inode *old_dir, | 409 | static int orangefs_rename(struct inode *old_dir, |
410 | struct dentry *old_dentry, | 410 | struct dentry *old_dentry, |
411 | struct inode *new_dir, | 411 | struct inode *new_dir, |
412 | struct dentry *new_dentry) | 412 | struct dentry *new_dentry, |
413 | unsigned int flags) | ||
413 | { | 414 | { |
414 | struct orangefs_kernel_op_s *new_op; | 415 | struct orangefs_kernel_op_s *new_op; |
415 | int ret; | 416 | int ret; |
416 | 417 | ||
418 | if (flags) | ||
419 | return -EINVAL; | ||
420 | |||
417 | gossip_debug(GOSSIP_NAME_DEBUG, | 421 | gossip_debug(GOSSIP_NAME_DEBUG, |
418 | "orangefs_rename: called (%pd2 => %pd2) ct=%d\n", | 422 | "orangefs_rename: called (%pd2 => %pd2) ct=%d\n", |
419 | old_dentry, new_dentry, d_count(new_dentry)); | 423 | old_dentry, new_dentry, d_count(new_dentry)); |
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 1560fdc09a5f..480fc7868a2f 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c | |||
@@ -996,7 +996,7 @@ const struct inode_operations ovl_dir_inode_operations = { | |||
996 | .symlink = ovl_symlink, | 996 | .symlink = ovl_symlink, |
997 | .unlink = ovl_unlink, | 997 | .unlink = ovl_unlink, |
998 | .rmdir = ovl_rmdir, | 998 | .rmdir = ovl_rmdir, |
999 | .rename2 = ovl_rename2, | 999 | .rename = ovl_rename2, |
1000 | .link = ovl_link, | 1000 | .link = ovl_link, |
1001 | .setattr = ovl_setattr, | 1001 | .setattr = ovl_setattr, |
1002 | .create = ovl_create, | 1002 | .create = ovl_create, |
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h index 5813ccff8cd9..e218e741cb99 100644 --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h | |||
@@ -114,13 +114,13 @@ static inline int ovl_do_rename(struct inode *olddir, struct dentry *olddentry, | |||
114 | { | 114 | { |
115 | int err; | 115 | int err; |
116 | 116 | ||
117 | pr_debug("rename2(%pd2, %pd2, 0x%x)\n", | 117 | pr_debug("rename(%pd2, %pd2, 0x%x)\n", |
118 | olddentry, newdentry, flags); | 118 | olddentry, newdentry, flags); |
119 | 119 | ||
120 | err = vfs_rename(olddir, olddentry, newdir, newdentry, NULL, flags); | 120 | err = vfs_rename(olddir, olddentry, newdir, newdentry, NULL, flags); |
121 | 121 | ||
122 | if (err) { | 122 | if (err) { |
123 | pr_debug("...rename2(%pd2, %pd2, ...) = %i\n", | 123 | pr_debug("...rename(%pd2, %pd2, ...) = %i\n", |
124 | olddentry, newdentry, err); | 124 | olddentry, newdentry, err); |
125 | } | 125 | } |
126 | return err; | 126 | return err; |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index a939f5ed7f89..5c89a07e3d7f 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -430,6 +430,7 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff) | |||
430 | static ssize_t | 430 | static ssize_t |
431 | read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) | 431 | read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) |
432 | { | 432 | { |
433 | char *buf = file->private_data; | ||
433 | ssize_t acc = 0; | 434 | ssize_t acc = 0; |
434 | size_t size, tsz; | 435 | size_t size, tsz; |
435 | size_t elf_buflen; | 436 | size_t elf_buflen; |
@@ -500,23 +501,20 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) | |||
500 | if (clear_user(buffer, tsz)) | 501 | if (clear_user(buffer, tsz)) |
501 | return -EFAULT; | 502 | return -EFAULT; |
502 | } else if (is_vmalloc_or_module_addr((void *)start)) { | 503 | } else if (is_vmalloc_or_module_addr((void *)start)) { |
503 | char * elf_buf; | 504 | vread(buf, (char *)start, tsz); |
504 | |||
505 | elf_buf = kzalloc(tsz, GFP_KERNEL); | ||
506 | if (!elf_buf) | ||
507 | return -ENOMEM; | ||
508 | vread(elf_buf, (char *)start, tsz); | ||
509 | /* we have to zero-fill user buffer even if no read */ | 505 | /* we have to zero-fill user buffer even if no read */ |
510 | if (copy_to_user(buffer, elf_buf, tsz)) { | 506 | if (copy_to_user(buffer, buf, tsz)) |
511 | kfree(elf_buf); | ||
512 | return -EFAULT; | 507 | return -EFAULT; |
513 | } | ||
514 | kfree(elf_buf); | ||
515 | } else { | 508 | } else { |
516 | if (kern_addr_valid(start)) { | 509 | if (kern_addr_valid(start)) { |
517 | unsigned long n; | 510 | unsigned long n; |
518 | 511 | ||
519 | n = copy_to_user(buffer, (char *)start, tsz); | 512 | /* |
513 | * Using bounce buffer to bypass the | ||
514 | * hardened user copy kernel text checks. | ||
515 | */ | ||
516 | memcpy(buf, (char *) start, tsz); | ||
517 | n = copy_to_user(buffer, buf, tsz); | ||
520 | /* | 518 | /* |
521 | * We cannot distinguish between fault on source | 519 | * We cannot distinguish between fault on source |
522 | * and fault on destination. When this happens | 520 | * and fault on destination. When this happens |
@@ -549,6 +547,11 @@ static int open_kcore(struct inode *inode, struct file *filp) | |||
549 | { | 547 | { |
550 | if (!capable(CAP_SYS_RAWIO)) | 548 | if (!capable(CAP_SYS_RAWIO)) |
551 | return -EPERM; | 549 | return -EPERM; |
550 | |||
551 | filp->private_data = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
552 | if (!filp->private_data) | ||
553 | return -ENOMEM; | ||
554 | |||
552 | if (kcore_need_update) | 555 | if (kcore_need_update) |
553 | kcore_update_ram(); | 556 | kcore_update_ram(); |
554 | if (i_size_read(inode) != proc_root_kcore->size) { | 557 | if (i_size_read(inode) != proc_root_kcore->size) { |
@@ -559,10 +562,16 @@ static int open_kcore(struct inode *inode, struct file *filp) | |||
559 | return 0; | 562 | return 0; |
560 | } | 563 | } |
561 | 564 | ||
565 | static int release_kcore(struct inode *inode, struct file *file) | ||
566 | { | ||
567 | kfree(file->private_data); | ||
568 | return 0; | ||
569 | } | ||
562 | 570 | ||
563 | static const struct file_operations proc_kcore_operations = { | 571 | static const struct file_operations proc_kcore_operations = { |
564 | .read = read_kcore, | 572 | .read = read_kcore, |
565 | .open = open_kcore, | 573 | .open = open_kcore, |
574 | .release = release_kcore, | ||
566 | .llseek = default_llseek, | 575 | .llseek = default_llseek, |
567 | }; | 576 | }; |
568 | 577 | ||
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c index 183a212694bf..12af0490322f 100644 --- a/fs/ramfs/file-mmu.c +++ b/fs/ramfs/file-mmu.c | |||
@@ -27,9 +27,17 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/ramfs.h> | 29 | #include <linux/ramfs.h> |
30 | #include <linux/sched.h> | ||
30 | 31 | ||
31 | #include "internal.h" | 32 | #include "internal.h" |
32 | 33 | ||
34 | static unsigned long ramfs_mmu_get_unmapped_area(struct file *file, | ||
35 | unsigned long addr, unsigned long len, unsigned long pgoff, | ||
36 | unsigned long flags) | ||
37 | { | ||
38 | return current->mm->get_unmapped_area(file, addr, len, pgoff, flags); | ||
39 | } | ||
40 | |||
33 | const struct file_operations ramfs_file_operations = { | 41 | const struct file_operations ramfs_file_operations = { |
34 | .read_iter = generic_file_read_iter, | 42 | .read_iter = generic_file_read_iter, |
35 | .write_iter = generic_file_write_iter, | 43 | .write_iter = generic_file_write_iter, |
@@ -38,6 +46,7 @@ const struct file_operations ramfs_file_operations = { | |||
38 | .splice_read = generic_file_splice_read, | 46 | .splice_read = generic_file_splice_read, |
39 | .splice_write = iter_file_splice_write, | 47 | .splice_write = iter_file_splice_write, |
40 | .llseek = generic_file_llseek, | 48 | .llseek = generic_file_llseek, |
49 | .get_unmapped_area = ramfs_mmu_get_unmapped_area, | ||
41 | }; | 50 | }; |
42 | 51 | ||
43 | const struct inode_operations ramfs_file_inode_operations = { | 52 | const struct inode_operations ramfs_file_inode_operations = { |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 968411930bd5..f9a0a2ba3783 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -1306,7 +1306,8 @@ static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de, | |||
1306 | * get_empty_nodes or its clones | 1306 | * get_empty_nodes or its clones |
1307 | */ | 1307 | */ |
1308 | static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 1308 | static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
1309 | struct inode *new_dir, struct dentry *new_dentry) | 1309 | struct inode *new_dir, struct dentry *new_dentry, |
1310 | unsigned int flags) | ||
1310 | { | 1311 | { |
1311 | int retval; | 1312 | int retval; |
1312 | INITIALIZE_PATH(old_entry_path); | 1313 | INITIALIZE_PATH(old_entry_path); |
@@ -1321,6 +1322,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1321 | unsigned long savelink = 1; | 1322 | unsigned long savelink = 1; |
1322 | struct timespec ctime; | 1323 | struct timespec ctime; |
1323 | 1324 | ||
1325 | if (flags & ~RENAME_NOREPLACE) | ||
1326 | return -EINVAL; | ||
1327 | |||
1324 | /* | 1328 | /* |
1325 | * three balancings: (1) old name removal, (2) new name insertion | 1329 | * three balancings: (1) old name removal, (2) new name insertion |
1326 | * and (3) maybe "save" link insertion | 1330 | * and (3) maybe "save" link insertion |
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index ce66618721b2..d8817f139763 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
@@ -206,7 +206,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry) | |||
206 | * higher-level routines. | 206 | * higher-level routines. |
207 | */ | 207 | */ |
208 | static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, | 208 | static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, |
209 | struct inode * new_dir, struct dentry * new_dentry) | 209 | struct inode * new_dir, struct dentry * new_dentry, |
210 | unsigned int flags) | ||
210 | { | 211 | { |
211 | struct inode * old_inode = d_inode(old_dentry); | 212 | struct inode * old_inode = d_inode(old_dentry); |
212 | struct inode * new_inode = d_inode(new_dentry); | 213 | struct inode * new_inode = d_inode(new_dentry); |
@@ -216,6 +217,9 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
216 | struct sysv_dir_entry * old_de; | 217 | struct sysv_dir_entry * old_de; |
217 | int err = -ENOENT; | 218 | int err = -ENOENT; |
218 | 219 | ||
220 | if (flags & ~RENAME_NOREPLACE) | ||
221 | return -EINVAL; | ||
222 | |||
219 | old_de = sysv_find_entry(old_dentry, &old_page); | 223 | old_de = sysv_find_entry(old_dentry, &old_page); |
220 | if (!old_de) | 224 | if (!old_de) |
221 | goto out; | 225 | goto out; |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 4b86d3a738e1..e10e9a00cfc3 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -966,7 +966,8 @@ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, | |||
966 | } | 966 | } |
967 | 967 | ||
968 | static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | 968 | static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, |
969 | struct inode *new_dir, struct dentry *new_dentry) | 969 | struct inode *new_dir, struct dentry *new_dentry, |
970 | unsigned int flags) | ||
970 | { | 971 | { |
971 | struct ubifs_info *c = old_dir->i_sb->s_fs_info; | 972 | struct ubifs_info *c = old_dir->i_sb->s_fs_info; |
972 | struct inode *old_inode = d_inode(old_dentry); | 973 | struct inode *old_inode = d_inode(old_dentry); |
@@ -984,6 +985,9 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
984 | struct timespec time; | 985 | struct timespec time; |
985 | unsigned int uninitialized_var(saved_nlink); | 986 | unsigned int uninitialized_var(saved_nlink); |
986 | 987 | ||
988 | if (flags & ~RENAME_NOREPLACE) | ||
989 | return -EINVAL; | ||
990 | |||
987 | /* | 991 | /* |
988 | * Budget request settings: deletion direntry, new direntry, removing | 992 | * Budget request settings: deletion direntry, new direntry, removing |
989 | * the old inode, and changing old and new parent directory inodes. | 993 | * the old inode, and changing old and new parent directory inodes. |
@@ -1179,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = { | |||
1179 | .mkdir = ubifs_mkdir, | 1183 | .mkdir = ubifs_mkdir, |
1180 | .rmdir = ubifs_rmdir, | 1184 | .rmdir = ubifs_rmdir, |
1181 | .mknod = ubifs_mknod, | 1185 | .mknod = ubifs_mknod, |
1182 | .rename = ubifs_rename, | 1186 | .rename = ubifs_rename, |
1183 | .setattr = ubifs_setattr, | 1187 | .setattr = ubifs_setattr, |
1184 | .getattr = ubifs_getattr, | 1188 | .getattr = ubifs_getattr, |
1185 | .setxattr = generic_setxattr, | 1189 | .setxattr = generic_setxattr, |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 61af3f1e1973..2d65e280748b 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -1093,7 +1093,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, | |||
1093 | * higher-level routines. | 1093 | * higher-level routines. |
1094 | */ | 1094 | */ |
1095 | static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | 1095 | static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, |
1096 | struct inode *new_dir, struct dentry *new_dentry) | 1096 | struct inode *new_dir, struct dentry *new_dentry, |
1097 | unsigned int flags) | ||
1097 | { | 1098 | { |
1098 | struct inode *old_inode = d_inode(old_dentry); | 1099 | struct inode *old_inode = d_inode(old_dentry); |
1099 | struct inode *new_inode = d_inode(new_dentry); | 1100 | struct inode *new_inode = d_inode(new_dentry); |
@@ -1105,6 +1106,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1105 | struct kernel_lb_addr tloc; | 1106 | struct kernel_lb_addr tloc; |
1106 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); | 1107 | struct udf_inode_info *old_iinfo = UDF_I(old_inode); |
1107 | 1108 | ||
1109 | if (flags & ~RENAME_NOREPLACE) | ||
1110 | return -EINVAL; | ||
1111 | |||
1108 | ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); | 1112 | ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); |
1109 | if (IS_ERR(ofi)) { | 1113 | if (IS_ERR(ofi)) { |
1110 | retval = PTR_ERR(ofi); | 1114 | retval = PTR_ERR(ofi); |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index e3b263998130..8eca4eda8450 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -245,7 +245,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry) | |||
245 | } | 245 | } |
246 | 246 | ||
247 | static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | 247 | static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, |
248 | struct inode *new_dir, struct dentry *new_dentry) | 248 | struct inode *new_dir, struct dentry *new_dentry, |
249 | unsigned int flags) | ||
249 | { | 250 | { |
250 | struct inode *old_inode = d_inode(old_dentry); | 251 | struct inode *old_inode = d_inode(old_dentry); |
251 | struct inode *new_inode = d_inode(new_dentry); | 252 | struct inode *new_inode = d_inode(new_dentry); |
@@ -255,6 +256,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
255 | struct ufs_dir_entry *old_de; | 256 | struct ufs_dir_entry *old_de; |
256 | int err = -ENOENT; | 257 | int err = -ENOENT; |
257 | 258 | ||
259 | if (flags & ~RENAME_NOREPLACE) | ||
260 | return -EINVAL; | ||
261 | |||
258 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); | 262 | old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); |
259 | if (!old_de) | 263 | if (!old_de) |
260 | goto out; | 264 | goto out; |
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 08c33f7fbe49..d8ac28656ac2 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -1059,7 +1059,7 @@ static const struct inode_operations xfs_dir_inode_operations = { | |||
1059 | */ | 1059 | */ |
1060 | .rmdir = xfs_vn_unlink, | 1060 | .rmdir = xfs_vn_unlink, |
1061 | .mknod = xfs_vn_mknod, | 1061 | .mknod = xfs_vn_mknod, |
1062 | .rename2 = xfs_vn_rename, | 1062 | .rename = xfs_vn_rename, |
1063 | .get_acl = xfs_get_acl, | 1063 | .get_acl = xfs_get_acl, |
1064 | .set_acl = xfs_set_acl, | 1064 | .set_acl = xfs_set_acl, |
1065 | .getattr = xfs_vn_getattr, | 1065 | .getattr = xfs_vn_getattr, |
@@ -1087,7 +1087,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = { | |||
1087 | */ | 1087 | */ |
1088 | .rmdir = xfs_vn_unlink, | 1088 | .rmdir = xfs_vn_unlink, |
1089 | .mknod = xfs_vn_mknod, | 1089 | .mknod = xfs_vn_mknod, |
1090 | .rename2 = xfs_vn_rename, | 1090 | .rename = xfs_vn_rename, |
1091 | .get_acl = xfs_get_acl, | 1091 | .get_acl = xfs_get_acl, |
1092 | .set_acl = xfs_set_acl, | 1092 | .set_acl = xfs_set_acl, |
1093 | .getattr = xfs_vn_getattr, | 1093 | .getattr = xfs_vn_getattr, |
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h index 5dea1fb6979c..6df9b0749671 100644 --- a/include/asm-generic/uaccess.h +++ b/include/asm-generic/uaccess.h | |||
@@ -231,14 +231,18 @@ extern int __put_user_bad(void) __attribute__((noreturn)); | |||
231 | might_fault(); \ | 231 | might_fault(); \ |
232 | access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ | 232 | access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \ |
233 | __get_user((x), (__typeof__(*(ptr)) *)__p) : \ | 233 | __get_user((x), (__typeof__(*(ptr)) *)__p) : \ |
234 | -EFAULT; \ | 234 | ((x) = (__typeof__(*(ptr)))0,-EFAULT); \ |
235 | }) | 235 | }) |
236 | 236 | ||
237 | #ifndef __get_user_fn | 237 | #ifndef __get_user_fn |
238 | static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) | 238 | static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) |
239 | { | 239 | { |
240 | size = __copy_from_user(x, ptr, size); | 240 | size_t n = __copy_from_user(x, ptr, size); |
241 | return size ? -EFAULT : size; | 241 | if (unlikely(n)) { |
242 | memset(x + (size - n), 0, n); | ||
243 | return -EFAULT; | ||
244 | } | ||
245 | return 0; | ||
242 | } | 246 | } |
243 | 247 | ||
244 | #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) | 248 | #define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k) |
@@ -258,11 +262,13 @@ extern int __get_user_bad(void) __attribute__((noreturn)); | |||
258 | static inline long copy_from_user(void *to, | 262 | static inline long copy_from_user(void *to, |
259 | const void __user * from, unsigned long n) | 263 | const void __user * from, unsigned long n) |
260 | { | 264 | { |
265 | unsigned long res = n; | ||
261 | might_fault(); | 266 | might_fault(); |
262 | if (access_ok(VERIFY_READ, from, n)) | 267 | if (likely(access_ok(VERIFY_READ, from, n))) |
263 | return __copy_from_user(to, from, n); | 268 | res = __copy_from_user(to, from, n); |
264 | else | 269 | if (unlikely(res)) |
265 | return n; | 270 | memset(to + (n - res), 0, res); |
271 | return res; | ||
266 | } | 272 | } |
267 | 273 | ||
268 | static inline long copy_to_user(void __user *to, | 274 | static inline long copy_to_user(void __user *to, |
diff --git a/include/linux/cec-funcs.h b/include/linux/cec-funcs.h index 82c3d3b7269d..138bbf721e70 100644 --- a/include/linux/cec-funcs.h +++ b/include/linux/cec-funcs.h | |||
@@ -162,10 +162,11 @@ static inline void cec_msg_standby(struct cec_msg *msg) | |||
162 | 162 | ||
163 | 163 | ||
164 | /* One Touch Record Feature */ | 164 | /* One Touch Record Feature */ |
165 | static inline void cec_msg_record_off(struct cec_msg *msg) | 165 | static inline void cec_msg_record_off(struct cec_msg *msg, bool reply) |
166 | { | 166 | { |
167 | msg->len = 2; | 167 | msg->len = 2; |
168 | msg->msg[1] = CEC_MSG_RECORD_OFF; | 168 | msg->msg[1] = CEC_MSG_RECORD_OFF; |
169 | msg->reply = reply ? CEC_MSG_RECORD_STATUS : 0; | ||
169 | } | 170 | } |
170 | 171 | ||
171 | struct cec_op_arib_data { | 172 | struct cec_op_arib_data { |
@@ -227,7 +228,7 @@ static inline void cec_set_digital_service_id(__u8 *msg, | |||
227 | if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) { | 228 | if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) { |
228 | *msg++ = (digital->channel.channel_number_fmt << 2) | | 229 | *msg++ = (digital->channel.channel_number_fmt << 2) | |
229 | (digital->channel.major >> 8); | 230 | (digital->channel.major >> 8); |
230 | *msg++ = digital->channel.major && 0xff; | 231 | *msg++ = digital->channel.major & 0xff; |
231 | *msg++ = digital->channel.minor >> 8; | 232 | *msg++ = digital->channel.minor >> 8; |
232 | *msg++ = digital->channel.minor & 0xff; | 233 | *msg++ = digital->channel.minor & 0xff; |
233 | *msg++ = 0; | 234 | *msg++ = 0; |
@@ -323,6 +324,7 @@ static inline void cec_msg_record_on_phys_addr(struct cec_msg *msg, | |||
323 | } | 324 | } |
324 | 325 | ||
325 | static inline void cec_msg_record_on(struct cec_msg *msg, | 326 | static inline void cec_msg_record_on(struct cec_msg *msg, |
327 | bool reply, | ||
326 | const struct cec_op_record_src *rec_src) | 328 | const struct cec_op_record_src *rec_src) |
327 | { | 329 | { |
328 | switch (rec_src->type) { | 330 | switch (rec_src->type) { |
@@ -346,6 +348,7 @@ static inline void cec_msg_record_on(struct cec_msg *msg, | |||
346 | rec_src->ext_phys_addr.phys_addr); | 348 | rec_src->ext_phys_addr.phys_addr); |
347 | break; | 349 | break; |
348 | } | 350 | } |
351 | msg->reply = reply ? CEC_MSG_RECORD_STATUS : 0; | ||
349 | } | 352 | } |
350 | 353 | ||
351 | static inline void cec_ops_record_on(const struct cec_msg *msg, | 354 | static inline void cec_ops_record_on(const struct cec_msg *msg, |
@@ -1141,6 +1144,75 @@ static inline void cec_msg_give_device_vendor_id(struct cec_msg *msg, | |||
1141 | msg->reply = reply ? CEC_MSG_DEVICE_VENDOR_ID : 0; | 1144 | msg->reply = reply ? CEC_MSG_DEVICE_VENDOR_ID : 0; |
1142 | } | 1145 | } |
1143 | 1146 | ||
1147 | static inline void cec_msg_vendor_command(struct cec_msg *msg, | ||
1148 | __u8 size, const __u8 *vendor_cmd) | ||
1149 | { | ||
1150 | if (size > 14) | ||
1151 | size = 14; | ||
1152 | msg->len = 2 + size; | ||
1153 | msg->msg[1] = CEC_MSG_VENDOR_COMMAND; | ||
1154 | memcpy(msg->msg + 2, vendor_cmd, size); | ||
1155 | } | ||
1156 | |||
1157 | static inline void cec_ops_vendor_command(const struct cec_msg *msg, | ||
1158 | __u8 *size, | ||
1159 | const __u8 **vendor_cmd) | ||
1160 | { | ||
1161 | *size = msg->len - 2; | ||
1162 | |||
1163 | if (*size > 14) | ||
1164 | *size = 14; | ||
1165 | *vendor_cmd = msg->msg + 2; | ||
1166 | } | ||
1167 | |||
1168 | static inline void cec_msg_vendor_command_with_id(struct cec_msg *msg, | ||
1169 | __u32 vendor_id, __u8 size, | ||
1170 | const __u8 *vendor_cmd) | ||
1171 | { | ||
1172 | if (size > 11) | ||
1173 | size = 11; | ||
1174 | msg->len = 5 + size; | ||
1175 | msg->msg[1] = CEC_MSG_VENDOR_COMMAND_WITH_ID; | ||
1176 | msg->msg[2] = vendor_id >> 16; | ||
1177 | msg->msg[3] = (vendor_id >> 8) & 0xff; | ||
1178 | msg->msg[4] = vendor_id & 0xff; | ||
1179 | memcpy(msg->msg + 5, vendor_cmd, size); | ||
1180 | } | ||
1181 | |||
1182 | static inline void cec_ops_vendor_command_with_id(const struct cec_msg *msg, | ||
1183 | __u32 *vendor_id, __u8 *size, | ||
1184 | const __u8 **vendor_cmd) | ||
1185 | { | ||
1186 | *size = msg->len - 5; | ||
1187 | |||
1188 | if (*size > 11) | ||
1189 | *size = 11; | ||
1190 | *vendor_id = (msg->msg[2] << 16) | (msg->msg[3] << 8) | msg->msg[4]; | ||
1191 | *vendor_cmd = msg->msg + 5; | ||
1192 | } | ||
1193 | |||
1194 | static inline void cec_msg_vendor_remote_button_down(struct cec_msg *msg, | ||
1195 | __u8 size, | ||
1196 | const __u8 *rc_code) | ||
1197 | { | ||
1198 | if (size > 14) | ||
1199 | size = 14; | ||
1200 | msg->len = 2 + size; | ||
1201 | msg->msg[1] = CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN; | ||
1202 | memcpy(msg->msg + 2, rc_code, size); | ||
1203 | } | ||
1204 | |||
1205 | static inline void cec_ops_vendor_remote_button_down(const struct cec_msg *msg, | ||
1206 | __u8 *size, | ||
1207 | const __u8 **rc_code) | ||
1208 | { | ||
1209 | *size = msg->len - 2; | ||
1210 | |||
1211 | if (*size > 14) | ||
1212 | *size = 14; | ||
1213 | *rc_code = msg->msg + 2; | ||
1214 | } | ||
1215 | |||
1144 | static inline void cec_msg_vendor_remote_button_up(struct cec_msg *msg) | 1216 | static inline void cec_msg_vendor_remote_button_up(struct cec_msg *msg) |
1145 | { | 1217 | { |
1146 | msg->len = 2; | 1218 | msg->len = 2; |
@@ -1277,7 +1349,7 @@ static inline void cec_msg_user_control_pressed(struct cec_msg *msg, | |||
1277 | msg->len += 4; | 1349 | msg->len += 4; |
1278 | msg->msg[3] = (ui_cmd->channel_identifier.channel_number_fmt << 2) | | 1350 | msg->msg[3] = (ui_cmd->channel_identifier.channel_number_fmt << 2) | |
1279 | (ui_cmd->channel_identifier.major >> 8); | 1351 | (ui_cmd->channel_identifier.major >> 8); |
1280 | msg->msg[4] = ui_cmd->channel_identifier.major && 0xff; | 1352 | msg->msg[4] = ui_cmd->channel_identifier.major & 0xff; |
1281 | msg->msg[5] = ui_cmd->channel_identifier.minor >> 8; | 1353 | msg->msg[5] = ui_cmd->channel_identifier.minor >> 8; |
1282 | msg->msg[6] = ui_cmd->channel_identifier.minor & 0xff; | 1354 | msg->msg[6] = ui_cmd->channel_identifier.minor & 0xff; |
1283 | break; | 1355 | break; |
diff --git a/include/linux/cec.h b/include/linux/cec.h index b3e22893a002..851968e803fa 100644 --- a/include/linux/cec.h +++ b/include/linux/cec.h | |||
@@ -364,7 +364,7 @@ struct cec_caps { | |||
364 | * @num_log_addrs: how many logical addresses should be claimed. Set by the | 364 | * @num_log_addrs: how many logical addresses should be claimed. Set by the |
365 | * caller. | 365 | * caller. |
366 | * @vendor_id: the vendor ID of the device. Set by the caller. | 366 | * @vendor_id: the vendor ID of the device. Set by the caller. |
367 | * @flags: set to 0. | 367 | * @flags: flags. |
368 | * @osd_name: the OSD name of the device. Set by the caller. | 368 | * @osd_name: the OSD name of the device. Set by the caller. |
369 | * @primary_device_type: the primary device type for each logical address. | 369 | * @primary_device_type: the primary device type for each logical address. |
370 | * Set by the caller. | 370 | * Set by the caller. |
@@ -389,6 +389,9 @@ struct cec_log_addrs { | |||
389 | __u8 features[CEC_MAX_LOG_ADDRS][12]; | 389 | __u8 features[CEC_MAX_LOG_ADDRS][12]; |
390 | }; | 390 | }; |
391 | 391 | ||
392 | /* Allow a fallback to unregistered */ | ||
393 | #define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK (1 << 0) | ||
394 | |||
392 | /* Events */ | 395 | /* Events */ |
393 | 396 | ||
394 | /* Event that occurs when the adapter state changes */ | 397 | /* Event that occurs when the adapter state changes */ |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 436aa4e42221..668569844d37 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -527,13 +527,14 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
527 | * object's lifetime is managed by something other than RCU. That | 527 | * object's lifetime is managed by something other than RCU. That |
528 | * "something other" might be reference counting or simple immortality. | 528 | * "something other" might be reference counting or simple immortality. |
529 | * | 529 | * |
530 | * The seemingly unused size_t variable is to validate @p is indeed a pointer | 530 | * The seemingly unused variable ___typecheck_p validates that @p is |
531 | * type by making sure it can be dereferenced. | 531 | * indeed a pointer type by using a pointer to typeof(*p) as the type. |
532 | * Taking a pointer to typeof(*p) again is needed in case p is void *. | ||
532 | */ | 533 | */ |
533 | #define lockless_dereference(p) \ | 534 | #define lockless_dereference(p) \ |
534 | ({ \ | 535 | ({ \ |
535 | typeof(p) _________p1 = READ_ONCE(p); \ | 536 | typeof(p) _________p1 = READ_ONCE(p); \ |
536 | size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \ | 537 | typeof(*(p)) *___typecheck_p __maybe_unused; \ |
537 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ | 538 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ |
538 | (_________p1); \ | 539 | (_________p1); \ |
539 | }) | 540 | }) |
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 242bf530edfc..34bd80512a0c 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __CPUHOTPLUG_H | 1 | #ifndef __CPUHOTPLUG_H |
2 | #define __CPUHOTPLUG_H | 2 | #define __CPUHOTPLUG_H |
3 | 3 | ||
4 | #include <linux/types.h> | ||
5 | |||
4 | enum cpuhp_state { | 6 | enum cpuhp_state { |
5 | CPUHP_OFFLINE, | 7 | CPUHP_OFFLINE, |
6 | CPUHP_CREATE_THREADS, | 8 | CPUHP_CREATE_THREADS, |
diff --git a/include/linux/efi.h b/include/linux/efi.h index 7f5a58225385..0148a3046b48 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h | |||
@@ -118,6 +118,15 @@ typedef struct { | |||
118 | u32 imagesize; | 118 | u32 imagesize; |
119 | } efi_capsule_header_t; | 119 | } efi_capsule_header_t; |
120 | 120 | ||
121 | struct efi_boot_memmap { | ||
122 | efi_memory_desc_t **map; | ||
123 | unsigned long *map_size; | ||
124 | unsigned long *desc_size; | ||
125 | u32 *desc_ver; | ||
126 | unsigned long *key_ptr; | ||
127 | unsigned long *buff_size; | ||
128 | }; | ||
129 | |||
121 | /* | 130 | /* |
122 | * EFI capsule flags | 131 | * EFI capsule flags |
123 | */ | 132 | */ |
@@ -946,7 +955,7 @@ extern int efi_memattr_apply_permissions(struct mm_struct *mm, | |||
946 | /* Iterate through an efi_memory_map */ | 955 | /* Iterate through an efi_memory_map */ |
947 | #define for_each_efi_memory_desc_in_map(m, md) \ | 956 | #define for_each_efi_memory_desc_in_map(m, md) \ |
948 | for ((md) = (m)->map; \ | 957 | for ((md) = (m)->map; \ |
949 | ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ | 958 | (md) && ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ |
950 | (md) = (void *)(md) + (m)->desc_size) | 959 | (md) = (void *)(md) + (m)->desc_size) |
951 | 960 | ||
952 | /** | 961 | /** |
@@ -1371,11 +1380,7 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, | |||
1371 | efi_loaded_image_t *image, int *cmd_line_len); | 1380 | efi_loaded_image_t *image, int *cmd_line_len); |
1372 | 1381 | ||
1373 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, | 1382 | efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg, |
1374 | efi_memory_desc_t **map, | 1383 | struct efi_boot_memmap *map); |
1375 | unsigned long *map_size, | ||
1376 | unsigned long *desc_size, | ||
1377 | u32 *desc_ver, | ||
1378 | unsigned long *key_ptr); | ||
1379 | 1384 | ||
1380 | efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, | 1385 | efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg, |
1381 | unsigned long size, unsigned long align, | 1386 | unsigned long size, unsigned long align, |
@@ -1457,4 +1462,14 @@ extern void efi_call_virt_check_flags(unsigned long flags, const char *call); | |||
1457 | arch_efi_call_virt_teardown(); \ | 1462 | arch_efi_call_virt_teardown(); \ |
1458 | }) | 1463 | }) |
1459 | 1464 | ||
1465 | typedef efi_status_t (*efi_exit_boot_map_processing)( | ||
1466 | efi_system_table_t *sys_table_arg, | ||
1467 | struct efi_boot_memmap *map, | ||
1468 | void *priv); | ||
1469 | |||
1470 | efi_status_t efi_exit_boot_services(efi_system_table_t *sys_table, | ||
1471 | void *handle, | ||
1472 | struct efi_boot_memmap *map, | ||
1473 | void *priv, | ||
1474 | efi_exit_boot_map_processing priv_func); | ||
1460 | #endif /* _LINUX_EFI_H */ | 1475 | #endif /* _LINUX_EFI_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 32ce6b31a61b..17d5a3507d0e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1734,8 +1734,6 @@ struct inode_operations { | |||
1734 | int (*rmdir) (struct inode *,struct dentry *); | 1734 | int (*rmdir) (struct inode *,struct dentry *); |
1735 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); | 1735 | int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); |
1736 | int (*rename) (struct inode *, struct dentry *, | 1736 | int (*rename) (struct inode *, struct dentry *, |
1737 | struct inode *, struct dentry *); | ||
1738 | int (*rename2) (struct inode *, struct dentry *, | ||
1739 | struct inode *, struct dentry *, unsigned int); | 1737 | struct inode *, struct dentry *, unsigned int); |
1740 | int (*setattr) (struct dentry *, struct iattr *); | 1738 | int (*setattr) (struct dentry *, struct iattr *); |
1741 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); | 1739 | int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); |
@@ -2951,7 +2949,8 @@ extern int simple_open(struct inode *inode, struct file *file); | |||
2951 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); | 2949 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); |
2952 | extern int simple_unlink(struct inode *, struct dentry *); | 2950 | extern int simple_unlink(struct inode *, struct dentry *); |
2953 | extern int simple_rmdir(struct inode *, struct dentry *); | 2951 | extern int simple_rmdir(struct inode *, struct dentry *); |
2954 | extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | 2952 | extern int simple_rename(struct inode *, struct dentry *, |
2953 | struct inode *, struct dentry *, unsigned int); | ||
2955 | extern int noop_fsync(struct file *, loff_t, loff_t, int); | 2954 | extern int noop_fsync(struct file *, loff_t, loff_t, int); |
2956 | extern int simple_empty(struct dentry *); | 2955 | extern int simple_empty(struct dentry *); |
2957 | extern int simple_readpage(struct file *file, struct page *page); | 2956 | extern int simple_readpage(struct file *file, struct page *page); |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 58205f33af02..7268ed076be8 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -148,6 +148,7 @@ struct fsnotify_group { | |||
148 | #define FS_PRIO_1 1 /* fanotify content based access control */ | 148 | #define FS_PRIO_1 1 /* fanotify content based access control */ |
149 | #define FS_PRIO_2 2 /* fanotify pre-content access */ | 149 | #define FS_PRIO_2 2 /* fanotify pre-content access */ |
150 | unsigned int priority; | 150 | unsigned int priority; |
151 | bool shutdown; /* group is being shut down, don't queue more events */ | ||
151 | 152 | ||
152 | /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ | 153 | /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */ |
153 | struct mutex mark_mutex; /* protect marks_list */ | 154 | struct mutex mark_mutex; /* protect marks_list */ |
@@ -179,7 +180,6 @@ struct fsnotify_group { | |||
179 | spinlock_t access_lock; | 180 | spinlock_t access_lock; |
180 | struct list_head access_list; | 181 | struct list_head access_list; |
181 | wait_queue_head_t access_waitq; | 182 | wait_queue_head_t access_waitq; |
182 | atomic_t bypass_perm; | ||
183 | #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ | 183 | #endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */ |
184 | int f_flags; | 184 | int f_flags; |
185 | unsigned int max_marks; | 185 | unsigned int max_marks; |
@@ -292,6 +292,8 @@ extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *op | |||
292 | extern void fsnotify_get_group(struct fsnotify_group *group); | 292 | extern void fsnotify_get_group(struct fsnotify_group *group); |
293 | /* drop reference on a group from fsnotify_alloc_group */ | 293 | /* drop reference on a group from fsnotify_alloc_group */ |
294 | extern void fsnotify_put_group(struct fsnotify_group *group); | 294 | extern void fsnotify_put_group(struct fsnotify_group *group); |
295 | /* group destruction begins, stop queuing new events */ | ||
296 | extern void fsnotify_group_stop_queueing(struct fsnotify_group *group); | ||
295 | /* destroy group */ | 297 | /* destroy group */ |
296 | extern void fsnotify_destroy_group(struct fsnotify_group *group); | 298 | extern void fsnotify_destroy_group(struct fsnotify_group *group); |
297 | /* fasync handler function */ | 299 | /* fasync handler function */ |
@@ -304,8 +306,6 @@ extern int fsnotify_add_event(struct fsnotify_group *group, | |||
304 | struct fsnotify_event *event, | 306 | struct fsnotify_event *event, |
305 | int (*merge)(struct list_head *, | 307 | int (*merge)(struct list_head *, |
306 | struct fsnotify_event *)); | 308 | struct fsnotify_event *)); |
307 | /* Remove passed event from groups notification queue */ | ||
308 | extern void fsnotify_remove_event(struct fsnotify_group *group, struct fsnotify_event *event); | ||
309 | /* true if the group notification queue is empty */ | 309 | /* true if the group notification queue is empty */ |
310 | extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); | 310 | extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); |
311 | /* return, but do not dequeue the first event on the notification queue */ | 311 | /* return, but do not dequeue the first event on the notification queue */ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index b52424eaa0ed..0ac26c892fe2 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -945,6 +945,16 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { } | |||
945 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } | 945 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } |
946 | #endif | 946 | #endif |
947 | 947 | ||
948 | /* | ||
949 | * The irqsave variants are for usage in non interrupt code. Do not use | ||
950 | * them in irq_chip callbacks. Use irq_gc_lock() instead. | ||
951 | */ | ||
952 | #define irq_gc_lock_irqsave(gc, flags) \ | ||
953 | raw_spin_lock_irqsave(&(gc)->lock, flags) | ||
954 | |||
955 | #define irq_gc_unlock_irqrestore(gc, flags) \ | ||
956 | raw_spin_unlock_irqrestore(&(gc)->lock, flags) | ||
957 | |||
948 | static inline void irq_reg_writel(struct irq_chip_generic *gc, | 958 | static inline void irq_reg_writel(struct irq_chip_generic *gc, |
949 | u32 val, int reg_offset) | 959 | u32 val, int reg_offset) |
950 | { | 960 | { |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 21bc4557b67a..d1f9a581aca8 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -6710,9 +6710,10 @@ struct mlx5_ifc_pude_reg_bits { | |||
6710 | }; | 6710 | }; |
6711 | 6711 | ||
6712 | struct mlx5_ifc_ptys_reg_bits { | 6712 | struct mlx5_ifc_ptys_reg_bits { |
6713 | u8 an_disable_cap[0x1]; | 6713 | u8 reserved_at_0[0x1]; |
6714 | u8 an_disable_admin[0x1]; | 6714 | u8 an_disable_admin[0x1]; |
6715 | u8 reserved_at_2[0x6]; | 6715 | u8 an_disable_cap[0x1]; |
6716 | u8 reserved_at_3[0x5]; | ||
6716 | u8 local_port[0x8]; | 6717 | u8 local_port[0x8]; |
6717 | u8 reserved_at_10[0xd]; | 6718 | u8 reserved_at_10[0xd]; |
6718 | u8 proto_mask[0x3]; | 6719 | u8 proto_mask[0x3]; |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3a788bf0affd..e8d79d4ebcfe 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -3267,6 +3267,7 @@ static inline void napi_free_frags(struct napi_struct *napi) | |||
3267 | napi->skb = NULL; | 3267 | napi->skb = NULL; |
3268 | } | 3268 | } |
3269 | 3269 | ||
3270 | bool netdev_is_rx_handler_busy(struct net_device *dev); | ||
3270 | int netdev_rx_handler_register(struct net_device *dev, | 3271 | int netdev_rx_handler_register(struct net_device *dev, |
3271 | rx_handler_func_t *rx_handler, | 3272 | rx_handler_func_t *rx_handler, |
3272 | void *rx_handler_data); | 3273 | void *rx_handler_data); |
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 66a1260b33de..01e84436cddf 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h | |||
@@ -571,56 +571,57 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size) | |||
571 | */ | 571 | */ |
572 | static inline int fault_in_multipages_writeable(char __user *uaddr, int size) | 572 | static inline int fault_in_multipages_writeable(char __user *uaddr, int size) |
573 | { | 573 | { |
574 | int ret = 0; | ||
575 | char __user *end = uaddr + size - 1; | 574 | char __user *end = uaddr + size - 1; |
576 | 575 | ||
577 | if (unlikely(size == 0)) | 576 | if (unlikely(size == 0)) |
578 | return ret; | 577 | return 0; |
579 | 578 | ||
579 | if (unlikely(uaddr > end)) | ||
580 | return -EFAULT; | ||
580 | /* | 581 | /* |
581 | * Writing zeroes into userspace here is OK, because we know that if | 582 | * Writing zeroes into userspace here is OK, because we know that if |
582 | * the zero gets there, we'll be overwriting it. | 583 | * the zero gets there, we'll be overwriting it. |
583 | */ | 584 | */ |
584 | while (uaddr <= end) { | 585 | do { |
585 | ret = __put_user(0, uaddr); | 586 | if (unlikely(__put_user(0, uaddr) != 0)) |
586 | if (ret != 0) | 587 | return -EFAULT; |
587 | return ret; | ||
588 | uaddr += PAGE_SIZE; | 588 | uaddr += PAGE_SIZE; |
589 | } | 589 | } while (uaddr <= end); |
590 | 590 | ||
591 | /* Check whether the range spilled into the next page. */ | 591 | /* Check whether the range spilled into the next page. */ |
592 | if (((unsigned long)uaddr & PAGE_MASK) == | 592 | if (((unsigned long)uaddr & PAGE_MASK) == |
593 | ((unsigned long)end & PAGE_MASK)) | 593 | ((unsigned long)end & PAGE_MASK)) |
594 | ret = __put_user(0, end); | 594 | return __put_user(0, end); |
595 | 595 | ||
596 | return ret; | 596 | return 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | static inline int fault_in_multipages_readable(const char __user *uaddr, | 599 | static inline int fault_in_multipages_readable(const char __user *uaddr, |
600 | int size) | 600 | int size) |
601 | { | 601 | { |
602 | volatile char c; | 602 | volatile char c; |
603 | int ret = 0; | ||
604 | const char __user *end = uaddr + size - 1; | 603 | const char __user *end = uaddr + size - 1; |
605 | 604 | ||
606 | if (unlikely(size == 0)) | 605 | if (unlikely(size == 0)) |
607 | return ret; | 606 | return 0; |
608 | 607 | ||
609 | while (uaddr <= end) { | 608 | if (unlikely(uaddr > end)) |
610 | ret = __get_user(c, uaddr); | 609 | return -EFAULT; |
611 | if (ret != 0) | 610 | |
612 | return ret; | 611 | do { |
612 | if (unlikely(__get_user(c, uaddr) != 0)) | ||
613 | return -EFAULT; | ||
613 | uaddr += PAGE_SIZE; | 614 | uaddr += PAGE_SIZE; |
614 | } | 615 | } while (uaddr <= end); |
615 | 616 | ||
616 | /* Check whether the range spilled into the next page. */ | 617 | /* Check whether the range spilled into the next page. */ |
617 | if (((unsigned long)uaddr & PAGE_MASK) == | 618 | if (((unsigned long)uaddr & PAGE_MASK) == |
618 | ((unsigned long)end & PAGE_MASK)) { | 619 | ((unsigned long)end & PAGE_MASK)) { |
619 | ret = __get_user(c, end); | 620 | return __get_user(c, end); |
620 | (void)c; | ||
621 | } | 621 | } |
622 | 622 | ||
623 | return ret; | 623 | (void)c; |
624 | return 0; | ||
624 | } | 625 | } |
625 | 626 | ||
626 | int add_to_page_cache_locked(struct page *page, struct address_space *mapping, | 627 | int add_to_page_cache_locked(struct page *page, struct address_space *mapping, |
diff --git a/include/linux/uio.h b/include/linux/uio.h index 1b5d1cd796e2..75b4aaf31a9d 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h | |||
@@ -76,7 +76,7 @@ size_t iov_iter_copy_from_user_atomic(struct page *page, | |||
76 | struct iov_iter *i, unsigned long offset, size_t bytes); | 76 | struct iov_iter *i, unsigned long offset, size_t bytes); |
77 | void iov_iter_advance(struct iov_iter *i, size_t bytes); | 77 | void iov_iter_advance(struct iov_iter *i, size_t bytes); |
78 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); | 78 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); |
79 | int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes); | 79 | #define iov_iter_fault_in_multipages_readable iov_iter_fault_in_readable |
80 | size_t iov_iter_single_seg_count(const struct iov_iter *i); | 80 | size_t iov_iter_single_seg_count(const struct iov_iter *i); |
81 | size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, | 81 | size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, |
82 | struct iov_iter *i); | 82 | struct iov_iter *i); |
diff --git a/include/media/cec.h b/include/media/cec.h index dc7854b855f3..fdb5d600e4bb 100644 --- a/include/media/cec.h +++ b/include/media/cec.h | |||
@@ -57,8 +57,8 @@ struct cec_devnode { | |||
57 | int minor; | 57 | int minor; |
58 | bool registered; | 58 | bool registered; |
59 | bool unregistered; | 59 | bool unregistered; |
60 | struct mutex fhs_lock; | ||
61 | struct list_head fhs; | 60 | struct list_head fhs; |
61 | struct mutex lock; | ||
62 | }; | 62 | }; |
63 | 63 | ||
64 | struct cec_adapter; | 64 | struct cec_adapter; |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 9b4c418bebd8..fd60eccb59a6 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -52,7 +52,7 @@ struct unix_sock { | |||
52 | struct sock sk; | 52 | struct sock sk; |
53 | struct unix_address *addr; | 53 | struct unix_address *addr; |
54 | struct path path; | 54 | struct path path; |
55 | struct mutex readlock; | 55 | struct mutex iolock, bindlock; |
56 | struct sock *peer; | 56 | struct sock *peer; |
57 | struct list_head link; | 57 | struct list_head link; |
58 | atomic_long_t inflight; | 58 | atomic_long_t inflight; |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9c23f4d33e06..beb7610d64e9 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1102,6 +1102,7 @@ struct station_info { | |||
1102 | struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; | 1102 | struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1]; |
1103 | }; | 1103 | }; |
1104 | 1104 | ||
1105 | #if IS_ENABLED(CONFIG_CFG80211) | ||
1105 | /** | 1106 | /** |
1106 | * cfg80211_get_station - retrieve information about a given station | 1107 | * cfg80211_get_station - retrieve information about a given station |
1107 | * @dev: the device where the station is supposed to be connected to | 1108 | * @dev: the device where the station is supposed to be connected to |
@@ -1114,6 +1115,14 @@ struct station_info { | |||
1114 | */ | 1115 | */ |
1115 | int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, | 1116 | int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr, |
1116 | struct station_info *sinfo); | 1117 | struct station_info *sinfo); |
1118 | #else | ||
1119 | static inline int cfg80211_get_station(struct net_device *dev, | ||
1120 | const u8 *mac_addr, | ||
1121 | struct station_info *sinfo) | ||
1122 | { | ||
1123 | return -ENOENT; | ||
1124 | } | ||
1125 | #endif | ||
1117 | 1126 | ||
1118 | /** | 1127 | /** |
1119 | * enum monitor_flags - monitor flags | 1128 | * enum monitor_flags - monitor flags |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 4079fc18ffe4..7d4a72e75f33 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -111,6 +111,7 @@ struct fib_info { | |||
111 | unsigned char fib_scope; | 111 | unsigned char fib_scope; |
112 | unsigned char fib_type; | 112 | unsigned char fib_type; |
113 | __be32 fib_prefsrc; | 113 | __be32 fib_prefsrc; |
114 | u32 fib_tb_id; | ||
114 | u32 fib_priority; | 115 | u32 fib_priority; |
115 | u32 *fib_metrics; | 116 | u32 *fib_metrics; |
116 | #define fib_mtu fib_metrics[RTAX_MTU-1] | 117 | #define fib_mtu fib_metrics[RTAX_MTU-1] |
@@ -319,7 +320,7 @@ void fib_flush_external(struct net *net); | |||
319 | /* Exported by fib_semantics.c */ | 320 | /* Exported by fib_semantics.c */ |
320 | int ip_fib_check_default(__be32 gw, struct net_device *dev); | 321 | int ip_fib_check_default(__be32 gw, struct net_device *dev); |
321 | int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); | 322 | int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force); |
322 | int fib_sync_down_addr(struct net *net, __be32 local); | 323 | int fib_sync_down_addr(struct net_device *dev, __be32 local); |
323 | int fib_sync_up(struct net_device *dev, unsigned int nh_flags); | 324 | int fib_sync_up(struct net_device *dev, unsigned int nh_flags); |
324 | 325 | ||
325 | extern u32 fib_multipath_secret __read_mostly; | 326 | extern u32 fib_multipath_secret __read_mostly; |
diff --git a/include/net/netfilter/nf_conntrack_synproxy.h b/include/net/netfilter/nf_conntrack_synproxy.h index 6793614e6502..e6937318546c 100644 --- a/include/net/netfilter/nf_conntrack_synproxy.h +++ b/include/net/netfilter/nf_conntrack_synproxy.h | |||
@@ -27,6 +27,20 @@ static inline struct nf_conn_synproxy *nfct_synproxy_ext_add(struct nf_conn *ct) | |||
27 | #endif | 27 | #endif |
28 | } | 28 | } |
29 | 29 | ||
30 | static inline bool nf_ct_add_synproxy(struct nf_conn *ct, | ||
31 | const struct nf_conn *tmpl) | ||
32 | { | ||
33 | if (tmpl && nfct_synproxy(tmpl)) { | ||
34 | if (!nfct_seqadj_ext_add(ct)) | ||
35 | return false; | ||
36 | |||
37 | if (!nfct_synproxy_ext_add(ct)) | ||
38 | return false; | ||
39 | } | ||
40 | |||
41 | return true; | ||
42 | } | ||
43 | |||
30 | struct synproxy_stats { | 44 | struct synproxy_stats { |
31 | unsigned int syn_received; | 45 | unsigned int syn_received; |
32 | unsigned int cookie_invalid; | 46 | unsigned int cookie_invalid; |
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h index d27588c8dbd9..1139cde0fdc5 100644 --- a/include/net/netfilter/nft_meta.h +++ b/include/net/netfilter/nft_meta.h | |||
@@ -36,4 +36,8 @@ void nft_meta_set_eval(const struct nft_expr *expr, | |||
36 | void nft_meta_set_destroy(const struct nft_ctx *ctx, | 36 | void nft_meta_set_destroy(const struct nft_ctx *ctx, |
37 | const struct nft_expr *expr); | 37 | const struct nft_expr *expr); |
38 | 38 | ||
39 | int nft_meta_set_validate(const struct nft_ctx *ctx, | ||
40 | const struct nft_expr *expr, | ||
41 | const struct nft_data **data); | ||
42 | |||
39 | #endif | 43 | #endif |
diff --git a/include/net/netfilter/nft_reject.h b/include/net/netfilter/nft_reject.h index 60fa1530006b..02e28c529b29 100644 --- a/include/net/netfilter/nft_reject.h +++ b/include/net/netfilter/nft_reject.h | |||
@@ -8,6 +8,10 @@ struct nft_reject { | |||
8 | 8 | ||
9 | extern const struct nla_policy nft_reject_policy[]; | 9 | extern const struct nla_policy nft_reject_policy[]; |
10 | 10 | ||
11 | int nft_reject_validate(const struct nft_ctx *ctx, | ||
12 | const struct nft_expr *expr, | ||
13 | const struct nft_data **data); | ||
14 | |||
11 | int nft_reject_init(const struct nft_ctx *ctx, | 15 | int nft_reject_init(const struct nft_ctx *ctx, |
12 | const struct nft_expr *expr, | 16 | const struct nft_expr *expr, |
13 | const struct nlattr * const tb[]); | 17 | const struct nlattr * const tb[]); |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index efc01743b9d6..bafe2a0ab908 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -382,7 +382,7 @@ enum { | |||
382 | ADDIP_SERIAL_SIGN_BIT = (1<<31) | 382 | ADDIP_SERIAL_SIGN_BIT = (1<<31) |
383 | }; | 383 | }; |
384 | 384 | ||
385 | static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) | 385 | static inline int ADDIP_SERIAL_gte(__u32 s, __u32 t) |
386 | { | 386 | { |
387 | return ((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT); | 387 | return ((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT); |
388 | } | 388 | } |
diff --git a/include/net/sock.h b/include/net/sock.h index ff5be7e8ddea..8741988e6880 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1332,6 +1332,16 @@ static inline void sk_mem_uncharge(struct sock *sk, int size) | |||
1332 | if (!sk_has_account(sk)) | 1332 | if (!sk_has_account(sk)) |
1333 | return; | 1333 | return; |
1334 | sk->sk_forward_alloc += size; | 1334 | sk->sk_forward_alloc += size; |
1335 | |||
1336 | /* Avoid a possible overflow. | ||
1337 | * TCP send queues can make this happen, if sk_mem_reclaim() | ||
1338 | * is not called and more than 2 GBytes are released at once. | ||
1339 | * | ||
1340 | * If we reach 2 MBytes, reclaim 1 MBytes right now, there is | ||
1341 | * no need to hold that much forward allocation anyway. | ||
1342 | */ | ||
1343 | if (unlikely(sk->sk_forward_alloc >= 1 << 21)) | ||
1344 | __sk_mem_reclaim(sk, 1 << 20); | ||
1335 | } | 1345 | } |
1336 | 1346 | ||
1337 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | 1347 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index adfebd6f243c..17934312eecb 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -1540,8 +1540,10 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); | |||
1540 | void xfrm4_local_error(struct sk_buff *skb, u32 mtu); | 1540 | void xfrm4_local_error(struct sk_buff *skb, u32 mtu); |
1541 | int xfrm6_extract_header(struct sk_buff *skb); | 1541 | int xfrm6_extract_header(struct sk_buff *skb); |
1542 | int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); | 1542 | int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); |
1543 | int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); | 1543 | int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, |
1544 | struct ip6_tnl *t); | ||
1544 | int xfrm6_transport_finish(struct sk_buff *skb, int async); | 1545 | int xfrm6_transport_finish(struct sk_buff *skb, int async); |
1546 | int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t); | ||
1545 | int xfrm6_rcv(struct sk_buff *skb); | 1547 | int xfrm6_rcv(struct sk_buff *skb); |
1546 | int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | 1548 | int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
1547 | xfrm_address_t *saddr, u8 proto); | 1549 | xfrm_address_t *saddr, u8 proto); |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index d1c51b7f5221..5e8dab5bf9ad 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -6270,6 +6270,12 @@ void cgroup_sk_alloc(struct sock_cgroup_data *skcd) | |||
6270 | if (cgroup_sk_alloc_disabled) | 6270 | if (cgroup_sk_alloc_disabled) |
6271 | return; | 6271 | return; |
6272 | 6272 | ||
6273 | /* Socket clone path */ | ||
6274 | if (skcd->val) { | ||
6275 | cgroup_get(sock_cgroup_ptr(skcd)); | ||
6276 | return; | ||
6277 | } | ||
6278 | |||
6273 | rcu_read_lock(); | 6279 | rcu_read_lock(); |
6274 | 6280 | ||
6275 | while (true) { | 6281 | while (true) { |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 3cfabdf7b942..fc9bb2225291 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -2496,11 +2496,11 @@ static int __perf_event_stop(void *info) | |||
2496 | return 0; | 2496 | return 0; |
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | static int perf_event_restart(struct perf_event *event) | 2499 | static int perf_event_stop(struct perf_event *event, int restart) |
2500 | { | 2500 | { |
2501 | struct stop_event_data sd = { | 2501 | struct stop_event_data sd = { |
2502 | .event = event, | 2502 | .event = event, |
2503 | .restart = 1, | 2503 | .restart = restart, |
2504 | }; | 2504 | }; |
2505 | int ret = 0; | 2505 | int ret = 0; |
2506 | 2506 | ||
@@ -3549,10 +3549,18 @@ static int perf_event_read(struct perf_event *event, bool group) | |||
3549 | .group = group, | 3549 | .group = group, |
3550 | .ret = 0, | 3550 | .ret = 0, |
3551 | }; | 3551 | }; |
3552 | ret = smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); | 3552 | /* |
3553 | /* The event must have been read from an online CPU: */ | 3553 | * Purposely ignore the smp_call_function_single() return |
3554 | WARN_ON_ONCE(ret); | 3554 | * value. |
3555 | ret = ret ? : data.ret; | 3555 | * |
3556 | * If event->oncpu isn't a valid CPU it means the event got | ||
3557 | * scheduled out and that will have updated the event count. | ||
3558 | * | ||
3559 | * Therefore, either way, we'll have an up-to-date event count | ||
3560 | * after this. | ||
3561 | */ | ||
3562 | (void)smp_call_function_single(event->oncpu, __perf_event_read, &data, 1); | ||
3563 | ret = data.ret; | ||
3556 | } else if (event->state == PERF_EVENT_STATE_INACTIVE) { | 3564 | } else if (event->state == PERF_EVENT_STATE_INACTIVE) { |
3557 | struct perf_event_context *ctx = event->ctx; | 3565 | struct perf_event_context *ctx = event->ctx; |
3558 | unsigned long flags; | 3566 | unsigned long flags; |
@@ -3921,7 +3929,7 @@ static void exclusive_event_destroy(struct perf_event *event) | |||
3921 | 3929 | ||
3922 | static bool exclusive_event_match(struct perf_event *e1, struct perf_event *e2) | 3930 | static bool exclusive_event_match(struct perf_event *e1, struct perf_event *e2) |
3923 | { | 3931 | { |
3924 | if ((e1->pmu->capabilities & PERF_PMU_CAP_EXCLUSIVE) && | 3932 | if ((e1->pmu == e2->pmu) && |
3925 | (e1->cpu == e2->cpu || | 3933 | (e1->cpu == e2->cpu || |
3926 | e1->cpu == -1 || | 3934 | e1->cpu == -1 || |
3927 | e2->cpu == -1)) | 3935 | e2->cpu == -1)) |
@@ -4837,6 +4845,19 @@ static void ring_buffer_attach(struct perf_event *event, | |||
4837 | spin_unlock_irqrestore(&rb->event_lock, flags); | 4845 | spin_unlock_irqrestore(&rb->event_lock, flags); |
4838 | } | 4846 | } |
4839 | 4847 | ||
4848 | /* | ||
4849 | * Avoid racing with perf_mmap_close(AUX): stop the event | ||
4850 | * before swizzling the event::rb pointer; if it's getting | ||
4851 | * unmapped, its aux_mmap_count will be 0 and it won't | ||
4852 | * restart. See the comment in __perf_pmu_output_stop(). | ||
4853 | * | ||
4854 | * Data will inevitably be lost when set_output is done in | ||
4855 | * mid-air, but then again, whoever does it like this is | ||
4856 | * not in for the data anyway. | ||
4857 | */ | ||
4858 | if (has_aux(event)) | ||
4859 | perf_event_stop(event, 0); | ||
4860 | |||
4840 | rcu_assign_pointer(event->rb, rb); | 4861 | rcu_assign_pointer(event->rb, rb); |
4841 | 4862 | ||
4842 | if (old_rb) { | 4863 | if (old_rb) { |
@@ -6112,7 +6133,7 @@ static void perf_event_addr_filters_exec(struct perf_event *event, void *data) | |||
6112 | raw_spin_unlock_irqrestore(&ifh->lock, flags); | 6133 | raw_spin_unlock_irqrestore(&ifh->lock, flags); |
6113 | 6134 | ||
6114 | if (restart) | 6135 | if (restart) |
6115 | perf_event_restart(event); | 6136 | perf_event_stop(event, 1); |
6116 | } | 6137 | } |
6117 | 6138 | ||
6118 | void perf_event_exec(void) | 6139 | void perf_event_exec(void) |
@@ -6156,7 +6177,13 @@ static void __perf_event_output_stop(struct perf_event *event, void *data) | |||
6156 | 6177 | ||
6157 | /* | 6178 | /* |
6158 | * In case of inheritance, it will be the parent that links to the | 6179 | * In case of inheritance, it will be the parent that links to the |
6159 | * ring-buffer, but it will be the child that's actually using it: | 6180 | * ring-buffer, but it will be the child that's actually using it. |
6181 | * | ||
6182 | * We are using event::rb to determine if the event should be stopped, | ||
6183 | * however this may race with ring_buffer_attach() (through set_output), | ||
6184 | * which will make us skip the event that actually needs to be stopped. | ||
6185 | * So ring_buffer_attach() has to stop an aux event before re-assigning | ||
6186 | * its rb pointer. | ||
6160 | */ | 6187 | */ |
6161 | if (rcu_dereference(parent->rb) == rb) | 6188 | if (rcu_dereference(parent->rb) == rb) |
6162 | ro->err = __perf_event_stop(&sd); | 6189 | ro->err = __perf_event_stop(&sd); |
@@ -6670,7 +6697,7 @@ static void __perf_addr_filters_adjust(struct perf_event *event, void *data) | |||
6670 | raw_spin_unlock_irqrestore(&ifh->lock, flags); | 6697 | raw_spin_unlock_irqrestore(&ifh->lock, flags); |
6671 | 6698 | ||
6672 | if (restart) | 6699 | if (restart) |
6673 | perf_event_restart(event); | 6700 | perf_event_stop(event, 1); |
6674 | } | 6701 | } |
6675 | 6702 | ||
6676 | /* | 6703 | /* |
@@ -7859,7 +7886,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) | |||
7859 | mmput(mm); | 7886 | mmput(mm); |
7860 | 7887 | ||
7861 | restart: | 7888 | restart: |
7862 | perf_event_restart(event); | 7889 | perf_event_stop(event, 1); |
7863 | } | 7890 | } |
7864 | 7891 | ||
7865 | /* | 7892 | /* |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index ae9b90dc9a5a..257fa460b846 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -330,15 +330,22 @@ void *perf_aux_output_begin(struct perf_output_handle *handle, | |||
330 | if (!rb) | 330 | if (!rb) |
331 | return NULL; | 331 | return NULL; |
332 | 332 | ||
333 | if (!rb_has_aux(rb) || !atomic_inc_not_zero(&rb->aux_refcount)) | 333 | if (!rb_has_aux(rb)) |
334 | goto err; | 334 | goto err; |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * If rb::aux_mmap_count is zero (and rb_has_aux() above went through), | 337 | * If aux_mmap_count is zero, the aux buffer is in perf_mmap_close(), |
338 | * the aux buffer is in perf_mmap_close(), about to get freed. | 338 | * about to get freed, so we leave immediately. |
339 | * | ||
340 | * Checking rb::aux_mmap_count and rb::refcount has to be done in | ||
341 | * the same order, see perf_mmap_close. Otherwise we end up freeing | ||
342 | * aux pages in this path, which is a bug, because in_atomic(). | ||
339 | */ | 343 | */ |
340 | if (!atomic_read(&rb->aux_mmap_count)) | 344 | if (!atomic_read(&rb->aux_mmap_count)) |
341 | goto err_put; | 345 | goto err; |
346 | |||
347 | if (!atomic_inc_not_zero(&rb->aux_refcount)) | ||
348 | goto err; | ||
342 | 349 | ||
343 | /* | 350 | /* |
344 | * Nesting is not supported for AUX area, make sure nested | 351 | * Nesting is not supported for AUX area, make sure nested |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 637389088b3f..26ba5654d9d5 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -820,6 +820,8 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle, | |||
820 | desc->name = name; | 820 | desc->name = name; |
821 | 821 | ||
822 | if (handle != handle_bad_irq && is_chained) { | 822 | if (handle != handle_bad_irq && is_chained) { |
823 | unsigned int type = irqd_get_trigger_type(&desc->irq_data); | ||
824 | |||
823 | /* | 825 | /* |
824 | * We're about to start this interrupt immediately, | 826 | * We're about to start this interrupt immediately, |
825 | * hence the need to set the trigger configuration. | 827 | * hence the need to set the trigger configuration. |
@@ -828,8 +830,10 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle, | |||
828 | * chained interrupt. Reset it immediately because we | 830 | * chained interrupt. Reset it immediately because we |
829 | * do know better. | 831 | * do know better. |
830 | */ | 832 | */ |
831 | __irq_set_trigger(desc, irqd_get_trigger_type(&desc->irq_data)); | 833 | if (type != IRQ_TYPE_NONE) { |
832 | desc->handle_irq = handle; | 834 | __irq_set_trigger(desc, type); |
835 | desc->handle_irq = handle; | ||
836 | } | ||
833 | 837 | ||
834 | irq_settings_set_noprobe(desc); | 838 | irq_settings_set_noprobe(desc); |
835 | irq_settings_set_norequest(desc); | 839 | irq_settings_set_norequest(desc); |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2a906f20fba7..44817c640e99 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2016,6 +2016,28 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) | |||
2016 | success = 1; /* we're going to change ->state */ | 2016 | success = 1; /* we're going to change ->state */ |
2017 | cpu = task_cpu(p); | 2017 | cpu = task_cpu(p); |
2018 | 2018 | ||
2019 | /* | ||
2020 | * Ensure we load p->on_rq _after_ p->state, otherwise it would | ||
2021 | * be possible to, falsely, observe p->on_rq == 0 and get stuck | ||
2022 | * in smp_cond_load_acquire() below. | ||
2023 | * | ||
2024 | * sched_ttwu_pending() try_to_wake_up() | ||
2025 | * [S] p->on_rq = 1; [L] P->state | ||
2026 | * UNLOCK rq->lock -----. | ||
2027 | * \ | ||
2028 | * +--- RMB | ||
2029 | * schedule() / | ||
2030 | * LOCK rq->lock -----' | ||
2031 | * UNLOCK rq->lock | ||
2032 | * | ||
2033 | * [task p] | ||
2034 | * [S] p->state = UNINTERRUPTIBLE [L] p->on_rq | ||
2035 | * | ||
2036 | * Pairs with the UNLOCK+LOCK on rq->lock from the | ||
2037 | * last wakeup of our task and the schedule that got our task | ||
2038 | * current. | ||
2039 | */ | ||
2040 | smp_rmb(); | ||
2019 | if (p->on_rq && ttwu_remote(p, wake_flags)) | 2041 | if (p->on_rq && ttwu_remote(p, wake_flags)) |
2020 | goto stat; | 2042 | goto stat; |
2021 | 2043 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index dade4c9559cc..7bc56762ca35 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -5124,19 +5124,20 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, | |||
5124 | struct trace_iterator *iter = filp->private_data; | 5124 | struct trace_iterator *iter = filp->private_data; |
5125 | ssize_t sret; | 5125 | ssize_t sret; |
5126 | 5126 | ||
5127 | /* return any leftover data */ | ||
5128 | sret = trace_seq_to_user(&iter->seq, ubuf, cnt); | ||
5129 | if (sret != -EBUSY) | ||
5130 | return sret; | ||
5131 | |||
5132 | trace_seq_init(&iter->seq); | ||
5133 | |||
5134 | /* | 5127 | /* |
5135 | * Avoid more than one consumer on a single file descriptor | 5128 | * Avoid more than one consumer on a single file descriptor |
5136 | * This is just a matter of traces coherency, the ring buffer itself | 5129 | * This is just a matter of traces coherency, the ring buffer itself |
5137 | * is protected. | 5130 | * is protected. |
5138 | */ | 5131 | */ |
5139 | mutex_lock(&iter->mutex); | 5132 | mutex_lock(&iter->mutex); |
5133 | |||
5134 | /* return any leftover data */ | ||
5135 | sret = trace_seq_to_user(&iter->seq, ubuf, cnt); | ||
5136 | if (sret != -EBUSY) | ||
5137 | goto out; | ||
5138 | |||
5139 | trace_seq_init(&iter->seq); | ||
5140 | |||
5140 | if (iter->trace->read) { | 5141 | if (iter->trace->read) { |
5141 | sret = iter->trace->read(iter, filp, ubuf, cnt, ppos); | 5142 | sret = iter->trace->read(iter, filp, ubuf, cnt, ppos); |
5142 | if (sret) | 5143 | if (sret) |
@@ -6163,9 +6164,6 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
6163 | return -EBUSY; | 6164 | return -EBUSY; |
6164 | #endif | 6165 | #endif |
6165 | 6166 | ||
6166 | if (splice_grow_spd(pipe, &spd)) | ||
6167 | return -ENOMEM; | ||
6168 | |||
6169 | if (*ppos & (PAGE_SIZE - 1)) | 6167 | if (*ppos & (PAGE_SIZE - 1)) |
6170 | return -EINVAL; | 6168 | return -EINVAL; |
6171 | 6169 | ||
@@ -6175,6 +6173,9 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
6175 | len &= PAGE_MASK; | 6173 | len &= PAGE_MASK; |
6176 | } | 6174 | } |
6177 | 6175 | ||
6176 | if (splice_grow_spd(pipe, &spd)) | ||
6177 | return -ENOMEM; | ||
6178 | |||
6178 | again: | 6179 | again: |
6179 | trace_access_lock(iter->cpu_file); | 6180 | trace_access_lock(iter->cpu_file); |
6180 | entries = ring_buffer_entries_cpu(iter->trace_buffer->buffer, iter->cpu_file); | 6181 | entries = ring_buffer_entries_cpu(iter->trace_buffer->buffer, iter->cpu_file); |
@@ -6232,19 +6233,21 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
6232 | /* did we read anything? */ | 6233 | /* did we read anything? */ |
6233 | if (!spd.nr_pages) { | 6234 | if (!spd.nr_pages) { |
6234 | if (ret) | 6235 | if (ret) |
6235 | return ret; | 6236 | goto out; |
6236 | 6237 | ||
6238 | ret = -EAGAIN; | ||
6237 | if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) | 6239 | if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) |
6238 | return -EAGAIN; | 6240 | goto out; |
6239 | 6241 | ||
6240 | ret = wait_on_pipe(iter, true); | 6242 | ret = wait_on_pipe(iter, true); |
6241 | if (ret) | 6243 | if (ret) |
6242 | return ret; | 6244 | goto out; |
6243 | 6245 | ||
6244 | goto again; | 6246 | goto again; |
6245 | } | 6247 | } |
6246 | 6248 | ||
6247 | ret = splice_to_pipe(pipe, &spd); | 6249 | ret = splice_to_pipe(pipe, &spd); |
6250 | out: | ||
6248 | splice_shrink_spd(&spd); | 6251 | splice_shrink_spd(&spd); |
6249 | 6252 | ||
6250 | return ret; | 6253 | return ret; |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 2e2cca509231..cab7405f48d2 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -821,7 +821,7 @@ config DETECT_HUNG_TASK | |||
821 | help | 821 | help |
822 | Say Y here to enable the kernel to detect "hung tasks", | 822 | Say Y here to enable the kernel to detect "hung tasks", |
823 | which are bugs that cause the task to be stuck in | 823 | which are bugs that cause the task to be stuck in |
824 | uninterruptible "D" state indefinitiley. | 824 | uninterruptible "D" state indefinitely. |
825 | 825 | ||
826 | When a hung task is detected, the kernel will print the | 826 | When a hung task is detected, the kernel will print the |
827 | current stack trace (which you should report), but the | 827 | current stack trace (which you should report), but the |
diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 9e8c7386b3a0..7e3138cfc8c9 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c | |||
@@ -291,33 +291,13 @@ done: | |||
291 | } | 291 | } |
292 | 292 | ||
293 | /* | 293 | /* |
294 | * Fault in the first iovec of the given iov_iter, to a maximum length | ||
295 | * of bytes. Returns 0 on success, or non-zero if the memory could not be | ||
296 | * accessed (ie. because it is an invalid address). | ||
297 | * | ||
298 | * writev-intensive code may want this to prefault several iovecs -- that | ||
299 | * would be possible (callers must not rely on the fact that _only_ the | ||
300 | * first iovec will be faulted with the current implementation). | ||
301 | */ | ||
302 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) | ||
303 | { | ||
304 | if (!(i->type & (ITER_BVEC|ITER_KVEC))) { | ||
305 | char __user *buf = i->iov->iov_base + i->iov_offset; | ||
306 | bytes = min(bytes, i->iov->iov_len - i->iov_offset); | ||
307 | return fault_in_pages_readable(buf, bytes); | ||
308 | } | ||
309 | return 0; | ||
310 | } | ||
311 | EXPORT_SYMBOL(iov_iter_fault_in_readable); | ||
312 | |||
313 | /* | ||
314 | * Fault in one or more iovecs of the given iov_iter, to a maximum length of | 294 | * Fault in one or more iovecs of the given iov_iter, to a maximum length of |
315 | * bytes. For each iovec, fault in each page that constitutes the iovec. | 295 | * bytes. For each iovec, fault in each page that constitutes the iovec. |
316 | * | 296 | * |
317 | * Return 0 on success, or non-zero if the memory could not be accessed (i.e. | 297 | * Return 0 on success, or non-zero if the memory could not be accessed (i.e. |
318 | * because it is an invalid address). | 298 | * because it is an invalid address). |
319 | */ | 299 | */ |
320 | int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) | 300 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes) |
321 | { | 301 | { |
322 | size_t skip = i->iov_offset; | 302 | size_t skip = i->iov_offset; |
323 | const struct iovec *iov; | 303 | const struct iovec *iov; |
@@ -334,7 +314,7 @@ int iov_iter_fault_in_multipages_readable(struct iov_iter *i, size_t bytes) | |||
334 | } | 314 | } |
335 | return 0; | 315 | return 0; |
336 | } | 316 | } |
337 | EXPORT_SYMBOL(iov_iter_fault_in_multipages_readable); | 317 | EXPORT_SYMBOL(iov_iter_fault_in_readable); |
338 | 318 | ||
339 | void iov_iter_init(struct iov_iter *i, int direction, | 319 | void iov_iter_init(struct iov_iter *i, int direction, |
340 | const struct iovec *iov, unsigned long nr_segs, | 320 | const struct iovec *iov, unsigned long nr_segs, |
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 1b7bf7314141..91f0727e3cad 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -105,10 +105,10 @@ static unsigned int radix_tree_descend(struct radix_tree_node *parent, | |||
105 | 105 | ||
106 | #ifdef CONFIG_RADIX_TREE_MULTIORDER | 106 | #ifdef CONFIG_RADIX_TREE_MULTIORDER |
107 | if (radix_tree_is_internal_node(entry)) { | 107 | if (radix_tree_is_internal_node(entry)) { |
108 | unsigned long siboff = get_slot_offset(parent, entry); | 108 | if (is_sibling_entry(parent, entry)) { |
109 | if (siboff < RADIX_TREE_MAP_SIZE) { | 109 | void **sibentry = (void **) entry_to_node(entry); |
110 | offset = siboff; | 110 | offset = get_slot_offset(parent, sibentry); |
111 | entry = rcu_dereference_raw(parent->slots[offset]); | 111 | entry = rcu_dereference_raw(*sibentry); |
112 | } | 112 | } |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
diff --git a/mm/debug.c b/mm/debug.c index 8865bfb41b0b..74c7cae4f683 100644 --- a/mm/debug.c +++ b/mm/debug.c | |||
@@ -42,9 +42,11 @@ const struct trace_print_flags vmaflag_names[] = { | |||
42 | 42 | ||
43 | void __dump_page(struct page *page, const char *reason) | 43 | void __dump_page(struct page *page, const char *reason) |
44 | { | 44 | { |
45 | int mapcount = PageSlab(page) ? 0 : page_mapcount(page); | ||
46 | |||
45 | pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", | 47 | pr_emerg("page:%p count:%d mapcount:%d mapping:%p index:%#lx", |
46 | page, page_ref_count(page), page_mapcount(page), | 48 | page, page_ref_count(page), mapcount, |
47 | page->mapping, page->index); | 49 | page->mapping, page_to_pgoff(page)); |
48 | if (PageCompound(page)) | 50 | if (PageCompound(page)) |
49 | pr_cont(" compound_mapcount: %d", compound_mapcount(page)); | 51 | pr_cont(" compound_mapcount: %d", compound_mapcount(page)); |
50 | pr_cont("\n"); | 52 | pr_cont("\n"); |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a6abd76baa72..53ae6d00656a 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1138,9 +1138,6 @@ int do_huge_pmd_numa_page(struct fault_env *fe, pmd_t pmd) | |||
1138 | bool was_writable; | 1138 | bool was_writable; |
1139 | int flags = 0; | 1139 | int flags = 0; |
1140 | 1140 | ||
1141 | /* A PROT_NONE fault should not end up here */ | ||
1142 | BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))); | ||
1143 | |||
1144 | fe->ptl = pmd_lock(vma->vm_mm, fe->pmd); | 1141 | fe->ptl = pmd_lock(vma->vm_mm, fe->pmd); |
1145 | if (unlikely(!pmd_same(pmd, *fe->pmd))) | 1142 | if (unlikely(!pmd_same(pmd, *fe->pmd))) |
1146 | goto out_unlock; | 1143 | goto out_unlock; |
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 79c52d0061af..728d7790dc2d 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c | |||
@@ -838,7 +838,8 @@ static bool hugepage_vma_check(struct vm_area_struct *vma) | |||
838 | * value (scan code). | 838 | * value (scan code). |
839 | */ | 839 | */ |
840 | 840 | ||
841 | static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address) | 841 | static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address, |
842 | struct vm_area_struct **vmap) | ||
842 | { | 843 | { |
843 | struct vm_area_struct *vma; | 844 | struct vm_area_struct *vma; |
844 | unsigned long hstart, hend; | 845 | unsigned long hstart, hend; |
@@ -846,7 +847,7 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address) | |||
846 | if (unlikely(khugepaged_test_exit(mm))) | 847 | if (unlikely(khugepaged_test_exit(mm))) |
847 | return SCAN_ANY_PROCESS; | 848 | return SCAN_ANY_PROCESS; |
848 | 849 | ||
849 | vma = find_vma(mm, address); | 850 | *vmap = vma = find_vma(mm, address); |
850 | if (!vma) | 851 | if (!vma) |
851 | return SCAN_VMA_NULL; | 852 | return SCAN_VMA_NULL; |
852 | 853 | ||
@@ -881,6 +882,11 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, | |||
881 | .pmd = pmd, | 882 | .pmd = pmd, |
882 | }; | 883 | }; |
883 | 884 | ||
885 | /* we only decide to swapin, if there is enough young ptes */ | ||
886 | if (referenced < HPAGE_PMD_NR/2) { | ||
887 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); | ||
888 | return false; | ||
889 | } | ||
884 | fe.pte = pte_offset_map(pmd, address); | 890 | fe.pte = pte_offset_map(pmd, address); |
885 | for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE; | 891 | for (; fe.address < address + HPAGE_PMD_NR*PAGE_SIZE; |
886 | fe.pte++, fe.address += PAGE_SIZE) { | 892 | fe.pte++, fe.address += PAGE_SIZE) { |
@@ -888,17 +894,12 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, | |||
888 | if (!is_swap_pte(pteval)) | 894 | if (!is_swap_pte(pteval)) |
889 | continue; | 895 | continue; |
890 | swapped_in++; | 896 | swapped_in++; |
891 | /* we only decide to swapin, if there is enough young ptes */ | ||
892 | if (referenced < HPAGE_PMD_NR/2) { | ||
893 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); | ||
894 | return false; | ||
895 | } | ||
896 | ret = do_swap_page(&fe, pteval); | 897 | ret = do_swap_page(&fe, pteval); |
897 | 898 | ||
898 | /* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */ | 899 | /* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */ |
899 | if (ret & VM_FAULT_RETRY) { | 900 | if (ret & VM_FAULT_RETRY) { |
900 | down_read(&mm->mmap_sem); | 901 | down_read(&mm->mmap_sem); |
901 | if (hugepage_vma_revalidate(mm, address)) { | 902 | if (hugepage_vma_revalidate(mm, address, &fe.vma)) { |
902 | /* vma is no longer available, don't continue to swapin */ | 903 | /* vma is no longer available, don't continue to swapin */ |
903 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); | 904 | trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); |
904 | return false; | 905 | return false; |
@@ -923,7 +924,6 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, | |||
923 | static void collapse_huge_page(struct mm_struct *mm, | 924 | static void collapse_huge_page(struct mm_struct *mm, |
924 | unsigned long address, | 925 | unsigned long address, |
925 | struct page **hpage, | 926 | struct page **hpage, |
926 | struct vm_area_struct *vma, | ||
927 | int node, int referenced) | 927 | int node, int referenced) |
928 | { | 928 | { |
929 | pmd_t *pmd, _pmd; | 929 | pmd_t *pmd, _pmd; |
@@ -933,6 +933,7 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
933 | spinlock_t *pmd_ptl, *pte_ptl; | 933 | spinlock_t *pmd_ptl, *pte_ptl; |
934 | int isolated = 0, result = 0; | 934 | int isolated = 0, result = 0; |
935 | struct mem_cgroup *memcg; | 935 | struct mem_cgroup *memcg; |
936 | struct vm_area_struct *vma; | ||
936 | unsigned long mmun_start; /* For mmu_notifiers */ | 937 | unsigned long mmun_start; /* For mmu_notifiers */ |
937 | unsigned long mmun_end; /* For mmu_notifiers */ | 938 | unsigned long mmun_end; /* For mmu_notifiers */ |
938 | gfp_t gfp; | 939 | gfp_t gfp; |
@@ -961,7 +962,7 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
961 | } | 962 | } |
962 | 963 | ||
963 | down_read(&mm->mmap_sem); | 964 | down_read(&mm->mmap_sem); |
964 | result = hugepage_vma_revalidate(mm, address); | 965 | result = hugepage_vma_revalidate(mm, address, &vma); |
965 | if (result) { | 966 | if (result) { |
966 | mem_cgroup_cancel_charge(new_page, memcg, true); | 967 | mem_cgroup_cancel_charge(new_page, memcg, true); |
967 | up_read(&mm->mmap_sem); | 968 | up_read(&mm->mmap_sem); |
@@ -994,7 +995,7 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
994 | * handled by the anon_vma lock + PG_lock. | 995 | * handled by the anon_vma lock + PG_lock. |
995 | */ | 996 | */ |
996 | down_write(&mm->mmap_sem); | 997 | down_write(&mm->mmap_sem); |
997 | result = hugepage_vma_revalidate(mm, address); | 998 | result = hugepage_vma_revalidate(mm, address, &vma); |
998 | if (result) | 999 | if (result) |
999 | goto out; | 1000 | goto out; |
1000 | /* check if the pmd is still valid */ | 1001 | /* check if the pmd is still valid */ |
@@ -1202,7 +1203,7 @@ out_unmap: | |||
1202 | if (ret) { | 1203 | if (ret) { |
1203 | node = khugepaged_find_target_node(); | 1204 | node = khugepaged_find_target_node(); |
1204 | /* collapse_huge_page will return with the mmap_sem released */ | 1205 | /* collapse_huge_page will return with the mmap_sem released */ |
1205 | collapse_huge_page(mm, address, hpage, vma, node, referenced); | 1206 | collapse_huge_page(mm, address, hpage, node, referenced); |
1206 | } | 1207 | } |
1207 | out: | 1208 | out: |
1208 | trace_mm_khugepaged_scan_pmd(mm, page, writable, referenced, | 1209 | trace_mm_khugepaged_scan_pmd(mm, page, writable, referenced, |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9a6a51a7c416..4be518d4e68a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1740,17 +1740,22 @@ static DEFINE_MUTEX(percpu_charge_mutex); | |||
1740 | static bool consume_stock(struct mem_cgroup *memcg, unsigned int nr_pages) | 1740 | static bool consume_stock(struct mem_cgroup *memcg, unsigned int nr_pages) |
1741 | { | 1741 | { |
1742 | struct memcg_stock_pcp *stock; | 1742 | struct memcg_stock_pcp *stock; |
1743 | unsigned long flags; | ||
1743 | bool ret = false; | 1744 | bool ret = false; |
1744 | 1745 | ||
1745 | if (nr_pages > CHARGE_BATCH) | 1746 | if (nr_pages > CHARGE_BATCH) |
1746 | return ret; | 1747 | return ret; |
1747 | 1748 | ||
1748 | stock = &get_cpu_var(memcg_stock); | 1749 | local_irq_save(flags); |
1750 | |||
1751 | stock = this_cpu_ptr(&memcg_stock); | ||
1749 | if (memcg == stock->cached && stock->nr_pages >= nr_pages) { | 1752 | if (memcg == stock->cached && stock->nr_pages >= nr_pages) { |
1750 | stock->nr_pages -= nr_pages; | 1753 | stock->nr_pages -= nr_pages; |
1751 | ret = true; | 1754 | ret = true; |
1752 | } | 1755 | } |
1753 | put_cpu_var(memcg_stock); | 1756 | |
1757 | local_irq_restore(flags); | ||
1758 | |||
1754 | return ret; | 1759 | return ret; |
1755 | } | 1760 | } |
1756 | 1761 | ||
@@ -1771,15 +1776,18 @@ static void drain_stock(struct memcg_stock_pcp *stock) | |||
1771 | stock->cached = NULL; | 1776 | stock->cached = NULL; |
1772 | } | 1777 | } |
1773 | 1778 | ||
1774 | /* | ||
1775 | * This must be called under preempt disabled or must be called by | ||
1776 | * a thread which is pinned to local cpu. | ||
1777 | */ | ||
1778 | static void drain_local_stock(struct work_struct *dummy) | 1779 | static void drain_local_stock(struct work_struct *dummy) |
1779 | { | 1780 | { |
1780 | struct memcg_stock_pcp *stock = this_cpu_ptr(&memcg_stock); | 1781 | struct memcg_stock_pcp *stock; |
1782 | unsigned long flags; | ||
1783 | |||
1784 | local_irq_save(flags); | ||
1785 | |||
1786 | stock = this_cpu_ptr(&memcg_stock); | ||
1781 | drain_stock(stock); | 1787 | drain_stock(stock); |
1782 | clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags); | 1788 | clear_bit(FLUSHING_CACHED_CHARGE, &stock->flags); |
1789 | |||
1790 | local_irq_restore(flags); | ||
1783 | } | 1791 | } |
1784 | 1792 | ||
1785 | /* | 1793 | /* |
@@ -1788,14 +1796,19 @@ static void drain_local_stock(struct work_struct *dummy) | |||
1788 | */ | 1796 | */ |
1789 | static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) | 1797 | static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages) |
1790 | { | 1798 | { |
1791 | struct memcg_stock_pcp *stock = &get_cpu_var(memcg_stock); | 1799 | struct memcg_stock_pcp *stock; |
1800 | unsigned long flags; | ||
1801 | |||
1802 | local_irq_save(flags); | ||
1792 | 1803 | ||
1804 | stock = this_cpu_ptr(&memcg_stock); | ||
1793 | if (stock->cached != memcg) { /* reset if necessary */ | 1805 | if (stock->cached != memcg) { /* reset if necessary */ |
1794 | drain_stock(stock); | 1806 | drain_stock(stock); |
1795 | stock->cached = memcg; | 1807 | stock->cached = memcg; |
1796 | } | 1808 | } |
1797 | stock->nr_pages += nr_pages; | 1809 | stock->nr_pages += nr_pages; |
1798 | put_cpu_var(memcg_stock); | 1810 | |
1811 | local_irq_restore(flags); | ||
1799 | } | 1812 | } |
1800 | 1813 | ||
1801 | /* | 1814 | /* |
diff --git a/mm/memory.c b/mm/memory.c index 83be99d9d8a1..793fe0f9841c 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3351,9 +3351,6 @@ static int do_numa_page(struct fault_env *fe, pte_t pte) | |||
3351 | bool was_writable = pte_write(pte); | 3351 | bool was_writable = pte_write(pte); |
3352 | int flags = 0; | 3352 | int flags = 0; |
3353 | 3353 | ||
3354 | /* A PROT_NONE fault should not end up here */ | ||
3355 | BUG_ON(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))); | ||
3356 | |||
3357 | /* | 3354 | /* |
3358 | * The "pte" at this point cannot be used safely without | 3355 | * The "pte" at this point cannot be used safely without |
3359 | * validation through pte_unmap_same(). It's of NUMA type but | 3356 | * validation through pte_unmap_same(). It's of NUMA type but |
@@ -3458,6 +3455,11 @@ static int wp_huge_pmd(struct fault_env *fe, pmd_t orig_pmd) | |||
3458 | return VM_FAULT_FALLBACK; | 3455 | return VM_FAULT_FALLBACK; |
3459 | } | 3456 | } |
3460 | 3457 | ||
3458 | static inline bool vma_is_accessible(struct vm_area_struct *vma) | ||
3459 | { | ||
3460 | return vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE); | ||
3461 | } | ||
3462 | |||
3461 | /* | 3463 | /* |
3462 | * These routines also need to handle stuff like marking pages dirty | 3464 | * These routines also need to handle stuff like marking pages dirty |
3463 | * and/or accessed for architectures that don't do it in hardware (most | 3465 | * and/or accessed for architectures that don't do it in hardware (most |
@@ -3524,7 +3526,7 @@ static int handle_pte_fault(struct fault_env *fe) | |||
3524 | if (!pte_present(entry)) | 3526 | if (!pte_present(entry)) |
3525 | return do_swap_page(fe, entry); | 3527 | return do_swap_page(fe, entry); |
3526 | 3528 | ||
3527 | if (pte_protnone(entry)) | 3529 | if (pte_protnone(entry) && vma_is_accessible(fe->vma)) |
3528 | return do_numa_page(fe, entry); | 3530 | return do_numa_page(fe, entry); |
3529 | 3531 | ||
3530 | fe->ptl = pte_lockptr(fe->vma->vm_mm, fe->pmd); | 3532 | fe->ptl = pte_lockptr(fe->vma->vm_mm, fe->pmd); |
@@ -3590,7 +3592,7 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address, | |||
3590 | 3592 | ||
3591 | barrier(); | 3593 | barrier(); |
3592 | if (pmd_trans_huge(orig_pmd) || pmd_devmap(orig_pmd)) { | 3594 | if (pmd_trans_huge(orig_pmd) || pmd_devmap(orig_pmd)) { |
3593 | if (pmd_protnone(orig_pmd)) | 3595 | if (pmd_protnone(orig_pmd) && vma_is_accessible(vma)) |
3594 | return do_huge_pmd_numa_page(&fe, orig_pmd); | 3596 | return do_huge_pmd_numa_page(&fe, orig_pmd); |
3595 | 3597 | ||
3596 | if ((fe.flags & FAULT_FLAG_WRITE) && | 3598 | if ((fe.flags & FAULT_FLAG_WRITE) && |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 41266dc29f33..b58906b6215c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -1567,7 +1567,9 @@ static struct page *new_node_page(struct page *page, unsigned long private, | |||
1567 | return alloc_huge_page_node(page_hstate(compound_head(page)), | 1567 | return alloc_huge_page_node(page_hstate(compound_head(page)), |
1568 | next_node_in(nid, nmask)); | 1568 | next_node_in(nid, nmask)); |
1569 | 1569 | ||
1570 | node_clear(nid, nmask); | 1570 | if (nid != next_node_in(nid, nmask)) |
1571 | node_clear(nid, nmask); | ||
1572 | |||
1571 | if (PageHighMem(page) | 1573 | if (PageHighMem(page) |
1572 | || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) | 1574 | || (zone_idx(page_zone(page)) == ZONE_MOVABLE)) |
1573 | gfp_mask |= __GFP_HIGHMEM; | 1575 | gfp_mask |= __GFP_HIGHMEM; |
diff --git a/mm/page_io.c b/mm/page_io.c index 16bd82fad38c..eafe5ddc2b54 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -264,6 +264,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc, | |||
264 | int ret; | 264 | int ret; |
265 | struct swap_info_struct *sis = page_swap_info(page); | 265 | struct swap_info_struct *sis = page_swap_info(page); |
266 | 266 | ||
267 | BUG_ON(!PageSwapCache(page)); | ||
267 | if (sis->flags & SWP_FILE) { | 268 | if (sis->flags & SWP_FILE) { |
268 | struct kiocb kiocb; | 269 | struct kiocb kiocb; |
269 | struct file *swap_file = sis->swap_file; | 270 | struct file *swap_file = sis->swap_file; |
@@ -337,6 +338,7 @@ int swap_readpage(struct page *page) | |||
337 | int ret = 0; | 338 | int ret = 0; |
338 | struct swap_info_struct *sis = page_swap_info(page); | 339 | struct swap_info_struct *sis = page_swap_info(page); |
339 | 340 | ||
341 | BUG_ON(!PageSwapCache(page)); | ||
340 | VM_BUG_ON_PAGE(!PageLocked(page), page); | 342 | VM_BUG_ON_PAGE(!PageLocked(page), page); |
341 | VM_BUG_ON_PAGE(PageUptodate(page), page); | 343 | VM_BUG_ON_PAGE(PageUptodate(page), page); |
342 | if (frontswap_load(page) == 0) { | 344 | if (frontswap_load(page) == 0) { |
@@ -386,6 +388,7 @@ int swap_set_page_dirty(struct page *page) | |||
386 | 388 | ||
387 | if (sis->flags & SWP_FILE) { | 389 | if (sis->flags & SWP_FILE) { |
388 | struct address_space *mapping = sis->swap_file->f_mapping; | 390 | struct address_space *mapping = sis->swap_file->f_mapping; |
391 | BUG_ON(!PageSwapCache(page)); | ||
389 | return mapping->a_ops->set_page_dirty(page); | 392 | return mapping->a_ops->set_page_dirty(page); |
390 | } else { | 393 | } else { |
391 | return __set_page_dirty_no_writeback(page); | 394 | return __set_page_dirty_no_writeback(page); |
diff --git a/mm/shmem.c b/mm/shmem.c index 28ae88bbeffa..e7e8f8c210c1 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -270,7 +270,7 @@ bool shmem_charge(struct inode *inode, long pages) | |||
270 | info->alloced -= pages; | 270 | info->alloced -= pages; |
271 | shmem_recalc_inode(inode); | 271 | shmem_recalc_inode(inode); |
272 | spin_unlock_irqrestore(&info->lock, flags); | 272 | spin_unlock_irqrestore(&info->lock, flags); |
273 | 273 | shmem_unacct_blocks(info->flags, pages); | |
274 | return false; | 274 | return false; |
275 | } | 275 | } |
276 | percpu_counter_add(&sbinfo->used_blocks, pages); | 276 | percpu_counter_add(&sbinfo->used_blocks, pages); |
@@ -291,6 +291,7 @@ void shmem_uncharge(struct inode *inode, long pages) | |||
291 | 291 | ||
292 | if (sbinfo->max_blocks) | 292 | if (sbinfo->max_blocks) |
293 | percpu_counter_sub(&sbinfo->used_blocks, pages); | 293 | percpu_counter_sub(&sbinfo->used_blocks, pages); |
294 | shmem_unacct_blocks(info->flags, pages); | ||
294 | } | 295 | } |
295 | 296 | ||
296 | /* | 297 | /* |
@@ -1980,7 +1981,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, | |||
1980 | return addr; | 1981 | return addr; |
1981 | sb = shm_mnt->mnt_sb; | 1982 | sb = shm_mnt->mnt_sb; |
1982 | } | 1983 | } |
1983 | if (SHMEM_SB(sb)->huge != SHMEM_HUGE_NEVER) | 1984 | if (SHMEM_SB(sb)->huge == SHMEM_HUGE_NEVER) |
1984 | return addr; | 1985 | return addr; |
1985 | } | 1986 | } |
1986 | 1987 | ||
@@ -3813,7 +3814,7 @@ static const struct inode_operations shmem_dir_inode_operations = { | |||
3813 | .mkdir = shmem_mkdir, | 3814 | .mkdir = shmem_mkdir, |
3814 | .rmdir = shmem_rmdir, | 3815 | .rmdir = shmem_rmdir, |
3815 | .mknod = shmem_mknod, | 3816 | .mknod = shmem_mknod, |
3816 | .rename2 = shmem_rename2, | 3817 | .rename = shmem_rename2, |
3817 | .tmpfile = shmem_tmpfile, | 3818 | .tmpfile = shmem_tmpfile, |
3818 | #endif | 3819 | #endif |
3819 | #ifdef CONFIG_TMPFS_XATTR | 3820 | #ifdef CONFIG_TMPFS_XATTR |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 78cfa292a29a..2657accc6e2b 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -2724,7 +2724,6 @@ int swapcache_prepare(swp_entry_t entry) | |||
2724 | struct swap_info_struct *page_swap_info(struct page *page) | 2724 | struct swap_info_struct *page_swap_info(struct page *page) |
2725 | { | 2725 | { |
2726 | swp_entry_t swap = { .val = page_private(page) }; | 2726 | swp_entry_t swap = { .val = page_private(page) }; |
2727 | BUG_ON(!PageSwapCache(page)); | ||
2728 | return swap_info[swp_type(swap)]; | 2727 | return swap_info[swp_type(swap)]; |
2729 | } | 2728 | } |
2730 | 2729 | ||
diff --git a/mm/usercopy.c b/mm/usercopy.c index 089328f2b920..3c8da0af9695 100644 --- a/mm/usercopy.c +++ b/mm/usercopy.c | |||
@@ -207,8 +207,11 @@ static inline const char *check_heap_object(const void *ptr, unsigned long n, | |||
207 | * Some architectures (arm64) return true for virt_addr_valid() on | 207 | * Some architectures (arm64) return true for virt_addr_valid() on |
208 | * vmalloced addresses. Work around this by checking for vmalloc | 208 | * vmalloced addresses. Work around this by checking for vmalloc |
209 | * first. | 209 | * first. |
210 | * | ||
211 | * We also need to check for module addresses explicitly since we | ||
212 | * may copy static data from modules to userspace | ||
210 | */ | 213 | */ |
211 | if (is_vmalloc_addr(ptr)) | 214 | if (is_vmalloc_or_module_addr(ptr)) |
212 | return NULL; | 215 | return NULL; |
213 | 216 | ||
214 | if (!virt_addr_valid(ptr)) | 217 | if (!virt_addr_valid(ptr)) |
diff --git a/mm/vmscan.c b/mm/vmscan.c index b1e12a1ea9cf..0fe8b7113868 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -2303,23 +2303,6 @@ out: | |||
2303 | } | 2303 | } |
2304 | } | 2304 | } |
2305 | 2305 | ||
2306 | #ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH | ||
2307 | static void init_tlb_ubc(void) | ||
2308 | { | ||
2309 | /* | ||
2310 | * This deliberately does not clear the cpumask as it's expensive | ||
2311 | * and unnecessary. If there happens to be data in there then the | ||
2312 | * first SWAP_CLUSTER_MAX pages will send an unnecessary IPI and | ||
2313 | * then will be cleared. | ||
2314 | */ | ||
2315 | current->tlb_ubc.flush_required = false; | ||
2316 | } | ||
2317 | #else | ||
2318 | static inline void init_tlb_ubc(void) | ||
2319 | { | ||
2320 | } | ||
2321 | #endif /* CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH */ | ||
2322 | |||
2323 | /* | 2306 | /* |
2324 | * This is a basic per-node page freer. Used by both kswapd and direct reclaim. | 2307 | * This is a basic per-node page freer. Used by both kswapd and direct reclaim. |
2325 | */ | 2308 | */ |
@@ -2355,8 +2338,6 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc | |||
2355 | scan_adjusted = (global_reclaim(sc) && !current_is_kswapd() && | 2338 | scan_adjusted = (global_reclaim(sc) && !current_is_kswapd() && |
2356 | sc->priority == DEF_PRIORITY); | 2339 | sc->priority == DEF_PRIORITY); |
2357 | 2340 | ||
2358 | init_tlb_ubc(); | ||
2359 | |||
2360 | blk_start_plug(&plug); | 2341 | blk_start_plug(&plug); |
2361 | while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || | 2342 | while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] || |
2362 | nr[LRU_INACTIVE_FILE]) { | 2343 | nr[LRU_INACTIVE_FILE]) { |
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index 7d170010beb9..ee08540ce503 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c | |||
@@ -335,7 +335,7 @@ int batadv_v_elp_iface_enable(struct batadv_hard_iface *hard_iface) | |||
335 | goto out; | 335 | goto out; |
336 | 336 | ||
337 | skb_reserve(hard_iface->bat_v.elp_skb, ETH_HLEN + NET_IP_ALIGN); | 337 | skb_reserve(hard_iface->bat_v.elp_skb, ETH_HLEN + NET_IP_ALIGN); |
338 | elp_buff = skb_push(hard_iface->bat_v.elp_skb, BATADV_ELP_HLEN); | 338 | elp_buff = skb_put(hard_iface->bat_v.elp_skb, BATADV_ELP_HLEN); |
339 | elp_packet = (struct batadv_elp_packet *)elp_buff; | 339 | elp_packet = (struct batadv_elp_packet *)elp_buff; |
340 | memset(elp_packet, 0, BATADV_ELP_HLEN); | 340 | memset(elp_packet, 0, BATADV_ELP_HLEN); |
341 | 341 | ||
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 7602c001e92b..3d199478c405 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -470,6 +470,29 @@ static int batadv_check_unicast_packet(struct batadv_priv *bat_priv, | |||
470 | } | 470 | } |
471 | 471 | ||
472 | /** | 472 | /** |
473 | * batadv_last_bonding_get - Get last_bonding_candidate of orig_node | ||
474 | * @orig_node: originator node whose last bonding candidate should be retrieved | ||
475 | * | ||
476 | * Return: last bonding candidate of router or NULL if not found | ||
477 | * | ||
478 | * The object is returned with refcounter increased by 1. | ||
479 | */ | ||
480 | static struct batadv_orig_ifinfo * | ||
481 | batadv_last_bonding_get(struct batadv_orig_node *orig_node) | ||
482 | { | ||
483 | struct batadv_orig_ifinfo *last_bonding_candidate; | ||
484 | |||
485 | spin_lock_bh(&orig_node->neigh_list_lock); | ||
486 | last_bonding_candidate = orig_node->last_bonding_candidate; | ||
487 | |||
488 | if (last_bonding_candidate) | ||
489 | kref_get(&last_bonding_candidate->refcount); | ||
490 | spin_unlock_bh(&orig_node->neigh_list_lock); | ||
491 | |||
492 | return last_bonding_candidate; | ||
493 | } | ||
494 | |||
495 | /** | ||
473 | * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node | 496 | * batadv_last_bonding_replace - Replace last_bonding_candidate of orig_node |
474 | * @orig_node: originator node whose bonding candidates should be replaced | 497 | * @orig_node: originator node whose bonding candidates should be replaced |
475 | * @new_candidate: new bonding candidate or NULL | 498 | * @new_candidate: new bonding candidate or NULL |
@@ -539,7 +562,7 @@ batadv_find_router(struct batadv_priv *bat_priv, | |||
539 | * router - obviously there are no other candidates. | 562 | * router - obviously there are no other candidates. |
540 | */ | 563 | */ |
541 | rcu_read_lock(); | 564 | rcu_read_lock(); |
542 | last_candidate = orig_node->last_bonding_candidate; | 565 | last_candidate = batadv_last_bonding_get(orig_node); |
543 | if (last_candidate) | 566 | if (last_candidate) |
544 | last_cand_router = rcu_dereference(last_candidate->router); | 567 | last_cand_router = rcu_dereference(last_candidate->router); |
545 | 568 | ||
@@ -631,6 +654,9 @@ next: | |||
631 | batadv_orig_ifinfo_put(next_candidate); | 654 | batadv_orig_ifinfo_put(next_candidate); |
632 | } | 655 | } |
633 | 656 | ||
657 | if (last_candidate) | ||
658 | batadv_orig_ifinfo_put(last_candidate); | ||
659 | |||
634 | return router; | 660 | return router; |
635 | } | 661 | } |
636 | 662 | ||
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index 8e486203d133..abe11f085479 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c | |||
@@ -80,13 +80,10 @@ static void br_do_proxy_arp(struct sk_buff *skb, struct net_bridge *br, | |||
80 | 80 | ||
81 | BR_INPUT_SKB_CB(skb)->proxyarp_replied = false; | 81 | BR_INPUT_SKB_CB(skb)->proxyarp_replied = false; |
82 | 82 | ||
83 | if (dev->flags & IFF_NOARP) | 83 | if ((dev->flags & IFF_NOARP) || |
84 | !pskb_may_pull(skb, arp_hdr_len(dev))) | ||
84 | return; | 85 | return; |
85 | 86 | ||
86 | if (!pskb_may_pull(skb, arp_hdr_len(dev))) { | ||
87 | dev->stats.tx_dropped++; | ||
88 | return; | ||
89 | } | ||
90 | parp = arp_hdr(skb); | 87 | parp = arp_hdr(skb); |
91 | 88 | ||
92 | if (parp->ar_pro != htons(ETH_P_IP) || | 89 | if (parp->ar_pro != htons(ETH_P_IP) || |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index a5423a1eec05..c5fea9393946 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1138,7 +1138,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1138 | } else { | 1138 | } else { |
1139 | err = br_ip6_multicast_add_group(br, port, | 1139 | err = br_ip6_multicast_add_group(br, port, |
1140 | &grec->grec_mca, vid); | 1140 | &grec->grec_mca, vid); |
1141 | if (!err) | 1141 | if (err) |
1142 | break; | 1142 | break; |
1143 | } | 1143 | } |
1144 | } | 1144 | } |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index cceac5bb658f..0833c251aef7 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -368,6 +368,8 @@ ebt_check_match(struct ebt_entry_match *m, struct xt_mtchk_param *par, | |||
368 | 368 | ||
369 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); | 369 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); |
370 | if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) { | 370 | if (IS_ERR(match) || match->family != NFPROTO_BRIDGE) { |
371 | if (!IS_ERR(match)) | ||
372 | module_put(match->me); | ||
371 | request_module("ebt_%s", m->u.name); | 373 | request_module("ebt_%s", m->u.name); |
372 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); | 374 | match = xt_find_match(NFPROTO_BRIDGE, m->u.name, 0); |
373 | } | 375 | } |
diff --git a/net/bridge/netfilter/nft_meta_bridge.c b/net/bridge/netfilter/nft_meta_bridge.c index 4b901d9f2e7c..ad47a921b701 100644 --- a/net/bridge/netfilter/nft_meta_bridge.c +++ b/net/bridge/netfilter/nft_meta_bridge.c | |||
@@ -86,6 +86,7 @@ static const struct nft_expr_ops nft_meta_bridge_set_ops = { | |||
86 | .init = nft_meta_set_init, | 86 | .init = nft_meta_set_init, |
87 | .destroy = nft_meta_set_destroy, | 87 | .destroy = nft_meta_set_destroy, |
88 | .dump = nft_meta_set_dump, | 88 | .dump = nft_meta_set_dump, |
89 | .validate = nft_meta_set_validate, | ||
89 | }; | 90 | }; |
90 | 91 | ||
91 | static const struct nft_expr_ops * | 92 | static const struct nft_expr_ops * |
diff --git a/net/core/dev.c b/net/core/dev.c index dd6ce598de89..ea6312057a71 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3975,6 +3975,22 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, | |||
3975 | } | 3975 | } |
3976 | 3976 | ||
3977 | /** | 3977 | /** |
3978 | * netdev_is_rx_handler_busy - check if receive handler is registered | ||
3979 | * @dev: device to check | ||
3980 | * | ||
3981 | * Check if a receive handler is already registered for a given device. | ||
3982 | * Return true if there one. | ||
3983 | * | ||
3984 | * The caller must hold the rtnl_mutex. | ||
3985 | */ | ||
3986 | bool netdev_is_rx_handler_busy(struct net_device *dev) | ||
3987 | { | ||
3988 | ASSERT_RTNL(); | ||
3989 | return dev && rtnl_dereference(dev->rx_handler); | ||
3990 | } | ||
3991 | EXPORT_SYMBOL_GPL(netdev_is_rx_handler_busy); | ||
3992 | |||
3993 | /** | ||
3978 | * netdev_rx_handler_register - register receive handler | 3994 | * netdev_rx_handler_register - register receive handler |
3979 | * @dev: device to register a handler for | 3995 | * @dev: device to register a handler for |
3980 | * @rx_handler: receive handler to register | 3996 | * @rx_handler: receive handler to register |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 61ad43f61c5e..52742a02814f 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
@@ -680,11 +680,13 @@ EXPORT_SYMBOL_GPL(__skb_get_hash_symmetric); | |||
680 | void __skb_get_hash(struct sk_buff *skb) | 680 | void __skb_get_hash(struct sk_buff *skb) |
681 | { | 681 | { |
682 | struct flow_keys keys; | 682 | struct flow_keys keys; |
683 | u32 hash; | ||
683 | 684 | ||
684 | __flow_hash_secret_init(); | 685 | __flow_hash_secret_init(); |
685 | 686 | ||
686 | __skb_set_sw_hash(skb, ___skb_get_hash(skb, &keys, hashrnd), | 687 | hash = ___skb_get_hash(skb, &keys, hashrnd); |
687 | flow_keys_have_l4(&keys)); | 688 | |
689 | __skb_set_sw_hash(skb, hash, flow_keys_have_l4(&keys)); | ||
688 | } | 690 | } |
689 | EXPORT_SYMBOL(__skb_get_hash); | 691 | EXPORT_SYMBOL(__skb_get_hash); |
690 | 692 | ||
diff --git a/net/core/sock.c b/net/core/sock.c index 25dab8b60223..fd7b41edf1ce 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1362,7 +1362,6 @@ static struct sock *sk_prot_alloc(struct proto *prot, gfp_t priority, | |||
1362 | if (!try_module_get(prot->owner)) | 1362 | if (!try_module_get(prot->owner)) |
1363 | goto out_free_sec; | 1363 | goto out_free_sec; |
1364 | sk_tx_queue_clear(sk); | 1364 | sk_tx_queue_clear(sk); |
1365 | cgroup_sk_alloc(&sk->sk_cgrp_data); | ||
1366 | } | 1365 | } |
1367 | 1366 | ||
1368 | return sk; | 1367 | return sk; |
@@ -1422,6 +1421,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
1422 | sock_net_set(sk, net); | 1421 | sock_net_set(sk, net); |
1423 | atomic_set(&sk->sk_wmem_alloc, 1); | 1422 | atomic_set(&sk->sk_wmem_alloc, 1); |
1424 | 1423 | ||
1424 | cgroup_sk_alloc(&sk->sk_cgrp_data); | ||
1425 | sock_update_classid(&sk->sk_cgrp_data); | 1425 | sock_update_classid(&sk->sk_cgrp_data); |
1426 | sock_update_netprioidx(&sk->sk_cgrp_data); | 1426 | sock_update_netprioidx(&sk->sk_cgrp_data); |
1427 | } | 1427 | } |
@@ -1566,6 +1566,9 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) | |||
1566 | newsk->sk_priority = 0; | 1566 | newsk->sk_priority = 0; |
1567 | newsk->sk_incoming_cpu = raw_smp_processor_id(); | 1567 | newsk->sk_incoming_cpu = raw_smp_processor_id(); |
1568 | atomic64_set(&newsk->sk_cookie, 0); | 1568 | atomic64_set(&newsk->sk_cookie, 0); |
1569 | |||
1570 | cgroup_sk_alloc(&newsk->sk_cgrp_data); | ||
1571 | |||
1569 | /* | 1572 | /* |
1570 | * Before updating sk_refcnt, we must commit prior changes to memory | 1573 | * Before updating sk_refcnt, we must commit prior changes to memory |
1571 | * (Documentation/RCU/rculist_nulls.txt for details) | 1574 | * (Documentation/RCU/rculist_nulls.txt for details) |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 415e117967c7..062a67ca9a21 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -2232,7 +2232,7 @@ static struct devinet_sysctl_table { | |||
2232 | }; | 2232 | }; |
2233 | 2233 | ||
2234 | static int __devinet_sysctl_register(struct net *net, char *dev_name, | 2234 | static int __devinet_sysctl_register(struct net *net, char *dev_name, |
2235 | struct ipv4_devconf *p) | 2235 | int ifindex, struct ipv4_devconf *p) |
2236 | { | 2236 | { |
2237 | int i; | 2237 | int i; |
2238 | struct devinet_sysctl_table *t; | 2238 | struct devinet_sysctl_table *t; |
@@ -2255,6 +2255,8 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name, | |||
2255 | goto free; | 2255 | goto free; |
2256 | 2256 | ||
2257 | p->sysctl = t; | 2257 | p->sysctl = t; |
2258 | |||
2259 | inet_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p); | ||
2258 | return 0; | 2260 | return 0; |
2259 | 2261 | ||
2260 | free: | 2262 | free: |
@@ -2286,7 +2288,7 @@ static int devinet_sysctl_register(struct in_device *idev) | |||
2286 | if (err) | 2288 | if (err) |
2287 | return err; | 2289 | return err; |
2288 | err = __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, | 2290 | err = __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, |
2289 | &idev->cnf); | 2291 | idev->dev->ifindex, &idev->cnf); |
2290 | if (err) | 2292 | if (err) |
2291 | neigh_sysctl_unregister(idev->arp_parms); | 2293 | neigh_sysctl_unregister(idev->arp_parms); |
2292 | return err; | 2294 | return err; |
@@ -2347,11 +2349,12 @@ static __net_init int devinet_init_net(struct net *net) | |||
2347 | } | 2349 | } |
2348 | 2350 | ||
2349 | #ifdef CONFIG_SYSCTL | 2351 | #ifdef CONFIG_SYSCTL |
2350 | err = __devinet_sysctl_register(net, "all", all); | 2352 | err = __devinet_sysctl_register(net, "all", NETCONFA_IFINDEX_ALL, all); |
2351 | if (err < 0) | 2353 | if (err < 0) |
2352 | goto err_reg_all; | 2354 | goto err_reg_all; |
2353 | 2355 | ||
2354 | err = __devinet_sysctl_register(net, "default", dflt); | 2356 | err = __devinet_sysctl_register(net, "default", |
2357 | NETCONFA_IFINDEX_DEFAULT, dflt); | ||
2355 | if (err < 0) | 2358 | if (err < 0) |
2356 | goto err_reg_dflt; | 2359 | goto err_reg_dflt; |
2357 | 2360 | ||
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index ef2ebeb89d0f..1b25daf8c7f1 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -509,6 +509,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt, | |||
509 | if (!dev) | 509 | if (!dev) |
510 | return -ENODEV; | 510 | return -ENODEV; |
511 | cfg->fc_oif = dev->ifindex; | 511 | cfg->fc_oif = dev->ifindex; |
512 | cfg->fc_table = l3mdev_fib_table(dev); | ||
512 | if (colon) { | 513 | if (colon) { |
513 | struct in_ifaddr *ifa; | 514 | struct in_ifaddr *ifa; |
514 | struct in_device *in_dev = __in_dev_get_rtnl(dev); | 515 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
@@ -1027,7 +1028,7 @@ no_promotions: | |||
1027 | * First of all, we scan fib_info list searching | 1028 | * First of all, we scan fib_info list searching |
1028 | * for stray nexthop entries, then ignite fib_flush. | 1029 | * for stray nexthop entries, then ignite fib_flush. |
1029 | */ | 1030 | */ |
1030 | if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local)) | 1031 | if (fib_sync_down_addr(dev, ifa->ifa_local)) |
1031 | fib_flush(dev_net(dev)); | 1032 | fib_flush(dev_net(dev)); |
1032 | } | 1033 | } |
1033 | } | 1034 | } |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 539fa264e67d..e9f56225e53f 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1057,6 +1057,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg) | |||
1057 | fi->fib_priority = cfg->fc_priority; | 1057 | fi->fib_priority = cfg->fc_priority; |
1058 | fi->fib_prefsrc = cfg->fc_prefsrc; | 1058 | fi->fib_prefsrc = cfg->fc_prefsrc; |
1059 | fi->fib_type = cfg->fc_type; | 1059 | fi->fib_type = cfg->fc_type; |
1060 | fi->fib_tb_id = cfg->fc_table; | ||
1060 | 1061 | ||
1061 | fi->fib_nhs = nhs; | 1062 | fi->fib_nhs = nhs; |
1062 | change_nexthops(fi) { | 1063 | change_nexthops(fi) { |
@@ -1337,18 +1338,21 @@ nla_put_failure: | |||
1337 | * referring to it. | 1338 | * referring to it. |
1338 | * - device went down -> we must shutdown all nexthops going via it. | 1339 | * - device went down -> we must shutdown all nexthops going via it. |
1339 | */ | 1340 | */ |
1340 | int fib_sync_down_addr(struct net *net, __be32 local) | 1341 | int fib_sync_down_addr(struct net_device *dev, __be32 local) |
1341 | { | 1342 | { |
1342 | int ret = 0; | 1343 | int ret = 0; |
1343 | unsigned int hash = fib_laddr_hashfn(local); | 1344 | unsigned int hash = fib_laddr_hashfn(local); |
1344 | struct hlist_head *head = &fib_info_laddrhash[hash]; | 1345 | struct hlist_head *head = &fib_info_laddrhash[hash]; |
1346 | struct net *net = dev_net(dev); | ||
1347 | int tb_id = l3mdev_fib_table(dev); | ||
1345 | struct fib_info *fi; | 1348 | struct fib_info *fi; |
1346 | 1349 | ||
1347 | if (!fib_info_laddrhash || local == 0) | 1350 | if (!fib_info_laddrhash || local == 0) |
1348 | return 0; | 1351 | return 0; |
1349 | 1352 | ||
1350 | hlist_for_each_entry(fi, head, fib_lhash) { | 1353 | hlist_for_each_entry(fi, head, fib_lhash) { |
1351 | if (!net_eq(fi->fib_net, net)) | 1354 | if (!net_eq(fi->fib_net, net) || |
1355 | fi->fib_tb_id != tb_id) | ||
1352 | continue; | 1356 | continue; |
1353 | if (fi->fib_prefsrc == local) { | 1357 | if (fi->fib_prefsrc == local) { |
1354 | fi->fib_flags |= RTNH_F_DEAD; | 1358 | fi->fib_flags |= RTNH_F_DEAD; |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 4b351af3e67b..d6feabb03516 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -312,6 +312,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
312 | { | 312 | { |
313 | const struct iphdr *iph = ip_hdr(skb); | 313 | const struct iphdr *iph = ip_hdr(skb); |
314 | struct rtable *rt; | 314 | struct rtable *rt; |
315 | struct net_device *dev = skb->dev; | ||
315 | 316 | ||
316 | /* if ingress device is enslaved to an L3 master device pass the | 317 | /* if ingress device is enslaved to an L3 master device pass the |
317 | * skb to its handler for processing | 318 | * skb to its handler for processing |
@@ -341,7 +342,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
341 | */ | 342 | */ |
342 | if (!skb_valid_dst(skb)) { | 343 | if (!skb_valid_dst(skb)) { |
343 | int err = ip_route_input_noref(skb, iph->daddr, iph->saddr, | 344 | int err = ip_route_input_noref(skb, iph->daddr, iph->saddr, |
344 | iph->tos, skb->dev); | 345 | iph->tos, dev); |
345 | if (unlikely(err)) { | 346 | if (unlikely(err)) { |
346 | if (err == -EXDEV) | 347 | if (err == -EXDEV) |
347 | __NET_INC_STATS(net, LINUX_MIB_IPRPFILTER); | 348 | __NET_INC_STATS(net, LINUX_MIB_IPRPFILTER); |
@@ -370,7 +371,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) | |||
370 | __IP_UPD_PO_STATS(net, IPSTATS_MIB_INBCAST, skb->len); | 371 | __IP_UPD_PO_STATS(net, IPSTATS_MIB_INBCAST, skb->len); |
371 | } else if (skb->pkt_type == PACKET_BROADCAST || | 372 | } else if (skb->pkt_type == PACKET_BROADCAST || |
372 | skb->pkt_type == PACKET_MULTICAST) { | 373 | skb->pkt_type == PACKET_MULTICAST) { |
373 | struct in_device *in_dev = __in_dev_get_rcu(skb->dev); | 374 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
374 | 375 | ||
375 | /* RFC 1122 3.3.6: | 376 | /* RFC 1122 3.3.6: |
376 | * | 377 | * |
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index cc701fa70b12..5d7944f394d9 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c | |||
@@ -88,6 +88,7 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) | |||
88 | struct net_device *dev; | 88 | struct net_device *dev; |
89 | struct pcpu_sw_netstats *tstats; | 89 | struct pcpu_sw_netstats *tstats; |
90 | struct xfrm_state *x; | 90 | struct xfrm_state *x; |
91 | struct xfrm_mode *inner_mode; | ||
91 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; | 92 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; |
92 | u32 orig_mark = skb->mark; | 93 | u32 orig_mark = skb->mark; |
93 | int ret; | 94 | int ret; |
@@ -105,7 +106,19 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) | |||
105 | } | 106 | } |
106 | 107 | ||
107 | x = xfrm_input_state(skb); | 108 | x = xfrm_input_state(skb); |
108 | family = x->inner_mode->afinfo->family; | 109 | |
110 | inner_mode = x->inner_mode; | ||
111 | |||
112 | if (x->sel.family == AF_UNSPEC) { | ||
113 | inner_mode = xfrm_ip2inner_mode(x, XFRM_MODE_SKB_CB(skb)->protocol); | ||
114 | if (inner_mode == NULL) { | ||
115 | XFRM_INC_STATS(dev_net(skb->dev), | ||
116 | LINUX_MIB_XFRMINSTATEMODEERROR); | ||
117 | return -EINVAL; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | family = inner_mode->afinfo->family; | ||
109 | 122 | ||
110 | skb->mark = be32_to_cpu(tunnel->parms.i_key); | 123 | skb->mark = be32_to_cpu(tunnel->parms.i_key); |
111 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); | 124 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 26253328d227..a87bcd2d4a94 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -2076,6 +2076,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | |||
2076 | struct rta_mfc_stats mfcs; | 2076 | struct rta_mfc_stats mfcs; |
2077 | struct nlattr *mp_attr; | 2077 | struct nlattr *mp_attr; |
2078 | struct rtnexthop *nhp; | 2078 | struct rtnexthop *nhp; |
2079 | unsigned long lastuse; | ||
2079 | int ct; | 2080 | int ct; |
2080 | 2081 | ||
2081 | /* If cache is unresolved, don't try to parse IIF and OIF */ | 2082 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
@@ -2105,12 +2106,14 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | |||
2105 | 2106 | ||
2106 | nla_nest_end(skb, mp_attr); | 2107 | nla_nest_end(skb, mp_attr); |
2107 | 2108 | ||
2109 | lastuse = READ_ONCE(c->mfc_un.res.lastuse); | ||
2110 | lastuse = time_after_eq(jiffies, lastuse) ? jiffies - lastuse : 0; | ||
2111 | |||
2108 | mfcs.mfcs_packets = c->mfc_un.res.pkt; | 2112 | mfcs.mfcs_packets = c->mfc_un.res.pkt; |
2109 | mfcs.mfcs_bytes = c->mfc_un.res.bytes; | 2113 | mfcs.mfcs_bytes = c->mfc_un.res.bytes; |
2110 | mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; | 2114 | mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; |
2111 | if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || | 2115 | if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || |
2112 | nla_put_u64_64bit(skb, RTA_EXPIRES, | 2116 | nla_put_u64_64bit(skb, RTA_EXPIRES, jiffies_to_clock_t(lastuse), |
2113 | jiffies_to_clock_t(c->mfc_un.res.lastuse), | ||
2114 | RTA_PAD)) | 2117 | RTA_PAD)) |
2115 | return -EMSGSIZE; | 2118 | return -EMSGSIZE; |
2116 | 2119 | ||
diff --git a/net/ipv4/netfilter/nft_chain_route_ipv4.c b/net/ipv4/netfilter/nft_chain_route_ipv4.c index 2375b0a8be46..30493beb611a 100644 --- a/net/ipv4/netfilter/nft_chain_route_ipv4.c +++ b/net/ipv4/netfilter/nft_chain_route_ipv4.c | |||
@@ -31,6 +31,7 @@ static unsigned int nf_route_table_hook(void *priv, | |||
31 | __be32 saddr, daddr; | 31 | __be32 saddr, daddr; |
32 | u_int8_t tos; | 32 | u_int8_t tos; |
33 | const struct iphdr *iph; | 33 | const struct iphdr *iph; |
34 | int err; | ||
34 | 35 | ||
35 | /* root is playing with raw sockets. */ | 36 | /* root is playing with raw sockets. */ |
36 | if (skb->len < sizeof(struct iphdr) || | 37 | if (skb->len < sizeof(struct iphdr) || |
@@ -46,15 +47,17 @@ static unsigned int nf_route_table_hook(void *priv, | |||
46 | tos = iph->tos; | 47 | tos = iph->tos; |
47 | 48 | ||
48 | ret = nft_do_chain(&pkt, priv); | 49 | ret = nft_do_chain(&pkt, priv); |
49 | if (ret != NF_DROP && ret != NF_QUEUE) { | 50 | if (ret != NF_DROP && ret != NF_STOLEN) { |
50 | iph = ip_hdr(skb); | 51 | iph = ip_hdr(skb); |
51 | 52 | ||
52 | if (iph->saddr != saddr || | 53 | if (iph->saddr != saddr || |
53 | iph->daddr != daddr || | 54 | iph->daddr != daddr || |
54 | skb->mark != mark || | 55 | skb->mark != mark || |
55 | iph->tos != tos) | 56 | iph->tos != tos) { |
56 | if (ip_route_me_harder(state->net, skb, RTN_UNSPEC)) | 57 | err = ip_route_me_harder(state->net, skb, RTN_UNSPEC); |
57 | ret = NF_DROP; | 58 | if (err < 0) |
59 | ret = NF_DROP_ERR(err); | ||
60 | } | ||
58 | } | 61 | } |
59 | return ret; | 62 | return ret; |
60 | } | 63 | } |
diff --git a/net/ipv4/netfilter/nft_reject_ipv4.c b/net/ipv4/netfilter/nft_reject_ipv4.c index c24f41c816b3..2c2553b9026c 100644 --- a/net/ipv4/netfilter/nft_reject_ipv4.c +++ b/net/ipv4/netfilter/nft_reject_ipv4.c | |||
@@ -46,6 +46,7 @@ static const struct nft_expr_ops nft_reject_ipv4_ops = { | |||
46 | .eval = nft_reject_ipv4_eval, | 46 | .eval = nft_reject_ipv4_eval, |
47 | .init = nft_reject_init, | 47 | .init = nft_reject_init, |
48 | .dump = nft_reject_dump, | 48 | .dump = nft_reject_dump, |
49 | .validate = nft_reject_validate, | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | static struct nft_expr_type nft_reject_ipv4_type __read_mostly = { | 52 | static struct nft_expr_type nft_reject_ipv4_type __read_mostly = { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a1f2830d8110..b5b47a26d4ec 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -476,12 +476,18 @@ u32 ip_idents_reserve(u32 hash, int segs) | |||
476 | atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ; | 476 | atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ; |
477 | u32 old = ACCESS_ONCE(*p_tstamp); | 477 | u32 old = ACCESS_ONCE(*p_tstamp); |
478 | u32 now = (u32)jiffies; | 478 | u32 now = (u32)jiffies; |
479 | u32 delta = 0; | 479 | u32 new, delta = 0; |
480 | 480 | ||
481 | if (old != now && cmpxchg(p_tstamp, old, now) == old) | 481 | if (old != now && cmpxchg(p_tstamp, old, now) == old) |
482 | delta = prandom_u32_max(now - old); | 482 | delta = prandom_u32_max(now - old); |
483 | 483 | ||
484 | return atomic_add_return(segs + delta, p_id) - segs; | 484 | /* Do not use atomic_add_return() as it makes UBSAN unhappy */ |
485 | do { | ||
486 | old = (u32)atomic_read(p_id); | ||
487 | new = old + delta + segs; | ||
488 | } while (atomic_cmpxchg(p_id, old, new) != old); | ||
489 | |||
490 | return new - segs; | ||
485 | } | 491 | } |
486 | EXPORT_SYMBOL(ip_idents_reserve); | 492 | EXPORT_SYMBOL(ip_idents_reserve); |
487 | 493 | ||
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 54d9f9b0120f..4e777a3243f9 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -150,6 +150,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb) | |||
150 | tp->segs_in = 0; | 150 | tp->segs_in = 0; |
151 | tcp_segs_in(tp, skb); | 151 | tcp_segs_in(tp, skb); |
152 | __skb_pull(skb, tcp_hdrlen(skb)); | 152 | __skb_pull(skb, tcp_hdrlen(skb)); |
153 | sk_forced_mem_schedule(sk, skb->truesize); | ||
153 | skb_set_owner_r(skb, sk); | 154 | skb_set_owner_r(skb, sk); |
154 | 155 | ||
155 | TCP_SKB_CB(skb)->seq++; | 156 | TCP_SKB_CB(skb)->seq++; |
@@ -226,6 +227,7 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk, | |||
226 | tcp_fastopen_add_skb(child, skb); | 227 | tcp_fastopen_add_skb(child, skb); |
227 | 228 | ||
228 | tcp_rsk(req)->rcv_nxt = tp->rcv_nxt; | 229 | tcp_rsk(req)->rcv_nxt = tp->rcv_nxt; |
230 | tp->rcv_wup = tp->rcv_nxt; | ||
229 | /* tcp_conn_request() is sending the SYNACK, | 231 | /* tcp_conn_request() is sending the SYNACK, |
230 | * and queues the child into listener accept queue. | 232 | * and queues the child into listener accept queue. |
231 | */ | 233 | */ |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3ebf45b38bc3..08323bd95f2a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5885,7 +5885,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) | |||
5885 | * so release it. | 5885 | * so release it. |
5886 | */ | 5886 | */ |
5887 | if (req) { | 5887 | if (req) { |
5888 | tp->total_retrans = req->num_retrans; | 5888 | inet_csk(sk)->icsk_retransmits = 0; |
5889 | reqsk_fastopen_remove(sk, req, false); | 5889 | reqsk_fastopen_remove(sk, req, false); |
5890 | } else { | 5890 | } else { |
5891 | /* Make sure socket is routed, for correct metrics. */ | 5891 | /* Make sure socket is routed, for correct metrics. */ |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index bdaef7fd6e47..5288cec4a2b2 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2605,7 +2605,8 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) | |||
2605 | * copying overhead: fragmentation, tunneling, mangling etc. | 2605 | * copying overhead: fragmentation, tunneling, mangling etc. |
2606 | */ | 2606 | */ |
2607 | if (atomic_read(&sk->sk_wmem_alloc) > | 2607 | if (atomic_read(&sk->sk_wmem_alloc) > |
2608 | min(sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), sk->sk_sndbuf)) | 2608 | min_t(u32, sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), |
2609 | sk->sk_sndbuf)) | ||
2609 | return -EAGAIN; | 2610 | return -EAGAIN; |
2610 | 2611 | ||
2611 | if (skb_still_in_host_queue(sk, skb)) | 2612 | if (skb_still_in_host_queue(sk, skb)) |
@@ -2830,7 +2831,7 @@ begin_fwd: | |||
2830 | if (tcp_retransmit_skb(sk, skb, segs)) | 2831 | if (tcp_retransmit_skb(sk, skb, segs)) |
2831 | return; | 2832 | return; |
2832 | 2833 | ||
2833 | NET_INC_STATS(sock_net(sk), mib_idx); | 2834 | NET_ADD_STATS(sock_net(sk), mib_idx, tcp_skb_pcount(skb)); |
2834 | 2835 | ||
2835 | if (tcp_in_cwnd_reduction(sk)) | 2836 | if (tcp_in_cwnd_reduction(sk)) |
2836 | tp->prr_out += tcp_skb_pcount(skb); | 2837 | tp->prr_out += tcp_skb_pcount(skb); |
@@ -3567,6 +3568,8 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req) | |||
3567 | if (!res) { | 3568 | if (!res) { |
3568 | __TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS); | 3569 | __TCP_INC_STATS(sock_net(sk), TCP_MIB_RETRANSSEGS); |
3569 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); | 3570 | __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); |
3571 | if (unlikely(tcp_passive_fastopen(sk))) | ||
3572 | tcp_sk(sk)->total_retrans++; | ||
3570 | } | 3573 | } |
3571 | return res; | 3574 | return res; |
3572 | } | 3575 | } |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index d84930b2dd95..f712b411f6ed 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -384,6 +384,7 @@ static void tcp_fastopen_synack_timer(struct sock *sk) | |||
384 | */ | 384 | */ |
385 | inet_rtx_syn_ack(sk, req); | 385 | inet_rtx_syn_ack(sk, req); |
386 | req->num_timeout++; | 386 | req->num_timeout++; |
387 | icsk->icsk_retransmits++; | ||
387 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | 388 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, |
388 | TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); | 389 | TCP_TIMEOUT_INIT << req->num_timeout, TCP_RTO_MAX); |
389 | } | 390 | } |
diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c index 028eb046ea40..9c5fc973267f 100644 --- a/net/ipv4/tcp_yeah.c +++ b/net/ipv4/tcp_yeah.c | |||
@@ -76,7 +76,7 @@ static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack, u32 acked) | |||
76 | if (!tcp_is_cwnd_limited(sk)) | 76 | if (!tcp_is_cwnd_limited(sk)) |
77 | return; | 77 | return; |
78 | 78 | ||
79 | if (tp->snd_cwnd <= tp->snd_ssthresh) | 79 | if (tcp_in_slow_start(tp)) |
80 | tcp_slow_start(tp, acked); | 80 | tcp_slow_start(tp, acked); |
81 | 81 | ||
82 | else if (!yeah->doing_reno_now) { | 82 | else if (!yeah->doing_reno_now) { |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index b644a23c3db0..41f5b504a782 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -29,7 +29,7 @@ static struct dst_entry *__xfrm4_dst_lookup(struct net *net, struct flowi4 *fl4, | |||
29 | memset(fl4, 0, sizeof(*fl4)); | 29 | memset(fl4, 0, sizeof(*fl4)); |
30 | fl4->daddr = daddr->a4; | 30 | fl4->daddr = daddr->a4; |
31 | fl4->flowi4_tos = tos; | 31 | fl4->flowi4_tos = tos; |
32 | fl4->flowi4_oif = oif; | 32 | fl4->flowi4_oif = l3mdev_master_ifindex_by_index(net, oif); |
33 | if (saddr) | 33 | if (saddr) |
34 | fl4->saddr = saddr->a4; | 34 | fl4->saddr = saddr->a4; |
35 | 35 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f418d2eaeddd..2f1f5d439788 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -778,7 +778,14 @@ static int addrconf_fixup_forwarding(struct ctl_table *table, int *p, int newf) | |||
778 | } | 778 | } |
779 | 779 | ||
780 | if (p == &net->ipv6.devconf_all->forwarding) { | 780 | if (p == &net->ipv6.devconf_all->forwarding) { |
781 | int old_dflt = net->ipv6.devconf_dflt->forwarding; | ||
782 | |||
781 | net->ipv6.devconf_dflt->forwarding = newf; | 783 | net->ipv6.devconf_dflt->forwarding = newf; |
784 | if ((!newf) ^ (!old_dflt)) | ||
785 | inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, | ||
786 | NETCONFA_IFINDEX_DEFAULT, | ||
787 | net->ipv6.devconf_dflt); | ||
788 | |||
782 | addrconf_forward_change(net, newf); | 789 | addrconf_forward_change(net, newf); |
783 | if ((!newf) ^ (!old)) | 790 | if ((!newf) ^ (!old)) |
784 | inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, | 791 | inet6_netconf_notify_devconf(net, NETCONFA_FORWARDING, |
@@ -1941,6 +1948,7 @@ errdad: | |||
1941 | spin_unlock_bh(&ifp->lock); | 1948 | spin_unlock_bh(&ifp->lock); |
1942 | 1949 | ||
1943 | addrconf_mod_dad_work(ifp, 0); | 1950 | addrconf_mod_dad_work(ifp, 0); |
1951 | in6_ifa_put(ifp); | ||
1944 | } | 1952 | } |
1945 | 1953 | ||
1946 | /* Join to solicited addr multicast group. | 1954 | /* Join to solicited addr multicast group. |
@@ -3850,6 +3858,7 @@ static void addrconf_dad_work(struct work_struct *w) | |||
3850 | addrconf_dad_begin(ifp); | 3858 | addrconf_dad_begin(ifp); |
3851 | goto out; | 3859 | goto out; |
3852 | } else if (action == DAD_ABORT) { | 3860 | } else if (action == DAD_ABORT) { |
3861 | in6_ifa_hold(ifp); | ||
3853 | addrconf_dad_stop(ifp, 1); | 3862 | addrconf_dad_stop(ifp, 1); |
3854 | if (disable_ipv6) | 3863 | if (disable_ipv6) |
3855 | addrconf_ifdown(idev->dev, 0); | 3864 | addrconf_ifdown(idev->dev, 0); |
@@ -6025,7 +6034,7 @@ static const struct ctl_table addrconf_sysctl[] = { | |||
6025 | static int __addrconf_sysctl_register(struct net *net, char *dev_name, | 6034 | static int __addrconf_sysctl_register(struct net *net, char *dev_name, |
6026 | struct inet6_dev *idev, struct ipv6_devconf *p) | 6035 | struct inet6_dev *idev, struct ipv6_devconf *p) |
6027 | { | 6036 | { |
6028 | int i; | 6037 | int i, ifindex; |
6029 | struct ctl_table *table; | 6038 | struct ctl_table *table; |
6030 | char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; | 6039 | char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; |
6031 | 6040 | ||
@@ -6045,6 +6054,13 @@ static int __addrconf_sysctl_register(struct net *net, char *dev_name, | |||
6045 | if (!p->sysctl_header) | 6054 | if (!p->sysctl_header) |
6046 | goto free; | 6055 | goto free; |
6047 | 6056 | ||
6057 | if (!strcmp(dev_name, "all")) | ||
6058 | ifindex = NETCONFA_IFINDEX_ALL; | ||
6059 | else if (!strcmp(dev_name, "default")) | ||
6060 | ifindex = NETCONFA_IFINDEX_DEFAULT; | ||
6061 | else | ||
6062 | ifindex = idev->dev->ifindex; | ||
6063 | inet6_netconf_notify_devconf(net, NETCONFA_ALL, ifindex, p); | ||
6048 | return 0; | 6064 | return 0; |
6049 | 6065 | ||
6050 | free: | 6066 | free: |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 7b0481e3738f..888543debe4e 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1174,6 +1174,7 @@ ip4ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1174 | encap_limit = t->parms.encap_limit; | 1174 | encap_limit = t->parms.encap_limit; |
1175 | 1175 | ||
1176 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); | 1176 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); |
1177 | fl6.flowi6_proto = IPPROTO_IPIP; | ||
1177 | 1178 | ||
1178 | dsfield = ipv4_get_dsfield(iph); | 1179 | dsfield = ipv4_get_dsfield(iph); |
1179 | 1180 | ||
@@ -1233,6 +1234,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1233 | encap_limit = t->parms.encap_limit; | 1234 | encap_limit = t->parms.encap_limit; |
1234 | 1235 | ||
1235 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); | 1236 | memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6)); |
1237 | fl6.flowi6_proto = IPPROTO_IPV6; | ||
1236 | 1238 | ||
1237 | dsfield = ipv6_get_dsfield(ipv6h); | 1239 | dsfield = ipv6_get_dsfield(ipv6h); |
1238 | if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) | 1240 | if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS) |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index d90a11f14040..5bd3afdcc771 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -321,11 +321,9 @@ static int vti6_rcv(struct sk_buff *skb) | |||
321 | goto discard; | 321 | goto discard; |
322 | } | 322 | } |
323 | 323 | ||
324 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; | ||
325 | |||
326 | rcu_read_unlock(); | 324 | rcu_read_unlock(); |
327 | 325 | ||
328 | return xfrm6_rcv(skb); | 326 | return xfrm6_rcv_tnl(skb, t); |
329 | } | 327 | } |
330 | rcu_read_unlock(); | 328 | rcu_read_unlock(); |
331 | return -EINVAL; | 329 | return -EINVAL; |
@@ -340,6 +338,7 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
340 | struct net_device *dev; | 338 | struct net_device *dev; |
341 | struct pcpu_sw_netstats *tstats; | 339 | struct pcpu_sw_netstats *tstats; |
342 | struct xfrm_state *x; | 340 | struct xfrm_state *x; |
341 | struct xfrm_mode *inner_mode; | ||
343 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; | 342 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; |
344 | u32 orig_mark = skb->mark; | 343 | u32 orig_mark = skb->mark; |
345 | int ret; | 344 | int ret; |
@@ -357,7 +356,19 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
357 | } | 356 | } |
358 | 357 | ||
359 | x = xfrm_input_state(skb); | 358 | x = xfrm_input_state(skb); |
360 | family = x->inner_mode->afinfo->family; | 359 | |
360 | inner_mode = x->inner_mode; | ||
361 | |||
362 | if (x->sel.family == AF_UNSPEC) { | ||
363 | inner_mode = xfrm_ip2inner_mode(x, XFRM_MODE_SKB_CB(skb)->protocol); | ||
364 | if (inner_mode == NULL) { | ||
365 | XFRM_INC_STATS(dev_net(skb->dev), | ||
366 | LINUX_MIB_XFRMINSTATEMODEERROR); | ||
367 | return -EINVAL; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | family = inner_mode->afinfo->family; | ||
361 | 372 | ||
362 | skb->mark = be32_to_cpu(t->parms.i_key); | 373 | skb->mark = be32_to_cpu(t->parms.i_key); |
363 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); | 374 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 6122f9c5cc49..fccb5dd91902 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -2239,6 +2239,7 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | |||
2239 | struct rta_mfc_stats mfcs; | 2239 | struct rta_mfc_stats mfcs; |
2240 | struct nlattr *mp_attr; | 2240 | struct nlattr *mp_attr; |
2241 | struct rtnexthop *nhp; | 2241 | struct rtnexthop *nhp; |
2242 | unsigned long lastuse; | ||
2242 | int ct; | 2243 | int ct; |
2243 | 2244 | ||
2244 | /* If cache is unresolved, don't try to parse IIF and OIF */ | 2245 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
@@ -2269,12 +2270,14 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | |||
2269 | 2270 | ||
2270 | nla_nest_end(skb, mp_attr); | 2271 | nla_nest_end(skb, mp_attr); |
2271 | 2272 | ||
2273 | lastuse = READ_ONCE(c->mfc_un.res.lastuse); | ||
2274 | lastuse = time_after_eq(jiffies, lastuse) ? jiffies - lastuse : 0; | ||
2275 | |||
2272 | mfcs.mfcs_packets = c->mfc_un.res.pkt; | 2276 | mfcs.mfcs_packets = c->mfc_un.res.pkt; |
2273 | mfcs.mfcs_bytes = c->mfc_un.res.bytes; | 2277 | mfcs.mfcs_bytes = c->mfc_un.res.bytes; |
2274 | mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; | 2278 | mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; |
2275 | if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || | 2279 | if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || |
2276 | nla_put_u64_64bit(skb, RTA_EXPIRES, | 2280 | nla_put_u64_64bit(skb, RTA_EXPIRES, jiffies_to_clock_t(lastuse), |
2277 | jiffies_to_clock_t(c->mfc_un.res.lastuse), | ||
2278 | RTA_PAD)) | 2281 | RTA_PAD)) |
2279 | return -EMSGSIZE; | 2282 | return -EMSGSIZE; |
2280 | 2283 | ||
diff --git a/net/ipv6/netfilter/nft_chain_route_ipv6.c b/net/ipv6/netfilter/nft_chain_route_ipv6.c index 71d995ff3108..2535223ba956 100644 --- a/net/ipv6/netfilter/nft_chain_route_ipv6.c +++ b/net/ipv6/netfilter/nft_chain_route_ipv6.c | |||
@@ -31,6 +31,7 @@ static unsigned int nf_route_table_hook(void *priv, | |||
31 | struct in6_addr saddr, daddr; | 31 | struct in6_addr saddr, daddr; |
32 | u_int8_t hop_limit; | 32 | u_int8_t hop_limit; |
33 | u32 mark, flowlabel; | 33 | u32 mark, flowlabel; |
34 | int err; | ||
34 | 35 | ||
35 | /* malformed packet, drop it */ | 36 | /* malformed packet, drop it */ |
36 | if (nft_set_pktinfo_ipv6(&pkt, skb, state) < 0) | 37 | if (nft_set_pktinfo_ipv6(&pkt, skb, state) < 0) |
@@ -46,13 +47,16 @@ static unsigned int nf_route_table_hook(void *priv, | |||
46 | flowlabel = *((u32 *)ipv6_hdr(skb)); | 47 | flowlabel = *((u32 *)ipv6_hdr(skb)); |
47 | 48 | ||
48 | ret = nft_do_chain(&pkt, priv); | 49 | ret = nft_do_chain(&pkt, priv); |
49 | if (ret != NF_DROP && ret != NF_QUEUE && | 50 | if (ret != NF_DROP && ret != NF_STOLEN && |
50 | (memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr)) || | 51 | (memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr)) || |
51 | memcmp(&ipv6_hdr(skb)->daddr, &daddr, sizeof(daddr)) || | 52 | memcmp(&ipv6_hdr(skb)->daddr, &daddr, sizeof(daddr)) || |
52 | skb->mark != mark || | 53 | skb->mark != mark || |
53 | ipv6_hdr(skb)->hop_limit != hop_limit || | 54 | ipv6_hdr(skb)->hop_limit != hop_limit || |
54 | flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) | 55 | flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { |
55 | return ip6_route_me_harder(state->net, skb) == 0 ? ret : NF_DROP; | 56 | err = ip6_route_me_harder(state->net, skb); |
57 | if (err < 0) | ||
58 | ret = NF_DROP_ERR(err); | ||
59 | } | ||
56 | 60 | ||
57 | return ret; | 61 | return ret; |
58 | } | 62 | } |
diff --git a/net/ipv6/netfilter/nft_reject_ipv6.c b/net/ipv6/netfilter/nft_reject_ipv6.c index 533cd5719c59..92bda9908bb9 100644 --- a/net/ipv6/netfilter/nft_reject_ipv6.c +++ b/net/ipv6/netfilter/nft_reject_ipv6.c | |||
@@ -47,6 +47,7 @@ static const struct nft_expr_ops nft_reject_ipv6_ops = { | |||
47 | .eval = nft_reject_ipv6_eval, | 47 | .eval = nft_reject_ipv6_eval, |
48 | .init = nft_reject_init, | 48 | .init = nft_reject_init, |
49 | .dump = nft_reject_dump, | 49 | .dump = nft_reject_dump, |
50 | .validate = nft_reject_validate, | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | static struct nft_expr_type nft_reject_ipv6_type __read_mostly = { | 53 | static struct nft_expr_type nft_reject_ipv6_type __read_mostly = { |
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c index 0900352c924c..0e983b694ee8 100644 --- a/net/ipv6/ping.c +++ b/net/ipv6/ping.c | |||
@@ -126,8 +126,10 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
126 | rt = (struct rt6_info *) dst; | 126 | rt = (struct rt6_info *) dst; |
127 | 127 | ||
128 | np = inet6_sk(sk); | 128 | np = inet6_sk(sk); |
129 | if (!np) | 129 | if (!np) { |
130 | return -EBADF; | 130 | err = -EBADF; |
131 | goto dst_err_out; | ||
132 | } | ||
131 | 133 | ||
132 | if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) | 134 | if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) |
133 | fl6.flowi6_oif = np->mcast_oif; | 135 | fl6.flowi6_oif = np->mcast_oif; |
@@ -163,6 +165,9 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) | |||
163 | } | 165 | } |
164 | release_sock(sk); | 166 | release_sock(sk); |
165 | 167 | ||
168 | dst_err_out: | ||
169 | dst_release(dst); | ||
170 | |||
166 | if (err) | 171 | if (err) |
167 | return err; | 172 | return err; |
168 | 173 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 49817555449e..e3a224b97905 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1986,9 +1986,18 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg) | |||
1986 | if (!(gwa_type & IPV6_ADDR_UNICAST)) | 1986 | if (!(gwa_type & IPV6_ADDR_UNICAST)) |
1987 | goto out; | 1987 | goto out; |
1988 | 1988 | ||
1989 | if (cfg->fc_table) | 1989 | if (cfg->fc_table) { |
1990 | grt = ip6_nh_lookup_table(net, cfg, gw_addr); | 1990 | grt = ip6_nh_lookup_table(net, cfg, gw_addr); |
1991 | 1991 | ||
1992 | if (grt) { | ||
1993 | if (grt->rt6i_flags & RTF_GATEWAY || | ||
1994 | (dev && dev != grt->dst.dev)) { | ||
1995 | ip6_rt_put(grt); | ||
1996 | grt = NULL; | ||
1997 | } | ||
1998 | } | ||
1999 | } | ||
2000 | |||
1992 | if (!grt) | 2001 | if (!grt) |
1993 | grt = rt6_lookup(net, gw_addr, NULL, | 2002 | grt = rt6_lookup(net, gw_addr, NULL, |
1994 | cfg->fc_ifindex, 1); | 2003 | cfg->fc_ifindex, 1); |
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 0eaab1fa6be5..b5789562aded 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c | |||
@@ -21,8 +21,10 @@ int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb) | |||
21 | return xfrm6_extract_header(skb); | 21 | return xfrm6_extract_header(skb); |
22 | } | 22 | } |
23 | 23 | ||
24 | int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | 24 | int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi, |
25 | struct ip6_tnl *t) | ||
25 | { | 26 | { |
27 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; | ||
26 | XFRM_SPI_SKB_CB(skb)->family = AF_INET6; | 28 | XFRM_SPI_SKB_CB(skb)->family = AF_INET6; |
27 | XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); | 29 | XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct ipv6hdr, daddr); |
28 | return xfrm_input(skb, nexthdr, spi, 0); | 30 | return xfrm_input(skb, nexthdr, spi, 0); |
@@ -48,13 +50,18 @@ int xfrm6_transport_finish(struct sk_buff *skb, int async) | |||
48 | return -1; | 50 | return -1; |
49 | } | 51 | } |
50 | 52 | ||
51 | int xfrm6_rcv(struct sk_buff *skb) | 53 | int xfrm6_rcv_tnl(struct sk_buff *skb, struct ip6_tnl *t) |
52 | { | 54 | { |
53 | return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff], | 55 | return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff], |
54 | 0); | 56 | 0, t); |
55 | } | 57 | } |
56 | EXPORT_SYMBOL(xfrm6_rcv); | 58 | EXPORT_SYMBOL(xfrm6_rcv_tnl); |
57 | 59 | ||
60 | int xfrm6_rcv(struct sk_buff *skb) | ||
61 | { | ||
62 | return xfrm6_rcv_tnl(skb, NULL); | ||
63 | } | ||
64 | EXPORT_SYMBOL(xfrm6_rcv); | ||
58 | int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | 65 | int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
59 | xfrm_address_t *saddr, u8 proto) | 66 | xfrm_address_t *saddr, u8 proto) |
60 | { | 67 | { |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 6cc97003e4a9..70a86adad875 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -36,7 +36,7 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, int oif, | |||
36 | int err; | 36 | int err; |
37 | 37 | ||
38 | memset(&fl6, 0, sizeof(fl6)); | 38 | memset(&fl6, 0, sizeof(fl6)); |
39 | fl6.flowi6_oif = oif; | 39 | fl6.flowi6_oif = l3mdev_master_ifindex_by_index(net, oif); |
40 | fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; | 40 | fl6.flowi6_flags = FLOWI_FLAG_SKIP_NH_OIF; |
41 | memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); | 41 | memcpy(&fl6.daddr, daddr, sizeof(fl6.daddr)); |
42 | if (saddr) | 42 | if (saddr) |
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 5743044cd660..e1c0bbe7996c 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -236,7 +236,7 @@ static int xfrm6_tunnel_rcv(struct sk_buff *skb) | |||
236 | __be32 spi; | 236 | __be32 spi; |
237 | 237 | ||
238 | spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr); | 238 | spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr); |
239 | return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi); | 239 | return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi, NULL); |
240 | } | 240 | } |
241 | 241 | ||
242 | static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 242 | static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 8d2f7c9b491d..ccc244406fb9 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -832,7 +832,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
832 | struct sock *sk = sock->sk; | 832 | struct sock *sk = sock->sk; |
833 | struct irda_sock *new, *self = irda_sk(sk); | 833 | struct irda_sock *new, *self = irda_sk(sk); |
834 | struct sock *newsk; | 834 | struct sock *newsk; |
835 | struct sk_buff *skb; | 835 | struct sk_buff *skb = NULL; |
836 | int err; | 836 | int err; |
837 | 837 | ||
838 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); | 838 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); |
@@ -900,7 +900,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
900 | err = -EPERM; /* value does not seem to make sense. -arnd */ | 900 | err = -EPERM; /* value does not seem to make sense. -arnd */ |
901 | if (!new->tsap) { | 901 | if (!new->tsap) { |
902 | pr_debug("%s(), dup failed!\n", __func__); | 902 | pr_debug("%s(), dup failed!\n", __func__); |
903 | kfree_skb(skb); | ||
904 | goto out; | 903 | goto out; |
905 | } | 904 | } |
906 | 905 | ||
@@ -919,7 +918,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
919 | /* Clean up the original one to keep it in listen state */ | 918 | /* Clean up the original one to keep it in listen state */ |
920 | irttp_listen(self->tsap); | 919 | irttp_listen(self->tsap); |
921 | 920 | ||
922 | kfree_skb(skb); | ||
923 | sk->sk_ack_backlog--; | 921 | sk->sk_ack_backlog--; |
924 | 922 | ||
925 | newsock->state = SS_CONNECTED; | 923 | newsock->state = SS_CONNECTED; |
@@ -927,6 +925,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
927 | irda_connect_response(new); | 925 | irda_connect_response(new); |
928 | err = 0; | 926 | err = 0; |
929 | out: | 927 | out: |
928 | kfree_skb(skb); | ||
930 | release_sock(sk); | 929 | release_sock(sk); |
931 | return err; | 930 | return err; |
932 | } | 931 | } |
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c index cb39e05b166c..411693288648 100644 --- a/net/kcm/kcmsock.c +++ b/net/kcm/kcmsock.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/socket.h> | 13 | #include <linux/socket.h> |
14 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
15 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
16 | #include <linux/syscalls.h> | ||
16 | #include <net/kcm.h> | 17 | #include <net/kcm.h> |
17 | #include <net/netns/generic.h> | 18 | #include <net/netns/generic.h> |
18 | #include <net/sock.h> | 19 | #include <net/sock.h> |
@@ -2029,7 +2030,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
2029 | if (copy_to_user((void __user *)arg, &info, | 2030 | if (copy_to_user((void __user *)arg, &info, |
2030 | sizeof(info))) { | 2031 | sizeof(info))) { |
2031 | err = -EFAULT; | 2032 | err = -EFAULT; |
2032 | sock_release(newsock); | 2033 | sys_close(info.fd); |
2033 | } | 2034 | } |
2034 | } | 2035 | } |
2035 | 2036 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index 1e40dacaa137..a2ed3bda4ddc 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1855,6 +1855,9 @@ static __net_exit void l2tp_exit_net(struct net *net) | |||
1855 | (void)l2tp_tunnel_delete(tunnel); | 1855 | (void)l2tp_tunnel_delete(tunnel); |
1856 | } | 1856 | } |
1857 | rcu_read_unlock_bh(); | 1857 | rcu_read_unlock_bh(); |
1858 | |||
1859 | flush_workqueue(l2tp_wq); | ||
1860 | rcu_barrier(); | ||
1858 | } | 1861 | } |
1859 | 1862 | ||
1860 | static struct pernet_operations l2tp_net_ops = { | 1863 | static struct pernet_operations l2tp_net_ops = { |
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index a9aff6079c42..afa94687d5e1 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c | |||
@@ -261,10 +261,16 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta, | |||
261 | .timeout = timeout, | 261 | .timeout = timeout, |
262 | .ssn = start_seq_num, | 262 | .ssn = start_seq_num, |
263 | }; | 263 | }; |
264 | |||
265 | int i, ret = -EOPNOTSUPP; | 264 | int i, ret = -EOPNOTSUPP; |
266 | u16 status = WLAN_STATUS_REQUEST_DECLINED; | 265 | u16 status = WLAN_STATUS_REQUEST_DECLINED; |
267 | 266 | ||
267 | if (tid >= IEEE80211_FIRST_TSPEC_TSID) { | ||
268 | ht_dbg(sta->sdata, | ||
269 | "STA %pM requests BA session on unsupported tid %d\n", | ||
270 | sta->sta.addr, tid); | ||
271 | goto end_no_lock; | ||
272 | } | ||
273 | |||
268 | if (!sta->sta.ht_cap.ht_supported) { | 274 | if (!sta->sta.ht_cap.ht_supported) { |
269 | ht_dbg(sta->sdata, | 275 | ht_dbg(sta->sdata, |
270 | "STA %pM erroneously requests BA session on tid %d w/o QoS\n", | 276 | "STA %pM erroneously requests BA session on tid %d w/o QoS\n", |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index 5650c46bf91a..45319cc01121 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -584,6 +584,9 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, | |||
584 | ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) | 584 | ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) |
585 | return -EINVAL; | 585 | return -EINVAL; |
586 | 586 | ||
587 | if (WARN_ON(tid >= IEEE80211_FIRST_TSPEC_TSID)) | ||
588 | return -EINVAL; | ||
589 | |||
587 | ht_dbg(sdata, "Open BA session requested for %pM tid %u\n", | 590 | ht_dbg(sdata, "Open BA session requested for %pM tid %u\n", |
588 | pubsta->addr, tid); | 591 | pubsta->addr, tid); |
589 | 592 | ||
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 8f9c3bde835f..faccef977670 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -746,6 +746,7 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, | |||
746 | sta = next_hop_deref_protected(mpath); | 746 | sta = next_hop_deref_protected(mpath); |
747 | if (mpath->flags & MESH_PATH_ACTIVE && | 747 | if (mpath->flags & MESH_PATH_ACTIVE && |
748 | ether_addr_equal(ta, sta->sta.addr) && | 748 | ether_addr_equal(ta, sta->sta.addr) && |
749 | !(mpath->flags & MESH_PATH_FIXED) && | ||
749 | (!(mpath->flags & MESH_PATH_SN_VALID) || | 750 | (!(mpath->flags & MESH_PATH_SN_VALID) || |
750 | SN_GT(target_sn, mpath->sn) || target_sn == 0)) { | 751 | SN_GT(target_sn, mpath->sn) || target_sn == 0)) { |
751 | mpath->flags &= ~MESH_PATH_ACTIVE; | 752 | mpath->flags &= ~MESH_PATH_ACTIVE; |
@@ -1012,7 +1013,7 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) | |||
1012 | goto enddiscovery; | 1013 | goto enddiscovery; |
1013 | 1014 | ||
1014 | spin_lock_bh(&mpath->state_lock); | 1015 | spin_lock_bh(&mpath->state_lock); |
1015 | if (mpath->flags & MESH_PATH_DELETED) { | 1016 | if (mpath->flags & (MESH_PATH_DELETED | MESH_PATH_FIXED)) { |
1016 | spin_unlock_bh(&mpath->state_lock); | 1017 | spin_unlock_bh(&mpath->state_lock); |
1017 | goto enddiscovery; | 1018 | goto enddiscovery; |
1018 | } | 1019 | } |
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c index 6db2ddfa0695..f0e6175a9821 100644 --- a/net/mac80211/mesh_pathtbl.c +++ b/net/mac80211/mesh_pathtbl.c | |||
@@ -826,7 +826,7 @@ void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop) | |||
826 | mpath->metric = 0; | 826 | mpath->metric = 0; |
827 | mpath->hop_count = 0; | 827 | mpath->hop_count = 0; |
828 | mpath->exp_time = 0; | 828 | mpath->exp_time = 0; |
829 | mpath->flags |= MESH_PATH_FIXED; | 829 | mpath->flags = MESH_PATH_FIXED | MESH_PATH_SN_VALID; |
830 | mesh_path_activate(mpath); | 830 | mesh_path_activate(mpath); |
831 | spin_unlock_bh(&mpath->state_lock); | 831 | spin_unlock_bh(&mpath->state_lock); |
832 | mesh_path_tx_pending(mpath); | 832 | mesh_path_tx_pending(mpath); |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 76b737dcc36f..aa58df80ede0 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1616,7 +1616,6 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, | |||
1616 | 1616 | ||
1617 | sta_info_recalc_tim(sta); | 1617 | sta_info_recalc_tim(sta); |
1618 | } else { | 1618 | } else { |
1619 | unsigned long tids = sta->txq_buffered_tids & driver_release_tids; | ||
1620 | int tid; | 1619 | int tid; |
1621 | 1620 | ||
1622 | /* | 1621 | /* |
@@ -1648,7 +1647,8 @@ ieee80211_sta_ps_deliver_response(struct sta_info *sta, | |||
1648 | for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { | 1647 | for (tid = 0; tid < ARRAY_SIZE(sta->sta.txq); tid++) { |
1649 | struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]); | 1648 | struct txq_info *txqi = to_txq_info(sta->sta.txq[tid]); |
1650 | 1649 | ||
1651 | if (!(tids & BIT(tid)) || txqi->tin.backlog_packets) | 1650 | if (!(driver_release_tids & BIT(tid)) || |
1651 | txqi->tin.backlog_packets) | ||
1652 | continue; | 1652 | continue; |
1653 | 1653 | ||
1654 | sta_info_recalc_tim(sta); | 1654 | sta_info_recalc_tim(sta); |
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index b5d28f14b9cf..afca7d103684 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c | |||
@@ -333,10 +333,11 @@ ieee80211_tdls_chandef_vht_upgrade(struct ieee80211_sub_if_data *sdata, | |||
333 | if (!uc.center_freq1) | 333 | if (!uc.center_freq1) |
334 | return; | 334 | return; |
335 | 335 | ||
336 | /* proceed to downgrade the chandef until usable or the same */ | 336 | /* proceed to downgrade the chandef until usable or the same as AP BW */ |
337 | while (uc.width > max_width || | 337 | while (uc.width > max_width || |
338 | !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, | 338 | (uc.width > sta->tdls_chandef.width && |
339 | sdata->wdev.iftype)) | 339 | !cfg80211_reg_can_beacon_relax(sdata->local->hw.wiphy, &uc, |
340 | sdata->wdev.iftype))) | ||
340 | ieee80211_chandef_downgrade(&uc); | 341 | ieee80211_chandef_downgrade(&uc); |
341 | 342 | ||
342 | if (!cfg80211_chandef_identical(&uc, &sta->tdls_chandef)) { | 343 | if (!cfg80211_chandef_identical(&uc, &sta->tdls_chandef)) { |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 502396694f47..18b285e06bc8 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -796,6 +796,36 @@ static __le16 ieee80211_tx_next_seq(struct sta_info *sta, int tid) | |||
796 | return ret; | 796 | return ret; |
797 | } | 797 | } |
798 | 798 | ||
799 | static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local, | ||
800 | struct ieee80211_vif *vif, | ||
801 | struct ieee80211_sta *pubsta, | ||
802 | struct sk_buff *skb) | ||
803 | { | ||
804 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
805 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
806 | struct ieee80211_txq *txq = NULL; | ||
807 | |||
808 | if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) || | ||
809 | (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)) | ||
810 | return NULL; | ||
811 | |||
812 | if (!ieee80211_is_data(hdr->frame_control)) | ||
813 | return NULL; | ||
814 | |||
815 | if (pubsta) { | ||
816 | u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; | ||
817 | |||
818 | txq = pubsta->txq[tid]; | ||
819 | } else if (vif) { | ||
820 | txq = vif->txq; | ||
821 | } | ||
822 | |||
823 | if (!txq) | ||
824 | return NULL; | ||
825 | |||
826 | return to_txq_info(txq); | ||
827 | } | ||
828 | |||
799 | static ieee80211_tx_result debug_noinline | 829 | static ieee80211_tx_result debug_noinline |
800 | ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | 830 | ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) |
801 | { | 831 | { |
@@ -853,7 +883,8 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
853 | tid = *qc & IEEE80211_QOS_CTL_TID_MASK; | 883 | tid = *qc & IEEE80211_QOS_CTL_TID_MASK; |
854 | tx->sta->tx_stats.msdu[tid]++; | 884 | tx->sta->tx_stats.msdu[tid]++; |
855 | 885 | ||
856 | if (!tx->sta->sta.txq[0]) | 886 | if (!ieee80211_get_txq(tx->local, info->control.vif, &tx->sta->sta, |
887 | tx->skb)) | ||
857 | hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); | 888 | hdr->seq_ctrl = ieee80211_tx_next_seq(tx->sta, tid); |
858 | 889 | ||
859 | return TX_CONTINUE; | 890 | return TX_CONTINUE; |
@@ -1243,36 +1274,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1243 | return TX_CONTINUE; | 1274 | return TX_CONTINUE; |
1244 | } | 1275 | } |
1245 | 1276 | ||
1246 | static struct txq_info *ieee80211_get_txq(struct ieee80211_local *local, | ||
1247 | struct ieee80211_vif *vif, | ||
1248 | struct ieee80211_sta *pubsta, | ||
1249 | struct sk_buff *skb) | ||
1250 | { | ||
1251 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
1252 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
1253 | struct ieee80211_txq *txq = NULL; | ||
1254 | |||
1255 | if ((info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) || | ||
1256 | (info->control.flags & IEEE80211_TX_CTRL_PS_RESPONSE)) | ||
1257 | return NULL; | ||
1258 | |||
1259 | if (!ieee80211_is_data(hdr->frame_control)) | ||
1260 | return NULL; | ||
1261 | |||
1262 | if (pubsta) { | ||
1263 | u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; | ||
1264 | |||
1265 | txq = pubsta->txq[tid]; | ||
1266 | } else if (vif) { | ||
1267 | txq = vif->txq; | ||
1268 | } | ||
1269 | |||
1270 | if (!txq) | ||
1271 | return NULL; | ||
1272 | |||
1273 | return to_txq_info(txq); | ||
1274 | } | ||
1275 | |||
1276 | static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb) | 1277 | static void ieee80211_set_skb_enqueue_time(struct sk_buff *skb) |
1277 | { | 1278 | { |
1278 | IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time(); | 1279 | IEEE80211_SKB_CB(skb)->control.enqueue_time = codel_get_time(); |
@@ -1514,8 +1515,12 @@ out: | |||
1514 | spin_unlock_bh(&fq->lock); | 1515 | spin_unlock_bh(&fq->lock); |
1515 | 1516 | ||
1516 | if (skb && skb_has_frag_list(skb) && | 1517 | if (skb && skb_has_frag_list(skb) && |
1517 | !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) | 1518 | !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) { |
1518 | skb_linearize(skb); | 1519 | if (skb_linearize(skb)) { |
1520 | ieee80211_free_txskb(&local->hw, skb); | ||
1521 | return NULL; | ||
1522 | } | ||
1523 | } | ||
1519 | 1524 | ||
1520 | return skb; | 1525 | return skb; |
1521 | } | 1526 | } |
@@ -3264,7 +3269,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata, | |||
3264 | 3269 | ||
3265 | if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { | 3270 | if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) { |
3266 | *ieee80211_get_qos_ctl(hdr) = tid; | 3271 | *ieee80211_get_qos_ctl(hdr) = tid; |
3267 | if (!sta->sta.txq[0]) | 3272 | if (!ieee80211_get_txq(local, &sdata->vif, &sta->sta, skb)) |
3268 | hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); | 3273 | hdr->seq_ctrl = ieee80211_tx_next_seq(sta, tid); |
3269 | } else { | 3274 | } else { |
3270 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 3275 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index dd2c43abf9e2..9934b0c93c1e 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1035,9 +1035,9 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, | |||
1035 | if (IS_ERR(ct)) | 1035 | if (IS_ERR(ct)) |
1036 | return (struct nf_conntrack_tuple_hash *)ct; | 1036 | return (struct nf_conntrack_tuple_hash *)ct; |
1037 | 1037 | ||
1038 | if (tmpl && nfct_synproxy(tmpl)) { | 1038 | if (!nf_ct_add_synproxy(ct, tmpl)) { |
1039 | nfct_seqadj_ext_add(ct); | 1039 | nf_conntrack_free(ct); |
1040 | nfct_synproxy_ext_add(ct); | 1040 | return ERR_PTR(-ENOMEM); |
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | timeout_ext = tmpl ? nf_ct_timeout_find(tmpl) : NULL; | 1043 | timeout_ext = tmpl ? nf_ct_timeout_find(tmpl) : NULL; |
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c index de31818417b8..ecee105bbada 100644 --- a/net/netfilter/nf_nat_core.c +++ b/net/netfilter/nf_nat_core.c | |||
@@ -441,7 +441,8 @@ nf_nat_setup_info(struct nf_conn *ct, | |||
441 | ct->status |= IPS_DST_NAT; | 441 | ct->status |= IPS_DST_NAT; |
442 | 442 | ||
443 | if (nfct_help(ct)) | 443 | if (nfct_help(ct)) |
444 | nfct_seqadj_ext_add(ct); | 444 | if (!nfct_seqadj_ext_add(ct)) |
445 | return NF_DROP; | ||
445 | } | 446 | } |
446 | 447 | ||
447 | if (maniptype == NF_NAT_MANIP_SRC) { | 448 | if (maniptype == NF_NAT_MANIP_SRC) { |
@@ -807,7 +808,7 @@ nfnetlink_parse_nat_setup(struct nf_conn *ct, | |||
807 | if (err < 0) | 808 | if (err < 0) |
808 | return err; | 809 | return err; |
809 | 810 | ||
810 | return nf_nat_setup_info(ct, &range, manip); | 811 | return nf_nat_setup_info(ct, &range, manip) == NF_DROP ? -ENOMEM : 0; |
811 | } | 812 | } |
812 | #else | 813 | #else |
813 | static int | 814 | static int |
diff --git a/net/netfilter/nf_tables_netdev.c b/net/netfilter/nf_tables_netdev.c index 5eefe4a355c6..75d696f11045 100644 --- a/net/netfilter/nf_tables_netdev.c +++ b/net/netfilter/nf_tables_netdev.c | |||
@@ -30,7 +30,6 @@ nft_netdev_set_pktinfo_ipv4(struct nft_pktinfo *pkt, | |||
30 | if (!iph) | 30 | if (!iph) |
31 | return; | 31 | return; |
32 | 32 | ||
33 | iph = ip_hdr(skb); | ||
34 | if (iph->ihl < 5 || iph->version != 4) | 33 | if (iph->ihl < 5 || iph->version != 4) |
35 | return; | 34 | return; |
36 | 35 | ||
diff --git a/net/netfilter/nf_tables_trace.c b/net/netfilter/nf_tables_trace.c index 39eb1cc62e91..fa24a5b398b1 100644 --- a/net/netfilter/nf_tables_trace.c +++ b/net/netfilter/nf_tables_trace.c | |||
@@ -237,7 +237,7 @@ void nft_trace_notify(struct nft_traceinfo *info) | |||
237 | break; | 237 | break; |
238 | case NFT_TRACETYPE_POLICY: | 238 | case NFT_TRACETYPE_POLICY: |
239 | if (nla_put_be32(skb, NFTA_TRACE_POLICY, | 239 | if (nla_put_be32(skb, NFTA_TRACE_POLICY, |
240 | info->basechain->policy)) | 240 | htonl(info->basechain->policy))) |
241 | goto nla_put_failure; | 241 | goto nla_put_failure; |
242 | break; | 242 | break; |
243 | } | 243 | } |
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index 70eb2f6a3b01..d44d89b56127 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -343,12 +343,12 @@ static int nfnl_acct_del(struct net *net, struct sock *nfnl, | |||
343 | struct sk_buff *skb, const struct nlmsghdr *nlh, | 343 | struct sk_buff *skb, const struct nlmsghdr *nlh, |
344 | const struct nlattr * const tb[]) | 344 | const struct nlattr * const tb[]) |
345 | { | 345 | { |
346 | char *acct_name; | 346 | struct nf_acct *cur, *tmp; |
347 | struct nf_acct *cur; | ||
348 | int ret = -ENOENT; | 347 | int ret = -ENOENT; |
348 | char *acct_name; | ||
349 | 349 | ||
350 | if (!tb[NFACCT_NAME]) { | 350 | if (!tb[NFACCT_NAME]) { |
351 | list_for_each_entry(cur, &net->nfnl_acct_list, head) | 351 | list_for_each_entry_safe(cur, tmp, &net->nfnl_acct_list, head) |
352 | nfnl_acct_try_del(cur); | 352 | nfnl_acct_try_del(cur); |
353 | 353 | ||
354 | return 0; | 354 | return 0; |
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index 68216cdc7083..139e0867e56e 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c | |||
@@ -98,31 +98,28 @@ static int cttimeout_new_timeout(struct net *net, struct sock *ctnl, | |||
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | 100 | ||
101 | l4proto = nf_ct_l4proto_find_get(l3num, l4num); | ||
102 | |||
103 | /* This protocol is not supportted, skip. */ | ||
104 | if (l4proto->l4proto != l4num) { | ||
105 | ret = -EOPNOTSUPP; | ||
106 | goto err_proto_put; | ||
107 | } | ||
108 | |||
109 | if (matching) { | 101 | if (matching) { |
110 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { | 102 | if (nlh->nlmsg_flags & NLM_F_REPLACE) { |
111 | /* You cannot replace one timeout policy by another of | 103 | /* You cannot replace one timeout policy by another of |
112 | * different kind, sorry. | 104 | * different kind, sorry. |
113 | */ | 105 | */ |
114 | if (matching->l3num != l3num || | 106 | if (matching->l3num != l3num || |
115 | matching->l4proto->l4proto != l4num) { | 107 | matching->l4proto->l4proto != l4num) |
116 | ret = -EINVAL; | 108 | return -EINVAL; |
117 | goto err_proto_put; | 109 | |
118 | } | 110 | return ctnl_timeout_parse_policy(&matching->data, |
119 | 111 | matching->l4proto, net, | |
120 | ret = ctnl_timeout_parse_policy(&matching->data, | 112 | cda[CTA_TIMEOUT_DATA]); |
121 | l4proto, net, | ||
122 | cda[CTA_TIMEOUT_DATA]); | ||
123 | return ret; | ||
124 | } | 113 | } |
125 | ret = -EBUSY; | 114 | |
115 | return -EBUSY; | ||
116 | } | ||
117 | |||
118 | l4proto = nf_ct_l4proto_find_get(l3num, l4num); | ||
119 | |||
120 | /* This protocol is not supportted, skip. */ | ||
121 | if (l4proto->l4proto != l4num) { | ||
122 | ret = -EOPNOTSUPP; | ||
126 | goto err_proto_put; | 123 | goto err_proto_put; |
127 | } | 124 | } |
128 | 125 | ||
@@ -305,7 +302,16 @@ static void ctnl_untimeout(struct net *net, struct ctnl_timeout *timeout) | |||
305 | const struct hlist_nulls_node *nn; | 302 | const struct hlist_nulls_node *nn; |
306 | unsigned int last_hsize; | 303 | unsigned int last_hsize; |
307 | spinlock_t *lock; | 304 | spinlock_t *lock; |
308 | int i; | 305 | int i, cpu; |
306 | |||
307 | for_each_possible_cpu(cpu) { | ||
308 | struct ct_pcpu *pcpu = per_cpu_ptr(net->ct.pcpu_lists, cpu); | ||
309 | |||
310 | spin_lock_bh(&pcpu->lock); | ||
311 | hlist_nulls_for_each_entry(h, nn, &pcpu->unconfirmed, hnnode) | ||
312 | untimeout(h, timeout); | ||
313 | spin_unlock_bh(&pcpu->lock); | ||
314 | } | ||
309 | 315 | ||
310 | local_bh_disable(); | 316 | local_bh_disable(); |
311 | restart: | 317 | restart: |
@@ -350,12 +356,13 @@ static int cttimeout_del_timeout(struct net *net, struct sock *ctnl, | |||
350 | const struct nlmsghdr *nlh, | 356 | const struct nlmsghdr *nlh, |
351 | const struct nlattr * const cda[]) | 357 | const struct nlattr * const cda[]) |
352 | { | 358 | { |
353 | struct ctnl_timeout *cur; | 359 | struct ctnl_timeout *cur, *tmp; |
354 | int ret = -ENOENT; | 360 | int ret = -ENOENT; |
355 | char *name; | 361 | char *name; |
356 | 362 | ||
357 | if (!cda[CTA_TIMEOUT_NAME]) { | 363 | if (!cda[CTA_TIMEOUT_NAME]) { |
358 | list_for_each_entry(cur, &net->nfct_timeout_list, head) | 364 | list_for_each_entry_safe(cur, tmp, &net->nfct_timeout_list, |
365 | head) | ||
359 | ctnl_timeout_try_del(net, cur); | 366 | ctnl_timeout_try_del(net, cur); |
360 | 367 | ||
361 | return 0; | 368 | return 0; |
diff --git a/net/netfilter/nft_meta.c b/net/netfilter/nft_meta.c index 2863f3493038..8a6bc7630912 100644 --- a/net/netfilter/nft_meta.c +++ b/net/netfilter/nft_meta.c | |||
@@ -291,10 +291,16 @@ int nft_meta_get_init(const struct nft_ctx *ctx, | |||
291 | } | 291 | } |
292 | EXPORT_SYMBOL_GPL(nft_meta_get_init); | 292 | EXPORT_SYMBOL_GPL(nft_meta_get_init); |
293 | 293 | ||
294 | static int nft_meta_set_init_pkttype(const struct nft_ctx *ctx) | 294 | int nft_meta_set_validate(const struct nft_ctx *ctx, |
295 | const struct nft_expr *expr, | ||
296 | const struct nft_data **data) | ||
295 | { | 297 | { |
298 | struct nft_meta *priv = nft_expr_priv(expr); | ||
296 | unsigned int hooks; | 299 | unsigned int hooks; |
297 | 300 | ||
301 | if (priv->key != NFT_META_PKTTYPE) | ||
302 | return 0; | ||
303 | |||
298 | switch (ctx->afi->family) { | 304 | switch (ctx->afi->family) { |
299 | case NFPROTO_BRIDGE: | 305 | case NFPROTO_BRIDGE: |
300 | hooks = 1 << NF_BR_PRE_ROUTING; | 306 | hooks = 1 << NF_BR_PRE_ROUTING; |
@@ -308,6 +314,7 @@ static int nft_meta_set_init_pkttype(const struct nft_ctx *ctx) | |||
308 | 314 | ||
309 | return nft_chain_validate_hooks(ctx->chain, hooks); | 315 | return nft_chain_validate_hooks(ctx->chain, hooks); |
310 | } | 316 | } |
317 | EXPORT_SYMBOL_GPL(nft_meta_set_validate); | ||
311 | 318 | ||
312 | int nft_meta_set_init(const struct nft_ctx *ctx, | 319 | int nft_meta_set_init(const struct nft_ctx *ctx, |
313 | const struct nft_expr *expr, | 320 | const struct nft_expr *expr, |
@@ -327,15 +334,16 @@ int nft_meta_set_init(const struct nft_ctx *ctx, | |||
327 | len = sizeof(u8); | 334 | len = sizeof(u8); |
328 | break; | 335 | break; |
329 | case NFT_META_PKTTYPE: | 336 | case NFT_META_PKTTYPE: |
330 | err = nft_meta_set_init_pkttype(ctx); | ||
331 | if (err) | ||
332 | return err; | ||
333 | len = sizeof(u8); | 337 | len = sizeof(u8); |
334 | break; | 338 | break; |
335 | default: | 339 | default: |
336 | return -EOPNOTSUPP; | 340 | return -EOPNOTSUPP; |
337 | } | 341 | } |
338 | 342 | ||
343 | err = nft_meta_set_validate(ctx, expr, NULL); | ||
344 | if (err < 0) | ||
345 | return err; | ||
346 | |||
339 | priv->sreg = nft_parse_register(tb[NFTA_META_SREG]); | 347 | priv->sreg = nft_parse_register(tb[NFTA_META_SREG]); |
340 | err = nft_validate_register_load(priv->sreg, len); | 348 | err = nft_validate_register_load(priv->sreg, len); |
341 | if (err < 0) | 349 | if (err < 0) |
@@ -407,6 +415,7 @@ static const struct nft_expr_ops nft_meta_set_ops = { | |||
407 | .init = nft_meta_set_init, | 415 | .init = nft_meta_set_init, |
408 | .destroy = nft_meta_set_destroy, | 416 | .destroy = nft_meta_set_destroy, |
409 | .dump = nft_meta_set_dump, | 417 | .dump = nft_meta_set_dump, |
418 | .validate = nft_meta_set_validate, | ||
410 | }; | 419 | }; |
411 | 420 | ||
412 | static const struct nft_expr_ops * | 421 | static const struct nft_expr_ops * |
diff --git a/net/netfilter/nft_reject.c b/net/netfilter/nft_reject.c index 0522fc9bfb0a..c64de3f7379d 100644 --- a/net/netfilter/nft_reject.c +++ b/net/netfilter/nft_reject.c | |||
@@ -26,11 +26,27 @@ const struct nla_policy nft_reject_policy[NFTA_REJECT_MAX + 1] = { | |||
26 | }; | 26 | }; |
27 | EXPORT_SYMBOL_GPL(nft_reject_policy); | 27 | EXPORT_SYMBOL_GPL(nft_reject_policy); |
28 | 28 | ||
29 | int nft_reject_validate(const struct nft_ctx *ctx, | ||
30 | const struct nft_expr *expr, | ||
31 | const struct nft_data **data) | ||
32 | { | ||
33 | return nft_chain_validate_hooks(ctx->chain, | ||
34 | (1 << NF_INET_LOCAL_IN) | | ||
35 | (1 << NF_INET_FORWARD) | | ||
36 | (1 << NF_INET_LOCAL_OUT)); | ||
37 | } | ||
38 | EXPORT_SYMBOL_GPL(nft_reject_validate); | ||
39 | |||
29 | int nft_reject_init(const struct nft_ctx *ctx, | 40 | int nft_reject_init(const struct nft_ctx *ctx, |
30 | const struct nft_expr *expr, | 41 | const struct nft_expr *expr, |
31 | const struct nlattr * const tb[]) | 42 | const struct nlattr * const tb[]) |
32 | { | 43 | { |
33 | struct nft_reject *priv = nft_expr_priv(expr); | 44 | struct nft_reject *priv = nft_expr_priv(expr); |
45 | int err; | ||
46 | |||
47 | err = nft_reject_validate(ctx, expr, NULL); | ||
48 | if (err < 0) | ||
49 | return err; | ||
34 | 50 | ||
35 | if (tb[NFTA_REJECT_TYPE] == NULL) | 51 | if (tb[NFTA_REJECT_TYPE] == NULL) |
36 | return -EINVAL; | 52 | return -EINVAL; |
diff --git a/net/netfilter/nft_reject_inet.c b/net/netfilter/nft_reject_inet.c index 759ca5248a3d..e79d9ca2ffee 100644 --- a/net/netfilter/nft_reject_inet.c +++ b/net/netfilter/nft_reject_inet.c | |||
@@ -66,7 +66,11 @@ static int nft_reject_inet_init(const struct nft_ctx *ctx, | |||
66 | const struct nlattr * const tb[]) | 66 | const struct nlattr * const tb[]) |
67 | { | 67 | { |
68 | struct nft_reject *priv = nft_expr_priv(expr); | 68 | struct nft_reject *priv = nft_expr_priv(expr); |
69 | int icmp_code; | 69 | int icmp_code, err; |
70 | |||
71 | err = nft_reject_validate(ctx, expr, NULL); | ||
72 | if (err < 0) | ||
73 | return err; | ||
70 | 74 | ||
71 | if (tb[NFTA_REJECT_TYPE] == NULL) | 75 | if (tb[NFTA_REJECT_TYPE] == NULL) |
72 | return -EINVAL; | 76 | return -EINVAL; |
@@ -124,6 +128,7 @@ static const struct nft_expr_ops nft_reject_inet_ops = { | |||
124 | .eval = nft_reject_inet_eval, | 128 | .eval = nft_reject_inet_eval, |
125 | .init = nft_reject_inet_init, | 129 | .init = nft_reject_inet_init, |
126 | .dump = nft_reject_inet_dump, | 130 | .dump = nft_reject_inet_dump, |
131 | .validate = nft_reject_validate, | ||
127 | }; | 132 | }; |
128 | 133 | ||
129 | static struct nft_expr_type nft_reject_inet_type __read_mostly = { | 134 | static struct nft_expr_type nft_reject_inet_type __read_mostly = { |
diff --git a/net/sctp/input.c b/net/sctp/input.c index 69444d32ecda..1555fb8c68e0 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -796,27 +796,34 @@ struct sctp_hash_cmp_arg { | |||
796 | static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, | 796 | static inline int sctp_hash_cmp(struct rhashtable_compare_arg *arg, |
797 | const void *ptr) | 797 | const void *ptr) |
798 | { | 798 | { |
799 | struct sctp_transport *t = (struct sctp_transport *)ptr; | ||
799 | const struct sctp_hash_cmp_arg *x = arg->key; | 800 | const struct sctp_hash_cmp_arg *x = arg->key; |
800 | const struct sctp_transport *t = ptr; | 801 | struct sctp_association *asoc; |
801 | struct sctp_association *asoc = t->asoc; | 802 | int err = 1; |
802 | const struct net *net = x->net; | ||
803 | 803 | ||
804 | if (!sctp_cmp_addr_exact(&t->ipaddr, x->paddr)) | 804 | if (!sctp_cmp_addr_exact(&t->ipaddr, x->paddr)) |
805 | return 1; | 805 | return err; |
806 | if (!net_eq(sock_net(asoc->base.sk), net)) | 806 | if (!sctp_transport_hold(t)) |
807 | return 1; | 807 | return err; |
808 | |||
809 | asoc = t->asoc; | ||
810 | if (!net_eq(sock_net(asoc->base.sk), x->net)) | ||
811 | goto out; | ||
808 | if (x->ep) { | 812 | if (x->ep) { |
809 | if (x->ep != asoc->ep) | 813 | if (x->ep != asoc->ep) |
810 | return 1; | 814 | goto out; |
811 | } else { | 815 | } else { |
812 | if (x->laddr->v4.sin_port != htons(asoc->base.bind_addr.port)) | 816 | if (x->laddr->v4.sin_port != htons(asoc->base.bind_addr.port)) |
813 | return 1; | 817 | goto out; |
814 | if (!sctp_bind_addr_match(&asoc->base.bind_addr, | 818 | if (!sctp_bind_addr_match(&asoc->base.bind_addr, |
815 | x->laddr, sctp_sk(asoc->base.sk))) | 819 | x->laddr, sctp_sk(asoc->base.sk))) |
816 | return 1; | 820 | goto out; |
817 | } | 821 | } |
818 | 822 | ||
819 | return 0; | 823 | err = 0; |
824 | out: | ||
825 | sctp_transport_put(t); | ||
826 | return err; | ||
820 | } | 827 | } |
821 | 828 | ||
822 | static inline u32 sctp_hash_obj(const void *data, u32 len, u32 seed) | 829 | static inline u32 sctp_hash_obj(const void *data, u32 len, u32 seed) |
diff --git a/net/sctp/output.c b/net/sctp/output.c index 1f1682b9a6a8..31b7bc35895d 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -878,7 +878,7 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet, | |||
878 | struct sctp_chunk *chunk, | 878 | struct sctp_chunk *chunk, |
879 | u16 chunk_len) | 879 | u16 chunk_len) |
880 | { | 880 | { |
881 | size_t psize, pmtu; | 881 | size_t psize, pmtu, maxsize; |
882 | sctp_xmit_t retval = SCTP_XMIT_OK; | 882 | sctp_xmit_t retval = SCTP_XMIT_OK; |
883 | 883 | ||
884 | psize = packet->size; | 884 | psize = packet->size; |
@@ -906,6 +906,17 @@ static sctp_xmit_t sctp_packet_will_fit(struct sctp_packet *packet, | |||
906 | goto out; | 906 | goto out; |
907 | } | 907 | } |
908 | 908 | ||
909 | /* Similarly, if this chunk was built before a PMTU | ||
910 | * reduction, we have to fragment it at IP level now. So | ||
911 | * if the packet already contains something, we need to | ||
912 | * flush. | ||
913 | */ | ||
914 | maxsize = pmtu - packet->overhead; | ||
915 | if (packet->auth) | ||
916 | maxsize -= WORD_ROUND(packet->auth->skb->len); | ||
917 | if (chunk_len > maxsize) | ||
918 | retval = SCTP_XMIT_PMTU_FULL; | ||
919 | |||
909 | /* It is also okay to fragment if the chunk we are | 920 | /* It is also okay to fragment if the chunk we are |
910 | * adding is a control chunk, but only if current packet | 921 | * adding is a control chunk, but only if current packet |
911 | * is not a GSO one otherwise it causes fragmentation of | 922 | * is not a GSO one otherwise it causes fragmentation of |
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 1d281816f2bf..d8582028b346 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -569,9 +569,10 @@ gss_svc_searchbyctx(struct cache_detail *cd, struct xdr_netobj *handle) | |||
569 | struct rsc *found; | 569 | struct rsc *found; |
570 | 570 | ||
571 | memset(&rsci, 0, sizeof(rsci)); | 571 | memset(&rsci, 0, sizeof(rsci)); |
572 | rsci.handle.data = handle->data; | 572 | if (dup_to_netobj(&rsci.handle, handle->data, handle->len)) |
573 | rsci.handle.len = handle->len; | 573 | return NULL; |
574 | found = rsc_lookup(cd, &rsci); | 574 | found = rsc_lookup(cd, &rsci); |
575 | rsc_free(&rsci); | ||
575 | if (!found) | 576 | if (!found) |
576 | return NULL; | 577 | return NULL; |
577 | if (cache_check(cd, &found->h, NULL)) | 578 | if (cache_check(cd, &found->h, NULL)) |
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 536d0be3f61b..799cce6cbe45 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/prefetch.h> | 52 | #include <linux/prefetch.h> |
53 | #include <linux/sunrpc/addr.h> | 53 | #include <linux/sunrpc/addr.h> |
54 | #include <linux/sunrpc/svc_rdma.h> | ||
54 | #include <asm/bitops.h> | 55 | #include <asm/bitops.h> |
55 | #include <linux/module.h> /* try_module_get()/module_put() */ | 56 | #include <linux/module.h> /* try_module_get()/module_put() */ |
56 | 57 | ||
@@ -923,7 +924,7 @@ rpcrdma_buffer_create(struct rpcrdma_xprt *r_xprt) | |||
923 | } | 924 | } |
924 | 925 | ||
925 | INIT_LIST_HEAD(&buf->rb_recv_bufs); | 926 | INIT_LIST_HEAD(&buf->rb_recv_bufs); |
926 | for (i = 0; i < buf->rb_max_requests; i++) { | 927 | for (i = 0; i < buf->rb_max_requests + RPCRDMA_MAX_BC_REQUESTS; i++) { |
927 | struct rpcrdma_rep *rep; | 928 | struct rpcrdma_rep *rep; |
928 | 929 | ||
929 | rep = rpcrdma_create_rep(r_xprt); | 930 | rep = rpcrdma_create_rep(r_xprt); |
@@ -1018,6 +1019,7 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | |||
1018 | rep = rpcrdma_buffer_get_rep_locked(buf); | 1019 | rep = rpcrdma_buffer_get_rep_locked(buf); |
1019 | rpcrdma_destroy_rep(ia, rep); | 1020 | rpcrdma_destroy_rep(ia, rep); |
1020 | } | 1021 | } |
1022 | buf->rb_send_count = 0; | ||
1021 | 1023 | ||
1022 | spin_lock(&buf->rb_reqslock); | 1024 | spin_lock(&buf->rb_reqslock); |
1023 | while (!list_empty(&buf->rb_allreqs)) { | 1025 | while (!list_empty(&buf->rb_allreqs)) { |
@@ -1032,6 +1034,7 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf) | |||
1032 | spin_lock(&buf->rb_reqslock); | 1034 | spin_lock(&buf->rb_reqslock); |
1033 | } | 1035 | } |
1034 | spin_unlock(&buf->rb_reqslock); | 1036 | spin_unlock(&buf->rb_reqslock); |
1037 | buf->rb_recv_count = 0; | ||
1035 | 1038 | ||
1036 | rpcrdma_destroy_mrs(buf); | 1039 | rpcrdma_destroy_mrs(buf); |
1037 | } | 1040 | } |
@@ -1074,8 +1077,27 @@ rpcrdma_put_mw(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mw *mw) | |||
1074 | spin_unlock(&buf->rb_mwlock); | 1077 | spin_unlock(&buf->rb_mwlock); |
1075 | } | 1078 | } |
1076 | 1079 | ||
1080 | static struct rpcrdma_rep * | ||
1081 | rpcrdma_buffer_get_rep(struct rpcrdma_buffer *buffers) | ||
1082 | { | ||
1083 | /* If an RPC previously completed without a reply (say, a | ||
1084 | * credential problem or a soft timeout occurs) then hold off | ||
1085 | * on supplying more Receive buffers until the number of new | ||
1086 | * pending RPCs catches up to the number of posted Receives. | ||
1087 | */ | ||
1088 | if (unlikely(buffers->rb_send_count < buffers->rb_recv_count)) | ||
1089 | return NULL; | ||
1090 | |||
1091 | if (unlikely(list_empty(&buffers->rb_recv_bufs))) | ||
1092 | return NULL; | ||
1093 | buffers->rb_recv_count++; | ||
1094 | return rpcrdma_buffer_get_rep_locked(buffers); | ||
1095 | } | ||
1096 | |||
1077 | /* | 1097 | /* |
1078 | * Get a set of request/reply buffers. | 1098 | * Get a set of request/reply buffers. |
1099 | * | ||
1100 | * Reply buffer (if available) is attached to send buffer upon return. | ||
1079 | */ | 1101 | */ |
1080 | struct rpcrdma_req * | 1102 | struct rpcrdma_req * |
1081 | rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) | 1103 | rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) |
@@ -1085,21 +1107,15 @@ rpcrdma_buffer_get(struct rpcrdma_buffer *buffers) | |||
1085 | spin_lock(&buffers->rb_lock); | 1107 | spin_lock(&buffers->rb_lock); |
1086 | if (list_empty(&buffers->rb_send_bufs)) | 1108 | if (list_empty(&buffers->rb_send_bufs)) |
1087 | goto out_reqbuf; | 1109 | goto out_reqbuf; |
1110 | buffers->rb_send_count++; | ||
1088 | req = rpcrdma_buffer_get_req_locked(buffers); | 1111 | req = rpcrdma_buffer_get_req_locked(buffers); |
1089 | if (list_empty(&buffers->rb_recv_bufs)) | 1112 | req->rl_reply = rpcrdma_buffer_get_rep(buffers); |
1090 | goto out_repbuf; | ||
1091 | req->rl_reply = rpcrdma_buffer_get_rep_locked(buffers); | ||
1092 | spin_unlock(&buffers->rb_lock); | 1113 | spin_unlock(&buffers->rb_lock); |
1093 | return req; | 1114 | return req; |
1094 | 1115 | ||
1095 | out_reqbuf: | 1116 | out_reqbuf: |
1096 | spin_unlock(&buffers->rb_lock); | 1117 | spin_unlock(&buffers->rb_lock); |
1097 | pr_warn("rpcrdma: out of request buffers (%p)\n", buffers); | 1118 | pr_warn("RPC: %s: out of request buffers\n", __func__); |
1098 | return NULL; | ||
1099 | out_repbuf: | ||
1100 | list_add(&req->rl_free, &buffers->rb_send_bufs); | ||
1101 | spin_unlock(&buffers->rb_lock); | ||
1102 | pr_warn("rpcrdma: out of reply buffers (%p)\n", buffers); | ||
1103 | return NULL; | 1119 | return NULL; |
1104 | } | 1120 | } |
1105 | 1121 | ||
@@ -1117,9 +1133,12 @@ rpcrdma_buffer_put(struct rpcrdma_req *req) | |||
1117 | req->rl_reply = NULL; | 1133 | req->rl_reply = NULL; |
1118 | 1134 | ||
1119 | spin_lock(&buffers->rb_lock); | 1135 | spin_lock(&buffers->rb_lock); |
1136 | buffers->rb_send_count--; | ||
1120 | list_add_tail(&req->rl_free, &buffers->rb_send_bufs); | 1137 | list_add_tail(&req->rl_free, &buffers->rb_send_bufs); |
1121 | if (rep) | 1138 | if (rep) { |
1139 | buffers->rb_recv_count--; | ||
1122 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); | 1140 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); |
1141 | } | ||
1123 | spin_unlock(&buffers->rb_lock); | 1142 | spin_unlock(&buffers->rb_lock); |
1124 | } | 1143 | } |
1125 | 1144 | ||
@@ -1133,8 +1152,7 @@ rpcrdma_recv_buffer_get(struct rpcrdma_req *req) | |||
1133 | struct rpcrdma_buffer *buffers = req->rl_buffer; | 1152 | struct rpcrdma_buffer *buffers = req->rl_buffer; |
1134 | 1153 | ||
1135 | spin_lock(&buffers->rb_lock); | 1154 | spin_lock(&buffers->rb_lock); |
1136 | if (!list_empty(&buffers->rb_recv_bufs)) | 1155 | req->rl_reply = rpcrdma_buffer_get_rep(buffers); |
1137 | req->rl_reply = rpcrdma_buffer_get_rep_locked(buffers); | ||
1138 | spin_unlock(&buffers->rb_lock); | 1156 | spin_unlock(&buffers->rb_lock); |
1139 | } | 1157 | } |
1140 | 1158 | ||
@@ -1148,6 +1166,7 @@ rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep) | |||
1148 | struct rpcrdma_buffer *buffers = &rep->rr_rxprt->rx_buf; | 1166 | struct rpcrdma_buffer *buffers = &rep->rr_rxprt->rx_buf; |
1149 | 1167 | ||
1150 | spin_lock(&buffers->rb_lock); | 1168 | spin_lock(&buffers->rb_lock); |
1169 | buffers->rb_recv_count--; | ||
1151 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); | 1170 | list_add_tail(&rep->rr_list, &buffers->rb_recv_bufs); |
1152 | spin_unlock(&buffers->rb_lock); | 1171 | spin_unlock(&buffers->rb_lock); |
1153 | } | 1172 | } |
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h index 670fad57153a..a71b0f5897d8 100644 --- a/net/sunrpc/xprtrdma/xprt_rdma.h +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | |||
@@ -321,6 +321,7 @@ struct rpcrdma_buffer { | |||
321 | char *rb_pool; | 321 | char *rb_pool; |
322 | 322 | ||
323 | spinlock_t rb_lock; /* protect buf lists */ | 323 | spinlock_t rb_lock; /* protect buf lists */ |
324 | int rb_send_count, rb_recv_count; | ||
324 | struct list_head rb_send_bufs; | 325 | struct list_head rb_send_bufs; |
325 | struct list_head rb_recv_bufs; | 326 | struct list_head rb_recv_bufs; |
326 | u32 rb_max_requests; | 327 | u32 rb_max_requests; |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 8ede3bc52481..bf168838a029 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1074,7 +1074,7 @@ static void xs_udp_data_receive(struct sock_xprt *transport) | |||
1074 | skb = skb_recv_datagram(sk, 0, 1, &err); | 1074 | skb = skb_recv_datagram(sk, 0, 1, &err); |
1075 | if (skb != NULL) { | 1075 | if (skb != NULL) { |
1076 | xs_udp_data_read_skb(&transport->xprt, sk, skb); | 1076 | xs_udp_data_read_skb(&transport->xprt, sk, skb); |
1077 | skb_free_datagram(sk, skb); | 1077 | skb_free_datagram_locked(sk, skb); |
1078 | continue; | 1078 | continue; |
1079 | } | 1079 | } |
1080 | if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) | 1080 | if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index 6b626a64b517..a04fe9be1c60 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -62,6 +62,8 @@ static void publ_to_item(struct distr_item *i, struct publication *p) | |||
62 | 62 | ||
63 | /** | 63 | /** |
64 | * named_prepare_buf - allocate & initialize a publication message | 64 | * named_prepare_buf - allocate & initialize a publication message |
65 | * | ||
66 | * The buffer returned is of size INT_H_SIZE + payload size | ||
65 | */ | 67 | */ |
66 | static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, | 68 | static struct sk_buff *named_prepare_buf(struct net *net, u32 type, u32 size, |
67 | u32 dest) | 69 | u32 dest) |
@@ -141,9 +143,9 @@ static void named_distribute(struct net *net, struct sk_buff_head *list, | |||
141 | struct publication *publ; | 143 | struct publication *publ; |
142 | struct sk_buff *skb = NULL; | 144 | struct sk_buff *skb = NULL; |
143 | struct distr_item *item = NULL; | 145 | struct distr_item *item = NULL; |
144 | uint msg_dsz = (tipc_node_get_mtu(net, dnode, 0) / ITEM_SIZE) * | 146 | u32 msg_dsz = ((tipc_node_get_mtu(net, dnode, 0) - INT_H_SIZE) / |
145 | ITEM_SIZE; | 147 | ITEM_SIZE) * ITEM_SIZE; |
146 | uint msg_rem = msg_dsz; | 148 | u32 msg_rem = msg_dsz; |
147 | 149 | ||
148 | list_for_each_entry(publ, pls, local_list) { | 150 | list_for_each_entry(publ, pls, local_list) { |
149 | /* Prepare next buffer: */ | 151 | /* Prepare next buffer: */ |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index f1dffe84f0d5..8309687a56b0 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -661,11 +661,11 @@ static int unix_set_peek_off(struct sock *sk, int val) | |||
661 | { | 661 | { |
662 | struct unix_sock *u = unix_sk(sk); | 662 | struct unix_sock *u = unix_sk(sk); |
663 | 663 | ||
664 | if (mutex_lock_interruptible(&u->readlock)) | 664 | if (mutex_lock_interruptible(&u->iolock)) |
665 | return -EINTR; | 665 | return -EINTR; |
666 | 666 | ||
667 | sk->sk_peek_off = val; | 667 | sk->sk_peek_off = val; |
668 | mutex_unlock(&u->readlock); | 668 | mutex_unlock(&u->iolock); |
669 | 669 | ||
670 | return 0; | 670 | return 0; |
671 | } | 671 | } |
@@ -779,7 +779,8 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) | |||
779 | spin_lock_init(&u->lock); | 779 | spin_lock_init(&u->lock); |
780 | atomic_long_set(&u->inflight, 0); | 780 | atomic_long_set(&u->inflight, 0); |
781 | INIT_LIST_HEAD(&u->link); | 781 | INIT_LIST_HEAD(&u->link); |
782 | mutex_init(&u->readlock); /* single task reading lock */ | 782 | mutex_init(&u->iolock); /* single task reading lock */ |
783 | mutex_init(&u->bindlock); /* single task binding lock */ | ||
783 | init_waitqueue_head(&u->peer_wait); | 784 | init_waitqueue_head(&u->peer_wait); |
784 | init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); | 785 | init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); |
785 | unix_insert_socket(unix_sockets_unbound(sk), sk); | 786 | unix_insert_socket(unix_sockets_unbound(sk), sk); |
@@ -848,7 +849,7 @@ static int unix_autobind(struct socket *sock) | |||
848 | int err; | 849 | int err; |
849 | unsigned int retries = 0; | 850 | unsigned int retries = 0; |
850 | 851 | ||
851 | err = mutex_lock_interruptible(&u->readlock); | 852 | err = mutex_lock_interruptible(&u->bindlock); |
852 | if (err) | 853 | if (err) |
853 | return err; | 854 | return err; |
854 | 855 | ||
@@ -895,7 +896,7 @@ retry: | |||
895 | spin_unlock(&unix_table_lock); | 896 | spin_unlock(&unix_table_lock); |
896 | err = 0; | 897 | err = 0; |
897 | 898 | ||
898 | out: mutex_unlock(&u->readlock); | 899 | out: mutex_unlock(&u->bindlock); |
899 | return err; | 900 | return err; |
900 | } | 901 | } |
901 | 902 | ||
@@ -954,20 +955,32 @@ fail: | |||
954 | return NULL; | 955 | return NULL; |
955 | } | 956 | } |
956 | 957 | ||
957 | static int unix_mknod(struct dentry *dentry, const struct path *path, umode_t mode, | 958 | static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) |
958 | struct path *res) | ||
959 | { | 959 | { |
960 | int err; | 960 | struct dentry *dentry; |
961 | struct path path; | ||
962 | int err = 0; | ||
963 | /* | ||
964 | * Get the parent directory, calculate the hash for last | ||
965 | * component. | ||
966 | */ | ||
967 | dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); | ||
968 | err = PTR_ERR(dentry); | ||
969 | if (IS_ERR(dentry)) | ||
970 | return err; | ||
961 | 971 | ||
962 | err = security_path_mknod(path, dentry, mode, 0); | 972 | /* |
973 | * All right, let's create it. | ||
974 | */ | ||
975 | err = security_path_mknod(&path, dentry, mode, 0); | ||
963 | if (!err) { | 976 | if (!err) { |
964 | err = vfs_mknod(d_inode(path->dentry), dentry, mode, 0); | 977 | err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0); |
965 | if (!err) { | 978 | if (!err) { |
966 | res->mnt = mntget(path->mnt); | 979 | res->mnt = mntget(path.mnt); |
967 | res->dentry = dget(dentry); | 980 | res->dentry = dget(dentry); |
968 | } | 981 | } |
969 | } | 982 | } |
970 | 983 | done_path_create(&path, dentry); | |
971 | return err; | 984 | return err; |
972 | } | 985 | } |
973 | 986 | ||
@@ -978,12 +991,10 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
978 | struct unix_sock *u = unix_sk(sk); | 991 | struct unix_sock *u = unix_sk(sk); |
979 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; | 992 | struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; |
980 | char *sun_path = sunaddr->sun_path; | 993 | char *sun_path = sunaddr->sun_path; |
981 | int err, name_err; | 994 | int err; |
982 | unsigned int hash; | 995 | unsigned int hash; |
983 | struct unix_address *addr; | 996 | struct unix_address *addr; |
984 | struct hlist_head *list; | 997 | struct hlist_head *list; |
985 | struct path path; | ||
986 | struct dentry *dentry; | ||
987 | 998 | ||
988 | err = -EINVAL; | 999 | err = -EINVAL; |
989 | if (sunaddr->sun_family != AF_UNIX) | 1000 | if (sunaddr->sun_family != AF_UNIX) |
@@ -999,34 +1010,14 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
999 | goto out; | 1010 | goto out; |
1000 | addr_len = err; | 1011 | addr_len = err; |
1001 | 1012 | ||
1002 | name_err = 0; | 1013 | err = mutex_lock_interruptible(&u->bindlock); |
1003 | dentry = NULL; | ||
1004 | if (sun_path[0]) { | ||
1005 | /* Get the parent directory, calculate the hash for last | ||
1006 | * component. | ||
1007 | */ | ||
1008 | dentry = kern_path_create(AT_FDCWD, sun_path, &path, 0); | ||
1009 | |||
1010 | if (IS_ERR(dentry)) { | ||
1011 | /* delay report until after 'already bound' check */ | ||
1012 | name_err = PTR_ERR(dentry); | ||
1013 | dentry = NULL; | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | err = mutex_lock_interruptible(&u->readlock); | ||
1018 | if (err) | 1014 | if (err) |
1019 | goto out_path; | 1015 | goto out; |
1020 | 1016 | ||
1021 | err = -EINVAL; | 1017 | err = -EINVAL; |
1022 | if (u->addr) | 1018 | if (u->addr) |
1023 | goto out_up; | 1019 | goto out_up; |
1024 | 1020 | ||
1025 | if (name_err) { | ||
1026 | err = name_err == -EEXIST ? -EADDRINUSE : name_err; | ||
1027 | goto out_up; | ||
1028 | } | ||
1029 | |||
1030 | err = -ENOMEM; | 1021 | err = -ENOMEM; |
1031 | addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); | 1022 | addr = kmalloc(sizeof(*addr)+addr_len, GFP_KERNEL); |
1032 | if (!addr) | 1023 | if (!addr) |
@@ -1037,11 +1028,11 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1037 | addr->hash = hash ^ sk->sk_type; | 1028 | addr->hash = hash ^ sk->sk_type; |
1038 | atomic_set(&addr->refcnt, 1); | 1029 | atomic_set(&addr->refcnt, 1); |
1039 | 1030 | ||
1040 | if (dentry) { | 1031 | if (sun_path[0]) { |
1041 | struct path u_path; | 1032 | struct path path; |
1042 | umode_t mode = S_IFSOCK | | 1033 | umode_t mode = S_IFSOCK | |
1043 | (SOCK_INODE(sock)->i_mode & ~current_umask()); | 1034 | (SOCK_INODE(sock)->i_mode & ~current_umask()); |
1044 | err = unix_mknod(dentry, &path, mode, &u_path); | 1035 | err = unix_mknod(sun_path, mode, &path); |
1045 | if (err) { | 1036 | if (err) { |
1046 | if (err == -EEXIST) | 1037 | if (err == -EEXIST) |
1047 | err = -EADDRINUSE; | 1038 | err = -EADDRINUSE; |
@@ -1049,9 +1040,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1049 | goto out_up; | 1040 | goto out_up; |
1050 | } | 1041 | } |
1051 | addr->hash = UNIX_HASH_SIZE; | 1042 | addr->hash = UNIX_HASH_SIZE; |
1052 | hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); | 1043 | hash = d_real_inode(path.dentry)->i_ino & (UNIX_HASH_SIZE - 1); |
1053 | spin_lock(&unix_table_lock); | 1044 | spin_lock(&unix_table_lock); |
1054 | u->path = u_path; | 1045 | u->path = path; |
1055 | list = &unix_socket_table[hash]; | 1046 | list = &unix_socket_table[hash]; |
1056 | } else { | 1047 | } else { |
1057 | spin_lock(&unix_table_lock); | 1048 | spin_lock(&unix_table_lock); |
@@ -1073,11 +1064,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1073 | out_unlock: | 1064 | out_unlock: |
1074 | spin_unlock(&unix_table_lock); | 1065 | spin_unlock(&unix_table_lock); |
1075 | out_up: | 1066 | out_up: |
1076 | mutex_unlock(&u->readlock); | 1067 | mutex_unlock(&u->bindlock); |
1077 | out_path: | ||
1078 | if (dentry) | ||
1079 | done_path_create(&path, dentry); | ||
1080 | |||
1081 | out: | 1068 | out: |
1082 | return err; | 1069 | return err; |
1083 | } | 1070 | } |
@@ -1969,17 +1956,17 @@ static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page, | |||
1969 | if (false) { | 1956 | if (false) { |
1970 | alloc_skb: | 1957 | alloc_skb: |
1971 | unix_state_unlock(other); | 1958 | unix_state_unlock(other); |
1972 | mutex_unlock(&unix_sk(other)->readlock); | 1959 | mutex_unlock(&unix_sk(other)->iolock); |
1973 | newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, | 1960 | newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, |
1974 | &err, 0); | 1961 | &err, 0); |
1975 | if (!newskb) | 1962 | if (!newskb) |
1976 | goto err; | 1963 | goto err; |
1977 | } | 1964 | } |
1978 | 1965 | ||
1979 | /* we must acquire readlock as we modify already present | 1966 | /* we must acquire iolock as we modify already present |
1980 | * skbs in the sk_receive_queue and mess with skb->len | 1967 | * skbs in the sk_receive_queue and mess with skb->len |
1981 | */ | 1968 | */ |
1982 | err = mutex_lock_interruptible(&unix_sk(other)->readlock); | 1969 | err = mutex_lock_interruptible(&unix_sk(other)->iolock); |
1983 | if (err) { | 1970 | if (err) { |
1984 | err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; | 1971 | err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; |
1985 | goto err; | 1972 | goto err; |
@@ -2046,7 +2033,7 @@ alloc_skb: | |||
2046 | } | 2033 | } |
2047 | 2034 | ||
2048 | unix_state_unlock(other); | 2035 | unix_state_unlock(other); |
2049 | mutex_unlock(&unix_sk(other)->readlock); | 2036 | mutex_unlock(&unix_sk(other)->iolock); |
2050 | 2037 | ||
2051 | other->sk_data_ready(other); | 2038 | other->sk_data_ready(other); |
2052 | scm_destroy(&scm); | 2039 | scm_destroy(&scm); |
@@ -2055,7 +2042,7 @@ alloc_skb: | |||
2055 | err_state_unlock: | 2042 | err_state_unlock: |
2056 | unix_state_unlock(other); | 2043 | unix_state_unlock(other); |
2057 | err_unlock: | 2044 | err_unlock: |
2058 | mutex_unlock(&unix_sk(other)->readlock); | 2045 | mutex_unlock(&unix_sk(other)->iolock); |
2059 | err: | 2046 | err: |
2060 | kfree_skb(newskb); | 2047 | kfree_skb(newskb); |
2061 | if (send_sigpipe && !(flags & MSG_NOSIGNAL)) | 2048 | if (send_sigpipe && !(flags & MSG_NOSIGNAL)) |
@@ -2123,7 +2110,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
2123 | timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); | 2110 | timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); |
2124 | 2111 | ||
2125 | do { | 2112 | do { |
2126 | mutex_lock(&u->readlock); | 2113 | mutex_lock(&u->iolock); |
2127 | 2114 | ||
2128 | skip = sk_peek_offset(sk, flags); | 2115 | skip = sk_peek_offset(sk, flags); |
2129 | skb = __skb_try_recv_datagram(sk, flags, &peeked, &skip, &err, | 2116 | skb = __skb_try_recv_datagram(sk, flags, &peeked, &skip, &err, |
@@ -2131,14 +2118,14 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
2131 | if (skb) | 2118 | if (skb) |
2132 | break; | 2119 | break; |
2133 | 2120 | ||
2134 | mutex_unlock(&u->readlock); | 2121 | mutex_unlock(&u->iolock); |
2135 | 2122 | ||
2136 | if (err != -EAGAIN) | 2123 | if (err != -EAGAIN) |
2137 | break; | 2124 | break; |
2138 | } while (timeo && | 2125 | } while (timeo && |
2139 | !__skb_wait_for_more_packets(sk, &err, &timeo, last)); | 2126 | !__skb_wait_for_more_packets(sk, &err, &timeo, last)); |
2140 | 2127 | ||
2141 | if (!skb) { /* implies readlock unlocked */ | 2128 | if (!skb) { /* implies iolock unlocked */ |
2142 | unix_state_lock(sk); | 2129 | unix_state_lock(sk); |
2143 | /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ | 2130 | /* Signal EOF on disconnected non-blocking SEQPACKET socket. */ |
2144 | if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && | 2131 | if (sk->sk_type == SOCK_SEQPACKET && err == -EAGAIN && |
@@ -2203,7 +2190,7 @@ static int unix_dgram_recvmsg(struct socket *sock, struct msghdr *msg, | |||
2203 | 2190 | ||
2204 | out_free: | 2191 | out_free: |
2205 | skb_free_datagram(sk, skb); | 2192 | skb_free_datagram(sk, skb); |
2206 | mutex_unlock(&u->readlock); | 2193 | mutex_unlock(&u->iolock); |
2207 | out: | 2194 | out: |
2208 | return err; | 2195 | return err; |
2209 | } | 2196 | } |
@@ -2298,7 +2285,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state) | |||
2298 | /* Lock the socket to prevent queue disordering | 2285 | /* Lock the socket to prevent queue disordering |
2299 | * while sleeps in memcpy_tomsg | 2286 | * while sleeps in memcpy_tomsg |
2300 | */ | 2287 | */ |
2301 | mutex_lock(&u->readlock); | 2288 | mutex_lock(&u->iolock); |
2302 | 2289 | ||
2303 | if (flags & MSG_PEEK) | 2290 | if (flags & MSG_PEEK) |
2304 | skip = sk_peek_offset(sk, flags); | 2291 | skip = sk_peek_offset(sk, flags); |
@@ -2340,7 +2327,7 @@ again: | |||
2340 | break; | 2327 | break; |
2341 | } | 2328 | } |
2342 | 2329 | ||
2343 | mutex_unlock(&u->readlock); | 2330 | mutex_unlock(&u->iolock); |
2344 | 2331 | ||
2345 | timeo = unix_stream_data_wait(sk, timeo, last, | 2332 | timeo = unix_stream_data_wait(sk, timeo, last, |
2346 | last_len); | 2333 | last_len); |
@@ -2351,7 +2338,7 @@ again: | |||
2351 | goto out; | 2338 | goto out; |
2352 | } | 2339 | } |
2353 | 2340 | ||
2354 | mutex_lock(&u->readlock); | 2341 | mutex_lock(&u->iolock); |
2355 | goto redo; | 2342 | goto redo; |
2356 | unlock: | 2343 | unlock: |
2357 | unix_state_unlock(sk); | 2344 | unix_state_unlock(sk); |
@@ -2454,7 +2441,7 @@ unlock: | |||
2454 | } | 2441 | } |
2455 | } while (size); | 2442 | } while (size); |
2456 | 2443 | ||
2457 | mutex_unlock(&u->readlock); | 2444 | mutex_unlock(&u->iolock); |
2458 | if (state->msg) | 2445 | if (state->msg) |
2459 | scm_recv(sock, state->msg, &scm, flags); | 2446 | scm_recv(sock, state->msg, &scm, flags); |
2460 | else | 2447 | else |
@@ -2495,9 +2482,9 @@ static ssize_t skb_unix_socket_splice(struct sock *sk, | |||
2495 | int ret; | 2482 | int ret; |
2496 | struct unix_sock *u = unix_sk(sk); | 2483 | struct unix_sock *u = unix_sk(sk); |
2497 | 2484 | ||
2498 | mutex_unlock(&u->readlock); | 2485 | mutex_unlock(&u->iolock); |
2499 | ret = splice_to_pipe(pipe, spd); | 2486 | ret = splice_to_pipe(pipe, spd); |
2500 | mutex_lock(&u->readlock); | 2487 | mutex_lock(&u->iolock); |
2501 | 2488 | ||
2502 | return ret; | 2489 | return ret; |
2503 | } | 2490 | } |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index f02653a08993..4809f4d2cdcc 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6978,7 +6978,7 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
6978 | 6978 | ||
6979 | params.n_counter_offsets_presp = len / sizeof(u16); | 6979 | params.n_counter_offsets_presp = len / sizeof(u16); |
6980 | if (rdev->wiphy.max_num_csa_counters && | 6980 | if (rdev->wiphy.max_num_csa_counters && |
6981 | (params.n_counter_offsets_beacon > | 6981 | (params.n_counter_offsets_presp > |
6982 | rdev->wiphy.max_num_csa_counters)) | 6982 | rdev->wiphy.max_num_csa_counters)) |
6983 | return -EINVAL; | 6983 | return -EINVAL; |
6984 | 6984 | ||
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c index dbb2738e356a..6250b1cfcde5 100644 --- a/net/wireless/wext-core.c +++ b/net/wireless/wext-core.c | |||
@@ -958,29 +958,8 @@ static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, | |||
958 | return private(dev, iwr, cmd, info, handler); | 958 | return private(dev, iwr, cmd, info, handler); |
959 | } | 959 | } |
960 | /* Old driver API : call driver ioctl handler */ | 960 | /* Old driver API : call driver ioctl handler */ |
961 | if (dev->netdev_ops->ndo_do_ioctl) { | 961 | if (dev->netdev_ops->ndo_do_ioctl) |
962 | #ifdef CONFIG_COMPAT | 962 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); |
963 | if (info->flags & IW_REQUEST_FLAG_COMPAT) { | ||
964 | int ret = 0; | ||
965 | struct iwreq iwr_lcl; | ||
966 | struct compat_iw_point *iwp_compat = (void *) &iwr->u.data; | ||
967 | |||
968 | memcpy(&iwr_lcl, iwr, sizeof(struct iwreq)); | ||
969 | iwr_lcl.u.data.pointer = compat_ptr(iwp_compat->pointer); | ||
970 | iwr_lcl.u.data.length = iwp_compat->length; | ||
971 | iwr_lcl.u.data.flags = iwp_compat->flags; | ||
972 | |||
973 | ret = dev->netdev_ops->ndo_do_ioctl(dev, (void *) &iwr_lcl, cmd); | ||
974 | |||
975 | iwp_compat->pointer = ptr_to_compat(iwr_lcl.u.data.pointer); | ||
976 | iwp_compat->length = iwr_lcl.u.data.length; | ||
977 | iwp_compat->flags = iwr_lcl.u.data.flags; | ||
978 | |||
979 | return ret; | ||
980 | } else | ||
981 | #endif | ||
982 | return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); | ||
983 | } | ||
984 | return -EOPNOTSUPP; | 963 | return -EOPNOTSUPP; |
985 | } | 964 | } |
986 | 965 | ||
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 1c4ad477ce93..6e3f0254d8a1 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -207,15 +207,15 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
207 | family = XFRM_SPI_SKB_CB(skb)->family; | 207 | family = XFRM_SPI_SKB_CB(skb)->family; |
208 | 208 | ||
209 | /* if tunnel is present override skb->mark value with tunnel i_key */ | 209 | /* if tunnel is present override skb->mark value with tunnel i_key */ |
210 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { | 210 | switch (family) { |
211 | switch (family) { | 211 | case AF_INET: |
212 | case AF_INET: | 212 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) |
213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); | 213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); |
214 | break; | 214 | break; |
215 | case AF_INET6: | 215 | case AF_INET6: |
216 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6) | ||
216 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); | 217 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); |
217 | break; | 218 | break; |
218 | } | ||
219 | } | 219 | } |
220 | 220 | ||
221 | /* Allocate new secpath or COW existing one. */ | 221 | /* Allocate new secpath or COW existing one. */ |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index b5e665b3cfb0..45f9cf97ea25 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -626,6 +626,10 @@ static void xfrm_hash_rebuild(struct work_struct *work) | |||
626 | 626 | ||
627 | /* re-insert all policies by order of creation */ | 627 | /* re-insert all policies by order of creation */ |
628 | list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { | 628 | list_for_each_entry_reverse(policy, &net->xfrm.policy_all, walk.all) { |
629 | if (xfrm_policy_id2dir(policy->index) >= XFRM_POLICY_MAX) { | ||
630 | /* skip socket policies */ | ||
631 | continue; | ||
632 | } | ||
629 | newpos = NULL; | 633 | newpos = NULL; |
630 | chain = policy_hash_bysel(net, &policy->selector, | 634 | chain = policy_hash_bysel(net, &policy->selector, |
631 | policy->family, | 635 | policy->family, |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 9895a8c56d8c..a30f898dc1c5 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -332,6 +332,7 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x) | |||
332 | { | 332 | { |
333 | tasklet_hrtimer_cancel(&x->mtimer); | 333 | tasklet_hrtimer_cancel(&x->mtimer); |
334 | del_timer_sync(&x->rtimer); | 334 | del_timer_sync(&x->rtimer); |
335 | kfree(x->aead); | ||
335 | kfree(x->aalg); | 336 | kfree(x->aalg); |
336 | kfree(x->ealg); | 337 | kfree(x->ealg); |
337 | kfree(x->calg); | 338 | kfree(x->calg); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index d516845e16e3..08892091cfe3 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -581,9 +581,12 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, | |||
581 | if (err) | 581 | if (err) |
582 | goto error; | 582 | goto error; |
583 | 583 | ||
584 | if (attrs[XFRMA_SEC_CTX] && | 584 | if (attrs[XFRMA_SEC_CTX]) { |
585 | security_xfrm_state_alloc(x, nla_data(attrs[XFRMA_SEC_CTX]))) | 585 | err = security_xfrm_state_alloc(x, |
586 | goto error; | 586 | nla_data(attrs[XFRMA_SEC_CTX])); |
587 | if (err) | ||
588 | goto error; | ||
589 | } | ||
587 | 590 | ||
588 | if ((err = xfrm_alloc_replay_state_esn(&x->replay_esn, &x->preplay_esn, | 591 | if ((err = xfrm_alloc_replay_state_esn(&x->replay_esn, &x->preplay_esn, |
589 | attrs[XFRMA_REPLAY_ESN_VAL]))) | 592 | attrs[XFRMA_REPLAY_ESN_VAL]))) |
@@ -896,7 +899,8 @@ static int xfrm_dump_sa_done(struct netlink_callback *cb) | |||
896 | struct sock *sk = cb->skb->sk; | 899 | struct sock *sk = cb->skb->sk; |
897 | struct net *net = sock_net(sk); | 900 | struct net *net = sock_net(sk); |
898 | 901 | ||
899 | xfrm_state_walk_done(walk, net); | 902 | if (cb->args[0]) |
903 | xfrm_state_walk_done(walk, net); | ||
900 | return 0; | 904 | return 0; |
901 | } | 905 | } |
902 | 906 | ||
@@ -921,8 +925,6 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) | |||
921 | u8 proto = 0; | 925 | u8 proto = 0; |
922 | int err; | 926 | int err; |
923 | 927 | ||
924 | cb->args[0] = 1; | ||
925 | |||
926 | err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, | 928 | err = nlmsg_parse(cb->nlh, 0, attrs, XFRMA_MAX, |
927 | xfrma_policy); | 929 | xfrma_policy); |
928 | if (err < 0) | 930 | if (err < 0) |
@@ -939,6 +941,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb) | |||
939 | proto = nla_get_u8(attrs[XFRMA_PROTO]); | 941 | proto = nla_get_u8(attrs[XFRMA_PROTO]); |
940 | 942 | ||
941 | xfrm_state_walk_init(walk, proto, filter); | 943 | xfrm_state_walk_init(walk, proto, filter); |
944 | cb->args[0] = 1; | ||
942 | } | 945 | } |
943 | 946 | ||
944 | (void) xfrm_state_walk(net, walk, dump_one_state, &info); | 947 | (void) xfrm_state_walk(net, walk, dump_one_state, &info); |
@@ -2051,9 +2054,6 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2051 | if (up->hard) { | 2054 | if (up->hard) { |
2052 | xfrm_policy_delete(xp, p->dir); | 2055 | xfrm_policy_delete(xp, p->dir); |
2053 | xfrm_audit_policy_delete(xp, 1, true); | 2056 | xfrm_audit_policy_delete(xp, 1, true); |
2054 | } else { | ||
2055 | // reset the timers here? | ||
2056 | WARN(1, "Don't know what to do with soft policy expire\n"); | ||
2057 | } | 2057 | } |
2058 | km_policy_expired(xp, p->dir, up->hard, nlh->nlmsg_pid); | 2058 | km_policy_expired(xp, p->dir, up->hard, nlh->nlmsg_pid); |
2059 | 2059 | ||
@@ -2117,7 +2117,7 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2117 | 2117 | ||
2118 | err = verify_newpolicy_info(&ua->policy); | 2118 | err = verify_newpolicy_info(&ua->policy); |
2119 | if (err) | 2119 | if (err) |
2120 | goto bad_policy; | 2120 | goto free_state; |
2121 | 2121 | ||
2122 | /* build an XP */ | 2122 | /* build an XP */ |
2123 | xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); | 2123 | xp = xfrm_policy_construct(net, &ua->policy, attrs, &err); |
@@ -2149,8 +2149,6 @@ static int xfrm_add_acquire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2149 | 2149 | ||
2150 | return 0; | 2150 | return 0; |
2151 | 2151 | ||
2152 | bad_policy: | ||
2153 | WARN(1, "BAD policy passed\n"); | ||
2154 | free_state: | 2152 | free_state: |
2155 | kfree(x); | 2153 | kfree(x); |
2156 | nomem: | 2154 | nomem: |
diff --git a/scripts/faddr2line b/scripts/faddr2line new file mode 100755 index 000000000000..450b33257339 --- /dev/null +++ b/scripts/faddr2line | |||
@@ -0,0 +1,177 @@ | |||
1 | #!/bin/bash | ||
2 | # | ||
3 | # Translate stack dump function offsets. | ||
4 | # | ||
5 | # addr2line doesn't work with KASLR addresses. This works similarly to | ||
6 | # addr2line, but instead takes the 'func+0x123' format as input: | ||
7 | # | ||
8 | # $ ./scripts/faddr2line ~/k/vmlinux meminfo_proc_show+0x5/0x568 | ||
9 | # meminfo_proc_show+0x5/0x568: | ||
10 | # meminfo_proc_show at fs/proc/meminfo.c:27 | ||
11 | # | ||
12 | # If the address is part of an inlined function, the full inline call chain is | ||
13 | # printed: | ||
14 | # | ||
15 | # $ ./scripts/faddr2line ~/k/vmlinux native_write_msr+0x6/0x27 | ||
16 | # native_write_msr+0x6/0x27: | ||
17 | # arch_static_branch at arch/x86/include/asm/msr.h:121 | ||
18 | # (inlined by) static_key_false at include/linux/jump_label.h:125 | ||
19 | # (inlined by) native_write_msr at arch/x86/include/asm/msr.h:125 | ||
20 | # | ||
21 | # The function size after the '/' in the input is optional, but recommended. | ||
22 | # It's used to help disambiguate any duplicate symbol names, which can occur | ||
23 | # rarely. If the size is omitted for a duplicate symbol then it's possible for | ||
24 | # multiple code sites to be printed: | ||
25 | # | ||
26 | # $ ./scripts/faddr2line ~/k/vmlinux raw_ioctl+0x5 | ||
27 | # raw_ioctl+0x5/0x20: | ||
28 | # raw_ioctl at drivers/char/raw.c:122 | ||
29 | # | ||
30 | # raw_ioctl+0x5/0xb1: | ||
31 | # raw_ioctl at net/ipv4/raw.c:876 | ||
32 | # | ||
33 | # Multiple addresses can be specified on a single command line: | ||
34 | # | ||
35 | # $ ./scripts/faddr2line ~/k/vmlinux type_show+0x10/45 free_reserved_area+0x90 | ||
36 | # type_show+0x10/0x2d: | ||
37 | # type_show at drivers/video/backlight/backlight.c:213 | ||
38 | # | ||
39 | # free_reserved_area+0x90/0x123: | ||
40 | # free_reserved_area at mm/page_alloc.c:6429 (discriminator 2) | ||
41 | |||
42 | |||
43 | set -o errexit | ||
44 | set -o nounset | ||
45 | |||
46 | command -v awk >/dev/null 2>&1 || die "awk isn't installed" | ||
47 | command -v readelf >/dev/null 2>&1 || die "readelf isn't installed" | ||
48 | command -v addr2line >/dev/null 2>&1 || die "addr2line isn't installed" | ||
49 | |||
50 | usage() { | ||
51 | echo "usage: faddr2line <object file> <func+offset> <func+offset>..." >&2 | ||
52 | exit 1 | ||
53 | } | ||
54 | |||
55 | warn() { | ||
56 | echo "$1" >&2 | ||
57 | } | ||
58 | |||
59 | die() { | ||
60 | echo "ERROR: $1" >&2 | ||
61 | exit 1 | ||
62 | } | ||
63 | |||
64 | # Try to figure out the source directory prefix so we can remove it from the | ||
65 | # addr2line output. HACK ALERT: This assumes that start_kernel() is in | ||
66 | # kernel/init.c! This only works for vmlinux. Otherwise it falls back to | ||
67 | # printing the absolute path. | ||
68 | find_dir_prefix() { | ||
69 | local objfile=$1 | ||
70 | |||
71 | local start_kernel_addr=$(readelf -sW $objfile | awk '$8 == "start_kernel" {printf "0x%s", $2}') | ||
72 | [[ -z $start_kernel_addr ]] && return | ||
73 | |||
74 | local file_line=$(addr2line -e $objfile $start_kernel_addr) | ||
75 | [[ -z $file_line ]] && return | ||
76 | |||
77 | local prefix=${file_line%init/main.c:*} | ||
78 | if [[ -z $prefix ]] || [[ $prefix = $file_line ]]; then | ||
79 | return | ||
80 | fi | ||
81 | |||
82 | DIR_PREFIX=$prefix | ||
83 | return 0 | ||
84 | } | ||
85 | |||
86 | __faddr2line() { | ||
87 | local objfile=$1 | ||
88 | local func_addr=$2 | ||
89 | local dir_prefix=$3 | ||
90 | local print_warnings=$4 | ||
91 | |||
92 | local func=${func_addr%+*} | ||
93 | local offset=${func_addr#*+} | ||
94 | offset=${offset%/*} | ||
95 | local size= | ||
96 | [[ $func_addr =~ "/" ]] && size=${func_addr#*/} | ||
97 | |||
98 | if [[ -z $func ]] || [[ -z $offset ]] || [[ $func = $func_addr ]]; then | ||
99 | warn "bad func+offset $func_addr" | ||
100 | DONE=1 | ||
101 | return | ||
102 | fi | ||
103 | |||
104 | # Go through each of the object's symbols which match the func name. | ||
105 | # In rare cases there might be duplicates. | ||
106 | while read symbol; do | ||
107 | local fields=($symbol) | ||
108 | local sym_base=0x${fields[1]} | ||
109 | local sym_size=${fields[2]} | ||
110 | local sym_type=${fields[3]} | ||
111 | |||
112 | # calculate the address | ||
113 | local addr=$(($sym_base + $offset)) | ||
114 | if [[ -z $addr ]] || [[ $addr = 0 ]]; then | ||
115 | warn "bad address: $sym_base + $offset" | ||
116 | DONE=1 | ||
117 | return | ||
118 | fi | ||
119 | local hexaddr=0x$(printf %x $addr) | ||
120 | |||
121 | # weed out non-function symbols | ||
122 | if [[ $sym_type != "FUNC" ]]; then | ||
123 | [[ $print_warnings = 1 ]] && | ||
124 | echo "skipping $func address at $hexaddr due to non-function symbol" | ||
125 | continue | ||
126 | fi | ||
127 | |||
128 | # if the user provided a size, make sure it matches the symbol's size | ||
129 | if [[ -n $size ]] && [[ $size -ne $sym_size ]]; then | ||
130 | [[ $print_warnings = 1 ]] && | ||
131 | echo "skipping $func address at $hexaddr due to size mismatch ($size != $sym_size)" | ||
132 | continue; | ||
133 | fi | ||
134 | |||
135 | # make sure the provided offset is within the symbol's range | ||
136 | if [[ $offset -gt $sym_size ]]; then | ||
137 | [[ $print_warnings = 1 ]] && | ||
138 | echo "skipping $func address at $hexaddr due to size mismatch ($offset > $sym_size)" | ||
139 | continue | ||
140 | fi | ||
141 | |||
142 | # separate multiple entries with a blank line | ||
143 | [[ $FIRST = 0 ]] && echo | ||
144 | FIRST=0 | ||
145 | |||
146 | local hexsize=0x$(printf %x $sym_size) | ||
147 | echo "$func+$offset/$hexsize:" | ||
148 | addr2line -fpie $objfile $hexaddr | sed "s; $dir_prefix\(\./\)*; ;" | ||
149 | DONE=1 | ||
150 | |||
151 | done < <(readelf -sW $objfile | awk -v f=$func '$8 == f {print}') | ||
152 | } | ||
153 | |||
154 | [[ $# -lt 2 ]] && usage | ||
155 | |||
156 | objfile=$1 | ||
157 | [[ ! -f $objfile ]] && die "can't find objfile $objfile" | ||
158 | shift | ||
159 | |||
160 | DIR_PREFIX=supercalifragilisticexpialidocious | ||
161 | find_dir_prefix $objfile | ||
162 | |||
163 | FIRST=1 | ||
164 | while [[ $# -gt 0 ]]; do | ||
165 | func_addr=$1 | ||
166 | shift | ||
167 | |||
168 | # print any matches found | ||
169 | DONE=0 | ||
170 | __faddr2line $objfile $func_addr $DIR_PREFIX 0 | ||
171 | |||
172 | # if no match was found, print warnings | ||
173 | if [[ $DONE = 0 ]]; then | ||
174 | __faddr2line $objfile $func_addr $DIR_PREFIX 1 | ||
175 | warn "no match for $func_addr" | ||
176 | fi | ||
177 | done | ||
diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c index 5adbfc32242f..17a06105ccb6 100644 --- a/security/keys/encrypted-keys/encrypted.c +++ b/security/keys/encrypted-keys/encrypted.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/rcupdate.h> | 29 | #include <linux/rcupdate.h> |
30 | #include <linux/scatterlist.h> | 30 | #include <linux/scatterlist.h> |
31 | #include <linux/ctype.h> | 31 | #include <linux/ctype.h> |
32 | #include <crypto/aes.h> | ||
32 | #include <crypto/hash.h> | 33 | #include <crypto/hash.h> |
33 | #include <crypto/sha.h> | 34 | #include <crypto/sha.h> |
34 | #include <crypto/skcipher.h> | 35 | #include <crypto/skcipher.h> |
@@ -478,6 +479,7 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload, | |||
478 | struct crypto_skcipher *tfm; | 479 | struct crypto_skcipher *tfm; |
479 | struct skcipher_request *req; | 480 | struct skcipher_request *req; |
480 | unsigned int encrypted_datalen; | 481 | unsigned int encrypted_datalen; |
482 | u8 iv[AES_BLOCK_SIZE]; | ||
481 | unsigned int padlen; | 483 | unsigned int padlen; |
482 | char pad[16]; | 484 | char pad[16]; |
483 | int ret; | 485 | int ret; |
@@ -500,8 +502,8 @@ static int derived_key_encrypt(struct encrypted_key_payload *epayload, | |||
500 | sg_init_table(sg_out, 1); | 502 | sg_init_table(sg_out, 1); |
501 | sg_set_buf(sg_out, epayload->encrypted_data, encrypted_datalen); | 503 | sg_set_buf(sg_out, epayload->encrypted_data, encrypted_datalen); |
502 | 504 | ||
503 | skcipher_request_set_crypt(req, sg_in, sg_out, encrypted_datalen, | 505 | memcpy(iv, epayload->iv, sizeof(iv)); |
504 | epayload->iv); | 506 | skcipher_request_set_crypt(req, sg_in, sg_out, encrypted_datalen, iv); |
505 | ret = crypto_skcipher_encrypt(req); | 507 | ret = crypto_skcipher_encrypt(req); |
506 | tfm = crypto_skcipher_reqtfm(req); | 508 | tfm = crypto_skcipher_reqtfm(req); |
507 | skcipher_request_free(req); | 509 | skcipher_request_free(req); |
@@ -581,6 +583,7 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, | |||
581 | struct crypto_skcipher *tfm; | 583 | struct crypto_skcipher *tfm; |
582 | struct skcipher_request *req; | 584 | struct skcipher_request *req; |
583 | unsigned int encrypted_datalen; | 585 | unsigned int encrypted_datalen; |
586 | u8 iv[AES_BLOCK_SIZE]; | ||
584 | char pad[16]; | 587 | char pad[16]; |
585 | int ret; | 588 | int ret; |
586 | 589 | ||
@@ -599,8 +602,8 @@ static int derived_key_decrypt(struct encrypted_key_payload *epayload, | |||
599 | epayload->decrypted_datalen); | 602 | epayload->decrypted_datalen); |
600 | sg_set_buf(&sg_out[1], pad, sizeof pad); | 603 | sg_set_buf(&sg_out[1], pad, sizeof pad); |
601 | 604 | ||
602 | skcipher_request_set_crypt(req, sg_in, sg_out, encrypted_datalen, | 605 | memcpy(iv, epayload->iv, sizeof(iv)); |
603 | epayload->iv); | 606 | skcipher_request_set_crypt(req, sg_in, sg_out, encrypted_datalen, iv); |
604 | ret = crypto_skcipher_decrypt(req); | 607 | ret = crypto_skcipher_decrypt(req); |
605 | tfm = crypto_skcipher_reqtfm(req); | 608 | tfm = crypto_skcipher_reqtfm(req); |
606 | skcipher_request_free(req); | 609 | skcipher_request_free(req); |
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 5077f1968841..a97b275ca3af 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -173,7 +173,7 @@ static char *tomoyo_get_local_path(struct dentry *dentry, char * const buffer, | |||
173 | * Use filesystem name if filesystem does not support rename() | 173 | * Use filesystem name if filesystem does not support rename() |
174 | * operation. | 174 | * operation. |
175 | */ | 175 | */ |
176 | if (!inode->i_op->rename && !inode->i_op->rename2) | 176 | if (!inode->i_op->rename) |
177 | goto prepend_filesystem_name; | 177 | goto prepend_filesystem_name; |
178 | } | 178 | } |
179 | /* Prepend device name. */ | 179 | /* Prepend device name. */ |
@@ -283,7 +283,7 @@ char *tomoyo_realpath_from_path(const struct path *path) | |||
283 | * or dentry without vfsmount. | 283 | * or dentry without vfsmount. |
284 | */ | 284 | */ |
285 | if (!path->mnt || | 285 | if (!path->mnt || |
286 | (!inode->i_op->rename && !inode->i_op->rename2)) | 286 | (!inode->i_op->rename)) |
287 | pos = tomoyo_get_local_path(path->dentry, buf, | 287 | pos = tomoyo_get_local_path(path->dentry, buf, |
288 | buf_len - 1); | 288 | buf_len - 1); |
289 | /* Get absolute name for the rest. */ | 289 | /* Get absolute name for the rest. */ |
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index d9836c5eb694..11c8d9bc762e 100644 --- a/tools/lguest/lguest.c +++ b/tools/lguest/lguest.c | |||
@@ -3266,6 +3266,9 @@ int main(int argc, char *argv[]) | |||
3266 | } | 3266 | } |
3267 | } | 3267 | } |
3268 | 3268 | ||
3269 | /* If we exit via err(), this kills all the threads, restores tty. */ | ||
3270 | atexit(cleanup_devices); | ||
3271 | |||
3269 | /* We always have a console device, and it's always device 1. */ | 3272 | /* We always have a console device, and it's always device 1. */ |
3270 | setup_console(); | 3273 | setup_console(); |
3271 | 3274 | ||
@@ -3369,9 +3372,6 @@ int main(int argc, char *argv[]) | |||
3369 | /* Ensure that we terminate if a device-servicing child dies. */ | 3372 | /* Ensure that we terminate if a device-servicing child dies. */ |
3370 | signal(SIGCHLD, kill_launcher); | 3373 | signal(SIGCHLD, kill_launcher); |
3371 | 3374 | ||
3372 | /* If we exit via err(), this kills all the threads, restores tty. */ | ||
3373 | atexit(cleanup_devices); | ||
3374 | |||
3375 | /* If requested, chroot to a directory */ | 3375 | /* If requested, chroot to a directory */ |
3376 | if (chroot_path) { | 3376 | if (chroot_path) { |
3377 | if (chroot(chroot_path) != 0) | 3377 | if (chroot(chroot_path) != 0) |
diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index 3b530467148e..9d0919ed52a4 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | CFLAGS += -I. -g -Wall -D_LGPL_SOURCE | 2 | CFLAGS += -I. -g -O2 -Wall -D_LGPL_SOURCE |
3 | LDFLAGS += -lpthread -lurcu | 3 | LDFLAGS += -lpthread -lurcu |
4 | TARGETS = main | 4 | TARGETS = main |
5 | OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ | 5 | OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ |
diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c index 39d9b9568fe2..05d7bc488971 100644 --- a/tools/testing/radix-tree/multiorder.c +++ b/tools/testing/radix-tree/multiorder.c | |||
@@ -124,6 +124,8 @@ static void multiorder_check(unsigned long index, int order) | |||
124 | unsigned long i; | 124 | unsigned long i; |
125 | unsigned long min = index & ~((1UL << order) - 1); | 125 | unsigned long min = index & ~((1UL << order) - 1); |
126 | unsigned long max = min + (1UL << order); | 126 | unsigned long max = min + (1UL << order); |
127 | void **slot; | ||
128 | struct item *item2 = item_create(min); | ||
127 | RADIX_TREE(tree, GFP_KERNEL); | 129 | RADIX_TREE(tree, GFP_KERNEL); |
128 | 130 | ||
129 | printf("Multiorder index %ld, order %d\n", index, order); | 131 | printf("Multiorder index %ld, order %d\n", index, order); |
@@ -139,13 +141,19 @@ static void multiorder_check(unsigned long index, int order) | |||
139 | item_check_absent(&tree, i); | 141 | item_check_absent(&tree, i); |
140 | for (i = max; i < 2*max; i++) | 142 | for (i = max; i < 2*max; i++) |
141 | item_check_absent(&tree, i); | 143 | item_check_absent(&tree, i); |
144 | for (i = min; i < max; i++) | ||
145 | assert(radix_tree_insert(&tree, i, item2) == -EEXIST); | ||
146 | |||
147 | slot = radix_tree_lookup_slot(&tree, index); | ||
148 | free(*slot); | ||
149 | radix_tree_replace_slot(slot, item2); | ||
142 | for (i = min; i < max; i++) { | 150 | for (i = min; i < max; i++) { |
143 | static void *entry = (void *) | 151 | struct item *item = item_lookup(&tree, i); |
144 | (0xA0 | RADIX_TREE_EXCEPTIONAL_ENTRY); | 152 | assert(item != 0); |
145 | assert(radix_tree_insert(&tree, i, entry) == -EEXIST); | 153 | assert(item->index == min); |
146 | } | 154 | } |
147 | 155 | ||
148 | assert(item_delete(&tree, index) != 0); | 156 | assert(item_delete(&tree, min) != 0); |
149 | 157 | ||
150 | for (i = 0; i < 2*max; i++) | 158 | for (i = 0; i < 2*max; i++) |
151 | item_check_absent(&tree, i); | 159 | item_check_absent(&tree, i); |