diff options
148 files changed, 1300 insertions, 608 deletions
diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt index dc2a18f0b3a1..ddbe304beb21 100644 --- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt +++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt | |||
@@ -15,10 +15,8 @@ Optional properties: | |||
15 | - phys: phandle + phy specifier pair | 15 | - phys: phandle + phy specifier pair |
16 | - phy-names: must be "usb" | 16 | - phy-names: must be "usb" |
17 | - dmas: Must contain a list of references to DMA specifiers. | 17 | - dmas: Must contain a list of references to DMA specifiers. |
18 | - dma-names : Must contain a list of DMA names: | 18 | - dma-names : named "ch%d", where %d is the channel number ranging from zero |
19 | - tx0 ... tx<n> | 19 | to the number of channels (DnFIFOs) minus one. |
20 | - rx0 ... rx<n> | ||
21 | - This <n> means DnFIFO in USBHS module. | ||
22 | 20 | ||
23 | Example: | 21 | Example: |
24 | usbhs: usb@e6590000 { | 22 | usbhs: usb@e6590000 { |
diff --git a/MAINTAINERS b/MAINTAINERS index af802b357b6a..d8afd2953678 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -51,9 +51,9 @@ trivial patch so apply some common sense. | |||
51 | or does something very odd once a month document it. | 51 | or does something very odd once a month document it. |
52 | 52 | ||
53 | PLEASE remember that submissions must be made under the terms | 53 | PLEASE remember that submissions must be made under the terms |
54 | of the OSDL certificate of contribution and should include a | 54 | of the Linux Foundation certificate of contribution and should |
55 | Signed-off-by: line. The current version of this "Developer's | 55 | include a Signed-off-by: line. The current version of this |
56 | Certificate of Origin" (DCO) is listed in the file | 56 | "Developer's Certificate of Origin" (DCO) is listed in the file |
57 | Documentation/SubmittingPatches. | 57 | Documentation/SubmittingPatches. |
58 | 58 | ||
59 | 6. Make sure you have the right to send any changes you make. If you | 59 | 6. Make sure you have the right to send any changes you make. If you |
@@ -7575,6 +7575,7 @@ F: drivers/pci/host/pci-exynos.c | |||
7575 | 7575 | ||
7576 | PCI DRIVER FOR SYNOPSIS DESIGNWARE | 7576 | PCI DRIVER FOR SYNOPSIS DESIGNWARE |
7577 | M: Jingoo Han <jingoohan1@gmail.com> | 7577 | M: Jingoo Han <jingoohan1@gmail.com> |
7578 | M: Pratyush Anand <pratyush.anand@gmail.com> | ||
7578 | L: linux-pci@vger.kernel.org | 7579 | L: linux-pci@vger.kernel.org |
7579 | S: Maintained | 7580 | S: Maintained |
7580 | F: drivers/pci/host/*designware* | 7581 | F: drivers/pci/host/*designware* |
@@ -7588,8 +7589,9 @@ F: Documentation/devicetree/bindings/pci/host-generic-pci.txt | |||
7588 | F: drivers/pci/host/pci-host-generic.c | 7589 | F: drivers/pci/host/pci-host-generic.c |
7589 | 7590 | ||
7590 | PCIE DRIVER FOR ST SPEAR13XX | 7591 | PCIE DRIVER FOR ST SPEAR13XX |
7592 | M: Pratyush Anand <pratyush.anand@gmail.com> | ||
7591 | L: linux-pci@vger.kernel.org | 7593 | L: linux-pci@vger.kernel.org |
7592 | S: Orphan | 7594 | S: Maintained |
7593 | F: drivers/pci/host/*spear* | 7595 | F: drivers/pci/host/*spear* |
7594 | 7596 | ||
7595 | PCMCIA SUBSYSTEM | 7597 | PCMCIA SUBSYSTEM |
@@ -10587,8 +10589,7 @@ F: drivers/virtio/virtio_input.c | |||
10587 | F: include/uapi/linux/virtio_input.h | 10589 | F: include/uapi/linux/virtio_input.h |
10588 | 10590 | ||
10589 | VIA RHINE NETWORK DRIVER | 10591 | VIA RHINE NETWORK DRIVER |
10590 | M: Roger Luethi <rl@hellgate.ch> | 10592 | S: Orphan |
10591 | S: Maintained | ||
10592 | F: drivers/net/ethernet/via/via-rhine.c | 10593 | F: drivers/net/ethernet/via/via-rhine.c |
10593 | 10594 | ||
10594 | VIA SD/MMC CARD CONTROLLER DRIVER | 10595 | VIA SD/MMC CARD CONTROLLER DRIVER |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 1 | 2 | PATCHLEVEL = 1 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 15051e9c2c6f..b054c5c6e713 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c | |||
@@ -127,7 +127,7 @@ int smp_num_siblings = 1; | |||
127 | volatile int ia64_cpu_to_sapicid[NR_CPUS]; | 127 | volatile int ia64_cpu_to_sapicid[NR_CPUS]; |
128 | EXPORT_SYMBOL(ia64_cpu_to_sapicid); | 128 | EXPORT_SYMBOL(ia64_cpu_to_sapicid); |
129 | 129 | ||
130 | static volatile cpumask_t cpu_callin_map; | 130 | static cpumask_t cpu_callin_map; |
131 | 131 | ||
132 | struct smp_boot_data smp_boot_data __initdata; | 132 | struct smp_boot_data smp_boot_data __initdata; |
133 | 133 | ||
@@ -477,6 +477,7 @@ do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) | |||
477 | for (timeout = 0; timeout < 100000; timeout++) { | 477 | for (timeout = 0; timeout < 100000; timeout++) { |
478 | if (cpumask_test_cpu(cpu, &cpu_callin_map)) | 478 | if (cpumask_test_cpu(cpu, &cpu_callin_map)) |
479 | break; /* It has booted */ | 479 | break; /* It has booted */ |
480 | barrier(); /* Make sure we re-read cpu_callin_map */ | ||
480 | udelay(100); | 481 | udelay(100); |
481 | } | 482 | } |
482 | Dprintk("\n"); | 483 | Dprintk("\n"); |
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c index a73c93c3d44a..7fc8397d16f2 100644 --- a/arch/mips/ath79/setup.c +++ b/arch/mips/ath79/setup.c | |||
@@ -225,7 +225,7 @@ void __init plat_time_init(void) | |||
225 | ddr_clk_rate = ath79_get_sys_clk_rate("ddr"); | 225 | ddr_clk_rate = ath79_get_sys_clk_rate("ddr"); |
226 | ref_clk_rate = ath79_get_sys_clk_rate("ref"); | 226 | ref_clk_rate = ath79_get_sys_clk_rate("ref"); |
227 | 227 | ||
228 | pr_info("Clocks: CPU:%lu.%03luMHz, DDR:%lu.%03luMHz, AHB:%lu.%03luMHz, Ref:%lu.%03luMHz", | 228 | pr_info("Clocks: CPU:%lu.%03luMHz, DDR:%lu.%03luMHz, AHB:%lu.%03luMHz, Ref:%lu.%03luMHz\n", |
229 | cpu_clk_rate / 1000000, (cpu_clk_rate / 1000) % 1000, | 229 | cpu_clk_rate / 1000000, (cpu_clk_rate / 1000) % 1000, |
230 | ddr_clk_rate / 1000000, (ddr_clk_rate / 1000) % 1000, | 230 | ddr_clk_rate / 1000000, (ddr_clk_rate / 1000) % 1000, |
231 | ahb_clk_rate / 1000000, (ahb_clk_rate / 1000) % 1000, | 231 | ahb_clk_rate / 1000000, (ahb_clk_rate / 1000) % 1000, |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index e36515dcd3b2..209e5b76c1bc 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -74,13 +74,12 @@ static inline void cpu_set_fpu_fcsr_mask(struct cpuinfo_mips *c) | |||
74 | { | 74 | { |
75 | unsigned long sr, mask, fcsr, fcsr0, fcsr1; | 75 | unsigned long sr, mask, fcsr, fcsr0, fcsr1; |
76 | 76 | ||
77 | fcsr = c->fpu_csr31; | ||
77 | mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM; | 78 | mask = FPU_CSR_ALL_X | FPU_CSR_ALL_E | FPU_CSR_ALL_S | FPU_CSR_RM; |
78 | 79 | ||
79 | sr = read_c0_status(); | 80 | sr = read_c0_status(); |
80 | __enable_fpu(FPU_AS_IS); | 81 | __enable_fpu(FPU_AS_IS); |
81 | 82 | ||
82 | fcsr = read_32bit_cp1_register(CP1_STATUS); | ||
83 | |||
84 | fcsr0 = fcsr & mask; | 83 | fcsr0 = fcsr & mask; |
85 | write_32bit_cp1_register(CP1_STATUS, fcsr0); | 84 | write_32bit_cp1_register(CP1_STATUS, fcsr0); |
86 | fcsr0 = read_32bit_cp1_register(CP1_STATUS); | 85 | fcsr0 = read_32bit_cp1_register(CP1_STATUS); |
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index 51f57d841662..3c8a18a00a65 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c | |||
@@ -109,7 +109,7 @@ void __init init_IRQ(void) | |||
109 | #endif | 109 | #endif |
110 | } | 110 | } |
111 | 111 | ||
112 | #ifdef DEBUG_STACKOVERFLOW | 112 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
113 | static inline void check_stack_overflow(void) | 113 | static inline void check_stack_overflow(void) |
114 | { | 114 | { |
115 | unsigned long sp; | 115 | unsigned long sp; |
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c index 4b50c5787e25..d5fa3eaf39a1 100644 --- a/arch/mips/kvm/emulate.c +++ b/arch/mips/kvm/emulate.c | |||
@@ -2409,7 +2409,7 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, | |||
2409 | if (vcpu->mmio_needed == 2) | 2409 | if (vcpu->mmio_needed == 2) |
2410 | *gpr = *(int16_t *) run->mmio.data; | 2410 | *gpr = *(int16_t *) run->mmio.data; |
2411 | else | 2411 | else |
2412 | *gpr = *(int16_t *) run->mmio.data; | 2412 | *gpr = *(uint16_t *)run->mmio.data; |
2413 | 2413 | ||
2414 | break; | 2414 | break; |
2415 | case 1: | 2415 | case 1: |
diff --git a/arch/mips/loongson/loongson-3/smp.c b/arch/mips/loongson/loongson-3/smp.c index e3c68b5da18d..509877c6e9d9 100644 --- a/arch/mips/loongson/loongson-3/smp.c +++ b/arch/mips/loongson/loongson-3/smp.c | |||
@@ -272,7 +272,7 @@ void loongson3_ipi_interrupt(struct pt_regs *regs) | |||
272 | if (action & SMP_ASK_C0COUNT) { | 272 | if (action & SMP_ASK_C0COUNT) { |
273 | BUG_ON(cpu != 0); | 273 | BUG_ON(cpu != 0); |
274 | c0count = read_c0_count(); | 274 | c0count = read_c0_count(); |
275 | for (i = 1; i < loongson_sysconf.nr_cpus; i++) | 275 | for (i = 1; i < num_possible_cpus(); i++) |
276 | per_cpu(core0_c0count, i) = c0count; | 276 | per_cpu(core0_c0count, i) = c0count; |
277 | } | 277 | } |
278 | } | 278 | } |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 0dbb65a51ce5..2e03ab173591 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -1372,7 +1372,7 @@ static int probe_scache(void) | |||
1372 | scache_size = addr; | 1372 | scache_size = addr; |
1373 | c->scache.linesz = 16 << ((config & R4K_CONF_SB) >> 22); | 1373 | c->scache.linesz = 16 << ((config & R4K_CONF_SB) >> 22); |
1374 | c->scache.ways = 1; | 1374 | c->scache.ways = 1; |
1375 | c->dcache.waybit = 0; /* does not matter */ | 1375 | c->scache.waybit = 0; /* does not matter */ |
1376 | 1376 | ||
1377 | return 1; | 1377 | return 1; |
1378 | } | 1378 | } |
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c index 5d6139390bf8..e23fdf2a9c80 100644 --- a/arch/mips/net/bpf_jit.c +++ b/arch/mips/net/bpf_jit.c | |||
@@ -681,11 +681,7 @@ static unsigned int get_stack_depth(struct jit_ctx *ctx) | |||
681 | sp_off += config_enabled(CONFIG_64BIT) ? | 681 | sp_off += config_enabled(CONFIG_64BIT) ? |
682 | (ARGS_USED_BY_JIT + 1) * RSIZE : RSIZE; | 682 | (ARGS_USED_BY_JIT + 1) * RSIZE : RSIZE; |
683 | 683 | ||
684 | /* | 684 | return sp_off; |
685 | * Subtract the bytes for the last registers since we only care about | ||
686 | * the location on the stack pointer. | ||
687 | */ | ||
688 | return sp_off - RSIZE; | ||
689 | } | 685 | } |
690 | 686 | ||
691 | static void build_prologue(struct jit_ctx *ctx) | 687 | static void build_prologue(struct jit_ctx *ctx) |
diff --git a/arch/mips/ralink/ill_acc.c b/arch/mips/ralink/ill_acc.c index e20b02e3ae28..e10d10b9e82a 100644 --- a/arch/mips/ralink/ill_acc.c +++ b/arch/mips/ralink/ill_acc.c | |||
@@ -41,7 +41,7 @@ static irqreturn_t ill_acc_irq_handler(int irq, void *_priv) | |||
41 | addr, (type >> ILL_ACC_OFF_S) & ILL_ACC_OFF_M, | 41 | addr, (type >> ILL_ACC_OFF_S) & ILL_ACC_OFF_M, |
42 | type & ILL_ACC_LEN_M); | 42 | type & ILL_ACC_LEN_M); |
43 | 43 | ||
44 | rt_memc_w32(REG_ILL_ACC_TYPE, REG_ILL_ACC_TYPE); | 44 | rt_memc_w32(ILL_INT_STATUS, REG_ILL_ACC_TYPE); |
45 | 45 | ||
46 | return IRQ_HANDLED; | 46 | return IRQ_HANDLED; |
47 | } | 47 | } |
diff --git a/arch/sparc/include/asm/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h index a6e424d185d0..a6cfdabb6054 100644 --- a/arch/sparc/include/asm/cpudata_64.h +++ b/arch/sparc/include/asm/cpudata_64.h | |||
@@ -24,7 +24,8 @@ typedef struct { | |||
24 | unsigned int icache_line_size; | 24 | unsigned int icache_line_size; |
25 | unsigned int ecache_size; | 25 | unsigned int ecache_size; |
26 | unsigned int ecache_line_size; | 26 | unsigned int ecache_line_size; |
27 | int core_id; | 27 | unsigned short sock_id; |
28 | unsigned short core_id; | ||
28 | int proc_id; | 29 | int proc_id; |
29 | } cpuinfo_sparc; | 30 | } cpuinfo_sparc; |
30 | 31 | ||
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index dc165ebdf05a..2a52c91d2c8a 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h | |||
@@ -308,12 +308,26 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t prot) | |||
308 | " sllx %1, 32, %1\n" | 308 | " sllx %1, 32, %1\n" |
309 | " or %0, %1, %0\n" | 309 | " or %0, %1, %0\n" |
310 | " .previous\n" | 310 | " .previous\n" |
311 | " .section .sun_m7_2insn_patch, \"ax\"\n" | ||
312 | " .word 661b\n" | ||
313 | " sethi %%uhi(%4), %1\n" | ||
314 | " sethi %%hi(%4), %0\n" | ||
315 | " .word 662b\n" | ||
316 | " or %1, %%ulo(%4), %1\n" | ||
317 | " or %0, %%lo(%4), %0\n" | ||
318 | " .word 663b\n" | ||
319 | " sllx %1, 32, %1\n" | ||
320 | " or %0, %1, %0\n" | ||
321 | " .previous\n" | ||
311 | : "=r" (mask), "=r" (tmp) | 322 | : "=r" (mask), "=r" (tmp) |
312 | : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | | 323 | : "i" (_PAGE_PADDR_4U | _PAGE_MODIFIED_4U | _PAGE_ACCESSED_4U | |
313 | _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | | 324 | _PAGE_CP_4U | _PAGE_CV_4U | _PAGE_E_4U | |
314 | _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U), | 325 | _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4U), |
315 | "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | | 326 | "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | |
316 | _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | | 327 | _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_E_4V | |
328 | _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V), | ||
329 | "i" (_PAGE_PADDR_4V | _PAGE_MODIFIED_4V | _PAGE_ACCESSED_4V | | ||
330 | _PAGE_CP_4V | _PAGE_E_4V | | ||
317 | _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V)); | 331 | _PAGE_SPECIAL | _PAGE_PMD_HUGE | _PAGE_SZALL_4V)); |
318 | 332 | ||
319 | return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); | 333 | return __pte((pte_val(pte) & mask) | (pgprot_val(prot) & ~mask)); |
@@ -342,9 +356,15 @@ static inline pgprot_t pgprot_noncached(pgprot_t prot) | |||
342 | " andn %0, %4, %0\n" | 356 | " andn %0, %4, %0\n" |
343 | " or %0, %5, %0\n" | 357 | " or %0, %5, %0\n" |
344 | " .previous\n" | 358 | " .previous\n" |
359 | " .section .sun_m7_2insn_patch, \"ax\"\n" | ||
360 | " .word 661b\n" | ||
361 | " andn %0, %6, %0\n" | ||
362 | " or %0, %5, %0\n" | ||
363 | " .previous\n" | ||
345 | : "=r" (val) | 364 | : "=r" (val) |
346 | : "0" (val), "i" (_PAGE_CP_4U | _PAGE_CV_4U), "i" (_PAGE_E_4U), | 365 | : "0" (val), "i" (_PAGE_CP_4U | _PAGE_CV_4U), "i" (_PAGE_E_4U), |
347 | "i" (_PAGE_CP_4V | _PAGE_CV_4V), "i" (_PAGE_E_4V)); | 366 | "i" (_PAGE_CP_4V | _PAGE_CV_4V), "i" (_PAGE_E_4V), |
367 | "i" (_PAGE_CP_4V)); | ||
348 | 368 | ||
349 | return __pgprot(val); | 369 | return __pgprot(val); |
350 | } | 370 | } |
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h index ed8f071132e4..d1761df5cca6 100644 --- a/arch/sparc/include/asm/topology_64.h +++ b/arch/sparc/include/asm/topology_64.h | |||
@@ -40,11 +40,12 @@ static inline int pcibus_to_node(struct pci_bus *pbus) | |||
40 | #ifdef CONFIG_SMP | 40 | #ifdef CONFIG_SMP |
41 | #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id) | 41 | #define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id) |
42 | #define topology_core_id(cpu) (cpu_data(cpu).core_id) | 42 | #define topology_core_id(cpu) (cpu_data(cpu).core_id) |
43 | #define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) | 43 | #define topology_core_cpumask(cpu) (&cpu_core_sib_map[cpu]) |
44 | #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) | 44 | #define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) |
45 | #endif /* CONFIG_SMP */ | 45 | #endif /* CONFIG_SMP */ |
46 | 46 | ||
47 | extern cpumask_t cpu_core_map[NR_CPUS]; | 47 | extern cpumask_t cpu_core_map[NR_CPUS]; |
48 | extern cpumask_t cpu_core_sib_map[NR_CPUS]; | ||
48 | static inline const struct cpumask *cpu_coregroup_mask(int cpu) | 49 | static inline const struct cpumask *cpu_coregroup_mask(int cpu) |
49 | { | 50 | { |
50 | return &cpu_core_map[cpu]; | 51 | return &cpu_core_map[cpu]; |
diff --git a/arch/sparc/include/asm/trap_block.h b/arch/sparc/include/asm/trap_block.h index 6fd4436d32f0..ec9c04de3664 100644 --- a/arch/sparc/include/asm/trap_block.h +++ b/arch/sparc/include/asm/trap_block.h | |||
@@ -79,6 +79,8 @@ struct sun4v_2insn_patch_entry { | |||
79 | }; | 79 | }; |
80 | extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch, | 80 | extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch, |
81 | __sun4v_2insn_patch_end; | 81 | __sun4v_2insn_patch_end; |
82 | extern struct sun4v_2insn_patch_entry __sun_m7_2insn_patch, | ||
83 | __sun_m7_2insn_patch_end; | ||
82 | 84 | ||
83 | 85 | ||
84 | #endif /* !(__ASSEMBLY__) */ | 86 | #endif /* !(__ASSEMBLY__) */ |
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index 07cc49e541f4..0f679421b468 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h | |||
@@ -69,6 +69,8 @@ void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *, | |||
69 | struct sun4v_1insn_patch_entry *); | 69 | struct sun4v_1insn_patch_entry *); |
70 | void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, | 70 | void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *, |
71 | struct sun4v_2insn_patch_entry *); | 71 | struct sun4v_2insn_patch_entry *); |
72 | void sun_m7_patch_2insn_range(struct sun4v_2insn_patch_entry *, | ||
73 | struct sun4v_2insn_patch_entry *); | ||
72 | extern unsigned int dcache_parity_tl1_occurred; | 74 | extern unsigned int dcache_parity_tl1_occurred; |
73 | extern unsigned int icache_parity_tl1_occurred; | 75 | extern unsigned int icache_parity_tl1_occurred; |
74 | 76 | ||
diff --git a/arch/sparc/kernel/leon_pci_grpci2.c b/arch/sparc/kernel/leon_pci_grpci2.c index 94e392bdee7d..814fb1729b12 100644 --- a/arch/sparc/kernel/leon_pci_grpci2.c +++ b/arch/sparc/kernel/leon_pci_grpci2.c | |||
@@ -723,7 +723,6 @@ static int grpci2_of_probe(struct platform_device *ofdev) | |||
723 | err = -ENOMEM; | 723 | err = -ENOMEM; |
724 | goto err1; | 724 | goto err1; |
725 | } | 725 | } |
726 | memset(grpci2priv, 0, sizeof(*grpci2priv)); | ||
727 | priv->regs = regs; | 726 | priv->regs = regs; |
728 | priv->irq = ofdev->archdata.irqs[0]; /* BASE IRQ */ | 727 | priv->irq = ofdev->archdata.irqs[0]; /* BASE IRQ */ |
729 | priv->irq_mode = (capability & STS_IRQMODE) >> STS_IRQMODE_BIT; | 728 | priv->irq_mode = (capability & STS_IRQMODE) >> STS_IRQMODE_BIT; |
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 26c80e18d7b1..6f80936e0eea 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c | |||
@@ -614,45 +614,68 @@ static void fill_in_one_cache(cpuinfo_sparc *c, struct mdesc_handle *hp, u64 mp) | |||
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | static void mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id) | 617 | static void find_back_node_value(struct mdesc_handle *hp, u64 node, |
618 | char *srch_val, | ||
619 | void (*func)(struct mdesc_handle *, u64, int), | ||
620 | u64 val, int depth) | ||
618 | { | 621 | { |
619 | u64 a; | 622 | u64 arc; |
620 | |||
621 | mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { | ||
622 | u64 t = mdesc_arc_target(hp, a); | ||
623 | const char *name; | ||
624 | const u64 *id; | ||
625 | 623 | ||
626 | name = mdesc_node_name(hp, t); | 624 | /* Since we have an estimate of recursion depth, do a sanity check. */ |
627 | if (!strcmp(name, "cpu")) { | 625 | if (depth == 0) |
628 | id = mdesc_get_property(hp, t, "id", NULL); | 626 | return; |
629 | if (*id < NR_CPUS) | ||
630 | cpu_data(*id).core_id = core_id; | ||
631 | } else { | ||
632 | u64 j; | ||
633 | 627 | ||
634 | mdesc_for_each_arc(j, hp, t, MDESC_ARC_TYPE_BACK) { | 628 | mdesc_for_each_arc(arc, hp, node, MDESC_ARC_TYPE_BACK) { |
635 | u64 n = mdesc_arc_target(hp, j); | 629 | u64 n = mdesc_arc_target(hp, arc); |
636 | const char *n_name; | 630 | const char *name = mdesc_node_name(hp, n); |
637 | 631 | ||
638 | n_name = mdesc_node_name(hp, n); | 632 | if (!strcmp(srch_val, name)) |
639 | if (strcmp(n_name, "cpu")) | 633 | (*func)(hp, n, val); |
640 | continue; | ||
641 | 634 | ||
642 | id = mdesc_get_property(hp, n, "id", NULL); | 635 | find_back_node_value(hp, n, srch_val, func, val, depth-1); |
643 | if (*id < NR_CPUS) | ||
644 | cpu_data(*id).core_id = core_id; | ||
645 | } | ||
646 | } | ||
647 | } | 636 | } |
648 | } | 637 | } |
649 | 638 | ||
639 | static void __mark_core_id(struct mdesc_handle *hp, u64 node, | ||
640 | int core_id) | ||
641 | { | ||
642 | const u64 *id = mdesc_get_property(hp, node, "id", NULL); | ||
643 | |||
644 | if (*id < num_possible_cpus()) | ||
645 | cpu_data(*id).core_id = core_id; | ||
646 | } | ||
647 | |||
648 | static void __mark_sock_id(struct mdesc_handle *hp, u64 node, | ||
649 | int sock_id) | ||
650 | { | ||
651 | const u64 *id = mdesc_get_property(hp, node, "id", NULL); | ||
652 | |||
653 | if (*id < num_possible_cpus()) | ||
654 | cpu_data(*id).sock_id = sock_id; | ||
655 | } | ||
656 | |||
657 | static void mark_core_ids(struct mdesc_handle *hp, u64 mp, | ||
658 | int core_id) | ||
659 | { | ||
660 | find_back_node_value(hp, mp, "cpu", __mark_core_id, core_id, 10); | ||
661 | } | ||
662 | |||
663 | static void mark_sock_ids(struct mdesc_handle *hp, u64 mp, | ||
664 | int sock_id) | ||
665 | { | ||
666 | find_back_node_value(hp, mp, "cpu", __mark_sock_id, sock_id, 10); | ||
667 | } | ||
668 | |||
650 | static void set_core_ids(struct mdesc_handle *hp) | 669 | static void set_core_ids(struct mdesc_handle *hp) |
651 | { | 670 | { |
652 | int idx; | 671 | int idx; |
653 | u64 mp; | 672 | u64 mp; |
654 | 673 | ||
655 | idx = 1; | 674 | idx = 1; |
675 | |||
676 | /* Identify unique cores by looking for cpus backpointed to by | ||
677 | * level 1 instruction caches. | ||
678 | */ | ||
656 | mdesc_for_each_node_by_name(hp, mp, "cache") { | 679 | mdesc_for_each_node_by_name(hp, mp, "cache") { |
657 | const u64 *level; | 680 | const u64 *level; |
658 | const char *type; | 681 | const char *type; |
@@ -667,11 +690,72 @@ static void set_core_ids(struct mdesc_handle *hp) | |||
667 | continue; | 690 | continue; |
668 | 691 | ||
669 | mark_core_ids(hp, mp, idx); | 692 | mark_core_ids(hp, mp, idx); |
693 | idx++; | ||
694 | } | ||
695 | } | ||
696 | |||
697 | static int set_sock_ids_by_cache(struct mdesc_handle *hp, int level) | ||
698 | { | ||
699 | u64 mp; | ||
700 | int idx = 1; | ||
701 | int fnd = 0; | ||
702 | |||
703 | /* Identify unique sockets by looking for cpus backpointed to by | ||
704 | * shared level n caches. | ||
705 | */ | ||
706 | mdesc_for_each_node_by_name(hp, mp, "cache") { | ||
707 | const u64 *cur_lvl; | ||
708 | |||
709 | cur_lvl = mdesc_get_property(hp, mp, "level", NULL); | ||
710 | if (*cur_lvl != level) | ||
711 | continue; | ||
712 | |||
713 | mark_sock_ids(hp, mp, idx); | ||
714 | idx++; | ||
715 | fnd = 1; | ||
716 | } | ||
717 | return fnd; | ||
718 | } | ||
719 | |||
720 | static void set_sock_ids_by_socket(struct mdesc_handle *hp, u64 mp) | ||
721 | { | ||
722 | int idx = 1; | ||
670 | 723 | ||
724 | mdesc_for_each_node_by_name(hp, mp, "socket") { | ||
725 | u64 a; | ||
726 | |||
727 | mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_FWD) { | ||
728 | u64 t = mdesc_arc_target(hp, a); | ||
729 | const char *name; | ||
730 | const u64 *id; | ||
731 | |||
732 | name = mdesc_node_name(hp, t); | ||
733 | if (strcmp(name, "cpu")) | ||
734 | continue; | ||
735 | |||
736 | id = mdesc_get_property(hp, t, "id", NULL); | ||
737 | if (*id < num_possible_cpus()) | ||
738 | cpu_data(*id).sock_id = idx; | ||
739 | } | ||
671 | idx++; | 740 | idx++; |
672 | } | 741 | } |
673 | } | 742 | } |
674 | 743 | ||
744 | static void set_sock_ids(struct mdesc_handle *hp) | ||
745 | { | ||
746 | u64 mp; | ||
747 | |||
748 | /* If machine description exposes sockets data use it. | ||
749 | * Otherwise fallback to use shared L3 or L2 caches. | ||
750 | */ | ||
751 | mp = mdesc_node_by_name(hp, MDESC_NODE_NULL, "sockets"); | ||
752 | if (mp != MDESC_NODE_NULL) | ||
753 | return set_sock_ids_by_socket(hp, mp); | ||
754 | |||
755 | if (!set_sock_ids_by_cache(hp, 3)) | ||
756 | set_sock_ids_by_cache(hp, 2); | ||
757 | } | ||
758 | |||
675 | static void mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id) | 759 | static void mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id) |
676 | { | 760 | { |
677 | u64 a; | 761 | u64 a; |
@@ -707,7 +791,6 @@ static void __set_proc_ids(struct mdesc_handle *hp, const char *exec_unit_name) | |||
707 | continue; | 791 | continue; |
708 | 792 | ||
709 | mark_proc_ids(hp, mp, idx); | 793 | mark_proc_ids(hp, mp, idx); |
710 | |||
711 | idx++; | 794 | idx++; |
712 | } | 795 | } |
713 | } | 796 | } |
@@ -900,6 +983,7 @@ void mdesc_fill_in_cpu_data(cpumask_t *mask) | |||
900 | 983 | ||
901 | set_core_ids(hp); | 984 | set_core_ids(hp); |
902 | set_proc_ids(hp); | 985 | set_proc_ids(hp); |
986 | set_sock_ids(hp); | ||
903 | 987 | ||
904 | mdesc_release(hp); | 988 | mdesc_release(hp); |
905 | 989 | ||
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 6f7251fd2eab..c928bc64b4ba 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -1002,6 +1002,38 @@ static int __init pcibios_init(void) | |||
1002 | subsys_initcall(pcibios_init); | 1002 | subsys_initcall(pcibios_init); |
1003 | 1003 | ||
1004 | #ifdef CONFIG_SYSFS | 1004 | #ifdef CONFIG_SYSFS |
1005 | |||
1006 | #define SLOT_NAME_SIZE 11 /* Max decimal digits + null in u32 */ | ||
1007 | |||
1008 | static void pcie_bus_slot_names(struct pci_bus *pbus) | ||
1009 | { | ||
1010 | struct pci_dev *pdev; | ||
1011 | struct pci_bus *bus; | ||
1012 | |||
1013 | list_for_each_entry(pdev, &pbus->devices, bus_list) { | ||
1014 | char name[SLOT_NAME_SIZE]; | ||
1015 | struct pci_slot *pci_slot; | ||
1016 | const u32 *slot_num; | ||
1017 | int len; | ||
1018 | |||
1019 | slot_num = of_get_property(pdev->dev.of_node, | ||
1020 | "physical-slot#", &len); | ||
1021 | |||
1022 | if (slot_num == NULL || len != 4) | ||
1023 | continue; | ||
1024 | |||
1025 | snprintf(name, sizeof(name), "%u", slot_num[0]); | ||
1026 | pci_slot = pci_create_slot(pbus, slot_num[0], name, NULL); | ||
1027 | |||
1028 | if (IS_ERR(pci_slot)) | ||
1029 | pr_err("PCI: pci_create_slot returned %ld.\n", | ||
1030 | PTR_ERR(pci_slot)); | ||
1031 | } | ||
1032 | |||
1033 | list_for_each_entry(bus, &pbus->children, node) | ||
1034 | pcie_bus_slot_names(bus); | ||
1035 | } | ||
1036 | |||
1005 | static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus) | 1037 | static void pci_bus_slot_names(struct device_node *node, struct pci_bus *bus) |
1006 | { | 1038 | { |
1007 | const struct pci_slot_names { | 1039 | const struct pci_slot_names { |
@@ -1053,18 +1085,29 @@ static int __init of_pci_slot_init(void) | |||
1053 | 1085 | ||
1054 | while ((pbus = pci_find_next_bus(pbus)) != NULL) { | 1086 | while ((pbus = pci_find_next_bus(pbus)) != NULL) { |
1055 | struct device_node *node; | 1087 | struct device_node *node; |
1088 | struct pci_dev *pdev; | ||
1089 | |||
1090 | pdev = list_first_entry(&pbus->devices, struct pci_dev, | ||
1091 | bus_list); | ||
1056 | 1092 | ||
1057 | if (pbus->self) { | 1093 | if (pdev && pci_is_pcie(pdev)) { |
1058 | /* PCI->PCI bridge */ | 1094 | pcie_bus_slot_names(pbus); |
1059 | node = pbus->self->dev.of_node; | ||
1060 | } else { | 1095 | } else { |
1061 | struct pci_pbm_info *pbm = pbus->sysdata; | ||
1062 | 1096 | ||
1063 | /* Host PCI controller */ | 1097 | if (pbus->self) { |
1064 | node = pbm->op->dev.of_node; | 1098 | |
1065 | } | 1099 | /* PCI->PCI bridge */ |
1100 | node = pbus->self->dev.of_node; | ||
1101 | |||
1102 | } else { | ||
1103 | struct pci_pbm_info *pbm = pbus->sysdata; | ||
1066 | 1104 | ||
1067 | pci_bus_slot_names(node, pbus); | 1105 | /* Host PCI controller */ |
1106 | node = pbm->op->dev.of_node; | ||
1107 | } | ||
1108 | |||
1109 | pci_bus_slot_names(node, pbus); | ||
1110 | } | ||
1068 | } | 1111 | } |
1069 | 1112 | ||
1070 | return 0; | 1113 | return 0; |
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index c38d19fc27ba..f7b261749383 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c | |||
@@ -255,6 +255,24 @@ void sun4v_patch_2insn_range(struct sun4v_2insn_patch_entry *start, | |||
255 | } | 255 | } |
256 | } | 256 | } |
257 | 257 | ||
258 | void sun_m7_patch_2insn_range(struct sun4v_2insn_patch_entry *start, | ||
259 | struct sun4v_2insn_patch_entry *end) | ||
260 | { | ||
261 | while (start < end) { | ||
262 | unsigned long addr = start->addr; | ||
263 | |||
264 | *(unsigned int *) (addr + 0) = start->insns[0]; | ||
265 | wmb(); | ||
266 | __asm__ __volatile__("flush %0" : : "r" (addr + 0)); | ||
267 | |||
268 | *(unsigned int *) (addr + 4) = start->insns[1]; | ||
269 | wmb(); | ||
270 | __asm__ __volatile__("flush %0" : : "r" (addr + 4)); | ||
271 | |||
272 | start++; | ||
273 | } | ||
274 | } | ||
275 | |||
258 | static void __init sun4v_patch(void) | 276 | static void __init sun4v_patch(void) |
259 | { | 277 | { |
260 | extern void sun4v_hvapi_init(void); | 278 | extern void sun4v_hvapi_init(void); |
@@ -267,6 +285,9 @@ static void __init sun4v_patch(void) | |||
267 | 285 | ||
268 | sun4v_patch_2insn_range(&__sun4v_2insn_patch, | 286 | sun4v_patch_2insn_range(&__sun4v_2insn_patch, |
269 | &__sun4v_2insn_patch_end); | 287 | &__sun4v_2insn_patch_end); |
288 | if (sun4v_chip_type == SUN4V_CHIP_SPARC_M7) | ||
289 | sun_m7_patch_2insn_range(&__sun_m7_2insn_patch, | ||
290 | &__sun_m7_2insn_patch_end); | ||
270 | 291 | ||
271 | sun4v_hvapi_init(); | 292 | sun4v_hvapi_init(); |
272 | } | 293 | } |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 61139d9924ca..19cd08d18672 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -60,8 +60,12 @@ DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; | |||
60 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly = | 60 | cpumask_t cpu_core_map[NR_CPUS] __read_mostly = |
61 | { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; | 61 | { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; |
62 | 62 | ||
63 | cpumask_t cpu_core_sib_map[NR_CPUS] __read_mostly = { | ||
64 | [0 ... NR_CPUS-1] = CPU_MASK_NONE }; | ||
65 | |||
63 | EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); | 66 | EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); |
64 | EXPORT_SYMBOL(cpu_core_map); | 67 | EXPORT_SYMBOL(cpu_core_map); |
68 | EXPORT_SYMBOL(cpu_core_sib_map); | ||
65 | 69 | ||
66 | static cpumask_t smp_commenced_mask; | 70 | static cpumask_t smp_commenced_mask; |
67 | 71 | ||
@@ -1243,6 +1247,15 @@ void smp_fill_in_sib_core_maps(void) | |||
1243 | } | 1247 | } |
1244 | } | 1248 | } |
1245 | 1249 | ||
1250 | for_each_present_cpu(i) { | ||
1251 | unsigned int j; | ||
1252 | |||
1253 | for_each_present_cpu(j) { | ||
1254 | if (cpu_data(i).sock_id == cpu_data(j).sock_id) | ||
1255 | cpumask_set_cpu(j, &cpu_core_sib_map[i]); | ||
1256 | } | ||
1257 | } | ||
1258 | |||
1246 | for_each_present_cpu(i) { | 1259 | for_each_present_cpu(i) { |
1247 | unsigned int j; | 1260 | unsigned int j; |
1248 | 1261 | ||
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index 09243057cb0b..f1a2f688b28a 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S | |||
@@ -138,6 +138,11 @@ SECTIONS | |||
138 | *(.pause_3insn_patch) | 138 | *(.pause_3insn_patch) |
139 | __pause_3insn_patch_end = .; | 139 | __pause_3insn_patch_end = .; |
140 | } | 140 | } |
141 | .sun_m7_2insn_patch : { | ||
142 | __sun_m7_2insn_patch = .; | ||
143 | *(.sun_m7_2insn_patch) | ||
144 | __sun_m7_2insn_patch_end = .; | ||
145 | } | ||
141 | PERCPU_SECTION(SMP_CACHE_BYTES) | 146 | PERCPU_SECTION(SMP_CACHE_BYTES) |
142 | 147 | ||
143 | . = ALIGN(PAGE_SIZE); | 148 | . = ALIGN(PAGE_SIZE); |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 4ca0d6ba5ec8..559cb744112c 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include "init_64.h" | 54 | #include "init_64.h" |
55 | 55 | ||
56 | unsigned long kern_linear_pte_xor[4] __read_mostly; | 56 | unsigned long kern_linear_pte_xor[4] __read_mostly; |
57 | static unsigned long page_cache4v_flag; | ||
57 | 58 | ||
58 | /* A bitmap, two bits for every 256MB of physical memory. These two | 59 | /* A bitmap, two bits for every 256MB of physical memory. These two |
59 | * bits determine what page size we use for kernel linear | 60 | * bits determine what page size we use for kernel linear |
@@ -1909,11 +1910,24 @@ static void __init sun4u_linear_pte_xor_finalize(void) | |||
1909 | 1910 | ||
1910 | static void __init sun4v_linear_pte_xor_finalize(void) | 1911 | static void __init sun4v_linear_pte_xor_finalize(void) |
1911 | { | 1912 | { |
1913 | unsigned long pagecv_flag; | ||
1914 | |||
1915 | /* Bit 9 of TTE is no longer CV bit on M7 processor and it instead | ||
1916 | * enables MCD error. Do not set bit 9 on M7 processor. | ||
1917 | */ | ||
1918 | switch (sun4v_chip_type) { | ||
1919 | case SUN4V_CHIP_SPARC_M7: | ||
1920 | pagecv_flag = 0x00; | ||
1921 | break; | ||
1922 | default: | ||
1923 | pagecv_flag = _PAGE_CV_4V; | ||
1924 | break; | ||
1925 | } | ||
1912 | #ifndef CONFIG_DEBUG_PAGEALLOC | 1926 | #ifndef CONFIG_DEBUG_PAGEALLOC |
1913 | if (cpu_pgsz_mask & HV_PGSZ_MASK_256MB) { | 1927 | if (cpu_pgsz_mask & HV_PGSZ_MASK_256MB) { |
1914 | kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^ | 1928 | kern_linear_pte_xor[1] = (_PAGE_VALID | _PAGE_SZ256MB_4V) ^ |
1915 | PAGE_OFFSET; | 1929 | PAGE_OFFSET; |
1916 | kern_linear_pte_xor[1] |= (_PAGE_CP_4V | _PAGE_CV_4V | | 1930 | kern_linear_pte_xor[1] |= (_PAGE_CP_4V | pagecv_flag | |
1917 | _PAGE_P_4V | _PAGE_W_4V); | 1931 | _PAGE_P_4V | _PAGE_W_4V); |
1918 | } else { | 1932 | } else { |
1919 | kern_linear_pte_xor[1] = kern_linear_pte_xor[0]; | 1933 | kern_linear_pte_xor[1] = kern_linear_pte_xor[0]; |
@@ -1922,7 +1936,7 @@ static void __init sun4v_linear_pte_xor_finalize(void) | |||
1922 | if (cpu_pgsz_mask & HV_PGSZ_MASK_2GB) { | 1936 | if (cpu_pgsz_mask & HV_PGSZ_MASK_2GB) { |
1923 | kern_linear_pte_xor[2] = (_PAGE_VALID | _PAGE_SZ2GB_4V) ^ | 1937 | kern_linear_pte_xor[2] = (_PAGE_VALID | _PAGE_SZ2GB_4V) ^ |
1924 | PAGE_OFFSET; | 1938 | PAGE_OFFSET; |
1925 | kern_linear_pte_xor[2] |= (_PAGE_CP_4V | _PAGE_CV_4V | | 1939 | kern_linear_pte_xor[2] |= (_PAGE_CP_4V | pagecv_flag | |
1926 | _PAGE_P_4V | _PAGE_W_4V); | 1940 | _PAGE_P_4V | _PAGE_W_4V); |
1927 | } else { | 1941 | } else { |
1928 | kern_linear_pte_xor[2] = kern_linear_pte_xor[1]; | 1942 | kern_linear_pte_xor[2] = kern_linear_pte_xor[1]; |
@@ -1931,7 +1945,7 @@ static void __init sun4v_linear_pte_xor_finalize(void) | |||
1931 | if (cpu_pgsz_mask & HV_PGSZ_MASK_16GB) { | 1945 | if (cpu_pgsz_mask & HV_PGSZ_MASK_16GB) { |
1932 | kern_linear_pte_xor[3] = (_PAGE_VALID | _PAGE_SZ16GB_4V) ^ | 1946 | kern_linear_pte_xor[3] = (_PAGE_VALID | _PAGE_SZ16GB_4V) ^ |
1933 | PAGE_OFFSET; | 1947 | PAGE_OFFSET; |
1934 | kern_linear_pte_xor[3] |= (_PAGE_CP_4V | _PAGE_CV_4V | | 1948 | kern_linear_pte_xor[3] |= (_PAGE_CP_4V | pagecv_flag | |
1935 | _PAGE_P_4V | _PAGE_W_4V); | 1949 | _PAGE_P_4V | _PAGE_W_4V); |
1936 | } else { | 1950 | } else { |
1937 | kern_linear_pte_xor[3] = kern_linear_pte_xor[2]; | 1951 | kern_linear_pte_xor[3] = kern_linear_pte_xor[2]; |
@@ -1958,6 +1972,13 @@ static phys_addr_t __init available_memory(void) | |||
1958 | return available; | 1972 | return available; |
1959 | } | 1973 | } |
1960 | 1974 | ||
1975 | #define _PAGE_CACHE_4U (_PAGE_CP_4U | _PAGE_CV_4U) | ||
1976 | #define _PAGE_CACHE_4V (_PAGE_CP_4V | _PAGE_CV_4V) | ||
1977 | #define __DIRTY_BITS_4U (_PAGE_MODIFIED_4U | _PAGE_WRITE_4U | _PAGE_W_4U) | ||
1978 | #define __DIRTY_BITS_4V (_PAGE_MODIFIED_4V | _PAGE_WRITE_4V | _PAGE_W_4V) | ||
1979 | #define __ACCESS_BITS_4U (_PAGE_ACCESSED_4U | _PAGE_READ_4U | _PAGE_R) | ||
1980 | #define __ACCESS_BITS_4V (_PAGE_ACCESSED_4V | _PAGE_READ_4V | _PAGE_R) | ||
1981 | |||
1961 | /* We need to exclude reserved regions. This exclusion will include | 1982 | /* We need to exclude reserved regions. This exclusion will include |
1962 | * vmlinux and initrd. To be more precise the initrd size could be used to | 1983 | * vmlinux and initrd. To be more precise the initrd size could be used to |
1963 | * compute a new lower limit because it is freed later during initialization. | 1984 | * compute a new lower limit because it is freed later during initialization. |
@@ -2034,6 +2055,25 @@ void __init paging_init(void) | |||
2034 | memset(swapper_4m_tsb, 0x40, sizeof(swapper_4m_tsb)); | 2055 | memset(swapper_4m_tsb, 0x40, sizeof(swapper_4m_tsb)); |
2035 | #endif | 2056 | #endif |
2036 | 2057 | ||
2058 | /* TTE.cv bit on sparc v9 occupies the same position as TTE.mcde | ||
2059 | * bit on M7 processor. This is a conflicting usage of the same | ||
2060 | * bit. Enabling TTE.cv on M7 would turn on Memory Corruption | ||
2061 | * Detection error on all pages and this will lead to problems | ||
2062 | * later. Kernel does not run with MCD enabled and hence rest | ||
2063 | * of the required steps to fully configure memory corruption | ||
2064 | * detection are not taken. We need to ensure TTE.mcde is not | ||
2065 | * set on M7 processor. Compute the value of cacheability | ||
2066 | * flag for use later taking this into consideration. | ||
2067 | */ | ||
2068 | switch (sun4v_chip_type) { | ||
2069 | case SUN4V_CHIP_SPARC_M7: | ||
2070 | page_cache4v_flag = _PAGE_CP_4V; | ||
2071 | break; | ||
2072 | default: | ||
2073 | page_cache4v_flag = _PAGE_CACHE_4V; | ||
2074 | break; | ||
2075 | } | ||
2076 | |||
2037 | if (tlb_type == hypervisor) | 2077 | if (tlb_type == hypervisor) |
2038 | sun4v_pgprot_init(); | 2078 | sun4v_pgprot_init(); |
2039 | else | 2079 | else |
@@ -2274,13 +2314,6 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
2274 | } | 2314 | } |
2275 | #endif | 2315 | #endif |
2276 | 2316 | ||
2277 | #define _PAGE_CACHE_4U (_PAGE_CP_4U | _PAGE_CV_4U) | ||
2278 | #define _PAGE_CACHE_4V (_PAGE_CP_4V | _PAGE_CV_4V) | ||
2279 | #define __DIRTY_BITS_4U (_PAGE_MODIFIED_4U | _PAGE_WRITE_4U | _PAGE_W_4U) | ||
2280 | #define __DIRTY_BITS_4V (_PAGE_MODIFIED_4V | _PAGE_WRITE_4V | _PAGE_W_4V) | ||
2281 | #define __ACCESS_BITS_4U (_PAGE_ACCESSED_4U | _PAGE_READ_4U | _PAGE_R) | ||
2282 | #define __ACCESS_BITS_4V (_PAGE_ACCESSED_4V | _PAGE_READ_4V | _PAGE_R) | ||
2283 | |||
2284 | pgprot_t PAGE_KERNEL __read_mostly; | 2317 | pgprot_t PAGE_KERNEL __read_mostly; |
2285 | EXPORT_SYMBOL(PAGE_KERNEL); | 2318 | EXPORT_SYMBOL(PAGE_KERNEL); |
2286 | 2319 | ||
@@ -2312,8 +2345,7 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, | |||
2312 | _PAGE_P_4U | _PAGE_W_4U); | 2345 | _PAGE_P_4U | _PAGE_W_4U); |
2313 | if (tlb_type == hypervisor) | 2346 | if (tlb_type == hypervisor) |
2314 | pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4V | | 2347 | pte_base = (_PAGE_VALID | _PAGE_SZ4MB_4V | |
2315 | _PAGE_CP_4V | _PAGE_CV_4V | | 2348 | page_cache4v_flag | _PAGE_P_4V | _PAGE_W_4V); |
2316 | _PAGE_P_4V | _PAGE_W_4V); | ||
2317 | 2349 | ||
2318 | pte_base |= _PAGE_PMD_HUGE; | 2350 | pte_base |= _PAGE_PMD_HUGE; |
2319 | 2351 | ||
@@ -2450,14 +2482,14 @@ static void __init sun4v_pgprot_init(void) | |||
2450 | int i; | 2482 | int i; |
2451 | 2483 | ||
2452 | PAGE_KERNEL = __pgprot (_PAGE_PRESENT_4V | _PAGE_VALID | | 2484 | PAGE_KERNEL = __pgprot (_PAGE_PRESENT_4V | _PAGE_VALID | |
2453 | _PAGE_CACHE_4V | _PAGE_P_4V | | 2485 | page_cache4v_flag | _PAGE_P_4V | |
2454 | __ACCESS_BITS_4V | __DIRTY_BITS_4V | | 2486 | __ACCESS_BITS_4V | __DIRTY_BITS_4V | |
2455 | _PAGE_EXEC_4V); | 2487 | _PAGE_EXEC_4V); |
2456 | PAGE_KERNEL_LOCKED = PAGE_KERNEL; | 2488 | PAGE_KERNEL_LOCKED = PAGE_KERNEL; |
2457 | 2489 | ||
2458 | _PAGE_IE = _PAGE_IE_4V; | 2490 | _PAGE_IE = _PAGE_IE_4V; |
2459 | _PAGE_E = _PAGE_E_4V; | 2491 | _PAGE_E = _PAGE_E_4V; |
2460 | _PAGE_CACHE = _PAGE_CACHE_4V; | 2492 | _PAGE_CACHE = page_cache4v_flag; |
2461 | 2493 | ||
2462 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2494 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2463 | kern_linear_pte_xor[0] = _PAGE_VALID ^ PAGE_OFFSET; | 2495 | kern_linear_pte_xor[0] = _PAGE_VALID ^ PAGE_OFFSET; |
@@ -2465,8 +2497,8 @@ static void __init sun4v_pgprot_init(void) | |||
2465 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^ | 2497 | kern_linear_pte_xor[0] = (_PAGE_VALID | _PAGE_SZ4MB_4V) ^ |
2466 | PAGE_OFFSET; | 2498 | PAGE_OFFSET; |
2467 | #endif | 2499 | #endif |
2468 | kern_linear_pte_xor[0] |= (_PAGE_CP_4V | _PAGE_CV_4V | | 2500 | kern_linear_pte_xor[0] |= (page_cache4v_flag | _PAGE_P_4V | |
2469 | _PAGE_P_4V | _PAGE_W_4V); | 2501 | _PAGE_W_4V); |
2470 | 2502 | ||
2471 | for (i = 1; i < 4; i++) | 2503 | for (i = 1; i < 4; i++) |
2472 | kern_linear_pte_xor[i] = kern_linear_pte_xor[0]; | 2504 | kern_linear_pte_xor[i] = kern_linear_pte_xor[0]; |
@@ -2479,12 +2511,12 @@ static void __init sun4v_pgprot_init(void) | |||
2479 | _PAGE_SZ4MB_4V | _PAGE_SZ512K_4V | | 2511 | _PAGE_SZ4MB_4V | _PAGE_SZ512K_4V | |
2480 | _PAGE_SZ64K_4V | _PAGE_SZ8K_4V); | 2512 | _PAGE_SZ64K_4V | _PAGE_SZ8K_4V); |
2481 | 2513 | ||
2482 | page_none = _PAGE_PRESENT_4V | _PAGE_ACCESSED_4V | _PAGE_CACHE_4V; | 2514 | page_none = _PAGE_PRESENT_4V | _PAGE_ACCESSED_4V | page_cache4v_flag; |
2483 | page_shared = (_PAGE_VALID | _PAGE_PRESENT_4V | _PAGE_CACHE_4V | | 2515 | page_shared = (_PAGE_VALID | _PAGE_PRESENT_4V | page_cache4v_flag | |
2484 | __ACCESS_BITS_4V | _PAGE_WRITE_4V | _PAGE_EXEC_4V); | 2516 | __ACCESS_BITS_4V | _PAGE_WRITE_4V | _PAGE_EXEC_4V); |
2485 | page_copy = (_PAGE_VALID | _PAGE_PRESENT_4V | _PAGE_CACHE_4V | | 2517 | page_copy = (_PAGE_VALID | _PAGE_PRESENT_4V | page_cache4v_flag | |
2486 | __ACCESS_BITS_4V | _PAGE_EXEC_4V); | 2518 | __ACCESS_BITS_4V | _PAGE_EXEC_4V); |
2487 | page_readonly = (_PAGE_VALID | _PAGE_PRESENT_4V | _PAGE_CACHE_4V | | 2519 | page_readonly = (_PAGE_VALID | _PAGE_PRESENT_4V | page_cache4v_flag | |
2488 | __ACCESS_BITS_4V | _PAGE_EXEC_4V); | 2520 | __ACCESS_BITS_4V | _PAGE_EXEC_4V); |
2489 | 2521 | ||
2490 | page_exec_bit = _PAGE_EXEC_4V; | 2522 | page_exec_bit = _PAGE_EXEC_4V; |
@@ -2542,7 +2574,7 @@ static unsigned long kern_large_tte(unsigned long paddr) | |||
2542 | _PAGE_EXEC_4U | _PAGE_L_4U | _PAGE_W_4U); | 2574 | _PAGE_EXEC_4U | _PAGE_L_4U | _PAGE_W_4U); |
2543 | if (tlb_type == hypervisor) | 2575 | if (tlb_type == hypervisor) |
2544 | val = (_PAGE_VALID | _PAGE_SZ4MB_4V | | 2576 | val = (_PAGE_VALID | _PAGE_SZ4MB_4V | |
2545 | _PAGE_CP_4V | _PAGE_CV_4V | _PAGE_P_4V | | 2577 | page_cache4v_flag | _PAGE_P_4V | |
2546 | _PAGE_EXEC_4V | _PAGE_W_4V); | 2578 | _PAGE_EXEC_4V | _PAGE_W_4V); |
2547 | 2579 | ||
2548 | return val | paddr; | 2580 | return val | paddr; |
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h index 89dd0d78013a..805d25ca5f1d 100644 --- a/arch/x86/boot/compressed/misc.h +++ b/arch/x86/boot/compressed/misc.h | |||
@@ -2,15 +2,14 @@ | |||
2 | #define BOOT_COMPRESSED_MISC_H | 2 | #define BOOT_COMPRESSED_MISC_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * we have to be careful, because no indirections are allowed here, and | 5 | * Special hack: we have to be careful, because no indirections are allowed here, |
6 | * paravirt_ops is a kind of one. As it will only run in baremetal anyway, | 6 | * and paravirt_ops is a kind of one. As it will only run in baremetal anyway, |
7 | * we just keep it from happening | 7 | * we just keep it from happening. (This list needs to be extended when new |
8 | * paravirt and debugging variants are added.) | ||
8 | */ | 9 | */ |
9 | #undef CONFIG_PARAVIRT | 10 | #undef CONFIG_PARAVIRT |
11 | #undef CONFIG_PARAVIRT_SPINLOCKS | ||
10 | #undef CONFIG_KASAN | 12 | #undef CONFIG_KASAN |
11 | #ifdef CONFIG_X86_32 | ||
12 | #define _ASM_X86_DESC_H 1 | ||
13 | #endif | ||
14 | 13 | ||
15 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
16 | #include <linux/screen_info.h> | 15 | #include <linux/screen_info.h> |
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h index 19507ffa5d28..5fabf1362942 100644 --- a/arch/x86/include/asm/ptrace.h +++ b/arch/x86/include/asm/ptrace.h | |||
@@ -107,7 +107,7 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) | |||
107 | static inline int user_mode(struct pt_regs *regs) | 107 | static inline int user_mode(struct pt_regs *regs) |
108 | { | 108 | { |
109 | #ifdef CONFIG_X86_32 | 109 | #ifdef CONFIG_X86_32 |
110 | return (regs->cs & SEGMENT_RPL_MASK) == USER_RPL; | 110 | return ((regs->cs & SEGMENT_RPL_MASK) | (regs->flags & X86_VM_MASK)) >= USER_RPL; |
111 | #else | 111 | #else |
112 | return !!(regs->cs & 3); | 112 | return !!(regs->cs & 3); |
113 | #endif | 113 | #endif |
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h index 5a9856eb12ba..7d5a1929d76b 100644 --- a/arch/x86/include/asm/segment.h +++ b/arch/x86/include/asm/segment.h | |||
@@ -231,11 +231,21 @@ | |||
231 | #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8) | 231 | #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES* 8) |
232 | 232 | ||
233 | #ifdef __KERNEL__ | 233 | #ifdef __KERNEL__ |
234 | |||
235 | /* | ||
236 | * early_idt_handler_array is an array of entry points referenced in the | ||
237 | * early IDT. For simplicity, it's a real array with one entry point | ||
238 | * every nine bytes. That leaves room for an optional 'push $0' if the | ||
239 | * vector has no error code (two bytes), a 'push $vector_number' (two | ||
240 | * bytes), and a jump to the common entry code (up to five bytes). | ||
241 | */ | ||
242 | #define EARLY_IDT_HANDLER_SIZE 9 | ||
243 | |||
234 | #ifndef __ASSEMBLY__ | 244 | #ifndef __ASSEMBLY__ |
235 | 245 | ||
236 | extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5]; | 246 | extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_SIZE]; |
237 | #ifdef CONFIG_TRACING | 247 | #ifdef CONFIG_TRACING |
238 | # define trace_early_idt_handlers early_idt_handlers | 248 | # define trace_early_idt_handler_array early_idt_handler_array |
239 | #endif | 249 | #endif |
240 | 250 | ||
241 | /* | 251 | /* |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 87848ebe2bb7..4f7001f28936 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -190,6 +190,7 @@ static bool check_hw_exists(void) | |||
190 | u64 val, val_fail, val_new= ~0; | 190 | u64 val, val_fail, val_new= ~0; |
191 | int i, reg, reg_fail, ret = 0; | 191 | int i, reg, reg_fail, ret = 0; |
192 | int bios_fail = 0; | 192 | int bios_fail = 0; |
193 | int reg_safe = -1; | ||
193 | 194 | ||
194 | /* | 195 | /* |
195 | * Check to see if the BIOS enabled any of the counters, if so | 196 | * Check to see if the BIOS enabled any of the counters, if so |
@@ -204,6 +205,8 @@ static bool check_hw_exists(void) | |||
204 | bios_fail = 1; | 205 | bios_fail = 1; |
205 | val_fail = val; | 206 | val_fail = val; |
206 | reg_fail = reg; | 207 | reg_fail = reg; |
208 | } else { | ||
209 | reg_safe = i; | ||
207 | } | 210 | } |
208 | } | 211 | } |
209 | 212 | ||
@@ -222,11 +225,22 @@ static bool check_hw_exists(void) | |||
222 | } | 225 | } |
223 | 226 | ||
224 | /* | 227 | /* |
228 | * If all the counters are enabled, the below test will always | ||
229 | * fail. The tools will also become useless in this scenario. | ||
230 | * Just fail and disable the hardware counters. | ||
231 | */ | ||
232 | |||
233 | if (reg_safe == -1) { | ||
234 | reg = reg_safe; | ||
235 | goto msr_fail; | ||
236 | } | ||
237 | |||
238 | /* | ||
225 | * Read the current value, change it and read it back to see if it | 239 | * Read the current value, change it and read it back to see if it |
226 | * matches, this is needed to detect certain hardware emulators | 240 | * matches, this is needed to detect certain hardware emulators |
227 | * (qemu/kvm) that don't trap on the MSR access and always return 0s. | 241 | * (qemu/kvm) that don't trap on the MSR access and always return 0s. |
228 | */ | 242 | */ |
229 | reg = x86_pmu_event_addr(0); | 243 | reg = x86_pmu_event_addr(reg_safe); |
230 | if (rdmsrl_safe(reg, &val)) | 244 | if (rdmsrl_safe(reg, &val)) |
231 | goto msr_fail; | 245 | goto msr_fail; |
232 | val ^= 0xffffUL; | 246 | val ^= 0xffffUL; |
@@ -611,6 +625,7 @@ struct sched_state { | |||
611 | int event; /* event index */ | 625 | int event; /* event index */ |
612 | int counter; /* counter index */ | 626 | int counter; /* counter index */ |
613 | int unassigned; /* number of events to be assigned left */ | 627 | int unassigned; /* number of events to be assigned left */ |
628 | int nr_gp; /* number of GP counters used */ | ||
614 | unsigned long used[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; | 629 | unsigned long used[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; |
615 | }; | 630 | }; |
616 | 631 | ||
@@ -620,27 +635,29 @@ struct sched_state { | |||
620 | struct perf_sched { | 635 | struct perf_sched { |
621 | int max_weight; | 636 | int max_weight; |
622 | int max_events; | 637 | int max_events; |
623 | struct perf_event **events; | 638 | int max_gp; |
624 | struct sched_state state; | ||
625 | int saved_states; | 639 | int saved_states; |
640 | struct event_constraint **constraints; | ||
641 | struct sched_state state; | ||
626 | struct sched_state saved[SCHED_STATES_MAX]; | 642 | struct sched_state saved[SCHED_STATES_MAX]; |
627 | }; | 643 | }; |
628 | 644 | ||
629 | /* | 645 | /* |
630 | * Initialize interator that runs through all events and counters. | 646 | * Initialize interator that runs through all events and counters. |
631 | */ | 647 | */ |
632 | static void perf_sched_init(struct perf_sched *sched, struct perf_event **events, | 648 | static void perf_sched_init(struct perf_sched *sched, struct event_constraint **constraints, |
633 | int num, int wmin, int wmax) | 649 | int num, int wmin, int wmax, int gpmax) |
634 | { | 650 | { |
635 | int idx; | 651 | int idx; |
636 | 652 | ||
637 | memset(sched, 0, sizeof(*sched)); | 653 | memset(sched, 0, sizeof(*sched)); |
638 | sched->max_events = num; | 654 | sched->max_events = num; |
639 | sched->max_weight = wmax; | 655 | sched->max_weight = wmax; |
640 | sched->events = events; | 656 | sched->max_gp = gpmax; |
657 | sched->constraints = constraints; | ||
641 | 658 | ||
642 | for (idx = 0; idx < num; idx++) { | 659 | for (idx = 0; idx < num; idx++) { |
643 | if (events[idx]->hw.constraint->weight == wmin) | 660 | if (constraints[idx]->weight == wmin) |
644 | break; | 661 | break; |
645 | } | 662 | } |
646 | 663 | ||
@@ -687,7 +704,7 @@ static bool __perf_sched_find_counter(struct perf_sched *sched) | |||
687 | if (sched->state.event >= sched->max_events) | 704 | if (sched->state.event >= sched->max_events) |
688 | return false; | 705 | return false; |
689 | 706 | ||
690 | c = sched->events[sched->state.event]->hw.constraint; | 707 | c = sched->constraints[sched->state.event]; |
691 | /* Prefer fixed purpose counters */ | 708 | /* Prefer fixed purpose counters */ |
692 | if (c->idxmsk64 & (~0ULL << INTEL_PMC_IDX_FIXED)) { | 709 | if (c->idxmsk64 & (~0ULL << INTEL_PMC_IDX_FIXED)) { |
693 | idx = INTEL_PMC_IDX_FIXED; | 710 | idx = INTEL_PMC_IDX_FIXED; |
@@ -696,11 +713,16 @@ static bool __perf_sched_find_counter(struct perf_sched *sched) | |||
696 | goto done; | 713 | goto done; |
697 | } | 714 | } |
698 | } | 715 | } |
716 | |||
699 | /* Grab the first unused counter starting with idx */ | 717 | /* Grab the first unused counter starting with idx */ |
700 | idx = sched->state.counter; | 718 | idx = sched->state.counter; |
701 | for_each_set_bit_from(idx, c->idxmsk, INTEL_PMC_IDX_FIXED) { | 719 | for_each_set_bit_from(idx, c->idxmsk, INTEL_PMC_IDX_FIXED) { |
702 | if (!__test_and_set_bit(idx, sched->state.used)) | 720 | if (!__test_and_set_bit(idx, sched->state.used)) { |
721 | if (sched->state.nr_gp++ >= sched->max_gp) | ||
722 | return false; | ||
723 | |||
703 | goto done; | 724 | goto done; |
725 | } | ||
704 | } | 726 | } |
705 | 727 | ||
706 | return false; | 728 | return false; |
@@ -745,7 +767,7 @@ static bool perf_sched_next_event(struct perf_sched *sched) | |||
745 | if (sched->state.weight > sched->max_weight) | 767 | if (sched->state.weight > sched->max_weight) |
746 | return false; | 768 | return false; |
747 | } | 769 | } |
748 | c = sched->events[sched->state.event]->hw.constraint; | 770 | c = sched->constraints[sched->state.event]; |
749 | } while (c->weight != sched->state.weight); | 771 | } while (c->weight != sched->state.weight); |
750 | 772 | ||
751 | sched->state.counter = 0; /* start with first counter */ | 773 | sched->state.counter = 0; /* start with first counter */ |
@@ -756,12 +778,12 @@ static bool perf_sched_next_event(struct perf_sched *sched) | |||
756 | /* | 778 | /* |
757 | * Assign a counter for each event. | 779 | * Assign a counter for each event. |
758 | */ | 780 | */ |
759 | int perf_assign_events(struct perf_event **events, int n, | 781 | int perf_assign_events(struct event_constraint **constraints, int n, |
760 | int wmin, int wmax, int *assign) | 782 | int wmin, int wmax, int gpmax, int *assign) |
761 | { | 783 | { |
762 | struct perf_sched sched; | 784 | struct perf_sched sched; |
763 | 785 | ||
764 | perf_sched_init(&sched, events, n, wmin, wmax); | 786 | perf_sched_init(&sched, constraints, n, wmin, wmax, gpmax); |
765 | 787 | ||
766 | do { | 788 | do { |
767 | if (!perf_sched_find_counter(&sched)) | 789 | if (!perf_sched_find_counter(&sched)) |
@@ -788,9 +810,9 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
788 | x86_pmu.start_scheduling(cpuc); | 810 | x86_pmu.start_scheduling(cpuc); |
789 | 811 | ||
790 | for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) { | 812 | for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) { |
791 | hwc = &cpuc->event_list[i]->hw; | 813 | cpuc->event_constraint[i] = NULL; |
792 | c = x86_pmu.get_event_constraints(cpuc, i, cpuc->event_list[i]); | 814 | c = x86_pmu.get_event_constraints(cpuc, i, cpuc->event_list[i]); |
793 | hwc->constraint = c; | 815 | cpuc->event_constraint[i] = c; |
794 | 816 | ||
795 | wmin = min(wmin, c->weight); | 817 | wmin = min(wmin, c->weight); |
796 | wmax = max(wmax, c->weight); | 818 | wmax = max(wmax, c->weight); |
@@ -801,7 +823,7 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
801 | */ | 823 | */ |
802 | for (i = 0; i < n; i++) { | 824 | for (i = 0; i < n; i++) { |
803 | hwc = &cpuc->event_list[i]->hw; | 825 | hwc = &cpuc->event_list[i]->hw; |
804 | c = hwc->constraint; | 826 | c = cpuc->event_constraint[i]; |
805 | 827 | ||
806 | /* never assigned */ | 828 | /* never assigned */ |
807 | if (hwc->idx == -1) | 829 | if (hwc->idx == -1) |
@@ -821,9 +843,26 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
821 | } | 843 | } |
822 | 844 | ||
823 | /* slow path */ | 845 | /* slow path */ |
824 | if (i != n) | 846 | if (i != n) { |
825 | unsched = perf_assign_events(cpuc->event_list, n, wmin, | 847 | int gpmax = x86_pmu.num_counters; |
826 | wmax, assign); | 848 | |
849 | /* | ||
850 | * Do not allow scheduling of more than half the available | ||
851 | * generic counters. | ||
852 | * | ||
853 | * This helps avoid counter starvation of sibling thread by | ||
854 | * ensuring at most half the counters cannot be in exclusive | ||
855 | * mode. There is no designated counters for the limits. Any | ||
856 | * N/2 counters can be used. This helps with events with | ||
857 | * specific counter constraints. | ||
858 | */ | ||
859 | if (is_ht_workaround_enabled() && !cpuc->is_fake && | ||
860 | READ_ONCE(cpuc->excl_cntrs->exclusive_present)) | ||
861 | gpmax /= 2; | ||
862 | |||
863 | unsched = perf_assign_events(cpuc->event_constraint, n, wmin, | ||
864 | wmax, gpmax, assign); | ||
865 | } | ||
827 | 866 | ||
828 | /* | 867 | /* |
829 | * In case of success (unsched = 0), mark events as committed, | 868 | * In case of success (unsched = 0), mark events as committed, |
@@ -840,7 +879,7 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
840 | e = cpuc->event_list[i]; | 879 | e = cpuc->event_list[i]; |
841 | e->hw.flags |= PERF_X86_EVENT_COMMITTED; | 880 | e->hw.flags |= PERF_X86_EVENT_COMMITTED; |
842 | if (x86_pmu.commit_scheduling) | 881 | if (x86_pmu.commit_scheduling) |
843 | x86_pmu.commit_scheduling(cpuc, e, assign[i]); | 882 | x86_pmu.commit_scheduling(cpuc, i, assign[i]); |
844 | } | 883 | } |
845 | } | 884 | } |
846 | 885 | ||
@@ -1292,8 +1331,10 @@ static void x86_pmu_del(struct perf_event *event, int flags) | |||
1292 | x86_pmu.put_event_constraints(cpuc, event); | 1331 | x86_pmu.put_event_constraints(cpuc, event); |
1293 | 1332 | ||
1294 | /* Delete the array entry. */ | 1333 | /* Delete the array entry. */ |
1295 | while (++i < cpuc->n_events) | 1334 | while (++i < cpuc->n_events) { |
1296 | cpuc->event_list[i-1] = cpuc->event_list[i]; | 1335 | cpuc->event_list[i-1] = cpuc->event_list[i]; |
1336 | cpuc->event_constraint[i-1] = cpuc->event_constraint[i]; | ||
1337 | } | ||
1297 | --cpuc->n_events; | 1338 | --cpuc->n_events; |
1298 | 1339 | ||
1299 | perf_event_update_userpage(event); | 1340 | perf_event_update_userpage(event); |
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 6ac5cb7a9e14..ef78516850fb 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -74,6 +74,7 @@ struct event_constraint { | |||
74 | #define PERF_X86_EVENT_EXCL 0x0040 /* HT exclusivity on counter */ | 74 | #define PERF_X86_EVENT_EXCL 0x0040 /* HT exclusivity on counter */ |
75 | #define PERF_X86_EVENT_DYNAMIC 0x0080 /* dynamic alloc'd constraint */ | 75 | #define PERF_X86_EVENT_DYNAMIC 0x0080 /* dynamic alloc'd constraint */ |
76 | #define PERF_X86_EVENT_RDPMC_ALLOWED 0x0100 /* grant rdpmc permission */ | 76 | #define PERF_X86_EVENT_RDPMC_ALLOWED 0x0100 /* grant rdpmc permission */ |
77 | #define PERF_X86_EVENT_EXCL_ACCT 0x0200 /* accounted EXCL event */ | ||
77 | 78 | ||
78 | 79 | ||
79 | struct amd_nb { | 80 | struct amd_nb { |
@@ -134,8 +135,6 @@ enum intel_excl_state_type { | |||
134 | struct intel_excl_states { | 135 | struct intel_excl_states { |
135 | enum intel_excl_state_type init_state[X86_PMC_IDX_MAX]; | 136 | enum intel_excl_state_type init_state[X86_PMC_IDX_MAX]; |
136 | enum intel_excl_state_type state[X86_PMC_IDX_MAX]; | 137 | enum intel_excl_state_type state[X86_PMC_IDX_MAX]; |
137 | int num_alloc_cntrs;/* #counters allocated */ | ||
138 | int max_alloc_cntrs;/* max #counters allowed */ | ||
139 | bool sched_started; /* true if scheduling has started */ | 138 | bool sched_started; /* true if scheduling has started */ |
140 | }; | 139 | }; |
141 | 140 | ||
@@ -144,6 +143,11 @@ struct intel_excl_cntrs { | |||
144 | 143 | ||
145 | struct intel_excl_states states[2]; | 144 | struct intel_excl_states states[2]; |
146 | 145 | ||
146 | union { | ||
147 | u16 has_exclusive[2]; | ||
148 | u32 exclusive_present; | ||
149 | }; | ||
150 | |||
147 | int refcnt; /* per-core: #HT threads */ | 151 | int refcnt; /* per-core: #HT threads */ |
148 | unsigned core_id; /* per-core: core id */ | 152 | unsigned core_id; /* per-core: core id */ |
149 | }; | 153 | }; |
@@ -172,7 +176,11 @@ struct cpu_hw_events { | |||
172 | added in the current transaction */ | 176 | added in the current transaction */ |
173 | int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */ | 177 | int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */ |
174 | u64 tags[X86_PMC_IDX_MAX]; | 178 | u64 tags[X86_PMC_IDX_MAX]; |
179 | |||
175 | struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */ | 180 | struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */ |
181 | struct event_constraint *event_constraint[X86_PMC_IDX_MAX]; | ||
182 | |||
183 | int n_excl; /* the number of exclusive events */ | ||
176 | 184 | ||
177 | unsigned int group_flag; | 185 | unsigned int group_flag; |
178 | int is_fake; | 186 | int is_fake; |
@@ -519,9 +527,7 @@ struct x86_pmu { | |||
519 | void (*put_event_constraints)(struct cpu_hw_events *cpuc, | 527 | void (*put_event_constraints)(struct cpu_hw_events *cpuc, |
520 | struct perf_event *event); | 528 | struct perf_event *event); |
521 | 529 | ||
522 | void (*commit_scheduling)(struct cpu_hw_events *cpuc, | 530 | void (*commit_scheduling)(struct cpu_hw_events *cpuc, int idx, int cntr); |
523 | struct perf_event *event, | ||
524 | int cntr); | ||
525 | 531 | ||
526 | void (*start_scheduling)(struct cpu_hw_events *cpuc); | 532 | void (*start_scheduling)(struct cpu_hw_events *cpuc); |
527 | 533 | ||
@@ -717,8 +723,8 @@ static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, | |||
717 | 723 | ||
718 | void x86_pmu_enable_all(int added); | 724 | void x86_pmu_enable_all(int added); |
719 | 725 | ||
720 | int perf_assign_events(struct perf_event **events, int n, | 726 | int perf_assign_events(struct event_constraint **constraints, int n, |
721 | int wmin, int wmax, int *assign); | 727 | int wmin, int wmax, int gpmax, int *assign); |
722 | int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign); | 728 | int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign); |
723 | 729 | ||
724 | void x86_pmu_stop(struct perf_event *event, int flags); | 730 | void x86_pmu_stop(struct perf_event *event, int flags); |
@@ -929,4 +935,8 @@ static inline struct intel_shared_regs *allocate_shared_regs(int cpu) | |||
929 | return NULL; | 935 | return NULL; |
930 | } | 936 | } |
931 | 937 | ||
938 | static inline int is_ht_workaround_enabled(void) | ||
939 | { | ||
940 | return 0; | ||
941 | } | ||
932 | #endif /* CONFIG_CPU_SUP_INTEL */ | 942 | #endif /* CONFIG_CPU_SUP_INTEL */ |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 3998131d1a68..a1e35c9f06b9 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1923,7 +1923,6 @@ intel_start_scheduling(struct cpu_hw_events *cpuc) | |||
1923 | xl = &excl_cntrs->states[tid]; | 1923 | xl = &excl_cntrs->states[tid]; |
1924 | 1924 | ||
1925 | xl->sched_started = true; | 1925 | xl->sched_started = true; |
1926 | xl->num_alloc_cntrs = 0; | ||
1927 | /* | 1926 | /* |
1928 | * lock shared state until we are done scheduling | 1927 | * lock shared state until we are done scheduling |
1929 | * in stop_event_scheduling() | 1928 | * in stop_event_scheduling() |
@@ -2000,6 +1999,11 @@ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, | |||
2000 | * across HT threads | 1999 | * across HT threads |
2001 | */ | 2000 | */ |
2002 | is_excl = c->flags & PERF_X86_EVENT_EXCL; | 2001 | is_excl = c->flags & PERF_X86_EVENT_EXCL; |
2002 | if (is_excl && !(event->hw.flags & PERF_X86_EVENT_EXCL_ACCT)) { | ||
2003 | event->hw.flags |= PERF_X86_EVENT_EXCL_ACCT; | ||
2004 | if (!cpuc->n_excl++) | ||
2005 | WRITE_ONCE(excl_cntrs->has_exclusive[tid], 1); | ||
2006 | } | ||
2003 | 2007 | ||
2004 | /* | 2008 | /* |
2005 | * xl = state of current HT | 2009 | * xl = state of current HT |
@@ -2008,18 +2012,6 @@ intel_get_excl_constraints(struct cpu_hw_events *cpuc, struct perf_event *event, | |||
2008 | xl = &excl_cntrs->states[tid]; | 2012 | xl = &excl_cntrs->states[tid]; |
2009 | xlo = &excl_cntrs->states[o_tid]; | 2013 | xlo = &excl_cntrs->states[o_tid]; |
2010 | 2014 | ||
2011 | /* | ||
2012 | * do not allow scheduling of more than max_alloc_cntrs | ||
2013 | * which is set to half the available generic counters. | ||
2014 | * this helps avoid counter starvation of sibling thread | ||
2015 | * by ensuring at most half the counters cannot be in | ||
2016 | * exclusive mode. There is not designated counters for the | ||
2017 | * limits. Any N/2 counters can be used. This helps with | ||
2018 | * events with specifix counter constraints | ||
2019 | */ | ||
2020 | if (xl->num_alloc_cntrs++ == xl->max_alloc_cntrs) | ||
2021 | return &emptyconstraint; | ||
2022 | |||
2023 | cx = c; | 2015 | cx = c; |
2024 | 2016 | ||
2025 | /* | 2017 | /* |
@@ -2106,7 +2098,7 @@ static struct event_constraint * | |||
2106 | intel_get_event_constraints(struct cpu_hw_events *cpuc, int idx, | 2098 | intel_get_event_constraints(struct cpu_hw_events *cpuc, int idx, |
2107 | struct perf_event *event) | 2099 | struct perf_event *event) |
2108 | { | 2100 | { |
2109 | struct event_constraint *c1 = event->hw.constraint; | 2101 | struct event_constraint *c1 = cpuc->event_constraint[idx]; |
2110 | struct event_constraint *c2; | 2102 | struct event_constraint *c2; |
2111 | 2103 | ||
2112 | /* | 2104 | /* |
@@ -2150,6 +2142,11 @@ static void intel_put_excl_constraints(struct cpu_hw_events *cpuc, | |||
2150 | 2142 | ||
2151 | xl = &excl_cntrs->states[tid]; | 2143 | xl = &excl_cntrs->states[tid]; |
2152 | xlo = &excl_cntrs->states[o_tid]; | 2144 | xlo = &excl_cntrs->states[o_tid]; |
2145 | if (hwc->flags & PERF_X86_EVENT_EXCL_ACCT) { | ||
2146 | hwc->flags &= ~PERF_X86_EVENT_EXCL_ACCT; | ||
2147 | if (!--cpuc->n_excl) | ||
2148 | WRITE_ONCE(excl_cntrs->has_exclusive[tid], 0); | ||
2149 | } | ||
2153 | 2150 | ||
2154 | /* | 2151 | /* |
2155 | * put_constraint may be called from x86_schedule_events() | 2152 | * put_constraint may be called from x86_schedule_events() |
@@ -2188,8 +2185,6 @@ intel_put_shared_regs_event_constraints(struct cpu_hw_events *cpuc, | |||
2188 | static void intel_put_event_constraints(struct cpu_hw_events *cpuc, | 2185 | static void intel_put_event_constraints(struct cpu_hw_events *cpuc, |
2189 | struct perf_event *event) | 2186 | struct perf_event *event) |
2190 | { | 2187 | { |
2191 | struct event_constraint *c = event->hw.constraint; | ||
2192 | |||
2193 | intel_put_shared_regs_event_constraints(cpuc, event); | 2188 | intel_put_shared_regs_event_constraints(cpuc, event); |
2194 | 2189 | ||
2195 | /* | 2190 | /* |
@@ -2197,19 +2192,14 @@ static void intel_put_event_constraints(struct cpu_hw_events *cpuc, | |||
2197 | * all events are subject to and must call the | 2192 | * all events are subject to and must call the |
2198 | * put_excl_constraints() routine | 2193 | * put_excl_constraints() routine |
2199 | */ | 2194 | */ |
2200 | if (c && cpuc->excl_cntrs) | 2195 | if (cpuc->excl_cntrs) |
2201 | intel_put_excl_constraints(cpuc, event); | 2196 | intel_put_excl_constraints(cpuc, event); |
2202 | |||
2203 | /* cleanup dynamic constraint */ | ||
2204 | if (c && (c->flags & PERF_X86_EVENT_DYNAMIC)) | ||
2205 | event->hw.constraint = NULL; | ||
2206 | } | 2197 | } |
2207 | 2198 | ||
2208 | static void intel_commit_scheduling(struct cpu_hw_events *cpuc, | 2199 | static void intel_commit_scheduling(struct cpu_hw_events *cpuc, int idx, int cntr) |
2209 | struct perf_event *event, int cntr) | ||
2210 | { | 2200 | { |
2211 | struct intel_excl_cntrs *excl_cntrs = cpuc->excl_cntrs; | 2201 | struct intel_excl_cntrs *excl_cntrs = cpuc->excl_cntrs; |
2212 | struct event_constraint *c = event->hw.constraint; | 2202 | struct event_constraint *c = cpuc->event_constraint[idx]; |
2213 | struct intel_excl_states *xlo, *xl; | 2203 | struct intel_excl_states *xlo, *xl; |
2214 | int tid = cpuc->excl_thread_id; | 2204 | int tid = cpuc->excl_thread_id; |
2215 | int o_tid = 1 - tid; | 2205 | int o_tid = 1 - tid; |
@@ -2639,8 +2629,6 @@ static void intel_pmu_cpu_starting(int cpu) | |||
2639 | cpuc->lbr_sel = &cpuc->shared_regs->regs[EXTRA_REG_LBR]; | 2629 | cpuc->lbr_sel = &cpuc->shared_regs->regs[EXTRA_REG_LBR]; |
2640 | 2630 | ||
2641 | if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { | 2631 | if (x86_pmu.flags & PMU_FL_EXCL_CNTRS) { |
2642 | int h = x86_pmu.num_counters >> 1; | ||
2643 | |||
2644 | for_each_cpu(i, topology_thread_cpumask(cpu)) { | 2632 | for_each_cpu(i, topology_thread_cpumask(cpu)) { |
2645 | struct intel_excl_cntrs *c; | 2633 | struct intel_excl_cntrs *c; |
2646 | 2634 | ||
@@ -2654,11 +2642,6 @@ static void intel_pmu_cpu_starting(int cpu) | |||
2654 | } | 2642 | } |
2655 | cpuc->excl_cntrs->core_id = core_id; | 2643 | cpuc->excl_cntrs->core_id = core_id; |
2656 | cpuc->excl_cntrs->refcnt++; | 2644 | cpuc->excl_cntrs->refcnt++; |
2657 | /* | ||
2658 | * set hard limit to half the number of generic counters | ||
2659 | */ | ||
2660 | cpuc->excl_cntrs->states[0].max_alloc_cntrs = h; | ||
2661 | cpuc->excl_cntrs->states[1].max_alloc_cntrs = h; | ||
2662 | } | 2645 | } |
2663 | } | 2646 | } |
2664 | 2647 | ||
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 813f75d71175..7f73b3553e2e 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -706,9 +706,9 @@ void intel_pmu_pebs_disable(struct perf_event *event) | |||
706 | 706 | ||
707 | cpuc->pebs_enabled &= ~(1ULL << hwc->idx); | 707 | cpuc->pebs_enabled &= ~(1ULL << hwc->idx); |
708 | 708 | ||
709 | if (event->hw.constraint->flags & PERF_X86_EVENT_PEBS_LDLAT) | 709 | if (event->hw.flags & PERF_X86_EVENT_PEBS_LDLAT) |
710 | cpuc->pebs_enabled &= ~(1ULL << (hwc->idx + 32)); | 710 | cpuc->pebs_enabled &= ~(1ULL << (hwc->idx + 32)); |
711 | else if (event->hw.constraint->flags & PERF_X86_EVENT_PEBS_ST) | 711 | else if (event->hw.flags & PERF_X86_EVENT_PEBS_ST) |
712 | cpuc->pebs_enabled &= ~(1ULL << 63); | 712 | cpuc->pebs_enabled &= ~(1ULL << 63); |
713 | 713 | ||
714 | if (cpuc->enabled) | 714 | if (cpuc->enabled) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c index ffe666c2c6b5..123ff1bb2f60 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_pt.c +++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c | |||
@@ -151,7 +151,7 @@ static int __init pt_pmu_hw_init(void) | |||
151 | 151 | ||
152 | de_attr->attr.attr.name = pt_caps[i].name; | 152 | de_attr->attr.attr.name = pt_caps[i].name; |
153 | 153 | ||
154 | sysfs_attr_init(&de_attrs->attr.attr); | 154 | sysfs_attr_init(&de_attr->attr.attr); |
155 | 155 | ||
156 | de_attr->attr.attr.mode = S_IRUGO; | 156 | de_attr->attr.attr.mode = S_IRUGO; |
157 | de_attr->attr.show = pt_cap_show; | 157 | de_attr->attr.show = pt_cap_show; |
@@ -615,7 +615,8 @@ static int pt_buffer_reset_markers(struct pt_buffer *buf, | |||
615 | struct perf_output_handle *handle) | 615 | struct perf_output_handle *handle) |
616 | 616 | ||
617 | { | 617 | { |
618 | unsigned long idx, npages, end; | 618 | unsigned long head = local64_read(&buf->head); |
619 | unsigned long idx, npages, wakeup; | ||
619 | 620 | ||
620 | if (buf->snapshot) | 621 | if (buf->snapshot) |
621 | return 0; | 622 | return 0; |
@@ -634,17 +635,26 @@ static int pt_buffer_reset_markers(struct pt_buffer *buf, | |||
634 | buf->topa_index[buf->stop_pos]->stop = 0; | 635 | buf->topa_index[buf->stop_pos]->stop = 0; |
635 | buf->topa_index[buf->intr_pos]->intr = 0; | 636 | buf->topa_index[buf->intr_pos]->intr = 0; |
636 | 637 | ||
637 | if (pt_cap_get(PT_CAP_topa_multiple_entries)) { | 638 | /* how many pages till the STOP marker */ |
638 | npages = (handle->size + 1) >> PAGE_SHIFT; | 639 | npages = handle->size >> PAGE_SHIFT; |
639 | end = (local64_read(&buf->head) >> PAGE_SHIFT) + npages; | 640 | |
640 | /*if (end > handle->wakeup >> PAGE_SHIFT) | 641 | /* if it's on a page boundary, fill up one more page */ |
641 | end = handle->wakeup >> PAGE_SHIFT;*/ | 642 | if (!offset_in_page(head + handle->size + 1)) |
642 | idx = end & (buf->nr_pages - 1); | 643 | npages++; |
643 | buf->stop_pos = idx; | 644 | |
644 | idx = (local64_read(&buf->head) >> PAGE_SHIFT) + npages - 1; | 645 | idx = (head >> PAGE_SHIFT) + npages; |
645 | idx &= buf->nr_pages - 1; | 646 | idx &= buf->nr_pages - 1; |
646 | buf->intr_pos = idx; | 647 | buf->stop_pos = idx; |
647 | } | 648 | |
649 | wakeup = handle->wakeup >> PAGE_SHIFT; | ||
650 | |||
651 | /* in the worst case, wake up the consumer one page before hard stop */ | ||
652 | idx = (head >> PAGE_SHIFT) + npages - 1; | ||
653 | if (idx > wakeup) | ||
654 | idx = wakeup; | ||
655 | |||
656 | idx &= buf->nr_pages - 1; | ||
657 | buf->intr_pos = idx; | ||
648 | 658 | ||
649 | buf->topa_index[buf->stop_pos]->stop = 1; | 659 | buf->topa_index[buf->stop_pos]->stop = 1; |
650 | buf->topa_index[buf->intr_pos]->intr = 1; | 660 | buf->topa_index[buf->intr_pos]->intr = 1; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index c635b8b49e93..dd319e59246b 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -365,9 +365,8 @@ static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int | |||
365 | bitmap_zero(used_mask, UNCORE_PMC_IDX_MAX); | 365 | bitmap_zero(used_mask, UNCORE_PMC_IDX_MAX); |
366 | 366 | ||
367 | for (i = 0, wmin = UNCORE_PMC_IDX_MAX, wmax = 0; i < n; i++) { | 367 | for (i = 0, wmin = UNCORE_PMC_IDX_MAX, wmax = 0; i < n; i++) { |
368 | hwc = &box->event_list[i]->hw; | ||
369 | c = uncore_get_event_constraint(box, box->event_list[i]); | 368 | c = uncore_get_event_constraint(box, box->event_list[i]); |
370 | hwc->constraint = c; | 369 | box->event_constraint[i] = c; |
371 | wmin = min(wmin, c->weight); | 370 | wmin = min(wmin, c->weight); |
372 | wmax = max(wmax, c->weight); | 371 | wmax = max(wmax, c->weight); |
373 | } | 372 | } |
@@ -375,7 +374,7 @@ static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int | |||
375 | /* fastpath, try to reuse previous register */ | 374 | /* fastpath, try to reuse previous register */ |
376 | for (i = 0; i < n; i++) { | 375 | for (i = 0; i < n; i++) { |
377 | hwc = &box->event_list[i]->hw; | 376 | hwc = &box->event_list[i]->hw; |
378 | c = hwc->constraint; | 377 | c = box->event_constraint[i]; |
379 | 378 | ||
380 | /* never assigned */ | 379 | /* never assigned */ |
381 | if (hwc->idx == -1) | 380 | if (hwc->idx == -1) |
@@ -395,8 +394,8 @@ static int uncore_assign_events(struct intel_uncore_box *box, int assign[], int | |||
395 | } | 394 | } |
396 | /* slow path */ | 395 | /* slow path */ |
397 | if (i != n) | 396 | if (i != n) |
398 | ret = perf_assign_events(box->event_list, n, | 397 | ret = perf_assign_events(box->event_constraint, n, |
399 | wmin, wmax, assign); | 398 | wmin, wmax, n, assign); |
400 | 399 | ||
401 | if (!assign || ret) { | 400 | if (!assign || ret) { |
402 | for (i = 0; i < n; i++) | 401 | for (i = 0; i < n; i++) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h index 6c8c1e7e69d8..f789ec9a0133 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h | |||
@@ -97,6 +97,7 @@ struct intel_uncore_box { | |||
97 | atomic_t refcnt; | 97 | atomic_t refcnt; |
98 | struct perf_event *events[UNCORE_PMC_IDX_MAX]; | 98 | struct perf_event *events[UNCORE_PMC_IDX_MAX]; |
99 | struct perf_event *event_list[UNCORE_PMC_IDX_MAX]; | 99 | struct perf_event *event_list[UNCORE_PMC_IDX_MAX]; |
100 | struct event_constraint *event_constraint[UNCORE_PMC_IDX_MAX]; | ||
100 | unsigned long active_mask[BITS_TO_LONGS(UNCORE_PMC_IDX_MAX)]; | 101 | unsigned long active_mask[BITS_TO_LONGS(UNCORE_PMC_IDX_MAX)]; |
101 | u64 tags[UNCORE_PMC_IDX_MAX]; | 102 | u64 tags[UNCORE_PMC_IDX_MAX]; |
102 | struct pci_dev *pci_dev; | 103 | struct pci_dev *pci_dev; |
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 2b55ee6db053..5a4668136e98 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c | |||
@@ -167,7 +167,7 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) | |||
167 | clear_bss(); | 167 | clear_bss(); |
168 | 168 | ||
169 | for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) | 169 | for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) |
170 | set_intr_gate(i, early_idt_handlers[i]); | 170 | set_intr_gate(i, early_idt_handler_array[i]); |
171 | load_idt((const struct desc_ptr *)&idt_descr); | 171 | load_idt((const struct desc_ptr *)&idt_descr); |
172 | 172 | ||
173 | copy_bootdata(__va(real_mode_data)); | 173 | copy_bootdata(__va(real_mode_data)); |
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index d031bad9e07e..53eeb226657c 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S | |||
@@ -478,21 +478,22 @@ is486: | |||
478 | __INIT | 478 | __INIT |
479 | setup_once: | 479 | setup_once: |
480 | /* | 480 | /* |
481 | * Set up a idt with 256 entries pointing to ignore_int, | 481 | * Set up a idt with 256 interrupt gates that push zero if there |
482 | * interrupt gates. It doesn't actually load idt - that needs | 482 | * is no error code and then jump to early_idt_handler_common. |
483 | * to be done on each CPU. Interrupts are enabled elsewhere, | 483 | * It doesn't actually load the idt - that needs to be done on |
484 | * when we can be relatively sure everything is ok. | 484 | * each CPU. Interrupts are enabled elsewhere, when we can be |
485 | * relatively sure everything is ok. | ||
485 | */ | 486 | */ |
486 | 487 | ||
487 | movl $idt_table,%edi | 488 | movl $idt_table,%edi |
488 | movl $early_idt_handlers,%eax | 489 | movl $early_idt_handler_array,%eax |
489 | movl $NUM_EXCEPTION_VECTORS,%ecx | 490 | movl $NUM_EXCEPTION_VECTORS,%ecx |
490 | 1: | 491 | 1: |
491 | movl %eax,(%edi) | 492 | movl %eax,(%edi) |
492 | movl %eax,4(%edi) | 493 | movl %eax,4(%edi) |
493 | /* interrupt gate, dpl=0, present */ | 494 | /* interrupt gate, dpl=0, present */ |
494 | movl $(0x8E000000 + __KERNEL_CS),2(%edi) | 495 | movl $(0x8E000000 + __KERNEL_CS),2(%edi) |
495 | addl $9,%eax | 496 | addl $EARLY_IDT_HANDLER_SIZE,%eax |
496 | addl $8,%edi | 497 | addl $8,%edi |
497 | loop 1b | 498 | loop 1b |
498 | 499 | ||
@@ -524,26 +525,28 @@ setup_once: | |||
524 | andl $0,setup_once_ref /* Once is enough, thanks */ | 525 | andl $0,setup_once_ref /* Once is enough, thanks */ |
525 | ret | 526 | ret |
526 | 527 | ||
527 | ENTRY(early_idt_handlers) | 528 | ENTRY(early_idt_handler_array) |
528 | # 36(%esp) %eflags | 529 | # 36(%esp) %eflags |
529 | # 32(%esp) %cs | 530 | # 32(%esp) %cs |
530 | # 28(%esp) %eip | 531 | # 28(%esp) %eip |
531 | # 24(%rsp) error code | 532 | # 24(%rsp) error code |
532 | i = 0 | 533 | i = 0 |
533 | .rept NUM_EXCEPTION_VECTORS | 534 | .rept NUM_EXCEPTION_VECTORS |
534 | .if (EXCEPTION_ERRCODE_MASK >> i) & 1 | 535 | .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 |
535 | ASM_NOP2 | ||
536 | .else | ||
537 | pushl $0 # Dummy error code, to make stack frame uniform | 536 | pushl $0 # Dummy error code, to make stack frame uniform |
538 | .endif | 537 | .endif |
539 | pushl $i # 20(%esp) Vector number | 538 | pushl $i # 20(%esp) Vector number |
540 | jmp early_idt_handler | 539 | jmp early_idt_handler_common |
541 | i = i + 1 | 540 | i = i + 1 |
541 | .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc | ||
542 | .endr | 542 | .endr |
543 | ENDPROC(early_idt_handlers) | 543 | ENDPROC(early_idt_handler_array) |
544 | 544 | ||
545 | /* This is global to keep gas from relaxing the jumps */ | 545 | early_idt_handler_common: |
546 | ENTRY(early_idt_handler) | 546 | /* |
547 | * The stack is the hardware frame, an error code or zero, and the | ||
548 | * vector number. | ||
549 | */ | ||
547 | cld | 550 | cld |
548 | 551 | ||
549 | cmpl $2,(%esp) # X86_TRAP_NMI | 552 | cmpl $2,(%esp) # X86_TRAP_NMI |
@@ -603,7 +606,7 @@ ex_entry: | |||
603 | is_nmi: | 606 | is_nmi: |
604 | addl $8,%esp /* drop vector number and error code */ | 607 | addl $8,%esp /* drop vector number and error code */ |
605 | iret | 608 | iret |
606 | ENDPROC(early_idt_handler) | 609 | ENDPROC(early_idt_handler_common) |
607 | 610 | ||
608 | /* This is the default interrupt "handler" :-) */ | 611 | /* This is the default interrupt "handler" :-) */ |
609 | ALIGN | 612 | ALIGN |
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index ae6588b301c2..df7e78057ae0 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -321,26 +321,28 @@ bad_address: | |||
321 | jmp bad_address | 321 | jmp bad_address |
322 | 322 | ||
323 | __INIT | 323 | __INIT |
324 | .globl early_idt_handlers | 324 | ENTRY(early_idt_handler_array) |
325 | early_idt_handlers: | ||
326 | # 104(%rsp) %rflags | 325 | # 104(%rsp) %rflags |
327 | # 96(%rsp) %cs | 326 | # 96(%rsp) %cs |
328 | # 88(%rsp) %rip | 327 | # 88(%rsp) %rip |
329 | # 80(%rsp) error code | 328 | # 80(%rsp) error code |
330 | i = 0 | 329 | i = 0 |
331 | .rept NUM_EXCEPTION_VECTORS | 330 | .rept NUM_EXCEPTION_VECTORS |
332 | .if (EXCEPTION_ERRCODE_MASK >> i) & 1 | 331 | .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 |
333 | ASM_NOP2 | ||
334 | .else | ||
335 | pushq $0 # Dummy error code, to make stack frame uniform | 332 | pushq $0 # Dummy error code, to make stack frame uniform |
336 | .endif | 333 | .endif |
337 | pushq $i # 72(%rsp) Vector number | 334 | pushq $i # 72(%rsp) Vector number |
338 | jmp early_idt_handler | 335 | jmp early_idt_handler_common |
339 | i = i + 1 | 336 | i = i + 1 |
337 | .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc | ||
340 | .endr | 338 | .endr |
339 | ENDPROC(early_idt_handler_array) | ||
341 | 340 | ||
342 | /* This is global to keep gas from relaxing the jumps */ | 341 | early_idt_handler_common: |
343 | ENTRY(early_idt_handler) | 342 | /* |
343 | * The stack is the hardware frame, an error code or zero, and the | ||
344 | * vector number. | ||
345 | */ | ||
344 | cld | 346 | cld |
345 | 347 | ||
346 | cmpl $2,(%rsp) # X86_TRAP_NMI | 348 | cmpl $2,(%rsp) # X86_TRAP_NMI |
@@ -412,7 +414,7 @@ ENTRY(early_idt_handler) | |||
412 | is_nmi: | 414 | is_nmi: |
413 | addq $16,%rsp # drop vector number and error code | 415 | addq $16,%rsp # drop vector number and error code |
414 | INTERRUPT_RETURN | 416 | INTERRUPT_RETURN |
415 | ENDPROC(early_idt_handler) | 417 | ENDPROC(early_idt_handler_common) |
416 | 418 | ||
417 | __INITDATA | 419 | __INITDATA |
418 | 420 | ||
diff --git a/block/genhd.c b/block/genhd.c index 0a536dc05f3b..666e11b83983 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -653,7 +653,6 @@ void del_gendisk(struct gendisk *disk) | |||
653 | disk->flags &= ~GENHD_FL_UP; | 653 | disk->flags &= ~GENHD_FL_UP; |
654 | 654 | ||
655 | sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); | 655 | sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); |
656 | bdi_unregister(&disk->queue->backing_dev_info); | ||
657 | blk_unregister_queue(disk); | 656 | blk_unregister_queue(disk); |
658 | blk_unregister_region(disk_devt(disk), disk->minors); | 657 | blk_unregister_region(disk_devt(disk), disk->minors); |
659 | 658 | ||
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 23716dd8a7ec..5928d0746a27 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c | |||
@@ -45,7 +45,7 @@ static void ahci_mvebu_mbus_config(struct ahci_host_priv *hpriv, | |||
45 | writel((cs->mbus_attr << 8) | | 45 | writel((cs->mbus_attr << 8) | |
46 | (dram->mbus_dram_target_id << 4) | 1, | 46 | (dram->mbus_dram_target_id << 4) | 1, |
47 | hpriv->mmio + AHCI_WINDOW_CTRL(i)); | 47 | hpriv->mmio + AHCI_WINDOW_CTRL(i)); |
48 | writel(cs->base, hpriv->mmio + AHCI_WINDOW_BASE(i)); | 48 | writel(cs->base >> 16, hpriv->mmio + AHCI_WINDOW_BASE(i)); |
49 | writel(((cs->size - 1) & 0xffff0000), | 49 | writel(((cs->size - 1) & 0xffff0000), |
50 | hpriv->mmio + AHCI_WINDOW_SIZE(i)); | 50 | hpriv->mmio + AHCI_WINDOW_SIZE(i)); |
51 | } | 51 | } |
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index 80a80548ad0a..27245957eee3 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c | |||
@@ -1053,7 +1053,7 @@ static struct of_device_id octeon_cf_match[] = { | |||
1053 | }, | 1053 | }, |
1054 | {}, | 1054 | {}, |
1055 | }; | 1055 | }; |
1056 | MODULE_DEVICE_TABLE(of, octeon_i2c_match); | 1056 | MODULE_DEVICE_TABLE(of, octeon_cf_match); |
1057 | 1057 | ||
1058 | static struct platform_driver octeon_cf_driver = { | 1058 | static struct platform_driver octeon_cf_driver = { |
1059 | .probe = octeon_cf_probe, | 1059 | .probe = octeon_cf_probe, |
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 9c2ba1c97c42..df0c66cb7ad3 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c | |||
@@ -179,7 +179,7 @@ static int detect_cache_attributes(unsigned int cpu) | |||
179 | { | 179 | { |
180 | int ret; | 180 | int ret; |
181 | 181 | ||
182 | if (init_cache_level(cpu)) | 182 | if (init_cache_level(cpu) || !cache_leaves(cpu)) |
183 | return -ENOENT; | 183 | return -ENOENT; |
184 | 184 | ||
185 | per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu), | 185 | per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu), |
diff --git a/drivers/base/init.c b/drivers/base/init.c index da033d3bab3c..48c0e220acc0 100644 --- a/drivers/base/init.c +++ b/drivers/base/init.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/memory.h> | 10 | #include <linux/memory.h> |
11 | #include <linux/of.h> | ||
11 | 12 | ||
12 | #include "base.h" | 13 | #include "base.h" |
13 | 14 | ||
@@ -34,4 +35,5 @@ void __init driver_init(void) | |||
34 | cpu_dev_init(); | 35 | cpu_dev_init(); |
35 | memory_dev_init(); | 36 | memory_dev_init(); |
36 | container_dev_init(); | 37 | container_dev_init(); |
38 | of_core_init(); | ||
37 | } | 39 | } |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 85b8036deaa3..683dff272562 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1750,6 +1750,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1750 | struct nvme_iod *iod; | 1750 | struct nvme_iod *iod; |
1751 | dma_addr_t meta_dma = 0; | 1751 | dma_addr_t meta_dma = 0; |
1752 | void *meta = NULL; | 1752 | void *meta = NULL; |
1753 | void __user *metadata; | ||
1753 | 1754 | ||
1754 | if (copy_from_user(&io, uio, sizeof(io))) | 1755 | if (copy_from_user(&io, uio, sizeof(io))) |
1755 | return -EFAULT; | 1756 | return -EFAULT; |
@@ -1763,6 +1764,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1763 | meta_len = 0; | 1764 | meta_len = 0; |
1764 | } | 1765 | } |
1765 | 1766 | ||
1767 | metadata = (void __user *)(unsigned long)io.metadata; | ||
1768 | |||
1766 | write = io.opcode & 1; | 1769 | write = io.opcode & 1; |
1767 | 1770 | ||
1768 | switch (io.opcode) { | 1771 | switch (io.opcode) { |
@@ -1786,13 +1789,13 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1786 | if (meta_len) { | 1789 | if (meta_len) { |
1787 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, | 1790 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, |
1788 | &meta_dma, GFP_KERNEL); | 1791 | &meta_dma, GFP_KERNEL); |
1792 | |||
1789 | if (!meta) { | 1793 | if (!meta) { |
1790 | status = -ENOMEM; | 1794 | status = -ENOMEM; |
1791 | goto unmap; | 1795 | goto unmap; |
1792 | } | 1796 | } |
1793 | if (write) { | 1797 | if (write) { |
1794 | if (copy_from_user(meta, (void __user *)io.metadata, | 1798 | if (copy_from_user(meta, metadata, meta_len)) { |
1795 | meta_len)) { | ||
1796 | status = -EFAULT; | 1799 | status = -EFAULT; |
1797 | goto unmap; | 1800 | goto unmap; |
1798 | } | 1801 | } |
@@ -1819,8 +1822,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) | |||
1819 | nvme_free_iod(dev, iod); | 1822 | nvme_free_iod(dev, iod); |
1820 | if (meta) { | 1823 | if (meta) { |
1821 | if (status == NVME_SC_SUCCESS && !write) { | 1824 | if (status == NVME_SC_SUCCESS && !write) { |
1822 | if (copy_to_user((void __user *)io.metadata, meta, | 1825 | if (copy_to_user(metadata, meta, meta_len)) |
1823 | meta_len)) | ||
1824 | status = -EFAULT; | 1826 | status = -EFAULT; |
1825 | } | 1827 | } |
1826 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); | 1828 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); |
diff --git a/drivers/dma/hsu/hsu.c b/drivers/dma/hsu/hsu.c index 9b84def7a353..f42f71e37e73 100644 --- a/drivers/dma/hsu/hsu.c +++ b/drivers/dma/hsu/hsu.c | |||
@@ -384,7 +384,10 @@ static int hsu_dma_terminate_all(struct dma_chan *chan) | |||
384 | spin_lock_irqsave(&hsuc->vchan.lock, flags); | 384 | spin_lock_irqsave(&hsuc->vchan.lock, flags); |
385 | 385 | ||
386 | hsu_dma_stop_channel(hsuc); | 386 | hsu_dma_stop_channel(hsuc); |
387 | hsuc->desc = NULL; | 387 | if (hsuc->desc) { |
388 | hsu_dma_desc_free(&hsuc->desc->vdesc); | ||
389 | hsuc->desc = NULL; | ||
390 | } | ||
388 | 391 | ||
389 | vchan_get_all_descriptors(&hsuc->vchan, &head); | 392 | vchan_get_all_descriptors(&hsuc->vchan, &head); |
390 | spin_unlock_irqrestore(&hsuc->vchan.lock, flags); | 393 | spin_unlock_irqrestore(&hsuc->vchan.lock, flags); |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index a7d9d3029b14..340f9e607cd8 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2127,6 +2127,7 @@ static int pl330_terminate_all(struct dma_chan *chan) | |||
2127 | struct pl330_dmac *pl330 = pch->dmac; | 2127 | struct pl330_dmac *pl330 = pch->dmac; |
2128 | LIST_HEAD(list); | 2128 | LIST_HEAD(list); |
2129 | 2129 | ||
2130 | pm_runtime_get_sync(pl330->ddma.dev); | ||
2130 | spin_lock_irqsave(&pch->lock, flags); | 2131 | spin_lock_irqsave(&pch->lock, flags); |
2131 | spin_lock(&pl330->lock); | 2132 | spin_lock(&pl330->lock); |
2132 | _stop(pch->thread); | 2133 | _stop(pch->thread); |
@@ -2151,6 +2152,8 @@ static int pl330_terminate_all(struct dma_chan *chan) | |||
2151 | list_splice_tail_init(&pch->work_list, &pl330->desc_pool); | 2152 | list_splice_tail_init(&pch->work_list, &pl330->desc_pool); |
2152 | list_splice_tail_init(&pch->completed_list, &pl330->desc_pool); | 2153 | list_splice_tail_init(&pch->completed_list, &pl330->desc_pool); |
2153 | spin_unlock_irqrestore(&pch->lock, flags); | 2154 | spin_unlock_irqrestore(&pch->lock, flags); |
2155 | pm_runtime_mark_last_busy(pl330->ddma.dev); | ||
2156 | pm_runtime_put_autosuspend(pl330->ddma.dev); | ||
2154 | 2157 | ||
2155 | return 0; | 2158 | return 0; |
2156 | } | 2159 | } |
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index 071c2c969eec..72791232e46b 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c | |||
@@ -186,8 +186,20 @@ struct ibft_kobject { | |||
186 | 186 | ||
187 | static struct iscsi_boot_kset *boot_kset; | 187 | static struct iscsi_boot_kset *boot_kset; |
188 | 188 | ||
189 | /* fully null address */ | ||
189 | static const char nulls[16]; | 190 | static const char nulls[16]; |
190 | 191 | ||
192 | /* IPv4-mapped IPv6 ::ffff:0.0.0.0 */ | ||
193 | static const char mapped_nulls[16] = { 0x00, 0x00, 0x00, 0x00, | ||
194 | 0x00, 0x00, 0x00, 0x00, | ||
195 | 0x00, 0x00, 0xff, 0xff, | ||
196 | 0x00, 0x00, 0x00, 0x00 }; | ||
197 | |||
198 | static int address_not_null(u8 *ip) | ||
199 | { | ||
200 | return (memcmp(ip, nulls, 16) && memcmp(ip, mapped_nulls, 16)); | ||
201 | } | ||
202 | |||
191 | /* | 203 | /* |
192 | * Helper functions to parse data properly. | 204 | * Helper functions to parse data properly. |
193 | */ | 205 | */ |
@@ -445,7 +457,7 @@ static umode_t ibft_check_nic_for(void *data, int type) | |||
445 | rc = S_IRUGO; | 457 | rc = S_IRUGO; |
446 | break; | 458 | break; |
447 | case ISCSI_BOOT_ETH_IP_ADDR: | 459 | case ISCSI_BOOT_ETH_IP_ADDR: |
448 | if (memcmp(nic->ip_addr, nulls, sizeof(nic->ip_addr))) | 460 | if (address_not_null(nic->ip_addr)) |
449 | rc = S_IRUGO; | 461 | rc = S_IRUGO; |
450 | break; | 462 | break; |
451 | case ISCSI_BOOT_ETH_SUBNET_MASK: | 463 | case ISCSI_BOOT_ETH_SUBNET_MASK: |
@@ -456,21 +468,19 @@ static umode_t ibft_check_nic_for(void *data, int type) | |||
456 | rc = S_IRUGO; | 468 | rc = S_IRUGO; |
457 | break; | 469 | break; |
458 | case ISCSI_BOOT_ETH_GATEWAY: | 470 | case ISCSI_BOOT_ETH_GATEWAY: |
459 | if (memcmp(nic->gateway, nulls, sizeof(nic->gateway))) | 471 | if (address_not_null(nic->gateway)) |
460 | rc = S_IRUGO; | 472 | rc = S_IRUGO; |
461 | break; | 473 | break; |
462 | case ISCSI_BOOT_ETH_PRIMARY_DNS: | 474 | case ISCSI_BOOT_ETH_PRIMARY_DNS: |
463 | if (memcmp(nic->primary_dns, nulls, | 475 | if (address_not_null(nic->primary_dns)) |
464 | sizeof(nic->primary_dns))) | ||
465 | rc = S_IRUGO; | 476 | rc = S_IRUGO; |
466 | break; | 477 | break; |
467 | case ISCSI_BOOT_ETH_SECONDARY_DNS: | 478 | case ISCSI_BOOT_ETH_SECONDARY_DNS: |
468 | if (memcmp(nic->secondary_dns, nulls, | 479 | if (address_not_null(nic->secondary_dns)) |
469 | sizeof(nic->secondary_dns))) | ||
470 | rc = S_IRUGO; | 480 | rc = S_IRUGO; |
471 | break; | 481 | break; |
472 | case ISCSI_BOOT_ETH_DHCP: | 482 | case ISCSI_BOOT_ETH_DHCP: |
473 | if (memcmp(nic->dhcp, nulls, sizeof(nic->dhcp))) | 483 | if (address_not_null(nic->dhcp)) |
474 | rc = S_IRUGO; | 484 | rc = S_IRUGO; |
475 | break; | 485 | break; |
476 | case ISCSI_BOOT_ETH_VLAN: | 486 | case ISCSI_BOOT_ETH_VLAN: |
@@ -536,23 +546,19 @@ static umode_t __init ibft_check_initiator_for(void *data, int type) | |||
536 | rc = S_IRUGO; | 546 | rc = S_IRUGO; |
537 | break; | 547 | break; |
538 | case ISCSI_BOOT_INI_ISNS_SERVER: | 548 | case ISCSI_BOOT_INI_ISNS_SERVER: |
539 | if (memcmp(init->isns_server, nulls, | 549 | if (address_not_null(init->isns_server)) |
540 | sizeof(init->isns_server))) | ||
541 | rc = S_IRUGO; | 550 | rc = S_IRUGO; |
542 | break; | 551 | break; |
543 | case ISCSI_BOOT_INI_SLP_SERVER: | 552 | case ISCSI_BOOT_INI_SLP_SERVER: |
544 | if (memcmp(init->slp_server, nulls, | 553 | if (address_not_null(init->slp_server)) |
545 | sizeof(init->slp_server))) | ||
546 | rc = S_IRUGO; | 554 | rc = S_IRUGO; |
547 | break; | 555 | break; |
548 | case ISCSI_BOOT_INI_PRI_RADIUS_SERVER: | 556 | case ISCSI_BOOT_INI_PRI_RADIUS_SERVER: |
549 | if (memcmp(init->pri_radius_server, nulls, | 557 | if (address_not_null(init->pri_radius_server)) |
550 | sizeof(init->pri_radius_server))) | ||
551 | rc = S_IRUGO; | 558 | rc = S_IRUGO; |
552 | break; | 559 | break; |
553 | case ISCSI_BOOT_INI_SEC_RADIUS_SERVER: | 560 | case ISCSI_BOOT_INI_SEC_RADIUS_SERVER: |
554 | if (memcmp(init->sec_radius_server, nulls, | 561 | if (address_not_null(init->sec_radius_server)) |
555 | sizeof(init->sec_radius_server))) | ||
556 | rc = S_IRUGO; | 562 | rc = S_IRUGO; |
557 | break; | 563 | break; |
558 | case ISCSI_BOOT_INI_INITIATOR_NAME: | 564 | case ISCSI_BOOT_INI_INITIATOR_NAME: |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c index e469c4b2e8cc..c25728bc388a 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c | |||
@@ -684,8 +684,6 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, | |||
684 | dev->node_props.cpu_core_id_base); | 684 | dev->node_props.cpu_core_id_base); |
685 | sysfs_show_32bit_prop(buffer, "simd_id_base", | 685 | sysfs_show_32bit_prop(buffer, "simd_id_base", |
686 | dev->node_props.simd_id_base); | 686 | dev->node_props.simd_id_base); |
687 | sysfs_show_32bit_prop(buffer, "capability", | ||
688 | dev->node_props.capability); | ||
689 | sysfs_show_32bit_prop(buffer, "max_waves_per_simd", | 687 | sysfs_show_32bit_prop(buffer, "max_waves_per_simd", |
690 | dev->node_props.max_waves_per_simd); | 688 | dev->node_props.max_waves_per_simd); |
691 | sysfs_show_32bit_prop(buffer, "lds_size_in_kb", | 689 | sysfs_show_32bit_prop(buffer, "lds_size_in_kb", |
@@ -736,6 +734,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, | |||
736 | dev->gpu->kfd2kgd->get_fw_version( | 734 | dev->gpu->kfd2kgd->get_fw_version( |
737 | dev->gpu->kgd, | 735 | dev->gpu->kgd, |
738 | KGD_ENGINE_MEC1)); | 736 | KGD_ENGINE_MEC1)); |
737 | sysfs_show_32bit_prop(buffer, "capability", | ||
738 | dev->node_props.capability); | ||
739 | } | 739 | } |
740 | 740 | ||
741 | return sysfs_show_32bit_prop(buffer, "max_engine_clk_ccompute", | 741 | return sysfs_show_32bit_prop(buffer, "max_engine_clk_ccompute", |
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index ffc305fc2076..eb7e61078a5b 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -217,7 +217,7 @@ static ssize_t status_store(struct device *device, | |||
217 | 217 | ||
218 | mutex_unlock(&dev->mode_config.mutex); | 218 | mutex_unlock(&dev->mode_config.mutex); |
219 | 219 | ||
220 | return ret; | 220 | return ret ? ret : count; |
221 | } | 221 | } |
222 | 222 | ||
223 | static ssize_t status_show(struct device *device, | 223 | static ssize_t status_show(struct device *device, |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 007c7d7d8295..dc55c51964ab 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1667,12 +1667,15 @@ static int i915_sr_status(struct seq_file *m, void *unused) | |||
1667 | 1667 | ||
1668 | if (HAS_PCH_SPLIT(dev)) | 1668 | if (HAS_PCH_SPLIT(dev)) |
1669 | sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN; | 1669 | sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN; |
1670 | else if (IS_CRESTLINE(dev) || IS_I945G(dev) || IS_I945GM(dev)) | 1670 | else if (IS_CRESTLINE(dev) || IS_G4X(dev) || |
1671 | IS_I945G(dev) || IS_I945GM(dev)) | ||
1671 | sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN; | 1672 | sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN; |
1672 | else if (IS_I915GM(dev)) | 1673 | else if (IS_I915GM(dev)) |
1673 | sr_enabled = I915_READ(INSTPM) & INSTPM_SELF_EN; | 1674 | sr_enabled = I915_READ(INSTPM) & INSTPM_SELF_EN; |
1674 | else if (IS_PINEVIEW(dev)) | 1675 | else if (IS_PINEVIEW(dev)) |
1675 | sr_enabled = I915_READ(DSPFW3) & PINEVIEW_SELF_REFRESH_EN; | 1676 | sr_enabled = I915_READ(DSPFW3) & PINEVIEW_SELF_REFRESH_EN; |
1677 | else if (IS_VALLEYVIEW(dev)) | ||
1678 | sr_enabled = I915_READ(FW_BLC_SELF_VLV) & FW_CSPWRDWNEN; | ||
1676 | 1679 | ||
1677 | intel_runtime_pm_put(dev_priv); | 1680 | intel_runtime_pm_put(dev_priv); |
1678 | 1681 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 53394f998a1f..851b585987f9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2656,9 +2656,6 @@ void i915_gem_reset(struct drm_device *dev) | |||
2656 | void | 2656 | void |
2657 | i915_gem_retire_requests_ring(struct intel_engine_cs *ring) | 2657 | i915_gem_retire_requests_ring(struct intel_engine_cs *ring) |
2658 | { | 2658 | { |
2659 | if (list_empty(&ring->request_list)) | ||
2660 | return; | ||
2661 | |||
2662 | WARN_ON(i915_verify_lists(ring->dev)); | 2659 | WARN_ON(i915_verify_lists(ring->dev)); |
2663 | 2660 | ||
2664 | /* Retire requests first as we use it above for the early return. | 2661 | /* Retire requests first as we use it above for the early return. |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f27346e907b1..d714a4b5711e 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -880,10 +880,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
880 | DP_AUX_CH_CTL_RECEIVE_ERROR)) | 880 | DP_AUX_CH_CTL_RECEIVE_ERROR)) |
881 | continue; | 881 | continue; |
882 | if (status & DP_AUX_CH_CTL_DONE) | 882 | if (status & DP_AUX_CH_CTL_DONE) |
883 | break; | 883 | goto done; |
884 | } | 884 | } |
885 | if (status & DP_AUX_CH_CTL_DONE) | ||
886 | break; | ||
887 | } | 885 | } |
888 | 886 | ||
889 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { | 887 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { |
@@ -892,6 +890,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
892 | goto out; | 890 | goto out; |
893 | } | 891 | } |
894 | 892 | ||
893 | done: | ||
895 | /* Check for timeout or receive error. | 894 | /* Check for timeout or receive error. |
896 | * Timeouts occur when the sink is not connected | 895 | * Timeouts occur when the sink is not connected |
897 | */ | 896 | */ |
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 09df74b8e917..424e62197787 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c | |||
@@ -1134,6 +1134,12 @@ static int gen8_init_common_ring(struct intel_engine_cs *ring) | |||
1134 | I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask)); | 1134 | I915_WRITE_IMR(ring, ~(ring->irq_enable_mask | ring->irq_keep_mask)); |
1135 | I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff); | 1135 | I915_WRITE(RING_HWSTAM(ring->mmio_base), 0xffffffff); |
1136 | 1136 | ||
1137 | if (ring->status_page.obj) { | ||
1138 | I915_WRITE(RING_HWS_PGA(ring->mmio_base), | ||
1139 | (u32)ring->status_page.gfx_addr); | ||
1140 | POSTING_READ(RING_HWS_PGA(ring->mmio_base)); | ||
1141 | } | ||
1142 | |||
1137 | I915_WRITE(RING_MODE_GEN7(ring), | 1143 | I915_WRITE(RING_MODE_GEN7(ring), |
1138 | _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) | | 1144 | _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) | |
1139 | _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE)); | 1145 | _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE)); |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 441e2502b889..005b5e04de4d 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -901,13 +901,6 @@ static int chv_init_workarounds(struct intel_engine_cs *ring) | |||
901 | GEN6_WIZ_HASHING_MASK, | 901 | GEN6_WIZ_HASHING_MASK, |
902 | GEN6_WIZ_HASHING_16x4); | 902 | GEN6_WIZ_HASHING_16x4); |
903 | 903 | ||
904 | if (INTEL_REVID(dev) == SKL_REVID_C0 || | ||
905 | INTEL_REVID(dev) == SKL_REVID_D0) | ||
906 | /* WaBarrierPerformanceFixDisable:skl */ | ||
907 | WA_SET_BIT_MASKED(HDC_CHICKEN0, | ||
908 | HDC_FENCE_DEST_SLM_DISABLE | | ||
909 | HDC_BARRIER_PERFORMANCE_DISABLE); | ||
910 | |||
911 | return 0; | 904 | return 0; |
912 | } | 905 | } |
913 | 906 | ||
@@ -1024,6 +1017,13 @@ static int skl_init_workarounds(struct intel_engine_cs *ring) | |||
1024 | WA_SET_BIT_MASKED(HIZ_CHICKEN, | 1017 | WA_SET_BIT_MASKED(HIZ_CHICKEN, |
1025 | BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE); | 1018 | BDW_HIZ_POWER_COMPILER_CLOCK_GATING_DISABLE); |
1026 | 1019 | ||
1020 | if (INTEL_REVID(dev) == SKL_REVID_C0 || | ||
1021 | INTEL_REVID(dev) == SKL_REVID_D0) | ||
1022 | /* WaBarrierPerformanceFixDisable:skl */ | ||
1023 | WA_SET_BIT_MASKED(HDC_CHICKEN0, | ||
1024 | HDC_FENCE_DEST_SLM_DISABLE | | ||
1025 | HDC_BARRIER_PERFORMANCE_DISABLE); | ||
1026 | |||
1027 | return skl_tune_iz_hashing(ring); | 1027 | return skl_tune_iz_hashing(ring); |
1028 | } | 1028 | } |
1029 | 1029 | ||
diff --git a/drivers/gpu/drm/radeon/dce3_1_afmt.c b/drivers/gpu/drm/radeon/dce3_1_afmt.c index f04205170b8a..cfa3a84a2af0 100644 --- a/drivers/gpu/drm/radeon/dce3_1_afmt.c +++ b/drivers/gpu/drm/radeon/dce3_1_afmt.c | |||
@@ -173,7 +173,7 @@ void dce3_2_hdmi_update_acr(struct drm_encoder *encoder, long offset, | |||
173 | struct drm_device *dev = encoder->dev; | 173 | struct drm_device *dev = encoder->dev; |
174 | struct radeon_device *rdev = dev->dev_private; | 174 | struct radeon_device *rdev = dev->dev_private; |
175 | 175 | ||
176 | WREG32(HDMI0_ACR_PACKET_CONTROL + offset, | 176 | WREG32(DCE3_HDMI0_ACR_PACKET_CONTROL + offset, |
177 | HDMI0_ACR_SOURCE | /* select SW CTS value */ | 177 | HDMI0_ACR_SOURCE | /* select SW CTS value */ |
178 | HDMI0_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ | 178 | HDMI0_ACR_AUTO_SEND); /* allow hw to sent ACR packets when required */ |
179 | 179 | ||
diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c index 8fe78d08e01c..7c6966434ee7 100644 --- a/drivers/i2c/busses/i2c-hix5hd2.c +++ b/drivers/i2c/busses/i2c-hix5hd2.c | |||
@@ -554,4 +554,4 @@ module_platform_driver(hix5hd2_i2c_driver); | |||
554 | MODULE_DESCRIPTION("Hix5hd2 I2C Bus driver"); | 554 | MODULE_DESCRIPTION("Hix5hd2 I2C Bus driver"); |
555 | MODULE_AUTHOR("Wei Yan <sledge.yanwei@huawei.com>"); | 555 | MODULE_AUTHOR("Wei Yan <sledge.yanwei@huawei.com>"); |
556 | MODULE_LICENSE("GPL"); | 556 | MODULE_LICENSE("GPL"); |
557 | MODULE_ALIAS("platform:i2c-hix5hd2"); | 557 | MODULE_ALIAS("platform:hix5hd2-i2c"); |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 958c8db4ec30..297e9c9ac943 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -1143,6 +1143,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1143 | return -ENOMEM; | 1143 | return -ENOMEM; |
1144 | 1144 | ||
1145 | i2c->quirks = s3c24xx_get_device_quirks(pdev); | 1145 | i2c->quirks = s3c24xx_get_device_quirks(pdev); |
1146 | i2c->sysreg = ERR_PTR(-ENOENT); | ||
1146 | if (pdata) | 1147 | if (pdata) |
1147 | memcpy(i2c->pdata, pdata, sizeof(*pdata)); | 1148 | memcpy(i2c->pdata, pdata, sizeof(*pdata)); |
1148 | else | 1149 | else |
diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index 89d8aa1d2818..df12c57e6ce0 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c | |||
@@ -1001,7 +1001,7 @@ static struct platform_driver twl6030_gpadc_driver = { | |||
1001 | 1001 | ||
1002 | module_platform_driver(twl6030_gpadc_driver); | 1002 | module_platform_driver(twl6030_gpadc_driver); |
1003 | 1003 | ||
1004 | MODULE_ALIAS("platform: " DRIVER_NAME); | 1004 | MODULE_ALIAS("platform:" DRIVER_NAME); |
1005 | MODULE_AUTHOR("Balaji T K <balajitk@ti.com>"); | 1005 | MODULE_AUTHOR("Balaji T K <balajitk@ti.com>"); |
1006 | MODULE_AUTHOR("Graeme Gregory <gg@slimlogic.co.uk>"); | 1006 | MODULE_AUTHOR("Graeme Gregory <gg@slimlogic.co.uk>"); |
1007 | MODULE_AUTHOR("Oleksandr Kozaruk <oleksandr.kozaruk@ti.com"); | 1007 | MODULE_AUTHOR("Oleksandr Kozaruk <oleksandr.kozaruk@ti.com"); |
diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h index 0916bf6b6c31..73b189c1c0fb 100644 --- a/drivers/iio/imu/adis16400.h +++ b/drivers/iio/imu/adis16400.h | |||
@@ -139,6 +139,7 @@ | |||
139 | #define ADIS16400_NO_BURST BIT(1) | 139 | #define ADIS16400_NO_BURST BIT(1) |
140 | #define ADIS16400_HAS_SLOW_MODE BIT(2) | 140 | #define ADIS16400_HAS_SLOW_MODE BIT(2) |
141 | #define ADIS16400_HAS_SERIAL_NUMBER BIT(3) | 141 | #define ADIS16400_HAS_SERIAL_NUMBER BIT(3) |
142 | #define ADIS16400_BURST_DIAG_STAT BIT(4) | ||
142 | 143 | ||
143 | struct adis16400_state; | 144 | struct adis16400_state; |
144 | 145 | ||
@@ -165,6 +166,7 @@ struct adis16400_state { | |||
165 | int filt_int; | 166 | int filt_int; |
166 | 167 | ||
167 | struct adis adis; | 168 | struct adis adis; |
169 | unsigned long avail_scan_mask[2]; | ||
168 | }; | 170 | }; |
169 | 171 | ||
170 | /* At the moment triggers are only used for ring buffer | 172 | /* At the moment triggers are only used for ring buffer |
diff --git a/drivers/iio/imu/adis16400_buffer.c b/drivers/iio/imu/adis16400_buffer.c index 6e727ffe5262..90c24a23c679 100644 --- a/drivers/iio/imu/adis16400_buffer.c +++ b/drivers/iio/imu/adis16400_buffer.c | |||
@@ -18,7 +18,8 @@ int adis16400_update_scan_mode(struct iio_dev *indio_dev, | |||
18 | { | 18 | { |
19 | struct adis16400_state *st = iio_priv(indio_dev); | 19 | struct adis16400_state *st = iio_priv(indio_dev); |
20 | struct adis *adis = &st->adis; | 20 | struct adis *adis = &st->adis; |
21 | uint16_t *tx; | 21 | unsigned int burst_length; |
22 | u8 *tx; | ||
22 | 23 | ||
23 | if (st->variant->flags & ADIS16400_NO_BURST) | 24 | if (st->variant->flags & ADIS16400_NO_BURST) |
24 | return adis_update_scan_mode(indio_dev, scan_mask); | 25 | return adis_update_scan_mode(indio_dev, scan_mask); |
@@ -26,26 +27,29 @@ int adis16400_update_scan_mode(struct iio_dev *indio_dev, | |||
26 | kfree(adis->xfer); | 27 | kfree(adis->xfer); |
27 | kfree(adis->buffer); | 28 | kfree(adis->buffer); |
28 | 29 | ||
30 | /* All but the timestamp channel */ | ||
31 | burst_length = (indio_dev->num_channels - 1) * sizeof(u16); | ||
32 | if (st->variant->flags & ADIS16400_BURST_DIAG_STAT) | ||
33 | burst_length += sizeof(u16); | ||
34 | |||
29 | adis->xfer = kcalloc(2, sizeof(*adis->xfer), GFP_KERNEL); | 35 | adis->xfer = kcalloc(2, sizeof(*adis->xfer), GFP_KERNEL); |
30 | if (!adis->xfer) | 36 | if (!adis->xfer) |
31 | return -ENOMEM; | 37 | return -ENOMEM; |
32 | 38 | ||
33 | adis->buffer = kzalloc(indio_dev->scan_bytes + sizeof(u16), | 39 | adis->buffer = kzalloc(burst_length + sizeof(u16), GFP_KERNEL); |
34 | GFP_KERNEL); | ||
35 | if (!adis->buffer) | 40 | if (!adis->buffer) |
36 | return -ENOMEM; | 41 | return -ENOMEM; |
37 | 42 | ||
38 | tx = adis->buffer + indio_dev->scan_bytes; | 43 | tx = adis->buffer + burst_length; |
39 | |||
40 | tx[0] = ADIS_READ_REG(ADIS16400_GLOB_CMD); | 44 | tx[0] = ADIS_READ_REG(ADIS16400_GLOB_CMD); |
41 | tx[1] = 0; | 45 | tx[1] = 0; |
42 | 46 | ||
43 | adis->xfer[0].tx_buf = tx; | 47 | adis->xfer[0].tx_buf = tx; |
44 | adis->xfer[0].bits_per_word = 8; | 48 | adis->xfer[0].bits_per_word = 8; |
45 | adis->xfer[0].len = 2; | 49 | adis->xfer[0].len = 2; |
46 | adis->xfer[1].tx_buf = tx; | 50 | adis->xfer[1].rx_buf = adis->buffer; |
47 | adis->xfer[1].bits_per_word = 8; | 51 | adis->xfer[1].bits_per_word = 8; |
48 | adis->xfer[1].len = indio_dev->scan_bytes; | 52 | adis->xfer[1].len = burst_length; |
49 | 53 | ||
50 | spi_message_init(&adis->msg); | 54 | spi_message_init(&adis->msg); |
51 | spi_message_add_tail(&adis->xfer[0], &adis->msg); | 55 | spi_message_add_tail(&adis->xfer[0], &adis->msg); |
@@ -61,6 +65,7 @@ irqreturn_t adis16400_trigger_handler(int irq, void *p) | |||
61 | struct adis16400_state *st = iio_priv(indio_dev); | 65 | struct adis16400_state *st = iio_priv(indio_dev); |
62 | struct adis *adis = &st->adis; | 66 | struct adis *adis = &st->adis; |
63 | u32 old_speed_hz = st->adis.spi->max_speed_hz; | 67 | u32 old_speed_hz = st->adis.spi->max_speed_hz; |
68 | void *buffer; | ||
64 | int ret; | 69 | int ret; |
65 | 70 | ||
66 | if (!adis->buffer) | 71 | if (!adis->buffer) |
@@ -81,7 +86,12 @@ irqreturn_t adis16400_trigger_handler(int irq, void *p) | |||
81 | spi_setup(st->adis.spi); | 86 | spi_setup(st->adis.spi); |
82 | } | 87 | } |
83 | 88 | ||
84 | iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer, | 89 | if (st->variant->flags & ADIS16400_BURST_DIAG_STAT) |
90 | buffer = adis->buffer + sizeof(u16); | ||
91 | else | ||
92 | buffer = adis->buffer; | ||
93 | |||
94 | iio_push_to_buffers_with_timestamp(indio_dev, buffer, | ||
85 | pf->timestamp); | 95 | pf->timestamp); |
86 | 96 | ||
87 | iio_trigger_notify_done(indio_dev->trig); | 97 | iio_trigger_notify_done(indio_dev->trig); |
diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c index fa795dcd5f75..2fd68f2219a7 100644 --- a/drivers/iio/imu/adis16400_core.c +++ b/drivers/iio/imu/adis16400_core.c | |||
@@ -405,6 +405,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
405 | *val = st->variant->temp_scale_nano / 1000000; | 405 | *val = st->variant->temp_scale_nano / 1000000; |
406 | *val2 = (st->variant->temp_scale_nano % 1000000); | 406 | *val2 = (st->variant->temp_scale_nano % 1000000); |
407 | return IIO_VAL_INT_PLUS_MICRO; | 407 | return IIO_VAL_INT_PLUS_MICRO; |
408 | case IIO_PRESSURE: | ||
409 | /* 20 uBar = 0.002kPascal */ | ||
410 | *val = 0; | ||
411 | *val2 = 2000; | ||
412 | return IIO_VAL_INT_PLUS_MICRO; | ||
408 | default: | 413 | default: |
409 | return -EINVAL; | 414 | return -EINVAL; |
410 | } | 415 | } |
@@ -454,10 +459,10 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
454 | } | 459 | } |
455 | } | 460 | } |
456 | 461 | ||
457 | #define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si) { \ | 462 | #define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si, chn) { \ |
458 | .type = IIO_VOLTAGE, \ | 463 | .type = IIO_VOLTAGE, \ |
459 | .indexed = 1, \ | 464 | .indexed = 1, \ |
460 | .channel = 0, \ | 465 | .channel = chn, \ |
461 | .extend_name = name, \ | 466 | .extend_name = name, \ |
462 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ | 467 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ |
463 | BIT(IIO_CHAN_INFO_SCALE), \ | 468 | BIT(IIO_CHAN_INFO_SCALE), \ |
@@ -474,10 +479,10 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, | |||
474 | } | 479 | } |
475 | 480 | ||
476 | #define ADIS16400_SUPPLY_CHAN(addr, bits) \ | 481 | #define ADIS16400_SUPPLY_CHAN(addr, bits) \ |
477 | ADIS16400_VOLTAGE_CHAN(addr, bits, "supply", ADIS16400_SCAN_SUPPLY) | 482 | ADIS16400_VOLTAGE_CHAN(addr, bits, "supply", ADIS16400_SCAN_SUPPLY, 0) |
478 | 483 | ||
479 | #define ADIS16400_AUX_ADC_CHAN(addr, bits) \ | 484 | #define ADIS16400_AUX_ADC_CHAN(addr, bits) \ |
480 | ADIS16400_VOLTAGE_CHAN(addr, bits, NULL, ADIS16400_SCAN_ADC) | 485 | ADIS16400_VOLTAGE_CHAN(addr, bits, NULL, ADIS16400_SCAN_ADC, 1) |
481 | 486 | ||
482 | #define ADIS16400_GYRO_CHAN(mod, addr, bits) { \ | 487 | #define ADIS16400_GYRO_CHAN(mod, addr, bits) { \ |
483 | .type = IIO_ANGL_VEL, \ | 488 | .type = IIO_ANGL_VEL, \ |
@@ -773,7 +778,8 @@ static struct adis16400_chip_info adis16400_chips[] = { | |||
773 | .channels = adis16448_channels, | 778 | .channels = adis16448_channels, |
774 | .num_channels = ARRAY_SIZE(adis16448_channels), | 779 | .num_channels = ARRAY_SIZE(adis16448_channels), |
775 | .flags = ADIS16400_HAS_PROD_ID | | 780 | .flags = ADIS16400_HAS_PROD_ID | |
776 | ADIS16400_HAS_SERIAL_NUMBER, | 781 | ADIS16400_HAS_SERIAL_NUMBER | |
782 | ADIS16400_BURST_DIAG_STAT, | ||
777 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(10000), /* 0.01 deg/s */ | 783 | .gyro_scale_micro = IIO_DEGREE_TO_RAD(10000), /* 0.01 deg/s */ |
778 | .accel_scale_micro = IIO_G_TO_M_S_2(833), /* 1/1200 g */ | 784 | .accel_scale_micro = IIO_G_TO_M_S_2(833), /* 1/1200 g */ |
779 | .temp_scale_nano = 73860000, /* 0.07386 C */ | 785 | .temp_scale_nano = 73860000, /* 0.07386 C */ |
@@ -791,11 +797,6 @@ static const struct iio_info adis16400_info = { | |||
791 | .debugfs_reg_access = adis_debugfs_reg_access, | 797 | .debugfs_reg_access = adis_debugfs_reg_access, |
792 | }; | 798 | }; |
793 | 799 | ||
794 | static const unsigned long adis16400_burst_scan_mask[] = { | ||
795 | ~0UL, | ||
796 | 0, | ||
797 | }; | ||
798 | |||
799 | static const char * const adis16400_status_error_msgs[] = { | 800 | static const char * const adis16400_status_error_msgs[] = { |
800 | [ADIS16400_DIAG_STAT_ZACCL_FAIL] = "Z-axis accelerometer self-test failure", | 801 | [ADIS16400_DIAG_STAT_ZACCL_FAIL] = "Z-axis accelerometer self-test failure", |
801 | [ADIS16400_DIAG_STAT_YACCL_FAIL] = "Y-axis accelerometer self-test failure", | 802 | [ADIS16400_DIAG_STAT_YACCL_FAIL] = "Y-axis accelerometer self-test failure", |
@@ -843,6 +844,20 @@ static const struct adis_data adis16400_data = { | |||
843 | BIT(ADIS16400_DIAG_STAT_POWER_LOW), | 844 | BIT(ADIS16400_DIAG_STAT_POWER_LOW), |
844 | }; | 845 | }; |
845 | 846 | ||
847 | static void adis16400_setup_chan_mask(struct adis16400_state *st) | ||
848 | { | ||
849 | const struct adis16400_chip_info *chip_info = st->variant; | ||
850 | unsigned i; | ||
851 | |||
852 | for (i = 0; i < chip_info->num_channels; i++) { | ||
853 | const struct iio_chan_spec *ch = &chip_info->channels[i]; | ||
854 | |||
855 | if (ch->scan_index >= 0 && | ||
856 | ch->scan_index != ADIS16400_SCAN_TIMESTAMP) | ||
857 | st->avail_scan_mask[0] |= BIT(ch->scan_index); | ||
858 | } | ||
859 | } | ||
860 | |||
846 | static int adis16400_probe(struct spi_device *spi) | 861 | static int adis16400_probe(struct spi_device *spi) |
847 | { | 862 | { |
848 | struct adis16400_state *st; | 863 | struct adis16400_state *st; |
@@ -866,8 +881,10 @@ static int adis16400_probe(struct spi_device *spi) | |||
866 | indio_dev->info = &adis16400_info; | 881 | indio_dev->info = &adis16400_info; |
867 | indio_dev->modes = INDIO_DIRECT_MODE; | 882 | indio_dev->modes = INDIO_DIRECT_MODE; |
868 | 883 | ||
869 | if (!(st->variant->flags & ADIS16400_NO_BURST)) | 884 | if (!(st->variant->flags & ADIS16400_NO_BURST)) { |
870 | indio_dev->available_scan_masks = adis16400_burst_scan_mask; | 885 | adis16400_setup_chan_mask(st); |
886 | indio_dev->available_scan_masks = st->avail_scan_mask; | ||
887 | } | ||
871 | 888 | ||
872 | ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data); | 889 | ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data); |
873 | if (ret) | 890 | if (ret) |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 7752bd59d4b7..a353b7de6d22 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -1063,9 +1063,8 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse) | |||
1063 | right = (packet[1] & 0x02) >> 1; | 1063 | right = (packet[1] & 0x02) >> 1; |
1064 | middle = (packet[1] & 0x04) >> 2; | 1064 | middle = (packet[1] & 0x04) >> 2; |
1065 | 1065 | ||
1066 | /* Divide 2 since trackpoint's speed is too fast */ | 1066 | input_report_rel(dev2, REL_X, (char)x); |
1067 | input_report_rel(dev2, REL_X, (char)x / 2); | 1067 | input_report_rel(dev2, REL_Y, -((char)y)); |
1068 | input_report_rel(dev2, REL_Y, -((char)y / 2)); | ||
1069 | 1068 | ||
1070 | input_report_key(dev2, BTN_LEFT, left); | 1069 | input_report_key(dev2, BTN_LEFT, left); |
1071 | input_report_key(dev2, BTN_RIGHT, right); | 1070 | input_report_key(dev2, BTN_RIGHT, right); |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 79363b687195..ce3d40004458 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1376,10 +1376,11 @@ static bool elantech_is_signature_valid(const unsigned char *param) | |||
1376 | return true; | 1376 | return true; |
1377 | 1377 | ||
1378 | /* | 1378 | /* |
1379 | * Some models have a revision higher then 20. Meaning param[2] may | 1379 | * Some hw_version >= 4 models have a revision higher then 20. Meaning |
1380 | * be 10 or 20, skip the rates check for these. | 1380 | * that param[2] may be 10 or 20, skip the rates check for these. |
1381 | */ | 1381 | */ |
1382 | if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40) | 1382 | if ((param[0] & 0x0f) >= 0x06 && (param[1] & 0xaf) == 0x0f && |
1383 | param[2] < 40) | ||
1383 | return true; | 1384 | return true; |
1384 | 1385 | ||
1385 | for (i = 0; i < ARRAY_SIZE(rates); i++) | 1386 | for (i = 0; i < ARRAY_SIZE(rates); i++) |
@@ -1555,6 +1556,7 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1555 | case 9: | 1556 | case 9: |
1556 | case 10: | 1557 | case 10: |
1557 | case 13: | 1558 | case 13: |
1559 | case 14: | ||
1558 | etd->hw_version = 4; | 1560 | etd->hw_version = 4; |
1559 | break; | 1561 | break; |
1560 | default: | 1562 | default: |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index e43d48956dea..e1c7e9e51045 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2930,6 +2930,7 @@ static void *alloc_coherent(struct device *dev, size_t size, | |||
2930 | size = PAGE_ALIGN(size); | 2930 | size = PAGE_ALIGN(size); |
2931 | dma_mask = dev->coherent_dma_mask; | 2931 | dma_mask = dev->coherent_dma_mask; |
2932 | flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); | 2932 | flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); |
2933 | flag |= __GFP_ZERO; | ||
2933 | 2934 | ||
2934 | page = alloc_pages(flag | __GFP_NOWARN, get_order(size)); | 2935 | page = alloc_pages(flag | __GFP_NOWARN, get_order(size)); |
2935 | if (!page) { | 2936 | if (!page) { |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 68d43beccb7e..2ffe58969944 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -696,6 +696,11 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu | |||
696 | return &context[devfn]; | 696 | return &context[devfn]; |
697 | } | 697 | } |
698 | 698 | ||
699 | static int iommu_dummy(struct device *dev) | ||
700 | { | ||
701 | return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO; | ||
702 | } | ||
703 | |||
699 | static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) | 704 | static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn) |
700 | { | 705 | { |
701 | struct dmar_drhd_unit *drhd = NULL; | 706 | struct dmar_drhd_unit *drhd = NULL; |
@@ -705,6 +710,9 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf | |||
705 | u16 segment = 0; | 710 | u16 segment = 0; |
706 | int i; | 711 | int i; |
707 | 712 | ||
713 | if (iommu_dummy(dev)) | ||
714 | return NULL; | ||
715 | |||
708 | if (dev_is_pci(dev)) { | 716 | if (dev_is_pci(dev)) { |
709 | pdev = to_pci_dev(dev); | 717 | pdev = to_pci_dev(dev); |
710 | segment = pci_domain_nr(pdev->bus); | 718 | segment = pci_domain_nr(pdev->bus); |
@@ -2969,11 +2977,6 @@ static inline struct dmar_domain *get_valid_domain_for_dev(struct device *dev) | |||
2969 | return __get_valid_domain_for_dev(dev); | 2977 | return __get_valid_domain_for_dev(dev); |
2970 | } | 2978 | } |
2971 | 2979 | ||
2972 | static int iommu_dummy(struct device *dev) | ||
2973 | { | ||
2974 | return dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO; | ||
2975 | } | ||
2976 | |||
2977 | /* Check if the dev needs to go through non-identity map and unmap process.*/ | 2980 | /* Check if the dev needs to go through non-identity map and unmap process.*/ |
2978 | static int iommu_no_mapping(struct device *dev) | 2981 | static int iommu_no_mapping(struct device *dev) |
2979 | { | 2982 | { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index a3b0f7a0c61e..1f82a04ce01a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1774,7 +1774,7 @@ struct bnx2x { | |||
1774 | int stats_state; | 1774 | int stats_state; |
1775 | 1775 | ||
1776 | /* used for synchronization of concurrent threads statistics handling */ | 1776 | /* used for synchronization of concurrent threads statistics handling */ |
1777 | struct mutex stats_lock; | 1777 | struct semaphore stats_lock; |
1778 | 1778 | ||
1779 | /* used by dmae command loader */ | 1779 | /* used by dmae command loader */ |
1780 | struct dmae_command stats_dmae; | 1780 | struct dmae_command stats_dmae; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index fd52ce95127e..33501bcddc48 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -12054,7 +12054,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) | |||
12054 | mutex_init(&bp->port.phy_mutex); | 12054 | mutex_init(&bp->port.phy_mutex); |
12055 | mutex_init(&bp->fw_mb_mutex); | 12055 | mutex_init(&bp->fw_mb_mutex); |
12056 | mutex_init(&bp->drv_info_mutex); | 12056 | mutex_init(&bp->drv_info_mutex); |
12057 | mutex_init(&bp->stats_lock); | 12057 | sema_init(&bp->stats_lock, 1); |
12058 | bp->drv_info_mng_owner = false; | 12058 | bp->drv_info_mng_owner = false; |
12059 | 12059 | ||
12060 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); | 12060 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); |
@@ -13690,9 +13690,10 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp) | |||
13690 | cancel_delayed_work_sync(&bp->sp_task); | 13690 | cancel_delayed_work_sync(&bp->sp_task); |
13691 | cancel_delayed_work_sync(&bp->period_task); | 13691 | cancel_delayed_work_sync(&bp->period_task); |
13692 | 13692 | ||
13693 | mutex_lock(&bp->stats_lock); | 13693 | if (!down_timeout(&bp->stats_lock, HZ / 10)) { |
13694 | bp->stats_state = STATS_STATE_DISABLED; | 13694 | bp->stats_state = STATS_STATE_DISABLED; |
13695 | mutex_unlock(&bp->stats_lock); | 13695 | up(&bp->stats_lock); |
13696 | } | ||
13696 | 13697 | ||
13697 | bnx2x_save_statistics(bp); | 13698 | bnx2x_save_statistics(bp); |
13698 | 13699 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c index 266b055c2360..69d699f0730a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | |||
@@ -1372,19 +1372,23 @@ void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) | |||
1372 | * that context in case someone is in the middle of a transition. | 1372 | * that context in case someone is in the middle of a transition. |
1373 | * For other events, wait a bit until lock is taken. | 1373 | * For other events, wait a bit until lock is taken. |
1374 | */ | 1374 | */ |
1375 | if (!mutex_trylock(&bp->stats_lock)) { | 1375 | if (down_trylock(&bp->stats_lock)) { |
1376 | if (event == STATS_EVENT_UPDATE) | 1376 | if (event == STATS_EVENT_UPDATE) |
1377 | return; | 1377 | return; |
1378 | 1378 | ||
1379 | DP(BNX2X_MSG_STATS, | 1379 | DP(BNX2X_MSG_STATS, |
1380 | "Unlikely stats' lock contention [event %d]\n", event); | 1380 | "Unlikely stats' lock contention [event %d]\n", event); |
1381 | mutex_lock(&bp->stats_lock); | 1381 | if (unlikely(down_timeout(&bp->stats_lock, HZ / 10))) { |
1382 | BNX2X_ERR("Failed to take stats lock [event %d]\n", | ||
1383 | event); | ||
1384 | return; | ||
1385 | } | ||
1382 | } | 1386 | } |
1383 | 1387 | ||
1384 | bnx2x_stats_stm[state][event].action(bp); | 1388 | bnx2x_stats_stm[state][event].action(bp); |
1385 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; | 1389 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; |
1386 | 1390 | ||
1387 | mutex_unlock(&bp->stats_lock); | 1391 | up(&bp->stats_lock); |
1388 | 1392 | ||
1389 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) | 1393 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) |
1390 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", | 1394 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", |
@@ -1970,7 +1974,11 @@ int bnx2x_stats_safe_exec(struct bnx2x *bp, | |||
1970 | /* Wait for statistics to end [while blocking further requests], | 1974 | /* Wait for statistics to end [while blocking further requests], |
1971 | * then run supplied function 'safely'. | 1975 | * then run supplied function 'safely'. |
1972 | */ | 1976 | */ |
1973 | mutex_lock(&bp->stats_lock); | 1977 | rc = down_timeout(&bp->stats_lock, HZ / 10); |
1978 | if (unlikely(rc)) { | ||
1979 | BNX2X_ERR("Failed to take statistics lock for safe execution\n"); | ||
1980 | goto out_no_lock; | ||
1981 | } | ||
1974 | 1982 | ||
1975 | bnx2x_stats_comp(bp); | 1983 | bnx2x_stats_comp(bp); |
1976 | while (bp->stats_pending && cnt--) | 1984 | while (bp->stats_pending && cnt--) |
@@ -1988,7 +1996,7 @@ out: | |||
1988 | /* No need to restart statistics - if they're enabled, the timer | 1996 | /* No need to restart statistics - if they're enabled, the timer |
1989 | * will restart the statistics. | 1997 | * will restart the statistics. |
1990 | */ | 1998 | */ |
1991 | mutex_unlock(&bp->stats_lock); | 1999 | up(&bp->stats_lock); |
1992 | 2000 | out_no_lock: | |
1993 | return rc; | 2001 | return rc; |
1994 | } | 2002 | } |
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c index 594a2ab36d31..68f3c13c9ef6 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c | |||
@@ -2414,7 +2414,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, enum bfi_fwboot_type boot_type, | |||
2414 | if (status == BFA_STATUS_OK) | 2414 | if (status == BFA_STATUS_OK) |
2415 | bfa_ioc_lpu_start(ioc); | 2415 | bfa_ioc_lpu_start(ioc); |
2416 | else | 2416 | else |
2417 | bfa_nw_iocpf_timeout(ioc); | 2417 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT); |
2418 | 2418 | ||
2419 | return status; | 2419 | return status; |
2420 | } | 2420 | } |
@@ -3029,7 +3029,7 @@ bfa_ioc_poll_fwinit(struct bfa_ioc *ioc) | |||
3029 | } | 3029 | } |
3030 | 3030 | ||
3031 | if (ioc->iocpf.poll_time >= BFA_IOC_TOV) { | 3031 | if (ioc->iocpf.poll_time >= BFA_IOC_TOV) { |
3032 | bfa_nw_iocpf_timeout(ioc); | 3032 | bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT); |
3033 | } else { | 3033 | } else { |
3034 | ioc->iocpf.poll_time += BFA_IOC_POLL_TOV; | 3034 | ioc->iocpf.poll_time += BFA_IOC_POLL_TOV; |
3035 | mod_timer(&ioc->iocpf_timer, jiffies + | 3035 | mod_timer(&ioc->iocpf_timer, jiffies + |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index 37072a83f9d6..caae6cb2bc1a 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -3701,10 +3701,6 @@ bnad_pci_probe(struct pci_dev *pdev, | |||
3701 | setup_timer(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout, | 3701 | setup_timer(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout, |
3702 | ((unsigned long)bnad)); | 3702 | ((unsigned long)bnad)); |
3703 | 3703 | ||
3704 | /* Now start the timer before calling IOC */ | ||
3705 | mod_timer(&bnad->bna.ioceth.ioc.iocpf_timer, | ||
3706 | jiffies + msecs_to_jiffies(BNA_IOC_TIMER_FREQ)); | ||
3707 | |||
3708 | /* | 3704 | /* |
3709 | * Start the chip | 3705 | * Start the chip |
3710 | * If the call back comes with error, we bail out. | 3706 | * If the call back comes with error, we bail out. |
diff --git a/drivers/net/ethernet/brocade/bna/cna_fwimg.c b/drivers/net/ethernet/brocade/bna/cna_fwimg.c index ebf462d8082f..badea368bdc8 100644 --- a/drivers/net/ethernet/brocade/bna/cna_fwimg.c +++ b/drivers/net/ethernet/brocade/bna/cna_fwimg.c | |||
@@ -30,6 +30,7 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image, | |||
30 | u32 *bfi_image_size, char *fw_name) | 30 | u32 *bfi_image_size, char *fw_name) |
31 | { | 31 | { |
32 | const struct firmware *fw; | 32 | const struct firmware *fw; |
33 | u32 n; | ||
33 | 34 | ||
34 | if (request_firmware(&fw, fw_name, &pdev->dev)) { | 35 | if (request_firmware(&fw, fw_name, &pdev->dev)) { |
35 | pr_alert("Can't locate firmware %s\n", fw_name); | 36 | pr_alert("Can't locate firmware %s\n", fw_name); |
@@ -40,6 +41,12 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image, | |||
40 | *bfi_image_size = fw->size/sizeof(u32); | 41 | *bfi_image_size = fw->size/sizeof(u32); |
41 | bfi_fw = fw; | 42 | bfi_fw = fw; |
42 | 43 | ||
44 | /* Convert loaded firmware to host order as it is stored in file | ||
45 | * as sequence of LE32 integers. | ||
46 | */ | ||
47 | for (n = 0; n < *bfi_image_size; n++) | ||
48 | le32_to_cpus(*bfi_image + n); | ||
49 | |||
43 | return *bfi_image; | 50 | return *bfi_image; |
44 | error: | 51 | error: |
45 | return NULL; | 52 | return NULL; |
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index c0ad95d2f63d..809ea4610a77 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c | |||
@@ -224,12 +224,17 @@ static void efx_unmap_rx_buffer(struct efx_nic *efx, | |||
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | static void efx_free_rx_buffer(struct efx_rx_buffer *rx_buf) | 227 | static void efx_free_rx_buffers(struct efx_rx_queue *rx_queue, |
228 | struct efx_rx_buffer *rx_buf, | ||
229 | unsigned int num_bufs) | ||
228 | { | 230 | { |
229 | if (rx_buf->page) { | 231 | do { |
230 | put_page(rx_buf->page); | 232 | if (rx_buf->page) { |
231 | rx_buf->page = NULL; | 233 | put_page(rx_buf->page); |
232 | } | 234 | rx_buf->page = NULL; |
235 | } | ||
236 | rx_buf = efx_rx_buf_next(rx_queue, rx_buf); | ||
237 | } while (--num_bufs); | ||
233 | } | 238 | } |
234 | 239 | ||
235 | /* Attempt to recycle the page if there is an RX recycle ring; the page can | 240 | /* Attempt to recycle the page if there is an RX recycle ring; the page can |
@@ -278,7 +283,7 @@ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue, | |||
278 | /* If this is the last buffer in a page, unmap and free it. */ | 283 | /* If this is the last buffer in a page, unmap and free it. */ |
279 | if (rx_buf->flags & EFX_RX_BUF_LAST_IN_PAGE) { | 284 | if (rx_buf->flags & EFX_RX_BUF_LAST_IN_PAGE) { |
280 | efx_unmap_rx_buffer(rx_queue->efx, rx_buf); | 285 | efx_unmap_rx_buffer(rx_queue->efx, rx_buf); |
281 | efx_free_rx_buffer(rx_buf); | 286 | efx_free_rx_buffers(rx_queue, rx_buf, 1); |
282 | } | 287 | } |
283 | rx_buf->page = NULL; | 288 | rx_buf->page = NULL; |
284 | } | 289 | } |
@@ -304,10 +309,7 @@ static void efx_discard_rx_packet(struct efx_channel *channel, | |||
304 | 309 | ||
305 | efx_recycle_rx_pages(channel, rx_buf, n_frags); | 310 | efx_recycle_rx_pages(channel, rx_buf, n_frags); |
306 | 311 | ||
307 | do { | 312 | efx_free_rx_buffers(rx_queue, rx_buf, n_frags); |
308 | efx_free_rx_buffer(rx_buf); | ||
309 | rx_buf = efx_rx_buf_next(rx_queue, rx_buf); | ||
310 | } while (--n_frags); | ||
311 | } | 313 | } |
312 | 314 | ||
313 | /** | 315 | /** |
@@ -431,11 +433,10 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf, | |||
431 | 433 | ||
432 | skb = napi_get_frags(napi); | 434 | skb = napi_get_frags(napi); |
433 | if (unlikely(!skb)) { | 435 | if (unlikely(!skb)) { |
434 | while (n_frags--) { | 436 | struct efx_rx_queue *rx_queue; |
435 | put_page(rx_buf->page); | 437 | |
436 | rx_buf->page = NULL; | 438 | rx_queue = efx_channel_get_rx_queue(channel); |
437 | rx_buf = efx_rx_buf_next(&channel->rx_queue, rx_buf); | 439 | efx_free_rx_buffers(rx_queue, rx_buf, n_frags); |
438 | } | ||
439 | return; | 440 | return; |
440 | } | 441 | } |
441 | 442 | ||
@@ -622,7 +623,10 @@ static void efx_rx_deliver(struct efx_channel *channel, u8 *eh, | |||
622 | 623 | ||
623 | skb = efx_rx_mk_skb(channel, rx_buf, n_frags, eh, hdr_len); | 624 | skb = efx_rx_mk_skb(channel, rx_buf, n_frags, eh, hdr_len); |
624 | if (unlikely(skb == NULL)) { | 625 | if (unlikely(skb == NULL)) { |
625 | efx_free_rx_buffer(rx_buf); | 626 | struct efx_rx_queue *rx_queue; |
627 | |||
628 | rx_queue = efx_channel_get_rx_queue(channel); | ||
629 | efx_free_rx_buffers(rx_queue, rx_buf, n_frags); | ||
626 | return; | 630 | return; |
627 | } | 631 | } |
628 | skb_record_rx_queue(skb, channel->rx_queue.core_index); | 632 | skb_record_rx_queue(skb, channel->rx_queue.core_index); |
@@ -661,8 +665,12 @@ void __efx_rx_packet(struct efx_channel *channel) | |||
661 | * loopback layer, and free the rx_buf here | 665 | * loopback layer, and free the rx_buf here |
662 | */ | 666 | */ |
663 | if (unlikely(efx->loopback_selftest)) { | 667 | if (unlikely(efx->loopback_selftest)) { |
668 | struct efx_rx_queue *rx_queue; | ||
669 | |||
664 | efx_loopback_rx_packet(efx, eh, rx_buf->len); | 670 | efx_loopback_rx_packet(efx, eh, rx_buf->len); |
665 | efx_free_rx_buffer(rx_buf); | 671 | rx_queue = efx_channel_get_rx_queue(channel); |
672 | efx_free_rx_buffers(rx_queue, rx_buf, | ||
673 | channel->rx_pkt_n_frags); | ||
666 | goto out; | 674 | goto out; |
667 | } | 675 | } |
668 | 676 | ||
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c index 4ec9811f49c8..65efb1468988 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c | |||
@@ -511,11 +511,9 @@ static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx, | |||
511 | msgbuf->rx_pktids, | 511 | msgbuf->rx_pktids, |
512 | msgbuf->ioctl_resp_pktid); | 512 | msgbuf->ioctl_resp_pktid); |
513 | if (msgbuf->ioctl_resp_ret_len != 0) { | 513 | if (msgbuf->ioctl_resp_ret_len != 0) { |
514 | if (!skb) { | 514 | if (!skb) |
515 | brcmf_err("Invalid packet id idx recv'd %d\n", | ||
516 | msgbuf->ioctl_resp_pktid); | ||
517 | return -EBADF; | 515 | return -EBADF; |
518 | } | 516 | |
519 | memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ? | 517 | memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ? |
520 | len : msgbuf->ioctl_resp_ret_len); | 518 | len : msgbuf->ioctl_resp_ret_len); |
521 | } | 519 | } |
@@ -874,10 +872,8 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf) | |||
874 | flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS; | 872 | flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS; |
875 | skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, | 873 | skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, |
876 | msgbuf->tx_pktids, idx); | 874 | msgbuf->tx_pktids, idx); |
877 | if (!skb) { | 875 | if (!skb) |
878 | brcmf_err("Invalid packet id idx recv'd %d\n", idx); | ||
879 | return; | 876 | return; |
880 | } | ||
881 | 877 | ||
882 | set_bit(flowid, msgbuf->txstatus_done_map); | 878 | set_bit(flowid, msgbuf->txstatus_done_map); |
883 | commonring = msgbuf->flowrings[flowid]; | 879 | commonring = msgbuf->flowrings[flowid]; |
@@ -1156,6 +1152,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf) | |||
1156 | 1152 | ||
1157 | skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, | 1153 | skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, |
1158 | msgbuf->rx_pktids, idx); | 1154 | msgbuf->rx_pktids, idx); |
1155 | if (!skb) | ||
1156 | return; | ||
1159 | 1157 | ||
1160 | if (data_offset) | 1158 | if (data_offset) |
1161 | skb_pull(skb, data_offset); | 1159 | skb_pull(skb, data_offset); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 75e96db6626b..8e604a3931ca 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -471,7 +471,7 @@ static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw, | |||
471 | if (cfg->device_family != IWL_DEVICE_FAMILY_8000) | 471 | if (cfg->device_family != IWL_DEVICE_FAMILY_8000) |
472 | return le16_to_cpup(nvm_sw + RADIO_CFG); | 472 | return le16_to_cpup(nvm_sw + RADIO_CFG); |
473 | 473 | ||
474 | return le32_to_cpup((__le32 *)(nvm_sw + RADIO_CFG_FAMILY_8000)); | 474 | return le32_to_cpup((__le32 *)(phy_sku + RADIO_CFG_FAMILY_8000)); |
475 | 475 | ||
476 | } | 476 | } |
477 | 477 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h index 01996c9d98a7..376b84e54ad7 100644 --- a/drivers/net/wireless/iwlwifi/pcie/internal.h +++ b/drivers/net/wireless/iwlwifi/pcie/internal.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved. |
4 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 4 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
5 | * | 5 | * |
6 | * Portions of this file are derived from the ipw3945 project, as well | 6 | * Portions of this file are derived from the ipw3945 project, as well |
7 | * as portions of the ieee80211 subsystem header files. | 7 | * as portions of the ieee80211 subsystem header files. |
@@ -320,7 +320,7 @@ struct iwl_trans_pcie { | |||
320 | 320 | ||
321 | /*protect hw register */ | 321 | /*protect hw register */ |
322 | spinlock_t reg_lock; | 322 | spinlock_t reg_lock; |
323 | bool cmd_in_flight; | 323 | bool cmd_hold_nic_awake; |
324 | bool ref_cmd_in_flight; | 324 | bool ref_cmd_in_flight; |
325 | 325 | ||
326 | /* protect ref counter */ | 326 | /* protect ref counter */ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index d6f6515fe663..dc179094e6a0 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -1372,7 +1372,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, bool silent, | |||
1372 | 1372 | ||
1373 | spin_lock_irqsave(&trans_pcie->reg_lock, *flags); | 1373 | spin_lock_irqsave(&trans_pcie->reg_lock, *flags); |
1374 | 1374 | ||
1375 | if (trans_pcie->cmd_in_flight) | 1375 | if (trans_pcie->cmd_hold_nic_awake) |
1376 | goto out; | 1376 | goto out; |
1377 | 1377 | ||
1378 | /* this bit wakes up the NIC */ | 1378 | /* this bit wakes up the NIC */ |
@@ -1438,7 +1438,7 @@ static void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans, | |||
1438 | */ | 1438 | */ |
1439 | __acquire(&trans_pcie->reg_lock); | 1439 | __acquire(&trans_pcie->reg_lock); |
1440 | 1440 | ||
1441 | if (trans_pcie->cmd_in_flight) | 1441 | if (trans_pcie->cmd_hold_nic_awake) |
1442 | goto out; | 1442 | goto out; |
1443 | 1443 | ||
1444 | __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, | 1444 | __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, |
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c index 06952aadfd7b..5ef8044c2ea3 100644 --- a/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/drivers/net/wireless/iwlwifi/pcie/tx.c | |||
@@ -1039,18 +1039,14 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans, | |||
1039 | iwl_trans_pcie_ref(trans); | 1039 | iwl_trans_pcie_ref(trans); |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | if (trans_pcie->cmd_in_flight) | ||
1043 | return 0; | ||
1044 | |||
1045 | trans_pcie->cmd_in_flight = true; | ||
1046 | |||
1047 | /* | 1042 | /* |
1048 | * wake up the NIC to make sure that the firmware will see the host | 1043 | * wake up the NIC to make sure that the firmware will see the host |
1049 | * command - we will let the NIC sleep once all the host commands | 1044 | * command - we will let the NIC sleep once all the host commands |
1050 | * returned. This needs to be done only on NICs that have | 1045 | * returned. This needs to be done only on NICs that have |
1051 | * apmg_wake_up_wa set. | 1046 | * apmg_wake_up_wa set. |
1052 | */ | 1047 | */ |
1053 | if (trans->cfg->base_params->apmg_wake_up_wa) { | 1048 | if (trans->cfg->base_params->apmg_wake_up_wa && |
1049 | !trans_pcie->cmd_hold_nic_awake) { | ||
1054 | __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, | 1050 | __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, |
1055 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 1051 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
1056 | if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) | 1052 | if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) |
@@ -1064,10 +1060,10 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans, | |||
1064 | if (ret < 0) { | 1060 | if (ret < 0) { |
1065 | __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, | 1061 | __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, |
1066 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 1062 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
1067 | trans_pcie->cmd_in_flight = false; | ||
1068 | IWL_ERR(trans, "Failed to wake NIC for hcmd\n"); | 1063 | IWL_ERR(trans, "Failed to wake NIC for hcmd\n"); |
1069 | return -EIO; | 1064 | return -EIO; |
1070 | } | 1065 | } |
1066 | trans_pcie->cmd_hold_nic_awake = true; | ||
1071 | } | 1067 | } |
1072 | 1068 | ||
1073 | return 0; | 1069 | return 0; |
@@ -1085,15 +1081,14 @@ static int iwl_pcie_clear_cmd_in_flight(struct iwl_trans *trans) | |||
1085 | iwl_trans_pcie_unref(trans); | 1081 | iwl_trans_pcie_unref(trans); |
1086 | } | 1082 | } |
1087 | 1083 | ||
1088 | if (WARN_ON(!trans_pcie->cmd_in_flight)) | 1084 | if (trans->cfg->base_params->apmg_wake_up_wa) { |
1089 | return 0; | 1085 | if (WARN_ON(!trans_pcie->cmd_hold_nic_awake)) |
1090 | 1086 | return 0; | |
1091 | trans_pcie->cmd_in_flight = false; | ||
1092 | 1087 | ||
1093 | if (trans->cfg->base_params->apmg_wake_up_wa) | 1088 | trans_pcie->cmd_hold_nic_awake = false; |
1094 | __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, | 1089 | __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, |
1095 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 1090 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
1096 | 1091 | } | |
1097 | return 0; | 1092 | return 0; |
1098 | } | 1093 | } |
1099 | 1094 | ||
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 4de46aa61d95..0d2594395ffb 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -1250,7 +1250,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, | |||
1250 | netdev_err(queue->vif->dev, | 1250 | netdev_err(queue->vif->dev, |
1251 | "txreq.offset: %x, size: %u, end: %lu\n", | 1251 | "txreq.offset: %x, size: %u, end: %lu\n", |
1252 | txreq.offset, txreq.size, | 1252 | txreq.offset, txreq.size, |
1253 | (txreq.offset&~PAGE_MASK) + txreq.size); | 1253 | (unsigned long)(txreq.offset&~PAGE_MASK) + txreq.size); |
1254 | xenvif_fatal_tx_err(queue->vif); | 1254 | xenvif_fatal_tx_err(queue->vif); |
1255 | break; | 1255 | break; |
1256 | } | 1256 | } |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index fee02414529e..968787abf78d 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -34,6 +34,8 @@ struct backend_info { | |||
34 | enum xenbus_state frontend_state; | 34 | enum xenbus_state frontend_state; |
35 | struct xenbus_watch hotplug_status_watch; | 35 | struct xenbus_watch hotplug_status_watch; |
36 | u8 have_hotplug_status_watch:1; | 36 | u8 have_hotplug_status_watch:1; |
37 | |||
38 | const char *hotplug_script; | ||
37 | }; | 39 | }; |
38 | 40 | ||
39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | 41 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); |
@@ -238,6 +240,7 @@ static int netback_remove(struct xenbus_device *dev) | |||
238 | xenvif_free(be->vif); | 240 | xenvif_free(be->vif); |
239 | be->vif = NULL; | 241 | be->vif = NULL; |
240 | } | 242 | } |
243 | kfree(be->hotplug_script); | ||
241 | kfree(be); | 244 | kfree(be); |
242 | dev_set_drvdata(&dev->dev, NULL); | 245 | dev_set_drvdata(&dev->dev, NULL); |
243 | return 0; | 246 | return 0; |
@@ -255,6 +258,7 @@ static int netback_probe(struct xenbus_device *dev, | |||
255 | struct xenbus_transaction xbt; | 258 | struct xenbus_transaction xbt; |
256 | int err; | 259 | int err; |
257 | int sg; | 260 | int sg; |
261 | const char *script; | ||
258 | struct backend_info *be = kzalloc(sizeof(struct backend_info), | 262 | struct backend_info *be = kzalloc(sizeof(struct backend_info), |
259 | GFP_KERNEL); | 263 | GFP_KERNEL); |
260 | if (!be) { | 264 | if (!be) { |
@@ -347,6 +351,15 @@ static int netback_probe(struct xenbus_device *dev, | |||
347 | if (err) | 351 | if (err) |
348 | pr_debug("Error writing multi-queue-max-queues\n"); | 352 | pr_debug("Error writing multi-queue-max-queues\n"); |
349 | 353 | ||
354 | script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL); | ||
355 | if (IS_ERR(script)) { | ||
356 | err = PTR_ERR(script); | ||
357 | xenbus_dev_fatal(dev, err, "reading script"); | ||
358 | goto fail; | ||
359 | } | ||
360 | |||
361 | be->hotplug_script = script; | ||
362 | |||
350 | err = xenbus_switch_state(dev, XenbusStateInitWait); | 363 | err = xenbus_switch_state(dev, XenbusStateInitWait); |
351 | if (err) | 364 | if (err) |
352 | goto fail; | 365 | goto fail; |
@@ -379,22 +392,14 @@ static int netback_uevent(struct xenbus_device *xdev, | |||
379 | struct kobj_uevent_env *env) | 392 | struct kobj_uevent_env *env) |
380 | { | 393 | { |
381 | struct backend_info *be = dev_get_drvdata(&xdev->dev); | 394 | struct backend_info *be = dev_get_drvdata(&xdev->dev); |
382 | char *val; | ||
383 | 395 | ||
384 | val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL); | 396 | if (!be) |
385 | if (IS_ERR(val)) { | 397 | return 0; |
386 | int err = PTR_ERR(val); | 398 | |
387 | xenbus_dev_fatal(xdev, err, "reading script"); | 399 | if (add_uevent_var(env, "script=%s", be->hotplug_script)) |
388 | return err; | 400 | return -ENOMEM; |
389 | } else { | ||
390 | if (add_uevent_var(env, "script=%s", val)) { | ||
391 | kfree(val); | ||
392 | return -ENOMEM; | ||
393 | } | ||
394 | kfree(val); | ||
395 | } | ||
396 | 401 | ||
397 | if (!be || !be->vif) | 402 | if (!be->vif) |
398 | return 0; | 403 | return 0; |
399 | 404 | ||
400 | return add_uevent_var(env, "vif=%s", be->vif->dev->name); | 405 | return add_uevent_var(env, "vif=%s", be->vif->dev->name); |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 99764db0875a..f0650265febf 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -189,7 +189,7 @@ int __of_attach_node_sysfs(struct device_node *np) | |||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||
192 | static int __init of_init(void) | 192 | void __init of_core_init(void) |
193 | { | 193 | { |
194 | struct device_node *np; | 194 | struct device_node *np; |
195 | 195 | ||
@@ -198,7 +198,8 @@ static int __init of_init(void) | |||
198 | of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); | 198 | of_kset = kset_create_and_add("devicetree", NULL, firmware_kobj); |
199 | if (!of_kset) { | 199 | if (!of_kset) { |
200 | mutex_unlock(&of_mutex); | 200 | mutex_unlock(&of_mutex); |
201 | return -ENOMEM; | 201 | pr_err("devicetree: failed to register existing nodes\n"); |
202 | return; | ||
202 | } | 203 | } |
203 | for_each_of_allnodes(np) | 204 | for_each_of_allnodes(np) |
204 | __of_attach_node_sysfs(np); | 205 | __of_attach_node_sysfs(np); |
@@ -207,10 +208,7 @@ static int __init of_init(void) | |||
207 | /* Symlink in /proc as required by userspace ABI */ | 208 | /* Symlink in /proc as required by userspace ABI */ |
208 | if (of_root) | 209 | if (of_root) |
209 | proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base"); | 210 | proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base"); |
210 | |||
211 | return 0; | ||
212 | } | 211 | } |
213 | core_initcall(of_init); | ||
214 | 212 | ||
215 | static struct property *__of_find_property(const struct device_node *np, | 213 | static struct property *__of_find_property(const struct device_node *np, |
216 | const char *name, int *lenp) | 214 | const char *name, int *lenp) |
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 3351ef408125..53826b84e0ec 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -225,7 +225,7 @@ void __of_attach_node(struct device_node *np) | |||
225 | phandle = __of_get_property(np, "phandle", &sz); | 225 | phandle = __of_get_property(np, "phandle", &sz); |
226 | if (!phandle) | 226 | if (!phandle) |
227 | phandle = __of_get_property(np, "linux,phandle", &sz); | 227 | phandle = __of_get_property(np, "linux,phandle", &sz); |
228 | if (IS_ENABLED(PPC_PSERIES) && !phandle) | 228 | if (IS_ENABLED(CONFIG_PPC_PSERIES) && !phandle) |
229 | phandle = __of_get_property(np, "ibm,phandle", &sz); | 229 | phandle = __of_get_property(np, "ibm,phandle", &sz); |
230 | np->phandle = (phandle && (sz >= 4)) ? be32_to_cpup(phandle) : 0; | 230 | np->phandle = (phandle && (sz >= 4)) ? be32_to_cpup(phandle) : 0; |
231 | 231 | ||
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 4fd0cacf7ca0..508cc56130e3 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -428,16 +428,19 @@ static void __assign_resources_sorted(struct list_head *head, | |||
428 | * consistent. | 428 | * consistent. |
429 | */ | 429 | */ |
430 | if (add_align > dev_res->res->start) { | 430 | if (add_align > dev_res->res->start) { |
431 | resource_size_t r_size = resource_size(dev_res->res); | ||
432 | |||
431 | dev_res->res->start = add_align; | 433 | dev_res->res->start = add_align; |
432 | dev_res->res->end = add_align + | 434 | dev_res->res->end = add_align + r_size - 1; |
433 | resource_size(dev_res->res); | ||
434 | 435 | ||
435 | list_for_each_entry(dev_res2, head, list) { | 436 | list_for_each_entry(dev_res2, head, list) { |
436 | align = pci_resource_alignment(dev_res2->dev, | 437 | align = pci_resource_alignment(dev_res2->dev, |
437 | dev_res2->res); | 438 | dev_res2->res); |
438 | if (add_align > align) | 439 | if (add_align > align) { |
439 | list_move_tail(&dev_res->list, | 440 | list_move_tail(&dev_res->list, |
440 | &dev_res2->list); | 441 | &dev_res2->list); |
442 | break; | ||
443 | } | ||
441 | } | 444 | } |
442 | } | 445 | } |
443 | 446 | ||
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index a53bd5b52df9..fc9b9f0ea91e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -38,7 +38,9 @@ config ARMADA375_USBCLUSTER_PHY | |||
38 | config PHY_DM816X_USB | 38 | config PHY_DM816X_USB |
39 | tristate "TI dm816x USB PHY driver" | 39 | tristate "TI dm816x USB PHY driver" |
40 | depends on ARCH_OMAP2PLUS | 40 | depends on ARCH_OMAP2PLUS |
41 | depends on USB_SUPPORT | ||
41 | select GENERIC_PHY | 42 | select GENERIC_PHY |
43 | select USB_PHY | ||
42 | help | 44 | help |
43 | Enable this for dm816x USB to work. | 45 | Enable this for dm816x USB to work. |
44 | 46 | ||
@@ -97,8 +99,9 @@ config OMAP_CONTROL_PHY | |||
97 | config OMAP_USB2 | 99 | config OMAP_USB2 |
98 | tristate "OMAP USB2 PHY Driver" | 100 | tristate "OMAP USB2 PHY Driver" |
99 | depends on ARCH_OMAP2PLUS | 101 | depends on ARCH_OMAP2PLUS |
100 | depends on USB_PHY | 102 | depends on USB_SUPPORT |
101 | select GENERIC_PHY | 103 | select GENERIC_PHY |
104 | select USB_PHY | ||
102 | select OMAP_CONTROL_PHY | 105 | select OMAP_CONTROL_PHY |
103 | depends on OMAP_OCP2SCP | 106 | depends on OMAP_OCP2SCP |
104 | help | 107 | help |
@@ -122,8 +125,9 @@ config TI_PIPE3 | |||
122 | config TWL4030_USB | 125 | config TWL4030_USB |
123 | tristate "TWL4030 USB Transceiver Driver" | 126 | tristate "TWL4030 USB Transceiver Driver" |
124 | depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS | 127 | depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS |
125 | depends on USB_PHY | 128 | depends on USB_SUPPORT |
126 | select GENERIC_PHY | 129 | select GENERIC_PHY |
130 | select USB_PHY | ||
127 | help | 131 | help |
128 | Enable this to support the USB OTG transceiver on TWL4030 | 132 | Enable this to support the USB OTG transceiver on TWL4030 |
129 | family chips (including the TWL5030 and TPS659x0 devices). | 133 | family chips (including the TWL5030 and TPS659x0 devices). |
@@ -304,7 +308,7 @@ config PHY_STIH41X_USB | |||
304 | 308 | ||
305 | config PHY_QCOM_UFS | 309 | config PHY_QCOM_UFS |
306 | tristate "Qualcomm UFS PHY driver" | 310 | tristate "Qualcomm UFS PHY driver" |
307 | depends on OF && ARCH_MSM | 311 | depends on OF && ARCH_QCOM |
308 | select GENERIC_PHY | 312 | select GENERIC_PHY |
309 | help | 313 | help |
310 | Support for UFS PHY on QCOM chipsets. | 314 | Support for UFS PHY on QCOM chipsets. |
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 3791838f4bd4..63bc12d7a73e 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
@@ -530,7 +530,7 @@ struct phy *phy_optional_get(struct device *dev, const char *string) | |||
530 | { | 530 | { |
531 | struct phy *phy = phy_get(dev, string); | 531 | struct phy *phy = phy_get(dev, string); |
532 | 532 | ||
533 | if (PTR_ERR(phy) == -ENODEV) | 533 | if (IS_ERR(phy) && (PTR_ERR(phy) == -ENODEV)) |
534 | phy = NULL; | 534 | phy = NULL; |
535 | 535 | ||
536 | return phy; | 536 | return phy; |
@@ -584,7 +584,7 @@ struct phy *devm_phy_optional_get(struct device *dev, const char *string) | |||
584 | { | 584 | { |
585 | struct phy *phy = devm_phy_get(dev, string); | 585 | struct phy *phy = devm_phy_get(dev, string); |
586 | 586 | ||
587 | if (PTR_ERR(phy) == -ENODEV) | 587 | if (IS_ERR(phy) && (PTR_ERR(phy) == -ENODEV)) |
588 | phy = NULL; | 588 | phy = NULL; |
589 | 589 | ||
590 | return phy; | 590 | return phy; |
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 183ef4368101..c1a468686bdc 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -275,6 +275,7 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
275 | phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); | 275 | phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); |
276 | if (IS_ERR(phy->wkupclk)) { | 276 | if (IS_ERR(phy->wkupclk)) { |
277 | dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); | 277 | dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); |
278 | pm_runtime_disable(phy->dev); | ||
278 | return PTR_ERR(phy->wkupclk); | 279 | return PTR_ERR(phy->wkupclk); |
279 | } else { | 280 | } else { |
280 | dev_warn(&pdev->dev, | 281 | dev_warn(&pdev->dev, |
diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c index 778276aba3aa..97d45f47d1ad 100644 --- a/drivers/phy/phy-rcar-gen2.c +++ b/drivers/phy/phy-rcar-gen2.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #define USBHS_LPSTS 0x02 | 23 | #define USBHS_LPSTS 0x02 |
24 | #define USBHS_UGCTRL 0x80 | 24 | #define USBHS_UGCTRL 0x80 |
25 | #define USBHS_UGCTRL2 0x84 | 25 | #define USBHS_UGCTRL2 0x84 |
26 | #define USBHS_UGSTS 0x88 /* The manuals have 0x90 */ | 26 | #define USBHS_UGSTS 0x88 /* From technical update */ |
27 | 27 | ||
28 | /* Low Power Status register (LPSTS) */ | 28 | /* Low Power Status register (LPSTS) */ |
29 | #define USBHS_LPSTS_SUSPM 0x4000 | 29 | #define USBHS_LPSTS_SUSPM 0x4000 |
@@ -41,7 +41,7 @@ | |||
41 | #define USBHS_UGCTRL2_USB0SEL_HS_USB 0x00000030 | 41 | #define USBHS_UGCTRL2_USB0SEL_HS_USB 0x00000030 |
42 | 42 | ||
43 | /* USB General status register (UGSTS) */ | 43 | /* USB General status register (UGSTS) */ |
44 | #define USBHS_UGSTS_LOCK 0x00000300 /* The manuals have 0x3 */ | 44 | #define USBHS_UGSTS_LOCK 0x00000100 /* From technical update */ |
45 | 45 | ||
46 | #define PHYS_PER_CHANNEL 2 | 46 | #define PHYS_PER_CHANNEL 2 |
47 | 47 | ||
diff --git a/drivers/staging/ozwpan/ozhcd.c b/drivers/staging/ozwpan/ozhcd.c index 5ff4716b72c3..784b5ecfa849 100644 --- a/drivers/staging/ozwpan/ozhcd.c +++ b/drivers/staging/ozwpan/ozhcd.c | |||
@@ -746,8 +746,8 @@ void oz_hcd_pd_reset(void *hpd, void *hport) | |||
746 | /* | 746 | /* |
747 | * Context: softirq | 747 | * Context: softirq |
748 | */ | 748 | */ |
749 | void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, const u8 *desc, | 749 | void oz_hcd_get_desc_cnf(void *hport, u8 req_id, u8 status, const u8 *desc, |
750 | int length, int offset, int total_size) | 750 | u8 length, u16 offset, u16 total_size) |
751 | { | 751 | { |
752 | struct oz_port *port = hport; | 752 | struct oz_port *port = hport; |
753 | struct urb *urb; | 753 | struct urb *urb; |
@@ -759,8 +759,8 @@ void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, const u8 *desc, | |||
759 | if (!urb) | 759 | if (!urb) |
760 | return; | 760 | return; |
761 | if (status == 0) { | 761 | if (status == 0) { |
762 | int copy_len; | 762 | unsigned int copy_len; |
763 | int required_size = urb->transfer_buffer_length; | 763 | unsigned int required_size = urb->transfer_buffer_length; |
764 | 764 | ||
765 | if (required_size > total_size) | 765 | if (required_size > total_size) |
766 | required_size = total_size; | 766 | required_size = total_size; |
diff --git a/drivers/staging/ozwpan/ozusbif.h b/drivers/staging/ozwpan/ozusbif.h index 4249fa374012..d2a6085345be 100644 --- a/drivers/staging/ozwpan/ozusbif.h +++ b/drivers/staging/ozwpan/ozusbif.h | |||
@@ -29,8 +29,8 @@ void oz_usb_request_heartbeat(void *hpd); | |||
29 | 29 | ||
30 | /* Confirmation functions. | 30 | /* Confirmation functions. |
31 | */ | 31 | */ |
32 | void oz_hcd_get_desc_cnf(void *hport, u8 req_id, int status, | 32 | void oz_hcd_get_desc_cnf(void *hport, u8 req_id, u8 status, |
33 | const u8 *desc, int length, int offset, int total_size); | 33 | const u8 *desc, u8 length, u16 offset, u16 total_size); |
34 | void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, | 34 | void oz_hcd_control_cnf(void *hport, u8 req_id, u8 rcode, |
35 | const u8 *data, int data_len); | 35 | const u8 *data, int data_len); |
36 | 36 | ||
diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c index d434d8c6fff6..f660bb198c65 100644 --- a/drivers/staging/ozwpan/ozusbsvc1.c +++ b/drivers/staging/ozwpan/ozusbsvc1.c | |||
@@ -326,7 +326,11 @@ static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, | |||
326 | struct oz_multiple_fixed *body = | 326 | struct oz_multiple_fixed *body = |
327 | (struct oz_multiple_fixed *)data_hdr; | 327 | (struct oz_multiple_fixed *)data_hdr; |
328 | u8 *data = body->data; | 328 | u8 *data = body->data; |
329 | int n = (len - sizeof(struct oz_multiple_fixed)+1) | 329 | unsigned int n; |
330 | if (!body->unit_size || | ||
331 | len < sizeof(struct oz_multiple_fixed) - 1) | ||
332 | break; | ||
333 | n = (len - (sizeof(struct oz_multiple_fixed) - 1)) | ||
330 | / body->unit_size; | 334 | / body->unit_size; |
331 | while (n--) { | 335 | while (n--) { |
332 | oz_hcd_data_ind(usb_ctx->hport, body->endpoint, | 336 | oz_hcd_data_ind(usb_ctx->hport, body->endpoint, |
@@ -390,10 +394,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) | |||
390 | case OZ_GET_DESC_RSP: { | 394 | case OZ_GET_DESC_RSP: { |
391 | struct oz_get_desc_rsp *body = | 395 | struct oz_get_desc_rsp *body = |
392 | (struct oz_get_desc_rsp *)usb_hdr; | 396 | (struct oz_get_desc_rsp *)usb_hdr; |
393 | int data_len = elt->length - | 397 | u16 offs, total_size; |
394 | sizeof(struct oz_get_desc_rsp) + 1; | 398 | u8 data_len; |
395 | u16 offs = le16_to_cpu(get_unaligned(&body->offset)); | 399 | |
396 | u16 total_size = | 400 | if (elt->length < sizeof(struct oz_get_desc_rsp) - 1) |
401 | break; | ||
402 | data_len = elt->length - | ||
403 | (sizeof(struct oz_get_desc_rsp) - 1); | ||
404 | offs = le16_to_cpu(get_unaligned(&body->offset)); | ||
405 | total_size = | ||
397 | le16_to_cpu(get_unaligned(&body->total_size)); | 406 | le16_to_cpu(get_unaligned(&body->total_size)); |
398 | oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - cnf\n"); | 407 | oz_dbg(ON, "USB_REQ_GET_DESCRIPTOR - cnf\n"); |
399 | oz_hcd_get_desc_cnf(usb_ctx->hport, body->req_id, | 408 | oz_hcd_get_desc_cnf(usb_ctx->hport, body->req_id, |
diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index f1d47a0676c3..ada8d5dafd49 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c | |||
@@ -898,11 +898,11 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
898 | IS_LED_WPS_BLINKING(pLed)) | 898 | IS_LED_WPS_BLINKING(pLed)) |
899 | return; | 899 | return; |
900 | if (pLed->bLedLinkBlinkInProgress == true) { | 900 | if (pLed->bLedLinkBlinkInProgress == true) { |
901 | del_timer_sync(&pLed->BlinkTimer); | 901 | del_timer(&pLed->BlinkTimer); |
902 | pLed->bLedLinkBlinkInProgress = false; | 902 | pLed->bLedLinkBlinkInProgress = false; |
903 | } | 903 | } |
904 | if (pLed->bLedBlinkInProgress == true) { | 904 | if (pLed->bLedBlinkInProgress == true) { |
905 | del_timer_sync(&pLed->BlinkTimer); | 905 | del_timer(&pLed->BlinkTimer); |
906 | pLed->bLedBlinkInProgress = false; | 906 | pLed->bLedBlinkInProgress = false; |
907 | } | 907 | } |
908 | pLed->bLedNoLinkBlinkInProgress = true; | 908 | pLed->bLedNoLinkBlinkInProgress = true; |
@@ -921,11 +921,11 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
921 | IS_LED_WPS_BLINKING(pLed)) | 921 | IS_LED_WPS_BLINKING(pLed)) |
922 | return; | 922 | return; |
923 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 923 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
924 | del_timer_sync(&pLed->BlinkTimer); | 924 | del_timer(&pLed->BlinkTimer); |
925 | pLed->bLedNoLinkBlinkInProgress = false; | 925 | pLed->bLedNoLinkBlinkInProgress = false; |
926 | } | 926 | } |
927 | if (pLed->bLedBlinkInProgress == true) { | 927 | if (pLed->bLedBlinkInProgress == true) { |
928 | del_timer_sync(&pLed->BlinkTimer); | 928 | del_timer(&pLed->BlinkTimer); |
929 | pLed->bLedBlinkInProgress = false; | 929 | pLed->bLedBlinkInProgress = false; |
930 | } | 930 | } |
931 | pLed->bLedLinkBlinkInProgress = true; | 931 | pLed->bLedLinkBlinkInProgress = true; |
@@ -946,15 +946,15 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
946 | if (IS_LED_WPS_BLINKING(pLed)) | 946 | if (IS_LED_WPS_BLINKING(pLed)) |
947 | return; | 947 | return; |
948 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 948 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
949 | del_timer_sync(&pLed->BlinkTimer); | 949 | del_timer(&pLed->BlinkTimer); |
950 | pLed->bLedNoLinkBlinkInProgress = false; | 950 | pLed->bLedNoLinkBlinkInProgress = false; |
951 | } | 951 | } |
952 | if (pLed->bLedLinkBlinkInProgress == true) { | 952 | if (pLed->bLedLinkBlinkInProgress == true) { |
953 | del_timer_sync(&pLed->BlinkTimer); | 953 | del_timer(&pLed->BlinkTimer); |
954 | pLed->bLedLinkBlinkInProgress = false; | 954 | pLed->bLedLinkBlinkInProgress = false; |
955 | } | 955 | } |
956 | if (pLed->bLedBlinkInProgress == true) { | 956 | if (pLed->bLedBlinkInProgress == true) { |
957 | del_timer_sync(&pLed->BlinkTimer); | 957 | del_timer(&pLed->BlinkTimer); |
958 | pLed->bLedBlinkInProgress = false; | 958 | pLed->bLedBlinkInProgress = false; |
959 | } | 959 | } |
960 | pLed->bLedScanBlinkInProgress = true; | 960 | pLed->bLedScanBlinkInProgress = true; |
@@ -975,11 +975,11 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
975 | IS_LED_WPS_BLINKING(pLed)) | 975 | IS_LED_WPS_BLINKING(pLed)) |
976 | return; | 976 | return; |
977 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 977 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
978 | del_timer_sync(&pLed->BlinkTimer); | 978 | del_timer(&pLed->BlinkTimer); |
979 | pLed->bLedNoLinkBlinkInProgress = false; | 979 | pLed->bLedNoLinkBlinkInProgress = false; |
980 | } | 980 | } |
981 | if (pLed->bLedLinkBlinkInProgress == true) { | 981 | if (pLed->bLedLinkBlinkInProgress == true) { |
982 | del_timer_sync(&pLed->BlinkTimer); | 982 | del_timer(&pLed->BlinkTimer); |
983 | pLed->bLedLinkBlinkInProgress = false; | 983 | pLed->bLedLinkBlinkInProgress = false; |
984 | } | 984 | } |
985 | pLed->bLedBlinkInProgress = true; | 985 | pLed->bLedBlinkInProgress = true; |
@@ -998,19 +998,19 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
998 | case LED_CTL_START_WPS_BOTTON: | 998 | case LED_CTL_START_WPS_BOTTON: |
999 | if (pLed->bLedWPSBlinkInProgress == false) { | 999 | if (pLed->bLedWPSBlinkInProgress == false) { |
1000 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 1000 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
1001 | del_timer_sync(&pLed->BlinkTimer); | 1001 | del_timer(&pLed->BlinkTimer); |
1002 | pLed->bLedNoLinkBlinkInProgress = false; | 1002 | pLed->bLedNoLinkBlinkInProgress = false; |
1003 | } | 1003 | } |
1004 | if (pLed->bLedLinkBlinkInProgress == true) { | 1004 | if (pLed->bLedLinkBlinkInProgress == true) { |
1005 | del_timer_sync(&pLed->BlinkTimer); | 1005 | del_timer(&pLed->BlinkTimer); |
1006 | pLed->bLedLinkBlinkInProgress = false; | 1006 | pLed->bLedLinkBlinkInProgress = false; |
1007 | } | 1007 | } |
1008 | if (pLed->bLedBlinkInProgress == true) { | 1008 | if (pLed->bLedBlinkInProgress == true) { |
1009 | del_timer_sync(&pLed->BlinkTimer); | 1009 | del_timer(&pLed->BlinkTimer); |
1010 | pLed->bLedBlinkInProgress = false; | 1010 | pLed->bLedBlinkInProgress = false; |
1011 | } | 1011 | } |
1012 | if (pLed->bLedScanBlinkInProgress == true) { | 1012 | if (pLed->bLedScanBlinkInProgress == true) { |
1013 | del_timer_sync(&pLed->BlinkTimer); | 1013 | del_timer(&pLed->BlinkTimer); |
1014 | pLed->bLedScanBlinkInProgress = false; | 1014 | pLed->bLedScanBlinkInProgress = false; |
1015 | } | 1015 | } |
1016 | pLed->bLedWPSBlinkInProgress = true; | 1016 | pLed->bLedWPSBlinkInProgress = true; |
@@ -1025,23 +1025,23 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
1025 | break; | 1025 | break; |
1026 | case LED_CTL_STOP_WPS: | 1026 | case LED_CTL_STOP_WPS: |
1027 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 1027 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
1028 | del_timer_sync(&pLed->BlinkTimer); | 1028 | del_timer(&pLed->BlinkTimer); |
1029 | pLed->bLedNoLinkBlinkInProgress = false; | 1029 | pLed->bLedNoLinkBlinkInProgress = false; |
1030 | } | 1030 | } |
1031 | if (pLed->bLedLinkBlinkInProgress == true) { | 1031 | if (pLed->bLedLinkBlinkInProgress == true) { |
1032 | del_timer_sync(&pLed->BlinkTimer); | 1032 | del_timer(&pLed->BlinkTimer); |
1033 | pLed->bLedLinkBlinkInProgress = false; | 1033 | pLed->bLedLinkBlinkInProgress = false; |
1034 | } | 1034 | } |
1035 | if (pLed->bLedBlinkInProgress == true) { | 1035 | if (pLed->bLedBlinkInProgress == true) { |
1036 | del_timer_sync(&pLed->BlinkTimer); | 1036 | del_timer(&pLed->BlinkTimer); |
1037 | pLed->bLedBlinkInProgress = false; | 1037 | pLed->bLedBlinkInProgress = false; |
1038 | } | 1038 | } |
1039 | if (pLed->bLedScanBlinkInProgress == true) { | 1039 | if (pLed->bLedScanBlinkInProgress == true) { |
1040 | del_timer_sync(&pLed->BlinkTimer); | 1040 | del_timer(&pLed->BlinkTimer); |
1041 | pLed->bLedScanBlinkInProgress = false; | 1041 | pLed->bLedScanBlinkInProgress = false; |
1042 | } | 1042 | } |
1043 | if (pLed->bLedWPSBlinkInProgress) | 1043 | if (pLed->bLedWPSBlinkInProgress) |
1044 | del_timer_sync(&pLed->BlinkTimer); | 1044 | del_timer(&pLed->BlinkTimer); |
1045 | else | 1045 | else |
1046 | pLed->bLedWPSBlinkInProgress = true; | 1046 | pLed->bLedWPSBlinkInProgress = true; |
1047 | pLed->CurrLedState = LED_BLINK_WPS_STOP; | 1047 | pLed->CurrLedState = LED_BLINK_WPS_STOP; |
@@ -1057,7 +1057,7 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
1057 | break; | 1057 | break; |
1058 | case LED_CTL_STOP_WPS_FAIL: | 1058 | case LED_CTL_STOP_WPS_FAIL: |
1059 | if (pLed->bLedWPSBlinkInProgress) { | 1059 | if (pLed->bLedWPSBlinkInProgress) { |
1060 | del_timer_sync(&pLed->BlinkTimer); | 1060 | del_timer(&pLed->BlinkTimer); |
1061 | pLed->bLedWPSBlinkInProgress = false; | 1061 | pLed->bLedWPSBlinkInProgress = false; |
1062 | } | 1062 | } |
1063 | pLed->bLedNoLinkBlinkInProgress = true; | 1063 | pLed->bLedNoLinkBlinkInProgress = true; |
@@ -1073,23 +1073,23 @@ static void SwLedControlMode1(struct _adapter *padapter, | |||
1073 | pLed->CurrLedState = LED_OFF; | 1073 | pLed->CurrLedState = LED_OFF; |
1074 | pLed->BlinkingLedState = LED_OFF; | 1074 | pLed->BlinkingLedState = LED_OFF; |
1075 | if (pLed->bLedNoLinkBlinkInProgress) { | 1075 | if (pLed->bLedNoLinkBlinkInProgress) { |
1076 | del_timer_sync(&pLed->BlinkTimer); | 1076 | del_timer(&pLed->BlinkTimer); |
1077 | pLed->bLedNoLinkBlinkInProgress = false; | 1077 | pLed->bLedNoLinkBlinkInProgress = false; |
1078 | } | 1078 | } |
1079 | if (pLed->bLedLinkBlinkInProgress) { | 1079 | if (pLed->bLedLinkBlinkInProgress) { |
1080 | del_timer_sync(&pLed->BlinkTimer); | 1080 | del_timer(&pLed->BlinkTimer); |
1081 | pLed->bLedLinkBlinkInProgress = false; | 1081 | pLed->bLedLinkBlinkInProgress = false; |
1082 | } | 1082 | } |
1083 | if (pLed->bLedBlinkInProgress) { | 1083 | if (pLed->bLedBlinkInProgress) { |
1084 | del_timer_sync(&pLed->BlinkTimer); | 1084 | del_timer(&pLed->BlinkTimer); |
1085 | pLed->bLedBlinkInProgress = false; | 1085 | pLed->bLedBlinkInProgress = false; |
1086 | } | 1086 | } |
1087 | if (pLed->bLedWPSBlinkInProgress) { | 1087 | if (pLed->bLedWPSBlinkInProgress) { |
1088 | del_timer_sync(&pLed->BlinkTimer); | 1088 | del_timer(&pLed->BlinkTimer); |
1089 | pLed->bLedWPSBlinkInProgress = false; | 1089 | pLed->bLedWPSBlinkInProgress = false; |
1090 | } | 1090 | } |
1091 | if (pLed->bLedScanBlinkInProgress) { | 1091 | if (pLed->bLedScanBlinkInProgress) { |
1092 | del_timer_sync(&pLed->BlinkTimer); | 1092 | del_timer(&pLed->BlinkTimer); |
1093 | pLed->bLedScanBlinkInProgress = false; | 1093 | pLed->bLedScanBlinkInProgress = false; |
1094 | } | 1094 | } |
1095 | mod_timer(&pLed->BlinkTimer, | 1095 | mod_timer(&pLed->BlinkTimer, |
@@ -1116,7 +1116,7 @@ static void SwLedControlMode2(struct _adapter *padapter, | |||
1116 | return; | 1116 | return; |
1117 | 1117 | ||
1118 | if (pLed->bLedBlinkInProgress == true) { | 1118 | if (pLed->bLedBlinkInProgress == true) { |
1119 | del_timer_sync(&pLed->BlinkTimer); | 1119 | del_timer(&pLed->BlinkTimer); |
1120 | pLed->bLedBlinkInProgress = false; | 1120 | pLed->bLedBlinkInProgress = false; |
1121 | } | 1121 | } |
1122 | pLed->bLedScanBlinkInProgress = true; | 1122 | pLed->bLedScanBlinkInProgress = true; |
@@ -1154,11 +1154,11 @@ static void SwLedControlMode2(struct _adapter *padapter, | |||
1154 | pLed->CurrLedState = LED_ON; | 1154 | pLed->CurrLedState = LED_ON; |
1155 | pLed->BlinkingLedState = LED_ON; | 1155 | pLed->BlinkingLedState = LED_ON; |
1156 | if (pLed->bLedBlinkInProgress) { | 1156 | if (pLed->bLedBlinkInProgress) { |
1157 | del_timer_sync(&pLed->BlinkTimer); | 1157 | del_timer(&pLed->BlinkTimer); |
1158 | pLed->bLedBlinkInProgress = false; | 1158 | pLed->bLedBlinkInProgress = false; |
1159 | } | 1159 | } |
1160 | if (pLed->bLedScanBlinkInProgress) { | 1160 | if (pLed->bLedScanBlinkInProgress) { |
1161 | del_timer_sync(&pLed->BlinkTimer); | 1161 | del_timer(&pLed->BlinkTimer); |
1162 | pLed->bLedScanBlinkInProgress = false; | 1162 | pLed->bLedScanBlinkInProgress = false; |
1163 | } | 1163 | } |
1164 | 1164 | ||
@@ -1170,11 +1170,11 @@ static void SwLedControlMode2(struct _adapter *padapter, | |||
1170 | case LED_CTL_START_WPS_BOTTON: | 1170 | case LED_CTL_START_WPS_BOTTON: |
1171 | if (pLed->bLedWPSBlinkInProgress == false) { | 1171 | if (pLed->bLedWPSBlinkInProgress == false) { |
1172 | if (pLed->bLedBlinkInProgress == true) { | 1172 | if (pLed->bLedBlinkInProgress == true) { |
1173 | del_timer_sync(&pLed->BlinkTimer); | 1173 | del_timer(&pLed->BlinkTimer); |
1174 | pLed->bLedBlinkInProgress = false; | 1174 | pLed->bLedBlinkInProgress = false; |
1175 | } | 1175 | } |
1176 | if (pLed->bLedScanBlinkInProgress == true) { | 1176 | if (pLed->bLedScanBlinkInProgress == true) { |
1177 | del_timer_sync(&pLed->BlinkTimer); | 1177 | del_timer(&pLed->BlinkTimer); |
1178 | pLed->bLedScanBlinkInProgress = false; | 1178 | pLed->bLedScanBlinkInProgress = false; |
1179 | } | 1179 | } |
1180 | pLed->bLedWPSBlinkInProgress = true; | 1180 | pLed->bLedWPSBlinkInProgress = true; |
@@ -1214,15 +1214,15 @@ static void SwLedControlMode2(struct _adapter *padapter, | |||
1214 | pLed->CurrLedState = LED_OFF; | 1214 | pLed->CurrLedState = LED_OFF; |
1215 | pLed->BlinkingLedState = LED_OFF; | 1215 | pLed->BlinkingLedState = LED_OFF; |
1216 | if (pLed->bLedBlinkInProgress) { | 1216 | if (pLed->bLedBlinkInProgress) { |
1217 | del_timer_sync(&pLed->BlinkTimer); | 1217 | del_timer(&pLed->BlinkTimer); |
1218 | pLed->bLedBlinkInProgress = false; | 1218 | pLed->bLedBlinkInProgress = false; |
1219 | } | 1219 | } |
1220 | if (pLed->bLedScanBlinkInProgress) { | 1220 | if (pLed->bLedScanBlinkInProgress) { |
1221 | del_timer_sync(&pLed->BlinkTimer); | 1221 | del_timer(&pLed->BlinkTimer); |
1222 | pLed->bLedScanBlinkInProgress = false; | 1222 | pLed->bLedScanBlinkInProgress = false; |
1223 | } | 1223 | } |
1224 | if (pLed->bLedWPSBlinkInProgress) { | 1224 | if (pLed->bLedWPSBlinkInProgress) { |
1225 | del_timer_sync(&pLed->BlinkTimer); | 1225 | del_timer(&pLed->BlinkTimer); |
1226 | pLed->bLedWPSBlinkInProgress = false; | 1226 | pLed->bLedWPSBlinkInProgress = false; |
1227 | } | 1227 | } |
1228 | mod_timer(&pLed->BlinkTimer, | 1228 | mod_timer(&pLed->BlinkTimer, |
@@ -1248,7 +1248,7 @@ static void SwLedControlMode3(struct _adapter *padapter, | |||
1248 | if (IS_LED_WPS_BLINKING(pLed)) | 1248 | if (IS_LED_WPS_BLINKING(pLed)) |
1249 | return; | 1249 | return; |
1250 | if (pLed->bLedBlinkInProgress == true) { | 1250 | if (pLed->bLedBlinkInProgress == true) { |
1251 | del_timer_sync(&pLed->BlinkTimer); | 1251 | del_timer(&pLed->BlinkTimer); |
1252 | pLed->bLedBlinkInProgress = false; | 1252 | pLed->bLedBlinkInProgress = false; |
1253 | } | 1253 | } |
1254 | pLed->bLedScanBlinkInProgress = true; | 1254 | pLed->bLedScanBlinkInProgress = true; |
@@ -1286,11 +1286,11 @@ static void SwLedControlMode3(struct _adapter *padapter, | |||
1286 | pLed->CurrLedState = LED_ON; | 1286 | pLed->CurrLedState = LED_ON; |
1287 | pLed->BlinkingLedState = LED_ON; | 1287 | pLed->BlinkingLedState = LED_ON; |
1288 | if (pLed->bLedBlinkInProgress) { | 1288 | if (pLed->bLedBlinkInProgress) { |
1289 | del_timer_sync(&pLed->BlinkTimer); | 1289 | del_timer(&pLed->BlinkTimer); |
1290 | pLed->bLedBlinkInProgress = false; | 1290 | pLed->bLedBlinkInProgress = false; |
1291 | } | 1291 | } |
1292 | if (pLed->bLedScanBlinkInProgress) { | 1292 | if (pLed->bLedScanBlinkInProgress) { |
1293 | del_timer_sync(&pLed->BlinkTimer); | 1293 | del_timer(&pLed->BlinkTimer); |
1294 | pLed->bLedScanBlinkInProgress = false; | 1294 | pLed->bLedScanBlinkInProgress = false; |
1295 | } | 1295 | } |
1296 | mod_timer(&pLed->BlinkTimer, | 1296 | mod_timer(&pLed->BlinkTimer, |
@@ -1300,11 +1300,11 @@ static void SwLedControlMode3(struct _adapter *padapter, | |||
1300 | case LED_CTL_START_WPS_BOTTON: | 1300 | case LED_CTL_START_WPS_BOTTON: |
1301 | if (pLed->bLedWPSBlinkInProgress == false) { | 1301 | if (pLed->bLedWPSBlinkInProgress == false) { |
1302 | if (pLed->bLedBlinkInProgress == true) { | 1302 | if (pLed->bLedBlinkInProgress == true) { |
1303 | del_timer_sync(&pLed->BlinkTimer); | 1303 | del_timer(&pLed->BlinkTimer); |
1304 | pLed->bLedBlinkInProgress = false; | 1304 | pLed->bLedBlinkInProgress = false; |
1305 | } | 1305 | } |
1306 | if (pLed->bLedScanBlinkInProgress == true) { | 1306 | if (pLed->bLedScanBlinkInProgress == true) { |
1307 | del_timer_sync(&pLed->BlinkTimer); | 1307 | del_timer(&pLed->BlinkTimer); |
1308 | pLed->bLedScanBlinkInProgress = false; | 1308 | pLed->bLedScanBlinkInProgress = false; |
1309 | } | 1309 | } |
1310 | pLed->bLedWPSBlinkInProgress = true; | 1310 | pLed->bLedWPSBlinkInProgress = true; |
@@ -1319,7 +1319,7 @@ static void SwLedControlMode3(struct _adapter *padapter, | |||
1319 | break; | 1319 | break; |
1320 | case LED_CTL_STOP_WPS: | 1320 | case LED_CTL_STOP_WPS: |
1321 | if (pLed->bLedWPSBlinkInProgress) { | 1321 | if (pLed->bLedWPSBlinkInProgress) { |
1322 | del_timer_sync(&(pLed->BlinkTimer)); | 1322 | del_timer(&pLed->BlinkTimer); |
1323 | pLed->bLedWPSBlinkInProgress = false; | 1323 | pLed->bLedWPSBlinkInProgress = false; |
1324 | } else | 1324 | } else |
1325 | pLed->bLedWPSBlinkInProgress = true; | 1325 | pLed->bLedWPSBlinkInProgress = true; |
@@ -1336,7 +1336,7 @@ static void SwLedControlMode3(struct _adapter *padapter, | |||
1336 | break; | 1336 | break; |
1337 | case LED_CTL_STOP_WPS_FAIL: | 1337 | case LED_CTL_STOP_WPS_FAIL: |
1338 | if (pLed->bLedWPSBlinkInProgress) { | 1338 | if (pLed->bLedWPSBlinkInProgress) { |
1339 | del_timer_sync(&pLed->BlinkTimer); | 1339 | del_timer(&pLed->BlinkTimer); |
1340 | pLed->bLedWPSBlinkInProgress = false; | 1340 | pLed->bLedWPSBlinkInProgress = false; |
1341 | } | 1341 | } |
1342 | pLed->CurrLedState = LED_OFF; | 1342 | pLed->CurrLedState = LED_OFF; |
@@ -1357,15 +1357,15 @@ static void SwLedControlMode3(struct _adapter *padapter, | |||
1357 | pLed->CurrLedState = LED_OFF; | 1357 | pLed->CurrLedState = LED_OFF; |
1358 | pLed->BlinkingLedState = LED_OFF; | 1358 | pLed->BlinkingLedState = LED_OFF; |
1359 | if (pLed->bLedBlinkInProgress) { | 1359 | if (pLed->bLedBlinkInProgress) { |
1360 | del_timer_sync(&pLed->BlinkTimer); | 1360 | del_timer(&pLed->BlinkTimer); |
1361 | pLed->bLedBlinkInProgress = false; | 1361 | pLed->bLedBlinkInProgress = false; |
1362 | } | 1362 | } |
1363 | if (pLed->bLedScanBlinkInProgress) { | 1363 | if (pLed->bLedScanBlinkInProgress) { |
1364 | del_timer_sync(&pLed->BlinkTimer); | 1364 | del_timer(&pLed->BlinkTimer); |
1365 | pLed->bLedScanBlinkInProgress = false; | 1365 | pLed->bLedScanBlinkInProgress = false; |
1366 | } | 1366 | } |
1367 | if (pLed->bLedWPSBlinkInProgress) { | 1367 | if (pLed->bLedWPSBlinkInProgress) { |
1368 | del_timer_sync(&pLed->BlinkTimer); | 1368 | del_timer(&pLed->BlinkTimer); |
1369 | pLed->bLedWPSBlinkInProgress = false; | 1369 | pLed->bLedWPSBlinkInProgress = false; |
1370 | } | 1370 | } |
1371 | mod_timer(&pLed->BlinkTimer, | 1371 | mod_timer(&pLed->BlinkTimer, |
@@ -1388,7 +1388,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1388 | case LED_CTL_START_TO_LINK: | 1388 | case LED_CTL_START_TO_LINK: |
1389 | if (pLed1->bLedWPSBlinkInProgress) { | 1389 | if (pLed1->bLedWPSBlinkInProgress) { |
1390 | pLed1->bLedWPSBlinkInProgress = false; | 1390 | pLed1->bLedWPSBlinkInProgress = false; |
1391 | del_timer_sync(&pLed1->BlinkTimer); | 1391 | del_timer(&pLed1->BlinkTimer); |
1392 | pLed1->BlinkingLedState = LED_OFF; | 1392 | pLed1->BlinkingLedState = LED_OFF; |
1393 | pLed1->CurrLedState = LED_OFF; | 1393 | pLed1->CurrLedState = LED_OFF; |
1394 | if (pLed1->bLedOn) | 1394 | if (pLed1->bLedOn) |
@@ -1400,11 +1400,11 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1400 | IS_LED_WPS_BLINKING(pLed)) | 1400 | IS_LED_WPS_BLINKING(pLed)) |
1401 | return; | 1401 | return; |
1402 | if (pLed->bLedBlinkInProgress == true) { | 1402 | if (pLed->bLedBlinkInProgress == true) { |
1403 | del_timer_sync(&pLed->BlinkTimer); | 1403 | del_timer(&pLed->BlinkTimer); |
1404 | pLed->bLedBlinkInProgress = false; | 1404 | pLed->bLedBlinkInProgress = false; |
1405 | } | 1405 | } |
1406 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 1406 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
1407 | del_timer_sync(&pLed->BlinkTimer); | 1407 | del_timer(&pLed->BlinkTimer); |
1408 | pLed->bLedNoLinkBlinkInProgress = false; | 1408 | pLed->bLedNoLinkBlinkInProgress = false; |
1409 | } | 1409 | } |
1410 | pLed->bLedStartToLinkBlinkInProgress = true; | 1410 | pLed->bLedStartToLinkBlinkInProgress = true; |
@@ -1426,7 +1426,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1426 | if (LedAction == LED_CTL_LINK) { | 1426 | if (LedAction == LED_CTL_LINK) { |
1427 | if (pLed1->bLedWPSBlinkInProgress) { | 1427 | if (pLed1->bLedWPSBlinkInProgress) { |
1428 | pLed1->bLedWPSBlinkInProgress = false; | 1428 | pLed1->bLedWPSBlinkInProgress = false; |
1429 | del_timer_sync(&pLed1->BlinkTimer); | 1429 | del_timer(&pLed1->BlinkTimer); |
1430 | pLed1->BlinkingLedState = LED_OFF; | 1430 | pLed1->BlinkingLedState = LED_OFF; |
1431 | pLed1->CurrLedState = LED_OFF; | 1431 | pLed1->CurrLedState = LED_OFF; |
1432 | if (pLed1->bLedOn) | 1432 | if (pLed1->bLedOn) |
@@ -1439,7 +1439,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1439 | IS_LED_WPS_BLINKING(pLed)) | 1439 | IS_LED_WPS_BLINKING(pLed)) |
1440 | return; | 1440 | return; |
1441 | if (pLed->bLedBlinkInProgress == true) { | 1441 | if (pLed->bLedBlinkInProgress == true) { |
1442 | del_timer_sync(&pLed->BlinkTimer); | 1442 | del_timer(&pLed->BlinkTimer); |
1443 | pLed->bLedBlinkInProgress = false; | 1443 | pLed->bLedBlinkInProgress = false; |
1444 | } | 1444 | } |
1445 | pLed->bLedNoLinkBlinkInProgress = true; | 1445 | pLed->bLedNoLinkBlinkInProgress = true; |
@@ -1460,11 +1460,11 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1460 | if (IS_LED_WPS_BLINKING(pLed)) | 1460 | if (IS_LED_WPS_BLINKING(pLed)) |
1461 | return; | 1461 | return; |
1462 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 1462 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
1463 | del_timer_sync(&pLed->BlinkTimer); | 1463 | del_timer(&pLed->BlinkTimer); |
1464 | pLed->bLedNoLinkBlinkInProgress = false; | 1464 | pLed->bLedNoLinkBlinkInProgress = false; |
1465 | } | 1465 | } |
1466 | if (pLed->bLedBlinkInProgress == true) { | 1466 | if (pLed->bLedBlinkInProgress == true) { |
1467 | del_timer_sync(&pLed->BlinkTimer); | 1467 | del_timer(&pLed->BlinkTimer); |
1468 | pLed->bLedBlinkInProgress = false; | 1468 | pLed->bLedBlinkInProgress = false; |
1469 | } | 1469 | } |
1470 | pLed->bLedScanBlinkInProgress = true; | 1470 | pLed->bLedScanBlinkInProgress = true; |
@@ -1485,7 +1485,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1485 | IS_LED_WPS_BLINKING(pLed)) | 1485 | IS_LED_WPS_BLINKING(pLed)) |
1486 | return; | 1486 | return; |
1487 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 1487 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
1488 | del_timer_sync(&pLed->BlinkTimer); | 1488 | del_timer(&pLed->BlinkTimer); |
1489 | pLed->bLedNoLinkBlinkInProgress = false; | 1489 | pLed->bLedNoLinkBlinkInProgress = false; |
1490 | } | 1490 | } |
1491 | pLed->bLedBlinkInProgress = true; | 1491 | pLed->bLedBlinkInProgress = true; |
@@ -1503,7 +1503,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1503 | case LED_CTL_START_WPS_BOTTON: | 1503 | case LED_CTL_START_WPS_BOTTON: |
1504 | if (pLed1->bLedWPSBlinkInProgress) { | 1504 | if (pLed1->bLedWPSBlinkInProgress) { |
1505 | pLed1->bLedWPSBlinkInProgress = false; | 1505 | pLed1->bLedWPSBlinkInProgress = false; |
1506 | del_timer_sync(&(pLed1->BlinkTimer)); | 1506 | del_timer(&pLed1->BlinkTimer); |
1507 | pLed1->BlinkingLedState = LED_OFF; | 1507 | pLed1->BlinkingLedState = LED_OFF; |
1508 | pLed1->CurrLedState = LED_OFF; | 1508 | pLed1->CurrLedState = LED_OFF; |
1509 | if (pLed1->bLedOn) | 1509 | if (pLed1->bLedOn) |
@@ -1512,15 +1512,15 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1512 | } | 1512 | } |
1513 | if (pLed->bLedWPSBlinkInProgress == false) { | 1513 | if (pLed->bLedWPSBlinkInProgress == false) { |
1514 | if (pLed->bLedNoLinkBlinkInProgress == true) { | 1514 | if (pLed->bLedNoLinkBlinkInProgress == true) { |
1515 | del_timer_sync(&pLed->BlinkTimer); | 1515 | del_timer(&pLed->BlinkTimer); |
1516 | pLed->bLedNoLinkBlinkInProgress = false; | 1516 | pLed->bLedNoLinkBlinkInProgress = false; |
1517 | } | 1517 | } |
1518 | if (pLed->bLedBlinkInProgress == true) { | 1518 | if (pLed->bLedBlinkInProgress == true) { |
1519 | del_timer_sync(&pLed->BlinkTimer); | 1519 | del_timer(&pLed->BlinkTimer); |
1520 | pLed->bLedBlinkInProgress = false; | 1520 | pLed->bLedBlinkInProgress = false; |
1521 | } | 1521 | } |
1522 | if (pLed->bLedScanBlinkInProgress == true) { | 1522 | if (pLed->bLedScanBlinkInProgress == true) { |
1523 | del_timer_sync(&pLed->BlinkTimer); | 1523 | del_timer(&pLed->BlinkTimer); |
1524 | pLed->bLedScanBlinkInProgress = false; | 1524 | pLed->bLedScanBlinkInProgress = false; |
1525 | } | 1525 | } |
1526 | pLed->bLedWPSBlinkInProgress = true; | 1526 | pLed->bLedWPSBlinkInProgress = true; |
@@ -1538,7 +1538,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1538 | break; | 1538 | break; |
1539 | case LED_CTL_STOP_WPS: /*WPS connect success*/ | 1539 | case LED_CTL_STOP_WPS: /*WPS connect success*/ |
1540 | if (pLed->bLedWPSBlinkInProgress) { | 1540 | if (pLed->bLedWPSBlinkInProgress) { |
1541 | del_timer_sync(&pLed->BlinkTimer); | 1541 | del_timer(&pLed->BlinkTimer); |
1542 | pLed->bLedWPSBlinkInProgress = false; | 1542 | pLed->bLedWPSBlinkInProgress = false; |
1543 | } | 1543 | } |
1544 | pLed->bLedNoLinkBlinkInProgress = true; | 1544 | pLed->bLedNoLinkBlinkInProgress = true; |
@@ -1552,7 +1552,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1552 | break; | 1552 | break; |
1553 | case LED_CTL_STOP_WPS_FAIL: /*WPS authentication fail*/ | 1553 | case LED_CTL_STOP_WPS_FAIL: /*WPS authentication fail*/ |
1554 | if (pLed->bLedWPSBlinkInProgress) { | 1554 | if (pLed->bLedWPSBlinkInProgress) { |
1555 | del_timer_sync(&pLed->BlinkTimer); | 1555 | del_timer(&pLed->BlinkTimer); |
1556 | pLed->bLedWPSBlinkInProgress = false; | 1556 | pLed->bLedWPSBlinkInProgress = false; |
1557 | } | 1557 | } |
1558 | pLed->bLedNoLinkBlinkInProgress = true; | 1558 | pLed->bLedNoLinkBlinkInProgress = true; |
@@ -1565,7 +1565,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1565 | msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); | 1565 | msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); |
1566 | /*LED1 settings*/ | 1566 | /*LED1 settings*/ |
1567 | if (pLed1->bLedWPSBlinkInProgress) | 1567 | if (pLed1->bLedWPSBlinkInProgress) |
1568 | del_timer_sync(&pLed1->BlinkTimer); | 1568 | del_timer(&pLed1->BlinkTimer); |
1569 | else | 1569 | else |
1570 | pLed1->bLedWPSBlinkInProgress = true; | 1570 | pLed1->bLedWPSBlinkInProgress = true; |
1571 | pLed1->CurrLedState = LED_BLINK_WPS_STOP; | 1571 | pLed1->CurrLedState = LED_BLINK_WPS_STOP; |
@@ -1578,7 +1578,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1578 | break; | 1578 | break; |
1579 | case LED_CTL_STOP_WPS_FAIL_OVERLAP: /*WPS session overlap*/ | 1579 | case LED_CTL_STOP_WPS_FAIL_OVERLAP: /*WPS session overlap*/ |
1580 | if (pLed->bLedWPSBlinkInProgress) { | 1580 | if (pLed->bLedWPSBlinkInProgress) { |
1581 | del_timer_sync(&pLed->BlinkTimer); | 1581 | del_timer(&pLed->BlinkTimer); |
1582 | pLed->bLedWPSBlinkInProgress = false; | 1582 | pLed->bLedWPSBlinkInProgress = false; |
1583 | } | 1583 | } |
1584 | pLed->bLedNoLinkBlinkInProgress = true; | 1584 | pLed->bLedNoLinkBlinkInProgress = true; |
@@ -1591,7 +1591,7 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1591 | msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); | 1591 | msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA)); |
1592 | /*LED1 settings*/ | 1592 | /*LED1 settings*/ |
1593 | if (pLed1->bLedWPSBlinkInProgress) | 1593 | if (pLed1->bLedWPSBlinkInProgress) |
1594 | del_timer_sync(&pLed1->BlinkTimer); | 1594 | del_timer(&pLed1->BlinkTimer); |
1595 | else | 1595 | else |
1596 | pLed1->bLedWPSBlinkInProgress = true; | 1596 | pLed1->bLedWPSBlinkInProgress = true; |
1597 | pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; | 1597 | pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP; |
@@ -1607,31 +1607,31 @@ static void SwLedControlMode4(struct _adapter *padapter, | |||
1607 | pLed->CurrLedState = LED_OFF; | 1607 | pLed->CurrLedState = LED_OFF; |
1608 | pLed->BlinkingLedState = LED_OFF; | 1608 | pLed->BlinkingLedState = LED_OFF; |
1609 | if (pLed->bLedNoLinkBlinkInProgress) { | 1609 | if (pLed->bLedNoLinkBlinkInProgress) { |
1610 | del_timer_sync(&pLed->BlinkTimer); | 1610 | del_timer(&pLed->BlinkTimer); |
1611 | pLed->bLedNoLinkBlinkInProgress = false; | 1611 | pLed->bLedNoLinkBlinkInProgress = false; |
1612 | } | 1612 | } |
1613 | if (pLed->bLedLinkBlinkInProgress) { | 1613 | if (pLed->bLedLinkBlinkInProgress) { |
1614 | del_timer_sync(&pLed->BlinkTimer); | 1614 | del_timer(&pLed->BlinkTimer); |
1615 | pLed->bLedLinkBlinkInProgress = false; | 1615 | pLed->bLedLinkBlinkInProgress = false; |
1616 | } | 1616 | } |
1617 | if (pLed->bLedBlinkInProgress) { | 1617 | if (pLed->bLedBlinkInProgress) { |
1618 | del_timer_sync(&pLed->BlinkTimer); | 1618 | del_timer(&pLed->BlinkTimer); |
1619 | pLed->bLedBlinkInProgress = false; | 1619 | pLed->bLedBlinkInProgress = false; |
1620 | } | 1620 | } |
1621 | if (pLed->bLedWPSBlinkInProgress) { | 1621 | if (pLed->bLedWPSBlinkInProgress) { |
1622 | del_timer_sync(&pLed->BlinkTimer); | 1622 | del_timer(&pLed->BlinkTimer); |
1623 | pLed->bLedWPSBlinkInProgress = false; | 1623 | pLed->bLedWPSBlinkInProgress = false; |
1624 | } | 1624 | } |
1625 | if (pLed->bLedScanBlinkInProgress) { | 1625 | if (pLed->bLedScanBlinkInProgress) { |
1626 | del_timer_sync(&pLed->BlinkTimer); | 1626 | del_timer(&pLed->BlinkTimer); |
1627 | pLed->bLedScanBlinkInProgress = false; | 1627 | pLed->bLedScanBlinkInProgress = false; |
1628 | } | 1628 | } |
1629 | if (pLed->bLedStartToLinkBlinkInProgress) { | 1629 | if (pLed->bLedStartToLinkBlinkInProgress) { |
1630 | del_timer_sync(&pLed->BlinkTimer); | 1630 | del_timer(&pLed->BlinkTimer); |
1631 | pLed->bLedStartToLinkBlinkInProgress = false; | 1631 | pLed->bLedStartToLinkBlinkInProgress = false; |
1632 | } | 1632 | } |
1633 | if (pLed1->bLedWPSBlinkInProgress) { | 1633 | if (pLed1->bLedWPSBlinkInProgress) { |
1634 | del_timer_sync(&pLed1->BlinkTimer); | 1634 | del_timer(&pLed1->BlinkTimer); |
1635 | pLed1->bLedWPSBlinkInProgress = false; | 1635 | pLed1->bLedWPSBlinkInProgress = false; |
1636 | } | 1636 | } |
1637 | pLed1->BlinkingLedState = LED_UNKNOWN; | 1637 | pLed1->BlinkingLedState = LED_UNKNOWN; |
@@ -1671,7 +1671,7 @@ static void SwLedControlMode5(struct _adapter *padapter, | |||
1671 | ; /* dummy branch */ | 1671 | ; /* dummy branch */ |
1672 | else if (pLed->bLedScanBlinkInProgress == false) { | 1672 | else if (pLed->bLedScanBlinkInProgress == false) { |
1673 | if (pLed->bLedBlinkInProgress == true) { | 1673 | if (pLed->bLedBlinkInProgress == true) { |
1674 | del_timer_sync(&pLed->BlinkTimer); | 1674 | del_timer(&pLed->BlinkTimer); |
1675 | pLed->bLedBlinkInProgress = false; | 1675 | pLed->bLedBlinkInProgress = false; |
1676 | } | 1676 | } |
1677 | pLed->bLedScanBlinkInProgress = true; | 1677 | pLed->bLedScanBlinkInProgress = true; |
@@ -1705,7 +1705,7 @@ static void SwLedControlMode5(struct _adapter *padapter, | |||
1705 | pLed->CurrLedState = LED_OFF; | 1705 | pLed->CurrLedState = LED_OFF; |
1706 | pLed->BlinkingLedState = LED_OFF; | 1706 | pLed->BlinkingLedState = LED_OFF; |
1707 | if (pLed->bLedBlinkInProgress) { | 1707 | if (pLed->bLedBlinkInProgress) { |
1708 | del_timer_sync(&pLed->BlinkTimer); | 1708 | del_timer(&pLed->BlinkTimer); |
1709 | pLed->bLedBlinkInProgress = false; | 1709 | pLed->bLedBlinkInProgress = false; |
1710 | } | 1710 | } |
1711 | SwLedOff(padapter, pLed); | 1711 | SwLedOff(padapter, pLed); |
@@ -1756,7 +1756,7 @@ static void SwLedControlMode6(struct _adapter *padapter, | |||
1756 | case LED_CTL_START_WPS_BOTTON: | 1756 | case LED_CTL_START_WPS_BOTTON: |
1757 | if (pLed->bLedWPSBlinkInProgress == false) { | 1757 | if (pLed->bLedWPSBlinkInProgress == false) { |
1758 | if (pLed->bLedBlinkInProgress == true) { | 1758 | if (pLed->bLedBlinkInProgress == true) { |
1759 | del_timer_sync(&pLed->BlinkTimer); | 1759 | del_timer(&pLed->BlinkTimer); |
1760 | pLed->bLedBlinkInProgress = false; | 1760 | pLed->bLedBlinkInProgress = false; |
1761 | } | 1761 | } |
1762 | pLed->bLedWPSBlinkInProgress = true; | 1762 | pLed->bLedWPSBlinkInProgress = true; |
@@ -1772,7 +1772,7 @@ static void SwLedControlMode6(struct _adapter *padapter, | |||
1772 | case LED_CTL_STOP_WPS_FAIL: | 1772 | case LED_CTL_STOP_WPS_FAIL: |
1773 | case LED_CTL_STOP_WPS: | 1773 | case LED_CTL_STOP_WPS: |
1774 | if (pLed->bLedWPSBlinkInProgress) { | 1774 | if (pLed->bLedWPSBlinkInProgress) { |
1775 | del_timer_sync(&pLed->BlinkTimer); | 1775 | del_timer(&pLed->BlinkTimer); |
1776 | pLed->bLedWPSBlinkInProgress = false; | 1776 | pLed->bLedWPSBlinkInProgress = false; |
1777 | } | 1777 | } |
1778 | pLed->CurrLedState = LED_ON; | 1778 | pLed->CurrLedState = LED_ON; |
@@ -1784,11 +1784,11 @@ static void SwLedControlMode6(struct _adapter *padapter, | |||
1784 | pLed->CurrLedState = LED_OFF; | 1784 | pLed->CurrLedState = LED_OFF; |
1785 | pLed->BlinkingLedState = LED_OFF; | 1785 | pLed->BlinkingLedState = LED_OFF; |
1786 | if (pLed->bLedBlinkInProgress) { | 1786 | if (pLed->bLedBlinkInProgress) { |
1787 | del_timer_sync(&pLed->BlinkTimer); | 1787 | del_timer(&pLed->BlinkTimer); |
1788 | pLed->bLedBlinkInProgress = false; | 1788 | pLed->bLedBlinkInProgress = false; |
1789 | } | 1789 | } |
1790 | if (pLed->bLedWPSBlinkInProgress) { | 1790 | if (pLed->bLedWPSBlinkInProgress) { |
1791 | del_timer_sync(&pLed->BlinkTimer); | 1791 | del_timer(&pLed->BlinkTimer); |
1792 | pLed->bLedWPSBlinkInProgress = false; | 1792 | pLed->bLedWPSBlinkInProgress = false; |
1793 | } | 1793 | } |
1794 | SwLedOff(padapter, pLed); | 1794 | SwLedOff(padapter, pLed); |
diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 1a1c38f885d6..e35854d28f90 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c | |||
@@ -910,7 +910,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, | |||
910 | if (pcmd->res != H2C_SUCCESS) | 910 | if (pcmd->res != H2C_SUCCESS) |
911 | mod_timer(&pmlmepriv->assoc_timer, | 911 | mod_timer(&pmlmepriv->assoc_timer, |
912 | jiffies + msecs_to_jiffies(1)); | 912 | jiffies + msecs_to_jiffies(1)); |
913 | del_timer_sync(&pmlmepriv->assoc_timer); | 913 | del_timer(&pmlmepriv->assoc_timer); |
914 | #ifdef __BIG_ENDIAN | 914 | #ifdef __BIG_ENDIAN |
915 | /* endian_convert */ | 915 | /* endian_convert */ |
916 | pnetwork->Length = le32_to_cpu(pnetwork->Length); | 916 | pnetwork->Length = le32_to_cpu(pnetwork->Length); |
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index fb2b195b90af..c044b0e55ba9 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c | |||
@@ -582,7 +582,7 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf) | |||
582 | spin_lock_irqsave(&pmlmepriv->lock, irqL); | 582 | spin_lock_irqsave(&pmlmepriv->lock, irqL); |
583 | 583 | ||
584 | if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { | 584 | if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { |
585 | del_timer_sync(&pmlmepriv->scan_to_timer); | 585 | del_timer(&pmlmepriv->scan_to_timer); |
586 | 586 | ||
587 | _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); | 587 | _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY); |
588 | } | 588 | } |
@@ -696,7 +696,7 @@ void r8712_ind_disconnect(struct _adapter *padapter) | |||
696 | } | 696 | } |
697 | if (padapter->pwrctrlpriv.pwr_mode != | 697 | if (padapter->pwrctrlpriv.pwr_mode != |
698 | padapter->registrypriv.power_mgnt) { | 698 | padapter->registrypriv.power_mgnt) { |
699 | del_timer_sync(&pmlmepriv->dhcp_timer); | 699 | del_timer(&pmlmepriv->dhcp_timer); |
700 | r8712_set_ps_mode(padapter, padapter->registrypriv.power_mgnt, | 700 | r8712_set_ps_mode(padapter, padapter->registrypriv.power_mgnt, |
701 | padapter->registrypriv.smart_ps); | 701 | padapter->registrypriv.smart_ps); |
702 | } | 702 | } |
@@ -910,7 +910,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf) | |||
910 | if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) | 910 | if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) |
911 | == true) | 911 | == true) |
912 | r8712_indicate_connect(adapter); | 912 | r8712_indicate_connect(adapter); |
913 | del_timer_sync(&pmlmepriv->assoc_timer); | 913 | del_timer(&pmlmepriv->assoc_timer); |
914 | } else | 914 | } else |
915 | goto ignore_joinbss_callback; | 915 | goto ignore_joinbss_callback; |
916 | } else { | 916 | } else { |
diff --git a/drivers/staging/rtl8712/rtl871x_pwrctrl.c b/drivers/staging/rtl8712/rtl871x_pwrctrl.c index aaa584435c87..9bc04f474d18 100644 --- a/drivers/staging/rtl8712/rtl871x_pwrctrl.c +++ b/drivers/staging/rtl8712/rtl871x_pwrctrl.c | |||
@@ -103,7 +103,7 @@ void r8712_cpwm_int_hdl(struct _adapter *padapter, | |||
103 | 103 | ||
104 | if (pwrpriv->cpwm_tog == ((preportpwrstate->state) & 0x80)) | 104 | if (pwrpriv->cpwm_tog == ((preportpwrstate->state) & 0x80)) |
105 | return; | 105 | return; |
106 | del_timer_sync(&padapter->pwrctrlpriv.rpwm_check_timer); | 106 | del_timer(&padapter->pwrctrlpriv.rpwm_check_timer); |
107 | _enter_pwrlock(&pwrpriv->lock); | 107 | _enter_pwrlock(&pwrpriv->lock); |
108 | pwrpriv->cpwm = (preportpwrstate->state) & 0xf; | 108 | pwrpriv->cpwm = (preportpwrstate->state) & 0xf; |
109 | if (pwrpriv->cpwm >= PS_STATE_S2) { | 109 | if (pwrpriv->cpwm >= PS_STATE_S2) { |
diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c index 7bb96c47f188..a9b93d0f6f56 100644 --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c | |||
@@ -198,7 +198,7 @@ void r8712_free_stainfo(struct _adapter *padapter, struct sta_info *psta) | |||
198 | * cancel reordering_ctrl_timer */ | 198 | * cancel reordering_ctrl_timer */ |
199 | for (i = 0; i < 16; i++) { | 199 | for (i = 0; i < 16; i++) { |
200 | preorder_ctrl = &psta->recvreorder_ctrl[i]; | 200 | preorder_ctrl = &psta->recvreorder_ctrl[i]; |
201 | del_timer_sync(&preorder_ctrl->reordering_ctrl_timer); | 201 | del_timer(&preorder_ctrl->reordering_ctrl_timer); |
202 | } | 202 | } |
203 | spin_lock(&(pfree_sta_queue->lock)); | 203 | spin_lock(&(pfree_sta_queue->lock)); |
204 | /* insert into free_sta_queue; 20061114 */ | 204 | /* insert into free_sta_queue; 20061114 */ |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index cc57a3a6b02b..396344cb011f 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -162,6 +162,17 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x, | |||
162 | return put_user(x, ptr); | 162 | return put_user(x, ptr); |
163 | } | 163 | } |
164 | 164 | ||
165 | static inline int tty_copy_to_user(struct tty_struct *tty, | ||
166 | void __user *to, | ||
167 | const void *from, | ||
168 | unsigned long n) | ||
169 | { | ||
170 | struct n_tty_data *ldata = tty->disc_data; | ||
171 | |||
172 | tty_audit_add_data(tty, to, n, ldata->icanon); | ||
173 | return copy_to_user(to, from, n); | ||
174 | } | ||
175 | |||
165 | /** | 176 | /** |
166 | * n_tty_kick_worker - start input worker (if required) | 177 | * n_tty_kick_worker - start input worker (if required) |
167 | * @tty: terminal | 178 | * @tty: terminal |
@@ -2070,8 +2081,8 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2070 | 2081 | ||
2071 | size = N_TTY_BUF_SIZE - tail; | 2082 | size = N_TTY_BUF_SIZE - tail; |
2072 | n = eol - tail; | 2083 | n = eol - tail; |
2073 | if (n > 4096) | 2084 | if (n > N_TTY_BUF_SIZE) |
2074 | n += 4096; | 2085 | n += N_TTY_BUF_SIZE; |
2075 | n += found; | 2086 | n += found; |
2076 | c = n; | 2087 | c = n; |
2077 | 2088 | ||
@@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, | |||
2084 | __func__, eol, found, n, c, size, more); | 2095 | __func__, eol, found, n, c, size, more); |
2085 | 2096 | ||
2086 | if (n > size) { | 2097 | if (n > size) { |
2087 | ret = copy_to_user(*b, read_buf_addr(ldata, tail), size); | 2098 | ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size); |
2088 | if (ret) | 2099 | if (ret) |
2089 | return -EFAULT; | 2100 | return -EFAULT; |
2090 | ret = copy_to_user(*b + size, ldata->read_buf, n - size); | 2101 | ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size); |
2091 | } else | 2102 | } else |
2092 | ret = copy_to_user(*b, read_buf_addr(ldata, tail), n); | 2103 | ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n); |
2093 | 2104 | ||
2094 | if (ret) | 2105 | if (ret) |
2095 | return -EFAULT; | 2106 | return -EFAULT; |
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index 9289999cb7c6..dce1a23706e8 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c | |||
@@ -562,12 +562,36 @@ static irqreturn_t omap_wake_irq(int irq, void *dev_id) | |||
562 | return IRQ_NONE; | 562 | return IRQ_NONE; |
563 | } | 563 | } |
564 | 564 | ||
565 | #ifdef CONFIG_SERIAL_8250_DMA | ||
566 | static int omap_8250_dma_handle_irq(struct uart_port *port); | ||
567 | #endif | ||
568 | |||
569 | static irqreturn_t omap8250_irq(int irq, void *dev_id) | ||
570 | { | ||
571 | struct uart_port *port = dev_id; | ||
572 | struct uart_8250_port *up = up_to_u8250p(port); | ||
573 | unsigned int iir; | ||
574 | int ret; | ||
575 | |||
576 | #ifdef CONFIG_SERIAL_8250_DMA | ||
577 | if (up->dma) { | ||
578 | ret = omap_8250_dma_handle_irq(port); | ||
579 | return IRQ_RETVAL(ret); | ||
580 | } | ||
581 | #endif | ||
582 | |||
583 | serial8250_rpm_get(up); | ||
584 | iir = serial_port_in(port, UART_IIR); | ||
585 | ret = serial8250_handle_irq(port, iir); | ||
586 | serial8250_rpm_put(up); | ||
587 | |||
588 | return IRQ_RETVAL(ret); | ||
589 | } | ||
590 | |||
565 | static int omap_8250_startup(struct uart_port *port) | 591 | static int omap_8250_startup(struct uart_port *port) |
566 | { | 592 | { |
567 | struct uart_8250_port *up = | 593 | struct uart_8250_port *up = up_to_u8250p(port); |
568 | container_of(port, struct uart_8250_port, port); | ||
569 | struct omap8250_priv *priv = port->private_data; | 594 | struct omap8250_priv *priv = port->private_data; |
570 | |||
571 | int ret; | 595 | int ret; |
572 | 596 | ||
573 | if (priv->wakeirq) { | 597 | if (priv->wakeirq) { |
@@ -580,10 +604,31 @@ static int omap_8250_startup(struct uart_port *port) | |||
580 | 604 | ||
581 | pm_runtime_get_sync(port->dev); | 605 | pm_runtime_get_sync(port->dev); |
582 | 606 | ||
583 | ret = serial8250_do_startup(port); | 607 | up->mcr = 0; |
584 | if (ret) | 608 | serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); |
609 | |||
610 | serial_out(up, UART_LCR, UART_LCR_WLEN8); | ||
611 | |||
612 | up->lsr_saved_flags = 0; | ||
613 | up->msr_saved_flags = 0; | ||
614 | |||
615 | if (up->dma) { | ||
616 | ret = serial8250_request_dma(up); | ||
617 | if (ret) { | ||
618 | dev_warn_ratelimited(port->dev, | ||
619 | "failed to request DMA\n"); | ||
620 | up->dma = NULL; | ||
621 | } | ||
622 | } | ||
623 | |||
624 | ret = request_irq(port->irq, omap8250_irq, IRQF_SHARED, | ||
625 | dev_name(port->dev), port); | ||
626 | if (ret < 0) | ||
585 | goto err; | 627 | goto err; |
586 | 628 | ||
629 | up->ier = UART_IER_RLSI | UART_IER_RDI; | ||
630 | serial_out(up, UART_IER, up->ier); | ||
631 | |||
587 | #ifdef CONFIG_PM | 632 | #ifdef CONFIG_PM |
588 | up->capabilities |= UART_CAP_RPM; | 633 | up->capabilities |= UART_CAP_RPM; |
589 | #endif | 634 | #endif |
@@ -610,8 +655,7 @@ err: | |||
610 | 655 | ||
611 | static void omap_8250_shutdown(struct uart_port *port) | 656 | static void omap_8250_shutdown(struct uart_port *port) |
612 | { | 657 | { |
613 | struct uart_8250_port *up = | 658 | struct uart_8250_port *up = up_to_u8250p(port); |
614 | container_of(port, struct uart_8250_port, port); | ||
615 | struct omap8250_priv *priv = port->private_data; | 659 | struct omap8250_priv *priv = port->private_data; |
616 | 660 | ||
617 | flush_work(&priv->qos_work); | 661 | flush_work(&priv->qos_work); |
@@ -621,11 +665,24 @@ static void omap_8250_shutdown(struct uart_port *port) | |||
621 | pm_runtime_get_sync(port->dev); | 665 | pm_runtime_get_sync(port->dev); |
622 | 666 | ||
623 | serial_out(up, UART_OMAP_WER, 0); | 667 | serial_out(up, UART_OMAP_WER, 0); |
624 | serial8250_do_shutdown(port); | 668 | |
669 | up->ier = 0; | ||
670 | serial_out(up, UART_IER, 0); | ||
671 | |||
672 | if (up->dma) | ||
673 | serial8250_release_dma(up); | ||
674 | |||
675 | /* | ||
676 | * Disable break condition and FIFOs | ||
677 | */ | ||
678 | if (up->lcr & UART_LCR_SBC) | ||
679 | serial_out(up, UART_LCR, up->lcr & ~UART_LCR_SBC); | ||
680 | serial_out(up, UART_FCR, UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); | ||
625 | 681 | ||
626 | pm_runtime_mark_last_busy(port->dev); | 682 | pm_runtime_mark_last_busy(port->dev); |
627 | pm_runtime_put_autosuspend(port->dev); | 683 | pm_runtime_put_autosuspend(port->dev); |
628 | 684 | ||
685 | free_irq(port->irq, port); | ||
629 | if (priv->wakeirq) | 686 | if (priv->wakeirq) |
630 | free_irq(priv->wakeirq, port); | 687 | free_irq(priv->wakeirq, port); |
631 | } | 688 | } |
@@ -974,6 +1031,13 @@ static inline int omap_8250_rx_dma(struct uart_8250_port *p, unsigned int iir) | |||
974 | } | 1031 | } |
975 | #endif | 1032 | #endif |
976 | 1033 | ||
1034 | static int omap8250_no_handle_irq(struct uart_port *port) | ||
1035 | { | ||
1036 | /* IRQ has not been requested but handling irq? */ | ||
1037 | WARN_ONCE(1, "Unexpected irq handling before port startup\n"); | ||
1038 | return 0; | ||
1039 | } | ||
1040 | |||
977 | static int omap8250_probe(struct platform_device *pdev) | 1041 | static int omap8250_probe(struct platform_device *pdev) |
978 | { | 1042 | { |
979 | struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1043 | struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -1075,6 +1139,7 @@ static int omap8250_probe(struct platform_device *pdev) | |||
1075 | pm_runtime_get_sync(&pdev->dev); | 1139 | pm_runtime_get_sync(&pdev->dev); |
1076 | 1140 | ||
1077 | omap_serial_fill_features_erratas(&up, priv); | 1141 | omap_serial_fill_features_erratas(&up, priv); |
1142 | up.port.handle_irq = omap8250_no_handle_irq; | ||
1078 | #ifdef CONFIG_SERIAL_8250_DMA | 1143 | #ifdef CONFIG_SERIAL_8250_DMA |
1079 | if (pdev->dev.of_node) { | 1144 | if (pdev->dev.of_node) { |
1080 | /* | 1145 | /* |
@@ -1088,7 +1153,6 @@ static int omap8250_probe(struct platform_device *pdev) | |||
1088 | ret = of_property_count_strings(pdev->dev.of_node, "dma-names"); | 1153 | ret = of_property_count_strings(pdev->dev.of_node, "dma-names"); |
1089 | if (ret == 2) { | 1154 | if (ret == 2) { |
1090 | up.dma = &priv->omap8250_dma; | 1155 | up.dma = &priv->omap8250_dma; |
1091 | up.port.handle_irq = omap_8250_dma_handle_irq; | ||
1092 | priv->omap8250_dma.fn = the_no_dma_filter_fn; | 1156 | priv->omap8250_dma.fn = the_no_dma_filter_fn; |
1093 | priv->omap8250_dma.tx_dma = omap_8250_tx_dma; | 1157 | priv->omap8250_dma.tx_dma = omap_8250_tx_dma; |
1094 | priv->omap8250_dma.rx_dma = omap_8250_rx_dma; | 1158 | priv->omap8250_dma.rx_dma = omap_8250_rx_dma; |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 6f5a0720a8c8..763eb20fe321 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1249,20 +1249,19 @@ __acquires(&uap->port.lock) | |||
1249 | 1249 | ||
1250 | /* | 1250 | /* |
1251 | * Transmit a character | 1251 | * Transmit a character |
1252 | * There must be at least one free entry in the TX FIFO to accept the char. | ||
1253 | * | 1252 | * |
1254 | * Returns true if the FIFO might have space in it afterwards; | 1253 | * Returns true if the character was successfully queued to the FIFO. |
1255 | * returns false if the FIFO definitely became full. | 1254 | * Returns false otherwise. |
1256 | */ | 1255 | */ |
1257 | static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c) | 1256 | static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c) |
1258 | { | 1257 | { |
1258 | if (readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF) | ||
1259 | return false; /* unable to transmit character */ | ||
1260 | |||
1259 | writew(c, uap->port.membase + UART01x_DR); | 1261 | writew(c, uap->port.membase + UART01x_DR); |
1260 | uap->port.icount.tx++; | 1262 | uap->port.icount.tx++; |
1261 | 1263 | ||
1262 | if (likely(uap->tx_irq_seen > 1)) | 1264 | return true; |
1263 | return true; | ||
1264 | |||
1265 | return !(readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF); | ||
1266 | } | 1265 | } |
1267 | 1266 | ||
1268 | static bool pl011_tx_chars(struct uart_amba_port *uap) | 1267 | static bool pl011_tx_chars(struct uart_amba_port *uap) |
@@ -1296,7 +1295,8 @@ static bool pl011_tx_chars(struct uart_amba_port *uap) | |||
1296 | return false; | 1295 | return false; |
1297 | 1296 | ||
1298 | if (uap->port.x_char) { | 1297 | if (uap->port.x_char) { |
1299 | pl011_tx_char(uap, uap->port.x_char); | 1298 | if (!pl011_tx_char(uap, uap->port.x_char)) |
1299 | goto done; | ||
1300 | uap->port.x_char = 0; | 1300 | uap->port.x_char = 0; |
1301 | --count; | 1301 | --count; |
1302 | } | 1302 | } |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index c8cfa0637128..88250395b0ce 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -911,6 +911,14 @@ static void dma_rx_callback(void *data) | |||
911 | 911 | ||
912 | status = dmaengine_tx_status(chan, (dma_cookie_t)0, &state); | 912 | status = dmaengine_tx_status(chan, (dma_cookie_t)0, &state); |
913 | count = RX_BUF_SIZE - state.residue; | 913 | count = RX_BUF_SIZE - state.residue; |
914 | |||
915 | if (readl(sport->port.membase + USR2) & USR2_IDLE) { | ||
916 | /* In condition [3] the SDMA counted up too early */ | ||
917 | count--; | ||
918 | |||
919 | writel(USR2_IDLE, sport->port.membase + USR2); | ||
920 | } | ||
921 | |||
914 | dev_dbg(sport->port.dev, "We get %d bytes.\n", count); | 922 | dev_dbg(sport->port.dev, "We get %d bytes.\n", count); |
915 | 923 | ||
916 | if (count) { | 924 | if (count) { |
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index fdab715a0631..c0eafa6fd403 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h | |||
@@ -339,7 +339,7 @@ | |||
339 | #define DWC3_DGCMD_SET_ENDPOINT_NRDY 0x0c | 339 | #define DWC3_DGCMD_SET_ENDPOINT_NRDY 0x0c |
340 | #define DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK 0x10 | 340 | #define DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK 0x10 |
341 | 341 | ||
342 | #define DWC3_DGCMD_STATUS(n) (((n) >> 15) & 1) | 342 | #define DWC3_DGCMD_STATUS(n) (((n) >> 12) & 0x0F) |
343 | #define DWC3_DGCMD_CMDACT (1 << 10) | 343 | #define DWC3_DGCMD_CMDACT (1 << 10) |
344 | #define DWC3_DGCMD_CMDIOC (1 << 8) | 344 | #define DWC3_DGCMD_CMDIOC (1 << 8) |
345 | 345 | ||
@@ -355,7 +355,7 @@ | |||
355 | #define DWC3_DEPCMD_PARAM_SHIFT 16 | 355 | #define DWC3_DEPCMD_PARAM_SHIFT 16 |
356 | #define DWC3_DEPCMD_PARAM(x) ((x) << DWC3_DEPCMD_PARAM_SHIFT) | 356 | #define DWC3_DEPCMD_PARAM(x) ((x) << DWC3_DEPCMD_PARAM_SHIFT) |
357 | #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) | 357 | #define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) |
358 | #define DWC3_DEPCMD_STATUS(x) (((x) >> 15) & 1) | 358 | #define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F) |
359 | #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) | 359 | #define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) |
360 | #define DWC3_DEPCMD_CMDACT (1 << 10) | 360 | #define DWC3_DEPCMD_CMDACT (1 << 10) |
361 | #define DWC3_DEPCMD_CMDIOC (1 << 8) | 361 | #define DWC3_DEPCMD_CMDIOC (1 << 8) |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 6bdb57069044..3507f880eb74 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -315,7 +315,6 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf, | |||
315 | return ret; | 315 | return ret; |
316 | } | 316 | } |
317 | 317 | ||
318 | set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags); | ||
319 | return len; | 318 | return len; |
320 | } | 319 | } |
321 | break; | 320 | break; |
@@ -847,7 +846,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
847 | ret = ep->status; | 846 | ret = ep->status; |
848 | if (io_data->read && ret > 0) { | 847 | if (io_data->read && ret > 0) { |
849 | ret = copy_to_iter(data, ret, &io_data->data); | 848 | ret = copy_to_iter(data, ret, &io_data->data); |
850 | if (unlikely(iov_iter_count(&io_data->data))) | 849 | if (!ret) |
851 | ret = -EFAULT; | 850 | ret = -EFAULT; |
852 | } | 851 | } |
853 | } | 852 | } |
@@ -1463,8 +1462,7 @@ static void ffs_data_clear(struct ffs_data *ffs) | |||
1463 | { | 1462 | { |
1464 | ENTER(); | 1463 | ENTER(); |
1465 | 1464 | ||
1466 | if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags)) | 1465 | ffs_closed(ffs); |
1467 | ffs_closed(ffs); | ||
1468 | 1466 | ||
1469 | BUG_ON(ffs->gadget); | 1467 | BUG_ON(ffs->gadget); |
1470 | 1468 | ||
@@ -3422,9 +3420,13 @@ static int ffs_ready(struct ffs_data *ffs) | |||
3422 | ffs_obj->desc_ready = true; | 3420 | ffs_obj->desc_ready = true; |
3423 | ffs_obj->ffs_data = ffs; | 3421 | ffs_obj->ffs_data = ffs; |
3424 | 3422 | ||
3425 | if (ffs_obj->ffs_ready_callback) | 3423 | if (ffs_obj->ffs_ready_callback) { |
3426 | ret = ffs_obj->ffs_ready_callback(ffs); | 3424 | ret = ffs_obj->ffs_ready_callback(ffs); |
3425 | if (ret) | ||
3426 | goto done; | ||
3427 | } | ||
3427 | 3428 | ||
3429 | set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags); | ||
3428 | done: | 3430 | done: |
3429 | ffs_dev_unlock(); | 3431 | ffs_dev_unlock(); |
3430 | return ret; | 3432 | return ret; |
@@ -3443,7 +3445,8 @@ static void ffs_closed(struct ffs_data *ffs) | |||
3443 | 3445 | ||
3444 | ffs_obj->desc_ready = false; | 3446 | ffs_obj->desc_ready = false; |
3445 | 3447 | ||
3446 | if (ffs_obj->ffs_closed_callback) | 3448 | if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) && |
3449 | ffs_obj->ffs_closed_callback) | ||
3447 | ffs_obj->ffs_closed_callback(ffs); | 3450 | ffs_obj->ffs_closed_callback(ffs); |
3448 | 3451 | ||
3449 | if (!ffs_obj->opts || ffs_obj->opts->no_configfs | 3452 | if (!ffs_obj->opts || ffs_obj->opts->no_configfs |
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c index 259b656c0b3e..6316aa5b1c49 100644 --- a/drivers/usb/gadget/function/f_midi.c +++ b/drivers/usb/gadget/function/f_midi.c | |||
@@ -973,7 +973,13 @@ static ssize_t f_midi_opts_id_show(struct f_midi_opts *opts, char *page) | |||
973 | int result; | 973 | int result; |
974 | 974 | ||
975 | mutex_lock(&opts->lock); | 975 | mutex_lock(&opts->lock); |
976 | result = strlcpy(page, opts->id, PAGE_SIZE); | 976 | if (opts->id) { |
977 | result = strlcpy(page, opts->id, PAGE_SIZE); | ||
978 | } else { | ||
979 | page[0] = 0; | ||
980 | result = 0; | ||
981 | } | ||
982 | |||
977 | mutex_unlock(&opts->lock); | 983 | mutex_unlock(&opts->lock); |
978 | 984 | ||
979 | return result; | 985 | return result; |
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c index 9719abfb6145..7856b3394494 100644 --- a/drivers/usb/gadget/function/f_uac1.c +++ b/drivers/usb/gadget/function/f_uac1.c | |||
@@ -588,7 +588,10 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
588 | 588 | ||
589 | if (intf == 1) { | 589 | if (intf == 1) { |
590 | if (alt == 1) { | 590 | if (alt == 1) { |
591 | config_ep_by_speed(cdev->gadget, f, out_ep); | 591 | err = config_ep_by_speed(cdev->gadget, f, out_ep); |
592 | if (err) | ||
593 | return err; | ||
594 | |||
592 | usb_ep_enable(out_ep); | 595 | usb_ep_enable(out_ep); |
593 | out_ep->driver_data = audio; | 596 | out_ep->driver_data = audio; |
594 | audio->copy_buf = f_audio_buffer_alloc(audio_buf_size); | 597 | audio->copy_buf = f_audio_buffer_alloc(audio_buf_size); |
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c index 7b9ef7e257d2..e821931c965c 100644 --- a/drivers/usb/gadget/legacy/g_ffs.c +++ b/drivers/usb/gadget/legacy/g_ffs.c | |||
@@ -304,8 +304,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs) | |||
304 | gfs_registered = true; | 304 | gfs_registered = true; |
305 | 305 | ||
306 | ret = usb_composite_probe(&gfs_driver); | 306 | ret = usb_composite_probe(&gfs_driver); |
307 | if (unlikely(ret < 0)) | 307 | if (unlikely(ret < 0)) { |
308 | ++missing_funcs; | ||
308 | gfs_registered = false; | 309 | gfs_registered = false; |
310 | } | ||
309 | 311 | ||
310 | return ret; | 312 | return ret; |
311 | } | 313 | } |
diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index b808951491cc..99fd9a5667df 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c | |||
@@ -1487,7 +1487,7 @@ static int s3c2410_udc_pullup(struct usb_gadget *gadget, int is_on) | |||
1487 | 1487 | ||
1488 | dprintk(DEBUG_NORMAL, "%s()\n", __func__); | 1488 | dprintk(DEBUG_NORMAL, "%s()\n", __func__); |
1489 | 1489 | ||
1490 | s3c2410_udc_set_pullup(udc, is_on ? 0 : 1); | 1490 | s3c2410_udc_set_pullup(udc, is_on); |
1491 | return 0; | 1491 | return 0; |
1492 | } | 1492 | } |
1493 | 1493 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ec8ac1674854..36bf089b708f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3682,18 +3682,21 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
3682 | { | 3682 | { |
3683 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); | 3683 | struct xhci_hcd *xhci = hcd_to_xhci(hcd); |
3684 | unsigned long flags; | 3684 | unsigned long flags; |
3685 | int ret; | 3685 | int ret, slot_id; |
3686 | struct xhci_command *command; | 3686 | struct xhci_command *command; |
3687 | 3687 | ||
3688 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); | 3688 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
3689 | if (!command) | 3689 | if (!command) |
3690 | return 0; | 3690 | return 0; |
3691 | 3691 | ||
3692 | /* xhci->slot_id and xhci->addr_dev are not thread-safe */ | ||
3693 | mutex_lock(&xhci->mutex); | ||
3692 | spin_lock_irqsave(&xhci->lock, flags); | 3694 | spin_lock_irqsave(&xhci->lock, flags); |
3693 | command->completion = &xhci->addr_dev; | 3695 | command->completion = &xhci->addr_dev; |
3694 | ret = xhci_queue_slot_control(xhci, command, TRB_ENABLE_SLOT, 0); | 3696 | ret = xhci_queue_slot_control(xhci, command, TRB_ENABLE_SLOT, 0); |
3695 | if (ret) { | 3697 | if (ret) { |
3696 | spin_unlock_irqrestore(&xhci->lock, flags); | 3698 | spin_unlock_irqrestore(&xhci->lock, flags); |
3699 | mutex_unlock(&xhci->mutex); | ||
3697 | xhci_dbg(xhci, "FIXME: allocate a command ring segment\n"); | 3700 | xhci_dbg(xhci, "FIXME: allocate a command ring segment\n"); |
3698 | kfree(command); | 3701 | kfree(command); |
3699 | return 0; | 3702 | return 0; |
@@ -3702,8 +3705,10 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
3702 | spin_unlock_irqrestore(&xhci->lock, flags); | 3705 | spin_unlock_irqrestore(&xhci->lock, flags); |
3703 | 3706 | ||
3704 | wait_for_completion(command->completion); | 3707 | wait_for_completion(command->completion); |
3708 | slot_id = xhci->slot_id; | ||
3709 | mutex_unlock(&xhci->mutex); | ||
3705 | 3710 | ||
3706 | if (!xhci->slot_id || command->status != COMP_SUCCESS) { | 3711 | if (!slot_id || command->status != COMP_SUCCESS) { |
3707 | xhci_err(xhci, "Error while assigning device slot ID\n"); | 3712 | xhci_err(xhci, "Error while assigning device slot ID\n"); |
3708 | xhci_err(xhci, "Max number of devices this xHCI host supports is %u.\n", | 3713 | xhci_err(xhci, "Max number of devices this xHCI host supports is %u.\n", |
3709 | HCS_MAX_SLOTS( | 3714 | HCS_MAX_SLOTS( |
@@ -3728,11 +3733,11 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) | |||
3728 | * xhci_discover_or_reset_device(), which may be called as part of | 3733 | * xhci_discover_or_reset_device(), which may be called as part of |
3729 | * mass storage driver error handling. | 3734 | * mass storage driver error handling. |
3730 | */ | 3735 | */ |
3731 | if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { | 3736 | if (!xhci_alloc_virt_device(xhci, slot_id, udev, GFP_NOIO)) { |
3732 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); | 3737 | xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); |
3733 | goto disable_slot; | 3738 | goto disable_slot; |
3734 | } | 3739 | } |
3735 | udev->slot_id = xhci->slot_id; | 3740 | udev->slot_id = slot_id; |
3736 | 3741 | ||
3737 | #ifndef CONFIG_USB_DEFAULT_PERSIST | 3742 | #ifndef CONFIG_USB_DEFAULT_PERSIST |
3738 | /* | 3743 | /* |
@@ -3778,12 +3783,15 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3778 | struct xhci_slot_ctx *slot_ctx; | 3783 | struct xhci_slot_ctx *slot_ctx; |
3779 | struct xhci_input_control_ctx *ctrl_ctx; | 3784 | struct xhci_input_control_ctx *ctrl_ctx; |
3780 | u64 temp_64; | 3785 | u64 temp_64; |
3781 | struct xhci_command *command; | 3786 | struct xhci_command *command = NULL; |
3787 | |||
3788 | mutex_lock(&xhci->mutex); | ||
3782 | 3789 | ||
3783 | if (!udev->slot_id) { | 3790 | if (!udev->slot_id) { |
3784 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, | 3791 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, |
3785 | "Bad Slot ID %d", udev->slot_id); | 3792 | "Bad Slot ID %d", udev->slot_id); |
3786 | return -EINVAL; | 3793 | ret = -EINVAL; |
3794 | goto out; | ||
3787 | } | 3795 | } |
3788 | 3796 | ||
3789 | virt_dev = xhci->devs[udev->slot_id]; | 3797 | virt_dev = xhci->devs[udev->slot_id]; |
@@ -3796,7 +3804,8 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3796 | */ | 3804 | */ |
3797 | xhci_warn(xhci, "Virt dev invalid for slot_id 0x%x!\n", | 3805 | xhci_warn(xhci, "Virt dev invalid for slot_id 0x%x!\n", |
3798 | udev->slot_id); | 3806 | udev->slot_id); |
3799 | return -EINVAL; | 3807 | ret = -EINVAL; |
3808 | goto out; | ||
3800 | } | 3809 | } |
3801 | 3810 | ||
3802 | if (setup == SETUP_CONTEXT_ONLY) { | 3811 | if (setup == SETUP_CONTEXT_ONLY) { |
@@ -3804,13 +3813,15 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3804 | if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) == | 3813 | if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) == |
3805 | SLOT_STATE_DEFAULT) { | 3814 | SLOT_STATE_DEFAULT) { |
3806 | xhci_dbg(xhci, "Slot already in default state\n"); | 3815 | xhci_dbg(xhci, "Slot already in default state\n"); |
3807 | return 0; | 3816 | goto out; |
3808 | } | 3817 | } |
3809 | } | 3818 | } |
3810 | 3819 | ||
3811 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); | 3820 | command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); |
3812 | if (!command) | 3821 | if (!command) { |
3813 | return -ENOMEM; | 3822 | ret = -ENOMEM; |
3823 | goto out; | ||
3824 | } | ||
3814 | 3825 | ||
3815 | command->in_ctx = virt_dev->in_ctx; | 3826 | command->in_ctx = virt_dev->in_ctx; |
3816 | command->completion = &xhci->addr_dev; | 3827 | command->completion = &xhci->addr_dev; |
@@ -3820,8 +3831,8 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3820 | if (!ctrl_ctx) { | 3831 | if (!ctrl_ctx) { |
3821 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", | 3832 | xhci_warn(xhci, "%s: Could not get input context, bad type.\n", |
3822 | __func__); | 3833 | __func__); |
3823 | kfree(command); | 3834 | ret = -EINVAL; |
3824 | return -EINVAL; | 3835 | goto out; |
3825 | } | 3836 | } |
3826 | /* | 3837 | /* |
3827 | * If this is the first Set Address since device plug-in or | 3838 | * If this is the first Set Address since device plug-in or |
@@ -3848,8 +3859,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3848 | spin_unlock_irqrestore(&xhci->lock, flags); | 3859 | spin_unlock_irqrestore(&xhci->lock, flags); |
3849 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, | 3860 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, |
3850 | "FIXME: allocate a command ring segment"); | 3861 | "FIXME: allocate a command ring segment"); |
3851 | kfree(command); | 3862 | goto out; |
3852 | return ret; | ||
3853 | } | 3863 | } |
3854 | xhci_ring_cmd_db(xhci); | 3864 | xhci_ring_cmd_db(xhci); |
3855 | spin_unlock_irqrestore(&xhci->lock, flags); | 3865 | spin_unlock_irqrestore(&xhci->lock, flags); |
@@ -3896,10 +3906,8 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3896 | ret = -EINVAL; | 3906 | ret = -EINVAL; |
3897 | break; | 3907 | break; |
3898 | } | 3908 | } |
3899 | if (ret) { | 3909 | if (ret) |
3900 | kfree(command); | 3910 | goto out; |
3901 | return ret; | ||
3902 | } | ||
3903 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); | 3911 | temp_64 = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); |
3904 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, | 3912 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, |
3905 | "Op regs DCBAA ptr = %#016llx", temp_64); | 3913 | "Op regs DCBAA ptr = %#016llx", temp_64); |
@@ -3932,8 +3940,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, | |||
3932 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, | 3940 | xhci_dbg_trace(xhci, trace_xhci_dbg_address, |
3933 | "Internal device address = %d", | 3941 | "Internal device address = %d", |
3934 | le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK); | 3942 | le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK); |
3943 | out: | ||
3944 | mutex_unlock(&xhci->mutex); | ||
3935 | kfree(command); | 3945 | kfree(command); |
3936 | return 0; | 3946 | return ret; |
3937 | } | 3947 | } |
3938 | 3948 | ||
3939 | int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | 3949 | int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) |
@@ -4855,6 +4865,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) | |||
4855 | return 0; | 4865 | return 0; |
4856 | } | 4866 | } |
4857 | 4867 | ||
4868 | mutex_init(&xhci->mutex); | ||
4858 | xhci->cap_regs = hcd->regs; | 4869 | xhci->cap_regs = hcd->regs; |
4859 | xhci->op_regs = hcd->regs + | 4870 | xhci->op_regs = hcd->regs + |
4860 | HC_LENGTH(readl(&xhci->cap_regs->hc_capbase)); | 4871 | HC_LENGTH(readl(&xhci->cap_regs->hc_capbase)); |
@@ -5011,4 +5022,12 @@ static int __init xhci_hcd_init(void) | |||
5011 | BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); | 5022 | BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); |
5012 | return 0; | 5023 | return 0; |
5013 | } | 5024 | } |
5025 | |||
5026 | /* | ||
5027 | * If an init function is provided, an exit function must also be provided | ||
5028 | * to allow module unload. | ||
5029 | */ | ||
5030 | static void __exit xhci_hcd_fini(void) { } | ||
5031 | |||
5014 | module_init(xhci_hcd_init); | 5032 | module_init(xhci_hcd_init); |
5033 | module_exit(xhci_hcd_fini); | ||
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index ea75e8ccd3c1..6977f8491fa7 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1497,6 +1497,8 @@ struct xhci_hcd { | |||
1497 | struct list_head lpm_failed_devs; | 1497 | struct list_head lpm_failed_devs; |
1498 | 1498 | ||
1499 | /* slot enabling and address device helpers */ | 1499 | /* slot enabling and address device helpers */ |
1500 | /* these are not thread safe so use mutex */ | ||
1501 | struct mutex mutex; | ||
1500 | struct completion addr_dev; | 1502 | struct completion addr_dev; |
1501 | int slot_id; | 1503 | int slot_id; |
1502 | /* For USB 3.0 LPM enable/disable. */ | 1504 | /* For USB 3.0 LPM enable/disable. */ |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 3789b08ef67b..6dca3d794ced 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2021,13 +2021,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2021 | if (musb->ops->quirks) | 2021 | if (musb->ops->quirks) |
2022 | musb->io.quirks = musb->ops->quirks; | 2022 | musb->io.quirks = musb->ops->quirks; |
2023 | 2023 | ||
2024 | /* At least tusb6010 has it's own offsets.. */ | 2024 | /* Most devices use indexed offset or flat offset */ |
2025 | if (musb->ops->ep_offset) | ||
2026 | musb->io.ep_offset = musb->ops->ep_offset; | ||
2027 | if (musb->ops->ep_select) | ||
2028 | musb->io.ep_select = musb->ops->ep_select; | ||
2029 | |||
2030 | /* ..and some devices use indexed offset or flat offset */ | ||
2031 | if (musb->io.quirks & MUSB_INDEXED_EP) { | 2025 | if (musb->io.quirks & MUSB_INDEXED_EP) { |
2032 | musb->io.ep_offset = musb_indexed_ep_offset; | 2026 | musb->io.ep_offset = musb_indexed_ep_offset; |
2033 | musb->io.ep_select = musb_indexed_ep_select; | 2027 | musb->io.ep_select = musb_indexed_ep_select; |
@@ -2036,6 +2030,12 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2036 | musb->io.ep_select = musb_flat_ep_select; | 2030 | musb->io.ep_select = musb_flat_ep_select; |
2037 | } | 2031 | } |
2038 | 2032 | ||
2033 | /* At least tusb6010 has its own offsets */ | ||
2034 | if (musb->ops->ep_offset) | ||
2035 | musb->io.ep_offset = musb->ops->ep_offset; | ||
2036 | if (musb->ops->ep_select) | ||
2037 | musb->io.ep_select = musb->ops->ep_select; | ||
2038 | |||
2039 | if (musb->ops->fifo_mode) | 2039 | if (musb->ops->fifo_mode) |
2040 | fifo_mode = musb->ops->fifo_mode; | 2040 | fifo_mode = musb->ops->fifo_mode; |
2041 | else | 2041 | else |
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 7225d526df04..03ab0c699f74 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -1179,7 +1179,7 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev, | |||
1179 | } | 1179 | } |
1180 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 1180 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
1181 | ab8500_usb_link_status_irq, | 1181 | ab8500_usb_link_status_irq, |
1182 | IRQF_NO_SUSPEND | IRQF_SHARED, | 1182 | IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT, |
1183 | "usb-link-status", ab); | 1183 | "usb-link-status", ab); |
1184 | if (err < 0) { | 1184 | if (err < 0) { |
1185 | dev_err(ab->dev, "request_irq failed for link status irq\n"); | 1185 | dev_err(ab->dev, "request_irq failed for link status irq\n"); |
@@ -1195,7 +1195,7 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev, | |||
1195 | } | 1195 | } |
1196 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 1196 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
1197 | ab8500_usb_disconnect_irq, | 1197 | ab8500_usb_disconnect_irq, |
1198 | IRQF_NO_SUSPEND | IRQF_SHARED, | 1198 | IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT, |
1199 | "usb-id-fall", ab); | 1199 | "usb-id-fall", ab); |
1200 | if (err < 0) { | 1200 | if (err < 0) { |
1201 | dev_err(ab->dev, "request_irq failed for ID fall irq\n"); | 1201 | dev_err(ab->dev, "request_irq failed for ID fall irq\n"); |
@@ -1211,7 +1211,7 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev, | |||
1211 | } | 1211 | } |
1212 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 1212 | err = devm_request_threaded_irq(&pdev->dev, irq, NULL, |
1213 | ab8500_usb_disconnect_irq, | 1213 | ab8500_usb_disconnect_irq, |
1214 | IRQF_NO_SUSPEND | IRQF_SHARED, | 1214 | IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT, |
1215 | "usb-vbus-fall", ab); | 1215 | "usb-vbus-fall", ab); |
1216 | if (err < 0) { | 1216 | if (err < 0) { |
1217 | dev_err(ab->dev, "request_irq failed for Vbus fall irq\n"); | 1217 | dev_err(ab->dev, "request_irq failed for Vbus fall irq\n"); |
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c index 845f658276b1..2b28443d07b9 100644 --- a/drivers/usb/phy/phy-tahvo.c +++ b/drivers/usb/phy/phy-tahvo.c | |||
@@ -401,7 +401,8 @@ static int tahvo_usb_probe(struct platform_device *pdev) | |||
401 | dev_set_drvdata(&pdev->dev, tu); | 401 | dev_set_drvdata(&pdev->dev, tu); |
402 | 402 | ||
403 | tu->irq = platform_get_irq(pdev, 0); | 403 | tu->irq = platform_get_irq(pdev, 0); |
404 | ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt, 0, | 404 | ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt, |
405 | IRQF_ONESHOT, | ||
405 | "tahvo-vbus", tu); | 406 | "tahvo-vbus", tu); |
406 | if (ret) { | 407 | if (ret) { |
407 | dev_err(&pdev->dev, "could not register tahvo-vbus irq: %d\n", | 408 | dev_err(&pdev->dev, "could not register tahvo-vbus irq: %d\n", |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 8597cf9cfceb..c0f5c652d272 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -611,6 +611,8 @@ struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { | |||
611 | static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | 611 | static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) |
612 | { | 612 | { |
613 | struct usbhs_pipe *pipe = pkt->pipe; | 613 | struct usbhs_pipe *pipe = pkt->pipe; |
614 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | ||
615 | struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); | ||
614 | 616 | ||
615 | if (usbhs_pipe_is_busy(pipe)) | 617 | if (usbhs_pipe_is_busy(pipe)) |
616 | return 0; | 618 | return 0; |
@@ -624,6 +626,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
624 | usbhs_pipe_data_sequence(pipe, pkt->sequence); | 626 | usbhs_pipe_data_sequence(pipe, pkt->sequence); |
625 | pkt->sequence = -1; /* -1 sequence will be ignored */ | 627 | pkt->sequence = -1; /* -1 sequence will be ignored */ |
626 | 628 | ||
629 | if (usbhs_pipe_is_dcp(pipe)) | ||
630 | usbhsf_fifo_clear(pipe, fifo); | ||
631 | |||
627 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); | 632 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); |
628 | usbhs_pipe_enable(pipe); | 633 | usbhs_pipe_enable(pipe); |
629 | usbhs_pipe_running(pipe, 1); | 634 | usbhs_pipe_running(pipe, 1); |
@@ -673,7 +678,14 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done) | |||
673 | *is_done = 1; | 678 | *is_done = 1; |
674 | usbhsf_rx_irq_ctrl(pipe, 0); | 679 | usbhsf_rx_irq_ctrl(pipe, 0); |
675 | usbhs_pipe_running(pipe, 0); | 680 | usbhs_pipe_running(pipe, 0); |
676 | usbhs_pipe_disable(pipe); /* disable pipe first */ | 681 | /* |
682 | * If function mode, since this controller is possible to enter | ||
683 | * Control Write status stage at this timing, this driver | ||
684 | * should not disable the pipe. If such a case happens, this | ||
685 | * controller is not able to complete the status stage. | ||
686 | */ | ||
687 | if (!usbhs_mod_is_host(priv) && !usbhs_pipe_is_dcp(pipe)) | ||
688 | usbhs_pipe_disable(pipe); /* disable pipe first */ | ||
677 | } | 689 | } |
678 | 690 | ||
679 | /* | 691 | /* |
@@ -1227,15 +1239,21 @@ static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo, | |||
1227 | { | 1239 | { |
1228 | char name[16]; | 1240 | char name[16]; |
1229 | 1241 | ||
1230 | snprintf(name, sizeof(name), "tx%d", channel); | 1242 | /* |
1231 | fifo->tx_chan = dma_request_slave_channel_reason(dev, name); | 1243 | * To avoid complex handing for DnFIFOs, the driver uses each |
1232 | if (IS_ERR(fifo->tx_chan)) | 1244 | * DnFIFO as TX or RX direction (not bi-direction). |
1233 | fifo->tx_chan = NULL; | 1245 | * So, the driver uses odd channels for TX, even channels for RX. |
1234 | 1246 | */ | |
1235 | snprintf(name, sizeof(name), "rx%d", channel); | 1247 | snprintf(name, sizeof(name), "ch%d", channel); |
1236 | fifo->rx_chan = dma_request_slave_channel_reason(dev, name); | 1248 | if (channel & 1) { |
1237 | if (IS_ERR(fifo->rx_chan)) | 1249 | fifo->tx_chan = dma_request_slave_channel_reason(dev, name); |
1238 | fifo->rx_chan = NULL; | 1250 | if (IS_ERR(fifo->tx_chan)) |
1251 | fifo->tx_chan = NULL; | ||
1252 | } else { | ||
1253 | fifo->rx_chan = dma_request_slave_channel_reason(dev, name); | ||
1254 | if (IS_ERR(fifo->rx_chan)) | ||
1255 | fifo->rx_chan = NULL; | ||
1256 | } | ||
1239 | } | 1257 | } |
1240 | 1258 | ||
1241 | static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo, | 1259 | static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo, |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 9031750e7404..ffd739e31bfc 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -128,6 +128,7 @@ static const struct usb_device_id id_table[] = { | |||
128 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ | 128 | { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ |
129 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ | 129 | { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ |
130 | { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ | 130 | { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ |
131 | { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ | ||
131 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | 132 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
132 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ | 133 | { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
133 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ | 134 | { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8eb68a31cab6..4c8b3b82103d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -699,6 +699,7 @@ static const struct usb_device_id id_table_combined[] = { | |||
699 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, | 699 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, |
700 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, | 700 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, |
701 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, | 701 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, |
702 | { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, | ||
702 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, | 703 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, |
703 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, | 704 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, |
704 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 705 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 4e4f46f3c89c..792e054126de 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -155,6 +155,7 @@ | |||
155 | #define XSENS_AWINDA_STATION_PID 0x0101 | 155 | #define XSENS_AWINDA_STATION_PID 0x0101 |
156 | #define XSENS_AWINDA_DONGLE_PID 0x0102 | 156 | #define XSENS_AWINDA_DONGLE_PID 0x0102 |
157 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ | 157 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ |
158 | #define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ | ||
158 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ | 159 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ |
159 | 160 | ||
160 | /* Xsens devices using FTDI VID */ | 161 | /* Xsens devices using FTDI VID */ |
diff --git a/fs/fhandle.c b/fs/fhandle.c index 999ff5c3cab0..d59712dfa3e7 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c | |||
@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, | |||
195 | goto out_err; | 195 | goto out_err; |
196 | } | 196 | } |
197 | /* copy the full handle */ | 197 | /* copy the full handle */ |
198 | if (copy_from_user(handle, ufh, | 198 | *handle = f_handle; |
199 | sizeof(struct file_handle) + | 199 | if (copy_from_user(&handle->f_handle, |
200 | &ufh->f_handle, | ||
200 | f_handle.handle_bytes)) { | 201 | f_handle.handle_bytes)) { |
201 | retval = -EFAULT; | 202 | retval = -EFAULT; |
202 | goto out_handle; | 203 | goto out_handle; |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index aff923ae8c4b..d87d8eced064 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -116,7 +116,6 @@ __printf(3, 4) | |||
116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | 116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
117 | const char *fmt, ...); | 117 | const char *fmt, ...); |
118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
119 | void bdi_unregister(struct backing_dev_info *bdi); | ||
120 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); | 119 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | 120 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
122 | enum wb_reason reason); | 121 | enum wb_reason reason); |
diff --git a/include/linux/of.h b/include/linux/of.h index ddeaae6d2083..b871ff9d81d7 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -121,6 +121,8 @@ extern struct device_node *of_stdout; | |||
121 | extern raw_spinlock_t devtree_lock; | 121 | extern raw_spinlock_t devtree_lock; |
122 | 122 | ||
123 | #ifdef CONFIG_OF | 123 | #ifdef CONFIG_OF |
124 | void of_core_init(void); | ||
125 | |||
124 | static inline bool is_of_node(struct fwnode_handle *fwnode) | 126 | static inline bool is_of_node(struct fwnode_handle *fwnode) |
125 | { | 127 | { |
126 | return fwnode && fwnode->type == FWNODE_OF; | 128 | return fwnode && fwnode->type == FWNODE_OF; |
@@ -376,6 +378,10 @@ bool of_console_check(struct device_node *dn, char *name, int index); | |||
376 | 378 | ||
377 | #else /* CONFIG_OF */ | 379 | #else /* CONFIG_OF */ |
378 | 380 | ||
381 | static inline void of_core_init(void) | ||
382 | { | ||
383 | } | ||
384 | |||
379 | static inline bool is_of_node(struct fwnode_handle *fwnode) | 385 | static inline bool is_of_node(struct fwnode_handle *fwnode) |
380 | { | 386 | { |
381 | return false; | 387 | return false; |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 61992cf2e977..d8a82a89f35a 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -92,8 +92,6 @@ struct hw_perf_event_extra { | |||
92 | int idx; /* index in shared_regs->regs[] */ | 92 | int idx; /* index in shared_regs->regs[] */ |
93 | }; | 93 | }; |
94 | 94 | ||
95 | struct event_constraint; | ||
96 | |||
97 | /** | 95 | /** |
98 | * struct hw_perf_event - performance event hardware details: | 96 | * struct hw_perf_event - performance event hardware details: |
99 | */ | 97 | */ |
@@ -112,8 +110,6 @@ struct hw_perf_event { | |||
112 | 110 | ||
113 | struct hw_perf_event_extra extra_reg; | 111 | struct hw_perf_event_extra extra_reg; |
114 | struct hw_perf_event_extra branch_reg; | 112 | struct hw_perf_event_extra branch_reg; |
115 | |||
116 | struct event_constraint *constraint; | ||
117 | }; | 113 | }; |
118 | struct { /* software */ | 114 | struct { /* software */ |
119 | struct hrtimer hrtimer; | 115 | struct hrtimer hrtimer; |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 497bc14cdb85..0320bbb7d7b5 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -98,7 +98,8 @@ struct inet_connection_sock { | |||
98 | const struct tcp_congestion_ops *icsk_ca_ops; | 98 | const struct tcp_congestion_ops *icsk_ca_ops; |
99 | const struct inet_connection_sock_af_ops *icsk_af_ops; | 99 | const struct inet_connection_sock_af_ops *icsk_af_ops; |
100 | unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); | 100 | unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); |
101 | __u8 icsk_ca_state:7, | 101 | __u8 icsk_ca_state:6, |
102 | icsk_ca_setsockopt:1, | ||
102 | icsk_ca_dst_locked:1; | 103 | icsk_ca_dst_locked:1; |
103 | __u8 icsk_retransmits; | 104 | __u8 icsk_retransmits; |
104 | __u8 icsk_pending; | 105 | __u8 icsk_pending; |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8e3668b44c29..fc57f6b82fc5 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -354,7 +354,7 @@ enum ieee80211_rssi_event_data { | |||
354 | }; | 354 | }; |
355 | 355 | ||
356 | /** | 356 | /** |
357 | * enum ieee80211_rssi_event - data attached to an %RSSI_EVENT | 357 | * struct ieee80211_rssi_event - data attached to an %RSSI_EVENT |
358 | * @data: See &enum ieee80211_rssi_event_data | 358 | * @data: See &enum ieee80211_rssi_event_data |
359 | */ | 359 | */ |
360 | struct ieee80211_rssi_event { | 360 | struct ieee80211_rssi_event { |
@@ -388,7 +388,7 @@ enum ieee80211_mlme_event_status { | |||
388 | }; | 388 | }; |
389 | 389 | ||
390 | /** | 390 | /** |
391 | * enum ieee80211_mlme_event - data attached to an %MLME_EVENT | 391 | * struct ieee80211_mlme_event - data attached to an %MLME_EVENT |
392 | * @data: See &enum ieee80211_mlme_event_data | 392 | * @data: See &enum ieee80211_mlme_event_data |
393 | * @status: See &enum ieee80211_mlme_event_status | 393 | * @status: See &enum ieee80211_mlme_event_status |
394 | * @reason: the reason code if applicable | 394 | * @reason: the reason code if applicable |
@@ -401,9 +401,10 @@ struct ieee80211_mlme_event { | |||
401 | 401 | ||
402 | /** | 402 | /** |
403 | * struct ieee80211_event - event to be sent to the driver | 403 | * struct ieee80211_event - event to be sent to the driver |
404 | * @type The event itself. See &enum ieee80211_event_type. | 404 | * @type: The event itself. See &enum ieee80211_event_type. |
405 | * @rssi: relevant if &type is %RSSI_EVENT | 405 | * @rssi: relevant if &type is %RSSI_EVENT |
406 | * @mlme: relevant if &type is %AUTH_EVENT | 406 | * @mlme: relevant if &type is %AUTH_EVENT |
407 | * @u: union holding the above two fields | ||
407 | */ | 408 | */ |
408 | struct ieee80211_event { | 409 | struct ieee80211_event { |
409 | enum ieee80211_event_type type; | 410 | enum ieee80211_event_type type; |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 880dd7437172..c178d13d6f4c 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -250,7 +250,6 @@ DEFINE_EVENT(writeback_class, name, \ | |||
250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); | 250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); | 251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); | 252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); |
253 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | ||
254 | 253 | ||
255 | DECLARE_EVENT_CLASS(wbc_class, | 254 | DECLARE_EVENT_CLASS(wbc_class, |
256 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), | 255 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h index 984169a819ee..d7f1cbc3766c 100644 --- a/include/uapi/linux/virtio_balloon.h +++ b/include/uapi/linux/virtio_balloon.h | |||
@@ -26,6 +26,7 @@ | |||
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 | * SUCH DAMAGE. */ | 27 | * SUCH DAMAGE. */ |
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/virtio_types.h> | ||
29 | #include <linux/virtio_ids.h> | 30 | #include <linux/virtio_ids.h> |
30 | #include <linux/virtio_config.h> | 31 | #include <linux/virtio_config.h> |
31 | 32 | ||
diff --git a/kernel/compat.c b/kernel/compat.c index 24f00610c575..333d364be29d 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -912,7 +912,8 @@ long compat_get_bitmap(unsigned long *mask, const compat_ulong_t __user *umask, | |||
912 | * bitmap. We must however ensure the end of the | 912 | * bitmap. We must however ensure the end of the |
913 | * kernel bitmap is zeroed. | 913 | * kernel bitmap is zeroed. |
914 | */ | 914 | */ |
915 | if (nr_compat_longs-- > 0) { | 915 | if (nr_compat_longs) { |
916 | nr_compat_longs--; | ||
916 | if (__get_user(um, umask)) | 917 | if (__get_user(um, umask)) |
917 | return -EFAULT; | 918 | return -EFAULT; |
918 | } else { | 919 | } else { |
@@ -954,7 +955,8 @@ long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask, | |||
954 | * We dont want to write past the end of the userspace | 955 | * We dont want to write past the end of the userspace |
955 | * bitmap. | 956 | * bitmap. |
956 | */ | 957 | */ |
957 | if (nr_compat_longs-- > 0) { | 958 | if (nr_compat_longs) { |
959 | nr_compat_longs--; | ||
958 | if (__put_user(um, umask)) | 960 | if (__put_user(um, umask)) |
959 | return -EFAULT; | 961 | return -EFAULT; |
960 | } | 962 | } |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 1a3bf48743ce..eddf1ed4155e 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -3442,7 +3442,6 @@ static void free_event_rcu(struct rcu_head *head) | |||
3442 | if (event->ns) | 3442 | if (event->ns) |
3443 | put_pid_ns(event->ns); | 3443 | put_pid_ns(event->ns); |
3444 | perf_event_free_filter(event); | 3444 | perf_event_free_filter(event); |
3445 | perf_event_free_bpf_prog(event); | ||
3446 | kfree(event); | 3445 | kfree(event); |
3447 | } | 3446 | } |
3448 | 3447 | ||
@@ -3573,6 +3572,8 @@ static void __free_event(struct perf_event *event) | |||
3573 | put_callchain_buffers(); | 3572 | put_callchain_buffers(); |
3574 | } | 3573 | } |
3575 | 3574 | ||
3575 | perf_event_free_bpf_prog(event); | ||
3576 | |||
3576 | if (event->destroy) | 3577 | if (event->destroy) |
3577 | event->destroy(event); | 3578 | event->destroy(event); |
3578 | 3579 | ||
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 232f00f273cb..725c416085e3 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -493,6 +493,20 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, | |||
493 | rb->aux_pages[rb->aux_nr_pages] = page_address(page++); | 493 | rb->aux_pages[rb->aux_nr_pages] = page_address(page++); |
494 | } | 494 | } |
495 | 495 | ||
496 | /* | ||
497 | * In overwrite mode, PMUs that don't support SG may not handle more | ||
498 | * than one contiguous allocation, since they rely on PMI to do double | ||
499 | * buffering. In this case, the entire buffer has to be one contiguous | ||
500 | * chunk. | ||
501 | */ | ||
502 | if ((event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) && | ||
503 | overwrite) { | ||
504 | struct page *page = virt_to_page(rb->aux_pages[0]); | ||
505 | |||
506 | if (page_private(page) != max_order) | ||
507 | goto out; | ||
508 | } | ||
509 | |||
496 | rb->aux_priv = event->pmu->setup_aux(event->cpu, rb->aux_pages, nr_pages, | 510 | rb->aux_priv = event->pmu->setup_aux(event->cpu, rb->aux_pages, nr_pages, |
497 | overwrite); | 511 | overwrite); |
498 | if (!rb->aux_priv) | 512 | if (!rb->aux_priv) |
diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index a28df5206d95..fe9a32591c24 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c | |||
@@ -57,7 +57,8 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, | |||
57 | return res + find_zero(data) + 1 - align; | 57 | return res + find_zero(data) + 1 - align; |
58 | } | 58 | } |
59 | res += sizeof(unsigned long); | 59 | res += sizeof(unsigned long); |
60 | if (unlikely(max < sizeof(unsigned long))) | 60 | /* We already handled 'unsigned long' bytes. Did we do it all ? */ |
61 | if (unlikely(max <= sizeof(unsigned long))) | ||
61 | break; | 62 | break; |
62 | max -= sizeof(unsigned long); | 63 | max -= sizeof(unsigned long); |
63 | if (unlikely(__get_user(c,(unsigned long __user *)(src+res)))) | 64 | if (unlikely(__get_user(c,(unsigned long __user *)(src+res)))) |
@@ -89,8 +90,15 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, | |||
89 | * Get the size of a NUL-terminated string in user space. | 90 | * Get the size of a NUL-terminated string in user space. |
90 | * | 91 | * |
91 | * Returns the size of the string INCLUDING the terminating NUL. | 92 | * Returns the size of the string INCLUDING the terminating NUL. |
92 | * If the string is too long, returns 'count+1'. | 93 | * If the string is too long, returns a number larger than @count. User |
94 | * has to check the return value against "> count". | ||
93 | * On exception (or invalid count), returns 0. | 95 | * On exception (or invalid count), returns 0. |
96 | * | ||
97 | * NOTE! You should basically never use this function. There is | ||
98 | * almost never any valid case for using the length of a user space | ||
99 | * string, since the string can be changed at any time by other | ||
100 | * threads. Use "strncpy_from_user()" instead to get a stable copy | ||
101 | * of the string. | ||
94 | */ | 102 | */ |
95 | long strnlen_user(const char __user *str, long count) | 103 | long strnlen_user(const char __user *str, long count) |
96 | { | 104 | { |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 4abda074ea45..3c365ab6cf5f 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -537,8 +537,9 @@ EXPORT_SYMBOL_GPL(swiotlb_tbl_map_single); | |||
537 | * Allocates bounce buffer and returns its kernel virtual address. | 537 | * Allocates bounce buffer and returns its kernel virtual address. |
538 | */ | 538 | */ |
539 | 539 | ||
540 | phys_addr_t map_single(struct device *hwdev, phys_addr_t phys, size_t size, | 540 | static phys_addr_t |
541 | enum dma_data_direction dir) | 541 | map_single(struct device *hwdev, phys_addr_t phys, size_t size, |
542 | enum dma_data_direction dir) | ||
542 | { | 543 | { |
543 | dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start); | 544 | dma_addr_t start_dma_addr = phys_to_dma(hwdev, io_tlb_start); |
544 | 545 | ||
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 6dc4580df2af..000e7b3b9896 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -359,23 +359,6 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi) | |||
359 | flush_delayed_work(&bdi->wb.dwork); | 359 | flush_delayed_work(&bdi->wb.dwork); |
360 | } | 360 | } |
361 | 361 | ||
362 | /* | ||
363 | * Called when the device behind @bdi has been removed or ejected. | ||
364 | * | ||
365 | * We can't really do much here except for reducing the dirty ratio at | ||
366 | * the moment. In the future we should be able to set a flag so that | ||
367 | * the filesystem can handle errors at mark_inode_dirty time instead | ||
368 | * of only at writeback time. | ||
369 | */ | ||
370 | void bdi_unregister(struct backing_dev_info *bdi) | ||
371 | { | ||
372 | if (WARN_ON_ONCE(!bdi->dev)) | ||
373 | return; | ||
374 | |||
375 | bdi_set_min_ratio(bdi, 0); | ||
376 | } | ||
377 | EXPORT_SYMBOL(bdi_unregister); | ||
378 | |||
379 | static void bdi_wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi) | 362 | static void bdi_wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi) |
380 | { | 363 | { |
381 | memset(wb, 0, sizeof(*wb)); | 364 | memset(wb, 0, sizeof(*wb)); |
@@ -443,6 +426,7 @@ void bdi_destroy(struct backing_dev_info *bdi) | |||
443 | int i; | 426 | int i; |
444 | 427 | ||
445 | bdi_wb_shutdown(bdi); | 428 | bdi_wb_shutdown(bdi); |
429 | bdi_set_min_ratio(bdi, 0); | ||
446 | 430 | ||
447 | WARN_ON(!list_empty(&bdi->work_list)); | 431 | WARN_ON(!list_empty(&bdi->work_list)); |
448 | WARN_ON(delayed_work_pending(&bdi->wb.dwork)); | 432 | WARN_ON(delayed_work_pending(&bdi->wb.dwork)); |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index a3abe6ed111e..22fd0419b314 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1822,7 +1822,7 @@ static void br_multicast_query_expired(struct net_bridge *br, | |||
1822 | if (query->startup_sent < br->multicast_startup_query_count) | 1822 | if (query->startup_sent < br->multicast_startup_query_count) |
1823 | query->startup_sent++; | 1823 | query->startup_sent++; |
1824 | 1824 | ||
1825 | RCU_INIT_POINTER(querier, NULL); | 1825 | RCU_INIT_POINTER(querier->port, NULL); |
1826 | br_multicast_send_query(br, NULL, query); | 1826 | br_multicast_send_query(br, NULL, query); |
1827 | spin_unlock(&br->multicast_lock); | 1827 | spin_unlock(&br->multicast_lock); |
1828 | } | 1828 | } |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 24c7c96bf5f8..91180a7fc943 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -1117,8 +1117,6 @@ static int do_replace(struct net *net, const void __user *user, | |||
1117 | return -ENOMEM; | 1117 | return -ENOMEM; |
1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
1119 | return -ENOMEM; | 1119 | return -ENOMEM; |
1120 | if (tmp.num_counters == 0) | ||
1121 | return -EINVAL; | ||
1122 | 1120 | ||
1123 | tmp.name[sizeof(tmp.name) - 1] = 0; | 1121 | tmp.name[sizeof(tmp.name) - 1] = 0; |
1124 | 1122 | ||
@@ -2161,8 +2159,6 @@ static int compat_copy_ebt_replace_from_user(struct ebt_replace *repl, | |||
2161 | return -ENOMEM; | 2159 | return -ENOMEM; |
2162 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 2160 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
2163 | return -ENOMEM; | 2161 | return -ENOMEM; |
2164 | if (tmp.num_counters == 0) | ||
2165 | return -EINVAL; | ||
2166 | 2162 | ||
2167 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); | 2163 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); |
2168 | 2164 | ||
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 1347e11f5cc9..1d00b8922902 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -359,15 +359,7 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) | |||
359 | int err; | 359 | int err; |
360 | struct ethtool_cmd cmd; | 360 | struct ethtool_cmd cmd; |
361 | 361 | ||
362 | if (!dev->ethtool_ops->get_settings) | 362 | err = __ethtool_get_settings(dev, &cmd); |
363 | return -EOPNOTSUPP; | ||
364 | |||
365 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | ||
366 | return -EFAULT; | ||
367 | |||
368 | cmd.cmd = ETHTOOL_GSET; | ||
369 | |||
370 | err = dev->ethtool_ops->get_settings(dev, &cmd); | ||
371 | if (err < 0) | 363 | if (err < 0) |
372 | return err; | 364 | return err; |
373 | 365 | ||
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e6f6cc3a1bcf..392e29a0227d 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -359,7 +359,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
359 | */ | 359 | */ |
360 | ds = kzalloc(sizeof(*ds) + drv->priv_size, GFP_KERNEL); | 360 | ds = kzalloc(sizeof(*ds) + drv->priv_size, GFP_KERNEL); |
361 | if (ds == NULL) | 361 | if (ds == NULL) |
362 | return NULL; | 362 | return ERR_PTR(-ENOMEM); |
363 | 363 | ||
364 | ds->dst = dst; | 364 | ds->dst = dst; |
365 | ds->index = index; | 365 | ds->index = index; |
@@ -370,7 +370,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
370 | 370 | ||
371 | ret = dsa_switch_setup_one(ds, parent); | 371 | ret = dsa_switch_setup_one(ds, parent); |
372 | if (ret) | 372 | if (ret) |
373 | return NULL; | 373 | return ERR_PTR(ret); |
374 | 374 | ||
375 | return ds; | 375 | return ds; |
376 | } | 376 | } |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 421a80b09b62..30b544f025ac 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -256,7 +256,8 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
256 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); | 256 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); |
257 | aead_givcrypt_set_assoc(req, asg, assoclen); | 257 | aead_givcrypt_set_assoc(req, asg, assoclen); |
258 | aead_givcrypt_set_giv(req, esph->enc_data, | 258 | aead_givcrypt_set_giv(req, esph->enc_data, |
259 | XFRM_SKB_CB(skb)->seq.output.low); | 259 | XFRM_SKB_CB(skb)->seq.output.low + |
260 | ((u64)XFRM_SKB_CB(skb)->seq.output.hi << 32)); | ||
260 | 261 | ||
261 | ESP_SKB_CB(skb)->tmp = tmp; | 262 | ESP_SKB_CB(skb)->tmp = tmp; |
262 | err = crypto_aead_givencrypt(req); | 263 | err = crypto_aead_givencrypt(req); |
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index 9f7269f3c54a..0c152087ca15 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c | |||
@@ -65,7 +65,6 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi, | |||
65 | goto drop; | 65 | goto drop; |
66 | 66 | ||
67 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; | 67 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; |
68 | skb->mark = be32_to_cpu(tunnel->parms.i_key); | ||
69 | 68 | ||
70 | return xfrm_input(skb, nexthdr, spi, encap_type); | 69 | return xfrm_input(skb, nexthdr, spi, encap_type); |
71 | } | 70 | } |
@@ -91,6 +90,8 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) | |||
91 | struct pcpu_sw_netstats *tstats; | 90 | struct pcpu_sw_netstats *tstats; |
92 | struct xfrm_state *x; | 91 | struct xfrm_state *x; |
93 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; | 92 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; |
93 | u32 orig_mark = skb->mark; | ||
94 | int ret; | ||
94 | 95 | ||
95 | if (!tunnel) | 96 | if (!tunnel) |
96 | return 1; | 97 | return 1; |
@@ -107,7 +108,11 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) | |||
107 | x = xfrm_input_state(skb); | 108 | x = xfrm_input_state(skb); |
108 | family = x->inner_mode->afinfo->family; | 109 | family = x->inner_mode->afinfo->family; |
109 | 110 | ||
110 | if (!xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) | 111 | skb->mark = be32_to_cpu(tunnel->parms.i_key); |
112 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); | ||
113 | skb->mark = orig_mark; | ||
114 | |||
115 | if (!ret) | ||
111 | return -EPERM; | 116 | return -EPERM; |
112 | 117 | ||
113 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev))); | 118 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev))); |
@@ -216,8 +221,6 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
216 | 221 | ||
217 | memset(&fl, 0, sizeof(fl)); | 222 | memset(&fl, 0, sizeof(fl)); |
218 | 223 | ||
219 | skb->mark = be32_to_cpu(tunnel->parms.o_key); | ||
220 | |||
221 | switch (skb->protocol) { | 224 | switch (skb->protocol) { |
222 | case htons(ETH_P_IP): | 225 | case htons(ETH_P_IP): |
223 | xfrm_decode_session(skb, &fl, AF_INET); | 226 | xfrm_decode_session(skb, &fl, AF_INET); |
@@ -233,6 +236,9 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
233 | return NETDEV_TX_OK; | 236 | return NETDEV_TX_OK; |
234 | } | 237 | } |
235 | 238 | ||
239 | /* override mark with tunnel output key */ | ||
240 | fl.flowi_mark = be32_to_cpu(tunnel->parms.o_key); | ||
241 | |||
236 | return vti_xmit(skb, dev, &fl); | 242 | return vti_xmit(skb, dev, &fl); |
237 | } | 243 | } |
238 | 244 | ||
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 7a5ae50c80c8..84be008c945c 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -187,6 +187,7 @@ static void tcp_reinit_congestion_control(struct sock *sk, | |||
187 | 187 | ||
188 | tcp_cleanup_congestion_control(sk); | 188 | tcp_cleanup_congestion_control(sk); |
189 | icsk->icsk_ca_ops = ca; | 189 | icsk->icsk_ca_ops = ca; |
190 | icsk->icsk_ca_setsockopt = 1; | ||
190 | 191 | ||
191 | if (sk->sk_state != TCP_CLOSE && icsk->icsk_ca_ops->init) | 192 | if (sk->sk_state != TCP_CLOSE && icsk->icsk_ca_ops->init) |
192 | icsk->icsk_ca_ops->init(sk); | 193 | icsk->icsk_ca_ops->init(sk); |
@@ -335,8 +336,10 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | |||
335 | rcu_read_lock(); | 336 | rcu_read_lock(); |
336 | ca = __tcp_ca_find_autoload(name); | 337 | ca = __tcp_ca_find_autoload(name); |
337 | /* No change asking for existing value */ | 338 | /* No change asking for existing value */ |
338 | if (ca == icsk->icsk_ca_ops) | 339 | if (ca == icsk->icsk_ca_ops) { |
340 | icsk->icsk_ca_setsockopt = 1; | ||
339 | goto out; | 341 | goto out; |
342 | } | ||
340 | if (!ca) | 343 | if (!ca) |
341 | err = -ENOENT; | 344 | err = -ENOENT; |
342 | else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || | 345 | else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index b5732a54f2ad..17e7339ee5ca 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -420,7 +420,10 @@ void tcp_ca_openreq_child(struct sock *sk, const struct dst_entry *dst) | |||
420 | rcu_read_unlock(); | 420 | rcu_read_unlock(); |
421 | } | 421 | } |
422 | 422 | ||
423 | if (!ca_got_dst && !try_module_get(icsk->icsk_ca_ops->owner)) | 423 | /* If no valid choice made yet, assign current system default ca. */ |
424 | if (!ca_got_dst && | ||
425 | (!icsk->icsk_ca_setsockopt || | ||
426 | !try_module_get(icsk->icsk_ca_ops->owner))) | ||
424 | tcp_assign_congestion_control(sk); | 427 | tcp_assign_congestion_control(sk); |
425 | 428 | ||
426 | tcp_set_ca_state(sk, TCP_CA_Open); | 429 | tcp_set_ca_state(sk, TCP_CA_Open); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index d10b7e0112eb..1c92ea67baef 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1345,10 +1345,8 @@ csum_copy_err: | |||
1345 | } | 1345 | } |
1346 | unlock_sock_fast(sk, slow); | 1346 | unlock_sock_fast(sk, slow); |
1347 | 1347 | ||
1348 | if (noblock) | 1348 | /* starting over for a new packet, but check if we need to yield */ |
1349 | return -EAGAIN; | 1349 | cond_resched(); |
1350 | |||
1351 | /* starting over for a new packet */ | ||
1352 | msg->msg_flags &= ~MSG_TRUNC; | 1350 | msg->msg_flags &= ~MSG_TRUNC; |
1353 | goto try_again; | 1351 | goto try_again; |
1354 | } | 1352 | } |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 31f1b5d5e2ef..7c07ce36aae2 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -248,7 +248,8 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
248 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); | 248 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); |
249 | aead_givcrypt_set_assoc(req, asg, assoclen); | 249 | aead_givcrypt_set_assoc(req, asg, assoclen); |
250 | aead_givcrypt_set_giv(req, esph->enc_data, | 250 | aead_givcrypt_set_giv(req, esph->enc_data, |
251 | XFRM_SKB_CB(skb)->seq.output.low); | 251 | XFRM_SKB_CB(skb)->seq.output.low + |
252 | ((u64)XFRM_SKB_CB(skb)->seq.output.hi << 32)); | ||
252 | 253 | ||
253 | ESP_SKB_CB(skb)->tmp = tmp; | 254 | ESP_SKB_CB(skb)->tmp = tmp; |
254 | err = crypto_aead_givencrypt(req); | 255 | err = crypto_aead_givencrypt(req); |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index ed9d681207fa..0224c032dca5 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -322,7 +322,6 @@ static int vti6_rcv(struct sk_buff *skb) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; | 324 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; |
325 | skb->mark = be32_to_cpu(t->parms.i_key); | ||
326 | 325 | ||
327 | rcu_read_unlock(); | 326 | rcu_read_unlock(); |
328 | 327 | ||
@@ -342,6 +341,8 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
342 | struct pcpu_sw_netstats *tstats; | 341 | struct pcpu_sw_netstats *tstats; |
343 | struct xfrm_state *x; | 342 | struct xfrm_state *x; |
344 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; | 343 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; |
344 | u32 orig_mark = skb->mark; | ||
345 | int ret; | ||
345 | 346 | ||
346 | if (!t) | 347 | if (!t) |
347 | return 1; | 348 | return 1; |
@@ -358,7 +359,11 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
358 | x = xfrm_input_state(skb); | 359 | x = xfrm_input_state(skb); |
359 | family = x->inner_mode->afinfo->family; | 360 | family = x->inner_mode->afinfo->family; |
360 | 361 | ||
361 | if (!xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) | 362 | skb->mark = be32_to_cpu(t->parms.i_key); |
363 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); | ||
364 | skb->mark = orig_mark; | ||
365 | |||
366 | if (!ret) | ||
362 | return -EPERM; | 367 | return -EPERM; |
363 | 368 | ||
364 | skb_scrub_packet(skb, !net_eq(t->net, dev_net(skb->dev))); | 369 | skb_scrub_packet(skb, !net_eq(t->net, dev_net(skb->dev))); |
@@ -430,6 +435,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) | |||
430 | struct net_device *tdev; | 435 | struct net_device *tdev; |
431 | struct xfrm_state *x; | 436 | struct xfrm_state *x; |
432 | int err = -1; | 437 | int err = -1; |
438 | int mtu; | ||
433 | 439 | ||
434 | if (!dst) | 440 | if (!dst) |
435 | goto tx_err_link_failure; | 441 | goto tx_err_link_failure; |
@@ -463,6 +469,19 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) | |||
463 | skb_dst_set(skb, dst); | 469 | skb_dst_set(skb, dst); |
464 | skb->dev = skb_dst(skb)->dev; | 470 | skb->dev = skb_dst(skb)->dev; |
465 | 471 | ||
472 | mtu = dst_mtu(dst); | ||
473 | if (!skb->ignore_df && skb->len > mtu) { | ||
474 | skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu); | ||
475 | |||
476 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
477 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); | ||
478 | else | ||
479 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, | ||
480 | htonl(mtu)); | ||
481 | |||
482 | return -EMSGSIZE; | ||
483 | } | ||
484 | |||
466 | err = dst_output(skb); | 485 | err = dst_output(skb); |
467 | if (net_xmit_eval(err) == 0) { | 486 | if (net_xmit_eval(err) == 0) { |
468 | struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); | 487 | struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); |
@@ -495,7 +514,6 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
495 | int ret; | 514 | int ret; |
496 | 515 | ||
497 | memset(&fl, 0, sizeof(fl)); | 516 | memset(&fl, 0, sizeof(fl)); |
498 | skb->mark = be32_to_cpu(t->parms.o_key); | ||
499 | 517 | ||
500 | switch (skb->protocol) { | 518 | switch (skb->protocol) { |
501 | case htons(ETH_P_IPV6): | 519 | case htons(ETH_P_IPV6): |
@@ -516,6 +534,9 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
516 | goto tx_err; | 534 | goto tx_err; |
517 | } | 535 | } |
518 | 536 | ||
537 | /* override mark with tunnel output key */ | ||
538 | fl.flowi_mark = be32_to_cpu(t->parms.o_key); | ||
539 | |||
519 | ret = vti6_xmit(skb, dev, &fl); | 540 | ret = vti6_xmit(skb, dev, &fl); |
520 | if (ret < 0) | 541 | if (ret < 0) |
521 | goto tx_err; | 542 | goto tx_err; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index c2ec41617a35..e51fc3eee6db 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -525,10 +525,8 @@ csum_copy_err: | |||
525 | } | 525 | } |
526 | unlock_sock_fast(sk, slow); | 526 | unlock_sock_fast(sk, slow); |
527 | 527 | ||
528 | if (noblock) | 528 | /* starting over for a new packet, but check if we need to yield */ |
529 | return -EAGAIN; | 529 | cond_resched(); |
530 | |||
531 | /* starting over for a new packet */ | ||
532 | msg->msg_flags &= ~MSG_TRUNC; | 530 | msg->msg_flags &= ~MSG_TRUNC; |
533 | goto try_again; | 531 | goto try_again; |
534 | } | 532 | } |
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 526c4feb3b50..b58286ecd156 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <net/dst.h> | 13 | #include <net/dst.h> |
14 | #include <net/ip.h> | 14 | #include <net/ip.h> |
15 | #include <net/xfrm.h> | 15 | #include <net/xfrm.h> |
16 | #include <net/ip_tunnels.h> | ||
17 | #include <net/ip6_tunnel.h> | ||
16 | 18 | ||
17 | static struct kmem_cache *secpath_cachep __read_mostly; | 19 | static struct kmem_cache *secpath_cachep __read_mostly; |
18 | 20 | ||
@@ -186,6 +188,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
186 | struct xfrm_state *x = NULL; | 188 | struct xfrm_state *x = NULL; |
187 | xfrm_address_t *daddr; | 189 | xfrm_address_t *daddr; |
188 | struct xfrm_mode *inner_mode; | 190 | struct xfrm_mode *inner_mode; |
191 | u32 mark = skb->mark; | ||
189 | unsigned int family; | 192 | unsigned int family; |
190 | int decaps = 0; | 193 | int decaps = 0; |
191 | int async = 0; | 194 | int async = 0; |
@@ -203,6 +206,18 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
203 | XFRM_SPI_SKB_CB(skb)->daddroff); | 206 | XFRM_SPI_SKB_CB(skb)->daddroff); |
204 | family = XFRM_SPI_SKB_CB(skb)->family; | 207 | family = XFRM_SPI_SKB_CB(skb)->family; |
205 | 208 | ||
209 | /* if tunnel is present override skb->mark value with tunnel i_key */ | ||
210 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { | ||
211 | switch (family) { | ||
212 | case AF_INET: | ||
213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); | ||
214 | break; | ||
215 | case AF_INET6: | ||
216 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); | ||
217 | break; | ||
218 | } | ||
219 | } | ||
220 | |||
206 | /* Allocate new secpath or COW existing one. */ | 221 | /* Allocate new secpath or COW existing one. */ |
207 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { | 222 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { |
208 | struct sec_path *sp; | 223 | struct sec_path *sp; |
@@ -229,7 +244,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
229 | goto drop; | 244 | goto drop; |
230 | } | 245 | } |
231 | 246 | ||
232 | x = xfrm_state_lookup(net, skb->mark, daddr, spi, nexthdr, family); | 247 | x = xfrm_state_lookup(net, mark, daddr, spi, nexthdr, family); |
233 | if (x == NULL) { | 248 | if (x == NULL) { |
234 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); | 249 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); |
235 | xfrm_audit_state_notfound(skb, family, spi, seq); | 250 | xfrm_audit_state_notfound(skb, family, spi, seq); |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index dab57daae408..4fd725a0c500 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
@@ -99,6 +99,7 @@ static int xfrm_replay_overflow(struct xfrm_state *x, struct sk_buff *skb) | |||
99 | 99 | ||
100 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { | 100 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { |
101 | XFRM_SKB_CB(skb)->seq.output.low = ++x->replay.oseq; | 101 | XFRM_SKB_CB(skb)->seq.output.low = ++x->replay.oseq; |
102 | XFRM_SKB_CB(skb)->seq.output.hi = 0; | ||
102 | if (unlikely(x->replay.oseq == 0)) { | 103 | if (unlikely(x->replay.oseq == 0)) { |
103 | x->replay.oseq--; | 104 | x->replay.oseq--; |
104 | xfrm_audit_state_replay_overflow(x, skb); | 105 | xfrm_audit_state_replay_overflow(x, skb); |
@@ -177,6 +178,7 @@ static int xfrm_replay_overflow_bmp(struct xfrm_state *x, struct sk_buff *skb) | |||
177 | 178 | ||
178 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { | 179 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { |
179 | XFRM_SKB_CB(skb)->seq.output.low = ++replay_esn->oseq; | 180 | XFRM_SKB_CB(skb)->seq.output.low = ++replay_esn->oseq; |
181 | XFRM_SKB_CB(skb)->seq.output.hi = 0; | ||
180 | if (unlikely(replay_esn->oseq == 0)) { | 182 | if (unlikely(replay_esn->oseq == 0)) { |
181 | replay_esn->oseq--; | 183 | replay_esn->oseq--; |
182 | xfrm_audit_state_replay_overflow(x, skb); | 184 | xfrm_audit_state_replay_overflow(x, skb); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index f5e39e35d73a..96688cd0f6f1 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -927,8 +927,8 @@ struct xfrm_state *xfrm_state_lookup_byspi(struct net *net, __be32 spi, | |||
927 | x->id.spi != spi) | 927 | x->id.spi != spi) |
928 | continue; | 928 | continue; |
929 | 929 | ||
930 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | ||
931 | xfrm_state_hold(x); | 930 | xfrm_state_hold(x); |
931 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | ||
932 | return x; | 932 | return x; |
933 | } | 933 | } |
934 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | 934 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 464168426465..0320cb523d9e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2168,6 +2168,7 @@ static const struct hda_fixup alc882_fixups[] = { | |||
2168 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { | 2168 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
2169 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), | 2169 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), |
2170 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | 2170 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), |
2171 | SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | ||
2171 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), | 2172 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), |
2172 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | 2173 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), |
2173 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), | 2174 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), |
@@ -5377,6 +5378,13 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5377 | {0x1d, 0x40700001}, | 5378 | {0x1d, 0x40700001}, |
5378 | {0x21, 0x02211040}), | 5379 | {0x21, 0x02211040}), |
5379 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5380 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5381 | ALC255_STANDARD_PINS, | ||
5382 | {0x12, 0x90a60160}, | ||
5383 | {0x14, 0x90170120}, | ||
5384 | {0x17, 0x40000000}, | ||
5385 | {0x1d, 0x40700001}, | ||
5386 | {0x21, 0x02211030}), | ||
5387 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5380 | ALC256_STANDARD_PINS, | 5388 | ALC256_STANDARD_PINS, |
5381 | {0x13, 0x40000000}), | 5389 | {0x13, 0x40000000}), |
5382 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5390 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 31a95cca015d..bab6c04932aa 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -449,6 +449,15 @@ static int via_suspend(struct hda_codec *codec) | |||
449 | 449 | ||
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | |||
453 | static int via_resume(struct hda_codec *codec) | ||
454 | { | ||
455 | /* some delay here to make jack detection working (bko#98921) */ | ||
456 | msleep(10); | ||
457 | codec->patch_ops.init(codec); | ||
458 | regcache_sync(codec->core.regmap); | ||
459 | return 0; | ||
460 | } | ||
452 | #endif | 461 | #endif |
453 | 462 | ||
454 | #ifdef CONFIG_PM | 463 | #ifdef CONFIG_PM |
@@ -475,6 +484,7 @@ static const struct hda_codec_ops via_patch_ops = { | |||
475 | .stream_pm = snd_hda_gen_stream_pm, | 484 | .stream_pm = snd_hda_gen_stream_pm, |
476 | #ifdef CONFIG_PM | 485 | #ifdef CONFIG_PM |
477 | .suspend = via_suspend, | 486 | .suspend = via_suspend, |
487 | .resume = via_resume, | ||
478 | .check_power_status = via_check_power_status, | 488 | .check_power_status = via_check_power_status, |
479 | #endif | 489 | #endif |
480 | }; | 490 | }; |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 3e2ef61c627b..8b7e391dd0b8 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -918,6 +918,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, | |||
918 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ | 918 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ |
919 | case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ | 919 | case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ |
920 | case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ | 920 | case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ |
921 | case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */ | ||
921 | case USB_ID(0x046d, 0x0991): | 922 | case USB_ID(0x046d, 0x0991): |
922 | /* Most audio usb devices lie about volume resolution. | 923 | /* Most audio usb devices lie about volume resolution. |
923 | * Most Logitech webcams have res = 384. | 924 | * Most Logitech webcams have res = 384. |
@@ -1582,12 +1583,6 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, | |||
1582 | unitid); | 1583 | unitid); |
1583 | return -EINVAL; | 1584 | return -EINVAL; |
1584 | } | 1585 | } |
1585 | /* no bmControls field (e.g. Maya44) -> ignore */ | ||
1586 | if (desc->bLength <= 10 + input_pins) { | ||
1587 | usb_audio_dbg(state->chip, "MU %d has no bmControls field\n", | ||
1588 | unitid); | ||
1589 | return 0; | ||
1590 | } | ||
1591 | 1586 | ||
1592 | num_ins = 0; | 1587 | num_ins = 0; |
1593 | ich = 0; | 1588 | ich = 0; |
@@ -1595,6 +1590,9 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, | |||
1595 | err = parse_audio_unit(state, desc->baSourceID[pin]); | 1590 | err = parse_audio_unit(state, desc->baSourceID[pin]); |
1596 | if (err < 0) | 1591 | if (err < 0) |
1597 | continue; | 1592 | continue; |
1593 | /* no bmControls field (e.g. Maya44) -> ignore */ | ||
1594 | if (desc->bLength <= 10 + input_pins) | ||
1595 | continue; | ||
1598 | err = check_input_term(state, desc->baSourceID[pin], &iterm); | 1596 | err = check_input_term(state, desc->baSourceID[pin], &iterm); |
1599 | if (err < 0) | 1597 | if (err < 0) |
1600 | return err; | 1598 | return err; |
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index b703cb3cda19..e5000da9e9d7 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c | |||
@@ -437,6 +437,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { | |||
437 | .map = ebox44_map, | 437 | .map = ebox44_map, |
438 | }, | 438 | }, |
439 | { | 439 | { |
440 | /* MAYA44 USB+ */ | ||
441 | .id = USB_ID(0x2573, 0x0008), | ||
442 | .map = maya44_map, | ||
443 | }, | ||
444 | { | ||
440 | /* KEF X300A */ | 445 | /* KEF X300A */ |
441 | .id = USB_ID(0x27ac, 0x1000), | 446 | .id = USB_ID(0x27ac, 0x1000), |
442 | .map = scms_usb3318_map, | 447 | .map = scms_usb3318_map, |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 29175346cc4f..b8c97d092a47 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1120,6 +1120,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1120 | case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ | 1120 | case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ |
1121 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ | 1121 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ |
1122 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ | 1122 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
1123 | case USB_ID(0x074D, 0x3553): /* Outlaw RR2150 (Micronas UAC3553B) */ | ||
1123 | return true; | 1124 | return true; |
1124 | } | 1125 | } |
1125 | return false; | 1126 | return false; |
diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 5bdb781163d1..9b0d8baf2934 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile | |||
@@ -5,8 +5,10 @@ include ../lib.mk | |||
5 | .PHONY: all all_32 all_64 warn_32bit_failure clean | 5 | .PHONY: all all_32 all_64 warn_32bit_failure clean |
6 | 6 | ||
7 | TARGETS_C_BOTHBITS := sigreturn single_step_syscall | 7 | TARGETS_C_BOTHBITS := sigreturn single_step_syscall |
8 | TARGETS_C_32BIT_ONLY := entry_from_vm86 | ||
8 | 9 | ||
9 | BINARIES_32 := $(TARGETS_C_BOTHBITS:%=%_32) | 10 | TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY) |
11 | BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32) | ||
10 | BINARIES_64 := $(TARGETS_C_BOTHBITS:%=%_64) | 12 | BINARIES_64 := $(TARGETS_C_BOTHBITS:%=%_64) |
11 | 13 | ||
12 | CFLAGS := -O2 -g -std=gnu99 -pthread -Wall | 14 | CFLAGS := -O2 -g -std=gnu99 -pthread -Wall |
@@ -32,7 +34,7 @@ all_64: $(BINARIES_64) | |||
32 | clean: | 34 | clean: |
33 | $(RM) $(BINARIES_32) $(BINARIES_64) | 35 | $(RM) $(BINARIES_32) $(BINARIES_64) |
34 | 36 | ||
35 | $(TARGETS_C_BOTHBITS:%=%_32): %_32: %.c | 37 | $(TARGETS_C_32BIT_ALL:%=%_32): %_32: %.c |
36 | $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl | 38 | $(CC) -m32 -o $@ $(CFLAGS) $(EXTRA_CFLAGS) $^ -lrt -ldl |
37 | 39 | ||
38 | $(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c | 40 | $(TARGETS_C_BOTHBITS:%=%_64): %_64: %.c |
diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c new file mode 100644 index 000000000000..5c38a187677b --- /dev/null +++ b/tools/testing/selftests/x86/entry_from_vm86.c | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * entry_from_vm86.c - tests kernel entries from vm86 mode | ||
3 | * Copyright (c) 2014-2015 Andrew Lutomirski | ||
4 | * | ||
5 | * This exercises a few paths that need to special-case vm86 mode. | ||
6 | * | ||
7 | * GPL v2. | ||
8 | */ | ||
9 | |||
10 | #define _GNU_SOURCE | ||
11 | |||
12 | #include <assert.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <sys/syscall.h> | ||
15 | #include <sys/signal.h> | ||
16 | #include <sys/ucontext.h> | ||
17 | #include <unistd.h> | ||
18 | #include <stdio.h> | ||
19 | #include <string.h> | ||
20 | #include <inttypes.h> | ||
21 | #include <sys/mman.h> | ||
22 | #include <err.h> | ||
23 | #include <stddef.h> | ||
24 | #include <stdbool.h> | ||
25 | #include <errno.h> | ||
26 | #include <sys/vm86.h> | ||
27 | |||
28 | static unsigned long load_addr = 0x10000; | ||
29 | static int nerrs = 0; | ||
30 | |||
31 | asm ( | ||
32 | ".pushsection .rodata\n\t" | ||
33 | ".type vmcode_bound, @object\n\t" | ||
34 | "vmcode:\n\t" | ||
35 | "vmcode_bound:\n\t" | ||
36 | ".code16\n\t" | ||
37 | "bound %ax, (2048)\n\t" | ||
38 | "int3\n\t" | ||
39 | "vmcode_sysenter:\n\t" | ||
40 | "sysenter\n\t" | ||
41 | ".size vmcode, . - vmcode\n\t" | ||
42 | "end_vmcode:\n\t" | ||
43 | ".code32\n\t" | ||
44 | ".popsection" | ||
45 | ); | ||
46 | |||
47 | extern unsigned char vmcode[], end_vmcode[]; | ||
48 | extern unsigned char vmcode_bound[], vmcode_sysenter[]; | ||
49 | |||
50 | static void do_test(struct vm86plus_struct *v86, unsigned long eip, | ||
51 | const char *text) | ||
52 | { | ||
53 | long ret; | ||
54 | |||
55 | printf("[RUN]\t%s from vm86 mode\n", text); | ||
56 | v86->regs.eip = eip; | ||
57 | ret = vm86(VM86_ENTER, v86); | ||
58 | |||
59 | if (ret == -1 && errno == ENOSYS) { | ||
60 | printf("[SKIP]\tvm86 not supported\n"); | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | if (VM86_TYPE(ret) == VM86_INTx) { | ||
65 | char trapname[32]; | ||
66 | int trapno = VM86_ARG(ret); | ||
67 | if (trapno == 13) | ||
68 | strcpy(trapname, "GP"); | ||
69 | else if (trapno == 5) | ||
70 | strcpy(trapname, "BR"); | ||
71 | else if (trapno == 14) | ||
72 | strcpy(trapname, "PF"); | ||
73 | else | ||
74 | sprintf(trapname, "%d", trapno); | ||
75 | |||
76 | printf("[OK]\tExited vm86 mode due to #%s\n", trapname); | ||
77 | } else if (VM86_TYPE(ret) == VM86_UNKNOWN) { | ||
78 | printf("[OK]\tExited vm86 mode due to unhandled GP fault\n"); | ||
79 | } else { | ||
80 | printf("[OK]\tExited vm86 mode due to type %ld, arg %ld\n", | ||
81 | VM86_TYPE(ret), VM86_ARG(ret)); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | int main(void) | ||
86 | { | ||
87 | struct vm86plus_struct v86; | ||
88 | unsigned char *addr = mmap((void *)load_addr, 4096, | ||
89 | PROT_READ | PROT_WRITE | PROT_EXEC, | ||
90 | MAP_ANONYMOUS | MAP_PRIVATE, -1,0); | ||
91 | if (addr != (unsigned char *)load_addr) | ||
92 | err(1, "mmap"); | ||
93 | |||
94 | memcpy(addr, vmcode, end_vmcode - vmcode); | ||
95 | addr[2048] = 2; | ||
96 | addr[2050] = 3; | ||
97 | |||
98 | memset(&v86, 0, sizeof(v86)); | ||
99 | |||
100 | v86.regs.cs = load_addr / 16; | ||
101 | v86.regs.ss = load_addr / 16; | ||
102 | v86.regs.ds = load_addr / 16; | ||
103 | v86.regs.es = load_addr / 16; | ||
104 | |||
105 | assert((v86.regs.cs & 3) == 0); /* Looks like RPL = 0 */ | ||
106 | |||
107 | /* #BR -- should deliver SIG??? */ | ||
108 | do_test(&v86, vmcode_bound - vmcode, "#BR"); | ||
109 | |||
110 | /* SYSENTER -- should cause #GP or #UD depending on CPU */ | ||
111 | do_test(&v86, vmcode_sysenter - vmcode, "SYSENTER"); | ||
112 | |||
113 | return (nerrs == 0 ? 0 : 1); | ||
114 | } | ||