diff options
62 files changed, 588 insertions, 278 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 3ddbd25c2307..a410cd0850cc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -5193,7 +5193,7 @@ DRM DRIVERS FOR XEN | |||
| 5193 | M: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> | 5193 | M: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> |
| 5194 | T: git git://anongit.freedesktop.org/drm/drm-misc | 5194 | T: git git://anongit.freedesktop.org/drm/drm-misc |
| 5195 | L: dri-devel@lists.freedesktop.org | 5195 | L: dri-devel@lists.freedesktop.org |
| 5196 | L: xen-devel@lists.xen.org | 5196 | L: xen-devel@lists.xenproject.org (moderated for non-subscribers) |
| 5197 | S: Supported | 5197 | S: Supported |
| 5198 | F: drivers/gpu/drm/xen/ | 5198 | F: drivers/gpu/drm/xen/ |
| 5199 | F: Documentation/gpu/xen-front.rst | 5199 | F: Documentation/gpu/xen-front.rst |
| @@ -11319,10 +11319,12 @@ F: include/dt-bindings/ | |||
| 11319 | 11319 | ||
| 11320 | OPENCORES I2C BUS DRIVER | 11320 | OPENCORES I2C BUS DRIVER |
| 11321 | M: Peter Korsgaard <peter@korsgaard.com> | 11321 | M: Peter Korsgaard <peter@korsgaard.com> |
| 11322 | M: Andrew Lunn <andrew@lunn.ch> | ||
| 11322 | L: linux-i2c@vger.kernel.org | 11323 | L: linux-i2c@vger.kernel.org |
| 11323 | S: Maintained | 11324 | S: Maintained |
| 11324 | F: Documentation/i2c/busses/i2c-ocores | 11325 | F: Documentation/i2c/busses/i2c-ocores |
| 11325 | F: drivers/i2c/busses/i2c-ocores.c | 11326 | F: drivers/i2c/busses/i2c-ocores.c |
| 11327 | F: include/linux/platform_data/i2c-ocores.h | ||
| 11326 | 11328 | ||
| 11327 | OPENRISC ARCHITECTURE | 11329 | OPENRISC ARCHITECTURE |
| 11328 | M: Jonas Bonn <jonas@southpole.se> | 11330 | M: Jonas Bonn <jonas@southpole.se> |
| @@ -2,7 +2,7 @@ | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 0 | 3 | PATCHLEVEL = 0 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc5 | 5 | EXTRAVERSION = -rc6 |
| 6 | NAME = Shy Crocodile | 6 | NAME = Shy Crocodile |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index cb44aa290e73..e1d44b903dfc 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <linux/of_address.h> | 7 | #include <linux/of_address.h> |
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | #include <linux/dma-mapping.h> | ||
| 11 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
| 12 | #include <linux/swiotlb.h> | 11 | #include <linux/swiotlb.h> |
| 13 | 12 | ||
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c index 38049357d6d3..40712e49381b 100644 --- a/arch/m68k/emu/nfblock.c +++ b/arch/m68k/emu/nfblock.c | |||
| @@ -155,18 +155,22 @@ out: | |||
| 155 | static int __init nfhd_init(void) | 155 | static int __init nfhd_init(void) |
| 156 | { | 156 | { |
| 157 | u32 blocks, bsize; | 157 | u32 blocks, bsize; |
| 158 | int ret; | ||
| 158 | int i; | 159 | int i; |
| 159 | 160 | ||
| 160 | nfhd_id = nf_get_id("XHDI"); | 161 | nfhd_id = nf_get_id("XHDI"); |
| 161 | if (!nfhd_id) | 162 | if (!nfhd_id) |
| 162 | return -ENODEV; | 163 | return -ENODEV; |
| 163 | 164 | ||
| 164 | major_num = register_blkdev(major_num, "nfhd"); | 165 | ret = register_blkdev(major_num, "nfhd"); |
| 165 | if (major_num <= 0) { | 166 | if (ret < 0) { |
| 166 | pr_warn("nfhd: unable to get major number\n"); | 167 | pr_warn("nfhd: unable to get major number\n"); |
| 167 | return major_num; | 168 | return ret; |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 171 | if (!major_num) | ||
| 172 | major_num = ret; | ||
| 173 | |||
| 170 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { | 174 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { |
| 171 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) | 175 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) |
| 172 | continue; | 176 | continue; |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 0d14f51d0002..a84c24d894aa 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -1403,6 +1403,21 @@ config LOONGSON3_ENHANCEMENT | |||
| 1403 | please say 'N' here. If you want a high-performance kernel to run on | 1403 | please say 'N' here. If you want a high-performance kernel to run on |
| 1404 | new Loongson 3 machines only, please say 'Y' here. | 1404 | new Loongson 3 machines only, please say 'Y' here. |
| 1405 | 1405 | ||
| 1406 | config CPU_LOONGSON3_WORKAROUNDS | ||
| 1407 | bool "Old Loongson 3 LLSC Workarounds" | ||
| 1408 | default y if SMP | ||
| 1409 | depends on CPU_LOONGSON3 | ||
| 1410 | help | ||
| 1411 | Loongson 3 processors have the llsc issues which require workarounds. | ||
| 1412 | Without workarounds the system may hang unexpectedly. | ||
| 1413 | |||
| 1414 | Newer Loongson 3 will fix these issues and no workarounds are needed. | ||
| 1415 | The workarounds have no significant side effect on them but may | ||
| 1416 | decrease the performance of the system so this option should be | ||
| 1417 | disabled unless the kernel is intended to be run on old systems. | ||
| 1418 | |||
| 1419 | If unsure, please say Y. | ||
| 1420 | |||
| 1406 | config CPU_LOONGSON2E | 1421 | config CPU_LOONGSON2E |
| 1407 | bool "Loongson 2E" | 1422 | bool "Loongson 2E" |
| 1408 | depends on SYS_HAS_CPU_LOONGSON2E | 1423 | depends on SYS_HAS_CPU_LOONGSON2E |
diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts index 50cff3cbcc6d..4f7b1fa31cf5 100644 --- a/arch/mips/boot/dts/ingenic/ci20.dts +++ b/arch/mips/boot/dts/ingenic/ci20.dts | |||
| @@ -76,7 +76,7 @@ | |||
| 76 | status = "okay"; | 76 | status = "okay"; |
| 77 | 77 | ||
| 78 | pinctrl-names = "default"; | 78 | pinctrl-names = "default"; |
| 79 | pinctrl-0 = <&pins_uart2>; | 79 | pinctrl-0 = <&pins_uart3>; |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
| 82 | &uart4 { | 82 | &uart4 { |
| @@ -196,9 +196,9 @@ | |||
| 196 | bias-disable; | 196 | bias-disable; |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | pins_uart2: uart2 { | 199 | pins_uart3: uart3 { |
| 200 | function = "uart2"; | 200 | function = "uart3"; |
| 201 | groups = "uart2-data", "uart2-hwflow"; | 201 | groups = "uart3-data", "uart3-hwflow"; |
| 202 | bias-disable; | 202 | bias-disable; |
| 203 | }; | 203 | }; |
| 204 | 204 | ||
diff --git a/arch/mips/boot/dts/ingenic/jz4740.dtsi b/arch/mips/boot/dts/ingenic/jz4740.dtsi index 6fb16fd24035..2beb78a62b7d 100644 --- a/arch/mips/boot/dts/ingenic/jz4740.dtsi +++ b/arch/mips/boot/dts/ingenic/jz4740.dtsi | |||
| @@ -161,7 +161,7 @@ | |||
| 161 | #dma-cells = <2>; | 161 | #dma-cells = <2>; |
| 162 | 162 | ||
| 163 | interrupt-parent = <&intc>; | 163 | interrupt-parent = <&intc>; |
| 164 | interrupts = <29>; | 164 | interrupts = <20>; |
| 165 | 165 | ||
| 166 | clocks = <&cgu JZ4740_CLK_DMA>; | 166 | clocks = <&cgu JZ4740_CLK_DMA>; |
| 167 | 167 | ||
diff --git a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts index 2152b7ba65fb..cc8dbea0911f 100644 --- a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts +++ b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts | |||
| @@ -90,11 +90,11 @@ | |||
| 90 | interrupts = <0>; | 90 | interrupts = <0>; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | axi_i2c: i2c@10A00000 { | 93 | axi_i2c: i2c@10a00000 { |
| 94 | compatible = "xlnx,xps-iic-2.00.a"; | 94 | compatible = "xlnx,xps-iic-2.00.a"; |
| 95 | interrupt-parent = <&axi_intc>; | 95 | interrupt-parent = <&axi_intc>; |
| 96 | interrupts = <4>; | 96 | interrupts = <4>; |
| 97 | reg = < 0x10A00000 0x10000 >; | 97 | reg = < 0x10a00000 0x10000 >; |
| 98 | clocks = <&ext>; | 98 | clocks = <&ext>; |
| 99 | xlnx,clk-freq = <0x5f5e100>; | 99 | xlnx,clk-freq = <0x5f5e100>; |
| 100 | xlnx,family = "Artix7"; | 100 | xlnx,family = "Artix7"; |
| @@ -106,9 +106,9 @@ | |||
| 106 | #address-cells = <1>; | 106 | #address-cells = <1>; |
| 107 | #size-cells = <0>; | 107 | #size-cells = <0>; |
| 108 | 108 | ||
| 109 | ad7420@4B { | 109 | ad7420@4b { |
| 110 | compatible = "adi,adt7420"; | 110 | compatible = "adi,adt7420"; |
| 111 | reg = <0x4B>; | 111 | reg = <0x4b>; |
| 112 | }; | 112 | }; |
| 113 | } ; | 113 | } ; |
| 114 | }; | 114 | }; |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 43fcd35e2957..94096299fc56 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
| @@ -58,6 +58,7 @@ static __inline__ void atomic_##op(int i, atomic_t * v) \ | |||
| 58 | if (kernel_uses_llsc) { \ | 58 | if (kernel_uses_llsc) { \ |
| 59 | int temp; \ | 59 | int temp; \ |
| 60 | \ | 60 | \ |
| 61 | loongson_llsc_mb(); \ | ||
| 61 | __asm__ __volatile__( \ | 62 | __asm__ __volatile__( \ |
| 62 | " .set push \n" \ | 63 | " .set push \n" \ |
| 63 | " .set "MIPS_ISA_LEVEL" \n" \ | 64 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -85,6 +86,7 @@ static __inline__ int atomic_##op##_return_relaxed(int i, atomic_t * v) \ | |||
| 85 | if (kernel_uses_llsc) { \ | 86 | if (kernel_uses_llsc) { \ |
| 86 | int temp; \ | 87 | int temp; \ |
| 87 | \ | 88 | \ |
| 89 | loongson_llsc_mb(); \ | ||
| 88 | __asm__ __volatile__( \ | 90 | __asm__ __volatile__( \ |
| 89 | " .set push \n" \ | 91 | " .set push \n" \ |
| 90 | " .set "MIPS_ISA_LEVEL" \n" \ | 92 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -118,6 +120,7 @@ static __inline__ int atomic_fetch_##op##_relaxed(int i, atomic_t * v) \ | |||
| 118 | if (kernel_uses_llsc) { \ | 120 | if (kernel_uses_llsc) { \ |
| 119 | int temp; \ | 121 | int temp; \ |
| 120 | \ | 122 | \ |
| 123 | loongson_llsc_mb(); \ | ||
| 121 | __asm__ __volatile__( \ | 124 | __asm__ __volatile__( \ |
| 122 | " .set push \n" \ | 125 | " .set push \n" \ |
| 123 | " .set "MIPS_ISA_LEVEL" \n" \ | 126 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -256,6 +259,7 @@ static __inline__ void atomic64_##op(long i, atomic64_t * v) \ | |||
| 256 | if (kernel_uses_llsc) { \ | 259 | if (kernel_uses_llsc) { \ |
| 257 | long temp; \ | 260 | long temp; \ |
| 258 | \ | 261 | \ |
| 262 | loongson_llsc_mb(); \ | ||
| 259 | __asm__ __volatile__( \ | 263 | __asm__ __volatile__( \ |
| 260 | " .set push \n" \ | 264 | " .set push \n" \ |
| 261 | " .set "MIPS_ISA_LEVEL" \n" \ | 265 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -283,6 +287,7 @@ static __inline__ long atomic64_##op##_return_relaxed(long i, atomic64_t * v) \ | |||
| 283 | if (kernel_uses_llsc) { \ | 287 | if (kernel_uses_llsc) { \ |
| 284 | long temp; \ | 288 | long temp; \ |
| 285 | \ | 289 | \ |
| 290 | loongson_llsc_mb(); \ | ||
| 286 | __asm__ __volatile__( \ | 291 | __asm__ __volatile__( \ |
| 287 | " .set push \n" \ | 292 | " .set push \n" \ |
| 288 | " .set "MIPS_ISA_LEVEL" \n" \ | 293 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -316,6 +321,7 @@ static __inline__ long atomic64_fetch_##op##_relaxed(long i, atomic64_t * v) \ | |||
| 316 | if (kernel_uses_llsc) { \ | 321 | if (kernel_uses_llsc) { \ |
| 317 | long temp; \ | 322 | long temp; \ |
| 318 | \ | 323 | \ |
| 324 | loongson_llsc_mb(); \ | ||
| 319 | __asm__ __volatile__( \ | 325 | __asm__ __volatile__( \ |
| 320 | " .set push \n" \ | 326 | " .set push \n" \ |
| 321 | " .set "MIPS_ISA_LEVEL" \n" \ | 327 | " .set "MIPS_ISA_LEVEL" \n" \ |
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h index a5eb1bb199a7..b7f6ac5e513c 100644 --- a/arch/mips/include/asm/barrier.h +++ b/arch/mips/include/asm/barrier.h | |||
| @@ -222,6 +222,42 @@ | |||
| 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() | 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() |
| 223 | #define __smp_mb__after_atomic() smp_llsc_mb() | 223 | #define __smp_mb__after_atomic() smp_llsc_mb() |
| 224 | 224 | ||
| 225 | /* | ||
| 226 | * Some Loongson 3 CPUs have a bug wherein execution of a memory access (load, | ||
| 227 | * store or pref) in between an ll & sc can cause the sc instruction to | ||
| 228 | * erroneously succeed, breaking atomicity. Whilst it's unusual to write code | ||
| 229 | * containing such sequences, this bug bites harder than we might otherwise | ||
| 230 | * expect due to reordering & speculation: | ||
| 231 | * | ||
| 232 | * 1) A memory access appearing prior to the ll in program order may actually | ||
| 233 | * be executed after the ll - this is the reordering case. | ||
| 234 | * | ||
| 235 | * In order to avoid this we need to place a memory barrier (ie. a sync | ||
| 236 | * instruction) prior to every ll instruction, in between it & any earlier | ||
| 237 | * memory access instructions. Many of these cases are already covered by | ||
| 238 | * smp_mb__before_llsc() but for the remaining cases, typically ones in | ||
| 239 | * which multiple CPUs may operate on a memory location but ordering is not | ||
| 240 | * usually guaranteed, we use loongson_llsc_mb() below. | ||
| 241 | * | ||
| 242 | * This reordering case is fixed by 3A R2 CPUs, ie. 3A2000 models and later. | ||
| 243 | * | ||
| 244 | * 2) If a conditional branch exists between an ll & sc with a target outside | ||
| 245 | * of the ll-sc loop, for example an exit upon value mismatch in cmpxchg() | ||
| 246 | * or similar, then misprediction of the branch may allow speculative | ||
| 247 | * execution of memory accesses from outside of the ll-sc loop. | ||
| 248 | * | ||
| 249 | * In order to avoid this we need a memory barrier (ie. a sync instruction) | ||
| 250 | * at each affected branch target, for which we also use loongson_llsc_mb() | ||
| 251 | * defined below. | ||
| 252 | * | ||
| 253 | * This case affects all current Loongson 3 CPUs. | ||
| 254 | */ | ||
| 255 | #ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS /* Loongson-3's LLSC workaround */ | ||
| 256 | #define loongson_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory") | ||
| 257 | #else | ||
| 258 | #define loongson_llsc_mb() do { } while (0) | ||
| 259 | #endif | ||
| 260 | |||
| 225 | #include <asm-generic/barrier.h> | 261 | #include <asm-generic/barrier.h> |
| 226 | 262 | ||
| 227 | #endif /* __ASM_BARRIER_H */ | 263 | #endif /* __ASM_BARRIER_H */ |
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index c4675957b21b..830c93a010c3 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
| @@ -69,6 +69,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); | 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); |
| 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
| 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
| 72 | loongson_llsc_mb(); | ||
| 72 | do { | 73 | do { |
| 73 | __asm__ __volatile__( | 74 | __asm__ __volatile__( |
| 74 | " " __LL "%0, %1 # set_bit \n" | 75 | " " __LL "%0, %1 # set_bit \n" |
| @@ -79,6 +80,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 79 | } while (unlikely(!temp)); | 80 | } while (unlikely(!temp)); |
| 80 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 81 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
| 81 | } else if (kernel_uses_llsc) { | 82 | } else if (kernel_uses_llsc) { |
| 83 | loongson_llsc_mb(); | ||
| 82 | do { | 84 | do { |
| 83 | __asm__ __volatile__( | 85 | __asm__ __volatile__( |
| 84 | " .set push \n" | 86 | " .set push \n" |
| @@ -123,6 +125,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 123 | : "ir" (~(1UL << bit))); | 125 | : "ir" (~(1UL << bit))); |
| 124 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 126 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
| 125 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 127 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
| 128 | loongson_llsc_mb(); | ||
| 126 | do { | 129 | do { |
| 127 | __asm__ __volatile__( | 130 | __asm__ __volatile__( |
| 128 | " " __LL "%0, %1 # clear_bit \n" | 131 | " " __LL "%0, %1 # clear_bit \n" |
| @@ -133,6 +136,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 133 | } while (unlikely(!temp)); | 136 | } while (unlikely(!temp)); |
| 134 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 137 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
| 135 | } else if (kernel_uses_llsc) { | 138 | } else if (kernel_uses_llsc) { |
| 139 | loongson_llsc_mb(); | ||
| 136 | do { | 140 | do { |
| 137 | __asm__ __volatile__( | 141 | __asm__ __volatile__( |
| 138 | " .set push \n" | 142 | " .set push \n" |
| @@ -193,6 +197,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 193 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); | 197 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); |
| 194 | unsigned long temp; | 198 | unsigned long temp; |
| 195 | 199 | ||
| 200 | loongson_llsc_mb(); | ||
| 196 | do { | 201 | do { |
| 197 | __asm__ __volatile__( | 202 | __asm__ __volatile__( |
| 198 | " .set push \n" | 203 | " .set push \n" |
diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h index c14d798f3888..b83b0397462d 100644 --- a/arch/mips/include/asm/futex.h +++ b/arch/mips/include/asm/futex.h | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | "i" (-EFAULT) \ | 50 | "i" (-EFAULT) \ |
| 51 | : "memory"); \ | 51 | : "memory"); \ |
| 52 | } else if (cpu_has_llsc) { \ | 52 | } else if (cpu_has_llsc) { \ |
| 53 | loongson_llsc_mb(); \ | ||
| 53 | __asm__ __volatile__( \ | 54 | __asm__ __volatile__( \ |
| 54 | " .set push \n" \ | 55 | " .set push \n" \ |
| 55 | " .set noat \n" \ | 56 | " .set noat \n" \ |
| @@ -163,6 +164,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 163 | "i" (-EFAULT) | 164 | "i" (-EFAULT) |
| 164 | : "memory"); | 165 | : "memory"); |
| 165 | } else if (cpu_has_llsc) { | 166 | } else if (cpu_has_llsc) { |
| 167 | loongson_llsc_mb(); | ||
| 166 | __asm__ __volatile__( | 168 | __asm__ __volatile__( |
| 167 | "# futex_atomic_cmpxchg_inatomic \n" | 169 | "# futex_atomic_cmpxchg_inatomic \n" |
| 168 | " .set push \n" | 170 | " .set push \n" |
| @@ -192,6 +194,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 192 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), | 194 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), |
| 193 | "i" (-EFAULT) | 195 | "i" (-EFAULT) |
| 194 | : "memory"); | 196 | : "memory"); |
| 197 | loongson_llsc_mb(); | ||
| 195 | } else | 198 | } else |
| 196 | return -ENOSYS; | 199 | return -ENOSYS; |
| 197 | 200 | ||
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 57933fc8fd98..910851c62db3 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
| @@ -228,6 +228,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
| 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
| 229 | : [global] "r" (page_global)); | 229 | : [global] "r" (page_global)); |
| 230 | } else if (kernel_uses_llsc) { | 230 | } else if (kernel_uses_llsc) { |
| 231 | loongson_llsc_mb(); | ||
| 231 | __asm__ __volatile__ ( | 232 | __asm__ __volatile__ ( |
| 232 | " .set push \n" | 233 | " .set push \n" |
| 233 | " .set "MIPS_ISA_ARCH_LEVEL" \n" | 234 | " .set "MIPS_ISA_ARCH_LEVEL" \n" |
| @@ -242,6 +243,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
| 242 | " .set pop \n" | 243 | " .set pop \n" |
| 243 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 244 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
| 244 | : [global] "r" (page_global)); | 245 | : [global] "r" (page_global)); |
| 246 | loongson_llsc_mb(); | ||
| 245 | } | 247 | } |
| 246 | #else /* !CONFIG_SMP */ | 248 | #else /* !CONFIG_SMP */ |
| 247 | if (pte_none(*buddy)) | 249 | if (pte_none(*buddy)) |
diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c index 8f5bd04f320a..7f3f136572de 100644 --- a/arch/mips/kernel/mips-cm.c +++ b/arch/mips/kernel/mips-cm.c | |||
| @@ -457,5 +457,5 @@ void mips_cm_error_report(void) | |||
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | /* reprime cause register */ | 459 | /* reprime cause register */ |
| 460 | write_gcr_error_cause(0); | 460 | write_gcr_error_cause(cm_error); |
| 461 | } | 461 | } |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 6829a064aac8..339870ed92f7 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
| @@ -371,7 +371,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size) | |||
| 371 | static int get_frame_info(struct mips_frame_info *info) | 371 | static int get_frame_info(struct mips_frame_info *info) |
| 372 | { | 372 | { |
| 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); | 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); |
| 374 | union mips_instruction insn, *ip, *ip_end; | 374 | union mips_instruction insn, *ip; |
| 375 | const unsigned int max_insns = 128; | 375 | const unsigned int max_insns = 128; |
| 376 | unsigned int last_insn_size = 0; | 376 | unsigned int last_insn_size = 0; |
| 377 | unsigned int i; | 377 | unsigned int i; |
| @@ -384,10 +384,9 @@ static int get_frame_info(struct mips_frame_info *info) | |||
| 384 | if (!ip) | 384 | if (!ip) |
| 385 | goto err; | 385 | goto err; |
| 386 | 386 | ||
| 387 | ip_end = (void *)ip + info->func_size; | 387 | for (i = 0; i < max_insns; i++) { |
| 388 | |||
| 389 | for (i = 0; i < max_insns && ip < ip_end; i++) { | ||
| 390 | ip = (void *)ip + last_insn_size; | 388 | ip = (void *)ip + last_insn_size; |
| 389 | |||
| 391 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { | 390 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { |
| 392 | insn.word = ip->halfword[0] << 16; | 391 | insn.word = ip->halfword[0] << 16; |
| 393 | last_insn_size = 2; | 392 | last_insn_size = 2; |
diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform index 0fce4608aa88..c1a4d4dc4665 100644 --- a/arch/mips/loongson64/Platform +++ b/arch/mips/loongson64/Platform | |||
| @@ -23,6 +23,29 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS | |||
| 23 | endif | 23 | endif |
| 24 | 24 | ||
| 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap | 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap |
| 26 | |||
| 27 | # | ||
| 28 | # Some versions of binutils, not currently mainline as of 2019/02/04, support | ||
| 29 | # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction | ||
| 30 | # to work around a CPU bug (see loongson_llsc_mb() in asm/barrier.h for a | ||
| 31 | # description). | ||
| 32 | # | ||
| 33 | # We disable this in order to prevent the assembler meddling with the | ||
| 34 | # instruction that labels refer to, ie. if we label an ll instruction: | ||
| 35 | # | ||
| 36 | # 1: ll v0, 0(a0) | ||
| 37 | # | ||
| 38 | # ...then with the assembler fix applied the label may actually point at a sync | ||
| 39 | # instruction inserted by the assembler, and if we were using the label in an | ||
| 40 | # exception table the table would no longer contain the address of the ll | ||
| 41 | # instruction. | ||
| 42 | # | ||
| 43 | # Avoid this by explicitly disabling that assembler behaviour. If upstream | ||
| 44 | # binutils does not merge support for the flag then we can revisit & remove | ||
| 45 | # this later - for now it ensures vendor toolchains don't cause problems. | ||
| 46 | # | ||
| 47 | cflags-$(CONFIG_CPU_LOONGSON3) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) | ||
| 48 | |||
| 26 | # | 49 | # |
| 27 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a | 50 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a |
| 28 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open | 51 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open |
diff --git a/arch/mips/loongson64/common/reset.c b/arch/mips/loongson64/common/reset.c index a60715e11306..b26892ce871c 100644 --- a/arch/mips/loongson64/common/reset.c +++ b/arch/mips/loongson64/common/reset.c | |||
| @@ -59,7 +59,12 @@ static void loongson_poweroff(void) | |||
| 59 | { | 59 | { |
| 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE | 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE |
| 61 | mach_prepare_shutdown(); | 61 | mach_prepare_shutdown(); |
| 62 | unreachable(); | 62 | |
| 63 | /* | ||
| 64 | * It needs a wait loop here, but mips/kernel/reset.c already calls | ||
| 65 | * a generic delay loop, machine_hang(), so simply return. | ||
| 66 | */ | ||
| 67 | return; | ||
| 63 | #else | 68 | #else |
| 64 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; | 69 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; |
| 65 | 70 | ||
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 37b1cb246332..65b6e85447b1 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
| @@ -932,6 +932,8 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, | |||
| 932 | * to mimic that here by taking a load/istream page | 932 | * to mimic that here by taking a load/istream page |
| 933 | * fault. | 933 | * fault. |
| 934 | */ | 934 | */ |
| 935 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 936 | uasm_i_sync(p, 0); | ||
| 935 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); | 937 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); |
| 936 | uasm_i_jr(p, ptr); | 938 | uasm_i_jr(p, ptr); |
| 937 | 939 | ||
| @@ -1646,6 +1648,8 @@ static void | |||
| 1646 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) | 1648 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) |
| 1647 | { | 1649 | { |
| 1648 | #ifdef CONFIG_SMP | 1650 | #ifdef CONFIG_SMP |
| 1651 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 1652 | uasm_i_sync(p, 0); | ||
| 1649 | # ifdef CONFIG_PHYS_ADDR_T_64BIT | 1653 | # ifdef CONFIG_PHYS_ADDR_T_64BIT |
| 1650 | if (cpu_has_64bits) | 1654 | if (cpu_has_64bits) |
| 1651 | uasm_i_lld(p, pte, 0, ptr); | 1655 | uasm_i_lld(p, pte, 0, ptr); |
| @@ -2259,6 +2263,8 @@ static void build_r4000_tlb_load_handler(void) | |||
| 2259 | #endif | 2263 | #endif |
| 2260 | 2264 | ||
| 2261 | uasm_l_nopage_tlbl(&l, p); | 2265 | uasm_l_nopage_tlbl(&l, p); |
| 2266 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2267 | uasm_i_sync(&p, 0); | ||
| 2262 | build_restore_work_registers(&p); | 2268 | build_restore_work_registers(&p); |
| 2263 | #ifdef CONFIG_CPU_MICROMIPS | 2269 | #ifdef CONFIG_CPU_MICROMIPS |
| 2264 | if ((unsigned long)tlb_do_page_fault_0 & 1) { | 2270 | if ((unsigned long)tlb_do_page_fault_0 & 1) { |
| @@ -2313,6 +2319,8 @@ static void build_r4000_tlb_store_handler(void) | |||
| 2313 | #endif | 2319 | #endif |
| 2314 | 2320 | ||
| 2315 | uasm_l_nopage_tlbs(&l, p); | 2321 | uasm_l_nopage_tlbs(&l, p); |
| 2322 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2323 | uasm_i_sync(&p, 0); | ||
| 2316 | build_restore_work_registers(&p); | 2324 | build_restore_work_registers(&p); |
| 2317 | #ifdef CONFIG_CPU_MICROMIPS | 2325 | #ifdef CONFIG_CPU_MICROMIPS |
| 2318 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2326 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
| @@ -2368,6 +2376,8 @@ static void build_r4000_tlb_modify_handler(void) | |||
| 2368 | #endif | 2376 | #endif |
| 2369 | 2377 | ||
| 2370 | uasm_l_nopage_tlbm(&l, p); | 2378 | uasm_l_nopage_tlbm(&l, p); |
| 2379 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2380 | uasm_i_sync(&p, 0); | ||
| 2371 | build_restore_work_registers(&p); | 2381 | build_restore_work_registers(&p); |
| 2372 | #ifdef CONFIG_CPU_MICROMIPS | 2382 | #ifdef CONFIG_CPU_MICROMIPS |
| 2373 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2383 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c index 5017d5843c5a..fc29b85cfa92 100644 --- a/arch/mips/pci/pci-octeon.c +++ b/arch/mips/pci/pci-octeon.c | |||
| @@ -568,6 +568,11 @@ static int __init octeon_pci_setup(void) | |||
| 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) | 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) |
| 569 | return 0; | 569 | return 0; |
| 570 | 570 | ||
| 571 | if (!octeon_is_pci_host()) { | ||
| 572 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
| 573 | return 0; | ||
| 574 | } | ||
| 575 | |||
| 571 | /* Point pcibios_map_irq() to the PCI version of it */ | 576 | /* Point pcibios_map_irq() to the PCI version of it */ |
| 572 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; | 577 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; |
| 573 | 578 | ||
| @@ -579,11 +584,6 @@ static int __init octeon_pci_setup(void) | |||
| 579 | else | 584 | else |
| 580 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; | 585 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; |
| 581 | 586 | ||
| 582 | if (!octeon_is_pci_host()) { | ||
| 583 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
| 584 | return 0; | ||
| 585 | } | ||
| 586 | |||
| 587 | /* PCI I/O and PCI MEM values */ | 587 | /* PCI I/O and PCI MEM values */ |
| 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); | 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); |
| 589 | ioport_resource.start = 0; | 589 | ioport_resource.start = 0; |
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index f6fd340e39c2..0ede4deb8181 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile | |||
| @@ -8,6 +8,7 @@ ccflags-vdso := \ | |||
| 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ | 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ |
| 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ | 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ |
| 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ | 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ |
| 11 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ | ||
| 11 | -D__VDSO__ | 12 | -D__VDSO__ |
| 12 | 13 | ||
| 13 | ifdef CONFIG_CC_IS_CLANG | 14 | ifdef CONFIG_CC_IS_CLANG |
| @@ -129,7 +130,7 @@ $(obj)/%-o32.o: $(src)/%.c FORCE | |||
| 129 | $(call cmd,force_checksrc) | 130 | $(call cmd,force_checksrc) |
| 130 | $(call if_changed_rule,cc_o_c) | 131 | $(call if_changed_rule,cc_o_c) |
| 131 | 132 | ||
| 132 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32 | 133 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32 |
| 133 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE | 134 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE |
| 134 | $(call if_changed_dep,cpp_lds_S) | 135 | $(call if_changed_dep,cpp_lds_S) |
| 135 | 136 | ||
| @@ -169,7 +170,7 @@ $(obj)/%-n32.o: $(src)/%.c FORCE | |||
| 169 | $(call cmd,force_checksrc) | 170 | $(call cmd,force_checksrc) |
| 170 | $(call if_changed_rule,cc_o_c) | 171 | $(call if_changed_rule,cc_o_c) |
| 171 | 172 | ||
| 172 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32 | 173 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32 |
| 173 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE | 174 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE |
| 174 | $(call if_changed_dep,cpp_lds_S) | 175 | $(call if_changed_dep,cpp_lds_S) |
| 175 | 176 | ||
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index f105ae8651c9..f62e347862cc 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
| @@ -602,10 +602,12 @@ ENTRY(trampoline_32bit_src) | |||
| 602 | 3: | 602 | 3: |
| 603 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ | 603 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ |
| 604 | pushl %ecx | 604 | pushl %ecx |
| 605 | pushl %edx | ||
| 605 | movl $MSR_EFER, %ecx | 606 | movl $MSR_EFER, %ecx |
| 606 | rdmsr | 607 | rdmsr |
| 607 | btsl $_EFER_LME, %eax | 608 | btsl $_EFER_LME, %eax |
| 608 | wrmsr | 609 | wrmsr |
| 610 | popl %edx | ||
| 609 | popl %ecx | 611 | popl %ecx |
| 610 | 612 | ||
| 611 | /* Enable PAE and LA57 (if required) paging modes */ | 613 | /* Enable PAE and LA57 (if required) paging modes */ |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 40e12cfc87f6..daafb893449b 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
| @@ -3559,6 +3559,14 @@ static void free_excl_cntrs(int cpu) | |||
| 3559 | 3559 | ||
| 3560 | static void intel_pmu_cpu_dying(int cpu) | 3560 | static void intel_pmu_cpu_dying(int cpu) |
| 3561 | { | 3561 | { |
| 3562 | fini_debug_store_on_cpu(cpu); | ||
| 3563 | |||
| 3564 | if (x86_pmu.counter_freezing) | ||
| 3565 | disable_counter_freeze(); | ||
| 3566 | } | ||
| 3567 | |||
| 3568 | static void intel_pmu_cpu_dead(int cpu) | ||
| 3569 | { | ||
| 3562 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); | 3570 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
| 3563 | struct intel_shared_regs *pc; | 3571 | struct intel_shared_regs *pc; |
| 3564 | 3572 | ||
| @@ -3570,11 +3578,6 @@ static void intel_pmu_cpu_dying(int cpu) | |||
| 3570 | } | 3578 | } |
| 3571 | 3579 | ||
| 3572 | free_excl_cntrs(cpu); | 3580 | free_excl_cntrs(cpu); |
| 3573 | |||
| 3574 | fini_debug_store_on_cpu(cpu); | ||
| 3575 | |||
| 3576 | if (x86_pmu.counter_freezing) | ||
| 3577 | disable_counter_freeze(); | ||
| 3578 | } | 3581 | } |
| 3579 | 3582 | ||
| 3580 | static void intel_pmu_sched_task(struct perf_event_context *ctx, | 3583 | static void intel_pmu_sched_task(struct perf_event_context *ctx, |
| @@ -3663,6 +3666,7 @@ static __initconst const struct x86_pmu core_pmu = { | |||
| 3663 | .cpu_prepare = intel_pmu_cpu_prepare, | 3666 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3664 | .cpu_starting = intel_pmu_cpu_starting, | 3667 | .cpu_starting = intel_pmu_cpu_starting, |
| 3665 | .cpu_dying = intel_pmu_cpu_dying, | 3668 | .cpu_dying = intel_pmu_cpu_dying, |
| 3669 | .cpu_dead = intel_pmu_cpu_dead, | ||
| 3666 | }; | 3670 | }; |
| 3667 | 3671 | ||
| 3668 | static struct attribute *intel_pmu_attrs[]; | 3672 | static struct attribute *intel_pmu_attrs[]; |
| @@ -3703,6 +3707,8 @@ static __initconst const struct x86_pmu intel_pmu = { | |||
| 3703 | .cpu_prepare = intel_pmu_cpu_prepare, | 3707 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3704 | .cpu_starting = intel_pmu_cpu_starting, | 3708 | .cpu_starting = intel_pmu_cpu_starting, |
| 3705 | .cpu_dying = intel_pmu_cpu_dying, | 3709 | .cpu_dying = intel_pmu_cpu_dying, |
| 3710 | .cpu_dead = intel_pmu_cpu_dead, | ||
| 3711 | |||
| 3706 | .guest_get_msrs = intel_guest_get_msrs, | 3712 | .guest_get_msrs = intel_guest_get_msrs, |
| 3707 | .sched_task = intel_pmu_sched_task, | 3713 | .sched_task = intel_pmu_sched_task, |
| 3708 | }; | 3714 | }; |
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index c07bee31abe8..b10e04387f38 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c | |||
| @@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = { | |||
| 1222 | .id_table = snbep_uncore_pci_ids, | 1222 | .id_table = snbep_uncore_pci_ids, |
| 1223 | }; | 1223 | }; |
| 1224 | 1224 | ||
| 1225 | #define NODE_ID_MASK 0x7 | ||
| 1226 | |||
| 1225 | /* | 1227 | /* |
| 1226 | * build pci bus to socket mapping | 1228 | * build pci bus to socket mapping |
| 1227 | */ | 1229 | */ |
| @@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool | |||
| 1243 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); | 1245 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); |
| 1244 | if (err) | 1246 | if (err) |
| 1245 | break; | 1247 | break; |
| 1246 | nodeid = config; | 1248 | nodeid = config & NODE_ID_MASK; |
| 1247 | /* get the Node ID mapping */ | 1249 | /* get the Node ID mapping */ |
| 1248 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); | 1250 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); |
| 1249 | if (err) | 1251 | if (err) |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 40616e805292..2779ace16d23 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
| @@ -1065,7 +1065,7 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
| 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
| 1066 | pmd_t *pmdp, pmd_t pmd) | 1066 | pmd_t *pmdp, pmd_t pmd) |
| 1067 | { | 1067 | { |
| 1068 | native_set_pmd(pmdp, pmd); | 1068 | set_pmd(pmdp, pmd); |
| 1069 | } | 1069 | } |
| 1070 | 1070 | ||
| 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, | 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, |
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 672c7225cb1b..6ce290c506d9 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c | |||
| @@ -784,6 +784,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | |||
| 784 | quirk_no_way_out(i, m, regs); | 784 | quirk_no_way_out(i, m, regs); |
| 785 | 785 | ||
| 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { | 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
| 787 | m->bank = i; | ||
| 787 | mce_read_aux(m, i); | 788 | mce_read_aux(m, i); |
| 788 | *msg = tmp; | 789 | *msg = tmp; |
| 789 | return 1; | 790 | return 1; |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 4f8972311a77..14e6119838a6 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
| @@ -230,6 +230,29 @@ static bool __cpa_pfn_in_highmap(unsigned long pfn) | |||
| 230 | 230 | ||
| 231 | #endif | 231 | #endif |
| 232 | 232 | ||
| 233 | /* | ||
| 234 | * See set_mce_nospec(). | ||
| 235 | * | ||
| 236 | * Machine check recovery code needs to change cache mode of poisoned pages to | ||
| 237 | * UC to avoid speculative access logging another error. But passing the | ||
| 238 | * address of the 1:1 mapping to set_memory_uc() is a fine way to encourage a | ||
| 239 | * speculative access. So we cheat and flip the top bit of the address. This | ||
| 240 | * works fine for the code that updates the page tables. But at the end of the | ||
| 241 | * process we need to flush the TLB and cache and the non-canonical address | ||
| 242 | * causes a #GP fault when used by the INVLPG and CLFLUSH instructions. | ||
| 243 | * | ||
| 244 | * But in the common case we already have a canonical address. This code | ||
| 245 | * will fix the top bit if needed and is a no-op otherwise. | ||
| 246 | */ | ||
| 247 | static inline unsigned long fix_addr(unsigned long addr) | ||
| 248 | { | ||
| 249 | #ifdef CONFIG_X86_64 | ||
| 250 | return (long)(addr << 1) >> 1; | ||
| 251 | #else | ||
| 252 | return addr; | ||
| 253 | #endif | ||
| 254 | } | ||
| 255 | |||
| 233 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) | 256 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) |
| 234 | { | 257 | { |
| 235 | if (cpa->flags & CPA_PAGES_ARRAY) { | 258 | if (cpa->flags & CPA_PAGES_ARRAY) { |
| @@ -313,7 +336,7 @@ void __cpa_flush_tlb(void *data) | |||
| 313 | unsigned int i; | 336 | unsigned int i; |
| 314 | 337 | ||
| 315 | for (i = 0; i < cpa->numpages; i++) | 338 | for (i = 0; i < cpa->numpages; i++) |
| 316 | __flush_tlb_one_kernel(__cpa_addr(cpa, i)); | 339 | __flush_tlb_one_kernel(fix_addr(__cpa_addr(cpa, i))); |
| 317 | } | 340 | } |
| 318 | 341 | ||
| 319 | static void cpa_flush(struct cpa_data *data, int cache) | 342 | static void cpa_flush(struct cpa_data *data, int cache) |
| @@ -347,7 +370,7 @@ static void cpa_flush(struct cpa_data *data, int cache) | |||
| 347 | * Only flush present addresses: | 370 | * Only flush present addresses: |
| 348 | */ | 371 | */ |
| 349 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) | 372 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) |
| 350 | clflush_cache_range_opt((void *)addr, PAGE_SIZE); | 373 | clflush_cache_range_opt((void *)fix_addr(addr), PAGE_SIZE); |
| 351 | } | 374 | } |
| 352 | mb(); | 375 | mb(); |
| 353 | } | 376 | } |
| @@ -1627,29 +1650,6 @@ out: | |||
| 1627 | return ret; | 1650 | return ret; |
| 1628 | } | 1651 | } |
| 1629 | 1652 | ||
| 1630 | /* | ||
| 1631 | * Machine check recovery code needs to change cache mode of poisoned | ||
| 1632 | * pages to UC to avoid speculative access logging another error. But | ||
| 1633 | * passing the address of the 1:1 mapping to set_memory_uc() is a fine | ||
| 1634 | * way to encourage a speculative access. So we cheat and flip the top | ||
| 1635 | * bit of the address. This works fine for the code that updates the | ||
| 1636 | * page tables. But at the end of the process we need to flush the cache | ||
| 1637 | * and the non-canonical address causes a #GP fault when used by the | ||
| 1638 | * CLFLUSH instruction. | ||
| 1639 | * | ||
| 1640 | * But in the common case we already have a canonical address. This code | ||
| 1641 | * will fix the top bit if needed and is a no-op otherwise. | ||
| 1642 | */ | ||
| 1643 | static inline unsigned long make_addr_canonical_again(unsigned long addr) | ||
| 1644 | { | ||
| 1645 | #ifdef CONFIG_X86_64 | ||
| 1646 | return (long)(addr << 1) >> 1; | ||
| 1647 | #else | ||
| 1648 | return addr; | ||
| 1649 | #endif | ||
| 1650 | } | ||
| 1651 | |||
| 1652 | |||
| 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, | 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, |
| 1654 | pgprot_t mask_set, pgprot_t mask_clr, | 1654 | pgprot_t mask_set, pgprot_t mask_clr, |
| 1655 | int force_split, int in_flag, | 1655 | int force_split, int in_flag, |
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index fc714ef402a6..2620baa1f699 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c | |||
| @@ -72,6 +72,7 @@ | |||
| 72 | #include <linux/sched/loadavg.h> | 72 | #include <linux/sched/loadavg.h> |
| 73 | #include <linux/sched/signal.h> | 73 | #include <linux/sched/signal.h> |
| 74 | #include <trace/events/block.h> | 74 | #include <trace/events/block.h> |
| 75 | #include <linux/blk-mq.h> | ||
| 75 | #include "blk-rq-qos.h" | 76 | #include "blk-rq-qos.h" |
| 76 | #include "blk-stat.h" | 77 | #include "blk-stat.h" |
| 77 | 78 | ||
| @@ -591,6 +592,7 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) | |||
| 591 | u64 now = ktime_to_ns(ktime_get()); | 592 | u64 now = ktime_to_ns(ktime_get()); |
| 592 | bool issue_as_root = bio_issue_as_root_blkg(bio); | 593 | bool issue_as_root = bio_issue_as_root_blkg(bio); |
| 593 | bool enabled = false; | 594 | bool enabled = false; |
| 595 | int inflight = 0; | ||
| 594 | 596 | ||
| 595 | blkg = bio->bi_blkg; | 597 | blkg = bio->bi_blkg; |
| 596 | if (!blkg || !bio_flagged(bio, BIO_TRACKED)) | 598 | if (!blkg || !bio_flagged(bio, BIO_TRACKED)) |
| @@ -601,6 +603,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) | |||
| 601 | return; | 603 | return; |
| 602 | 604 | ||
| 603 | enabled = blk_iolatency_enabled(iolat->blkiolat); | 605 | enabled = blk_iolatency_enabled(iolat->blkiolat); |
| 606 | if (!enabled) | ||
| 607 | return; | ||
| 608 | |||
| 604 | while (blkg && blkg->parent) { | 609 | while (blkg && blkg->parent) { |
| 605 | iolat = blkg_to_lat(blkg); | 610 | iolat = blkg_to_lat(blkg); |
| 606 | if (!iolat) { | 611 | if (!iolat) { |
| @@ -609,8 +614,9 @@ static void blkcg_iolatency_done_bio(struct rq_qos *rqos, struct bio *bio) | |||
| 609 | } | 614 | } |
| 610 | rqw = &iolat->rq_wait; | 615 | rqw = &iolat->rq_wait; |
| 611 | 616 | ||
| 612 | atomic_dec(&rqw->inflight); | 617 | inflight = atomic_dec_return(&rqw->inflight); |
| 613 | if (!enabled || iolat->min_lat_nsec == 0) | 618 | WARN_ON_ONCE(inflight < 0); |
| 619 | if (iolat->min_lat_nsec == 0) | ||
| 614 | goto next; | 620 | goto next; |
| 615 | iolatency_record_time(iolat, &bio->bi_issue, now, | 621 | iolatency_record_time(iolat, &bio->bi_issue, now, |
| 616 | issue_as_root); | 622 | issue_as_root); |
| @@ -754,10 +760,13 @@ int blk_iolatency_init(struct request_queue *q) | |||
| 754 | return 0; | 760 | return 0; |
| 755 | } | 761 | } |
| 756 | 762 | ||
| 757 | static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | 763 | /* |
| 764 | * return 1 for enabling iolatency, return -1 for disabling iolatency, otherwise | ||
| 765 | * return 0. | ||
| 766 | */ | ||
| 767 | static int iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | ||
| 758 | { | 768 | { |
| 759 | struct iolatency_grp *iolat = blkg_to_lat(blkg); | 769 | struct iolatency_grp *iolat = blkg_to_lat(blkg); |
| 760 | struct blk_iolatency *blkiolat = iolat->blkiolat; | ||
| 761 | u64 oldval = iolat->min_lat_nsec; | 770 | u64 oldval = iolat->min_lat_nsec; |
| 762 | 771 | ||
| 763 | iolat->min_lat_nsec = val; | 772 | iolat->min_lat_nsec = val; |
| @@ -766,9 +775,10 @@ static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) | |||
| 766 | BLKIOLATENCY_MAX_WIN_SIZE); | 775 | BLKIOLATENCY_MAX_WIN_SIZE); |
| 767 | 776 | ||
| 768 | if (!oldval && val) | 777 | if (!oldval && val) |
| 769 | atomic_inc(&blkiolat->enabled); | 778 | return 1; |
| 770 | if (oldval && !val) | 779 | if (oldval && !val) |
| 771 | atomic_dec(&blkiolat->enabled); | 780 | return -1; |
| 781 | return 0; | ||
| 772 | } | 782 | } |
| 773 | 783 | ||
| 774 | static void iolatency_clear_scaling(struct blkcg_gq *blkg) | 784 | static void iolatency_clear_scaling(struct blkcg_gq *blkg) |
| @@ -800,6 +810,7 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, | |||
| 800 | u64 lat_val = 0; | 810 | u64 lat_val = 0; |
| 801 | u64 oldval; | 811 | u64 oldval; |
| 802 | int ret; | 812 | int ret; |
| 813 | int enable = 0; | ||
| 803 | 814 | ||
| 804 | ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); | 815 | ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx); |
| 805 | if (ret) | 816 | if (ret) |
| @@ -834,7 +845,12 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, | |||
| 834 | blkg = ctx.blkg; | 845 | blkg = ctx.blkg; |
| 835 | oldval = iolat->min_lat_nsec; | 846 | oldval = iolat->min_lat_nsec; |
| 836 | 847 | ||
| 837 | iolatency_set_min_lat_nsec(blkg, lat_val); | 848 | enable = iolatency_set_min_lat_nsec(blkg, lat_val); |
| 849 | if (enable) { | ||
| 850 | WARN_ON_ONCE(!blk_get_queue(blkg->q)); | ||
| 851 | blkg_get(blkg); | ||
| 852 | } | ||
| 853 | |||
| 838 | if (oldval != iolat->min_lat_nsec) { | 854 | if (oldval != iolat->min_lat_nsec) { |
| 839 | iolatency_clear_scaling(blkg); | 855 | iolatency_clear_scaling(blkg); |
| 840 | } | 856 | } |
| @@ -842,6 +858,24 @@ static ssize_t iolatency_set_limit(struct kernfs_open_file *of, char *buf, | |||
| 842 | ret = 0; | 858 | ret = 0; |
| 843 | out: | 859 | out: |
| 844 | blkg_conf_finish(&ctx); | 860 | blkg_conf_finish(&ctx); |
| 861 | if (ret == 0 && enable) { | ||
| 862 | struct iolatency_grp *tmp = blkg_to_lat(blkg); | ||
| 863 | struct blk_iolatency *blkiolat = tmp->blkiolat; | ||
| 864 | |||
| 865 | blk_mq_freeze_queue(blkg->q); | ||
| 866 | |||
| 867 | if (enable == 1) | ||
| 868 | atomic_inc(&blkiolat->enabled); | ||
| 869 | else if (enable == -1) | ||
| 870 | atomic_dec(&blkiolat->enabled); | ||
| 871 | else | ||
| 872 | WARN_ON_ONCE(1); | ||
| 873 | |||
| 874 | blk_mq_unfreeze_queue(blkg->q); | ||
| 875 | |||
| 876 | blkg_put(blkg); | ||
| 877 | blk_put_queue(blkg->q); | ||
| 878 | } | ||
| 845 | return ret ?: nbytes; | 879 | return ret ?: nbytes; |
| 846 | } | 880 | } |
| 847 | 881 | ||
| @@ -977,8 +1011,14 @@ static void iolatency_pd_offline(struct blkg_policy_data *pd) | |||
| 977 | { | 1011 | { |
| 978 | struct iolatency_grp *iolat = pd_to_lat(pd); | 1012 | struct iolatency_grp *iolat = pd_to_lat(pd); |
| 979 | struct blkcg_gq *blkg = lat_to_blkg(iolat); | 1013 | struct blkcg_gq *blkg = lat_to_blkg(iolat); |
| 1014 | struct blk_iolatency *blkiolat = iolat->blkiolat; | ||
| 1015 | int ret; | ||
| 980 | 1016 | ||
| 981 | iolatency_set_min_lat_nsec(blkg, 0); | 1017 | ret = iolatency_set_min_lat_nsec(blkg, 0); |
| 1018 | if (ret == 1) | ||
| 1019 | atomic_inc(&blkiolat->enabled); | ||
| 1020 | if (ret == -1) | ||
| 1021 | atomic_dec(&blkiolat->enabled); | ||
| 982 | iolatency_clear_scaling(blkg); | 1022 | iolatency_clear_scaling(blkg); |
| 983 | } | 1023 | } |
| 984 | 1024 | ||
diff --git a/block/blk-mq.h b/block/blk-mq.h index d943d46b0785..d0b3dd54ef8d 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h | |||
| @@ -36,7 +36,6 @@ struct blk_mq_ctx { | |||
| 36 | struct kobject kobj; | 36 | struct kobject kobj; |
| 37 | } ____cacheline_aligned_in_smp; | 37 | } ____cacheline_aligned_in_smp; |
| 38 | 38 | ||
| 39 | void blk_mq_freeze_queue(struct request_queue *q); | ||
| 40 | void blk_mq_free_queue(struct request_queue *q); | 39 | void blk_mq_free_queue(struct request_queue *q); |
| 41 | int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); | 40 | int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr); |
| 42 | void blk_mq_wake_waiters(struct request_queue *q); | 41 | void blk_mq_wake_waiters(struct request_queue *q); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index b8c3f9e6af89..adf28788cab5 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4554,6 +4554,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, | 4554 | { "SAMSUNG MZMPC128HBFU-000MV", "CXM14M1Q", ATA_HORKAGE_NOLPM, }, |
| 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, | 4555 | { "SAMSUNG SSD PM830 mSATA *", "CXM13D1Q", ATA_HORKAGE_NOLPM, }, |
| 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, | 4556 | { "SAMSUNG MZ7TD256HAFV-000L9", NULL, ATA_HORKAGE_NOLPM, }, |
| 4557 | { "SAMSUNG MZ7TE512HMHP-000L1", "EXT06L0Q", ATA_HORKAGE_NOLPM, }, | ||
| 4557 | 4558 | ||
| 4558 | /* devices that don't properly handle queued TRIM commands */ | 4559 | /* devices that don't properly handle queued TRIM commands */ |
| 4559 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | | 4560 | { "Micron_M500IT_*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | |
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index 4e557684f792..fe69dccfa0c0 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c | |||
| @@ -203,6 +203,7 @@ struct at_xdmac_chan { | |||
| 203 | u32 save_cim; | 203 | u32 save_cim; |
| 204 | u32 save_cnda; | 204 | u32 save_cnda; |
| 205 | u32 save_cndc; | 205 | u32 save_cndc; |
| 206 | u32 irq_status; | ||
| 206 | unsigned long status; | 207 | unsigned long status; |
| 207 | struct tasklet_struct tasklet; | 208 | struct tasklet_struct tasklet; |
| 208 | struct dma_slave_config sconfig; | 209 | struct dma_slave_config sconfig; |
| @@ -1580,8 +1581,8 @@ static void at_xdmac_tasklet(unsigned long data) | |||
| 1580 | struct at_xdmac_desc *desc; | 1581 | struct at_xdmac_desc *desc; |
| 1581 | u32 error_mask; | 1582 | u32 error_mask; |
| 1582 | 1583 | ||
| 1583 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08lx\n", | 1584 | dev_dbg(chan2dev(&atchan->chan), "%s: status=0x%08x\n", |
| 1584 | __func__, atchan->status); | 1585 | __func__, atchan->irq_status); |
| 1585 | 1586 | ||
| 1586 | error_mask = AT_XDMAC_CIS_RBEIS | 1587 | error_mask = AT_XDMAC_CIS_RBEIS |
| 1587 | | AT_XDMAC_CIS_WBEIS | 1588 | | AT_XDMAC_CIS_WBEIS |
| @@ -1589,15 +1590,15 @@ static void at_xdmac_tasklet(unsigned long data) | |||
| 1589 | 1590 | ||
| 1590 | if (at_xdmac_chan_is_cyclic(atchan)) { | 1591 | if (at_xdmac_chan_is_cyclic(atchan)) { |
| 1591 | at_xdmac_handle_cyclic(atchan); | 1592 | at_xdmac_handle_cyclic(atchan); |
| 1592 | } else if ((atchan->status & AT_XDMAC_CIS_LIS) | 1593 | } else if ((atchan->irq_status & AT_XDMAC_CIS_LIS) |
| 1593 | || (atchan->status & error_mask)) { | 1594 | || (atchan->irq_status & error_mask)) { |
| 1594 | struct dma_async_tx_descriptor *txd; | 1595 | struct dma_async_tx_descriptor *txd; |
| 1595 | 1596 | ||
| 1596 | if (atchan->status & AT_XDMAC_CIS_RBEIS) | 1597 | if (atchan->irq_status & AT_XDMAC_CIS_RBEIS) |
| 1597 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); | 1598 | dev_err(chan2dev(&atchan->chan), "read bus error!!!"); |
| 1598 | if (atchan->status & AT_XDMAC_CIS_WBEIS) | 1599 | if (atchan->irq_status & AT_XDMAC_CIS_WBEIS) |
| 1599 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); | 1600 | dev_err(chan2dev(&atchan->chan), "write bus error!!!"); |
| 1600 | if (atchan->status & AT_XDMAC_CIS_ROIS) | 1601 | if (atchan->irq_status & AT_XDMAC_CIS_ROIS) |
| 1601 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); | 1602 | dev_err(chan2dev(&atchan->chan), "request overflow error!!!"); |
| 1602 | 1603 | ||
| 1603 | spin_lock(&atchan->lock); | 1604 | spin_lock(&atchan->lock); |
| @@ -1652,7 +1653,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) | |||
| 1652 | atchan = &atxdmac->chan[i]; | 1653 | atchan = &atxdmac->chan[i]; |
| 1653 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); | 1654 | chan_imr = at_xdmac_chan_read(atchan, AT_XDMAC_CIM); |
| 1654 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); | 1655 | chan_status = at_xdmac_chan_read(atchan, AT_XDMAC_CIS); |
| 1655 | atchan->status = chan_status & chan_imr; | 1656 | atchan->irq_status = chan_status & chan_imr; |
| 1656 | dev_vdbg(atxdmac->dma.dev, | 1657 | dev_vdbg(atxdmac->dma.dev, |
| 1657 | "%s: chan%d: imr=0x%x, status=0x%x\n", | 1658 | "%s: chan%d: imr=0x%x, status=0x%x\n", |
| 1658 | __func__, i, chan_imr, chan_status); | 1659 | __func__, i, chan_imr, chan_status); |
| @@ -1666,7 +1667,7 @@ static irqreturn_t at_xdmac_interrupt(int irq, void *dev_id) | |||
| 1666 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), | 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CDA), |
| 1667 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); | 1668 | at_xdmac_chan_read(atchan, AT_XDMAC_CUBC)); |
| 1668 | 1669 | ||
| 1669 | if (atchan->status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) | 1670 | if (atchan->irq_status & (AT_XDMAC_CIS_RBEIS | AT_XDMAC_CIS_WBEIS)) |
| 1670 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); | 1671 | at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask); |
| 1671 | 1672 | ||
| 1672 | tasklet_schedule(&atchan->tasklet); | 1673 | tasklet_schedule(&atchan->tasklet); |
diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 1a44c8086d77..ae10f5614f95 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c | |||
| @@ -406,38 +406,32 @@ static void bcm2835_dma_fill_cb_chain_with_sg( | |||
| 406 | } | 406 | } |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | static int bcm2835_dma_abort(void __iomem *chan_base) | 409 | static int bcm2835_dma_abort(struct bcm2835_chan *c) |
| 410 | { | 410 | { |
| 411 | unsigned long cs; | 411 | void __iomem *chan_base = c->chan_base; |
| 412 | long int timeout = 10000; | 412 | long int timeout = 10000; |
| 413 | 413 | ||
| 414 | cs = readl(chan_base + BCM2835_DMA_CS); | 414 | /* |
| 415 | if (!(cs & BCM2835_DMA_ACTIVE)) | 415 | * A zero control block address means the channel is idle. |
| 416 | * (The ACTIVE flag in the CS register is not a reliable indicator.) | ||
| 417 | */ | ||
| 418 | if (!readl(chan_base + BCM2835_DMA_ADDR)) | ||
| 416 | return 0; | 419 | return 0; |
| 417 | 420 | ||
| 418 | /* Write 0 to the active bit - Pause the DMA */ | 421 | /* Write 0 to the active bit - Pause the DMA */ |
| 419 | writel(0, chan_base + BCM2835_DMA_CS); | 422 | writel(0, chan_base + BCM2835_DMA_CS); |
| 420 | 423 | ||
| 421 | /* Wait for any current AXI transfer to complete */ | 424 | /* Wait for any current AXI transfer to complete */ |
| 422 | while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) { | 425 | while ((readl(chan_base + BCM2835_DMA_CS) & |
| 426 | BCM2835_DMA_WAITING_FOR_WRITES) && --timeout) | ||
| 423 | cpu_relax(); | 427 | cpu_relax(); |
| 424 | cs = readl(chan_base + BCM2835_DMA_CS); | ||
| 425 | } | ||
| 426 | 428 | ||
| 427 | /* We'll un-pause when we set of our next DMA */ | 429 | /* Peripheral might be stuck and fail to signal AXI write responses */ |
| 428 | if (!timeout) | 430 | if (!timeout) |
| 429 | return -ETIMEDOUT; | 431 | dev_err(c->vc.chan.device->dev, |
| 430 | 432 | "failed to complete outstanding writes\n"); | |
| 431 | if (!(cs & BCM2835_DMA_ACTIVE)) | ||
| 432 | return 0; | ||
| 433 | |||
| 434 | /* Terminate the control block chain */ | ||
| 435 | writel(0, chan_base + BCM2835_DMA_NEXTCB); | ||
| 436 | |||
| 437 | /* Abort the whole DMA */ | ||
| 438 | writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE, | ||
| 439 | chan_base + BCM2835_DMA_CS); | ||
| 440 | 433 | ||
| 434 | writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS); | ||
| 441 | return 0; | 435 | return 0; |
| 442 | } | 436 | } |
| 443 | 437 | ||
| @@ -476,8 +470,15 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) | |||
| 476 | 470 | ||
| 477 | spin_lock_irqsave(&c->vc.lock, flags); | 471 | spin_lock_irqsave(&c->vc.lock, flags); |
| 478 | 472 | ||
| 479 | /* Acknowledge interrupt */ | 473 | /* |
| 480 | writel(BCM2835_DMA_INT, c->chan_base + BCM2835_DMA_CS); | 474 | * Clear the INT flag to receive further interrupts. Keep the channel |
| 475 | * active in case the descriptor is cyclic or in case the client has | ||
| 476 | * already terminated the descriptor and issued a new one. (May happen | ||
| 477 | * if this IRQ handler is threaded.) If the channel is finished, it | ||
| 478 | * will remain idle despite the ACTIVE flag being set. | ||
| 479 | */ | ||
| 480 | writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE, | ||
| 481 | c->chan_base + BCM2835_DMA_CS); | ||
| 481 | 482 | ||
| 482 | d = c->desc; | 483 | d = c->desc; |
| 483 | 484 | ||
| @@ -485,11 +486,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) | |||
| 485 | if (d->cyclic) { | 486 | if (d->cyclic) { |
| 486 | /* call the cyclic callback */ | 487 | /* call the cyclic callback */ |
| 487 | vchan_cyclic_callback(&d->vd); | 488 | vchan_cyclic_callback(&d->vd); |
| 488 | 489 | } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) { | |
| 489 | /* Keep the DMA engine running */ | ||
| 490 | writel(BCM2835_DMA_ACTIVE, | ||
| 491 | c->chan_base + BCM2835_DMA_CS); | ||
| 492 | } else { | ||
| 493 | vchan_cookie_complete(&c->desc->vd); | 490 | vchan_cookie_complete(&c->desc->vd); |
| 494 | bcm2835_dma_start_desc(c); | 491 | bcm2835_dma_start_desc(c); |
| 495 | } | 492 | } |
| @@ -779,7 +776,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) | |||
| 779 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); | 776 | struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); |
| 780 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); | 777 | struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device); |
| 781 | unsigned long flags; | 778 | unsigned long flags; |
| 782 | int timeout = 10000; | ||
| 783 | LIST_HEAD(head); | 779 | LIST_HEAD(head); |
| 784 | 780 | ||
| 785 | spin_lock_irqsave(&c->vc.lock, flags); | 781 | spin_lock_irqsave(&c->vc.lock, flags); |
| @@ -789,27 +785,11 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) | |||
| 789 | list_del_init(&c->node); | 785 | list_del_init(&c->node); |
| 790 | spin_unlock(&d->lock); | 786 | spin_unlock(&d->lock); |
| 791 | 787 | ||
| 792 | /* | 788 | /* stop DMA activity */ |
| 793 | * Stop DMA activity: we assume the callback will not be called | ||
| 794 | * after bcm_dma_abort() returns (even if it does, it will see | ||
| 795 | * c->desc is NULL and exit.) | ||
| 796 | */ | ||
| 797 | if (c->desc) { | 789 | if (c->desc) { |
| 798 | vchan_terminate_vdesc(&c->desc->vd); | 790 | vchan_terminate_vdesc(&c->desc->vd); |
| 799 | c->desc = NULL; | 791 | c->desc = NULL; |
| 800 | bcm2835_dma_abort(c->chan_base); | 792 | bcm2835_dma_abort(c); |
| 801 | |||
| 802 | /* Wait for stopping */ | ||
| 803 | while (--timeout) { | ||
| 804 | if (!(readl(c->chan_base + BCM2835_DMA_CS) & | ||
| 805 | BCM2835_DMA_ACTIVE)) | ||
| 806 | break; | ||
| 807 | |||
| 808 | cpu_relax(); | ||
| 809 | } | ||
| 810 | |||
| 811 | if (!timeout) | ||
| 812 | dev_err(d->ddev.dev, "DMA transfer could not be terminated\n"); | ||
| 813 | } | 793 | } |
| 814 | 794 | ||
| 815 | vchan_get_all_descriptors(&c->vc, &head); | 795 | vchan_get_all_descriptors(&c->vc, &head); |
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c index 2eea4ef72915..6511928b4cdf 100644 --- a/drivers/dma/dmatest.c +++ b/drivers/dma/dmatest.c | |||
| @@ -711,11 +711,9 @@ static int dmatest_func(void *data) | |||
| 711 | srcs[i] = um->addr[i] + src_off; | 711 | srcs[i] = um->addr[i] + src_off; |
| 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); | 712 | ret = dma_mapping_error(dev->dev, um->addr[i]); |
| 713 | if (ret) { | 713 | if (ret) { |
| 714 | dmaengine_unmap_put(um); | ||
| 715 | result("src mapping error", total_tests, | 714 | result("src mapping error", total_tests, |
| 716 | src_off, dst_off, len, ret); | 715 | src_off, dst_off, len, ret); |
| 717 | failed_tests++; | 716 | goto error_unmap_continue; |
| 718 | continue; | ||
| 719 | } | 717 | } |
| 720 | um->to_cnt++; | 718 | um->to_cnt++; |
| 721 | } | 719 | } |
| @@ -730,11 +728,9 @@ static int dmatest_func(void *data) | |||
| 730 | DMA_BIDIRECTIONAL); | 728 | DMA_BIDIRECTIONAL); |
| 731 | ret = dma_mapping_error(dev->dev, dsts[i]); | 729 | ret = dma_mapping_error(dev->dev, dsts[i]); |
| 732 | if (ret) { | 730 | if (ret) { |
| 733 | dmaengine_unmap_put(um); | ||
| 734 | result("dst mapping error", total_tests, | 731 | result("dst mapping error", total_tests, |
| 735 | src_off, dst_off, len, ret); | 732 | src_off, dst_off, len, ret); |
| 736 | failed_tests++; | 733 | goto error_unmap_continue; |
| 737 | continue; | ||
| 738 | } | 734 | } |
| 739 | um->bidi_cnt++; | 735 | um->bidi_cnt++; |
| 740 | } | 736 | } |
| @@ -762,12 +758,10 @@ static int dmatest_func(void *data) | |||
| 762 | } | 758 | } |
| 763 | 759 | ||
| 764 | if (!tx) { | 760 | if (!tx) { |
| 765 | dmaengine_unmap_put(um); | ||
| 766 | result("prep error", total_tests, src_off, | 761 | result("prep error", total_tests, src_off, |
| 767 | dst_off, len, ret); | 762 | dst_off, len, ret); |
| 768 | msleep(100); | 763 | msleep(100); |
| 769 | failed_tests++; | 764 | goto error_unmap_continue; |
| 770 | continue; | ||
| 771 | } | 765 | } |
| 772 | 766 | ||
| 773 | done->done = false; | 767 | done->done = false; |
| @@ -776,12 +770,10 @@ static int dmatest_func(void *data) | |||
| 776 | cookie = tx->tx_submit(tx); | 770 | cookie = tx->tx_submit(tx); |
| 777 | 771 | ||
| 778 | if (dma_submit_error(cookie)) { | 772 | if (dma_submit_error(cookie)) { |
| 779 | dmaengine_unmap_put(um); | ||
| 780 | result("submit error", total_tests, src_off, | 773 | result("submit error", total_tests, src_off, |
| 781 | dst_off, len, ret); | 774 | dst_off, len, ret); |
| 782 | msleep(100); | 775 | msleep(100); |
| 783 | failed_tests++; | 776 | goto error_unmap_continue; |
| 784 | continue; | ||
| 785 | } | 777 | } |
| 786 | dma_async_issue_pending(chan); | 778 | dma_async_issue_pending(chan); |
| 787 | 779 | ||
| @@ -790,22 +782,20 @@ static int dmatest_func(void *data) | |||
| 790 | 782 | ||
| 791 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); | 783 | status = dma_async_is_tx_complete(chan, cookie, NULL, NULL); |
| 792 | 784 | ||
| 793 | dmaengine_unmap_put(um); | ||
| 794 | |||
| 795 | if (!done->done) { | 785 | if (!done->done) { |
| 796 | result("test timed out", total_tests, src_off, dst_off, | 786 | result("test timed out", total_tests, src_off, dst_off, |
| 797 | len, 0); | 787 | len, 0); |
| 798 | failed_tests++; | 788 | goto error_unmap_continue; |
| 799 | continue; | ||
| 800 | } else if (status != DMA_COMPLETE) { | 789 | } else if (status != DMA_COMPLETE) { |
| 801 | result(status == DMA_ERROR ? | 790 | result(status == DMA_ERROR ? |
| 802 | "completion error status" : | 791 | "completion error status" : |
| 803 | "completion busy status", total_tests, src_off, | 792 | "completion busy status", total_tests, src_off, |
| 804 | dst_off, len, ret); | 793 | dst_off, len, ret); |
| 805 | failed_tests++; | 794 | goto error_unmap_continue; |
| 806 | continue; | ||
| 807 | } | 795 | } |
| 808 | 796 | ||
| 797 | dmaengine_unmap_put(um); | ||
| 798 | |||
| 809 | if (params->noverify) { | 799 | if (params->noverify) { |
| 810 | verbose_result("test passed", total_tests, src_off, | 800 | verbose_result("test passed", total_tests, src_off, |
| 811 | dst_off, len, 0); | 801 | dst_off, len, 0); |
| @@ -846,6 +836,12 @@ static int dmatest_func(void *data) | |||
| 846 | verbose_result("test passed", total_tests, src_off, | 836 | verbose_result("test passed", total_tests, src_off, |
| 847 | dst_off, len, 0); | 837 | dst_off, len, 0); |
| 848 | } | 838 | } |
| 839 | |||
| 840 | continue; | ||
| 841 | |||
| 842 | error_unmap_continue: | ||
| 843 | dmaengine_unmap_put(um); | ||
| 844 | failed_tests++; | ||
| 849 | } | 845 | } |
| 850 | ktime = ktime_sub(ktime_get(), ktime); | 846 | ktime = ktime_sub(ktime_get(), ktime); |
| 851 | ktime = ktime_sub(ktime, comparetime); | 847 | ktime = ktime_sub(ktime, comparetime); |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index c2fff3f6c9ca..4a09af3cd546 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
| @@ -618,7 +618,7 @@ static void imxdma_tasklet(unsigned long data) | |||
| 618 | { | 618 | { |
| 619 | struct imxdma_channel *imxdmac = (void *)data; | 619 | struct imxdma_channel *imxdmac = (void *)data; |
| 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; | 620 | struct imxdma_engine *imxdma = imxdmac->imxdma; |
| 621 | struct imxdma_desc *desc; | 621 | struct imxdma_desc *desc, *next_desc; |
| 622 | unsigned long flags; | 622 | unsigned long flags; |
| 623 | 623 | ||
| 624 | spin_lock_irqsave(&imxdma->lock, flags); | 624 | spin_lock_irqsave(&imxdma->lock, flags); |
| @@ -648,10 +648,10 @@ static void imxdma_tasklet(unsigned long data) | |||
| 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); | 648 | list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free); |
| 649 | 649 | ||
| 650 | if (!list_empty(&imxdmac->ld_queue)) { | 650 | if (!list_empty(&imxdmac->ld_queue)) { |
| 651 | desc = list_first_entry(&imxdmac->ld_queue, struct imxdma_desc, | 651 | next_desc = list_first_entry(&imxdmac->ld_queue, |
| 652 | node); | 652 | struct imxdma_desc, node); |
| 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); | 653 | list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active); |
| 654 | if (imxdma_xfer_desc(desc) < 0) | 654 | if (imxdma_xfer_desc(next_desc) < 0) |
| 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", | 655 | dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n", |
| 656 | __func__, imxdmac->channel); | 656 | __func__, imxdmac->channel); |
| 657 | } | 657 | } |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b1086bfb0465..cd9c65f3d404 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
| @@ -1500,8 +1500,7 @@ static int omap_i2c_remove(struct platform_device *pdev) | |||
| 1500 | return 0; | 1500 | return 0; |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
| 1503 | #ifdef CONFIG_PM | 1503 | static int __maybe_unused omap_i2c_runtime_suspend(struct device *dev) |
| 1504 | static int omap_i2c_runtime_suspend(struct device *dev) | ||
| 1505 | { | 1504 | { |
| 1506 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1505 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
| 1507 | 1506 | ||
| @@ -1527,7 +1526,7 @@ static int omap_i2c_runtime_suspend(struct device *dev) | |||
| 1527 | return 0; | 1526 | return 0; |
| 1528 | } | 1527 | } |
| 1529 | 1528 | ||
| 1530 | static int omap_i2c_runtime_resume(struct device *dev) | 1529 | static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) |
| 1531 | { | 1530 | { |
| 1532 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); | 1531 | struct omap_i2c_dev *omap = dev_get_drvdata(dev); |
| 1533 | 1532 | ||
| @@ -1542,20 +1541,18 @@ static int omap_i2c_runtime_resume(struct device *dev) | |||
| 1542 | } | 1541 | } |
| 1543 | 1542 | ||
| 1544 | static const struct dev_pm_ops omap_i2c_pm_ops = { | 1543 | static const struct dev_pm_ops omap_i2c_pm_ops = { |
| 1544 | SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, | ||
| 1545 | pm_runtime_force_resume) | ||
| 1545 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, | 1546 | SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, |
| 1546 | omap_i2c_runtime_resume, NULL) | 1547 | omap_i2c_runtime_resume, NULL) |
| 1547 | }; | 1548 | }; |
| 1548 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
| 1549 | #else | ||
| 1550 | #define OMAP_I2C_PM_OPS NULL | ||
| 1551 | #endif /* CONFIG_PM */ | ||
| 1552 | 1549 | ||
| 1553 | static struct platform_driver omap_i2c_driver = { | 1550 | static struct platform_driver omap_i2c_driver = { |
| 1554 | .probe = omap_i2c_probe, | 1551 | .probe = omap_i2c_probe, |
| 1555 | .remove = omap_i2c_remove, | 1552 | .remove = omap_i2c_remove, |
| 1556 | .driver = { | 1553 | .driver = { |
| 1557 | .name = "omap_i2c", | 1554 | .name = "omap_i2c", |
| 1558 | .pm = OMAP_I2C_PM_OPS, | 1555 | .pm = &omap_i2c_pm_ops, |
| 1559 | .of_match_table = of_match_ptr(omap_i2c_of_match), | 1556 | .of_match_table = of_match_ptr(omap_i2c_of_match), |
| 1560 | }, | 1557 | }, |
| 1561 | }; | 1558 | }; |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 7f2a45445b00..c3aba3fc818d 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
| @@ -97,9 +97,14 @@ struct its_device; | |||
| 97 | * The ITS structure - contains most of the infrastructure, with the | 97 | * The ITS structure - contains most of the infrastructure, with the |
| 98 | * top-level MSI domain, the command queue, the collections, and the | 98 | * top-level MSI domain, the command queue, the collections, and the |
| 99 | * list of devices writing to it. | 99 | * list of devices writing to it. |
| 100 | * | ||
| 101 | * dev_alloc_lock has to be taken for device allocations, while the | ||
| 102 | * spinlock must be taken to parse data structures such as the device | ||
| 103 | * list. | ||
| 100 | */ | 104 | */ |
| 101 | struct its_node { | 105 | struct its_node { |
| 102 | raw_spinlock_t lock; | 106 | raw_spinlock_t lock; |
| 107 | struct mutex dev_alloc_lock; | ||
| 103 | struct list_head entry; | 108 | struct list_head entry; |
| 104 | void __iomem *base; | 109 | void __iomem *base; |
| 105 | phys_addr_t phys_base; | 110 | phys_addr_t phys_base; |
| @@ -156,6 +161,7 @@ struct its_device { | |||
| 156 | void *itt; | 161 | void *itt; |
| 157 | u32 nr_ites; | 162 | u32 nr_ites; |
| 158 | u32 device_id; | 163 | u32 device_id; |
| 164 | bool shared; | ||
| 159 | }; | 165 | }; |
| 160 | 166 | ||
| 161 | static struct { | 167 | static struct { |
| @@ -1580,6 +1586,9 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) | |||
| 1580 | nr_irqs /= 2; | 1586 | nr_irqs /= 2; |
| 1581 | } while (nr_irqs > 0); | 1587 | } while (nr_irqs > 0); |
| 1582 | 1588 | ||
| 1589 | if (!nr_irqs) | ||
| 1590 | err = -ENOSPC; | ||
| 1591 | |||
| 1583 | if (err) | 1592 | if (err) |
| 1584 | goto out; | 1593 | goto out; |
| 1585 | 1594 | ||
| @@ -2059,6 +2068,29 @@ static int __init allocate_lpi_tables(void) | |||
| 2059 | return 0; | 2068 | return 0; |
| 2060 | } | 2069 | } |
| 2061 | 2070 | ||
| 2071 | static u64 its_clear_vpend_valid(void __iomem *vlpi_base) | ||
| 2072 | { | ||
| 2073 | u32 count = 1000000; /* 1s! */ | ||
| 2074 | bool clean; | ||
| 2075 | u64 val; | ||
| 2076 | |||
| 2077 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2078 | val &= ~GICR_VPENDBASER_Valid; | ||
| 2079 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
| 2080 | |||
| 2081 | do { | ||
| 2082 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2083 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
| 2084 | if (!clean) { | ||
| 2085 | count--; | ||
| 2086 | cpu_relax(); | ||
| 2087 | udelay(1); | ||
| 2088 | } | ||
| 2089 | } while (!clean && count); | ||
| 2090 | |||
| 2091 | return val; | ||
| 2092 | } | ||
| 2093 | |||
| 2062 | static void its_cpu_init_lpis(void) | 2094 | static void its_cpu_init_lpis(void) |
| 2063 | { | 2095 | { |
| 2064 | void __iomem *rbase = gic_data_rdist_rd_base(); | 2096 | void __iomem *rbase = gic_data_rdist_rd_base(); |
| @@ -2144,6 +2176,30 @@ static void its_cpu_init_lpis(void) | |||
| 2144 | val |= GICR_CTLR_ENABLE_LPIS; | 2176 | val |= GICR_CTLR_ENABLE_LPIS; |
| 2145 | writel_relaxed(val, rbase + GICR_CTLR); | 2177 | writel_relaxed(val, rbase + GICR_CTLR); |
| 2146 | 2178 | ||
| 2179 | if (gic_rdists->has_vlpis) { | ||
| 2180 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | ||
| 2181 | |||
| 2182 | /* | ||
| 2183 | * It's possible for CPU to receive VLPIs before it is | ||
| 2184 | * sheduled as a vPE, especially for the first CPU, and the | ||
| 2185 | * VLPI with INTID larger than 2^(IDbits+1) will be considered | ||
| 2186 | * as out of range and dropped by GIC. | ||
| 2187 | * So we initialize IDbits to known value to avoid VLPI drop. | ||
| 2188 | */ | ||
| 2189 | val = (LPI_NRBITS - 1) & GICR_VPROPBASER_IDBITS_MASK; | ||
| 2190 | pr_debug("GICv4: CPU%d: Init IDbits to 0x%llx for GICR_VPROPBASER\n", | ||
| 2191 | smp_processor_id(), val); | ||
| 2192 | gits_write_vpropbaser(val, vlpi_base + GICR_VPROPBASER); | ||
| 2193 | |||
| 2194 | /* | ||
| 2195 | * Also clear Valid bit of GICR_VPENDBASER, in case some | ||
| 2196 | * ancient programming gets left in and has possibility of | ||
| 2197 | * corrupting memory. | ||
| 2198 | */ | ||
| 2199 | val = its_clear_vpend_valid(vlpi_base); | ||
| 2200 | WARN_ON(val & GICR_VPENDBASER_Dirty); | ||
| 2201 | } | ||
| 2202 | |||
| 2147 | /* Make sure the GIC has seen the above */ | 2203 | /* Make sure the GIC has seen the above */ |
| 2148 | dsb(sy); | 2204 | dsb(sy); |
| 2149 | out: | 2205 | out: |
| @@ -2422,6 +2478,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
| 2422 | struct its_device *its_dev; | 2478 | struct its_device *its_dev; |
| 2423 | struct msi_domain_info *msi_info; | 2479 | struct msi_domain_info *msi_info; |
| 2424 | u32 dev_id; | 2480 | u32 dev_id; |
| 2481 | int err = 0; | ||
| 2425 | 2482 | ||
| 2426 | /* | 2483 | /* |
| 2427 | * We ignore "dev" entierely, and rely on the dev_id that has | 2484 | * We ignore "dev" entierely, and rely on the dev_id that has |
| @@ -2444,6 +2501,7 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
| 2444 | return -EINVAL; | 2501 | return -EINVAL; |
| 2445 | } | 2502 | } |
| 2446 | 2503 | ||
| 2504 | mutex_lock(&its->dev_alloc_lock); | ||
| 2447 | its_dev = its_find_device(its, dev_id); | 2505 | its_dev = its_find_device(its, dev_id); |
| 2448 | if (its_dev) { | 2506 | if (its_dev) { |
| 2449 | /* | 2507 | /* |
| @@ -2451,18 +2509,22 @@ static int its_msi_prepare(struct irq_domain *domain, struct device *dev, | |||
| 2451 | * another alias (PCI bridge of some sort). No need to | 2509 | * another alias (PCI bridge of some sort). No need to |
| 2452 | * create the device. | 2510 | * create the device. |
| 2453 | */ | 2511 | */ |
| 2512 | its_dev->shared = true; | ||
| 2454 | pr_debug("Reusing ITT for devID %x\n", dev_id); | 2513 | pr_debug("Reusing ITT for devID %x\n", dev_id); |
| 2455 | goto out; | 2514 | goto out; |
| 2456 | } | 2515 | } |
| 2457 | 2516 | ||
| 2458 | its_dev = its_create_device(its, dev_id, nvec, true); | 2517 | its_dev = its_create_device(its, dev_id, nvec, true); |
| 2459 | if (!its_dev) | 2518 | if (!its_dev) { |
| 2460 | return -ENOMEM; | 2519 | err = -ENOMEM; |
| 2520 | goto out; | ||
| 2521 | } | ||
| 2461 | 2522 | ||
| 2462 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); | 2523 | pr_debug("ITT %d entries, %d bits\n", nvec, ilog2(nvec)); |
| 2463 | out: | 2524 | out: |
| 2525 | mutex_unlock(&its->dev_alloc_lock); | ||
| 2464 | info->scratchpad[0].ptr = its_dev; | 2526 | info->scratchpad[0].ptr = its_dev; |
| 2465 | return 0; | 2527 | return err; |
| 2466 | } | 2528 | } |
| 2467 | 2529 | ||
| 2468 | static struct msi_domain_ops its_msi_domain_ops = { | 2530 | static struct msi_domain_ops its_msi_domain_ops = { |
| @@ -2566,6 +2628,7 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
| 2566 | { | 2628 | { |
| 2567 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); | 2629 | struct irq_data *d = irq_domain_get_irq_data(domain, virq); |
| 2568 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); | 2630 | struct its_device *its_dev = irq_data_get_irq_chip_data(d); |
| 2631 | struct its_node *its = its_dev->its; | ||
| 2569 | int i; | 2632 | int i; |
| 2570 | 2633 | ||
| 2571 | for (i = 0; i < nr_irqs; i++) { | 2634 | for (i = 0; i < nr_irqs; i++) { |
| @@ -2580,8 +2643,14 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
| 2580 | irq_domain_reset_irq_data(data); | 2643 | irq_domain_reset_irq_data(data); |
| 2581 | } | 2644 | } |
| 2582 | 2645 | ||
| 2583 | /* If all interrupts have been freed, start mopping the floor */ | 2646 | mutex_lock(&its->dev_alloc_lock); |
| 2584 | if (bitmap_empty(its_dev->event_map.lpi_map, | 2647 | |
| 2648 | /* | ||
| 2649 | * If all interrupts have been freed, start mopping the | ||
| 2650 | * floor. This is conditionned on the device not being shared. | ||
| 2651 | */ | ||
| 2652 | if (!its_dev->shared && | ||
| 2653 | bitmap_empty(its_dev->event_map.lpi_map, | ||
| 2585 | its_dev->event_map.nr_lpis)) { | 2654 | its_dev->event_map.nr_lpis)) { |
| 2586 | its_lpi_free(its_dev->event_map.lpi_map, | 2655 | its_lpi_free(its_dev->event_map.lpi_map, |
| 2587 | its_dev->event_map.lpi_base, | 2656 | its_dev->event_map.lpi_base, |
| @@ -2593,6 +2662,8 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq, | |||
| 2593 | its_free_device(its_dev); | 2662 | its_free_device(its_dev); |
| 2594 | } | 2663 | } |
| 2595 | 2664 | ||
| 2665 | mutex_unlock(&its->dev_alloc_lock); | ||
| 2666 | |||
| 2596 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); | 2667 | irq_domain_free_irqs_parent(domain, virq, nr_irqs); |
| 2597 | } | 2668 | } |
| 2598 | 2669 | ||
| @@ -2755,26 +2826,11 @@ static void its_vpe_schedule(struct its_vpe *vpe) | |||
| 2755 | static void its_vpe_deschedule(struct its_vpe *vpe) | 2826 | static void its_vpe_deschedule(struct its_vpe *vpe) |
| 2756 | { | 2827 | { |
| 2757 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); | 2828 | void __iomem *vlpi_base = gic_data_rdist_vlpi_base(); |
| 2758 | u32 count = 1000000; /* 1s! */ | ||
| 2759 | bool clean; | ||
| 2760 | u64 val; | 2829 | u64 val; |
| 2761 | 2830 | ||
| 2762 | /* We're being scheduled out */ | 2831 | val = its_clear_vpend_valid(vlpi_base); |
| 2763 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2764 | val &= ~GICR_VPENDBASER_Valid; | ||
| 2765 | gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER); | ||
| 2766 | |||
| 2767 | do { | ||
| 2768 | val = gits_read_vpendbaser(vlpi_base + GICR_VPENDBASER); | ||
| 2769 | clean = !(val & GICR_VPENDBASER_Dirty); | ||
| 2770 | if (!clean) { | ||
| 2771 | count--; | ||
| 2772 | cpu_relax(); | ||
| 2773 | udelay(1); | ||
| 2774 | } | ||
| 2775 | } while (!clean && count); | ||
| 2776 | 2832 | ||
| 2777 | if (unlikely(!clean && !count)) { | 2833 | if (unlikely(val & GICR_VPENDBASER_Dirty)) { |
| 2778 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); | 2834 | pr_err_ratelimited("ITS virtual pending table not cleaning\n"); |
| 2779 | vpe->idai = false; | 2835 | vpe->idai = false; |
| 2780 | vpe->pending_last = true; | 2836 | vpe->pending_last = true; |
| @@ -3517,6 +3573,7 @@ static int __init its_probe_one(struct resource *res, | |||
| 3517 | } | 3573 | } |
| 3518 | 3574 | ||
| 3519 | raw_spin_lock_init(&its->lock); | 3575 | raw_spin_lock_init(&its->lock); |
| 3576 | mutex_init(&its->dev_alloc_lock); | ||
| 3520 | INIT_LIST_HEAD(&its->entry); | 3577 | INIT_LIST_HEAD(&its->entry); |
| 3521 | INIT_LIST_HEAD(&its->its_device_list); | 3578 | INIT_LIST_HEAD(&its->its_device_list); |
| 3522 | typer = gic_read_typer(its_base + GITS_TYPER); | 3579 | typer = gic_read_typer(its_base + GITS_TYPER); |
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c index 25f32e1d7764..3496b61a312a 100644 --- a/drivers/irqchip/irq-mmp.c +++ b/drivers/irqchip/irq-mmp.c | |||
| @@ -34,6 +34,9 @@ | |||
| 34 | #define SEL_INT_PENDING (1 << 6) | 34 | #define SEL_INT_PENDING (1 << 6) |
| 35 | #define SEL_INT_NUM_MASK 0x3f | 35 | #define SEL_INT_NUM_MASK 0x3f |
| 36 | 36 | ||
| 37 | #define MMP2_ICU_INT_ROUTE_PJ4_IRQ (1 << 5) | ||
| 38 | #define MMP2_ICU_INT_ROUTE_PJ4_FIQ (1 << 6) | ||
| 39 | |||
| 37 | struct icu_chip_data { | 40 | struct icu_chip_data { |
| 38 | int nr_irqs; | 41 | int nr_irqs; |
| 39 | unsigned int virq_base; | 42 | unsigned int virq_base; |
| @@ -190,7 +193,8 @@ static const struct mmp_intc_conf mmp_conf = { | |||
| 190 | static const struct mmp_intc_conf mmp2_conf = { | 193 | static const struct mmp_intc_conf mmp2_conf = { |
| 191 | .conf_enable = 0x20, | 194 | .conf_enable = 0x20, |
| 192 | .conf_disable = 0x0, | 195 | .conf_disable = 0x0, |
| 193 | .conf_mask = 0x7f, | 196 | .conf_mask = MMP2_ICU_INT_ROUTE_PJ4_IRQ | |
| 197 | MMP2_ICU_INT_ROUTE_PJ4_FIQ, | ||
| 194 | }; | 198 | }; |
| 195 | 199 | ||
| 196 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) | 200 | static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs) |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 60104e1079c5..37f174ccbcec 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
| @@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent, | |||
| 480 | /* let's register it anyway to preserve ordering */ | 480 | /* let's register it anyway to preserve ordering */ |
| 481 | slave->offset = 0; | 481 | slave->offset = 0; |
| 482 | slave->mtd.size = 0; | 482 | slave->mtd.size = 0; |
| 483 | |||
| 484 | /* Initialize ->erasesize to make add_mtd_device() happy. */ | ||
| 485 | slave->mtd.erasesize = parent->erasesize; | ||
| 486 | |||
| 483 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", | 487 | printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", |
| 484 | part->name); | 488 | part->name); |
| 485 | goto out_register; | 489 | goto out_register; |
| @@ -632,7 +636,6 @@ err_remove_part: | |||
| 632 | mutex_unlock(&mtd_partitions_mutex); | 636 | mutex_unlock(&mtd_partitions_mutex); |
| 633 | 637 | ||
| 634 | free_partition(new); | 638 | free_partition(new); |
| 635 | pr_info("%s:%i\n", __func__, __LINE__); | ||
| 636 | 639 | ||
| 637 | return ret; | 640 | return ret; |
| 638 | } | 641 | } |
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c index bd4cfac6b5aa..a4768df5083f 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c | |||
| @@ -155,9 +155,10 @@ int gpmi_init(struct gpmi_nand_data *this) | |||
| 155 | 155 | ||
| 156 | /* | 156 | /* |
| 157 | * Reset BCH here, too. We got failures otherwise :( | 157 | * Reset BCH here, too. We got failures otherwise :( |
| 158 | * See later BCH reset for explanation of MX23 handling | 158 | * See later BCH reset for explanation of MX23 and MX28 handling |
| 159 | */ | 159 | */ |
| 160 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 160 | ret = gpmi_reset_block(r->bch_regs, |
| 161 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
| 161 | if (ret) | 162 | if (ret) |
| 162 | goto err_out; | 163 | goto err_out; |
| 163 | 164 | ||
| @@ -263,12 +264,10 @@ int bch_set_geometry(struct gpmi_nand_data *this) | |||
| 263 | /* | 264 | /* |
| 264 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this | 265 | * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this |
| 265 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. | 266 | * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. |
| 266 | * On the other hand, the MX28 needs the reset, because one case has been | 267 | * and MX28. |
| 267 | * seen where the BCH produced ECC errors constantly after 10000 | ||
| 268 | * consecutive reboots. The latter case has not been seen on the MX23 | ||
| 269 | * yet, still we don't know if it could happen there as well. | ||
| 270 | */ | 268 | */ |
| 271 | ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | 269 | ret = gpmi_reset_block(r->bch_regs, |
| 270 | GPMI_IS_MX23(this) || GPMI_IS_MX28(this)); | ||
| 272 | if (ret) | 271 | if (ret) |
| 273 | goto err_out; | 272 | goto err_out; |
| 274 | 273 | ||
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index cca4b24d2ffa..839494ac457c 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c | |||
| @@ -410,6 +410,7 @@ static int nand_check_wp(struct nand_chip *chip) | |||
| 410 | 410 | ||
| 411 | /** | 411 | /** |
| 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob | 412 | * nand_fill_oob - [INTERN] Transfer client buffer to oob |
| 413 | * @chip: NAND chip object | ||
| 413 | * @oob: oob data buffer | 414 | * @oob: oob data buffer |
| 414 | * @len: oob data write length | 415 | * @len: oob data write length |
| 415 | * @ops: oob ops structure | 416 | * @ops: oob ops structure |
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c index 1b722fe9213c..19a2b563acdf 100644 --- a/drivers/mtd/nand/raw/nand_bbt.c +++ b/drivers/mtd/nand/raw/nand_bbt.c | |||
| @@ -158,7 +158,7 @@ static u32 add_marker_len(struct nand_bbt_descr *td) | |||
| 158 | 158 | ||
| 159 | /** | 159 | /** |
| 160 | * read_bbt - [GENERIC] Read the bad block table starting from page | 160 | * read_bbt - [GENERIC] Read the bad block table starting from page |
| 161 | * @chip: NAND chip object | 161 | * @this: NAND chip object |
| 162 | * @buf: temporary buffer | 162 | * @buf: temporary buffer |
| 163 | * @page: the starting page | 163 | * @page: the starting page |
| 164 | * @num: the number of bbt descriptors to read | 164 | * @num: the number of bbt descriptors to read |
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 479c2f2cf17f..fa87ae28cdfe 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c | |||
| @@ -304,24 +304,30 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 304 | struct nand_device *nand = spinand_to_nand(spinand); | 304 | struct nand_device *nand = spinand_to_nand(spinand); |
| 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); | 305 | struct mtd_info *mtd = nanddev_to_mtd(nand); |
| 306 | struct nand_page_io_req adjreq = *req; | 306 | struct nand_page_io_req adjreq = *req; |
| 307 | unsigned int nbytes = 0; | 307 | void *buf = spinand->databuf; |
| 308 | void *buf = NULL; | 308 | unsigned int nbytes; |
| 309 | u16 column = 0; | 309 | u16 column = 0; |
| 310 | int ret; | 310 | int ret; |
| 311 | 311 | ||
| 312 | memset(spinand->databuf, 0xff, | 312 | /* |
| 313 | nanddev_page_size(nand) + | 313 | * Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset |
| 314 | nanddev_per_page_oobsize(nand)); | 314 | * the cache content to 0xFF (depends on vendor implementation), so we |
| 315 | * must fill the page cache entirely even if we only want to program | ||
| 316 | * the data portion of the page, otherwise we might corrupt the BBM or | ||
| 317 | * user data previously programmed in OOB area. | ||
| 318 | */ | ||
| 319 | nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand); | ||
| 320 | memset(spinand->databuf, 0xff, nbytes); | ||
| 321 | adjreq.dataoffs = 0; | ||
| 322 | adjreq.datalen = nanddev_page_size(nand); | ||
| 323 | adjreq.databuf.out = spinand->databuf; | ||
| 324 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
| 325 | adjreq.ooboffs = 0; | ||
| 326 | adjreq.oobbuf.out = spinand->oobbuf; | ||
| 315 | 327 | ||
| 316 | if (req->datalen) { | 328 | if (req->datalen) |
| 317 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, | 329 | memcpy(spinand->databuf + req->dataoffs, req->databuf.out, |
| 318 | req->datalen); | 330 | req->datalen); |
| 319 | adjreq.dataoffs = 0; | ||
| 320 | adjreq.datalen = nanddev_page_size(nand); | ||
| 321 | adjreq.databuf.out = spinand->databuf; | ||
| 322 | nbytes = adjreq.datalen; | ||
| 323 | buf = spinand->databuf; | ||
| 324 | } | ||
| 325 | 331 | ||
| 326 | if (req->ooblen) { | 332 | if (req->ooblen) { |
| 327 | if (req->mode == MTD_OPS_AUTO_OOB) | 333 | if (req->mode == MTD_OPS_AUTO_OOB) |
| @@ -332,14 +338,6 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 332 | else | 338 | else |
| 333 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, | 339 | memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, |
| 334 | req->ooblen); | 340 | req->ooblen); |
| 335 | |||
| 336 | adjreq.ooblen = nanddev_per_page_oobsize(nand); | ||
| 337 | adjreq.ooboffs = 0; | ||
| 338 | nbytes += nanddev_per_page_oobsize(nand); | ||
| 339 | if (!buf) { | ||
| 340 | buf = spinand->oobbuf; | ||
| 341 | column = nanddev_page_size(nand); | ||
| 342 | } | ||
| 343 | } | 341 | } |
| 344 | 342 | ||
| 345 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); | 343 | spinand_cache_op_adjust_colum(spinand, &adjreq, &column); |
| @@ -370,8 +368,8 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 370 | 368 | ||
| 371 | /* | 369 | /* |
| 372 | * We need to use the RANDOM LOAD CACHE operation if there's | 370 | * We need to use the RANDOM LOAD CACHE operation if there's |
| 373 | * more than one iteration, because the LOAD operation resets | 371 | * more than one iteration, because the LOAD operation might |
| 374 | * the cache to 0xff. | 372 | * reset the cache to 0xff. |
| 375 | */ | 373 | */ |
| 376 | if (nbytes) { | 374 | if (nbytes) { |
| 377 | column = op.addr.val; | 375 | column = op.addr.val; |
| @@ -1018,11 +1016,11 @@ static int spinand_init(struct spinand_device *spinand) | |||
| 1018 | for (i = 0; i < nand->memorg.ntargets; i++) { | 1016 | for (i = 0; i < nand->memorg.ntargets; i++) { |
| 1019 | ret = spinand_select_target(spinand, i); | 1017 | ret = spinand_select_target(spinand, i); |
| 1020 | if (ret) | 1018 | if (ret) |
| 1021 | goto err_free_bufs; | 1019 | goto err_manuf_cleanup; |
| 1022 | 1020 | ||
| 1023 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); | 1021 | ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); |
| 1024 | if (ret) | 1022 | if (ret) |
| 1025 | goto err_free_bufs; | 1023 | goto err_manuf_cleanup; |
| 1026 | } | 1024 | } |
| 1027 | 1025 | ||
| 1028 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); | 1026 | ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); |
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 150e49723c15..6a9dd68c0f4f 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
| @@ -1253,6 +1253,7 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, | |||
| 1253 | * effects say only one namespace is affected. | 1253 | * effects say only one namespace is affected. |
| 1254 | */ | 1254 | */ |
| 1255 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { | 1255 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { |
| 1256 | mutex_lock(&ctrl->scan_lock); | ||
| 1256 | nvme_start_freeze(ctrl); | 1257 | nvme_start_freeze(ctrl); |
| 1257 | nvme_wait_freeze(ctrl); | 1258 | nvme_wait_freeze(ctrl); |
| 1258 | } | 1259 | } |
| @@ -1281,8 +1282,10 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) | |||
| 1281 | */ | 1282 | */ |
| 1282 | if (effects & NVME_CMD_EFFECTS_LBCC) | 1283 | if (effects & NVME_CMD_EFFECTS_LBCC) |
| 1283 | nvme_update_formats(ctrl); | 1284 | nvme_update_formats(ctrl); |
| 1284 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) | 1285 | if (effects & (NVME_CMD_EFFECTS_LBCC | NVME_CMD_EFFECTS_CSE_MASK)) { |
| 1285 | nvme_unfreeze(ctrl); | 1286 | nvme_unfreeze(ctrl); |
| 1287 | mutex_unlock(&ctrl->scan_lock); | ||
| 1288 | } | ||
| 1286 | if (effects & NVME_CMD_EFFECTS_CCC) | 1289 | if (effects & NVME_CMD_EFFECTS_CCC) |
| 1287 | nvme_init_identify(ctrl); | 1290 | nvme_init_identify(ctrl); |
| 1288 | if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) | 1291 | if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) |
| @@ -3401,6 +3404,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
| 3401 | if (nvme_identify_ctrl(ctrl, &id)) | 3404 | if (nvme_identify_ctrl(ctrl, &id)) |
| 3402 | return; | 3405 | return; |
| 3403 | 3406 | ||
| 3407 | mutex_lock(&ctrl->scan_lock); | ||
| 3404 | nn = le32_to_cpu(id->nn); | 3408 | nn = le32_to_cpu(id->nn); |
| 3405 | if (ctrl->vs >= NVME_VS(1, 1, 0) && | 3409 | if (ctrl->vs >= NVME_VS(1, 1, 0) && |
| 3406 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { | 3410 | !(ctrl->quirks & NVME_QUIRK_IDENTIFY_CNS)) { |
| @@ -3409,6 +3413,7 @@ static void nvme_scan_work(struct work_struct *work) | |||
| 3409 | } | 3413 | } |
| 3410 | nvme_scan_ns_sequential(ctrl, nn); | 3414 | nvme_scan_ns_sequential(ctrl, nn); |
| 3411 | out_free_id: | 3415 | out_free_id: |
| 3416 | mutex_unlock(&ctrl->scan_lock); | ||
| 3412 | kfree(id); | 3417 | kfree(id); |
| 3413 | down_write(&ctrl->namespaces_rwsem); | 3418 | down_write(&ctrl->namespaces_rwsem); |
| 3414 | list_sort(NULL, &ctrl->namespaces, ns_cmp); | 3419 | list_sort(NULL, &ctrl->namespaces, ns_cmp); |
| @@ -3652,6 +3657,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, | |||
| 3652 | 3657 | ||
| 3653 | ctrl->state = NVME_CTRL_NEW; | 3658 | ctrl->state = NVME_CTRL_NEW; |
| 3654 | spin_lock_init(&ctrl->lock); | 3659 | spin_lock_init(&ctrl->lock); |
| 3660 | mutex_init(&ctrl->scan_lock); | ||
| 3655 | INIT_LIST_HEAD(&ctrl->namespaces); | 3661 | INIT_LIST_HEAD(&ctrl->namespaces); |
| 3656 | init_rwsem(&ctrl->namespaces_rwsem); | 3662 | init_rwsem(&ctrl->namespaces_rwsem); |
| 3657 | ctrl->dev = dev; | 3663 | ctrl->dev = dev; |
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index ab961bdeea89..c4a1bb41abf0 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h | |||
| @@ -154,6 +154,7 @@ struct nvme_ctrl { | |||
| 154 | enum nvme_ctrl_state state; | 154 | enum nvme_ctrl_state state; |
| 155 | bool identified; | 155 | bool identified; |
| 156 | spinlock_t lock; | 156 | spinlock_t lock; |
| 157 | struct mutex scan_lock; | ||
| 157 | const struct nvme_ctrl_ops *ops; | 158 | const struct nvme_ctrl_ops *ops; |
| 158 | struct request_queue *admin_q; | 159 | struct request_queue *admin_q; |
| 159 | struct request_queue *connect_q; | 160 | struct request_queue *connect_q; |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 9bc585415d9b..022ea1ee63f8 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
| @@ -2557,16 +2557,7 @@ static void nvme_reset_work(struct work_struct *work) | |||
| 2557 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) | 2557 | if (dev->ctrl.ctrl_config & NVME_CC_ENABLE) |
| 2558 | nvme_dev_disable(dev, false); | 2558 | nvme_dev_disable(dev, false); |
| 2559 | 2559 | ||
| 2560 | /* | 2560 | mutex_lock(&dev->shutdown_lock); |
| 2561 | * Introduce CONNECTING state from nvme-fc/rdma transports to mark the | ||
| 2562 | * initializing procedure here. | ||
| 2563 | */ | ||
| 2564 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { | ||
| 2565 | dev_warn(dev->ctrl.device, | ||
| 2566 | "failed to mark controller CONNECTING\n"); | ||
| 2567 | goto out; | ||
| 2568 | } | ||
| 2569 | |||
| 2570 | result = nvme_pci_enable(dev); | 2561 | result = nvme_pci_enable(dev); |
| 2571 | if (result) | 2562 | if (result) |
| 2572 | goto out; | 2563 | goto out; |
| @@ -2585,6 +2576,17 @@ static void nvme_reset_work(struct work_struct *work) | |||
| 2585 | */ | 2576 | */ |
| 2586 | dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; | 2577 | dev->ctrl.max_hw_sectors = NVME_MAX_KB_SZ << 1; |
| 2587 | dev->ctrl.max_segments = NVME_MAX_SEGS; | 2578 | dev->ctrl.max_segments = NVME_MAX_SEGS; |
| 2579 | mutex_unlock(&dev->shutdown_lock); | ||
| 2580 | |||
| 2581 | /* | ||
| 2582 | * Introduce CONNECTING state from nvme-fc/rdma transports to mark the | ||
| 2583 | * initializing procedure here. | ||
| 2584 | */ | ||
| 2585 | if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_CONNECTING)) { | ||
| 2586 | dev_warn(dev->ctrl.device, | ||
| 2587 | "failed to mark controller CONNECTING\n"); | ||
| 2588 | goto out; | ||
| 2589 | } | ||
| 2588 | 2590 | ||
| 2589 | result = nvme_init_identify(&dev->ctrl); | 2591 | result = nvme_init_identify(&dev->ctrl); |
| 2590 | if (result) | 2592 | if (result) |
| @@ -1436,6 +1436,7 @@ static int aio_prep_rw(struct kiocb *req, const struct iocb *iocb) | |||
| 1436 | if (unlikely(!req->ki_filp)) | 1436 | if (unlikely(!req->ki_filp)) |
| 1437 | return -EBADF; | 1437 | return -EBADF; |
| 1438 | req->ki_complete = aio_complete_rw; | 1438 | req->ki_complete = aio_complete_rw; |
| 1439 | req->private = NULL; | ||
| 1439 | req->ki_pos = iocb->aio_offset; | 1440 | req->ki_pos = iocb->aio_offset; |
| 1440 | req->ki_flags = iocb_flags(req->ki_filp); | 1441 | req->ki_flags = iocb_flags(req->ki_filp); |
| 1441 | if (iocb->aio_flags & IOCB_FLAG_RESFD) | 1442 | if (iocb->aio_flags & IOCB_FLAG_RESFD) |
diff --git a/fs/buffer.c b/fs/buffer.c index 52d024bfdbc1..48318fb74938 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -200,6 +200,7 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) | |||
| 200 | struct buffer_head *head; | 200 | struct buffer_head *head; |
| 201 | struct page *page; | 201 | struct page *page; |
| 202 | int all_mapped = 1; | 202 | int all_mapped = 1; |
| 203 | static DEFINE_RATELIMIT_STATE(last_warned, HZ, 1); | ||
| 203 | 204 | ||
| 204 | index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); | 205 | index = block >> (PAGE_SHIFT - bd_inode->i_blkbits); |
| 205 | page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); | 206 | page = find_get_page_flags(bd_mapping, index, FGP_ACCESSED); |
| @@ -227,15 +228,15 @@ __find_get_block_slow(struct block_device *bdev, sector_t block) | |||
| 227 | * file io on the block device and getblk. It gets dealt with | 228 | * file io on the block device and getblk. It gets dealt with |
| 228 | * elsewhere, don't buffer_error if we had some unmapped buffers | 229 | * elsewhere, don't buffer_error if we had some unmapped buffers |
| 229 | */ | 230 | */ |
| 230 | if (all_mapped) { | 231 | ratelimit_set_flags(&last_warned, RATELIMIT_MSG_ON_RELEASE); |
| 231 | printk("__find_get_block_slow() failed. " | 232 | if (all_mapped && __ratelimit(&last_warned)) { |
| 232 | "block=%llu, b_blocknr=%llu\n", | 233 | printk("__find_get_block_slow() failed. block=%llu, " |
| 233 | (unsigned long long)block, | 234 | "b_blocknr=%llu, b_state=0x%08lx, b_size=%zu, " |
| 234 | (unsigned long long)bh->b_blocknr); | 235 | "device %pg blocksize: %d\n", |
| 235 | printk("b_state=0x%08lx, b_size=%zu\n", | 236 | (unsigned long long)block, |
| 236 | bh->b_state, bh->b_size); | 237 | (unsigned long long)bh->b_blocknr, |
| 237 | printk("device %pg blocksize: %d\n", bdev, | 238 | bh->b_state, bh->b_size, bdev, |
| 238 | 1 << bd_inode->i_blkbits); | 239 | 1 << bd_inode->i_blkbits); |
| 239 | } | 240 | } |
| 240 | out_unlock: | 241 | out_unlock: |
| 241 | spin_unlock(&bd_mapping->private_lock); | 242 | spin_unlock(&bd_mapping->private_lock); |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 8804753805ac..7bb2d8de9f30 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
| @@ -116,7 +116,13 @@ extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes); | |||
| 116 | 116 | ||
| 117 | static inline sector_t blk_rq_trace_sector(struct request *rq) | 117 | static inline sector_t blk_rq_trace_sector(struct request *rq) |
| 118 | { | 118 | { |
| 119 | return blk_rq_is_passthrough(rq) ? 0 : blk_rq_pos(rq); | 119 | /* |
| 120 | * Tracing should ignore starting sector for passthrough requests and | ||
| 121 | * requests where starting sector didn't get set. | ||
| 122 | */ | ||
| 123 | if (blk_rq_is_passthrough(rq) || blk_rq_pos(rq) == (sector_t)-1) | ||
| 124 | return 0; | ||
| 125 | return blk_rq_pos(rq); | ||
| 120 | } | 126 | } |
| 121 | 127 | ||
| 122 | static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq) | 128 | static inline unsigned int blk_rq_trace_nr_sectors(struct request *rq) |
diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index 071b4cbdf010..c848a7cc502e 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h | |||
| @@ -319,7 +319,7 @@ | |||
| 319 | #define GITS_TYPER_PLPIS (1UL << 0) | 319 | #define GITS_TYPER_PLPIS (1UL << 0) |
| 320 | #define GITS_TYPER_VLPIS (1UL << 1) | 320 | #define GITS_TYPER_VLPIS (1UL << 1) |
| 321 | #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 | 321 | #define GITS_TYPER_ITT_ENTRY_SIZE_SHIFT 4 |
| 322 | #define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0x1f) + 1) | 322 | #define GITS_TYPER_ITT_ENTRY_SIZE(r) ((((r) >> GITS_TYPER_ITT_ENTRY_SIZE_SHIFT) & 0xf) + 1) |
| 323 | #define GITS_TYPER_IDBITS_SHIFT 8 | 323 | #define GITS_TYPER_IDBITS_SHIFT 8 |
| 324 | #define GITS_TYPER_DEVBITS_SHIFT 13 | 324 | #define GITS_TYPER_DEVBITS_SHIFT 13 |
| 325 | #define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) | 325 | #define GITS_TYPER_DEVBITS(r) ((((r) >> GITS_TYPER_DEVBITS_SHIFT) & 0x1f) + 1) |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 4a9937076331..309ef5a64af5 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
| @@ -734,6 +734,9 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) | |||
| 734 | size = sizeof(struct ring_buffer); | 734 | size = sizeof(struct ring_buffer); |
| 735 | size += nr_pages * sizeof(void *); | 735 | size += nr_pages * sizeof(void *); |
| 736 | 736 | ||
| 737 | if (order_base_2(size) >= MAX_ORDER) | ||
| 738 | goto fail; | ||
| 739 | |||
| 737 | rb = kzalloc(size, GFP_KERNEL); | 740 | rb = kzalloc(size, GFP_KERNEL); |
| 738 | if (!rb) | 741 | if (!rb) |
| 739 | goto fail; | 742 | goto fail; |
diff --git a/kernel/futex.c b/kernel/futex.c index fdd312da0992..a0514e01c3eb 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
| @@ -2221,11 +2221,11 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) | |||
| 2221 | * decrement the counter at queue_unlock() when some error has | 2221 | * decrement the counter at queue_unlock() when some error has |
| 2222 | * occurred and we don't end up adding the task to the list. | 2222 | * occurred and we don't end up adding the task to the list. |
| 2223 | */ | 2223 | */ |
| 2224 | hb_waiters_inc(hb); | 2224 | hb_waiters_inc(hb); /* implies smp_mb(); (A) */ |
| 2225 | 2225 | ||
| 2226 | q->lock_ptr = &hb->lock; | 2226 | q->lock_ptr = &hb->lock; |
| 2227 | 2227 | ||
| 2228 | spin_lock(&hb->lock); /* implies smp_mb(); (A) */ | 2228 | spin_lock(&hb->lock); |
| 2229 | return hb; | 2229 | return hb; |
| 2230 | } | 2230 | } |
| 2231 | 2231 | ||
| @@ -2861,35 +2861,39 @@ retry_private: | |||
| 2861 | * and BUG when futex_unlock_pi() interleaves with this. | 2861 | * and BUG when futex_unlock_pi() interleaves with this. |
| 2862 | * | 2862 | * |
| 2863 | * Therefore acquire wait_lock while holding hb->lock, but drop the | 2863 | * Therefore acquire wait_lock while holding hb->lock, but drop the |
| 2864 | * latter before calling rt_mutex_start_proxy_lock(). This still fully | 2864 | * latter before calling __rt_mutex_start_proxy_lock(). This |
| 2865 | * serializes against futex_unlock_pi() as that does the exact same | 2865 | * interleaves with futex_unlock_pi() -- which does a similar lock |
| 2866 | * lock handoff sequence. | 2866 | * handoff -- such that the latter can observe the futex_q::pi_state |
| 2867 | * before __rt_mutex_start_proxy_lock() is done. | ||
| 2867 | */ | 2868 | */ |
| 2868 | raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); | 2869 | raw_spin_lock_irq(&q.pi_state->pi_mutex.wait_lock); |
| 2869 | spin_unlock(q.lock_ptr); | 2870 | spin_unlock(q.lock_ptr); |
| 2871 | /* | ||
| 2872 | * __rt_mutex_start_proxy_lock() unconditionally enqueues the @rt_waiter | ||
| 2873 | * such that futex_unlock_pi() is guaranteed to observe the waiter when | ||
| 2874 | * it sees the futex_q::pi_state. | ||
| 2875 | */ | ||
| 2870 | ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); | 2876 | ret = __rt_mutex_start_proxy_lock(&q.pi_state->pi_mutex, &rt_waiter, current); |
| 2871 | raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); | 2877 | raw_spin_unlock_irq(&q.pi_state->pi_mutex.wait_lock); |
| 2872 | 2878 | ||
| 2873 | if (ret) { | 2879 | if (ret) { |
| 2874 | if (ret == 1) | 2880 | if (ret == 1) |
| 2875 | ret = 0; | 2881 | ret = 0; |
| 2876 | 2882 | goto cleanup; | |
| 2877 | spin_lock(q.lock_ptr); | ||
| 2878 | goto no_block; | ||
| 2879 | } | 2883 | } |
| 2880 | 2884 | ||
| 2881 | |||
| 2882 | if (unlikely(to)) | 2885 | if (unlikely(to)) |
| 2883 | hrtimer_start_expires(&to->timer, HRTIMER_MODE_ABS); | 2886 | hrtimer_start_expires(&to->timer, HRTIMER_MODE_ABS); |
| 2884 | 2887 | ||
| 2885 | ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); | 2888 | ret = rt_mutex_wait_proxy_lock(&q.pi_state->pi_mutex, to, &rt_waiter); |
| 2886 | 2889 | ||
| 2890 | cleanup: | ||
| 2887 | spin_lock(q.lock_ptr); | 2891 | spin_lock(q.lock_ptr); |
| 2888 | /* | 2892 | /* |
| 2889 | * If we failed to acquire the lock (signal/timeout), we must | 2893 | * If we failed to acquire the lock (deadlock/signal/timeout), we must |
| 2890 | * first acquire the hb->lock before removing the lock from the | 2894 | * first acquire the hb->lock before removing the lock from the |
| 2891 | * rt_mutex waitqueue, such that we can keep the hb and rt_mutex | 2895 | * rt_mutex waitqueue, such that we can keep the hb and rt_mutex wait |
| 2892 | * wait lists consistent. | 2896 | * lists consistent. |
| 2893 | * | 2897 | * |
| 2894 | * In particular; it is important that futex_unlock_pi() can not | 2898 | * In particular; it is important that futex_unlock_pi() can not |
| 2895 | * observe this inconsistency. | 2899 | * observe this inconsistency. |
| @@ -3013,6 +3017,10 @@ retry: | |||
| 3013 | * there is no point where we hold neither; and therefore | 3017 | * there is no point where we hold neither; and therefore |
| 3014 | * wake_futex_pi() must observe a state consistent with what we | 3018 | * wake_futex_pi() must observe a state consistent with what we |
| 3015 | * observed. | 3019 | * observed. |
| 3020 | * | ||
| 3021 | * In particular; this forces __rt_mutex_start_proxy() to | ||
| 3022 | * complete such that we're guaranteed to observe the | ||
| 3023 | * rt_waiter. Also see the WARN in wake_futex_pi(). | ||
| 3016 | */ | 3024 | */ |
| 3017 | raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); | 3025 | raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); |
| 3018 | spin_unlock(&hb->lock); | 3026 | spin_unlock(&hb->lock); |
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 581edcc63c26..978d63a8261c 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c | |||
| @@ -1726,12 +1726,33 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock, | |||
| 1726 | rt_mutex_set_owner(lock, NULL); | 1726 | rt_mutex_set_owner(lock, NULL); |
| 1727 | } | 1727 | } |
| 1728 | 1728 | ||
| 1729 | /** | ||
| 1730 | * __rt_mutex_start_proxy_lock() - Start lock acquisition for another task | ||
| 1731 | * @lock: the rt_mutex to take | ||
| 1732 | * @waiter: the pre-initialized rt_mutex_waiter | ||
| 1733 | * @task: the task to prepare | ||
| 1734 | * | ||
| 1735 | * Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock | ||
| 1736 | * detection. It does not wait, see rt_mutex_wait_proxy_lock() for that. | ||
| 1737 | * | ||
| 1738 | * NOTE: does _NOT_ remove the @waiter on failure; must either call | ||
| 1739 | * rt_mutex_wait_proxy_lock() or rt_mutex_cleanup_proxy_lock() after this. | ||
| 1740 | * | ||
| 1741 | * Returns: | ||
| 1742 | * 0 - task blocked on lock | ||
| 1743 | * 1 - acquired the lock for task, caller should wake it up | ||
| 1744 | * <0 - error | ||
| 1745 | * | ||
| 1746 | * Special API call for PI-futex support. | ||
| 1747 | */ | ||
| 1729 | int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, | 1748 | int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
| 1730 | struct rt_mutex_waiter *waiter, | 1749 | struct rt_mutex_waiter *waiter, |
| 1731 | struct task_struct *task) | 1750 | struct task_struct *task) |
| 1732 | { | 1751 | { |
| 1733 | int ret; | 1752 | int ret; |
| 1734 | 1753 | ||
| 1754 | lockdep_assert_held(&lock->wait_lock); | ||
| 1755 | |||
| 1735 | if (try_to_take_rt_mutex(lock, task, NULL)) | 1756 | if (try_to_take_rt_mutex(lock, task, NULL)) |
| 1736 | return 1; | 1757 | return 1; |
| 1737 | 1758 | ||
| @@ -1749,9 +1770,6 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
| 1749 | ret = 0; | 1770 | ret = 0; |
| 1750 | } | 1771 | } |
| 1751 | 1772 | ||
| 1752 | if (unlikely(ret)) | ||
| 1753 | remove_waiter(lock, waiter); | ||
| 1754 | |||
| 1755 | debug_rt_mutex_print_deadlock(waiter); | 1773 | debug_rt_mutex_print_deadlock(waiter); |
| 1756 | 1774 | ||
| 1757 | return ret; | 1775 | return ret; |
| @@ -1763,12 +1781,18 @@ int __rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
| 1763 | * @waiter: the pre-initialized rt_mutex_waiter | 1781 | * @waiter: the pre-initialized rt_mutex_waiter |
| 1764 | * @task: the task to prepare | 1782 | * @task: the task to prepare |
| 1765 | * | 1783 | * |
| 1784 | * Starts the rt_mutex acquire; it enqueues the @waiter and does deadlock | ||
| 1785 | * detection. It does not wait, see rt_mutex_wait_proxy_lock() for that. | ||
| 1786 | * | ||
| 1787 | * NOTE: unlike __rt_mutex_start_proxy_lock this _DOES_ remove the @waiter | ||
| 1788 | * on failure. | ||
| 1789 | * | ||
| 1766 | * Returns: | 1790 | * Returns: |
| 1767 | * 0 - task blocked on lock | 1791 | * 0 - task blocked on lock |
| 1768 | * 1 - acquired the lock for task, caller should wake it up | 1792 | * 1 - acquired the lock for task, caller should wake it up |
| 1769 | * <0 - error | 1793 | * <0 - error |
| 1770 | * | 1794 | * |
| 1771 | * Special API call for FUTEX_REQUEUE_PI support. | 1795 | * Special API call for PI-futex support. |
| 1772 | */ | 1796 | */ |
| 1773 | int rt_mutex_start_proxy_lock(struct rt_mutex *lock, | 1797 | int rt_mutex_start_proxy_lock(struct rt_mutex *lock, |
| 1774 | struct rt_mutex_waiter *waiter, | 1798 | struct rt_mutex_waiter *waiter, |
| @@ -1778,6 +1802,8 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, | |||
| 1778 | 1802 | ||
| 1779 | raw_spin_lock_irq(&lock->wait_lock); | 1803 | raw_spin_lock_irq(&lock->wait_lock); |
| 1780 | ret = __rt_mutex_start_proxy_lock(lock, waiter, task); | 1804 | ret = __rt_mutex_start_proxy_lock(lock, waiter, task); |
| 1805 | if (unlikely(ret)) | ||
| 1806 | remove_waiter(lock, waiter); | ||
| 1781 | raw_spin_unlock_irq(&lock->wait_lock); | 1807 | raw_spin_unlock_irq(&lock->wait_lock); |
| 1782 | 1808 | ||
| 1783 | return ret; | 1809 | return ret; |
| @@ -1845,7 +1871,8 @@ int rt_mutex_wait_proxy_lock(struct rt_mutex *lock, | |||
| 1845 | * @lock: the rt_mutex we were woken on | 1871 | * @lock: the rt_mutex we were woken on |
| 1846 | * @waiter: the pre-initialized rt_mutex_waiter | 1872 | * @waiter: the pre-initialized rt_mutex_waiter |
| 1847 | * | 1873 | * |
| 1848 | * Attempt to clean up after a failed rt_mutex_wait_proxy_lock(). | 1874 | * Attempt to clean up after a failed __rt_mutex_start_proxy_lock() or |
| 1875 | * rt_mutex_wait_proxy_lock(). | ||
| 1849 | * | 1876 | * |
| 1850 | * Unless we acquired the lock; we're still enqueued on the wait-list and can | 1877 | * Unless we acquired the lock; we're still enqueued on the wait-list and can |
| 1851 | * in fact still be granted ownership until we're removed. Therefore we can | 1878 | * in fact still be granted ownership until we're removed. Therefore we can |
diff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h index f6052e70bf40..a55cb8b10165 100644 --- a/tools/include/uapi/linux/in.h +++ b/tools/include/uapi/linux/in.h | |||
| @@ -268,7 +268,7 @@ struct sockaddr_in { | |||
| 268 | #define IN_MULTICAST(a) IN_CLASSD(a) | 268 | #define IN_MULTICAST(a) IN_CLASSD(a) |
| 269 | #define IN_MULTICAST_NET 0xe0000000 | 269 | #define IN_MULTICAST_NET 0xe0000000 |
| 270 | 270 | ||
| 271 | #define IN_BADCLASS(a) ((((long int) (a) ) == 0xffffffff) | 271 | #define IN_BADCLASS(a) (((long int) (a) ) == (long int)0xffffffff) |
| 272 | #define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) | 272 | #define IN_EXPERIMENTAL(a) IN_BADCLASS((a)) |
| 273 | 273 | ||
| 274 | #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) | 274 | #define IN_CLASSE(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) |
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt index 095aebdc5bb7..e6150f21267d 100644 --- a/tools/perf/Documentation/perf-c2c.txt +++ b/tools/perf/Documentation/perf-c2c.txt | |||
| @@ -19,8 +19,11 @@ C2C stands for Cache To Cache. | |||
| 19 | The perf c2c tool provides means for Shared Data C2C/HITM analysis. It allows | 19 | The perf c2c tool provides means for Shared Data C2C/HITM analysis. It allows |
| 20 | you to track down the cacheline contentions. | 20 | you to track down the cacheline contentions. |
| 21 | 21 | ||
| 22 | The tool is based on x86's load latency and precise store facility events | 22 | On x86, the tool is based on load latency and precise store facility events |
| 23 | provided by Intel CPUs. These events provide: | 23 | provided by Intel CPUs. On PowerPC, the tool uses random instruction sampling |
| 24 | with thresholding feature. | ||
| 25 | |||
| 26 | These events provide: | ||
| 24 | - memory address of the access | 27 | - memory address of the access |
| 25 | - type of the access (load and store details) | 28 | - type of the access (load and store details) |
| 26 | - latency (in cycles) of the load access | 29 | - latency (in cycles) of the load access |
| @@ -46,7 +49,7 @@ RECORD OPTIONS | |||
| 46 | 49 | ||
| 47 | -l:: | 50 | -l:: |
| 48 | --ldlat:: | 51 | --ldlat:: |
| 49 | Configure mem-loads latency. | 52 | Configure mem-loads latency. (x86 only) |
| 50 | 53 | ||
| 51 | -k:: | 54 | -k:: |
| 52 | --all-kernel:: | 55 | --all-kernel:: |
| @@ -119,11 +122,16 @@ Following perf record options are configured by default: | |||
| 119 | -W,-d,--phys-data,--sample-cpu | 122 | -W,-d,--phys-data,--sample-cpu |
| 120 | 123 | ||
| 121 | Unless specified otherwise with '-e' option, following events are monitored by | 124 | Unless specified otherwise with '-e' option, following events are monitored by |
| 122 | default: | 125 | default on x86: |
| 123 | 126 | ||
| 124 | cpu/mem-loads,ldlat=30/P | 127 | cpu/mem-loads,ldlat=30/P |
| 125 | cpu/mem-stores/P | 128 | cpu/mem-stores/P |
| 126 | 129 | ||
| 130 | and following on PowerPC: | ||
| 131 | |||
| 132 | cpu/mem-loads/ | ||
| 133 | cpu/mem-stores/ | ||
| 134 | |||
| 127 | User can pass any 'perf record' option behind '--' mark, like (to enable | 135 | User can pass any 'perf record' option behind '--' mark, like (to enable |
| 128 | callchains and system wide monitoring): | 136 | callchains and system wide monitoring): |
| 129 | 137 | ||
diff --git a/tools/perf/Documentation/perf-mem.txt b/tools/perf/Documentation/perf-mem.txt index f8d2167cf3e7..199ea0f0a6c0 100644 --- a/tools/perf/Documentation/perf-mem.txt +++ b/tools/perf/Documentation/perf-mem.txt | |||
| @@ -82,7 +82,7 @@ RECORD OPTIONS | |||
| 82 | Be more verbose (show counter open errors, etc) | 82 | Be more verbose (show counter open errors, etc) |
| 83 | 83 | ||
| 84 | --ldlat <n>:: | 84 | --ldlat <n>:: |
| 85 | Specify desired latency for loads event. | 85 | Specify desired latency for loads event. (x86 only) |
| 86 | 86 | ||
| 87 | In addition, for report all perf report options are valid, and for record | 87 | In addition, for report all perf report options are valid, and for record |
| 88 | all perf record options. | 88 | all perf record options. |
diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build index 2e6595310420..ba98bd006488 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build | |||
| @@ -2,6 +2,7 @@ libperf-y += header.o | |||
| 2 | libperf-y += sym-handling.o | 2 | libperf-y += sym-handling.o |
| 3 | libperf-y += kvm-stat.o | 3 | libperf-y += kvm-stat.o |
| 4 | libperf-y += perf_regs.o | 4 | libperf-y += perf_regs.o |
| 5 | libperf-y += mem-events.o | ||
| 5 | 6 | ||
| 6 | libperf-$(CONFIG_DWARF) += dwarf-regs.o | 7 | libperf-$(CONFIG_DWARF) += dwarf-regs.o |
| 7 | libperf-$(CONFIG_DWARF) += skip-callchain-idx.o | 8 | libperf-$(CONFIG_DWARF) += skip-callchain-idx.o |
diff --git a/tools/perf/arch/powerpc/util/mem-events.c b/tools/perf/arch/powerpc/util/mem-events.c new file mode 100644 index 000000000000..d08311f04e95 --- /dev/null +++ b/tools/perf/arch/powerpc/util/mem-events.c | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | #include "mem-events.h" | ||
| 3 | |||
| 4 | /* PowerPC does not support 'ldlat' parameter. */ | ||
| 5 | char *perf_mem_events__name(int i) | ||
| 6 | { | ||
| 7 | if (i == PERF_MEM_EVENTS__LOAD) | ||
| 8 | return (char *) "cpu/mem-loads/"; | ||
| 9 | |||
| 10 | return (char *) "cpu/mem-stores/"; | ||
| 11 | } | ||
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index ed4583128b9c..b36061cd1ab8 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
| @@ -2514,19 +2514,30 @@ static size_t trace__fprintf_thread_summary(struct trace *trace, FILE *fp); | |||
| 2514 | 2514 | ||
| 2515 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) | 2515 | static bool perf_evlist__add_vfs_getname(struct perf_evlist *evlist) |
| 2516 | { | 2516 | { |
| 2517 | struct perf_evsel *evsel = perf_evsel__newtp("probe", "vfs_getname"); | 2517 | bool found = false; |
| 2518 | struct perf_evsel *evsel, *tmp; | ||
| 2519 | struct parse_events_error err = { .idx = 0, }; | ||
| 2520 | int ret = parse_events(evlist, "probe:vfs_getname*", &err); | ||
| 2518 | 2521 | ||
| 2519 | if (IS_ERR(evsel)) | 2522 | if (ret) |
| 2520 | return false; | 2523 | return false; |
| 2521 | 2524 | ||
| 2522 | if (perf_evsel__field(evsel, "pathname") == NULL) { | 2525 | evlist__for_each_entry_safe(evlist, evsel, tmp) { |
| 2526 | if (!strstarts(perf_evsel__name(evsel), "probe:vfs_getname")) | ||
| 2527 | continue; | ||
| 2528 | |||
| 2529 | if (perf_evsel__field(evsel, "pathname")) { | ||
| 2530 | evsel->handler = trace__vfs_getname; | ||
| 2531 | found = true; | ||
| 2532 | continue; | ||
| 2533 | } | ||
| 2534 | |||
| 2535 | list_del_init(&evsel->node); | ||
| 2536 | evsel->evlist = NULL; | ||
| 2523 | perf_evsel__delete(evsel); | 2537 | perf_evsel__delete(evsel); |
| 2524 | return false; | ||
| 2525 | } | 2538 | } |
| 2526 | 2539 | ||
| 2527 | evsel->handler = trace__vfs_getname; | 2540 | return found; |
| 2528 | perf_evlist__add(evlist, evsel); | ||
| 2529 | return true; | ||
| 2530 | } | 2541 | } |
| 2531 | 2542 | ||
| 2532 | static struct perf_evsel *perf_evsel__new_pgfault(u64 config) | 2543 | static struct perf_evsel *perf_evsel__new_pgfault(u64 config) |
diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py index 44090a9a19f3..e952127e4fb0 100644 --- a/tools/perf/tests/attr.py +++ b/tools/perf/tests/attr.py | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #! /usr/bin/python | 1 | #! /usr/bin/python |
| 2 | # SPDX-License-Identifier: GPL-2.0 | 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | 3 | ||
| 4 | from __future__ import print_function | ||
| 5 | |||
| 4 | import os | 6 | import os |
| 5 | import sys | 7 | import sys |
| 6 | import glob | 8 | import glob |
| @@ -8,7 +10,11 @@ import optparse | |||
| 8 | import tempfile | 10 | import tempfile |
| 9 | import logging | 11 | import logging |
| 10 | import shutil | 12 | import shutil |
| 11 | import ConfigParser | 13 | |
| 14 | try: | ||
| 15 | import configparser | ||
| 16 | except ImportError: | ||
| 17 | import ConfigParser as configparser | ||
| 12 | 18 | ||
| 13 | def data_equal(a, b): | 19 | def data_equal(a, b): |
| 14 | # Allow multiple values in assignment separated by '|' | 20 | # Allow multiple values in assignment separated by '|' |
| @@ -100,20 +106,20 @@ class Event(dict): | |||
| 100 | def equal(self, other): | 106 | def equal(self, other): |
| 101 | for t in Event.terms: | 107 | for t in Event.terms: |
| 102 | log.debug(" [%s] %s %s" % (t, self[t], other[t])); | 108 | log.debug(" [%s] %s %s" % (t, self[t], other[t])); |
| 103 | if not self.has_key(t) or not other.has_key(t): | 109 | if t not in self or t not in other: |
| 104 | return False | 110 | return False |
| 105 | if not data_equal(self[t], other[t]): | 111 | if not data_equal(self[t], other[t]): |
| 106 | return False | 112 | return False |
| 107 | return True | 113 | return True |
| 108 | 114 | ||
| 109 | def optional(self): | 115 | def optional(self): |
| 110 | if self.has_key('optional') and self['optional'] == '1': | 116 | if 'optional' in self and self['optional'] == '1': |
| 111 | return True | 117 | return True |
| 112 | return False | 118 | return False |
| 113 | 119 | ||
| 114 | def diff(self, other): | 120 | def diff(self, other): |
| 115 | for t in Event.terms: | 121 | for t in Event.terms: |
| 116 | if not self.has_key(t) or not other.has_key(t): | 122 | if t not in self or t not in other: |
| 117 | continue | 123 | continue |
| 118 | if not data_equal(self[t], other[t]): | 124 | if not data_equal(self[t], other[t]): |
| 119 | log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) | 125 | log.warning("expected %s=%s, got %s" % (t, self[t], other[t])) |
| @@ -134,7 +140,7 @@ class Event(dict): | |||
| 134 | # - expected values assignments | 140 | # - expected values assignments |
| 135 | class Test(object): | 141 | class Test(object): |
| 136 | def __init__(self, path, options): | 142 | def __init__(self, path, options): |
| 137 | parser = ConfigParser.SafeConfigParser() | 143 | parser = configparser.SafeConfigParser() |
| 138 | parser.read(path) | 144 | parser.read(path) |
| 139 | 145 | ||
| 140 | log.warning("running '%s'" % path) | 146 | log.warning("running '%s'" % path) |
| @@ -193,7 +199,7 @@ class Test(object): | |||
| 193 | return True | 199 | return True |
| 194 | 200 | ||
| 195 | def load_events(self, path, events): | 201 | def load_events(self, path, events): |
| 196 | parser_event = ConfigParser.SafeConfigParser() | 202 | parser_event = configparser.SafeConfigParser() |
| 197 | parser_event.read(path) | 203 | parser_event.read(path) |
| 198 | 204 | ||
| 199 | # The event record section header contains 'event' word, | 205 | # The event record section header contains 'event' word, |
| @@ -207,7 +213,7 @@ class Test(object): | |||
| 207 | # Read parent event if there's any | 213 | # Read parent event if there's any |
| 208 | if (':' in section): | 214 | if (':' in section): |
| 209 | base = section[section.index(':') + 1:] | 215 | base = section[section.index(':') + 1:] |
| 210 | parser_base = ConfigParser.SafeConfigParser() | 216 | parser_base = configparser.SafeConfigParser() |
| 211 | parser_base.read(self.test_dir + '/' + base) | 217 | parser_base.read(self.test_dir + '/' + base) |
| 212 | base_items = parser_base.items('event') | 218 | base_items = parser_base.items('event') |
| 213 | 219 | ||
| @@ -322,9 +328,9 @@ def run_tests(options): | |||
| 322 | for f in glob.glob(options.test_dir + '/' + options.test): | 328 | for f in glob.glob(options.test_dir + '/' + options.test): |
| 323 | try: | 329 | try: |
| 324 | Test(f, options).run() | 330 | Test(f, options).run() |
| 325 | except Unsup, obj: | 331 | except Unsup as obj: |
| 326 | log.warning("unsupp %s" % obj.getMsg()) | 332 | log.warning("unsupp %s" % obj.getMsg()) |
| 327 | except Notest, obj: | 333 | except Notest as obj: |
| 328 | log.warning("skipped %s" % obj.getMsg()) | 334 | log.warning("skipped %s" % obj.getMsg()) |
| 329 | 335 | ||
| 330 | def setup_log(verbose): | 336 | def setup_log(verbose): |
| @@ -363,7 +369,7 @@ def main(): | |||
| 363 | parser.add_option("-p", "--perf", | 369 | parser.add_option("-p", "--perf", |
| 364 | action="store", type="string", dest="perf") | 370 | action="store", type="string", dest="perf") |
| 365 | parser.add_option("-v", "--verbose", | 371 | parser.add_option("-v", "--verbose", |
| 366 | action="count", dest="verbose") | 372 | default=0, action="count", dest="verbose") |
| 367 | 373 | ||
| 368 | options, args = parser.parse_args() | 374 | options, args = parser.parse_args() |
| 369 | if args: | 375 | if args: |
| @@ -373,7 +379,7 @@ def main(): | |||
| 373 | setup_log(options.verbose) | 379 | setup_log(options.verbose) |
| 374 | 380 | ||
| 375 | if not options.test_dir: | 381 | if not options.test_dir: |
| 376 | print 'FAILED no -d option specified' | 382 | print('FAILED no -d option specified') |
| 377 | sys.exit(-1) | 383 | sys.exit(-1) |
| 378 | 384 | ||
| 379 | if not options.test: | 385 | if not options.test: |
| @@ -382,8 +388,8 @@ def main(): | |||
| 382 | try: | 388 | try: |
| 383 | run_tests(options) | 389 | run_tests(options) |
| 384 | 390 | ||
| 385 | except Fail, obj: | 391 | except Fail as obj: |
| 386 | print "FAILED %s" % obj.getMsg(); | 392 | print("FAILED %s" % obj.getMsg()) |
| 387 | sys.exit(-1) | 393 | sys.exit(-1) |
| 388 | 394 | ||
| 389 | sys.exit(0) | 395 | sys.exit(0) |
diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c index 5f8501c68da4..5cbba70bcdd0 100644 --- a/tools/perf/tests/evsel-tp-sched.c +++ b/tools/perf/tests/evsel-tp-sched.c | |||
| @@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name, | |||
| 17 | return -1; | 17 | return -1; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | is_signed = !!(field->flags | TEP_FIELD_IS_SIGNED); | 20 | is_signed = !!(field->flags & TEP_FIELD_IS_SIGNED); |
| 21 | if (should_be_signed && !is_signed) { | 21 | if (should_be_signed && !is_signed) { |
| 22 | pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n", | 22 | pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n", |
| 23 | evsel->name, name, is_signed, should_be_signed); | 23 | evsel->name, name, is_signed, should_be_signed); |
diff --git a/tools/perf/util/c++/clang.cpp b/tools/perf/util/c++/clang.cpp index 89512504551b..39c0004f2886 100644 --- a/tools/perf/util/c++/clang.cpp +++ b/tools/perf/util/c++/clang.cpp | |||
| @@ -160,7 +160,7 @@ getBPFObjectFromModule(llvm::Module *Module) | |||
| 160 | } | 160 | } |
| 161 | PM.run(*Module); | 161 | PM.run(*Module); |
| 162 | 162 | ||
| 163 | return std::move(Buffer); | 163 | return Buffer; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | } | 166 | } |
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 93f74d8d3cdd..42c3e5a229d2 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c | |||
| @@ -28,7 +28,7 @@ struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = { | |||
| 28 | static char mem_loads_name[100]; | 28 | static char mem_loads_name[100]; |
| 29 | static bool mem_loads_name__init; | 29 | static bool mem_loads_name__init; |
| 30 | 30 | ||
| 31 | char *perf_mem_events__name(int i) | 31 | char * __weak perf_mem_events__name(int i) |
| 32 | { | 32 | { |
| 33 | if (i == PERF_MEM_EVENTS__LOAD) { | 33 | if (i == PERF_MEM_EVENTS__LOAD) { |
| 34 | if (!mem_loads_name__init) { | 34 | if (!mem_loads_name__init) { |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 66a84d5846c8..dca7dfae69ad 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
| @@ -19,6 +19,20 @@ | |||
| 19 | #define EM_AARCH64 183 /* ARM 64 bit */ | 19 | #define EM_AARCH64 183 /* ARM 64 bit */ |
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | #ifndef ELF32_ST_VISIBILITY | ||
| 23 | #define ELF32_ST_VISIBILITY(o) ((o) & 0x03) | ||
| 24 | #endif | ||
| 25 | |||
| 26 | /* For ELF64 the definitions are the same. */ | ||
| 27 | #ifndef ELF64_ST_VISIBILITY | ||
| 28 | #define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o) | ||
| 29 | #endif | ||
| 30 | |||
| 31 | /* How to extract information held in the st_other field. */ | ||
| 32 | #ifndef GELF_ST_VISIBILITY | ||
| 33 | #define GELF_ST_VISIBILITY(val) ELF64_ST_VISIBILITY (val) | ||
| 34 | #endif | ||
| 35 | |||
| 22 | typedef Elf64_Nhdr GElf_Nhdr; | 36 | typedef Elf64_Nhdr GElf_Nhdr; |
| 23 | 37 | ||
| 24 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT | 38 | #ifdef HAVE_CPLUS_DEMANGLE_SUPPORT |
| @@ -87,6 +101,11 @@ static inline uint8_t elf_sym__type(const GElf_Sym *sym) | |||
| 87 | return GELF_ST_TYPE(sym->st_info); | 101 | return GELF_ST_TYPE(sym->st_info); |
| 88 | } | 102 | } |
| 89 | 103 | ||
| 104 | static inline uint8_t elf_sym__visibility(const GElf_Sym *sym) | ||
| 105 | { | ||
| 106 | return GELF_ST_VISIBILITY(sym->st_other); | ||
| 107 | } | ||
| 108 | |||
| 90 | #ifndef STT_GNU_IFUNC | 109 | #ifndef STT_GNU_IFUNC |
| 91 | #define STT_GNU_IFUNC 10 | 110 | #define STT_GNU_IFUNC 10 |
| 92 | #endif | 111 | #endif |
| @@ -111,7 +130,9 @@ static inline int elf_sym__is_label(const GElf_Sym *sym) | |||
| 111 | return elf_sym__type(sym) == STT_NOTYPE && | 130 | return elf_sym__type(sym) == STT_NOTYPE && |
| 112 | sym->st_name != 0 && | 131 | sym->st_name != 0 && |
| 113 | sym->st_shndx != SHN_UNDEF && | 132 | sym->st_shndx != SHN_UNDEF && |
| 114 | sym->st_shndx != SHN_ABS; | 133 | sym->st_shndx != SHN_ABS && |
| 134 | elf_sym__visibility(sym) != STV_HIDDEN && | ||
| 135 | elf_sym__visibility(sym) != STV_INTERNAL; | ||
| 115 | } | 136 | } |
| 116 | 137 | ||
| 117 | static bool elf_sym__filter(GElf_Sym *sym) | 138 | static bool elf_sym__filter(GElf_Sym *sym) |
