diff options
426 files changed, 3770 insertions, 3113 deletions
diff --git a/.get_maintainer.ignore b/.get_maintainer.ignore new file mode 100644 index 000000000000..cca6d870f7a5 --- /dev/null +++ b/.get_maintainer.ignore | |||
| @@ -0,0 +1 @@ | |||
| Christoph Hellwig <hch@lst.de> | |||
| @@ -17,6 +17,7 @@ Aleksey Gorelov <aleksey_gorelov@phoenix.com> | |||
| 17 | Al Viro <viro@ftp.linux.org.uk> | 17 | Al Viro <viro@ftp.linux.org.uk> |
| 18 | Al Viro <viro@zenIV.linux.org.uk> | 18 | Al Viro <viro@zenIV.linux.org.uk> |
| 19 | Andreas Herrmann <aherrman@de.ibm.com> | 19 | Andreas Herrmann <aherrman@de.ibm.com> |
| 20 | Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com> | ||
| 20 | Andrew Morton <akpm@linux-foundation.org> | 21 | Andrew Morton <akpm@linux-foundation.org> |
| 21 | Andrew Vasquez <andrew.vasquez@qlogic.com> | 22 | Andrew Vasquez <andrew.vasquez@qlogic.com> |
| 22 | Andy Adamson <andros@citi.umich.edu> | 23 | Andy Adamson <andros@citi.umich.edu> |
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt index d6b794cef0b8..91e6e5c478d0 100644 --- a/Documentation/devicetree/bindings/arm/cpus.txt +++ b/Documentation/devicetree/bindings/arm/cpus.txt | |||
| @@ -199,6 +199,7 @@ nodes to be present and contain the properties described below. | |||
| 199 | "qcom,kpss-acc-v1" | 199 | "qcom,kpss-acc-v1" |
| 200 | "qcom,kpss-acc-v2" | 200 | "qcom,kpss-acc-v2" |
| 201 | "rockchip,rk3066-smp" | 201 | "rockchip,rk3066-smp" |
| 202 | "ste,dbx500-smp" | ||
| 202 | 203 | ||
| 203 | - cpu-release-addr | 204 | - cpu-release-addr |
| 204 | Usage: required for systems that have an "enable-method" | 205 | Usage: required for systems that have an "enable-method" |
diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt index 305e3df3d9b1..9cf9446eaf2e 100644 --- a/Documentation/devicetree/bindings/phy/ti-phy.txt +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt | |||
| @@ -82,6 +82,9 @@ Optional properties: | |||
| 82 | - id: If there are multiple instance of the same type, in order to | 82 | - id: If there are multiple instance of the same type, in order to |
| 83 | differentiate between each instance "id" can be used (e.g., multi-lane PCIe | 83 | differentiate between each instance "id" can be used (e.g., multi-lane PCIe |
| 84 | PHY). If "id" is not provided, it is set to default value of '1'. | 84 | PHY). If "id" is not provided, it is set to default value of '1'. |
| 85 | - syscon-pllreset: Handle to system control region that contains the | ||
| 86 | CTRL_CORE_SMA_SW_0 register and register offset to the CTRL_CORE_SMA_SW_0 | ||
| 87 | register that contains the SATA_PLL_SOFT_RESET bit. Only valid for sata_phy. | ||
| 85 | 88 | ||
| 86 | This is usually a subnode of ocp2scp to which it is connected. | 89 | This is usually a subnode of ocp2scp to which it is connected. |
| 87 | 90 | ||
| @@ -100,3 +103,16 @@ usb3phy@4a084400 { | |||
| 100 | "sysclk", | 103 | "sysclk", |
| 101 | "refclk"; | 104 | "refclk"; |
| 102 | }; | 105 | }; |
| 106 | |||
| 107 | sata_phy: phy@4A096000 { | ||
| 108 | compatible = "ti,phy-pipe3-sata"; | ||
| 109 | reg = <0x4A096000 0x80>, /* phy_rx */ | ||
| 110 | <0x4A096400 0x64>, /* phy_tx */ | ||
| 111 | <0x4A096800 0x40>; /* pll_ctrl */ | ||
| 112 | reg-names = "phy_rx", "phy_tx", "pll_ctrl"; | ||
| 113 | ctrl-module = <&omap_control_sata>; | ||
| 114 | clocks = <&sys_clkin1>, <&sata_ref_clk>; | ||
| 115 | clock-names = "sysclk", "refclk"; | ||
| 116 | syscon-pllreset = <&scm_conf 0x3fc>; | ||
| 117 | #phy-cells = <0>; | ||
| 118 | }; | ||
diff --git a/Documentation/input/alps.txt b/Documentation/input/alps.txt index c86f2f1ae4f6..1fec1135791d 100644 --- a/Documentation/input/alps.txt +++ b/Documentation/input/alps.txt | |||
| @@ -119,8 +119,10 @@ ALPS Absolute Mode - Protocol Version 2 | |||
| 119 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 | 119 | byte 5: 0 z6 z5 z4 z3 z2 z1 z0 |
| 120 | 120 | ||
| 121 | Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for | 121 | Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for |
| 122 | the DualPoint Stick. For non interleaved dualpoint devices the pointingstick | 122 | the DualPoint Stick. The M, R and L bits signal the combined status of both |
| 123 | buttons get reported separately in the PSM, PSR and PSL bits. | 123 | the pointingstick and touchpad buttons, except for Dell dualpoint devices |
| 124 | where the pointingstick buttons get reported separately in the PSM, PSR | ||
| 125 | and PSL bits. | ||
| 124 | 126 | ||
| 125 | Dualpoint device -- interleaved packet format | 127 | Dualpoint device -- interleaved packet format |
| 126 | --------------------------------------------- | 128 | --------------------------------------------- |
diff --git a/MAINTAINERS b/MAINTAINERS index a9ae6c105520..b60e2b2369d2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -3587,6 +3587,15 @@ S: Maintained | |||
| 3587 | F: drivers/gpu/drm/rockchip/ | 3587 | F: drivers/gpu/drm/rockchip/ |
| 3588 | F: Documentation/devicetree/bindings/video/rockchip* | 3588 | F: Documentation/devicetree/bindings/video/rockchip* |
| 3589 | 3589 | ||
| 3590 | DRM DRIVERS FOR STI | ||
| 3591 | M: Benjamin Gaignard <benjamin.gaignard@linaro.org> | ||
| 3592 | M: Vincent Abriou <vincent.abriou@st.com> | ||
| 3593 | L: dri-devel@lists.freedesktop.org | ||
| 3594 | T: git http://git.linaro.org/people/benjamin.gaignard/kernel.git | ||
| 3595 | S: Maintained | ||
| 3596 | F: drivers/gpu/drm/sti | ||
| 3597 | F: Documentation/devicetree/bindings/gpu/st,stih4xx.txt | ||
| 3598 | |||
| 3590 | DSBR100 USB FM RADIO DRIVER | 3599 | DSBR100 USB FM RADIO DRIVER |
| 3591 | M: Alexey Klimov <klimov.linux@gmail.com> | 3600 | M: Alexey Klimov <klimov.linux@gmail.com> |
| 3592 | L: linux-media@vger.kernel.org | 3601 | L: linux-media@vger.kernel.org |
| @@ -5840,6 +5849,7 @@ S: Odd Fixes | |||
| 5840 | 5849 | ||
| 5841 | KERNEL NFSD, SUNRPC, AND LOCKD SERVERS | 5850 | KERNEL NFSD, SUNRPC, AND LOCKD SERVERS |
| 5842 | M: "J. Bruce Fields" <bfields@fieldses.org> | 5851 | M: "J. Bruce Fields" <bfields@fieldses.org> |
| 5852 | M: Jeff Layton <jlayton@poochiereds.net> | ||
| 5843 | L: linux-nfs@vger.kernel.org | 5853 | L: linux-nfs@vger.kernel.org |
| 5844 | W: http://nfs.sourceforge.net/ | 5854 | W: http://nfs.sourceforge.net/ |
| 5845 | S: Supported | 5855 | S: Supported |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 4 | 1 | VERSION = 4 |
| 2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
| 3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
| 4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = -rc8 |
| 5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -597,6 +597,11 @@ endif # $(dot-config) | |||
| 597 | # Defaults to vmlinux, but the arch makefile usually adds further targets | 597 | # Defaults to vmlinux, but the arch makefile usually adds further targets |
| 598 | all: vmlinux | 598 | all: vmlinux |
| 599 | 599 | ||
| 600 | # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default | ||
| 601 | # values of the respective KBUILD_* variables | ||
| 602 | ARCH_CPPFLAGS := | ||
| 603 | ARCH_AFLAGS := | ||
| 604 | ARCH_CFLAGS := | ||
| 600 | include arch/$(SRCARCH)/Makefile | 605 | include arch/$(SRCARCH)/Makefile |
| 601 | 606 | ||
| 602 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) | 607 | KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) |
| @@ -848,10 +853,10 @@ export mod_strip_cmd | |||
| 848 | mod_compress_cmd = true | 853 | mod_compress_cmd = true |
| 849 | ifdef CONFIG_MODULE_COMPRESS | 854 | ifdef CONFIG_MODULE_COMPRESS |
| 850 | ifdef CONFIG_MODULE_COMPRESS_GZIP | 855 | ifdef CONFIG_MODULE_COMPRESS_GZIP |
| 851 | mod_compress_cmd = gzip -n | 856 | mod_compress_cmd = gzip -n -f |
| 852 | endif # CONFIG_MODULE_COMPRESS_GZIP | 857 | endif # CONFIG_MODULE_COMPRESS_GZIP |
| 853 | ifdef CONFIG_MODULE_COMPRESS_XZ | 858 | ifdef CONFIG_MODULE_COMPRESS_XZ |
| 854 | mod_compress_cmd = xz | 859 | mod_compress_cmd = xz -f |
| 855 | endif # CONFIG_MODULE_COMPRESS_XZ | 860 | endif # CONFIG_MODULE_COMPRESS_XZ |
| 856 | endif # CONFIG_MODULE_COMPRESS | 861 | endif # CONFIG_MODULE_COMPRESS |
| 857 | export mod_compress_cmd | 862 | export mod_compress_cmd |
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 91cf4055acab..bd4670d1b89b 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
| @@ -313,11 +313,11 @@ config ARC_PAGE_SIZE_8K | |||
| 313 | 313 | ||
| 314 | config ARC_PAGE_SIZE_16K | 314 | config ARC_PAGE_SIZE_16K |
| 315 | bool "16KB" | 315 | bool "16KB" |
| 316 | depends on ARC_MMU_V3 | 316 | depends on ARC_MMU_V3 || ARC_MMU_V4 |
| 317 | 317 | ||
| 318 | config ARC_PAGE_SIZE_4K | 318 | config ARC_PAGE_SIZE_4K |
| 319 | bool "4KB" | 319 | bool "4KB" |
| 320 | depends on ARC_MMU_V3 | 320 | depends on ARC_MMU_V3 || ARC_MMU_V4 |
| 321 | 321 | ||
| 322 | endchoice | 322 | endchoice |
| 323 | 323 | ||
| @@ -365,6 +365,11 @@ config ARC_HAS_LLSC | |||
| 365 | default y | 365 | default y |
| 366 | depends on !ARC_CANT_LLSC | 366 | depends on !ARC_CANT_LLSC |
| 367 | 367 | ||
| 368 | config ARC_STAR_9000923308 | ||
| 369 | bool "Workaround for llock/scond livelock" | ||
| 370 | default y | ||
| 371 | depends on ISA_ARCV2 && SMP && ARC_HAS_LLSC | ||
| 372 | |||
| 368 | config ARC_HAS_SWAPE | 373 | config ARC_HAS_SWAPE |
| 369 | bool "Insn: SWAPE (endian-swap)" | 374 | bool "Insn: SWAPE (endian-swap)" |
| 370 | default y | 375 | default y |
| @@ -379,6 +384,10 @@ config ARC_HAS_LL64 | |||
| 379 | dest operands with 2 possible source operands. | 384 | dest operands with 2 possible source operands. |
| 380 | default y | 385 | default y |
| 381 | 386 | ||
| 387 | config ARC_HAS_DIV_REM | ||
| 388 | bool "Insn: div, divu, rem, remu" | ||
| 389 | default y | ||
| 390 | |||
| 382 | config ARC_HAS_RTC | 391 | config ARC_HAS_RTC |
| 383 | bool "Local 64-bit r/o cycle counter" | 392 | bool "Local 64-bit r/o cycle counter" |
| 384 | default n | 393 | default n |
diff --git a/arch/arc/Makefile b/arch/arc/Makefile index 46d87310220d..8a27a48304a4 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile | |||
| @@ -36,8 +36,16 @@ cflags-$(atleast_gcc44) += -fsection-anchors | |||
| 36 | cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock | 36 | cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock |
| 37 | cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape | 37 | cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape |
| 38 | 38 | ||
| 39 | ifdef CONFIG_ISA_ARCV2 | ||
| 40 | |||
| 39 | ifndef CONFIG_ARC_HAS_LL64 | 41 | ifndef CONFIG_ARC_HAS_LL64 |
| 40 | cflags-$(CONFIG_ISA_ARCV2) += -mno-ll64 | 42 | cflags-y += -mno-ll64 |
| 43 | endif | ||
| 44 | |||
| 45 | ifndef CONFIG_ARC_HAS_DIV_REM | ||
| 46 | cflags-y += -mno-div-rem | ||
| 47 | endif | ||
| 48 | |||
| 41 | endif | 49 | endif |
| 42 | 50 | ||
| 43 | cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables | 51 | cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables |
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 070f58827a5c..c8f57b8449dc 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
| @@ -89,11 +89,10 @@ | |||
| 89 | #define ECR_C_BIT_DTLB_LD_MISS 8 | 89 | #define ECR_C_BIT_DTLB_LD_MISS 8 |
| 90 | #define ECR_C_BIT_DTLB_ST_MISS 9 | 90 | #define ECR_C_BIT_DTLB_ST_MISS 9 |
| 91 | 91 | ||
| 92 | |||
| 93 | /* Auxiliary registers */ | 92 | /* Auxiliary registers */ |
| 94 | #define AUX_IDENTITY 4 | 93 | #define AUX_IDENTITY 4 |
| 95 | #define AUX_INTR_VEC_BASE 0x25 | 94 | #define AUX_INTR_VEC_BASE 0x25 |
| 96 | 95 | #define AUX_NON_VOL 0x5e | |
| 97 | 96 | ||
| 98 | /* | 97 | /* |
| 99 | * Floating Pt Registers | 98 | * Floating Pt Registers |
| @@ -240,9 +239,9 @@ struct bcr_extn_xymem { | |||
| 240 | 239 | ||
| 241 | struct bcr_perip { | 240 | struct bcr_perip { |
| 242 | #ifdef CONFIG_CPU_BIG_ENDIAN | 241 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 243 | unsigned int start:8, pad2:8, sz:8, pad:8; | 242 | unsigned int start:8, pad2:8, sz:8, ver:8; |
| 244 | #else | 243 | #else |
| 245 | unsigned int pad:8, sz:8, pad2:8, start:8; | 244 | unsigned int ver:8, sz:8, pad2:8, start:8; |
| 246 | #endif | 245 | #endif |
| 247 | }; | 246 | }; |
| 248 | 247 | ||
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index 03484cb4d16d..87d18ae53115 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h | |||
| @@ -23,33 +23,60 @@ | |||
| 23 | 23 | ||
| 24 | #define atomic_set(v, i) (((v)->counter) = (i)) | 24 | #define atomic_set(v, i) (((v)->counter) = (i)) |
| 25 | 25 | ||
| 26 | #ifdef CONFIG_ISA_ARCV2 | 26 | #ifdef CONFIG_ARC_STAR_9000923308 |
| 27 | #define PREFETCHW " prefetchw [%1] \n" | 27 | |
| 28 | #else | 28 | #define SCOND_FAIL_RETRY_VAR_DEF \ |
| 29 | #define PREFETCHW | 29 | unsigned int delay = 1, tmp; \ |
| 30 | |||
| 31 | #define SCOND_FAIL_RETRY_ASM \ | ||
| 32 | " bz 4f \n" \ | ||
| 33 | " ; --- scond fail delay --- \n" \ | ||
| 34 | " mov %[tmp], %[delay] \n" /* tmp = delay */ \ | ||
| 35 | "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ | ||
| 36 | " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ | ||
| 37 | " rol %[delay], %[delay] \n" /* delay *= 2 */ \ | ||
| 38 | " b 1b \n" /* start over */ \ | ||
| 39 | "4: ; --- success --- \n" \ | ||
| 40 | |||
| 41 | #define SCOND_FAIL_RETRY_VARS \ | ||
| 42 | ,[delay] "+&r" (delay),[tmp] "=&r" (tmp) \ | ||
| 43 | |||
| 44 | #else /* !CONFIG_ARC_STAR_9000923308 */ | ||
| 45 | |||
| 46 | #define SCOND_FAIL_RETRY_VAR_DEF | ||
| 47 | |||
| 48 | #define SCOND_FAIL_RETRY_ASM \ | ||
| 49 | " bnz 1b \n" \ | ||
| 50 | |||
| 51 | #define SCOND_FAIL_RETRY_VARS | ||
| 52 | |||
| 30 | #endif | 53 | #endif |
| 31 | 54 | ||
| 32 | #define ATOMIC_OP(op, c_op, asm_op) \ | 55 | #define ATOMIC_OP(op, c_op, asm_op) \ |
| 33 | static inline void atomic_##op(int i, atomic_t *v) \ | 56 | static inline void atomic_##op(int i, atomic_t *v) \ |
| 34 | { \ | 57 | { \ |
| 35 | unsigned int temp; \ | 58 | unsigned int val; \ |
| 59 | SCOND_FAIL_RETRY_VAR_DEF \ | ||
| 36 | \ | 60 | \ |
| 37 | __asm__ __volatile__( \ | 61 | __asm__ __volatile__( \ |
| 38 | "1: \n" \ | 62 | "1: llock %[val], [%[ctr]] \n" \ |
| 39 | PREFETCHW \ | 63 | " " #asm_op " %[val], %[val], %[i] \n" \ |
| 40 | " llock %0, [%1] \n" \ | 64 | " scond %[val], [%[ctr]] \n" \ |
| 41 | " " #asm_op " %0, %0, %2 \n" \ | 65 | " \n" \ |
| 42 | " scond %0, [%1] \n" \ | 66 | SCOND_FAIL_RETRY_ASM \ |
| 43 | " bnz 1b \n" \ | 67 | \ |
| 44 | : "=&r"(temp) /* Early clobber, to prevent reg reuse */ \ | 68 | : [val] "=&r" (val) /* Early clobber to prevent reg reuse */ \ |
| 45 | : "r"(&v->counter), "ir"(i) \ | 69 | SCOND_FAIL_RETRY_VARS \ |
| 70 | : [ctr] "r" (&v->counter), /* Not "m": llock only supports reg direct addr mode */ \ | ||
| 71 | [i] "ir" (i) \ | ||
| 46 | : "cc"); \ | 72 | : "cc"); \ |
| 47 | } \ | 73 | } \ |
| 48 | 74 | ||
| 49 | #define ATOMIC_OP_RETURN(op, c_op, asm_op) \ | 75 | #define ATOMIC_OP_RETURN(op, c_op, asm_op) \ |
| 50 | static inline int atomic_##op##_return(int i, atomic_t *v) \ | 76 | static inline int atomic_##op##_return(int i, atomic_t *v) \ |
| 51 | { \ | 77 | { \ |
| 52 | unsigned int temp; \ | 78 | unsigned int val; \ |
| 79 | SCOND_FAIL_RETRY_VAR_DEF \ | ||
| 53 | \ | 80 | \ |
| 54 | /* \ | 81 | /* \ |
| 55 | * Explicit full memory barrier needed before/after as \ | 82 | * Explicit full memory barrier needed before/after as \ |
| @@ -58,19 +85,21 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
| 58 | smp_mb(); \ | 85 | smp_mb(); \ |
| 59 | \ | 86 | \ |
| 60 | __asm__ __volatile__( \ | 87 | __asm__ __volatile__( \ |
| 61 | "1: \n" \ | 88 | "1: llock %[val], [%[ctr]] \n" \ |
| 62 | PREFETCHW \ | 89 | " " #asm_op " %[val], %[val], %[i] \n" \ |
| 63 | " llock %0, [%1] \n" \ | 90 | " scond %[val], [%[ctr]] \n" \ |
| 64 | " " #asm_op " %0, %0, %2 \n" \ | 91 | " \n" \ |
| 65 | " scond %0, [%1] \n" \ | 92 | SCOND_FAIL_RETRY_ASM \ |
| 66 | " bnz 1b \n" \ | 93 | \ |
| 67 | : "=&r"(temp) \ | 94 | : [val] "=&r" (val) \ |
| 68 | : "r"(&v->counter), "ir"(i) \ | 95 | SCOND_FAIL_RETRY_VARS \ |
| 96 | : [ctr] "r" (&v->counter), \ | ||
| 97 | [i] "ir" (i) \ | ||
| 69 | : "cc"); \ | 98 | : "cc"); \ |
| 70 | \ | 99 | \ |
| 71 | smp_mb(); \ | 100 | smp_mb(); \ |
| 72 | \ | 101 | \ |
| 73 | return temp; \ | 102 | return val; \ |
| 74 | } | 103 | } |
| 75 | 104 | ||
| 76 | #else /* !CONFIG_ARC_HAS_LLSC */ | 105 | #else /* !CONFIG_ARC_HAS_LLSC */ |
| @@ -150,6 +179,9 @@ ATOMIC_OP(and, &=, and) | |||
| 150 | #undef ATOMIC_OPS | 179 | #undef ATOMIC_OPS |
| 151 | #undef ATOMIC_OP_RETURN | 180 | #undef ATOMIC_OP_RETURN |
| 152 | #undef ATOMIC_OP | 181 | #undef ATOMIC_OP |
| 182 | #undef SCOND_FAIL_RETRY_VAR_DEF | ||
| 183 | #undef SCOND_FAIL_RETRY_ASM | ||
| 184 | #undef SCOND_FAIL_RETRY_VARS | ||
| 153 | 185 | ||
| 154 | /** | 186 | /** |
| 155 | * __atomic_add_unless - add unless the number is a given value | 187 | * __atomic_add_unless - add unless the number is a given value |
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h index 91694ec1ce95..69095da1fcfd 100644 --- a/arch/arc/include/asm/ptrace.h +++ b/arch/arc/include/asm/ptrace.h | |||
| @@ -20,20 +20,20 @@ | |||
| 20 | struct pt_regs { | 20 | struct pt_regs { |
| 21 | 21 | ||
| 22 | /* Real registers */ | 22 | /* Real registers */ |
| 23 | long bta; /* bta_l1, bta_l2, erbta */ | 23 | unsigned long bta; /* bta_l1, bta_l2, erbta */ |
| 24 | 24 | ||
| 25 | long lp_start, lp_end, lp_count; | 25 | unsigned long lp_start, lp_end, lp_count; |
| 26 | 26 | ||
| 27 | long status32; /* status32_l1, status32_l2, erstatus */ | 27 | unsigned long status32; /* status32_l1, status32_l2, erstatus */ |
| 28 | long ret; /* ilink1, ilink2 or eret */ | 28 | unsigned long ret; /* ilink1, ilink2 or eret */ |
| 29 | long blink; | 29 | unsigned long blink; |
| 30 | long fp; | 30 | unsigned long fp; |
| 31 | long r26; /* gp */ | 31 | unsigned long r26; /* gp */ |
| 32 | 32 | ||
| 33 | long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; | 33 | unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; |
| 34 | 34 | ||
| 35 | long sp; /* user/kernel sp depending on where we came from */ | 35 | unsigned long sp; /* User/Kernel depending on where we came from */ |
| 36 | long orig_r0; | 36 | unsigned long orig_r0; |
| 37 | 37 | ||
| 38 | /* | 38 | /* |
| 39 | * To distinguish bet excp, syscall, irq | 39 | * To distinguish bet excp, syscall, irq |
| @@ -55,13 +55,13 @@ struct pt_regs { | |||
| 55 | unsigned long event; | 55 | unsigned long event; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | long user_r25; | 58 | unsigned long user_r25; |
| 59 | }; | 59 | }; |
| 60 | #else | 60 | #else |
| 61 | 61 | ||
| 62 | struct pt_regs { | 62 | struct pt_regs { |
| 63 | 63 | ||
| 64 | long orig_r0; | 64 | unsigned long orig_r0; |
| 65 | 65 | ||
| 66 | union { | 66 | union { |
| 67 | struct { | 67 | struct { |
| @@ -76,26 +76,26 @@ struct pt_regs { | |||
| 76 | unsigned long event; | 76 | unsigned long event; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | long bta; /* bta_l1, bta_l2, erbta */ | 79 | unsigned long bta; /* bta_l1, bta_l2, erbta */ |
| 80 | 80 | ||
| 81 | long user_r25; | 81 | unsigned long user_r25; |
| 82 | 82 | ||
| 83 | long r26; /* gp */ | 83 | unsigned long r26; /* gp */ |
| 84 | long fp; | 84 | unsigned long fp; |
| 85 | long sp; /* user/kernel sp depending on where we came from */ | 85 | unsigned long sp; /* user/kernel sp depending on where we came from */ |
| 86 | 86 | ||
| 87 | long r12; | 87 | unsigned long r12; |
| 88 | 88 | ||
| 89 | /*------- Below list auto saved by h/w -----------*/ | 89 | /*------- Below list auto saved by h/w -----------*/ |
| 90 | long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; | 90 | unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; |
| 91 | 91 | ||
| 92 | long blink; | 92 | unsigned long blink; |
| 93 | long lp_end, lp_start, lp_count; | 93 | unsigned long lp_end, lp_start, lp_count; |
| 94 | 94 | ||
| 95 | long ei, ldi, jli; | 95 | unsigned long ei, ldi, jli; |
| 96 | 96 | ||
| 97 | long ret; | 97 | unsigned long ret; |
| 98 | long status32; | 98 | unsigned long status32; |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | #endif | 101 | #endif |
| @@ -103,10 +103,10 @@ struct pt_regs { | |||
| 103 | /* Callee saved registers - need to be saved only when you are scheduled out */ | 103 | /* Callee saved registers - need to be saved only when you are scheduled out */ |
| 104 | 104 | ||
| 105 | struct callee_regs { | 105 | struct callee_regs { |
| 106 | long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; | 106 | unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13; |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | #define instruction_pointer(regs) (unsigned long)((regs)->ret) | 109 | #define instruction_pointer(regs) ((regs)->ret) |
| 110 | #define profile_pc(regs) instruction_pointer(regs) | 110 | #define profile_pc(regs) instruction_pointer(regs) |
| 111 | 111 | ||
| 112 | /* return 1 if user mode or 0 if kernel mode */ | 112 | /* return 1 if user mode or 0 if kernel mode */ |
| @@ -142,7 +142,7 @@ struct callee_regs { | |||
| 142 | 142 | ||
| 143 | static inline long regs_return_value(struct pt_regs *regs) | 143 | static inline long regs_return_value(struct pt_regs *regs) |
| 144 | { | 144 | { |
| 145 | return regs->r0; | 145 | return (long)regs->r0; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | #endif /* !__ASSEMBLY__ */ | 148 | #endif /* !__ASSEMBLY__ */ |
diff --git a/arch/arc/include/asm/spinlock.h b/arch/arc/include/asm/spinlock.h index e1651df6a93d..db8c59d1eaeb 100644 --- a/arch/arc/include/asm/spinlock.h +++ b/arch/arc/include/asm/spinlock.h | |||
| @@ -18,9 +18,518 @@ | |||
| 18 | #define arch_spin_unlock_wait(x) \ | 18 | #define arch_spin_unlock_wait(x) \ |
| 19 | do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0) | 19 | do { while (arch_spin_is_locked(x)) cpu_relax(); } while (0) |
| 20 | 20 | ||
| 21 | #ifdef CONFIG_ARC_HAS_LLSC | ||
| 22 | |||
| 23 | /* | ||
| 24 | * A normal LLOCK/SCOND based system, w/o need for livelock workaround | ||
| 25 | */ | ||
| 26 | #ifndef CONFIG_ARC_STAR_9000923308 | ||
| 27 | |||
| 21 | static inline void arch_spin_lock(arch_spinlock_t *lock) | 28 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
| 22 | { | 29 | { |
| 23 | unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__; | 30 | unsigned int val; |
| 31 | |||
| 32 | smp_mb(); | ||
| 33 | |||
| 34 | __asm__ __volatile__( | ||
| 35 | "1: llock %[val], [%[slock]] \n" | ||
| 36 | " breq %[val], %[LOCKED], 1b \n" /* spin while LOCKED */ | ||
| 37 | " scond %[LOCKED], [%[slock]] \n" /* acquire */ | ||
| 38 | " bnz 1b \n" | ||
| 39 | " \n" | ||
| 40 | : [val] "=&r" (val) | ||
| 41 | : [slock] "r" (&(lock->slock)), | ||
| 42 | [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) | ||
| 43 | : "memory", "cc"); | ||
| 44 | |||
| 45 | smp_mb(); | ||
| 46 | } | ||
| 47 | |||
| 48 | /* 1 - lock taken successfully */ | ||
| 49 | static inline int arch_spin_trylock(arch_spinlock_t *lock) | ||
| 50 | { | ||
| 51 | unsigned int val, got_it = 0; | ||
| 52 | |||
| 53 | smp_mb(); | ||
| 54 | |||
| 55 | __asm__ __volatile__( | ||
| 56 | "1: llock %[val], [%[slock]] \n" | ||
| 57 | " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */ | ||
| 58 | " scond %[LOCKED], [%[slock]] \n" /* acquire */ | ||
| 59 | " bnz 1b \n" | ||
| 60 | " mov %[got_it], 1 \n" | ||
| 61 | "4: \n" | ||
| 62 | " \n" | ||
| 63 | : [val] "=&r" (val), | ||
| 64 | [got_it] "+&r" (got_it) | ||
| 65 | : [slock] "r" (&(lock->slock)), | ||
| 66 | [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) | ||
| 67 | : "memory", "cc"); | ||
| 68 | |||
| 69 | smp_mb(); | ||
| 70 | |||
| 71 | return got_it; | ||
| 72 | } | ||
| 73 | |||
| 74 | static inline void arch_spin_unlock(arch_spinlock_t *lock) | ||
| 75 | { | ||
| 76 | smp_mb(); | ||
| 77 | |||
| 78 | lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__; | ||
| 79 | |||
| 80 | smp_mb(); | ||
| 81 | } | ||
| 82 | |||
| 83 | /* | ||
| 84 | * Read-write spinlocks, allowing multiple readers but only one writer. | ||
| 85 | * Unfair locking as Writers could be starved indefinitely by Reader(s) | ||
| 86 | */ | ||
| 87 | |||
| 88 | static inline void arch_read_lock(arch_rwlock_t *rw) | ||
| 89 | { | ||
| 90 | unsigned int val; | ||
| 91 | |||
| 92 | smp_mb(); | ||
| 93 | |||
| 94 | /* | ||
| 95 | * zero means writer holds the lock exclusively, deny Reader. | ||
| 96 | * Otherwise grant lock to first/subseq reader | ||
| 97 | * | ||
| 98 | * if (rw->counter > 0) { | ||
| 99 | * rw->counter--; | ||
| 100 | * ret = 1; | ||
| 101 | * } | ||
| 102 | */ | ||
| 103 | |||
| 104 | __asm__ __volatile__( | ||
| 105 | "1: llock %[val], [%[rwlock]] \n" | ||
| 106 | " brls %[val], %[WR_LOCKED], 1b\n" /* <= 0: spin while write locked */ | ||
| 107 | " sub %[val], %[val], 1 \n" /* reader lock */ | ||
| 108 | " scond %[val], [%[rwlock]] \n" | ||
| 109 | " bnz 1b \n" | ||
| 110 | " \n" | ||
| 111 | : [val] "=&r" (val) | ||
| 112 | : [rwlock] "r" (&(rw->counter)), | ||
| 113 | [WR_LOCKED] "ir" (0) | ||
| 114 | : "memory", "cc"); | ||
| 115 | |||
| 116 | smp_mb(); | ||
| 117 | } | ||
| 118 | |||
| 119 | /* 1 - lock taken successfully */ | ||
| 120 | static inline int arch_read_trylock(arch_rwlock_t *rw) | ||
| 121 | { | ||
| 122 | unsigned int val, got_it = 0; | ||
| 123 | |||
| 124 | smp_mb(); | ||
| 125 | |||
| 126 | __asm__ __volatile__( | ||
| 127 | "1: llock %[val], [%[rwlock]] \n" | ||
| 128 | " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */ | ||
| 129 | " sub %[val], %[val], 1 \n" /* counter-- */ | ||
| 130 | " scond %[val], [%[rwlock]] \n" | ||
| 131 | " bnz 1b \n" /* retry if collided with someone */ | ||
| 132 | " mov %[got_it], 1 \n" | ||
| 133 | " \n" | ||
| 134 | "4: ; --- done --- \n" | ||
| 135 | |||
| 136 | : [val] "=&r" (val), | ||
| 137 | [got_it] "+&r" (got_it) | ||
| 138 | : [rwlock] "r" (&(rw->counter)), | ||
| 139 | [WR_LOCKED] "ir" (0) | ||
| 140 | : "memory", "cc"); | ||
| 141 | |||
| 142 | smp_mb(); | ||
| 143 | |||
| 144 | return got_it; | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline void arch_write_lock(arch_rwlock_t *rw) | ||
| 148 | { | ||
| 149 | unsigned int val; | ||
| 150 | |||
| 151 | smp_mb(); | ||
| 152 | |||
| 153 | /* | ||
| 154 | * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__), | ||
| 155 | * deny writer. Otherwise if unlocked grant to writer | ||
| 156 | * Hence the claim that Linux rwlocks are unfair to writers. | ||
| 157 | * (can be starved for an indefinite time by readers). | ||
| 158 | * | ||
| 159 | * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) { | ||
| 160 | * rw->counter = 0; | ||
| 161 | * ret = 1; | ||
| 162 | * } | ||
| 163 | */ | ||
| 164 | |||
| 165 | __asm__ __volatile__( | ||
| 166 | "1: llock %[val], [%[rwlock]] \n" | ||
| 167 | " brne %[val], %[UNLOCKED], 1b \n" /* while !UNLOCKED spin */ | ||
| 168 | " mov %[val], %[WR_LOCKED] \n" | ||
| 169 | " scond %[val], [%[rwlock]] \n" | ||
| 170 | " bnz 1b \n" | ||
| 171 | " \n" | ||
| 172 | : [val] "=&r" (val) | ||
| 173 | : [rwlock] "r" (&(rw->counter)), | ||
| 174 | [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), | ||
| 175 | [WR_LOCKED] "ir" (0) | ||
| 176 | : "memory", "cc"); | ||
| 177 | |||
| 178 | smp_mb(); | ||
| 179 | } | ||
| 180 | |||
| 181 | /* 1 - lock taken successfully */ | ||
| 182 | static inline int arch_write_trylock(arch_rwlock_t *rw) | ||
| 183 | { | ||
| 184 | unsigned int val, got_it = 0; | ||
| 185 | |||
| 186 | smp_mb(); | ||
| 187 | |||
| 188 | __asm__ __volatile__( | ||
| 189 | "1: llock %[val], [%[rwlock]] \n" | ||
| 190 | " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */ | ||
| 191 | " mov %[val], %[WR_LOCKED] \n" | ||
| 192 | " scond %[val], [%[rwlock]] \n" | ||
| 193 | " bnz 1b \n" /* retry if collided with someone */ | ||
| 194 | " mov %[got_it], 1 \n" | ||
| 195 | " \n" | ||
| 196 | "4: ; --- done --- \n" | ||
| 197 | |||
| 198 | : [val] "=&r" (val), | ||
| 199 | [got_it] "+&r" (got_it) | ||
| 200 | : [rwlock] "r" (&(rw->counter)), | ||
| 201 | [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), | ||
| 202 | [WR_LOCKED] "ir" (0) | ||
| 203 | : "memory", "cc"); | ||
| 204 | |||
| 205 | smp_mb(); | ||
| 206 | |||
| 207 | return got_it; | ||
| 208 | } | ||
| 209 | |||
| 210 | static inline void arch_read_unlock(arch_rwlock_t *rw) | ||
| 211 | { | ||
| 212 | unsigned int val; | ||
| 213 | |||
| 214 | smp_mb(); | ||
| 215 | |||
| 216 | /* | ||
| 217 | * rw->counter++; | ||
| 218 | */ | ||
| 219 | __asm__ __volatile__( | ||
| 220 | "1: llock %[val], [%[rwlock]] \n" | ||
| 221 | " add %[val], %[val], 1 \n" | ||
| 222 | " scond %[val], [%[rwlock]] \n" | ||
| 223 | " bnz 1b \n" | ||
| 224 | " \n" | ||
| 225 | : [val] "=&r" (val) | ||
| 226 | : [rwlock] "r" (&(rw->counter)) | ||
| 227 | : "memory", "cc"); | ||
| 228 | |||
| 229 | smp_mb(); | ||
| 230 | } | ||
| 231 | |||
| 232 | static inline void arch_write_unlock(arch_rwlock_t *rw) | ||
| 233 | { | ||
| 234 | smp_mb(); | ||
| 235 | |||
| 236 | rw->counter = __ARCH_RW_LOCK_UNLOCKED__; | ||
| 237 | |||
| 238 | smp_mb(); | ||
| 239 | } | ||
| 240 | |||
| 241 | #else /* CONFIG_ARC_STAR_9000923308 */ | ||
| 242 | |||
| 243 | /* | ||
| 244 | * HS38x4 could get into a LLOCK/SCOND livelock in case of multiple overlapping | ||
| 245 | * coherency transactions in the SCU. The exclusive line state keeps rotating | ||
| 246 | * among contenting cores leading to a never ending cycle. So break the cycle | ||
| 247 | * by deferring the retry of failed exclusive access (SCOND). The actual delay | ||
| 248 | * needed is function of number of contending cores as well as the unrelated | ||
| 249 | * coherency traffic from other cores. To keep the code simple, start off with | ||
| 250 | * small delay of 1 which would suffice most cases and in case of contention | ||
| 251 | * double the delay. Eventually the delay is sufficient such that the coherency | ||
| 252 | * pipeline is drained, thus a subsequent exclusive access would succeed. | ||
| 253 | */ | ||
| 254 | |||
| 255 | #define SCOND_FAIL_RETRY_VAR_DEF \ | ||
| 256 | unsigned int delay, tmp; \ | ||
| 257 | |||
| 258 | #define SCOND_FAIL_RETRY_ASM \ | ||
| 259 | " ; --- scond fail delay --- \n" \ | ||
| 260 | " mov %[tmp], %[delay] \n" /* tmp = delay */ \ | ||
| 261 | "2: brne.d %[tmp], 0, 2b \n" /* while (tmp != 0) */ \ | ||
| 262 | " sub %[tmp], %[tmp], 1 \n" /* tmp-- */ \ | ||
| 263 | " rol %[delay], %[delay] \n" /* delay *= 2 */ \ | ||
| 264 | " b 1b \n" /* start over */ \ | ||
| 265 | " \n" \ | ||
| 266 | "4: ; --- done --- \n" \ | ||
| 267 | |||
| 268 | #define SCOND_FAIL_RETRY_VARS \ | ||
| 269 | ,[delay] "=&r" (delay), [tmp] "=&r" (tmp) \ | ||
| 270 | |||
| 271 | static inline void arch_spin_lock(arch_spinlock_t *lock) | ||
| 272 | { | ||
| 273 | unsigned int val; | ||
| 274 | SCOND_FAIL_RETRY_VAR_DEF; | ||
| 275 | |||
| 276 | smp_mb(); | ||
| 277 | |||
| 278 | __asm__ __volatile__( | ||
| 279 | "0: mov %[delay], 1 \n" | ||
| 280 | "1: llock %[val], [%[slock]] \n" | ||
| 281 | " breq %[val], %[LOCKED], 0b \n" /* spin while LOCKED */ | ||
| 282 | " scond %[LOCKED], [%[slock]] \n" /* acquire */ | ||
| 283 | " bz 4f \n" /* done */ | ||
| 284 | " \n" | ||
| 285 | SCOND_FAIL_RETRY_ASM | ||
| 286 | |||
| 287 | : [val] "=&r" (val) | ||
| 288 | SCOND_FAIL_RETRY_VARS | ||
| 289 | : [slock] "r" (&(lock->slock)), | ||
| 290 | [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) | ||
| 291 | : "memory", "cc"); | ||
| 292 | |||
| 293 | smp_mb(); | ||
| 294 | } | ||
| 295 | |||
| 296 | /* 1 - lock taken successfully */ | ||
| 297 | static inline int arch_spin_trylock(arch_spinlock_t *lock) | ||
| 298 | { | ||
| 299 | unsigned int val, got_it = 0; | ||
| 300 | SCOND_FAIL_RETRY_VAR_DEF; | ||
| 301 | |||
| 302 | smp_mb(); | ||
| 303 | |||
| 304 | __asm__ __volatile__( | ||
| 305 | "0: mov %[delay], 1 \n" | ||
| 306 | "1: llock %[val], [%[slock]] \n" | ||
| 307 | " breq %[val], %[LOCKED], 4f \n" /* already LOCKED, just bail */ | ||
| 308 | " scond %[LOCKED], [%[slock]] \n" /* acquire */ | ||
| 309 | " bz.d 4f \n" | ||
| 310 | " mov.z %[got_it], 1 \n" /* got it */ | ||
| 311 | " \n" | ||
| 312 | SCOND_FAIL_RETRY_ASM | ||
| 313 | |||
| 314 | : [val] "=&r" (val), | ||
| 315 | [got_it] "+&r" (got_it) | ||
| 316 | SCOND_FAIL_RETRY_VARS | ||
| 317 | : [slock] "r" (&(lock->slock)), | ||
| 318 | [LOCKED] "r" (__ARCH_SPIN_LOCK_LOCKED__) | ||
| 319 | : "memory", "cc"); | ||
| 320 | |||
| 321 | smp_mb(); | ||
| 322 | |||
| 323 | return got_it; | ||
| 324 | } | ||
| 325 | |||
| 326 | static inline void arch_spin_unlock(arch_spinlock_t *lock) | ||
| 327 | { | ||
| 328 | smp_mb(); | ||
| 329 | |||
| 330 | lock->slock = __ARCH_SPIN_LOCK_UNLOCKED__; | ||
| 331 | |||
| 332 | smp_mb(); | ||
| 333 | } | ||
| 334 | |||
| 335 | /* | ||
| 336 | * Read-write spinlocks, allowing multiple readers but only one writer. | ||
| 337 | * Unfair locking as Writers could be starved indefinitely by Reader(s) | ||
| 338 | */ | ||
| 339 | |||
| 340 | static inline void arch_read_lock(arch_rwlock_t *rw) | ||
| 341 | { | ||
| 342 | unsigned int val; | ||
| 343 | SCOND_FAIL_RETRY_VAR_DEF; | ||
| 344 | |||
| 345 | smp_mb(); | ||
| 346 | |||
| 347 | /* | ||
| 348 | * zero means writer holds the lock exclusively, deny Reader. | ||
| 349 | * Otherwise grant lock to first/subseq reader | ||
| 350 | * | ||
| 351 | * if (rw->counter > 0) { | ||
| 352 | * rw->counter--; | ||
| 353 | * ret = 1; | ||
| 354 | * } | ||
| 355 | */ | ||
| 356 | |||
| 357 | __asm__ __volatile__( | ||
| 358 | "0: mov %[delay], 1 \n" | ||
| 359 | "1: llock %[val], [%[rwlock]] \n" | ||
| 360 | " brls %[val], %[WR_LOCKED], 0b\n" /* <= 0: spin while write locked */ | ||
| 361 | " sub %[val], %[val], 1 \n" /* reader lock */ | ||
| 362 | " scond %[val], [%[rwlock]] \n" | ||
| 363 | " bz 4f \n" /* done */ | ||
| 364 | " \n" | ||
| 365 | SCOND_FAIL_RETRY_ASM | ||
| 366 | |||
| 367 | : [val] "=&r" (val) | ||
| 368 | SCOND_FAIL_RETRY_VARS | ||
| 369 | : [rwlock] "r" (&(rw->counter)), | ||
| 370 | [WR_LOCKED] "ir" (0) | ||
| 371 | : "memory", "cc"); | ||
| 372 | |||
| 373 | smp_mb(); | ||
| 374 | } | ||
| 375 | |||
| 376 | /* 1 - lock taken successfully */ | ||
| 377 | static inline int arch_read_trylock(arch_rwlock_t *rw) | ||
| 378 | { | ||
| 379 | unsigned int val, got_it = 0; | ||
| 380 | SCOND_FAIL_RETRY_VAR_DEF; | ||
| 381 | |||
| 382 | smp_mb(); | ||
| 383 | |||
| 384 | __asm__ __volatile__( | ||
| 385 | "0: mov %[delay], 1 \n" | ||
| 386 | "1: llock %[val], [%[rwlock]] \n" | ||
| 387 | " brls %[val], %[WR_LOCKED], 4f\n" /* <= 0: already write locked, bail */ | ||
| 388 | " sub %[val], %[val], 1 \n" /* counter-- */ | ||
| 389 | " scond %[val], [%[rwlock]] \n" | ||
| 390 | " bz.d 4f \n" | ||
| 391 | " mov.z %[got_it], 1 \n" /* got it */ | ||
| 392 | " \n" | ||
| 393 | SCOND_FAIL_RETRY_ASM | ||
| 394 | |||
| 395 | : [val] "=&r" (val), | ||
| 396 | [got_it] "+&r" (got_it) | ||
| 397 | SCOND_FAIL_RETRY_VARS | ||
| 398 | : [rwlock] "r" (&(rw->counter)), | ||
| 399 | [WR_LOCKED] "ir" (0) | ||
| 400 | : "memory", "cc"); | ||
| 401 | |||
| 402 | smp_mb(); | ||
| 403 | |||
| 404 | return got_it; | ||
| 405 | } | ||
| 406 | |||
| 407 | static inline void arch_write_lock(arch_rwlock_t *rw) | ||
| 408 | { | ||
| 409 | unsigned int val; | ||
| 410 | SCOND_FAIL_RETRY_VAR_DEF; | ||
| 411 | |||
| 412 | smp_mb(); | ||
| 413 | |||
| 414 | /* | ||
| 415 | * If reader(s) hold lock (lock < __ARCH_RW_LOCK_UNLOCKED__), | ||
| 416 | * deny writer. Otherwise if unlocked grant to writer | ||
| 417 | * Hence the claim that Linux rwlocks are unfair to writers. | ||
| 418 | * (can be starved for an indefinite time by readers). | ||
| 419 | * | ||
| 420 | * if (rw->counter == __ARCH_RW_LOCK_UNLOCKED__) { | ||
| 421 | * rw->counter = 0; | ||
| 422 | * ret = 1; | ||
| 423 | * } | ||
| 424 | */ | ||
| 425 | |||
| 426 | __asm__ __volatile__( | ||
| 427 | "0: mov %[delay], 1 \n" | ||
| 428 | "1: llock %[val], [%[rwlock]] \n" | ||
| 429 | " brne %[val], %[UNLOCKED], 0b \n" /* while !UNLOCKED spin */ | ||
| 430 | " mov %[val], %[WR_LOCKED] \n" | ||
| 431 | " scond %[val], [%[rwlock]] \n" | ||
| 432 | " bz 4f \n" | ||
| 433 | " \n" | ||
| 434 | SCOND_FAIL_RETRY_ASM | ||
| 435 | |||
| 436 | : [val] "=&r" (val) | ||
| 437 | SCOND_FAIL_RETRY_VARS | ||
| 438 | : [rwlock] "r" (&(rw->counter)), | ||
| 439 | [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), | ||
| 440 | [WR_LOCKED] "ir" (0) | ||
| 441 | : "memory", "cc"); | ||
| 442 | |||
| 443 | smp_mb(); | ||
| 444 | } | ||
| 445 | |||
| 446 | /* 1 - lock taken successfully */ | ||
| 447 | static inline int arch_write_trylock(arch_rwlock_t *rw) | ||
| 448 | { | ||
| 449 | unsigned int val, got_it = 0; | ||
| 450 | SCOND_FAIL_RETRY_VAR_DEF; | ||
| 451 | |||
| 452 | smp_mb(); | ||
| 453 | |||
| 454 | __asm__ __volatile__( | ||
| 455 | "0: mov %[delay], 1 \n" | ||
| 456 | "1: llock %[val], [%[rwlock]] \n" | ||
| 457 | " brne %[val], %[UNLOCKED], 4f \n" /* !UNLOCKED, bail */ | ||
| 458 | " mov %[val], %[WR_LOCKED] \n" | ||
| 459 | " scond %[val], [%[rwlock]] \n" | ||
| 460 | " bz.d 4f \n" | ||
| 461 | " mov.z %[got_it], 1 \n" /* got it */ | ||
| 462 | " \n" | ||
| 463 | SCOND_FAIL_RETRY_ASM | ||
| 464 | |||
| 465 | : [val] "=&r" (val), | ||
| 466 | [got_it] "+&r" (got_it) | ||
| 467 | SCOND_FAIL_RETRY_VARS | ||
| 468 | : [rwlock] "r" (&(rw->counter)), | ||
| 469 | [UNLOCKED] "ir" (__ARCH_RW_LOCK_UNLOCKED__), | ||
| 470 | [WR_LOCKED] "ir" (0) | ||
| 471 | : "memory", "cc"); | ||
| 472 | |||
| 473 | smp_mb(); | ||
| 474 | |||
| 475 | return got_it; | ||
| 476 | } | ||
| 477 | |||
| 478 | static inline void arch_read_unlock(arch_rwlock_t *rw) | ||
| 479 | { | ||
| 480 | unsigned int val; | ||
| 481 | |||
| 482 | smp_mb(); | ||
| 483 | |||
| 484 | /* | ||
| 485 | * rw->counter++; | ||
| 486 | */ | ||
| 487 | __asm__ __volatile__( | ||
| 488 | "1: llock %[val], [%[rwlock]] \n" | ||
| 489 | " add %[val], %[val], 1 \n" | ||
| 490 | " scond %[val], [%[rwlock]] \n" | ||
| 491 | " bnz 1b \n" | ||
| 492 | " \n" | ||
| 493 | : [val] "=&r" (val) | ||
| 494 | : [rwlock] "r" (&(rw->counter)) | ||
| 495 | : "memory", "cc"); | ||
| 496 | |||
| 497 | smp_mb(); | ||
| 498 | } | ||
| 499 | |||
| 500 | static inline void arch_write_unlock(arch_rwlock_t *rw) | ||
| 501 | { | ||
| 502 | unsigned int val; | ||
| 503 | |||
| 504 | smp_mb(); | ||
| 505 | |||
| 506 | /* | ||
| 507 | * rw->counter = __ARCH_RW_LOCK_UNLOCKED__; | ||
| 508 | */ | ||
| 509 | __asm__ __volatile__( | ||
| 510 | "1: llock %[val], [%[rwlock]] \n" | ||
| 511 | " scond %[UNLOCKED], [%[rwlock]]\n" | ||
| 512 | " bnz 1b \n" | ||
| 513 | " \n" | ||
| 514 | : [val] "=&r" (val) | ||
| 515 | : [rwlock] "r" (&(rw->counter)), | ||
| 516 | [UNLOCKED] "r" (__ARCH_RW_LOCK_UNLOCKED__) | ||
| 517 | : "memory", "cc"); | ||
| 518 | |||
| 519 | smp_mb(); | ||
| 520 | } | ||
| 521 | |||
| 522 | #undef SCOND_FAIL_RETRY_VAR_DEF | ||
| 523 | #undef SCOND_FAIL_RETRY_ASM | ||
| 524 | #undef SCOND_FAIL_RETRY_VARS | ||
| 525 | |||
| 526 | #endif /* CONFIG_ARC_STAR_9000923308 */ | ||
| 527 | |||
| 528 | #else /* !CONFIG_ARC_HAS_LLSC */ | ||
| 529 | |||
| 530 | static inline void arch_spin_lock(arch_spinlock_t *lock) | ||
| 531 | { | ||
| 532 | unsigned int val = __ARCH_SPIN_LOCK_LOCKED__; | ||
| 24 | 533 | ||
| 25 | /* | 534 | /* |
| 26 | * This smp_mb() is technically superfluous, we only need the one | 535 | * This smp_mb() is technically superfluous, we only need the one |
| @@ -33,7 +542,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) | |||
| 33 | __asm__ __volatile__( | 542 | __asm__ __volatile__( |
| 34 | "1: ex %0, [%1] \n" | 543 | "1: ex %0, [%1] \n" |
| 35 | " breq %0, %2, 1b \n" | 544 | " breq %0, %2, 1b \n" |
| 36 | : "+&r" (tmp) | 545 | : "+&r" (val) |
| 37 | : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__) | 546 | : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__) |
| 38 | : "memory"); | 547 | : "memory"); |
| 39 | 548 | ||
| @@ -48,26 +557,27 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) | |||
| 48 | smp_mb(); | 557 | smp_mb(); |
| 49 | } | 558 | } |
| 50 | 559 | ||
| 560 | /* 1 - lock taken successfully */ | ||
| 51 | static inline int arch_spin_trylock(arch_spinlock_t *lock) | 561 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
| 52 | { | 562 | { |
| 53 | unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__; | 563 | unsigned int val = __ARCH_SPIN_LOCK_LOCKED__; |
| 54 | 564 | ||
| 55 | smp_mb(); | 565 | smp_mb(); |
| 56 | 566 | ||
| 57 | __asm__ __volatile__( | 567 | __asm__ __volatile__( |
| 58 | "1: ex %0, [%1] \n" | 568 | "1: ex %0, [%1] \n" |
| 59 | : "+r" (tmp) | 569 | : "+r" (val) |
| 60 | : "r"(&(lock->slock)) | 570 | : "r"(&(lock->slock)) |
| 61 | : "memory"); | 571 | : "memory"); |
| 62 | 572 | ||
| 63 | smp_mb(); | 573 | smp_mb(); |
| 64 | 574 | ||
| 65 | return (tmp == __ARCH_SPIN_LOCK_UNLOCKED__); | 575 | return (val == __ARCH_SPIN_LOCK_UNLOCKED__); |
| 66 | } | 576 | } |
| 67 | 577 | ||
| 68 | static inline void arch_spin_unlock(arch_spinlock_t *lock) | 578 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
| 69 | { | 579 | { |
| 70 | unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__; | 580 | unsigned int val = __ARCH_SPIN_LOCK_UNLOCKED__; |
| 71 | 581 | ||
| 72 | /* | 582 | /* |
| 73 | * RELEASE barrier: given the instructions avail on ARCv2, full barrier | 583 | * RELEASE barrier: given the instructions avail on ARCv2, full barrier |
| @@ -77,7 +587,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) | |||
| 77 | 587 | ||
| 78 | __asm__ __volatile__( | 588 | __asm__ __volatile__( |
| 79 | " ex %0, [%1] \n" | 589 | " ex %0, [%1] \n" |
| 80 | : "+r" (tmp) | 590 | : "+r" (val) |
| 81 | : "r"(&(lock->slock)) | 591 | : "r"(&(lock->slock)) |
| 82 | : "memory"); | 592 | : "memory"); |
| 83 | 593 | ||
| @@ -90,19 +600,12 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) | |||
| 90 | 600 | ||
| 91 | /* | 601 | /* |
| 92 | * Read-write spinlocks, allowing multiple readers but only one writer. | 602 | * Read-write spinlocks, allowing multiple readers but only one writer. |
| 603 | * Unfair locking as Writers could be starved indefinitely by Reader(s) | ||
| 93 | * | 604 | * |
| 94 | * The spinlock itself is contained in @counter and access to it is | 605 | * The spinlock itself is contained in @counter and access to it is |
| 95 | * serialized with @lock_mutex. | 606 | * serialized with @lock_mutex. |
| 96 | * | ||
| 97 | * Unfair locking as Writers could be starved indefinitely by Reader(s) | ||
| 98 | */ | 607 | */ |
| 99 | 608 | ||
| 100 | /* Would read_trylock() succeed? */ | ||
| 101 | #define arch_read_can_lock(x) ((x)->counter > 0) | ||
| 102 | |||
| 103 | /* Would write_trylock() succeed? */ | ||
| 104 | #define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__) | ||
| 105 | |||
| 106 | /* 1 - lock taken successfully */ | 609 | /* 1 - lock taken successfully */ |
| 107 | static inline int arch_read_trylock(arch_rwlock_t *rw) | 610 | static inline int arch_read_trylock(arch_rwlock_t *rw) |
| 108 | { | 611 | { |
| @@ -173,6 +676,11 @@ static inline void arch_write_unlock(arch_rwlock_t *rw) | |||
| 173 | arch_spin_unlock(&(rw->lock_mutex)); | 676 | arch_spin_unlock(&(rw->lock_mutex)); |
| 174 | } | 677 | } |
| 175 | 678 | ||
| 679 | #endif | ||
| 680 | |||
| 681 | #define arch_read_can_lock(x) ((x)->counter > 0) | ||
| 682 | #define arch_write_can_lock(x) ((x)->counter == __ARCH_RW_LOCK_UNLOCKED__) | ||
| 683 | |||
| 176 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) | 684 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) |
| 177 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) | 685 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) |
| 178 | 686 | ||
diff --git a/arch/arc/include/asm/spinlock_types.h b/arch/arc/include/asm/spinlock_types.h index 662627ced4f2..4e1ef5f650c6 100644 --- a/arch/arc/include/asm/spinlock_types.h +++ b/arch/arc/include/asm/spinlock_types.h | |||
| @@ -26,7 +26,9 @@ typedef struct { | |||
| 26 | */ | 26 | */ |
| 27 | typedef struct { | 27 | typedef struct { |
| 28 | volatile unsigned int counter; | 28 | volatile unsigned int counter; |
| 29 | #ifndef CONFIG_ARC_HAS_LLSC | ||
| 29 | arch_spinlock_t lock_mutex; | 30 | arch_spinlock_t lock_mutex; |
| 31 | #endif | ||
| 30 | } arch_rwlock_t; | 32 | } arch_rwlock_t; |
| 31 | 33 | ||
| 32 | #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000 | 34 | #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000 |
diff --git a/arch/arc/include/uapi/asm/ptrace.h b/arch/arc/include/uapi/asm/ptrace.h index 76a7739aab1c..0b3ef63d4a03 100644 --- a/arch/arc/include/uapi/asm/ptrace.h +++ b/arch/arc/include/uapi/asm/ptrace.h | |||
| @@ -32,20 +32,20 @@ | |||
| 32 | */ | 32 | */ |
| 33 | struct user_regs_struct { | 33 | struct user_regs_struct { |
| 34 | 34 | ||
| 35 | long pad; | 35 | unsigned long pad; |
| 36 | struct { | 36 | struct { |
| 37 | long bta, lp_start, lp_end, lp_count; | 37 | unsigned long bta, lp_start, lp_end, lp_count; |
| 38 | long status32, ret, blink, fp, gp; | 38 | unsigned long status32, ret, blink, fp, gp; |
| 39 | long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; | 39 | unsigned long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0; |
| 40 | long sp; | 40 | unsigned long sp; |
| 41 | } scratch; | 41 | } scratch; |
| 42 | long pad2; | 42 | unsigned long pad2; |
| 43 | struct { | 43 | struct { |
| 44 | long r25, r24, r23, r22, r21, r20; | 44 | unsigned long r25, r24, r23, r22, r21, r20; |
| 45 | long r19, r18, r17, r16, r15, r14, r13; | 45 | unsigned long r19, r18, r17, r16, r15, r14, r13; |
| 46 | } callee; | 46 | } callee; |
| 47 | long efa; /* break pt addr, for break points in delay slots */ | 47 | unsigned long efa; /* break pt addr, for break points in delay slots */ |
| 48 | long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */ | 48 | unsigned long stop_pc; /* give dbg stop_pc after ensuring brkpt trap */ |
| 49 | }; | 49 | }; |
| 50 | #endif /* !__ASSEMBLY__ */ | 50 | #endif /* !__ASSEMBLY__ */ |
| 51 | 51 | ||
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 18cc01591c96..cabde9dc0696 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
| @@ -47,6 +47,7 @@ static void read_arc_build_cfg_regs(void) | |||
| 47 | struct bcr_perip uncached_space; | 47 | struct bcr_perip uncached_space; |
| 48 | struct bcr_generic bcr; | 48 | struct bcr_generic bcr; |
| 49 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; | 49 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 50 | unsigned long perip_space; | ||
| 50 | FIX_PTR(cpu); | 51 | FIX_PTR(cpu); |
| 51 | 52 | ||
| 52 | READ_BCR(AUX_IDENTITY, cpu->core); | 53 | READ_BCR(AUX_IDENTITY, cpu->core); |
| @@ -56,7 +57,12 @@ static void read_arc_build_cfg_regs(void) | |||
| 56 | cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); | 57 | cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); |
| 57 | 58 | ||
| 58 | READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space); | 59 | READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space); |
| 59 | BUG_ON((uncached_space.start << 24) != ARC_UNCACHED_ADDR_SPACE); | 60 | if (uncached_space.ver < 3) |
| 61 | perip_space = uncached_space.start << 24; | ||
| 62 | else | ||
| 63 | perip_space = read_aux_reg(AUX_NON_VOL) & 0xF0000000; | ||
| 64 | |||
| 65 | BUG_ON(perip_space != ARC_UNCACHED_ADDR_SPACE); | ||
| 60 | 66 | ||
| 61 | READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy); | 67 | READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy); |
| 62 | 68 | ||
| @@ -330,6 +336,10 @@ static void arc_chk_core_config(void) | |||
| 330 | pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n"); | 336 | pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n"); |
| 331 | else if (!cpu->extn.fpu_dp && fpu_enabled) | 337 | else if (!cpu->extn.fpu_dp && fpu_enabled) |
| 332 | panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n"); | 338 | panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n"); |
| 339 | |||
| 340 | if (is_isa_arcv2() && IS_ENABLED(CONFIG_SMP) && cpu->isa.atomic && | ||
| 341 | !IS_ENABLED(CONFIG_ARC_STAR_9000923308)) | ||
| 342 | panic("llock/scond livelock workaround missing\n"); | ||
| 333 | } | 343 | } |
| 334 | 344 | ||
| 335 | /* | 345 | /* |
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index 3364d2bbc515..4294761a2b3e 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c | |||
| @@ -203,34 +203,24 @@ static int arc_clkevent_set_next_event(unsigned long delta, | |||
| 203 | return 0; | 203 | return 0; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | static void arc_clkevent_set_mode(enum clock_event_mode mode, | 206 | static int arc_clkevent_set_periodic(struct clock_event_device *dev) |
| 207 | struct clock_event_device *dev) | ||
| 208 | { | 207 | { |
| 209 | switch (mode) { | 208 | /* |
| 210 | case CLOCK_EVT_MODE_PERIODIC: | 209 | * At X Hz, 1 sec = 1000ms -> X cycles; |
| 211 | /* | 210 | * 10ms -> X / 100 cycles |
| 212 | * At X Hz, 1 sec = 1000ms -> X cycles; | 211 | */ |
| 213 | * 10ms -> X / 100 cycles | 212 | arc_timer_event_setup(arc_get_core_freq() / HZ); |
| 214 | */ | 213 | return 0; |
| 215 | arc_timer_event_setup(arc_get_core_freq() / HZ); | ||
| 216 | break; | ||
| 217 | case CLOCK_EVT_MODE_ONESHOT: | ||
| 218 | break; | ||
| 219 | default: | ||
| 220 | break; | ||
| 221 | } | ||
| 222 | |||
| 223 | return; | ||
| 224 | } | 214 | } |
| 225 | 215 | ||
| 226 | static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = { | 216 | static DEFINE_PER_CPU(struct clock_event_device, arc_clockevent_device) = { |
| 227 | .name = "ARC Timer0", | 217 | .name = "ARC Timer0", |
| 228 | .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, | 218 | .features = CLOCK_EVT_FEAT_ONESHOT | |
| 229 | .mode = CLOCK_EVT_MODE_UNUSED, | 219 | CLOCK_EVT_FEAT_PERIODIC, |
| 230 | .rating = 300, | 220 | .rating = 300, |
| 231 | .irq = TIMER0_IRQ, /* hardwired, no need for resources */ | 221 | .irq = TIMER0_IRQ, /* hardwired, no need for resources */ |
| 232 | .set_next_event = arc_clkevent_set_next_event, | 222 | .set_next_event = arc_clkevent_set_next_event, |
| 233 | .set_mode = arc_clkevent_set_mode, | 223 | .set_state_periodic = arc_clkevent_set_periodic, |
| 234 | }; | 224 | }; |
| 235 | 225 | ||
| 236 | static irqreturn_t timer_irq_handler(int irq, void *dev_id) | 226 | static irqreturn_t timer_irq_handler(int irq, void *dev_id) |
| @@ -240,7 +230,7 @@ static irqreturn_t timer_irq_handler(int irq, void *dev_id) | |||
| 240 | * irq_set_chip_and_handler() asked for handle_percpu_devid_irq() | 230 | * irq_set_chip_and_handler() asked for handle_percpu_devid_irq() |
| 241 | */ | 231 | */ |
| 242 | struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device); | 232 | struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device); |
| 243 | int irq_reenable = evt->mode == CLOCK_EVT_MODE_PERIODIC; | 233 | int irq_reenable = clockevent_state_periodic(evt); |
| 244 | 234 | ||
| 245 | /* | 235 | /* |
| 246 | * Any write to CTRL reg ACks the interrupt, we rewrite the | 236 | * Any write to CTRL reg ACks the interrupt, we rewrite the |
diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S index 1b2b3acfed52..0cab0b8a57c5 100644 --- a/arch/arc/lib/memcpy-archs.S +++ b/arch/arc/lib/memcpy-archs.S | |||
| @@ -206,7 +206,7 @@ unalignedOffby3: | |||
| 206 | ld.ab r6, [r1, 4] | 206 | ld.ab r6, [r1, 4] |
| 207 | prefetch [r1, 28] ;Prefetch the next read location | 207 | prefetch [r1, 28] ;Prefetch the next read location |
| 208 | ld.ab r8, [r1,4] | 208 | ld.ab r8, [r1,4] |
| 209 | prefetch [r3, 32] ;Prefetch the next write location | 209 | prefetchw [r3, 32] ;Prefetch the next write location |
| 210 | 210 | ||
| 211 | SHIFT_1 (r7, r6, 8) | 211 | SHIFT_1 (r7, r6, 8) |
| 212 | or r7, r7, r5 | 212 | or r7, r7, r5 |
diff --git a/arch/arc/lib/memset-archs.S b/arch/arc/lib/memset-archs.S index 92d573c734b5..365b18364815 100644 --- a/arch/arc/lib/memset-archs.S +++ b/arch/arc/lib/memset-archs.S | |||
| @@ -10,12 +10,6 @@ | |||
| 10 | 10 | ||
| 11 | #undef PREALLOC_NOT_AVAIL | 11 | #undef PREALLOC_NOT_AVAIL |
| 12 | 12 | ||
| 13 | #ifdef PREALLOC_NOT_AVAIL | ||
| 14 | #define PREWRITE(A,B) prefetchw [(A),(B)] | ||
| 15 | #else | ||
| 16 | #define PREWRITE(A,B) prealloc [(A),(B)] | ||
| 17 | #endif | ||
| 18 | |||
| 19 | ENTRY(memset) | 13 | ENTRY(memset) |
| 20 | prefetchw [r0] ; Prefetch the write location | 14 | prefetchw [r0] ; Prefetch the write location |
| 21 | mov.f 0, r2 | 15 | mov.f 0, r2 |
| @@ -51,9 +45,15 @@ ENTRY(memset) | |||
| 51 | 45 | ||
| 52 | ;;; Convert len to Dwords, unfold x8 | 46 | ;;; Convert len to Dwords, unfold x8 |
| 53 | lsr.f lp_count, lp_count, 6 | 47 | lsr.f lp_count, lp_count, 6 |
| 48 | |||
| 54 | lpnz @.Lset64bytes | 49 | lpnz @.Lset64bytes |
| 55 | ;; LOOP START | 50 | ;; LOOP START |
| 56 | PREWRITE(r3, 64) ;Prefetch the next write location | 51 | #ifdef PREALLOC_NOT_AVAIL |
| 52 | prefetchw [r3, 64] ;Prefetch the next write location | ||
| 53 | #else | ||
| 54 | prealloc [r3, 64] | ||
| 55 | #endif | ||
| 56 | #ifdef CONFIG_ARC_HAS_LL64 | ||
| 57 | std.ab r4, [r3, 8] | 57 | std.ab r4, [r3, 8] |
| 58 | std.ab r4, [r3, 8] | 58 | std.ab r4, [r3, 8] |
| 59 | std.ab r4, [r3, 8] | 59 | std.ab r4, [r3, 8] |
| @@ -62,16 +62,45 @@ ENTRY(memset) | |||
| 62 | std.ab r4, [r3, 8] | 62 | std.ab r4, [r3, 8] |
| 63 | std.ab r4, [r3, 8] | 63 | std.ab r4, [r3, 8] |
| 64 | std.ab r4, [r3, 8] | 64 | std.ab r4, [r3, 8] |
| 65 | #else | ||
| 66 | st.ab r4, [r3, 4] | ||
| 67 | st.ab r4, [r3, 4] | ||
| 68 | st.ab r4, [r3, 4] | ||
| 69 | st.ab r4, [r3, 4] | ||
| 70 | st.ab r4, [r3, 4] | ||
| 71 | st.ab r4, [r3, 4] | ||
| 72 | st.ab r4, [r3, 4] | ||
| 73 | st.ab r4, [r3, 4] | ||
| 74 | st.ab r4, [r3, 4] | ||
| 75 | st.ab r4, [r3, 4] | ||
| 76 | st.ab r4, [r3, 4] | ||
| 77 | st.ab r4, [r3, 4] | ||
| 78 | st.ab r4, [r3, 4] | ||
| 79 | st.ab r4, [r3, 4] | ||
| 80 | st.ab r4, [r3, 4] | ||
| 81 | st.ab r4, [r3, 4] | ||
| 82 | #endif | ||
| 65 | .Lset64bytes: | 83 | .Lset64bytes: |
| 66 | 84 | ||
| 67 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes | 85 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes |
| 68 | lpnz .Lset32bytes | 86 | lpnz .Lset32bytes |
| 69 | ;; LOOP START | 87 | ;; LOOP START |
| 70 | prefetchw [r3, 32] ;Prefetch the next write location | 88 | prefetchw [r3, 32] ;Prefetch the next write location |
| 89 | #ifdef CONFIG_ARC_HAS_LL64 | ||
| 71 | std.ab r4, [r3, 8] | 90 | std.ab r4, [r3, 8] |
| 72 | std.ab r4, [r3, 8] | 91 | std.ab r4, [r3, 8] |
| 73 | std.ab r4, [r3, 8] | 92 | std.ab r4, [r3, 8] |
| 74 | std.ab r4, [r3, 8] | 93 | std.ab r4, [r3, 8] |
| 94 | #else | ||
| 95 | st.ab r4, [r3, 4] | ||
| 96 | st.ab r4, [r3, 4] | ||
| 97 | st.ab r4, [r3, 4] | ||
| 98 | st.ab r4, [r3, 4] | ||
| 99 | st.ab r4, [r3, 4] | ||
| 100 | st.ab r4, [r3, 4] | ||
| 101 | st.ab r4, [r3, 4] | ||
| 102 | st.ab r4, [r3, 4] | ||
| 103 | #endif | ||
| 75 | .Lset32bytes: | 104 | .Lset32bytes: |
| 76 | 105 | ||
| 77 | and.f lp_count, r2, 0x1F ;Last remaining 31 bytes | 106 | and.f lp_count, r2, 0x1F ;Last remaining 31 bytes |
diff --git a/arch/arc/plat-axs10x/axs10x.c b/arch/arc/plat-axs10x/axs10x.c index 99f7da513a48..e7769c3ab5f2 100644 --- a/arch/arc/plat-axs10x/axs10x.c +++ b/arch/arc/plat-axs10x/axs10x.c | |||
| @@ -389,6 +389,21 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od) | |||
| 389 | 389 | ||
| 390 | static void __init axs103_early_init(void) | 390 | static void __init axs103_early_init(void) |
| 391 | { | 391 | { |
| 392 | /* | ||
| 393 | * AXS103 configurations for SMP/QUAD configurations share device tree | ||
| 394 | * which defaults to 90 MHz. However recent failures of Quad config | ||
| 395 | * revealed P&R timing violations so clamp it down to safe 50 MHz | ||
| 396 | * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack | ||
| 397 | * | ||
| 398 | * This hack is really hacky as of now. Fix it properly by getting the | ||
| 399 | * number of cores as return value of platform's early SMP callback | ||
| 400 | */ | ||
| 401 | #ifdef CONFIG_ARC_MCIP | ||
| 402 | unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; | ||
| 403 | if (num_cores > 2) | ||
| 404 | arc_set_core_freq(50 * 1000000); | ||
| 405 | #endif | ||
| 406 | |||
| 392 | switch (arc_get_core_freq()/1000000) { | 407 | switch (arc_get_core_freq()/1000000) { |
| 393 | case 33: | 408 | case 33: |
| 394 | axs103_set_freq(1, 1, 1); | 409 | axs103_set_freq(1, 1, 1); |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 07ab3d203916..7451b447cc2d 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
| @@ -312,6 +312,9 @@ INSTALL_TARGETS = zinstall uinstall install | |||
| 312 | 312 | ||
| 313 | PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) | 313 | PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) |
| 314 | 314 | ||
| 315 | bootpImage uImage: zImage | ||
| 316 | zImage: Image | ||
| 317 | |||
| 315 | $(BOOT_TARGETS): vmlinux | 318 | $(BOOT_TARGETS): vmlinux |
| 316 | $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ | 319 | $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ |
| 317 | 320 | ||
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 8f1e25bcecbd..1e29ccf77ea2 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi | |||
| @@ -116,7 +116,7 @@ | |||
| 116 | ranges = <0 0x2000 0x2000>; | 116 | ranges = <0 0x2000 0x2000>; |
| 117 | 117 | ||
| 118 | scm_conf: scm_conf@0 { | 118 | scm_conf: scm_conf@0 { |
| 119 | compatible = "syscon"; | 119 | compatible = "syscon", "simple-bus"; |
| 120 | reg = <0x0 0x1400>; | 120 | reg = <0x0 0x1400>; |
| 121 | #address-cells = <1>; | 121 | #address-cells = <1>; |
| 122 | #size-cells = <1>; | 122 | #size-cells = <1>; |
| @@ -1140,6 +1140,7 @@ | |||
| 1140 | ctrl-module = <&omap_control_sata>; | 1140 | ctrl-module = <&omap_control_sata>; |
| 1141 | clocks = <&sys_clkin1>, <&sata_ref_clk>; | 1141 | clocks = <&sys_clkin1>, <&sata_ref_clk>; |
| 1142 | clock-names = "sysclk", "refclk"; | 1142 | clock-names = "sysclk", "refclk"; |
| 1143 | syscon-pllreset = <&scm_conf 0x3fc>; | ||
| 1143 | #phy-cells = <0>; | 1144 | #phy-cells = <0>; |
| 1144 | }; | 1145 | }; |
| 1145 | 1146 | ||
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index e6d13592080d..b57033e8c633 100644 --- a/arch/arm/boot/dts/imx6qdl.dtsi +++ b/arch/arm/boot/dts/imx6qdl.dtsi | |||
| @@ -181,10 +181,10 @@ | |||
| 181 | interrupt-names = "msi"; | 181 | interrupt-names = "msi"; |
| 182 | #interrupt-cells = <1>; | 182 | #interrupt-cells = <1>; |
| 183 | interrupt-map-mask = <0 0 0 0x7>; | 183 | interrupt-map-mask = <0 0 0 0x7>; |
| 184 | interrupt-map = <0 0 0 1 &intc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, | 184 | interrupt-map = <0 0 0 1 &gpc GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>, |
| 185 | <0 0 0 2 &intc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, | 185 | <0 0 0 2 &gpc GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>, |
| 186 | <0 0 0 3 &intc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, | 186 | <0 0 0 3 &gpc GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>, |
| 187 | <0 0 0 4 &intc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; | 187 | <0 0 0 4 &gpc GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; |
| 188 | clocks = <&clks IMX6QDL_CLK_PCIE_AXI>, | 188 | clocks = <&clks IMX6QDL_CLK_PCIE_AXI>, |
| 189 | <&clks IMX6QDL_CLK_LVDS1_GATE>, | 189 | <&clks IMX6QDL_CLK_LVDS1_GATE>, |
| 190 | <&clks IMX6QDL_CLK_PCIE_REF_125M>; | 190 | <&clks IMX6QDL_CLK_PCIE_REF_125M>; |
diff --git a/arch/arm/boot/dts/k2e.dtsi b/arch/arm/boot/dts/k2e.dtsi index 1b6494fbdb91..675fb8e492c6 100644 --- a/arch/arm/boot/dts/k2e.dtsi +++ b/arch/arm/boot/dts/k2e.dtsi | |||
| @@ -131,10 +131,17 @@ | |||
| 131 | <GIC_SPI 376 IRQ_TYPE_EDGE_RISING>; | 131 | <GIC_SPI 376 IRQ_TYPE_EDGE_RISING>; |
| 132 | }; | 132 | }; |
| 133 | }; | 133 | }; |
| 134 | |||
| 135 | mdio: mdio@24200f00 { | ||
| 136 | compatible = "ti,keystone_mdio", "ti,davinci_mdio"; | ||
| 137 | #address-cells = <1>; | ||
| 138 | #size-cells = <0>; | ||
| 139 | reg = <0x24200f00 0x100>; | ||
| 140 | status = "disabled"; | ||
| 141 | clocks = <&clkcpgmac>; | ||
| 142 | clock-names = "fck"; | ||
| 143 | bus_freq = <2500000>; | ||
| 144 | }; | ||
| 134 | /include/ "k2e-netcp.dtsi" | 145 | /include/ "k2e-netcp.dtsi" |
| 135 | }; | 146 | }; |
| 136 | }; | 147 | }; |
| 137 | |||
| 138 | &mdio { | ||
| 139 | reg = <0x24200f00 0x100>; | ||
| 140 | }; | ||
diff --git a/arch/arm/boot/dts/k2hk.dtsi b/arch/arm/boot/dts/k2hk.dtsi index ae6472407b22..d0810a5f2968 100644 --- a/arch/arm/boot/dts/k2hk.dtsi +++ b/arch/arm/boot/dts/k2hk.dtsi | |||
| @@ -98,6 +98,17 @@ | |||
| 98 | #gpio-cells = <2>; | 98 | #gpio-cells = <2>; |
| 99 | gpio,syscon-dev = <&devctrl 0x25c>; | 99 | gpio,syscon-dev = <&devctrl 0x25c>; |
| 100 | }; | 100 | }; |
| 101 | |||
| 102 | mdio: mdio@02090300 { | ||
| 103 | compatible = "ti,keystone_mdio", "ti,davinci_mdio"; | ||
| 104 | #address-cells = <1>; | ||
| 105 | #size-cells = <0>; | ||
| 106 | reg = <0x02090300 0x100>; | ||
| 107 | status = "disabled"; | ||
| 108 | clocks = <&clkcpgmac>; | ||
| 109 | clock-names = "fck"; | ||
| 110 | bus_freq = <2500000>; | ||
| 111 | }; | ||
| 101 | /include/ "k2hk-netcp.dtsi" | 112 | /include/ "k2hk-netcp.dtsi" |
| 102 | }; | 113 | }; |
| 103 | }; | 114 | }; |
diff --git a/arch/arm/boot/dts/k2l.dtsi b/arch/arm/boot/dts/k2l.dtsi index 0e007483615e..49fd414f680c 100644 --- a/arch/arm/boot/dts/k2l.dtsi +++ b/arch/arm/boot/dts/k2l.dtsi | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | soc { | 31 | soc { |
| 32 | |||
| 33 | /include/ "k2l-clocks.dtsi" | 32 | /include/ "k2l-clocks.dtsi" |
| 34 | 33 | ||
| 35 | uart2: serial@02348400 { | 34 | uart2: serial@02348400 { |
| @@ -79,6 +78,17 @@ | |||
| 79 | #gpio-cells = <2>; | 78 | #gpio-cells = <2>; |
| 80 | gpio,syscon-dev = <&devctrl 0x24c>; | 79 | gpio,syscon-dev = <&devctrl 0x24c>; |
| 81 | }; | 80 | }; |
| 81 | |||
| 82 | mdio: mdio@26200f00 { | ||
| 83 | compatible = "ti,keystone_mdio", "ti,davinci_mdio"; | ||
| 84 | #address-cells = <1>; | ||
| 85 | #size-cells = <0>; | ||
| 86 | reg = <0x26200f00 0x100>; | ||
| 87 | status = "disabled"; | ||
| 88 | clocks = <&clkcpgmac>; | ||
| 89 | clock-names = "fck"; | ||
| 90 | bus_freq = <2500000>; | ||
| 91 | }; | ||
| 82 | /include/ "k2l-netcp.dtsi" | 92 | /include/ "k2l-netcp.dtsi" |
| 83 | }; | 93 | }; |
| 84 | }; | 94 | }; |
| @@ -96,7 +106,3 @@ | |||
| 96 | /* Pin muxed. Enabled and configured by Bootloader */ | 106 | /* Pin muxed. Enabled and configured by Bootloader */ |
| 97 | status = "disabled"; | 107 | status = "disabled"; |
| 98 | }; | 108 | }; |
| 99 | |||
| 100 | &mdio { | ||
| 101 | reg = <0x26200f00 0x100>; | ||
| 102 | }; | ||
diff --git a/arch/arm/boot/dts/keystone.dtsi b/arch/arm/boot/dts/keystone.dtsi index e7a6f6deabb6..72816d65f7ec 100644 --- a/arch/arm/boot/dts/keystone.dtsi +++ b/arch/arm/boot/dts/keystone.dtsi | |||
| @@ -267,17 +267,6 @@ | |||
| 267 | 1 0 0x21000A00 0x00000100>; | 267 | 1 0 0x21000A00 0x00000100>; |
| 268 | }; | 268 | }; |
| 269 | 269 | ||
| 270 | mdio: mdio@02090300 { | ||
| 271 | compatible = "ti,keystone_mdio", "ti,davinci_mdio"; | ||
| 272 | #address-cells = <1>; | ||
| 273 | #size-cells = <0>; | ||
| 274 | reg = <0x02090300 0x100>; | ||
| 275 | status = "disabled"; | ||
| 276 | clocks = <&clkpa>; | ||
| 277 | clock-names = "fck"; | ||
| 278 | bus_freq = <2500000>; | ||
| 279 | }; | ||
| 280 | |||
| 281 | kirq0: keystone_irq@26202a0 { | 270 | kirq0: keystone_irq@26202a0 { |
| 282 | compatible = "ti,keystone-irq"; | 271 | compatible = "ti,keystone-irq"; |
| 283 | interrupts = <GIC_SPI 4 IRQ_TYPE_EDGE_RISING>; | 272 | interrupts = <GIC_SPI 4 IRQ_TYPE_EDGE_RISING>; |
diff --git a/arch/arm/boot/dts/omap2430.dtsi b/arch/arm/boot/dts/omap2430.dtsi index 11a7963be003..2390f387c271 100644 --- a/arch/arm/boot/dts/omap2430.dtsi +++ b/arch/arm/boot/dts/omap2430.dtsi | |||
| @@ -51,7 +51,8 @@ | |||
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | scm_conf: scm_conf@270 { | 53 | scm_conf: scm_conf@270 { |
| 54 | compatible = "syscon"; | 54 | compatible = "syscon", |
| 55 | "simple-bus"; | ||
| 55 | reg = <0x270 0x240>; | 56 | reg = <0x270 0x240>; |
| 56 | #address-cells = <1>; | 57 | #address-cells = <1>; |
| 57 | #size-cells = <1>; | 58 | #size-cells = <1>; |
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 7d31c6ff246f..abc4473e6f8a 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi | |||
| @@ -191,7 +191,8 @@ | |||
| 191 | }; | 191 | }; |
| 192 | 192 | ||
| 193 | omap4_padconf_global: omap4_padconf_global@5a0 { | 193 | omap4_padconf_global: omap4_padconf_global@5a0 { |
| 194 | compatible = "syscon"; | 194 | compatible = "syscon", |
| 195 | "simple-bus"; | ||
| 195 | reg = <0x5a0 0x170>; | 196 | reg = <0x5a0 0x170>; |
| 196 | #address-cells = <1>; | 197 | #address-cells = <1>; |
| 197 | #size-cells = <1>; | 198 | #size-cells = <1>; |
diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi index c8fd648a7108..b1a1263e6001 100644 --- a/arch/arm/boot/dts/omap5.dtsi +++ b/arch/arm/boot/dts/omap5.dtsi | |||
| @@ -180,7 +180,8 @@ | |||
| 180 | }; | 180 | }; |
| 181 | 181 | ||
| 182 | omap5_padconf_global: omap5_padconf_global@5a0 { | 182 | omap5_padconf_global: omap5_padconf_global@5a0 { |
| 183 | compatible = "syscon"; | 183 | compatible = "syscon", |
| 184 | "simple-bus"; | ||
| 184 | reg = <0x5a0 0xec>; | 185 | reg = <0x5a0 0xec>; |
| 185 | #address-cells = <1>; | 186 | #address-cells = <1>; |
| 186 | #size-cells = <1>; | 187 | #size-cells = <1>; |
diff --git a/arch/arm/boot/dts/ste-dbx5x0.dtsi b/arch/arm/boot/dts/ste-dbx5x0.dtsi index a75f3289e653..b8f81fb418ce 100644 --- a/arch/arm/boot/dts/ste-dbx5x0.dtsi +++ b/arch/arm/boot/dts/ste-dbx5x0.dtsi | |||
| @@ -15,6 +15,33 @@ | |||
| 15 | #include "skeleton.dtsi" | 15 | #include "skeleton.dtsi" |
| 16 | 16 | ||
| 17 | / { | 17 | / { |
| 18 | cpus { | ||
| 19 | #address-cells = <1>; | ||
| 20 | #size-cells = <0>; | ||
| 21 | enable-method = "ste,dbx500-smp"; | ||
| 22 | |||
| 23 | cpu-map { | ||
| 24 | cluster0 { | ||
| 25 | core0 { | ||
| 26 | cpu = <&CPU0>; | ||
| 27 | }; | ||
| 28 | core1 { | ||
| 29 | cpu = <&CPU1>; | ||
| 30 | }; | ||
| 31 | }; | ||
| 32 | }; | ||
| 33 | CPU0: cpu@300 { | ||
| 34 | device_type = "cpu"; | ||
| 35 | compatible = "arm,cortex-a9"; | ||
| 36 | reg = <0x300>; | ||
| 37 | }; | ||
| 38 | CPU1: cpu@301 { | ||
| 39 | device_type = "cpu"; | ||
| 40 | compatible = "arm,cortex-a9"; | ||
| 41 | reg = <0x301>; | ||
| 42 | }; | ||
| 43 | }; | ||
| 44 | |||
| 18 | soc { | 45 | soc { |
| 19 | #address-cells = <1>; | 46 | #address-cells = <1>; |
| 20 | #size-cells = <1>; | 47 | #size-cells = <1>; |
| @@ -22,32 +49,6 @@ | |||
| 22 | interrupt-parent = <&intc>; | 49 | interrupt-parent = <&intc>; |
| 23 | ranges; | 50 | ranges; |
| 24 | 51 | ||
| 25 | cpus { | ||
| 26 | #address-cells = <1>; | ||
| 27 | #size-cells = <0>; | ||
| 28 | |||
| 29 | cpu-map { | ||
| 30 | cluster0 { | ||
| 31 | core0 { | ||
| 32 | cpu = <&CPU0>; | ||
| 33 | }; | ||
| 34 | core1 { | ||
| 35 | cpu = <&CPU1>; | ||
| 36 | }; | ||
| 37 | }; | ||
| 38 | }; | ||
| 39 | CPU0: cpu@0 { | ||
| 40 | device_type = "cpu"; | ||
| 41 | compatible = "arm,cortex-a9"; | ||
| 42 | reg = <0>; | ||
| 43 | }; | ||
| 44 | CPU1: cpu@1 { | ||
| 45 | device_type = "cpu"; | ||
| 46 | compatible = "arm,cortex-a9"; | ||
| 47 | reg = <1>; | ||
| 48 | }; | ||
| 49 | }; | ||
| 50 | |||
| 51 | ptm@801ae000 { | 52 | ptm@801ae000 { |
| 52 | compatible = "arm,coresight-etm3x", "arm,primecell"; | 53 | compatible = "arm,coresight-etm3x", "arm,primecell"; |
| 53 | reg = <0x801ae000 0x1000>; | 54 | reg = <0x801ae000 0x1000>; |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 92828a1dec80..b48dd4f37f80 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
| @@ -61,6 +61,7 @@ work_pending: | |||
| 61 | movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE) | 61 | movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE) |
| 62 | ldmia sp, {r0 - r6} @ have to reload r0 - r6 | 62 | ldmia sp, {r0 - r6} @ have to reload r0 - r6 |
| 63 | b local_restart @ ... and off we go | 63 | b local_restart @ ... and off we go |
| 64 | ENDPROC(ret_fast_syscall) | ||
| 64 | 65 | ||
| 65 | /* | 66 | /* |
| 66 | * "slow" syscall return path. "why" tells us if this was a real syscall. | 67 | * "slow" syscall return path. "why" tells us if this was a real syscall. |
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index bd755d97e459..29e2991465cb 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
| @@ -399,6 +399,9 @@ ENTRY(secondary_startup) | |||
| 399 | sub lr, r4, r5 @ mmu has been enabled | 399 | sub lr, r4, r5 @ mmu has been enabled |
| 400 | add r3, r7, lr | 400 | add r3, r7, lr |
| 401 | ldrd r4, [r3, #0] @ get secondary_data.pgdir | 401 | ldrd r4, [r3, #0] @ get secondary_data.pgdir |
| 402 | ARM_BE8(eor r4, r4, r5) @ Swap r5 and r4 in BE: | ||
| 403 | ARM_BE8(eor r5, r4, r5) @ it can be done in 3 steps | ||
| 404 | ARM_BE8(eor r4, r4, r5) @ without using a temp reg. | ||
| 402 | ldr r8, [r3, #8] @ get secondary_data.swapper_pg_dir | 405 | ldr r8, [r3, #8] @ get secondary_data.swapper_pg_dir |
| 403 | badr lr, __enable_mmu @ return address | 406 | badr lr, __enable_mmu @ return address |
| 404 | mov r13, r12 @ __secondary_switched address | 407 | mov r13, r12 @ __secondary_switched address |
diff --git a/arch/arm/kernel/vdso.c b/arch/arm/kernel/vdso.c index efe17dd9b921..54a5aeab988d 100644 --- a/arch/arm/kernel/vdso.c +++ b/arch/arm/kernel/vdso.c | |||
| @@ -296,7 +296,6 @@ static bool tk_is_cntvct(const struct timekeeper *tk) | |||
| 296 | */ | 296 | */ |
| 297 | void update_vsyscall(struct timekeeper *tk) | 297 | void update_vsyscall(struct timekeeper *tk) |
| 298 | { | 298 | { |
| 299 | struct timespec xtime_coarse; | ||
| 300 | struct timespec64 *wtm = &tk->wall_to_monotonic; | 299 | struct timespec64 *wtm = &tk->wall_to_monotonic; |
| 301 | 300 | ||
| 302 | if (!cntvct_ok) { | 301 | if (!cntvct_ok) { |
| @@ -308,10 +307,10 @@ void update_vsyscall(struct timekeeper *tk) | |||
| 308 | 307 | ||
| 309 | vdso_write_begin(vdso_data); | 308 | vdso_write_begin(vdso_data); |
| 310 | 309 | ||
| 311 | xtime_coarse = __current_kernel_time(); | ||
| 312 | vdso_data->tk_is_cntvct = tk_is_cntvct(tk); | 310 | vdso_data->tk_is_cntvct = tk_is_cntvct(tk); |
| 313 | vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; | 311 | vdso_data->xtime_coarse_sec = tk->xtime_sec; |
| 314 | vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; | 312 | vdso_data->xtime_coarse_nsec = (u32)(tk->tkr_mono.xtime_nsec >> |
| 313 | tk->tkr_mono.shift); | ||
| 315 | vdso_data->wtm_clock_sec = wtm->tv_sec; | 314 | vdso_data->wtm_clock_sec = wtm->tv_sec; |
| 316 | vdso_data->wtm_clock_nsec = wtm->tv_nsec; | 315 | vdso_data->wtm_clock_nsec = wtm->tv_nsec; |
| 317 | 316 | ||
diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c index 3e58d710013c..4b39af2dfda9 100644 --- a/arch/arm/lib/uaccess_with_memcpy.c +++ b/arch/arm/lib/uaccess_with_memcpy.c | |||
| @@ -96,7 +96,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | /* the mmap semaphore is taken only if not in an atomic context */ | 98 | /* the mmap semaphore is taken only if not in an atomic context */ |
| 99 | atomic = in_atomic(); | 99 | atomic = faulthandler_disabled(); |
| 100 | 100 | ||
| 101 | if (!atomic) | 101 | if (!atomic) |
| 102 | down_read(¤t->mm->mmap_sem); | 102 | down_read(¤t->mm->mmap_sem); |
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 6001f1c9d136..4a87e86dec45 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c | |||
| @@ -146,9 +146,8 @@ static __init int exynos4_pm_init_power_domain(void) | |||
| 146 | pd->base = of_iomap(np, 0); | 146 | pd->base = of_iomap(np, 0); |
| 147 | if (!pd->base) { | 147 | if (!pd->base) { |
| 148 | pr_warn("%s: failed to map memory\n", __func__); | 148 | pr_warn("%s: failed to map memory\n", __func__); |
| 149 | kfree(pd->pd.name); | 149 | kfree_const(pd->pd.name); |
| 150 | kfree(pd); | 150 | kfree(pd); |
| 151 | of_node_put(np); | ||
| 152 | continue; | 151 | continue; |
| 153 | } | 152 | } |
| 154 | 153 | ||
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index 8e52621b5a6b..e1d2e991d17a 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c | |||
| @@ -392,6 +392,7 @@ static struct irq_chip wakeupgen_chip = { | |||
| 392 | .irq_mask = wakeupgen_mask, | 392 | .irq_mask = wakeupgen_mask, |
| 393 | .irq_unmask = wakeupgen_unmask, | 393 | .irq_unmask = wakeupgen_unmask, |
| 394 | .irq_retrigger = irq_chip_retrigger_hierarchy, | 394 | .irq_retrigger = irq_chip_retrigger_hierarchy, |
| 395 | .irq_set_type = irq_chip_set_type_parent, | ||
| 395 | .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, | 396 | .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, |
| 396 | #ifdef CONFIG_SMP | 397 | #ifdef CONFIG_SMP |
| 397 | .irq_set_affinity = irq_chip_set_affinity_parent, | 398 | .irq_set_affinity = irq_chip_set_affinity_parent, |
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile index 9d259d94e429..1160434eece0 100644 --- a/arch/arm/vdso/Makefile +++ b/arch/arm/vdso/Makefile | |||
| @@ -14,7 +14,7 @@ VDSO_LDFLAGS += -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 | |||
| 14 | VDSO_LDFLAGS += -nostdlib -shared | 14 | VDSO_LDFLAGS += -nostdlib -shared |
| 15 | VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | 15 | VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) |
| 16 | VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id) | 16 | VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id) |
| 17 | VDSO_LDFLAGS += $(call cc-option, -fuse-ld=bfd) | 17 | VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd) |
| 18 | 18 | ||
| 19 | obj-$(CONFIG_VDSO) += vdso.o | 19 | obj-$(CONFIG_VDSO) += vdso.o |
| 20 | extra-$(CONFIG_VDSO) += vdso.lds | 20 | extra-$(CONFIG_VDSO) += vdso.lds |
diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c index 1670f15ef69e..948f0ad2de23 100644 --- a/arch/arm64/kernel/signal32.c +++ b/arch/arm64/kernel/signal32.c | |||
| @@ -168,7 +168,8 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
| 168 | * Other callers might not initialize the si_lsb field, | 168 | * Other callers might not initialize the si_lsb field, |
| 169 | * so check explicitely for the right codes here. | 169 | * so check explicitely for the right codes here. |
| 170 | */ | 170 | */ |
| 171 | if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) | 171 | if (from->si_signo == SIGBUS && |
| 172 | (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) | ||
| 172 | err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); | 173 | err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); |
| 173 | #endif | 174 | #endif |
| 174 | break; | 175 | break; |
| @@ -201,8 +202,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
| 201 | 202 | ||
| 202 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | 203 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
| 203 | { | 204 | { |
| 204 | memset(to, 0, sizeof *to); | ||
| 205 | |||
| 206 | if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) || | 205 | if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) || |
| 207 | copy_from_user(to->_sifields._pad, | 206 | copy_from_user(to->_sifields._pad, |
| 208 | from->_sifields._pad, SI_PAD_SIZE)) | 207 | from->_sifields._pad, SI_PAD_SIZE)) |
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index ec37ab3f524f..97bc68f4c689 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c | |||
| @@ -199,16 +199,15 @@ up_fail: | |||
| 199 | */ | 199 | */ |
| 200 | void update_vsyscall(struct timekeeper *tk) | 200 | void update_vsyscall(struct timekeeper *tk) |
| 201 | { | 201 | { |
| 202 | struct timespec xtime_coarse; | ||
| 203 | u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter"); | 202 | u32 use_syscall = strcmp(tk->tkr_mono.clock->name, "arch_sys_counter"); |
| 204 | 203 | ||
| 205 | ++vdso_data->tb_seq_count; | 204 | ++vdso_data->tb_seq_count; |
| 206 | smp_wmb(); | 205 | smp_wmb(); |
| 207 | 206 | ||
| 208 | xtime_coarse = __current_kernel_time(); | ||
| 209 | vdso_data->use_syscall = use_syscall; | 207 | vdso_data->use_syscall = use_syscall; |
| 210 | vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec; | 208 | vdso_data->xtime_coarse_sec = tk->xtime_sec; |
| 211 | vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec; | 209 | vdso_data->xtime_coarse_nsec = tk->tkr_mono.xtime_nsec >> |
| 210 | tk->tkr_mono.shift; | ||
| 212 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; | 211 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; |
| 213 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; | 212 | vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; |
| 214 | 213 | ||
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c index f02530e726f6..85c57158dcd9 100644 --- a/arch/arm64/kvm/inject_fault.c +++ b/arch/arm64/kvm/inject_fault.c | |||
| @@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr) | |||
| 168 | { | 168 | { |
| 169 | if (!(vcpu->arch.hcr_el2 & HCR_RW)) | 169 | if (!(vcpu->arch.hcr_el2 & HCR_RW)) |
| 170 | inject_abt32(vcpu, false, addr); | 170 | inject_abt32(vcpu, false, addr); |
| 171 | 171 | else | |
| 172 | inject_abt64(vcpu, false, addr); | 172 | inject_abt64(vcpu, false, addr); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | /** | 175 | /** |
| @@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr) | |||
| 184 | { | 184 | { |
| 185 | if (!(vcpu->arch.hcr_el2 & HCR_RW)) | 185 | if (!(vcpu->arch.hcr_el2 & HCR_RW)) |
| 186 | inject_abt32(vcpu, true, addr); | 186 | inject_abt32(vcpu, true, addr); |
| 187 | 187 | else | |
| 188 | inject_abt64(vcpu, true, addr); | 188 | inject_abt64(vcpu, true, addr); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /** | 191 | /** |
| @@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) | |||
| 198 | { | 198 | { |
| 199 | if (!(vcpu->arch.hcr_el2 & HCR_RW)) | 199 | if (!(vcpu->arch.hcr_el2 & HCR_RW)) |
| 200 | inject_undef32(vcpu); | 200 | inject_undef32(vcpu); |
| 201 | 201 | else | |
| 202 | inject_undef64(vcpu); | 202 | inject_undef64(vcpu); |
| 203 | } | 203 | } |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index cee5f93e5712..199a8357838c 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -151,7 +151,6 @@ config BMIPS_GENERIC | |||
| 151 | select BCM7120_L2_IRQ | 151 | select BCM7120_L2_IRQ |
| 152 | select BRCMSTB_L2_IRQ | 152 | select BRCMSTB_L2_IRQ |
| 153 | select IRQ_MIPS_CPU | 153 | select IRQ_MIPS_CPU |
| 154 | select RAW_IRQ_ACCESSORS | ||
| 155 | select DMA_NONCOHERENT | 154 | select DMA_NONCOHERENT |
| 156 | select SYS_SUPPORTS_32BIT_KERNEL | 155 | select SYS_SUPPORTS_32BIT_KERNEL |
| 157 | select SYS_SUPPORTS_LITTLE_ENDIAN | 156 | select SYS_SUPPORTS_LITTLE_ENDIAN |
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index 01a644f174dd..1ba21204ebe0 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c | |||
| @@ -190,6 +190,7 @@ int get_c0_perfcount_int(void) | |||
| 190 | { | 190 | { |
| 191 | return ATH79_MISC_IRQ(5); | 191 | return ATH79_MISC_IRQ(5); |
| 192 | } | 192 | } |
| 193 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 193 | 194 | ||
| 194 | unsigned int get_c0_compare_int(void) | 195 | unsigned int get_c0_compare_int(void) |
| 195 | { | 196 | { |
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c index 56f5d080ef9d..b7fa9ae28c36 100644 --- a/arch/mips/cavium-octeon/smp.c +++ b/arch/mips/cavium-octeon/smp.c | |||
| @@ -42,7 +42,7 @@ static irqreturn_t mailbox_interrupt(int irq, void *dev_id) | |||
| 42 | cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action); | 42 | cvmx_write_csr(CVMX_CIU_MBOX_CLRX(coreid), action); |
| 43 | 43 | ||
| 44 | if (action & SMP_CALL_FUNCTION) | 44 | if (action & SMP_CALL_FUNCTION) |
| 45 | smp_call_function_interrupt(); | 45 | generic_smp_call_function_interrupt(); |
| 46 | if (action & SMP_RESCHEDULE_YOURSELF) | 46 | if (action & SMP_RESCHEDULE_YOURSELF) |
| 47 | scheduler_ipi(); | 47 | scheduler_ipi(); |
| 48 | 48 | ||
diff --git a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h b/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h deleted file mode 100644 index 11d3b572b1b3..000000000000 --- a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | #ifndef __ASM_MACH_BCM63XX_DMA_COHERENCE_H | ||
| 2 | #define __ASM_MACH_BCM63XX_DMA_COHERENCE_H | ||
| 3 | |||
| 4 | #include <asm/bmips.h> | ||
| 5 | |||
| 6 | #define plat_post_dma_flush bmips_post_dma_flush | ||
| 7 | |||
| 8 | #include <asm/mach-generic/dma-coherence.h> | ||
| 9 | |||
| 10 | #endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */ | ||
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 9d8106758142..ae8569475264 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
| @@ -182,8 +182,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
| 182 | * Make sure the buddy is global too (if it's !none, | 182 | * Make sure the buddy is global too (if it's !none, |
| 183 | * it better already be global) | 183 | * it better already be global) |
| 184 | */ | 184 | */ |
| 185 | #ifdef CONFIG_SMP | ||
| 186 | /* | ||
| 187 | * For SMP, multiple CPUs can race, so we need to do | ||
| 188 | * this atomically. | ||
| 189 | */ | ||
| 190 | #ifdef CONFIG_64BIT | ||
| 191 | #define LL_INSN "lld" | ||
| 192 | #define SC_INSN "scd" | ||
| 193 | #else /* CONFIG_32BIT */ | ||
| 194 | #define LL_INSN "ll" | ||
| 195 | #define SC_INSN "sc" | ||
| 196 | #endif | ||
| 197 | unsigned long page_global = _PAGE_GLOBAL; | ||
| 198 | unsigned long tmp; | ||
| 199 | |||
| 200 | __asm__ __volatile__ ( | ||
| 201 | " .set push\n" | ||
| 202 | " .set noreorder\n" | ||
| 203 | "1: " LL_INSN " %[tmp], %[buddy]\n" | ||
| 204 | " bnez %[tmp], 2f\n" | ||
| 205 | " or %[tmp], %[tmp], %[global]\n" | ||
| 206 | " " SC_INSN " %[tmp], %[buddy]\n" | ||
| 207 | " beqz %[tmp], 1b\n" | ||
| 208 | " nop\n" | ||
| 209 | "2:\n" | ||
| 210 | " .set pop" | ||
| 211 | : [buddy] "+m" (buddy->pte), | ||
| 212 | [tmp] "=&r" (tmp) | ||
| 213 | : [global] "r" (page_global)); | ||
| 214 | #else /* !CONFIG_SMP */ | ||
| 185 | if (pte_none(*buddy)) | 215 | if (pte_none(*buddy)) |
| 186 | pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; | 216 | pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; |
| 217 | #endif /* CONFIG_SMP */ | ||
| 187 | } | 218 | } |
| 188 | #endif | 219 | #endif |
| 189 | } | 220 | } |
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 16f1ea9ab191..03722d4326a1 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
| @@ -83,8 +83,6 @@ static inline void __cpu_die(unsigned int cpu) | |||
| 83 | extern void play_dead(void); | 83 | extern void play_dead(void); |
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
| 86 | extern asmlinkage void smp_call_function_interrupt(void); | ||
| 87 | |||
| 88 | static inline void arch_send_call_function_single_ipi(int cpu) | 86 | static inline void arch_send_call_function_single_ipi(int cpu) |
| 89 | { | 87 | { |
| 90 | extern struct plat_smp_ops *mp_ops; /* private */ | 88 | extern struct plat_smp_ops *mp_ops; /* private */ |
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index 28d6d9364bd1..a71da576883c 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h | |||
| @@ -152,6 +152,31 @@ | |||
| 152 | .set noreorder | 152 | .set noreorder |
| 153 | bltz k0, 8f | 153 | bltz k0, 8f |
| 154 | move k1, sp | 154 | move k1, sp |
| 155 | #ifdef CONFIG_EVA | ||
| 156 | /* | ||
| 157 | * Flush interAptiv's Return Prediction Stack (RPS) by writing | ||
| 158 | * EntryHi. Toggling Config7.RPS is slower and less portable. | ||
| 159 | * | ||
| 160 | * The RPS isn't automatically flushed when exceptions are | ||
| 161 | * taken, which can result in kernel mode speculative accesses | ||
| 162 | * to user addresses if the RPS mispredicts. That's harmless | ||
| 163 | * when user and kernel share the same address space, but with | ||
| 164 | * EVA the same user segments may be unmapped to kernel mode, | ||
| 165 | * even containing sensitive MMIO regions or invalid memory. | ||
| 166 | * | ||
| 167 | * This can happen when the kernel sets the return address to | ||
| 168 | * ret_from_* and jr's to the exception handler, which looks | ||
| 169 | * more like a tail call than a function call. If nested calls | ||
| 170 | * don't evict the last user address in the RPS, it will | ||
| 171 | * mispredict the return and fetch from a user controlled | ||
| 172 | * address into the icache. | ||
| 173 | * | ||
| 174 | * More recent EVA-capable cores with MAAR to restrict | ||
| 175 | * speculative accesses aren't affected. | ||
| 176 | */ | ||
| 177 | MFC0 k0, CP0_ENTRYHI | ||
| 178 | MTC0 k0, CP0_ENTRYHI | ||
| 179 | #endif | ||
| 155 | .set reorder | 180 | .set reorder |
| 156 | /* Called from user mode, new stack. */ | 181 | /* Called from user mode, new stack. */ |
| 157 | get_saved_sp | 182 | get_saved_sp |
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index af42e7003f12..baa7b6fc0a60 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S | |||
| @@ -407,7 +407,7 @@ NESTED(nmi_handler, PT_SIZE, sp) | |||
| 407 | .set noat | 407 | .set noat |
| 408 | SAVE_ALL | 408 | SAVE_ALL |
| 409 | FEXPORT(handle_\exception\ext) | 409 | FEXPORT(handle_\exception\ext) |
| 410 | __BUILD_clear_\clear | 410 | __build_clear_\clear |
| 411 | .set at | 411 | .set at |
| 412 | __BUILD_\verbose \exception | 412 | __BUILD_\verbose \exception |
| 413 | move a0, sp | 413 | move a0, sp |
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c index 3e4491aa6d6b..789d7bf4fef3 100644 --- a/arch/mips/kernel/mips-mt-fpaff.c +++ b/arch/mips/kernel/mips-mt-fpaff.c | |||
| @@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, | |||
| 154 | unsigned long __user *user_mask_ptr) | 154 | unsigned long __user *user_mask_ptr) |
| 155 | { | 155 | { |
| 156 | unsigned int real_len; | 156 | unsigned int real_len; |
| 157 | cpumask_t mask; | 157 | cpumask_t allowed, mask; |
| 158 | int retval; | 158 | int retval; |
| 159 | struct task_struct *p; | 159 | struct task_struct *p; |
| 160 | 160 | ||
| @@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, | |||
| 173 | if (retval) | 173 | if (retval) |
| 174 | goto out_unlock; | 174 | goto out_unlock; |
| 175 | 175 | ||
| 176 | cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); | 176 | cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed); |
| 177 | cpumask_and(&mask, &allowed, cpu_active_mask); | ||
| 177 | 178 | ||
| 178 | out_unlock: | 179 | out_unlock: |
| 179 | read_unlock(&tasklist_lock); | 180 | read_unlock(&tasklist_lock); |
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index b130033838ba..5fcec3032f38 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c | |||
| @@ -38,7 +38,7 @@ char *mips_get_machine_name(void) | |||
| 38 | return mips_machine_name; | 38 | return mips_machine_name; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | #ifdef CONFIG_OF | 41 | #ifdef CONFIG_USE_OF |
| 42 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) | 42 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) |
| 43 | { | 43 | { |
| 44 | return add_memory_region(base, size, BOOT_MEM_RAM); | 44 | return add_memory_region(base, size, BOOT_MEM_RAM); |
diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S index 74bab9ddd0e1..c6bbf2165051 100644 --- a/arch/mips/kernel/relocate_kernel.S +++ b/arch/mips/kernel/relocate_kernel.S | |||
| @@ -24,7 +24,7 @@ LEAF(relocate_new_kernel) | |||
| 24 | 24 | ||
| 25 | process_entry: | 25 | process_entry: |
| 26 | PTR_L s2, (s0) | 26 | PTR_L s2, (s0) |
| 27 | PTR_ADD s0, s0, SZREG | 27 | PTR_ADDIU s0, s0, SZREG |
| 28 | 28 | ||
| 29 | /* | 29 | /* |
| 30 | * In case of a kdump/crash kernel, the indirection page is not | 30 | * In case of a kdump/crash kernel, the indirection page is not |
| @@ -61,9 +61,9 @@ copy_word: | |||
| 61 | /* copy page word by word */ | 61 | /* copy page word by word */ |
| 62 | REG_L s5, (s2) | 62 | REG_L s5, (s2) |
| 63 | REG_S s5, (s4) | 63 | REG_S s5, (s4) |
| 64 | PTR_ADD s4, s4, SZREG | 64 | PTR_ADDIU s4, s4, SZREG |
| 65 | PTR_ADD s2, s2, SZREG | 65 | PTR_ADDIU s2, s2, SZREG |
| 66 | LONG_SUB s6, s6, 1 | 66 | LONG_ADDIU s6, s6, -1 |
| 67 | beq s6, zero, process_entry | 67 | beq s6, zero, process_entry |
| 68 | b copy_word | 68 | b copy_word |
| 69 | b process_entry | 69 | b process_entry |
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index ad4d44635c76..a6f6b762c47a 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
| @@ -80,7 +80,7 @@ syscall_trace_entry: | |||
| 80 | SAVE_STATIC | 80 | SAVE_STATIC |
| 81 | move s0, t2 | 81 | move s0, t2 |
| 82 | move a0, sp | 82 | move a0, sp |
| 83 | daddiu a1, v0, __NR_64_Linux | 83 | move a1, v0 |
| 84 | jal syscall_trace_enter | 84 | jal syscall_trace_enter |
| 85 | 85 | ||
| 86 | bltz v0, 2f # seccomp failed? Skip syscall | 86 | bltz v0, 2f # seccomp failed? Skip syscall |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 446cc654da56..4b2010654c46 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
| @@ -72,7 +72,7 @@ n32_syscall_trace_entry: | |||
| 72 | SAVE_STATIC | 72 | SAVE_STATIC |
| 73 | move s0, t2 | 73 | move s0, t2 |
| 74 | move a0, sp | 74 | move a0, sp |
| 75 | daddiu a1, v0, __NR_N32_Linux | 75 | move a1, v0 |
| 76 | jal syscall_trace_enter | 76 | jal syscall_trace_enter |
| 77 | 77 | ||
| 78 | bltz v0, 2f # seccomp failed? Skip syscall | 78 | bltz v0, 2f # seccomp failed? Skip syscall |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index 19a7705f2a01..5d7f2634996f 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
| @@ -409,8 +409,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) | |||
| 409 | 409 | ||
| 410 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) | 410 | int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) |
| 411 | { | 411 | { |
| 412 | memset(to, 0, sizeof *to); | ||
| 413 | |||
| 414 | if (copy_from_user(to, from, 3*sizeof(int)) || | 412 | if (copy_from_user(to, from, 3*sizeof(int)) || |
| 415 | copy_from_user(to->_sifields._pad, | 413 | copy_from_user(to->_sifields._pad, |
| 416 | from->_sifields._pad, SI_PAD_SIZE32)) | 414 | from->_sifields._pad, SI_PAD_SIZE32)) |
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index 336708ae5c5b..78cf8c2f1de0 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c | |||
| @@ -284,7 +284,7 @@ static irqreturn_t bmips5000_ipi_interrupt(int irq, void *dev_id) | |||
| 284 | if (action == 0) | 284 | if (action == 0) |
| 285 | scheduler_ipi(); | 285 | scheduler_ipi(); |
| 286 | else | 286 | else |
| 287 | smp_call_function_interrupt(); | 287 | generic_smp_call_function_interrupt(); |
| 288 | 288 | ||
| 289 | return IRQ_HANDLED; | 289 | return IRQ_HANDLED; |
| 290 | } | 290 | } |
| @@ -336,7 +336,7 @@ static irqreturn_t bmips43xx_ipi_interrupt(int irq, void *dev_id) | |||
| 336 | if (action & SMP_RESCHEDULE_YOURSELF) | 336 | if (action & SMP_RESCHEDULE_YOURSELF) |
| 337 | scheduler_ipi(); | 337 | scheduler_ipi(); |
| 338 | if (action & SMP_CALL_FUNCTION) | 338 | if (action & SMP_CALL_FUNCTION) |
| 339 | smp_call_function_interrupt(); | 339 | generic_smp_call_function_interrupt(); |
| 340 | 340 | ||
| 341 | return IRQ_HANDLED; | 341 | return IRQ_HANDLED; |
| 342 | } | 342 | } |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index d0744cc77ea7..a31896c33716 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
| @@ -192,16 +192,6 @@ asmlinkage void start_secondary(void) | |||
| 192 | cpu_startup_entry(CPUHP_ONLINE); | 192 | cpu_startup_entry(CPUHP_ONLINE); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | /* | ||
| 196 | * Call into both interrupt handlers, as we share the IPI for them | ||
| 197 | */ | ||
| 198 | void __irq_entry smp_call_function_interrupt(void) | ||
| 199 | { | ||
| 200 | irq_enter(); | ||
| 201 | generic_smp_call_function_interrupt(); | ||
| 202 | irq_exit(); | ||
| 203 | } | ||
| 204 | |||
| 205 | static void stop_this_cpu(void *dummy) | 195 | static void stop_this_cpu(void *dummy) |
| 206 | { | 196 | { |
| 207 | /* | 197 | /* |
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index e207a43b5f8f..8ea28e6ab37d 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c | |||
| @@ -192,6 +192,7 @@ static void show_stacktrace(struct task_struct *task, | |||
| 192 | void show_stack(struct task_struct *task, unsigned long *sp) | 192 | void show_stack(struct task_struct *task, unsigned long *sp) |
| 193 | { | 193 | { |
| 194 | struct pt_regs regs; | 194 | struct pt_regs regs; |
| 195 | mm_segment_t old_fs = get_fs(); | ||
| 195 | if (sp) { | 196 | if (sp) { |
| 196 | regs.regs[29] = (unsigned long)sp; | 197 | regs.regs[29] = (unsigned long)sp; |
| 197 | regs.regs[31] = 0; | 198 | regs.regs[31] = 0; |
| @@ -210,7 +211,13 @@ void show_stack(struct task_struct *task, unsigned long *sp) | |||
| 210 | prepare_frametrace(®s); | 211 | prepare_frametrace(®s); |
| 211 | } | 212 | } |
| 212 | } | 213 | } |
| 214 | /* | ||
| 215 | * show_stack() deals exclusively with kernel mode, so be sure to access | ||
| 216 | * the stack in the kernel (not user) address space. | ||
| 217 | */ | ||
| 218 | set_fs(KERNEL_DS); | ||
| 213 | show_stacktrace(task, ®s); | 219 | show_stacktrace(task, ®s); |
| 220 | set_fs(old_fs); | ||
| 214 | } | 221 | } |
| 215 | 222 | ||
| 216 | static void show_code(unsigned int __user *pc) | 223 | static void show_code(unsigned int __user *pc) |
| @@ -1519,6 +1526,7 @@ asmlinkage void do_mcheck(struct pt_regs *regs) | |||
| 1519 | const int field = 2 * sizeof(unsigned long); | 1526 | const int field = 2 * sizeof(unsigned long); |
| 1520 | int multi_match = regs->cp0_status & ST0_TS; | 1527 | int multi_match = regs->cp0_status & ST0_TS; |
| 1521 | enum ctx_state prev_state; | 1528 | enum ctx_state prev_state; |
| 1529 | mm_segment_t old_fs = get_fs(); | ||
| 1522 | 1530 | ||
| 1523 | prev_state = exception_enter(); | 1531 | prev_state = exception_enter(); |
| 1524 | show_regs(regs); | 1532 | show_regs(regs); |
| @@ -1540,8 +1548,13 @@ asmlinkage void do_mcheck(struct pt_regs *regs) | |||
| 1540 | dump_tlb_all(); | 1548 | dump_tlb_all(); |
| 1541 | } | 1549 | } |
| 1542 | 1550 | ||
| 1551 | if (!user_mode(regs)) | ||
| 1552 | set_fs(KERNEL_DS); | ||
| 1553 | |||
| 1543 | show_code((unsigned int __user *) regs->cp0_epc); | 1554 | show_code((unsigned int __user *) regs->cp0_epc); |
| 1544 | 1555 | ||
| 1556 | set_fs(old_fs); | ||
| 1557 | |||
| 1545 | /* | 1558 | /* |
| 1546 | * Some chips may have other causes of machine check (e.g. SB1 | 1559 | * Some chips may have other causes of machine check (e.g. SB1 |
| 1547 | * graduation timer) | 1560 | * graduation timer) |
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c index af84bef0c90d..eb3efd137fd1 100644 --- a/arch/mips/kernel/unaligned.c +++ b/arch/mips/kernel/unaligned.c | |||
| @@ -438,7 +438,7 @@ do { \ | |||
| 438 | : "memory"); \ | 438 | : "memory"); \ |
| 439 | } while(0) | 439 | } while(0) |
| 440 | 440 | ||
| 441 | #define StoreDW(addr, value, res) \ | 441 | #define _StoreDW(addr, value, res) \ |
| 442 | do { \ | 442 | do { \ |
| 443 | __asm__ __volatile__ ( \ | 443 | __asm__ __volatile__ ( \ |
| 444 | ".set\tpush\n\t" \ | 444 | ".set\tpush\n\t" \ |
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c index 6ab10573490d..2c218c3bbca5 100644 --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c | |||
| @@ -293,7 +293,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) | |||
| 293 | 293 | ||
| 294 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) | 294 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) |
| 295 | { | 295 | { |
| 296 | smp_call_function_interrupt(); | 296 | generic_smp_call_function_interrupt(); |
| 297 | return IRQ_HANDLED; | 297 | return IRQ_HANDLED; |
| 298 | } | 298 | } |
| 299 | 299 | ||
| @@ -466,6 +466,7 @@ int get_c0_perfcount_int(void) | |||
| 466 | { | 466 | { |
| 467 | return ltq_perfcount_irq; | 467 | return ltq_perfcount_irq; |
| 468 | } | 468 | } |
| 469 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 469 | 470 | ||
| 470 | unsigned int get_c0_compare_int(void) | 471 | unsigned int get_c0_compare_int(void) |
| 471 | { | 472 | { |
diff --git a/arch/mips/loongson64/loongson-3/smp.c b/arch/mips/loongson64/loongson-3/smp.c index 509877c6e9d9..1a4738a8f2d3 100644 --- a/arch/mips/loongson64/loongson-3/smp.c +++ b/arch/mips/loongson64/loongson-3/smp.c | |||
| @@ -266,8 +266,11 @@ void loongson3_ipi_interrupt(struct pt_regs *regs) | |||
| 266 | if (action & SMP_RESCHEDULE_YOURSELF) | 266 | if (action & SMP_RESCHEDULE_YOURSELF) |
| 267 | scheduler_ipi(); | 267 | scheduler_ipi(); |
| 268 | 268 | ||
| 269 | if (action & SMP_CALL_FUNCTION) | 269 | if (action & SMP_CALL_FUNCTION) { |
| 270 | smp_call_function_interrupt(); | 270 | irq_enter(); |
| 271 | generic_smp_call_function_interrupt(); | ||
| 272 | irq_exit(); | ||
| 273 | } | ||
| 271 | 274 | ||
| 272 | if (action & SMP_ASK_C0COUNT) { | 275 | if (action & SMP_ASK_C0COUNT) { |
| 273 | BUG_ON(cpu != 0); | 276 | BUG_ON(cpu != 0); |
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index 77d96db8253c..aab218c36e0d 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c | |||
| @@ -160,18 +160,18 @@ static inline void setup_protection_map(void) | |||
| 160 | protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); | 160 | protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); |
| 161 | protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); | 161 | protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); |
| 162 | protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); | 162 | protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); |
| 163 | protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); | 163 | protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT); |
| 164 | protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT); | 164 | protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT); |
| 165 | protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); | 165 | protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT); |
| 166 | protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT); | 166 | protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT); |
| 167 | 167 | ||
| 168 | protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); | 168 | protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ); |
| 169 | protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); | 169 | protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC); |
| 170 | protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ); | 170 | protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ); |
| 171 | protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); | 171 | protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE); |
| 172 | protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_READ); | 172 | protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT); |
| 173 | protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT); | 173 | protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT); |
| 174 | protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE | _PAGE_NO_READ); | 174 | protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE); |
| 175 | protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE); | 175 | protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE); |
| 176 | 176 | ||
| 177 | } else { | 177 | } else { |
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c index 36c0f26fac6b..852a41c6da45 100644 --- a/arch/mips/mm/fault.c +++ b/arch/mips/mm/fault.c | |||
| @@ -133,7 +133,8 @@ good_area: | |||
| 133 | #endif | 133 | #endif |
| 134 | goto bad_area; | 134 | goto bad_area; |
| 135 | } | 135 | } |
| 136 | if (!(vma->vm_flags & VM_READ)) { | 136 | if (!(vma->vm_flags & VM_READ) && |
| 137 | exception_epc(regs) != address) { | ||
| 137 | #if 0 | 138 | #if 0 |
| 138 | pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n", | 139 | pr_notice("Cpu%d[%s:%d:%0*lx:%ld:%0*lx] RI violation\n", |
| 139 | raw_smp_processor_id(), | 140 | raw_smp_processor_id(), |
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index d1392f8f5811..fa8f591f3713 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
| @@ -222,7 +222,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) | |||
| 222 | 222 | ||
| 223 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) | 223 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) |
| 224 | { | 224 | { |
| 225 | smp_call_function_interrupt(); | 225 | generic_smp_call_function_interrupt(); |
| 226 | 226 | ||
| 227 | return IRQ_HANDLED; | 227 | return IRQ_HANDLED; |
| 228 | } | 228 | } |
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c index 5625b190edc0..b7bf721eabf5 100644 --- a/arch/mips/mti-malta/malta-time.c +++ b/arch/mips/mti-malta/malta-time.c | |||
| @@ -154,6 +154,7 @@ int get_c0_perfcount_int(void) | |||
| 154 | 154 | ||
| 155 | return mips_cpu_perf_irq; | 155 | return mips_cpu_perf_irq; |
| 156 | } | 156 | } |
| 157 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 157 | 158 | ||
| 158 | unsigned int get_c0_compare_int(void) | 159 | unsigned int get_c0_compare_int(void) |
| 159 | { | 160 | { |
| @@ -171,14 +172,17 @@ unsigned int get_c0_compare_int(void) | |||
| 171 | 172 | ||
| 172 | static void __init init_rtc(void) | 173 | static void __init init_rtc(void) |
| 173 | { | 174 | { |
| 174 | /* stop the clock whilst setting it up */ | 175 | unsigned char freq, ctrl; |
| 175 | CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL); | ||
| 176 | 176 | ||
| 177 | /* 32KHz time base */ | 177 | /* Set 32KHz time base if not already set */ |
| 178 | CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); | 178 | freq = CMOS_READ(RTC_FREQ_SELECT); |
| 179 | if ((freq & RTC_DIV_CTL) != RTC_REF_CLCK_32KHZ) | ||
| 180 | CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); | ||
| 179 | 181 | ||
| 180 | /* start the clock */ | 182 | /* Ensure SET bit is clear so RTC can run */ |
| 181 | CMOS_WRITE(RTC_24H, RTC_CONTROL); | 183 | ctrl = CMOS_READ(RTC_CONTROL); |
| 184 | if (ctrl & RTC_SET) | ||
| 185 | CMOS_WRITE(ctrl & ~RTC_SET, RTC_CONTROL); | ||
| 182 | } | 186 | } |
| 183 | 187 | ||
| 184 | void __init plat_time_init(void) | 188 | void __init plat_time_init(void) |
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c index e1d69895fb1d..a120b7a5a8fe 100644 --- a/arch/mips/mti-sead3/sead3-time.c +++ b/arch/mips/mti-sead3/sead3-time.c | |||
| @@ -77,6 +77,7 @@ int get_c0_perfcount_int(void) | |||
| 77 | return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; | 77 | return MIPS_CPU_IRQ_BASE + cp0_perfcount_irq; |
| 78 | return -1; | 78 | return -1; |
| 79 | } | 79 | } |
| 80 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 80 | 81 | ||
| 81 | unsigned int get_c0_compare_int(void) | 82 | unsigned int get_c0_compare_int(void) |
| 82 | { | 83 | { |
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c index dc3e327fbbac..f5fff228b347 100644 --- a/arch/mips/netlogic/common/smp.c +++ b/arch/mips/netlogic/common/smp.c | |||
| @@ -86,7 +86,7 @@ void nlm_smp_function_ipi_handler(unsigned int irq, struct irq_desc *desc) | |||
| 86 | { | 86 | { |
| 87 | clear_c0_eimr(irq); | 87 | clear_c0_eimr(irq); |
| 88 | ack_c0_eirr(irq); | 88 | ack_c0_eirr(irq); |
| 89 | smp_call_function_interrupt(); | 89 | generic_smp_call_function_interrupt(); |
| 90 | set_c0_eimr(irq); | 90 | set_c0_eimr(irq); |
| 91 | } | 91 | } |
| 92 | 92 | ||
diff --git a/arch/mips/paravirt/paravirt-smp.c b/arch/mips/paravirt/paravirt-smp.c index 42181c7105df..f8d3e081b2eb 100644 --- a/arch/mips/paravirt/paravirt-smp.c +++ b/arch/mips/paravirt/paravirt-smp.c | |||
| @@ -114,7 +114,7 @@ static irqreturn_t paravirt_reched_interrupt(int irq, void *dev_id) | |||
| 114 | 114 | ||
| 115 | static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id) | 115 | static irqreturn_t paravirt_function_interrupt(int irq, void *dev_id) |
| 116 | { | 116 | { |
| 117 | smp_call_function_interrupt(); | 117 | generic_smp_call_function_interrupt(); |
| 118 | return IRQ_HANDLED; | 118 | return IRQ_HANDLED; |
| 119 | } | 119 | } |
| 120 | 120 | ||
diff --git a/arch/mips/pistachio/time.c b/arch/mips/pistachio/time.c index 7c73fcb92a10..8a377346f0ca 100644 --- a/arch/mips/pistachio/time.c +++ b/arch/mips/pistachio/time.c | |||
| @@ -26,6 +26,7 @@ int get_c0_perfcount_int(void) | |||
| 26 | { | 26 | { |
| 27 | return gic_get_c0_perfcount_int(); | 27 | return gic_get_c0_perfcount_int(); |
| 28 | } | 28 | } |
| 29 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 29 | 30 | ||
| 30 | int get_c0_fdc_int(void) | 31 | int get_c0_fdc_int(void) |
| 31 | { | 32 | { |
diff --git a/arch/mips/pmcs-msp71xx/msp_smp.c b/arch/mips/pmcs-msp71xx/msp_smp.c index 10170580a2de..ffa0f7101a97 100644 --- a/arch/mips/pmcs-msp71xx/msp_smp.c +++ b/arch/mips/pmcs-msp71xx/msp_smp.c | |||
| @@ -44,7 +44,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) | |||
| 44 | 44 | ||
| 45 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) | 45 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) |
| 46 | { | 46 | { |
| 47 | smp_call_function_interrupt(); | 47 | generic_smp_call_function_interrupt(); |
| 48 | 48 | ||
| 49 | return IRQ_HANDLED; | 49 | return IRQ_HANDLED; |
| 50 | } | 50 | } |
diff --git a/arch/mips/ralink/irq.c b/arch/mips/ralink/irq.c index 53707aacc0f8..8c624a8b9ea2 100644 --- a/arch/mips/ralink/irq.c +++ b/arch/mips/ralink/irq.c | |||
| @@ -89,6 +89,7 @@ int get_c0_perfcount_int(void) | |||
| 89 | { | 89 | { |
| 90 | return rt_perfcount_irq; | 90 | return rt_perfcount_irq; |
| 91 | } | 91 | } |
| 92 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 92 | 93 | ||
| 93 | unsigned int get_c0_compare_int(void) | 94 | unsigned int get_c0_compare_int(void) |
| 94 | { | 95 | { |
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c index 3fbaef97a1b8..16ec4e12daa3 100644 --- a/arch/mips/sgi-ip27/ip27-irq.c +++ b/arch/mips/sgi-ip27/ip27-irq.c | |||
| @@ -107,10 +107,14 @@ static void ip27_do_irq_mask0(void) | |||
| 107 | scheduler_ipi(); | 107 | scheduler_ipi(); |
| 108 | } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) { | 108 | } else if (pend0 & (1UL << CPU_CALL_A_IRQ)) { |
| 109 | LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ); | 109 | LOCAL_HUB_CLR_INTR(CPU_CALL_A_IRQ); |
| 110 | smp_call_function_interrupt(); | 110 | irq_enter(); |
| 111 | generic_smp_call_function_interrupt(); | ||
| 112 | irq_exit(); | ||
| 111 | } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) { | 113 | } else if (pend0 & (1UL << CPU_CALL_B_IRQ)) { |
| 112 | LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ); | 114 | LOCAL_HUB_CLR_INTR(CPU_CALL_B_IRQ); |
| 113 | smp_call_function_interrupt(); | 115 | irq_enter(); |
| 116 | generic_smp_call_function_interrupt(); | ||
| 117 | irq_exit(); | ||
| 114 | } else | 118 | } else |
| 115 | #endif | 119 | #endif |
| 116 | { | 120 | { |
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c index af7d44edd9a8..4c71aea25663 100644 --- a/arch/mips/sibyte/bcm1480/smp.c +++ b/arch/mips/sibyte/bcm1480/smp.c | |||
| @@ -29,8 +29,6 @@ | |||
| 29 | #include <asm/sibyte/bcm1480_regs.h> | 29 | #include <asm/sibyte/bcm1480_regs.h> |
| 30 | #include <asm/sibyte/bcm1480_int.h> | 30 | #include <asm/sibyte/bcm1480_int.h> |
| 31 | 31 | ||
| 32 | extern void smp_call_function_interrupt(void); | ||
| 33 | |||
| 34 | /* | 32 | /* |
| 35 | * These are routines for dealing with the bcm1480 smp capabilities | 33 | * These are routines for dealing with the bcm1480 smp capabilities |
| 36 | * independent of board/firmware | 34 | * independent of board/firmware |
| @@ -184,6 +182,9 @@ void bcm1480_mailbox_interrupt(void) | |||
| 184 | if (action & SMP_RESCHEDULE_YOURSELF) | 182 | if (action & SMP_RESCHEDULE_YOURSELF) |
| 185 | scheduler_ipi(); | 183 | scheduler_ipi(); |
| 186 | 184 | ||
| 187 | if (action & SMP_CALL_FUNCTION) | 185 | if (action & SMP_CALL_FUNCTION) { |
| 188 | smp_call_function_interrupt(); | 186 | irq_enter(); |
| 187 | generic_smp_call_function_interrupt(); | ||
| 188 | irq_exit(); | ||
| 189 | } | ||
| 189 | } | 190 | } |
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c index c0c4b3f88a08..1cf66f5ff23d 100644 --- a/arch/mips/sibyte/sb1250/smp.c +++ b/arch/mips/sibyte/sb1250/smp.c | |||
| @@ -172,6 +172,9 @@ void sb1250_mailbox_interrupt(void) | |||
| 172 | if (action & SMP_RESCHEDULE_YOURSELF) | 172 | if (action & SMP_RESCHEDULE_YOURSELF) |
| 173 | scheduler_ipi(); | 173 | scheduler_ipi(); |
| 174 | 174 | ||
| 175 | if (action & SMP_CALL_FUNCTION) | 175 | if (action & SMP_CALL_FUNCTION) { |
| 176 | smp_call_function_interrupt(); | 176 | irq_enter(); |
| 177 | generic_smp_call_function_interrupt(); | ||
| 178 | irq_exit(); | ||
| 179 | } | ||
| 177 | } | 180 | } |
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index 42e02a2d570b..efc3fa54c90b 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c | |||
| @@ -191,6 +191,9 @@ struct pci_dev *of_create_pci_dev(struct device_node *node, | |||
| 191 | 191 | ||
| 192 | pci_device_add(dev, bus); | 192 | pci_device_add(dev, bus); |
| 193 | 193 | ||
| 194 | /* Setup MSI caps & disable MSI/MSI-X interrupts */ | ||
| 195 | pci_msi_setup_pci_dev(dev); | ||
| 196 | |||
| 194 | return dev; | 197 | return dev; |
| 195 | } | 198 | } |
| 196 | EXPORT_SYMBOL(of_create_pci_dev); | 199 | EXPORT_SYMBOL(of_create_pci_dev); |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index d3a831ac0f92..da50e0c9c57e 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
| @@ -966,8 +966,6 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s) | |||
| 966 | 966 | ||
| 967 | int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) | 967 | int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) |
| 968 | { | 968 | { |
| 969 | memset(to, 0, sizeof *to); | ||
| 970 | |||
| 971 | if (copy_from_user(to, from, 3*sizeof(int)) || | 969 | if (copy_from_user(to, from, 3*sizeof(int)) || |
| 972 | copy_from_user(to->_sifields._pad, | 970 | copy_from_user(to->_sifields._pad, |
| 973 | from->_sifields._pad, SI_PAD_SIZE32)) | 971 | from->_sifields._pad, SI_PAD_SIZE32)) |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 2078f92d15ac..f32f843a3631 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
| @@ -1742,10 +1742,10 @@ static bool ibs_enabled(struct kvm_vcpu *vcpu) | |||
| 1742 | 1742 | ||
| 1743 | static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu) | 1743 | static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu) |
| 1744 | { | 1744 | { |
| 1745 | if (!vcpu->requests) | ||
| 1746 | return 0; | ||
| 1747 | retry: | 1745 | retry: |
| 1748 | kvm_s390_vcpu_request_handled(vcpu); | 1746 | kvm_s390_vcpu_request_handled(vcpu); |
| 1747 | if (!vcpu->requests) | ||
| 1748 | return 0; | ||
| 1749 | /* | 1749 | /* |
| 1750 | * We use MMU_RELOAD just to re-arm the ipte notifier for the | 1750 | * We use MMU_RELOAD just to re-arm the ipte notifier for the |
| 1751 | * guest prefix page. gmap_ipte_notify will wait on the ptl lock. | 1751 | * guest prefix page. gmap_ipte_notify will wait on the ptl lock. |
diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h index 1f0aa2024e94..6424249d5f78 100644 --- a/arch/sparc/include/asm/visasm.h +++ b/arch/sparc/include/asm/visasm.h | |||
| @@ -28,16 +28,10 @@ | |||
| 28 | * Must preserve %o5 between VISEntryHalf and VISExitHalf */ | 28 | * Must preserve %o5 between VISEntryHalf and VISExitHalf */ |
| 29 | 29 | ||
| 30 | #define VISEntryHalf \ | 30 | #define VISEntryHalf \ |
| 31 | rd %fprs, %o5; \ | 31 | VISEntry |
| 32 | andcc %o5, FPRS_FEF, %g0; \ | 32 | |
| 33 | be,pt %icc, 297f; \ | 33 | #define VISExitHalf \ |
| 34 | sethi %hi(298f), %g7; \ | 34 | VISExit |
| 35 | sethi %hi(VISenterhalf), %g1; \ | ||
| 36 | jmpl %g1 + %lo(VISenterhalf), %g0; \ | ||
| 37 | or %g7, %lo(298f), %g7; \ | ||
| 38 | clr %o5; \ | ||
| 39 | 297: wr %o5, FPRS_FEF, %fprs; \ | ||
| 40 | 298: | ||
| 41 | 35 | ||
| 42 | #define VISEntryHalfFast(fail_label) \ | 36 | #define VISEntryHalfFast(fail_label) \ |
| 43 | rd %fprs, %o5; \ | 37 | rd %fprs, %o5; \ |
| @@ -47,7 +41,7 @@ | |||
| 47 | ba,a,pt %xcc, fail_label; \ | 41 | ba,a,pt %xcc, fail_label; \ |
| 48 | 297: wr %o5, FPRS_FEF, %fprs; | 42 | 297: wr %o5, FPRS_FEF, %fprs; |
| 49 | 43 | ||
| 50 | #define VISExitHalf \ | 44 | #define VISExitHalfFast \ |
| 51 | wr %o5, 0, %fprs; | 45 | wr %o5, 0, %fprs; |
| 52 | 46 | ||
| 53 | #ifndef __ASSEMBLY__ | 47 | #ifndef __ASSEMBLY__ |
diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S index 140527a20e7d..83aeeb1dffdb 100644 --- a/arch/sparc/lib/NG4memcpy.S +++ b/arch/sparc/lib/NG4memcpy.S | |||
| @@ -240,8 +240,11 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ | |||
| 240 | add %o0, 0x40, %o0 | 240 | add %o0, 0x40, %o0 |
| 241 | bne,pt %icc, 1b | 241 | bne,pt %icc, 1b |
| 242 | LOAD(prefetch, %g1 + 0x200, #n_reads_strong) | 242 | LOAD(prefetch, %g1 + 0x200, #n_reads_strong) |
| 243 | #ifdef NON_USER_COPY | ||
| 244 | VISExitHalfFast | ||
| 245 | #else | ||
| 243 | VISExitHalf | 246 | VISExitHalf |
| 244 | 247 | #endif | |
| 245 | brz,pn %o2, .Lexit | 248 | brz,pn %o2, .Lexit |
| 246 | cmp %o2, 19 | 249 | cmp %o2, 19 |
| 247 | ble,pn %icc, .Lsmall_unaligned | 250 | ble,pn %icc, .Lsmall_unaligned |
diff --git a/arch/sparc/lib/VISsave.S b/arch/sparc/lib/VISsave.S index b320ae9e2e2e..a063d84336d6 100644 --- a/arch/sparc/lib/VISsave.S +++ b/arch/sparc/lib/VISsave.S | |||
| @@ -44,9 +44,8 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 | |||
| 44 | 44 | ||
| 45 | stx %g3, [%g6 + TI_GSR] | 45 | stx %g3, [%g6 + TI_GSR] |
| 46 | 2: add %g6, %g1, %g3 | 46 | 2: add %g6, %g1, %g3 |
| 47 | cmp %o5, FPRS_DU | 47 | mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5 |
| 48 | be,pn %icc, 6f | 48 | sll %g1, 3, %g1 |
| 49 | sll %g1, 3, %g1 | ||
| 50 | stb %o5, [%g3 + TI_FPSAVED] | 49 | stb %o5, [%g3 + TI_FPSAVED] |
| 51 | rd %gsr, %g2 | 50 | rd %gsr, %g2 |
| 52 | add %g6, %g1, %g3 | 51 | add %g6, %g1, %g3 |
| @@ -80,65 +79,3 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 | |||
| 80 | .align 32 | 79 | .align 32 |
| 81 | 80: jmpl %g7 + %g0, %g0 | 80 | 80: jmpl %g7 + %g0, %g0 |
| 82 | nop | 81 | nop |
| 83 | |||
| 84 | 6: ldub [%g3 + TI_FPSAVED], %o5 | ||
| 85 | or %o5, FPRS_DU, %o5 | ||
| 86 | add %g6, TI_FPREGS+0x80, %g2 | ||
| 87 | stb %o5, [%g3 + TI_FPSAVED] | ||
| 88 | |||
| 89 | sll %g1, 5, %g1 | ||
| 90 | add %g6, TI_FPREGS+0xc0, %g3 | ||
| 91 | wr %g0, FPRS_FEF, %fprs | ||
| 92 | membar #Sync | ||
| 93 | stda %f32, [%g2 + %g1] ASI_BLK_P | ||
| 94 | stda %f48, [%g3 + %g1] ASI_BLK_P | ||
| 95 | membar #Sync | ||
| 96 | ba,pt %xcc, 80f | ||
| 97 | nop | ||
| 98 | |||
| 99 | .align 32 | ||
| 100 | 80: jmpl %g7 + %g0, %g0 | ||
| 101 | nop | ||
| 102 | |||
| 103 | .align 32 | ||
| 104 | VISenterhalf: | ||
| 105 | ldub [%g6 + TI_FPDEPTH], %g1 | ||
| 106 | brnz,a,pn %g1, 1f | ||
| 107 | cmp %g1, 1 | ||
| 108 | stb %g0, [%g6 + TI_FPSAVED] | ||
| 109 | stx %fsr, [%g6 + TI_XFSR] | ||
| 110 | clr %o5 | ||
| 111 | jmpl %g7 + %g0, %g0 | ||
| 112 | wr %g0, FPRS_FEF, %fprs | ||
| 113 | |||
| 114 | 1: bne,pn %icc, 2f | ||
| 115 | srl %g1, 1, %g1 | ||
| 116 | ba,pt %xcc, vis1 | ||
| 117 | sub %g7, 8, %g7 | ||
| 118 | 2: addcc %g6, %g1, %g3 | ||
| 119 | sll %g1, 3, %g1 | ||
| 120 | andn %o5, FPRS_DU, %g2 | ||
| 121 | stb %g2, [%g3 + TI_FPSAVED] | ||
| 122 | |||
| 123 | rd %gsr, %g2 | ||
| 124 | add %g6, %g1, %g3 | ||
| 125 | stx %g2, [%g3 + TI_GSR] | ||
| 126 | add %g6, %g1, %g2 | ||
| 127 | stx %fsr, [%g2 + TI_XFSR] | ||
| 128 | sll %g1, 5, %g1 | ||
| 129 | 3: andcc %o5, FPRS_DL, %g0 | ||
| 130 | be,pn %icc, 4f | ||
| 131 | add %g6, TI_FPREGS, %g2 | ||
| 132 | |||
| 133 | add %g6, TI_FPREGS+0x40, %g3 | ||
| 134 | membar #Sync | ||
| 135 | stda %f0, [%g2 + %g1] ASI_BLK_P | ||
| 136 | stda %f16, [%g3 + %g1] ASI_BLK_P | ||
| 137 | membar #Sync | ||
| 138 | ba,pt %xcc, 4f | ||
| 139 | nop | ||
| 140 | |||
| 141 | .align 32 | ||
| 142 | 4: and %o5, FPRS_DU, %o5 | ||
| 143 | jmpl %g7 + %g0, %g0 | ||
| 144 | wr %o5, FPRS_FEF, %fprs | ||
diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c index 1d649a95660c..8069ce12f20b 100644 --- a/arch/sparc/lib/ksyms.c +++ b/arch/sparc/lib/ksyms.c | |||
| @@ -135,10 +135,6 @@ EXPORT_SYMBOL(copy_user_page); | |||
| 135 | void VISenter(void); | 135 | void VISenter(void); |
| 136 | EXPORT_SYMBOL(VISenter); | 136 | EXPORT_SYMBOL(VISenter); |
| 137 | 137 | ||
| 138 | /* CRYPTO code needs this */ | ||
| 139 | void VISenterhalf(void); | ||
| 140 | EXPORT_SYMBOL(VISenterhalf); | ||
| 141 | |||
| 142 | extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); | 138 | extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); |
| 143 | extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, | 139 | extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, |
| 144 | unsigned long *); | 140 | unsigned long *); |
diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c index e8c2c04143cd..c667e104a0c2 100644 --- a/arch/tile/kernel/compat_signal.c +++ b/arch/tile/kernel/compat_signal.c | |||
| @@ -113,8 +113,6 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) | |||
| 113 | if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo))) | 113 | if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo))) |
| 114 | return -EFAULT; | 114 | return -EFAULT; |
| 115 | 115 | ||
| 116 | memset(to, 0, sizeof(*to)); | ||
| 117 | |||
| 118 | err = __get_user(to->si_signo, &from->si_signo); | 116 | err = __get_user(to->si_signo, &from->si_signo); |
| 119 | err |= __get_user(to->si_errno, &from->si_errno); | 117 | err |= __get_user(to->si_errno, &from->si_errno); |
| 120 | err |= __get_user(to->si_code, &from->si_code); | 118 | err |= __get_user(to->si_code, &from->si_code); |
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index 5a1844765a7a..a7e257d9cb90 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S | |||
| @@ -140,6 +140,7 @@ sysexit_from_sys_call: | |||
| 140 | */ | 140 | */ |
| 141 | andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) | 141 | andl $~TS_COMPAT, ASM_THREAD_INFO(TI_status, %rsp, SIZEOF_PTREGS) |
| 142 | movl RIP(%rsp), %ecx /* User %eip */ | 142 | movl RIP(%rsp), %ecx /* User %eip */ |
| 143 | movq RAX(%rsp), %rax | ||
| 143 | RESTORE_RSI_RDI | 144 | RESTORE_RSI_RDI |
| 144 | xorl %edx, %edx /* Do not leak kernel information */ | 145 | xorl %edx, %edx /* Do not leak kernel information */ |
| 145 | xorq %r8, %r8 | 146 | xorq %r8, %r8 |
| @@ -219,7 +220,6 @@ sysexit_from_sys_call: | |||
| 219 | 1: setbe %al /* 1 if error, 0 if not */ | 220 | 1: setbe %al /* 1 if error, 0 if not */ |
| 220 | movzbl %al, %edi /* zero-extend that into %edi */ | 221 | movzbl %al, %edi /* zero-extend that into %edi */ |
| 221 | call __audit_syscall_exit | 222 | call __audit_syscall_exit |
| 222 | movq RAX(%rsp), %rax /* reload syscall return value */ | ||
| 223 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %edi | 223 | movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT), %edi |
| 224 | DISABLE_INTERRUPTS(CLBR_NONE) | 224 | DISABLE_INTERRUPTS(CLBR_NONE) |
| 225 | TRACE_IRQS_OFF | 225 | TRACE_IRQS_OFF |
| @@ -368,6 +368,7 @@ sysretl_from_sys_call: | |||
| 368 | RESTORE_RSI_RDI_RDX | 368 | RESTORE_RSI_RDI_RDX |
| 369 | movl RIP(%rsp), %ecx | 369 | movl RIP(%rsp), %ecx |
| 370 | movl EFLAGS(%rsp), %r11d | 370 | movl EFLAGS(%rsp), %r11d |
| 371 | movq RAX(%rsp), %rax | ||
| 371 | xorq %r10, %r10 | 372 | xorq %r10, %r10 |
| 372 | xorq %r9, %r9 | 373 | xorq %r9, %r9 |
| 373 | xorq %r8, %r8 | 374 | xorq %r8, %r8 |
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h index 6fe6b182c998..9dfce4e0417d 100644 --- a/arch/x86/include/asm/sigcontext.h +++ b/arch/x86/include/asm/sigcontext.h | |||
| @@ -57,9 +57,9 @@ struct sigcontext { | |||
| 57 | unsigned long ip; | 57 | unsigned long ip; |
| 58 | unsigned long flags; | 58 | unsigned long flags; |
| 59 | unsigned short cs; | 59 | unsigned short cs; |
| 60 | unsigned short __pad2; /* Was called gs, but was always zero. */ | 60 | unsigned short gs; |
| 61 | unsigned short __pad1; /* Was called fs, but was always zero. */ | 61 | unsigned short fs; |
| 62 | unsigned short ss; | 62 | unsigned short __pad0; |
| 63 | unsigned long err; | 63 | unsigned long err; |
| 64 | unsigned long trapno; | 64 | unsigned long trapno; |
| 65 | unsigned long oldmask; | 65 | unsigned long oldmask; |
diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h index 751bf4b7bf11..d7f3b3b78ac3 100644 --- a/arch/x86/include/asm/switch_to.h +++ b/arch/x86/include/asm/switch_to.h | |||
| @@ -79,12 +79,12 @@ do { \ | |||
| 79 | #else /* CONFIG_X86_32 */ | 79 | #else /* CONFIG_X86_32 */ |
| 80 | 80 | ||
| 81 | /* frame pointer must be last for get_wchan */ | 81 | /* frame pointer must be last for get_wchan */ |
| 82 | #define SAVE_CONTEXT "pushq %%rbp ; movq %%rsi,%%rbp\n\t" | 82 | #define SAVE_CONTEXT "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t" |
| 83 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\t" | 83 | #define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\t" |
| 84 | 84 | ||
| 85 | #define __EXTRA_CLOBBER \ | 85 | #define __EXTRA_CLOBBER \ |
| 86 | , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ | 86 | , "rcx", "rbx", "rdx", "r8", "r9", "r10", "r11", \ |
| 87 | "r12", "r13", "r14", "r15", "flags" | 87 | "r12", "r13", "r14", "r15" |
| 88 | 88 | ||
| 89 | #ifdef CONFIG_CC_STACKPROTECTOR | 89 | #ifdef CONFIG_CC_STACKPROTECTOR |
| 90 | #define __switch_canary \ | 90 | #define __switch_canary \ |
| @@ -100,11 +100,7 @@ do { \ | |||
| 100 | #define __switch_canary_iparam | 100 | #define __switch_canary_iparam |
| 101 | #endif /* CC_STACKPROTECTOR */ | 101 | #endif /* CC_STACKPROTECTOR */ |
| 102 | 102 | ||
| 103 | /* | 103 | /* Save restore flags to clear handle leaking NT */ |
| 104 | * There is no need to save or restore flags, because flags are always | ||
| 105 | * clean in kernel mode, with the possible exception of IOPL. Kernel IOPL | ||
| 106 | * has no effect. | ||
| 107 | */ | ||
| 108 | #define switch_to(prev, next, last) \ | 104 | #define switch_to(prev, next, last) \ |
| 109 | asm volatile(SAVE_CONTEXT \ | 105 | asm volatile(SAVE_CONTEXT \ |
| 110 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ | 106 | "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */ \ |
diff --git a/arch/x86/include/uapi/asm/sigcontext.h b/arch/x86/include/uapi/asm/sigcontext.h index 0e8a973de9ee..40836a9a7250 100644 --- a/arch/x86/include/uapi/asm/sigcontext.h +++ b/arch/x86/include/uapi/asm/sigcontext.h | |||
| @@ -177,24 +177,9 @@ struct sigcontext { | |||
| 177 | __u64 rip; | 177 | __u64 rip; |
| 178 | __u64 eflags; /* RFLAGS */ | 178 | __u64 eflags; /* RFLAGS */ |
| 179 | __u16 cs; | 179 | __u16 cs; |
| 180 | 180 | __u16 gs; | |
| 181 | /* | 181 | __u16 fs; |
| 182 | * Prior to 2.5.64 ("[PATCH] x86-64 updates for 2.5.64-bk3"), | 182 | __u16 __pad0; |
| 183 | * Linux saved and restored fs and gs in these slots. This | ||
| 184 | * was counterproductive, as fsbase and gsbase were never | ||
| 185 | * saved, so arch_prctl was presumably unreliable. | ||
| 186 | * | ||
| 187 | * If these slots are ever needed for any other purpose, there | ||
| 188 | * is some risk that very old 64-bit binaries could get | ||
| 189 | * confused. I doubt that many such binaries still work, | ||
| 190 | * though, since the same patch in 2.5.64 also removed the | ||
| 191 | * 64-bit set_thread_area syscall, so it appears that there is | ||
| 192 | * no TLS API that works in both pre- and post-2.5.64 kernels. | ||
| 193 | */ | ||
| 194 | __u16 __pad2; /* Was gs. */ | ||
| 195 | __u16 __pad1; /* Was fs. */ | ||
| 196 | |||
| 197 | __u16 ss; | ||
| 198 | __u64 err; | 183 | __u64 err; |
| 199 | __u64 trapno; | 184 | __u64 trapno; |
| 200 | __u64 oldmask; | 185 | __u64 oldmask; |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index dcb52850a28f..cde732c1b495 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
| @@ -1424,7 +1424,7 @@ static inline void __x2apic_disable(void) | |||
| 1424 | { | 1424 | { |
| 1425 | u64 msr; | 1425 | u64 msr; |
| 1426 | 1426 | ||
| 1427 | if (cpu_has_apic) | 1427 | if (!cpu_has_apic) |
| 1428 | return; | 1428 | return; |
| 1429 | 1429 | ||
| 1430 | rdmsrl(MSR_IA32_APICBASE, msr); | 1430 | rdmsrl(MSR_IA32_APICBASE, msr); |
| @@ -1483,10 +1483,13 @@ void x2apic_setup(void) | |||
| 1483 | 1483 | ||
| 1484 | static __init void x2apic_disable(void) | 1484 | static __init void x2apic_disable(void) |
| 1485 | { | 1485 | { |
| 1486 | u32 x2apic_id; | 1486 | u32 x2apic_id, state = x2apic_state; |
| 1487 | 1487 | ||
| 1488 | if (x2apic_state != X2APIC_ON) | 1488 | x2apic_mode = 0; |
| 1489 | goto out; | 1489 | x2apic_state = X2APIC_DISABLED; |
| 1490 | |||
| 1491 | if (state != X2APIC_ON) | ||
| 1492 | return; | ||
| 1490 | 1493 | ||
| 1491 | x2apic_id = read_apic_id(); | 1494 | x2apic_id = read_apic_id(); |
| 1492 | if (x2apic_id >= 255) | 1495 | if (x2apic_id >= 255) |
| @@ -1494,9 +1497,6 @@ static __init void x2apic_disable(void) | |||
| 1494 | 1497 | ||
| 1495 | __x2apic_disable(); | 1498 | __x2apic_disable(); |
| 1496 | register_lapic_address(mp_lapic_addr); | 1499 | register_lapic_address(mp_lapic_addr); |
| 1497 | out: | ||
| 1498 | x2apic_state = X2APIC_DISABLED; | ||
| 1499 | x2apic_mode = 0; | ||
| 1500 | } | 1500 | } |
| 1501 | 1501 | ||
| 1502 | static __init void x2apic_enable(void) | 1502 | static __init void x2apic_enable(void) |
diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index f813261d9740..2683f36e4e0a 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c | |||
| @@ -322,7 +322,7 @@ static int x86_vector_alloc_irqs(struct irq_domain *domain, unsigned int virq, | |||
| 322 | irq_data->chip = &lapic_controller; | 322 | irq_data->chip = &lapic_controller; |
| 323 | irq_data->chip_data = data; | 323 | irq_data->chip_data = data; |
| 324 | irq_data->hwirq = virq + i; | 324 | irq_data->hwirq = virq + i; |
| 325 | err = assign_irq_vector_policy(virq, irq_data->node, data, | 325 | err = assign_irq_vector_policy(virq + i, irq_data->node, data, |
| 326 | info); | 326 | info); |
| 327 | if (err) | 327 | if (err) |
| 328 | goto error; | 328 | goto error; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index b9826a981fb2..6326ae24e4d5 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
| @@ -2534,7 +2534,7 @@ static int intel_pmu_cpu_prepare(int cpu) | |||
| 2534 | if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) { | 2534 | if (x86_pmu.extra_regs || x86_pmu.lbr_sel_map) { |
| 2535 | cpuc->shared_regs = allocate_shared_regs(cpu); | 2535 | cpuc->shared_regs = allocate_shared_regs(cpu); |
| 2536 | if (!cpuc->shared_regs) | 2536 | if (!cpuc->shared_regs) |
| 2537 | return NOTIFY_BAD; | 2537 | goto err; |
| 2538 | } | 2538 | } |
| 2539 | 2539 | ||
| 2540 | if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { | 2540 | if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
| @@ -2542,18 +2542,27 @@ static int intel_pmu_cpu_prepare(int cpu) | |||
| 2542 | 2542 | ||
| 2543 | cpuc->constraint_list = kzalloc(sz, GFP_KERNEL); | 2543 | cpuc->constraint_list = kzalloc(sz, GFP_KERNEL); |
| 2544 | if (!cpuc->constraint_list) | 2544 | if (!cpuc->constraint_list) |
| 2545 | return NOTIFY_BAD; | 2545 | goto err_shared_regs; |
| 2546 | 2546 | ||
| 2547 | cpuc->excl_cntrs = allocate_excl_cntrs(cpu); | 2547 | cpuc->excl_cntrs = allocate_excl_cntrs(cpu); |
| 2548 | if (!cpuc->excl_cntrs) { | 2548 | if (!cpuc->excl_cntrs) |
| 2549 | kfree(cpuc->constraint_list); | 2549 | goto err_constraint_list; |
| 2550 | kfree(cpuc->shared_regs); | 2550 | |
| 2551 | return NOTIFY_BAD; | ||
| 2552 | } | ||
| 2553 | cpuc->excl_thread_id = 0; | 2551 | cpuc->excl_thread_id = 0; |
| 2554 | } | 2552 | } |
| 2555 | 2553 | ||
| 2556 | return NOTIFY_OK; | 2554 | return NOTIFY_OK; |
| 2555 | |||
| 2556 | err_constraint_list: | ||
| 2557 | kfree(cpuc->constraint_list); | ||
| 2558 | cpuc->constraint_list = NULL; | ||
| 2559 | |||
| 2560 | err_shared_regs: | ||
| 2561 | kfree(cpuc->shared_regs); | ||
| 2562 | cpuc->shared_regs = NULL; | ||
| 2563 | |||
| 2564 | err: | ||
| 2565 | return NOTIFY_BAD; | ||
| 2557 | } | 2566 | } |
| 2558 | 2567 | ||
| 2559 | static void intel_pmu_cpu_starting(int cpu) | 2568 | static void intel_pmu_cpu_starting(int cpu) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_cqm.c b/arch/x86/kernel/cpu/perf_event_intel_cqm.c index 63eb68b73589..377e8f8ed391 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_cqm.c +++ b/arch/x86/kernel/cpu/perf_event_intel_cqm.c | |||
| @@ -1255,7 +1255,7 @@ static inline void cqm_pick_event_reader(int cpu) | |||
| 1255 | cpumask_set_cpu(cpu, &cqm_cpumask); | 1255 | cpumask_set_cpu(cpu, &cqm_cpumask); |
| 1256 | } | 1256 | } |
| 1257 | 1257 | ||
| 1258 | static void intel_cqm_cpu_prepare(unsigned int cpu) | 1258 | static void intel_cqm_cpu_starting(unsigned int cpu) |
| 1259 | { | 1259 | { |
| 1260 | struct intel_pqr_state *state = &per_cpu(pqr_state, cpu); | 1260 | struct intel_pqr_state *state = &per_cpu(pqr_state, cpu); |
| 1261 | struct cpuinfo_x86 *c = &cpu_data(cpu); | 1261 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| @@ -1296,13 +1296,11 @@ static int intel_cqm_cpu_notifier(struct notifier_block *nb, | |||
| 1296 | unsigned int cpu = (unsigned long)hcpu; | 1296 | unsigned int cpu = (unsigned long)hcpu; |
| 1297 | 1297 | ||
| 1298 | switch (action & ~CPU_TASKS_FROZEN) { | 1298 | switch (action & ~CPU_TASKS_FROZEN) { |
| 1299 | case CPU_UP_PREPARE: | ||
| 1300 | intel_cqm_cpu_prepare(cpu); | ||
| 1301 | break; | ||
| 1302 | case CPU_DOWN_PREPARE: | 1299 | case CPU_DOWN_PREPARE: |
| 1303 | intel_cqm_cpu_exit(cpu); | 1300 | intel_cqm_cpu_exit(cpu); |
| 1304 | break; | 1301 | break; |
| 1305 | case CPU_STARTING: | 1302 | case CPU_STARTING: |
| 1303 | intel_cqm_cpu_starting(cpu); | ||
| 1306 | cqm_pick_event_reader(cpu); | 1304 | cqm_pick_event_reader(cpu); |
| 1307 | break; | 1305 | break; |
| 1308 | } | 1306 | } |
| @@ -1373,7 +1371,7 @@ static int __init intel_cqm_init(void) | |||
| 1373 | goto out; | 1371 | goto out; |
| 1374 | 1372 | ||
| 1375 | for_each_online_cpu(i) { | 1373 | for_each_online_cpu(i) { |
| 1376 | intel_cqm_cpu_prepare(i); | 1374 | intel_cqm_cpu_starting(i); |
| 1377 | cqm_pick_event_reader(i); | 1375 | cqm_pick_event_reader(i); |
| 1378 | } | 1376 | } |
| 1379 | 1377 | ||
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 79de954626fd..d25097c3fc1d 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c | |||
| @@ -270,7 +270,7 @@ int fpu__copy(struct fpu *dst_fpu, struct fpu *src_fpu) | |||
| 270 | dst_fpu->fpregs_active = 0; | 270 | dst_fpu->fpregs_active = 0; |
| 271 | dst_fpu->last_cpu = -1; | 271 | dst_fpu->last_cpu = -1; |
| 272 | 272 | ||
| 273 | if (src_fpu->fpstate_active) | 273 | if (src_fpu->fpstate_active && cpu_has_fpu) |
| 274 | fpu_copy(dst_fpu, src_fpu); | 274 | fpu_copy(dst_fpu, src_fpu); |
| 275 | 275 | ||
| 276 | return 0; | 276 | return 0; |
diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index 1e173f6285c7..d14e9ac3235a 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c | |||
| @@ -40,7 +40,12 @@ static void fpu__init_cpu_generic(void) | |||
| 40 | write_cr0(cr0); | 40 | write_cr0(cr0); |
| 41 | 41 | ||
| 42 | /* Flush out any pending x87 state: */ | 42 | /* Flush out any pending x87 state: */ |
| 43 | asm volatile ("fninit"); | 43 | #ifdef CONFIG_MATH_EMULATION |
| 44 | if (!cpu_has_fpu) | ||
| 45 | fpstate_init_soft(¤t->thread.fpu.state.soft); | ||
| 46 | else | ||
| 47 | #endif | ||
| 48 | asm volatile ("fninit"); | ||
| 44 | } | 49 | } |
| 45 | 50 | ||
| 46 | /* | 51 | /* |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 397688beed4b..c27cad726765 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
| @@ -408,6 +408,7 @@ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) | |||
| 408 | static void mwait_idle(void) | 408 | static void mwait_idle(void) |
| 409 | { | 409 | { |
| 410 | if (!current_set_polling_and_test()) { | 410 | if (!current_set_polling_and_test()) { |
| 411 | trace_cpu_idle_rcuidle(1, smp_processor_id()); | ||
| 411 | if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) { | 412 | if (this_cpu_has(X86_BUG_CLFLUSH_MONITOR)) { |
| 412 | smp_mb(); /* quirk */ | 413 | smp_mb(); /* quirk */ |
| 413 | clflush((void *)¤t_thread_info()->flags); | 414 | clflush((void *)¤t_thread_info()->flags); |
| @@ -419,6 +420,7 @@ static void mwait_idle(void) | |||
| 419 | __sti_mwait(0, 0); | 420 | __sti_mwait(0, 0); |
| 420 | else | 421 | else |
| 421 | local_irq_enable(); | 422 | local_irq_enable(); |
| 423 | trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, smp_processor_id()); | ||
| 422 | } else { | 424 | } else { |
| 423 | local_irq_enable(); | 425 | local_irq_enable(); |
| 424 | } | 426 | } |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index 206996c1669d..71820c42b6ce 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
| @@ -93,8 +93,15 @@ int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc) | |||
| 93 | COPY(r15); | 93 | COPY(r15); |
| 94 | #endif /* CONFIG_X86_64 */ | 94 | #endif /* CONFIG_X86_64 */ |
| 95 | 95 | ||
| 96 | #ifdef CONFIG_X86_32 | ||
| 96 | COPY_SEG_CPL3(cs); | 97 | COPY_SEG_CPL3(cs); |
| 97 | COPY_SEG_CPL3(ss); | 98 | COPY_SEG_CPL3(ss); |
| 99 | #else /* !CONFIG_X86_32 */ | ||
| 100 | /* Kernel saves and restores only the CS segment register on signals, | ||
| 101 | * which is the bare minimum needed to allow mixed 32/64-bit code. | ||
| 102 | * App's signal handler can save/restore other segments if needed. */ | ||
| 103 | COPY_SEG_CPL3(cs); | ||
| 104 | #endif /* CONFIG_X86_32 */ | ||
| 98 | 105 | ||
| 99 | get_user_ex(tmpflags, &sc->flags); | 106 | get_user_ex(tmpflags, &sc->flags); |
| 100 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); | 107 | regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
| @@ -154,9 +161,8 @@ int setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate, | |||
| 154 | #else /* !CONFIG_X86_32 */ | 161 | #else /* !CONFIG_X86_32 */ |
| 155 | put_user_ex(regs->flags, &sc->flags); | 162 | put_user_ex(regs->flags, &sc->flags); |
| 156 | put_user_ex(regs->cs, &sc->cs); | 163 | put_user_ex(regs->cs, &sc->cs); |
| 157 | put_user_ex(0, &sc->__pad2); | 164 | put_user_ex(0, &sc->gs); |
| 158 | put_user_ex(0, &sc->__pad1); | 165 | put_user_ex(0, &sc->fs); |
| 159 | put_user_ex(regs->ss, &sc->ss); | ||
| 160 | #endif /* CONFIG_X86_32 */ | 166 | #endif /* CONFIG_X86_32 */ |
| 161 | 167 | ||
| 162 | put_user_ex(fpstate, &sc->fpstate); | 168 | put_user_ex(fpstate, &sc->fpstate); |
| @@ -451,19 +457,9 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, | |||
| 451 | 457 | ||
| 452 | regs->sp = (unsigned long)frame; | 458 | regs->sp = (unsigned long)frame; |
| 453 | 459 | ||
| 454 | /* | 460 | /* Set up the CS register to run signal handlers in 64-bit mode, |
| 455 | * Set up the CS and SS registers to run signal handlers in | 461 | even if the handler happens to be interrupting 32-bit code. */ |
| 456 | * 64-bit mode, even if the handler happens to be interrupting | ||
| 457 | * 32-bit or 16-bit code. | ||
| 458 | * | ||
| 459 | * SS is subtle. In 64-bit mode, we don't need any particular | ||
| 460 | * SS descriptor, but we do need SS to be valid. It's possible | ||
| 461 | * that the old SS is entirely bogus -- this can happen if the | ||
| 462 | * signal we're trying to deliver is #GP or #SS caused by a bad | ||
| 463 | * SS value. | ||
| 464 | */ | ||
| 465 | regs->cs = __USER_CS; | 462 | regs->cs = __USER_CS; |
| 466 | regs->ss = __USER_DS; | ||
| 467 | 463 | ||
| 468 | return 0; | 464 | return 0; |
| 469 | } | 465 | } |
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c index 6273324186ac..0ccb53a9fcd9 100644 --- a/arch/x86/kernel/step.c +++ b/arch/x86/kernel/step.c | |||
| @@ -28,11 +28,11 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re | |||
| 28 | struct desc_struct *desc; | 28 | struct desc_struct *desc; |
| 29 | unsigned long base; | 29 | unsigned long base; |
| 30 | 30 | ||
| 31 | seg &= ~7UL; | 31 | seg >>= 3; |
| 32 | 32 | ||
| 33 | mutex_lock(&child->mm->context.lock); | 33 | mutex_lock(&child->mm->context.lock); |
| 34 | if (unlikely(!child->mm->context.ldt || | 34 | if (unlikely(!child->mm->context.ldt || |
| 35 | (seg >> 3) >= child->mm->context.ldt->size)) | 35 | seg >= child->mm->context.ldt->size)) |
| 36 | addr = -1L; /* bogus selector, access would fault */ | 36 | addr = -1L; /* bogus selector, access would fault */ |
| 37 | else { | 37 | else { |
| 38 | desc = &child->mm->context.ldt->entries[seg]; | 38 | desc = &child->mm->context.ldt->entries[seg]; |
diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c index dc0a84a6f309..9e8bf13572e6 100644 --- a/arch/x86/kvm/mtrr.c +++ b/arch/x86/kvm/mtrr.c | |||
| @@ -672,16 +672,16 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) | |||
| 672 | if (iter.mtrr_disabled) | 672 | if (iter.mtrr_disabled) |
| 673 | return mtrr_disabled_type(); | 673 | return mtrr_disabled_type(); |
| 674 | 674 | ||
| 675 | /* not contained in any MTRRs. */ | ||
| 676 | if (type == -1) | ||
| 677 | return mtrr_default_type(mtrr_state); | ||
| 678 | |||
| 675 | /* | 679 | /* |
| 676 | * We just check one page, partially covered by MTRRs is | 680 | * We just check one page, partially covered by MTRRs is |
| 677 | * impossible. | 681 | * impossible. |
| 678 | */ | 682 | */ |
| 679 | WARN_ON(iter.partial_map); | 683 | WARN_ON(iter.partial_map); |
| 680 | 684 | ||
| 681 | /* not contained in any MTRRs. */ | ||
| 682 | if (type == -1) | ||
| 683 | return mtrr_default_type(mtrr_state); | ||
| 684 | |||
| 685 | return type; | 685 | return type; |
| 686 | } | 686 | } |
| 687 | EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type); | 687 | EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5ef2560075bf..8f0f6eca69da 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -2105,7 +2105,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
| 2105 | if (guest_cpuid_has_tsc_adjust(vcpu)) { | 2105 | if (guest_cpuid_has_tsc_adjust(vcpu)) { |
| 2106 | if (!msr_info->host_initiated) { | 2106 | if (!msr_info->host_initiated) { |
| 2107 | s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr; | 2107 | s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr; |
| 2108 | kvm_x86_ops->adjust_tsc_offset(vcpu, adj, true); | 2108 | adjust_tsc_offset_guest(vcpu, adj); |
| 2109 | } | 2109 | } |
| 2110 | vcpu->arch.ia32_tsc_adjust_msr = data; | 2110 | vcpu->arch.ia32_tsc_adjust_msr = data; |
| 2111 | } | 2111 | } |
| @@ -6327,6 +6327,7 @@ static void process_smi_save_state_64(struct kvm_vcpu *vcpu, char *buf) | |||
| 6327 | static void process_smi(struct kvm_vcpu *vcpu) | 6327 | static void process_smi(struct kvm_vcpu *vcpu) |
| 6328 | { | 6328 | { |
| 6329 | struct kvm_segment cs, ds; | 6329 | struct kvm_segment cs, ds; |
| 6330 | struct desc_ptr dt; | ||
| 6330 | char buf[512]; | 6331 | char buf[512]; |
| 6331 | u32 cr0; | 6332 | u32 cr0; |
| 6332 | 6333 | ||
| @@ -6359,6 +6360,10 @@ static void process_smi(struct kvm_vcpu *vcpu) | |||
| 6359 | 6360 | ||
| 6360 | kvm_x86_ops->set_cr4(vcpu, 0); | 6361 | kvm_x86_ops->set_cr4(vcpu, 0); |
| 6361 | 6362 | ||
| 6363 | /* Undocumented: IDT limit is set to zero on entry to SMM. */ | ||
| 6364 | dt.address = dt.size = 0; | ||
| 6365 | kvm_x86_ops->set_idt(vcpu, &dt); | ||
| 6366 | |||
| 6362 | __kvm_set_dr(vcpu, 7, DR7_FIXED_1); | 6367 | __kvm_set_dr(vcpu, 7, DR7_FIXED_1); |
| 6363 | 6368 | ||
| 6364 | cs.selector = (vcpu->arch.smbase >> 4) & 0xffff; | 6369 | cs.selector = (vcpu->arch.smbase >> 4) & 0xffff; |
diff --git a/arch/x86/math-emu/fpu_entry.c b/arch/x86/math-emu/fpu_entry.c index f37e84ab49f3..3d8f2e421466 100644 --- a/arch/x86/math-emu/fpu_entry.c +++ b/arch/x86/math-emu/fpu_entry.c | |||
| @@ -29,7 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
| 31 | #include <asm/traps.h> | 31 | #include <asm/traps.h> |
| 32 | #include <asm/desc.h> | ||
| 33 | #include <asm/user.h> | 32 | #include <asm/user.h> |
| 34 | #include <asm/fpu/internal.h> | 33 | #include <asm/fpu/internal.h> |
| 35 | 34 | ||
| @@ -181,7 +180,7 @@ void math_emulate(struct math_emu_info *info) | |||
| 181 | math_abort(FPU_info, SIGILL); | 180 | math_abort(FPU_info, SIGILL); |
| 182 | } | 181 | } |
| 183 | 182 | ||
| 184 | code_descriptor = LDT_DESCRIPTOR(FPU_CS); | 183 | code_descriptor = FPU_get_ldt_descriptor(FPU_CS); |
| 185 | if (SEG_D_SIZE(code_descriptor)) { | 184 | if (SEG_D_SIZE(code_descriptor)) { |
| 186 | /* The above test may be wrong, the book is not clear */ | 185 | /* The above test may be wrong, the book is not clear */ |
| 187 | /* Segmented 32 bit protected mode */ | 186 | /* Segmented 32 bit protected mode */ |
diff --git a/arch/x86/math-emu/fpu_system.h b/arch/x86/math-emu/fpu_system.h index 9ccecb61a4fa..5e044d506b7a 100644 --- a/arch/x86/math-emu/fpu_system.h +++ b/arch/x86/math-emu/fpu_system.h | |||
| @@ -16,9 +16,24 @@ | |||
| 16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
| 18 | 18 | ||
| 19 | /* s is always from a cpu register, and the cpu does bounds checking | 19 | #include <asm/desc.h> |
| 20 | * during register load --> no further bounds checks needed */ | 20 | #include <asm/mmu_context.h> |
| 21 | #define LDT_DESCRIPTOR(s) (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3]) | 21 | |
| 22 | static inline struct desc_struct FPU_get_ldt_descriptor(unsigned seg) | ||
| 23 | { | ||
| 24 | static struct desc_struct zero_desc; | ||
| 25 | struct desc_struct ret = zero_desc; | ||
| 26 | |||
| 27 | #ifdef CONFIG_MODIFY_LDT_SYSCALL | ||
| 28 | seg >>= 3; | ||
| 29 | mutex_lock(¤t->mm->context.lock); | ||
| 30 | if (current->mm->context.ldt && seg < current->mm->context.ldt->size) | ||
| 31 | ret = current->mm->context.ldt->entries[seg]; | ||
| 32 | mutex_unlock(¤t->mm->context.lock); | ||
| 33 | #endif | ||
| 34 | return ret; | ||
| 35 | } | ||
| 36 | |||
| 22 | #define SEG_D_SIZE(x) ((x).b & (3 << 21)) | 37 | #define SEG_D_SIZE(x) ((x).b & (3 << 21)) |
| 23 | #define SEG_G_BIT(x) ((x).b & (1 << 23)) | 38 | #define SEG_G_BIT(x) ((x).b & (1 << 23)) |
| 24 | #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1) | 39 | #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1) |
diff --git a/arch/x86/math-emu/get_address.c b/arch/x86/math-emu/get_address.c index 6ef5e99380f9..8300db71c2a6 100644 --- a/arch/x86/math-emu/get_address.c +++ b/arch/x86/math-emu/get_address.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <linux/stddef.h> | 20 | #include <linux/stddef.h> |
| 21 | 21 | ||
| 22 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
| 23 | #include <asm/desc.h> | ||
| 24 | 23 | ||
| 25 | #include "fpu_system.h" | 24 | #include "fpu_system.h" |
| 26 | #include "exception.h" | 25 | #include "exception.h" |
| @@ -158,7 +157,7 @@ static long pm_address(u_char FPU_modrm, u_char segment, | |||
| 158 | addr->selector = PM_REG_(segment); | 157 | addr->selector = PM_REG_(segment); |
| 159 | } | 158 | } |
| 160 | 159 | ||
| 161 | descriptor = LDT_DESCRIPTOR(PM_REG_(segment)); | 160 | descriptor = FPU_get_ldt_descriptor(addr->selector); |
| 162 | base_address = SEG_BASE_ADDR(descriptor); | 161 | base_address = SEG_BASE_ADDR(descriptor); |
| 163 | address = base_address + offset; | 162 | address = base_address + offset; |
| 164 | limit = base_address | 163 | limit = base_address |
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index e88fda867a33..484145368a24 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig | |||
| @@ -8,7 +8,7 @@ config XEN | |||
| 8 | select PARAVIRT_CLOCK | 8 | select PARAVIRT_CLOCK |
| 9 | select XEN_HAVE_PVMMU | 9 | select XEN_HAVE_PVMMU |
| 10 | depends on X86_64 || (X86_32 && X86_PAE) | 10 | depends on X86_64 || (X86_32 && X86_PAE) |
| 11 | depends on X86_TSC | 11 | depends on X86_LOCAL_APIC && X86_TSC |
| 12 | help | 12 | help |
| 13 | This is the Linux Xen port. Enabling this will allow the | 13 | This is the Linux Xen port. Enabling this will allow the |
| 14 | kernel to boot in a paravirtualized environment under the | 14 | kernel to boot in a paravirtualized environment under the |
| @@ -17,7 +17,7 @@ config XEN | |||
| 17 | config XEN_DOM0 | 17 | config XEN_DOM0 |
| 18 | def_bool y | 18 | def_bool y |
| 19 | depends on XEN && PCI_XEN && SWIOTLB_XEN | 19 | depends on XEN && PCI_XEN && SWIOTLB_XEN |
| 20 | depends on X86_LOCAL_APIC && X86_IO_APIC && ACPI && PCI | 20 | depends on X86_IO_APIC && ACPI && PCI |
| 21 | 21 | ||
| 22 | config XEN_PVHVM | 22 | config XEN_PVHVM |
| 23 | def_bool y | 23 | def_bool y |
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index 7322755f337a..4b6e29ac0968 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile | |||
| @@ -13,13 +13,13 @@ CFLAGS_mmu.o := $(nostackp) | |||
| 13 | obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ | 13 | obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ |
| 14 | time.o xen-asm.o xen-asm_$(BITS).o \ | 14 | time.o xen-asm.o xen-asm_$(BITS).o \ |
| 15 | grant-table.o suspend.o platform-pci-unplug.o \ | 15 | grant-table.o suspend.o platform-pci-unplug.o \ |
| 16 | p2m.o | 16 | p2m.o apic.o |
| 17 | 17 | ||
| 18 | obj-$(CONFIG_EVENT_TRACING) += trace.o | 18 | obj-$(CONFIG_EVENT_TRACING) += trace.o |
| 19 | 19 | ||
| 20 | obj-$(CONFIG_SMP) += smp.o | 20 | obj-$(CONFIG_SMP) += smp.o |
| 21 | obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o | 21 | obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o |
| 22 | obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o | 22 | obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o |
| 23 | obj-$(CONFIG_XEN_DOM0) += apic.o vga.o | 23 | obj-$(CONFIG_XEN_DOM0) += vga.o |
| 24 | obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o | 24 | obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o |
| 25 | obj-$(CONFIG_XEN_EFI) += efi.o | 25 | obj-$(CONFIG_XEN_EFI) += efi.o |
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index c20fe29e65f4..2292721b1d10 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
| @@ -101,17 +101,15 @@ struct dom0_vga_console_info; | |||
| 101 | 101 | ||
| 102 | #ifdef CONFIG_XEN_DOM0 | 102 | #ifdef CONFIG_XEN_DOM0 |
| 103 | void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); | 103 | void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); |
| 104 | void __init xen_init_apic(void); | ||
| 105 | #else | 104 | #else |
| 106 | static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, | 105 | static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, |
| 107 | size_t size) | 106 | size_t size) |
| 108 | { | 107 | { |
| 109 | } | 108 | } |
| 110 | static inline void __init xen_init_apic(void) | ||
| 111 | { | ||
| 112 | } | ||
| 113 | #endif | 109 | #endif |
| 114 | 110 | ||
| 111 | void __init xen_init_apic(void); | ||
| 112 | |||
| 115 | #ifdef CONFIG_XEN_EFI | 113 | #ifdef CONFIG_XEN_EFI |
| 116 | extern void xen_efi_init(void); | 114 | extern void xen_efi_init(void); |
| 117 | #else | 115 | #else |
diff --git a/block/blk-settings.c b/block/blk-settings.c index 12600bfffca9..e0057d035200 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
| @@ -241,8 +241,8 @@ EXPORT_SYMBOL(blk_queue_bounce_limit); | |||
| 241 | * Description: | 241 | * Description: |
| 242 | * Enables a low level driver to set a hard upper limit, | 242 | * Enables a low level driver to set a hard upper limit, |
| 243 | * max_hw_sectors, on the size of requests. max_hw_sectors is set by | 243 | * max_hw_sectors, on the size of requests. max_hw_sectors is set by |
| 244 | * the device driver based upon the combined capabilities of I/O | 244 | * the device driver based upon the capabilities of the I/O |
| 245 | * controller and storage device. | 245 | * controller. |
| 246 | * | 246 | * |
| 247 | * max_sectors is a soft limit imposed by the block layer for | 247 | * max_sectors is a soft limit imposed by the block layer for |
| 248 | * filesystem type requests. This value can be overridden on a | 248 | * filesystem type requests. This value can be overridden on a |
diff --git a/crypto/authencesn.c b/crypto/authencesn.c index a3da6770bc9e..b8efe36ce114 100644 --- a/crypto/authencesn.c +++ b/crypto/authencesn.c | |||
| @@ -393,8 +393,6 @@ static int crypto_authenc_esn_genicv(struct aead_request *req, u8 *iv, | |||
| 393 | struct scatterlist *cipher = areq_ctx->cipher; | 393 | struct scatterlist *cipher = areq_ctx->cipher; |
| 394 | struct scatterlist *hsg = areq_ctx->hsg; | 394 | struct scatterlist *hsg = areq_ctx->hsg; |
| 395 | struct scatterlist *tsg = areq_ctx->tsg; | 395 | struct scatterlist *tsg = areq_ctx->tsg; |
| 396 | struct scatterlist *assoc1; | ||
| 397 | struct scatterlist *assoc2; | ||
| 398 | unsigned int ivsize = crypto_aead_ivsize(authenc_esn); | 396 | unsigned int ivsize = crypto_aead_ivsize(authenc_esn); |
| 399 | unsigned int cryptlen = req->cryptlen; | 397 | unsigned int cryptlen = req->cryptlen; |
| 400 | struct page *dstp; | 398 | struct page *dstp; |
| @@ -412,27 +410,19 @@ static int crypto_authenc_esn_genicv(struct aead_request *req, u8 *iv, | |||
| 412 | cryptlen += ivsize; | 410 | cryptlen += ivsize; |
| 413 | } | 411 | } |
| 414 | 412 | ||
| 415 | if (sg_is_last(assoc)) | 413 | if (assoc->length < 12) |
| 416 | return -EINVAL; | ||
| 417 | |||
| 418 | assoc1 = assoc + 1; | ||
| 419 | if (sg_is_last(assoc1)) | ||
| 420 | return -EINVAL; | ||
| 421 | |||
| 422 | assoc2 = assoc + 2; | ||
| 423 | if (!sg_is_last(assoc2)) | ||
| 424 | return -EINVAL; | 414 | return -EINVAL; |
| 425 | 415 | ||
| 426 | sg_init_table(hsg, 2); | 416 | sg_init_table(hsg, 2); |
| 427 | sg_set_page(hsg, sg_page(assoc), assoc->length, assoc->offset); | 417 | sg_set_page(hsg, sg_page(assoc), 4, assoc->offset); |
| 428 | sg_set_page(hsg + 1, sg_page(assoc2), assoc2->length, assoc2->offset); | 418 | sg_set_page(hsg + 1, sg_page(assoc), 4, assoc->offset + 8); |
| 429 | 419 | ||
| 430 | sg_init_table(tsg, 1); | 420 | sg_init_table(tsg, 1); |
| 431 | sg_set_page(tsg, sg_page(assoc1), assoc1->length, assoc1->offset); | 421 | sg_set_page(tsg, sg_page(assoc), 4, assoc->offset + 4); |
| 432 | 422 | ||
| 433 | areq_ctx->cryptlen = cryptlen; | 423 | areq_ctx->cryptlen = cryptlen; |
| 434 | areq_ctx->headlen = assoc->length + assoc2->length; | 424 | areq_ctx->headlen = 8; |
| 435 | areq_ctx->trailen = assoc1->length; | 425 | areq_ctx->trailen = 4; |
| 436 | areq_ctx->sg = dst; | 426 | areq_ctx->sg = dst; |
| 437 | 427 | ||
| 438 | areq_ctx->complete = authenc_esn_geniv_ahash_done; | 428 | areq_ctx->complete = authenc_esn_geniv_ahash_done; |
| @@ -563,8 +553,6 @@ static int crypto_authenc_esn_iverify(struct aead_request *req, u8 *iv, | |||
| 563 | struct scatterlist *cipher = areq_ctx->cipher; | 553 | struct scatterlist *cipher = areq_ctx->cipher; |
| 564 | struct scatterlist *hsg = areq_ctx->hsg; | 554 | struct scatterlist *hsg = areq_ctx->hsg; |
| 565 | struct scatterlist *tsg = areq_ctx->tsg; | 555 | struct scatterlist *tsg = areq_ctx->tsg; |
| 566 | struct scatterlist *assoc1; | ||
| 567 | struct scatterlist *assoc2; | ||
| 568 | unsigned int ivsize = crypto_aead_ivsize(authenc_esn); | 556 | unsigned int ivsize = crypto_aead_ivsize(authenc_esn); |
| 569 | struct page *srcp; | 557 | struct page *srcp; |
| 570 | u8 *vsrc; | 558 | u8 *vsrc; |
| @@ -580,27 +568,19 @@ static int crypto_authenc_esn_iverify(struct aead_request *req, u8 *iv, | |||
| 580 | cryptlen += ivsize; | 568 | cryptlen += ivsize; |
| 581 | } | 569 | } |
| 582 | 570 | ||
| 583 | if (sg_is_last(assoc)) | 571 | if (assoc->length < 12) |
| 584 | return -EINVAL; | ||
| 585 | |||
| 586 | assoc1 = assoc + 1; | ||
| 587 | if (sg_is_last(assoc1)) | ||
| 588 | return -EINVAL; | ||
| 589 | |||
| 590 | assoc2 = assoc + 2; | ||
| 591 | if (!sg_is_last(assoc2)) | ||
| 592 | return -EINVAL; | 572 | return -EINVAL; |
| 593 | 573 | ||
| 594 | sg_init_table(hsg, 2); | 574 | sg_init_table(hsg, 2); |
| 595 | sg_set_page(hsg, sg_page(assoc), assoc->length, assoc->offset); | 575 | sg_set_page(hsg, sg_page(assoc), 4, assoc->offset); |
| 596 | sg_set_page(hsg + 1, sg_page(assoc2), assoc2->length, assoc2->offset); | 576 | sg_set_page(hsg + 1, sg_page(assoc), 4, assoc->offset + 8); |
| 597 | 577 | ||
| 598 | sg_init_table(tsg, 1); | 578 | sg_init_table(tsg, 1); |
| 599 | sg_set_page(tsg, sg_page(assoc1), assoc1->length, assoc1->offset); | 579 | sg_set_page(tsg, sg_page(assoc), 4, assoc->offset + 4); |
| 600 | 580 | ||
| 601 | areq_ctx->cryptlen = cryptlen; | 581 | areq_ctx->cryptlen = cryptlen; |
| 602 | areq_ctx->headlen = assoc->length + assoc2->length; | 582 | areq_ctx->headlen = 8; |
| 603 | areq_ctx->trailen = assoc1->length; | 583 | areq_ctx->trailen = 4; |
| 604 | areq_ctx->sg = src; | 584 | areq_ctx->sg = src; |
| 605 | 585 | ||
| 606 | areq_ctx->complete = authenc_esn_verify_ahash_done; | 586 | areq_ctx->complete = authenc_esn_verify_ahash_done; |
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 628a42c41ab1..cf0fd96a7602 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c | |||
| @@ -702,11 +702,11 @@ static ssize_t flags_show(struct device *dev, | |||
| 702 | u16 flags = to_nfit_memdev(dev)->flags; | 702 | u16 flags = to_nfit_memdev(dev)->flags; |
| 703 | 703 | ||
| 704 | return sprintf(buf, "%s%s%s%s%s\n", | 704 | return sprintf(buf, "%s%s%s%s%s\n", |
| 705 | flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save " : "", | 705 | flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save_fail " : "", |
| 706 | flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore " : "", | 706 | flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore_fail " : "", |
| 707 | flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush " : "", | 707 | flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush_fail " : "", |
| 708 | flags & ACPI_NFIT_MEM_ARMED ? "arm " : "", | 708 | flags & ACPI_NFIT_MEM_ARMED ? "not_armed " : "", |
| 709 | flags & ACPI_NFIT_MEM_HEALTH_OBSERVED ? "smart " : ""); | 709 | flags & ACPI_NFIT_MEM_HEALTH_OBSERVED ? "smart_event " : ""); |
| 710 | } | 710 | } |
| 711 | static DEVICE_ATTR_RO(flags); | 711 | static DEVICE_ATTR_RO(flags); |
| 712 | 712 | ||
| @@ -849,12 +849,12 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) | |||
| 849 | if ((mem_flags & ACPI_NFIT_MEM_FAILED_MASK) == 0) | 849 | if ((mem_flags & ACPI_NFIT_MEM_FAILED_MASK) == 0) |
| 850 | continue; | 850 | continue; |
| 851 | 851 | ||
| 852 | dev_info(acpi_desc->dev, "%s: failed: %s%s%s%s\n", | 852 | dev_info(acpi_desc->dev, "%s flags:%s%s%s%s\n", |
| 853 | nvdimm_name(nvdimm), | 853 | nvdimm_name(nvdimm), |
| 854 | mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save " : "", | 854 | mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? " save_fail" : "", |
| 855 | mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore " : "", | 855 | mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? " restore_fail":"", |
| 856 | mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush " : "", | 856 | mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? " flush_fail" : "", |
| 857 | mem_flags & ACPI_NFIT_MEM_ARMED ? "arm " : ""); | 857 | mem_flags & ACPI_NFIT_MEM_ARMED ? " not_armed" : ""); |
| 858 | 858 | ||
| 859 | } | 859 | } |
| 860 | 860 | ||
| @@ -1024,7 +1024,7 @@ static void wmb_blk(struct nfit_blk *nfit_blk) | |||
| 1024 | wmb_pmem(); | 1024 | wmb_pmem(); |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) | 1027 | static u32 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) |
| 1028 | { | 1028 | { |
| 1029 | struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; | 1029 | struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; |
| 1030 | u64 offset = nfit_blk->stat_offset + mmio->size * bw; | 1030 | u64 offset = nfit_blk->stat_offset + mmio->size * bw; |
| @@ -1032,7 +1032,7 @@ static u64 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) | |||
| 1032 | if (mmio->num_lines) | 1032 | if (mmio->num_lines) |
| 1033 | offset = to_interleave_offset(offset, mmio); | 1033 | offset = to_interleave_offset(offset, mmio); |
| 1034 | 1034 | ||
| 1035 | return readq(mmio->base + offset); | 1035 | return readl(mmio->base + offset); |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, | 1038 | static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, |
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 815f75ef2411..2922f1f252d5 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
| 33 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
| 34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
| 35 | #include <linux/workqueue.h> | ||
| 35 | #include <acpi/video.h> | 36 | #include <acpi/video.h> |
| 36 | 37 | ||
| 37 | ACPI_MODULE_NAME("video"); | 38 | ACPI_MODULE_NAME("video"); |
| @@ -41,6 +42,7 @@ void acpi_video_unregister_backlight(void); | |||
| 41 | 42 | ||
| 42 | static bool backlight_notifier_registered; | 43 | static bool backlight_notifier_registered; |
| 43 | static struct notifier_block backlight_nb; | 44 | static struct notifier_block backlight_nb; |
| 45 | static struct work_struct backlight_notify_work; | ||
| 44 | 46 | ||
| 45 | static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; | 47 | static enum acpi_backlight_type acpi_backlight_cmdline = acpi_backlight_undef; |
| 46 | static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; | 48 | static enum acpi_backlight_type acpi_backlight_dmi = acpi_backlight_undef; |
| @@ -262,6 +264,13 @@ static const struct dmi_system_id video_detect_dmi_table[] = { | |||
| 262 | { }, | 264 | { }, |
| 263 | }; | 265 | }; |
| 264 | 266 | ||
| 267 | /* This uses a workqueue to avoid various locking ordering issues */ | ||
| 268 | static void acpi_video_backlight_notify_work(struct work_struct *work) | ||
| 269 | { | ||
| 270 | if (acpi_video_get_backlight_type() != acpi_backlight_video) | ||
| 271 | acpi_video_unregister_backlight(); | ||
| 272 | } | ||
| 273 | |||
| 265 | static int acpi_video_backlight_notify(struct notifier_block *nb, | 274 | static int acpi_video_backlight_notify(struct notifier_block *nb, |
| 266 | unsigned long val, void *bd) | 275 | unsigned long val, void *bd) |
| 267 | { | 276 | { |
| @@ -269,9 +278,8 @@ static int acpi_video_backlight_notify(struct notifier_block *nb, | |||
| 269 | 278 | ||
| 270 | /* A raw bl registering may change video -> native */ | 279 | /* A raw bl registering may change video -> native */ |
| 271 | if (backlight->props.type == BACKLIGHT_RAW && | 280 | if (backlight->props.type == BACKLIGHT_RAW && |
| 272 | val == BACKLIGHT_REGISTERED && | 281 | val == BACKLIGHT_REGISTERED) |
| 273 | acpi_video_get_backlight_type() != acpi_backlight_video) | 282 | schedule_work(&backlight_notify_work); |
| 274 | acpi_video_unregister_backlight(); | ||
| 275 | 283 | ||
| 276 | return NOTIFY_OK; | 284 | return NOTIFY_OK; |
| 277 | } | 285 | } |
| @@ -304,6 +312,8 @@ enum acpi_backlight_type acpi_video_get_backlight_type(void) | |||
| 304 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 312 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
| 305 | ACPI_UINT32_MAX, find_video, NULL, | 313 | ACPI_UINT32_MAX, find_video, NULL, |
| 306 | &video_caps, NULL); | 314 | &video_caps, NULL); |
| 315 | INIT_WORK(&backlight_notify_work, | ||
| 316 | acpi_video_backlight_notify_work); | ||
| 307 | backlight_nb.notifier_call = acpi_video_backlight_notify; | 317 | backlight_nb.notifier_call = acpi_video_backlight_notify; |
| 308 | backlight_nb.priority = 0; | 318 | backlight_nb.priority = 0; |
| 309 | if (backlight_register_notifier(&backlight_nb) == 0) | 319 | if (backlight_register_notifier(&backlight_nb) == 0) |
diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c index ce1e3a885981..14b7305d2ba0 100644 --- a/drivers/ata/ahci_brcmstb.c +++ b/drivers/ata/ahci_brcmstb.c | |||
| @@ -92,7 +92,7 @@ static inline u32 brcm_sata_readreg(void __iomem *addr) | |||
| 92 | * Other architectures (e.g., ARM) either do not support big endian, or | 92 | * Other architectures (e.g., ARM) either do not support big endian, or |
| 93 | * else leave I/O in little endian mode. | 93 | * else leave I/O in little endian mode. |
| 94 | */ | 94 | */ |
| 95 | if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) | 95 | if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) |
| 96 | return __raw_readl(addr); | 96 | return __raw_readl(addr); |
| 97 | else | 97 | else |
| 98 | return readl_relaxed(addr); | 98 | return readl_relaxed(addr); |
| @@ -101,7 +101,7 @@ static inline u32 brcm_sata_readreg(void __iomem *addr) | |||
| 101 | static inline void brcm_sata_writereg(u32 val, void __iomem *addr) | 101 | static inline void brcm_sata_writereg(u32 val, void __iomem *addr) |
| 102 | { | 102 | { |
| 103 | /* See brcm_sata_readreg() comments */ | 103 | /* See brcm_sata_readreg() comments */ |
| 104 | if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN)) | 104 | if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) |
| 105 | __raw_writel(val, addr); | 105 | __raw_writel(val, addr); |
| 106 | else | 106 | else |
| 107 | writel_relaxed(val, addr); | 107 | writel_relaxed(val, addr); |
| @@ -209,6 +209,7 @@ static void brcm_sata_init(struct brcm_ahci_priv *priv) | |||
| 209 | priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL); | 209 | priv->top_ctrl + SATA_TOP_CTRL_BUS_CTRL); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | #ifdef CONFIG_PM_SLEEP | ||
| 212 | static int brcm_ahci_suspend(struct device *dev) | 213 | static int brcm_ahci_suspend(struct device *dev) |
| 213 | { | 214 | { |
| 214 | struct ata_host *host = dev_get_drvdata(dev); | 215 | struct ata_host *host = dev_get_drvdata(dev); |
| @@ -231,6 +232,7 @@ static int brcm_ahci_resume(struct device *dev) | |||
| 231 | brcm_sata_phys_enable(priv); | 232 | brcm_sata_phys_enable(priv); |
| 232 | return ahci_platform_resume(dev); | 233 | return ahci_platform_resume(dev); |
| 233 | } | 234 | } |
| 235 | #endif | ||
| 234 | 236 | ||
| 235 | static struct scsi_host_template ahci_platform_sht = { | 237 | static struct scsi_host_template ahci_platform_sht = { |
| 236 | AHCI_SHT(DRV_NAME), | 238 | AHCI_SHT(DRV_NAME), |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index db5d9f79a247..19bcb80b2031 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -694,11 +694,11 @@ static int ata_rwcmd_protocol(struct ata_taskfile *tf, struct ata_device *dev) | |||
| 694 | * RETURNS: | 694 | * RETURNS: |
| 695 | * Block address read from @tf. | 695 | * Block address read from @tf. |
| 696 | */ | 696 | */ |
| 697 | u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) | 697 | u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) |
| 698 | { | 698 | { |
| 699 | u64 block = 0; | 699 | u64 block = 0; |
| 700 | 700 | ||
| 701 | if (!dev || tf->flags & ATA_TFLAG_LBA) { | 701 | if (tf->flags & ATA_TFLAG_LBA) { |
| 702 | if (tf->flags & ATA_TFLAG_LBA48) { | 702 | if (tf->flags & ATA_TFLAG_LBA48) { |
| 703 | block |= (u64)tf->hob_lbah << 40; | 703 | block |= (u64)tf->hob_lbah << 40; |
| 704 | block |= (u64)tf->hob_lbam << 32; | 704 | block |= (u64)tf->hob_lbam << 32; |
| @@ -2147,24 +2147,6 @@ static int ata_dev_config_ncq(struct ata_device *dev, | |||
| 2147 | return 0; | 2147 | return 0; |
| 2148 | } | 2148 | } |
| 2149 | 2149 | ||
| 2150 | static void ata_dev_config_sense_reporting(struct ata_device *dev) | ||
| 2151 | { | ||
| 2152 | unsigned int err_mask; | ||
| 2153 | |||
| 2154 | if (!ata_id_has_sense_reporting(dev->id)) | ||
| 2155 | return; | ||
| 2156 | |||
| 2157 | if (ata_id_sense_reporting_enabled(dev->id)) | ||
| 2158 | return; | ||
| 2159 | |||
| 2160 | err_mask = ata_dev_set_feature(dev, SETFEATURE_SENSE_DATA, 0x1); | ||
| 2161 | if (err_mask) { | ||
| 2162 | ata_dev_dbg(dev, | ||
| 2163 | "failed to enable Sense Data Reporting, Emask 0x%x\n", | ||
| 2164 | err_mask); | ||
| 2165 | } | ||
| 2166 | } | ||
| 2167 | |||
| 2168 | /** | 2150 | /** |
| 2169 | * ata_dev_configure - Configure the specified ATA/ATAPI device | 2151 | * ata_dev_configure - Configure the specified ATA/ATAPI device |
| 2170 | * @dev: Target device to configure | 2152 | * @dev: Target device to configure |
| @@ -2387,7 +2369,7 @@ int ata_dev_configure(struct ata_device *dev) | |||
| 2387 | dev->devslp_timing[i] = sata_setting[j]; | 2369 | dev->devslp_timing[i] = sata_setting[j]; |
| 2388 | } | 2370 | } |
| 2389 | } | 2371 | } |
| 2390 | ata_dev_config_sense_reporting(dev); | 2372 | |
| 2391 | dev->cdb_len = 16; | 2373 | dev->cdb_len = 16; |
| 2392 | } | 2374 | } |
| 2393 | 2375 | ||
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 7465031a893c..cb0508af1459 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -1592,8 +1592,6 @@ static int ata_eh_read_log_10h(struct ata_device *dev, | |||
| 1592 | tf->hob_lbah = buf[10]; | 1592 | tf->hob_lbah = buf[10]; |
| 1593 | tf->nsect = buf[12]; | 1593 | tf->nsect = buf[12]; |
| 1594 | tf->hob_nsect = buf[13]; | 1594 | tf->hob_nsect = buf[13]; |
| 1595 | if (ata_id_has_ncq_autosense(dev->id)) | ||
| 1596 | tf->auxiliary = buf[14] << 16 | buf[15] << 8 | buf[16]; | ||
| 1597 | 1595 | ||
| 1598 | return 0; | 1596 | return 0; |
| 1599 | } | 1597 | } |
| @@ -1630,70 +1628,6 @@ unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key) | |||
| 1630 | } | 1628 | } |
| 1631 | 1629 | ||
| 1632 | /** | 1630 | /** |
| 1633 | * ata_eh_request_sense - perform REQUEST_SENSE_DATA_EXT | ||
| 1634 | * @dev: device to perform REQUEST_SENSE_SENSE_DATA_EXT to | ||
| 1635 | * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) | ||
| 1636 | * @dfl_sense_key: default sense key to use | ||
| 1637 | * | ||
| 1638 | * Perform REQUEST_SENSE_DATA_EXT after the device reported CHECK | ||
| 1639 | * SENSE. This function is EH helper. | ||
| 1640 | * | ||
| 1641 | * LOCKING: | ||
| 1642 | * Kernel thread context (may sleep). | ||
| 1643 | * | ||
| 1644 | * RETURNS: | ||
| 1645 | * encoded sense data on success, 0 on failure or if sense data | ||
| 1646 | * is not available. | ||
| 1647 | */ | ||
| 1648 | static u32 ata_eh_request_sense(struct ata_queued_cmd *qc, | ||
| 1649 | struct scsi_cmnd *cmd) | ||
| 1650 | { | ||
| 1651 | struct ata_device *dev = qc->dev; | ||
| 1652 | struct ata_taskfile tf; | ||
| 1653 | unsigned int err_mask; | ||
| 1654 | |||
| 1655 | if (!cmd) | ||
| 1656 | return 0; | ||
| 1657 | |||
| 1658 | DPRINTK("ATA request sense\n"); | ||
| 1659 | ata_dev_warn(dev, "request sense\n"); | ||
| 1660 | if (!ata_id_sense_reporting_enabled(dev->id)) { | ||
| 1661 | ata_dev_warn(qc->dev, "sense data reporting disabled\n"); | ||
| 1662 | return 0; | ||
| 1663 | } | ||
| 1664 | ata_tf_init(dev, &tf); | ||
| 1665 | |||
| 1666 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | ||
| 1667 | tf.flags |= ATA_TFLAG_LBA | ATA_TFLAG_LBA48; | ||
| 1668 | tf.command = ATA_CMD_REQ_SENSE_DATA; | ||
| 1669 | tf.protocol = ATA_PROT_NODATA; | ||
| 1670 | |||
| 1671 | err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); | ||
| 1672 | /* | ||
| 1673 | * ACS-4 states: | ||
| 1674 | * The device may set the SENSE DATA AVAILABLE bit to one in the | ||
| 1675 | * STATUS field and clear the ERROR bit to zero in the STATUS field | ||
| 1676 | * to indicate that the command returned completion without an error | ||
| 1677 | * and the sense data described in table 306 is available. | ||
| 1678 | * | ||
| 1679 | * IOW the 'ATA_SENSE' bit might not be set even though valid | ||
| 1680 | * sense data is available. | ||
| 1681 | * So check for both. | ||
| 1682 | */ | ||
| 1683 | if ((tf.command & ATA_SENSE) || | ||
| 1684 | tf.lbah != 0 || tf.lbam != 0 || tf.lbal != 0) { | ||
| 1685 | ata_scsi_set_sense(cmd, tf.lbah, tf.lbam, tf.lbal); | ||
| 1686 | qc->flags |= ATA_QCFLAG_SENSE_VALID; | ||
| 1687 | ata_dev_warn(dev, "sense data %02x/%02x/%02x\n", | ||
| 1688 | tf.lbah, tf.lbam, tf.lbal); | ||
| 1689 | } else { | ||
| 1690 | ata_dev_warn(dev, "request sense failed stat %02x emask %x\n", | ||
| 1691 | tf.command, err_mask); | ||
| 1692 | } | ||
| 1693 | return err_mask; | ||
| 1694 | } | ||
| 1695 | |||
| 1696 | /** | ||
| 1697 | * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE | 1631 | * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE |
| 1698 | * @dev: device to perform REQUEST_SENSE to | 1632 | * @dev: device to perform REQUEST_SENSE to |
| 1699 | * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) | 1633 | * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) |
| @@ -1855,19 +1789,6 @@ void ata_eh_analyze_ncq_error(struct ata_link *link) | |||
| 1855 | memcpy(&qc->result_tf, &tf, sizeof(tf)); | 1789 | memcpy(&qc->result_tf, &tf, sizeof(tf)); |
| 1856 | qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; | 1790 | qc->result_tf.flags = ATA_TFLAG_ISADDR | ATA_TFLAG_LBA | ATA_TFLAG_LBA48; |
| 1857 | qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; | 1791 | qc->err_mask |= AC_ERR_DEV | AC_ERR_NCQ; |
| 1858 | if (qc->result_tf.auxiliary) { | ||
| 1859 | char sense_key, asc, ascq; | ||
| 1860 | |||
| 1861 | sense_key = (qc->result_tf.auxiliary >> 16) & 0xff; | ||
| 1862 | asc = (qc->result_tf.auxiliary >> 8) & 0xff; | ||
| 1863 | ascq = qc->result_tf.auxiliary & 0xff; | ||
| 1864 | ata_dev_dbg(dev, "NCQ Autosense %02x/%02x/%02x\n", | ||
| 1865 | sense_key, asc, ascq); | ||
| 1866 | ata_scsi_set_sense(qc->scsicmd, sense_key, asc, ascq); | ||
| 1867 | ata_scsi_set_sense_information(qc->scsicmd, &qc->result_tf); | ||
| 1868 | qc->flags |= ATA_QCFLAG_SENSE_VALID; | ||
| 1869 | } | ||
| 1870 | |||
| 1871 | ehc->i.err_mask &= ~AC_ERR_DEV; | 1792 | ehc->i.err_mask &= ~AC_ERR_DEV; |
| 1872 | } | 1793 | } |
| 1873 | 1794 | ||
| @@ -1897,27 +1818,6 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
| 1897 | return ATA_EH_RESET; | 1818 | return ATA_EH_RESET; |
| 1898 | } | 1819 | } |
| 1899 | 1820 | ||
| 1900 | /* | ||
| 1901 | * Sense data reporting does not work if the | ||
| 1902 | * device fault bit is set. | ||
| 1903 | */ | ||
| 1904 | if ((stat & ATA_SENSE) && !(stat & ATA_DF) && | ||
| 1905 | !(qc->flags & ATA_QCFLAG_SENSE_VALID)) { | ||
| 1906 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { | ||
| 1907 | tmp = ata_eh_request_sense(qc, qc->scsicmd); | ||
| 1908 | if (tmp) | ||
| 1909 | qc->err_mask |= tmp; | ||
| 1910 | else | ||
| 1911 | ata_scsi_set_sense_information(qc->scsicmd, tf); | ||
| 1912 | } else { | ||
| 1913 | ata_dev_warn(qc->dev, "sense data available but port frozen\n"); | ||
| 1914 | } | ||
| 1915 | } | ||
| 1916 | |||
| 1917 | /* Set by NCQ autosense or request sense above */ | ||
| 1918 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) | ||
| 1919 | return 0; | ||
| 1920 | |||
| 1921 | if (stat & (ATA_ERR | ATA_DF)) | 1821 | if (stat & (ATA_ERR | ATA_DF)) |
| 1922 | qc->err_mask |= AC_ERR_DEV; | 1822 | qc->err_mask |= AC_ERR_DEV; |
| 1923 | else | 1823 | else |
| @@ -2661,15 +2561,14 @@ static void ata_eh_link_report(struct ata_link *link) | |||
| 2661 | 2561 | ||
| 2662 | #ifdef CONFIG_ATA_VERBOSE_ERROR | 2562 | #ifdef CONFIG_ATA_VERBOSE_ERROR |
| 2663 | if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | | 2563 | if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | |
| 2664 | ATA_SENSE | ATA_ERR)) { | 2564 | ATA_ERR)) { |
| 2665 | if (res->command & ATA_BUSY) | 2565 | if (res->command & ATA_BUSY) |
| 2666 | ata_dev_err(qc->dev, "status: { Busy }\n"); | 2566 | ata_dev_err(qc->dev, "status: { Busy }\n"); |
| 2667 | else | 2567 | else |
| 2668 | ata_dev_err(qc->dev, "status: { %s%s%s%s%s}\n", | 2568 | ata_dev_err(qc->dev, "status: { %s%s%s%s}\n", |
| 2669 | res->command & ATA_DRDY ? "DRDY " : "", | 2569 | res->command & ATA_DRDY ? "DRDY " : "", |
| 2670 | res->command & ATA_DF ? "DF " : "", | 2570 | res->command & ATA_DF ? "DF " : "", |
| 2671 | res->command & ATA_DRQ ? "DRQ " : "", | 2571 | res->command & ATA_DRQ ? "DRQ " : "", |
| 2672 | res->command & ATA_SENSE ? "SENSE " : "", | ||
| 2673 | res->command & ATA_ERR ? "ERR " : ""); | 2572 | res->command & ATA_ERR ? "ERR " : ""); |
| 2674 | } | 2573 | } |
| 2675 | 2574 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 641a61a59e89..0d7f0da3a269 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -270,28 +270,13 @@ DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR, | |||
| 270 | ata_scsi_park_show, ata_scsi_park_store); | 270 | ata_scsi_park_show, ata_scsi_park_store); |
| 271 | EXPORT_SYMBOL_GPL(dev_attr_unload_heads); | 271 | EXPORT_SYMBOL_GPL(dev_attr_unload_heads); |
| 272 | 272 | ||
| 273 | void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) | 273 | static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) |
| 274 | { | 274 | { |
| 275 | if (!cmd) | ||
| 276 | return; | ||
| 277 | |||
| 278 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; | 275 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; |
| 279 | 276 | ||
| 280 | scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); | 277 | scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); |
| 281 | } | 278 | } |
| 282 | 279 | ||
| 283 | void ata_scsi_set_sense_information(struct scsi_cmnd *cmd, | ||
| 284 | const struct ata_taskfile *tf) | ||
| 285 | { | ||
| 286 | u64 information; | ||
| 287 | |||
| 288 | if (!cmd) | ||
| 289 | return; | ||
| 290 | |||
| 291 | information = ata_tf_read_block(tf, NULL); | ||
| 292 | scsi_set_sense_information(cmd->sense_buffer, information); | ||
| 293 | } | ||
| 294 | |||
| 295 | static ssize_t | 280 | static ssize_t |
| 296 | ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr, | 281 | ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr, |
| 297 | const char *buf, size_t count) | 282 | const char *buf, size_t count) |
| @@ -1792,9 +1777,7 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) | |||
| 1792 | ((cdb[2] & 0x20) || need_sense)) { | 1777 | ((cdb[2] & 0x20) || need_sense)) { |
| 1793 | ata_gen_passthru_sense(qc); | 1778 | ata_gen_passthru_sense(qc); |
| 1794 | } else { | 1779 | } else { |
| 1795 | if (qc->flags & ATA_QCFLAG_SENSE_VALID) { | 1780 | if (!need_sense) { |
| 1796 | cmd->result = SAM_STAT_CHECK_CONDITION; | ||
| 1797 | } else if (!need_sense) { | ||
| 1798 | cmd->result = SAM_STAT_GOOD; | 1781 | cmd->result = SAM_STAT_GOOD; |
| 1799 | } else { | 1782 | } else { |
| 1800 | /* TODO: decide which descriptor format to use | 1783 | /* TODO: decide which descriptor format to use |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index a998a175f9f1..f840ca18a7c0 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
| @@ -67,8 +67,7 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); | |||
| 67 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 67 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
| 68 | u64 block, u32 n_block, unsigned int tf_flags, | 68 | u64 block, u32 n_block, unsigned int tf_flags, |
| 69 | unsigned int tag); | 69 | unsigned int tag); |
| 70 | extern u64 ata_tf_read_block(const struct ata_taskfile *tf, | 70 | extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev); |
| 71 | struct ata_device *dev); | ||
| 72 | extern unsigned ata_exec_internal(struct ata_device *dev, | 71 | extern unsigned ata_exec_internal(struct ata_device *dev, |
| 73 | struct ata_taskfile *tf, const u8 *cdb, | 72 | struct ata_taskfile *tf, const u8 *cdb, |
| 74 | int dma_dir, void *buf, unsigned int buflen, | 73 | int dma_dir, void *buf, unsigned int buflen, |
| @@ -138,9 +137,6 @@ extern int ata_scsi_add_hosts(struct ata_host *host, | |||
| 138 | struct scsi_host_template *sht); | 137 | struct scsi_host_template *sht); |
| 139 | extern void ata_scsi_scan_host(struct ata_port *ap, int sync); | 138 | extern void ata_scsi_scan_host(struct ata_port *ap, int sync); |
| 140 | extern int ata_scsi_offline_dev(struct ata_device *dev); | 139 | extern int ata_scsi_offline_dev(struct ata_device *dev); |
| 141 | extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq); | ||
| 142 | extern void ata_scsi_set_sense_information(struct scsi_cmnd *cmd, | ||
| 143 | const struct ata_taskfile *tf); | ||
| 144 | extern void ata_scsi_media_change_notify(struct ata_device *dev); | 140 | extern void ata_scsi_media_change_notify(struct ata_device *dev); |
| 145 | extern void ata_scsi_hotplug(struct work_struct *work); | 141 | extern void ata_scsi_hotplug(struct work_struct *work); |
| 146 | extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); | 142 | extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); |
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index 3a18a8a719b4..fab504fd9cfd 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c | |||
| @@ -1238,8 +1238,12 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_host *host) | |||
| 1238 | readl(mmio + PDC_SDRAM_CONTROL); | 1238 | readl(mmio + PDC_SDRAM_CONTROL); |
| 1239 | 1239 | ||
| 1240 | /* Turn on for ECC */ | 1240 | /* Turn on for ECC */ |
| 1241 | pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, | 1241 | if (!pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, |
| 1242 | PDC_DIMM_SPD_TYPE, &spd0); | 1242 | PDC_DIMM_SPD_TYPE, &spd0)) { |
| 1243 | pr_err("Failed in i2c read: device=%#x, subaddr=%#x\n", | ||
| 1244 | PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE); | ||
| 1245 | return 1; | ||
| 1246 | } | ||
| 1243 | if (spd0 == 0x02) { | 1247 | if (spd0 == 0x02) { |
| 1244 | data |= (0x01 << 16); | 1248 | data |= (0x01 << 16); |
| 1245 | writel(data, mmio + PDC_SDRAM_CONTROL); | 1249 | writel(data, mmio + PDC_SDRAM_CONTROL); |
| @@ -1380,8 +1384,12 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) | |||
| 1380 | 1384 | ||
| 1381 | /* ECC initiliazation. */ | 1385 | /* ECC initiliazation. */ |
| 1382 | 1386 | ||
| 1383 | pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, | 1387 | if (!pdc20621_i2c_read(host, PDC_DIMM0_SPD_DEV_ADDRESS, |
| 1384 | PDC_DIMM_SPD_TYPE, &spd0); | 1388 | PDC_DIMM_SPD_TYPE, &spd0)) { |
| 1389 | pr_err("Failed in i2c read: device=%#x, subaddr=%#x\n", | ||
| 1390 | PDC_DIMM0_SPD_DEV_ADDRESS, PDC_DIMM_SPD_TYPE); | ||
| 1391 | return 1; | ||
| 1392 | } | ||
| 1385 | if (spd0 == 0x02) { | 1393 | if (spd0 == 0x02) { |
| 1386 | void *buf; | 1394 | void *buf; |
| 1387 | VPRINTK("Start ECC initialization\n"); | 1395 | VPRINTK("Start ECC initialization\n"); |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 81751a49d8bf..56486d92c4e7 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
| @@ -296,11 +296,20 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, | |||
| 296 | if (!blk) | 296 | if (!blk) |
| 297 | return -ENOMEM; | 297 | return -ENOMEM; |
| 298 | 298 | ||
| 299 | present = krealloc(rbnode->cache_present, | 299 | if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) { |
| 300 | BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL); | 300 | present = krealloc(rbnode->cache_present, |
| 301 | if (!present) { | 301 | BITS_TO_LONGS(blklen) * sizeof(*present), |
| 302 | kfree(blk); | 302 | GFP_KERNEL); |
| 303 | return -ENOMEM; | 303 | if (!present) { |
| 304 | kfree(blk); | ||
| 305 | return -ENOMEM; | ||
| 306 | } | ||
| 307 | |||
| 308 | memset(present + BITS_TO_LONGS(rbnode->blklen), 0, | ||
| 309 | (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen)) | ||
| 310 | * sizeof(*present)); | ||
| 311 | } else { | ||
| 312 | present = rbnode->cache_present; | ||
| 304 | } | 313 | } |
| 305 | 314 | ||
| 306 | /* insert the register value in the correct place in the rbnode block */ | 315 | /* insert the register value in the correct place in the rbnode block */ |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 4a2ef09e6704..f504232c1ee7 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
| @@ -3756,6 +3756,14 @@ static int mtip_init_cmd(void *data, struct request *rq, unsigned int hctx_idx, | |||
| 3756 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); | 3756 | struct mtip_cmd *cmd = blk_mq_rq_to_pdu(rq); |
| 3757 | u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64; | 3757 | u32 host_cap_64 = readl(dd->mmio + HOST_CAP) & HOST_CAP_64; |
| 3758 | 3758 | ||
| 3759 | /* | ||
| 3760 | * For flush requests, request_idx starts at the end of the | ||
| 3761 | * tag space. Since we don't support FLUSH/FUA, simply return | ||
| 3762 | * 0 as there's nothing to be done. | ||
| 3763 | */ | ||
| 3764 | if (request_idx >= MTIP_MAX_COMMAND_SLOTS) | ||
| 3765 | return 0; | ||
| 3766 | |||
| 3759 | cmd->command = dmam_alloc_coherent(&dd->pdev->dev, CMD_DMA_ALLOC_SZ, | 3767 | cmd->command = dmam_alloc_coherent(&dd->pdev->dev, CMD_DMA_ALLOC_SZ, |
| 3760 | &cmd->command_dma, GFP_KERNEL); | 3768 | &cmd->command_dma, GFP_KERNEL); |
| 3761 | if (!cmd->command) | 3769 | if (!cmd->command) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d94529d5c8e9..bc67a93aa4f4 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -523,6 +523,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...) | |||
| 523 | # define rbd_assert(expr) ((void) 0) | 523 | # define rbd_assert(expr) ((void) 0) |
| 524 | #endif /* !RBD_DEBUG */ | 524 | #endif /* !RBD_DEBUG */ |
| 525 | 525 | ||
| 526 | static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request); | ||
| 526 | static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request); | 527 | static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request); |
| 527 | static void rbd_img_parent_read(struct rbd_obj_request *obj_request); | 528 | static void rbd_img_parent_read(struct rbd_obj_request *obj_request); |
| 528 | static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); | 529 | static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); |
| @@ -1818,6 +1819,16 @@ static void rbd_osd_stat_callback(struct rbd_obj_request *obj_request) | |||
| 1818 | obj_request_done_set(obj_request); | 1819 | obj_request_done_set(obj_request); |
| 1819 | } | 1820 | } |
| 1820 | 1821 | ||
| 1822 | static void rbd_osd_call_callback(struct rbd_obj_request *obj_request) | ||
| 1823 | { | ||
| 1824 | dout("%s: obj %p\n", __func__, obj_request); | ||
| 1825 | |||
| 1826 | if (obj_request_img_data_test(obj_request)) | ||
| 1827 | rbd_osd_copyup_callback(obj_request); | ||
| 1828 | else | ||
| 1829 | obj_request_done_set(obj_request); | ||
| 1830 | } | ||
| 1831 | |||
| 1821 | static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, | 1832 | static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, |
| 1822 | struct ceph_msg *msg) | 1833 | struct ceph_msg *msg) |
| 1823 | { | 1834 | { |
| @@ -1866,6 +1877,8 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, | |||
| 1866 | rbd_osd_discard_callback(obj_request); | 1877 | rbd_osd_discard_callback(obj_request); |
| 1867 | break; | 1878 | break; |
| 1868 | case CEPH_OSD_OP_CALL: | 1879 | case CEPH_OSD_OP_CALL: |
| 1880 | rbd_osd_call_callback(obj_request); | ||
| 1881 | break; | ||
| 1869 | case CEPH_OSD_OP_NOTIFY_ACK: | 1882 | case CEPH_OSD_OP_NOTIFY_ACK: |
| 1870 | case CEPH_OSD_OP_WATCH: | 1883 | case CEPH_OSD_OP_WATCH: |
| 1871 | rbd_osd_trivial_callback(obj_request); | 1884 | rbd_osd_trivial_callback(obj_request); |
| @@ -2530,13 +2543,15 @@ out_unwind: | |||
| 2530 | } | 2543 | } |
| 2531 | 2544 | ||
| 2532 | static void | 2545 | static void |
| 2533 | rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) | 2546 | rbd_osd_copyup_callback(struct rbd_obj_request *obj_request) |
| 2534 | { | 2547 | { |
| 2535 | struct rbd_img_request *img_request; | 2548 | struct rbd_img_request *img_request; |
| 2536 | struct rbd_device *rbd_dev; | 2549 | struct rbd_device *rbd_dev; |
| 2537 | struct page **pages; | 2550 | struct page **pages; |
| 2538 | u32 page_count; | 2551 | u32 page_count; |
| 2539 | 2552 | ||
| 2553 | dout("%s: obj %p\n", __func__, obj_request); | ||
| 2554 | |||
| 2540 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO || | 2555 | rbd_assert(obj_request->type == OBJ_REQUEST_BIO || |
| 2541 | obj_request->type == OBJ_REQUEST_NODATA); | 2556 | obj_request->type == OBJ_REQUEST_NODATA); |
| 2542 | rbd_assert(obj_request_img_data_test(obj_request)); | 2557 | rbd_assert(obj_request_img_data_test(obj_request)); |
| @@ -2563,9 +2578,7 @@ rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) | |||
| 2563 | if (!obj_request->result) | 2578 | if (!obj_request->result) |
| 2564 | obj_request->xferred = obj_request->length; | 2579 | obj_request->xferred = obj_request->length; |
| 2565 | 2580 | ||
| 2566 | /* Finish up with the normal image object callback */ | 2581 | obj_request_done_set(obj_request); |
| 2567 | |||
| 2568 | rbd_img_obj_callback(obj_request); | ||
| 2569 | } | 2582 | } |
| 2570 | 2583 | ||
| 2571 | static void | 2584 | static void |
| @@ -2650,7 +2663,6 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) | |||
| 2650 | 2663 | ||
| 2651 | /* All set, send it off. */ | 2664 | /* All set, send it off. */ |
| 2652 | 2665 | ||
| 2653 | orig_request->callback = rbd_img_obj_copyup_callback; | ||
| 2654 | osdc = &rbd_dev->rbd_client->client->osdc; | 2666 | osdc = &rbd_dev->rbd_client->client->osdc; |
| 2655 | img_result = rbd_obj_request_submit(osdc, orig_request); | 2667 | img_result = rbd_obj_request_submit(osdc, orig_request); |
| 2656 | if (!img_result) | 2668 | if (!img_result) |
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index ced96777b677..954c0029fb3b 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
| @@ -369,8 +369,8 @@ static void purge_persistent_gnt(struct xen_blkif *blkif) | |||
| 369 | return; | 369 | return; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | if (work_pending(&blkif->persistent_purge_work)) { | 372 | if (work_busy(&blkif->persistent_purge_work)) { |
| 373 | pr_alert_ratelimited("Scheduled work from previous purge is still pending, cannot purge list\n"); | 373 | pr_alert_ratelimited("Scheduled work from previous purge is still busy, cannot purge list\n"); |
| 374 | return; | 374 | return; |
| 375 | } | 375 | } |
| 376 | 376 | ||
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 6d89ed35d80c..7a8a73f1fc04 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
| @@ -179,6 +179,7 @@ static DEFINE_SPINLOCK(minor_lock); | |||
| 179 | ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) | 179 | ((_segs + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) |
| 180 | 180 | ||
| 181 | static int blkfront_setup_indirect(struct blkfront_info *info); | 181 | static int blkfront_setup_indirect(struct blkfront_info *info); |
| 182 | static int blkfront_gather_backend_features(struct blkfront_info *info); | ||
| 182 | 183 | ||
| 183 | static int get_id_from_freelist(struct blkfront_info *info) | 184 | static int get_id_from_freelist(struct blkfront_info *info) |
| 184 | { | 185 | { |
| @@ -1128,8 +1129,10 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, | |||
| 1128 | * Add the used indirect page back to the list of | 1129 | * Add the used indirect page back to the list of |
| 1129 | * available pages for indirect grefs. | 1130 | * available pages for indirect grefs. |
| 1130 | */ | 1131 | */ |
| 1131 | indirect_page = pfn_to_page(s->indirect_grants[i]->pfn); | 1132 | if (!info->feature_persistent) { |
| 1132 | list_add(&indirect_page->lru, &info->indirect_pages); | 1133 | indirect_page = pfn_to_page(s->indirect_grants[i]->pfn); |
| 1134 | list_add(&indirect_page->lru, &info->indirect_pages); | ||
| 1135 | } | ||
| 1133 | s->indirect_grants[i]->gref = GRANT_INVALID_REF; | 1136 | s->indirect_grants[i]->gref = GRANT_INVALID_REF; |
| 1134 | list_add_tail(&s->indirect_grants[i]->node, &info->grants); | 1137 | list_add_tail(&s->indirect_grants[i]->node, &info->grants); |
| 1135 | } | 1138 | } |
| @@ -1519,7 +1522,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
| 1519 | info->shadow_free = info->ring.req_prod_pvt; | 1522 | info->shadow_free = info->ring.req_prod_pvt; |
| 1520 | info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; | 1523 | info->shadow[BLK_RING_SIZE(info)-1].req.u.rw.id = 0x0fffffff; |
| 1521 | 1524 | ||
| 1522 | rc = blkfront_setup_indirect(info); | 1525 | rc = blkfront_gather_backend_features(info); |
| 1523 | if (rc) { | 1526 | if (rc) { |
| 1524 | kfree(copy); | 1527 | kfree(copy); |
| 1525 | return rc; | 1528 | return rc; |
| @@ -1720,20 +1723,13 @@ static void blkfront_setup_discard(struct blkfront_info *info) | |||
| 1720 | 1723 | ||
| 1721 | static int blkfront_setup_indirect(struct blkfront_info *info) | 1724 | static int blkfront_setup_indirect(struct blkfront_info *info) |
| 1722 | { | 1725 | { |
| 1723 | unsigned int indirect_segments, segs; | 1726 | unsigned int segs; |
| 1724 | int err, i; | 1727 | int err, i; |
| 1725 | 1728 | ||
| 1726 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | 1729 | if (info->max_indirect_segments == 0) |
| 1727 | "feature-max-indirect-segments", "%u", &indirect_segments, | ||
| 1728 | NULL); | ||
| 1729 | if (err) { | ||
| 1730 | info->max_indirect_segments = 0; | ||
| 1731 | segs = BLKIF_MAX_SEGMENTS_PER_REQUEST; | 1730 | segs = BLKIF_MAX_SEGMENTS_PER_REQUEST; |
| 1732 | } else { | 1731 | else |
| 1733 | info->max_indirect_segments = min(indirect_segments, | ||
| 1734 | xen_blkif_max_segments); | ||
| 1735 | segs = info->max_indirect_segments; | 1732 | segs = info->max_indirect_segments; |
| 1736 | } | ||
| 1737 | 1733 | ||
| 1738 | err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info)); | 1734 | err = fill_grant_buffer(info, (segs + INDIRECT_GREFS(segs)) * BLK_RING_SIZE(info)); |
| 1739 | if (err) | 1735 | if (err) |
| @@ -1797,6 +1793,68 @@ out_of_memory: | |||
| 1797 | } | 1793 | } |
| 1798 | 1794 | ||
| 1799 | /* | 1795 | /* |
| 1796 | * Gather all backend feature-* | ||
| 1797 | */ | ||
| 1798 | static int blkfront_gather_backend_features(struct blkfront_info *info) | ||
| 1799 | { | ||
| 1800 | int err; | ||
| 1801 | int barrier, flush, discard, persistent; | ||
| 1802 | unsigned int indirect_segments; | ||
| 1803 | |||
| 1804 | info->feature_flush = 0; | ||
| 1805 | |||
| 1806 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1807 | "feature-barrier", "%d", &barrier, | ||
| 1808 | NULL); | ||
| 1809 | |||
| 1810 | /* | ||
| 1811 | * If there's no "feature-barrier" defined, then it means | ||
| 1812 | * we're dealing with a very old backend which writes | ||
| 1813 | * synchronously; nothing to do. | ||
| 1814 | * | ||
| 1815 | * If there are barriers, then we use flush. | ||
| 1816 | */ | ||
| 1817 | if (!err && barrier) | ||
| 1818 | info->feature_flush = REQ_FLUSH | REQ_FUA; | ||
| 1819 | /* | ||
| 1820 | * And if there is "feature-flush-cache" use that above | ||
| 1821 | * barriers. | ||
| 1822 | */ | ||
| 1823 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1824 | "feature-flush-cache", "%d", &flush, | ||
| 1825 | NULL); | ||
| 1826 | |||
| 1827 | if (!err && flush) | ||
| 1828 | info->feature_flush = REQ_FLUSH; | ||
| 1829 | |||
| 1830 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1831 | "feature-discard", "%d", &discard, | ||
| 1832 | NULL); | ||
| 1833 | |||
| 1834 | if (!err && discard) | ||
| 1835 | blkfront_setup_discard(info); | ||
| 1836 | |||
| 1837 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1838 | "feature-persistent", "%u", &persistent, | ||
| 1839 | NULL); | ||
| 1840 | if (err) | ||
| 1841 | info->feature_persistent = 0; | ||
| 1842 | else | ||
| 1843 | info->feature_persistent = persistent; | ||
| 1844 | |||
| 1845 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1846 | "feature-max-indirect-segments", "%u", &indirect_segments, | ||
| 1847 | NULL); | ||
| 1848 | if (err) | ||
| 1849 | info->max_indirect_segments = 0; | ||
| 1850 | else | ||
| 1851 | info->max_indirect_segments = min(indirect_segments, | ||
| 1852 | xen_blkif_max_segments); | ||
| 1853 | |||
| 1854 | return blkfront_setup_indirect(info); | ||
| 1855 | } | ||
| 1856 | |||
| 1857 | /* | ||
| 1800 | * Invoked when the backend is finally 'ready' (and has told produced | 1858 | * Invoked when the backend is finally 'ready' (and has told produced |
| 1801 | * the details about the physical device - #sectors, size, etc). | 1859 | * the details about the physical device - #sectors, size, etc). |
| 1802 | */ | 1860 | */ |
| @@ -1807,7 +1865,6 @@ static void blkfront_connect(struct blkfront_info *info) | |||
| 1807 | unsigned int physical_sector_size; | 1865 | unsigned int physical_sector_size; |
| 1808 | unsigned int binfo; | 1866 | unsigned int binfo; |
| 1809 | int err; | 1867 | int err; |
| 1810 | int barrier, flush, discard, persistent; | ||
| 1811 | 1868 | ||
| 1812 | switch (info->connected) { | 1869 | switch (info->connected) { |
| 1813 | case BLKIF_STATE_CONNECTED: | 1870 | case BLKIF_STATE_CONNECTED: |
| @@ -1864,48 +1921,7 @@ static void blkfront_connect(struct blkfront_info *info) | |||
| 1864 | if (err != 1) | 1921 | if (err != 1) |
| 1865 | physical_sector_size = sector_size; | 1922 | physical_sector_size = sector_size; |
| 1866 | 1923 | ||
| 1867 | info->feature_flush = 0; | 1924 | err = blkfront_gather_backend_features(info); |
| 1868 | |||
| 1869 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1870 | "feature-barrier", "%d", &barrier, | ||
| 1871 | NULL); | ||
| 1872 | |||
| 1873 | /* | ||
| 1874 | * If there's no "feature-barrier" defined, then it means | ||
| 1875 | * we're dealing with a very old backend which writes | ||
| 1876 | * synchronously; nothing to do. | ||
| 1877 | * | ||
| 1878 | * If there are barriers, then we use flush. | ||
| 1879 | */ | ||
| 1880 | if (!err && barrier) | ||
| 1881 | info->feature_flush = REQ_FLUSH | REQ_FUA; | ||
| 1882 | /* | ||
| 1883 | * And if there is "feature-flush-cache" use that above | ||
| 1884 | * barriers. | ||
| 1885 | */ | ||
| 1886 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1887 | "feature-flush-cache", "%d", &flush, | ||
| 1888 | NULL); | ||
| 1889 | |||
| 1890 | if (!err && flush) | ||
| 1891 | info->feature_flush = REQ_FLUSH; | ||
| 1892 | |||
| 1893 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1894 | "feature-discard", "%d", &discard, | ||
| 1895 | NULL); | ||
| 1896 | |||
| 1897 | if (!err && discard) | ||
| 1898 | blkfront_setup_discard(info); | ||
| 1899 | |||
| 1900 | err = xenbus_gather(XBT_NIL, info->xbdev->otherend, | ||
| 1901 | "feature-persistent", "%u", &persistent, | ||
| 1902 | NULL); | ||
| 1903 | if (err) | ||
| 1904 | info->feature_persistent = 0; | ||
| 1905 | else | ||
| 1906 | info->feature_persistent = persistent; | ||
| 1907 | |||
| 1908 | err = blkfront_setup_indirect(info); | ||
| 1909 | if (err) { | 1925 | if (err) { |
| 1910 | xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s", | 1926 | xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s", |
| 1911 | info->xbdev->otherend); | 1927 | info->xbdev->otherend); |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index fb655e8d1e3b..763301c7828c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
| @@ -496,10 +496,9 @@ static void zram_meta_free(struct zram_meta *meta, u64 disksize) | |||
| 496 | kfree(meta); | 496 | kfree(meta); |
| 497 | } | 497 | } |
| 498 | 498 | ||
| 499 | static struct zram_meta *zram_meta_alloc(int device_id, u64 disksize) | 499 | static struct zram_meta *zram_meta_alloc(char *pool_name, u64 disksize) |
| 500 | { | 500 | { |
| 501 | size_t num_pages; | 501 | size_t num_pages; |
| 502 | char pool_name[8]; | ||
| 503 | struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL); | 502 | struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL); |
| 504 | 503 | ||
| 505 | if (!meta) | 504 | if (!meta) |
| @@ -512,7 +511,6 @@ static struct zram_meta *zram_meta_alloc(int device_id, u64 disksize) | |||
| 512 | goto out_error; | 511 | goto out_error; |
| 513 | } | 512 | } |
| 514 | 513 | ||
| 515 | snprintf(pool_name, sizeof(pool_name), "zram%d", device_id); | ||
| 516 | meta->mem_pool = zs_create_pool(pool_name, GFP_NOIO | __GFP_HIGHMEM); | 514 | meta->mem_pool = zs_create_pool(pool_name, GFP_NOIO | __GFP_HIGHMEM); |
| 517 | if (!meta->mem_pool) { | 515 | if (!meta->mem_pool) { |
| 518 | pr_err("Error creating memory pool\n"); | 516 | pr_err("Error creating memory pool\n"); |
| @@ -1031,7 +1029,7 @@ static ssize_t disksize_store(struct device *dev, | |||
| 1031 | return -EINVAL; | 1029 | return -EINVAL; |
| 1032 | 1030 | ||
| 1033 | disksize = PAGE_ALIGN(disksize); | 1031 | disksize = PAGE_ALIGN(disksize); |
| 1034 | meta = zram_meta_alloc(zram->disk->first_minor, disksize); | 1032 | meta = zram_meta_alloc(zram->disk->disk_name, disksize); |
| 1035 | if (!meta) | 1033 | if (!meta) |
| 1036 | return -ENOMEM; | 1034 | return -ENOMEM; |
| 1037 | 1035 | ||
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index da8faf78536a..5643b65cee20 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
| @@ -429,7 +429,7 @@ static int hwrng_fillfn(void *unused) | |||
| 429 | static void start_khwrngd(void) | 429 | static void start_khwrngd(void) |
| 430 | { | 430 | { |
| 431 | hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng"); | 431 | hwrng_fill = kthread_run(hwrng_fillfn, NULL, "hwrng"); |
| 432 | if (hwrng_fill == ERR_PTR(-ENOMEM)) { | 432 | if (IS_ERR(hwrng_fill)) { |
| 433 | pr_err("hwrng_fill thread creation failed"); | 433 | pr_err("hwrng_fill thread creation failed"); |
| 434 | hwrng_fill = NULL; | 434 | hwrng_fill = NULL; |
| 435 | } | 435 | } |
diff --git a/drivers/clk/pxa/clk-pxa3xx.c b/drivers/clk/pxa/clk-pxa3xx.c index 4b93a1efb36d..ac03ba49e9d1 100644 --- a/drivers/clk/pxa/clk-pxa3xx.c +++ b/drivers/clk/pxa/clk-pxa3xx.c | |||
| @@ -126,7 +126,7 @@ PARENTS(pxa3xx_ac97_bus) = { "ring_osc_60mhz", "ac97" }; | |||
| 126 | PARENTS(pxa3xx_sbus) = { "ring_osc_60mhz", "system_bus" }; | 126 | PARENTS(pxa3xx_sbus) = { "ring_osc_60mhz", "system_bus" }; |
| 127 | PARENTS(pxa3xx_smemcbus) = { "ring_osc_60mhz", "smemc" }; | 127 | PARENTS(pxa3xx_smemcbus) = { "ring_osc_60mhz", "smemc" }; |
| 128 | 128 | ||
| 129 | #define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENA : &CKENB) | 129 | #define CKEN_AB(bit) ((CKEN_ ## bit > 31) ? &CKENB : &CKENA) |
| 130 | #define PXA3XX_CKEN(dev_id, con_id, parents, mult_lp, div_lp, mult_hp, \ | 130 | #define PXA3XX_CKEN(dev_id, con_id, parents, mult_lp, div_lp, mult_hp, \ |
| 131 | div_hp, bit, is_lp, flags) \ | 131 | div_hp, bit, is_lp, flags) \ |
| 132 | PXA_CKEN(dev_id, con_id, bit, parents, mult_lp, div_lp, \ | 132 | PXA_CKEN(dev_id, con_id, bit, parents, mult_lp, div_lp, \ |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index b8ff3c64cc45..c96de14036a0 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
| @@ -661,6 +661,9 @@ static void sh_cmt_clocksource_suspend(struct clocksource *cs) | |||
| 661 | { | 661 | { |
| 662 | struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); | 662 | struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); |
| 663 | 663 | ||
| 664 | if (!ch->cs_enabled) | ||
| 665 | return; | ||
| 666 | |||
| 664 | sh_cmt_stop(ch, FLAG_CLOCKSOURCE); | 667 | sh_cmt_stop(ch, FLAG_CLOCKSOURCE); |
| 665 | pm_genpd_syscore_poweroff(&ch->cmt->pdev->dev); | 668 | pm_genpd_syscore_poweroff(&ch->cmt->pdev->dev); |
| 666 | } | 669 | } |
| @@ -669,6 +672,9 @@ static void sh_cmt_clocksource_resume(struct clocksource *cs) | |||
| 669 | { | 672 | { |
| 670 | struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); | 673 | struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); |
| 671 | 674 | ||
| 675 | if (!ch->cs_enabled) | ||
| 676 | return; | ||
| 677 | |||
| 672 | pm_genpd_syscore_poweron(&ch->cmt->pdev->dev); | 678 | pm_genpd_syscore_poweron(&ch->cmt->pdev->dev); |
| 673 | sh_cmt_start(ch, FLAG_CLOCKSOURCE); | 679 | sh_cmt_start(ch, FLAG_CLOCKSOURCE); |
| 674 | } | 680 | } |
diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c index 2d59038dec43..86c7eb66bdfb 100644 --- a/drivers/clocksource/timer-imx-gpt.c +++ b/drivers/clocksource/timer-imx-gpt.c | |||
| @@ -462,6 +462,7 @@ void __init mxc_timer_init(unsigned long pbase, int irq, enum imx_gpt_type type) | |||
| 462 | BUG_ON(!imxtm->base); | 462 | BUG_ON(!imxtm->base); |
| 463 | 463 | ||
| 464 | imxtm->type = type; | 464 | imxtm->type = type; |
| 465 | imxtm->irq = irq; | ||
| 465 | 466 | ||
| 466 | _mxc_timer_init(imxtm); | 467 | _mxc_timer_init(imxtm); |
| 467 | } | 468 | } |
diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index ae5b2bd3a978..fa3dd840a837 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c | |||
| @@ -180,7 +180,7 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
| 180 | ret = exynos5250_cpufreq_init(exynos_info); | 180 | ret = exynos5250_cpufreq_init(exynos_info); |
| 181 | } else { | 181 | } else { |
| 182 | pr_err("%s: Unknown SoC type\n", __func__); | 182 | pr_err("%s: Unknown SoC type\n", __func__); |
| 183 | return -ENODEV; | 183 | ret = -ENODEV; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | if (ret) | 186 | if (ret) |
| @@ -188,12 +188,14 @@ static int exynos_cpufreq_probe(struct platform_device *pdev) | |||
| 188 | 188 | ||
| 189 | if (exynos_info->set_freq == NULL) { | 189 | if (exynos_info->set_freq == NULL) { |
| 190 | dev_err(&pdev->dev, "No set_freq function (ERR)\n"); | 190 | dev_err(&pdev->dev, "No set_freq function (ERR)\n"); |
| 191 | ret = -EINVAL; | ||
| 191 | goto err_vdd_arm; | 192 | goto err_vdd_arm; |
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | arm_regulator = regulator_get(NULL, "vdd_arm"); | 195 | arm_regulator = regulator_get(NULL, "vdd_arm"); |
| 195 | if (IS_ERR(arm_regulator)) { | 196 | if (IS_ERR(arm_regulator)) { |
| 196 | dev_err(&pdev->dev, "failed to get resource vdd_arm\n"); | 197 | dev_err(&pdev->dev, "failed to get resource vdd_arm\n"); |
| 198 | ret = -EINVAL; | ||
| 197 | goto err_vdd_arm; | 199 | goto err_vdd_arm; |
| 198 | } | 200 | } |
| 199 | 201 | ||
| @@ -225,7 +227,7 @@ err_cpufreq_reg: | |||
| 225 | regulator_put(arm_regulator); | 227 | regulator_put(arm_regulator); |
| 226 | err_vdd_arm: | 228 | err_vdd_arm: |
| 227 | kfree(exynos_info); | 229 | kfree(exynos_info); |
| 228 | return -EINVAL; | 230 | return ret; |
| 229 | } | 231 | } |
| 230 | 232 | ||
| 231 | static struct platform_driver exynos_cpufreq_platdrv = { | 233 | static struct platform_driver exynos_cpufreq_platdrv = { |
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index e362860c2b50..cd593c1f66dc 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <asm/clock.h> | 20 | #include <asm/clock.h> |
| 21 | #include <asm/idle.h> | 21 | #include <asm/idle.h> |
| 22 | 22 | ||
| 23 | #include <asm/mach-loongson/loongson.h> | 23 | #include <asm/mach-loongson64/loongson.h> |
| 24 | 24 | ||
| 25 | static uint nowait; | 25 | static uint nowait; |
| 26 | 26 | ||
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c index dae1e8099969..f9c78751989e 100644 --- a/drivers/crypto/caam/caamhash.c +++ b/drivers/crypto/caam/caamhash.c | |||
| @@ -909,13 +909,14 @@ static int ahash_final_ctx(struct ahash_request *req) | |||
| 909 | state->buflen_1; | 909 | state->buflen_1; |
| 910 | u32 *sh_desc = ctx->sh_desc_fin, *desc; | 910 | u32 *sh_desc = ctx->sh_desc_fin, *desc; |
| 911 | dma_addr_t ptr = ctx->sh_desc_fin_dma; | 911 | dma_addr_t ptr = ctx->sh_desc_fin_dma; |
| 912 | int sec4_sg_bytes; | 912 | int sec4_sg_bytes, sec4_sg_src_index; |
| 913 | int digestsize = crypto_ahash_digestsize(ahash); | 913 | int digestsize = crypto_ahash_digestsize(ahash); |
| 914 | struct ahash_edesc *edesc; | 914 | struct ahash_edesc *edesc; |
| 915 | int ret = 0; | 915 | int ret = 0; |
| 916 | int sh_len; | 916 | int sh_len; |
| 917 | 917 | ||
| 918 | sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry); | 918 | sec4_sg_src_index = 1 + (buflen ? 1 : 0); |
| 919 | sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry); | ||
| 919 | 920 | ||
| 920 | /* allocate space for base edesc and hw desc commands, link tables */ | 921 | /* allocate space for base edesc and hw desc commands, link tables */ |
| 921 | edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN + | 922 | edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN + |
| @@ -942,7 +943,7 @@ static int ahash_final_ctx(struct ahash_request *req) | |||
| 942 | state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1, | 943 | state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1, |
| 943 | buf, state->buf_dma, buflen, | 944 | buf, state->buf_dma, buflen, |
| 944 | last_buflen); | 945 | last_buflen); |
| 945 | (edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN; | 946 | (edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN; |
| 946 | 947 | ||
| 947 | edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, | 948 | edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg, |
| 948 | sec4_sg_bytes, DMA_TO_DEVICE); | 949 | sec4_sg_bytes, DMA_TO_DEVICE); |
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 7ba495f75370..402631a19a11 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
| @@ -905,7 +905,6 @@ static int ablk_perform(struct ablkcipher_request *req, int encrypt) | |||
| 905 | crypt->mode |= NPE_OP_NOT_IN_PLACE; | 905 | crypt->mode |= NPE_OP_NOT_IN_PLACE; |
| 906 | /* This was never tested by Intel | 906 | /* This was never tested by Intel |
| 907 | * for more than one dst buffer, I think. */ | 907 | * for more than one dst buffer, I think. */ |
| 908 | BUG_ON(req->dst->length < nbytes); | ||
| 909 | req_ctx->dst = NULL; | 908 | req_ctx->dst = NULL; |
| 910 | if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook, | 909 | if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook, |
| 911 | flags, DMA_FROM_DEVICE)) | 910 | flags, DMA_FROM_DEVICE)) |
diff --git a/drivers/crypto/nx/nx-sha256.c b/drivers/crypto/nx/nx-sha256.c index 08f8d5cd6334..becb738c897b 100644 --- a/drivers/crypto/nx/nx-sha256.c +++ b/drivers/crypto/nx/nx-sha256.c | |||
| @@ -71,7 +71,6 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
| 71 | struct sha256_state *sctx = shash_desc_ctx(desc); | 71 | struct sha256_state *sctx = shash_desc_ctx(desc); |
| 72 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 72 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); |
| 73 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; | 73 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; |
| 74 | struct nx_sg *in_sg; | ||
| 75 | struct nx_sg *out_sg; | 74 | struct nx_sg *out_sg; |
| 76 | u64 to_process = 0, leftover, total; | 75 | u64 to_process = 0, leftover, total; |
| 77 | unsigned long irq_flags; | 76 | unsigned long irq_flags; |
| @@ -97,7 +96,6 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
| 97 | NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE; | 96 | NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE; |
| 98 | NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION; | 97 | NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION; |
| 99 | 98 | ||
| 100 | in_sg = nx_ctx->in_sg; | ||
| 101 | max_sg_len = min_t(u64, nx_ctx->ap->sglen, | 99 | max_sg_len = min_t(u64, nx_ctx->ap->sglen, |
| 102 | nx_driver.of.max_sg_len/sizeof(struct nx_sg)); | 100 | nx_driver.of.max_sg_len/sizeof(struct nx_sg)); |
| 103 | max_sg_len = min_t(u64, max_sg_len, | 101 | max_sg_len = min_t(u64, max_sg_len, |
| @@ -114,17 +112,12 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
| 114 | } | 112 | } |
| 115 | 113 | ||
| 116 | do { | 114 | do { |
| 117 | /* | 115 | int used_sgs = 0; |
| 118 | * to_process: the SHA256_BLOCK_SIZE data chunk to process in | 116 | struct nx_sg *in_sg = nx_ctx->in_sg; |
| 119 | * this update. This value is also restricted by the sg list | ||
| 120 | * limits. | ||
| 121 | */ | ||
| 122 | to_process = total - to_process; | ||
| 123 | to_process = to_process & ~(SHA256_BLOCK_SIZE - 1); | ||
| 124 | 117 | ||
| 125 | if (buf_len) { | 118 | if (buf_len) { |
| 126 | data_len = buf_len; | 119 | data_len = buf_len; |
| 127 | in_sg = nx_build_sg_list(nx_ctx->in_sg, | 120 | in_sg = nx_build_sg_list(in_sg, |
| 128 | (u8 *) sctx->buf, | 121 | (u8 *) sctx->buf, |
| 129 | &data_len, | 122 | &data_len, |
| 130 | max_sg_len); | 123 | max_sg_len); |
| @@ -133,15 +126,27 @@ static int nx_sha256_update(struct shash_desc *desc, const u8 *data, | |||
| 133 | rc = -EINVAL; | 126 | rc = -EINVAL; |
| 134 | goto out; | 127 | goto out; |
| 135 | } | 128 | } |
| 129 | used_sgs = in_sg - nx_ctx->in_sg; | ||
| 136 | } | 130 | } |
| 137 | 131 | ||
| 132 | /* to_process: SHA256_BLOCK_SIZE aligned chunk to be | ||
| 133 | * processed in this iteration. This value is restricted | ||
| 134 | * by sg list limits and number of sgs we already used | ||
| 135 | * for leftover data. (see above) | ||
| 136 | * In ideal case, we could allow NX_PAGE_SIZE * max_sg_len, | ||
| 137 | * but because data may not be aligned, we need to account | ||
| 138 | * for that too. */ | ||
| 139 | to_process = min_t(u64, total, | ||
| 140 | (max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE); | ||
| 141 | to_process = to_process & ~(SHA256_BLOCK_SIZE - 1); | ||
| 142 | |||
| 138 | data_len = to_process - buf_len; | 143 | data_len = to_process - buf_len; |
| 139 | in_sg = nx_build_sg_list(in_sg, (u8 *) data, | 144 | in_sg = nx_build_sg_list(in_sg, (u8 *) data, |
| 140 | &data_len, max_sg_len); | 145 | &data_len, max_sg_len); |
| 141 | 146 | ||
| 142 | nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); | 147 | nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg); |
| 143 | 148 | ||
| 144 | to_process = (data_len + buf_len); | 149 | to_process = data_len + buf_len; |
| 145 | leftover = total - to_process; | 150 | leftover = total - to_process; |
| 146 | 151 | ||
| 147 | /* | 152 | /* |
diff --git a/drivers/crypto/nx/nx-sha512.c b/drivers/crypto/nx/nx-sha512.c index aff0fe58eac0..b6e183d58d73 100644 --- a/drivers/crypto/nx/nx-sha512.c +++ b/drivers/crypto/nx/nx-sha512.c | |||
| @@ -71,7 +71,6 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
| 71 | struct sha512_state *sctx = shash_desc_ctx(desc); | 71 | struct sha512_state *sctx = shash_desc_ctx(desc); |
| 72 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); | 72 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base); |
| 73 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; | 73 | struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb; |
| 74 | struct nx_sg *in_sg; | ||
| 75 | struct nx_sg *out_sg; | 74 | struct nx_sg *out_sg; |
| 76 | u64 to_process, leftover = 0, total; | 75 | u64 to_process, leftover = 0, total; |
| 77 | unsigned long irq_flags; | 76 | unsigned long irq_flags; |
| @@ -97,7 +96,6 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
| 97 | NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE; | 96 | NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE; |
| 98 | NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION; | 97 | NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION; |
| 99 | 98 | ||
| 100 | in_sg = nx_ctx->in_sg; | ||
| 101 | max_sg_len = min_t(u64, nx_ctx->ap->sglen, | 99 | max_sg_len = min_t(u64, nx_ctx->ap->sglen, |
| 102 | nx_driver.of.max_sg_len/sizeof(struct nx_sg)); | 100 | nx_driver.of.max_sg_len/sizeof(struct nx_sg)); |
| 103 | max_sg_len = min_t(u64, max_sg_len, | 101 | max_sg_len = min_t(u64, max_sg_len, |
| @@ -114,18 +112,12 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
| 114 | } | 112 | } |
| 115 | 113 | ||
| 116 | do { | 114 | do { |
| 117 | /* | 115 | int used_sgs = 0; |
| 118 | * to_process: the SHA512_BLOCK_SIZE data chunk to process in | 116 | struct nx_sg *in_sg = nx_ctx->in_sg; |
| 119 | * this update. This value is also restricted by the sg list | ||
| 120 | * limits. | ||
| 121 | */ | ||
| 122 | to_process = total - leftover; | ||
| 123 | to_process = to_process & ~(SHA512_BLOCK_SIZE - 1); | ||
| 124 | leftover = total - to_process; | ||
| 125 | 117 | ||
| 126 | if (buf_len) { | 118 | if (buf_len) { |
| 127 | data_len = buf_len; | 119 | data_len = buf_len; |
| 128 | in_sg = nx_build_sg_list(nx_ctx->in_sg, | 120 | in_sg = nx_build_sg_list(in_sg, |
| 129 | (u8 *) sctx->buf, | 121 | (u8 *) sctx->buf, |
| 130 | &data_len, max_sg_len); | 122 | &data_len, max_sg_len); |
| 131 | 123 | ||
| @@ -133,8 +125,20 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
| 133 | rc = -EINVAL; | 125 | rc = -EINVAL; |
| 134 | goto out; | 126 | goto out; |
| 135 | } | 127 | } |
| 128 | used_sgs = in_sg - nx_ctx->in_sg; | ||
| 136 | } | 129 | } |
| 137 | 130 | ||
| 131 | /* to_process: SHA512_BLOCK_SIZE aligned chunk to be | ||
| 132 | * processed in this iteration. This value is restricted | ||
| 133 | * by sg list limits and number of sgs we already used | ||
| 134 | * for leftover data. (see above) | ||
| 135 | * In ideal case, we could allow NX_PAGE_SIZE * max_sg_len, | ||
| 136 | * but because data may not be aligned, we need to account | ||
| 137 | * for that too. */ | ||
| 138 | to_process = min_t(u64, total, | ||
| 139 | (max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE); | ||
| 140 | to_process = to_process & ~(SHA512_BLOCK_SIZE - 1); | ||
| 141 | |||
| 138 | data_len = to_process - buf_len; | 142 | data_len = to_process - buf_len; |
| 139 | in_sg = nx_build_sg_list(in_sg, (u8 *) data, | 143 | in_sg = nx_build_sg_list(in_sg, (u8 *) data, |
| 140 | &data_len, max_sg_len); | 144 | &data_len, max_sg_len); |
| @@ -146,7 +150,7 @@ static int nx_sha512_update(struct shash_desc *desc, const u8 *data, | |||
| 146 | goto out; | 150 | goto out; |
| 147 | } | 151 | } |
| 148 | 152 | ||
| 149 | to_process = (data_len + buf_len); | 153 | to_process = data_len + buf_len; |
| 150 | leftover = total - to_process; | 154 | leftover = total - to_process; |
| 151 | 155 | ||
| 152 | /* | 156 | /* |
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 067402c7c2a9..df427c0e9e7b 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c | |||
| @@ -73,7 +73,8 @@ | |||
| 73 | ICP_QAT_HW_CIPHER_KEY_CONVERT, \ | 73 | ICP_QAT_HW_CIPHER_KEY_CONVERT, \ |
| 74 | ICP_QAT_HW_CIPHER_DECRYPT) | 74 | ICP_QAT_HW_CIPHER_DECRYPT) |
| 75 | 75 | ||
| 76 | static atomic_t active_dev; | 76 | static DEFINE_MUTEX(algs_lock); |
| 77 | static unsigned int active_devs; | ||
| 77 | 78 | ||
| 78 | struct qat_alg_buf { | 79 | struct qat_alg_buf { |
| 79 | uint32_t len; | 80 | uint32_t len; |
| @@ -1280,7 +1281,10 @@ static struct crypto_alg qat_algs[] = { { | |||
| 1280 | 1281 | ||
| 1281 | int qat_algs_register(void) | 1282 | int qat_algs_register(void) |
| 1282 | { | 1283 | { |
| 1283 | if (atomic_add_return(1, &active_dev) == 1) { | 1284 | int ret = 0; |
| 1285 | |||
| 1286 | mutex_lock(&algs_lock); | ||
| 1287 | if (++active_devs == 1) { | ||
| 1284 | int i; | 1288 | int i; |
| 1285 | 1289 | ||
| 1286 | for (i = 0; i < ARRAY_SIZE(qat_algs); i++) | 1290 | for (i = 0; i < ARRAY_SIZE(qat_algs); i++) |
| @@ -1289,21 +1293,25 @@ int qat_algs_register(void) | |||
| 1289 | CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC : | 1293 | CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC : |
| 1290 | CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; | 1294 | CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC; |
| 1291 | 1295 | ||
| 1292 | return crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); | 1296 | ret = crypto_register_algs(qat_algs, ARRAY_SIZE(qat_algs)); |
| 1293 | } | 1297 | } |
| 1294 | return 0; | 1298 | mutex_unlock(&algs_lock); |
| 1299 | return ret; | ||
| 1295 | } | 1300 | } |
| 1296 | 1301 | ||
| 1297 | int qat_algs_unregister(void) | 1302 | int qat_algs_unregister(void) |
| 1298 | { | 1303 | { |
| 1299 | if (atomic_sub_return(1, &active_dev) == 0) | 1304 | int ret = 0; |
| 1300 | return crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); | 1305 | |
| 1301 | return 0; | 1306 | mutex_lock(&algs_lock); |
| 1307 | if (--active_devs == 0) | ||
| 1308 | ret = crypto_unregister_algs(qat_algs, ARRAY_SIZE(qat_algs)); | ||
| 1309 | mutex_unlock(&algs_lock); | ||
| 1310 | return ret; | ||
| 1302 | } | 1311 | } |
| 1303 | 1312 | ||
| 1304 | int qat_algs_init(void) | 1313 | int qat_algs_init(void) |
| 1305 | { | 1314 | { |
| 1306 | atomic_set(&active_dev, 0); | ||
| 1307 | crypto_get_default_rng(); | 1315 | crypto_get_default_rng(); |
| 1308 | return 0; | 1316 | return 0; |
| 1309 | } | 1317 | } |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 4a4cce15f25d..3ff284c8e3d5 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
| @@ -689,6 +689,10 @@ struct dma_chan *dma_request_slave_channel(struct device *dev, | |||
| 689 | struct dma_chan *ch = dma_request_slave_channel_reason(dev, name); | 689 | struct dma_chan *ch = dma_request_slave_channel_reason(dev, name); |
| 690 | if (IS_ERR(ch)) | 690 | if (IS_ERR(ch)) |
| 691 | return NULL; | 691 | return NULL; |
| 692 | |||
| 693 | dma_cap_set(DMA_PRIVATE, ch->device->cap_mask); | ||
| 694 | ch->device->privatecnt++; | ||
| 695 | |||
| 692 | return ch; | 696 | return ch; |
| 693 | } | 697 | } |
| 694 | EXPORT_SYMBOL_GPL(dma_request_slave_channel); | 698 | EXPORT_SYMBOL_GPL(dma_request_slave_channel); |
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c index 3515b381c131..711d8ad74f11 100644 --- a/drivers/edac/ppc4xx_edac.c +++ b/drivers/edac/ppc4xx_edac.c | |||
| @@ -920,7 +920,7 @@ static int ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1) | |||
| 920 | */ | 920 | */ |
| 921 | 921 | ||
| 922 | for (row = 0; row < mci->nr_csrows; row++) { | 922 | for (row = 0; row < mci->nr_csrows; row++) { |
| 923 | struct csrow_info *csi = &mci->csrows[row]; | 923 | struct csrow_info *csi = mci->csrows[row]; |
| 924 | 924 | ||
| 925 | /* | 925 | /* |
| 926 | * Get the configuration settings for this | 926 | * Get the configuration settings for this |
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index 080d5cc27055..eebdf2a33bfe 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c | |||
| @@ -200,7 +200,6 @@ static int palmas_usb_probe(struct platform_device *pdev) | |||
| 200 | status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev); | 200 | status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev); |
| 201 | if (status) { | 201 | if (status) { |
| 202 | dev_err(&pdev->dev, "failed to register extcon device\n"); | 202 | dev_err(&pdev->dev, "failed to register extcon device\n"); |
| 203 | kfree(palmas_usb->edev->name); | ||
| 204 | return status; | 203 | return status; |
| 205 | } | 204 | } |
| 206 | 205 | ||
| @@ -214,7 +213,6 @@ static int palmas_usb_probe(struct platform_device *pdev) | |||
| 214 | if (status < 0) { | 213 | if (status < 0) { |
| 215 | dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", | 214 | dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", |
| 216 | palmas_usb->id_irq, status); | 215 | palmas_usb->id_irq, status); |
| 217 | kfree(palmas_usb->edev->name); | ||
| 218 | return status; | 216 | return status; |
| 219 | } | 217 | } |
| 220 | } | 218 | } |
| @@ -229,7 +227,6 @@ static int palmas_usb_probe(struct platform_device *pdev) | |||
| 229 | if (status < 0) { | 227 | if (status < 0) { |
| 230 | dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", | 228 | dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", |
| 231 | palmas_usb->vbus_irq, status); | 229 | palmas_usb->vbus_irq, status); |
| 232 | kfree(palmas_usb->edev->name); | ||
| 233 | return status; | 230 | return status; |
| 234 | } | 231 | } |
| 235 | } | 232 | } |
| @@ -239,15 +236,6 @@ static int palmas_usb_probe(struct platform_device *pdev) | |||
| 239 | return 0; | 236 | return 0; |
| 240 | } | 237 | } |
| 241 | 238 | ||
| 242 | static int palmas_usb_remove(struct platform_device *pdev) | ||
| 243 | { | ||
| 244 | struct palmas_usb *palmas_usb = platform_get_drvdata(pdev); | ||
| 245 | |||
| 246 | kfree(palmas_usb->edev->name); | ||
| 247 | |||
| 248 | return 0; | ||
| 249 | } | ||
| 250 | |||
| 251 | #ifdef CONFIG_PM_SLEEP | 239 | #ifdef CONFIG_PM_SLEEP |
| 252 | static int palmas_usb_suspend(struct device *dev) | 240 | static int palmas_usb_suspend(struct device *dev) |
| 253 | { | 241 | { |
| @@ -288,7 +276,6 @@ static const struct of_device_id of_palmas_match_tbl[] = { | |||
| 288 | 276 | ||
| 289 | static struct platform_driver palmas_usb_driver = { | 277 | static struct platform_driver palmas_usb_driver = { |
| 290 | .probe = palmas_usb_probe, | 278 | .probe = palmas_usb_probe, |
| 291 | .remove = palmas_usb_remove, | ||
| 292 | .driver = { | 279 | .driver = { |
| 293 | .name = "palmas-usb", | 280 | .name = "palmas-usb", |
| 294 | .of_match_table = of_palmas_match_tbl, | 281 | .of_match_table = of_palmas_match_tbl, |
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 76157ab9faf3..43b57b02d050 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c | |||
| @@ -124,25 +124,35 @@ static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned int id | |||
| 124 | return -EINVAL; | 124 | return -EINVAL; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) | 127 | static int find_cable_id_by_name(struct extcon_dev *edev, const char *name) |
| 128 | { | 128 | { |
| 129 | unsigned int id = EXTCON_NONE; | 129 | unsigned int id = -EINVAL; |
| 130 | int i = 0; | 130 | int i = 0; |
| 131 | 131 | ||
| 132 | if (edev->max_supported == 0) | 132 | /* Find the id of extcon cable */ |
| 133 | return -EINVAL; | ||
| 134 | |||
| 135 | /* Find the the number of extcon cable */ | ||
| 136 | while (extcon_name[i]) { | 133 | while (extcon_name[i]) { |
| 137 | if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) { | 134 | if (!strncmp(extcon_name[i], name, CABLE_NAME_MAX)) { |
| 138 | id = i; | 135 | id = i; |
| 139 | break; | 136 | break; |
| 140 | } | 137 | } |
| 138 | i++; | ||
| 141 | } | 139 | } |
| 142 | 140 | ||
| 143 | if (id == EXTCON_NONE) | 141 | return id; |
| 142 | } | ||
| 143 | |||
| 144 | static int find_cable_index_by_name(struct extcon_dev *edev, const char *name) | ||
| 145 | { | ||
| 146 | unsigned int id; | ||
| 147 | |||
| 148 | if (edev->max_supported == 0) | ||
| 144 | return -EINVAL; | 149 | return -EINVAL; |
| 145 | 150 | ||
| 151 | /* Find the the number of extcon cable */ | ||
| 152 | id = find_cable_id_by_name(edev, name); | ||
| 153 | if (id < 0) | ||
| 154 | return id; | ||
| 155 | |||
| 146 | return find_cable_index_by_id(edev, id); | 156 | return find_cable_index_by_id(edev, id); |
| 147 | } | 157 | } |
| 148 | 158 | ||
| @@ -228,9 +238,11 @@ static ssize_t cable_state_show(struct device *dev, | |||
| 228 | struct extcon_cable *cable = container_of(attr, struct extcon_cable, | 238 | struct extcon_cable *cable = container_of(attr, struct extcon_cable, |
| 229 | attr_state); | 239 | attr_state); |
| 230 | 240 | ||
| 241 | int i = cable->cable_index; | ||
| 242 | |||
| 231 | return sprintf(buf, "%d\n", | 243 | return sprintf(buf, "%d\n", |
| 232 | extcon_get_cable_state_(cable->edev, | 244 | extcon_get_cable_state_(cable->edev, |
| 233 | cable->cable_index)); | 245 | cable->edev->supported_cable[i])); |
| 234 | } | 246 | } |
| 235 | 247 | ||
| 236 | /** | 248 | /** |
| @@ -263,20 +275,25 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) | |||
| 263 | spin_lock_irqsave(&edev->lock, flags); | 275 | spin_lock_irqsave(&edev->lock, flags); |
| 264 | 276 | ||
| 265 | if (edev->state != ((edev->state & ~mask) | (state & mask))) { | 277 | if (edev->state != ((edev->state & ~mask) | (state & mask))) { |
| 278 | u32 old_state; | ||
| 279 | |||
| 266 | if (check_mutually_exclusive(edev, (edev->state & ~mask) | | 280 | if (check_mutually_exclusive(edev, (edev->state & ~mask) | |
| 267 | (state & mask))) { | 281 | (state & mask))) { |
| 268 | spin_unlock_irqrestore(&edev->lock, flags); | 282 | spin_unlock_irqrestore(&edev->lock, flags); |
| 269 | return -EPERM; | 283 | return -EPERM; |
| 270 | } | 284 | } |
| 271 | 285 | ||
| 272 | for (index = 0; index < edev->max_supported; index++) { | 286 | old_state = edev->state; |
| 273 | if (is_extcon_changed(edev->state, state, index, &attached)) | ||
| 274 | raw_notifier_call_chain(&edev->nh[index], attached, edev); | ||
| 275 | } | ||
| 276 | |||
| 277 | edev->state &= ~mask; | 287 | edev->state &= ~mask; |
| 278 | edev->state |= state & mask; | 288 | edev->state |= state & mask; |
| 279 | 289 | ||
| 290 | for (index = 0; index < edev->max_supported; index++) { | ||
| 291 | if (is_extcon_changed(old_state, edev->state, index, | ||
| 292 | &attached)) | ||
| 293 | raw_notifier_call_chain(&edev->nh[index], | ||
| 294 | attached, edev); | ||
| 295 | } | ||
| 296 | |||
| 280 | /* This could be in interrupt handler */ | 297 | /* This could be in interrupt handler */ |
| 281 | prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); | 298 | prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); |
| 282 | if (prop_buf) { | 299 | if (prop_buf) { |
| @@ -361,8 +378,13 @@ EXPORT_SYMBOL_GPL(extcon_get_cable_state_); | |||
| 361 | */ | 378 | */ |
| 362 | int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name) | 379 | int extcon_get_cable_state(struct extcon_dev *edev, const char *cable_name) |
| 363 | { | 380 | { |
| 364 | return extcon_get_cable_state_(edev, find_cable_index_by_name | 381 | unsigned int id; |
| 365 | (edev, cable_name)); | 382 | |
| 383 | id = find_cable_id_by_name(edev, cable_name); | ||
| 384 | if (id < 0) | ||
| 385 | return id; | ||
| 386 | |||
| 387 | return extcon_get_cable_state_(edev, id); | ||
| 366 | } | 388 | } |
| 367 | EXPORT_SYMBOL_GPL(extcon_get_cable_state); | 389 | EXPORT_SYMBOL_GPL(extcon_get_cable_state); |
| 368 | 390 | ||
| @@ -404,8 +426,13 @@ EXPORT_SYMBOL_GPL(extcon_set_cable_state_); | |||
| 404 | int extcon_set_cable_state(struct extcon_dev *edev, | 426 | int extcon_set_cable_state(struct extcon_dev *edev, |
| 405 | const char *cable_name, bool cable_state) | 427 | const char *cable_name, bool cable_state) |
| 406 | { | 428 | { |
| 407 | return extcon_set_cable_state_(edev, find_cable_index_by_name | 429 | unsigned int id; |
| 408 | (edev, cable_name), cable_state); | 430 | |
| 431 | id = find_cable_id_by_name(edev, cable_name); | ||
| 432 | if (id < 0) | ||
| 433 | return id; | ||
| 434 | |||
| 435 | return extcon_set_cable_state_(edev, id, cable_state); | ||
| 409 | } | 436 | } |
| 410 | EXPORT_SYMBOL_GPL(extcon_set_cable_state); | 437 | EXPORT_SYMBOL_GPL(extcon_set_cable_state); |
| 411 | 438 | ||
diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c index 87add3fdce52..e41594510b97 100644 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c | |||
| @@ -245,4 +245,4 @@ char *bcm47xx_nvram_get_contents(size_t *nvram_size) | |||
| 245 | } | 245 | } |
| 246 | EXPORT_SYMBOL(bcm47xx_nvram_get_contents); | 246 | EXPORT_SYMBOL(bcm47xx_nvram_get_contents); |
| 247 | 247 | ||
| 248 | MODULE_LICENSE("GPLv2"); | 248 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 31b00f91cfcd..f7b49d5ce4b8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
| @@ -1130,6 +1130,9 @@ struct amdgpu_gfx { | |||
| 1130 | uint32_t me_feature_version; | 1130 | uint32_t me_feature_version; |
| 1131 | uint32_t ce_feature_version; | 1131 | uint32_t ce_feature_version; |
| 1132 | uint32_t pfp_feature_version; | 1132 | uint32_t pfp_feature_version; |
| 1133 | uint32_t rlc_feature_version; | ||
| 1134 | uint32_t mec_feature_version; | ||
| 1135 | uint32_t mec2_feature_version; | ||
| 1133 | struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS]; | 1136 | struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS]; |
| 1134 | unsigned num_gfx_rings; | 1137 | unsigned num_gfx_rings; |
| 1135 | struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS]; | 1138 | struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS]; |
| @@ -1639,6 +1642,7 @@ struct amdgpu_sdma { | |||
| 1639 | /* SDMA firmware */ | 1642 | /* SDMA firmware */ |
| 1640 | const struct firmware *fw; | 1643 | const struct firmware *fw; |
| 1641 | uint32_t fw_version; | 1644 | uint32_t fw_version; |
| 1645 | uint32_t feature_version; | ||
| 1642 | 1646 | ||
| 1643 | struct amdgpu_ring ring; | 1647 | struct amdgpu_ring ring; |
| 1644 | }; | 1648 | }; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 9736892bcdf9..3bfe67de8349 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
| @@ -317,16 +317,17 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
| 317 | break; | 317 | break; |
| 318 | case AMDGPU_INFO_FW_GFX_RLC: | 318 | case AMDGPU_INFO_FW_GFX_RLC: |
| 319 | fw_info.ver = adev->gfx.rlc_fw_version; | 319 | fw_info.ver = adev->gfx.rlc_fw_version; |
| 320 | fw_info.feature = 0; | 320 | fw_info.feature = adev->gfx.rlc_feature_version; |
| 321 | break; | 321 | break; |
| 322 | case AMDGPU_INFO_FW_GFX_MEC: | 322 | case AMDGPU_INFO_FW_GFX_MEC: |
| 323 | if (info->query_fw.index == 0) | 323 | if (info->query_fw.index == 0) { |
| 324 | fw_info.ver = adev->gfx.mec_fw_version; | 324 | fw_info.ver = adev->gfx.mec_fw_version; |
| 325 | else if (info->query_fw.index == 1) | 325 | fw_info.feature = adev->gfx.mec_feature_version; |
| 326 | } else if (info->query_fw.index == 1) { | ||
| 326 | fw_info.ver = adev->gfx.mec2_fw_version; | 327 | fw_info.ver = adev->gfx.mec2_fw_version; |
| 327 | else | 328 | fw_info.feature = adev->gfx.mec2_feature_version; |
| 329 | } else | ||
| 328 | return -EINVAL; | 330 | return -EINVAL; |
| 329 | fw_info.feature = 0; | ||
| 330 | break; | 331 | break; |
| 331 | case AMDGPU_INFO_FW_SMC: | 332 | case AMDGPU_INFO_FW_SMC: |
| 332 | fw_info.ver = adev->pm.fw_version; | 333 | fw_info.ver = adev->pm.fw_version; |
| @@ -336,7 +337,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
| 336 | if (info->query_fw.index >= 2) | 337 | if (info->query_fw.index >= 2) |
| 337 | return -EINVAL; | 338 | return -EINVAL; |
| 338 | fw_info.ver = adev->sdma[info->query_fw.index].fw_version; | 339 | fw_info.ver = adev->sdma[info->query_fw.index].fw_version; |
| 339 | fw_info.feature = 0; | 340 | fw_info.feature = adev->sdma[info->query_fw.index].feature_version; |
| 340 | break; | 341 | break; |
| 341 | default: | 342 | default: |
| 342 | return -EINVAL; | 343 | return -EINVAL; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index 2f7a5efa21c2..f5c22556ec2c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
| @@ -374,7 +374,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) | |||
| 374 | unsigned height_in_mb = ALIGN(height / 16, 2); | 374 | unsigned height_in_mb = ALIGN(height / 16, 2); |
| 375 | unsigned fs_in_mb = width_in_mb * height_in_mb; | 375 | unsigned fs_in_mb = width_in_mb * height_in_mb; |
| 376 | 376 | ||
| 377 | unsigned image_size, tmp, min_dpb_size, num_dpb_buffer; | 377 | unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size; |
| 378 | 378 | ||
| 379 | image_size = width * height; | 379 | image_size = width * height; |
| 380 | image_size += image_size / 2; | 380 | image_size += image_size / 2; |
| @@ -466,6 +466,8 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) | |||
| 466 | 466 | ||
| 467 | num_dpb_buffer = (le32_to_cpu(msg[59]) & 0xff) + 2; | 467 | num_dpb_buffer = (le32_to_cpu(msg[59]) & 0xff) + 2; |
| 468 | min_dpb_size = image_size * num_dpb_buffer; | 468 | min_dpb_size = image_size * num_dpb_buffer; |
| 469 | min_ctx_size = ((width + 255) / 16) * ((height + 255) / 16) | ||
| 470 | * 16 * num_dpb_buffer + 52 * 1024; | ||
| 469 | break; | 471 | break; |
| 470 | 472 | ||
| 471 | default: | 473 | default: |
| @@ -486,6 +488,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) | |||
| 486 | 488 | ||
| 487 | buf_sizes[0x1] = dpb_size; | 489 | buf_sizes[0x1] = dpb_size; |
| 488 | buf_sizes[0x2] = image_size; | 490 | buf_sizes[0x2] = image_size; |
| 491 | buf_sizes[0x4] = min_ctx_size; | ||
| 489 | return 0; | 492 | return 0; |
| 490 | } | 493 | } |
| 491 | 494 | ||
| @@ -628,6 +631,13 @@ static int amdgpu_uvd_cs_pass2(struct amdgpu_uvd_cs_ctx *ctx) | |||
| 628 | return -EINVAL; | 631 | return -EINVAL; |
| 629 | } | 632 | } |
| 630 | 633 | ||
| 634 | } else if (cmd == 0x206) { | ||
| 635 | if ((end - start) < ctx->buf_sizes[4]) { | ||
| 636 | DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, | ||
| 637 | (unsigned)(end - start), | ||
| 638 | ctx->buf_sizes[4]); | ||
| 639 | return -EINVAL; | ||
| 640 | } | ||
| 631 | } else if ((cmd != 0x100) && (cmd != 0x204)) { | 641 | } else if ((cmd != 0x100) && (cmd != 0x204)) { |
| 632 | DRM_ERROR("invalid UVD command %X!\n", cmd); | 642 | DRM_ERROR("invalid UVD command %X!\n", cmd); |
| 633 | return -EINVAL; | 643 | return -EINVAL; |
| @@ -755,9 +765,10 @@ int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser, uint32_t ib_idx) | |||
| 755 | struct amdgpu_uvd_cs_ctx ctx = {}; | 765 | struct amdgpu_uvd_cs_ctx ctx = {}; |
| 756 | unsigned buf_sizes[] = { | 766 | unsigned buf_sizes[] = { |
| 757 | [0x00000000] = 2048, | 767 | [0x00000000] = 2048, |
| 758 | [0x00000001] = 32 * 1024 * 1024, | 768 | [0x00000001] = 0xFFFFFFFF, |
| 759 | [0x00000002] = 2048 * 1152 * 3, | 769 | [0x00000002] = 0xFFFFFFFF, |
| 760 | [0x00000003] = 2048, | 770 | [0x00000003] = 2048, |
| 771 | [0x00000004] = 0xFFFFFFFF, | ||
| 761 | }; | 772 | }; |
| 762 | struct amdgpu_ib *ib = &parser->ibs[ib_idx]; | 773 | struct amdgpu_ib *ib = &parser->ibs[ib_idx]; |
| 763 | int r; | 774 | int r; |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index ab83cc1ca4cc..15df46c93f0a 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c | |||
| @@ -500,6 +500,7 @@ static int cik_sdma_load_microcode(struct amdgpu_device *adev) | |||
| 500 | amdgpu_ucode_print_sdma_hdr(&hdr->header); | 500 | amdgpu_ucode_print_sdma_hdr(&hdr->header); |
| 501 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; | 501 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
| 502 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | 502 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); |
| 503 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 503 | fw_data = (const __le32 *) | 504 | fw_data = (const __le32 *) |
| 504 | (adev->sdma[i].fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 505 | (adev->sdma[i].fw->data + le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
| 505 | WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0); | 506 | WREG32(mmSDMA0_UCODE_ADDR + sdma_offsets[i], 0); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 2db6ab0a543d..0d8bf2cb1956 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
| @@ -3080,6 +3080,8 @@ static int gfx_v7_0_cp_compute_load_microcode(struct amdgpu_device *adev) | |||
| 3080 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | 3080 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; |
| 3081 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); | 3081 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); |
| 3082 | adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version); | 3082 | adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version); |
| 3083 | adev->gfx.mec_feature_version = le32_to_cpu( | ||
| 3084 | mec_hdr->ucode_feature_version); | ||
| 3083 | 3085 | ||
| 3084 | gfx_v7_0_cp_compute_enable(adev, false); | 3086 | gfx_v7_0_cp_compute_enable(adev, false); |
| 3085 | 3087 | ||
| @@ -3102,6 +3104,8 @@ static int gfx_v7_0_cp_compute_load_microcode(struct amdgpu_device *adev) | |||
| 3102 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; | 3104 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; |
| 3103 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); | 3105 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); |
| 3104 | adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version); | 3106 | adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version); |
| 3107 | adev->gfx.mec2_feature_version = le32_to_cpu( | ||
| 3108 | mec2_hdr->ucode_feature_version); | ||
| 3105 | 3109 | ||
| 3106 | /* MEC2 */ | 3110 | /* MEC2 */ |
| 3107 | fw_data = (const __le32 *) | 3111 | fw_data = (const __le32 *) |
| @@ -4066,6 +4070,8 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev) | |||
| 4066 | hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; | 4070 | hdr = (const struct rlc_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; |
| 4067 | amdgpu_ucode_print_rlc_hdr(&hdr->header); | 4071 | amdgpu_ucode_print_rlc_hdr(&hdr->header); |
| 4068 | adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version); | 4072 | adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version); |
| 4073 | adev->gfx.rlc_feature_version = le32_to_cpu( | ||
| 4074 | hdr->ucode_feature_version); | ||
| 4069 | 4075 | ||
| 4070 | gfx_v7_0_rlc_stop(adev); | 4076 | gfx_v7_0_rlc_stop(adev); |
| 4071 | 4077 | ||
| @@ -5122,7 +5128,7 @@ static void gfx_v7_0_print_status(void *handle) | |||
| 5122 | dev_info(adev->dev, " CP_HPD_EOP_CONTROL=0x%08X\n", | 5128 | dev_info(adev->dev, " CP_HPD_EOP_CONTROL=0x%08X\n", |
| 5123 | RREG32(mmCP_HPD_EOP_CONTROL)); | 5129 | RREG32(mmCP_HPD_EOP_CONTROL)); |
| 5124 | 5130 | ||
| 5125 | for (queue = 0; queue < 8; i++) { | 5131 | for (queue = 0; queue < 8; queue++) { |
| 5126 | cik_srbm_select(adev, me, pipe, queue, 0); | 5132 | cik_srbm_select(adev, me, pipe, queue, 0); |
| 5127 | dev_info(adev->dev, " queue: %d\n", queue); | 5133 | dev_info(adev->dev, " queue: %d\n", queue); |
| 5128 | dev_info(adev->dev, " CP_PQ_WPTR_POLL_CNTL=0x%08X\n", | 5134 | dev_info(adev->dev, " CP_PQ_WPTR_POLL_CNTL=0x%08X\n", |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 9e1d4ddbf475..20e2cfd521d5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
| @@ -587,6 +587,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 587 | int err; | 587 | int err; |
| 588 | struct amdgpu_firmware_info *info = NULL; | 588 | struct amdgpu_firmware_info *info = NULL; |
| 589 | const struct common_firmware_header *header = NULL; | 589 | const struct common_firmware_header *header = NULL; |
| 590 | const struct gfx_firmware_header_v1_0 *cp_hdr; | ||
| 590 | 591 | ||
| 591 | DRM_DEBUG("\n"); | 592 | DRM_DEBUG("\n"); |
| 592 | 593 | ||
| @@ -611,6 +612,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 611 | err = amdgpu_ucode_validate(adev->gfx.pfp_fw); | 612 | err = amdgpu_ucode_validate(adev->gfx.pfp_fw); |
| 612 | if (err) | 613 | if (err) |
| 613 | goto out; | 614 | goto out; |
| 615 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.pfp_fw->data; | ||
| 616 | adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 617 | adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 614 | 618 | ||
| 615 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); | 619 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name); |
| 616 | err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); | 620 | err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev); |
| @@ -619,6 +623,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 619 | err = amdgpu_ucode_validate(adev->gfx.me_fw); | 623 | err = amdgpu_ucode_validate(adev->gfx.me_fw); |
| 620 | if (err) | 624 | if (err) |
| 621 | goto out; | 625 | goto out; |
| 626 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; | ||
| 627 | adev->gfx.me_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 628 | adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 622 | 629 | ||
| 623 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); | 630 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name); |
| 624 | err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); | 631 | err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev); |
| @@ -627,12 +634,18 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 627 | err = amdgpu_ucode_validate(adev->gfx.ce_fw); | 634 | err = amdgpu_ucode_validate(adev->gfx.ce_fw); |
| 628 | if (err) | 635 | if (err) |
| 629 | goto out; | 636 | goto out; |
| 637 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.ce_fw->data; | ||
| 638 | adev->gfx.ce_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 639 | adev->gfx.ce_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 630 | 640 | ||
| 631 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); | 641 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); |
| 632 | err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); | 642 | err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); |
| 633 | if (err) | 643 | if (err) |
| 634 | goto out; | 644 | goto out; |
| 635 | err = amdgpu_ucode_validate(adev->gfx.rlc_fw); | 645 | err = amdgpu_ucode_validate(adev->gfx.rlc_fw); |
| 646 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.rlc_fw->data; | ||
| 647 | adev->gfx.rlc_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 648 | adev->gfx.rlc_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 636 | 649 | ||
| 637 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); | 650 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name); |
| 638 | err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); | 651 | err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev); |
| @@ -641,6 +654,9 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 641 | err = amdgpu_ucode_validate(adev->gfx.mec_fw); | 654 | err = amdgpu_ucode_validate(adev->gfx.mec_fw); |
| 642 | if (err) | 655 | if (err) |
| 643 | goto out; | 656 | goto out; |
| 657 | cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | ||
| 658 | adev->gfx.mec_fw_version = le32_to_cpu(cp_hdr->header.ucode_version); | ||
| 659 | adev->gfx.mec_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version); | ||
| 644 | 660 | ||
| 645 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); | 661 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name); |
| 646 | err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); | 662 | err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev); |
| @@ -648,6 +664,12 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) | |||
| 648 | err = amdgpu_ucode_validate(adev->gfx.mec2_fw); | 664 | err = amdgpu_ucode_validate(adev->gfx.mec2_fw); |
| 649 | if (err) | 665 | if (err) |
| 650 | goto out; | 666 | goto out; |
| 667 | cp_hdr = (const struct gfx_firmware_header_v1_0 *) | ||
| 668 | adev->gfx.mec2_fw->data; | ||
| 669 | adev->gfx.mec2_fw_version = le32_to_cpu( | ||
| 670 | cp_hdr->header.ucode_version); | ||
| 671 | adev->gfx.mec2_feature_version = le32_to_cpu( | ||
| 672 | cp_hdr->ucode_feature_version); | ||
| 651 | } else { | 673 | } else { |
| 652 | err = 0; | 674 | err = 0; |
| 653 | adev->gfx.mec2_fw = NULL; | 675 | adev->gfx.mec2_fw = NULL; |
| @@ -1983,6 +2005,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) | |||
| 1983 | adev->gfx.config.max_shader_engines = 1; | 2005 | adev->gfx.config.max_shader_engines = 1; |
| 1984 | adev->gfx.config.max_tile_pipes = 2; | 2006 | adev->gfx.config.max_tile_pipes = 2; |
| 1985 | adev->gfx.config.max_sh_per_se = 1; | 2007 | adev->gfx.config.max_sh_per_se = 1; |
| 2008 | adev->gfx.config.max_backends_per_se = 2; | ||
| 1986 | 2009 | ||
| 1987 | switch (adev->pdev->revision) { | 2010 | switch (adev->pdev->revision) { |
| 1988 | case 0xc4: | 2011 | case 0xc4: |
| @@ -1991,7 +2014,6 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) | |||
| 1991 | case 0xcc: | 2014 | case 0xcc: |
| 1992 | /* B10 */ | 2015 | /* B10 */ |
| 1993 | adev->gfx.config.max_cu_per_sh = 8; | 2016 | adev->gfx.config.max_cu_per_sh = 8; |
| 1994 | adev->gfx.config.max_backends_per_se = 2; | ||
| 1995 | break; | 2017 | break; |
| 1996 | case 0xc5: | 2018 | case 0xc5: |
| 1997 | case 0x81: | 2019 | case 0x81: |
| @@ -2000,14 +2022,12 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) | |||
| 2000 | case 0xcd: | 2022 | case 0xcd: |
| 2001 | /* B8 */ | 2023 | /* B8 */ |
| 2002 | adev->gfx.config.max_cu_per_sh = 6; | 2024 | adev->gfx.config.max_cu_per_sh = 6; |
| 2003 | adev->gfx.config.max_backends_per_se = 2; | ||
| 2004 | break; | 2025 | break; |
| 2005 | case 0xc6: | 2026 | case 0xc6: |
| 2006 | case 0xca: | 2027 | case 0xca: |
| 2007 | case 0xce: | 2028 | case 0xce: |
| 2008 | /* B6 */ | 2029 | /* B6 */ |
| 2009 | adev->gfx.config.max_cu_per_sh = 6; | 2030 | adev->gfx.config.max_cu_per_sh = 6; |
| 2010 | adev->gfx.config.max_backends_per_se = 2; | ||
| 2011 | break; | 2031 | break; |
| 2012 | case 0xc7: | 2032 | case 0xc7: |
| 2013 | case 0x87: | 2033 | case 0x87: |
| @@ -2015,7 +2035,6 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) | |||
| 2015 | default: | 2035 | default: |
| 2016 | /* B4 */ | 2036 | /* B4 */ |
| 2017 | adev->gfx.config.max_cu_per_sh = 4; | 2037 | adev->gfx.config.max_cu_per_sh = 4; |
| 2018 | adev->gfx.config.max_backends_per_se = 1; | ||
| 2019 | break; | 2038 | break; |
| 2020 | } | 2039 | } |
| 2021 | 2040 | ||
| @@ -2275,7 +2294,6 @@ static int gfx_v8_0_rlc_load_microcode(struct amdgpu_device *adev) | |||
| 2275 | 2294 | ||
| 2276 | hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; | 2295 | hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; |
| 2277 | amdgpu_ucode_print_rlc_hdr(&hdr->header); | 2296 | amdgpu_ucode_print_rlc_hdr(&hdr->header); |
| 2278 | adev->gfx.rlc_fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 2279 | 2297 | ||
| 2280 | fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + | 2298 | fw_data = (const __le32 *)(adev->gfx.rlc_fw->data + |
| 2281 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 2299 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
| @@ -2361,12 +2379,6 @@ static int gfx_v8_0_cp_gfx_load_microcode(struct amdgpu_device *adev) | |||
| 2361 | amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header); | 2379 | amdgpu_ucode_print_gfx_hdr(&pfp_hdr->header); |
| 2362 | amdgpu_ucode_print_gfx_hdr(&ce_hdr->header); | 2380 | amdgpu_ucode_print_gfx_hdr(&ce_hdr->header); |
| 2363 | amdgpu_ucode_print_gfx_hdr(&me_hdr->header); | 2381 | amdgpu_ucode_print_gfx_hdr(&me_hdr->header); |
| 2364 | adev->gfx.pfp_fw_version = le32_to_cpu(pfp_hdr->header.ucode_version); | ||
| 2365 | adev->gfx.ce_fw_version = le32_to_cpu(ce_hdr->header.ucode_version); | ||
| 2366 | adev->gfx.me_fw_version = le32_to_cpu(me_hdr->header.ucode_version); | ||
| 2367 | adev->gfx.me_feature_version = le32_to_cpu(me_hdr->ucode_feature_version); | ||
| 2368 | adev->gfx.ce_feature_version = le32_to_cpu(ce_hdr->ucode_feature_version); | ||
| 2369 | adev->gfx.pfp_feature_version = le32_to_cpu(pfp_hdr->ucode_feature_version); | ||
| 2370 | 2382 | ||
| 2371 | gfx_v8_0_cp_gfx_enable(adev, false); | 2383 | gfx_v8_0_cp_gfx_enable(adev, false); |
| 2372 | 2384 | ||
| @@ -2622,7 +2634,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) | |||
| 2622 | 2634 | ||
| 2623 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; | 2635 | mec_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec_fw->data; |
| 2624 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); | 2636 | amdgpu_ucode_print_gfx_hdr(&mec_hdr->header); |
| 2625 | adev->gfx.mec_fw_version = le32_to_cpu(mec_hdr->header.ucode_version); | ||
| 2626 | 2637 | ||
| 2627 | fw_data = (const __le32 *) | 2638 | fw_data = (const __le32 *) |
| 2628 | (adev->gfx.mec_fw->data + | 2639 | (adev->gfx.mec_fw->data + |
| @@ -2641,7 +2652,6 @@ static int gfx_v8_0_cp_compute_load_microcode(struct amdgpu_device *adev) | |||
| 2641 | 2652 | ||
| 2642 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; | 2653 | mec2_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.mec2_fw->data; |
| 2643 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); | 2654 | amdgpu_ucode_print_gfx_hdr(&mec2_hdr->header); |
| 2644 | adev->gfx.mec2_fw_version = le32_to_cpu(mec2_hdr->header.ucode_version); | ||
| 2645 | 2655 | ||
| 2646 | fw_data = (const __le32 *) | 2656 | fw_data = (const __le32 *) |
| 2647 | (adev->gfx.mec2_fw->data + | 2657 | (adev->gfx.mec2_fw->data + |
| @@ -3125,7 +3135,7 @@ static int gfx_v8_0_cp_compute_resume(struct amdgpu_device *adev) | |||
| 3125 | WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, | 3135 | WREG32(mmCP_MEC_DOORBELL_RANGE_LOWER, |
| 3126 | AMDGPU_DOORBELL_KIQ << 2); | 3136 | AMDGPU_DOORBELL_KIQ << 2); |
| 3127 | WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, | 3137 | WREG32(mmCP_MEC_DOORBELL_RANGE_UPPER, |
| 3128 | 0x7FFFF << 2); | 3138 | AMDGPU_DOORBELL_MEC_RING7 << 2); |
| 3129 | } | 3139 | } |
| 3130 | tmp = RREG32(mmCP_HQD_PQ_DOORBELL_CONTROL); | 3140 | tmp = RREG32(mmCP_HQD_PQ_DOORBELL_CONTROL); |
| 3131 | tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL, | 3141 | tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL, |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index d7895885fe0c..a988dfb1d394 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | |||
| @@ -121,6 +121,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) | |||
| 121 | int err, i; | 121 | int err, i; |
| 122 | struct amdgpu_firmware_info *info = NULL; | 122 | struct amdgpu_firmware_info *info = NULL; |
| 123 | const struct common_firmware_header *header = NULL; | 123 | const struct common_firmware_header *header = NULL; |
| 124 | const struct sdma_firmware_header_v1_0 *hdr; | ||
| 124 | 125 | ||
| 125 | DRM_DEBUG("\n"); | 126 | DRM_DEBUG("\n"); |
| 126 | 127 | ||
| @@ -142,6 +143,9 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) | |||
| 142 | err = amdgpu_ucode_validate(adev->sdma[i].fw); | 143 | err = amdgpu_ucode_validate(adev->sdma[i].fw); |
| 143 | if (err) | 144 | if (err) |
| 144 | goto out; | 145 | goto out; |
| 146 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | ||
| 147 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 148 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 145 | 149 | ||
| 146 | if (adev->firmware.smu_load) { | 150 | if (adev->firmware.smu_load) { |
| 147 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; | 151 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; |
| @@ -541,8 +545,6 @@ static int sdma_v2_4_load_microcode(struct amdgpu_device *adev) | |||
| 541 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | 545 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; |
| 542 | amdgpu_ucode_print_sdma_hdr(&hdr->header); | 546 | amdgpu_ucode_print_sdma_hdr(&hdr->header); |
| 543 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; | 547 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
| 544 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 545 | |||
| 546 | fw_data = (const __le32 *) | 548 | fw_data = (const __le32 *) |
| 547 | (adev->sdma[i].fw->data + | 549 | (adev->sdma[i].fw->data + |
| 548 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 550 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 7bb37b93993f..2b86569b18d3 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | |||
| @@ -159,6 +159,7 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) | |||
| 159 | int err, i; | 159 | int err, i; |
| 160 | struct amdgpu_firmware_info *info = NULL; | 160 | struct amdgpu_firmware_info *info = NULL; |
| 161 | const struct common_firmware_header *header = NULL; | 161 | const struct common_firmware_header *header = NULL; |
| 162 | const struct sdma_firmware_header_v1_0 *hdr; | ||
| 162 | 163 | ||
| 163 | DRM_DEBUG("\n"); | 164 | DRM_DEBUG("\n"); |
| 164 | 165 | ||
| @@ -183,6 +184,9 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev) | |||
| 183 | err = amdgpu_ucode_validate(adev->sdma[i].fw); | 184 | err = amdgpu_ucode_validate(adev->sdma[i].fw); |
| 184 | if (err) | 185 | if (err) |
| 185 | goto out; | 186 | goto out; |
| 187 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | ||
| 188 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 189 | adev->sdma[i].feature_version = le32_to_cpu(hdr->ucode_feature_version); | ||
| 186 | 190 | ||
| 187 | if (adev->firmware.smu_load) { | 191 | if (adev->firmware.smu_load) { |
| 188 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; | 192 | info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; |
| @@ -630,8 +634,6 @@ static int sdma_v3_0_load_microcode(struct amdgpu_device *adev) | |||
| 630 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; | 634 | hdr = (const struct sdma_firmware_header_v1_0 *)adev->sdma[i].fw->data; |
| 631 | amdgpu_ucode_print_sdma_hdr(&hdr->header); | 635 | amdgpu_ucode_print_sdma_hdr(&hdr->header); |
| 632 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; | 636 | fw_size = le32_to_cpu(hdr->header.ucode_size_bytes) / 4; |
| 633 | adev->sdma[i].fw_version = le32_to_cpu(hdr->header.ucode_version); | ||
| 634 | |||
| 635 | fw_data = (const __le32 *) | 637 | fw_data = (const __le32 *) |
| 636 | (adev->sdma[i].fw->data + | 638 | (adev->sdma[i].fw->data + |
| 637 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); | 639 | le32_to_cpu(hdr->header.ucode_array_offset_bytes)); |
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 6fad1f9648f3..ef6182bc8e5e 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | |||
| @@ -559,7 +559,7 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev) | |||
| 559 | return 0; | 559 | return 0; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | #ifdef CONFIG_PM | 562 | #ifdef CONFIG_PM_SLEEP |
| 563 | static int atmel_hlcdc_dc_drm_suspend(struct device *dev) | 563 | static int atmel_hlcdc_dc_drm_suspend(struct device *dev) |
| 564 | { | 564 | { |
| 565 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 565 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index aac212297b49..9dcc7280e572 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
| @@ -196,7 +196,12 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx) | |||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | funcs = connector->helper_private; | 198 | funcs = connector->helper_private; |
| 199 | new_encoder = funcs->best_encoder(connector); | 199 | |
| 200 | if (funcs->atomic_best_encoder) | ||
| 201 | new_encoder = funcs->atomic_best_encoder(connector, | ||
| 202 | connector_state); | ||
| 203 | else | ||
| 204 | new_encoder = funcs->best_encoder(connector); | ||
| 200 | 205 | ||
| 201 | if (!new_encoder) { | 206 | if (!new_encoder) { |
| 202 | DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n", | 207 | DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n", |
| @@ -229,13 +234,14 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx) | |||
| 229 | } | 234 | } |
| 230 | } | 235 | } |
| 231 | 236 | ||
| 237 | if (WARN_ON(!connector_state->crtc)) | ||
| 238 | return -EINVAL; | ||
| 239 | |||
| 232 | connector_state->best_encoder = new_encoder; | 240 | connector_state->best_encoder = new_encoder; |
| 233 | if (connector_state->crtc) { | 241 | idx = drm_crtc_index(connector_state->crtc); |
| 234 | idx = drm_crtc_index(connector_state->crtc); | ||
| 235 | 242 | ||
| 236 | crtc_state = state->crtc_states[idx]; | 243 | crtc_state = state->crtc_states[idx]; |
| 237 | crtc_state->mode_changed = true; | 244 | crtc_state->mode_changed = true; |
| 238 | } | ||
| 239 | 245 | ||
| 240 | DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n", | 246 | DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n", |
| 241 | connector->base.id, | 247 | connector->base.id, |
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index 778bbb6425b8..eb603f1defc2 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c | |||
| @@ -873,9 +873,10 @@ static void drm_dp_destroy_port(struct kref *kref) | |||
| 873 | from an EDID retrieval */ | 873 | from an EDID retrieval */ |
| 874 | if (port->connector) { | 874 | if (port->connector) { |
| 875 | mutex_lock(&mgr->destroy_connector_lock); | 875 | mutex_lock(&mgr->destroy_connector_lock); |
| 876 | list_add(&port->connector->destroy_list, &mgr->destroy_connector_list); | 876 | list_add(&port->next, &mgr->destroy_connector_list); |
| 877 | mutex_unlock(&mgr->destroy_connector_lock); | 877 | mutex_unlock(&mgr->destroy_connector_lock); |
| 878 | schedule_work(&mgr->destroy_connector_work); | 878 | schedule_work(&mgr->destroy_connector_work); |
| 879 | return; | ||
| 879 | } | 880 | } |
| 880 | drm_dp_port_teardown_pdt(port, port->pdt); | 881 | drm_dp_port_teardown_pdt(port, port->pdt); |
| 881 | 882 | ||
| @@ -1294,7 +1295,6 @@ retry: | |||
| 1294 | goto retry; | 1295 | goto retry; |
| 1295 | } | 1296 | } |
| 1296 | DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret); | 1297 | DRM_DEBUG_KMS("failed to dpcd write %d %d\n", tosend, ret); |
| 1297 | WARN(1, "fail\n"); | ||
| 1298 | 1298 | ||
| 1299 | return -EIO; | 1299 | return -EIO; |
| 1300 | } | 1300 | } |
| @@ -2660,7 +2660,7 @@ static void drm_dp_tx_work(struct work_struct *work) | |||
| 2660 | static void drm_dp_destroy_connector_work(struct work_struct *work) | 2660 | static void drm_dp_destroy_connector_work(struct work_struct *work) |
| 2661 | { | 2661 | { |
| 2662 | struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); | 2662 | struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, destroy_connector_work); |
| 2663 | struct drm_connector *connector; | 2663 | struct drm_dp_mst_port *port; |
| 2664 | 2664 | ||
| 2665 | /* | 2665 | /* |
| 2666 | * Not a regular list traverse as we have to drop the destroy | 2666 | * Not a regular list traverse as we have to drop the destroy |
| @@ -2669,15 +2669,21 @@ static void drm_dp_destroy_connector_work(struct work_struct *work) | |||
| 2669 | */ | 2669 | */ |
| 2670 | for (;;) { | 2670 | for (;;) { |
| 2671 | mutex_lock(&mgr->destroy_connector_lock); | 2671 | mutex_lock(&mgr->destroy_connector_lock); |
| 2672 | connector = list_first_entry_or_null(&mgr->destroy_connector_list, struct drm_connector, destroy_list); | 2672 | port = list_first_entry_or_null(&mgr->destroy_connector_list, struct drm_dp_mst_port, next); |
| 2673 | if (!connector) { | 2673 | if (!port) { |
| 2674 | mutex_unlock(&mgr->destroy_connector_lock); | 2674 | mutex_unlock(&mgr->destroy_connector_lock); |
| 2675 | break; | 2675 | break; |
| 2676 | } | 2676 | } |
| 2677 | list_del(&connector->destroy_list); | 2677 | list_del(&port->next); |
| 2678 | mutex_unlock(&mgr->destroy_connector_lock); | 2678 | mutex_unlock(&mgr->destroy_connector_lock); |
| 2679 | 2679 | ||
| 2680 | mgr->cbs->destroy_connector(mgr, connector); | 2680 | mgr->cbs->destroy_connector(mgr, port->connector); |
| 2681 | |||
| 2682 | drm_dp_port_teardown_pdt(port, port->pdt); | ||
| 2683 | |||
| 2684 | if (!port->input && port->vcpi.vcpi > 0) | ||
| 2685 | drm_dp_mst_put_payload_id(mgr, port->vcpi.vcpi); | ||
| 2686 | kfree(port); | ||
| 2681 | } | 2687 | } |
| 2682 | } | 2688 | } |
| 2683 | 2689 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index f9cc68fbd2a3..b50fa0afd907 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
| @@ -75,7 +75,7 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600) | |||
| 75 | module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); | 75 | module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); |
| 76 | 76 | ||
| 77 | static void store_vblank(struct drm_device *dev, int crtc, | 77 | static void store_vblank(struct drm_device *dev, int crtc, |
| 78 | unsigned vblank_count_inc, | 78 | u32 vblank_count_inc, |
| 79 | struct timeval *t_vblank) | 79 | struct timeval *t_vblank) |
| 80 | { | 80 | { |
| 81 | struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; | 81 | struct drm_vblank_crtc *vblank = &dev->vblank[crtc]; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 842d6b8dc3c4..2a652359af64 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
| @@ -1745,7 +1745,6 @@ static int fimc_probe(struct platform_device *pdev) | |||
| 1745 | spin_lock_init(&ctx->lock); | 1745 | spin_lock_init(&ctx->lock); |
| 1746 | platform_set_drvdata(pdev, ctx); | 1746 | platform_set_drvdata(pdev, ctx); |
| 1747 | 1747 | ||
| 1748 | pm_runtime_set_active(dev); | ||
| 1749 | pm_runtime_enable(dev); | 1748 | pm_runtime_enable(dev); |
| 1750 | 1749 | ||
| 1751 | ret = exynos_drm_ippdrv_register(ippdrv); | 1750 | ret = exynos_drm_ippdrv_register(ippdrv); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 8040ed2a831f..f1c6b76c127f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
| @@ -593,8 +593,7 @@ static int gsc_src_set_transf(struct device *dev, | |||
| 593 | 593 | ||
| 594 | gsc_write(cfg, GSC_IN_CON); | 594 | gsc_write(cfg, GSC_IN_CON); |
| 595 | 595 | ||
| 596 | ctx->rotation = cfg & | 596 | ctx->rotation = (cfg & GSC_IN_ROT_90) ? 1 : 0; |
| 597 | (GSC_IN_ROT_90 | GSC_IN_ROT_270) ? 1 : 0; | ||
| 598 | *swap = ctx->rotation; | 597 | *swap = ctx->rotation; |
| 599 | 598 | ||
| 600 | return 0; | 599 | return 0; |
| @@ -857,8 +856,7 @@ static int gsc_dst_set_transf(struct device *dev, | |||
| 857 | 856 | ||
| 858 | gsc_write(cfg, GSC_IN_CON); | 857 | gsc_write(cfg, GSC_IN_CON); |
| 859 | 858 | ||
| 860 | ctx->rotation = cfg & | 859 | ctx->rotation = (cfg & GSC_IN_ROT_90) ? 1 : 0; |
| 861 | (GSC_IN_ROT_90 | GSC_IN_ROT_270) ? 1 : 0; | ||
| 862 | *swap = ctx->rotation; | 860 | *swap = ctx->rotation; |
| 863 | 861 | ||
| 864 | return 0; | 862 | return 0; |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 99e286489031..4a00990e4ae4 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -1064,6 +1064,7 @@ static int hdmi_get_modes(struct drm_connector *connector) | |||
| 1064 | { | 1064 | { |
| 1065 | struct hdmi_context *hdata = ctx_from_connector(connector); | 1065 | struct hdmi_context *hdata = ctx_from_connector(connector); |
| 1066 | struct edid *edid; | 1066 | struct edid *edid; |
| 1067 | int ret; | ||
| 1067 | 1068 | ||
| 1068 | if (!hdata->ddc_adpt) | 1069 | if (!hdata->ddc_adpt) |
| 1069 | return -ENODEV; | 1070 | return -ENODEV; |
| @@ -1079,7 +1080,11 @@ static int hdmi_get_modes(struct drm_connector *connector) | |||
| 1079 | 1080 | ||
| 1080 | drm_mode_connector_update_edid_property(connector, edid); | 1081 | drm_mode_connector_update_edid_property(connector, edid); |
| 1081 | 1082 | ||
| 1082 | return drm_add_edid_modes(connector, edid); | 1083 | ret = drm_add_edid_modes(connector, edid); |
| 1084 | |||
| 1085 | kfree(edid); | ||
| 1086 | |||
| 1087 | return ret; | ||
| 1083 | } | 1088 | } |
| 1084 | 1089 | ||
| 1085 | static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) | 1090 | static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index cae98db33062..4706b56902b4 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
| @@ -718,6 +718,10 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) | |||
| 718 | 718 | ||
| 719 | /* handling VSYNC */ | 719 | /* handling VSYNC */ |
| 720 | if (val & MXR_INT_STATUS_VSYNC) { | 720 | if (val & MXR_INT_STATUS_VSYNC) { |
| 721 | /* vsync interrupt use different bit for read and clear */ | ||
| 722 | val |= MXR_INT_CLEAR_VSYNC; | ||
| 723 | val &= ~MXR_INT_STATUS_VSYNC; | ||
| 724 | |||
| 721 | /* interlace scan need to check shadow register */ | 725 | /* interlace scan need to check shadow register */ |
| 722 | if (ctx->interlace) { | 726 | if (ctx->interlace) { |
| 723 | base = mixer_reg_read(res, MXR_GRAPHIC_BASE(0)); | 727 | base = mixer_reg_read(res, MXR_GRAPHIC_BASE(0)); |
| @@ -743,11 +747,6 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) | |||
| 743 | 747 | ||
| 744 | out: | 748 | out: |
| 745 | /* clear interrupts */ | 749 | /* clear interrupts */ |
| 746 | if (~val & MXR_INT_EN_VSYNC) { | ||
| 747 | /* vsync interrupt use different bit for read and clear */ | ||
| 748 | val &= ~MXR_INT_EN_VSYNC; | ||
| 749 | val |= MXR_INT_CLEAR_VSYNC; | ||
| 750 | } | ||
| 751 | mixer_reg_write(res, MXR_INT_STATUS, val); | 750 | mixer_reg_write(res, MXR_INT_STATUS, val); |
| 752 | 751 | ||
| 753 | spin_unlock(&res->reg_slock); | 752 | spin_unlock(&res->reg_slock); |
| @@ -907,8 +906,8 @@ static int mixer_enable_vblank(struct exynos_drm_crtc *crtc) | |||
| 907 | } | 906 | } |
| 908 | 907 | ||
| 909 | /* enable vsync interrupt */ | 908 | /* enable vsync interrupt */ |
| 910 | mixer_reg_writemask(res, MXR_INT_EN, MXR_INT_EN_VSYNC, | 909 | mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC); |
| 911 | MXR_INT_EN_VSYNC); | 910 | mixer_reg_writemask(res, MXR_INT_EN, ~0, MXR_INT_EN_VSYNC); |
| 912 | 911 | ||
| 913 | return 0; | 912 | return 0; |
| 914 | } | 913 | } |
| @@ -918,7 +917,13 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc) | |||
| 918 | struct mixer_context *mixer_ctx = crtc->ctx; | 917 | struct mixer_context *mixer_ctx = crtc->ctx; |
| 919 | struct mixer_resources *res = &mixer_ctx->mixer_res; | 918 | struct mixer_resources *res = &mixer_ctx->mixer_res; |
| 920 | 919 | ||
| 920 | if (!mixer_ctx->powered) { | ||
| 921 | mixer_ctx->int_en &= MXR_INT_EN_VSYNC; | ||
| 922 | return; | ||
| 923 | } | ||
| 924 | |||
| 921 | /* disable vsync interrupt */ | 925 | /* disable vsync interrupt */ |
| 926 | mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC); | ||
| 922 | mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); | 927 | mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); |
| 923 | } | 928 | } |
| 924 | 929 | ||
| @@ -1047,6 +1052,8 @@ static void mixer_enable(struct exynos_drm_crtc *crtc) | |||
| 1047 | 1052 | ||
| 1048 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); | 1053 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_SOFT_RESET); |
| 1049 | 1054 | ||
| 1055 | if (ctx->int_en & MXR_INT_EN_VSYNC) | ||
| 1056 | mixer_reg_writemask(res, MXR_INT_STATUS, ~0, MXR_INT_CLEAR_VSYNC); | ||
| 1050 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); | 1057 | mixer_reg_write(res, MXR_INT_EN, ctx->int_en); |
| 1051 | mixer_win_reset(ctx); | 1058 | mixer_win_reset(ctx); |
| 1052 | } | 1059 | } |
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index fe1599d75f14..424228be79ae 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c | |||
| @@ -606,8 +606,6 @@ static void | |||
| 606 | tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, uint16_t addr, | 606 | tda998x_write_if(struct tda998x_priv *priv, uint8_t bit, uint16_t addr, |
| 607 | uint8_t *buf, size_t size) | 607 | uint8_t *buf, size_t size) |
| 608 | { | 608 | { |
| 609 | buf[PB(0)] = tda998x_cksum(buf, size); | ||
| 610 | |||
| 611 | reg_clear(priv, REG_DIP_IF_FLAGS, bit); | 609 | reg_clear(priv, REG_DIP_IF_FLAGS, bit); |
| 612 | reg_write_range(priv, addr, buf, size); | 610 | reg_write_range(priv, addr, buf, size); |
| 613 | reg_set(priv, REG_DIP_IF_FLAGS, bit); | 611 | reg_set(priv, REG_DIP_IF_FLAGS, bit); |
| @@ -627,6 +625,8 @@ tda998x_write_aif(struct tda998x_priv *priv, struct tda998x_encoder_params *p) | |||
| 627 | buf[PB(4)] = p->audio_frame[4]; | 625 | buf[PB(4)] = p->audio_frame[4]; |
| 628 | buf[PB(5)] = p->audio_frame[5] & 0xf8; /* DM_INH + LSV */ | 626 | buf[PB(5)] = p->audio_frame[5] & 0xf8; /* DM_INH + LSV */ |
| 629 | 627 | ||
| 628 | buf[PB(0)] = tda998x_cksum(buf, sizeof(buf)); | ||
| 629 | |||
| 630 | tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, buf, | 630 | tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, buf, |
| 631 | sizeof(buf)); | 631 | sizeof(buf)); |
| 632 | } | 632 | } |
diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 7ed8033aae60..8e35e0d013df 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c | |||
| @@ -129,8 +129,9 @@ int intel_atomic_commit(struct drm_device *dev, | |||
| 129 | struct drm_atomic_state *state, | 129 | struct drm_atomic_state *state, |
| 130 | bool async) | 130 | bool async) |
| 131 | { | 131 | { |
| 132 | int ret; | 132 | struct drm_crtc_state *crtc_state; |
| 133 | int i; | 133 | struct drm_crtc *crtc; |
| 134 | int ret, i; | ||
| 134 | 135 | ||
| 135 | if (async) { | 136 | if (async) { |
| 136 | DRM_DEBUG_KMS("i915 does not yet support async commit\n"); | 137 | DRM_DEBUG_KMS("i915 does not yet support async commit\n"); |
| @@ -142,48 +143,18 @@ int intel_atomic_commit(struct drm_device *dev, | |||
| 142 | return ret; | 143 | return ret; |
| 143 | 144 | ||
| 144 | /* Point of no return */ | 145 | /* Point of no return */ |
| 145 | 146 | drm_atomic_helper_swap_state(dev, state); | |
| 146 | /* | ||
| 147 | * FIXME: The proper sequence here will eventually be: | ||
| 148 | * | ||
| 149 | * drm_atomic_helper_swap_state(dev, state) | ||
| 150 | * drm_atomic_helper_commit_modeset_disables(dev, state); | ||
| 151 | * drm_atomic_helper_commit_planes(dev, state); | ||
| 152 | * drm_atomic_helper_commit_modeset_enables(dev, state); | ||
| 153 | * drm_atomic_helper_wait_for_vblanks(dev, state); | ||
| 154 | * drm_atomic_helper_cleanup_planes(dev, state); | ||
| 155 | * drm_atomic_state_free(state); | ||
| 156 | * | ||
| 157 | * once we have full atomic modeset. For now, just manually update | ||
| 158 | * plane states to avoid clobbering good states with dummy states | ||
| 159 | * while nuclear pageflipping. | ||
| 160 | */ | ||
| 161 | for (i = 0; i < dev->mode_config.num_total_plane; i++) { | ||
| 162 | struct drm_plane *plane = state->planes[i]; | ||
| 163 | |||
| 164 | if (!plane) | ||
| 165 | continue; | ||
| 166 | |||
| 167 | plane->state->state = state; | ||
| 168 | swap(state->plane_states[i], plane->state); | ||
| 169 | plane->state->state = NULL; | ||
| 170 | } | ||
| 171 | 147 | ||
| 172 | /* swap crtc_scaler_state */ | 148 | /* swap crtc_scaler_state */ |
| 173 | for (i = 0; i < dev->mode_config.num_crtc; i++) { | 149 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
| 174 | struct drm_crtc *crtc = state->crtcs[i]; | 150 | to_intel_crtc(crtc)->config = to_intel_crtc_state(crtc->state); |
| 175 | if (!crtc) { | ||
| 176 | continue; | ||
| 177 | } | ||
| 178 | |||
| 179 | to_intel_crtc(crtc)->config->scaler_state = | ||
| 180 | to_intel_crtc_state(state->crtc_states[i])->scaler_state; | ||
| 181 | 151 | ||
| 182 | if (INTEL_INFO(dev)->gen >= 9) | 152 | if (INTEL_INFO(dev)->gen >= 9) |
| 183 | skl_detach_scalers(to_intel_crtc(crtc)); | 153 | skl_detach_scalers(to_intel_crtc(crtc)); |
| 154 | |||
| 155 | drm_atomic_helper_commit_planes_on_crtc(crtc_state); | ||
| 184 | } | 156 | } |
| 185 | 157 | ||
| 186 | drm_atomic_helper_commit_planes(dev, state); | ||
| 187 | drm_atomic_helper_wait_for_vblanks(dev, state); | 158 | drm_atomic_helper_wait_for_vblanks(dev, state); |
| 188 | drm_atomic_helper_cleanup_planes(dev, state); | 159 | drm_atomic_helper_cleanup_planes(dev, state); |
| 189 | drm_atomic_state_free(state); | 160 | drm_atomic_state_free(state); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 30e0f54ba19d..87476ff181dd 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -11826,7 +11826,9 @@ encoder_retry: | |||
| 11826 | goto encoder_retry; | 11826 | goto encoder_retry; |
| 11827 | } | 11827 | } |
| 11828 | 11828 | ||
| 11829 | pipe_config->dither = pipe_config->pipe_bpp != base_bpp; | 11829 | /* Dithering seems to not pass-through bits correctly when it should, so |
| 11830 | * only enable it on 6bpc panels. */ | ||
| 11831 | pipe_config->dither = pipe_config->pipe_bpp == 6*3; | ||
| 11830 | DRM_DEBUG_KMS("plane bpp: %i, pipe bpp: %i, dithering: %i\n", | 11832 | DRM_DEBUG_KMS("plane bpp: %i, pipe bpp: %i, dithering: %i\n", |
| 11831 | base_bpp, pipe_config->pipe_bpp, pipe_config->dither); | 11833 | base_bpp, pipe_config->pipe_bpp, pipe_config->dither); |
| 11832 | 11834 | ||
| @@ -12624,17 +12626,17 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc, | |||
| 12624 | 12626 | ||
| 12625 | modeset_update_crtc_power_domains(state); | 12627 | modeset_update_crtc_power_domains(state); |
| 12626 | 12628 | ||
| 12627 | drm_atomic_helper_commit_planes(dev, state); | ||
| 12628 | |||
| 12629 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ | 12629 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ |
| 12630 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | 12630 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
| 12631 | if (!needs_modeset(crtc->state) || !crtc->state->enable) | 12631 | if (!needs_modeset(crtc->state) || !crtc->state->enable) { |
| 12632 | drm_atomic_helper_commit_planes_on_crtc(crtc_state); | ||
| 12632 | continue; | 12633 | continue; |
| 12634 | } | ||
| 12633 | 12635 | ||
| 12634 | update_scanline_offset(to_intel_crtc(crtc)); | 12636 | update_scanline_offset(to_intel_crtc(crtc)); |
| 12635 | 12637 | ||
| 12636 | dev_priv->display.crtc_enable(crtc); | 12638 | dev_priv->display.crtc_enable(crtc); |
| 12637 | intel_crtc_enable_planes(crtc); | 12639 | drm_atomic_helper_commit_planes_on_crtc(crtc_state); |
| 12638 | } | 12640 | } |
| 12639 | 12641 | ||
| 12640 | /* FIXME: add subpixel order */ | 12642 | /* FIXME: add subpixel order */ |
| @@ -12891,20 +12893,11 @@ intel_modeset_stage_output_state(struct drm_device *dev, | |||
| 12891 | return 0; | 12893 | return 0; |
| 12892 | } | 12894 | } |
| 12893 | 12895 | ||
| 12894 | static bool primary_plane_visible(struct drm_crtc *crtc) | ||
| 12895 | { | ||
| 12896 | struct intel_plane_state *plane_state = | ||
| 12897 | to_intel_plane_state(crtc->primary->state); | ||
| 12898 | |||
| 12899 | return plane_state->visible; | ||
| 12900 | } | ||
| 12901 | |||
| 12902 | static int intel_crtc_set_config(struct drm_mode_set *set) | 12896 | static int intel_crtc_set_config(struct drm_mode_set *set) |
| 12903 | { | 12897 | { |
| 12904 | struct drm_device *dev; | 12898 | struct drm_device *dev; |
| 12905 | struct drm_atomic_state *state = NULL; | 12899 | struct drm_atomic_state *state = NULL; |
| 12906 | struct intel_crtc_state *pipe_config; | 12900 | struct intel_crtc_state *pipe_config; |
| 12907 | bool primary_plane_was_visible; | ||
| 12908 | int ret; | 12901 | int ret; |
| 12909 | 12902 | ||
| 12910 | BUG_ON(!set); | 12903 | BUG_ON(!set); |
| @@ -12943,38 +12936,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set) | |||
| 12943 | 12936 | ||
| 12944 | intel_update_pipe_size(to_intel_crtc(set->crtc)); | 12937 | intel_update_pipe_size(to_intel_crtc(set->crtc)); |
| 12945 | 12938 | ||
| 12946 | primary_plane_was_visible = primary_plane_visible(set->crtc); | ||
| 12947 | |||
| 12948 | ret = intel_set_mode_with_config(set->crtc, pipe_config, true); | 12939 | ret = intel_set_mode_with_config(set->crtc, pipe_config, true); |
| 12949 | 12940 | ||
| 12950 | if (ret == 0 && | ||
| 12951 | pipe_config->base.enable && | ||
| 12952 | pipe_config->base.planes_changed && | ||
| 12953 | !needs_modeset(&pipe_config->base)) { | ||
| 12954 | struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc); | ||
| 12955 | |||
| 12956 | /* | ||
| 12957 | * We need to make sure the primary plane is re-enabled if it | ||
| 12958 | * has previously been turned off. | ||
| 12959 | */ | ||
| 12960 | if (ret == 0 && !primary_plane_was_visible && | ||
| 12961 | primary_plane_visible(set->crtc)) { | ||
| 12962 | WARN_ON(!intel_crtc->active); | ||
| 12963 | intel_post_enable_primary(set->crtc); | ||
| 12964 | } | ||
| 12965 | |||
| 12966 | /* | ||
| 12967 | * In the fastboot case this may be our only check of the | ||
| 12968 | * state after boot. It would be better to only do it on | ||
| 12969 | * the first update, but we don't have a nice way of doing that | ||
| 12970 | * (and really, set_config isn't used much for high freq page | ||
| 12971 | * flipping, so increasing its cost here shouldn't be a big | ||
| 12972 | * deal). | ||
| 12973 | */ | ||
| 12974 | if (i915.fastboot && ret == 0) | ||
| 12975 | intel_modeset_check_state(set->crtc->dev); | ||
| 12976 | } | ||
| 12977 | |||
| 12978 | if (ret) { | 12941 | if (ret) { |
| 12979 | DRM_DEBUG_KMS("failed to set mode on [CRTC:%d], err = %d\n", | 12942 | DRM_DEBUG_KMS("failed to set mode on [CRTC:%d], err = %d\n", |
| 12980 | set->crtc->base.id, ret); | 12943 | set->crtc->base.id, ret); |
| @@ -13305,6 +13268,9 @@ intel_check_primary_plane(struct drm_plane *plane, | |||
| 13305 | */ | 13268 | */ |
| 13306 | if (IS_BROADWELL(dev)) | 13269 | if (IS_BROADWELL(dev)) |
| 13307 | intel_crtc->atomic.wait_vblank = true; | 13270 | intel_crtc->atomic.wait_vblank = true; |
| 13271 | |||
| 13272 | if (crtc_state) | ||
| 13273 | intel_crtc->atomic.post_enable_primary = true; | ||
| 13308 | } | 13274 | } |
| 13309 | 13275 | ||
| 13310 | /* | 13276 | /* |
| @@ -13317,6 +13283,10 @@ intel_check_primary_plane(struct drm_plane *plane, | |||
| 13317 | if (!state->visible || !fb) | 13283 | if (!state->visible || !fb) |
| 13318 | intel_crtc->atomic.disable_ips = true; | 13284 | intel_crtc->atomic.disable_ips = true; |
| 13319 | 13285 | ||
| 13286 | if (!state->visible && old_state->visible && | ||
| 13287 | crtc_state && !needs_modeset(&crtc_state->base)) | ||
| 13288 | intel_crtc->atomic.pre_disable_primary = true; | ||
| 13289 | |||
| 13320 | intel_crtc->atomic.fb_bits |= | 13290 | intel_crtc->atomic.fb_bits |= |
| 13321 | INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); | 13291 | INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); |
| 13322 | 13292 | ||
| @@ -15034,6 +15004,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
| 15034 | struct intel_plane_state *plane_state; | 15004 | struct intel_plane_state *plane_state; |
| 15035 | 15005 | ||
| 15036 | memset(crtc->config, 0, sizeof(*crtc->config)); | 15006 | memset(crtc->config, 0, sizeof(*crtc->config)); |
| 15007 | crtc->config->base.crtc = &crtc->base; | ||
| 15037 | 15008 | ||
| 15038 | crtc->config->quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE; | 15009 | crtc->config->quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE; |
| 15039 | 15010 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 6e8faa253792..1df0e1fe235f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -93,9 +93,6 @@ static const struct dp_link_dpll chv_dpll[] = { | |||
| 93 | 93 | ||
| 94 | static const int skl_rates[] = { 162000, 216000, 270000, | 94 | static const int skl_rates[] = { 162000, 216000, 270000, |
| 95 | 324000, 432000, 540000 }; | 95 | 324000, 432000, 540000 }; |
| 96 | static const int chv_rates[] = { 162000, 202500, 210000, 216000, | ||
| 97 | 243000, 270000, 324000, 405000, | ||
| 98 | 420000, 432000, 540000 }; | ||
| 99 | static const int default_rates[] = { 162000, 270000, 540000 }; | 96 | static const int default_rates[] = { 162000, 270000, 540000 }; |
| 100 | 97 | ||
| 101 | /** | 98 | /** |
| @@ -1169,24 +1166,31 @@ intel_dp_sink_rates(struct intel_dp *intel_dp, const int **sink_rates) | |||
| 1169 | return (intel_dp_max_link_bw(intel_dp) >> 3) + 1; | 1166 | return (intel_dp_max_link_bw(intel_dp) >> 3) + 1; |
| 1170 | } | 1167 | } |
| 1171 | 1168 | ||
| 1169 | static bool intel_dp_source_supports_hbr2(struct drm_device *dev) | ||
| 1170 | { | ||
| 1171 | /* WaDisableHBR2:skl */ | ||
| 1172 | if (IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0) | ||
| 1173 | return false; | ||
| 1174 | |||
| 1175 | if ((IS_HASWELL(dev) && !IS_HSW_ULX(dev)) || IS_BROADWELL(dev) || | ||
| 1176 | (INTEL_INFO(dev)->gen >= 9)) | ||
| 1177 | return true; | ||
| 1178 | else | ||
| 1179 | return false; | ||
| 1180 | } | ||
| 1181 | |||
| 1172 | static int | 1182 | static int |
| 1173 | intel_dp_source_rates(struct drm_device *dev, const int **source_rates) | 1183 | intel_dp_source_rates(struct drm_device *dev, const int **source_rates) |
| 1174 | { | 1184 | { |
| 1175 | if (IS_SKYLAKE(dev)) { | 1185 | if (IS_SKYLAKE(dev)) { |
| 1176 | *source_rates = skl_rates; | 1186 | *source_rates = skl_rates; |
| 1177 | return ARRAY_SIZE(skl_rates); | 1187 | return ARRAY_SIZE(skl_rates); |
| 1178 | } else if (IS_CHERRYVIEW(dev)) { | ||
| 1179 | *source_rates = chv_rates; | ||
| 1180 | return ARRAY_SIZE(chv_rates); | ||
| 1181 | } | 1188 | } |
| 1182 | 1189 | ||
| 1183 | *source_rates = default_rates; | 1190 | *source_rates = default_rates; |
| 1184 | 1191 | ||
| 1185 | if (IS_SKYLAKE(dev) && INTEL_REVID(dev) <= SKL_REVID_B0) | 1192 | /* This depends on the fact that 5.4 is last value in the array */ |
| 1186 | /* WaDisableHBR2:skl */ | 1193 | if (intel_dp_source_supports_hbr2(dev)) |
| 1187 | return (DP_LINK_BW_2_7 >> 3) + 1; | ||
| 1188 | else if (INTEL_INFO(dev)->gen >= 8 || | ||
| 1189 | (IS_HASWELL(dev) && !IS_HSW_ULX(dev))) | ||
| 1190 | return (DP_LINK_BW_5_4 >> 3) + 1; | 1194 | return (DP_LINK_BW_5_4 >> 3) + 1; |
| 1191 | else | 1195 | else |
| 1192 | return (DP_LINK_BW_2_7 >> 3) + 1; | 1196 | return (DP_LINK_BW_2_7 >> 3) + 1; |
| @@ -3941,10 +3945,15 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) | |||
| 3941 | } | 3945 | } |
| 3942 | } | 3946 | } |
| 3943 | 3947 | ||
| 3944 | /* Training Pattern 3 support, both source and sink */ | 3948 | /* Training Pattern 3 support, Intel platforms that support HBR2 alone |
| 3949 | * have support for TP3 hence that check is used along with dpcd check | ||
| 3950 | * to ensure TP3 can be enabled. | ||
| 3951 | * SKL < B0: due it's WaDisableHBR2 is the only exception where TP3 is | ||
| 3952 | * supported but still not enabled. | ||
| 3953 | */ | ||
| 3945 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 && | 3954 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 && |
| 3946 | intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED && | 3955 | intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED && |
| 3947 | (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)) { | 3956 | intel_dp_source_supports_hbr2(dev)) { |
| 3948 | intel_dp->use_tps3 = true; | 3957 | intel_dp->use_tps3 = true; |
| 3949 | DRM_DEBUG_KMS("Displayport TPS3 supported\n"); | 3958 | DRM_DEBUG_KMS("Displayport TPS3 supported\n"); |
| 3950 | } else | 3959 | } else |
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 6e4cc5334f47..600afdbef8c9 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c | |||
| @@ -357,6 +357,16 @@ intel_dp_mst_mode_valid(struct drm_connector *connector, | |||
| 357 | return MODE_OK; | 357 | return MODE_OK; |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *connector, | ||
| 361 | struct drm_connector_state *state) | ||
| 362 | { | ||
| 363 | struct intel_connector *intel_connector = to_intel_connector(connector); | ||
| 364 | struct intel_dp *intel_dp = intel_connector->mst_port; | ||
| 365 | struct intel_crtc *crtc = to_intel_crtc(state->crtc); | ||
| 366 | |||
| 367 | return &intel_dp->mst_encoders[crtc->pipe]->base.base; | ||
| 368 | } | ||
| 369 | |||
| 360 | static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector) | 370 | static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connector) |
| 361 | { | 371 | { |
| 362 | struct intel_connector *intel_connector = to_intel_connector(connector); | 372 | struct intel_connector *intel_connector = to_intel_connector(connector); |
| @@ -367,6 +377,7 @@ static struct drm_encoder *intel_mst_best_encoder(struct drm_connector *connecto | |||
| 367 | static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = { | 377 | static const struct drm_connector_helper_funcs intel_dp_mst_connector_helper_funcs = { |
| 368 | .get_modes = intel_dp_mst_get_modes, | 378 | .get_modes = intel_dp_mst_get_modes, |
| 369 | .mode_valid = intel_dp_mst_mode_valid, | 379 | .mode_valid = intel_dp_mst_mode_valid, |
| 380 | .atomic_best_encoder = intel_mst_atomic_best_encoder, | ||
| 370 | .best_encoder = intel_mst_best_encoder, | 381 | .best_encoder = intel_mst_best_encoder, |
| 371 | }; | 382 | }; |
| 372 | 383 | ||
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 9b74ffae5f5a..7f2161a1ff5d 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
| @@ -1012,6 +1012,8 @@ static int intel_lr_context_pin(struct intel_engine_cs *ring, | |||
| 1012 | ret = intel_pin_and_map_ringbuffer_obj(ring->dev, ringbuf); | 1012 | ret = intel_pin_and_map_ringbuffer_obj(ring->dev, ringbuf); |
| 1013 | if (ret) | 1013 | if (ret) |
| 1014 | goto unpin_ctx_obj; | 1014 | goto unpin_ctx_obj; |
| 1015 | |||
| 1016 | ctx_obj->dirty = true; | ||
| 1015 | } | 1017 | } |
| 1016 | 1018 | ||
| 1017 | return ret; | 1019 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c index 52c22b026005..e10f9644140f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | |||
| @@ -166,30 +166,14 @@ gk104_fifo_context_attach(struct nvkm_object *parent, | |||
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | static int | 168 | static int |
| 169 | gk104_fifo_chan_kick(struct gk104_fifo_chan *chan) | ||
| 170 | { | ||
| 171 | struct nvkm_object *obj = (void *)chan; | ||
| 172 | struct gk104_fifo_priv *priv = (void *)obj->engine; | ||
| 173 | |||
| 174 | nv_wr32(priv, 0x002634, chan->base.chid); | ||
| 175 | if (!nv_wait(priv, 0x002634, 0x100000, 0x000000)) { | ||
| 176 | nv_error(priv, "channel %d [%s] kick timeout\n", | ||
| 177 | chan->base.chid, nvkm_client_name(chan)); | ||
| 178 | return -EBUSY; | ||
| 179 | } | ||
| 180 | |||
| 181 | return 0; | ||
| 182 | } | ||
| 183 | |||
| 184 | static int | ||
| 185 | gk104_fifo_context_detach(struct nvkm_object *parent, bool suspend, | 169 | gk104_fifo_context_detach(struct nvkm_object *parent, bool suspend, |
| 186 | struct nvkm_object *object) | 170 | struct nvkm_object *object) |
| 187 | { | 171 | { |
| 188 | struct nvkm_bar *bar = nvkm_bar(parent); | 172 | struct nvkm_bar *bar = nvkm_bar(parent); |
| 173 | struct gk104_fifo_priv *priv = (void *)parent->engine; | ||
| 189 | struct gk104_fifo_base *base = (void *)parent->parent; | 174 | struct gk104_fifo_base *base = (void *)parent->parent; |
| 190 | struct gk104_fifo_chan *chan = (void *)parent; | 175 | struct gk104_fifo_chan *chan = (void *)parent; |
| 191 | u32 addr; | 176 | u32 addr; |
| 192 | int ret; | ||
| 193 | 177 | ||
| 194 | switch (nv_engidx(object->engine)) { | 178 | switch (nv_engidx(object->engine)) { |
| 195 | case NVDEV_ENGINE_SW : return 0; | 179 | case NVDEV_ENGINE_SW : return 0; |
| @@ -204,9 +188,13 @@ gk104_fifo_context_detach(struct nvkm_object *parent, bool suspend, | |||
| 204 | return -EINVAL; | 188 | return -EINVAL; |
| 205 | } | 189 | } |
| 206 | 190 | ||
| 207 | ret = gk104_fifo_chan_kick(chan); | 191 | nv_wr32(priv, 0x002634, chan->base.chid); |
| 208 | if (ret && suspend) | 192 | if (!nv_wait(priv, 0x002634, 0xffffffff, chan->base.chid)) { |
| 209 | return ret; | 193 | nv_error(priv, "channel %d [%s] kick timeout\n", |
| 194 | chan->base.chid, nvkm_client_name(chan)); | ||
| 195 | if (suspend) | ||
| 196 | return -EBUSY; | ||
| 197 | } | ||
| 210 | 198 | ||
| 211 | if (addr) { | 199 | if (addr) { |
| 212 | nv_wo32(base, addr + 0x00, 0x00000000); | 200 | nv_wo32(base, addr + 0x00, 0x00000000); |
| @@ -331,7 +319,6 @@ gk104_fifo_chan_fini(struct nvkm_object *object, bool suspend) | |||
| 331 | gk104_fifo_runlist_update(priv, chan->engine); | 319 | gk104_fifo_runlist_update(priv, chan->engine); |
| 332 | } | 320 | } |
| 333 | 321 | ||
| 334 | gk104_fifo_chan_kick(chan); | ||
| 335 | nv_wr32(priv, 0x800000 + (chid * 8), 0x00000000); | 322 | nv_wr32(priv, 0x800000 + (chid * 8), 0x00000000); |
| 336 | return nvkm_fifo_channel_fini(&chan->base, suspend); | 323 | return nvkm_fifo_channel_fini(&chan->base, suspend); |
| 337 | } | 324 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 1162bfa464f3..171d3e43c30c 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
| @@ -79,6 +79,11 @@ static void radeon_hotplug_work_func(struct work_struct *work) | |||
| 79 | struct drm_mode_config *mode_config = &dev->mode_config; | 79 | struct drm_mode_config *mode_config = &dev->mode_config; |
| 80 | struct drm_connector *connector; | 80 | struct drm_connector *connector; |
| 81 | 81 | ||
| 82 | /* we can race here at startup, some boards seem to trigger | ||
| 83 | * hotplug irqs when they shouldn't. */ | ||
| 84 | if (!rdev->mode_info.mode_config_initialized) | ||
| 85 | return; | ||
| 86 | |||
| 82 | mutex_lock(&mode_config->mutex); | 87 | mutex_lock(&mode_config->mutex); |
| 83 | if (mode_config->num_connector) { | 88 | if (mode_config->num_connector) { |
| 84 | list_for_each_entry(connector, &mode_config->connector_list, head) | 89 | list_for_each_entry(connector, &mode_config->connector_list, head) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 654c8daeb5ab..97ad3bcb99a7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
| @@ -2492,7 +2492,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
| 2492 | ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, | 2492 | ret = ttm_eu_reserve_buffers(&ticket, &sw_context->validate_nodes, |
| 2493 | true, NULL); | 2493 | true, NULL); |
| 2494 | if (unlikely(ret != 0)) | 2494 | if (unlikely(ret != 0)) |
| 2495 | goto out_err; | 2495 | goto out_err_nores; |
| 2496 | 2496 | ||
| 2497 | ret = vmw_validate_buffers(dev_priv, sw_context); | 2497 | ret = vmw_validate_buffers(dev_priv, sw_context); |
| 2498 | if (unlikely(ret != 0)) | 2498 | if (unlikely(ret != 0)) |
| @@ -2536,6 +2536,7 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
| 2536 | vmw_resource_relocations_free(&sw_context->res_relocations); | 2536 | vmw_resource_relocations_free(&sw_context->res_relocations); |
| 2537 | 2537 | ||
| 2538 | vmw_fifo_commit(dev_priv, command_size); | 2538 | vmw_fifo_commit(dev_priv, command_size); |
| 2539 | mutex_unlock(&dev_priv->binding_mutex); | ||
| 2539 | 2540 | ||
| 2540 | vmw_query_bo_switch_commit(dev_priv, sw_context); | 2541 | vmw_query_bo_switch_commit(dev_priv, sw_context); |
| 2541 | ret = vmw_execbuf_fence_commands(file_priv, dev_priv, | 2542 | ret = vmw_execbuf_fence_commands(file_priv, dev_priv, |
| @@ -2551,7 +2552,6 @@ int vmw_execbuf_process(struct drm_file *file_priv, | |||
| 2551 | DRM_ERROR("Fence submission error. Syncing.\n"); | 2552 | DRM_ERROR("Fence submission error. Syncing.\n"); |
| 2552 | 2553 | ||
| 2553 | vmw_resource_list_unreserve(&sw_context->resource_list, false); | 2554 | vmw_resource_list_unreserve(&sw_context->resource_list, false); |
| 2554 | mutex_unlock(&dev_priv->binding_mutex); | ||
| 2555 | 2555 | ||
| 2556 | ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes, | 2556 | ttm_eu_fence_buffer_objects(&ticket, &sw_context->validate_nodes, |
| 2557 | (void *) fence); | 2557 | (void *) fence); |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 3511bbaba505..e3c63640df73 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
| @@ -462,12 +462,15 @@ out: | |||
| 462 | 462 | ||
| 463 | static void hidinput_cleanup_battery(struct hid_device *dev) | 463 | static void hidinput_cleanup_battery(struct hid_device *dev) |
| 464 | { | 464 | { |
| 465 | const struct power_supply_desc *psy_desc; | ||
| 466 | |||
| 465 | if (!dev->battery) | 467 | if (!dev->battery) |
| 466 | return; | 468 | return; |
| 467 | 469 | ||
| 470 | psy_desc = dev->battery->desc; | ||
| 468 | power_supply_unregister(dev->battery); | 471 | power_supply_unregister(dev->battery); |
| 469 | kfree(dev->battery->desc->name); | 472 | kfree(psy_desc->name); |
| 470 | kfree(dev->battery->desc); | 473 | kfree(psy_desc); |
| 471 | dev->battery = NULL; | 474 | dev->battery = NULL; |
| 472 | } | 475 | } |
| 473 | #else /* !CONFIG_HID_BATTERY_STRENGTH */ | 476 | #else /* !CONFIG_HID_BATTERY_STRENGTH */ |
diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c index 94167310e15a..b905d501e752 100644 --- a/drivers/hid/hid-uclogic.c +++ b/drivers/hid/hid-uclogic.c | |||
| @@ -858,7 +858,7 @@ static int uclogic_tablet_enable(struct hid_device *hdev) | |||
| 858 | for (p = drvdata->rdesc; | 858 | for (p = drvdata->rdesc; |
| 859 | p <= drvdata->rdesc + drvdata->rsize - 4;) { | 859 | p <= drvdata->rdesc + drvdata->rsize - 4;) { |
| 860 | if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && | 860 | if (p[0] == 0xFE && p[1] == 0xED && p[2] == 0x1D && |
| 861 | p[3] < sizeof(params)) { | 861 | p[3] < ARRAY_SIZE(params)) { |
| 862 | v = params[p[3]]; | 862 | v = params[p[3]]; |
| 863 | put_unaligned(cpu_to_le32(v), (s32 *)p); | 863 | put_unaligned(cpu_to_le32(v), (s32 *)p); |
| 864 | p += 4; | 864 | p += 4; |
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index 44958d79d598..01b937e63cf3 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
| @@ -1284,6 +1284,39 @@ fail_register_pen_input: | |||
| 1284 | return error; | 1284 | return error; |
| 1285 | } | 1285 | } |
| 1286 | 1286 | ||
| 1287 | /* | ||
| 1288 | * Not all devices report physical dimensions from HID. | ||
| 1289 | * Compute the default from hardcoded logical dimension | ||
| 1290 | * and resolution before driver overwrites them. | ||
| 1291 | */ | ||
| 1292 | static void wacom_set_default_phy(struct wacom_features *features) | ||
| 1293 | { | ||
| 1294 | if (features->x_resolution) { | ||
| 1295 | features->x_phy = (features->x_max * 100) / | ||
| 1296 | features->x_resolution; | ||
| 1297 | features->y_phy = (features->y_max * 100) / | ||
| 1298 | features->y_resolution; | ||
| 1299 | } | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | static void wacom_calculate_res(struct wacom_features *features) | ||
| 1303 | { | ||
| 1304 | /* set unit to "100th of a mm" for devices not reported by HID */ | ||
| 1305 | if (!features->unit) { | ||
| 1306 | features->unit = 0x11; | ||
| 1307 | features->unitExpo = -3; | ||
| 1308 | } | ||
| 1309 | |||
| 1310 | features->x_resolution = wacom_calc_hid_res(features->x_max, | ||
| 1311 | features->x_phy, | ||
| 1312 | features->unit, | ||
| 1313 | features->unitExpo); | ||
| 1314 | features->y_resolution = wacom_calc_hid_res(features->y_max, | ||
| 1315 | features->y_phy, | ||
| 1316 | features->unit, | ||
| 1317 | features->unitExpo); | ||
| 1318 | } | ||
| 1319 | |||
| 1287 | static void wacom_wireless_work(struct work_struct *work) | 1320 | static void wacom_wireless_work(struct work_struct *work) |
| 1288 | { | 1321 | { |
| 1289 | struct wacom *wacom = container_of(work, struct wacom, work); | 1322 | struct wacom *wacom = container_of(work, struct wacom, work); |
| @@ -1341,6 +1374,8 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1341 | if (wacom_wac1->features.type != INTUOSHT && | 1374 | if (wacom_wac1->features.type != INTUOSHT && |
| 1342 | wacom_wac1->features.type != BAMBOO_PT) | 1375 | wacom_wac1->features.type != BAMBOO_PT) |
| 1343 | wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD; | 1376 | wacom_wac1->features.device_type |= WACOM_DEVICETYPE_PAD; |
| 1377 | wacom_set_default_phy(&wacom_wac1->features); | ||
| 1378 | wacom_calculate_res(&wacom_wac1->features); | ||
| 1344 | snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen", | 1379 | snprintf(wacom_wac1->pen_name, WACOM_NAME_MAX, "%s (WL) Pen", |
| 1345 | wacom_wac1->features.name); | 1380 | wacom_wac1->features.name); |
| 1346 | snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", | 1381 | snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", |
| @@ -1359,7 +1394,9 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1359 | wacom_wac2->features = | 1394 | wacom_wac2->features = |
| 1360 | *((struct wacom_features *)id->driver_data); | 1395 | *((struct wacom_features *)id->driver_data); |
| 1361 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; | 1396 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; |
| 1397 | wacom_set_default_phy(&wacom_wac2->features); | ||
| 1362 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; | 1398 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; |
| 1399 | wacom_calculate_res(&wacom_wac2->features); | ||
| 1363 | snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX, | 1400 | snprintf(wacom_wac2->touch_name, WACOM_NAME_MAX, |
| 1364 | "%s (WL) Finger",wacom_wac2->features.name); | 1401 | "%s (WL) Finger",wacom_wac2->features.name); |
| 1365 | snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX, | 1402 | snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX, |
| @@ -1407,39 +1444,6 @@ void wacom_battery_work(struct work_struct *work) | |||
| 1407 | } | 1444 | } |
| 1408 | } | 1445 | } |
| 1409 | 1446 | ||
| 1410 | /* | ||
| 1411 | * Not all devices report physical dimensions from HID. | ||
| 1412 | * Compute the default from hardcoded logical dimension | ||
| 1413 | * and resolution before driver overwrites them. | ||
| 1414 | */ | ||
| 1415 | static void wacom_set_default_phy(struct wacom_features *features) | ||
| 1416 | { | ||
| 1417 | if (features->x_resolution) { | ||
| 1418 | features->x_phy = (features->x_max * 100) / | ||
| 1419 | features->x_resolution; | ||
| 1420 | features->y_phy = (features->y_max * 100) / | ||
| 1421 | features->y_resolution; | ||
| 1422 | } | ||
| 1423 | } | ||
| 1424 | |||
| 1425 | static void wacom_calculate_res(struct wacom_features *features) | ||
| 1426 | { | ||
| 1427 | /* set unit to "100th of a mm" for devices not reported by HID */ | ||
| 1428 | if (!features->unit) { | ||
| 1429 | features->unit = 0x11; | ||
| 1430 | features->unitExpo = -3; | ||
| 1431 | } | ||
| 1432 | |||
| 1433 | features->x_resolution = wacom_calc_hid_res(features->x_max, | ||
| 1434 | features->x_phy, | ||
| 1435 | features->unit, | ||
| 1436 | features->unitExpo); | ||
| 1437 | features->y_resolution = wacom_calc_hid_res(features->y_max, | ||
| 1438 | features->y_phy, | ||
| 1439 | features->unit, | ||
| 1440 | features->unitExpo); | ||
| 1441 | } | ||
| 1442 | |||
| 1443 | static size_t wacom_compute_pktlen(struct hid_device *hdev) | 1447 | static size_t wacom_compute_pktlen(struct hid_device *hdev) |
| 1444 | { | 1448 | { |
| 1445 | struct hid_report_enum *report_enum; | 1449 | struct hid_report_enum *report_enum; |
diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 37c16afe007a..c8487894b312 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c | |||
| @@ -929,6 +929,21 @@ static struct dmi_system_id i8k_dmi_table[] __initdata = { | |||
| 929 | 929 | ||
| 930 | MODULE_DEVICE_TABLE(dmi, i8k_dmi_table); | 930 | MODULE_DEVICE_TABLE(dmi, i8k_dmi_table); |
| 931 | 931 | ||
| 932 | static struct dmi_system_id i8k_blacklist_dmi_table[] __initdata = { | ||
| 933 | { | ||
| 934 | /* | ||
| 935 | * CPU fan speed going up and down on Dell Studio XPS 8100 | ||
| 936 | * for unknown reasons. | ||
| 937 | */ | ||
| 938 | .ident = "Dell Studio XPS 8100", | ||
| 939 | .matches = { | ||
| 940 | DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
| 941 | DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Studio XPS 8100"), | ||
| 942 | }, | ||
| 943 | }, | ||
| 944 | { } | ||
| 945 | }; | ||
| 946 | |||
| 932 | /* | 947 | /* |
| 933 | * Probe for the presence of a supported laptop. | 948 | * Probe for the presence of a supported laptop. |
| 934 | */ | 949 | */ |
| @@ -940,7 +955,8 @@ static int __init i8k_probe(void) | |||
| 940 | /* | 955 | /* |
| 941 | * Get DMI information | 956 | * Get DMI information |
| 942 | */ | 957 | */ |
| 943 | if (!dmi_check_system(i8k_dmi_table)) { | 958 | if (!dmi_check_system(i8k_dmi_table) || |
| 959 | dmi_check_system(i8k_blacklist_dmi_table)) { | ||
| 944 | if (!ignore_dmi && !force) | 960 | if (!ignore_dmi && !force) |
| 945 | return -ENODEV; | 961 | return -ENODEV; |
| 946 | 962 | ||
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c index 9b55e673b67c..85d106fe3ce8 100644 --- a/drivers/hwmon/g762.c +++ b/drivers/hwmon/g762.c | |||
| @@ -582,6 +582,7 @@ static const struct of_device_id g762_dt_match[] = { | |||
| 582 | { .compatible = "gmt,g763" }, | 582 | { .compatible = "gmt,g763" }, |
| 583 | { }, | 583 | { }, |
| 584 | }; | 584 | }; |
| 585 | MODULE_DEVICE_TABLE(of, g762_dt_match); | ||
| 585 | 586 | ||
| 586 | /* | 587 | /* |
| 587 | * Grab clock (a required property), enable it, get (fixed) clock frequency | 588 | * Grab clock (a required property), enable it, get (fixed) clock frequency |
diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c index 6153df735e82..08ff89d222e5 100644 --- a/drivers/hwmon/nct7904.c +++ b/drivers/hwmon/nct7904.c | |||
| @@ -575,6 +575,7 @@ static const struct i2c_device_id nct7904_id[] = { | |||
| 575 | {"nct7904", 0}, | 575 | {"nct7904", 0}, |
| 576 | {} | 576 | {} |
| 577 | }; | 577 | }; |
| 578 | MODULE_DEVICE_TABLE(i2c, nct7904_id); | ||
| 578 | 579 | ||
| 579 | static struct i2c_driver nct7904_driver = { | 580 | static struct i2c_driver nct7904_driver = { |
| 580 | .class = I2C_CLASS_HWMON, | 581 | .class = I2C_CLASS_HWMON, |
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index af162b4c7a6d..025686d41640 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
| @@ -692,7 +692,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) | |||
| 692 | 692 | ||
| 693 | platform_set_drvdata(pdev, iface); | 693 | platform_set_drvdata(pdev, iface); |
| 694 | 694 | ||
| 695 | dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Contoller, " | 695 | dev_info(&pdev->dev, "Blackfin BF5xx on-chip I2C TWI Controller, " |
| 696 | "regs_base@%p\n", iface->regs_base); | 696 | "regs_base@%p\n", iface->regs_base); |
| 697 | 697 | ||
| 698 | return 0; | 698 | return 0; |
| @@ -735,6 +735,6 @@ subsys_initcall(i2c_bfin_twi_init); | |||
| 735 | module_exit(i2c_bfin_twi_exit); | 735 | module_exit(i2c_bfin_twi_exit); |
| 736 | 736 | ||
| 737 | MODULE_AUTHOR("Bryan Wu, Sonic Zhang"); | 737 | MODULE_AUTHOR("Bryan Wu, Sonic Zhang"); |
| 738 | MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Contoller Driver"); | 738 | MODULE_DESCRIPTION("Blackfin BF5xx on-chip I2C TWI Controller Driver"); |
| 739 | MODULE_LICENSE("GPL"); | 739 | MODULE_LICENSE("GPL"); |
| 740 | MODULE_ALIAS("platform:i2c-bfin-twi"); | 740 | MODULE_ALIAS("platform:i2c-bfin-twi"); |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index d1c22e3fdd14..fc9bf7f30e35 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
| @@ -1247,7 +1247,14 @@ static void omap_i2c_prepare_recovery(struct i2c_adapter *adap) | |||
| 1247 | u32 reg; | 1247 | u32 reg; |
| 1248 | 1248 | ||
| 1249 | reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); | 1249 | reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); |
| 1250 | /* enable test mode */ | ||
| 1250 | reg |= OMAP_I2C_SYSTEST_ST_EN; | 1251 | reg |= OMAP_I2C_SYSTEST_ST_EN; |
| 1252 | /* select SDA/SCL IO mode */ | ||
| 1253 | reg |= 3 << OMAP_I2C_SYSTEST_TMODE_SHIFT; | ||
| 1254 | /* set SCL to high-impedance state (reset value is 0) */ | ||
| 1255 | reg |= OMAP_I2C_SYSTEST_SCL_O; | ||
| 1256 | /* set SDA to high-impedance state (reset value is 0) */ | ||
| 1257 | reg |= OMAP_I2C_SYSTEST_SDA_O; | ||
| 1251 | omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); | 1258 | omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); |
| 1252 | } | 1259 | } |
| 1253 | 1260 | ||
| @@ -1257,7 +1264,11 @@ static void omap_i2c_unprepare_recovery(struct i2c_adapter *adap) | |||
| 1257 | u32 reg; | 1264 | u32 reg; |
| 1258 | 1265 | ||
| 1259 | reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); | 1266 | reg = omap_i2c_read_reg(dev, OMAP_I2C_SYSTEST_REG); |
| 1267 | /* restore reset values */ | ||
| 1260 | reg &= ~OMAP_I2C_SYSTEST_ST_EN; | 1268 | reg &= ~OMAP_I2C_SYSTEST_ST_EN; |
| 1269 | reg &= ~OMAP_I2C_SYSTEST_TMODE_MASK; | ||
| 1270 | reg &= ~OMAP_I2C_SYSTEST_SCL_O; | ||
| 1271 | reg &= ~OMAP_I2C_SYSTEST_SDA_O; | ||
| 1261 | omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); | 1272 | omap_i2c_write_reg(dev, OMAP_I2C_SYSTEST_REG, reg); |
| 1262 | } | 1273 | } |
| 1263 | 1274 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index e6d4935161e4..c83e4d13cfc5 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
| @@ -567,6 +567,9 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) | |||
| 567 | if (bri->prepare_recovery) | 567 | if (bri->prepare_recovery) |
| 568 | bri->prepare_recovery(adap); | 568 | bri->prepare_recovery(adap); |
| 569 | 569 | ||
| 570 | bri->set_scl(adap, val); | ||
| 571 | ndelay(RECOVERY_NDELAY); | ||
| 572 | |||
| 570 | /* | 573 | /* |
| 571 | * By this time SCL is high, as we need to give 9 falling-rising edges | 574 | * By this time SCL is high, as we need to give 9 falling-rising edges |
| 572 | */ | 575 | */ |
| @@ -597,7 +600,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap) | |||
| 597 | 600 | ||
| 598 | int i2c_generic_scl_recovery(struct i2c_adapter *adap) | 601 | int i2c_generic_scl_recovery(struct i2c_adapter *adap) |
| 599 | { | 602 | { |
| 600 | adap->bus_recovery_info->set_scl(adap, 1); | ||
| 601 | return i2c_generic_recovery(adap); | 603 | return i2c_generic_recovery(adap); |
| 602 | } | 604 | } |
| 603 | EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); | 605 | EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); |
| @@ -1338,13 +1340,17 @@ static int of_dev_node_match(struct device *dev, void *data) | |||
| 1338 | struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) | 1340 | struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) |
| 1339 | { | 1341 | { |
| 1340 | struct device *dev; | 1342 | struct device *dev; |
| 1343 | struct i2c_client *client; | ||
| 1341 | 1344 | ||
| 1342 | dev = bus_find_device(&i2c_bus_type, NULL, node, | 1345 | dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match); |
| 1343 | of_dev_node_match); | ||
| 1344 | if (!dev) | 1346 | if (!dev) |
| 1345 | return NULL; | 1347 | return NULL; |
| 1346 | 1348 | ||
| 1347 | return i2c_verify_client(dev); | 1349 | client = i2c_verify_client(dev); |
| 1350 | if (!client) | ||
| 1351 | put_device(dev); | ||
| 1352 | |||
| 1353 | return client; | ||
| 1348 | } | 1354 | } |
| 1349 | EXPORT_SYMBOL(of_find_i2c_device_by_node); | 1355 | EXPORT_SYMBOL(of_find_i2c_device_by_node); |
| 1350 | 1356 | ||
| @@ -1352,13 +1358,17 @@ EXPORT_SYMBOL(of_find_i2c_device_by_node); | |||
| 1352 | struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node) | 1358 | struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node) |
| 1353 | { | 1359 | { |
| 1354 | struct device *dev; | 1360 | struct device *dev; |
| 1361 | struct i2c_adapter *adapter; | ||
| 1355 | 1362 | ||
| 1356 | dev = bus_find_device(&i2c_bus_type, NULL, node, | 1363 | dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match); |
| 1357 | of_dev_node_match); | ||
| 1358 | if (!dev) | 1364 | if (!dev) |
| 1359 | return NULL; | 1365 | return NULL; |
| 1360 | 1366 | ||
| 1361 | return i2c_verify_adapter(dev); | 1367 | adapter = i2c_verify_adapter(dev); |
| 1368 | if (!adapter) | ||
| 1369 | put_device(dev); | ||
| 1370 | |||
| 1371 | return adapter; | ||
| 1362 | } | 1372 | } |
| 1363 | EXPORT_SYMBOL(of_find_i2c_adapter_by_node); | 1373 | EXPORT_SYMBOL(of_find_i2c_adapter_by_node); |
| 1364 | #else | 1374 | #else |
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c index 822374654609..1da449614779 100644 --- a/drivers/i2c/i2c-slave-eeprom.c +++ b/drivers/i2c/i2c-slave-eeprom.c | |||
| @@ -80,9 +80,6 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj | |||
| 80 | struct eeprom_data *eeprom; | 80 | struct eeprom_data *eeprom; |
| 81 | unsigned long flags; | 81 | unsigned long flags; |
| 82 | 82 | ||
| 83 | if (off + count > attr->size) | ||
| 84 | return -EFBIG; | ||
| 85 | |||
| 86 | eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); | 83 | eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); |
| 87 | 84 | ||
| 88 | spin_lock_irqsave(&eeprom->buffer_lock, flags); | 85 | spin_lock_irqsave(&eeprom->buffer_lock, flags); |
| @@ -98,9 +95,6 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob | |||
| 98 | struct eeprom_data *eeprom; | 95 | struct eeprom_data *eeprom; |
| 99 | unsigned long flags; | 96 | unsigned long flags; |
| 100 | 97 | ||
| 101 | if (off + count > attr->size) | ||
| 102 | return -EFBIG; | ||
| 103 | |||
| 104 | eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); | 98 | eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); |
| 105 | 99 | ||
| 106 | spin_lock_irqsave(&eeprom->buffer_lock, flags); | 100 | spin_lock_irqsave(&eeprom->buffer_lock, flags); |
diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c index c7aab48f07cd..92d518382a9f 100644 --- a/drivers/infiniband/hw/cxgb4/cq.c +++ b/drivers/infiniband/hw/cxgb4/cq.c | |||
| @@ -814,7 +814,7 @@ static int c4iw_poll_cq_one(struct c4iw_cq *chp, struct ib_wc *wc) | |||
| 814 | printk(KERN_ERR MOD | 814 | printk(KERN_ERR MOD |
| 815 | "Unexpected cqe_status 0x%x for QPID=0x%0x\n", | 815 | "Unexpected cqe_status 0x%x for QPID=0x%0x\n", |
| 816 | CQE_STATUS(&cqe), CQE_QPID(&cqe)); | 816 | CQE_STATUS(&cqe), CQE_QPID(&cqe)); |
| 817 | ret = -EINVAL; | 817 | wc->status = IB_WC_FATAL_ERR; |
| 818 | } | 818 | } |
| 819 | } | 819 | } |
| 820 | out: | 820 | out: |
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index 27b6a3ce18ca..891797ad76bc 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c | |||
| @@ -196,7 +196,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
| 196 | if (n_buttons[i] < 1) | 196 | if (n_buttons[i] < 1) |
| 197 | continue; | 197 | continue; |
| 198 | 198 | ||
| 199 | if (n_buttons[i] > 6) { | 199 | if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) { |
| 200 | printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); | 200 | printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); |
| 201 | err = -EINVAL; | 201 | err = -EINVAL; |
| 202 | goto err_unreg_devs; | 202 | goto err_unreg_devs; |
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index 097d7216d98e..c6dc644aa580 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
| @@ -246,7 +246,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev) | |||
| 246 | * convert it to descriptor. | 246 | * convert it to descriptor. |
| 247 | */ | 247 | */ |
| 248 | if (!button->gpiod && gpio_is_valid(button->gpio)) { | 248 | if (!button->gpiod && gpio_is_valid(button->gpio)) { |
| 249 | unsigned flags = 0; | 249 | unsigned flags = GPIOF_IN; |
| 250 | 250 | ||
| 251 | if (button->active_low) | 251 | if (button->active_low) |
| 252 | flags |= GPIOF_ACTIVE_LOW; | 252 | flags |= GPIOF_ACTIVE_LOW; |
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c index 10e140af5aac..1ac898db303a 100644 --- a/drivers/input/misc/axp20x-pek.c +++ b/drivers/input/misc/axp20x-pek.c | |||
| @@ -292,3 +292,4 @@ module_platform_driver(axp20x_pek_driver); | |||
| 292 | MODULE_DESCRIPTION("axp20x Power Button"); | 292 | MODULE_DESCRIPTION("axp20x Power Button"); |
| 293 | MODULE_AUTHOR("Carlo Caione <carlo@caione.org>"); | 293 | MODULE_AUTHOR("Carlo Caione <carlo@caione.org>"); |
| 294 | MODULE_LICENSE("GPL"); | 294 | MODULE_LICENSE("GPL"); |
| 295 | MODULE_ALIAS("platform:axp20x-pek"); | ||
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index fc17b9592f54..10c4e3d462f1 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c | |||
| @@ -183,7 +183,8 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata, | |||
| 183 | if (pdata && pdata->coexist) | 183 | if (pdata && pdata->coexist) |
| 184 | return true; | 184 | return true; |
| 185 | 185 | ||
| 186 | if (of_find_node_by_name(node, "codec")) { | 186 | node = of_find_node_by_name(node, "codec"); |
| 187 | if (node) { | ||
| 187 | of_node_put(node); | 188 | of_node_put(node); |
| 188 | return true; | 189 | return true; |
| 189 | } | 190 | } |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 113d6f1516a5..4d246861d692 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/input/mt.h> | 20 | #include <linux/input/mt.h> |
| 21 | #include <linux/serio.h> | 21 | #include <linux/serio.h> |
| 22 | #include <linux/libps2.h> | 22 | #include <linux/libps2.h> |
| 23 | #include <linux/dmi.h> | ||
| 23 | 24 | ||
| 24 | #include "psmouse.h" | 25 | #include "psmouse.h" |
| 25 | #include "alps.h" | 26 | #include "alps.h" |
| @@ -99,6 +100,7 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = { | |||
| 99 | #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ | 100 | #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ |
| 100 | #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with | 101 | #define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with |
| 101 | 6-byte ALPS packet */ | 102 | 6-byte ALPS packet */ |
| 103 | #define ALPS_DELL 0x100 /* device is a Dell laptop */ | ||
| 102 | #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */ | 104 | #define ALPS_BUTTONPAD 0x200 /* device is a clickpad */ |
| 103 | 105 | ||
| 104 | static const struct alps_model_info alps_model_data[] = { | 106 | static const struct alps_model_info alps_model_data[] = { |
| @@ -251,9 +253,9 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse) | |||
| 251 | return; | 253 | return; |
| 252 | } | 254 | } |
| 253 | 255 | ||
| 254 | /* Non interleaved V2 dualpoint has separate stick button bits */ | 256 | /* Dell non interleaved V2 dualpoint has separate stick button bits */ |
| 255 | if (priv->proto_version == ALPS_PROTO_V2 && | 257 | if (priv->proto_version == ALPS_PROTO_V2 && |
| 256 | priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) { | 258 | priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) { |
| 257 | left |= packet[0] & 1; | 259 | left |= packet[0] & 1; |
| 258 | right |= packet[0] & 2; | 260 | right |= packet[0] & 2; |
| 259 | middle |= packet[0] & 4; | 261 | middle |= packet[0] & 4; |
| @@ -2550,6 +2552,8 @@ static int alps_set_protocol(struct psmouse *psmouse, | |||
| 2550 | priv->byte0 = protocol->byte0; | 2552 | priv->byte0 = protocol->byte0; |
| 2551 | priv->mask0 = protocol->mask0; | 2553 | priv->mask0 = protocol->mask0; |
| 2552 | priv->flags = protocol->flags; | 2554 | priv->flags = protocol->flags; |
| 2555 | if (dmi_name_in_vendors("Dell")) | ||
| 2556 | priv->flags |= ALPS_DELL; | ||
| 2553 | 2557 | ||
| 2554 | priv->x_max = 2000; | 2558 | priv->x_max = 2000; |
| 2555 | priv->y_max = 1400; | 2559 | priv->y_max = 1400; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 22b9ca901f4e..2955f1d0ca6c 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
| @@ -783,19 +783,26 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) | |||
| 783 | struct elantech_data *etd = psmouse->private; | 783 | struct elantech_data *etd = psmouse->private; |
| 784 | unsigned char *packet = psmouse->packet; | 784 | unsigned char *packet = psmouse->packet; |
| 785 | unsigned char packet_type = packet[3] & 0x03; | 785 | unsigned char packet_type = packet[3] & 0x03; |
| 786 | unsigned int ic_version; | ||
| 786 | bool sanity_check; | 787 | bool sanity_check; |
| 787 | 788 | ||
| 788 | if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) | 789 | if (etd->tp_dev && (packet[3] & 0x0f) == 0x06) |
| 789 | return PACKET_TRACKPOINT; | 790 | return PACKET_TRACKPOINT; |
| 790 | 791 | ||
| 792 | /* This represents the version of IC body. */ | ||
| 793 | ic_version = (etd->fw_version & 0x0f0000) >> 16; | ||
| 794 | |||
| 791 | /* | 795 | /* |
| 792 | * Sanity check based on the constant bits of a packet. | 796 | * Sanity check based on the constant bits of a packet. |
| 793 | * The constant bits change depending on the value of | 797 | * The constant bits change depending on the value of |
| 794 | * the hardware flag 'crc_enabled' but are the same for | 798 | * the hardware flag 'crc_enabled' and the version of |
| 795 | * every packet, regardless of the type. | 799 | * the IC body, but are the same for every packet, |
| 800 | * regardless of the type. | ||
| 796 | */ | 801 | */ |
| 797 | if (etd->crc_enabled) | 802 | if (etd->crc_enabled) |
| 798 | sanity_check = ((packet[3] & 0x08) == 0x00); | 803 | sanity_check = ((packet[3] & 0x08) == 0x00); |
| 804 | else if (ic_version == 7 && etd->samples[1] == 0x2A) | ||
| 805 | sanity_check = ((packet[3] & 0x1c) == 0x10); | ||
| 799 | else | 806 | else |
| 800 | sanity_check = ((packet[0] & 0x0c) == 0x04 && | 807 | sanity_check = ((packet[0] & 0x0c) == 0x04 && |
| 801 | (packet[3] & 0x1c) == 0x10); | 808 | (packet[3] & 0x1c) == 0x10); |
| @@ -1116,6 +1123,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, | |||
| 1116 | * Avatar AVIU-145A2 0x361f00 ? clickpad | 1123 | * Avatar AVIU-145A2 0x361f00 ? clickpad |
| 1117 | * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons | 1124 | * Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons |
| 1118 | * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons | 1125 | * Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons |
| 1126 | * Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons | ||
| 1119 | * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) | 1127 | * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) |
| 1120 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons | 1128 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons |
| 1121 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) | 1129 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) |
| @@ -1651,6 +1659,16 @@ int elantech_init(struct psmouse *psmouse) | |||
| 1651 | etd->capabilities[0], etd->capabilities[1], | 1659 | etd->capabilities[0], etd->capabilities[1], |
| 1652 | etd->capabilities[2]); | 1660 | etd->capabilities[2]); |
| 1653 | 1661 | ||
| 1662 | if (etd->hw_version != 1) { | ||
| 1663 | if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) { | ||
| 1664 | psmouse_err(psmouse, "failed to query sample data\n"); | ||
| 1665 | goto init_fail; | ||
| 1666 | } | ||
| 1667 | psmouse_info(psmouse, | ||
| 1668 | "Elan sample query result %02x, %02x, %02x\n", | ||
| 1669 | etd->samples[0], etd->samples[1], etd->samples[2]); | ||
| 1670 | } | ||
| 1671 | |||
| 1654 | if (elantech_set_absolute_mode(psmouse)) { | 1672 | if (elantech_set_absolute_mode(psmouse)) { |
| 1655 | psmouse_err(psmouse, | 1673 | psmouse_err(psmouse, |
| 1656 | "failed to put touchpad into absolute mode.\n"); | 1674 | "failed to put touchpad into absolute mode.\n"); |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index f965d1569cc3..e1cbf409d9c8 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
| @@ -129,6 +129,7 @@ struct elantech_data { | |||
| 129 | unsigned char reg_26; | 129 | unsigned char reg_26; |
| 130 | unsigned char debug; | 130 | unsigned char debug; |
| 131 | unsigned char capabilities[3]; | 131 | unsigned char capabilities[3]; |
| 132 | unsigned char samples[3]; | ||
| 132 | bool paritycheck; | 133 | bool paritycheck; |
| 133 | bool jumpy_cursor; | 134 | bool jumpy_cursor; |
| 134 | bool reports_pressure; | 135 | bool reports_pressure; |
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 692fe2bc8197..c12bb93334ff 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c | |||
| @@ -68,7 +68,9 @@ static struct irq_chip crossbar_chip = { | |||
| 68 | .irq_mask = irq_chip_mask_parent, | 68 | .irq_mask = irq_chip_mask_parent, |
| 69 | .irq_unmask = irq_chip_unmask_parent, | 69 | .irq_unmask = irq_chip_unmask_parent, |
| 70 | .irq_retrigger = irq_chip_retrigger_hierarchy, | 70 | .irq_retrigger = irq_chip_retrigger_hierarchy, |
| 71 | .irq_set_wake = irq_chip_set_wake_parent, | 71 | .irq_set_type = irq_chip_set_type_parent, |
| 72 | .flags = IRQCHIP_MASK_ON_SUSPEND | | ||
| 73 | IRQCHIP_SKIP_SET_WAKE, | ||
| 72 | #ifdef CONFIG_SMP | 74 | #ifdef CONFIG_SMP |
| 73 | .irq_set_affinity = irq_chip_set_affinity_parent, | 75 | .irq_set_affinity = irq_chip_set_affinity_parent, |
| 74 | #endif | 76 | #endif |
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index b7d54d428b5e..ff4be0515a0d 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c | |||
| @@ -538,7 +538,7 @@ static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) | |||
| 538 | 538 | ||
| 539 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) | 539 | static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) |
| 540 | { | 540 | { |
| 541 | smp_call_function_interrupt(); | 541 | generic_smp_call_function_interrupt(); |
| 542 | 542 | ||
| 543 | return IRQ_HANDLED; | 543 | return IRQ_HANDLED; |
| 544 | } | 544 | } |
diff --git a/drivers/md/dm-cache-policy-mq.c b/drivers/md/dm-cache-policy-mq.c index 32814371b8d3..aa1b41ca40f7 100644 --- a/drivers/md/dm-cache-policy-mq.c +++ b/drivers/md/dm-cache-policy-mq.c | |||
| @@ -1471,5 +1471,3 @@ module_exit(mq_exit); | |||
| 1471 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); | 1471 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); |
| 1472 | MODULE_LICENSE("GPL"); | 1472 | MODULE_LICENSE("GPL"); |
| 1473 | MODULE_DESCRIPTION("mq cache policy"); | 1473 | MODULE_DESCRIPTION("mq cache policy"); |
| 1474 | |||
| 1475 | MODULE_ALIAS("dm-cache-default"); | ||
diff --git a/drivers/md/dm-cache-policy-smq.c b/drivers/md/dm-cache-policy-smq.c index 48a4a826ae07..200366c62231 100644 --- a/drivers/md/dm-cache-policy-smq.c +++ b/drivers/md/dm-cache-policy-smq.c | |||
| @@ -1789,3 +1789,5 @@ module_exit(smq_exit); | |||
| 1789 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); | 1789 | MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>"); |
| 1790 | MODULE_LICENSE("GPL"); | 1790 | MODULE_LICENSE("GPL"); |
| 1791 | MODULE_DESCRIPTION("smq cache policy"); | 1791 | MODULE_DESCRIPTION("smq cache policy"); |
| 1792 | |||
| 1793 | MODULE_ALIAS("dm-cache-default"); | ||
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 48dfe3c4d6aa..6ba47cfb1443 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
| @@ -1293,8 +1293,8 @@ static int __release_metadata_snap(struct dm_pool_metadata *pmd) | |||
| 1293 | return r; | 1293 | return r; |
| 1294 | 1294 | ||
| 1295 | disk_super = dm_block_data(copy); | 1295 | disk_super = dm_block_data(copy); |
| 1296 | dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root)); | 1296 | dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root)); |
| 1297 | dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root)); | 1297 | dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root)); |
| 1298 | dm_sm_dec_block(pmd->metadata_sm, held_root); | 1298 | dm_sm_dec_block(pmd->metadata_sm, held_root); |
| 1299 | 1299 | ||
| 1300 | return dm_tm_unlock(pmd->tm, copy); | 1300 | return dm_tm_unlock(pmd->tm, copy); |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index ab37ae114e94..0d7ab20c58df 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -1729,7 +1729,8 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 1729 | struct mapped_device *md = q->queuedata; | 1729 | struct mapped_device *md = q->queuedata; |
| 1730 | struct dm_table *map = dm_get_live_table_fast(md); | 1730 | struct dm_table *map = dm_get_live_table_fast(md); |
| 1731 | struct dm_target *ti; | 1731 | struct dm_target *ti; |
| 1732 | sector_t max_sectors, max_size = 0; | 1732 | sector_t max_sectors; |
| 1733 | int max_size = 0; | ||
| 1733 | 1734 | ||
| 1734 | if (unlikely(!map)) | 1735 | if (unlikely(!map)) |
| 1735 | goto out; | 1736 | goto out; |
| @@ -1742,18 +1743,10 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 1742 | * Find maximum amount of I/O that won't need splitting | 1743 | * Find maximum amount of I/O that won't need splitting |
| 1743 | */ | 1744 | */ |
| 1744 | max_sectors = min(max_io_len(bvm->bi_sector, ti), | 1745 | max_sectors = min(max_io_len(bvm->bi_sector, ti), |
| 1745 | (sector_t) queue_max_sectors(q)); | 1746 | (sector_t) BIO_MAX_SECTORS); |
| 1746 | max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; | 1747 | max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; |
| 1747 | 1748 | if (max_size < 0) | |
| 1748 | /* | 1749 | max_size = 0; |
| 1749 | * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t | ||
| 1750 | * to the targets' merge function since it holds sectors not bytes). | ||
| 1751 | * Just doing this as an interim fix for stable@ because the more | ||
| 1752 | * comprehensive cleanup of switching to sector_t will impact every | ||
| 1753 | * DM target that implements a ->merge hook. | ||
| 1754 | */ | ||
| 1755 | if (max_size > INT_MAX) | ||
| 1756 | max_size = INT_MAX; | ||
| 1757 | 1750 | ||
| 1758 | /* | 1751 | /* |
| 1759 | * merge_bvec_fn() returns number of bytes | 1752 | * merge_bvec_fn() returns number of bytes |
| @@ -1761,13 +1754,13 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 1761 | * max is precomputed maximal io size | 1754 | * max is precomputed maximal io size |
| 1762 | */ | 1755 | */ |
| 1763 | if (max_size && ti->type->merge) | 1756 | if (max_size && ti->type->merge) |
| 1764 | max_size = ti->type->merge(ti, bvm, biovec, (int) max_size); | 1757 | max_size = ti->type->merge(ti, bvm, biovec, max_size); |
| 1765 | /* | 1758 | /* |
| 1766 | * If the target doesn't support merge method and some of the devices | 1759 | * If the target doesn't support merge method and some of the devices |
| 1767 | * provided their merge_bvec method (we know this by looking for the | 1760 | * provided their merge_bvec method (we know this by looking at |
| 1768 | * max_hw_sectors that dm_set_device_limits may set), then we can't | 1761 | * queue_max_hw_sectors), then we can't allow bios with multiple vector |
| 1769 | * allow bios with multiple vector entries. So always set max_size | 1762 | * entries. So always set max_size to 0, and the code below allows |
| 1770 | * to 0, and the code below allows just one page. | 1763 | * just one page. |
| 1771 | */ | 1764 | */ |
| 1772 | else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9) | 1765 | else if (queue_max_hw_sectors(q) <= PAGE_SIZE >> 9) |
| 1773 | max_size = 0; | 1766 | max_size = 0; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0c2a4e8b873c..e25f00f0138a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -5759,7 +5759,7 @@ static int get_bitmap_file(struct mddev *mddev, void __user * arg) | |||
| 5759 | char *ptr; | 5759 | char *ptr; |
| 5760 | int err; | 5760 | int err; |
| 5761 | 5761 | ||
| 5762 | file = kmalloc(sizeof(*file), GFP_NOIO); | 5762 | file = kzalloc(sizeof(*file), GFP_NOIO); |
| 5763 | if (!file) | 5763 | if (!file) |
| 5764 | return -ENOMEM; | 5764 | return -ENOMEM; |
| 5765 | 5765 | ||
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h index bf2b80d5c470..8731b6ea026b 100644 --- a/drivers/md/persistent-data/dm-btree-internal.h +++ b/drivers/md/persistent-data/dm-btree-internal.h | |||
| @@ -138,4 +138,10 @@ int lower_bound(struct btree_node *n, uint64_t key); | |||
| 138 | 138 | ||
| 139 | extern struct dm_block_validator btree_node_validator; | 139 | extern struct dm_block_validator btree_node_validator; |
| 140 | 140 | ||
| 141 | /* | ||
| 142 | * Value type for upper levels of multi-level btrees. | ||
| 143 | */ | ||
| 144 | extern void init_le64_type(struct dm_transaction_manager *tm, | ||
| 145 | struct dm_btree_value_type *vt); | ||
| 146 | |||
| 141 | #endif /* DM_BTREE_INTERNAL_H */ | 147 | #endif /* DM_BTREE_INTERNAL_H */ |
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index 9836c0ae897c..4222f774cf36 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
| @@ -544,14 +544,6 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | |||
| 544 | return r; | 544 | return r; |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | static struct dm_btree_value_type le64_type = { | ||
| 548 | .context = NULL, | ||
| 549 | .size = sizeof(__le64), | ||
| 550 | .inc = NULL, | ||
| 551 | .dec = NULL, | ||
| 552 | .equal = NULL | ||
| 553 | }; | ||
| 554 | |||
| 555 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, | 547 | int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, |
| 556 | uint64_t *keys, dm_block_t *new_root) | 548 | uint64_t *keys, dm_block_t *new_root) |
| 557 | { | 549 | { |
| @@ -559,12 +551,14 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, | |||
| 559 | int index = 0, r = 0; | 551 | int index = 0, r = 0; |
| 560 | struct shadow_spine spine; | 552 | struct shadow_spine spine; |
| 561 | struct btree_node *n; | 553 | struct btree_node *n; |
| 554 | struct dm_btree_value_type le64_vt; | ||
| 562 | 555 | ||
| 556 | init_le64_type(info->tm, &le64_vt); | ||
| 563 | init_shadow_spine(&spine, info); | 557 | init_shadow_spine(&spine, info); |
| 564 | for (level = 0; level < info->levels; level++) { | 558 | for (level = 0; level < info->levels; level++) { |
| 565 | r = remove_raw(&spine, info, | 559 | r = remove_raw(&spine, info, |
| 566 | (level == last_level ? | 560 | (level == last_level ? |
| 567 | &info->value_type : &le64_type), | 561 | &info->value_type : &le64_vt), |
| 568 | root, keys[level], (unsigned *)&index); | 562 | root, keys[level], (unsigned *)&index); |
| 569 | if (r < 0) | 563 | if (r < 0) |
| 570 | break; | 564 | break; |
| @@ -654,11 +648,13 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, | |||
| 654 | int index = 0, r = 0; | 648 | int index = 0, r = 0; |
| 655 | struct shadow_spine spine; | 649 | struct shadow_spine spine; |
| 656 | struct btree_node *n; | 650 | struct btree_node *n; |
| 651 | struct dm_btree_value_type le64_vt; | ||
| 657 | uint64_t k; | 652 | uint64_t k; |
| 658 | 653 | ||
| 654 | init_le64_type(info->tm, &le64_vt); | ||
| 659 | init_shadow_spine(&spine, info); | 655 | init_shadow_spine(&spine, info); |
| 660 | for (level = 0; level < last_level; level++) { | 656 | for (level = 0; level < last_level; level++) { |
| 661 | r = remove_raw(&spine, info, &le64_type, | 657 | r = remove_raw(&spine, info, &le64_vt, |
| 662 | root, keys[level], (unsigned *) &index); | 658 | root, keys[level], (unsigned *) &index); |
| 663 | if (r < 0) | 659 | if (r < 0) |
| 664 | goto out; | 660 | goto out; |
| @@ -689,6 +685,7 @@ static int remove_one(struct dm_btree_info *info, dm_block_t root, | |||
| 689 | value_ptr(n, index)); | 685 | value_ptr(n, index)); |
| 690 | 686 | ||
| 691 | delete_at(n, index); | 687 | delete_at(n, index); |
| 688 | keys[last_level] = k + 1ull; | ||
| 692 | 689 | ||
| 693 | } else | 690 | } else |
| 694 | r = -ENODATA; | 691 | r = -ENODATA; |
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c index 1b5e13ec7f96..0dee514ba4c5 100644 --- a/drivers/md/persistent-data/dm-btree-spine.c +++ b/drivers/md/persistent-data/dm-btree-spine.c | |||
| @@ -249,3 +249,40 @@ int shadow_root(struct shadow_spine *s) | |||
| 249 | { | 249 | { |
| 250 | return s->root; | 250 | return s->root; |
| 251 | } | 251 | } |
| 252 | |||
| 253 | static void le64_inc(void *context, const void *value_le) | ||
| 254 | { | ||
| 255 | struct dm_transaction_manager *tm = context; | ||
| 256 | __le64 v_le; | ||
| 257 | |||
| 258 | memcpy(&v_le, value_le, sizeof(v_le)); | ||
| 259 | dm_tm_inc(tm, le64_to_cpu(v_le)); | ||
| 260 | } | ||
| 261 | |||
| 262 | static void le64_dec(void *context, const void *value_le) | ||
| 263 | { | ||
| 264 | struct dm_transaction_manager *tm = context; | ||
| 265 | __le64 v_le; | ||
| 266 | |||
| 267 | memcpy(&v_le, value_le, sizeof(v_le)); | ||
| 268 | dm_tm_dec(tm, le64_to_cpu(v_le)); | ||
| 269 | } | ||
| 270 | |||
| 271 | static int le64_equal(void *context, const void *value1_le, const void *value2_le) | ||
| 272 | { | ||
| 273 | __le64 v1_le, v2_le; | ||
| 274 | |||
| 275 | memcpy(&v1_le, value1_le, sizeof(v1_le)); | ||
| 276 | memcpy(&v2_le, value2_le, sizeof(v2_le)); | ||
| 277 | return v1_le == v2_le; | ||
| 278 | } | ||
| 279 | |||
| 280 | void init_le64_type(struct dm_transaction_manager *tm, | ||
| 281 | struct dm_btree_value_type *vt) | ||
| 282 | { | ||
| 283 | vt->context = tm; | ||
| 284 | vt->size = sizeof(__le64); | ||
| 285 | vt->inc = le64_inc; | ||
| 286 | vt->dec = le64_dec; | ||
| 287 | vt->equal = le64_equal; | ||
| 288 | } | ||
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c index fdd3793e22f9..c7726cebc495 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c | |||
| @@ -667,12 +667,7 @@ static int insert(struct dm_btree_info *info, dm_block_t root, | |||
| 667 | struct btree_node *n; | 667 | struct btree_node *n; |
| 668 | struct dm_btree_value_type le64_type; | 668 | struct dm_btree_value_type le64_type; |
| 669 | 669 | ||
| 670 | le64_type.context = NULL; | 670 | init_le64_type(info->tm, &le64_type); |
| 671 | le64_type.size = sizeof(__le64); | ||
| 672 | le64_type.inc = NULL; | ||
| 673 | le64_type.dec = NULL; | ||
| 674 | le64_type.equal = NULL; | ||
| 675 | |||
| 676 | init_shadow_spine(&spine, info); | 671 | init_shadow_spine(&spine, info); |
| 677 | 672 | ||
| 678 | for (level = 0; level < (info->levels - 1); level++) { | 673 | for (level = 0; level < (info->levels - 1); level++) { |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 94f5b55069e0..967a4ed73929 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -1476,6 +1476,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) | |||
| 1476 | { | 1476 | { |
| 1477 | char b[BDEVNAME_SIZE]; | 1477 | char b[BDEVNAME_SIZE]; |
| 1478 | struct r1conf *conf = mddev->private; | 1478 | struct r1conf *conf = mddev->private; |
| 1479 | unsigned long flags; | ||
| 1479 | 1480 | ||
| 1480 | /* | 1481 | /* |
| 1481 | * If it is not operational, then we have already marked it as dead | 1482 | * If it is not operational, then we have already marked it as dead |
| @@ -1495,14 +1496,13 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) | |||
| 1495 | return; | 1496 | return; |
| 1496 | } | 1497 | } |
| 1497 | set_bit(Blocked, &rdev->flags); | 1498 | set_bit(Blocked, &rdev->flags); |
| 1499 | spin_lock_irqsave(&conf->device_lock, flags); | ||
| 1498 | if (test_and_clear_bit(In_sync, &rdev->flags)) { | 1500 | if (test_and_clear_bit(In_sync, &rdev->flags)) { |
| 1499 | unsigned long flags; | ||
| 1500 | spin_lock_irqsave(&conf->device_lock, flags); | ||
| 1501 | mddev->degraded++; | 1501 | mddev->degraded++; |
| 1502 | set_bit(Faulty, &rdev->flags); | 1502 | set_bit(Faulty, &rdev->flags); |
| 1503 | spin_unlock_irqrestore(&conf->device_lock, flags); | ||
| 1504 | } else | 1503 | } else |
| 1505 | set_bit(Faulty, &rdev->flags); | 1504 | set_bit(Faulty, &rdev->flags); |
| 1505 | spin_unlock_irqrestore(&conf->device_lock, flags); | ||
| 1506 | /* | 1506 | /* |
| 1507 | * if recovery is running, make sure it aborts. | 1507 | * if recovery is running, make sure it aborts. |
| 1508 | */ | 1508 | */ |
| @@ -1568,7 +1568,10 @@ static int raid1_spare_active(struct mddev *mddev) | |||
| 1568 | * Find all failed disks within the RAID1 configuration | 1568 | * Find all failed disks within the RAID1 configuration |
| 1569 | * and mark them readable. | 1569 | * and mark them readable. |
| 1570 | * Called under mddev lock, so rcu protection not needed. | 1570 | * Called under mddev lock, so rcu protection not needed. |
| 1571 | * device_lock used to avoid races with raid1_end_read_request | ||
| 1572 | * which expects 'In_sync' flags and ->degraded to be consistent. | ||
| 1571 | */ | 1573 | */ |
| 1574 | spin_lock_irqsave(&conf->device_lock, flags); | ||
| 1572 | for (i = 0; i < conf->raid_disks; i++) { | 1575 | for (i = 0; i < conf->raid_disks; i++) { |
| 1573 | struct md_rdev *rdev = conf->mirrors[i].rdev; | 1576 | struct md_rdev *rdev = conf->mirrors[i].rdev; |
| 1574 | struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev; | 1577 | struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev; |
| @@ -1599,7 +1602,6 @@ static int raid1_spare_active(struct mddev *mddev) | |||
| 1599 | sysfs_notify_dirent_safe(rdev->sysfs_state); | 1602 | sysfs_notify_dirent_safe(rdev->sysfs_state); |
| 1600 | } | 1603 | } |
| 1601 | } | 1604 | } |
| 1602 | spin_lock_irqsave(&conf->device_lock, flags); | ||
| 1603 | mddev->degraded -= count; | 1605 | mddev->degraded -= count; |
| 1604 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1606 | spin_unlock_irqrestore(&conf->device_lock, flags); |
| 1605 | 1607 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 643d217bfa13..f757023fc458 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -2256,7 +2256,7 @@ static int resize_stripes(struct r5conf *conf, int newsize) | |||
| 2256 | static int drop_one_stripe(struct r5conf *conf) | 2256 | static int drop_one_stripe(struct r5conf *conf) |
| 2257 | { | 2257 | { |
| 2258 | struct stripe_head *sh; | 2258 | struct stripe_head *sh; |
| 2259 | int hash = (conf->max_nr_stripes - 1) % NR_STRIPE_HASH_LOCKS; | 2259 | int hash = (conf->max_nr_stripes - 1) & STRIPE_HASH_LOCKS_MASK; |
| 2260 | 2260 | ||
| 2261 | spin_lock_irq(conf->hash_locks + hash); | 2261 | spin_lock_irq(conf->hash_locks + hash); |
| 2262 | sh = get_free_stripe(conf, hash); | 2262 | sh = get_free_stripe(conf, hash); |
| @@ -6388,7 +6388,8 @@ static unsigned long raid5_cache_scan(struct shrinker *shrink, | |||
| 6388 | 6388 | ||
| 6389 | if (mutex_trylock(&conf->cache_size_mutex)) { | 6389 | if (mutex_trylock(&conf->cache_size_mutex)) { |
| 6390 | ret= 0; | 6390 | ret= 0; |
| 6391 | while (ret < sc->nr_to_scan) { | 6391 | while (ret < sc->nr_to_scan && |
| 6392 | conf->max_nr_stripes > conf->min_nr_stripes) { | ||
| 6392 | if (drop_one_stripe(conf) == 0) { | 6393 | if (drop_one_stripe(conf) == 0) { |
| 6393 | ret = SHRINK_STOP; | 6394 | ret = SHRINK_STOP; |
| 6394 | break; | 6395 | break; |
diff --git a/drivers/media/dvb-frontends/Kconfig b/drivers/media/dvb-frontends/Kconfig index 0d35f5850ff1..5ab90f36a6a6 100644 --- a/drivers/media/dvb-frontends/Kconfig +++ b/drivers/media/dvb-frontends/Kconfig | |||
| @@ -240,7 +240,7 @@ config DVB_SI21XX | |||
| 240 | 240 | ||
| 241 | config DVB_TS2020 | 241 | config DVB_TS2020 |
| 242 | tristate "Montage Tehnology TS2020 based tuners" | 242 | tristate "Montage Tehnology TS2020 based tuners" |
| 243 | depends on DVB_CORE | 243 | depends on DVB_CORE && I2C |
| 244 | select REGMAP_I2C | 244 | select REGMAP_I2C |
| 245 | default m if !MEDIA_SUBDRV_AUTOSELECT | 245 | default m if !MEDIA_SUBDRV_AUTOSELECT |
| 246 | help | 246 | help |
diff --git a/drivers/media/pci/cobalt/Kconfig b/drivers/media/pci/cobalt/Kconfig index 3be1b2c3c386..6a1c0089bb62 100644 --- a/drivers/media/pci/cobalt/Kconfig +++ b/drivers/media/pci/cobalt/Kconfig | |||
| @@ -2,6 +2,7 @@ config VIDEO_COBALT | |||
| 2 | tristate "Cisco Cobalt support" | 2 | tristate "Cisco Cobalt support" |
| 3 | depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER | 3 | depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER |
| 4 | depends on PCI_MSI && MTD_COMPLEX_MAPPINGS && GPIOLIB | 4 | depends on PCI_MSI && MTD_COMPLEX_MAPPINGS && GPIOLIB |
| 5 | depends on SND | ||
| 5 | select I2C_ALGOBIT | 6 | select I2C_ALGOBIT |
| 6 | select VIDEO_ADV7604 | 7 | select VIDEO_ADV7604 |
| 7 | select VIDEO_ADV7511 | 8 | select VIDEO_ADV7511 |
diff --git a/drivers/media/pci/cobalt/cobalt-irq.c b/drivers/media/pci/cobalt/cobalt-irq.c index dd4bff9cf339..d1f5898d11ba 100644 --- a/drivers/media/pci/cobalt/cobalt-irq.c +++ b/drivers/media/pci/cobalt/cobalt-irq.c | |||
| @@ -139,7 +139,7 @@ done: | |||
| 139 | also know about dropped frames. */ | 139 | also know about dropped frames. */ |
| 140 | cb->vb.v4l2_buf.sequence = s->sequence++; | 140 | cb->vb.v4l2_buf.sequence = s->sequence++; |
| 141 | vb2_buffer_done(&cb->vb, (skip || s->unstable_frame) ? | 141 | vb2_buffer_done(&cb->vb, (skip || s->unstable_frame) ? |
| 142 | VB2_BUF_STATE_QUEUED : VB2_BUF_STATE_DONE); | 142 | VB2_BUF_STATE_REQUEUEING : VB2_BUF_STATE_DONE); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | irqreturn_t cobalt_irq_handler(int irq, void *dev_id) | 145 | irqreturn_t cobalt_irq_handler(int irq, void *dev_id) |
diff --git a/drivers/media/pci/mantis/mantis_dma.c b/drivers/media/pci/mantis/mantis_dma.c index 1d59c7e039f7..87990ece5848 100644 --- a/drivers/media/pci/mantis/mantis_dma.c +++ b/drivers/media/pci/mantis/mantis_dma.c | |||
| @@ -130,10 +130,11 @@ err: | |||
| 130 | 130 | ||
| 131 | int mantis_dma_init(struct mantis_pci *mantis) | 131 | int mantis_dma_init(struct mantis_pci *mantis) |
| 132 | { | 132 | { |
| 133 | int err = 0; | 133 | int err; |
| 134 | 134 | ||
| 135 | dprintk(MANTIS_DEBUG, 1, "Mantis DMA init"); | 135 | dprintk(MANTIS_DEBUG, 1, "Mantis DMA init"); |
| 136 | if (mantis_alloc_buffers(mantis) < 0) { | 136 | err = mantis_alloc_buffers(mantis); |
| 137 | if (err < 0) { | ||
| 137 | dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer"); | 138 | dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer"); |
| 138 | 139 | ||
| 139 | /* Stop RISC Engine */ | 140 | /* Stop RISC Engine */ |
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index 8939ebd74391..84fa6e9b59a1 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c | |||
| @@ -184,125 +184,9 @@ out: | |||
| 184 | return -EINVAL; | 184 | return -EINVAL; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | static struct ir_raw_timings_manchester ir_rc5_timings = { | ||
| 188 | .leader = RC5_UNIT, | ||
| 189 | .pulse_space_start = 0, | ||
| 190 | .clock = RC5_UNIT, | ||
| 191 | .trailer_space = RC5_UNIT * 10, | ||
| 192 | }; | ||
| 193 | |||
| 194 | static struct ir_raw_timings_manchester ir_rc5x_timings[2] = { | ||
| 195 | { | ||
| 196 | .leader = RC5_UNIT, | ||
| 197 | .pulse_space_start = 0, | ||
| 198 | .clock = RC5_UNIT, | ||
| 199 | .trailer_space = RC5X_SPACE, | ||
| 200 | }, | ||
| 201 | { | ||
| 202 | .clock = RC5_UNIT, | ||
| 203 | .trailer_space = RC5_UNIT * 10, | ||
| 204 | }, | ||
| 205 | }; | ||
| 206 | |||
| 207 | static struct ir_raw_timings_manchester ir_rc5_sz_timings = { | ||
| 208 | .leader = RC5_UNIT, | ||
| 209 | .pulse_space_start = 0, | ||
| 210 | .clock = RC5_UNIT, | ||
| 211 | .trailer_space = RC5_UNIT * 10, | ||
| 212 | }; | ||
| 213 | |||
| 214 | static int ir_rc5_validate_filter(const struct rc_scancode_filter *scancode, | ||
| 215 | unsigned int important_bits) | ||
| 216 | { | ||
| 217 | /* all important bits of scancode should be set in mask */ | ||
| 218 | if (~scancode->mask & important_bits) | ||
| 219 | return -EINVAL; | ||
| 220 | /* extra bits in mask should be zero in data */ | ||
| 221 | if (scancode->mask & scancode->data & ~important_bits) | ||
| 222 | return -EINVAL; | ||
| 223 | return 0; | ||
| 224 | } | ||
| 225 | |||
| 226 | /** | ||
| 227 | * ir_rc5_encode() - Encode a scancode as a stream of raw events | ||
| 228 | * | ||
| 229 | * @protocols: allowed protocols | ||
| 230 | * @scancode: scancode filter describing scancode (helps distinguish between | ||
| 231 | * protocol subtypes when scancode is ambiguous) | ||
| 232 | * @events: array of raw ir events to write into | ||
| 233 | * @max: maximum size of @events | ||
| 234 | * | ||
| 235 | * Returns: The number of events written. | ||
| 236 | * -ENOBUFS if there isn't enough space in the array to fit the | ||
| 237 | * encoding. In this case all @max events will have been written. | ||
| 238 | * -EINVAL if the scancode is ambiguous or invalid. | ||
| 239 | */ | ||
| 240 | static int ir_rc5_encode(u64 protocols, | ||
| 241 | const struct rc_scancode_filter *scancode, | ||
| 242 | struct ir_raw_event *events, unsigned int max) | ||
| 243 | { | ||
| 244 | int ret; | ||
| 245 | struct ir_raw_event *e = events; | ||
| 246 | unsigned int data, xdata, command, commandx, system; | ||
| 247 | |||
| 248 | /* Detect protocol and convert scancode to raw data */ | ||
| 249 | if (protocols & RC_BIT_RC5 && | ||
| 250 | !ir_rc5_validate_filter(scancode, 0x1f7f)) { | ||
| 251 | /* decode scancode */ | ||
| 252 | command = (scancode->data & 0x003f) >> 0; | ||
| 253 | commandx = (scancode->data & 0x0040) >> 6; | ||
| 254 | system = (scancode->data & 0x1f00) >> 8; | ||
| 255 | /* encode data */ | ||
| 256 | data = !commandx << 12 | system << 6 | command; | ||
| 257 | |||
| 258 | /* Modulate the data */ | ||
| 259 | ret = ir_raw_gen_manchester(&e, max, &ir_rc5_timings, RC5_NBITS, | ||
| 260 | data); | ||
| 261 | if (ret < 0) | ||
| 262 | return ret; | ||
| 263 | } else if (protocols & RC_BIT_RC5X && | ||
| 264 | !ir_rc5_validate_filter(scancode, 0x1f7f3f)) { | ||
| 265 | /* decode scancode */ | ||
| 266 | xdata = (scancode->data & 0x00003f) >> 0; | ||
| 267 | command = (scancode->data & 0x003f00) >> 8; | ||
| 268 | commandx = (scancode->data & 0x004000) >> 14; | ||
| 269 | system = (scancode->data & 0x1f0000) >> 16; | ||
| 270 | /* commandx and system overlap, bits must match when encoded */ | ||
| 271 | if (commandx == (system & 0x1)) | ||
| 272 | return -EINVAL; | ||
| 273 | /* encode data */ | ||
| 274 | data = 1 << 18 | system << 12 | command << 6 | xdata; | ||
| 275 | |||
| 276 | /* Modulate the data */ | ||
| 277 | ret = ir_raw_gen_manchester(&e, max, &ir_rc5x_timings[0], | ||
| 278 | CHECK_RC5X_NBITS, | ||
| 279 | data >> (RC5X_NBITS-CHECK_RC5X_NBITS)); | ||
| 280 | if (ret < 0) | ||
| 281 | return ret; | ||
| 282 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 283 | &ir_rc5x_timings[1], | ||
| 284 | RC5X_NBITS - CHECK_RC5X_NBITS, | ||
| 285 | data); | ||
| 286 | if (ret < 0) | ||
| 287 | return ret; | ||
| 288 | } else if (protocols & RC_BIT_RC5_SZ && | ||
| 289 | !ir_rc5_validate_filter(scancode, 0x2fff)) { | ||
| 290 | /* RC5-SZ scancode is raw enough for Manchester as it is */ | ||
| 291 | ret = ir_raw_gen_manchester(&e, max, &ir_rc5_sz_timings, | ||
| 292 | RC5_SZ_NBITS, scancode->data & 0x2fff); | ||
| 293 | if (ret < 0) | ||
| 294 | return ret; | ||
| 295 | } else { | ||
| 296 | return -EINVAL; | ||
| 297 | } | ||
| 298 | |||
| 299 | return e - events; | ||
| 300 | } | ||
| 301 | |||
| 302 | static struct ir_raw_handler rc5_handler = { | 187 | static struct ir_raw_handler rc5_handler = { |
| 303 | .protocols = RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ, | 188 | .protocols = RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ, |
| 304 | .decode = ir_rc5_decode, | 189 | .decode = ir_rc5_decode, |
| 305 | .encode = ir_rc5_encode, | ||
| 306 | }; | 190 | }; |
| 307 | 191 | ||
| 308 | static int __init ir_rc5_decode_init(void) | 192 | static int __init ir_rc5_decode_init(void) |
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index f9c70baf6e0c..d16bc67af732 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c | |||
| @@ -291,133 +291,11 @@ out: | |||
| 291 | return -EINVAL; | 291 | return -EINVAL; |
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | static struct ir_raw_timings_manchester ir_rc6_timings[4] = { | ||
| 295 | { | ||
| 296 | .leader = RC6_PREFIX_PULSE, | ||
| 297 | .pulse_space_start = 0, | ||
| 298 | .clock = RC6_UNIT, | ||
| 299 | .invert = 1, | ||
| 300 | .trailer_space = RC6_PREFIX_SPACE, | ||
| 301 | }, | ||
| 302 | { | ||
| 303 | .clock = RC6_UNIT, | ||
| 304 | .invert = 1, | ||
| 305 | }, | ||
| 306 | { | ||
| 307 | .clock = RC6_UNIT * 2, | ||
| 308 | .invert = 1, | ||
| 309 | }, | ||
| 310 | { | ||
| 311 | .clock = RC6_UNIT, | ||
| 312 | .invert = 1, | ||
| 313 | .trailer_space = RC6_SUFFIX_SPACE, | ||
| 314 | }, | ||
| 315 | }; | ||
| 316 | |||
| 317 | static int ir_rc6_validate_filter(const struct rc_scancode_filter *scancode, | ||
| 318 | unsigned int important_bits) | ||
| 319 | { | ||
| 320 | /* all important bits of scancode should be set in mask */ | ||
| 321 | if (~scancode->mask & important_bits) | ||
| 322 | return -EINVAL; | ||
| 323 | /* extra bits in mask should be zero in data */ | ||
| 324 | if (scancode->mask & scancode->data & ~important_bits) | ||
| 325 | return -EINVAL; | ||
| 326 | return 0; | ||
| 327 | } | ||
| 328 | |||
| 329 | /** | ||
| 330 | * ir_rc6_encode() - Encode a scancode as a stream of raw events | ||
| 331 | * | ||
| 332 | * @protocols: allowed protocols | ||
| 333 | * @scancode: scancode filter describing scancode (helps distinguish between | ||
| 334 | * protocol subtypes when scancode is ambiguous) | ||
| 335 | * @events: array of raw ir events to write into | ||
| 336 | * @max: maximum size of @events | ||
| 337 | * | ||
| 338 | * Returns: The number of events written. | ||
| 339 | * -ENOBUFS if there isn't enough space in the array to fit the | ||
| 340 | * encoding. In this case all @max events will have been written. | ||
| 341 | * -EINVAL if the scancode is ambiguous or invalid. | ||
| 342 | */ | ||
| 343 | static int ir_rc6_encode(u64 protocols, | ||
| 344 | const struct rc_scancode_filter *scancode, | ||
| 345 | struct ir_raw_event *events, unsigned int max) | ||
| 346 | { | ||
| 347 | int ret; | ||
| 348 | struct ir_raw_event *e = events; | ||
| 349 | |||
| 350 | if (protocols & RC_BIT_RC6_0 && | ||
| 351 | !ir_rc6_validate_filter(scancode, 0xffff)) { | ||
| 352 | |||
| 353 | /* Modulate the preamble */ | ||
| 354 | ret = ir_raw_gen_manchester(&e, max, &ir_rc6_timings[0], 0, 0); | ||
| 355 | if (ret < 0) | ||
| 356 | return ret; | ||
| 357 | |||
| 358 | /* Modulate the header (Start Bit & Mode-0) */ | ||
| 359 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 360 | &ir_rc6_timings[1], | ||
| 361 | RC6_HEADER_NBITS, (1 << 3)); | ||
| 362 | if (ret < 0) | ||
| 363 | return ret; | ||
| 364 | |||
| 365 | /* Modulate Trailer Bit */ | ||
| 366 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 367 | &ir_rc6_timings[2], 1, 0); | ||
| 368 | if (ret < 0) | ||
| 369 | return ret; | ||
| 370 | |||
| 371 | /* Modulate rest of the data */ | ||
| 372 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 373 | &ir_rc6_timings[3], RC6_0_NBITS, | ||
| 374 | scancode->data); | ||
| 375 | if (ret < 0) | ||
| 376 | return ret; | ||
| 377 | |||
| 378 | } else if (protocols & (RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | | ||
| 379 | RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE) && | ||
| 380 | !ir_rc6_validate_filter(scancode, 0x8fffffff)) { | ||
| 381 | |||
| 382 | /* Modulate the preamble */ | ||
| 383 | ret = ir_raw_gen_manchester(&e, max, &ir_rc6_timings[0], 0, 0); | ||
| 384 | if (ret < 0) | ||
| 385 | return ret; | ||
| 386 | |||
| 387 | /* Modulate the header (Start Bit & Header-version 6 */ | ||
| 388 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 389 | &ir_rc6_timings[1], | ||
| 390 | RC6_HEADER_NBITS, (1 << 3 | 6)); | ||
| 391 | if (ret < 0) | ||
| 392 | return ret; | ||
| 393 | |||
| 394 | /* Modulate Trailer Bit */ | ||
| 395 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 396 | &ir_rc6_timings[2], 1, 0); | ||
| 397 | if (ret < 0) | ||
| 398 | return ret; | ||
| 399 | |||
| 400 | /* Modulate rest of the data */ | ||
| 401 | ret = ir_raw_gen_manchester(&e, max - (e - events), | ||
| 402 | &ir_rc6_timings[3], | ||
| 403 | fls(scancode->mask), | ||
| 404 | scancode->data); | ||
| 405 | if (ret < 0) | ||
| 406 | return ret; | ||
| 407 | |||
| 408 | } else { | ||
| 409 | return -EINVAL; | ||
| 410 | } | ||
| 411 | |||
| 412 | return e - events; | ||
| 413 | } | ||
| 414 | |||
| 415 | static struct ir_raw_handler rc6_handler = { | 294 | static struct ir_raw_handler rc6_handler = { |
| 416 | .protocols = RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | | 295 | .protocols = RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | |
| 417 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | | 296 | RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | |
| 418 | RC_BIT_RC6_MCE, | 297 | RC_BIT_RC6_MCE, |
| 419 | .decode = ir_rc6_decode, | 298 | .decode = ir_rc6_decode, |
| 420 | .encode = ir_rc6_encode, | ||
| 421 | }; | 299 | }; |
| 422 | 300 | ||
| 423 | static int __init ir_rc6_decode_init(void) | 301 | static int __init ir_rc6_decode_init(void) |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index baeb5971fd52..85af7a869167 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
| @@ -526,130 +526,6 @@ static int nvt_set_tx_carrier(struct rc_dev *dev, u32 carrier) | |||
| 526 | return 0; | 526 | return 0; |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | static int nvt_write_wakeup_codes(struct rc_dev *dev, | ||
| 530 | const u8 *wakeup_sample_buf, int count) | ||
| 531 | { | ||
| 532 | int i = 0; | ||
| 533 | u8 reg, reg_learn_mode; | ||
| 534 | unsigned long flags; | ||
| 535 | struct nvt_dev *nvt = dev->priv; | ||
| 536 | |||
| 537 | nvt_dbg_wake("writing wakeup samples"); | ||
| 538 | |||
| 539 | reg = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON); | ||
| 540 | reg_learn_mode = reg & ~CIR_WAKE_IRCON_MODE0; | ||
| 541 | reg_learn_mode |= CIR_WAKE_IRCON_MODE1; | ||
| 542 | |||
| 543 | /* Lock the learn area to prevent racing with wake-isr */ | ||
| 544 | spin_lock_irqsave(&nvt->nvt_lock, flags); | ||
| 545 | |||
| 546 | /* Enable fifo writes */ | ||
| 547 | nvt_cir_wake_reg_write(nvt, reg_learn_mode, CIR_WAKE_IRCON); | ||
| 548 | |||
| 549 | /* Clear cir wake rx fifo */ | ||
| 550 | nvt_clear_cir_wake_fifo(nvt); | ||
| 551 | |||
| 552 | if (count > WAKE_FIFO_LEN) { | ||
| 553 | nvt_dbg_wake("HW FIFO too small for all wake samples"); | ||
| 554 | count = WAKE_FIFO_LEN; | ||
| 555 | } | ||
| 556 | |||
| 557 | if (count) | ||
| 558 | pr_info("Wake samples (%d) =", count); | ||
| 559 | else | ||
| 560 | pr_info("Wake sample fifo cleared"); | ||
| 561 | |||
| 562 | /* Write wake samples to fifo */ | ||
| 563 | for (i = 0; i < count; i++) { | ||
| 564 | pr_cont(" %02x", wakeup_sample_buf[i]); | ||
| 565 | nvt_cir_wake_reg_write(nvt, wakeup_sample_buf[i], | ||
| 566 | CIR_WAKE_WR_FIFO_DATA); | ||
| 567 | } | ||
| 568 | pr_cont("\n"); | ||
| 569 | |||
| 570 | /* Switch cir to wakeup mode and disable fifo writing */ | ||
| 571 | nvt_cir_wake_reg_write(nvt, reg, CIR_WAKE_IRCON); | ||
| 572 | |||
| 573 | /* Set number of bytes needed for wake */ | ||
| 574 | nvt_cir_wake_reg_write(nvt, count ? count : | ||
| 575 | CIR_WAKE_FIFO_CMP_BYTES, | ||
| 576 | CIR_WAKE_FIFO_CMP_DEEP); | ||
| 577 | |||
| 578 | spin_unlock_irqrestore(&nvt->nvt_lock, flags); | ||
| 579 | |||
| 580 | return 0; | ||
| 581 | } | ||
| 582 | |||
| 583 | static int nvt_ir_raw_set_wakeup_filter(struct rc_dev *dev, | ||
| 584 | struct rc_scancode_filter *sc_filter) | ||
| 585 | { | ||
| 586 | u8 *reg_buf; | ||
| 587 | u8 buf_val; | ||
| 588 | int i, ret, count; | ||
| 589 | unsigned int val; | ||
| 590 | struct ir_raw_event *raw; | ||
| 591 | bool complete; | ||
| 592 | |||
| 593 | /* Require both mask and data to be set before actually committing */ | ||
| 594 | if (!sc_filter->mask || !sc_filter->data) | ||
| 595 | return 0; | ||
| 596 | |||
| 597 | raw = kmalloc_array(WAKE_FIFO_LEN, sizeof(*raw), GFP_KERNEL); | ||
| 598 | if (!raw) | ||
| 599 | return -ENOMEM; | ||
| 600 | |||
| 601 | ret = ir_raw_encode_scancode(dev->enabled_wakeup_protocols, sc_filter, | ||
| 602 | raw, WAKE_FIFO_LEN); | ||
| 603 | complete = (ret != -ENOBUFS); | ||
| 604 | if (!complete) | ||
| 605 | ret = WAKE_FIFO_LEN; | ||
| 606 | else if (ret < 0) | ||
| 607 | goto out_raw; | ||
| 608 | |||
| 609 | reg_buf = kmalloc_array(WAKE_FIFO_LEN, sizeof(*reg_buf), GFP_KERNEL); | ||
| 610 | if (!reg_buf) { | ||
| 611 | ret = -ENOMEM; | ||
| 612 | goto out_raw; | ||
| 613 | } | ||
| 614 | |||
| 615 | /* Inspect the ir samples */ | ||
| 616 | for (i = 0, count = 0; i < ret && count < WAKE_FIFO_LEN; ++i) { | ||
| 617 | val = NS_TO_US((raw[i]).duration) / SAMPLE_PERIOD; | ||
| 618 | |||
| 619 | /* Split too large values into several smaller ones */ | ||
| 620 | while (val > 0 && count < WAKE_FIFO_LEN) { | ||
| 621 | |||
| 622 | /* Skip last value for better comparison tolerance */ | ||
| 623 | if (complete && i == ret - 1 && val < BUF_LEN_MASK) | ||
| 624 | break; | ||
| 625 | |||
| 626 | /* Clamp values to BUF_LEN_MASK at most */ | ||
| 627 | buf_val = (val > BUF_LEN_MASK) ? BUF_LEN_MASK : val; | ||
| 628 | |||
| 629 | reg_buf[count] = buf_val; | ||
| 630 | val -= buf_val; | ||
| 631 | if ((raw[i]).pulse) | ||
| 632 | reg_buf[count] |= BUF_PULSE_BIT; | ||
| 633 | count++; | ||
| 634 | } | ||
| 635 | } | ||
| 636 | |||
| 637 | ret = nvt_write_wakeup_codes(dev, reg_buf, count); | ||
| 638 | |||
| 639 | kfree(reg_buf); | ||
| 640 | out_raw: | ||
| 641 | kfree(raw); | ||
| 642 | |||
| 643 | return ret; | ||
| 644 | } | ||
| 645 | |||
| 646 | /* Dummy implementation. nuvoton is agnostic to the protocol used */ | ||
| 647 | static int nvt_ir_raw_change_wakeup_protocol(struct rc_dev *dev, | ||
| 648 | u64 *rc_type) | ||
| 649 | { | ||
| 650 | return 0; | ||
| 651 | } | ||
| 652 | |||
| 653 | /* | 529 | /* |
| 654 | * nvt_tx_ir | 530 | * nvt_tx_ir |
| 655 | * | 531 | * |
| @@ -1167,14 +1043,11 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id) | |||
| 1167 | /* Set up the rc device */ | 1043 | /* Set up the rc device */ |
| 1168 | rdev->priv = nvt; | 1044 | rdev->priv = nvt; |
| 1169 | rdev->driver_type = RC_DRIVER_IR_RAW; | 1045 | rdev->driver_type = RC_DRIVER_IR_RAW; |
| 1170 | rdev->encode_wakeup = true; | ||
| 1171 | rdev->allowed_protocols = RC_BIT_ALL; | 1046 | rdev->allowed_protocols = RC_BIT_ALL; |
| 1172 | rdev->open = nvt_open; | 1047 | rdev->open = nvt_open; |
| 1173 | rdev->close = nvt_close; | 1048 | rdev->close = nvt_close; |
| 1174 | rdev->tx_ir = nvt_tx_ir; | 1049 | rdev->tx_ir = nvt_tx_ir; |
| 1175 | rdev->s_tx_carrier = nvt_set_tx_carrier; | 1050 | rdev->s_tx_carrier = nvt_set_tx_carrier; |
| 1176 | rdev->s_wakeup_filter = nvt_ir_raw_set_wakeup_filter; | ||
| 1177 | rdev->change_wakeup_protocol = nvt_ir_raw_change_wakeup_protocol; | ||
| 1178 | rdev->input_name = "Nuvoton w836x7hg Infrared Remote Transceiver"; | 1051 | rdev->input_name = "Nuvoton w836x7hg Infrared Remote Transceiver"; |
| 1179 | rdev->input_phys = "nuvoton/cir0"; | 1052 | rdev->input_phys = "nuvoton/cir0"; |
| 1180 | rdev->input_id.bustype = BUS_HOST; | 1053 | rdev->input_id.bustype = BUS_HOST; |
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h index 9d0e161c2a88..e1cf23c3875b 100644 --- a/drivers/media/rc/nuvoton-cir.h +++ b/drivers/media/rc/nuvoton-cir.h | |||
| @@ -63,7 +63,6 @@ static int debug; | |||
| 63 | */ | 63 | */ |
| 64 | #define TX_BUF_LEN 256 | 64 | #define TX_BUF_LEN 256 |
| 65 | #define RX_BUF_LEN 32 | 65 | #define RX_BUF_LEN 32 |
| 66 | #define WAKE_FIFO_LEN 67 | ||
| 67 | 66 | ||
| 68 | struct nvt_dev { | 67 | struct nvt_dev { |
| 69 | struct pnp_dev *pdev; | 68 | struct pnp_dev *pdev; |
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 4b994aa2f2a7..b68d4f762734 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h | |||
| @@ -25,8 +25,6 @@ struct ir_raw_handler { | |||
| 25 | 25 | ||
| 26 | u64 protocols; /* which are handled by this handler */ | 26 | u64 protocols; /* which are handled by this handler */ |
| 27 | int (*decode)(struct rc_dev *dev, struct ir_raw_event event); | 27 | int (*decode)(struct rc_dev *dev, struct ir_raw_event event); |
| 28 | int (*encode)(u64 protocols, const struct rc_scancode_filter *scancode, | ||
| 29 | struct ir_raw_event *events, unsigned int max); | ||
| 30 | 28 | ||
| 31 | /* These two should only be used by the lirc decoder */ | 29 | /* These two should only be used by the lirc decoder */ |
| 32 | int (*raw_register)(struct rc_dev *dev); | 30 | int (*raw_register)(struct rc_dev *dev); |
| @@ -152,44 +150,10 @@ static inline bool is_timing_event(struct ir_raw_event ev) | |||
| 152 | #define TO_US(duration) DIV_ROUND_CLOSEST((duration), 1000) | 150 | #define TO_US(duration) DIV_ROUND_CLOSEST((duration), 1000) |
| 153 | #define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") | 151 | #define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") |
| 154 | 152 | ||
| 155 | /* functions for IR encoders */ | ||
| 156 | |||
| 157 | static inline void init_ir_raw_event_duration(struct ir_raw_event *ev, | ||
| 158 | unsigned int pulse, | ||
| 159 | u32 duration) | ||
| 160 | { | ||
| 161 | init_ir_raw_event(ev); | ||
| 162 | ev->duration = duration; | ||
| 163 | ev->pulse = pulse; | ||
| 164 | } | ||
| 165 | |||
| 166 | /** | ||
| 167 | * struct ir_raw_timings_manchester - Manchester coding timings | ||
| 168 | * @leader: duration of leader pulse (if any) 0 if continuing | ||
| 169 | * existing signal (see @pulse_space_start) | ||
| 170 | * @pulse_space_start: 1 for starting with pulse (0 for starting with space) | ||
| 171 | * @clock: duration of each pulse/space in ns | ||
| 172 | * @invert: if set clock logic is inverted | ||
| 173 | * (0 = space + pulse, 1 = pulse + space) | ||
| 174 | * @trailer_space: duration of trailer space in ns | ||
| 175 | */ | ||
| 176 | struct ir_raw_timings_manchester { | ||
| 177 | unsigned int leader; | ||
| 178 | unsigned int pulse_space_start:1; | ||
| 179 | unsigned int clock; | ||
| 180 | unsigned int invert:1; | ||
| 181 | unsigned int trailer_space; | ||
| 182 | }; | ||
| 183 | |||
| 184 | int ir_raw_gen_manchester(struct ir_raw_event **ev, unsigned int max, | ||
| 185 | const struct ir_raw_timings_manchester *timings, | ||
| 186 | unsigned int n, unsigned int data); | ||
| 187 | |||
| 188 | /* | 153 | /* |
| 189 | * Routines from rc-raw.c to be used internally and by decoders | 154 | * Routines from rc-raw.c to be used internally and by decoders |
| 190 | */ | 155 | */ |
| 191 | u64 ir_raw_get_allowed_protocols(void); | 156 | u64 ir_raw_get_allowed_protocols(void); |
| 192 | u64 ir_raw_get_encode_protocols(void); | ||
| 193 | int ir_raw_event_register(struct rc_dev *dev); | 157 | int ir_raw_event_register(struct rc_dev *dev); |
| 194 | void ir_raw_event_unregister(struct rc_dev *dev); | 158 | void ir_raw_event_unregister(struct rc_dev *dev); |
| 195 | int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); | 159 | int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); |
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index b9e4645c731c..b732ac6a26d8 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c | |||
| @@ -30,7 +30,6 @@ static LIST_HEAD(ir_raw_client_list); | |||
| 30 | static DEFINE_MUTEX(ir_raw_handler_lock); | 30 | static DEFINE_MUTEX(ir_raw_handler_lock); |
| 31 | static LIST_HEAD(ir_raw_handler_list); | 31 | static LIST_HEAD(ir_raw_handler_list); |
| 32 | static u64 available_protocols; | 32 | static u64 available_protocols; |
| 33 | static u64 encode_protocols; | ||
| 34 | 33 | ||
| 35 | static int ir_raw_event_thread(void *data) | 34 | static int ir_raw_event_thread(void *data) |
| 36 | { | 35 | { |
| @@ -241,146 +240,12 @@ ir_raw_get_allowed_protocols(void) | |||
| 241 | return protocols; | 240 | return protocols; |
| 242 | } | 241 | } |
| 243 | 242 | ||
| 244 | /* used internally by the sysfs interface */ | ||
| 245 | u64 | ||
| 246 | ir_raw_get_encode_protocols(void) | ||
| 247 | { | ||
| 248 | u64 protocols; | ||
| 249 | |||
| 250 | mutex_lock(&ir_raw_handler_lock); | ||
| 251 | protocols = encode_protocols; | ||
| 252 | mutex_unlock(&ir_raw_handler_lock); | ||
| 253 | return protocols; | ||
| 254 | } | ||
| 255 | |||
| 256 | static int change_protocol(struct rc_dev *dev, u64 *rc_type) | 243 | static int change_protocol(struct rc_dev *dev, u64 *rc_type) |
| 257 | { | 244 | { |
| 258 | /* the caller will update dev->enabled_protocols */ | 245 | /* the caller will update dev->enabled_protocols */ |
| 259 | return 0; | 246 | return 0; |
| 260 | } | 247 | } |
| 261 | 248 | ||
| 262 | /** | ||
| 263 | * ir_raw_gen_manchester() - Encode data with Manchester (bi-phase) modulation. | ||
| 264 | * @ev: Pointer to pointer to next free event. *@ev is incremented for | ||
| 265 | * each raw event filled. | ||
| 266 | * @max: Maximum number of raw events to fill. | ||
| 267 | * @timings: Manchester modulation timings. | ||
| 268 | * @n: Number of bits of data. | ||
| 269 | * @data: Data bits to encode. | ||
| 270 | * | ||
| 271 | * Encodes the @n least significant bits of @data using Manchester (bi-phase) | ||
| 272 | * modulation with the timing characteristics described by @timings, writing up | ||
| 273 | * to @max raw IR events using the *@ev pointer. | ||
| 274 | * | ||
| 275 | * Returns: 0 on success. | ||
| 276 | * -ENOBUFS if there isn't enough space in the array to fit the | ||
| 277 | * full encoded data. In this case all @max events will have been | ||
| 278 | * written. | ||
| 279 | */ | ||
| 280 | int ir_raw_gen_manchester(struct ir_raw_event **ev, unsigned int max, | ||
| 281 | const struct ir_raw_timings_manchester *timings, | ||
| 282 | unsigned int n, unsigned int data) | ||
| 283 | { | ||
| 284 | bool need_pulse; | ||
| 285 | unsigned int i; | ||
| 286 | int ret = -ENOBUFS; | ||
| 287 | |||
| 288 | i = 1 << (n - 1); | ||
| 289 | |||
| 290 | if (timings->leader) { | ||
| 291 | if (!max--) | ||
| 292 | return ret; | ||
| 293 | if (timings->pulse_space_start) { | ||
| 294 | init_ir_raw_event_duration((*ev)++, 1, timings->leader); | ||
| 295 | |||
| 296 | if (!max--) | ||
| 297 | return ret; | ||
| 298 | init_ir_raw_event_duration((*ev), 0, timings->leader); | ||
| 299 | } else { | ||
| 300 | init_ir_raw_event_duration((*ev), 1, timings->leader); | ||
| 301 | } | ||
| 302 | i >>= 1; | ||
| 303 | } else { | ||
| 304 | /* continue existing signal */ | ||
| 305 | --(*ev); | ||
| 306 | } | ||
| 307 | /* from here on *ev will point to the last event rather than the next */ | ||
| 308 | |||
| 309 | while (n && i > 0) { | ||
| 310 | need_pulse = !(data & i); | ||
| 311 | if (timings->invert) | ||
| 312 | need_pulse = !need_pulse; | ||
| 313 | if (need_pulse == !!(*ev)->pulse) { | ||
| 314 | (*ev)->duration += timings->clock; | ||
| 315 | } else { | ||
| 316 | if (!max--) | ||
| 317 | goto nobufs; | ||
| 318 | init_ir_raw_event_duration(++(*ev), need_pulse, | ||
| 319 | timings->clock); | ||
| 320 | } | ||
| 321 | |||
| 322 | if (!max--) | ||
| 323 | goto nobufs; | ||
| 324 | init_ir_raw_event_duration(++(*ev), !need_pulse, | ||
| 325 | timings->clock); | ||
| 326 | i >>= 1; | ||
| 327 | } | ||
| 328 | |||
| 329 | if (timings->trailer_space) { | ||
| 330 | if (!(*ev)->pulse) | ||
| 331 | (*ev)->duration += timings->trailer_space; | ||
| 332 | else if (!max--) | ||
| 333 | goto nobufs; | ||
| 334 | else | ||
| 335 | init_ir_raw_event_duration(++(*ev), 0, | ||
| 336 | timings->trailer_space); | ||
| 337 | } | ||
| 338 | |||
| 339 | ret = 0; | ||
| 340 | nobufs: | ||
| 341 | /* point to the next event rather than last event before returning */ | ||
| 342 | ++(*ev); | ||
| 343 | return ret; | ||
| 344 | } | ||
| 345 | EXPORT_SYMBOL(ir_raw_gen_manchester); | ||
| 346 | |||
| 347 | /** | ||
| 348 | * ir_raw_encode_scancode() - Encode a scancode as raw events | ||
| 349 | * | ||
| 350 | * @protocols: permitted protocols | ||
| 351 | * @scancode: scancode filter describing a single scancode | ||
| 352 | * @events: array of raw events to write into | ||
| 353 | * @max: max number of raw events | ||
| 354 | * | ||
| 355 | * Attempts to encode the scancode as raw events. | ||
| 356 | * | ||
| 357 | * Returns: The number of events written. | ||
| 358 | * -ENOBUFS if there isn't enough space in the array to fit the | ||
| 359 | * encoding. In this case all @max events will have been written. | ||
| 360 | * -EINVAL if the scancode is ambiguous or invalid, or if no | ||
| 361 | * compatible encoder was found. | ||
| 362 | */ | ||
| 363 | int ir_raw_encode_scancode(u64 protocols, | ||
| 364 | const struct rc_scancode_filter *scancode, | ||
| 365 | struct ir_raw_event *events, unsigned int max) | ||
| 366 | { | ||
| 367 | struct ir_raw_handler *handler; | ||
| 368 | int ret = -EINVAL; | ||
| 369 | |||
| 370 | mutex_lock(&ir_raw_handler_lock); | ||
| 371 | list_for_each_entry(handler, &ir_raw_handler_list, list) { | ||
| 372 | if (handler->protocols & protocols && handler->encode) { | ||
| 373 | ret = handler->encode(protocols, scancode, events, max); | ||
| 374 | if (ret >= 0 || ret == -ENOBUFS) | ||
| 375 | break; | ||
| 376 | } | ||
| 377 | } | ||
| 378 | mutex_unlock(&ir_raw_handler_lock); | ||
| 379 | |||
| 380 | return ret; | ||
| 381 | } | ||
| 382 | EXPORT_SYMBOL(ir_raw_encode_scancode); | ||
| 383 | |||
| 384 | /* | 249 | /* |
| 385 | * Used to (un)register raw event clients | 250 | * Used to (un)register raw event clients |
| 386 | */ | 251 | */ |
| @@ -463,8 +328,6 @@ int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) | |||
| 463 | list_for_each_entry(raw, &ir_raw_client_list, list) | 328 | list_for_each_entry(raw, &ir_raw_client_list, list) |
| 464 | ir_raw_handler->raw_register(raw->dev); | 329 | ir_raw_handler->raw_register(raw->dev); |
| 465 | available_protocols |= ir_raw_handler->protocols; | 330 | available_protocols |= ir_raw_handler->protocols; |
| 466 | if (ir_raw_handler->encode) | ||
| 467 | encode_protocols |= ir_raw_handler->protocols; | ||
| 468 | mutex_unlock(&ir_raw_handler_lock); | 331 | mutex_unlock(&ir_raw_handler_lock); |
| 469 | 332 | ||
| 470 | return 0; | 333 | return 0; |
| @@ -481,8 +344,6 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) | |||
| 481 | list_for_each_entry(raw, &ir_raw_client_list, list) | 344 | list_for_each_entry(raw, &ir_raw_client_list, list) |
| 482 | ir_raw_handler->raw_unregister(raw->dev); | 345 | ir_raw_handler->raw_unregister(raw->dev); |
| 483 | available_protocols &= ~ir_raw_handler->protocols; | 346 | available_protocols &= ~ir_raw_handler->protocols; |
| 484 | if (ir_raw_handler->encode) | ||
| 485 | encode_protocols &= ~ir_raw_handler->protocols; | ||
| 486 | mutex_unlock(&ir_raw_handler_lock); | 347 | mutex_unlock(&ir_raw_handler_lock); |
| 487 | } | 348 | } |
| 488 | EXPORT_SYMBOL(ir_raw_handler_unregister); | 349 | EXPORT_SYMBOL(ir_raw_handler_unregister); |
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index d8bdf63ce985..63dace8198b0 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
| 29 | #include <linux/slab.h> | ||
| 30 | #include <media/rc-core.h> | 29 | #include <media/rc-core.h> |
| 31 | 30 | ||
| 32 | #define DRIVER_NAME "rc-loopback" | 31 | #define DRIVER_NAME "rc-loopback" |
| @@ -177,39 +176,6 @@ static int loop_set_carrier_report(struct rc_dev *dev, int enable) | |||
| 177 | return 0; | 176 | return 0; |
| 178 | } | 177 | } |
| 179 | 178 | ||
| 180 | static int loop_set_wakeup_filter(struct rc_dev *dev, | ||
| 181 | struct rc_scancode_filter *sc_filter) | ||
| 182 | { | ||
| 183 | static const unsigned int max = 512; | ||
| 184 | struct ir_raw_event *raw; | ||
| 185 | int ret; | ||
| 186 | int i; | ||
| 187 | |||
| 188 | /* fine to disable filter */ | ||
| 189 | if (!sc_filter->mask) | ||
| 190 | return 0; | ||
| 191 | |||
| 192 | /* encode the specified filter and loop it back */ | ||
| 193 | raw = kmalloc_array(max, sizeof(*raw), GFP_KERNEL); | ||
| 194 | ret = ir_raw_encode_scancode(dev->enabled_wakeup_protocols, sc_filter, | ||
| 195 | raw, max); | ||
| 196 | /* still loop back the partial raw IR even if it's incomplete */ | ||
| 197 | if (ret == -ENOBUFS) | ||
| 198 | ret = max; | ||
| 199 | if (ret >= 0) { | ||
| 200 | /* do the loopback */ | ||
| 201 | for (i = 0; i < ret; ++i) | ||
| 202 | ir_raw_event_store(dev, &raw[i]); | ||
| 203 | ir_raw_event_handle(dev); | ||
| 204 | |||
| 205 | ret = 0; | ||
| 206 | } | ||
| 207 | |||
| 208 | kfree(raw); | ||
| 209 | |||
| 210 | return ret; | ||
| 211 | } | ||
| 212 | |||
| 213 | static int __init loop_init(void) | 179 | static int __init loop_init(void) |
| 214 | { | 180 | { |
| 215 | struct rc_dev *rc; | 181 | struct rc_dev *rc; |
| @@ -229,7 +195,6 @@ static int __init loop_init(void) | |||
| 229 | rc->map_name = RC_MAP_EMPTY; | 195 | rc->map_name = RC_MAP_EMPTY; |
| 230 | rc->priv = &loopdev; | 196 | rc->priv = &loopdev; |
| 231 | rc->driver_type = RC_DRIVER_IR_RAW; | 197 | rc->driver_type = RC_DRIVER_IR_RAW; |
| 232 | rc->encode_wakeup = true; | ||
| 233 | rc->allowed_protocols = RC_BIT_ALL; | 198 | rc->allowed_protocols = RC_BIT_ALL; |
| 234 | rc->timeout = 100 * 1000 * 1000; /* 100 ms */ | 199 | rc->timeout = 100 * 1000 * 1000; /* 100 ms */ |
| 235 | rc->min_timeout = 1; | 200 | rc->min_timeout = 1; |
| @@ -244,7 +209,6 @@ static int __init loop_init(void) | |||
| 244 | rc->s_idle = loop_set_idle; | 209 | rc->s_idle = loop_set_idle; |
| 245 | rc->s_learning_mode = loop_set_learning_mode; | 210 | rc->s_learning_mode = loop_set_learning_mode; |
| 246 | rc->s_carrier_report = loop_set_carrier_report; | 211 | rc->s_carrier_report = loop_set_carrier_report; |
| 247 | rc->s_wakeup_filter = loop_set_wakeup_filter; | ||
| 248 | 212 | ||
| 249 | loopdev.txmask = RXMASK_REGULAR; | 213 | loopdev.txmask = RXMASK_REGULAR; |
| 250 | loopdev.txcarrier = 36000; | 214 | loopdev.txcarrier = 36000; |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 9d015db65280..0ff388a16168 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
| @@ -865,8 +865,6 @@ static ssize_t show_protocols(struct device *device, | |||
| 865 | } else { | 865 | } else { |
| 866 | enabled = dev->enabled_wakeup_protocols; | 866 | enabled = dev->enabled_wakeup_protocols; |
| 867 | allowed = dev->allowed_wakeup_protocols; | 867 | allowed = dev->allowed_wakeup_protocols; |
| 868 | if (dev->encode_wakeup && !allowed) | ||
| 869 | allowed = ir_raw_get_encode_protocols(); | ||
| 870 | } | 868 | } |
| 871 | 869 | ||
| 872 | mutex_unlock(&dev->lock); | 870 | mutex_unlock(&dev->lock); |
| @@ -1408,16 +1406,13 @@ int rc_register_device(struct rc_dev *dev) | |||
| 1408 | path ? path : "N/A"); | 1406 | path ? path : "N/A"); |
| 1409 | kfree(path); | 1407 | kfree(path); |
| 1410 | 1408 | ||
| 1411 | if (dev->driver_type == RC_DRIVER_IR_RAW || dev->encode_wakeup) { | 1409 | if (dev->driver_type == RC_DRIVER_IR_RAW) { |
| 1412 | /* Load raw decoders, if they aren't already */ | 1410 | /* Load raw decoders, if they aren't already */ |
| 1413 | if (!raw_init) { | 1411 | if (!raw_init) { |
| 1414 | IR_dprintk(1, "Loading raw decoders\n"); | 1412 | IR_dprintk(1, "Loading raw decoders\n"); |
| 1415 | ir_raw_init(); | 1413 | ir_raw_init(); |
| 1416 | raw_init = true; | 1414 | raw_init = true; |
| 1417 | } | 1415 | } |
| 1418 | } | ||
| 1419 | |||
| 1420 | if (dev->driver_type == RC_DRIVER_IR_RAW) { | ||
| 1421 | /* calls ir_register_device so unlock mutex here*/ | 1416 | /* calls ir_register_device so unlock mutex here*/ |
| 1422 | mutex_unlock(&dev->lock); | 1417 | mutex_unlock(&dev->lock); |
| 1423 | rc = ir_raw_event_register(dev); | 1418 | rc = ir_raw_event_register(dev); |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 93b315459098..a14c428f70e9 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
| @@ -715,6 +715,7 @@ static void __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) | |||
| 715 | break; | 715 | break; |
| 716 | case VB2_BUF_STATE_PREPARING: | 716 | case VB2_BUF_STATE_PREPARING: |
| 717 | case VB2_BUF_STATE_DEQUEUED: | 717 | case VB2_BUF_STATE_DEQUEUED: |
| 718 | case VB2_BUF_STATE_REQUEUEING: | ||
| 718 | /* nothing */ | 719 | /* nothing */ |
| 719 | break; | 720 | break; |
| 720 | } | 721 | } |
| @@ -1182,7 +1183,8 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
| 1182 | 1183 | ||
| 1183 | if (WARN_ON(state != VB2_BUF_STATE_DONE && | 1184 | if (WARN_ON(state != VB2_BUF_STATE_DONE && |
| 1184 | state != VB2_BUF_STATE_ERROR && | 1185 | state != VB2_BUF_STATE_ERROR && |
| 1185 | state != VB2_BUF_STATE_QUEUED)) | 1186 | state != VB2_BUF_STATE_QUEUED && |
| 1187 | state != VB2_BUF_STATE_REQUEUEING)) | ||
| 1186 | state = VB2_BUF_STATE_ERROR; | 1188 | state = VB2_BUF_STATE_ERROR; |
| 1187 | 1189 | ||
| 1188 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1190 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
| @@ -1199,22 +1201,30 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
| 1199 | for (plane = 0; plane < vb->num_planes; ++plane) | 1201 | for (plane = 0; plane < vb->num_planes; ++plane) |
| 1200 | call_void_memop(vb, finish, vb->planes[plane].mem_priv); | 1202 | call_void_memop(vb, finish, vb->planes[plane].mem_priv); |
| 1201 | 1203 | ||
| 1202 | /* Add the buffer to the done buffers list */ | ||
| 1203 | spin_lock_irqsave(&q->done_lock, flags); | 1204 | spin_lock_irqsave(&q->done_lock, flags); |
| 1204 | vb->state = state; | 1205 | if (state == VB2_BUF_STATE_QUEUED || |
| 1205 | if (state != VB2_BUF_STATE_QUEUED) | 1206 | state == VB2_BUF_STATE_REQUEUEING) { |
| 1207 | vb->state = VB2_BUF_STATE_QUEUED; | ||
| 1208 | } else { | ||
| 1209 | /* Add the buffer to the done buffers list */ | ||
| 1206 | list_add_tail(&vb->done_entry, &q->done_list); | 1210 | list_add_tail(&vb->done_entry, &q->done_list); |
| 1211 | vb->state = state; | ||
| 1212 | } | ||
| 1207 | atomic_dec(&q->owned_by_drv_count); | 1213 | atomic_dec(&q->owned_by_drv_count); |
| 1208 | spin_unlock_irqrestore(&q->done_lock, flags); | 1214 | spin_unlock_irqrestore(&q->done_lock, flags); |
| 1209 | 1215 | ||
| 1210 | if (state == VB2_BUF_STATE_QUEUED) { | 1216 | switch (state) { |
| 1217 | case VB2_BUF_STATE_QUEUED: | ||
| 1218 | return; | ||
| 1219 | case VB2_BUF_STATE_REQUEUEING: | ||
| 1211 | if (q->start_streaming_called) | 1220 | if (q->start_streaming_called) |
| 1212 | __enqueue_in_driver(vb); | 1221 | __enqueue_in_driver(vb); |
| 1213 | return; | 1222 | return; |
| 1223 | default: | ||
| 1224 | /* Inform any processes that may be waiting for buffers */ | ||
| 1225 | wake_up(&q->done_wq); | ||
| 1226 | break; | ||
| 1214 | } | 1227 | } |
| 1215 | |||
| 1216 | /* Inform any processes that may be waiting for buffers */ | ||
| 1217 | wake_up(&q->done_wq); | ||
| 1218 | } | 1228 | } |
| 1219 | EXPORT_SYMBOL_GPL(vb2_buffer_done); | 1229 | EXPORT_SYMBOL_GPL(vb2_buffer_done); |
| 1220 | 1230 | ||
| @@ -1244,19 +1254,19 @@ EXPORT_SYMBOL_GPL(vb2_discard_done); | |||
| 1244 | 1254 | ||
| 1245 | static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) | 1255 | static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) |
| 1246 | { | 1256 | { |
| 1247 | static bool __check_once __read_mostly; | 1257 | static bool check_once; |
| 1248 | 1258 | ||
| 1249 | if (__check_once) | 1259 | if (check_once) |
| 1250 | return; | 1260 | return; |
| 1251 | 1261 | ||
| 1252 | __check_once = true; | 1262 | check_once = true; |
| 1253 | __WARN(); | 1263 | WARN_ON(1); |
| 1254 | 1264 | ||
| 1255 | pr_warn_once("use of bytesused == 0 is deprecated and will be removed in the future,\n"); | 1265 | pr_warn("use of bytesused == 0 is deprecated and will be removed in the future,\n"); |
| 1256 | if (vb->vb2_queue->allow_zero_bytesused) | 1266 | if (vb->vb2_queue->allow_zero_bytesused) |
| 1257 | pr_warn_once("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); | 1267 | pr_warn("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); |
| 1258 | else | 1268 | else |
| 1259 | pr_warn_once("use the actual size instead.\n"); | 1269 | pr_warn("use the actual size instead.\n"); |
| 1260 | } | 1270 | } |
| 1261 | 1271 | ||
| 1262 | /** | 1272 | /** |
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index 3a27a84ad3ec..9426276dbe14 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c | |||
| @@ -2245,6 +2245,9 @@ void omap3_gpmc_save_context(void) | |||
| 2245 | { | 2245 | { |
| 2246 | int i; | 2246 | int i; |
| 2247 | 2247 | ||
| 2248 | if (!gpmc_base) | ||
| 2249 | return; | ||
| 2250 | |||
| 2248 | gpmc_context.sysconfig = gpmc_read_reg(GPMC_SYSCONFIG); | 2251 | gpmc_context.sysconfig = gpmc_read_reg(GPMC_SYSCONFIG); |
| 2249 | gpmc_context.irqenable = gpmc_read_reg(GPMC_IRQENABLE); | 2252 | gpmc_context.irqenable = gpmc_read_reg(GPMC_IRQENABLE); |
| 2250 | gpmc_context.timeout_ctrl = gpmc_read_reg(GPMC_TIMEOUT_CONTROL); | 2253 | gpmc_context.timeout_ctrl = gpmc_read_reg(GPMC_TIMEOUT_CONTROL); |
| @@ -2277,6 +2280,9 @@ void omap3_gpmc_restore_context(void) | |||
| 2277 | { | 2280 | { |
| 2278 | int i; | 2281 | int i; |
| 2279 | 2282 | ||
| 2283 | if (!gpmc_base) | ||
| 2284 | return; | ||
| 2285 | |||
| 2280 | gpmc_write_reg(GPMC_SYSCONFIG, gpmc_context.sysconfig); | 2286 | gpmc_write_reg(GPMC_SYSCONFIG, gpmc_context.sysconfig); |
| 2281 | gpmc_write_reg(GPMC_IRQENABLE, gpmc_context.irqenable); | 2287 | gpmc_write_reg(GPMC_IRQENABLE, gpmc_context.irqenable); |
| 2282 | gpmc_write_reg(GPMC_TIMEOUT_CONTROL, gpmc_context.timeout_ctrl); | 2288 | gpmc_write_reg(GPMC_TIMEOUT_CONTROL, gpmc_context.timeout_ctrl); |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 653815950aa2..3f68dd251ce8 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -115,7 +115,7 @@ config MFD_CROS_EC_I2C | |||
| 115 | 115 | ||
| 116 | config MFD_CROS_EC_SPI | 116 | config MFD_CROS_EC_SPI |
| 117 | tristate "ChromeOS Embedded Controller (SPI)" | 117 | tristate "ChromeOS Embedded Controller (SPI)" |
| 118 | depends on MFD_CROS_EC && CROS_EC_PROTO && SPI && OF | 118 | depends on MFD_CROS_EC && CROS_EC_PROTO && SPI |
| 119 | 119 | ||
| 120 | ---help--- | 120 | ---help--- |
| 121 | If you say Y here, you get support for talking to the ChromeOS EC | 121 | If you say Y here, you get support for talking to the ChromeOS EC |
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index bebf58a06a6b..a72ddb295078 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c | |||
| @@ -651,7 +651,7 @@ static int arizona_runtime_suspend(struct device *dev) | |||
| 651 | 651 | ||
| 652 | arizona->has_fully_powered_off = true; | 652 | arizona->has_fully_powered_off = true; |
| 653 | 653 | ||
| 654 | disable_irq(arizona->irq); | 654 | disable_irq_nosync(arizona->irq); |
| 655 | arizona_enable_reset(arizona); | 655 | arizona_enable_reset(arizona); |
| 656 | regulator_bulk_disable(arizona->num_core_supplies, | 656 | regulator_bulk_disable(arizona->num_core_supplies, |
| 657 | arizona->core_supplies); | 657 | arizona->core_supplies); |
| @@ -1141,10 +1141,6 @@ int arizona_dev_init(struct arizona *arizona) | |||
| 1141 | arizona->pdata.gpio_defaults[i]); | 1141 | arizona->pdata.gpio_defaults[i]); |
| 1142 | } | 1142 | } |
| 1143 | 1143 | ||
| 1144 | pm_runtime_set_autosuspend_delay(arizona->dev, 100); | ||
| 1145 | pm_runtime_use_autosuspend(arizona->dev); | ||
| 1146 | pm_runtime_enable(arizona->dev); | ||
| 1147 | |||
| 1148 | /* Chip default */ | 1144 | /* Chip default */ |
| 1149 | if (!arizona->pdata.clk32k_src) | 1145 | if (!arizona->pdata.clk32k_src) |
| 1150 | arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2; | 1146 | arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2; |
| @@ -1245,11 +1241,17 @@ int arizona_dev_init(struct arizona *arizona) | |||
| 1245 | arizona->pdata.spk_fmt[i]); | 1241 | arizona->pdata.spk_fmt[i]); |
| 1246 | } | 1242 | } |
| 1247 | 1243 | ||
| 1244 | pm_runtime_set_active(arizona->dev); | ||
| 1245 | pm_runtime_enable(arizona->dev); | ||
| 1246 | |||
| 1248 | /* Set up for interrupts */ | 1247 | /* Set up for interrupts */ |
| 1249 | ret = arizona_irq_init(arizona); | 1248 | ret = arizona_irq_init(arizona); |
| 1250 | if (ret != 0) | 1249 | if (ret != 0) |
| 1251 | goto err_reset; | 1250 | goto err_reset; |
| 1252 | 1251 | ||
| 1252 | pm_runtime_set_autosuspend_delay(arizona->dev, 100); | ||
| 1253 | pm_runtime_use_autosuspend(arizona->dev); | ||
| 1254 | |||
| 1253 | arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error", | 1255 | arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error", |
| 1254 | arizona_clkgen_err, arizona); | 1256 | arizona_clkgen_err, arizona); |
| 1255 | arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked", | 1257 | arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked", |
| @@ -1278,10 +1280,6 @@ int arizona_dev_init(struct arizona *arizona) | |||
| 1278 | goto err_irq; | 1280 | goto err_irq; |
| 1279 | } | 1281 | } |
| 1280 | 1282 | ||
| 1281 | #ifdef CONFIG_PM | ||
| 1282 | regulator_disable(arizona->dcvdd); | ||
| 1283 | #endif | ||
| 1284 | |||
| 1285 | return 0; | 1283 | return 0; |
| 1286 | 1284 | ||
| 1287 | err_irq: | 1285 | err_irq: |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 2d3db81be099..6ded3dc36644 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
| @@ -438,9 +438,6 @@ static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj, | |||
| 438 | { | 438 | { |
| 439 | struct at24_data *at24; | 439 | struct at24_data *at24; |
| 440 | 440 | ||
| 441 | if (unlikely(off >= attr->size)) | ||
| 442 | return -EFBIG; | ||
| 443 | |||
| 444 | at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); | 441 | at24 = dev_get_drvdata(container_of(kobj, struct device, kobj)); |
| 445 | return at24_write(at24, buf, off, count); | 442 | return at24_write(at24, buf, off, count); |
| 446 | } | 443 | } |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index e1ccefce9a9d..a98dd4f1b0e3 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -786,6 +786,7 @@ static bool bond_should_notify_peers(struct bonding *bond) | |||
| 786 | slave ? slave->dev->name : "NULL"); | 786 | slave ? slave->dev->name : "NULL"); |
| 787 | 787 | ||
| 788 | if (!slave || !bond->send_peer_notif || | 788 | if (!slave || !bond->send_peer_notif || |
| 789 | !netif_carrier_ok(bond->dev) || | ||
| 789 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) | 790 | test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state)) |
| 790 | return false; | 791 | return false; |
| 791 | 792 | ||
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 6b94007ae052..838545ce468d 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c | |||
| @@ -854,6 +854,18 @@ static int pcan_usb_probe(struct usb_interface *intf) | |||
| 854 | /* | 854 | /* |
| 855 | * describe the PCAN-USB adapter | 855 | * describe the PCAN-USB adapter |
| 856 | */ | 856 | */ |
| 857 | static const struct can_bittiming_const pcan_usb_const = { | ||
| 858 | .name = "pcan_usb", | ||
| 859 | .tseg1_min = 1, | ||
| 860 | .tseg1_max = 16, | ||
| 861 | .tseg2_min = 1, | ||
| 862 | .tseg2_max = 8, | ||
| 863 | .sjw_max = 4, | ||
| 864 | .brp_min = 1, | ||
| 865 | .brp_max = 64, | ||
| 866 | .brp_inc = 1, | ||
| 867 | }; | ||
| 868 | |||
| 857 | const struct peak_usb_adapter pcan_usb = { | 869 | const struct peak_usb_adapter pcan_usb = { |
| 858 | .name = "PCAN-USB", | 870 | .name = "PCAN-USB", |
| 859 | .device_id = PCAN_USB_PRODUCT_ID, | 871 | .device_id = PCAN_USB_PRODUCT_ID, |
| @@ -862,17 +874,7 @@ const struct peak_usb_adapter pcan_usb = { | |||
| 862 | .clock = { | 874 | .clock = { |
| 863 | .freq = PCAN_USB_CRYSTAL_HZ / 2 , | 875 | .freq = PCAN_USB_CRYSTAL_HZ / 2 , |
| 864 | }, | 876 | }, |
| 865 | .bittiming_const = { | 877 | .bittiming_const = &pcan_usb_const, |
| 866 | .name = "pcan_usb", | ||
| 867 | .tseg1_min = 1, | ||
| 868 | .tseg1_max = 16, | ||
| 869 | .tseg2_min = 1, | ||
| 870 | .tseg2_max = 8, | ||
| 871 | .sjw_max = 4, | ||
| 872 | .brp_min = 1, | ||
| 873 | .brp_max = 64, | ||
| 874 | .brp_inc = 1, | ||
| 875 | }, | ||
| 876 | 878 | ||
| 877 | /* size of device private data */ | 879 | /* size of device private data */ |
| 878 | .sizeof_dev_private = sizeof(struct pcan_usb), | 880 | .sizeof_dev_private = sizeof(struct pcan_usb), |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.c b/drivers/net/can/usb/peak_usb/pcan_usb_core.c index 7921cff93a63..5a2e341a6d1e 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c | |||
| @@ -792,9 +792,9 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter, | |||
| 792 | dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx]; | 792 | dev->ep_msg_out = peak_usb_adapter->ep_msg_out[ctrl_idx]; |
| 793 | 793 | ||
| 794 | dev->can.clock = peak_usb_adapter->clock; | 794 | dev->can.clock = peak_usb_adapter->clock; |
| 795 | dev->can.bittiming_const = &peak_usb_adapter->bittiming_const; | 795 | dev->can.bittiming_const = peak_usb_adapter->bittiming_const; |
| 796 | dev->can.do_set_bittiming = peak_usb_set_bittiming; | 796 | dev->can.do_set_bittiming = peak_usb_set_bittiming; |
| 797 | dev->can.data_bittiming_const = &peak_usb_adapter->data_bittiming_const; | 797 | dev->can.data_bittiming_const = peak_usb_adapter->data_bittiming_const; |
| 798 | dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming; | 798 | dev->can.do_set_data_bittiming = peak_usb_set_data_bittiming; |
| 799 | dev->can.do_set_mode = peak_usb_set_mode; | 799 | dev->can.do_set_mode = peak_usb_set_mode; |
| 800 | dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter; | 800 | dev->can.do_get_berr_counter = peak_usb_adapter->do_get_berr_counter; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_core.h b/drivers/net/can/usb/peak_usb/pcan_usb_core.h index 9e624f05ad4d..506fe506c9d3 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.h +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.h | |||
| @@ -48,8 +48,8 @@ struct peak_usb_adapter { | |||
| 48 | u32 device_id; | 48 | u32 device_id; |
| 49 | u32 ctrlmode_supported; | 49 | u32 ctrlmode_supported; |
| 50 | struct can_clock clock; | 50 | struct can_clock clock; |
| 51 | const struct can_bittiming_const bittiming_const; | 51 | const struct can_bittiming_const * const bittiming_const; |
| 52 | const struct can_bittiming_const data_bittiming_const; | 52 | const struct can_bittiming_const * const data_bittiming_const; |
| 53 | unsigned int ctrl_count; | 53 | unsigned int ctrl_count; |
| 54 | 54 | ||
| 55 | int (*intf_probe)(struct usb_interface *intf); | 55 | int (*intf_probe)(struct usb_interface *intf); |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c index 09d14e70abd7..ce44a033f63b 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_fd.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_fd.c | |||
| @@ -990,6 +990,30 @@ static void pcan_usb_fd_free(struct peak_usb_device *dev) | |||
| 990 | } | 990 | } |
| 991 | 991 | ||
| 992 | /* describes the PCAN-USB FD adapter */ | 992 | /* describes the PCAN-USB FD adapter */ |
| 993 | static const struct can_bittiming_const pcan_usb_fd_const = { | ||
| 994 | .name = "pcan_usb_fd", | ||
| 995 | .tseg1_min = 1, | ||
| 996 | .tseg1_max = 64, | ||
| 997 | .tseg2_min = 1, | ||
| 998 | .tseg2_max = 16, | ||
| 999 | .sjw_max = 16, | ||
| 1000 | .brp_min = 1, | ||
| 1001 | .brp_max = 1024, | ||
| 1002 | .brp_inc = 1, | ||
| 1003 | }; | ||
| 1004 | |||
| 1005 | static const struct can_bittiming_const pcan_usb_fd_data_const = { | ||
| 1006 | .name = "pcan_usb_fd", | ||
| 1007 | .tseg1_min = 1, | ||
| 1008 | .tseg1_max = 16, | ||
| 1009 | .tseg2_min = 1, | ||
| 1010 | .tseg2_max = 8, | ||
| 1011 | .sjw_max = 4, | ||
| 1012 | .brp_min = 1, | ||
| 1013 | .brp_max = 1024, | ||
| 1014 | .brp_inc = 1, | ||
| 1015 | }; | ||
| 1016 | |||
| 993 | const struct peak_usb_adapter pcan_usb_fd = { | 1017 | const struct peak_usb_adapter pcan_usb_fd = { |
| 994 | .name = "PCAN-USB FD", | 1018 | .name = "PCAN-USB FD", |
| 995 | .device_id = PCAN_USBFD_PRODUCT_ID, | 1019 | .device_id = PCAN_USBFD_PRODUCT_ID, |
| @@ -999,28 +1023,8 @@ const struct peak_usb_adapter pcan_usb_fd = { | |||
| 999 | .clock = { | 1023 | .clock = { |
| 1000 | .freq = PCAN_UFD_CRYSTAL_HZ, | 1024 | .freq = PCAN_UFD_CRYSTAL_HZ, |
| 1001 | }, | 1025 | }, |
| 1002 | .bittiming_const = { | 1026 | .bittiming_const = &pcan_usb_fd_const, |
| 1003 | .name = "pcan_usb_fd", | 1027 | .data_bittiming_const = &pcan_usb_fd_data_const, |
| 1004 | .tseg1_min = 1, | ||
| 1005 | .tseg1_max = 64, | ||
| 1006 | .tseg2_min = 1, | ||
| 1007 | .tseg2_max = 16, | ||
| 1008 | .sjw_max = 16, | ||
| 1009 | .brp_min = 1, | ||
| 1010 | .brp_max = 1024, | ||
| 1011 | .brp_inc = 1, | ||
| 1012 | }, | ||
| 1013 | .data_bittiming_const = { | ||
| 1014 | .name = "pcan_usb_fd", | ||
| 1015 | .tseg1_min = 1, | ||
| 1016 | .tseg1_max = 16, | ||
| 1017 | .tseg2_min = 1, | ||
| 1018 | .tseg2_max = 8, | ||
| 1019 | .sjw_max = 4, | ||
| 1020 | .brp_min = 1, | ||
| 1021 | .brp_max = 1024, | ||
| 1022 | .brp_inc = 1, | ||
| 1023 | }, | ||
| 1024 | 1028 | ||
| 1025 | /* size of device private data */ | 1029 | /* size of device private data */ |
| 1026 | .sizeof_dev_private = sizeof(struct pcan_usb_fd_device), | 1030 | .sizeof_dev_private = sizeof(struct pcan_usb_fd_device), |
| @@ -1058,6 +1062,30 @@ const struct peak_usb_adapter pcan_usb_fd = { | |||
| 1058 | }; | 1062 | }; |
| 1059 | 1063 | ||
| 1060 | /* describes the PCAN-USB Pro FD adapter */ | 1064 | /* describes the PCAN-USB Pro FD adapter */ |
| 1065 | static const struct can_bittiming_const pcan_usb_pro_fd_const = { | ||
| 1066 | .name = "pcan_usb_pro_fd", | ||
| 1067 | .tseg1_min = 1, | ||
| 1068 | .tseg1_max = 64, | ||
| 1069 | .tseg2_min = 1, | ||
| 1070 | .tseg2_max = 16, | ||
| 1071 | .sjw_max = 16, | ||
| 1072 | .brp_min = 1, | ||
| 1073 | .brp_max = 1024, | ||
| 1074 | .brp_inc = 1, | ||
| 1075 | }; | ||
| 1076 | |||
| 1077 | static const struct can_bittiming_const pcan_usb_pro_fd_data_const = { | ||
| 1078 | .name = "pcan_usb_pro_fd", | ||
| 1079 | .tseg1_min = 1, | ||
| 1080 | .tseg1_max = 16, | ||
| 1081 | .tseg2_min = 1, | ||
| 1082 | .tseg2_max = 8, | ||
| 1083 | .sjw_max = 4, | ||
| 1084 | .brp_min = 1, | ||
| 1085 | .brp_max = 1024, | ||
| 1086 | .brp_inc = 1, | ||
| 1087 | }; | ||
| 1088 | |||
| 1061 | const struct peak_usb_adapter pcan_usb_pro_fd = { | 1089 | const struct peak_usb_adapter pcan_usb_pro_fd = { |
| 1062 | .name = "PCAN-USB Pro FD", | 1090 | .name = "PCAN-USB Pro FD", |
| 1063 | .device_id = PCAN_USBPROFD_PRODUCT_ID, | 1091 | .device_id = PCAN_USBPROFD_PRODUCT_ID, |
| @@ -1067,28 +1095,8 @@ const struct peak_usb_adapter pcan_usb_pro_fd = { | |||
| 1067 | .clock = { | 1095 | .clock = { |
| 1068 | .freq = PCAN_UFD_CRYSTAL_HZ, | 1096 | .freq = PCAN_UFD_CRYSTAL_HZ, |
| 1069 | }, | 1097 | }, |
| 1070 | .bittiming_const = { | 1098 | .bittiming_const = &pcan_usb_pro_fd_const, |
| 1071 | .name = "pcan_usb_pro_fd", | 1099 | .data_bittiming_const = &pcan_usb_pro_fd_data_const, |
| 1072 | .tseg1_min = 1, | ||
| 1073 | .tseg1_max = 64, | ||
| 1074 | .tseg2_min = 1, | ||
| 1075 | .tseg2_max = 16, | ||
| 1076 | .sjw_max = 16, | ||
| 1077 | .brp_min = 1, | ||
| 1078 | .brp_max = 1024, | ||
| 1079 | .brp_inc = 1, | ||
| 1080 | }, | ||
| 1081 | .data_bittiming_const = { | ||
| 1082 | .name = "pcan_usb_pro_fd", | ||
| 1083 | .tseg1_min = 1, | ||
| 1084 | .tseg1_max = 16, | ||
| 1085 | .tseg2_min = 1, | ||
| 1086 | .tseg2_max = 8, | ||
| 1087 | .sjw_max = 4, | ||
| 1088 | .brp_min = 1, | ||
| 1089 | .brp_max = 1024, | ||
| 1090 | .brp_inc = 1, | ||
| 1091 | }, | ||
| 1092 | 1100 | ||
| 1093 | /* size of device private data */ | 1101 | /* size of device private data */ |
| 1094 | .sizeof_dev_private = sizeof(struct pcan_usb_fd_device), | 1102 | .sizeof_dev_private = sizeof(struct pcan_usb_fd_device), |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 7d61b3279798..bbdd6058cd2f 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
| @@ -1004,6 +1004,18 @@ int pcan_usb_pro_probe(struct usb_interface *intf) | |||
| 1004 | /* | 1004 | /* |
| 1005 | * describe the PCAN-USB Pro adapter | 1005 | * describe the PCAN-USB Pro adapter |
| 1006 | */ | 1006 | */ |
| 1007 | static const struct can_bittiming_const pcan_usb_pro_const = { | ||
| 1008 | .name = "pcan_usb_pro", | ||
| 1009 | .tseg1_min = 1, | ||
| 1010 | .tseg1_max = 16, | ||
| 1011 | .tseg2_min = 1, | ||
| 1012 | .tseg2_max = 8, | ||
| 1013 | .sjw_max = 4, | ||
| 1014 | .brp_min = 1, | ||
| 1015 | .brp_max = 1024, | ||
| 1016 | .brp_inc = 1, | ||
| 1017 | }; | ||
| 1018 | |||
| 1007 | const struct peak_usb_adapter pcan_usb_pro = { | 1019 | const struct peak_usb_adapter pcan_usb_pro = { |
| 1008 | .name = "PCAN-USB Pro", | 1020 | .name = "PCAN-USB Pro", |
| 1009 | .device_id = PCAN_USBPRO_PRODUCT_ID, | 1021 | .device_id = PCAN_USBPRO_PRODUCT_ID, |
| @@ -1012,17 +1024,7 @@ const struct peak_usb_adapter pcan_usb_pro = { | |||
| 1012 | .clock = { | 1024 | .clock = { |
| 1013 | .freq = PCAN_USBPRO_CRYSTAL_HZ, | 1025 | .freq = PCAN_USBPRO_CRYSTAL_HZ, |
| 1014 | }, | 1026 | }, |
| 1015 | .bittiming_const = { | 1027 | .bittiming_const = &pcan_usb_pro_const, |
| 1016 | .name = "pcan_usb_pro", | ||
| 1017 | .tseg1_min = 1, | ||
| 1018 | .tseg1_max = 16, | ||
| 1019 | .tseg2_min = 1, | ||
| 1020 | .tseg2_max = 8, | ||
| 1021 | .sjw_max = 4, | ||
| 1022 | .brp_min = 1, | ||
| 1023 | .brp_max = 1024, | ||
| 1024 | .brp_inc = 1, | ||
| 1025 | }, | ||
| 1026 | 1028 | ||
| 1027 | /* size of device private data */ | 1029 | /* size of device private data */ |
| 1028 | .sizeof_dev_private = sizeof(struct pcan_usb_pro_device), | 1030 | .sizeof_dev_private = sizeof(struct pcan_usb_pro_device), |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 2d1ce3c5d0dd..753887d02b46 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
| @@ -1763,16 +1763,9 @@ vortex_open(struct net_device *dev) | |||
| 1763 | vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); | 1763 | vp->rx_ring[i].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, PKT_BUF_SZ, PCI_DMA_FROMDEVICE)); |
| 1764 | } | 1764 | } |
| 1765 | if (i != RX_RING_SIZE) { | 1765 | if (i != RX_RING_SIZE) { |
| 1766 | int j; | ||
| 1767 | pr_emerg("%s: no memory for rx ring\n", dev->name); | 1766 | pr_emerg("%s: no memory for rx ring\n", dev->name); |
| 1768 | for (j = 0; j < i; j++) { | ||
| 1769 | if (vp->rx_skbuff[j]) { | ||
| 1770 | dev_kfree_skb(vp->rx_skbuff[j]); | ||
| 1771 | vp->rx_skbuff[j] = NULL; | ||
| 1772 | } | ||
| 1773 | } | ||
| 1774 | retval = -ENOMEM; | 1767 | retval = -ENOMEM; |
| 1775 | goto err_free_irq; | 1768 | goto err_free_skb; |
| 1776 | } | 1769 | } |
| 1777 | /* Wrap the ring. */ | 1770 | /* Wrap the ring. */ |
| 1778 | vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma); | 1771 | vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma); |
| @@ -1782,7 +1775,13 @@ vortex_open(struct net_device *dev) | |||
| 1782 | if (!retval) | 1775 | if (!retval) |
| 1783 | goto out; | 1776 | goto out; |
| 1784 | 1777 | ||
| 1785 | err_free_irq: | 1778 | err_free_skb: |
| 1779 | for (i = 0; i < RX_RING_SIZE; i++) { | ||
| 1780 | if (vp->rx_skbuff[i]) { | ||
| 1781 | dev_kfree_skb(vp->rx_skbuff[i]); | ||
| 1782 | vp->rx_skbuff[i] = NULL; | ||
| 1783 | } | ||
| 1784 | } | ||
| 1786 | free_irq(dev->irq, dev); | 1785 | free_irq(dev->irq, dev); |
| 1787 | err: | 1786 | err: |
| 1788 | if (vortex_debug > 1) | 1787 | if (vortex_debug > 1) |
diff --git a/drivers/net/ethernet/Makefile b/drivers/net/ethernet/Makefile index c51014b0464f..b52e0f63f9a3 100644 --- a/drivers/net/ethernet/Makefile +++ b/drivers/net/ethernet/Makefile | |||
| @@ -65,7 +65,7 @@ obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/ | |||
| 65 | obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/ | 65 | obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/ |
| 66 | obj-$(CONFIG_NET_VENDOR_QUALCOMM) += qualcomm/ | 66 | obj-$(CONFIG_NET_VENDOR_QUALCOMM) += qualcomm/ |
| 67 | obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/ | 67 | obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/ |
| 68 | obj-$(CONFIG_SH_ETH) += renesas/ | 68 | obj-$(CONFIG_NET_VENDOR_RENESAS) += renesas/ |
| 69 | obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ | 69 | obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ |
| 70 | obj-$(CONFIG_NET_VENDOR_ROCKER) += rocker/ | 70 | obj-$(CONFIG_NET_VENDOR_ROCKER) += rocker/ |
| 71 | obj-$(CONFIG_NET_VENDOR_SAMSUNG) += samsung/ | 71 | obj-$(CONFIG_NET_VENDOR_SAMSUNG) += samsung/ |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index a626c4315a89..cfa37041ab71 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | |||
| @@ -801,6 +801,9 @@ int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata) | |||
| 801 | 801 | ||
| 802 | void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata) | 802 | void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata) |
| 803 | { | 803 | { |
| 804 | if (pdata->phy_dev) | ||
| 805 | phy_disconnect(pdata->phy_dev); | ||
| 806 | |||
| 804 | mdiobus_unregister(pdata->mdio_bus); | 807 | mdiobus_unregister(pdata->mdio_bus); |
| 805 | mdiobus_free(pdata->mdio_bus); | 808 | mdiobus_free(pdata->mdio_bus); |
| 806 | pdata->mdio_bus = NULL; | 809 | pdata->mdio_bus = NULL; |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 299eb4315fe6..a02ea7f8fdae 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c | |||
| @@ -1277,9 +1277,10 @@ static int xgene_enet_remove(struct platform_device *pdev) | |||
| 1277 | mac_ops->tx_disable(pdata); | 1277 | mac_ops->tx_disable(pdata); |
| 1278 | 1278 | ||
| 1279 | xgene_enet_napi_del(pdata); | 1279 | xgene_enet_napi_del(pdata); |
| 1280 | xgene_enet_mdio_remove(pdata); | 1280 | if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) |
| 1281 | xgene_enet_delete_desc_rings(pdata); | 1281 | xgene_enet_mdio_remove(pdata); |
| 1282 | unregister_netdev(ndev); | 1282 | unregister_netdev(ndev); |
| 1283 | xgene_enet_delete_desc_rings(pdata); | ||
| 1283 | pdata->port_ops->shutdown(pdata); | 1284 | pdata->port_ops->shutdown(pdata); |
| 1284 | free_netdev(ndev); | 1285 | free_netdev(ndev); |
| 1285 | 1286 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index a90d7364334f..f7fbdc9d1325 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
| @@ -262,9 +262,9 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata, | |||
| 262 | if (likely(skb)) { | 262 | if (likely(skb)) { |
| 263 | (*pkts_compl)++; | 263 | (*pkts_compl)++; |
| 264 | (*bytes_compl) += skb->len; | 264 | (*bytes_compl) += skb->len; |
| 265 | dev_kfree_skb_any(skb); | ||
| 265 | } | 266 | } |
| 266 | 267 | ||
| 267 | dev_kfree_skb_any(skb); | ||
| 268 | tx_buf->first_bd = 0; | 268 | tx_buf->first_bd = 0; |
| 269 | tx_buf->skb = NULL; | 269 | tx_buf->skb = NULL; |
| 270 | 270 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c index 76b9052a961c..5907c821d131 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | |||
| @@ -1718,6 +1718,22 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf, | |||
| 1718 | offset += sizeof(u32); | 1718 | offset += sizeof(u32); |
| 1719 | data_buf += sizeof(u32); | 1719 | data_buf += sizeof(u32); |
| 1720 | written_so_far += sizeof(u32); | 1720 | written_so_far += sizeof(u32); |
| 1721 | |||
| 1722 | /* At end of each 4Kb page, release nvram lock to allow MFW | ||
| 1723 | * chance to take it for its own use. | ||
| 1724 | */ | ||
| 1725 | if ((cmd_flags & MCPR_NVM_COMMAND_LAST) && | ||
| 1726 | (written_so_far < buf_size)) { | ||
| 1727 | DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM, | ||
| 1728 | "Releasing NVM lock after offset 0x%x\n", | ||
| 1729 | (u32)(offset - sizeof(u32))); | ||
| 1730 | bnx2x_release_nvram_lock(bp); | ||
| 1731 | usleep_range(1000, 2000); | ||
| 1732 | rc = bnx2x_acquire_nvram_lock(bp); | ||
| 1733 | if (rc) | ||
| 1734 | return rc; | ||
| 1735 | } | ||
| 1736 | |||
| 1721 | cmd_flags = 0; | 1737 | cmd_flags = 0; |
| 1722 | } | 1738 | } |
| 1723 | 1739 | ||
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 64c1e9db6b0b..09ff09f828d0 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
| @@ -2126,6 +2126,8 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | |||
| 2126 | int ret = 0; | 2126 | int ret = 0; |
| 2127 | int timeout = 0; | 2127 | int timeout = 0; |
| 2128 | u32 reg; | 2128 | u32 reg; |
| 2129 | u32 dma_ctrl; | ||
| 2130 | int i; | ||
| 2129 | 2131 | ||
| 2130 | /* Disable TDMA to stop add more frames in TX DMA */ | 2132 | /* Disable TDMA to stop add more frames in TX DMA */ |
| 2131 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | 2133 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); |
| @@ -2169,6 +2171,20 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | |||
| 2169 | ret = -ETIMEDOUT; | 2171 | ret = -ETIMEDOUT; |
| 2170 | } | 2172 | } |
| 2171 | 2173 | ||
| 2174 | dma_ctrl = 0; | ||
| 2175 | for (i = 0; i < priv->hw_params->rx_queues; i++) | ||
| 2176 | dma_ctrl |= (1 << (i + DMA_RING_BUF_EN_SHIFT)); | ||
| 2177 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
| 2178 | reg &= ~dma_ctrl; | ||
| 2179 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
| 2180 | |||
| 2181 | dma_ctrl = 0; | ||
| 2182 | for (i = 0; i < priv->hw_params->tx_queues; i++) | ||
| 2183 | dma_ctrl |= (1 << (i + DMA_RING_BUF_EN_SHIFT)); | ||
| 2184 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
| 2185 | reg &= ~dma_ctrl; | ||
| 2186 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
| 2187 | |||
| 2172 | return ret; | 2188 | return ret; |
| 2173 | } | 2189 | } |
| 2174 | 2190 | ||
| @@ -2820,8 +2836,6 @@ static void bcmgenet_timeout(struct net_device *dev) | |||
| 2820 | 2836 | ||
| 2821 | netif_dbg(priv, tx_err, dev, "bcmgenet_timeout\n"); | 2837 | netif_dbg(priv, tx_err, dev, "bcmgenet_timeout\n"); |
| 2822 | 2838 | ||
| 2823 | bcmgenet_disable_tx_napi(priv); | ||
| 2824 | |||
| 2825 | for (q = 0; q < priv->hw_params->tx_queues; q++) | 2839 | for (q = 0; q < priv->hw_params->tx_queues; q++) |
| 2826 | bcmgenet_dump_tx_queue(&priv->tx_rings[q]); | 2840 | bcmgenet_dump_tx_queue(&priv->tx_rings[q]); |
| 2827 | bcmgenet_dump_tx_queue(&priv->tx_rings[DESC_INDEX]); | 2841 | bcmgenet_dump_tx_queue(&priv->tx_rings[DESC_INDEX]); |
| @@ -2837,8 +2851,6 @@ static void bcmgenet_timeout(struct net_device *dev) | |||
| 2837 | bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR); | 2851 | bcmgenet_intrl2_0_writel(priv, int0_enable, INTRL2_CPU_MASK_CLEAR); |
| 2838 | bcmgenet_intrl2_1_writel(priv, int1_enable, INTRL2_CPU_MASK_CLEAR); | 2852 | bcmgenet_intrl2_1_writel(priv, int1_enable, INTRL2_CPU_MASK_CLEAR); |
| 2839 | 2853 | ||
| 2840 | bcmgenet_enable_tx_napi(priv); | ||
| 2841 | |||
| 2842 | dev->trans_start = jiffies; | 2854 | dev->trans_start = jiffies; |
| 2843 | 2855 | ||
| 2844 | dev->stats.tx_errors++; | 2856 | dev->stats.tx_errors++; |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 0612b19f6313..506047c38607 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
| @@ -676,6 +676,7 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) | |||
| 676 | if (!next_cmpl->valid) | 676 | if (!next_cmpl->valid) |
| 677 | break; | 677 | break; |
| 678 | } | 678 | } |
| 679 | packets++; | ||
| 679 | 680 | ||
| 680 | /* TODO: BNA_CQ_EF_LOCAL ? */ | 681 | /* TODO: BNA_CQ_EF_LOCAL ? */ |
| 681 | if (unlikely(flags & (BNA_CQ_EF_MAC_ERROR | | 682 | if (unlikely(flags & (BNA_CQ_EF_MAC_ERROR | |
| @@ -692,7 +693,6 @@ bnad_cq_process(struct bnad *bnad, struct bna_ccb *ccb, int budget) | |||
| 692 | else | 693 | else |
| 693 | bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len); | 694 | bnad_cq_setup_skb_frags(rcb, skb, sop_ci, nvecs, len); |
| 694 | 695 | ||
| 695 | packets++; | ||
| 696 | rcb->rxq->rx_packets++; | 696 | rcb->rxq->rx_packets++; |
| 697 | rcb->rxq->rx_bytes += totlen; | 697 | rcb->rxq->rx_bytes += totlen; |
| 698 | ccb->bytes_per_intr += totlen; | 698 | ccb->bytes_per_intr += totlen; |
diff --git a/drivers/net/ethernet/cavium/Kconfig b/drivers/net/ethernet/cavium/Kconfig index c4d6bbe9458d..02e23e6f1424 100644 --- a/drivers/net/ethernet/cavium/Kconfig +++ b/drivers/net/ethernet/cavium/Kconfig | |||
| @@ -16,7 +16,6 @@ if NET_VENDOR_CAVIUM | |||
| 16 | config THUNDER_NIC_PF | 16 | config THUNDER_NIC_PF |
| 17 | tristate "Thunder Physical function driver" | 17 | tristate "Thunder Physical function driver" |
| 18 | depends on 64BIT | 18 | depends on 64BIT |
| 19 | default ARCH_THUNDER | ||
| 20 | select THUNDER_NIC_BGX | 19 | select THUNDER_NIC_BGX |
| 21 | ---help--- | 20 | ---help--- |
| 22 | This driver supports Thunder's NIC physical function. | 21 | This driver supports Thunder's NIC physical function. |
| @@ -29,14 +28,12 @@ config THUNDER_NIC_PF | |||
| 29 | config THUNDER_NIC_VF | 28 | config THUNDER_NIC_VF |
| 30 | tristate "Thunder Virtual function driver" | 29 | tristate "Thunder Virtual function driver" |
| 31 | depends on 64BIT | 30 | depends on 64BIT |
| 32 | default ARCH_THUNDER | ||
| 33 | ---help--- | 31 | ---help--- |
| 34 | This driver supports Thunder's NIC virtual function | 32 | This driver supports Thunder's NIC virtual function |
| 35 | 33 | ||
| 36 | config THUNDER_NIC_BGX | 34 | config THUNDER_NIC_BGX |
| 37 | tristate "Thunder MAC interface driver (BGX)" | 35 | tristate "Thunder MAC interface driver (BGX)" |
| 38 | depends on 64BIT | 36 | depends on 64BIT |
| 39 | default ARCH_THUNDER | ||
| 40 | ---help--- | 37 | ---help--- |
| 41 | This driver supports programming and controlling of MAC | 38 | This driver supports programming and controlling of MAC |
| 42 | interface from NIC physical function driver. | 39 | interface from NIC physical function driver. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index a11485fbb33f..c3c7db41819d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | |||
| @@ -2332,10 +2332,11 @@ int t4_setup_debugfs(struct adapter *adap) | |||
| 2332 | EXT_MEM1_SIZE_G(size)); | 2332 | EXT_MEM1_SIZE_G(size)); |
| 2333 | } | 2333 | } |
| 2334 | } else { | 2334 | } else { |
| 2335 | if (i & EXT_MEM_ENABLE_F) | 2335 | if (i & EXT_MEM_ENABLE_F) { |
| 2336 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); | 2336 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); |
| 2337 | add_debugfs_mem(adap, "mc", MEM_MC, | 2337 | add_debugfs_mem(adap, "mc", MEM_MC, |
| 2338 | EXT_MEM_SIZE_G(size)); | 2338 | EXT_MEM_SIZE_G(size)); |
| 2339 | } | ||
| 2339 | } | 2340 | } |
| 2340 | 2341 | ||
| 2341 | de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap, | 2342 | de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap, |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 2716e6f30d9a..00e3a6b6b822 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
| @@ -620,6 +620,11 @@ enum be_if_flags { | |||
| 620 | BE_IF_FLAGS_VLAN_PROMISCUOUS |\ | 620 | BE_IF_FLAGS_VLAN_PROMISCUOUS |\ |
| 621 | BE_IF_FLAGS_MCAST_PROMISCUOUS) | 621 | BE_IF_FLAGS_MCAST_PROMISCUOUS) |
| 622 | 622 | ||
| 623 | #define BE_IF_EN_FLAGS (BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_PASS_L3L4_ERRORS |\ | ||
| 624 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_UNTAGGED) | ||
| 625 | |||
| 626 | #define BE_IF_ALL_FILT_FLAGS (BE_IF_EN_FLAGS | BE_IF_FLAGS_ALL_PROMISCUOUS) | ||
| 627 | |||
| 623 | /* An RX interface is an object with one or more MAC addresses and | 628 | /* An RX interface is an object with one or more MAC addresses and |
| 624 | * filtering capabilities. */ | 629 | * filtering capabilities. */ |
| 625 | struct be_cmd_req_if_create { | 630 | struct be_cmd_req_if_create { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 6f642426308c..6ca693b03f33 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -273,6 +273,10 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) | |||
| 273 | if (ether_addr_equal(addr->sa_data, netdev->dev_addr)) | 273 | if (ether_addr_equal(addr->sa_data, netdev->dev_addr)) |
| 274 | return 0; | 274 | return 0; |
| 275 | 275 | ||
| 276 | /* if device is not running, copy MAC to netdev->dev_addr */ | ||
| 277 | if (!netif_running(netdev)) | ||
| 278 | goto done; | ||
| 279 | |||
| 276 | /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT | 280 | /* The PMAC_ADD cmd may fail if the VF doesn't have FILTMGMT |
| 277 | * privilege or if PF did not provision the new MAC address. | 281 | * privilege or if PF did not provision the new MAC address. |
| 278 | * On BE3, this cmd will always fail if the VF doesn't have the | 282 | * On BE3, this cmd will always fail if the VF doesn't have the |
| @@ -307,9 +311,9 @@ static int be_mac_addr_set(struct net_device *netdev, void *p) | |||
| 307 | status = -EPERM; | 311 | status = -EPERM; |
| 308 | goto err; | 312 | goto err; |
| 309 | } | 313 | } |
| 310 | 314 | done: | |
| 311 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 315 | ether_addr_copy(netdev->dev_addr, addr->sa_data); |
| 312 | dev_info(dev, "MAC address changed to %pM\n", mac); | 316 | dev_info(dev, "MAC address changed to %pM\n", addr->sa_data); |
| 313 | return 0; | 317 | return 0; |
| 314 | err: | 318 | err: |
| 315 | dev_warn(dev, "MAC address change to %pM failed\n", addr->sa_data); | 319 | dev_warn(dev, "MAC address change to %pM failed\n", addr->sa_data); |
| @@ -2447,10 +2451,24 @@ static void be_eq_clean(struct be_eq_obj *eqo) | |||
| 2447 | be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0); | 2451 | be_eq_notify(eqo->adapter, eqo->q.id, false, true, num, 0); |
| 2448 | } | 2452 | } |
| 2449 | 2453 | ||
| 2450 | static void be_rx_cq_clean(struct be_rx_obj *rxo) | 2454 | /* Free posted rx buffers that were not used */ |
| 2455 | static void be_rxq_clean(struct be_rx_obj *rxo) | ||
| 2451 | { | 2456 | { |
| 2452 | struct be_rx_page_info *page_info; | ||
| 2453 | struct be_queue_info *rxq = &rxo->q; | 2457 | struct be_queue_info *rxq = &rxo->q; |
| 2458 | struct be_rx_page_info *page_info; | ||
| 2459 | |||
| 2460 | while (atomic_read(&rxq->used) > 0) { | ||
| 2461 | page_info = get_rx_page_info(rxo); | ||
| 2462 | put_page(page_info->page); | ||
| 2463 | memset(page_info, 0, sizeof(*page_info)); | ||
| 2464 | } | ||
| 2465 | BUG_ON(atomic_read(&rxq->used)); | ||
| 2466 | rxq->tail = 0; | ||
| 2467 | rxq->head = 0; | ||
| 2468 | } | ||
| 2469 | |||
| 2470 | static void be_rx_cq_clean(struct be_rx_obj *rxo) | ||
| 2471 | { | ||
| 2454 | struct be_queue_info *rx_cq = &rxo->cq; | 2472 | struct be_queue_info *rx_cq = &rxo->cq; |
| 2455 | struct be_rx_compl_info *rxcp; | 2473 | struct be_rx_compl_info *rxcp; |
| 2456 | struct be_adapter *adapter = rxo->adapter; | 2474 | struct be_adapter *adapter = rxo->adapter; |
| @@ -2487,16 +2505,6 @@ static void be_rx_cq_clean(struct be_rx_obj *rxo) | |||
| 2487 | 2505 | ||
| 2488 | /* After cleanup, leave the CQ in unarmed state */ | 2506 | /* After cleanup, leave the CQ in unarmed state */ |
| 2489 | be_cq_notify(adapter, rx_cq->id, false, 0); | 2507 | be_cq_notify(adapter, rx_cq->id, false, 0); |
| 2490 | |||
| 2491 | /* Then free posted rx buffers that were not used */ | ||
| 2492 | while (atomic_read(&rxq->used) > 0) { | ||
| 2493 | page_info = get_rx_page_info(rxo); | ||
| 2494 | put_page(page_info->page); | ||
| 2495 | memset(page_info, 0, sizeof(*page_info)); | ||
| 2496 | } | ||
| 2497 | BUG_ON(atomic_read(&rxq->used)); | ||
| 2498 | rxq->tail = 0; | ||
| 2499 | rxq->head = 0; | ||
| 2500 | } | 2508 | } |
| 2501 | 2509 | ||
| 2502 | static void be_tx_compl_clean(struct be_adapter *adapter) | 2510 | static void be_tx_compl_clean(struct be_adapter *adapter) |
| @@ -2576,8 +2584,8 @@ static void be_evt_queues_destroy(struct be_adapter *adapter) | |||
| 2576 | be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ); | 2584 | be_cmd_q_destroy(adapter, &eqo->q, QTYPE_EQ); |
| 2577 | napi_hash_del(&eqo->napi); | 2585 | napi_hash_del(&eqo->napi); |
| 2578 | netif_napi_del(&eqo->napi); | 2586 | netif_napi_del(&eqo->napi); |
| 2587 | free_cpumask_var(eqo->affinity_mask); | ||
| 2579 | } | 2588 | } |
| 2580 | free_cpumask_var(eqo->affinity_mask); | ||
| 2581 | be_queue_free(adapter, &eqo->q); | 2589 | be_queue_free(adapter, &eqo->q); |
| 2582 | } | 2590 | } |
| 2583 | } | 2591 | } |
| @@ -2594,13 +2602,7 @@ static int be_evt_queues_create(struct be_adapter *adapter) | |||
| 2594 | 2602 | ||
| 2595 | for_all_evt_queues(adapter, eqo, i) { | 2603 | for_all_evt_queues(adapter, eqo, i) { |
| 2596 | int numa_node = dev_to_node(&adapter->pdev->dev); | 2604 | int numa_node = dev_to_node(&adapter->pdev->dev); |
| 2597 | if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL)) | 2605 | |
| 2598 | return -ENOMEM; | ||
| 2599 | cpumask_set_cpu(cpumask_local_spread(i, numa_node), | ||
| 2600 | eqo->affinity_mask); | ||
| 2601 | netif_napi_add(adapter->netdev, &eqo->napi, be_poll, | ||
| 2602 | BE_NAPI_WEIGHT); | ||
| 2603 | napi_hash_add(&eqo->napi); | ||
| 2604 | aic = &adapter->aic_obj[i]; | 2606 | aic = &adapter->aic_obj[i]; |
| 2605 | eqo->adapter = adapter; | 2607 | eqo->adapter = adapter; |
| 2606 | eqo->idx = i; | 2608 | eqo->idx = i; |
| @@ -2616,6 +2618,14 @@ static int be_evt_queues_create(struct be_adapter *adapter) | |||
| 2616 | rc = be_cmd_eq_create(adapter, eqo); | 2618 | rc = be_cmd_eq_create(adapter, eqo); |
| 2617 | if (rc) | 2619 | if (rc) |
| 2618 | return rc; | 2620 | return rc; |
| 2621 | |||
| 2622 | if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL)) | ||
| 2623 | return -ENOMEM; | ||
| 2624 | cpumask_set_cpu(cpumask_local_spread(i, numa_node), | ||
| 2625 | eqo->affinity_mask); | ||
| 2626 | netif_napi_add(adapter->netdev, &eqo->napi, be_poll, | ||
| 2627 | BE_NAPI_WEIGHT); | ||
| 2628 | napi_hash_add(&eqo->napi); | ||
| 2619 | } | 2629 | } |
| 2620 | return 0; | 2630 | return 0; |
| 2621 | } | 2631 | } |
| @@ -3354,13 +3364,54 @@ static void be_rx_qs_destroy(struct be_adapter *adapter) | |||
| 3354 | for_all_rx_queues(adapter, rxo, i) { | 3364 | for_all_rx_queues(adapter, rxo, i) { |
| 3355 | q = &rxo->q; | 3365 | q = &rxo->q; |
| 3356 | if (q->created) { | 3366 | if (q->created) { |
| 3367 | /* If RXQs are destroyed while in an "out of buffer" | ||
| 3368 | * state, there is a possibility of an HW stall on | ||
| 3369 | * Lancer. So, post 64 buffers to each queue to relieve | ||
| 3370 | * the "out of buffer" condition. | ||
| 3371 | * Make sure there's space in the RXQ before posting. | ||
| 3372 | */ | ||
| 3373 | if (lancer_chip(adapter)) { | ||
| 3374 | be_rx_cq_clean(rxo); | ||
| 3375 | if (atomic_read(&q->used) == 0) | ||
| 3376 | be_post_rx_frags(rxo, GFP_KERNEL, | ||
| 3377 | MAX_RX_POST); | ||
| 3378 | } | ||
| 3379 | |||
| 3357 | be_cmd_rxq_destroy(adapter, q); | 3380 | be_cmd_rxq_destroy(adapter, q); |
| 3358 | be_rx_cq_clean(rxo); | 3381 | be_rx_cq_clean(rxo); |
| 3382 | be_rxq_clean(rxo); | ||
| 3359 | } | 3383 | } |
| 3360 | be_queue_free(adapter, q); | 3384 | be_queue_free(adapter, q); |
| 3361 | } | 3385 | } |
| 3362 | } | 3386 | } |
| 3363 | 3387 | ||
| 3388 | static void be_disable_if_filters(struct be_adapter *adapter) | ||
| 3389 | { | ||
| 3390 | be_cmd_pmac_del(adapter, adapter->if_handle, | ||
| 3391 | adapter->pmac_id[0], 0); | ||
| 3392 | |||
| 3393 | be_clear_uc_list(adapter); | ||
| 3394 | |||
| 3395 | /* The IFACE flags are enabled in the open path and cleared | ||
| 3396 | * in the close path. When a VF gets detached from the host and | ||
| 3397 | * assigned to a VM the following happens: | ||
| 3398 | * - VF's IFACE flags get cleared in the detach path | ||
| 3399 | * - IFACE create is issued by the VF in the attach path | ||
| 3400 | * Due to a bug in the BE3/Skyhawk-R FW | ||
| 3401 | * (Lancer FW doesn't have the bug), the IFACE capability flags | ||
| 3402 | * specified along with the IFACE create cmd issued by a VF are not | ||
| 3403 | * honoured by FW. As a consequence, if a *new* driver | ||
| 3404 | * (that enables/disables IFACE flags in open/close) | ||
| 3405 | * is loaded in the host and an *old* driver is * used by a VM/VF, | ||
| 3406 | * the IFACE gets created *without* the needed flags. | ||
| 3407 | * To avoid this, disable RX-filter flags only for Lancer. | ||
| 3408 | */ | ||
| 3409 | if (lancer_chip(adapter)) { | ||
| 3410 | be_cmd_rx_filter(adapter, BE_IF_ALL_FILT_FLAGS, OFF); | ||
| 3411 | adapter->if_flags &= ~BE_IF_ALL_FILT_FLAGS; | ||
| 3412 | } | ||
| 3413 | } | ||
| 3414 | |||
| 3364 | static int be_close(struct net_device *netdev) | 3415 | static int be_close(struct net_device *netdev) |
| 3365 | { | 3416 | { |
| 3366 | struct be_adapter *adapter = netdev_priv(netdev); | 3417 | struct be_adapter *adapter = netdev_priv(netdev); |
| @@ -3373,6 +3424,8 @@ static int be_close(struct net_device *netdev) | |||
| 3373 | if (!(adapter->flags & BE_FLAGS_SETUP_DONE)) | 3424 | if (!(adapter->flags & BE_FLAGS_SETUP_DONE)) |
| 3374 | return 0; | 3425 | return 0; |
| 3375 | 3426 | ||
| 3427 | be_disable_if_filters(adapter); | ||
| 3428 | |||
| 3376 | be_roce_dev_close(adapter); | 3429 | be_roce_dev_close(adapter); |
| 3377 | 3430 | ||
| 3378 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { | 3431 | if (adapter->flags & BE_FLAGS_NAPI_ENABLED) { |
| @@ -3392,7 +3445,6 @@ static int be_close(struct net_device *netdev) | |||
| 3392 | be_tx_compl_clean(adapter); | 3445 | be_tx_compl_clean(adapter); |
| 3393 | 3446 | ||
| 3394 | be_rx_qs_destroy(adapter); | 3447 | be_rx_qs_destroy(adapter); |
| 3395 | be_clear_uc_list(adapter); | ||
| 3396 | 3448 | ||
| 3397 | for_all_evt_queues(adapter, eqo, i) { | 3449 | for_all_evt_queues(adapter, eqo, i) { |
| 3398 | if (msix_enabled(adapter)) | 3450 | if (msix_enabled(adapter)) |
| @@ -3477,6 +3529,31 @@ static int be_rx_qs_create(struct be_adapter *adapter) | |||
| 3477 | return 0; | 3529 | return 0; |
| 3478 | } | 3530 | } |
| 3479 | 3531 | ||
| 3532 | static int be_enable_if_filters(struct be_adapter *adapter) | ||
| 3533 | { | ||
| 3534 | int status; | ||
| 3535 | |||
| 3536 | status = be_cmd_rx_filter(adapter, BE_IF_EN_FLAGS, ON); | ||
| 3537 | if (status) | ||
| 3538 | return status; | ||
| 3539 | |||
| 3540 | /* For BE3 VFs, the PF programs the initial MAC address */ | ||
| 3541 | if (!(BEx_chip(adapter) && be_virtfn(adapter))) { | ||
| 3542 | status = be_cmd_pmac_add(adapter, adapter->netdev->dev_addr, | ||
| 3543 | adapter->if_handle, | ||
| 3544 | &adapter->pmac_id[0], 0); | ||
| 3545 | if (status) | ||
| 3546 | return status; | ||
| 3547 | } | ||
| 3548 | |||
| 3549 | if (adapter->vlans_added) | ||
| 3550 | be_vid_config(adapter); | ||
| 3551 | |||
| 3552 | be_set_rx_mode(adapter->netdev); | ||
| 3553 | |||
| 3554 | return 0; | ||
| 3555 | } | ||
| 3556 | |||
| 3480 | static int be_open(struct net_device *netdev) | 3557 | static int be_open(struct net_device *netdev) |
| 3481 | { | 3558 | { |
| 3482 | struct be_adapter *adapter = netdev_priv(netdev); | 3559 | struct be_adapter *adapter = netdev_priv(netdev); |
| @@ -3490,6 +3567,10 @@ static int be_open(struct net_device *netdev) | |||
| 3490 | if (status) | 3567 | if (status) |
| 3491 | goto err; | 3568 | goto err; |
| 3492 | 3569 | ||
| 3570 | status = be_enable_if_filters(adapter); | ||
| 3571 | if (status) | ||
| 3572 | goto err; | ||
| 3573 | |||
| 3493 | status = be_irq_register(adapter); | 3574 | status = be_irq_register(adapter); |
| 3494 | if (status) | 3575 | if (status) |
| 3495 | goto err; | 3576 | goto err; |
| @@ -3686,16 +3767,6 @@ static void be_cancel_err_detection(struct be_adapter *adapter) | |||
| 3686 | } | 3767 | } |
| 3687 | } | 3768 | } |
| 3688 | 3769 | ||
| 3689 | static void be_mac_clear(struct be_adapter *adapter) | ||
| 3690 | { | ||
| 3691 | if (adapter->pmac_id) { | ||
| 3692 | be_cmd_pmac_del(adapter, adapter->if_handle, | ||
| 3693 | adapter->pmac_id[0], 0); | ||
| 3694 | kfree(adapter->pmac_id); | ||
| 3695 | adapter->pmac_id = NULL; | ||
| 3696 | } | ||
| 3697 | } | ||
| 3698 | |||
| 3699 | #ifdef CONFIG_BE2NET_VXLAN | 3770 | #ifdef CONFIG_BE2NET_VXLAN |
| 3700 | static void be_disable_vxlan_offloads(struct be_adapter *adapter) | 3771 | static void be_disable_vxlan_offloads(struct be_adapter *adapter) |
| 3701 | { | 3772 | { |
| @@ -3770,8 +3841,8 @@ static int be_clear(struct be_adapter *adapter) | |||
| 3770 | #ifdef CONFIG_BE2NET_VXLAN | 3841 | #ifdef CONFIG_BE2NET_VXLAN |
| 3771 | be_disable_vxlan_offloads(adapter); | 3842 | be_disable_vxlan_offloads(adapter); |
| 3772 | #endif | 3843 | #endif |
| 3773 | /* delete the primary mac along with the uc-mac list */ | 3844 | kfree(adapter->pmac_id); |
| 3774 | be_mac_clear(adapter); | 3845 | adapter->pmac_id = NULL; |
| 3775 | 3846 | ||
| 3776 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); | 3847 | be_cmd_if_destroy(adapter, adapter->if_handle, 0); |
| 3777 | 3848 | ||
| @@ -3782,25 +3853,11 @@ static int be_clear(struct be_adapter *adapter) | |||
| 3782 | return 0; | 3853 | return 0; |
| 3783 | } | 3854 | } |
| 3784 | 3855 | ||
| 3785 | static int be_if_create(struct be_adapter *adapter, u32 *if_handle, | ||
| 3786 | u32 cap_flags, u32 vf) | ||
| 3787 | { | ||
| 3788 | u32 en_flags; | ||
| 3789 | |||
| 3790 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | ||
| 3791 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS | | ||
| 3792 | BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS; | ||
| 3793 | |||
| 3794 | en_flags &= cap_flags; | ||
| 3795 | |||
| 3796 | return be_cmd_if_create(adapter, cap_flags, en_flags, if_handle, vf); | ||
| 3797 | } | ||
| 3798 | |||
| 3799 | static int be_vfs_if_create(struct be_adapter *adapter) | 3856 | static int be_vfs_if_create(struct be_adapter *adapter) |
| 3800 | { | 3857 | { |
| 3801 | struct be_resources res = {0}; | 3858 | struct be_resources res = {0}; |
| 3859 | u32 cap_flags, en_flags, vf; | ||
| 3802 | struct be_vf_cfg *vf_cfg; | 3860 | struct be_vf_cfg *vf_cfg; |
| 3803 | u32 cap_flags, vf; | ||
| 3804 | int status; | 3861 | int status; |
| 3805 | 3862 | ||
| 3806 | /* If a FW profile exists, then cap_flags are updated */ | 3863 | /* If a FW profile exists, then cap_flags are updated */ |
| @@ -3821,8 +3878,12 @@ static int be_vfs_if_create(struct be_adapter *adapter) | |||
| 3821 | } | 3878 | } |
| 3822 | } | 3879 | } |
| 3823 | 3880 | ||
| 3824 | status = be_if_create(adapter, &vf_cfg->if_handle, | 3881 | en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | |
| 3825 | cap_flags, vf + 1); | 3882 | BE_IF_FLAGS_BROADCAST | |
| 3883 | BE_IF_FLAGS_MULTICAST | | ||
| 3884 | BE_IF_FLAGS_PASS_L3L4_ERRORS); | ||
| 3885 | status = be_cmd_if_create(adapter, cap_flags, en_flags, | ||
| 3886 | &vf_cfg->if_handle, vf + 1); | ||
| 3826 | if (status) | 3887 | if (status) |
| 3827 | return status; | 3888 | return status; |
| 3828 | } | 3889 | } |
| @@ -4194,15 +4255,8 @@ static int be_mac_setup(struct be_adapter *adapter) | |||
| 4194 | 4255 | ||
| 4195 | memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN); | 4256 | memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN); |
| 4196 | memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN); | 4257 | memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN); |
| 4197 | } else { | ||
| 4198 | /* Maybe the HW was reset; dev_addr must be re-programmed */ | ||
| 4199 | memcpy(mac, adapter->netdev->dev_addr, ETH_ALEN); | ||
| 4200 | } | 4258 | } |
| 4201 | 4259 | ||
| 4202 | /* For BE3-R VFs, the PF programs the initial MAC address */ | ||
| 4203 | if (!(BEx_chip(adapter) && be_virtfn(adapter))) | ||
| 4204 | be_cmd_pmac_add(adapter, mac, adapter->if_handle, | ||
| 4205 | &adapter->pmac_id[0], 0); | ||
| 4206 | return 0; | 4260 | return 0; |
| 4207 | } | 4261 | } |
| 4208 | 4262 | ||
| @@ -4342,6 +4396,7 @@ static int be_func_init(struct be_adapter *adapter) | |||
| 4342 | static int be_setup(struct be_adapter *adapter) | 4396 | static int be_setup(struct be_adapter *adapter) |
| 4343 | { | 4397 | { |
| 4344 | struct device *dev = &adapter->pdev->dev; | 4398 | struct device *dev = &adapter->pdev->dev; |
| 4399 | u32 en_flags; | ||
| 4345 | int status; | 4400 | int status; |
| 4346 | 4401 | ||
| 4347 | status = be_func_init(adapter); | 4402 | status = be_func_init(adapter); |
| @@ -4364,8 +4419,11 @@ static int be_setup(struct be_adapter *adapter) | |||
| 4364 | if (status) | 4419 | if (status) |
| 4365 | goto err; | 4420 | goto err; |
| 4366 | 4421 | ||
| 4367 | status = be_if_create(adapter, &adapter->if_handle, | 4422 | /* will enable all the needed filter flags in be_open() */ |
| 4368 | be_if_cap_flags(adapter), 0); | 4423 | en_flags = BE_IF_FLAGS_RSS | BE_IF_FLAGS_DEFQ_RSS; |
| 4424 | en_flags = en_flags & be_if_cap_flags(adapter); | ||
| 4425 | status = be_cmd_if_create(adapter, be_if_cap_flags(adapter), en_flags, | ||
| 4426 | &adapter->if_handle, 0); | ||
| 4369 | if (status) | 4427 | if (status) |
| 4370 | goto err; | 4428 | goto err; |
| 4371 | 4429 | ||
| @@ -4391,11 +4449,6 @@ static int be_setup(struct be_adapter *adapter) | |||
| 4391 | dev_err(dev, "Please upgrade firmware to version >= 4.0\n"); | 4449 | dev_err(dev, "Please upgrade firmware to version >= 4.0\n"); |
| 4392 | } | 4450 | } |
| 4393 | 4451 | ||
| 4394 | if (adapter->vlans_added) | ||
| 4395 | be_vid_config(adapter); | ||
| 4396 | |||
| 4397 | be_set_rx_mode(adapter->netdev); | ||
| 4398 | |||
| 4399 | status = be_cmd_set_flow_control(adapter, adapter->tx_fc, | 4452 | status = be_cmd_set_flow_control(adapter, adapter->tx_fc, |
| 4400 | adapter->rx_fc); | 4453 | adapter->rx_fc); |
| 4401 | if (status) | 4454 | if (status) |
| @@ -5121,7 +5174,7 @@ static void be_add_vxlan_port(struct net_device *netdev, sa_family_t sa_family, | |||
| 5121 | struct device *dev = &adapter->pdev->dev; | 5174 | struct device *dev = &adapter->pdev->dev; |
| 5122 | int status; | 5175 | int status; |
| 5123 | 5176 | ||
| 5124 | if (lancer_chip(adapter) || BEx_chip(adapter)) | 5177 | if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) |
| 5125 | return; | 5178 | return; |
| 5126 | 5179 | ||
| 5127 | if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) { | 5180 | if (adapter->flags & BE_FLAGS_VXLAN_OFFLOADS) { |
| @@ -5168,7 +5221,7 @@ static void be_del_vxlan_port(struct net_device *netdev, sa_family_t sa_family, | |||
| 5168 | { | 5221 | { |
| 5169 | struct be_adapter *adapter = netdev_priv(netdev); | 5222 | struct be_adapter *adapter = netdev_priv(netdev); |
| 5170 | 5223 | ||
| 5171 | if (lancer_chip(adapter) || BEx_chip(adapter)) | 5224 | if (lancer_chip(adapter) || BEx_chip(adapter) || be_is_mc(adapter)) |
| 5172 | return; | 5225 | return; |
| 5173 | 5226 | ||
| 5174 | if (adapter->vxlan_port != port) | 5227 | if (adapter->vxlan_port != port) |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 32e3807c650e..b349e6f36ea7 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -1778,7 +1778,7 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | |||
| 1778 | return ret; | 1778 | return ret; |
| 1779 | 1779 | ||
| 1780 | fep->mii_timeout = 0; | 1780 | fep->mii_timeout = 0; |
| 1781 | init_completion(&fep->mdio_done); | 1781 | reinit_completion(&fep->mdio_done); |
| 1782 | 1782 | ||
| 1783 | /* start a read op */ | 1783 | /* start a read op */ |
| 1784 | writel(FEC_MMFR_ST | FEC_MMFR_OP_READ | | 1784 | writel(FEC_MMFR_ST | FEC_MMFR_OP_READ | |
| @@ -1817,7 +1817,7 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, | |||
| 1817 | return ret; | 1817 | return ret; |
| 1818 | 1818 | ||
| 1819 | fep->mii_timeout = 0; | 1819 | fep->mii_timeout = 0; |
| 1820 | init_completion(&fep->mdio_done); | 1820 | reinit_completion(&fep->mdio_done); |
| 1821 | 1821 | ||
| 1822 | /* start a write op */ | 1822 | /* start a write op */ |
| 1823 | writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE | | 1823 | writel(FEC_MMFR_ST | FEC_MMFR_OP_WRITE | |
| @@ -3433,6 +3433,7 @@ fec_probe(struct platform_device *pdev) | |||
| 3433 | 3433 | ||
| 3434 | pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT); | 3434 | pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT); |
| 3435 | pm_runtime_use_autosuspend(&pdev->dev); | 3435 | pm_runtime_use_autosuspend(&pdev->dev); |
| 3436 | pm_runtime_get_noresume(&pdev->dev); | ||
| 3436 | pm_runtime_set_active(&pdev->dev); | 3437 | pm_runtime_set_active(&pdev->dev); |
| 3437 | pm_runtime_enable(&pdev->dev); | 3438 | pm_runtime_enable(&pdev->dev); |
| 3438 | 3439 | ||
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 56316db6c5a6..cf8e54652df9 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | |||
| @@ -586,7 +586,8 @@ static int fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 586 | frag = skb_shinfo(skb)->frags; | 586 | frag = skb_shinfo(skb)->frags; |
| 587 | while (nr_frags) { | 587 | while (nr_frags) { |
| 588 | CBDC_SC(bdp, | 588 | CBDC_SC(bdp, |
| 589 | BD_ENET_TX_STATS | BD_ENET_TX_LAST | BD_ENET_TX_TC); | 589 | BD_ENET_TX_STATS | BD_ENET_TX_INTR | BD_ENET_TX_LAST | |
| 590 | BD_ENET_TX_TC); | ||
| 590 | CBDS_SC(bdp, BD_ENET_TX_READY); | 591 | CBDS_SC(bdp, BD_ENET_TX_READY); |
| 591 | 592 | ||
| 592 | if ((CBDR_SC(bdp) & BD_ENET_TX_WRAP) == 0) | 593 | if ((CBDR_SC(bdp) & BD_ENET_TX_WRAP) == 0) |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index b34214e2df5f..016743e355de 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c | |||
| @@ -110,7 +110,7 @@ static int do_pd_setup(struct fs_enet_private *fep) | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | #define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB) | 112 | #define FEC_NAPI_RX_EVENT_MSK (FEC_ENET_RXF | FEC_ENET_RXB) |
| 113 | #define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF | FEC_ENET_TXB) | 113 | #define FEC_NAPI_TX_EVENT_MSK (FEC_ENET_TXF) |
| 114 | #define FEC_RX_EVENT (FEC_ENET_RXF) | 114 | #define FEC_RX_EVENT (FEC_ENET_RXF) |
| 115 | #define FEC_TX_EVENT (FEC_ENET_TXF) | 115 | #define FEC_TX_EVENT (FEC_ENET_TXF) |
| 116 | #define FEC_ERR_EVENT_MSK (FEC_ENET_HBERR | FEC_ENET_BABR | \ | 116 | #define FEC_ERR_EVENT_MSK (FEC_ENET_HBERR | FEC_ENET_BABR | \ |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 2b7610f341b0..10b3bbbbac8e 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
| @@ -2102,6 +2102,11 @@ int startup_gfar(struct net_device *ndev) | |||
| 2102 | /* Start Rx/Tx DMA and enable the interrupts */ | 2102 | /* Start Rx/Tx DMA and enable the interrupts */ |
| 2103 | gfar_start(priv); | 2103 | gfar_start(priv); |
| 2104 | 2104 | ||
| 2105 | /* force link state update after mac reset */ | ||
| 2106 | priv->oldlink = 0; | ||
| 2107 | priv->oldspeed = 0; | ||
| 2108 | priv->oldduplex = -1; | ||
| 2109 | |||
| 2105 | phy_start(priv->phydev); | 2110 | phy_start(priv->phydev); |
| 2106 | 2111 | ||
| 2107 | enable_napi(priv); | 2112 | enable_napi(priv); |
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c index 3c0a8f825b63..5b90fcf96265 100644 --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c | |||
| @@ -900,27 +900,6 @@ static int gfar_check_filer_hardware(struct gfar_private *priv) | |||
| 900 | return 0; | 900 | return 0; |
| 901 | } | 901 | } |
| 902 | 902 | ||
| 903 | static int gfar_comp_asc(const void *a, const void *b) | ||
| 904 | { | ||
| 905 | return memcmp(a, b, 4); | ||
| 906 | } | ||
| 907 | |||
| 908 | static int gfar_comp_desc(const void *a, const void *b) | ||
| 909 | { | ||
| 910 | return -memcmp(a, b, 4); | ||
| 911 | } | ||
| 912 | |||
| 913 | static void gfar_swap(void *a, void *b, int size) | ||
| 914 | { | ||
| 915 | u32 *_a = a; | ||
| 916 | u32 *_b = b; | ||
| 917 | |||
| 918 | swap(_a[0], _b[0]); | ||
| 919 | swap(_a[1], _b[1]); | ||
| 920 | swap(_a[2], _b[2]); | ||
| 921 | swap(_a[3], _b[3]); | ||
| 922 | } | ||
| 923 | |||
| 924 | /* Write a mask to filer cache */ | 903 | /* Write a mask to filer cache */ |
| 925 | static void gfar_set_mask(u32 mask, struct filer_table *tab) | 904 | static void gfar_set_mask(u32 mask, struct filer_table *tab) |
| 926 | { | 905 | { |
| @@ -1270,310 +1249,6 @@ static int gfar_convert_to_filer(struct ethtool_rx_flow_spec *rule, | |||
| 1270 | return 0; | 1249 | return 0; |
| 1271 | } | 1250 | } |
| 1272 | 1251 | ||
| 1273 | /* Copy size filer entries */ | ||
| 1274 | static void gfar_copy_filer_entries(struct gfar_filer_entry dst[0], | ||
| 1275 | struct gfar_filer_entry src[0], s32 size) | ||
| 1276 | { | ||
| 1277 | while (size > 0) { | ||
| 1278 | size--; | ||
| 1279 | dst[size].ctrl = src[size].ctrl; | ||
| 1280 | dst[size].prop = src[size].prop; | ||
| 1281 | } | ||
| 1282 | } | ||
| 1283 | |||
| 1284 | /* Delete the contents of the filer-table between start and end | ||
| 1285 | * and collapse them | ||
| 1286 | */ | ||
| 1287 | static int gfar_trim_filer_entries(u32 begin, u32 end, struct filer_table *tab) | ||
| 1288 | { | ||
| 1289 | int length; | ||
| 1290 | |||
| 1291 | if (end > MAX_FILER_CACHE_IDX || end < begin) | ||
| 1292 | return -EINVAL; | ||
| 1293 | |||
| 1294 | end++; | ||
| 1295 | length = end - begin; | ||
| 1296 | |||
| 1297 | /* Copy */ | ||
| 1298 | while (end < tab->index) { | ||
| 1299 | tab->fe[begin].ctrl = tab->fe[end].ctrl; | ||
| 1300 | tab->fe[begin++].prop = tab->fe[end++].prop; | ||
| 1301 | |||
| 1302 | } | ||
| 1303 | /* Fill up with don't cares */ | ||
| 1304 | while (begin < tab->index) { | ||
| 1305 | tab->fe[begin].ctrl = 0x60; | ||
| 1306 | tab->fe[begin].prop = 0xFFFFFFFF; | ||
| 1307 | begin++; | ||
| 1308 | } | ||
| 1309 | |||
| 1310 | tab->index -= length; | ||
| 1311 | return 0; | ||
| 1312 | } | ||
| 1313 | |||
| 1314 | /* Make space on the wanted location */ | ||
| 1315 | static int gfar_expand_filer_entries(u32 begin, u32 length, | ||
| 1316 | struct filer_table *tab) | ||
| 1317 | { | ||
| 1318 | if (length == 0 || length + tab->index > MAX_FILER_CACHE_IDX || | ||
| 1319 | begin > MAX_FILER_CACHE_IDX) | ||
| 1320 | return -EINVAL; | ||
| 1321 | |||
| 1322 | gfar_copy_filer_entries(&(tab->fe[begin + length]), &(tab->fe[begin]), | ||
| 1323 | tab->index - length + 1); | ||
| 1324 | |||
| 1325 | tab->index += length; | ||
| 1326 | return 0; | ||
| 1327 | } | ||
| 1328 | |||
| 1329 | static int gfar_get_next_cluster_start(int start, struct filer_table *tab) | ||
| 1330 | { | ||
| 1331 | for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1); | ||
| 1332 | start++) { | ||
| 1333 | if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) == | ||
| 1334 | (RQFCR_AND | RQFCR_CLE)) | ||
| 1335 | return start; | ||
| 1336 | } | ||
| 1337 | return -1; | ||
| 1338 | } | ||
| 1339 | |||
| 1340 | static int gfar_get_next_cluster_end(int start, struct filer_table *tab) | ||
| 1341 | { | ||
| 1342 | for (; (start < tab->index) && (start < MAX_FILER_CACHE_IDX - 1); | ||
| 1343 | start++) { | ||
| 1344 | if ((tab->fe[start].ctrl & (RQFCR_AND | RQFCR_CLE)) == | ||
| 1345 | (RQFCR_CLE)) | ||
| 1346 | return start; | ||
| 1347 | } | ||
| 1348 | return -1; | ||
| 1349 | } | ||
| 1350 | |||
| 1351 | /* Uses hardwares clustering option to reduce | ||
| 1352 | * the number of filer table entries | ||
| 1353 | */ | ||
| 1354 | static void gfar_cluster_filer(struct filer_table *tab) | ||
| 1355 | { | ||
| 1356 | s32 i = -1, j, iend, jend; | ||
| 1357 | |||
| 1358 | while ((i = gfar_get_next_cluster_start(++i, tab)) != -1) { | ||
| 1359 | j = i; | ||
| 1360 | while ((j = gfar_get_next_cluster_start(++j, tab)) != -1) { | ||
| 1361 | /* The cluster entries self and the previous one | ||
| 1362 | * (a mask) must be identical! | ||
| 1363 | */ | ||
| 1364 | if (tab->fe[i].ctrl != tab->fe[j].ctrl) | ||
| 1365 | break; | ||
| 1366 | if (tab->fe[i].prop != tab->fe[j].prop) | ||
| 1367 | break; | ||
| 1368 | if (tab->fe[i - 1].ctrl != tab->fe[j - 1].ctrl) | ||
| 1369 | break; | ||
| 1370 | if (tab->fe[i - 1].prop != tab->fe[j - 1].prop) | ||
| 1371 | break; | ||
| 1372 | iend = gfar_get_next_cluster_end(i, tab); | ||
| 1373 | jend = gfar_get_next_cluster_end(j, tab); | ||
| 1374 | if (jend == -1 || iend == -1) | ||
| 1375 | break; | ||
| 1376 | |||
| 1377 | /* First we make some free space, where our cluster | ||
| 1378 | * element should be. Then we copy it there and finally | ||
| 1379 | * delete in from its old location. | ||
| 1380 | */ | ||
| 1381 | if (gfar_expand_filer_entries(iend, (jend - j), tab) == | ||
| 1382 | -EINVAL) | ||
| 1383 | break; | ||
| 1384 | |||
| 1385 | gfar_copy_filer_entries(&(tab->fe[iend + 1]), | ||
| 1386 | &(tab->fe[jend + 1]), jend - j); | ||
| 1387 | |||
| 1388 | if (gfar_trim_filer_entries(jend - 1, | ||
| 1389 | jend + (jend - j), | ||
| 1390 | tab) == -EINVAL) | ||
| 1391 | return; | ||
| 1392 | |||
| 1393 | /* Mask out cluster bit */ | ||
| 1394 | tab->fe[iend].ctrl &= ~(RQFCR_CLE); | ||
| 1395 | } | ||
| 1396 | } | ||
| 1397 | } | ||
| 1398 | |||
| 1399 | /* Swaps the masked bits of a1<>a2 and b1<>b2 */ | ||
| 1400 | static void gfar_swap_bits(struct gfar_filer_entry *a1, | ||
| 1401 | struct gfar_filer_entry *a2, | ||
| 1402 | struct gfar_filer_entry *b1, | ||
| 1403 | struct gfar_filer_entry *b2, u32 mask) | ||
| 1404 | { | ||
| 1405 | u32 temp[4]; | ||
| 1406 | temp[0] = a1->ctrl & mask; | ||
| 1407 | temp[1] = a2->ctrl & mask; | ||
| 1408 | temp[2] = b1->ctrl & mask; | ||
| 1409 | temp[3] = b2->ctrl & mask; | ||
| 1410 | |||
| 1411 | a1->ctrl &= ~mask; | ||
| 1412 | a2->ctrl &= ~mask; | ||
| 1413 | b1->ctrl &= ~mask; | ||
| 1414 | b2->ctrl &= ~mask; | ||
| 1415 | |||
| 1416 | a1->ctrl |= temp[1]; | ||
| 1417 | a2->ctrl |= temp[0]; | ||
| 1418 | b1->ctrl |= temp[3]; | ||
| 1419 | b2->ctrl |= temp[2]; | ||
| 1420 | } | ||
| 1421 | |||
| 1422 | /* Generate a list consisting of masks values with their start and | ||
| 1423 | * end of validity and block as indicator for parts belonging | ||
| 1424 | * together (glued by ANDs) in mask_table | ||
| 1425 | */ | ||
| 1426 | static u32 gfar_generate_mask_table(struct gfar_mask_entry *mask_table, | ||
| 1427 | struct filer_table *tab) | ||
| 1428 | { | ||
| 1429 | u32 i, and_index = 0, block_index = 1; | ||
| 1430 | |||
| 1431 | for (i = 0; i < tab->index; i++) { | ||
| 1432 | |||
| 1433 | /* LSByte of control = 0 sets a mask */ | ||
| 1434 | if (!(tab->fe[i].ctrl & 0xF)) { | ||
| 1435 | mask_table[and_index].mask = tab->fe[i].prop; | ||
| 1436 | mask_table[and_index].start = i; | ||
| 1437 | mask_table[and_index].block = block_index; | ||
| 1438 | if (and_index >= 1) | ||
| 1439 | mask_table[and_index - 1].end = i - 1; | ||
| 1440 | and_index++; | ||
| 1441 | } | ||
| 1442 | /* cluster starts and ends will be separated because they should | ||
| 1443 | * hold their position | ||
| 1444 | */ | ||
| 1445 | if (tab->fe[i].ctrl & RQFCR_CLE) | ||
| 1446 | block_index++; | ||
| 1447 | /* A not set AND indicates the end of a depended block */ | ||
| 1448 | if (!(tab->fe[i].ctrl & RQFCR_AND)) | ||
| 1449 | block_index++; | ||
| 1450 | } | ||
| 1451 | |||
| 1452 | mask_table[and_index - 1].end = i - 1; | ||
| 1453 | |||
| 1454 | return and_index; | ||
| 1455 | } | ||
| 1456 | |||
| 1457 | /* Sorts the entries of mask_table by the values of the masks. | ||
| 1458 | * Important: The 0xFF80 flags of the first and last entry of a | ||
| 1459 | * block must hold their position (which queue, CLusterEnable, ReJEct, | ||
| 1460 | * AND) | ||
| 1461 | */ | ||
| 1462 | static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table, | ||
| 1463 | struct filer_table *temp_table, u32 and_index) | ||
| 1464 | { | ||
| 1465 | /* Pointer to compare function (_asc or _desc) */ | ||
| 1466 | int (*gfar_comp)(const void *, const void *); | ||
| 1467 | |||
| 1468 | u32 i, size = 0, start = 0, prev = 1; | ||
| 1469 | u32 old_first, old_last, new_first, new_last; | ||
| 1470 | |||
| 1471 | gfar_comp = &gfar_comp_desc; | ||
| 1472 | |||
| 1473 | for (i = 0; i < and_index; i++) { | ||
| 1474 | if (prev != mask_table[i].block) { | ||
| 1475 | old_first = mask_table[start].start + 1; | ||
| 1476 | old_last = mask_table[i - 1].end; | ||
| 1477 | sort(mask_table + start, size, | ||
| 1478 | sizeof(struct gfar_mask_entry), | ||
| 1479 | gfar_comp, &gfar_swap); | ||
| 1480 | |||
| 1481 | /* Toggle order for every block. This makes the | ||
| 1482 | * thing more efficient! | ||
| 1483 | */ | ||
| 1484 | if (gfar_comp == gfar_comp_desc) | ||
| 1485 | gfar_comp = &gfar_comp_asc; | ||
| 1486 | else | ||
| 1487 | gfar_comp = &gfar_comp_desc; | ||
| 1488 | |||
| 1489 | new_first = mask_table[start].start + 1; | ||
| 1490 | new_last = mask_table[i - 1].end; | ||
| 1491 | |||
| 1492 | gfar_swap_bits(&temp_table->fe[new_first], | ||
| 1493 | &temp_table->fe[old_first], | ||
| 1494 | &temp_table->fe[new_last], | ||
| 1495 | &temp_table->fe[old_last], | ||
| 1496 | RQFCR_QUEUE | RQFCR_CLE | | ||
| 1497 | RQFCR_RJE | RQFCR_AND); | ||
| 1498 | |||
| 1499 | start = i; | ||
| 1500 | size = 0; | ||
| 1501 | } | ||
| 1502 | size++; | ||
| 1503 | prev = mask_table[i].block; | ||
| 1504 | } | ||
| 1505 | } | ||
| 1506 | |||
| 1507 | /* Reduces the number of masks needed in the filer table to save entries | ||
| 1508 | * This is done by sorting the masks of a depended block. A depended block is | ||
| 1509 | * identified by gluing ANDs or CLE. The sorting order toggles after every | ||
| 1510 | * block. Of course entries in scope of a mask must change their location with | ||
| 1511 | * it. | ||
| 1512 | */ | ||
| 1513 | static int gfar_optimize_filer_masks(struct filer_table *tab) | ||
| 1514 | { | ||
| 1515 | struct filer_table *temp_table; | ||
| 1516 | struct gfar_mask_entry *mask_table; | ||
| 1517 | |||
| 1518 | u32 and_index = 0, previous_mask = 0, i = 0, j = 0, size = 0; | ||
| 1519 | s32 ret = 0; | ||
| 1520 | |||
| 1521 | /* We need a copy of the filer table because | ||
| 1522 | * we want to change its order | ||
| 1523 | */ | ||
| 1524 | temp_table = kmemdup(tab, sizeof(*temp_table), GFP_KERNEL); | ||
| 1525 | if (temp_table == NULL) | ||
| 1526 | return -ENOMEM; | ||
| 1527 | |||
| 1528 | mask_table = kcalloc(MAX_FILER_CACHE_IDX / 2 + 1, | ||
| 1529 | sizeof(struct gfar_mask_entry), GFP_KERNEL); | ||
| 1530 | |||
| 1531 | if (mask_table == NULL) { | ||
| 1532 | ret = -ENOMEM; | ||
| 1533 | goto end; | ||
| 1534 | } | ||
| 1535 | |||
| 1536 | and_index = gfar_generate_mask_table(mask_table, tab); | ||
| 1537 | |||
| 1538 | gfar_sort_mask_table(mask_table, temp_table, and_index); | ||
| 1539 | |||
| 1540 | /* Now we can copy the data from our duplicated filer table to | ||
| 1541 | * the real one in the order the mask table says | ||
| 1542 | */ | ||
| 1543 | for (i = 0; i < and_index; i++) { | ||
| 1544 | size = mask_table[i].end - mask_table[i].start + 1; | ||
| 1545 | gfar_copy_filer_entries(&(tab->fe[j]), | ||
| 1546 | &(temp_table->fe[mask_table[i].start]), size); | ||
| 1547 | j += size; | ||
| 1548 | } | ||
| 1549 | |||
| 1550 | /* And finally we just have to check for duplicated masks and drop the | ||
| 1551 | * second ones | ||
| 1552 | */ | ||
| 1553 | for (i = 0; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) { | ||
| 1554 | if (tab->fe[i].ctrl == 0x80) { | ||
| 1555 | previous_mask = i++; | ||
| 1556 | break; | ||
| 1557 | } | ||
| 1558 | } | ||
| 1559 | for (; i < tab->index && i < MAX_FILER_CACHE_IDX; i++) { | ||
| 1560 | if (tab->fe[i].ctrl == 0x80) { | ||
| 1561 | if (tab->fe[i].prop == tab->fe[previous_mask].prop) { | ||
| 1562 | /* Two identical ones found! | ||
| 1563 | * So drop the second one! | ||
| 1564 | */ | ||
| 1565 | gfar_trim_filer_entries(i, i, tab); | ||
| 1566 | } else | ||
| 1567 | /* Not identical! */ | ||
| 1568 | previous_mask = i; | ||
| 1569 | } | ||
| 1570 | } | ||
| 1571 | |||
| 1572 | kfree(mask_table); | ||
| 1573 | end: kfree(temp_table); | ||
| 1574 | return ret; | ||
| 1575 | } | ||
| 1576 | |||
| 1577 | /* Write the bit-pattern from software's buffer to hardware registers */ | 1252 | /* Write the bit-pattern from software's buffer to hardware registers */ |
| 1578 | static int gfar_write_filer_table(struct gfar_private *priv, | 1253 | static int gfar_write_filer_table(struct gfar_private *priv, |
| 1579 | struct filer_table *tab) | 1254 | struct filer_table *tab) |
| @@ -1583,11 +1258,10 @@ static int gfar_write_filer_table(struct gfar_private *priv, | |||
| 1583 | return -EBUSY; | 1258 | return -EBUSY; |
| 1584 | 1259 | ||
| 1585 | /* Fill regular entries */ | 1260 | /* Fill regular entries */ |
| 1586 | for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop); | 1261 | for (; i < MAX_FILER_IDX && (tab->fe[i].ctrl | tab->fe[i].prop); i++) |
| 1587 | i++) | ||
| 1588 | gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); | 1262 | gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); |
| 1589 | /* Fill the rest with fall-troughs */ | 1263 | /* Fill the rest with fall-troughs */ |
| 1590 | for (; i < MAX_FILER_IDX - 1; i++) | 1264 | for (; i < MAX_FILER_IDX; i++) |
| 1591 | gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF); | 1265 | gfar_write_filer(priv, i, 0x60, 0xFFFFFFFF); |
| 1592 | /* Last entry must be default accept | 1266 | /* Last entry must be default accept |
| 1593 | * because that's what people expect | 1267 | * because that's what people expect |
| @@ -1621,7 +1295,6 @@ static int gfar_process_filer_changes(struct gfar_private *priv) | |||
| 1621 | { | 1295 | { |
| 1622 | struct ethtool_flow_spec_container *j; | 1296 | struct ethtool_flow_spec_container *j; |
| 1623 | struct filer_table *tab; | 1297 | struct filer_table *tab; |
| 1624 | s32 i = 0; | ||
| 1625 | s32 ret = 0; | 1298 | s32 ret = 0; |
| 1626 | 1299 | ||
| 1627 | /* So index is set to zero, too! */ | 1300 | /* So index is set to zero, too! */ |
| @@ -1646,17 +1319,6 @@ static int gfar_process_filer_changes(struct gfar_private *priv) | |||
| 1646 | } | 1319 | } |
| 1647 | } | 1320 | } |
| 1648 | 1321 | ||
| 1649 | i = tab->index; | ||
| 1650 | |||
| 1651 | /* Optimizations to save entries */ | ||
| 1652 | gfar_cluster_filer(tab); | ||
| 1653 | gfar_optimize_filer_masks(tab); | ||
| 1654 | |||
| 1655 | pr_debug("\tSummary:\n" | ||
| 1656 | "\tData on hardware: %d\n" | ||
| 1657 | "\tCompression rate: %d%%\n", | ||
| 1658 | tab->index, 100 - (100 * tab->index) / i); | ||
| 1659 | |||
| 1660 | /* Write everything to hardware */ | 1322 | /* Write everything to hardware */ |
| 1661 | ret = gfar_write_filer_table(priv, tab); | 1323 | ret = gfar_write_filer_table(priv, tab); |
| 1662 | if (ret == -EBUSY) { | 1324 | if (ret == -EBUSY) { |
| @@ -1722,13 +1384,14 @@ static int gfar_add_cls(struct gfar_private *priv, | |||
| 1722 | } | 1384 | } |
| 1723 | 1385 | ||
| 1724 | process: | 1386 | process: |
| 1387 | priv->rx_list.count++; | ||
| 1725 | ret = gfar_process_filer_changes(priv); | 1388 | ret = gfar_process_filer_changes(priv); |
| 1726 | if (ret) | 1389 | if (ret) |
| 1727 | goto clean_list; | 1390 | goto clean_list; |
| 1728 | priv->rx_list.count++; | ||
| 1729 | return ret; | 1391 | return ret; |
| 1730 | 1392 | ||
| 1731 | clean_list: | 1393 | clean_list: |
| 1394 | priv->rx_list.count--; | ||
| 1732 | list_del(&temp->list); | 1395 | list_del(&temp->list); |
| 1733 | clean_mem: | 1396 | clean_mem: |
| 1734 | kfree(temp); | 1397 | kfree(temp); |
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c index 982fdcdc795b..b5b2925103ec 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c +++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c | |||
| @@ -216,7 +216,7 @@ static void fm10k_reuse_rx_page(struct fm10k_ring *rx_ring, | |||
| 216 | 216 | ||
| 217 | static inline bool fm10k_page_is_reserved(struct page *page) | 217 | static inline bool fm10k_page_is_reserved(struct page *page) |
| 218 | { | 218 | { |
| 219 | return (page_to_nid(page) != numa_mem_id()) || page->pfmemalloc; | 219 | return (page_to_nid(page) != numa_mem_id()) || page_is_pfmemalloc(page); |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer, | 222 | static bool fm10k_can_reuse_rx_page(struct fm10k_rx_buffer *rx_buffer, |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 2f70a9b152bd..830466c49987 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
| @@ -6566,7 +6566,7 @@ static void igb_reuse_rx_page(struct igb_ring *rx_ring, | |||
| 6566 | 6566 | ||
| 6567 | static inline bool igb_page_is_reserved(struct page *page) | 6567 | static inline bool igb_page_is_reserved(struct page *page) |
| 6568 | { | 6568 | { |
| 6569 | return (page_to_nid(page) != numa_mem_id()) || page->pfmemalloc; | 6569 | return (page_to_nid(page) != numa_mem_id()) || page_is_pfmemalloc(page); |
| 6570 | } | 6570 | } |
| 6571 | 6571 | ||
| 6572 | static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, | 6572 | static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 9aa6104e34ea..ae21e0b06c3a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -1832,7 +1832,7 @@ static void ixgbe_reuse_rx_page(struct ixgbe_ring *rx_ring, | |||
| 1832 | 1832 | ||
| 1833 | static inline bool ixgbe_page_is_reserved(struct page *page) | 1833 | static inline bool ixgbe_page_is_reserved(struct page *page) |
| 1834 | { | 1834 | { |
| 1835 | return (page_to_nid(page) != numa_mem_id()) || page->pfmemalloc; | 1835 | return (page_to_nid(page) != numa_mem_id()) || page_is_pfmemalloc(page); |
| 1836 | } | 1836 | } |
| 1837 | 1837 | ||
| 1838 | /** | 1838 | /** |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index e71cdde9cb01..1d7b00b038a2 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
| @@ -765,7 +765,7 @@ static void ixgbevf_reuse_rx_page(struct ixgbevf_ring *rx_ring, | |||
| 765 | 765 | ||
| 766 | static inline bool ixgbevf_page_is_reserved(struct page *page) | 766 | static inline bool ixgbevf_page_is_reserved(struct page *page) |
| 767 | { | 767 | { |
| 768 | return (page_to_nid(page) != numa_mem_id()) || page->pfmemalloc; | 768 | return (page_to_nid(page) != numa_mem_id()) || page_is_pfmemalloc(page); |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | /** | 771 | /** |
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index 3e8b1bfb1f2e..d9884fd15b45 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c | |||
| @@ -27,6 +27,8 @@ | |||
| 27 | #include <linux/of_address.h> | 27 | #include <linux/of_address.h> |
| 28 | #include <linux/phy.h> | 28 | #include <linux/phy.h> |
| 29 | #include <linux/clk.h> | 29 | #include <linux/clk.h> |
| 30 | #include <linux/hrtimer.h> | ||
| 31 | #include <linux/ktime.h> | ||
| 30 | #include <uapi/linux/ppp_defs.h> | 32 | #include <uapi/linux/ppp_defs.h> |
| 31 | #include <net/ip.h> | 33 | #include <net/ip.h> |
| 32 | #include <net/ipv6.h> | 34 | #include <net/ipv6.h> |
| @@ -299,6 +301,7 @@ | |||
| 299 | 301 | ||
| 300 | /* Coalescing */ | 302 | /* Coalescing */ |
| 301 | #define MVPP2_TXDONE_COAL_PKTS_THRESH 15 | 303 | #define MVPP2_TXDONE_COAL_PKTS_THRESH 15 |
| 304 | #define MVPP2_TXDONE_HRTIMER_PERIOD_NS 1000000UL | ||
| 302 | #define MVPP2_RX_COAL_PKTS 32 | 305 | #define MVPP2_RX_COAL_PKTS 32 |
| 303 | #define MVPP2_RX_COAL_USEC 100 | 306 | #define MVPP2_RX_COAL_USEC 100 |
| 304 | 307 | ||
| @@ -660,6 +663,14 @@ struct mvpp2_pcpu_stats { | |||
| 660 | u64 tx_bytes; | 663 | u64 tx_bytes; |
| 661 | }; | 664 | }; |
| 662 | 665 | ||
| 666 | /* Per-CPU port control */ | ||
| 667 | struct mvpp2_port_pcpu { | ||
| 668 | struct hrtimer tx_done_timer; | ||
| 669 | bool timer_scheduled; | ||
| 670 | /* Tasklet for egress finalization */ | ||
| 671 | struct tasklet_struct tx_done_tasklet; | ||
| 672 | }; | ||
| 673 | |||
| 663 | struct mvpp2_port { | 674 | struct mvpp2_port { |
| 664 | u8 id; | 675 | u8 id; |
| 665 | 676 | ||
| @@ -679,6 +690,9 @@ struct mvpp2_port { | |||
| 679 | u32 pending_cause_rx; | 690 | u32 pending_cause_rx; |
| 680 | struct napi_struct napi; | 691 | struct napi_struct napi; |
| 681 | 692 | ||
| 693 | /* Per-CPU port control */ | ||
| 694 | struct mvpp2_port_pcpu __percpu *pcpu; | ||
| 695 | |||
| 682 | /* Flags */ | 696 | /* Flags */ |
| 683 | unsigned long flags; | 697 | unsigned long flags; |
| 684 | 698 | ||
| @@ -776,6 +790,9 @@ struct mvpp2_txq_pcpu { | |||
| 776 | /* Array of transmitted skb */ | 790 | /* Array of transmitted skb */ |
| 777 | struct sk_buff **tx_skb; | 791 | struct sk_buff **tx_skb; |
| 778 | 792 | ||
| 793 | /* Array of transmitted buffers' physical addresses */ | ||
| 794 | dma_addr_t *tx_buffs; | ||
| 795 | |||
| 779 | /* Index of last TX DMA descriptor that was inserted */ | 796 | /* Index of last TX DMA descriptor that was inserted */ |
| 780 | int txq_put_index; | 797 | int txq_put_index; |
| 781 | 798 | ||
| @@ -913,8 +930,6 @@ struct mvpp2_bm_pool { | |||
| 913 | /* Occupied buffers indicator */ | 930 | /* Occupied buffers indicator */ |
| 914 | atomic_t in_use; | 931 | atomic_t in_use; |
| 915 | int in_use_thresh; | 932 | int in_use_thresh; |
| 916 | |||
| 917 | spinlock_t lock; | ||
| 918 | }; | 933 | }; |
| 919 | 934 | ||
| 920 | struct mvpp2_buff_hdr { | 935 | struct mvpp2_buff_hdr { |
| @@ -963,9 +978,13 @@ static void mvpp2_txq_inc_get(struct mvpp2_txq_pcpu *txq_pcpu) | |||
| 963 | } | 978 | } |
| 964 | 979 | ||
| 965 | static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu, | 980 | static void mvpp2_txq_inc_put(struct mvpp2_txq_pcpu *txq_pcpu, |
| 966 | struct sk_buff *skb) | 981 | struct sk_buff *skb, |
| 982 | struct mvpp2_tx_desc *tx_desc) | ||
| 967 | { | 983 | { |
| 968 | txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb; | 984 | txq_pcpu->tx_skb[txq_pcpu->txq_put_index] = skb; |
| 985 | if (skb) | ||
| 986 | txq_pcpu->tx_buffs[txq_pcpu->txq_put_index] = | ||
| 987 | tx_desc->buf_phys_addr; | ||
| 969 | txq_pcpu->txq_put_index++; | 988 | txq_pcpu->txq_put_index++; |
| 970 | if (txq_pcpu->txq_put_index == txq_pcpu->size) | 989 | if (txq_pcpu->txq_put_index == txq_pcpu->size) |
| 971 | txq_pcpu->txq_put_index = 0; | 990 | txq_pcpu->txq_put_index = 0; |
| @@ -3376,7 +3395,6 @@ static int mvpp2_bm_pool_create(struct platform_device *pdev, | |||
| 3376 | bm_pool->pkt_size = 0; | 3395 | bm_pool->pkt_size = 0; |
| 3377 | bm_pool->buf_num = 0; | 3396 | bm_pool->buf_num = 0; |
| 3378 | atomic_set(&bm_pool->in_use, 0); | 3397 | atomic_set(&bm_pool->in_use, 0); |
| 3379 | spin_lock_init(&bm_pool->lock); | ||
| 3380 | 3398 | ||
| 3381 | return 0; | 3399 | return 0; |
| 3382 | } | 3400 | } |
| @@ -3647,7 +3665,6 @@ static struct mvpp2_bm_pool * | |||
| 3647 | mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, | 3665 | mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, |
| 3648 | int pkt_size) | 3666 | int pkt_size) |
| 3649 | { | 3667 | { |
| 3650 | unsigned long flags = 0; | ||
| 3651 | struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool]; | 3668 | struct mvpp2_bm_pool *new_pool = &port->priv->bm_pools[pool]; |
| 3652 | int num; | 3669 | int num; |
| 3653 | 3670 | ||
| @@ -3656,8 +3673,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, | |||
| 3656 | return NULL; | 3673 | return NULL; |
| 3657 | } | 3674 | } |
| 3658 | 3675 | ||
| 3659 | spin_lock_irqsave(&new_pool->lock, flags); | ||
| 3660 | |||
| 3661 | if (new_pool->type == MVPP2_BM_FREE) | 3676 | if (new_pool->type == MVPP2_BM_FREE) |
| 3662 | new_pool->type = type; | 3677 | new_pool->type = type; |
| 3663 | 3678 | ||
| @@ -3686,8 +3701,6 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, | |||
| 3686 | if (num != pkts_num) { | 3701 | if (num != pkts_num) { |
| 3687 | WARN(1, "pool %d: %d of %d allocated\n", | 3702 | WARN(1, "pool %d: %d of %d allocated\n", |
| 3688 | new_pool->id, num, pkts_num); | 3703 | new_pool->id, num, pkts_num); |
| 3689 | /* We need to undo the bufs_add() allocations */ | ||
| 3690 | spin_unlock_irqrestore(&new_pool->lock, flags); | ||
| 3691 | return NULL; | 3704 | return NULL; |
| 3692 | } | 3705 | } |
| 3693 | } | 3706 | } |
| @@ -3695,15 +3708,12 @@ mvpp2_bm_pool_use(struct mvpp2_port *port, int pool, enum mvpp2_bm_type type, | |||
| 3695 | mvpp2_bm_pool_bufsize_set(port->priv, new_pool, | 3708 | mvpp2_bm_pool_bufsize_set(port->priv, new_pool, |
| 3696 | MVPP2_RX_BUF_SIZE(new_pool->pkt_size)); | 3709 | MVPP2_RX_BUF_SIZE(new_pool->pkt_size)); |
| 3697 | 3710 | ||
| 3698 | spin_unlock_irqrestore(&new_pool->lock, flags); | ||
| 3699 | |||
| 3700 | return new_pool; | 3711 | return new_pool; |
| 3701 | } | 3712 | } |
| 3702 | 3713 | ||
| 3703 | /* Initialize pools for swf */ | 3714 | /* Initialize pools for swf */ |
| 3704 | static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) | 3715 | static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) |
| 3705 | { | 3716 | { |
| 3706 | unsigned long flags = 0; | ||
| 3707 | int rxq; | 3717 | int rxq; |
| 3708 | 3718 | ||
| 3709 | if (!port->pool_long) { | 3719 | if (!port->pool_long) { |
| @@ -3714,9 +3724,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) | |||
| 3714 | if (!port->pool_long) | 3724 | if (!port->pool_long) |
| 3715 | return -ENOMEM; | 3725 | return -ENOMEM; |
| 3716 | 3726 | ||
| 3717 | spin_lock_irqsave(&port->pool_long->lock, flags); | ||
| 3718 | port->pool_long->port_map |= (1 << port->id); | 3727 | port->pool_long->port_map |= (1 << port->id); |
| 3719 | spin_unlock_irqrestore(&port->pool_long->lock, flags); | ||
| 3720 | 3728 | ||
| 3721 | for (rxq = 0; rxq < rxq_number; rxq++) | 3729 | for (rxq = 0; rxq < rxq_number; rxq++) |
| 3722 | mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id); | 3730 | mvpp2_rxq_long_pool_set(port, rxq, port->pool_long->id); |
| @@ -3730,9 +3738,7 @@ static int mvpp2_swf_bm_pool_init(struct mvpp2_port *port) | |||
| 3730 | if (!port->pool_short) | 3738 | if (!port->pool_short) |
| 3731 | return -ENOMEM; | 3739 | return -ENOMEM; |
| 3732 | 3740 | ||
| 3733 | spin_lock_irqsave(&port->pool_short->lock, flags); | ||
| 3734 | port->pool_short->port_map |= (1 << port->id); | 3741 | port->pool_short->port_map |= (1 << port->id); |
| 3735 | spin_unlock_irqrestore(&port->pool_short->lock, flags); | ||
| 3736 | 3742 | ||
| 3737 | for (rxq = 0; rxq < rxq_number; rxq++) | 3743 | for (rxq = 0; rxq < rxq_number; rxq++) |
| 3738 | mvpp2_rxq_short_pool_set(port, rxq, | 3744 | mvpp2_rxq_short_pool_set(port, rxq, |
| @@ -3806,7 +3812,6 @@ static void mvpp2_interrupts_unmask(void *arg) | |||
| 3806 | 3812 | ||
| 3807 | mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id), | 3813 | mvpp2_write(port->priv, MVPP2_ISR_RX_TX_MASK_REG(port->id), |
| 3808 | (MVPP2_CAUSE_MISC_SUM_MASK | | 3814 | (MVPP2_CAUSE_MISC_SUM_MASK | |
| 3809 | MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK | | ||
| 3810 | MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK)); | 3815 | MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK)); |
| 3811 | } | 3816 | } |
| 3812 | 3817 | ||
| @@ -4382,23 +4387,6 @@ static void mvpp2_rx_time_coal_set(struct mvpp2_port *port, | |||
| 4382 | rxq->time_coal = usec; | 4387 | rxq->time_coal = usec; |
| 4383 | } | 4388 | } |
| 4384 | 4389 | ||
| 4385 | /* Set threshold for TX_DONE pkts coalescing */ | ||
| 4386 | static void mvpp2_tx_done_pkts_coal_set(void *arg) | ||
| 4387 | { | ||
| 4388 | struct mvpp2_port *port = arg; | ||
| 4389 | int queue; | ||
| 4390 | u32 val; | ||
| 4391 | |||
| 4392 | for (queue = 0; queue < txq_number; queue++) { | ||
| 4393 | struct mvpp2_tx_queue *txq = port->txqs[queue]; | ||
| 4394 | |||
| 4395 | val = (txq->done_pkts_coal << MVPP2_TRANSMITTED_THRESH_OFFSET) & | ||
| 4396 | MVPP2_TRANSMITTED_THRESH_MASK; | ||
| 4397 | mvpp2_write(port->priv, MVPP2_TXQ_NUM_REG, txq->id); | ||
| 4398 | mvpp2_write(port->priv, MVPP2_TXQ_THRESH_REG, val); | ||
| 4399 | } | ||
| 4400 | } | ||
| 4401 | |||
| 4402 | /* Free Tx queue skbuffs */ | 4390 | /* Free Tx queue skbuffs */ |
| 4403 | static void mvpp2_txq_bufs_free(struct mvpp2_port *port, | 4391 | static void mvpp2_txq_bufs_free(struct mvpp2_port *port, |
| 4404 | struct mvpp2_tx_queue *txq, | 4392 | struct mvpp2_tx_queue *txq, |
| @@ -4407,8 +4395,8 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, | |||
| 4407 | int i; | 4395 | int i; |
| 4408 | 4396 | ||
| 4409 | for (i = 0; i < num; i++) { | 4397 | for (i = 0; i < num; i++) { |
| 4410 | struct mvpp2_tx_desc *tx_desc = txq->descs + | 4398 | dma_addr_t buf_phys_addr = |
| 4411 | txq_pcpu->txq_get_index; | 4399 | txq_pcpu->tx_buffs[txq_pcpu->txq_get_index]; |
| 4412 | struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index]; | 4400 | struct sk_buff *skb = txq_pcpu->tx_skb[txq_pcpu->txq_get_index]; |
| 4413 | 4401 | ||
| 4414 | mvpp2_txq_inc_get(txq_pcpu); | 4402 | mvpp2_txq_inc_get(txq_pcpu); |
| @@ -4416,8 +4404,8 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port, | |||
| 4416 | if (!skb) | 4404 | if (!skb) |
| 4417 | continue; | 4405 | continue; |
| 4418 | 4406 | ||
| 4419 | dma_unmap_single(port->dev->dev.parent, tx_desc->buf_phys_addr, | 4407 | dma_unmap_single(port->dev->dev.parent, buf_phys_addr, |
| 4420 | tx_desc->data_size, DMA_TO_DEVICE); | 4408 | skb_headlen(skb), DMA_TO_DEVICE); |
| 4421 | dev_kfree_skb_any(skb); | 4409 | dev_kfree_skb_any(skb); |
| 4422 | } | 4410 | } |
| 4423 | } | 4411 | } |
| @@ -4433,7 +4421,7 @@ static inline struct mvpp2_rx_queue *mvpp2_get_rx_queue(struct mvpp2_port *port, | |||
| 4433 | static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port, | 4421 | static inline struct mvpp2_tx_queue *mvpp2_get_tx_queue(struct mvpp2_port *port, |
| 4434 | u32 cause) | 4422 | u32 cause) |
| 4435 | { | 4423 | { |
| 4436 | int queue = fls(cause >> 16) - 1; | 4424 | int queue = fls(cause) - 1; |
| 4437 | 4425 | ||
| 4438 | return port->txqs[queue]; | 4426 | return port->txqs[queue]; |
| 4439 | } | 4427 | } |
| @@ -4460,6 +4448,29 @@ static void mvpp2_txq_done(struct mvpp2_port *port, struct mvpp2_tx_queue *txq, | |||
| 4460 | netif_tx_wake_queue(nq); | 4448 | netif_tx_wake_queue(nq); |
| 4461 | } | 4449 | } |
| 4462 | 4450 | ||
| 4451 | static unsigned int mvpp2_tx_done(struct mvpp2_port *port, u32 cause) | ||
| 4452 | { | ||
| 4453 | struct mvpp2_tx_queue *txq; | ||
| 4454 | struct mvpp2_txq_pcpu *txq_pcpu; | ||
| 4455 | unsigned int tx_todo = 0; | ||
| 4456 | |||
| 4457 | while (cause) { | ||
| 4458 | txq = mvpp2_get_tx_queue(port, cause); | ||
| 4459 | if (!txq) | ||
| 4460 | break; | ||
| 4461 | |||
| 4462 | txq_pcpu = this_cpu_ptr(txq->pcpu); | ||
| 4463 | |||
| 4464 | if (txq_pcpu->count) { | ||
| 4465 | mvpp2_txq_done(port, txq, txq_pcpu); | ||
| 4466 | tx_todo += txq_pcpu->count; | ||
| 4467 | } | ||
| 4468 | |||
| 4469 | cause &= ~(1 << txq->log_id); | ||
| 4470 | } | ||
| 4471 | return tx_todo; | ||
| 4472 | } | ||
| 4473 | |||
| 4463 | /* Rx/Tx queue initialization/cleanup methods */ | 4474 | /* Rx/Tx queue initialization/cleanup methods */ |
| 4464 | 4475 | ||
| 4465 | /* Allocate and initialize descriptors for aggr TXQ */ | 4476 | /* Allocate and initialize descriptors for aggr TXQ */ |
| @@ -4649,12 +4660,13 @@ static int mvpp2_txq_init(struct mvpp2_port *port, | |||
| 4649 | txq_pcpu->tx_skb = kmalloc(txq_pcpu->size * | 4660 | txq_pcpu->tx_skb = kmalloc(txq_pcpu->size * |
| 4650 | sizeof(*txq_pcpu->tx_skb), | 4661 | sizeof(*txq_pcpu->tx_skb), |
| 4651 | GFP_KERNEL); | 4662 | GFP_KERNEL); |
| 4652 | if (!txq_pcpu->tx_skb) { | 4663 | if (!txq_pcpu->tx_skb) |
| 4653 | dma_free_coherent(port->dev->dev.parent, | 4664 | goto error; |
| 4654 | txq->size * MVPP2_DESC_ALIGNED_SIZE, | 4665 | |
| 4655 | txq->descs, txq->descs_phys); | 4666 | txq_pcpu->tx_buffs = kmalloc(txq_pcpu->size * |
| 4656 | return -ENOMEM; | 4667 | sizeof(dma_addr_t), GFP_KERNEL); |
| 4657 | } | 4668 | if (!txq_pcpu->tx_buffs) |
| 4669 | goto error; | ||
| 4658 | 4670 | ||
| 4659 | txq_pcpu->count = 0; | 4671 | txq_pcpu->count = 0; |
| 4660 | txq_pcpu->reserved_num = 0; | 4672 | txq_pcpu->reserved_num = 0; |
| @@ -4663,6 +4675,19 @@ static int mvpp2_txq_init(struct mvpp2_port *port, | |||
| 4663 | } | 4675 | } |
| 4664 | 4676 | ||
| 4665 | return 0; | 4677 | return 0; |
| 4678 | |||
| 4679 | error: | ||
| 4680 | for_each_present_cpu(cpu) { | ||
| 4681 | txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); | ||
| 4682 | kfree(txq_pcpu->tx_skb); | ||
| 4683 | kfree(txq_pcpu->tx_buffs); | ||
| 4684 | } | ||
| 4685 | |||
| 4686 | dma_free_coherent(port->dev->dev.parent, | ||
| 4687 | txq->size * MVPP2_DESC_ALIGNED_SIZE, | ||
| 4688 | txq->descs, txq->descs_phys); | ||
| 4689 | |||
| 4690 | return -ENOMEM; | ||
| 4666 | } | 4691 | } |
| 4667 | 4692 | ||
| 4668 | /* Free allocated TXQ resources */ | 4693 | /* Free allocated TXQ resources */ |
| @@ -4675,6 +4700,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port, | |||
| 4675 | for_each_present_cpu(cpu) { | 4700 | for_each_present_cpu(cpu) { |
| 4676 | txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); | 4701 | txq_pcpu = per_cpu_ptr(txq->pcpu, cpu); |
| 4677 | kfree(txq_pcpu->tx_skb); | 4702 | kfree(txq_pcpu->tx_skb); |
| 4703 | kfree(txq_pcpu->tx_buffs); | ||
| 4678 | } | 4704 | } |
| 4679 | 4705 | ||
| 4680 | if (txq->descs) | 4706 | if (txq->descs) |
| @@ -4805,7 +4831,6 @@ static int mvpp2_setup_txqs(struct mvpp2_port *port) | |||
| 4805 | goto err_cleanup; | 4831 | goto err_cleanup; |
| 4806 | } | 4832 | } |
| 4807 | 4833 | ||
| 4808 | on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1); | ||
| 4809 | on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1); | 4834 | on_each_cpu(mvpp2_txq_sent_counter_clear, port, 1); |
| 4810 | return 0; | 4835 | return 0; |
| 4811 | 4836 | ||
| @@ -4887,6 +4912,49 @@ static void mvpp2_link_event(struct net_device *dev) | |||
| 4887 | } | 4912 | } |
| 4888 | } | 4913 | } |
| 4889 | 4914 | ||
| 4915 | static void mvpp2_timer_set(struct mvpp2_port_pcpu *port_pcpu) | ||
| 4916 | { | ||
| 4917 | ktime_t interval; | ||
| 4918 | |||
| 4919 | if (!port_pcpu->timer_scheduled) { | ||
| 4920 | port_pcpu->timer_scheduled = true; | ||
| 4921 | interval = ktime_set(0, MVPP2_TXDONE_HRTIMER_PERIOD_NS); | ||
| 4922 | hrtimer_start(&port_pcpu->tx_done_timer, interval, | ||
| 4923 | HRTIMER_MODE_REL_PINNED); | ||
| 4924 | } | ||
| 4925 | } | ||
| 4926 | |||
| 4927 | static void mvpp2_tx_proc_cb(unsigned long data) | ||
| 4928 | { | ||
| 4929 | struct net_device *dev = (struct net_device *)data; | ||
| 4930 | struct mvpp2_port *port = netdev_priv(dev); | ||
| 4931 | struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu); | ||
| 4932 | unsigned int tx_todo, cause; | ||
| 4933 | |||
| 4934 | if (!netif_running(dev)) | ||
| 4935 | return; | ||
| 4936 | port_pcpu->timer_scheduled = false; | ||
| 4937 | |||
| 4938 | /* Process all the Tx queues */ | ||
| 4939 | cause = (1 << txq_number) - 1; | ||
| 4940 | tx_todo = mvpp2_tx_done(port, cause); | ||
| 4941 | |||
| 4942 | /* Set the timer in case not all the packets were processed */ | ||
| 4943 | if (tx_todo) | ||
| 4944 | mvpp2_timer_set(port_pcpu); | ||
| 4945 | } | ||
| 4946 | |||
| 4947 | static enum hrtimer_restart mvpp2_hr_timer_cb(struct hrtimer *timer) | ||
| 4948 | { | ||
| 4949 | struct mvpp2_port_pcpu *port_pcpu = container_of(timer, | ||
| 4950 | struct mvpp2_port_pcpu, | ||
| 4951 | tx_done_timer); | ||
| 4952 | |||
| 4953 | tasklet_schedule(&port_pcpu->tx_done_tasklet); | ||
| 4954 | |||
| 4955 | return HRTIMER_NORESTART; | ||
| 4956 | } | ||
| 4957 | |||
| 4890 | /* Main RX/TX processing routines */ | 4958 | /* Main RX/TX processing routines */ |
| 4891 | 4959 | ||
| 4892 | /* Display more error info */ | 4960 | /* Display more error info */ |
| @@ -5144,11 +5212,11 @@ static int mvpp2_tx_frag_process(struct mvpp2_port *port, struct sk_buff *skb, | |||
| 5144 | if (i == (skb_shinfo(skb)->nr_frags - 1)) { | 5212 | if (i == (skb_shinfo(skb)->nr_frags - 1)) { |
| 5145 | /* Last descriptor */ | 5213 | /* Last descriptor */ |
| 5146 | tx_desc->command = MVPP2_TXD_L_DESC; | 5214 | tx_desc->command = MVPP2_TXD_L_DESC; |
| 5147 | mvpp2_txq_inc_put(txq_pcpu, skb); | 5215 | mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc); |
| 5148 | } else { | 5216 | } else { |
| 5149 | /* Descriptor in the middle: Not First, Not Last */ | 5217 | /* Descriptor in the middle: Not First, Not Last */ |
| 5150 | tx_desc->command = 0; | 5218 | tx_desc->command = 0; |
| 5151 | mvpp2_txq_inc_put(txq_pcpu, NULL); | 5219 | mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc); |
| 5152 | } | 5220 | } |
| 5153 | } | 5221 | } |
| 5154 | 5222 | ||
| @@ -5214,12 +5282,12 @@ static int mvpp2_tx(struct sk_buff *skb, struct net_device *dev) | |||
| 5214 | /* First and Last descriptor */ | 5282 | /* First and Last descriptor */ |
| 5215 | tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC; | 5283 | tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_L_DESC; |
| 5216 | tx_desc->command = tx_cmd; | 5284 | tx_desc->command = tx_cmd; |
| 5217 | mvpp2_txq_inc_put(txq_pcpu, skb); | 5285 | mvpp2_txq_inc_put(txq_pcpu, skb, tx_desc); |
| 5218 | } else { | 5286 | } else { |
| 5219 | /* First but not Last */ | 5287 | /* First but not Last */ |
| 5220 | tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE; | 5288 | tx_cmd |= MVPP2_TXD_F_DESC | MVPP2_TXD_PADDING_DISABLE; |
| 5221 | tx_desc->command = tx_cmd; | 5289 | tx_desc->command = tx_cmd; |
| 5222 | mvpp2_txq_inc_put(txq_pcpu, NULL); | 5290 | mvpp2_txq_inc_put(txq_pcpu, NULL, tx_desc); |
| 5223 | 5291 | ||
| 5224 | /* Continue with other skb fragments */ | 5292 | /* Continue with other skb fragments */ |
| 5225 | if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) { | 5293 | if (mvpp2_tx_frag_process(port, skb, aggr_txq, txq)) { |
| @@ -5255,6 +5323,17 @@ out: | |||
| 5255 | dev_kfree_skb_any(skb); | 5323 | dev_kfree_skb_any(skb); |
| 5256 | } | 5324 | } |
| 5257 | 5325 | ||
| 5326 | /* Finalize TX processing */ | ||
| 5327 | if (txq_pcpu->count >= txq->done_pkts_coal) | ||
| 5328 | mvpp2_txq_done(port, txq, txq_pcpu); | ||
| 5329 | |||
| 5330 | /* Set the timer in case not all frags were processed */ | ||
| 5331 | if (txq_pcpu->count <= frags && txq_pcpu->count > 0) { | ||
| 5332 | struct mvpp2_port_pcpu *port_pcpu = this_cpu_ptr(port->pcpu); | ||
| 5333 | |||
| 5334 | mvpp2_timer_set(port_pcpu); | ||
| 5335 | } | ||
| 5336 | |||
| 5258 | return NETDEV_TX_OK; | 5337 | return NETDEV_TX_OK; |
| 5259 | } | 5338 | } |
| 5260 | 5339 | ||
| @@ -5268,10 +5347,11 @@ static inline void mvpp2_cause_error(struct net_device *dev, int cause) | |||
| 5268 | netdev_err(dev, "tx fifo underrun error\n"); | 5347 | netdev_err(dev, "tx fifo underrun error\n"); |
| 5269 | } | 5348 | } |
| 5270 | 5349 | ||
| 5271 | static void mvpp2_txq_done_percpu(void *arg) | 5350 | static int mvpp2_poll(struct napi_struct *napi, int budget) |
| 5272 | { | 5351 | { |
| 5273 | struct mvpp2_port *port = arg; | 5352 | u32 cause_rx_tx, cause_rx, cause_misc; |
| 5274 | u32 cause_rx_tx, cause_tx, cause_misc; | 5353 | int rx_done = 0; |
| 5354 | struct mvpp2_port *port = netdev_priv(napi->dev); | ||
| 5275 | 5355 | ||
| 5276 | /* Rx/Tx cause register | 5356 | /* Rx/Tx cause register |
| 5277 | * | 5357 | * |
| @@ -5285,7 +5365,7 @@ static void mvpp2_txq_done_percpu(void *arg) | |||
| 5285 | */ | 5365 | */ |
| 5286 | cause_rx_tx = mvpp2_read(port->priv, | 5366 | cause_rx_tx = mvpp2_read(port->priv, |
| 5287 | MVPP2_ISR_RX_TX_CAUSE_REG(port->id)); | 5367 | MVPP2_ISR_RX_TX_CAUSE_REG(port->id)); |
| 5288 | cause_tx = cause_rx_tx & MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; | 5368 | cause_rx_tx &= ~MVPP2_CAUSE_TXQ_OCCUP_DESC_ALL_MASK; |
| 5289 | cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK; | 5369 | cause_misc = cause_rx_tx & MVPP2_CAUSE_MISC_SUM_MASK; |
| 5290 | 5370 | ||
| 5291 | if (cause_misc) { | 5371 | if (cause_misc) { |
| @@ -5297,26 +5377,6 @@ static void mvpp2_txq_done_percpu(void *arg) | |||
| 5297 | cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK); | 5377 | cause_rx_tx & ~MVPP2_CAUSE_MISC_SUM_MASK); |
| 5298 | } | 5378 | } |
| 5299 | 5379 | ||
| 5300 | /* Release TX descriptors */ | ||
| 5301 | if (cause_tx) { | ||
| 5302 | struct mvpp2_tx_queue *txq = mvpp2_get_tx_queue(port, cause_tx); | ||
| 5303 | struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu); | ||
| 5304 | |||
| 5305 | if (txq_pcpu->count) | ||
| 5306 | mvpp2_txq_done(port, txq, txq_pcpu); | ||
| 5307 | } | ||
| 5308 | } | ||
| 5309 | |||
| 5310 | static int mvpp2_poll(struct napi_struct *napi, int budget) | ||
| 5311 | { | ||
| 5312 | u32 cause_rx_tx, cause_rx; | ||
| 5313 | int rx_done = 0; | ||
| 5314 | struct mvpp2_port *port = netdev_priv(napi->dev); | ||
| 5315 | |||
| 5316 | on_each_cpu(mvpp2_txq_done_percpu, port, 1); | ||
| 5317 | |||
| 5318 | cause_rx_tx = mvpp2_read(port->priv, | ||
| 5319 | MVPP2_ISR_RX_TX_CAUSE_REG(port->id)); | ||
| 5320 | cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK; | 5380 | cause_rx = cause_rx_tx & MVPP2_CAUSE_RXQ_OCCUP_DESC_ALL_MASK; |
| 5321 | 5381 | ||
| 5322 | /* Process RX packets */ | 5382 | /* Process RX packets */ |
| @@ -5561,6 +5621,8 @@ err_cleanup_rxqs: | |||
| 5561 | static int mvpp2_stop(struct net_device *dev) | 5621 | static int mvpp2_stop(struct net_device *dev) |
| 5562 | { | 5622 | { |
| 5563 | struct mvpp2_port *port = netdev_priv(dev); | 5623 | struct mvpp2_port *port = netdev_priv(dev); |
| 5624 | struct mvpp2_port_pcpu *port_pcpu; | ||
| 5625 | int cpu; | ||
| 5564 | 5626 | ||
| 5565 | mvpp2_stop_dev(port); | 5627 | mvpp2_stop_dev(port); |
| 5566 | mvpp2_phy_disconnect(port); | 5628 | mvpp2_phy_disconnect(port); |
| @@ -5569,6 +5631,13 @@ static int mvpp2_stop(struct net_device *dev) | |||
| 5569 | on_each_cpu(mvpp2_interrupts_mask, port, 1); | 5631 | on_each_cpu(mvpp2_interrupts_mask, port, 1); |
| 5570 | 5632 | ||
| 5571 | free_irq(port->irq, port); | 5633 | free_irq(port->irq, port); |
| 5634 | for_each_present_cpu(cpu) { | ||
| 5635 | port_pcpu = per_cpu_ptr(port->pcpu, cpu); | ||
| 5636 | |||
| 5637 | hrtimer_cancel(&port_pcpu->tx_done_timer); | ||
| 5638 | port_pcpu->timer_scheduled = false; | ||
| 5639 | tasklet_kill(&port_pcpu->tx_done_tasklet); | ||
| 5640 | } | ||
| 5572 | mvpp2_cleanup_rxqs(port); | 5641 | mvpp2_cleanup_rxqs(port); |
| 5573 | mvpp2_cleanup_txqs(port); | 5642 | mvpp2_cleanup_txqs(port); |
| 5574 | 5643 | ||
| @@ -5784,7 +5853,6 @@ static int mvpp2_ethtool_set_coalesce(struct net_device *dev, | |||
| 5784 | txq->done_pkts_coal = c->tx_max_coalesced_frames; | 5853 | txq->done_pkts_coal = c->tx_max_coalesced_frames; |
| 5785 | } | 5854 | } |
| 5786 | 5855 | ||
| 5787 | on_each_cpu(mvpp2_tx_done_pkts_coal_set, port, 1); | ||
| 5788 | return 0; | 5856 | return 0; |
| 5789 | } | 5857 | } |
| 5790 | 5858 | ||
| @@ -6035,6 +6103,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, | |||
| 6035 | { | 6103 | { |
| 6036 | struct device_node *phy_node; | 6104 | struct device_node *phy_node; |
| 6037 | struct mvpp2_port *port; | 6105 | struct mvpp2_port *port; |
| 6106 | struct mvpp2_port_pcpu *port_pcpu; | ||
| 6038 | struct net_device *dev; | 6107 | struct net_device *dev; |
| 6039 | struct resource *res; | 6108 | struct resource *res; |
| 6040 | const char *dt_mac_addr; | 6109 | const char *dt_mac_addr; |
| @@ -6044,7 +6113,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, | |||
| 6044 | int features; | 6113 | int features; |
| 6045 | int phy_mode; | 6114 | int phy_mode; |
| 6046 | int priv_common_regs_num = 2; | 6115 | int priv_common_regs_num = 2; |
| 6047 | int err, i; | 6116 | int err, i, cpu; |
| 6048 | 6117 | ||
| 6049 | dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number, | 6118 | dev = alloc_etherdev_mqs(sizeof(struct mvpp2_port), txq_number, |
| 6050 | rxq_number); | 6119 | rxq_number); |
| @@ -6135,6 +6204,24 @@ static int mvpp2_port_probe(struct platform_device *pdev, | |||
| 6135 | } | 6204 | } |
| 6136 | mvpp2_port_power_up(port); | 6205 | mvpp2_port_power_up(port); |
| 6137 | 6206 | ||
| 6207 | port->pcpu = alloc_percpu(struct mvpp2_port_pcpu); | ||
| 6208 | if (!port->pcpu) { | ||
| 6209 | err = -ENOMEM; | ||
| 6210 | goto err_free_txq_pcpu; | ||
| 6211 | } | ||
| 6212 | |||
| 6213 | for_each_present_cpu(cpu) { | ||
| 6214 | port_pcpu = per_cpu_ptr(port->pcpu, cpu); | ||
| 6215 | |||
| 6216 | hrtimer_init(&port_pcpu->tx_done_timer, CLOCK_MONOTONIC, | ||
| 6217 | HRTIMER_MODE_REL_PINNED); | ||
| 6218 | port_pcpu->tx_done_timer.function = mvpp2_hr_timer_cb; | ||
| 6219 | port_pcpu->timer_scheduled = false; | ||
| 6220 | |||
| 6221 | tasklet_init(&port_pcpu->tx_done_tasklet, mvpp2_tx_proc_cb, | ||
| 6222 | (unsigned long)dev); | ||
| 6223 | } | ||
| 6224 | |||
| 6138 | netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT); | 6225 | netif_napi_add(dev, &port->napi, mvpp2_poll, NAPI_POLL_WEIGHT); |
| 6139 | features = NETIF_F_SG | NETIF_F_IP_CSUM; | 6226 | features = NETIF_F_SG | NETIF_F_IP_CSUM; |
| 6140 | dev->features = features | NETIF_F_RXCSUM; | 6227 | dev->features = features | NETIF_F_RXCSUM; |
| @@ -6144,7 +6231,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, | |||
| 6144 | err = register_netdev(dev); | 6231 | err = register_netdev(dev); |
| 6145 | if (err < 0) { | 6232 | if (err < 0) { |
| 6146 | dev_err(&pdev->dev, "failed to register netdev\n"); | 6233 | dev_err(&pdev->dev, "failed to register netdev\n"); |
| 6147 | goto err_free_txq_pcpu; | 6234 | goto err_free_port_pcpu; |
| 6148 | } | 6235 | } |
| 6149 | netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr); | 6236 | netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr); |
| 6150 | 6237 | ||
| @@ -6153,6 +6240,8 @@ static int mvpp2_port_probe(struct platform_device *pdev, | |||
| 6153 | priv->port_list[id] = port; | 6240 | priv->port_list[id] = port; |
| 6154 | return 0; | 6241 | return 0; |
| 6155 | 6242 | ||
| 6243 | err_free_port_pcpu: | ||
| 6244 | free_percpu(port->pcpu); | ||
| 6156 | err_free_txq_pcpu: | 6245 | err_free_txq_pcpu: |
| 6157 | for (i = 0; i < txq_number; i++) | 6246 | for (i = 0; i < txq_number; i++) |
| 6158 | free_percpu(port->txqs[i]->pcpu); | 6247 | free_percpu(port->txqs[i]->pcpu); |
| @@ -6171,6 +6260,7 @@ static void mvpp2_port_remove(struct mvpp2_port *port) | |||
| 6171 | int i; | 6260 | int i; |
| 6172 | 6261 | ||
| 6173 | unregister_netdev(port->dev); | 6262 | unregister_netdev(port->dev); |
| 6263 | free_percpu(port->pcpu); | ||
| 6174 | free_percpu(port->stats); | 6264 | free_percpu(port->stats); |
| 6175 | for (i = 0; i < txq_number; i++) | 6265 | for (i = 0; i < txq_number; i++) |
| 6176 | free_percpu(port->txqs[i]->pcpu); | 6266 | free_percpu(port->txqs[i]->pcpu); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index afad529838de..06e3e1e54c35 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
| @@ -391,6 +391,8 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) | |||
| 391 | /* disable cmdif checksum */ | 391 | /* disable cmdif checksum */ |
| 392 | MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); | 392 | MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); |
| 393 | 393 | ||
| 394 | MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12); | ||
| 395 | |||
| 394 | err = set_caps(dev, set_ctx, set_sz); | 396 | err = set_caps(dev, set_ctx, set_sz); |
| 395 | 397 | ||
| 396 | query_ex: | 398 | query_ex: |
diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c index f78909a00f15..09d2e16fd6b0 100644 --- a/drivers/net/ethernet/micrel/ks8842.c +++ b/drivers/net/ethernet/micrel/ks8842.c | |||
| @@ -952,9 +952,8 @@ static int ks8842_alloc_dma_bufs(struct net_device *netdev) | |||
| 952 | 952 | ||
| 953 | sg_dma_address(&tx_ctl->sg) = dma_map_single(adapter->dev, | 953 | sg_dma_address(&tx_ctl->sg) = dma_map_single(adapter->dev, |
| 954 | tx_ctl->buf, DMA_BUFFER_SIZE, DMA_TO_DEVICE); | 954 | tx_ctl->buf, DMA_BUFFER_SIZE, DMA_TO_DEVICE); |
| 955 | err = dma_mapping_error(adapter->dev, | 955 | if (dma_mapping_error(adapter->dev, sg_dma_address(&tx_ctl->sg))) { |
| 956 | sg_dma_address(&tx_ctl->sg)); | 956 | err = -ENOMEM; |
| 957 | if (err) { | ||
| 958 | sg_dma_address(&tx_ctl->sg) = 0; | 957 | sg_dma_address(&tx_ctl->sg) = 0; |
| 959 | goto err; | 958 | goto err; |
| 960 | } | 959 | } |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 3df51faf18ae..f790f61ea78a 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -4875,10 +4875,12 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) | |||
| 4875 | case RTL_GIGA_MAC_VER_46: | 4875 | case RTL_GIGA_MAC_VER_46: |
| 4876 | case RTL_GIGA_MAC_VER_47: | 4876 | case RTL_GIGA_MAC_VER_47: |
| 4877 | case RTL_GIGA_MAC_VER_48: | 4877 | case RTL_GIGA_MAC_VER_48: |
| 4878 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); | ||
| 4879 | break; | ||
| 4878 | case RTL_GIGA_MAC_VER_49: | 4880 | case RTL_GIGA_MAC_VER_49: |
| 4879 | case RTL_GIGA_MAC_VER_50: | 4881 | case RTL_GIGA_MAC_VER_50: |
| 4880 | case RTL_GIGA_MAC_VER_51: | 4882 | case RTL_GIGA_MAC_VER_51: |
| 4881 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST | RX_EARLY_OFF); | 4883 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); |
| 4882 | break; | 4884 | break; |
| 4883 | default: | 4885 | default: |
| 4884 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST); | 4886 | RTL_W32(RxConfig, RX128_INT_EN | RX_DMA_BURST); |
diff --git a/drivers/net/ethernet/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c index 2d8578cade03..2e7f9a2834be 100644 --- a/drivers/net/ethernet/rocker/rocker.c +++ b/drivers/net/ethernet/rocker/rocker.c | |||
| @@ -4821,6 +4821,7 @@ static void rocker_remove_ports(const struct rocker *rocker) | |||
| 4821 | rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE, | 4821 | rocker_port_ig_tbl(rocker_port, SWITCHDEV_TRANS_NONE, |
| 4822 | ROCKER_OP_FLAG_REMOVE); | 4822 | ROCKER_OP_FLAG_REMOVE); |
| 4823 | unregister_netdev(rocker_port->dev); | 4823 | unregister_netdev(rocker_port->dev); |
| 4824 | free_netdev(rocker_port->dev); | ||
| 4824 | } | 4825 | } |
| 4825 | kfree(rocker->ports); | 4826 | kfree(rocker->ports); |
| 4826 | } | 4827 | } |
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 605cc8948594..b1a4ea21c91c 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
| @@ -1282,7 +1282,12 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, | |||
| 1282 | } | 1282 | } |
| 1283 | } | 1283 | } |
| 1284 | 1284 | ||
| 1285 | if (core_stats) { | 1285 | if (!core_stats) |
| 1286 | return stats_count; | ||
| 1287 | |||
| 1288 | if (nic_data->datapath_caps & | ||
| 1289 | 1 << MC_CMD_GET_CAPABILITIES_OUT_EVB_LBN) { | ||
| 1290 | /* Use vadaptor stats. */ | ||
| 1286 | core_stats->rx_packets = stats[EF10_STAT_rx_unicast] + | 1291 | core_stats->rx_packets = stats[EF10_STAT_rx_unicast] + |
| 1287 | stats[EF10_STAT_rx_multicast] + | 1292 | stats[EF10_STAT_rx_multicast] + |
| 1288 | stats[EF10_STAT_rx_broadcast]; | 1293 | stats[EF10_STAT_rx_broadcast]; |
| @@ -1302,6 +1307,26 @@ static size_t efx_ef10_update_stats_common(struct efx_nic *efx, u64 *full_stats, | |||
| 1302 | core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow]; | 1307 | core_stats->rx_fifo_errors = stats[EF10_STAT_rx_overflow]; |
| 1303 | core_stats->rx_errors = core_stats->rx_crc_errors; | 1308 | core_stats->rx_errors = core_stats->rx_crc_errors; |
| 1304 | core_stats->tx_errors = stats[EF10_STAT_tx_bad]; | 1309 | core_stats->tx_errors = stats[EF10_STAT_tx_bad]; |
| 1310 | } else { | ||
| 1311 | /* Use port stats. */ | ||
| 1312 | core_stats->rx_packets = stats[EF10_STAT_port_rx_packets]; | ||
| 1313 | core_stats->tx_packets = stats[EF10_STAT_port_tx_packets]; | ||
| 1314 | core_stats->rx_bytes = stats[EF10_STAT_port_rx_bytes]; | ||
| 1315 | core_stats->tx_bytes = stats[EF10_STAT_port_tx_bytes]; | ||
| 1316 | core_stats->rx_dropped = stats[EF10_STAT_port_rx_nodesc_drops] + | ||
| 1317 | stats[GENERIC_STAT_rx_nodesc_trunc] + | ||
| 1318 | stats[GENERIC_STAT_rx_noskb_drops]; | ||
| 1319 | core_stats->multicast = stats[EF10_STAT_port_rx_multicast]; | ||
| 1320 | core_stats->rx_length_errors = | ||
| 1321 | stats[EF10_STAT_port_rx_gtjumbo] + | ||
| 1322 | stats[EF10_STAT_port_rx_length_error]; | ||
| 1323 | core_stats->rx_crc_errors = stats[EF10_STAT_port_rx_bad]; | ||
| 1324 | core_stats->rx_frame_errors = | ||
| 1325 | stats[EF10_STAT_port_rx_align_error]; | ||
| 1326 | core_stats->rx_fifo_errors = stats[EF10_STAT_port_rx_overflow]; | ||
| 1327 | core_stats->rx_errors = (core_stats->rx_length_errors + | ||
| 1328 | core_stats->rx_crc_errors + | ||
| 1329 | core_stats->rx_frame_errors); | ||
| 1305 | } | 1330 | } |
| 1306 | 1331 | ||
| 1307 | return stats_count; | 1332 | return stats_count; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 7e3129e7f143..f0e4bb4e3ec5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | |||
| @@ -42,7 +42,7 @@ | |||
| 42 | #define NSS_COMMON_CLK_DIV_MASK 0x7f | 42 | #define NSS_COMMON_CLK_DIV_MASK 0x7f |
| 43 | 43 | ||
| 44 | #define NSS_COMMON_CLK_SRC_CTRL 0x14 | 44 | #define NSS_COMMON_CLK_SRC_CTRL 0x14 |
| 45 | #define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (1 << x) | 45 | #define NSS_COMMON_CLK_SRC_CTRL_OFFSET(x) (x) |
| 46 | /* Mode is coded on 1 bit but is different depending on the MAC ID: | 46 | /* Mode is coded on 1 bit but is different depending on the MAC ID: |
| 47 | * MAC0: QSGMII=0 RGMII=1 | 47 | * MAC0: QSGMII=0 RGMII=1 |
| 48 | * MAC1: QSGMII=0 SGMII=0 RGMII=1 | 48 | * MAC1: QSGMII=0 SGMII=0 RGMII=1 |
| @@ -291,7 +291,7 @@ static void *ipq806x_gmac_setup(struct platform_device *pdev) | |||
| 291 | 291 | ||
| 292 | /* Configure the clock src according to the mode */ | 292 | /* Configure the clock src according to the mode */ |
| 293 | regmap_read(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, &val); | 293 | regmap_read(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, &val); |
| 294 | val &= ~NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); | 294 | val &= ~(1 << NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id)); |
| 295 | switch (gmac->phy_mode) { | 295 | switch (gmac->phy_mode) { |
| 296 | case PHY_INTERFACE_MODE_RGMII: | 296 | case PHY_INTERFACE_MODE_RGMII: |
| 297 | val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) << | 297 | val |= NSS_COMMON_CLK_SRC_CTRL_RGMII(gmac->id) << |
diff --git a/drivers/net/ethernet/ti/netcp.h b/drivers/net/ethernet/ti/netcp.h index a8a730641bbb..bb1bb72121c0 100644 --- a/drivers/net/ethernet/ti/netcp.h +++ b/drivers/net/ethernet/ti/netcp.h | |||
| @@ -85,7 +85,6 @@ struct netcp_intf { | |||
| 85 | struct list_head rxhook_list_head; | 85 | struct list_head rxhook_list_head; |
| 86 | unsigned int rx_queue_id; | 86 | unsigned int rx_queue_id; |
| 87 | void *rx_fdq[KNAV_DMA_FDQ_PER_CHAN]; | 87 | void *rx_fdq[KNAV_DMA_FDQ_PER_CHAN]; |
| 88 | u32 rx_buffer_sizes[KNAV_DMA_FDQ_PER_CHAN]; | ||
| 89 | struct napi_struct rx_napi; | 88 | struct napi_struct rx_napi; |
| 90 | struct napi_struct tx_napi; | 89 | struct napi_struct tx_napi; |
| 91 | 90 | ||
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index 9749dfd78c43..4755838c6137 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #define NETCP_SOP_OFFSET (NET_IP_ALIGN + NET_SKB_PAD) | 34 | #define NETCP_SOP_OFFSET (NET_IP_ALIGN + NET_SKB_PAD) |
| 35 | #define NETCP_NAPI_WEIGHT 64 | 35 | #define NETCP_NAPI_WEIGHT 64 |
| 36 | #define NETCP_TX_TIMEOUT (5 * HZ) | 36 | #define NETCP_TX_TIMEOUT (5 * HZ) |
| 37 | #define NETCP_PACKET_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN) | ||
| 37 | #define NETCP_MIN_PACKET_SIZE ETH_ZLEN | 38 | #define NETCP_MIN_PACKET_SIZE ETH_ZLEN |
| 38 | #define NETCP_MAX_MCAST_ADDR 16 | 39 | #define NETCP_MAX_MCAST_ADDR 16 |
| 39 | 40 | ||
| @@ -804,30 +805,28 @@ static void netcp_allocate_rx_buf(struct netcp_intf *netcp, int fdq) | |||
| 804 | if (likely(fdq == 0)) { | 805 | if (likely(fdq == 0)) { |
| 805 | unsigned int primary_buf_len; | 806 | unsigned int primary_buf_len; |
| 806 | /* Allocate a primary receive queue entry */ | 807 | /* Allocate a primary receive queue entry */ |
| 807 | buf_len = netcp->rx_buffer_sizes[0] + NETCP_SOP_OFFSET; | 808 | buf_len = NETCP_PACKET_SIZE + NETCP_SOP_OFFSET; |
| 808 | primary_buf_len = SKB_DATA_ALIGN(buf_len) + | 809 | primary_buf_len = SKB_DATA_ALIGN(buf_len) + |
| 809 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | 810 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); |
| 810 | 811 | ||
| 811 | if (primary_buf_len <= PAGE_SIZE) { | 812 | bufptr = netdev_alloc_frag(primary_buf_len); |
| 812 | bufptr = netdev_alloc_frag(primary_buf_len); | 813 | pad[1] = primary_buf_len; |
| 813 | pad[1] = primary_buf_len; | ||
| 814 | } else { | ||
| 815 | bufptr = kmalloc(primary_buf_len, GFP_ATOMIC | | ||
| 816 | GFP_DMA32 | __GFP_COLD); | ||
| 817 | pad[1] = 0; | ||
| 818 | } | ||
| 819 | 814 | ||
| 820 | if (unlikely(!bufptr)) { | 815 | if (unlikely(!bufptr)) { |
| 821 | dev_warn_ratelimited(netcp->ndev_dev, "Primary RX buffer alloc failed\n"); | 816 | dev_warn_ratelimited(netcp->ndev_dev, |
| 817 | "Primary RX buffer alloc failed\n"); | ||
| 822 | goto fail; | 818 | goto fail; |
| 823 | } | 819 | } |
| 824 | dma = dma_map_single(netcp->dev, bufptr, buf_len, | 820 | dma = dma_map_single(netcp->dev, bufptr, buf_len, |
| 825 | DMA_TO_DEVICE); | 821 | DMA_TO_DEVICE); |
| 822 | if (unlikely(dma_mapping_error(netcp->dev, dma))) | ||
| 823 | goto fail; | ||
| 824 | |||
| 826 | pad[0] = (u32)bufptr; | 825 | pad[0] = (u32)bufptr; |
| 827 | 826 | ||
| 828 | } else { | 827 | } else { |
| 829 | /* Allocate a secondary receive queue entry */ | 828 | /* Allocate a secondary receive queue entry */ |
| 830 | page = alloc_page(GFP_ATOMIC | GFP_DMA32 | __GFP_COLD); | 829 | page = alloc_page(GFP_ATOMIC | GFP_DMA | __GFP_COLD); |
| 831 | if (unlikely(!page)) { | 830 | if (unlikely(!page)) { |
| 832 | dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n"); | 831 | dev_warn_ratelimited(netcp->ndev_dev, "Secondary page alloc failed\n"); |
| 833 | goto fail; | 832 | goto fail; |
| @@ -1010,7 +1009,7 @@ netcp_tx_map_skb(struct sk_buff *skb, struct netcp_intf *netcp) | |||
| 1010 | 1009 | ||
| 1011 | /* Map the linear buffer */ | 1010 | /* Map the linear buffer */ |
| 1012 | dma_addr = dma_map_single(dev, skb->data, pkt_len, DMA_TO_DEVICE); | 1011 | dma_addr = dma_map_single(dev, skb->data, pkt_len, DMA_TO_DEVICE); |
| 1013 | if (unlikely(!dma_addr)) { | 1012 | if (unlikely(dma_mapping_error(dev, dma_addr))) { |
| 1014 | dev_err(netcp->ndev_dev, "Failed to map skb buffer\n"); | 1013 | dev_err(netcp->ndev_dev, "Failed to map skb buffer\n"); |
| 1015 | return NULL; | 1014 | return NULL; |
| 1016 | } | 1015 | } |
| @@ -1546,8 +1545,8 @@ static int netcp_setup_navigator_resources(struct net_device *ndev) | |||
| 1546 | knav_queue_disable_notify(netcp->rx_queue); | 1545 | knav_queue_disable_notify(netcp->rx_queue); |
| 1547 | 1546 | ||
| 1548 | /* open Rx FDQs */ | 1547 | /* open Rx FDQs */ |
| 1549 | for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && | 1548 | for (i = 0; i < KNAV_DMA_FDQ_PER_CHAN && netcp->rx_queue_depths[i]; |
| 1550 | netcp->rx_queue_depths[i] && netcp->rx_buffer_sizes[i]; ++i) { | 1549 | ++i) { |
| 1551 | snprintf(name, sizeof(name), "rx-fdq-%s-%d", ndev->name, i); | 1550 | snprintf(name, sizeof(name), "rx-fdq-%s-%d", ndev->name, i); |
| 1552 | netcp->rx_fdq[i] = knav_queue_open(name, KNAV_QUEUE_GP, 0); | 1551 | netcp->rx_fdq[i] = knav_queue_open(name, KNAV_QUEUE_GP, 0); |
| 1553 | if (IS_ERR_OR_NULL(netcp->rx_fdq[i])) { | 1552 | if (IS_ERR_OR_NULL(netcp->rx_fdq[i])) { |
| @@ -1941,14 +1940,6 @@ static int netcp_create_interface(struct netcp_device *netcp_device, | |||
| 1941 | netcp->rx_queue_depths[0] = 128; | 1940 | netcp->rx_queue_depths[0] = 128; |
| 1942 | } | 1941 | } |
| 1943 | 1942 | ||
| 1944 | ret = of_property_read_u32_array(node_interface, "rx-buffer-size", | ||
| 1945 | netcp->rx_buffer_sizes, | ||
| 1946 | KNAV_DMA_FDQ_PER_CHAN); | ||
| 1947 | if (ret) { | ||
| 1948 | dev_err(dev, "missing \"rx-buffer-size\" parameter\n"); | ||
| 1949 | netcp->rx_buffer_sizes[0] = 1536; | ||
| 1950 | } | ||
| 1951 | |||
| 1952 | ret = of_property_read_u32_array(node_interface, "rx-pool", temp, 2); | 1943 | ret = of_property_read_u32_array(node_interface, "rx-pool", temp, 2); |
| 1953 | if (ret < 0) { | 1944 | if (ret < 0) { |
| 1954 | dev_err(dev, "missing \"rx-pool\" parameter\n"); | 1945 | dev_err(dev, "missing \"rx-pool\" parameter\n"); |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 2ffbf13471d0..216bfd350169 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
| @@ -728,11 +728,12 @@ static int mkiss_open(struct tty_struct *tty) | |||
| 728 | dev->type = ARPHRD_AX25; | 728 | dev->type = ARPHRD_AX25; |
| 729 | 729 | ||
| 730 | /* Perform the low-level AX25 initialization. */ | 730 | /* Perform the low-level AX25 initialization. */ |
| 731 | if ((err = ax_open(ax->dev))) { | 731 | err = ax_open(ax->dev); |
| 732 | if (err) | ||
| 732 | goto out_free_netdev; | 733 | goto out_free_netdev; |
| 733 | } | ||
| 734 | 734 | ||
| 735 | if (register_netdev(dev)) | 735 | err = register_netdev(dev); |
| 736 | if (err) | ||
| 736 | goto out_free_buffers; | 737 | goto out_free_buffers; |
| 737 | 738 | ||
| 738 | /* after register_netdev() - because else printk smashes the kernel */ | 739 | /* after register_netdev() - because else printk smashes the kernel */ |
diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c index 3cc316cb7e6b..d8757bf9ad75 100644 --- a/drivers/net/ntb_netdev.c +++ b/drivers/net/ntb_netdev.c | |||
| @@ -102,6 +102,12 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, | |||
| 102 | 102 | ||
| 103 | netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len); | 103 | netdev_dbg(ndev, "%s: %d byte payload received\n", __func__, len); |
| 104 | 104 | ||
| 105 | if (len < 0) { | ||
| 106 | ndev->stats.rx_errors++; | ||
| 107 | ndev->stats.rx_length_errors++; | ||
| 108 | goto enqueue_again; | ||
| 109 | } | ||
| 110 | |||
| 105 | skb_put(skb, len); | 111 | skb_put(skb, len); |
| 106 | skb->protocol = eth_type_trans(skb, ndev); | 112 | skb->protocol = eth_type_trans(skb, ndev); |
| 107 | skb->ip_summed = CHECKSUM_NONE; | 113 | skb->ip_summed = CHECKSUM_NONE; |
| @@ -121,6 +127,7 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data, | |||
| 121 | return; | 127 | return; |
| 122 | } | 128 | } |
| 123 | 129 | ||
| 130 | enqueue_again: | ||
| 124 | rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN); | 131 | rc = ntb_transport_rx_enqueue(qp, skb, skb->data, ndev->mtu + ETH_HLEN); |
| 125 | if (rc) { | 132 | if (rc) { |
| 126 | dev_kfree_skb(skb); | 133 | dev_kfree_skb(skb); |
| @@ -184,7 +191,7 @@ static int ntb_netdev_open(struct net_device *ndev) | |||
| 184 | 191 | ||
| 185 | rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data, | 192 | rc = ntb_transport_rx_enqueue(dev->qp, skb, skb->data, |
| 186 | ndev->mtu + ETH_HLEN); | 193 | ndev->mtu + ETH_HLEN); |
| 187 | if (rc == -EINVAL) { | 194 | if (rc) { |
| 188 | dev_kfree_skb(skb); | 195 | dev_kfree_skb(skb); |
| 189 | goto err; | 196 | goto err; |
| 190 | } | 197 | } |
diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c index 1960b46add65..d7a65247f952 100644 --- a/drivers/net/phy/fixed_phy.c +++ b/drivers/net/phy/fixed_phy.c | |||
| @@ -290,6 +290,15 @@ struct phy_device *fixed_phy_register(unsigned int irq, | |||
| 290 | return ERR_PTR(-EINVAL); | 290 | return ERR_PTR(-EINVAL); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | /* propagate the fixed link values to struct phy_device */ | ||
| 294 | phy->link = status->link; | ||
| 295 | if (status->link) { | ||
| 296 | phy->speed = status->speed; | ||
| 297 | phy->duplex = status->duplex; | ||
| 298 | phy->pause = status->pause; | ||
| 299 | phy->asym_pause = status->asym_pause; | ||
| 300 | } | ||
| 301 | |||
| 293 | of_node_get(np); | 302 | of_node_get(np); |
| 294 | phy->dev.of_node = np; | 303 | phy->dev.of_node = np; |
| 295 | 304 | ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b2197b506acb..34fe339f4e80 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
| @@ -811,6 +811,7 @@ void phy_state_machine(struct work_struct *work) | |||
| 811 | bool needs_aneg = false, do_suspend = false; | 811 | bool needs_aneg = false, do_suspend = false; |
| 812 | enum phy_state old_state; | 812 | enum phy_state old_state; |
| 813 | int err = 0; | 813 | int err = 0; |
| 814 | int old_link; | ||
| 814 | 815 | ||
| 815 | mutex_lock(&phydev->lock); | 816 | mutex_lock(&phydev->lock); |
| 816 | 817 | ||
| @@ -896,11 +897,18 @@ void phy_state_machine(struct work_struct *work) | |||
| 896 | phydev->adjust_link(phydev->attached_dev); | 897 | phydev->adjust_link(phydev->attached_dev); |
| 897 | break; | 898 | break; |
| 898 | case PHY_RUNNING: | 899 | case PHY_RUNNING: |
| 899 | /* Only register a CHANGE if we are | 900 | /* Only register a CHANGE if we are polling or ignoring |
| 900 | * polling or ignoring interrupts | 901 | * interrupts and link changed since latest checking. |
| 901 | */ | 902 | */ |
| 902 | if (!phy_interrupt_is_valid(phydev)) | 903 | if (!phy_interrupt_is_valid(phydev)) { |
| 903 | phydev->state = PHY_CHANGELINK; | 904 | old_link = phydev->link; |
| 905 | err = phy_read_status(phydev); | ||
| 906 | if (err) | ||
| 907 | break; | ||
| 908 | |||
| 909 | if (old_link != phydev->link) | ||
| 910 | phydev->state = PHY_CHANGELINK; | ||
| 911 | } | ||
| 904 | break; | 912 | break; |
| 905 | case PHY_CHANGELINK: | 913 | case PHY_CHANGELINK: |
| 906 | err = phy_read_status(phydev); | 914 | err = phy_read_status(phydev); |
| @@ -1030,10 +1038,14 @@ int phy_read_mmd_indirect(struct phy_device *phydev, int prtad, | |||
| 1030 | int value = -1; | 1038 | int value = -1; |
| 1031 | 1039 | ||
| 1032 | if (phydrv->read_mmd_indirect == NULL) { | 1040 | if (phydrv->read_mmd_indirect == NULL) { |
| 1033 | mmd_phy_indirect(phydev->bus, prtad, devad, addr); | 1041 | struct mii_bus *bus = phydev->bus; |
| 1042 | |||
| 1043 | mutex_lock(&bus->mdio_lock); | ||
| 1044 | mmd_phy_indirect(bus, prtad, devad, addr); | ||
| 1034 | 1045 | ||
| 1035 | /* Read the content of the MMD's selected register */ | 1046 | /* Read the content of the MMD's selected register */ |
| 1036 | value = phydev->bus->read(phydev->bus, addr, MII_MMD_DATA); | 1047 | value = bus->read(bus, addr, MII_MMD_DATA); |
| 1048 | mutex_unlock(&bus->mdio_lock); | ||
| 1037 | } else { | 1049 | } else { |
| 1038 | value = phydrv->read_mmd_indirect(phydev, prtad, devad, addr); | 1050 | value = phydrv->read_mmd_indirect(phydev, prtad, devad, addr); |
| 1039 | } | 1051 | } |
| @@ -1063,10 +1075,14 @@ void phy_write_mmd_indirect(struct phy_device *phydev, int prtad, | |||
| 1063 | struct phy_driver *phydrv = phydev->drv; | 1075 | struct phy_driver *phydrv = phydev->drv; |
| 1064 | 1076 | ||
| 1065 | if (phydrv->write_mmd_indirect == NULL) { | 1077 | if (phydrv->write_mmd_indirect == NULL) { |
| 1066 | mmd_phy_indirect(phydev->bus, prtad, devad, addr); | 1078 | struct mii_bus *bus = phydev->bus; |
| 1079 | |||
| 1080 | mutex_lock(&bus->mdio_lock); | ||
| 1081 | mmd_phy_indirect(bus, prtad, devad, addr); | ||
| 1067 | 1082 | ||
| 1068 | /* Write the data into MMD's selected register */ | 1083 | /* Write the data into MMD's selected register */ |
| 1069 | phydev->bus->write(phydev->bus, addr, MII_MMD_DATA, data); | 1084 | bus->write(bus, addr, MII_MMD_DATA, data); |
| 1085 | mutex_unlock(&bus->mdio_lock); | ||
| 1070 | } else { | 1086 | } else { |
| 1071 | phydrv->write_mmd_indirect(phydev, prtad, devad, addr, data); | 1087 | phydrv->write_mmd_indirect(phydev, prtad, devad, addr, data); |
| 1072 | } | 1088 | } |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 0302483de240..55f01788df5e 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
| @@ -176,7 +176,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, | |||
| 176 | if (c45_ids) | 176 | if (c45_ids) |
| 177 | dev->c45_ids = *c45_ids; | 177 | dev->c45_ids = *c45_ids; |
| 178 | dev->bus = bus; | 178 | dev->bus = bus; |
| 179 | dev->dev.parent = bus->parent; | 179 | dev->dev.parent = &bus->dev; |
| 180 | dev->dev.bus = &mdio_bus_type; | 180 | dev->dev.bus = &mdio_bus_type; |
| 181 | dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL; | 181 | dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL; |
| 182 | dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr); | 182 | dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr); |
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index c0f6479e19d4..70b08958763a 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
| @@ -91,19 +91,18 @@ static int lan911x_config_init(struct phy_device *phydev) | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | /* | 93 | /* |
| 94 | * The LAN8710/LAN8720 requires a minimum of 2 link pulses within 64ms of each | 94 | * The LAN87xx suffers from rare absence of the ENERGYON-bit when Ethernet cable |
| 95 | * other in order to set the ENERGYON bit and exit EDPD mode. If a link partner | 95 | * plugs in while LAN87xx is in Energy Detect Power-Down mode. This leads to |
| 96 | * does send the pulses within this interval, the PHY will remained powered | 96 | * unstable detection of plugging in Ethernet cable. |
| 97 | * down. | 97 | * This workaround disables Energy Detect Power-Down mode and waiting for |
| 98 | * | 98 | * response on link pulses to detect presence of plugged Ethernet cable. |
| 99 | * This workaround will manually toggle the PHY on/off upon calls to read_status | 99 | * The Energy Detect Power-Down mode is enabled again in the end of procedure to |
| 100 | * in order to generate link test pulses if the link is down. If a link partner | 100 | * save approximately 220 mW of power if cable is unplugged. |
| 101 | * is present, it will respond to the pulses, which will cause the ENERGYON bit | ||
| 102 | * to be set and will cause the EDPD mode to be exited. | ||
| 103 | */ | 101 | */ |
| 104 | static int lan87xx_read_status(struct phy_device *phydev) | 102 | static int lan87xx_read_status(struct phy_device *phydev) |
| 105 | { | 103 | { |
| 106 | int err = genphy_read_status(phydev); | 104 | int err = genphy_read_status(phydev); |
| 105 | int i; | ||
| 107 | 106 | ||
| 108 | if (!phydev->link) { | 107 | if (!phydev->link) { |
| 109 | /* Disable EDPD to wake up PHY */ | 108 | /* Disable EDPD to wake up PHY */ |
| @@ -116,8 +115,16 @@ static int lan87xx_read_status(struct phy_device *phydev) | |||
| 116 | if (rc < 0) | 115 | if (rc < 0) |
| 117 | return rc; | 116 | return rc; |
| 118 | 117 | ||
| 119 | /* Sleep 64 ms to allow ~5 link test pulses to be sent */ | 118 | /* Wait max 640 ms to detect energy */ |
| 120 | msleep(64); | 119 | for (i = 0; i < 64; i++) { |
| 120 | /* Sleep to allow link test pulses to be sent */ | ||
| 121 | msleep(10); | ||
| 122 | rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | ||
| 123 | if (rc < 0) | ||
| 124 | return rc; | ||
| 125 | if (rc & MII_LAN83C185_ENERGYON) | ||
| 126 | break; | ||
| 127 | } | ||
| 121 | 128 | ||
| 122 | /* Re-enable EDPD */ | 129 | /* Re-enable EDPD */ |
| 123 | rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); | 130 | rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); |
| @@ -191,7 +198,7 @@ static struct phy_driver smsc_phy_driver[] = { | |||
| 191 | 198 | ||
| 192 | /* basic functions */ | 199 | /* basic functions */ |
| 193 | .config_aneg = genphy_config_aneg, | 200 | .config_aneg = genphy_config_aneg, |
| 194 | .read_status = genphy_read_status, | 201 | .read_status = lan87xx_read_status, |
| 195 | .config_init = smsc_phy_config_init, | 202 | .config_init = smsc_phy_config_init, |
| 196 | .soft_reset = smsc_phy_reset, | 203 | .soft_reset = smsc_phy_reset, |
| 197 | 204 | ||
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 9d15566521a7..fa8f5046afe9 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
| @@ -269,9 +269,9 @@ static void ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound); | |||
| 269 | static void ppp_ccp_closed(struct ppp *ppp); | 269 | static void ppp_ccp_closed(struct ppp *ppp); |
| 270 | static struct compressor *find_compressor(int type); | 270 | static struct compressor *find_compressor(int type); |
| 271 | static void ppp_get_stats(struct ppp *ppp, struct ppp_stats *st); | 271 | static void ppp_get_stats(struct ppp *ppp, struct ppp_stats *st); |
| 272 | static struct ppp *ppp_create_interface(struct net *net, int unit, int *retp); | 272 | static struct ppp *ppp_create_interface(struct net *net, int unit, |
| 273 | struct file *file, int *retp); | ||
| 273 | static void init_ppp_file(struct ppp_file *pf, int kind); | 274 | static void init_ppp_file(struct ppp_file *pf, int kind); |
| 274 | static void ppp_shutdown_interface(struct ppp *ppp); | ||
| 275 | static void ppp_destroy_interface(struct ppp *ppp); | 275 | static void ppp_destroy_interface(struct ppp *ppp); |
| 276 | static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit); | 276 | static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit); |
| 277 | static struct channel *ppp_find_channel(struct ppp_net *pn, int unit); | 277 | static struct channel *ppp_find_channel(struct ppp_net *pn, int unit); |
| @@ -392,8 +392,10 @@ static int ppp_release(struct inode *unused, struct file *file) | |||
| 392 | file->private_data = NULL; | 392 | file->private_data = NULL; |
| 393 | if (pf->kind == INTERFACE) { | 393 | if (pf->kind == INTERFACE) { |
| 394 | ppp = PF_TO_PPP(pf); | 394 | ppp = PF_TO_PPP(pf); |
| 395 | rtnl_lock(); | ||
| 395 | if (file == ppp->owner) | 396 | if (file == ppp->owner) |
| 396 | ppp_shutdown_interface(ppp); | 397 | unregister_netdevice(ppp->dev); |
| 398 | rtnl_unlock(); | ||
| 397 | } | 399 | } |
| 398 | if (atomic_dec_and_test(&pf->refcnt)) { | 400 | if (atomic_dec_and_test(&pf->refcnt)) { |
| 399 | switch (pf->kind) { | 401 | switch (pf->kind) { |
| @@ -593,8 +595,10 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 593 | mutex_lock(&ppp_mutex); | 595 | mutex_lock(&ppp_mutex); |
| 594 | if (pf->kind == INTERFACE) { | 596 | if (pf->kind == INTERFACE) { |
| 595 | ppp = PF_TO_PPP(pf); | 597 | ppp = PF_TO_PPP(pf); |
| 598 | rtnl_lock(); | ||
| 596 | if (file == ppp->owner) | 599 | if (file == ppp->owner) |
| 597 | ppp_shutdown_interface(ppp); | 600 | unregister_netdevice(ppp->dev); |
| 601 | rtnl_unlock(); | ||
| 598 | } | 602 | } |
| 599 | if (atomic_long_read(&file->f_count) < 2) { | 603 | if (atomic_long_read(&file->f_count) < 2) { |
| 600 | ppp_release(NULL, file); | 604 | ppp_release(NULL, file); |
| @@ -838,11 +842,10 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, | |||
| 838 | /* Create a new ppp unit */ | 842 | /* Create a new ppp unit */ |
| 839 | if (get_user(unit, p)) | 843 | if (get_user(unit, p)) |
| 840 | break; | 844 | break; |
| 841 | ppp = ppp_create_interface(net, unit, &err); | 845 | ppp = ppp_create_interface(net, unit, file, &err); |
| 842 | if (!ppp) | 846 | if (!ppp) |
| 843 | break; | 847 | break; |
| 844 | file->private_data = &ppp->file; | 848 | file->private_data = &ppp->file; |
| 845 | ppp->owner = file; | ||
| 846 | err = -EFAULT; | 849 | err = -EFAULT; |
| 847 | if (put_user(ppp->file.index, p)) | 850 | if (put_user(ppp->file.index, p)) |
| 848 | break; | 851 | break; |
| @@ -916,6 +919,16 @@ static __net_init int ppp_init_net(struct net *net) | |||
| 916 | static __net_exit void ppp_exit_net(struct net *net) | 919 | static __net_exit void ppp_exit_net(struct net *net) |
| 917 | { | 920 | { |
| 918 | struct ppp_net *pn = net_generic(net, ppp_net_id); | 921 | struct ppp_net *pn = net_generic(net, ppp_net_id); |
| 922 | struct ppp *ppp; | ||
| 923 | LIST_HEAD(list); | ||
| 924 | int id; | ||
| 925 | |||
| 926 | rtnl_lock(); | ||
| 927 | idr_for_each_entry(&pn->units_idr, ppp, id) | ||
| 928 | unregister_netdevice_queue(ppp->dev, &list); | ||
| 929 | |||
| 930 | unregister_netdevice_many(&list); | ||
| 931 | rtnl_unlock(); | ||
| 919 | 932 | ||
| 920 | idr_destroy(&pn->units_idr); | 933 | idr_destroy(&pn->units_idr); |
| 921 | } | 934 | } |
| @@ -1088,8 +1101,28 @@ static int ppp_dev_init(struct net_device *dev) | |||
| 1088 | return 0; | 1101 | return 0; |
| 1089 | } | 1102 | } |
| 1090 | 1103 | ||
| 1104 | static void ppp_dev_uninit(struct net_device *dev) | ||
| 1105 | { | ||
| 1106 | struct ppp *ppp = netdev_priv(dev); | ||
| 1107 | struct ppp_net *pn = ppp_pernet(ppp->ppp_net); | ||
| 1108 | |||
| 1109 | ppp_lock(ppp); | ||
| 1110 | ppp->closing = 1; | ||
| 1111 | ppp_unlock(ppp); | ||
| 1112 | |||
| 1113 | mutex_lock(&pn->all_ppp_mutex); | ||
| 1114 | unit_put(&pn->units_idr, ppp->file.index); | ||
| 1115 | mutex_unlock(&pn->all_ppp_mutex); | ||
| 1116 | |||
| 1117 | ppp->owner = NULL; | ||
| 1118 | |||
| 1119 | ppp->file.dead = 1; | ||
| 1120 | wake_up_interruptible(&ppp->file.rwait); | ||
| 1121 | } | ||
| 1122 | |||
| 1091 | static const struct net_device_ops ppp_netdev_ops = { | 1123 | static const struct net_device_ops ppp_netdev_ops = { |
| 1092 | .ndo_init = ppp_dev_init, | 1124 | .ndo_init = ppp_dev_init, |
| 1125 | .ndo_uninit = ppp_dev_uninit, | ||
| 1093 | .ndo_start_xmit = ppp_start_xmit, | 1126 | .ndo_start_xmit = ppp_start_xmit, |
| 1094 | .ndo_do_ioctl = ppp_net_ioctl, | 1127 | .ndo_do_ioctl = ppp_net_ioctl, |
| 1095 | .ndo_get_stats64 = ppp_get_stats64, | 1128 | .ndo_get_stats64 = ppp_get_stats64, |
| @@ -2667,8 +2700,8 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st) | |||
| 2667 | * or if there is already a unit with the requested number. | 2700 | * or if there is already a unit with the requested number. |
| 2668 | * unit == -1 means allocate a new number. | 2701 | * unit == -1 means allocate a new number. |
| 2669 | */ | 2702 | */ |
| 2670 | static struct ppp * | 2703 | static struct ppp *ppp_create_interface(struct net *net, int unit, |
| 2671 | ppp_create_interface(struct net *net, int unit, int *retp) | 2704 | struct file *file, int *retp) |
| 2672 | { | 2705 | { |
| 2673 | struct ppp *ppp; | 2706 | struct ppp *ppp; |
| 2674 | struct ppp_net *pn; | 2707 | struct ppp_net *pn; |
| @@ -2688,6 +2721,7 @@ ppp_create_interface(struct net *net, int unit, int *retp) | |||
| 2688 | ppp->mru = PPP_MRU; | 2721 | ppp->mru = PPP_MRU; |
| 2689 | init_ppp_file(&ppp->file, INTERFACE); | 2722 | init_ppp_file(&ppp->file, INTERFACE); |
| 2690 | ppp->file.hdrlen = PPP_HDRLEN - 2; /* don't count proto bytes */ | 2723 | ppp->file.hdrlen = PPP_HDRLEN - 2; /* don't count proto bytes */ |
| 2724 | ppp->owner = file; | ||
| 2691 | for (i = 0; i < NUM_NP; ++i) | 2725 | for (i = 0; i < NUM_NP; ++i) |
| 2692 | ppp->npmode[i] = NPMODE_PASS; | 2726 | ppp->npmode[i] = NPMODE_PASS; |
| 2693 | INIT_LIST_HEAD(&ppp->channels); | 2727 | INIT_LIST_HEAD(&ppp->channels); |
| @@ -2776,34 +2810,6 @@ init_ppp_file(struct ppp_file *pf, int kind) | |||
| 2776 | } | 2810 | } |
| 2777 | 2811 | ||
| 2778 | /* | 2812 | /* |
| 2779 | * Take down a ppp interface unit - called when the owning file | ||
| 2780 | * (the one that created the unit) is closed or detached. | ||
| 2781 | */ | ||
| 2782 | static void ppp_shutdown_interface(struct ppp *ppp) | ||
| 2783 | { | ||
| 2784 | struct ppp_net *pn; | ||
| 2785 | |||
| 2786 | pn = ppp_pernet(ppp->ppp_net); | ||
| 2787 | mutex_lock(&pn->all_ppp_mutex); | ||
| 2788 | |||
| 2789 | /* This will call dev_close() for us. */ | ||
| 2790 | ppp_lock(ppp); | ||
| 2791 | if (!ppp->closing) { | ||
| 2792 | ppp->closing = 1; | ||
| 2793 | ppp_unlock(ppp); | ||
| 2794 | unregister_netdev(ppp->dev); | ||
| 2795 | unit_put(&pn->units_idr, ppp->file.index); | ||
| 2796 | } else | ||
| 2797 | ppp_unlock(ppp); | ||
| 2798 | |||
| 2799 | ppp->file.dead = 1; | ||
| 2800 | ppp->owner = NULL; | ||
| 2801 | wake_up_interruptible(&ppp->file.rwait); | ||
| 2802 | |||
| 2803 | mutex_unlock(&pn->all_ppp_mutex); | ||
| 2804 | } | ||
| 2805 | |||
| 2806 | /* | ||
| 2807 | * Free the memory used by a ppp unit. This is only called once | 2813 | * Free the memory used by a ppp unit. This is only called once |
| 2808 | * there are no channels connected to the unit and no file structs | 2814 | * there are no channels connected to the unit and no file structs |
| 2809 | * that reference the unit. | 2815 | * that reference the unit. |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 9d43460ce3c7..64a60afbe50c 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -785,6 +785,7 @@ static const struct usb_device_id products[] = { | |||
| 785 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 785 | {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
| 786 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ | 786 | {QMI_FIXED_INTF(0x413c, 0x81a8, 8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 787 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ | 787 | {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 788 | {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ | ||
| 788 | {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ | 789 | {QMI_FIXED_INTF(0x03f0, 0x581d, 4)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Module (Huawei me906e) */ |
| 789 | 790 | ||
| 790 | /* 4. Gobi 1000 devices */ | 791 | /* 4. Gobi 1000 devices */ |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 3c86b107275a..e0498571ae26 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -778,7 +778,7 @@ int usbnet_stop (struct net_device *net) | |||
| 778 | { | 778 | { |
| 779 | struct usbnet *dev = netdev_priv(net); | 779 | struct usbnet *dev = netdev_priv(net); |
| 780 | struct driver_info *info = dev->driver_info; | 780 | struct driver_info *info = dev->driver_info; |
| 781 | int retval, pm; | 781 | int retval, pm, mpn; |
| 782 | 782 | ||
| 783 | clear_bit(EVENT_DEV_OPEN, &dev->flags); | 783 | clear_bit(EVENT_DEV_OPEN, &dev->flags); |
| 784 | netif_stop_queue (net); | 784 | netif_stop_queue (net); |
| @@ -809,6 +809,8 @@ int usbnet_stop (struct net_device *net) | |||
| 809 | 809 | ||
| 810 | usbnet_purge_paused_rxq(dev); | 810 | usbnet_purge_paused_rxq(dev); |
| 811 | 811 | ||
| 812 | mpn = !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags); | ||
| 813 | |||
| 812 | /* deferred work (task, timer, softirq) must also stop. | 814 | /* deferred work (task, timer, softirq) must also stop. |
| 813 | * can't flush_scheduled_work() until we drop rtnl (later), | 815 | * can't flush_scheduled_work() until we drop rtnl (later), |
| 814 | * else workers could deadlock; so make workers a NOP. | 816 | * else workers could deadlock; so make workers a NOP. |
| @@ -819,8 +821,7 @@ int usbnet_stop (struct net_device *net) | |||
| 819 | if (!pm) | 821 | if (!pm) |
| 820 | usb_autopm_put_interface(dev->intf); | 822 | usb_autopm_put_interface(dev->intf); |
| 821 | 823 | ||
| 822 | if (info->manage_power && | 824 | if (info->manage_power && mpn) |
| 823 | !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags)) | ||
| 824 | info->manage_power(dev, 0); | 825 | info->manage_power(dev, 0); |
| 825 | else | 826 | else |
| 826 | usb_autopm_put_interface(dev->intf); | 827 | usb_autopm_put_interface(dev->intf); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7fbca37a1adf..237f8e5e493d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -1756,9 +1756,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
| 1756 | /* Do we support "hardware" checksums? */ | 1756 | /* Do we support "hardware" checksums? */ |
| 1757 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { | 1757 | if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { |
| 1758 | /* This opens up the world of extra features. */ | 1758 | /* This opens up the world of extra features. */ |
| 1759 | dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; | 1759 | dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
| 1760 | if (csum) | 1760 | if (csum) |
| 1761 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; | 1761 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
| 1762 | 1762 | ||
| 1763 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { | 1763 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { |
| 1764 | dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO | 1764 | dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 34c519eb1db5..5bc4b1ed67b3 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -2216,6 +2216,8 @@ static int vxlan_open(struct net_device *dev) | |||
| 2216 | 2216 | ||
| 2217 | if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip)) { | 2217 | if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip)) { |
| 2218 | ret = vxlan_igmp_join(vxlan); | 2218 | ret = vxlan_igmp_join(vxlan); |
| 2219 | if (ret == -EADDRINUSE) | ||
| 2220 | ret = 0; | ||
| 2219 | if (ret) { | 2221 | if (ret) { |
| 2220 | vxlan_sock_release(vs); | 2222 | vxlan_sock_release(vs); |
| 2221 | return ret; | 2223 | return ret; |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 7193b7304fdd..848ea6a399f2 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
| @@ -589,7 +589,8 @@ static int cosa_probe(int base, int irq, int dma) | |||
| 589 | chan->netdev->base_addr = chan->cosa->datareg; | 589 | chan->netdev->base_addr = chan->cosa->datareg; |
| 590 | chan->netdev->irq = chan->cosa->irq; | 590 | chan->netdev->irq = chan->cosa->irq; |
| 591 | chan->netdev->dma = chan->cosa->dma; | 591 | chan->netdev->dma = chan->cosa->dma; |
| 592 | if (register_hdlc_device(chan->netdev)) { | 592 | err = register_hdlc_device(chan->netdev); |
| 593 | if (err) { | ||
| 593 | netdev_warn(chan->netdev, | 594 | netdev_warn(chan->netdev, |
| 594 | "register_hdlc_device() failed\n"); | 595 | "register_hdlc_device() failed\n"); |
| 595 | free_netdev(chan->netdev); | 596 | free_netdev(chan->netdev); |
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c index 25d1cbd34306..b2f0d245bcf3 100644 --- a/drivers/net/wireless/b43/tables_nphy.c +++ b/drivers/net/wireless/b43/tables_nphy.c | |||
| @@ -3728,7 +3728,7 @@ const u32 *b43_nphy_get_tx_gain_table(struct b43_wldev *dev) | |||
| 3728 | switch (phy->rev) { | 3728 | switch (phy->rev) { |
| 3729 | case 6: | 3729 | case 6: |
| 3730 | case 5: | 3730 | case 5: |
| 3731 | if (sprom->fem.ghz5.extpa_gain == 3) | 3731 | if (sprom->fem.ghz2.extpa_gain == 3) |
| 3732 | return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g; | 3732 | return b43_ntab_tx_gain_epa_rev3_hi_pwr_2g; |
| 3733 | /* fall through */ | 3733 | /* fall through */ |
| 3734 | case 4: | 3734 | case 4: |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 5000bfcded61..5514ad6d4e54 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -1023,7 +1023,7 @@ static void iwl_mvm_scan_umac_dwell(struct iwl_mvm *mvm, | |||
| 1023 | cmd->scan_priority = | 1023 | cmd->scan_priority = |
| 1024 | iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6); | 1024 | iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6); |
| 1025 | 1025 | ||
| 1026 | if (iwl_mvm_scan_total_iterations(params) == 0) | 1026 | if (iwl_mvm_scan_total_iterations(params) == 1) |
| 1027 | cmd->ooc_priority = | 1027 | cmd->ooc_priority = |
| 1028 | iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6); | 1028 | iwl_mvm_scan_priority(mvm, IWL_SCAN_PRIORITY_EXT_6); |
| 1029 | else | 1029 | else |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 6203c4ad9bba..9e144e71da0b 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
| @@ -478,10 +478,16 @@ static void iwl_pcie_apm_stop(struct iwl_trans *trans, bool op_mode_leave) | |||
| 478 | if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) | 478 | if (trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) |
| 479 | iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG, | 479 | iwl_set_bits_prph(trans, APMG_PCIDEV_STT_REG, |
| 480 | APMG_PCIDEV_STT_VAL_WAKE_ME); | 480 | APMG_PCIDEV_STT_VAL_WAKE_ME); |
| 481 | else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) | 481 | else if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) { |
| 482 | iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, | ||
| 483 | CSR_RESET_LINK_PWR_MGMT_DISABLED); | ||
| 482 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, | 484 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, |
| 483 | CSR_HW_IF_CONFIG_REG_PREPARE | | 485 | CSR_HW_IF_CONFIG_REG_PREPARE | |
| 484 | CSR_HW_IF_CONFIG_REG_ENABLE_PME); | 486 | CSR_HW_IF_CONFIG_REG_ENABLE_PME); |
| 487 | mdelay(1); | ||
| 488 | iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, | ||
| 489 | CSR_RESET_LINK_PWR_MGMT_DISABLED); | ||
| 490 | } | ||
| 485 | mdelay(5); | 491 | mdelay(5); |
| 486 | } | 492 | } |
| 487 | 493 | ||
| @@ -575,6 +581,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
| 575 | if (ret >= 0) | 581 | if (ret >= 0) |
| 576 | return 0; | 582 | return 0; |
| 577 | 583 | ||
| 584 | iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, | ||
| 585 | CSR_RESET_LINK_PWR_MGMT_DISABLED); | ||
| 586 | msleep(1); | ||
| 587 | |||
| 578 | for (iter = 0; iter < 10; iter++) { | 588 | for (iter = 0; iter < 10; iter++) { |
| 579 | /* If HW is not ready, prepare the conditions to check again */ | 589 | /* If HW is not ready, prepare the conditions to check again */ |
| 580 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, | 590 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, |
| @@ -582,8 +592,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
| 582 | 592 | ||
| 583 | do { | 593 | do { |
| 584 | ret = iwl_pcie_set_hw_ready(trans); | 594 | ret = iwl_pcie_set_hw_ready(trans); |
| 585 | if (ret >= 0) | 595 | if (ret >= 0) { |
| 586 | return 0; | 596 | ret = 0; |
| 597 | goto out; | ||
| 598 | } | ||
| 587 | 599 | ||
| 588 | usleep_range(200, 1000); | 600 | usleep_range(200, 1000); |
| 589 | t += 200; | 601 | t += 200; |
| @@ -593,6 +605,10 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
| 593 | 605 | ||
| 594 | IWL_ERR(trans, "Couldn't prepare the card\n"); | 606 | IWL_ERR(trans, "Couldn't prepare the card\n"); |
| 595 | 607 | ||
| 608 | out: | ||
| 609 | iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, | ||
| 610 | CSR_RESET_LINK_PWR_MGMT_DISABLED); | ||
| 611 | |||
| 596 | return ret; | 612 | return ret; |
| 597 | } | 613 | } |
| 598 | 614 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 2b86c2135de3..607acb53c847 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
| @@ -1875,8 +1875,19 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb, | |||
| 1875 | 1875 | ||
| 1876 | /* start timer if queue currently empty */ | 1876 | /* start timer if queue currently empty */ |
| 1877 | if (q->read_ptr == q->write_ptr) { | 1877 | if (q->read_ptr == q->write_ptr) { |
| 1878 | if (txq->wd_timeout) | 1878 | if (txq->wd_timeout) { |
| 1879 | mod_timer(&txq->stuck_timer, jiffies + txq->wd_timeout); | 1879 | /* |
| 1880 | * If the TXQ is active, then set the timer, if not, | ||
| 1881 | * set the timer in remainder so that the timer will | ||
| 1882 | * be armed with the right value when the station will | ||
| 1883 | * wake up. | ||
| 1884 | */ | ||
| 1885 | if (!txq->frozen) | ||
| 1886 | mod_timer(&txq->stuck_timer, | ||
| 1887 | jiffies + txq->wd_timeout); | ||
| 1888 | else | ||
| 1889 | txq->frozen_expiry_remainder = txq->wd_timeout; | ||
| 1890 | } | ||
| 1880 | IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id); | 1891 | IWL_DEBUG_RPM(trans, "Q: %d first tx - take ref\n", q->id); |
| 1881 | iwl_trans_pcie_ref(trans); | 1892 | iwl_trans_pcie_ref(trans); |
| 1882 | } | 1893 | } |
diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c index b6cc9ff47fc2..1c6788aecc62 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio_ops.c | |||
| @@ -172,6 +172,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
| 172 | (struct rsi_91x_sdiodev *)adapter->rsi_dev; | 172 | (struct rsi_91x_sdiodev *)adapter->rsi_dev; |
| 173 | u32 len; | 173 | u32 len; |
| 174 | u32 num_blocks; | 174 | u32 num_blocks; |
| 175 | const u8 *fw; | ||
| 175 | const struct firmware *fw_entry = NULL; | 176 | const struct firmware *fw_entry = NULL; |
| 176 | u32 block_size = dev->tx_blk_size; | 177 | u32 block_size = dev->tx_blk_size; |
| 177 | int status = 0; | 178 | int status = 0; |
| @@ -200,6 +201,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
| 200 | return status; | 201 | return status; |
| 201 | } | 202 | } |
| 202 | 203 | ||
| 204 | /* Copy firmware into DMA-accessible memory */ | ||
| 205 | fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); | ||
| 206 | if (!fw) | ||
| 207 | return -ENOMEM; | ||
| 203 | len = fw_entry->size; | 208 | len = fw_entry->size; |
| 204 | 209 | ||
| 205 | if (len % 4) | 210 | if (len % 4) |
| @@ -210,7 +215,8 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
| 210 | rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len); | 215 | rsi_dbg(INIT_ZONE, "%s: Instruction size:%d\n", __func__, len); |
| 211 | rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); | 216 | rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); |
| 212 | 217 | ||
| 213 | status = rsi_copy_to_card(common, fw_entry->data, len, num_blocks); | 218 | status = rsi_copy_to_card(common, fw, len, num_blocks); |
| 219 | kfree(fw); | ||
| 214 | release_firmware(fw_entry); | 220 | release_firmware(fw_entry); |
| 215 | return status; | 221 | return status; |
| 216 | } | 222 | } |
diff --git a/drivers/net/wireless/rsi/rsi_91x_usb_ops.c b/drivers/net/wireless/rsi/rsi_91x_usb_ops.c index 1106ce76707e..30c2cf7fa93b 100644 --- a/drivers/net/wireless/rsi/rsi_91x_usb_ops.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb_ops.c | |||
| @@ -146,7 +146,10 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
| 146 | return status; | 146 | return status; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /* Copy firmware into DMA-accessible memory */ | ||
| 149 | fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); | 150 | fw = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); |
| 151 | if (!fw) | ||
| 152 | return -ENOMEM; | ||
| 150 | len = fw_entry->size; | 153 | len = fw_entry->size; |
| 151 | 154 | ||
| 152 | if (len % 4) | 155 | if (len % 4) |
| @@ -158,6 +161,7 @@ static int rsi_load_ta_instructions(struct rsi_common *common) | |||
| 158 | rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); | 161 | rsi_dbg(INIT_ZONE, "%s: num blocks: %d\n", __func__, num_blocks); |
| 159 | 162 | ||
| 160 | status = rsi_copy_to_card(common, fw, len, num_blocks); | 163 | status = rsi_copy_to_card(common, fw, len, num_blocks); |
| 164 | kfree(fw); | ||
| 161 | release_firmware(fw_entry); | 165 | release_firmware(fw_entry); |
| 162 | return status; | 166 | return status; |
| 163 | } | 167 | } |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index 3b3a88b53b11..585d0883c7e5 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
| @@ -1015,9 +1015,12 @@ static void send_beacon_frame(struct ieee80211_hw *hw, | |||
| 1015 | { | 1015 | { |
| 1016 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1016 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 1017 | struct sk_buff *skb = ieee80211_beacon_get(hw, vif); | 1017 | struct sk_buff *skb = ieee80211_beacon_get(hw, vif); |
| 1018 | struct rtl_tcb_desc tcb_desc; | ||
| 1018 | 1019 | ||
| 1019 | if (skb) | 1020 | if (skb) { |
| 1020 | rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL); | 1021 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); |
| 1022 | rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, &tcb_desc); | ||
| 1023 | } | ||
| 1021 | } | 1024 | } |
| 1022 | 1025 | ||
| 1023 | static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, | 1026 | static void rtl_op_bss_info_changed(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c index 1017f02d7bf7..7bf88d9dcdc3 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723be/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723be/sw.c | |||
| @@ -385,6 +385,7 @@ module_param_named(debug, rtl8723be_mod_params.debug, int, 0444); | |||
| 385 | module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); | 385 | module_param_named(ips, rtl8723be_mod_params.inactiveps, bool, 0444); |
| 386 | module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); | 386 | module_param_named(swlps, rtl8723be_mod_params.swctrl_lps, bool, 0444); |
| 387 | module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); | 387 | module_param_named(fwlps, rtl8723be_mod_params.fwctrl_lps, bool, 0444); |
| 388 | module_param_named(msi, rtl8723be_mod_params.msi_support, bool, 0444); | ||
| 388 | module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog, | 389 | module_param_named(disable_watchdog, rtl8723be_mod_params.disable_watchdog, |
| 389 | bool, 0444); | 390 | bool, 0444); |
| 390 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); | 391 | MODULE_PARM_DESC(swenc, "Set to 1 for software crypto (default 0)\n"); |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index 1a83e190fc15..28577a31549d 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
| @@ -61,6 +61,12 @@ void xenvif_skb_zerocopy_prepare(struct xenvif_queue *queue, | |||
| 61 | void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue) | 61 | void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue) |
| 62 | { | 62 | { |
| 63 | atomic_dec(&queue->inflight_packets); | 63 | atomic_dec(&queue->inflight_packets); |
| 64 | |||
| 65 | /* Wake the dealloc thread _after_ decrementing inflight_packets so | ||
| 66 | * that if kthread_stop() has already been called, the dealloc thread | ||
| 67 | * does not wait forever with nothing to wake it. | ||
| 68 | */ | ||
| 69 | wake_up(&queue->dealloc_wq); | ||
| 64 | } | 70 | } |
| 65 | 71 | ||
| 66 | int xenvif_schedulable(struct xenvif *vif) | 72 | int xenvif_schedulable(struct xenvif *vif) |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 7d50711476fe..3f44b522b831 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -810,23 +810,17 @@ static inline struct sk_buff *xenvif_alloc_skb(unsigned int size) | |||
| 810 | static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue, | 810 | static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *queue, |
| 811 | struct sk_buff *skb, | 811 | struct sk_buff *skb, |
| 812 | struct xen_netif_tx_request *txp, | 812 | struct xen_netif_tx_request *txp, |
| 813 | struct gnttab_map_grant_ref *gop) | 813 | struct gnttab_map_grant_ref *gop, |
| 814 | unsigned int frag_overflow, | ||
| 815 | struct sk_buff *nskb) | ||
| 814 | { | 816 | { |
| 815 | struct skb_shared_info *shinfo = skb_shinfo(skb); | 817 | struct skb_shared_info *shinfo = skb_shinfo(skb); |
| 816 | skb_frag_t *frags = shinfo->frags; | 818 | skb_frag_t *frags = shinfo->frags; |
| 817 | u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; | 819 | u16 pending_idx = XENVIF_TX_CB(skb)->pending_idx; |
| 818 | int start; | 820 | int start; |
| 819 | pending_ring_idx_t index; | 821 | pending_ring_idx_t index; |
| 820 | unsigned int nr_slots, frag_overflow = 0; | 822 | unsigned int nr_slots; |
| 821 | 823 | ||
| 822 | /* At this point shinfo->nr_frags is in fact the number of | ||
| 823 | * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. | ||
| 824 | */ | ||
| 825 | if (shinfo->nr_frags > MAX_SKB_FRAGS) { | ||
| 826 | frag_overflow = shinfo->nr_frags - MAX_SKB_FRAGS; | ||
| 827 | BUG_ON(frag_overflow > MAX_SKB_FRAGS); | ||
| 828 | shinfo->nr_frags = MAX_SKB_FRAGS; | ||
| 829 | } | ||
| 830 | nr_slots = shinfo->nr_frags; | 824 | nr_slots = shinfo->nr_frags; |
| 831 | 825 | ||
| 832 | /* Skip first skb fragment if it is on same page as header fragment. */ | 826 | /* Skip first skb fragment if it is on same page as header fragment. */ |
| @@ -841,13 +835,6 @@ static struct gnttab_map_grant_ref *xenvif_get_requests(struct xenvif_queue *que | |||
| 841 | } | 835 | } |
| 842 | 836 | ||
| 843 | if (frag_overflow) { | 837 | if (frag_overflow) { |
| 844 | struct sk_buff *nskb = xenvif_alloc_skb(0); | ||
| 845 | if (unlikely(nskb == NULL)) { | ||
| 846 | if (net_ratelimit()) | ||
| 847 | netdev_err(queue->vif->dev, | ||
| 848 | "Can't allocate the frag_list skb.\n"); | ||
| 849 | return NULL; | ||
| 850 | } | ||
| 851 | 838 | ||
| 852 | shinfo = skb_shinfo(nskb); | 839 | shinfo = skb_shinfo(nskb); |
| 853 | frags = shinfo->frags; | 840 | frags = shinfo->frags; |
| @@ -1175,9 +1162,10 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, | |||
| 1175 | unsigned *copy_ops, | 1162 | unsigned *copy_ops, |
| 1176 | unsigned *map_ops) | 1163 | unsigned *map_ops) |
| 1177 | { | 1164 | { |
| 1178 | struct gnttab_map_grant_ref *gop = queue->tx_map_ops, *request_gop; | 1165 | struct gnttab_map_grant_ref *gop = queue->tx_map_ops; |
| 1179 | struct sk_buff *skb; | 1166 | struct sk_buff *skb, *nskb; |
| 1180 | int ret; | 1167 | int ret; |
| 1168 | unsigned int frag_overflow; | ||
| 1181 | 1169 | ||
| 1182 | while (skb_queue_len(&queue->tx_queue) < budget) { | 1170 | while (skb_queue_len(&queue->tx_queue) < budget) { |
| 1183 | struct xen_netif_tx_request txreq; | 1171 | struct xen_netif_tx_request txreq; |
| @@ -1265,6 +1253,29 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, | |||
| 1265 | break; | 1253 | break; |
| 1266 | } | 1254 | } |
| 1267 | 1255 | ||
| 1256 | skb_shinfo(skb)->nr_frags = ret; | ||
| 1257 | if (data_len < txreq.size) | ||
| 1258 | skb_shinfo(skb)->nr_frags++; | ||
| 1259 | /* At this point shinfo->nr_frags is in fact the number of | ||
| 1260 | * slots, which can be as large as XEN_NETBK_LEGACY_SLOTS_MAX. | ||
| 1261 | */ | ||
| 1262 | frag_overflow = 0; | ||
| 1263 | nskb = NULL; | ||
| 1264 | if (skb_shinfo(skb)->nr_frags > MAX_SKB_FRAGS) { | ||
| 1265 | frag_overflow = skb_shinfo(skb)->nr_frags - MAX_SKB_FRAGS; | ||
| 1266 | BUG_ON(frag_overflow > MAX_SKB_FRAGS); | ||
| 1267 | skb_shinfo(skb)->nr_frags = MAX_SKB_FRAGS; | ||
| 1268 | nskb = xenvif_alloc_skb(0); | ||
| 1269 | if (unlikely(nskb == NULL)) { | ||
| 1270 | kfree_skb(skb); | ||
| 1271 | xenvif_tx_err(queue, &txreq, idx); | ||
| 1272 | if (net_ratelimit()) | ||
| 1273 | netdev_err(queue->vif->dev, | ||
| 1274 | "Can't allocate the frag_list skb.\n"); | ||
| 1275 | break; | ||
| 1276 | } | ||
| 1277 | } | ||
| 1278 | |||
| 1268 | if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) { | 1279 | if (extras[XEN_NETIF_EXTRA_TYPE_GSO - 1].type) { |
| 1269 | struct xen_netif_extra_info *gso; | 1280 | struct xen_netif_extra_info *gso; |
| 1270 | gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; | 1281 | gso = &extras[XEN_NETIF_EXTRA_TYPE_GSO - 1]; |
| @@ -1272,6 +1283,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, | |||
| 1272 | if (xenvif_set_skb_gso(queue->vif, skb, gso)) { | 1283 | if (xenvif_set_skb_gso(queue->vif, skb, gso)) { |
| 1273 | /* Failure in xenvif_set_skb_gso is fatal. */ | 1284 | /* Failure in xenvif_set_skb_gso is fatal. */ |
| 1274 | kfree_skb(skb); | 1285 | kfree_skb(skb); |
| 1286 | kfree_skb(nskb); | ||
| 1275 | break; | 1287 | break; |
| 1276 | } | 1288 | } |
| 1277 | } | 1289 | } |
| @@ -1294,9 +1306,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, | |||
| 1294 | 1306 | ||
| 1295 | (*copy_ops)++; | 1307 | (*copy_ops)++; |
| 1296 | 1308 | ||
| 1297 | skb_shinfo(skb)->nr_frags = ret; | ||
| 1298 | if (data_len < txreq.size) { | 1309 | if (data_len < txreq.size) { |
| 1299 | skb_shinfo(skb)->nr_frags++; | ||
| 1300 | frag_set_pending_idx(&skb_shinfo(skb)->frags[0], | 1310 | frag_set_pending_idx(&skb_shinfo(skb)->frags[0], |
| 1301 | pending_idx); | 1311 | pending_idx); |
| 1302 | xenvif_tx_create_map_op(queue, pending_idx, &txreq, gop); | 1312 | xenvif_tx_create_map_op(queue, pending_idx, &txreq, gop); |
| @@ -1310,13 +1320,8 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, | |||
| 1310 | 1320 | ||
| 1311 | queue->pending_cons++; | 1321 | queue->pending_cons++; |
| 1312 | 1322 | ||
| 1313 | request_gop = xenvif_get_requests(queue, skb, txfrags, gop); | 1323 | gop = xenvif_get_requests(queue, skb, txfrags, gop, |
| 1314 | if (request_gop == NULL) { | 1324 | frag_overflow, nskb); |
| 1315 | kfree_skb(skb); | ||
| 1316 | xenvif_tx_err(queue, &txreq, idx); | ||
| 1317 | break; | ||
| 1318 | } | ||
| 1319 | gop = request_gop; | ||
| 1320 | 1325 | ||
| 1321 | __skb_queue_tail(&queue->tx_queue, skb); | 1326 | __skb_queue_tail(&queue->tx_queue, skb); |
| 1322 | 1327 | ||
| @@ -1536,7 +1541,6 @@ void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success) | |||
| 1536 | smp_wmb(); | 1541 | smp_wmb(); |
| 1537 | queue->dealloc_prod++; | 1542 | queue->dealloc_prod++; |
| 1538 | } while (ubuf); | 1543 | } while (ubuf); |
| 1539 | wake_up(&queue->dealloc_wq); | ||
| 1540 | spin_unlock_irqrestore(&queue->callback_lock, flags); | 1544 | spin_unlock_irqrestore(&queue->callback_lock, flags); |
| 1541 | 1545 | ||
| 1542 | if (likely(zerocopy_success)) | 1546 | if (likely(zerocopy_success)) |
diff --git a/drivers/ntb/ntb.c b/drivers/ntb/ntb.c index 23435f2a5486..2e2530743831 100644 --- a/drivers/ntb/ntb.c +++ b/drivers/ntb/ntb.c | |||
| @@ -114,7 +114,7 @@ int ntb_register_device(struct ntb_dev *ntb) | |||
| 114 | ntb->dev.bus = &ntb_bus; | 114 | ntb->dev.bus = &ntb_bus; |
| 115 | ntb->dev.parent = &ntb->pdev->dev; | 115 | ntb->dev.parent = &ntb->pdev->dev; |
| 116 | ntb->dev.release = ntb_dev_release; | 116 | ntb->dev.release = ntb_dev_release; |
| 117 | dev_set_name(&ntb->dev, pci_name(ntb->pdev)); | 117 | dev_set_name(&ntb->dev, "%s", pci_name(ntb->pdev)); |
| 118 | 118 | ||
| 119 | ntb->ctx = NULL; | 119 | ntb->ctx = NULL; |
| 120 | ntb->ctx_ops = NULL; | 120 | ntb->ctx_ops = NULL; |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index efe3ad4122f2..1c6386d5f79c 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
| @@ -142,10 +142,11 @@ struct ntb_transport_qp { | |||
| 142 | 142 | ||
| 143 | void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data, | 143 | void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data, |
| 144 | void *data, int len); | 144 | void *data, int len); |
| 145 | struct list_head rx_post_q; | ||
| 145 | struct list_head rx_pend_q; | 146 | struct list_head rx_pend_q; |
| 146 | struct list_head rx_free_q; | 147 | struct list_head rx_free_q; |
| 147 | spinlock_t ntb_rx_pend_q_lock; | 148 | /* ntb_rx_q_lock: synchronize access to rx_XXXX_q */ |
| 148 | spinlock_t ntb_rx_free_q_lock; | 149 | spinlock_t ntb_rx_q_lock; |
| 149 | void *rx_buff; | 150 | void *rx_buff; |
| 150 | unsigned int rx_index; | 151 | unsigned int rx_index; |
| 151 | unsigned int rx_max_entry; | 152 | unsigned int rx_max_entry; |
| @@ -211,6 +212,8 @@ struct ntb_transport_ctx { | |||
| 211 | bool link_is_up; | 212 | bool link_is_up; |
| 212 | struct delayed_work link_work; | 213 | struct delayed_work link_work; |
| 213 | struct work_struct link_cleanup; | 214 | struct work_struct link_cleanup; |
| 215 | |||
| 216 | struct dentry *debugfs_node_dir; | ||
| 214 | }; | 217 | }; |
| 215 | 218 | ||
| 216 | enum { | 219 | enum { |
| @@ -436,13 +439,17 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count, | |||
| 436 | char *buf; | 439 | char *buf; |
| 437 | ssize_t ret, out_offset, out_count; | 440 | ssize_t ret, out_offset, out_count; |
| 438 | 441 | ||
| 442 | qp = filp->private_data; | ||
| 443 | |||
| 444 | if (!qp || !qp->link_is_up) | ||
| 445 | return 0; | ||
| 446 | |||
| 439 | out_count = 1000; | 447 | out_count = 1000; |
| 440 | 448 | ||
| 441 | buf = kmalloc(out_count, GFP_KERNEL); | 449 | buf = kmalloc(out_count, GFP_KERNEL); |
| 442 | if (!buf) | 450 | if (!buf) |
| 443 | return -ENOMEM; | 451 | return -ENOMEM; |
| 444 | 452 | ||
| 445 | qp = filp->private_data; | ||
| 446 | out_offset = 0; | 453 | out_offset = 0; |
| 447 | out_offset += snprintf(buf + out_offset, out_count - out_offset, | 454 | out_offset += snprintf(buf + out_offset, out_count - out_offset, |
| 448 | "NTB QP stats\n"); | 455 | "NTB QP stats\n"); |
| @@ -534,6 +541,27 @@ out: | |||
| 534 | return entry; | 541 | return entry; |
| 535 | } | 542 | } |
| 536 | 543 | ||
| 544 | static struct ntb_queue_entry *ntb_list_mv(spinlock_t *lock, | ||
| 545 | struct list_head *list, | ||
| 546 | struct list_head *to_list) | ||
| 547 | { | ||
| 548 | struct ntb_queue_entry *entry; | ||
| 549 | unsigned long flags; | ||
| 550 | |||
| 551 | spin_lock_irqsave(lock, flags); | ||
| 552 | |||
| 553 | if (list_empty(list)) { | ||
| 554 | entry = NULL; | ||
| 555 | } else { | ||
| 556 | entry = list_first_entry(list, struct ntb_queue_entry, entry); | ||
| 557 | list_move_tail(&entry->entry, to_list); | ||
| 558 | } | ||
| 559 | |||
| 560 | spin_unlock_irqrestore(lock, flags); | ||
| 561 | |||
| 562 | return entry; | ||
| 563 | } | ||
| 564 | |||
| 537 | static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt, | 565 | static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt, |
| 538 | unsigned int qp_num) | 566 | unsigned int qp_num) |
| 539 | { | 567 | { |
| @@ -601,13 +629,16 @@ static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw) | |||
| 601 | } | 629 | } |
| 602 | 630 | ||
| 603 | static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, | 631 | static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, |
| 604 | unsigned int size) | 632 | resource_size_t size) |
| 605 | { | 633 | { |
| 606 | struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; | 634 | struct ntb_transport_mw *mw = &nt->mw_vec[num_mw]; |
| 607 | struct pci_dev *pdev = nt->ndev->pdev; | 635 | struct pci_dev *pdev = nt->ndev->pdev; |
| 608 | unsigned int xlat_size, buff_size; | 636 | size_t xlat_size, buff_size; |
| 609 | int rc; | 637 | int rc; |
| 610 | 638 | ||
| 639 | if (!size) | ||
| 640 | return -EINVAL; | ||
| 641 | |||
| 611 | xlat_size = round_up(size, mw->xlat_align_size); | 642 | xlat_size = round_up(size, mw->xlat_align_size); |
| 612 | buff_size = round_up(size, mw->xlat_align); | 643 | buff_size = round_up(size, mw->xlat_align); |
| 613 | 644 | ||
| @@ -627,7 +658,7 @@ static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw, | |||
| 627 | if (!mw->virt_addr) { | 658 | if (!mw->virt_addr) { |
| 628 | mw->xlat_size = 0; | 659 | mw->xlat_size = 0; |
| 629 | mw->buff_size = 0; | 660 | mw->buff_size = 0; |
| 630 | dev_err(&pdev->dev, "Unable to alloc MW buff of size %d\n", | 661 | dev_err(&pdev->dev, "Unable to alloc MW buff of size %zu\n", |
| 631 | buff_size); | 662 | buff_size); |
| 632 | return -ENOMEM; | 663 | return -ENOMEM; |
| 633 | } | 664 | } |
| @@ -867,6 +898,8 @@ static void ntb_qp_link_work(struct work_struct *work) | |||
| 867 | 898 | ||
| 868 | if (qp->event_handler) | 899 | if (qp->event_handler) |
| 869 | qp->event_handler(qp->cb_data, qp->link_is_up); | 900 | qp->event_handler(qp->cb_data, qp->link_is_up); |
| 901 | |||
| 902 | tasklet_schedule(&qp->rxc_db_work); | ||
| 870 | } else if (nt->link_is_up) | 903 | } else if (nt->link_is_up) |
| 871 | schedule_delayed_work(&qp->link_work, | 904 | schedule_delayed_work(&qp->link_work, |
| 872 | msecs_to_jiffies(NTB_LINK_DOWN_TIMEOUT)); | 905 | msecs_to_jiffies(NTB_LINK_DOWN_TIMEOUT)); |
| @@ -923,12 +956,12 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, | |||
| 923 | qp->tx_max_frame = min(transport_mtu, tx_size / 2); | 956 | qp->tx_max_frame = min(transport_mtu, tx_size / 2); |
| 924 | qp->tx_max_entry = tx_size / qp->tx_max_frame; | 957 | qp->tx_max_entry = tx_size / qp->tx_max_frame; |
| 925 | 958 | ||
| 926 | if (nt_debugfs_dir) { | 959 | if (nt->debugfs_node_dir) { |
| 927 | char debugfs_name[4]; | 960 | char debugfs_name[4]; |
| 928 | 961 | ||
| 929 | snprintf(debugfs_name, 4, "qp%d", qp_num); | 962 | snprintf(debugfs_name, 4, "qp%d", qp_num); |
| 930 | qp->debugfs_dir = debugfs_create_dir(debugfs_name, | 963 | qp->debugfs_dir = debugfs_create_dir(debugfs_name, |
| 931 | nt_debugfs_dir); | 964 | nt->debugfs_node_dir); |
| 932 | 965 | ||
| 933 | qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR, | 966 | qp->debugfs_stats = debugfs_create_file("stats", S_IRUSR, |
| 934 | qp->debugfs_dir, qp, | 967 | qp->debugfs_dir, qp, |
| @@ -941,10 +974,10 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, | |||
| 941 | INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work); | 974 | INIT_DELAYED_WORK(&qp->link_work, ntb_qp_link_work); |
| 942 | INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work); | 975 | INIT_WORK(&qp->link_cleanup, ntb_qp_link_cleanup_work); |
| 943 | 976 | ||
| 944 | spin_lock_init(&qp->ntb_rx_pend_q_lock); | 977 | spin_lock_init(&qp->ntb_rx_q_lock); |
| 945 | spin_lock_init(&qp->ntb_rx_free_q_lock); | ||
| 946 | spin_lock_init(&qp->ntb_tx_free_q_lock); | 978 | spin_lock_init(&qp->ntb_tx_free_q_lock); |
| 947 | 979 | ||
| 980 | INIT_LIST_HEAD(&qp->rx_post_q); | ||
| 948 | INIT_LIST_HEAD(&qp->rx_pend_q); | 981 | INIT_LIST_HEAD(&qp->rx_pend_q); |
| 949 | INIT_LIST_HEAD(&qp->rx_free_q); | 982 | INIT_LIST_HEAD(&qp->rx_free_q); |
| 950 | INIT_LIST_HEAD(&qp->tx_free_q); | 983 | INIT_LIST_HEAD(&qp->tx_free_q); |
| @@ -1031,6 +1064,12 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev) | |||
| 1031 | goto err2; | 1064 | goto err2; |
| 1032 | } | 1065 | } |
| 1033 | 1066 | ||
| 1067 | if (nt_debugfs_dir) { | ||
| 1068 | nt->debugfs_node_dir = | ||
| 1069 | debugfs_create_dir(pci_name(ndev->pdev), | ||
| 1070 | nt_debugfs_dir); | ||
| 1071 | } | ||
| 1072 | |||
| 1034 | for (i = 0; i < qp_count; i++) { | 1073 | for (i = 0; i < qp_count; i++) { |
| 1035 | rc = ntb_transport_init_queue(nt, i); | 1074 | rc = ntb_transport_init_queue(nt, i); |
| 1036 | if (rc) | 1075 | if (rc) |
| @@ -1107,22 +1146,47 @@ static void ntb_transport_free(struct ntb_client *self, struct ntb_dev *ndev) | |||
| 1107 | kfree(nt); | 1146 | kfree(nt); |
| 1108 | } | 1147 | } |
| 1109 | 1148 | ||
| 1110 | static void ntb_rx_copy_callback(void *data) | 1149 | static void ntb_complete_rxc(struct ntb_transport_qp *qp) |
| 1111 | { | 1150 | { |
| 1112 | struct ntb_queue_entry *entry = data; | 1151 | struct ntb_queue_entry *entry; |
| 1113 | struct ntb_transport_qp *qp = entry->qp; | 1152 | void *cb_data; |
| 1114 | void *cb_data = entry->cb_data; | 1153 | unsigned int len; |
| 1115 | unsigned int len = entry->len; | 1154 | unsigned long irqflags; |
| 1116 | struct ntb_payload_header *hdr = entry->rx_hdr; | 1155 | |
| 1156 | spin_lock_irqsave(&qp->ntb_rx_q_lock, irqflags); | ||
| 1157 | |||
| 1158 | while (!list_empty(&qp->rx_post_q)) { | ||
| 1159 | entry = list_first_entry(&qp->rx_post_q, | ||
| 1160 | struct ntb_queue_entry, entry); | ||
| 1161 | if (!(entry->flags & DESC_DONE_FLAG)) | ||
| 1162 | break; | ||
| 1163 | |||
| 1164 | entry->rx_hdr->flags = 0; | ||
| 1165 | iowrite32(entry->index, &qp->rx_info->entry); | ||
| 1117 | 1166 | ||
| 1118 | hdr->flags = 0; | 1167 | cb_data = entry->cb_data; |
| 1168 | len = entry->len; | ||
| 1119 | 1169 | ||
| 1120 | iowrite32(entry->index, &qp->rx_info->entry); | 1170 | list_move_tail(&entry->entry, &qp->rx_free_q); |
| 1121 | 1171 | ||
| 1122 | ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q); | 1172 | spin_unlock_irqrestore(&qp->ntb_rx_q_lock, irqflags); |
| 1123 | 1173 | ||
| 1124 | if (qp->rx_handler && qp->client_ready) | 1174 | if (qp->rx_handler && qp->client_ready) |
| 1125 | qp->rx_handler(qp, qp->cb_data, cb_data, len); | 1175 | qp->rx_handler(qp, qp->cb_data, cb_data, len); |
| 1176 | |||
| 1177 | spin_lock_irqsave(&qp->ntb_rx_q_lock, irqflags); | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | spin_unlock_irqrestore(&qp->ntb_rx_q_lock, irqflags); | ||
| 1181 | } | ||
| 1182 | |||
| 1183 | static void ntb_rx_copy_callback(void *data) | ||
| 1184 | { | ||
| 1185 | struct ntb_queue_entry *entry = data; | ||
| 1186 | |||
| 1187 | entry->flags |= DESC_DONE_FLAG; | ||
| 1188 | |||
| 1189 | ntb_complete_rxc(entry->qp); | ||
| 1126 | } | 1190 | } |
| 1127 | 1191 | ||
| 1128 | static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset) | 1192 | static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset) |
| @@ -1138,19 +1202,18 @@ static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset) | |||
| 1138 | ntb_rx_copy_callback(entry); | 1202 | ntb_rx_copy_callback(entry); |
| 1139 | } | 1203 | } |
| 1140 | 1204 | ||
| 1141 | static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset, | 1205 | static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset) |
| 1142 | size_t len) | ||
| 1143 | { | 1206 | { |
| 1144 | struct dma_async_tx_descriptor *txd; | 1207 | struct dma_async_tx_descriptor *txd; |
| 1145 | struct ntb_transport_qp *qp = entry->qp; | 1208 | struct ntb_transport_qp *qp = entry->qp; |
| 1146 | struct dma_chan *chan = qp->dma_chan; | 1209 | struct dma_chan *chan = qp->dma_chan; |
| 1147 | struct dma_device *device; | 1210 | struct dma_device *device; |
| 1148 | size_t pay_off, buff_off; | 1211 | size_t pay_off, buff_off, len; |
| 1149 | struct dmaengine_unmap_data *unmap; | 1212 | struct dmaengine_unmap_data *unmap; |
| 1150 | dma_cookie_t cookie; | 1213 | dma_cookie_t cookie; |
| 1151 | void *buf = entry->buf; | 1214 | void *buf = entry->buf; |
| 1152 | 1215 | ||
| 1153 | entry->len = len; | 1216 | len = entry->len; |
| 1154 | 1217 | ||
| 1155 | if (!chan) | 1218 | if (!chan) |
| 1156 | goto err; | 1219 | goto err; |
| @@ -1226,7 +1289,6 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp) | |||
| 1226 | struct ntb_payload_header *hdr; | 1289 | struct ntb_payload_header *hdr; |
| 1227 | struct ntb_queue_entry *entry; | 1290 | struct ntb_queue_entry *entry; |
| 1228 | void *offset; | 1291 | void *offset; |
| 1229 | int rc; | ||
| 1230 | 1292 | ||
| 1231 | offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index; | 1293 | offset = qp->rx_buff + qp->rx_max_frame * qp->rx_index; |
| 1232 | hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header); | 1294 | hdr = offset + qp->rx_max_frame - sizeof(struct ntb_payload_header); |
| @@ -1255,65 +1317,43 @@ static int ntb_process_rxc(struct ntb_transport_qp *qp) | |||
| 1255 | return -EIO; | 1317 | return -EIO; |
| 1256 | } | 1318 | } |
| 1257 | 1319 | ||
| 1258 | entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q); | 1320 | entry = ntb_list_mv(&qp->ntb_rx_q_lock, &qp->rx_pend_q, &qp->rx_post_q); |
| 1259 | if (!entry) { | 1321 | if (!entry) { |
| 1260 | dev_dbg(&qp->ndev->pdev->dev, "no receive buffer\n"); | 1322 | dev_dbg(&qp->ndev->pdev->dev, "no receive buffer\n"); |
| 1261 | qp->rx_err_no_buf++; | 1323 | qp->rx_err_no_buf++; |
| 1262 | 1324 | return -EAGAIN; | |
| 1263 | rc = -ENOMEM; | ||
| 1264 | goto err; | ||
| 1265 | } | 1325 | } |
| 1266 | 1326 | ||
| 1327 | entry->rx_hdr = hdr; | ||
| 1328 | entry->index = qp->rx_index; | ||
| 1329 | |||
| 1267 | if (hdr->len > entry->len) { | 1330 | if (hdr->len > entry->len) { |
| 1268 | dev_dbg(&qp->ndev->pdev->dev, | 1331 | dev_dbg(&qp->ndev->pdev->dev, |
| 1269 | "receive buffer overflow! Wanted %d got %d\n", | 1332 | "receive buffer overflow! Wanted %d got %d\n", |
| 1270 | hdr->len, entry->len); | 1333 | hdr->len, entry->len); |
| 1271 | qp->rx_err_oflow++; | 1334 | qp->rx_err_oflow++; |
| 1272 | 1335 | ||
| 1273 | rc = -EIO; | 1336 | entry->len = -EIO; |
| 1274 | goto err; | 1337 | entry->flags |= DESC_DONE_FLAG; |
| 1275 | } | ||
| 1276 | 1338 | ||
| 1277 | dev_dbg(&qp->ndev->pdev->dev, | 1339 | ntb_complete_rxc(qp); |
| 1278 | "RX OK index %u ver %u size %d into buf size %d\n", | 1340 | } else { |
| 1279 | qp->rx_index, hdr->ver, hdr->len, entry->len); | 1341 | dev_dbg(&qp->ndev->pdev->dev, |
| 1342 | "RX OK index %u ver %u size %d into buf size %d\n", | ||
| 1343 | qp->rx_index, hdr->ver, hdr->len, entry->len); | ||
| 1280 | 1344 | ||
| 1281 | qp->rx_bytes += hdr->len; | 1345 | qp->rx_bytes += hdr->len; |
| 1282 | qp->rx_pkts++; | 1346 | qp->rx_pkts++; |
| 1283 | 1347 | ||
| 1284 | entry->index = qp->rx_index; | 1348 | entry->len = hdr->len; |
| 1285 | entry->rx_hdr = hdr; | ||
| 1286 | 1349 | ||
| 1287 | ntb_async_rx(entry, offset, hdr->len); | 1350 | ntb_async_rx(entry, offset); |
| 1351 | } | ||
| 1288 | 1352 | ||
| 1289 | qp->rx_index++; | 1353 | qp->rx_index++; |
| 1290 | qp->rx_index %= qp->rx_max_entry; | 1354 | qp->rx_index %= qp->rx_max_entry; |
| 1291 | 1355 | ||
| 1292 | return 0; | 1356 | return 0; |
| 1293 | |||
| 1294 | err: | ||
| 1295 | /* FIXME: if this syncrhonous update of the rx_index gets ahead of | ||
| 1296 | * asyncrhonous ntb_rx_copy_callback of previous entry, there are three | ||
| 1297 | * scenarios: | ||
| 1298 | * | ||
| 1299 | * 1) The peer might miss this update, but observe the update | ||
| 1300 | * from the memcpy completion callback. In this case, the buffer will | ||
| 1301 | * not be freed on the peer to be reused for a different packet. The | ||
| 1302 | * successful rx of a later packet would clear the condition, but the | ||
| 1303 | * condition could persist if several rx fail in a row. | ||
| 1304 | * | ||
| 1305 | * 2) The peer may observe this update before the asyncrhonous copy of | ||
| 1306 | * prior packets is completed. The peer may overwrite the buffers of | ||
| 1307 | * the prior packets before they are copied. | ||
| 1308 | * | ||
| 1309 | * 3) Both: the peer may observe the update, and then observe the index | ||
| 1310 | * decrement by the asynchronous completion callback. Who knows what | ||
| 1311 | * badness that will cause. | ||
| 1312 | */ | ||
| 1313 | hdr->flags = 0; | ||
| 1314 | iowrite32(qp->rx_index, &qp->rx_info->entry); | ||
| 1315 | |||
| 1316 | return rc; | ||
| 1317 | } | 1357 | } |
| 1318 | 1358 | ||
| 1319 | static void ntb_transport_rxc_db(unsigned long data) | 1359 | static void ntb_transport_rxc_db(unsigned long data) |
| @@ -1333,7 +1373,7 @@ static void ntb_transport_rxc_db(unsigned long data) | |||
| 1333 | break; | 1373 | break; |
| 1334 | } | 1374 | } |
| 1335 | 1375 | ||
| 1336 | if (qp->dma_chan) | 1376 | if (i && qp->dma_chan) |
| 1337 | dma_async_issue_pending(qp->dma_chan); | 1377 | dma_async_issue_pending(qp->dma_chan); |
| 1338 | 1378 | ||
| 1339 | if (i == qp->rx_max_entry) { | 1379 | if (i == qp->rx_max_entry) { |
| @@ -1609,7 +1649,7 @@ ntb_transport_create_queue(void *data, struct device *client_dev, | |||
| 1609 | goto err1; | 1649 | goto err1; |
| 1610 | 1650 | ||
| 1611 | entry->qp = qp; | 1651 | entry->qp = qp; |
| 1612 | ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, | 1652 | ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, |
| 1613 | &qp->rx_free_q); | 1653 | &qp->rx_free_q); |
| 1614 | } | 1654 | } |
| 1615 | 1655 | ||
| @@ -1634,7 +1674,7 @@ err2: | |||
| 1634 | while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q))) | 1674 | while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q))) |
| 1635 | kfree(entry); | 1675 | kfree(entry); |
| 1636 | err1: | 1676 | err1: |
| 1637 | while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q))) | 1677 | while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q))) |
| 1638 | kfree(entry); | 1678 | kfree(entry); |
| 1639 | if (qp->dma_chan) | 1679 | if (qp->dma_chan) |
| 1640 | dma_release_channel(qp->dma_chan); | 1680 | dma_release_channel(qp->dma_chan); |
| @@ -1652,7 +1692,6 @@ EXPORT_SYMBOL_GPL(ntb_transport_create_queue); | |||
| 1652 | */ | 1692 | */ |
| 1653 | void ntb_transport_free_queue(struct ntb_transport_qp *qp) | 1693 | void ntb_transport_free_queue(struct ntb_transport_qp *qp) |
| 1654 | { | 1694 | { |
| 1655 | struct ntb_transport_ctx *nt = qp->transport; | ||
| 1656 | struct pci_dev *pdev; | 1695 | struct pci_dev *pdev; |
| 1657 | struct ntb_queue_entry *entry; | 1696 | struct ntb_queue_entry *entry; |
| 1658 | u64 qp_bit; | 1697 | u64 qp_bit; |
| @@ -1689,18 +1728,23 @@ void ntb_transport_free_queue(struct ntb_transport_qp *qp) | |||
| 1689 | qp->tx_handler = NULL; | 1728 | qp->tx_handler = NULL; |
| 1690 | qp->event_handler = NULL; | 1729 | qp->event_handler = NULL; |
| 1691 | 1730 | ||
| 1692 | while ((entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q))) | 1731 | while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q))) |
| 1693 | kfree(entry); | 1732 | kfree(entry); |
| 1694 | 1733 | ||
| 1695 | while ((entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q))) { | 1734 | while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q))) { |
| 1696 | dev_warn(&pdev->dev, "Freeing item from a non-empty queue\n"); | 1735 | dev_warn(&pdev->dev, "Freeing item from non-empty rx_pend_q\n"); |
| 1736 | kfree(entry); | ||
| 1737 | } | ||
| 1738 | |||
| 1739 | while ((entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_post_q))) { | ||
| 1740 | dev_warn(&pdev->dev, "Freeing item from non-empty rx_post_q\n"); | ||
| 1697 | kfree(entry); | 1741 | kfree(entry); |
| 1698 | } | 1742 | } |
| 1699 | 1743 | ||
| 1700 | while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q))) | 1744 | while ((entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q))) |
| 1701 | kfree(entry); | 1745 | kfree(entry); |
| 1702 | 1746 | ||
| 1703 | nt->qp_bitmap_free |= qp_bit; | 1747 | qp->transport->qp_bitmap_free |= qp_bit; |
| 1704 | 1748 | ||
| 1705 | dev_info(&pdev->dev, "NTB Transport QP %d freed\n", qp->qp_num); | 1749 | dev_info(&pdev->dev, "NTB Transport QP %d freed\n", qp->qp_num); |
| 1706 | } | 1750 | } |
| @@ -1724,14 +1768,14 @@ void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len) | |||
| 1724 | if (!qp || qp->client_ready) | 1768 | if (!qp || qp->client_ready) |
| 1725 | return NULL; | 1769 | return NULL; |
| 1726 | 1770 | ||
| 1727 | entry = ntb_list_rm(&qp->ntb_rx_pend_q_lock, &qp->rx_pend_q); | 1771 | entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_pend_q); |
| 1728 | if (!entry) | 1772 | if (!entry) |
| 1729 | return NULL; | 1773 | return NULL; |
| 1730 | 1774 | ||
| 1731 | buf = entry->cb_data; | 1775 | buf = entry->cb_data; |
| 1732 | *len = entry->len; | 1776 | *len = entry->len; |
| 1733 | 1777 | ||
| 1734 | ntb_list_add(&qp->ntb_rx_free_q_lock, &entry->entry, &qp->rx_free_q); | 1778 | ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_free_q); |
| 1735 | 1779 | ||
| 1736 | return buf; | 1780 | return buf; |
| 1737 | } | 1781 | } |
| @@ -1757,15 +1801,18 @@ int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data, | |||
| 1757 | if (!qp) | 1801 | if (!qp) |
| 1758 | return -EINVAL; | 1802 | return -EINVAL; |
| 1759 | 1803 | ||
| 1760 | entry = ntb_list_rm(&qp->ntb_rx_free_q_lock, &qp->rx_free_q); | 1804 | entry = ntb_list_rm(&qp->ntb_rx_q_lock, &qp->rx_free_q); |
| 1761 | if (!entry) | 1805 | if (!entry) |
| 1762 | return -ENOMEM; | 1806 | return -ENOMEM; |
| 1763 | 1807 | ||
| 1764 | entry->cb_data = cb; | 1808 | entry->cb_data = cb; |
| 1765 | entry->buf = data; | 1809 | entry->buf = data; |
| 1766 | entry->len = len; | 1810 | entry->len = len; |
| 1811 | entry->flags = 0; | ||
| 1812 | |||
| 1813 | ntb_list_add(&qp->ntb_rx_q_lock, &entry->entry, &qp->rx_pend_q); | ||
| 1767 | 1814 | ||
| 1768 | ntb_list_add(&qp->ntb_rx_pend_q_lock, &entry->entry, &qp->rx_pend_q); | 1815 | tasklet_schedule(&qp->rxc_db_work); |
| 1769 | 1816 | ||
| 1770 | return 0; | 1817 | return 0; |
| 1771 | } | 1818 | } |
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 73de4efcbe6e..944f50015ed0 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | # PCI configuration | 2 | # PCI configuration |
| 3 | # | 3 | # |
| 4 | config PCI_BUS_ADDR_T_64BIT | 4 | config PCI_BUS_ADDR_T_64BIT |
| 5 | def_bool y if (ARCH_DMA_ADDR_T_64BIT || 64BIT) | 5 | def_bool y if (ARCH_DMA_ADDR_T_64BIT || (64BIT && !PARISC)) |
| 6 | depends on PCI | 6 | depends on PCI |
| 7 | 7 | ||
| 8 | config PCI_MSI | 8 | config PCI_MSI |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cefd636681b6..f6ae0d0052eb 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -997,7 +997,12 @@ void set_pcie_port_type(struct pci_dev *pdev) | |||
| 997 | else if (type == PCI_EXP_TYPE_UPSTREAM || | 997 | else if (type == PCI_EXP_TYPE_UPSTREAM || |
| 998 | type == PCI_EXP_TYPE_DOWNSTREAM) { | 998 | type == PCI_EXP_TYPE_DOWNSTREAM) { |
| 999 | parent = pci_upstream_bridge(pdev); | 999 | parent = pci_upstream_bridge(pdev); |
| 1000 | if (!parent->has_secondary_link) | 1000 | |
| 1001 | /* | ||
| 1002 | * Usually there's an upstream device (Root Port or Switch | ||
| 1003 | * Downstream Port), but we can't assume one exists. | ||
| 1004 | */ | ||
| 1005 | if (parent && !parent->has_secondary_link) | ||
| 1001 | pdev->has_secondary_link = 1; | 1006 | pdev->has_secondary_link = 1; |
| 1002 | } | 1007 | } |
| 1003 | } | 1008 | } |
| @@ -1103,7 +1108,7 @@ int pci_cfg_space_size(struct pci_dev *dev) | |||
| 1103 | 1108 | ||
| 1104 | #define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED) | 1109 | #define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED) |
| 1105 | 1110 | ||
| 1106 | static void pci_msi_setup_pci_dev(struct pci_dev *dev) | 1111 | void pci_msi_setup_pci_dev(struct pci_dev *dev) |
| 1107 | { | 1112 | { |
| 1108 | /* | 1113 | /* |
| 1109 | * Disable the MSI hardware to avoid screaming interrupts | 1114 | * Disable the MSI hardware to avoid screaming interrupts |
diff --git a/drivers/phy/phy-sun4i-usb.c b/drivers/phy/phy-sun4i-usb.c index e17c539e4f6f..2dad7e820ff0 100644 --- a/drivers/phy/phy-sun4i-usb.c +++ b/drivers/phy/phy-sun4i-usb.c | |||
| @@ -212,6 +212,7 @@ void sun4i_usb_phy_set_squelch_detect(struct phy *_phy, bool enabled) | |||
| 212 | 212 | ||
| 213 | sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2); | 213 | sun4i_usb_phy_write(phy, PHY_SQUELCH_DETECT, enabled ? 0 : 2, 2); |
| 214 | } | 214 | } |
| 215 | EXPORT_SYMBOL_GPL(sun4i_usb_phy_set_squelch_detect); | ||
| 215 | 216 | ||
| 216 | static struct phy_ops sun4i_usb_phy_ops = { | 217 | static struct phy_ops sun4i_usb_phy_ops = { |
| 217 | .init = sun4i_usb_phy_init, | 218 | .init = sun4i_usb_phy_init, |
diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c index 3510b81db3fa..08020dc2c7c8 100644 --- a/drivers/phy/phy-ti-pipe3.c +++ b/drivers/phy/phy-ti-pipe3.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
| 29 | #include <linux/phy/omap_control_phy.h> | 29 | #include <linux/phy/omap_control_phy.h> |
| 30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
| 31 | #include <linux/mfd/syscon.h> | ||
| 32 | #include <linux/regmap.h> | ||
| 31 | 33 | ||
| 32 | #define PLL_STATUS 0x00000004 | 34 | #define PLL_STATUS 0x00000004 |
| 33 | #define PLL_GO 0x00000008 | 35 | #define PLL_GO 0x00000008 |
| @@ -52,6 +54,8 @@ | |||
| 52 | #define PLL_LOCK 0x2 | 54 | #define PLL_LOCK 0x2 |
| 53 | #define PLL_IDLE 0x1 | 55 | #define PLL_IDLE 0x1 |
| 54 | 56 | ||
| 57 | #define SATA_PLL_SOFT_RESET BIT(18) | ||
| 58 | |||
| 55 | /* | 59 | /* |
| 56 | * This is an Empirical value that works, need to confirm the actual | 60 | * This is an Empirical value that works, need to confirm the actual |
| 57 | * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status | 61 | * value required for the PIPE3PHY_PLL_CONFIGURATION2.PLL_IDLE status |
| @@ -82,6 +86,9 @@ struct ti_pipe3 { | |||
| 82 | struct clk *refclk; | 86 | struct clk *refclk; |
| 83 | struct clk *div_clk; | 87 | struct clk *div_clk; |
| 84 | struct pipe3_dpll_map *dpll_map; | 88 | struct pipe3_dpll_map *dpll_map; |
| 89 | struct regmap *dpll_reset_syscon; /* ctrl. reg. acces */ | ||
| 90 | unsigned int dpll_reset_reg; /* reg. index within syscon */ | ||
| 91 | bool sata_refclk_enabled; | ||
| 85 | }; | 92 | }; |
| 86 | 93 | ||
| 87 | static struct pipe3_dpll_map dpll_map_usb[] = { | 94 | static struct pipe3_dpll_map dpll_map_usb[] = { |
| @@ -249,8 +256,11 @@ static int ti_pipe3_exit(struct phy *x) | |||
| 249 | u32 val; | 256 | u32 val; |
| 250 | unsigned long timeout; | 257 | unsigned long timeout; |
| 251 | 258 | ||
| 252 | /* SATA DPLL can't be powered down due to Errata i783 */ | 259 | /* If dpll_reset_syscon is not present we wont power down SATA DPLL |
| 253 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) | 260 | * due to Errata i783 |
| 261 | */ | ||
| 262 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata") && | ||
| 263 | !phy->dpll_reset_syscon) | ||
| 254 | return 0; | 264 | return 0; |
| 255 | 265 | ||
| 256 | /* PCIe doesn't have internal DPLL */ | 266 | /* PCIe doesn't have internal DPLL */ |
| @@ -276,6 +286,14 @@ static int ti_pipe3_exit(struct phy *x) | |||
| 276 | } | 286 | } |
| 277 | } | 287 | } |
| 278 | 288 | ||
| 289 | /* i783: SATA needs control bit toggle after PLL unlock */ | ||
| 290 | if (of_device_is_compatible(phy->dev->of_node, "ti,phy-pipe3-sata")) { | ||
| 291 | regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg, | ||
| 292 | SATA_PLL_SOFT_RESET, SATA_PLL_SOFT_RESET); | ||
| 293 | regmap_update_bits(phy->dpll_reset_syscon, phy->dpll_reset_reg, | ||
| 294 | SATA_PLL_SOFT_RESET, 0); | ||
| 295 | } | ||
| 296 | |||
| 279 | ti_pipe3_disable_clocks(phy); | 297 | ti_pipe3_disable_clocks(phy); |
| 280 | 298 | ||
| 281 | return 0; | 299 | return 0; |
| @@ -350,6 +368,21 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
| 350 | } | 368 | } |
| 351 | } else { | 369 | } else { |
| 352 | phy->wkupclk = ERR_PTR(-ENODEV); | 370 | phy->wkupclk = ERR_PTR(-ENODEV); |
| 371 | phy->dpll_reset_syscon = syscon_regmap_lookup_by_phandle(node, | ||
| 372 | "syscon-pllreset"); | ||
| 373 | if (IS_ERR(phy->dpll_reset_syscon)) { | ||
| 374 | dev_info(&pdev->dev, | ||
| 375 | "can't get syscon-pllreset, sata dpll won't idle\n"); | ||
| 376 | phy->dpll_reset_syscon = NULL; | ||
| 377 | } else { | ||
| 378 | if (of_property_read_u32_index(node, | ||
| 379 | "syscon-pllreset", 1, | ||
| 380 | &phy->dpll_reset_reg)) { | ||
| 381 | dev_err(&pdev->dev, | ||
| 382 | "couldn't get pllreset reg. offset\n"); | ||
| 383 | return -EINVAL; | ||
| 384 | } | ||
| 385 | } | ||
| 353 | } | 386 | } |
| 354 | 387 | ||
| 355 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { | 388 | if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) { |
| @@ -402,10 +435,16 @@ static int ti_pipe3_probe(struct platform_device *pdev) | |||
| 402 | 435 | ||
| 403 | platform_set_drvdata(pdev, phy); | 436 | platform_set_drvdata(pdev, phy); |
| 404 | pm_runtime_enable(phy->dev); | 437 | pm_runtime_enable(phy->dev); |
| 405 | /* Prevent auto-disable of refclk for SATA PHY due to Errata i783 */ | 438 | |
| 406 | if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) | 439 | /* |
| 407 | if (!IS_ERR(phy->refclk)) | 440 | * Prevent auto-disable of refclk for SATA PHY due to Errata i783 |
| 441 | */ | ||
| 442 | if (of_device_is_compatible(node, "ti,phy-pipe3-sata")) { | ||
| 443 | if (!IS_ERR(phy->refclk)) { | ||
| 408 | clk_prepare_enable(phy->refclk); | 444 | clk_prepare_enable(phy->refclk); |
| 445 | phy->sata_refclk_enabled = true; | ||
| 446 | } | ||
| 447 | } | ||
| 409 | 448 | ||
| 410 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); | 449 | generic_phy = devm_phy_create(phy->dev, NULL, &ops); |
| 411 | if (IS_ERR(generic_phy)) | 450 | if (IS_ERR(generic_phy)) |
| @@ -472,8 +511,18 @@ static void ti_pipe3_disable_clocks(struct ti_pipe3 *phy) | |||
| 472 | { | 511 | { |
| 473 | if (!IS_ERR(phy->wkupclk)) | 512 | if (!IS_ERR(phy->wkupclk)) |
| 474 | clk_disable_unprepare(phy->wkupclk); | 513 | clk_disable_unprepare(phy->wkupclk); |
| 475 | if (!IS_ERR(phy->refclk)) | 514 | if (!IS_ERR(phy->refclk)) { |
| 476 | clk_disable_unprepare(phy->refclk); | 515 | clk_disable_unprepare(phy->refclk); |
| 516 | /* | ||
| 517 | * SATA refclk needs an additional disable as we left it | ||
| 518 | * on in probe to avoid Errata i783 | ||
| 519 | */ | ||
| 520 | if (phy->sata_refclk_enabled) { | ||
| 521 | clk_disable_unprepare(phy->refclk); | ||
| 522 | phy->sata_refclk_enabled = false; | ||
| 523 | } | ||
| 524 | } | ||
| 525 | |||
| 477 | if (!IS_ERR(phy->div_clk)) | 526 | if (!IS_ERR(phy->div_clk)) |
| 478 | clk_disable_unprepare(phy->div_clk); | 527 | clk_disable_unprepare(phy->div_clk); |
| 479 | } | 528 | } |
diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig index cb1329919527..3271cd1abe7c 100644 --- a/drivers/platform/chrome/Kconfig +++ b/drivers/platform/chrome/Kconfig | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | menuconfig CHROME_PLATFORMS | 5 | menuconfig CHROME_PLATFORMS |
| 6 | bool "Platform support for Chrome hardware" | 6 | bool "Platform support for Chrome hardware" |
| 7 | depends on X86 || ARM | ||
| 8 | ---help--- | 7 | ---help--- |
| 9 | Say Y here to get to see options for platform support for | 8 | Say Y here to get to see options for platform support for |
| 10 | various Chromebooks and Chromeboxes. This option alone does | 9 | various Chromebooks and Chromeboxes. This option alone does |
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index 26270c351624..ce129e595b55 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | 39 | ||
| 40 | #define DRV_NAME "fnic" | 40 | #define DRV_NAME "fnic" |
| 41 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" | 41 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" |
| 42 | #define DRV_VERSION "1.6.0.17" | 42 | #define DRV_VERSION "1.6.0.17a" |
| 43 | #define PFX DRV_NAME ": " | 43 | #define PFX DRV_NAME ": " |
| 44 | #define DFX DRV_NAME "%d: " | 44 | #define DFX DRV_NAME "%d: " |
| 45 | 45 | ||
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 155b286f1a9d..25436cd2860c 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c | |||
| @@ -425,6 +425,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ | |||
| 425 | unsigned long ptr; | 425 | unsigned long ptr; |
| 426 | struct fc_rport_priv *rdata; | 426 | struct fc_rport_priv *rdata; |
| 427 | spinlock_t *io_lock = NULL; | 427 | spinlock_t *io_lock = NULL; |
| 428 | int io_lock_acquired = 0; | ||
| 428 | 429 | ||
| 429 | if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED))) | 430 | if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED))) |
| 430 | return SCSI_MLQUEUE_HOST_BUSY; | 431 | return SCSI_MLQUEUE_HOST_BUSY; |
| @@ -518,6 +519,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ | |||
| 518 | spin_lock_irqsave(io_lock, flags); | 519 | spin_lock_irqsave(io_lock, flags); |
| 519 | 520 | ||
| 520 | /* initialize rest of io_req */ | 521 | /* initialize rest of io_req */ |
| 522 | io_lock_acquired = 1; | ||
| 521 | io_req->port_id = rport->port_id; | 523 | io_req->port_id = rport->port_id; |
| 522 | io_req->start_time = jiffies; | 524 | io_req->start_time = jiffies; |
| 523 | CMD_STATE(sc) = FNIC_IOREQ_CMD_PENDING; | 525 | CMD_STATE(sc) = FNIC_IOREQ_CMD_PENDING; |
| @@ -571,7 +573,7 @@ out: | |||
| 571 | (((u64)CMD_FLAGS(sc) >> 32) | CMD_STATE(sc))); | 573 | (((u64)CMD_FLAGS(sc) >> 32) | CMD_STATE(sc))); |
| 572 | 574 | ||
| 573 | /* if only we issued IO, will we have the io lock */ | 575 | /* if only we issued IO, will we have the io lock */ |
| 574 | if (CMD_FLAGS(sc) & FNIC_IO_INITIALIZED) | 576 | if (io_lock_acquired) |
| 575 | spin_unlock_irqrestore(io_lock, flags); | 577 | spin_unlock_irqrestore(io_lock, flags); |
| 576 | 578 | ||
| 577 | atomic_dec(&fnic->in_flight); | 579 | atomic_dec(&fnic->in_flight); |
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 1b3a09473452..30f9ef0c0d4f 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c | |||
| @@ -733,8 +733,6 @@ static bool fc_invoke_resp(struct fc_exch *ep, struct fc_seq *sp, | |||
| 733 | if (resp) { | 733 | if (resp) { |
| 734 | resp(sp, fp, arg); | 734 | resp(sp, fp, arg); |
| 735 | res = true; | 735 | res = true; |
| 736 | } else if (!IS_ERR(fp)) { | ||
| 737 | fc_frame_free(fp); | ||
| 738 | } | 736 | } |
| 739 | 737 | ||
| 740 | spin_lock_bh(&ep->ex_lock); | 738 | spin_lock_bh(&ep->ex_lock); |
| @@ -1596,7 +1594,8 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) | |||
| 1596 | * If new exch resp handler is valid then call that | 1594 | * If new exch resp handler is valid then call that |
| 1597 | * first. | 1595 | * first. |
| 1598 | */ | 1596 | */ |
| 1599 | fc_invoke_resp(ep, sp, fp); | 1597 | if (!fc_invoke_resp(ep, sp, fp)) |
| 1598 | fc_frame_free(fp); | ||
| 1600 | 1599 | ||
| 1601 | fc_exch_release(ep); | 1600 | fc_exch_release(ep); |
| 1602 | return; | 1601 | return; |
| @@ -1695,7 +1694,8 @@ static void fc_exch_abts_resp(struct fc_exch *ep, struct fc_frame *fp) | |||
| 1695 | fc_exch_hold(ep); | 1694 | fc_exch_hold(ep); |
| 1696 | if (!rc) | 1695 | if (!rc) |
| 1697 | fc_exch_delete(ep); | 1696 | fc_exch_delete(ep); |
| 1698 | fc_invoke_resp(ep, sp, fp); | 1697 | if (!fc_invoke_resp(ep, sp, fp)) |
| 1698 | fc_frame_free(fp); | ||
| 1699 | if (has_rec) | 1699 | if (has_rec) |
| 1700 | fc_exch_timer_set(ep, ep->r_a_tov); | 1700 | fc_exch_timer_set(ep, ep->r_a_tov); |
| 1701 | fc_exch_release(ep); | 1701 | fc_exch_release(ep); |
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index c6795941b45d..2d5909c4685c 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c | |||
| @@ -1039,11 +1039,26 @@ restart: | |||
| 1039 | fc_fcp_pkt_hold(fsp); | 1039 | fc_fcp_pkt_hold(fsp); |
| 1040 | spin_unlock_irqrestore(&si->scsi_queue_lock, flags); | 1040 | spin_unlock_irqrestore(&si->scsi_queue_lock, flags); |
| 1041 | 1041 | ||
| 1042 | if (!fc_fcp_lock_pkt(fsp)) { | 1042 | spin_lock_bh(&fsp->scsi_pkt_lock); |
| 1043 | if (!(fsp->state & FC_SRB_COMPL)) { | ||
| 1044 | fsp->state |= FC_SRB_COMPL; | ||
| 1045 | /* | ||
| 1046 | * TODO: dropping scsi_pkt_lock and then reacquiring | ||
| 1047 | * again around fc_fcp_cleanup_cmd() is required, | ||
| 1048 | * since fc_fcp_cleanup_cmd() calls into | ||
| 1049 | * fc_seq_set_resp() and that func preempts cpu using | ||
| 1050 | * schedule. May be schedule and related code should be | ||
| 1051 | * removed instead of unlocking here to avoid scheduling | ||
| 1052 | * while atomic bug. | ||
| 1053 | */ | ||
| 1054 | spin_unlock_bh(&fsp->scsi_pkt_lock); | ||
| 1055 | |||
| 1043 | fc_fcp_cleanup_cmd(fsp, error); | 1056 | fc_fcp_cleanup_cmd(fsp, error); |
| 1057 | |||
| 1058 | spin_lock_bh(&fsp->scsi_pkt_lock); | ||
| 1044 | fc_io_compl(fsp); | 1059 | fc_io_compl(fsp); |
| 1045 | fc_fcp_unlock_pkt(fsp); | ||
| 1046 | } | 1060 | } |
| 1061 | spin_unlock_bh(&fsp->scsi_pkt_lock); | ||
| 1047 | 1062 | ||
| 1048 | fc_fcp_pkt_release(fsp); | 1063 | fc_fcp_pkt_release(fsp); |
| 1049 | spin_lock_irqsave(&si->scsi_queue_lock, flags); | 1064 | spin_lock_irqsave(&si->scsi_queue_lock, flags); |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 8053f24f0349..98d9bb6ff725 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
| @@ -2941,10 +2941,10 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
| 2941 | { | 2941 | { |
| 2942 | struct iscsi_conn *conn = cls_conn->dd_data; | 2942 | struct iscsi_conn *conn = cls_conn->dd_data; |
| 2943 | struct iscsi_session *session = conn->session; | 2943 | struct iscsi_session *session = conn->session; |
| 2944 | unsigned long flags; | ||
| 2945 | 2944 | ||
| 2946 | del_timer_sync(&conn->transport_timer); | 2945 | del_timer_sync(&conn->transport_timer); |
| 2947 | 2946 | ||
| 2947 | mutex_lock(&session->eh_mutex); | ||
| 2948 | spin_lock_bh(&session->frwd_lock); | 2948 | spin_lock_bh(&session->frwd_lock); |
| 2949 | conn->c_stage = ISCSI_CONN_CLEANUP_WAIT; | 2949 | conn->c_stage = ISCSI_CONN_CLEANUP_WAIT; |
| 2950 | if (session->leadconn == conn) { | 2950 | if (session->leadconn == conn) { |
| @@ -2956,28 +2956,6 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
| 2956 | } | 2956 | } |
| 2957 | spin_unlock_bh(&session->frwd_lock); | 2957 | spin_unlock_bh(&session->frwd_lock); |
| 2958 | 2958 | ||
| 2959 | /* | ||
| 2960 | * Block until all in-progress commands for this connection | ||
| 2961 | * time out or fail. | ||
| 2962 | */ | ||
| 2963 | for (;;) { | ||
| 2964 | spin_lock_irqsave(session->host->host_lock, flags); | ||
| 2965 | if (!atomic_read(&session->host->host_busy)) { /* OK for ERL == 0 */ | ||
| 2966 | spin_unlock_irqrestore(session->host->host_lock, flags); | ||
| 2967 | break; | ||
| 2968 | } | ||
| 2969 | spin_unlock_irqrestore(session->host->host_lock, flags); | ||
| 2970 | msleep_interruptible(500); | ||
| 2971 | iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): " | ||
| 2972 | "host_busy %d host_failed %d\n", | ||
| 2973 | atomic_read(&session->host->host_busy), | ||
| 2974 | session->host->host_failed); | ||
| 2975 | /* | ||
| 2976 | * force eh_abort() to unblock | ||
| 2977 | */ | ||
| 2978 | wake_up(&conn->ehwait); | ||
| 2979 | } | ||
| 2980 | |||
| 2981 | /* flush queued up work because we free the connection below */ | 2959 | /* flush queued up work because we free the connection below */ |
| 2982 | iscsi_suspend_tx(conn); | 2960 | iscsi_suspend_tx(conn); |
| 2983 | 2961 | ||
| @@ -2994,6 +2972,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn) | |||
| 2994 | if (session->leadconn == conn) | 2972 | if (session->leadconn == conn) |
| 2995 | session->leadconn = NULL; | 2973 | session->leadconn = NULL; |
| 2996 | spin_unlock_bh(&session->frwd_lock); | 2974 | spin_unlock_bh(&session->frwd_lock); |
| 2975 | mutex_unlock(&session->eh_mutex); | ||
| 2997 | 2976 | ||
| 2998 | iscsi_destroy_conn(cls_conn); | 2977 | iscsi_destroy_conn(cls_conn); |
| 2999 | } | 2978 | } |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index cfadccef045c..6457a8a0db9c 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> |
| 29 | #include <asm/unaligned.h> | ||
| 30 | 29 | ||
| 31 | #include <scsi/scsi.h> | 30 | #include <scsi/scsi.h> |
| 32 | #include <scsi/scsi_cmnd.h> | 31 | #include <scsi/scsi_cmnd.h> |
| @@ -2523,33 +2522,3 @@ void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq) | |||
| 2523 | } | 2522 | } |
| 2524 | } | 2523 | } |
| 2525 | EXPORT_SYMBOL(scsi_build_sense_buffer); | 2524 | EXPORT_SYMBOL(scsi_build_sense_buffer); |
| 2526 | |||
| 2527 | /** | ||
| 2528 | * scsi_set_sense_information - set the information field in a | ||
| 2529 | * formatted sense data buffer | ||
| 2530 | * @buf: Where to build sense data | ||
| 2531 | * @info: 64-bit information value to be set | ||
| 2532 | * | ||
| 2533 | **/ | ||
| 2534 | void scsi_set_sense_information(u8 *buf, u64 info) | ||
| 2535 | { | ||
| 2536 | if ((buf[0] & 0x7f) == 0x72) { | ||
| 2537 | u8 *ucp, len; | ||
| 2538 | |||
| 2539 | len = buf[7]; | ||
| 2540 | ucp = (char *)scsi_sense_desc_find(buf, len + 8, 0); | ||
| 2541 | if (!ucp) { | ||
| 2542 | buf[7] = len + 0xa; | ||
| 2543 | ucp = buf + 8 + len; | ||
| 2544 | } | ||
| 2545 | ucp[0] = 0; | ||
| 2546 | ucp[1] = 0xa; | ||
| 2547 | ucp[2] = 0x80; /* Valid bit */ | ||
| 2548 | ucp[3] = 0; | ||
| 2549 | put_unaligned_be64(info, &ucp[4]); | ||
| 2550 | } else if ((buf[0] & 0x7f) == 0x70) { | ||
| 2551 | buf[0] |= 0x80; | ||
| 2552 | put_unaligned_be64(info, &buf[3]); | ||
| 2553 | } | ||
| 2554 | } | ||
| 2555 | EXPORT_SYMBOL(scsi_set_sense_information); | ||
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c index 9e43ae1d2163..e4b799837948 100644 --- a/drivers/scsi/scsi_pm.c +++ b/drivers/scsi/scsi_pm.c | |||
| @@ -217,15 +217,15 @@ static int sdev_runtime_suspend(struct device *dev) | |||
| 217 | { | 217 | { |
| 218 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 218 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
| 219 | struct scsi_device *sdev = to_scsi_device(dev); | 219 | struct scsi_device *sdev = to_scsi_device(dev); |
| 220 | int err; | 220 | int err = 0; |
| 221 | 221 | ||
| 222 | err = blk_pre_runtime_suspend(sdev->request_queue); | 222 | if (pm && pm->runtime_suspend) { |
| 223 | if (err) | 223 | err = blk_pre_runtime_suspend(sdev->request_queue); |
| 224 | return err; | 224 | if (err) |
| 225 | if (pm && pm->runtime_suspend) | 225 | return err; |
| 226 | err = pm->runtime_suspend(dev); | 226 | err = pm->runtime_suspend(dev); |
| 227 | blk_post_runtime_suspend(sdev->request_queue, err); | 227 | blk_post_runtime_suspend(sdev->request_queue, err); |
| 228 | 228 | } | |
| 229 | return err; | 229 | return err; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| @@ -248,11 +248,11 @@ static int sdev_runtime_resume(struct device *dev) | |||
| 248 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 248 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
| 249 | int err = 0; | 249 | int err = 0; |
| 250 | 250 | ||
| 251 | blk_pre_runtime_resume(sdev->request_queue); | 251 | if (pm && pm->runtime_resume) { |
| 252 | if (pm && pm->runtime_resume) | 252 | blk_pre_runtime_resume(sdev->request_queue); |
| 253 | err = pm->runtime_resume(dev); | 253 | err = pm->runtime_resume(dev); |
| 254 | blk_post_runtime_resume(sdev->request_queue, err); | 254 | blk_post_runtime_resume(sdev->request_queue, err); |
| 255 | 255 | } | |
| 256 | return err; | 256 | return err; |
| 257 | } | 257 | } |
| 258 | 258 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3b2fcb4fada0..a20da8c25b4f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -2770,9 +2770,9 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
| 2770 | max_xfer = sdkp->max_xfer_blocks; | 2770 | max_xfer = sdkp->max_xfer_blocks; |
| 2771 | max_xfer <<= ilog2(sdp->sector_size) - 9; | 2771 | max_xfer <<= ilog2(sdp->sector_size) - 9; |
| 2772 | 2772 | ||
| 2773 | max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), | 2773 | sdkp->disk->queue->limits.max_sectors = |
| 2774 | max_xfer); | 2774 | min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), max_xfer); |
| 2775 | blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer); | 2775 | |
| 2776 | set_capacity(disk, sdkp->capacity); | 2776 | set_capacity(disk, sdkp->capacity); |
| 2777 | sd_config_write_same(sdkp); | 2777 | sd_config_write_same(sdkp); |
| 2778 | kfree(buffer); | 2778 | kfree(buffer); |
diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index bfa42620a3f6..940781183fac 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c | |||
| @@ -1266,6 +1266,7 @@ static const struct das1800_board *das1800_probe(struct comedi_device *dev) | |||
| 1266 | if (index == das1801hc || index == das1802hc) | 1266 | if (index == das1801hc || index == das1802hc) |
| 1267 | return board; | 1267 | return board; |
| 1268 | index = das1801hc; | 1268 | index = das1801hc; |
| 1269 | break; | ||
| 1269 | default: | 1270 | default: |
| 1270 | dev_err(dev->class_dev, | 1271 | dev_err(dev->class_dev, |
| 1271 | "Board model: probe returned 0x%x (unknown, please report)\n", | 1272 | "Board model: probe returned 0x%x (unknown, please report)\n", |
diff --git a/drivers/staging/lustre/lustre/obdclass/debug.c b/drivers/staging/lustre/lustre/obdclass/debug.c index 9c934e6d2ea1..c61add46b426 100644 --- a/drivers/staging/lustre/lustre/obdclass/debug.c +++ b/drivers/staging/lustre/lustre/obdclass/debug.c | |||
| @@ -40,7 +40,7 @@ | |||
| 40 | 40 | ||
| 41 | #define DEBUG_SUBSYSTEM D_OTHER | 41 | #define DEBUG_SUBSYSTEM D_OTHER |
| 42 | 42 | ||
| 43 | #include <linux/unaligned/access_ok.h> | 43 | #include <asm/unaligned.h> |
| 44 | 44 | ||
| 45 | #include "../include/obd_support.h" | 45 | #include "../include/obd_support.h" |
| 46 | #include "../include/lustre_debug.h" | 46 | #include "../include/lustre_debug.h" |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index b0c8e235b982..69bdc8f29b59 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
| @@ -1483,8 +1483,9 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1483 | } | 1483 | } |
| 1484 | } | 1484 | } |
| 1485 | 1485 | ||
| 1486 | if (changed & BSS_CHANGED_ASSOC && priv->op_mode != NL80211_IFTYPE_AP) { | 1486 | if (changed & (BSS_CHANGED_ASSOC | BSS_CHANGED_BEACON_INFO) && |
| 1487 | if (conf->assoc) { | 1487 | priv->op_mode != NL80211_IFTYPE_AP) { |
| 1488 | if (conf->assoc && conf->beacon_rate) { | ||
| 1488 | CARDbUpdateTSF(priv, conf->beacon_rate->hw_value, | 1489 | CARDbUpdateTSF(priv, conf->beacon_rate->hw_value, |
| 1489 | conf->sync_tsf); | 1490 | conf->sync_tsf); |
| 1490 | 1491 | ||
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index cd77a064c772..fd092909a457 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -968,9 +968,9 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
| 968 | cmd->cmd_flags |= ICF_NON_IMMEDIATE_UNSOLICITED_DATA; | 968 | cmd->cmd_flags |= ICF_NON_IMMEDIATE_UNSOLICITED_DATA; |
| 969 | 969 | ||
| 970 | conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; | 970 | conn->sess->init_task_tag = cmd->init_task_tag = hdr->itt; |
| 971 | if (hdr->flags & ISCSI_FLAG_CMD_READ) { | 971 | if (hdr->flags & ISCSI_FLAG_CMD_READ) |
| 972 | cmd->targ_xfer_tag = session_get_next_ttt(conn->sess); | 972 | cmd->targ_xfer_tag = session_get_next_ttt(conn->sess); |
| 973 | } else if (hdr->flags & ISCSI_FLAG_CMD_WRITE) | 973 | else |
| 974 | cmd->targ_xfer_tag = 0xFFFFFFFF; | 974 | cmd->targ_xfer_tag = 0xFFFFFFFF; |
| 975 | cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); | 975 | cmd->cmd_sn = be32_to_cpu(hdr->cmdsn); |
| 976 | cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); | 976 | cmd->exp_stat_sn = be32_to_cpu(hdr->exp_statsn); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index c2e9fea90b4a..860e84046177 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
| @@ -457,8 +457,15 @@ void target_unregister_template(const struct target_core_fabric_ops *fo) | |||
| 457 | if (!strcmp(t->tf_ops->name, fo->name)) { | 457 | if (!strcmp(t->tf_ops->name, fo->name)) { |
| 458 | BUG_ON(atomic_read(&t->tf_access_cnt)); | 458 | BUG_ON(atomic_read(&t->tf_access_cnt)); |
| 459 | list_del(&t->tf_list); | 459 | list_del(&t->tf_list); |
| 460 | mutex_unlock(&g_tf_lock); | ||
| 461 | /* | ||
| 462 | * Wait for any outstanding fabric se_deve_entry->rcu_head | ||
| 463 | * callbacks to complete post kfree_rcu(), before allowing | ||
| 464 | * fabric driver unload of TFO->module to proceed. | ||
| 465 | */ | ||
| 466 | rcu_barrier(); | ||
| 460 | kfree(t); | 467 | kfree(t); |
| 461 | break; | 468 | return; |
| 462 | } | 469 | } |
| 463 | } | 470 | } |
| 464 | mutex_unlock(&g_tf_lock); | 471 | mutex_unlock(&g_tf_lock); |
diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c index 62ea4e8e70a8..be9cefc07407 100644 --- a/drivers/target/target_core_hba.c +++ b/drivers/target/target_core_hba.c | |||
| @@ -84,8 +84,16 @@ void target_backend_unregister(const struct target_backend_ops *ops) | |||
| 84 | list_for_each_entry(tb, &backend_list, list) { | 84 | list_for_each_entry(tb, &backend_list, list) { |
| 85 | if (tb->ops == ops) { | 85 | if (tb->ops == ops) { |
| 86 | list_del(&tb->list); | 86 | list_del(&tb->list); |
| 87 | mutex_unlock(&backend_mutex); | ||
| 88 | /* | ||
| 89 | * Wait for any outstanding backend driver ->rcu_head | ||
| 90 | * callbacks to complete post TBO->free_device() -> | ||
| 91 | * call_rcu(), before allowing backend driver module | ||
| 92 | * unload of target_backend_ops->owner to proceed. | ||
| 93 | */ | ||
| 94 | rcu_barrier(); | ||
| 87 | kfree(tb); | 95 | kfree(tb); |
| 88 | break; | 96 | return; |
| 89 | } | 97 | } |
| 90 | } | 98 | } |
| 91 | mutex_unlock(&backend_mutex); | 99 | mutex_unlock(&backend_mutex); |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index b5ba1ec3c354..f87d4cef6d39 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
| @@ -1203,17 +1203,13 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) | |||
| 1203 | struct se_dev_entry *deve; | 1203 | struct se_dev_entry *deve; |
| 1204 | struct se_session *sess = cmd->se_sess; | 1204 | struct se_session *sess = cmd->se_sess; |
| 1205 | struct se_node_acl *nacl; | 1205 | struct se_node_acl *nacl; |
| 1206 | struct scsi_lun slun; | ||
| 1206 | unsigned char *buf; | 1207 | unsigned char *buf; |
| 1207 | u32 lun_count = 0, offset = 8; | 1208 | u32 lun_count = 0, offset = 8; |
| 1208 | 1209 | __be32 len; | |
| 1209 | if (cmd->data_length < 16) { | ||
| 1210 | pr_warn("REPORT LUNS allocation length %u too small\n", | ||
| 1211 | cmd->data_length); | ||
| 1212 | return TCM_INVALID_CDB_FIELD; | ||
| 1213 | } | ||
| 1214 | 1210 | ||
| 1215 | buf = transport_kmap_data_sg(cmd); | 1211 | buf = transport_kmap_data_sg(cmd); |
| 1216 | if (!buf) | 1212 | if (cmd->data_length && !buf) |
| 1217 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1213 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 1218 | 1214 | ||
| 1219 | /* | 1215 | /* |
| @@ -1221,11 +1217,9 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) | |||
| 1221 | * coming via a target_core_mod PASSTHROUGH op, and not through | 1217 | * coming via a target_core_mod PASSTHROUGH op, and not through |
| 1222 | * a $FABRIC_MOD. In that case, report LUN=0 only. | 1218 | * a $FABRIC_MOD. In that case, report LUN=0 only. |
| 1223 | */ | 1219 | */ |
| 1224 | if (!sess) { | 1220 | if (!sess) |
| 1225 | int_to_scsilun(0, (struct scsi_lun *)&buf[offset]); | ||
| 1226 | lun_count = 1; | ||
| 1227 | goto done; | 1221 | goto done; |
| 1228 | } | 1222 | |
| 1229 | nacl = sess->se_node_acl; | 1223 | nacl = sess->se_node_acl; |
| 1230 | 1224 | ||
| 1231 | rcu_read_lock(); | 1225 | rcu_read_lock(); |
| @@ -1236,10 +1230,12 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) | |||
| 1236 | * See SPC2-R20 7.19. | 1230 | * See SPC2-R20 7.19. |
| 1237 | */ | 1231 | */ |
| 1238 | lun_count++; | 1232 | lun_count++; |
| 1239 | if ((offset + 8) > cmd->data_length) | 1233 | if (offset >= cmd->data_length) |
| 1240 | continue; | 1234 | continue; |
| 1241 | 1235 | ||
| 1242 | int_to_scsilun(deve->mapped_lun, (struct scsi_lun *)&buf[offset]); | 1236 | int_to_scsilun(deve->mapped_lun, &slun); |
| 1237 | memcpy(buf + offset, &slun, | ||
| 1238 | min(8u, cmd->data_length - offset)); | ||
| 1243 | offset += 8; | 1239 | offset += 8; |
| 1244 | } | 1240 | } |
| 1245 | rcu_read_unlock(); | 1241 | rcu_read_unlock(); |
| @@ -1248,12 +1244,22 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd) | |||
| 1248 | * See SPC3 r07, page 159. | 1244 | * See SPC3 r07, page 159. |
| 1249 | */ | 1245 | */ |
| 1250 | done: | 1246 | done: |
| 1251 | lun_count *= 8; | 1247 | /* |
| 1252 | buf[0] = ((lun_count >> 24) & 0xff); | 1248 | * If no LUNs are accessible, report virtual LUN 0. |
| 1253 | buf[1] = ((lun_count >> 16) & 0xff); | 1249 | */ |
| 1254 | buf[2] = ((lun_count >> 8) & 0xff); | 1250 | if (lun_count == 0) { |
| 1255 | buf[3] = (lun_count & 0xff); | 1251 | int_to_scsilun(0, &slun); |
| 1256 | transport_kunmap_data_sg(cmd); | 1252 | if (cmd->data_length > 8) |
| 1253 | memcpy(buf + offset, &slun, | ||
| 1254 | min(8u, cmd->data_length - offset)); | ||
| 1255 | lun_count = 1; | ||
| 1256 | } | ||
| 1257 | |||
| 1258 | if (buf) { | ||
| 1259 | len = cpu_to_be32(lun_count * 8); | ||
| 1260 | memcpy(buf, &len, min_t(int, sizeof len, cmd->data_length)); | ||
| 1261 | transport_kunmap_data_sg(cmd); | ||
| 1262 | } | ||
| 1257 | 1263 | ||
| 1258 | target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8); | 1264 | target_complete_cmd_with_length(cmd, GOOD, 8 + lun_count * 8); |
| 1259 | return 0; | 1265 | return 0; |
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 6509c61b9648..620dcd405ff6 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
| @@ -68,7 +68,7 @@ struct power_table { | |||
| 68 | * registered cooling device. | 68 | * registered cooling device. |
| 69 | * @cpufreq_state: integer value representing the current state of cpufreq | 69 | * @cpufreq_state: integer value representing the current state of cpufreq |
| 70 | * cooling devices. | 70 | * cooling devices. |
| 71 | * @cpufreq_val: integer value representing the absolute value of the clipped | 71 | * @clipped_freq: integer value representing the absolute value of the clipped |
| 72 | * frequency. | 72 | * frequency. |
| 73 | * @max_level: maximum cooling level. One less than total number of valid | 73 | * @max_level: maximum cooling level. One less than total number of valid |
| 74 | * cpufreq frequencies. | 74 | * cpufreq frequencies. |
| @@ -91,7 +91,7 @@ struct cpufreq_cooling_device { | |||
| 91 | int id; | 91 | int id; |
| 92 | struct thermal_cooling_device *cool_dev; | 92 | struct thermal_cooling_device *cool_dev; |
| 93 | unsigned int cpufreq_state; | 93 | unsigned int cpufreq_state; |
| 94 | unsigned int cpufreq_val; | 94 | unsigned int clipped_freq; |
| 95 | unsigned int max_level; | 95 | unsigned int max_level; |
| 96 | unsigned int *freq_table; /* In descending order */ | 96 | unsigned int *freq_table; /* In descending order */ |
| 97 | struct cpumask allowed_cpus; | 97 | struct cpumask allowed_cpus; |
| @@ -107,6 +107,9 @@ struct cpufreq_cooling_device { | |||
| 107 | static DEFINE_IDR(cpufreq_idr); | 107 | static DEFINE_IDR(cpufreq_idr); |
| 108 | static DEFINE_MUTEX(cooling_cpufreq_lock); | 108 | static DEFINE_MUTEX(cooling_cpufreq_lock); |
| 109 | 109 | ||
| 110 | static unsigned int cpufreq_dev_count; | ||
| 111 | |||
| 112 | static DEFINE_MUTEX(cooling_list_lock); | ||
| 110 | static LIST_HEAD(cpufreq_dev_list); | 113 | static LIST_HEAD(cpufreq_dev_list); |
| 111 | 114 | ||
| 112 | /** | 115 | /** |
| @@ -185,14 +188,14 @@ unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) | |||
| 185 | { | 188 | { |
| 186 | struct cpufreq_cooling_device *cpufreq_dev; | 189 | struct cpufreq_cooling_device *cpufreq_dev; |
| 187 | 190 | ||
| 188 | mutex_lock(&cooling_cpufreq_lock); | 191 | mutex_lock(&cooling_list_lock); |
| 189 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { | 192 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { |
| 190 | if (cpumask_test_cpu(cpu, &cpufreq_dev->allowed_cpus)) { | 193 | if (cpumask_test_cpu(cpu, &cpufreq_dev->allowed_cpus)) { |
| 191 | mutex_unlock(&cooling_cpufreq_lock); | 194 | mutex_unlock(&cooling_list_lock); |
| 192 | return get_level(cpufreq_dev, freq); | 195 | return get_level(cpufreq_dev, freq); |
| 193 | } | 196 | } |
| 194 | } | 197 | } |
| 195 | mutex_unlock(&cooling_cpufreq_lock); | 198 | mutex_unlock(&cooling_list_lock); |
| 196 | 199 | ||
| 197 | pr_err("%s: cpu:%d not part of any cooling device\n", __func__, cpu); | 200 | pr_err("%s: cpu:%d not part of any cooling device\n", __func__, cpu); |
| 198 | return THERMAL_CSTATE_INVALID; | 201 | return THERMAL_CSTATE_INVALID; |
| @@ -215,29 +218,35 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb, | |||
| 215 | unsigned long event, void *data) | 218 | unsigned long event, void *data) |
| 216 | { | 219 | { |
| 217 | struct cpufreq_policy *policy = data; | 220 | struct cpufreq_policy *policy = data; |
| 218 | unsigned long max_freq = 0; | 221 | unsigned long clipped_freq; |
| 219 | struct cpufreq_cooling_device *cpufreq_dev; | 222 | struct cpufreq_cooling_device *cpufreq_dev; |
| 220 | 223 | ||
| 221 | switch (event) { | 224 | if (event != CPUFREQ_ADJUST) |
| 225 | return NOTIFY_DONE; | ||
| 222 | 226 | ||
| 223 | case CPUFREQ_ADJUST: | 227 | mutex_lock(&cooling_list_lock); |
| 224 | mutex_lock(&cooling_cpufreq_lock); | 228 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { |
| 225 | list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { | 229 | if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus)) |
| 226 | if (!cpumask_test_cpu(policy->cpu, | 230 | continue; |
| 227 | &cpufreq_dev->allowed_cpus)) | ||
| 228 | continue; | ||
| 229 | 231 | ||
| 230 | max_freq = cpufreq_dev->cpufreq_val; | 232 | /* |
| 233 | * policy->max is the maximum allowed frequency defined by user | ||
| 234 | * and clipped_freq is the maximum that thermal constraints | ||
| 235 | * allow. | ||
| 236 | * | ||
| 237 | * If clipped_freq is lower than policy->max, then we need to | ||
| 238 | * readjust policy->max. | ||
| 239 | * | ||
| 240 | * But, if clipped_freq is greater than policy->max, we don't | ||
| 241 | * need to do anything. | ||
| 242 | */ | ||
| 243 | clipped_freq = cpufreq_dev->clipped_freq; | ||
| 231 | 244 | ||
| 232 | if (policy->max != max_freq) | 245 | if (policy->max > clipped_freq) |
| 233 | cpufreq_verify_within_limits(policy, 0, | 246 | cpufreq_verify_within_limits(policy, 0, clipped_freq); |
| 234 | max_freq); | ||
| 235 | } | ||
| 236 | mutex_unlock(&cooling_cpufreq_lock); | ||
| 237 | break; | 247 | break; |
| 238 | default: | ||
| 239 | return NOTIFY_DONE; | ||
| 240 | } | 248 | } |
| 249 | mutex_unlock(&cooling_list_lock); | ||
| 241 | 250 | ||
| 242 | return NOTIFY_OK; | 251 | return NOTIFY_OK; |
| 243 | } | 252 | } |
| @@ -519,7 +528,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, | |||
| 519 | 528 | ||
| 520 | clip_freq = cpufreq_device->freq_table[state]; | 529 | clip_freq = cpufreq_device->freq_table[state]; |
| 521 | cpufreq_device->cpufreq_state = state; | 530 | cpufreq_device->cpufreq_state = state; |
| 522 | cpufreq_device->cpufreq_val = clip_freq; | 531 | cpufreq_device->clipped_freq = clip_freq; |
| 523 | 532 | ||
| 524 | cpufreq_update_policy(cpu); | 533 | cpufreq_update_policy(cpu); |
| 525 | 534 | ||
| @@ -861,17 +870,19 @@ __cpufreq_cooling_register(struct device_node *np, | |||
| 861 | pr_debug("%s: freq:%u KHz\n", __func__, freq); | 870 | pr_debug("%s: freq:%u KHz\n", __func__, freq); |
| 862 | } | 871 | } |
| 863 | 872 | ||
| 864 | cpufreq_dev->cpufreq_val = cpufreq_dev->freq_table[0]; | 873 | cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0]; |
| 865 | cpufreq_dev->cool_dev = cool_dev; | 874 | cpufreq_dev->cool_dev = cool_dev; |
| 866 | 875 | ||
| 867 | mutex_lock(&cooling_cpufreq_lock); | 876 | mutex_lock(&cooling_cpufreq_lock); |
| 868 | 877 | ||
| 878 | mutex_lock(&cooling_list_lock); | ||
| 879 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); | ||
| 880 | mutex_unlock(&cooling_list_lock); | ||
| 881 | |||
| 869 | /* Register the notifier for first cpufreq cooling device */ | 882 | /* Register the notifier for first cpufreq cooling device */ |
| 870 | if (list_empty(&cpufreq_dev_list)) | 883 | if (!cpufreq_dev_count++) |
| 871 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, | 884 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, |
| 872 | CPUFREQ_POLICY_NOTIFIER); | 885 | CPUFREQ_POLICY_NOTIFIER); |
| 873 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); | ||
| 874 | |||
| 875 | mutex_unlock(&cooling_cpufreq_lock); | 886 | mutex_unlock(&cooling_cpufreq_lock); |
| 876 | 887 | ||
| 877 | return cool_dev; | 888 | return cool_dev; |
| @@ -1013,13 +1024,17 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) | |||
| 1013 | return; | 1024 | return; |
| 1014 | 1025 | ||
| 1015 | cpufreq_dev = cdev->devdata; | 1026 | cpufreq_dev = cdev->devdata; |
| 1016 | mutex_lock(&cooling_cpufreq_lock); | ||
| 1017 | list_del(&cpufreq_dev->node); | ||
| 1018 | 1027 | ||
| 1019 | /* Unregister the notifier for the last cpufreq cooling device */ | 1028 | /* Unregister the notifier for the last cpufreq cooling device */ |
| 1020 | if (list_empty(&cpufreq_dev_list)) | 1029 | mutex_lock(&cooling_cpufreq_lock); |
| 1030 | if (!--cpufreq_dev_count) | ||
| 1021 | cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, | 1031 | cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, |
| 1022 | CPUFREQ_POLICY_NOTIFIER); | 1032 | CPUFREQ_POLICY_NOTIFIER); |
| 1033 | |||
| 1034 | mutex_lock(&cooling_list_lock); | ||
| 1035 | list_del(&cpufreq_dev->node); | ||
| 1036 | mutex_unlock(&cooling_list_lock); | ||
| 1037 | |||
| 1023 | mutex_unlock(&cooling_cpufreq_lock); | 1038 | mutex_unlock(&cooling_cpufreq_lock); |
| 1024 | 1039 | ||
| 1025 | thermal_cooling_device_unregister(cpufreq_dev->cool_dev); | 1040 | thermal_cooling_device_unregister(cpufreq_dev->cool_dev); |
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index d5dd357ba57c..b49f97c734d0 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c | |||
| @@ -405,7 +405,6 @@ static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops, | |||
| 405 | static struct platform_driver hisi_thermal_driver = { | 405 | static struct platform_driver hisi_thermal_driver = { |
| 406 | .driver = { | 406 | .driver = { |
| 407 | .name = "hisi_thermal", | 407 | .name = "hisi_thermal", |
| 408 | .owner = THIS_MODULE, | ||
| 409 | .pm = &hisi_thermal_pm_ops, | 408 | .pm = &hisi_thermal_pm_ops, |
| 410 | .of_match_table = of_hisi_thermal_match, | 409 | .of_match_table = of_hisi_thermal_match, |
| 411 | }, | 410 | }, |
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index 4672250b329f..7006860f2f36 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c | |||
| @@ -229,7 +229,8 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 229 | struct thermal_instance *instance; | 229 | struct thermal_instance *instance; |
| 230 | struct power_allocator_params *params = tz->governor_data; | 230 | struct power_allocator_params *params = tz->governor_data; |
| 231 | u32 *req_power, *max_power, *granted_power, *extra_actor_power; | 231 | u32 *req_power, *max_power, *granted_power, *extra_actor_power; |
| 232 | u32 total_req_power, max_allocatable_power; | 232 | u32 *weighted_req_power; |
| 233 | u32 total_req_power, max_allocatable_power, total_weighted_req_power; | ||
| 233 | u32 total_granted_power, power_range; | 234 | u32 total_granted_power, power_range; |
| 234 | int i, num_actors, total_weight, ret = 0; | 235 | int i, num_actors, total_weight, ret = 0; |
| 235 | int trip_max_desired_temperature = params->trip_max_desired_temperature; | 236 | int trip_max_desired_temperature = params->trip_max_desired_temperature; |
| @@ -247,16 +248,17 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 247 | } | 248 | } |
| 248 | 249 | ||
| 249 | /* | 250 | /* |
| 250 | * We need to allocate three arrays of the same size: | 251 | * We need to allocate five arrays of the same size: |
| 251 | * req_power, max_power and granted_power. They are going to | 252 | * req_power, max_power, granted_power, extra_actor_power and |
| 252 | * be needed until this function returns. Allocate them all | 253 | * weighted_req_power. They are going to be needed until this |
| 253 | * in one go to simplify the allocation and deallocation | 254 | * function returns. Allocate them all in one go to simplify |
| 254 | * logic. | 255 | * the allocation and deallocation logic. |
| 255 | */ | 256 | */ |
| 256 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power)); | 257 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*max_power)); |
| 257 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power)); | 258 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*granted_power)); |
| 258 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power)); | 259 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*extra_actor_power)); |
| 259 | req_power = devm_kcalloc(&tz->device, num_actors * 4, | 260 | BUILD_BUG_ON(sizeof(*req_power) != sizeof(*weighted_req_power)); |
| 261 | req_power = devm_kcalloc(&tz->device, num_actors * 5, | ||
| 260 | sizeof(*req_power), GFP_KERNEL); | 262 | sizeof(*req_power), GFP_KERNEL); |
| 261 | if (!req_power) { | 263 | if (!req_power) { |
| 262 | ret = -ENOMEM; | 264 | ret = -ENOMEM; |
| @@ -266,8 +268,10 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 266 | max_power = &req_power[num_actors]; | 268 | max_power = &req_power[num_actors]; |
| 267 | granted_power = &req_power[2 * num_actors]; | 269 | granted_power = &req_power[2 * num_actors]; |
| 268 | extra_actor_power = &req_power[3 * num_actors]; | 270 | extra_actor_power = &req_power[3 * num_actors]; |
| 271 | weighted_req_power = &req_power[4 * num_actors]; | ||
| 269 | 272 | ||
| 270 | i = 0; | 273 | i = 0; |
| 274 | total_weighted_req_power = 0; | ||
| 271 | total_req_power = 0; | 275 | total_req_power = 0; |
| 272 | max_allocatable_power = 0; | 276 | max_allocatable_power = 0; |
| 273 | 277 | ||
| @@ -289,13 +293,14 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 289 | else | 293 | else |
| 290 | weight = instance->weight; | 294 | weight = instance->weight; |
| 291 | 295 | ||
| 292 | req_power[i] = frac_to_int(weight * req_power[i]); | 296 | weighted_req_power[i] = frac_to_int(weight * req_power[i]); |
| 293 | 297 | ||
| 294 | if (power_actor_get_max_power(cdev, tz, &max_power[i])) | 298 | if (power_actor_get_max_power(cdev, tz, &max_power[i])) |
| 295 | continue; | 299 | continue; |
| 296 | 300 | ||
| 297 | total_req_power += req_power[i]; | 301 | total_req_power += req_power[i]; |
| 298 | max_allocatable_power += max_power[i]; | 302 | max_allocatable_power += max_power[i]; |
| 303 | total_weighted_req_power += weighted_req_power[i]; | ||
| 299 | 304 | ||
| 300 | i++; | 305 | i++; |
| 301 | } | 306 | } |
| @@ -303,8 +308,9 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 303 | power_range = pid_controller(tz, current_temp, control_temp, | 308 | power_range = pid_controller(tz, current_temp, control_temp, |
| 304 | max_allocatable_power); | 309 | max_allocatable_power); |
| 305 | 310 | ||
| 306 | divvy_up_power(req_power, max_power, num_actors, total_req_power, | 311 | divvy_up_power(weighted_req_power, max_power, num_actors, |
| 307 | power_range, granted_power, extra_actor_power); | 312 | total_weighted_req_power, power_range, granted_power, |
| 313 | extra_actor_power); | ||
| 308 | 314 | ||
| 309 | total_granted_power = 0; | 315 | total_granted_power = 0; |
| 310 | i = 0; | 316 | i = 0; |
| @@ -328,7 +334,7 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
| 328 | max_allocatable_power, current_temp, | 334 | max_allocatable_power, current_temp, |
| 329 | (s32)control_temp - (s32)current_temp); | 335 | (s32)control_temp - (s32)current_temp); |
| 330 | 336 | ||
| 331 | devm_kfree(&tz->device, req_power); | 337 | kfree(req_power); |
| 332 | unlock: | 338 | unlock: |
| 333 | mutex_unlock(&tz->lock); | 339 | mutex_unlock(&tz->lock); |
| 334 | 340 | ||
| @@ -420,7 +426,7 @@ static int power_allocator_bind(struct thermal_zone_device *tz) | |||
| 420 | return -EINVAL; | 426 | return -EINVAL; |
| 421 | } | 427 | } |
| 422 | 428 | ||
| 423 | params = devm_kzalloc(&tz->device, sizeof(*params), GFP_KERNEL); | 429 | params = kzalloc(sizeof(*params), GFP_KERNEL); |
| 424 | if (!params) | 430 | if (!params) |
| 425 | return -ENOMEM; | 431 | return -ENOMEM; |
| 426 | 432 | ||
| @@ -462,14 +468,14 @@ static int power_allocator_bind(struct thermal_zone_device *tz) | |||
| 462 | return 0; | 468 | return 0; |
| 463 | 469 | ||
| 464 | free: | 470 | free: |
| 465 | devm_kfree(&tz->device, params); | 471 | kfree(params); |
| 466 | return ret; | 472 | return ret; |
| 467 | } | 473 | } |
| 468 | 474 | ||
| 469 | static void power_allocator_unbind(struct thermal_zone_device *tz) | 475 | static void power_allocator_unbind(struct thermal_zone_device *tz) |
| 470 | { | 476 | { |
| 471 | dev_dbg(&tz->device, "Unbinding from thermal zone %d\n", tz->id); | 477 | dev_dbg(&tz->device, "Unbinding from thermal zone %d\n", tz->id); |
| 472 | devm_kfree(&tz->device, tz->governor_data); | 478 | kfree(tz->governor_data); |
| 473 | tz->governor_data = NULL; | 479 | tz->governor_data = NULL; |
| 474 | } | 480 | } |
| 475 | 481 | ||
diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index c8e35c1a43dc..e0da3865e060 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config EXYNOS_THERMAL | 1 | config EXYNOS_THERMAL |
| 2 | tristate "Exynos thermal management unit driver" | 2 | tristate "Exynos thermal management unit driver" |
| 3 | depends on OF | 3 | depends on THERMAL_OF |
| 4 | help | 4 | help |
| 5 | If you say yes here you get support for the TMU (Thermal Management | 5 | If you say yes here you get support for the TMU (Thermal Management |
| 6 | Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises | 6 | Unit) driver for SAMSUNG EXYNOS series of SoCs. This driver initialises |
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 531f4b179871..c96ff10b869e 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
| @@ -1296,7 +1296,6 @@ static struct thermal_zone_of_device_ops exynos_sensor_ops = { | |||
| 1296 | 1296 | ||
| 1297 | static int exynos_tmu_probe(struct platform_device *pdev) | 1297 | static int exynos_tmu_probe(struct platform_device *pdev) |
| 1298 | { | 1298 | { |
| 1299 | struct exynos_tmu_platform_data *pdata; | ||
| 1300 | struct exynos_tmu_data *data; | 1299 | struct exynos_tmu_data *data; |
| 1301 | int ret; | 1300 | int ret; |
| 1302 | 1301 | ||
| @@ -1318,8 +1317,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
| 1318 | if (ret) | 1317 | if (ret) |
| 1319 | goto err_sensor; | 1318 | goto err_sensor; |
| 1320 | 1319 | ||
| 1321 | pdata = data->pdata; | ||
| 1322 | |||
| 1323 | INIT_WORK(&data->irq_work, exynos_tmu_work); | 1320 | INIT_WORK(&data->irq_work, exynos_tmu_work); |
| 1324 | 1321 | ||
| 1325 | data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); | 1322 | data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); |
| @@ -1392,6 +1389,8 @@ err_clk_sec: | |||
| 1392 | if (!IS_ERR(data->clk_sec)) | 1389 | if (!IS_ERR(data->clk_sec)) |
| 1393 | clk_unprepare(data->clk_sec); | 1390 | clk_unprepare(data->clk_sec); |
| 1394 | err_sensor: | 1391 | err_sensor: |
| 1392 | if (!IS_ERR_OR_NULL(data->regulator)) | ||
| 1393 | regulator_disable(data->regulator); | ||
| 1395 | thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); | 1394 | thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); |
| 1396 | 1395 | ||
| 1397 | return ret; | 1396 | return ret; |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 04659bfb888b..4ca211be4c0f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
| @@ -1333,6 +1333,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, | |||
| 1333 | return -ENODEV; | 1333 | return -ENODEV; |
| 1334 | 1334 | ||
| 1335 | unbind: | 1335 | unbind: |
| 1336 | device_remove_file(&tz->device, &pos->weight_attr); | ||
| 1336 | device_remove_file(&tz->device, &pos->attr); | 1337 | device_remove_file(&tz->device, &pos->attr); |
| 1337 | sysfs_remove_link(&tz->device.kobj, pos->name); | 1338 | sysfs_remove_link(&tz->device.kobj, pos->name); |
| 1338 | release_idr(&tz->idr, &tz->lock, pos->id); | 1339 | release_idr(&tz->idr, &tz->lock, pos->id); |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 74fea4fa41b1..3ad48e1c0c57 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
| @@ -1024,7 +1024,18 @@ static struct platform_driver ci_hdrc_driver = { | |||
| 1024 | }, | 1024 | }, |
| 1025 | }; | 1025 | }; |
| 1026 | 1026 | ||
| 1027 | module_platform_driver(ci_hdrc_driver); | 1027 | static int __init ci_hdrc_platform_register(void) |
| 1028 | { | ||
| 1029 | ci_hdrc_host_driver_init(); | ||
| 1030 | return platform_driver_register(&ci_hdrc_driver); | ||
| 1031 | } | ||
| 1032 | module_init(ci_hdrc_platform_register); | ||
| 1033 | |||
| 1034 | static void __exit ci_hdrc_platform_unregister(void) | ||
| 1035 | { | ||
| 1036 | platform_driver_unregister(&ci_hdrc_driver); | ||
| 1037 | } | ||
| 1038 | module_exit(ci_hdrc_platform_unregister); | ||
| 1028 | 1039 | ||
| 1029 | MODULE_ALIAS("platform:ci_hdrc"); | 1040 | MODULE_ALIAS("platform:ci_hdrc"); |
| 1030 | MODULE_LICENSE("GPL v2"); | 1041 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 6cf87b8b13a8..7161439def19 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c | |||
| @@ -249,9 +249,12 @@ int ci_hdrc_host_init(struct ci_hdrc *ci) | |||
| 249 | rdrv->name = "host"; | 249 | rdrv->name = "host"; |
| 250 | ci->roles[CI_ROLE_HOST] = rdrv; | 250 | ci->roles[CI_ROLE_HOST] = rdrv; |
| 251 | 251 | ||
| 252 | return 0; | ||
| 253 | } | ||
| 254 | |||
| 255 | void ci_hdrc_host_driver_init(void) | ||
| 256 | { | ||
| 252 | ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides); | 257 | ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides); |
| 253 | orig_bus_suspend = ci_ehci_hc_driver.bus_suspend; | 258 | orig_bus_suspend = ci_ehci_hc_driver.bus_suspend; |
| 254 | ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend; | 259 | ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend; |
| 255 | |||
| 256 | return 0; | ||
| 257 | } | 260 | } |
diff --git a/drivers/usb/chipidea/host.h b/drivers/usb/chipidea/host.h index 5707bf379bfb..0f12f131bdd3 100644 --- a/drivers/usb/chipidea/host.h +++ b/drivers/usb/chipidea/host.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | int ci_hdrc_host_init(struct ci_hdrc *ci); | 6 | int ci_hdrc_host_init(struct ci_hdrc *ci); |
| 7 | void ci_hdrc_host_destroy(struct ci_hdrc *ci); | 7 | void ci_hdrc_host_destroy(struct ci_hdrc *ci); |
| 8 | void ci_hdrc_host_driver_init(void); | ||
| 8 | 9 | ||
| 9 | #else | 10 | #else |
| 10 | 11 | ||
| @@ -18,6 +19,11 @@ static inline void ci_hdrc_host_destroy(struct ci_hdrc *ci) | |||
| 18 | 19 | ||
| 19 | } | 20 | } |
| 20 | 21 | ||
| 22 | static void ci_hdrc_host_driver_init(void) | ||
| 23 | { | ||
| 24 | |||
| 25 | } | ||
| 26 | |||
| 21 | #endif | 27 | #endif |
| 22 | 28 | ||
| 23 | #endif /* __DRIVERS_USB_CHIPIDEA_HOST_H */ | 29 | #endif /* __DRIVERS_USB_CHIPIDEA_HOST_H */ |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index f7f35a36c09a..6df9715a4bcd 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
| @@ -699,6 +699,10 @@ static inline int hidg_get_minor(void) | |||
| 699 | int ret; | 699 | int ret; |
| 700 | 700 | ||
| 701 | ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL); | 701 | ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL); |
| 702 | if (ret >= HIDG_MINORS) { | ||
| 703 | ida_simple_remove(&hidg_ida, ret); | ||
| 704 | ret = -ENODEV; | ||
| 705 | } | ||
| 702 | 706 | ||
| 703 | return ret; | 707 | return ret; |
| 704 | } | 708 | } |
diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 44173df27273..357f63f47b42 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c | |||
| @@ -1248,7 +1248,15 @@ static struct config_item_type printer_func_type = { | |||
| 1248 | 1248 | ||
| 1249 | static inline int gprinter_get_minor(void) | 1249 | static inline int gprinter_get_minor(void) |
| 1250 | { | 1250 | { |
| 1251 | return ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL); | 1251 | int ret; |
| 1252 | |||
| 1253 | ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL); | ||
| 1254 | if (ret >= PRINTER_MINORS) { | ||
| 1255 | ida_simple_remove(&printer_ida, ret); | ||
| 1256 | ret = -ENODEV; | ||
| 1257 | } | ||
| 1258 | |||
| 1259 | return ret; | ||
| 1252 | } | 1260 | } |
| 1253 | 1261 | ||
| 1254 | static inline void gprinter_put_minor(int minor) | 1262 | static inline void gprinter_put_minor(int minor) |
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 6d3eb8b00a48..531861547253 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
| @@ -1162,14 +1162,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt) | |||
| 1162 | factor = 1000; | 1162 | factor = 1000; |
| 1163 | } else { | 1163 | } else { |
| 1164 | ep_desc = &hs_epin_desc; | 1164 | ep_desc = &hs_epin_desc; |
| 1165 | factor = 125; | 1165 | factor = 8000; |
| 1166 | } | 1166 | } |
| 1167 | 1167 | ||
| 1168 | /* pre-compute some values for iso_complete() */ | 1168 | /* pre-compute some values for iso_complete() */ |
| 1169 | uac2->p_framesize = opts->p_ssize * | 1169 | uac2->p_framesize = opts->p_ssize * |
| 1170 | num_channels(opts->p_chmask); | 1170 | num_channels(opts->p_chmask); |
| 1171 | rate = opts->p_srate * uac2->p_framesize; | 1171 | rate = opts->p_srate * uac2->p_framesize; |
| 1172 | uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor; | 1172 | uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1)); |
| 1173 | uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval, | 1173 | uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval, |
| 1174 | prm->max_psize); | 1174 | prm->max_psize); |
| 1175 | 1175 | ||
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c index b04980cf6dc4..1efa61265d8d 100644 --- a/drivers/usb/gadget/udc/bdc/bdc_ep.c +++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c | |||
| @@ -779,7 +779,7 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) | |||
| 779 | /* The current hw dequeue pointer */ | 779 | /* The current hw dequeue pointer */ |
| 780 | tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0)); | 780 | tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(0)); |
| 781 | deq_ptr_64 = tmp_32; | 781 | deq_ptr_64 = tmp_32; |
| 782 | tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS0(1)); | 782 | tmp_32 = bdc_readl(bdc->regs, BDC_EPSTS1(0)); |
| 783 | deq_ptr_64 |= ((u64)tmp_32 << 32); | 783 | deq_ptr_64 |= ((u64)tmp_32 << 32); |
| 784 | 784 | ||
| 785 | /* we have the dma addr of next bd that will be fetched by hardware */ | 785 | /* we have the dma addr of next bd that will be fetched by hardware */ |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 362ee8af5fce..89ed5e71a199 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
| @@ -323,6 +323,7 @@ err4: | |||
| 323 | 323 | ||
| 324 | err3: | 324 | err3: |
| 325 | put_device(&udc->dev); | 325 | put_device(&udc->dev); |
| 326 | device_del(&gadget->dev); | ||
| 326 | 327 | ||
| 327 | err2: | 328 | err2: |
| 328 | put_device(&gadget->dev); | 329 | put_device(&gadget->dev); |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 3e442f77a2b9..9a8c936cd42c 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -1792,7 +1792,8 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
| 1792 | int size; | 1792 | int size; |
| 1793 | int i, j, num_ports; | 1793 | int i, j, num_ports; |
| 1794 | 1794 | ||
| 1795 | del_timer_sync(&xhci->cmd_timer); | 1795 | if (timer_pending(&xhci->cmd_timer)) |
| 1796 | del_timer_sync(&xhci->cmd_timer); | ||
| 1796 | 1797 | ||
| 1797 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
| 1798 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1799 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6a8fc52aed58..32f4d564494a 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -82,7 +82,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, | |||
| 82 | return 0; | 82 | return 0; |
| 83 | /* offset in TRBs */ | 83 | /* offset in TRBs */ |
| 84 | segment_offset = trb - seg->trbs; | 84 | segment_offset = trb - seg->trbs; |
| 85 | if (segment_offset > TRBS_PER_SEGMENT) | 85 | if (segment_offset >= TRBS_PER_SEGMENT) |
| 86 | return 0; | 86 | return 0; |
| 87 | return seg->dma + (segment_offset * sizeof(*trb)); | 87 | return seg->dma + (segment_offset * sizeof(*trb)); |
| 88 | } | 88 | } |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 19b85ee98a72..876423b8892c 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -1099,6 +1099,8 @@ static const struct usb_device_id option_ids[] = { | |||
| 1099 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | 1099 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
| 1100 | { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), | 1100 | { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x68c0, 0xff), |
| 1101 | .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ | 1101 | .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC73xx */ |
| 1102 | { USB_DEVICE_INTERFACE_CLASS(SIERRA_VENDOR_ID, 0x9041, 0xff), | ||
| 1103 | .driver_info = (kernel_ulong_t)&sierra_mc73xx_blacklist }, /* MC7305/MC7355 */ | ||
| 1102 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, | 1104 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
| 1103 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, | 1105 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
| 1104 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), | 1106 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 9c63897b3a56..d156545728c2 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -145,7 +145,6 @@ static const struct usb_device_id id_table[] = { | |||
| 145 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ | 145 | {DEVICE_SWI(0x1199, 0x901c)}, /* Sierra Wireless EM7700 */ |
| 146 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ | 146 | {DEVICE_SWI(0x1199, 0x901f)}, /* Sierra Wireless EM7355 */ |
| 147 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ | 147 | {DEVICE_SWI(0x1199, 0x9040)}, /* Sierra Wireless Modem */ |
| 148 | {DEVICE_SWI(0x1199, 0x9041)}, /* Sierra Wireless MC7305/MC7355 */ | ||
| 149 | {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */ | 148 | {DEVICE_SWI(0x1199, 0x9051)}, /* Netgear AirCard 340U */ |
| 150 | {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */ | 149 | {DEVICE_SWI(0x1199, 0x9053)}, /* Sierra Wireless Modem */ |
| 151 | {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */ | 150 | {DEVICE_SWI(0x1199, 0x9054)}, /* Sierra Wireless Modem */ |
| @@ -158,6 +157,7 @@ static const struct usb_device_id id_table[] = { | |||
| 158 | {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ | 157 | {DEVICE_SWI(0x413c, 0x81a4)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */ |
| 159 | {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ | 158 | {DEVICE_SWI(0x413c, 0x81a8)}, /* Dell Wireless 5808 Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 160 | {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ | 159 | {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */ |
| 160 | {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */ | ||
| 161 | 161 | ||
| 162 | /* Huawei devices */ | 162 | /* Huawei devices */ |
| 163 | {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */ | 163 | {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */ |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 46179a0828eb..07d1ecd564f7 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -289,6 +289,7 @@ static const struct usb_device_id id_table[] = { | |||
| 289 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), | 289 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), |
| 290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
| 291 | }, | 291 | }, |
| 292 | { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */ | ||
| 292 | /* AT&T Direct IP LTE modems */ | 293 | /* AT&T Direct IP LTE modems */ |
| 293 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), | 294 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), |
| 294 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 295 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 658c34bb9076..1aaf89300621 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
| @@ -1306,10 +1306,11 @@ static void fbcon_cursor(struct vc_data *vc, int mode) | |||
| 1306 | int y; | 1306 | int y; |
| 1307 | int c = scr_readw((u16 *) vc->vc_pos); | 1307 | int c = scr_readw((u16 *) vc->vc_pos); |
| 1308 | 1308 | ||
| 1309 | ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); | ||
| 1310 | |||
| 1309 | if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) | 1311 | if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1) |
| 1310 | return; | 1312 | return; |
| 1311 | 1313 | ||
| 1312 | ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); | ||
| 1313 | if (vc->vc_cursor_type & 0x10) | 1314 | if (vc->vc_cursor_type & 0x10) |
| 1314 | fbcon_del_cursor_timer(info); | 1315 | fbcon_del_cursor_timer(info); |
| 1315 | else | 1316 | else |
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 2d98de535e0f..f888561568d9 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig | |||
| @@ -298,7 +298,7 @@ config FB_ARMCLCD | |||
| 298 | 298 | ||
| 299 | # Helper logic selected only by the ARM Versatile platform family. | 299 | # Helper logic selected only by the ARM Versatile platform family. |
| 300 | config PLAT_VERSATILE_CLCD | 300 | config PLAT_VERSATILE_CLCD |
| 301 | def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS | 301 | def_bool ARCH_VERSATILE || ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_INTEGRATOR |
| 302 | depends on ARM | 302 | depends on ARM |
| 303 | depends on FB_ARMCLCD && FB=y | 303 | depends on FB_ARMCLCD && FB=y |
| 304 | 304 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dss-of.c b/drivers/video/fbdev/omap2/dss/dss-of.c index 928ee639c0c1..bf407b6ba15c 100644 --- a/drivers/video/fbdev/omap2/dss/dss-of.c +++ b/drivers/video/fbdev/omap2/dss/dss-of.c | |||
| @@ -60,6 +60,8 @@ omapdss_of_get_next_port(const struct device_node *parent, | |||
| 60 | } | 60 | } |
| 61 | prev = port; | 61 | prev = port; |
| 62 | } while (of_node_cmp(port->name, "port") != 0); | 62 | } while (of_node_cmp(port->name, "port") != 0); |
| 63 | |||
| 64 | of_node_put(ports); | ||
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | return port; | 67 | return port; |
| @@ -94,7 +96,7 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port) | |||
| 94 | if (!port) | 96 | if (!port) |
| 95 | return NULL; | 97 | return NULL; |
| 96 | 98 | ||
| 97 | np = of_get_next_parent(port); | 99 | np = of_get_parent(port); |
| 98 | 100 | ||
| 99 | for (i = 0; i < 2 && np; ++i) { | 101 | for (i = 0; i < 2 && np; ++i) { |
| 100 | struct property *prop; | 102 | struct property *prop; |
diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 86bd457d039d..50bce45e7f3d 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c | |||
| @@ -653,7 +653,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) | |||
| 653 | goto err_free_dma; | 653 | goto err_free_dma; |
| 654 | } | 654 | } |
| 655 | 655 | ||
| 656 | ret = clk_enable(priv->clk); | 656 | ret = clk_prepare_enable(priv->clk); |
| 657 | if (ret < 0) { | 657 | if (ret < 0) { |
| 658 | dev_err(dev, "failed to enable clock\n"); | 658 | dev_err(dev, "failed to enable clock\n"); |
| 659 | goto err_misc_deregister; | 659 | goto err_misc_deregister; |
| @@ -685,7 +685,7 @@ err_misc_deregister: | |||
| 685 | misc_deregister(&priv->misc_dev); | 685 | misc_deregister(&priv->misc_dev); |
| 686 | 686 | ||
| 687 | err_disable_clk: | 687 | err_disable_clk: |
| 688 | clk_disable(priv->clk); | 688 | clk_disable_unprepare(priv->clk); |
| 689 | 689 | ||
| 690 | return ret; | 690 | return ret; |
| 691 | } | 691 | } |
diff --git a/drivers/video/of_videomode.c b/drivers/video/of_videomode.c index 111c2d1911d3..b5102aa6090d 100644 --- a/drivers/video/of_videomode.c +++ b/drivers/video/of_videomode.c | |||
| @@ -44,11 +44,9 @@ int of_get_videomode(struct device_node *np, struct videomode *vm, | |||
| 44 | index = disp->native_mode; | 44 | index = disp->native_mode; |
| 45 | 45 | ||
| 46 | ret = videomode_from_timings(disp, vm, index); | 46 | ret = videomode_from_timings(disp, vm, index); |
| 47 | if (ret) | ||
| 48 | return ret; | ||
| 49 | 47 | ||
| 50 | display_timings_release(disp); | 48 | display_timings_release(disp); |
| 51 | 49 | ||
| 52 | return 0; | 50 | return ret; |
| 53 | } | 51 | } |
| 54 | EXPORT_SYMBOL_GPL(of_get_videomode); | 52 | EXPORT_SYMBOL_GPL(of_get_videomode); |
diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c index 60e2a1677563..c96944b59856 100644 --- a/drivers/virtio/virtio_input.c +++ b/drivers/virtio/virtio_input.c | |||
| @@ -313,6 +313,7 @@ err_init_vq: | |||
| 313 | static void virtinput_remove(struct virtio_device *vdev) | 313 | static void virtinput_remove(struct virtio_device *vdev) |
| 314 | { | 314 | { |
| 315 | struct virtio_input *vi = vdev->priv; | 315 | struct virtio_input *vi = vdev->priv; |
| 316 | void *buf; | ||
| 316 | unsigned long flags; | 317 | unsigned long flags; |
| 317 | 318 | ||
| 318 | spin_lock_irqsave(&vi->lock, flags); | 319 | spin_lock_irqsave(&vi->lock, flags); |
| @@ -320,6 +321,9 @@ static void virtinput_remove(struct virtio_device *vdev) | |||
| 320 | spin_unlock_irqrestore(&vi->lock, flags); | 321 | spin_unlock_irqrestore(&vi->lock, flags); |
| 321 | 322 | ||
| 322 | input_unregister_device(vi->idev); | 323 | input_unregister_device(vi->idev); |
| 324 | vdev->config->reset(vdev); | ||
| 325 | while ((buf = virtqueue_detach_unused_buf(vi->sts)) != NULL) | ||
| 326 | kfree(buf); | ||
| 323 | vdev->config->del_vqs(vdev); | 327 | vdev->config->del_vqs(vdev); |
| 324 | kfree(vi); | 328 | kfree(vi); |
| 325 | } | 329 | } |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index fd933695f232..bf4a23c7c591 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -472,7 +472,7 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | /* | 474 | /* |
| 475 | * We avoid multiple worker processes conflicting via the balloon mutex. | 475 | * As this is a work item it is guaranteed to run as a single instance only. |
| 476 | * We may of course race updates of the target counts (which are protected | 476 | * We may of course race updates of the target counts (which are protected |
| 477 | * by the balloon lock), or with changes to the Xen hard limit, but we will | 477 | * by the balloon lock), or with changes to the Xen hard limit, but we will |
| 478 | * recover from these in time. | 478 | * recover from these in time. |
| @@ -482,9 +482,10 @@ static void balloon_process(struct work_struct *work) | |||
| 482 | enum bp_state state = BP_DONE; | 482 | enum bp_state state = BP_DONE; |
| 483 | long credit; | 483 | long credit; |
| 484 | 484 | ||
| 485 | mutex_lock(&balloon_mutex); | ||
| 486 | 485 | ||
| 487 | do { | 486 | do { |
| 487 | mutex_lock(&balloon_mutex); | ||
| 488 | |||
| 488 | credit = current_credit(); | 489 | credit = current_credit(); |
| 489 | 490 | ||
| 490 | if (credit > 0) { | 491 | if (credit > 0) { |
| @@ -499,17 +500,15 @@ static void balloon_process(struct work_struct *work) | |||
| 499 | 500 | ||
| 500 | state = update_schedule(state); | 501 | state = update_schedule(state); |
| 501 | 502 | ||
| 502 | #ifndef CONFIG_PREEMPT | 503 | mutex_unlock(&balloon_mutex); |
| 503 | if (need_resched()) | 504 | |
| 504 | schedule(); | 505 | cond_resched(); |
| 505 | #endif | 506 | |
| 506 | } while (credit && state == BP_DONE); | 507 | } while (credit && state == BP_DONE); |
| 507 | 508 | ||
| 508 | /* Schedule more work if there is some still to be done. */ | 509 | /* Schedule more work if there is some still to be done. */ |
| 509 | if (state == BP_EAGAIN) | 510 | if (state == BP_EAGAIN) |
| 510 | schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); | 511 | schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); |
| 511 | |||
| 512 | mutex_unlock(&balloon_mutex); | ||
| 513 | } | 512 | } |
| 514 | 513 | ||
| 515 | /* Resets the Xen limit, sets new target, and kicks off processing. */ | 514 | /* Resets the Xen limit, sets new target, and kicks off processing. */ |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 67b9163db718..0dbb222daaf1 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
| @@ -568,12 +568,14 @@ static int gntdev_release(struct inode *inode, struct file *flip) | |||
| 568 | 568 | ||
| 569 | pr_debug("priv %p\n", priv); | 569 | pr_debug("priv %p\n", priv); |
| 570 | 570 | ||
| 571 | mutex_lock(&priv->lock); | ||
| 571 | while (!list_empty(&priv->maps)) { | 572 | while (!list_empty(&priv->maps)) { |
| 572 | map = list_entry(priv->maps.next, struct grant_map, next); | 573 | map = list_entry(priv->maps.next, struct grant_map, next); |
| 573 | list_del(&map->next); | 574 | list_del(&map->next); |
| 574 | gntdev_put_map(NULL /* already removed */, map); | 575 | gntdev_put_map(NULL /* already removed */, map); |
| 575 | } | 576 | } |
| 576 | WARN_ON(!list_empty(&priv->freeable_maps)); | 577 | WARN_ON(!list_empty(&priv->freeable_maps)); |
| 578 | mutex_unlock(&priv->lock); | ||
| 577 | 579 | ||
| 578 | if (use_ptemod) | 580 | if (use_ptemod) |
| 579 | mmu_notifier_unregister(&priv->mn, priv->mm); | 581 | mmu_notifier_unregister(&priv->mn, priv->mm); |
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index 9ad327238ba9..e30353575d5d 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c | |||
| @@ -814,8 +814,10 @@ static int xenbus_unmap_ring_vfree_hvm(struct xenbus_device *dev, void *vaddr) | |||
| 814 | 814 | ||
| 815 | rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles, | 815 | rv = xenbus_unmap_ring(dev, node->handles, node->nr_handles, |
| 816 | addrs); | 816 | addrs); |
| 817 | if (!rv) | 817 | if (!rv) { |
| 818 | vunmap(vaddr); | 818 | vunmap(vaddr); |
| 819 | free_xenballooned_pages(node->nr_handles, node->hvm.pages); | ||
| 820 | } | ||
| 819 | else | 821 | else |
| 820 | WARN(1, "Leaking %p, size %u page(s)\n", vaddr, | 822 | WARN(1, "Leaking %p, size %u page(s)\n", vaddr, |
| 821 | node->nr_handles); | 823 | node->nr_handles); |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index e9ace099162c..8a8202956576 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
| @@ -1651,6 +1651,11 @@ static int qgroup_update_counters(struct btrfs_fs_info *fs_info, | |||
| 1651 | /* Exclusive -> exclusive, nothing changed */ | 1651 | /* Exclusive -> exclusive, nothing changed */ |
| 1652 | } | 1652 | } |
| 1653 | } | 1653 | } |
| 1654 | |||
| 1655 | /* For exclusive extent, free its reserved bytes too */ | ||
| 1656 | if (nr_old_roots == 0 && nr_new_roots == 1 && | ||
| 1657 | cur_new_count == nr_new_roots) | ||
| 1658 | qg->reserved -= num_bytes; | ||
| 1654 | if (dirty) | 1659 | if (dirty) |
| 1655 | qgroup_dirty(fs_info, qg); | 1660 | qgroup_dirty(fs_info, qg); |
| 1656 | } | 1661 | } |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index dc10c9dd36c1..ddd5e9471290 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
| @@ -1506,7 +1506,6 @@ static int __mark_caps_flushing(struct inode *inode, | |||
| 1506 | 1506 | ||
| 1507 | swap(cf, ci->i_prealloc_cap_flush); | 1507 | swap(cf, ci->i_prealloc_cap_flush); |
| 1508 | cf->caps = flushing; | 1508 | cf->caps = flushing; |
| 1509 | cf->kick = false; | ||
| 1510 | 1509 | ||
| 1511 | spin_lock(&mdsc->cap_dirty_lock); | 1510 | spin_lock(&mdsc->cap_dirty_lock); |
| 1512 | list_del_init(&ci->i_dirty_item); | 1511 | list_del_init(&ci->i_dirty_item); |
| @@ -2123,8 +2122,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
| 2123 | 2122 | ||
| 2124 | static int __kick_flushing_caps(struct ceph_mds_client *mdsc, | 2123 | static int __kick_flushing_caps(struct ceph_mds_client *mdsc, |
| 2125 | struct ceph_mds_session *session, | 2124 | struct ceph_mds_session *session, |
| 2126 | struct ceph_inode_info *ci, | 2125 | struct ceph_inode_info *ci) |
| 2127 | bool kick_all) | ||
| 2128 | { | 2126 | { |
| 2129 | struct inode *inode = &ci->vfs_inode; | 2127 | struct inode *inode = &ci->vfs_inode; |
| 2130 | struct ceph_cap *cap; | 2128 | struct ceph_cap *cap; |
| @@ -2150,9 +2148,7 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 2150 | 2148 | ||
| 2151 | for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) { | 2149 | for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) { |
| 2152 | cf = rb_entry(n, struct ceph_cap_flush, i_node); | 2150 | cf = rb_entry(n, struct ceph_cap_flush, i_node); |
| 2153 | if (cf->tid < first_tid) | 2151 | if (cf->tid >= first_tid) |
| 2154 | continue; | ||
| 2155 | if (kick_all || cf->kick) | ||
| 2156 | break; | 2152 | break; |
| 2157 | } | 2153 | } |
| 2158 | if (!n) { | 2154 | if (!n) { |
| @@ -2161,7 +2157,6 @@ static int __kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 2161 | } | 2157 | } |
| 2162 | 2158 | ||
| 2163 | cf = rb_entry(n, struct ceph_cap_flush, i_node); | 2159 | cf = rb_entry(n, struct ceph_cap_flush, i_node); |
| 2164 | cf->kick = false; | ||
| 2165 | 2160 | ||
| 2166 | first_tid = cf->tid + 1; | 2161 | first_tid = cf->tid + 1; |
| 2167 | 2162 | ||
| @@ -2181,8 +2176,6 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 2181 | { | 2176 | { |
| 2182 | struct ceph_inode_info *ci; | 2177 | struct ceph_inode_info *ci; |
| 2183 | struct ceph_cap *cap; | 2178 | struct ceph_cap *cap; |
| 2184 | struct ceph_cap_flush *cf; | ||
| 2185 | struct rb_node *n; | ||
| 2186 | 2179 | ||
| 2187 | dout("early_kick_flushing_caps mds%d\n", session->s_mds); | 2180 | dout("early_kick_flushing_caps mds%d\n", session->s_mds); |
| 2188 | list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { | 2181 | list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { |
| @@ -2205,16 +2198,11 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 2205 | if ((cap->issued & ci->i_flushing_caps) != | 2198 | if ((cap->issued & ci->i_flushing_caps) != |
| 2206 | ci->i_flushing_caps) { | 2199 | ci->i_flushing_caps) { |
| 2207 | spin_unlock(&ci->i_ceph_lock); | 2200 | spin_unlock(&ci->i_ceph_lock); |
| 2208 | if (!__kick_flushing_caps(mdsc, session, ci, true)) | 2201 | if (!__kick_flushing_caps(mdsc, session, ci)) |
| 2209 | continue; | 2202 | continue; |
| 2210 | spin_lock(&ci->i_ceph_lock); | 2203 | spin_lock(&ci->i_ceph_lock); |
| 2211 | } | 2204 | } |
| 2212 | 2205 | ||
| 2213 | for (n = rb_first(&ci->i_cap_flush_tree); n; n = rb_next(n)) { | ||
| 2214 | cf = rb_entry(n, struct ceph_cap_flush, i_node); | ||
| 2215 | cf->kick = true; | ||
| 2216 | } | ||
| 2217 | |||
| 2218 | spin_unlock(&ci->i_ceph_lock); | 2206 | spin_unlock(&ci->i_ceph_lock); |
| 2219 | } | 2207 | } |
| 2220 | } | 2208 | } |
| @@ -2228,7 +2216,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | |||
| 2228 | 2216 | ||
| 2229 | dout("kick_flushing_caps mds%d\n", session->s_mds); | 2217 | dout("kick_flushing_caps mds%d\n", session->s_mds); |
| 2230 | list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { | 2218 | list_for_each_entry(ci, &session->s_cap_flushing, i_flushing_item) { |
| 2231 | int delayed = __kick_flushing_caps(mdsc, session, ci, false); | 2219 | int delayed = __kick_flushing_caps(mdsc, session, ci); |
| 2232 | if (delayed) { | 2220 | if (delayed) { |
| 2233 | spin_lock(&ci->i_ceph_lock); | 2221 | spin_lock(&ci->i_ceph_lock); |
| 2234 | __cap_delay_requeue(mdsc, ci); | 2222 | __cap_delay_requeue(mdsc, ci); |
| @@ -2261,7 +2249,7 @@ static void kick_flushing_inode_caps(struct ceph_mds_client *mdsc, | |||
| 2261 | 2249 | ||
| 2262 | spin_unlock(&ci->i_ceph_lock); | 2250 | spin_unlock(&ci->i_ceph_lock); |
| 2263 | 2251 | ||
| 2264 | delayed = __kick_flushing_caps(mdsc, session, ci, true); | 2252 | delayed = __kick_flushing_caps(mdsc, session, ci); |
| 2265 | if (delayed) { | 2253 | if (delayed) { |
| 2266 | spin_lock(&ci->i_ceph_lock); | 2254 | spin_lock(&ci->i_ceph_lock); |
| 2267 | __cap_delay_requeue(mdsc, ci); | 2255 | __cap_delay_requeue(mdsc, ci); |
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c index 4347039ecc18..6706bde9ad1b 100644 --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c | |||
| @@ -287,7 +287,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode, | |||
| 287 | return 0; | 287 | return 0; |
| 288 | 288 | ||
| 289 | spin_lock(&ctx->flc_lock); | 289 | spin_lock(&ctx->flc_lock); |
| 290 | list_for_each_entry(lock, &ctx->flc_flock, fl_list) { | 290 | list_for_each_entry(lock, &ctx->flc_posix, fl_list) { |
| 291 | ++seen_fcntl; | 291 | ++seen_fcntl; |
| 292 | if (seen_fcntl > num_fcntl_locks) { | 292 | if (seen_fcntl > num_fcntl_locks) { |
| 293 | err = -ENOSPC; | 293 | err = -ENOSPC; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 860cc016e70d..2f2460d23a06 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
| @@ -189,7 +189,6 @@ static inline void ceph_put_cap_snap(struct ceph_cap_snap *capsnap) | |||
| 189 | struct ceph_cap_flush { | 189 | struct ceph_cap_flush { |
| 190 | u64 tid; | 190 | u64 tid; |
| 191 | int caps; | 191 | int caps; |
| 192 | bool kick; | ||
| 193 | struct rb_node g_node; // global | 192 | struct rb_node g_node; // global |
| 194 | union { | 193 | union { |
| 195 | struct rb_node i_node; // inode | 194 | struct rb_node i_node; // inode |
diff --git a/fs/dcache.c b/fs/dcache.c index 5c8ea15e73a5..9b5fe503f6cb 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
| @@ -3442,22 +3442,15 @@ void __init vfs_caches_init_early(void) | |||
| 3442 | inode_init_early(); | 3442 | inode_init_early(); |
| 3443 | } | 3443 | } |
| 3444 | 3444 | ||
| 3445 | void __init vfs_caches_init(unsigned long mempages) | 3445 | void __init vfs_caches_init(void) |
| 3446 | { | 3446 | { |
| 3447 | unsigned long reserve; | ||
| 3448 | |||
| 3449 | /* Base hash sizes on available memory, with a reserve equal to | ||
| 3450 | 150% of current kernel size */ | ||
| 3451 | |||
| 3452 | reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1); | ||
| 3453 | mempages -= reserve; | ||
| 3454 | |||
| 3455 | names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, | 3447 | names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, |
| 3456 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | 3448 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); |
| 3457 | 3449 | ||
| 3458 | dcache_init(); | 3450 | dcache_init(); |
| 3459 | inode_init(); | 3451 | inode_init(); |
| 3460 | files_init(mempages); | 3452 | files_init(); |
| 3453 | files_maxfiles_init(); | ||
| 3461 | mnt_init(); | 3454 | mnt_init(); |
| 3462 | bdev_cache_init(); | 3455 | bdev_cache_init(); |
| 3463 | chrdev_init(); | 3456 | chrdev_init(); |
diff --git a/fs/file_table.c b/fs/file_table.c index 7f9d407c7595..ad17e05ebf95 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/hardirq.h> | 25 | #include <linux/hardirq.h> |
| 26 | #include <linux/task_work.h> | 26 | #include <linux/task_work.h> |
| 27 | #include <linux/ima.h> | 27 | #include <linux/ima.h> |
| 28 | #include <linux/swap.h> | ||
| 28 | 29 | ||
| 29 | #include <linux/atomic.h> | 30 | #include <linux/atomic.h> |
| 30 | 31 | ||
| @@ -308,19 +309,24 @@ void put_filp(struct file *file) | |||
| 308 | } | 309 | } |
| 309 | } | 310 | } |
| 310 | 311 | ||
| 311 | void __init files_init(unsigned long mempages) | 312 | void __init files_init(void) |
| 312 | { | 313 | { |
| 313 | unsigned long n; | ||
| 314 | |||
| 315 | filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, | 314 | filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, |
| 316 | SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); | 315 | SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); |
| 316 | percpu_counter_init(&nr_files, 0, GFP_KERNEL); | ||
| 317 | } | ||
| 317 | 318 | ||
| 318 | /* | 319 | /* |
| 319 | * One file with associated inode and dcache is very roughly 1K. | 320 | * One file with associated inode and dcache is very roughly 1K. Per default |
| 320 | * Per default don't use more than 10% of our memory for files. | 321 | * do not use more than 10% of our memory for files. |
| 321 | */ | 322 | */ |
| 323 | void __init files_maxfiles_init(void) | ||
| 324 | { | ||
| 325 | unsigned long n; | ||
| 326 | unsigned long memreserve = (totalram_pages - nr_free_pages()) * 3/2; | ||
| 327 | |||
| 328 | memreserve = min(memreserve, totalram_pages - 1); | ||
| 329 | n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10; | ||
| 322 | 330 | ||
| 323 | n = (mempages * (PAGE_SIZE / 1024)) / 10; | ||
| 324 | files_stat.max_files = max_t(unsigned long, n, NR_FILE); | 331 | files_stat.max_files = max_t(unsigned long, n, NR_FILE); |
| 325 | percpu_counter_init(&nr_files, 0, GFP_KERNEL); | ||
| 326 | } | 332 | } |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 518c6294bf6c..5fa588e933d5 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -844,14 +844,15 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi, | |||
| 844 | struct wb_iter iter; | 844 | struct wb_iter iter; |
| 845 | 845 | ||
| 846 | might_sleep(); | 846 | might_sleep(); |
| 847 | |||
| 848 | if (!bdi_has_dirty_io(bdi)) | ||
| 849 | return; | ||
| 850 | restart: | 847 | restart: |
| 851 | rcu_read_lock(); | 848 | rcu_read_lock(); |
| 852 | bdi_for_each_wb(wb, bdi, &iter, next_blkcg_id) { | 849 | bdi_for_each_wb(wb, bdi, &iter, next_blkcg_id) { |
| 853 | if (!wb_has_dirty_io(wb) || | 850 | /* SYNC_ALL writes out I_DIRTY_TIME too */ |
| 854 | (skip_if_busy && writeback_in_progress(wb))) | 851 | if (!wb_has_dirty_io(wb) && |
| 852 | (base_work->sync_mode == WB_SYNC_NONE || | ||
| 853 | list_empty(&wb->b_dirty_time))) | ||
| 854 | continue; | ||
| 855 | if (skip_if_busy && writeback_in_progress(wb)) | ||
| 855 | continue; | 856 | continue; |
| 856 | 857 | ||
| 857 | base_work->nr_pages = wb_split_bdi_pages(wb, nr_pages); | 858 | base_work->nr_pages = wb_split_bdi_pages(wb, nr_pages); |
| @@ -899,8 +900,7 @@ static void bdi_split_work_to_wbs(struct backing_dev_info *bdi, | |||
| 899 | { | 900 | { |
| 900 | might_sleep(); | 901 | might_sleep(); |
| 901 | 902 | ||
| 902 | if (bdi_has_dirty_io(bdi) && | 903 | if (!skip_if_busy || !writeback_in_progress(&bdi->wb)) { |
| 903 | (!skip_if_busy || !writeback_in_progress(&bdi->wb))) { | ||
| 904 | base_work->auto_free = 0; | 904 | base_work->auto_free = 0; |
| 905 | base_work->single_wait = 0; | 905 | base_work->single_wait = 0; |
| 906 | base_work->single_done = 0; | 906 | base_work->single_done = 0; |
| @@ -2275,8 +2275,12 @@ void sync_inodes_sb(struct super_block *sb) | |||
| 2275 | }; | 2275 | }; |
| 2276 | struct backing_dev_info *bdi = sb->s_bdi; | 2276 | struct backing_dev_info *bdi = sb->s_bdi; |
| 2277 | 2277 | ||
| 2278 | /* Nothing to do? */ | 2278 | /* |
| 2279 | if (!bdi_has_dirty_io(bdi) || bdi == &noop_backing_dev_info) | 2279 | * Can't skip on !bdi_has_dirty() because we should wait for !dirty |
| 2280 | * inodes under writeback and I_DIRTY_TIME inodes ignored by | ||
| 2281 | * bdi_has_dirty() need to be written out too. | ||
| 2282 | */ | ||
| 2283 | if (bdi == &noop_backing_dev_info) | ||
| 2280 | return; | 2284 | return; |
| 2281 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); | 2285 | WARN_ON(!rwsem_is_locked(&sb->s_umount)); |
| 2282 | 2286 | ||
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 80cc1b35d460..ebb5e37455a0 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -2246,7 +2246,15 @@ static long fuse_dev_ioctl(struct file *file, unsigned int cmd, | |||
| 2246 | 2246 | ||
| 2247 | err = -EINVAL; | 2247 | err = -EINVAL; |
| 2248 | if (old) { | 2248 | if (old) { |
| 2249 | struct fuse_dev *fud = fuse_get_dev(old); | 2249 | struct fuse_dev *fud = NULL; |
| 2250 | |||
| 2251 | /* | ||
| 2252 | * Check against file->f_op because CUSE | ||
| 2253 | * uses the same ioctl handler. | ||
| 2254 | */ | ||
| 2255 | if (old->f_op == file->f_op && | ||
| 2256 | old->f_cred->user_ns == file->f_cred->user_ns) | ||
| 2257 | fud = fuse_get_dev(old); | ||
| 2250 | 2258 | ||
| 2251 | if (fud) { | 2259 | if (fud) { |
| 2252 | mutex_lock(&fuse_mutex); | 2260 | mutex_lock(&fuse_mutex); |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 0cf74df68617..973c24ce59ad 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
| @@ -1010,6 +1010,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size, | |||
| 1010 | inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0); | 1010 | inode = hugetlbfs_get_inode(sb, NULL, S_IFREG | S_IRWXUGO, 0); |
| 1011 | if (!inode) | 1011 | if (!inode) |
| 1012 | goto out_dentry; | 1012 | goto out_dentry; |
| 1013 | if (creat_flags == HUGETLB_SHMFS_INODE) | ||
| 1014 | inode->i_flags |= S_PRIVATE; | ||
| 1013 | 1015 | ||
| 1014 | file = ERR_PTR(-ENOMEM); | 1016 | file = ERR_PTR(-ENOMEM); |
| 1015 | if (hugetlb_reserve_pages(inode, 0, | 1017 | if (hugetlb_reserve_pages(inode, 0, |
diff --git a/fs/namei.c b/fs/namei.c index fbbcf0993312..1c2105ed20c5 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -879,7 +879,7 @@ static inline int may_follow_link(struct nameidata *nd) | |||
| 879 | return 0; | 879 | return 0; |
| 880 | 880 | ||
| 881 | /* Allowed if parent directory not sticky and world-writable. */ | 881 | /* Allowed if parent directory not sticky and world-writable. */ |
| 882 | parent = nd->path.dentry->d_inode; | 882 | parent = nd->inode; |
| 883 | if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH)) | 883 | if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH)) |
| 884 | return 0; | 884 | return 0; |
| 885 | 885 | ||
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 6904213a4363..ebf90e487c75 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c | |||
| @@ -212,6 +212,7 @@ nfsd4_alloc_layout_stateid(struct nfsd4_compound_state *cstate, | |||
| 212 | BUG_ON(!ls->ls_file); | 212 | BUG_ON(!ls->ls_file); |
| 213 | 213 | ||
| 214 | if (nfsd4_layout_setlease(ls)) { | 214 | if (nfsd4_layout_setlease(ls)) { |
| 215 | fput(ls->ls_file); | ||
| 215 | put_nfs4_file(fp); | 216 | put_nfs4_file(fp); |
| 216 | kmem_cache_free(nfs4_layout_stateid_cache, ls); | 217 | kmem_cache_free(nfs4_layout_stateid_cache, ls); |
| 217 | return NULL; | 218 | return NULL; |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 61dfb33f0559..95202719a1fd 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -4396,9 +4396,9 @@ laundromat_main(struct work_struct *laundry) | |||
| 4396 | queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ); | 4396 | queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ); |
| 4397 | } | 4397 | } |
| 4398 | 4398 | ||
| 4399 | static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_ol_stateid *stp) | 4399 | static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp) |
| 4400 | { | 4400 | { |
| 4401 | if (!fh_match(&fhp->fh_handle, &stp->st_stid.sc_file->fi_fhandle)) | 4401 | if (!fh_match(&fhp->fh_handle, &stp->sc_file->fi_fhandle)) |
| 4402 | return nfserr_bad_stateid; | 4402 | return nfserr_bad_stateid; |
| 4403 | return nfs_ok; | 4403 | return nfs_ok; |
| 4404 | } | 4404 | } |
| @@ -4601,9 +4601,6 @@ nfs4_check_olstateid(struct svc_fh *fhp, struct nfs4_ol_stateid *ols, int flags) | |||
| 4601 | { | 4601 | { |
| 4602 | __be32 status; | 4602 | __be32 status; |
| 4603 | 4603 | ||
| 4604 | status = nfs4_check_fh(fhp, ols); | ||
| 4605 | if (status) | ||
| 4606 | return status; | ||
| 4607 | status = nfsd4_check_openowner_confirmed(ols); | 4604 | status = nfsd4_check_openowner_confirmed(ols); |
| 4608 | if (status) | 4605 | if (status) |
| 4609 | return status; | 4606 | return status; |
| @@ -4690,6 +4687,9 @@ nfs4_preprocess_stateid_op(struct svc_rqst *rqstp, | |||
| 4690 | status = nfserr_bad_stateid; | 4687 | status = nfserr_bad_stateid; |
| 4691 | break; | 4688 | break; |
| 4692 | } | 4689 | } |
| 4690 | if (status) | ||
| 4691 | goto out; | ||
| 4692 | status = nfs4_check_fh(fhp, s); | ||
| 4693 | 4693 | ||
| 4694 | done: | 4694 | done: |
| 4695 | if (!status && filpp) | 4695 | if (!status && filpp) |
| @@ -4798,7 +4798,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ | |||
| 4798 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); | 4798 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); |
| 4799 | if (status) | 4799 | if (status) |
| 4800 | return status; | 4800 | return status; |
| 4801 | return nfs4_check_fh(current_fh, stp); | 4801 | return nfs4_check_fh(current_fh, &stp->st_stid); |
| 4802 | } | 4802 | } |
| 4803 | 4803 | ||
| 4804 | /* | 4804 | /* |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 54633858733a..75e0563c09d1 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
| @@ -2143,6 +2143,7 @@ nfsd4_encode_aclname(struct xdr_stream *xdr, struct svc_rqst *rqstp, | |||
| 2143 | #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \ | 2143 | #define WORD0_ABSENT_FS_ATTRS (FATTR4_WORD0_FS_LOCATIONS | FATTR4_WORD0_FSID | \ |
| 2144 | FATTR4_WORD0_RDATTR_ERROR) | 2144 | FATTR4_WORD0_RDATTR_ERROR) |
| 2145 | #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID | 2145 | #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID |
| 2146 | #define WORD2_ABSENT_FS_ATTRS 0 | ||
| 2146 | 2147 | ||
| 2147 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL | 2148 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL |
| 2148 | static inline __be32 | 2149 | static inline __be32 |
| @@ -2171,7 +2172,7 @@ nfsd4_encode_security_label(struct xdr_stream *xdr, struct svc_rqst *rqstp, | |||
| 2171 | { return 0; } | 2172 | { return 0; } |
| 2172 | #endif | 2173 | #endif |
| 2173 | 2174 | ||
| 2174 | static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) | 2175 | static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32 *rdattr_err) |
| 2175 | { | 2176 | { |
| 2176 | /* As per referral draft: */ | 2177 | /* As per referral draft: */ |
| 2177 | if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || | 2178 | if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || |
| @@ -2184,6 +2185,7 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) | |||
| 2184 | } | 2185 | } |
| 2185 | *bmval0 &= WORD0_ABSENT_FS_ATTRS; | 2186 | *bmval0 &= WORD0_ABSENT_FS_ATTRS; |
| 2186 | *bmval1 &= WORD1_ABSENT_FS_ATTRS; | 2187 | *bmval1 &= WORD1_ABSENT_FS_ATTRS; |
| 2188 | *bmval2 &= WORD2_ABSENT_FS_ATTRS; | ||
| 2187 | return 0; | 2189 | return 0; |
| 2188 | } | 2190 | } |
| 2189 | 2191 | ||
| @@ -2246,8 +2248,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
| 2246 | BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion)); | 2248 | BUG_ON(bmval2 & ~nfsd_suppattrs2(minorversion)); |
| 2247 | 2249 | ||
| 2248 | if (exp->ex_fslocs.migrated) { | 2250 | if (exp->ex_fslocs.migrated) { |
| 2249 | BUG_ON(bmval[2]); | 2251 | status = fattr_handle_absent_fs(&bmval0, &bmval1, &bmval2, &rdattr_err); |
| 2250 | status = fattr_handle_absent_fs(&bmval0, &bmval1, &rdattr_err); | ||
| 2251 | if (status) | 2252 | if (status) |
| 2252 | goto out; | 2253 | goto out; |
| 2253 | } | 2254 | } |
| @@ -2286,8 +2287,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, | |||
| 2286 | } | 2287 | } |
| 2287 | 2288 | ||
| 2288 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL | 2289 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL |
| 2289 | if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || | 2290 | if ((bmval2 & FATTR4_WORD2_SECURITY_LABEL) || |
| 2290 | bmval[0] & FATTR4_WORD0_SUPPORTED_ATTRS) { | 2291 | bmval0 & FATTR4_WORD0_SUPPORTED_ATTRS) { |
| 2291 | err = security_inode_getsecctx(d_inode(dentry), | 2292 | err = security_inode_getsecctx(d_inode(dentry), |
| 2292 | &context, &contextlen); | 2293 | &context, &contextlen); |
| 2293 | contextsupport = (err == 0); | 2294 | contextsupport = (err == 0); |
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 92e48c70f0f0..39ddcaf0918f 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c | |||
| @@ -412,16 +412,36 @@ void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, | |||
| 412 | unsigned int flags) | 412 | unsigned int flags) |
| 413 | { | 413 | { |
| 414 | struct fsnotify_mark *lmark, *mark; | 414 | struct fsnotify_mark *lmark, *mark; |
| 415 | LIST_HEAD(to_free); | ||
| 415 | 416 | ||
| 417 | /* | ||
| 418 | * We have to be really careful here. Anytime we drop mark_mutex, e.g. | ||
| 419 | * fsnotify_clear_marks_by_inode() can come and free marks. Even in our | ||
| 420 | * to_free list so we have to use mark_mutex even when accessing that | ||
| 421 | * list. And freeing mark requires us to drop mark_mutex. So we can | ||
| 422 | * reliably free only the first mark in the list. That's why we first | ||
| 423 | * move marks to free to to_free list in one go and then free marks in | ||
| 424 | * to_free list one by one. | ||
| 425 | */ | ||
| 416 | mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); | 426 | mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); |
| 417 | list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { | 427 | list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { |
| 418 | if (mark->flags & flags) { | 428 | if (mark->flags & flags) |
| 419 | fsnotify_get_mark(mark); | 429 | list_move(&mark->g_list, &to_free); |
| 420 | fsnotify_destroy_mark_locked(mark, group); | ||
| 421 | fsnotify_put_mark(mark); | ||
| 422 | } | ||
| 423 | } | 430 | } |
| 424 | mutex_unlock(&group->mark_mutex); | 431 | mutex_unlock(&group->mark_mutex); |
| 432 | |||
| 433 | while (1) { | ||
| 434 | mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); | ||
| 435 | if (list_empty(&to_free)) { | ||
| 436 | mutex_unlock(&group->mark_mutex); | ||
| 437 | break; | ||
| 438 | } | ||
| 439 | mark = list_first_entry(&to_free, struct fsnotify_mark, g_list); | ||
| 440 | fsnotify_get_mark(mark); | ||
| 441 | fsnotify_destroy_mark_locked(mark, group); | ||
| 442 | mutex_unlock(&group->mark_mutex); | ||
| 443 | fsnotify_put_mark(mark); | ||
| 444 | } | ||
| 425 | } | 445 | } |
| 426 | 446 | ||
| 427 | /* | 447 | /* |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 1a35c6139656..0f5fd9db8194 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
| @@ -685,7 +685,7 @@ static int ocfs2_direct_IO_zero_extend(struct ocfs2_super *osb, | |||
| 685 | 685 | ||
| 686 | if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) { | 686 | if (p_cpos && !(ext_flags & OCFS2_EXT_UNWRITTEN)) { |
| 687 | u64 s = i_size_read(inode); | 687 | u64 s = i_size_read(inode); |
| 688 | sector_t sector = (p_cpos << (osb->s_clustersize_bits - 9)) + | 688 | sector_t sector = ((u64)p_cpos << (osb->s_clustersize_bits - 9)) + |
| 689 | (do_div(s, osb->s_clustersize) >> 9); | 689 | (do_div(s, osb->s_clustersize) >> 9); |
| 690 | 690 | ||
| 691 | ret = blkdev_issue_zeroout(osb->sb->s_bdev, sector, | 691 | ret = blkdev_issue_zeroout(osb->sb->s_bdev, sector, |
| @@ -910,7 +910,7 @@ static ssize_t ocfs2_direct_IO_write(struct kiocb *iocb, | |||
| 910 | BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN)); | 910 | BUG_ON(!p_cpos || (ext_flags & OCFS2_EXT_UNWRITTEN)); |
| 911 | 911 | ||
| 912 | ret = blkdev_issue_zeroout(osb->sb->s_bdev, | 912 | ret = blkdev_issue_zeroout(osb->sb->s_bdev, |
| 913 | p_cpos << (osb->s_clustersize_bits - 9), | 913 | (u64)p_cpos << (osb->s_clustersize_bits - 9), |
| 914 | zero_len_head >> 9, GFP_NOFS, false); | 914 | zero_len_head >> 9, GFP_NOFS, false); |
| 915 | if (ret < 0) | 915 | if (ret < 0) |
| 916 | mlog_errno(ret); | 916 | mlog_errno(ret); |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 8b23aa2f52dd..23157e40dd74 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
| @@ -4025,9 +4025,13 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) | |||
| 4025 | osb->dc_work_sequence = osb->dc_wake_sequence; | 4025 | osb->dc_work_sequence = osb->dc_wake_sequence; |
| 4026 | 4026 | ||
| 4027 | processed = osb->blocked_lock_count; | 4027 | processed = osb->blocked_lock_count; |
| 4028 | while (processed) { | 4028 | /* |
| 4029 | BUG_ON(list_empty(&osb->blocked_lock_list)); | 4029 | * blocked lock processing in this loop might call iput which can |
| 4030 | 4030 | * remove items off osb->blocked_lock_list. Downconvert up to | |
| 4031 | * 'processed' number of locks, but stop short if we had some | ||
| 4032 | * removed in ocfs2_mark_lockres_freeing when downconverting. | ||
| 4033 | */ | ||
| 4034 | while (processed && !list_empty(&osb->blocked_lock_list)) { | ||
| 4031 | lockres = list_entry(osb->blocked_lock_list.next, | 4035 | lockres = list_entry(osb->blocked_lock_list.next, |
| 4032 | struct ocfs2_lock_res, l_blocked_list); | 4036 | struct ocfs2_lock_res, l_blocked_list); |
| 4033 | list_del_init(&lockres->l_blocked_list); | 4037 | list_del_init(&lockres->l_blocked_list); |
diff --git a/fs/signalfd.c b/fs/signalfd.c index 7e412ad74836..270221fcef42 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
| @@ -121,8 +121,9 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, | |||
| 121 | * Other callers might not initialize the si_lsb field, | 121 | * Other callers might not initialize the si_lsb field, |
| 122 | * so check explicitly for the right codes here. | 122 | * so check explicitly for the right codes here. |
| 123 | */ | 123 | */ |
| 124 | if (kinfo->si_code == BUS_MCEERR_AR || | 124 | if (kinfo->si_signo == SIGBUS && |
| 125 | kinfo->si_code == BUS_MCEERR_AO) | 125 | (kinfo->si_code == BUS_MCEERR_AR || |
| 126 | kinfo->si_code == BUS_MCEERR_AO)) | ||
| 126 | err |= __put_user((short) kinfo->si_addr_lsb, | 127 | err |= __put_user((short) kinfo->si_addr_lsb, |
| 127 | &uinfo->ssi_addr_lsb); | 128 | &uinfo->ssi_addr_lsb); |
| 128 | #endif | 129 | #endif |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 48db6a56975f..5aa519711e0b 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -691,7 +691,7 @@ struct drm_vblank_crtc { | |||
| 691 | struct timer_list disable_timer; /* delayed disable timer */ | 691 | struct timer_list disable_timer; /* delayed disable timer */ |
| 692 | 692 | ||
| 693 | /* vblank counter, protected by dev->vblank_time_lock for writes */ | 693 | /* vblank counter, protected by dev->vblank_time_lock for writes */ |
| 694 | unsigned long count; | 694 | u32 count; |
| 695 | /* vblank timestamps, protected by dev->vblank_time_lock for writes */ | 695 | /* vblank timestamps, protected by dev->vblank_time_lock for writes */ |
| 696 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; | 696 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; |
| 697 | 697 | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 57ca8cc383a6..3b4d8a4a23fb 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -743,8 +743,6 @@ struct drm_connector { | |||
| 743 | uint8_t num_h_tile, num_v_tile; | 743 | uint8_t num_h_tile, num_v_tile; |
| 744 | uint8_t tile_h_loc, tile_v_loc; | 744 | uint8_t tile_h_loc, tile_v_loc; |
| 745 | uint16_t tile_h_size, tile_v_size; | 745 | uint16_t tile_h_size, tile_v_size; |
| 746 | |||
| 747 | struct list_head destroy_list; | ||
| 748 | }; | 746 | }; |
| 749 | 747 | ||
| 750 | /** | 748 | /** |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index c8fc187061de..918aa68b5199 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
| @@ -168,6 +168,7 @@ struct drm_encoder_helper_funcs { | |||
| 168 | * @get_modes: get mode list for this connector | 168 | * @get_modes: get mode list for this connector |
| 169 | * @mode_valid: is this mode valid on the given connector? (optional) | 169 | * @mode_valid: is this mode valid on the given connector? (optional) |
| 170 | * @best_encoder: return the preferred encoder for this connector | 170 | * @best_encoder: return the preferred encoder for this connector |
| 171 | * @atomic_best_encoder: atomic version of @best_encoder | ||
| 171 | * | 172 | * |
| 172 | * The helper operations are called by the mid-layer CRTC helper. | 173 | * The helper operations are called by the mid-layer CRTC helper. |
| 173 | */ | 174 | */ |
| @@ -176,6 +177,8 @@ struct drm_connector_helper_funcs { | |||
| 176 | enum drm_mode_status (*mode_valid)(struct drm_connector *connector, | 177 | enum drm_mode_status (*mode_valid)(struct drm_connector *connector, |
| 177 | struct drm_display_mode *mode); | 178 | struct drm_display_mode *mode); |
| 178 | struct drm_encoder *(*best_encoder)(struct drm_connector *connector); | 179 | struct drm_encoder *(*best_encoder)(struct drm_connector *connector); |
| 180 | struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector, | ||
| 181 | struct drm_connector_state *connector_state); | ||
| 179 | }; | 182 | }; |
| 180 | 183 | ||
| 181 | extern void drm_helper_disable_unused_functions(struct drm_device *dev); | 184 | extern void drm_helper_disable_unused_functions(struct drm_device *dev); |
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 799050198323..53c53c459b15 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -348,6 +348,25 @@ static inline int drm_eld_mnl(const uint8_t *eld) | |||
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | /** | 350 | /** |
| 351 | * drm_eld_sad - Get ELD SAD structures. | ||
| 352 | * @eld: pointer to an eld memory structure with sad_count set | ||
| 353 | */ | ||
| 354 | static inline const uint8_t *drm_eld_sad(const uint8_t *eld) | ||
| 355 | { | ||
| 356 | unsigned int ver, mnl; | ||
| 357 | |||
| 358 | ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT; | ||
| 359 | if (ver != 2 && ver != 31) | ||
| 360 | return NULL; | ||
| 361 | |||
| 362 | mnl = drm_eld_mnl(eld); | ||
| 363 | if (mnl > 16) | ||
| 364 | return NULL; | ||
| 365 | |||
| 366 | return eld + DRM_ELD_CEA_SAD(mnl, 0); | ||
| 367 | } | ||
| 368 | |||
| 369 | /** | ||
| 351 | * drm_eld_sad_count - Get ELD SAD count. | 370 | * drm_eld_sad_count - Get ELD SAD count. |
| 352 | * @eld: pointer to an eld memory structure with sad_count set | 371 | * @eld: pointer to an eld memory structure with sad_count set |
| 353 | */ | 372 | */ |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 45c39a37f924..8bc073d297db 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -172,6 +172,7 @@ | |||
| 172 | {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 172 | {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 173 | {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 173 | {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 174 | {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ | 174 | {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ |
| 175 | {0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 175 | {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 176 | {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 176 | {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 177 | {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 177 | {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 178 | {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/linux/ata.h b/include/linux/ata.h index 6c78956aa470..d2992bfa1706 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
| @@ -385,8 +385,6 @@ enum { | |||
| 385 | SATA_SSP = 0x06, /* Software Settings Preservation */ | 385 | SATA_SSP = 0x06, /* Software Settings Preservation */ |
| 386 | SATA_DEVSLP = 0x09, /* Device Sleep */ | 386 | SATA_DEVSLP = 0x09, /* Device Sleep */ |
| 387 | 387 | ||
| 388 | SETFEATURE_SENSE_DATA = 0xC3, /* Sense Data Reporting feature */ | ||
| 389 | |||
| 390 | /* feature values for SET_MAX */ | 388 | /* feature values for SET_MAX */ |
| 391 | ATA_SET_MAX_ADDR = 0x00, | 389 | ATA_SET_MAX_ADDR = 0x00, |
| 392 | ATA_SET_MAX_PASSWD = 0x01, | 390 | ATA_SET_MAX_PASSWD = 0x01, |
| @@ -530,8 +528,6 @@ struct ata_bmdma_prd { | |||
| 530 | #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) | 528 | #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) |
| 531 | #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) | 529 | #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) |
| 532 | #define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) | 530 | #define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) |
| 533 | #define ata_id_has_ncq_autosense(id) \ | ||
| 534 | ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) | ||
| 535 | 531 | ||
| 536 | static inline bool ata_id_has_hipm(const u16 *id) | 532 | static inline bool ata_id_has_hipm(const u16 *id) |
| 537 | { | 533 | { |
| @@ -720,20 +716,6 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id) | |||
| 720 | return false; | 716 | return false; |
| 721 | } | 717 | } |
| 722 | 718 | ||
| 723 | static inline bool ata_id_has_sense_reporting(const u16 *id) | ||
| 724 | { | ||
| 725 | if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) | ||
| 726 | return false; | ||
| 727 | return id[ATA_ID_COMMAND_SET_3] & (1 << 6); | ||
| 728 | } | ||
| 729 | |||
| 730 | static inline bool ata_id_sense_reporting_enabled(const u16 *id) | ||
| 731 | { | ||
| 732 | if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) | ||
| 733 | return false; | ||
| 734 | return id[ATA_ID_COMMAND_SET_4] & (1 << 6); | ||
| 735 | } | ||
| 736 | |||
| 737 | /** | 719 | /** |
| 738 | * ata_id_major_version - get ATA level of drive | 720 | * ata_id_major_version - get ATA level of drive |
| 739 | * @id: Identify data | 721 | * @id: Identify data |
diff --git a/include/linux/fs.h b/include/linux/fs.h index cc008c338f5a..84b783f277f7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -55,7 +55,8 @@ struct vm_fault; | |||
| 55 | 55 | ||
| 56 | extern void __init inode_init(void); | 56 | extern void __init inode_init(void); |
| 57 | extern void __init inode_init_early(void); | 57 | extern void __init inode_init_early(void); |
| 58 | extern void __init files_init(unsigned long); | 58 | extern void __init files_init(void); |
| 59 | extern void __init files_maxfiles_init(void); | ||
| 59 | 60 | ||
| 60 | extern struct files_stat_struct files_stat; | 61 | extern struct files_stat_struct files_stat; |
| 61 | extern unsigned long get_max_files(void); | 62 | extern unsigned long get_max_files(void); |
| @@ -2245,7 +2246,7 @@ extern int ioctl_preallocate(struct file *filp, void __user *argp); | |||
| 2245 | 2246 | ||
| 2246 | /* fs/dcache.c */ | 2247 | /* fs/dcache.c */ |
| 2247 | extern void __init vfs_caches_init_early(void); | 2248 | extern void __init vfs_caches_init_early(void); |
| 2248 | extern void __init vfs_caches_init(unsigned long); | 2249 | extern void __init vfs_caches_init(void); |
| 2249 | 2250 | ||
| 2250 | extern struct kmem_cache *names_cachep; | 2251 | extern struct kmem_cache *names_cachep; |
| 2251 | 2252 | ||
diff --git a/include/linux/irq.h b/include/linux/irq.h index 92188b0225bb..51744bcf74ee 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -484,6 +484,7 @@ extern int irq_chip_set_affinity_parent(struct irq_data *data, | |||
| 484 | extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on); | 484 | extern int irq_chip_set_wake_parent(struct irq_data *data, unsigned int on); |
| 485 | extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, | 485 | extern int irq_chip_set_vcpu_affinity_parent(struct irq_data *data, |
| 486 | void *vcpu_info); | 486 | void *vcpu_info); |
| 487 | extern int irq_chip_set_type_parent(struct irq_data *data, unsigned int type); | ||
| 487 | #endif | 488 | #endif |
| 488 | 489 | ||
| 489 | /* Handling of unhandled and spurious interrupts: */ | 490 | /* Handling of unhandled and spurious interrupts: */ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 2e872f92dbac..bf6f117fcf4d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1003,6 +1003,34 @@ static inline int page_mapped(struct page *page) | |||
| 1003 | } | 1003 | } |
| 1004 | 1004 | ||
| 1005 | /* | 1005 | /* |
| 1006 | * Return true only if the page has been allocated with | ||
| 1007 | * ALLOC_NO_WATERMARKS and the low watermark was not | ||
| 1008 | * met implying that the system is under some pressure. | ||
| 1009 | */ | ||
| 1010 | static inline bool page_is_pfmemalloc(struct page *page) | ||
| 1011 | { | ||
| 1012 | /* | ||
| 1013 | * Page index cannot be this large so this must be | ||
| 1014 | * a pfmemalloc page. | ||
| 1015 | */ | ||
| 1016 | return page->index == -1UL; | ||
| 1017 | } | ||
| 1018 | |||
| 1019 | /* | ||
| 1020 | * Only to be called by the page allocator on a freshly allocated | ||
| 1021 | * page. | ||
| 1022 | */ | ||
| 1023 | static inline void set_page_pfmemalloc(struct page *page) | ||
| 1024 | { | ||
| 1025 | page->index = -1UL; | ||
| 1026 | } | ||
| 1027 | |||
| 1028 | static inline void clear_page_pfmemalloc(struct page *page) | ||
| 1029 | { | ||
| 1030 | page->index = 0; | ||
| 1031 | } | ||
| 1032 | |||
| 1033 | /* | ||
| 1006 | * Different kinds of faults, as returned by handle_mm_fault(). | 1034 | * Different kinds of faults, as returned by handle_mm_fault(). |
| 1007 | * Used to decide whether a process gets delivered SIGBUS or | 1035 | * Used to decide whether a process gets delivered SIGBUS or |
| 1008 | * just gets major/minor fault counters bumped up. | 1036 | * just gets major/minor fault counters bumped up. |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 0038ac7466fd..15549578d559 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -63,15 +63,6 @@ struct page { | |||
| 63 | union { | 63 | union { |
| 64 | pgoff_t index; /* Our offset within mapping. */ | 64 | pgoff_t index; /* Our offset within mapping. */ |
| 65 | void *freelist; /* sl[aou]b first free object */ | 65 | void *freelist; /* sl[aou]b first free object */ |
| 66 | bool pfmemalloc; /* If set by the page allocator, | ||
| 67 | * ALLOC_NO_WATERMARKS was set | ||
| 68 | * and the low watermark was not | ||
| 69 | * met implying that the system | ||
| 70 | * is under some pressure. The | ||
| 71 | * caller should try ensure | ||
| 72 | * this page is only used to | ||
| 73 | * free other pages. | ||
| 74 | */ | ||
| 75 | }; | 66 | }; |
| 76 | 67 | ||
| 77 | union { | 68 | union { |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f34e040b34e9..41c93844fb1d 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -631,15 +631,19 @@ static inline void ClearPageSlabPfmemalloc(struct page *page) | |||
| 631 | 1 << PG_private | 1 << PG_private_2 | \ | 631 | 1 << PG_private | 1 << PG_private_2 | \ |
| 632 | 1 << PG_writeback | 1 << PG_reserved | \ | 632 | 1 << PG_writeback | 1 << PG_reserved | \ |
| 633 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ | 633 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ |
| 634 | 1 << PG_unevictable | __PG_MLOCKED | __PG_HWPOISON | \ | 634 | 1 << PG_unevictable | __PG_MLOCKED | \ |
| 635 | __PG_COMPOUND_LOCK) | 635 | __PG_COMPOUND_LOCK) |
| 636 | 636 | ||
| 637 | /* | 637 | /* |
| 638 | * Flags checked when a page is prepped for return by the page allocator. | 638 | * Flags checked when a page is prepped for return by the page allocator. |
| 639 | * Pages being prepped should not have any flags set. It they are set, | 639 | * Pages being prepped should not have these flags set. It they are set, |
| 640 | * there has been a kernel bug or struct page corruption. | 640 | * there has been a kernel bug or struct page corruption. |
| 641 | * | ||
| 642 | * __PG_HWPOISON is exceptional because it needs to be kept beyond page's | ||
| 643 | * alloc-free cycle to prevent from reusing the page. | ||
| 641 | */ | 644 | */ |
| 642 | #define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) | 645 | #define PAGE_FLAGS_CHECK_AT_PREP \ |
| 646 | (((1 << NR_PAGEFLAGS) - 1) & ~__PG_HWPOISON) | ||
| 643 | 647 | ||
| 644 | #define PAGE_FLAGS_PRIVATE \ | 648 | #define PAGE_FLAGS_PRIVATE \ |
| 645 | (1 << PG_private | 1 << PG_private_2) | 649 | (1 << PG_private | 1 << PG_private_2) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 8a0321a8fb59..860c751810fc 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -1202,6 +1202,7 @@ struct msix_entry { | |||
| 1202 | u16 entry; /* driver uses to specify entry, OS writes */ | 1202 | u16 entry; /* driver uses to specify entry, OS writes */ |
| 1203 | }; | 1203 | }; |
| 1204 | 1204 | ||
| 1205 | void pci_msi_setup_pci_dev(struct pci_dev *dev); | ||
| 1205 | 1206 | ||
| 1206 | #ifdef CONFIG_PCI_MSI | 1207 | #ifdef CONFIG_PCI_MSI |
| 1207 | int pci_msi_vec_count(struct pci_dev *dev); | 1208 | int pci_msi_vec_count(struct pci_dev *dev); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index d6cdd6e87d53..9b88536487e6 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -1602,20 +1602,16 @@ static inline void __skb_fill_page_desc(struct sk_buff *skb, int i, | |||
| 1602 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 1602 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
| 1603 | 1603 | ||
| 1604 | /* | 1604 | /* |
| 1605 | * Propagate page->pfmemalloc to the skb if we can. The problem is | 1605 | * Propagate page pfmemalloc to the skb if we can. The problem is |
| 1606 | * that not all callers have unique ownership of the page. If | 1606 | * that not all callers have unique ownership of the page but rely |
| 1607 | * pfmemalloc is set, we check the mapping as a mapping implies | 1607 | * on page_is_pfmemalloc doing the right thing(tm). |
| 1608 | * page->index is set (index and pfmemalloc share space). | ||
| 1609 | * If it's a valid mapping, we cannot use page->pfmemalloc but we | ||
| 1610 | * do not lose pfmemalloc information as the pages would not be | ||
| 1611 | * allocated using __GFP_MEMALLOC. | ||
| 1612 | */ | 1608 | */ |
| 1613 | frag->page.p = page; | 1609 | frag->page.p = page; |
| 1614 | frag->page_offset = off; | 1610 | frag->page_offset = off; |
| 1615 | skb_frag_size_set(frag, size); | 1611 | skb_frag_size_set(frag, size); |
| 1616 | 1612 | ||
| 1617 | page = compound_head(page); | 1613 | page = compound_head(page); |
| 1618 | if (page->pfmemalloc && !page->mapping) | 1614 | if (page_is_pfmemalloc(page)) |
| 1619 | skb->pfmemalloc = true; | 1615 | skb->pfmemalloc = true; |
| 1620 | } | 1616 | } |
| 1621 | 1617 | ||
| @@ -2263,7 +2259,7 @@ static inline struct page *dev_alloc_page(void) | |||
| 2263 | static inline void skb_propagate_pfmemalloc(struct page *page, | 2259 | static inline void skb_propagate_pfmemalloc(struct page *page, |
| 2264 | struct sk_buff *skb) | 2260 | struct sk_buff *skb) |
| 2265 | { | 2261 | { |
| 2266 | if (page && page->pfmemalloc) | 2262 | if (page_is_pfmemalloc(page)) |
| 2267 | skb->pfmemalloc = true; | 2263 | skb->pfmemalloc = true; |
| 2268 | } | 2264 | } |
| 2269 | 2265 | ||
| @@ -2884,11 +2880,11 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) | |||
| 2884 | * | 2880 | * |
| 2885 | * PHY drivers may accept clones of transmitted packets for | 2881 | * PHY drivers may accept clones of transmitted packets for |
| 2886 | * timestamping via their phy_driver.txtstamp method. These drivers | 2882 | * timestamping via their phy_driver.txtstamp method. These drivers |
| 2887 | * must call this function to return the skb back to the stack, with | 2883 | * must call this function to return the skb back to the stack with a |
| 2888 | * or without a timestamp. | 2884 | * timestamp. |
| 2889 | * | 2885 | * |
| 2890 | * @skb: clone of the the original outgoing packet | 2886 | * @skb: clone of the the original outgoing packet |
| 2891 | * @hwtstamps: hardware time stamps, may be NULL if not available | 2887 | * @hwtstamps: hardware time stamps |
| 2892 | * | 2888 | * |
| 2893 | */ | 2889 | */ |
| 2894 | void skb_complete_tx_timestamp(struct sk_buff *skb, | 2890 | void skb_complete_tx_timestamp(struct sk_buff *skb, |
diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 45534da57759..644bdc61c387 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h | |||
| @@ -74,8 +74,6 @@ enum rc_filter_type { | |||
| 74 | * @input_dev: the input child device used to communicate events to userspace | 74 | * @input_dev: the input child device used to communicate events to userspace |
| 75 | * @driver_type: specifies if protocol decoding is done in hardware or software | 75 | * @driver_type: specifies if protocol decoding is done in hardware or software |
| 76 | * @idle: used to keep track of RX state | 76 | * @idle: used to keep track of RX state |
| 77 | * @encode_wakeup: wakeup filtering uses IR encode API, therefore the allowed | ||
| 78 | * wakeup protocols is the set of all raw encoders | ||
| 79 | * @allowed_protocols: bitmask with the supported RC_BIT_* protocols | 77 | * @allowed_protocols: bitmask with the supported RC_BIT_* protocols |
| 80 | * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols | 78 | * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols |
| 81 | * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols | 79 | * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols |
| @@ -136,7 +134,6 @@ struct rc_dev { | |||
| 136 | struct input_dev *input_dev; | 134 | struct input_dev *input_dev; |
| 137 | enum rc_driver_type driver_type; | 135 | enum rc_driver_type driver_type; |
| 138 | bool idle; | 136 | bool idle; |
| 139 | bool encode_wakeup; | ||
| 140 | u64 allowed_protocols; | 137 | u64 allowed_protocols; |
| 141 | u64 enabled_protocols; | 138 | u64 enabled_protocols; |
| 142 | u64 allowed_wakeup_protocols; | 139 | u64 allowed_wakeup_protocols; |
| @@ -246,7 +243,6 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev) | |||
| 246 | #define US_TO_NS(usec) ((usec) * 1000) | 243 | #define US_TO_NS(usec) ((usec) * 1000) |
| 247 | #define MS_TO_US(msec) ((msec) * 1000) | 244 | #define MS_TO_US(msec) ((msec) * 1000) |
| 248 | #define MS_TO_NS(msec) ((msec) * 1000 * 1000) | 245 | #define MS_TO_NS(msec) ((msec) * 1000 * 1000) |
| 249 | #define NS_TO_US(nsec) DIV_ROUND_UP(nsec, 1000L) | ||
| 250 | 246 | ||
| 251 | void ir_raw_event_handle(struct rc_dev *dev); | 247 | void ir_raw_event_handle(struct rc_dev *dev); |
| 252 | int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); | 248 | int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); |
| @@ -254,9 +250,6 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type); | |||
| 254 | int ir_raw_event_store_with_filter(struct rc_dev *dev, | 250 | int ir_raw_event_store_with_filter(struct rc_dev *dev, |
| 255 | struct ir_raw_event *ev); | 251 | struct ir_raw_event *ev); |
| 256 | void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); | 252 | void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); |
| 257 | int ir_raw_encode_scancode(u64 protocols, | ||
| 258 | const struct rc_scancode_filter *scancode, | ||
| 259 | struct ir_raw_event *events, unsigned int max); | ||
| 260 | 253 | ||
| 261 | static inline void ir_raw_event_reset(struct rc_dev *dev) | 254 | static inline void ir_raw_event_reset(struct rc_dev *dev) |
| 262 | { | 255 | { |
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 22a44c2f5963..c192e1b46cdc 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h | |||
| @@ -139,6 +139,7 @@ enum vb2_io_modes { | |||
| 139 | * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf | 139 | * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf |
| 140 | * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver | 140 | * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver |
| 141 | * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver | 141 | * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver |
| 142 | * @VB2_BUF_STATE_REQUEUEING: re-queue a buffer to the driver | ||
| 142 | * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used | 143 | * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used |
| 143 | * in a hardware operation | 144 | * in a hardware operation |
| 144 | * @VB2_BUF_STATE_DONE: buffer returned from driver to videobuf, but | 145 | * @VB2_BUF_STATE_DONE: buffer returned from driver to videobuf, but |
| @@ -152,6 +153,7 @@ enum vb2_buffer_state { | |||
| 152 | VB2_BUF_STATE_PREPARING, | 153 | VB2_BUF_STATE_PREPARING, |
| 153 | VB2_BUF_STATE_PREPARED, | 154 | VB2_BUF_STATE_PREPARED, |
| 154 | VB2_BUF_STATE_QUEUED, | 155 | VB2_BUF_STATE_QUEUED, |
| 156 | VB2_BUF_STATE_REQUEUEING, | ||
| 155 | VB2_BUF_STATE_ACTIVE, | 157 | VB2_BUF_STATE_ACTIVE, |
| 156 | VB2_BUF_STATE_DONE, | 158 | VB2_BUF_STATE_DONE, |
| 157 | VB2_BUF_STATE_ERROR, | 159 | VB2_BUF_STATE_ERROR, |
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h index 4942710ef720..8d1d7fa67ec4 100644 --- a/include/scsi/scsi_eh.h +++ b/include/scsi/scsi_eh.h | |||
| @@ -28,7 +28,6 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len, | |||
| 28 | u64 * info_out); | 28 | u64 * info_out); |
| 29 | 29 | ||
| 30 | extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq); | 30 | extern void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq); |
| 31 | extern void scsi_set_sense_information(u8 *buf, u64 info); | ||
| 32 | 31 | ||
| 33 | extern int scsi_ioctl_reset(struct scsi_device *, int __user *); | 32 | extern int scsi_ioctl_reset(struct scsi_device *, int __user *); |
| 34 | 33 | ||
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index efe3443572ba..413417f3707b 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
| @@ -319,6 +319,7 @@ | |||
| 319 | #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ | 319 | #define PCI_MSIX_PBA 8 /* Pending Bit Array offset */ |
| 320 | #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ | 320 | #define PCI_MSIX_PBA_BIR 0x00000007 /* BAR index */ |
| 321 | #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ | 321 | #define PCI_MSIX_PBA_OFFSET 0xfffffff8 /* Offset into specified BAR */ |
| 322 | #define PCI_MSIX_FLAGS_BIRMASK PCI_MSIX_PBA_BIR /* deprecated */ | ||
| 322 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ | 323 | #define PCI_CAP_MSIX_SIZEOF 12 /* size of MSIX registers */ |
| 323 | 324 | ||
| 324 | /* MSI-X Table entry format */ | 325 | /* MSI-X Table entry format */ |
diff --git a/init/main.c b/init/main.c index c5d5626289ce..56506553d4d8 100644 --- a/init/main.c +++ b/init/main.c | |||
| @@ -656,7 +656,7 @@ asmlinkage __visible void __init start_kernel(void) | |||
| 656 | key_init(); | 656 | key_init(); |
| 657 | security_init(); | 657 | security_init(); |
| 658 | dbg_late_init(); | 658 | dbg_late_init(); |
| 659 | vfs_caches_init(totalram_pages); | 659 | vfs_caches_init(); |
| 660 | signals_init(); | 660 | signals_init(); |
| 661 | /* rootfs populating might need page-writeback */ | 661 | /* rootfs populating might need page-writeback */ |
| 662 | page_writeback_init(); | 662 | page_writeback_init(); |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index a24ba9fe5bb8..161a1807e6ef 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
| @@ -142,7 +142,6 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) | |||
| 142 | if (!leaf) | 142 | if (!leaf) |
| 143 | return -ENOMEM; | 143 | return -ENOMEM; |
| 144 | INIT_LIST_HEAD(&leaf->msg_list); | 144 | INIT_LIST_HEAD(&leaf->msg_list); |
| 145 | info->qsize += sizeof(*leaf); | ||
| 146 | } | 145 | } |
| 147 | leaf->priority = msg->m_type; | 146 | leaf->priority = msg->m_type; |
| 148 | rb_link_node(&leaf->rb_node, parent, p); | 147 | rb_link_node(&leaf->rb_node, parent, p); |
| @@ -187,7 +186,6 @@ try_again: | |||
| 187 | "lazy leaf delete!\n"); | 186 | "lazy leaf delete!\n"); |
| 188 | rb_erase(&leaf->rb_node, &info->msg_tree); | 187 | rb_erase(&leaf->rb_node, &info->msg_tree); |
| 189 | if (info->node_cache) { | 188 | if (info->node_cache) { |
| 190 | info->qsize -= sizeof(*leaf); | ||
| 191 | kfree(leaf); | 189 | kfree(leaf); |
| 192 | } else { | 190 | } else { |
| 193 | info->node_cache = leaf; | 191 | info->node_cache = leaf; |
| @@ -200,7 +198,6 @@ try_again: | |||
| 200 | if (list_empty(&leaf->msg_list)) { | 198 | if (list_empty(&leaf->msg_list)) { |
| 201 | rb_erase(&leaf->rb_node, &info->msg_tree); | 199 | rb_erase(&leaf->rb_node, &info->msg_tree); |
| 202 | if (info->node_cache) { | 200 | if (info->node_cache) { |
| 203 | info->qsize -= sizeof(*leaf); | ||
| 204 | kfree(leaf); | 201 | kfree(leaf); |
| 205 | } else { | 202 | } else { |
| 206 | info->node_cache = leaf; | 203 | info->node_cache = leaf; |
| @@ -1034,7 +1031,6 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, | |||
| 1034 | /* Save our speculative allocation into the cache */ | 1031 | /* Save our speculative allocation into the cache */ |
| 1035 | INIT_LIST_HEAD(&new_leaf->msg_list); | 1032 | INIT_LIST_HEAD(&new_leaf->msg_list); |
| 1036 | info->node_cache = new_leaf; | 1033 | info->node_cache = new_leaf; |
| 1037 | info->qsize += sizeof(*new_leaf); | ||
| 1038 | new_leaf = NULL; | 1034 | new_leaf = NULL; |
| 1039 | } else { | 1035 | } else { |
| 1040 | kfree(new_leaf); | 1036 | kfree(new_leaf); |
| @@ -1142,7 +1138,6 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, | |||
| 1142 | /* Save our speculative allocation into the cache */ | 1138 | /* Save our speculative allocation into the cache */ |
| 1143 | INIT_LIST_HEAD(&new_leaf->msg_list); | 1139 | INIT_LIST_HEAD(&new_leaf->msg_list); |
| 1144 | info->node_cache = new_leaf; | 1140 | info->node_cache = new_leaf; |
| 1145 | info->qsize += sizeof(*new_leaf); | ||
| 1146 | } else { | 1141 | } else { |
| 1147 | kfree(new_leaf); | 1142 | kfree(new_leaf); |
| 1148 | } | 1143 | } |
| @@ -253,6 +253,16 @@ static void sem_rcu_free(struct rcu_head *head) | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | /* | 255 | /* |
| 256 | * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they | ||
| 257 | * are only control barriers. | ||
| 258 | * The code must pair with spin_unlock(&sem->lock) or | ||
| 259 | * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient. | ||
| 260 | * | ||
| 261 | * smp_rmb() is sufficient, as writes cannot pass the control barrier. | ||
| 262 | */ | ||
| 263 | #define ipc_smp_acquire__after_spin_is_unlocked() smp_rmb() | ||
| 264 | |||
| 265 | /* | ||
| 256 | * Wait until all currently ongoing simple ops have completed. | 266 | * Wait until all currently ongoing simple ops have completed. |
| 257 | * Caller must own sem_perm.lock. | 267 | * Caller must own sem_perm.lock. |
| 258 | * New simple ops cannot start, because simple ops first check | 268 | * New simple ops cannot start, because simple ops first check |
| @@ -275,6 +285,7 @@ static void sem_wait_array(struct sem_array *sma) | |||
| 275 | sem = sma->sem_base + i; | 285 | sem = sma->sem_base + i; |
| 276 | spin_unlock_wait(&sem->lock); | 286 | spin_unlock_wait(&sem->lock); |
| 277 | } | 287 | } |
| 288 | ipc_smp_acquire__after_spin_is_unlocked(); | ||
| 278 | } | 289 | } |
| 279 | 290 | ||
| 280 | /* | 291 | /* |
| @@ -327,13 +338,12 @@ static inline int sem_lock(struct sem_array *sma, struct sembuf *sops, | |||
| 327 | /* Then check that the global lock is free */ | 338 | /* Then check that the global lock is free */ |
| 328 | if (!spin_is_locked(&sma->sem_perm.lock)) { | 339 | if (!spin_is_locked(&sma->sem_perm.lock)) { |
| 329 | /* | 340 | /* |
| 330 | * The ipc object lock check must be visible on all | 341 | * We need a memory barrier with acquire semantics, |
| 331 | * cores before rechecking the complex count. Otherwise | 342 | * otherwise we can race with another thread that does: |
| 332 | * we can race with another thread that does: | ||
| 333 | * complex_count++; | 343 | * complex_count++; |
| 334 | * spin_unlock(sem_perm.lock); | 344 | * spin_unlock(sem_perm.lock); |
| 335 | */ | 345 | */ |
| 336 | smp_rmb(); | 346 | ipc_smp_acquire__after_spin_is_unlocked(); |
| 337 | 347 | ||
| 338 | /* | 348 | /* |
| 339 | * Now repeat the test of complex_count: | 349 | * Now repeat the test of complex_count: |
| @@ -2074,17 +2084,28 @@ void exit_sem(struct task_struct *tsk) | |||
| 2074 | rcu_read_lock(); | 2084 | rcu_read_lock(); |
| 2075 | un = list_entry_rcu(ulp->list_proc.next, | 2085 | un = list_entry_rcu(ulp->list_proc.next, |
| 2076 | struct sem_undo, list_proc); | 2086 | struct sem_undo, list_proc); |
| 2077 | if (&un->list_proc == &ulp->list_proc) | 2087 | if (&un->list_proc == &ulp->list_proc) { |
| 2078 | semid = -1; | 2088 | /* |
| 2079 | else | 2089 | * We must wait for freeary() before freeing this ulp, |
| 2080 | semid = un->semid; | 2090 | * in case we raced with last sem_undo. There is a small |
| 2091 | * possibility where we exit while freeary() didn't | ||
| 2092 | * finish unlocking sem_undo_list. | ||
| 2093 | */ | ||
| 2094 | spin_unlock_wait(&ulp->lock); | ||
| 2095 | rcu_read_unlock(); | ||
| 2096 | break; | ||
| 2097 | } | ||
| 2098 | spin_lock(&ulp->lock); | ||
| 2099 | semid = un->semid; | ||
| 2100 | spin_unlock(&ulp->lock); | ||
| 2081 | 2101 | ||
| 2102 | /* exit_sem raced with IPC_RMID, nothing to do */ | ||
| 2082 | if (semid == -1) { | 2103 | if (semid == -1) { |
| 2083 | rcu_read_unlock(); | 2104 | rcu_read_unlock(); |
| 2084 | break; | 2105 | continue; |
| 2085 | } | 2106 | } |
| 2086 | 2107 | ||
| 2087 | sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid); | 2108 | sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, semid); |
| 2088 | /* exit_sem raced with IPC_RMID, nothing to do */ | 2109 | /* exit_sem raced with IPC_RMID, nothing to do */ |
| 2089 | if (IS_ERR(sma)) { | 2110 | if (IS_ERR(sma)) { |
| 2090 | rcu_read_unlock(); | 2111 | rcu_read_unlock(); |
| @@ -2112,9 +2133,11 @@ void exit_sem(struct task_struct *tsk) | |||
| 2112 | ipc_assert_locked_object(&sma->sem_perm); | 2133 | ipc_assert_locked_object(&sma->sem_perm); |
| 2113 | list_del(&un->list_id); | 2134 | list_del(&un->list_id); |
| 2114 | 2135 | ||
| 2115 | spin_lock(&ulp->lock); | 2136 | /* we are the last process using this ulp, acquiring ulp->lock |
| 2137 | * isn't required. Besides that, we are also protected against | ||
| 2138 | * IPC_RMID as we hold sma->sem_perm lock now | ||
| 2139 | */ | ||
| 2116 | list_del_rcu(&un->list_proc); | 2140 | list_del_rcu(&un->list_proc); |
| 2117 | spin_unlock(&ulp->lock); | ||
| 2118 | 2141 | ||
| 2119 | /* perform adjustments registered in un */ | 2142 | /* perform adjustments registered in un */ |
| 2120 | for (i = 0; i < sma->sem_nsems; i++) { | 2143 | for (i = 0; i < sma->sem_nsems; i++) { |
| @@ -545,7 +545,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) | |||
| 545 | if ((shmflg & SHM_NORESERVE) && | 545 | if ((shmflg & SHM_NORESERVE) && |
| 546 | sysctl_overcommit_memory != OVERCOMMIT_NEVER) | 546 | sysctl_overcommit_memory != OVERCOMMIT_NEVER) |
| 547 | acctflag = VM_NORESERVE; | 547 | acctflag = VM_NORESERVE; |
| 548 | file = shmem_file_setup(name, size, acctflag); | 548 | file = shmem_kernel_file_setup(name, size, acctflag); |
| 549 | } | 549 | } |
| 550 | error = PTR_ERR(file); | 550 | error = PTR_ERR(file); |
| 551 | if (IS_ERR(file)) | 551 | if (IS_ERR(file)) |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index ee14e3a35a29..f0acff0f66c9 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
| @@ -1223,7 +1223,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs, | |||
| 1223 | spin_unlock_irq(&callback_lock); | 1223 | spin_unlock_irq(&callback_lock); |
| 1224 | 1224 | ||
| 1225 | /* use trialcs->mems_allowed as a temp variable */ | 1225 | /* use trialcs->mems_allowed as a temp variable */ |
| 1226 | update_nodemasks_hier(cs, &cs->mems_allowed); | 1226 | update_nodemasks_hier(cs, &trialcs->mems_allowed); |
| 1227 | done: | 1227 | done: |
| 1228 | return retval; | 1228 | return retval; |
| 1229 | } | 1229 | } |
diff --git a/kernel/events/core.c b/kernel/events/core.c index d3dae3419b99..e6feb5114134 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -1868,8 +1868,6 @@ event_sched_in(struct perf_event *event, | |||
| 1868 | 1868 | ||
| 1869 | perf_pmu_disable(event->pmu); | 1869 | perf_pmu_disable(event->pmu); |
| 1870 | 1870 | ||
| 1871 | event->tstamp_running += tstamp - event->tstamp_stopped; | ||
| 1872 | |||
| 1873 | perf_set_shadow_time(event, ctx, tstamp); | 1871 | perf_set_shadow_time(event, ctx, tstamp); |
| 1874 | 1872 | ||
| 1875 | perf_log_itrace_start(event); | 1873 | perf_log_itrace_start(event); |
| @@ -1881,6 +1879,8 @@ event_sched_in(struct perf_event *event, | |||
| 1881 | goto out; | 1879 | goto out; |
| 1882 | } | 1880 | } |
| 1883 | 1881 | ||
| 1882 | event->tstamp_running += tstamp - event->tstamp_stopped; | ||
| 1883 | |||
| 1884 | if (!is_software_event(event)) | 1884 | if (!is_software_event(event)) |
| 1885 | cpuctx->active_oncpu++; | 1885 | cpuctx->active_oncpu++; |
| 1886 | if (!ctx->nr_active++) | 1886 | if (!ctx->nr_active++) |
| @@ -3958,28 +3958,21 @@ static void perf_event_for_each(struct perf_event *event, | |||
| 3958 | perf_event_for_each_child(sibling, func); | 3958 | perf_event_for_each_child(sibling, func); |
| 3959 | } | 3959 | } |
| 3960 | 3960 | ||
| 3961 | static int perf_event_period(struct perf_event *event, u64 __user *arg) | 3961 | struct period_event { |
| 3962 | { | 3962 | struct perf_event *event; |
| 3963 | struct perf_event_context *ctx = event->ctx; | ||
| 3964 | int ret = 0, active; | ||
| 3965 | u64 value; | 3963 | u64 value; |
| 3964 | }; | ||
| 3966 | 3965 | ||
| 3967 | if (!is_sampling_event(event)) | 3966 | static int __perf_event_period(void *info) |
| 3968 | return -EINVAL; | 3967 | { |
| 3969 | 3968 | struct period_event *pe = info; | |
| 3970 | if (copy_from_user(&value, arg, sizeof(value))) | 3969 | struct perf_event *event = pe->event; |
| 3971 | return -EFAULT; | 3970 | struct perf_event_context *ctx = event->ctx; |
| 3972 | 3971 | u64 value = pe->value; | |
| 3973 | if (!value) | 3972 | bool active; |
| 3974 | return -EINVAL; | ||
| 3975 | 3973 | ||
| 3976 | raw_spin_lock_irq(&ctx->lock); | 3974 | raw_spin_lock(&ctx->lock); |
| 3977 | if (event->attr.freq) { | 3975 | if (event->attr.freq) { |
| 3978 | if (value > sysctl_perf_event_sample_rate) { | ||
| 3979 | ret = -EINVAL; | ||
| 3980 | goto unlock; | ||
| 3981 | } | ||
| 3982 | |||
| 3983 | event->attr.sample_freq = value; | 3976 | event->attr.sample_freq = value; |
| 3984 | } else { | 3977 | } else { |
| 3985 | event->attr.sample_period = value; | 3978 | event->attr.sample_period = value; |
| @@ -3998,11 +3991,53 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg) | |||
| 3998 | event->pmu->start(event, PERF_EF_RELOAD); | 3991 | event->pmu->start(event, PERF_EF_RELOAD); |
| 3999 | perf_pmu_enable(ctx->pmu); | 3992 | perf_pmu_enable(ctx->pmu); |
| 4000 | } | 3993 | } |
| 3994 | raw_spin_unlock(&ctx->lock); | ||
| 4001 | 3995 | ||
| 4002 | unlock: | 3996 | return 0; |
| 3997 | } | ||
| 3998 | |||
| 3999 | static int perf_event_period(struct perf_event *event, u64 __user *arg) | ||
| 4000 | { | ||
| 4001 | struct period_event pe = { .event = event, }; | ||
| 4002 | struct perf_event_context *ctx = event->ctx; | ||
| 4003 | struct task_struct *task; | ||
| 4004 | u64 value; | ||
| 4005 | |||
| 4006 | if (!is_sampling_event(event)) | ||
| 4007 | return -EINVAL; | ||
| 4008 | |||
| 4009 | if (copy_from_user(&value, arg, sizeof(value))) | ||
| 4010 | return -EFAULT; | ||
| 4011 | |||
| 4012 | if (!value) | ||
| 4013 | return -EINVAL; | ||
| 4014 | |||
| 4015 | if (event->attr.freq && value > sysctl_perf_event_sample_rate) | ||
| 4016 | return -EINVAL; | ||
| 4017 | |||
| 4018 | task = ctx->task; | ||
| 4019 | pe.value = value; | ||
| 4020 | |||
| 4021 | if (!task) { | ||
| 4022 | cpu_function_call(event->cpu, __perf_event_period, &pe); | ||
| 4023 | return 0; | ||
| 4024 | } | ||
| 4025 | |||
| 4026 | retry: | ||
| 4027 | if (!task_function_call(task, __perf_event_period, &pe)) | ||
| 4028 | return 0; | ||
| 4029 | |||
| 4030 | raw_spin_lock_irq(&ctx->lock); | ||
| 4031 | if (ctx->is_active) { | ||
| 4032 | raw_spin_unlock_irq(&ctx->lock); | ||
| 4033 | task = ctx->task; | ||
| 4034 | goto retry; | ||
| 4035 | } | ||
| 4036 | |||
| 4037 | __perf_event_period(&pe); | ||
| 4003 | raw_spin_unlock_irq(&ctx->lock); | 4038 | raw_spin_unlock_irq(&ctx->lock); |
| 4004 | 4039 | ||
| 4005 | return ret; | 4040 | return 0; |
| 4006 | } | 4041 | } |
| 4007 | 4042 | ||
| 4008 | static const struct file_operations perf_fops; | 4043 | static const struct file_operations perf_fops; |
| @@ -4740,12 +4775,20 @@ static const struct file_operations perf_fops = { | |||
| 4740 | * to user-space before waking everybody up. | 4775 | * to user-space before waking everybody up. |
| 4741 | */ | 4776 | */ |
| 4742 | 4777 | ||
| 4778 | static inline struct fasync_struct **perf_event_fasync(struct perf_event *event) | ||
| 4779 | { | ||
| 4780 | /* only the parent has fasync state */ | ||
| 4781 | if (event->parent) | ||
| 4782 | event = event->parent; | ||
| 4783 | return &event->fasync; | ||
| 4784 | } | ||
| 4785 | |||
| 4743 | void perf_event_wakeup(struct perf_event *event) | 4786 | void perf_event_wakeup(struct perf_event *event) |
| 4744 | { | 4787 | { |
| 4745 | ring_buffer_wakeup(event); | 4788 | ring_buffer_wakeup(event); |
| 4746 | 4789 | ||
| 4747 | if (event->pending_kill) { | 4790 | if (event->pending_kill) { |
| 4748 | kill_fasync(&event->fasync, SIGIO, event->pending_kill); | 4791 | kill_fasync(perf_event_fasync(event), SIGIO, event->pending_kill); |
| 4749 | event->pending_kill = 0; | 4792 | event->pending_kill = 0; |
| 4750 | } | 4793 | } |
| 4751 | } | 4794 | } |
| @@ -6124,7 +6167,7 @@ static int __perf_event_overflow(struct perf_event *event, | |||
| 6124 | else | 6167 | else |
| 6125 | perf_event_output(event, data, regs); | 6168 | perf_event_output(event, data, regs); |
| 6126 | 6169 | ||
| 6127 | if (event->fasync && event->pending_kill) { | 6170 | if (*perf_event_fasync(event) && event->pending_kill) { |
| 6128 | event->pending_wakeup = 1; | 6171 | event->pending_wakeup = 1; |
| 6129 | irq_work_queue(&event->pending); | 6172 | irq_work_queue(&event->pending); |
| 6130 | } | 6173 | } |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index b2be01b1aa9d..c8aa3f75bc4d 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
| @@ -559,11 +559,13 @@ static void __rb_free_aux(struct ring_buffer *rb) | |||
| 559 | rb->aux_priv = NULL; | 559 | rb->aux_priv = NULL; |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | for (pg = 0; pg < rb->aux_nr_pages; pg++) | 562 | if (rb->aux_nr_pages) { |
| 563 | rb_free_aux_page(rb, pg); | 563 | for (pg = 0; pg < rb->aux_nr_pages; pg++) |
| 564 | rb_free_aux_page(rb, pg); | ||
| 564 | 565 | ||
| 565 | kfree(rb->aux_pages); | 566 | kfree(rb->aux_pages); |
| 566 | rb->aux_nr_pages = 0; | 567 | rb->aux_nr_pages = 0; |
| 568 | } | ||
| 567 | } | 569 | } |
| 568 | 570 | ||
| 569 | void rb_free_aux(struct ring_buffer *rb) | 571 | void rb_free_aux(struct ring_buffer *rb) |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 27f4332c7f84..ae216824e8ca 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
| @@ -985,6 +985,23 @@ int irq_chip_set_affinity_parent(struct irq_data *data, | |||
| 985 | } | 985 | } |
| 986 | 986 | ||
| 987 | /** | 987 | /** |
| 988 | * irq_chip_set_type_parent - Set IRQ type on the parent interrupt | ||
| 989 | * @data: Pointer to interrupt specific data | ||
| 990 | * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h | ||
| 991 | * | ||
| 992 | * Conditional, as the underlying parent chip might not implement it. | ||
| 993 | */ | ||
| 994 | int irq_chip_set_type_parent(struct irq_data *data, unsigned int type) | ||
| 995 | { | ||
| 996 | data = data->parent_data; | ||
| 997 | |||
| 998 | if (data->chip->irq_set_type) | ||
| 999 | return data->chip->irq_set_type(data, type); | ||
| 1000 | |||
| 1001 | return -ENOSYS; | ||
| 1002 | } | ||
| 1003 | |||
| 1004 | /** | ||
| 988 | * irq_chip_retrigger_hierarchy - Retrigger an interrupt in hardware | 1005 | * irq_chip_retrigger_hierarchy - Retrigger an interrupt in hardware |
| 989 | * @data: Pointer to interrupt specific data | 1006 | * @data: Pointer to interrupt specific data |
| 990 | * | 1007 | * |
| @@ -997,7 +1014,7 @@ int irq_chip_retrigger_hierarchy(struct irq_data *data) | |||
| 997 | if (data->chip && data->chip->irq_retrigger) | 1014 | if (data->chip && data->chip->irq_retrigger) |
| 998 | return data->chip->irq_retrigger(data); | 1015 | return data->chip->irq_retrigger(data); |
| 999 | 1016 | ||
| 1000 | return -ENOSYS; | 1017 | return 0; |
| 1001 | } | 1018 | } |
| 1002 | 1019 | ||
| 1003 | /** | 1020 | /** |
diff --git a/kernel/kthread.c b/kernel/kthread.c index 10e489c448fe..fdea0bee7b5a 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
| @@ -97,6 +97,7 @@ bool kthread_should_park(void) | |||
| 97 | { | 97 | { |
| 98 | return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags); | 98 | return test_bit(KTHREAD_SHOULD_PARK, &to_kthread(current)->flags); |
| 99 | } | 99 | } |
| 100 | EXPORT_SYMBOL_GPL(kthread_should_park); | ||
| 100 | 101 | ||
| 101 | /** | 102 | /** |
| 102 | * kthread_freezable_should_stop - should this freezable kthread return now? | 103 | * kthread_freezable_should_stop - should this freezable kthread return now? |
| @@ -171,6 +172,7 @@ void kthread_parkme(void) | |||
| 171 | { | 172 | { |
| 172 | __kthread_parkme(to_kthread(current)); | 173 | __kthread_parkme(to_kthread(current)); |
| 173 | } | 174 | } |
| 175 | EXPORT_SYMBOL_GPL(kthread_parkme); | ||
| 174 | 176 | ||
| 175 | static int kthread(void *_create) | 177 | static int kthread(void *_create) |
| 176 | { | 178 | { |
| @@ -411,6 +413,7 @@ void kthread_unpark(struct task_struct *k) | |||
| 411 | if (kthread) | 413 | if (kthread) |
| 412 | __kthread_unpark(k, kthread); | 414 | __kthread_unpark(k, kthread); |
| 413 | } | 415 | } |
| 416 | EXPORT_SYMBOL_GPL(kthread_unpark); | ||
| 414 | 417 | ||
| 415 | /** | 418 | /** |
| 416 | * kthread_park - park a thread created by kthread_create(). | 419 | * kthread_park - park a thread created by kthread_create(). |
| @@ -441,6 +444,7 @@ int kthread_park(struct task_struct *k) | |||
| 441 | } | 444 | } |
| 442 | return ret; | 445 | return ret; |
| 443 | } | 446 | } |
| 447 | EXPORT_SYMBOL_GPL(kthread_park); | ||
| 444 | 448 | ||
| 445 | /** | 449 | /** |
| 446 | * kthread_stop - stop a thread created by kthread_create(). | 450 | * kthread_stop - stop a thread created by kthread_create(). |
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h index 04ab18151cc8..df19ae4debd0 100644 --- a/kernel/locking/qspinlock_paravirt.h +++ b/kernel/locking/qspinlock_paravirt.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <linux/hash.h> | 5 | #include <linux/hash.h> |
| 6 | #include <linux/bootmem.h> | 6 | #include <linux/bootmem.h> |
| 7 | #include <linux/debug_locks.h> | ||
| 7 | 8 | ||
| 8 | /* | 9 | /* |
| 9 | * Implement paravirt qspinlocks; the general idea is to halt the vcpus instead | 10 | * Implement paravirt qspinlocks; the general idea is to halt the vcpus instead |
| @@ -286,15 +287,23 @@ __visible void __pv_queued_spin_unlock(struct qspinlock *lock) | |||
| 286 | { | 287 | { |
| 287 | struct __qspinlock *l = (void *)lock; | 288 | struct __qspinlock *l = (void *)lock; |
| 288 | struct pv_node *node; | 289 | struct pv_node *node; |
| 290 | u8 lockval = cmpxchg(&l->locked, _Q_LOCKED_VAL, 0); | ||
| 289 | 291 | ||
| 290 | /* | 292 | /* |
| 291 | * We must not unlock if SLOW, because in that case we must first | 293 | * We must not unlock if SLOW, because in that case we must first |
| 292 | * unhash. Otherwise it would be possible to have multiple @lock | 294 | * unhash. Otherwise it would be possible to have multiple @lock |
| 293 | * entries, which would be BAD. | 295 | * entries, which would be BAD. |
| 294 | */ | 296 | */ |
| 295 | if (likely(cmpxchg(&l->locked, _Q_LOCKED_VAL, 0) == _Q_LOCKED_VAL)) | 297 | if (likely(lockval == _Q_LOCKED_VAL)) |
| 296 | return; | 298 | return; |
| 297 | 299 | ||
| 300 | if (unlikely(lockval != _Q_SLOW_VAL)) { | ||
| 301 | if (debug_locks_silent) | ||
| 302 | return; | ||
| 303 | WARN(1, "pvqspinlock: lock %p has corrupted value 0x%x!\n", lock, atomic_read(&lock->val)); | ||
| 304 | return; | ||
| 305 | } | ||
| 306 | |||
| 298 | /* | 307 | /* |
| 299 | * Since the above failed to release, this must be the SLOW path. | 308 | * Since the above failed to release, this must be the SLOW path. |
| 300 | * Therefore start by looking up the blocked node and unhashing it. | 309 | * Therefore start by looking up the blocked node and unhashing it. |
diff --git a/kernel/module.c b/kernel/module.c index 4d2b82e610e2..b86b7bf1be38 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -602,13 +602,16 @@ const struct kernel_symbol *find_symbol(const char *name, | |||
| 602 | } | 602 | } |
| 603 | EXPORT_SYMBOL_GPL(find_symbol); | 603 | EXPORT_SYMBOL_GPL(find_symbol); |
| 604 | 604 | ||
| 605 | /* Search for module by name: must hold module_mutex. */ | 605 | /* |
| 606 | * Search for module by name: must hold module_mutex (or preempt disabled | ||
| 607 | * for read-only access). | ||
| 608 | */ | ||
| 606 | static struct module *find_module_all(const char *name, size_t len, | 609 | static struct module *find_module_all(const char *name, size_t len, |
| 607 | bool even_unformed) | 610 | bool even_unformed) |
| 608 | { | 611 | { |
| 609 | struct module *mod; | 612 | struct module *mod; |
| 610 | 613 | ||
| 611 | module_assert_mutex(); | 614 | module_assert_mutex_or_preempt(); |
| 612 | 615 | ||
| 613 | list_for_each_entry(mod, &modules, list) { | 616 | list_for_each_entry(mod, &modules, list) { |
| 614 | if (!even_unformed && mod->state == MODULE_STATE_UNFORMED) | 617 | if (!even_unformed && mod->state == MODULE_STATE_UNFORMED) |
| @@ -621,6 +624,7 @@ static struct module *find_module_all(const char *name, size_t len, | |||
| 621 | 624 | ||
| 622 | struct module *find_module(const char *name) | 625 | struct module *find_module(const char *name) |
| 623 | { | 626 | { |
| 627 | module_assert_mutex(); | ||
| 624 | return find_module_all(name, strlen(name), false); | 628 | return find_module_all(name, strlen(name), false); |
| 625 | } | 629 | } |
| 626 | EXPORT_SYMBOL_GPL(find_module); | 630 | EXPORT_SYMBOL_GPL(find_module); |
diff --git a/kernel/signal.c b/kernel/signal.c index 836df8dac6cc..0f6bbbe77b46 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
| @@ -2748,12 +2748,15 @@ int copy_siginfo_to_user(siginfo_t __user *to, const siginfo_t *from) | |||
| 2748 | * Other callers might not initialize the si_lsb field, | 2748 | * Other callers might not initialize the si_lsb field, |
| 2749 | * so check explicitly for the right codes here. | 2749 | * so check explicitly for the right codes here. |
| 2750 | */ | 2750 | */ |
| 2751 | if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) | 2751 | if (from->si_signo == SIGBUS && |
| 2752 | (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) | ||
| 2752 | err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); | 2753 | err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); |
| 2753 | #endif | 2754 | #endif |
| 2754 | #ifdef SEGV_BNDERR | 2755 | #ifdef SEGV_BNDERR |
| 2755 | err |= __put_user(from->si_lower, &to->si_lower); | 2756 | if (from->si_signo == SIGSEGV && from->si_code == SEGV_BNDERR) { |
| 2756 | err |= __put_user(from->si_upper, &to->si_upper); | 2757 | err |= __put_user(from->si_lower, &to->si_lower); |
| 2758 | err |= __put_user(from->si_upper, &to->si_upper); | ||
| 2759 | } | ||
| 2757 | #endif | 2760 | #endif |
| 2758 | break; | 2761 | break; |
| 2759 | case __SI_CHLD: | 2762 | case __SI_CHLD: |
| @@ -3017,7 +3020,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, | |||
| 3017 | int, sig, | 3020 | int, sig, |
| 3018 | struct compat_siginfo __user *, uinfo) | 3021 | struct compat_siginfo __user *, uinfo) |
| 3019 | { | 3022 | { |
| 3020 | siginfo_t info; | 3023 | siginfo_t info = {}; |
| 3021 | int ret = copy_siginfo_from_user32(&info, uinfo); | 3024 | int ret = copy_siginfo_from_user32(&info, uinfo); |
| 3022 | if (unlikely(ret)) | 3025 | if (unlikely(ret)) |
| 3023 | return ret; | 3026 | return ret; |
| @@ -3061,7 +3064,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, | |||
| 3061 | int, sig, | 3064 | int, sig, |
| 3062 | struct compat_siginfo __user *, uinfo) | 3065 | struct compat_siginfo __user *, uinfo) |
| 3063 | { | 3066 | { |
| 3064 | siginfo_t info; | 3067 | siginfo_t info = {}; |
| 3065 | 3068 | ||
| 3066 | if (copy_siginfo_from_user32(&info, uinfo)) | 3069 | if (copy_siginfo_from_user32(&info, uinfo)) |
| 3067 | return -EFAULT; | 3070 | return -EFAULT; |
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 5e097fa9faf7..84190f02b521 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
| @@ -807,8 +807,8 @@ __mod_timer(struct timer_list *timer, unsigned long expires, | |||
| 807 | spin_unlock(&base->lock); | 807 | spin_unlock(&base->lock); |
| 808 | base = new_base; | 808 | base = new_base; |
| 809 | spin_lock(&base->lock); | 809 | spin_lock(&base->lock); |
| 810 | timer->flags &= ~TIMER_BASEMASK; | 810 | WRITE_ONCE(timer->flags, |
| 811 | timer->flags |= base->cpu; | 811 | (timer->flags & ~TIMER_BASEMASK) | base->cpu); |
| 812 | } | 812 | } |
| 813 | } | 813 | } |
| 814 | 814 | ||
diff --git a/lib/iommu-common.c b/lib/iommu-common.c index df30632f0bef..ff19f66d3f7f 100644 --- a/lib/iommu-common.c +++ b/lib/iommu-common.c | |||
| @@ -119,7 +119,7 @@ unsigned long iommu_tbl_range_alloc(struct device *dev, | |||
| 119 | unsigned long align_mask = 0; | 119 | unsigned long align_mask = 0; |
| 120 | 120 | ||
| 121 | if (align_order > 0) | 121 | if (align_order > 0) |
| 122 | align_mask = 0xffffffffffffffffl >> (64 - align_order); | 122 | align_mask = ~0ul >> (BITS_PER_LONG - align_order); |
| 123 | 123 | ||
| 124 | /* Sanity check */ | 124 | /* Sanity check */ |
| 125 | if (unlikely(npages == 0)) { | 125 | if (unlikely(npages == 0)) { |
| @@ -16,7 +16,7 @@ struct cma { | |||
| 16 | extern struct cma cma_areas[MAX_CMA_AREAS]; | 16 | extern struct cma cma_areas[MAX_CMA_AREAS]; |
| 17 | extern unsigned cma_area_count; | 17 | extern unsigned cma_area_count; |
| 18 | 18 | ||
| 19 | static unsigned long cma_bitmap_maxno(struct cma *cma) | 19 | static inline unsigned long cma_bitmap_maxno(struct cma *cma) |
| 20 | { | 20 | { |
| 21 | return cma->count >> cma->order_per_bit; | 21 | return cma->count >> cma->order_per_bit; |
| 22 | } | 22 | } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index c107094f79ba..097c7a4bfbd9 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -1676,12 +1676,7 @@ static void __split_huge_page_refcount(struct page *page, | |||
| 1676 | /* after clearing PageTail the gup refcount can be released */ | 1676 | /* after clearing PageTail the gup refcount can be released */ |
| 1677 | smp_mb__after_atomic(); | 1677 | smp_mb__after_atomic(); |
| 1678 | 1678 | ||
| 1679 | /* | 1679 | page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP; |
| 1680 | * retain hwpoison flag of the poisoned tail page: | ||
| 1681 | * fix for the unsuitable process killed on Guest Machine(KVM) | ||
| 1682 | * by the memory-failure. | ||
| 1683 | */ | ||
| 1684 | page_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP | __PG_HWPOISON; | ||
| 1685 | page_tail->flags |= (page->flags & | 1680 | page_tail->flags |= (page->flags & |
| 1686 | ((1L << PG_referenced) | | 1681 | ((1L << PG_referenced) | |
| 1687 | (1L << PG_swapbacked) | | 1682 | (1L << PG_swapbacked) | |
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index 6c513a63ea84..7b28e9cdf1c7 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * This file contains shadow memory manipulation code. | 2 | * This file contains shadow memory manipulation code. |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. |
| 5 | * Author: Andrey Ryabinin <a.ryabinin@samsung.com> | 5 | * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> |
| 6 | * | 6 | * |
| 7 | * Some of code borrowed from https://github.com/xairy/linux by | 7 | * Some of code borrowed from https://github.com/xairy/linux by |
| 8 | * Andrey Konovalov <adech.fo@gmail.com> | 8 | * Andrey Konovalov <adech.fo@gmail.com> |
diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 680ceedf810a..e07c94fbd0ac 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * This file contains error reporting code. | 2 | * This file contains error reporting code. |
| 3 | * | 3 | * |
| 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. | 4 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. |
| 5 | * Author: Andrey Ryabinin <a.ryabinin@samsung.com> | 5 | * Author: Andrey Ryabinin <ryabinin.a.a@gmail.com> |
| 6 | * | 6 | * |
| 7 | * Some of code borrowed from https://github.com/xairy/linux by | 7 | * Some of code borrowed from https://github.com/xairy/linux by |
| 8 | * Andrey Konovalov <adech.fo@gmail.com> | 8 | * Andrey Konovalov <adech.fo@gmail.com> |
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index c53543d89282..1f4446a90cef 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
| @@ -909,6 +909,18 @@ int get_hwpoison_page(struct page *page) | |||
| 909 | * directly for tail pages. | 909 | * directly for tail pages. |
| 910 | */ | 910 | */ |
| 911 | if (PageTransHuge(head)) { | 911 | if (PageTransHuge(head)) { |
| 912 | /* | ||
| 913 | * Non anonymous thp exists only in allocation/free time. We | ||
| 914 | * can't handle such a case correctly, so let's give it up. | ||
| 915 | * This should be better than triggering BUG_ON when kernel | ||
| 916 | * tries to touch the "partially handled" page. | ||
| 917 | */ | ||
| 918 | if (!PageAnon(head)) { | ||
| 919 | pr_err("MCE: %#lx: non anonymous thp\n", | ||
| 920 | page_to_pfn(page)); | ||
| 921 | return 0; | ||
| 922 | } | ||
| 923 | |||
| 912 | if (get_page_unless_zero(head)) { | 924 | if (get_page_unless_zero(head)) { |
| 913 | if (PageTail(page)) | 925 | if (PageTail(page)) |
| 914 | get_page(page); | 926 | get_page(page); |
| @@ -1134,17 +1146,11 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1134 | } | 1146 | } |
| 1135 | 1147 | ||
| 1136 | if (!PageHuge(p) && PageTransHuge(hpage)) { | 1148 | if (!PageHuge(p) && PageTransHuge(hpage)) { |
| 1137 | if (!PageAnon(hpage)) { | 1149 | if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) { |
| 1138 | pr_err("MCE: %#lx: non anonymous thp\n", pfn); | 1150 | if (!PageAnon(hpage)) |
| 1139 | if (TestClearPageHWPoison(p)) | 1151 | pr_err("MCE: %#lx: non anonymous thp\n", pfn); |
| 1140 | atomic_long_sub(nr_pages, &num_poisoned_pages); | 1152 | else |
| 1141 | put_page(p); | 1153 | pr_err("MCE: %#lx: thp split failed\n", pfn); |
| 1142 | if (p != hpage) | ||
| 1143 | put_page(hpage); | ||
| 1144 | return -EBUSY; | ||
| 1145 | } | ||
| 1146 | if (unlikely(split_huge_page(hpage))) { | ||
| 1147 | pr_err("MCE: %#lx: thp split failed\n", pfn); | ||
| 1148 | if (TestClearPageHWPoison(p)) | 1154 | if (TestClearPageHWPoison(p)) |
| 1149 | atomic_long_sub(nr_pages, &num_poisoned_pages); | 1155 | atomic_long_sub(nr_pages, &num_poisoned_pages); |
| 1150 | put_page(p); | 1156 | put_page(p); |
| @@ -1209,9 +1215,9 @@ int memory_failure(unsigned long pfn, int trapno, int flags) | |||
| 1209 | if (!PageHWPoison(p)) { | 1215 | if (!PageHWPoison(p)) { |
| 1210 | printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); | 1216 | printk(KERN_ERR "MCE %#lx: just unpoisoned\n", pfn); |
| 1211 | atomic_long_sub(nr_pages, &num_poisoned_pages); | 1217 | atomic_long_sub(nr_pages, &num_poisoned_pages); |
| 1218 | unlock_page(hpage); | ||
| 1212 | put_page(hpage); | 1219 | put_page(hpage); |
| 1213 | res = 0; | 1220 | return 0; |
| 1214 | goto out; | ||
| 1215 | } | 1221 | } |
| 1216 | if (hwpoison_filter(p)) { | 1222 | if (hwpoison_filter(p)) { |
| 1217 | if (TestClearPageHWPoison(p)) | 1223 | if (TestClearPageHWPoison(p)) |
| @@ -1535,6 +1541,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) | |||
| 1535 | */ | 1541 | */ |
| 1536 | ret = __get_any_page(page, pfn, 0); | 1542 | ret = __get_any_page(page, pfn, 0); |
| 1537 | if (!PageLRU(page)) { | 1543 | if (!PageLRU(page)) { |
| 1544 | /* Drop page reference which is from __get_any_page() */ | ||
| 1545 | put_page(page); | ||
| 1538 | pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", | 1546 | pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", |
| 1539 | pfn, page->flags); | 1547 | pfn, page->flags); |
| 1540 | return -EIO; | 1548 | return -EIO; |
| @@ -1564,13 +1572,12 @@ static int soft_offline_huge_page(struct page *page, int flags) | |||
| 1564 | unlock_page(hpage); | 1572 | unlock_page(hpage); |
| 1565 | 1573 | ||
| 1566 | ret = isolate_huge_page(hpage, &pagelist); | 1574 | ret = isolate_huge_page(hpage, &pagelist); |
| 1567 | if (ret) { | 1575 | /* |
| 1568 | /* | 1576 | * get_any_page() and isolate_huge_page() takes a refcount each, |
| 1569 | * get_any_page() and isolate_huge_page() takes a refcount each, | 1577 | * so need to drop one here. |
| 1570 | * so need to drop one here. | 1578 | */ |
| 1571 | */ | 1579 | put_page(hpage); |
| 1572 | put_page(hpage); | 1580 | if (!ret) { |
| 1573 | } else { | ||
| 1574 | pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); | 1581 | pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); |
| 1575 | return -EBUSY; | 1582 | return -EBUSY; |
| 1576 | } | 1583 | } |
| @@ -1656,6 +1663,8 @@ static int __soft_offline_page(struct page *page, int flags) | |||
| 1656 | inc_zone_page_state(page, NR_ISOLATED_ANON + | 1663 | inc_zone_page_state(page, NR_ISOLATED_ANON + |
| 1657 | page_is_file_cache(page)); | 1664 | page_is_file_cache(page)); |
| 1658 | list_add(&page->lru, &pagelist); | 1665 | list_add(&page->lru, &pagelist); |
| 1666 | if (!TestSetPageHWPoison(page)) | ||
| 1667 | atomic_long_inc(&num_poisoned_pages); | ||
| 1659 | ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, | 1668 | ret = migrate_pages(&pagelist, new_page, NULL, MPOL_MF_MOVE_ALL, |
| 1660 | MIGRATE_SYNC, MR_MEMORY_FAILURE); | 1669 | MIGRATE_SYNC, MR_MEMORY_FAILURE); |
| 1661 | if (ret) { | 1670 | if (ret) { |
| @@ -1670,9 +1679,8 @@ static int __soft_offline_page(struct page *page, int flags) | |||
| 1670 | pfn, ret, page->flags); | 1679 | pfn, ret, page->flags); |
| 1671 | if (ret > 0) | 1680 | if (ret > 0) |
| 1672 | ret = -EIO; | 1681 | ret = -EIO; |
| 1673 | } else { | 1682 | if (TestClearPageHWPoison(page)) |
| 1674 | SetPageHWPoison(page); | 1683 | atomic_long_dec(&num_poisoned_pages); |
| 1675 | atomic_long_inc(&num_poisoned_pages); | ||
| 1676 | } | 1684 | } |
| 1677 | } else { | 1685 | } else { |
| 1678 | pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n", | 1686 | pr_info("soft offline: %#lx: isolation failed: %d, page count %d, type %lx\n", |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 26fbba7d888f..6da82bcb0a8b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
| @@ -446,7 +446,7 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) | |||
| 446 | int nr_pages = PAGES_PER_SECTION; | 446 | int nr_pages = PAGES_PER_SECTION; |
| 447 | int nid = pgdat->node_id; | 447 | int nid = pgdat->node_id; |
| 448 | int zone_type; | 448 | int zone_type; |
| 449 | unsigned long flags; | 449 | unsigned long flags, pfn; |
| 450 | int ret; | 450 | int ret; |
| 451 | 451 | ||
| 452 | zone_type = zone - pgdat->node_zones; | 452 | zone_type = zone - pgdat->node_zones; |
| @@ -461,6 +461,14 @@ static int __meminit __add_zone(struct zone *zone, unsigned long phys_start_pfn) | |||
| 461 | pgdat_resize_unlock(zone->zone_pgdat, &flags); | 461 | pgdat_resize_unlock(zone->zone_pgdat, &flags); |
| 462 | memmap_init_zone(nr_pages, nid, zone_type, | 462 | memmap_init_zone(nr_pages, nid, zone_type, |
| 463 | phys_start_pfn, MEMMAP_HOTPLUG); | 463 | phys_start_pfn, MEMMAP_HOTPLUG); |
| 464 | |||
| 465 | /* online_page_range is called later and expects pages reserved */ | ||
| 466 | for (pfn = phys_start_pfn; pfn < phys_start_pfn + nr_pages; pfn++) { | ||
| 467 | if (!pfn_valid(pfn)) | ||
| 468 | continue; | ||
| 469 | |||
| 470 | SetPageReserved(pfn_to_page(pfn)); | ||
| 471 | } | ||
| 464 | return 0; | 472 | return 0; |
| 465 | } | 473 | } |
| 466 | 474 | ||
| @@ -1269,6 +1277,7 @@ int __ref add_memory(int nid, u64 start, u64 size) | |||
| 1269 | 1277 | ||
| 1270 | /* create new memmap entry */ | 1278 | /* create new memmap entry */ |
| 1271 | firmware_map_add_hotplug(start, start + size, "System RAM"); | 1279 | firmware_map_add_hotplug(start, start + size, "System RAM"); |
| 1280 | memblock_add_node(start, size, nid); | ||
| 1272 | 1281 | ||
| 1273 | goto out; | 1282 | goto out; |
| 1274 | 1283 | ||
| @@ -2005,6 +2014,8 @@ void __ref remove_memory(int nid, u64 start, u64 size) | |||
| 2005 | 2014 | ||
| 2006 | /* remove memmap entry */ | 2015 | /* remove memmap entry */ |
| 2007 | firmware_map_remove(start, start + size, "System RAM"); | 2016 | firmware_map_remove(start, start + size, "System RAM"); |
| 2017 | memblock_free(start, size); | ||
| 2018 | memblock_remove(start, size); | ||
| 2008 | 2019 | ||
| 2009 | arch_remove_memory(start, size); | 2020 | arch_remove_memory(start, size); |
| 2010 | 2021 | ||
diff --git a/mm/migrate.c b/mm/migrate.c index ee401e4e5ef1..eb4267107d1f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
| @@ -880,7 +880,8 @@ static int __unmap_and_move(struct page *page, struct page *newpage, | |||
| 880 | /* Establish migration ptes or remove ptes */ | 880 | /* Establish migration ptes or remove ptes */ |
| 881 | if (page_mapped(page)) { | 881 | if (page_mapped(page)) { |
| 882 | try_to_unmap(page, | 882 | try_to_unmap(page, |
| 883 | TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS); | 883 | TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS| |
| 884 | TTU_IGNORE_HWPOISON); | ||
| 884 | page_was_mapped = 1; | 885 | page_was_mapped = 1; |
| 885 | } | 886 | } |
| 886 | 887 | ||
| @@ -950,7 +951,10 @@ out: | |||
| 950 | list_del(&page->lru); | 951 | list_del(&page->lru); |
| 951 | dec_zone_page_state(page, NR_ISOLATED_ANON + | 952 | dec_zone_page_state(page, NR_ISOLATED_ANON + |
| 952 | page_is_file_cache(page)); | 953 | page_is_file_cache(page)); |
| 953 | if (reason != MR_MEMORY_FAILURE) | 954 | /* Soft-offlined page shouldn't go through lru cache list */ |
| 955 | if (reason == MR_MEMORY_FAILURE) | ||
| 956 | put_page(page); | ||
| 957 | else | ||
| 954 | putback_lru_page(page); | 958 | putback_lru_page(page); |
| 955 | } | 959 | } |
| 956 | 960 | ||
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 22cddd3e5de8..5cccc127ef81 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -2063,10 +2063,10 @@ static struct notifier_block ratelimit_nb = { | |||
| 2063 | */ | 2063 | */ |
| 2064 | void __init page_writeback_init(void) | 2064 | void __init page_writeback_init(void) |
| 2065 | { | 2065 | { |
| 2066 | BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); | ||
| 2067 | |||
| 2066 | writeback_set_ratelimit(); | 2068 | writeback_set_ratelimit(); |
| 2067 | register_cpu_notifier(&ratelimit_nb); | 2069 | register_cpu_notifier(&ratelimit_nb); |
| 2068 | |||
| 2069 | BUG_ON(wb_domain_init(&global_wb_domain, GFP_KERNEL)); | ||
| 2070 | } | 2070 | } |
| 2071 | 2071 | ||
| 2072 | /** | 2072 | /** |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ef19f22b2b7d..5b5240b7f642 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
| 19 | #include <linux/swap.h> | 19 | #include <linux/swap.h> |
| 20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| 21 | #include <linux/rwsem.h> | ||
| 22 | #include <linux/pagemap.h> | 21 | #include <linux/pagemap.h> |
| 23 | #include <linux/jiffies.h> | 22 | #include <linux/jiffies.h> |
| 24 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
| @@ -981,21 +980,21 @@ static void __init __free_pages_boot_core(struct page *page, | |||
| 981 | 980 | ||
| 982 | #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ | 981 | #if defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) || \ |
| 983 | defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) | 982 | defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) |
| 984 | /* Only safe to use early in boot when initialisation is single-threaded */ | 983 | |
| 985 | static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; | 984 | static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; |
| 986 | 985 | ||
| 987 | int __meminit early_pfn_to_nid(unsigned long pfn) | 986 | int __meminit early_pfn_to_nid(unsigned long pfn) |
| 988 | { | 987 | { |
| 988 | static DEFINE_SPINLOCK(early_pfn_lock); | ||
| 989 | int nid; | 989 | int nid; |
| 990 | 990 | ||
| 991 | /* The system will behave unpredictably otherwise */ | 991 | spin_lock(&early_pfn_lock); |
| 992 | BUG_ON(system_state != SYSTEM_BOOTING); | ||
| 993 | |||
| 994 | nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); | 992 | nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); |
| 995 | if (nid >= 0) | 993 | if (nid < 0) |
| 996 | return nid; | 994 | nid = 0; |
| 997 | /* just returns 0 */ | 995 | spin_unlock(&early_pfn_lock); |
| 998 | return 0; | 996 | |
| 997 | return nid; | ||
| 999 | } | 998 | } |
| 1000 | #endif | 999 | #endif |
| 1001 | 1000 | ||
| @@ -1060,7 +1059,15 @@ static void __init deferred_free_range(struct page *page, | |||
| 1060 | __free_pages_boot_core(page, pfn, 0); | 1059 | __free_pages_boot_core(page, pfn, 0); |
| 1061 | } | 1060 | } |
| 1062 | 1061 | ||
| 1063 | static __initdata DECLARE_RWSEM(pgdat_init_rwsem); | 1062 | /* Completion tracking for deferred_init_memmap() threads */ |
| 1063 | static atomic_t pgdat_init_n_undone __initdata; | ||
| 1064 | static __initdata DECLARE_COMPLETION(pgdat_init_all_done_comp); | ||
| 1065 | |||
| 1066 | static inline void __init pgdat_init_report_one_done(void) | ||
| 1067 | { | ||
| 1068 | if (atomic_dec_and_test(&pgdat_init_n_undone)) | ||
| 1069 | complete(&pgdat_init_all_done_comp); | ||
| 1070 | } | ||
| 1064 | 1071 | ||
| 1065 | /* Initialise remaining memory on a node */ | 1072 | /* Initialise remaining memory on a node */ |
| 1066 | static int __init deferred_init_memmap(void *data) | 1073 | static int __init deferred_init_memmap(void *data) |
| @@ -1077,7 +1084,7 @@ static int __init deferred_init_memmap(void *data) | |||
| 1077 | const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); | 1084 | const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); |
| 1078 | 1085 | ||
| 1079 | if (first_init_pfn == ULONG_MAX) { | 1086 | if (first_init_pfn == ULONG_MAX) { |
| 1080 | up_read(&pgdat_init_rwsem); | 1087 | pgdat_init_report_one_done(); |
| 1081 | return 0; | 1088 | return 0; |
| 1082 | } | 1089 | } |
| 1083 | 1090 | ||
| @@ -1177,7 +1184,8 @@ free_range: | |||
| 1177 | 1184 | ||
| 1178 | pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, | 1185 | pr_info("node %d initialised, %lu pages in %ums\n", nid, nr_pages, |
| 1179 | jiffies_to_msecs(jiffies - start)); | 1186 | jiffies_to_msecs(jiffies - start)); |
| 1180 | up_read(&pgdat_init_rwsem); | 1187 | |
| 1188 | pgdat_init_report_one_done(); | ||
| 1181 | return 0; | 1189 | return 0; |
| 1182 | } | 1190 | } |
| 1183 | 1191 | ||
| @@ -1185,14 +1193,17 @@ void __init page_alloc_init_late(void) | |||
| 1185 | { | 1193 | { |
| 1186 | int nid; | 1194 | int nid; |
| 1187 | 1195 | ||
| 1196 | /* There will be num_node_state(N_MEMORY) threads */ | ||
| 1197 | atomic_set(&pgdat_init_n_undone, num_node_state(N_MEMORY)); | ||
| 1188 | for_each_node_state(nid, N_MEMORY) { | 1198 | for_each_node_state(nid, N_MEMORY) { |
| 1189 | down_read(&pgdat_init_rwsem); | ||
| 1190 | kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); | 1199 | kthread_run(deferred_init_memmap, NODE_DATA(nid), "pgdatinit%d", nid); |
| 1191 | } | 1200 | } |
| 1192 | 1201 | ||
| 1193 | /* Block until all are initialised */ | 1202 | /* Block until all are initialised */ |
| 1194 | down_write(&pgdat_init_rwsem); | 1203 | wait_for_completion(&pgdat_init_all_done_comp); |
| 1195 | up_write(&pgdat_init_rwsem); | 1204 | |
| 1205 | /* Reinit limits that are based on free pages after the kernel is up */ | ||
| 1206 | files_maxfiles_init(); | ||
| 1196 | } | 1207 | } |
| 1197 | #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ | 1208 | #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ |
| 1198 | 1209 | ||
| @@ -1285,6 +1296,10 @@ static inline int check_new_page(struct page *page) | |||
| 1285 | bad_reason = "non-NULL mapping"; | 1296 | bad_reason = "non-NULL mapping"; |
| 1286 | if (unlikely(atomic_read(&page->_count) != 0)) | 1297 | if (unlikely(atomic_read(&page->_count) != 0)) |
| 1287 | bad_reason = "nonzero _count"; | 1298 | bad_reason = "nonzero _count"; |
| 1299 | if (unlikely(page->flags & __PG_HWPOISON)) { | ||
| 1300 | bad_reason = "HWPoisoned (hardware-corrupted)"; | ||
| 1301 | bad_flags = __PG_HWPOISON; | ||
| 1302 | } | ||
| 1288 | if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { | 1303 | if (unlikely(page->flags & PAGE_FLAGS_CHECK_AT_PREP)) { |
| 1289 | bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; | 1304 | bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; |
| 1290 | bad_flags = PAGE_FLAGS_CHECK_AT_PREP; | 1305 | bad_flags = PAGE_FLAGS_CHECK_AT_PREP; |
| @@ -1328,12 +1343,15 @@ static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags, | |||
| 1328 | set_page_owner(page, order, gfp_flags); | 1343 | set_page_owner(page, order, gfp_flags); |
| 1329 | 1344 | ||
| 1330 | /* | 1345 | /* |
| 1331 | * page->pfmemalloc is set when ALLOC_NO_WATERMARKS was necessary to | 1346 | * page is set pfmemalloc when ALLOC_NO_WATERMARKS was necessary to |
| 1332 | * allocate the page. The expectation is that the caller is taking | 1347 | * allocate the page. The expectation is that the caller is taking |
| 1333 | * steps that will free more memory. The caller should avoid the page | 1348 | * steps that will free more memory. The caller should avoid the page |
| 1334 | * being used for !PFMEMALLOC purposes. | 1349 | * being used for !PFMEMALLOC purposes. |
| 1335 | */ | 1350 | */ |
| 1336 | page->pfmemalloc = !!(alloc_flags & ALLOC_NO_WATERMARKS); | 1351 | if (alloc_flags & ALLOC_NO_WATERMARKS) |
| 1352 | set_page_pfmemalloc(page); | ||
| 1353 | else | ||
| 1354 | clear_page_pfmemalloc(page); | ||
| 1337 | 1355 | ||
| 1338 | return 0; | 1356 | return 0; |
| 1339 | } | 1357 | } |
| @@ -3330,7 +3348,7 @@ refill: | |||
| 3330 | atomic_add(size - 1, &page->_count); | 3348 | atomic_add(size - 1, &page->_count); |
| 3331 | 3349 | ||
| 3332 | /* reset page count bias and offset to start of new frag */ | 3350 | /* reset page count bias and offset to start of new frag */ |
| 3333 | nc->pfmemalloc = page->pfmemalloc; | 3351 | nc->pfmemalloc = page_is_pfmemalloc(page); |
| 3334 | nc->pagecnt_bias = size; | 3352 | nc->pagecnt_bias = size; |
| 3335 | nc->offset = size; | 3353 | nc->offset = size; |
| 3336 | } | 3354 | } |
| @@ -5045,6 +5063,10 @@ static unsigned long __meminit zone_spanned_pages_in_node(int nid, | |||
| 5045 | { | 5063 | { |
| 5046 | unsigned long zone_start_pfn, zone_end_pfn; | 5064 | unsigned long zone_start_pfn, zone_end_pfn; |
| 5047 | 5065 | ||
| 5066 | /* When hotadd a new node, the node should be empty */ | ||
| 5067 | if (!node_start_pfn && !node_end_pfn) | ||
| 5068 | return 0; | ||
| 5069 | |||
| 5048 | /* Get the start and end of the zone */ | 5070 | /* Get the start and end of the zone */ |
| 5049 | zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; | 5071 | zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type]; |
| 5050 | zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; | 5072 | zone_end_pfn = arch_zone_highest_possible_pfn[zone_type]; |
| @@ -5108,6 +5130,10 @@ static unsigned long __meminit zone_absent_pages_in_node(int nid, | |||
| 5108 | unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; | 5130 | unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type]; |
| 5109 | unsigned long zone_start_pfn, zone_end_pfn; | 5131 | unsigned long zone_start_pfn, zone_end_pfn; |
| 5110 | 5132 | ||
| 5133 | /* When hotadd a new node, the node should be empty */ | ||
| 5134 | if (!node_start_pfn && !node_end_pfn) | ||
| 5135 | return 0; | ||
| 5136 | |||
| 5111 | zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); | 5137 | zone_start_pfn = clamp(node_start_pfn, zone_low, zone_high); |
| 5112 | zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); | 5138 | zone_end_pfn = clamp(node_end_pfn, zone_low, zone_high); |
| 5113 | 5139 | ||
diff --git a/mm/shmem.c b/mm/shmem.c index 4caf8ed24d65..dbe0c1e8349c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
| @@ -3363,8 +3363,8 @@ put_path: | |||
| 3363 | * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be | 3363 | * shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be |
| 3364 | * kernel internal. There will be NO LSM permission checks against the | 3364 | * kernel internal. There will be NO LSM permission checks against the |
| 3365 | * underlying inode. So users of this interface must do LSM checks at a | 3365 | * underlying inode. So users of this interface must do LSM checks at a |
| 3366 | * higher layer. The one user is the big_key implementation. LSM checks | 3366 | * higher layer. The users are the big_key and shm implementations. LSM |
| 3367 | * are provided at the key level rather than the inode level. | 3367 | * checks are provided at the key or shm level rather than the inode. |
| 3368 | * @name: name for dentry (to be seen in /proc/<pid>/maps | 3368 | * @name: name for dentry (to be seen in /proc/<pid>/maps |
| 3369 | * @size: size to be set for the file | 3369 | * @size: size to be set for the file |
| 3370 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size | 3370 | * @flags: VM_NORESERVE suppresses pre-accounting of the entire object size |
| @@ -1603,7 +1603,7 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, | |||
| 1603 | } | 1603 | } |
| 1604 | 1604 | ||
| 1605 | /* Record if ALLOC_NO_WATERMARKS was set when allocating the slab */ | 1605 | /* Record if ALLOC_NO_WATERMARKS was set when allocating the slab */ |
| 1606 | if (unlikely(page->pfmemalloc)) | 1606 | if (page_is_pfmemalloc(page)) |
| 1607 | pfmemalloc_active = true; | 1607 | pfmemalloc_active = true; |
| 1608 | 1608 | ||
| 1609 | nr_pages = (1 << cachep->gfporder); | 1609 | nr_pages = (1 << cachep->gfporder); |
| @@ -1614,7 +1614,7 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, | |||
| 1614 | add_zone_page_state(page_zone(page), | 1614 | add_zone_page_state(page_zone(page), |
| 1615 | NR_SLAB_UNRECLAIMABLE, nr_pages); | 1615 | NR_SLAB_UNRECLAIMABLE, nr_pages); |
| 1616 | __SetPageSlab(page); | 1616 | __SetPageSlab(page); |
| 1617 | if (page->pfmemalloc) | 1617 | if (page_is_pfmemalloc(page)) |
| 1618 | SetPageSlabPfmemalloc(page); | 1618 | SetPageSlabPfmemalloc(page); |
| 1619 | 1619 | ||
| 1620 | if (kmemcheck_enabled && !(cachep->flags & SLAB_NOTRACK)) { | 1620 | if (kmemcheck_enabled && !(cachep->flags & SLAB_NOTRACK)) { |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 3e5f8f29c286..86831105a09f 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
| @@ -37,8 +37,7 @@ struct kmem_cache *kmem_cache; | |||
| 37 | SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \ | 37 | SLAB_TRACE | SLAB_DESTROY_BY_RCU | SLAB_NOLEAKTRACE | \ |
| 38 | SLAB_FAILSLAB) | 38 | SLAB_FAILSLAB) |
| 39 | 39 | ||
| 40 | #define SLAB_MERGE_SAME (SLAB_DEBUG_FREE | SLAB_RECLAIM_ACCOUNT | \ | 40 | #define SLAB_MERGE_SAME (SLAB_RECLAIM_ACCOUNT | SLAB_CACHE_DMA | SLAB_NOTRACK) |
| 41 | SLAB_CACHE_DMA | SLAB_NOTRACK) | ||
| 42 | 41 | ||
| 43 | /* | 42 | /* |
| 44 | * Merge control. If this is set then no merging of slab caches will occur. | 43 | * Merge control. If this is set then no merging of slab caches will occur. |
| @@ -1427,7 +1427,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) | |||
| 1427 | inc_slabs_node(s, page_to_nid(page), page->objects); | 1427 | inc_slabs_node(s, page_to_nid(page), page->objects); |
| 1428 | page->slab_cache = s; | 1428 | page->slab_cache = s; |
| 1429 | __SetPageSlab(page); | 1429 | __SetPageSlab(page); |
| 1430 | if (page->pfmemalloc) | 1430 | if (page_is_pfmemalloc(page)) |
| 1431 | SetPageSlabPfmemalloc(page); | 1431 | SetPageSlabPfmemalloc(page); |
| 1432 | 1432 | ||
| 1433 | start = page_address(page); | 1433 | start = page_address(page); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index e61445dce04e..8286938c70de 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
| @@ -973,22 +973,18 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
| 973 | * caller can stall after page list has been processed. | 973 | * caller can stall after page list has been processed. |
| 974 | * | 974 | * |
| 975 | * 2) Global or new memcg reclaim encounters a page that is | 975 | * 2) Global or new memcg reclaim encounters a page that is |
| 976 | * not marked for immediate reclaim or the caller does not | 976 | * not marked for immediate reclaim, or the caller does not |
| 977 | * have __GFP_IO. In this case mark the page for immediate | 977 | * have __GFP_FS (or __GFP_IO if it's simply going to swap, |
| 978 | * not to fs). In this case mark the page for immediate | ||
| 978 | * reclaim and continue scanning. | 979 | * reclaim and continue scanning. |
| 979 | * | 980 | * |
| 980 | * __GFP_IO is checked because a loop driver thread might | 981 | * Require may_enter_fs because we would wait on fs, which |
| 982 | * may not have submitted IO yet. And the loop driver might | ||
| 981 | * enter reclaim, and deadlock if it waits on a page for | 983 | * enter reclaim, and deadlock if it waits on a page for |
| 982 | * which it is needed to do the write (loop masks off | 984 | * which it is needed to do the write (loop masks off |
| 983 | * __GFP_IO|__GFP_FS for this reason); but more thought | 985 | * __GFP_IO|__GFP_FS for this reason); but more thought |
| 984 | * would probably show more reasons. | 986 | * would probably show more reasons. |
| 985 | * | 987 | * |
| 986 | * Don't require __GFP_FS, since we're not going into the | ||
| 987 | * FS, just waiting on its writeback completion. Worryingly, | ||
| 988 | * ext4 gfs2 and xfs allocate pages with | ||
| 989 | * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so testing | ||
| 990 | * may_enter_fs here is liable to OOM on them. | ||
| 991 | * | ||
| 992 | * 3) Legacy memcg encounters a page that is not already marked | 988 | * 3) Legacy memcg encounters a page that is not already marked |
| 993 | * PageReclaim. memcg does not have any dirty pages | 989 | * PageReclaim. memcg does not have any dirty pages |
| 994 | * throttling so we could easily OOM just because too many | 990 | * throttling so we could easily OOM just because too many |
| @@ -1005,7 +1001,7 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
| 1005 | 1001 | ||
| 1006 | /* Case 2 above */ | 1002 | /* Case 2 above */ |
| 1007 | } else if (sane_reclaim(sc) || | 1003 | } else if (sane_reclaim(sc) || |
| 1008 | !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) { | 1004 | !PageReclaim(page) || !may_enter_fs) { |
| 1009 | /* | 1005 | /* |
| 1010 | * This is slightly racy - end_page_writeback() | 1006 | * This is slightly racy - end_page_writeback() |
| 1011 | * might have just cleared PageReclaim, then | 1007 | * might have just cleared PageReclaim, then |
diff --git a/net/9p/client.c b/net/9p/client.c index 498454b3c06c..ea79ee9a7348 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
| @@ -1541,6 +1541,7 @@ p9_client_read(struct p9_fid *fid, u64 offset, struct iov_iter *to, int *err) | |||
| 1541 | struct p9_client *clnt = fid->clnt; | 1541 | struct p9_client *clnt = fid->clnt; |
| 1542 | struct p9_req_t *req; | 1542 | struct p9_req_t *req; |
| 1543 | int total = 0; | 1543 | int total = 0; |
| 1544 | *err = 0; | ||
| 1544 | 1545 | ||
| 1545 | p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n", | 1546 | p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n", |
| 1546 | fid->fid, (unsigned long long) offset, (int)iov_iter_count(to)); | 1547 | fid->fid, (unsigned long long) offset, (int)iov_iter_count(to)); |
| @@ -1620,6 +1621,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struct iov_iter *from, int *err) | |||
| 1620 | struct p9_client *clnt = fid->clnt; | 1621 | struct p9_client *clnt = fid->clnt; |
| 1621 | struct p9_req_t *req; | 1622 | struct p9_req_t *req; |
| 1622 | int total = 0; | 1623 | int total = 0; |
| 1624 | *err = 0; | ||
| 1623 | 1625 | ||
| 1624 | p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n", | 1626 | p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n", |
| 1625 | fid->fid, (unsigned long long) offset, | 1627 | fid->fid, (unsigned long long) offset, |
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index fb54e6aed096..6d0b471eede8 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
| @@ -1138,6 +1138,9 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, | |||
| 1138 | * @bat_priv: the bat priv with all the soft interface information | 1138 | * @bat_priv: the bat priv with all the soft interface information |
| 1139 | * @skb: packet to check | 1139 | * @skb: packet to check |
| 1140 | * @hdr_size: size of the encapsulation header | 1140 | * @hdr_size: size of the encapsulation header |
| 1141 | * | ||
| 1142 | * Returns true if the packet was snooped and consumed by DAT. False if the | ||
| 1143 | * packet has to be delivered to the interface | ||
| 1141 | */ | 1144 | */ |
| 1142 | bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | 1145 | bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, |
| 1143 | struct sk_buff *skb, int hdr_size) | 1146 | struct sk_buff *skb, int hdr_size) |
| @@ -1145,7 +1148,7 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | |||
| 1145 | uint16_t type; | 1148 | uint16_t type; |
| 1146 | __be32 ip_src, ip_dst; | 1149 | __be32 ip_src, ip_dst; |
| 1147 | uint8_t *hw_src, *hw_dst; | 1150 | uint8_t *hw_src, *hw_dst; |
| 1148 | bool ret = false; | 1151 | bool dropped = false; |
| 1149 | unsigned short vid; | 1152 | unsigned short vid; |
| 1150 | 1153 | ||
| 1151 | if (!atomic_read(&bat_priv->distributed_arp_table)) | 1154 | if (!atomic_read(&bat_priv->distributed_arp_table)) |
| @@ -1174,12 +1177,17 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | |||
| 1174 | /* if this REPLY is directed to a client of mine, let's deliver the | 1177 | /* if this REPLY is directed to a client of mine, let's deliver the |
| 1175 | * packet to the interface | 1178 | * packet to the interface |
| 1176 | */ | 1179 | */ |
| 1177 | ret = !batadv_is_my_client(bat_priv, hw_dst, vid); | 1180 | dropped = !batadv_is_my_client(bat_priv, hw_dst, vid); |
| 1181 | |||
| 1182 | /* if this REPLY is sent on behalf of a client of mine, let's drop the | ||
| 1183 | * packet because the client will reply by itself | ||
| 1184 | */ | ||
| 1185 | dropped |= batadv_is_my_client(bat_priv, hw_src, vid); | ||
| 1178 | out: | 1186 | out: |
| 1179 | if (ret) | 1187 | if (dropped) |
| 1180 | kfree_skb(skb); | 1188 | kfree_skb(skb); |
| 1181 | /* if ret == false -> packet has to be delivered to the interface */ | 1189 | /* if dropped == false -> deliver to the interface */ |
| 1182 | return ret; | 1190 | return dropped; |
| 1183 | } | 1191 | } |
| 1184 | 1192 | ||
| 1185 | /** | 1193 | /** |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index bb0158620628..cffa92dd9877 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
| @@ -439,6 +439,8 @@ static void batadv_gw_node_add(struct batadv_priv *bat_priv, | |||
| 439 | 439 | ||
| 440 | INIT_HLIST_NODE(&gw_node->list); | 440 | INIT_HLIST_NODE(&gw_node->list); |
| 441 | gw_node->orig_node = orig_node; | 441 | gw_node->orig_node = orig_node; |
| 442 | gw_node->bandwidth_down = ntohl(gateway->bandwidth_down); | ||
| 443 | gw_node->bandwidth_up = ntohl(gateway->bandwidth_up); | ||
| 442 | atomic_set(&gw_node->refcount, 1); | 444 | atomic_set(&gw_node->refcount, 1); |
| 443 | 445 | ||
| 444 | spin_lock_bh(&bat_priv->gw.list_lock); | 446 | spin_lock_bh(&bat_priv->gw.list_lock); |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index c002961da75d..a2fc843c2243 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -479,6 +479,9 @@ out: | |||
| 479 | */ | 479 | */ |
| 480 | void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan) | 480 | void batadv_softif_vlan_free_ref(struct batadv_softif_vlan *vlan) |
| 481 | { | 481 | { |
| 482 | if (!vlan) | ||
| 483 | return; | ||
| 484 | |||
| 482 | if (atomic_dec_and_test(&vlan->refcount)) { | 485 | if (atomic_dec_and_test(&vlan->refcount)) { |
| 483 | spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock); | 486 | spin_lock_bh(&vlan->bat_priv->softif_vlan_list_lock); |
| 484 | hlist_del_rcu(&vlan->list); | 487 | hlist_del_rcu(&vlan->list); |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index b4824951010b..5809b39c1922 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
| @@ -594,6 +594,12 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | |||
| 594 | 594 | ||
| 595 | /* increase the refcounter of the related vlan */ | 595 | /* increase the refcounter of the related vlan */ |
| 596 | vlan = batadv_softif_vlan_get(bat_priv, vid); | 596 | vlan = batadv_softif_vlan_get(bat_priv, vid); |
| 597 | if (WARN(!vlan, "adding TT local entry %pM to non-existent VLAN %d", | ||
| 598 | addr, BATADV_PRINT_VID(vid))) { | ||
| 599 | kfree(tt_local); | ||
| 600 | tt_local = NULL; | ||
| 601 | goto out; | ||
| 602 | } | ||
| 597 | 603 | ||
| 598 | batadv_dbg(BATADV_DBG_TT, bat_priv, | 604 | batadv_dbg(BATADV_DBG_TT, bat_priv, |
| 599 | "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n", | 605 | "Creating new local tt entry: %pM (vid: %d, ttvn: %d)\n", |
| @@ -1034,6 +1040,7 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, | |||
| 1034 | struct batadv_tt_local_entry *tt_local_entry; | 1040 | struct batadv_tt_local_entry *tt_local_entry; |
| 1035 | uint16_t flags, curr_flags = BATADV_NO_FLAGS; | 1041 | uint16_t flags, curr_flags = BATADV_NO_FLAGS; |
| 1036 | struct batadv_softif_vlan *vlan; | 1042 | struct batadv_softif_vlan *vlan; |
| 1043 | void *tt_entry_exists; | ||
| 1037 | 1044 | ||
| 1038 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); | 1045 | tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid); |
| 1039 | if (!tt_local_entry) | 1046 | if (!tt_local_entry) |
| @@ -1061,11 +1068,22 @@ uint16_t batadv_tt_local_remove(struct batadv_priv *bat_priv, | |||
| 1061 | * immediately purge it | 1068 | * immediately purge it |
| 1062 | */ | 1069 | */ |
| 1063 | batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); | 1070 | batadv_tt_local_event(bat_priv, tt_local_entry, BATADV_TT_CLIENT_DEL); |
| 1064 | hlist_del_rcu(&tt_local_entry->common.hash_entry); | 1071 | |
| 1072 | tt_entry_exists = batadv_hash_remove(bat_priv->tt.local_hash, | ||
| 1073 | batadv_compare_tt, | ||
| 1074 | batadv_choose_tt, | ||
| 1075 | &tt_local_entry->common); | ||
| 1076 | if (!tt_entry_exists) | ||
| 1077 | goto out; | ||
| 1078 | |||
| 1079 | /* extra call to free the local tt entry */ | ||
| 1065 | batadv_tt_local_entry_free_ref(tt_local_entry); | 1080 | batadv_tt_local_entry_free_ref(tt_local_entry); |
| 1066 | 1081 | ||
| 1067 | /* decrease the reference held for this vlan */ | 1082 | /* decrease the reference held for this vlan */ |
| 1068 | vlan = batadv_softif_vlan_get(bat_priv, vid); | 1083 | vlan = batadv_softif_vlan_get(bat_priv, vid); |
| 1084 | if (!vlan) | ||
| 1085 | goto out; | ||
| 1086 | |||
| 1069 | batadv_softif_vlan_free_ref(vlan); | 1087 | batadv_softif_vlan_free_ref(vlan); |
| 1070 | batadv_softif_vlan_free_ref(vlan); | 1088 | batadv_softif_vlan_free_ref(vlan); |
| 1071 | 1089 | ||
| @@ -1166,8 +1184,10 @@ static void batadv_tt_local_table_free(struct batadv_priv *bat_priv) | |||
| 1166 | /* decrease the reference held for this vlan */ | 1184 | /* decrease the reference held for this vlan */ |
| 1167 | vlan = batadv_softif_vlan_get(bat_priv, | 1185 | vlan = batadv_softif_vlan_get(bat_priv, |
| 1168 | tt_common_entry->vid); | 1186 | tt_common_entry->vid); |
| 1169 | batadv_softif_vlan_free_ref(vlan); | 1187 | if (vlan) { |
| 1170 | batadv_softif_vlan_free_ref(vlan); | 1188 | batadv_softif_vlan_free_ref(vlan); |
| 1189 | batadv_softif_vlan_free_ref(vlan); | ||
| 1190 | } | ||
| 1171 | 1191 | ||
| 1172 | batadv_tt_local_entry_free_ref(tt_local); | 1192 | batadv_tt_local_entry_free_ref(tt_local); |
| 1173 | } | 1193 | } |
| @@ -3207,8 +3227,10 @@ static void batadv_tt_local_purge_pending_clients(struct batadv_priv *bat_priv) | |||
| 3207 | 3227 | ||
| 3208 | /* decrease the reference held for this vlan */ | 3228 | /* decrease the reference held for this vlan */ |
| 3209 | vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); | 3229 | vlan = batadv_softif_vlan_get(bat_priv, tt_common->vid); |
| 3210 | batadv_softif_vlan_free_ref(vlan); | 3230 | if (vlan) { |
| 3211 | batadv_softif_vlan_free_ref(vlan); | 3231 | batadv_softif_vlan_free_ref(vlan); |
| 3232 | batadv_softif_vlan_free_ref(vlan); | ||
| 3233 | } | ||
| 3212 | 3234 | ||
| 3213 | batadv_tt_local_entry_free_ref(tt_local); | 3235 | batadv_tt_local_entry_free_ref(tt_local); |
| 3214 | } | 3236 | } |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 7998fb279165..92720f3fe573 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
| @@ -7820,7 +7820,7 @@ void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent) | |||
| 7820 | /* Make sure we copy only the significant bytes based on the | 7820 | /* Make sure we copy only the significant bytes based on the |
| 7821 | * encryption key size, and set the rest of the value to zeroes. | 7821 | * encryption key size, and set the rest of the value to zeroes. |
| 7822 | */ | 7822 | */ |
| 7823 | memcpy(ev.key.val, key->val, sizeof(key->enc_size)); | 7823 | memcpy(ev.key.val, key->val, key->enc_size); |
| 7824 | memset(ev.key.val + key->enc_size, 0, | 7824 | memset(ev.key.val + key->enc_size, 0, |
| 7825 | sizeof(ev.key.val) - key->enc_size); | 7825 | sizeof(ev.key.val) - key->enc_size); |
| 7826 | 7826 | ||
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 0b39dcc65b94..1285eaf5dc22 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -1591,7 +1591,7 @@ static int br_multicast_ipv4_rcv(struct net_bridge *br, | |||
| 1591 | break; | 1591 | break; |
| 1592 | } | 1592 | } |
| 1593 | 1593 | ||
| 1594 | if (skb_trimmed) | 1594 | if (skb_trimmed && skb_trimmed != skb) |
| 1595 | kfree_skb(skb_trimmed); | 1595 | kfree_skb(skb_trimmed); |
| 1596 | 1596 | ||
| 1597 | return err; | 1597 | return err; |
| @@ -1636,7 +1636,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br, | |||
| 1636 | break; | 1636 | break; |
| 1637 | } | 1637 | } |
| 1638 | 1638 | ||
| 1639 | if (skb_trimmed) | 1639 | if (skb_trimmed && skb_trimmed != skb) |
| 1640 | kfree_skb(skb_trimmed); | 1640 | kfree_skb(skb_trimmed); |
| 1641 | 1641 | ||
| 1642 | return err; | 1642 | return err; |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 3da5525eb8a2..4d74a0639c4c 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
| @@ -112,6 +112,8 @@ static inline size_t br_port_info_size(void) | |||
| 112 | + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */ | 112 | + nla_total_size(1) /* IFLA_BRPORT_FAST_LEAVE */ |
| 113 | + nla_total_size(1) /* IFLA_BRPORT_LEARNING */ | 113 | + nla_total_size(1) /* IFLA_BRPORT_LEARNING */ |
| 114 | + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */ | 114 | + nla_total_size(1) /* IFLA_BRPORT_UNICAST_FLOOD */ |
| 115 | + nla_total_size(1) /* IFLA_BRPORT_PROXYARP */ | ||
| 116 | + nla_total_size(1) /* IFLA_BRPORT_PROXYARP_WIFI */ | ||
| 115 | + 0; | 117 | + 0; |
| 116 | } | 118 | } |
| 117 | 119 | ||
| @@ -506,6 +508,8 @@ static const struct nla_policy br_port_policy[IFLA_BRPORT_MAX + 1] = { | |||
| 506 | [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 }, | 508 | [IFLA_BRPORT_FAST_LEAVE]= { .type = NLA_U8 }, |
| 507 | [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 }, | 509 | [IFLA_BRPORT_LEARNING] = { .type = NLA_U8 }, |
| 508 | [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 }, | 510 | [IFLA_BRPORT_UNICAST_FLOOD] = { .type = NLA_U8 }, |
| 511 | [IFLA_BRPORT_PROXYARP] = { .type = NLA_U8 }, | ||
| 512 | [IFLA_BRPORT_PROXYARP_WIFI] = { .type = NLA_U8 }, | ||
| 509 | }; | 513 | }; |
| 510 | 514 | ||
| 511 | /* Change the state of the port and notify spanning tree */ | 515 | /* Change the state of the port and notify spanning tree */ |
diff --git a/net/core/datagram.c b/net/core/datagram.c index 4967262b2707..617088aee21d 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
| @@ -131,12 +131,12 @@ out_noerr: | |||
| 131 | goto out; | 131 | goto out; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | static int skb_set_peeked(struct sk_buff *skb) | 134 | static struct sk_buff *skb_set_peeked(struct sk_buff *skb) |
| 135 | { | 135 | { |
| 136 | struct sk_buff *nskb; | 136 | struct sk_buff *nskb; |
| 137 | 137 | ||
| 138 | if (skb->peeked) | 138 | if (skb->peeked) |
| 139 | return 0; | 139 | return skb; |
| 140 | 140 | ||
| 141 | /* We have to unshare an skb before modifying it. */ | 141 | /* We have to unshare an skb before modifying it. */ |
| 142 | if (!skb_shared(skb)) | 142 | if (!skb_shared(skb)) |
| @@ -144,7 +144,7 @@ static int skb_set_peeked(struct sk_buff *skb) | |||
| 144 | 144 | ||
| 145 | nskb = skb_clone(skb, GFP_ATOMIC); | 145 | nskb = skb_clone(skb, GFP_ATOMIC); |
| 146 | if (!nskb) | 146 | if (!nskb) |
| 147 | return -ENOMEM; | 147 | return ERR_PTR(-ENOMEM); |
| 148 | 148 | ||
| 149 | skb->prev->next = nskb; | 149 | skb->prev->next = nskb; |
| 150 | skb->next->prev = nskb; | 150 | skb->next->prev = nskb; |
| @@ -157,7 +157,7 @@ static int skb_set_peeked(struct sk_buff *skb) | |||
| 157 | done: | 157 | done: |
| 158 | skb->peeked = 1; | 158 | skb->peeked = 1; |
| 159 | 159 | ||
| 160 | return 0; | 160 | return skb; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | /** | 163 | /** |
| @@ -229,8 +229,9 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, | |||
| 229 | continue; | 229 | continue; |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | error = skb_set_peeked(skb); | 232 | skb = skb_set_peeked(skb); |
| 233 | if (error) | 233 | error = PTR_ERR(skb); |
| 234 | if (IS_ERR(skb)) | ||
| 234 | goto unlock_err; | 235 | goto unlock_err; |
| 235 | 236 | ||
| 236 | atomic_inc(&skb->users); | 237 | atomic_inc(&skb->users); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 1ebdf1c0d118..1cbd209192ea 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
| @@ -3514,8 +3514,6 @@ static int pktgen_thread_worker(void *arg) | |||
| 3514 | 3514 | ||
| 3515 | set_freezable(); | 3515 | set_freezable(); |
| 3516 | 3516 | ||
| 3517 | __set_current_state(TASK_RUNNING); | ||
| 3518 | |||
| 3519 | while (!kthread_should_stop()) { | 3517 | while (!kthread_should_stop()) { |
| 3520 | pkt_dev = next_to_run(t); | 3518 | pkt_dev = next_to_run(t); |
| 3521 | 3519 | ||
| @@ -3560,7 +3558,6 @@ static int pktgen_thread_worker(void *arg) | |||
| 3560 | 3558 | ||
| 3561 | try_to_freeze(); | 3559 | try_to_freeze(); |
| 3562 | } | 3560 | } |
| 3563 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 3564 | 3561 | ||
| 3565 | pr_debug("%s stopping all device\n", t->tsk->comm); | 3562 | pr_debug("%s stopping all device\n", t->tsk->comm); |
| 3566 | pktgen_stop(t); | 3563 | pktgen_stop(t); |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 87b22c0bc08c..b42f0e26f89e 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
| @@ -103,10 +103,16 @@ void reqsk_queue_destroy(struct request_sock_queue *queue) | |||
| 103 | spin_lock_bh(&queue->syn_wait_lock); | 103 | spin_lock_bh(&queue->syn_wait_lock); |
| 104 | while ((req = lopt->syn_table[i]) != NULL) { | 104 | while ((req = lopt->syn_table[i]) != NULL) { |
| 105 | lopt->syn_table[i] = req->dl_next; | 105 | lopt->syn_table[i] = req->dl_next; |
| 106 | /* Because of following del_timer_sync(), | ||
| 107 | * we must release the spinlock here | ||
| 108 | * or risk a dead lock. | ||
| 109 | */ | ||
| 110 | spin_unlock_bh(&queue->syn_wait_lock); | ||
| 106 | atomic_inc(&lopt->qlen_dec); | 111 | atomic_inc(&lopt->qlen_dec); |
| 107 | if (del_timer(&req->rsk_timer)) | 112 | if (del_timer_sync(&req->rsk_timer)) |
| 108 | reqsk_put(req); | 113 | reqsk_put(req); |
| 109 | reqsk_put(req); | 114 | reqsk_put(req); |
| 115 | spin_lock_bh(&queue->syn_wait_lock); | ||
| 110 | } | 116 | } |
| 111 | spin_unlock_bh(&queue->syn_wait_lock); | 117 | spin_unlock_bh(&queue->syn_wait_lock); |
| 112 | } | 118 | } |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b6a19ca0f99e..7b84330e5d30 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -340,7 +340,7 @@ struct sk_buff *build_skb(void *data, unsigned int frag_size) | |||
| 340 | 340 | ||
| 341 | if (skb && frag_size) { | 341 | if (skb && frag_size) { |
| 342 | skb->head_frag = 1; | 342 | skb->head_frag = 1; |
| 343 | if (virt_to_head_page(data)->pfmemalloc) | 343 | if (page_is_pfmemalloc(virt_to_head_page(data))) |
| 344 | skb->pfmemalloc = 1; | 344 | skb->pfmemalloc = 1; |
| 345 | } | 345 | } |
| 346 | return skb; | 346 | return skb; |
| @@ -4022,8 +4022,8 @@ EXPORT_SYMBOL(skb_checksum_setup); | |||
| 4022 | * Otherwise returns the provided skb. Returns NULL in error cases | 4022 | * Otherwise returns the provided skb. Returns NULL in error cases |
| 4023 | * (e.g. transport_len exceeds skb length or out-of-memory). | 4023 | * (e.g. transport_len exceeds skb length or out-of-memory). |
| 4024 | * | 4024 | * |
| 4025 | * Caller needs to set the skb transport header and release the returned skb. | 4025 | * Caller needs to set the skb transport header and free any returned skb if it |
| 4026 | * Provided skb is consumed. | 4026 | * differs from the provided skb. |
| 4027 | */ | 4027 | */ |
| 4028 | static struct sk_buff *skb_checksum_maybe_trim(struct sk_buff *skb, | 4028 | static struct sk_buff *skb_checksum_maybe_trim(struct sk_buff *skb, |
| 4029 | unsigned int transport_len) | 4029 | unsigned int transport_len) |
| @@ -4032,16 +4032,12 @@ static struct sk_buff *skb_checksum_maybe_trim(struct sk_buff *skb, | |||
| 4032 | unsigned int len = skb_transport_offset(skb) + transport_len; | 4032 | unsigned int len = skb_transport_offset(skb) + transport_len; |
| 4033 | int ret; | 4033 | int ret; |
| 4034 | 4034 | ||
| 4035 | if (skb->len < len) { | 4035 | if (skb->len < len) |
| 4036 | kfree_skb(skb); | ||
| 4037 | return NULL; | 4036 | return NULL; |
| 4038 | } else if (skb->len == len) { | 4037 | else if (skb->len == len) |
| 4039 | return skb; | 4038 | return skb; |
| 4040 | } | ||
| 4041 | 4039 | ||
| 4042 | skb_chk = skb_clone(skb, GFP_ATOMIC); | 4040 | skb_chk = skb_clone(skb, GFP_ATOMIC); |
| 4043 | kfree_skb(skb); | ||
| 4044 | |||
| 4045 | if (!skb_chk) | 4041 | if (!skb_chk) |
| 4046 | return NULL; | 4042 | return NULL; |
| 4047 | 4043 | ||
| @@ -4066,8 +4062,8 @@ static struct sk_buff *skb_checksum_maybe_trim(struct sk_buff *skb, | |||
| 4066 | * If the skb has data beyond the given transport length, then a | 4062 | * If the skb has data beyond the given transport length, then a |
| 4067 | * trimmed & cloned skb is checked and returned. | 4063 | * trimmed & cloned skb is checked and returned. |
| 4068 | * | 4064 | * |
| 4069 | * Caller needs to set the skb transport header and release the returned skb. | 4065 | * Caller needs to set the skb transport header and free any returned skb if it |
| 4070 | * Provided skb is consumed. | 4066 | * differs from the provided skb. |
| 4071 | */ | 4067 | */ |
| 4072 | struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb, | 4068 | struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb, |
| 4073 | unsigned int transport_len, | 4069 | unsigned int transport_len, |
| @@ -4079,23 +4075,26 @@ struct sk_buff *skb_checksum_trimmed(struct sk_buff *skb, | |||
| 4079 | 4075 | ||
| 4080 | skb_chk = skb_checksum_maybe_trim(skb, transport_len); | 4076 | skb_chk = skb_checksum_maybe_trim(skb, transport_len); |
| 4081 | if (!skb_chk) | 4077 | if (!skb_chk) |
| 4082 | return NULL; | 4078 | goto err; |
| 4083 | 4079 | ||
| 4084 | if (!pskb_may_pull(skb_chk, offset)) { | 4080 | if (!pskb_may_pull(skb_chk, offset)) |
| 4085 | kfree_skb(skb_chk); | 4081 | goto err; |
| 4086 | return NULL; | ||
| 4087 | } | ||
| 4088 | 4082 | ||
| 4089 | __skb_pull(skb_chk, offset); | 4083 | __skb_pull(skb_chk, offset); |
| 4090 | ret = skb_chkf(skb_chk); | 4084 | ret = skb_chkf(skb_chk); |
| 4091 | __skb_push(skb_chk, offset); | 4085 | __skb_push(skb_chk, offset); |
| 4092 | 4086 | ||
| 4093 | if (ret) { | 4087 | if (ret) |
| 4094 | kfree_skb(skb_chk); | 4088 | goto err; |
| 4095 | return NULL; | ||
| 4096 | } | ||
| 4097 | 4089 | ||
| 4098 | return skb_chk; | 4090 | return skb_chk; |
| 4091 | |||
| 4092 | err: | ||
| 4093 | if (skb_chk && skb_chk != skb) | ||
| 4094 | kfree_skb(skb_chk); | ||
| 4095 | |||
| 4096 | return NULL; | ||
| 4097 | |||
| 4099 | } | 4098 | } |
| 4100 | EXPORT_SYMBOL(skb_checksum_trimmed); | 4099 | EXPORT_SYMBOL(skb_checksum_trimmed); |
| 4101 | 4100 | ||
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 0917123790ea..35c47ddd04f0 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
| @@ -756,7 +756,8 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p, | |||
| 756 | return -ENODEV; | 756 | return -ENODEV; |
| 757 | 757 | ||
| 758 | /* Use already configured phy mode */ | 758 | /* Use already configured phy mode */ |
| 759 | p->phy_interface = p->phy->interface; | 759 | if (p->phy_interface == PHY_INTERFACE_MODE_NA) |
| 760 | p->phy_interface = p->phy->interface; | ||
| 760 | phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, | 761 | phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, |
| 761 | p->phy_interface); | 762 | p->phy_interface); |
| 762 | 763 | ||
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 37c4bb89a708..b0c6258ffb79 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -2465,7 +2465,7 @@ static struct key_vector *fib_route_get_idx(struct fib_route_iter *iter, | |||
| 2465 | key = l->key + 1; | 2465 | key = l->key + 1; |
| 2466 | iter->pos++; | 2466 | iter->pos++; |
| 2467 | 2467 | ||
| 2468 | if (pos-- <= 0) | 2468 | if (--pos <= 0) |
| 2469 | break; | 2469 | break; |
| 2470 | 2470 | ||
| 2471 | l = NULL; | 2471 | l = NULL; |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 651cdf648ec4..9fdfd9deac11 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
| @@ -1435,33 +1435,35 @@ static int __ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed) | |||
| 1435 | struct sk_buff *skb_chk; | 1435 | struct sk_buff *skb_chk; |
| 1436 | unsigned int transport_len; | 1436 | unsigned int transport_len; |
| 1437 | unsigned int len = skb_transport_offset(skb) + sizeof(struct igmphdr); | 1437 | unsigned int len = skb_transport_offset(skb) + sizeof(struct igmphdr); |
| 1438 | int ret; | 1438 | int ret = -EINVAL; |
| 1439 | 1439 | ||
| 1440 | transport_len = ntohs(ip_hdr(skb)->tot_len) - ip_hdrlen(skb); | 1440 | transport_len = ntohs(ip_hdr(skb)->tot_len) - ip_hdrlen(skb); |
| 1441 | 1441 | ||
| 1442 | skb_get(skb); | ||
| 1443 | skb_chk = skb_checksum_trimmed(skb, transport_len, | 1442 | skb_chk = skb_checksum_trimmed(skb, transport_len, |
| 1444 | ip_mc_validate_checksum); | 1443 | ip_mc_validate_checksum); |
| 1445 | if (!skb_chk) | 1444 | if (!skb_chk) |
| 1446 | return -EINVAL; | 1445 | goto err; |
| 1447 | 1446 | ||
| 1448 | if (!pskb_may_pull(skb_chk, len)) { | 1447 | if (!pskb_may_pull(skb_chk, len)) |
| 1449 | kfree_skb(skb_chk); | 1448 | goto err; |
| 1450 | return -EINVAL; | ||
| 1451 | } | ||
| 1452 | 1449 | ||
| 1453 | ret = ip_mc_check_igmp_msg(skb_chk); | 1450 | ret = ip_mc_check_igmp_msg(skb_chk); |
| 1454 | if (ret) { | 1451 | if (ret) |
| 1455 | kfree_skb(skb_chk); | 1452 | goto err; |
| 1456 | return ret; | ||
| 1457 | } | ||
| 1458 | 1453 | ||
| 1459 | if (skb_trimmed) | 1454 | if (skb_trimmed) |
| 1460 | *skb_trimmed = skb_chk; | 1455 | *skb_trimmed = skb_chk; |
| 1461 | else | 1456 | /* free now unneeded clone */ |
| 1457 | else if (skb_chk != skb) | ||
| 1462 | kfree_skb(skb_chk); | 1458 | kfree_skb(skb_chk); |
| 1463 | 1459 | ||
| 1464 | return 0; | 1460 | ret = 0; |
| 1461 | |||
| 1462 | err: | ||
| 1463 | if (ret && skb_chk && skb_chk != skb) | ||
| 1464 | kfree_skb(skb_chk); | ||
| 1465 | |||
| 1466 | return ret; | ||
| 1465 | } | 1467 | } |
| 1466 | 1468 | ||
| 1467 | /** | 1469 | /** |
| @@ -1470,7 +1472,7 @@ static int __ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed) | |||
| 1470 | * @skb_trimmed: to store an skb pointer trimmed to IPv4 packet tail (optional) | 1472 | * @skb_trimmed: to store an skb pointer trimmed to IPv4 packet tail (optional) |
| 1471 | * | 1473 | * |
| 1472 | * Checks whether an IPv4 packet is a valid IGMP packet. If so sets | 1474 | * Checks whether an IPv4 packet is a valid IGMP packet. If so sets |
| 1473 | * skb network and transport headers accordingly and returns zero. | 1475 | * skb transport header accordingly and returns zero. |
| 1474 | * | 1476 | * |
| 1475 | * -EINVAL: A broken packet was detected, i.e. it violates some internet | 1477 | * -EINVAL: A broken packet was detected, i.e. it violates some internet |
| 1476 | * standard | 1478 | * standard |
| @@ -1485,7 +1487,8 @@ static int __ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed) | |||
| 1485 | * to leave the original skb and its full frame unchanged (which might be | 1487 | * to leave the original skb and its full frame unchanged (which might be |
| 1486 | * desirable for layer 2 frame jugglers). | 1488 | * desirable for layer 2 frame jugglers). |
| 1487 | * | 1489 | * |
| 1488 | * The caller needs to release a reference count from any returned skb_trimmed. | 1490 | * Caller needs to set the skb network header and free any returned skb if it |
| 1491 | * differs from the provided skb. | ||
| 1489 | */ | 1492 | */ |
| 1490 | int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed) | 1493 | int ip_mc_check_igmp(struct sk_buff *skb, struct sk_buff **skb_trimmed) |
| 1491 | { | 1494 | { |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 60021d0d9326..134957159c27 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -593,7 +593,7 @@ static bool reqsk_queue_unlink(struct request_sock_queue *queue, | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | spin_unlock(&queue->syn_wait_lock); | 595 | spin_unlock(&queue->syn_wait_lock); |
| 596 | if (del_timer(&req->rsk_timer)) | 596 | if (timer_pending(&req->rsk_timer) && del_timer_sync(&req->rsk_timer)) |
| 597 | reqsk_put(req); | 597 | reqsk_put(req); |
| 598 | return found; | 598 | return found; |
| 599 | } | 599 | } |
diff --git a/net/ipv4/netfilter/ipt_SYNPROXY.c b/net/ipv4/netfilter/ipt_SYNPROXY.c index fe8cc183411e..95ea633e8356 100644 --- a/net/ipv4/netfilter/ipt_SYNPROXY.c +++ b/net/ipv4/netfilter/ipt_SYNPROXY.c | |||
| @@ -226,7 +226,8 @@ synproxy_send_client_ack(const struct synproxy_net *snet, | |||
| 226 | 226 | ||
| 227 | synproxy_build_options(nth, opts); | 227 | synproxy_build_options(nth, opts); |
| 228 | 228 | ||
| 229 | synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); | 229 | synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, |
| 230 | niph, nth, tcp_hdr_size); | ||
| 230 | } | 231 | } |
| 231 | 232 | ||
| 232 | static bool | 233 | static bool |
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 433231ccfb17..0330ab2e2b63 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
| @@ -41,8 +41,6 @@ static int tcp_syn_retries_min = 1; | |||
| 41 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; | 41 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; |
| 42 | static int ip_ping_group_range_min[] = { 0, 0 }; | 42 | static int ip_ping_group_range_min[] = { 0, 0 }; |
| 43 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; | 43 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
| 44 | static int min_sndbuf = SOCK_MIN_SNDBUF; | ||
| 45 | static int min_rcvbuf = SOCK_MIN_RCVBUF; | ||
| 46 | 44 | ||
| 47 | /* Update system visible IP port range */ | 45 | /* Update system visible IP port range */ |
| 48 | static void set_local_port_range(struct net *net, int range[2]) | 46 | static void set_local_port_range(struct net *net, int range[2]) |
| @@ -530,7 +528,7 @@ static struct ctl_table ipv4_table[] = { | |||
| 530 | .maxlen = sizeof(sysctl_tcp_wmem), | 528 | .maxlen = sizeof(sysctl_tcp_wmem), |
| 531 | .mode = 0644, | 529 | .mode = 0644, |
| 532 | .proc_handler = proc_dointvec_minmax, | 530 | .proc_handler = proc_dointvec_minmax, |
| 533 | .extra1 = &min_sndbuf, | 531 | .extra1 = &one, |
| 534 | }, | 532 | }, |
| 535 | { | 533 | { |
| 536 | .procname = "tcp_notsent_lowat", | 534 | .procname = "tcp_notsent_lowat", |
| @@ -545,7 +543,7 @@ static struct ctl_table ipv4_table[] = { | |||
| 545 | .maxlen = sizeof(sysctl_tcp_rmem), | 543 | .maxlen = sizeof(sysctl_tcp_rmem), |
| 546 | .mode = 0644, | 544 | .mode = 0644, |
| 547 | .proc_handler = proc_dointvec_minmax, | 545 | .proc_handler = proc_dointvec_minmax, |
| 548 | .extra1 = &min_rcvbuf, | 546 | .extra1 = &one, |
| 549 | }, | 547 | }, |
| 550 | { | 548 | { |
| 551 | .procname = "tcp_app_win", | 549 | .procname = "tcp_app_win", |
| @@ -758,7 +756,7 @@ static struct ctl_table ipv4_table[] = { | |||
| 758 | .maxlen = sizeof(sysctl_udp_rmem_min), | 756 | .maxlen = sizeof(sysctl_udp_rmem_min), |
| 759 | .mode = 0644, | 757 | .mode = 0644, |
| 760 | .proc_handler = proc_dointvec_minmax, | 758 | .proc_handler = proc_dointvec_minmax, |
| 761 | .extra1 = &min_rcvbuf, | 759 | .extra1 = &one |
| 762 | }, | 760 | }, |
| 763 | { | 761 | { |
| 764 | .procname = "udp_wmem_min", | 762 | .procname = "udp_wmem_min", |
| @@ -766,7 +764,7 @@ static struct ctl_table ipv4_table[] = { | |||
| 766 | .maxlen = sizeof(sysctl_udp_wmem_min), | 764 | .maxlen = sizeof(sysctl_udp_wmem_min), |
| 767 | .mode = 0644, | 765 | .mode = 0644, |
| 768 | .proc_handler = proc_dointvec_minmax, | 766 | .proc_handler = proc_dointvec_minmax, |
| 769 | .extra1 = &min_sndbuf, | 767 | .extra1 = &one |
| 770 | }, | 768 | }, |
| 771 | { } | 769 | { } |
| 772 | }; | 770 | }; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index d7d4c2b79cf2..0ea2e1c5d395 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1348,7 +1348,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
| 1348 | req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr); | 1348 | req = inet_csk_search_req(sk, th->source, iph->saddr, iph->daddr); |
| 1349 | if (req) { | 1349 | if (req) { |
| 1350 | nsk = tcp_check_req(sk, skb, req, false); | 1350 | nsk = tcp_check_req(sk, skb, req, false); |
| 1351 | if (!nsk) | 1351 | if (!nsk || nsk == sk) |
| 1352 | reqsk_put(req); | 1352 | reqsk_put(req); |
| 1353 | return nsk; | 1353 | return nsk; |
| 1354 | } | 1354 | } |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 83aa604f9273..1b8c5ba7d5f7 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
| @@ -1995,12 +1995,19 @@ void udp_v4_early_demux(struct sk_buff *skb) | |||
| 1995 | 1995 | ||
| 1996 | skb->sk = sk; | 1996 | skb->sk = sk; |
| 1997 | skb->destructor = sock_efree; | 1997 | skb->destructor = sock_efree; |
| 1998 | dst = sk->sk_rx_dst; | 1998 | dst = READ_ONCE(sk->sk_rx_dst); |
| 1999 | 1999 | ||
| 2000 | if (dst) | 2000 | if (dst) |
| 2001 | dst = dst_check(dst, 0); | 2001 | dst = dst_check(dst, 0); |
| 2002 | if (dst) | 2002 | if (dst) { |
| 2003 | skb_dst_set_noref(skb, dst); | 2003 | /* DST_NOCACHE can not be used without taking a reference */ |
| 2004 | if (dst->flags & DST_NOCACHE) { | ||
| 2005 | if (likely(atomic_inc_not_zero(&dst->__refcnt))) | ||
| 2006 | skb_dst_set(skb, dst); | ||
| 2007 | } else { | ||
| 2008 | skb_dst_set_noref(skb, dst); | ||
| 2009 | } | ||
| 2010 | } | ||
| 2004 | } | 2011 | } |
| 2005 | 2012 | ||
| 2006 | int udp_rcv(struct sk_buff *skb) | 2013 | int udp_rcv(struct sk_buff *skb) |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 55d19861ab20..548c6237b1e7 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
| @@ -172,6 +172,8 @@ static void rt6_free_pcpu(struct rt6_info *non_pcpu_rt) | |||
| 172 | *ppcpu_rt = NULL; | 172 | *ppcpu_rt = NULL; |
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | |||
| 176 | non_pcpu_rt->rt6i_pcpu = NULL; | ||
| 175 | } | 177 | } |
| 176 | 178 | ||
| 177 | static void rt6_release(struct rt6_info *rt) | 179 | static void rt6_release(struct rt6_info *rt) |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index a38d3ac0f18f..69f4f689f06a 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
| @@ -361,6 +361,7 @@ static void ip6gre_tunnel_uninit(struct net_device *dev) | |||
| 361 | struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id); | 361 | struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id); |
| 362 | 362 | ||
| 363 | ip6gre_tunnel_unlink(ign, t); | 363 | ip6gre_tunnel_unlink(ign, t); |
| 364 | ip6_tnl_dst_reset(t); | ||
| 364 | dev_put(dev); | 365 | dev_put(dev); |
| 365 | } | 366 | } |
| 366 | 367 | ||
diff --git a/net/ipv6/mcast_snoop.c b/net/ipv6/mcast_snoop.c index df8afe5ab31e..9405b04eecc6 100644 --- a/net/ipv6/mcast_snoop.c +++ b/net/ipv6/mcast_snoop.c | |||
| @@ -143,34 +143,36 @@ static int __ipv6_mc_check_mld(struct sk_buff *skb, | |||
| 143 | struct sk_buff *skb_chk = NULL; | 143 | struct sk_buff *skb_chk = NULL; |
| 144 | unsigned int transport_len; | 144 | unsigned int transport_len; |
| 145 | unsigned int len = skb_transport_offset(skb) + sizeof(struct mld_msg); | 145 | unsigned int len = skb_transport_offset(skb) + sizeof(struct mld_msg); |
| 146 | int ret; | 146 | int ret = -EINVAL; |
| 147 | 147 | ||
| 148 | transport_len = ntohs(ipv6_hdr(skb)->payload_len); | 148 | transport_len = ntohs(ipv6_hdr(skb)->payload_len); |
| 149 | transport_len -= skb_transport_offset(skb) - sizeof(struct ipv6hdr); | 149 | transport_len -= skb_transport_offset(skb) - sizeof(struct ipv6hdr); |
| 150 | 150 | ||
| 151 | skb_get(skb); | ||
| 152 | skb_chk = skb_checksum_trimmed(skb, transport_len, | 151 | skb_chk = skb_checksum_trimmed(skb, transport_len, |
| 153 | ipv6_mc_validate_checksum); | 152 | ipv6_mc_validate_checksum); |
| 154 | if (!skb_chk) | 153 | if (!skb_chk) |
| 155 | return -EINVAL; | 154 | goto err; |
| 156 | 155 | ||
| 157 | if (!pskb_may_pull(skb_chk, len)) { | 156 | if (!pskb_may_pull(skb_chk, len)) |
| 158 | kfree_skb(skb_chk); | 157 | goto err; |
| 159 | return -EINVAL; | ||
| 160 | } | ||
| 161 | 158 | ||
| 162 | ret = ipv6_mc_check_mld_msg(skb_chk); | 159 | ret = ipv6_mc_check_mld_msg(skb_chk); |
| 163 | if (ret) { | 160 | if (ret) |
| 164 | kfree_skb(skb_chk); | 161 | goto err; |
| 165 | return ret; | ||
| 166 | } | ||
| 167 | 162 | ||
| 168 | if (skb_trimmed) | 163 | if (skb_trimmed) |
| 169 | *skb_trimmed = skb_chk; | 164 | *skb_trimmed = skb_chk; |
| 170 | else | 165 | /* free now unneeded clone */ |
| 166 | else if (skb_chk != skb) | ||
| 171 | kfree_skb(skb_chk); | 167 | kfree_skb(skb_chk); |
| 172 | 168 | ||
| 173 | return 0; | 169 | ret = 0; |
| 170 | |||
| 171 | err: | ||
| 172 | if (ret && skb_chk && skb_chk != skb) | ||
| 173 | kfree_skb(skb_chk); | ||
| 174 | |||
| 175 | return ret; | ||
| 174 | } | 176 | } |
| 175 | 177 | ||
| 176 | /** | 178 | /** |
| @@ -179,7 +181,7 @@ static int __ipv6_mc_check_mld(struct sk_buff *skb, | |||
| 179 | * @skb_trimmed: to store an skb pointer trimmed to IPv6 packet tail (optional) | 181 | * @skb_trimmed: to store an skb pointer trimmed to IPv6 packet tail (optional) |
| 180 | * | 182 | * |
| 181 | * Checks whether an IPv6 packet is a valid MLD packet. If so sets | 183 | * Checks whether an IPv6 packet is a valid MLD packet. If so sets |
| 182 | * skb network and transport headers accordingly and returns zero. | 184 | * skb transport header accordingly and returns zero. |
| 183 | * | 185 | * |
| 184 | * -EINVAL: A broken packet was detected, i.e. it violates some internet | 186 | * -EINVAL: A broken packet was detected, i.e. it violates some internet |
| 185 | * standard | 187 | * standard |
| @@ -194,7 +196,8 @@ static int __ipv6_mc_check_mld(struct sk_buff *skb, | |||
| 194 | * to leave the original skb and its full frame unchanged (which might be | 196 | * to leave the original skb and its full frame unchanged (which might be |
| 195 | * desirable for layer 2 frame jugglers). | 197 | * desirable for layer 2 frame jugglers). |
| 196 | * | 198 | * |
| 197 | * The caller needs to release a reference count from any returned skb_trimmed. | 199 | * Caller needs to set the skb network header and free any returned skb if it |
| 200 | * differs from the provided skb. | ||
| 198 | */ | 201 | */ |
| 199 | int ipv6_mc_check_mld(struct sk_buff *skb, struct sk_buff **skb_trimmed) | 202 | int ipv6_mc_check_mld(struct sk_buff *skb, struct sk_buff **skb_trimmed) |
| 200 | { | 203 | { |
diff --git a/net/ipv6/netfilter/ip6t_SYNPROXY.c b/net/ipv6/netfilter/ip6t_SYNPROXY.c index 6edb7b106de7..ebbb754c2111 100644 --- a/net/ipv6/netfilter/ip6t_SYNPROXY.c +++ b/net/ipv6/netfilter/ip6t_SYNPROXY.c | |||
| @@ -37,12 +37,13 @@ synproxy_build_ip(struct sk_buff *skb, const struct in6_addr *saddr, | |||
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | static void | 39 | static void |
| 40 | synproxy_send_tcp(const struct sk_buff *skb, struct sk_buff *nskb, | 40 | synproxy_send_tcp(const struct synproxy_net *snet, |
| 41 | const struct sk_buff *skb, struct sk_buff *nskb, | ||
| 41 | struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo, | 42 | struct nf_conntrack *nfct, enum ip_conntrack_info ctinfo, |
| 42 | struct ipv6hdr *niph, struct tcphdr *nth, | 43 | struct ipv6hdr *niph, struct tcphdr *nth, |
| 43 | unsigned int tcp_hdr_size) | 44 | unsigned int tcp_hdr_size) |
| 44 | { | 45 | { |
| 45 | struct net *net = nf_ct_net((struct nf_conn *)nfct); | 46 | struct net *net = nf_ct_net(snet->tmpl); |
| 46 | struct dst_entry *dst; | 47 | struct dst_entry *dst; |
| 47 | struct flowi6 fl6; | 48 | struct flowi6 fl6; |
| 48 | 49 | ||
| @@ -83,7 +84,8 @@ free_nskb: | |||
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | static void | 86 | static void |
| 86 | synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th, | 87 | synproxy_send_client_synack(const struct synproxy_net *snet, |
| 88 | const struct sk_buff *skb, const struct tcphdr *th, | ||
| 87 | const struct synproxy_options *opts) | 89 | const struct synproxy_options *opts) |
| 88 | { | 90 | { |
| 89 | struct sk_buff *nskb; | 91 | struct sk_buff *nskb; |
| @@ -119,7 +121,7 @@ synproxy_send_client_synack(const struct sk_buff *skb, const struct tcphdr *th, | |||
| 119 | 121 | ||
| 120 | synproxy_build_options(nth, opts); | 122 | synproxy_build_options(nth, opts); |
| 121 | 123 | ||
| 122 | synproxy_send_tcp(skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, | 124 | synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, |
| 123 | niph, nth, tcp_hdr_size); | 125 | niph, nth, tcp_hdr_size); |
| 124 | } | 126 | } |
| 125 | 127 | ||
| @@ -163,7 +165,7 @@ synproxy_send_server_syn(const struct synproxy_net *snet, | |||
| 163 | 165 | ||
| 164 | synproxy_build_options(nth, opts); | 166 | synproxy_build_options(nth, opts); |
| 165 | 167 | ||
| 166 | synproxy_send_tcp(skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW, | 168 | synproxy_send_tcp(snet, skb, nskb, &snet->tmpl->ct_general, IP_CT_NEW, |
| 167 | niph, nth, tcp_hdr_size); | 169 | niph, nth, tcp_hdr_size); |
| 168 | } | 170 | } |
| 169 | 171 | ||
| @@ -203,7 +205,7 @@ synproxy_send_server_ack(const struct synproxy_net *snet, | |||
| 203 | 205 | ||
| 204 | synproxy_build_options(nth, opts); | 206 | synproxy_build_options(nth, opts); |
| 205 | 207 | ||
| 206 | synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); | 208 | synproxy_send_tcp(snet, skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); |
| 207 | } | 209 | } |
| 208 | 210 | ||
| 209 | static void | 211 | static void |
| @@ -241,7 +243,8 @@ synproxy_send_client_ack(const struct synproxy_net *snet, | |||
| 241 | 243 | ||
| 242 | synproxy_build_options(nth, opts); | 244 | synproxy_build_options(nth, opts); |
| 243 | 245 | ||
| 244 | synproxy_send_tcp(skb, nskb, NULL, 0, niph, nth, tcp_hdr_size); | 246 | synproxy_send_tcp(snet, skb, nskb, skb->nfct, IP_CT_ESTABLISHED_REPLY, |
| 247 | niph, nth, tcp_hdr_size); | ||
| 245 | } | 248 | } |
| 246 | 249 | ||
| 247 | static bool | 250 | static bool |
| @@ -301,7 +304,7 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
| 301 | XT_SYNPROXY_OPT_SACK_PERM | | 304 | XT_SYNPROXY_OPT_SACK_PERM | |
| 302 | XT_SYNPROXY_OPT_ECN); | 305 | XT_SYNPROXY_OPT_ECN); |
| 303 | 306 | ||
| 304 | synproxy_send_client_synack(skb, th, &opts); | 307 | synproxy_send_client_synack(snet, skb, th, &opts); |
| 305 | return NF_DROP; | 308 | return NF_DROP; |
| 306 | 309 | ||
| 307 | } else if (th->ack && !(th->fin || th->rst || th->syn)) { | 310 | } else if (th->ack && !(th->fin || th->rst || th->syn)) { |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 6090969937f8..d15586490cec 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -318,8 +318,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = { | |||
| 318 | /* allocate dst with ip6_dst_ops */ | 318 | /* allocate dst with ip6_dst_ops */ |
| 319 | static struct rt6_info *__ip6_dst_alloc(struct net *net, | 319 | static struct rt6_info *__ip6_dst_alloc(struct net *net, |
| 320 | struct net_device *dev, | 320 | struct net_device *dev, |
| 321 | int flags, | 321 | int flags) |
| 322 | struct fib6_table *table) | ||
| 323 | { | 322 | { |
| 324 | struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, | 323 | struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev, |
| 325 | 0, DST_OBSOLETE_FORCE_CHK, flags); | 324 | 0, DST_OBSOLETE_FORCE_CHK, flags); |
| @@ -336,10 +335,9 @@ static struct rt6_info *__ip6_dst_alloc(struct net *net, | |||
| 336 | 335 | ||
| 337 | static struct rt6_info *ip6_dst_alloc(struct net *net, | 336 | static struct rt6_info *ip6_dst_alloc(struct net *net, |
| 338 | struct net_device *dev, | 337 | struct net_device *dev, |
| 339 | int flags, | 338 | int flags) |
| 340 | struct fib6_table *table) | ||
| 341 | { | 339 | { |
| 342 | struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags, table); | 340 | struct rt6_info *rt = __ip6_dst_alloc(net, dev, flags); |
| 343 | 341 | ||
| 344 | if (rt) { | 342 | if (rt) { |
| 345 | rt->rt6i_pcpu = alloc_percpu_gfp(struct rt6_info *, GFP_ATOMIC); | 343 | rt->rt6i_pcpu = alloc_percpu_gfp(struct rt6_info *, GFP_ATOMIC); |
| @@ -950,8 +948,7 @@ static struct rt6_info *ip6_rt_cache_alloc(struct rt6_info *ort, | |||
| 950 | if (ort->rt6i_flags & (RTF_CACHE | RTF_PCPU)) | 948 | if (ort->rt6i_flags & (RTF_CACHE | RTF_PCPU)) |
| 951 | ort = (struct rt6_info *)ort->dst.from; | 949 | ort = (struct rt6_info *)ort->dst.from; |
| 952 | 950 | ||
| 953 | rt = __ip6_dst_alloc(dev_net(ort->dst.dev), ort->dst.dev, | 951 | rt = __ip6_dst_alloc(dev_net(ort->dst.dev), ort->dst.dev, 0); |
| 954 | 0, ort->rt6i_table); | ||
| 955 | 952 | ||
| 956 | if (!rt) | 953 | if (!rt) |
| 957 | return NULL; | 954 | return NULL; |
| @@ -983,8 +980,7 @@ static struct rt6_info *ip6_rt_pcpu_alloc(struct rt6_info *rt) | |||
| 983 | struct rt6_info *pcpu_rt; | 980 | struct rt6_info *pcpu_rt; |
| 984 | 981 | ||
| 985 | pcpu_rt = __ip6_dst_alloc(dev_net(rt->dst.dev), | 982 | pcpu_rt = __ip6_dst_alloc(dev_net(rt->dst.dev), |
| 986 | rt->dst.dev, rt->dst.flags, | 983 | rt->dst.dev, rt->dst.flags); |
| 987 | rt->rt6i_table); | ||
| 988 | 984 | ||
| 989 | if (!pcpu_rt) | 985 | if (!pcpu_rt) |
| 990 | return NULL; | 986 | return NULL; |
| @@ -997,32 +993,53 @@ static struct rt6_info *ip6_rt_pcpu_alloc(struct rt6_info *rt) | |||
| 997 | /* It should be called with read_lock_bh(&tb6_lock) acquired */ | 993 | /* It should be called with read_lock_bh(&tb6_lock) acquired */ |
| 998 | static struct rt6_info *rt6_get_pcpu_route(struct rt6_info *rt) | 994 | static struct rt6_info *rt6_get_pcpu_route(struct rt6_info *rt) |
| 999 | { | 995 | { |
| 1000 | struct rt6_info *pcpu_rt, *prev, **p; | 996 | struct rt6_info *pcpu_rt, **p; |
| 1001 | 997 | ||
| 1002 | p = this_cpu_ptr(rt->rt6i_pcpu); | 998 | p = this_cpu_ptr(rt->rt6i_pcpu); |
| 1003 | pcpu_rt = *p; | 999 | pcpu_rt = *p; |
| 1004 | 1000 | ||
| 1005 | if (pcpu_rt) | 1001 | if (pcpu_rt) { |
| 1006 | goto done; | 1002 | dst_hold(&pcpu_rt->dst); |
| 1003 | rt6_dst_from_metrics_check(pcpu_rt); | ||
| 1004 | } | ||
| 1005 | return pcpu_rt; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | static struct rt6_info *rt6_make_pcpu_route(struct rt6_info *rt) | ||
| 1009 | { | ||
| 1010 | struct fib6_table *table = rt->rt6i_table; | ||
| 1011 | struct rt6_info *pcpu_rt, *prev, **p; | ||
| 1007 | 1012 | ||
| 1008 | pcpu_rt = ip6_rt_pcpu_alloc(rt); | 1013 | pcpu_rt = ip6_rt_pcpu_alloc(rt); |
| 1009 | if (!pcpu_rt) { | 1014 | if (!pcpu_rt) { |
| 1010 | struct net *net = dev_net(rt->dst.dev); | 1015 | struct net *net = dev_net(rt->dst.dev); |
| 1011 | 1016 | ||
| 1012 | pcpu_rt = net->ipv6.ip6_null_entry; | 1017 | dst_hold(&net->ipv6.ip6_null_entry->dst); |
| 1013 | goto done; | 1018 | return net->ipv6.ip6_null_entry; |
| 1014 | } | 1019 | } |
| 1015 | 1020 | ||
| 1016 | prev = cmpxchg(p, NULL, pcpu_rt); | 1021 | read_lock_bh(&table->tb6_lock); |
| 1017 | if (prev) { | 1022 | if (rt->rt6i_pcpu) { |
| 1018 | /* If someone did it before us, return prev instead */ | 1023 | p = this_cpu_ptr(rt->rt6i_pcpu); |
| 1024 | prev = cmpxchg(p, NULL, pcpu_rt); | ||
| 1025 | if (prev) { | ||
| 1026 | /* If someone did it before us, return prev instead */ | ||
| 1027 | dst_destroy(&pcpu_rt->dst); | ||
| 1028 | pcpu_rt = prev; | ||
| 1029 | } | ||
| 1030 | } else { | ||
| 1031 | /* rt has been removed from the fib6 tree | ||
| 1032 | * before we have a chance to acquire the read_lock. | ||
| 1033 | * In this case, don't brother to create a pcpu rt | ||
| 1034 | * since rt is going away anyway. The next | ||
| 1035 | * dst_check() will trigger a re-lookup. | ||
| 1036 | */ | ||
| 1019 | dst_destroy(&pcpu_rt->dst); | 1037 | dst_destroy(&pcpu_rt->dst); |
| 1020 | pcpu_rt = prev; | 1038 | pcpu_rt = rt; |
| 1021 | } | 1039 | } |
| 1022 | |||
| 1023 | done: | ||
| 1024 | dst_hold(&pcpu_rt->dst); | 1040 | dst_hold(&pcpu_rt->dst); |
| 1025 | rt6_dst_from_metrics_check(pcpu_rt); | 1041 | rt6_dst_from_metrics_check(pcpu_rt); |
| 1042 | read_unlock_bh(&table->tb6_lock); | ||
| 1026 | return pcpu_rt; | 1043 | return pcpu_rt; |
| 1027 | } | 1044 | } |
| 1028 | 1045 | ||
| @@ -1097,9 +1114,22 @@ redo_rt6_select: | |||
| 1097 | rt->dst.lastuse = jiffies; | 1114 | rt->dst.lastuse = jiffies; |
| 1098 | rt->dst.__use++; | 1115 | rt->dst.__use++; |
| 1099 | pcpu_rt = rt6_get_pcpu_route(rt); | 1116 | pcpu_rt = rt6_get_pcpu_route(rt); |
| 1100 | read_unlock_bh(&table->tb6_lock); | 1117 | |
| 1118 | if (pcpu_rt) { | ||
| 1119 | read_unlock_bh(&table->tb6_lock); | ||
| 1120 | } else { | ||
| 1121 | /* We have to do the read_unlock first | ||
| 1122 | * because rt6_make_pcpu_route() may trigger | ||
| 1123 | * ip6_dst_gc() which will take the write_lock. | ||
| 1124 | */ | ||
| 1125 | dst_hold(&rt->dst); | ||
| 1126 | read_unlock_bh(&table->tb6_lock); | ||
| 1127 | pcpu_rt = rt6_make_pcpu_route(rt); | ||
| 1128 | dst_release(&rt->dst); | ||
| 1129 | } | ||
| 1101 | 1130 | ||
| 1102 | return pcpu_rt; | 1131 | return pcpu_rt; |
| 1132 | |||
| 1103 | } | 1133 | } |
| 1104 | } | 1134 | } |
| 1105 | 1135 | ||
| @@ -1555,7 +1585,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, | |||
| 1555 | if (unlikely(!idev)) | 1585 | if (unlikely(!idev)) |
| 1556 | return ERR_PTR(-ENODEV); | 1586 | return ERR_PTR(-ENODEV); |
| 1557 | 1587 | ||
| 1558 | rt = ip6_dst_alloc(net, dev, 0, NULL); | 1588 | rt = ip6_dst_alloc(net, dev, 0); |
| 1559 | if (unlikely(!rt)) { | 1589 | if (unlikely(!rt)) { |
| 1560 | in6_dev_put(idev); | 1590 | in6_dev_put(idev); |
| 1561 | dst = ERR_PTR(-ENOMEM); | 1591 | dst = ERR_PTR(-ENOMEM); |
| @@ -1742,7 +1772,8 @@ int ip6_route_add(struct fib6_config *cfg) | |||
| 1742 | if (!table) | 1772 | if (!table) |
| 1743 | goto out; | 1773 | goto out; |
| 1744 | 1774 | ||
| 1745 | rt = ip6_dst_alloc(net, NULL, (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT, table); | 1775 | rt = ip6_dst_alloc(net, NULL, |
| 1776 | (cfg->fc_flags & RTF_ADDRCONF) ? 0 : DST_NOCOUNT); | ||
| 1746 | 1777 | ||
| 1747 | if (!rt) { | 1778 | if (!rt) { |
| 1748 | err = -ENOMEM; | 1779 | err = -ENOMEM; |
| @@ -1831,6 +1862,7 @@ int ip6_route_add(struct fib6_config *cfg) | |||
| 1831 | int gwa_type; | 1862 | int gwa_type; |
| 1832 | 1863 | ||
| 1833 | gw_addr = &cfg->fc_gateway; | 1864 | gw_addr = &cfg->fc_gateway; |
| 1865 | gwa_type = ipv6_addr_type(gw_addr); | ||
| 1834 | 1866 | ||
| 1835 | /* if gw_addr is local we will fail to detect this in case | 1867 | /* if gw_addr is local we will fail to detect this in case |
| 1836 | * address is still TENTATIVE (DAD in progress). rt6_lookup() | 1868 | * address is still TENTATIVE (DAD in progress). rt6_lookup() |
| @@ -1838,11 +1870,12 @@ int ip6_route_add(struct fib6_config *cfg) | |||
| 1838 | * prefix route was assigned to, which might be non-loopback. | 1870 | * prefix route was assigned to, which might be non-loopback. |
| 1839 | */ | 1871 | */ |
| 1840 | err = -EINVAL; | 1872 | err = -EINVAL; |
| 1841 | if (ipv6_chk_addr_and_flags(net, gw_addr, NULL, 0, 0)) | 1873 | if (ipv6_chk_addr_and_flags(net, gw_addr, |
| 1874 | gwa_type & IPV6_ADDR_LINKLOCAL ? | ||
| 1875 | dev : NULL, 0, 0)) | ||
| 1842 | goto out; | 1876 | goto out; |
| 1843 | 1877 | ||
| 1844 | rt->rt6i_gateway = *gw_addr; | 1878 | rt->rt6i_gateway = *gw_addr; |
| 1845 | gwa_type = ipv6_addr_type(gw_addr); | ||
| 1846 | 1879 | ||
| 1847 | if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) { | 1880 | if (gwa_type != (IPV6_ADDR_LINKLOCAL|IPV6_ADDR_UNICAST)) { |
| 1848 | struct rt6_info *grt; | 1881 | struct rt6_info *grt; |
| @@ -2397,7 +2430,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
| 2397 | { | 2430 | { |
| 2398 | struct net *net = dev_net(idev->dev); | 2431 | struct net *net = dev_net(idev->dev); |
| 2399 | struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, | 2432 | struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, |
| 2400 | DST_NOCOUNT, NULL); | 2433 | DST_NOCOUNT); |
| 2401 | if (!rt) | 2434 | if (!rt) |
| 2402 | return ERR_PTR(-ENOMEM); | 2435 | return ERR_PTR(-ENOMEM); |
| 2403 | 2436 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 6748c4277aff..7a6cea5e4274 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -943,7 +943,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
| 943 | &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); | 943 | &ipv6_hdr(skb)->daddr, tcp_v6_iif(skb)); |
| 944 | if (req) { | 944 | if (req) { |
| 945 | nsk = tcp_check_req(sk, skb, req, false); | 945 | nsk = tcp_check_req(sk, skb, req, false); |
| 946 | if (!nsk) | 946 | if (!nsk || nsk == sk) |
| 947 | reqsk_put(req); | 947 | reqsk_put(req); |
| 948 | return nsk; | 948 | return nsk; |
| 949 | } | 949 | } |
diff --git a/net/key/af_key.c b/net/key/af_key.c index b397f0aa9005..83a70688784b 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
| @@ -219,7 +219,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, | |||
| 219 | #define BROADCAST_ONE 1 | 219 | #define BROADCAST_ONE 1 |
| 220 | #define BROADCAST_REGISTERED 2 | 220 | #define BROADCAST_REGISTERED 2 |
| 221 | #define BROADCAST_PROMISC_ONLY 4 | 221 | #define BROADCAST_PROMISC_ONLY 4 |
| 222 | static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, | 222 | static int pfkey_broadcast(struct sk_buff *skb, |
| 223 | int broadcast_flags, struct sock *one_sk, | 223 | int broadcast_flags, struct sock *one_sk, |
| 224 | struct net *net) | 224 | struct net *net) |
| 225 | { | 225 | { |
| @@ -244,7 +244,7 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, | |||
| 244 | * socket. | 244 | * socket. |
| 245 | */ | 245 | */ |
| 246 | if (pfk->promisc) | 246 | if (pfk->promisc) |
| 247 | pfkey_broadcast_one(skb, &skb2, allocation, sk); | 247 | pfkey_broadcast_one(skb, &skb2, GFP_ATOMIC, sk); |
| 248 | 248 | ||
| 249 | /* the exact target will be processed later */ | 249 | /* the exact target will be processed later */ |
| 250 | if (sk == one_sk) | 250 | if (sk == one_sk) |
| @@ -259,7 +259,7 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, | |||
| 259 | continue; | 259 | continue; |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | err2 = pfkey_broadcast_one(skb, &skb2, allocation, sk); | 262 | err2 = pfkey_broadcast_one(skb, &skb2, GFP_ATOMIC, sk); |
| 263 | 263 | ||
| 264 | /* Error is cleare after succecful sending to at least one | 264 | /* Error is cleare after succecful sending to at least one |
| 265 | * registered KM */ | 265 | * registered KM */ |
| @@ -269,7 +269,7 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, | |||
| 269 | rcu_read_unlock(); | 269 | rcu_read_unlock(); |
| 270 | 270 | ||
| 271 | if (one_sk != NULL) | 271 | if (one_sk != NULL) |
| 272 | err = pfkey_broadcast_one(skb, &skb2, allocation, one_sk); | 272 | err = pfkey_broadcast_one(skb, &skb2, GFP_KERNEL, one_sk); |
| 273 | 273 | ||
| 274 | kfree_skb(skb2); | 274 | kfree_skb(skb2); |
| 275 | kfree_skb(skb); | 275 | kfree_skb(skb); |
| @@ -292,7 +292,7 @@ static int pfkey_do_dump(struct pfkey_sock *pfk) | |||
| 292 | hdr = (struct sadb_msg *) pfk->dump.skb->data; | 292 | hdr = (struct sadb_msg *) pfk->dump.skb->data; |
| 293 | hdr->sadb_msg_seq = 0; | 293 | hdr->sadb_msg_seq = 0; |
| 294 | hdr->sadb_msg_errno = rc; | 294 | hdr->sadb_msg_errno = rc; |
| 295 | pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, | 295 | pfkey_broadcast(pfk->dump.skb, BROADCAST_ONE, |
| 296 | &pfk->sk, sock_net(&pfk->sk)); | 296 | &pfk->sk, sock_net(&pfk->sk)); |
| 297 | pfk->dump.skb = NULL; | 297 | pfk->dump.skb = NULL; |
| 298 | } | 298 | } |
| @@ -333,7 +333,7 @@ static int pfkey_error(const struct sadb_msg *orig, int err, struct sock *sk) | |||
| 333 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / | 333 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / |
| 334 | sizeof(uint64_t)); | 334 | sizeof(uint64_t)); |
| 335 | 335 | ||
| 336 | pfkey_broadcast(skb, GFP_KERNEL, BROADCAST_ONE, sk, sock_net(sk)); | 336 | pfkey_broadcast(skb, BROADCAST_ONE, sk, sock_net(sk)); |
| 337 | 337 | ||
| 338 | return 0; | 338 | return 0; |
| 339 | } | 339 | } |
| @@ -1365,7 +1365,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, const struct sadb_ | |||
| 1365 | 1365 | ||
| 1366 | xfrm_state_put(x); | 1366 | xfrm_state_put(x); |
| 1367 | 1367 | ||
| 1368 | pfkey_broadcast(resp_skb, GFP_KERNEL, BROADCAST_ONE, sk, net); | 1368 | pfkey_broadcast(resp_skb, BROADCAST_ONE, sk, net); |
| 1369 | 1369 | ||
| 1370 | return 0; | 1370 | return 0; |
| 1371 | } | 1371 | } |
| @@ -1452,7 +1452,7 @@ static int key_notify_sa(struct xfrm_state *x, const struct km_event *c) | |||
| 1452 | hdr->sadb_msg_seq = c->seq; | 1452 | hdr->sadb_msg_seq = c->seq; |
| 1453 | hdr->sadb_msg_pid = c->portid; | 1453 | hdr->sadb_msg_pid = c->portid; |
| 1454 | 1454 | ||
| 1455 | pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xs_net(x)); | 1455 | pfkey_broadcast(skb, BROADCAST_ALL, NULL, xs_net(x)); |
| 1456 | 1456 | ||
| 1457 | return 0; | 1457 | return 0; |
| 1458 | } | 1458 | } |
| @@ -1565,7 +1565,7 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, const struct sadb_msg | |||
| 1565 | out_hdr->sadb_msg_reserved = 0; | 1565 | out_hdr->sadb_msg_reserved = 0; |
| 1566 | out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; | 1566 | out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; |
| 1567 | out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; | 1567 | out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; |
| 1568 | pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, sk, sock_net(sk)); | 1568 | pfkey_broadcast(out_skb, BROADCAST_ONE, sk, sock_net(sk)); |
| 1569 | 1569 | ||
| 1570 | return 0; | 1570 | return 0; |
| 1571 | } | 1571 | } |
| @@ -1670,7 +1670,7 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad | |||
| 1670 | return -ENOBUFS; | 1670 | return -ENOBUFS; |
| 1671 | } | 1671 | } |
| 1672 | 1672 | ||
| 1673 | pfkey_broadcast(supp_skb, GFP_KERNEL, BROADCAST_REGISTERED, sk, sock_net(sk)); | 1673 | pfkey_broadcast(supp_skb, BROADCAST_REGISTERED, sk, sock_net(sk)); |
| 1674 | 1674 | ||
| 1675 | return 0; | 1675 | return 0; |
| 1676 | } | 1676 | } |
| @@ -1689,7 +1689,7 @@ static int unicast_flush_resp(struct sock *sk, const struct sadb_msg *ihdr) | |||
| 1689 | hdr->sadb_msg_errno = (uint8_t) 0; | 1689 | hdr->sadb_msg_errno = (uint8_t) 0; |
| 1690 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); | 1690 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); |
| 1691 | 1691 | ||
| 1692 | return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ONE, sk, sock_net(sk)); | 1692 | return pfkey_broadcast(skb, BROADCAST_ONE, sk, sock_net(sk)); |
| 1693 | } | 1693 | } |
| 1694 | 1694 | ||
| 1695 | static int key_notify_sa_flush(const struct km_event *c) | 1695 | static int key_notify_sa_flush(const struct km_event *c) |
| @@ -1710,7 +1710,7 @@ static int key_notify_sa_flush(const struct km_event *c) | |||
| 1710 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); | 1710 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); |
| 1711 | hdr->sadb_msg_reserved = 0; | 1711 | hdr->sadb_msg_reserved = 0; |
| 1712 | 1712 | ||
| 1713 | pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net); | 1713 | pfkey_broadcast(skb, BROADCAST_ALL, NULL, c->net); |
| 1714 | 1714 | ||
| 1715 | return 0; | 1715 | return 0; |
| 1716 | } | 1716 | } |
| @@ -1767,7 +1767,7 @@ static int dump_sa(struct xfrm_state *x, int count, void *ptr) | |||
| 1767 | out_hdr->sadb_msg_pid = pfk->dump.msg_portid; | 1767 | out_hdr->sadb_msg_pid = pfk->dump.msg_portid; |
| 1768 | 1768 | ||
| 1769 | if (pfk->dump.skb) | 1769 | if (pfk->dump.skb) |
| 1770 | pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, | 1770 | pfkey_broadcast(pfk->dump.skb, BROADCAST_ONE, |
| 1771 | &pfk->sk, sock_net(&pfk->sk)); | 1771 | &pfk->sk, sock_net(&pfk->sk)); |
| 1772 | pfk->dump.skb = out_skb; | 1772 | pfk->dump.skb = out_skb; |
| 1773 | 1773 | ||
| @@ -1847,7 +1847,7 @@ static int pfkey_promisc(struct sock *sk, struct sk_buff *skb, const struct sadb | |||
| 1847 | new_hdr->sadb_msg_errno = 0; | 1847 | new_hdr->sadb_msg_errno = 0; |
| 1848 | } | 1848 | } |
| 1849 | 1849 | ||
| 1850 | pfkey_broadcast(skb, GFP_KERNEL, BROADCAST_ALL, NULL, sock_net(sk)); | 1850 | pfkey_broadcast(skb, BROADCAST_ALL, NULL, sock_net(sk)); |
| 1851 | return 0; | 1851 | return 0; |
| 1852 | } | 1852 | } |
| 1853 | 1853 | ||
| @@ -2181,7 +2181,7 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, const struct km_ev | |||
| 2181 | out_hdr->sadb_msg_errno = 0; | 2181 | out_hdr->sadb_msg_errno = 0; |
| 2182 | out_hdr->sadb_msg_seq = c->seq; | 2182 | out_hdr->sadb_msg_seq = c->seq; |
| 2183 | out_hdr->sadb_msg_pid = c->portid; | 2183 | out_hdr->sadb_msg_pid = c->portid; |
| 2184 | pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp)); | 2184 | pfkey_broadcast(out_skb, BROADCAST_ALL, NULL, xp_net(xp)); |
| 2185 | return 0; | 2185 | return 0; |
| 2186 | 2186 | ||
| 2187 | } | 2187 | } |
| @@ -2401,7 +2401,7 @@ static int key_pol_get_resp(struct sock *sk, struct xfrm_policy *xp, const struc | |||
| 2401 | out_hdr->sadb_msg_errno = 0; | 2401 | out_hdr->sadb_msg_errno = 0; |
| 2402 | out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; | 2402 | out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; |
| 2403 | out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; | 2403 | out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; |
| 2404 | pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ONE, sk, xp_net(xp)); | 2404 | pfkey_broadcast(out_skb, BROADCAST_ONE, sk, xp_net(xp)); |
| 2405 | err = 0; | 2405 | err = 0; |
| 2406 | 2406 | ||
| 2407 | out: | 2407 | out: |
| @@ -2655,7 +2655,7 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr) | |||
| 2655 | out_hdr->sadb_msg_pid = pfk->dump.msg_portid; | 2655 | out_hdr->sadb_msg_pid = pfk->dump.msg_portid; |
| 2656 | 2656 | ||
| 2657 | if (pfk->dump.skb) | 2657 | if (pfk->dump.skb) |
| 2658 | pfkey_broadcast(pfk->dump.skb, GFP_ATOMIC, BROADCAST_ONE, | 2658 | pfkey_broadcast(pfk->dump.skb, BROADCAST_ONE, |
| 2659 | &pfk->sk, sock_net(&pfk->sk)); | 2659 | &pfk->sk, sock_net(&pfk->sk)); |
| 2660 | pfk->dump.skb = out_skb; | 2660 | pfk->dump.skb = out_skb; |
| 2661 | 2661 | ||
| @@ -2708,7 +2708,7 @@ static int key_notify_policy_flush(const struct km_event *c) | |||
| 2708 | hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC; | 2708 | hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC; |
| 2709 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); | 2709 | hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t)); |
| 2710 | hdr->sadb_msg_reserved = 0; | 2710 | hdr->sadb_msg_reserved = 0; |
| 2711 | pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net); | 2711 | pfkey_broadcast(skb_out, BROADCAST_ALL, NULL, c->net); |
| 2712 | return 0; | 2712 | return 0; |
| 2713 | 2713 | ||
| 2714 | } | 2714 | } |
| @@ -2770,7 +2770,7 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb | |||
| 2770 | void *ext_hdrs[SADB_EXT_MAX]; | 2770 | void *ext_hdrs[SADB_EXT_MAX]; |
| 2771 | int err; | 2771 | int err; |
| 2772 | 2772 | ||
| 2773 | pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL, | 2773 | pfkey_broadcast(skb_clone(skb, GFP_KERNEL), |
| 2774 | BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); | 2774 | BROADCAST_PROMISC_ONLY, NULL, sock_net(sk)); |
| 2775 | 2775 | ||
| 2776 | memset(ext_hdrs, 0, sizeof(ext_hdrs)); | 2776 | memset(ext_hdrs, 0, sizeof(ext_hdrs)); |
| @@ -2992,7 +2992,7 @@ static int key_notify_sa_expire(struct xfrm_state *x, const struct km_event *c) | |||
| 2992 | out_hdr->sadb_msg_seq = 0; | 2992 | out_hdr->sadb_msg_seq = 0; |
| 2993 | out_hdr->sadb_msg_pid = 0; | 2993 | out_hdr->sadb_msg_pid = 0; |
| 2994 | 2994 | ||
| 2995 | pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL, xs_net(x)); | 2995 | pfkey_broadcast(out_skb, BROADCAST_REGISTERED, NULL, xs_net(x)); |
| 2996 | return 0; | 2996 | return 0; |
| 2997 | } | 2997 | } |
| 2998 | 2998 | ||
| @@ -3182,7 +3182,7 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct | |||
| 3182 | xfrm_ctx->ctx_len); | 3182 | xfrm_ctx->ctx_len); |
| 3183 | } | 3183 | } |
| 3184 | 3184 | ||
| 3185 | return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL, xs_net(x)); | 3185 | return pfkey_broadcast(skb, BROADCAST_REGISTERED, NULL, xs_net(x)); |
| 3186 | } | 3186 | } |
| 3187 | 3187 | ||
| 3188 | static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt, | 3188 | static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt, |
| @@ -3380,7 +3380,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, | |||
| 3380 | n_port->sadb_x_nat_t_port_port = sport; | 3380 | n_port->sadb_x_nat_t_port_port = sport; |
| 3381 | n_port->sadb_x_nat_t_port_reserved = 0; | 3381 | n_port->sadb_x_nat_t_port_reserved = 0; |
| 3382 | 3382 | ||
| 3383 | return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL, xs_net(x)); | 3383 | return pfkey_broadcast(skb, BROADCAST_REGISTERED, NULL, xs_net(x)); |
| 3384 | } | 3384 | } |
| 3385 | 3385 | ||
| 3386 | #ifdef CONFIG_NET_KEY_MIGRATE | 3386 | #ifdef CONFIG_NET_KEY_MIGRATE |
| @@ -3572,7 +3572,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, | |||
| 3572 | } | 3572 | } |
| 3573 | 3573 | ||
| 3574 | /* broadcast migrate message to sockets */ | 3574 | /* broadcast migrate message to sockets */ |
| 3575 | pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, &init_net); | 3575 | pfkey_broadcast(skb, BROADCAST_ALL, NULL, &init_net); |
| 3576 | 3576 | ||
| 3577 | return 0; | 3577 | return 0; |
| 3578 | 3578 | ||
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index 247552a7f6c2..3ece7d1034c8 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
| @@ -92,14 +92,15 @@ int minstrel_get_tp_avg(struct minstrel_rate *mr, int prob_ewma) | |||
| 92 | static inline void | 92 | static inline void |
| 93 | minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list) | 93 | minstrel_sort_best_tp_rates(struct minstrel_sta_info *mi, int i, u8 *tp_list) |
| 94 | { | 94 | { |
| 95 | int j = MAX_THR_RATES; | 95 | int j; |
| 96 | struct minstrel_rate_stats *tmp_mrs = &mi->r[j - 1].stats; | 96 | struct minstrel_rate_stats *tmp_mrs; |
| 97 | struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats; | 97 | struct minstrel_rate_stats *cur_mrs = &mi->r[i].stats; |
| 98 | 98 | ||
| 99 | while (j > 0 && (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) > | 99 | for (j = MAX_THR_RATES; j > 0; --j) { |
| 100 | minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma))) { | ||
| 101 | j--; | ||
| 102 | tmp_mrs = &mi->r[tp_list[j - 1]].stats; | 100 | tmp_mrs = &mi->r[tp_list[j - 1]].stats; |
| 101 | if (minstrel_get_tp_avg(&mi->r[i], cur_mrs->prob_ewma) <= | ||
| 102 | minstrel_get_tp_avg(&mi->r[tp_list[j - 1]], tmp_mrs->prob_ewma)) | ||
| 103 | break; | ||
| 103 | } | 104 | } |
| 104 | 105 | ||
| 105 | if (j < MAX_THR_RATES - 1) | 106 | if (j < MAX_THR_RATES - 1) |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 651039ad1681..3c20d02aee73 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
| @@ -292,7 +292,7 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net, u16 zone, gfp_t flags) | |||
| 292 | { | 292 | { |
| 293 | struct nf_conn *tmpl; | 293 | struct nf_conn *tmpl; |
| 294 | 294 | ||
| 295 | tmpl = kzalloc(sizeof(struct nf_conn), GFP_KERNEL); | 295 | tmpl = kzalloc(sizeof(*tmpl), flags); |
| 296 | if (tmpl == NULL) | 296 | if (tmpl == NULL) |
| 297 | return NULL; | 297 | return NULL; |
| 298 | 298 | ||
| @@ -303,7 +303,7 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net, u16 zone, gfp_t flags) | |||
| 303 | if (zone) { | 303 | if (zone) { |
| 304 | struct nf_conntrack_zone *nf_ct_zone; | 304 | struct nf_conntrack_zone *nf_ct_zone; |
| 305 | 305 | ||
| 306 | nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, GFP_ATOMIC); | 306 | nf_ct_zone = nf_ct_ext_add(tmpl, NF_CT_EXT_ZONE, flags); |
| 307 | if (!nf_ct_zone) | 307 | if (!nf_ct_zone) |
| 308 | goto out_free; | 308 | goto out_free; |
| 309 | nf_ct_zone->id = zone; | 309 | nf_ct_zone->id = zone; |
| @@ -1544,10 +1544,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) | |||
| 1544 | sz = nr_slots * sizeof(struct hlist_nulls_head); | 1544 | sz = nr_slots * sizeof(struct hlist_nulls_head); |
| 1545 | hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, | 1545 | hash = (void *)__get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, |
| 1546 | get_order(sz)); | 1546 | get_order(sz)); |
| 1547 | if (!hash) { | 1547 | if (!hash) |
| 1548 | printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); | ||
| 1549 | hash = vzalloc(sz); | 1548 | hash = vzalloc(sz); |
| 1550 | } | ||
| 1551 | 1549 | ||
| 1552 | if (hash && nulls) | 1550 | if (hash && nulls) |
| 1553 | for (i = 0; i < nr_slots; i++) | 1551 | for (i = 0; i < nr_slots; i++) |
diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c index 71f1e9fdfa18..d7f168527903 100644 --- a/net/netfilter/nf_synproxy_core.c +++ b/net/netfilter/nf_synproxy_core.c | |||
| @@ -353,10 +353,8 @@ static int __net_init synproxy_net_init(struct net *net) | |||
| 353 | int err = -ENOMEM; | 353 | int err = -ENOMEM; |
| 354 | 354 | ||
| 355 | ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL); | 355 | ct = nf_ct_tmpl_alloc(net, 0, GFP_KERNEL); |
| 356 | if (IS_ERR(ct)) { | 356 | if (!ct) |
| 357 | err = PTR_ERR(ct); | ||
| 358 | goto err1; | 357 | goto err1; |
| 359 | } | ||
| 360 | 358 | ||
| 361 | if (!nfct_seqadj_ext_add(ct)) | 359 | if (!nfct_seqadj_ext_add(ct)) |
| 362 | goto err2; | 360 | goto err2; |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index c6630030c912..43ddeee404e9 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
| @@ -202,9 +202,10 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par, | |||
| 202 | goto err1; | 202 | goto err1; |
| 203 | 203 | ||
| 204 | ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL); | 204 | ct = nf_ct_tmpl_alloc(par->net, info->zone, GFP_KERNEL); |
| 205 | ret = PTR_ERR(ct); | 205 | if (!ct) { |
| 206 | if (IS_ERR(ct)) | 206 | ret = -ENOMEM; |
| 207 | goto err2; | 207 | goto err2; |
| 208 | } | ||
| 208 | 209 | ||
| 209 | ret = 0; | 210 | ret = 0; |
| 210 | if ((info->ct_events || info->exp_events) && | 211 | if ((info->ct_events || info->exp_events) && |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index d8e2e3918ce2..a774985489e2 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
| @@ -1096,6 +1096,11 @@ static int netlink_insert(struct sock *sk, u32 portid) | |||
| 1096 | 1096 | ||
| 1097 | err = __netlink_insert(table, sk); | 1097 | err = __netlink_insert(table, sk); |
| 1098 | if (err) { | 1098 | if (err) { |
| 1099 | /* In case the hashtable backend returns with -EBUSY | ||
| 1100 | * from here, it must not escape to the caller. | ||
| 1101 | */ | ||
| 1102 | if (unlikely(err == -EBUSY)) | ||
| 1103 | err = -EOVERFLOW; | ||
| 1099 | if (err == -EEXIST) | 1104 | if (err == -EEXIST) |
| 1100 | err = -EADDRINUSE; | 1105 | err = -EADDRINUSE; |
| 1101 | nlk_sk(sk)->portid = 0; | 1106 | nlk_sk(sk)->portid = 0; |
| @@ -2396,7 +2401,7 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) | |||
| 2396 | * sendmsg(), but that's what we've got... | 2401 | * sendmsg(), but that's what we've got... |
| 2397 | */ | 2402 | */ |
| 2398 | if (netlink_tx_is_mmaped(sk) && | 2403 | if (netlink_tx_is_mmaped(sk) && |
| 2399 | msg->msg_iter.type == ITER_IOVEC && | 2404 | iter_is_iovec(&msg->msg_iter) && |
| 2400 | msg->msg_iter.nr_segs == 1 && | 2405 | msg->msg_iter.nr_segs == 1 && |
| 2401 | msg->msg_iter.iov->iov_base == NULL) { | 2406 | msg->msg_iter.iov->iov_base == NULL) { |
| 2402 | err = netlink_mmap_sendmsg(sk, msg, dst_portid, dst_group, | 2407 | err = netlink_mmap_sendmsg(sk, msg, dst_portid, dst_group, |
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 8a8c0b8b4f63..ee34f474ad14 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
| @@ -273,28 +273,36 @@ static int set_eth_addr(struct sk_buff *skb, struct sw_flow_key *flow_key, | |||
| 273 | return 0; | 273 | return 0; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, | 276 | static void update_ip_l4_checksum(struct sk_buff *skb, struct iphdr *nh, |
| 277 | __be32 *addr, __be32 new_addr) | 277 | __be32 addr, __be32 new_addr) |
| 278 | { | 278 | { |
| 279 | int transport_len = skb->len - skb_transport_offset(skb); | 279 | int transport_len = skb->len - skb_transport_offset(skb); |
| 280 | 280 | ||
| 281 | if (nh->frag_off & htons(IP_OFFSET)) | ||
| 282 | return; | ||
| 283 | |||
| 281 | if (nh->protocol == IPPROTO_TCP) { | 284 | if (nh->protocol == IPPROTO_TCP) { |
| 282 | if (likely(transport_len >= sizeof(struct tcphdr))) | 285 | if (likely(transport_len >= sizeof(struct tcphdr))) |
| 283 | inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb, | 286 | inet_proto_csum_replace4(&tcp_hdr(skb)->check, skb, |
| 284 | *addr, new_addr, 1); | 287 | addr, new_addr, 1); |
| 285 | } else if (nh->protocol == IPPROTO_UDP) { | 288 | } else if (nh->protocol == IPPROTO_UDP) { |
| 286 | if (likely(transport_len >= sizeof(struct udphdr))) { | 289 | if (likely(transport_len >= sizeof(struct udphdr))) { |
| 287 | struct udphdr *uh = udp_hdr(skb); | 290 | struct udphdr *uh = udp_hdr(skb); |
| 288 | 291 | ||
| 289 | if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) { | 292 | if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) { |
| 290 | inet_proto_csum_replace4(&uh->check, skb, | 293 | inet_proto_csum_replace4(&uh->check, skb, |
| 291 | *addr, new_addr, 1); | 294 | addr, new_addr, 1); |
| 292 | if (!uh->check) | 295 | if (!uh->check) |
| 293 | uh->check = CSUM_MANGLED_0; | 296 | uh->check = CSUM_MANGLED_0; |
| 294 | } | 297 | } |
| 295 | } | 298 | } |
| 296 | } | 299 | } |
| 300 | } | ||
| 297 | 301 | ||
| 302 | static void set_ip_addr(struct sk_buff *skb, struct iphdr *nh, | ||
| 303 | __be32 *addr, __be32 new_addr) | ||
| 304 | { | ||
| 305 | update_ip_l4_checksum(skb, nh, *addr, new_addr); | ||
| 298 | csum_replace4(&nh->check, *addr, new_addr); | 306 | csum_replace4(&nh->check, *addr, new_addr); |
| 299 | skb_clear_hash(skb); | 307 | skb_clear_hash(skb); |
| 300 | *addr = new_addr; | 308 | *addr = new_addr; |
diff --git a/net/rds/info.c b/net/rds/info.c index 9a6b4f66187c..140a44a5f7b7 100644 --- a/net/rds/info.c +++ b/net/rds/info.c | |||
| @@ -176,7 +176,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval, | |||
| 176 | 176 | ||
| 177 | /* check for all kinds of wrapping and the like */ | 177 | /* check for all kinds of wrapping and the like */ |
| 178 | start = (unsigned long)optval; | 178 | start = (unsigned long)optval; |
| 179 | if (len < 0 || len + PAGE_SIZE - 1 < len || start + len < start) { | 179 | if (len < 0 || len > INT_MAX - PAGE_SIZE + 1 || start + len < start) { |
| 180 | ret = -EINVAL; | 180 | ret = -EINVAL; |
| 181 | goto out; | 181 | goto out; |
| 182 | } | 182 | } |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index a42a3b257226..268545050ddb 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
| @@ -98,6 +98,8 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla, | |||
| 98 | return ret; | 98 | return ret; |
| 99 | ret = ACT_P_CREATED; | 99 | ret = ACT_P_CREATED; |
| 100 | } else { | 100 | } else { |
| 101 | if (bind) | ||
| 102 | return 0; | ||
| 101 | if (!ovr) { | 103 | if (!ovr) { |
| 102 | tcf_hash_release(a, bind); | 104 | tcf_hash_release(a, bind); |
| 103 | return -EEXIST; | 105 | return -EEXIST; |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index cab9e9b43967..4fbb67430ce4 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
| @@ -490,6 +490,19 @@ static bool u32_destroy(struct tcf_proto *tp, bool force) | |||
| 490 | return false; | 490 | return false; |
| 491 | } | 491 | } |
| 492 | } | 492 | } |
| 493 | |||
| 494 | if (tp_c->refcnt > 1) | ||
| 495 | return false; | ||
| 496 | |||
| 497 | if (tp_c->refcnt == 1) { | ||
| 498 | struct tc_u_hnode *ht; | ||
| 499 | |||
| 500 | for (ht = rtnl_dereference(tp_c->hlist); | ||
| 501 | ht; | ||
| 502 | ht = rtnl_dereference(ht->next)) | ||
| 503 | if (!ht_empty(ht)) | ||
| 504 | return false; | ||
| 505 | } | ||
| 493 | } | 506 | } |
| 494 | 507 | ||
| 495 | if (root_ht && --root_ht->refcnt == 0) | 508 | if (root_ht && --root_ht->refcnt == 0) |
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c index 21ca33c9f036..a9ba030435a2 100644 --- a/net/sched/sch_fq_codel.c +++ b/net/sched/sch_fq_codel.c | |||
| @@ -288,10 +288,26 @@ begin: | |||
| 288 | 288 | ||
| 289 | static void fq_codel_reset(struct Qdisc *sch) | 289 | static void fq_codel_reset(struct Qdisc *sch) |
| 290 | { | 290 | { |
| 291 | struct sk_buff *skb; | 291 | struct fq_codel_sched_data *q = qdisc_priv(sch); |
| 292 | int i; | ||
| 292 | 293 | ||
| 293 | while ((skb = fq_codel_dequeue(sch)) != NULL) | 294 | INIT_LIST_HEAD(&q->new_flows); |
| 294 | kfree_skb(skb); | 295 | INIT_LIST_HEAD(&q->old_flows); |
| 296 | for (i = 0; i < q->flows_cnt; i++) { | ||
| 297 | struct fq_codel_flow *flow = q->flows + i; | ||
| 298 | |||
| 299 | while (flow->head) { | ||
| 300 | struct sk_buff *skb = dequeue_head(flow); | ||
| 301 | |||
| 302 | qdisc_qstats_backlog_dec(sch, skb); | ||
| 303 | kfree_skb(skb); | ||
| 304 | } | ||
| 305 | |||
| 306 | INIT_LIST_HEAD(&flow->flowchain); | ||
| 307 | codel_vars_init(&flow->cvars); | ||
| 308 | } | ||
| 309 | memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); | ||
| 310 | sch->q.qlen = 0; | ||
| 295 | } | 311 | } |
| 296 | 312 | ||
| 297 | static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = { | 313 | static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = { |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 06320c8c1c86..a655ddc3f353 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
| @@ -3132,11 +3132,18 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, | |||
| 3132 | case SCTP_PARAM_IPV4_ADDRESS: | 3132 | case SCTP_PARAM_IPV4_ADDRESS: |
| 3133 | if (length != sizeof(sctp_ipv4addr_param_t)) | 3133 | if (length != sizeof(sctp_ipv4addr_param_t)) |
| 3134 | return false; | 3134 | return false; |
| 3135 | /* ensure there is only one addr param and it's in the | ||
| 3136 | * beginning of addip_hdr params, or we reject it. | ||
| 3137 | */ | ||
| 3138 | if (param.v != addip->addip_hdr.params) | ||
| 3139 | return false; | ||
| 3135 | addr_param_seen = true; | 3140 | addr_param_seen = true; |
| 3136 | break; | 3141 | break; |
| 3137 | case SCTP_PARAM_IPV6_ADDRESS: | 3142 | case SCTP_PARAM_IPV6_ADDRESS: |
| 3138 | if (length != sizeof(sctp_ipv6addr_param_t)) | 3143 | if (length != sizeof(sctp_ipv6addr_param_t)) |
| 3139 | return false; | 3144 | return false; |
| 3145 | if (param.v != addip->addip_hdr.params) | ||
| 3146 | return false; | ||
| 3140 | addr_param_seen = true; | 3147 | addr_param_seen = true; |
| 3141 | break; | 3148 | break; |
| 3142 | case SCTP_PARAM_ADD_IP: | 3149 | case SCTP_PARAM_ADD_IP: |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index fef2acdf4a2e..85e6f03aeb70 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
| @@ -702,7 +702,7 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds, | |||
| 702 | * outstanding data and rely on the retransmission limit be reached | 702 | * outstanding data and rely on the retransmission limit be reached |
| 703 | * to shutdown the association. | 703 | * to shutdown the association. |
| 704 | */ | 704 | */ |
| 705 | if (t->asoc->state != SCTP_STATE_SHUTDOWN_PENDING) | 705 | if (t->asoc->state < SCTP_STATE_SHUTDOWN_PENDING) |
| 706 | t->asoc->overall_error_count = 0; | 706 | t->asoc->overall_error_count = 0; |
| 707 | 707 | ||
| 708 | /* Clear the hb_sent flag to signal that we had a good | 708 | /* Clear the hb_sent flag to signal that we had a good |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 9cb8522d8d22..f3d3fb42b873 100755 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
| @@ -137,7 +137,7 @@ my $ksource = ($ARGV[0] ? $ARGV[0] : '.'); | |||
| 137 | my $kconfig = $ARGV[1]; | 137 | my $kconfig = $ARGV[1]; |
| 138 | my $lsmod_file = $ENV{'LSMOD'}; | 138 | my $lsmod_file = $ENV{'LSMOD'}; |
| 139 | 139 | ||
| 140 | my @makefiles = `find $ksource -name Makefile 2>/dev/null`; | 140 | my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`; |
| 141 | chomp @makefiles; | 141 | chomp @makefiles; |
| 142 | 142 | ||
| 143 | my %depends; | 143 | my %depends; |
diff --git a/security/security.c b/security/security.c index 595fffab48b0..994283624bdb 100644 --- a/security/security.c +++ b/security/security.c | |||
| @@ -380,8 +380,8 @@ int security_inode_init_security(struct inode *inode, struct inode *dir, | |||
| 380 | return 0; | 380 | return 0; |
| 381 | 381 | ||
| 382 | if (!initxattrs) | 382 | if (!initxattrs) |
| 383 | return call_int_hook(inode_init_security, 0, inode, dir, qstr, | 383 | return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, |
| 384 | NULL, NULL, NULL); | 384 | dir, qstr, NULL, NULL, NULL); |
| 385 | memset(new_xattrs, 0, sizeof(new_xattrs)); | 385 | memset(new_xattrs, 0, sizeof(new_xattrs)); |
| 386 | lsm_xattr = new_xattrs; | 386 | lsm_xattr = new_xattrs; |
| 387 | ret = call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, qstr, | 387 | ret = call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, qstr, |
| @@ -409,8 +409,8 @@ int security_old_inode_init_security(struct inode *inode, struct inode *dir, | |||
| 409 | { | 409 | { |
| 410 | if (unlikely(IS_PRIVATE(inode))) | 410 | if (unlikely(IS_PRIVATE(inode))) |
| 411 | return -EOPNOTSUPP; | 411 | return -EOPNOTSUPP; |
| 412 | return call_int_hook(inode_init_security, 0, inode, dir, qstr, | 412 | return call_int_hook(inode_init_security, -EOPNOTSUPP, inode, dir, |
| 413 | name, value, len); | 413 | qstr, name, value, len); |
| 414 | } | 414 | } |
| 415 | EXPORT_SYMBOL(security_old_inode_init_security); | 415 | EXPORT_SYMBOL(security_old_inode_init_security); |
| 416 | 416 | ||
| @@ -1281,7 +1281,8 @@ int security_socket_getpeersec_stream(struct socket *sock, char __user *optval, | |||
| 1281 | 1281 | ||
| 1282 | int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) | 1282 | int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid) |
| 1283 | { | 1283 | { |
| 1284 | return call_int_hook(socket_getpeersec_dgram, 0, sock, skb, secid); | 1284 | return call_int_hook(socket_getpeersec_dgram, -ENOPROTOOPT, sock, |
| 1285 | skb, secid); | ||
| 1285 | } | 1286 | } |
| 1286 | EXPORT_SYMBOL(security_socket_getpeersec_dgram); | 1287 | EXPORT_SYMBOL(security_socket_getpeersec_dgram); |
| 1287 | 1288 | ||
diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c index 9ed32502470e..5ebb89687936 100644 --- a/security/yama/yama_lsm.c +++ b/security/yama/yama_lsm.c | |||
| @@ -406,6 +406,7 @@ static __init int yama_init(void) | |||
| 406 | */ | 406 | */ |
| 407 | if (!security_module_enable("yama")) | 407 | if (!security_module_enable("yama")) |
| 408 | return 0; | 408 | return 0; |
| 409 | yama_add_hooks(); | ||
| 409 | #endif | 410 | #endif |
| 410 | pr_info("Yama: becoming mindful.\n"); | 411 | pr_info("Yama: becoming mindful.\n"); |
| 411 | 412 | ||
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index de165a1b9240..20b56eb987f8 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
| @@ -521,6 +521,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
| 521 | goto out_child; | 521 | goto out_child; |
| 522 | } | 522 | } |
| 523 | 523 | ||
| 524 | /* | ||
| 525 | * Normally perf_session__new would do this, but it doesn't have the | ||
| 526 | * evlist. | ||
| 527 | */ | ||
| 528 | if (rec->tool.ordered_events && !perf_evlist__sample_id_all(rec->evlist)) { | ||
| 529 | pr_warning("WARNING: No sample_id_all support, falling back to unordered processing\n"); | ||
| 530 | rec->tool.ordered_events = false; | ||
| 531 | } | ||
| 532 | |||
| 524 | if (!rec->evlist->nr_groups) | 533 | if (!rec->evlist->nr_groups) |
| 525 | perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); | 534 | perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); |
| 526 | 535 | ||
| @@ -965,9 +974,11 @@ static struct record record = { | |||
| 965 | .tool = { | 974 | .tool = { |
| 966 | .sample = process_sample_event, | 975 | .sample = process_sample_event, |
| 967 | .fork = perf_event__process_fork, | 976 | .fork = perf_event__process_fork, |
| 977 | .exit = perf_event__process_exit, | ||
| 968 | .comm = perf_event__process_comm, | 978 | .comm = perf_event__process_comm, |
| 969 | .mmap = perf_event__process_mmap, | 979 | .mmap = perf_event__process_mmap, |
| 970 | .mmap2 = perf_event__process_mmap2, | 980 | .mmap2 = perf_event__process_mmap2, |
| 981 | .ordered_events = true, | ||
| 971 | }, | 982 | }, |
| 972 | }; | 983 | }; |
| 973 | 984 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index ecf319728f25..6135cc07213c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
| @@ -601,8 +601,8 @@ static void display_sig(int sig __maybe_unused) | |||
| 601 | 601 | ||
| 602 | static void display_setup_sig(void) | 602 | static void display_setup_sig(void) |
| 603 | { | 603 | { |
| 604 | signal(SIGSEGV, display_sig); | 604 | signal(SIGSEGV, sighandler_dump_stack); |
| 605 | signal(SIGFPE, display_sig); | 605 | signal(SIGFPE, sighandler_dump_stack); |
| 606 | signal(SIGINT, display_sig); | 606 | signal(SIGINT, display_sig); |
| 607 | signal(SIGQUIT, display_sig); | 607 | signal(SIGQUIT, display_sig); |
| 608 | signal(SIGTERM, display_sig); | 608 | signal(SIGTERM, display_sig); |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 094ddaee104c..d31fac19c30b 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
| @@ -638,7 +638,7 @@ ifndef DESTDIR | |||
| 638 | prefix ?= $(HOME) | 638 | prefix ?= $(HOME) |
| 639 | endif | 639 | endif |
| 640 | bindir_relative = bin | 640 | bindir_relative = bin |
| 641 | bindir = $(prefix)/$(bindir_relative) | 641 | bindir = $(abspath $(prefix)/$(bindir_relative)) |
| 642 | mandir = share/man | 642 | mandir = share/man |
| 643 | infodir = share/info | 643 | infodir = share/info |
| 644 | perfexecdir = libexec/perf-core | 644 | perfexecdir = libexec/perf-core |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 7ff682770fdb..f1a4c833121e 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -1387,6 +1387,24 @@ int machine__process_fork_event(struct machine *machine, union perf_event *event | |||
| 1387 | event->fork.ptid); | 1387 | event->fork.ptid); |
| 1388 | int err = 0; | 1388 | int err = 0; |
| 1389 | 1389 | ||
| 1390 | if (dump_trace) | ||
| 1391 | perf_event__fprintf_task(event, stdout); | ||
| 1392 | |||
| 1393 | /* | ||
| 1394 | * There may be an existing thread that is not actually the parent, | ||
| 1395 | * either because we are processing events out of order, or because the | ||
| 1396 | * (fork) event that would have removed the thread was lost. Assume the | ||
| 1397 | * latter case and continue on as best we can. | ||
| 1398 | */ | ||
| 1399 | if (parent->pid_ != (pid_t)event->fork.ppid) { | ||
| 1400 | dump_printf("removing erroneous parent thread %d/%d\n", | ||
| 1401 | parent->pid_, parent->tid); | ||
| 1402 | machine__remove_thread(machine, parent); | ||
| 1403 | thread__put(parent); | ||
| 1404 | parent = machine__findnew_thread(machine, event->fork.ppid, | ||
| 1405 | event->fork.ptid); | ||
| 1406 | } | ||
| 1407 | |||
| 1390 | /* if a thread currently exists for the thread id remove it */ | 1408 | /* if a thread currently exists for the thread id remove it */ |
| 1391 | if (thread != NULL) { | 1409 | if (thread != NULL) { |
| 1392 | machine__remove_thread(machine, thread); | 1410 | machine__remove_thread(machine, thread); |
| @@ -1395,8 +1413,6 @@ int machine__process_fork_event(struct machine *machine, union perf_event *event | |||
| 1395 | 1413 | ||
| 1396 | thread = machine__findnew_thread(machine, event->fork.pid, | 1414 | thread = machine__findnew_thread(machine, event->fork.pid, |
| 1397 | event->fork.tid); | 1415 | event->fork.tid); |
| 1398 | if (dump_trace) | ||
| 1399 | perf_event__fprintf_task(event, stdout); | ||
| 1400 | 1416 | ||
| 1401 | if (thread == NULL || parent == NULL || | 1417 | if (thread == NULL || parent == NULL || |
| 1402 | thread__fork(thread, parent, sample->time) < 0) { | 1418 | thread__fork(thread, parent, sample->time) < 0) { |
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index 53e8bb7bc852..2a5d8d7698ae 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c | |||
| @@ -85,7 +85,7 @@ void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count, | |||
| 85 | else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) | 85 | else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) |
| 86 | update_stats(&runtime_cycles_stats[ctx][cpu], count[0]); | 86 | update_stats(&runtime_cycles_stats[ctx][cpu], count[0]); |
| 87 | else if (perf_stat_evsel__is(counter, CYCLES_IN_TX)) | 87 | else if (perf_stat_evsel__is(counter, CYCLES_IN_TX)) |
| 88 | update_stats(&runtime_transaction_stats[ctx][cpu], count[0]); | 88 | update_stats(&runtime_cycles_in_tx_stats[ctx][cpu], count[0]); |
| 89 | else if (perf_stat_evsel__is(counter, TRANSACTION_START)) | 89 | else if (perf_stat_evsel__is(counter, TRANSACTION_START)) |
| 90 | update_stats(&runtime_transaction_stats[ctx][cpu], count[0]); | 90 | update_stats(&runtime_transaction_stats[ctx][cpu], count[0]); |
| 91 | else if (perf_stat_evsel__is(counter, ELISION_START)) | 91 | else if (perf_stat_evsel__is(counter, ELISION_START)) |
| @@ -398,20 +398,18 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel, | |||
| 398 | " # %5.2f%% aborted cycles ", | 398 | " # %5.2f%% aborted cycles ", |
| 399 | 100.0 * ((total2-avg) / total)); | 399 | 100.0 * ((total2-avg) / total)); |
| 400 | } else if (perf_stat_evsel__is(evsel, TRANSACTION_START) && | 400 | } else if (perf_stat_evsel__is(evsel, TRANSACTION_START) && |
| 401 | avg > 0 && | ||
| 402 | runtime_cycles_in_tx_stats[ctx][cpu].n != 0) { | 401 | runtime_cycles_in_tx_stats[ctx][cpu].n != 0) { |
| 403 | total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]); | 402 | total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]); |
| 404 | 403 | ||
| 405 | if (total) | 404 | if (avg) |
| 406 | ratio = total / avg; | 405 | ratio = total / avg; |
| 407 | 406 | ||
| 408 | fprintf(out, " # %8.0f cycles / transaction ", ratio); | 407 | fprintf(out, " # %8.0f cycles / transaction ", ratio); |
| 409 | } else if (perf_stat_evsel__is(evsel, ELISION_START) && | 408 | } else if (perf_stat_evsel__is(evsel, ELISION_START) && |
| 410 | avg > 0 && | ||
| 411 | runtime_cycles_in_tx_stats[ctx][cpu].n != 0) { | 409 | runtime_cycles_in_tx_stats[ctx][cpu].n != 0) { |
| 412 | total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]); | 410 | total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]); |
| 413 | 411 | ||
| 414 | if (total) | 412 | if (avg) |
| 415 | ratio = total / avg; | 413 | ratio = total / avg; |
| 416 | 414 | ||
| 417 | fprintf(out, " # %8.0f cycles / elision ", ratio); | 415 | fprintf(out, " # %8.0f cycles / elision ", ratio); |
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 28c4b746baa1..0a9ae8014729 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
| @@ -191,6 +191,12 @@ static int thread__clone_map_groups(struct thread *thread, | |||
| 191 | if (thread->pid_ == parent->pid_) | 191 | if (thread->pid_ == parent->pid_) |
| 192 | return 0; | 192 | return 0; |
| 193 | 193 | ||
| 194 | if (thread->mg == parent->mg) { | ||
| 195 | pr_debug("broken map groups on thread %d/%d parent %d/%d\n", | ||
| 196 | thread->pid_, thread->tid, parent->pid_, parent->tid); | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | |||
| 194 | /* But this one is new process, copy maps. */ | 200 | /* But this one is new process, copy maps. */ |
| 195 | for (i = 0; i < MAP__NR_TYPES; ++i) | 201 | for (i = 0; i < MAP__NR_TYPES; ++i) |
| 196 | if (map_groups__clone(thread->mg, parent->mg, i) < 0) | 202 | if (map_groups__clone(thread->mg, parent->mg, i) < 0) |
