diff options
397 files changed, 3355 insertions, 3362 deletions
diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft index c2b7d1154bec..cac3930bdb04 100644 --- a/Documentation/ABI/testing/sysfs-ibft +++ b/Documentation/ABI/testing/sysfs-ibft | |||
| @@ -20,4 +20,4 @@ Date: November 2007 | |||
| 20 | Contact: Konrad Rzeszutek <ketuzsezr@darnok.org> | 20 | Contact: Konrad Rzeszutek <ketuzsezr@darnok.org> |
| 21 | Description: The /sys/firmware/ibft/ethernetX directory will contain | 21 | Description: The /sys/firmware/ibft/ethernetX directory will contain |
| 22 | files that expose the iSCSI Boot Firmware Table NIC data. | 22 | files that expose the iSCSI Boot Firmware Table NIC data. |
| 23 | This can this can the IP address, MAC, and gateway of the NIC. | 23 | Usually this contains the IP address, MAC, and gateway of the NIC. |
diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index df2962d9e11e..8bf7c6191296 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile | |||
| @@ -25,7 +25,7 @@ GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP)) | |||
| 25 | PHONY += cleanmediadocs | 25 | PHONY += cleanmediadocs |
| 26 | 26 | ||
| 27 | cleanmediadocs: | 27 | cleanmediadocs: |
| 28 | -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null | 28 | -@rm -f `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null |
| 29 | 29 | ||
| 30 | $(obj)/media_api.xml: $(GENFILES) FORCE | 30 | $(obj)/media_api.xml: $(GENFILES) FORCE |
| 31 | 31 | ||
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 07ffc76553ba..0a2debfa68f6 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml | |||
| @@ -2566,6 +2566,10 @@ fields changed from _s32 to _u32. | |||
| 2566 | <para>Added compound control types and &VIDIOC-QUERY-EXT-CTRL;. | 2566 | <para>Added compound control types and &VIDIOC-QUERY-EXT-CTRL;. |
| 2567 | </para> | 2567 | </para> |
| 2568 | </listitem> | 2568 | </listitem> |
| 2569 | </orderedlist> | ||
| 2570 | </section> | ||
| 2571 | |||
| 2572 | <section> | ||
| 2569 | <title>V4L2 in Linux 3.18</title> | 2573 | <title>V4L2 in Linux 3.18</title> |
| 2570 | <orderedlist> | 2574 | <orderedlist> |
| 2571 | <listitem> | 2575 | <listitem> |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 57cf5efb044d..93aa8604630e 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
| @@ -324,7 +324,6 @@ tree, they need to be integration-tested. For this purpose, a special | |||
| 324 | testing repository exists into which virtually all subsystem trees are | 324 | testing repository exists into which virtually all subsystem trees are |
| 325 | pulled on an almost daily basis: | 325 | pulled on an almost daily basis: |
| 326 | http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git | 326 | http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git |
| 327 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
| 328 | 327 | ||
| 329 | This way, the -next kernel gives a summary outlook onto what will be | 328 | This way, the -next kernel gives a summary outlook onto what will be |
| 330 | expected to go into the mainline kernel at the next merge period. | 329 | expected to go into the mainline kernel at the next merge period. |
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 482c74947de0..1fa1caa198eb 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
| @@ -483,12 +483,10 @@ have been included in the discussion | |||
| 483 | 483 | ||
| 484 | 14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: | 484 | 14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: |
| 485 | 485 | ||
| 486 | If this patch fixes a problem reported by somebody else, consider adding a | 486 | The Reported-by tag gives credit to people who find bugs and report them and it |
| 487 | Reported-by: tag to credit the reporter for their contribution. Please | 487 | hopefully inspires them to help us again in the future. Please note that if |
| 488 | note that this tag should not be added without the reporter's permission, | 488 | the bug was reported in private, then ask for permission first before using the |
| 489 | especially if the problem was not reported in a public forum. That said, | 489 | Reported-by tag. |
| 490 | if we diligently credit our bug reporters, they will, hopefully, be | ||
| 491 | inspired to help us again in the future. | ||
| 492 | 490 | ||
| 493 | A Tested-by: tag indicates that the patch has been successfully tested (in | 491 | A Tested-by: tag indicates that the patch has been successfully tested (in |
| 494 | some environment) by the person named. This tag informs maintainers that | 492 | some environment) by the person named. This tag informs maintainers that |
diff --git a/Documentation/development-process/2.Process b/Documentation/development-process/2.Process index 2e0617936e8f..c24e156a6118 100644 --- a/Documentation/development-process/2.Process +++ b/Documentation/development-process/2.Process | |||
| @@ -289,10 +289,6 @@ lists when they are assembled; they can be downloaded from: | |||
| 289 | 289 | ||
| 290 | http://www.kernel.org/pub/linux/kernel/next/ | 290 | http://www.kernel.org/pub/linux/kernel/next/ |
| 291 | 291 | ||
| 292 | Some information about linux-next has been gathered at: | ||
| 293 | |||
| 294 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
| 295 | |||
| 296 | Linux-next has become an integral part of the kernel development process; | 292 | Linux-next has become an integral part of the kernel development process; |
| 297 | all patches merged during a given merge window should really have found | 293 | all patches merged during a given merge window should really have found |
| 298 | their way into linux-next some time before the merge window opens. | 294 | their way into linux-next some time before the merge window opens. |
diff --git a/Documentation/development-process/8.Conclusion b/Documentation/development-process/8.Conclusion index 1990ab4b4949..caef69022e9c 100644 --- a/Documentation/development-process/8.Conclusion +++ b/Documentation/development-process/8.Conclusion | |||
| @@ -22,10 +22,6 @@ Beyond that, a valuable resource for kernel developers is: | |||
| 22 | 22 | ||
| 23 | http://kernelnewbies.org/ | 23 | http://kernelnewbies.org/ |
| 24 | 24 | ||
| 25 | Information about the linux-next tree gathers at: | ||
| 26 | |||
| 27 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
| 28 | |||
| 29 | And, of course, one should not forget http://kernel.org/, the definitive | 25 | And, of course, one should not forget http://kernel.org/, the definitive |
| 30 | location for kernel release information. | 26 | location for kernel release information. |
| 31 | 27 | ||
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt index 0f8487b88822..e77e167593db 100644 --- a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt +++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt | |||
| @@ -11,3 +11,5 @@ Optional properties: | |||
| 11 | are supported on the device. Valid value for SMSC LAN91c111 are | 11 | are supported on the device. Valid value for SMSC LAN91c111 are |
| 12 | 1, 2 or 4. If it's omitted or invalid, the size would be 2 meaning | 12 | 1, 2 or 4. If it's omitted or invalid, the size would be 2 meaning |
| 13 | 16-bit access only. | 13 | 16-bit access only. |
| 14 | - power-gpios: GPIO to control the PWRDWN pin | ||
| 15 | - reset-gpios: GPIO to control the RESET pin | ||
diff --git a/Documentation/devicetree/bindings/sound/sgtl5000.txt b/Documentation/devicetree/bindings/sound/sgtl5000.txt index 955df60a118c..d556dcb8816b 100644 --- a/Documentation/devicetree/bindings/sound/sgtl5000.txt +++ b/Documentation/devicetree/bindings/sound/sgtl5000.txt | |||
| @@ -7,10 +7,20 @@ Required properties: | |||
| 7 | 7 | ||
| 8 | - clocks : the clock provider of SYS_MCLK | 8 | - clocks : the clock provider of SYS_MCLK |
| 9 | 9 | ||
| 10 | - VDDA-supply : the regulator provider of VDDA | ||
| 11 | |||
| 12 | - VDDIO-supply: the regulator provider of VDDIO | ||
| 13 | |||
| 14 | Optional properties: | ||
| 15 | |||
| 16 | - VDDD-supply : the regulator provider of VDDD | ||
| 17 | |||
| 10 | Example: | 18 | Example: |
| 11 | 19 | ||
| 12 | codec: sgtl5000@0a { | 20 | codec: sgtl5000@0a { |
| 13 | compatible = "fsl,sgtl5000"; | 21 | compatible = "fsl,sgtl5000"; |
| 14 | reg = <0x0a>; | 22 | reg = <0x0a>; |
| 15 | clocks = <&clks 150>; | 23 | clocks = <&clks 150>; |
| 24 | VDDA-supply = <®_3p3v>; | ||
| 25 | VDDIO-supply = <®_3p3v>; | ||
| 16 | }; | 26 | }; |
diff --git a/Documentation/devicetree/bindings/submitting-patches.txt b/Documentation/devicetree/bindings/submitting-patches.txt index 042a0273b8ba..b7ba01ad1426 100644 --- a/Documentation/devicetree/bindings/submitting-patches.txt +++ b/Documentation/devicetree/bindings/submitting-patches.txt | |||
| @@ -12,6 +12,9 @@ I. For patch submitters | |||
| 12 | 12 | ||
| 13 | devicetree@vger.kernel.org | 13 | devicetree@vger.kernel.org |
| 14 | 14 | ||
| 15 | 3) The Documentation/ portion of the patch should come in the series before | ||
| 16 | the code implementing the binding. | ||
| 17 | |||
| 15 | II. For kernel maintainers | 18 | II. For kernel maintainers |
| 16 | 19 | ||
| 17 | 1) If you aren't comfortable reviewing a given binding, reply to it and ask | 20 | 1) If you aren't comfortable reviewing a given binding, reply to it and ask |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 74339c57b914..db034a5912e7 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -1307,6 +1307,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 1307 | .cdrom .chs .ignore_cable are additional options | 1307 | .cdrom .chs .ignore_cable are additional options |
| 1308 | See Documentation/ide/ide.txt. | 1308 | See Documentation/ide/ide.txt. |
| 1309 | 1309 | ||
| 1310 | ide-generic.probe-mask= [HW] (E)IDE subsystem | ||
| 1311 | Format: <int> | ||
| 1312 | Probe mask for legacy ISA IDE ports. Depending on | ||
| 1313 | platform up to 6 ports are supported, enabled by | ||
| 1314 | setting corresponding bits in the mask to 1. The | ||
| 1315 | default value is 0x0, which has a special meaning. | ||
| 1316 | On systems that have PCI, it triggers scanning the | ||
| 1317 | PCI bus for the first and the second port, which | ||
| 1318 | are then probed. On systems without PCI the value | ||
| 1319 | of 0x0 enables probing the two first ports as if it | ||
| 1320 | was 0x3. | ||
| 1321 | |||
| 1310 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem | 1322 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem |
| 1311 | Claim all unknown PCI IDE storage controllers. | 1323 | Claim all unknown PCI IDE storage controllers. |
| 1312 | 1324 | ||
| @@ -1587,6 +1599,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
| 1587 | kmemleak= [KNL] Boot-time kmemleak enable/disable | 1599 | kmemleak= [KNL] Boot-time kmemleak enable/disable |
| 1588 | Valid arguments: on, off | 1600 | Valid arguments: on, off |
| 1589 | Default: on | 1601 | Default: on |
| 1602 | Built with CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y, | ||
| 1603 | the default is off. | ||
| 1590 | 1604 | ||
| 1591 | kmemcheck= [X86] Boot-time kmemcheck enable/disable/one-shot mode | 1605 | kmemcheck= [X86] Boot-time kmemcheck enable/disable/one-shot mode |
| 1592 | Valid arguments: 0, 1, 2 | 1606 | Valid arguments: 0, 1, 2 |
diff --git a/Documentation/kmemleak.txt b/Documentation/kmemleak.txt index f4f033c8d856..45e777f4e41d 100644 --- a/Documentation/kmemleak.txt +++ b/Documentation/kmemleak.txt | |||
| @@ -62,6 +62,10 @@ Memory may be allocated or freed before kmemleak is initialised and | |||
| 62 | these actions are stored in an early log buffer. The size of this buffer | 62 | these actions are stored in an early log buffer. The size of this buffer |
| 63 | is configured via the CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE option. | 63 | is configured via the CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE option. |
| 64 | 64 | ||
| 65 | If CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF are enabled, the kmemleak is | ||
| 66 | disabled by default. Passing "kmemleak=on" on the kernel command | ||
| 67 | line enables the function. | ||
| 68 | |||
| 65 | Basic Algorithm | 69 | Basic Algorithm |
| 66 | --------------- | 70 | --------------- |
| 67 | 71 | ||
diff --git a/Documentation/prctl/Makefile b/Documentation/prctl/Makefile index 3e3232dcb2b8..2948b7b124b9 100644 --- a/Documentation/prctl/Makefile +++ b/Documentation/prctl/Makefile | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | # List of programs to build | 1 | # List of programs to build |
| 2 | hostprogs-y := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test | 2 | hostprogs-$(CONFIG_X86) := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test |
| 3 | # Tell kbuild to always build the programs | 3 | # Tell kbuild to always build the programs |
| 4 | always := $(hostprogs-y) | 4 | always := $(hostprogs-y) |
| 5 | 5 | ||
diff --git a/Documentation/ptp/testptp.mk b/Documentation/ptp/testptp.mk new file mode 100644 index 000000000000..4ef2d9755421 --- /dev/null +++ b/Documentation/ptp/testptp.mk | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | # PTP 1588 clock support - User space test program | ||
| 2 | # | ||
| 3 | # Copyright (C) 2010 OMICRON electronics GmbH | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation; either version 2 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # This program is distributed in the hope that it will be useful, | ||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this program; if not, write to the Free Software | ||
| 17 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 18 | |||
| 19 | CC = $(CROSS_COMPILE)gcc | ||
| 20 | INC = -I$(KBUILD_OUTPUT)/usr/include | ||
| 21 | CFLAGS = -Wall $(INC) | ||
| 22 | LDLIBS = -lrt | ||
| 23 | PROGS = testptp | ||
| 24 | |||
| 25 | all: $(PROGS) | ||
| 26 | |||
| 27 | testptp: testptp.o | ||
| 28 | |||
| 29 | clean: | ||
| 30 | rm -f testptp.o | ||
| 31 | |||
| 32 | distclean: clean | ||
| 33 | rm -f $(PROGS) | ||
diff --git a/Documentation/vDSO/Makefile b/Documentation/vDSO/Makefile index 2b99e57207c1..ee075c3d2124 100644 --- a/Documentation/vDSO/Makefile +++ b/Documentation/vDSO/Makefile | |||
| @@ -10,3 +10,6 @@ always := $(hostprogs-y) | |||
| 10 | HOSTCFLAGS := -I$(objtree)/usr/include -std=gnu99 | 10 | HOSTCFLAGS := -I$(objtree)/usr/include -std=gnu99 |
| 11 | HOSTCFLAGS_vdso_standalone_test_x86.o := -fno-asynchronous-unwind-tables -fno-stack-protector | 11 | HOSTCFLAGS_vdso_standalone_test_x86.o := -fno-asynchronous-unwind-tables -fno-stack-protector |
| 12 | HOSTLOADLIBES_vdso_standalone_test_x86 := -nostdlib | 12 | HOSTLOADLIBES_vdso_standalone_test_x86 := -nostdlib |
| 13 | ifeq ($(CONFIG_X86_32),y) | ||
| 14 | HOSTLOADLIBES_vdso_standalone_test_x86 += -lgcc_s | ||
| 15 | endif | ||
diff --git a/Documentation/vDSO/vdso_standalone_test_x86.c b/Documentation/vDSO/vdso_standalone_test_x86.c index d46240265c50..93b0ebf8cc38 100644 --- a/Documentation/vDSO/vdso_standalone_test_x86.c +++ b/Documentation/vDSO/vdso_standalone_test_x86.c | |||
| @@ -63,7 +63,7 @@ static inline void linux_exit(int code) | |||
| 63 | x86_syscall3(__NR_exit, code, 0, 0); | 63 | x86_syscall3(__NR_exit, code, 0, 0); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | void to_base10(char *lastdig, uint64_t n) | 66 | void to_base10(char *lastdig, time_t n) |
| 67 | { | 67 | { |
| 68 | while (n) { | 68 | while (n) { |
| 69 | *lastdig = (n % 10) + '0'; | 69 | *lastdig = (n % 10) + '0'; |
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index bdd4bb97fff7..b64e0af9cc56 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
| @@ -274,7 +274,7 @@ This command mounts a (pseudo) filesystem of type hugetlbfs on the directory | |||
| 274 | /mnt/huge. Any files created on /mnt/huge uses huge pages. The uid and gid | 274 | /mnt/huge. Any files created on /mnt/huge uses huge pages. The uid and gid |
| 275 | options sets the owner and group of the root of the file system. By default | 275 | options sets the owner and group of the root of the file system. By default |
| 276 | the uid and gid of the current process are taken. The mode option sets the | 276 | the uid and gid of the current process are taken. The mode option sets the |
| 277 | mode of root of file system to value & 0777. This value is given in octal. | 277 | mode of root of file system to value & 01777. This value is given in octal. |
| 278 | By default the value 0755 is picked. The size option sets the maximum value of | 278 | By default the value 0755 is picked. The size option sets the maximum value of |
| 279 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is | 279 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is |
| 280 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of | 280 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of |
diff --git a/MAINTAINERS b/MAINTAINERS index dab92a78d1d5..1cfabdd1d23f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -4608,7 +4608,7 @@ S: Supported | |||
| 4608 | F: drivers/crypto/nx/ | 4608 | F: drivers/crypto/nx/ |
| 4609 | 4609 | ||
| 4610 | IBM Power 842 compression accelerator | 4610 | IBM Power 842 compression accelerator |
| 4611 | M: Nathan Fontenot <nfont@linux.vnet.ibm.com> | 4611 | M: Dan Streetman <ddstreet@us.ibm.com> |
| 4612 | S: Supported | 4612 | S: Supported |
| 4613 | F: drivers/crypto/nx/nx-842.c | 4613 | F: drivers/crypto/nx/nx-842.c |
| 4614 | F: include/linux/nx842.h | 4614 | F: include/linux/nx842.h |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 739fcf29c643..bc82a12d4c2c 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
| @@ -668,6 +668,8 @@ | |||
| 668 | bank-width = <2>; | 668 | bank-width = <2>; |
| 669 | pinctrl-names = "default"; | 669 | pinctrl-names = "default"; |
| 670 | pinctrl-0 = <ðernet_pins>; | 670 | pinctrl-0 = <ðernet_pins>; |
| 671 | power-gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>; /* gpio86 */ | ||
| 672 | reset-gpios = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* gpio164 */ | ||
| 671 | gpmc,device-width = <2>; | 673 | gpmc,device-width = <2>; |
| 672 | gpmc,sync-clk-ps = <0>; | 674 | gpmc,sync-clk-ps = <0>; |
| 673 | gpmc,cs-on-ns = <0>; | 675 | gpmc,cs-on-ns = <0>; |
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 713e807621d2..2d2d6087b9b1 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
| 12 | */ | 12 | */ |
| 13 | #include <linux/compiler.h> | ||
| 13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 14 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
| 15 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
| @@ -39,10 +40,19 @@ | |||
| 39 | * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c | 40 | * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c |
| 40 | * (http://gcc.gnu.org/PR8896) and incorrect structure | 41 | * (http://gcc.gnu.org/PR8896) and incorrect structure |
| 41 | * initialisation in fs/jffs2/erase.c | 42 | * initialisation in fs/jffs2/erase.c |
| 43 | * GCC 4.8.0-4.8.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854 | ||
| 44 | * miscompiles find_get_entry(), and can result in EXT3 and EXT4 | ||
| 45 | * filesystem corruption (possibly other FS too). | ||
| 42 | */ | 46 | */ |
| 47 | #ifdef __GNUC__ | ||
| 43 | #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) | 48 | #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) |
| 44 | #error Your compiler is too buggy; it is known to miscompile kernels. | 49 | #error Your compiler is too buggy; it is known to miscompile kernels. |
| 45 | #error Known good compilers: 3.3 | 50 | #error Known good compilers: 3.3, 4.x |
| 51 | #endif | ||
| 52 | #if GCC_VERSION >= 40800 && GCC_VERSION < 40803 | ||
| 53 | #error Your compiler is too buggy; it is known to miscompile kernels | ||
| 54 | #error and result in filesystem corruption and oopses. | ||
| 55 | #endif | ||
| 46 | #endif | 56 | #endif |
| 47 | 57 | ||
| 48 | int main(void) | 58 | int main(void) |
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index c95346c94829..cec9d6c6442c 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
| @@ -252,9 +252,6 @@ static void __init nokia_n900_legacy_init(void) | |||
| 252 | platform_device_register(&omap3_rom_rng_device); | 252 | platform_device_register(&omap3_rom_rng_device); |
| 253 | 253 | ||
| 254 | } | 254 | } |
| 255 | |||
| 256 | /* Only on some development boards */ | ||
| 257 | gpio_request_one(164, GPIOF_OUT_INIT_LOW, "smc91x reset"); | ||
| 258 | } | 255 | } |
| 259 | 256 | ||
| 260 | static void __init omap3_tao3530_legacy_init(void) | 257 | static void __init omap3_tao3530_legacy_init(void) |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 92bba32d9230..9481f85c56e6 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
| @@ -559,10 +559,10 @@ void __init mem_init(void) | |||
| 559 | #ifdef CONFIG_MODULES | 559 | #ifdef CONFIG_MODULES |
| 560 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" | 560 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" |
| 561 | #endif | 561 | #endif |
| 562 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" | 562 | " .text : 0x%p" " - 0x%p" " (%4td kB)\n" |
| 563 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" | 563 | " .init : 0x%p" " - 0x%p" " (%4td kB)\n" |
| 564 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" | 564 | " .data : 0x%p" " - 0x%p" " (%4td kB)\n" |
| 565 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", | 565 | " .bss : 0x%p" " - 0x%p" " (%4td kB)\n", |
| 566 | 566 | ||
| 567 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + | 567 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + |
| 568 | (PAGE_SIZE)), | 568 | (PAGE_SIZE)), |
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 6feded3b0c4c..a7736fa0580c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
| @@ -129,6 +129,10 @@ endmenu | |||
| 129 | 129 | ||
| 130 | menu "Kernel features" | 130 | menu "Kernel features" |
| 131 | 131 | ||
| 132 | config NR_CPUS | ||
| 133 | int | ||
| 134 | default "1" | ||
| 135 | |||
| 132 | config ADVANCED_OPTIONS | 136 | config ADVANCED_OPTIONS |
| 133 | bool "Prompt for advanced kernel configuration options" | 137 | bool "Prompt for advanced kernel configuration options" |
| 134 | help | 138 | help |
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index ea4b233647c1..0a53362d5548 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
| @@ -38,6 +38,6 @@ | |||
| 38 | 38 | ||
| 39 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
| 40 | 40 | ||
| 41 | #define __NR_syscalls 387 | 41 | #define __NR_syscalls 388 |
| 42 | 42 | ||
| 43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ | 43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h index 1c2380bf8fe6..c712677f8a2a 100644 --- a/arch/microblaze/include/uapi/asm/unistd.h +++ b/arch/microblaze/include/uapi/asm/unistd.h | |||
| @@ -402,5 +402,6 @@ | |||
| 402 | #define __NR_seccomp 384 | 402 | #define __NR_seccomp 384 |
| 403 | #define __NR_getrandom 385 | 403 | #define __NR_getrandom 385 |
| 404 | #define __NR_memfd_create 386 | 404 | #define __NR_memfd_create 386 |
| 405 | #define __NR_bpf 387 | ||
| 405 | 406 | ||
| 406 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ | 407 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index de59ee1d7010..0166e890486c 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
| @@ -387,3 +387,4 @@ ENTRY(sys_call_table) | |||
| 387 | .long sys_seccomp | 387 | .long sys_seccomp |
| 388 | .long sys_getrandom /* 385 */ | 388 | .long sys_getrandom /* 385 */ |
| 389 | .long sys_memfd_create | 389 | .long sys_memfd_create |
| 390 | .long sys_bpf | ||
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 9037914f6985..b30e41c0c033 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
| @@ -660,8 +660,13 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
| 660 | res = &hose->mem_resources[memno++]; | 660 | res = &hose->mem_resources[memno++]; |
| 661 | break; | 661 | break; |
| 662 | } | 662 | } |
| 663 | if (res != NULL) | 663 | if (res != NULL) { |
| 664 | of_pci_range_to_resource(&range, dev, res); | 664 | res->name = dev->full_name; |
| 665 | res->flags = range.flags; | ||
| 666 | res->start = range.cpu_addr; | ||
| 667 | res->end = range.cpu_addr + range.size - 1; | ||
| 668 | res->parent = res->child = res->sibling = NULL; | ||
| 669 | } | ||
| 665 | } | 670 | } |
| 666 | 671 | ||
| 667 | /* If there's an ISA hole and the pci_mem_offset is -not- matching | 672 | /* If there's an ISA hole and the pci_mem_offset is -not- matching |
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 623f2971ce0e..766b77d527ac 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
| @@ -71,7 +71,7 @@ pte_t *huge_pte_offset_and_shift(struct mm_struct *mm, | |||
| 71 | 71 | ||
| 72 | void flush_dcache_icache_hugepage(struct page *page); | 72 | void flush_dcache_icache_hugepage(struct page *page); |
| 73 | 73 | ||
| 74 | #if defined(CONFIG_PPC_MM_SLICES) || defined(CONFIG_PPC_SUBPAGE_PROT) | 74 | #if defined(CONFIG_PPC_MM_SLICES) |
| 75 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | 75 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, |
| 76 | unsigned long len); | 76 | unsigned long len); |
| 77 | #else | 77 | #else |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 7d8a60068805..ce9577d693be 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
| @@ -365,3 +365,4 @@ SYSCALL_SPU(renameat2) | |||
| 365 | SYSCALL_SPU(seccomp) | 365 | SYSCALL_SPU(seccomp) |
| 366 | SYSCALL_SPU(getrandom) | 366 | SYSCALL_SPU(getrandom) |
| 367 | SYSCALL_SPU(memfd_create) | 367 | SYSCALL_SPU(memfd_create) |
| 368 | SYSCALL_SPU(bpf) | ||
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 4e9af3fd43e7..e0da021caa00 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <uapi/asm/unistd.h> | 12 | #include <uapi/asm/unistd.h> |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | #define __NR_syscalls 361 | 15 | #define __NR_syscalls 362 |
| 16 | 16 | ||
| 17 | #define __NR__exit __NR_exit | 17 | #define __NR__exit __NR_exit |
| 18 | #define NR_syscalls __NR_syscalls | 18 | #define NR_syscalls __NR_syscalls |
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h index 0688fc06e183..f55351f2e66e 100644 --- a/arch/powerpc/include/uapi/asm/unistd.h +++ b/arch/powerpc/include/uapi/asm/unistd.h | |||
| @@ -383,5 +383,6 @@ | |||
| 383 | #define __NR_seccomp 358 | 383 | #define __NR_seccomp 358 |
| 384 | #define __NR_getrandom 359 | 384 | #define __NR_getrandom 359 |
| 385 | #define __NR_memfd_create 360 | 385 | #define __NR_memfd_create 360 |
| 386 | #define __NR_bpf 361 | ||
| 386 | 387 | ||
| 387 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 388 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c index 0f9939e693df..5a236f082c78 100644 --- a/arch/powerpc/mm/copro_fault.c +++ b/arch/powerpc/mm/copro_fault.c | |||
| @@ -99,8 +99,6 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
| 99 | u64 vsid; | 99 | u64 vsid; |
| 100 | int psize, ssize; | 100 | int psize, ssize; |
| 101 | 101 | ||
| 102 | slb->esid = (ea & ESID_MASK) | SLB_ESID_V; | ||
| 103 | |||
| 104 | switch (REGION_ID(ea)) { | 102 | switch (REGION_ID(ea)) { |
| 105 | case USER_REGION_ID: | 103 | case USER_REGION_ID: |
| 106 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); | 104 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); |
| @@ -133,6 +131,7 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
| 133 | vsid |= mmu_psize_defs[psize].sllp | | 131 | vsid |= mmu_psize_defs[psize].sllp | |
| 134 | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); | 132 | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); |
| 135 | 133 | ||
| 134 | slb->esid = (ea & (ssize == MMU_SEGSIZE_1T ? ESID_MASK_1T : ESID_MASK)) | SLB_ESID_V; | ||
| 136 | slb->vsid = vsid; | 135 | slb->vsid = vsid; |
| 137 | 136 | ||
| 138 | return 0; | 137 | return 0; |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index e5236c24dc07..b9d1dfdbe5bb 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
| @@ -1509,11 +1509,14 @@ static int update_cpu_topology(void *data) | |||
| 1509 | cpu = smp_processor_id(); | 1509 | cpu = smp_processor_id(); |
| 1510 | 1510 | ||
| 1511 | for (update = data; update; update = update->next) { | 1511 | for (update = data; update; update = update->next) { |
| 1512 | int new_nid = update->new_nid; | ||
| 1512 | if (cpu != update->cpu) | 1513 | if (cpu != update->cpu) |
| 1513 | continue; | 1514 | continue; |
| 1514 | 1515 | ||
| 1515 | unmap_cpu_from_node(update->cpu); | 1516 | unmap_cpu_from_node(cpu); |
| 1516 | map_cpu_to_node(update->cpu, update->new_nid); | 1517 | map_cpu_to_node(cpu, new_nid); |
| 1518 | set_cpu_numa_node(cpu, new_nid); | ||
| 1519 | set_cpu_numa_mem(cpu, local_memory_node(new_nid)); | ||
| 1517 | vdso_getcpu_init(); | 1520 | vdso_getcpu_init(); |
| 1518 | } | 1521 | } |
| 1519 | 1522 | ||
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index 8d7bda94d196..ded0ea1afde4 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c | |||
| @@ -682,6 +682,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start, | |||
| 682 | slice_convert(mm, mask, psize); | 682 | slice_convert(mm, mask, psize); |
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | #ifdef CONFIG_HUGETLB_PAGE | ||
| 685 | /* | 686 | /* |
| 686 | * is_hugepage_only_range() is used by generic code to verify whether | 687 | * is_hugepage_only_range() is used by generic code to verify whether |
| 687 | * a normal mmap mapping (non hugetlbfs) is valid on a given area. | 688 | * a normal mmap mapping (non hugetlbfs) is valid on a given area. |
| @@ -726,4 +727,4 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | |||
| 726 | #endif | 727 | #endif |
| 727 | return !slice_check_fit(mask, available); | 728 | return !slice_check_fit(mask, available); |
| 728 | } | 729 | } |
| 729 | 730 | #endif | |
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 6c8710dd90c9..dba34088da28 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c | |||
| @@ -417,11 +417,6 @@ static int h_24x7_event_add(struct perf_event *event, int flags) | |||
| 417 | return 0; | 417 | return 0; |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | static int h_24x7_event_idx(struct perf_event *event) | ||
| 421 | { | ||
| 422 | return 0; | ||
| 423 | } | ||
| 424 | |||
| 425 | static struct pmu h_24x7_pmu = { | 420 | static struct pmu h_24x7_pmu = { |
| 426 | .task_ctx_nr = perf_invalid_context, | 421 | .task_ctx_nr = perf_invalid_context, |
| 427 | 422 | ||
| @@ -433,7 +428,6 @@ static struct pmu h_24x7_pmu = { | |||
| 433 | .start = h_24x7_event_start, | 428 | .start = h_24x7_event_start, |
| 434 | .stop = h_24x7_event_stop, | 429 | .stop = h_24x7_event_stop, |
| 435 | .read = h_24x7_event_update, | 430 | .read = h_24x7_event_update, |
| 436 | .event_idx = h_24x7_event_idx, | ||
| 437 | }; | 431 | }; |
| 438 | 432 | ||
| 439 | static int hv_24x7_init(void) | 433 | static int hv_24x7_init(void) |
diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c index 15fc76c93022..a051fe946c63 100644 --- a/arch/powerpc/perf/hv-gpci.c +++ b/arch/powerpc/perf/hv-gpci.c | |||
| @@ -246,11 +246,6 @@ static int h_gpci_event_init(struct perf_event *event) | |||
| 246 | return 0; | 246 | return 0; |
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | static int h_gpci_event_idx(struct perf_event *event) | ||
| 250 | { | ||
| 251 | return 0; | ||
| 252 | } | ||
| 253 | |||
| 254 | static struct pmu h_gpci_pmu = { | 249 | static struct pmu h_gpci_pmu = { |
| 255 | .task_ctx_nr = perf_invalid_context, | 250 | .task_ctx_nr = perf_invalid_context, |
| 256 | 251 | ||
| @@ -262,7 +257,6 @@ static struct pmu h_gpci_pmu = { | |||
| 262 | .start = h_gpci_event_start, | 257 | .start = h_gpci_event_start, |
| 263 | .stop = h_gpci_event_stop, | 258 | .stop = h_gpci_event_stop, |
| 264 | .read = h_gpci_event_update, | 259 | .read = h_gpci_event_update, |
| 265 | .event_idx = h_gpci_event_idx, | ||
| 266 | }; | 260 | }; |
| 267 | 261 | ||
| 268 | static int hv_gpci_init(void) | 262 | static int hv_gpci_init(void) |
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c index dd2c285ad170..ad4b31df779a 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c | |||
| @@ -191,7 +191,6 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
| 191 | { | 191 | { |
| 192 | struct lpc_debugfs_entry *lpc = filp->private_data; | 192 | struct lpc_debugfs_entry *lpc = filp->private_data; |
| 193 | u32 data, pos, len, todo; | 193 | u32 data, pos, len, todo; |
| 194 | __be32 bedata; | ||
| 195 | int rc; | 194 | int rc; |
| 196 | 195 | ||
| 197 | if (!access_ok(VERIFY_WRITE, ubuf, count)) | 196 | if (!access_ok(VERIFY_WRITE, ubuf, count)) |
| @@ -214,10 +213,9 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
| 214 | len = 2; | 213 | len = 2; |
| 215 | } | 214 | } |
| 216 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, | 215 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, |
| 217 | &bedata, len); | 216 | &data, len); |
| 218 | if (rc) | 217 | if (rc) |
| 219 | return -ENXIO; | 218 | return -ENXIO; |
| 220 | data = be32_to_cpu(bedata); | ||
| 221 | switch(len) { | 219 | switch(len) { |
| 222 | case 4: | 220 | case 4: |
| 223 | rc = __put_user((u32)data, (u32 __user *)ubuf); | 221 | rc = __put_user((u32)data, (u32 __user *)ubuf); |
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index e9e2450c1fdd..feb549aa3eea 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
| @@ -58,7 +58,7 @@ END_FTR_SECTION(0, 1); \ | |||
| 58 | */ | 58 | */ |
| 59 | 59 | ||
| 60 | #define OPAL_CALL(name, token) \ | 60 | #define OPAL_CALL(name, token) \ |
| 61 | _GLOBAL(name); \ | 61 | _GLOBAL_TOC(name); \ |
| 62 | mflr r0; \ | 62 | mflr r0; \ |
| 63 | std r0,16(r1); \ | 63 | std r0,16(r1); \ |
| 64 | li r0,token; \ | 64 | li r0,token; \ |
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 08e761318c17..b878f12a9597 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c | |||
| @@ -1411,11 +1411,6 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags) | |||
| 1411 | perf_pmu_enable(event->pmu); | 1411 | perf_pmu_enable(event->pmu); |
| 1412 | } | 1412 | } |
| 1413 | 1413 | ||
| 1414 | static int cpumsf_pmu_event_idx(struct perf_event *event) | ||
| 1415 | { | ||
| 1416 | return event->hw.idx; | ||
| 1417 | } | ||
| 1418 | |||
| 1419 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); | 1414 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); |
| 1420 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); | 1415 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); |
| 1421 | 1416 | ||
| @@ -1458,7 +1453,6 @@ static struct pmu cpumf_sampling = { | |||
| 1458 | .stop = cpumsf_pmu_stop, | 1453 | .stop = cpumsf_pmu_stop, |
| 1459 | .read = cpumsf_pmu_read, | 1454 | .read = cpumsf_pmu_read, |
| 1460 | 1455 | ||
| 1461 | .event_idx = cpumsf_pmu_event_idx, | ||
| 1462 | .attr_groups = cpumsf_pmu_attr_groups, | 1456 | .attr_groups = cpumsf_pmu_attr_groups, |
| 1463 | }; | 1457 | }; |
| 1464 | 1458 | ||
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index 9139d14b9c53..538c10db3537 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
| @@ -118,7 +118,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | static struct resource scif0_resources[] = { | 120 | static struct resource scif0_resources[] = { |
| 121 | DEFINE_RES_MEM(0xfffffe80, 0x100), | 121 | DEFINE_RES_MEM(0xfffffe80, 0x10), |
| 122 | DEFINE_RES_IRQ(evt2irq(0x4e0)), | 122 | DEFINE_RES_IRQ(evt2irq(0x4e0)), |
| 123 | }; | 123 | }; |
| 124 | 124 | ||
| @@ -143,7 +143,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
| 143 | }; | 143 | }; |
| 144 | 144 | ||
| 145 | static struct resource scif1_resources[] = { | 145 | static struct resource scif1_resources[] = { |
| 146 | DEFINE_RES_MEM(0xa4000150, 0x100), | 146 | DEFINE_RES_MEM(0xa4000150, 0x10), |
| 147 | DEFINE_RES_IRQ(evt2irq(0x900)), | 147 | DEFINE_RES_IRQ(evt2irq(0x900)), |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| @@ -169,7 +169,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
| 169 | }; | 169 | }; |
| 170 | 170 | ||
| 171 | static struct resource scif2_resources[] = { | 171 | static struct resource scif2_resources[] = { |
| 172 | DEFINE_RES_MEM(0xa4000140, 0x100), | 172 | DEFINE_RES_MEM(0xa4000140, 0x10), |
| 173 | DEFINE_RES_IRQ(evt2irq(0x880)), | 173 | DEFINE_RES_IRQ(evt2irq(0x880)), |
| 174 | }; | 174 | }; |
| 175 | 175 | ||
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h index c842a89b1190..46d83842eddc 100644 --- a/arch/sparc/include/uapi/asm/unistd.h +++ b/arch/sparc/include/uapi/asm/unistd.h | |||
| @@ -414,8 +414,9 @@ | |||
| 414 | #define __NR_seccomp 346 | 414 | #define __NR_seccomp 346 |
| 415 | #define __NR_getrandom 347 | 415 | #define __NR_getrandom 347 |
| 416 | #define __NR_memfd_create 348 | 416 | #define __NR_memfd_create 348 |
| 417 | #define __NR_bpf 349 | ||
| 417 | 418 | ||
| 418 | #define NR_syscalls 349 | 419 | #define NR_syscalls 350 |
| 419 | 420 | ||
| 420 | /* Bitmask values returned from kern_features system call. */ | 421 | /* Bitmask values returned from kern_features system call. */ |
| 421 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 | 422 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 |
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 6a873c344bc0..ad0cdf497b78 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
| @@ -86,4 +86,4 @@ sys_call_table: | |||
| 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
| 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
| 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
| 89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index d9151b6490d8..580cde9370c9 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
| @@ -87,7 +87,7 @@ sys_call_table32: | |||
| 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime | 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime |
| 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev | 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev |
| 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
| 90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
| 91 | 91 | ||
| 92 | #endif /* CONFIG_COMPAT */ | 92 | #endif /* CONFIG_COMPAT */ |
| 93 | 93 | ||
| @@ -166,4 +166,4 @@ sys_call_table: | |||
| 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
| 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
| 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
| 169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f2327e88e07c..ded8a6774ac9 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -142,6 +142,10 @@ config INSTRUCTION_DECODER | |||
| 142 | def_bool y | 142 | def_bool y |
| 143 | depends on KPROBES || PERF_EVENTS || UPROBES | 143 | depends on KPROBES || PERF_EVENTS || UPROBES |
| 144 | 144 | ||
| 145 | config PERF_EVENTS_INTEL_UNCORE | ||
| 146 | def_bool y | ||
| 147 | depends on PERF_EVENTS && SUP_SUP_INTEL && PCI | ||
| 148 | |||
| 145 | config OUTPUT_FORMAT | 149 | config OUTPUT_FORMAT |
| 146 | string | 150 | string |
| 147 | default "elf32-i386" if X86_32 | 151 | default "elf32-i386" if X86_32 |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 8ffba18395c8..ffe71228fc10 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
| @@ -157,7 +157,7 @@ ENTRY(ia32_sysenter_target) | |||
| 157 | * ourselves. To save a few cycles, we can check whether | 157 | * ourselves. To save a few cycles, we can check whether |
| 158 | * NT was set instead of doing an unconditional popfq. | 158 | * NT was set instead of doing an unconditional popfq. |
| 159 | */ | 159 | */ |
| 160 | testl $X86_EFLAGS_NT,EFLAGS(%rsp) /* saved EFLAGS match cpu */ | 160 | testl $X86_EFLAGS_NT,EFLAGS-ARGOFFSET(%rsp) |
| 161 | jnz sysenter_fix_flags | 161 | jnz sysenter_fix_flags |
| 162 | sysenter_flags_fixed: | 162 | sysenter_flags_fixed: |
| 163 | 163 | ||
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h index 7024c12f7bfe..400873450e33 100644 --- a/arch/x86/include/asm/preempt.h +++ b/arch/x86/include/asm/preempt.h | |||
| @@ -105,6 +105,7 @@ static __always_inline bool should_resched(void) | |||
| 105 | # ifdef CONFIG_CONTEXT_TRACKING | 105 | # ifdef CONFIG_CONTEXT_TRACKING |
| 106 | extern asmlinkage void ___preempt_schedule_context(void); | 106 | extern asmlinkage void ___preempt_schedule_context(void); |
| 107 | # define __preempt_schedule_context() asm ("call ___preempt_schedule_context") | 107 | # define __preempt_schedule_context() asm ("call ___preempt_schedule_context") |
| 108 | extern asmlinkage void preempt_schedule_context(void); | ||
| 108 | # endif | 109 | # endif |
| 109 | #endif | 110 | #endif |
| 110 | 111 | ||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b436fc735aa4..a142e77693e1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -397,7 +397,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, | |||
| 397 | 397 | ||
| 398 | /* Don't set up the ACPI SCI because it's already set up */ | 398 | /* Don't set up the ACPI SCI because it's already set up */ |
| 399 | if (acpi_gbl_FADT.sci_interrupt == gsi) | 399 | if (acpi_gbl_FADT.sci_interrupt == gsi) |
| 400 | return gsi; | 400 | return mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); |
| 401 | 401 | ||
| 402 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; | 402 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; |
| 403 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; | 403 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; |
| @@ -604,14 +604,18 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) | |||
| 604 | 604 | ||
| 605 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) | 605 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) |
| 606 | { | 606 | { |
| 607 | int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | 607 | int irq; |
| 608 | 608 | ||
| 609 | if (irq >= 0) { | 609 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { |
| 610 | *irqp = gsi; | ||
| 611 | } else { | ||
| 612 | irq = mp_map_gsi_to_irq(gsi, | ||
| 613 | IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | ||
| 614 | if (irq < 0) | ||
| 615 | return -1; | ||
| 610 | *irqp = irq; | 616 | *irqp = irq; |
| 611 | return 0; | ||
| 612 | } | 617 | } |
| 613 | 618 | return 0; | |
| 614 | return -1; | ||
| 615 | } | 619 | } |
| 616 | EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); | 620 | EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); |
| 617 | 621 | ||
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 5972b108f15a..b708738d016e 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
| @@ -185,8 +185,6 @@ static void apbt_setup_irq(struct apbt_dev *adev) | |||
| 185 | 185 | ||
| 186 | irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); | 186 | irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); |
| 187 | irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); | 187 | irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); |
| 188 | /* APB timer irqs are set up as mp_irqs, timer is edge type */ | ||
| 189 | __irq_set_handler(adev->irq, handle_edge_irq, 0, "edge"); | ||
| 190 | } | 188 | } |
| 191 | 189 | ||
| 192 | /* Should be called with per cpu */ | 190 | /* Should be called with per cpu */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 00853b254ab0..ba6cc041edb1 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
| @@ -1297,7 +1297,7 @@ void setup_local_APIC(void) | |||
| 1297 | unsigned int value, queued; | 1297 | unsigned int value, queued; |
| 1298 | int i, j, acked = 0; | 1298 | int i, j, acked = 0; |
| 1299 | unsigned long long tsc = 0, ntsc; | 1299 | unsigned long long tsc = 0, ntsc; |
| 1300 | long long max_loops = cpu_khz; | 1300 | long long max_loops = cpu_khz ? cpu_khz : 1000000; |
| 1301 | 1301 | ||
| 1302 | if (cpu_has_tsc) | 1302 | if (cpu_has_tsc) |
| 1303 | rdtscll(tsc); | 1303 | rdtscll(tsc); |
| @@ -1383,7 +1383,7 @@ void setup_local_APIC(void) | |||
| 1383 | break; | 1383 | break; |
| 1384 | } | 1384 | } |
| 1385 | if (queued) { | 1385 | if (queued) { |
| 1386 | if (cpu_has_tsc) { | 1386 | if (cpu_has_tsc && cpu_khz) { |
| 1387 | rdtscll(ntsc); | 1387 | rdtscll(ntsc); |
| 1388 | max_loops = (cpu_khz << 10) - (ntsc - tsc); | 1388 | max_loops = (cpu_khz << 10) - (ntsc - tsc); |
| 1389 | } else | 1389 | } else |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index 01d5453b5502..e27b49d7c922 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
| @@ -39,9 +39,12 @@ obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd_iommu.o | |||
| 39 | endif | 39 | endif |
| 40 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o | 40 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o |
| 41 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o | 41 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o |
| 42 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o perf_event_intel_uncore_snb.o | ||
| 43 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore_snbep.o perf_event_intel_uncore_nhmex.o | ||
| 44 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o | 42 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o |
| 43 | |||
| 44 | obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += perf_event_intel_uncore.o \ | ||
| 45 | perf_event_intel_uncore_snb.o \ | ||
| 46 | perf_event_intel_uncore_snbep.o \ | ||
| 47 | perf_event_intel_uncore_nhmex.o | ||
| 45 | endif | 48 | endif |
| 46 | 49 | ||
| 47 | 50 | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 1ef456273172..9cc6b6f25f42 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
| @@ -213,12 +213,13 @@ static void intel_workarounds(struct cpuinfo_x86 *c) | |||
| 213 | { | 213 | { |
| 214 | #ifdef CONFIG_X86_F00F_BUG | 214 | #ifdef CONFIG_X86_F00F_BUG |
| 215 | /* | 215 | /* |
| 216 | * All current models of Pentium and Pentium with MMX technology CPUs | 216 | * All models of Pentium and Pentium with MMX technology CPUs |
| 217 | * have the F0 0F bug, which lets nonprivileged users lock up the | 217 | * have the F0 0F bug, which lets nonprivileged users lock up the |
| 218 | * system. Announce that the fault handler will be checking for it. | 218 | * system. Announce that the fault handler will be checking for it. |
| 219 | * The Quark is also family 5, but does not have the same bug. | ||
| 219 | */ | 220 | */ |
| 220 | clear_cpu_bug(c, X86_BUG_F00F); | 221 | clear_cpu_bug(c, X86_BUG_F00F); |
| 221 | if (!paravirt_enabled() && c->x86 == 5) { | 222 | if (!paravirt_enabled() && c->x86 == 5 && c->x86_model < 9) { |
| 222 | static int f00f_workaround_enabled; | 223 | static int f00f_workaround_enabled; |
| 223 | 224 | ||
| 224 | set_cpu_bug(c, X86_BUG_F00F); | 225 | set_cpu_bug(c, X86_BUG_F00F); |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 1b8299dd3d91..143e5f5dc855 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
| @@ -243,8 +243,9 @@ static bool check_hw_exists(void) | |||
| 243 | 243 | ||
| 244 | msr_fail: | 244 | msr_fail: |
| 245 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); | 245 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); |
| 246 | printk(boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR | 246 | printk("%sFailed to access perfctr msr (MSR %x is %Lx)\n", |
| 247 | "Failed to access perfctr msr (MSR %x is %Lx)\n", reg, val_new); | 247 | boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR, |
| 248 | reg, val_new); | ||
| 248 | 249 | ||
| 249 | return false; | 250 | return false; |
| 250 | } | 251 | } |
| @@ -444,12 +445,6 @@ int x86_pmu_hw_config(struct perf_event *event) | |||
| 444 | if (event->attr.type == PERF_TYPE_RAW) | 445 | if (event->attr.type == PERF_TYPE_RAW) |
| 445 | event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK; | 446 | event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK; |
| 446 | 447 | ||
| 447 | if (event->attr.sample_period && x86_pmu.limit_period) { | ||
| 448 | if (x86_pmu.limit_period(event, event->attr.sample_period) > | ||
| 449 | event->attr.sample_period) | ||
| 450 | return -EINVAL; | ||
| 451 | } | ||
| 452 | |||
| 453 | return x86_setup_perfctr(event); | 448 | return x86_setup_perfctr(event); |
| 454 | } | 449 | } |
| 455 | 450 | ||
| @@ -987,9 +982,6 @@ int x86_perf_event_set_period(struct perf_event *event) | |||
| 987 | if (left > x86_pmu.max_period) | 982 | if (left > x86_pmu.max_period) |
| 988 | left = x86_pmu.max_period; | 983 | left = x86_pmu.max_period; |
| 989 | 984 | ||
| 990 | if (x86_pmu.limit_period) | ||
| 991 | left = x86_pmu.limit_period(event, left); | ||
| 992 | |||
| 993 | per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; | 985 | per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; |
| 994 | 986 | ||
| 995 | /* | 987 | /* |
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index d98a34d435d7..fc5eb390b368 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
| @@ -445,7 +445,6 @@ struct x86_pmu { | |||
| 445 | struct x86_pmu_quirk *quirks; | 445 | struct x86_pmu_quirk *quirks; |
| 446 | int perfctr_second_write; | 446 | int perfctr_second_write; |
| 447 | bool late_ack; | 447 | bool late_ack; |
| 448 | unsigned (*limit_period)(struct perf_event *event, unsigned l); | ||
| 449 | 448 | ||
| 450 | /* | 449 | /* |
| 451 | * sysfs attrs | 450 | * sysfs attrs |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index a73947c53b65..944bf019b74f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
| @@ -220,15 +220,6 @@ static struct event_constraint intel_hsw_event_constraints[] = { | |||
| 220 | EVENT_CONSTRAINT_END | 220 | EVENT_CONSTRAINT_END |
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | static struct event_constraint intel_bdw_event_constraints[] = { | ||
| 224 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | ||
| 225 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | ||
| 226 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | ||
| 227 | INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */ | ||
| 228 | INTEL_EVENT_CONSTRAINT(0xa3, 0x4), /* CYCLE_ACTIVITY.* */ | ||
| 229 | EVENT_CONSTRAINT_END | ||
| 230 | }; | ||
| 231 | |||
| 232 | static u64 intel_pmu_event_map(int hw_event) | 223 | static u64 intel_pmu_event_map(int hw_event) |
| 233 | { | 224 | { |
| 234 | return intel_perfmon_event_map[hw_event]; | 225 | return intel_perfmon_event_map[hw_event]; |
| @@ -424,126 +415,6 @@ static __initconst const u64 snb_hw_cache_event_ids | |||
| 424 | 415 | ||
| 425 | }; | 416 | }; |
| 426 | 417 | ||
| 427 | static __initconst const u64 hsw_hw_cache_event_ids | ||
| 428 | [PERF_COUNT_HW_CACHE_MAX] | ||
| 429 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
| 430 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
| 431 | { | ||
| 432 | [ C(L1D ) ] = { | ||
| 433 | [ C(OP_READ) ] = { | ||
| 434 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
| 435 | [ C(RESULT_MISS) ] = 0x151, /* L1D.REPLACEMENT */ | ||
| 436 | }, | ||
| 437 | [ C(OP_WRITE) ] = { | ||
| 438 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
| 439 | [ C(RESULT_MISS) ] = 0x0, | ||
| 440 | }, | ||
| 441 | [ C(OP_PREFETCH) ] = { | ||
| 442 | [ C(RESULT_ACCESS) ] = 0x0, | ||
| 443 | [ C(RESULT_MISS) ] = 0x0, | ||
| 444 | }, | ||
| 445 | }, | ||
| 446 | [ C(L1I ) ] = { | ||
| 447 | [ C(OP_READ) ] = { | ||
| 448 | [ C(RESULT_ACCESS) ] = 0x0, | ||
| 449 | [ C(RESULT_MISS) ] = 0x280, /* ICACHE.MISSES */ | ||
| 450 | }, | ||
| 451 | [ C(OP_WRITE) ] = { | ||
| 452 | [ C(RESULT_ACCESS) ] = -1, | ||
| 453 | [ C(RESULT_MISS) ] = -1, | ||
| 454 | }, | ||
| 455 | [ C(OP_PREFETCH) ] = { | ||
| 456 | [ C(RESULT_ACCESS) ] = 0x0, | ||
| 457 | [ C(RESULT_MISS) ] = 0x0, | ||
| 458 | }, | ||
| 459 | }, | ||
| 460 | [ C(LL ) ] = { | ||
| 461 | [ C(OP_READ) ] = { | ||
| 462 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */ | ||
| 463 | [ C(RESULT_ACCESS) ] = 0x1b7, | ||
| 464 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE| | ||
| 465 | L3_MISS|ANY_SNOOP */ | ||
| 466 | [ C(RESULT_MISS) ] = 0x1b7, | ||
| 467 | }, | ||
| 468 | [ C(OP_WRITE) ] = { | ||
| 469 | [ C(RESULT_ACCESS) ] = 0x1b7, /* OFFCORE_RESPONSE:ALL_RFO */ | ||
| 470 | /* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */ | ||
| 471 | [ C(RESULT_MISS) ] = 0x1b7, | ||
| 472 | }, | ||
| 473 | [ C(OP_PREFETCH) ] = { | ||
| 474 | [ C(RESULT_ACCESS) ] = 0x0, | ||
| 475 | [ C(RESULT_MISS) ] = 0x0, | ||
| 476 | }, | ||
| 477 | }, | ||
| 478 | [ C(DTLB) ] = { | ||
| 479 | [ C(OP_READ) ] = { | ||
| 480 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
| 481 | [ C(RESULT_MISS) ] = 0x108, /* DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK */ | ||
| 482 | }, | ||
| 483 | [ C(OP_WRITE) ] = { | ||
| 484 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
| 485 | [ C(RESULT_MISS) ] = 0x149, /* DTLB_STORE_MISSES.MISS_CAUSES_A_WALK */ | ||
| 486 | }, | ||
| 487 | [ C(OP_PREFETCH) ] = { | ||
| 488 | [ C(RESULT_ACCESS) ] = 0x0, | ||
| 489 | [ C(RESULT_MISS) ] = 0x0, | ||
| 490 | }, | ||
| 491 | }, | ||
| 492 | [ C(ITLB) ] = { | ||
| 493 | [ C(OP_READ) ] = { | ||
| 494 | [ C(RESULT_ACCESS) ] = 0x6085, /* ITLB_MISSES.STLB_HIT */ | ||
| 495 | [ C(RESULT_MISS) ] = 0x185, /* ITLB_MISSES.MISS_CAUSES_A_WALK */ | ||
| 496 | }, | ||
| 497 | [ C(OP_WRITE) ] = { | ||
| 498 | [ C(RESULT_ACCESS) ] = -1, | ||
| 499 | [ C(RESULT_MISS) ] = -1, | ||
| 500 | }, | ||
| 501 | [ C(OP_PREFETCH) ] = { | ||
| 502 | [ C(RESULT_ACCESS) ] = -1, | ||
| 503 | [ C(RESULT_MISS) ] = -1, | ||
| 504 | }, | ||
| 505 | }, | ||
| 506 | [ C(BPU ) ] = { | ||
| 507 | [ C(OP_READ) ] = { | ||
| 508 | [ C(RESULT_ACCESS) ] = 0xc4, /* BR_INST_RETIRED.ALL_BRANCHES */ | ||
| 509 | [ C(RESULT_MISS) ] = 0xc5, /* BR_MISP_RETIRED.ALL_BRANCHES */ | ||
| 510 | }, | ||
| 511 | [ C(OP_WRITE) ] = { | ||
| 512 | [ C(RESULT_ACCESS) ] = -1, | ||
| 513 | [ C(RESULT_MISS) ] = -1, | ||
| 514 | }, | ||
| 515 | [ C(OP_PREFETCH) ] = { | ||
| 516 | [ C(RESULT_ACCESS) ] = -1, | ||
| 517 | [ C(RESULT_MISS) ] = -1, | ||
| 518 | }, | ||
| 519 | }, | ||
| 520 | }; | ||
| 521 | |||
| 522 | static __initconst const u64 hsw_hw_cache_extra_regs | ||
| 523 | [PERF_COUNT_HW_CACHE_MAX] | ||
| 524 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
| 525 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
| 526 | { | ||
| 527 | [ C(LL ) ] = { | ||
| 528 | [ C(OP_READ) ] = { | ||
| 529 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */ | ||
| 530 | [ C(RESULT_ACCESS) ] = 0x2d5, | ||
| 531 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE| | ||
| 532 | L3_MISS|ANY_SNOOP */ | ||
| 533 | [ C(RESULT_MISS) ] = 0x3fbc0202d5ull, | ||
| 534 | }, | ||
| 535 | [ C(OP_WRITE) ] = { | ||
| 536 | [ C(RESULT_ACCESS) ] = 0x122, /* OFFCORE_RESPONSE:ALL_RFO */ | ||
| 537 | /* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */ | ||
| 538 | [ C(RESULT_MISS) ] = 0x3fbc020122ull, | ||
| 539 | }, | ||
| 540 | [ C(OP_PREFETCH) ] = { | ||
| 541 | [ C(RESULT_ACCESS) ] = 0x0, | ||
| 542 | [ C(RESULT_MISS) ] = 0x0, | ||
| 543 | }, | ||
| 544 | }, | ||
| 545 | }; | ||
| 546 | |||
| 547 | static __initconst const u64 westmere_hw_cache_event_ids | 418 | static __initconst const u64 westmere_hw_cache_event_ids |
| 548 | [PERF_COUNT_HW_CACHE_MAX] | 419 | [PERF_COUNT_HW_CACHE_MAX] |
| 549 | [PERF_COUNT_HW_CACHE_OP_MAX] | 420 | [PERF_COUNT_HW_CACHE_OP_MAX] |
| @@ -2034,24 +1905,6 @@ hsw_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) | |||
| 2034 | return c; | 1905 | return c; |
| 2035 | } | 1906 | } |
| 2036 | 1907 | ||
| 2037 | /* | ||
| 2038 | * Broadwell: | ||
| 2039 | * The INST_RETIRED.ALL period always needs to have lowest | ||
| 2040 | * 6bits cleared (BDM57). It shall not use a period smaller | ||
| 2041 | * than 100 (BDM11). We combine the two to enforce | ||
| 2042 | * a min-period of 128. | ||
| 2043 | */ | ||
| 2044 | static unsigned bdw_limit_period(struct perf_event *event, unsigned left) | ||
| 2045 | { | ||
| 2046 | if ((event->hw.config & INTEL_ARCH_EVENT_MASK) == | ||
| 2047 | X86_CONFIG(.event=0xc0, .umask=0x01)) { | ||
| 2048 | if (left < 128) | ||
| 2049 | left = 128; | ||
| 2050 | left &= ~0x3fu; | ||
| 2051 | } | ||
| 2052 | return left; | ||
| 2053 | } | ||
| 2054 | |||
| 2055 | PMU_FORMAT_ATTR(event, "config:0-7" ); | 1908 | PMU_FORMAT_ATTR(event, "config:0-7" ); |
| 2056 | PMU_FORMAT_ATTR(umask, "config:8-15" ); | 1909 | PMU_FORMAT_ATTR(umask, "config:8-15" ); |
| 2057 | PMU_FORMAT_ATTR(edge, "config:18" ); | 1910 | PMU_FORMAT_ATTR(edge, "config:18" ); |
| @@ -2692,8 +2545,8 @@ __init int intel_pmu_init(void) | |||
| 2692 | case 69: /* 22nm Haswell ULT */ | 2545 | case 69: /* 22nm Haswell ULT */ |
| 2693 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ | 2546 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ |
| 2694 | x86_pmu.late_ack = true; | 2547 | x86_pmu.late_ack = true; |
| 2695 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | 2548 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
| 2696 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | 2549 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); |
| 2697 | 2550 | ||
| 2698 | intel_pmu_lbr_init_snb(); | 2551 | intel_pmu_lbr_init_snb(); |
| 2699 | 2552 | ||
| @@ -2712,28 +2565,6 @@ __init int intel_pmu_init(void) | |||
| 2712 | pr_cont("Haswell events, "); | 2565 | pr_cont("Haswell events, "); |
| 2713 | break; | 2566 | break; |
| 2714 | 2567 | ||
| 2715 | case 61: /* 14nm Broadwell Core-M */ | ||
| 2716 | x86_pmu.late_ack = true; | ||
| 2717 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | ||
| 2718 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | ||
| 2719 | |||
| 2720 | intel_pmu_lbr_init_snb(); | ||
| 2721 | |||
| 2722 | x86_pmu.event_constraints = intel_bdw_event_constraints; | ||
| 2723 | x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints; | ||
| 2724 | x86_pmu.extra_regs = intel_snbep_extra_regs; | ||
| 2725 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
| 2726 | /* all extra regs are per-cpu when HT is on */ | ||
| 2727 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | ||
| 2728 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | ||
| 2729 | |||
| 2730 | x86_pmu.hw_config = hsw_hw_config; | ||
| 2731 | x86_pmu.get_event_constraints = hsw_get_event_constraints; | ||
| 2732 | x86_pmu.cpu_events = hsw_events_attrs; | ||
| 2733 | x86_pmu.limit_period = bdw_limit_period; | ||
| 2734 | pr_cont("Broadwell events, "); | ||
| 2735 | break; | ||
| 2736 | |||
| 2737 | default: | 2568 | default: |
| 2738 | switch (x86_pmu.version) { | 2569 | switch (x86_pmu.version) { |
| 2739 | case 1: | 2570 | case 1: |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index b553ed89e5f5..344b63f18d14 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
| @@ -447,15 +447,14 @@ sysenter_exit: | |||
| 447 | sysenter_audit: | 447 | sysenter_audit: |
| 448 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) | 448 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) |
| 449 | jnz syscall_trace_entry | 449 | jnz syscall_trace_entry |
| 450 | addl $4,%esp | 450 | /* movl PT_EAX(%esp), %eax already set, syscall number: 1st arg to audit */ |
| 451 | CFI_ADJUST_CFA_OFFSET -4 | 451 | movl PT_EBX(%esp), %edx /* ebx/a0: 2nd arg to audit */ |
| 452 | movl %esi,4(%esp) /* 5th arg: 4th syscall arg */ | 452 | /* movl PT_ECX(%esp), %ecx already set, a1: 3nd arg to audit */ |
| 453 | movl %edx,(%esp) /* 4th arg: 3rd syscall arg */ | 453 | pushl_cfi PT_ESI(%esp) /* a3: 5th arg */ |
| 454 | /* %ecx already in %ecx 3rd arg: 2nd syscall arg */ | 454 | pushl_cfi PT_EDX+4(%esp) /* a2: 4th arg */ |
| 455 | movl %ebx,%edx /* 2nd arg: 1st syscall arg */ | ||
| 456 | /* %eax already in %eax 1st arg: syscall number */ | ||
| 457 | call __audit_syscall_entry | 455 | call __audit_syscall_entry |
| 458 | pushl_cfi %ebx | 456 | popl_cfi %ecx /* get that remapped edx off the stack */ |
| 457 | popl_cfi %ecx /* get that remapped esi off the stack */ | ||
| 459 | movl PT_EAX(%esp),%eax /* reload syscall number */ | 458 | movl PT_EAX(%esp),%eax /* reload syscall number */ |
| 460 | jmp sysenter_do_call | 459 | jmp sysenter_do_call |
| 461 | 460 | ||
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 8af817105e29..e7cc5370cd2f 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
| @@ -111,8 +111,7 @@ static void make_8259A_irq(unsigned int irq) | |||
| 111 | { | 111 | { |
| 112 | disable_irq_nosync(irq); | 112 | disable_irq_nosync(irq); |
| 113 | io_apic_irqs &= ~(1<<irq); | 113 | io_apic_irqs &= ~(1<<irq); |
| 114 | irq_set_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq, | 114 | irq_set_chip_and_handler(irq, &i8259A_chip, handle_level_irq); |
| 115 | i8259A_chip.name); | ||
| 116 | enable_irq(irq); | 115 | enable_irq(irq); |
| 117 | } | 116 | } |
| 118 | 117 | ||
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 44f1ed42fdf2..4de73ee78361 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
| @@ -70,7 +70,6 @@ int vector_used_by_percpu_irq(unsigned int vector) | |||
| 70 | void __init init_ISA_irqs(void) | 70 | void __init init_ISA_irqs(void) |
| 71 | { | 71 | { |
| 72 | struct irq_chip *chip = legacy_pic->chip; | 72 | struct irq_chip *chip = legacy_pic->chip; |
| 73 | const char *name = chip->name; | ||
| 74 | int i; | 73 | int i; |
| 75 | 74 | ||
| 76 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) | 75 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) |
| @@ -79,7 +78,7 @@ void __init init_ISA_irqs(void) | |||
| 79 | legacy_pic->init(0); | 78 | legacy_pic->init(0); |
| 80 | 79 | ||
| 81 | for (i = 0; i < nr_legacy_irqs(); i++) | 80 | for (i = 0; i < nr_legacy_irqs(); i++) |
| 82 | irq_set_chip_and_handler_name(i, chip, handle_level_irq, name); | 81 | irq_set_chip_and_handler(i, chip, handle_level_irq); |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | void __init init_IRQ(void) | 84 | void __init init_IRQ(void) |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 235cfd39e0d7..ab08aa2276fb 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 1128 | setup_real_mode(); | 1128 | setup_real_mode(); |
| 1129 | 1129 | ||
| 1130 | memblock_set_current_limit(get_max_mapped()); | 1130 | memblock_set_current_limit(get_max_mapped()); |
| 1131 | dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); | ||
| 1132 | 1131 | ||
| 1133 | /* | 1132 | /* |
| 1134 | * NOTE: On x86-32, only from this point on, fixmaps are ready for use. | 1133 | * NOTE: On x86-32, only from this point on, fixmaps are ready for use. |
| @@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 1159 | early_acpi_boot_init(); | 1158 | early_acpi_boot_init(); |
| 1160 | 1159 | ||
| 1161 | initmem_init(); | 1160 | initmem_init(); |
| 1161 | dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); | ||
| 1162 | 1162 | ||
| 1163 | /* | 1163 | /* |
| 1164 | * Reserve memory for crash kernel after SRAT is parsed so that it | 1164 | * Reserve memory for crash kernel after SRAT is parsed so that it |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2d5200e56357..4d2128ac70bd 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
| @@ -102,8 +102,6 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map); | |||
| 102 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); | 102 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
| 103 | EXPORT_PER_CPU_SYMBOL(cpu_info); | 103 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
| 104 | 104 | ||
| 105 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
| 106 | |||
| 107 | atomic_t init_deasserted; | 105 | atomic_t init_deasserted; |
| 108 | 106 | ||
| 109 | /* | 107 | /* |
| @@ -1318,6 +1316,8 @@ void cpu_disable_common(void) | |||
| 1318 | fixup_irqs(); | 1316 | fixup_irqs(); |
| 1319 | } | 1317 | } |
| 1320 | 1318 | ||
| 1319 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
| 1320 | |||
| 1321 | int native_cpu_disable(void) | 1321 | int native_cpu_disable(void) |
| 1322 | { | 1322 | { |
| 1323 | int ret; | 1323 | int ret; |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index b6025f9e36c6..b7e50bba3bbb 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
| @@ -1166,14 +1166,17 @@ void __init tsc_init(void) | |||
| 1166 | 1166 | ||
| 1167 | x86_init.timers.tsc_pre_init(); | 1167 | x86_init.timers.tsc_pre_init(); |
| 1168 | 1168 | ||
| 1169 | if (!cpu_has_tsc) | 1169 | if (!cpu_has_tsc) { |
| 1170 | setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
| 1170 | return; | 1171 | return; |
| 1172 | } | ||
| 1171 | 1173 | ||
| 1172 | tsc_khz = x86_platform.calibrate_tsc(); | 1174 | tsc_khz = x86_platform.calibrate_tsc(); |
| 1173 | cpu_khz = tsc_khz; | 1175 | cpu_khz = tsc_khz; |
| 1174 | 1176 | ||
| 1175 | if (!tsc_khz) { | 1177 | if (!tsc_khz) { |
| 1176 | mark_tsc_unstable("could not calculate TSC khz"); | 1178 | mark_tsc_unstable("could not calculate TSC khz"); |
| 1179 | setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
| 1177 | return; | 1180 | return; |
| 1178 | } | 1181 | } |
| 1179 | 1182 | ||
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index ae242a7c11c7..36de293caf25 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
| @@ -409,7 +409,7 @@ phys_addr_t slow_virt_to_phys(void *__virt_addr) | |||
| 409 | psize = page_level_size(level); | 409 | psize = page_level_size(level); |
| 410 | pmask = page_level_mask(level); | 410 | pmask = page_level_mask(level); |
| 411 | offset = virt_addr & ~pmask; | 411 | offset = virt_addr & ~pmask; |
| 412 | phys_addr = pte_pfn(*pte) << PAGE_SHIFT; | 412 | phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; |
| 413 | return (phys_addr | offset); | 413 | return (phys_addr | offset); |
| 414 | } | 414 | } |
| 415 | EXPORT_SYMBOL_GPL(slow_virt_to_phys); | 415 | EXPORT_SYMBOL_GPL(slow_virt_to_phys); |
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c index 3c53a90fdb18..c14ad34776c4 100644 --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c | |||
| @@ -106,6 +106,7 @@ int __init sfi_parse_mtmr(struct sfi_table_header *table) | |||
| 106 | mp_irq.dstapic = MP_APIC_ALL; | 106 | mp_irq.dstapic = MP_APIC_ALL; |
| 107 | mp_irq.dstirq = pentry->irq; | 107 | mp_irq.dstirq = pentry->irq; |
| 108 | mp_save_irq(&mp_irq); | 108 | mp_save_irq(&mp_irq); |
| 109 | mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC); | ||
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | return 0; | 112 | return 0; |
| @@ -176,6 +177,7 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
| 176 | mp_irq.dstapic = MP_APIC_ALL; | 177 | mp_irq.dstapic = MP_APIC_ALL; |
| 177 | mp_irq.dstirq = pentry->irq; | 178 | mp_irq.dstirq = pentry->irq; |
| 178 | mp_save_irq(&mp_irq); | 179 | mp_save_irq(&mp_irq); |
| 180 | mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC); | ||
| 179 | } | 181 | } |
| 180 | return 0; | 182 | return 0; |
| 181 | } | 183 | } |
diff --git a/block/blk-merge.c b/block/blk-merge.c index ba99351c0f58..b3ac40aef46b 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
| @@ -99,16 +99,17 @@ void blk_recount_segments(struct request_queue *q, struct bio *bio) | |||
| 99 | { | 99 | { |
| 100 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, | 100 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, |
| 101 | &q->queue_flags); | 101 | &q->queue_flags); |
| 102 | bool merge_not_need = bio->bi_vcnt < queue_max_segments(q); | ||
| 102 | 103 | ||
| 103 | if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && | 104 | if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && |
| 104 | bio->bi_vcnt < queue_max_segments(q)) | 105 | merge_not_need) |
| 105 | bio->bi_phys_segments = bio->bi_vcnt; | 106 | bio->bi_phys_segments = bio->bi_vcnt; |
| 106 | else { | 107 | else { |
| 107 | struct bio *nxt = bio->bi_next; | 108 | struct bio *nxt = bio->bi_next; |
| 108 | 109 | ||
| 109 | bio->bi_next = NULL; | 110 | bio->bi_next = NULL; |
| 110 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, | 111 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, |
| 111 | no_sg_merge); | 112 | no_sg_merge && merge_not_need); |
| 112 | bio->bi_next = nxt; | 113 | bio->bi_next = nxt; |
| 113 | } | 114 | } |
| 114 | 115 | ||
diff --git a/block/elevator.c b/block/elevator.c index 24c28b659bb3..afa3b037a17c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -229,7 +229,9 @@ int elevator_init(struct request_queue *q, char *name) | |||
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | err = e->ops.elevator_init_fn(q, e); | 231 | err = e->ops.elevator_init_fn(q, e); |
| 232 | return 0; | 232 | if (err) |
| 233 | elevator_put(e); | ||
| 234 | return err; | ||
| 233 | } | 235 | } |
| 234 | EXPORT_SYMBOL(elevator_init); | 236 | EXPORT_SYMBOL(elevator_init); |
| 235 | 237 | ||
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index abb2e65b24cc..1e053d911240 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
| @@ -508,7 +508,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
| 508 | 508 | ||
| 509 | if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { | 509 | if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { |
| 510 | err = DRIVER_ERROR << 24; | 510 | err = DRIVER_ERROR << 24; |
| 511 | goto out; | 511 | goto error; |
| 512 | } | 512 | } |
| 513 | 513 | ||
| 514 | memset(sense, 0, sizeof(sense)); | 514 | memset(sense, 0, sizeof(sense)); |
| @@ -517,7 +517,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
| 517 | 517 | ||
| 518 | blk_execute_rq(q, disk, rq, 0); | 518 | blk_execute_rq(q, disk, rq, 0); |
| 519 | 519 | ||
| 520 | out: | ||
| 521 | err = rq->errors & 0xff; /* only 8 bit SCSI status */ | 520 | err = rq->errors & 0xff; /* only 8 bit SCSI status */ |
| 522 | if (err) { | 521 | if (err) { |
| 523 | if (rq->sense_len && rq->sense) { | 522 | if (rq->sense_len && rq->sense) { |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 473ff4892401..950fff9ce453 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
| @@ -223,9 +223,10 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, | |||
| 223 | #undef pr_fmt | 223 | #undef pr_fmt |
| 224 | #define pr_fmt(fmt) fmt | 224 | #define pr_fmt(fmt) fmt |
| 225 | 225 | ||
| 226 | static void rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev) | 226 | static int rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev) |
| 227 | { | 227 | { |
| 228 | dev_set_cma_area(dev, rmem->priv); | 228 | dev_set_cma_area(dev, rmem->priv); |
| 229 | return 0; | ||
| 229 | } | 230 | } |
| 230 | 231 | ||
| 231 | static void rmem_cma_device_release(struct reserved_mem *rmem, | 232 | static void rmem_cma_device_release(struct reserved_mem *rmem, |
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 1e5ac0a79696..cd9161a8b3a1 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
| @@ -275,7 +275,7 @@ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend, | |||
| 275 | static const struct pci_device_id bcma_pci_bridge_tbl[] = { | 275 | static const struct pci_device_id bcma_pci_bridge_tbl[] = { |
| 276 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, | 276 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, |
| 277 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4313) }, | 277 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4313) }, |
| 278 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43224) }, | 278 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43224) }, /* 0xa8d8 */ |
| 279 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, | 279 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, |
| 280 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, | 280 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, |
| 281 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, | 281 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, |
| @@ -285,7 +285,8 @@ static const struct pci_device_id bcma_pci_bridge_tbl[] = { | |||
| 285 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, | 285 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, |
| 286 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, | 286 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, |
| 287 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, | 287 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, |
| 288 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */ | 288 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */ |
| 289 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */ | ||
| 289 | { 0, }, | 290 | { 0, }, |
| 290 | }; | 291 | }; |
| 291 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); | 292 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index d1656c2f70af..1000955ce09d 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
| @@ -132,7 +132,7 @@ static bool bcma_is_core_needed_early(u16 core_id) | |||
| 132 | return false; | 132 | return false; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | #ifdef CONFIG_OF | 135 | #if defined(CONFIG_OF) && defined(CONFIG_OF_ADDRESS) |
| 136 | static struct device_node *bcma_of_find_child_device(struct platform_device *parent, | 136 | static struct device_node *bcma_of_find_child_device(struct platform_device *parent, |
| 137 | struct bcma_device *core) | 137 | struct bcma_device *core) |
| 138 | { | 138 | { |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 2671a3f02f0c..8001e812018b 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
| @@ -450,14 +450,10 @@ static int init_driver_queues(struct nullb *nullb) | |||
| 450 | 450 | ||
| 451 | ret = setup_commands(nq); | 451 | ret = setup_commands(nq); |
| 452 | if (ret) | 452 | if (ret) |
| 453 | goto err_queue; | 453 | return ret; |
| 454 | nullb->nr_queues++; | 454 | nullb->nr_queues++; |
| 455 | } | 455 | } |
| 456 | |||
| 457 | return 0; | 456 | return 0; |
| 458 | err_queue: | ||
| 459 | cleanup_queues(nullb); | ||
| 460 | return ret; | ||
| 461 | } | 457 | } |
| 462 | 458 | ||
| 463 | static int null_add_dev(void) | 459 | static int null_add_dev(void) |
| @@ -507,7 +503,9 @@ static int null_add_dev(void) | |||
| 507 | goto out_cleanup_queues; | 503 | goto out_cleanup_queues; |
| 508 | } | 504 | } |
| 509 | blk_queue_make_request(nullb->q, null_queue_bio); | 505 | blk_queue_make_request(nullb->q, null_queue_bio); |
| 510 | init_driver_queues(nullb); | 506 | rv = init_driver_queues(nullb); |
| 507 | if (rv) | ||
| 508 | goto out_cleanup_blk_queue; | ||
| 511 | } else { | 509 | } else { |
| 512 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); | 510 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); |
| 513 | if (!nullb->q) { | 511 | if (!nullb->q) { |
| @@ -516,7 +514,9 @@ static int null_add_dev(void) | |||
| 516 | } | 514 | } |
| 517 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); | 515 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); |
| 518 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); | 516 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); |
| 519 | init_driver_queues(nullb); | 517 | rv = init_driver_queues(nullb); |
| 518 | if (rv) | ||
| 519 | goto out_cleanup_blk_queue; | ||
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | nullb->q->queuedata = nullb; | 522 | nullb->q->queuedata = nullb; |
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 756b8ec00f16..0ebadf93b6c5 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c | |||
| @@ -69,8 +69,6 @@ struct vdc_port { | |||
| 69 | u8 vdisk_mtype; | 69 | u8 vdisk_mtype; |
| 70 | 70 | ||
| 71 | char disk_name[32]; | 71 | char disk_name[32]; |
| 72 | |||
| 73 | struct vio_disk_vtoc label; | ||
| 74 | }; | 72 | }; |
| 75 | 73 | ||
| 76 | static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) | 74 | static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) |
| @@ -710,13 +708,6 @@ static int probe_disk(struct vdc_port *port) | |||
| 710 | if (comp.err) | 708 | if (comp.err) |
| 711 | return comp.err; | 709 | return comp.err; |
| 712 | 710 | ||
| 713 | err = generic_request(port, VD_OP_GET_VTOC, | ||
| 714 | &port->label, sizeof(port->label)); | ||
| 715 | if (err < 0) { | ||
| 716 | printk(KERN_ERR PFX "VD_OP_GET_VTOC returns error %d\n", err); | ||
| 717 | return err; | ||
| 718 | } | ||
| 719 | |||
| 720 | if (vdc_version_supported(port, 1, 1)) { | 711 | if (vdc_version_supported(port, 1, 1)) { |
| 721 | /* vdisk_size should be set during the handshake, if it wasn't | 712 | /* vdisk_size should be set during the handshake, if it wasn't |
| 722 | * then the underlying disk is reserved by another system | 713 | * then the underlying disk is reserved by another system |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 0e63e8aa8279..2ad0b5bce44b 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -99,11 +99,12 @@ static ssize_t mem_used_total_show(struct device *dev, | |||
| 99 | { | 99 | { |
| 100 | u64 val = 0; | 100 | u64 val = 0; |
| 101 | struct zram *zram = dev_to_zram(dev); | 101 | struct zram *zram = dev_to_zram(dev); |
| 102 | struct zram_meta *meta = zram->meta; | ||
| 103 | 102 | ||
| 104 | down_read(&zram->init_lock); | 103 | down_read(&zram->init_lock); |
| 105 | if (init_done(zram)) | 104 | if (init_done(zram)) { |
| 105 | struct zram_meta *meta = zram->meta; | ||
| 106 | val = zs_get_total_pages(meta->mem_pool); | 106 | val = zs_get_total_pages(meta->mem_pool); |
| 107 | } | ||
| 107 | up_read(&zram->init_lock); | 108 | up_read(&zram->init_lock); |
| 108 | 109 | ||
| 109 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); | 110 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); |
| @@ -173,16 +174,17 @@ static ssize_t mem_used_max_store(struct device *dev, | |||
| 173 | int err; | 174 | int err; |
| 174 | unsigned long val; | 175 | unsigned long val; |
| 175 | struct zram *zram = dev_to_zram(dev); | 176 | struct zram *zram = dev_to_zram(dev); |
| 176 | struct zram_meta *meta = zram->meta; | ||
| 177 | 177 | ||
| 178 | err = kstrtoul(buf, 10, &val); | 178 | err = kstrtoul(buf, 10, &val); |
| 179 | if (err || val != 0) | 179 | if (err || val != 0) |
| 180 | return -EINVAL; | 180 | return -EINVAL; |
| 181 | 181 | ||
| 182 | down_read(&zram->init_lock); | 182 | down_read(&zram->init_lock); |
| 183 | if (init_done(zram)) | 183 | if (init_done(zram)) { |
| 184 | struct zram_meta *meta = zram->meta; | ||
| 184 | atomic_long_set(&zram->stats.max_used_pages, | 185 | atomic_long_set(&zram->stats.max_used_pages, |
| 185 | zs_get_total_pages(meta->mem_pool)); | 186 | zs_get_total_pages(meta->mem_pool)); |
| 187 | } | ||
| 186 | up_read(&zram->init_lock); | 188 | up_read(&zram->init_lock); |
| 187 | 189 | ||
| 188 | return len; | 190 | return len; |
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 2133f9d59d06..43005d4d3348 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
| @@ -660,11 +660,11 @@ static bool __init | |||
| 660 | arch_timer_probed(int type, const struct of_device_id *matches) | 660 | arch_timer_probed(int type, const struct of_device_id *matches) |
| 661 | { | 661 | { |
| 662 | struct device_node *dn; | 662 | struct device_node *dn; |
| 663 | bool probed = false; | 663 | bool probed = true; |
| 664 | 664 | ||
| 665 | dn = of_find_matching_node(NULL, matches); | 665 | dn = of_find_matching_node(NULL, matches); |
| 666 | if (dn && of_device_is_available(dn) && (arch_timers_present & type)) | 666 | if (dn && of_device_is_available(dn) && !(arch_timers_present & type)) |
| 667 | probed = true; | 667 | probed = false; |
| 668 | of_node_put(dn); | 668 | of_node_put(dn); |
| 669 | 669 | ||
| 670 | return probed; | 670 | return probed; |
diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c index df6575f1430d..682288ced4ac 100644 --- a/drivers/edac/cpc925_edac.c +++ b/drivers/edac/cpc925_edac.c | |||
| @@ -562,7 +562,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci) | |||
| 562 | 562 | ||
| 563 | if (apiexcp & UECC_EXCP_DETECTED) { | 563 | if (apiexcp & UECC_EXCP_DETECTED) { |
| 564 | cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n"); | 564 | cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n"); |
| 565 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, | 565 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, |
| 566 | pfn, offset, 0, | 566 | pfn, offset, 0, |
| 567 | csrow, -1, -1, | 567 | csrow, -1, -1, |
| 568 | mci->ctl_name, ""); | 568 | mci->ctl_name, ""); |
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c index 3cda79bc8b00..ece3aef16bb1 100644 --- a/drivers/edac/e7xxx_edac.c +++ b/drivers/edac/e7xxx_edac.c | |||
| @@ -226,7 +226,7 @@ static void process_ce(struct mem_ctl_info *mci, struct e7xxx_error_info *info) | |||
| 226 | static void process_ce_no_info(struct mem_ctl_info *mci) | 226 | static void process_ce_no_info(struct mem_ctl_info *mci) |
| 227 | { | 227 | { |
| 228 | edac_dbg(3, "\n"); | 228 | edac_dbg(3, "\n"); |
| 229 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, 0, 0, 0, -1, -1, -1, | 229 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, 0, 0, 0, -1, -1, -1, |
| 230 | "e7xxx CE log register overflow", ""); | 230 | "e7xxx CE log register overflow", ""); |
| 231 | } | 231 | } |
| 232 | 232 | ||
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c index 022a70273ada..aa98b136f5d0 100644 --- a/drivers/edac/i3200_edac.c +++ b/drivers/edac/i3200_edac.c | |||
| @@ -242,11 +242,11 @@ static void i3200_process_error_info(struct mem_ctl_info *mci, | |||
| 242 | -1, -1, | 242 | -1, -1, |
| 243 | "i3000 UE", ""); | 243 | "i3000 UE", ""); |
| 244 | } else if (log & I3200_ECCERRLOG_CE) { | 244 | } else if (log & I3200_ECCERRLOG_CE) { |
| 245 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, | 245 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, |
| 246 | 0, 0, eccerrlog_syndrome(log), | 246 | 0, 0, eccerrlog_syndrome(log), |
| 247 | eccerrlog_row(channel, log), | 247 | eccerrlog_row(channel, log), |
| 248 | -1, -1, | 248 | -1, -1, |
| 249 | "i3000 UE", ""); | 249 | "i3000 CE", ""); |
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | } | 252 | } |
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c index 3382f6344e42..4382343a7c60 100644 --- a/drivers/edac/i82860_edac.c +++ b/drivers/edac/i82860_edac.c | |||
| @@ -124,7 +124,7 @@ static int i82860_process_error_info(struct mem_ctl_info *mci, | |||
| 124 | dimm->location[0], dimm->location[1], -1, | 124 | dimm->location[0], dimm->location[1], -1, |
| 125 | "i82860 UE", ""); | 125 | "i82860 UE", ""); |
| 126 | else | 126 | else |
| 127 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, | 127 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, |
| 128 | info->eap, 0, info->derrsyn, | 128 | info->eap, 0, info->derrsyn, |
| 129 | dimm->location[0], dimm->location[1], -1, | 129 | dimm->location[0], dimm->location[1], -1, |
| 130 | "i82860 CE", ""); | 130 | "i82860 CE", ""); |
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 84c3cb15ccdd..8bf61d295ffd 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
| @@ -946,6 +946,12 @@ static const char *keys[KEY_MAX + 1] = { | |||
| 946 | [KEY_BRIGHTNESS_MIN] = "BrightnessMin", | 946 | [KEY_BRIGHTNESS_MIN] = "BrightnessMin", |
| 947 | [KEY_BRIGHTNESS_MAX] = "BrightnessMax", | 947 | [KEY_BRIGHTNESS_MAX] = "BrightnessMax", |
| 948 | [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", | 948 | [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", |
| 949 | [KEY_KBDINPUTASSIST_PREV] = "KbdInputAssistPrev", | ||
| 950 | [KEY_KBDINPUTASSIST_NEXT] = "KbdInputAssistNext", | ||
| 951 | [KEY_KBDINPUTASSIST_PREVGROUP] = "KbdInputAssistPrevGroup", | ||
| 952 | [KEY_KBDINPUTASSIST_NEXTGROUP] = "KbdInputAssistNextGroup", | ||
| 953 | [KEY_KBDINPUTASSIST_ACCEPT] = "KbdInputAssistAccept", | ||
| 954 | [KEY_KBDINPUTASSIST_CANCEL] = "KbdInputAssistCancel", | ||
| 949 | }; | 955 | }; |
| 950 | 956 | ||
| 951 | static const char *relatives[REL_MAX + 1] = { | 957 | static const char *relatives[REL_MAX + 1] = { |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index cd9c9e96cf0e..e23ab8b30626 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -298,6 +298,8 @@ | |||
| 298 | 298 | ||
| 299 | #define USB_VENDOR_ID_ELAN 0x04f3 | 299 | #define USB_VENDOR_ID_ELAN 0x04f3 |
| 300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 | 300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 |
| 301 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b | ||
| 302 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f | ||
| 301 | 303 | ||
| 302 | #define USB_VENDOR_ID_ELECOM 0x056e | 304 | #define USB_VENDOR_ID_ELECOM 0x056e |
| 303 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 | 305 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 2df7fddbd119..725f22ca47fc 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
| @@ -695,7 +695,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 695 | break; | 695 | break; |
| 696 | 696 | ||
| 697 | case 0x5b: /* TransducerSerialNumber */ | 697 | case 0x5b: /* TransducerSerialNumber */ |
| 698 | set_bit(MSC_SERIAL, input->mscbit); | 698 | usage->type = EV_MSC; |
| 699 | usage->code = MSC_SERIAL; | ||
| 700 | bit = input->mscbit; | ||
| 701 | max = MSC_MAX; | ||
| 699 | break; | 702 | break; |
| 700 | 703 | ||
| 701 | default: goto unknown; | 704 | default: goto unknown; |
| @@ -862,6 +865,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
| 862 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; | 865 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; |
| 863 | case 0x28c: map_key_clear(KEY_SEND); break; | 866 | case 0x28c: map_key_clear(KEY_SEND); break; |
| 864 | 867 | ||
| 868 | case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; | ||
| 869 | case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; | ||
| 870 | case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; | ||
| 871 | case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; | ||
| 872 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; | ||
| 873 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; | ||
| 874 | |||
| 865 | default: goto ignore; | 875 | default: goto ignore; |
| 866 | } | 876 | } |
| 867 | break; | 877 | break; |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index f3cb5b0a4345..5014bb567b29 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -71,6 +71,8 @@ static const struct hid_blacklist { | |||
| 71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, | 71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
| 72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
| 73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, | 73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, |
| 74 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, | ||
| 75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, | ||
| 74 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 76 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
| 75 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 77 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
| 76 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 78 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index bda5994ceb68..8b72cf392b34 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -1173,18 +1173,24 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, | |||
| 1173 | err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], | 1173 | err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], |
| 1174 | &mflow->reg_id[i]); | 1174 | &mflow->reg_id[i]); |
| 1175 | if (err) | 1175 | if (err) |
| 1176 | goto err_free; | 1176 | goto err_create_flow; |
| 1177 | i++; | 1177 | i++; |
| 1178 | } | 1178 | } |
| 1179 | 1179 | ||
| 1180 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { | 1180 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { |
| 1181 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); | 1181 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); |
| 1182 | if (err) | 1182 | if (err) |
| 1183 | goto err_free; | 1183 | goto err_create_flow; |
| 1184 | i++; | ||
| 1184 | } | 1185 | } |
| 1185 | 1186 | ||
| 1186 | return &mflow->ibflow; | 1187 | return &mflow->ibflow; |
| 1187 | 1188 | ||
| 1189 | err_create_flow: | ||
| 1190 | while (i) { | ||
| 1191 | (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, mflow->reg_id[i]); | ||
| 1192 | i--; | ||
| 1193 | } | ||
| 1188 | err_free: | 1194 | err_free: |
| 1189 | kfree(mflow); | 1195 | kfree(mflow); |
| 1190 | return ERR_PTR(err); | 1196 | return ERR_PTR(err); |
diff --git a/drivers/media/common/saa7146/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c index 97afee672d07..4418119cf707 100644 --- a/drivers/media/common/saa7146/saa7146_core.c +++ b/drivers/media/common/saa7146/saa7146_core.c | |||
| @@ -364,6 +364,9 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
| 364 | goto out; | 364 | goto out; |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | /* create a nice device name */ | ||
| 368 | sprintf(dev->name, "saa7146 (%d)", saa7146_num); | ||
| 369 | |||
| 367 | DEB_EE("pci:%p\n", pci); | 370 | DEB_EE("pci:%p\n", pci); |
| 368 | 371 | ||
| 369 | err = pci_enable_device(pci); | 372 | err = pci_enable_device(pci); |
| @@ -438,9 +441,6 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
| 438 | 441 | ||
| 439 | /* the rest + print status message */ | 442 | /* the rest + print status message */ |
| 440 | 443 | ||
| 441 | /* create a nice device name */ | ||
| 442 | sprintf(dev->name, "saa7146 (%d)", saa7146_num); | ||
| 443 | |||
| 444 | pr_info("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x)\n", | 444 | pr_info("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x)\n", |
| 445 | dev->mem, dev->revision, pci->irq, | 445 | dev->mem, dev->revision, pci->irq, |
| 446 | pci->subsystem_vendor, pci->subsystem_device); | 446 | pci->subsystem_vendor, pci->subsystem_device); |
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 13734b8c7917..4cb90317ff45 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c | |||
| @@ -1600,6 +1600,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
| 1600 | break; | 1600 | break; |
| 1601 | 1601 | ||
| 1602 | /* attach tuner */ | 1602 | /* attach tuner */ |
| 1603 | memset(&m88ts2022_config, 0, sizeof(m88ts2022_config)); | ||
| 1603 | m88ts2022_config.fe = fe0->dvb.frontend; | 1604 | m88ts2022_config.fe = fe0->dvb.frontend; |
| 1604 | m88ts2022_config.clock = 27000000; | 1605 | m88ts2022_config.clock = 27000000; |
| 1605 | memset(&info, 0, sizeof(struct i2c_board_info)); | 1606 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| @@ -1635,6 +1636,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
| 1635 | /* port c - terrestrial/cable */ | 1636 | /* port c - terrestrial/cable */ |
| 1636 | case 2: | 1637 | case 2: |
| 1637 | /* attach frontend */ | 1638 | /* attach frontend */ |
| 1639 | memset(&si2168_config, 0, sizeof(si2168_config)); | ||
| 1638 | si2168_config.i2c_adapter = &adapter; | 1640 | si2168_config.i2c_adapter = &adapter; |
| 1639 | si2168_config.fe = &fe0->dvb.frontend; | 1641 | si2168_config.fe = &fe0->dvb.frontend; |
| 1640 | si2168_config.ts_mode = SI2168_TS_SERIAL; | 1642 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
| @@ -1654,6 +1656,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
| 1654 | port->i2c_client_demod = client_demod; | 1656 | port->i2c_client_demod = client_demod; |
| 1655 | 1657 | ||
| 1656 | /* attach tuner */ | 1658 | /* attach tuner */ |
| 1659 | memset(&si2157_config, 0, sizeof(si2157_config)); | ||
| 1657 | si2157_config.fe = fe0->dvb.frontend; | 1660 | si2157_config.fe = fe0->dvb.frontend; |
| 1658 | memset(&info, 0, sizeof(struct i2c_board_info)); | 1661 | memset(&info, 0, sizeof(struct i2c_board_info)); |
| 1659 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); | 1662 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
diff --git a/drivers/media/pci/tw68/Kconfig b/drivers/media/pci/tw68/Kconfig index 5425ba1e320d..95d5d5202048 100644 --- a/drivers/media/pci/tw68/Kconfig +++ b/drivers/media/pci/tw68/Kconfig | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | config VIDEO_TW68 | 1 | config VIDEO_TW68 |
| 2 | tristate "Techwell tw68x Video For Linux" | 2 | tristate "Techwell tw68x Video For Linux" |
| 3 | depends on VIDEO_DEV && PCI && VIDEO_V4L2 | 3 | depends on VIDEO_DEV && PCI && VIDEO_V4L2 |
| 4 | select I2C_ALGOBIT | ||
| 5 | select VIDEOBUF2_DMA_SG | 4 | select VIDEOBUF2_DMA_SG |
| 6 | ---help--- | 5 | ---help--- |
| 7 | Support for Techwell tw68xx based frame grabber boards. | 6 | Support for Techwell tw68xx based frame grabber boards. |
diff --git a/drivers/media/pci/tw68/tw68-core.c b/drivers/media/pci/tw68/tw68-core.c index a6fb48cf7aae..63f0b64057cb 100644 --- a/drivers/media/pci/tw68/tw68-core.c +++ b/drivers/media/pci/tw68/tw68-core.c | |||
| @@ -306,7 +306,7 @@ static int tw68_initdev(struct pci_dev *pci_dev, | |||
| 306 | 306 | ||
| 307 | /* get irq */ | 307 | /* get irq */ |
| 308 | err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq, | 308 | err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq, |
| 309 | IRQF_SHARED | IRQF_DISABLED, dev->name, dev); | 309 | IRQF_SHARED, dev->name, dev); |
| 310 | if (err < 0) { | 310 | if (err < 0) { |
| 311 | pr_err("%s: can't get IRQ %d\n", | 311 | pr_err("%s: can't get IRQ %d\n", |
| 312 | dev->name, pci_dev->irq); | 312 | dev->name, pci_dev->irq); |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index bee9074ebc13..3aac88f1d54a 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
| @@ -166,7 +166,7 @@ config VIDEO_MEM2MEM_DEINTERLACE | |||
| 166 | config VIDEO_SAMSUNG_S5P_G2D | 166 | config VIDEO_SAMSUNG_S5P_G2D |
| 167 | tristate "Samsung S5P and EXYNOS4 G2D 2d graphics accelerator driver" | 167 | tristate "Samsung S5P and EXYNOS4 G2D 2d graphics accelerator driver" |
| 168 | depends on VIDEO_DEV && VIDEO_V4L2 | 168 | depends on VIDEO_DEV && VIDEO_V4L2 |
| 169 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 169 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
| 170 | depends on HAS_DMA | 170 | depends on HAS_DMA |
| 171 | select VIDEOBUF2_DMA_CONTIG | 171 | select VIDEOBUF2_DMA_CONTIG |
| 172 | select V4L2_MEM2MEM_DEV | 172 | select V4L2_MEM2MEM_DEV |
| @@ -178,7 +178,7 @@ config VIDEO_SAMSUNG_S5P_G2D | |||
| 178 | config VIDEO_SAMSUNG_S5P_JPEG | 178 | config VIDEO_SAMSUNG_S5P_JPEG |
| 179 | tristate "Samsung S5P/Exynos3250/Exynos4 JPEG codec driver" | 179 | tristate "Samsung S5P/Exynos3250/Exynos4 JPEG codec driver" |
| 180 | depends on VIDEO_DEV && VIDEO_V4L2 | 180 | depends on VIDEO_DEV && VIDEO_V4L2 |
| 181 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 181 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
| 182 | depends on HAS_DMA | 182 | depends on HAS_DMA |
| 183 | select VIDEOBUF2_DMA_CONTIG | 183 | select VIDEOBUF2_DMA_CONTIG |
| 184 | select V4L2_MEM2MEM_DEV | 184 | select V4L2_MEM2MEM_DEV |
| @@ -189,7 +189,7 @@ config VIDEO_SAMSUNG_S5P_JPEG | |||
| 189 | config VIDEO_SAMSUNG_S5P_MFC | 189 | config VIDEO_SAMSUNG_S5P_MFC |
| 190 | tristate "Samsung S5P MFC Video Codec" | 190 | tristate "Samsung S5P MFC Video Codec" |
| 191 | depends on VIDEO_DEV && VIDEO_V4L2 | 191 | depends on VIDEO_DEV && VIDEO_V4L2 |
| 192 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 192 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
| 193 | depends on HAS_DMA | 193 | depends on HAS_DMA |
| 194 | select VIDEOBUF2_DMA_CONTIG | 194 | select VIDEOBUF2_DMA_CONTIG |
| 195 | default n | 195 | default n |
diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index 77c951237744..b7b2e472240a 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | config VIDEO_SAMSUNG_EXYNOS4_IS | 2 | config VIDEO_SAMSUNG_EXYNOS4_IS |
| 3 | bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver" | 3 | bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver" |
| 4 | depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API | 4 | depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
| 5 | depends on (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST) | 5 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
| 6 | depends on OF && COMMON_CLK | 6 | depends on OF && COMMON_CLK |
| 7 | help | 7 | help |
| 8 | Say Y here to enable camera host interface devices for | 8 | Say Y here to enable camera host interface devices for |
diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c index b70fd996d794..aee92d908e49 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.c +++ b/drivers/media/platform/exynos4-is/fimc-core.c | |||
| @@ -832,6 +832,7 @@ err: | |||
| 832 | return -ENXIO; | 832 | return -ENXIO; |
| 833 | } | 833 | } |
| 834 | 834 | ||
| 835 | #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) | ||
| 835 | static int fimc_m2m_suspend(struct fimc_dev *fimc) | 836 | static int fimc_m2m_suspend(struct fimc_dev *fimc) |
| 836 | { | 837 | { |
| 837 | unsigned long flags; | 838 | unsigned long flags; |
| @@ -870,6 +871,7 @@ static int fimc_m2m_resume(struct fimc_dev *fimc) | |||
| 870 | 871 | ||
| 871 | return 0; | 872 | return 0; |
| 872 | } | 873 | } |
| 874 | #endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */ | ||
| 873 | 875 | ||
| 874 | static const struct of_device_id fimc_of_match[]; | 876 | static const struct of_device_id fimc_of_match[]; |
| 875 | 877 | ||
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index e525a7c8d885..6fcc7f072ace 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c | |||
| @@ -893,7 +893,7 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result, | |||
| 893 | unsigned long buffer, unsigned long size, | 893 | unsigned long buffer, unsigned long size, |
| 894 | struct s5p_jpeg_ctx *ctx) | 894 | struct s5p_jpeg_ctx *ctx) |
| 895 | { | 895 | { |
| 896 | int c, components, notfound; | 896 | int c, components = 0, notfound; |
| 897 | unsigned int height, width, word, subsampling = 0; | 897 | unsigned int height, width, word, subsampling = 0; |
| 898 | long length; | 898 | long length; |
| 899 | struct s5p_jpeg_buffer jpeg_buffer; | 899 | struct s5p_jpeg_buffer jpeg_buffer; |
| @@ -2632,6 +2632,7 @@ static int s5p_jpeg_remove(struct platform_device *pdev) | |||
| 2632 | return 0; | 2632 | return 0; |
| 2633 | } | 2633 | } |
| 2634 | 2634 | ||
| 2635 | #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) | ||
| 2635 | static int s5p_jpeg_runtime_suspend(struct device *dev) | 2636 | static int s5p_jpeg_runtime_suspend(struct device *dev) |
| 2636 | { | 2637 | { |
| 2637 | struct s5p_jpeg *jpeg = dev_get_drvdata(dev); | 2638 | struct s5p_jpeg *jpeg = dev_get_drvdata(dev); |
| @@ -2681,7 +2682,9 @@ static int s5p_jpeg_runtime_resume(struct device *dev) | |||
| 2681 | 2682 | ||
| 2682 | return 0; | 2683 | return 0; |
| 2683 | } | 2684 | } |
| 2685 | #endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */ | ||
| 2684 | 2686 | ||
| 2687 | #ifdef CONFIG_PM_SLEEP | ||
| 2685 | static int s5p_jpeg_suspend(struct device *dev) | 2688 | static int s5p_jpeg_suspend(struct device *dev) |
| 2686 | { | 2689 | { |
| 2687 | if (pm_runtime_suspended(dev)) | 2690 | if (pm_runtime_suspended(dev)) |
| @@ -2697,6 +2700,7 @@ static int s5p_jpeg_resume(struct device *dev) | |||
| 2697 | 2700 | ||
| 2698 | return s5p_jpeg_runtime_resume(dev); | 2701 | return s5p_jpeg_runtime_resume(dev); |
| 2699 | } | 2702 | } |
| 2703 | #endif | ||
| 2700 | 2704 | ||
| 2701 | static const struct dev_pm_ops s5p_jpeg_pm_ops = { | 2705 | static const struct dev_pm_ops s5p_jpeg_pm_ops = { |
| 2702 | SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume) | 2706 | SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume) |
diff --git a/drivers/media/platform/s5p-tv/Kconfig b/drivers/media/platform/s5p-tv/Kconfig index a9d56f8936b4..beb180e71ba0 100644 --- a/drivers/media/platform/s5p-tv/Kconfig +++ b/drivers/media/platform/s5p-tv/Kconfig | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | config VIDEO_SAMSUNG_S5P_TV | 9 | config VIDEO_SAMSUNG_S5P_TV |
| 10 | bool "Samsung TV driver for S5P platform" | 10 | bool "Samsung TV driver for S5P platform" |
| 11 | depends on PM_RUNTIME | 11 | depends on PM_RUNTIME |
| 12 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 12 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
| 13 | default n | 13 | default n |
| 14 | ---help--- | 14 | ---help--- |
| 15 | Say Y here to enable selecting the TV output devices for | 15 | Say Y here to enable selecting the TV output devices for |
diff --git a/drivers/media/platform/vivid/Kconfig b/drivers/media/platform/vivid/Kconfig index d71139a2ae00..c3090932f06d 100644 --- a/drivers/media/platform/vivid/Kconfig +++ b/drivers/media/platform/vivid/Kconfig | |||
| @@ -1,8 +1,11 @@ | |||
| 1 | config VIDEO_VIVID | 1 | config VIDEO_VIVID |
| 2 | tristate "Virtual Video Test Driver" | 2 | tristate "Virtual Video Test Driver" |
| 3 | depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 | 3 | depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 && FB |
| 4 | select FONT_SUPPORT | 4 | select FONT_SUPPORT |
| 5 | select FONT_8x16 | 5 | select FONT_8x16 |
| 6 | select FB_CFB_FILLRECT | ||
| 7 | select FB_CFB_COPYAREA | ||
| 8 | select FB_CFB_IMAGEBLIT | ||
| 6 | select VIDEOBUF2_VMALLOC | 9 | select VIDEOBUF2_VMALLOC |
| 7 | default n | 10 | default n |
| 8 | ---help--- | 11 | ---help--- |
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c index 0c6fa53fa646..cbcd6250e7b2 100644 --- a/drivers/media/platform/vivid/vivid-tpg.c +++ b/drivers/media/platform/vivid/vivid-tpg.c | |||
| @@ -136,7 +136,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) | |||
| 136 | tpg->black_line[plane] = vzalloc(max_w * pixelsz); | 136 | tpg->black_line[plane] = vzalloc(max_w * pixelsz); |
| 137 | if (!tpg->black_line[plane]) | 137 | if (!tpg->black_line[plane]) |
| 138 | return -ENOMEM; | 138 | return -ENOMEM; |
| 139 | tpg->random_line[plane] = vzalloc(max_w * pixelsz); | 139 | tpg->random_line[plane] = vzalloc(max_w * 2 * pixelsz); |
| 140 | if (!tpg->random_line[plane]) | 140 | if (!tpg->random_line[plane]) |
| 141 | return -ENOMEM; | 141 | return -ENOMEM; |
| 142 | } | 142 | } |
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index 6f28f6e02ea5..704397f3c106 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c | |||
| @@ -1256,7 +1256,7 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) | |||
| 1256 | fmerr("Unable to read firmware(%s) content\n", fw_name); | 1256 | fmerr("Unable to read firmware(%s) content\n", fw_name); |
| 1257 | return ret; | 1257 | return ret; |
| 1258 | } | 1258 | } |
| 1259 | fmdbg("Firmware(%s) length : %d bytes\n", fw_name, fw_entry->size); | 1259 | fmdbg("Firmware(%s) length : %zu bytes\n", fw_name, fw_entry->size); |
| 1260 | 1260 | ||
| 1261 | fw_data = (void *)fw_entry->data; | 1261 | fw_data = (void *)fw_entry->data; |
| 1262 | fw_len = fw_entry->size; | 1262 | fw_len = fw_entry->size; |
diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c index e44c8aba6074..803a0e63d47e 100644 --- a/drivers/media/tuners/xc5000.c +++ b/drivers/media/tuners/xc5000.c | |||
| @@ -1333,9 +1333,9 @@ static int xc5000_release(struct dvb_frontend *fe) | |||
| 1333 | 1333 | ||
| 1334 | if (priv) { | 1334 | if (priv) { |
| 1335 | cancel_delayed_work(&priv->timer_sleep); | 1335 | cancel_delayed_work(&priv->timer_sleep); |
| 1336 | hybrid_tuner_release_state(priv); | ||
| 1337 | if (priv->firmware) | 1336 | if (priv->firmware) |
| 1338 | release_firmware(priv->firmware); | 1337 | release_firmware(priv->firmware); |
| 1338 | hybrid_tuner_release_state(priv); | ||
| 1339 | } | 1339 | } |
| 1340 | 1340 | ||
| 1341 | mutex_unlock(&xc5000_list_mutex); | 1341 | mutex_unlock(&xc5000_list_mutex); |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 00758c83eec7..1896ab218b11 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
| @@ -193,8 +193,8 @@ static int af9035_wr_reg_mask(struct dvb_usb_device *d, u32 reg, u8 val, | |||
| 193 | return af9035_wr_regs(d, reg, &val, 1); | 193 | return af9035_wr_regs(d, reg, &val, 1); |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | static int af9035_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | 196 | static int af9035_add_i2c_dev(struct dvb_usb_device *d, const char *type, |
| 197 | void *platform_data, struct i2c_adapter *adapter) | 197 | u8 addr, void *platform_data, struct i2c_adapter *adapter) |
| 198 | { | 198 | { |
| 199 | int ret, num; | 199 | int ret, num; |
| 200 | struct state *state = d_to_priv(d); | 200 | struct state *state = d_to_priv(d); |
| @@ -221,7 +221,7 @@ static int af9035_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | |||
| 221 | goto err; | 221 | goto err; |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | request_module(board_info.type); | 224 | request_module("%s", board_info.type); |
| 225 | 225 | ||
| 226 | /* register I2C device */ | 226 | /* register I2C device */ |
| 227 | client = i2c_new_device(adapter, &board_info); | 227 | client = i2c_new_device(adapter, &board_info); |
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index d3c5f230e97a..ae917c042a52 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c | |||
| @@ -630,8 +630,8 @@ error: | |||
| 630 | return ret; | 630 | return ret; |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | static int anysee_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | 633 | static int anysee_add_i2c_dev(struct dvb_usb_device *d, const char *type, |
| 634 | void *platform_data) | 634 | u8 addr, void *platform_data) |
| 635 | { | 635 | { |
| 636 | int ret, num; | 636 | int ret, num; |
| 637 | struct anysee_state *state = d_to_priv(d); | 637 | struct anysee_state *state = d_to_priv(d); |
| @@ -659,7 +659,7 @@ static int anysee_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | |||
| 659 | goto err; | 659 | goto err; |
| 660 | } | 660 | } |
| 661 | 661 | ||
| 662 | request_module(board_info.type); | 662 | request_module("%s", board_info.type); |
| 663 | 663 | ||
| 664 | /* register I2C device */ | 664 | /* register I2C device */ |
| 665 | client = i2c_new_device(adapter, &board_info); | 665 | client = i2c_new_device(adapter, &board_info); |
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index b5e52fe7957a..901cf2b952d7 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c | |||
| @@ -504,7 +504,7 @@ EXPORT_SYMBOL_GPL(em28xx_audio_analog_set); | |||
| 504 | int em28xx_audio_setup(struct em28xx *dev) | 504 | int em28xx_audio_setup(struct em28xx *dev) |
| 505 | { | 505 | { |
| 506 | int vid1, vid2, feat, cfg; | 506 | int vid1, vid2, feat, cfg; |
| 507 | u32 vid; | 507 | u32 vid = 0; |
| 508 | u8 i2s_samplerates; | 508 | u8 i2s_samplerates; |
| 509 | 509 | ||
| 510 | if (dev->chip_id == CHIP_ID_EM2870 || | 510 | if (dev->chip_id == CHIP_ID_EM2870 || |
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 581f6dad4ca9..23f8f6afa2e0 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c | |||
| @@ -712,8 +712,10 @@ static int em28xx_ir_init(struct em28xx *dev) | |||
| 712 | em28xx_info("Registering input extension\n"); | 712 | em28xx_info("Registering input extension\n"); |
| 713 | 713 | ||
| 714 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); | 714 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
| 715 | if (!ir) | ||
| 716 | return -ENOMEM; | ||
| 715 | rc = rc_allocate_device(); | 717 | rc = rc_allocate_device(); |
| 716 | if (!ir || !rc) | 718 | if (!rc) |
| 717 | goto error; | 719 | goto error; |
| 718 | 720 | ||
| 719 | /* record handles to ourself */ | 721 | /* record handles to ourself */ |
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 328b5ba47a0a..fd1fa412e094 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c | |||
| @@ -932,7 +932,7 @@ static int hackrf_set_bandwidth(struct hackrf_dev *dev) | |||
| 932 | dev->bandwidth->val = bandwidth; | 932 | dev->bandwidth->val = bandwidth; |
| 933 | dev->bandwidth->cur.val = bandwidth; | 933 | dev->bandwidth->cur.val = bandwidth; |
| 934 | 934 | ||
| 935 | dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth_lut[i].freq); | 935 | dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth); |
| 936 | 936 | ||
| 937 | u16tmp = 0; | 937 | u16tmp = 0; |
| 938 | u16tmp |= ((bandwidth >> 0) & 0xff) << 0; | 938 | u16tmp |= ((bandwidth >> 0) & 0xff) << 0; |
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index 68bc9615660e..9bfa041e3316 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c | |||
| @@ -446,6 +446,7 @@ static int usbvision_v4l2_close(struct file *file) | |||
| 446 | if (usbvision->remove_pending) { | 446 | if (usbvision->remove_pending) { |
| 447 | printk(KERN_INFO "%s: Final disconnect\n", __func__); | 447 | printk(KERN_INFO "%s: Final disconnect\n", __func__); |
| 448 | usbvision_release(usbvision); | 448 | usbvision_release(usbvision); |
| 449 | return 0; | ||
| 449 | } | 450 | } |
| 450 | mutex_unlock(&usbvision->v4l2_lock); | 451 | mutex_unlock(&usbvision->v4l2_lock); |
| 451 | 452 | ||
| @@ -1221,6 +1222,7 @@ static int usbvision_radio_close(struct file *file) | |||
| 1221 | if (usbvision->remove_pending) { | 1222 | if (usbvision->remove_pending) { |
| 1222 | printk(KERN_INFO "%s: Final disconnect\n", __func__); | 1223 | printk(KERN_INFO "%s: Final disconnect\n", __func__); |
| 1223 | usbvision_release(usbvision); | 1224 | usbvision_release(usbvision); |
| 1225 | return err_code; | ||
| 1224 | } | 1226 | } |
| 1225 | 1227 | ||
| 1226 | mutex_unlock(&usbvision->v4l2_lock); | 1228 | mutex_unlock(&usbvision->v4l2_lock); |
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 60a8e2c3631e..378ae02e593b 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c | |||
| @@ -318,7 +318,6 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream, | |||
| 318 | stream->ctrl = probe; | 318 | stream->ctrl = probe; |
| 319 | stream->cur_format = format; | 319 | stream->cur_format = format; |
| 320 | stream->cur_frame = frame; | 320 | stream->cur_frame = frame; |
| 321 | stream->frame_size = fmt->fmt.pix.sizeimage; | ||
| 322 | 321 | ||
| 323 | done: | 322 | done: |
| 324 | mutex_unlock(&stream->mutex); | 323 | mutex_unlock(&stream->mutex); |
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 9ace520bb079..df81b9c4faf1 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c | |||
| @@ -1143,7 +1143,7 @@ static int uvc_video_encode_data(struct uvc_streaming *stream, | |||
| 1143 | static void uvc_video_validate_buffer(const struct uvc_streaming *stream, | 1143 | static void uvc_video_validate_buffer(const struct uvc_streaming *stream, |
| 1144 | struct uvc_buffer *buf) | 1144 | struct uvc_buffer *buf) |
| 1145 | { | 1145 | { |
| 1146 | if (stream->frame_size != buf->bytesused && | 1146 | if (stream->ctrl.dwMaxVideoFrameSize != buf->bytesused && |
| 1147 | !(stream->cur_format->flags & UVC_FMT_FLAG_COMPRESSED)) | 1147 | !(stream->cur_format->flags & UVC_FMT_FLAG_COMPRESSED)) |
| 1148 | buf->error = 1; | 1148 | buf->error = 1; |
| 1149 | } | 1149 | } |
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 6f676c29ec09..864ada740360 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h | |||
| @@ -457,7 +457,6 @@ struct uvc_streaming { | |||
| 457 | struct uvc_format *def_format; | 457 | struct uvc_format *def_format; |
| 458 | struct uvc_format *cur_format; | 458 | struct uvc_format *cur_format; |
| 459 | struct uvc_frame *cur_frame; | 459 | struct uvc_frame *cur_frame; |
| 460 | size_t frame_size; | ||
| 461 | 460 | ||
| 462 | /* Protect access to ctrl, cur_format, cur_frame and hardware video | 461 | /* Protect access to ctrl, cur_format, cur_frame and hardware video |
| 463 | * probe control. | 462 | * probe control. |
diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c b/drivers/media/v4l2-core/videobuf-dma-contig.c index bf80f0f7dfb8..e02353e340dd 100644 --- a/drivers/media/v4l2-core/videobuf-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c | |||
| @@ -305,6 +305,15 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
| 305 | /* Try to remap memory */ | 305 | /* Try to remap memory */ |
| 306 | size = vma->vm_end - vma->vm_start; | 306 | size = vma->vm_end - vma->vm_start; |
| 307 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 307 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| 308 | |||
| 309 | /* the "vm_pgoff" is just used in v4l2 to find the | ||
| 310 | * corresponding buffer data structure which is allocated | ||
| 311 | * earlier and it does not mean the offset from the physical | ||
| 312 | * buffer start address as usual. So set it to 0 to pass | ||
| 313 | * the sanity check in vm_iomap_memory(). | ||
| 314 | */ | ||
| 315 | vma->vm_pgoff = 0; | ||
| 316 | |||
| 308 | retval = vm_iomap_memory(vma, mem->dma_handle, size); | 317 | retval = vm_iomap_memory(vma, mem->dma_handle, size); |
| 309 | if (retval) { | 318 | if (retval) { |
| 310 | dev_err(q->dev, "mmap: remap failed with error %d. ", | 319 | dev_err(q->dev, "mmap: remap failed with error %d. ", |
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c index 69506ebd4d07..c99e896604ee 100644 --- a/drivers/misc/cxl/fault.c +++ b/drivers/misc/cxl/fault.c | |||
| @@ -21,60 +21,64 @@ | |||
| 21 | 21 | ||
| 22 | #include "cxl.h" | 22 | #include "cxl.h" |
| 23 | 23 | ||
| 24 | static struct cxl_sste* find_free_sste(struct cxl_sste *primary_group, | 24 | static bool sste_matches(struct cxl_sste *sste, struct copro_slb *slb) |
| 25 | bool sec_hash, | ||
| 26 | struct cxl_sste *secondary_group, | ||
| 27 | unsigned int *lru) | ||
| 28 | { | 25 | { |
| 29 | unsigned int i, entry; | 26 | return ((sste->vsid_data == cpu_to_be64(slb->vsid)) && |
| 30 | struct cxl_sste *sste, *group = primary_group; | 27 | (sste->esid_data == cpu_to_be64(slb->esid))); |
| 31 | 28 | } | |
| 32 | for (i = 0; i < 2; i++) { | 29 | |
| 33 | for (entry = 0; entry < 8; entry++) { | 30 | /* |
| 34 | sste = group + entry; | 31 | * This finds a free SSTE for the given SLB, or returns NULL if it's already in |
| 35 | if (!(be64_to_cpu(sste->esid_data) & SLB_ESID_V)) | 32 | * the segment table. |
| 36 | return sste; | 33 | */ |
| 37 | } | 34 | static struct cxl_sste* find_free_sste(struct cxl_context *ctx, |
| 38 | if (!sec_hash) | 35 | struct copro_slb *slb) |
| 39 | break; | 36 | { |
| 40 | group = secondary_group; | 37 | struct cxl_sste *primary, *sste, *ret = NULL; |
| 38 | unsigned int mask = (ctx->sst_size >> 7) - 1; /* SSTP0[SegTableSize] */ | ||
| 39 | unsigned int entry; | ||
| 40 | unsigned int hash; | ||
| 41 | |||
| 42 | if (slb->vsid & SLB_VSID_B_1T) | ||
| 43 | hash = (slb->esid >> SID_SHIFT_1T) & mask; | ||
| 44 | else /* 256M */ | ||
| 45 | hash = (slb->esid >> SID_SHIFT) & mask; | ||
| 46 | |||
| 47 | primary = ctx->sstp + (hash << 3); | ||
| 48 | |||
| 49 | for (entry = 0, sste = primary; entry < 8; entry++, sste++) { | ||
| 50 | if (!ret && !(be64_to_cpu(sste->esid_data) & SLB_ESID_V)) | ||
| 51 | ret = sste; | ||
| 52 | if (sste_matches(sste, slb)) | ||
| 53 | return NULL; | ||
| 41 | } | 54 | } |
| 55 | if (ret) | ||
| 56 | return ret; | ||
| 57 | |||
| 42 | /* Nothing free, select an entry to cast out */ | 58 | /* Nothing free, select an entry to cast out */ |
| 43 | if (sec_hash && (*lru & 0x8)) | 59 | ret = primary + ctx->sst_lru; |
| 44 | sste = secondary_group + (*lru & 0x7); | 60 | ctx->sst_lru = (ctx->sst_lru + 1) & 0x7; |
| 45 | else | ||
| 46 | sste = primary_group + (*lru & 0x7); | ||
| 47 | *lru = (*lru + 1) & 0xf; | ||
| 48 | 61 | ||
| 49 | return sste; | 62 | return ret; |
| 50 | } | 63 | } |
| 51 | 64 | ||
| 52 | static void cxl_load_segment(struct cxl_context *ctx, struct copro_slb *slb) | 65 | static void cxl_load_segment(struct cxl_context *ctx, struct copro_slb *slb) |
| 53 | { | 66 | { |
| 54 | /* mask is the group index, we search primary and secondary here. */ | 67 | /* mask is the group index, we search primary and secondary here. */ |
| 55 | unsigned int mask = (ctx->sst_size >> 7)-1; /* SSTP0[SegTableSize] */ | ||
| 56 | bool sec_hash = 1; | ||
| 57 | struct cxl_sste *sste; | 68 | struct cxl_sste *sste; |
| 58 | unsigned int hash; | ||
| 59 | unsigned long flags; | 69 | unsigned long flags; |
| 60 | 70 | ||
| 61 | |||
| 62 | sec_hash = !!(cxl_p1n_read(ctx->afu, CXL_PSL_SR_An) & CXL_PSL_SR_An_SC); | ||
| 63 | |||
| 64 | if (slb->vsid & SLB_VSID_B_1T) | ||
| 65 | hash = (slb->esid >> SID_SHIFT_1T) & mask; | ||
| 66 | else /* 256M */ | ||
| 67 | hash = (slb->esid >> SID_SHIFT) & mask; | ||
| 68 | |||
| 69 | spin_lock_irqsave(&ctx->sste_lock, flags); | 71 | spin_lock_irqsave(&ctx->sste_lock, flags); |
| 70 | sste = find_free_sste(ctx->sstp + (hash << 3), sec_hash, | 72 | sste = find_free_sste(ctx, slb); |
| 71 | ctx->sstp + ((~hash & mask) << 3), &ctx->sst_lru); | 73 | if (!sste) |
| 74 | goto out_unlock; | ||
| 72 | 75 | ||
| 73 | pr_devel("CXL Populating SST[%li]: %#llx %#llx\n", | 76 | pr_devel("CXL Populating SST[%li]: %#llx %#llx\n", |
| 74 | sste - ctx->sstp, slb->vsid, slb->esid); | 77 | sste - ctx->sstp, slb->vsid, slb->esid); |
| 75 | 78 | ||
| 76 | sste->vsid_data = cpu_to_be64(slb->vsid); | 79 | sste->vsid_data = cpu_to_be64(slb->vsid); |
| 77 | sste->esid_data = cpu_to_be64(slb->esid); | 80 | sste->esid_data = cpu_to_be64(slb->esid); |
| 81 | out_unlock: | ||
| 78 | spin_unlock_irqrestore(&ctx->sste_lock, flags); | 82 | spin_unlock_irqrestore(&ctx->sste_lock, flags); |
| 79 | } | 83 | } |
| 80 | 84 | ||
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c index 623286a77114..d47532e8f4f1 100644 --- a/drivers/misc/cxl/native.c +++ b/drivers/misc/cxl/native.c | |||
| @@ -417,7 +417,7 @@ static int attach_afu_directed(struct cxl_context *ctx, u64 wed, u64 amr) | |||
| 417 | ctx->elem->haurp = 0; /* disable */ | 417 | ctx->elem->haurp = 0; /* disable */ |
| 418 | ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1)); | 418 | ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1)); |
| 419 | 419 | ||
| 420 | sr = CXL_PSL_SR_An_SC; | 420 | sr = 0; |
| 421 | if (ctx->master) | 421 | if (ctx->master) |
| 422 | sr |= CXL_PSL_SR_An_MP; | 422 | sr |= CXL_PSL_SR_An_MP; |
| 423 | if (mfspr(SPRN_LPCR) & LPCR_TC) | 423 | if (mfspr(SPRN_LPCR) & LPCR_TC) |
| @@ -508,7 +508,7 @@ static int attach_dedicated(struct cxl_context *ctx, u64 wed, u64 amr) | |||
| 508 | u64 sr; | 508 | u64 sr; |
| 509 | int rc; | 509 | int rc; |
| 510 | 510 | ||
| 511 | sr = CXL_PSL_SR_An_SC; | 511 | sr = 0; |
| 512 | set_endian(sr); | 512 | set_endian(sr); |
| 513 | if (ctx->master) | 513 | if (ctx->master) |
| 514 | sr |= CXL_PSL_SR_An_MP; | 514 | sr |= CXL_PSL_SR_An_MP; |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 4706386b7d34..f9009be3f307 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -135,6 +135,7 @@ config MACVLAN | |||
| 135 | config MACVTAP | 135 | config MACVTAP |
| 136 | tristate "MAC-VLAN based tap driver" | 136 | tristate "MAC-VLAN based tap driver" |
| 137 | depends on MACVLAN | 137 | depends on MACVLAN |
| 138 | depends on INET | ||
| 138 | help | 139 | help |
| 139 | This adds a specialized tap character device driver that is based | 140 | This adds a specialized tap character device driver that is based |
| 140 | on the MAC-VLAN network interface, called macvtap. A macvtap device | 141 | on the MAC-VLAN network interface, called macvtap. A macvtap device |
| @@ -200,6 +201,7 @@ config RIONET_RX_SIZE | |||
| 200 | 201 | ||
| 201 | config TUN | 202 | config TUN |
| 202 | tristate "Universal TUN/TAP device driver support" | 203 | tristate "Universal TUN/TAP device driver support" |
| 204 | depends on INET | ||
| 203 | select CRC32 | 205 | select CRC32 |
| 204 | ---help--- | 206 | ---help--- |
| 205 | TUN/TAP provides packet reception and transmission for user space | 207 | TUN/TAP provides packet reception and transmission for user space |
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c index 1020a7af67cf..78d8e876f3aa 100644 --- a/drivers/net/dsa/mv88e6171.c +++ b/drivers/net/dsa/mv88e6171.c | |||
| @@ -395,7 +395,7 @@ static int mv88e6171_get_sset_count(struct dsa_switch *ds) | |||
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | struct dsa_switch_driver mv88e6171_switch_driver = { | 397 | struct dsa_switch_driver mv88e6171_switch_driver = { |
| 398 | .tag_protocol = DSA_TAG_PROTO_DSA, | 398 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
| 399 | .priv_size = sizeof(struct mv88e6xxx_priv_state), | 399 | .priv_size = sizeof(struct mv88e6xxx_priv_state), |
| 400 | .probe = mv88e6171_probe, | 400 | .probe = mv88e6171_probe, |
| 401 | .setup = mv88e6171_setup, | 401 | .setup = mv88e6171_setup, |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 29554992215a..2349ea970255 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
| @@ -1465,7 +1465,7 @@ static int xgbe_set_features(struct net_device *netdev, | |||
| 1465 | { | 1465 | { |
| 1466 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 1466 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
| 1467 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 1467 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
| 1468 | unsigned int rxcsum, rxvlan, rxvlan_filter; | 1468 | netdev_features_t rxcsum, rxvlan, rxvlan_filter; |
| 1469 | 1469 | ||
| 1470 | rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; | 1470 | rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; |
| 1471 | rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; | 1471 | rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; |
| @@ -1598,7 +1598,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) | |||
| 1598 | struct skb_shared_hwtstamps *hwtstamps; | 1598 | struct skb_shared_hwtstamps *hwtstamps; |
| 1599 | unsigned int incomplete, error, context_next, context; | 1599 | unsigned int incomplete, error, context_next, context; |
| 1600 | unsigned int len, put_len, max_len; | 1600 | unsigned int len, put_len, max_len; |
| 1601 | int received = 0; | 1601 | unsigned int received = 0; |
| 1602 | int packet_count = 0; | ||
| 1602 | 1603 | ||
| 1603 | DBGPR("-->xgbe_rx_poll: budget=%d\n", budget); | 1604 | DBGPR("-->xgbe_rx_poll: budget=%d\n", budget); |
| 1604 | 1605 | ||
| @@ -1608,7 +1609,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) | |||
| 1608 | 1609 | ||
| 1609 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); | 1610 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); |
| 1610 | packet = &ring->packet_data; | 1611 | packet = &ring->packet_data; |
| 1611 | while (received < budget) { | 1612 | while (packet_count < budget) { |
| 1612 | DBGPR(" cur = %d\n", ring->cur); | 1613 | DBGPR(" cur = %d\n", ring->cur); |
| 1613 | 1614 | ||
| 1614 | /* First time in loop see if we need to restore state */ | 1615 | /* First time in loop see if we need to restore state */ |
| @@ -1662,7 +1663,7 @@ read_again: | |||
| 1662 | if (packet->errors) | 1663 | if (packet->errors) |
| 1663 | DBGPR("Error in received packet\n"); | 1664 | DBGPR("Error in received packet\n"); |
| 1664 | dev_kfree_skb(skb); | 1665 | dev_kfree_skb(skb); |
| 1665 | continue; | 1666 | goto next_packet; |
| 1666 | } | 1667 | } |
| 1667 | 1668 | ||
| 1668 | if (!context) { | 1669 | if (!context) { |
| @@ -1677,7 +1678,7 @@ read_again: | |||
| 1677 | } | 1678 | } |
| 1678 | 1679 | ||
| 1679 | dev_kfree_skb(skb); | 1680 | dev_kfree_skb(skb); |
| 1680 | continue; | 1681 | goto next_packet; |
| 1681 | } | 1682 | } |
| 1682 | memcpy(skb_tail_pointer(skb), rdata->skb->data, | 1683 | memcpy(skb_tail_pointer(skb), rdata->skb->data, |
| 1683 | put_len); | 1684 | put_len); |
| @@ -1694,7 +1695,7 @@ read_again: | |||
| 1694 | 1695 | ||
| 1695 | /* Stray Context Descriptor? */ | 1696 | /* Stray Context Descriptor? */ |
| 1696 | if (!skb) | 1697 | if (!skb) |
| 1697 | continue; | 1698 | goto next_packet; |
| 1698 | 1699 | ||
| 1699 | /* Be sure we don't exceed the configured MTU */ | 1700 | /* Be sure we don't exceed the configured MTU */ |
| 1700 | max_len = netdev->mtu + ETH_HLEN; | 1701 | max_len = netdev->mtu + ETH_HLEN; |
| @@ -1705,7 +1706,7 @@ read_again: | |||
| 1705 | if (skb->len > max_len) { | 1706 | if (skb->len > max_len) { |
| 1706 | DBGPR("packet length exceeds configured MTU\n"); | 1707 | DBGPR("packet length exceeds configured MTU\n"); |
| 1707 | dev_kfree_skb(skb); | 1708 | dev_kfree_skb(skb); |
| 1708 | continue; | 1709 | goto next_packet; |
| 1709 | } | 1710 | } |
| 1710 | 1711 | ||
| 1711 | #ifdef XGMAC_ENABLE_RX_PKT_DUMP | 1712 | #ifdef XGMAC_ENABLE_RX_PKT_DUMP |
| @@ -1739,6 +1740,9 @@ read_again: | |||
| 1739 | 1740 | ||
| 1740 | netdev->last_rx = jiffies; | 1741 | netdev->last_rx = jiffies; |
| 1741 | napi_gro_receive(&pdata->napi, skb); | 1742 | napi_gro_receive(&pdata->napi, skb); |
| 1743 | |||
| 1744 | next_packet: | ||
| 1745 | packet_count++; | ||
| 1742 | } | 1746 | } |
| 1743 | 1747 | ||
| 1744 | /* Check if we need to save state before leaving */ | 1748 | /* Check if we need to save state before leaving */ |
| @@ -1752,9 +1756,9 @@ read_again: | |||
| 1752 | rdata->state.error = error; | 1756 | rdata->state.error = error; |
| 1753 | } | 1757 | } |
| 1754 | 1758 | ||
| 1755 | DBGPR("<--xgbe_rx_poll: received = %d\n", received); | 1759 | DBGPR("<--xgbe_rx_poll: packet_count = %d\n", packet_count); |
| 1756 | 1760 | ||
| 1757 | return received; | 1761 | return packet_count; |
| 1758 | } | 1762 | } |
| 1759 | 1763 | ||
| 1760 | static int xgbe_poll(struct napi_struct *napi, int budget) | 1764 | static int xgbe_poll(struct napi_struct *napi, int budget) |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c index e6d24c210198..c22f32622fa9 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | |||
| @@ -124,20 +124,18 @@ static int xgene_enet_ecc_init(struct xgene_enet_pdata *p) | |||
| 124 | { | 124 | { |
| 125 | struct net_device *ndev = p->ndev; | 125 | struct net_device *ndev = p->ndev; |
| 126 | u32 data; | 126 | u32 data; |
| 127 | int i; | 127 | int i = 0; |
| 128 | 128 | ||
| 129 | xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0); | 129 | xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0); |
| 130 | for (i = 0; i < 10 && data != ~0U ; i++) { | 130 | do { |
| 131 | usleep_range(100, 110); | 131 | usleep_range(100, 110); |
| 132 | data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR); | 132 | data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR); |
| 133 | } | 133 | if (data == ~0U) |
| 134 | return 0; | ||
| 135 | } while (++i < 10); | ||
| 134 | 136 | ||
| 135 | if (data != ~0U) { | 137 | netdev_err(ndev, "Failed to release memory from shutdown\n"); |
| 136 | netdev_err(ndev, "Failed to release memory from shutdown\n"); | 138 | return -ENODEV; |
| 137 | return -ENODEV; | ||
| 138 | } | ||
| 139 | |||
| 140 | return 0; | ||
| 141 | } | 139 | } |
| 142 | 140 | ||
| 143 | static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p) | 141 | static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p) |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 9ae36979bdee..3a6778a667f4 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
| @@ -1397,6 +1397,9 @@ static void bcm_sysport_netif_start(struct net_device *dev) | |||
| 1397 | /* Enable NAPI */ | 1397 | /* Enable NAPI */ |
| 1398 | napi_enable(&priv->napi); | 1398 | napi_enable(&priv->napi); |
| 1399 | 1399 | ||
| 1400 | /* Enable RX interrupt and TX ring full interrupt */ | ||
| 1401 | intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); | ||
| 1402 | |||
| 1400 | phy_start(priv->phydev); | 1403 | phy_start(priv->phydev); |
| 1401 | 1404 | ||
| 1402 | /* Enable TX interrupts for the 32 TXQs */ | 1405 | /* Enable TX interrupts for the 32 TXQs */ |
| @@ -1499,9 +1502,6 @@ static int bcm_sysport_open(struct net_device *dev) | |||
| 1499 | if (ret) | 1502 | if (ret) |
| 1500 | goto out_free_rx_ring; | 1503 | goto out_free_rx_ring; |
| 1501 | 1504 | ||
| 1502 | /* Enable RX interrupt and TX ring full interrupt */ | ||
| 1503 | intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); | ||
| 1504 | |||
| 1505 | /* Turn on TDMA */ | 1505 | /* Turn on TDMA */ |
| 1506 | ret = tdma_enable_set(priv, 1); | 1506 | ret = tdma_enable_set(priv, 1); |
| 1507 | if (ret) | 1507 | if (ret) |
| @@ -1858,6 +1858,8 @@ static int bcm_sysport_resume(struct device *d) | |||
| 1858 | if (!netif_running(dev)) | 1858 | if (!netif_running(dev)) |
| 1859 | return 0; | 1859 | return 0; |
| 1860 | 1860 | ||
| 1861 | umac_reset(priv); | ||
| 1862 | |||
| 1861 | /* We may have been suspended and never received a WOL event that | 1863 | /* We may have been suspended and never received a WOL event that |
| 1862 | * would turn off MPD detection, take care of that now | 1864 | * would turn off MPD detection, take care of that now |
| 1863 | */ | 1865 | */ |
| @@ -1885,9 +1887,6 @@ static int bcm_sysport_resume(struct device *d) | |||
| 1885 | 1887 | ||
| 1886 | netif_device_attach(dev); | 1888 | netif_device_attach(dev); |
| 1887 | 1889 | ||
| 1888 | /* Enable RX interrupt and TX ring full interrupt */ | ||
| 1889 | intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); | ||
| 1890 | |||
| 1891 | /* RX pipe enable */ | 1890 | /* RX pipe enable */ |
| 1892 | topctrl_writel(priv, 0, RX_FLUSH_CNTL); | 1891 | topctrl_writel(priv, 0, RX_FLUSH_CNTL); |
| 1893 | 1892 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 23f23c97c2ad..f05fab65d78a 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
| @@ -382,10 +382,8 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type, | |||
| 382 | if (l5_cid >= MAX_CM_SK_TBL_SZ) | 382 | if (l5_cid >= MAX_CM_SK_TBL_SZ) |
| 383 | break; | 383 | break; |
| 384 | 384 | ||
| 385 | rcu_read_lock(); | ||
| 386 | if (!rcu_access_pointer(cp->ulp_ops[CNIC_ULP_L4])) { | 385 | if (!rcu_access_pointer(cp->ulp_ops[CNIC_ULP_L4])) { |
| 387 | rc = -ENODEV; | 386 | rc = -ENODEV; |
| 388 | rcu_read_unlock(); | ||
| 389 | break; | 387 | break; |
| 390 | } | 388 | } |
| 391 | csk = &cp->csk_tbl[l5_cid]; | 389 | csk = &cp->csk_tbl[l5_cid]; |
| @@ -414,7 +412,6 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type, | |||
| 414 | } | 412 | } |
| 415 | } | 413 | } |
| 416 | csk_put(csk); | 414 | csk_put(csk); |
| 417 | rcu_read_unlock(); | ||
| 418 | rc = 0; | 415 | rc = 0; |
| 419 | } | 416 | } |
| 420 | } | 417 | } |
| @@ -615,7 +612,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) | |||
| 615 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | 612 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); |
| 616 | 613 | ||
| 617 | mutex_lock(&cnic_lock); | 614 | mutex_lock(&cnic_lock); |
| 618 | if (rcu_dereference(cp->ulp_ops[ulp_type])) { | 615 | if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { |
| 619 | RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL); | 616 | RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL); |
| 620 | cnic_put(dev); | 617 | cnic_put(dev); |
| 621 | } else { | 618 | } else { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c index 8edf0f5bd679..6fe300e316c3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | |||
| @@ -60,6 +60,42 @@ void cxgb4_dcb_version_init(struct net_device *dev) | |||
| 60 | dcb->dcb_version = FW_PORT_DCB_VER_AUTO; | 60 | dcb->dcb_version = FW_PORT_DCB_VER_AUTO; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | static void cxgb4_dcb_cleanup_apps(struct net_device *dev) | ||
| 64 | { | ||
| 65 | struct port_info *pi = netdev2pinfo(dev); | ||
| 66 | struct adapter *adap = pi->adapter; | ||
| 67 | struct port_dcb_info *dcb = &pi->dcb; | ||
| 68 | struct dcb_app app; | ||
| 69 | int i, err; | ||
| 70 | |||
| 71 | /* zero priority implies remove */ | ||
| 72 | app.priority = 0; | ||
| 73 | |||
| 74 | for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) { | ||
| 75 | /* Check if app list is exhausted */ | ||
| 76 | if (!dcb->app_priority[i].protocolid) | ||
| 77 | break; | ||
| 78 | |||
| 79 | app.protocol = dcb->app_priority[i].protocolid; | ||
| 80 | |||
| 81 | if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { | ||
| 82 | app.selector = dcb->app_priority[i].sel_field + 1; | ||
| 83 | err = dcb_ieee_setapp(dev, &app); | ||
| 84 | } else { | ||
| 85 | app.selector = !!(dcb->app_priority[i].sel_field); | ||
| 86 | err = dcb_setapp(dev, &app); | ||
| 87 | } | ||
| 88 | |||
| 89 | if (err) { | ||
| 90 | dev_err(adap->pdev_dev, | ||
| 91 | "Failed DCB Clear %s Application Priority: sel=%d, prot=%d, , err=%d\n", | ||
| 92 | dcb_ver_array[dcb->dcb_version], app.selector, | ||
| 93 | app.protocol, -err); | ||
| 94 | break; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 63 | /* Finite State machine for Data Center Bridging. | 99 | /* Finite State machine for Data Center Bridging. |
| 64 | */ | 100 | */ |
| 65 | void cxgb4_dcb_state_fsm(struct net_device *dev, | 101 | void cxgb4_dcb_state_fsm(struct net_device *dev, |
| @@ -80,7 +116,6 @@ void cxgb4_dcb_state_fsm(struct net_device *dev, | |||
| 80 | /* we're going to use Host DCB */ | 116 | /* we're going to use Host DCB */ |
| 81 | dcb->state = CXGB4_DCB_STATE_HOST; | 117 | dcb->state = CXGB4_DCB_STATE_HOST; |
| 82 | dcb->supported = CXGB4_DCBX_HOST_SUPPORT; | 118 | dcb->supported = CXGB4_DCBX_HOST_SUPPORT; |
| 83 | dcb->enabled = 1; | ||
| 84 | break; | 119 | break; |
| 85 | } | 120 | } |
| 86 | 121 | ||
| @@ -145,6 +180,7 @@ void cxgb4_dcb_state_fsm(struct net_device *dev, | |||
| 145 | * state. We need to reset back to a ground state | 180 | * state. We need to reset back to a ground state |
| 146 | * of incomplete. | 181 | * of incomplete. |
| 147 | */ | 182 | */ |
| 183 | cxgb4_dcb_cleanup_apps(dev); | ||
| 148 | cxgb4_dcb_state_init(dev); | 184 | cxgb4_dcb_state_init(dev); |
| 149 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; | 185 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; |
| 150 | dcb->supported = CXGB4_DCBX_FW_SUPPORT; | 186 | dcb->supported = CXGB4_DCBX_FW_SUPPORT; |
| @@ -349,6 +385,12 @@ static u8 cxgb4_setstate(struct net_device *dev, u8 enabled) | |||
| 349 | { | 385 | { |
| 350 | struct port_info *pi = netdev2pinfo(dev); | 386 | struct port_info *pi = netdev2pinfo(dev); |
| 351 | 387 | ||
| 388 | /* If DCBx is host-managed, dcb is enabled by outside lldp agents */ | ||
| 389 | if (pi->dcb.state == CXGB4_DCB_STATE_HOST) { | ||
| 390 | pi->dcb.enabled = enabled; | ||
| 391 | return 0; | ||
| 392 | } | ||
| 393 | |||
| 352 | /* Firmware doesn't provide any mechanism to control the DCB state. | 394 | /* Firmware doesn't provide any mechanism to control the DCB state. |
| 353 | */ | 395 | */ |
| 354 | if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED)) | 396 | if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED)) |
| @@ -833,11 +875,16 @@ static int cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id, | |||
| 833 | 875 | ||
| 834 | /* Return whether IEEE Data Center Bridging has been negotiated. | 876 | /* Return whether IEEE Data Center Bridging has been negotiated. |
| 835 | */ | 877 | */ |
| 836 | static inline int cxgb4_ieee_negotiation_complete(struct net_device *dev) | 878 | static inline int |
| 879 | cxgb4_ieee_negotiation_complete(struct net_device *dev, | ||
| 880 | enum cxgb4_dcb_fw_msgs dcb_subtype) | ||
| 837 | { | 881 | { |
| 838 | struct port_info *pi = netdev2pinfo(dev); | 882 | struct port_info *pi = netdev2pinfo(dev); |
| 839 | struct port_dcb_info *dcb = &pi->dcb; | 883 | struct port_dcb_info *dcb = &pi->dcb; |
| 840 | 884 | ||
| 885 | if (dcb_subtype && !(dcb->msgs & dcb_subtype)) | ||
| 886 | return 0; | ||
| 887 | |||
| 841 | return (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED && | 888 | return (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED && |
| 842 | (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); | 889 | (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); |
| 843 | } | 890 | } |
| @@ -850,7 +897,7 @@ static int cxgb4_ieee_getapp(struct net_device *dev, struct dcb_app *app) | |||
| 850 | { | 897 | { |
| 851 | int prio; | 898 | int prio; |
| 852 | 899 | ||
| 853 | if (!cxgb4_ieee_negotiation_complete(dev)) | 900 | if (!cxgb4_ieee_negotiation_complete(dev, CXGB4_DCB_FW_APP_ID)) |
| 854 | return -EINVAL; | 901 | return -EINVAL; |
| 855 | if (!(app->selector && app->protocol)) | 902 | if (!(app->selector && app->protocol)) |
| 856 | return -EINVAL; | 903 | return -EINVAL; |
| @@ -872,7 +919,7 @@ static int cxgb4_ieee_setapp(struct net_device *dev, struct dcb_app *app) | |||
| 872 | { | 919 | { |
| 873 | int ret; | 920 | int ret; |
| 874 | 921 | ||
| 875 | if (!cxgb4_ieee_negotiation_complete(dev)) | 922 | if (!cxgb4_ieee_negotiation_complete(dev, CXGB4_DCB_FW_APP_ID)) |
| 876 | return -EINVAL; | 923 | return -EINVAL; |
| 877 | if (!(app->selector && app->protocol)) | 924 | if (!(app->selector && app->protocol)) |
| 878 | return -EINVAL; | 925 | return -EINVAL; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 3f60070f2519..8520d5529df8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
| @@ -694,7 +694,11 @@ int cxgb4_dcb_enabled(const struct net_device *dev) | |||
| 694 | #ifdef CONFIG_CHELSIO_T4_DCB | 694 | #ifdef CONFIG_CHELSIO_T4_DCB |
| 695 | struct port_info *pi = netdev_priv(dev); | 695 | struct port_info *pi = netdev_priv(dev); |
| 696 | 696 | ||
| 697 | return pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED; | 697 | if (!pi->dcb.enabled) |
| 698 | return 0; | ||
| 699 | |||
| 700 | return ((pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED) || | ||
| 701 | (pi->dcb.state == CXGB4_DCB_STATE_HOST)); | ||
| 698 | #else | 702 | #else |
| 699 | return 0; | 703 | return 0; |
| 700 | #endif | 704 | #endif |
| @@ -6610,6 +6614,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 6610 | 6614 | ||
| 6611 | spin_lock_init(&adapter->stats_lock); | 6615 | spin_lock_init(&adapter->stats_lock); |
| 6612 | spin_lock_init(&adapter->tid_release_lock); | 6616 | spin_lock_init(&adapter->tid_release_lock); |
| 6617 | spin_lock_init(&adapter->win0_lock); | ||
| 6613 | 6618 | ||
| 6614 | INIT_WORK(&adapter->tid_release_task, process_tid_release_list); | 6619 | INIT_WORK(&adapter->tid_release_task, process_tid_release_list); |
| 6615 | INIT_WORK(&adapter->db_full_task, process_db_full); | 6620 | INIT_WORK(&adapter->db_full_task, process_db_full); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index bfa398d91826..0b42bddaf284 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | |||
| @@ -2929,14 +2929,14 @@ static const struct pci_device_id cxgb4vf_pci_tbl[] = { | |||
| 2929 | CH_DEVICE(0x480d), /* T480-cr */ | 2929 | CH_DEVICE(0x480d), /* T480-cr */ |
| 2930 | CH_DEVICE(0x480e), /* T440-lp-cr */ | 2930 | CH_DEVICE(0x480e), /* T440-lp-cr */ |
| 2931 | CH_DEVICE(0x4880), | 2931 | CH_DEVICE(0x4880), |
| 2932 | CH_DEVICE(0x4880), | 2932 | CH_DEVICE(0x4881), |
| 2933 | CH_DEVICE(0x4880), | 2933 | CH_DEVICE(0x4882), |
| 2934 | CH_DEVICE(0x4880), | 2934 | CH_DEVICE(0x4883), |
| 2935 | CH_DEVICE(0x4880), | 2935 | CH_DEVICE(0x4884), |
| 2936 | CH_DEVICE(0x4880), | 2936 | CH_DEVICE(0x4885), |
| 2937 | CH_DEVICE(0x4880), | 2937 | CH_DEVICE(0x4886), |
| 2938 | CH_DEVICE(0x4880), | 2938 | CH_DEVICE(0x4887), |
| 2939 | CH_DEVICE(0x4880), | 2939 | CH_DEVICE(0x4888), |
| 2940 | CH_DEVICE(0x5801), /* T520-cr */ | 2940 | CH_DEVICE(0x5801), /* T520-cr */ |
| 2941 | CH_DEVICE(0x5802), /* T522-cr */ | 2941 | CH_DEVICE(0x5802), /* T522-cr */ |
| 2942 | CH_DEVICE(0x5803), /* T540-cr */ | 2942 | CH_DEVICE(0x5803), /* T540-cr */ |
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c index 69dfd3c9e529..0be6850be8a2 100644 --- a/drivers/net/ethernet/cisco/enic/enic_clsf.c +++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c | |||
| @@ -86,7 +86,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic) | |||
| 86 | int i; | 86 | int i; |
| 87 | 87 | ||
| 88 | enic_rfs_timer_stop(enic); | 88 | enic_rfs_timer_stop(enic); |
| 89 | spin_lock(&enic->rfs_h.lock); | 89 | spin_lock_bh(&enic->rfs_h.lock); |
| 90 | enic->rfs_h.free = 0; | 90 | enic->rfs_h.free = 0; |
| 91 | for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { | 91 | for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { |
| 92 | struct hlist_head *hhead; | 92 | struct hlist_head *hhead; |
| @@ -100,7 +100,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic) | |||
| 100 | kfree(n); | 100 | kfree(n); |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | spin_unlock(&enic->rfs_h.lock); | 103 | spin_unlock_bh(&enic->rfs_h.lock); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id) | 106 | struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id) |
| @@ -128,7 +128,7 @@ void enic_flow_may_expire(unsigned long data) | |||
| 128 | bool res; | 128 | bool res; |
| 129 | int j; | 129 | int j; |
| 130 | 130 | ||
| 131 | spin_lock(&enic->rfs_h.lock); | 131 | spin_lock_bh(&enic->rfs_h.lock); |
| 132 | for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) { | 132 | for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) { |
| 133 | struct hlist_head *hhead; | 133 | struct hlist_head *hhead; |
| 134 | struct hlist_node *tmp; | 134 | struct hlist_node *tmp; |
| @@ -148,7 +148,7 @@ void enic_flow_may_expire(unsigned long data) | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | spin_unlock(&enic->rfs_h.lock); | 151 | spin_unlock_bh(&enic->rfs_h.lock); |
| 152 | mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); | 152 | mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -183,7 +183,7 @@ int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, | |||
| 183 | return -EPROTONOSUPPORT; | 183 | return -EPROTONOSUPPORT; |
| 184 | 184 | ||
| 185 | tbl_idx = skb_get_hash_raw(skb) & ENIC_RFS_FLW_MASK; | 185 | tbl_idx = skb_get_hash_raw(skb) & ENIC_RFS_FLW_MASK; |
| 186 | spin_lock(&enic->rfs_h.lock); | 186 | spin_lock_bh(&enic->rfs_h.lock); |
| 187 | n = htbl_key_search(&enic->rfs_h.ht_head[tbl_idx], &keys); | 187 | n = htbl_key_search(&enic->rfs_h.ht_head[tbl_idx], &keys); |
| 188 | 188 | ||
| 189 | if (n) { /* entry already present */ | 189 | if (n) { /* entry already present */ |
| @@ -277,7 +277,7 @@ int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, | |||
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | ret_unlock: | 279 | ret_unlock: |
| 280 | spin_unlock(&enic->rfs_h.lock); | 280 | spin_unlock_bh(&enic->rfs_h.lock); |
| 281 | return res; | 281 | return res; |
| 282 | } | 282 | } |
| 283 | 283 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 929bfe70080a..180e53fa628f 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
| @@ -1674,13 +1674,13 @@ static int enic_stop(struct net_device *netdev) | |||
| 1674 | 1674 | ||
| 1675 | enic_dev_disable(enic); | 1675 | enic_dev_disable(enic); |
| 1676 | 1676 | ||
| 1677 | local_bh_disable(); | ||
| 1678 | for (i = 0; i < enic->rq_count; i++) { | 1677 | for (i = 0; i < enic->rq_count; i++) { |
| 1679 | napi_disable(&enic->napi[i]); | 1678 | napi_disable(&enic->napi[i]); |
| 1679 | local_bh_disable(); | ||
| 1680 | while (!enic_poll_lock_napi(&enic->rq[i])) | 1680 | while (!enic_poll_lock_napi(&enic->rq[i])) |
| 1681 | mdelay(1); | 1681 | mdelay(1); |
| 1682 | local_bh_enable(); | ||
| 1682 | } | 1683 | } |
| 1683 | local_bh_enable(); | ||
| 1684 | 1684 | ||
| 1685 | netif_carrier_off(netdev); | 1685 | netif_carrier_off(netdev); |
| 1686 | netif_tx_disable(netdev); | 1686 | netif_tx_disable(netdev); |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 81b96cf87574..50a851db2852 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -1581,7 +1581,8 @@ fec_enet_interrupt(int irq, void *dev_id) | |||
| 1581 | complete(&fep->mdio_done); | 1581 | complete(&fep->mdio_done); |
| 1582 | } | 1582 | } |
| 1583 | 1583 | ||
| 1584 | fec_ptp_check_pps_event(fep); | 1584 | if (fep->ptp_clock) |
| 1585 | fec_ptp_check_pps_event(fep); | ||
| 1585 | 1586 | ||
| 1586 | return ret; | 1587 | return ret; |
| 1587 | } | 1588 | } |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index 3d4e08be1709..b34214e2df5f 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c | |||
| @@ -341,6 +341,9 @@ static void restart(struct net_device *dev) | |||
| 341 | FC(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD disable */ | 341 | FC(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD disable */ |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | /* Restore multicast and promiscuous settings */ | ||
| 345 | set_multicast_list(dev); | ||
| 346 | |||
| 344 | /* | 347 | /* |
| 345 | * Enable interrupts we wish to service. | 348 | * Enable interrupts we wish to service. |
| 346 | */ | 349 | */ |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c index f30411f0701f..7a184e8816a4 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c | |||
| @@ -355,6 +355,9 @@ static void restart(struct net_device *dev) | |||
| 355 | if (fep->phydev->duplex) | 355 | if (fep->phydev->duplex) |
| 356 | S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); | 356 | S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); |
| 357 | 357 | ||
| 358 | /* Restore multicast and promiscuous settings */ | ||
| 359 | set_multicast_list(dev); | ||
| 360 | |||
| 358 | S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); | 361 | S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
| 359 | } | 362 | } |
| 360 | 363 | ||
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 5f6aded512f5..24f3986cfae2 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
| @@ -1075,7 +1075,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 1075 | NETIF_F_HW_CSUM | | 1075 | NETIF_F_HW_CSUM | |
| 1076 | NETIF_F_SG); | 1076 | NETIF_F_SG); |
| 1077 | 1077 | ||
| 1078 | netdev->priv_flags |= IFF_UNICAST_FLT; | 1078 | /* Do not set IFF_UNICAST_FLT for VMWare's 82545EM */ |
| 1079 | if (hw->device_id != E1000_DEV_ID_82545EM_COPPER || | ||
| 1080 | hw->subsystem_vendor_id != PCI_VENDOR_ID_VMWARE) | ||
| 1081 | netdev->priv_flags |= IFF_UNICAST_FLT; | ||
| 1079 | 1082 | ||
| 1080 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(hw); | 1083 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(hw); |
| 1081 | 1084 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index ed5f1c15fb0f..c3a7f4a4b775 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
| @@ -6151,7 +6151,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) | |||
| 6151 | I40E_GL_MDET_TX_PF_NUM_SHIFT; | 6151 | I40E_GL_MDET_TX_PF_NUM_SHIFT; |
| 6152 | u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >> | 6152 | u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >> |
| 6153 | I40E_GL_MDET_TX_VF_NUM_SHIFT; | 6153 | I40E_GL_MDET_TX_VF_NUM_SHIFT; |
| 6154 | u8 event = (reg & I40E_GL_MDET_TX_EVENT_SHIFT) >> | 6154 | u8 event = (reg & I40E_GL_MDET_TX_EVENT_MASK) >> |
| 6155 | I40E_GL_MDET_TX_EVENT_SHIFT; | 6155 | I40E_GL_MDET_TX_EVENT_SHIFT; |
| 6156 | u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >> | 6156 | u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >> |
| 6157 | I40E_GL_MDET_TX_QUEUE_SHIFT; | 6157 | I40E_GL_MDET_TX_QUEUE_SHIFT; |
| @@ -6165,7 +6165,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) | |||
| 6165 | if (reg & I40E_GL_MDET_RX_VALID_MASK) { | 6165 | if (reg & I40E_GL_MDET_RX_VALID_MASK) { |
| 6166 | u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >> | 6166 | u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >> |
| 6167 | I40E_GL_MDET_RX_FUNCTION_SHIFT; | 6167 | I40E_GL_MDET_RX_FUNCTION_SHIFT; |
| 6168 | u8 event = (reg & I40E_GL_MDET_RX_EVENT_SHIFT) >> | 6168 | u8 event = (reg & I40E_GL_MDET_RX_EVENT_MASK) >> |
| 6169 | I40E_GL_MDET_RX_EVENT_SHIFT; | 6169 | I40E_GL_MDET_RX_EVENT_SHIFT; |
| 6170 | u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >> | 6170 | u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >> |
| 6171 | I40E_GL_MDET_RX_QUEUE_SHIFT; | 6171 | I40E_GL_MDET_RX_QUEUE_SHIFT; |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a21b14495ebd..a2d72a87cbde 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -6537,6 +6537,9 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, | |||
| 6537 | if (unlikely(page_to_nid(page) != numa_node_id())) | 6537 | if (unlikely(page_to_nid(page) != numa_node_id())) |
| 6538 | return false; | 6538 | return false; |
| 6539 | 6539 | ||
| 6540 | if (unlikely(page->pfmemalloc)) | ||
| 6541 | return false; | ||
| 6542 | |||
| 6540 | #if (PAGE_SIZE < 8192) | 6543 | #if (PAGE_SIZE < 8192) |
| 6541 | /* if we are only owner of page we can reuse it */ | 6544 | /* if we are only owner of page we can reuse it */ |
| 6542 | if (unlikely(page_count(page) != 1)) | 6545 | if (unlikely(page_count(page) != 1)) |
| @@ -6603,7 +6606,8 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, | |||
| 6603 | memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); | 6606 | memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); |
| 6604 | 6607 | ||
| 6605 | /* we can reuse buffer as-is, just make sure it is local */ | 6608 | /* we can reuse buffer as-is, just make sure it is local */ |
| 6606 | if (likely(page_to_nid(page) == numa_node_id())) | 6609 | if (likely((page_to_nid(page) == numa_node_id()) && |
| 6610 | !page->pfmemalloc)) | ||
| 6607 | return true; | 6611 | return true; |
| 6608 | 6612 | ||
| 6609 | /* this page cannot be reused so discard it */ | 6613 | /* this page cannot be reused so discard it */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 3ce4a258f945..0ae038b9af90 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
| @@ -342,12 +342,16 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
| 342 | if (old == advertised) | 342 | if (old == advertised) |
| 343 | return err; | 343 | return err; |
| 344 | /* this sets the link speed and restarts auto-neg */ | 344 | /* this sets the link speed and restarts auto-neg */ |
| 345 | while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) | ||
| 346 | usleep_range(1000, 2000); | ||
| 347 | |||
| 345 | hw->mac.autotry_restart = true; | 348 | hw->mac.autotry_restart = true; |
| 346 | err = hw->mac.ops.setup_link(hw, advertised, true); | 349 | err = hw->mac.ops.setup_link(hw, advertised, true); |
| 347 | if (err) { | 350 | if (err) { |
| 348 | e_info(probe, "setup link failed with code %d\n", err); | 351 | e_info(probe, "setup link failed with code %d\n", err); |
| 349 | hw->mac.ops.setup_link(hw, old, true); | 352 | hw->mac.ops.setup_link(hw, old, true); |
| 350 | } | 353 | } |
| 354 | clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); | ||
| 351 | } else { | 355 | } else { |
| 352 | /* in this case we currently only support 10Gb/FULL */ | 356 | /* in this case we currently only support 10Gb/FULL */ |
| 353 | u32 speed = ethtool_cmd_speed(ecmd); | 357 | u32 speed = ethtool_cmd_speed(ecmd); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index fec5212d4337..d2df4e3d1032 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -4321,8 +4321,8 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring) | |||
| 4321 | IXGBE_CB(skb)->page_released = false; | 4321 | IXGBE_CB(skb)->page_released = false; |
| 4322 | } | 4322 | } |
| 4323 | dev_kfree_skb(skb); | 4323 | dev_kfree_skb(skb); |
| 4324 | rx_buffer->skb = NULL; | ||
| 4324 | } | 4325 | } |
| 4325 | rx_buffer->skb = NULL; | ||
| 4326 | if (rx_buffer->dma) | 4326 | if (rx_buffer->dma) |
| 4327 | dma_unmap_page(dev, rx_buffer->dma, | 4327 | dma_unmap_page(dev, rx_buffer->dma, |
| 4328 | ixgbe_rx_pg_size(rx_ring), | 4328 | ixgbe_rx_pg_size(rx_ring), |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 34c137878545..454d9fea640e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
| @@ -836,8 +836,11 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 836 | * whether LSO is used */ | 836 | * whether LSO is used */ |
| 837 | tx_desc->ctrl.srcrb_flags = priv->ctrl_flags; | 837 | tx_desc->ctrl.srcrb_flags = priv->ctrl_flags; |
| 838 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 838 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
| 839 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | | 839 | if (!skb->encapsulation) |
| 840 | MLX4_WQE_CTRL_TCP_UDP_CSUM); | 840 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | |
| 841 | MLX4_WQE_CTRL_TCP_UDP_CSUM); | ||
| 842 | else | ||
| 843 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM); | ||
| 841 | ring->tx_csum++; | 844 | ring->tx_csum++; |
| 842 | } | 845 | } |
| 843 | 846 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index a49c9d11d8a5..49290a405903 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
| @@ -1026,6 +1026,7 @@ static void mlx4_free_eq(struct mlx4_dev *dev, | |||
| 1026 | pr_cont("\n"); | 1026 | pr_cont("\n"); |
| 1027 | } | 1027 | } |
| 1028 | } | 1028 | } |
| 1029 | synchronize_irq(eq->irq); | ||
| 1029 | 1030 | ||
| 1030 | mlx4_mtt_cleanup(dev, &eq->mtt); | 1031 | mlx4_mtt_cleanup(dev, &eq->mtt); |
| 1031 | for (i = 0; i < npages; ++i) | 1032 | for (i = 0; i < npages; ++i) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index ca0f98c95105..872843179f44 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
| @@ -955,6 +955,10 @@ static void mlx4_err_rule(struct mlx4_dev *dev, char *str, | |||
| 955 | cur->ib.dst_gid_msk); | 955 | cur->ib.dst_gid_msk); |
| 956 | break; | 956 | break; |
| 957 | 957 | ||
| 958 | case MLX4_NET_TRANS_RULE_ID_VXLAN: | ||
| 959 | len += snprintf(buf + len, BUF_SIZE - len, | ||
| 960 | "VNID = %d ", be32_to_cpu(cur->vxlan.vni)); | ||
| 961 | break; | ||
| 958 | case MLX4_NET_TRANS_RULE_ID_IPV6: | 962 | case MLX4_NET_TRANS_RULE_ID_IPV6: |
| 959 | break; | 963 | break; |
| 960 | 964 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index ed53291468f3..a278238a2db6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
| @@ -420,6 +420,7 @@ int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq) | |||
| 420 | if (err) | 420 | if (err) |
| 421 | mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n", | 421 | mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n", |
| 422 | eq->eqn); | 422 | eq->eqn); |
| 423 | synchronize_irq(table->msix_arr[eq->irqn].vector); | ||
| 423 | mlx5_buf_free(dev, &eq->buf); | 424 | mlx5_buf_free(dev, &eq->buf); |
| 424 | 425 | ||
| 425 | return err; | 426 | return err; |
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c index ee84a90e371c..aaf2987512b5 100644 --- a/drivers/net/ethernet/sfc/tx.c +++ b/drivers/net/ethernet/sfc/tx.c | |||
| @@ -343,8 +343,6 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
| 343 | unsigned short dma_flags; | 343 | unsigned short dma_flags; |
| 344 | int i = 0; | 344 | int i = 0; |
| 345 | 345 | ||
| 346 | EFX_BUG_ON_PARANOID(tx_queue->write_count > tx_queue->insert_count); | ||
| 347 | |||
| 348 | if (skb_shinfo(skb)->gso_size) | 346 | if (skb_shinfo(skb)->gso_size) |
| 349 | return efx_enqueue_skb_tso(tx_queue, skb); | 347 | return efx_enqueue_skb_tso(tx_queue, skb); |
| 350 | 348 | ||
| @@ -1258,8 +1256,6 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, | |||
| 1258 | /* Find the packet protocol and sanity-check it */ | 1256 | /* Find the packet protocol and sanity-check it */ |
| 1259 | state.protocol = efx_tso_check_protocol(skb); | 1257 | state.protocol = efx_tso_check_protocol(skb); |
| 1260 | 1258 | ||
| 1261 | EFX_BUG_ON_PARANOID(tx_queue->write_count > tx_queue->insert_count); | ||
| 1262 | |||
| 1263 | rc = tso_start(&state, efx, skb); | 1259 | rc = tso_start(&state, efx, skb); |
| 1264 | if (rc) | 1260 | if (rc) |
| 1265 | goto mem_err; | 1261 | goto mem_err; |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 5e94d00b96b3..2c62208077fe 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
| @@ -81,6 +81,7 @@ static const char version[] = | |||
| 81 | #include <linux/workqueue.h> | 81 | #include <linux/workqueue.h> |
| 82 | #include <linux/of.h> | 82 | #include <linux/of.h> |
| 83 | #include <linux/of_device.h> | 83 | #include <linux/of_device.h> |
| 84 | #include <linux/of_gpio.h> | ||
| 84 | 85 | ||
| 85 | #include <linux/netdevice.h> | 86 | #include <linux/netdevice.h> |
| 86 | #include <linux/etherdevice.h> | 87 | #include <linux/etherdevice.h> |
| @@ -2188,6 +2189,41 @@ static const struct of_device_id smc91x_match[] = { | |||
| 2188 | {}, | 2189 | {}, |
| 2189 | }; | 2190 | }; |
| 2190 | MODULE_DEVICE_TABLE(of, smc91x_match); | 2191 | MODULE_DEVICE_TABLE(of, smc91x_match); |
| 2192 | |||
| 2193 | /** | ||
| 2194 | * of_try_set_control_gpio - configure a gpio if it exists | ||
| 2195 | */ | ||
| 2196 | static int try_toggle_control_gpio(struct device *dev, | ||
| 2197 | struct gpio_desc **desc, | ||
| 2198 | const char *name, int index, | ||
| 2199 | int value, unsigned int nsdelay) | ||
| 2200 | { | ||
| 2201 | struct gpio_desc *gpio = *desc; | ||
| 2202 | int res; | ||
| 2203 | |||
| 2204 | gpio = devm_gpiod_get_index(dev, name, index); | ||
| 2205 | if (IS_ERR(gpio)) { | ||
| 2206 | if (PTR_ERR(gpio) == -ENOENT) { | ||
| 2207 | *desc = NULL; | ||
| 2208 | return 0; | ||
| 2209 | } | ||
| 2210 | |||
| 2211 | return PTR_ERR(gpio); | ||
| 2212 | } | ||
| 2213 | res = gpiod_direction_output(gpio, !value); | ||
| 2214 | if (res) { | ||
| 2215 | dev_err(dev, "unable to toggle gpio %s: %i\n", name, res); | ||
| 2216 | devm_gpiod_put(dev, gpio); | ||
| 2217 | gpio = NULL; | ||
| 2218 | return res; | ||
| 2219 | } | ||
| 2220 | if (nsdelay) | ||
| 2221 | usleep_range(nsdelay, 2 * nsdelay); | ||
| 2222 | gpiod_set_value_cansleep(gpio, value); | ||
| 2223 | *desc = gpio; | ||
| 2224 | |||
| 2225 | return 0; | ||
| 2226 | } | ||
| 2191 | #endif | 2227 | #endif |
| 2192 | 2228 | ||
| 2193 | /* | 2229 | /* |
| @@ -2237,6 +2273,28 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
| 2237 | struct device_node *np = pdev->dev.of_node; | 2273 | struct device_node *np = pdev->dev.of_node; |
| 2238 | u32 val; | 2274 | u32 val; |
| 2239 | 2275 | ||
| 2276 | /* Optional pwrdwn GPIO configured? */ | ||
| 2277 | ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, | ||
| 2278 | "power", 0, 0, 100); | ||
| 2279 | if (ret) | ||
| 2280 | return ret; | ||
| 2281 | |||
| 2282 | /* | ||
| 2283 | * Optional reset GPIO configured? Minimum 100 ns reset needed | ||
| 2284 | * according to LAN91C96 datasheet page 14. | ||
| 2285 | */ | ||
| 2286 | ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, | ||
| 2287 | "reset", 0, 0, 100); | ||
| 2288 | if (ret) | ||
| 2289 | return ret; | ||
| 2290 | |||
| 2291 | /* | ||
| 2292 | * Need to wait for optional EEPROM to load, max 750 us according | ||
| 2293 | * to LAN91C96 datasheet page 55. | ||
| 2294 | */ | ||
| 2295 | if (lp->reset_gpio) | ||
| 2296 | usleep_range(750, 1000); | ||
| 2297 | |||
| 2240 | /* Combination of IO widths supported, default to 16-bit */ | 2298 | /* Combination of IO widths supported, default to 16-bit */ |
| 2241 | if (!of_property_read_u32(np, "reg-io-width", &val)) { | 2299 | if (!of_property_read_u32(np, "reg-io-width", &val)) { |
| 2242 | if (val & 1) | 2300 | if (val & 1) |
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index 47dce918eb0f..2a38dacbbd27 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
| @@ -298,6 +298,9 @@ struct smc_local { | |||
| 298 | struct sk_buff *pending_tx_skb; | 298 | struct sk_buff *pending_tx_skb; |
| 299 | struct tasklet_struct tx_task; | 299 | struct tasklet_struct tx_task; |
| 300 | 300 | ||
| 301 | struct gpio_desc *power_gpio; | ||
| 302 | struct gpio_desc *reset_gpio; | ||
| 303 | |||
| 301 | /* version/revision of the SMC91x chip */ | 304 | /* version/revision of the SMC91x chip */ |
| 302 | int version; | 305 | int version; |
| 303 | 306 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 655a23bbc451..e17a970eaf2b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
| @@ -33,6 +33,7 @@ static struct stmmac_dma_cfg dma_cfg; | |||
| 33 | static void stmmac_default_data(void) | 33 | static void stmmac_default_data(void) |
| 34 | { | 34 | { |
| 35 | memset(&plat_dat, 0, sizeof(struct plat_stmmacenet_data)); | 35 | memset(&plat_dat, 0, sizeof(struct plat_stmmacenet_data)); |
| 36 | |||
| 36 | plat_dat.bus_id = 1; | 37 | plat_dat.bus_id = 1; |
| 37 | plat_dat.phy_addr = 0; | 38 | plat_dat.phy_addr = 0; |
| 38 | plat_dat.interface = PHY_INTERFACE_MODE_GMII; | 39 | plat_dat.interface = PHY_INTERFACE_MODE_GMII; |
| @@ -47,6 +48,12 @@ static void stmmac_default_data(void) | |||
| 47 | dma_cfg.pbl = 32; | 48 | dma_cfg.pbl = 32; |
| 48 | dma_cfg.burst_len = DMA_AXI_BLEN_256; | 49 | dma_cfg.burst_len = DMA_AXI_BLEN_256; |
| 49 | plat_dat.dma_cfg = &dma_cfg; | 50 | plat_dat.dma_cfg = &dma_cfg; |
| 51 | |||
| 52 | /* Set default value for multicast hash bins */ | ||
| 53 | plat_dat.multicast_filter_bins = HASH_TABLE_SIZE; | ||
| 54 | |||
| 55 | /* Set default value for unicast filter entries */ | ||
| 56 | plat_dat.unicast_filter_entries = 1; | ||
| 50 | } | 57 | } |
| 51 | 58 | ||
| 52 | /** | 59 | /** |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 952e1e4764b7..d8794488f80a 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
| @@ -591,8 +591,8 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
| 591 | if (enable) { | 591 | if (enable) { |
| 592 | unsigned long timeout = jiffies + HZ; | 592 | unsigned long timeout = jiffies + HZ; |
| 593 | 593 | ||
| 594 | /* Disable Learn for all ports */ | 594 | /* Disable Learn for all ports (host is port 0 and slaves are port 1 and up */ |
| 595 | for (i = 0; i < priv->data.slaves; i++) { | 595 | for (i = 0; i <= priv->data.slaves; i++) { |
| 596 | cpsw_ale_control_set(ale, i, | 596 | cpsw_ale_control_set(ale, i, |
| 597 | ALE_PORT_NOLEARN, 1); | 597 | ALE_PORT_NOLEARN, 1); |
| 598 | cpsw_ale_control_set(ale, i, | 598 | cpsw_ale_control_set(ale, i, |
| @@ -616,11 +616,11 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
| 616 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); | 616 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); |
| 617 | dev_dbg(&ndev->dev, "promiscuity enabled\n"); | 617 | dev_dbg(&ndev->dev, "promiscuity enabled\n"); |
| 618 | } else { | 618 | } else { |
| 619 | /* Flood All Unicast Packets to Host port */ | 619 | /* Don't Flood All Unicast Packets to Host port */ |
| 620 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); | 620 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); |
| 621 | 621 | ||
| 622 | /* Enable Learn for all ports */ | 622 | /* Enable Learn for all ports (host is port 0 and slaves are port 1 and up */ |
| 623 | for (i = 0; i < priv->data.slaves; i++) { | 623 | for (i = 0; i <= priv->data.slaves; i++) { |
| 624 | cpsw_ale_control_set(ale, i, | 624 | cpsw_ale_control_set(ale, i, |
| 625 | ALE_PORT_NOLEARN, 0); | 625 | ALE_PORT_NOLEARN, 0); |
| 626 | cpsw_ale_control_set(ale, i, | 626 | cpsw_ale_control_set(ale, i, |
| @@ -638,12 +638,16 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) | |||
| 638 | if (ndev->flags & IFF_PROMISC) { | 638 | if (ndev->flags & IFF_PROMISC) { |
| 639 | /* Enable promiscuous mode */ | 639 | /* Enable promiscuous mode */ |
| 640 | cpsw_set_promiscious(ndev, true); | 640 | cpsw_set_promiscious(ndev, true); |
| 641 | cpsw_ale_set_allmulti(priv->ale, IFF_ALLMULTI); | ||
| 641 | return; | 642 | return; |
| 642 | } else { | 643 | } else { |
| 643 | /* Disable promiscuous mode */ | 644 | /* Disable promiscuous mode */ |
| 644 | cpsw_set_promiscious(ndev, false); | 645 | cpsw_set_promiscious(ndev, false); |
| 645 | } | 646 | } |
| 646 | 647 | ||
| 648 | /* Restore allmulti on vlans if necessary */ | ||
| 649 | cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); | ||
| 650 | |||
| 647 | /* Clear all mcast from ALE */ | 651 | /* Clear all mcast from ALE */ |
| 648 | cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); | 652 | cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); |
| 649 | 653 | ||
| @@ -1149,6 +1153,7 @@ static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) | |||
| 1149 | const int port = priv->host_port; | 1153 | const int port = priv->host_port; |
| 1150 | u32 reg; | 1154 | u32 reg; |
| 1151 | int i; | 1155 | int i; |
| 1156 | int unreg_mcast_mask; | ||
| 1152 | 1157 | ||
| 1153 | reg = (priv->version == CPSW_VERSION_1) ? CPSW1_PORT_VLAN : | 1158 | reg = (priv->version == CPSW_VERSION_1) ? CPSW1_PORT_VLAN : |
| 1154 | CPSW2_PORT_VLAN; | 1159 | CPSW2_PORT_VLAN; |
| @@ -1158,9 +1163,14 @@ static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) | |||
| 1158 | for (i = 0; i < priv->data.slaves; i++) | 1163 | for (i = 0; i < priv->data.slaves; i++) |
| 1159 | slave_write(priv->slaves + i, vlan, reg); | 1164 | slave_write(priv->slaves + i, vlan, reg); |
| 1160 | 1165 | ||
| 1166 | if (priv->ndev->flags & IFF_ALLMULTI) | ||
| 1167 | unreg_mcast_mask = ALE_ALL_PORTS; | ||
| 1168 | else | ||
| 1169 | unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2; | ||
| 1170 | |||
| 1161 | cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port, | 1171 | cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port, |
| 1162 | ALE_ALL_PORTS << port, ALE_ALL_PORTS << port, | 1172 | ALE_ALL_PORTS << port, ALE_ALL_PORTS << port, |
| 1163 | (ALE_PORT_1 | ALE_PORT_2) << port); | 1173 | unreg_mcast_mask << port); |
| 1164 | } | 1174 | } |
| 1165 | 1175 | ||
| 1166 | static void cpsw_init_host_port(struct cpsw_priv *priv) | 1176 | static void cpsw_init_host_port(struct cpsw_priv *priv) |
| @@ -1620,11 +1630,17 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, | |||
| 1620 | unsigned short vid) | 1630 | unsigned short vid) |
| 1621 | { | 1631 | { |
| 1622 | int ret; | 1632 | int ret; |
| 1633 | int unreg_mcast_mask; | ||
| 1634 | |||
| 1635 | if (priv->ndev->flags & IFF_ALLMULTI) | ||
| 1636 | unreg_mcast_mask = ALE_ALL_PORTS; | ||
| 1637 | else | ||
| 1638 | unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2; | ||
| 1623 | 1639 | ||
| 1624 | ret = cpsw_ale_add_vlan(priv->ale, vid, | 1640 | ret = cpsw_ale_add_vlan(priv->ale, vid, |
| 1625 | ALE_ALL_PORTS << priv->host_port, | 1641 | ALE_ALL_PORTS << priv->host_port, |
| 1626 | 0, ALE_ALL_PORTS << priv->host_port, | 1642 | 0, ALE_ALL_PORTS << priv->host_port, |
| 1627 | (ALE_PORT_1 | ALE_PORT_2) << priv->host_port); | 1643 | unreg_mcast_mask << priv->host_port); |
| 1628 | if (ret != 0) | 1644 | if (ret != 0) |
| 1629 | return ret; | 1645 | return ret; |
| 1630 | 1646 | ||
| @@ -2006,7 +2022,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
| 2006 | parp = of_get_property(slave_node, "phy_id", &lenp); | 2022 | parp = of_get_property(slave_node, "phy_id", &lenp); |
| 2007 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { | 2023 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
| 2008 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); | 2024 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); |
| 2009 | return -EINVAL; | 2025 | goto no_phy_slave; |
| 2010 | } | 2026 | } |
| 2011 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); | 2027 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); |
| 2012 | phyid = be32_to_cpup(parp+1); | 2028 | phyid = be32_to_cpup(parp+1); |
| @@ -2019,6 +2035,14 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
| 2019 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), | 2035 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), |
| 2020 | PHY_ID_FMT, mdio->name, phyid); | 2036 | PHY_ID_FMT, mdio->name, phyid); |
| 2021 | 2037 | ||
| 2038 | slave_data->phy_if = of_get_phy_mode(slave_node); | ||
| 2039 | if (slave_data->phy_if < 0) { | ||
| 2040 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", | ||
| 2041 | i); | ||
| 2042 | return slave_data->phy_if; | ||
| 2043 | } | ||
| 2044 | |||
| 2045 | no_phy_slave: | ||
| 2022 | mac_addr = of_get_mac_address(slave_node); | 2046 | mac_addr = of_get_mac_address(slave_node); |
| 2023 | if (mac_addr) { | 2047 | if (mac_addr) { |
| 2024 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); | 2048 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); |
| @@ -2030,14 +2054,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
| 2030 | return ret; | 2054 | return ret; |
| 2031 | } | 2055 | } |
| 2032 | } | 2056 | } |
| 2033 | |||
| 2034 | slave_data->phy_if = of_get_phy_mode(slave_node); | ||
| 2035 | if (slave_data->phy_if < 0) { | ||
| 2036 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", | ||
| 2037 | i); | ||
| 2038 | return slave_data->phy_if; | ||
| 2039 | } | ||
| 2040 | |||
| 2041 | if (data->dual_emac) { | 2057 | if (data->dual_emac) { |
| 2042 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", | 2058 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", |
| 2043 | &prop)) { | 2059 | &prop)) { |
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 0579b2243bb6..3ae83879a75f 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c | |||
| @@ -443,6 +443,35 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) | |||
| 443 | return 0; | 443 | return 0; |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti) | ||
| 447 | { | ||
| 448 | u32 ale_entry[ALE_ENTRY_WORDS]; | ||
| 449 | int type, idx; | ||
| 450 | int unreg_mcast = 0; | ||
| 451 | |||
| 452 | /* Only bother doing the work if the setting is actually changing */ | ||
| 453 | if (ale->allmulti == allmulti) | ||
| 454 | return; | ||
| 455 | |||
| 456 | /* Remember the new setting to check against next time */ | ||
| 457 | ale->allmulti = allmulti; | ||
| 458 | |||
| 459 | for (idx = 0; idx < ale->params.ale_entries; idx++) { | ||
| 460 | cpsw_ale_read(ale, idx, ale_entry); | ||
| 461 | type = cpsw_ale_get_entry_type(ale_entry); | ||
| 462 | if (type != ALE_TYPE_VLAN) | ||
| 463 | continue; | ||
| 464 | |||
| 465 | unreg_mcast = cpsw_ale_get_vlan_unreg_mcast(ale_entry); | ||
| 466 | if (allmulti) | ||
| 467 | unreg_mcast |= 1; | ||
| 468 | else | ||
| 469 | unreg_mcast &= ~1; | ||
| 470 | cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast); | ||
| 471 | cpsw_ale_write(ale, idx, ale_entry); | ||
| 472 | } | ||
| 473 | } | ||
| 474 | |||
| 446 | struct ale_control_info { | 475 | struct ale_control_info { |
| 447 | const char *name; | 476 | const char *name; |
| 448 | int offset, port_offset; | 477 | int offset, port_offset; |
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h index 31cf43cab42e..c0d4127aa549 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.h +++ b/drivers/net/ethernet/ti/cpsw_ale.h | |||
| @@ -27,6 +27,7 @@ struct cpsw_ale { | |||
| 27 | struct cpsw_ale_params params; | 27 | struct cpsw_ale_params params; |
| 28 | struct timer_list timer; | 28 | struct timer_list timer; |
| 29 | unsigned long ageout; | 29 | unsigned long ageout; |
| 30 | int allmulti; | ||
| 30 | }; | 31 | }; |
| 31 | 32 | ||
| 32 | enum cpsw_ale_control { | 33 | enum cpsw_ale_control { |
| @@ -103,6 +104,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, | |||
| 103 | int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, | 104 | int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, |
| 104 | int reg_mcast, int unreg_mcast); | 105 | int reg_mcast, int unreg_mcast); |
| 105 | int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port); | 106 | int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port); |
| 107 | void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti); | ||
| 106 | 108 | ||
| 107 | int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); | 109 | int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); |
| 108 | int cpsw_ale_control_set(struct cpsw_ale *ale, int port, | 110 | int cpsw_ale_control_set(struct cpsw_ale *ale, int port, |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 9e17d1a91e71..78ec33f5100b 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
| @@ -550,6 +550,7 @@ do_lso: | |||
| 550 | do_send: | 550 | do_send: |
| 551 | /* Start filling in the page buffers with the rndis hdr */ | 551 | /* Start filling in the page buffers with the rndis hdr */ |
| 552 | rndis_msg->msg_len += rndis_msg_size; | 552 | rndis_msg->msg_len += rndis_msg_size; |
| 553 | packet->total_data_buflen = rndis_msg->msg_len; | ||
| 553 | packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, | 554 | packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, |
| 554 | skb, &packet->page_buf[0]); | 555 | skb, &packet->page_buf[0]); |
| 555 | 556 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 29b3bb410781..bfb0b6ec8c56 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
| @@ -272,7 +272,7 @@ static void macvlan_process_broadcast(struct work_struct *w) | |||
| 272 | struct sk_buff *skb; | 272 | struct sk_buff *skb; |
| 273 | struct sk_buff_head list; | 273 | struct sk_buff_head list; |
| 274 | 274 | ||
| 275 | skb_queue_head_init(&list); | 275 | __skb_queue_head_init(&list); |
| 276 | 276 | ||
| 277 | spin_lock_bh(&port->bc_queue.lock); | 277 | spin_lock_bh(&port->bc_queue.lock); |
| 278 | skb_queue_splice_tail_init(&port->bc_queue, &list); | 278 | skb_queue_splice_tail_init(&port->bc_queue, &list); |
| @@ -1082,9 +1082,15 @@ static void macvlan_port_destroy(struct net_device *dev) | |||
| 1082 | { | 1082 | { |
| 1083 | struct macvlan_port *port = macvlan_port_get_rtnl(dev); | 1083 | struct macvlan_port *port = macvlan_port_get_rtnl(dev); |
| 1084 | 1084 | ||
| 1085 | cancel_work_sync(&port->bc_work); | ||
| 1086 | dev->priv_flags &= ~IFF_MACVLAN_PORT; | 1085 | dev->priv_flags &= ~IFF_MACVLAN_PORT; |
| 1087 | netdev_rx_handler_unregister(dev); | 1086 | netdev_rx_handler_unregister(dev); |
| 1087 | |||
| 1088 | /* After this point, no packet can schedule bc_work anymore, | ||
| 1089 | * but we need to cancel it and purge left skbs if any. | ||
| 1090 | */ | ||
| 1091 | cancel_work_sync(&port->bc_work); | ||
| 1092 | __skb_queue_purge(&port->bc_queue); | ||
| 1093 | |||
| 1088 | kfree_rcu(port, rcu); | 1094 | kfree_rcu(port, rcu); |
| 1089 | } | 1095 | } |
| 1090 | 1096 | ||
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 65e2892342bd..6f226de655a4 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/idr.h> | 16 | #include <linux/idr.h> |
| 17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
| 18 | 18 | ||
| 19 | #include <net/ipv6.h> | ||
| 19 | #include <net/net_namespace.h> | 20 | #include <net/net_namespace.h> |
| 20 | #include <net/rtnetlink.h> | 21 | #include <net/rtnetlink.h> |
| 21 | #include <net/sock.h> | 22 | #include <net/sock.h> |
| @@ -65,7 +66,7 @@ static struct cdev macvtap_cdev; | |||
| 65 | static const struct proto_ops macvtap_socket_ops; | 66 | static const struct proto_ops macvtap_socket_ops; |
| 66 | 67 | ||
| 67 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ | 68 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ |
| 68 | NETIF_F_TSO6 | NETIF_F_UFO) | 69 | NETIF_F_TSO6) |
| 69 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) | 70 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) |
| 70 | #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) | 71 | #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) |
| 71 | 72 | ||
| @@ -569,7 +570,11 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb, | |||
| 569 | gso_type = SKB_GSO_TCPV6; | 570 | gso_type = SKB_GSO_TCPV6; |
| 570 | break; | 571 | break; |
| 571 | case VIRTIO_NET_HDR_GSO_UDP: | 572 | case VIRTIO_NET_HDR_GSO_UDP: |
| 573 | pr_warn_once("macvtap: %s: using disabled UFO feature; please fix this program\n", | ||
| 574 | current->comm); | ||
| 572 | gso_type = SKB_GSO_UDP; | 575 | gso_type = SKB_GSO_UDP; |
| 576 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
| 577 | ipv6_proxy_select_ident(skb); | ||
| 573 | break; | 578 | break; |
| 574 | default: | 579 | default: |
| 575 | return -EINVAL; | 580 | return -EINVAL; |
| @@ -614,8 +619,6 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, | |||
| 614 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 619 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
| 615 | else if (sinfo->gso_type & SKB_GSO_TCPV6) | 620 | else if (sinfo->gso_type & SKB_GSO_TCPV6) |
| 616 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 621 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
| 617 | else if (sinfo->gso_type & SKB_GSO_UDP) | ||
| 618 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; | ||
| 619 | else | 622 | else |
| 620 | BUG(); | 623 | BUG(); |
| 621 | if (sinfo->gso_type & SKB_GSO_TCP_ECN) | 624 | if (sinfo->gso_type & SKB_GSO_TCP_ECN) |
| @@ -950,9 +953,6 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) | |||
| 950 | if (arg & TUN_F_TSO6) | 953 | if (arg & TUN_F_TSO6) |
| 951 | feature_mask |= NETIF_F_TSO6; | 954 | feature_mask |= NETIF_F_TSO6; |
| 952 | } | 955 | } |
| 953 | |||
| 954 | if (arg & TUN_F_UFO) | ||
| 955 | feature_mask |= NETIF_F_UFO; | ||
| 956 | } | 956 | } |
| 957 | 957 | ||
| 958 | /* tun/tap driver inverts the usage for TSO offloads, where | 958 | /* tun/tap driver inverts the usage for TSO offloads, where |
| @@ -963,7 +963,7 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) | |||
| 963 | * When user space turns off TSO, we turn off GSO/LRO so that | 963 | * When user space turns off TSO, we turn off GSO/LRO so that |
| 964 | * user-space will not receive TSO frames. | 964 | * user-space will not receive TSO frames. |
| 965 | */ | 965 | */ |
| 966 | if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) | 966 | if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) |
| 967 | features |= RX_OFFLOADS; | 967 | features |= RX_OFFLOADS; |
| 968 | else | 968 | else |
| 969 | features &= ~RX_OFFLOADS; | 969 | features &= ~RX_OFFLOADS; |
| @@ -1064,7 +1064,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, | |||
| 1064 | case TUNSETOFFLOAD: | 1064 | case TUNSETOFFLOAD: |
| 1065 | /* let the user check for future flags */ | 1065 | /* let the user check for future flags */ |
| 1066 | if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | | 1066 | if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | |
| 1067 | TUN_F_TSO_ECN | TUN_F_UFO)) | 1067 | TUN_F_TSO_ECN)) |
| 1068 | return -EINVAL; | 1068 | return -EINVAL; |
| 1069 | 1069 | ||
| 1070 | rtnl_lock(); | 1070 | rtnl_lock(); |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index bd37e45c89c0..225c033b08f3 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
| @@ -50,10 +50,15 @@ | |||
| 50 | #define MII_M1011_PHY_SCR 0x10 | 50 | #define MII_M1011_PHY_SCR 0x10 |
| 51 | #define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060 | 51 | #define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060 |
| 52 | 52 | ||
| 53 | #define MII_M1145_PHY_EXT_SR 0x1b | ||
| 53 | #define MII_M1145_PHY_EXT_CR 0x14 | 54 | #define MII_M1145_PHY_EXT_CR 0x14 |
| 54 | #define MII_M1145_RGMII_RX_DELAY 0x0080 | 55 | #define MII_M1145_RGMII_RX_DELAY 0x0080 |
| 55 | #define MII_M1145_RGMII_TX_DELAY 0x0002 | 56 | #define MII_M1145_RGMII_TX_DELAY 0x0002 |
| 56 | 57 | ||
| 58 | #define MII_M1145_HWCFG_MODE_SGMII_NO_CLK 0x4 | ||
| 59 | #define MII_M1145_HWCFG_MODE_MASK 0xf | ||
| 60 | #define MII_M1145_HWCFG_FIBER_COPPER_AUTO 0x8000 | ||
| 61 | |||
| 57 | #define MII_M1111_PHY_LED_CONTROL 0x18 | 62 | #define MII_M1111_PHY_LED_CONTROL 0x18 |
| 58 | #define MII_M1111_PHY_LED_DIRECT 0x4100 | 63 | #define MII_M1111_PHY_LED_DIRECT 0x4100 |
| 59 | #define MII_M1111_PHY_LED_COMBINE 0x411c | 64 | #define MII_M1111_PHY_LED_COMBINE 0x411c |
| @@ -676,6 +681,20 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
| 676 | } | 681 | } |
| 677 | } | 682 | } |
| 678 | 683 | ||
| 684 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { | ||
| 685 | int temp = phy_read(phydev, MII_M1145_PHY_EXT_SR); | ||
| 686 | if (temp < 0) | ||
| 687 | return temp; | ||
| 688 | |||
| 689 | temp &= ~MII_M1145_HWCFG_MODE_MASK; | ||
| 690 | temp |= MII_M1145_HWCFG_MODE_SGMII_NO_CLK; | ||
| 691 | temp |= MII_M1145_HWCFG_FIBER_COPPER_AUTO; | ||
| 692 | |||
| 693 | err = phy_write(phydev, MII_M1145_PHY_EXT_SR, temp); | ||
| 694 | if (err < 0) | ||
| 695 | return err; | ||
| 696 | } | ||
| 697 | |||
| 679 | err = marvell_of_reg_init(phydev); | 698 | err = marvell_of_reg_init(phydev); |
| 680 | if (err < 0) | 699 | if (err < 0) |
| 681 | return err; | 700 | return err; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 186ce541c657..7302398f0b1f 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -65,6 +65,7 @@ | |||
| 65 | #include <linux/nsproxy.h> | 65 | #include <linux/nsproxy.h> |
| 66 | #include <linux/virtio_net.h> | 66 | #include <linux/virtio_net.h> |
| 67 | #include <linux/rcupdate.h> | 67 | #include <linux/rcupdate.h> |
| 68 | #include <net/ipv6.h> | ||
| 68 | #include <net/net_namespace.h> | 69 | #include <net/net_namespace.h> |
| 69 | #include <net/netns/generic.h> | 70 | #include <net/netns/generic.h> |
| 70 | #include <net/rtnetlink.h> | 71 | #include <net/rtnetlink.h> |
| @@ -174,7 +175,7 @@ struct tun_struct { | |||
| 174 | struct net_device *dev; | 175 | struct net_device *dev; |
| 175 | netdev_features_t set_features; | 176 | netdev_features_t set_features; |
| 176 | #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ | 177 | #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ |
| 177 | NETIF_F_TSO6|NETIF_F_UFO) | 178 | NETIF_F_TSO6) |
| 178 | 179 | ||
| 179 | int vnet_hdr_sz; | 180 | int vnet_hdr_sz; |
| 180 | int sndbuf; | 181 | int sndbuf; |
| @@ -1139,6 +1140,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1139 | break; | 1140 | break; |
| 1140 | } | 1141 | } |
| 1141 | 1142 | ||
| 1143 | skb_reset_network_header(skb); | ||
| 1144 | |||
| 1142 | if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 1145 | if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { |
| 1143 | pr_debug("GSO!\n"); | 1146 | pr_debug("GSO!\n"); |
| 1144 | switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { | 1147 | switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
| @@ -1149,8 +1152,20 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1149 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 1152 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
| 1150 | break; | 1153 | break; |
| 1151 | case VIRTIO_NET_HDR_GSO_UDP: | 1154 | case VIRTIO_NET_HDR_GSO_UDP: |
| 1155 | { | ||
| 1156 | static bool warned; | ||
| 1157 | |||
| 1158 | if (!warned) { | ||
| 1159 | warned = true; | ||
| 1160 | netdev_warn(tun->dev, | ||
| 1161 | "%s: using disabled UFO feature; please fix this program\n", | ||
| 1162 | current->comm); | ||
| 1163 | } | ||
| 1152 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 1164 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
| 1165 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
| 1166 | ipv6_proxy_select_ident(skb); | ||
| 1153 | break; | 1167 | break; |
| 1168 | } | ||
| 1154 | default: | 1169 | default: |
| 1155 | tun->dev->stats.rx_frame_errors++; | 1170 | tun->dev->stats.rx_frame_errors++; |
| 1156 | kfree_skb(skb); | 1171 | kfree_skb(skb); |
| @@ -1179,7 +1194,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1179 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; | 1194 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; |
| 1180 | } | 1195 | } |
| 1181 | 1196 | ||
| 1182 | skb_reset_network_header(skb); | ||
| 1183 | skb_probe_transport_header(skb, 0); | 1197 | skb_probe_transport_header(skb, 0); |
| 1184 | 1198 | ||
| 1185 | rxhash = skb_get_hash(skb); | 1199 | rxhash = skb_get_hash(skb); |
| @@ -1251,8 +1265,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
| 1251 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 1265 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
| 1252 | else if (sinfo->gso_type & SKB_GSO_TCPV6) | 1266 | else if (sinfo->gso_type & SKB_GSO_TCPV6) |
| 1253 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 1267 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
| 1254 | else if (sinfo->gso_type & SKB_GSO_UDP) | ||
| 1255 | gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; | ||
| 1256 | else { | 1268 | else { |
| 1257 | pr_err("unexpected GSO type: " | 1269 | pr_err("unexpected GSO type: " |
| 1258 | "0x%x, gso_size %d, hdr_len %d\n", | 1270 | "0x%x, gso_size %d, hdr_len %d\n", |
| @@ -1762,11 +1774,6 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) | |||
| 1762 | features |= NETIF_F_TSO6; | 1774 | features |= NETIF_F_TSO6; |
| 1763 | arg &= ~(TUN_F_TSO4|TUN_F_TSO6); | 1775 | arg &= ~(TUN_F_TSO4|TUN_F_TSO6); |
| 1764 | } | 1776 | } |
| 1765 | |||
| 1766 | if (arg & TUN_F_UFO) { | ||
| 1767 | features |= NETIF_F_UFO; | ||
| 1768 | arg &= ~TUN_F_UFO; | ||
| 1769 | } | ||
| 1770 | } | 1777 | } |
| 1771 | 1778 | ||
| 1772 | /* This gives the user a way to test for new features in future by | 1779 | /* This gives the user a way to test for new features in future by |
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index be4275721039..e6338c16081a 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c | |||
| @@ -937,6 +937,7 @@ static int ax88179_set_mac_addr(struct net_device *net, void *p) | |||
| 937 | { | 937 | { |
| 938 | struct usbnet *dev = netdev_priv(net); | 938 | struct usbnet *dev = netdev_priv(net); |
| 939 | struct sockaddr *addr = p; | 939 | struct sockaddr *addr = p; |
| 940 | int ret; | ||
| 940 | 941 | ||
| 941 | if (netif_running(net)) | 942 | if (netif_running(net)) |
| 942 | return -EBUSY; | 943 | return -EBUSY; |
| @@ -946,8 +947,12 @@ static int ax88179_set_mac_addr(struct net_device *net, void *p) | |||
| 946 | memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); | 947 | memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); |
| 947 | 948 | ||
| 948 | /* Set the MAC address */ | 949 | /* Set the MAC address */ |
| 949 | return ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, | 950 | ret = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, |
| 950 | ETH_ALEN, net->dev_addr); | 951 | ETH_ALEN, net->dev_addr); |
| 952 | if (ret < 0) | ||
| 953 | return ret; | ||
| 954 | |||
| 955 | return 0; | ||
| 951 | } | 956 | } |
| 952 | 957 | ||
| 953 | static const struct net_device_ops ax88179_netdev_ops = { | 958 | static const struct net_device_ops ax88179_netdev_ops = { |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 2a32d9167d3b..d3920b54a92c 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
| @@ -67,6 +67,35 @@ static const u8 mbm_guid[16] = { | |||
| 67 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, | 67 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | static void usbnet_cdc_update_filter(struct usbnet *dev) | ||
| 71 | { | ||
| 72 | struct cdc_state *info = (void *) &dev->data; | ||
| 73 | struct usb_interface *intf = info->control; | ||
| 74 | |||
| 75 | u16 cdc_filter = | ||
| 76 | USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | | ||
| 77 | USB_CDC_PACKET_TYPE_BROADCAST; | ||
| 78 | |||
| 79 | if (dev->net->flags & IFF_PROMISC) | ||
| 80 | cdc_filter |= USB_CDC_PACKET_TYPE_PROMISCUOUS; | ||
| 81 | |||
| 82 | /* FIXME cdc-ether has some multicast code too, though it complains | ||
| 83 | * in routine cases. info->ether describes the multicast support. | ||
| 84 | * Implement that here, manipulating the cdc filter as needed. | ||
| 85 | */ | ||
| 86 | |||
| 87 | usb_control_msg(dev->udev, | ||
| 88 | usb_sndctrlpipe(dev->udev, 0), | ||
| 89 | USB_CDC_SET_ETHERNET_PACKET_FILTER, | ||
| 90 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 91 | cdc_filter, | ||
| 92 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
| 93 | NULL, | ||
| 94 | 0, | ||
| 95 | USB_CTRL_SET_TIMEOUT | ||
| 96 | ); | ||
| 97 | } | ||
| 98 | |||
| 70 | /* probes control interface, claims data interface, collects the bulk | 99 | /* probes control interface, claims data interface, collects the bulk |
| 71 | * endpoints, activates data interface (if needed), maybe sets MTU. | 100 | * endpoints, activates data interface (if needed), maybe sets MTU. |
| 72 | * all pure cdc, except for certain firmware workarounds, and knowing | 101 | * all pure cdc, except for certain firmware workarounds, and knowing |
| @@ -347,16 +376,8 @@ next_desc: | |||
| 347 | * don't do reset all the way. So the packet filter should | 376 | * don't do reset all the way. So the packet filter should |
| 348 | * be set to a sane initial value. | 377 | * be set to a sane initial value. |
| 349 | */ | 378 | */ |
| 350 | usb_control_msg(dev->udev, | 379 | usbnet_cdc_update_filter(dev); |
| 351 | usb_sndctrlpipe(dev->udev, 0), | 380 | |
| 352 | USB_CDC_SET_ETHERNET_PACKET_FILTER, | ||
| 353 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 354 | USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST, | ||
| 355 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
| 356 | NULL, | ||
| 357 | 0, | ||
| 358 | USB_CTRL_SET_TIMEOUT | ||
| 359 | ); | ||
| 360 | return 0; | 381 | return 0; |
| 361 | 382 | ||
| 362 | bad_desc: | 383 | bad_desc: |
| @@ -468,10 +489,6 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 468 | return status; | 489 | return status; |
| 469 | } | 490 | } |
| 470 | 491 | ||
| 471 | /* FIXME cdc-ether has some multicast code too, though it complains | ||
| 472 | * in routine cases. info->ether describes the multicast support. | ||
| 473 | * Implement that here, manipulating the cdc filter as needed. | ||
| 474 | */ | ||
| 475 | return 0; | 492 | return 0; |
| 476 | } | 493 | } |
| 477 | EXPORT_SYMBOL_GPL(usbnet_cdc_bind); | 494 | EXPORT_SYMBOL_GPL(usbnet_cdc_bind); |
| @@ -482,6 +499,7 @@ static const struct driver_info cdc_info = { | |||
| 482 | .bind = usbnet_cdc_bind, | 499 | .bind = usbnet_cdc_bind, |
| 483 | .unbind = usbnet_cdc_unbind, | 500 | .unbind = usbnet_cdc_unbind, |
| 484 | .status = usbnet_cdc_status, | 501 | .status = usbnet_cdc_status, |
| 502 | .set_rx_mode = usbnet_cdc_update_filter, | ||
| 485 | .manage_power = usbnet_manage_power, | 503 | .manage_power = usbnet_manage_power, |
| 486 | }; | 504 | }; |
| 487 | 505 | ||
| @@ -491,6 +509,7 @@ static const struct driver_info wwan_info = { | |||
| 491 | .bind = usbnet_cdc_bind, | 509 | .bind = usbnet_cdc_bind, |
| 492 | .unbind = usbnet_cdc_unbind, | 510 | .unbind = usbnet_cdc_unbind, |
| 493 | .status = usbnet_cdc_status, | 511 | .status = usbnet_cdc_status, |
| 512 | .set_rx_mode = usbnet_cdc_update_filter, | ||
| 494 | .manage_power = usbnet_manage_power, | 513 | .manage_power = usbnet_manage_power, |
| 495 | }; | 514 | }; |
| 496 | 515 | ||
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e3d84c322e4e..c6554c7a8147 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
| @@ -1162,6 +1162,9 @@ static void intr_callback(struct urb *urb) | |||
| 1162 | case -ESHUTDOWN: | 1162 | case -ESHUTDOWN: |
| 1163 | netif_device_detach(tp->netdev); | 1163 | netif_device_detach(tp->netdev); |
| 1164 | case -ENOENT: | 1164 | case -ENOENT: |
| 1165 | case -EPROTO: | ||
| 1166 | netif_info(tp, intr, tp->netdev, | ||
| 1167 | "Stop submitting intr, status %d\n", status); | ||
| 1165 | return; | 1168 | return; |
| 1166 | case -EOVERFLOW: | 1169 | case -EOVERFLOW: |
| 1167 | netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); | 1170 | netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); |
| @@ -2891,6 +2894,9 @@ static int rtl8152_open(struct net_device *netdev) | |||
| 2891 | if (res) | 2894 | if (res) |
| 2892 | goto out; | 2895 | goto out; |
| 2893 | 2896 | ||
| 2897 | /* set speed to 0 to avoid autoresume try to submit rx */ | ||
| 2898 | tp->speed = 0; | ||
| 2899 | |||
| 2894 | res = usb_autopm_get_interface(tp->intf); | 2900 | res = usb_autopm_get_interface(tp->intf); |
| 2895 | if (res < 0) { | 2901 | if (res < 0) { |
| 2896 | free_all_mem(tp); | 2902 | free_all_mem(tp); |
| @@ -2904,6 +2910,8 @@ static int rtl8152_open(struct net_device *netdev) | |||
| 2904 | clear_bit(WORK_ENABLE, &tp->flags); | 2910 | clear_bit(WORK_ENABLE, &tp->flags); |
| 2905 | usb_kill_urb(tp->intr_urb); | 2911 | usb_kill_urb(tp->intr_urb); |
| 2906 | cancel_delayed_work_sync(&tp->schedule); | 2912 | cancel_delayed_work_sync(&tp->schedule); |
| 2913 | |||
| 2914 | /* disable the tx/rx, if the workqueue has enabled them. */ | ||
| 2907 | if (tp->speed & LINK_STATUS) | 2915 | if (tp->speed & LINK_STATUS) |
| 2908 | tp->rtl_ops.disable(tp); | 2916 | tp->rtl_ops.disable(tp); |
| 2909 | } | 2917 | } |
| @@ -2955,10 +2963,7 @@ static int rtl8152_close(struct net_device *netdev) | |||
| 2955 | * be disable when autoresume occurs, because the | 2963 | * be disable when autoresume occurs, because the |
| 2956 | * netif_running() would be false. | 2964 | * netif_running() would be false. |
| 2957 | */ | 2965 | */ |
| 2958 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 2966 | rtl_runtime_suspend_enable(tp, false); |
| 2959 | rtl_runtime_suspend_enable(tp, false); | ||
| 2960 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | ||
| 2961 | } | ||
| 2962 | 2967 | ||
| 2963 | tasklet_disable(&tp->tl); | 2968 | tasklet_disable(&tp->tl); |
| 2964 | tp->rtl_ops.down(tp); | 2969 | tp->rtl_ops.down(tp); |
| @@ -3205,7 +3210,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 3205 | netif_device_detach(netdev); | 3210 | netif_device_detach(netdev); |
| 3206 | } | 3211 | } |
| 3207 | 3212 | ||
| 3208 | if (netif_running(netdev)) { | 3213 | if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) { |
| 3209 | clear_bit(WORK_ENABLE, &tp->flags); | 3214 | clear_bit(WORK_ENABLE, &tp->flags); |
| 3210 | usb_kill_urb(tp->intr_urb); | 3215 | usb_kill_urb(tp->intr_urb); |
| 3211 | tasklet_disable(&tp->tl); | 3216 | tasklet_disable(&tp->tl); |
| @@ -3253,6 +3258,8 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
| 3253 | set_bit(WORK_ENABLE, &tp->flags); | 3258 | set_bit(WORK_ENABLE, &tp->flags); |
| 3254 | } | 3259 | } |
| 3255 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3260 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
| 3261 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | ||
| 3262 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | ||
| 3256 | } | 3263 | } |
| 3257 | 3264 | ||
| 3258 | mutex_unlock(&tp->control); | 3265 | mutex_unlock(&tp->control); |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 20615bbd693b..3a6770a65d78 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -1052,6 +1052,21 @@ static void __handle_link_change(struct usbnet *dev) | |||
| 1052 | clear_bit(EVENT_LINK_CHANGE, &dev->flags); | 1052 | clear_bit(EVENT_LINK_CHANGE, &dev->flags); |
| 1053 | } | 1053 | } |
| 1054 | 1054 | ||
| 1055 | static void usbnet_set_rx_mode(struct net_device *net) | ||
| 1056 | { | ||
| 1057 | struct usbnet *dev = netdev_priv(net); | ||
| 1058 | |||
| 1059 | usbnet_defer_kevent(dev, EVENT_SET_RX_MODE); | ||
| 1060 | } | ||
| 1061 | |||
| 1062 | static void __handle_set_rx_mode(struct usbnet *dev) | ||
| 1063 | { | ||
| 1064 | if (dev->driver_info->set_rx_mode) | ||
| 1065 | (dev->driver_info->set_rx_mode)(dev); | ||
| 1066 | |||
| 1067 | clear_bit(EVENT_SET_RX_MODE, &dev->flags); | ||
| 1068 | } | ||
| 1069 | |||
| 1055 | /* work that cannot be done in interrupt context uses keventd. | 1070 | /* work that cannot be done in interrupt context uses keventd. |
| 1056 | * | 1071 | * |
| 1057 | * NOTE: with 2.5 we could do more of this using completion callbacks, | 1072 | * NOTE: with 2.5 we could do more of this using completion callbacks, |
| @@ -1157,6 +1172,10 @@ skip_reset: | |||
| 1157 | if (test_bit (EVENT_LINK_CHANGE, &dev->flags)) | 1172 | if (test_bit (EVENT_LINK_CHANGE, &dev->flags)) |
| 1158 | __handle_link_change(dev); | 1173 | __handle_link_change(dev); |
| 1159 | 1174 | ||
| 1175 | if (test_bit (EVENT_SET_RX_MODE, &dev->flags)) | ||
| 1176 | __handle_set_rx_mode(dev); | ||
| 1177 | |||
| 1178 | |||
| 1160 | if (dev->flags) | 1179 | if (dev->flags) |
| 1161 | netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags); | 1180 | netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags); |
| 1162 | } | 1181 | } |
| @@ -1525,6 +1544,7 @@ static const struct net_device_ops usbnet_netdev_ops = { | |||
| 1525 | .ndo_stop = usbnet_stop, | 1544 | .ndo_stop = usbnet_stop, |
| 1526 | .ndo_start_xmit = usbnet_start_xmit, | 1545 | .ndo_start_xmit = usbnet_start_xmit, |
| 1527 | .ndo_tx_timeout = usbnet_tx_timeout, | 1546 | .ndo_tx_timeout = usbnet_tx_timeout, |
| 1547 | .ndo_set_rx_mode = usbnet_set_rx_mode, | ||
| 1528 | .ndo_change_mtu = usbnet_change_mtu, | 1548 | .ndo_change_mtu = usbnet_change_mtu, |
| 1529 | .ndo_set_mac_address = eth_mac_addr, | 1549 | .ndo_set_mac_address = eth_mac_addr, |
| 1530 | .ndo_validate_addr = eth_validate_addr, | 1550 | .ndo_validate_addr = eth_validate_addr, |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d75256bd1a6a..ec2a8b41ed41 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -491,8 +491,17 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
| 491 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 491 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
| 492 | break; | 492 | break; |
| 493 | case VIRTIO_NET_HDR_GSO_UDP: | 493 | case VIRTIO_NET_HDR_GSO_UDP: |
| 494 | { | ||
| 495 | static bool warned; | ||
| 496 | |||
| 497 | if (!warned) { | ||
| 498 | warned = true; | ||
| 499 | netdev_warn(dev, | ||
| 500 | "host using disabled UFO feature; please fix it\n"); | ||
| 501 | } | ||
| 494 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 502 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
| 495 | break; | 503 | break; |
| 504 | } | ||
| 496 | case VIRTIO_NET_HDR_GSO_TCPV6: | 505 | case VIRTIO_NET_HDR_GSO_TCPV6: |
| 497 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 506 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
| 498 | break; | 507 | break; |
| @@ -881,8 +890,6 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) | |||
| 881 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 890 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
| 882 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 891 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
| 883 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 892 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
| 884 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) | ||
| 885 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_UDP; | ||
| 886 | else | 893 | else |
| 887 | BUG(); | 894 | BUG(); |
| 888 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) | 895 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) |
| @@ -1705,7 +1712,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1705 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; | 1712 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; |
| 1706 | 1713 | ||
| 1707 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { | 1714 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { |
| 1708 | dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO | 1715 | dev->hw_features |= NETIF_F_TSO |
| 1709 | | NETIF_F_TSO_ECN | NETIF_F_TSO6; | 1716 | | NETIF_F_TSO_ECN | NETIF_F_TSO6; |
| 1710 | } | 1717 | } |
| 1711 | /* Individual feature bits: what can host handle? */ | 1718 | /* Individual feature bits: what can host handle? */ |
| @@ -1715,11 +1722,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1715 | dev->hw_features |= NETIF_F_TSO6; | 1722 | dev->hw_features |= NETIF_F_TSO6; |
| 1716 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) | 1723 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) |
| 1717 | dev->hw_features |= NETIF_F_TSO_ECN; | 1724 | dev->hw_features |= NETIF_F_TSO_ECN; |
| 1718 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO)) | ||
| 1719 | dev->hw_features |= NETIF_F_UFO; | ||
| 1720 | 1725 | ||
| 1721 | if (gso) | 1726 | if (gso) |
| 1722 | dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); | 1727 | dev->features |= dev->hw_features & NETIF_F_ALL_TSO; |
| 1723 | /* (!csum && gso) case will be fixed by register_netdev() */ | 1728 | /* (!csum && gso) case will be fixed by register_netdev() */ |
| 1724 | } | 1729 | } |
| 1725 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) | 1730 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) |
| @@ -1757,8 +1762,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1757 | /* If we can receive ANY GSO packets, we must allocate large ones. */ | 1762 | /* If we can receive ANY GSO packets, we must allocate large ones. */ |
| 1758 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || | 1763 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || |
| 1759 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || | 1764 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || |
| 1760 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || | 1765 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) |
| 1761 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) | ||
| 1762 | vi->big_packets = true; | 1766 | vi->big_packets = true; |
| 1763 | 1767 | ||
| 1764 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) | 1768 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) |
| @@ -1952,9 +1956,9 @@ static struct virtio_device_id id_table[] = { | |||
| 1952 | static unsigned int features[] = { | 1956 | static unsigned int features[] = { |
| 1953 | VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, | 1957 | VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, |
| 1954 | VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, | 1958 | VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, |
| 1955 | VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, | 1959 | VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_TSO6, |
| 1956 | VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, | 1960 | VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, |
| 1957 | VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, | 1961 | VIRTIO_NET_F_GUEST_ECN, |
| 1958 | VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, | 1962 | VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, |
| 1959 | VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, | 1963 | VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, |
| 1960 | VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, | 1964 | VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, |
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index e5ba6faf3281..86907e5ba6ca 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
| @@ -80,6 +80,7 @@ struct reg_dmn_pair_mapping { | |||
| 80 | 80 | ||
| 81 | struct ath_regulatory { | 81 | struct ath_regulatory { |
| 82 | char alpha2[2]; | 82 | char alpha2[2]; |
| 83 | enum nl80211_dfs_regions region; | ||
| 83 | u16 country_code; | 84 | u16 country_code; |
| 84 | u16 max_power_level; | 85 | u16 max_power_level; |
| 85 | u16 current_rd; | 86 | u16 current_rd; |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index c6dd7f1fed65..33b0c7aef2ea 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
| @@ -368,11 +368,11 @@ void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, | |||
| 368 | { | 368 | { |
| 369 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 369 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
| 370 | 370 | ||
| 371 | if (reg->power_limit != new_txpow) { | 371 | if (reg->power_limit != new_txpow) |
| 372 | ath9k_hw_set_txpowerlimit(ah, new_txpow, false); | 372 | ath9k_hw_set_txpowerlimit(ah, new_txpow, false); |
| 373 | /* read back in case value is clamped */ | 373 | |
| 374 | *txpower = reg->max_power_level; | 374 | /* read back in case value is clamped */ |
| 375 | } | 375 | *txpower = reg->max_power_level; |
| 376 | } | 376 | } |
| 377 | EXPORT_SYMBOL(ath9k_cmn_update_txpow); | 377 | EXPORT_SYMBOL(ath9k_cmn_update_txpow); |
| 378 | 378 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 46f20a309b5f..5c45e787814e 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
| @@ -455,7 +455,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
| 455 | "%2d %2x %1x %2x %2x\n", | 455 | "%2d %2x %1x %2x %2x\n", |
| 456 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, | 456 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, |
| 457 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), | 457 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), |
| 458 | val[2] & (0x7 << (i * 3)) >> (i * 3), | 458 | (val[2] & (0x7 << (i * 3))) >> (i * 3), |
| 459 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); | 459 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); |
| 460 | } | 460 | } |
| 461 | 461 | ||
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 156a944134dc..3bd030494986 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
| @@ -734,6 +734,32 @@ static const struct ieee80211_iface_combination if_comb[] = { | |||
| 734 | #endif | 734 | #endif |
| 735 | }; | 735 | }; |
| 736 | 736 | ||
| 737 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
| 738 | static void ath9k_set_mcc_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | ||
| 739 | { | ||
| 740 | struct ath_hw *ah = sc->sc_ah; | ||
| 741 | struct ath_common *common = ath9k_hw_common(ah); | ||
| 742 | |||
| 743 | if (!ath9k_is_chanctx_enabled()) | ||
| 744 | return; | ||
| 745 | |||
| 746 | hw->flags |= IEEE80211_HW_QUEUE_CONTROL; | ||
| 747 | hw->queues = ATH9K_NUM_TX_QUEUES; | ||
| 748 | hw->offchannel_tx_hw_queue = hw->queues - 1; | ||
| 749 | hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); | ||
| 750 | hw->wiphy->iface_combinations = if_comb_multi; | ||
| 751 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); | ||
| 752 | hw->wiphy->max_scan_ssids = 255; | ||
| 753 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | ||
| 754 | hw->wiphy->max_remain_on_channel_duration = 10000; | ||
| 755 | hw->chanctx_data_size = sizeof(void *); | ||
| 756 | hw->extra_beacon_tailroom = | ||
| 757 | sizeof(struct ieee80211_p2p_noa_attr) + 9; | ||
| 758 | |||
| 759 | ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); | ||
| 760 | } | ||
| 761 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
| 762 | |||
| 737 | static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | 763 | static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
| 738 | { | 764 | { |
| 739 | struct ath_hw *ah = sc->sc_ah; | 765 | struct ath_hw *ah = sc->sc_ah; |
| @@ -746,7 +772,6 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
| 746 | IEEE80211_HW_SPECTRUM_MGMT | | 772 | IEEE80211_HW_SPECTRUM_MGMT | |
| 747 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | | 773 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
| 748 | IEEE80211_HW_SUPPORTS_RC_TABLE | | 774 | IEEE80211_HW_SUPPORTS_RC_TABLE | |
| 749 | IEEE80211_HW_QUEUE_CONTROL | | ||
| 750 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; | 775 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; |
| 751 | 776 | ||
| 752 | if (ath9k_ps_enable) | 777 | if (ath9k_ps_enable) |
| @@ -781,24 +806,6 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
| 781 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | 806 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); |
| 782 | } | 807 | } |
| 783 | 808 | ||
| 784 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
| 785 | |||
| 786 | if (ath9k_is_chanctx_enabled()) { | ||
| 787 | hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); | ||
| 788 | hw->wiphy->iface_combinations = if_comb_multi; | ||
| 789 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); | ||
| 790 | hw->wiphy->max_scan_ssids = 255; | ||
| 791 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | ||
| 792 | hw->wiphy->max_remain_on_channel_duration = 10000; | ||
| 793 | hw->chanctx_data_size = sizeof(void *); | ||
| 794 | hw->extra_beacon_tailroom = | ||
| 795 | sizeof(struct ieee80211_p2p_noa_attr) + 9; | ||
| 796 | |||
| 797 | ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); | ||
| 798 | } | ||
| 799 | |||
| 800 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
| 801 | |||
| 802 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 809 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
| 803 | 810 | ||
| 804 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 811 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
| @@ -808,12 +815,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
| 808 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; | 815 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; |
| 809 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; | 816 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; |
| 810 | 817 | ||
| 811 | /* allow 4 queues per channel context + | 818 | hw->queues = 4; |
| 812 | * 1 cab queue + 1 offchannel tx queue | ||
| 813 | */ | ||
| 814 | hw->queues = ATH9K_NUM_TX_QUEUES; | ||
| 815 | /* last queue for offchannel */ | ||
| 816 | hw->offchannel_tx_hw_queue = hw->queues - 1; | ||
| 817 | hw->max_rates = 4; | 819 | hw->max_rates = 4; |
| 818 | hw->max_listen_interval = 10; | 820 | hw->max_listen_interval = 10; |
| 819 | hw->max_rate_tries = 10; | 821 | hw->max_rate_tries = 10; |
| @@ -837,6 +839,9 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
| 837 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 839 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
| 838 | &common->sbands[IEEE80211_BAND_5GHZ]; | 840 | &common->sbands[IEEE80211_BAND_5GHZ]; |
| 839 | 841 | ||
| 842 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
| 843 | ath9k_set_mcc_capab(sc, hw); | ||
| 844 | #endif | ||
| 840 | ath9k_init_wow(hw); | 845 | ath9k_init_wow(hw); |
| 841 | ath9k_cmn_reload_chainmask(ah); | 846 | ath9k_cmn_reload_chainmask(ah); |
| 842 | 847 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6f6a974f7fdb..30c66dfcd7a0 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -1162,6 +1162,9 @@ static void ath9k_assign_hw_queues(struct ieee80211_hw *hw, | |||
| 1162 | { | 1162 | { |
| 1163 | int i; | 1163 | int i; |
| 1164 | 1164 | ||
| 1165 | if (!ath9k_is_chanctx_enabled()) | ||
| 1166 | return; | ||
| 1167 | |||
| 1165 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | 1168 | for (i = 0; i < IEEE80211_NUM_ACS; i++) |
| 1166 | vif->hw_queue[i] = i; | 1169 | vif->hw_queue[i] = i; |
| 1167 | 1170 | ||
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 493a183d0aaf..d6e54a3c88f6 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
| @@ -169,7 +169,10 @@ static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, | |||
| 169 | 169 | ||
| 170 | if (txq->stopped && | 170 | if (txq->stopped && |
| 171 | txq->pending_frames < sc->tx.txq_max_pending[q]) { | 171 | txq->pending_frames < sc->tx.txq_max_pending[q]) { |
| 172 | ieee80211_wake_queue(sc->hw, info->hw_queue); | 172 | if (ath9k_is_chanctx_enabled()) |
| 173 | ieee80211_wake_queue(sc->hw, info->hw_queue); | ||
| 174 | else | ||
| 175 | ieee80211_wake_queue(sc->hw, q); | ||
| 173 | txq->stopped = false; | 176 | txq->stopped = false; |
| 174 | } | 177 | } |
| 175 | } | 178 | } |
| @@ -2247,7 +2250,10 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
| 2247 | fi->txq = q; | 2250 | fi->txq = q; |
| 2248 | if (++txq->pending_frames > sc->tx.txq_max_pending[q] && | 2251 | if (++txq->pending_frames > sc->tx.txq_max_pending[q] && |
| 2249 | !txq->stopped) { | 2252 | !txq->stopped) { |
| 2250 | ieee80211_stop_queue(sc->hw, info->hw_queue); | 2253 | if (ath9k_is_chanctx_enabled()) |
| 2254 | ieee80211_stop_queue(sc->hw, info->hw_queue); | ||
| 2255 | else | ||
| 2256 | ieee80211_stop_queue(sc->hw, q); | ||
| 2251 | txq->stopped = true; | 2257 | txq->stopped = true; |
| 2252 | } | 2258 | } |
| 2253 | } | 2259 | } |
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index 415393dfb6fc..06ea6cc9e30a 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c | |||
| @@ -515,6 +515,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy, | |||
| 515 | if (!request) | 515 | if (!request) |
| 516 | return; | 516 | return; |
| 517 | 517 | ||
| 518 | reg->region = request->dfs_region; | ||
| 518 | switch (request->initiator) { | 519 | switch (request->initiator) { |
| 519 | case NL80211_REGDOM_SET_BY_CORE: | 520 | case NL80211_REGDOM_SET_BY_CORE: |
| 520 | /* | 521 | /* |
| @@ -779,6 +780,19 @@ u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, | |||
| 779 | return SD_NO_CTL; | 780 | return SD_NO_CTL; |
| 780 | } | 781 | } |
| 781 | 782 | ||
| 783 | if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) { | ||
| 784 | switch (reg->region) { | ||
| 785 | case NL80211_DFS_FCC: | ||
| 786 | return CTL_FCC; | ||
| 787 | case NL80211_DFS_ETSI: | ||
| 788 | return CTL_ETSI; | ||
| 789 | case NL80211_DFS_JP: | ||
| 790 | return CTL_MKK; | ||
| 791 | default: | ||
| 792 | break; | ||
| 793 | } | ||
| 794 | } | ||
| 795 | |||
| 782 | switch (band) { | 796 | switch (band) { |
| 783 | case IEEE80211_BAND_2GHZ: | 797 | case IEEE80211_BAND_2GHZ: |
| 784 | return reg->regpair->reg_2ghz_ctl; | 798 | return reg->regpair->reg_2ghz_ctl; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index f55f625fd06b..d20d4e6f391a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
| @@ -670,7 +670,6 @@ static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci, | |||
| 670 | struct brcmf_sdio_dev *sdiodev) | 670 | struct brcmf_sdio_dev *sdiodev) |
| 671 | { | 671 | { |
| 672 | int i; | 672 | int i; |
| 673 | uint fw_len, nv_len; | ||
| 674 | char end; | 673 | char end; |
| 675 | 674 | ||
| 676 | for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { | 675 | for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { |
| @@ -684,25 +683,25 @@ static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci, | |||
| 684 | return -ENODEV; | 683 | return -ENODEV; |
| 685 | } | 684 | } |
| 686 | 685 | ||
| 687 | fw_len = sizeof(sdiodev->fw_name) - 1; | ||
| 688 | nv_len = sizeof(sdiodev->nvram_name) - 1; | ||
| 689 | /* check if firmware path is provided by module parameter */ | 686 | /* check if firmware path is provided by module parameter */ |
| 690 | if (brcmf_firmware_path[0] != '\0') { | 687 | if (brcmf_firmware_path[0] != '\0') { |
| 691 | strncpy(sdiodev->fw_name, brcmf_firmware_path, fw_len); | 688 | strlcpy(sdiodev->fw_name, brcmf_firmware_path, |
| 692 | strncpy(sdiodev->nvram_name, brcmf_firmware_path, nv_len); | 689 | sizeof(sdiodev->fw_name)); |
| 693 | fw_len -= strlen(sdiodev->fw_name); | 690 | strlcpy(sdiodev->nvram_name, brcmf_firmware_path, |
| 694 | nv_len -= strlen(sdiodev->nvram_name); | 691 | sizeof(sdiodev->nvram_name)); |
| 695 | 692 | ||
| 696 | end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1]; | 693 | end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1]; |
| 697 | if (end != '/') { | 694 | if (end != '/') { |
| 698 | strncat(sdiodev->fw_name, "/", fw_len); | 695 | strlcat(sdiodev->fw_name, "/", |
| 699 | strncat(sdiodev->nvram_name, "/", nv_len); | 696 | sizeof(sdiodev->fw_name)); |
| 700 | fw_len--; | 697 | strlcat(sdiodev->nvram_name, "/", |
| 701 | nv_len--; | 698 | sizeof(sdiodev->nvram_name)); |
| 702 | } | 699 | } |
| 703 | } | 700 | } |
| 704 | strncat(sdiodev->fw_name, brcmf_fwname_data[i].bin, fw_len); | 701 | strlcat(sdiodev->fw_name, brcmf_fwname_data[i].bin, |
| 705 | strncat(sdiodev->nvram_name, brcmf_fwname_data[i].nv, nv_len); | 702 | sizeof(sdiodev->fw_name)); |
| 703 | strlcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv, | ||
| 704 | sizeof(sdiodev->nvram_name)); | ||
| 706 | 705 | ||
| 707 | return 0; | 706 | return 0; |
| 708 | } | 707 | } |
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index 2364a3c09b9e..cae692ff1013 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
| @@ -1095,6 +1095,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 1095 | u32 queues, bool drop) | 1095 | u32 queues, bool drop) |
| 1096 | { | 1096 | { |
| 1097 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 1097 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
| 1098 | u32 scd_queues; | ||
| 1098 | 1099 | ||
| 1099 | mutex_lock(&priv->mutex); | 1100 | mutex_lock(&priv->mutex); |
| 1100 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 1101 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
| @@ -1108,18 +1109,19 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 1108 | goto done; | 1109 | goto done; |
| 1109 | } | 1110 | } |
| 1110 | 1111 | ||
| 1111 | /* | 1112 | scd_queues = BIT(priv->cfg->base_params->num_of_queues) - 1; |
| 1112 | * mac80211 will not push any more frames for transmit | 1113 | scd_queues &= ~(BIT(IWL_IPAN_CMD_QUEUE_NUM) | |
| 1113 | * until the flush is completed | 1114 | BIT(IWL_DEFAULT_CMD_QUEUE_NUM)); |
| 1114 | */ | 1115 | |
| 1115 | if (drop) { | 1116 | if (vif) |
| 1116 | IWL_DEBUG_MAC80211(priv, "send flush command\n"); | 1117 | scd_queues &= ~BIT(vif->hw_queue[IEEE80211_AC_VO]); |
| 1117 | if (iwlagn_txfifo_flush(priv, 0)) { | 1118 | |
| 1118 | IWL_ERR(priv, "flush request fail\n"); | 1119 | IWL_DEBUG_TX_QUEUES(priv, "Flushing SCD queues: 0x%x\n", scd_queues); |
| 1119 | goto done; | 1120 | if (iwlagn_txfifo_flush(priv, scd_queues)) { |
| 1120 | } | 1121 | IWL_ERR(priv, "flush request fail\n"); |
| 1122 | goto done; | ||
| 1121 | } | 1123 | } |
| 1122 | IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); | 1124 | IWL_DEBUG_TX_QUEUES(priv, "wait transmit/flush all frames\n"); |
| 1123 | iwl_trans_wait_tx_queue_empty(priv->trans, 0xffffffff); | 1125 | iwl_trans_wait_tx_queue_empty(priv->trans, 0xffffffff); |
| 1124 | done: | 1126 | done: |
| 1125 | mutex_unlock(&priv->mutex); | 1127 | mutex_unlock(&priv->mutex); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index e4351487ca72..d2b7234b1c73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
| @@ -82,7 +82,8 @@ | |||
| 82 | #define IWL8000_TX_POWER_VERSION 0xffff /* meaningless */ | 82 | #define IWL8000_TX_POWER_VERSION 0xffff /* meaningless */ |
| 83 | 83 | ||
| 84 | #define IWL8000_FW_PRE "iwlwifi-8000" | 84 | #define IWL8000_FW_PRE "iwlwifi-8000" |
| 85 | #define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode" | 85 | #define IWL8000_MODULE_FIRMWARE(api) \ |
| 86 | IWL8000_FW_PRE "-" __stringify(api) ".ucode" | ||
| 86 | 87 | ||
| 87 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 | 88 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 |
| 88 | #define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin" | 89 | #define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 9eb85249e89c..d8fc548c0d6c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
| @@ -563,6 +563,7 @@ enum iwl_trans_state { | |||
| 563 | * Set during transport allocation. | 563 | * Set during transport allocation. |
| 564 | * @hw_id_str: a string with info about HW ID. Set during transport allocation. | 564 | * @hw_id_str: a string with info about HW ID. Set during transport allocation. |
| 565 | * @pm_support: set to true in start_hw if link pm is supported | 565 | * @pm_support: set to true in start_hw if link pm is supported |
| 566 | * @ltr_enabled: set to true if the LTR is enabled | ||
| 566 | * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. | 567 | * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. |
| 567 | * The user should use iwl_trans_{alloc,free}_tx_cmd. | 568 | * The user should use iwl_trans_{alloc,free}_tx_cmd. |
| 568 | * @dev_cmd_headroom: room needed for the transport's private use before the | 569 | * @dev_cmd_headroom: room needed for the transport's private use before the |
| @@ -589,6 +590,7 @@ struct iwl_trans { | |||
| 589 | u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; | 590 | u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; |
| 590 | 591 | ||
| 591 | bool pm_support; | 592 | bool pm_support; |
| 593 | bool ltr_enabled; | ||
| 592 | 594 | ||
| 593 | /* The following fields are internal only */ | 595 | /* The following fields are internal only */ |
| 594 | struct kmem_cache *dev_cmd_pool; | 596 | struct kmem_cache *dev_cmd_pool; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 8df2021f9856..da2ffb785194 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
| @@ -303,8 +303,8 @@ static const __le64 iwl_ci_mask[][3] = { | |||
| 303 | }; | 303 | }; |
| 304 | 304 | ||
| 305 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { | 305 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { |
| 306 | cpu_to_le32(0x28412201), | 306 | cpu_to_le32(0x2e402280), |
| 307 | cpu_to_le32(0x11118451), | 307 | cpu_to_le32(0x7711a751), |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | struct corunning_block_luts { | 310 | struct corunning_block_luts { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c index 585c0ab4a3ec..8a1d2f33d5b7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | |||
| @@ -291,8 +291,8 @@ static const __le64 iwl_ci_mask[][3] = { | |||
| 291 | }; | 291 | }; |
| 292 | 292 | ||
| 293 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { | 293 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { |
| 294 | cpu_to_le32(0x28412201), | 294 | cpu_to_le32(0x2e402280), |
| 295 | cpu_to_le32(0x11118451), | 295 | cpu_to_le32(0x7711a751), |
| 296 | }; | 296 | }; |
| 297 | 297 | ||
| 298 | struct corunning_block_luts { | 298 | struct corunning_block_luts { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h index 27dd86395b39..2fd8ad4633e0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h | |||
| @@ -68,13 +68,46 @@ | |||
| 68 | 68 | ||
| 69 | /* Power Management Commands, Responses, Notifications */ | 69 | /* Power Management Commands, Responses, Notifications */ |
| 70 | 70 | ||
| 71 | /** | ||
| 72 | * enum iwl_ltr_config_flags - masks for LTR config command flags | ||
| 73 | * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status | ||
| 74 | * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow | ||
| 75 | * memory access | ||
| 76 | * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR | ||
| 77 | * reg change | ||
| 78 | * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from | ||
| 79 | * D0 to D3 | ||
| 80 | * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register | ||
| 81 | * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register | ||
| 82 | * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD | ||
| 83 | */ | ||
| 84 | enum iwl_ltr_config_flags { | ||
| 85 | LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0), | ||
| 86 | LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1), | ||
| 87 | LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2), | ||
| 88 | LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3), | ||
| 89 | LTR_CFG_FLAG_SW_SET_SHORT = BIT(4), | ||
| 90 | LTR_CFG_FLAG_SW_SET_LONG = BIT(5), | ||
| 91 | LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6), | ||
| 92 | }; | ||
| 93 | |||
| 94 | /** | ||
| 95 | * struct iwl_ltr_config_cmd - configures the LTR | ||
| 96 | * @flags: See %enum iwl_ltr_config_flags | ||
| 97 | */ | ||
| 98 | struct iwl_ltr_config_cmd { | ||
| 99 | __le32 flags; | ||
| 100 | __le32 static_long; | ||
| 101 | __le32 static_short; | ||
| 102 | } __packed; | ||
| 103 | |||
| 71 | /* Radio LP RX Energy Threshold measured in dBm */ | 104 | /* Radio LP RX Energy Threshold measured in dBm */ |
| 72 | #define POWER_LPRX_RSSI_THRESHOLD 75 | 105 | #define POWER_LPRX_RSSI_THRESHOLD 75 |
| 73 | #define POWER_LPRX_RSSI_THRESHOLD_MAX 94 | 106 | #define POWER_LPRX_RSSI_THRESHOLD_MAX 94 |
| 74 | #define POWER_LPRX_RSSI_THRESHOLD_MIN 30 | 107 | #define POWER_LPRX_RSSI_THRESHOLD_MIN 30 |
| 75 | 108 | ||
| 76 | /** | 109 | /** |
| 77 | * enum iwl_scan_flags - masks for power table command flags | 110 | * enum iwl_power_flags - masks for power table command flags |
| 78 | * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off | 111 | * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off |
| 79 | * receiver and transmitter. '0' - does not allow. | 112 | * receiver and transmitter. '0' - does not allow. |
| 80 | * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, | 113 | * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 667a92274c87..c62575d86bcd 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
| @@ -157,6 +157,7 @@ enum { | |||
| 157 | /* Power - legacy power table command */ | 157 | /* Power - legacy power table command */ |
| 158 | POWER_TABLE_CMD = 0x77, | 158 | POWER_TABLE_CMD = 0x77, |
| 159 | PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78, | 159 | PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78, |
| 160 | LTR_CONFIG = 0xee, | ||
| 160 | 161 | ||
| 161 | /* Thermal Throttling*/ | 162 | /* Thermal Throttling*/ |
| 162 | REPLY_THERMAL_MNG_BACKOFF = 0x7e, | 163 | REPLY_THERMAL_MNG_BACKOFF = 0x7e, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index 23fd711a67e4..e0d9f19650b0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
| @@ -480,6 +480,15 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
| 480 | /* Initialize tx backoffs to the minimal possible */ | 480 | /* Initialize tx backoffs to the minimal possible */ |
| 481 | iwl_mvm_tt_tx_backoff(mvm, 0); | 481 | iwl_mvm_tt_tx_backoff(mvm, 0); |
| 482 | 482 | ||
| 483 | if (mvm->trans->ltr_enabled) { | ||
| 484 | struct iwl_ltr_config_cmd cmd = { | ||
| 485 | .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE), | ||
| 486 | }; | ||
| 487 | |||
| 488 | WARN_ON(iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, | ||
| 489 | sizeof(cmd), &cmd)); | ||
| 490 | } | ||
| 491 | |||
| 483 | ret = iwl_mvm_power_update_device(mvm); | 492 | ret = iwl_mvm_power_update_device(mvm); |
| 484 | if (ret) | 493 | if (ret) |
| 485 | goto error; | 494 | goto error; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index c7a73c68bdab..585fe5b7100f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
| @@ -526,7 +526,8 @@ static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, | |||
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && | 528 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && |
| 529 | !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) | 529 | !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status) && |
| 530 | !test_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) | ||
| 530 | goto drop; | 531 | goto drop; |
| 531 | 532 | ||
| 532 | /* treat non-bufferable MMPDUs as broadcast if sta is sleeping */ | 533 | /* treat non-bufferable MMPDUs as broadcast if sta is sleeping */ |
| @@ -1734,6 +1735,13 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm, | |||
| 1734 | if (changes & BSS_CHANGED_BEACON && | 1735 | if (changes & BSS_CHANGED_BEACON && |
| 1735 | iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) | 1736 | iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) |
| 1736 | IWL_WARN(mvm, "Failed updating beacon data\n"); | 1737 | IWL_WARN(mvm, "Failed updating beacon data\n"); |
| 1738 | |||
| 1739 | if (changes & BSS_CHANGED_TXPOWER) { | ||
| 1740 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", | ||
| 1741 | bss_conf->txpower); | ||
| 1742 | iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower); | ||
| 1743 | } | ||
| 1744 | |||
| 1737 | } | 1745 | } |
| 1738 | 1746 | ||
| 1739 | static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, | 1747 | static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, |
| @@ -2367,14 +2375,19 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, | |||
| 2367 | /* Set the node address */ | 2375 | /* Set the node address */ |
| 2368 | memcpy(aux_roc_req.node_addr, vif->addr, ETH_ALEN); | 2376 | memcpy(aux_roc_req.node_addr, vif->addr, ETH_ALEN); |
| 2369 | 2377 | ||
| 2378 | lockdep_assert_held(&mvm->mutex); | ||
| 2379 | |||
| 2380 | spin_lock_bh(&mvm->time_event_lock); | ||
| 2381 | |||
| 2382 | if (WARN_ON(te_data->id == HOT_SPOT_CMD)) { | ||
| 2383 | spin_unlock_bh(&mvm->time_event_lock); | ||
| 2384 | return -EIO; | ||
| 2385 | } | ||
| 2386 | |||
| 2370 | te_data->vif = vif; | 2387 | te_data->vif = vif; |
| 2371 | te_data->duration = duration; | 2388 | te_data->duration = duration; |
| 2372 | te_data->id = HOT_SPOT_CMD; | 2389 | te_data->id = HOT_SPOT_CMD; |
| 2373 | 2390 | ||
| 2374 | lockdep_assert_held(&mvm->mutex); | ||
| 2375 | |||
| 2376 | spin_lock_bh(&mvm->time_event_lock); | ||
| 2377 | list_add_tail(&te_data->list, &mvm->time_event_list); | ||
| 2378 | spin_unlock_bh(&mvm->time_event_lock); | 2391 | spin_unlock_bh(&mvm->time_event_lock); |
| 2379 | 2392 | ||
| 2380 | /* | 2393 | /* |
| @@ -2430,22 +2443,23 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw, | |||
| 2430 | IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, | 2443 | IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, |
| 2431 | duration, type); | 2444 | duration, type); |
| 2432 | 2445 | ||
| 2446 | mutex_lock(&mvm->mutex); | ||
| 2447 | |||
| 2433 | switch (vif->type) { | 2448 | switch (vif->type) { |
| 2434 | case NL80211_IFTYPE_STATION: | 2449 | case NL80211_IFTYPE_STATION: |
| 2435 | /* Use aux roc framework (HS20) */ | 2450 | /* Use aux roc framework (HS20) */ |
| 2436 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | 2451 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, |
| 2437 | vif, duration); | 2452 | vif, duration); |
| 2438 | return ret; | 2453 | goto out_unlock; |
| 2439 | case NL80211_IFTYPE_P2P_DEVICE: | 2454 | case NL80211_IFTYPE_P2P_DEVICE: |
| 2440 | /* handle below */ | 2455 | /* handle below */ |
| 2441 | break; | 2456 | break; |
| 2442 | default: | 2457 | default: |
| 2443 | IWL_ERR(mvm, "vif isn't P2P_DEVICE: %d\n", vif->type); | 2458 | IWL_ERR(mvm, "vif isn't P2P_DEVICE: %d\n", vif->type); |
| 2444 | return -EINVAL; | 2459 | ret = -EINVAL; |
| 2460 | goto out_unlock; | ||
| 2445 | } | 2461 | } |
| 2446 | 2462 | ||
| 2447 | mutex_lock(&mvm->mutex); | ||
| 2448 | |||
| 2449 | for (i = 0; i < NUM_PHY_CTX; i++) { | 2463 | for (i = 0; i < NUM_PHY_CTX; i++) { |
| 2450 | phy_ctxt = &mvm->phy_ctxts[i]; | 2464 | phy_ctxt = &mvm->phy_ctxts[i]; |
| 2451 | if (phy_ctxt->ref == 0 || mvmvif->phy_ctxt == phy_ctxt) | 2465 | if (phy_ctxt->ref == 0 || mvmvif->phy_ctxt == phy_ctxt) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 15aa298ee79c..48cb25a93591 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
| @@ -336,6 +336,7 @@ static const char *const iwl_mvm_cmd_strings[REPLY_MAX] = { | |||
| 336 | CMD(DTS_MEASUREMENT_NOTIFICATION), | 336 | CMD(DTS_MEASUREMENT_NOTIFICATION), |
| 337 | CMD(REPLY_THERMAL_MNG_BACKOFF), | 337 | CMD(REPLY_THERMAL_MNG_BACKOFF), |
| 338 | CMD(MAC_PM_POWER_TABLE), | 338 | CMD(MAC_PM_POWER_TABLE), |
| 339 | CMD(LTR_CONFIG), | ||
| 339 | CMD(BT_COEX_CI), | 340 | CMD(BT_COEX_CI), |
| 340 | CMD(BT_COEX_UPDATE_SW_BOOST), | 341 | CMD(BT_COEX_UPDATE_SW_BOOST), |
| 341 | CMD(BT_COEX_UPDATE_CORUN_LUT), | 342 | CMD(BT_COEX_UPDATE_CORUN_LUT), |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index cb85e63c20aa..b280d5d87127 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -459,7 +459,8 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm, | |||
| 459 | basic_ssid ? 1 : 0); | 459 | basic_ssid ? 1 : 0); |
| 460 | 460 | ||
| 461 | cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL | | 461 | cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL | |
| 462 | TX_CMD_FLG_BT_DIS); | 462 | 3 << TX_CMD_FLG_BT_PRIO_POS); |
| 463 | |||
| 463 | cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id; | 464 | cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id; |
| 464 | cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); | 465 | cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); |
| 465 | cmd->tx_cmd.rate_n_flags = | 466 | cmd->tx_cmd.rate_n_flags = |
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index b7f9e61d14e2..6dfad230be5e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
| @@ -305,8 +305,8 @@ static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm, | |||
| 305 | te_data->running = false; | 305 | te_data->running = false; |
| 306 | te_data->vif = NULL; | 306 | te_data->vif = NULL; |
| 307 | te_data->uid = 0; | 307 | te_data->uid = 0; |
| 308 | te_data->id = TE_MAX; | ||
| 308 | } else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) { | 309 | } else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) { |
| 309 | set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); | ||
| 310 | set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); | 310 | set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); |
| 311 | te_data->running = true; | 311 | te_data->running = true; |
| 312 | ieee80211_ready_on_channel(mvm->hw); /* Start TE */ | 312 | ieee80211_ready_on_channel(mvm->hw); /* Start TE */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 1cb793a498ac..c6a517c771df 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
| @@ -175,14 +175,10 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, | |||
| 175 | 175 | ||
| 176 | /* | 176 | /* |
| 177 | * for data packets, rate info comes from the table inside the fw. This | 177 | * for data packets, rate info comes from the table inside the fw. This |
| 178 | * table is controlled by LINK_QUALITY commands. Exclude ctrl port | 178 | * table is controlled by LINK_QUALITY commands |
| 179 | * frames like EAPOLs which should be treated as mgmt frames. This | ||
| 180 | * avoids them being sent initially in high rates which increases the | ||
| 181 | * chances for completion of the 4-Way handshake. | ||
| 182 | */ | 179 | */ |
| 183 | 180 | ||
| 184 | if (ieee80211_is_data(fc) && sta && | 181 | if (ieee80211_is_data(fc) && sta) { |
| 185 | !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { | ||
| 186 | tx_cmd->initial_rate_index = 0; | 182 | tx_cmd->initial_rate_index = 0; |
| 187 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); | 183 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); |
| 188 | return; | 184 | return; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 1393bac0025c..3781b029e54a 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
| @@ -174,6 +174,7 @@ static void iwl_pcie_apm_config(struct iwl_trans *trans) | |||
| 174 | { | 174 | { |
| 175 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 175 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
| 176 | u16 lctl; | 176 | u16 lctl; |
| 177 | u16 cap; | ||
| 177 | 178 | ||
| 178 | /* | 179 | /* |
| 179 | * HW bug W/A for instability in PCIe bus L0S->L1 transition. | 180 | * HW bug W/A for instability in PCIe bus L0S->L1 transition. |
| @@ -184,16 +185,17 @@ static void iwl_pcie_apm_config(struct iwl_trans *trans) | |||
| 184 | * power savings, even without L1. | 185 | * power savings, even without L1. |
| 185 | */ | 186 | */ |
| 186 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); | 187 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); |
| 187 | if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { | 188 | if (lctl & PCI_EXP_LNKCTL_ASPM_L1) |
| 188 | /* L1-ASPM enabled; disable(!) L0S */ | ||
| 189 | iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 189 | iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
| 190 | dev_info(trans->dev, "L1 Enabled; Disabling L0S\n"); | 190 | else |
| 191 | } else { | ||
| 192 | /* L1-ASPM disabled; enable(!) L0S */ | ||
| 193 | iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 191 | iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
| 194 | dev_info(trans->dev, "L1 Disabled; Enabling L0S\n"); | ||
| 195 | } | ||
| 196 | trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); | 192 | trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); |
| 193 | |||
| 194 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_DEVCTL2, &cap); | ||
| 195 | trans->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN; | ||
| 196 | dev_info(trans->dev, "L1 %sabled - LTR %sabled\n", | ||
| 197 | (lctl & PCI_EXP_LNKCTL_ASPM_L1) ? "En" : "Dis", | ||
| 198 | trans->ltr_enabled ? "En" : "Dis"); | ||
| 197 | } | 199 | } |
| 198 | 200 | ||
| 199 | /* | 201 | /* |
| @@ -428,7 +430,7 @@ static int iwl_pcie_apm_stop_master(struct iwl_trans *trans) | |||
| 428 | ret = iwl_poll_bit(trans, CSR_RESET, | 430 | ret = iwl_poll_bit(trans, CSR_RESET, |
| 429 | CSR_RESET_REG_FLAG_MASTER_DISABLED, | 431 | CSR_RESET_REG_FLAG_MASTER_DISABLED, |
| 430 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); | 432 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); |
| 431 | if (ret) | 433 | if (ret < 0) |
| 432 | IWL_WARN(trans, "Master Disable Timed Out, 100 usec\n"); | 434 | IWL_WARN(trans, "Master Disable Timed Out, 100 usec\n"); |
| 433 | 435 | ||
| 434 | IWL_DEBUG_INFO(trans, "stop master\n"); | 436 | IWL_DEBUG_INFO(trans, "stop master\n"); |
| @@ -544,7 +546,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
| 544 | msleep(25); | 546 | msleep(25); |
| 545 | } | 547 | } |
| 546 | 548 | ||
| 547 | IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter); | 549 | IWL_ERR(trans, "Couldn't prepare the card\n"); |
| 548 | 550 | ||
| 549 | return ret; | 551 | return ret; |
| 550 | } | 552 | } |
| @@ -1043,7 +1045,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, | |||
| 1043 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1045 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, |
| 1044 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1046 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, |
| 1045 | 25000); | 1047 | 25000); |
| 1046 | if (ret) { | 1048 | if (ret < 0) { |
| 1047 | IWL_ERR(trans, "Failed to resume the device (mac ready)\n"); | 1049 | IWL_ERR(trans, "Failed to resume the device (mac ready)\n"); |
| 1048 | return ret; | 1050 | return ret; |
| 1049 | } | 1051 | } |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c index 40057079ffb9..5ef5a0eeba50 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c | |||
| @@ -196,6 +196,7 @@ mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv, | |||
| 196 | mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win); | 196 | mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win); |
| 197 | 197 | ||
| 198 | del_timer_sync(&tbl->timer_context.timer); | 198 | del_timer_sync(&tbl->timer_context.timer); |
| 199 | tbl->timer_context.timer_is_set = false; | ||
| 199 | 200 | ||
| 200 | spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); | 201 | spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); |
| 201 | list_del(&tbl->list); | 202 | list_del(&tbl->list); |
| @@ -297,6 +298,7 @@ mwifiex_flush_data(unsigned long context) | |||
| 297 | (struct reorder_tmr_cnxt *) context; | 298 | (struct reorder_tmr_cnxt *) context; |
| 298 | int start_win, seq_num; | 299 | int start_win, seq_num; |
| 299 | 300 | ||
| 301 | ctx->timer_is_set = false; | ||
| 300 | seq_num = mwifiex_11n_find_last_seq_num(ctx); | 302 | seq_num = mwifiex_11n_find_last_seq_num(ctx); |
| 301 | 303 | ||
| 302 | if (seq_num < 0) | 304 | if (seq_num < 0) |
| @@ -385,6 +387,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
| 385 | 387 | ||
| 386 | new_node->timer_context.ptr = new_node; | 388 | new_node->timer_context.ptr = new_node; |
| 387 | new_node->timer_context.priv = priv; | 389 | new_node->timer_context.priv = priv; |
| 390 | new_node->timer_context.timer_is_set = false; | ||
| 388 | 391 | ||
| 389 | init_timer(&new_node->timer_context.timer); | 392 | init_timer(&new_node->timer_context.timer); |
| 390 | new_node->timer_context.timer.function = mwifiex_flush_data; | 393 | new_node->timer_context.timer.function = mwifiex_flush_data; |
| @@ -399,6 +402,22 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
| 399 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); | 402 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); |
| 400 | } | 403 | } |
| 401 | 404 | ||
| 405 | static void | ||
| 406 | mwifiex_11n_rxreorder_timer_restart(struct mwifiex_rx_reorder_tbl *tbl) | ||
| 407 | { | ||
| 408 | u32 min_flush_time; | ||
| 409 | |||
| 410 | if (tbl->win_size >= MWIFIEX_BA_WIN_SIZE_32) | ||
| 411 | min_flush_time = MIN_FLUSH_TIMER_15_MS; | ||
| 412 | else | ||
| 413 | min_flush_time = MIN_FLUSH_TIMER_MS; | ||
| 414 | |||
| 415 | mod_timer(&tbl->timer_context.timer, | ||
| 416 | jiffies + msecs_to_jiffies(min_flush_time * tbl->win_size)); | ||
| 417 | |||
| 418 | tbl->timer_context.timer_is_set = true; | ||
| 419 | } | ||
| 420 | |||
| 402 | /* | 421 | /* |
| 403 | * This function prepares command for adding a BA request. | 422 | * This function prepares command for adding a BA request. |
| 404 | * | 423 | * |
| @@ -523,31 +542,31 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
| 523 | u8 *ta, u8 pkt_type, void *payload) | 542 | u8 *ta, u8 pkt_type, void *payload) |
| 524 | { | 543 | { |
| 525 | struct mwifiex_rx_reorder_tbl *tbl; | 544 | struct mwifiex_rx_reorder_tbl *tbl; |
| 526 | int start_win, end_win, win_size; | 545 | int prev_start_win, start_win, end_win, win_size; |
| 527 | u16 pkt_index; | 546 | u16 pkt_index; |
| 528 | bool init_window_shift = false; | 547 | bool init_window_shift = false; |
| 548 | int ret = 0; | ||
| 529 | 549 | ||
| 530 | tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); | 550 | tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); |
| 531 | if (!tbl) { | 551 | if (!tbl) { |
| 532 | if (pkt_type != PKT_TYPE_BAR) | 552 | if (pkt_type != PKT_TYPE_BAR) |
| 533 | mwifiex_11n_dispatch_pkt(priv, payload); | 553 | mwifiex_11n_dispatch_pkt(priv, payload); |
| 534 | return 0; | 554 | return ret; |
| 535 | } | 555 | } |
| 536 | 556 | ||
| 537 | if ((pkt_type == PKT_TYPE_AMSDU) && !tbl->amsdu) { | 557 | if ((pkt_type == PKT_TYPE_AMSDU) && !tbl->amsdu) { |
| 538 | mwifiex_11n_dispatch_pkt(priv, payload); | 558 | mwifiex_11n_dispatch_pkt(priv, payload); |
| 539 | return 0; | 559 | return ret; |
| 540 | } | 560 | } |
| 541 | 561 | ||
| 542 | start_win = tbl->start_win; | 562 | start_win = tbl->start_win; |
| 563 | prev_start_win = start_win; | ||
| 543 | win_size = tbl->win_size; | 564 | win_size = tbl->win_size; |
| 544 | end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1); | 565 | end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1); |
| 545 | if (tbl->flags & RXREOR_INIT_WINDOW_SHIFT) { | 566 | if (tbl->flags & RXREOR_INIT_WINDOW_SHIFT) { |
| 546 | init_window_shift = true; | 567 | init_window_shift = true; |
| 547 | tbl->flags &= ~RXREOR_INIT_WINDOW_SHIFT; | 568 | tbl->flags &= ~RXREOR_INIT_WINDOW_SHIFT; |
| 548 | } | 569 | } |
| 549 | mod_timer(&tbl->timer_context.timer, | ||
| 550 | jiffies + msecs_to_jiffies(MIN_FLUSH_TIMER_MS * win_size)); | ||
| 551 | 570 | ||
| 552 | if (tbl->flags & RXREOR_FORCE_NO_DROP) { | 571 | if (tbl->flags & RXREOR_FORCE_NO_DROP) { |
| 553 | dev_dbg(priv->adapter->dev, | 572 | dev_dbg(priv->adapter->dev, |
| @@ -568,11 +587,14 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
| 568 | if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) { | 587 | if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) { |
| 569 | if (seq_num >= ((start_win + TWOPOW11) & | 588 | if (seq_num >= ((start_win + TWOPOW11) & |
| 570 | (MAX_TID_VALUE - 1)) && | 589 | (MAX_TID_VALUE - 1)) && |
| 571 | seq_num < start_win) | 590 | seq_num < start_win) { |
| 572 | return -1; | 591 | ret = -1; |
| 592 | goto done; | ||
| 593 | } | ||
| 573 | } else if ((seq_num < start_win) || | 594 | } else if ((seq_num < start_win) || |
| 574 | (seq_num > (start_win + TWOPOW11))) { | 595 | (seq_num >= (start_win + TWOPOW11))) { |
| 575 | return -1; | 596 | ret = -1; |
| 597 | goto done; | ||
| 576 | } | 598 | } |
| 577 | } | 599 | } |
| 578 | 600 | ||
| @@ -601,8 +623,10 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
| 601 | else | 623 | else |
| 602 | pkt_index = (seq_num+MAX_TID_VALUE) - start_win; | 624 | pkt_index = (seq_num+MAX_TID_VALUE) - start_win; |
| 603 | 625 | ||
| 604 | if (tbl->rx_reorder_ptr[pkt_index]) | 626 | if (tbl->rx_reorder_ptr[pkt_index]) { |
| 605 | return -1; | 627 | ret = -1; |
| 628 | goto done; | ||
| 629 | } | ||
| 606 | 630 | ||
| 607 | tbl->rx_reorder_ptr[pkt_index] = payload; | 631 | tbl->rx_reorder_ptr[pkt_index] = payload; |
| 608 | } | 632 | } |
| @@ -613,7 +637,11 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
| 613 | */ | 637 | */ |
| 614 | mwifiex_11n_scan_and_dispatch(priv, tbl); | 638 | mwifiex_11n_scan_and_dispatch(priv, tbl); |
| 615 | 639 | ||
| 616 | return 0; | 640 | done: |
| 641 | if (!tbl->timer_context.timer_is_set || | ||
| 642 | prev_start_win != tbl->start_win) | ||
| 643 | mwifiex_11n_rxreorder_timer_restart(tbl); | ||
| 644 | return ret; | ||
| 617 | } | 645 | } |
| 618 | 646 | ||
| 619 | /* | 647 | /* |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h index 3a87bb0e3a62..63ecea89b4ab 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.h +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | #define _MWIFIEX_11N_RXREORDER_H_ | 21 | #define _MWIFIEX_11N_RXREORDER_H_ |
| 22 | 22 | ||
| 23 | #define MIN_FLUSH_TIMER_MS 50 | 23 | #define MIN_FLUSH_TIMER_MS 50 |
| 24 | #define MIN_FLUSH_TIMER_15_MS 15 | ||
| 25 | #define MWIFIEX_BA_WIN_SIZE_32 32 | ||
| 24 | 26 | ||
| 25 | #define PKT_TYPE_BAR 0xE7 | 27 | #define PKT_TYPE_BAR 0xE7 |
| 26 | #define MAX_TID_VALUE (2 << 11) | 28 | #define MAX_TID_VALUE (2 << 11) |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index e2635747d966..f55658d15c60 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
| @@ -592,6 +592,7 @@ struct reorder_tmr_cnxt { | |||
| 592 | struct timer_list timer; | 592 | struct timer_list timer; |
| 593 | struct mwifiex_rx_reorder_tbl *ptr; | 593 | struct mwifiex_rx_reorder_tbl *ptr; |
| 594 | struct mwifiex_private *priv; | 594 | struct mwifiex_private *priv; |
| 595 | u8 timer_is_set; | ||
| 595 | }; | 596 | }; |
| 596 | 597 | ||
| 597 | struct mwifiex_rx_reorder_tbl { | 598 | struct mwifiex_rx_reorder_tbl { |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 573897b8e878..8444313eabe2 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
| @@ -1111,6 +1111,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
| 1111 | /* Ovislink */ | 1111 | /* Ovislink */ |
| 1112 | { USB_DEVICE(0x1b75, 0x3071) }, | 1112 | { USB_DEVICE(0x1b75, 0x3071) }, |
| 1113 | { USB_DEVICE(0x1b75, 0x3072) }, | 1113 | { USB_DEVICE(0x1b75, 0x3072) }, |
| 1114 | { USB_DEVICE(0x1b75, 0xa200) }, | ||
| 1114 | /* Para */ | 1115 | /* Para */ |
| 1115 | { USB_DEVICE(0x20b8, 0x8888) }, | 1116 | { USB_DEVICE(0x20b8, 0x8888) }, |
| 1116 | /* Pegatron */ | 1117 | /* Pegatron */ |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 58ba71830886..40b6d1d006d7 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
| @@ -467,7 +467,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) | |||
| 467 | rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); | 467 | rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); |
| 468 | /* <2> work queue */ | 468 | /* <2> work queue */ |
| 469 | rtlpriv->works.hw = hw; | 469 | rtlpriv->works.hw = hw; |
| 470 | rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0); | 470 | rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
| 471 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, | 471 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
| 472 | (void *)rtl_watchdog_wq_callback); | 472 | (void *)rtl_watchdog_wq_callback); |
| 473 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, | 473 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index f6179bc06086..07dae0d44abc 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
| @@ -1828,3 +1828,9 @@ const struct ieee80211_ops rtl_ops = { | |||
| 1828 | .flush = rtl_op_flush, | 1828 | .flush = rtl_op_flush, |
| 1829 | }; | 1829 | }; |
| 1830 | EXPORT_SYMBOL_GPL(rtl_ops); | 1830 | EXPORT_SYMBOL_GPL(rtl_ops); |
| 1831 | |||
| 1832 | bool rtl_btc_status_false(void) | ||
| 1833 | { | ||
| 1834 | return false; | ||
| 1835 | } | ||
| 1836 | EXPORT_SYMBOL_GPL(rtl_btc_status_false); | ||
diff --git a/drivers/net/wireless/rtlwifi/core.h b/drivers/net/wireless/rtlwifi/core.h index 59cd3b9dca25..624e1dc16d31 100644 --- a/drivers/net/wireless/rtlwifi/core.h +++ b/drivers/net/wireless/rtlwifi/core.h | |||
| @@ -42,5 +42,6 @@ void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, | |||
| 42 | u32 mask, u32 data); | 42 | u32 mask, u32 data); |
| 43 | void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data); | 43 | void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data); |
| 44 | bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); | 44 | bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); |
| 45 | bool rtl_btc_status_false(void); | ||
| 45 | 46 | ||
| 46 | #endif | 47 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 667aba81246c..25daa8715219 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
| @@ -1796,7 +1796,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw) | |||
| 1796 | rtl_pci_reset_trx_ring(hw); | 1796 | rtl_pci_reset_trx_ring(hw); |
| 1797 | 1797 | ||
| 1798 | rtlpci->driver_is_goingto_unload = false; | 1798 | rtlpci->driver_is_goingto_unload = false; |
| 1799 | if (rtlpriv->cfg->ops->get_btc_status()) { | 1799 | if (rtlpriv->cfg->ops->get_btc_status && |
| 1800 | rtlpriv->cfg->ops->get_btc_status()) { | ||
| 1800 | rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv); | 1801 | rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv); |
| 1801 | rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv); | 1802 | rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv); |
| 1802 | } | 1803 | } |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c index a00861b26ece..29983bc96a89 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c | |||
| @@ -656,7 +656,8 @@ static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { | |||
| 656 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 656 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 657 | }; | 657 | }; |
| 658 | 658 | ||
| 659 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | 659 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, |
| 660 | bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *)) | ||
| 660 | { | 661 | { |
| 661 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 662 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 662 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 663 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
| @@ -722,7 +723,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | |||
| 722 | memcpy((u8 *)skb_put(skb, totalpacketlen), | 723 | memcpy((u8 *)skb_put(skb, totalpacketlen), |
| 723 | &reserved_page_packet, totalpacketlen); | 724 | &reserved_page_packet, totalpacketlen); |
| 724 | 725 | ||
| 725 | rtstatus = rtl_cmd_send_packet(hw, skb); | 726 | if (cmd_send_packet) |
| 727 | rtstatus = cmd_send_packet(hw, skb); | ||
| 728 | else | ||
| 729 | rtstatus = rtl_cmd_send_packet(hw, skb); | ||
| 726 | 730 | ||
| 727 | if (rtstatus) | 731 | if (rtstatus) |
| 728 | b_dlok = true; | 732 | b_dlok = true; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h index a815bd6273da..b64ae45dc674 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | |||
| @@ -109,7 +109,9 @@ void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, | |||
| 109 | u32 cmd_len, u8 *p_cmdbuffer); | 109 | u32 cmd_len, u8 *p_cmdbuffer); |
| 110 | void rtl92c_firmware_selfreset(struct ieee80211_hw *hw); | 110 | void rtl92c_firmware_selfreset(struct ieee80211_hw *hw); |
| 111 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); | 111 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); |
| 112 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); | 112 | void rtl92c_set_fw_rsvdpagepkt |
| 113 | (struct ieee80211_hw *hw, | ||
| 114 | bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *)); | ||
| 113 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); | 115 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); |
| 114 | void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len); | 116 | void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len); |
| 115 | void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); | 117 | void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h index 831df101d7b7..9b660df6fd71 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h | |||
| @@ -114,6 +114,8 @@ | |||
| 114 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) | 114 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) |
| 115 | #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ | 115 | #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ |
| 116 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) | 116 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) |
| 117 | #define GET_RX_STATUS_DESC_BUFF_ADDR(__pdesc) \ | ||
| 118 | SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32) | ||
| 117 | 119 | ||
| 118 | #define CHIP_VER_B BIT(4) | 120 | #define CHIP_VER_B BIT(4) |
| 119 | #define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3) | 121 | #define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 8ec0f031f48a..55357d69397a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | |||
| @@ -459,7 +459,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
| 459 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, | 459 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, |
| 460 | tmp_reg422 & (~BIT(6))); | 460 | tmp_reg422 & (~BIT(6))); |
| 461 | 461 | ||
| 462 | rtl92c_set_fw_rsvdpagepkt(hw, 0); | 462 | rtl92c_set_fw_rsvdpagepkt(hw, NULL); |
| 463 | 463 | ||
| 464 | _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); | 464 | _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); |
| 465 | _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4)); | 465 | _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4)); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c index d86b5b566444..46ea07605eb4 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | |||
| @@ -244,6 +244,7 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = { | |||
| 244 | .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, | 244 | .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, |
| 245 | .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback, | 245 | .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback, |
| 246 | .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, | 246 | .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, |
| 247 | .get_btc_status = rtl_btc_status_false, | ||
| 247 | }; | 248 | }; |
| 248 | 249 | ||
| 249 | static struct rtl_mod_params rtl92ce_mod_params = { | 250 | static struct rtl_mod_params rtl92ce_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index 2fb9c7acb76a..dc3d20b17a26 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
| @@ -728,6 +728,9 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name) | |||
| 728 | case HW_DESC_RXPKT_LEN: | 728 | case HW_DESC_RXPKT_LEN: |
| 729 | ret = GET_RX_DESC_PKT_LEN(pdesc); | 729 | ret = GET_RX_DESC_PKT_LEN(pdesc); |
| 730 | break; | 730 | break; |
| 731 | case HW_DESC_RXBUFF_ADDR: | ||
| 732 | ret = GET_RX_STATUS_DESC_BUFF_ADDR(pdesc); | ||
| 733 | break; | ||
| 731 | default: | 734 | default: |
| 732 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", | 735 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", |
| 733 | desc_name); | 736 | desc_name); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 04aa0b5f5b3d..873363acbacf 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
| @@ -1592,6 +1592,20 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
| 1592 | } | 1592 | } |
| 1593 | } | 1593 | } |
| 1594 | 1594 | ||
| 1595 | bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
| 1596 | { | ||
| 1597 | /* Currently nothing happens here. | ||
| 1598 | * Traffic stops after some seconds in WPA2 802.11n mode. | ||
| 1599 | * Maybe because rtl8192cu chip should be set from here? | ||
| 1600 | * If I understand correctly, the realtek vendor driver sends some urbs | ||
| 1601 | * if its "here". | ||
| 1602 | * | ||
| 1603 | * This is maybe necessary: | ||
| 1604 | * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); | ||
| 1605 | */ | ||
| 1606 | return true; | ||
| 1607 | } | ||
| 1608 | |||
| 1595 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | 1609 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) |
| 1596 | { | 1610 | { |
| 1597 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1611 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| @@ -1939,7 +1953,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
| 1939 | recover = true; | 1953 | recover = true; |
| 1940 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, | 1954 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, |
| 1941 | tmp_reg422 & (~BIT(6))); | 1955 | tmp_reg422 & (~BIT(6))); |
| 1942 | rtl92c_set_fw_rsvdpagepkt(hw, 0); | 1956 | rtl92c_set_fw_rsvdpagepkt(hw, |
| 1957 | &usb_cmd_send_packet); | ||
| 1943 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); | 1958 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); |
| 1944 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); | 1959 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); |
| 1945 | if (recover) | 1960 | if (recover) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h index 0f7812e0c8aa..c1e33b0228c0 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | |||
| @@ -104,7 +104,6 @@ bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); | |||
| 104 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); | 104 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); |
| 105 | int rtl92c_download_fw(struct ieee80211_hw *hw); | 105 | int rtl92c_download_fw(struct ieee80211_hw *hw); |
| 106 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); | 106 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); |
| 107 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished); | ||
| 108 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); | 107 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); |
| 109 | void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, | 108 | void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, |
| 110 | u8 element_id, u32 cmd_len, u8 *p_cmdbuffer); | 109 | u8 element_id, u32 cmd_len, u8 *p_cmdbuffer); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index 7c5fbaf5fee0..e06bafee37f9 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
| @@ -101,6 +101,12 @@ static void rtl92cu_deinit_sw_vars(struct ieee80211_hw *hw) | |||
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | /* get bt coexist status */ | ||
| 105 | static bool rtl92cu_get_btc_status(void) | ||
| 106 | { | ||
| 107 | return false; | ||
| 108 | } | ||
| 109 | |||
| 104 | static struct rtl_hal_ops rtl8192cu_hal_ops = { | 110 | static struct rtl_hal_ops rtl8192cu_hal_ops = { |
| 105 | .init_sw_vars = rtl92cu_init_sw_vars, | 111 | .init_sw_vars = rtl92cu_init_sw_vars, |
| 106 | .deinit_sw_vars = rtl92cu_deinit_sw_vars, | 112 | .deinit_sw_vars = rtl92cu_deinit_sw_vars, |
| @@ -148,6 +154,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = { | |||
| 148 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, | 154 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, |
| 149 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, | 155 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, |
| 150 | .fill_h2c_cmd = rtl92c_fill_h2c_cmd, | 156 | .fill_h2c_cmd = rtl92c_fill_h2c_cmd, |
| 157 | .get_btc_status = rtl92cu_get_btc_status, | ||
| 151 | }; | 158 | }; |
| 152 | 159 | ||
| 153 | static struct rtl_mod_params rtl92cu_mod_params = { | 160 | static struct rtl_mod_params rtl92cu_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c index edab5a5351b5..a0aba088259a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c | |||
| @@ -251,6 +251,7 @@ static struct rtl_hal_ops rtl8192de_hal_ops = { | |||
| 251 | .get_rfreg = rtl92d_phy_query_rf_reg, | 251 | .get_rfreg = rtl92d_phy_query_rf_reg, |
| 252 | .set_rfreg = rtl92d_phy_set_rf_reg, | 252 | .set_rfreg = rtl92d_phy_set_rf_reg, |
| 253 | .linked_set_reg = rtl92d_linked_set_reg, | 253 | .linked_set_reg = rtl92d_linked_set_reg, |
| 254 | .get_btc_status = rtl_btc_status_false, | ||
| 254 | }; | 255 | }; |
| 255 | 256 | ||
| 256 | static struct rtl_mod_params rtl92de_mod_params = { | 257 | static struct rtl_mod_params rtl92de_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c index dfdc9b20e4ad..1a87edca2c3f 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c | |||
| @@ -362,7 +362,7 @@ void rtl92ee_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
| 362 | } | 362 | } |
| 363 | break; | 363 | break; |
| 364 | default: | 364 | default: |
| 365 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 365 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
| 366 | "switch case not process %x\n", variable); | 366 | "switch case not process %x\n", variable); |
| 367 | break; | 367 | break; |
| 368 | } | 368 | } |
| @@ -591,7 +591,7 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
| 591 | acm_ctrl &= (~ACMHW_BEQEN); | 591 | acm_ctrl &= (~ACMHW_BEQEN); |
| 592 | break; | 592 | break; |
| 593 | default: | 593 | default: |
| 594 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 594 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
| 595 | "switch case not process\n"); | 595 | "switch case not process\n"); |
| 596 | break; | 596 | break; |
| 597 | } | 597 | } |
| @@ -710,7 +710,7 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
| 710 | } | 710 | } |
| 711 | break; | 711 | break; |
| 712 | default: | 712 | default: |
| 713 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 713 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
| 714 | "switch case not process %x\n", variable); | 714 | "switch case not process %x\n", variable); |
| 715 | break; | 715 | break; |
| 716 | } | 716 | } |
| @@ -2424,7 +2424,7 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index, | |||
| 2424 | enc_algo = CAM_AES; | 2424 | enc_algo = CAM_AES; |
| 2425 | break; | 2425 | break; |
| 2426 | default: | 2426 | default: |
| 2427 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 2427 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
| 2428 | "switch case not process\n"); | 2428 | "switch case not process\n"); |
| 2429 | enc_algo = CAM_TKIP; | 2429 | enc_algo = CAM_TKIP; |
| 2430 | break; | 2430 | break; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/def.h b/drivers/net/wireless/rtlwifi/rtl8192se/def.h index 83c98674bfd3..6e7a70b43949 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192se/def.h | |||
| @@ -446,6 +446,8 @@ | |||
| 446 | /* DWORD 6 */ | 446 | /* DWORD 6 */ |
| 447 | #define SET_RX_STATUS__DESC_BUFF_ADDR(__pdesc, __val) \ | 447 | #define SET_RX_STATUS__DESC_BUFF_ADDR(__pdesc, __val) \ |
| 448 | SET_BITS_OFFSET_LE(__pdesc + 24, 0, 32, __val) | 448 | SET_BITS_OFFSET_LE(__pdesc + 24, 0, 32, __val) |
| 449 | #define GET_RX_STATUS_DESC_BUFF_ADDR(__pdesc) \ | ||
| 450 | SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32) | ||
| 449 | 451 | ||
| 450 | #define SE_RX_HAL_IS_CCK_RATE(_pdesc)\ | 452 | #define SE_RX_HAL_IS_CCK_RATE(_pdesc)\ |
| 451 | (GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE1M || \ | 453 | (GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE1M || \ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index 1bff2a0f7600..aadba29c167a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
| @@ -87,11 +87,8 @@ static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw) | |||
| 87 | static void rtl92se_fw_cb(const struct firmware *firmware, void *context) | 87 | static void rtl92se_fw_cb(const struct firmware *firmware, void *context) |
| 88 | { | 88 | { |
| 89 | struct ieee80211_hw *hw = context; | 89 | struct ieee80211_hw *hw = context; |
| 90 | struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); | ||
| 91 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 90 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 92 | struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); | ||
| 93 | struct rt_firmware *pfirmware = NULL; | 91 | struct rt_firmware *pfirmware = NULL; |
| 94 | int err; | ||
| 95 | 92 | ||
| 96 | RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, | 93 | RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, |
| 97 | "Firmware callback routine entered!\n"); | 94 | "Firmware callback routine entered!\n"); |
| @@ -112,20 +109,6 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context) | |||
| 112 | memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); | 109 | memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); |
| 113 | pfirmware->sz_fw_tmpbufferlen = firmware->size; | 110 | pfirmware->sz_fw_tmpbufferlen = firmware->size; |
| 114 | release_firmware(firmware); | 111 | release_firmware(firmware); |
| 115 | |||
| 116 | err = ieee80211_register_hw(hw); | ||
| 117 | if (err) { | ||
| 118 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
| 119 | "Can't register mac80211 hw\n"); | ||
| 120 | return; | ||
| 121 | } else { | ||
| 122 | rtlpriv->mac80211.mac80211_registered = 1; | ||
| 123 | } | ||
| 124 | rtlpci->irq_alloc = 1; | ||
| 125 | set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); | ||
| 126 | |||
| 127 | /*init rfkill */ | ||
| 128 | rtl_init_rfkill(hw); | ||
| 129 | } | 112 | } |
| 130 | 113 | ||
| 131 | static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) | 114 | static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) |
| @@ -226,8 +209,8 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) | |||
| 226 | if (!rtlpriv->rtlhal.pfirmware) | 209 | if (!rtlpriv->rtlhal.pfirmware) |
| 227 | return 1; | 210 | return 1; |
| 228 | 211 | ||
| 229 | rtlpriv->max_fw_size = RTL8190_MAX_RAW_FIRMWARE_CODE_SIZE; | 212 | rtlpriv->max_fw_size = RTL8190_MAX_FIRMWARE_CODE_SIZE*2 + |
| 230 | 213 | sizeof(struct fw_hdr); | |
| 231 | pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" | 214 | pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" |
| 232 | "Loading firmware %s\n", rtlpriv->cfg->fw_name); | 215 | "Loading firmware %s\n", rtlpriv->cfg->fw_name); |
| 233 | /* request fw */ | 216 | /* request fw */ |
| @@ -294,6 +277,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = { | |||
| 294 | .set_bbreg = rtl92s_phy_set_bb_reg, | 277 | .set_bbreg = rtl92s_phy_set_bb_reg, |
| 295 | .get_rfreg = rtl92s_phy_query_rf_reg, | 278 | .get_rfreg = rtl92s_phy_query_rf_reg, |
| 296 | .set_rfreg = rtl92s_phy_set_rf_reg, | 279 | .set_rfreg = rtl92s_phy_set_rf_reg, |
| 280 | .get_btc_status = rtl_btc_status_false, | ||
| 297 | }; | 281 | }; |
| 298 | 282 | ||
| 299 | static struct rtl_mod_params rtl92se_mod_params = { | 283 | static struct rtl_mod_params rtl92se_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index b358ebce8942..672fd3b02835 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
| @@ -640,6 +640,9 @@ u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name) | |||
| 640 | case HW_DESC_RXPKT_LEN: | 640 | case HW_DESC_RXPKT_LEN: |
| 641 | ret = GET_RX_STATUS_DESC_PKT_LEN(desc); | 641 | ret = GET_RX_STATUS_DESC_PKT_LEN(desc); |
| 642 | break; | 642 | break; |
| 643 | case HW_DESC_RXBUFF_ADDR: | ||
| 644 | ret = GET_RX_STATUS_DESC_BUFF_ADDR(desc); | ||
| 645 | break; | ||
| 643 | default: | 646 | default: |
| 644 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", | 647 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", |
| 645 | desc_name); | 648 | desc_name); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c index 9786313dc62f..1e9570fa874f 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c | |||
| @@ -1889,15 +1889,18 @@ static void _rtl8821ae_store_tx_power_by_rate(struct ieee80211_hw *hw, | |||
| 1889 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 1889 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
| 1890 | u8 rate_section = _rtl8821ae_get_rate_section_index(regaddr); | 1890 | u8 rate_section = _rtl8821ae_get_rate_section_index(regaddr); |
| 1891 | 1891 | ||
| 1892 | if (band != BAND_ON_2_4G && band != BAND_ON_5G) | 1892 | if (band != BAND_ON_2_4G && band != BAND_ON_5G) { |
| 1893 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid Band %d\n", band); | 1893 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid Band %d\n", band); |
| 1894 | 1894 | band = BAND_ON_2_4G; | |
| 1895 | if (rfpath >= MAX_RF_PATH) | 1895 | } |
| 1896 | if (rfpath >= MAX_RF_PATH) { | ||
| 1896 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid RfPath %d\n", rfpath); | 1897 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid RfPath %d\n", rfpath); |
| 1897 | 1898 | rfpath = MAX_RF_PATH - 1; | |
| 1898 | if (txnum >= MAX_RF_PATH) | 1899 | } |
| 1900 | if (txnum >= MAX_RF_PATH) { | ||
| 1899 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid TxNum %d\n", txnum); | 1901 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid TxNum %d\n", txnum); |
| 1900 | 1902 | txnum = MAX_RF_PATH - 1; | |
| 1903 | } | ||
| 1901 | rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section] = data; | 1904 | rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section] = data; |
| 1902 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 1905 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, |
| 1903 | "TxPwrByRateOffset[Band %d][RfPath %d][TxNum %d][RateSection %d] = 0x%x\n", | 1906 | "TxPwrByRateOffset[Band %d][RfPath %d][TxNum %d][RateSection %d] = 0x%x\n", |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 10cf69c4bc42..46ee956d0235 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
| @@ -1117,7 +1117,18 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
| 1117 | } | 1117 | } |
| 1118 | rtlpriv->cfg->ops->init_sw_leds(hw); | 1118 | rtlpriv->cfg->ops->init_sw_leds(hw); |
| 1119 | 1119 | ||
| 1120 | err = ieee80211_register_hw(hw); | ||
| 1121 | if (err) { | ||
| 1122 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
| 1123 | "Can't register mac80211 hw.\n"); | ||
| 1124 | err = -ENODEV; | ||
| 1125 | goto error_out; | ||
| 1126 | } | ||
| 1127 | rtlpriv->mac80211.mac80211_registered = 1; | ||
| 1128 | |||
| 1129 | set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); | ||
| 1120 | return 0; | 1130 | return 0; |
| 1131 | |||
| 1121 | error_out: | 1132 | error_out: |
| 1122 | rtl_deinit_core(hw); | 1133 | rtl_deinit_core(hw); |
| 1123 | _rtl_usb_io_handler_release(hw); | 1134 | _rtl_usb_io_handler_release(hw); |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index d4eb8d2e9cb7..083ecc93fe5e 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
| @@ -176,10 +176,11 @@ struct xenvif_queue { /* Per-queue data for xenvif */ | |||
| 176 | char rx_irq_name[IRQ_NAME_SIZE]; /* DEVNAME-qN-rx */ | 176 | char rx_irq_name[IRQ_NAME_SIZE]; /* DEVNAME-qN-rx */ |
| 177 | struct xen_netif_rx_back_ring rx; | 177 | struct xen_netif_rx_back_ring rx; |
| 178 | struct sk_buff_head rx_queue; | 178 | struct sk_buff_head rx_queue; |
| 179 | RING_IDX rx_last_skb_slots; | ||
| 180 | unsigned long status; | ||
| 181 | 179 | ||
| 182 | struct timer_list rx_stalled; | 180 | unsigned int rx_queue_max; |
| 181 | unsigned int rx_queue_len; | ||
| 182 | unsigned long last_rx_time; | ||
| 183 | bool stalled; | ||
| 183 | 184 | ||
| 184 | struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS]; | 185 | struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS]; |
| 185 | 186 | ||
| @@ -199,18 +200,14 @@ struct xenvif_queue { /* Per-queue data for xenvif */ | |||
| 199 | struct xenvif_stats stats; | 200 | struct xenvif_stats stats; |
| 200 | }; | 201 | }; |
| 201 | 202 | ||
| 203 | /* Maximum number of Rx slots a to-guest packet may use, including the | ||
| 204 | * slot needed for GSO meta-data. | ||
| 205 | */ | ||
| 206 | #define XEN_NETBK_RX_SLOTS_MAX (MAX_SKB_FRAGS + 1) | ||
| 207 | |||
| 202 | enum state_bit_shift { | 208 | enum state_bit_shift { |
| 203 | /* This bit marks that the vif is connected */ | 209 | /* This bit marks that the vif is connected */ |
| 204 | VIF_STATUS_CONNECTED, | 210 | VIF_STATUS_CONNECTED, |
| 205 | /* This bit signals the RX thread that queuing was stopped (in | ||
| 206 | * start_xmit), and either the timer fired or an RX interrupt came | ||
| 207 | */ | ||
| 208 | QUEUE_STATUS_RX_PURGE_EVENT, | ||
| 209 | /* This bit tells the interrupt handler that this queue was the reason | ||
| 210 | * for the carrier off, so it should kick the thread. Only queues which | ||
| 211 | * brought it down can turn on the carrier. | ||
| 212 | */ | ||
| 213 | QUEUE_STATUS_RX_STALLED | ||
| 214 | }; | 211 | }; |
| 215 | 212 | ||
| 216 | struct xenvif { | 213 | struct xenvif { |
| @@ -228,9 +225,6 @@ struct xenvif { | |||
| 228 | u8 ip_csum:1; | 225 | u8 ip_csum:1; |
| 229 | u8 ipv6_csum:1; | 226 | u8 ipv6_csum:1; |
| 230 | 227 | ||
| 231 | /* Internal feature information. */ | ||
| 232 | u8 can_queue:1; /* can queue packets for receiver? */ | ||
| 233 | |||
| 234 | /* Is this interface disabled? True when backend discovers | 228 | /* Is this interface disabled? True when backend discovers |
| 235 | * frontend is rogue. | 229 | * frontend is rogue. |
| 236 | */ | 230 | */ |
| @@ -240,6 +234,9 @@ struct xenvif { | |||
| 240 | /* Queues */ | 234 | /* Queues */ |
| 241 | struct xenvif_queue *queues; | 235 | struct xenvif_queue *queues; |
| 242 | unsigned int num_queues; /* active queues, resource allocated */ | 236 | unsigned int num_queues; /* active queues, resource allocated */ |
| 237 | unsigned int stalled_queues; | ||
| 238 | |||
| 239 | spinlock_t lock; | ||
| 243 | 240 | ||
| 244 | #ifdef CONFIG_DEBUG_FS | 241 | #ifdef CONFIG_DEBUG_FS |
| 245 | struct dentry *xenvif_dbg_root; | 242 | struct dentry *xenvif_dbg_root; |
| @@ -249,6 +246,14 @@ struct xenvif { | |||
| 249 | struct net_device *dev; | 246 | struct net_device *dev; |
| 250 | }; | 247 | }; |
| 251 | 248 | ||
| 249 | struct xenvif_rx_cb { | ||
| 250 | unsigned long expires; | ||
| 251 | int meta_slots_used; | ||
| 252 | bool full_coalesce; | ||
| 253 | }; | ||
| 254 | |||
| 255 | #define XENVIF_RX_CB(skb) ((struct xenvif_rx_cb *)(skb)->cb) | ||
| 256 | |||
| 252 | static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif) | 257 | static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif) |
| 253 | { | 258 | { |
| 254 | return to_xenbus_device(vif->dev->dev.parent); | 259 | return to_xenbus_device(vif->dev->dev.parent); |
| @@ -272,8 +277,6 @@ void xenvif_xenbus_fini(void); | |||
| 272 | 277 | ||
| 273 | int xenvif_schedulable(struct xenvif *vif); | 278 | int xenvif_schedulable(struct xenvif *vif); |
| 274 | 279 | ||
| 275 | int xenvif_must_stop_queue(struct xenvif_queue *queue); | ||
| 276 | |||
| 277 | int xenvif_queue_stopped(struct xenvif_queue *queue); | 280 | int xenvif_queue_stopped(struct xenvif_queue *queue); |
| 278 | void xenvif_wake_queue(struct xenvif_queue *queue); | 281 | void xenvif_wake_queue(struct xenvif_queue *queue); |
| 279 | 282 | ||
| @@ -296,6 +299,8 @@ void xenvif_kick_thread(struct xenvif_queue *queue); | |||
| 296 | 299 | ||
| 297 | int xenvif_dealloc_kthread(void *data); | 300 | int xenvif_dealloc_kthread(void *data); |
| 298 | 301 | ||
| 302 | void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb); | ||
| 303 | |||
| 299 | /* Determine whether the needed number of slots (req) are available, | 304 | /* Determine whether the needed number of slots (req) are available, |
| 300 | * and set req_event if not. | 305 | * and set req_event if not. |
| 301 | */ | 306 | */ |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index f379689dde30..895fe84011e7 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
| @@ -43,6 +43,9 @@ | |||
| 43 | #define XENVIF_QUEUE_LENGTH 32 | 43 | #define XENVIF_QUEUE_LENGTH 32 |
| 44 | #define XENVIF_NAPI_WEIGHT 64 | 44 | #define XENVIF_NAPI_WEIGHT 64 |
| 45 | 45 | ||
| 46 | /* Number of bytes allowed on the internal guest Rx queue. */ | ||
| 47 | #define XENVIF_RX_QUEUE_BYTES (XEN_NETIF_RX_RING_SIZE/2 * PAGE_SIZE) | ||
| 48 | |||
| 46 | /* This function is used to set SKBTX_DEV_ZEROCOPY as well as | 49 | /* This function is used to set SKBTX_DEV_ZEROCOPY as well as |
| 47 | * increasing the inflight counter. We need to increase the inflight | 50 | * increasing the inflight counter. We need to increase the inflight |
| 48 | * counter because core driver calls into xenvif_zerocopy_callback | 51 | * counter because core driver calls into xenvif_zerocopy_callback |
| @@ -60,20 +63,11 @@ void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue) | |||
| 60 | atomic_dec(&queue->inflight_packets); | 63 | atomic_dec(&queue->inflight_packets); |
| 61 | } | 64 | } |
| 62 | 65 | ||
| 63 | static inline void xenvif_stop_queue(struct xenvif_queue *queue) | ||
| 64 | { | ||
| 65 | struct net_device *dev = queue->vif->dev; | ||
| 66 | |||
| 67 | if (!queue->vif->can_queue) | ||
| 68 | return; | ||
| 69 | |||
| 70 | netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id)); | ||
| 71 | } | ||
| 72 | |||
| 73 | int xenvif_schedulable(struct xenvif *vif) | 66 | int xenvif_schedulable(struct xenvif *vif) |
| 74 | { | 67 | { |
| 75 | return netif_running(vif->dev) && | 68 | return netif_running(vif->dev) && |
| 76 | test_bit(VIF_STATUS_CONNECTED, &vif->status); | 69 | test_bit(VIF_STATUS_CONNECTED, &vif->status) && |
| 70 | !vif->disabled; | ||
| 77 | } | 71 | } |
| 78 | 72 | ||
| 79 | static irqreturn_t xenvif_tx_interrupt(int irq, void *dev_id) | 73 | static irqreturn_t xenvif_tx_interrupt(int irq, void *dev_id) |
| @@ -114,16 +108,7 @@ int xenvif_poll(struct napi_struct *napi, int budget) | |||
| 114 | static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id) | 108 | static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id) |
| 115 | { | 109 | { |
| 116 | struct xenvif_queue *queue = dev_id; | 110 | struct xenvif_queue *queue = dev_id; |
| 117 | struct netdev_queue *net_queue = | ||
| 118 | netdev_get_tx_queue(queue->vif->dev, queue->id); | ||
| 119 | 111 | ||
| 120 | /* QUEUE_STATUS_RX_PURGE_EVENT is only set if either QDisc was off OR | ||
| 121 | * the carrier went down and this queue was previously blocked | ||
| 122 | */ | ||
| 123 | if (unlikely(netif_tx_queue_stopped(net_queue) || | ||
| 124 | (!netif_carrier_ok(queue->vif->dev) && | ||
| 125 | test_bit(QUEUE_STATUS_RX_STALLED, &queue->status)))) | ||
| 126 | set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status); | ||
| 127 | xenvif_kick_thread(queue); | 112 | xenvif_kick_thread(queue); |
| 128 | 113 | ||
| 129 | return IRQ_HANDLED; | 114 | return IRQ_HANDLED; |
| @@ -151,24 +136,13 @@ void xenvif_wake_queue(struct xenvif_queue *queue) | |||
| 151 | netif_tx_wake_queue(netdev_get_tx_queue(dev, id)); | 136 | netif_tx_wake_queue(netdev_get_tx_queue(dev, id)); |
| 152 | } | 137 | } |
| 153 | 138 | ||
| 154 | /* Callback to wake the queue's thread and turn the carrier off on timeout */ | ||
| 155 | static void xenvif_rx_stalled(unsigned long data) | ||
| 156 | { | ||
| 157 | struct xenvif_queue *queue = (struct xenvif_queue *)data; | ||
| 158 | |||
| 159 | if (xenvif_queue_stopped(queue)) { | ||
| 160 | set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status); | ||
| 161 | xenvif_kick_thread(queue); | ||
| 162 | } | ||
| 163 | } | ||
| 164 | |||
| 165 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | 139 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) |
| 166 | { | 140 | { |
| 167 | struct xenvif *vif = netdev_priv(dev); | 141 | struct xenvif *vif = netdev_priv(dev); |
| 168 | struct xenvif_queue *queue = NULL; | 142 | struct xenvif_queue *queue = NULL; |
| 169 | unsigned int num_queues = vif->num_queues; | 143 | unsigned int num_queues = vif->num_queues; |
| 170 | u16 index; | 144 | u16 index; |
| 171 | int min_slots_needed; | 145 | struct xenvif_rx_cb *cb; |
| 172 | 146 | ||
| 173 | BUG_ON(skb->dev != dev); | 147 | BUG_ON(skb->dev != dev); |
| 174 | 148 | ||
| @@ -191,30 +165,10 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 191 | !xenvif_schedulable(vif)) | 165 | !xenvif_schedulable(vif)) |
| 192 | goto drop; | 166 | goto drop; |
| 193 | 167 | ||
| 194 | /* At best we'll need one slot for the header and one for each | 168 | cb = XENVIF_RX_CB(skb); |
| 195 | * frag. | 169 | cb->expires = jiffies + rx_drain_timeout_jiffies; |
| 196 | */ | ||
| 197 | min_slots_needed = 1 + skb_shinfo(skb)->nr_frags; | ||
| 198 | |||
| 199 | /* If the skb is GSO then we'll also need an extra slot for the | ||
| 200 | * metadata. | ||
| 201 | */ | ||
| 202 | if (skb_is_gso(skb)) | ||
| 203 | min_slots_needed++; | ||
| 204 | 170 | ||
| 205 | /* If the skb can't possibly fit in the remaining slots | 171 | xenvif_rx_queue_tail(queue, skb); |
| 206 | * then turn off the queue to give the ring a chance to | ||
| 207 | * drain. | ||
| 208 | */ | ||
| 209 | if (!xenvif_rx_ring_slots_available(queue, min_slots_needed)) { | ||
| 210 | queue->rx_stalled.function = xenvif_rx_stalled; | ||
| 211 | queue->rx_stalled.data = (unsigned long)queue; | ||
| 212 | xenvif_stop_queue(queue); | ||
| 213 | mod_timer(&queue->rx_stalled, | ||
| 214 | jiffies + rx_drain_timeout_jiffies); | ||
| 215 | } | ||
| 216 | |||
| 217 | skb_queue_tail(&queue->rx_queue, skb); | ||
| 218 | xenvif_kick_thread(queue); | 172 | xenvif_kick_thread(queue); |
| 219 | 173 | ||
| 220 | return NETDEV_TX_OK; | 174 | return NETDEV_TX_OK; |
| @@ -465,6 +419,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
| 465 | vif->queues = NULL; | 419 | vif->queues = NULL; |
| 466 | vif->num_queues = 0; | 420 | vif->num_queues = 0; |
| 467 | 421 | ||
| 422 | spin_lock_init(&vif->lock); | ||
| 423 | |||
| 468 | dev->netdev_ops = &xenvif_netdev_ops; | 424 | dev->netdev_ops = &xenvif_netdev_ops; |
| 469 | dev->hw_features = NETIF_F_SG | | 425 | dev->hw_features = NETIF_F_SG | |
| 470 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 426 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
| @@ -508,6 +464,8 @@ int xenvif_init_queue(struct xenvif_queue *queue) | |||
| 508 | init_timer(&queue->credit_timeout); | 464 | init_timer(&queue->credit_timeout); |
| 509 | queue->credit_window_start = get_jiffies_64(); | 465 | queue->credit_window_start = get_jiffies_64(); |
| 510 | 466 | ||
| 467 | queue->rx_queue_max = XENVIF_RX_QUEUE_BYTES; | ||
| 468 | |||
| 511 | skb_queue_head_init(&queue->rx_queue); | 469 | skb_queue_head_init(&queue->rx_queue); |
| 512 | skb_queue_head_init(&queue->tx_queue); | 470 | skb_queue_head_init(&queue->tx_queue); |
| 513 | 471 | ||
| @@ -539,8 +497,6 @@ int xenvif_init_queue(struct xenvif_queue *queue) | |||
| 539 | queue->grant_tx_handle[i] = NETBACK_INVALID_HANDLE; | 497 | queue->grant_tx_handle[i] = NETBACK_INVALID_HANDLE; |
| 540 | } | 498 | } |
| 541 | 499 | ||
| 542 | init_timer(&queue->rx_stalled); | ||
| 543 | |||
| 544 | return 0; | 500 | return 0; |
| 545 | } | 501 | } |
| 546 | 502 | ||
| @@ -551,7 +507,6 @@ void xenvif_carrier_on(struct xenvif *vif) | |||
| 551 | dev_set_mtu(vif->dev, ETH_DATA_LEN); | 507 | dev_set_mtu(vif->dev, ETH_DATA_LEN); |
| 552 | netdev_update_features(vif->dev); | 508 | netdev_update_features(vif->dev); |
| 553 | set_bit(VIF_STATUS_CONNECTED, &vif->status); | 509 | set_bit(VIF_STATUS_CONNECTED, &vif->status); |
| 554 | netif_carrier_on(vif->dev); | ||
| 555 | if (netif_running(vif->dev)) | 510 | if (netif_running(vif->dev)) |
| 556 | xenvif_up(vif); | 511 | xenvif_up(vif); |
| 557 | rtnl_unlock(); | 512 | rtnl_unlock(); |
| @@ -611,6 +566,8 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, | |||
| 611 | disable_irq(queue->rx_irq); | 566 | disable_irq(queue->rx_irq); |
| 612 | } | 567 | } |
| 613 | 568 | ||
| 569 | queue->stalled = true; | ||
| 570 | |||
| 614 | task = kthread_create(xenvif_kthread_guest_rx, | 571 | task = kthread_create(xenvif_kthread_guest_rx, |
| 615 | (void *)queue, "%s-guest-rx", queue->name); | 572 | (void *)queue, "%s-guest-rx", queue->name); |
| 616 | if (IS_ERR(task)) { | 573 | if (IS_ERR(task)) { |
| @@ -674,7 +631,6 @@ void xenvif_disconnect(struct xenvif *vif) | |||
| 674 | netif_napi_del(&queue->napi); | 631 | netif_napi_del(&queue->napi); |
| 675 | 632 | ||
| 676 | if (queue->task) { | 633 | if (queue->task) { |
| 677 | del_timer_sync(&queue->rx_stalled); | ||
| 678 | kthread_stop(queue->task); | 634 | kthread_stop(queue->task); |
| 679 | queue->task = NULL; | 635 | queue->task = NULL; |
| 680 | } | 636 | } |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 08f65996534c..6563f0713fc0 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -55,13 +55,20 @@ | |||
| 55 | bool separate_tx_rx_irq = 1; | 55 | bool separate_tx_rx_irq = 1; |
| 56 | module_param(separate_tx_rx_irq, bool, 0644); | 56 | module_param(separate_tx_rx_irq, bool, 0644); |
| 57 | 57 | ||
| 58 | /* When guest ring is filled up, qdisc queues the packets for us, but we have | 58 | /* The time that packets can stay on the guest Rx internal queue |
| 59 | * to timeout them, otherwise other guests' packets can get stuck there | 59 | * before they are dropped. |
| 60 | */ | 60 | */ |
| 61 | unsigned int rx_drain_timeout_msecs = 10000; | 61 | unsigned int rx_drain_timeout_msecs = 10000; |
| 62 | module_param(rx_drain_timeout_msecs, uint, 0444); | 62 | module_param(rx_drain_timeout_msecs, uint, 0444); |
| 63 | unsigned int rx_drain_timeout_jiffies; | 63 | unsigned int rx_drain_timeout_jiffies; |
| 64 | 64 | ||
| 65 | /* The length of time before the frontend is considered unresponsive | ||
| 66 | * because it isn't providing Rx slots. | ||
| 67 | */ | ||
| 68 | static unsigned int rx_stall_timeout_msecs = 60000; | ||
| 69 | module_param(rx_stall_timeout_msecs, uint, 0444); | ||
| 70 | static unsigned int rx_stall_timeout_jiffies; | ||
| 71 | |||
| 65 | unsigned int xenvif_max_queues; | 72 | unsigned int xenvif_max_queues; |
| 66 | module_param_named(max_queues, xenvif_max_queues, uint, 0644); | 73 | module_param_named(max_queues, xenvif_max_queues, uint, 0644); |
| 67 | MODULE_PARM_DESC(max_queues, | 74 | MODULE_PARM_DESC(max_queues, |
| @@ -83,7 +90,6 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
| 83 | s8 st); | 90 | s8 st); |
| 84 | 91 | ||
| 85 | static inline int tx_work_todo(struct xenvif_queue *queue); | 92 | static inline int tx_work_todo(struct xenvif_queue *queue); |
| 86 | static inline int rx_work_todo(struct xenvif_queue *queue); | ||
| 87 | 93 | ||
| 88 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, | 94 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, |
| 89 | u16 id, | 95 | u16 id, |
| @@ -163,6 +169,69 @@ bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue, int needed) | |||
| 163 | return false; | 169 | return false; |
| 164 | } | 170 | } |
| 165 | 171 | ||
| 172 | void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb) | ||
| 173 | { | ||
| 174 | unsigned long flags; | ||
| 175 | |||
| 176 | spin_lock_irqsave(&queue->rx_queue.lock, flags); | ||
| 177 | |||
| 178 | __skb_queue_tail(&queue->rx_queue, skb); | ||
| 179 | |||
| 180 | queue->rx_queue_len += skb->len; | ||
| 181 | if (queue->rx_queue_len > queue->rx_queue_max) | ||
| 182 | netif_tx_stop_queue(netdev_get_tx_queue(queue->vif->dev, queue->id)); | ||
| 183 | |||
| 184 | spin_unlock_irqrestore(&queue->rx_queue.lock, flags); | ||
| 185 | } | ||
| 186 | |||
| 187 | static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue) | ||
| 188 | { | ||
| 189 | struct sk_buff *skb; | ||
| 190 | |||
| 191 | spin_lock_irq(&queue->rx_queue.lock); | ||
| 192 | |||
| 193 | skb = __skb_dequeue(&queue->rx_queue); | ||
| 194 | if (skb) | ||
| 195 | queue->rx_queue_len -= skb->len; | ||
| 196 | |||
| 197 | spin_unlock_irq(&queue->rx_queue.lock); | ||
| 198 | |||
| 199 | return skb; | ||
| 200 | } | ||
| 201 | |||
| 202 | static void xenvif_rx_queue_maybe_wake(struct xenvif_queue *queue) | ||
| 203 | { | ||
| 204 | spin_lock_irq(&queue->rx_queue.lock); | ||
| 205 | |||
| 206 | if (queue->rx_queue_len < queue->rx_queue_max) | ||
| 207 | netif_tx_wake_queue(netdev_get_tx_queue(queue->vif->dev, queue->id)); | ||
| 208 | |||
| 209 | spin_unlock_irq(&queue->rx_queue.lock); | ||
| 210 | } | ||
| 211 | |||
| 212 | |||
| 213 | static void xenvif_rx_queue_purge(struct xenvif_queue *queue) | ||
| 214 | { | ||
| 215 | struct sk_buff *skb; | ||
| 216 | while ((skb = xenvif_rx_dequeue(queue)) != NULL) | ||
| 217 | kfree_skb(skb); | ||
| 218 | } | ||
| 219 | |||
| 220 | static void xenvif_rx_queue_drop_expired(struct xenvif_queue *queue) | ||
| 221 | { | ||
| 222 | struct sk_buff *skb; | ||
| 223 | |||
| 224 | for(;;) { | ||
| 225 | skb = skb_peek(&queue->rx_queue); | ||
| 226 | if (!skb) | ||
| 227 | break; | ||
| 228 | if (time_before(jiffies, XENVIF_RX_CB(skb)->expires)) | ||
| 229 | break; | ||
| 230 | xenvif_rx_dequeue(queue); | ||
| 231 | kfree_skb(skb); | ||
| 232 | } | ||
| 233 | } | ||
| 234 | |||
| 166 | /* | 235 | /* |
| 167 | * Returns true if we should start a new receive buffer instead of | 236 | * Returns true if we should start a new receive buffer instead of |
| 168 | * adding 'size' bytes to a buffer which currently contains 'offset' | 237 | * adding 'size' bytes to a buffer which currently contains 'offset' |
| @@ -237,13 +306,6 @@ static struct xenvif_rx_meta *get_next_rx_buffer(struct xenvif_queue *queue, | |||
| 237 | return meta; | 306 | return meta; |
| 238 | } | 307 | } |
| 239 | 308 | ||
| 240 | struct xenvif_rx_cb { | ||
| 241 | int meta_slots_used; | ||
| 242 | bool full_coalesce; | ||
| 243 | }; | ||
| 244 | |||
| 245 | #define XENVIF_RX_CB(skb) ((struct xenvif_rx_cb *)(skb)->cb) | ||
| 246 | |||
| 247 | /* | 309 | /* |
| 248 | * Set up the grant operations for this fragment. If it's a flipping | 310 | * Set up the grant operations for this fragment. If it's a flipping |
| 249 | * interface, we also set up the unmap request from here. | 311 | * interface, we also set up the unmap request from here. |
| @@ -587,12 +649,15 @@ static void xenvif_rx_action(struct xenvif_queue *queue) | |||
| 587 | 649 | ||
| 588 | skb_queue_head_init(&rxq); | 650 | skb_queue_head_init(&rxq); |
| 589 | 651 | ||
| 590 | while ((skb = skb_dequeue(&queue->rx_queue)) != NULL) { | 652 | while (xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX) |
| 653 | && (skb = xenvif_rx_dequeue(queue)) != NULL) { | ||
| 591 | RING_IDX max_slots_needed; | 654 | RING_IDX max_slots_needed; |
| 592 | RING_IDX old_req_cons; | 655 | RING_IDX old_req_cons; |
| 593 | RING_IDX ring_slots_used; | 656 | RING_IDX ring_slots_used; |
| 594 | int i; | 657 | int i; |
| 595 | 658 | ||
| 659 | queue->last_rx_time = jiffies; | ||
| 660 | |||
| 596 | /* We need a cheap worse case estimate for the number of | 661 | /* We need a cheap worse case estimate for the number of |
| 597 | * slots we'll use. | 662 | * slots we'll use. |
| 598 | */ | 663 | */ |
| @@ -634,15 +699,6 @@ static void xenvif_rx_action(struct xenvif_queue *queue) | |||
| 634 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) | 699 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) |
| 635 | max_slots_needed++; | 700 | max_slots_needed++; |
| 636 | 701 | ||
| 637 | /* If the skb may not fit then bail out now */ | ||
| 638 | if (!xenvif_rx_ring_slots_available(queue, max_slots_needed)) { | ||
| 639 | skb_queue_head(&queue->rx_queue, skb); | ||
| 640 | need_to_notify = true; | ||
| 641 | queue->rx_last_skb_slots = max_slots_needed; | ||
| 642 | break; | ||
| 643 | } else | ||
| 644 | queue->rx_last_skb_slots = 0; | ||
| 645 | |||
| 646 | old_req_cons = queue->rx.req_cons; | 702 | old_req_cons = queue->rx.req_cons; |
| 647 | XENVIF_RX_CB(skb)->meta_slots_used = xenvif_gop_skb(skb, &npo, queue); | 703 | XENVIF_RX_CB(skb)->meta_slots_used = xenvif_gop_skb(skb, &npo, queue); |
| 648 | ring_slots_used = queue->rx.req_cons - old_req_cons; | 704 | ring_slots_used = queue->rx.req_cons - old_req_cons; |
| @@ -1869,12 +1925,6 @@ void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx) | |||
| 1869 | } | 1925 | } |
| 1870 | } | 1926 | } |
| 1871 | 1927 | ||
| 1872 | static inline int rx_work_todo(struct xenvif_queue *queue) | ||
| 1873 | { | ||
| 1874 | return (!skb_queue_empty(&queue->rx_queue) && | ||
| 1875 | xenvif_rx_ring_slots_available(queue, queue->rx_last_skb_slots)); | ||
| 1876 | } | ||
| 1877 | |||
| 1878 | static inline int tx_work_todo(struct xenvif_queue *queue) | 1928 | static inline int tx_work_todo(struct xenvif_queue *queue) |
| 1879 | { | 1929 | { |
| 1880 | if (likely(RING_HAS_UNCONSUMED_REQUESTS(&queue->tx))) | 1930 | if (likely(RING_HAS_UNCONSUMED_REQUESTS(&queue->tx))) |
| @@ -1931,92 +1981,121 @@ err: | |||
| 1931 | return err; | 1981 | return err; |
| 1932 | } | 1982 | } |
| 1933 | 1983 | ||
| 1934 | static void xenvif_start_queue(struct xenvif_queue *queue) | 1984 | static void xenvif_queue_carrier_off(struct xenvif_queue *queue) |
| 1935 | { | 1985 | { |
| 1936 | if (xenvif_schedulable(queue->vif)) | 1986 | struct xenvif *vif = queue->vif; |
| 1937 | xenvif_wake_queue(queue); | 1987 | |
| 1988 | queue->stalled = true; | ||
| 1989 | |||
| 1990 | /* At least one queue has stalled? Disable the carrier. */ | ||
| 1991 | spin_lock(&vif->lock); | ||
| 1992 | if (vif->stalled_queues++ == 0) { | ||
| 1993 | netdev_info(vif->dev, "Guest Rx stalled"); | ||
| 1994 | netif_carrier_off(vif->dev); | ||
| 1995 | } | ||
| 1996 | spin_unlock(&vif->lock); | ||
| 1938 | } | 1997 | } |
| 1939 | 1998 | ||
| 1940 | /* Only called from the queue's thread, it handles the situation when the guest | 1999 | static void xenvif_queue_carrier_on(struct xenvif_queue *queue) |
| 1941 | * doesn't post enough requests on the receiving ring. | ||
| 1942 | * First xenvif_start_xmit disables QDisc and start a timer, and then either the | ||
| 1943 | * timer fires, or the guest send an interrupt after posting new request. If it | ||
| 1944 | * is the timer, the carrier is turned off here. | ||
| 1945 | * */ | ||
| 1946 | static void xenvif_rx_purge_event(struct xenvif_queue *queue) | ||
| 1947 | { | 2000 | { |
| 1948 | /* Either the last unsuccesful skb or at least 1 slot should fit */ | 2001 | struct xenvif *vif = queue->vif; |
| 1949 | int needed = queue->rx_last_skb_slots ? | ||
| 1950 | queue->rx_last_skb_slots : 1; | ||
| 1951 | 2002 | ||
| 1952 | /* It is assumed that if the guest post new slots after this, the RX | 2003 | queue->last_rx_time = jiffies; /* Reset Rx stall detection. */ |
| 1953 | * interrupt will set the QUEUE_STATUS_RX_PURGE_EVENT bit and wake up | 2004 | queue->stalled = false; |
| 1954 | * the thread again | ||
| 1955 | */ | ||
| 1956 | set_bit(QUEUE_STATUS_RX_STALLED, &queue->status); | ||
| 1957 | if (!xenvif_rx_ring_slots_available(queue, needed)) { | ||
| 1958 | rtnl_lock(); | ||
| 1959 | if (netif_carrier_ok(queue->vif->dev)) { | ||
| 1960 | /* Timer fired and there are still no slots. Turn off | ||
| 1961 | * everything except the interrupts | ||
| 1962 | */ | ||
| 1963 | netif_carrier_off(queue->vif->dev); | ||
| 1964 | skb_queue_purge(&queue->rx_queue); | ||
| 1965 | queue->rx_last_skb_slots = 0; | ||
| 1966 | if (net_ratelimit()) | ||
| 1967 | netdev_err(queue->vif->dev, "Carrier off due to lack of guest response on queue %d\n", queue->id); | ||
| 1968 | } else { | ||
| 1969 | /* Probably an another queue already turned the carrier | ||
| 1970 | * off, make sure nothing is stucked in the internal | ||
| 1971 | * queue of this queue | ||
| 1972 | */ | ||
| 1973 | skb_queue_purge(&queue->rx_queue); | ||
| 1974 | queue->rx_last_skb_slots = 0; | ||
| 1975 | } | ||
| 1976 | rtnl_unlock(); | ||
| 1977 | } else if (!netif_carrier_ok(queue->vif->dev)) { | ||
| 1978 | unsigned int num_queues = queue->vif->num_queues; | ||
| 1979 | unsigned int i; | ||
| 1980 | /* The carrier was down, but an interrupt kicked | ||
| 1981 | * the thread again after new requests were | ||
| 1982 | * posted | ||
| 1983 | */ | ||
| 1984 | clear_bit(QUEUE_STATUS_RX_STALLED, | ||
| 1985 | &queue->status); | ||
| 1986 | rtnl_lock(); | ||
| 1987 | netif_carrier_on(queue->vif->dev); | ||
| 1988 | netif_tx_wake_all_queues(queue->vif->dev); | ||
| 1989 | rtnl_unlock(); | ||
| 1990 | 2005 | ||
| 1991 | for (i = 0; i < num_queues; i++) { | 2006 | /* All queues are ready? Enable the carrier. */ |
| 1992 | struct xenvif_queue *temp = &queue->vif->queues[i]; | 2007 | spin_lock(&vif->lock); |
| 2008 | if (--vif->stalled_queues == 0) { | ||
| 2009 | netdev_info(vif->dev, "Guest Rx ready"); | ||
| 2010 | netif_carrier_on(vif->dev); | ||
| 2011 | } | ||
| 2012 | spin_unlock(&vif->lock); | ||
| 2013 | } | ||
| 1993 | 2014 | ||
| 1994 | xenvif_napi_schedule_or_enable_events(temp); | 2015 | static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue) |
| 1995 | } | 2016 | { |
| 1996 | if (net_ratelimit()) | 2017 | RING_IDX prod, cons; |
| 1997 | netdev_err(queue->vif->dev, "Carrier on again\n"); | 2018 | |
| 1998 | } else { | 2019 | prod = queue->rx.sring->req_prod; |
| 1999 | /* Queuing were stopped, but the guest posted | 2020 | cons = queue->rx.req_cons; |
| 2000 | * new requests and sent an interrupt | 2021 | |
| 2001 | */ | 2022 | return !queue->stalled |
| 2002 | clear_bit(QUEUE_STATUS_RX_STALLED, | 2023 | && prod - cons < XEN_NETBK_RX_SLOTS_MAX |
| 2003 | &queue->status); | 2024 | && time_after(jiffies, |
| 2004 | del_timer_sync(&queue->rx_stalled); | 2025 | queue->last_rx_time + rx_stall_timeout_jiffies); |
| 2005 | xenvif_start_queue(queue); | 2026 | } |
| 2027 | |||
| 2028 | static bool xenvif_rx_queue_ready(struct xenvif_queue *queue) | ||
| 2029 | { | ||
| 2030 | RING_IDX prod, cons; | ||
| 2031 | |||
| 2032 | prod = queue->rx.sring->req_prod; | ||
| 2033 | cons = queue->rx.req_cons; | ||
| 2034 | |||
| 2035 | return queue->stalled | ||
| 2036 | && prod - cons >= XEN_NETBK_RX_SLOTS_MAX; | ||
| 2037 | } | ||
| 2038 | |||
| 2039 | static bool xenvif_have_rx_work(struct xenvif_queue *queue) | ||
| 2040 | { | ||
| 2041 | return (!skb_queue_empty(&queue->rx_queue) | ||
| 2042 | && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX)) | ||
| 2043 | || xenvif_rx_queue_stalled(queue) | ||
| 2044 | || xenvif_rx_queue_ready(queue) | ||
| 2045 | || kthread_should_stop() | ||
| 2046 | || queue->vif->disabled; | ||
| 2047 | } | ||
| 2048 | |||
| 2049 | static long xenvif_rx_queue_timeout(struct xenvif_queue *queue) | ||
| 2050 | { | ||
| 2051 | struct sk_buff *skb; | ||
| 2052 | long timeout; | ||
| 2053 | |||
| 2054 | skb = skb_peek(&queue->rx_queue); | ||
| 2055 | if (!skb) | ||
| 2056 | return MAX_SCHEDULE_TIMEOUT; | ||
| 2057 | |||
| 2058 | timeout = XENVIF_RX_CB(skb)->expires - jiffies; | ||
| 2059 | return timeout < 0 ? 0 : timeout; | ||
| 2060 | } | ||
| 2061 | |||
| 2062 | /* Wait until the guest Rx thread has work. | ||
| 2063 | * | ||
| 2064 | * The timeout needs to be adjusted based on the current head of the | ||
| 2065 | * queue (and not just the head at the beginning). In particular, if | ||
| 2066 | * the queue is initially empty an infinite timeout is used and this | ||
| 2067 | * needs to be reduced when a skb is queued. | ||
| 2068 | * | ||
| 2069 | * This cannot be done with wait_event_timeout() because it only | ||
| 2070 | * calculates the timeout once. | ||
| 2071 | */ | ||
| 2072 | static void xenvif_wait_for_rx_work(struct xenvif_queue *queue) | ||
| 2073 | { | ||
| 2074 | DEFINE_WAIT(wait); | ||
| 2075 | |||
| 2076 | if (xenvif_have_rx_work(queue)) | ||
| 2077 | return; | ||
| 2078 | |||
| 2079 | for (;;) { | ||
| 2080 | long ret; | ||
| 2081 | |||
| 2082 | prepare_to_wait(&queue->wq, &wait, TASK_INTERRUPTIBLE); | ||
| 2083 | if (xenvif_have_rx_work(queue)) | ||
| 2084 | break; | ||
| 2085 | ret = schedule_timeout(xenvif_rx_queue_timeout(queue)); | ||
| 2086 | if (!ret) | ||
| 2087 | break; | ||
| 2006 | } | 2088 | } |
| 2089 | finish_wait(&queue->wq, &wait); | ||
| 2007 | } | 2090 | } |
| 2008 | 2091 | ||
| 2009 | int xenvif_kthread_guest_rx(void *data) | 2092 | int xenvif_kthread_guest_rx(void *data) |
| 2010 | { | 2093 | { |
| 2011 | struct xenvif_queue *queue = data; | 2094 | struct xenvif_queue *queue = data; |
| 2012 | struct sk_buff *skb; | 2095 | struct xenvif *vif = queue->vif; |
| 2013 | 2096 | ||
| 2014 | while (!kthread_should_stop()) { | 2097 | for (;;) { |
| 2015 | wait_event_interruptible(queue->wq, | 2098 | xenvif_wait_for_rx_work(queue); |
| 2016 | rx_work_todo(queue) || | ||
| 2017 | queue->vif->disabled || | ||
| 2018 | test_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status) || | ||
| 2019 | kthread_should_stop()); | ||
| 2020 | 2099 | ||
| 2021 | if (kthread_should_stop()) | 2100 | if (kthread_should_stop()) |
| 2022 | break; | 2101 | break; |
| @@ -2028,35 +2107,38 @@ int xenvif_kthread_guest_rx(void *data) | |||
| 2028 | * context so we defer it here, if this thread is | 2107 | * context so we defer it here, if this thread is |
| 2029 | * associated with queue 0. | 2108 | * associated with queue 0. |
| 2030 | */ | 2109 | */ |
| 2031 | if (unlikely(queue->vif->disabled && queue->id == 0)) { | 2110 | if (unlikely(vif->disabled && queue->id == 0)) { |
| 2032 | xenvif_carrier_off(queue->vif); | 2111 | xenvif_carrier_off(vif); |
| 2033 | } else if (unlikely(queue->vif->disabled)) { | 2112 | xenvif_rx_queue_purge(queue); |
| 2034 | /* kthread_stop() would be called upon this thread soon, | 2113 | continue; |
| 2035 | * be a bit proactive | ||
| 2036 | */ | ||
| 2037 | skb_queue_purge(&queue->rx_queue); | ||
| 2038 | queue->rx_last_skb_slots = 0; | ||
| 2039 | } else if (unlikely(test_and_clear_bit(QUEUE_STATUS_RX_PURGE_EVENT, | ||
| 2040 | &queue->status))) { | ||
| 2041 | xenvif_rx_purge_event(queue); | ||
| 2042 | } else if (!netif_carrier_ok(queue->vif->dev)) { | ||
| 2043 | /* Another queue stalled and turned the carrier off, so | ||
| 2044 | * purge the internal queue of queues which were not | ||
| 2045 | * blocked | ||
| 2046 | */ | ||
| 2047 | skb_queue_purge(&queue->rx_queue); | ||
| 2048 | queue->rx_last_skb_slots = 0; | ||
| 2049 | } | 2114 | } |
| 2050 | 2115 | ||
| 2051 | if (!skb_queue_empty(&queue->rx_queue)) | 2116 | if (!skb_queue_empty(&queue->rx_queue)) |
| 2052 | xenvif_rx_action(queue); | 2117 | xenvif_rx_action(queue); |
| 2053 | 2118 | ||
| 2119 | /* If the guest hasn't provided any Rx slots for a | ||
| 2120 | * while it's probably not responsive, drop the | ||
| 2121 | * carrier so packets are dropped earlier. | ||
| 2122 | */ | ||
| 2123 | if (xenvif_rx_queue_stalled(queue)) | ||
| 2124 | xenvif_queue_carrier_off(queue); | ||
| 2125 | else if (xenvif_rx_queue_ready(queue)) | ||
| 2126 | xenvif_queue_carrier_on(queue); | ||
| 2127 | |||
| 2128 | /* Queued packets may have foreign pages from other | ||
| 2129 | * domains. These cannot be queued indefinitely as | ||
| 2130 | * this would starve guests of grant refs and transmit | ||
| 2131 | * slots. | ||
| 2132 | */ | ||
| 2133 | xenvif_rx_queue_drop_expired(queue); | ||
| 2134 | |||
| 2135 | xenvif_rx_queue_maybe_wake(queue); | ||
| 2136 | |||
| 2054 | cond_resched(); | 2137 | cond_resched(); |
| 2055 | } | 2138 | } |
| 2056 | 2139 | ||
| 2057 | /* Bin any remaining skbs */ | 2140 | /* Bin any remaining skbs */ |
| 2058 | while ((skb = skb_dequeue(&queue->rx_queue)) != NULL) | 2141 | xenvif_rx_queue_purge(queue); |
| 2059 | dev_kfree_skb(skb); | ||
| 2060 | 2142 | ||
| 2061 | return 0; | 2143 | return 0; |
| 2062 | } | 2144 | } |
| @@ -2113,6 +2195,7 @@ static int __init netback_init(void) | |||
| 2113 | goto failed_init; | 2195 | goto failed_init; |
| 2114 | 2196 | ||
| 2115 | rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs); | 2197 | rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs); |
| 2198 | rx_stall_timeout_jiffies = msecs_to_jiffies(rx_stall_timeout_msecs); | ||
| 2116 | 2199 | ||
| 2117 | #ifdef CONFIG_DEBUG_FS | 2200 | #ifdef CONFIG_DEBUG_FS |
| 2118 | xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL); | 2201 | xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL); |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 8079c31ac5e6..4e56a27f9689 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
| @@ -52,6 +52,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) | |||
| 52 | struct xenvif_queue *queue = m->private; | 52 | struct xenvif_queue *queue = m->private; |
| 53 | struct xen_netif_tx_back_ring *tx_ring = &queue->tx; | 53 | struct xen_netif_tx_back_ring *tx_ring = &queue->tx; |
| 54 | struct xen_netif_rx_back_ring *rx_ring = &queue->rx; | 54 | struct xen_netif_rx_back_ring *rx_ring = &queue->rx; |
| 55 | struct netdev_queue *dev_queue; | ||
| 55 | 56 | ||
| 56 | if (tx_ring->sring) { | 57 | if (tx_ring->sring) { |
| 57 | struct xen_netif_tx_sring *sring = tx_ring->sring; | 58 | struct xen_netif_tx_sring *sring = tx_ring->sring; |
| @@ -112,6 +113,13 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) | |||
| 112 | queue->credit_timeout.expires, | 113 | queue->credit_timeout.expires, |
| 113 | jiffies); | 114 | jiffies); |
| 114 | 115 | ||
| 116 | dev_queue = netdev_get_tx_queue(queue->vif->dev, queue->id); | ||
| 117 | |||
| 118 | seq_printf(m, "\nRx internal queue: len %u max %u pkts %u %s\n", | ||
| 119 | queue->rx_queue_len, queue->rx_queue_max, | ||
| 120 | skb_queue_len(&queue->rx_queue), | ||
| 121 | netif_tx_queue_stopped(dev_queue) ? "stopped" : "running"); | ||
| 122 | |||
| 115 | return 0; | 123 | return 0; |
| 116 | } | 124 | } |
| 117 | 125 | ||
| @@ -703,6 +711,7 @@ static void connect(struct backend_info *be) | |||
| 703 | be->vif->queues = vzalloc(requested_num_queues * | 711 | be->vif->queues = vzalloc(requested_num_queues * |
| 704 | sizeof(struct xenvif_queue)); | 712 | sizeof(struct xenvif_queue)); |
| 705 | be->vif->num_queues = requested_num_queues; | 713 | be->vif->num_queues = requested_num_queues; |
| 714 | be->vif->stalled_queues = requested_num_queues; | ||
| 706 | 715 | ||
| 707 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { | 716 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { |
| 708 | queue = &be->vif->queues[queue_index]; | 717 | queue = &be->vif->queues[queue_index]; |
| @@ -873,15 +882,10 @@ static int read_xenbus_vif_flags(struct backend_info *be) | |||
| 873 | if (!rx_copy) | 882 | if (!rx_copy) |
| 874 | return -EOPNOTSUPP; | 883 | return -EOPNOTSUPP; |
| 875 | 884 | ||
| 876 | if (vif->dev->tx_queue_len != 0) { | 885 | if (xenbus_scanf(XBT_NIL, dev->otherend, |
| 877 | if (xenbus_scanf(XBT_NIL, dev->otherend, | 886 | "feature-rx-notify", "%d", &val) < 0 || val == 0) { |
| 878 | "feature-rx-notify", "%d", &val) < 0) | 887 | xenbus_dev_fatal(dev, -EINVAL, "feature-rx-notify is mandatory"); |
| 879 | val = 0; | 888 | return -EINVAL; |
| 880 | if (val) | ||
| 881 | vif->can_queue = 1; | ||
| 882 | else | ||
| 883 | /* Must be non-zero for pfifo_fast to work. */ | ||
| 884 | vif->dev->tx_queue_len = 1; | ||
| 885 | } | 889 | } |
| 886 | 890 | ||
| 887 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", | 891 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", |
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 59fb12e84e6b..dc566b38645f 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c | |||
| @@ -243,23 +243,27 @@ static inline struct reserved_mem *__find_rmem(struct device_node *node) | |||
| 243 | * This function assign memory region pointed by "memory-region" device tree | 243 | * This function assign memory region pointed by "memory-region" device tree |
| 244 | * property to the given device. | 244 | * property to the given device. |
| 245 | */ | 245 | */ |
| 246 | void of_reserved_mem_device_init(struct device *dev) | 246 | int of_reserved_mem_device_init(struct device *dev) |
| 247 | { | 247 | { |
| 248 | struct reserved_mem *rmem; | 248 | struct reserved_mem *rmem; |
| 249 | struct device_node *np; | 249 | struct device_node *np; |
| 250 | int ret; | ||
| 250 | 251 | ||
| 251 | np = of_parse_phandle(dev->of_node, "memory-region", 0); | 252 | np = of_parse_phandle(dev->of_node, "memory-region", 0); |
| 252 | if (!np) | 253 | if (!np) |
| 253 | return; | 254 | return -ENODEV; |
| 254 | 255 | ||
| 255 | rmem = __find_rmem(np); | 256 | rmem = __find_rmem(np); |
| 256 | of_node_put(np); | 257 | of_node_put(np); |
| 257 | 258 | ||
| 258 | if (!rmem || !rmem->ops || !rmem->ops->device_init) | 259 | if (!rmem || !rmem->ops || !rmem->ops->device_init) |
| 259 | return; | 260 | return -EINVAL; |
| 261 | |||
| 262 | ret = rmem->ops->device_init(rmem, dev); | ||
| 263 | if (ret == 0) | ||
| 264 | dev_info(dev, "assigned reserved memory node %s\n", rmem->name); | ||
| 260 | 265 | ||
| 261 | rmem->ops->device_init(rmem, dev); | 266 | return ret; |
| 262 | dev_info(dev, "assigned reserved memory node %s\n", rmem->name); | ||
| 263 | } | 267 | } |
| 264 | 268 | ||
| 265 | /** | 269 | /** |
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 233fe8a88264..69202d1eb8fb 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
| @@ -275,15 +275,22 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp) | |||
| 275 | goto err_pcie; | 275 | goto err_pcie; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | /* allow the clocks to stabilize */ | ||
| 279 | usleep_range(200, 500); | ||
| 280 | |||
| 281 | /* power up core phy and enable ref clock */ | 278 | /* power up core phy and enable ref clock */ |
| 282 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 279 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
| 283 | IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); | 280 | IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); |
| 281 | /* | ||
| 282 | * the async reset input need ref clock to sync internally, | ||
| 283 | * when the ref clock comes after reset, internal synced | ||
| 284 | * reset time is too short, cannot meet the requirement. | ||
| 285 | * add one ~10us delay here. | ||
| 286 | */ | ||
| 287 | udelay(10); | ||
| 284 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 288 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
| 285 | IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); | 289 | IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); |
| 286 | 290 | ||
| 291 | /* allow the clocks to stabilize */ | ||
| 292 | usleep_range(200, 500); | ||
| 293 | |||
| 287 | /* Some boards don't have PCIe reset GPIO. */ | 294 | /* Some boards don't have PCIe reset GPIO. */ |
| 288 | if (gpio_is_valid(imx6_pcie->reset_gpio)) { | 295 | if (gpio_is_valid(imx6_pcie->reset_gpio)) { |
| 289 | gpio_set_value(imx6_pcie->reset_gpio, 0); | 296 | gpio_set_value(imx6_pcie->reset_gpio, 0); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 3a5e7e28b874..07aa722bb12c 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
| @@ -262,13 +262,6 @@ static int pciehp_probe(struct pcie_device *dev) | |||
| 262 | goto err_out_none; | 262 | goto err_out_none; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | if (!dev->port->subordinate) { | ||
| 266 | /* Can happen if we run out of bus numbers during probe */ | ||
| 267 | dev_err(&dev->device, | ||
| 268 | "Hotplug bridge without secondary bus, ignoring\n"); | ||
| 269 | goto err_out_none; | ||
| 270 | } | ||
| 271 | |||
| 272 | ctrl = pcie_init(dev); | 265 | ctrl = pcie_init(dev); |
| 273 | if (!ctrl) { | 266 | if (!ctrl) { |
| 274 | dev_err(&dev->device, "Controller initialization failed\n"); | 267 | dev_err(&dev->device, "Controller initialization failed\n"); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 92b6d9ab00e4..2c6643fdc0cf 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
| @@ -185,7 +185,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
| 185 | } | 185 | } |
| 186 | static DEVICE_ATTR_RO(modalias); | 186 | static DEVICE_ATTR_RO(modalias); |
| 187 | 187 | ||
| 188 | static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, | 188 | static ssize_t enable_store(struct device *dev, struct device_attribute *attr, |
| 189 | const char *buf, size_t count) | 189 | const char *buf, size_t count) |
| 190 | { | 190 | { |
| 191 | struct pci_dev *pdev = to_pci_dev(dev); | 191 | struct pci_dev *pdev = to_pci_dev(dev); |
| @@ -210,7 +210,7 @@ static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, | |||
| 210 | return result < 0 ? result : count; | 210 | return result < 0 ? result : count; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, | 213 | static ssize_t enable_show(struct device *dev, struct device_attribute *attr, |
| 214 | char *buf) | 214 | char *buf) |
| 215 | { | 215 | { |
| 216 | struct pci_dev *pdev; | 216 | struct pci_dev *pdev; |
| @@ -218,7 +218,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, | |||
| 218 | pdev = to_pci_dev(dev); | 218 | pdev = to_pci_dev(dev); |
| 219 | return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt)); | 219 | return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt)); |
| 220 | } | 220 | } |
| 221 | static DEVICE_ATTR_RW(enabled); | 221 | static DEVICE_ATTR_RW(enable); |
| 222 | 222 | ||
| 223 | #ifdef CONFIG_NUMA | 223 | #ifdef CONFIG_NUMA |
| 224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, | 224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, |
| @@ -563,7 +563,7 @@ static struct attribute *pci_dev_attrs[] = { | |||
| 563 | #endif | 563 | #endif |
| 564 | &dev_attr_dma_mask_bits.attr, | 564 | &dev_attr_dma_mask_bits.attr, |
| 565 | &dev_attr_consistent_dma_mask_bits.attr, | 565 | &dev_attr_consistent_dma_mask_bits.attr, |
| 566 | &dev_attr_enabled.attr, | 566 | &dev_attr_enable.attr, |
| 567 | &dev_attr_broken_parity_status.attr, | 567 | &dev_attr_broken_parity_status.attr, |
| 568 | &dev_attr_msi_bus.attr, | 568 | &dev_attr_msi_bus.attr, |
| 569 | #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) | 569 | #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) |
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c index e305416d7697..196a5c8838c4 100644 --- a/drivers/regulator/rk808-regulator.c +++ b/drivers/regulator/rk808-regulator.c | |||
| @@ -44,7 +44,7 @@ static const int rk808_buck_config_regs[] = { | |||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static const struct regulator_linear_range rk808_buck_voltage_ranges[] = { | 46 | static const struct regulator_linear_range rk808_buck_voltage_ranges[] = { |
| 47 | REGULATOR_LINEAR_RANGE(700000, 0, 63, 12500), | 47 | REGULATOR_LINEAR_RANGE(712500, 0, 63, 12500), |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | static const struct regulator_linear_range rk808_buck4_voltage_ranges[] = { | 50 | static const struct regulator_linear_range rk808_buck4_voltage_ranges[] = { |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 94ae1798d48a..6dd12ddbabc6 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
| @@ -1320,7 +1320,7 @@ config RTC_DRV_LPC32XX | |||
| 1320 | 1320 | ||
| 1321 | config RTC_DRV_PM8XXX | 1321 | config RTC_DRV_PM8XXX |
| 1322 | tristate "Qualcomm PMIC8XXX RTC" | 1322 | tristate "Qualcomm PMIC8XXX RTC" |
| 1323 | depends on MFD_PM8XXX | 1323 | depends on MFD_PM8XXX || MFD_SPMI_PMIC |
| 1324 | help | 1324 | help |
| 1325 | If you say yes here you get support for the | 1325 | If you say yes here you get support for the |
| 1326 | Qualcomm PMIC8XXX RTC. | 1326 | Qualcomm PMIC8XXX RTC. |
diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c index 314129e66d6e..92679df6d6e2 100644 --- a/drivers/rtc/rtc-bq32k.c +++ b/drivers/rtc/rtc-bq32k.c | |||
| @@ -160,7 +160,7 @@ static int trickle_charger_of_init(struct device *dev, struct device_node *node) | |||
| 160 | dev_err(dev, "bq32k: diode and resistor mismatch\n"); | 160 | dev_err(dev, "bq32k: diode and resistor mismatch\n"); |
| 161 | return -EINVAL; | 161 | return -EINVAL; |
| 162 | } | 162 | } |
| 163 | reg = 0x25; | 163 | reg = 0x45; |
| 164 | break; | 164 | break; |
| 165 | 165 | ||
| 166 | default: | 166 | default: |
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index 197699f358c7..5adcf111fc14 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c | |||
| @@ -27,21 +27,36 @@ | |||
| 27 | 27 | ||
| 28 | /* RTC_CTRL register bit fields */ | 28 | /* RTC_CTRL register bit fields */ |
| 29 | #define PM8xxx_RTC_ENABLE BIT(7) | 29 | #define PM8xxx_RTC_ENABLE BIT(7) |
| 30 | #define PM8xxx_RTC_ALARM_ENABLE BIT(1) | ||
| 31 | #define PM8xxx_RTC_ALARM_CLEAR BIT(0) | 30 | #define PM8xxx_RTC_ALARM_CLEAR BIT(0) |
| 32 | 31 | ||
| 33 | #define NUM_8_BIT_RTC_REGS 0x4 | 32 | #define NUM_8_BIT_RTC_REGS 0x4 |
| 34 | 33 | ||
| 35 | /** | 34 | /** |
| 35 | * struct pm8xxx_rtc_regs - describe RTC registers per PMIC versions | ||
| 36 | * @ctrl: base address of control register | ||
| 37 | * @write: base address of write register | ||
| 38 | * @read: base address of read register | ||
| 39 | * @alarm_ctrl: base address of alarm control register | ||
| 40 | * @alarm_ctrl2: base address of alarm control2 register | ||
| 41 | * @alarm_rw: base address of alarm read-write register | ||
| 42 | * @alarm_en: alarm enable mask | ||
| 43 | */ | ||
| 44 | struct pm8xxx_rtc_regs { | ||
| 45 | unsigned int ctrl; | ||
| 46 | unsigned int write; | ||
| 47 | unsigned int read; | ||
| 48 | unsigned int alarm_ctrl; | ||
| 49 | unsigned int alarm_ctrl2; | ||
| 50 | unsigned int alarm_rw; | ||
| 51 | unsigned int alarm_en; | ||
| 52 | }; | ||
| 53 | |||
| 54 | /** | ||
| 36 | * struct pm8xxx_rtc - rtc driver internal structure | 55 | * struct pm8xxx_rtc - rtc driver internal structure |
| 37 | * @rtc: rtc device for this driver. | 56 | * @rtc: rtc device for this driver. |
| 38 | * @regmap: regmap used to access RTC registers | 57 | * @regmap: regmap used to access RTC registers |
| 39 | * @allow_set_time: indicates whether writing to the RTC is allowed | 58 | * @allow_set_time: indicates whether writing to the RTC is allowed |
| 40 | * @rtc_alarm_irq: rtc alarm irq number. | 59 | * @rtc_alarm_irq: rtc alarm irq number. |
| 41 | * @rtc_base: address of rtc control register. | ||
| 42 | * @rtc_read_base: base address of read registers. | ||
| 43 | * @rtc_write_base: base address of write registers. | ||
| 44 | * @alarm_rw_base: base address of alarm registers. | ||
| 45 | * @ctrl_reg: rtc control register. | 60 | * @ctrl_reg: rtc control register. |
| 46 | * @rtc_dev: device structure. | 61 | * @rtc_dev: device structure. |
| 47 | * @ctrl_reg_lock: spinlock protecting access to ctrl_reg. | 62 | * @ctrl_reg_lock: spinlock protecting access to ctrl_reg. |
| @@ -51,11 +66,7 @@ struct pm8xxx_rtc { | |||
| 51 | struct regmap *regmap; | 66 | struct regmap *regmap; |
| 52 | bool allow_set_time; | 67 | bool allow_set_time; |
| 53 | int rtc_alarm_irq; | 68 | int rtc_alarm_irq; |
| 54 | int rtc_base; | 69 | const struct pm8xxx_rtc_regs *regs; |
| 55 | int rtc_read_base; | ||
| 56 | int rtc_write_base; | ||
| 57 | int alarm_rw_base; | ||
| 58 | u8 ctrl_reg; | ||
| 59 | struct device *rtc_dev; | 70 | struct device *rtc_dev; |
| 60 | spinlock_t ctrl_reg_lock; | 71 | spinlock_t ctrl_reg_lock; |
| 61 | }; | 72 | }; |
| @@ -71,8 +82,10 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
| 71 | { | 82 | { |
| 72 | int rc, i; | 83 | int rc, i; |
| 73 | unsigned long secs, irq_flags; | 84 | unsigned long secs, irq_flags; |
| 74 | u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, ctrl_reg; | 85 | u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0; |
| 86 | unsigned int ctrl_reg; | ||
| 75 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 87 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
| 88 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
| 76 | 89 | ||
| 77 | if (!rtc_dd->allow_set_time) | 90 | if (!rtc_dd->allow_set_time) |
| 78 | return -EACCES; | 91 | return -EACCES; |
| @@ -87,30 +100,30 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
| 87 | dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); | 100 | dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); |
| 88 | 101 | ||
| 89 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 102 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 90 | ctrl_reg = rtc_dd->ctrl_reg; | ||
| 91 | 103 | ||
| 92 | if (ctrl_reg & PM8xxx_RTC_ALARM_ENABLE) { | 104 | rc = regmap_read(rtc_dd->regmap, regs->ctrl, &ctrl_reg); |
| 105 | if (rc) | ||
| 106 | goto rtc_rw_fail; | ||
| 107 | |||
| 108 | if (ctrl_reg & regs->alarm_en) { | ||
| 93 | alarm_enabled = 1; | 109 | alarm_enabled = 1; |
| 94 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 110 | ctrl_reg &= ~regs->alarm_en; |
| 95 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 111 | rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); |
| 96 | if (rc) { | 112 | if (rc) { |
| 97 | dev_err(dev, "Write to RTC control register failed\n"); | 113 | dev_err(dev, "Write to RTC control register failed\n"); |
| 98 | goto rtc_rw_fail; | 114 | goto rtc_rw_fail; |
| 99 | } | 115 | } |
| 100 | rtc_dd->ctrl_reg = ctrl_reg; | ||
| 101 | } else { | ||
| 102 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | ||
| 103 | } | 116 | } |
| 104 | 117 | ||
| 105 | /* Write 0 to Byte[0] */ | 118 | /* Write 0 to Byte[0] */ |
| 106 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_write_base, 0); | 119 | rc = regmap_write(rtc_dd->regmap, regs->write, 0); |
| 107 | if (rc) { | 120 | if (rc) { |
| 108 | dev_err(dev, "Write to RTC write data register failed\n"); | 121 | dev_err(dev, "Write to RTC write data register failed\n"); |
| 109 | goto rtc_rw_fail; | 122 | goto rtc_rw_fail; |
| 110 | } | 123 | } |
| 111 | 124 | ||
| 112 | /* Write Byte[1], Byte[2], Byte[3] */ | 125 | /* Write Byte[1], Byte[2], Byte[3] */ |
| 113 | rc = regmap_bulk_write(rtc_dd->regmap, rtc_dd->rtc_write_base + 1, | 126 | rc = regmap_bulk_write(rtc_dd->regmap, regs->write + 1, |
| 114 | &value[1], sizeof(value) - 1); | 127 | &value[1], sizeof(value) - 1); |
| 115 | if (rc) { | 128 | if (rc) { |
| 116 | dev_err(dev, "Write to RTC write data register failed\n"); | 129 | dev_err(dev, "Write to RTC write data register failed\n"); |
| @@ -118,25 +131,23 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
| 118 | } | 131 | } |
| 119 | 132 | ||
| 120 | /* Write Byte[0] */ | 133 | /* Write Byte[0] */ |
| 121 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_write_base, value[0]); | 134 | rc = regmap_write(rtc_dd->regmap, regs->write, value[0]); |
| 122 | if (rc) { | 135 | if (rc) { |
| 123 | dev_err(dev, "Write to RTC write data register failed\n"); | 136 | dev_err(dev, "Write to RTC write data register failed\n"); |
| 124 | goto rtc_rw_fail; | 137 | goto rtc_rw_fail; |
| 125 | } | 138 | } |
| 126 | 139 | ||
| 127 | if (alarm_enabled) { | 140 | if (alarm_enabled) { |
| 128 | ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE; | 141 | ctrl_reg |= regs->alarm_en; |
| 129 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 142 | rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); |
| 130 | if (rc) { | 143 | if (rc) { |
| 131 | dev_err(dev, "Write to RTC control register failed\n"); | 144 | dev_err(dev, "Write to RTC control register failed\n"); |
| 132 | goto rtc_rw_fail; | 145 | goto rtc_rw_fail; |
| 133 | } | 146 | } |
| 134 | rtc_dd->ctrl_reg = ctrl_reg; | ||
| 135 | } | 147 | } |
| 136 | 148 | ||
| 137 | rtc_rw_fail: | 149 | rtc_rw_fail: |
| 138 | if (alarm_enabled) | 150 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 139 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | ||
| 140 | 151 | ||
| 141 | return rc; | 152 | return rc; |
| 142 | } | 153 | } |
| @@ -148,9 +159,9 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 148 | unsigned long secs; | 159 | unsigned long secs; |
| 149 | unsigned int reg; | 160 | unsigned int reg; |
| 150 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 161 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
| 162 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
| 151 | 163 | ||
| 152 | rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->rtc_read_base, | 164 | rc = regmap_bulk_read(rtc_dd->regmap, regs->read, value, sizeof(value)); |
| 153 | value, sizeof(value)); | ||
| 154 | if (rc) { | 165 | if (rc) { |
| 155 | dev_err(dev, "RTC read data register failed\n"); | 166 | dev_err(dev, "RTC read data register failed\n"); |
| 156 | return rc; | 167 | return rc; |
| @@ -160,14 +171,14 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 160 | * Read the LSB again and check if there has been a carry over. | 171 | * Read the LSB again and check if there has been a carry over. |
| 161 | * If there is, redo the read operation. | 172 | * If there is, redo the read operation. |
| 162 | */ | 173 | */ |
| 163 | rc = regmap_read(rtc_dd->regmap, rtc_dd->rtc_read_base, ®); | 174 | rc = regmap_read(rtc_dd->regmap, regs->read, ®); |
| 164 | if (rc < 0) { | 175 | if (rc < 0) { |
| 165 | dev_err(dev, "RTC read data register failed\n"); | 176 | dev_err(dev, "RTC read data register failed\n"); |
| 166 | return rc; | 177 | return rc; |
| 167 | } | 178 | } |
| 168 | 179 | ||
| 169 | if (unlikely(reg < value[0])) { | 180 | if (unlikely(reg < value[0])) { |
| 170 | rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->rtc_read_base, | 181 | rc = regmap_bulk_read(rtc_dd->regmap, regs->read, |
| 171 | value, sizeof(value)); | 182 | value, sizeof(value)); |
| 172 | if (rc) { | 183 | if (rc) { |
| 173 | dev_err(dev, "RTC read data register failed\n"); | 184 | dev_err(dev, "RTC read data register failed\n"); |
| @@ -195,9 +206,11 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 195 | static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | 206 | static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
| 196 | { | 207 | { |
| 197 | int rc, i; | 208 | int rc, i; |
| 198 | u8 value[NUM_8_BIT_RTC_REGS], ctrl_reg; | 209 | u8 value[NUM_8_BIT_RTC_REGS]; |
| 210 | unsigned int ctrl_reg; | ||
| 199 | unsigned long secs, irq_flags; | 211 | unsigned long secs, irq_flags; |
| 200 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 212 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
| 213 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
| 201 | 214 | ||
| 202 | rtc_tm_to_time(&alarm->time, &secs); | 215 | rtc_tm_to_time(&alarm->time, &secs); |
| 203 | 216 | ||
| @@ -208,28 +221,28 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 208 | 221 | ||
| 209 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 222 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 210 | 223 | ||
| 211 | rc = regmap_bulk_write(rtc_dd->regmap, rtc_dd->alarm_rw_base, value, | 224 | rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value, |
| 212 | sizeof(value)); | 225 | sizeof(value)); |
| 213 | if (rc) { | 226 | if (rc) { |
| 214 | dev_err(dev, "Write to RTC ALARM register failed\n"); | 227 | dev_err(dev, "Write to RTC ALARM register failed\n"); |
| 215 | goto rtc_rw_fail; | 228 | goto rtc_rw_fail; |
| 216 | } | 229 | } |
| 217 | 230 | ||
| 218 | ctrl_reg = rtc_dd->ctrl_reg; | 231 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); |
| 232 | if (rc) | ||
| 233 | goto rtc_rw_fail; | ||
| 219 | 234 | ||
| 220 | if (alarm->enabled) | 235 | if (alarm->enabled) |
| 221 | ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE; | 236 | ctrl_reg |= regs->alarm_en; |
| 222 | else | 237 | else |
| 223 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 238 | ctrl_reg &= ~regs->alarm_en; |
| 224 | 239 | ||
| 225 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 240 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); |
| 226 | if (rc) { | 241 | if (rc) { |
| 227 | dev_err(dev, "Write to RTC control register failed\n"); | 242 | dev_err(dev, "Write to RTC alarm control register failed\n"); |
| 228 | goto rtc_rw_fail; | 243 | goto rtc_rw_fail; |
| 229 | } | 244 | } |
| 230 | 245 | ||
| 231 | rtc_dd->ctrl_reg = ctrl_reg; | ||
| 232 | |||
| 233 | dev_dbg(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n", | 246 | dev_dbg(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n", |
| 234 | alarm->time.tm_hour, alarm->time.tm_min, | 247 | alarm->time.tm_hour, alarm->time.tm_min, |
| 235 | alarm->time.tm_sec, alarm->time.tm_mday, | 248 | alarm->time.tm_sec, alarm->time.tm_mday, |
| @@ -245,8 +258,9 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
| 245 | u8 value[NUM_8_BIT_RTC_REGS]; | 258 | u8 value[NUM_8_BIT_RTC_REGS]; |
| 246 | unsigned long secs; | 259 | unsigned long secs; |
| 247 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 260 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
| 261 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
| 248 | 262 | ||
| 249 | rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->alarm_rw_base, value, | 263 | rc = regmap_bulk_read(rtc_dd->regmap, regs->alarm_rw, value, |
| 250 | sizeof(value)); | 264 | sizeof(value)); |
| 251 | if (rc) { | 265 | if (rc) { |
| 252 | dev_err(dev, "RTC alarm time read failed\n"); | 266 | dev_err(dev, "RTC alarm time read failed\n"); |
| @@ -276,25 +290,26 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) | |||
| 276 | int rc; | 290 | int rc; |
| 277 | unsigned long irq_flags; | 291 | unsigned long irq_flags; |
| 278 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 292 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
| 279 | u8 ctrl_reg; | 293 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; |
| 294 | unsigned int ctrl_reg; | ||
| 280 | 295 | ||
| 281 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 296 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 282 | 297 | ||
| 283 | ctrl_reg = rtc_dd->ctrl_reg; | 298 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); |
| 299 | if (rc) | ||
| 300 | goto rtc_rw_fail; | ||
| 284 | 301 | ||
| 285 | if (enable) | 302 | if (enable) |
| 286 | ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE; | 303 | ctrl_reg |= regs->alarm_en; |
| 287 | else | 304 | else |
| 288 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 305 | ctrl_reg &= ~regs->alarm_en; |
| 289 | 306 | ||
| 290 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 307 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); |
| 291 | if (rc) { | 308 | if (rc) { |
| 292 | dev_err(dev, "Write to RTC control register failed\n"); | 309 | dev_err(dev, "Write to RTC control register failed\n"); |
| 293 | goto rtc_rw_fail; | 310 | goto rtc_rw_fail; |
| 294 | } | 311 | } |
| 295 | 312 | ||
| 296 | rtc_dd->ctrl_reg = ctrl_reg; | ||
| 297 | |||
| 298 | rtc_rw_fail: | 313 | rtc_rw_fail: |
| 299 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | 314 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 300 | return rc; | 315 | return rc; |
| @@ -311,6 +326,7 @@ static const struct rtc_class_ops pm8xxx_rtc_ops = { | |||
| 311 | static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) | 326 | static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) |
| 312 | { | 327 | { |
| 313 | struct pm8xxx_rtc *rtc_dd = dev_id; | 328 | struct pm8xxx_rtc *rtc_dd = dev_id; |
| 329 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
| 314 | unsigned int ctrl_reg; | 330 | unsigned int ctrl_reg; |
| 315 | int rc; | 331 | int rc; |
| 316 | unsigned long irq_flags; | 332 | unsigned long irq_flags; |
| @@ -320,48 +336,100 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) | |||
| 320 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 336 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 321 | 337 | ||
| 322 | /* Clear the alarm enable bit */ | 338 | /* Clear the alarm enable bit */ |
| 323 | ctrl_reg = rtc_dd->ctrl_reg; | 339 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); |
| 324 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 340 | if (rc) { |
| 341 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | ||
| 342 | goto rtc_alarm_handled; | ||
| 343 | } | ||
| 344 | |||
| 345 | ctrl_reg &= ~regs->alarm_en; | ||
| 325 | 346 | ||
| 326 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 347 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); |
| 327 | if (rc) { | 348 | if (rc) { |
| 328 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | 349 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 329 | dev_err(rtc_dd->rtc_dev, | 350 | dev_err(rtc_dd->rtc_dev, |
| 330 | "Write to RTC control register failed\n"); | 351 | "Write to alarm control register failed\n"); |
| 331 | goto rtc_alarm_handled; | 352 | goto rtc_alarm_handled; |
| 332 | } | 353 | } |
| 333 | 354 | ||
| 334 | rtc_dd->ctrl_reg = ctrl_reg; | ||
| 335 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | 355 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
| 336 | 356 | ||
| 337 | /* Clear RTC alarm register */ | 357 | /* Clear RTC alarm register */ |
| 338 | rc = regmap_read(rtc_dd->regmap, | 358 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl2, &ctrl_reg); |
| 339 | rtc_dd->rtc_base + PM8XXX_ALARM_CTRL_OFFSET, | ||
| 340 | &ctrl_reg); | ||
| 341 | if (rc) { | 359 | if (rc) { |
| 342 | dev_err(rtc_dd->rtc_dev, | 360 | dev_err(rtc_dd->rtc_dev, |
| 343 | "RTC Alarm control register read failed\n"); | 361 | "RTC Alarm control2 register read failed\n"); |
| 344 | goto rtc_alarm_handled; | 362 | goto rtc_alarm_handled; |
| 345 | } | 363 | } |
| 346 | 364 | ||
| 347 | ctrl_reg &= ~PM8xxx_RTC_ALARM_CLEAR; | 365 | ctrl_reg |= PM8xxx_RTC_ALARM_CLEAR; |
| 348 | rc = regmap_write(rtc_dd->regmap, | 366 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl2, ctrl_reg); |
| 349 | rtc_dd->rtc_base + PM8XXX_ALARM_CTRL_OFFSET, | ||
| 350 | ctrl_reg); | ||
| 351 | if (rc) | 367 | if (rc) |
| 352 | dev_err(rtc_dd->rtc_dev, | 368 | dev_err(rtc_dd->rtc_dev, |
| 353 | "Write to RTC Alarm control register failed\n"); | 369 | "Write to RTC Alarm control2 register failed\n"); |
| 354 | 370 | ||
| 355 | rtc_alarm_handled: | 371 | rtc_alarm_handled: |
| 356 | return IRQ_HANDLED; | 372 | return IRQ_HANDLED; |
| 357 | } | 373 | } |
| 358 | 374 | ||
| 375 | static int pm8xxx_rtc_enable(struct pm8xxx_rtc *rtc_dd) | ||
| 376 | { | ||
| 377 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
| 378 | unsigned int ctrl_reg; | ||
| 379 | int rc; | ||
| 380 | |||
| 381 | /* Check if the RTC is on, else turn it on */ | ||
| 382 | rc = regmap_read(rtc_dd->regmap, regs->ctrl, &ctrl_reg); | ||
| 383 | if (rc) | ||
| 384 | return rc; | ||
| 385 | |||
| 386 | if (!(ctrl_reg & PM8xxx_RTC_ENABLE)) { | ||
| 387 | ctrl_reg |= PM8xxx_RTC_ENABLE; | ||
| 388 | rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); | ||
| 389 | if (rc) | ||
| 390 | return rc; | ||
| 391 | } | ||
| 392 | |||
| 393 | return 0; | ||
| 394 | } | ||
| 395 | |||
| 396 | static const struct pm8xxx_rtc_regs pm8921_regs = { | ||
| 397 | .ctrl = 0x11d, | ||
| 398 | .write = 0x11f, | ||
| 399 | .read = 0x123, | ||
| 400 | .alarm_rw = 0x127, | ||
| 401 | .alarm_ctrl = 0x11d, | ||
| 402 | .alarm_ctrl2 = 0x11e, | ||
| 403 | .alarm_en = BIT(1), | ||
| 404 | }; | ||
| 405 | |||
| 406 | static const struct pm8xxx_rtc_regs pm8058_regs = { | ||
| 407 | .ctrl = 0x1e8, | ||
| 408 | .write = 0x1ea, | ||
| 409 | .read = 0x1ee, | ||
| 410 | .alarm_rw = 0x1f2, | ||
| 411 | .alarm_ctrl = 0x1e8, | ||
| 412 | .alarm_ctrl2 = 0x1e9, | ||
| 413 | .alarm_en = BIT(1), | ||
| 414 | }; | ||
| 415 | |||
| 416 | static const struct pm8xxx_rtc_regs pm8941_regs = { | ||
| 417 | .ctrl = 0x6046, | ||
| 418 | .write = 0x6040, | ||
| 419 | .read = 0x6048, | ||
| 420 | .alarm_rw = 0x6140, | ||
| 421 | .alarm_ctrl = 0x6146, | ||
| 422 | .alarm_ctrl2 = 0x6148, | ||
| 423 | .alarm_en = BIT(7), | ||
| 424 | }; | ||
| 425 | |||
| 359 | /* | 426 | /* |
| 360 | * Hardcoded RTC bases until IORESOURCE_REG mapping is figured out | 427 | * Hardcoded RTC bases until IORESOURCE_REG mapping is figured out |
| 361 | */ | 428 | */ |
| 362 | static const struct of_device_id pm8xxx_id_table[] = { | 429 | static const struct of_device_id pm8xxx_id_table[] = { |
| 363 | { .compatible = "qcom,pm8921-rtc", .data = (void *) 0x11D }, | 430 | { .compatible = "qcom,pm8921-rtc", .data = &pm8921_regs }, |
| 364 | { .compatible = "qcom,pm8058-rtc", .data = (void *) 0x1E8 }, | 431 | { .compatible = "qcom,pm8058-rtc", .data = &pm8058_regs }, |
| 432 | { .compatible = "qcom,pm8941-rtc", .data = &pm8941_regs }, | ||
| 365 | { }, | 433 | { }, |
| 366 | }; | 434 | }; |
| 367 | MODULE_DEVICE_TABLE(of, pm8xxx_id_table); | 435 | MODULE_DEVICE_TABLE(of, pm8xxx_id_table); |
| @@ -369,7 +437,6 @@ MODULE_DEVICE_TABLE(of, pm8xxx_id_table); | |||
| 369 | static int pm8xxx_rtc_probe(struct platform_device *pdev) | 437 | static int pm8xxx_rtc_probe(struct platform_device *pdev) |
| 370 | { | 438 | { |
| 371 | int rc; | 439 | int rc; |
| 372 | unsigned int ctrl_reg; | ||
| 373 | struct pm8xxx_rtc *rtc_dd; | 440 | struct pm8xxx_rtc *rtc_dd; |
| 374 | const struct of_device_id *match; | 441 | const struct of_device_id *match; |
| 375 | 442 | ||
| @@ -399,33 +466,12 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) | |||
| 399 | rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node, | 466 | rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node, |
| 400 | "allow-set-time"); | 467 | "allow-set-time"); |
| 401 | 468 | ||
| 402 | rtc_dd->rtc_base = (long) match->data; | 469 | rtc_dd->regs = match->data; |
| 403 | |||
| 404 | /* Setup RTC register addresses */ | ||
| 405 | rtc_dd->rtc_write_base = rtc_dd->rtc_base + PM8XXX_RTC_WRITE_OFFSET; | ||
| 406 | rtc_dd->rtc_read_base = rtc_dd->rtc_base + PM8XXX_RTC_READ_OFFSET; | ||
| 407 | rtc_dd->alarm_rw_base = rtc_dd->rtc_base + PM8XXX_ALARM_RW_OFFSET; | ||
| 408 | |||
| 409 | rtc_dd->rtc_dev = &pdev->dev; | 470 | rtc_dd->rtc_dev = &pdev->dev; |
| 410 | 471 | ||
| 411 | /* Check if the RTC is on, else turn it on */ | 472 | rc = pm8xxx_rtc_enable(rtc_dd); |
| 412 | rc = regmap_read(rtc_dd->regmap, rtc_dd->rtc_base, &ctrl_reg); | 473 | if (rc) |
| 413 | if (rc) { | ||
| 414 | dev_err(&pdev->dev, "RTC control register read failed!\n"); | ||
| 415 | return rc; | 474 | return rc; |
| 416 | } | ||
| 417 | |||
| 418 | if (!(ctrl_reg & PM8xxx_RTC_ENABLE)) { | ||
| 419 | ctrl_reg |= PM8xxx_RTC_ENABLE; | ||
| 420 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | ||
| 421 | if (rc) { | ||
| 422 | dev_err(&pdev->dev, | ||
| 423 | "Write to RTC control register failed\n"); | ||
| 424 | return rc; | ||
| 425 | } | ||
| 426 | } | ||
| 427 | |||
| 428 | rtc_dd->ctrl_reg = ctrl_reg; | ||
| 429 | 475 | ||
| 430 | platform_set_drvdata(pdev, rtc_dd); | 476 | platform_set_drvdata(pdev, rtc_dd); |
| 431 | 477 | ||
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index a6b1252c9941..806072238c00 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -535,13 +535,15 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
| 535 | } | 535 | } |
| 536 | clk_prepare_enable(info->rtc_clk); | 536 | clk_prepare_enable(info->rtc_clk); |
| 537 | 537 | ||
| 538 | info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src"); | 538 | if (info->data->needs_src_clk) { |
| 539 | if (IS_ERR(info->rtc_src_clk)) { | 539 | info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src"); |
| 540 | dev_err(&pdev->dev, "failed to find rtc source clock\n"); | 540 | if (IS_ERR(info->rtc_src_clk)) { |
| 541 | return PTR_ERR(info->rtc_src_clk); | 541 | dev_err(&pdev->dev, |
| 542 | "failed to find rtc source clock\n"); | ||
| 543 | return PTR_ERR(info->rtc_src_clk); | ||
| 544 | } | ||
| 545 | clk_prepare_enable(info->rtc_src_clk); | ||
| 542 | } | 546 | } |
| 543 | clk_prepare_enable(info->rtc_src_clk); | ||
| 544 | |||
| 545 | 547 | ||
| 546 | /* check to see if everything is setup correctly */ | 548 | /* check to see if everything is setup correctly */ |
| 547 | if (info->data->enable) | 549 | if (info->data->enable) |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 729215885250..72e12bad14b9 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
| @@ -669,6 +669,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
| 669 | master->cleanup = dw_spi_cleanup; | 669 | master->cleanup = dw_spi_cleanup; |
| 670 | master->transfer_one_message = dw_spi_transfer_one_message; | 670 | master->transfer_one_message = dw_spi_transfer_one_message; |
| 671 | master->max_speed_hz = dws->max_freq; | 671 | master->max_speed_hz = dws->max_freq; |
| 672 | master->dev.of_node = dev->of_node; | ||
| 672 | 673 | ||
| 673 | /* Basic HW init */ | 674 | /* Basic HW init */ |
| 674 | spi_hw_init(dws); | 675 | spi_hw_init(dws); |
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 835cdda6f4f5..c76b7d7879df 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
| @@ -454,7 +454,7 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
| 454 | spi->master = master; | 454 | spi->master = master; |
| 455 | 455 | ||
| 456 | of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); | 456 | of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); |
| 457 | devdata = of_id->data; | 457 | devdata = (of_id) ? of_id->data : &orion_spi_dev_data; |
| 458 | spi->devdata = devdata; | 458 | spi->devdata = devdata; |
| 459 | 459 | ||
| 460 | spi->clk = devm_clk_get(&pdev->dev, NULL); | 460 | spi->clk = devm_clk_get(&pdev->dev, NULL); |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index f35f723816ea..fc2dd8441608 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
| @@ -1106,7 +1106,7 @@ err_rxdesc: | |||
| 1106 | pl022->sgt_tx.nents, DMA_TO_DEVICE); | 1106 | pl022->sgt_tx.nents, DMA_TO_DEVICE); |
| 1107 | err_tx_sgmap: | 1107 | err_tx_sgmap: |
| 1108 | dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl, | 1108 | dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl, |
| 1109 | pl022->sgt_tx.nents, DMA_FROM_DEVICE); | 1109 | pl022->sgt_rx.nents, DMA_FROM_DEVICE); |
| 1110 | err_rx_sgmap: | 1110 | err_rx_sgmap: |
| 1111 | sg_free_table(&pl022->sgt_tx); | 1111 | sg_free_table(&pl022->sgt_tx); |
| 1112 | err_alloc_tx_sg: | 1112 | err_alloc_tx_sg: |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index f96ea8a38d64..87bc16f491f0 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
| @@ -145,6 +145,9 @@ | |||
| 145 | #define RXBUSY (1 << 0) | 145 | #define RXBUSY (1 << 0) |
| 146 | #define TXBUSY (1 << 1) | 146 | #define TXBUSY (1 << 1) |
| 147 | 147 | ||
| 148 | /* sclk_out: spi master internal logic in rk3x can support 50Mhz */ | ||
| 149 | #define MAX_SCLK_OUT 50000000 | ||
| 150 | |||
| 148 | enum rockchip_ssi_type { | 151 | enum rockchip_ssi_type { |
| 149 | SSI_MOTO_SPI = 0, | 152 | SSI_MOTO_SPI = 0, |
| 150 | SSI_TI_SSP, | 153 | SSI_TI_SSP, |
| @@ -325,6 +328,8 @@ static int rockchip_spi_unprepare_message(struct spi_master *master, | |||
| 325 | 328 | ||
| 326 | spin_unlock_irqrestore(&rs->lock, flags); | 329 | spin_unlock_irqrestore(&rs->lock, flags); |
| 327 | 330 | ||
| 331 | spi_enable_chip(rs, 0); | ||
| 332 | |||
| 328 | return 0; | 333 | return 0; |
| 329 | } | 334 | } |
| 330 | 335 | ||
| @@ -381,6 +386,8 @@ static int rockchip_spi_pio_transfer(struct rockchip_spi *rs) | |||
| 381 | if (rs->tx) | 386 | if (rs->tx) |
| 382 | wait_for_idle(rs); | 387 | wait_for_idle(rs); |
| 383 | 388 | ||
| 389 | spi_enable_chip(rs, 0); | ||
| 390 | |||
| 384 | return 0; | 391 | return 0; |
| 385 | } | 392 | } |
| 386 | 393 | ||
| @@ -392,8 +399,10 @@ static void rockchip_spi_dma_rxcb(void *data) | |||
| 392 | spin_lock_irqsave(&rs->lock, flags); | 399 | spin_lock_irqsave(&rs->lock, flags); |
| 393 | 400 | ||
| 394 | rs->state &= ~RXBUSY; | 401 | rs->state &= ~RXBUSY; |
| 395 | if (!(rs->state & TXBUSY)) | 402 | if (!(rs->state & TXBUSY)) { |
| 403 | spi_enable_chip(rs, 0); | ||
| 396 | spi_finalize_current_transfer(rs->master); | 404 | spi_finalize_current_transfer(rs->master); |
| 405 | } | ||
| 397 | 406 | ||
| 398 | spin_unlock_irqrestore(&rs->lock, flags); | 407 | spin_unlock_irqrestore(&rs->lock, flags); |
| 399 | } | 408 | } |
| @@ -409,8 +418,10 @@ static void rockchip_spi_dma_txcb(void *data) | |||
| 409 | spin_lock_irqsave(&rs->lock, flags); | 418 | spin_lock_irqsave(&rs->lock, flags); |
| 410 | 419 | ||
| 411 | rs->state &= ~TXBUSY; | 420 | rs->state &= ~TXBUSY; |
| 412 | if (!(rs->state & RXBUSY)) | 421 | if (!(rs->state & RXBUSY)) { |
| 422 | spi_enable_chip(rs, 0); | ||
| 413 | spi_finalize_current_transfer(rs->master); | 423 | spi_finalize_current_transfer(rs->master); |
| 424 | } | ||
| 414 | 425 | ||
| 415 | spin_unlock_irqrestore(&rs->lock, flags); | 426 | spin_unlock_irqrestore(&rs->lock, flags); |
| 416 | } | 427 | } |
| @@ -496,12 +507,19 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
| 496 | dmacr |= RF_DMA_EN; | 507 | dmacr |= RF_DMA_EN; |
| 497 | } | 508 | } |
| 498 | 509 | ||
| 510 | if (WARN_ON(rs->speed > MAX_SCLK_OUT)) | ||
| 511 | rs->speed = MAX_SCLK_OUT; | ||
| 512 | |||
| 513 | /* the minimum divsor is 2 */ | ||
| 514 | if (rs->max_freq < 2 * rs->speed) { | ||
| 515 | clk_set_rate(rs->spiclk, 2 * rs->speed); | ||
| 516 | rs->max_freq = clk_get_rate(rs->spiclk); | ||
| 517 | } | ||
| 518 | |||
| 499 | /* div doesn't support odd number */ | 519 | /* div doesn't support odd number */ |
| 500 | div = max_t(u32, rs->max_freq / rs->speed, 1); | 520 | div = max_t(u32, rs->max_freq / rs->speed, 1); |
| 501 | div = (div + 1) & 0xfffe; | 521 | div = (div + 1) & 0xfffe; |
| 502 | 522 | ||
| 503 | spi_enable_chip(rs, 0); | ||
| 504 | |||
| 505 | writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0); | 523 | writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0); |
| 506 | 524 | ||
| 507 | writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1); | 525 | writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1); |
| @@ -515,8 +533,6 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
| 515 | spi_set_clk(rs, div); | 533 | spi_set_clk(rs, div); |
| 516 | 534 | ||
| 517 | dev_dbg(rs->dev, "cr0 0x%x, div %d\n", cr0, div); | 535 | dev_dbg(rs->dev, "cr0 0x%x, div %d\n", cr0, div); |
| 518 | |||
| 519 | spi_enable_chip(rs, 1); | ||
| 520 | } | 536 | } |
| 521 | 537 | ||
| 522 | static int rockchip_spi_transfer_one( | 538 | static int rockchip_spi_transfer_one( |
| @@ -524,7 +540,7 @@ static int rockchip_spi_transfer_one( | |||
| 524 | struct spi_device *spi, | 540 | struct spi_device *spi, |
| 525 | struct spi_transfer *xfer) | 541 | struct spi_transfer *xfer) |
| 526 | { | 542 | { |
| 527 | int ret = 0; | 543 | int ret = 1; |
| 528 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 544 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
| 529 | 545 | ||
| 530 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && | 546 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
| @@ -556,17 +572,27 @@ static int rockchip_spi_transfer_one( | |||
| 556 | rs->tmode = CR0_XFM_RO; | 572 | rs->tmode = CR0_XFM_RO; |
| 557 | 573 | ||
| 558 | /* we need prepare dma before spi was enabled */ | 574 | /* we need prepare dma before spi was enabled */ |
| 559 | if (master->can_dma && master->can_dma(master, spi, xfer)) { | 575 | if (master->can_dma && master->can_dma(master, spi, xfer)) |
| 560 | rs->use_dma = 1; | 576 | rs->use_dma = 1; |
| 561 | rockchip_spi_prepare_dma(rs); | 577 | else |
| 562 | } else { | ||
| 563 | rs->use_dma = 0; | 578 | rs->use_dma = 0; |
| 564 | } | ||
| 565 | 579 | ||
| 566 | rockchip_spi_config(rs); | 580 | rockchip_spi_config(rs); |
| 567 | 581 | ||
| 568 | if (!rs->use_dma) | 582 | if (rs->use_dma) { |
| 583 | if (rs->tmode == CR0_XFM_RO) { | ||
| 584 | /* rx: dma must be prepared first */ | ||
| 585 | rockchip_spi_prepare_dma(rs); | ||
| 586 | spi_enable_chip(rs, 1); | ||
| 587 | } else { | ||
| 588 | /* tx or tr: spi must be enabled first */ | ||
| 589 | spi_enable_chip(rs, 1); | ||
| 590 | rockchip_spi_prepare_dma(rs); | ||
| 591 | } | ||
| 592 | } else { | ||
| 593 | spi_enable_chip(rs, 1); | ||
| 569 | ret = rockchip_spi_pio_transfer(rs); | 594 | ret = rockchip_spi_pio_transfer(rs); |
| 595 | } | ||
| 570 | 596 | ||
| 571 | return ret; | 597 | return ret; |
| 572 | } | 598 | } |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index e3bc23bb5883..e50039fb1474 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
| @@ -82,10 +82,11 @@ struct spidev_data { | |||
| 82 | struct spi_device *spi; | 82 | struct spi_device *spi; |
| 83 | struct list_head device_entry; | 83 | struct list_head device_entry; |
| 84 | 84 | ||
| 85 | /* buffer is NULL unless this device is open (users > 0) */ | 85 | /* TX/RX buffers are NULL unless this device is open (users > 0) */ |
| 86 | struct mutex buf_lock; | 86 | struct mutex buf_lock; |
| 87 | unsigned users; | 87 | unsigned users; |
| 88 | u8 *buffer; | 88 | u8 *tx_buffer; |
| 89 | u8 *rx_buffer; | ||
| 89 | }; | 90 | }; |
| 90 | 91 | ||
| 91 | static LIST_HEAD(device_list); | 92 | static LIST_HEAD(device_list); |
| @@ -135,7 +136,7 @@ static inline ssize_t | |||
| 135 | spidev_sync_write(struct spidev_data *spidev, size_t len) | 136 | spidev_sync_write(struct spidev_data *spidev, size_t len) |
| 136 | { | 137 | { |
| 137 | struct spi_transfer t = { | 138 | struct spi_transfer t = { |
| 138 | .tx_buf = spidev->buffer, | 139 | .tx_buf = spidev->tx_buffer, |
| 139 | .len = len, | 140 | .len = len, |
| 140 | }; | 141 | }; |
| 141 | struct spi_message m; | 142 | struct spi_message m; |
| @@ -149,7 +150,7 @@ static inline ssize_t | |||
| 149 | spidev_sync_read(struct spidev_data *spidev, size_t len) | 150 | spidev_sync_read(struct spidev_data *spidev, size_t len) |
| 150 | { | 151 | { |
| 151 | struct spi_transfer t = { | 152 | struct spi_transfer t = { |
| 152 | .rx_buf = spidev->buffer, | 153 | .rx_buf = spidev->rx_buffer, |
| 153 | .len = len, | 154 | .len = len, |
| 154 | }; | 155 | }; |
| 155 | struct spi_message m; | 156 | struct spi_message m; |
| @@ -179,7 +180,7 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) | |||
| 179 | if (status > 0) { | 180 | if (status > 0) { |
| 180 | unsigned long missing; | 181 | unsigned long missing; |
| 181 | 182 | ||
| 182 | missing = copy_to_user(buf, spidev->buffer, status); | 183 | missing = copy_to_user(buf, spidev->rx_buffer, status); |
| 183 | if (missing == status) | 184 | if (missing == status) |
| 184 | status = -EFAULT; | 185 | status = -EFAULT; |
| 185 | else | 186 | else |
| @@ -206,7 +207,7 @@ spidev_write(struct file *filp, const char __user *buf, | |||
| 206 | spidev = filp->private_data; | 207 | spidev = filp->private_data; |
| 207 | 208 | ||
| 208 | mutex_lock(&spidev->buf_lock); | 209 | mutex_lock(&spidev->buf_lock); |
| 209 | missing = copy_from_user(spidev->buffer, buf, count); | 210 | missing = copy_from_user(spidev->tx_buffer, buf, count); |
| 210 | if (missing == 0) | 211 | if (missing == 0) |
| 211 | status = spidev_sync_write(spidev, count); | 212 | status = spidev_sync_write(spidev, count); |
| 212 | else | 213 | else |
| @@ -224,7 +225,7 @@ static int spidev_message(struct spidev_data *spidev, | |||
| 224 | struct spi_transfer *k_tmp; | 225 | struct spi_transfer *k_tmp; |
| 225 | struct spi_ioc_transfer *u_tmp; | 226 | struct spi_ioc_transfer *u_tmp; |
| 226 | unsigned n, total; | 227 | unsigned n, total; |
| 227 | u8 *buf; | 228 | u8 *tx_buf, *rx_buf; |
| 228 | int status = -EFAULT; | 229 | int status = -EFAULT; |
| 229 | 230 | ||
| 230 | spi_message_init(&msg); | 231 | spi_message_init(&msg); |
| @@ -236,7 +237,8 @@ static int spidev_message(struct spidev_data *spidev, | |||
| 236 | * We walk the array of user-provided transfers, using each one | 237 | * We walk the array of user-provided transfers, using each one |
| 237 | * to initialize a kernel version of the same transfer. | 238 | * to initialize a kernel version of the same transfer. |
| 238 | */ | 239 | */ |
| 239 | buf = spidev->buffer; | 240 | tx_buf = spidev->tx_buffer; |
| 241 | rx_buf = spidev->rx_buffer; | ||
| 240 | total = 0; | 242 | total = 0; |
| 241 | for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; | 243 | for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; |
| 242 | n; | 244 | n; |
| @@ -250,20 +252,21 @@ static int spidev_message(struct spidev_data *spidev, | |||
| 250 | } | 252 | } |
| 251 | 253 | ||
| 252 | if (u_tmp->rx_buf) { | 254 | if (u_tmp->rx_buf) { |
| 253 | k_tmp->rx_buf = buf; | 255 | k_tmp->rx_buf = rx_buf; |
| 254 | if (!access_ok(VERIFY_WRITE, (u8 __user *) | 256 | if (!access_ok(VERIFY_WRITE, (u8 __user *) |
| 255 | (uintptr_t) u_tmp->rx_buf, | 257 | (uintptr_t) u_tmp->rx_buf, |
| 256 | u_tmp->len)) | 258 | u_tmp->len)) |
| 257 | goto done; | 259 | goto done; |
| 258 | } | 260 | } |
| 259 | if (u_tmp->tx_buf) { | 261 | if (u_tmp->tx_buf) { |
| 260 | k_tmp->tx_buf = buf; | 262 | k_tmp->tx_buf = tx_buf; |
| 261 | if (copy_from_user(buf, (const u8 __user *) | 263 | if (copy_from_user(tx_buf, (const u8 __user *) |
| 262 | (uintptr_t) u_tmp->tx_buf, | 264 | (uintptr_t) u_tmp->tx_buf, |
| 263 | u_tmp->len)) | 265 | u_tmp->len)) |
| 264 | goto done; | 266 | goto done; |
| 265 | } | 267 | } |
| 266 | buf += k_tmp->len; | 268 | tx_buf += k_tmp->len; |
| 269 | rx_buf += k_tmp->len; | ||
| 267 | 270 | ||
| 268 | k_tmp->cs_change = !!u_tmp->cs_change; | 271 | k_tmp->cs_change = !!u_tmp->cs_change; |
| 269 | k_tmp->tx_nbits = u_tmp->tx_nbits; | 272 | k_tmp->tx_nbits = u_tmp->tx_nbits; |
| @@ -290,17 +293,17 @@ static int spidev_message(struct spidev_data *spidev, | |||
| 290 | goto done; | 293 | goto done; |
| 291 | 294 | ||
| 292 | /* copy any rx data out of bounce buffer */ | 295 | /* copy any rx data out of bounce buffer */ |
| 293 | buf = spidev->buffer; | 296 | rx_buf = spidev->rx_buffer; |
| 294 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { | 297 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { |
| 295 | if (u_tmp->rx_buf) { | 298 | if (u_tmp->rx_buf) { |
| 296 | if (__copy_to_user((u8 __user *) | 299 | if (__copy_to_user((u8 __user *) |
| 297 | (uintptr_t) u_tmp->rx_buf, buf, | 300 | (uintptr_t) u_tmp->rx_buf, rx_buf, |
| 298 | u_tmp->len)) { | 301 | u_tmp->len)) { |
| 299 | status = -EFAULT; | 302 | status = -EFAULT; |
| 300 | goto done; | 303 | goto done; |
| 301 | } | 304 | } |
| 302 | } | 305 | } |
| 303 | buf += u_tmp->len; | 306 | rx_buf += u_tmp->len; |
| 304 | } | 307 | } |
| 305 | status = total; | 308 | status = total; |
| 306 | 309 | ||
| @@ -508,22 +511,41 @@ static int spidev_open(struct inode *inode, struct file *filp) | |||
| 508 | break; | 511 | break; |
| 509 | } | 512 | } |
| 510 | } | 513 | } |
| 511 | if (status == 0) { | 514 | |
| 512 | if (!spidev->buffer) { | 515 | if (status) { |
| 513 | spidev->buffer = kmalloc(bufsiz, GFP_KERNEL); | 516 | pr_debug("spidev: nothing for minor %d\n", iminor(inode)); |
| 514 | if (!spidev->buffer) { | 517 | goto err_find_dev; |
| 518 | } | ||
| 519 | |||
| 520 | if (!spidev->tx_buffer) { | ||
| 521 | spidev->tx_buffer = kmalloc(bufsiz, GFP_KERNEL); | ||
| 522 | if (!spidev->tx_buffer) { | ||
| 515 | dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); | 523 | dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); |
| 516 | status = -ENOMEM; | 524 | status = -ENOMEM; |
| 525 | goto err_find_dev; | ||
| 517 | } | 526 | } |
| 518 | } | 527 | } |
| 519 | if (status == 0) { | 528 | |
| 520 | spidev->users++; | 529 | if (!spidev->rx_buffer) { |
| 521 | filp->private_data = spidev; | 530 | spidev->rx_buffer = kmalloc(bufsiz, GFP_KERNEL); |
| 522 | nonseekable_open(inode, filp); | 531 | if (!spidev->rx_buffer) { |
| 532 | dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); | ||
| 533 | status = -ENOMEM; | ||
| 534 | goto err_alloc_rx_buf; | ||
| 523 | } | 535 | } |
| 524 | } else | 536 | } |
| 525 | pr_debug("spidev: nothing for minor %d\n", iminor(inode)); | 537 | |
| 538 | spidev->users++; | ||
| 539 | filp->private_data = spidev; | ||
| 540 | nonseekable_open(inode, filp); | ||
| 541 | |||
| 542 | mutex_unlock(&device_list_lock); | ||
| 543 | return 0; | ||
| 526 | 544 | ||
| 545 | err_alloc_rx_buf: | ||
| 546 | kfree(spidev->tx_buffer); | ||
| 547 | spidev->tx_buffer = NULL; | ||
| 548 | err_find_dev: | ||
| 527 | mutex_unlock(&device_list_lock); | 549 | mutex_unlock(&device_list_lock); |
| 528 | return status; | 550 | return status; |
| 529 | } | 551 | } |
| @@ -542,8 +564,11 @@ static int spidev_release(struct inode *inode, struct file *filp) | |||
| 542 | if (!spidev->users) { | 564 | if (!spidev->users) { |
| 543 | int dofree; | 565 | int dofree; |
| 544 | 566 | ||
| 545 | kfree(spidev->buffer); | 567 | kfree(spidev->tx_buffer); |
| 546 | spidev->buffer = NULL; | 568 | spidev->tx_buffer = NULL; |
| 569 | |||
| 570 | kfree(spidev->rx_buffer); | ||
| 571 | spidev->rx_buffer = NULL; | ||
| 547 | 572 | ||
| 548 | /* ... after we unbound from the underlying device? */ | 573 | /* ... after we unbound from the underlying device? */ |
| 549 | spin_lock_irq(&spidev->spi_lock); | 574 | spin_lock_irq(&spidev->spi_lock); |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 57b1d44acbfe..eb976ee3a02f 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
| @@ -448,8 +448,10 @@ static int __init fb_console_setup(char *this_opt) | |||
| 448 | return 1; | 448 | return 1; |
| 449 | 449 | ||
| 450 | while ((options = strsep(&this_opt, ",")) != NULL) { | 450 | while ((options = strsep(&this_opt, ",")) != NULL) { |
| 451 | if (!strncmp(options, "font:", 5)) | 451 | if (!strncmp(options, "font:", 5)) { |
| 452 | strlcpy(fontname, options + 5, sizeof(fontname)); | 452 | strlcpy(fontname, options + 5, sizeof(fontname)); |
| 453 | continue; | ||
| 454 | } | ||
| 453 | 455 | ||
| 454 | if (!strncmp(options, "scrollback:", 11)) { | 456 | if (!strncmp(options, "scrollback:", 11)) { |
| 455 | options += 11; | 457 | options += 11; |
| @@ -457,13 +459,9 @@ static int __init fb_console_setup(char *this_opt) | |||
| 457 | fbcon_softback_size = simple_strtoul(options, &options, 0); | 459 | fbcon_softback_size = simple_strtoul(options, &options, 0); |
| 458 | if (*options == 'k' || *options == 'K') { | 460 | if (*options == 'k' || *options == 'K') { |
| 459 | fbcon_softback_size *= 1024; | 461 | fbcon_softback_size *= 1024; |
| 460 | options++; | ||
| 461 | } | 462 | } |
| 462 | if (*options != ',') | 463 | } |
| 463 | return 1; | 464 | continue; |
| 464 | options++; | ||
| 465 | } else | ||
| 466 | return 1; | ||
| 467 | } | 465 | } |
| 468 | 466 | ||
| 469 | if (!strncmp(options, "map:", 4)) { | 467 | if (!strncmp(options, "map:", 4)) { |
| @@ -478,8 +476,7 @@ static int __init fb_console_setup(char *this_opt) | |||
| 478 | 476 | ||
| 479 | fbcon_map_override(); | 477 | fbcon_map_override(); |
| 480 | } | 478 | } |
| 481 | 479 | continue; | |
| 482 | return 1; | ||
| 483 | } | 480 | } |
| 484 | 481 | ||
| 485 | if (!strncmp(options, "vc:", 3)) { | 482 | if (!strncmp(options, "vc:", 3)) { |
| @@ -491,7 +488,8 @@ static int __init fb_console_setup(char *this_opt) | |||
| 491 | if (*options++ == '-') | 488 | if (*options++ == '-') |
| 492 | last_fb_vc = simple_strtoul(options, &options, 10) - 1; | 489 | last_fb_vc = simple_strtoul(options, &options, 10) - 1; |
| 493 | fbcon_is_default = 0; | 490 | fbcon_is_default = 0; |
| 494 | } | 491 | continue; |
| 492 | } | ||
| 495 | 493 | ||
| 496 | if (!strncmp(options, "rotate:", 7)) { | 494 | if (!strncmp(options, "rotate:", 7)) { |
| 497 | options += 7; | 495 | options += 7; |
| @@ -499,6 +497,7 @@ static int __init fb_console_setup(char *this_opt) | |||
| 499 | initial_rotation = simple_strtoul(options, &options, 0); | 497 | initial_rotation = simple_strtoul(options, &options, 0); |
| 500 | if (initial_rotation > 3) | 498 | if (initial_rotation > 3) |
| 501 | initial_rotation = 0; | 499 | initial_rotation = 0; |
| 500 | continue; | ||
| 502 | } | 501 | } |
| 503 | } | 502 | } |
| 504 | return 1; | 503 | return 1; |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 6e6aa704fe84..517f565b65d7 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
| @@ -56,7 +56,7 @@ static int cursor_size_lastfrom; | |||
| 56 | static int cursor_size_lastto; | 56 | static int cursor_size_lastto; |
| 57 | static u32 vgacon_xres; | 57 | static u32 vgacon_xres; |
| 58 | static u32 vgacon_yres; | 58 | static u32 vgacon_yres; |
| 59 | static struct vgastate state; | 59 | static struct vgastate vgastate; |
| 60 | 60 | ||
| 61 | #define BLANK 0x0020 | 61 | #define BLANK 0x0020 |
| 62 | 62 | ||
| @@ -400,7 +400,7 @@ static const char *vgacon_startup(void) | |||
| 400 | 400 | ||
| 401 | vga_video_num_lines = screen_info.orig_video_lines; | 401 | vga_video_num_lines = screen_info.orig_video_lines; |
| 402 | vga_video_num_columns = screen_info.orig_video_cols; | 402 | vga_video_num_columns = screen_info.orig_video_cols; |
| 403 | state.vgabase = NULL; | 403 | vgastate.vgabase = NULL; |
| 404 | 404 | ||
| 405 | if (screen_info.orig_video_mode == 7) { | 405 | if (screen_info.orig_video_mode == 7) { |
| 406 | /* Monochrome display */ | 406 | /* Monochrome display */ |
| @@ -851,12 +851,12 @@ static void vga_set_palette(struct vc_data *vc, unsigned char *table) | |||
| 851 | { | 851 | { |
| 852 | int i, j; | 852 | int i, j; |
| 853 | 853 | ||
| 854 | vga_w(state.vgabase, VGA_PEL_MSK, 0xff); | 854 | vga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff); |
| 855 | for (i = j = 0; i < 16; i++) { | 855 | for (i = j = 0; i < 16; i++) { |
| 856 | vga_w(state.vgabase, VGA_PEL_IW, table[i]); | 856 | vga_w(vgastate.vgabase, VGA_PEL_IW, table[i]); |
| 857 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 857 | vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
| 858 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 858 | vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
| 859 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 859 | vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
| 860 | } | 860 | } |
| 861 | } | 861 | } |
| 862 | 862 | ||
| @@ -1008,7 +1008,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) | |||
| 1008 | switch (blank) { | 1008 | switch (blank) { |
| 1009 | case 0: /* Unblank */ | 1009 | case 0: /* Unblank */ |
| 1010 | if (vga_vesa_blanked) { | 1010 | if (vga_vesa_blanked) { |
| 1011 | vga_vesa_unblank(&state); | 1011 | vga_vesa_unblank(&vgastate); |
| 1012 | vga_vesa_blanked = 0; | 1012 | vga_vesa_blanked = 0; |
| 1013 | } | 1013 | } |
| 1014 | if (vga_palette_blanked) { | 1014 | if (vga_palette_blanked) { |
| @@ -1022,7 +1022,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) | |||
| 1022 | case 1: /* Normal blanking */ | 1022 | case 1: /* Normal blanking */ |
| 1023 | case -1: /* Obsolete */ | 1023 | case -1: /* Obsolete */ |
| 1024 | if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) { | 1024 | if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) { |
| 1025 | vga_pal_blank(&state); | 1025 | vga_pal_blank(&vgastate); |
| 1026 | vga_palette_blanked = 1; | 1026 | vga_palette_blanked = 1; |
| 1027 | return 0; | 1027 | return 0; |
| 1028 | } | 1028 | } |
| @@ -1034,7 +1034,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) | |||
| 1034 | return 1; | 1034 | return 1; |
| 1035 | default: /* VESA blanking */ | 1035 | default: /* VESA blanking */ |
| 1036 | if (vga_video_type == VIDEO_TYPE_VGAC) { | 1036 | if (vga_video_type == VIDEO_TYPE_VGAC) { |
| 1037 | vga_vesa_blank(&state, blank - 1); | 1037 | vga_vesa_blank(&vgastate, blank - 1); |
| 1038 | vga_vesa_blanked = blank; | 1038 | vga_vesa_blanked = blank; |
| 1039 | } | 1039 | } |
| 1040 | return 0; | 1040 | return 0; |
| @@ -1280,7 +1280,7 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigne | |||
| 1280 | (charcount != 256 && charcount != 512)) | 1280 | (charcount != 256 && charcount != 512)) |
| 1281 | return -EINVAL; | 1281 | return -EINVAL; |
| 1282 | 1282 | ||
| 1283 | rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); | 1283 | rc = vgacon_do_font_op(&vgastate, font->data, 1, charcount == 512); |
| 1284 | if (rc) | 1284 | if (rc) |
| 1285 | return rc; | 1285 | return rc; |
| 1286 | 1286 | ||
| @@ -1299,7 +1299,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font) | |||
| 1299 | font->charcount = vga_512_chars ? 512 : 256; | 1299 | font->charcount = vga_512_chars ? 512 : 256; |
| 1300 | if (!font->data) | 1300 | if (!font->data) |
| 1301 | return 0; | 1301 | return 0; |
| 1302 | return vgacon_do_font_op(&state, font->data, 0, vga_512_chars); | 1302 | return vgacon_do_font_op(&vgastate, font->data, 0, vga_512_chars); |
| 1303 | } | 1303 | } |
| 1304 | 1304 | ||
| 1305 | #else | 1305 | #else |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index 3bf403150a2d..9ec81d46fc57 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
| @@ -27,7 +27,6 @@ | |||
| 27 | #include <linux/regulator/consumer.h> | 27 | #include <linux/regulator/consumer.h> |
| 28 | #include <video/videomode.h> | 28 | #include <video/videomode.h> |
| 29 | 29 | ||
| 30 | #include <mach/cpu.h> | ||
| 31 | #include <asm/gpio.h> | 30 | #include <asm/gpio.h> |
| 32 | 31 | ||
| 33 | #include <video/atmel_lcdc.h> | 32 | #include <video/atmel_lcdc.h> |
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c index 5ee3b5505f7f..91921665b98b 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c | |||
| @@ -301,6 +301,8 @@ static const struct of_device_id tvc_of_match[] = { | |||
| 301 | {}, | 301 | {}, |
| 302 | }; | 302 | }; |
| 303 | 303 | ||
| 304 | MODULE_DEVICE_TABLE(of, tvc_of_match); | ||
| 305 | |||
| 304 | static struct platform_driver tvc_connector_driver = { | 306 | static struct platform_driver tvc_connector_driver = { |
| 305 | .probe = tvc_probe, | 307 | .probe = tvc_probe, |
| 306 | .remove = __exit_p(tvc_remove), | 308 | .remove = __exit_p(tvc_remove), |
| @@ -308,6 +310,7 @@ static struct platform_driver tvc_connector_driver = { | |||
| 308 | .name = "connector-analog-tv", | 310 | .name = "connector-analog-tv", |
| 309 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
| 310 | .of_match_table = tvc_of_match, | 312 | .of_match_table = tvc_of_match, |
| 313 | .suppress_bind_attrs = true, | ||
| 311 | }, | 314 | }, |
| 312 | }; | 315 | }; |
| 313 | 316 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c index 74de2bc50c4f..2dfb6e5ff0cc 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c | |||
| @@ -391,6 +391,7 @@ static struct platform_driver dvi_connector_driver = { | |||
| 391 | .name = "connector-dvi", | 391 | .name = "connector-dvi", |
| 392 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
| 393 | .of_match_table = dvic_of_match, | 393 | .of_match_table = dvic_of_match, |
| 394 | .suppress_bind_attrs = true, | ||
| 394 | }, | 395 | }, |
| 395 | }; | 396 | }; |
| 396 | 397 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c index 131c6e260898..7b25967a91eb 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c | |||
| @@ -437,6 +437,7 @@ static struct platform_driver hdmi_connector_driver = { | |||
| 437 | .name = "connector-hdmi", | 437 | .name = "connector-hdmi", |
| 438 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
| 439 | .of_match_table = hdmic_of_match, | 439 | .of_match_table = hdmic_of_match, |
| 440 | .suppress_bind_attrs = true, | ||
| 440 | }, | 441 | }, |
| 441 | }; | 442 | }; |
| 442 | 443 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c index b4e9a42a79e6..47ee7cdee1c5 100644 --- a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c | |||
| @@ -298,6 +298,7 @@ static struct platform_driver tfp410_driver = { | |||
| 298 | .name = "tfp410", | 298 | .name = "tfp410", |
| 299 | .owner = THIS_MODULE, | 299 | .owner = THIS_MODULE, |
| 300 | .of_match_table = tfp410_of_match, | 300 | .of_match_table = tfp410_of_match, |
| 301 | .suppress_bind_attrs = true, | ||
| 301 | }, | 302 | }, |
| 302 | }; | 303 | }; |
| 303 | 304 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c index c891d8f84cb2..c4abd56dd846 100644 --- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c | |||
| @@ -461,6 +461,7 @@ static struct platform_driver tpd_driver = { | |||
| 461 | .name = "tpd12s015", | 461 | .name = "tpd12s015", |
| 462 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
| 463 | .of_match_table = tpd_of_match, | 463 | .of_match_table = tpd_of_match, |
| 464 | .suppress_bind_attrs = true, | ||
| 464 | }, | 465 | }, |
| 465 | }; | 466 | }; |
| 466 | 467 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c index 3636b61dc9b4..a9c3dcf0f6b5 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c | |||
| @@ -327,6 +327,7 @@ static struct platform_driver panel_dpi_driver = { | |||
| 327 | .name = "panel-dpi", | 327 | .name = "panel-dpi", |
| 328 | .owner = THIS_MODULE, | 328 | .owner = THIS_MODULE, |
| 329 | .of_match_table = panel_dpi_of_match, | 329 | .of_match_table = panel_dpi_of_match, |
| 330 | .suppress_bind_attrs = true, | ||
| 330 | }, | 331 | }, |
| 331 | }; | 332 | }; |
| 332 | 333 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c index d6f14e8717e8..899cb1ab523d 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c | |||
| @@ -1378,6 +1378,7 @@ static struct platform_driver dsicm_driver = { | |||
| 1378 | .name = "panel-dsi-cm", | 1378 | .name = "panel-dsi-cm", |
| 1379 | .owner = THIS_MODULE, | 1379 | .owner = THIS_MODULE, |
| 1380 | .of_match_table = dsicm_of_match, | 1380 | .of_match_table = dsicm_of_match, |
| 1381 | .suppress_bind_attrs = true, | ||
| 1381 | }, | 1382 | }, |
| 1382 | }; | 1383 | }; |
| 1383 | 1384 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c index cc5b5124e0b4..27d4fcfa1824 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c | |||
| @@ -394,6 +394,7 @@ static struct spi_driver lb035q02_spi_driver = { | |||
| 394 | .name = "panel_lgphilips_lb035q02", | 394 | .name = "panel_lgphilips_lb035q02", |
| 395 | .owner = THIS_MODULE, | 395 | .owner = THIS_MODULE, |
| 396 | .of_match_table = lb035q02_of_match, | 396 | .of_match_table = lb035q02_of_match, |
| 397 | .suppress_bind_attrs = true, | ||
| 397 | }, | 398 | }, |
| 398 | }; | 399 | }; |
| 399 | 400 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c index 3595f111aa35..ccf3f4f3c703 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c | |||
| @@ -424,6 +424,7 @@ static struct spi_driver nec_8048_driver = { | |||
| 424 | .owner = THIS_MODULE, | 424 | .owner = THIS_MODULE, |
| 425 | .pm = NEC_8048_PM_OPS, | 425 | .pm = NEC_8048_PM_OPS, |
| 426 | .of_match_table = nec_8048_of_match, | 426 | .of_match_table = nec_8048_of_match, |
| 427 | .suppress_bind_attrs = true, | ||
| 427 | }, | 428 | }, |
| 428 | .probe = nec_8048_probe, | 429 | .probe = nec_8048_probe, |
| 429 | .remove = nec_8048_remove, | 430 | .remove = nec_8048_remove, |
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c index f1f72ce50a17..234142cc3764 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c | |||
| @@ -410,6 +410,7 @@ static struct platform_driver sharp_ls_driver = { | |||
| 410 | .name = "panel-sharp-ls037v7dw01", | 410 | .name = "panel-sharp-ls037v7dw01", |
| 411 | .owner = THIS_MODULE, | 411 | .owner = THIS_MODULE, |
| 412 | .of_match_table = sharp_ls_of_match, | 412 | .of_match_table = sharp_ls_of_match, |
| 413 | .suppress_bind_attrs = true, | ||
| 413 | }, | 414 | }, |
| 414 | }; | 415 | }; |
| 415 | 416 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c index 617f8d2f5127..337ccc5c0f5e 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c | |||
| @@ -904,6 +904,7 @@ static struct spi_driver acx565akm_driver = { | |||
| 904 | .name = "acx565akm", | 904 | .name = "acx565akm", |
| 905 | .owner = THIS_MODULE, | 905 | .owner = THIS_MODULE, |
| 906 | .of_match_table = acx565akm_of_match, | 906 | .of_match_table = acx565akm_of_match, |
| 907 | .suppress_bind_attrs = true, | ||
| 907 | }, | 908 | }, |
| 908 | .probe = acx565akm_probe, | 909 | .probe = acx565akm_probe, |
| 909 | .remove = acx565akm_remove, | 910 | .remove = acx565akm_remove, |
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c index 728808bcceeb..fbba0b8ca871 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c | |||
| @@ -500,6 +500,7 @@ static struct spi_driver td028ttec1_spi_driver = { | |||
| 500 | .name = "panel-tpo-td028ttec1", | 500 | .name = "panel-tpo-td028ttec1", |
| 501 | .owner = THIS_MODULE, | 501 | .owner = THIS_MODULE, |
| 502 | .of_match_table = td028ttec1_of_match, | 502 | .of_match_table = td028ttec1_of_match, |
| 503 | .suppress_bind_attrs = true, | ||
| 503 | }, | 504 | }, |
| 504 | }; | 505 | }; |
| 505 | 506 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c index de78ab0caaa8..5aba76bca25a 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c | |||
| @@ -673,6 +673,7 @@ static struct spi_driver tpo_td043_spi_driver = { | |||
| 673 | .owner = THIS_MODULE, | 673 | .owner = THIS_MODULE, |
| 674 | .pm = &tpo_td043_spi_pm, | 674 | .pm = &tpo_td043_spi_pm, |
| 675 | .of_match_table = tpo_td043_of_match, | 675 | .of_match_table = tpo_td043_of_match, |
| 676 | .suppress_bind_attrs = true, | ||
| 676 | }, | 677 | }, |
| 677 | .probe = tpo_td043_probe, | 678 | .probe = tpo_td043_probe, |
| 678 | .remove = tpo_td043_remove, | 679 | .remove = tpo_td043_remove, |
diff --git a/drivers/video/fbdev/omap2/dss/apply.c b/drivers/video/fbdev/omap2/dss/apply.c index 0a0b084ce65d..663ccc3bf4e5 100644 --- a/drivers/video/fbdev/omap2/dss/apply.c +++ b/drivers/video/fbdev/omap2/dss/apply.c | |||
| @@ -1132,6 +1132,8 @@ static void dss_mgr_disable_compat(struct omap_overlay_manager *mgr) | |||
| 1132 | if (!mp->enabled) | 1132 | if (!mp->enabled) |
| 1133 | goto out; | 1133 | goto out; |
| 1134 | 1134 | ||
| 1135 | wait_pending_extra_info_updates(); | ||
| 1136 | |||
| 1135 | if (!mgr_manual_update(mgr)) | 1137 | if (!mgr_manual_update(mgr)) |
| 1136 | dispc_mgr_disable_sync(mgr->id); | 1138 | dispc_mgr_disable_sync(mgr->id); |
| 1137 | 1139 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index be053aa80880..0e9a74bb9fc2 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c | |||
| @@ -3290,8 +3290,11 @@ static void dispc_dump_regs(struct seq_file *s) | |||
| 3290 | DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS); | 3290 | DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS); |
| 3291 | DUMPREG(i, DISPC_OVL_ROW_INC); | 3291 | DUMPREG(i, DISPC_OVL_ROW_INC); |
| 3292 | DUMPREG(i, DISPC_OVL_PIXEL_INC); | 3292 | DUMPREG(i, DISPC_OVL_PIXEL_INC); |
| 3293 | |||
| 3293 | if (dss_has_feature(FEAT_PRELOAD)) | 3294 | if (dss_has_feature(FEAT_PRELOAD)) |
| 3294 | DUMPREG(i, DISPC_OVL_PRELOAD); | 3295 | DUMPREG(i, DISPC_OVL_PRELOAD); |
| 3296 | if (dss_has_feature(FEAT_MFLAG)) | ||
| 3297 | DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD); | ||
| 3295 | 3298 | ||
| 3296 | if (i == OMAP_DSS_GFX) { | 3299 | if (i == OMAP_DSS_GFX) { |
| 3297 | DUMPREG(i, DISPC_OVL_WINDOW_SKIP); | 3300 | DUMPREG(i, DISPC_OVL_WINDOW_SKIP); |
| @@ -3312,10 +3315,6 @@ static void dispc_dump_regs(struct seq_file *s) | |||
| 3312 | } | 3315 | } |
| 3313 | if (dss_has_feature(FEAT_ATTR2)) | 3316 | if (dss_has_feature(FEAT_ATTR2)) |
| 3314 | DUMPREG(i, DISPC_OVL_ATTRIBUTES2); | 3317 | DUMPREG(i, DISPC_OVL_ATTRIBUTES2); |
| 3315 | if (dss_has_feature(FEAT_PRELOAD)) | ||
| 3316 | DUMPREG(i, DISPC_OVL_PRELOAD); | ||
| 3317 | if (dss_has_feature(FEAT_MFLAG)) | ||
| 3318 | DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD); | ||
| 3319 | } | 3318 | } |
| 3320 | 3319 | ||
| 3321 | #undef DISPC_REG | 3320 | #undef DISPC_REG |
| @@ -3843,6 +3842,7 @@ static struct platform_driver omap_dispchw_driver = { | |||
| 3843 | .owner = THIS_MODULE, | 3842 | .owner = THIS_MODULE, |
| 3844 | .pm = &dispc_pm_ops, | 3843 | .pm = &dispc_pm_ops, |
| 3845 | .of_match_table = dispc_of_match, | 3844 | .of_match_table = dispc_of_match, |
| 3845 | .suppress_bind_attrs = true, | ||
| 3846 | }, | 3846 | }, |
| 3847 | }; | 3847 | }; |
| 3848 | 3848 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dispc.h b/drivers/video/fbdev/omap2/dss/dispc.h index 78edb449c763..3043d6e0a5f9 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.h +++ b/drivers/video/fbdev/omap2/dss/dispc.h | |||
| @@ -101,8 +101,7 @@ | |||
| 101 | DISPC_FIR_COEF_V2_OFFSET(n, i)) | 101 | DISPC_FIR_COEF_V2_OFFSET(n, i)) |
| 102 | #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ | 102 | #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ |
| 103 | DISPC_PRELOAD_OFFSET(n)) | 103 | DISPC_PRELOAD_OFFSET(n)) |
| 104 | #define DISPC_OVL_MFLAG_THRESHOLD(n) (DISPC_OVL_BASE(n) + \ | 104 | #define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n) |
| 105 | DISPC_MFLAG_THRESHOLD_OFFSET(n)) | ||
| 106 | 105 | ||
| 107 | /* DISPC up/downsampling FIR filter coefficient structure */ | 106 | /* DISPC up/downsampling FIR filter coefficient structure */ |
| 108 | struct dispc_coef { | 107 | struct dispc_coef { |
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c index 9368972d6962..4a3363dae74a 100644 --- a/drivers/video/fbdev/omap2/dss/dpi.c +++ b/drivers/video/fbdev/omap2/dss/dpi.c | |||
| @@ -720,6 +720,7 @@ static struct platform_driver omap_dpi_driver = { | |||
| 720 | .driver = { | 720 | .driver = { |
| 721 | .name = "omapdss_dpi", | 721 | .name = "omapdss_dpi", |
| 722 | .owner = THIS_MODULE, | 722 | .owner = THIS_MODULE, |
| 723 | .suppress_bind_attrs = true, | ||
| 723 | }, | 724 | }, |
| 724 | }; | 725 | }; |
| 725 | 726 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c index b6f6ae1d4664..0793bc67a275 100644 --- a/drivers/video/fbdev/omap2/dss/dsi.c +++ b/drivers/video/fbdev/omap2/dss/dsi.c | |||
| @@ -1603,7 +1603,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev, | |||
| 1603 | } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) { | 1603 | } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) { |
| 1604 | f = cinfo->clkin4ddr < 1000000000 ? 0x2 : 0x4; | 1604 | f = cinfo->clkin4ddr < 1000000000 ? 0x2 : 0x4; |
| 1605 | 1605 | ||
| 1606 | l = FLD_MOD(l, f, 4, 1); /* PLL_SELFREQDCO */ | 1606 | l = FLD_MOD(l, f, 3, 1); /* PLL_SELFREQDCO */ |
| 1607 | } | 1607 | } |
| 1608 | 1608 | ||
| 1609 | l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ | 1609 | l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ |
| @@ -5754,6 +5754,7 @@ static struct platform_driver omap_dsihw_driver = { | |||
| 5754 | .owner = THIS_MODULE, | 5754 | .owner = THIS_MODULE, |
| 5755 | .pm = &dsi_pm_ops, | 5755 | .pm = &dsi_pm_ops, |
| 5756 | .of_match_table = dsi_of_match, | 5756 | .of_match_table = dsi_of_match, |
| 5757 | .suppress_bind_attrs = true, | ||
| 5757 | }, | 5758 | }, |
| 5758 | }; | 5759 | }; |
| 5759 | 5760 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c index 6daeb7ed44c6..14bcd6c43f72 100644 --- a/drivers/video/fbdev/omap2/dss/dss.c +++ b/drivers/video/fbdev/omap2/dss/dss.c | |||
| @@ -966,6 +966,7 @@ static struct platform_driver omap_dsshw_driver = { | |||
| 966 | .owner = THIS_MODULE, | 966 | .owner = THIS_MODULE, |
| 967 | .pm = &dss_pm_ops, | 967 | .pm = &dss_pm_ops, |
| 968 | .of_match_table = dss_of_match, | 968 | .of_match_table = dss_of_match, |
| 969 | .suppress_bind_attrs = true, | ||
| 969 | }, | 970 | }, |
| 970 | }; | 971 | }; |
| 971 | 972 | ||
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c index 6a8550cf43e5..9a8713ca090c 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4.c | |||
| @@ -781,6 +781,7 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
| 781 | .owner = THIS_MODULE, | 781 | .owner = THIS_MODULE, |
| 782 | .pm = &hdmi_pm_ops, | 782 | .pm = &hdmi_pm_ops, |
| 783 | .of_match_table = hdmi_of_match, | 783 | .of_match_table = hdmi_of_match, |
| 784 | .suppress_bind_attrs = true, | ||
| 784 | }, | 785 | }, |
| 785 | }; | 786 | }; |
| 786 | 787 | ||
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c index 32d02ec34d23..169b764bb9d4 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5.c | |||
| @@ -806,6 +806,7 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
| 806 | .owner = THIS_MODULE, | 806 | .owner = THIS_MODULE, |
| 807 | .pm = &hdmi_pm_ops, | 807 | .pm = &hdmi_pm_ops, |
| 808 | .of_match_table = hdmi_of_match, | 808 | .of_match_table = hdmi_of_match, |
| 809 | .suppress_bind_attrs = true, | ||
| 809 | }, | 810 | }, |
| 810 | }; | 811 | }; |
| 811 | 812 | ||
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c index 54df12a8d744..6d92bb32fe51 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c | |||
| @@ -124,16 +124,15 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll) | |||
| 124 | r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */ | 124 | r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */ |
| 125 | r = FLD_MOD(r, fmt->refsel, 22, 21); /* REFSEL */ | 125 | r = FLD_MOD(r, fmt->refsel, 22, 21); /* REFSEL */ |
| 126 | 126 | ||
| 127 | if (fmt->dcofreq) { | 127 | if (fmt->dcofreq) |
| 128 | /* divider programming for frequency beyond 1000Mhz */ | ||
| 129 | REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10); | ||
| 130 | r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ | 128 | r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ |
| 131 | } else { | 129 | else |
| 132 | r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ | 130 | r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ |
| 133 | } | ||
| 134 | 131 | ||
| 135 | hdmi_write_reg(pll->base, PLLCTRL_CFG2, r); | 132 | hdmi_write_reg(pll->base, PLLCTRL_CFG2, r); |
| 136 | 133 | ||
| 134 | REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10); | ||
| 135 | |||
| 137 | r = hdmi_read_reg(pll->base, PLLCTRL_CFG4); | 136 | r = hdmi_read_reg(pll->base, PLLCTRL_CFG4); |
| 138 | r = FLD_MOD(r, fmt->regm2, 24, 18); | 137 | r = FLD_MOD(r, fmt->regm2, 24, 18); |
| 139 | r = FLD_MOD(r, fmt->regmf, 17, 0); | 138 | r = FLD_MOD(r, fmt->regmf, 17, 0); |
| @@ -144,8 +143,8 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll) | |||
| 144 | 143 | ||
| 145 | /* wait for bit change */ | 144 | /* wait for bit change */ |
| 146 | if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO, | 145 | if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO, |
| 147 | 0, 0, 1) != 1) { | 146 | 0, 0, 0) != 0) { |
| 148 | DSSERR("PLL GO bit not set\n"); | 147 | DSSERR("PLL GO bit not clearing\n"); |
| 149 | return -ETIMEDOUT; | 148 | return -ETIMEDOUT; |
| 150 | } | 149 | } |
| 151 | 150 | ||
diff --git a/drivers/video/fbdev/omap2/dss/rfbi.c b/drivers/video/fbdev/omap2/dss/rfbi.c index c8a81a2b879c..878273f58839 100644 --- a/drivers/video/fbdev/omap2/dss/rfbi.c +++ b/drivers/video/fbdev/omap2/dss/rfbi.c | |||
| @@ -1044,6 +1044,7 @@ static struct platform_driver omap_rfbihw_driver = { | |||
| 1044 | .name = "omapdss_rfbi", | 1044 | .name = "omapdss_rfbi", |
| 1045 | .owner = THIS_MODULE, | 1045 | .owner = THIS_MODULE, |
| 1046 | .pm = &rfbi_pm_ops, | 1046 | .pm = &rfbi_pm_ops, |
| 1047 | .suppress_bind_attrs = true, | ||
| 1047 | }, | 1048 | }, |
| 1048 | }; | 1049 | }; |
| 1049 | 1050 | ||
diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c index 911dcc9173a6..4c9c46d4ea60 100644 --- a/drivers/video/fbdev/omap2/dss/sdi.c +++ b/drivers/video/fbdev/omap2/dss/sdi.c | |||
| @@ -377,6 +377,7 @@ static struct platform_driver omap_sdi_driver = { | |||
| 377 | .driver = { | 377 | .driver = { |
| 378 | .name = "omapdss_sdi", | 378 | .name = "omapdss_sdi", |
| 379 | .owner = THIS_MODULE, | 379 | .owner = THIS_MODULE, |
| 380 | .suppress_bind_attrs = true, | ||
| 380 | }, | 381 | }, |
| 381 | }; | 382 | }; |
| 382 | 383 | ||
diff --git a/drivers/video/fbdev/omap2/dss/venc.c b/drivers/video/fbdev/omap2/dss/venc.c index 21d81113962b..d077d8a75ddc 100644 --- a/drivers/video/fbdev/omap2/dss/venc.c +++ b/drivers/video/fbdev/omap2/dss/venc.c | |||
| @@ -966,6 +966,7 @@ static struct platform_driver omap_venchw_driver = { | |||
| 966 | .owner = THIS_MODULE, | 966 | .owner = THIS_MODULE, |
| 967 | .pm = &venc_pm_ops, | 967 | .pm = &venc_pm_ops, |
| 968 | .of_match_table = venc_of_match, | 968 | .of_match_table = venc_of_match, |
| 969 | .suppress_bind_attrs = true, | ||
| 969 | }, | 970 | }, |
| 970 | }; | 971 | }; |
| 971 | 972 | ||
diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c index 15872433e0c6..ce8a70570756 100644 --- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c | |||
| @@ -1833,14 +1833,13 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) | |||
| 1833 | if (fbdev == NULL) | 1833 | if (fbdev == NULL) |
| 1834 | return; | 1834 | return; |
| 1835 | 1835 | ||
| 1836 | for (i = 0; i < fbdev->num_fbs; i++) { | 1836 | for (i = 0; i < fbdev->num_overlays; i++) { |
| 1837 | struct omapfb_info *ofbi = FB2OFB(fbdev->fbs[i]); | 1837 | struct omap_overlay *ovl = fbdev->overlays[i]; |
| 1838 | int j; | ||
| 1839 | 1838 | ||
| 1840 | for (j = 0; j < ofbi->num_overlays; j++) { | 1839 | ovl->disable(ovl); |
| 1841 | struct omap_overlay *ovl = ofbi->overlays[j]; | 1840 | |
| 1842 | ovl->disable(ovl); | 1841 | if (ovl->manager) |
| 1843 | } | 1842 | ovl->unset_manager(ovl); |
| 1844 | } | 1843 | } |
| 1845 | 1844 | ||
| 1846 | for (i = 0; i < fbdev->num_fbs; i++) | 1845 | for (i = 0; i < fbdev->num_fbs; i++) |
| @@ -2619,7 +2618,7 @@ err0: | |||
| 2619 | return r; | 2618 | return r; |
| 2620 | } | 2619 | } |
| 2621 | 2620 | ||
| 2622 | static int __exit omapfb_remove(struct platform_device *pdev) | 2621 | static int omapfb_remove(struct platform_device *pdev) |
| 2623 | { | 2622 | { |
| 2624 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); | 2623 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); |
| 2625 | 2624 | ||
| @@ -2636,7 +2635,7 @@ static int __exit omapfb_remove(struct platform_device *pdev) | |||
| 2636 | 2635 | ||
| 2637 | static struct platform_driver omapfb_driver = { | 2636 | static struct platform_driver omapfb_driver = { |
| 2638 | .probe = omapfb_probe, | 2637 | .probe = omapfb_probe, |
| 2639 | .remove = __exit_p(omapfb_remove), | 2638 | .remove = omapfb_remove, |
| 2640 | .driver = { | 2639 | .driver = { |
| 2641 | .name = "omapfb", | 2640 | .name = "omapfb", |
| 2642 | .owner = THIS_MODULE, | 2641 | .owner = THIS_MODULE, |
| @@ -2651,6 +2650,7 @@ module_param_named(mirror, def_mirror, bool, 0); | |||
| 2651 | 2650 | ||
| 2652 | module_platform_driver(omapfb_driver); | 2651 | module_platform_driver(omapfb_driver); |
| 2653 | 2652 | ||
| 2653 | MODULE_ALIAS("platform:omapfb"); | ||
| 2654 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>"); | 2654 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>"); |
| 2655 | MODULE_DESCRIPTION("OMAP2/3 Framebuffer"); | 2655 | MODULE_DESCRIPTION("OMAP2/3 Framebuffer"); |
| 2656 | MODULE_LICENSE("GPL v2"); | 2656 | MODULE_LICENSE("GPL v2"); |
diff --git a/fs/buffer.c b/fs/buffer.c index 6c48f20eddd4..20805db2c987 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -128,21 +128,15 @@ __clear_page_buffers(struct page *page) | |||
| 128 | page_cache_release(page); | 128 | page_cache_release(page); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | 131 | static void buffer_io_error(struct buffer_head *bh, char *msg) | |
| 132 | static int quiet_error(struct buffer_head *bh) | ||
| 133 | { | ||
| 134 | if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit()) | ||
| 135 | return 0; | ||
| 136 | return 1; | ||
| 137 | } | ||
| 138 | |||
| 139 | |||
| 140 | static void buffer_io_error(struct buffer_head *bh) | ||
| 141 | { | 132 | { |
| 142 | char b[BDEVNAME_SIZE]; | 133 | char b[BDEVNAME_SIZE]; |
| 143 | printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", | 134 | |
| 135 | if (!test_bit(BH_Quiet, &bh->b_state)) | ||
| 136 | printk_ratelimited(KERN_ERR | ||
| 137 | "Buffer I/O error on dev %s, logical block %llu%s\n", | ||
| 144 | bdevname(bh->b_bdev, b), | 138 | bdevname(bh->b_bdev, b), |
| 145 | (unsigned long long)bh->b_blocknr); | 139 | (unsigned long long)bh->b_blocknr, msg); |
| 146 | } | 140 | } |
| 147 | 141 | ||
| 148 | /* | 142 | /* |
| @@ -177,17 +171,10 @@ EXPORT_SYMBOL(end_buffer_read_sync); | |||
| 177 | 171 | ||
| 178 | void end_buffer_write_sync(struct buffer_head *bh, int uptodate) | 172 | void end_buffer_write_sync(struct buffer_head *bh, int uptodate) |
| 179 | { | 173 | { |
| 180 | char b[BDEVNAME_SIZE]; | ||
| 181 | |||
| 182 | if (uptodate) { | 174 | if (uptodate) { |
| 183 | set_buffer_uptodate(bh); | 175 | set_buffer_uptodate(bh); |
| 184 | } else { | 176 | } else { |
| 185 | if (!quiet_error(bh)) { | 177 | buffer_io_error(bh, ", lost sync page write"); |
| 186 | buffer_io_error(bh); | ||
| 187 | printk(KERN_WARNING "lost page write due to " | ||
| 188 | "I/O error on %s\n", | ||
| 189 | bdevname(bh->b_bdev, b)); | ||
| 190 | } | ||
| 191 | set_buffer_write_io_error(bh); | 178 | set_buffer_write_io_error(bh); |
| 192 | clear_buffer_uptodate(bh); | 179 | clear_buffer_uptodate(bh); |
| 193 | } | 180 | } |
| @@ -304,8 +291,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) | |||
| 304 | set_buffer_uptodate(bh); | 291 | set_buffer_uptodate(bh); |
| 305 | } else { | 292 | } else { |
| 306 | clear_buffer_uptodate(bh); | 293 | clear_buffer_uptodate(bh); |
| 307 | if (!quiet_error(bh)) | 294 | buffer_io_error(bh, ", async page read"); |
| 308 | buffer_io_error(bh); | ||
| 309 | SetPageError(page); | 295 | SetPageError(page); |
| 310 | } | 296 | } |
| 311 | 297 | ||
| @@ -353,7 +339,6 @@ still_busy: | |||
| 353 | */ | 339 | */ |
| 354 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) | 340 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) |
| 355 | { | 341 | { |
| 356 | char b[BDEVNAME_SIZE]; | ||
| 357 | unsigned long flags; | 342 | unsigned long flags; |
| 358 | struct buffer_head *first; | 343 | struct buffer_head *first; |
| 359 | struct buffer_head *tmp; | 344 | struct buffer_head *tmp; |
| @@ -365,12 +350,7 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) | |||
| 365 | if (uptodate) { | 350 | if (uptodate) { |
| 366 | set_buffer_uptodate(bh); | 351 | set_buffer_uptodate(bh); |
| 367 | } else { | 352 | } else { |
| 368 | if (!quiet_error(bh)) { | 353 | buffer_io_error(bh, ", lost async page write"); |
| 369 | buffer_io_error(bh); | ||
| 370 | printk(KERN_WARNING "lost page write due to " | ||
| 371 | "I/O error on %s\n", | ||
| 372 | bdevname(bh->b_bdev, b)); | ||
| 373 | } | ||
| 374 | set_bit(AS_EIO, &page->mapping->flags); | 354 | set_bit(AS_EIO, &page->mapping->flags); |
| 375 | set_buffer_write_io_error(bh); | 355 | set_buffer_write_io_error(bh); |
| 376 | clear_buffer_uptodate(bh); | 356 | clear_buffer_uptodate(bh); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 7015db0bafd1..eb742d0e67ff 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
| @@ -1354,13 +1354,6 @@ set_qf_format: | |||
| 1354 | "not specified."); | 1354 | "not specified."); |
| 1355 | return 0; | 1355 | return 0; |
| 1356 | } | 1356 | } |
| 1357 | } else { | ||
| 1358 | if (sbi->s_jquota_fmt) { | ||
| 1359 | ext3_msg(sb, KERN_ERR, "error: journaled quota format " | ||
| 1360 | "specified with no journaling " | ||
| 1361 | "enabled."); | ||
| 1362 | return 0; | ||
| 1363 | } | ||
| 1364 | } | 1357 | } |
| 1365 | #endif | 1358 | #endif |
| 1366 | return 1; | 1359 | return 1; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 37043d0b2be8..0b16fb4c06d3 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
| @@ -3603,11 +3603,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
| 3603 | } | 3603 | } |
| 3604 | } | 3604 | } |
| 3605 | 3605 | ||
| 3606 | allocated = ext4_split_extent(handle, inode, ppath, | 3606 | err = ext4_split_extent(handle, inode, ppath, &split_map, split_flag, |
| 3607 | &split_map, split_flag, flags); | 3607 | flags); |
| 3608 | if (allocated < 0) | 3608 | if (err > 0) |
| 3609 | err = allocated; | 3609 | err = 0; |
| 3610 | |||
| 3611 | out: | 3610 | out: |
| 3612 | /* If we have gotten a failure, don't zero out status tree */ | 3611 | /* If we have gotten a failure, don't zero out status tree */ |
| 3613 | if (!err) | 3612 | if (!err) |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index aca7b24a4432..8131be8c0af3 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
| @@ -137,10 +137,10 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
| 137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); | 137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | iocb->private = &overwrite; | ||
| 140 | if (o_direct) { | 141 | if (o_direct) { |
| 141 | blk_start_plug(&plug); | 142 | blk_start_plug(&plug); |
| 142 | 143 | ||
| 143 | iocb->private = &overwrite; | ||
| 144 | 144 | ||
| 145 | /* check whether we do a DIO overwrite or not */ | 145 | /* check whether we do a DIO overwrite or not */ |
| 146 | if (ext4_should_dioread_nolock(inode) && !aio_mutex && | 146 | if (ext4_should_dioread_nolock(inode) && !aio_mutex && |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 8012a5daf401..ac644c31ca67 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -887,6 +887,10 @@ got: | |||
| 887 | struct buffer_head *block_bitmap_bh; | 887 | struct buffer_head *block_bitmap_bh; |
| 888 | 888 | ||
| 889 | block_bitmap_bh = ext4_read_block_bitmap(sb, group); | 889 | block_bitmap_bh = ext4_read_block_bitmap(sb, group); |
| 890 | if (!block_bitmap_bh) { | ||
| 891 | err = -EIO; | ||
| 892 | goto out; | ||
| 893 | } | ||
| 890 | BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); | 894 | BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); |
| 891 | err = ext4_journal_get_write_access(handle, block_bitmap_bh); | 895 | err = ext4_journal_get_write_access(handle, block_bitmap_bh); |
| 892 | if (err) { | 896 | if (err) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e9777f93cf05..3356ab5395f4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -4959,7 +4959,12 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) | |||
| 4959 | if (val) | 4959 | if (val) |
| 4960 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4960 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
| 4961 | else { | 4961 | else { |
| 4962 | jbd2_journal_flush(journal); | 4962 | err = jbd2_journal_flush(journal); |
| 4963 | if (err < 0) { | ||
| 4964 | jbd2_journal_unlock_updates(journal); | ||
| 4965 | ext4_inode_resume_unlocked_dio(inode); | ||
| 4966 | return err; | ||
| 4967 | } | ||
| 4963 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4968 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
| 4964 | } | 4969 | } |
| 4965 | ext4_set_aops(inode); | 4970 | ext4_set_aops(inode); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 123798c5ac31..426211882f72 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
| @@ -1816,31 +1816,39 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
| 1816 | hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; | 1816 | hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; |
| 1817 | hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; | 1817 | hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; |
| 1818 | ext4fs_dirhash(name, namelen, &hinfo); | 1818 | ext4fs_dirhash(name, namelen, &hinfo); |
| 1819 | memset(frames, 0, sizeof(frames)); | ||
| 1819 | frame = frames; | 1820 | frame = frames; |
| 1820 | frame->entries = entries; | 1821 | frame->entries = entries; |
| 1821 | frame->at = entries; | 1822 | frame->at = entries; |
| 1822 | frame->bh = bh; | 1823 | frame->bh = bh; |
| 1823 | bh = bh2; | 1824 | bh = bh2; |
| 1824 | 1825 | ||
| 1825 | ext4_handle_dirty_dx_node(handle, dir, frame->bh); | 1826 | retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh); |
| 1826 | ext4_handle_dirty_dirent_node(handle, dir, bh); | 1827 | if (retval) |
| 1828 | goto out_frames; | ||
| 1829 | retval = ext4_handle_dirty_dirent_node(handle, dir, bh); | ||
| 1830 | if (retval) | ||
| 1831 | goto out_frames; | ||
| 1827 | 1832 | ||
| 1828 | de = do_split(handle,dir, &bh, frame, &hinfo); | 1833 | de = do_split(handle,dir, &bh, frame, &hinfo); |
| 1829 | if (IS_ERR(de)) { | 1834 | if (IS_ERR(de)) { |
| 1830 | /* | 1835 | retval = PTR_ERR(de); |
| 1831 | * Even if the block split failed, we have to properly write | 1836 | goto out_frames; |
| 1832 | * out all the changes we did so far. Otherwise we can end up | ||
| 1833 | * with corrupted filesystem. | ||
| 1834 | */ | ||
| 1835 | ext4_mark_inode_dirty(handle, dir); | ||
| 1836 | dx_release(frames); | ||
| 1837 | return PTR_ERR(de); | ||
| 1838 | } | 1837 | } |
| 1839 | dx_release(frames); | 1838 | dx_release(frames); |
| 1840 | 1839 | ||
| 1841 | retval = add_dirent_to_buf(handle, dentry, inode, de, bh); | 1840 | retval = add_dirent_to_buf(handle, dentry, inode, de, bh); |
| 1842 | brelse(bh); | 1841 | brelse(bh); |
| 1843 | return retval; | 1842 | return retval; |
| 1843 | out_frames: | ||
| 1844 | /* | ||
| 1845 | * Even if the block split failed, we have to properly write | ||
| 1846 | * out all the changes we did so far. Otherwise we can end up | ||
| 1847 | * with corrupted filesystem. | ||
| 1848 | */ | ||
| 1849 | ext4_mark_inode_dirty(handle, dir); | ||
| 1850 | dx_release(frames); | ||
| 1851 | return retval; | ||
| 1844 | } | 1852 | } |
| 1845 | 1853 | ||
| 1846 | /* | 1854 | /* |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index f298c60f907d..ca4588388fc3 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
| @@ -1081,7 +1081,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, | |||
| 1081 | break; | 1081 | break; |
| 1082 | 1082 | ||
| 1083 | if (meta_bg == 0) | 1083 | if (meta_bg == 0) |
| 1084 | backup_block = group * bpg + blk_off; | 1084 | backup_block = ((ext4_fsblk_t)group) * bpg + blk_off; |
| 1085 | else | 1085 | else |
| 1086 | backup_block = (ext4_group_first_block_no(sb, group) + | 1086 | backup_block = (ext4_group_first_block_no(sb, group) + |
| 1087 | ext4_bg_has_super(sb, group)); | 1087 | ext4_bg_has_super(sb, group)); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1eda6ab0ef9d..2c9e6864abd9 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
| @@ -3526,6 +3526,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3526 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | 3526 | #ifdef CONFIG_EXT4_FS_POSIX_ACL |
| 3527 | set_opt(sb, POSIX_ACL); | 3527 | set_opt(sb, POSIX_ACL); |
| 3528 | #endif | 3528 | #endif |
| 3529 | /* don't forget to enable journal_csum when metadata_csum is enabled. */ | ||
| 3530 | if (ext4_has_metadata_csum(sb)) | ||
| 3531 | set_opt(sb, JOURNAL_CHECKSUM); | ||
| 3532 | |||
| 3529 | if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) | 3533 | if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) |
| 3530 | set_opt(sb, JOURNAL_DATA); | 3534 | set_opt(sb, JOURNAL_DATA); |
| 3531 | else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) | 3535 | else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) |
| @@ -3943,7 +3947,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3943 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && | 3947 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && |
| 3944 | !(sb->s_flags & MS_RDONLY)) | 3948 | !(sb->s_flags & MS_RDONLY)) |
| 3945 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | 3949 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) |
| 3946 | goto failed_mount3; | 3950 | goto failed_mount3a; |
| 3947 | 3951 | ||
| 3948 | /* | 3952 | /* |
| 3949 | * The first inode we look at is the journal inode. Don't try | 3953 | * The first inode we look at is the journal inode. Don't try |
| @@ -3952,7 +3956,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
| 3952 | if (!test_opt(sb, NOLOAD) && | 3956 | if (!test_opt(sb, NOLOAD) && |
| 3953 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { | 3957 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { |
| 3954 | if (ext4_load_journal(sb, es, journal_devnum)) | 3958 | if (ext4_load_journal(sb, es, journal_devnum)) |
| 3955 | goto failed_mount3; | 3959 | goto failed_mount3a; |
| 3956 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && | 3960 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && |
| 3957 | EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { | 3961 | EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { |
| 3958 | ext4_msg(sb, KERN_ERR, "required journal recovery " | 3962 | ext4_msg(sb, KERN_ERR, "required journal recovery " |
| @@ -4240,6 +4244,7 @@ failed_mount_wq: | |||
| 4240 | jbd2_journal_destroy(sbi->s_journal); | 4244 | jbd2_journal_destroy(sbi->s_journal); |
| 4241 | sbi->s_journal = NULL; | 4245 | sbi->s_journal = NULL; |
| 4242 | } | 4246 | } |
| 4247 | failed_mount3a: | ||
| 4243 | ext4_es_unregister_shrinker(sbi); | 4248 | ext4_es_unregister_shrinker(sbi); |
| 4244 | failed_mount3: | 4249 | failed_mount3: |
| 4245 | del_timer_sync(&sbi->s_err_report); | 4250 | del_timer_sync(&sbi->s_err_report); |
| @@ -4841,6 +4846,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
| 4841 | goto restore_opts; | 4846 | goto restore_opts; |
| 4842 | } | 4847 | } |
| 4843 | 4848 | ||
| 4849 | if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ | ||
| 4850 | test_opt(sb, JOURNAL_CHECKSUM)) { | ||
| 4851 | ext4_msg(sb, KERN_ERR, "changing journal_checksum " | ||
| 4852 | "during remount not supported"); | ||
| 4853 | err = -EINVAL; | ||
| 4854 | goto restore_opts; | ||
| 4855 | } | ||
| 4856 | |||
| 4844 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { | 4857 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { |
| 4845 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { | 4858 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { |
| 4846 | ext4_msg(sb, KERN_ERR, "can't mount with " | 4859 | ext4_msg(sb, KERN_ERR, "can't mount with " |
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index 8898bbd2b61e..dcead636c33b 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
| @@ -93,6 +93,7 @@ | |||
| 93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
| 94 | #endif | 94 | #endif |
| 95 | #include <linux/log2.h> | 95 | #include <linux/log2.h> |
| 96 | #include <linux/hash.h> | ||
| 96 | 97 | ||
| 97 | static struct kmem_cache *revoke_record_cache; | 98 | static struct kmem_cache *revoke_record_cache; |
| 98 | static struct kmem_cache *revoke_table_cache; | 99 | static struct kmem_cache *revoke_table_cache; |
| @@ -129,15 +130,11 @@ static void flush_descriptor(journal_t *, struct journal_head *, int, int); | |||
| 129 | 130 | ||
| 130 | /* Utility functions to maintain the revoke table */ | 131 | /* Utility functions to maintain the revoke table */ |
| 131 | 132 | ||
| 132 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | ||
| 133 | static inline int hash(journal_t *journal, unsigned int block) | 133 | static inline int hash(journal_t *journal, unsigned int block) |
| 134 | { | 134 | { |
| 135 | struct jbd_revoke_table_s *table = journal->j_revoke; | 135 | struct jbd_revoke_table_s *table = journal->j_revoke; |
| 136 | int hash_shift = table->hash_shift; | ||
| 137 | 136 | ||
| 138 | return ((block << (hash_shift - 6)) ^ | 137 | return hash_32(block, table->hash_shift); |
| 139 | (block >> 13) ^ | ||
| 140 | (block << (hash_shift - 12))) & (table->hash_size - 1); | ||
| 141 | } | 138 | } |
| 142 | 139 | ||
| 143 | static int insert_revoke_hash(journal_t *journal, unsigned int blocknr, | 140 | static int insert_revoke_hash(journal_t *journal, unsigned int blocknr, |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index d5e95a175c92..c6cbaef2bda1 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
| @@ -92,6 +92,7 @@ | |||
| 92 | #include <linux/init.h> | 92 | #include <linux/init.h> |
| 93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
| 94 | #include <linux/log2.h> | 94 | #include <linux/log2.h> |
| 95 | #include <linux/hash.h> | ||
| 95 | #endif | 96 | #endif |
| 96 | 97 | ||
| 97 | static struct kmem_cache *jbd2_revoke_record_cache; | 98 | static struct kmem_cache *jbd2_revoke_record_cache; |
| @@ -130,16 +131,9 @@ static void flush_descriptor(journal_t *, struct buffer_head *, int, int); | |||
| 130 | 131 | ||
| 131 | /* Utility functions to maintain the revoke table */ | 132 | /* Utility functions to maintain the revoke table */ |
| 132 | 133 | ||
| 133 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | ||
| 134 | static inline int hash(journal_t *journal, unsigned long long block) | 134 | static inline int hash(journal_t *journal, unsigned long long block) |
| 135 | { | 135 | { |
| 136 | struct jbd2_revoke_table_s *table = journal->j_revoke; | 136 | return hash_64(block, journal->j_revoke->hash_shift); |
| 137 | int hash_shift = table->hash_shift; | ||
| 138 | int hash = (int)block ^ (int)((block >> 31) >> 1); | ||
| 139 | |||
| 140 | return ((hash << (hash_shift - 6)) ^ | ||
| 141 | (hash >> 13) ^ | ||
| 142 | (hash << (hash_shift - 12))) & (table->hash_size - 1); | ||
| 143 | } | 137 | } |
| 144 | 138 | ||
| 145 | static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, | 139 | static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, |
diff --git a/fs/namei.c b/fs/namei.c index 42df664e95e5..78512898d3ba 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -3154,7 +3154,8 @@ static int do_tmpfile(int dfd, struct filename *pathname, | |||
| 3154 | if (error) | 3154 | if (error) |
| 3155 | goto out2; | 3155 | goto out2; |
| 3156 | audit_inode(pathname, nd->path.dentry, 0); | 3156 | audit_inode(pathname, nd->path.dentry, 0); |
| 3157 | error = may_open(&nd->path, op->acc_mode, op->open_flag); | 3157 | /* Don't check for other permissions, the inode was just created */ |
| 3158 | error = may_open(&nd->path, MAY_OPEN, op->open_flag); | ||
| 3158 | if (error) | 3159 | if (error) |
| 3159 | goto out2; | 3160 | goto out2; |
| 3160 | file->f_path.mnt = nd->path.mnt; | 3161 | file->f_path.mnt = nd->path.mnt; |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index cdeb3cfd6f32..0beb023f25ac 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -1272,7 +1272,8 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp) | |||
| 1272 | */ | 1272 | */ |
| 1273 | if (argp->opcnt == resp->opcnt) | 1273 | if (argp->opcnt == resp->opcnt) |
| 1274 | return false; | 1274 | return false; |
| 1275 | 1275 | if (next->opnum == OP_ILLEGAL) | |
| 1276 | return false; | ||
| 1276 | nextd = OPDESC(next); | 1277 | nextd = OPDESC(next); |
| 1277 | /* | 1278 | /* |
| 1278 | * Rest of 2.6.3.1.1: certain operations will return WRONGSEC | 1279 | * Rest of 2.6.3.1.1: certain operations will return WRONGSEC |
| @@ -1589,7 +1590,8 @@ static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op | |||
| 1589 | static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, | 1590 | static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, |
| 1590 | struct nfsd4_op *op) | 1591 | struct nfsd4_op *op) |
| 1591 | { | 1592 | { |
| 1592 | return NFS4_MAX_SESSIONID_LEN + 20; | 1593 | return (op_encode_hdr_size |
| 1594 | + XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32); | ||
| 1593 | } | 1595 | } |
| 1594 | 1596 | ||
| 1595 | static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) | 1597 | static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) |
| @@ -1893,6 +1895,7 @@ static struct nfsd4_operation nfsd4_ops[] = { | |||
| 1893 | .op_func = (nfsd4op_func)nfsd4_sequence, | 1895 | .op_func = (nfsd4op_func)nfsd4_sequence, |
| 1894 | .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, | 1896 | .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, |
| 1895 | .op_name = "OP_SEQUENCE", | 1897 | .op_name = "OP_SEQUENCE", |
| 1898 | .op_rsize_bop = (nfsd4op_rsize)nfsd4_sequence_rsize, | ||
| 1896 | }, | 1899 | }, |
| 1897 | [OP_DESTROY_CLIENTID] = { | 1900 | [OP_DESTROY_CLIENTID] = { |
| 1898 | .op_func = (nfsd4op_func)nfsd4_destroy_clientid, | 1901 | .op_func = (nfsd4op_func)nfsd4_destroy_clientid, |
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index 9ce062218de9..e8497144b323 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
| @@ -288,20 +288,25 @@ void fsnotify_unmount_inodes(struct list_head *list) | |||
| 288 | spin_unlock(&inode->i_lock); | 288 | spin_unlock(&inode->i_lock); |
| 289 | 289 | ||
| 290 | /* In case the dropping of a reference would nuke next_i. */ | 290 | /* In case the dropping of a reference would nuke next_i. */ |
| 291 | if ((&next_i->i_sb_list != list) && | 291 | while (&next_i->i_sb_list != list) { |
| 292 | atomic_read(&next_i->i_count)) { | ||
| 293 | spin_lock(&next_i->i_lock); | 292 | spin_lock(&next_i->i_lock); |
| 294 | if (!(next_i->i_state & (I_FREEING | I_WILL_FREE))) { | 293 | if (!(next_i->i_state & (I_FREEING | I_WILL_FREE)) && |
| 294 | atomic_read(&next_i->i_count)) { | ||
| 295 | __iget(next_i); | 295 | __iget(next_i); |
| 296 | need_iput = next_i; | 296 | need_iput = next_i; |
| 297 | spin_unlock(&next_i->i_lock); | ||
| 298 | break; | ||
| 297 | } | 299 | } |
| 298 | spin_unlock(&next_i->i_lock); | 300 | spin_unlock(&next_i->i_lock); |
| 301 | next_i = list_entry(next_i->i_sb_list.next, | ||
| 302 | struct inode, i_sb_list); | ||
| 299 | } | 303 | } |
| 300 | 304 | ||
| 301 | /* | 305 | /* |
| 302 | * We can safely drop inode_sb_list_lock here because we hold | 306 | * We can safely drop inode_sb_list_lock here because either |
| 303 | * references on both inode and next_i. Also no new inodes | 307 | * we actually hold references on both inode and next_i or |
| 304 | * will be added since the umount has begun. | 308 | * end of list. Also no new inodes will be added since the |
| 309 | * umount has begun. | ||
| 305 | */ | 310 | */ |
| 306 | spin_unlock(&inode_sb_list_lock); | 311 | spin_unlock(&inode_sb_list_lock); |
| 307 | 312 | ||
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 8add6f1030d7..b931e04e3388 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
| @@ -158,7 +158,7 @@ bail_add: | |||
| 158 | * NOTE: This dentry already has ->d_op set from | 158 | * NOTE: This dentry already has ->d_op set from |
| 159 | * ocfs2_get_parent() and ocfs2_get_dentry() | 159 | * ocfs2_get_parent() and ocfs2_get_dentry() |
| 160 | */ | 160 | */ |
| 161 | if (ret) | 161 | if (!IS_ERR_OR_NULL(ret)) |
| 162 | dentry = ret; | 162 | dentry = ret; |
| 163 | 163 | ||
| 164 | status = ocfs2_dentry_attach_lock(dentry, inode, | 164 | status = ocfs2_dentry_attach_lock(dentry, inode, |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 8b663b2d9562..6b4527216a7f 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
| @@ -634,7 +634,7 @@ int dquot_writeback_dquots(struct super_block *sb, int type) | |||
| 634 | dqstats_inc(DQST_LOOKUPS); | 634 | dqstats_inc(DQST_LOOKUPS); |
| 635 | err = sb->dq_op->write_dquot(dquot); | 635 | err = sb->dq_op->write_dquot(dquot); |
| 636 | if (!ret && err) | 636 | if (!ret && err) |
| 637 | err = ret; | 637 | ret = err; |
| 638 | dqput(dquot); | 638 | dqput(dquot); |
| 639 | spin_lock(&dq_list_lock); | 639 | spin_lock(&dq_list_lock); |
| 640 | } | 640 | } |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0207a78a8d82..6cbee8395f60 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -1583,13 +1583,13 @@ static inline bool blk_integrity_merge_rq(struct request_queue *rq, | |||
| 1583 | struct request *r1, | 1583 | struct request *r1, |
| 1584 | struct request *r2) | 1584 | struct request *r2) |
| 1585 | { | 1585 | { |
| 1586 | return 0; | 1586 | return true; |
| 1587 | } | 1587 | } |
| 1588 | static inline bool blk_integrity_merge_bio(struct request_queue *rq, | 1588 | static inline bool blk_integrity_merge_bio(struct request_queue *rq, |
| 1589 | struct request *r, | 1589 | struct request *r, |
| 1590 | struct bio *b) | 1590 | struct bio *b) |
| 1591 | { | 1591 | { |
| 1592 | return 0; | 1592 | return true; |
| 1593 | } | 1593 | } |
| 1594 | static inline bool blk_integrity_is_initialized(struct gendisk *g) | 1594 | static inline bool blk_integrity_is_initialized(struct gendisk *g) |
| 1595 | { | 1595 | { |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 2507fd2a1eb4..d1a558239b1a 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
| @@ -71,7 +71,6 @@ | |||
| 71 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 | 71 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 |
| 72 | * | 72 | * |
| 73 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. | 73 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. |
| 74 | * Fixed in GCC 4.8.2 and later versions. | ||
| 75 | * | 74 | * |
| 76 | * (asm goto is automatically volatile - the naming reflects this.) | 75 | * (asm goto is automatically volatile - the naming reflects this.) |
| 77 | */ | 76 | */ |
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h index cdd1cc202d51..c8c565952548 100644 --- a/include/linux/compiler-gcc5.h +++ b/include/linux/compiler-gcc5.h | |||
| @@ -53,7 +53,6 @@ | |||
| 53 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 | 53 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 |
| 54 | * | 54 | * |
| 55 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. | 55 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. |
| 56 | * Fixed in GCC 4.8.2 and later versions. | ||
| 57 | * | 56 | * |
| 58 | * (asm goto is automatically volatile - the naming reflects this.) | 57 | * (asm goto is automatically volatile - the naming reflects this.) |
| 59 | */ | 58 | */ |
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h index 6b394f0b5148..eeb307985715 100644 --- a/include/linux/khugepaged.h +++ b/include/linux/khugepaged.h | |||
| @@ -6,7 +6,8 @@ | |||
| 6 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 6 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 7 | extern int __khugepaged_enter(struct mm_struct *mm); | 7 | extern int __khugepaged_enter(struct mm_struct *mm); |
| 8 | extern void __khugepaged_exit(struct mm_struct *mm); | 8 | extern void __khugepaged_exit(struct mm_struct *mm); |
| 9 | extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma); | 9 | extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma, |
| 10 | unsigned long vm_flags); | ||
| 10 | 11 | ||
| 11 | #define khugepaged_enabled() \ | 12 | #define khugepaged_enabled() \ |
| 12 | (transparent_hugepage_flags & \ | 13 | (transparent_hugepage_flags & \ |
| @@ -35,13 +36,13 @@ static inline void khugepaged_exit(struct mm_struct *mm) | |||
| 35 | __khugepaged_exit(mm); | 36 | __khugepaged_exit(mm); |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | static inline int khugepaged_enter(struct vm_area_struct *vma) | 39 | static inline int khugepaged_enter(struct vm_area_struct *vma, |
| 40 | unsigned long vm_flags) | ||
| 39 | { | 41 | { |
| 40 | if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) | 42 | if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) |
| 41 | if ((khugepaged_always() || | 43 | if ((khugepaged_always() || |
| 42 | (khugepaged_req_madv() && | 44 | (khugepaged_req_madv() && (vm_flags & VM_HUGEPAGE))) && |
| 43 | vma->vm_flags & VM_HUGEPAGE)) && | 45 | !(vm_flags & VM_NOHUGEPAGE)) |
| 44 | !(vma->vm_flags & VM_NOHUGEPAGE)) | ||
| 45 | if (__khugepaged_enter(vma->vm_mm)) | 46 | if (__khugepaged_enter(vma->vm_mm)) |
| 46 | return -ENOMEM; | 47 | return -ENOMEM; |
| 47 | return 0; | 48 | return 0; |
| @@ -54,11 +55,13 @@ static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm) | |||
| 54 | static inline void khugepaged_exit(struct mm_struct *mm) | 55 | static inline void khugepaged_exit(struct mm_struct *mm) |
| 55 | { | 56 | { |
| 56 | } | 57 | } |
| 57 | static inline int khugepaged_enter(struct vm_area_struct *vma) | 58 | static inline int khugepaged_enter(struct vm_area_struct *vma, |
| 59 | unsigned long vm_flags) | ||
| 58 | { | 60 | { |
| 59 | return 0; | 61 | return 0; |
| 60 | } | 62 | } |
| 61 | static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | 63 | static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma, |
| 64 | unsigned long vm_flags) | ||
| 62 | { | 65 | { |
| 63 | return 0; | 66 | return 0; |
| 64 | } | 67 | } |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 19df5d857411..6b75640ef5ab 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -139,48 +139,23 @@ static inline bool mem_cgroup_disabled(void) | |||
| 139 | return false; | 139 | return false; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, | 142 | struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked, |
| 143 | unsigned long *flags); | 143 | unsigned long *flags); |
| 144 | 144 | void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked, | |
| 145 | extern atomic_t memcg_moving; | 145 | unsigned long flags); |
| 146 | 146 | void mem_cgroup_update_page_stat(struct mem_cgroup *memcg, | |
| 147 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | 147 | enum mem_cgroup_stat_index idx, int val); |
| 148 | bool *locked, unsigned long *flags) | 148 | |
| 149 | { | 149 | static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg, |
| 150 | if (mem_cgroup_disabled()) | ||
| 151 | return; | ||
| 152 | rcu_read_lock(); | ||
| 153 | *locked = false; | ||
| 154 | if (atomic_read(&memcg_moving)) | ||
| 155 | __mem_cgroup_begin_update_page_stat(page, locked, flags); | ||
| 156 | } | ||
| 157 | |||
| 158 | void __mem_cgroup_end_update_page_stat(struct page *page, | ||
| 159 | unsigned long *flags); | ||
| 160 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
| 161 | bool *locked, unsigned long *flags) | ||
| 162 | { | ||
| 163 | if (mem_cgroup_disabled()) | ||
| 164 | return; | ||
| 165 | if (*locked) | ||
| 166 | __mem_cgroup_end_update_page_stat(page, flags); | ||
| 167 | rcu_read_unlock(); | ||
| 168 | } | ||
| 169 | |||
| 170 | void mem_cgroup_update_page_stat(struct page *page, | ||
| 171 | enum mem_cgroup_stat_index idx, | ||
| 172 | int val); | ||
| 173 | |||
| 174 | static inline void mem_cgroup_inc_page_stat(struct page *page, | ||
| 175 | enum mem_cgroup_stat_index idx) | 150 | enum mem_cgroup_stat_index idx) |
| 176 | { | 151 | { |
| 177 | mem_cgroup_update_page_stat(page, idx, 1); | 152 | mem_cgroup_update_page_stat(memcg, idx, 1); |
| 178 | } | 153 | } |
| 179 | 154 | ||
| 180 | static inline void mem_cgroup_dec_page_stat(struct page *page, | 155 | static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg, |
| 181 | enum mem_cgroup_stat_index idx) | 156 | enum mem_cgroup_stat_index idx) |
| 182 | { | 157 | { |
| 183 | mem_cgroup_update_page_stat(page, idx, -1); | 158 | mem_cgroup_update_page_stat(memcg, idx, -1); |
| 184 | } | 159 | } |
| 185 | 160 | ||
| 186 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 161 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
| @@ -315,13 +290,14 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
| 315 | { | 290 | { |
| 316 | } | 291 | } |
| 317 | 292 | ||
| 318 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | 293 | static inline struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, |
| 319 | bool *locked, unsigned long *flags) | 294 | bool *locked, unsigned long *flags) |
| 320 | { | 295 | { |
| 296 | return NULL; | ||
| 321 | } | 297 | } |
| 322 | 298 | ||
| 323 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | 299 | static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, |
| 324 | bool *locked, unsigned long *flags) | 300 | bool locked, unsigned long flags) |
| 325 | { | 301 | { |
| 326 | } | 302 | } |
| 327 | 303 | ||
| @@ -343,12 +319,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait) | |||
| 343 | return false; | 319 | return false; |
| 344 | } | 320 | } |
| 345 | 321 | ||
| 346 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 322 | static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg, |
| 347 | enum mem_cgroup_stat_index idx) | 323 | enum mem_cgroup_stat_index idx) |
| 348 | { | 324 | { |
| 349 | } | 325 | } |
| 350 | 326 | ||
| 351 | static inline void mem_cgroup_dec_page_stat(struct page *page, | 327 | static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg, |
| 352 | enum mem_cgroup_stat_index idx) | 328 | enum mem_cgroup_stat_index idx) |
| 353 | { | 329 | { |
| 354 | } | 330 | } |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 27eb1bfbe704..b46461116cd2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1235,7 +1235,6 @@ int __set_page_dirty_no_writeback(struct page *page); | |||
| 1235 | int redirty_page_for_writepage(struct writeback_control *wbc, | 1235 | int redirty_page_for_writepage(struct writeback_control *wbc, |
| 1236 | struct page *page); | 1236 | struct page *page); |
| 1237 | void account_page_dirtied(struct page *page, struct address_space *mapping); | 1237 | void account_page_dirtied(struct page *page, struct address_space *mapping); |
| 1238 | void account_page_writeback(struct page *page); | ||
| 1239 | int set_page_dirty(struct page *page); | 1238 | int set_page_dirty(struct page *page); |
| 1240 | int set_page_dirty_lock(struct page *page); | 1239 | int set_page_dirty_lock(struct page *page); |
| 1241 | int clear_page_dirty_for_io(struct page *page); | 1240 | int clear_page_dirty_for_io(struct page *page); |
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 5b5efae09135..ad2f67054372 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h | |||
| @@ -16,7 +16,7 @@ struct reserved_mem { | |||
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | struct reserved_mem_ops { | 18 | struct reserved_mem_ops { |
| 19 | void (*device_init)(struct reserved_mem *rmem, | 19 | int (*device_init)(struct reserved_mem *rmem, |
| 20 | struct device *dev); | 20 | struct device *dev); |
| 21 | void (*device_release)(struct reserved_mem *rmem, | 21 | void (*device_release)(struct reserved_mem *rmem, |
| 22 | struct device *dev); | 22 | struct device *dev); |
| @@ -28,14 +28,17 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); | |||
| 28 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) | 28 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_OF_RESERVED_MEM | 30 | #ifdef CONFIG_OF_RESERVED_MEM |
| 31 | void of_reserved_mem_device_init(struct device *dev); | 31 | int of_reserved_mem_device_init(struct device *dev); |
| 32 | void of_reserved_mem_device_release(struct device *dev); | 32 | void of_reserved_mem_device_release(struct device *dev); |
| 33 | 33 | ||
| 34 | void fdt_init_reserved_mem(void); | 34 | void fdt_init_reserved_mem(void); |
| 35 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, | 35 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, |
| 36 | phys_addr_t base, phys_addr_t size); | 36 | phys_addr_t base, phys_addr_t size); |
| 37 | #else | 37 | #else |
| 38 | static inline void of_reserved_mem_device_init(struct device *dev) { } | 38 | static inline int of_reserved_mem_device_init(struct device *dev) |
| 39 | { | ||
| 40 | return -ENOSYS; | ||
| 41 | } | ||
| 39 | static inline void of_reserved_mem_device_release(struct device *pdev) { } | 42 | static inline void of_reserved_mem_device_release(struct device *pdev) { } |
| 40 | 43 | ||
| 41 | static inline void fdt_init_reserved_mem(void) { } | 44 | static inline void fdt_init_reserved_mem(void) { } |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index d347c805f923..f540b1496e2f 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -35,6 +35,8 @@ | |||
| 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ |
| 36 | #define __LINUX_REGULATOR_CONSUMER_H_ | 36 | #define __LINUX_REGULATOR_CONSUMER_H_ |
| 37 | 37 | ||
| 38 | #include <linux/err.h> | ||
| 39 | |||
| 38 | struct device; | 40 | struct device; |
| 39 | struct notifier_block; | 41 | struct notifier_block; |
| 40 | struct regmap; | 42 | struct regmap; |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a59d9343c25b..6c8b6f604e76 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -557,7 +557,9 @@ struct sk_buff { | |||
| 557 | /* fields enclosed in headers_start/headers_end are copied | 557 | /* fields enclosed in headers_start/headers_end are copied |
| 558 | * using a single memcpy() in __copy_skb_header() | 558 | * using a single memcpy() in __copy_skb_header() |
| 559 | */ | 559 | */ |
| 560 | /* private: */ | ||
| 560 | __u32 headers_start[0]; | 561 | __u32 headers_start[0]; |
| 562 | /* public: */ | ||
| 561 | 563 | ||
| 562 | /* if you move pkt_type around you also must adapt those constants */ | 564 | /* if you move pkt_type around you also must adapt those constants */ |
| 563 | #ifdef __BIG_ENDIAN_BITFIELD | 565 | #ifdef __BIG_ENDIAN_BITFIELD |
| @@ -642,7 +644,9 @@ struct sk_buff { | |||
| 642 | __u16 network_header; | 644 | __u16 network_header; |
| 643 | __u16 mac_header; | 645 | __u16 mac_header; |
| 644 | 646 | ||
| 647 | /* private: */ | ||
| 645 | __u32 headers_end[0]; | 648 | __u32 headers_end[0]; |
| 649 | /* public: */ | ||
| 646 | 650 | ||
| 647 | /* These elements must be at the end, see alloc_skb() for details. */ | 651 | /* These elements must be at the end, see alloc_skb() for details. */ |
| 648 | sk_buff_data_t tail; | 652 | sk_buff_data_t tail; |
| @@ -795,15 +799,19 @@ struct sk_buff_fclones { | |||
| 795 | * @skb: buffer | 799 | * @skb: buffer |
| 796 | * | 800 | * |
| 797 | * Returns true is skb is a fast clone, and its clone is not freed. | 801 | * Returns true is skb is a fast clone, and its clone is not freed. |
| 802 | * Some drivers call skb_orphan() in their ndo_start_xmit(), | ||
| 803 | * so we also check that this didnt happen. | ||
| 798 | */ | 804 | */ |
| 799 | static inline bool skb_fclone_busy(const struct sk_buff *skb) | 805 | static inline bool skb_fclone_busy(const struct sock *sk, |
| 806 | const struct sk_buff *skb) | ||
| 800 | { | 807 | { |
| 801 | const struct sk_buff_fclones *fclones; | 808 | const struct sk_buff_fclones *fclones; |
| 802 | 809 | ||
| 803 | fclones = container_of(skb, struct sk_buff_fclones, skb1); | 810 | fclones = container_of(skb, struct sk_buff_fclones, skb1); |
| 804 | 811 | ||
| 805 | return skb->fclone == SKB_FCLONE_ORIG && | 812 | return skb->fclone == SKB_FCLONE_ORIG && |
| 806 | fclones->skb2.fclone == SKB_FCLONE_CLONE; | 813 | fclones->skb2.fclone == SKB_FCLONE_CLONE && |
| 814 | fclones->skb2.sk == sk; | ||
| 807 | } | 815 | } |
| 808 | 816 | ||
| 809 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | 817 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 26088feb6608..d9a4905e01d0 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -78,6 +78,7 @@ struct usbnet { | |||
| 78 | # define EVENT_NO_RUNTIME_PM 9 | 78 | # define EVENT_NO_RUNTIME_PM 9 |
| 79 | # define EVENT_RX_KILL 10 | 79 | # define EVENT_RX_KILL 10 |
| 80 | # define EVENT_LINK_CHANGE 11 | 80 | # define EVENT_LINK_CHANGE 11 |
| 81 | # define EVENT_SET_RX_MODE 12 | ||
| 81 | }; | 82 | }; |
| 82 | 83 | ||
| 83 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 84 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
| @@ -159,6 +160,9 @@ struct driver_info { | |||
| 159 | /* called by minidriver when receiving indication */ | 160 | /* called by minidriver when receiving indication */ |
| 160 | void (*indication)(struct usbnet *dev, void *ind, int indlen); | 161 | void (*indication)(struct usbnet *dev, void *ind, int indlen); |
| 161 | 162 | ||
| 163 | /* rx mode change (device changes address list filtering) */ | ||
| 164 | void (*set_rx_mode)(struct usbnet *dev); | ||
| 165 | |||
| 162 | /* for new devices, use the descriptor-reading code instead */ | 166 | /* for new devices, use the descriptor-reading code instead */ |
| 163 | int in; /* rx endpoint */ | 167 | int in; /* rx endpoint */ |
| 164 | int out; /* tx endpoint */ | 168 | int out; /* tx endpoint */ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 97f472012438..4292929392b0 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -671,6 +671,8 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add | |||
| 671 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); | 671 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); |
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | void ipv6_proxy_select_ident(struct sk_buff *skb); | ||
| 675 | |||
| 674 | int ip6_dst_hoplimit(struct dst_entry *dst); | 676 | int ip6_dst_hoplimit(struct dst_entry *dst); |
| 675 | 677 | ||
| 676 | static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6, | 678 | static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6, |
diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h index e8427193c777..03e928a55229 100644 --- a/include/net/netfilter/ipv4/nf_reject.h +++ b/include/net/netfilter/ipv4/nf_reject.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef _IPV4_NF_REJECT_H | 1 | #ifndef _IPV4_NF_REJECT_H |
| 2 | #define _IPV4_NF_REJECT_H | 2 | #define _IPV4_NF_REJECT_H |
| 3 | 3 | ||
| 4 | #include <linux/skbuff.h> | ||
| 5 | #include <net/ip.h> | ||
| 4 | #include <net/icmp.h> | 6 | #include <net/icmp.h> |
| 5 | 7 | ||
| 6 | static inline void nf_send_unreach(struct sk_buff *skb_in, int code) | 8 | static inline void nf_send_unreach(struct sk_buff *skb_in, int code) |
| @@ -10,4 +12,12 @@ static inline void nf_send_unreach(struct sk_buff *skb_in, int code) | |||
| 10 | 12 | ||
| 11 | void nf_send_reset(struct sk_buff *oldskb, int hook); | 13 | void nf_send_reset(struct sk_buff *oldskb, int hook); |
| 12 | 14 | ||
| 15 | const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb, | ||
| 16 | struct tcphdr *_oth, int hook); | ||
| 17 | struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, | ||
| 18 | const struct sk_buff *oldskb, | ||
| 19 | __be16 protocol, int ttl); | ||
| 20 | void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb, | ||
| 21 | const struct tcphdr *oth); | ||
| 22 | |||
| 13 | #endif /* _IPV4_NF_REJECT_H */ | 23 | #endif /* _IPV4_NF_REJECT_H */ |
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h index 48e18810a9be..23216d48abf9 100644 --- a/include/net/netfilter/ipv6/nf_reject.h +++ b/include/net/netfilter/ipv6/nf_reject.h | |||
| @@ -15,4 +15,14 @@ nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code, | |||
| 15 | 15 | ||
| 16 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook); | 16 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook); |
| 17 | 17 | ||
| 18 | const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb, | ||
| 19 | struct tcphdr *otcph, | ||
| 20 | unsigned int *otcplen, int hook); | ||
| 21 | struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, | ||
| 22 | const struct sk_buff *oldskb, | ||
| 23 | __be16 protocol, int hoplimit); | ||
| 24 | void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, | ||
| 25 | const struct sk_buff *oldskb, | ||
| 26 | const struct tcphdr *oth, unsigned int otcplen); | ||
| 27 | |||
| 18 | #endif /* _IPV6_NF_REJECT_H */ | 28 | #endif /* _IPV6_NF_REJECT_H */ |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 3d7292392fac..845c596bf594 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
| @@ -530,6 +530,9 @@ enum nft_chain_type { | |||
| 530 | NFT_CHAIN_T_MAX | 530 | NFT_CHAIN_T_MAX |
| 531 | }; | 531 | }; |
| 532 | 532 | ||
| 533 | int nft_chain_validate_dependency(const struct nft_chain *chain, | ||
| 534 | enum nft_chain_type type); | ||
| 535 | |||
| 533 | struct nft_stats { | 536 | struct nft_stats { |
| 534 | u64 bytes; | 537 | u64 bytes; |
| 535 | u64 pkts; | 538 | u64 pkts; |
diff --git a/include/net/netfilter/nft_masq.h b/include/net/netfilter/nft_masq.h index c72729f954f4..e2a518b60e19 100644 --- a/include/net/netfilter/nft_masq.h +++ b/include/net/netfilter/nft_masq.h | |||
| @@ -13,4 +13,7 @@ int nft_masq_init(const struct nft_ctx *ctx, | |||
| 13 | 13 | ||
| 14 | int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr); | 14 | int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr); |
| 15 | 15 | ||
| 16 | int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
| 17 | const struct nft_data **data); | ||
| 18 | |||
| 16 | #endif /* _NFT_MASQ_H_ */ | 19 | #endif /* _NFT_MASQ_H_ */ |
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index 9b56f37148cf..e335e7d8c6c2 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h | |||
| @@ -660,18 +660,18 @@ TRACE_EVENT(rcu_torture_read, | |||
| 660 | /* | 660 | /* |
| 661 | * Tracepoint for _rcu_barrier() execution. The string "s" describes | 661 | * Tracepoint for _rcu_barrier() execution. The string "s" describes |
| 662 | * the _rcu_barrier phase: | 662 | * the _rcu_barrier phase: |
| 663 | * "Begin": rcu_barrier_callback() started. | 663 | * "Begin": _rcu_barrier() started. |
| 664 | * "Check": rcu_barrier_callback() checking for piggybacking. | 664 | * "Check": _rcu_barrier() checking for piggybacking. |
| 665 | * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit. | 665 | * "EarlyExit": _rcu_barrier() piggybacked, thus early exit. |
| 666 | * "Inc1": rcu_barrier_callback() piggyback check counter incremented. | 666 | * "Inc1": _rcu_barrier() piggyback check counter incremented. |
| 667 | * "Offline": rcu_barrier_callback() found offline CPU | 667 | * "OfflineNoCB": _rcu_barrier() found callback on never-online CPU |
| 668 | * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU. | 668 | * "OnlineNoCB": _rcu_barrier() found online no-CBs CPU. |
| 669 | * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks. | 669 | * "OnlineQ": _rcu_barrier() found online CPU with callbacks. |
| 670 | * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks. | 670 | * "OnlineNQ": _rcu_barrier() found online CPU, no callbacks. |
| 671 | * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. | 671 | * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. |
| 672 | * "CB": An rcu_barrier_callback() invoked a callback, not the last. | 672 | * "CB": An rcu_barrier_callback() invoked a callback, not the last. |
| 673 | * "LastCB": An rcu_barrier_callback() invoked the last callback. | 673 | * "LastCB": An rcu_barrier_callback() invoked the last callback. |
| 674 | * "Inc2": rcu_barrier_callback() piggyback check counter incremented. | 674 | * "Inc2": _rcu_barrier() piggyback check counter incremented. |
| 675 | * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument | 675 | * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument |
| 676 | * is the count of remaining callbacks, and "done" is the piggybacking count. | 676 | * is the count of remaining callbacks, and "done" is the piggybacking count. |
| 677 | */ | 677 | */ |
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 1874ebe9ac1e..a1d7e931ab72 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h | |||
| @@ -739,6 +739,13 @@ struct input_keymap_entry { | |||
| 739 | #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ | 739 | #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ |
| 740 | #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ | 740 | #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ |
| 741 | 741 | ||
| 742 | #define KEY_KBDINPUTASSIST_PREV 0x260 | ||
| 743 | #define KEY_KBDINPUTASSIST_NEXT 0x261 | ||
| 744 | #define KEY_KBDINPUTASSIST_PREVGROUP 0x262 | ||
| 745 | #define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 | ||
| 746 | #define KEY_KBDINPUTASSIST_ACCEPT 0x264 | ||
| 747 | #define KEY_KBDINPUTASSIST_CANCEL 0x265 | ||
| 748 | |||
| 742 | #define BTN_TRIGGER_HAPPY 0x2c0 | 749 | #define BTN_TRIGGER_HAPPY 0x2c0 |
| 743 | #define BTN_TRIGGER_HAPPY1 0x2c0 | 750 | #define BTN_TRIGGER_HAPPY1 0x2c0 |
| 744 | #define BTN_TRIGGER_HAPPY2 0x2c1 | 751 | #define BTN_TRIGGER_HAPPY2 0x2c1 |
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 9269de254874..9d845404d875 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
| @@ -364,7 +364,7 @@ struct perf_event_mmap_page { | |||
| 364 | /* | 364 | /* |
| 365 | * Bits needed to read the hw events in user-space. | 365 | * Bits needed to read the hw events in user-space. |
| 366 | * | 366 | * |
| 367 | * u32 seq, time_mult, time_shift, idx, width; | 367 | * u32 seq, time_mult, time_shift, index, width; |
| 368 | * u64 count, enabled, running; | 368 | * u64 count, enabled, running; |
| 369 | * u64 cyc, time_offset; | 369 | * u64 cyc, time_offset; |
| 370 | * s64 pmc = 0; | 370 | * s64 pmc = 0; |
| @@ -383,11 +383,11 @@ struct perf_event_mmap_page { | |||
| 383 | * time_shift = pc->time_shift; | 383 | * time_shift = pc->time_shift; |
| 384 | * } | 384 | * } |
| 385 | * | 385 | * |
| 386 | * idx = pc->index; | 386 | * index = pc->index; |
| 387 | * count = pc->offset; | 387 | * count = pc->offset; |
| 388 | * if (pc->cap_usr_rdpmc && idx) { | 388 | * if (pc->cap_user_rdpmc && index) { |
| 389 | * width = pc->pmc_width; | 389 | * width = pc->pmc_width; |
| 390 | * pmc = rdpmc(idx - 1); | 390 | * pmc = rdpmc(index - 1); |
| 391 | * } | 391 | * } |
| 392 | * | 392 | * |
| 393 | * barrier(); | 393 | * barrier(); |
| @@ -415,7 +415,7 @@ struct perf_event_mmap_page { | |||
| 415 | }; | 415 | }; |
| 416 | 416 | ||
| 417 | /* | 417 | /* |
| 418 | * If cap_usr_rdpmc this field provides the bit-width of the value | 418 | * If cap_user_rdpmc this field provides the bit-width of the value |
| 419 | * read using the rdpmc() or equivalent instruction. This can be used | 419 | * read using the rdpmc() or equivalent instruction. This can be used |
| 420 | * to sign extend the result like: | 420 | * to sign extend the result like: |
| 421 | * | 421 | * |
| @@ -439,10 +439,10 @@ struct perf_event_mmap_page { | |||
| 439 | * | 439 | * |
| 440 | * Where time_offset,time_mult,time_shift and cyc are read in the | 440 | * Where time_offset,time_mult,time_shift and cyc are read in the |
| 441 | * seqcount loop described above. This delta can then be added to | 441 | * seqcount loop described above. This delta can then be added to |
| 442 | * enabled and possible running (if idx), improving the scaling: | 442 | * enabled and possible running (if index), improving the scaling: |
| 443 | * | 443 | * |
| 444 | * enabled += delta; | 444 | * enabled += delta; |
| 445 | * if (idx) | 445 | * if (index) |
| 446 | * running += delta; | 446 | * running += delta; |
| 447 | * | 447 | * |
| 448 | * quot = count / running; | 448 | * quot = count / running; |
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h index 34f9d7387d13..b932be9f5c5b 100644 --- a/include/uapi/linux/sched.h +++ b/include/uapi/linux/sched.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ | 13 | #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ |
| 14 | #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ | 14 | #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ |
| 15 | #define CLONE_THREAD 0x00010000 /* Same thread group? */ | 15 | #define CLONE_THREAD 0x00010000 /* Same thread group? */ |
| 16 | #define CLONE_NEWNS 0x00020000 /* New namespace group? */ | 16 | #define CLONE_NEWNS 0x00020000 /* New mount namespace group */ |
| 17 | #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ | 17 | #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
| 18 | #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ | 18 | #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ |
| 19 | #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ | 19 | #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ |
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h index 6a0764c89fcb..6c8f159e416e 100644 --- a/include/uapi/linux/v4l2-dv-timings.h +++ b/include/uapi/linux/v4l2-dv-timings.h | |||
| @@ -21,8 +21,17 @@ | |||
| 21 | #ifndef _V4L2_DV_TIMINGS_H | 21 | #ifndef _V4L2_DV_TIMINGS_H |
| 22 | #define _V4L2_DV_TIMINGS_H | 22 | #define _V4L2_DV_TIMINGS_H |
| 23 | 23 | ||
| 24 | #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) | ||
| 25 | /* Sadly gcc versions older than 4.6 have a bug in how they initialize | ||
| 26 | anonymous unions where they require additional curly brackets. | ||
| 27 | This violates the C1x standard. This workaround adds the curly brackets | ||
| 28 | if needed. */ | ||
| 24 | #define V4L2_INIT_BT_TIMINGS(_width, args...) \ | 29 | #define V4L2_INIT_BT_TIMINGS(_width, args...) \ |
| 25 | { .bt = { _width , ## args } } | 30 | { .bt = { _width , ## args } } |
| 31 | #else | ||
| 32 | #define V4L2_INIT_BT_TIMINGS(_width, args...) \ | ||
| 33 | .bt = { _width , ## args } | ||
| 34 | #endif | ||
| 26 | 35 | ||
| 27 | /* CEA-861-E timings (i.e. standard HDTV timings) */ | 36 | /* CEA-861-E timings (i.e. standard HDTV timings) */ |
| 28 | 37 | ||
diff --git a/init/Kconfig b/init/Kconfig index 3ee28ae02cc8..2081a4d3d917 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -1341,6 +1341,10 @@ config SYSCTL_ARCH_UNALIGN_ALLOW | |||
| 1341 | config HAVE_PCSPKR_PLATFORM | 1341 | config HAVE_PCSPKR_PLATFORM |
| 1342 | bool | 1342 | bool |
| 1343 | 1343 | ||
| 1344 | # interpreter that classic socket filters depend on | ||
| 1345 | config BPF | ||
| 1346 | bool | ||
| 1347 | |||
| 1344 | menuconfig EXPERT | 1348 | menuconfig EXPERT |
| 1345 | bool "Configure standard kernel features (expert users)" | 1349 | bool "Configure standard kernel features (expert users)" |
| 1346 | # Unhide debug options, to make the on-by-default options visible | 1350 | # Unhide debug options, to make the on-by-default options visible |
| @@ -1521,6 +1525,16 @@ config EVENTFD | |||
| 1521 | 1525 | ||
| 1522 | If unsure, say Y. | 1526 | If unsure, say Y. |
| 1523 | 1527 | ||
| 1528 | # syscall, maps, verifier | ||
| 1529 | config BPF_SYSCALL | ||
| 1530 | bool "Enable bpf() system call" if EXPERT | ||
| 1531 | select ANON_INODES | ||
| 1532 | select BPF | ||
| 1533 | default n | ||
| 1534 | help | ||
| 1535 | Enable the bpf() system call that allows to manipulate eBPF | ||
| 1536 | programs and maps via file descriptors. | ||
| 1537 | |||
| 1524 | config SHMEM | 1538 | config SHMEM |
| 1525 | bool "Use full shmem filesystem" if EXPERT | 1539 | bool "Use full shmem filesystem" if EXPERT |
| 1526 | default y | 1540 | default y |
diff --git a/kernel/Makefile b/kernel/Makefile index dc5c77544fd6..17ea6d4a9a24 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -86,7 +86,7 @@ obj-$(CONFIG_RING_BUFFER) += trace/ | |||
| 86 | obj-$(CONFIG_TRACEPOINTS) += trace/ | 86 | obj-$(CONFIG_TRACEPOINTS) += trace/ |
| 87 | obj-$(CONFIG_IRQ_WORK) += irq_work.o | 87 | obj-$(CONFIG_IRQ_WORK) += irq_work.o |
| 88 | obj-$(CONFIG_CPU_PM) += cpu_pm.o | 88 | obj-$(CONFIG_CPU_PM) += cpu_pm.o |
| 89 | obj-$(CONFIG_NET) += bpf/ | 89 | obj-$(CONFIG_BPF) += bpf/ |
| 90 | 90 | ||
| 91 | obj-$(CONFIG_PERF_EVENTS) += events/ | 91 | obj-$(CONFIG_PERF_EVENTS) += events/ |
| 92 | 92 | ||
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile index 45427239f375..0daf7f6ae7df 100644 --- a/kernel/bpf/Makefile +++ b/kernel/bpf/Makefile | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | obj-y := core.o syscall.o verifier.o | 1 | obj-y := core.o |
| 2 | 2 | obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o | |
| 3 | ifdef CONFIG_TEST_BPF | 3 | ifdef CONFIG_TEST_BPF |
| 4 | obj-y += test_stub.o | 4 | obj-$(CONFIG_BPF_SYSCALL) += test_stub.o |
| 5 | endif | 5 | endif |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index f0c30c59b317..d6594e457a25 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
| @@ -655,3 +655,12 @@ void bpf_prog_free(struct bpf_prog *fp) | |||
| 655 | schedule_work(&aux->work); | 655 | schedule_work(&aux->work); |
| 656 | } | 656 | } |
| 657 | EXPORT_SYMBOL_GPL(bpf_prog_free); | 657 | EXPORT_SYMBOL_GPL(bpf_prog_free); |
| 658 | |||
| 659 | /* To execute LD_ABS/LD_IND instructions __bpf_prog_run() may call | ||
| 660 | * skb_copy_bits(), so provide a weak definition of it for NET-less config. | ||
| 661 | */ | ||
| 662 | int __weak skb_copy_bits(const struct sk_buff *skb, int offset, void *to, | ||
| 663 | int len) | ||
| 664 | { | ||
| 665 | return -EFAULT; | ||
| 666 | } | ||
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 801f5f3b9307..9f81818f2941 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
| @@ -1409,7 +1409,8 @@ static bool states_equal(struct verifier_state *old, struct verifier_state *cur) | |||
| 1409 | if (memcmp(&old->regs[i], &cur->regs[i], | 1409 | if (memcmp(&old->regs[i], &cur->regs[i], |
| 1410 | sizeof(old->regs[0])) != 0) { | 1410 | sizeof(old->regs[0])) != 0) { |
| 1411 | if (old->regs[i].type == NOT_INIT || | 1411 | if (old->regs[i].type == NOT_INIT || |
| 1412 | old->regs[i].type == UNKNOWN_VALUE) | 1412 | (old->regs[i].type == UNKNOWN_VALUE && |
| 1413 | cur->regs[i].type != NOT_INIT)) | ||
| 1413 | continue; | 1414 | continue; |
| 1414 | return false; | 1415 | return false; |
| 1415 | } | 1416 | } |
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 5664985c46a0..937ecdfdf258 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c | |||
| @@ -107,46 +107,6 @@ void context_tracking_user_enter(void) | |||
| 107 | } | 107 | } |
| 108 | NOKPROBE_SYMBOL(context_tracking_user_enter); | 108 | NOKPROBE_SYMBOL(context_tracking_user_enter); |
| 109 | 109 | ||
| 110 | #ifdef CONFIG_PREEMPT | ||
| 111 | /** | ||
| 112 | * preempt_schedule_context - preempt_schedule called by tracing | ||
| 113 | * | ||
| 114 | * The tracing infrastructure uses preempt_enable_notrace to prevent | ||
| 115 | * recursion and tracing preempt enabling caused by the tracing | ||
| 116 | * infrastructure itself. But as tracing can happen in areas coming | ||
| 117 | * from userspace or just about to enter userspace, a preempt enable | ||
| 118 | * can occur before user_exit() is called. This will cause the scheduler | ||
| 119 | * to be called when the system is still in usermode. | ||
| 120 | * | ||
| 121 | * To prevent this, the preempt_enable_notrace will use this function | ||
| 122 | * instead of preempt_schedule() to exit user context if needed before | ||
| 123 | * calling the scheduler. | ||
| 124 | */ | ||
| 125 | asmlinkage __visible void __sched notrace preempt_schedule_context(void) | ||
| 126 | { | ||
| 127 | enum ctx_state prev_ctx; | ||
| 128 | |||
| 129 | if (likely(!preemptible())) | ||
| 130 | return; | ||
| 131 | |||
| 132 | /* | ||
| 133 | * Need to disable preemption in case user_exit() is traced | ||
| 134 | * and the tracer calls preempt_enable_notrace() causing | ||
| 135 | * an infinite recursion. | ||
| 136 | */ | ||
| 137 | preempt_disable_notrace(); | ||
| 138 | prev_ctx = exception_enter(); | ||
| 139 | preempt_enable_no_resched_notrace(); | ||
| 140 | |||
| 141 | preempt_schedule(); | ||
| 142 | |||
| 143 | preempt_disable_notrace(); | ||
| 144 | exception_exit(prev_ctx); | ||
| 145 | preempt_enable_notrace(); | ||
| 146 | } | ||
| 147 | EXPORT_SYMBOL_GPL(preempt_schedule_context); | ||
| 148 | #endif /* CONFIG_PREEMPT */ | ||
| 149 | |||
| 150 | /** | 110 | /** |
| 151 | * context_tracking_user_exit - Inform the context tracking that the CPU is | 111 | * context_tracking_user_exit - Inform the context tracking that the CPU is |
| 152 | * exiting userspace mode and entering the kernel. | 112 | * exiting userspace mode and entering the kernel. |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 356450f09c1f..90a3d017b90c 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -64,6 +64,8 @@ static struct { | |||
| 64 | * an ongoing cpu hotplug operation. | 64 | * an ongoing cpu hotplug operation. |
| 65 | */ | 65 | */ |
| 66 | int refcount; | 66 | int refcount; |
| 67 | /* And allows lockless put_online_cpus(). */ | ||
| 68 | atomic_t puts_pending; | ||
| 67 | 69 | ||
| 68 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 70 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 69 | struct lockdep_map dep_map; | 71 | struct lockdep_map dep_map; |
| @@ -113,7 +115,11 @@ void put_online_cpus(void) | |||
| 113 | { | 115 | { |
| 114 | if (cpu_hotplug.active_writer == current) | 116 | if (cpu_hotplug.active_writer == current) |
| 115 | return; | 117 | return; |
| 116 | mutex_lock(&cpu_hotplug.lock); | 118 | if (!mutex_trylock(&cpu_hotplug.lock)) { |
| 119 | atomic_inc(&cpu_hotplug.puts_pending); | ||
| 120 | cpuhp_lock_release(); | ||
| 121 | return; | ||
| 122 | } | ||
| 117 | 123 | ||
| 118 | if (WARN_ON(!cpu_hotplug.refcount)) | 124 | if (WARN_ON(!cpu_hotplug.refcount)) |
| 119 | cpu_hotplug.refcount++; /* try to fix things up */ | 125 | cpu_hotplug.refcount++; /* try to fix things up */ |
| @@ -155,6 +161,12 @@ void cpu_hotplug_begin(void) | |||
| 155 | cpuhp_lock_acquire(); | 161 | cpuhp_lock_acquire(); |
| 156 | for (;;) { | 162 | for (;;) { |
| 157 | mutex_lock(&cpu_hotplug.lock); | 163 | mutex_lock(&cpu_hotplug.lock); |
| 164 | if (atomic_read(&cpu_hotplug.puts_pending)) { | ||
| 165 | int delta; | ||
| 166 | |||
| 167 | delta = atomic_xchg(&cpu_hotplug.puts_pending, 0); | ||
| 168 | cpu_hotplug.refcount -= delta; | ||
| 169 | } | ||
| 158 | if (likely(!cpu_hotplug.refcount)) | 170 | if (likely(!cpu_hotplug.refcount)) |
| 159 | break; | 171 | break; |
| 160 | __set_current_state(TASK_UNINTERRUPTIBLE); | 172 | __set_current_state(TASK_UNINTERRUPTIBLE); |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 1425d07018de..2b02c9fda790 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -6071,11 +6071,6 @@ static int perf_swevent_init(struct perf_event *event) | |||
| 6071 | return 0; | 6071 | return 0; |
| 6072 | } | 6072 | } |
| 6073 | 6073 | ||
| 6074 | static int perf_swevent_event_idx(struct perf_event *event) | ||
| 6075 | { | ||
| 6076 | return 0; | ||
| 6077 | } | ||
| 6078 | |||
| 6079 | static struct pmu perf_swevent = { | 6074 | static struct pmu perf_swevent = { |
| 6080 | .task_ctx_nr = perf_sw_context, | 6075 | .task_ctx_nr = perf_sw_context, |
| 6081 | 6076 | ||
| @@ -6085,8 +6080,6 @@ static struct pmu perf_swevent = { | |||
| 6085 | .start = perf_swevent_start, | 6080 | .start = perf_swevent_start, |
| 6086 | .stop = perf_swevent_stop, | 6081 | .stop = perf_swevent_stop, |
| 6087 | .read = perf_swevent_read, | 6082 | .read = perf_swevent_read, |
| 6088 | |||
| 6089 | .event_idx = perf_swevent_event_idx, | ||
| 6090 | }; | 6083 | }; |
| 6091 | 6084 | ||
| 6092 | #ifdef CONFIG_EVENT_TRACING | 6085 | #ifdef CONFIG_EVENT_TRACING |
| @@ -6204,8 +6197,6 @@ static struct pmu perf_tracepoint = { | |||
| 6204 | .start = perf_swevent_start, | 6197 | .start = perf_swevent_start, |
| 6205 | .stop = perf_swevent_stop, | 6198 | .stop = perf_swevent_stop, |
| 6206 | .read = perf_swevent_read, | 6199 | .read = perf_swevent_read, |
| 6207 | |||
| 6208 | .event_idx = perf_swevent_event_idx, | ||
| 6209 | }; | 6200 | }; |
| 6210 | 6201 | ||
| 6211 | static inline void perf_tp_register(void) | 6202 | static inline void perf_tp_register(void) |
| @@ -6431,8 +6422,6 @@ static struct pmu perf_cpu_clock = { | |||
| 6431 | .start = cpu_clock_event_start, | 6422 | .start = cpu_clock_event_start, |
| 6432 | .stop = cpu_clock_event_stop, | 6423 | .stop = cpu_clock_event_stop, |
| 6433 | .read = cpu_clock_event_read, | 6424 | .read = cpu_clock_event_read, |
| 6434 | |||
| 6435 | .event_idx = perf_swevent_event_idx, | ||
| 6436 | }; | 6425 | }; |
| 6437 | 6426 | ||
| 6438 | /* | 6427 | /* |
| @@ -6511,8 +6500,6 @@ static struct pmu perf_task_clock = { | |||
| 6511 | .start = task_clock_event_start, | 6500 | .start = task_clock_event_start, |
| 6512 | .stop = task_clock_event_stop, | 6501 | .stop = task_clock_event_stop, |
| 6513 | .read = task_clock_event_read, | 6502 | .read = task_clock_event_read, |
| 6514 | |||
| 6515 | .event_idx = perf_swevent_event_idx, | ||
| 6516 | }; | 6503 | }; |
| 6517 | 6504 | ||
| 6518 | static void perf_pmu_nop_void(struct pmu *pmu) | 6505 | static void perf_pmu_nop_void(struct pmu *pmu) |
| @@ -6542,7 +6529,7 @@ static void perf_pmu_cancel_txn(struct pmu *pmu) | |||
| 6542 | 6529 | ||
| 6543 | static int perf_event_idx_default(struct perf_event *event) | 6530 | static int perf_event_idx_default(struct perf_event *event) |
| 6544 | { | 6531 | { |
| 6545 | return event->hw.idx + 1; | 6532 | return 0; |
| 6546 | } | 6533 | } |
| 6547 | 6534 | ||
| 6548 | /* | 6535 | /* |
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 1559fb0b9296..9803a6600d49 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c | |||
| @@ -605,11 +605,6 @@ static void hw_breakpoint_stop(struct perf_event *bp, int flags) | |||
| 605 | bp->hw.state = PERF_HES_STOPPED; | 605 | bp->hw.state = PERF_HES_STOPPED; |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static int hw_breakpoint_event_idx(struct perf_event *bp) | ||
| 609 | { | ||
| 610 | return 0; | ||
| 611 | } | ||
| 612 | |||
| 613 | static struct pmu perf_breakpoint = { | 608 | static struct pmu perf_breakpoint = { |
| 614 | .task_ctx_nr = perf_sw_context, /* could eventually get its own */ | 609 | .task_ctx_nr = perf_sw_context, /* could eventually get its own */ |
| 615 | 610 | ||
| @@ -619,8 +614,6 @@ static struct pmu perf_breakpoint = { | |||
| 619 | .start = hw_breakpoint_start, | 614 | .start = hw_breakpoint_start, |
| 620 | .stop = hw_breakpoint_stop, | 615 | .stop = hw_breakpoint_stop, |
| 621 | .read = hw_breakpoint_pmu_read, | 616 | .read = hw_breakpoint_pmu_read, |
| 622 | |||
| 623 | .event_idx = hw_breakpoint_event_idx, | ||
| 624 | }; | 617 | }; |
| 625 | 618 | ||
| 626 | int __init init_hw_breakpoint(void) | 619 | int __init init_hw_breakpoint(void) |
diff --git a/kernel/futex.c b/kernel/futex.c index f3a3a071283c..63678b573d61 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
| @@ -143,9 +143,8 @@ | |||
| 143 | * | 143 | * |
| 144 | * Where (A) orders the waiters increment and the futex value read through | 144 | * Where (A) orders the waiters increment and the futex value read through |
| 145 | * atomic operations (see hb_waiters_inc) and where (B) orders the write | 145 | * atomic operations (see hb_waiters_inc) and where (B) orders the write |
| 146 | * to futex and the waiters read -- this is done by the barriers in | 146 | * to futex and the waiters read -- this is done by the barriers for both |
| 147 | * get_futex_key_refs(), through either ihold or atomic_inc, depending on the | 147 | * shared and private futexes in get_futex_key_refs(). |
| 148 | * futex type. | ||
| 149 | * | 148 | * |
| 150 | * This yields the following case (where X:=waiters, Y:=futex): | 149 | * This yields the following case (where X:=waiters, Y:=futex): |
| 151 | * | 150 | * |
| @@ -344,13 +343,20 @@ static void get_futex_key_refs(union futex_key *key) | |||
| 344 | futex_get_mm(key); /* implies MB (B) */ | 343 | futex_get_mm(key); /* implies MB (B) */ |
| 345 | break; | 344 | break; |
| 346 | default: | 345 | default: |
| 346 | /* | ||
| 347 | * Private futexes do not hold reference on an inode or | ||
| 348 | * mm, therefore the only purpose of calling get_futex_key_refs | ||
| 349 | * is because we need the barrier for the lockless waiter check. | ||
| 350 | */ | ||
| 347 | smp_mb(); /* explicit MB (B) */ | 351 | smp_mb(); /* explicit MB (B) */ |
| 348 | } | 352 | } |
| 349 | } | 353 | } |
| 350 | 354 | ||
| 351 | /* | 355 | /* |
| 352 | * Drop a reference to the resource addressed by a key. | 356 | * Drop a reference to the resource addressed by a key. |
| 353 | * The hash bucket spinlock must not be held. | 357 | * The hash bucket spinlock must not be held. This is |
| 358 | * a no-op for private futexes, see comment in the get | ||
| 359 | * counterpart. | ||
| 354 | */ | 360 | */ |
| 355 | static void drop_futex_key_refs(union futex_key *key) | 361 | static void drop_futex_key_refs(union futex_key *key) |
| 356 | { | 362 | { |
| @@ -641,8 +647,14 @@ static struct futex_pi_state * alloc_pi_state(void) | |||
| 641 | return pi_state; | 647 | return pi_state; |
| 642 | } | 648 | } |
| 643 | 649 | ||
| 650 | /* | ||
| 651 | * Must be called with the hb lock held. | ||
| 652 | */ | ||
| 644 | static void free_pi_state(struct futex_pi_state *pi_state) | 653 | static void free_pi_state(struct futex_pi_state *pi_state) |
| 645 | { | 654 | { |
| 655 | if (!pi_state) | ||
| 656 | return; | ||
| 657 | |||
| 646 | if (!atomic_dec_and_test(&pi_state->refcount)) | 658 | if (!atomic_dec_and_test(&pi_state->refcount)) |
| 647 | return; | 659 | return; |
| 648 | 660 | ||
| @@ -1521,15 +1533,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, | |||
| 1521 | } | 1533 | } |
| 1522 | 1534 | ||
| 1523 | retry: | 1535 | retry: |
| 1524 | if (pi_state != NULL) { | ||
| 1525 | /* | ||
| 1526 | * We will have to lookup the pi_state again, so free this one | ||
| 1527 | * to keep the accounting correct. | ||
| 1528 | */ | ||
| 1529 | free_pi_state(pi_state); | ||
| 1530 | pi_state = NULL; | ||
| 1531 | } | ||
| 1532 | |||
| 1533 | ret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ); | 1536 | ret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ); |
| 1534 | if (unlikely(ret != 0)) | 1537 | if (unlikely(ret != 0)) |
| 1535 | goto out; | 1538 | goto out; |
| @@ -1619,6 +1622,8 @@ retry_private: | |||
| 1619 | case 0: | 1622 | case 0: |
| 1620 | break; | 1623 | break; |
| 1621 | case -EFAULT: | 1624 | case -EFAULT: |
| 1625 | free_pi_state(pi_state); | ||
| 1626 | pi_state = NULL; | ||
| 1622 | double_unlock_hb(hb1, hb2); | 1627 | double_unlock_hb(hb1, hb2); |
| 1623 | hb_waiters_dec(hb2); | 1628 | hb_waiters_dec(hb2); |
| 1624 | put_futex_key(&key2); | 1629 | put_futex_key(&key2); |
| @@ -1634,6 +1639,8 @@ retry_private: | |||
| 1634 | * exit to complete. | 1639 | * exit to complete. |
| 1635 | * - The user space value changed. | 1640 | * - The user space value changed. |
| 1636 | */ | 1641 | */ |
| 1642 | free_pi_state(pi_state); | ||
| 1643 | pi_state = NULL; | ||
| 1637 | double_unlock_hb(hb1, hb2); | 1644 | double_unlock_hb(hb1, hb2); |
| 1638 | hb_waiters_dec(hb2); | 1645 | hb_waiters_dec(hb2); |
| 1639 | put_futex_key(&key2); | 1646 | put_futex_key(&key2); |
| @@ -1710,6 +1717,7 @@ retry_private: | |||
| 1710 | } | 1717 | } |
| 1711 | 1718 | ||
| 1712 | out_unlock: | 1719 | out_unlock: |
| 1720 | free_pi_state(pi_state); | ||
| 1713 | double_unlock_hb(hb1, hb2); | 1721 | double_unlock_hb(hb1, hb2); |
| 1714 | hb_waiters_dec(hb2); | 1722 | hb_waiters_dec(hb2); |
| 1715 | 1723 | ||
| @@ -1727,8 +1735,6 @@ out_put_keys: | |||
| 1727 | out_put_key1: | 1735 | out_put_key1: |
| 1728 | put_futex_key(&key1); | 1736 | put_futex_key(&key1); |
| 1729 | out: | 1737 | out: |
| 1730 | if (pi_state != NULL) | ||
| 1731 | free_pi_state(pi_state); | ||
| 1732 | return ret ? ret : task_count; | 1738 | return ret ? ret : task_count; |
| 1733 | } | 1739 | } |
| 1734 | 1740 | ||
diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index cf66c5c8458e..3b7408759bdf 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig | |||
| @@ -35,7 +35,7 @@ config GCOV_KERNEL | |||
| 35 | config GCOV_PROFILE_ALL | 35 | config GCOV_PROFILE_ALL |
| 36 | bool "Profile entire Kernel" | 36 | bool "Profile entire Kernel" |
| 37 | depends on GCOV_KERNEL | 37 | depends on GCOV_KERNEL |
| 38 | depends on SUPERH || S390 || X86 || PPC || MICROBLAZE || ARM | 38 | depends on SUPERH || S390 || X86 || PPC || MICROBLAZE || ARM || ARM64 |
| 39 | default n | 39 | default n |
| 40 | ---help--- | 40 | ---help--- |
| 41 | This options activates profiling for the entire kernel. | 41 | This options activates profiling for the entire kernel. |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 8637e041a247..80f7a6d00519 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
| @@ -196,12 +196,34 @@ int __request_module(bool wait, const char *fmt, ...) | |||
| 196 | EXPORT_SYMBOL(__request_module); | 196 | EXPORT_SYMBOL(__request_module); |
| 197 | #endif /* CONFIG_MODULES */ | 197 | #endif /* CONFIG_MODULES */ |
| 198 | 198 | ||
| 199 | static void call_usermodehelper_freeinfo(struct subprocess_info *info) | ||
| 200 | { | ||
| 201 | if (info->cleanup) | ||
| 202 | (*info->cleanup)(info); | ||
| 203 | kfree(info); | ||
| 204 | } | ||
| 205 | |||
| 206 | static void umh_complete(struct subprocess_info *sub_info) | ||
| 207 | { | ||
| 208 | struct completion *comp = xchg(&sub_info->complete, NULL); | ||
| 209 | /* | ||
| 210 | * See call_usermodehelper_exec(). If xchg() returns NULL | ||
| 211 | * we own sub_info, the UMH_KILLABLE caller has gone away | ||
| 212 | * or the caller used UMH_NO_WAIT. | ||
| 213 | */ | ||
| 214 | if (comp) | ||
| 215 | complete(comp); | ||
| 216 | else | ||
| 217 | call_usermodehelper_freeinfo(sub_info); | ||
| 218 | } | ||
| 219 | |||
| 199 | /* | 220 | /* |
| 200 | * This is the task which runs the usermode application | 221 | * This is the task which runs the usermode application |
| 201 | */ | 222 | */ |
| 202 | static int ____call_usermodehelper(void *data) | 223 | static int ____call_usermodehelper(void *data) |
| 203 | { | 224 | { |
| 204 | struct subprocess_info *sub_info = data; | 225 | struct subprocess_info *sub_info = data; |
| 226 | int wait = sub_info->wait & ~UMH_KILLABLE; | ||
| 205 | struct cred *new; | 227 | struct cred *new; |
| 206 | int retval; | 228 | int retval; |
| 207 | 229 | ||
| @@ -221,7 +243,7 @@ static int ____call_usermodehelper(void *data) | |||
| 221 | retval = -ENOMEM; | 243 | retval = -ENOMEM; |
| 222 | new = prepare_kernel_cred(current); | 244 | new = prepare_kernel_cred(current); |
| 223 | if (!new) | 245 | if (!new) |
| 224 | goto fail; | 246 | goto out; |
| 225 | 247 | ||
| 226 | spin_lock(&umh_sysctl_lock); | 248 | spin_lock(&umh_sysctl_lock); |
| 227 | new->cap_bset = cap_intersect(usermodehelper_bset, new->cap_bset); | 249 | new->cap_bset = cap_intersect(usermodehelper_bset, new->cap_bset); |
| @@ -233,7 +255,7 @@ static int ____call_usermodehelper(void *data) | |||
| 233 | retval = sub_info->init(sub_info, new); | 255 | retval = sub_info->init(sub_info, new); |
| 234 | if (retval) { | 256 | if (retval) { |
| 235 | abort_creds(new); | 257 | abort_creds(new); |
| 236 | goto fail; | 258 | goto out; |
| 237 | } | 259 | } |
| 238 | } | 260 | } |
| 239 | 261 | ||
| @@ -242,12 +264,13 @@ static int ____call_usermodehelper(void *data) | |||
| 242 | retval = do_execve(getname_kernel(sub_info->path), | 264 | retval = do_execve(getname_kernel(sub_info->path), |
| 243 | (const char __user *const __user *)sub_info->argv, | 265 | (const char __user *const __user *)sub_info->argv, |
| 244 | (const char __user *const __user *)sub_info->envp); | 266 | (const char __user *const __user *)sub_info->envp); |
| 267 | out: | ||
| 268 | sub_info->retval = retval; | ||
| 269 | /* wait_for_helper() will call umh_complete if UHM_WAIT_PROC. */ | ||
| 270 | if (wait != UMH_WAIT_PROC) | ||
| 271 | umh_complete(sub_info); | ||
| 245 | if (!retval) | 272 | if (!retval) |
| 246 | return 0; | 273 | return 0; |
| 247 | |||
| 248 | /* Exec failed? */ | ||
| 249 | fail: | ||
| 250 | sub_info->retval = retval; | ||
| 251 | do_exit(0); | 274 | do_exit(0); |
| 252 | } | 275 | } |
| 253 | 276 | ||
| @@ -258,26 +281,6 @@ static int call_helper(void *data) | |||
| 258 | return ____call_usermodehelper(data); | 281 | return ____call_usermodehelper(data); |
| 259 | } | 282 | } |
| 260 | 283 | ||
| 261 | static void call_usermodehelper_freeinfo(struct subprocess_info *info) | ||
| 262 | { | ||
| 263 | if (info->cleanup) | ||
| 264 | (*info->cleanup)(info); | ||
| 265 | kfree(info); | ||
| 266 | } | ||
| 267 | |||
| 268 | static void umh_complete(struct subprocess_info *sub_info) | ||
| 269 | { | ||
| 270 | struct completion *comp = xchg(&sub_info->complete, NULL); | ||
| 271 | /* | ||
| 272 | * See call_usermodehelper_exec(). If xchg() returns NULL | ||
| 273 | * we own sub_info, the UMH_KILLABLE caller has gone away. | ||
| 274 | */ | ||
| 275 | if (comp) | ||
| 276 | complete(comp); | ||
| 277 | else | ||
| 278 | call_usermodehelper_freeinfo(sub_info); | ||
| 279 | } | ||
| 280 | |||
| 281 | /* Keventd can't block, but this (a child) can. */ | 284 | /* Keventd can't block, but this (a child) can. */ |
| 282 | static int wait_for_helper(void *data) | 285 | static int wait_for_helper(void *data) |
| 283 | { | 286 | { |
| @@ -336,18 +339,8 @@ static void __call_usermodehelper(struct work_struct *work) | |||
| 336 | kmod_thread_locker = NULL; | 339 | kmod_thread_locker = NULL; |
| 337 | } | 340 | } |
| 338 | 341 | ||
| 339 | switch (wait) { | 342 | if (pid < 0) { |
| 340 | case UMH_NO_WAIT: | 343 | sub_info->retval = pid; |
| 341 | call_usermodehelper_freeinfo(sub_info); | ||
| 342 | break; | ||
| 343 | |||
| 344 | case UMH_WAIT_PROC: | ||
| 345 | if (pid > 0) | ||
| 346 | break; | ||
| 347 | /* FALLTHROUGH */ | ||
| 348 | case UMH_WAIT_EXEC: | ||
| 349 | if (pid < 0) | ||
| 350 | sub_info->retval = pid; | ||
| 351 | umh_complete(sub_info); | 344 | umh_complete(sub_info); |
| 352 | } | 345 | } |
| 353 | } | 346 | } |
| @@ -588,7 +581,12 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) | |||
| 588 | goto out; | 581 | goto out; |
| 589 | } | 582 | } |
| 590 | 583 | ||
| 591 | sub_info->complete = &done; | 584 | /* |
| 585 | * Set the completion pointer only if there is a waiter. | ||
| 586 | * This makes it possible to use umh_complete to free | ||
| 587 | * the data structure in case of UMH_NO_WAIT. | ||
| 588 | */ | ||
| 589 | sub_info->complete = (wait == UMH_NO_WAIT) ? NULL : &done; | ||
| 592 | sub_info->wait = wait; | 590 | sub_info->wait = wait; |
| 593 | 591 | ||
| 594 | queue_work(khelper_wq, &sub_info->work); | 592 | queue_work(khelper_wq, &sub_info->work); |
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 133e47223095..9815447d22e0 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
| @@ -3299,11 +3299,16 @@ static void _rcu_barrier(struct rcu_state *rsp) | |||
| 3299 | continue; | 3299 | continue; |
| 3300 | rdp = per_cpu_ptr(rsp->rda, cpu); | 3300 | rdp = per_cpu_ptr(rsp->rda, cpu); |
| 3301 | if (rcu_is_nocb_cpu(cpu)) { | 3301 | if (rcu_is_nocb_cpu(cpu)) { |
| 3302 | _rcu_barrier_trace(rsp, "OnlineNoCB", cpu, | 3302 | if (!rcu_nocb_cpu_needs_barrier(rsp, cpu)) { |
| 3303 | rsp->n_barrier_done); | 3303 | _rcu_barrier_trace(rsp, "OfflineNoCB", cpu, |
| 3304 | atomic_inc(&rsp->barrier_cpu_count); | 3304 | rsp->n_barrier_done); |
| 3305 | __call_rcu(&rdp->barrier_head, rcu_barrier_callback, | 3305 | } else { |
| 3306 | rsp, cpu, 0); | 3306 | _rcu_barrier_trace(rsp, "OnlineNoCB", cpu, |
| 3307 | rsp->n_barrier_done); | ||
| 3308 | atomic_inc(&rsp->barrier_cpu_count); | ||
| 3309 | __call_rcu(&rdp->barrier_head, | ||
| 3310 | rcu_barrier_callback, rsp, cpu, 0); | ||
| 3311 | } | ||
| 3307 | } else if (ACCESS_ONCE(rdp->qlen)) { | 3312 | } else if (ACCESS_ONCE(rdp->qlen)) { |
| 3308 | _rcu_barrier_trace(rsp, "OnlineQ", cpu, | 3313 | _rcu_barrier_trace(rsp, "OnlineQ", cpu, |
| 3309 | rsp->n_barrier_done); | 3314 | rsp->n_barrier_done); |
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index d03764652d91..bbdc45d8d74f 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h | |||
| @@ -587,6 +587,7 @@ static void print_cpu_stall_info(struct rcu_state *rsp, int cpu); | |||
| 587 | static void print_cpu_stall_info_end(void); | 587 | static void print_cpu_stall_info_end(void); |
| 588 | static void zero_cpu_stall_ticks(struct rcu_data *rdp); | 588 | static void zero_cpu_stall_ticks(struct rcu_data *rdp); |
| 589 | static void increment_cpu_stall_ticks(void); | 589 | static void increment_cpu_stall_ticks(void); |
| 590 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu); | ||
| 590 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq); | 591 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq); |
| 591 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp); | 592 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp); |
| 592 | static void rcu_init_one_nocb(struct rcu_node *rnp); | 593 | static void rcu_init_one_nocb(struct rcu_node *rnp); |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 387dd4599344..c1d7f27bd38f 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
| @@ -2050,6 +2050,33 @@ static void wake_nocb_leader(struct rcu_data *rdp, bool force) | |||
| 2050 | } | 2050 | } |
| 2051 | 2051 | ||
| 2052 | /* | 2052 | /* |
| 2053 | * Does the specified CPU need an RCU callback for the specified flavor | ||
| 2054 | * of rcu_barrier()? | ||
| 2055 | */ | ||
| 2056 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu) | ||
| 2057 | { | ||
| 2058 | struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu); | ||
| 2059 | struct rcu_head *rhp; | ||
| 2060 | |||
| 2061 | /* No-CBs CPUs might have callbacks on any of three lists. */ | ||
| 2062 | rhp = ACCESS_ONCE(rdp->nocb_head); | ||
| 2063 | if (!rhp) | ||
| 2064 | rhp = ACCESS_ONCE(rdp->nocb_gp_head); | ||
| 2065 | if (!rhp) | ||
| 2066 | rhp = ACCESS_ONCE(rdp->nocb_follower_head); | ||
| 2067 | |||
| 2068 | /* Having no rcuo kthread but CBs after scheduler starts is bad! */ | ||
| 2069 | if (!ACCESS_ONCE(rdp->nocb_kthread) && rhp) { | ||
| 2070 | /* RCU callback enqueued before CPU first came online??? */ | ||
| 2071 | pr_err("RCU: Never-onlined no-CBs CPU %d has CB %p\n", | ||
| 2072 | cpu, rhp->func); | ||
| 2073 | WARN_ON_ONCE(1); | ||
| 2074 | } | ||
| 2075 | |||
| 2076 | return !!rhp; | ||
| 2077 | } | ||
| 2078 | |||
| 2079 | /* | ||
| 2053 | * Enqueue the specified string of rcu_head structures onto the specified | 2080 | * Enqueue the specified string of rcu_head structures onto the specified |
| 2054 | * CPU's no-CBs lists. The CPU is specified by rdp, the head of the | 2081 | * CPU's no-CBs lists. The CPU is specified by rdp, the head of the |
| 2055 | * string by rhp, and the tail of the string by rhtp. The non-lazy/lazy | 2082 | * string by rhp, and the tail of the string by rhtp. The non-lazy/lazy |
| @@ -2642,6 +2669,12 @@ static bool init_nocb_callback_list(struct rcu_data *rdp) | |||
| 2642 | 2669 | ||
| 2643 | #else /* #ifdef CONFIG_RCU_NOCB_CPU */ | 2670 | #else /* #ifdef CONFIG_RCU_NOCB_CPU */ |
| 2644 | 2671 | ||
| 2672 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu) | ||
| 2673 | { | ||
| 2674 | WARN_ON_ONCE(1); /* Should be dead code. */ | ||
| 2675 | return false; | ||
| 2676 | } | ||
| 2677 | |||
| 2645 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) | 2678 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) |
| 2646 | { | 2679 | { |
| 2647 | } | 2680 | } |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 44999505e1bf..240157c13ddc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -2951,6 +2951,47 @@ asmlinkage __visible void __sched notrace preempt_schedule(void) | |||
| 2951 | } | 2951 | } |
| 2952 | NOKPROBE_SYMBOL(preempt_schedule); | 2952 | NOKPROBE_SYMBOL(preempt_schedule); |
| 2953 | EXPORT_SYMBOL(preempt_schedule); | 2953 | EXPORT_SYMBOL(preempt_schedule); |
| 2954 | |||
| 2955 | #ifdef CONFIG_CONTEXT_TRACKING | ||
| 2956 | /** | ||
| 2957 | * preempt_schedule_context - preempt_schedule called by tracing | ||
| 2958 | * | ||
| 2959 | * The tracing infrastructure uses preempt_enable_notrace to prevent | ||
| 2960 | * recursion and tracing preempt enabling caused by the tracing | ||
| 2961 | * infrastructure itself. But as tracing can happen in areas coming | ||
| 2962 | * from userspace or just about to enter userspace, a preempt enable | ||
| 2963 | * can occur before user_exit() is called. This will cause the scheduler | ||
| 2964 | * to be called when the system is still in usermode. | ||
| 2965 | * | ||
| 2966 | * To prevent this, the preempt_enable_notrace will use this function | ||
| 2967 | * instead of preempt_schedule() to exit user context if needed before | ||
| 2968 | * calling the scheduler. | ||
| 2969 | */ | ||
| 2970 | asmlinkage __visible void __sched notrace preempt_schedule_context(void) | ||
| 2971 | { | ||
| 2972 | enum ctx_state prev_ctx; | ||
| 2973 | |||
| 2974 | if (likely(!preemptible())) | ||
| 2975 | return; | ||
| 2976 | |||
| 2977 | do { | ||
| 2978 | __preempt_count_add(PREEMPT_ACTIVE); | ||
| 2979 | /* | ||
| 2980 | * Needs preempt disabled in case user_exit() is traced | ||
| 2981 | * and the tracer calls preempt_enable_notrace() causing | ||
| 2982 | * an infinite recursion. | ||
| 2983 | */ | ||
| 2984 | prev_ctx = exception_enter(); | ||
| 2985 | __schedule(); | ||
| 2986 | exception_exit(prev_ctx); | ||
| 2987 | |||
| 2988 | __preempt_count_sub(PREEMPT_ACTIVE); | ||
| 2989 | barrier(); | ||
| 2990 | } while (need_resched()); | ||
| 2991 | } | ||
| 2992 | EXPORT_SYMBOL_GPL(preempt_schedule_context); | ||
| 2993 | #endif /* CONFIG_CONTEXT_TRACKING */ | ||
| 2994 | |||
| 2954 | #endif /* CONFIG_PREEMPT */ | 2995 | #endif /* CONFIG_PREEMPT */ |
| 2955 | 2996 | ||
| 2956 | /* | 2997 | /* |
| @@ -7833,6 +7874,11 @@ static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
| 7833 | sched_offline_group(tg); | 7874 | sched_offline_group(tg); |
| 7834 | } | 7875 | } |
| 7835 | 7876 | ||
| 7877 | static void cpu_cgroup_fork(struct task_struct *task) | ||
| 7878 | { | ||
| 7879 | sched_move_task(task); | ||
| 7880 | } | ||
| 7881 | |||
| 7836 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, | 7882 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, |
| 7837 | struct cgroup_taskset *tset) | 7883 | struct cgroup_taskset *tset) |
| 7838 | { | 7884 | { |
| @@ -8205,6 +8251,7 @@ struct cgroup_subsys cpu_cgrp_subsys = { | |||
| 8205 | .css_free = cpu_cgroup_css_free, | 8251 | .css_free = cpu_cgroup_css_free, |
| 8206 | .css_online = cpu_cgroup_css_online, | 8252 | .css_online = cpu_cgroup_css_online, |
| 8207 | .css_offline = cpu_cgroup_css_offline, | 8253 | .css_offline = cpu_cgroup_css_offline, |
| 8254 | .fork = cpu_cgroup_fork, | ||
| 8208 | .can_attach = cpu_cgroup_can_attach, | 8255 | .can_attach = cpu_cgroup_can_attach, |
| 8209 | .attach = cpu_cgroup_attach, | 8256 | .attach = cpu_cgroup_attach, |
| 8210 | .exit = cpu_cgroup_exit, | 8257 | .exit = cpu_cgroup_exit, |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 256e577faf1b..5285332392d5 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
| @@ -518,12 +518,20 @@ again: | |||
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | /* | 520 | /* |
| 521 | * We need to take care of a possible races here. In fact, the | 521 | * We need to take care of several possible races here: |
| 522 | * task might have changed its scheduling policy to something | 522 | * |
| 523 | * different from SCHED_DEADLINE or changed its reservation | 523 | * - the task might have changed its scheduling policy |
| 524 | * parameters (through sched_setattr()). | 524 | * to something different than SCHED_DEADLINE |
| 525 | * - the task might have changed its reservation parameters | ||
| 526 | * (through sched_setattr()) | ||
| 527 | * - the task might have been boosted by someone else and | ||
| 528 | * might be in the boosting/deboosting path | ||
| 529 | * | ||
| 530 | * In all this cases we bail out, as the task is already | ||
| 531 | * in the runqueue or is going to be enqueued back anyway. | ||
| 525 | */ | 532 | */ |
| 526 | if (!dl_task(p) || dl_se->dl_new) | 533 | if (!dl_task(p) || dl_se->dl_new || |
| 534 | dl_se->dl_boosted || !dl_se->dl_throttled) | ||
| 527 | goto unlock; | 535 | goto unlock; |
| 528 | 536 | ||
| 529 | sched_clock_tick(); | 537 | sched_clock_tick(); |
| @@ -532,7 +540,7 @@ again: | |||
| 532 | dl_se->dl_yielded = 0; | 540 | dl_se->dl_yielded = 0; |
| 533 | if (task_on_rq_queued(p)) { | 541 | if (task_on_rq_queued(p)) { |
| 534 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); | 542 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); |
| 535 | if (task_has_dl_policy(rq->curr)) | 543 | if (dl_task(rq->curr)) |
| 536 | check_preempt_curr_dl(rq, p, 0); | 544 | check_preempt_curr_dl(rq, p, 0); |
| 537 | else | 545 | else |
| 538 | resched_curr(rq); | 546 | resched_curr(rq); |
| @@ -847,8 +855,19 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) | |||
| 847 | * smaller than our one... OTW we keep our runtime and | 855 | * smaller than our one... OTW we keep our runtime and |
| 848 | * deadline. | 856 | * deadline. |
| 849 | */ | 857 | */ |
| 850 | if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) | 858 | if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) { |
| 851 | pi_se = &pi_task->dl; | 859 | pi_se = &pi_task->dl; |
| 860 | } else if (!dl_prio(p->normal_prio)) { | ||
| 861 | /* | ||
| 862 | * Special case in which we have a !SCHED_DEADLINE task | ||
| 863 | * that is going to be deboosted, but exceedes its | ||
| 864 | * runtime while doing so. No point in replenishing | ||
| 865 | * it, as it's going to return back to its original | ||
| 866 | * scheduling class after this. | ||
| 867 | */ | ||
| 868 | BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH); | ||
| 869 | return; | ||
| 870 | } | ||
| 852 | 871 | ||
| 853 | /* | 872 | /* |
| 854 | * If p is throttled, we do nothing. In fact, if it exhausted | 873 | * If p is throttled, we do nothing. In fact, if it exhausted |
| @@ -1607,8 +1626,12 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) | |||
| 1607 | /* Only reschedule if pushing failed */ | 1626 | /* Only reschedule if pushing failed */ |
| 1608 | check_resched = 0; | 1627 | check_resched = 0; |
| 1609 | #endif /* CONFIG_SMP */ | 1628 | #endif /* CONFIG_SMP */ |
| 1610 | if (check_resched && task_has_dl_policy(rq->curr)) | 1629 | if (check_resched) { |
| 1611 | check_preempt_curr_dl(rq, p, 0); | 1630 | if (dl_task(rq->curr)) |
| 1631 | check_preempt_curr_dl(rq, p, 0); | ||
| 1632 | else | ||
| 1633 | resched_curr(rq); | ||
| 1634 | } | ||
| 1612 | } | 1635 | } |
| 1613 | } | 1636 | } |
| 1614 | 1637 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf3e708..34baa60f8a7b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -828,11 +828,12 @@ static unsigned int task_nr_scan_windows(struct task_struct *p) | |||
| 828 | 828 | ||
| 829 | static unsigned int task_scan_min(struct task_struct *p) | 829 | static unsigned int task_scan_min(struct task_struct *p) |
| 830 | { | 830 | { |
| 831 | unsigned int scan_size = ACCESS_ONCE(sysctl_numa_balancing_scan_size); | ||
| 831 | unsigned int scan, floor; | 832 | unsigned int scan, floor; |
| 832 | unsigned int windows = 1; | 833 | unsigned int windows = 1; |
| 833 | 834 | ||
| 834 | if (sysctl_numa_balancing_scan_size < MAX_SCAN_WINDOW) | 835 | if (scan_size < MAX_SCAN_WINDOW) |
| 835 | windows = MAX_SCAN_WINDOW / sysctl_numa_balancing_scan_size; | 836 | windows = MAX_SCAN_WINDOW / scan_size; |
| 836 | floor = 1000 / windows; | 837 | floor = 1000 / windows; |
| 837 | 838 | ||
| 838 | scan = sysctl_numa_balancing_scan_period_min / task_nr_scan_windows(p); | 839 | scan = sysctl_numa_balancing_scan_period_min / task_nr_scan_windows(p); |
| @@ -1164,9 +1165,19 @@ static void task_numa_compare(struct task_numa_env *env, | |||
| 1164 | long moveimp = imp; | 1165 | long moveimp = imp; |
| 1165 | 1166 | ||
| 1166 | rcu_read_lock(); | 1167 | rcu_read_lock(); |
| 1167 | cur = ACCESS_ONCE(dst_rq->curr); | 1168 | |
| 1168 | if (cur->pid == 0) /* idle */ | 1169 | raw_spin_lock_irq(&dst_rq->lock); |
| 1170 | cur = dst_rq->curr; | ||
| 1171 | /* | ||
| 1172 | * No need to move the exiting task, and this ensures that ->curr | ||
| 1173 | * wasn't reaped and thus get_task_struct() in task_numa_assign() | ||
| 1174 | * is safe under RCU read lock. | ||
| 1175 | * Note that rcu_read_lock() itself can't protect from the final | ||
| 1176 | * put_task_struct() after the last schedule(). | ||
| 1177 | */ | ||
| 1178 | if ((cur->flags & PF_EXITING) || is_idle_task(cur)) | ||
| 1169 | cur = NULL; | 1179 | cur = NULL; |
| 1180 | raw_spin_unlock_irq(&dst_rq->lock); | ||
| 1170 | 1181 | ||
| 1171 | /* | 1182 | /* |
| 1172 | * "imp" is the fault differential for the source task between the | 1183 | * "imp" is the fault differential for the source task between the |
| @@ -1520,7 +1531,7 @@ static void update_task_scan_period(struct task_struct *p, | |||
| 1520 | * scanning faster if shared accesses dominate as it may | 1531 | * scanning faster if shared accesses dominate as it may |
| 1521 | * simply bounce migrations uselessly | 1532 | * simply bounce migrations uselessly |
| 1522 | */ | 1533 | */ |
| 1523 | ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared)); | 1534 | ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared + 1)); |
| 1524 | diff = (diff * ratio) / NUMA_PERIOD_SLOTS; | 1535 | diff = (diff * ratio) / NUMA_PERIOD_SLOTS; |
| 1525 | } | 1536 | } |
| 1526 | 1537 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 4aada6d9fe74..15f2511a1b7c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -387,7 +387,8 @@ static struct ctl_table kern_table[] = { | |||
| 387 | .data = &sysctl_numa_balancing_scan_size, | 387 | .data = &sysctl_numa_balancing_scan_size, |
| 388 | .maxlen = sizeof(unsigned int), | 388 | .maxlen = sizeof(unsigned int), |
| 389 | .mode = 0644, | 389 | .mode = 0644, |
| 390 | .proc_handler = proc_dointvec, | 390 | .proc_handler = proc_dointvec_minmax, |
| 391 | .extra1 = &one, | ||
| 391 | }, | 392 | }, |
| 392 | { | 393 | { |
| 393 | .procname = "numa_balancing", | 394 | .procname = "numa_balancing", |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 9c94c19f1305..55449909f114 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
| @@ -72,7 +72,7 @@ static u64 cev_delta2ns(unsigned long latch, struct clock_event_device *evt, | |||
| 72 | * Also omit the add if it would overflow the u64 boundary. | 72 | * Also omit the add if it would overflow the u64 boundary. |
| 73 | */ | 73 | */ |
| 74 | if ((~0ULL - clc > rnd) && | 74 | if ((~0ULL - clc > rnd) && |
| 75 | (!ismax || evt->mult <= (1U << evt->shift))) | 75 | (!ismax || evt->mult <= (1ULL << evt->shift))) |
| 76 | clc += rnd; | 76 | clc += rnd; |
| 77 | 77 | ||
| 78 | do_div(clc, evt->mult); | 78 | do_div(clc, evt->mult); |
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 42b463ad90f2..31ea01f42e1f 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c | |||
| @@ -636,6 +636,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
| 636 | goto out; | 636 | goto out; |
| 637 | } | 637 | } |
| 638 | } else { | 638 | } else { |
| 639 | memset(&event.sigev_value, 0, sizeof(event.sigev_value)); | ||
| 639 | event.sigev_notify = SIGEV_SIGNAL; | 640 | event.sigev_notify = SIGEV_SIGNAL; |
| 640 | event.sigev_signo = SIGALRM; | 641 | event.sigev_signo = SIGALRM; |
| 641 | event.sigev_value.sival_int = new_timer->it_id; | 642 | event.sigev_value.sival_int = new_timer->it_id; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index fb186b9ddf51..31c90fec4158 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -1925,8 +1925,16 @@ ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec) | |||
| 1925 | * when we are adding another op to the rec or removing the | 1925 | * when we are adding another op to the rec or removing the |
| 1926 | * current one. Thus, if the op is being added, we can | 1926 | * current one. Thus, if the op is being added, we can |
| 1927 | * ignore it because it hasn't attached itself to the rec | 1927 | * ignore it because it hasn't attached itself to the rec |
| 1928 | * yet. That means we just need to find the op that has a | 1928 | * yet. |
| 1929 | * trampoline and is not beeing added. | 1929 | * |
| 1930 | * If an ops is being modified (hooking to different functions) | ||
| 1931 | * then we don't care about the new functions that are being | ||
| 1932 | * added, just the old ones (that are probably being removed). | ||
| 1933 | * | ||
| 1934 | * If we are adding an ops to a function that already is using | ||
| 1935 | * a trampoline, it needs to be removed (trampolines are only | ||
| 1936 | * for single ops connected), then an ops that is not being | ||
| 1937 | * modified also needs to be checked. | ||
| 1930 | */ | 1938 | */ |
| 1931 | do_for_each_ftrace_op(op, ftrace_ops_list) { | 1939 | do_for_each_ftrace_op(op, ftrace_ops_list) { |
| 1932 | 1940 | ||
| @@ -1940,17 +1948,23 @@ ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec) | |||
| 1940 | if (op->flags & FTRACE_OPS_FL_ADDING) | 1948 | if (op->flags & FTRACE_OPS_FL_ADDING) |
| 1941 | continue; | 1949 | continue; |
| 1942 | 1950 | ||
| 1951 | |||
| 1943 | /* | 1952 | /* |
| 1944 | * If the ops is not being added and has a trampoline, | 1953 | * If the ops is being modified and is in the old |
| 1945 | * then it must be the one that we want! | 1954 | * hash, then it is probably being removed from this |
| 1955 | * function. | ||
| 1946 | */ | 1956 | */ |
| 1947 | if (hash_contains_ip(ip, op->func_hash)) | ||
| 1948 | return op; | ||
| 1949 | |||
| 1950 | /* If the ops is being modified, it may be in the old hash. */ | ||
| 1951 | if ((op->flags & FTRACE_OPS_FL_MODIFYING) && | 1957 | if ((op->flags & FTRACE_OPS_FL_MODIFYING) && |
| 1952 | hash_contains_ip(ip, &op->old_hash)) | 1958 | hash_contains_ip(ip, &op->old_hash)) |
| 1953 | return op; | 1959 | return op; |
| 1960 | /* | ||
| 1961 | * If the ops is not being added or modified, and it's | ||
| 1962 | * in its normal filter hash, then this must be the one | ||
| 1963 | * we want! | ||
| 1964 | */ | ||
| 1965 | if (!(op->flags & FTRACE_OPS_FL_MODIFYING) && | ||
| 1966 | hash_contains_ip(ip, op->func_hash)) | ||
| 1967 | return op; | ||
| 1954 | 1968 | ||
| 1955 | } while_for_each_ftrace_op(op); | 1969 | } while_for_each_ftrace_op(op); |
| 1956 | 1970 | ||
| @@ -2293,10 +2307,13 @@ static void ftrace_run_update_code(int command) | |||
| 2293 | FTRACE_WARN_ON(ret); | 2307 | FTRACE_WARN_ON(ret); |
| 2294 | } | 2308 | } |
| 2295 | 2309 | ||
| 2296 | static void ftrace_run_modify_code(struct ftrace_ops *ops, int command) | 2310 | static void ftrace_run_modify_code(struct ftrace_ops *ops, int command, |
| 2311 | struct ftrace_hash *old_hash) | ||
| 2297 | { | 2312 | { |
| 2298 | ops->flags |= FTRACE_OPS_FL_MODIFYING; | 2313 | ops->flags |= FTRACE_OPS_FL_MODIFYING; |
| 2314 | ops->old_hash.filter_hash = old_hash; | ||
| 2299 | ftrace_run_update_code(command); | 2315 | ftrace_run_update_code(command); |
| 2316 | ops->old_hash.filter_hash = NULL; | ||
| 2300 | ops->flags &= ~FTRACE_OPS_FL_MODIFYING; | 2317 | ops->flags &= ~FTRACE_OPS_FL_MODIFYING; |
| 2301 | } | 2318 | } |
| 2302 | 2319 | ||
| @@ -3340,7 +3357,7 @@ static struct ftrace_ops trace_probe_ops __read_mostly = | |||
| 3340 | 3357 | ||
| 3341 | static int ftrace_probe_registered; | 3358 | static int ftrace_probe_registered; |
| 3342 | 3359 | ||
| 3343 | static void __enable_ftrace_function_probe(void) | 3360 | static void __enable_ftrace_function_probe(struct ftrace_hash *old_hash) |
| 3344 | { | 3361 | { |
| 3345 | int ret; | 3362 | int ret; |
| 3346 | int i; | 3363 | int i; |
| @@ -3348,7 +3365,8 @@ static void __enable_ftrace_function_probe(void) | |||
| 3348 | if (ftrace_probe_registered) { | 3365 | if (ftrace_probe_registered) { |
| 3349 | /* still need to update the function call sites */ | 3366 | /* still need to update the function call sites */ |
| 3350 | if (ftrace_enabled) | 3367 | if (ftrace_enabled) |
| 3351 | ftrace_run_modify_code(&trace_probe_ops, FTRACE_UPDATE_CALLS); | 3368 | ftrace_run_modify_code(&trace_probe_ops, FTRACE_UPDATE_CALLS, |
| 3369 | old_hash); | ||
| 3352 | return; | 3370 | return; |
| 3353 | } | 3371 | } |
| 3354 | 3372 | ||
| @@ -3477,13 +3495,14 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
| 3477 | } while_for_each_ftrace_rec(); | 3495 | } while_for_each_ftrace_rec(); |
| 3478 | 3496 | ||
| 3479 | ret = ftrace_hash_move(&trace_probe_ops, 1, orig_hash, hash); | 3497 | ret = ftrace_hash_move(&trace_probe_ops, 1, orig_hash, hash); |
| 3498 | |||
| 3499 | __enable_ftrace_function_probe(old_hash); | ||
| 3500 | |||
| 3480 | if (!ret) | 3501 | if (!ret) |
| 3481 | free_ftrace_hash_rcu(old_hash); | 3502 | free_ftrace_hash_rcu(old_hash); |
| 3482 | else | 3503 | else |
| 3483 | count = ret; | 3504 | count = ret; |
| 3484 | 3505 | ||
| 3485 | __enable_ftrace_function_probe(); | ||
| 3486 | |||
| 3487 | out_unlock: | 3506 | out_unlock: |
| 3488 | mutex_unlock(&ftrace_lock); | 3507 | mutex_unlock(&ftrace_lock); |
| 3489 | out: | 3508 | out: |
| @@ -3764,10 +3783,11 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) | |||
| 3764 | return add_hash_entry(hash, ip); | 3783 | return add_hash_entry(hash, ip); |
| 3765 | } | 3784 | } |
| 3766 | 3785 | ||
| 3767 | static void ftrace_ops_update_code(struct ftrace_ops *ops) | 3786 | static void ftrace_ops_update_code(struct ftrace_ops *ops, |
| 3787 | struct ftrace_hash *old_hash) | ||
| 3768 | { | 3788 | { |
| 3769 | if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) | 3789 | if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) |
| 3770 | ftrace_run_modify_code(ops, FTRACE_UPDATE_CALLS); | 3790 | ftrace_run_modify_code(ops, FTRACE_UPDATE_CALLS, old_hash); |
| 3771 | } | 3791 | } |
| 3772 | 3792 | ||
| 3773 | static int | 3793 | static int |
| @@ -3813,7 +3833,7 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
| 3813 | old_hash = *orig_hash; | 3833 | old_hash = *orig_hash; |
| 3814 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3834 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
| 3815 | if (!ret) { | 3835 | if (!ret) { |
| 3816 | ftrace_ops_update_code(ops); | 3836 | ftrace_ops_update_code(ops, old_hash); |
| 3817 | free_ftrace_hash_rcu(old_hash); | 3837 | free_ftrace_hash_rcu(old_hash); |
| 3818 | } | 3838 | } |
| 3819 | mutex_unlock(&ftrace_lock); | 3839 | mutex_unlock(&ftrace_lock); |
| @@ -4058,7 +4078,7 @@ int ftrace_regex_release(struct inode *inode, struct file *file) | |||
| 4058 | ret = ftrace_hash_move(iter->ops, filter_hash, | 4078 | ret = ftrace_hash_move(iter->ops, filter_hash, |
| 4059 | orig_hash, iter->hash); | 4079 | orig_hash, iter->hash); |
| 4060 | if (!ret) { | 4080 | if (!ret) { |
| 4061 | ftrace_ops_update_code(iter->ops); | 4081 | ftrace_ops_update_code(iter->ops, old_hash); |
| 4062 | free_ftrace_hash_rcu(old_hash); | 4082 | free_ftrace_hash_rcu(old_hash); |
| 4063 | } | 4083 | } |
| 4064 | mutex_unlock(&ftrace_lock); | 4084 | mutex_unlock(&ftrace_lock); |
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 4dc8b79c5f75..29228c4d5696 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
| @@ -313,7 +313,7 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) | |||
| 313 | int size; | 313 | int size; |
| 314 | 314 | ||
| 315 | syscall_nr = trace_get_syscall_nr(current, regs); | 315 | syscall_nr = trace_get_syscall_nr(current, regs); |
| 316 | if (syscall_nr < 0) | 316 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
| 317 | return; | 317 | return; |
| 318 | 318 | ||
| 319 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE) */ | 319 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE) */ |
| @@ -360,7 +360,7 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret) | |||
| 360 | int syscall_nr; | 360 | int syscall_nr; |
| 361 | 361 | ||
| 362 | syscall_nr = trace_get_syscall_nr(current, regs); | 362 | syscall_nr = trace_get_syscall_nr(current, regs); |
| 363 | if (syscall_nr < 0) | 363 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
| 364 | return; | 364 | return; |
| 365 | 365 | ||
| 366 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */ | 366 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */ |
| @@ -567,7 +567,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) | |||
| 567 | int size; | 567 | int size; |
| 568 | 568 | ||
| 569 | syscall_nr = trace_get_syscall_nr(current, regs); | 569 | syscall_nr = trace_get_syscall_nr(current, regs); |
| 570 | if (syscall_nr < 0) | 570 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
| 571 | return; | 571 | return; |
| 572 | if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) | 572 | if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) |
| 573 | return; | 573 | return; |
| @@ -641,7 +641,7 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) | |||
| 641 | int size; | 641 | int size; |
| 642 | 642 | ||
| 643 | syscall_nr = trace_get_syscall_nr(current, regs); | 643 | syscall_nr = trace_get_syscall_nr(current, regs); |
| 644 | if (syscall_nr < 0) | 644 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
| 645 | return; | 645 | return; |
| 646 | if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) | 646 | if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) |
| 647 | return; | 647 | return; |
diff --git a/lib/bitmap.c b/lib/bitmap.c index cd250a2e14cb..b499ab6ada29 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
| @@ -131,7 +131,9 @@ void __bitmap_shift_right(unsigned long *dst, | |||
| 131 | lower = src[off + k]; | 131 | lower = src[off + k]; |
| 132 | if (left && off + k == lim - 1) | 132 | if (left && off + k == lim - 1) |
| 133 | lower &= mask; | 133 | lower &= mask; |
| 134 | dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; | 134 | dst[k] = lower >> rem; |
| 135 | if (rem) | ||
| 136 | dst[k] |= upper << (BITS_PER_LONG - rem); | ||
| 135 | if (left && k == lim - 1) | 137 | if (left && k == lim - 1) |
| 136 | dst[k] &= mask; | 138 | dst[k] &= mask; |
| 137 | } | 139 | } |
| @@ -172,7 +174,9 @@ void __bitmap_shift_left(unsigned long *dst, | |||
| 172 | upper = src[k]; | 174 | upper = src[k]; |
| 173 | if (left && k == lim - 1) | 175 | if (left && k == lim - 1) |
| 174 | upper &= (1UL << left) - 1; | 176 | upper &= (1UL << left) - 1; |
| 175 | dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; | 177 | dst[k + off] = upper << rem; |
| 178 | if (rem) | ||
| 179 | dst[k + off] |= lower >> (BITS_PER_LONG - rem); | ||
| 176 | if (left && k + off == lim - 1) | 180 | if (left && k + off == lim - 1) |
| 177 | dst[k + off] &= (1UL << left) - 1; | 181 | dst[k + off] &= (1UL << left) - 1; |
| 178 | } | 182 | } |
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 9cdf62f8accd..c9f2e8c6ccc9 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
| @@ -203,10 +203,10 @@ void __sg_free_table(struct sg_table *table, unsigned int max_ents, | |||
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | table->orig_nents -= sg_size; | 205 | table->orig_nents -= sg_size; |
| 206 | if (!skip_first_chunk) { | 206 | if (skip_first_chunk) |
| 207 | free_fn(sgl, alloc_size); | ||
| 208 | skip_first_chunk = false; | 207 | skip_first_chunk = false; |
| 209 | } | 208 | else |
| 209 | free_fn(sgl, alloc_size); | ||
| 210 | sgl = next; | 210 | sgl = next; |
| 211 | } | 211 | } |
| 212 | 212 | ||
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c index b3cbe19f71b5..fcad8322ef36 100644 --- a/mm/balloon_compaction.c +++ b/mm/balloon_compaction.c | |||
| @@ -68,11 +68,13 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) | |||
| 68 | * to be released by the balloon driver. | 68 | * to be released by the balloon driver. |
| 69 | */ | 69 | */ |
| 70 | if (trylock_page(page)) { | 70 | if (trylock_page(page)) { |
| 71 | #ifdef CONFIG_BALLOON_COMPACTION | ||
| 71 | if (!PagePrivate(page)) { | 72 | if (!PagePrivate(page)) { |
| 72 | /* raced with isolation */ | 73 | /* raced with isolation */ |
| 73 | unlock_page(page); | 74 | unlock_page(page); |
| 74 | continue; | 75 | continue; |
| 75 | } | 76 | } |
| 77 | #endif | ||
| 76 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); | 78 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); |
| 77 | balloon_page_delete(page); | 79 | balloon_page_delete(page); |
| 78 | __count_vm_event(BALLOON_DEFLATE); | 80 | __count_vm_event(BALLOON_DEFLATE); |
diff --git a/mm/compaction.c b/mm/compaction.c index edba18aed173..ec74cf0123ef 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
| @@ -784,6 +784,9 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, | |||
| 784 | cc->nr_migratepages = 0; | 784 | cc->nr_migratepages = 0; |
| 785 | break; | 785 | break; |
| 786 | } | 786 | } |
| 787 | |||
| 788 | if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) | ||
| 789 | break; | ||
| 787 | } | 790 | } |
| 788 | acct_isolated(cc->zone, cc); | 791 | acct_isolated(cc->zone, cc); |
| 789 | 792 | ||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 74c78aa8bc2f..de984159cf0b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -200,7 +200,7 @@ retry: | |||
| 200 | preempt_disable(); | 200 | preempt_disable(); |
| 201 | if (cmpxchg(&huge_zero_page, NULL, zero_page)) { | 201 | if (cmpxchg(&huge_zero_page, NULL, zero_page)) { |
| 202 | preempt_enable(); | 202 | preempt_enable(); |
| 203 | __free_page(zero_page); | 203 | __free_pages(zero_page, compound_order(zero_page)); |
| 204 | goto retry; | 204 | goto retry; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| @@ -232,7 +232,7 @@ static unsigned long shrink_huge_zero_page_scan(struct shrinker *shrink, | |||
| 232 | if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) { | 232 | if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) { |
| 233 | struct page *zero_page = xchg(&huge_zero_page, NULL); | 233 | struct page *zero_page = xchg(&huge_zero_page, NULL); |
| 234 | BUG_ON(zero_page == NULL); | 234 | BUG_ON(zero_page == NULL); |
| 235 | __free_page(zero_page); | 235 | __free_pages(zero_page, compound_order(zero_page)); |
| 236 | return HPAGE_PMD_NR; | 236 | return HPAGE_PMD_NR; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| @@ -803,7 +803,7 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 803 | return VM_FAULT_FALLBACK; | 803 | return VM_FAULT_FALLBACK; |
| 804 | if (unlikely(anon_vma_prepare(vma))) | 804 | if (unlikely(anon_vma_prepare(vma))) |
| 805 | return VM_FAULT_OOM; | 805 | return VM_FAULT_OOM; |
| 806 | if (unlikely(khugepaged_enter(vma))) | 806 | if (unlikely(khugepaged_enter(vma, vma->vm_flags))) |
| 807 | return VM_FAULT_OOM; | 807 | return VM_FAULT_OOM; |
| 808 | if (!(flags & FAULT_FLAG_WRITE) && | 808 | if (!(flags & FAULT_FLAG_WRITE) && |
| 809 | transparent_hugepage_use_zero_page()) { | 809 | transparent_hugepage_use_zero_page()) { |
| @@ -1970,7 +1970,7 @@ int hugepage_madvise(struct vm_area_struct *vma, | |||
| 1970 | * register it here without waiting a page fault that | 1970 | * register it here without waiting a page fault that |
| 1971 | * may not happen any time soon. | 1971 | * may not happen any time soon. |
| 1972 | */ | 1972 | */ |
| 1973 | if (unlikely(khugepaged_enter_vma_merge(vma))) | 1973 | if (unlikely(khugepaged_enter_vma_merge(vma, *vm_flags))) |
| 1974 | return -ENOMEM; | 1974 | return -ENOMEM; |
| 1975 | break; | 1975 | break; |
| 1976 | case MADV_NOHUGEPAGE: | 1976 | case MADV_NOHUGEPAGE: |
| @@ -2071,7 +2071,8 @@ int __khugepaged_enter(struct mm_struct *mm) | |||
| 2071 | return 0; | 2071 | return 0; |
| 2072 | } | 2072 | } |
| 2073 | 2073 | ||
| 2074 | int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | 2074 | int khugepaged_enter_vma_merge(struct vm_area_struct *vma, |
| 2075 | unsigned long vm_flags) | ||
| 2075 | { | 2076 | { |
| 2076 | unsigned long hstart, hend; | 2077 | unsigned long hstart, hend; |
| 2077 | if (!vma->anon_vma) | 2078 | if (!vma->anon_vma) |
| @@ -2083,11 +2084,11 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | |||
| 2083 | if (vma->vm_ops) | 2084 | if (vma->vm_ops) |
| 2084 | /* khugepaged not yet working on file or special mappings */ | 2085 | /* khugepaged not yet working on file or special mappings */ |
| 2085 | return 0; | 2086 | return 0; |
| 2086 | VM_BUG_ON_VMA(vma->vm_flags & VM_NO_THP, vma); | 2087 | VM_BUG_ON_VMA(vm_flags & VM_NO_THP, vma); |
| 2087 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; | 2088 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; |
| 2088 | hend = vma->vm_end & HPAGE_PMD_MASK; | 2089 | hend = vma->vm_end & HPAGE_PMD_MASK; |
| 2089 | if (hstart < hend) | 2090 | if (hstart < hend) |
| 2090 | return khugepaged_enter(vma); | 2091 | return khugepaged_enter(vma, vm_flags); |
| 2091 | return 0; | 2092 | return 0; |
| 2092 | } | 2093 | } |
| 2093 | 2094 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 23976fd885fd..d6ac0e33e150 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -1536,12 +1536,8 @@ int mem_cgroup_swappiness(struct mem_cgroup *memcg) | |||
| 1536 | * start move here. | 1536 | * start move here. |
| 1537 | */ | 1537 | */ |
| 1538 | 1538 | ||
| 1539 | /* for quick checking without looking up memcg */ | ||
| 1540 | atomic_t memcg_moving __read_mostly; | ||
| 1541 | |||
| 1542 | static void mem_cgroup_start_move(struct mem_cgroup *memcg) | 1539 | static void mem_cgroup_start_move(struct mem_cgroup *memcg) |
| 1543 | { | 1540 | { |
| 1544 | atomic_inc(&memcg_moving); | ||
| 1545 | atomic_inc(&memcg->moving_account); | 1541 | atomic_inc(&memcg->moving_account); |
| 1546 | synchronize_rcu(); | 1542 | synchronize_rcu(); |
| 1547 | } | 1543 | } |
| @@ -1552,10 +1548,8 @@ static void mem_cgroup_end_move(struct mem_cgroup *memcg) | |||
| 1552 | * Now, mem_cgroup_clear_mc() may call this function with NULL. | 1548 | * Now, mem_cgroup_clear_mc() may call this function with NULL. |
| 1553 | * We check NULL in callee rather than caller. | 1549 | * We check NULL in callee rather than caller. |
| 1554 | */ | 1550 | */ |
| 1555 | if (memcg) { | 1551 | if (memcg) |
| 1556 | atomic_dec(&memcg_moving); | ||
| 1557 | atomic_dec(&memcg->moving_account); | 1552 | atomic_dec(&memcg->moving_account); |
| 1558 | } | ||
| 1559 | } | 1553 | } |
| 1560 | 1554 | ||
| 1561 | /* | 1555 | /* |
| @@ -2204,41 +2198,52 @@ cleanup: | |||
| 2204 | return true; | 2198 | return true; |
| 2205 | } | 2199 | } |
| 2206 | 2200 | ||
| 2207 | /* | 2201 | /** |
| 2208 | * Used to update mapped file or writeback or other statistics. | 2202 | * mem_cgroup_begin_page_stat - begin a page state statistics transaction |
| 2203 | * @page: page that is going to change accounted state | ||
| 2204 | * @locked: &memcg->move_lock slowpath was taken | ||
| 2205 | * @flags: IRQ-state flags for &memcg->move_lock | ||
| 2209 | * | 2206 | * |
| 2210 | * Notes: Race condition | 2207 | * This function must mark the beginning of an accounted page state |
| 2208 | * change to prevent double accounting when the page is concurrently | ||
| 2209 | * being moved to another memcg: | ||
| 2211 | * | 2210 | * |
| 2212 | * Charging occurs during page instantiation, while the page is | 2211 | * memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); |
| 2213 | * unmapped and locked in page migration, or while the page table is | 2212 | * if (TestClearPageState(page)) |
| 2214 | * locked in THP migration. No race is possible. | 2213 | * mem_cgroup_update_page_stat(memcg, state, -1); |
| 2214 | * mem_cgroup_end_page_stat(memcg, locked, flags); | ||
| 2215 | * | 2215 | * |
| 2216 | * Uncharge happens to pages with zero references, no race possible. | 2216 | * The RCU lock is held throughout the transaction. The fast path can |
| 2217 | * get away without acquiring the memcg->move_lock (@locked is false) | ||
| 2218 | * because page moving starts with an RCU grace period. | ||
| 2217 | * | 2219 | * |
| 2218 | * Charge moving between groups is protected by checking mm->moving | 2220 | * The RCU lock also protects the memcg from being freed when the page |
| 2219 | * account and taking the move_lock in the slowpath. | 2221 | * state that is going to change is the only thing preventing the page |
| 2222 | * from being uncharged. E.g. end-writeback clearing PageWriteback(), | ||
| 2223 | * which allows migration to go ahead and uncharge the page before the | ||
| 2224 | * account transaction might be complete. | ||
| 2220 | */ | 2225 | */ |
| 2221 | 2226 | struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, | |
| 2222 | void __mem_cgroup_begin_update_page_stat(struct page *page, | 2227 | bool *locked, |
| 2223 | bool *locked, unsigned long *flags) | 2228 | unsigned long *flags) |
| 2224 | { | 2229 | { |
| 2225 | struct mem_cgroup *memcg; | 2230 | struct mem_cgroup *memcg; |
| 2226 | struct page_cgroup *pc; | 2231 | struct page_cgroup *pc; |
| 2227 | 2232 | ||
| 2233 | rcu_read_lock(); | ||
| 2234 | |||
| 2235 | if (mem_cgroup_disabled()) | ||
| 2236 | return NULL; | ||
| 2237 | |||
| 2228 | pc = lookup_page_cgroup(page); | 2238 | pc = lookup_page_cgroup(page); |
| 2229 | again: | 2239 | again: |
| 2230 | memcg = pc->mem_cgroup; | 2240 | memcg = pc->mem_cgroup; |
| 2231 | if (unlikely(!memcg || !PageCgroupUsed(pc))) | 2241 | if (unlikely(!memcg || !PageCgroupUsed(pc))) |
| 2232 | return; | 2242 | return NULL; |
| 2233 | /* | 2243 | |
| 2234 | * If this memory cgroup is not under account moving, we don't | 2244 | *locked = false; |
| 2235 | * need to take move_lock_mem_cgroup(). Because we already hold | ||
| 2236 | * rcu_read_lock(), any calls to move_account will be delayed until | ||
| 2237 | * rcu_read_unlock(). | ||
| 2238 | */ | ||
| 2239 | VM_BUG_ON(!rcu_read_lock_held()); | ||
| 2240 | if (atomic_read(&memcg->moving_account) <= 0) | 2245 | if (atomic_read(&memcg->moving_account) <= 0) |
| 2241 | return; | 2246 | return memcg; |
| 2242 | 2247 | ||
| 2243 | move_lock_mem_cgroup(memcg, flags); | 2248 | move_lock_mem_cgroup(memcg, flags); |
| 2244 | if (memcg != pc->mem_cgroup || !PageCgroupUsed(pc)) { | 2249 | if (memcg != pc->mem_cgroup || !PageCgroupUsed(pc)) { |
| @@ -2246,36 +2251,40 @@ again: | |||
| 2246 | goto again; | 2251 | goto again; |
| 2247 | } | 2252 | } |
| 2248 | *locked = true; | 2253 | *locked = true; |
| 2254 | |||
| 2255 | return memcg; | ||
| 2249 | } | 2256 | } |
| 2250 | 2257 | ||
| 2251 | void __mem_cgroup_end_update_page_stat(struct page *page, unsigned long *flags) | 2258 | /** |
| 2259 | * mem_cgroup_end_page_stat - finish a page state statistics transaction | ||
| 2260 | * @memcg: the memcg that was accounted against | ||
| 2261 | * @locked: value received from mem_cgroup_begin_page_stat() | ||
| 2262 | * @flags: value received from mem_cgroup_begin_page_stat() | ||
| 2263 | */ | ||
| 2264 | void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked, | ||
| 2265 | unsigned long flags) | ||
| 2252 | { | 2266 | { |
| 2253 | struct page_cgroup *pc = lookup_page_cgroup(page); | 2267 | if (memcg && locked) |
| 2268 | move_unlock_mem_cgroup(memcg, &flags); | ||
| 2254 | 2269 | ||
| 2255 | /* | 2270 | rcu_read_unlock(); |
| 2256 | * It's guaranteed that pc->mem_cgroup never changes while | ||
| 2257 | * lock is held because a routine modifies pc->mem_cgroup | ||
| 2258 | * should take move_lock_mem_cgroup(). | ||
| 2259 | */ | ||
| 2260 | move_unlock_mem_cgroup(pc->mem_cgroup, flags); | ||
| 2261 | } | 2271 | } |
| 2262 | 2272 | ||
| 2263 | void mem_cgroup_update_page_stat(struct page *page, | 2273 | /** |
| 2274 | * mem_cgroup_update_page_stat - update page state statistics | ||
| 2275 | * @memcg: memcg to account against | ||
| 2276 | * @idx: page state item to account | ||
| 2277 | * @val: number of pages (positive or negative) | ||
| 2278 | * | ||
| 2279 | * See mem_cgroup_begin_page_stat() for locking requirements. | ||
| 2280 | */ | ||
| 2281 | void mem_cgroup_update_page_stat(struct mem_cgroup *memcg, | ||
| 2264 | enum mem_cgroup_stat_index idx, int val) | 2282 | enum mem_cgroup_stat_index idx, int val) |
| 2265 | { | 2283 | { |
| 2266 | struct mem_cgroup *memcg; | ||
| 2267 | struct page_cgroup *pc = lookup_page_cgroup(page); | ||
| 2268 | unsigned long uninitialized_var(flags); | ||
| 2269 | |||
| 2270 | if (mem_cgroup_disabled()) | ||
| 2271 | return; | ||
| 2272 | |||
| 2273 | VM_BUG_ON(!rcu_read_lock_held()); | 2284 | VM_BUG_ON(!rcu_read_lock_held()); |
| 2274 | memcg = pc->mem_cgroup; | ||
| 2275 | if (unlikely(!memcg || !PageCgroupUsed(pc))) | ||
| 2276 | return; | ||
| 2277 | 2285 | ||
| 2278 | this_cpu_add(memcg->stat->count[idx], val); | 2286 | if (memcg) |
| 2287 | this_cpu_add(memcg->stat->count[idx], val); | ||
| 2279 | } | 2288 | } |
| 2280 | 2289 | ||
| 2281 | /* | 2290 | /* |
diff --git a/mm/memory.c b/mm/memory.c index 1cc6bfbd872e..3e503831e042 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -1147,6 +1147,7 @@ again: | |||
| 1147 | print_bad_pte(vma, addr, ptent, page); | 1147 | print_bad_pte(vma, addr, ptent, page); |
| 1148 | if (unlikely(!__tlb_remove_page(tlb, page))) { | 1148 | if (unlikely(!__tlb_remove_page(tlb, page))) { |
| 1149 | force_flush = 1; | 1149 | force_flush = 1; |
| 1150 | addr += PAGE_SIZE; | ||
| 1150 | break; | 1151 | break; |
| 1151 | } | 1152 | } |
| 1152 | continue; | 1153 | continue; |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 29d8693d0c61..252e1dbbed86 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
| @@ -1912,7 +1912,6 @@ void try_offline_node(int nid) | |||
| 1912 | unsigned long start_pfn = pgdat->node_start_pfn; | 1912 | unsigned long start_pfn = pgdat->node_start_pfn; |
| 1913 | unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages; | 1913 | unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages; |
| 1914 | unsigned long pfn; | 1914 | unsigned long pfn; |
| 1915 | struct page *pgdat_page = virt_to_page(pgdat); | ||
| 1916 | int i; | 1915 | int i; |
| 1917 | 1916 | ||
| 1918 | for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { | 1917 | for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { |
| @@ -1941,10 +1940,6 @@ void try_offline_node(int nid) | |||
| 1941 | node_set_offline(nid); | 1940 | node_set_offline(nid); |
| 1942 | unregister_one_node(nid); | 1941 | unregister_one_node(nid); |
| 1943 | 1942 | ||
| 1944 | if (!PageSlab(pgdat_page) && !PageCompound(pgdat_page)) | ||
| 1945 | /* node data is allocated from boot memory */ | ||
| 1946 | return; | ||
| 1947 | |||
| 1948 | /* free waittable in each zone */ | 1943 | /* free waittable in each zone */ |
| 1949 | for (i = 0; i < MAX_NR_ZONES; i++) { | 1944 | for (i = 0; i < MAX_NR_ZONES; i++) { |
| 1950 | struct zone *zone = pgdat->node_zones + i; | 1945 | struct zone *zone = pgdat->node_zones + i; |
| @@ -1080,7 +1080,7 @@ struct vm_area_struct *vma_merge(struct mm_struct *mm, | |||
| 1080 | end, prev->vm_pgoff, NULL); | 1080 | end, prev->vm_pgoff, NULL); |
| 1081 | if (err) | 1081 | if (err) |
| 1082 | return NULL; | 1082 | return NULL; |
| 1083 | khugepaged_enter_vma_merge(prev); | 1083 | khugepaged_enter_vma_merge(prev, vm_flags); |
| 1084 | return prev; | 1084 | return prev; |
| 1085 | } | 1085 | } |
| 1086 | 1086 | ||
| @@ -1099,7 +1099,7 @@ struct vm_area_struct *vma_merge(struct mm_struct *mm, | |||
| 1099 | next->vm_pgoff - pglen, NULL); | 1099 | next->vm_pgoff - pglen, NULL); |
| 1100 | if (err) | 1100 | if (err) |
| 1101 | return NULL; | 1101 | return NULL; |
| 1102 | khugepaged_enter_vma_merge(area); | 1102 | khugepaged_enter_vma_merge(area, vm_flags); |
| 1103 | return area; | 1103 | return area; |
| 1104 | } | 1104 | } |
| 1105 | 1105 | ||
| @@ -2208,7 +2208,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) | |||
| 2208 | } | 2208 | } |
| 2209 | } | 2209 | } |
| 2210 | vma_unlock_anon_vma(vma); | 2210 | vma_unlock_anon_vma(vma); |
| 2211 | khugepaged_enter_vma_merge(vma); | 2211 | khugepaged_enter_vma_merge(vma, vma->vm_flags); |
| 2212 | validate_mm(vma->vm_mm); | 2212 | validate_mm(vma->vm_mm); |
| 2213 | return error; | 2213 | return error; |
| 2214 | } | 2214 | } |
| @@ -2277,7 +2277,7 @@ int expand_downwards(struct vm_area_struct *vma, | |||
| 2277 | } | 2277 | } |
| 2278 | } | 2278 | } |
| 2279 | vma_unlock_anon_vma(vma); | 2279 | vma_unlock_anon_vma(vma); |
| 2280 | khugepaged_enter_vma_merge(vma); | 2280 | khugepaged_enter_vma_merge(vma, vma->vm_flags); |
| 2281 | validate_mm(vma->vm_mm); | 2281 | validate_mm(vma->vm_mm); |
| 2282 | return error; | 2282 | return error; |
| 2283 | } | 2283 | } |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ff24c9d83112..19ceae87522d 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -2116,23 +2116,6 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) | |||
| 2116 | EXPORT_SYMBOL(account_page_dirtied); | 2116 | EXPORT_SYMBOL(account_page_dirtied); |
| 2117 | 2117 | ||
| 2118 | /* | 2118 | /* |
| 2119 | * Helper function for set_page_writeback family. | ||
| 2120 | * | ||
| 2121 | * The caller must hold mem_cgroup_begin/end_update_page_stat() lock | ||
| 2122 | * while calling this function. | ||
| 2123 | * See test_set_page_writeback for example. | ||
| 2124 | * | ||
| 2125 | * NOTE: Unlike account_page_dirtied this does not rely on being atomic | ||
| 2126 | * wrt interrupts. | ||
| 2127 | */ | ||
| 2128 | void account_page_writeback(struct page *page) | ||
| 2129 | { | ||
| 2130 | mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_WRITEBACK); | ||
| 2131 | inc_zone_page_state(page, NR_WRITEBACK); | ||
| 2132 | } | ||
| 2133 | EXPORT_SYMBOL(account_page_writeback); | ||
| 2134 | |||
| 2135 | /* | ||
| 2136 | * For address_spaces which do not use buffers. Just tag the page as dirty in | 2119 | * For address_spaces which do not use buffers. Just tag the page as dirty in |
| 2137 | * its radix tree. | 2120 | * its radix tree. |
| 2138 | * | 2121 | * |
| @@ -2344,11 +2327,12 @@ EXPORT_SYMBOL(clear_page_dirty_for_io); | |||
| 2344 | int test_clear_page_writeback(struct page *page) | 2327 | int test_clear_page_writeback(struct page *page) |
| 2345 | { | 2328 | { |
| 2346 | struct address_space *mapping = page_mapping(page); | 2329 | struct address_space *mapping = page_mapping(page); |
| 2347 | int ret; | ||
| 2348 | bool locked; | ||
| 2349 | unsigned long memcg_flags; | 2330 | unsigned long memcg_flags; |
| 2331 | struct mem_cgroup *memcg; | ||
| 2332 | bool locked; | ||
| 2333 | int ret; | ||
| 2350 | 2334 | ||
| 2351 | mem_cgroup_begin_update_page_stat(page, &locked, &memcg_flags); | 2335 | memcg = mem_cgroup_begin_page_stat(page, &locked, &memcg_flags); |
| 2352 | if (mapping) { | 2336 | if (mapping) { |
| 2353 | struct backing_dev_info *bdi = mapping->backing_dev_info; | 2337 | struct backing_dev_info *bdi = mapping->backing_dev_info; |
| 2354 | unsigned long flags; | 2338 | unsigned long flags; |
| @@ -2369,22 +2353,23 @@ int test_clear_page_writeback(struct page *page) | |||
| 2369 | ret = TestClearPageWriteback(page); | 2353 | ret = TestClearPageWriteback(page); |
| 2370 | } | 2354 | } |
| 2371 | if (ret) { | 2355 | if (ret) { |
| 2372 | mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_WRITEBACK); | 2356 | mem_cgroup_dec_page_stat(memcg, MEM_CGROUP_STAT_WRITEBACK); |
| 2373 | dec_zone_page_state(page, NR_WRITEBACK); | 2357 | dec_zone_page_state(page, NR_WRITEBACK); |
| 2374 | inc_zone_page_state(page, NR_WRITTEN); | 2358 | inc_zone_page_state(page, NR_WRITTEN); |
| 2375 | } | 2359 | } |
| 2376 | mem_cgroup_end_update_page_stat(page, &locked, &memcg_flags); | 2360 | mem_cgroup_end_page_stat(memcg, locked, memcg_flags); |
| 2377 | return ret; | 2361 | return ret; |
| 2378 | } | 2362 | } |
| 2379 | 2363 | ||
| 2380 | int __test_set_page_writeback(struct page *page, bool keep_write) | 2364 | int __test_set_page_writeback(struct page *page, bool keep_write) |
| 2381 | { | 2365 | { |
| 2382 | struct address_space *mapping = page_mapping(page); | 2366 | struct address_space *mapping = page_mapping(page); |
| 2383 | int ret; | ||
| 2384 | bool locked; | ||
| 2385 | unsigned long memcg_flags; | 2367 | unsigned long memcg_flags; |
| 2368 | struct mem_cgroup *memcg; | ||
| 2369 | bool locked; | ||
| 2370 | int ret; | ||
| 2386 | 2371 | ||
| 2387 | mem_cgroup_begin_update_page_stat(page, &locked, &memcg_flags); | 2372 | memcg = mem_cgroup_begin_page_stat(page, &locked, &memcg_flags); |
| 2388 | if (mapping) { | 2373 | if (mapping) { |
| 2389 | struct backing_dev_info *bdi = mapping->backing_dev_info; | 2374 | struct backing_dev_info *bdi = mapping->backing_dev_info; |
| 2390 | unsigned long flags; | 2375 | unsigned long flags; |
| @@ -2410,9 +2395,11 @@ int __test_set_page_writeback(struct page *page, bool keep_write) | |||
| 2410 | } else { | 2395 | } else { |
| 2411 | ret = TestSetPageWriteback(page); | 2396 | ret = TestSetPageWriteback(page); |
| 2412 | } | 2397 | } |
| 2413 | if (!ret) | 2398 | if (!ret) { |
| 2414 | account_page_writeback(page); | 2399 | mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_WRITEBACK); |
| 2415 | mem_cgroup_end_update_page_stat(page, &locked, &memcg_flags); | 2400 | inc_zone_page_state(page, NR_WRITEBACK); |
| 2401 | } | ||
| 2402 | mem_cgroup_end_page_stat(memcg, locked, memcg_flags); | ||
| 2416 | return ret; | 2403 | return ret; |
| 2417 | 2404 | ||
| 2418 | } | 2405 | } |
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 3708264d2833..5331c2bd85a2 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c | |||
| @@ -171,6 +171,7 @@ static void free_page_cgroup(void *addr) | |||
| 171 | sizeof(struct page_cgroup) * PAGES_PER_SECTION; | 171 | sizeof(struct page_cgroup) * PAGES_PER_SECTION; |
| 172 | 172 | ||
| 173 | BUG_ON(PageReserved(page)); | 173 | BUG_ON(PageReserved(page)); |
| 174 | kmemleak_free(addr); | ||
| 174 | free_pages_exact(addr, table_size); | 175 | free_pages_exact(addr, table_size); |
| 175 | } | 176 | } |
| 176 | } | 177 | } |
| @@ -1042,15 +1042,46 @@ void page_add_new_anon_rmap(struct page *page, | |||
| 1042 | */ | 1042 | */ |
| 1043 | void page_add_file_rmap(struct page *page) | 1043 | void page_add_file_rmap(struct page *page) |
| 1044 | { | 1044 | { |
| 1045 | bool locked; | 1045 | struct mem_cgroup *memcg; |
| 1046 | unsigned long flags; | 1046 | unsigned long flags; |
| 1047 | bool locked; | ||
| 1047 | 1048 | ||
| 1048 | mem_cgroup_begin_update_page_stat(page, &locked, &flags); | 1049 | memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); |
| 1049 | if (atomic_inc_and_test(&page->_mapcount)) { | 1050 | if (atomic_inc_and_test(&page->_mapcount)) { |
| 1050 | __inc_zone_page_state(page, NR_FILE_MAPPED); | 1051 | __inc_zone_page_state(page, NR_FILE_MAPPED); |
| 1051 | mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED); | 1052 | mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); |
| 1052 | } | 1053 | } |
| 1053 | mem_cgroup_end_update_page_stat(page, &locked, &flags); | 1054 | mem_cgroup_end_page_stat(memcg, locked, flags); |
| 1055 | } | ||
| 1056 | |||
| 1057 | static void page_remove_file_rmap(struct page *page) | ||
| 1058 | { | ||
| 1059 | struct mem_cgroup *memcg; | ||
| 1060 | unsigned long flags; | ||
| 1061 | bool locked; | ||
| 1062 | |||
| 1063 | memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); | ||
| 1064 | |||
| 1065 | /* page still mapped by someone else? */ | ||
| 1066 | if (!atomic_add_negative(-1, &page->_mapcount)) | ||
| 1067 | goto out; | ||
| 1068 | |||
| 1069 | /* Hugepages are not counted in NR_FILE_MAPPED for now. */ | ||
| 1070 | if (unlikely(PageHuge(page))) | ||
| 1071 | goto out; | ||
| 1072 | |||
| 1073 | /* | ||
| 1074 | * We use the irq-unsafe __{inc|mod}_zone_page_stat because | ||
| 1075 | * these counters are not modified in interrupt context, and | ||
| 1076 | * pte lock(a spinlock) is held, which implies preemption disabled. | ||
| 1077 | */ | ||
| 1078 | __dec_zone_page_state(page, NR_FILE_MAPPED); | ||
| 1079 | mem_cgroup_dec_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); | ||
| 1080 | |||
| 1081 | if (unlikely(PageMlocked(page))) | ||
| 1082 | clear_page_mlock(page); | ||
| 1083 | out: | ||
| 1084 | mem_cgroup_end_page_stat(memcg, locked, flags); | ||
| 1054 | } | 1085 | } |
| 1055 | 1086 | ||
| 1056 | /** | 1087 | /** |
| @@ -1061,46 +1092,33 @@ void page_add_file_rmap(struct page *page) | |||
| 1061 | */ | 1092 | */ |
| 1062 | void page_remove_rmap(struct page *page) | 1093 | void page_remove_rmap(struct page *page) |
| 1063 | { | 1094 | { |
| 1064 | bool anon = PageAnon(page); | 1095 | if (!PageAnon(page)) { |
| 1065 | bool locked; | 1096 | page_remove_file_rmap(page); |
| 1066 | unsigned long flags; | 1097 | return; |
| 1067 | 1098 | } | |
| 1068 | /* | ||
| 1069 | * The anon case has no mem_cgroup page_stat to update; but may | ||
| 1070 | * uncharge_page() below, where the lock ordering can deadlock if | ||
| 1071 | * we hold the lock against page_stat move: so avoid it on anon. | ||
| 1072 | */ | ||
| 1073 | if (!anon) | ||
| 1074 | mem_cgroup_begin_update_page_stat(page, &locked, &flags); | ||
| 1075 | 1099 | ||
| 1076 | /* page still mapped by someone else? */ | 1100 | /* page still mapped by someone else? */ |
| 1077 | if (!atomic_add_negative(-1, &page->_mapcount)) | 1101 | if (!atomic_add_negative(-1, &page->_mapcount)) |
| 1078 | goto out; | 1102 | return; |
| 1103 | |||
| 1104 | /* Hugepages are not counted in NR_ANON_PAGES for now. */ | ||
| 1105 | if (unlikely(PageHuge(page))) | ||
| 1106 | return; | ||
| 1079 | 1107 | ||
| 1080 | /* | 1108 | /* |
| 1081 | * Hugepages are not counted in NR_ANON_PAGES nor NR_FILE_MAPPED | ||
| 1082 | * and not charged by memcg for now. | ||
| 1083 | * | ||
| 1084 | * We use the irq-unsafe __{inc|mod}_zone_page_stat because | 1109 | * We use the irq-unsafe __{inc|mod}_zone_page_stat because |
| 1085 | * these counters are not modified in interrupt context, and | 1110 | * these counters are not modified in interrupt context, and |
| 1086 | * these counters are not modified in interrupt context, and | ||
| 1087 | * pte lock(a spinlock) is held, which implies preemption disabled. | 1111 | * pte lock(a spinlock) is held, which implies preemption disabled. |
| 1088 | */ | 1112 | */ |
| 1089 | if (unlikely(PageHuge(page))) | 1113 | if (PageTransHuge(page)) |
| 1090 | goto out; | 1114 | __dec_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); |
| 1091 | if (anon) { | 1115 | |
| 1092 | if (PageTransHuge(page)) | 1116 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, |
| 1093 | __dec_zone_page_state(page, | 1117 | -hpage_nr_pages(page)); |
| 1094 | NR_ANON_TRANSPARENT_HUGEPAGES); | 1118 | |
| 1095 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, | ||
| 1096 | -hpage_nr_pages(page)); | ||
| 1097 | } else { | ||
| 1098 | __dec_zone_page_state(page, NR_FILE_MAPPED); | ||
| 1099 | mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED); | ||
| 1100 | mem_cgroup_end_update_page_stat(page, &locked, &flags); | ||
| 1101 | } | ||
| 1102 | if (unlikely(PageMlocked(page))) | 1119 | if (unlikely(PageMlocked(page))) |
| 1103 | clear_page_mlock(page); | 1120 | clear_page_mlock(page); |
| 1121 | |||
| 1104 | /* | 1122 | /* |
| 1105 | * It would be tidy to reset the PageAnon mapping here, | 1123 | * It would be tidy to reset the PageAnon mapping here, |
| 1106 | * but that might overwrite a racing page_add_anon_rmap | 1124 | * but that might overwrite a racing page_add_anon_rmap |
| @@ -1110,10 +1128,6 @@ void page_remove_rmap(struct page *page) | |||
| 1110 | * Leaving it set also helps swapoff to reinstate ptes | 1128 | * Leaving it set also helps swapoff to reinstate ptes |
| 1111 | * faster for those pages still in swapcache. | 1129 | * faster for those pages still in swapcache. |
| 1112 | */ | 1130 | */ |
| 1113 | return; | ||
| 1114 | out: | ||
| 1115 | if (!anon) | ||
| 1116 | mem_cgroup_end_update_page_stat(page, &locked, &flags); | ||
| 1117 | } | 1131 | } |
| 1118 | 1132 | ||
| 1119 | /* | 1133 | /* |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 3a6e0cfdf03a..406944207b61 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
| @@ -93,16 +93,6 @@ static int kmem_cache_sanity_check(const char *name, size_t size) | |||
| 93 | s->object_size); | 93 | s->object_size); |
| 94 | continue; | 94 | continue; |
| 95 | } | 95 | } |
| 96 | |||
| 97 | #if !defined(CONFIG_SLUB) | ||
| 98 | if (!strcmp(s->name, name)) { | ||
| 99 | pr_err("%s (%s): Cache name already exists.\n", | ||
| 100 | __func__, name); | ||
| 101 | dump_stack(); | ||
| 102 | s = NULL; | ||
| 103 | return -EINVAL; | ||
| 104 | } | ||
| 105 | #endif | ||
| 106 | } | 96 | } |
| 107 | 97 | ||
| 108 | WARN_ON(strchr(name, ' ')); /* It confuses parsers */ | 98 | WARN_ON(strchr(name, ' ')); /* It confuses parsers */ |
diff --git a/net/Kconfig b/net/Kconfig index 6272420a721b..99815b5454bf 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
| @@ -6,7 +6,7 @@ menuconfig NET | |||
| 6 | bool "Networking support" | 6 | bool "Networking support" |
| 7 | select NLATTR | 7 | select NLATTR |
| 8 | select GENERIC_NET_UTILS | 8 | select GENERIC_NET_UTILS |
| 9 | select ANON_INODES | 9 | select BPF |
| 10 | ---help--- | 10 | ---help--- |
| 11 | Unless you really know what you are doing, you should say Y here. | 11 | Unless you really know what you are doing, you should say Y here. |
| 12 | The reason is that some programs need kernel networking support even | 12 | The reason is that some programs need kernel networking support even |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 992ec49a96aa..44cb786b925a 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
| @@ -112,6 +112,7 @@ void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) | |||
| 112 | 112 | ||
| 113 | kfree_skb(skb); | 113 | kfree_skb(skb); |
| 114 | } | 114 | } |
| 115 | EXPORT_SYMBOL_GPL(br_deliver); | ||
| 115 | 116 | ||
| 116 | /* called with rcu_read_lock */ | 117 | /* called with rcu_read_lock */ |
| 117 | void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) | 118 | void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 1bada53bb195..1a4f32c09ad5 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
| @@ -192,7 +192,6 @@ static inline void nf_bridge_save_header(struct sk_buff *skb) | |||
| 192 | 192 | ||
| 193 | static int br_parse_ip_options(struct sk_buff *skb) | 193 | static int br_parse_ip_options(struct sk_buff *skb) |
| 194 | { | 194 | { |
| 195 | struct ip_options *opt; | ||
| 196 | const struct iphdr *iph; | 195 | const struct iphdr *iph; |
| 197 | struct net_device *dev = skb->dev; | 196 | struct net_device *dev = skb->dev; |
| 198 | u32 len; | 197 | u32 len; |
| @@ -201,7 +200,6 @@ static int br_parse_ip_options(struct sk_buff *skb) | |||
| 201 | goto inhdr_error; | 200 | goto inhdr_error; |
| 202 | 201 | ||
| 203 | iph = ip_hdr(skb); | 202 | iph = ip_hdr(skb); |
| 204 | opt = &(IPCB(skb)->opt); | ||
| 205 | 203 | ||
| 206 | /* Basic sanity checks */ | 204 | /* Basic sanity checks */ |
| 207 | if (iph->ihl < 5 || iph->version != 4) | 205 | if (iph->ihl < 5 || iph->version != 4) |
| @@ -227,23 +225,11 @@ static int br_parse_ip_options(struct sk_buff *skb) | |||
| 227 | } | 225 | } |
| 228 | 226 | ||
| 229 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); | 227 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); |
| 230 | if (iph->ihl == 5) | 228 | /* We should really parse IP options here but until |
| 231 | return 0; | 229 | * somebody who actually uses IP options complains to |
| 232 | 230 | * us we'll just silently ignore the options because | |
| 233 | opt->optlen = iph->ihl*4 - sizeof(struct iphdr); | 231 | * we're lazy! |
| 234 | if (ip_options_compile(dev_net(dev), opt, skb)) | 232 | */ |
| 235 | goto inhdr_error; | ||
| 236 | |||
| 237 | /* Check correct handling of SRR option */ | ||
| 238 | if (unlikely(opt->srr)) { | ||
| 239 | struct in_device *in_dev = __in_dev_get_rcu(dev); | ||
| 240 | if (in_dev && !IN_DEV_SOURCE_ROUTE(in_dev)) | ||
| 241 | goto drop; | ||
| 242 | |||
| 243 | if (ip_options_rcv_srr(skb)) | ||
| 244 | goto drop; | ||
| 245 | } | ||
| 246 | |||
| 247 | return 0; | 233 | return 0; |
| 248 | 234 | ||
| 249 | inhdr_error: | 235 | inhdr_error: |
diff --git a/net/bridge/netfilter/nf_tables_bridge.c b/net/bridge/netfilter/nf_tables_bridge.c index da17a5eab8b4..074c557ab505 100644 --- a/net/bridge/netfilter/nf_tables_bridge.c +++ b/net/bridge/netfilter/nf_tables_bridge.c | |||
| @@ -75,9 +75,11 @@ static const struct nf_chain_type filter_bridge = { | |||
| 75 | .type = NFT_CHAIN_T_DEFAULT, | 75 | .type = NFT_CHAIN_T_DEFAULT, |
| 76 | .family = NFPROTO_BRIDGE, | 76 | .family = NFPROTO_BRIDGE, |
| 77 | .owner = THIS_MODULE, | 77 | .owner = THIS_MODULE, |
| 78 | .hook_mask = (1 << NF_BR_LOCAL_IN) | | 78 | .hook_mask = (1 << NF_BR_PRE_ROUTING) | |
| 79 | (1 << NF_BR_LOCAL_IN) | | ||
| 79 | (1 << NF_BR_FORWARD) | | 80 | (1 << NF_BR_FORWARD) | |
| 80 | (1 << NF_BR_LOCAL_OUT), | 81 | (1 << NF_BR_LOCAL_OUT) | |
| 82 | (1 << NF_BR_POST_ROUTING), | ||
| 81 | }; | 83 | }; |
| 82 | 84 | ||
| 83 | static int __init nf_tables_bridge_init(void) | 85 | static int __init nf_tables_bridge_init(void) |
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c index a76479535df2..654c9018e3e7 100644 --- a/net/bridge/netfilter/nft_reject_bridge.c +++ b/net/bridge/netfilter/nft_reject_bridge.c | |||
| @@ -16,6 +16,238 @@ | |||
| 16 | #include <net/netfilter/nft_reject.h> | 16 | #include <net/netfilter/nft_reject.h> |
| 17 | #include <net/netfilter/ipv4/nf_reject.h> | 17 | #include <net/netfilter/ipv4/nf_reject.h> |
| 18 | #include <net/netfilter/ipv6/nf_reject.h> | 18 | #include <net/netfilter/ipv6/nf_reject.h> |
| 19 | #include <linux/ip.h> | ||
| 20 | #include <net/ip.h> | ||
| 21 | #include <linux/netfilter_bridge.h> | ||
| 22 | #include "../br_private.h" | ||
| 23 | |||
| 24 | static void nft_reject_br_push_etherhdr(struct sk_buff *oldskb, | ||
| 25 | struct sk_buff *nskb) | ||
| 26 | { | ||
| 27 | struct ethhdr *eth; | ||
| 28 | |||
| 29 | eth = (struct ethhdr *)skb_push(nskb, ETH_HLEN); | ||
| 30 | skb_reset_mac_header(nskb); | ||
| 31 | ether_addr_copy(eth->h_source, eth_hdr(oldskb)->h_dest); | ||
| 32 | ether_addr_copy(eth->h_dest, eth_hdr(oldskb)->h_source); | ||
| 33 | eth->h_proto = eth_hdr(oldskb)->h_proto; | ||
| 34 | skb_pull(nskb, ETH_HLEN); | ||
| 35 | } | ||
| 36 | |||
| 37 | static int nft_reject_iphdr_validate(struct sk_buff *oldskb) | ||
| 38 | { | ||
| 39 | struct iphdr *iph; | ||
| 40 | u32 len; | ||
| 41 | |||
| 42 | if (!pskb_may_pull(oldskb, sizeof(struct iphdr))) | ||
| 43 | return 0; | ||
| 44 | |||
| 45 | iph = ip_hdr(oldskb); | ||
| 46 | if (iph->ihl < 5 || iph->version != 4) | ||
| 47 | return 0; | ||
| 48 | |||
| 49 | len = ntohs(iph->tot_len); | ||
| 50 | if (oldskb->len < len) | ||
| 51 | return 0; | ||
| 52 | else if (len < (iph->ihl*4)) | ||
| 53 | return 0; | ||
| 54 | |||
| 55 | if (!pskb_may_pull(oldskb, iph->ihl*4)) | ||
| 56 | return 0; | ||
| 57 | |||
| 58 | return 1; | ||
| 59 | } | ||
| 60 | |||
| 61 | static void nft_reject_br_send_v4_tcp_reset(struct sk_buff *oldskb, int hook) | ||
| 62 | { | ||
| 63 | struct sk_buff *nskb; | ||
| 64 | struct iphdr *niph; | ||
| 65 | const struct tcphdr *oth; | ||
| 66 | struct tcphdr _oth; | ||
| 67 | |||
| 68 | if (!nft_reject_iphdr_validate(oldskb)) | ||
| 69 | return; | ||
| 70 | |||
| 71 | oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook); | ||
| 72 | if (!oth) | ||
| 73 | return; | ||
| 74 | |||
| 75 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + | ||
| 76 | LL_MAX_HEADER, GFP_ATOMIC); | ||
| 77 | if (!nskb) | ||
| 78 | return; | ||
| 79 | |||
| 80 | skb_reserve(nskb, LL_MAX_HEADER); | ||
| 81 | niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, | ||
| 82 | sysctl_ip_default_ttl); | ||
| 83 | nf_reject_ip_tcphdr_put(nskb, oldskb, oth); | ||
| 84 | niph->ttl = sysctl_ip_default_ttl; | ||
| 85 | niph->tot_len = htons(nskb->len); | ||
| 86 | ip_send_check(niph); | ||
| 87 | |||
| 88 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
| 89 | |||
| 90 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
| 91 | } | ||
| 92 | |||
| 93 | static void nft_reject_br_send_v4_unreach(struct sk_buff *oldskb, int hook, | ||
| 94 | u8 code) | ||
| 95 | { | ||
| 96 | struct sk_buff *nskb; | ||
| 97 | struct iphdr *niph; | ||
| 98 | struct icmphdr *icmph; | ||
| 99 | unsigned int len; | ||
| 100 | void *payload; | ||
| 101 | __wsum csum; | ||
| 102 | |||
| 103 | if (!nft_reject_iphdr_validate(oldskb)) | ||
| 104 | return; | ||
| 105 | |||
| 106 | /* IP header checks: fragment. */ | ||
| 107 | if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) | ||
| 108 | return; | ||
| 109 | |||
| 110 | /* RFC says return as much as we can without exceeding 576 bytes. */ | ||
| 111 | len = min_t(unsigned int, 536, oldskb->len); | ||
| 112 | |||
| 113 | if (!pskb_may_pull(oldskb, len)) | ||
| 114 | return; | ||
| 115 | |||
| 116 | if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), 0)) | ||
| 117 | return; | ||
| 118 | |||
| 119 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmphdr) + | ||
| 120 | LL_MAX_HEADER + len, GFP_ATOMIC); | ||
| 121 | if (!nskb) | ||
| 122 | return; | ||
| 123 | |||
| 124 | skb_reserve(nskb, LL_MAX_HEADER); | ||
| 125 | niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_ICMP, | ||
| 126 | sysctl_ip_default_ttl); | ||
| 127 | |||
| 128 | skb_reset_transport_header(nskb); | ||
| 129 | icmph = (struct icmphdr *)skb_put(nskb, sizeof(struct icmphdr)); | ||
| 130 | memset(icmph, 0, sizeof(*icmph)); | ||
| 131 | icmph->type = ICMP_DEST_UNREACH; | ||
| 132 | icmph->code = code; | ||
| 133 | |||
| 134 | payload = skb_put(nskb, len); | ||
| 135 | memcpy(payload, skb_network_header(oldskb), len); | ||
| 136 | |||
| 137 | csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0); | ||
| 138 | icmph->checksum = csum_fold(csum); | ||
| 139 | |||
| 140 | niph->tot_len = htons(nskb->len); | ||
| 141 | ip_send_check(niph); | ||
| 142 | |||
| 143 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
| 144 | |||
| 145 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
| 146 | } | ||
| 147 | |||
| 148 | static int nft_reject_ip6hdr_validate(struct sk_buff *oldskb) | ||
| 149 | { | ||
| 150 | struct ipv6hdr *hdr; | ||
| 151 | u32 pkt_len; | ||
| 152 | |||
| 153 | if (!pskb_may_pull(oldskb, sizeof(struct ipv6hdr))) | ||
| 154 | return 0; | ||
| 155 | |||
| 156 | hdr = ipv6_hdr(oldskb); | ||
| 157 | if (hdr->version != 6) | ||
| 158 | return 0; | ||
| 159 | |||
| 160 | pkt_len = ntohs(hdr->payload_len); | ||
| 161 | if (pkt_len + sizeof(struct ipv6hdr) > oldskb->len) | ||
| 162 | return 0; | ||
| 163 | |||
| 164 | return 1; | ||
| 165 | } | ||
| 166 | |||
| 167 | static void nft_reject_br_send_v6_tcp_reset(struct net *net, | ||
| 168 | struct sk_buff *oldskb, int hook) | ||
| 169 | { | ||
| 170 | struct sk_buff *nskb; | ||
| 171 | const struct tcphdr *oth; | ||
| 172 | struct tcphdr _oth; | ||
| 173 | unsigned int otcplen; | ||
| 174 | struct ipv6hdr *nip6h; | ||
| 175 | |||
| 176 | if (!nft_reject_ip6hdr_validate(oldskb)) | ||
| 177 | return; | ||
| 178 | |||
| 179 | oth = nf_reject_ip6_tcphdr_get(oldskb, &_oth, &otcplen, hook); | ||
| 180 | if (!oth) | ||
| 181 | return; | ||
| 182 | |||
| 183 | nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct tcphdr) + | ||
| 184 | LL_MAX_HEADER, GFP_ATOMIC); | ||
| 185 | if (!nskb) | ||
| 186 | return; | ||
| 187 | |||
| 188 | skb_reserve(nskb, LL_MAX_HEADER); | ||
| 189 | nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, | ||
| 190 | net->ipv6.devconf_all->hop_limit); | ||
| 191 | nf_reject_ip6_tcphdr_put(nskb, oldskb, oth, otcplen); | ||
| 192 | nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); | ||
| 193 | |||
| 194 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
| 195 | |||
| 196 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
| 197 | } | ||
| 198 | |||
| 199 | static void nft_reject_br_send_v6_unreach(struct net *net, | ||
| 200 | struct sk_buff *oldskb, int hook, | ||
| 201 | u8 code) | ||
| 202 | { | ||
| 203 | struct sk_buff *nskb; | ||
| 204 | struct ipv6hdr *nip6h; | ||
| 205 | struct icmp6hdr *icmp6h; | ||
| 206 | unsigned int len; | ||
| 207 | void *payload; | ||
| 208 | |||
| 209 | if (!nft_reject_ip6hdr_validate(oldskb)) | ||
| 210 | return; | ||
| 211 | |||
| 212 | /* Include "As much of invoking packet as possible without the ICMPv6 | ||
| 213 | * packet exceeding the minimum IPv6 MTU" in the ICMP payload. | ||
| 214 | */ | ||
| 215 | len = min_t(unsigned int, 1220, oldskb->len); | ||
| 216 | |||
| 217 | if (!pskb_may_pull(oldskb, len)) | ||
| 218 | return; | ||
| 219 | |||
| 220 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmp6hdr) + | ||
| 221 | LL_MAX_HEADER + len, GFP_ATOMIC); | ||
| 222 | if (!nskb) | ||
| 223 | return; | ||
| 224 | |||
| 225 | skb_reserve(nskb, LL_MAX_HEADER); | ||
| 226 | nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_ICMPV6, | ||
| 227 | net->ipv6.devconf_all->hop_limit); | ||
| 228 | |||
| 229 | skb_reset_transport_header(nskb); | ||
| 230 | icmp6h = (struct icmp6hdr *)skb_put(nskb, sizeof(struct icmp6hdr)); | ||
| 231 | memset(icmp6h, 0, sizeof(*icmp6h)); | ||
| 232 | icmp6h->icmp6_type = ICMPV6_DEST_UNREACH; | ||
| 233 | icmp6h->icmp6_code = code; | ||
| 234 | |||
| 235 | payload = skb_put(nskb, len); | ||
| 236 | memcpy(payload, skb_network_header(oldskb), len); | ||
| 237 | nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); | ||
| 238 | |||
| 239 | icmp6h->icmp6_cksum = | ||
| 240 | csum_ipv6_magic(&nip6h->saddr, &nip6h->daddr, | ||
| 241 | nskb->len - sizeof(struct ipv6hdr), | ||
| 242 | IPPROTO_ICMPV6, | ||
| 243 | csum_partial(icmp6h, | ||
| 244 | nskb->len - sizeof(struct ipv6hdr), | ||
| 245 | 0)); | ||
| 246 | |||
| 247 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
| 248 | |||
| 249 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
| 250 | } | ||
| 19 | 251 | ||
| 20 | static void nft_reject_bridge_eval(const struct nft_expr *expr, | 252 | static void nft_reject_bridge_eval(const struct nft_expr *expr, |
| 21 | struct nft_data data[NFT_REG_MAX + 1], | 253 | struct nft_data data[NFT_REG_MAX + 1], |
| @@ -23,35 +255,46 @@ static void nft_reject_bridge_eval(const struct nft_expr *expr, | |||
| 23 | { | 255 | { |
| 24 | struct nft_reject *priv = nft_expr_priv(expr); | 256 | struct nft_reject *priv = nft_expr_priv(expr); |
| 25 | struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out); | 257 | struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out); |
| 258 | const unsigned char *dest = eth_hdr(pkt->skb)->h_dest; | ||
| 259 | |||
| 260 | if (is_broadcast_ether_addr(dest) || | ||
| 261 | is_multicast_ether_addr(dest)) | ||
| 262 | goto out; | ||
| 26 | 263 | ||
| 27 | switch (eth_hdr(pkt->skb)->h_proto) { | 264 | switch (eth_hdr(pkt->skb)->h_proto) { |
| 28 | case htons(ETH_P_IP): | 265 | case htons(ETH_P_IP): |
| 29 | switch (priv->type) { | 266 | switch (priv->type) { |
| 30 | case NFT_REJECT_ICMP_UNREACH: | 267 | case NFT_REJECT_ICMP_UNREACH: |
| 31 | nf_send_unreach(pkt->skb, priv->icmp_code); | 268 | nft_reject_br_send_v4_unreach(pkt->skb, |
| 269 | pkt->ops->hooknum, | ||
| 270 | priv->icmp_code); | ||
| 32 | break; | 271 | break; |
| 33 | case NFT_REJECT_TCP_RST: | 272 | case NFT_REJECT_TCP_RST: |
| 34 | nf_send_reset(pkt->skb, pkt->ops->hooknum); | 273 | nft_reject_br_send_v4_tcp_reset(pkt->skb, |
| 274 | pkt->ops->hooknum); | ||
| 35 | break; | 275 | break; |
| 36 | case NFT_REJECT_ICMPX_UNREACH: | 276 | case NFT_REJECT_ICMPX_UNREACH: |
| 37 | nf_send_unreach(pkt->skb, | 277 | nft_reject_br_send_v4_unreach(pkt->skb, |
| 38 | nft_reject_icmp_code(priv->icmp_code)); | 278 | pkt->ops->hooknum, |
| 279 | nft_reject_icmp_code(priv->icmp_code)); | ||
| 39 | break; | 280 | break; |
| 40 | } | 281 | } |
| 41 | break; | 282 | break; |
| 42 | case htons(ETH_P_IPV6): | 283 | case htons(ETH_P_IPV6): |
| 43 | switch (priv->type) { | 284 | switch (priv->type) { |
| 44 | case NFT_REJECT_ICMP_UNREACH: | 285 | case NFT_REJECT_ICMP_UNREACH: |
| 45 | nf_send_unreach6(net, pkt->skb, priv->icmp_code, | 286 | nft_reject_br_send_v6_unreach(net, pkt->skb, |
| 46 | pkt->ops->hooknum); | 287 | pkt->ops->hooknum, |
| 288 | priv->icmp_code); | ||
| 47 | break; | 289 | break; |
| 48 | case NFT_REJECT_TCP_RST: | 290 | case NFT_REJECT_TCP_RST: |
| 49 | nf_send_reset6(net, pkt->skb, pkt->ops->hooknum); | 291 | nft_reject_br_send_v6_tcp_reset(net, pkt->skb, |
| 292 | pkt->ops->hooknum); | ||
| 50 | break; | 293 | break; |
| 51 | case NFT_REJECT_ICMPX_UNREACH: | 294 | case NFT_REJECT_ICMPX_UNREACH: |
| 52 | nf_send_unreach6(net, pkt->skb, | 295 | nft_reject_br_send_v6_unreach(net, pkt->skb, |
| 53 | nft_reject_icmpv6_code(priv->icmp_code), | 296 | pkt->ops->hooknum, |
| 54 | pkt->ops->hooknum); | 297 | nft_reject_icmpv6_code(priv->icmp_code)); |
| 55 | break; | 298 | break; |
| 56 | } | 299 | } |
| 57 | break; | 300 | break; |
| @@ -59,15 +302,38 @@ static void nft_reject_bridge_eval(const struct nft_expr *expr, | |||
| 59 | /* No explicit way to reject this protocol, drop it. */ | 302 | /* No explicit way to reject this protocol, drop it. */ |
| 60 | break; | 303 | break; |
| 61 | } | 304 | } |
| 305 | out: | ||
| 62 | data[NFT_REG_VERDICT].verdict = NF_DROP; | 306 | data[NFT_REG_VERDICT].verdict = NF_DROP; |
| 63 | } | 307 | } |
| 64 | 308 | ||
| 309 | static int nft_reject_bridge_validate_hooks(const struct nft_chain *chain) | ||
| 310 | { | ||
| 311 | struct nft_base_chain *basechain; | ||
| 312 | |||
| 313 | if (chain->flags & NFT_BASE_CHAIN) { | ||
| 314 | basechain = nft_base_chain(chain); | ||
| 315 | |||
| 316 | switch (basechain->ops[0].hooknum) { | ||
| 317 | case NF_BR_PRE_ROUTING: | ||
| 318 | case NF_BR_LOCAL_IN: | ||
| 319 | break; | ||
| 320 | default: | ||
| 321 | return -EOPNOTSUPP; | ||
| 322 | } | ||
| 323 | } | ||
| 324 | return 0; | ||
| 325 | } | ||
| 326 | |||
| 65 | static int nft_reject_bridge_init(const struct nft_ctx *ctx, | 327 | static int nft_reject_bridge_init(const struct nft_ctx *ctx, |
| 66 | const struct nft_expr *expr, | 328 | const struct nft_expr *expr, |
| 67 | const struct nlattr * const tb[]) | 329 | const struct nlattr * const tb[]) |
| 68 | { | 330 | { |
| 69 | struct nft_reject *priv = nft_expr_priv(expr); | 331 | struct nft_reject *priv = nft_expr_priv(expr); |
| 70 | int icmp_code; | 332 | int icmp_code, err; |
| 333 | |||
| 334 | err = nft_reject_bridge_validate_hooks(ctx->chain); | ||
| 335 | if (err < 0) | ||
| 336 | return err; | ||
| 71 | 337 | ||
| 72 | if (tb[NFTA_REJECT_TYPE] == NULL) | 338 | if (tb[NFTA_REJECT_TYPE] == NULL) |
| 73 | return -EINVAL; | 339 | return -EINVAL; |
| @@ -116,6 +382,13 @@ nla_put_failure: | |||
| 116 | return -1; | 382 | return -1; |
| 117 | } | 383 | } |
| 118 | 384 | ||
| 385 | static int nft_reject_bridge_validate(const struct nft_ctx *ctx, | ||
| 386 | const struct nft_expr *expr, | ||
| 387 | const struct nft_data **data) | ||
| 388 | { | ||
| 389 | return nft_reject_bridge_validate_hooks(ctx->chain); | ||
| 390 | } | ||
| 391 | |||
| 119 | static struct nft_expr_type nft_reject_bridge_type; | 392 | static struct nft_expr_type nft_reject_bridge_type; |
| 120 | static const struct nft_expr_ops nft_reject_bridge_ops = { | 393 | static const struct nft_expr_ops nft_reject_bridge_ops = { |
| 121 | .type = &nft_reject_bridge_type, | 394 | .type = &nft_reject_bridge_type, |
| @@ -123,6 +396,7 @@ static const struct nft_expr_ops nft_reject_bridge_ops = { | |||
| 123 | .eval = nft_reject_bridge_eval, | 396 | .eval = nft_reject_bridge_eval, |
| 124 | .init = nft_reject_bridge_init, | 397 | .init = nft_reject_bridge_init, |
| 125 | .dump = nft_reject_bridge_dump, | 398 | .dump = nft_reject_bridge_dump, |
| 399 | .validate = nft_reject_bridge_validate, | ||
| 126 | }; | 400 | }; |
| 127 | 401 | ||
| 128 | static struct nft_expr_type nft_reject_bridge_type __read_mostly = { | 402 | static struct nft_expr_type nft_reject_bridge_type __read_mostly = { |
diff --git a/net/core/dev.c b/net/core/dev.c index b793e3521a36..945bbd001359 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
| @@ -4157,6 +4157,10 @@ EXPORT_SYMBOL(napi_gro_receive); | |||
| 4157 | 4157 | ||
| 4158 | static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) | 4158 | static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) |
| 4159 | { | 4159 | { |
| 4160 | if (unlikely(skb->pfmemalloc)) { | ||
| 4161 | consume_skb(skb); | ||
| 4162 | return; | ||
| 4163 | } | ||
| 4160 | __skb_pull(skb, skb_headlen(skb)); | 4164 | __skb_pull(skb, skb_headlen(skb)); |
| 4161 | /* restore the reserve we had after netdev_alloc_skb_ip_align() */ | 4165 | /* restore the reserve we had after netdev_alloc_skb_ip_align() */ |
| 4162 | skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); | 4166 | skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 1600aa24d36b..06dfb293e5aa 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
| @@ -1036,7 +1036,8 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) | |||
| 1036 | { | 1036 | { |
| 1037 | const struct ethtool_ops *ops = dev->ethtool_ops; | 1037 | const struct ethtool_ops *ops = dev->ethtool_ops; |
| 1038 | 1038 | ||
| 1039 | if (!ops->get_eeprom || !ops->get_eeprom_len) | 1039 | if (!ops->get_eeprom || !ops->get_eeprom_len || |
| 1040 | !ops->get_eeprom_len(dev)) | ||
| 1040 | return -EOPNOTSUPP; | 1041 | return -EOPNOTSUPP; |
| 1041 | 1042 | ||
| 1042 | return ethtool_get_any_eeprom(dev, useraddr, ops->get_eeprom, | 1043 | return ethtool_get_any_eeprom(dev, useraddr, ops->get_eeprom, |
| @@ -1052,7 +1053,8 @@ static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) | |||
| 1052 | u8 *data; | 1053 | u8 *data; |
| 1053 | int ret = 0; | 1054 | int ret = 0; |
| 1054 | 1055 | ||
| 1055 | if (!ops->set_eeprom || !ops->get_eeprom_len) | 1056 | if (!ops->set_eeprom || !ops->get_eeprom_len || |
| 1057 | !ops->get_eeprom_len(dev)) | ||
| 1056 | return -EOPNOTSUPP; | 1058 | return -EOPNOTSUPP; |
| 1057 | 1059 | ||
| 1058 | if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) | 1060 | if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 61059a05ec95..c16615bfb61e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -4070,15 +4070,22 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet); | |||
| 4070 | unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) | 4070 | unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) |
| 4071 | { | 4071 | { |
| 4072 | const struct skb_shared_info *shinfo = skb_shinfo(skb); | 4072 | const struct skb_shared_info *shinfo = skb_shinfo(skb); |
| 4073 | unsigned int thlen = 0; | ||
| 4073 | 4074 | ||
| 4074 | if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) | 4075 | if (skb->encapsulation) { |
| 4075 | return tcp_hdrlen(skb) + shinfo->gso_size; | 4076 | thlen = skb_inner_transport_header(skb) - |
| 4077 | skb_transport_header(skb); | ||
| 4076 | 4078 | ||
| 4079 | if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) | ||
| 4080 | thlen += inner_tcp_hdrlen(skb); | ||
| 4081 | } else if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) { | ||
| 4082 | thlen = tcp_hdrlen(skb); | ||
| 4083 | } | ||
| 4077 | /* UFO sets gso_size to the size of the fragmentation | 4084 | /* UFO sets gso_size to the size of the fragmentation |
| 4078 | * payload, i.e. the size of the L4 (UDP) header is already | 4085 | * payload, i.e. the size of the L4 (UDP) header is already |
| 4079 | * accounted for. | 4086 | * accounted for. |
| 4080 | */ | 4087 | */ |
| 4081 | return shinfo->gso_size; | 4088 | return thlen + shinfo->gso_size; |
| 4082 | } | 4089 | } |
| 4083 | EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); | 4090 | EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); |
| 4084 | 4091 | ||
diff --git a/net/core/tso.c b/net/core/tso.c index 8c3203c585b0..630b30b4fb53 100644 --- a/net/core/tso.c +++ b/net/core/tso.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #include <linux/export.h> | 1 | #include <linux/export.h> |
| 2 | #include <net/ip.h> | 2 | #include <net/ip.h> |
| 3 | #include <net/tso.h> | 3 | #include <net/tso.h> |
| 4 | #include <asm/unaligned.h> | ||
| 4 | 5 | ||
| 5 | /* Calculate expected number of TX descriptors */ | 6 | /* Calculate expected number of TX descriptors */ |
| 6 | int tso_count_descs(struct sk_buff *skb) | 7 | int tso_count_descs(struct sk_buff *skb) |
| @@ -23,7 +24,7 @@ void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso, | |||
| 23 | iph->id = htons(tso->ip_id); | 24 | iph->id = htons(tso->ip_id); |
| 24 | iph->tot_len = htons(size + hdr_len - mac_hdr_len); | 25 | iph->tot_len = htons(size + hdr_len - mac_hdr_len); |
| 25 | tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb)); | 26 | tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb)); |
| 26 | tcph->seq = htonl(tso->tcp_seq); | 27 | put_unaligned_be32(tso->tcp_seq, &tcph->seq); |
| 27 | tso->ip_id++; | 28 | tso->ip_id++; |
| 28 | 29 | ||
| 29 | if (!is_last) { | 30 | if (!is_last) { |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 22f34cf4cb27..6317b41c99b0 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
| @@ -174,8 +174,11 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
| 174 | dst->rcv = brcm_netdev_ops.rcv; | 174 | dst->rcv = brcm_netdev_ops.rcv; |
| 175 | break; | 175 | break; |
| 176 | #endif | 176 | #endif |
| 177 | default: | 177 | case DSA_TAG_PROTO_NONE: |
| 178 | break; | 178 | break; |
| 179 | default: | ||
| 180 | ret = -ENOPROTOOPT; | ||
| 181 | goto out; | ||
| 179 | } | 182 | } |
| 180 | 183 | ||
| 181 | dst->tag_protocol = drv->tag_protocol; | 184 | dst->tag_protocol = drv->tag_protocol; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 92db7a69f2b9..8b7fe5b03906 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
| @@ -1246,7 +1246,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
| 1246 | 1246 | ||
| 1247 | encap = SKB_GSO_CB(skb)->encap_level > 0; | 1247 | encap = SKB_GSO_CB(skb)->encap_level > 0; |
| 1248 | if (encap) | 1248 | if (encap) |
| 1249 | features = skb->dev->hw_enc_features & netif_skb_features(skb); | 1249 | features &= skb->dev->hw_enc_features; |
| 1250 | SKB_GSO_CB(skb)->encap_level += ihl; | 1250 | SKB_GSO_CB(skb)->encap_level += ihl; |
| 1251 | 1251 | ||
| 1252 | skb_reset_transport_header(skb); | 1252 | skb_reset_transport_header(skb); |
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index ccda09628de7..bb5947b0ce2d 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c | |||
| @@ -47,7 +47,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, | |||
| 47 | 47 | ||
| 48 | greh = (struct gre_base_hdr *)skb_transport_header(skb); | 48 | greh = (struct gre_base_hdr *)skb_transport_header(skb); |
| 49 | 49 | ||
| 50 | ghl = skb_inner_network_header(skb) - skb_transport_header(skb); | 50 | ghl = skb_inner_mac_header(skb) - skb_transport_header(skb); |
| 51 | if (unlikely(ghl < sizeof(*greh))) | 51 | if (unlikely(ghl < sizeof(*greh))) |
| 52 | goto out; | 52 | goto out; |
| 53 | 53 | ||
| @@ -68,7 +68,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, | |||
| 68 | skb->mac_len = skb_inner_network_offset(skb); | 68 | skb->mac_len = skb_inner_network_offset(skb); |
| 69 | 69 | ||
| 70 | /* segment inner packet. */ | 70 | /* segment inner packet. */ |
| 71 | enc_features = skb->dev->hw_enc_features & netif_skb_features(skb); | 71 | enc_features = skb->dev->hw_enc_features & features; |
| 72 | segs = skb_mac_gso_segment(skb, enc_features); | 72 | segs = skb_mac_gso_segment(skb, enc_features); |
| 73 | if (IS_ERR_OR_NULL(segs)) { | 73 | if (IS_ERR_OR_NULL(segs)) { |
| 74 | skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len); | 74 | skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len); |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 9eb89f3f0ee4..19419b60cb37 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
| @@ -146,7 +146,6 @@ evict_again: | |||
| 146 | atomic_inc(&fq->refcnt); | 146 | atomic_inc(&fq->refcnt); |
| 147 | spin_unlock(&hb->chain_lock); | 147 | spin_unlock(&hb->chain_lock); |
| 148 | del_timer_sync(&fq->timer); | 148 | del_timer_sync(&fq->timer); |
| 149 | WARN_ON(atomic_read(&fq->refcnt) != 1); | ||
| 150 | inet_frag_put(fq, f); | 149 | inet_frag_put(fq, f); |
| 151 | goto evict_again; | 150 | goto evict_again; |
| 152 | } | 151 | } |
| @@ -285,7 +284,8 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) | |||
| 285 | struct inet_frag_bucket *hb; | 284 | struct inet_frag_bucket *hb; |
| 286 | 285 | ||
| 287 | hb = get_frag_bucket_locked(fq, f); | 286 | hb = get_frag_bucket_locked(fq, f); |
| 288 | hlist_del(&fq->list); | 287 | if (!(fq->flags & INET_FRAG_EVICTED)) |
| 288 | hlist_del(&fq->list); | ||
| 289 | spin_unlock(&hb->chain_lock); | 289 | spin_unlock(&hb->chain_lock); |
| 290 | } | 290 | } |
| 291 | 291 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 88e5ef2c7f51..bc6471d4abcd 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
| @@ -231,7 +231,7 @@ static int ip_finish_output_gso(struct sk_buff *skb) | |||
| 231 | */ | 231 | */ |
| 232 | features = netif_skb_features(skb); | 232 | features = netif_skb_features(skb); |
| 233 | segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); | 233 | segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); |
| 234 | if (IS_ERR(segs)) { | 234 | if (IS_ERR_OR_NULL(segs)) { |
| 235 | kfree_skb(skb); | 235 | kfree_skb(skb); |
| 236 | return -ENOMEM; | 236 | return -ENOMEM; |
| 237 | } | 237 | } |
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c index b023b4eb1a96..1baaa83dfe5c 100644 --- a/net/ipv4/netfilter/nf_reject_ipv4.c +++ b/net/ipv4/netfilter/nf_reject_ipv4.c | |||
| @@ -6,48 +6,45 @@ | |||
| 6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/module.h> | ||
| 9 | #include <net/ip.h> | 10 | #include <net/ip.h> |
| 10 | #include <net/tcp.h> | 11 | #include <net/tcp.h> |
| 11 | #include <net/route.h> | 12 | #include <net/route.h> |
| 12 | #include <net/dst.h> | 13 | #include <net/dst.h> |
| 13 | #include <linux/netfilter_ipv4.h> | 14 | #include <linux/netfilter_ipv4.h> |
| 15 | #include <net/netfilter/ipv4/nf_reject.h> | ||
| 14 | 16 | ||
| 15 | /* Send RST reply */ | 17 | const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb, |
| 16 | void nf_send_reset(struct sk_buff *oldskb, int hook) | 18 | struct tcphdr *_oth, int hook) |
| 17 | { | 19 | { |
| 18 | struct sk_buff *nskb; | ||
| 19 | const struct iphdr *oiph; | ||
| 20 | struct iphdr *niph; | ||
| 21 | const struct tcphdr *oth; | 20 | const struct tcphdr *oth; |
| 22 | struct tcphdr _otcph, *tcph; | ||
| 23 | 21 | ||
| 24 | /* IP header checks: fragment. */ | 22 | /* IP header checks: fragment. */ |
| 25 | if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) | 23 | if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) |
| 26 | return; | 24 | return NULL; |
| 27 | 25 | ||
| 28 | oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb), | 26 | oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb), |
| 29 | sizeof(_otcph), &_otcph); | 27 | sizeof(struct tcphdr), _oth); |
| 30 | if (oth == NULL) | 28 | if (oth == NULL) |
| 31 | return; | 29 | return NULL; |
| 32 | 30 | ||
| 33 | /* No RST for RST. */ | 31 | /* No RST for RST. */ |
| 34 | if (oth->rst) | 32 | if (oth->rst) |
| 35 | return; | 33 | return NULL; |
| 36 | |||
| 37 | if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) | ||
| 38 | return; | ||
| 39 | 34 | ||
| 40 | /* Check checksum */ | 35 | /* Check checksum */ |
| 41 | if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP)) | 36 | if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP)) |
| 42 | return; | 37 | return NULL; |
| 43 | oiph = ip_hdr(oldskb); | ||
| 44 | 38 | ||
| 45 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + | 39 | return oth; |
| 46 | LL_MAX_HEADER, GFP_ATOMIC); | 40 | } |
| 47 | if (!nskb) | 41 | EXPORT_SYMBOL_GPL(nf_reject_ip_tcphdr_get); |
| 48 | return; | ||
| 49 | 42 | ||
| 50 | skb_reserve(nskb, LL_MAX_HEADER); | 43 | struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, |
| 44 | const struct sk_buff *oldskb, | ||
| 45 | __be16 protocol, int ttl) | ||
| 46 | { | ||
| 47 | struct iphdr *niph, *oiph = ip_hdr(oldskb); | ||
| 51 | 48 | ||
| 52 | skb_reset_network_header(nskb); | 49 | skb_reset_network_header(nskb); |
| 53 | niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); | 50 | niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); |
| @@ -56,10 +53,23 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
| 56 | niph->tos = 0; | 53 | niph->tos = 0; |
| 57 | niph->id = 0; | 54 | niph->id = 0; |
| 58 | niph->frag_off = htons(IP_DF); | 55 | niph->frag_off = htons(IP_DF); |
| 59 | niph->protocol = IPPROTO_TCP; | 56 | niph->protocol = protocol; |
| 60 | niph->check = 0; | 57 | niph->check = 0; |
| 61 | niph->saddr = oiph->daddr; | 58 | niph->saddr = oiph->daddr; |
| 62 | niph->daddr = oiph->saddr; | 59 | niph->daddr = oiph->saddr; |
| 60 | niph->ttl = ttl; | ||
| 61 | |||
| 62 | nskb->protocol = htons(ETH_P_IP); | ||
| 63 | |||
| 64 | return niph; | ||
| 65 | } | ||
| 66 | EXPORT_SYMBOL_GPL(nf_reject_iphdr_put); | ||
| 67 | |||
| 68 | void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb, | ||
| 69 | const struct tcphdr *oth) | ||
| 70 | { | ||
| 71 | struct iphdr *niph = ip_hdr(nskb); | ||
| 72 | struct tcphdr *tcph; | ||
| 63 | 73 | ||
| 64 | skb_reset_transport_header(nskb); | 74 | skb_reset_transport_header(nskb); |
| 65 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 75 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); |
| @@ -68,9 +78,9 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
| 68 | tcph->dest = oth->source; | 78 | tcph->dest = oth->source; |
| 69 | tcph->doff = sizeof(struct tcphdr) / 4; | 79 | tcph->doff = sizeof(struct tcphdr) / 4; |
| 70 | 80 | ||
| 71 | if (oth->ack) | 81 | if (oth->ack) { |
| 72 | tcph->seq = oth->ack_seq; | 82 | tcph->seq = oth->ack_seq; |
| 73 | else { | 83 | } else { |
| 74 | tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + | 84 | tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + |
| 75 | oldskb->len - ip_hdrlen(oldskb) - | 85 | oldskb->len - ip_hdrlen(oldskb) - |
| 76 | (oth->doff << 2)); | 86 | (oth->doff << 2)); |
| @@ -83,16 +93,43 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
| 83 | nskb->ip_summed = CHECKSUM_PARTIAL; | 93 | nskb->ip_summed = CHECKSUM_PARTIAL; |
| 84 | nskb->csum_start = (unsigned char *)tcph - nskb->head; | 94 | nskb->csum_start = (unsigned char *)tcph - nskb->head; |
| 85 | nskb->csum_offset = offsetof(struct tcphdr, check); | 95 | nskb->csum_offset = offsetof(struct tcphdr, check); |
| 96 | } | ||
| 97 | EXPORT_SYMBOL_GPL(nf_reject_ip_tcphdr_put); | ||
| 98 | |||
| 99 | /* Send RST reply */ | ||
| 100 | void nf_send_reset(struct sk_buff *oldskb, int hook) | ||
| 101 | { | ||
| 102 | struct sk_buff *nskb; | ||
| 103 | const struct iphdr *oiph; | ||
| 104 | struct iphdr *niph; | ||
| 105 | const struct tcphdr *oth; | ||
| 106 | struct tcphdr _oth; | ||
| 107 | |||
| 108 | oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook); | ||
| 109 | if (!oth) | ||
| 110 | return; | ||
| 111 | |||
| 112 | if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) | ||
| 113 | return; | ||
| 114 | |||
| 115 | oiph = ip_hdr(oldskb); | ||
| 116 | |||
| 117 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + | ||
| 118 | LL_MAX_HEADER, GFP_ATOMIC); | ||
| 119 | if (!nskb) | ||
| 120 | return; | ||
| 86 | 121 | ||
| 87 | /* ip_route_me_harder expects skb->dst to be set */ | 122 | /* ip_route_me_harder expects skb->dst to be set */ |
| 88 | skb_dst_set_noref(nskb, skb_dst(oldskb)); | 123 | skb_dst_set_noref(nskb, skb_dst(oldskb)); |
| 89 | 124 | ||
| 90 | nskb->protocol = htons(ETH_P_IP); | 125 | skb_reserve(nskb, LL_MAX_HEADER); |
| 126 | niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, | ||
| 127 | ip4_dst_hoplimit(skb_dst(nskb))); | ||
| 128 | nf_reject_ip_tcphdr_put(nskb, oldskb, oth); | ||
| 129 | |||
| 91 | if (ip_route_me_harder(nskb, RTN_UNSPEC)) | 130 | if (ip_route_me_harder(nskb, RTN_UNSPEC)) |
| 92 | goto free_nskb; | 131 | goto free_nskb; |
| 93 | 132 | ||
| 94 | niph->ttl = ip4_dst_hoplimit(skb_dst(nskb)); | ||
| 95 | |||
| 96 | /* "Never happens" */ | 133 | /* "Never happens" */ |
| 97 | if (nskb->len > dst_mtu(skb_dst(nskb))) | 134 | if (nskb->len > dst_mtu(skb_dst(nskb))) |
| 98 | goto free_nskb; | 135 | goto free_nskb; |
| @@ -125,3 +162,5 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
| 125 | kfree_skb(nskb); | 162 | kfree_skb(nskb); |
| 126 | } | 163 | } |
| 127 | EXPORT_SYMBOL_GPL(nf_send_reset); | 164 | EXPORT_SYMBOL_GPL(nf_send_reset); |
| 165 | |||
| 166 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c index 1c636d6b5b50..c1023c445920 100644 --- a/net/ipv4/netfilter/nft_masq_ipv4.c +++ b/net/ipv4/netfilter/nft_masq_ipv4.c | |||
| @@ -39,6 +39,7 @@ static const struct nft_expr_ops nft_masq_ipv4_ops = { | |||
| 39 | .eval = nft_masq_ipv4_eval, | 39 | .eval = nft_masq_ipv4_eval, |
| 40 | .init = nft_masq_init, | 40 | .init = nft_masq_init, |
| 41 | .dump = nft_masq_dump, | 41 | .dump = nft_masq_dump, |
| 42 | .validate = nft_masq_validate, | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | static struct nft_expr_type nft_masq_ipv4_type __read_mostly = { | 45 | static struct nft_expr_type nft_masq_ipv4_type __read_mostly = { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2d4ae469b471..6a2155b02602 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -1798,6 +1798,7 @@ local_input: | |||
| 1798 | no_route: | 1798 | no_route: |
| 1799 | RT_CACHE_STAT_INC(in_no_route); | 1799 | RT_CACHE_STAT_INC(in_no_route); |
| 1800 | res.type = RTN_UNREACHABLE; | 1800 | res.type = RTN_UNREACHABLE; |
| 1801 | res.fi = NULL; | ||
| 1801 | goto local_input; | 1802 | goto local_input; |
| 1802 | 1803 | ||
| 1803 | /* | 1804 | /* |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 1bec4e76d88c..39ec0c379545 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
| @@ -2868,61 +2868,42 @@ EXPORT_SYMBOL(compat_tcp_getsockopt); | |||
| 2868 | #endif | 2868 | #endif |
| 2869 | 2869 | ||
| 2870 | #ifdef CONFIG_TCP_MD5SIG | 2870 | #ifdef CONFIG_TCP_MD5SIG |
| 2871 | static struct tcp_md5sig_pool __percpu *tcp_md5sig_pool __read_mostly; | 2871 | static DEFINE_PER_CPU(struct tcp_md5sig_pool, tcp_md5sig_pool); |
| 2872 | static DEFINE_MUTEX(tcp_md5sig_mutex); | 2872 | static DEFINE_MUTEX(tcp_md5sig_mutex); |
| 2873 | 2873 | static bool tcp_md5sig_pool_populated = false; | |
| 2874 | static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool __percpu *pool) | ||
| 2875 | { | ||
| 2876 | int cpu; | ||
| 2877 | |||
| 2878 | for_each_possible_cpu(cpu) { | ||
| 2879 | struct tcp_md5sig_pool *p = per_cpu_ptr(pool, cpu); | ||
| 2880 | |||
| 2881 | if (p->md5_desc.tfm) | ||
| 2882 | crypto_free_hash(p->md5_desc.tfm); | ||
| 2883 | } | ||
| 2884 | free_percpu(pool); | ||
| 2885 | } | ||
| 2886 | 2874 | ||
| 2887 | static void __tcp_alloc_md5sig_pool(void) | 2875 | static void __tcp_alloc_md5sig_pool(void) |
| 2888 | { | 2876 | { |
| 2889 | int cpu; | 2877 | int cpu; |
| 2890 | struct tcp_md5sig_pool __percpu *pool; | ||
| 2891 | |||
| 2892 | pool = alloc_percpu(struct tcp_md5sig_pool); | ||
| 2893 | if (!pool) | ||
| 2894 | return; | ||
| 2895 | 2878 | ||
| 2896 | for_each_possible_cpu(cpu) { | 2879 | for_each_possible_cpu(cpu) { |
| 2897 | struct crypto_hash *hash; | 2880 | if (!per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm) { |
| 2898 | 2881 | struct crypto_hash *hash; | |
| 2899 | hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); | ||
| 2900 | if (IS_ERR_OR_NULL(hash)) | ||
| 2901 | goto out_free; | ||
| 2902 | 2882 | ||
| 2903 | per_cpu_ptr(pool, cpu)->md5_desc.tfm = hash; | 2883 | hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); |
| 2884 | if (IS_ERR_OR_NULL(hash)) | ||
| 2885 | return; | ||
| 2886 | per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm = hash; | ||
| 2887 | } | ||
| 2904 | } | 2888 | } |
| 2905 | /* before setting tcp_md5sig_pool, we must commit all writes | 2889 | /* before setting tcp_md5sig_pool_populated, we must commit all writes |
| 2906 | * to memory. See ACCESS_ONCE() in tcp_get_md5sig_pool() | 2890 | * to memory. See smp_rmb() in tcp_get_md5sig_pool() |
| 2907 | */ | 2891 | */ |
| 2908 | smp_wmb(); | 2892 | smp_wmb(); |
| 2909 | tcp_md5sig_pool = pool; | 2893 | tcp_md5sig_pool_populated = true; |
| 2910 | return; | ||
| 2911 | out_free: | ||
| 2912 | __tcp_free_md5sig_pool(pool); | ||
| 2913 | } | 2894 | } |
| 2914 | 2895 | ||
| 2915 | bool tcp_alloc_md5sig_pool(void) | 2896 | bool tcp_alloc_md5sig_pool(void) |
| 2916 | { | 2897 | { |
| 2917 | if (unlikely(!tcp_md5sig_pool)) { | 2898 | if (unlikely(!tcp_md5sig_pool_populated)) { |
| 2918 | mutex_lock(&tcp_md5sig_mutex); | 2899 | mutex_lock(&tcp_md5sig_mutex); |
| 2919 | 2900 | ||
| 2920 | if (!tcp_md5sig_pool) | 2901 | if (!tcp_md5sig_pool_populated) |
| 2921 | __tcp_alloc_md5sig_pool(); | 2902 | __tcp_alloc_md5sig_pool(); |
| 2922 | 2903 | ||
| 2923 | mutex_unlock(&tcp_md5sig_mutex); | 2904 | mutex_unlock(&tcp_md5sig_mutex); |
| 2924 | } | 2905 | } |
| 2925 | return tcp_md5sig_pool != NULL; | 2906 | return tcp_md5sig_pool_populated; |
| 2926 | } | 2907 | } |
| 2927 | EXPORT_SYMBOL(tcp_alloc_md5sig_pool); | 2908 | EXPORT_SYMBOL(tcp_alloc_md5sig_pool); |
| 2928 | 2909 | ||
| @@ -2936,13 +2917,13 @@ EXPORT_SYMBOL(tcp_alloc_md5sig_pool); | |||
| 2936 | */ | 2917 | */ |
| 2937 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) | 2918 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) |
| 2938 | { | 2919 | { |
| 2939 | struct tcp_md5sig_pool __percpu *p; | ||
| 2940 | |||
| 2941 | local_bh_disable(); | 2920 | local_bh_disable(); |
| 2942 | p = ACCESS_ONCE(tcp_md5sig_pool); | ||
| 2943 | if (p) | ||
| 2944 | return raw_cpu_ptr(p); | ||
| 2945 | 2921 | ||
| 2922 | if (tcp_md5sig_pool_populated) { | ||
| 2923 | /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ | ||
| 2924 | smp_rmb(); | ||
| 2925 | return this_cpu_ptr(&tcp_md5sig_pool); | ||
| 2926 | } | ||
| 2946 | local_bh_enable(); | 2927 | local_bh_enable(); |
| 2947 | return NULL; | 2928 | return NULL; |
| 2948 | } | 2929 | } |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 94d1a7757ff7..9c7d7621466b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -206,8 +206,6 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
| 206 | inet->inet_dport = usin->sin_port; | 206 | inet->inet_dport = usin->sin_port; |
| 207 | inet->inet_daddr = daddr; | 207 | inet->inet_daddr = daddr; |
| 208 | 208 | ||
| 209 | inet_set_txhash(sk); | ||
| 210 | |||
| 211 | inet_csk(sk)->icsk_ext_hdr_len = 0; | 209 | inet_csk(sk)->icsk_ext_hdr_len = 0; |
| 212 | if (inet_opt) | 210 | if (inet_opt) |
| 213 | inet_csk(sk)->icsk_ext_hdr_len = inet_opt->opt.optlen; | 211 | inet_csk(sk)->icsk_ext_hdr_len = inet_opt->opt.optlen; |
| @@ -224,6 +222,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
| 224 | if (err) | 222 | if (err) |
| 225 | goto failure; | 223 | goto failure; |
| 226 | 224 | ||
| 225 | inet_set_txhash(sk); | ||
| 226 | |||
| 227 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, | 227 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, |
| 228 | inet->inet_sport, inet->inet_dport, sk); | 228 | inet->inet_sport, inet->inet_dport, sk); |
| 229 | if (IS_ERR(rt)) { | 229 | if (IS_ERR(rt)) { |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 3af21296d967..a3d453b94747 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -2126,7 +2126,7 @@ bool tcp_schedule_loss_probe(struct sock *sk) | |||
| 2126 | static bool skb_still_in_host_queue(const struct sock *sk, | 2126 | static bool skb_still_in_host_queue(const struct sock *sk, |
| 2127 | const struct sk_buff *skb) | 2127 | const struct sk_buff *skb) |
| 2128 | { | 2128 | { |
| 2129 | if (unlikely(skb_fclone_busy(skb))) { | 2129 | if (unlikely(skb_fclone_busy(sk, skb))) { |
| 2130 | NET_INC_STATS_BH(sock_net(sk), | 2130 | NET_INC_STATS_BH(sock_net(sk), |
| 2131 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); | 2131 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); |
| 2132 | return true; | 2132 | return true; |
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 507310ef4b56..6480cea7aa53 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c | |||
| @@ -58,7 +58,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, | |||
| 58 | skb->encap_hdr_csum = 1; | 58 | skb->encap_hdr_csum = 1; |
| 59 | 59 | ||
| 60 | /* segment inner packet. */ | 60 | /* segment inner packet. */ |
| 61 | enc_features = skb->dev->hw_enc_features & netif_skb_features(skb); | 61 | enc_features = skb->dev->hw_enc_features & features; |
| 62 | segs = gso_inner_segment(skb, enc_features); | 62 | segs = gso_inner_segment(skb, enc_features); |
| 63 | if (IS_ERR_OR_NULL(segs)) { | 63 | if (IS_ERR_OR_NULL(segs)) { |
| 64 | skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset, | 64 | skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset, |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 725c763270a0..0169ccf5aa4f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
| @@ -4531,6 +4531,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token) | |||
| 4531 | } | 4531 | } |
| 4532 | 4532 | ||
| 4533 | write_unlock_bh(&idev->lock); | 4533 | write_unlock_bh(&idev->lock); |
| 4534 | inet6_ifinfo_notify(RTM_NEWLINK, idev); | ||
| 4534 | addrconf_verify_rtnl(); | 4535 | addrconf_verify_rtnl(); |
| 4535 | return 0; | 4536 | return 0; |
| 4536 | } | 4537 | } |
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 91014d32488d..a071563a7e6e 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
| @@ -90,7 +90,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
| 90 | 90 | ||
| 91 | encap = SKB_GSO_CB(skb)->encap_level > 0; | 91 | encap = SKB_GSO_CB(skb)->encap_level > 0; |
| 92 | if (encap) | 92 | if (encap) |
| 93 | features = skb->dev->hw_enc_features & netif_skb_features(skb); | 93 | features &= skb->dev->hw_enc_features; |
| 94 | SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h); | 94 | SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h); |
| 95 | 95 | ||
| 96 | ipv6h = ipv6_hdr(skb); | 96 | ipv6h = ipv6_hdr(skb); |
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index 5f5f0438d74d..015eb8a80766 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c | |||
| @@ -5,121 +5,109 @@ | |||
| 5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
| 7 | */ | 7 | */ |
| 8 | |||
| 9 | #include <linux/module.h> | ||
| 8 | #include <net/ipv6.h> | 10 | #include <net/ipv6.h> |
| 9 | #include <net/ip6_route.h> | 11 | #include <net/ip6_route.h> |
| 10 | #include <net/ip6_fib.h> | 12 | #include <net/ip6_fib.h> |
| 11 | #include <net/ip6_checksum.h> | 13 | #include <net/ip6_checksum.h> |
| 12 | #include <linux/netfilter_ipv6.h> | 14 | #include <linux/netfilter_ipv6.h> |
| 15 | #include <net/netfilter/ipv6/nf_reject.h> | ||
| 13 | 16 | ||
| 14 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | 17 | const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb, |
| 18 | struct tcphdr *otcph, | ||
| 19 | unsigned int *otcplen, int hook) | ||
| 15 | { | 20 | { |
| 16 | struct sk_buff *nskb; | ||
| 17 | struct tcphdr otcph, *tcph; | ||
| 18 | unsigned int otcplen, hh_len; | ||
| 19 | int tcphoff, needs_ack; | ||
| 20 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | 21 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); |
| 21 | struct ipv6hdr *ip6h; | ||
| 22 | #define DEFAULT_TOS_VALUE 0x0U | ||
| 23 | const __u8 tclass = DEFAULT_TOS_VALUE; | ||
| 24 | struct dst_entry *dst = NULL; | ||
| 25 | u8 proto; | 22 | u8 proto; |
| 26 | __be16 frag_off; | 23 | __be16 frag_off; |
| 27 | struct flowi6 fl6; | 24 | int tcphoff; |
| 28 | |||
| 29 | if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || | ||
| 30 | (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { | ||
| 31 | pr_debug("addr is not unicast.\n"); | ||
| 32 | return; | ||
| 33 | } | ||
| 34 | 25 | ||
| 35 | proto = oip6h->nexthdr; | 26 | proto = oip6h->nexthdr; |
| 36 | tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto, &frag_off); | 27 | tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), |
| 28 | &proto, &frag_off); | ||
| 37 | 29 | ||
| 38 | if ((tcphoff < 0) || (tcphoff > oldskb->len)) { | 30 | if ((tcphoff < 0) || (tcphoff > oldskb->len)) { |
| 39 | pr_debug("Cannot get TCP header.\n"); | 31 | pr_debug("Cannot get TCP header.\n"); |
| 40 | return; | 32 | return NULL; |
| 41 | } | 33 | } |
| 42 | 34 | ||
| 43 | otcplen = oldskb->len - tcphoff; | 35 | *otcplen = oldskb->len - tcphoff; |
| 44 | 36 | ||
| 45 | /* IP header checks: fragment, too short. */ | 37 | /* IP header checks: fragment, too short. */ |
| 46 | if (proto != IPPROTO_TCP || otcplen < sizeof(struct tcphdr)) { | 38 | if (proto != IPPROTO_TCP || *otcplen < sizeof(struct tcphdr)) { |
| 47 | pr_debug("proto(%d) != IPPROTO_TCP, " | 39 | pr_debug("proto(%d) != IPPROTO_TCP or too short (len = %d)\n", |
| 48 | "or too short. otcplen = %d\n", | 40 | proto, *otcplen); |
| 49 | proto, otcplen); | 41 | return NULL; |
| 50 | return; | ||
| 51 | } | 42 | } |
| 52 | 43 | ||
| 53 | if (skb_copy_bits(oldskb, tcphoff, &otcph, sizeof(struct tcphdr))) | 44 | otcph = skb_header_pointer(oldskb, tcphoff, sizeof(struct tcphdr), |
| 54 | BUG(); | 45 | otcph); |
| 46 | if (otcph == NULL) | ||
| 47 | return NULL; | ||
| 55 | 48 | ||
| 56 | /* No RST for RST. */ | 49 | /* No RST for RST. */ |
| 57 | if (otcph.rst) { | 50 | if (otcph->rst) { |
| 58 | pr_debug("RST is set\n"); | 51 | pr_debug("RST is set\n"); |
| 59 | return; | 52 | return NULL; |
| 60 | } | 53 | } |
| 61 | 54 | ||
| 62 | /* Check checksum. */ | 55 | /* Check checksum. */ |
| 63 | if (nf_ip6_checksum(oldskb, hook, tcphoff, IPPROTO_TCP)) { | 56 | if (nf_ip6_checksum(oldskb, hook, tcphoff, IPPROTO_TCP)) { |
| 64 | pr_debug("TCP checksum is invalid\n"); | 57 | pr_debug("TCP checksum is invalid\n"); |
| 65 | return; | 58 | return NULL; |
| 66 | } | 59 | } |
| 67 | 60 | ||
| 68 | memset(&fl6, 0, sizeof(fl6)); | 61 | return otcph; |
| 69 | fl6.flowi6_proto = IPPROTO_TCP; | 62 | } |
| 70 | fl6.saddr = oip6h->daddr; | 63 | EXPORT_SYMBOL_GPL(nf_reject_ip6_tcphdr_get); |
| 71 | fl6.daddr = oip6h->saddr; | ||
| 72 | fl6.fl6_sport = otcph.dest; | ||
| 73 | fl6.fl6_dport = otcph.source; | ||
| 74 | security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6)); | ||
| 75 | dst = ip6_route_output(net, NULL, &fl6); | ||
| 76 | if (dst == NULL || dst->error) { | ||
| 77 | dst_release(dst); | ||
| 78 | return; | ||
| 79 | } | ||
| 80 | dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0); | ||
| 81 | if (IS_ERR(dst)) | ||
| 82 | return; | ||
| 83 | |||
| 84 | hh_len = (dst->dev->hard_header_len + 15)&~15; | ||
| 85 | nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr) | ||
| 86 | + sizeof(struct tcphdr) + dst->trailer_len, | ||
| 87 | GFP_ATOMIC); | ||
| 88 | |||
| 89 | if (!nskb) { | ||
| 90 | net_dbg_ratelimited("cannot alloc skb\n"); | ||
| 91 | dst_release(dst); | ||
| 92 | return; | ||
| 93 | } | ||
| 94 | |||
| 95 | skb_dst_set(nskb, dst); | ||
| 96 | 64 | ||
| 97 | skb_reserve(nskb, hh_len + dst->header_len); | 65 | struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, |
| 66 | const struct sk_buff *oldskb, | ||
| 67 | __be16 protocol, int hoplimit) | ||
| 68 | { | ||
| 69 | struct ipv6hdr *ip6h; | ||
| 70 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | ||
| 71 | #define DEFAULT_TOS_VALUE 0x0U | ||
| 72 | const __u8 tclass = DEFAULT_TOS_VALUE; | ||
| 98 | 73 | ||
| 99 | skb_put(nskb, sizeof(struct ipv6hdr)); | 74 | skb_put(nskb, sizeof(struct ipv6hdr)); |
| 100 | skb_reset_network_header(nskb); | 75 | skb_reset_network_header(nskb); |
| 101 | ip6h = ipv6_hdr(nskb); | 76 | ip6h = ipv6_hdr(nskb); |
| 102 | ip6_flow_hdr(ip6h, tclass, 0); | 77 | ip6_flow_hdr(ip6h, tclass, 0); |
| 103 | ip6h->hop_limit = ip6_dst_hoplimit(dst); | 78 | ip6h->hop_limit = hoplimit; |
| 104 | ip6h->nexthdr = IPPROTO_TCP; | 79 | ip6h->nexthdr = protocol; |
| 105 | ip6h->saddr = oip6h->daddr; | 80 | ip6h->saddr = oip6h->daddr; |
| 106 | ip6h->daddr = oip6h->saddr; | 81 | ip6h->daddr = oip6h->saddr; |
| 107 | 82 | ||
| 83 | nskb->protocol = htons(ETH_P_IPV6); | ||
| 84 | |||
| 85 | return ip6h; | ||
| 86 | } | ||
| 87 | EXPORT_SYMBOL_GPL(nf_reject_ip6hdr_put); | ||
| 88 | |||
| 89 | void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, | ||
| 90 | const struct sk_buff *oldskb, | ||
| 91 | const struct tcphdr *oth, unsigned int otcplen) | ||
| 92 | { | ||
| 93 | struct tcphdr *tcph; | ||
| 94 | int needs_ack; | ||
| 95 | |||
| 108 | skb_reset_transport_header(nskb); | 96 | skb_reset_transport_header(nskb); |
| 109 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 97 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); |
| 110 | /* Truncate to length (no data) */ | 98 | /* Truncate to length (no data) */ |
| 111 | tcph->doff = sizeof(struct tcphdr)/4; | 99 | tcph->doff = sizeof(struct tcphdr)/4; |
| 112 | tcph->source = otcph.dest; | 100 | tcph->source = oth->dest; |
| 113 | tcph->dest = otcph.source; | 101 | tcph->dest = oth->source; |
| 114 | 102 | ||
| 115 | if (otcph.ack) { | 103 | if (oth->ack) { |
| 116 | needs_ack = 0; | 104 | needs_ack = 0; |
| 117 | tcph->seq = otcph.ack_seq; | 105 | tcph->seq = oth->ack_seq; |
| 118 | tcph->ack_seq = 0; | 106 | tcph->ack_seq = 0; |
| 119 | } else { | 107 | } else { |
| 120 | needs_ack = 1; | 108 | needs_ack = 1; |
| 121 | tcph->ack_seq = htonl(ntohl(otcph.seq) + otcph.syn + otcph.fin | 109 | tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + |
| 122 | + otcplen - (otcph.doff<<2)); | 110 | otcplen - (oth->doff<<2)); |
| 123 | tcph->seq = 0; | 111 | tcph->seq = 0; |
| 124 | } | 112 | } |
| 125 | 113 | ||
| @@ -137,6 +125,63 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | |||
| 137 | sizeof(struct tcphdr), IPPROTO_TCP, | 125 | sizeof(struct tcphdr), IPPROTO_TCP, |
| 138 | csum_partial(tcph, | 126 | csum_partial(tcph, |
| 139 | sizeof(struct tcphdr), 0)); | 127 | sizeof(struct tcphdr), 0)); |
| 128 | } | ||
| 129 | EXPORT_SYMBOL_GPL(nf_reject_ip6_tcphdr_put); | ||
| 130 | |||
| 131 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | ||
| 132 | { | ||
| 133 | struct sk_buff *nskb; | ||
| 134 | struct tcphdr _otcph; | ||
| 135 | const struct tcphdr *otcph; | ||
| 136 | unsigned int otcplen, hh_len; | ||
| 137 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | ||
| 138 | struct ipv6hdr *ip6h; | ||
| 139 | struct dst_entry *dst = NULL; | ||
| 140 | struct flowi6 fl6; | ||
| 141 | |||
| 142 | if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || | ||
| 143 | (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { | ||
| 144 | pr_debug("addr is not unicast.\n"); | ||
| 145 | return; | ||
| 146 | } | ||
| 147 | |||
| 148 | otcph = nf_reject_ip6_tcphdr_get(oldskb, &_otcph, &otcplen, hook); | ||
| 149 | if (!otcph) | ||
| 150 | return; | ||
| 151 | |||
| 152 | memset(&fl6, 0, sizeof(fl6)); | ||
| 153 | fl6.flowi6_proto = IPPROTO_TCP; | ||
| 154 | fl6.saddr = oip6h->daddr; | ||
| 155 | fl6.daddr = oip6h->saddr; | ||
| 156 | fl6.fl6_sport = otcph->dest; | ||
| 157 | fl6.fl6_dport = otcph->source; | ||
| 158 | security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6)); | ||
| 159 | dst = ip6_route_output(net, NULL, &fl6); | ||
| 160 | if (dst == NULL || dst->error) { | ||
| 161 | dst_release(dst); | ||
| 162 | return; | ||
| 163 | } | ||
| 164 | dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0); | ||
| 165 | if (IS_ERR(dst)) | ||
| 166 | return; | ||
| 167 | |||
| 168 | hh_len = (dst->dev->hard_header_len + 15)&~15; | ||
| 169 | nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr) | ||
| 170 | + sizeof(struct tcphdr) + dst->trailer_len, | ||
| 171 | GFP_ATOMIC); | ||
| 172 | |||
| 173 | if (!nskb) { | ||
| 174 | net_dbg_ratelimited("cannot alloc skb\n"); | ||
| 175 | dst_release(dst); | ||
| 176 | return; | ||
| 177 | } | ||
| 178 | |||
| 179 | skb_dst_set(nskb, dst); | ||
| 180 | |||
| 181 | skb_reserve(nskb, hh_len + dst->header_len); | ||
| 182 | ip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, | ||
| 183 | ip6_dst_hoplimit(dst)); | ||
| 184 | nf_reject_ip6_tcphdr_put(nskb, oldskb, otcph, otcplen); | ||
| 140 | 185 | ||
| 141 | nf_ct_attach(nskb, oldskb); | 186 | nf_ct_attach(nskb, oldskb); |
| 142 | 187 | ||
| @@ -161,3 +206,5 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | |||
| 161 | ip6_local_out(nskb); | 206 | ip6_local_out(nskb); |
| 162 | } | 207 | } |
| 163 | EXPORT_SYMBOL_GPL(nf_send_reset6); | 208 | EXPORT_SYMBOL_GPL(nf_send_reset6); |
| 209 | |||
| 210 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c index 556262f40761..8a7ac685076d 100644 --- a/net/ipv6/netfilter/nft_masq_ipv6.c +++ b/net/ipv6/netfilter/nft_masq_ipv6.c | |||
| @@ -39,6 +39,7 @@ static const struct nft_expr_ops nft_masq_ipv6_ops = { | |||
| 39 | .eval = nft_masq_ipv6_eval, | 39 | .eval = nft_masq_ipv6_eval, |
| 40 | .init = nft_masq_init, | 40 | .init = nft_masq_init, |
| 41 | .dump = nft_masq_dump, | 41 | .dump = nft_masq_dump, |
| 42 | .validate = nft_masq_validate, | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | static struct nft_expr_type nft_masq_ipv6_type __read_mostly = { | 45 | static struct nft_expr_type nft_masq_ipv6_type __read_mostly = { |
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index fc24c390af05..97f41a3e68d9 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c | |||
| @@ -3,11 +3,45 @@ | |||
| 3 | * not configured or static. These functions are needed by GSO/GRO implementation. | 3 | * not configured or static. These functions are needed by GSO/GRO implementation. |
| 4 | */ | 4 | */ |
| 5 | #include <linux/export.h> | 5 | #include <linux/export.h> |
| 6 | #include <net/ip.h> | ||
| 6 | #include <net/ipv6.h> | 7 | #include <net/ipv6.h> |
| 7 | #include <net/ip6_fib.h> | 8 | #include <net/ip6_fib.h> |
| 8 | #include <net/addrconf.h> | 9 | #include <net/addrconf.h> |
| 9 | #include <net/secure_seq.h> | 10 | #include <net/secure_seq.h> |
| 10 | 11 | ||
| 12 | /* This function exists only for tap drivers that must support broken | ||
| 13 | * clients requesting UFO without specifying an IPv6 fragment ID. | ||
| 14 | * | ||
| 15 | * This is similar to ipv6_select_ident() but we use an independent hash | ||
| 16 | * seed to limit information leakage. | ||
| 17 | * | ||
| 18 | * The network header must be set before calling this. | ||
| 19 | */ | ||
| 20 | void ipv6_proxy_select_ident(struct sk_buff *skb) | ||
| 21 | { | ||
| 22 | static u32 ip6_proxy_idents_hashrnd __read_mostly; | ||
| 23 | struct in6_addr buf[2]; | ||
| 24 | struct in6_addr *addrs; | ||
| 25 | u32 hash, id; | ||
| 26 | |||
| 27 | addrs = skb_header_pointer(skb, | ||
| 28 | skb_network_offset(skb) + | ||
| 29 | offsetof(struct ipv6hdr, saddr), | ||
| 30 | sizeof(buf), buf); | ||
| 31 | if (!addrs) | ||
| 32 | return; | ||
| 33 | |||
| 34 | net_get_random_once(&ip6_proxy_idents_hashrnd, | ||
| 35 | sizeof(ip6_proxy_idents_hashrnd)); | ||
| 36 | |||
| 37 | hash = __ipv6_addr_jhash(&addrs[1], ip6_proxy_idents_hashrnd); | ||
| 38 | hash = __ipv6_addr_jhash(&addrs[0], hash); | ||
| 39 | |||
| 40 | id = ip_idents_reserve(hash, 1); | ||
| 41 | skb_shinfo(skb)->ip6_frag_id = htonl(id); | ||
| 42 | } | ||
| 43 | EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); | ||
| 44 | |||
| 11 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | 45 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) |
| 12 | { | 46 | { |
| 13 | u16 offset = sizeof(struct ipv6hdr); | 47 | u16 offset = sizeof(struct ipv6hdr); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 831495529b82..ace29b60813c 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -200,8 +200,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
| 200 | sk->sk_v6_daddr = usin->sin6_addr; | 200 | sk->sk_v6_daddr = usin->sin6_addr; |
| 201 | np->flow_label = fl6.flowlabel; | 201 | np->flow_label = fl6.flowlabel; |
| 202 | 202 | ||
| 203 | ip6_set_txhash(sk); | ||
| 204 | |||
| 205 | /* | 203 | /* |
| 206 | * TCP over IPv4 | 204 | * TCP over IPv4 |
| 207 | */ | 205 | */ |
| @@ -297,6 +295,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
| 297 | if (err) | 295 | if (err) |
| 298 | goto late_failure; | 296 | goto late_failure; |
| 299 | 297 | ||
| 298 | ip6_set_txhash(sk); | ||
| 299 | |||
| 300 | if (!tp->write_seq && likely(!tp->repair)) | 300 | if (!tp->write_seq && likely(!tp->repair)) |
| 301 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, | 301 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, |
| 302 | sk->sk_v6_daddr.s6_addr32, | 302 | sk->sk_v6_daddr.s6_addr32, |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index ac49f84fe2c3..5f983644373a 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
| @@ -170,8 +170,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
| 170 | case IPPROTO_DCCP: | 170 | case IPPROTO_DCCP: |
| 171 | if (!onlyproto && (nh + offset + 4 < skb->data || | 171 | if (!onlyproto && (nh + offset + 4 < skb->data || |
| 172 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { | 172 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { |
| 173 | __be16 *ports = (__be16 *)exthdr; | 173 | __be16 *ports; |
| 174 | 174 | ||
| 175 | nh = skb_network_header(skb); | ||
| 176 | ports = (__be16 *)(nh + offset); | ||
| 175 | fl6->fl6_sport = ports[!!reverse]; | 177 | fl6->fl6_sport = ports[!!reverse]; |
| 176 | fl6->fl6_dport = ports[!reverse]; | 178 | fl6->fl6_dport = ports[!reverse]; |
| 177 | } | 179 | } |
| @@ -180,8 +182,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
| 180 | 182 | ||
| 181 | case IPPROTO_ICMPV6: | 183 | case IPPROTO_ICMPV6: |
| 182 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { | 184 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { |
| 183 | u8 *icmp = (u8 *)exthdr; | 185 | u8 *icmp; |
| 184 | 186 | ||
| 187 | nh = skb_network_header(skb); | ||
| 188 | icmp = (u8 *)(nh + offset); | ||
| 185 | fl6->fl6_icmp_type = icmp[0]; | 189 | fl6->fl6_icmp_type = icmp[0]; |
| 186 | fl6->fl6_icmp_code = icmp[1]; | 190 | fl6->fl6_icmp_code = icmp[1]; |
| 187 | } | 191 | } |
| @@ -192,8 +196,9 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
| 192 | case IPPROTO_MH: | 196 | case IPPROTO_MH: |
| 193 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { | 197 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { |
| 194 | struct ip6_mh *mh; | 198 | struct ip6_mh *mh; |
| 195 | mh = (struct ip6_mh *)exthdr; | ||
| 196 | 199 | ||
| 200 | nh = skb_network_header(skb); | ||
| 201 | mh = (struct ip6_mh *)(nh + offset); | ||
| 197 | fl6->fl6_mh_type = mh->ip6mh_type; | 202 | fl6->fl6_mh_type = mh->ip6mh_type; |
| 198 | } | 203 | } |
| 199 | fl6->flowi6_proto = nexthdr; | 204 | fl6->flowi6_proto = nexthdr; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index fb6a1502b6df..343da1e35025 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
| @@ -3458,7 +3458,7 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy, | |||
| 3458 | rcu_read_lock(); | 3458 | rcu_read_lock(); |
| 3459 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | 3459 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
| 3460 | if (chanctx_conf) { | 3460 | if (chanctx_conf) { |
| 3461 | *chandef = chanctx_conf->def; | 3461 | *chandef = sdata->vif.bss_conf.chandef; |
| 3462 | ret = 0; | 3462 | ret = 0; |
| 3463 | } else if (local->open_count > 0 && | 3463 | } else if (local->open_count > 0 && |
| 3464 | local->open_count == local->monitors && | 3464 | local->open_count == local->monitors && |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 8fdadfd94ba8..6081329784dd 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
| @@ -448,7 +448,7 @@ static void rate_fixup_ratelist(struct ieee80211_vif *vif, | |||
| 448 | */ | 448 | */ |
| 449 | if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) { | 449 | if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) { |
| 450 | u32 basic_rates = vif->bss_conf.basic_rates; | 450 | u32 basic_rates = vif->bss_conf.basic_rates; |
| 451 | s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0; | 451 | s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0; |
| 452 | 452 | ||
| 453 | rate = &sband->bitrates[rates[0].idx]; | 453 | rate = &sband->bitrates[rates[0].idx]; |
| 454 | 454 | ||
diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c index edde723f9f00..2acab1bcaa4b 100644 --- a/net/mac80211/rc80211_minstrel_debugfs.c +++ b/net/mac80211/rc80211_minstrel_debugfs.c | |||
| @@ -62,14 +62,14 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
| 62 | unsigned int i, tp, prob, eprob; | 62 | unsigned int i, tp, prob, eprob; |
| 63 | char *p; | 63 | char *p; |
| 64 | 64 | ||
| 65 | ms = kmalloc(sizeof(*ms) + 4096, GFP_KERNEL); | 65 | ms = kmalloc(2048, GFP_KERNEL); |
| 66 | if (!ms) | 66 | if (!ms) |
| 67 | return -ENOMEM; | 67 | return -ENOMEM; |
| 68 | 68 | ||
| 69 | file->private_data = ms; | 69 | file->private_data = ms; |
| 70 | p = ms->buf; | 70 | p = ms->buf; |
| 71 | p += sprintf(p, "rate throughput ewma prob this prob " | 71 | p += sprintf(p, "rate tpt eprob *prob" |
| 72 | "this succ/attempt success attempts\n"); | 72 | " *ok(*cum) ok( cum)\n"); |
| 73 | for (i = 0; i < mi->n_rates; i++) { | 73 | for (i = 0; i < mi->n_rates; i++) { |
| 74 | struct minstrel_rate *mr = &mi->r[i]; | 74 | struct minstrel_rate *mr = &mi->r[i]; |
| 75 | struct minstrel_rate_stats *mrs = &mi->r[i].stats; | 75 | struct minstrel_rate_stats *mrs = &mi->r[i].stats; |
| @@ -86,8 +86,8 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
| 86 | prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); | 86 | prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); |
| 87 | eprob = MINSTREL_TRUNC(mrs->probability * 1000); | 87 | eprob = MINSTREL_TRUNC(mrs->probability * 1000); |
| 88 | 88 | ||
| 89 | p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " | 89 | p += sprintf(p, " %4u.%1u %3u.%1u %3u.%1u" |
| 90 | " %3u(%3u) %8llu %8llu\n", | 90 | " %4u(%4u) %9llu(%9llu)\n", |
| 91 | tp / 10, tp % 10, | 91 | tp / 10, tp % 10, |
| 92 | eprob / 10, eprob % 10, | 92 | eprob / 10, eprob % 10, |
| 93 | prob / 10, prob % 10, | 93 | prob / 10, prob % 10, |
| @@ -102,6 +102,8 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
| 102 | mi->sample_packets); | 102 | mi->sample_packets); |
| 103 | ms->len = p - ms->buf; | 103 | ms->len = p - ms->buf; |
| 104 | 104 | ||
| 105 | WARN_ON(ms->len + sizeof(*ms) > 2048); | ||
| 106 | |||
| 105 | return 0; | 107 | return 0; |
| 106 | } | 108 | } |
| 107 | 109 | ||
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c index a72ad46f2a04..d537bec93754 100644 --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c | |||
| @@ -63,8 +63,8 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) | |||
| 63 | prob = MINSTREL_TRUNC(mr->cur_prob * 1000); | 63 | prob = MINSTREL_TRUNC(mr->cur_prob * 1000); |
| 64 | eprob = MINSTREL_TRUNC(mr->probability * 1000); | 64 | eprob = MINSTREL_TRUNC(mr->probability * 1000); |
| 65 | 65 | ||
| 66 | p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " | 66 | p += sprintf(p, " %4u.%1u %3u.%1u %3u.%1u " |
| 67 | "%3u %3u(%3u) %8llu %8llu\n", | 67 | "%3u %4u(%4u) %9llu(%9llu)\n", |
| 68 | tp / 10, tp % 10, | 68 | tp / 10, tp % 10, |
| 69 | eprob / 10, eprob % 10, | 69 | eprob / 10, eprob % 10, |
| 70 | prob / 10, prob % 10, | 70 | prob / 10, prob % 10, |
| @@ -96,14 +96,15 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) | |||
| 96 | return ret; | 96 | return ret; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | ms = kmalloc(sizeof(*ms) + 8192, GFP_KERNEL); | 99 | ms = kmalloc(8192, GFP_KERNEL); |
| 100 | if (!ms) | 100 | if (!ms) |
| 101 | return -ENOMEM; | 101 | return -ENOMEM; |
| 102 | 102 | ||
| 103 | file->private_data = ms; | 103 | file->private_data = ms; |
| 104 | p = ms->buf; | 104 | p = ms->buf; |
| 105 | p += sprintf(p, "type rate throughput ewma prob " | 105 | p += sprintf(p, "type rate tpt eprob *prob " |
| 106 | "this prob retry this succ/attempt success attempts\n"); | 106 | "ret *ok(*cum) ok( cum)\n"); |
| 107 | |||
| 107 | 108 | ||
| 108 | p = minstrel_ht_stats_dump(mi, max_mcs, p); | 109 | p = minstrel_ht_stats_dump(mi, max_mcs, p); |
| 109 | for (i = 0; i < max_mcs; i++) | 110 | for (i = 0; i < max_mcs; i++) |
| @@ -118,6 +119,8 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) | |||
| 118 | MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); | 119 | MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); |
| 119 | ms->len = p - ms->buf; | 120 | ms->len = p - ms->buf; |
| 120 | 121 | ||
| 122 | WARN_ON(ms->len + sizeof(*ms) > 8192); | ||
| 123 | |||
| 121 | return nonseekable_open(inode, file); | 124 | return nonseekable_open(inode, file); |
| 122 | } | 125 | } |
| 123 | 126 | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 42f68cb8957e..bcda2ac7d844 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
| @@ -336,6 +336,7 @@ struct ieee80211_tx_latency_stat { | |||
| 336 | * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for | 336 | * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for |
| 337 | * AP only. | 337 | * AP only. |
| 338 | * @cipher_scheme: optional cipher scheme for this station | 338 | * @cipher_scheme: optional cipher scheme for this station |
| 339 | * @last_tdls_pkt_time: holds the time in jiffies of last TDLS pkt ACKed | ||
| 339 | */ | 340 | */ |
| 340 | struct sta_info { | 341 | struct sta_info { |
| 341 | /* General information, mostly static */ | 342 | /* General information, mostly static */ |
diff --git a/net/mpls/Makefile b/net/mpls/Makefile index 0a3c171be537..6dec088c2d0f 100644 --- a/net/mpls/Makefile +++ b/net/mpls/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for MPLS. | 2 | # Makefile for MPLS. |
| 3 | # | 3 | # |
| 4 | obj-y += mpls_gso.o | 4 | obj-$(CONFIG_NET_MPLS_GSO) += mpls_gso.o |
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c index e28ed2ef5b06..e3545f21a099 100644 --- a/net/mpls/mpls_gso.c +++ b/net/mpls/mpls_gso.c | |||
| @@ -48,7 +48,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb, | |||
| 48 | __skb_push(skb, skb->mac_len); | 48 | __skb_push(skb, skb->mac_len); |
| 49 | 49 | ||
| 50 | /* Segment inner packet. */ | 50 | /* Segment inner packet. */ |
| 51 | mpls_features = skb->dev->mpls_features & netif_skb_features(skb); | 51 | mpls_features = skb->dev->mpls_features & features; |
| 52 | segs = skb_mac_gso_segment(skb, mpls_features); | 52 | segs = skb_mac_gso_segment(skb, mpls_features); |
| 53 | 53 | ||
| 54 | 54 | ||
| @@ -59,8 +59,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb, | |||
| 59 | * above pulled. It will be re-pushed after returning | 59 | * above pulled. It will be re-pushed after returning |
| 60 | * skb_mac_gso_segment(), an indirect caller of this function. | 60 | * skb_mac_gso_segment(), an indirect caller of this function. |
| 61 | */ | 61 | */ |
| 62 | __skb_push(skb, skb->data - skb_mac_header(skb)); | 62 | __skb_pull(skb, skb->data - skb_mac_header(skb)); |
| 63 | |||
| 64 | out: | 63 | out: |
| 65 | return segs; | 64 | return segs; |
| 66 | } | 65 | } |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 912e5a05b79d..86f9d76b1464 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
| @@ -659,7 +659,7 @@ ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index) | |||
| 659 | struct ip_set *set; | 659 | struct ip_set *set; |
| 660 | struct ip_set_net *inst = ip_set_pernet(net); | 660 | struct ip_set_net *inst = ip_set_pernet(net); |
| 661 | 661 | ||
| 662 | if (index > inst->ip_set_max) | 662 | if (index >= inst->ip_set_max) |
| 663 | return IPSET_INVALID_ID; | 663 | return IPSET_INVALID_ID; |
| 664 | 664 | ||
| 665 | nfnl_lock(NFNL_SUBSYS_IPSET); | 665 | nfnl_lock(NFNL_SUBSYS_IPSET); |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 91f17c1eb8a2..437a3663ad03 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
| @@ -316,7 +316,7 @@ __ip_vs_get_out_rt(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest, | |||
| 316 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, | 316 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, |
| 317 | local))) { | 317 | local))) { |
| 318 | IP_VS_DBG_RL("We are crossing local and non-local addresses" | 318 | IP_VS_DBG_RL("We are crossing local and non-local addresses" |
| 319 | " daddr=%pI4\n", &dest->addr.ip); | 319 | " daddr=%pI4\n", &daddr); |
| 320 | goto err_put; | 320 | goto err_put; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| @@ -458,7 +458,7 @@ __ip_vs_get_out_rt_v6(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest, | |||
| 458 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, | 458 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, |
| 459 | local))) { | 459 | local))) { |
| 460 | IP_VS_DBG_RL("We are crossing local and non-local addresses" | 460 | IP_VS_DBG_RL("We are crossing local and non-local addresses" |
| 461 | " daddr=%pI6\n", &dest->addr.in6); | 461 | " daddr=%pI6\n", daddr); |
| 462 | goto err_put; | 462 | goto err_put; |
| 463 | } | 463 | } |
| 464 | 464 | ||
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 44d1ea32570a..d87b6423ffb2 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
| @@ -213,7 +213,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
| 213 | { | 213 | { |
| 214 | /* REPLY */ | 214 | /* REPLY */ |
| 215 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ | 215 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ |
| 216 | /*syn*/ { sIV, sS2, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sS2 }, | 216 | /*syn*/ { sIV, sS2, sIV, sIV, sIV, sIV, sIV, sSS, sIV, sS2 }, |
| 217 | /* | 217 | /* |
| 218 | * sNO -> sIV Never reached. | 218 | * sNO -> sIV Never reached. |
| 219 | * sSS -> sS2 Simultaneous open | 219 | * sSS -> sS2 Simultaneous open |
| @@ -223,7 +223,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
| 223 | * sFW -> sIV | 223 | * sFW -> sIV |
| 224 | * sCW -> sIV | 224 | * sCW -> sIV |
| 225 | * sLA -> sIV | 225 | * sLA -> sIV |
| 226 | * sTW -> sIV Reopened connection, but server may not do it. | 226 | * sTW -> sSS Reopened connection, but server may have switched role |
| 227 | * sCL -> sIV | 227 | * sCL -> sIV |
| 228 | */ | 228 | */ |
| 229 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ | 229 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 556a0dfa4abc..11ab4b078f3b 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
| @@ -1328,10 +1328,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
| 1328 | basechain->stats = stats; | 1328 | basechain->stats = stats; |
| 1329 | } else { | 1329 | } else { |
| 1330 | stats = netdev_alloc_pcpu_stats(struct nft_stats); | 1330 | stats = netdev_alloc_pcpu_stats(struct nft_stats); |
| 1331 | if (IS_ERR(stats)) { | 1331 | if (stats == NULL) { |
| 1332 | module_put(type->owner); | 1332 | module_put(type->owner); |
| 1333 | kfree(basechain); | 1333 | kfree(basechain); |
| 1334 | return PTR_ERR(stats); | 1334 | return -ENOMEM; |
| 1335 | } | 1335 | } |
| 1336 | rcu_assign_pointer(basechain->stats, stats); | 1336 | rcu_assign_pointer(basechain->stats, stats); |
| 1337 | } | 1337 | } |
| @@ -3744,6 +3744,20 @@ static const struct nfnetlink_subsystem nf_tables_subsys = { | |||
| 3744 | .abort = nf_tables_abort, | 3744 | .abort = nf_tables_abort, |
| 3745 | }; | 3745 | }; |
| 3746 | 3746 | ||
| 3747 | int nft_chain_validate_dependency(const struct nft_chain *chain, | ||
| 3748 | enum nft_chain_type type) | ||
| 3749 | { | ||
| 3750 | const struct nft_base_chain *basechain; | ||
| 3751 | |||
| 3752 | if (chain->flags & NFT_BASE_CHAIN) { | ||
| 3753 | basechain = nft_base_chain(chain); | ||
| 3754 | if (basechain->type->type != type) | ||
| 3755 | return -EOPNOTSUPP; | ||
| 3756 | } | ||
| 3757 | return 0; | ||
| 3758 | } | ||
| 3759 | EXPORT_SYMBOL_GPL(nft_chain_validate_dependency); | ||
| 3760 | |||
| 3747 | /* | 3761 | /* |
| 3748 | * Loop detection - walk through the ruleset beginning at the destination chain | 3762 | * Loop detection - walk through the ruleset beginning at the destination chain |
| 3749 | * of a new jump until either the source chain is reached (loop) or all | 3763 | * of a new jump until either the source chain is reached (loop) or all |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index b1e3a0579416..5f1be5ba3559 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
| @@ -43,7 +43,8 @@ | |||
| 43 | #define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE | 43 | #define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE |
| 44 | #define NFULNL_TIMEOUT_DEFAULT 100 /* every second */ | 44 | #define NFULNL_TIMEOUT_DEFAULT 100 /* every second */ |
| 45 | #define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ | 45 | #define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ |
| 46 | #define NFULNL_COPY_RANGE_MAX 0xFFFF /* max packet size is limited by 16-bit struct nfattr nfa_len field */ | 46 | /* max packet size is limited by 16-bit struct nfattr nfa_len field */ |
| 47 | #define NFULNL_COPY_RANGE_MAX (0xFFFF - NLA_HDRLEN) | ||
| 47 | 48 | ||
| 48 | #define PRINTR(x, args...) do { if (net_ratelimit()) \ | 49 | #define PRINTR(x, args...) do { if (net_ratelimit()) \ |
| 49 | printk(x, ## args); } while (0); | 50 | printk(x, ## args); } while (0); |
| @@ -252,6 +253,8 @@ nfulnl_set_mode(struct nfulnl_instance *inst, u_int8_t mode, | |||
| 252 | 253 | ||
| 253 | case NFULNL_COPY_PACKET: | 254 | case NFULNL_COPY_PACKET: |
| 254 | inst->copy_mode = mode; | 255 | inst->copy_mode = mode; |
| 256 | if (range == 0) | ||
| 257 | range = NFULNL_COPY_RANGE_MAX; | ||
| 255 | inst->copy_range = min_t(unsigned int, | 258 | inst->copy_range = min_t(unsigned int, |
| 256 | range, NFULNL_COPY_RANGE_MAX); | 259 | range, NFULNL_COPY_RANGE_MAX); |
| 257 | break; | 260 | break; |
| @@ -343,26 +346,25 @@ nfulnl_alloc_skb(struct net *net, u32 peer_portid, unsigned int inst_size, | |||
| 343 | return skb; | 346 | return skb; |
| 344 | } | 347 | } |
| 345 | 348 | ||
| 346 | static int | 349 | static void |
| 347 | __nfulnl_send(struct nfulnl_instance *inst) | 350 | __nfulnl_send(struct nfulnl_instance *inst) |
| 348 | { | 351 | { |
| 349 | int status = -1; | ||
| 350 | |||
| 351 | if (inst->qlen > 1) { | 352 | if (inst->qlen > 1) { |
| 352 | struct nlmsghdr *nlh = nlmsg_put(inst->skb, 0, 0, | 353 | struct nlmsghdr *nlh = nlmsg_put(inst->skb, 0, 0, |
| 353 | NLMSG_DONE, | 354 | NLMSG_DONE, |
| 354 | sizeof(struct nfgenmsg), | 355 | sizeof(struct nfgenmsg), |
| 355 | 0); | 356 | 0); |
| 356 | if (!nlh) | 357 | if (WARN_ONCE(!nlh, "bad nlskb size: %u, tailroom %d\n", |
| 358 | inst->skb->len, skb_tailroom(inst->skb))) { | ||
| 359 | kfree_skb(inst->skb); | ||
| 357 | goto out; | 360 | goto out; |
| 361 | } | ||
| 358 | } | 362 | } |
| 359 | status = nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, | 363 | nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, |
| 360 | MSG_DONTWAIT); | 364 | MSG_DONTWAIT); |
| 361 | 365 | out: | |
| 362 | inst->qlen = 0; | 366 | inst->qlen = 0; |
| 363 | inst->skb = NULL; | 367 | inst->skb = NULL; |
| 364 | out: | ||
| 365 | return status; | ||
| 366 | } | 368 | } |
| 367 | 369 | ||
| 368 | static void | 370 | static void |
| @@ -649,7 +651,8 @@ nfulnl_log_packet(struct net *net, | |||
| 649 | + nla_total_size(sizeof(u_int32_t)) /* gid */ | 651 | + nla_total_size(sizeof(u_int32_t)) /* gid */ |
| 650 | + nla_total_size(plen) /* prefix */ | 652 | + nla_total_size(plen) /* prefix */ |
| 651 | + nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) | 653 | + nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) |
| 652 | + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)); | 654 | + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)) |
| 655 | + nla_total_size(sizeof(struct nfgenmsg)); /* NLMSG_DONE */ | ||
| 653 | 656 | ||
| 654 | if (in && skb_mac_header_was_set(skb)) { | 657 | if (in && skb_mac_header_was_set(skb)) { |
| 655 | size += nla_total_size(skb->dev->hard_header_len) | 658 | size += nla_total_size(skb->dev->hard_header_len) |
| @@ -678,8 +681,7 @@ nfulnl_log_packet(struct net *net, | |||
| 678 | break; | 681 | break; |
| 679 | 682 | ||
| 680 | case NFULNL_COPY_PACKET: | 683 | case NFULNL_COPY_PACKET: |
| 681 | if (inst->copy_range == 0 | 684 | if (inst->copy_range > skb->len) |
| 682 | || inst->copy_range > skb->len) | ||
| 683 | data_len = skb->len; | 685 | data_len = skb->len; |
| 684 | else | 686 | else |
| 685 | data_len = inst->copy_range; | 687 | data_len = inst->copy_range; |
| @@ -692,8 +694,7 @@ nfulnl_log_packet(struct net *net, | |||
| 692 | goto unlock_and_release; | 694 | goto unlock_and_release; |
| 693 | } | 695 | } |
| 694 | 696 | ||
| 695 | if (inst->skb && | 697 | if (inst->skb && size > skb_tailroom(inst->skb)) { |
| 696 | size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) { | ||
| 697 | /* either the queue len is too high or we don't have | 698 | /* either the queue len is too high or we don't have |
| 698 | * enough room in the skb left. flush to userspace. */ | 699 | * enough room in the skb left. flush to userspace. */ |
| 699 | __nfulnl_flush(inst); | 700 | __nfulnl_flush(inst); |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index a82077d9f59b..7c60ccd61a3e 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
| @@ -665,7 +665,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
| 665 | * returned by nf_queue. For instance, callers rely on -ECANCELED to | 665 | * returned by nf_queue. For instance, callers rely on -ECANCELED to |
| 666 | * mean 'ignore this hook'. | 666 | * mean 'ignore this hook'. |
| 667 | */ | 667 | */ |
| 668 | if (IS_ERR(segs)) | 668 | if (IS_ERR_OR_NULL(segs)) |
| 669 | goto out_err; | 669 | goto out_err; |
| 670 | queued = 0; | 670 | queued = 0; |
| 671 | err = 0; | 671 | err = 0; |
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 7e2683c8a44a..9d6d6f60a80f 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
| @@ -19,9 +19,52 @@ | |||
| 19 | #include <linux/netfilter/x_tables.h> | 19 | #include <linux/netfilter/x_tables.h> |
| 20 | #include <linux/netfilter_ipv4/ip_tables.h> | 20 | #include <linux/netfilter_ipv4/ip_tables.h> |
| 21 | #include <linux/netfilter_ipv6/ip6_tables.h> | 21 | #include <linux/netfilter_ipv6/ip6_tables.h> |
| 22 | #include <asm/uaccess.h> /* for set_fs */ | ||
| 23 | #include <net/netfilter/nf_tables.h> | 22 | #include <net/netfilter/nf_tables.h> |
| 24 | 23 | ||
| 24 | static const struct { | ||
| 25 | const char *name; | ||
| 26 | u8 type; | ||
| 27 | } table_to_chaintype[] = { | ||
| 28 | { "filter", NFT_CHAIN_T_DEFAULT }, | ||
| 29 | { "raw", NFT_CHAIN_T_DEFAULT }, | ||
| 30 | { "security", NFT_CHAIN_T_DEFAULT }, | ||
| 31 | { "mangle", NFT_CHAIN_T_ROUTE }, | ||
| 32 | { "nat", NFT_CHAIN_T_NAT }, | ||
| 33 | { }, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static int nft_compat_table_to_chaintype(const char *table) | ||
| 37 | { | ||
| 38 | int i; | ||
| 39 | |||
| 40 | for (i = 0; table_to_chaintype[i].name != NULL; i++) { | ||
| 41 | if (strcmp(table_to_chaintype[i].name, table) == 0) | ||
| 42 | return table_to_chaintype[i].type; | ||
| 43 | } | ||
| 44 | |||
| 45 | return -1; | ||
| 46 | } | ||
| 47 | |||
| 48 | static int nft_compat_chain_validate_dependency(const char *tablename, | ||
| 49 | const struct nft_chain *chain) | ||
| 50 | { | ||
| 51 | enum nft_chain_type type; | ||
| 52 | const struct nft_base_chain *basechain; | ||
| 53 | |||
| 54 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) | ||
| 55 | return 0; | ||
| 56 | |||
| 57 | type = nft_compat_table_to_chaintype(tablename); | ||
| 58 | if (type < 0) | ||
| 59 | return -EINVAL; | ||
| 60 | |||
| 61 | basechain = nft_base_chain(chain); | ||
| 62 | if (basechain->type->type != type) | ||
| 63 | return -EINVAL; | ||
| 64 | |||
| 65 | return 0; | ||
| 66 | } | ||
| 67 | |||
| 25 | union nft_entry { | 68 | union nft_entry { |
| 26 | struct ipt_entry e4; | 69 | struct ipt_entry e4; |
| 27 | struct ip6t_entry e6; | 70 | struct ip6t_entry e6; |
| @@ -95,6 +138,8 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
| 95 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 138 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
| 96 | 139 | ||
| 97 | par->hook_mask = 1 << ops->hooknum; | 140 | par->hook_mask = 1 << ops->hooknum; |
| 141 | } else { | ||
| 142 | par->hook_mask = 0; | ||
| 98 | } | 143 | } |
| 99 | par->family = ctx->afi->family; | 144 | par->family = ctx->afi->family; |
| 100 | } | 145 | } |
| @@ -151,6 +196,10 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 151 | union nft_entry e = {}; | 196 | union nft_entry e = {}; |
| 152 | int ret; | 197 | int ret; |
| 153 | 198 | ||
| 199 | ret = nft_compat_chain_validate_dependency(target->table, ctx->chain); | ||
| 200 | if (ret < 0) | ||
| 201 | goto err; | ||
| 202 | |||
| 154 | target_compat_from_user(target, nla_data(tb[NFTA_TARGET_INFO]), info); | 203 | target_compat_from_user(target, nla_data(tb[NFTA_TARGET_INFO]), info); |
| 155 | 204 | ||
| 156 | if (ctx->nla[NFTA_RULE_COMPAT]) { | 205 | if (ctx->nla[NFTA_RULE_COMPAT]) { |
| @@ -216,6 +265,7 @@ static int nft_target_validate(const struct nft_ctx *ctx, | |||
| 216 | { | 265 | { |
| 217 | struct xt_target *target = expr->ops->data; | 266 | struct xt_target *target = expr->ops->data; |
| 218 | unsigned int hook_mask = 0; | 267 | unsigned int hook_mask = 0; |
| 268 | int ret; | ||
| 219 | 269 | ||
| 220 | if (ctx->chain->flags & NFT_BASE_CHAIN) { | 270 | if (ctx->chain->flags & NFT_BASE_CHAIN) { |
| 221 | const struct nft_base_chain *basechain = | 271 | const struct nft_base_chain *basechain = |
| @@ -223,11 +273,13 @@ static int nft_target_validate(const struct nft_ctx *ctx, | |||
| 223 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 273 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
| 224 | 274 | ||
| 225 | hook_mask = 1 << ops->hooknum; | 275 | hook_mask = 1 << ops->hooknum; |
| 226 | if (hook_mask & target->hooks) | 276 | if (!(hook_mask & target->hooks)) |
| 227 | return 0; | 277 | return -EINVAL; |
| 228 | 278 | ||
| 229 | /* This target is being called from an invalid chain */ | 279 | ret = nft_compat_chain_validate_dependency(target->table, |
| 230 | return -EINVAL; | 280 | ctx->chain); |
| 281 | if (ret < 0) | ||
| 282 | return ret; | ||
| 231 | } | 283 | } |
| 232 | return 0; | 284 | return 0; |
| 233 | } | 285 | } |
| @@ -293,6 +345,8 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
| 293 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 345 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
| 294 | 346 | ||
| 295 | par->hook_mask = 1 << ops->hooknum; | 347 | par->hook_mask = 1 << ops->hooknum; |
| 348 | } else { | ||
| 349 | par->hook_mask = 0; | ||
| 296 | } | 350 | } |
| 297 | par->family = ctx->afi->family; | 351 | par->family = ctx->afi->family; |
| 298 | } | 352 | } |
| @@ -320,6 +374,10 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 320 | union nft_entry e = {}; | 374 | union nft_entry e = {}; |
| 321 | int ret; | 375 | int ret; |
| 322 | 376 | ||
| 377 | ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); | ||
| 378 | if (ret < 0) | ||
| 379 | goto err; | ||
| 380 | |||
| 323 | match_compat_from_user(match, nla_data(tb[NFTA_MATCH_INFO]), info); | 381 | match_compat_from_user(match, nla_data(tb[NFTA_MATCH_INFO]), info); |
| 324 | 382 | ||
| 325 | if (ctx->nla[NFTA_RULE_COMPAT]) { | 383 | if (ctx->nla[NFTA_RULE_COMPAT]) { |
| @@ -379,6 +437,7 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
| 379 | { | 437 | { |
| 380 | struct xt_match *match = expr->ops->data; | 438 | struct xt_match *match = expr->ops->data; |
| 381 | unsigned int hook_mask = 0; | 439 | unsigned int hook_mask = 0; |
| 440 | int ret; | ||
| 382 | 441 | ||
| 383 | if (ctx->chain->flags & NFT_BASE_CHAIN) { | 442 | if (ctx->chain->flags & NFT_BASE_CHAIN) { |
| 384 | const struct nft_base_chain *basechain = | 443 | const struct nft_base_chain *basechain = |
| @@ -386,11 +445,13 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
| 386 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 445 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
| 387 | 446 | ||
| 388 | hook_mask = 1 << ops->hooknum; | 447 | hook_mask = 1 << ops->hooknum; |
| 389 | if (hook_mask & match->hooks) | 448 | if (!(hook_mask & match->hooks)) |
| 390 | return 0; | 449 | return -EINVAL; |
| 391 | 450 | ||
| 392 | /* This match is being called from an invalid chain */ | 451 | ret = nft_compat_chain_validate_dependency(match->name, |
| 393 | return -EINVAL; | 452 | ctx->chain); |
| 453 | if (ret < 0) | ||
| 454 | return ret; | ||
| 394 | } | 455 | } |
| 395 | return 0; | 456 | return 0; |
| 396 | } | 457 | } |
| @@ -611,7 +672,7 @@ nft_target_select_ops(const struct nft_ctx *ctx, | |||
| 611 | family = ctx->afi->family; | 672 | family = ctx->afi->family; |
| 612 | 673 | ||
| 613 | /* Re-use the existing target if it's already loaded. */ | 674 | /* Re-use the existing target if it's already loaded. */ |
| 614 | list_for_each_entry(nft_target, &nft_match_list, head) { | 675 | list_for_each_entry(nft_target, &nft_target_list, head) { |
| 615 | struct xt_target *target = nft_target->ops.data; | 676 | struct xt_target *target = nft_target->ops.data; |
| 616 | 677 | ||
| 617 | if (strcmp(target->name, tg_name) == 0 && | 678 | if (strcmp(target->name, tg_name) == 0 && |
diff --git a/net/netfilter/nft_masq.c b/net/netfilter/nft_masq.c index 6637bab00567..d1ffd5eb3a9b 100644 --- a/net/netfilter/nft_masq.c +++ b/net/netfilter/nft_masq.c | |||
| @@ -26,6 +26,11 @@ int nft_masq_init(const struct nft_ctx *ctx, | |||
| 26 | const struct nlattr * const tb[]) | 26 | const struct nlattr * const tb[]) |
| 27 | { | 27 | { |
| 28 | struct nft_masq *priv = nft_expr_priv(expr); | 28 | struct nft_masq *priv = nft_expr_priv(expr); |
| 29 | int err; | ||
| 30 | |||
| 31 | err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); | ||
| 32 | if (err < 0) | ||
| 33 | return err; | ||
| 29 | 34 | ||
| 30 | if (tb[NFTA_MASQ_FLAGS] == NULL) | 35 | if (tb[NFTA_MASQ_FLAGS] == NULL) |
| 31 | return 0; | 36 | return 0; |
| @@ -55,5 +60,12 @@ nla_put_failure: | |||
| 55 | } | 60 | } |
| 56 | EXPORT_SYMBOL_GPL(nft_masq_dump); | 61 | EXPORT_SYMBOL_GPL(nft_masq_dump); |
| 57 | 62 | ||
| 63 | int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
| 64 | const struct nft_data **data) | ||
| 65 | { | ||
| 66 | return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); | ||
| 67 | } | ||
| 68 | EXPORT_SYMBOL_GPL(nft_masq_validate); | ||
| 69 | |||
| 58 | MODULE_LICENSE("GPL"); | 70 | MODULE_LICENSE("GPL"); |
| 59 | MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>"); | 71 | MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>"); |
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index 799550b476fb..afe2b0b45ec4 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c | |||
| @@ -95,7 +95,13 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 95 | u32 family; | 95 | u32 family; |
| 96 | int err; | 96 | int err; |
| 97 | 97 | ||
| 98 | if (tb[NFTA_NAT_TYPE] == NULL) | 98 | err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); |
| 99 | if (err < 0) | ||
| 100 | return err; | ||
| 101 | |||
| 102 | if (tb[NFTA_NAT_TYPE] == NULL || | ||
| 103 | (tb[NFTA_NAT_REG_ADDR_MIN] == NULL && | ||
| 104 | tb[NFTA_NAT_REG_PROTO_MIN] == NULL)) | ||
| 99 | return -EINVAL; | 105 | return -EINVAL; |
| 100 | 106 | ||
| 101 | switch (ntohl(nla_get_be32(tb[NFTA_NAT_TYPE]))) { | 107 | switch (ntohl(nla_get_be32(tb[NFTA_NAT_TYPE]))) { |
| @@ -120,38 +126,44 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
| 120 | priv->family = family; | 126 | priv->family = family; |
| 121 | 127 | ||
| 122 | if (tb[NFTA_NAT_REG_ADDR_MIN]) { | 128 | if (tb[NFTA_NAT_REG_ADDR_MIN]) { |
| 123 | priv->sreg_addr_min = ntohl(nla_get_be32( | 129 | priv->sreg_addr_min = |
| 124 | tb[NFTA_NAT_REG_ADDR_MIN])); | 130 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_ADDR_MIN])); |
| 131 | |||
| 125 | err = nft_validate_input_register(priv->sreg_addr_min); | 132 | err = nft_validate_input_register(priv->sreg_addr_min); |
| 126 | if (err < 0) | 133 | if (err < 0) |
| 127 | return err; | 134 | return err; |
| 128 | } | ||
| 129 | 135 | ||
| 130 | if (tb[NFTA_NAT_REG_ADDR_MAX]) { | 136 | if (tb[NFTA_NAT_REG_ADDR_MAX]) { |
| 131 | priv->sreg_addr_max = ntohl(nla_get_be32( | 137 | priv->sreg_addr_max = |
| 132 | tb[NFTA_NAT_REG_ADDR_MAX])); | 138 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_ADDR_MAX])); |
| 133 | err = nft_validate_input_register(priv->sreg_addr_max); | 139 | |
| 134 | if (err < 0) | 140 | err = nft_validate_input_register(priv->sreg_addr_max); |
| 135 | return err; | 141 | if (err < 0) |
| 136 | } else | 142 | return err; |
| 137 | priv->sreg_addr_max = priv->sreg_addr_min; | 143 | } else { |
| 144 | priv->sreg_addr_max = priv->sreg_addr_min; | ||
| 145 | } | ||
| 146 | } | ||
| 138 | 147 | ||
| 139 | if (tb[NFTA_NAT_REG_PROTO_MIN]) { | 148 | if (tb[NFTA_NAT_REG_PROTO_MIN]) { |
| 140 | priv->sreg_proto_min = ntohl(nla_get_be32( | 149 | priv->sreg_proto_min = |
| 141 | tb[NFTA_NAT_REG_PROTO_MIN])); | 150 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_PROTO_MIN])); |
| 151 | |||
| 142 | err = nft_validate_input_register(priv->sreg_proto_min); | 152 | err = nft_validate_input_register(priv->sreg_proto_min); |
| 143 | if (err < 0) | 153 | if (err < 0) |
| 144 | return err; | 154 | return err; |
| 145 | } | ||
| 146 | 155 | ||
| 147 | if (tb[NFTA_NAT_REG_PROTO_MAX]) { | 156 | if (tb[NFTA_NAT_REG_PROTO_MAX]) { |
| 148 | priv->sreg_proto_max = ntohl(nla_get_be32( | 157 | priv->sreg_proto_max = |
| 149 | tb[NFTA_NAT_REG_PROTO_MAX])); | 158 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_PROTO_MAX])); |
| 150 | err = nft_validate_input_register(priv->sreg_proto_max); | 159 | |
| 151 | if (err < 0) | 160 | err = nft_validate_input_register(priv->sreg_proto_max); |
| 152 | return err; | 161 | if (err < 0) |
| 153 | } else | 162 | return err; |
| 154 | priv->sreg_proto_max = priv->sreg_proto_min; | 163 | } else { |
| 164 | priv->sreg_proto_max = priv->sreg_proto_min; | ||
| 165 | } | ||
| 166 | } | ||
| 155 | 167 | ||
| 156 | if (tb[NFTA_NAT_FLAGS]) { | 168 | if (tb[NFTA_NAT_FLAGS]) { |
| 157 | priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS])); | 169 | priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS])); |
| @@ -179,17 +191,19 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
| 179 | 191 | ||
| 180 | if (nla_put_be32(skb, NFTA_NAT_FAMILY, htonl(priv->family))) | 192 | if (nla_put_be32(skb, NFTA_NAT_FAMILY, htonl(priv->family))) |
| 181 | goto nla_put_failure; | 193 | goto nla_put_failure; |
| 182 | if (nla_put_be32(skb, | 194 | |
| 183 | NFTA_NAT_REG_ADDR_MIN, htonl(priv->sreg_addr_min))) | 195 | if (priv->sreg_addr_min) { |
| 184 | goto nla_put_failure; | 196 | if (nla_put_be32(skb, NFTA_NAT_REG_ADDR_MIN, |
| 185 | if (nla_put_be32(skb, | 197 | htonl(priv->sreg_addr_min)) || |
| 186 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) | 198 | nla_put_be32(skb, NFTA_NAT_REG_ADDR_MAX, |
| 187 | goto nla_put_failure; | 199 | htonl(priv->sreg_addr_max))) |
| 200 | goto nla_put_failure; | ||
| 201 | } | ||
| 202 | |||
| 188 | if (priv->sreg_proto_min) { | 203 | if (priv->sreg_proto_min) { |
| 189 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, | 204 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, |
| 190 | htonl(priv->sreg_proto_min))) | 205 | htonl(priv->sreg_proto_min)) || |
| 191 | goto nla_put_failure; | 206 | nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, |
| 192 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, | ||
| 193 | htonl(priv->sreg_proto_max))) | 207 | htonl(priv->sreg_proto_max))) |
| 194 | goto nla_put_failure; | 208 | goto nla_put_failure; |
| 195 | } | 209 | } |
| @@ -205,6 +219,13 @@ nla_put_failure: | |||
| 205 | return -1; | 219 | return -1; |
| 206 | } | 220 | } |
| 207 | 221 | ||
| 222 | static int nft_nat_validate(const struct nft_ctx *ctx, | ||
| 223 | const struct nft_expr *expr, | ||
| 224 | const struct nft_data **data) | ||
| 225 | { | ||
| 226 | return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); | ||
| 227 | } | ||
| 228 | |||
| 208 | static struct nft_expr_type nft_nat_type; | 229 | static struct nft_expr_type nft_nat_type; |
| 209 | static const struct nft_expr_ops nft_nat_ops = { | 230 | static const struct nft_expr_ops nft_nat_ops = { |
| 210 | .type = &nft_nat_type, | 231 | .type = &nft_nat_type, |
| @@ -212,6 +233,7 @@ static const struct nft_expr_ops nft_nat_ops = { | |||
| 212 | .eval = nft_nat_eval, | 233 | .eval = nft_nat_eval, |
| 213 | .init = nft_nat_init, | 234 | .init = nft_nat_init, |
| 214 | .dump = nft_nat_dump, | 235 | .dump = nft_nat_dump, |
| 236 | .validate = nft_nat_validate, | ||
| 215 | }; | 237 | }; |
| 216 | 238 | ||
| 217 | static struct nft_expr_type nft_nat_type __read_mostly = { | 239 | static struct nft_expr_type nft_nat_type __read_mostly = { |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 7a186e74b1b3..f1de72de273e 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -96,6 +96,14 @@ static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); | |||
| 96 | static int netlink_dump(struct sock *sk); | 96 | static int netlink_dump(struct sock *sk); |
| 97 | static void netlink_skb_destructor(struct sk_buff *skb); | 97 | static void netlink_skb_destructor(struct sk_buff *skb); |
| 98 | 98 | ||
| 99 | /* nl_table locking explained: | ||
| 100 | * Lookup and traversal are protected with nl_sk_hash_lock or nl_table_lock | ||
| 101 | * combined with an RCU read-side lock. Insertion and removal are protected | ||
| 102 | * with nl_sk_hash_lock while using RCU list modification primitives and may | ||
| 103 | * run in parallel to nl_table_lock protected lookups. Destruction of the | ||
| 104 | * Netlink socket may only occur *after* nl_table_lock has been acquired | ||
| 105 | * either during or after the socket has been removed from the list. | ||
| 106 | */ | ||
| 99 | DEFINE_RWLOCK(nl_table_lock); | 107 | DEFINE_RWLOCK(nl_table_lock); |
| 100 | EXPORT_SYMBOL_GPL(nl_table_lock); | 108 | EXPORT_SYMBOL_GPL(nl_table_lock); |
| 101 | static atomic_t nl_table_users = ATOMIC_INIT(0); | 109 | static atomic_t nl_table_users = ATOMIC_INIT(0); |
| @@ -109,10 +117,10 @@ EXPORT_SYMBOL_GPL(nl_sk_hash_lock); | |||
| 109 | static int lockdep_nl_sk_hash_is_held(void) | 117 | static int lockdep_nl_sk_hash_is_held(void) |
| 110 | { | 118 | { |
| 111 | #ifdef CONFIG_LOCKDEP | 119 | #ifdef CONFIG_LOCKDEP |
| 112 | return (debug_locks) ? lockdep_is_held(&nl_sk_hash_lock) : 1; | 120 | if (debug_locks) |
| 113 | #else | 121 | return lockdep_is_held(&nl_sk_hash_lock) || lockdep_is_held(&nl_table_lock); |
| 114 | return 1; | ||
| 115 | #endif | 122 | #endif |
| 123 | return 1; | ||
| 116 | } | 124 | } |
| 117 | 125 | ||
| 118 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); | 126 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); |
| @@ -1028,11 +1036,13 @@ static struct sock *netlink_lookup(struct net *net, int protocol, u32 portid) | |||
| 1028 | struct netlink_table *table = &nl_table[protocol]; | 1036 | struct netlink_table *table = &nl_table[protocol]; |
| 1029 | struct sock *sk; | 1037 | struct sock *sk; |
| 1030 | 1038 | ||
| 1039 | read_lock(&nl_table_lock); | ||
| 1031 | rcu_read_lock(); | 1040 | rcu_read_lock(); |
| 1032 | sk = __netlink_lookup(table, portid, net); | 1041 | sk = __netlink_lookup(table, portid, net); |
| 1033 | if (sk) | 1042 | if (sk) |
| 1034 | sock_hold(sk); | 1043 | sock_hold(sk); |
| 1035 | rcu_read_unlock(); | 1044 | rcu_read_unlock(); |
| 1045 | read_unlock(&nl_table_lock); | ||
| 1036 | 1046 | ||
| 1037 | return sk; | 1047 | return sk; |
| 1038 | } | 1048 | } |
| @@ -1257,9 +1267,6 @@ static int netlink_release(struct socket *sock) | |||
| 1257 | } | 1267 | } |
| 1258 | netlink_table_ungrab(); | 1268 | netlink_table_ungrab(); |
| 1259 | 1269 | ||
| 1260 | /* Wait for readers to complete */ | ||
| 1261 | synchronize_net(); | ||
| 1262 | |||
| 1263 | kfree(nlk->groups); | 1270 | kfree(nlk->groups); |
| 1264 | nlk->groups = NULL; | 1271 | nlk->groups = NULL; |
| 1265 | 1272 | ||
| @@ -1281,6 +1288,7 @@ static int netlink_autobind(struct socket *sock) | |||
| 1281 | 1288 | ||
| 1282 | retry: | 1289 | retry: |
| 1283 | cond_resched(); | 1290 | cond_resched(); |
| 1291 | netlink_table_grab(); | ||
| 1284 | rcu_read_lock(); | 1292 | rcu_read_lock(); |
| 1285 | if (__netlink_lookup(table, portid, net)) { | 1293 | if (__netlink_lookup(table, portid, net)) { |
| 1286 | /* Bind collision, search negative portid values. */ | 1294 | /* Bind collision, search negative portid values. */ |
| @@ -1288,9 +1296,11 @@ retry: | |||
| 1288 | if (rover > -4097) | 1296 | if (rover > -4097) |
| 1289 | rover = -4097; | 1297 | rover = -4097; |
| 1290 | rcu_read_unlock(); | 1298 | rcu_read_unlock(); |
| 1299 | netlink_table_ungrab(); | ||
| 1291 | goto retry; | 1300 | goto retry; |
| 1292 | } | 1301 | } |
| 1293 | rcu_read_unlock(); | 1302 | rcu_read_unlock(); |
| 1303 | netlink_table_ungrab(); | ||
| 1294 | 1304 | ||
| 1295 | err = netlink_insert(sk, net, portid); | 1305 | err = netlink_insert(sk, net, portid); |
| 1296 | if (err == -EADDRINUSE) | 1306 | if (err == -EADDRINUSE) |
| @@ -2921,14 +2931,16 @@ static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos) | |||
| 2921 | } | 2931 | } |
| 2922 | 2932 | ||
| 2923 | static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) | 2933 | static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) |
| 2924 | __acquires(RCU) | 2934 | __acquires(nl_table_lock) __acquires(RCU) |
| 2925 | { | 2935 | { |
| 2936 | read_lock(&nl_table_lock); | ||
| 2926 | rcu_read_lock(); | 2937 | rcu_read_lock(); |
| 2927 | return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 2938 | return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
| 2928 | } | 2939 | } |
| 2929 | 2940 | ||
| 2930 | static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2941 | static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 2931 | { | 2942 | { |
| 2943 | struct rhashtable *ht; | ||
| 2932 | struct netlink_sock *nlk; | 2944 | struct netlink_sock *nlk; |
| 2933 | struct nl_seq_iter *iter; | 2945 | struct nl_seq_iter *iter; |
| 2934 | struct net *net; | 2946 | struct net *net; |
| @@ -2943,19 +2955,19 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
| 2943 | iter = seq->private; | 2955 | iter = seq->private; |
| 2944 | nlk = v; | 2956 | nlk = v; |
| 2945 | 2957 | ||
| 2946 | rht_for_each_entry_rcu(nlk, nlk->node.next, node) | 2958 | i = iter->link; |
| 2959 | ht = &nl_table[i].hash; | ||
| 2960 | rht_for_each_entry(nlk, nlk->node.next, ht, node) | ||
| 2947 | if (net_eq(sock_net((struct sock *)nlk), net)) | 2961 | if (net_eq(sock_net((struct sock *)nlk), net)) |
| 2948 | return nlk; | 2962 | return nlk; |
| 2949 | 2963 | ||
| 2950 | i = iter->link; | ||
| 2951 | j = iter->hash_idx + 1; | 2964 | j = iter->hash_idx + 1; |
| 2952 | 2965 | ||
| 2953 | do { | 2966 | do { |
| 2954 | struct rhashtable *ht = &nl_table[i].hash; | ||
| 2955 | const struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht); | 2967 | const struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht); |
| 2956 | 2968 | ||
| 2957 | for (; j < tbl->size; j++) { | 2969 | for (; j < tbl->size; j++) { |
| 2958 | rht_for_each_entry_rcu(nlk, tbl->buckets[j], node) { | 2970 | rht_for_each_entry(nlk, tbl->buckets[j], ht, node) { |
| 2959 | if (net_eq(sock_net((struct sock *)nlk), net)) { | 2971 | if (net_eq(sock_net((struct sock *)nlk), net)) { |
| 2960 | iter->link = i; | 2972 | iter->link = i; |
| 2961 | iter->hash_idx = j; | 2973 | iter->hash_idx = j; |
| @@ -2971,9 +2983,10 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
| 2971 | } | 2983 | } |
| 2972 | 2984 | ||
| 2973 | static void netlink_seq_stop(struct seq_file *seq, void *v) | 2985 | static void netlink_seq_stop(struct seq_file *seq, void *v) |
| 2974 | __releases(RCU) | 2986 | __releases(RCU) __releases(nl_table_lock) |
| 2975 | { | 2987 | { |
| 2976 | rcu_read_unlock(); | 2988 | rcu_read_unlock(); |
| 2989 | read_unlock(&nl_table_lock); | ||
| 2977 | } | 2990 | } |
| 2978 | 2991 | ||
| 2979 | 2992 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 2e31d9e7f4dc..e6d7255183eb 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -324,6 +324,8 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, | |||
| 324 | segs = __skb_gso_segment(skb, NETIF_F_SG, false); | 324 | segs = __skb_gso_segment(skb, NETIF_F_SG, false); |
| 325 | if (IS_ERR(segs)) | 325 | if (IS_ERR(segs)) |
| 326 | return PTR_ERR(segs); | 326 | return PTR_ERR(segs); |
| 327 | if (segs == NULL) | ||
| 328 | return -EINVAL; | ||
| 327 | 329 | ||
| 328 | /* Queue all of the segments. */ | 330 | /* Queue all of the segments. */ |
| 329 | skb = segs; | 331 | skb = segs; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2cf61b3e633c..76f402e05bd6 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
| @@ -947,7 +947,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
| 947 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS])) == 0) { | 947 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS])) == 0) { |
| 948 | if (qdisc_is_percpu_stats(sch)) { | 948 | if (qdisc_is_percpu_stats(sch)) { |
| 949 | sch->cpu_bstats = | 949 | sch->cpu_bstats = |
| 950 | alloc_percpu(struct gnet_stats_basic_cpu); | 950 | netdev_alloc_pcpu_stats(struct gnet_stats_basic_cpu); |
| 951 | if (!sch->cpu_bstats) | 951 | if (!sch->cpu_bstats) |
| 952 | goto err_out4; | 952 | goto err_out4; |
| 953 | 953 | ||
diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c index 33d7a98a7a97..b783a446d884 100644 --- a/net/sched/sch_pie.c +++ b/net/sched/sch_pie.c | |||
| @@ -445,7 +445,6 @@ static int pie_init(struct Qdisc *sch, struct nlattr *opt) | |||
| 445 | sch->limit = q->params.limit; | 445 | sch->limit = q->params.limit; |
| 446 | 446 | ||
| 447 | setup_timer(&q->adapt_timer, pie_timer, (unsigned long)sch); | 447 | setup_timer(&q->adapt_timer, pie_timer, (unsigned long)sch); |
| 448 | mod_timer(&q->adapt_timer, jiffies + HZ / 2); | ||
| 449 | 448 | ||
| 450 | if (opt) { | 449 | if (opt) { |
| 451 | int err = pie_change(sch, opt); | 450 | int err = pie_change(sch, opt); |
| @@ -454,6 +453,7 @@ static int pie_init(struct Qdisc *sch, struct nlattr *opt) | |||
| 454 | return err; | 453 | return err; |
| 455 | } | 454 | } |
| 456 | 455 | ||
| 456 | mod_timer(&q->adapt_timer, jiffies + HZ / 2); | ||
| 457 | return 0; | 457 | return 0; |
| 458 | } | 458 | } |
| 459 | 459 | ||
diff --git a/net/tipc/node.c b/net/tipc/node.c index 90cee4a6fce4..5781634e957d 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
| @@ -219,11 +219,11 @@ void tipc_node_abort_sock_conns(struct list_head *conns) | |||
| 219 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | 219 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) |
| 220 | { | 220 | { |
| 221 | struct tipc_link **active = &n_ptr->active_links[0]; | 221 | struct tipc_link **active = &n_ptr->active_links[0]; |
| 222 | u32 addr = n_ptr->addr; | ||
| 223 | 222 | ||
| 224 | n_ptr->working_links++; | 223 | n_ptr->working_links++; |
| 225 | tipc_nametbl_publish(TIPC_LINK_STATE, addr, addr, TIPC_NODE_SCOPE, | 224 | n_ptr->action_flags |= TIPC_NOTIFY_LINK_UP; |
| 226 | l_ptr->bearer_id, addr); | 225 | n_ptr->link_id = l_ptr->peer_bearer_id << 16 | l_ptr->bearer_id; |
| 226 | |||
| 227 | pr_info("Established link <%s> on network plane %c\n", | 227 | pr_info("Established link <%s> on network plane %c\n", |
| 228 | l_ptr->name, l_ptr->net_plane); | 228 | l_ptr->name, l_ptr->net_plane); |
| 229 | 229 | ||
| @@ -284,10 +284,10 @@ static void node_select_active_links(struct tipc_node *n_ptr) | |||
| 284 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | 284 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) |
| 285 | { | 285 | { |
| 286 | struct tipc_link **active; | 286 | struct tipc_link **active; |
| 287 | u32 addr = n_ptr->addr; | ||
| 288 | 287 | ||
| 289 | n_ptr->working_links--; | 288 | n_ptr->working_links--; |
| 290 | tipc_nametbl_withdraw(TIPC_LINK_STATE, addr, l_ptr->bearer_id, addr); | 289 | n_ptr->action_flags |= TIPC_NOTIFY_LINK_DOWN; |
| 290 | n_ptr->link_id = l_ptr->peer_bearer_id << 16 | l_ptr->bearer_id; | ||
| 291 | 291 | ||
| 292 | if (!tipc_link_is_active(l_ptr)) { | 292 | if (!tipc_link_is_active(l_ptr)) { |
| 293 | pr_info("Lost standby link <%s> on network plane %c\n", | 293 | pr_info("Lost standby link <%s> on network plane %c\n", |
| @@ -552,28 +552,30 @@ void tipc_node_unlock(struct tipc_node *node) | |||
| 552 | LIST_HEAD(conn_sks); | 552 | LIST_HEAD(conn_sks); |
| 553 | struct sk_buff_head waiting_sks; | 553 | struct sk_buff_head waiting_sks; |
| 554 | u32 addr = 0; | 554 | u32 addr = 0; |
| 555 | unsigned int flags = node->action_flags; | 555 | int flags = node->action_flags; |
| 556 | u32 link_id = 0; | ||
| 556 | 557 | ||
| 557 | if (likely(!node->action_flags)) { | 558 | if (likely(!flags)) { |
| 558 | spin_unlock_bh(&node->lock); | 559 | spin_unlock_bh(&node->lock); |
| 559 | return; | 560 | return; |
| 560 | } | 561 | } |
| 561 | 562 | ||
| 563 | addr = node->addr; | ||
| 564 | link_id = node->link_id; | ||
| 562 | __skb_queue_head_init(&waiting_sks); | 565 | __skb_queue_head_init(&waiting_sks); |
| 563 | if (node->action_flags & TIPC_WAKEUP_USERS) { | 566 | |
| 567 | if (flags & TIPC_WAKEUP_USERS) | ||
| 564 | skb_queue_splice_init(&node->waiting_sks, &waiting_sks); | 568 | skb_queue_splice_init(&node->waiting_sks, &waiting_sks); |
| 565 | node->action_flags &= ~TIPC_WAKEUP_USERS; | 569 | |
| 566 | } | 570 | if (flags & TIPC_NOTIFY_NODE_DOWN) { |
| 567 | if (node->action_flags & TIPC_NOTIFY_NODE_DOWN) { | ||
| 568 | list_replace_init(&node->nsub, &nsub_list); | 571 | list_replace_init(&node->nsub, &nsub_list); |
| 569 | list_replace_init(&node->conn_sks, &conn_sks); | 572 | list_replace_init(&node->conn_sks, &conn_sks); |
| 570 | node->action_flags &= ~TIPC_NOTIFY_NODE_DOWN; | ||
| 571 | } | 573 | } |
| 572 | if (node->action_flags & TIPC_NOTIFY_NODE_UP) { | 574 | node->action_flags &= ~(TIPC_WAKEUP_USERS | TIPC_NOTIFY_NODE_DOWN | |
| 573 | node->action_flags &= ~TIPC_NOTIFY_NODE_UP; | 575 | TIPC_NOTIFY_NODE_UP | TIPC_NOTIFY_LINK_UP | |
| 574 | addr = node->addr; | 576 | TIPC_NOTIFY_LINK_DOWN | |
| 575 | } | 577 | TIPC_WAKEUP_BCAST_USERS); |
| 576 | node->action_flags &= ~TIPC_WAKEUP_BCAST_USERS; | 578 | |
| 577 | spin_unlock_bh(&node->lock); | 579 | spin_unlock_bh(&node->lock); |
| 578 | 580 | ||
| 579 | while (!skb_queue_empty(&waiting_sks)) | 581 | while (!skb_queue_empty(&waiting_sks)) |
| @@ -588,6 +590,14 @@ void tipc_node_unlock(struct tipc_node *node) | |||
| 588 | if (flags & TIPC_WAKEUP_BCAST_USERS) | 590 | if (flags & TIPC_WAKEUP_BCAST_USERS) |
| 589 | tipc_bclink_wakeup_users(); | 591 | tipc_bclink_wakeup_users(); |
| 590 | 592 | ||
| 591 | if (addr) | 593 | if (flags & TIPC_NOTIFY_NODE_UP) |
| 592 | tipc_named_node_up(addr); | 594 | tipc_named_node_up(addr); |
| 595 | |||
| 596 | if (flags & TIPC_NOTIFY_LINK_UP) | ||
| 597 | tipc_nametbl_publish(TIPC_LINK_STATE, addr, addr, | ||
| 598 | TIPC_NODE_SCOPE, link_id, addr); | ||
| 599 | |||
| 600 | if (flags & TIPC_NOTIFY_LINK_DOWN) | ||
| 601 | tipc_nametbl_withdraw(TIPC_LINK_STATE, addr, | ||
| 602 | link_id, addr); | ||
| 593 | } | 603 | } |
diff --git a/net/tipc/node.h b/net/tipc/node.h index 67513c3c852c..04e91458bb29 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
| @@ -53,6 +53,7 @@ | |||
| 53 | * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down | 53 | * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down |
| 54 | * TIPC_NOTIFY_NODE_DOWN: notify node is down | 54 | * TIPC_NOTIFY_NODE_DOWN: notify node is down |
| 55 | * TIPC_NOTIFY_NODE_UP: notify node is up | 55 | * TIPC_NOTIFY_NODE_UP: notify node is up |
| 56 | * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type | ||
| 56 | */ | 57 | */ |
| 57 | enum { | 58 | enum { |
| 58 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), | 59 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), |
| @@ -60,7 +61,9 @@ enum { | |||
| 60 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), | 61 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), |
| 61 | TIPC_NOTIFY_NODE_UP = (1 << 4), | 62 | TIPC_NOTIFY_NODE_UP = (1 << 4), |
| 62 | TIPC_WAKEUP_USERS = (1 << 5), | 63 | TIPC_WAKEUP_USERS = (1 << 5), |
| 63 | TIPC_WAKEUP_BCAST_USERS = (1 << 6) | 64 | TIPC_WAKEUP_BCAST_USERS = (1 << 6), |
| 65 | TIPC_NOTIFY_LINK_UP = (1 << 7), | ||
| 66 | TIPC_NOTIFY_LINK_DOWN = (1 << 8) | ||
| 64 | }; | 67 | }; |
| 65 | 68 | ||
| 66 | /** | 69 | /** |
| @@ -100,6 +103,7 @@ struct tipc_node_bclink { | |||
| 100 | * @working_links: number of working links to node (both active and standby) | 103 | * @working_links: number of working links to node (both active and standby) |
| 101 | * @link_cnt: number of links to node | 104 | * @link_cnt: number of links to node |
| 102 | * @signature: node instance identifier | 105 | * @signature: node instance identifier |
| 106 | * @link_id: local and remote bearer ids of changing link, if any | ||
| 103 | * @nsub: list of "node down" subscriptions monitoring node | 107 | * @nsub: list of "node down" subscriptions monitoring node |
| 104 | * @rcu: rcu struct for tipc_node | 108 | * @rcu: rcu struct for tipc_node |
| 105 | */ | 109 | */ |
| @@ -116,6 +120,7 @@ struct tipc_node { | |||
| 116 | int link_cnt; | 120 | int link_cnt; |
| 117 | int working_links; | 121 | int working_links; |
| 118 | u32 signature; | 122 | u32 signature; |
| 123 | u32 link_id; | ||
| 119 | struct list_head nsub; | 124 | struct list_head nsub; |
| 120 | struct sk_buff_head waiting_sks; | 125 | struct sk_buff_head waiting_sks; |
| 121 | struct list_head conn_sks; | 126 | struct list_head conn_sks; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 75275c5cf929..51bddc236a15 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
| @@ -1776,7 +1776,7 @@ int tipc_sk_rcv(struct sk_buff *buf) | |||
| 1776 | sk = &tsk->sk; | 1776 | sk = &tsk->sk; |
| 1777 | 1777 | ||
| 1778 | /* Queue message */ | 1778 | /* Queue message */ |
| 1779 | bh_lock_sock(sk); | 1779 | spin_lock_bh(&sk->sk_lock.slock); |
| 1780 | 1780 | ||
| 1781 | if (!sock_owned_by_user(sk)) { | 1781 | if (!sock_owned_by_user(sk)) { |
| 1782 | rc = filter_rcv(sk, buf); | 1782 | rc = filter_rcv(sk, buf); |
| @@ -1787,7 +1787,7 @@ int tipc_sk_rcv(struct sk_buff *buf) | |||
| 1787 | if (sk_add_backlog(sk, buf, limit)) | 1787 | if (sk_add_backlog(sk, buf, limit)) |
| 1788 | rc = -TIPC_ERR_OVERLOAD; | 1788 | rc = -TIPC_ERR_OVERLOAD; |
| 1789 | } | 1789 | } |
| 1790 | bh_unlock_sock(sk); | 1790 | spin_unlock_bh(&sk->sk_lock.slock); |
| 1791 | tipc_sk_put(tsk); | 1791 | tipc_sk_put(tsk); |
| 1792 | if (likely(!rc)) | 1792 | if (likely(!rc)) |
| 1793 | return 0; | 1793 | return 0; |
| @@ -2673,7 +2673,7 @@ static int tipc_ioctl(struct socket *sk, unsigned int cmd, unsigned long arg) | |||
| 2673 | case SIOCGETLINKNAME: | 2673 | case SIOCGETLINKNAME: |
| 2674 | if (copy_from_user(&lnr, argp, sizeof(lnr))) | 2674 | if (copy_from_user(&lnr, argp, sizeof(lnr))) |
| 2675 | return -EFAULT; | 2675 | return -EFAULT; |
| 2676 | if (!tipc_node_get_linkname(lnr.bearer_id, lnr.peer, | 2676 | if (!tipc_node_get_linkname(lnr.bearer_id & 0xffff, lnr.peer, |
| 2677 | lnr.linkname, TIPC_MAX_LINK_NAME)) { | 2677 | lnr.linkname, TIPC_MAX_LINK_NAME)) { |
| 2678 | if (copy_to_user(argp, &lnr, sizeof(lnr))) | 2678 | if (copy_to_user(argp, &lnr, sizeof(lnr))) |
| 2679 | return -EFAULT; | 2679 | return -EFAULT; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index cb9f5a44ffad..5839c85075f1 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -5927,6 +5927,7 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
| 5927 | int err; | 5927 | int err; |
| 5928 | bool need_new_beacon = false; | 5928 | bool need_new_beacon = false; |
| 5929 | int len, i; | 5929 | int len, i; |
| 5930 | u32 cs_count; | ||
| 5930 | 5931 | ||
| 5931 | if (!rdev->ops->channel_switch || | 5932 | if (!rdev->ops->channel_switch || |
| 5932 | !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) | 5933 | !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) |
| @@ -5963,7 +5964,14 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
| 5963 | if (need_new_beacon && !info->attrs[NL80211_ATTR_CSA_IES]) | 5964 | if (need_new_beacon && !info->attrs[NL80211_ATTR_CSA_IES]) |
| 5964 | return -EINVAL; | 5965 | return -EINVAL; |
| 5965 | 5966 | ||
| 5966 | params.count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]); | 5967 | /* Even though the attribute is u32, the specification says |
| 5968 | * u8, so let's make sure we don't overflow. | ||
| 5969 | */ | ||
| 5970 | cs_count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]); | ||
| 5971 | if (cs_count > 255) | ||
| 5972 | return -EINVAL; | ||
| 5973 | |||
| 5974 | params.count = cs_count; | ||
| 5967 | 5975 | ||
| 5968 | if (!need_new_beacon) | 5976 | if (!need_new_beacon) |
| 5969 | goto skip_beacons; | 5977 | goto skip_beacons; |
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 499d6c18a8ce..7c532856b398 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
| @@ -157,6 +157,8 @@ static int xfrm_output_gso(struct sk_buff *skb) | |||
| 157 | kfree_skb(skb); | 157 | kfree_skb(skb); |
| 158 | if (IS_ERR(segs)) | 158 | if (IS_ERR(segs)) |
| 159 | return PTR_ERR(segs); | 159 | return PTR_ERR(segs); |
| 160 | if (segs == NULL) | ||
| 161 | return -EINVAL; | ||
| 160 | 162 | ||
| 161 | do { | 163 | do { |
| 162 | struct sk_buff *nskb = segs->next; | 164 | struct sk_buff *nskb = segs->next; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 4c4e457e7888..88bf289abdc9 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -1962,7 +1962,7 @@ static int xdst_queue_output(struct sock *sk, struct sk_buff *skb) | |||
| 1962 | struct xfrm_policy *pol = xdst->pols[0]; | 1962 | struct xfrm_policy *pol = xdst->pols[0]; |
| 1963 | struct xfrm_policy_queue *pq = &pol->polq; | 1963 | struct xfrm_policy_queue *pq = &pol->polq; |
| 1964 | 1964 | ||
| 1965 | if (unlikely(skb_fclone_busy(skb))) { | 1965 | if (unlikely(skb_fclone_busy(sk, skb))) { |
| 1966 | kfree_skb(skb); | 1966 | kfree_skb(skb); |
| 1967 | return 0; | 1967 | return 0; |
| 1968 | } | 1968 | } |
diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c index f44ef11f65a7..eb4bec0ad8af 100644 --- a/samples/bpf/test_verifier.c +++ b/samples/bpf/test_verifier.c | |||
| @@ -209,6 +209,17 @@ static struct bpf_test tests[] = { | |||
| 209 | .result = REJECT, | 209 | .result = REJECT, |
| 210 | }, | 210 | }, |
| 211 | { | 211 | { |
| 212 | "program doesn't init R0 before exit in all branches", | ||
| 213 | .insns = { | ||
| 214 | BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), | ||
| 215 | BPF_MOV64_IMM(BPF_REG_0, 1), | ||
| 216 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 2), | ||
| 217 | BPF_EXIT_INSN(), | ||
| 218 | }, | ||
| 219 | .errstr = "R0 !read_ok", | ||
| 220 | .result = REJECT, | ||
| 221 | }, | ||
| 222 | { | ||
| 212 | "stack out of bounds", | 223 | "stack out of bounds", |
| 213 | .insns = { | 224 | .insns = { |
| 214 | BPF_ST_MEM(BPF_DW, BPF_REG_10, 8, 0), | 225 | BPF_ST_MEM(BPF_DW, BPF_REG_10, 8, 0), |
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index 9685af330de5..c5ee1a7c5e8a 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
| @@ -319,9 +319,12 @@ int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
| 319 | { | 319 | { |
| 320 | const struct evm_ima_xattr_data *xattr_data = xattr_value; | 320 | const struct evm_ima_xattr_data *xattr_data = xattr_value; |
| 321 | 321 | ||
| 322 | if ((strcmp(xattr_name, XATTR_NAME_EVM) == 0) | 322 | if (strcmp(xattr_name, XATTR_NAME_EVM) == 0) { |
| 323 | && (xattr_data->type == EVM_XATTR_HMAC)) | 323 | if (!xattr_value_len) |
| 324 | return -EPERM; | 324 | return -EINVAL; |
| 325 | if (xattr_data->type != EVM_IMA_XATTR_DIGSIG) | ||
| 326 | return -EPERM; | ||
| 327 | } | ||
| 325 | return evm_protect_xattr(dentry, xattr_name, xattr_value, | 328 | return evm_protect_xattr(dentry, xattr_name, xattr_value, |
| 326 | xattr_value_len); | 329 | xattr_value_len); |
| 327 | } | 330 | } |
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 922685483bd3..7c8f41e618b6 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
| @@ -378,6 +378,8 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
| 378 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, | 378 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, |
| 379 | xattr_value_len); | 379 | xattr_value_len); |
| 380 | if (result == 1) { | 380 | if (result == 1) { |
| 381 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) | ||
| 382 | return -EINVAL; | ||
| 381 | ima_reset_appraise_flags(dentry->d_inode, | 383 | ima_reset_appraise_flags(dentry->d_inode, |
| 382 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); | 384 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); |
| 383 | result = 0; | 385 | result = 0; |
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h index c0379d13dbe1..9d1c2ebfe12a 100644 --- a/security/integrity/integrity.h +++ b/security/integrity/integrity.h | |||
| @@ -61,6 +61,7 @@ enum evm_ima_xattr_type { | |||
| 61 | EVM_XATTR_HMAC, | 61 | EVM_XATTR_HMAC, |
| 62 | EVM_IMA_XATTR_DIGSIG, | 62 | EVM_IMA_XATTR_DIGSIG, |
| 63 | IMA_XATTR_DIGEST_NG, | 63 | IMA_XATTR_DIGEST_NG, |
| 64 | IMA_XATTR_LAST | ||
| 64 | }; | 65 | }; |
| 65 | 66 | ||
| 66 | struct evm_ima_xattr_data { | 67 | struct evm_ima_xattr_data { |
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 102e8fd1d450..2d957ba63557 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
| @@ -210,6 +210,8 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream, | |||
| 210 | if (err < 0) | 210 | if (err < 0) |
| 211 | return err; | 211 | return err; |
| 212 | 212 | ||
| 213 | if (clear_user(src, sizeof(*src))) | ||
| 214 | return -EFAULT; | ||
| 213 | if (put_user(status.state, &src->state) || | 215 | if (put_user(status.state, &src->state) || |
| 214 | compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || | 216 | compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || |
| 215 | compat_put_timespec(&status.tstamp, &src->tstamp) || | 217 | compat_put_timespec(&status.tstamp, &src->tstamp) || |
diff --git a/sound/firewire/bebob/bebob_focusrite.c b/sound/firewire/bebob/bebob_focusrite.c index 45a0eed6d5b1..3b052ed0fbf5 100644 --- a/sound/firewire/bebob/bebob_focusrite.c +++ b/sound/firewire/bebob/bebob_focusrite.c | |||
| @@ -27,12 +27,14 @@ | |||
| 27 | #define SAFFIRE_CLOCK_SOURCE_INTERNAL 0 | 27 | #define SAFFIRE_CLOCK_SOURCE_INTERNAL 0 |
| 28 | #define SAFFIRE_CLOCK_SOURCE_SPDIF 1 | 28 | #define SAFFIRE_CLOCK_SOURCE_SPDIF 1 |
| 29 | 29 | ||
| 30 | /* '1' is absent, why... */ | 30 | /* clock sources as returned from register of Saffire Pro 10 and 26 */ |
| 31 | #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0 | 31 | #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0 |
| 32 | #define SAFFIREPRO_CLOCK_SOURCE_SKIP 1 /* never used on hardware */ | ||
| 32 | #define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2 | 33 | #define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2 |
| 33 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT1 3 | 34 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT1 3 /* not used on s.pro. 10 */ |
| 34 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT2 4 | 35 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT2 4 /* not used on s.pro. 10 */ |
| 35 | #define SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK 5 | 36 | #define SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK 5 |
| 37 | #define SAFFIREPRO_CLOCK_SOURCE_COUNT 6 | ||
| 36 | 38 | ||
| 37 | /* S/PDIF, ADAT1, ADAT2 is enabled or not. three quadlets */ | 39 | /* S/PDIF, ADAT1, ADAT2 is enabled or not. three quadlets */ |
| 38 | #define SAFFIREPRO_ENABLE_DIG_IFACES 0x01a4 | 40 | #define SAFFIREPRO_ENABLE_DIG_IFACES 0x01a4 |
| @@ -101,13 +103,34 @@ saffire_write_quad(struct snd_bebob *bebob, u64 offset, u32 value) | |||
| 101 | &data, sizeof(__be32), 0); | 103 | &data, sizeof(__be32), 0); |
| 102 | } | 104 | } |
| 103 | 105 | ||
| 106 | static char *const saffirepro_10_clk_src_labels[] = { | ||
| 107 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "Word Clock" | ||
| 108 | }; | ||
| 104 | static char *const saffirepro_26_clk_src_labels[] = { | 109 | static char *const saffirepro_26_clk_src_labels[] = { |
| 105 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "ADAT1", "ADAT2", "Word Clock" | 110 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "ADAT1", "ADAT2", "Word Clock" |
| 106 | }; | 111 | }; |
| 107 | 112 | /* Value maps between registers and labels for SaffirePro 10/26. */ | |
| 108 | static char *const saffirepro_10_clk_src_labels[] = { | 113 | static const signed char saffirepro_clk_maps[][SAFFIREPRO_CLOCK_SOURCE_COUNT] = { |
| 109 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "Word Clock" | 114 | /* SaffirePro 10 */ |
| 115 | [0] = { | ||
| 116 | [SAFFIREPRO_CLOCK_SOURCE_INTERNAL] = 0, | ||
| 117 | [SAFFIREPRO_CLOCK_SOURCE_SKIP] = -1, /* not supported */ | ||
| 118 | [SAFFIREPRO_CLOCK_SOURCE_SPDIF] = 1, | ||
| 119 | [SAFFIREPRO_CLOCK_SOURCE_ADAT1] = -1, /* not supported */ | ||
| 120 | [SAFFIREPRO_CLOCK_SOURCE_ADAT2] = -1, /* not supported */ | ||
| 121 | [SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK] = 2, | ||
| 122 | }, | ||
| 123 | /* SaffirePro 26 */ | ||
| 124 | [1] = { | ||
| 125 | [SAFFIREPRO_CLOCK_SOURCE_INTERNAL] = 0, | ||
| 126 | [SAFFIREPRO_CLOCK_SOURCE_SKIP] = -1, /* not supported */ | ||
| 127 | [SAFFIREPRO_CLOCK_SOURCE_SPDIF] = 1, | ||
| 128 | [SAFFIREPRO_CLOCK_SOURCE_ADAT1] = 2, | ||
| 129 | [SAFFIREPRO_CLOCK_SOURCE_ADAT2] = 3, | ||
| 130 | [SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK] = 4, | ||
| 131 | } | ||
| 110 | }; | 132 | }; |
| 133 | |||
| 111 | static int | 134 | static int |
| 112 | saffirepro_both_clk_freq_get(struct snd_bebob *bebob, unsigned int *rate) | 135 | saffirepro_both_clk_freq_get(struct snd_bebob *bebob, unsigned int *rate) |
| 113 | { | 136 | { |
| @@ -138,24 +161,35 @@ saffirepro_both_clk_freq_set(struct snd_bebob *bebob, unsigned int rate) | |||
| 138 | 161 | ||
| 139 | return saffire_write_quad(bebob, SAFFIREPRO_RATE_NOREBOOT, id); | 162 | return saffire_write_quad(bebob, SAFFIREPRO_RATE_NOREBOOT, id); |
| 140 | } | 163 | } |
| 164 | |||
| 165 | /* | ||
| 166 | * query hardware for current clock source, return our internally | ||
| 167 | * used clock index in *id, depending on hardware. | ||
| 168 | */ | ||
| 141 | static int | 169 | static int |
| 142 | saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) | 170 | saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) |
| 143 | { | 171 | { |
| 144 | int err; | 172 | int err; |
| 145 | u32 value; | 173 | u32 value; /* clock source read from hw register */ |
| 174 | const signed char *map; | ||
| 146 | 175 | ||
| 147 | err = saffire_read_quad(bebob, SAFFIREPRO_OFFSET_CLOCK_SOURCE, &value); | 176 | err = saffire_read_quad(bebob, SAFFIREPRO_OFFSET_CLOCK_SOURCE, &value); |
| 148 | if (err < 0) | 177 | if (err < 0) |
| 149 | goto end; | 178 | goto end; |
| 150 | 179 | ||
| 151 | if (bebob->spec->clock->labels == saffirepro_10_clk_src_labels) { | 180 | /* depending on hardware, use a different mapping */ |
| 152 | if (value == SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK) | 181 | if (bebob->spec->clock->labels == saffirepro_10_clk_src_labels) |
| 153 | *id = 2; | 182 | map = saffirepro_clk_maps[0]; |
| 154 | else if (value == SAFFIREPRO_CLOCK_SOURCE_SPDIF) | 183 | else |
| 155 | *id = 1; | 184 | map = saffirepro_clk_maps[1]; |
| 156 | } else if (value > 1) { | 185 | |
| 157 | *id = value - 1; | 186 | /* In a case that this driver cannot handle the value of register. */ |
| 187 | if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) { | ||
| 188 | err = -EIO; | ||
| 189 | goto end; | ||
| 158 | } | 190 | } |
| 191 | |||
| 192 | *id = (unsigned int)map[value]; | ||
| 159 | end: | 193 | end: |
| 160 | return err; | 194 | return err; |
| 161 | } | 195 | } |
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index ef4d0c9f6578..1aab0a32870c 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c | |||
| @@ -129,12 +129,24 @@ snd_bebob_stream_check_internal_clock(struct snd_bebob *bebob, bool *internal) | |||
| 129 | /* 1.The device has its own operation to switch source of clock */ | 129 | /* 1.The device has its own operation to switch source of clock */ |
| 130 | if (clk_spec) { | 130 | if (clk_spec) { |
| 131 | err = clk_spec->get(bebob, &id); | 131 | err = clk_spec->get(bebob, &id); |
| 132 | if (err < 0) | 132 | if (err < 0) { |
| 133 | dev_err(&bebob->unit->device, | 133 | dev_err(&bebob->unit->device, |
| 134 | "fail to get clock source: %d\n", err); | 134 | "fail to get clock source: %d\n", err); |
| 135 | else if (strncmp(clk_spec->labels[id], SND_BEBOB_CLOCK_INTERNAL, | 135 | goto end; |
| 136 | strlen(SND_BEBOB_CLOCK_INTERNAL)) == 0) | 136 | } |
| 137 | |||
| 138 | if (id >= clk_spec->num) { | ||
| 139 | dev_err(&bebob->unit->device, | ||
| 140 | "clock source %d out of range 0..%d\n", | ||
| 141 | id, clk_spec->num - 1); | ||
| 142 | err = -EIO; | ||
| 143 | goto end; | ||
| 144 | } | ||
| 145 | |||
| 146 | if (strncmp(clk_spec->labels[id], SND_BEBOB_CLOCK_INTERNAL, | ||
| 147 | strlen(SND_BEBOB_CLOCK_INTERNAL)) == 0) | ||
| 137 | *internal = true; | 148 | *internal = true; |
| 149 | |||
| 138 | goto end; | 150 | goto end; |
| 139 | } | 151 | } |
| 140 | 152 | ||
diff --git a/sound/firewire/bebob/bebob_terratec.c b/sound/firewire/bebob/bebob_terratec.c index 0e4c0bfc463b..9940611f2e1b 100644 --- a/sound/firewire/bebob/bebob_terratec.c +++ b/sound/firewire/bebob/bebob_terratec.c | |||
| @@ -24,7 +24,12 @@ phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id) | |||
| 24 | if (err < 0) | 24 | if (err < 0) |
| 25 | goto end; | 25 | goto end; |
| 26 | 26 | ||
| 27 | *id = (enable_ext & 0x01) | ((enable_word & 0x01) << 1); | 27 | if (enable_ext == 0) |
| 28 | *id = 0; | ||
| 29 | else if (enable_word == 0) | ||
| 30 | *id = 1; | ||
| 31 | else | ||
| 32 | *id = 2; | ||
| 28 | end: | 33 | end: |
| 29 | return err; | 34 | return err; |
| 30 | } | 35 | } |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 7bfdf9c51416..1610c38337af 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
| @@ -681,7 +681,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
| 681 | 681 | ||
| 682 | /* WARQ is at offset 12 */ | 682 | /* WARQ is at offset 12 */ |
| 683 | tmp = (reg & AD_DS_WSMC_WARQ) ? | 683 | tmp = (reg & AD_DS_WSMC_WARQ) ? |
| 684 | (((reg & AD_DS_WSMC_WARQ >> 12) & 0x01) ? 12 : 18) : 4; | 684 | ((((reg & AD_DS_WSMC_WARQ) >> 12) & 0x01) ? 12 : 18) : 4; |
| 685 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; | 685 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; |
| 686 | 686 | ||
| 687 | snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp, | 687 | snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp, |
| @@ -693,7 +693,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
| 693 | 693 | ||
| 694 | /* SYRQ is at offset 4 */ | 694 | /* SYRQ is at offset 4 */ |
| 695 | tmp = (reg & AD_DS_WSMC_SYRQ) ? | 695 | tmp = (reg & AD_DS_WSMC_SYRQ) ? |
| 696 | (((reg & AD_DS_WSMC_SYRQ >> 4) & 0x01) ? 12 : 18) : 4; | 696 | ((((reg & AD_DS_WSMC_SYRQ) >> 4) & 0x01) ? 12 : 18) : 4; |
| 697 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; | 697 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; |
| 698 | 698 | ||
| 699 | snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp, | 699 | snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp, |
| @@ -709,7 +709,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
| 709 | 709 | ||
| 710 | /* ACRQ is at offset 4 */ | 710 | /* ACRQ is at offset 4 */ |
| 711 | tmp = (reg & AD_DS_RAMC_ACRQ) ? | 711 | tmp = (reg & AD_DS_RAMC_ACRQ) ? |
| 712 | (((reg & AD_DS_RAMC_ACRQ >> 4) & 0x01) ? 12 : 18) : 4; | 712 | ((((reg & AD_DS_RAMC_ACRQ) >> 4) & 0x01) ? 12 : 18) : 4; |
| 713 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; | 713 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; |
| 714 | 714 | ||
| 715 | snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp, | 715 | snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp, |
| @@ -720,7 +720,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
| 720 | 720 | ||
| 721 | /* RERQ is at offset 12 */ | 721 | /* RERQ is at offset 12 */ |
| 722 | tmp = (reg & AD_DS_RAMC_RERQ) ? | 722 | tmp = (reg & AD_DS_RAMC_RERQ) ? |
| 723 | (((reg & AD_DS_RAMC_RERQ >> 12) & 0x01) ? 12 : 18) : 4; | 723 | ((((reg & AD_DS_RAMC_RERQ) >> 12) & 0x01) ? 12 : 18) : 4; |
| 724 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; | 724 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; |
| 725 | 725 | ||
| 726 | snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp, | 726 | snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp, |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index cfcca4c30d4d..9ab1e631cb32 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -374,6 +374,8 @@ static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool | |||
| 374 | #ifdef CONFIG_SND_DMA_SGBUF | 374 | #ifdef CONFIG_SND_DMA_SGBUF |
| 375 | if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { | 375 | if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { |
| 376 | struct snd_sg_buf *sgbuf = dmab->private_data; | 376 | struct snd_sg_buf *sgbuf = dmab->private_data; |
| 377 | if (chip->driver_type == AZX_DRIVER_CMEDIA) | ||
| 378 | return; /* deal with only CORB/RIRB buffers */ | ||
| 377 | if (on) | 379 | if (on) |
| 378 | set_pages_array_wc(sgbuf->page_table, sgbuf->pages); | 380 | set_pages_array_wc(sgbuf->page_table, sgbuf->pages); |
| 379 | else | 381 | else |
| @@ -1769,7 +1771,7 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream, | |||
| 1769 | #ifdef CONFIG_X86 | 1771 | #ifdef CONFIG_X86 |
| 1770 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | 1772 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); |
| 1771 | struct azx *chip = apcm->chip; | 1773 | struct azx *chip = apcm->chip; |
| 1772 | if (!azx_snoop(chip)) | 1774 | if (!azx_snoop(chip) && chip->driver_type != AZX_DRIVER_CMEDIA) |
| 1773 | area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); | 1775 | area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); |
| 1774 | #endif | 1776 | #endif |
| 1775 | } | 1777 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 34b7bdb510c7..c9cf248ce8ec 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -2675,7 +2675,7 @@ static void alc269_shutup(struct hda_codec *codec) | |||
| 2675 | 2675 | ||
| 2676 | static struct coef_fw alc282_coefs[] = { | 2676 | static struct coef_fw alc282_coefs[] = { |
| 2677 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | 2677 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ |
| 2678 | WRITE_COEF(0x05, 0x0700), /* FIFO and filter clock */ | 2678 | UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ |
| 2679 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ | 2679 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ |
| 2680 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | 2680 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ |
| 2681 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | 2681 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ |
| @@ -2786,7 +2786,7 @@ static void alc282_shutup(struct hda_codec *codec) | |||
| 2786 | 2786 | ||
| 2787 | static struct coef_fw alc283_coefs[] = { | 2787 | static struct coef_fw alc283_coefs[] = { |
| 2788 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | 2788 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ |
| 2789 | WRITE_COEF(0x05, 0x0700), /* FIFO and filter clock */ | 2789 | UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ |
| 2790 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ | 2790 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ |
| 2791 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | 2791 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ |
| 2792 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | 2792 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ |
| @@ -2817,6 +2817,7 @@ static struct coef_fw alc283_coefs[] = { | |||
| 2817 | UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */ | 2817 | UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */ |
| 2818 | UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */ | 2818 | UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */ |
| 2819 | WRITE_COEF(0x37, 0xfc06), /* Class D amp control */ | 2819 | WRITE_COEF(0x37, 0xfc06), /* Class D amp control */ |
| 2820 | UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */ | ||
| 2820 | {} | 2821 | {} |
| 2821 | }; | 2822 | }; |
| 2822 | 2823 | ||
| @@ -5922,6 +5923,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
| 5922 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5923 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 5923 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5924 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 5924 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 5925 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 5926 | SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
| 5925 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 5927 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
| 5926 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), | 5928 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), |
| 5927 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | 5929 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 0e9623368ab0..7d5d6444a837 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig | |||
| @@ -49,7 +49,6 @@ source "sound/soc/mxs/Kconfig" | |||
| 49 | source "sound/soc/pxa/Kconfig" | 49 | source "sound/soc/pxa/Kconfig" |
| 50 | source "sound/soc/rockchip/Kconfig" | 50 | source "sound/soc/rockchip/Kconfig" |
| 51 | source "sound/soc/samsung/Kconfig" | 51 | source "sound/soc/samsung/Kconfig" |
| 52 | source "sound/soc/s6000/Kconfig" | ||
| 53 | source "sound/soc/sh/Kconfig" | 52 | source "sound/soc/sh/Kconfig" |
| 54 | source "sound/soc/sirf/Kconfig" | 53 | source "sound/soc/sirf/Kconfig" |
| 55 | source "sound/soc/spear/Kconfig" | 54 | source "sound/soc/spear/Kconfig" |
diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 534714a1ca44..d88edfced8c4 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile | |||
| @@ -26,7 +26,6 @@ obj-$(CONFIG_SND_SOC) += kirkwood/ | |||
| 26 | obj-$(CONFIG_SND_SOC) += pxa/ | 26 | obj-$(CONFIG_SND_SOC) += pxa/ |
| 27 | obj-$(CONFIG_SND_SOC) += rockchip/ | 27 | obj-$(CONFIG_SND_SOC) += rockchip/ |
| 28 | obj-$(CONFIG_SND_SOC) += samsung/ | 28 | obj-$(CONFIG_SND_SOC) += samsung/ |
| 29 | obj-$(CONFIG_SND_SOC) += s6000/ | ||
| 30 | obj-$(CONFIG_SND_SOC) += sh/ | 29 | obj-$(CONFIG_SND_SOC) += sh/ |
| 31 | obj-$(CONFIG_SND_SOC) += sirf/ | 30 | obj-$(CONFIG_SND_SOC) += sirf/ |
| 32 | obj-$(CONFIG_SND_SOC) += spear/ | 31 | obj-$(CONFIG_SND_SOC) += spear/ |
diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c index 5518ebd6947c..91f60282fd2f 100644 --- a/sound/soc/codecs/adau1761.c +++ b/sound/soc/codecs/adau1761.c | |||
| @@ -405,6 +405,7 @@ static const struct snd_soc_dapm_widget adau1761_dapm_widgets[] = { | |||
| 405 | 2, 0, NULL, 0), | 405 | 2, 0, NULL, 0), |
| 406 | 406 | ||
| 407 | SND_SOC_DAPM_SUPPLY("Slew Clock", ADAU1761_CLK_ENABLE0, 6, 0, NULL, 0), | 407 | SND_SOC_DAPM_SUPPLY("Slew Clock", ADAU1761_CLK_ENABLE0, 6, 0, NULL, 0), |
| 408 | SND_SOC_DAPM_SUPPLY("ALC Clock", ADAU1761_CLK_ENABLE0, 5, 0, NULL, 0), | ||
| 408 | 409 | ||
| 409 | SND_SOC_DAPM_SUPPLY_S("Digital Clock 0", 1, ADAU1761_CLK_ENABLE1, | 410 | SND_SOC_DAPM_SUPPLY_S("Digital Clock 0", 1, ADAU1761_CLK_ENABLE1, |
| 410 | 0, 0, NULL, 0), | 411 | 0, 0, NULL, 0), |
| @@ -436,6 +437,9 @@ static const struct snd_soc_dapm_route adau1761_dapm_routes[] = { | |||
| 436 | { "Right Playback Mixer", NULL, "Slew Clock" }, | 437 | { "Right Playback Mixer", NULL, "Slew Clock" }, |
| 437 | { "Left Playback Mixer", NULL, "Slew Clock" }, | 438 | { "Left Playback Mixer", NULL, "Slew Clock" }, |
| 438 | 439 | ||
| 440 | { "Left Input Mixer", NULL, "ALC Clock" }, | ||
| 441 | { "Right Input Mixer", NULL, "ALC Clock" }, | ||
| 442 | |||
| 439 | { "Digital Clock 0", NULL, "SYSCLK" }, | 443 | { "Digital Clock 0", NULL, "SYSCLK" }, |
| 440 | { "Digital Clock 1", NULL, "SYSCLK" }, | 444 | { "Digital Clock 1", NULL, "SYSCLK" }, |
| 441 | }; | 445 | }; |
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 3b145313f93e..ed866e9a2928 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c | |||
| @@ -792,7 +792,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) | |||
| 792 | return -ENOMEM; | 792 | return -ENOMEM; |
| 793 | 793 | ||
| 794 | asrc_priv->pdev = pdev; | 794 | asrc_priv->pdev = pdev; |
| 795 | strcpy(asrc_priv->name, np->name); | 795 | strncpy(asrc_priv->name, np->name, sizeof(asrc_priv->name) - 1); |
| 796 | 796 | ||
| 797 | /* Get the addresses and IRQ */ | 797 | /* Get the addresses and IRQ */ |
| 798 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 798 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 8bcdfda09d7a..a645e296199e 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c | |||
| @@ -734,7 +734,7 @@ static int fsl_esai_probe(struct platform_device *pdev) | |||
| 734 | return -ENOMEM; | 734 | return -ENOMEM; |
| 735 | 735 | ||
| 736 | esai_priv->pdev = pdev; | 736 | esai_priv->pdev = pdev; |
| 737 | strcpy(esai_priv->name, np->name); | 737 | strncpy(esai_priv->name, np->name, sizeof(esai_priv->name) - 1); |
| 738 | 738 | ||
| 739 | /* Get the addresses and IRQ */ | 739 | /* Get the addresses and IRQ */ |
| 740 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 740 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c index 33fc5c3abf55..4df867cbb92a 100644 --- a/sound/soc/intel/sst-haswell-pcm.c +++ b/sound/soc/intel/sst-haswell-pcm.c | |||
| @@ -691,9 +691,7 @@ static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
| 691 | } | 691 | } |
| 692 | 692 | ||
| 693 | #define HSW_FORMATS \ | 693 | #define HSW_FORMATS \ |
| 694 | (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \ | 694 | (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE) |
| 695 | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S16_LE |\ | ||
| 696 | SNDRV_PCM_FMTBIT_S8) | ||
| 697 | 695 | ||
| 698 | static struct snd_soc_dai_driver hsw_dais[] = { | 696 | static struct snd_soc_dai_driver hsw_dais[] = { |
| 699 | { | 697 | { |
diff --git a/sound/soc/s6000/Kconfig b/sound/soc/s6000/Kconfig deleted file mode 100644 index f244a2566f20..000000000000 --- a/sound/soc/s6000/Kconfig +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | config SND_S6000_SOC | ||
| 2 | tristate "SoC Audio for the Stretch s6000 family" | ||
| 3 | depends on XTENSA_VARIANT_S6000 || COMPILE_TEST | ||
| 4 | depends on HAS_IOMEM | ||
| 5 | select SND_S6000_SOC_PCM if XTENSA_VARIANT_S6000 | ||
| 6 | help | ||
| 7 | Say Y or M if you want to add support for codecs attached to | ||
| 8 | s6000 family chips. You will also need to select the platform | ||
| 9 | to support below. | ||
| 10 | |||
| 11 | config SND_S6000_SOC_PCM | ||
| 12 | tristate | ||
| 13 | |||
| 14 | config SND_S6000_SOC_I2S | ||
| 15 | tristate | ||
| 16 | |||
| 17 | config SND_S6000_SOC_S6IPCAM | ||
| 18 | bool "SoC Audio support for Stretch 6105 IP Camera" | ||
| 19 | depends on SND_S6000_SOC=y | ||
| 20 | depends on I2C=y | ||
| 21 | depends on XTENSA_PLATFORM_S6105 || COMPILE_TEST | ||
| 22 | select SND_S6000_SOC_I2S | ||
| 23 | select SND_SOC_TLV320AIC3X | ||
| 24 | help | ||
| 25 | Say Y if you want to add support for SoC audio on the | ||
| 26 | Stretch s6105 IP Camera Reference Design. | ||
diff --git a/sound/soc/s6000/Makefile b/sound/soc/s6000/Makefile deleted file mode 100644 index 0f0ae2a012aa..000000000000 --- a/sound/soc/s6000/Makefile +++ /dev/null | |||
| @@ -1,11 +0,0 @@ | |||
| 1 | # s6000 Platform Support | ||
| 2 | snd-soc-s6000-objs := s6000-pcm.o | ||
| 3 | snd-soc-s6000-i2s-objs := s6000-i2s.o | ||
| 4 | |||
| 5 | obj-$(CONFIG_SND_S6000_SOC_PCM) += snd-soc-s6000.o | ||
| 6 | obj-$(CONFIG_SND_S6000_SOC_I2S) += snd-soc-s6000-i2s.o | ||
| 7 | |||
| 8 | # s6105 Machine Support | ||
| 9 | snd-soc-s6ipcam-objs := s6105-ipcam.o | ||
| 10 | |||
| 11 | obj-$(CONFIG_SND_S6000_SOC_S6IPCAM) += snd-soc-s6ipcam.o | ||
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c deleted file mode 100644 index 1c8d01166e5b..000000000000 --- a/sound/soc/s6000/s6000-i2s.c +++ /dev/null | |||
| @@ -1,617 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * ALSA SoC I2S Audio Layer for the Stretch S6000 family | ||
| 3 | * | ||
| 4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
| 5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/device.h> | ||
| 15 | #include <linux/delay.h> | ||
| 16 | #include <linux/clk.h> | ||
| 17 | #include <linux/interrupt.h> | ||
| 18 | #include <linux/io.h> | ||
| 19 | #include <linux/slab.h> | ||
| 20 | |||
| 21 | #include <sound/core.h> | ||
| 22 | #include <sound/pcm.h> | ||
| 23 | #include <sound/pcm_params.h> | ||
| 24 | #include <sound/initval.h> | ||
| 25 | #include <sound/soc.h> | ||
| 26 | |||
| 27 | #include "s6000-i2s.h" | ||
| 28 | #include "s6000-pcm.h" | ||
| 29 | |||
| 30 | struct s6000_i2s_dev { | ||
| 31 | dma_addr_t sifbase; | ||
| 32 | u8 __iomem *scbbase; | ||
| 33 | unsigned int wide; | ||
| 34 | unsigned int channel_in; | ||
| 35 | unsigned int channel_out; | ||
| 36 | unsigned int lines_in; | ||
| 37 | unsigned int lines_out; | ||
| 38 | struct s6000_pcm_dma_params dma_params; | ||
| 39 | }; | ||
| 40 | |||
| 41 | #define S6_I2S_INTERRUPT_STATUS 0x00 | ||
| 42 | #define S6_I2S_INT_OVERRUN 1 | ||
| 43 | #define S6_I2S_INT_UNDERRUN 2 | ||
| 44 | #define S6_I2S_INT_ALIGNMENT 4 | ||
| 45 | #define S6_I2S_INTERRUPT_ENABLE 0x04 | ||
| 46 | #define S6_I2S_INTERRUPT_RAW 0x08 | ||
| 47 | #define S6_I2S_INTERRUPT_CLEAR 0x0C | ||
| 48 | #define S6_I2S_INTERRUPT_SET 0x10 | ||
| 49 | #define S6_I2S_MODE 0x20 | ||
| 50 | #define S6_I2S_DUAL 0 | ||
| 51 | #define S6_I2S_WIDE 1 | ||
| 52 | #define S6_I2S_TX_DEFAULT 0x24 | ||
| 53 | #define S6_I2S_DATA_CFG(c) (0x40 + 0x10 * (c)) | ||
| 54 | #define S6_I2S_IN 0 | ||
| 55 | #define S6_I2S_OUT 1 | ||
| 56 | #define S6_I2S_UNUSED 2 | ||
| 57 | #define S6_I2S_INTERFACE_CFG(c) (0x44 + 0x10 * (c)) | ||
| 58 | #define S6_I2S_DIV_MASK 0x001fff | ||
| 59 | #define S6_I2S_16BIT 0x000000 | ||
| 60 | #define S6_I2S_20BIT 0x002000 | ||
| 61 | #define S6_I2S_24BIT 0x004000 | ||
| 62 | #define S6_I2S_32BIT 0x006000 | ||
| 63 | #define S6_I2S_BITS_MASK 0x006000 | ||
| 64 | #define S6_I2S_MEM_16BIT 0x000000 | ||
| 65 | #define S6_I2S_MEM_32BIT 0x008000 | ||
| 66 | #define S6_I2S_MEM_MASK 0x008000 | ||
| 67 | #define S6_I2S_CHANNELS_SHIFT 16 | ||
| 68 | #define S6_I2S_CHANNELS_MASK 0x030000 | ||
| 69 | #define S6_I2S_SCK_IN 0x000000 | ||
| 70 | #define S6_I2S_SCK_OUT 0x040000 | ||
| 71 | #define S6_I2S_SCK_DIR 0x040000 | ||
| 72 | #define S6_I2S_WS_IN 0x000000 | ||
| 73 | #define S6_I2S_WS_OUT 0x080000 | ||
| 74 | #define S6_I2S_WS_DIR 0x080000 | ||
| 75 | #define S6_I2S_LEFT_FIRST 0x000000 | ||
| 76 | #define S6_I2S_RIGHT_FIRST 0x100000 | ||
| 77 | #define S6_I2S_FIRST 0x100000 | ||
| 78 | #define S6_I2S_CUR_SCK 0x200000 | ||
| 79 | #define S6_I2S_CUR_WS 0x400000 | ||
| 80 | #define S6_I2S_ENABLE(c) (0x48 + 0x10 * (c)) | ||
| 81 | #define S6_I2S_DISABLE_IF 0x02 | ||
| 82 | #define S6_I2S_ENABLE_IF 0x03 | ||
| 83 | #define S6_I2S_IS_BUSY 0x04 | ||
| 84 | #define S6_I2S_DMA_ACTIVE 0x08 | ||
| 85 | #define S6_I2S_IS_ENABLED 0x10 | ||
| 86 | |||
| 87 | #define S6_I2S_NUM_LINES 4 | ||
| 88 | |||
| 89 | #define S6_I2S_SIF_PORT0 0x0000000 | ||
| 90 | #define S6_I2S_SIF_PORT1 0x0000080 /* docs say 0x0000010 */ | ||
| 91 | |||
| 92 | static inline void s6_i2s_write_reg(struct s6000_i2s_dev *dev, int reg, u32 val) | ||
| 93 | { | ||
| 94 | writel(val, dev->scbbase + reg); | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline u32 s6_i2s_read_reg(struct s6000_i2s_dev *dev, int reg) | ||
| 98 | { | ||
| 99 | return readl(dev->scbbase + reg); | ||
| 100 | } | ||
| 101 | |||
| 102 | static inline void s6_i2s_mod_reg(struct s6000_i2s_dev *dev, int reg, | ||
| 103 | u32 mask, u32 val) | ||
| 104 | { | ||
| 105 | val ^= s6_i2s_read_reg(dev, reg) & ~mask; | ||
| 106 | s6_i2s_write_reg(dev, reg, val); | ||
| 107 | } | ||
| 108 | |||
| 109 | static void s6000_i2s_start_channel(struct s6000_i2s_dev *dev, int channel) | ||
| 110 | { | ||
| 111 | int i, j, cur, prev; | ||
| 112 | |||
| 113 | /* | ||
| 114 | * Wait for WCLK to toggle 5 times before enabling the channel | ||
| 115 | * s6000 Family Datasheet 3.6.4: | ||
| 116 | * "At least two cycles of WS must occur between commands | ||
| 117 | * to disable or enable the interface" | ||
| 118 | */ | ||
| 119 | j = 0; | ||
| 120 | prev = ~S6_I2S_CUR_WS; | ||
| 121 | for (i = 1000000; --i && j < 6; ) { | ||
| 122 | cur = s6_i2s_read_reg(dev, S6_I2S_INTERFACE_CFG(channel)) | ||
| 123 | & S6_I2S_CUR_WS; | ||
| 124 | if (prev != cur) { | ||
| 125 | prev = cur; | ||
| 126 | j++; | ||
| 127 | } | ||
| 128 | } | ||
| 129 | if (j < 6) | ||
| 130 | printk(KERN_WARNING "s6000-i2s: timeout waiting for WCLK\n"); | ||
| 131 | |||
| 132 | s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_ENABLE_IF); | ||
| 133 | } | ||
| 134 | |||
| 135 | static void s6000_i2s_stop_channel(struct s6000_i2s_dev *dev, int channel) | ||
| 136 | { | ||
| 137 | s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_DISABLE_IF); | ||
| 138 | } | ||
| 139 | |||
| 140 | static void s6000_i2s_start(struct snd_pcm_substream *substream) | ||
| 141 | { | ||
| 142 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 143 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||
| 144 | int channel; | ||
| 145 | |||
| 146 | channel = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
| 147 | dev->channel_out : dev->channel_in; | ||
| 148 | |||
| 149 | s6000_i2s_start_channel(dev, channel); | ||
| 150 | } | ||
| 151 | |||
| 152 | static void s6000_i2s_stop(struct snd_pcm_substream *substream) | ||
| 153 | { | ||
| 154 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 155 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||
| 156 | int channel; | ||
| 157 | |||
| 158 | channel = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
| 159 | dev->channel_out : dev->channel_in; | ||
| 160 | |||
| 161 | s6000_i2s_stop_channel(dev, channel); | ||
| 162 | } | ||
| 163 | |||
| 164 | static int s6000_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | ||
| 165 | int after) | ||
| 166 | { | ||
| 167 | switch (cmd) { | ||
| 168 | case SNDRV_PCM_TRIGGER_START: | ||
| 169 | case SNDRV_PCM_TRIGGER_RESUME: | ||
| 170 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
| 171 | if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) ^ !after) | ||
| 172 | s6000_i2s_start(substream); | ||
| 173 | break; | ||
| 174 | case SNDRV_PCM_TRIGGER_STOP: | ||
| 175 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| 176 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
| 177 | if (!after) | ||
| 178 | s6000_i2s_stop(substream); | ||
| 179 | } | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 183 | static unsigned int s6000_i2s_int_sources(struct s6000_i2s_dev *dev) | ||
| 184 | { | ||
| 185 | unsigned int pending; | ||
| 186 | pending = s6_i2s_read_reg(dev, S6_I2S_INTERRUPT_RAW); | ||
| 187 | pending &= S6_I2S_INT_ALIGNMENT | | ||
| 188 | S6_I2S_INT_UNDERRUN | | ||
| 189 | S6_I2S_INT_OVERRUN; | ||
| 190 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_CLEAR, pending); | ||
| 191 | |||
| 192 | return pending; | ||
| 193 | } | ||
| 194 | |||
| 195 | static unsigned int s6000_i2s_check_xrun(struct snd_soc_dai *cpu_dai) | ||
| 196 | { | ||
| 197 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); | ||
| 198 | unsigned int errors; | ||
| 199 | unsigned int ret; | ||
| 200 | |||
| 201 | errors = s6000_i2s_int_sources(dev); | ||
| 202 | if (likely(!errors)) | ||
| 203 | return 0; | ||
| 204 | |||
| 205 | ret = 0; | ||
| 206 | if (errors & S6_I2S_INT_ALIGNMENT) | ||
| 207 | printk(KERN_ERR "s6000-i2s: WCLK misaligned\n"); | ||
| 208 | if (errors & S6_I2S_INT_UNDERRUN) | ||
| 209 | ret |= 1 << SNDRV_PCM_STREAM_PLAYBACK; | ||
| 210 | if (errors & S6_I2S_INT_OVERRUN) | ||
| 211 | ret |= 1 << SNDRV_PCM_STREAM_CAPTURE; | ||
| 212 | return ret; | ||
| 213 | } | ||
| 214 | |||
| 215 | static void s6000_i2s_wait_disabled(struct s6000_i2s_dev *dev) | ||
| 216 | { | ||
| 217 | int channel; | ||
| 218 | int n = 50; | ||
| 219 | for (channel = 0; channel < 2; channel++) { | ||
| 220 | while (--n >= 0) { | ||
| 221 | int v = s6_i2s_read_reg(dev, S6_I2S_ENABLE(channel)); | ||
| 222 | if ((v & S6_I2S_IS_ENABLED) | ||
| 223 | || !(v & (S6_I2S_DMA_ACTIVE | S6_I2S_IS_BUSY))) | ||
| 224 | break; | ||
| 225 | udelay(20); | ||
| 226 | } | ||
| 227 | } | ||
| 228 | if (n < 0) | ||
| 229 | printk(KERN_WARNING "s6000-i2s: timeout disabling interfaces"); | ||
| 230 | } | ||
| 231 | |||
| 232 | static int s6000_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | ||
| 233 | unsigned int fmt) | ||
| 234 | { | ||
| 235 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); | ||
| 236 | u32 w; | ||
| 237 | |||
| 238 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | ||
| 239 | case SND_SOC_DAIFMT_CBM_CFM: | ||
| 240 | w = S6_I2S_SCK_IN | S6_I2S_WS_IN; | ||
| 241 | break; | ||
| 242 | case SND_SOC_DAIFMT_CBS_CFM: | ||
| 243 | w = S6_I2S_SCK_OUT | S6_I2S_WS_IN; | ||
| 244 | break; | ||
| 245 | case SND_SOC_DAIFMT_CBM_CFS: | ||
| 246 | w = S6_I2S_SCK_IN | S6_I2S_WS_OUT; | ||
| 247 | break; | ||
| 248 | case SND_SOC_DAIFMT_CBS_CFS: | ||
| 249 | w = S6_I2S_SCK_OUT | S6_I2S_WS_OUT; | ||
| 250 | break; | ||
| 251 | default: | ||
| 252 | return -EINVAL; | ||
| 253 | } | ||
| 254 | |||
| 255 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
| 256 | case SND_SOC_DAIFMT_NB_NF: | ||
| 257 | w |= S6_I2S_LEFT_FIRST; | ||
| 258 | break; | ||
| 259 | case SND_SOC_DAIFMT_NB_IF: | ||
| 260 | w |= S6_I2S_RIGHT_FIRST; | ||
| 261 | break; | ||
| 262 | default: | ||
| 263 | return -EINVAL; | ||
| 264 | } | ||
| 265 | |||
| 266 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(0), | ||
| 267 | S6_I2S_FIRST | S6_I2S_WS_DIR | S6_I2S_SCK_DIR, w); | ||
| 268 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(1), | ||
| 269 | S6_I2S_FIRST | S6_I2S_WS_DIR | S6_I2S_SCK_DIR, w); | ||
| 270 | |||
| 271 | return 0; | ||
| 272 | } | ||
| 273 | |||
| 274 | static int s6000_i2s_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) | ||
| 275 | { | ||
| 276 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 277 | |||
| 278 | if (!div || (div & 1) || div > (S6_I2S_DIV_MASK + 1) * 2) | ||
| 279 | return -EINVAL; | ||
| 280 | |||
| 281 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(div_id), | ||
| 282 | S6_I2S_DIV_MASK, div / 2 - 1); | ||
| 283 | return 0; | ||
| 284 | } | ||
| 285 | |||
| 286 | static int s6000_i2s_hw_params(struct snd_pcm_substream *substream, | ||
| 287 | struct snd_pcm_hw_params *params, | ||
| 288 | struct snd_soc_dai *dai) | ||
| 289 | { | ||
| 290 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 291 | int interf; | ||
| 292 | u32 w = 0; | ||
| 293 | |||
| 294 | if (dev->wide) | ||
| 295 | interf = 0; | ||
| 296 | else { | ||
| 297 | w |= (((params_channels(params) - 2) / 2) | ||
| 298 | << S6_I2S_CHANNELS_SHIFT) & S6_I2S_CHANNELS_MASK; | ||
| 299 | interf = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
| 300 | ? dev->channel_out : dev->channel_in; | ||
| 301 | } | ||
| 302 | |||
| 303 | switch (params_format(params)) { | ||
| 304 | case SNDRV_PCM_FORMAT_S16_LE: | ||
| 305 | w |= S6_I2S_16BIT | S6_I2S_MEM_16BIT; | ||
| 306 | break; | ||
| 307 | case SNDRV_PCM_FORMAT_S32_LE: | ||
| 308 | w |= S6_I2S_32BIT | S6_I2S_MEM_32BIT; | ||
| 309 | break; | ||
| 310 | default: | ||
| 311 | printk(KERN_WARNING "s6000-i2s: unsupported PCM format %x\n", | ||
| 312 | params_format(params)); | ||
| 313 | return -EINVAL; | ||
| 314 | } | ||
| 315 | |||
| 316 | if (s6_i2s_read_reg(dev, S6_I2S_INTERFACE_CFG(interf)) | ||
| 317 | & S6_I2S_IS_ENABLED) { | ||
| 318 | printk(KERN_ERR "s6000-i2s: interface already enabled\n"); | ||
| 319 | return -EBUSY; | ||
| 320 | } | ||
| 321 | |||
| 322 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(interf), | ||
| 323 | S6_I2S_CHANNELS_MASK|S6_I2S_MEM_MASK|S6_I2S_BITS_MASK, | ||
| 324 | w); | ||
| 325 | |||
| 326 | return 0; | ||
| 327 | } | ||
| 328 | |||
| 329 | static int s6000_i2s_dai_probe(struct snd_soc_dai *dai) | ||
| 330 | { | ||
| 331 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 332 | struct s6000_snd_platform_data *pdata = dai->dev->platform_data; | ||
| 333 | |||
| 334 | if (!pdata) | ||
| 335 | return -EINVAL; | ||
| 336 | |||
| 337 | dai->capture_dma_data = &dev->dma_params; | ||
| 338 | dai->playback_dma_data = &dev->dma_params; | ||
| 339 | |||
| 340 | dev->wide = pdata->wide; | ||
| 341 | dev->channel_in = pdata->channel_in; | ||
| 342 | dev->channel_out = pdata->channel_out; | ||
| 343 | dev->lines_in = pdata->lines_in; | ||
| 344 | dev->lines_out = pdata->lines_out; | ||
| 345 | |||
| 346 | s6_i2s_write_reg(dev, S6_I2S_MODE, | ||
| 347 | dev->wide ? S6_I2S_WIDE : S6_I2S_DUAL); | ||
| 348 | |||
| 349 | if (dev->wide) { | ||
| 350 | int i; | ||
| 351 | |||
| 352 | if (dev->lines_in + dev->lines_out > S6_I2S_NUM_LINES) | ||
| 353 | return -EINVAL; | ||
| 354 | |||
| 355 | dev->channel_in = 0; | ||
| 356 | dev->channel_out = 1; | ||
| 357 | dai->driver->capture.channels_min = 2 * dev->lines_in; | ||
| 358 | dai->driver->capture.channels_max = dai->driver->capture.channels_min; | ||
| 359 | dai->driver->playback.channels_min = 2 * dev->lines_out; | ||
| 360 | dai->driver->playback.channels_max = dai->driver->playback.channels_min; | ||
| 361 | |||
| 362 | for (i = 0; i < dev->lines_out; i++) | ||
| 363 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(i), S6_I2S_OUT); | ||
| 364 | |||
| 365 | for (; i < S6_I2S_NUM_LINES - dev->lines_in; i++) | ||
| 366 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(i), | ||
| 367 | S6_I2S_UNUSED); | ||
| 368 | |||
| 369 | for (; i < S6_I2S_NUM_LINES; i++) | ||
| 370 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(i), S6_I2S_IN); | ||
| 371 | } else { | ||
| 372 | unsigned int cfg[2] = {S6_I2S_UNUSED, S6_I2S_UNUSED}; | ||
| 373 | |||
| 374 | if (dev->lines_in > 1 || dev->lines_out > 1) | ||
| 375 | return -EINVAL; | ||
| 376 | |||
| 377 | dai->driver->capture.channels_min = 2 * dev->lines_in; | ||
| 378 | dai->driver->capture.channels_max = 8 * dev->lines_in; | ||
| 379 | dai->driver->playback.channels_min = 2 * dev->lines_out; | ||
| 380 | dai->driver->playback.channels_max = 8 * dev->lines_out; | ||
| 381 | |||
| 382 | if (dev->lines_in) | ||
| 383 | cfg[dev->channel_in] = S6_I2S_IN; | ||
| 384 | if (dev->lines_out) | ||
| 385 | cfg[dev->channel_out] = S6_I2S_OUT; | ||
| 386 | |||
| 387 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(0), cfg[0]); | ||
| 388 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(1), cfg[1]); | ||
| 389 | } | ||
| 390 | |||
| 391 | if (dev->lines_out) { | ||
| 392 | if (dev->lines_in) { | ||
| 393 | if (!dev->dma_params.dma_out) | ||
| 394 | return -ENODEV; | ||
| 395 | } else { | ||
| 396 | dev->dma_params.dma_out = dev->dma_params.dma_in; | ||
| 397 | dev->dma_params.dma_in = 0; | ||
| 398 | } | ||
| 399 | } | ||
| 400 | dev->dma_params.sif_in = dev->sifbase + (dev->channel_in ? | ||
| 401 | S6_I2S_SIF_PORT1 : S6_I2S_SIF_PORT0); | ||
| 402 | dev->dma_params.sif_out = dev->sifbase + (dev->channel_out ? | ||
| 403 | S6_I2S_SIF_PORT1 : S6_I2S_SIF_PORT0); | ||
| 404 | dev->dma_params.same_rate = pdata->same_rate | pdata->wide; | ||
| 405 | return 0; | ||
| 406 | } | ||
| 407 | |||
| 408 | #define S6000_I2S_RATES SNDRV_PCM_RATE_CONTINUOUS | ||
| 409 | #define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) | ||
| 410 | |||
| 411 | static const struct snd_soc_dai_ops s6000_i2s_dai_ops = { | ||
| 412 | .set_fmt = s6000_i2s_set_dai_fmt, | ||
| 413 | .set_clkdiv = s6000_i2s_set_clkdiv, | ||
| 414 | .hw_params = s6000_i2s_hw_params, | ||
| 415 | }; | ||
| 416 | |||
| 417 | static struct snd_soc_dai_driver s6000_i2s_dai = { | ||
| 418 | .probe = s6000_i2s_dai_probe, | ||
| 419 | .playback = { | ||
| 420 | .channels_min = 2, | ||
| 421 | .channels_max = 8, | ||
| 422 | .formats = S6000_I2S_FORMATS, | ||
| 423 | .rates = S6000_I2S_RATES, | ||
| 424 | .rate_min = 0, | ||
| 425 | .rate_max = 1562500, | ||
| 426 | }, | ||
| 427 | .capture = { | ||
| 428 | .channels_min = 2, | ||
| 429 | .channels_max = 8, | ||
| 430 | .formats = S6000_I2S_FORMATS, | ||
| 431 | .rates = S6000_I2S_RATES, | ||
| 432 | .rate_min = 0, | ||
| 433 | .rate_max = 1562500, | ||
| 434 | }, | ||
| 435 | .ops = &s6000_i2s_dai_ops, | ||
| 436 | }; | ||
| 437 | |||
| 438 | static const struct snd_soc_component_driver s6000_i2s_component = { | ||
| 439 | .name = "s6000-i2s", | ||
| 440 | }; | ||
| 441 | |||
| 442 | static int s6000_i2s_probe(struct platform_device *pdev) | ||
| 443 | { | ||
| 444 | struct s6000_i2s_dev *dev; | ||
| 445 | struct resource *scbmem, *sifmem, *region, *dma1, *dma2; | ||
| 446 | u8 __iomem *mmio; | ||
| 447 | int ret; | ||
| 448 | |||
| 449 | scbmem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 450 | if (!scbmem) { | ||
| 451 | dev_err(&pdev->dev, "no mem resource?\n"); | ||
| 452 | ret = -ENODEV; | ||
| 453 | goto err_release_none; | ||
| 454 | } | ||
| 455 | |||
| 456 | region = request_mem_region(scbmem->start, resource_size(scbmem), | ||
| 457 | pdev->name); | ||
| 458 | if (!region) { | ||
| 459 | dev_err(&pdev->dev, "I2S SCB region already claimed\n"); | ||
| 460 | ret = -EBUSY; | ||
| 461 | goto err_release_none; | ||
| 462 | } | ||
| 463 | |||
| 464 | mmio = ioremap(scbmem->start, resource_size(scbmem)); | ||
| 465 | if (!mmio) { | ||
| 466 | dev_err(&pdev->dev, "can't ioremap SCB region\n"); | ||
| 467 | ret = -ENOMEM; | ||
| 468 | goto err_release_scb; | ||
| 469 | } | ||
| 470 | |||
| 471 | sifmem = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
| 472 | if (!sifmem) { | ||
| 473 | dev_err(&pdev->dev, "no second mem resource?\n"); | ||
| 474 | ret = -ENODEV; | ||
| 475 | goto err_release_map; | ||
| 476 | } | ||
| 477 | |||
| 478 | region = request_mem_region(sifmem->start, resource_size(sifmem), | ||
| 479 | pdev->name); | ||
| 480 | if (!region) { | ||
| 481 | dev_err(&pdev->dev, "I2S SIF region already claimed\n"); | ||
| 482 | ret = -EBUSY; | ||
| 483 | goto err_release_map; | ||
| 484 | } | ||
| 485 | |||
| 486 | dma1 = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
| 487 | if (!dma1) { | ||
| 488 | dev_err(&pdev->dev, "no dma resource?\n"); | ||
| 489 | ret = -ENODEV; | ||
| 490 | goto err_release_sif; | ||
| 491 | } | ||
| 492 | |||
| 493 | region = request_mem_region(dma1->start, resource_size(dma1), | ||
| 494 | pdev->name); | ||
| 495 | if (!region) { | ||
| 496 | dev_err(&pdev->dev, "I2S DMA region already claimed\n"); | ||
| 497 | ret = -EBUSY; | ||
| 498 | goto err_release_sif; | ||
| 499 | } | ||
| 500 | |||
| 501 | dma2 = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
| 502 | if (dma2) { | ||
| 503 | region = request_mem_region(dma2->start, resource_size(dma2), | ||
| 504 | pdev->name); | ||
| 505 | if (!region) { | ||
| 506 | dev_err(&pdev->dev, | ||
| 507 | "I2S DMA region already claimed\n"); | ||
| 508 | ret = -EBUSY; | ||
| 509 | goto err_release_dma1; | ||
| 510 | } | ||
| 511 | } | ||
| 512 | |||
| 513 | dev = kzalloc(sizeof(struct s6000_i2s_dev), GFP_KERNEL); | ||
| 514 | if (!dev) { | ||
| 515 | ret = -ENOMEM; | ||
| 516 | goto err_release_dma2; | ||
| 517 | } | ||
| 518 | dev_set_drvdata(&pdev->dev, dev); | ||
| 519 | |||
| 520 | dev->sifbase = sifmem->start; | ||
| 521 | dev->scbbase = mmio; | ||
| 522 | |||
| 523 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_ENABLE, 0); | ||
| 524 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_CLEAR, | ||
| 525 | S6_I2S_INT_ALIGNMENT | | ||
| 526 | S6_I2S_INT_UNDERRUN | | ||
| 527 | S6_I2S_INT_OVERRUN); | ||
| 528 | |||
| 529 | s6000_i2s_stop_channel(dev, 0); | ||
| 530 | s6000_i2s_stop_channel(dev, 1); | ||
| 531 | s6000_i2s_wait_disabled(dev); | ||
| 532 | |||
| 533 | dev->dma_params.check_xrun = s6000_i2s_check_xrun; | ||
| 534 | dev->dma_params.trigger = s6000_i2s_trigger; | ||
| 535 | dev->dma_params.dma_in = dma1->start; | ||
| 536 | dev->dma_params.dma_out = dma2 ? dma2->start : 0; | ||
| 537 | dev->dma_params.irq = platform_get_irq(pdev, 0); | ||
| 538 | if (dev->dma_params.irq < 0) { | ||
| 539 | dev_err(&pdev->dev, "no irq resource?\n"); | ||
| 540 | ret = -ENODEV; | ||
| 541 | goto err_release_dev; | ||
| 542 | } | ||
| 543 | |||
| 544 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_ENABLE, | ||
| 545 | S6_I2S_INT_ALIGNMENT | | ||
| 546 | S6_I2S_INT_UNDERRUN | | ||
| 547 | S6_I2S_INT_OVERRUN); | ||
| 548 | |||
| 549 | ret = snd_soc_register_component(&pdev->dev, &s6000_i2s_component, | ||
| 550 | &s6000_i2s_dai, 1); | ||
| 551 | if (ret) | ||
| 552 | goto err_release_dev; | ||
| 553 | |||
| 554 | return 0; | ||
| 555 | |||
| 556 | err_release_dev: | ||
| 557 | kfree(dev); | ||
| 558 | err_release_dma2: | ||
| 559 | if (dma2) | ||
| 560 | release_mem_region(dma2->start, resource_size(dma2)); | ||
| 561 | err_release_dma1: | ||
| 562 | release_mem_region(dma1->start, resource_size(dma1)); | ||
| 563 | err_release_sif: | ||
| 564 | release_mem_region(sifmem->start, resource_size(sifmem)); | ||
| 565 | err_release_map: | ||
| 566 | iounmap(mmio); | ||
| 567 | err_release_scb: | ||
| 568 | release_mem_region(scbmem->start, resource_size(scbmem)); | ||
| 569 | err_release_none: | ||
| 570 | return ret; | ||
| 571 | } | ||
| 572 | |||
| 573 | static int s6000_i2s_remove(struct platform_device *pdev) | ||
| 574 | { | ||
| 575 | struct s6000_i2s_dev *dev = dev_get_drvdata(&pdev->dev); | ||
| 576 | struct resource *region; | ||
| 577 | void __iomem *mmio = dev->scbbase; | ||
| 578 | |||
| 579 | snd_soc_unregister_component(&pdev->dev); | ||
| 580 | |||
| 581 | s6000_i2s_stop_channel(dev, 0); | ||
| 582 | s6000_i2s_stop_channel(dev, 1); | ||
| 583 | |||
| 584 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_ENABLE, 0); | ||
| 585 | kfree(dev); | ||
| 586 | |||
| 587 | region = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
| 588 | release_mem_region(region->start, resource_size(region)); | ||
| 589 | |||
| 590 | region = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
| 591 | if (region) | ||
| 592 | release_mem_region(region->start, resource_size(region)); | ||
| 593 | |||
| 594 | region = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 595 | release_mem_region(region->start, resource_size(region)); | ||
| 596 | |||
| 597 | iounmap(mmio); | ||
| 598 | region = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
| 599 | release_mem_region(region->start, resource_size(region)); | ||
| 600 | |||
| 601 | return 0; | ||
| 602 | } | ||
| 603 | |||
| 604 | static struct platform_driver s6000_i2s_driver = { | ||
| 605 | .probe = s6000_i2s_probe, | ||
| 606 | .remove = s6000_i2s_remove, | ||
| 607 | .driver = { | ||
| 608 | .name = "s6000-i2s", | ||
| 609 | .owner = THIS_MODULE, | ||
| 610 | }, | ||
| 611 | }; | ||
| 612 | |||
| 613 | module_platform_driver(s6000_i2s_driver); | ||
| 614 | |||
| 615 | MODULE_AUTHOR("Daniel Gloeckner"); | ||
| 616 | MODULE_DESCRIPTION("Stretch s6000 family I2S SoC Interface"); | ||
| 617 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s6000/s6000-i2s.h b/sound/soc/s6000/s6000-i2s.h deleted file mode 100644 index 86aa1921c89e..000000000000 --- a/sound/soc/s6000/s6000-i2s.h +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * ALSA SoC I2S Audio Layer for the Stretch s6000 family | ||
| 3 | * | ||
| 4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
| 5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _S6000_I2S_H | ||
| 13 | #define _S6000_I2S_H | ||
| 14 | |||
| 15 | struct s6000_snd_platform_data { | ||
| 16 | int lines_in; | ||
| 17 | int lines_out; | ||
| 18 | int channel_in; | ||
| 19 | int channel_out; | ||
| 20 | int wide; | ||
| 21 | int same_rate; | ||
| 22 | }; | ||
| 23 | #endif | ||
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c deleted file mode 100644 index fb8461e1b1f6..000000000000 --- a/sound/soc/s6000/s6000-pcm.c +++ /dev/null | |||
| @@ -1,521 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * ALSA PCM interface for the Stetch s6000 family | ||
| 3 | * | ||
| 4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
| 5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/module.h> | ||
| 13 | #include <linux/init.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <linux/slab.h> | ||
| 16 | #include <linux/dma-mapping.h> | ||
| 17 | #include <linux/interrupt.h> | ||
| 18 | |||
| 19 | #include <sound/core.h> | ||
| 20 | #include <sound/pcm.h> | ||
| 21 | #include <sound/pcm_params.h> | ||
| 22 | #include <sound/soc.h> | ||
| 23 | |||
| 24 | #include <asm/dma.h> | ||
| 25 | #include <variant/dmac.h> | ||
| 26 | |||
| 27 | #include "s6000-pcm.h" | ||
| 28 | |||
| 29 | #define S6_PCM_PREALLOCATE_SIZE (96 * 1024) | ||
| 30 | #define S6_PCM_PREALLOCATE_MAX (2048 * 1024) | ||
| 31 | |||
| 32 | static struct snd_pcm_hardware s6000_pcm_hardware = { | ||
| 33 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
| 34 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | | ||
| 35 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_JOINT_DUPLEX), | ||
| 36 | .buffer_bytes_max = 0x7ffffff0, | ||
| 37 | .period_bytes_min = 16, | ||
| 38 | .period_bytes_max = 0xfffff0, | ||
| 39 | .periods_min = 2, | ||
| 40 | .periods_max = 1024, /* no limit */ | ||
| 41 | .fifo_size = 0, | ||
| 42 | }; | ||
| 43 | |||
| 44 | struct s6000_runtime_data { | ||
| 45 | spinlock_t lock; | ||
| 46 | int period; /* current DMA period */ | ||
| 47 | }; | ||
| 48 | |||
| 49 | static void s6000_pcm_enqueue_dma(struct snd_pcm_substream *substream) | ||
| 50 | { | ||
| 51 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 52 | struct s6000_runtime_data *prtd = runtime->private_data; | ||
| 53 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 54 | struct s6000_pcm_dma_params *par; | ||
| 55 | int channel; | ||
| 56 | unsigned int period_size; | ||
| 57 | unsigned int dma_offset; | ||
| 58 | dma_addr_t dma_pos; | ||
| 59 | dma_addr_t src, dst; | ||
| 60 | |||
| 61 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 62 | |||
| 63 | period_size = snd_pcm_lib_period_bytes(substream); | ||
| 64 | dma_offset = prtd->period * period_size; | ||
| 65 | dma_pos = runtime->dma_addr + dma_offset; | ||
| 66 | |||
| 67 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
| 68 | src = dma_pos; | ||
| 69 | dst = par->sif_out; | ||
| 70 | channel = par->dma_out; | ||
| 71 | } else { | ||
| 72 | src = par->sif_in; | ||
| 73 | dst = dma_pos; | ||
| 74 | channel = par->dma_in; | ||
| 75 | } | ||
| 76 | |||
| 77 | if (!s6dmac_channel_enabled(DMA_MASK_DMAC(channel), | ||
| 78 | DMA_INDEX_CHNL(channel))) | ||
| 79 | return; | ||
| 80 | |||
| 81 | if (s6dmac_fifo_full(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel))) { | ||
| 82 | printk(KERN_ERR "s6000-pcm: fifo full\n"); | ||
| 83 | return; | ||
| 84 | } | ||
| 85 | |||
| 86 | if (WARN_ON(period_size & 15)) | ||
| 87 | return; | ||
| 88 | s6dmac_put_fifo(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel), | ||
| 89 | src, dst, period_size); | ||
| 90 | |||
| 91 | prtd->period++; | ||
| 92 | if (unlikely(prtd->period >= runtime->periods)) | ||
| 93 | prtd->period = 0; | ||
| 94 | } | ||
| 95 | |||
| 96 | static irqreturn_t s6000_pcm_irq(int irq, void *data) | ||
| 97 | { | ||
| 98 | struct snd_pcm *pcm = data; | ||
| 99 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | ||
| 100 | struct s6000_runtime_data *prtd; | ||
| 101 | unsigned int has_xrun; | ||
| 102 | int i, ret = IRQ_NONE; | ||
| 103 | |||
| 104 | for (i = 0; i < 2; ++i) { | ||
| 105 | struct snd_pcm_substream *substream = pcm->streams[i].substream; | ||
| 106 | struct s6000_pcm_dma_params *params = | ||
| 107 | snd_soc_dai_get_dma_data(runtime->cpu_dai, substream); | ||
| 108 | u32 channel; | ||
| 109 | unsigned int pending; | ||
| 110 | |||
| 111 | if (substream == SNDRV_PCM_STREAM_PLAYBACK) | ||
| 112 | channel = params->dma_out; | ||
| 113 | else | ||
| 114 | channel = params->dma_in; | ||
| 115 | |||
| 116 | has_xrun = params->check_xrun(runtime->cpu_dai); | ||
| 117 | |||
| 118 | if (!channel) | ||
| 119 | continue; | ||
| 120 | |||
| 121 | if (unlikely(has_xrun & (1 << i)) && | ||
| 122 | substream->runtime && | ||
| 123 | snd_pcm_running(substream)) { | ||
| 124 | dev_dbg(pcm->dev, "xrun\n"); | ||
| 125 | snd_pcm_stream_lock(substream); | ||
| 126 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | ||
| 127 | snd_pcm_stream_unlock(substream); | ||
| 128 | ret = IRQ_HANDLED; | ||
| 129 | } | ||
| 130 | |||
| 131 | pending = s6dmac_int_sources(DMA_MASK_DMAC(channel), | ||
| 132 | DMA_INDEX_CHNL(channel)); | ||
| 133 | |||
| 134 | if (pending & 1) { | ||
| 135 | ret = IRQ_HANDLED; | ||
| 136 | if (likely(substream->runtime && | ||
| 137 | snd_pcm_running(substream))) { | ||
| 138 | snd_pcm_period_elapsed(substream); | ||
| 139 | dev_dbg(pcm->dev, "period elapsed %x %x\n", | ||
| 140 | s6dmac_cur_src(DMA_MASK_DMAC(channel), | ||
| 141 | DMA_INDEX_CHNL(channel)), | ||
| 142 | s6dmac_cur_dst(DMA_MASK_DMAC(channel), | ||
| 143 | DMA_INDEX_CHNL(channel))); | ||
| 144 | prtd = substream->runtime->private_data; | ||
| 145 | spin_lock(&prtd->lock); | ||
| 146 | s6000_pcm_enqueue_dma(substream); | ||
| 147 | spin_unlock(&prtd->lock); | ||
| 148 | } | ||
| 149 | } | ||
| 150 | |||
| 151 | if (unlikely(pending & ~7)) { | ||
| 152 | if (pending & (1 << 3)) | ||
| 153 | printk(KERN_WARNING | ||
| 154 | "s6000-pcm: DMA %x Underflow\n", | ||
| 155 | channel); | ||
| 156 | if (pending & (1 << 4)) | ||
| 157 | printk(KERN_WARNING | ||
| 158 | "s6000-pcm: DMA %x Overflow\n", | ||
| 159 | channel); | ||
| 160 | if (pending & 0x1e0) | ||
| 161 | printk(KERN_WARNING | ||
| 162 | "s6000-pcm: DMA %x Master Error " | ||
| 163 | "(mask %x)\n", | ||
| 164 | channel, pending >> 5); | ||
| 165 | |||
| 166 | } | ||
| 167 | } | ||
| 168 | |||
| 169 | return ret; | ||
| 170 | } | ||
| 171 | |||
| 172 | static int s6000_pcm_start(struct snd_pcm_substream *substream) | ||
| 173 | { | ||
| 174 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | ||
| 175 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 176 | struct s6000_pcm_dma_params *par; | ||
| 177 | unsigned long flags; | ||
| 178 | int srcinc; | ||
| 179 | u32 dma; | ||
| 180 | |||
| 181 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 182 | |||
| 183 | spin_lock_irqsave(&prtd->lock, flags); | ||
| 184 | |||
| 185 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
| 186 | srcinc = 1; | ||
| 187 | dma = par->dma_out; | ||
| 188 | } else { | ||
| 189 | srcinc = 0; | ||
| 190 | dma = par->dma_in; | ||
| 191 | } | ||
| 192 | s6dmac_enable_chan(DMA_MASK_DMAC(dma), DMA_INDEX_CHNL(dma), | ||
| 193 | 1 /* priority 1 (0 is max) */, | ||
| 194 | 0 /* peripheral requests w/o xfer length mode */, | ||
| 195 | srcinc /* source address increment */, | ||
| 196 | srcinc^1 /* destination address increment */, | ||
| 197 | 0 /* chunksize 0 (skip impossible on this dma) */, | ||
| 198 | 0 /* source skip after chunk (impossible) */, | ||
| 199 | 0 /* destination skip after chunk (impossible) */, | ||
| 200 | 4 /* 16 byte burst size */, | ||
| 201 | -1 /* don't conserve bandwidth */, | ||
| 202 | 0 /* low watermark irq descriptor threshold */, | ||
| 203 | 0 /* disable hardware timestamps */, | ||
| 204 | 1 /* enable channel */); | ||
| 205 | |||
| 206 | s6000_pcm_enqueue_dma(substream); | ||
| 207 | s6000_pcm_enqueue_dma(substream); | ||
| 208 | |||
| 209 | spin_unlock_irqrestore(&prtd->lock, flags); | ||
| 210 | |||
| 211 | return 0; | ||
| 212 | } | ||
| 213 | |||
| 214 | static int s6000_pcm_stop(struct snd_pcm_substream *substream) | ||
| 215 | { | ||
| 216 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | ||
| 217 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 218 | struct s6000_pcm_dma_params *par; | ||
| 219 | unsigned long flags; | ||
| 220 | u32 channel; | ||
| 221 | |||
| 222 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 223 | |||
| 224 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
| 225 | channel = par->dma_out; | ||
| 226 | else | ||
| 227 | channel = par->dma_in; | ||
| 228 | |||
| 229 | s6dmac_set_terminal_count(DMA_MASK_DMAC(channel), | ||
| 230 | DMA_INDEX_CHNL(channel), 0); | ||
| 231 | |||
| 232 | spin_lock_irqsave(&prtd->lock, flags); | ||
| 233 | |||
| 234 | s6dmac_disable_chan(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel)); | ||
| 235 | |||
| 236 | spin_unlock_irqrestore(&prtd->lock, flags); | ||
| 237 | |||
| 238 | return 0; | ||
| 239 | } | ||
| 240 | |||
| 241 | static int s6000_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | ||
| 242 | { | ||
| 243 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 244 | struct s6000_pcm_dma_params *par; | ||
| 245 | int ret; | ||
| 246 | |||
| 247 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 248 | |||
| 249 | ret = par->trigger(substream, cmd, 0); | ||
| 250 | if (ret < 0) | ||
| 251 | return ret; | ||
| 252 | |||
| 253 | switch (cmd) { | ||
| 254 | case SNDRV_PCM_TRIGGER_START: | ||
| 255 | case SNDRV_PCM_TRIGGER_RESUME: | ||
| 256 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
| 257 | ret = s6000_pcm_start(substream); | ||
| 258 | break; | ||
| 259 | case SNDRV_PCM_TRIGGER_STOP: | ||
| 260 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
| 261 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
| 262 | ret = s6000_pcm_stop(substream); | ||
| 263 | break; | ||
| 264 | default: | ||
| 265 | ret = -EINVAL; | ||
| 266 | } | ||
| 267 | if (ret < 0) | ||
| 268 | return ret; | ||
| 269 | |||
| 270 | return par->trigger(substream, cmd, 1); | ||
| 271 | } | ||
| 272 | |||
| 273 | static int s6000_pcm_prepare(struct snd_pcm_substream *substream) | ||
| 274 | { | ||
| 275 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | ||
| 276 | |||
| 277 | prtd->period = 0; | ||
| 278 | |||
| 279 | return 0; | ||
| 280 | } | ||
| 281 | |||
| 282 | static snd_pcm_uframes_t s6000_pcm_pointer(struct snd_pcm_substream *substream) | ||
| 283 | { | ||
| 284 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 285 | struct s6000_pcm_dma_params *par; | ||
| 286 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 287 | struct s6000_runtime_data *prtd = runtime->private_data; | ||
| 288 | unsigned long flags; | ||
| 289 | unsigned int offset; | ||
| 290 | dma_addr_t count; | ||
| 291 | |||
| 292 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 293 | |||
| 294 | spin_lock_irqsave(&prtd->lock, flags); | ||
| 295 | |||
| 296 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
| 297 | count = s6dmac_cur_src(DMA_MASK_DMAC(par->dma_out), | ||
| 298 | DMA_INDEX_CHNL(par->dma_out)); | ||
| 299 | else | ||
| 300 | count = s6dmac_cur_dst(DMA_MASK_DMAC(par->dma_in), | ||
| 301 | DMA_INDEX_CHNL(par->dma_in)); | ||
| 302 | |||
| 303 | count -= runtime->dma_addr; | ||
| 304 | |||
| 305 | spin_unlock_irqrestore(&prtd->lock, flags); | ||
| 306 | |||
| 307 | offset = bytes_to_frames(runtime, count); | ||
| 308 | if (unlikely(offset >= runtime->buffer_size)) | ||
| 309 | offset = 0; | ||
| 310 | |||
| 311 | return offset; | ||
| 312 | } | ||
| 313 | |||
| 314 | static int s6000_pcm_open(struct snd_pcm_substream *substream) | ||
| 315 | { | ||
| 316 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 317 | struct s6000_pcm_dma_params *par; | ||
| 318 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 319 | struct s6000_runtime_data *prtd; | ||
| 320 | int ret; | ||
| 321 | |||
| 322 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 323 | snd_soc_set_runtime_hwparams(substream, &s6000_pcm_hardware); | ||
| 324 | |||
| 325 | ret = snd_pcm_hw_constraint_step(runtime, 0, | ||
| 326 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 16); | ||
| 327 | if (ret < 0) | ||
| 328 | return ret; | ||
| 329 | ret = snd_pcm_hw_constraint_step(runtime, 0, | ||
| 330 | SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 16); | ||
| 331 | if (ret < 0) | ||
| 332 | return ret; | ||
| 333 | ret = snd_pcm_hw_constraint_integer(runtime, | ||
| 334 | SNDRV_PCM_HW_PARAM_PERIODS); | ||
| 335 | if (ret < 0) | ||
| 336 | return ret; | ||
| 337 | |||
| 338 | if (par->same_rate) { | ||
| 339 | int rate; | ||
| 340 | spin_lock(&par->lock); /* needed? */ | ||
| 341 | rate = par->rate; | ||
| 342 | spin_unlock(&par->lock); | ||
| 343 | if (rate != -1) { | ||
| 344 | ret = snd_pcm_hw_constraint_minmax(runtime, | ||
| 345 | SNDRV_PCM_HW_PARAM_RATE, | ||
| 346 | rate, rate); | ||
| 347 | if (ret < 0) | ||
| 348 | return ret; | ||
| 349 | } | ||
| 350 | } | ||
| 351 | |||
| 352 | prtd = kzalloc(sizeof(struct s6000_runtime_data), GFP_KERNEL); | ||
| 353 | if (prtd == NULL) | ||
| 354 | return -ENOMEM; | ||
| 355 | |||
| 356 | spin_lock_init(&prtd->lock); | ||
| 357 | |||
| 358 | runtime->private_data = prtd; | ||
| 359 | |||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | |||
| 363 | static int s6000_pcm_close(struct snd_pcm_substream *substream) | ||
| 364 | { | ||
| 365 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
| 366 | struct s6000_runtime_data *prtd = runtime->private_data; | ||
| 367 | |||
| 368 | kfree(prtd); | ||
| 369 | |||
| 370 | return 0; | ||
| 371 | } | ||
| 372 | |||
| 373 | static int s6000_pcm_hw_params(struct snd_pcm_substream *substream, | ||
| 374 | struct snd_pcm_hw_params *hw_params) | ||
| 375 | { | ||
| 376 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 377 | struct s6000_pcm_dma_params *par; | ||
| 378 | int ret; | ||
| 379 | ret = snd_pcm_lib_malloc_pages(substream, | ||
| 380 | params_buffer_bytes(hw_params)); | ||
| 381 | if (ret < 0) { | ||
| 382 | printk(KERN_WARNING "s6000-pcm: allocation of memory failed\n"); | ||
| 383 | return ret; | ||
| 384 | } | ||
| 385 | |||
| 386 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 387 | |||
| 388 | if (par->same_rate) { | ||
| 389 | spin_lock(&par->lock); | ||
| 390 | if (par->rate == -1 || | ||
| 391 | !(par->in_use & ~(1 << substream->stream))) { | ||
| 392 | par->rate = params_rate(hw_params); | ||
| 393 | par->in_use |= 1 << substream->stream; | ||
| 394 | } else if (params_rate(hw_params) != par->rate) { | ||
| 395 | snd_pcm_lib_free_pages(substream); | ||
| 396 | par->in_use &= ~(1 << substream->stream); | ||
| 397 | ret = -EBUSY; | ||
| 398 | } | ||
| 399 | spin_unlock(&par->lock); | ||
| 400 | } | ||
| 401 | return ret; | ||
| 402 | } | ||
| 403 | |||
| 404 | static int s6000_pcm_hw_free(struct snd_pcm_substream *substream) | ||
| 405 | { | ||
| 406 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
| 407 | struct s6000_pcm_dma_params *par = | ||
| 408 | snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
| 409 | |||
| 410 | spin_lock(&par->lock); | ||
| 411 | par->in_use &= ~(1 << substream->stream); | ||
| 412 | if (!par->in_use) | ||
| 413 | par->rate = -1; | ||
| 414 | spin_unlock(&par->lock); | ||
| 415 | |||
| 416 | return snd_pcm_lib_free_pages(substream); | ||
| 417 | } | ||
| 418 | |||
| 419 | static struct snd_pcm_ops s6000_pcm_ops = { | ||
| 420 | .open = s6000_pcm_open, | ||
| 421 | .close = s6000_pcm_close, | ||
| 422 | .ioctl = snd_pcm_lib_ioctl, | ||
| 423 | .hw_params = s6000_pcm_hw_params, | ||
| 424 | .hw_free = s6000_pcm_hw_free, | ||
| 425 | .trigger = s6000_pcm_trigger, | ||
| 426 | .prepare = s6000_pcm_prepare, | ||
| 427 | .pointer = s6000_pcm_pointer, | ||
| 428 | }; | ||
| 429 | |||
| 430 | static void s6000_pcm_free(struct snd_pcm *pcm) | ||
| 431 | { | ||
| 432 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | ||
| 433 | struct s6000_pcm_dma_params *params = | ||
| 434 | snd_soc_dai_get_dma_data(runtime->cpu_dai, | ||
| 435 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); | ||
| 436 | |||
| 437 | free_irq(params->irq, pcm); | ||
| 438 | snd_pcm_lib_preallocate_free_for_all(pcm); | ||
| 439 | } | ||
| 440 | |||
| 441 | static int s6000_pcm_new(struct snd_soc_pcm_runtime *runtime) | ||
| 442 | { | ||
| 443 | struct snd_card *card = runtime->card->snd_card; | ||
| 444 | struct snd_pcm *pcm = runtime->pcm; | ||
| 445 | struct s6000_pcm_dma_params *params; | ||
| 446 | int res; | ||
| 447 | |||
| 448 | params = snd_soc_dai_get_dma_data(runtime->cpu_dai, | ||
| 449 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); | ||
| 450 | |||
| 451 | res = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); | ||
| 452 | if (res) | ||
| 453 | return res; | ||
| 454 | |||
| 455 | if (params->dma_in) { | ||
| 456 | s6dmac_disable_chan(DMA_MASK_DMAC(params->dma_in), | ||
| 457 | DMA_INDEX_CHNL(params->dma_in)); | ||
| 458 | s6dmac_int_sources(DMA_MASK_DMAC(params->dma_in), | ||
| 459 | DMA_INDEX_CHNL(params->dma_in)); | ||
| 460 | } | ||
| 461 | |||
| 462 | if (params->dma_out) { | ||
| 463 | s6dmac_disable_chan(DMA_MASK_DMAC(params->dma_out), | ||
| 464 | DMA_INDEX_CHNL(params->dma_out)); | ||
| 465 | s6dmac_int_sources(DMA_MASK_DMAC(params->dma_out), | ||
| 466 | DMA_INDEX_CHNL(params->dma_out)); | ||
| 467 | } | ||
| 468 | |||
| 469 | res = request_irq(params->irq, s6000_pcm_irq, IRQF_SHARED, | ||
| 470 | "s6000-audio", pcm); | ||
| 471 | if (res) { | ||
| 472 | printk(KERN_ERR "s6000-pcm couldn't get IRQ\n"); | ||
| 473 | return res; | ||
| 474 | } | ||
| 475 | |||
| 476 | res = snd_pcm_lib_preallocate_pages_for_all(pcm, | ||
| 477 | SNDRV_DMA_TYPE_DEV, | ||
| 478 | card->dev, | ||
| 479 | S6_PCM_PREALLOCATE_SIZE, | ||
| 480 | S6_PCM_PREALLOCATE_MAX); | ||
| 481 | if (res) | ||
| 482 | printk(KERN_WARNING "s6000-pcm: preallocation failed\n"); | ||
| 483 | |||
| 484 | spin_lock_init(¶ms->lock); | ||
| 485 | params->in_use = 0; | ||
| 486 | params->rate = -1; | ||
| 487 | return 0; | ||
| 488 | } | ||
| 489 | |||
| 490 | static struct snd_soc_platform_driver s6000_soc_platform = { | ||
| 491 | .ops = &s6000_pcm_ops, | ||
| 492 | .pcm_new = s6000_pcm_new, | ||
| 493 | .pcm_free = s6000_pcm_free, | ||
| 494 | }; | ||
| 495 | |||
| 496 | static int s6000_soc_platform_probe(struct platform_device *pdev) | ||
| 497 | { | ||
| 498 | return snd_soc_register_platform(&pdev->dev, &s6000_soc_platform); | ||
| 499 | } | ||
| 500 | |||
| 501 | static int s6000_soc_platform_remove(struct platform_device *pdev) | ||
| 502 | { | ||
| 503 | snd_soc_unregister_platform(&pdev->dev); | ||
| 504 | return 0; | ||
| 505 | } | ||
| 506 | |||
| 507 | static struct platform_driver s6000_pcm_driver = { | ||
| 508 | .driver = { | ||
| 509 | .name = "s6000-pcm-audio", | ||
| 510 | .owner = THIS_MODULE, | ||
| 511 | }, | ||
| 512 | |||
| 513 | .probe = s6000_soc_platform_probe, | ||
| 514 | .remove = s6000_soc_platform_remove, | ||
| 515 | }; | ||
| 516 | |||
| 517 | module_platform_driver(s6000_pcm_driver); | ||
| 518 | |||
| 519 | MODULE_AUTHOR("Daniel Gloeckner"); | ||
| 520 | MODULE_DESCRIPTION("Stretch s6000 family PCM DMA module"); | ||
| 521 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s6000/s6000-pcm.h b/sound/soc/s6000/s6000-pcm.h deleted file mode 100644 index 09d9b883e58b..000000000000 --- a/sound/soc/s6000/s6000-pcm.h +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * ALSA PCM interface for the Stretch s6000 family | ||
| 3 | * | ||
| 4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
| 5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef _S6000_PCM_H | ||
| 13 | #define _S6000_PCM_H | ||
| 14 | |||
| 15 | struct snd_soc_dai; | ||
| 16 | struct snd_pcm_substream; | ||
| 17 | |||
| 18 | struct s6000_pcm_dma_params { | ||
| 19 | unsigned int (*check_xrun)(struct snd_soc_dai *cpu_dai); | ||
| 20 | int (*trigger)(struct snd_pcm_substream *substream, int cmd, int after); | ||
| 21 | dma_addr_t sif_in; | ||
| 22 | dma_addr_t sif_out; | ||
| 23 | u32 dma_in; | ||
| 24 | u32 dma_out; | ||
| 25 | int irq; | ||
| 26 | int same_rate; | ||
| 27 | |||
| 28 | spinlock_t lock; | ||
| 29 | int in_use; | ||
| 30 | int rate; | ||
| 31 | }; | ||
| 32 | |||
| 33 | #endif | ||
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c deleted file mode 100644 index 3510c01f8a6a..000000000000 --- a/sound/soc/s6000/s6105-ipcam.c +++ /dev/null | |||
| @@ -1,221 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * ASoC driver for Stretch s6105 IP camera platform | ||
| 3 | * | ||
| 4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
| 5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/module.h> | ||
| 13 | #include <linux/moduleparam.h> | ||
| 14 | #include <linux/timer.h> | ||
| 15 | #include <linux/interrupt.h> | ||
| 16 | #include <linux/platform_device.h> | ||
| 17 | #include <linux/i2c.h> | ||
| 18 | #include <sound/core.h> | ||
| 19 | #include <sound/pcm.h> | ||
| 20 | #include <sound/soc.h> | ||
| 21 | |||
| 22 | #include "s6000-pcm.h" | ||
| 23 | #include "s6000-i2s.h" | ||
| 24 | |||
| 25 | #define S6105_CAM_CODEC_CLOCK 12288000 | ||
| 26 | |||
| 27 | static int s6105_hw_params(struct snd_pcm_substream *substream, | ||
| 28 | struct snd_pcm_hw_params *params) | ||
| 29 | { | ||
| 30 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 31 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
| 32 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
| 33 | int ret = 0; | ||
| 34 | |||
| 35 | /* set codec DAI configuration */ | ||
| 36 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
| 37 | SND_SOC_DAIFMT_CBM_CFM); | ||
| 38 | if (ret < 0) | ||
| 39 | return ret; | ||
| 40 | |||
| 41 | /* set cpu DAI configuration */ | ||
| 42 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_CBM_CFM | | ||
| 43 | SND_SOC_DAIFMT_NB_NF); | ||
| 44 | if (ret < 0) | ||
| 45 | return ret; | ||
| 46 | |||
| 47 | /* set the codec system clock */ | ||
| 48 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, S6105_CAM_CODEC_CLOCK, | ||
| 49 | SND_SOC_CLOCK_OUT); | ||
| 50 | if (ret < 0) | ||
| 51 | return ret; | ||
| 52 | |||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | static struct snd_soc_ops s6105_ops = { | ||
| 57 | .hw_params = s6105_hw_params, | ||
| 58 | }; | ||
| 59 | |||
| 60 | /* s6105 machine dapm widgets */ | ||
| 61 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { | ||
| 62 | SND_SOC_DAPM_LINE("Audio Out Differential", NULL), | ||
| 63 | SND_SOC_DAPM_LINE("Audio Out Stereo", NULL), | ||
| 64 | SND_SOC_DAPM_LINE("Audio In", NULL), | ||
| 65 | }; | ||
| 66 | |||
| 67 | /* s6105 machine audio_mapnections to the codec pins */ | ||
| 68 | static const struct snd_soc_dapm_route audio_map[] = { | ||
| 69 | /* Audio Out connected to HPLOUT, HPLCOM, HPROUT */ | ||
| 70 | {"Audio Out Differential", NULL, "HPLOUT"}, | ||
| 71 | {"Audio Out Differential", NULL, "HPLCOM"}, | ||
| 72 | {"Audio Out Stereo", NULL, "HPLOUT"}, | ||
| 73 | {"Audio Out Stereo", NULL, "HPROUT"}, | ||
| 74 | |||
| 75 | /* Audio In connected to LINE1L, LINE1R */ | ||
| 76 | {"LINE1L", NULL, "Audio In"}, | ||
| 77 | {"LINE1R", NULL, "Audio In"}, | ||
| 78 | }; | ||
| 79 | |||
| 80 | static int output_type_info(struct snd_kcontrol *kcontrol, | ||
| 81 | struct snd_ctl_elem_info *uinfo) | ||
| 82 | { | ||
| 83 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
| 84 | uinfo->count = 1; | ||
| 85 | uinfo->value.enumerated.items = 2; | ||
| 86 | if (uinfo->value.enumerated.item) { | ||
| 87 | uinfo->value.enumerated.item = 1; | ||
| 88 | strcpy(uinfo->value.enumerated.name, "HPLOUT/HPROUT"); | ||
| 89 | } else { | ||
| 90 | strcpy(uinfo->value.enumerated.name, "HPLOUT/HPLCOM"); | ||
| 91 | } | ||
| 92 | return 0; | ||
| 93 | } | ||
| 94 | |||
| 95 | static int output_type_get(struct snd_kcontrol *kcontrol, | ||
| 96 | struct snd_ctl_elem_value *ucontrol) | ||
| 97 | { | ||
| 98 | ucontrol->value.enumerated.item[0] = kcontrol->private_value; | ||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | |||
| 102 | static int output_type_put(struct snd_kcontrol *kcontrol, | ||
| 103 | struct snd_ctl_elem_value *ucontrol) | ||
| 104 | { | ||
| 105 | struct snd_soc_card *card = kcontrol->private_data; | ||
| 106 | struct snd_soc_dapm_context *dapm = &card->dapm; | ||
| 107 | unsigned int val = (ucontrol->value.enumerated.item[0] != 0); | ||
| 108 | char *differential = "Audio Out Differential"; | ||
| 109 | char *stereo = "Audio Out Stereo"; | ||
| 110 | |||
| 111 | if (kcontrol->private_value == val) | ||
| 112 | return 0; | ||
| 113 | kcontrol->private_value = val; | ||
| 114 | snd_soc_dapm_disable_pin(dapm, val ? differential : stereo); | ||
| 115 | snd_soc_dapm_sync(dapm); | ||
| 116 | snd_soc_dapm_enable_pin(dapm, val ? stereo : differential); | ||
| 117 | snd_soc_dapm_sync(dapm); | ||
| 118 | |||
| 119 | return 1; | ||
| 120 | } | ||
| 121 | |||
| 122 | static const struct snd_kcontrol_new audio_out_mux = { | ||
| 123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 124 | .name = "Master Output Mux", | ||
| 125 | .index = 0, | ||
| 126 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | ||
| 127 | .info = output_type_info, | ||
| 128 | .get = output_type_get, | ||
| 129 | .put = output_type_put, | ||
| 130 | .private_value = 1 /* default to stereo */ | ||
| 131 | }; | ||
| 132 | |||
| 133 | /* Logic for a aic3x as connected on the s6105 ip camera ref design */ | ||
| 134 | static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd) | ||
| 135 | { | ||
| 136 | struct snd_soc_card *card = rtd->card; | ||
| 137 | |||
| 138 | /* must correspond to audio_out_mux.private_value initializer */ | ||
| 139 | snd_soc_dapm_disable_pin(&card->dapm, "Audio Out Differential"); | ||
| 140 | |||
| 141 | snd_ctl_add(card->snd_card, snd_ctl_new1(&audio_out_mux, card)); | ||
| 142 | |||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | /* s6105 digital audio interface glue - connects codec <--> CPU */ | ||
| 147 | static struct snd_soc_dai_link s6105_dai = { | ||
| 148 | .name = "TLV320AIC31", | ||
| 149 | .stream_name = "AIC31", | ||
| 150 | .cpu_dai_name = "s6000-i2s", | ||
| 151 | .codec_dai_name = "tlv320aic3x-hifi", | ||
| 152 | .platform_name = "s6000-pcm-audio", | ||
| 153 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
| 154 | .init = s6105_aic3x_init, | ||
| 155 | .ops = &s6105_ops, | ||
| 156 | }; | ||
| 157 | |||
| 158 | /* s6105 audio machine driver */ | ||
| 159 | static struct snd_soc_card snd_soc_card_s6105 = { | ||
| 160 | .name = "Stretch IP Camera", | ||
| 161 | .owner = THIS_MODULE, | ||
| 162 | .dai_link = &s6105_dai, | ||
| 163 | .num_links = 1, | ||
| 164 | |||
| 165 | .dapm_widgets = aic3x_dapm_widgets, | ||
| 166 | .num_dapm_widgets = ARRAY_SIZE(aic3x_dapm_widgets), | ||
| 167 | .dapm_routes = audio_map, | ||
| 168 | .num_dapm_routes = ARRAY_SIZE(audio_map), | ||
| 169 | .fully_routed = true, | ||
| 170 | }; | ||
| 171 | |||
| 172 | static struct s6000_snd_platform_data s6105_snd_data __initdata = { | ||
| 173 | .wide = 0, | ||
| 174 | .channel_in = 0, | ||
| 175 | .channel_out = 1, | ||
| 176 | .lines_in = 1, | ||
| 177 | .lines_out = 1, | ||
| 178 | .same_rate = 1, | ||
| 179 | }; | ||
| 180 | |||
| 181 | static struct platform_device *s6105_snd_device; | ||
| 182 | |||
| 183 | /* temporary i2c device creation until this can be moved into the machine | ||
| 184 | * support file. | ||
| 185 | */ | ||
| 186 | static struct i2c_board_info i2c_device[] = { | ||
| 187 | { I2C_BOARD_INFO("tlv320aic33", 0x18), } | ||
| 188 | }; | ||
| 189 | |||
| 190 | static int __init s6105_init(void) | ||
| 191 | { | ||
| 192 | int ret; | ||
| 193 | |||
| 194 | i2c_register_board_info(0, i2c_device, ARRAY_SIZE(i2c_device)); | ||
| 195 | |||
| 196 | s6105_snd_device = platform_device_alloc("soc-audio", -1); | ||
| 197 | if (!s6105_snd_device) | ||
| 198 | return -ENOMEM; | ||
| 199 | |||
| 200 | platform_set_drvdata(s6105_snd_device, &snd_soc_card_s6105); | ||
| 201 | platform_device_add_data(s6105_snd_device, &s6105_snd_data, | ||
| 202 | sizeof(s6105_snd_data)); | ||
| 203 | |||
| 204 | ret = platform_device_add(s6105_snd_device); | ||
| 205 | if (ret) | ||
| 206 | platform_device_put(s6105_snd_device); | ||
| 207 | |||
| 208 | return ret; | ||
| 209 | } | ||
| 210 | |||
| 211 | static void __exit s6105_exit(void) | ||
| 212 | { | ||
| 213 | platform_device_unregister(s6105_snd_device); | ||
| 214 | } | ||
| 215 | |||
| 216 | module_init(s6105_init); | ||
| 217 | module_exit(s6105_exit); | ||
| 218 | |||
| 219 | MODULE_AUTHOR("Daniel Gloeckner"); | ||
| 220 | MODULE_DESCRIPTION("Stretch s6105 IP camera ASoC driver"); | ||
| 221 | MODULE_LICENSE("GPL"); | ||
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 8c5c11ca8c53..25114c9a6801 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
| @@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv) | |||
| 1142 | 1142 | ||
| 1143 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) | 1143 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) |
| 1144 | { | 1144 | { |
| 1145 | int ret = hists__init(); | ||
| 1146 | |||
| 1147 | if (ret < 0) | ||
| 1148 | return ret; | ||
| 1149 | |||
| 1145 | perf_config(perf_default_config, NULL); | 1150 | perf_config(perf_default_config, NULL); |
| 1146 | 1151 | ||
| 1147 | argc = parse_options(argc, argv, options, diff_usage, 0); | 1152 | argc = parse_options(argc, argv, options, diff_usage, 0); |
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 04412b4770a2..7af26acf06d9 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
| @@ -375,7 +375,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
| 375 | OPT_CALLBACK('x', "exec", NULL, "executable|path", | 375 | OPT_CALLBACK('x', "exec", NULL, "executable|path", |
| 376 | "target executable name or path", opt_set_target), | 376 | "target executable name or path", opt_set_target), |
| 377 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, | 377 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, |
| 378 | "Disable symbol demangling"), | 378 | "Enable symbol demangling"), |
| 379 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, | 379 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, |
| 380 | "Enable kernel symbol demangling"), | 380 | "Enable kernel symbol demangling"), |
| 381 | OPT_END() | 381 | OPT_END() |
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index 937e4324ad94..a3b13d7dc1d4 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 13 | #define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
| 14 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 14 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
| 15 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 15 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
| 16 | #define CPUINFO_PROC "model name" | 16 | #define CPUINFO_PROC {"model name"} |
| 17 | #ifndef __NR_perf_event_open | 17 | #ifndef __NR_perf_event_open |
| 18 | # define __NR_perf_event_open 336 | 18 | # define __NR_perf_event_open 336 |
| 19 | #endif | 19 | #endif |
| @@ -30,7 +30,7 @@ | |||
| 30 | #define wmb() asm volatile("sfence" ::: "memory") | 30 | #define wmb() asm volatile("sfence" ::: "memory") |
| 31 | #define rmb() asm volatile("lfence" ::: "memory") | 31 | #define rmb() asm volatile("lfence" ::: "memory") |
| 32 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 32 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
| 33 | #define CPUINFO_PROC "model name" | 33 | #define CPUINFO_PROC {"model name"} |
| 34 | #ifndef __NR_perf_event_open | 34 | #ifndef __NR_perf_event_open |
| 35 | # define __NR_perf_event_open 298 | 35 | # define __NR_perf_event_open 298 |
| 36 | #endif | 36 | #endif |
| @@ -47,14 +47,14 @@ | |||
| 47 | #define mb() asm volatile ("sync" ::: "memory") | 47 | #define mb() asm volatile ("sync" ::: "memory") |
| 48 | #define wmb() asm volatile ("sync" ::: "memory") | 48 | #define wmb() asm volatile ("sync" ::: "memory") |
| 49 | #define rmb() asm volatile ("sync" ::: "memory") | 49 | #define rmb() asm volatile ("sync" ::: "memory") |
| 50 | #define CPUINFO_PROC "cpu" | 50 | #define CPUINFO_PROC {"cpu"} |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| 53 | #ifdef __s390__ | 53 | #ifdef __s390__ |
| 54 | #define mb() asm volatile("bcr 15,0" ::: "memory") | 54 | #define mb() asm volatile("bcr 15,0" ::: "memory") |
| 55 | #define wmb() asm volatile("bcr 15,0" ::: "memory") | 55 | #define wmb() asm volatile("bcr 15,0" ::: "memory") |
| 56 | #define rmb() asm volatile("bcr 15,0" ::: "memory") | 56 | #define rmb() asm volatile("bcr 15,0" ::: "memory") |
| 57 | #define CPUINFO_PROC "vendor_id" | 57 | #define CPUINFO_PROC {"vendor_id"} |
| 58 | #endif | 58 | #endif |
| 59 | 59 | ||
| 60 | #ifdef __sh__ | 60 | #ifdef __sh__ |
| @@ -67,14 +67,14 @@ | |||
| 67 | # define wmb() asm volatile("" ::: "memory") | 67 | # define wmb() asm volatile("" ::: "memory") |
| 68 | # define rmb() asm volatile("" ::: "memory") | 68 | # define rmb() asm volatile("" ::: "memory") |
| 69 | #endif | 69 | #endif |
| 70 | #define CPUINFO_PROC "cpu type" | 70 | #define CPUINFO_PROC {"cpu type"} |
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | #ifdef __hppa__ | 73 | #ifdef __hppa__ |
| 74 | #define mb() asm volatile("" ::: "memory") | 74 | #define mb() asm volatile("" ::: "memory") |
| 75 | #define wmb() asm volatile("" ::: "memory") | 75 | #define wmb() asm volatile("" ::: "memory") |
| 76 | #define rmb() asm volatile("" ::: "memory") | 76 | #define rmb() asm volatile("" ::: "memory") |
| 77 | #define CPUINFO_PROC "cpu" | 77 | #define CPUINFO_PROC {"cpu"} |
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | #ifdef __sparc__ | 80 | #ifdef __sparc__ |
| @@ -87,14 +87,14 @@ | |||
| 87 | #endif | 87 | #endif |
| 88 | #define wmb() asm volatile("":::"memory") | 88 | #define wmb() asm volatile("":::"memory") |
| 89 | #define rmb() asm volatile("":::"memory") | 89 | #define rmb() asm volatile("":::"memory") |
| 90 | #define CPUINFO_PROC "cpu" | 90 | #define CPUINFO_PROC {"cpu"} |
| 91 | #endif | 91 | #endif |
| 92 | 92 | ||
| 93 | #ifdef __alpha__ | 93 | #ifdef __alpha__ |
| 94 | #define mb() asm volatile("mb" ::: "memory") | 94 | #define mb() asm volatile("mb" ::: "memory") |
| 95 | #define wmb() asm volatile("wmb" ::: "memory") | 95 | #define wmb() asm volatile("wmb" ::: "memory") |
| 96 | #define rmb() asm volatile("mb" ::: "memory") | 96 | #define rmb() asm volatile("mb" ::: "memory") |
| 97 | #define CPUINFO_PROC "cpu model" | 97 | #define CPUINFO_PROC {"cpu model"} |
| 98 | #endif | 98 | #endif |
| 99 | 99 | ||
| 100 | #ifdef __ia64__ | 100 | #ifdef __ia64__ |
| @@ -102,7 +102,7 @@ | |||
| 102 | #define wmb() asm volatile ("mf" ::: "memory") | 102 | #define wmb() asm volatile ("mf" ::: "memory") |
| 103 | #define rmb() asm volatile ("mf" ::: "memory") | 103 | #define rmb() asm volatile ("mf" ::: "memory") |
| 104 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") | 104 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") |
| 105 | #define CPUINFO_PROC "model name" | 105 | #define CPUINFO_PROC {"model name"} |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| 108 | #ifdef __arm__ | 108 | #ifdef __arm__ |
| @@ -113,7 +113,7 @@ | |||
| 113 | #define mb() ((void(*)(void))0xffff0fa0)() | 113 | #define mb() ((void(*)(void))0xffff0fa0)() |
| 114 | #define wmb() ((void(*)(void))0xffff0fa0)() | 114 | #define wmb() ((void(*)(void))0xffff0fa0)() |
| 115 | #define rmb() ((void(*)(void))0xffff0fa0)() | 115 | #define rmb() ((void(*)(void))0xffff0fa0)() |
| 116 | #define CPUINFO_PROC "Processor" | 116 | #define CPUINFO_PROC {"model name", "Processor"} |
| 117 | #endif | 117 | #endif |
| 118 | 118 | ||
| 119 | #ifdef __aarch64__ | 119 | #ifdef __aarch64__ |
| @@ -133,28 +133,28 @@ | |||
| 133 | : "memory") | 133 | : "memory") |
| 134 | #define wmb() mb() | 134 | #define wmb() mb() |
| 135 | #define rmb() mb() | 135 | #define rmb() mb() |
| 136 | #define CPUINFO_PROC "cpu model" | 136 | #define CPUINFO_PROC {"cpu model"} |
| 137 | #endif | 137 | #endif |
| 138 | 138 | ||
| 139 | #ifdef __arc__ | 139 | #ifdef __arc__ |
| 140 | #define mb() asm volatile("" ::: "memory") | 140 | #define mb() asm volatile("" ::: "memory") |
| 141 | #define wmb() asm volatile("" ::: "memory") | 141 | #define wmb() asm volatile("" ::: "memory") |
| 142 | #define rmb() asm volatile("" ::: "memory") | 142 | #define rmb() asm volatile("" ::: "memory") |
| 143 | #define CPUINFO_PROC "Processor" | 143 | #define CPUINFO_PROC {"Processor"} |
| 144 | #endif | 144 | #endif |
| 145 | 145 | ||
| 146 | #ifdef __metag__ | 146 | #ifdef __metag__ |
| 147 | #define mb() asm volatile("" ::: "memory") | 147 | #define mb() asm volatile("" ::: "memory") |
| 148 | #define wmb() asm volatile("" ::: "memory") | 148 | #define wmb() asm volatile("" ::: "memory") |
| 149 | #define rmb() asm volatile("" ::: "memory") | 149 | #define rmb() asm volatile("" ::: "memory") |
| 150 | #define CPUINFO_PROC "CPU" | 150 | #define CPUINFO_PROC {"CPU"} |
| 151 | #endif | 151 | #endif |
| 152 | 152 | ||
| 153 | #ifdef __xtensa__ | 153 | #ifdef __xtensa__ |
| 154 | #define mb() asm volatile("memw" ::: "memory") | 154 | #define mb() asm volatile("memw" ::: "memory") |
| 155 | #define wmb() asm volatile("memw" ::: "memory") | 155 | #define wmb() asm volatile("memw" ::: "memory") |
| 156 | #define rmb() asm volatile("" ::: "memory") | 156 | #define rmb() asm volatile("" ::: "memory") |
| 157 | #define CPUINFO_PROC "core ID" | 157 | #define CPUINFO_PROC {"core ID"} |
| 158 | #endif | 158 | #endif |
| 159 | 159 | ||
| 160 | #ifdef __tile__ | 160 | #ifdef __tile__ |
| @@ -162,7 +162,7 @@ | |||
| 162 | #define wmb() asm volatile ("mf" ::: "memory") | 162 | #define wmb() asm volatile ("mf" ::: "memory") |
| 163 | #define rmb() asm volatile ("mf" ::: "memory") | 163 | #define rmb() asm volatile ("mf" ::: "memory") |
| 164 | #define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory") | 164 | #define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory") |
| 165 | #define CPUINFO_PROC "model name" | 165 | #define CPUINFO_PROC {"model name"} |
| 166 | #endif | 166 | #endif |
| 167 | 167 | ||
| 168 | #define barrier() asm volatile ("" ::: "memory") | 168 | #define barrier() asm volatile ("" ::: "memory") |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index ce0de00399da..26f5b2fe5dc8 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
| @@ -579,16 +579,12 @@ static int write_version(int fd, struct perf_header *h __maybe_unused, | |||
| 579 | return do_write_string(fd, perf_version_string); | 579 | return do_write_string(fd, perf_version_string); |
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | static int write_cpudesc(int fd, struct perf_header *h __maybe_unused, | 582 | static int __write_cpudesc(int fd, const char *cpuinfo_proc) |
| 583 | struct perf_evlist *evlist __maybe_unused) | ||
| 584 | { | 583 | { |
| 585 | #ifndef CPUINFO_PROC | ||
| 586 | #define CPUINFO_PROC NULL | ||
| 587 | #endif | ||
| 588 | FILE *file; | 584 | FILE *file; |
| 589 | char *buf = NULL; | 585 | char *buf = NULL; |
| 590 | char *s, *p; | 586 | char *s, *p; |
| 591 | const char *search = CPUINFO_PROC; | 587 | const char *search = cpuinfo_proc; |
| 592 | size_t len = 0; | 588 | size_t len = 0; |
| 593 | int ret = -1; | 589 | int ret = -1; |
| 594 | 590 | ||
| @@ -638,6 +634,25 @@ done: | |||
| 638 | return ret; | 634 | return ret; |
| 639 | } | 635 | } |
| 640 | 636 | ||
| 637 | static int write_cpudesc(int fd, struct perf_header *h __maybe_unused, | ||
| 638 | struct perf_evlist *evlist __maybe_unused) | ||
| 639 | { | ||
| 640 | #ifndef CPUINFO_PROC | ||
| 641 | #define CPUINFO_PROC {"model name", } | ||
| 642 | #endif | ||
| 643 | const char *cpuinfo_procs[] = CPUINFO_PROC; | ||
| 644 | unsigned int i; | ||
| 645 | |||
| 646 | for (i = 0; i < ARRAY_SIZE(cpuinfo_procs); i++) { | ||
| 647 | int ret; | ||
| 648 | ret = __write_cpudesc(fd, cpuinfo_procs[i]); | ||
| 649 | if (ret >= 0) | ||
| 650 | return ret; | ||
| 651 | } | ||
| 652 | return -1; | ||
| 653 | } | ||
| 654 | |||
| 655 | |||
| 641 | static int write_nrcpus(int fd, struct perf_header *h __maybe_unused, | 656 | static int write_nrcpus(int fd, struct perf_header *h __maybe_unused, |
| 642 | struct perf_evlist *evlist __maybe_unused) | 657 | struct perf_evlist *evlist __maybe_unused) |
| 643 | { | 658 | { |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 4906cd81cb56..9402885a77f3 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
| @@ -373,6 +373,9 @@ struct sort_entry sort_cpu = { | |||
| 373 | static int64_t | 373 | static int64_t |
| 374 | sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right) | 374 | sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right) |
| 375 | { | 375 | { |
| 376 | if (!left->branch_info || !right->branch_info) | ||
| 377 | return cmp_null(left->branch_info, right->branch_info); | ||
| 378 | |||
| 376 | return _sort__dso_cmp(left->branch_info->from.map, | 379 | return _sort__dso_cmp(left->branch_info->from.map, |
| 377 | right->branch_info->from.map); | 380 | right->branch_info->from.map); |
| 378 | } | 381 | } |
| @@ -380,13 +383,19 @@ sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 380 | static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf, | 383 | static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf, |
| 381 | size_t size, unsigned int width) | 384 | size_t size, unsigned int width) |
| 382 | { | 385 | { |
| 383 | return _hist_entry__dso_snprintf(he->branch_info->from.map, | 386 | if (he->branch_info) |
| 384 | bf, size, width); | 387 | return _hist_entry__dso_snprintf(he->branch_info->from.map, |
| 388 | bf, size, width); | ||
| 389 | else | ||
| 390 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
| 385 | } | 391 | } |
| 386 | 392 | ||
| 387 | static int64_t | 393 | static int64_t |
| 388 | sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right) | 394 | sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right) |
| 389 | { | 395 | { |
| 396 | if (!left->branch_info || !right->branch_info) | ||
| 397 | return cmp_null(left->branch_info, right->branch_info); | ||
| 398 | |||
| 390 | return _sort__dso_cmp(left->branch_info->to.map, | 399 | return _sort__dso_cmp(left->branch_info->to.map, |
| 391 | right->branch_info->to.map); | 400 | right->branch_info->to.map); |
| 392 | } | 401 | } |
| @@ -394,8 +403,11 @@ sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 394 | static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf, | 403 | static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf, |
| 395 | size_t size, unsigned int width) | 404 | size_t size, unsigned int width) |
| 396 | { | 405 | { |
| 397 | return _hist_entry__dso_snprintf(he->branch_info->to.map, | 406 | if (he->branch_info) |
| 398 | bf, size, width); | 407 | return _hist_entry__dso_snprintf(he->branch_info->to.map, |
| 408 | bf, size, width); | ||
| 409 | else | ||
| 410 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
| 399 | } | 411 | } |
| 400 | 412 | ||
| 401 | static int64_t | 413 | static int64_t |
| @@ -404,6 +416,12 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 404 | struct addr_map_symbol *from_l = &left->branch_info->from; | 416 | struct addr_map_symbol *from_l = &left->branch_info->from; |
| 405 | struct addr_map_symbol *from_r = &right->branch_info->from; | 417 | struct addr_map_symbol *from_r = &right->branch_info->from; |
| 406 | 418 | ||
| 419 | if (!left->branch_info || !right->branch_info) | ||
| 420 | return cmp_null(left->branch_info, right->branch_info); | ||
| 421 | |||
| 422 | from_l = &left->branch_info->from; | ||
| 423 | from_r = &right->branch_info->from; | ||
| 424 | |||
| 407 | if (!from_l->sym && !from_r->sym) | 425 | if (!from_l->sym && !from_r->sym) |
| 408 | return _sort__addr_cmp(from_l->addr, from_r->addr); | 426 | return _sort__addr_cmp(from_l->addr, from_r->addr); |
| 409 | 427 | ||
| @@ -413,8 +431,13 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 413 | static int64_t | 431 | static int64_t |
| 414 | sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right) | 432 | sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right) |
| 415 | { | 433 | { |
| 416 | struct addr_map_symbol *to_l = &left->branch_info->to; | 434 | struct addr_map_symbol *to_l, *to_r; |
| 417 | struct addr_map_symbol *to_r = &right->branch_info->to; | 435 | |
| 436 | if (!left->branch_info || !right->branch_info) | ||
| 437 | return cmp_null(left->branch_info, right->branch_info); | ||
| 438 | |||
| 439 | to_l = &left->branch_info->to; | ||
| 440 | to_r = &right->branch_info->to; | ||
| 418 | 441 | ||
| 419 | if (!to_l->sym && !to_r->sym) | 442 | if (!to_l->sym && !to_r->sym) |
| 420 | return _sort__addr_cmp(to_l->addr, to_r->addr); | 443 | return _sort__addr_cmp(to_l->addr, to_r->addr); |
| @@ -425,19 +448,27 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 425 | static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf, | 448 | static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf, |
| 426 | size_t size, unsigned int width) | 449 | size_t size, unsigned int width) |
| 427 | { | 450 | { |
| 428 | struct addr_map_symbol *from = &he->branch_info->from; | 451 | if (he->branch_info) { |
| 429 | return _hist_entry__sym_snprintf(from->map, from->sym, from->addr, | 452 | struct addr_map_symbol *from = &he->branch_info->from; |
| 430 | he->level, bf, size, width); | ||
| 431 | 453 | ||
| 454 | return _hist_entry__sym_snprintf(from->map, from->sym, from->addr, | ||
| 455 | he->level, bf, size, width); | ||
| 456 | } | ||
| 457 | |||
| 458 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
| 432 | } | 459 | } |
| 433 | 460 | ||
| 434 | static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf, | 461 | static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf, |
| 435 | size_t size, unsigned int width) | 462 | size_t size, unsigned int width) |
| 436 | { | 463 | { |
| 437 | struct addr_map_symbol *to = &he->branch_info->to; | 464 | if (he->branch_info) { |
| 438 | return _hist_entry__sym_snprintf(to->map, to->sym, to->addr, | 465 | struct addr_map_symbol *to = &he->branch_info->to; |
| 439 | he->level, bf, size, width); | ||
| 440 | 466 | ||
| 467 | return _hist_entry__sym_snprintf(to->map, to->sym, to->addr, | ||
| 468 | he->level, bf, size, width); | ||
| 469 | } | ||
| 470 | |||
| 471 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
| 441 | } | 472 | } |
| 442 | 473 | ||
| 443 | struct sort_entry sort_dso_from = { | 474 | struct sort_entry sort_dso_from = { |
| @@ -471,11 +502,13 @@ struct sort_entry sort_sym_to = { | |||
| 471 | static int64_t | 502 | static int64_t |
| 472 | sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right) | 503 | sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right) |
| 473 | { | 504 | { |
| 474 | const unsigned char mp = left->branch_info->flags.mispred != | 505 | unsigned char mp, p; |
| 475 | right->branch_info->flags.mispred; | 506 | |
| 476 | const unsigned char p = left->branch_info->flags.predicted != | 507 | if (!left->branch_info || !right->branch_info) |
| 477 | right->branch_info->flags.predicted; | 508 | return cmp_null(left->branch_info, right->branch_info); |
| 478 | 509 | ||
| 510 | mp = left->branch_info->flags.mispred != right->branch_info->flags.mispred; | ||
| 511 | p = left->branch_info->flags.predicted != right->branch_info->flags.predicted; | ||
| 479 | return mp || p; | 512 | return mp || p; |
| 480 | } | 513 | } |
| 481 | 514 | ||
| @@ -483,10 +516,12 @@ static int hist_entry__mispredict_snprintf(struct hist_entry *he, char *bf, | |||
| 483 | size_t size, unsigned int width){ | 516 | size_t size, unsigned int width){ |
| 484 | static const char *out = "N/A"; | 517 | static const char *out = "N/A"; |
| 485 | 518 | ||
| 486 | if (he->branch_info->flags.predicted) | 519 | if (he->branch_info) { |
| 487 | out = "N"; | 520 | if (he->branch_info->flags.predicted) |
| 488 | else if (he->branch_info->flags.mispred) | 521 | out = "N"; |
| 489 | out = "Y"; | 522 | else if (he->branch_info->flags.mispred) |
| 523 | out = "Y"; | ||
| 524 | } | ||
| 490 | 525 | ||
| 491 | return repsep_snprintf(bf, size, "%-*.*s", width, width, out); | 526 | return repsep_snprintf(bf, size, "%-*.*s", width, width, out); |
| 492 | } | 527 | } |
| @@ -989,6 +1024,9 @@ struct sort_entry sort_mem_dcacheline = { | |||
| 989 | static int64_t | 1024 | static int64_t |
| 990 | sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) | 1025 | sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) |
| 991 | { | 1026 | { |
| 1027 | if (!left->branch_info || !right->branch_info) | ||
| 1028 | return cmp_null(left->branch_info, right->branch_info); | ||
| 1029 | |||
| 992 | return left->branch_info->flags.abort != | 1030 | return left->branch_info->flags.abort != |
| 993 | right->branch_info->flags.abort; | 1031 | right->branch_info->flags.abort; |
| 994 | } | 1032 | } |
| @@ -996,10 +1034,15 @@ sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 996 | static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf, | 1034 | static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf, |
| 997 | size_t size, unsigned int width) | 1035 | size_t size, unsigned int width) |
| 998 | { | 1036 | { |
| 999 | static const char *out = "."; | 1037 | static const char *out = "N/A"; |
| 1038 | |||
| 1039 | if (he->branch_info) { | ||
| 1040 | if (he->branch_info->flags.abort) | ||
| 1041 | out = "A"; | ||
| 1042 | else | ||
| 1043 | out = "."; | ||
| 1044 | } | ||
| 1000 | 1045 | ||
| 1001 | if (he->branch_info->flags.abort) | ||
| 1002 | out = "A"; | ||
| 1003 | return repsep_snprintf(bf, size, "%-*s", width, out); | 1046 | return repsep_snprintf(bf, size, "%-*s", width, out); |
| 1004 | } | 1047 | } |
| 1005 | 1048 | ||
| @@ -1013,6 +1056,9 @@ struct sort_entry sort_abort = { | |||
| 1013 | static int64_t | 1056 | static int64_t |
| 1014 | sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right) | 1057 | sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right) |
| 1015 | { | 1058 | { |
| 1059 | if (!left->branch_info || !right->branch_info) | ||
| 1060 | return cmp_null(left->branch_info, right->branch_info); | ||
| 1061 | |||
| 1016 | return left->branch_info->flags.in_tx != | 1062 | return left->branch_info->flags.in_tx != |
| 1017 | right->branch_info->flags.in_tx; | 1063 | right->branch_info->flags.in_tx; |
| 1018 | } | 1064 | } |
| @@ -1020,10 +1066,14 @@ sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right) | |||
| 1020 | static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf, | 1066 | static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf, |
| 1021 | size_t size, unsigned int width) | 1067 | size_t size, unsigned int width) |
| 1022 | { | 1068 | { |
| 1023 | static const char *out = "."; | 1069 | static const char *out = "N/A"; |
| 1024 | 1070 | ||
| 1025 | if (he->branch_info->flags.in_tx) | 1071 | if (he->branch_info) { |
| 1026 | out = "T"; | 1072 | if (he->branch_info->flags.in_tx) |
| 1073 | out = "T"; | ||
| 1074 | else | ||
| 1075 | out = "."; | ||
| 1076 | } | ||
| 1027 | 1077 | ||
| 1028 | return repsep_snprintf(bf, size, "%-*s", width, out); | 1078 | return repsep_snprintf(bf, size, "%-*s", width, out); |
| 1029 | } | 1079 | } |
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 2b7b2d91c016..c41411726c7a 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
| @@ -117,6 +117,9 @@ int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp, | |||
| 117 | if (!new) | 117 | if (!new) |
| 118 | return -ENOMEM; | 118 | return -ENOMEM; |
| 119 | list_add(&new->list, &thread->comm_list); | 119 | list_add(&new->list, &thread->comm_list); |
| 120 | |||
| 121 | if (exec) | ||
| 122 | unwind__flush_access(thread); | ||
| 120 | } | 123 | } |
| 121 | 124 | ||
| 122 | thread->comm_set = true; | 125 | thread->comm_set = true; |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index e060386165c5..4d45c0dfe343 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
| @@ -539,11 +539,23 @@ int unwind__prepare_access(struct thread *thread) | |||
| 539 | return -ENOMEM; | 539 | return -ENOMEM; |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | unw_set_caching_policy(addr_space, UNW_CACHE_GLOBAL); | ||
| 542 | thread__set_priv(thread, addr_space); | 543 | thread__set_priv(thread, addr_space); |
| 543 | 544 | ||
| 544 | return 0; | 545 | return 0; |
| 545 | } | 546 | } |
| 546 | 547 | ||
| 548 | void unwind__flush_access(struct thread *thread) | ||
| 549 | { | ||
| 550 | unw_addr_space_t addr_space; | ||
| 551 | |||
| 552 | if (callchain_param.record_mode != CALLCHAIN_DWARF) | ||
| 553 | return; | ||
| 554 | |||
| 555 | addr_space = thread__priv(thread); | ||
| 556 | unw_flush_cache(addr_space, 0, 0); | ||
| 557 | } | ||
| 558 | |||
| 547 | void unwind__finish_access(struct thread *thread) | 559 | void unwind__finish_access(struct thread *thread) |
| 548 | { | 560 | { |
| 549 | unw_addr_space_t addr_space; | 561 | unw_addr_space_t addr_space; |
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index c17c4855bdbc..f50b737235eb 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h | |||
| @@ -23,6 +23,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
| 23 | #ifdef HAVE_LIBUNWIND_SUPPORT | 23 | #ifdef HAVE_LIBUNWIND_SUPPORT |
| 24 | int libunwind__arch_reg_id(int regnum); | 24 | int libunwind__arch_reg_id(int regnum); |
| 25 | int unwind__prepare_access(struct thread *thread); | 25 | int unwind__prepare_access(struct thread *thread); |
| 26 | void unwind__flush_access(struct thread *thread); | ||
| 26 | void unwind__finish_access(struct thread *thread); | 27 | void unwind__finish_access(struct thread *thread); |
| 27 | #else | 28 | #else |
| 28 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | 29 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) |
| @@ -30,6 +31,7 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | |||
| 30 | return 0; | 31 | return 0; |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 34 | static inline void unwind__flush_access(struct thread *thread __maybe_unused) {} | ||
| 33 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} | 35 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} |
| 34 | #endif | 36 | #endif |
| 35 | #else | 37 | #else |
| @@ -49,6 +51,7 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | |||
| 49 | return 0; | 51 | return 0; |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 54 | static inline void unwind__flush_access(struct thread *thread __maybe_unused) {} | ||
| 52 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} | 55 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} |
| 53 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ | 56 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ |
| 54 | #endif /* __UNWIND_H */ | 57 | #endif /* __UNWIND_H */ |
