diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-02 22:53:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-02 22:53:09 -0500 |
commit | aa074c1c805a38c01c0dfe56f78d409e33be28a2 (patch) | |
tree | 5a361535d8df880af24e02b1508c2a6b44ae17c5 | |
parent | 7a962a4b6e86d27a7ba1c325a5981b52ad72c29b (diff) | |
parent | 0414855fdc4a40da05221fc6062cccbc0c30f169 (diff) |
Merge 3.14-rc5 into char-misc-next
We want these fixes in here as well.
169 files changed, 1880 insertions, 1142 deletions
diff --git a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt index 68b83ecc3850..ee9be9961524 100644 --- a/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt +++ b/Documentation/devicetree/bindings/dma/fsl-imx-sdma.txt | |||
@@ -1,12 +1,16 @@ | |||
1 | * Freescale Smart Direct Memory Access (SDMA) Controller for i.MX | 1 | * Freescale Smart Direct Memory Access (SDMA) Controller for i.MX |
2 | 2 | ||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : Should be "fsl,imx31-sdma", "fsl,imx31-to1-sdma", | 4 | - compatible : Should be one of |
5 | "fsl,imx31-to2-sdma", "fsl,imx35-sdma", "fsl,imx35-to1-sdma", | 5 | "fsl,imx25-sdma" |
6 | "fsl,imx35-to2-sdma", "fsl,imx51-sdma", "fsl,imx53-sdma" or | 6 | "fsl,imx31-sdma", "fsl,imx31-to1-sdma", "fsl,imx31-to2-sdma" |
7 | "fsl,imx6q-sdma". The -to variants should be preferred since they | 7 | "fsl,imx35-sdma", "fsl,imx35-to1-sdma", "fsl,imx35-to2-sdma" |
8 | allow to determnine the correct ROM script addresses needed for | 8 | "fsl,imx51-sdma" |
9 | the driver to work without additional firmware. | 9 | "fsl,imx53-sdma" |
10 | "fsl,imx6q-sdma" | ||
11 | The -to variants should be preferred since they allow to determnine the | ||
12 | correct ROM script addresses needed for the driver to work without additional | ||
13 | firmware. | ||
10 | - reg : Should contain SDMA registers location and length | 14 | - reg : Should contain SDMA registers location and length |
11 | - interrupts : Should contain SDMA interrupt | 15 | - interrupts : Should contain SDMA interrupt |
12 | - #dma-cells : Must be <3>. | 16 | - #dma-cells : Must be <3>. |
diff --git a/MAINTAINERS b/MAINTAINERS index 5d35f6cc0b69..59b3fef9ead7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -538,7 +538,7 @@ F: arch/alpha/ | |||
538 | ALTERA UART/JTAG UART SERIAL DRIVERS | 538 | ALTERA UART/JTAG UART SERIAL DRIVERS |
539 | M: Tobias Klauser <tklauser@distanz.ch> | 539 | M: Tobias Klauser <tklauser@distanz.ch> |
540 | L: linux-serial@vger.kernel.org | 540 | L: linux-serial@vger.kernel.org |
541 | L: nios2-dev@sopc.et.ntust.edu.tw (moderated for non-subscribers) | 541 | L: nios2-dev@lists.rocketboards.org (moderated for non-subscribers) |
542 | S: Maintained | 542 | S: Maintained |
543 | F: drivers/tty/serial/altera_uart.c | 543 | F: drivers/tty/serial/altera_uart.c |
544 | F: drivers/tty/serial/altera_jtaguart.c | 544 | F: drivers/tty/serial/altera_jtaguart.c |
@@ -2611,9 +2611,9 @@ DC395x SCSI driver | |||
2611 | M: Oliver Neukum <oliver@neukum.org> | 2611 | M: Oliver Neukum <oliver@neukum.org> |
2612 | M: Ali Akcaagac <aliakc@web.de> | 2612 | M: Ali Akcaagac <aliakc@web.de> |
2613 | M: Jamie Lenehan <lenehan@twibble.org> | 2613 | M: Jamie Lenehan <lenehan@twibble.org> |
2614 | W: http://twibble.org/dist/dc395x/ | ||
2615 | L: dc395x@twibble.org | 2614 | L: dc395x@twibble.org |
2616 | L: http://lists.twibble.org/mailman/listinfo/dc395x/ | 2615 | W: http://twibble.org/dist/dc395x/ |
2616 | W: http://lists.twibble.org/mailman/listinfo/dc395x/ | ||
2617 | S: Maintained | 2617 | S: Maintained |
2618 | F: Documentation/scsi/dc395x.txt | 2618 | F: Documentation/scsi/dc395x.txt |
2619 | F: drivers/scsi/dc395x.* | 2619 | F: drivers/scsi/dc395x.* |
@@ -2848,12 +2848,22 @@ F: lib/kobj* | |||
2848 | DRM DRIVERS | 2848 | DRM DRIVERS |
2849 | M: David Airlie <airlied@linux.ie> | 2849 | M: David Airlie <airlied@linux.ie> |
2850 | L: dri-devel@lists.freedesktop.org | 2850 | L: dri-devel@lists.freedesktop.org |
2851 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git | 2851 | T: git git://people.freedesktop.org/~airlied/linux |
2852 | S: Maintained | 2852 | S: Maintained |
2853 | F: drivers/gpu/drm/ | 2853 | F: drivers/gpu/drm/ |
2854 | F: include/drm/ | 2854 | F: include/drm/ |
2855 | F: include/uapi/drm/ | 2855 | F: include/uapi/drm/ |
2856 | 2856 | ||
2857 | RADEON DRM DRIVERS | ||
2858 | M: Alex Deucher <alexander.deucher@amd.com> | ||
2859 | M: Christian König <christian.koenig@amd.com> | ||
2860 | L: dri-devel@lists.freedesktop.org | ||
2861 | T: git git://people.freedesktop.org/~agd5f/linux | ||
2862 | S: Supported | ||
2863 | F: drivers/gpu/drm/radeon/ | ||
2864 | F: include/drm/radeon* | ||
2865 | F: include/uapi/drm/radeon* | ||
2866 | |||
2857 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) | 2867 | INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) |
2858 | M: Daniel Vetter <daniel.vetter@ffwll.ch> | 2868 | M: Daniel Vetter <daniel.vetter@ffwll.ch> |
2859 | M: Jani Nikula <jani.nikula@linux.intel.com> | 2869 | M: Jani Nikula <jani.nikula@linux.intel.com> |
@@ -5501,6 +5511,11 @@ W: http://www.kernel.org/doc/man-pages | |||
5501 | L: linux-man@vger.kernel.org | 5511 | L: linux-man@vger.kernel.org |
5502 | S: Maintained | 5512 | S: Maintained |
5503 | 5513 | ||
5514 | MARVELL ARMADA DRM SUPPORT | ||
5515 | M: Russell King <rmk+kernel@arm.linux.org.uk> | ||
5516 | S: Maintained | ||
5517 | F: drivers/gpu/drm/armada/ | ||
5518 | |||
5504 | MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) | 5519 | MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) |
5505 | M: Mirko Lindner <mlindner@marvell.com> | 5520 | M: Mirko Lindner <mlindner@marvell.com> |
5506 | M: Stephen Hemminger <stephen@networkplumber.org> | 5521 | M: Stephen Hemminger <stephen@networkplumber.org> |
@@ -8449,8 +8464,8 @@ TARGET SUBSYSTEM | |||
8449 | M: Nicholas A. Bellinger <nab@linux-iscsi.org> | 8464 | M: Nicholas A. Bellinger <nab@linux-iscsi.org> |
8450 | L: linux-scsi@vger.kernel.org | 8465 | L: linux-scsi@vger.kernel.org |
8451 | L: target-devel@vger.kernel.org | 8466 | L: target-devel@vger.kernel.org |
8452 | L: http://groups.google.com/group/linux-iscsi-target-dev | ||
8453 | W: http://www.linux-iscsi.org | 8467 | W: http://www.linux-iscsi.org |
8468 | W: http://groups.google.com/group/linux-iscsi-target-dev | ||
8454 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master | 8469 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git master |
8455 | S: Supported | 8470 | S: Supported |
8456 | F: drivers/target/ | 8471 | F: drivers/target/ |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 14 | 2 | PATCHLEVEL = 14 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Shuffling Zombie Juror |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
@@ -605,10 +605,11 @@ endif | |||
605 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR | 605 | ifdef CONFIG_CC_STACKPROTECTOR_REGULAR |
606 | stackp-flag := -fstack-protector | 606 | stackp-flag := -fstack-protector |
607 | ifeq ($(call cc-option, $(stackp-flag)),) | 607 | ifeq ($(call cc-option, $(stackp-flag)),) |
608 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR: \ | 608 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: \ |
609 | -fstack-protector not supported by compiler)) | 609 | -fstack-protector not supported by compiler) |
610 | endif | 610 | endif |
611 | else ifdef CONFIG_CC_STACKPROTECTOR_STRONG | 611 | else |
612 | ifdef CONFIG_CC_STACKPROTECTOR_STRONG | ||
612 | stackp-flag := -fstack-protector-strong | 613 | stackp-flag := -fstack-protector-strong |
613 | ifeq ($(call cc-option, $(stackp-flag)),) | 614 | ifeq ($(call cc-option, $(stackp-flag)),) |
614 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \ | 615 | $(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \ |
@@ -618,6 +619,7 @@ else | |||
618 | # Force off for distro compilers that enable stack protector by default. | 619 | # Force off for distro compilers that enable stack protector by default. |
619 | stackp-flag := $(call cc-option, -fno-stack-protector) | 620 | stackp-flag := $(call cc-option, -fno-stack-protector) |
620 | endif | 621 | endif |
622 | endif | ||
621 | KBUILD_CFLAGS += $(stackp-flag) | 623 | KBUILD_CFLAGS += $(stackp-flag) |
622 | 624 | ||
623 | # This warning generated too much noise in a regular build. | 625 | # This warning generated too much noise in a regular build. |
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 1d8248ea5669..bd18bb8b2770 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c | |||
@@ -878,7 +878,8 @@ static int hyp_init_cpu_pm_notifier(struct notifier_block *self, | |||
878 | unsigned long cmd, | 878 | unsigned long cmd, |
879 | void *v) | 879 | void *v) |
880 | { | 880 | { |
881 | if (cmd == CPU_PM_EXIT) { | 881 | if (cmd == CPU_PM_EXIT && |
882 | __hyp_get_vectors() == hyp_default_vectors) { | ||
882 | cpu_init_hyp_mode(NULL); | 883 | cpu_init_hyp_mode(NULL); |
883 | return NOTIFY_OK; | 884 | return NOTIFY_OK; |
884 | } | 885 | } |
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S index ddc15539bad2..0d68d4073068 100644 --- a/arch/arm/kvm/interrupts.S +++ b/arch/arm/kvm/interrupts.S | |||
@@ -220,6 +220,10 @@ after_vfp_restore: | |||
220 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are | 220 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are |
221 | * passed in r0 and r1. | 221 | * passed in r0 and r1. |
222 | * | 222 | * |
223 | * A function pointer with a value of 0xffffffff has a special meaning, | ||
224 | * and is used to implement __hyp_get_vectors in the same way as in | ||
225 | * arch/arm/kernel/hyp_stub.S. | ||
226 | * | ||
223 | * The calling convention follows the standard AAPCS: | 227 | * The calling convention follows the standard AAPCS: |
224 | * r0 - r3: caller save | 228 | * r0 - r3: caller save |
225 | * r12: caller save | 229 | * r12: caller save |
@@ -363,6 +367,11 @@ hyp_hvc: | |||
363 | host_switch_to_hyp: | 367 | host_switch_to_hyp: |
364 | pop {r0, r1, r2} | 368 | pop {r0, r1, r2} |
365 | 369 | ||
370 | /* Check for __hyp_get_vectors */ | ||
371 | cmp r0, #-1 | ||
372 | mrceq p15, 4, r0, c12, c0, 0 @ get HVBAR | ||
373 | beq 1f | ||
374 | |||
366 | push {lr} | 375 | push {lr} |
367 | mrs lr, SPSR | 376 | mrs lr, SPSR |
368 | push {lr} | 377 | push {lr} |
@@ -378,7 +387,7 @@ THUMB( orr lr, #1) | |||
378 | pop {lr} | 387 | pop {lr} |
379 | msr SPSR_csxf, lr | 388 | msr SPSR_csxf, lr |
380 | pop {lr} | 389 | pop {lr} |
381 | eret | 390 | 1: eret |
382 | 391 | ||
383 | guest_trap: | 392 | guest_trap: |
384 | load_vcpu @ Load VCPU pointer to r0 | 393 | load_vcpu @ Load VCPU pointer to r0 |
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 13fb0b3efc5f..453a179469a3 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #ifndef __ASM_PERCPU_H | 16 | #ifndef __ASM_PERCPU_H |
17 | #define __ASM_PERCPU_H | 17 | #define __ASM_PERCPU_H |
18 | 18 | ||
19 | #ifdef CONFIG_SMP | ||
20 | |||
19 | static inline void set_my_cpu_offset(unsigned long off) | 21 | static inline void set_my_cpu_offset(unsigned long off) |
20 | { | 22 | { |
21 | asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory"); | 23 | asm volatile("msr tpidr_el1, %0" :: "r" (off) : "memory"); |
@@ -36,6 +38,12 @@ static inline unsigned long __my_cpu_offset(void) | |||
36 | } | 38 | } |
37 | #define __my_cpu_offset __my_cpu_offset() | 39 | #define __my_cpu_offset __my_cpu_offset() |
38 | 40 | ||
41 | #else /* !CONFIG_SMP */ | ||
42 | |||
43 | #define set_my_cpu_offset(x) do { } while (0) | ||
44 | |||
45 | #endif /* CONFIG_SMP */ | ||
46 | |||
39 | #include <asm-generic/percpu.h> | 47 | #include <asm-generic/percpu.h> |
40 | 48 | ||
41 | #endif /* __ASM_PERCPU_H */ | 49 | #endif /* __ASM_PERCPU_H */ |
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index b524dcd17243..aa3917c8b623 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -136,11 +136,11 @@ extern struct page *empty_zero_page; | |||
136 | /* | 136 | /* |
137 | * The following only work if pte_present(). Undefined behaviour otherwise. | 137 | * The following only work if pte_present(). Undefined behaviour otherwise. |
138 | */ | 138 | */ |
139 | #define pte_present(pte) (pte_val(pte) & (PTE_VALID | PTE_PROT_NONE)) | 139 | #define pte_present(pte) (!!(pte_val(pte) & (PTE_VALID | PTE_PROT_NONE))) |
140 | #define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) | 140 | #define pte_dirty(pte) (!!(pte_val(pte) & PTE_DIRTY)) |
141 | #define pte_young(pte) (pte_val(pte) & PTE_AF) | 141 | #define pte_young(pte) (!!(pte_val(pte) & PTE_AF)) |
142 | #define pte_special(pte) (pte_val(pte) & PTE_SPECIAL) | 142 | #define pte_special(pte) (!!(pte_val(pte) & PTE_SPECIAL)) |
143 | #define pte_write(pte) (pte_val(pte) & PTE_WRITE) | 143 | #define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE)) |
144 | #define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) | 144 | #define pte_exec(pte) (!(pte_val(pte) & PTE_UXN)) |
145 | 145 | ||
146 | #define pte_valid_user(pte) \ | 146 | #define pte_valid_user(pte) \ |
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index c3b6c63ea5fb..38f0558f0c0a 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c | |||
@@ -48,7 +48,11 @@ int unwind_frame(struct stackframe *frame) | |||
48 | 48 | ||
49 | frame->sp = fp + 0x10; | 49 | frame->sp = fp + 0x10; |
50 | frame->fp = *(unsigned long *)(fp); | 50 | frame->fp = *(unsigned long *)(fp); |
51 | frame->pc = *(unsigned long *)(fp + 8); | 51 | /* |
52 | * -4 here because we care about the PC at time of bl, | ||
53 | * not where the return will go. | ||
54 | */ | ||
55 | frame->pc = *(unsigned long *)(fp + 8) - 4; | ||
52 | 56 | ||
53 | return 0; | 57 | return 0; |
54 | } | 58 | } |
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index 3b47c36e10ff..2c56012cb2d2 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S | |||
@@ -694,6 +694,24 @@ __hyp_panic_str: | |||
694 | 694 | ||
695 | .align 2 | 695 | .align 2 |
696 | 696 | ||
697 | /* | ||
698 | * u64 kvm_call_hyp(void *hypfn, ...); | ||
699 | * | ||
700 | * This is not really a variadic function in the classic C-way and care must | ||
701 | * be taken when calling this to ensure parameters are passed in registers | ||
702 | * only, since the stack will change between the caller and the callee. | ||
703 | * | ||
704 | * Call the function with the first argument containing a pointer to the | ||
705 | * function you wish to call in Hyp mode, and subsequent arguments will be | ||
706 | * passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the | ||
707 | * function pointer can be passed). The function being called must be mapped | ||
708 | * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are | ||
709 | * passed in r0 and r1. | ||
710 | * | ||
711 | * A function pointer with a value of 0 has a special meaning, and is | ||
712 | * used to implement __hyp_get_vectors in the same way as in | ||
713 | * arch/arm64/kernel/hyp_stub.S. | ||
714 | */ | ||
697 | ENTRY(kvm_call_hyp) | 715 | ENTRY(kvm_call_hyp) |
698 | hvc #0 | 716 | hvc #0 |
699 | ret | 717 | ret |
@@ -737,7 +755,12 @@ el1_sync: // Guest trapped into EL2 | |||
737 | pop x2, x3 | 755 | pop x2, x3 |
738 | pop x0, x1 | 756 | pop x0, x1 |
739 | 757 | ||
740 | push lr, xzr | 758 | /* Check for __hyp_get_vectors */ |
759 | cbnz x0, 1f | ||
760 | mrs x0, vbar_el2 | ||
761 | b 2f | ||
762 | |||
763 | 1: push lr, xzr | ||
741 | 764 | ||
742 | /* | 765 | /* |
743 | * Compute the function address in EL2, and shuffle the parameters. | 766 | * Compute the function address in EL2, and shuffle the parameters. |
@@ -750,7 +773,7 @@ el1_sync: // Guest trapped into EL2 | |||
750 | blr lr | 773 | blr lr |
751 | 774 | ||
752 | pop lr, xzr | 775 | pop lr, xzr |
753 | eret | 776 | 2: eret |
754 | 777 | ||
755 | el1_trap: | 778 | el1_trap: |
756 | /* | 779 | /* |
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 7cc8c364924d..6fb9e813a910 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -1,4 +1,4 @@ | |||
1 | 1 | generic-y += barrier.h | |
2 | generic-y += bitsperlong.h | 2 | generic-y += bitsperlong.h |
3 | generic-y += clkdev.h | 3 | generic-y += clkdev.h |
4 | generic-y += cputime.h | 4 | generic-y += cputime.h |
@@ -6,6 +6,7 @@ generic-y += device.h | |||
6 | generic-y += emergency-restart.h | 6 | generic-y += emergency-restart.h |
7 | generic-y += errno.h | 7 | generic-y += errno.h |
8 | generic-y += exec.h | 8 | generic-y += exec.h |
9 | generic-y += hash.h | ||
9 | generic-y += hw_irq.h | 10 | generic-y += hw_irq.h |
10 | generic-y += ioctl.h | 11 | generic-y += ioctl.h |
11 | generic-y += ipcbuf.h | 12 | generic-y += ipcbuf.h |
@@ -18,6 +19,7 @@ generic-y += local.h | |||
18 | generic-y += mman.h | 19 | generic-y += mman.h |
19 | generic-y += mutex.h | 20 | generic-y += mutex.h |
20 | generic-y += percpu.h | 21 | generic-y += percpu.h |
22 | generic-y += preempt.h | ||
21 | generic-y += resource.h | 23 | generic-y += resource.h |
22 | generic-y += scatterlist.h | 24 | generic-y += scatterlist.h |
23 | generic-y += sections.h | 25 | generic-y += sections.h |
@@ -31,5 +33,3 @@ generic-y += trace_clock.h | |||
31 | generic-y += types.h | 33 | generic-y += types.h |
32 | generic-y += word-at-a-time.h | 34 | generic-y += word-at-a-time.h |
33 | generic-y += xor.h | 35 | generic-y += xor.h |
34 | generic-y += preempt.h | ||
35 | generic-y += hash.h | ||
diff --git a/arch/m68k/include/asm/barrier.h b/arch/m68k/include/asm/barrier.h deleted file mode 100644 index 15c5f77c1614..000000000000 --- a/arch/m68k/include/asm/barrier.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #ifndef _M68K_BARRIER_H | ||
2 | #define _M68K_BARRIER_H | ||
3 | |||
4 | #define nop() do { asm volatile ("nop"); barrier(); } while (0) | ||
5 | |||
6 | #include <asm-generic/barrier.h> | ||
7 | |||
8 | #endif /* _M68K_BARRIER_H */ | ||
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 014f288fc813..9d38b73989eb 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
5 | 5 | ||
6 | 6 | ||
7 | #define NR_syscalls 349 | 7 | #define NR_syscalls 351 |
8 | 8 | ||
9 | #define __ARCH_WANT_OLD_READDIR | 9 | #define __ARCH_WANT_OLD_READDIR |
10 | #define __ARCH_WANT_OLD_STAT | 10 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index 625f321001dc..b932dd470041 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
@@ -354,5 +354,7 @@ | |||
354 | #define __NR_process_vm_writev 346 | 354 | #define __NR_process_vm_writev 346 |
355 | #define __NR_kcmp 347 | 355 | #define __NR_kcmp 347 |
356 | #define __NR_finit_module 348 | 356 | #define __NR_finit_module 348 |
357 | #define __NR_sched_setattr 349 | ||
358 | #define __NR_sched_getattr 350 | ||
357 | 359 | ||
358 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | 360 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 3f04ea0ab802..b6223dc41d82 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -369,4 +369,6 @@ ENTRY(sys_call_table) | |||
369 | .long sys_process_vm_writev | 369 | .long sys_process_vm_writev |
370 | .long sys_kcmp | 370 | .long sys_kcmp |
371 | .long sys_finit_module | 371 | .long sys_finit_module |
372 | .long sys_sched_setattr | ||
373 | .long sys_sched_getattr /* 350 */ | ||
372 | 374 | ||
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index 84fdf6857c31..a613d2c82fd9 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h | |||
@@ -200,10 +200,11 @@ static inline void __user *arch_compat_alloc_user_space(long len) | |||
200 | 200 | ||
201 | /* | 201 | /* |
202 | * We can't access below the stack pointer in the 32bit ABI and | 202 | * We can't access below the stack pointer in the 32bit ABI and |
203 | * can access 288 bytes in the 64bit ABI | 203 | * can access 288 bytes in the 64bit big-endian ABI, |
204 | * or 512 bytes with the new ELFv2 little-endian ABI. | ||
204 | */ | 205 | */ |
205 | if (!is_32bit_task()) | 206 | if (!is_32bit_task()) |
206 | usp -= 288; | 207 | usp -= USER_REDZONE_SIZE; |
207 | 208 | ||
208 | return (void __user *) (usp - len); | 209 | return (void __user *) (usp - len); |
209 | } | 210 | } |
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 40157e2ca691..ed82142a3251 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -816,8 +816,8 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, | |||
816 | int64_t opal_pci_poll(uint64_t phb_id); | 816 | int64_t opal_pci_poll(uint64_t phb_id); |
817 | int64_t opal_return_cpu(void); | 817 | int64_t opal_return_cpu(void); |
818 | 818 | ||
819 | int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, __be64 *val); | 819 | int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val); |
820 | int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val); | 820 | int64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val); |
821 | 821 | ||
822 | int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, | 822 | int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, |
823 | uint32_t addr, uint32_t data, uint32_t sz); | 823 | uint32_t addr, uint32_t data, uint32_t sz); |
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h index becc08e6a65c..279b80f3bb29 100644 --- a/arch/powerpc/include/asm/ptrace.h +++ b/arch/powerpc/include/asm/ptrace.h | |||
@@ -28,11 +28,23 @@ | |||
28 | 28 | ||
29 | #ifdef __powerpc64__ | 29 | #ifdef __powerpc64__ |
30 | 30 | ||
31 | /* | ||
32 | * Size of redzone that userspace is allowed to use below the stack | ||
33 | * pointer. This is 288 in the 64-bit big-endian ELF ABI, and 512 in | ||
34 | * the new ELFv2 little-endian ABI, so we allow the larger amount. | ||
35 | * | ||
36 | * For kernel code we allow a 288-byte redzone, in order to conserve | ||
37 | * kernel stack space; gcc currently only uses 288 bytes, and will | ||
38 | * hopefully allow explicit control of the redzone size in future. | ||
39 | */ | ||
40 | #define USER_REDZONE_SIZE 512 | ||
41 | #define KERNEL_REDZONE_SIZE 288 | ||
42 | |||
31 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ | 43 | #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ |
32 | #define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */ | 44 | #define STACK_FRAME_LR_SAVE 2 /* Location of LR in stack frame */ |
33 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265) | 45 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x7265677368657265) |
34 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \ | 46 | #define STACK_INT_FRAME_SIZE (sizeof(struct pt_regs) + \ |
35 | STACK_FRAME_OVERHEAD + 288) | 47 | STACK_FRAME_OVERHEAD + KERNEL_REDZONE_SIZE) |
36 | #define STACK_FRAME_MARKER 12 | 48 | #define STACK_FRAME_MARKER 12 |
37 | 49 | ||
38 | /* Size of dummy stack frame allocated when calling signal handler. */ | 50 | /* Size of dummy stack frame allocated when calling signal handler. */ |
@@ -41,6 +53,8 @@ | |||
41 | 53 | ||
42 | #else /* __powerpc64__ */ | 54 | #else /* __powerpc64__ */ |
43 | 55 | ||
56 | #define USER_REDZONE_SIZE 0 | ||
57 | #define KERNEL_REDZONE_SIZE 0 | ||
44 | #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ | 58 | #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */ |
45 | #define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */ | 59 | #define STACK_FRAME_LR_SAVE 1 /* Location of LR in stack frame */ |
46 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) | 60 | #define STACK_FRAME_REGS_MARKER ASM_CONST(0x72656773) |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 11c1d069d920..7a13f378ca2c 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -98,17 +98,19 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | |||
98 | size_t csize, unsigned long offset, int userbuf) | 98 | size_t csize, unsigned long offset, int userbuf) |
99 | { | 99 | { |
100 | void *vaddr; | 100 | void *vaddr; |
101 | phys_addr_t paddr; | ||
101 | 102 | ||
102 | if (!csize) | 103 | if (!csize) |
103 | return 0; | 104 | return 0; |
104 | 105 | ||
105 | csize = min_t(size_t, csize, PAGE_SIZE); | 106 | csize = min_t(size_t, csize, PAGE_SIZE); |
107 | paddr = pfn << PAGE_SHIFT; | ||
106 | 108 | ||
107 | if ((min_low_pfn < pfn) && (pfn < max_pfn)) { | 109 | if (memblock_is_region_memory(paddr, csize)) { |
108 | vaddr = __va(pfn << PAGE_SHIFT); | 110 | vaddr = __va(paddr); |
109 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); | 111 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); |
110 | } else { | 112 | } else { |
111 | vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0); | 113 | vaddr = __ioremap(paddr, PAGE_SIZE, 0); |
112 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); | 114 | csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); |
113 | iounmap(vaddr); | 115 | iounmap(vaddr); |
114 | } | 116 | } |
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c index 9b27b293a922..b0ded97ee4e1 100644 --- a/arch/powerpc/kernel/ftrace.c +++ b/arch/powerpc/kernel/ftrace.c | |||
@@ -74,6 +74,7 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new) | |||
74 | */ | 74 | */ |
75 | static int test_24bit_addr(unsigned long ip, unsigned long addr) | 75 | static int test_24bit_addr(unsigned long ip, unsigned long addr) |
76 | { | 76 | { |
77 | addr = ppc_function_entry((void *)addr); | ||
77 | 78 | ||
78 | /* use the create_branch to verify that this offset can be branched */ | 79 | /* use the create_branch to verify that this offset can be branched */ |
79 | return create_branch((unsigned int *)ip, addr, 0); | 80 | return create_branch((unsigned int *)ip, addr, 0); |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index e35bf773df7a..8d253c29649b 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -65,8 +65,8 @@ struct rt_sigframe { | |||
65 | struct siginfo __user *pinfo; | 65 | struct siginfo __user *pinfo; |
66 | void __user *puc; | 66 | void __user *puc; |
67 | struct siginfo info; | 67 | struct siginfo info; |
68 | /* 64 bit ABI allows for 288 bytes below sp before decrementing it. */ | 68 | /* New 64 bit little-endian ABI allows redzone of 512 bytes below sp */ |
69 | char abigap[288]; | 69 | char abigap[USER_REDZONE_SIZE]; |
70 | } __attribute__ ((aligned (16))); | 70 | } __attribute__ ((aligned (16))); |
71 | 71 | ||
72 | static const char fmt32[] = KERN_INFO \ | 72 | static const char fmt32[] = KERN_INFO \ |
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c index f51474336460..253fefe3d1a0 100644 --- a/arch/powerpc/platforms/powernv/eeh-ioda.c +++ b/arch/powerpc/platforms/powernv/eeh-ioda.c | |||
@@ -114,6 +114,7 @@ DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get, | |||
114 | ioda_eeh_inbB_dbgfs_set, "0x%llx\n"); | 114 | ioda_eeh_inbB_dbgfs_set, "0x%llx\n"); |
115 | #endif /* CONFIG_DEBUG_FS */ | 115 | #endif /* CONFIG_DEBUG_FS */ |
116 | 116 | ||
117 | |||
117 | /** | 118 | /** |
118 | * ioda_eeh_post_init - Chip dependent post initialization | 119 | * ioda_eeh_post_init - Chip dependent post initialization |
119 | * @hose: PCI controller | 120 | * @hose: PCI controller |
@@ -221,6 +222,22 @@ static int ioda_eeh_set_option(struct eeh_pe *pe, int option) | |||
221 | return ret; | 222 | return ret; |
222 | } | 223 | } |
223 | 224 | ||
225 | static void ioda_eeh_phb_diag(struct pci_controller *hose) | ||
226 | { | ||
227 | struct pnv_phb *phb = hose->private_data; | ||
228 | long rc; | ||
229 | |||
230 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, | ||
231 | PNV_PCI_DIAG_BUF_SIZE); | ||
232 | if (rc != OPAL_SUCCESS) { | ||
233 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", | ||
234 | __func__, hose->global_number, rc); | ||
235 | return; | ||
236 | } | ||
237 | |||
238 | pnv_pci_dump_phb_diag_data(hose, phb->diag.blob); | ||
239 | } | ||
240 | |||
224 | /** | 241 | /** |
225 | * ioda_eeh_get_state - Retrieve the state of PE | 242 | * ioda_eeh_get_state - Retrieve the state of PE |
226 | * @pe: EEH PE | 243 | * @pe: EEH PE |
@@ -272,6 +289,9 @@ static int ioda_eeh_get_state(struct eeh_pe *pe) | |||
272 | result |= EEH_STATE_DMA_ACTIVE; | 289 | result |= EEH_STATE_DMA_ACTIVE; |
273 | result |= EEH_STATE_MMIO_ENABLED; | 290 | result |= EEH_STATE_MMIO_ENABLED; |
274 | result |= EEH_STATE_DMA_ENABLED; | 291 | result |= EEH_STATE_DMA_ENABLED; |
292 | } else if (!(pe->state & EEH_PE_ISOLATED)) { | ||
293 | eeh_pe_state_mark(pe, EEH_PE_ISOLATED); | ||
294 | ioda_eeh_phb_diag(hose); | ||
275 | } | 295 | } |
276 | 296 | ||
277 | return result; | 297 | return result; |
@@ -315,6 +335,15 @@ static int ioda_eeh_get_state(struct eeh_pe *pe) | |||
315 | __func__, fstate, hose->global_number, pe_no); | 335 | __func__, fstate, hose->global_number, pe_no); |
316 | } | 336 | } |
317 | 337 | ||
338 | /* Dump PHB diag-data for frozen PE */ | ||
339 | if (result != EEH_STATE_NOT_SUPPORT && | ||
340 | (result & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) != | ||
341 | (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE) && | ||
342 | !(pe->state & EEH_PE_ISOLATED)) { | ||
343 | eeh_pe_state_mark(pe, EEH_PE_ISOLATED); | ||
344 | ioda_eeh_phb_diag(hose); | ||
345 | } | ||
346 | |||
318 | return result; | 347 | return result; |
319 | } | 348 | } |
320 | 349 | ||
@@ -530,42 +559,6 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option) | |||
530 | } | 559 | } |
531 | 560 | ||
532 | /** | 561 | /** |
533 | * ioda_eeh_get_log - Retrieve error log | ||
534 | * @pe: EEH PE | ||
535 | * @severity: Severity level of the log | ||
536 | * @drv_log: buffer to store the log | ||
537 | * @len: space of the log buffer | ||
538 | * | ||
539 | * The function is used to retrieve error log from P7IOC. | ||
540 | */ | ||
541 | static int ioda_eeh_get_log(struct eeh_pe *pe, int severity, | ||
542 | char *drv_log, unsigned long len) | ||
543 | { | ||
544 | s64 ret; | ||
545 | unsigned long flags; | ||
546 | struct pci_controller *hose = pe->phb; | ||
547 | struct pnv_phb *phb = hose->private_data; | ||
548 | |||
549 | spin_lock_irqsave(&phb->lock, flags); | ||
550 | |||
551 | ret = opal_pci_get_phb_diag_data2(phb->opal_id, | ||
552 | phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE); | ||
553 | if (ret) { | ||
554 | spin_unlock_irqrestore(&phb->lock, flags); | ||
555 | pr_warning("%s: Can't get log for PHB#%x-PE#%x (%lld)\n", | ||
556 | __func__, hose->global_number, pe->addr, ret); | ||
557 | return -EIO; | ||
558 | } | ||
559 | |||
560 | /* The PHB diag-data is always indicative */ | ||
561 | pnv_pci_dump_phb_diag_data(hose, phb->diag.blob); | ||
562 | |||
563 | spin_unlock_irqrestore(&phb->lock, flags); | ||
564 | |||
565 | return 0; | ||
566 | } | ||
567 | |||
568 | /** | ||
569 | * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE | 562 | * ioda_eeh_configure_bridge - Configure the PCI bridges for the indicated PE |
570 | * @pe: EEH PE | 563 | * @pe: EEH PE |
571 | * | 564 | * |
@@ -646,22 +639,6 @@ static void ioda_eeh_hub_diag(struct pci_controller *hose) | |||
646 | } | 639 | } |
647 | } | 640 | } |
648 | 641 | ||
649 | static void ioda_eeh_phb_diag(struct pci_controller *hose) | ||
650 | { | ||
651 | struct pnv_phb *phb = hose->private_data; | ||
652 | long rc; | ||
653 | |||
654 | rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob, | ||
655 | PNV_PCI_DIAG_BUF_SIZE); | ||
656 | if (rc != OPAL_SUCCESS) { | ||
657 | pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", | ||
658 | __func__, hose->global_number, rc); | ||
659 | return; | ||
660 | } | ||
661 | |||
662 | pnv_pci_dump_phb_diag_data(hose, phb->diag.blob); | ||
663 | } | ||
664 | |||
665 | static int ioda_eeh_get_phb_pe(struct pci_controller *hose, | 642 | static int ioda_eeh_get_phb_pe(struct pci_controller *hose, |
666 | struct eeh_pe **pe) | 643 | struct eeh_pe **pe) |
667 | { | 644 | { |
@@ -835,6 +812,20 @@ static int ioda_eeh_next_error(struct eeh_pe **pe) | |||
835 | } | 812 | } |
836 | 813 | ||
837 | /* | 814 | /* |
815 | * EEH core will try recover from fenced PHB or | ||
816 | * frozen PE. In the time for frozen PE, EEH core | ||
817 | * enable IO path for that before collecting logs, | ||
818 | * but it ruins the site. So we have to dump the | ||
819 | * log in advance here. | ||
820 | */ | ||
821 | if ((ret == EEH_NEXT_ERR_FROZEN_PE || | ||
822 | ret == EEH_NEXT_ERR_FENCED_PHB) && | ||
823 | !((*pe)->state & EEH_PE_ISOLATED)) { | ||
824 | eeh_pe_state_mark(*pe, EEH_PE_ISOLATED); | ||
825 | ioda_eeh_phb_diag(hose); | ||
826 | } | ||
827 | |||
828 | /* | ||
838 | * If we have no errors on the specific PHB or only | 829 | * If we have no errors on the specific PHB or only |
839 | * informative error there, we continue poking it. | 830 | * informative error there, we continue poking it. |
840 | * Otherwise, we need actions to be taken by upper | 831 | * Otherwise, we need actions to be taken by upper |
@@ -852,7 +843,6 @@ struct pnv_eeh_ops ioda_eeh_ops = { | |||
852 | .set_option = ioda_eeh_set_option, | 843 | .set_option = ioda_eeh_set_option, |
853 | .get_state = ioda_eeh_get_state, | 844 | .get_state = ioda_eeh_get_state, |
854 | .reset = ioda_eeh_reset, | 845 | .reset = ioda_eeh_reset, |
855 | .get_log = ioda_eeh_get_log, | ||
856 | .configure_bridge = ioda_eeh_configure_bridge, | 846 | .configure_bridge = ioda_eeh_configure_bridge, |
857 | .next_error = ioda_eeh_next_error | 847 | .next_error = ioda_eeh_next_error |
858 | }; | 848 | }; |
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c index 4fbf276ac99e..4cd2ea6c0dbe 100644 --- a/arch/powerpc/platforms/powernv/opal-xscom.c +++ b/arch/powerpc/platforms/powernv/opal-xscom.c | |||
@@ -71,11 +71,11 @@ static int opal_xscom_err_xlate(int64_t rc) | |||
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | static u64 opal_scom_unmangle(u64 reg) | 74 | static u64 opal_scom_unmangle(u64 addr) |
75 | { | 75 | { |
76 | /* | 76 | /* |
77 | * XSCOM indirect addresses have the top bit set. Additionally | 77 | * XSCOM indirect addresses have the top bit set. Additionally |
78 | * the reset of the top 3 nibbles is always 0. | 78 | * the rest of the top 3 nibbles is always 0. |
79 | * | 79 | * |
80 | * Because the debugfs interface uses signed offsets and shifts | 80 | * Because the debugfs interface uses signed offsets and shifts |
81 | * the address left by 3, we basically cannot use the top 4 bits | 81 | * the address left by 3, we basically cannot use the top 4 bits |
@@ -86,10 +86,13 @@ static u64 opal_scom_unmangle(u64 reg) | |||
86 | * conversion here. To leave room for further xscom address | 86 | * conversion here. To leave room for further xscom address |
87 | * expansion, we only clear out the top byte | 87 | * expansion, we only clear out the top byte |
88 | * | 88 | * |
89 | * For in-kernel use, we also support the real indirect bit, so | ||
90 | * we test for any of the top 5 bits | ||
91 | * | ||
89 | */ | 92 | */ |
90 | if (reg & (1ull << 59)) | 93 | if (addr & (0x1full << 59)) |
91 | reg = (reg & ~(0xffull << 56)) | (1ull << 63); | 94 | addr = (addr & ~(0xffull << 56)) | (1ull << 63); |
92 | return reg; | 95 | return addr; |
93 | } | 96 | } |
94 | 97 | ||
95 | static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) | 98 | static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) |
@@ -98,8 +101,8 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value) | |||
98 | int64_t rc; | 101 | int64_t rc; |
99 | __be64 v; | 102 | __be64 v; |
100 | 103 | ||
101 | reg = opal_scom_unmangle(reg); | 104 | reg = opal_scom_unmangle(m->addr + reg); |
102 | rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v)); | 105 | rc = opal_xscom_read(m->chip, reg, (__be64 *)__pa(&v)); |
103 | *value = be64_to_cpu(v); | 106 | *value = be64_to_cpu(v); |
104 | return opal_xscom_err_xlate(rc); | 107 | return opal_xscom_err_xlate(rc); |
105 | } | 108 | } |
@@ -109,8 +112,8 @@ static int opal_scom_write(scom_map_t map, u64 reg, u64 value) | |||
109 | struct opal_scom_map *m = map; | 112 | struct opal_scom_map *m = map; |
110 | int64_t rc; | 113 | int64_t rc; |
111 | 114 | ||
112 | reg = opal_scom_unmangle(reg); | 115 | reg = opal_scom_unmangle(m->addr + reg); |
113 | rc = opal_xscom_write(m->chip, m->addr + reg, value); | 116 | rc = opal_xscom_write(m->chip, reg, value); |
114 | return opal_xscom_err_xlate(rc); | 117 | return opal_xscom_err_xlate(rc); |
115 | } | 118 | } |
116 | 119 | ||
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 95633d79ef5d..8518817dcdfd 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -134,57 +134,72 @@ static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose, | |||
134 | pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n\n", | 134 | pr_info("P7IOC PHB#%d Diag-data (Version: %d)\n\n", |
135 | hose->global_number, common->version); | 135 | hose->global_number, common->version); |
136 | 136 | ||
137 | pr_info(" brdgCtl: %08x\n", data->brdgCtl); | 137 | if (data->brdgCtl) |
138 | 138 | pr_info(" brdgCtl: %08x\n", | |
139 | pr_info(" portStatusReg: %08x\n", data->portStatusReg); | 139 | data->brdgCtl); |
140 | pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus); | 140 | if (data->portStatusReg || data->rootCmplxStatus || |
141 | pr_info(" busAgentStatus: %08x\n", data->busAgentStatus); | 141 | data->busAgentStatus) |
142 | 142 | pr_info(" UtlSts: %08x %08x %08x\n", | |
143 | pr_info(" deviceStatus: %08x\n", data->deviceStatus); | 143 | data->portStatusReg, data->rootCmplxStatus, |
144 | pr_info(" slotStatus: %08x\n", data->slotStatus); | 144 | data->busAgentStatus); |
145 | pr_info(" linkStatus: %08x\n", data->linkStatus); | 145 | if (data->deviceStatus || data->slotStatus || |
146 | pr_info(" devCmdStatus: %08x\n", data->devCmdStatus); | 146 | data->linkStatus || data->devCmdStatus || |
147 | pr_info(" devSecStatus: %08x\n", data->devSecStatus); | 147 | data->devSecStatus) |
148 | 148 | pr_info(" RootSts: %08x %08x %08x %08x %08x\n", | |
149 | pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus); | 149 | data->deviceStatus, data->slotStatus, |
150 | pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus); | 150 | data->linkStatus, data->devCmdStatus, |
151 | pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus); | 151 | data->devSecStatus); |
152 | pr_info(" tlpHdr1: %08x\n", data->tlpHdr1); | 152 | if (data->rootErrorStatus || data->uncorrErrorStatus || |
153 | pr_info(" tlpHdr2: %08x\n", data->tlpHdr2); | 153 | data->corrErrorStatus) |
154 | pr_info(" tlpHdr3: %08x\n", data->tlpHdr3); | 154 | pr_info(" RootErrSts: %08x %08x %08x\n", |
155 | pr_info(" tlpHdr4: %08x\n", data->tlpHdr4); | 155 | data->rootErrorStatus, data->uncorrErrorStatus, |
156 | pr_info(" sourceId: %08x\n", data->sourceId); | 156 | data->corrErrorStatus); |
157 | pr_info(" errorClass: %016llx\n", data->errorClass); | 157 | if (data->tlpHdr1 || data->tlpHdr2 || |
158 | pr_info(" correlator: %016llx\n", data->correlator); | 158 | data->tlpHdr3 || data->tlpHdr4) |
159 | pr_info(" p7iocPlssr: %016llx\n", data->p7iocPlssr); | 159 | pr_info(" RootErrLog: %08x %08x %08x %08x\n", |
160 | pr_info(" p7iocCsr: %016llx\n", data->p7iocCsr); | 160 | data->tlpHdr1, data->tlpHdr2, |
161 | pr_info(" lemFir: %016llx\n", data->lemFir); | 161 | data->tlpHdr3, data->tlpHdr4); |
162 | pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask); | 162 | if (data->sourceId || data->errorClass || |
163 | pr_info(" lemWOF: %016llx\n", data->lemWOF); | 163 | data->correlator) |
164 | pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus); | 164 | pr_info(" RootErrLog1: %08x %016llx %016llx\n", |
165 | pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus); | 165 | data->sourceId, data->errorClass, |
166 | pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0); | 166 | data->correlator); |
167 | pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1); | 167 | if (data->p7iocPlssr || data->p7iocCsr) |
168 | pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus); | 168 | pr_info(" PhbSts: %016llx %016llx\n", |
169 | pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus); | 169 | data->p7iocPlssr, data->p7iocCsr); |
170 | pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0); | 170 | if (data->lemFir || data->lemErrorMask || |
171 | pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1); | 171 | data->lemWOF) |
172 | pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus); | 172 | pr_info(" Lem: %016llx %016llx %016llx\n", |
173 | pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus); | 173 | data->lemFir, data->lemErrorMask, |
174 | pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0); | 174 | data->lemWOF); |
175 | pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1); | 175 | if (data->phbErrorStatus || data->phbFirstErrorStatus || |
176 | pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus); | 176 | data->phbErrorLog0 || data->phbErrorLog1) |
177 | pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus); | 177 | pr_info(" PhbErr: %016llx %016llx %016llx %016llx\n", |
178 | pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0); | 178 | data->phbErrorStatus, data->phbFirstErrorStatus, |
179 | pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1); | 179 | data->phbErrorLog0, data->phbErrorLog1); |
180 | if (data->mmioErrorStatus || data->mmioFirstErrorStatus || | ||
181 | data->mmioErrorLog0 || data->mmioErrorLog1) | ||
182 | pr_info(" OutErr: %016llx %016llx %016llx %016llx\n", | ||
183 | data->mmioErrorStatus, data->mmioFirstErrorStatus, | ||
184 | data->mmioErrorLog0, data->mmioErrorLog1); | ||
185 | if (data->dma0ErrorStatus || data->dma0FirstErrorStatus || | ||
186 | data->dma0ErrorLog0 || data->dma0ErrorLog1) | ||
187 | pr_info(" InAErr: %016llx %016llx %016llx %016llx\n", | ||
188 | data->dma0ErrorStatus, data->dma0FirstErrorStatus, | ||
189 | data->dma0ErrorLog0, data->dma0ErrorLog1); | ||
190 | if (data->dma1ErrorStatus || data->dma1FirstErrorStatus || | ||
191 | data->dma1ErrorLog0 || data->dma1ErrorLog1) | ||
192 | pr_info(" InBErr: %016llx %016llx %016llx %016llx\n", | ||
193 | data->dma1ErrorStatus, data->dma1FirstErrorStatus, | ||
194 | data->dma1ErrorLog0, data->dma1ErrorLog1); | ||
180 | 195 | ||
181 | for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { | 196 | for (i = 0; i < OPAL_P7IOC_NUM_PEST_REGS; i++) { |
182 | if ((data->pestA[i] >> 63) == 0 && | 197 | if ((data->pestA[i] >> 63) == 0 && |
183 | (data->pestB[i] >> 63) == 0) | 198 | (data->pestB[i] >> 63) == 0) |
184 | continue; | 199 | continue; |
185 | 200 | ||
186 | pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]); | 201 | pr_info(" PE[%3d] A/B: %016llx %016llx\n", |
187 | pr_info(" PESTB: %016llx\n", data->pestB[i]); | 202 | i, data->pestA[i], data->pestB[i]); |
188 | } | 203 | } |
189 | } | 204 | } |
190 | 205 | ||
@@ -197,62 +212,77 @@ static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose, | |||
197 | data = (struct OpalIoPhb3ErrorData*)common; | 212 | data = (struct OpalIoPhb3ErrorData*)common; |
198 | pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n\n", | 213 | pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n\n", |
199 | hose->global_number, common->version); | 214 | hose->global_number, common->version); |
200 | 215 | if (data->brdgCtl) | |
201 | pr_info(" brdgCtl: %08x\n", data->brdgCtl); | 216 | pr_info(" brdgCtl: %08x\n", |
202 | 217 | data->brdgCtl); | |
203 | pr_info(" portStatusReg: %08x\n", data->portStatusReg); | 218 | if (data->portStatusReg || data->rootCmplxStatus || |
204 | pr_info(" rootCmplxStatus: %08x\n", data->rootCmplxStatus); | 219 | data->busAgentStatus) |
205 | pr_info(" busAgentStatus: %08x\n", data->busAgentStatus); | 220 | pr_info(" UtlSts: %08x %08x %08x\n", |
206 | 221 | data->portStatusReg, data->rootCmplxStatus, | |
207 | pr_info(" deviceStatus: %08x\n", data->deviceStatus); | 222 | data->busAgentStatus); |
208 | pr_info(" slotStatus: %08x\n", data->slotStatus); | 223 | if (data->deviceStatus || data->slotStatus || |
209 | pr_info(" linkStatus: %08x\n", data->linkStatus); | 224 | data->linkStatus || data->devCmdStatus || |
210 | pr_info(" devCmdStatus: %08x\n", data->devCmdStatus); | 225 | data->devSecStatus) |
211 | pr_info(" devSecStatus: %08x\n", data->devSecStatus); | 226 | pr_info(" RootSts: %08x %08x %08x %08x %08x\n", |
212 | 227 | data->deviceStatus, data->slotStatus, | |
213 | pr_info(" rootErrorStatus: %08x\n", data->rootErrorStatus); | 228 | data->linkStatus, data->devCmdStatus, |
214 | pr_info(" uncorrErrorStatus: %08x\n", data->uncorrErrorStatus); | 229 | data->devSecStatus); |
215 | pr_info(" corrErrorStatus: %08x\n", data->corrErrorStatus); | 230 | if (data->rootErrorStatus || data->uncorrErrorStatus || |
216 | pr_info(" tlpHdr1: %08x\n", data->tlpHdr1); | 231 | data->corrErrorStatus) |
217 | pr_info(" tlpHdr2: %08x\n", data->tlpHdr2); | 232 | pr_info(" RootErrSts: %08x %08x %08x\n", |
218 | pr_info(" tlpHdr3: %08x\n", data->tlpHdr3); | 233 | data->rootErrorStatus, data->uncorrErrorStatus, |
219 | pr_info(" tlpHdr4: %08x\n", data->tlpHdr4); | 234 | data->corrErrorStatus); |
220 | pr_info(" sourceId: %08x\n", data->sourceId); | 235 | if (data->tlpHdr1 || data->tlpHdr2 || |
221 | pr_info(" errorClass: %016llx\n", data->errorClass); | 236 | data->tlpHdr3 || data->tlpHdr4) |
222 | pr_info(" correlator: %016llx\n", data->correlator); | 237 | pr_info(" RootErrLog: %08x %08x %08x %08x\n", |
223 | 238 | data->tlpHdr1, data->tlpHdr2, | |
224 | pr_info(" nFir: %016llx\n", data->nFir); | 239 | data->tlpHdr3, data->tlpHdr4); |
225 | pr_info(" nFirMask: %016llx\n", data->nFirMask); | 240 | if (data->sourceId || data->errorClass || |
226 | pr_info(" nFirWOF: %016llx\n", data->nFirWOF); | 241 | data->correlator) |
227 | pr_info(" PhbPlssr: %016llx\n", data->phbPlssr); | 242 | pr_info(" RootErrLog1: %08x %016llx %016llx\n", |
228 | pr_info(" PhbCsr: %016llx\n", data->phbCsr); | 243 | data->sourceId, data->errorClass, |
229 | pr_info(" lemFir: %016llx\n", data->lemFir); | 244 | data->correlator); |
230 | pr_info(" lemErrorMask: %016llx\n", data->lemErrorMask); | 245 | if (data->nFir || data->nFirMask || |
231 | pr_info(" lemWOF: %016llx\n", data->lemWOF); | 246 | data->nFirWOF) |
232 | pr_info(" phbErrorStatus: %016llx\n", data->phbErrorStatus); | 247 | pr_info(" nFir: %016llx %016llx %016llx\n", |
233 | pr_info(" phbFirstErrorStatus: %016llx\n", data->phbFirstErrorStatus); | 248 | data->nFir, data->nFirMask, |
234 | pr_info(" phbErrorLog0: %016llx\n", data->phbErrorLog0); | 249 | data->nFirWOF); |
235 | pr_info(" phbErrorLog1: %016llx\n", data->phbErrorLog1); | 250 | if (data->phbPlssr || data->phbCsr) |
236 | pr_info(" mmioErrorStatus: %016llx\n", data->mmioErrorStatus); | 251 | pr_info(" PhbSts: %016llx %016llx\n", |
237 | pr_info(" mmioFirstErrorStatus: %016llx\n", data->mmioFirstErrorStatus); | 252 | data->phbPlssr, data->phbCsr); |
238 | pr_info(" mmioErrorLog0: %016llx\n", data->mmioErrorLog0); | 253 | if (data->lemFir || data->lemErrorMask || |
239 | pr_info(" mmioErrorLog1: %016llx\n", data->mmioErrorLog1); | 254 | data->lemWOF) |
240 | pr_info(" dma0ErrorStatus: %016llx\n", data->dma0ErrorStatus); | 255 | pr_info(" Lem: %016llx %016llx %016llx\n", |
241 | pr_info(" dma0FirstErrorStatus: %016llx\n", data->dma0FirstErrorStatus); | 256 | data->lemFir, data->lemErrorMask, |
242 | pr_info(" dma0ErrorLog0: %016llx\n", data->dma0ErrorLog0); | 257 | data->lemWOF); |
243 | pr_info(" dma0ErrorLog1: %016llx\n", data->dma0ErrorLog1); | 258 | if (data->phbErrorStatus || data->phbFirstErrorStatus || |
244 | pr_info(" dma1ErrorStatus: %016llx\n", data->dma1ErrorStatus); | 259 | data->phbErrorLog0 || data->phbErrorLog1) |
245 | pr_info(" dma1FirstErrorStatus: %016llx\n", data->dma1FirstErrorStatus); | 260 | pr_info(" PhbErr: %016llx %016llx %016llx %016llx\n", |
246 | pr_info(" dma1ErrorLog0: %016llx\n", data->dma1ErrorLog0); | 261 | data->phbErrorStatus, data->phbFirstErrorStatus, |
247 | pr_info(" dma1ErrorLog1: %016llx\n", data->dma1ErrorLog1); | 262 | data->phbErrorLog0, data->phbErrorLog1); |
263 | if (data->mmioErrorStatus || data->mmioFirstErrorStatus || | ||
264 | data->mmioErrorLog0 || data->mmioErrorLog1) | ||
265 | pr_info(" OutErr: %016llx %016llx %016llx %016llx\n", | ||
266 | data->mmioErrorStatus, data->mmioFirstErrorStatus, | ||
267 | data->mmioErrorLog0, data->mmioErrorLog1); | ||
268 | if (data->dma0ErrorStatus || data->dma0FirstErrorStatus || | ||
269 | data->dma0ErrorLog0 || data->dma0ErrorLog1) | ||
270 | pr_info(" InAErr: %016llx %016llx %016llx %016llx\n", | ||
271 | data->dma0ErrorStatus, data->dma0FirstErrorStatus, | ||
272 | data->dma0ErrorLog0, data->dma0ErrorLog1); | ||
273 | if (data->dma1ErrorStatus || data->dma1FirstErrorStatus || | ||
274 | data->dma1ErrorLog0 || data->dma1ErrorLog1) | ||
275 | pr_info(" InBErr: %016llx %016llx %016llx %016llx\n", | ||
276 | data->dma1ErrorStatus, data->dma1FirstErrorStatus, | ||
277 | data->dma1ErrorLog0, data->dma1ErrorLog1); | ||
248 | 278 | ||
249 | for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { | 279 | for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { |
250 | if ((data->pestA[i] >> 63) == 0 && | 280 | if ((data->pestA[i] >> 63) == 0 && |
251 | (data->pestB[i] >> 63) == 0) | 281 | (data->pestB[i] >> 63) == 0) |
252 | continue; | 282 | continue; |
253 | 283 | ||
254 | pr_info(" PE[%3d] PESTA: %016llx\n", i, data->pestA[i]); | 284 | pr_info(" PE[%3d] A/B: %016llx %016llx\n", |
255 | pr_info(" PESTB: %016llx\n", data->pestB[i]); | 285 | i, data->pestA[i], data->pestB[i]); |
256 | } | 286 | } |
257 | } | 287 | } |
258 | 288 | ||
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index 82789e79e539..0ea99e3d4815 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
@@ -35,12 +35,7 @@ | |||
35 | #include "offline_states.h" | 35 | #include "offline_states.h" |
36 | 36 | ||
37 | /* This version can't take the spinlock, because it never returns */ | 37 | /* This version can't take the spinlock, because it never returns */ |
38 | static struct rtas_args rtas_stop_self_args = { | 38 | static int rtas_stop_self_token = RTAS_UNKNOWN_SERVICE; |
39 | .token = RTAS_UNKNOWN_SERVICE, | ||
40 | .nargs = 0, | ||
41 | .nret = 1, | ||
42 | .rets = &rtas_stop_self_args.args[0], | ||
43 | }; | ||
44 | 39 | ||
45 | static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = | 40 | static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) = |
46 | CPU_STATE_OFFLINE; | 41 | CPU_STATE_OFFLINE; |
@@ -93,15 +88,20 @@ void set_default_offline_state(int cpu) | |||
93 | 88 | ||
94 | static void rtas_stop_self(void) | 89 | static void rtas_stop_self(void) |
95 | { | 90 | { |
96 | struct rtas_args *args = &rtas_stop_self_args; | 91 | struct rtas_args args = { |
92 | .token = cpu_to_be32(rtas_stop_self_token), | ||
93 | .nargs = 0, | ||
94 | .nret = 1, | ||
95 | .rets = &args.args[0], | ||
96 | }; | ||
97 | 97 | ||
98 | local_irq_disable(); | 98 | local_irq_disable(); |
99 | 99 | ||
100 | BUG_ON(args->token == RTAS_UNKNOWN_SERVICE); | 100 | BUG_ON(rtas_stop_self_token == RTAS_UNKNOWN_SERVICE); |
101 | 101 | ||
102 | printk("cpu %u (hwid %u) Ready to die...\n", | 102 | printk("cpu %u (hwid %u) Ready to die...\n", |
103 | smp_processor_id(), hard_smp_processor_id()); | 103 | smp_processor_id(), hard_smp_processor_id()); |
104 | enter_rtas(__pa(args)); | 104 | enter_rtas(__pa(&args)); |
105 | 105 | ||
106 | panic("Alas, I survived.\n"); | 106 | panic("Alas, I survived.\n"); |
107 | } | 107 | } |
@@ -392,10 +392,10 @@ static int __init pseries_cpu_hotplug_init(void) | |||
392 | } | 392 | } |
393 | } | 393 | } |
394 | 394 | ||
395 | rtas_stop_self_args.token = rtas_token("stop-self"); | 395 | rtas_stop_self_token = rtas_token("stop-self"); |
396 | qcss_tok = rtas_token("query-cpu-stopped-state"); | 396 | qcss_tok = rtas_token("query-cpu-stopped-state"); |
397 | 397 | ||
398 | if (rtas_stop_self_args.token == RTAS_UNKNOWN_SERVICE || | 398 | if (rtas_stop_self_token == RTAS_UNKNOWN_SERVICE || |
399 | qcss_tok == RTAS_UNKNOWN_SERVICE) { | 399 | qcss_tok == RTAS_UNKNOWN_SERVICE) { |
400 | printk(KERN_INFO "CPU Hotplug not supported by firmware " | 400 | printk(KERN_INFO "CPU Hotplug not supported by firmware " |
401 | "- disabling.\n"); | 401 | "- disabling.\n"); |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 59c8efce1b99..0248949a756d 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1421,5 +1421,5 @@ ENTRY(sys_sched_setattr_wrapper) | |||
1421 | ENTRY(sys_sched_getattr_wrapper) | 1421 | ENTRY(sys_sched_getattr_wrapper) |
1422 | lgfr %r2,%r2 # pid_t | 1422 | lgfr %r2,%r2 # pid_t |
1423 | llgtr %r3,%r3 # const char __user * | 1423 | llgtr %r3,%r3 # const char __user * |
1424 | llgfr %r3,%r3 # unsigned int | 1424 | llgfr %r4,%r4 # unsigned int |
1425 | jg sys_sched_getattr | 1425 | jg sys_sched_getattr |
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c index 60c11a629d96..f91c03119804 100644 --- a/arch/s390/pci/pci_dma.c +++ b/arch/s390/pci/pci_dma.c | |||
@@ -206,11 +206,13 @@ static void dma_cleanup_tables(struct zpci_dev *zdev) | |||
206 | zdev->dma_table = NULL; | 206 | zdev->dma_table = NULL; |
207 | } | 207 | } |
208 | 208 | ||
209 | static unsigned long __dma_alloc_iommu(struct zpci_dev *zdev, unsigned long start, | 209 | static unsigned long __dma_alloc_iommu(struct zpci_dev *zdev, |
210 | int size) | 210 | unsigned long start, int size) |
211 | { | 211 | { |
212 | unsigned long boundary_size = 0x1000000; | 212 | unsigned long boundary_size; |
213 | 213 | ||
214 | boundary_size = ALIGN(dma_get_seg_boundary(&zdev->pdev->dev) + 1, | ||
215 | PAGE_SIZE) >> PAGE_SHIFT; | ||
214 | return iommu_area_alloc(zdev->iommu_bitmap, zdev->iommu_pages, | 216 | return iommu_area_alloc(zdev->iommu_bitmap, zdev->iommu_pages, |
215 | start, size, 0, boundary_size, 0); | 217 | start, size, 0, boundary_size, 0); |
216 | } | 218 | } |
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index 90a21f430117..4dbf967da50d 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c | |||
@@ -111,7 +111,7 @@ struct mem_vector { | |||
111 | }; | 111 | }; |
112 | 112 | ||
113 | #define MEM_AVOID_MAX 5 | 113 | #define MEM_AVOID_MAX 5 |
114 | struct mem_vector mem_avoid[MEM_AVOID_MAX]; | 114 | static struct mem_vector mem_avoid[MEM_AVOID_MAX]; |
115 | 115 | ||
116 | static bool mem_contains(struct mem_vector *region, struct mem_vector *item) | 116 | static bool mem_contains(struct mem_vector *region, struct mem_vector *item) |
117 | { | 117 | { |
@@ -180,7 +180,7 @@ static void mem_avoid_init(unsigned long input, unsigned long input_size, | |||
180 | } | 180 | } |
181 | 181 | ||
182 | /* Does this memory vector overlap a known avoided area? */ | 182 | /* Does this memory vector overlap a known avoided area? */ |
183 | bool mem_avoid_overlap(struct mem_vector *img) | 183 | static bool mem_avoid_overlap(struct mem_vector *img) |
184 | { | 184 | { |
185 | int i; | 185 | int i; |
186 | 186 | ||
@@ -192,8 +192,9 @@ bool mem_avoid_overlap(struct mem_vector *img) | |||
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | 194 | ||
195 | unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / CONFIG_PHYSICAL_ALIGN]; | 195 | static unsigned long slots[CONFIG_RANDOMIZE_BASE_MAX_OFFSET / |
196 | unsigned long slot_max = 0; | 196 | CONFIG_PHYSICAL_ALIGN]; |
197 | static unsigned long slot_max; | ||
197 | 198 | ||
198 | static void slots_append(unsigned long addr) | 199 | static void slots_append(unsigned long addr) |
199 | { | 200 | { |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 895604f2e916..79f9f848bee4 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1192,6 +1192,9 @@ static void x86_pmu_del(struct perf_event *event, int flags) | |||
1192 | for (i = 0; i < cpuc->n_events; i++) { | 1192 | for (i = 0; i < cpuc->n_events; i++) { |
1193 | if (event == cpuc->event_list[i]) { | 1193 | if (event == cpuc->event_list[i]) { |
1194 | 1194 | ||
1195 | if (i >= cpuc->n_events - cpuc->n_added) | ||
1196 | --cpuc->n_added; | ||
1197 | |||
1195 | if (x86_pmu.put_event_constraints) | 1198 | if (x86_pmu.put_event_constraints) |
1196 | x86_pmu.put_event_constraints(cpuc, event); | 1199 | x86_pmu.put_event_constraints(cpuc, event); |
1197 | 1200 | ||
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 4eabc160696f..679cef0791cd 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c | |||
@@ -279,5 +279,7 @@ void arch_crash_save_vmcoreinfo(void) | |||
279 | VMCOREINFO_SYMBOL(node_data); | 279 | VMCOREINFO_SYMBOL(node_data); |
280 | VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); | 280 | VMCOREINFO_LENGTH(node_data, MAX_NUMNODES); |
281 | #endif | 281 | #endif |
282 | vmcoreinfo_append_str("KERNELOFFSET=%lx\n", | ||
283 | (unsigned long)&_text - __START_KERNEL); | ||
282 | } | 284 | } |
283 | 285 | ||
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index e50425d0f5f7..9b531351a587 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2672,6 +2672,7 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write, | |||
2672 | break; | 2672 | break; |
2673 | } | 2673 | } |
2674 | 2674 | ||
2675 | drop_large_spte(vcpu, iterator.sptep); | ||
2675 | if (!is_shadow_present_pte(*iterator.sptep)) { | 2676 | if (!is_shadow_present_pte(*iterator.sptep)) { |
2676 | u64 base_addr = iterator.addr; | 2677 | u64 base_addr = iterator.addr; |
2677 | 2678 | ||
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a06f101ef64b..392752834751 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -6688,7 +6688,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) | |||
6688 | else if (is_page_fault(intr_info)) | 6688 | else if (is_page_fault(intr_info)) |
6689 | return enable_ept; | 6689 | return enable_ept; |
6690 | else if (is_no_device(intr_info) && | 6690 | else if (is_no_device(intr_info) && |
6691 | !(nested_read_cr0(vmcs12) & X86_CR0_TS)) | 6691 | !(vmcs12->guest_cr0 & X86_CR0_TS)) |
6692 | return 0; | 6692 | return 0; |
6693 | return vmcs12->exception_bitmap & | 6693 | return vmcs12->exception_bitmap & |
6694 | (1u << (intr_info & INTR_INFO_VECTOR_MASK)); | 6694 | (1u << (intr_info & INTR_INFO_VECTOR_MASK)); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 39c28f09dfd5..2b8578432d5b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6186,7 +6186,7 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) | |||
6186 | frag->len -= len; | 6186 | frag->len -= len; |
6187 | } | 6187 | } |
6188 | 6188 | ||
6189 | if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { | 6189 | if (vcpu->mmio_cur_fragment >= vcpu->mmio_nr_fragments) { |
6190 | vcpu->mmio_needed = 0; | 6190 | vcpu->mmio_needed = 0; |
6191 | 6191 | ||
6192 | /* FIXME: return into emulator if single-stepping. */ | 6192 | /* FIXME: return into emulator if single-stepping. */ |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index ba56e11cbf77..c87ae7c6e5f9 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -20,6 +20,7 @@ config XTENSA | |||
20 | select HAVE_FUNCTION_TRACER | 20 | select HAVE_FUNCTION_TRACER |
21 | select HAVE_IRQ_TIME_ACCOUNTING | 21 | select HAVE_IRQ_TIME_ACCOUNTING |
22 | select HAVE_PERF_EVENTS | 22 | select HAVE_PERF_EVENTS |
23 | select COMMON_CLK | ||
23 | help | 24 | help |
24 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 25 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
25 | primarily for embedded systems. These processors are both | 26 | primarily for embedded systems. These processors are both |
@@ -80,7 +81,6 @@ choice | |||
80 | config XTENSA_VARIANT_FSF | 81 | config XTENSA_VARIANT_FSF |
81 | bool "fsf - default (not generic) configuration" | 82 | bool "fsf - default (not generic) configuration" |
82 | select MMU | 83 | select MMU |
83 | select HAVE_XTENSA_GPIO32 | ||
84 | 84 | ||
85 | config XTENSA_VARIANT_DC232B | 85 | config XTENSA_VARIANT_DC232B |
86 | bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" | 86 | bool "dc232b - Diamond 232L Standard Core Rev.B (LE)" |
@@ -135,7 +135,6 @@ config HAVE_SMP | |||
135 | config SMP | 135 | config SMP |
136 | bool "Enable Symmetric multi-processing support" | 136 | bool "Enable Symmetric multi-processing support" |
137 | depends on HAVE_SMP | 137 | depends on HAVE_SMP |
138 | select USE_GENERIC_SMP_HELPERS | ||
139 | select GENERIC_SMP_IDLE_THREAD | 138 | select GENERIC_SMP_IDLE_THREAD |
140 | help | 139 | help |
141 | Enabled SMP Software; allows more than one CPU/CORE | 140 | Enabled SMP Software; allows more than one CPU/CORE |
diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi index 46b4f5eab421..e7370b11348e 100644 --- a/arch/xtensa/boot/dts/xtfpga.dtsi +++ b/arch/xtensa/boot/dts/xtfpga.dtsi | |||
@@ -35,6 +35,13 @@ | |||
35 | interrupt-controller; | 35 | interrupt-controller; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | clocks { | ||
39 | osc: main-oscillator { | ||
40 | #clock-cells = <0>; | ||
41 | compatible = "fixed-clock"; | ||
42 | }; | ||
43 | }; | ||
44 | |||
38 | serial0: serial@fd050020 { | 45 | serial0: serial@fd050020 { |
39 | device_type = "serial"; | 46 | device_type = "serial"; |
40 | compatible = "ns16550a"; | 47 | compatible = "ns16550a"; |
@@ -42,9 +49,7 @@ | |||
42 | reg = <0xfd050020 0x20>; | 49 | reg = <0xfd050020 0x20>; |
43 | reg-shift = <2>; | 50 | reg-shift = <2>; |
44 | interrupts = <0 1>; /* external irq 0 */ | 51 | interrupts = <0 1>; /* external irq 0 */ |
45 | /* Filled in by platform_setup from FPGA register | 52 | clocks = <&osc>; |
46 | * clock-frequency = <100000000>; | ||
47 | */ | ||
48 | }; | 53 | }; |
49 | 54 | ||
50 | enet0: ethoc@fd030000 { | 55 | enet0: ethoc@fd030000 { |
@@ -52,5 +57,6 @@ | |||
52 | reg = <0xfd030000 0x4000 0xfd800000 0x4000>; | 57 | reg = <0xfd030000 0x4000 0xfd800000 0x4000>; |
53 | interrupts = <1 1>; /* external irq 1 */ | 58 | interrupts = <1 1>; /* external irq 1 */ |
54 | local-mac-address = [00 50 c2 13 6f 00]; | 59 | local-mac-address = [00 50 c2 13 6f 00]; |
60 | clocks = <&osc>; | ||
55 | }; | 61 | }; |
56 | }; | 62 | }; |
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index 2a042d430c25..74944207167e 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #ifdef CONFIG_MMU | 26 | #ifdef CONFIG_MMU |
27 | 27 | ||
28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF | 28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) |
29 | extern unsigned long xtensa_kio_paddr; | 29 | extern unsigned long xtensa_kio_paddr; |
30 | 30 | ||
31 | static inline unsigned long xtensa_get_kio_paddr(void) | 31 | static inline unsigned long xtensa_get_kio_paddr(void) |
diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h index 8c194f6af45e..677bfcf4ee5d 100644 --- a/arch/xtensa/include/asm/traps.h +++ b/arch/xtensa/include/asm/traps.h | |||
@@ -23,25 +23,37 @@ void secondary_trap_init(void); | |||
23 | 23 | ||
24 | static inline void spill_registers(void) | 24 | static inline void spill_registers(void) |
25 | { | 25 | { |
26 | 26 | #if XCHAL_NUM_AREGS > 16 | |
27 | __asm__ __volatile__ ( | 27 | __asm__ __volatile__ ( |
28 | "movi a14, "__stringify((1 << PS_EXCM_BIT) | LOCKLEVEL)"\n\t" | 28 | " call12 1f\n" |
29 | "mov a12, a0\n\t" | 29 | " _j 2f\n" |
30 | "rsr a13, sar\n\t" | 30 | " retw\n" |
31 | "xsr a14, ps\n\t" | 31 | " .align 4\n" |
32 | "movi a0, _spill_registers\n\t" | 32 | "1:\n" |
33 | "rsync\n\t" | 33 | " _entry a1, 48\n" |
34 | "callx0 a0\n\t" | 34 | " addi a12, a0, 3\n" |
35 | "mov a0, a12\n\t" | 35 | #if XCHAL_NUM_AREGS > 32 |
36 | "wsr a13, sar\n\t" | 36 | " .rept (" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n" |
37 | "wsr a14, ps\n\t" | 37 | " _entry a1, 48\n" |
38 | : : | 38 | " mov a12, a0\n" |
39 | #if defined(CONFIG_FRAME_POINTER) | 39 | " .endr\n" |
40 | : "a2", "a3", "a4", "a11", "a12", "a13", "a14", "a15", | 40 | #endif |
41 | " _entry a1, 48\n" | ||
42 | #if XCHAL_NUM_AREGS % 12 == 0 | ||
43 | " mov a8, a8\n" | ||
44 | #elif XCHAL_NUM_AREGS % 12 == 4 | ||
45 | " mov a12, a12\n" | ||
46 | #elif XCHAL_NUM_AREGS % 12 == 8 | ||
47 | " mov a4, a4\n" | ||
48 | #endif | ||
49 | " retw\n" | ||
50 | "2:\n" | ||
51 | : : : "a12", "a13", "memory"); | ||
41 | #else | 52 | #else |
42 | : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15", | 53 | __asm__ __volatile__ ( |
54 | " mov a12, a12\n" | ||
55 | : : : "memory"); | ||
43 | #endif | 56 | #endif |
44 | "memory"); | ||
45 | } | 57 | } |
46 | 58 | ||
47 | #endif /* _XTENSA_TRAPS_H */ | 59 | #endif /* _XTENSA_TRAPS_H */ |
diff --git a/arch/xtensa/include/asm/vectors.h b/arch/xtensa/include/asm/vectors.h index 5791b45d5a5d..f74ddfbb92ef 100644 --- a/arch/xtensa/include/asm/vectors.h +++ b/arch/xtensa/include/asm/vectors.h | |||
@@ -25,7 +25,7 @@ | |||
25 | #define XCHAL_KIO_DEFAULT_PADDR 0xf0000000 | 25 | #define XCHAL_KIO_DEFAULT_PADDR 0xf0000000 |
26 | #define XCHAL_KIO_SIZE 0x10000000 | 26 | #define XCHAL_KIO_SIZE 0x10000000 |
27 | 27 | ||
28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF | 28 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) |
29 | #define XCHAL_KIO_PADDR xtensa_get_kio_paddr() | 29 | #define XCHAL_KIO_PADDR xtensa_get_kio_paddr() |
30 | #else | 30 | #else |
31 | #define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR | 31 | #define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR |
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index 51940fec6990..b9395529f02d 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -734,7 +734,12 @@ __SYSCALL(332, sys_finit_module, 3) | |||
734 | #define __NR_accept4 333 | 734 | #define __NR_accept4 333 |
735 | __SYSCALL(333, sys_accept4, 4) | 735 | __SYSCALL(333, sys_accept4, 4) |
736 | 736 | ||
737 | #define __NR_syscall_count 334 | 737 | #define __NR_sched_setattr 334 |
738 | __SYSCALL(334, sys_sched_setattr, 2) | ||
739 | #define __NR_sched_getattr 335 | ||
740 | __SYSCALL(335, sys_sched_getattr, 3) | ||
741 | |||
742 | #define __NR_syscall_count 336 | ||
738 | 743 | ||
739 | /* | 744 | /* |
740 | * sysxtensa syscall handler | 745 | * sysxtensa syscall handler |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 21dbe6bdb8ed..ef7f4990722b 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1081,196 +1081,53 @@ ENTRY(fast_syscall_spill_registers) | |||
1081 | 1081 | ||
1082 | rsr a0, sar | 1082 | rsr a0, sar |
1083 | s32i a3, a2, PT_AREG3 | 1083 | s32i a3, a2, PT_AREG3 |
1084 | s32i a4, a2, PT_AREG4 | 1084 | s32i a0, a2, PT_SAR |
1085 | s32i a0, a2, PT_AREG5 # store SAR to PT_AREG5 | ||
1086 | 1085 | ||
1087 | /* The spill routine might clobber a7, a11, and a15. */ | 1086 | /* The spill routine might clobber a4, a7, a8, a11, a12, and a15. */ |
1088 | 1087 | ||
1088 | s32i a4, a2, PT_AREG4 | ||
1089 | s32i a7, a2, PT_AREG7 | 1089 | s32i a7, a2, PT_AREG7 |
1090 | s32i a8, a2, PT_AREG8 | ||
1090 | s32i a11, a2, PT_AREG11 | 1091 | s32i a11, a2, PT_AREG11 |
1092 | s32i a12, a2, PT_AREG12 | ||
1091 | s32i a15, a2, PT_AREG15 | 1093 | s32i a15, a2, PT_AREG15 |
1092 | 1094 | ||
1093 | call0 _spill_registers # destroys a3, a4, and SAR | ||
1094 | |||
1095 | /* Advance PC, restore registers and SAR, and return from exception. */ | ||
1096 | |||
1097 | l32i a3, a2, PT_AREG5 | ||
1098 | l32i a4, a2, PT_AREG4 | ||
1099 | l32i a0, a2, PT_AREG0 | ||
1100 | wsr a3, sar | ||
1101 | l32i a3, a2, PT_AREG3 | ||
1102 | |||
1103 | /* Restore clobbered registers. */ | ||
1104 | |||
1105 | l32i a7, a2, PT_AREG7 | ||
1106 | l32i a11, a2, PT_AREG11 | ||
1107 | l32i a15, a2, PT_AREG15 | ||
1108 | |||
1109 | movi a2, 0 | ||
1110 | rfe | ||
1111 | |||
1112 | ENDPROC(fast_syscall_spill_registers) | ||
1113 | |||
1114 | /* Fixup handler. | ||
1115 | * | ||
1116 | * We get here if the spill routine causes an exception, e.g. tlb miss. | ||
1117 | * We basically restore WINDOWBASE and WINDOWSTART to the condition when | ||
1118 | * we entered the spill routine and jump to the user exception handler. | ||
1119 | * | ||
1120 | * a0: value of depc, original value in depc | ||
1121 | * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE | ||
1122 | * a3: exctable, original value in excsave1 | ||
1123 | */ | ||
1124 | |||
1125 | ENTRY(fast_syscall_spill_registers_fixup) | ||
1126 | |||
1127 | rsr a2, windowbase # get current windowbase (a2 is saved) | ||
1128 | xsr a0, depc # restore depc and a0 | ||
1129 | ssl a2 # set shift (32 - WB) | ||
1130 | |||
1131 | /* We need to make sure the current registers (a0-a3) are preserved. | ||
1132 | * To do this, we simply set the bit for the current window frame | ||
1133 | * in WS, so that the exception handlers save them to the task stack. | ||
1134 | */ | ||
1135 | |||
1136 | xsr a3, excsave1 # get spill-mask | ||
1137 | slli a3, a3, 1 # shift left by one | ||
1138 | |||
1139 | slli a2, a3, 32-WSBITS | ||
1140 | src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy...... | ||
1141 | wsr a2, windowstart # set corrected windowstart | ||
1142 | |||
1143 | srli a3, a3, 1 | ||
1144 | rsr a2, excsave1 | ||
1145 | l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2 | ||
1146 | xsr a2, excsave1 | ||
1147 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3 | ||
1148 | l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task) | ||
1149 | xsr a2, excsave1 | ||
1150 | |||
1151 | /* Return to the original (user task) WINDOWBASE. | ||
1152 | * We leave the following frame behind: | ||
1153 | * a0, a1, a2 same | ||
1154 | * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE) | ||
1155 | * depc: depc (we have to return to that address) | ||
1156 | * excsave_1: exctable | ||
1157 | */ | ||
1158 | |||
1159 | wsr a3, windowbase | ||
1160 | rsync | ||
1161 | |||
1162 | /* We are now in the original frame when we entered _spill_registers: | ||
1163 | * a0: return address | ||
1164 | * a1: used, stack pointer | ||
1165 | * a2: kernel stack pointer | ||
1166 | * a3: available | ||
1167 | * depc: exception address | ||
1168 | * excsave: exctable | ||
1169 | * Note: This frame might be the same as above. | ||
1170 | */ | ||
1171 | |||
1172 | /* Setup stack pointer. */ | ||
1173 | |||
1174 | addi a2, a2, -PT_USER_SIZE | ||
1175 | s32i a0, a2, PT_AREG0 | ||
1176 | |||
1177 | /* Make sure we return to this fixup handler. */ | ||
1178 | |||
1179 | movi a3, fast_syscall_spill_registers_fixup_return | ||
1180 | s32i a3, a2, PT_DEPC # setup depc | ||
1181 | |||
1182 | /* Jump to the exception handler. */ | ||
1183 | |||
1184 | rsr a3, excsave1 | ||
1185 | rsr a0, exccause | ||
1186 | addx4 a0, a0, a3 # find entry in table | ||
1187 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | ||
1188 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1189 | jx a0 | ||
1190 | |||
1191 | ENDPROC(fast_syscall_spill_registers_fixup) | ||
1192 | |||
1193 | ENTRY(fast_syscall_spill_registers_fixup_return) | ||
1194 | |||
1195 | /* When we return here, all registers have been restored (a2: DEPC) */ | ||
1196 | |||
1197 | wsr a2, depc # exception address | ||
1198 | |||
1199 | /* Restore fixup handler. */ | ||
1200 | |||
1201 | rsr a2, excsave1 | ||
1202 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE | ||
1203 | movi a3, fast_syscall_spill_registers_fixup | ||
1204 | s32i a3, a2, EXC_TABLE_FIXUP | ||
1205 | rsr a3, windowbase | ||
1206 | s32i a3, a2, EXC_TABLE_PARAM | ||
1207 | l32i a2, a2, EXC_TABLE_KSTK | ||
1208 | |||
1209 | /* Load WB at the time the exception occurred. */ | ||
1210 | |||
1211 | rsr a3, sar # WB is still in SAR | ||
1212 | neg a3, a3 | ||
1213 | wsr a3, windowbase | ||
1214 | rsync | ||
1215 | |||
1216 | rsr a3, excsave1 | ||
1217 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1218 | |||
1219 | rfde | ||
1220 | |||
1221 | ENDPROC(fast_syscall_spill_registers_fixup_return) | ||
1222 | |||
1223 | /* | ||
1224 | * spill all registers. | ||
1225 | * | ||
1226 | * This is not a real function. The following conditions must be met: | ||
1227 | * | ||
1228 | * - must be called with call0. | ||
1229 | * - uses a3, a4 and SAR. | ||
1230 | * - the last 'valid' register of each frame are clobbered. | ||
1231 | * - the caller must have registered a fixup handler | ||
1232 | * (or be inside a critical section) | ||
1233 | * - PS_EXCM must be set (PS_WOE cleared?) | ||
1234 | */ | ||
1235 | |||
1236 | ENTRY(_spill_registers) | ||
1237 | |||
1238 | /* | 1095 | /* |
1239 | * Rotate ws so that the current windowbase is at bit 0. | 1096 | * Rotate ws so that the current windowbase is at bit 0. |
1240 | * Assume ws = xxxwww1yy (www1 current window frame). | 1097 | * Assume ws = xxxwww1yy (www1 current window frame). |
1241 | * Rotate ws right so that a4 = yyxxxwww1. | 1098 | * Rotate ws right so that a4 = yyxxxwww1. |
1242 | */ | 1099 | */ |
1243 | 1100 | ||
1244 | rsr a4, windowbase | 1101 | rsr a0, windowbase |
1245 | rsr a3, windowstart # a3 = xxxwww1yy | 1102 | rsr a3, windowstart # a3 = xxxwww1yy |
1246 | ssr a4 # holds WB | 1103 | ssr a0 # holds WB |
1247 | slli a4, a3, WSBITS | 1104 | slli a0, a3, WSBITS |
1248 | or a3, a3, a4 # a3 = xxxwww1yyxxxwww1yy | 1105 | or a3, a3, a0 # a3 = xxxwww1yyxxxwww1yy |
1249 | srl a3, a3 # a3 = 00xxxwww1yyxxxwww1 | 1106 | srl a3, a3 # a3 = 00xxxwww1yyxxxwww1 |
1250 | 1107 | ||
1251 | /* We are done if there are no more than the current register frame. */ | 1108 | /* We are done if there are no more than the current register frame. */ |
1252 | 1109 | ||
1253 | extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww | 1110 | extui a3, a3, 1, WSBITS-1 # a3 = 0yyxxxwww |
1254 | movi a4, (1 << (WSBITS-1)) | 1111 | movi a0, (1 << (WSBITS-1)) |
1255 | _beqz a3, .Lnospill # only one active frame? jump | 1112 | _beqz a3, .Lnospill # only one active frame? jump |
1256 | 1113 | ||
1257 | /* We want 1 at the top, so that we return to the current windowbase */ | 1114 | /* We want 1 at the top, so that we return to the current windowbase */ |
1258 | 1115 | ||
1259 | or a3, a3, a4 # 1yyxxxwww | 1116 | or a3, a3, a0 # 1yyxxxwww |
1260 | 1117 | ||
1261 | /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ | 1118 | /* Skip empty frames - get 'oldest' WINDOWSTART-bit. */ |
1262 | 1119 | ||
1263 | wsr a3, windowstart # save shifted windowstart | 1120 | wsr a3, windowstart # save shifted windowstart |
1264 | neg a4, a3 | 1121 | neg a0, a3 |
1265 | and a3, a4, a3 # first bit set from right: 000010000 | 1122 | and a3, a0, a3 # first bit set from right: 000010000 |
1266 | 1123 | ||
1267 | ffs_ws a4, a3 # a4: shifts to skip empty frames | 1124 | ffs_ws a0, a3 # a0: shifts to skip empty frames |
1268 | movi a3, WSBITS | 1125 | movi a3, WSBITS |
1269 | sub a4, a3, a4 # WSBITS-a4:number of 0-bits from right | 1126 | sub a0, a3, a0 # WSBITS-a0:number of 0-bits from right |
1270 | ssr a4 # save in SAR for later. | 1127 | ssr a0 # save in SAR for later. |
1271 | 1128 | ||
1272 | rsr a3, windowbase | 1129 | rsr a3, windowbase |
1273 | add a3, a3, a4 | 1130 | add a3, a3, a0 |
1274 | wsr a3, windowbase | 1131 | wsr a3, windowbase |
1275 | rsync | 1132 | rsync |
1276 | 1133 | ||
@@ -1285,22 +1142,6 @@ ENTRY(_spill_registers) | |||
1285 | * we have to save 4,8. or 12 registers. | 1142 | * we have to save 4,8. or 12 registers. |
1286 | */ | 1143 | */ |
1287 | 1144 | ||
1288 | _bbsi.l a3, 1, .Lc4 | ||
1289 | _bbsi.l a3, 2, .Lc8 | ||
1290 | |||
1291 | /* Special case: we have a call12-frame starting at a4. */ | ||
1292 | |||
1293 | _bbci.l a3, 3, .Lc12 # bit 3 shouldn't be zero! (Jump to Lc12 first) | ||
1294 | |||
1295 | s32e a4, a1, -16 # a1 is valid with an empty spill area | ||
1296 | l32e a4, a5, -12 | ||
1297 | s32e a8, a4, -48 | ||
1298 | mov a8, a4 | ||
1299 | l32e a4, a1, -16 | ||
1300 | j .Lc12c | ||
1301 | |||
1302 | .Lnospill: | ||
1303 | ret | ||
1304 | 1145 | ||
1305 | .Lloop: _bbsi.l a3, 1, .Lc4 | 1146 | .Lloop: _bbsi.l a3, 1, .Lc4 |
1306 | _bbci.l a3, 2, .Lc12 | 1147 | _bbci.l a3, 2, .Lc12 |
@@ -1314,20 +1155,10 @@ ENTRY(_spill_registers) | |||
1314 | s32e a9, a4, -28 | 1155 | s32e a9, a4, -28 |
1315 | s32e a10, a4, -24 | 1156 | s32e a10, a4, -24 |
1316 | s32e a11, a4, -20 | 1157 | s32e a11, a4, -20 |
1317 | |||
1318 | srli a11, a3, 2 # shift windowbase by 2 | 1158 | srli a11, a3, 2 # shift windowbase by 2 |
1319 | rotw 2 | 1159 | rotw 2 |
1320 | _bnei a3, 1, .Lloop | 1160 | _bnei a3, 1, .Lloop |
1321 | 1161 | j .Lexit | |
1322 | .Lexit: /* Done. Do the final rotation, set WS, and return. */ | ||
1323 | |||
1324 | rotw 1 | ||
1325 | rsr a3, windowbase | ||
1326 | ssl a3 | ||
1327 | movi a3, 1 | ||
1328 | sll a3, a3 | ||
1329 | wsr a3, windowstart | ||
1330 | ret | ||
1331 | 1162 | ||
1332 | .Lc4: s32e a4, a9, -16 | 1163 | .Lc4: s32e a4, a9, -16 |
1333 | s32e a5, a9, -12 | 1164 | s32e a5, a9, -12 |
@@ -1343,11 +1174,11 @@ ENTRY(_spill_registers) | |||
1343 | 1174 | ||
1344 | /* 12-register frame (call12) */ | 1175 | /* 12-register frame (call12) */ |
1345 | 1176 | ||
1346 | l32e a2, a5, -12 | 1177 | l32e a0, a5, -12 |
1347 | s32e a8, a2, -48 | 1178 | s32e a8, a0, -48 |
1348 | mov a8, a2 | 1179 | mov a8, a0 |
1349 | 1180 | ||
1350 | .Lc12c: s32e a9, a8, -44 | 1181 | s32e a9, a8, -44 |
1351 | s32e a10, a8, -40 | 1182 | s32e a10, a8, -40 |
1352 | s32e a11, a8, -36 | 1183 | s32e a11, a8, -36 |
1353 | s32e a12, a8, -32 | 1184 | s32e a12, a8, -32 |
@@ -1367,30 +1198,54 @@ ENTRY(_spill_registers) | |||
1367 | */ | 1198 | */ |
1368 | 1199 | ||
1369 | rotw 1 | 1200 | rotw 1 |
1370 | mov a5, a13 | 1201 | mov a4, a13 |
1371 | rotw -1 | 1202 | rotw -1 |
1372 | 1203 | ||
1373 | s32e a4, a9, -16 | 1204 | s32e a4, a8, -16 |
1374 | s32e a5, a9, -12 | 1205 | s32e a5, a8, -12 |
1375 | s32e a6, a9, -8 | 1206 | s32e a6, a8, -8 |
1376 | s32e a7, a9, -4 | 1207 | s32e a7, a8, -4 |
1377 | 1208 | ||
1378 | rotw 3 | 1209 | rotw 3 |
1379 | 1210 | ||
1380 | _beqi a3, 1, .Lexit | 1211 | _beqi a3, 1, .Lexit |
1381 | j .Lloop | 1212 | j .Lloop |
1382 | 1213 | ||
1383 | .Linvalid_mask: | 1214 | .Lexit: |
1384 | 1215 | ||
1385 | /* We get here because of an unrecoverable error in the window | 1216 | /* Done. Do the final rotation and set WS */ |
1386 | * registers. If we are in user space, we kill the application, | 1217 | |
1387 | * however, this condition is unrecoverable in kernel space. | 1218 | rotw 1 |
1388 | */ | 1219 | rsr a3, windowbase |
1220 | ssl a3 | ||
1221 | movi a3, 1 | ||
1222 | sll a3, a3 | ||
1223 | wsr a3, windowstart | ||
1224 | .Lnospill: | ||
1225 | |||
1226 | /* Advance PC, restore registers and SAR, and return from exception. */ | ||
1227 | |||
1228 | l32i a3, a2, PT_SAR | ||
1229 | l32i a0, a2, PT_AREG0 | ||
1230 | wsr a3, sar | ||
1231 | l32i a3, a2, PT_AREG3 | ||
1389 | 1232 | ||
1390 | rsr a0, ps | 1233 | /* Restore clobbered registers. */ |
1391 | _bbci.l a0, PS_UM_BIT, 1f | ||
1392 | 1234 | ||
1393 | /* User space: Setup a dummy frame and kill application. | 1235 | l32i a4, a2, PT_AREG4 |
1236 | l32i a7, a2, PT_AREG7 | ||
1237 | l32i a8, a2, PT_AREG8 | ||
1238 | l32i a11, a2, PT_AREG11 | ||
1239 | l32i a12, a2, PT_AREG12 | ||
1240 | l32i a15, a2, PT_AREG15 | ||
1241 | |||
1242 | movi a2, 0 | ||
1243 | rfe | ||
1244 | |||
1245 | .Linvalid_mask: | ||
1246 | |||
1247 | /* We get here because of an unrecoverable error in the window | ||
1248 | * registers, so set up a dummy frame and kill the user application. | ||
1394 | * Note: We assume EXC_TABLE_KSTK contains a valid stack pointer. | 1249 | * Note: We assume EXC_TABLE_KSTK contains a valid stack pointer. |
1395 | */ | 1250 | */ |
1396 | 1251 | ||
@@ -1414,14 +1269,136 @@ ENTRY(_spill_registers) | |||
1414 | movi a4, do_exit | 1269 | movi a4, do_exit |
1415 | callx4 a4 | 1270 | callx4 a4 |
1416 | 1271 | ||
1417 | 1: /* Kernel space: PANIC! */ | 1272 | /* shouldn't return, so panic */ |
1418 | 1273 | ||
1419 | wsr a0, excsave1 | 1274 | wsr a0, excsave1 |
1420 | movi a0, unrecoverable_exception | 1275 | movi a0, unrecoverable_exception |
1421 | callx0 a0 # should not return | 1276 | callx0 a0 # should not return |
1422 | 1: j 1b | 1277 | 1: j 1b |
1423 | 1278 | ||
1424 | ENDPROC(_spill_registers) | 1279 | |
1280 | ENDPROC(fast_syscall_spill_registers) | ||
1281 | |||
1282 | /* Fixup handler. | ||
1283 | * | ||
1284 | * We get here if the spill routine causes an exception, e.g. tlb miss. | ||
1285 | * We basically restore WINDOWBASE and WINDOWSTART to the condition when | ||
1286 | * we entered the spill routine and jump to the user exception handler. | ||
1287 | * | ||
1288 | * Note that we only need to restore the bits in windowstart that have not | ||
1289 | * been spilled yet by the _spill_register routine. Luckily, a3 contains a | ||
1290 | * rotated windowstart with only those bits set for frames that haven't been | ||
1291 | * spilled yet. Because a3 is rotated such that bit 0 represents the register | ||
1292 | * frame for the current windowbase - 1, we need to rotate a3 left by the | ||
1293 | * value of the current windowbase + 1 and move it to windowstart. | ||
1294 | * | ||
1295 | * a0: value of depc, original value in depc | ||
1296 | * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE | ||
1297 | * a3: exctable, original value in excsave1 | ||
1298 | */ | ||
1299 | |||
1300 | ENTRY(fast_syscall_spill_registers_fixup) | ||
1301 | |||
1302 | rsr a2, windowbase # get current windowbase (a2 is saved) | ||
1303 | xsr a0, depc # restore depc and a0 | ||
1304 | ssl a2 # set shift (32 - WB) | ||
1305 | |||
1306 | /* We need to make sure the current registers (a0-a3) are preserved. | ||
1307 | * To do this, we simply set the bit for the current window frame | ||
1308 | * in WS, so that the exception handlers save them to the task stack. | ||
1309 | * | ||
1310 | * Note: we use a3 to set the windowbase, so we take a special care | ||
1311 | * of it, saving it in the original _spill_registers frame across | ||
1312 | * the exception handler call. | ||
1313 | */ | ||
1314 | |||
1315 | xsr a3, excsave1 # get spill-mask | ||
1316 | slli a3, a3, 1 # shift left by one | ||
1317 | addi a3, a3, 1 # set the bit for the current window frame | ||
1318 | |||
1319 | slli a2, a3, 32-WSBITS | ||
1320 | src a2, a3, a2 # a2 = xxwww1yyxxxwww1yy...... | ||
1321 | wsr a2, windowstart # set corrected windowstart | ||
1322 | |||
1323 | srli a3, a3, 1 | ||
1324 | rsr a2, excsave1 | ||
1325 | l32i a2, a2, EXC_TABLE_DOUBLE_SAVE # restore a2 | ||
1326 | xsr a2, excsave1 | ||
1327 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE # save a3 | ||
1328 | l32i a3, a2, EXC_TABLE_PARAM # original WB (in user task) | ||
1329 | xsr a2, excsave1 | ||
1330 | |||
1331 | /* Return to the original (user task) WINDOWBASE. | ||
1332 | * We leave the following frame behind: | ||
1333 | * a0, a1, a2 same | ||
1334 | * a3: trashed (saved in EXC_TABLE_DOUBLE_SAVE) | ||
1335 | * depc: depc (we have to return to that address) | ||
1336 | * excsave_1: exctable | ||
1337 | */ | ||
1338 | |||
1339 | wsr a3, windowbase | ||
1340 | rsync | ||
1341 | |||
1342 | /* We are now in the original frame when we entered _spill_registers: | ||
1343 | * a0: return address | ||
1344 | * a1: used, stack pointer | ||
1345 | * a2: kernel stack pointer | ||
1346 | * a3: available | ||
1347 | * depc: exception address | ||
1348 | * excsave: exctable | ||
1349 | * Note: This frame might be the same as above. | ||
1350 | */ | ||
1351 | |||
1352 | /* Setup stack pointer. */ | ||
1353 | |||
1354 | addi a2, a2, -PT_USER_SIZE | ||
1355 | s32i a0, a2, PT_AREG0 | ||
1356 | |||
1357 | /* Make sure we return to this fixup handler. */ | ||
1358 | |||
1359 | movi a3, fast_syscall_spill_registers_fixup_return | ||
1360 | s32i a3, a2, PT_DEPC # setup depc | ||
1361 | |||
1362 | /* Jump to the exception handler. */ | ||
1363 | |||
1364 | rsr a3, excsave1 | ||
1365 | rsr a0, exccause | ||
1366 | addx4 a0, a0, a3 # find entry in table | ||
1367 | l32i a0, a0, EXC_TABLE_FAST_USER # load handler | ||
1368 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1369 | jx a0 | ||
1370 | |||
1371 | ENDPROC(fast_syscall_spill_registers_fixup) | ||
1372 | |||
1373 | ENTRY(fast_syscall_spill_registers_fixup_return) | ||
1374 | |||
1375 | /* When we return here, all registers have been restored (a2: DEPC) */ | ||
1376 | |||
1377 | wsr a2, depc # exception address | ||
1378 | |||
1379 | /* Restore fixup handler. */ | ||
1380 | |||
1381 | rsr a2, excsave1 | ||
1382 | s32i a3, a2, EXC_TABLE_DOUBLE_SAVE | ||
1383 | movi a3, fast_syscall_spill_registers_fixup | ||
1384 | s32i a3, a2, EXC_TABLE_FIXUP | ||
1385 | rsr a3, windowbase | ||
1386 | s32i a3, a2, EXC_TABLE_PARAM | ||
1387 | l32i a2, a2, EXC_TABLE_KSTK | ||
1388 | |||
1389 | /* Load WB at the time the exception occurred. */ | ||
1390 | |||
1391 | rsr a3, sar # WB is still in SAR | ||
1392 | neg a3, a3 | ||
1393 | wsr a3, windowbase | ||
1394 | rsync | ||
1395 | |||
1396 | rsr a3, excsave1 | ||
1397 | l32i a3, a3, EXC_TABLE_DOUBLE_SAVE | ||
1398 | |||
1399 | rfde | ||
1400 | |||
1401 | ENDPROC(fast_syscall_spill_registers_fixup_return) | ||
1425 | 1402 | ||
1426 | #ifdef CONFIG_MMU | 1403 | #ifdef CONFIG_MMU |
1427 | /* | 1404 | /* |
@@ -1794,6 +1771,43 @@ ENTRY(system_call) | |||
1794 | 1771 | ||
1795 | ENDPROC(system_call) | 1772 | ENDPROC(system_call) |
1796 | 1773 | ||
1774 | /* | ||
1775 | * Spill live registers on the kernel stack macro. | ||
1776 | * | ||
1777 | * Entry condition: ps.woe is set, ps.excm is cleared | ||
1778 | * Exit condition: windowstart has single bit set | ||
1779 | * May clobber: a12, a13 | ||
1780 | */ | ||
1781 | .macro spill_registers_kernel | ||
1782 | |||
1783 | #if XCHAL_NUM_AREGS > 16 | ||
1784 | call12 1f | ||
1785 | _j 2f | ||
1786 | retw | ||
1787 | .align 4 | ||
1788 | 1: | ||
1789 | _entry a1, 48 | ||
1790 | addi a12, a0, 3 | ||
1791 | #if XCHAL_NUM_AREGS > 32 | ||
1792 | .rept (XCHAL_NUM_AREGS - 32) / 12 | ||
1793 | _entry a1, 48 | ||
1794 | mov a12, a0 | ||
1795 | .endr | ||
1796 | #endif | ||
1797 | _entry a1, 48 | ||
1798 | #if XCHAL_NUM_AREGS % 12 == 0 | ||
1799 | mov a8, a8 | ||
1800 | #elif XCHAL_NUM_AREGS % 12 == 4 | ||
1801 | mov a12, a12 | ||
1802 | #elif XCHAL_NUM_AREGS % 12 == 8 | ||
1803 | mov a4, a4 | ||
1804 | #endif | ||
1805 | retw | ||
1806 | 2: | ||
1807 | #else | ||
1808 | mov a12, a12 | ||
1809 | #endif | ||
1810 | .endm | ||
1797 | 1811 | ||
1798 | /* | 1812 | /* |
1799 | * Task switch. | 1813 | * Task switch. |
@@ -1806,21 +1820,20 @@ ENTRY(_switch_to) | |||
1806 | 1820 | ||
1807 | entry a1, 16 | 1821 | entry a1, 16 |
1808 | 1822 | ||
1809 | mov a12, a2 # preserve 'prev' (a2) | 1823 | mov a10, a2 # preserve 'prev' (a2) |
1810 | mov a13, a3 # and 'next' (a3) | 1824 | mov a11, a3 # and 'next' (a3) |
1811 | 1825 | ||
1812 | l32i a4, a2, TASK_THREAD_INFO | 1826 | l32i a4, a2, TASK_THREAD_INFO |
1813 | l32i a5, a3, TASK_THREAD_INFO | 1827 | l32i a5, a3, TASK_THREAD_INFO |
1814 | 1828 | ||
1815 | save_xtregs_user a4 a6 a8 a9 a10 a11 THREAD_XTREGS_USER | 1829 | save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
1816 | 1830 | ||
1817 | s32i a0, a12, THREAD_RA # save return address | 1831 | s32i a0, a10, THREAD_RA # save return address |
1818 | s32i a1, a12, THREAD_SP # save stack pointer | 1832 | s32i a1, a10, THREAD_SP # save stack pointer |
1819 | 1833 | ||
1820 | /* Disable ints while we manipulate the stack pointer. */ | 1834 | /* Disable ints while we manipulate the stack pointer. */ |
1821 | 1835 | ||
1822 | movi a14, (1 << PS_EXCM_BIT) | LOCKLEVEL | 1836 | rsil a14, LOCKLEVEL |
1823 | xsr a14, ps | ||
1824 | rsr a3, excsave1 | 1837 | rsr a3, excsave1 |
1825 | rsync | 1838 | rsync |
1826 | s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ | 1839 | s32i a3, a3, EXC_TABLE_FIXUP /* enter critical section */ |
@@ -1835,7 +1848,7 @@ ENTRY(_switch_to) | |||
1835 | 1848 | ||
1836 | /* Flush register file. */ | 1849 | /* Flush register file. */ |
1837 | 1850 | ||
1838 | call0 _spill_registers # destroys a3, a4, and SAR | 1851 | spill_registers_kernel |
1839 | 1852 | ||
1840 | /* Set kernel stack (and leave critical section) | 1853 | /* Set kernel stack (and leave critical section) |
1841 | * Note: It's save to set it here. The stack will not be overwritten | 1854 | * Note: It's save to set it here. The stack will not be overwritten |
@@ -1851,13 +1864,13 @@ ENTRY(_switch_to) | |||
1851 | 1864 | ||
1852 | /* restore context of the task 'next' */ | 1865 | /* restore context of the task 'next' */ |
1853 | 1866 | ||
1854 | l32i a0, a13, THREAD_RA # restore return address | 1867 | l32i a0, a11, THREAD_RA # restore return address |
1855 | l32i a1, a13, THREAD_SP # restore stack pointer | 1868 | l32i a1, a11, THREAD_SP # restore stack pointer |
1856 | 1869 | ||
1857 | load_xtregs_user a5 a6 a8 a9 a10 a11 THREAD_XTREGS_USER | 1870 | load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER |
1858 | 1871 | ||
1859 | wsr a14, ps | 1872 | wsr a14, ps |
1860 | mov a2, a12 # return 'prev' | 1873 | mov a2, a10 # return 'prev' |
1861 | rsync | 1874 | rsync |
1862 | 1875 | ||
1863 | retw | 1876 | retw |
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 7d12af1317f1..84fe931bb60e 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/percpu.h> | 24 | #include <linux/percpu.h> |
25 | #include <linux/clk-provider.h> | ||
25 | #include <linux/cpu.h> | 26 | #include <linux/cpu.h> |
26 | #include <linux/of_fdt.h> | 27 | #include <linux/of_fdt.h> |
27 | #include <linux/of_platform.h> | 28 | #include <linux/of_platform.h> |
@@ -276,6 +277,7 @@ void __init early_init_devtree(void *params) | |||
276 | 277 | ||
277 | static int __init xtensa_device_probe(void) | 278 | static int __init xtensa_device_probe(void) |
278 | { | 279 | { |
280 | of_clk_init(NULL); | ||
279 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 281 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
280 | return 0; | 282 | return 0; |
281 | } | 283 | } |
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index 08b769d3b3a1..2a1823de69cc 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/platform.h> | 30 | #include <asm/platform.h> |
31 | 31 | ||
32 | unsigned long ccount_freq; /* ccount Hz */ | 32 | unsigned long ccount_freq; /* ccount Hz */ |
33 | EXPORT_SYMBOL(ccount_freq); | ||
33 | 34 | ||
34 | static cycle_t ccount_read(struct clocksource *cs) | 35 | static cycle_t ccount_read(struct clocksource *cs) |
35 | { | 36 | { |
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S index cb8fd44caabc..f9e1ec346e35 100644 --- a/arch/xtensa/kernel/vectors.S +++ b/arch/xtensa/kernel/vectors.S | |||
@@ -235,7 +235,7 @@ ENTRY(_DoubleExceptionVector) | |||
235 | 235 | ||
236 | /* Check for overflow/underflow exception, jump if overflow. */ | 236 | /* Check for overflow/underflow exception, jump if overflow. */ |
237 | 237 | ||
238 | _bbci.l a0, 6, _DoubleExceptionVector_WindowOverflow | 238 | bbci.l a0, 6, _DoubleExceptionVector_WindowOverflow |
239 | 239 | ||
240 | /* | 240 | /* |
241 | * Restart window underflow exception. | 241 | * Restart window underflow exception. |
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c index 74a60c7e085e..80b33ed51f31 100644 --- a/arch/xtensa/kernel/xtensa_ksyms.c +++ b/arch/xtensa/kernel/xtensa_ksyms.c | |||
@@ -122,9 +122,7 @@ EXPORT_SYMBOL(insw); | |||
122 | EXPORT_SYMBOL(insl); | 122 | EXPORT_SYMBOL(insl); |
123 | 123 | ||
124 | extern long common_exception_return; | 124 | extern long common_exception_return; |
125 | extern long _spill_registers; | ||
126 | EXPORT_SYMBOL(common_exception_return); | 125 | EXPORT_SYMBOL(common_exception_return); |
127 | EXPORT_SYMBOL(_spill_registers); | ||
128 | 126 | ||
129 | #ifdef CONFIG_FUNCTION_TRACER | 127 | #ifdef CONFIG_FUNCTION_TRACER |
130 | EXPORT_SYMBOL(_mcount); | 128 | EXPORT_SYMBOL(_mcount); |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 479d7537a32a..aff108df92d3 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -90,7 +90,7 @@ int __init mem_reserve(unsigned long start, unsigned long end, int must_exist) | |||
90 | 90 | ||
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Initialize the bootmem system and give it all the memory we have available. | 93 | * Initialize the bootmem system and give it all low memory we have available. |
94 | */ | 94 | */ |
95 | 95 | ||
96 | void __init bootmem_init(void) | 96 | void __init bootmem_init(void) |
@@ -142,9 +142,14 @@ void __init bootmem_init(void) | |||
142 | 142 | ||
143 | /* Add all remaining memory pieces into the bootmem map */ | 143 | /* Add all remaining memory pieces into the bootmem map */ |
144 | 144 | ||
145 | for (i=0; i<sysmem.nr_banks; i++) | 145 | for (i = 0; i < sysmem.nr_banks; i++) { |
146 | free_bootmem(sysmem.bank[i].start, | 146 | if (sysmem.bank[i].start >> PAGE_SHIFT < max_low_pfn) { |
147 | sysmem.bank[i].end - sysmem.bank[i].start); | 147 | unsigned long end = min(max_low_pfn << PAGE_SHIFT, |
148 | sysmem.bank[i].end); | ||
149 | free_bootmem(sysmem.bank[i].start, | ||
150 | end - sysmem.bank[i].start); | ||
151 | } | ||
152 | } | ||
148 | 153 | ||
149 | } | 154 | } |
150 | 155 | ||
diff --git a/arch/xtensa/mm/mmu.c b/arch/xtensa/mm/mmu.c index 36ec171698b8..861203e958da 100644 --- a/arch/xtensa/mm/mmu.c +++ b/arch/xtensa/mm/mmu.c | |||
@@ -39,7 +39,7 @@ void init_mmu(void) | |||
39 | set_itlbcfg_register(0); | 39 | set_itlbcfg_register(0); |
40 | set_dtlbcfg_register(0); | 40 | set_dtlbcfg_register(0); |
41 | #endif | 41 | #endif |
42 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && CONFIG_OF | 42 | #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF) |
43 | /* | 43 | /* |
44 | * Update the IO area mapping in case xtensa_kio_paddr has changed | 44 | * Update the IO area mapping in case xtensa_kio_paddr has changed |
45 | */ | 45 | */ |
diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c index 800227862fe8..57fd08b36f51 100644 --- a/arch/xtensa/platforms/xtfpga/setup.c +++ b/arch/xtensa/platforms/xtfpga/setup.c | |||
@@ -135,11 +135,11 @@ static void __init update_local_mac(struct device_node *node) | |||
135 | 135 | ||
136 | static int __init machine_setup(void) | 136 | static int __init machine_setup(void) |
137 | { | 137 | { |
138 | struct device_node *serial; | 138 | struct device_node *clock; |
139 | struct device_node *eth = NULL; | 139 | struct device_node *eth = NULL; |
140 | 140 | ||
141 | for_each_compatible_node(serial, NULL, "ns16550a") | 141 | for_each_node_by_name(clock, "main-oscillator") |
142 | update_clock_frequency(serial); | 142 | update_clock_frequency(clock); |
143 | 143 | ||
144 | if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) | 144 | if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) |
145 | update_local_mac(eth); | 145 | update_local_mac(eth); |
@@ -290,6 +290,7 @@ static int __init xtavnet_init(void) | |||
290 | * knows whether they set it correctly on the DIP switches. | 290 | * knows whether they set it correctly on the DIP switches. |
291 | */ | 291 | */ |
292 | pr_info("XTFPGA: Ethernet MAC %pM\n", ethoc_pdata.hwaddr); | 292 | pr_info("XTFPGA: Ethernet MAC %pM\n", ethoc_pdata.hwaddr); |
293 | ethoc_pdata.eth_clkfreq = *(long *)XTFPGA_CLKFRQ_VADDR; | ||
293 | 294 | ||
294 | return 0; | 295 | return 0; |
295 | } | 296 | } |
diff --git a/arch/xtensa/variants/fsf/include/variant/tie.h b/arch/xtensa/variants/fsf/include/variant/tie.h index bf4020116df5..244cdea4dee5 100644 --- a/arch/xtensa/variants/fsf/include/variant/tie.h +++ b/arch/xtensa/variants/fsf/include/variant/tie.h | |||
@@ -18,13 +18,6 @@ | |||
18 | #define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */ | 18 | #define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */ |
19 | #define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ | 19 | #define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */ |
20 | 20 | ||
21 | /* Basic parameters of each coprocessor: */ | ||
22 | #define XCHAL_CP7_NAME "XTIOP" | ||
23 | #define XCHAL_CP7_IDENT XTIOP | ||
24 | #define XCHAL_CP7_SA_SIZE 0 /* size of state save area */ | ||
25 | #define XCHAL_CP7_SA_ALIGN 1 /* min alignment of save area */ | ||
26 | #define XCHAL_CP_ID_XTIOP 7 /* coprocessor ID (0..7) */ | ||
27 | |||
28 | /* Filler info for unassigned coprocessors, to simplify arrays etc: */ | 21 | /* Filler info for unassigned coprocessors, to simplify arrays etc: */ |
29 | #define XCHAL_NCP_SA_SIZE 0 | 22 | #define XCHAL_NCP_SA_SIZE 0 |
30 | #define XCHAL_NCP_SA_ALIGN 1 | 23 | #define XCHAL_NCP_SA_ALIGN 1 |
@@ -42,6 +35,8 @@ | |||
42 | #define XCHAL_CP5_SA_ALIGN 1 | 35 | #define XCHAL_CP5_SA_ALIGN 1 |
43 | #define XCHAL_CP6_SA_SIZE 0 | 36 | #define XCHAL_CP6_SA_SIZE 0 |
44 | #define XCHAL_CP6_SA_ALIGN 1 | 37 | #define XCHAL_CP6_SA_ALIGN 1 |
38 | #define XCHAL_CP7_SA_SIZE 0 | ||
39 | #define XCHAL_CP7_SA_ALIGN 1 | ||
45 | 40 | ||
46 | /* Save area for non-coprocessor optional and custom (TIE) state: */ | 41 | /* Save area for non-coprocessor optional and custom (TIE) state: */ |
47 | #define XCHAL_NCP_SA_SIZE 0 | 42 | #define XCHAL_NCP_SA_SIZE 0 |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 28baa05b8018..84243c32e29c 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -56,6 +56,12 @@ struct throttling_tstate { | |||
56 | int target_state; /* target T-state */ | 56 | int target_state; /* target T-state */ |
57 | }; | 57 | }; |
58 | 58 | ||
59 | struct acpi_processor_throttling_arg { | ||
60 | struct acpi_processor *pr; | ||
61 | int target_state; | ||
62 | bool force; | ||
63 | }; | ||
64 | |||
59 | #define THROTTLING_PRECHANGE (1) | 65 | #define THROTTLING_PRECHANGE (1) |
60 | #define THROTTLING_POSTCHANGE (2) | 66 | #define THROTTLING_POSTCHANGE (2) |
61 | 67 | ||
@@ -1060,16 +1066,24 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
1060 | return 0; | 1066 | return 0; |
1061 | } | 1067 | } |
1062 | 1068 | ||
1069 | static long acpi_processor_throttling_fn(void *data) | ||
1070 | { | ||
1071 | struct acpi_processor_throttling_arg *arg = data; | ||
1072 | struct acpi_processor *pr = arg->pr; | ||
1073 | |||
1074 | return pr->throttling.acpi_processor_set_throttling(pr, | ||
1075 | arg->target_state, arg->force); | ||
1076 | } | ||
1077 | |||
1063 | int acpi_processor_set_throttling(struct acpi_processor *pr, | 1078 | int acpi_processor_set_throttling(struct acpi_processor *pr, |
1064 | int state, bool force) | 1079 | int state, bool force) |
1065 | { | 1080 | { |
1066 | cpumask_var_t saved_mask; | ||
1067 | int ret = 0; | 1081 | int ret = 0; |
1068 | unsigned int i; | 1082 | unsigned int i; |
1069 | struct acpi_processor *match_pr; | 1083 | struct acpi_processor *match_pr; |
1070 | struct acpi_processor_throttling *p_throttling; | 1084 | struct acpi_processor_throttling *p_throttling; |
1085 | struct acpi_processor_throttling_arg arg; | ||
1071 | struct throttling_tstate t_state; | 1086 | struct throttling_tstate t_state; |
1072 | cpumask_var_t online_throttling_cpus; | ||
1073 | 1087 | ||
1074 | if (!pr) | 1088 | if (!pr) |
1075 | return -EINVAL; | 1089 | return -EINVAL; |
@@ -1080,14 +1094,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1080 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) | 1094 | if ((state < 0) || (state > (pr->throttling.state_count - 1))) |
1081 | return -EINVAL; | 1095 | return -EINVAL; |
1082 | 1096 | ||
1083 | if (!alloc_cpumask_var(&saved_mask, GFP_KERNEL)) | ||
1084 | return -ENOMEM; | ||
1085 | |||
1086 | if (!alloc_cpumask_var(&online_throttling_cpus, GFP_KERNEL)) { | ||
1087 | free_cpumask_var(saved_mask); | ||
1088 | return -ENOMEM; | ||
1089 | } | ||
1090 | |||
1091 | if (cpu_is_offline(pr->id)) { | 1097 | if (cpu_is_offline(pr->id)) { |
1092 | /* | 1098 | /* |
1093 | * the cpu pointed by pr->id is offline. Unnecessary to change | 1099 | * the cpu pointed by pr->id is offline. Unnecessary to change |
@@ -1096,17 +1102,15 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1096 | return -ENODEV; | 1102 | return -ENODEV; |
1097 | } | 1103 | } |
1098 | 1104 | ||
1099 | cpumask_copy(saved_mask, ¤t->cpus_allowed); | ||
1100 | t_state.target_state = state; | 1105 | t_state.target_state = state; |
1101 | p_throttling = &(pr->throttling); | 1106 | p_throttling = &(pr->throttling); |
1102 | cpumask_and(online_throttling_cpus, cpu_online_mask, | 1107 | |
1103 | p_throttling->shared_cpu_map); | ||
1104 | /* | 1108 | /* |
1105 | * The throttling notifier will be called for every | 1109 | * The throttling notifier will be called for every |
1106 | * affected cpu in order to get one proper T-state. | 1110 | * affected cpu in order to get one proper T-state. |
1107 | * The notifier event is THROTTLING_PRECHANGE. | 1111 | * The notifier event is THROTTLING_PRECHANGE. |
1108 | */ | 1112 | */ |
1109 | for_each_cpu(i, online_throttling_cpus) { | 1113 | for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { |
1110 | t_state.cpu = i; | 1114 | t_state.cpu = i; |
1111 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, | 1115 | acpi_processor_throttling_notifier(THROTTLING_PRECHANGE, |
1112 | &t_state); | 1116 | &t_state); |
@@ -1118,21 +1122,18 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1118 | * it can be called only for the cpu pointed by pr. | 1122 | * it can be called only for the cpu pointed by pr. |
1119 | */ | 1123 | */ |
1120 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { | 1124 | if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { |
1121 | /* FIXME: use work_on_cpu() */ | 1125 | arg.pr = pr; |
1122 | if (set_cpus_allowed_ptr(current, cpumask_of(pr->id))) { | 1126 | arg.target_state = state; |
1123 | /* Can't migrate to the pr->id CPU. Exit */ | 1127 | arg.force = force; |
1124 | ret = -ENODEV; | 1128 | ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, &arg); |
1125 | goto exit; | ||
1126 | } | ||
1127 | ret = p_throttling->acpi_processor_set_throttling(pr, | ||
1128 | t_state.target_state, force); | ||
1129 | } else { | 1129 | } else { |
1130 | /* | 1130 | /* |
1131 | * When the T-state coordination is SW_ALL or HW_ALL, | 1131 | * When the T-state coordination is SW_ALL or HW_ALL, |
1132 | * it is necessary to set T-state for every affected | 1132 | * it is necessary to set T-state for every affected |
1133 | * cpus. | 1133 | * cpus. |
1134 | */ | 1134 | */ |
1135 | for_each_cpu(i, online_throttling_cpus) { | 1135 | for_each_cpu_and(i, cpu_online_mask, |
1136 | p_throttling->shared_cpu_map) { | ||
1136 | match_pr = per_cpu(processors, i); | 1137 | match_pr = per_cpu(processors, i); |
1137 | /* | 1138 | /* |
1138 | * If the pointer is invalid, we will report the | 1139 | * If the pointer is invalid, we will report the |
@@ -1153,13 +1154,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1153 | "on CPU %d\n", i)); | 1154 | "on CPU %d\n", i)); |
1154 | continue; | 1155 | continue; |
1155 | } | 1156 | } |
1156 | t_state.cpu = i; | 1157 | |
1157 | /* FIXME: use work_on_cpu() */ | 1158 | arg.pr = match_pr; |
1158 | if (set_cpus_allowed_ptr(current, cpumask_of(i))) | 1159 | arg.target_state = state; |
1159 | continue; | 1160 | arg.force = force; |
1160 | ret = match_pr->throttling. | 1161 | ret = work_on_cpu(pr->id, acpi_processor_throttling_fn, |
1161 | acpi_processor_set_throttling( | 1162 | &arg); |
1162 | match_pr, t_state.target_state, force); | ||
1163 | } | 1163 | } |
1164 | } | 1164 | } |
1165 | /* | 1165 | /* |
@@ -1168,17 +1168,12 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, | |||
1168 | * affected cpu to update the T-states. | 1168 | * affected cpu to update the T-states. |
1169 | * The notifier event is THROTTLING_POSTCHANGE | 1169 | * The notifier event is THROTTLING_POSTCHANGE |
1170 | */ | 1170 | */ |
1171 | for_each_cpu(i, online_throttling_cpus) { | 1171 | for_each_cpu_and(i, cpu_online_mask, p_throttling->shared_cpu_map) { |
1172 | t_state.cpu = i; | 1172 | t_state.cpu = i; |
1173 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, | 1173 | acpi_processor_throttling_notifier(THROTTLING_POSTCHANGE, |
1174 | &t_state); | 1174 | &t_state); |
1175 | } | 1175 | } |
1176 | /* restore the previous state */ | 1176 | |
1177 | /* FIXME: use work_on_cpu() */ | ||
1178 | set_cpus_allowed_ptr(current, saved_mask); | ||
1179 | exit: | ||
1180 | free_cpumask_var(online_throttling_cpus); | ||
1181 | free_cpumask_var(saved_mask); | ||
1182 | return ret; | 1177 | return ret; |
1183 | } | 1178 | } |
1184 | 1179 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 8a97ddfa6122..c30df50e4440 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -1580,6 +1580,7 @@ static int fw_pm_notify(struct notifier_block *notify_block, | |||
1580 | switch (mode) { | 1580 | switch (mode) { |
1581 | case PM_HIBERNATION_PREPARE: | 1581 | case PM_HIBERNATION_PREPARE: |
1582 | case PM_SUSPEND_PREPARE: | 1582 | case PM_SUSPEND_PREPARE: |
1583 | case PM_RESTORE_PREPARE: | ||
1583 | kill_requests_without_uevent(); | 1584 | kill_requests_without_uevent(); |
1584 | device_cache_fw_images(); | 1585 | device_cache_fw_images(); |
1585 | break; | 1586 | break; |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index e90816105921..2cd36b9297f3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -39,9 +39,10 @@ | |||
39 | #define BYT_TURBO_RATIOS 0x66c | 39 | #define BYT_TURBO_RATIOS 0x66c |
40 | 40 | ||
41 | 41 | ||
42 | #define FRAC_BITS 8 | 42 | #define FRAC_BITS 6 |
43 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) | 43 | #define int_tofp(X) ((int64_t)(X) << FRAC_BITS) |
44 | #define fp_toint(X) ((X) >> FRAC_BITS) | 44 | #define fp_toint(X) ((X) >> FRAC_BITS) |
45 | #define FP_ROUNDUP(X) ((X) += 1 << FRAC_BITS) | ||
45 | 46 | ||
46 | static inline int32_t mul_fp(int32_t x, int32_t y) | 47 | static inline int32_t mul_fp(int32_t x, int32_t y) |
47 | { | 48 | { |
@@ -556,18 +557,20 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) | |||
556 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, | 557 | static inline void intel_pstate_calc_busy(struct cpudata *cpu, |
557 | struct sample *sample) | 558 | struct sample *sample) |
558 | { | 559 | { |
559 | u64 core_pct; | 560 | int32_t core_pct; |
560 | u64 c0_pct; | 561 | int32_t c0_pct; |
561 | 562 | ||
562 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); | 563 | core_pct = div_fp(int_tofp((sample->aperf)), |
564 | int_tofp((sample->mperf))); | ||
565 | core_pct = mul_fp(core_pct, int_tofp(100)); | ||
566 | FP_ROUNDUP(core_pct); | ||
567 | |||
568 | c0_pct = div_fp(int_tofp(sample->mperf), int_tofp(sample->tsc)); | ||
563 | 569 | ||
564 | c0_pct = div64_u64(sample->mperf * 100, sample->tsc); | ||
565 | sample->freq = fp_toint( | 570 | sample->freq = fp_toint( |
566 | mul_fp(int_tofp(cpu->pstate.max_pstate), | 571 | mul_fp(int_tofp(cpu->pstate.max_pstate * 1000), core_pct)); |
567 | int_tofp(core_pct * 1000))); | ||
568 | 572 | ||
569 | sample->core_pct_busy = mul_fp(int_tofp(core_pct), | 573 | sample->core_pct_busy = mul_fp(core_pct, c0_pct); |
570 | div_fp(int_tofp(c0_pct + 1), int_tofp(100))); | ||
571 | } | 574 | } |
572 | 575 | ||
573 | static inline void intel_pstate_sample(struct cpudata *cpu) | 576 | static inline void intel_pstate_sample(struct cpudata *cpu) |
@@ -579,6 +582,10 @@ static inline void intel_pstate_sample(struct cpudata *cpu) | |||
579 | rdmsrl(MSR_IA32_MPERF, mperf); | 582 | rdmsrl(MSR_IA32_MPERF, mperf); |
580 | tsc = native_read_tsc(); | 583 | tsc = native_read_tsc(); |
581 | 584 | ||
585 | aperf = aperf >> FRAC_BITS; | ||
586 | mperf = mperf >> FRAC_BITS; | ||
587 | tsc = tsc >> FRAC_BITS; | ||
588 | |||
582 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; | 589 | cpu->sample_ptr = (cpu->sample_ptr + 1) % SAMPLE_COUNT; |
583 | cpu->samples[cpu->sample_ptr].aperf = aperf; | 590 | cpu->samples[cpu->sample_ptr].aperf = aperf; |
584 | cpu->samples[cpu->sample_ptr].mperf = mperf; | 591 | cpu->samples[cpu->sample_ptr].mperf = mperf; |
@@ -610,7 +617,8 @@ static inline int32_t intel_pstate_get_scaled_busy(struct cpudata *cpu) | |||
610 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; | 617 | core_busy = cpu->samples[cpu->sample_ptr].core_pct_busy; |
611 | max_pstate = int_tofp(cpu->pstate.max_pstate); | 618 | max_pstate = int_tofp(cpu->pstate.max_pstate); |
612 | current_pstate = int_tofp(cpu->pstate.current_pstate); | 619 | current_pstate = int_tofp(cpu->pstate.current_pstate); |
613 | return mul_fp(core_busy, div_fp(max_pstate, current_pstate)); | 620 | core_busy = mul_fp(core_busy, div_fp(max_pstate, current_pstate)); |
621 | return FP_ROUNDUP(core_busy); | ||
614 | } | 622 | } |
615 | 623 | ||
616 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) | 624 | static inline void intel_pstate_adjust_busy_pstate(struct cpudata *cpu) |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 4e7918339b12..19041cefabb1 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -449,6 +449,7 @@ static const struct of_device_id sdma_dt_ids[] = { | |||
449 | { .compatible = "fsl,imx51-sdma", .data = &sdma_imx51, }, | 449 | { .compatible = "fsl,imx51-sdma", .data = &sdma_imx51, }, |
450 | { .compatible = "fsl,imx35-sdma", .data = &sdma_imx35, }, | 450 | { .compatible = "fsl,imx35-sdma", .data = &sdma_imx35, }, |
451 | { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, | 451 | { .compatible = "fsl,imx31-sdma", .data = &sdma_imx31, }, |
452 | { .compatible = "fsl,imx25-sdma", .data = &sdma_imx25, }, | ||
452 | { /* sentinel */ } | 453 | { /* sentinel */ } |
453 | }; | 454 | }; |
454 | MODULE_DEVICE_TABLE(of, sdma_dt_ids); | 455 | MODULE_DEVICE_TABLE(of, sdma_dt_ids); |
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 87529181efcc..4e3549a16132 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -77,7 +77,8 @@ static irqreturn_t ioat_dma_do_interrupt(int irq, void *data) | |||
77 | attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET); | 77 | attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET); |
78 | for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) { | 78 | for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) { |
79 | chan = ioat_chan_by_index(instance, bit); | 79 | chan = ioat_chan_by_index(instance, bit); |
80 | tasklet_schedule(&chan->cleanup_task); | 80 | if (test_bit(IOAT_RUN, &chan->state)) |
81 | tasklet_schedule(&chan->cleanup_task); | ||
81 | } | 82 | } |
82 | 83 | ||
83 | writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET); | 84 | writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET); |
@@ -93,7 +94,8 @@ static irqreturn_t ioat_dma_do_interrupt_msix(int irq, void *data) | |||
93 | { | 94 | { |
94 | struct ioat_chan_common *chan = data; | 95 | struct ioat_chan_common *chan = data; |
95 | 96 | ||
96 | tasklet_schedule(&chan->cleanup_task); | 97 | if (test_bit(IOAT_RUN, &chan->state)) |
98 | tasklet_schedule(&chan->cleanup_task); | ||
97 | 99 | ||
98 | return IRQ_HANDLED; | 100 | return IRQ_HANDLED; |
99 | } | 101 | } |
@@ -116,7 +118,6 @@ void ioat_init_channel(struct ioatdma_device *device, struct ioat_chan_common *c | |||
116 | chan->timer.function = device->timer_fn; | 118 | chan->timer.function = device->timer_fn; |
117 | chan->timer.data = data; | 119 | chan->timer.data = data; |
118 | tasklet_init(&chan->cleanup_task, device->cleanup_fn, data); | 120 | tasklet_init(&chan->cleanup_task, device->cleanup_fn, data); |
119 | tasklet_disable(&chan->cleanup_task); | ||
120 | } | 121 | } |
121 | 122 | ||
122 | /** | 123 | /** |
@@ -354,13 +355,49 @@ static int ioat1_dma_alloc_chan_resources(struct dma_chan *c) | |||
354 | writel(((u64) chan->completion_dma) >> 32, | 355 | writel(((u64) chan->completion_dma) >> 32, |
355 | chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); | 356 | chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); |
356 | 357 | ||
357 | tasklet_enable(&chan->cleanup_task); | 358 | set_bit(IOAT_RUN, &chan->state); |
358 | ioat1_dma_start_null_desc(ioat); /* give chain to dma device */ | 359 | ioat1_dma_start_null_desc(ioat); /* give chain to dma device */ |
359 | dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", | 360 | dev_dbg(to_dev(chan), "%s: allocated %d descriptors\n", |
360 | __func__, ioat->desccount); | 361 | __func__, ioat->desccount); |
361 | return ioat->desccount; | 362 | return ioat->desccount; |
362 | } | 363 | } |
363 | 364 | ||
365 | void ioat_stop(struct ioat_chan_common *chan) | ||
366 | { | ||
367 | struct ioatdma_device *device = chan->device; | ||
368 | struct pci_dev *pdev = device->pdev; | ||
369 | int chan_id = chan_num(chan); | ||
370 | struct msix_entry *msix; | ||
371 | |||
372 | /* 1/ stop irq from firing tasklets | ||
373 | * 2/ stop the tasklet from re-arming irqs | ||
374 | */ | ||
375 | clear_bit(IOAT_RUN, &chan->state); | ||
376 | |||
377 | /* flush inflight interrupts */ | ||
378 | switch (device->irq_mode) { | ||
379 | case IOAT_MSIX: | ||
380 | msix = &device->msix_entries[chan_id]; | ||
381 | synchronize_irq(msix->vector); | ||
382 | break; | ||
383 | case IOAT_MSI: | ||
384 | case IOAT_INTX: | ||
385 | synchronize_irq(pdev->irq); | ||
386 | break; | ||
387 | default: | ||
388 | break; | ||
389 | } | ||
390 | |||
391 | /* flush inflight timers */ | ||
392 | del_timer_sync(&chan->timer); | ||
393 | |||
394 | /* flush inflight tasklet runs */ | ||
395 | tasklet_kill(&chan->cleanup_task); | ||
396 | |||
397 | /* final cleanup now that everything is quiesced and can't re-arm */ | ||
398 | device->cleanup_fn((unsigned long) &chan->common); | ||
399 | } | ||
400 | |||
364 | /** | 401 | /** |
365 | * ioat1_dma_free_chan_resources - release all the descriptors | 402 | * ioat1_dma_free_chan_resources - release all the descriptors |
366 | * @chan: the channel to be cleaned | 403 | * @chan: the channel to be cleaned |
@@ -379,9 +416,7 @@ static void ioat1_dma_free_chan_resources(struct dma_chan *c) | |||
379 | if (ioat->desccount == 0) | 416 | if (ioat->desccount == 0) |
380 | return; | 417 | return; |
381 | 418 | ||
382 | tasklet_disable(&chan->cleanup_task); | 419 | ioat_stop(chan); |
383 | del_timer_sync(&chan->timer); | ||
384 | ioat1_cleanup(ioat); | ||
385 | 420 | ||
386 | /* Delay 100ms after reset to allow internal DMA logic to quiesce | 421 | /* Delay 100ms after reset to allow internal DMA logic to quiesce |
387 | * before removing DMA descriptor resources. | 422 | * before removing DMA descriptor resources. |
@@ -526,8 +561,11 @@ ioat1_dma_prep_memcpy(struct dma_chan *c, dma_addr_t dma_dest, | |||
526 | static void ioat1_cleanup_event(unsigned long data) | 561 | static void ioat1_cleanup_event(unsigned long data) |
527 | { | 562 | { |
528 | struct ioat_dma_chan *ioat = to_ioat_chan((void *) data); | 563 | struct ioat_dma_chan *ioat = to_ioat_chan((void *) data); |
564 | struct ioat_chan_common *chan = &ioat->base; | ||
529 | 565 | ||
530 | ioat1_cleanup(ioat); | 566 | ioat1_cleanup(ioat); |
567 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
568 | return; | ||
531 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 569 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
532 | } | 570 | } |
533 | 571 | ||
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index 11fb877ddca9..e982f00a9843 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -356,6 +356,7 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
356 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 356 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
357 | void ioat_kobject_del(struct ioatdma_device *device); | 357 | void ioat_kobject_del(struct ioatdma_device *device); |
358 | int ioat_dma_setup_interrupts(struct ioatdma_device *device); | 358 | int ioat_dma_setup_interrupts(struct ioatdma_device *device); |
359 | void ioat_stop(struct ioat_chan_common *chan); | ||
359 | extern const struct sysfs_ops ioat_sysfs_ops; | 360 | extern const struct sysfs_ops ioat_sysfs_ops; |
360 | extern struct ioat_sysfs_entry ioat_version_attr; | 361 | extern struct ioat_sysfs_entry ioat_version_attr; |
361 | extern struct ioat_sysfs_entry ioat_cap_attr; | 362 | extern struct ioat_sysfs_entry ioat_cap_attr; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index 5d3affe7e976..8d1058085eeb 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -190,8 +190,11 @@ static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | |||
190 | void ioat2_cleanup_event(unsigned long data) | 190 | void ioat2_cleanup_event(unsigned long data) |
191 | { | 191 | { |
192 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); | 192 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); |
193 | struct ioat_chan_common *chan = &ioat->base; | ||
193 | 194 | ||
194 | ioat2_cleanup(ioat); | 195 | ioat2_cleanup(ioat); |
196 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
197 | return; | ||
195 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 198 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
196 | } | 199 | } |
197 | 200 | ||
@@ -553,10 +556,10 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
553 | ioat->issued = 0; | 556 | ioat->issued = 0; |
554 | ioat->tail = 0; | 557 | ioat->tail = 0; |
555 | ioat->alloc_order = order; | 558 | ioat->alloc_order = order; |
559 | set_bit(IOAT_RUN, &chan->state); | ||
556 | spin_unlock_bh(&ioat->prep_lock); | 560 | spin_unlock_bh(&ioat->prep_lock); |
557 | spin_unlock_bh(&chan->cleanup_lock); | 561 | spin_unlock_bh(&chan->cleanup_lock); |
558 | 562 | ||
559 | tasklet_enable(&chan->cleanup_task); | ||
560 | ioat2_start_null_desc(ioat); | 563 | ioat2_start_null_desc(ioat); |
561 | 564 | ||
562 | /* check that we got off the ground */ | 565 | /* check that we got off the ground */ |
@@ -566,7 +569,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c) | |||
566 | } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status)); | 569 | } while (i++ < 20 && !is_ioat_active(status) && !is_ioat_idle(status)); |
567 | 570 | ||
568 | if (is_ioat_active(status) || is_ioat_idle(status)) { | 571 | if (is_ioat_active(status) || is_ioat_idle(status)) { |
569 | set_bit(IOAT_RUN, &chan->state); | ||
570 | return 1 << ioat->alloc_order; | 572 | return 1 << ioat->alloc_order; |
571 | } else { | 573 | } else { |
572 | u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); | 574 | u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); |
@@ -809,11 +811,8 @@ void ioat2_free_chan_resources(struct dma_chan *c) | |||
809 | if (!ioat->ring) | 811 | if (!ioat->ring) |
810 | return; | 812 | return; |
811 | 813 | ||
812 | tasklet_disable(&chan->cleanup_task); | 814 | ioat_stop(chan); |
813 | del_timer_sync(&chan->timer); | ||
814 | device->cleanup_fn((unsigned long) c); | ||
815 | device->reset_hw(chan); | 815 | device->reset_hw(chan); |
816 | clear_bit(IOAT_RUN, &chan->state); | ||
817 | 816 | ||
818 | spin_lock_bh(&chan->cleanup_lock); | 817 | spin_lock_bh(&chan->cleanup_lock); |
819 | spin_lock_bh(&ioat->prep_lock); | 818 | spin_lock_bh(&ioat->prep_lock); |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 820817e97e62..b9b38a1cf92f 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -464,8 +464,11 @@ static void ioat3_cleanup(struct ioat2_dma_chan *ioat) | |||
464 | static void ioat3_cleanup_event(unsigned long data) | 464 | static void ioat3_cleanup_event(unsigned long data) |
465 | { | 465 | { |
466 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); | 466 | struct ioat2_dma_chan *ioat = to_ioat2_chan((void *) data); |
467 | struct ioat_chan_common *chan = &ioat->base; | ||
467 | 468 | ||
468 | ioat3_cleanup(ioat); | 469 | ioat3_cleanup(ioat); |
470 | if (!test_bit(IOAT_RUN, &chan->state)) | ||
471 | return; | ||
469 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); | 472 | writew(IOAT_CHANCTRL_RUN, ioat->base.reg_base + IOAT_CHANCTRL_OFFSET); |
470 | } | 473 | } |
471 | 474 | ||
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 00a2de957b23..bf18c786ed40 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1641,6 +1641,7 @@ static void dma_tasklet(unsigned long data) | |||
1641 | struct d40_chan *d40c = (struct d40_chan *) data; | 1641 | struct d40_chan *d40c = (struct d40_chan *) data; |
1642 | struct d40_desc *d40d; | 1642 | struct d40_desc *d40d; |
1643 | unsigned long flags; | 1643 | unsigned long flags; |
1644 | bool callback_active; | ||
1644 | dma_async_tx_callback callback; | 1645 | dma_async_tx_callback callback; |
1645 | void *callback_param; | 1646 | void *callback_param; |
1646 | 1647 | ||
@@ -1668,6 +1669,7 @@ static void dma_tasklet(unsigned long data) | |||
1668 | } | 1669 | } |
1669 | 1670 | ||
1670 | /* Callback to client */ | 1671 | /* Callback to client */ |
1672 | callback_active = !!(d40d->txd.flags & DMA_PREP_INTERRUPT); | ||
1671 | callback = d40d->txd.callback; | 1673 | callback = d40d->txd.callback; |
1672 | callback_param = d40d->txd.callback_param; | 1674 | callback_param = d40d->txd.callback_param; |
1673 | 1675 | ||
@@ -1690,7 +1692,7 @@ static void dma_tasklet(unsigned long data) | |||
1690 | 1692 | ||
1691 | spin_unlock_irqrestore(&d40c->lock, flags); | 1693 | spin_unlock_irqrestore(&d40c->lock, flags); |
1692 | 1694 | ||
1693 | if (callback && (d40d->txd.flags & DMA_PREP_INTERRUPT)) | 1695 | if (callback_active && callback) |
1694 | callback(callback_param); | 1696 | callback(callback_param); |
1695 | 1697 | ||
1696 | return; | 1698 | return; |
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c index d63f4798f7d0..57e96a3350f0 100644 --- a/drivers/edac/i7300_edac.c +++ b/drivers/edac/i7300_edac.c | |||
@@ -943,33 +943,35 @@ static int i7300_get_devices(struct mem_ctl_info *mci) | |||
943 | 943 | ||
944 | /* Attempt to 'get' the MCH register we want */ | 944 | /* Attempt to 'get' the MCH register we want */ |
945 | pdev = NULL; | 945 | pdev = NULL; |
946 | while (!pvt->pci_dev_16_1_fsb_addr_map || | 946 | while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
947 | !pvt->pci_dev_16_2_fsb_err_regs) { | 947 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, |
948 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 948 | pdev))) { |
949 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR, pdev); | ||
950 | if (!pdev) { | ||
951 | /* End of list, leave */ | ||
952 | i7300_printk(KERN_ERR, | ||
953 | "'system address,Process Bus' " | ||
954 | "device not found:" | ||
955 | "vendor 0x%x device 0x%x ERR funcs " | ||
956 | "(broken BIOS?)\n", | ||
957 | PCI_VENDOR_ID_INTEL, | ||
958 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR); | ||
959 | goto error; | ||
960 | } | ||
961 | |||
962 | /* Store device 16 funcs 1 and 2 */ | 949 | /* Store device 16 funcs 1 and 2 */ |
963 | switch (PCI_FUNC(pdev->devfn)) { | 950 | switch (PCI_FUNC(pdev->devfn)) { |
964 | case 1: | 951 | case 1: |
965 | pvt->pci_dev_16_1_fsb_addr_map = pdev; | 952 | if (!pvt->pci_dev_16_1_fsb_addr_map) |
953 | pvt->pci_dev_16_1_fsb_addr_map = | ||
954 | pci_dev_get(pdev); | ||
966 | break; | 955 | break; |
967 | case 2: | 956 | case 2: |
968 | pvt->pci_dev_16_2_fsb_err_regs = pdev; | 957 | if (!pvt->pci_dev_16_2_fsb_err_regs) |
958 | pvt->pci_dev_16_2_fsb_err_regs = | ||
959 | pci_dev_get(pdev); | ||
969 | break; | 960 | break; |
970 | } | 961 | } |
971 | } | 962 | } |
972 | 963 | ||
964 | if (!pvt->pci_dev_16_1_fsb_addr_map || | ||
965 | !pvt->pci_dev_16_2_fsb_err_regs) { | ||
966 | /* At least one device was not found */ | ||
967 | i7300_printk(KERN_ERR, | ||
968 | "'system address,Process Bus' device not found:" | ||
969 | "vendor 0x%x device 0x%x ERR funcs (broken BIOS?)\n", | ||
970 | PCI_VENDOR_ID_INTEL, | ||
971 | PCI_DEVICE_ID_INTEL_I7300_MCH_ERR); | ||
972 | goto error; | ||
973 | } | ||
974 | |||
973 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", | 975 | edac_dbg(1, "System Address, processor bus- PCI Bus ID: %s %x:%x\n", |
974 | pci_name(pvt->pci_dev_16_0_fsb_ctlr), | 976 | pci_name(pvt->pci_dev_16_0_fsb_ctlr), |
975 | pvt->pci_dev_16_0_fsb_ctlr->vendor, | 977 | pvt->pci_dev_16_0_fsb_ctlr->vendor, |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 87533ca7752e..d871275196f6 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
@@ -1334,14 +1334,19 @@ static int i7core_get_onedevice(struct pci_dev **prev, | |||
1334 | * is at addr 8086:2c40, instead of 8086:2c41. So, we need | 1334 | * is at addr 8086:2c40, instead of 8086:2c41. So, we need |
1335 | * to probe for the alternate address in case of failure | 1335 | * to probe for the alternate address in case of failure |
1336 | */ | 1336 | */ |
1337 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) | 1337 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_I7_NONCORE && !pdev) { |
1338 | pci_dev_get(*prev); /* pci_get_device will put it */ | ||
1338 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1339 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
1339 | PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); | 1340 | PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT, *prev); |
1341 | } | ||
1340 | 1342 | ||
1341 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && !pdev) | 1343 | if (dev_descr->dev_id == PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE && |
1344 | !pdev) { | ||
1345 | pci_dev_get(*prev); /* pci_get_device will put it */ | ||
1342 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | 1346 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, |
1343 | PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, | 1347 | PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT, |
1344 | *prev); | 1348 | *prev); |
1349 | } | ||
1345 | 1350 | ||
1346 | if (!pdev) { | 1351 | if (!pdev) { |
1347 | if (*prev) { | 1352 | if (*prev) { |
diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index c20602f601ee..98a14f6143a7 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c | |||
@@ -222,27 +222,19 @@ static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info) | |||
222 | struct snd_soc_dapm_context *dapm = arizona->dapm; | 222 | struct snd_soc_dapm_context *dapm = arizona->dapm; |
223 | int ret; | 223 | int ret; |
224 | 224 | ||
225 | mutex_lock(&dapm->card->dapm_mutex); | ||
226 | |||
227 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); | 225 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); |
228 | if (ret != 0) | 226 | if (ret != 0) |
229 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", | 227 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", |
230 | widget, ret); | 228 | widget, ret); |
231 | 229 | ||
232 | mutex_unlock(&dapm->card->dapm_mutex); | ||
233 | |||
234 | snd_soc_dapm_sync(dapm); | 230 | snd_soc_dapm_sync(dapm); |
235 | 231 | ||
236 | if (!arizona->pdata.micd_force_micbias) { | 232 | if (!arizona->pdata.micd_force_micbias) { |
237 | mutex_lock(&dapm->card->dapm_mutex); | ||
238 | |||
239 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); | 233 | ret = snd_soc_dapm_disable_pin(arizona->dapm, widget); |
240 | if (ret != 0) | 234 | if (ret != 0) |
241 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", | 235 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", |
242 | widget, ret); | 236 | widget, ret); |
243 | 237 | ||
244 | mutex_unlock(&dapm->card->dapm_mutex); | ||
245 | |||
246 | snd_soc_dapm_sync(dapm); | 238 | snd_soc_dapm_sync(dapm); |
247 | } | 239 | } |
248 | } | 240 | } |
@@ -304,16 +296,12 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) | |||
304 | ARIZONA_MICD_ENA, 0, | 296 | ARIZONA_MICD_ENA, 0, |
305 | &change); | 297 | &change); |
306 | 298 | ||
307 | mutex_lock(&dapm->card->dapm_mutex); | ||
308 | |||
309 | ret = snd_soc_dapm_disable_pin(dapm, widget); | 299 | ret = snd_soc_dapm_disable_pin(dapm, widget); |
310 | if (ret != 0) | 300 | if (ret != 0) |
311 | dev_warn(arizona->dev, | 301 | dev_warn(arizona->dev, |
312 | "Failed to disable %s: %d\n", | 302 | "Failed to disable %s: %d\n", |
313 | widget, ret); | 303 | widget, ret); |
314 | 304 | ||
315 | mutex_unlock(&dapm->card->dapm_mutex); | ||
316 | |||
317 | snd_soc_dapm_sync(dapm); | 305 | snd_soc_dapm_sync(dapm); |
318 | 306 | ||
319 | if (info->micd_reva) { | 307 | if (info->micd_reva) { |
diff --git a/drivers/fmc/fmc-write-eeprom.c b/drivers/fmc/fmc-write-eeprom.c index ee5b47904130..9bb2cbd5c9f2 100644 --- a/drivers/fmc/fmc-write-eeprom.c +++ b/drivers/fmc/fmc-write-eeprom.c | |||
@@ -27,7 +27,7 @@ FMC_PARAM_BUSID(fwe_drv); | |||
27 | /* The "file=" is like the generic "gateware=" used elsewhere */ | 27 | /* The "file=" is like the generic "gateware=" used elsewhere */ |
28 | static char *fwe_file[FMC_MAX_CARDS]; | 28 | static char *fwe_file[FMC_MAX_CARDS]; |
29 | static int fwe_file_n; | 29 | static int fwe_file_n; |
30 | module_param_array_named(file, fwe_file, charp, &fwe_file_n, 444); | 30 | module_param_array_named(file, fwe_file, charp, &fwe_file_n, 0444); |
31 | 31 | ||
32 | static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw, | 32 | static int fwe_run_tlv(struct fmc_device *fmc, const struct firmware *fw, |
33 | int write) | 33 | int write) |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 0d19f4f94d5a..daa4dd375ab1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1774,6 +1774,20 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1774 | return ATOM_PPLL1; | 1774 | return ATOM_PPLL1; |
1775 | DRM_ERROR("unable to allocate a PPLL\n"); | 1775 | DRM_ERROR("unable to allocate a PPLL\n"); |
1776 | return ATOM_PPLL_INVALID; | 1776 | return ATOM_PPLL_INVALID; |
1777 | } else if (ASIC_IS_DCE41(rdev)) { | ||
1778 | /* Don't share PLLs on DCE4.1 chips */ | ||
1779 | if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) { | ||
1780 | if (rdev->clock.dp_extclk) | ||
1781 | /* skip PPLL programming if using ext clock */ | ||
1782 | return ATOM_PPLL_INVALID; | ||
1783 | } | ||
1784 | pll_in_use = radeon_get_pll_use_mask(crtc); | ||
1785 | if (!(pll_in_use & (1 << ATOM_PPLL1))) | ||
1786 | return ATOM_PPLL1; | ||
1787 | if (!(pll_in_use & (1 << ATOM_PPLL2))) | ||
1788 | return ATOM_PPLL2; | ||
1789 | DRM_ERROR("unable to allocate a PPLL\n"); | ||
1790 | return ATOM_PPLL_INVALID; | ||
1777 | } else if (ASIC_IS_DCE4(rdev)) { | 1791 | } else if (ASIC_IS_DCE4(rdev)) { |
1778 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, | 1792 | /* in DP mode, the DP ref clock can come from PPLL, DCPLL, or ext clock, |
1779 | * depending on the asic: | 1793 | * depending on the asic: |
@@ -1801,7 +1815,7 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) | |||
1801 | if (pll != ATOM_PPLL_INVALID) | 1815 | if (pll != ATOM_PPLL_INVALID) |
1802 | return pll; | 1816 | return pll; |
1803 | } | 1817 | } |
1804 | } else if (!ASIC_IS_DCE41(rdev)) { /* Don't share PLLs on DCE4.1 chips */ | 1818 | } else { |
1805 | /* use the same PPLL for all monitors with the same clock */ | 1819 | /* use the same PPLL for all monitors with the same clock */ |
1806 | pll = radeon_get_shared_nondp_ppll(crtc); | 1820 | pll = radeon_get_shared_nondp_ppll(crtc); |
1807 | if (pll != ATOM_PPLL_INVALID) | 1821 | if (pll != ATOM_PPLL_INVALID) |
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c index 713a5d359901..94e858751994 100644 --- a/drivers/gpu/drm/radeon/dce6_afmt.c +++ b/drivers/gpu/drm/radeon/dce6_afmt.c | |||
@@ -278,13 +278,15 @@ static int dce6_audio_chipset_supported(struct radeon_device *rdev) | |||
278 | return !ASIC_IS_NODCE(rdev); | 278 | return !ASIC_IS_NODCE(rdev); |
279 | } | 279 | } |
280 | 280 | ||
281 | static void dce6_audio_enable(struct radeon_device *rdev, | 281 | void dce6_audio_enable(struct radeon_device *rdev, |
282 | struct r600_audio_pin *pin, | 282 | struct r600_audio_pin *pin, |
283 | bool enable) | 283 | bool enable) |
284 | { | 284 | { |
285 | if (!pin) | ||
286 | return; | ||
287 | |||
285 | WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOTPLUG_CONTROL, | 288 | WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOTPLUG_CONTROL, |
286 | AUDIO_ENABLED); | 289 | enable ? AUDIO_ENABLED : 0); |
287 | DRM_INFO("%s audio %d support\n", enable ? "Enabling" : "Disabling", pin->id); | ||
288 | } | 290 | } |
289 | 291 | ||
290 | static const u32 pin_offsets[7] = | 292 | static const u32 pin_offsets[7] = |
@@ -323,7 +325,8 @@ int dce6_audio_init(struct radeon_device *rdev) | |||
323 | rdev->audio.pin[i].connected = false; | 325 | rdev->audio.pin[i].connected = false; |
324 | rdev->audio.pin[i].offset = pin_offsets[i]; | 326 | rdev->audio.pin[i].offset = pin_offsets[i]; |
325 | rdev->audio.pin[i].id = i; | 327 | rdev->audio.pin[i].id = i; |
326 | dce6_audio_enable(rdev, &rdev->audio.pin[i], true); | 328 | /* disable audio. it will be set up later */ |
329 | dce6_audio_enable(rdev, &rdev->audio.pin[i], false); | ||
327 | } | 330 | } |
328 | 331 | ||
329 | return 0; | 332 | return 0; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 5623e7542d99..8a2c010b7dc5 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -5475,9 +5475,9 @@ void evergreen_fini(struct radeon_device *rdev) | |||
5475 | radeon_wb_fini(rdev); | 5475 | radeon_wb_fini(rdev); |
5476 | radeon_ib_pool_fini(rdev); | 5476 | radeon_ib_pool_fini(rdev); |
5477 | radeon_irq_kms_fini(rdev); | 5477 | radeon_irq_kms_fini(rdev); |
5478 | evergreen_pcie_gart_fini(rdev); | ||
5479 | uvd_v1_0_fini(rdev); | 5478 | uvd_v1_0_fini(rdev); |
5480 | radeon_uvd_fini(rdev); | 5479 | radeon_uvd_fini(rdev); |
5480 | evergreen_pcie_gart_fini(rdev); | ||
5481 | r600_vram_scratch_fini(rdev); | 5481 | r600_vram_scratch_fini(rdev); |
5482 | radeon_gem_fini(rdev); | 5482 | radeon_gem_fini(rdev); |
5483 | radeon_fence_driver_fini(rdev); | 5483 | radeon_fence_driver_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 0c6d5cef4cf1..05b0c95813fd 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -306,6 +306,15 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
306 | return; | 306 | return; |
307 | offset = dig->afmt->offset; | 307 | offset = dig->afmt->offset; |
308 | 308 | ||
309 | /* disable audio prior to setting up hw */ | ||
310 | if (ASIC_IS_DCE6(rdev)) { | ||
311 | dig->afmt->pin = dce6_audio_get_pin(rdev); | ||
312 | dce6_audio_enable(rdev, dig->afmt->pin, false); | ||
313 | } else { | ||
314 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
315 | r600_audio_enable(rdev, dig->afmt->pin, false); | ||
316 | } | ||
317 | |||
309 | evergreen_audio_set_dto(encoder, mode->clock); | 318 | evergreen_audio_set_dto(encoder, mode->clock); |
310 | 319 | ||
311 | WREG32(HDMI_VBI_PACKET_CONTROL + offset, | 320 | WREG32(HDMI_VBI_PACKET_CONTROL + offset, |
@@ -409,12 +418,16 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
409 | WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF); | 418 | WREG32(AFMT_RAMP_CONTROL1 + offset, 0x007FFFFF); |
410 | WREG32(AFMT_RAMP_CONTROL2 + offset, 0x00000001); | 419 | WREG32(AFMT_RAMP_CONTROL2 + offset, 0x00000001); |
411 | WREG32(AFMT_RAMP_CONTROL3 + offset, 0x00000001); | 420 | WREG32(AFMT_RAMP_CONTROL3 + offset, 0x00000001); |
421 | |||
422 | /* enable audio after to setting up hw */ | ||
423 | if (ASIC_IS_DCE6(rdev)) | ||
424 | dce6_audio_enable(rdev, dig->afmt->pin, true); | ||
425 | else | ||
426 | r600_audio_enable(rdev, dig->afmt->pin, true); | ||
412 | } | 427 | } |
413 | 428 | ||
414 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | 429 | void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) |
415 | { | 430 | { |
416 | struct drm_device *dev = encoder->dev; | ||
417 | struct radeon_device *rdev = dev->dev_private; | ||
418 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 431 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
419 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 432 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
420 | 433 | ||
@@ -427,15 +440,6 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
427 | if (!enable && !dig->afmt->enabled) | 440 | if (!enable && !dig->afmt->enabled) |
428 | return; | 441 | return; |
429 | 442 | ||
430 | if (enable) { | ||
431 | if (ASIC_IS_DCE6(rdev)) | ||
432 | dig->afmt->pin = dce6_audio_get_pin(rdev); | ||
433 | else | ||
434 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
435 | } else { | ||
436 | dig->afmt->pin = NULL; | ||
437 | } | ||
438 | |||
439 | dig->afmt->enabled = enable; | 443 | dig->afmt->enabled = enable; |
440 | 444 | ||
441 | DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n", | 445 | DRM_DEBUG("%sabling HDMI interface @ 0x%04X for encoder 0x%x\n", |
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index 47fc2b886979..bffac10c4296 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c | |||
@@ -142,12 +142,15 @@ void r600_audio_update_hdmi(struct work_struct *work) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /* enable the audio stream */ | 144 | /* enable the audio stream */ |
145 | static void r600_audio_enable(struct radeon_device *rdev, | 145 | void r600_audio_enable(struct radeon_device *rdev, |
146 | struct r600_audio_pin *pin, | 146 | struct r600_audio_pin *pin, |
147 | bool enable) | 147 | bool enable) |
148 | { | 148 | { |
149 | u32 value = 0; | 149 | u32 value = 0; |
150 | 150 | ||
151 | if (!pin) | ||
152 | return; | ||
153 | |||
151 | if (ASIC_IS_DCE4(rdev)) { | 154 | if (ASIC_IS_DCE4(rdev)) { |
152 | if (enable) { | 155 | if (enable) { |
153 | value |= 0x81000000; /* Required to enable audio */ | 156 | value |= 0x81000000; /* Required to enable audio */ |
@@ -158,7 +161,6 @@ static void r600_audio_enable(struct radeon_device *rdev, | |||
158 | WREG32_P(R600_AUDIO_ENABLE, | 161 | WREG32_P(R600_AUDIO_ENABLE, |
159 | enable ? 0x81000000 : 0x0, ~0x81000000); | 162 | enable ? 0x81000000 : 0x0, ~0x81000000); |
160 | } | 163 | } |
161 | DRM_INFO("%s audio %d support\n", enable ? "Enabling" : "Disabling", pin->id); | ||
162 | } | 164 | } |
163 | 165 | ||
164 | /* | 166 | /* |
@@ -178,8 +180,8 @@ int r600_audio_init(struct radeon_device *rdev) | |||
178 | rdev->audio.pin[0].status_bits = 0; | 180 | rdev->audio.pin[0].status_bits = 0; |
179 | rdev->audio.pin[0].category_code = 0; | 181 | rdev->audio.pin[0].category_code = 0; |
180 | rdev->audio.pin[0].id = 0; | 182 | rdev->audio.pin[0].id = 0; |
181 | 183 | /* disable audio. it will be set up later */ | |
182 | r600_audio_enable(rdev, &rdev->audio.pin[0], true); | 184 | r600_audio_enable(rdev, &rdev->audio.pin[0], false); |
183 | 185 | ||
184 | return 0; | 186 | return 0; |
185 | } | 187 | } |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 3016fc14f502..85a2bb28aed2 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -329,9 +329,6 @@ static void dce3_2_afmt_write_speaker_allocation(struct drm_encoder *encoder) | |||
329 | u8 *sadb; | 329 | u8 *sadb; |
330 | int sad_count; | 330 | int sad_count; |
331 | 331 | ||
332 | /* XXX: setting this register causes hangs on some asics */ | ||
333 | return; | ||
334 | |||
335 | list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { | 332 | list_for_each_entry(connector, &encoder->dev->mode_config.connector_list, head) { |
336 | if (connector->encoder == encoder) { | 333 | if (connector->encoder == encoder) { |
337 | radeon_connector = to_radeon_connector(connector); | 334 | radeon_connector = to_radeon_connector(connector); |
@@ -460,6 +457,10 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
460 | return; | 457 | return; |
461 | offset = dig->afmt->offset; | 458 | offset = dig->afmt->offset; |
462 | 459 | ||
460 | /* disable audio prior to setting up hw */ | ||
461 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
462 | r600_audio_enable(rdev, dig->afmt->pin, false); | ||
463 | |||
463 | r600_audio_set_dto(encoder, mode->clock); | 464 | r600_audio_set_dto(encoder, mode->clock); |
464 | 465 | ||
465 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, | 466 | WREG32(HDMI0_VBI_PACKET_CONTROL + offset, |
@@ -531,6 +532,9 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
531 | WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001); | 532 | WREG32(HDMI0_RAMP_CONTROL3 + offset, 0x00000001); |
532 | 533 | ||
533 | r600_hdmi_audio_workaround(encoder); | 534 | r600_hdmi_audio_workaround(encoder); |
535 | |||
536 | /* enable audio after to setting up hw */ | ||
537 | r600_audio_enable(rdev, dig->afmt->pin, true); | ||
534 | } | 538 | } |
535 | 539 | ||
536 | /* | 540 | /* |
@@ -651,11 +655,6 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
651 | if (!enable && !dig->afmt->enabled) | 655 | if (!enable && !dig->afmt->enabled) |
652 | return; | 656 | return; |
653 | 657 | ||
654 | if (enable) | ||
655 | dig->afmt->pin = r600_audio_get_pin(rdev); | ||
656 | else | ||
657 | dig->afmt->pin = NULL; | ||
658 | |||
659 | /* Older chipsets require setting HDMI and routing manually */ | 658 | /* Older chipsets require setting HDMI and routing manually */ |
660 | if (!ASIC_IS_DCE3(rdev)) { | 659 | if (!ASIC_IS_DCE3(rdev)) { |
661 | if (enable) | 660 | if (enable) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 024db37b1832..e887d027b6d0 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -2747,6 +2747,12 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
2747 | void r600_audio_update_hdmi(struct work_struct *work); | 2747 | void r600_audio_update_hdmi(struct work_struct *work); |
2748 | struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev); | 2748 | struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev); |
2749 | struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev); | 2749 | struct r600_audio_pin *dce6_audio_get_pin(struct radeon_device *rdev); |
2750 | void r600_audio_enable(struct radeon_device *rdev, | ||
2751 | struct r600_audio_pin *pin, | ||
2752 | bool enable); | ||
2753 | void dce6_audio_enable(struct radeon_device *rdev, | ||
2754 | struct r600_audio_pin *pin, | ||
2755 | bool enable); | ||
2750 | 2756 | ||
2751 | /* | 2757 | /* |
2752 | * R600 vram scratch functions | 2758 | * R600 vram scratch functions |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 485848f889f5..fa9a9c02751e 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -219,7 +219,8 @@ static int radeon_atpx_verify_interface(struct radeon_atpx *atpx) | |||
219 | memcpy(&output, info->buffer.pointer, size); | 219 | memcpy(&output, info->buffer.pointer, size); |
220 | 220 | ||
221 | /* TODO: check version? */ | 221 | /* TODO: check version? */ |
222 | printk("ATPX version %u\n", output.version); | 222 | printk("ATPX version %u, functions 0x%08x\n", |
223 | output.version, output.function_bits); | ||
223 | 224 | ||
224 | radeon_atpx_parse_functions(&atpx->functions, output.function_bits); | 225 | radeon_atpx_parse_functions(&atpx->functions, output.function_bits); |
225 | 226 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 114d1672d616..2aecd6dc2610 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -537,6 +537,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
537 | 537 | ||
538 | radeon_vm_init(rdev, &fpriv->vm); | 538 | radeon_vm_init(rdev, &fpriv->vm); |
539 | 539 | ||
540 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | ||
541 | if (r) | ||
542 | return r; | ||
543 | |||
540 | /* map the ib pool buffer read only into | 544 | /* map the ib pool buffer read only into |
541 | * virtual address space */ | 545 | * virtual address space */ |
542 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, | 546 | bo_va = radeon_vm_bo_add(rdev, &fpriv->vm, |
@@ -544,6 +548,8 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
544 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, | 548 | r = radeon_vm_bo_set_addr(rdev, bo_va, RADEON_VA_IB_OFFSET, |
545 | RADEON_VM_PAGE_READABLE | | 549 | RADEON_VM_PAGE_READABLE | |
546 | RADEON_VM_PAGE_SNOOPED); | 550 | RADEON_VM_PAGE_SNOOPED); |
551 | |||
552 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); | ||
547 | if (r) { | 553 | if (r) { |
548 | radeon_vm_fini(rdev, &fpriv->vm); | 554 | radeon_vm_fini(rdev, &fpriv->vm); |
549 | kfree(fpriv); | 555 | kfree(fpriv); |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 6781fee1eaad..3e6804b2b2ef 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -171,6 +171,8 @@ void radeon_uvd_fini(struct radeon_device *rdev) | |||
171 | 171 | ||
172 | radeon_bo_unref(&rdev->uvd.vcpu_bo); | 172 | radeon_bo_unref(&rdev->uvd.vcpu_bo); |
173 | 173 | ||
174 | radeon_ring_fini(rdev, &rdev->ring[R600_RING_TYPE_UVD_INDEX]); | ||
175 | |||
174 | release_firmware(rdev->uvd_fw); | 176 | release_firmware(rdev->uvd_fw); |
175 | } | 177 | } |
176 | 178 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 6c772e58c784..4e37a42305d8 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1955,9 +1955,9 @@ void rv770_fini(struct radeon_device *rdev) | |||
1955 | radeon_wb_fini(rdev); | 1955 | radeon_wb_fini(rdev); |
1956 | radeon_ib_pool_fini(rdev); | 1956 | radeon_ib_pool_fini(rdev); |
1957 | radeon_irq_kms_fini(rdev); | 1957 | radeon_irq_kms_fini(rdev); |
1958 | rv770_pcie_gart_fini(rdev); | ||
1959 | uvd_v1_0_fini(rdev); | 1958 | uvd_v1_0_fini(rdev); |
1960 | radeon_uvd_fini(rdev); | 1959 | radeon_uvd_fini(rdev); |
1960 | rv770_pcie_gart_fini(rdev); | ||
1961 | r600_vram_scratch_fini(rdev); | 1961 | r600_vram_scratch_fini(rdev); |
1962 | radeon_gem_fini(rdev); | 1962 | radeon_gem_fini(rdev); |
1963 | radeon_fence_driver_fini(rdev); | 1963 | radeon_fence_driver_fini(rdev); |
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 88a529008ce0..c71594754f46 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c | |||
@@ -104,7 +104,7 @@ static void tegra_drm_context_free(struct tegra_drm_context *context) | |||
104 | 104 | ||
105 | static void tegra_drm_lastclose(struct drm_device *drm) | 105 | static void tegra_drm_lastclose(struct drm_device *drm) |
106 | { | 106 | { |
107 | #ifdef CONFIG_TEGRA_DRM_FBDEV | 107 | #ifdef CONFIG_DRM_TEGRA_FBDEV |
108 | struct tegra_drm *tegra = drm->dev_private; | 108 | struct tegra_drm *tegra = drm->dev_private; |
109 | 109 | ||
110 | tegra_fbdev_restore_mode(tegra->fbdev); | 110 | tegra_fbdev_restore_mode(tegra->fbdev); |
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c index 338f7f6561d7..0266fb40479e 100644 --- a/drivers/gpu/drm/tegra/rgb.c +++ b/drivers/gpu/drm/tegra/rgb.c | |||
@@ -15,6 +15,7 @@ | |||
15 | struct tegra_rgb { | 15 | struct tegra_rgb { |
16 | struct tegra_output output; | 16 | struct tegra_output output; |
17 | struct tegra_dc *dc; | 17 | struct tegra_dc *dc; |
18 | bool enabled; | ||
18 | 19 | ||
19 | struct clk *clk_parent; | 20 | struct clk *clk_parent; |
20 | struct clk *clk; | 21 | struct clk *clk; |
@@ -89,6 +90,9 @@ static int tegra_output_rgb_enable(struct tegra_output *output) | |||
89 | struct tegra_rgb *rgb = to_rgb(output); | 90 | struct tegra_rgb *rgb = to_rgb(output); |
90 | unsigned long value; | 91 | unsigned long value; |
91 | 92 | ||
93 | if (rgb->enabled) | ||
94 | return 0; | ||
95 | |||
92 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); | 96 | tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); |
93 | 97 | ||
94 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; | 98 | value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL; |
@@ -122,6 +126,8 @@ static int tegra_output_rgb_enable(struct tegra_output *output) | |||
122 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL); | 126 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL); |
123 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); | 127 | tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL); |
124 | 128 | ||
129 | rgb->enabled = true; | ||
130 | |||
125 | return 0; | 131 | return 0; |
126 | } | 132 | } |
127 | 133 | ||
@@ -130,6 +136,9 @@ static int tegra_output_rgb_disable(struct tegra_output *output) | |||
130 | struct tegra_rgb *rgb = to_rgb(output); | 136 | struct tegra_rgb *rgb = to_rgb(output); |
131 | unsigned long value; | 137 | unsigned long value; |
132 | 138 | ||
139 | if (!rgb->enabled) | ||
140 | return 0; | ||
141 | |||
133 | value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL); | 142 | value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL); |
134 | value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE | | 143 | value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE | |
135 | PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); | 144 | PW4_ENABLE | PM0_ENABLE | PM1_ENABLE); |
@@ -144,6 +153,8 @@ static int tegra_output_rgb_disable(struct tegra_output *output) | |||
144 | 153 | ||
145 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); | 154 | tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); |
146 | 155 | ||
156 | rgb->enabled = false; | ||
157 | |||
147 | return 0; | 158 | return 0; |
148 | } | 159 | } |
149 | 160 | ||
diff --git a/drivers/gpu/drm/vmwgfx/svga3d_reg.h b/drivers/gpu/drm/vmwgfx/svga3d_reg.h index bb594c11605e..f58dc7dd15c5 100644 --- a/drivers/gpu/drm/vmwgfx/svga3d_reg.h +++ b/drivers/gpu/drm/vmwgfx/svga3d_reg.h | |||
@@ -261,12 +261,7 @@ typedef enum SVGA3dSurfaceFormat { | |||
261 | /* Planar video formats. */ | 261 | /* Planar video formats. */ |
262 | SVGA3D_YV12 = 121, | 262 | SVGA3D_YV12 = 121, |
263 | 263 | ||
264 | /* Shader constant formats. */ | 264 | SVGA3D_FORMAT_MAX = 122, |
265 | SVGA3D_SURFACE_SHADERCONST_FLOAT = 122, | ||
266 | SVGA3D_SURFACE_SHADERCONST_INT = 123, | ||
267 | SVGA3D_SURFACE_SHADERCONST_BOOL = 124, | ||
268 | |||
269 | SVGA3D_FORMAT_MAX = 125, | ||
270 | } SVGA3dSurfaceFormat; | 265 | } SVGA3dSurfaceFormat; |
271 | 266 | ||
272 | typedef uint32 SVGA3dColor; /* a, r, g, b */ | 267 | typedef uint32 SVGA3dColor; /* a, r, g, b */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 9e4be1725985..07831554dad7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <drm/ttm/ttm_module.h> | 40 | #include <drm/ttm/ttm_module.h> |
41 | #include "vmwgfx_fence.h" | 41 | #include "vmwgfx_fence.h" |
42 | 42 | ||
43 | #define VMWGFX_DRIVER_DATE "20121114" | 43 | #define VMWGFX_DRIVER_DATE "20140228" |
44 | #define VMWGFX_DRIVER_MAJOR 2 | 44 | #define VMWGFX_DRIVER_MAJOR 2 |
45 | #define VMWGFX_DRIVER_MINOR 5 | 45 | #define VMWGFX_DRIVER_MINOR 5 |
46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 | 46 | #define VMWGFX_DRIVER_PATCHLEVEL 0 |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c index d4a5a19cb8c3..04a64b8cd3cd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_mob.c | |||
@@ -188,18 +188,20 @@ static void vmw_takedown_otable_base(struct vmw_private *dev_priv, | |||
188 | 188 | ||
189 | bo = otable->page_table->pt_bo; | 189 | bo = otable->page_table->pt_bo; |
190 | cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); | 190 | cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd)); |
191 | if (unlikely(cmd == NULL)) | 191 | if (unlikely(cmd == NULL)) { |
192 | DRM_ERROR("Failed reserving FIFO space for OTable setup.\n"); | 192 | DRM_ERROR("Failed reserving FIFO space for OTable " |
193 | 193 | "takedown.\n"); | |
194 | memset(cmd, 0, sizeof(*cmd)); | 194 | } else { |
195 | cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE; | 195 | memset(cmd, 0, sizeof(*cmd)); |
196 | cmd->header.size = sizeof(cmd->body); | 196 | cmd->header.id = SVGA_3D_CMD_SET_OTABLE_BASE; |
197 | cmd->body.type = type; | 197 | cmd->header.size = sizeof(cmd->body); |
198 | cmd->body.baseAddress = 0; | 198 | cmd->body.type = type; |
199 | cmd->body.sizeInBytes = 0; | 199 | cmd->body.baseAddress = 0; |
200 | cmd->body.validSizeInBytes = 0; | 200 | cmd->body.sizeInBytes = 0; |
201 | cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID; | 201 | cmd->body.validSizeInBytes = 0; |
202 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | 202 | cmd->body.ptDepth = SVGA3D_MOBFMT_INVALID; |
203 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
204 | } | ||
203 | 205 | ||
204 | if (bo) { | 206 | if (bo) { |
205 | int ret; | 207 | int ret; |
@@ -562,11 +564,12 @@ void vmw_mob_unbind(struct vmw_private *dev_priv, | |||
562 | if (unlikely(cmd == NULL)) { | 564 | if (unlikely(cmd == NULL)) { |
563 | DRM_ERROR("Failed reserving FIFO space for Memory " | 565 | DRM_ERROR("Failed reserving FIFO space for Memory " |
564 | "Object unbinding.\n"); | 566 | "Object unbinding.\n"); |
567 | } else { | ||
568 | cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB; | ||
569 | cmd->header.size = sizeof(cmd->body); | ||
570 | cmd->body.mobid = mob->id; | ||
571 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
565 | } | 572 | } |
566 | cmd->header.id = SVGA_3D_CMD_DESTROY_GB_MOB; | ||
567 | cmd->header.size = sizeof(cmd->body); | ||
568 | cmd->body.mobid = mob->id; | ||
569 | vmw_fifo_commit(dev_priv, sizeof(*cmd)); | ||
570 | if (bo) { | 573 | if (bo) { |
571 | vmw_fence_single_bo(bo, NULL); | 574 | vmw_fence_single_bo(bo, NULL); |
572 | ttm_bo_unreserve(bo); | 575 | ttm_bo_unreserve(bo); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 2aa4bc6a4d60..9757b57f8388 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -427,8 +427,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, | |||
427 | INIT_LIST_HEAD(&vmw_bo->res_list); | 427 | INIT_LIST_HEAD(&vmw_bo->res_list); |
428 | 428 | ||
429 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, | 429 | ret = ttm_bo_init(bdev, &vmw_bo->base, size, |
430 | (user) ? ttm_bo_type_device : | 430 | ttm_bo_type_device, placement, |
431 | ttm_bo_type_kernel, placement, | ||
432 | 0, interruptible, | 431 | 0, interruptible, |
433 | NULL, acc_size, NULL, bo_free); | 432 | NULL, acc_size, NULL, bo_free); |
434 | return ret; | 433 | return ret; |
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 1146e3bba6e1..112f27e51bc7 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c | |||
@@ -538,7 +538,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) | |||
538 | 538 | ||
539 | g->base = job->gather_addr_phys[i]; | 539 | g->base = job->gather_addr_phys[i]; |
540 | 540 | ||
541 | for (j = 0; j < job->num_gathers; j++) | 541 | for (j = i + 1; j < job->num_gathers; j++) |
542 | if (job->gathers[j].bo == g->bo) | 542 | if (job->gathers[j].bo == g->bo) |
543 | job->gathers[j].handled = true; | 543 | job->gathers[j].handled = true; |
544 | 544 | ||
diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig index 41c64a43bcab..ac2d69e34c8c 100644 --- a/drivers/iio/gyro/Kconfig +++ b/drivers/iio/gyro/Kconfig | |||
@@ -70,7 +70,7 @@ config IIO_ST_GYRO_3AXIS | |||
70 | select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) | 70 | select IIO_TRIGGERED_BUFFER if (IIO_BUFFER) |
71 | help | 71 | help |
72 | Say yes here to build support for STMicroelectronics gyroscopes: | 72 | Say yes here to build support for STMicroelectronics gyroscopes: |
73 | L3G4200D, LSM330DL, L3GD20, L3GD20H, LSM330DLC, L3G4IS, LSM330. | 73 | L3G4200D, LSM330DL, L3GD20, LSM330DLC, L3G4IS, LSM330. |
74 | 74 | ||
75 | This driver can also be built as a module. If so, these modules | 75 | This driver can also be built as a module. If so, these modules |
76 | will be created: | 76 | will be created: |
diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h index f8f2bf84a5a2..c197360c450b 100644 --- a/drivers/iio/gyro/st_gyro.h +++ b/drivers/iio/gyro/st_gyro.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" | 19 | #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro" |
20 | #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" | 20 | #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" |
21 | #define L3GD20_GYRO_DEV_NAME "l3gd20" | 21 | #define L3GD20_GYRO_DEV_NAME "l3gd20" |
22 | #define L3GD20H_GYRO_DEV_NAME "l3gd20h" | ||
23 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" | 22 | #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" |
24 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" | 23 | #define LSM330_GYRO_DEV_NAME "lsm330_gyro" |
25 | 24 | ||
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index d53d91adfb55..a8e174a47bc4 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
@@ -167,11 +167,10 @@ static const struct st_sensors st_gyro_sensors[] = { | |||
167 | .wai = ST_GYRO_2_WAI_EXP, | 167 | .wai = ST_GYRO_2_WAI_EXP, |
168 | .sensors_supported = { | 168 | .sensors_supported = { |
169 | [0] = L3GD20_GYRO_DEV_NAME, | 169 | [0] = L3GD20_GYRO_DEV_NAME, |
170 | [1] = L3GD20H_GYRO_DEV_NAME, | 170 | [1] = LSM330D_GYRO_DEV_NAME, |
171 | [2] = LSM330D_GYRO_DEV_NAME, | 171 | [2] = LSM330DLC_GYRO_DEV_NAME, |
172 | [3] = LSM330DLC_GYRO_DEV_NAME, | 172 | [3] = L3G4IS_GYRO_DEV_NAME, |
173 | [4] = L3G4IS_GYRO_DEV_NAME, | 173 | [4] = LSM330_GYRO_DEV_NAME, |
174 | [5] = LSM330_GYRO_DEV_NAME, | ||
175 | }, | 174 | }, |
176 | .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, | 175 | .ch = (struct iio_chan_spec *)st_gyro_16bit_channels, |
177 | .odr = { | 176 | .odr = { |
diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c index 16b8b8d70bf1..23c12f361b05 100644 --- a/drivers/iio/gyro/st_gyro_i2c.c +++ b/drivers/iio/gyro/st_gyro_i2c.c | |||
@@ -55,7 +55,6 @@ static const struct i2c_device_id st_gyro_id_table[] = { | |||
55 | { LSM330DL_GYRO_DEV_NAME }, | 55 | { LSM330DL_GYRO_DEV_NAME }, |
56 | { LSM330DLC_GYRO_DEV_NAME }, | 56 | { LSM330DLC_GYRO_DEV_NAME }, |
57 | { L3GD20_GYRO_DEV_NAME }, | 57 | { L3GD20_GYRO_DEV_NAME }, |
58 | { L3GD20H_GYRO_DEV_NAME }, | ||
59 | { L3G4IS_GYRO_DEV_NAME }, | 58 | { L3G4IS_GYRO_DEV_NAME }, |
60 | { LSM330_GYRO_DEV_NAME }, | 59 | { LSM330_GYRO_DEV_NAME }, |
61 | {}, | 60 | {}, |
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c index 94763e25caf9..b4ad3be26687 100644 --- a/drivers/iio/gyro/st_gyro_spi.c +++ b/drivers/iio/gyro/st_gyro_spi.c | |||
@@ -54,7 +54,6 @@ static const struct spi_device_id st_gyro_id_table[] = { | |||
54 | { LSM330DL_GYRO_DEV_NAME }, | 54 | { LSM330DL_GYRO_DEV_NAME }, |
55 | { LSM330DLC_GYRO_DEV_NAME }, | 55 | { LSM330DLC_GYRO_DEV_NAME }, |
56 | { L3GD20_GYRO_DEV_NAME }, | 56 | { L3GD20_GYRO_DEV_NAME }, |
57 | { L3GD20H_GYRO_DEV_NAME }, | ||
58 | { L3G4IS_GYRO_DEV_NAME }, | 57 | { L3G4IS_GYRO_DEV_NAME }, |
59 | { LSM330_GYRO_DEV_NAME }, | 58 | { LSM330_GYRO_DEV_NAME }, |
60 | {}, | 59 | {}, |
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index f17b4e6183c6..47a6dbac2d0c 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c | |||
@@ -103,13 +103,13 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181) | |||
103 | /** | 103 | /** |
104 | * cm32181_read_als_it() - Get sensor integration time (ms) | 104 | * cm32181_read_als_it() - Get sensor integration time (ms) |
105 | * @cm32181: pointer of struct cm32181 | 105 | * @cm32181: pointer of struct cm32181 |
106 | * @val: pointer of int to load the als_it value. | 106 | * @val2: pointer of int to load the als_it value. |
107 | * | 107 | * |
108 | * Report the current integartion time by millisecond. | 108 | * Report the current integartion time by millisecond. |
109 | * | 109 | * |
110 | * Return: IIO_VAL_INT for success, otherwise -EINVAL. | 110 | * Return: IIO_VAL_INT_PLUS_MICRO for success, otherwise -EINVAL. |
111 | */ | 111 | */ |
112 | static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) | 112 | static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val2) |
113 | { | 113 | { |
114 | u16 als_it; | 114 | u16 als_it; |
115 | int i; | 115 | int i; |
@@ -119,8 +119,8 @@ static int cm32181_read_als_it(struct cm32181_chip *cm32181, int *val) | |||
119 | als_it >>= CM32181_CMD_ALS_IT_SHIFT; | 119 | als_it >>= CM32181_CMD_ALS_IT_SHIFT; |
120 | for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { | 120 | for (i = 0; i < ARRAY_SIZE(als_it_bits); i++) { |
121 | if (als_it == als_it_bits[i]) { | 121 | if (als_it == als_it_bits[i]) { |
122 | *val = als_it_value[i]; | 122 | *val2 = als_it_value[i]; |
123 | return IIO_VAL_INT; | 123 | return IIO_VAL_INT_PLUS_MICRO; |
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
@@ -221,7 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev, | |||
221 | *val = cm32181->calibscale; | 221 | *val = cm32181->calibscale; |
222 | return IIO_VAL_INT; | 222 | return IIO_VAL_INT; |
223 | case IIO_CHAN_INFO_INT_TIME: | 223 | case IIO_CHAN_INFO_INT_TIME: |
224 | ret = cm32181_read_als_it(cm32181, val); | 224 | ret = cm32181_read_als_it(cm32181, val2); |
225 | return ret; | 225 | return ret; |
226 | } | 226 | } |
227 | 227 | ||
@@ -240,7 +240,7 @@ static int cm32181_write_raw(struct iio_dev *indio_dev, | |||
240 | cm32181->calibscale = val; | 240 | cm32181->calibscale = val; |
241 | return val; | 241 | return val; |
242 | case IIO_CHAN_INFO_INT_TIME: | 242 | case IIO_CHAN_INFO_INT_TIME: |
243 | ret = cm32181_write_als_it(cm32181, val); | 243 | ret = cm32181_write_als_it(cm32181, val2); |
244 | return ret; | 244 | return ret; |
245 | } | 245 | } |
246 | 246 | ||
@@ -264,7 +264,7 @@ static ssize_t cm32181_get_it_available(struct device *dev, | |||
264 | 264 | ||
265 | n = ARRAY_SIZE(als_it_value); | 265 | n = ARRAY_SIZE(als_it_value); |
266 | for (i = 0, len = 0; i < n; i++) | 266 | for (i = 0, len = 0; i < n; i++) |
267 | len += sprintf(buf + len, "%d ", als_it_value[i]); | 267 | len += sprintf(buf + len, "0.%06u ", als_it_value[i]); |
268 | return len + sprintf(buf + len, "\n"); | 268 | return len + sprintf(buf + len, "\n"); |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index 0a142af83e25..a45e07492db3 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c | |||
@@ -50,10 +50,10 @@ | |||
50 | #define CM36651_CS_CONF2_DEFAULT_BIT 0x08 | 50 | #define CM36651_CS_CONF2_DEFAULT_BIT 0x08 |
51 | 51 | ||
52 | /* CS_CONF3 channel integration time */ | 52 | /* CS_CONF3 channel integration time */ |
53 | #define CM36651_CS_IT1 0x00 /* Integration time 80000 usec */ | 53 | #define CM36651_CS_IT1 0x00 /* Integration time 80 msec */ |
54 | #define CM36651_CS_IT2 0x40 /* Integration time 160000 usec */ | 54 | #define CM36651_CS_IT2 0x40 /* Integration time 160 msec */ |
55 | #define CM36651_CS_IT3 0x80 /* Integration time 320000 usec */ | 55 | #define CM36651_CS_IT3 0x80 /* Integration time 320 msec */ |
56 | #define CM36651_CS_IT4 0xC0 /* Integration time 640000 usec */ | 56 | #define CM36651_CS_IT4 0xC0 /* Integration time 640 msec */ |
57 | 57 | ||
58 | /* PS_CONF1 command code */ | 58 | /* PS_CONF1 command code */ |
59 | #define CM36651_PS_ENABLE 0x00 | 59 | #define CM36651_PS_ENABLE 0x00 |
@@ -64,10 +64,10 @@ | |||
64 | #define CM36651_PS_PERS4 0x0C | 64 | #define CM36651_PS_PERS4 0x0C |
65 | 65 | ||
66 | /* PS_CONF1 command code: integration time */ | 66 | /* PS_CONF1 command code: integration time */ |
67 | #define CM36651_PS_IT1 0x00 /* Integration time 320 usec */ | 67 | #define CM36651_PS_IT1 0x00 /* Integration time 0.32 msec */ |
68 | #define CM36651_PS_IT2 0x10 /* Integration time 420 usec */ | 68 | #define CM36651_PS_IT2 0x10 /* Integration time 0.42 msec */ |
69 | #define CM36651_PS_IT3 0x20 /* Integration time 520 usec */ | 69 | #define CM36651_PS_IT3 0x20 /* Integration time 0.52 msec */ |
70 | #define CM36651_PS_IT4 0x30 /* Integration time 640 usec */ | 70 | #define CM36651_PS_IT4 0x30 /* Integration time 0.64 msec */ |
71 | 71 | ||
72 | /* PS_CONF1 command code: duty ratio */ | 72 | /* PS_CONF1 command code: duty ratio */ |
73 | #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */ | 73 | #define CM36651_PS_DR1 0x00 /* Duty ratio 1/80 */ |
@@ -93,8 +93,8 @@ | |||
93 | #define CM36651_CLOSE_PROXIMITY 0x32 | 93 | #define CM36651_CLOSE_PROXIMITY 0x32 |
94 | #define CM36651_FAR_PROXIMITY 0x33 | 94 | #define CM36651_FAR_PROXIMITY 0x33 |
95 | 95 | ||
96 | #define CM36651_CS_INT_TIME_AVAIL "80000 160000 320000 640000" | 96 | #define CM36651_CS_INT_TIME_AVAIL "0.08 0.16 0.32 0.64" |
97 | #define CM36651_PS_INT_TIME_AVAIL "320 420 520 640" | 97 | #define CM36651_PS_INT_TIME_AVAIL "0.000320 0.000420 0.000520 0.000640" |
98 | 98 | ||
99 | enum cm36651_operation_mode { | 99 | enum cm36651_operation_mode { |
100 | CM36651_LIGHT_EN, | 100 | CM36651_LIGHT_EN, |
@@ -356,30 +356,30 @@ static int cm36651_read_channel(struct cm36651_data *cm36651, | |||
356 | } | 356 | } |
357 | 357 | ||
358 | static int cm36651_read_int_time(struct cm36651_data *cm36651, | 358 | static int cm36651_read_int_time(struct cm36651_data *cm36651, |
359 | struct iio_chan_spec const *chan, int *val) | 359 | struct iio_chan_spec const *chan, int *val2) |
360 | { | 360 | { |
361 | switch (chan->type) { | 361 | switch (chan->type) { |
362 | case IIO_LIGHT: | 362 | case IIO_LIGHT: |
363 | if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) | 363 | if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT1) |
364 | *val = 80000; | 364 | *val2 = 80000; |
365 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) | 365 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT2) |
366 | *val = 160000; | 366 | *val2 = 160000; |
367 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) | 367 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT3) |
368 | *val = 320000; | 368 | *val2 = 320000; |
369 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) | 369 | else if (cm36651->cs_int_time[chan->address] == CM36651_CS_IT4) |
370 | *val = 640000; | 370 | *val2 = 640000; |
371 | else | 371 | else |
372 | return -EINVAL; | 372 | return -EINVAL; |
373 | break; | 373 | break; |
374 | case IIO_PROXIMITY: | 374 | case IIO_PROXIMITY: |
375 | if (cm36651->ps_int_time == CM36651_PS_IT1) | 375 | if (cm36651->ps_int_time == CM36651_PS_IT1) |
376 | *val = 320; | 376 | *val2 = 320; |
377 | else if (cm36651->ps_int_time == CM36651_PS_IT2) | 377 | else if (cm36651->ps_int_time == CM36651_PS_IT2) |
378 | *val = 420; | 378 | *val2 = 420; |
379 | else if (cm36651->ps_int_time == CM36651_PS_IT3) | 379 | else if (cm36651->ps_int_time == CM36651_PS_IT3) |
380 | *val = 520; | 380 | *val2 = 520; |
381 | else if (cm36651->ps_int_time == CM36651_PS_IT4) | 381 | else if (cm36651->ps_int_time == CM36651_PS_IT4) |
382 | *val = 640; | 382 | *val2 = 640; |
383 | else | 383 | else |
384 | return -EINVAL; | 384 | return -EINVAL; |
385 | break; | 385 | break; |
@@ -387,7 +387,7 @@ static int cm36651_read_int_time(struct cm36651_data *cm36651, | |||
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | 389 | ||
390 | return IIO_VAL_INT; | 390 | return IIO_VAL_INT_PLUS_MICRO; |
391 | } | 391 | } |
392 | 392 | ||
393 | static int cm36651_write_int_time(struct cm36651_data *cm36651, | 393 | static int cm36651_write_int_time(struct cm36651_data *cm36651, |
@@ -459,7 +459,8 @@ static int cm36651_read_raw(struct iio_dev *indio_dev, | |||
459 | ret = cm36651_read_channel(cm36651, chan, val); | 459 | ret = cm36651_read_channel(cm36651, chan, val); |
460 | break; | 460 | break; |
461 | case IIO_CHAN_INFO_INT_TIME: | 461 | case IIO_CHAN_INFO_INT_TIME: |
462 | ret = cm36651_read_int_time(cm36651, chan, val); | 462 | *val = 0; |
463 | ret = cm36651_read_int_time(cm36651, chan, val2); | ||
463 | break; | 464 | break; |
464 | default: | 465 | default: |
465 | ret = -EINVAL; | 466 | ret = -EINVAL; |
@@ -479,7 +480,7 @@ static int cm36651_write_raw(struct iio_dev *indio_dev, | |||
479 | int ret = -EINVAL; | 480 | int ret = -EINVAL; |
480 | 481 | ||
481 | if (mask == IIO_CHAN_INFO_INT_TIME) { | 482 | if (mask == IIO_CHAN_INFO_INT_TIME) { |
482 | ret = cm36651_write_int_time(cm36651, chan, val); | 483 | ret = cm36651_write_int_time(cm36651, chan, val2); |
483 | if (ret < 0) | 484 | if (ret < 0) |
484 | dev_err(&client->dev, "Integration time write failed\n"); | 485 | dev_err(&client->dev, "Integration time write failed\n"); |
485 | } | 486 | } |
diff --git a/drivers/input/misc/arizona-haptics.c b/drivers/input/misc/arizona-haptics.c index 7a04f54ef961..ef2e281b0a43 100644 --- a/drivers/input/misc/arizona-haptics.c +++ b/drivers/input/misc/arizona-haptics.c | |||
@@ -37,7 +37,6 @@ static void arizona_haptics_work(struct work_struct *work) | |||
37 | struct arizona_haptics, | 37 | struct arizona_haptics, |
38 | work); | 38 | work); |
39 | struct arizona *arizona = haptics->arizona; | 39 | struct arizona *arizona = haptics->arizona; |
40 | struct mutex *dapm_mutex = &arizona->dapm->card->dapm_mutex; | ||
41 | int ret; | 40 | int ret; |
42 | 41 | ||
43 | if (!haptics->arizona->dapm) { | 42 | if (!haptics->arizona->dapm) { |
@@ -67,13 +66,10 @@ static void arizona_haptics_work(struct work_struct *work) | |||
67 | return; | 66 | return; |
68 | } | 67 | } |
69 | 68 | ||
70 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
71 | |||
72 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); | 69 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); |
73 | if (ret != 0) { | 70 | if (ret != 0) { |
74 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", | 71 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", |
75 | ret); | 72 | ret); |
76 | mutex_unlock(dapm_mutex); | ||
77 | return; | 73 | return; |
78 | } | 74 | } |
79 | 75 | ||
@@ -81,21 +77,14 @@ static void arizona_haptics_work(struct work_struct *work) | |||
81 | if (ret != 0) { | 77 | if (ret != 0) { |
82 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 78 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
83 | ret); | 79 | ret); |
84 | mutex_unlock(dapm_mutex); | ||
85 | return; | 80 | return; |
86 | } | 81 | } |
87 | |||
88 | mutex_unlock(dapm_mutex); | ||
89 | |||
90 | } else { | 82 | } else { |
91 | /* This disable sequence will be a noop if already enabled */ | 83 | /* This disable sequence will be a noop if already enabled */ |
92 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
93 | |||
94 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); | 84 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); |
95 | if (ret != 0) { | 85 | if (ret != 0) { |
96 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", | 86 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", |
97 | ret); | 87 | ret); |
98 | mutex_unlock(dapm_mutex); | ||
99 | return; | 88 | return; |
100 | } | 89 | } |
101 | 90 | ||
@@ -103,12 +92,9 @@ static void arizona_haptics_work(struct work_struct *work) | |||
103 | if (ret != 0) { | 92 | if (ret != 0) { |
104 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", | 93 | dev_err(arizona->dev, "Failed to sync DAPM: %d\n", |
105 | ret); | 94 | ret); |
106 | mutex_unlock(dapm_mutex); | ||
107 | return; | 95 | return; |
108 | } | 96 | } |
109 | 97 | ||
110 | mutex_unlock(dapm_mutex); | ||
111 | |||
112 | ret = regmap_update_bits(arizona->regmap, | 98 | ret = regmap_update_bits(arizona->regmap, |
113 | ARIZONA_HAPTICS_CONTROL_1, | 99 | ARIZONA_HAPTICS_CONTROL_1, |
114 | ARIZONA_HAP_CTRL_MASK, | 100 | ARIZONA_HAP_CTRL_MASK, |
@@ -155,16 +141,11 @@ static int arizona_haptics_play(struct input_dev *input, void *data, | |||
155 | static void arizona_haptics_close(struct input_dev *input) | 141 | static void arizona_haptics_close(struct input_dev *input) |
156 | { | 142 | { |
157 | struct arizona_haptics *haptics = input_get_drvdata(input); | 143 | struct arizona_haptics *haptics = input_get_drvdata(input); |
158 | struct mutex *dapm_mutex = &haptics->arizona->dapm->card->dapm_mutex; | ||
159 | 144 | ||
160 | cancel_work_sync(&haptics->work); | 145 | cancel_work_sync(&haptics->work); |
161 | 146 | ||
162 | mutex_lock_nested(dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
163 | |||
164 | if (haptics->arizona->dapm) | 147 | if (haptics->arizona->dapm) |
165 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); | 148 | snd_soc_dapm_disable_pin(haptics->arizona->dapm, "HAPTICS"); |
166 | |||
167 | mutex_unlock(dapm_mutex); | ||
168 | } | 149 | } |
169 | 150 | ||
170 | static int arizona_haptics_probe(struct platform_device *pdev) | 151 | static int arizona_haptics_probe(struct platform_device *pdev) |
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index d97fbe4fb9b1..80fffba7f12d 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -354,8 +354,8 @@ DEBUG_FOPS(mem); | |||
354 | return -ENOMEM; \ | 354 | return -ENOMEM; \ |
355 | } | 355 | } |
356 | 356 | ||
357 | #define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 600) | 357 | #define DEBUG_ADD_FILE(name) __DEBUG_ADD_FILE(name, 0600) |
358 | #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 400) | 358 | #define DEBUG_ADD_FILE_RO(name) __DEBUG_ADD_FILE(name, 0400) |
359 | 359 | ||
360 | static int iommu_debug_register(struct device *dev, void *data) | 360 | static int iommu_debug_register(struct device *dev, void *data) |
361 | { | 361 | { |
diff --git a/drivers/irqchip/irq-metag-ext.c b/drivers/irqchip/irq-metag-ext.c index 92c41ab4dbfd..2cb474ad8809 100644 --- a/drivers/irqchip/irq-metag-ext.c +++ b/drivers/irqchip/irq-metag-ext.c | |||
@@ -515,7 +515,7 @@ static int meta_intc_set_affinity(struct irq_data *data, | |||
515 | * one cpu (the interrupt code doesn't support it), so we just | 515 | * one cpu (the interrupt code doesn't support it), so we just |
516 | * pick the first cpu we find in 'cpumask'. | 516 | * pick the first cpu we find in 'cpumask'. |
517 | */ | 517 | */ |
518 | cpu = cpumask_any(cpumask); | 518 | cpu = cpumask_any_and(cpumask, cpu_online_mask); |
519 | thread = cpu_2_hwthread_id[cpu]; | 519 | thread = cpu_2_hwthread_id[cpu]; |
520 | 520 | ||
521 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); | 521 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); |
diff --git a/drivers/irqchip/irq-metag.c b/drivers/irqchip/irq-metag.c index 8e94d7a3b20d..c16c186d97d3 100644 --- a/drivers/irqchip/irq-metag.c +++ b/drivers/irqchip/irq-metag.c | |||
@@ -201,7 +201,7 @@ static int metag_internal_irq_set_affinity(struct irq_data *data, | |||
201 | * one cpu (the interrupt code doesn't support it), so we just | 201 | * one cpu (the interrupt code doesn't support it), so we just |
202 | * pick the first cpu we find in 'cpumask'. | 202 | * pick the first cpu we find in 'cpumask'. |
203 | */ | 203 | */ |
204 | cpu = cpumask_any(cpumask); | 204 | cpu = cpumask_any_and(cpumask, cpu_online_mask); |
205 | thread = cpu_2_hwthread_id[cpu]; | 205 | thread = cpu_2_hwthread_id[cpu]; |
206 | 206 | ||
207 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), | 207 | metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index ffd472e015ca..1af70145fab9 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -289,6 +289,7 @@ struct per_bio_data { | |||
289 | bool tick:1; | 289 | bool tick:1; |
290 | unsigned req_nr:2; | 290 | unsigned req_nr:2; |
291 | struct dm_deferred_entry *all_io_entry; | 291 | struct dm_deferred_entry *all_io_entry; |
292 | struct dm_hook_info hook_info; | ||
292 | 293 | ||
293 | /* | 294 | /* |
294 | * writethrough fields. These MUST remain at the end of this | 295 | * writethrough fields. These MUST remain at the end of this |
@@ -297,7 +298,6 @@ struct per_bio_data { | |||
297 | */ | 298 | */ |
298 | struct cache *cache; | 299 | struct cache *cache; |
299 | dm_cblock_t cblock; | 300 | dm_cblock_t cblock; |
300 | struct dm_hook_info hook_info; | ||
301 | struct dm_bio_details bio_details; | 301 | struct dm_bio_details bio_details; |
302 | }; | 302 | }; |
303 | 303 | ||
@@ -671,15 +671,16 @@ static void remap_to_cache(struct cache *cache, struct bio *bio, | |||
671 | dm_cblock_t cblock) | 671 | dm_cblock_t cblock) |
672 | { | 672 | { |
673 | sector_t bi_sector = bio->bi_iter.bi_sector; | 673 | sector_t bi_sector = bio->bi_iter.bi_sector; |
674 | sector_t block = from_cblock(cblock); | ||
674 | 675 | ||
675 | bio->bi_bdev = cache->cache_dev->bdev; | 676 | bio->bi_bdev = cache->cache_dev->bdev; |
676 | if (!block_size_is_power_of_two(cache)) | 677 | if (!block_size_is_power_of_two(cache)) |
677 | bio->bi_iter.bi_sector = | 678 | bio->bi_iter.bi_sector = |
678 | (from_cblock(cblock) * cache->sectors_per_block) + | 679 | (block * cache->sectors_per_block) + |
679 | sector_div(bi_sector, cache->sectors_per_block); | 680 | sector_div(bi_sector, cache->sectors_per_block); |
680 | else | 681 | else |
681 | bio->bi_iter.bi_sector = | 682 | bio->bi_iter.bi_sector = |
682 | (from_cblock(cblock) << cache->sectors_per_block_shift) | | 683 | (block << cache->sectors_per_block_shift) | |
683 | (bi_sector & (cache->sectors_per_block - 1)); | 684 | (bi_sector & (cache->sectors_per_block - 1)); |
684 | } | 685 | } |
685 | 686 | ||
@@ -1010,13 +1011,15 @@ static void overwrite_endio(struct bio *bio, int err) | |||
1010 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); | 1011 | struct per_bio_data *pb = get_per_bio_data(bio, pb_data_size); |
1011 | unsigned long flags; | 1012 | unsigned long flags; |
1012 | 1013 | ||
1014 | dm_unhook_bio(&pb->hook_info, bio); | ||
1015 | |||
1013 | if (err) | 1016 | if (err) |
1014 | mg->err = true; | 1017 | mg->err = true; |
1015 | 1018 | ||
1019 | mg->requeue_holder = false; | ||
1020 | |||
1016 | spin_lock_irqsave(&cache->lock, flags); | 1021 | spin_lock_irqsave(&cache->lock, flags); |
1017 | list_add_tail(&mg->list, &cache->completed_migrations); | 1022 | list_add_tail(&mg->list, &cache->completed_migrations); |
1018 | dm_unhook_bio(&pb->hook_info, bio); | ||
1019 | mg->requeue_holder = false; | ||
1020 | spin_unlock_irqrestore(&cache->lock, flags); | 1023 | spin_unlock_irqrestore(&cache->lock, flags); |
1021 | 1024 | ||
1022 | wake_worker(cache); | 1025 | wake_worker(cache); |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index b2b8a10e8427..3842ac738f98 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -201,29 +201,28 @@ static void list_dp_init(struct dpages *dp, struct page_list *pl, unsigned offse | |||
201 | /* | 201 | /* |
202 | * Functions for getting the pages from a bvec. | 202 | * Functions for getting the pages from a bvec. |
203 | */ | 203 | */ |
204 | static void bio_get_page(struct dpages *dp, | 204 | static void bio_get_page(struct dpages *dp, struct page **p, |
205 | struct page **p, unsigned long *len, unsigned *offset) | 205 | unsigned long *len, unsigned *offset) |
206 | { | 206 | { |
207 | struct bio *bio = dp->context_ptr; | 207 | struct bio_vec *bvec = dp->context_ptr; |
208 | struct bio_vec bvec = bio_iovec(bio); | 208 | *p = bvec->bv_page; |
209 | *p = bvec.bv_page; | 209 | *len = bvec->bv_len - dp->context_u; |
210 | *len = bvec.bv_len; | 210 | *offset = bvec->bv_offset + dp->context_u; |
211 | *offset = bvec.bv_offset; | ||
212 | } | 211 | } |
213 | 212 | ||
214 | static void bio_next_page(struct dpages *dp) | 213 | static void bio_next_page(struct dpages *dp) |
215 | { | 214 | { |
216 | struct bio *bio = dp->context_ptr; | 215 | struct bio_vec *bvec = dp->context_ptr; |
217 | struct bio_vec bvec = bio_iovec(bio); | 216 | dp->context_ptr = bvec + 1; |
218 | 217 | dp->context_u = 0; | |
219 | bio_advance(bio, bvec.bv_len); | ||
220 | } | 218 | } |
221 | 219 | ||
222 | static void bio_dp_init(struct dpages *dp, struct bio *bio) | 220 | static void bio_dp_init(struct dpages *dp, struct bio *bio) |
223 | { | 221 | { |
224 | dp->get_page = bio_get_page; | 222 | dp->get_page = bio_get_page; |
225 | dp->next_page = bio_next_page; | 223 | dp->next_page = bio_next_page; |
226 | dp->context_ptr = bio; | 224 | dp->context_ptr = __bvec_iter_bvec(bio->bi_io_vec, bio->bi_iter); |
225 | dp->context_u = bio->bi_iter.bi_bvec_done; | ||
227 | } | 226 | } |
228 | 227 | ||
229 | /* | 228 | /* |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 6eb9dc9ef8f3..422a9fdeb53e 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
@@ -1626,8 +1626,11 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, | |||
1626 | /* | 1626 | /* |
1627 | * Only pass ioctls through if the device sizes match exactly. | 1627 | * Only pass ioctls through if the device sizes match exactly. |
1628 | */ | 1628 | */ |
1629 | if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) | 1629 | if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) { |
1630 | r = scsi_verify_blk_ioctl(NULL, cmd); | 1630 | int err = scsi_verify_blk_ioctl(NULL, cmd); |
1631 | if (err) | ||
1632 | r = err; | ||
1633 | } | ||
1631 | 1634 | ||
1632 | if (r == -ENOTCONN && !fatal_signal_pending(current)) | 1635 | if (r == -ENOTCONN && !fatal_signal_pending(current)) |
1633 | queue_work(kmultipathd, &m->process_queued_ios); | 1636 | queue_work(kmultipathd, &m->process_queued_ios); |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index f284e0bfb25f..7dfdb5c746d6 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -1244,6 +1244,9 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, int error) | |||
1244 | 1244 | ||
1245 | dm_bio_restore(bd, bio); | 1245 | dm_bio_restore(bd, bio); |
1246 | bio_record->details.bi_bdev = NULL; | 1246 | bio_record->details.bi_bdev = NULL; |
1247 | |||
1248 | atomic_inc(&bio->bi_remaining); | ||
1249 | |||
1247 | queue_bio(ms, bio, rw); | 1250 | queue_bio(ms, bio, rw); |
1248 | return DM_ENDIO_INCOMPLETE; | 1251 | return DM_ENDIO_INCOMPLETE; |
1249 | } | 1252 | } |
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 7da347665552..baa87ff12816 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c | |||
@@ -483,7 +483,7 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd) | |||
483 | 483 | ||
484 | disk_super->data_mapping_root = cpu_to_le64(pmd->root); | 484 | disk_super->data_mapping_root = cpu_to_le64(pmd->root); |
485 | disk_super->device_details_root = cpu_to_le64(pmd->details_root); | 485 | disk_super->device_details_root = cpu_to_le64(pmd->details_root); |
486 | disk_super->metadata_block_size = cpu_to_le32(THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 486 | disk_super->metadata_block_size = cpu_to_le32(THIN_METADATA_BLOCK_SIZE); |
487 | disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); | 487 | disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); |
488 | disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); | 488 | disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); |
489 | 489 | ||
@@ -651,7 +651,7 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd, bool f | |||
651 | { | 651 | { |
652 | int r; | 652 | int r; |
653 | 653 | ||
654 | pmd->bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE, | 654 | pmd->bm = dm_block_manager_create(pmd->bdev, THIN_METADATA_BLOCK_SIZE << SECTOR_SHIFT, |
655 | THIN_METADATA_CACHE_SIZE, | 655 | THIN_METADATA_CACHE_SIZE, |
656 | THIN_MAX_CONCURRENT_LOCKS); | 656 | THIN_MAX_CONCURRENT_LOCKS); |
657 | if (IS_ERR(pmd->bm)) { | 657 | if (IS_ERR(pmd->bm)) { |
@@ -1489,6 +1489,23 @@ bool dm_thin_changed_this_transaction(struct dm_thin_device *td) | |||
1489 | return r; | 1489 | return r; |
1490 | } | 1490 | } |
1491 | 1491 | ||
1492 | bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd) | ||
1493 | { | ||
1494 | bool r = false; | ||
1495 | struct dm_thin_device *td, *tmp; | ||
1496 | |||
1497 | down_read(&pmd->root_lock); | ||
1498 | list_for_each_entry_safe(td, tmp, &pmd->thin_devices, list) { | ||
1499 | if (td->changed) { | ||
1500 | r = td->changed; | ||
1501 | break; | ||
1502 | } | ||
1503 | } | ||
1504 | up_read(&pmd->root_lock); | ||
1505 | |||
1506 | return r; | ||
1507 | } | ||
1508 | |||
1492 | bool dm_thin_aborted_changes(struct dm_thin_device *td) | 1509 | bool dm_thin_aborted_changes(struct dm_thin_device *td) |
1493 | { | 1510 | { |
1494 | bool r; | 1511 | bool r; |
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index 9a368567632f..82ea384d36ff 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
@@ -9,16 +9,14 @@ | |||
9 | 9 | ||
10 | #include "persistent-data/dm-block-manager.h" | 10 | #include "persistent-data/dm-block-manager.h" |
11 | #include "persistent-data/dm-space-map.h" | 11 | #include "persistent-data/dm-space-map.h" |
12 | #include "persistent-data/dm-space-map-metadata.h" | ||
12 | 13 | ||
13 | #define THIN_METADATA_BLOCK_SIZE 4096 | 14 | #define THIN_METADATA_BLOCK_SIZE DM_SM_METADATA_BLOCK_SIZE |
14 | 15 | ||
15 | /* | 16 | /* |
16 | * The metadata device is currently limited in size. | 17 | * The metadata device is currently limited in size. |
17 | * | ||
18 | * We have one block of index, which can hold 255 index entries. Each | ||
19 | * index entry contains allocation info about 16k metadata blocks. | ||
20 | */ | 18 | */ |
21 | #define THIN_METADATA_MAX_SECTORS (255 * (1 << 14) * (THIN_METADATA_BLOCK_SIZE / (1 << SECTOR_SHIFT))) | 19 | #define THIN_METADATA_MAX_SECTORS DM_SM_METADATA_MAX_SECTORS |
22 | 20 | ||
23 | /* | 21 | /* |
24 | * A metadata device larger than 16GB triggers a warning. | 22 | * A metadata device larger than 16GB triggers a warning. |
@@ -161,6 +159,8 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block); | |||
161 | */ | 159 | */ |
162 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); | 160 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); |
163 | 161 | ||
162 | bool dm_pool_changed_this_transaction(struct dm_pool_metadata *pmd); | ||
163 | |||
164 | bool dm_thin_aborted_changes(struct dm_thin_device *td); | 164 | bool dm_thin_aborted_changes(struct dm_thin_device *td); |
165 | 165 | ||
166 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, | 166 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index faaf944597ab..7e84baccf0ad 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1357,7 +1357,8 @@ static void process_deferred_bios(struct pool *pool) | |||
1357 | bio_list_init(&pool->deferred_flush_bios); | 1357 | bio_list_init(&pool->deferred_flush_bios); |
1358 | spin_unlock_irqrestore(&pool->lock, flags); | 1358 | spin_unlock_irqrestore(&pool->lock, flags); |
1359 | 1359 | ||
1360 | if (bio_list_empty(&bios) && !need_commit_due_to_time(pool)) | 1360 | if (bio_list_empty(&bios) && |
1361 | !(dm_pool_changed_this_transaction(pool->pmd) && need_commit_due_to_time(pool))) | ||
1361 | return; | 1362 | return; |
1362 | 1363 | ||
1363 | if (commit(pool)) { | 1364 | if (commit(pool)) { |
@@ -1999,16 +2000,27 @@ static void metadata_low_callback(void *context) | |||
1999 | dm_table_event(pool->ti->table); | 2000 | dm_table_event(pool->ti->table); |
2000 | } | 2001 | } |
2001 | 2002 | ||
2002 | static sector_t get_metadata_dev_size(struct block_device *bdev) | 2003 | static sector_t get_dev_size(struct block_device *bdev) |
2004 | { | ||
2005 | return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; | ||
2006 | } | ||
2007 | |||
2008 | static void warn_if_metadata_device_too_big(struct block_device *bdev) | ||
2003 | { | 2009 | { |
2004 | sector_t metadata_dev_size = i_size_read(bdev->bd_inode) >> SECTOR_SHIFT; | 2010 | sector_t metadata_dev_size = get_dev_size(bdev); |
2005 | char buffer[BDEVNAME_SIZE]; | 2011 | char buffer[BDEVNAME_SIZE]; |
2006 | 2012 | ||
2007 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) { | 2013 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS_WARNING) |
2008 | DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.", | 2014 | DMWARN("Metadata device %s is larger than %u sectors: excess space will not be used.", |
2009 | bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS); | 2015 | bdevname(bdev, buffer), THIN_METADATA_MAX_SECTORS); |
2010 | metadata_dev_size = THIN_METADATA_MAX_SECTORS_WARNING; | 2016 | } |
2011 | } | 2017 | |
2018 | static sector_t get_metadata_dev_size(struct block_device *bdev) | ||
2019 | { | ||
2020 | sector_t metadata_dev_size = get_dev_size(bdev); | ||
2021 | |||
2022 | if (metadata_dev_size > THIN_METADATA_MAX_SECTORS) | ||
2023 | metadata_dev_size = THIN_METADATA_MAX_SECTORS; | ||
2012 | 2024 | ||
2013 | return metadata_dev_size; | 2025 | return metadata_dev_size; |
2014 | } | 2026 | } |
@@ -2017,7 +2029,7 @@ static dm_block_t get_metadata_dev_size_in_blocks(struct block_device *bdev) | |||
2017 | { | 2029 | { |
2018 | sector_t metadata_dev_size = get_metadata_dev_size(bdev); | 2030 | sector_t metadata_dev_size = get_metadata_dev_size(bdev); |
2019 | 2031 | ||
2020 | sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE >> SECTOR_SHIFT); | 2032 | sector_div(metadata_dev_size, THIN_METADATA_BLOCK_SIZE); |
2021 | 2033 | ||
2022 | return metadata_dev_size; | 2034 | return metadata_dev_size; |
2023 | } | 2035 | } |
@@ -2095,12 +2107,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2095 | ti->error = "Error opening metadata block device"; | 2107 | ti->error = "Error opening metadata block device"; |
2096 | goto out_unlock; | 2108 | goto out_unlock; |
2097 | } | 2109 | } |
2098 | 2110 | warn_if_metadata_device_too_big(metadata_dev->bdev); | |
2099 | /* | ||
2100 | * Run for the side-effect of possibly issuing a warning if the | ||
2101 | * device is too big. | ||
2102 | */ | ||
2103 | (void) get_metadata_dev_size(metadata_dev->bdev); | ||
2104 | 2111 | ||
2105 | r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev); | 2112 | r = dm_get_device(ti, argv[1], FMODE_READ | FMODE_WRITE, &data_dev); |
2106 | if (r) { | 2113 | if (r) { |
@@ -2287,6 +2294,7 @@ static int maybe_resize_metadata_dev(struct dm_target *ti, bool *need_commit) | |||
2287 | return -EINVAL; | 2294 | return -EINVAL; |
2288 | 2295 | ||
2289 | } else if (metadata_dev_size > sb_metadata_dev_size) { | 2296 | } else if (metadata_dev_size > sb_metadata_dev_size) { |
2297 | warn_if_metadata_device_too_big(pool->md_dev); | ||
2290 | DMINFO("%s: growing the metadata device from %llu to %llu blocks", | 2298 | DMINFO("%s: growing the metadata device from %llu to %llu blocks", |
2291 | dm_device_name(pool->pool_md), | 2299 | dm_device_name(pool->pool_md), |
2292 | sb_metadata_dev_size, metadata_dev_size); | 2300 | sb_metadata_dev_size, metadata_dev_size); |
@@ -2894,6 +2902,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2894 | 2902 | ||
2895 | if (get_pool_mode(tc->pool) == PM_FAIL) { | 2903 | if (get_pool_mode(tc->pool) == PM_FAIL) { |
2896 | ti->error = "Couldn't open thin device, Pool is in fail mode"; | 2904 | ti->error = "Couldn't open thin device, Pool is in fail mode"; |
2905 | r = -EINVAL; | ||
2897 | goto bad_thin_open; | 2906 | goto bad_thin_open; |
2898 | } | 2907 | } |
2899 | 2908 | ||
@@ -2905,7 +2914,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2905 | 2914 | ||
2906 | r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block); | 2915 | r = dm_set_target_max_io_len(ti, tc->pool->sectors_per_block); |
2907 | if (r) | 2916 | if (r) |
2908 | goto bad_thin_open; | 2917 | goto bad_target_max_io_len; |
2909 | 2918 | ||
2910 | ti->num_flush_bios = 1; | 2919 | ti->num_flush_bios = 1; |
2911 | ti->flush_supported = true; | 2920 | ti->flush_supported = true; |
@@ -2926,6 +2935,8 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
2926 | 2935 | ||
2927 | return 0; | 2936 | return 0; |
2928 | 2937 | ||
2938 | bad_target_max_io_len: | ||
2939 | dm_pool_close_thin_device(tc->td); | ||
2929 | bad_thin_open: | 2940 | bad_thin_open: |
2930 | __pool_dec(tc->pool); | 2941 | __pool_dec(tc->pool); |
2931 | bad_pool_lookup: | 2942 | bad_pool_lookup: |
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c index 536782e3bcb7..e9bdd462f4f5 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.c +++ b/drivers/md/persistent-data/dm-space-map-metadata.c | |||
@@ -680,6 +680,8 @@ int dm_sm_metadata_create(struct dm_space_map *sm, | |||
680 | if (r) | 680 | if (r) |
681 | return r; | 681 | return r; |
682 | 682 | ||
683 | if (nr_blocks > DM_SM_METADATA_MAX_BLOCKS) | ||
684 | nr_blocks = DM_SM_METADATA_MAX_BLOCKS; | ||
683 | r = sm_ll_extend(&smm->ll, nr_blocks); | 685 | r = sm_ll_extend(&smm->ll, nr_blocks); |
684 | if (r) | 686 | if (r) |
685 | return r; | 687 | return r; |
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.h b/drivers/md/persistent-data/dm-space-map-metadata.h index 39bba0801cf2..64df923974d8 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.h +++ b/drivers/md/persistent-data/dm-space-map-metadata.h | |||
@@ -9,6 +9,17 @@ | |||
9 | 9 | ||
10 | #include "dm-transaction-manager.h" | 10 | #include "dm-transaction-manager.h" |
11 | 11 | ||
12 | #define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT) | ||
13 | |||
14 | /* | ||
15 | * The metadata device is currently limited in size. | ||
16 | * | ||
17 | * We have one block of index, which can hold 255 index entries. Each | ||
18 | * index entry contains allocation info about ~16k metadata blocks. | ||
19 | */ | ||
20 | #define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64)) | ||
21 | #define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE) | ||
22 | |||
12 | /* | 23 | /* |
13 | * Unfortunately we have to use two-phase construction due to the cycle | 24 | * Unfortunately we have to use two-phase construction due to the cycle |
14 | * between the tm and sm. | 25 | * between the tm and sm. |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 59eba5d2c685..9715a7ba164a 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -1584,7 +1584,7 @@ read_retry: | |||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | if (mtd->ecc_stats.failed - ecc_failures) { | 1586 | if (mtd->ecc_stats.failed - ecc_failures) { |
1587 | if (retry_mode + 1 <= chip->read_retries) { | 1587 | if (retry_mode + 1 < chip->read_retries) { |
1588 | retry_mode++; | 1588 | retry_mode++; |
1589 | ret = nand_setup_read_retry(mtd, | 1589 | ret = nand_setup_read_retry(mtd, |
1590 | retry_mode); | 1590 | retry_mode); |
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index ef4190a02b7b..bf642ceef681 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -1633,6 +1633,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1633 | int i; | 1633 | int i; |
1634 | dma_cap_mask_t mask; | 1634 | dma_cap_mask_t mask; |
1635 | unsigned sig; | 1635 | unsigned sig; |
1636 | unsigned oob_index; | ||
1636 | struct resource *res; | 1637 | struct resource *res; |
1637 | struct mtd_part_parser_data ppdata = {}; | 1638 | struct mtd_part_parser_data ppdata = {}; |
1638 | 1639 | ||
@@ -1826,11 +1827,14 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1826 | (mtd->writesize / | 1827 | (mtd->writesize / |
1827 | nand_chip->ecc.size); | 1828 | nand_chip->ecc.size); |
1828 | if (nand_chip->options & NAND_BUSWIDTH_16) | 1829 | if (nand_chip->options & NAND_BUSWIDTH_16) |
1829 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1830 | oob_index = BADBLOCK_MARKER_LENGTH; |
1830 | else | 1831 | else |
1831 | ecclayout->eccpos[0] = 1; | 1832 | oob_index = 1; |
1832 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1833 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1833 | ecclayout->eccbytes; | 1834 | ecclayout->eccpos[i] = oob_index; |
1835 | /* no reserved-marker in ecclayout for this ecc-scheme */ | ||
1836 | ecclayout->oobfree->offset = | ||
1837 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1834 | break; | 1838 | break; |
1835 | 1839 | ||
1836 | case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: | 1840 | case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: |
@@ -1847,9 +1851,15 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1847 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1851 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1848 | (mtd->writesize / | 1852 | (mtd->writesize / |
1849 | nand_chip->ecc.size); | 1853 | nand_chip->ecc.size); |
1850 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1854 | oob_index = BADBLOCK_MARKER_LENGTH; |
1851 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1855 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) { |
1852 | ecclayout->eccbytes; | 1856 | ecclayout->eccpos[i] = oob_index; |
1857 | if (((i + 1) % nand_chip->ecc.bytes) == 0) | ||
1858 | oob_index++; | ||
1859 | } | ||
1860 | /* include reserved-marker in ecclayout->oobfree calculation */ | ||
1861 | ecclayout->oobfree->offset = 1 + | ||
1862 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1853 | /* software bch library is used for locating errors */ | 1863 | /* software bch library is used for locating errors */ |
1854 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1864 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1855 | nand_chip->ecc.size, | 1865 | nand_chip->ecc.size, |
@@ -1883,9 +1893,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1883 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1893 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1884 | (mtd->writesize / | 1894 | (mtd->writesize / |
1885 | nand_chip->ecc.size); | 1895 | nand_chip->ecc.size); |
1886 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1896 | oob_index = BADBLOCK_MARKER_LENGTH; |
1887 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1897 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1888 | ecclayout->eccbytes; | 1898 | ecclayout->eccpos[i] = oob_index; |
1899 | /* reserved marker already included in ecclayout->eccbytes */ | ||
1900 | ecclayout->oobfree->offset = | ||
1901 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1889 | /* This ECC scheme requires ELM H/W block */ | 1902 | /* This ECC scheme requires ELM H/W block */ |
1890 | if (is_elm_present(info, pdata->elm_of_node, BCH4_ECC) < 0) { | 1903 | if (is_elm_present(info, pdata->elm_of_node, BCH4_ECC) < 0) { |
1891 | pr_err("nand: error: could not initialize ELM\n"); | 1904 | pr_err("nand: error: could not initialize ELM\n"); |
@@ -1913,9 +1926,15 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1913 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1926 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1914 | (mtd->writesize / | 1927 | (mtd->writesize / |
1915 | nand_chip->ecc.size); | 1928 | nand_chip->ecc.size); |
1916 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1929 | oob_index = BADBLOCK_MARKER_LENGTH; |
1917 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1930 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) { |
1918 | ecclayout->eccbytes; | 1931 | ecclayout->eccpos[i] = oob_index; |
1932 | if (((i + 1) % nand_chip->ecc.bytes) == 0) | ||
1933 | oob_index++; | ||
1934 | } | ||
1935 | /* include reserved-marker in ecclayout->oobfree calculation */ | ||
1936 | ecclayout->oobfree->offset = 1 + | ||
1937 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1919 | /* software bch library is used for locating errors */ | 1938 | /* software bch library is used for locating errors */ |
1920 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1939 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1921 | nand_chip->ecc.size, | 1940 | nand_chip->ecc.size, |
@@ -1956,9 +1975,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1956 | ecclayout->eccbytes = nand_chip->ecc.bytes * | 1975 | ecclayout->eccbytes = nand_chip->ecc.bytes * |
1957 | (mtd->writesize / | 1976 | (mtd->writesize / |
1958 | nand_chip->ecc.size); | 1977 | nand_chip->ecc.size); |
1959 | ecclayout->eccpos[0] = BADBLOCK_MARKER_LENGTH; | 1978 | oob_index = BADBLOCK_MARKER_LENGTH; |
1960 | ecclayout->oobfree->offset = ecclayout->eccpos[0] + | 1979 | for (i = 0; i < ecclayout->eccbytes; i++, oob_index++) |
1961 | ecclayout->eccbytes; | 1980 | ecclayout->eccpos[i] = oob_index; |
1981 | /* reserved marker already included in ecclayout->eccbytes */ | ||
1982 | ecclayout->oobfree->offset = | ||
1983 | ecclayout->eccpos[ecclayout->eccbytes - 1] + 1; | ||
1962 | break; | 1984 | break; |
1963 | #else | 1985 | #else |
1964 | pr_err("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n"); | 1986 | pr_err("nand: error: CONFIG_MTD_NAND_OMAP_BCH not enabled\n"); |
@@ -1972,11 +1994,8 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1972 | goto return_error; | 1994 | goto return_error; |
1973 | } | 1995 | } |
1974 | 1996 | ||
1975 | /* populate remaining ECC layout data */ | 1997 | /* all OOB bytes from oobfree->offset till end off OOB are free */ |
1976 | ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH + | 1998 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; |
1977 | ecclayout->eccbytes); | ||
1978 | for (i = 1; i < ecclayout->eccbytes; i++) | ||
1979 | ecclayout->eccpos[i] = ecclayout->eccpos[0] + i; | ||
1980 | /* check if NAND device's OOB is enough to store ECC signatures */ | 1999 | /* check if NAND device's OOB is enough to store ECC signatures */ |
1981 | if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { | 2000 | if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) { |
1982 | pr_err("not enough OOB bytes required = %d, available=%d\n", | 2001 | pr_err("not enough OOB bytes required = %d, available=%d\n", |
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index ead861307b3c..c5dad652614d 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
@@ -463,8 +463,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai, | |||
463 | } | 463 | } |
464 | } | 464 | } |
465 | if (found_orphan) { | 465 | if (found_orphan) { |
466 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
467 | list_del(&tmp_aeb->u.list); | 466 | list_del(&tmp_aeb->u.list); |
467 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
468 | } | 468 | } |
469 | 469 | ||
470 | new_aeb = kmem_cache_alloc(ai->aeb_slab_cache, | 470 | new_aeb = kmem_cache_alloc(ai->aeb_slab_cache, |
@@ -846,16 +846,16 @@ fail_bad: | |||
846 | ret = UBI_BAD_FASTMAP; | 846 | ret = UBI_BAD_FASTMAP; |
847 | fail: | 847 | fail: |
848 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) { | 848 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) { |
849 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
850 | list_del(&tmp_aeb->u.list); | 849 | list_del(&tmp_aeb->u.list); |
850 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
851 | } | 851 | } |
852 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) { | 852 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) { |
853 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
854 | list_del(&tmp_aeb->u.list); | 853 | list_del(&tmp_aeb->u.list); |
854 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
855 | } | 855 | } |
856 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { | 856 | list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) { |
857 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
858 | list_del(&tmp_aeb->u.list); | 857 | list_del(&tmp_aeb->u.list); |
858 | kmem_cache_free(ai->aeb_slab_cache, tmp_aeb); | ||
859 | } | 859 | } |
860 | 860 | ||
861 | return ret; | 861 | return ret; |
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c index 8a843a04c224..a40b9c34e9ff 100644 --- a/drivers/pwm/pwm-lp3943.c +++ b/drivers/pwm/pwm-lp3943.c | |||
@@ -52,8 +52,10 @@ lp3943_pwm_request_map(struct lp3943_pwm *lp3943_pwm, int hwpwm) | |||
52 | offset = pwm_map->output[i]; | 52 | offset = pwm_map->output[i]; |
53 | 53 | ||
54 | /* Return an error if the pin is already assigned */ | 54 | /* Return an error if the pin is already assigned */ |
55 | if (test_and_set_bit(offset, &lp3943->pin_used)) | 55 | if (test_and_set_bit(offset, &lp3943->pin_used)) { |
56 | kfree(pwm_map); | ||
56 | return ERR_PTR(-EBUSY); | 57 | return ERR_PTR(-EBUSY); |
58 | } | ||
57 | } | 59 | } |
58 | 60 | ||
59 | return pwm_map; | 61 | return pwm_map; |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index f6b9188c5af5..9f0ea6cb6922 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -610,6 +610,7 @@ void chsc_chp_online(struct chp_id chpid) | |||
610 | css_wait_for_slow_path(); | 610 | css_wait_for_slow_path(); |
611 | for_each_subchannel_staged(__s390_process_res_acc, NULL, | 611 | for_each_subchannel_staged(__s390_process_res_acc, NULL, |
612 | &link); | 612 | &link); |
613 | css_schedule_reprobe(); | ||
613 | } | 614 | } |
614 | } | 615 | } |
615 | 616 | ||
diff --git a/drivers/s390/crypto/zcrypt_msgtype6.c b/drivers/s390/crypto/zcrypt_msgtype6.c index dc542e0a3055..0bc91e46395a 100644 --- a/drivers/s390/crypto/zcrypt_msgtype6.c +++ b/drivers/s390/crypto/zcrypt_msgtype6.c | |||
@@ -311,7 +311,7 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev, | |||
311 | } __packed * msg = ap_msg->message; | 311 | } __packed * msg = ap_msg->message; |
312 | 312 | ||
313 | int rcblen = CEIL4(xcRB->request_control_blk_length); | 313 | int rcblen = CEIL4(xcRB->request_control_blk_length); |
314 | int replylen; | 314 | int replylen, req_sumlen, resp_sumlen; |
315 | char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen; | 315 | char *req_data = ap_msg->message + sizeof(struct type6_hdr) + rcblen; |
316 | char *function_code; | 316 | char *function_code; |
317 | 317 | ||
@@ -321,12 +321,34 @@ static int XCRB_msg_to_type6CPRB_msgX(struct zcrypt_device *zdev, | |||
321 | xcRB->request_data_length; | 321 | xcRB->request_data_length; |
322 | if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE) | 322 | if (ap_msg->length > MSGTYPE06_MAX_MSG_SIZE) |
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | |||
325 | /* Overflow check | ||
326 | sum must be greater (or equal) than the largest operand */ | ||
327 | req_sumlen = CEIL4(xcRB->request_control_blk_length) + | ||
328 | xcRB->request_data_length; | ||
329 | if ((CEIL4(xcRB->request_control_blk_length) <= | ||
330 | xcRB->request_data_length) ? | ||
331 | (req_sumlen < xcRB->request_data_length) : | ||
332 | (req_sumlen < CEIL4(xcRB->request_control_blk_length))) { | ||
333 | return -EINVAL; | ||
334 | } | ||
335 | |||
324 | replylen = sizeof(struct type86_fmt2_msg) + | 336 | replylen = sizeof(struct type86_fmt2_msg) + |
325 | CEIL4(xcRB->reply_control_blk_length) + | 337 | CEIL4(xcRB->reply_control_blk_length) + |
326 | xcRB->reply_data_length; | 338 | xcRB->reply_data_length; |
327 | if (replylen > MSGTYPE06_MAX_MSG_SIZE) | 339 | if (replylen > MSGTYPE06_MAX_MSG_SIZE) |
328 | return -EINVAL; | 340 | return -EINVAL; |
329 | 341 | ||
342 | /* Overflow check | ||
343 | sum must be greater (or equal) than the largest operand */ | ||
344 | resp_sumlen = CEIL4(xcRB->reply_control_blk_length) + | ||
345 | xcRB->reply_data_length; | ||
346 | if ((CEIL4(xcRB->reply_control_blk_length) <= xcRB->reply_data_length) ? | ||
347 | (resp_sumlen < xcRB->reply_data_length) : | ||
348 | (resp_sumlen < CEIL4(xcRB->reply_control_blk_length))) { | ||
349 | return -EINVAL; | ||
350 | } | ||
351 | |||
330 | /* prepare type6 header */ | 352 | /* prepare type6 header */ |
331 | msg->hdr = static_type6_hdrX; | 353 | msg->hdr = static_type6_hdrX; |
332 | memcpy(msg->hdr.agent_id , &(xcRB->agent_ID), sizeof(xcRB->agent_ID)); | 354 | memcpy(msg->hdr.agent_id , &(xcRB->agent_ID), sizeof(xcRB->agent_ID)); |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 2eb97d7e8d12..0cb73074c199 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -790,17 +790,32 @@ static inline int test_tgt_sess_count(struct qla_tgt *tgt) | |||
790 | } | 790 | } |
791 | 791 | ||
792 | /* Called by tcm_qla2xxx configfs code */ | 792 | /* Called by tcm_qla2xxx configfs code */ |
793 | void qlt_stop_phase1(struct qla_tgt *tgt) | 793 | int qlt_stop_phase1(struct qla_tgt *tgt) |
794 | { | 794 | { |
795 | struct scsi_qla_host *vha = tgt->vha; | 795 | struct scsi_qla_host *vha = tgt->vha; |
796 | struct qla_hw_data *ha = tgt->ha; | 796 | struct qla_hw_data *ha = tgt->ha; |
797 | unsigned long flags; | 797 | unsigned long flags; |
798 | 798 | ||
799 | mutex_lock(&qla_tgt_mutex); | ||
800 | if (!vha->fc_vport) { | ||
801 | struct Scsi_Host *sh = vha->host; | ||
802 | struct fc_host_attrs *fc_host = shost_to_fc_host(sh); | ||
803 | bool npiv_vports; | ||
804 | |||
805 | spin_lock_irqsave(sh->host_lock, flags); | ||
806 | npiv_vports = (fc_host->npiv_vports_inuse); | ||
807 | spin_unlock_irqrestore(sh->host_lock, flags); | ||
808 | |||
809 | if (npiv_vports) { | ||
810 | mutex_unlock(&qla_tgt_mutex); | ||
811 | return -EPERM; | ||
812 | } | ||
813 | } | ||
799 | if (tgt->tgt_stop || tgt->tgt_stopped) { | 814 | if (tgt->tgt_stop || tgt->tgt_stopped) { |
800 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e, | 815 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf04e, |
801 | "Already in tgt->tgt_stop or tgt_stopped state\n"); | 816 | "Already in tgt->tgt_stop or tgt_stopped state\n"); |
802 | dump_stack(); | 817 | mutex_unlock(&qla_tgt_mutex); |
803 | return; | 818 | return -EPERM; |
804 | } | 819 | } |
805 | 820 | ||
806 | ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n", | 821 | ql_dbg(ql_dbg_tgt, vha, 0xe003, "Stopping target for host %ld(%p)\n", |
@@ -815,6 +830,7 @@ void qlt_stop_phase1(struct qla_tgt *tgt) | |||
815 | qlt_clear_tgt_db(tgt, true); | 830 | qlt_clear_tgt_db(tgt, true); |
816 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 831 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
817 | mutex_unlock(&vha->vha_tgt.tgt_mutex); | 832 | mutex_unlock(&vha->vha_tgt.tgt_mutex); |
833 | mutex_unlock(&qla_tgt_mutex); | ||
818 | 834 | ||
819 | flush_delayed_work(&tgt->sess_del_work); | 835 | flush_delayed_work(&tgt->sess_del_work); |
820 | 836 | ||
@@ -841,6 +857,7 @@ void qlt_stop_phase1(struct qla_tgt *tgt) | |||
841 | 857 | ||
842 | /* Wait for sessions to clear out (just in case) */ | 858 | /* Wait for sessions to clear out (just in case) */ |
843 | wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); | 859 | wait_event(tgt->waitQ, test_tgt_sess_count(tgt)); |
860 | return 0; | ||
844 | } | 861 | } |
845 | EXPORT_SYMBOL(qlt_stop_phase1); | 862 | EXPORT_SYMBOL(qlt_stop_phase1); |
846 | 863 | ||
@@ -3185,7 +3202,8 @@ restart: | |||
3185 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c, | 3202 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf02c, |
3186 | "SRR cmd %p (se_cmd %p, tag %d, op %x), " | 3203 | "SRR cmd %p (se_cmd %p, tag %d, op %x), " |
3187 | "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag, | 3204 | "sg_cnt=%d, offset=%d", cmd, &cmd->se_cmd, cmd->tag, |
3188 | se_cmd->t_task_cdb[0], cmd->sg_cnt, cmd->offset); | 3205 | se_cmd->t_task_cdb ? se_cmd->t_task_cdb[0] : 0, |
3206 | cmd->sg_cnt, cmd->offset); | ||
3189 | 3207 | ||
3190 | qlt_handle_srr(vha, sctio, imm); | 3208 | qlt_handle_srr(vha, sctio, imm); |
3191 | 3209 | ||
@@ -4181,6 +4199,9 @@ int qlt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha) | |||
4181 | tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX; | 4199 | tgt->datasegs_per_cmd = QLA_TGT_DATASEGS_PER_CMD_24XX; |
4182 | tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX; | 4200 | tgt->datasegs_per_cont = QLA_TGT_DATASEGS_PER_CONT_24XX; |
4183 | 4201 | ||
4202 | if (base_vha->fc_vport) | ||
4203 | return 0; | ||
4204 | |||
4184 | mutex_lock(&qla_tgt_mutex); | 4205 | mutex_lock(&qla_tgt_mutex); |
4185 | list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); | 4206 | list_add_tail(&tgt->tgt_list_entry, &qla_tgt_glist); |
4186 | mutex_unlock(&qla_tgt_mutex); | 4207 | mutex_unlock(&qla_tgt_mutex); |
@@ -4194,6 +4215,10 @@ int qlt_remove_target(struct qla_hw_data *ha, struct scsi_qla_host *vha) | |||
4194 | if (!vha->vha_tgt.qla_tgt) | 4215 | if (!vha->vha_tgt.qla_tgt) |
4195 | return 0; | 4216 | return 0; |
4196 | 4217 | ||
4218 | if (vha->fc_vport) { | ||
4219 | qlt_release(vha->vha_tgt.qla_tgt); | ||
4220 | return 0; | ||
4221 | } | ||
4197 | mutex_lock(&qla_tgt_mutex); | 4222 | mutex_lock(&qla_tgt_mutex); |
4198 | list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry); | 4223 | list_del(&vha->vha_tgt.qla_tgt->tgt_list_entry); |
4199 | mutex_unlock(&qla_tgt_mutex); | 4224 | mutex_unlock(&qla_tgt_mutex); |
@@ -4265,6 +4290,12 @@ int qlt_lport_register(void *target_lport_ptr, u64 phys_wwpn, | |||
4265 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4290 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
4266 | continue; | 4291 | continue; |
4267 | } | 4292 | } |
4293 | if (tgt->tgt_stop) { | ||
4294 | pr_debug("MODE_TARGET in shutdown on qla2xxx(%d)\n", | ||
4295 | host->host_no); | ||
4296 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
4297 | continue; | ||
4298 | } | ||
4268 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 4299 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
4269 | 4300 | ||
4270 | if (!scsi_host_get(host)) { | 4301 | if (!scsi_host_get(host)) { |
@@ -4279,12 +4310,11 @@ int qlt_lport_register(void *target_lport_ptr, u64 phys_wwpn, | |||
4279 | scsi_host_put(host); | 4310 | scsi_host_put(host); |
4280 | continue; | 4311 | continue; |
4281 | } | 4312 | } |
4282 | mutex_unlock(&qla_tgt_mutex); | ||
4283 | |||
4284 | rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn); | 4313 | rc = (*callback)(vha, target_lport_ptr, npiv_wwpn, npiv_wwnn); |
4285 | if (rc != 0) | 4314 | if (rc != 0) |
4286 | scsi_host_put(host); | 4315 | scsi_host_put(host); |
4287 | 4316 | ||
4317 | mutex_unlock(&qla_tgt_mutex); | ||
4288 | return rc; | 4318 | return rc; |
4289 | } | 4319 | } |
4290 | mutex_unlock(&qla_tgt_mutex); | 4320 | mutex_unlock(&qla_tgt_mutex); |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 66e755cdde57..ce33d8c26406 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -1001,7 +1001,7 @@ extern void qlt_modify_vp_config(struct scsi_qla_host *, | |||
1001 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); | 1001 | extern void qlt_probe_one_stage1(struct scsi_qla_host *, struct qla_hw_data *); |
1002 | extern int qlt_mem_alloc(struct qla_hw_data *); | 1002 | extern int qlt_mem_alloc(struct qla_hw_data *); |
1003 | extern void qlt_mem_free(struct qla_hw_data *); | 1003 | extern void qlt_mem_free(struct qla_hw_data *); |
1004 | extern void qlt_stop_phase1(struct qla_tgt *); | 1004 | extern int qlt_stop_phase1(struct qla_tgt *); |
1005 | extern void qlt_stop_phase2(struct qla_tgt *); | 1005 | extern void qlt_stop_phase2(struct qla_tgt *); |
1006 | extern irqreturn_t qla83xx_msix_atio_q(int, void *); | 1006 | extern irqreturn_t qla83xx_msix_atio_q(int, void *); |
1007 | extern void qlt_83xx_iospace_config(struct qla_hw_data *); | 1007 | extern void qlt_83xx_iospace_config(struct qla_hw_data *); |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 75a141bbe74d..788c4fe2b0c9 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -182,20 +182,6 @@ static int tcm_qla2xxx_npiv_parse_wwn( | |||
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
184 | 184 | ||
185 | static ssize_t tcm_qla2xxx_npiv_format_wwn(char *buf, size_t len, | ||
186 | u64 wwpn, u64 wwnn) | ||
187 | { | ||
188 | u8 b[8], b2[8]; | ||
189 | |||
190 | put_unaligned_be64(wwpn, b); | ||
191 | put_unaligned_be64(wwnn, b2); | ||
192 | return snprintf(buf, len, | ||
193 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x," | ||
194 | "%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", | ||
195 | b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], | ||
196 | b2[0], b2[1], b2[2], b2[3], b2[4], b2[5], b2[6], b2[7]); | ||
197 | } | ||
198 | |||
199 | static char *tcm_qla2xxx_npiv_get_fabric_name(void) | 185 | static char *tcm_qla2xxx_npiv_get_fabric_name(void) |
200 | { | 186 | { |
201 | return "qla2xxx_npiv"; | 187 | return "qla2xxx_npiv"; |
@@ -227,15 +213,6 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) | |||
227 | return lport->lport_naa_name; | 213 | return lport->lport_naa_name; |
228 | } | 214 | } |
229 | 215 | ||
230 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) | ||
231 | { | ||
232 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | ||
233 | struct tcm_qla2xxx_tpg, se_tpg); | ||
234 | struct tcm_qla2xxx_lport *lport = tpg->lport; | ||
235 | |||
236 | return &lport->lport_npiv_name[0]; | ||
237 | } | ||
238 | |||
239 | static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg) | 216 | static u16 tcm_qla2xxx_get_tag(struct se_portal_group *se_tpg) |
240 | { | 217 | { |
241 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 218 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
@@ -941,15 +918,41 @@ static ssize_t tcm_qla2xxx_tpg_show_enable( | |||
941 | atomic_read(&tpg->lport_tpg_enabled)); | 918 | atomic_read(&tpg->lport_tpg_enabled)); |
942 | } | 919 | } |
943 | 920 | ||
921 | static void tcm_qla2xxx_depend_tpg(struct work_struct *work) | ||
922 | { | ||
923 | struct tcm_qla2xxx_tpg *base_tpg = container_of(work, | ||
924 | struct tcm_qla2xxx_tpg, tpg_base_work); | ||
925 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | ||
926 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | ||
927 | |||
928 | if (!configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
929 | &se_tpg->tpg_group.cg_item)) { | ||
930 | atomic_set(&base_tpg->lport_tpg_enabled, 1); | ||
931 | qlt_enable_vha(base_vha); | ||
932 | } | ||
933 | complete(&base_tpg->tpg_base_comp); | ||
934 | } | ||
935 | |||
936 | static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) | ||
937 | { | ||
938 | struct tcm_qla2xxx_tpg *base_tpg = container_of(work, | ||
939 | struct tcm_qla2xxx_tpg, tpg_base_work); | ||
940 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | ||
941 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | ||
942 | |||
943 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { | ||
944 | atomic_set(&base_tpg->lport_tpg_enabled, 0); | ||
945 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | ||
946 | &se_tpg->tpg_group.cg_item); | ||
947 | } | ||
948 | complete(&base_tpg->tpg_base_comp); | ||
949 | } | ||
950 | |||
944 | static ssize_t tcm_qla2xxx_tpg_store_enable( | 951 | static ssize_t tcm_qla2xxx_tpg_store_enable( |
945 | struct se_portal_group *se_tpg, | 952 | struct se_portal_group *se_tpg, |
946 | const char *page, | 953 | const char *page, |
947 | size_t count) | 954 | size_t count) |
948 | { | 955 | { |
949 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
950 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
951 | struct tcm_qla2xxx_lport, lport_wwn); | ||
952 | struct scsi_qla_host *vha = lport->qla_vha; | ||
953 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | 956 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, |
954 | struct tcm_qla2xxx_tpg, se_tpg); | 957 | struct tcm_qla2xxx_tpg, se_tpg); |
955 | unsigned long op; | 958 | unsigned long op; |
@@ -964,19 +967,28 @@ static ssize_t tcm_qla2xxx_tpg_store_enable( | |||
964 | pr_err("Illegal value for tpg_enable: %lu\n", op); | 967 | pr_err("Illegal value for tpg_enable: %lu\n", op); |
965 | return -EINVAL; | 968 | return -EINVAL; |
966 | } | 969 | } |
967 | |||
968 | if (op) { | 970 | if (op) { |
969 | atomic_set(&tpg->lport_tpg_enabled, 1); | 971 | if (atomic_read(&tpg->lport_tpg_enabled)) |
970 | qlt_enable_vha(vha); | 972 | return -EEXIST; |
973 | |||
974 | INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_depend_tpg); | ||
971 | } else { | 975 | } else { |
972 | if (!vha->vha_tgt.qla_tgt) { | 976 | if (!atomic_read(&tpg->lport_tpg_enabled)) |
973 | pr_err("struct qla_hw_data *vha->vha_tgt.qla_tgt is NULL\n"); | 977 | return count; |
974 | return -ENODEV; | 978 | |
975 | } | 979 | INIT_WORK(&tpg->tpg_base_work, tcm_qla2xxx_undepend_tpg); |
976 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
977 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
978 | } | 980 | } |
981 | init_completion(&tpg->tpg_base_comp); | ||
982 | schedule_work(&tpg->tpg_base_work); | ||
983 | wait_for_completion(&tpg->tpg_base_comp); | ||
979 | 984 | ||
985 | if (op) { | ||
986 | if (!atomic_read(&tpg->lport_tpg_enabled)) | ||
987 | return -ENODEV; | ||
988 | } else { | ||
989 | if (atomic_read(&tpg->lport_tpg_enabled)) | ||
990 | return -EPERM; | ||
991 | } | ||
980 | return count; | 992 | return count; |
981 | } | 993 | } |
982 | 994 | ||
@@ -1053,11 +1065,64 @@ static void tcm_qla2xxx_drop_tpg(struct se_portal_group *se_tpg) | |||
1053 | /* | 1065 | /* |
1054 | * Clear local TPG=1 pointer for non NPIV mode. | 1066 | * Clear local TPG=1 pointer for non NPIV mode. |
1055 | */ | 1067 | */ |
1056 | lport->tpg_1 = NULL; | 1068 | lport->tpg_1 = NULL; |
1057 | |||
1058 | kfree(tpg); | 1069 | kfree(tpg); |
1059 | } | 1070 | } |
1060 | 1071 | ||
1072 | static ssize_t tcm_qla2xxx_npiv_tpg_show_enable( | ||
1073 | struct se_portal_group *se_tpg, | ||
1074 | char *page) | ||
1075 | { | ||
1076 | return tcm_qla2xxx_tpg_show_enable(se_tpg, page); | ||
1077 | } | ||
1078 | |||
1079 | static ssize_t tcm_qla2xxx_npiv_tpg_store_enable( | ||
1080 | struct se_portal_group *se_tpg, | ||
1081 | const char *page, | ||
1082 | size_t count) | ||
1083 | { | ||
1084 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
1085 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
1086 | struct tcm_qla2xxx_lport, lport_wwn); | ||
1087 | struct scsi_qla_host *vha = lport->qla_vha; | ||
1088 | struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg, | ||
1089 | struct tcm_qla2xxx_tpg, se_tpg); | ||
1090 | unsigned long op; | ||
1091 | int rc; | ||
1092 | |||
1093 | rc = kstrtoul(page, 0, &op); | ||
1094 | if (rc < 0) { | ||
1095 | pr_err("kstrtoul() returned %d\n", rc); | ||
1096 | return -EINVAL; | ||
1097 | } | ||
1098 | if ((op != 1) && (op != 0)) { | ||
1099 | pr_err("Illegal value for tpg_enable: %lu\n", op); | ||
1100 | return -EINVAL; | ||
1101 | } | ||
1102 | if (op) { | ||
1103 | if (atomic_read(&tpg->lport_tpg_enabled)) | ||
1104 | return -EEXIST; | ||
1105 | |||
1106 | atomic_set(&tpg->lport_tpg_enabled, 1); | ||
1107 | qlt_enable_vha(vha); | ||
1108 | } else { | ||
1109 | if (!atomic_read(&tpg->lport_tpg_enabled)) | ||
1110 | return count; | ||
1111 | |||
1112 | atomic_set(&tpg->lport_tpg_enabled, 0); | ||
1113 | qlt_stop_phase1(vha->vha_tgt.qla_tgt); | ||
1114 | } | ||
1115 | |||
1116 | return count; | ||
1117 | } | ||
1118 | |||
1119 | TF_TPG_BASE_ATTR(tcm_qla2xxx_npiv, enable, S_IRUGO | S_IWUSR); | ||
1120 | |||
1121 | static struct configfs_attribute *tcm_qla2xxx_npiv_tpg_attrs[] = { | ||
1122 | &tcm_qla2xxx_npiv_tpg_enable.attr, | ||
1123 | NULL, | ||
1124 | }; | ||
1125 | |||
1061 | static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( | 1126 | static struct se_portal_group *tcm_qla2xxx_npiv_make_tpg( |
1062 | struct se_wwn *wwn, | 1127 | struct se_wwn *wwn, |
1063 | struct config_group *group, | 1128 | struct config_group *group, |
@@ -1650,6 +1715,9 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1650 | struct scsi_qla_host *npiv_vha; | 1715 | struct scsi_qla_host *npiv_vha; |
1651 | struct tcm_qla2xxx_lport *lport = | 1716 | struct tcm_qla2xxx_lport *lport = |
1652 | (struct tcm_qla2xxx_lport *)target_lport_ptr; | 1717 | (struct tcm_qla2xxx_lport *)target_lport_ptr; |
1718 | struct tcm_qla2xxx_lport *base_lport = | ||
1719 | (struct tcm_qla2xxx_lport *)base_vha->vha_tgt.target_lport_ptr; | ||
1720 | struct tcm_qla2xxx_tpg *base_tpg; | ||
1653 | struct fc_vport_identifiers vport_id; | 1721 | struct fc_vport_identifiers vport_id; |
1654 | 1722 | ||
1655 | if (!qla_tgt_mode_enabled(base_vha)) { | 1723 | if (!qla_tgt_mode_enabled(base_vha)) { |
@@ -1657,6 +1725,13 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1657 | return -EPERM; | 1725 | return -EPERM; |
1658 | } | 1726 | } |
1659 | 1727 | ||
1728 | if (!base_lport || !base_lport->tpg_1 || | ||
1729 | !atomic_read(&base_lport->tpg_1->lport_tpg_enabled)) { | ||
1730 | pr_err("qla2xxx base_lport or tpg_1 not available\n"); | ||
1731 | return -EPERM; | ||
1732 | } | ||
1733 | base_tpg = base_lport->tpg_1; | ||
1734 | |||
1660 | memset(&vport_id, 0, sizeof(vport_id)); | 1735 | memset(&vport_id, 0, sizeof(vport_id)); |
1661 | vport_id.port_name = npiv_wwpn; | 1736 | vport_id.port_name = npiv_wwpn; |
1662 | vport_id.node_name = npiv_wwnn; | 1737 | vport_id.node_name = npiv_wwnn; |
@@ -1675,7 +1750,6 @@ static int tcm_qla2xxx_lport_register_npiv_cb(struct scsi_qla_host *base_vha, | |||
1675 | npiv_vha = (struct scsi_qla_host *)vport->dd_data; | 1750 | npiv_vha = (struct scsi_qla_host *)vport->dd_data; |
1676 | npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr; | 1751 | npiv_vha->vha_tgt.target_lport_ptr = target_lport_ptr; |
1677 | lport->qla_vha = npiv_vha; | 1752 | lport->qla_vha = npiv_vha; |
1678 | |||
1679 | scsi_host_get(npiv_vha->host); | 1753 | scsi_host_get(npiv_vha->host); |
1680 | return 0; | 1754 | return 0; |
1681 | } | 1755 | } |
@@ -1714,8 +1788,6 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( | |||
1714 | } | 1788 | } |
1715 | lport->lport_npiv_wwpn = npiv_wwpn; | 1789 | lport->lport_npiv_wwpn = npiv_wwpn; |
1716 | lport->lport_npiv_wwnn = npiv_wwnn; | 1790 | lport->lport_npiv_wwnn = npiv_wwnn; |
1717 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], | ||
1718 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); | ||
1719 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); | 1791 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); |
1720 | 1792 | ||
1721 | ret = tcm_qla2xxx_init_lport(lport); | 1793 | ret = tcm_qla2xxx_init_lport(lport); |
@@ -1824,7 +1896,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = { | |||
1824 | static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { | 1896 | static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { |
1825 | .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, | 1897 | .get_fabric_name = tcm_qla2xxx_npiv_get_fabric_name, |
1826 | .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, | 1898 | .get_fabric_proto_ident = tcm_qla2xxx_get_fabric_proto_ident, |
1827 | .tpg_get_wwn = tcm_qla2xxx_npiv_get_fabric_wwn, | 1899 | .tpg_get_wwn = tcm_qla2xxx_get_fabric_wwn, |
1828 | .tpg_get_tag = tcm_qla2xxx_get_tag, | 1900 | .tpg_get_tag = tcm_qla2xxx_get_tag, |
1829 | .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, | 1901 | .tpg_get_default_depth = tcm_qla2xxx_get_default_depth, |
1830 | .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, | 1902 | .tpg_get_pr_transport_id = tcm_qla2xxx_get_pr_transport_id, |
@@ -1935,7 +2007,7 @@ static int tcm_qla2xxx_register_configfs(void) | |||
1935 | */ | 2007 | */ |
1936 | npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; | 2008 | npiv_fabric->tf_cit_tmpl.tfc_wwn_cit.ct_attrs = tcm_qla2xxx_wwn_attrs; |
1937 | npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = | 2009 | npiv_fabric->tf_cit_tmpl.tfc_tpg_base_cit.ct_attrs = |
1938 | tcm_qla2xxx_tpg_attrs; | 2010 | tcm_qla2xxx_npiv_tpg_attrs; |
1939 | npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; | 2011 | npiv_fabric->tf_cit_tmpl.tfc_tpg_attrib_cit.ct_attrs = NULL; |
1940 | npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; | 2012 | npiv_fabric->tf_cit_tmpl.tfc_tpg_param_cit.ct_attrs = NULL; |
1941 | npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; | 2013 | npiv_fabric->tf_cit_tmpl.tfc_tpg_np_base_cit.ct_attrs = NULL; |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 275d8b9a7a34..33aaac8c7d59 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h | |||
@@ -4,8 +4,6 @@ | |||
4 | #define TCM_QLA2XXX_VERSION "v0.1" | 4 | #define TCM_QLA2XXX_VERSION "v0.1" |
5 | /* length of ASCII WWPNs including pad */ | 5 | /* length of ASCII WWPNs including pad */ |
6 | #define TCM_QLA2XXX_NAMELEN 32 | 6 | #define TCM_QLA2XXX_NAMELEN 32 |
7 | /* lenth of ASCII NPIV 'WWPN+WWNN' including pad */ | ||
8 | #define TCM_QLA2XXX_NPIV_NAMELEN 66 | ||
9 | 7 | ||
10 | #include "qla_target.h" | 8 | #include "qla_target.h" |
11 | 9 | ||
@@ -43,6 +41,9 @@ struct tcm_qla2xxx_tpg { | |||
43 | struct tcm_qla2xxx_tpg_attrib tpg_attrib; | 41 | struct tcm_qla2xxx_tpg_attrib tpg_attrib; |
44 | /* Returned by tcm_qla2xxx_make_tpg() */ | 42 | /* Returned by tcm_qla2xxx_make_tpg() */ |
45 | struct se_portal_group se_tpg; | 43 | struct se_portal_group se_tpg; |
44 | /* Items for dealing with configfs_depend_item */ | ||
45 | struct completion tpg_base_comp; | ||
46 | struct work_struct tpg_base_work; | ||
46 | }; | 47 | }; |
47 | 48 | ||
48 | struct tcm_qla2xxx_fc_loopid { | 49 | struct tcm_qla2xxx_fc_loopid { |
@@ -62,8 +63,6 @@ struct tcm_qla2xxx_lport { | |||
62 | char lport_name[TCM_QLA2XXX_NAMELEN]; | 63 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
63 | /* ASCII formatted naa WWPN for VPD page 83 etc */ | 64 | /* ASCII formatted naa WWPN for VPD page 83 etc */ |
64 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; | 65 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; |
65 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ | ||
66 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; | ||
67 | /* map for fc_port pointers in 24-bit FC Port ID space */ | 66 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
68 | struct btree_head32 lport_fcport_map; | 67 | struct btree_head32 lport_fcport_map; |
69 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ | 68 | /* vmalloc-ed memory for fc_port pointers for 16-bit FC loop ID */ |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 7fc66a6a6e36..514844efac75 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -757,6 +757,7 @@ static void mxs_lradc_finish_touch_event(struct mxs_lradc *lradc, bool valid) | |||
757 | } | 757 | } |
758 | 758 | ||
759 | /* if it is released, wait for the next touch via IRQ */ | 759 | /* if it is released, wait for the next touch via IRQ */ |
760 | lradc->cur_plate = LRADC_TOUCH; | ||
760 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); | 761 | mxs_lradc_reg_clear(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ, LRADC_CTRL1); |
761 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); | 762 | mxs_lradc_reg_set(lradc, LRADC_CTRL1_TOUCH_DETECT_IRQ_EN, LRADC_CTRL1); |
762 | } | 763 | } |
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c index a70dcef1419e..2f40ff5901d6 100644 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c | |||
@@ -55,6 +55,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = { | |||
55 | /****** 8188EUS ********/ | 55 | /****** 8188EUS ********/ |
56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ | 56 | {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */ |
57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ | 57 | {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ |
58 | {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ | ||
58 | {} /* Terminating entry */ | 59 | {} /* Terminating entry */ |
59 | }; | 60 | }; |
60 | 61 | ||
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index a4489444ffbc..42f18fc1067b 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -1074,7 +1074,7 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, | |||
1074 | struct scatterlist *psg; | 1074 | struct scatterlist *psg; |
1075 | void *paddr, *addr; | 1075 | void *paddr, *addr; |
1076 | unsigned int i, len, left; | 1076 | unsigned int i, len, left; |
1077 | unsigned int offset = 0; | 1077 | unsigned int offset = sg_off; |
1078 | 1078 | ||
1079 | left = sectors * dev->prot_length; | 1079 | left = sectors * dev->prot_length; |
1080 | 1080 | ||
@@ -1084,11 +1084,10 @@ sbc_dif_copy_prot(struct se_cmd *cmd, unsigned int sectors, bool read, | |||
1084 | if (offset >= sg->length) { | 1084 | if (offset >= sg->length) { |
1085 | sg = sg_next(sg); | 1085 | sg = sg_next(sg); |
1086 | offset = 0; | 1086 | offset = 0; |
1087 | sg_off = sg->offset; | ||
1088 | } | 1087 | } |
1089 | 1088 | ||
1090 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; | 1089 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; |
1091 | addr = kmap_atomic(sg_page(sg)) + sg_off; | 1090 | addr = kmap_atomic(sg_page(sg)) + sg->offset + offset; |
1092 | 1091 | ||
1093 | if (read) | 1092 | if (read) |
1094 | memcpy(paddr, addr, len); | 1093 | memcpy(paddr, addr, len); |
@@ -1163,7 +1162,7 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, | |||
1163 | { | 1162 | { |
1164 | struct se_device *dev = cmd->se_dev; | 1163 | struct se_device *dev = cmd->se_dev; |
1165 | struct se_dif_v1_tuple *sdt; | 1164 | struct se_dif_v1_tuple *sdt; |
1166 | struct scatterlist *dsg; | 1165 | struct scatterlist *dsg, *psg = sg; |
1167 | sector_t sector = start; | 1166 | sector_t sector = start; |
1168 | void *daddr, *paddr; | 1167 | void *daddr, *paddr; |
1169 | int i, j, offset = sg_off; | 1168 | int i, j, offset = sg_off; |
@@ -1171,14 +1170,14 @@ sbc_dif_verify_read(struct se_cmd *cmd, sector_t start, unsigned int sectors, | |||
1171 | 1170 | ||
1172 | for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { | 1171 | for_each_sg(cmd->t_data_sg, dsg, cmd->t_data_nents, i) { |
1173 | daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; | 1172 | daddr = kmap_atomic(sg_page(dsg)) + dsg->offset; |
1174 | paddr = kmap_atomic(sg_page(sg)) + sg->offset; | 1173 | paddr = kmap_atomic(sg_page(psg)) + sg->offset; |
1175 | 1174 | ||
1176 | for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { | 1175 | for (j = 0; j < dsg->length; j += dev->dev_attrib.block_size) { |
1177 | 1176 | ||
1178 | if (offset >= sg->length) { | 1177 | if (offset >= psg->length) { |
1179 | kunmap_atomic(paddr); | 1178 | kunmap_atomic(paddr); |
1180 | sg = sg_next(sg); | 1179 | psg = sg_next(psg); |
1181 | paddr = kmap_atomic(sg_page(sg)) + sg->offset; | 1180 | paddr = kmap_atomic(sg_page(psg)) + psg->offset; |
1182 | offset = 0; | 1181 | offset = 0; |
1183 | } | 1182 | } |
1184 | 1183 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 24b4f65d8777..2956250b7225 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1601,6 +1601,9 @@ void transport_generic_request_failure(struct se_cmd *cmd, | |||
1601 | case TCM_CHECK_CONDITION_ABORT_CMD: | 1601 | case TCM_CHECK_CONDITION_ABORT_CMD: |
1602 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: | 1602 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: |
1603 | case TCM_CHECK_CONDITION_NOT_READY: | 1603 | case TCM_CHECK_CONDITION_NOT_READY: |
1604 | case TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED: | ||
1605 | case TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED: | ||
1606 | case TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED: | ||
1604 | break; | 1607 | break; |
1605 | case TCM_OUT_OF_RESOURCES: | 1608 | case TCM_OUT_OF_RESOURCES: |
1606 | sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 1609 | sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 471142725ffe..81cda09b47e3 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -685,8 +685,15 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
685 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 685 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
686 | u32 status, masked_status, pcd_status = 0, cmd; | 686 | u32 status, masked_status, pcd_status = 0, cmd; |
687 | int bh; | 687 | int bh; |
688 | unsigned long flags; | ||
688 | 689 | ||
689 | spin_lock (&ehci->lock); | 690 | /* |
691 | * For threadirqs option we use spin_lock_irqsave() variant to prevent | ||
692 | * deadlock with ehci hrtimer callback, because hrtimer callbacks run | ||
693 | * in interrupt context even when threadirqs is specified. We can go | ||
694 | * back to spin_lock() variant when hrtimer callbacks become threaded. | ||
695 | */ | ||
696 | spin_lock_irqsave(&ehci->lock, flags); | ||
690 | 697 | ||
691 | status = ehci_readl(ehci, &ehci->regs->status); | 698 | status = ehci_readl(ehci, &ehci->regs->status); |
692 | 699 | ||
@@ -704,7 +711,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
704 | 711 | ||
705 | /* Shared IRQ? */ | 712 | /* Shared IRQ? */ |
706 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 713 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
707 | spin_unlock(&ehci->lock); | 714 | spin_unlock_irqrestore(&ehci->lock, flags); |
708 | return IRQ_NONE; | 715 | return IRQ_NONE; |
709 | } | 716 | } |
710 | 717 | ||
@@ -815,7 +822,7 @@ dead: | |||
815 | 822 | ||
816 | if (bh) | 823 | if (bh) |
817 | ehci_work (ehci); | 824 | ehci_work (ehci); |
818 | spin_unlock (&ehci->lock); | 825 | spin_unlock_irqrestore(&ehci->lock, flags); |
819 | if (pcd_status) | 826 | if (pcd_status) |
820 | usb_hcd_poll_rh_status(hcd); | 827 | usb_hcd_poll_rh_status(hcd); |
821 | return IRQ_HANDLED; | 828 | return IRQ_HANDLED; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ee1f00f03c43..44ab12986805 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -907,6 +907,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
907 | /* Crucible Devices */ | 907 | /* Crucible Devices */ |
908 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, | 908 | { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, |
909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, | 909 | { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) }, |
910 | /* Cressi Devices */ | ||
911 | { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, | ||
910 | { } /* Terminating entry */ | 912 | { } /* Terminating entry */ |
911 | }; | 913 | }; |
912 | 914 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 1e2d369df86e..e599fbfcde5f 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -1320,3 +1320,9 @@ | |||
1320 | * Manufacturer: Smart GSM Team | 1320 | * Manufacturer: Smart GSM Team |
1321 | */ | 1321 | */ |
1322 | #define FTDI_Z3X_PID 0x0011 | 1322 | #define FTDI_Z3X_PID 0x0011 |
1323 | |||
1324 | /* | ||
1325 | * Product: Cressi PC Interface | ||
1326 | * Manufacturer: Cressi | ||
1327 | */ | ||
1328 | #define FTDI_CRESSI_PID 0x87d0 | ||
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 0a025b8e2a12..e48d4a672580 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1001,6 +1001,12 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) | |||
1001 | break; | 1001 | break; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* virtio-scsi spec requires byte 0 of the lun to be 1 */ | ||
1005 | if (unlikely(v_req.lun[0] != 1)) { | ||
1006 | vhost_scsi_send_bad_target(vs, vq, head, out); | ||
1007 | continue; | ||
1008 | } | ||
1009 | |||
1004 | /* Extract the tpgt */ | 1010 | /* Extract the tpgt */ |
1005 | target = v_req.lun[1]; | 1011 | target = v_req.lun[1]; |
1006 | tpg = ACCESS_ONCE(vs_tpg[target]); | 1012 | tpg = ACCESS_ONCE(vs_tpg[target]); |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e0259a163f98..d754e3cf99a8 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -40,18 +40,13 @@ | |||
40 | struct wb_writeback_work { | 40 | struct wb_writeback_work { |
41 | long nr_pages; | 41 | long nr_pages; |
42 | struct super_block *sb; | 42 | struct super_block *sb; |
43 | /* | 43 | unsigned long *older_than_this; |
44 | * Write only inodes dirtied before this time. Don't forget to set | ||
45 | * older_than_this_is_set when you set this. | ||
46 | */ | ||
47 | unsigned long older_than_this; | ||
48 | enum writeback_sync_modes sync_mode; | 44 | enum writeback_sync_modes sync_mode; |
49 | unsigned int tagged_writepages:1; | 45 | unsigned int tagged_writepages:1; |
50 | unsigned int for_kupdate:1; | 46 | unsigned int for_kupdate:1; |
51 | unsigned int range_cyclic:1; | 47 | unsigned int range_cyclic:1; |
52 | unsigned int for_background:1; | 48 | unsigned int for_background:1; |
53 | unsigned int for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ | 49 | unsigned int for_sync:1; /* sync(2) WB_SYNC_ALL writeback */ |
54 | unsigned int older_than_this_is_set:1; | ||
55 | enum wb_reason reason; /* why was writeback initiated? */ | 50 | enum wb_reason reason; /* why was writeback initiated? */ |
56 | 51 | ||
57 | struct list_head list; /* pending work list */ | 52 | struct list_head list; /* pending work list */ |
@@ -252,10 +247,10 @@ static int move_expired_inodes(struct list_head *delaying_queue, | |||
252 | int do_sb_sort = 0; | 247 | int do_sb_sort = 0; |
253 | int moved = 0; | 248 | int moved = 0; |
254 | 249 | ||
255 | WARN_ON_ONCE(!work->older_than_this_is_set); | ||
256 | while (!list_empty(delaying_queue)) { | 250 | while (!list_empty(delaying_queue)) { |
257 | inode = wb_inode(delaying_queue->prev); | 251 | inode = wb_inode(delaying_queue->prev); |
258 | if (inode_dirtied_after(inode, work->older_than_this)) | 252 | if (work->older_than_this && |
253 | inode_dirtied_after(inode, *work->older_than_this)) | ||
259 | break; | 254 | break; |
260 | list_move(&inode->i_wb_list, &tmp); | 255 | list_move(&inode->i_wb_list, &tmp); |
261 | moved++; | 256 | moved++; |
@@ -742,8 +737,6 @@ static long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages, | |||
742 | .sync_mode = WB_SYNC_NONE, | 737 | .sync_mode = WB_SYNC_NONE, |
743 | .range_cyclic = 1, | 738 | .range_cyclic = 1, |
744 | .reason = reason, | 739 | .reason = reason, |
745 | .older_than_this = jiffies, | ||
746 | .older_than_this_is_set = 1, | ||
747 | }; | 740 | }; |
748 | 741 | ||
749 | spin_lock(&wb->list_lock); | 742 | spin_lock(&wb->list_lock); |
@@ -802,13 +795,12 @@ static long wb_writeback(struct bdi_writeback *wb, | |||
802 | { | 795 | { |
803 | unsigned long wb_start = jiffies; | 796 | unsigned long wb_start = jiffies; |
804 | long nr_pages = work->nr_pages; | 797 | long nr_pages = work->nr_pages; |
798 | unsigned long oldest_jif; | ||
805 | struct inode *inode; | 799 | struct inode *inode; |
806 | long progress; | 800 | long progress; |
807 | 801 | ||
808 | if (!work->older_than_this_is_set) { | 802 | oldest_jif = jiffies; |
809 | work->older_than_this = jiffies; | 803 | work->older_than_this = &oldest_jif; |
810 | work->older_than_this_is_set = 1; | ||
811 | } | ||
812 | 804 | ||
813 | spin_lock(&wb->list_lock); | 805 | spin_lock(&wb->list_lock); |
814 | for (;;) { | 806 | for (;;) { |
@@ -842,10 +834,10 @@ static long wb_writeback(struct bdi_writeback *wb, | |||
842 | * safe. | 834 | * safe. |
843 | */ | 835 | */ |
844 | if (work->for_kupdate) { | 836 | if (work->for_kupdate) { |
845 | work->older_than_this = jiffies - | 837 | oldest_jif = jiffies - |
846 | msecs_to_jiffies(dirty_expire_interval * 10); | 838 | msecs_to_jiffies(dirty_expire_interval * 10); |
847 | } else if (work->for_background) | 839 | } else if (work->for_background) |
848 | work->older_than_this = jiffies; | 840 | oldest_jif = jiffies; |
849 | 841 | ||
850 | trace_writeback_start(wb->bdi, work); | 842 | trace_writeback_start(wb->bdi, work); |
851 | if (list_empty(&wb->b_io)) | 843 | if (list_empty(&wb->b_io)) |
@@ -1357,21 +1349,18 @@ EXPORT_SYMBOL(try_to_writeback_inodes_sb); | |||
1357 | 1349 | ||
1358 | /** | 1350 | /** |
1359 | * sync_inodes_sb - sync sb inode pages | 1351 | * sync_inodes_sb - sync sb inode pages |
1360 | * @sb: the superblock | 1352 | * @sb: the superblock |
1361 | * @older_than_this: timestamp | ||
1362 | * | 1353 | * |
1363 | * This function writes and waits on any dirty inode belonging to this | 1354 | * This function writes and waits on any dirty inode belonging to this |
1364 | * superblock that has been dirtied before given timestamp. | 1355 | * super_block. |
1365 | */ | 1356 | */ |
1366 | void sync_inodes_sb(struct super_block *sb, unsigned long older_than_this) | 1357 | void sync_inodes_sb(struct super_block *sb) |
1367 | { | 1358 | { |
1368 | DECLARE_COMPLETION_ONSTACK(done); | 1359 | DECLARE_COMPLETION_ONSTACK(done); |
1369 | struct wb_writeback_work work = { | 1360 | struct wb_writeback_work work = { |
1370 | .sb = sb, | 1361 | .sb = sb, |
1371 | .sync_mode = WB_SYNC_ALL, | 1362 | .sync_mode = WB_SYNC_ALL, |
1372 | .nr_pages = LONG_MAX, | 1363 | .nr_pages = LONG_MAX, |
1373 | .older_than_this = older_than_this, | ||
1374 | .older_than_this_is_set = 1, | ||
1375 | .range_cyclic = 0, | 1364 | .range_cyclic = 0, |
1376 | .done = &done, | 1365 | .done = &done, |
1377 | .reason = WB_REASON_SYNC, | 1366 | .reason = WB_REASON_SYNC, |
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 0d6ce895a9ee..0f4152defe7b 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c | |||
@@ -94,6 +94,7 @@ const void *kernfs_super_ns(struct super_block *sb) | |||
94 | * @fs_type: file_system_type of the fs being mounted | 94 | * @fs_type: file_system_type of the fs being mounted |
95 | * @flags: mount flags specified for the mount | 95 | * @flags: mount flags specified for the mount |
96 | * @root: kernfs_root of the hierarchy being mounted | 96 | * @root: kernfs_root of the hierarchy being mounted |
97 | * @new_sb_created: tell the caller if we allocated a new superblock | ||
97 | * @ns: optional namespace tag of the mount | 98 | * @ns: optional namespace tag of the mount |
98 | * | 99 | * |
99 | * This is to be called from each kernfs user's file_system_type->mount() | 100 | * This is to be called from each kernfs user's file_system_type->mount() |
@@ -104,7 +105,8 @@ const void *kernfs_super_ns(struct super_block *sb) | |||
104 | * The return value can be passed to the vfs layer verbatim. | 105 | * The return value can be passed to the vfs layer verbatim. |
105 | */ | 106 | */ |
106 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 107 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
107 | struct kernfs_root *root, const void *ns) | 108 | struct kernfs_root *root, bool *new_sb_created, |
109 | const void *ns) | ||
108 | { | 110 | { |
109 | struct super_block *sb; | 111 | struct super_block *sb; |
110 | struct kernfs_super_info *info; | 112 | struct kernfs_super_info *info; |
@@ -122,6 +124,10 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | |||
122 | kfree(info); | 124 | kfree(info); |
123 | if (IS_ERR(sb)) | 125 | if (IS_ERR(sb)) |
124 | return ERR_CAST(sb); | 126 | return ERR_CAST(sb); |
127 | |||
128 | if (new_sb_created) | ||
129 | *new_sb_created = !sb->s_root; | ||
130 | |||
125 | if (!sb->s_root) { | 131 | if (!sb->s_root) { |
126 | error = kernfs_fill_super(sb); | 132 | error = kernfs_fill_super(sb); |
127 | if (error) { | 133 | if (error) { |
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 0b9ff4395e6a..abc8cbcfe90e 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -86,7 +86,7 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
86 | struct fsnotify_mark *inode_mark, | 86 | struct fsnotify_mark *inode_mark, |
87 | struct fsnotify_mark *vfsmount_mark, | 87 | struct fsnotify_mark *vfsmount_mark, |
88 | u32 mask, void *data, int data_type, | 88 | u32 mask, void *data, int data_type, |
89 | const unsigned char *file_name) | 89 | const unsigned char *file_name, u32 cookie) |
90 | { | 90 | { |
91 | struct dnotify_mark *dn_mark; | 91 | struct dnotify_mark *dn_mark; |
92 | struct dnotify_struct *dn; | 92 | struct dnotify_struct *dn; |
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 0e792f5e3147..dc638f786d5c 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -147,7 +147,7 @@ static int fanotify_handle_event(struct fsnotify_group *group, | |||
147 | struct fsnotify_mark *inode_mark, | 147 | struct fsnotify_mark *inode_mark, |
148 | struct fsnotify_mark *fanotify_mark, | 148 | struct fsnotify_mark *fanotify_mark, |
149 | u32 mask, void *data, int data_type, | 149 | u32 mask, void *data, int data_type, |
150 | const unsigned char *file_name) | 150 | const unsigned char *file_name, u32 cookie) |
151 | { | 151 | { |
152 | int ret = 0; | 152 | int ret = 0; |
153 | struct fanotify_event_info *event; | 153 | struct fanotify_event_info *event; |
@@ -192,10 +192,12 @@ static int fanotify_handle_event(struct fsnotify_group *group, | |||
192 | 192 | ||
193 | ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); | 193 | ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); |
194 | if (ret) { | 194 | if (ret) { |
195 | BUG_ON(mask & FAN_ALL_PERM_EVENTS); | 195 | /* Permission events shouldn't be merged */ |
196 | BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS); | ||
196 | /* Our event wasn't used in the end. Free it. */ | 197 | /* Our event wasn't used in the end. Free it. */ |
197 | fsnotify_destroy_event(group, fsn_event); | 198 | fsnotify_destroy_event(group, fsn_event); |
198 | ret = 0; | 199 | |
200 | return 0; | ||
199 | } | 201 | } |
200 | 202 | ||
201 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 203 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index b6175fa11bf8..287a22c04149 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -698,6 +698,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
698 | struct fsnotify_group *group; | 698 | struct fsnotify_group *group; |
699 | int f_flags, fd; | 699 | int f_flags, fd; |
700 | struct user_struct *user; | 700 | struct user_struct *user; |
701 | struct fanotify_event_info *oevent; | ||
701 | 702 | ||
702 | pr_debug("%s: flags=%d event_f_flags=%d\n", | 703 | pr_debug("%s: flags=%d event_f_flags=%d\n", |
703 | __func__, flags, event_f_flags); | 704 | __func__, flags, event_f_flags); |
@@ -730,8 +731,20 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) | |||
730 | group->fanotify_data.user = user; | 731 | group->fanotify_data.user = user; |
731 | atomic_inc(&user->fanotify_listeners); | 732 | atomic_inc(&user->fanotify_listeners); |
732 | 733 | ||
734 | oevent = kmem_cache_alloc(fanotify_event_cachep, GFP_KERNEL); | ||
735 | if (unlikely(!oevent)) { | ||
736 | fd = -ENOMEM; | ||
737 | goto out_destroy_group; | ||
738 | } | ||
739 | group->overflow_event = &oevent->fse; | ||
740 | fsnotify_init_event(group->overflow_event, NULL, FS_Q_OVERFLOW); | ||
741 | oevent->tgid = get_pid(task_tgid(current)); | ||
742 | oevent->path.mnt = NULL; | ||
743 | oevent->path.dentry = NULL; | ||
744 | |||
733 | group->fanotify_data.f_flags = event_f_flags; | 745 | group->fanotify_data.f_flags = event_f_flags; |
734 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS | 746 | #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |
747 | oevent->response = 0; | ||
735 | mutex_init(&group->fanotify_data.access_mutex); | 748 | mutex_init(&group->fanotify_data.access_mutex); |
736 | init_waitqueue_head(&group->fanotify_data.access_waitq); | 749 | init_waitqueue_head(&group->fanotify_data.access_waitq); |
737 | INIT_LIST_HEAD(&group->fanotify_data.access_list); | 750 | INIT_LIST_HEAD(&group->fanotify_data.access_list); |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 1d4e1ea2f37c..9d3e9c50066a 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -179,7 +179,7 @@ static int send_to_group(struct inode *to_tell, | |||
179 | 179 | ||
180 | return group->ops->handle_event(group, to_tell, inode_mark, | 180 | return group->ops->handle_event(group, to_tell, inode_mark, |
181 | vfsmount_mark, mask, data, data_is, | 181 | vfsmount_mark, mask, data, data_is, |
182 | file_name); | 182 | file_name, cookie); |
183 | } | 183 | } |
184 | 184 | ||
185 | /* | 185 | /* |
diff --git a/fs/notify/group.c b/fs/notify/group.c index ee674fe2cec7..ad1995980456 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -55,6 +55,13 @@ void fsnotify_destroy_group(struct fsnotify_group *group) | |||
55 | /* clear the notification queue of all events */ | 55 | /* clear the notification queue of all events */ |
56 | fsnotify_flush_notify(group); | 56 | fsnotify_flush_notify(group); |
57 | 57 | ||
58 | /* | ||
59 | * Destroy overflow event (we cannot use fsnotify_destroy_event() as | ||
60 | * that deliberately ignores overflow events. | ||
61 | */ | ||
62 | if (group->overflow_event) | ||
63 | group->ops->free_event(group->overflow_event); | ||
64 | |||
58 | fsnotify_put_group(group); | 65 | fsnotify_put_group(group); |
59 | } | 66 | } |
60 | 67 | ||
@@ -99,7 +106,6 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops) | |||
99 | INIT_LIST_HEAD(&group->marks_list); | 106 | INIT_LIST_HEAD(&group->marks_list); |
100 | 107 | ||
101 | group->ops = ops; | 108 | group->ops = ops; |
102 | fsnotify_init_event(&group->overflow_event, NULL, FS_Q_OVERFLOW); | ||
103 | 109 | ||
104 | return group; | 110 | return group; |
105 | } | 111 | } |
diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h index 485eef3f4407..ed855ef6f077 100644 --- a/fs/notify/inotify/inotify.h +++ b/fs/notify/inotify/inotify.h | |||
@@ -27,6 +27,6 @@ extern int inotify_handle_event(struct fsnotify_group *group, | |||
27 | struct fsnotify_mark *inode_mark, | 27 | struct fsnotify_mark *inode_mark, |
28 | struct fsnotify_mark *vfsmount_mark, | 28 | struct fsnotify_mark *vfsmount_mark, |
29 | u32 mask, void *data, int data_type, | 29 | u32 mask, void *data, int data_type, |
30 | const unsigned char *file_name); | 30 | const unsigned char *file_name, u32 cookie); |
31 | 31 | ||
32 | extern const struct fsnotify_ops inotify_fsnotify_ops; | 32 | extern const struct fsnotify_ops inotify_fsnotify_ops; |
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index d5ee56348bb8..43ab1e1a07a2 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c | |||
@@ -67,7 +67,7 @@ int inotify_handle_event(struct fsnotify_group *group, | |||
67 | struct fsnotify_mark *inode_mark, | 67 | struct fsnotify_mark *inode_mark, |
68 | struct fsnotify_mark *vfsmount_mark, | 68 | struct fsnotify_mark *vfsmount_mark, |
69 | u32 mask, void *data, int data_type, | 69 | u32 mask, void *data, int data_type, |
70 | const unsigned char *file_name) | 70 | const unsigned char *file_name, u32 cookie) |
71 | { | 71 | { |
72 | struct inotify_inode_mark *i_mark; | 72 | struct inotify_inode_mark *i_mark; |
73 | struct inotify_event_info *event; | 73 | struct inotify_event_info *event; |
@@ -103,6 +103,7 @@ int inotify_handle_event(struct fsnotify_group *group, | |||
103 | fsn_event = &event->fse; | 103 | fsn_event = &event->fse; |
104 | fsnotify_init_event(fsn_event, inode, mask); | 104 | fsnotify_init_event(fsn_event, inode, mask); |
105 | event->wd = i_mark->wd; | 105 | event->wd = i_mark->wd; |
106 | event->sync_cookie = cookie; | ||
106 | event->name_len = len; | 107 | event->name_len = len; |
107 | if (len) | 108 | if (len) |
108 | strcpy(event->name, file_name); | 109 | strcpy(event->name, file_name); |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 497395c8274b..78a2ca3966c3 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -495,7 +495,7 @@ void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, | |||
495 | 495 | ||
496 | /* Queue ignore event for the watch */ | 496 | /* Queue ignore event for the watch */ |
497 | inotify_handle_event(group, NULL, fsn_mark, NULL, FS_IN_IGNORED, | 497 | inotify_handle_event(group, NULL, fsn_mark, NULL, FS_IN_IGNORED, |
498 | NULL, FSNOTIFY_EVENT_NONE, NULL); | 498 | NULL, FSNOTIFY_EVENT_NONE, NULL, 0); |
499 | 499 | ||
500 | i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); | 500 | i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); |
501 | /* remove this mark from the idr */ | 501 | /* remove this mark from the idr */ |
@@ -633,11 +633,23 @@ static int inotify_update_watch(struct fsnotify_group *group, struct inode *inod | |||
633 | static struct fsnotify_group *inotify_new_group(unsigned int max_events) | 633 | static struct fsnotify_group *inotify_new_group(unsigned int max_events) |
634 | { | 634 | { |
635 | struct fsnotify_group *group; | 635 | struct fsnotify_group *group; |
636 | struct inotify_event_info *oevent; | ||
636 | 637 | ||
637 | group = fsnotify_alloc_group(&inotify_fsnotify_ops); | 638 | group = fsnotify_alloc_group(&inotify_fsnotify_ops); |
638 | if (IS_ERR(group)) | 639 | if (IS_ERR(group)) |
639 | return group; | 640 | return group; |
640 | 641 | ||
642 | oevent = kmalloc(sizeof(struct inotify_event_info), GFP_KERNEL); | ||
643 | if (unlikely(!oevent)) { | ||
644 | fsnotify_destroy_group(group); | ||
645 | return ERR_PTR(-ENOMEM); | ||
646 | } | ||
647 | group->overflow_event = &oevent->fse; | ||
648 | fsnotify_init_event(group->overflow_event, NULL, FS_Q_OVERFLOW); | ||
649 | oevent->wd = -1; | ||
650 | oevent->sync_cookie = 0; | ||
651 | oevent->name_len = 0; | ||
652 | |||
641 | group->max_events = max_events; | 653 | group->max_events = max_events; |
642 | 654 | ||
643 | spin_lock_init(&group->inotify_data.idr_lock); | 655 | spin_lock_init(&group->inotify_data.idr_lock); |
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 18b3c4427dca..1e58402171a5 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -80,7 +80,8 @@ void fsnotify_destroy_event(struct fsnotify_group *group, | |||
80 | /* | 80 | /* |
81 | * Add an event to the group notification queue. The group can later pull this | 81 | * Add an event to the group notification queue. The group can later pull this |
82 | * event off the queue to deal with. The function returns 0 if the event was | 82 | * event off the queue to deal with. The function returns 0 if the event was |
83 | * added to the queue, 1 if the event was merged with some other queued event. | 83 | * added to the queue, 1 if the event was merged with some other queued event, |
84 | * 2 if the queue of events has overflown. | ||
84 | */ | 85 | */ |
85 | int fsnotify_add_notify_event(struct fsnotify_group *group, | 86 | int fsnotify_add_notify_event(struct fsnotify_group *group, |
86 | struct fsnotify_event *event, | 87 | struct fsnotify_event *event, |
@@ -95,10 +96,14 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, | |||
95 | mutex_lock(&group->notification_mutex); | 96 | mutex_lock(&group->notification_mutex); |
96 | 97 | ||
97 | if (group->q_len >= group->max_events) { | 98 | if (group->q_len >= group->max_events) { |
99 | ret = 2; | ||
98 | /* Queue overflow event only if it isn't already queued */ | 100 | /* Queue overflow event only if it isn't already queued */ |
99 | if (list_empty(&group->overflow_event.list)) | 101 | if (!list_empty(&group->overflow_event->list)) { |
100 | event = &group->overflow_event; | 102 | mutex_unlock(&group->notification_mutex); |
101 | ret = 1; | 103 | return ret; |
104 | } | ||
105 | event = group->overflow_event; | ||
106 | goto queue; | ||
102 | } | 107 | } |
103 | 108 | ||
104 | if (!list_empty(list) && merge) { | 109 | if (!list_empty(list) && merge) { |
@@ -109,6 +114,7 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, | |||
109 | } | 114 | } |
110 | } | 115 | } |
111 | 116 | ||
117 | queue: | ||
112 | group->q_len++; | 118 | group->q_len++; |
113 | list_add_tail(&event->list, list); | 119 | list_add_tail(&event->list, list); |
114 | mutex_unlock(&group->notification_mutex); | 120 | mutex_unlock(&group->notification_mutex); |
@@ -132,7 +138,11 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group | |||
132 | 138 | ||
133 | event = list_first_entry(&group->notification_list, | 139 | event = list_first_entry(&group->notification_list, |
134 | struct fsnotify_event, list); | 140 | struct fsnotify_event, list); |
135 | list_del(&event->list); | 141 | /* |
142 | * We need to init list head for the case of overflow event so that | ||
143 | * check in fsnotify_add_notify_events() works | ||
144 | */ | ||
145 | list_del_init(&event->list); | ||
136 | group->q_len--; | 146 | group->q_len--; |
137 | 147 | ||
138 | return event; | 148 | return event; |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 831d49a4111f..cfc8dcc16043 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -581,9 +581,17 @@ int dquot_scan_active(struct super_block *sb, | |||
581 | dqstats_inc(DQST_LOOKUPS); | 581 | dqstats_inc(DQST_LOOKUPS); |
582 | dqput(old_dquot); | 582 | dqput(old_dquot); |
583 | old_dquot = dquot; | 583 | old_dquot = dquot; |
584 | ret = fn(dquot, priv); | 584 | /* |
585 | if (ret < 0) | 585 | * ->release_dquot() can be racing with us. Our reference |
586 | goto out; | 586 | * protects us from new calls to it so just wait for any |
587 | * outstanding call and recheck the DQ_ACTIVE_B after that. | ||
588 | */ | ||
589 | wait_on_dquot(dquot); | ||
590 | if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { | ||
591 | ret = fn(dquot, priv); | ||
592 | if (ret < 0) | ||
593 | goto out; | ||
594 | } | ||
587 | spin_lock(&dq_list_lock); | 595 | spin_lock(&dq_list_lock); |
588 | /* We are safe to continue now because our dquot could not | 596 | /* We are safe to continue now because our dquot could not |
589 | * be moved out of the inuse list while we hold the reference */ | 597 | * be moved out of the inuse list while we hold the reference */ |
@@ -27,11 +27,10 @@ | |||
27 | * wait == 1 case since in that case write_inode() functions do | 27 | * wait == 1 case since in that case write_inode() functions do |
28 | * sync_dirty_buffer() and thus effectively write one block at a time. | 28 | * sync_dirty_buffer() and thus effectively write one block at a time. |
29 | */ | 29 | */ |
30 | static int __sync_filesystem(struct super_block *sb, int wait, | 30 | static int __sync_filesystem(struct super_block *sb, int wait) |
31 | unsigned long start) | ||
32 | { | 31 | { |
33 | if (wait) | 32 | if (wait) |
34 | sync_inodes_sb(sb, start); | 33 | sync_inodes_sb(sb); |
35 | else | 34 | else |
36 | writeback_inodes_sb(sb, WB_REASON_SYNC); | 35 | writeback_inodes_sb(sb, WB_REASON_SYNC); |
37 | 36 | ||
@@ -48,7 +47,6 @@ static int __sync_filesystem(struct super_block *sb, int wait, | |||
48 | int sync_filesystem(struct super_block *sb) | 47 | int sync_filesystem(struct super_block *sb) |
49 | { | 48 | { |
50 | int ret; | 49 | int ret; |
51 | unsigned long start = jiffies; | ||
52 | 50 | ||
53 | /* | 51 | /* |
54 | * We need to be protected against the filesystem going from | 52 | * We need to be protected against the filesystem going from |
@@ -62,17 +60,17 @@ int sync_filesystem(struct super_block *sb) | |||
62 | if (sb->s_flags & MS_RDONLY) | 60 | if (sb->s_flags & MS_RDONLY) |
63 | return 0; | 61 | return 0; |
64 | 62 | ||
65 | ret = __sync_filesystem(sb, 0, start); | 63 | ret = __sync_filesystem(sb, 0); |
66 | if (ret < 0) | 64 | if (ret < 0) |
67 | return ret; | 65 | return ret; |
68 | return __sync_filesystem(sb, 1, start); | 66 | return __sync_filesystem(sb, 1); |
69 | } | 67 | } |
70 | EXPORT_SYMBOL_GPL(sync_filesystem); | 68 | EXPORT_SYMBOL_GPL(sync_filesystem); |
71 | 69 | ||
72 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) | 70 | static void sync_inodes_one_sb(struct super_block *sb, void *arg) |
73 | { | 71 | { |
74 | if (!(sb->s_flags & MS_RDONLY)) | 72 | if (!(sb->s_flags & MS_RDONLY)) |
75 | sync_inodes_sb(sb, *((unsigned long *)arg)); | 73 | sync_inodes_sb(sb); |
76 | } | 74 | } |
77 | 75 | ||
78 | static void sync_fs_one_sb(struct super_block *sb, void *arg) | 76 | static void sync_fs_one_sb(struct super_block *sb, void *arg) |
@@ -104,10 +102,9 @@ static void fdatawait_one_bdev(struct block_device *bdev, void *arg) | |||
104 | SYSCALL_DEFINE0(sync) | 102 | SYSCALL_DEFINE0(sync) |
105 | { | 103 | { |
106 | int nowait = 0, wait = 1; | 104 | int nowait = 0, wait = 1; |
107 | unsigned long start = jiffies; | ||
108 | 105 | ||
109 | wakeup_flusher_threads(0, WB_REASON_SYNC); | 106 | wakeup_flusher_threads(0, WB_REASON_SYNC); |
110 | iterate_supers(sync_inodes_one_sb, &start); | 107 | iterate_supers(sync_inodes_one_sb, NULL); |
111 | iterate_supers(sync_fs_one_sb, &nowait); | 108 | iterate_supers(sync_fs_one_sb, &nowait); |
112 | iterate_supers(sync_fs_one_sb, &wait); | 109 | iterate_supers(sync_fs_one_sb, &wait); |
113 | iterate_bdevs(fdatawrite_one_bdev, NULL); | 110 | iterate_bdevs(fdatawrite_one_bdev, NULL); |
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c index 6211230814fd..3eaf5c6622eb 100644 --- a/fs/sysfs/mount.c +++ b/fs/sysfs/mount.c | |||
@@ -27,6 +27,7 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, | |||
27 | { | 27 | { |
28 | struct dentry *root; | 28 | struct dentry *root; |
29 | void *ns; | 29 | void *ns; |
30 | bool new_sb; | ||
30 | 31 | ||
31 | if (!(flags & MS_KERNMOUNT)) { | 32 | if (!(flags & MS_KERNMOUNT)) { |
32 | if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type)) | 33 | if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type)) |
@@ -37,8 +38,8 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type, | |||
37 | } | 38 | } |
38 | 39 | ||
39 | ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); | 40 | ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); |
40 | root = kernfs_mount_ns(fs_type, flags, sysfs_root, ns); | 41 | root = kernfs_mount_ns(fs_type, flags, sysfs_root, &new_sb, ns); |
41 | if (IS_ERR(root)) | 42 | if (IS_ERR(root) || !new_sb) |
42 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); | 43 | kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); |
43 | return root; | 44 | return root; |
44 | } | 45 | } |
diff --git a/fs/udf/file.c b/fs/udf/file.c index c02a27a19c6d..1037637957c7 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -144,6 +144,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
144 | size_t count = iocb->ki_nbytes; | 144 | size_t count = iocb->ki_nbytes; |
145 | struct udf_inode_info *iinfo = UDF_I(inode); | 145 | struct udf_inode_info *iinfo = UDF_I(inode); |
146 | 146 | ||
147 | mutex_lock(&inode->i_mutex); | ||
147 | down_write(&iinfo->i_data_sem); | 148 | down_write(&iinfo->i_data_sem); |
148 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { | 149 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { |
149 | if (file->f_flags & O_APPEND) | 150 | if (file->f_flags & O_APPEND) |
@@ -156,6 +157,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
156 | pos + count)) { | 157 | pos + count)) { |
157 | err = udf_expand_file_adinicb(inode); | 158 | err = udf_expand_file_adinicb(inode); |
158 | if (err) { | 159 | if (err) { |
160 | mutex_unlock(&inode->i_mutex); | ||
159 | udf_debug("udf_expand_adinicb: err=%d\n", err); | 161 | udf_debug("udf_expand_adinicb: err=%d\n", err); |
160 | return err; | 162 | return err; |
161 | } | 163 | } |
@@ -169,9 +171,17 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
169 | } else | 171 | } else |
170 | up_write(&iinfo->i_data_sem); | 172 | up_write(&iinfo->i_data_sem); |
171 | 173 | ||
172 | retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); | 174 | retval = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); |
173 | if (retval > 0) | 175 | mutex_unlock(&inode->i_mutex); |
176 | |||
177 | if (retval > 0) { | ||
178 | ssize_t err; | ||
179 | |||
174 | mark_inode_dirty(inode); | 180 | mark_inode_dirty(inode); |
181 | err = generic_write_sync(file, iocb->ki_pos - retval, retval); | ||
182 | if (err < 0) | ||
183 | retval = err; | ||
184 | } | ||
175 | 185 | ||
176 | return retval; | 186 | return retval; |
177 | } | 187 | } |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 062b7925bca0..982ce05c87ed 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -265,6 +265,7 @@ int udf_expand_file_adinicb(struct inode *inode) | |||
265 | .nr_to_write = 1, | 265 | .nr_to_write = 1, |
266 | }; | 266 | }; |
267 | 267 | ||
268 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | ||
268 | if (!iinfo->i_lenAlloc) { | 269 | if (!iinfo->i_lenAlloc) { |
269 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 270 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
270 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 271 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index f317488263dd..d971f4932b5d 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -913,7 +913,7 @@ xfs_flush_inodes( | |||
913 | struct super_block *sb = mp->m_super; | 913 | struct super_block *sb = mp->m_super; |
914 | 914 | ||
915 | if (down_read_trylock(&sb->s_umount)) { | 915 | if (down_read_trylock(&sb->s_umount)) { |
916 | sync_inodes_sb(sb, jiffies); | 916 | sync_inodes_sb(sb); |
917 | up_read(&sb->s_umount); | 917 | up_read(&sb->s_umount); |
918 | } | 918 | } |
919 | } | 919 | } |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 3d286ff49ab0..64cf3ef50696 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -99,7 +99,7 @@ struct fsnotify_ops { | |||
99 | struct fsnotify_mark *inode_mark, | 99 | struct fsnotify_mark *inode_mark, |
100 | struct fsnotify_mark *vfsmount_mark, | 100 | struct fsnotify_mark *vfsmount_mark, |
101 | u32 mask, void *data, int data_type, | 101 | u32 mask, void *data, int data_type, |
102 | const unsigned char *file_name); | 102 | const unsigned char *file_name, u32 cookie); |
103 | void (*free_group_priv)(struct fsnotify_group *group); | 103 | void (*free_group_priv)(struct fsnotify_group *group); |
104 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); | 104 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); |
105 | void (*free_event)(struct fsnotify_event *event); | 105 | void (*free_event)(struct fsnotify_event *event); |
@@ -160,7 +160,7 @@ struct fsnotify_group { | |||
160 | 160 | ||
161 | struct fasync_struct *fsn_fa; /* async notification */ | 161 | struct fasync_struct *fsn_fa; /* async notification */ |
162 | 162 | ||
163 | struct fsnotify_event overflow_event; /* Event we queue when the | 163 | struct fsnotify_event *overflow_event; /* Event we queue when the |
164 | * notification list is too | 164 | * notification list is too |
165 | * full */ | 165 | * full */ |
166 | 166 | ||
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index e7831d203737..35e7eca4e33b 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h | |||
@@ -118,9 +118,7 @@ extern int mq_init_ns(struct ipc_namespace *ns); | |||
118 | * the new maximum will handle anyone else. I may have to revisit this | 118 | * the new maximum will handle anyone else. I may have to revisit this |
119 | * in the future. | 119 | * in the future. |
120 | */ | 120 | */ |
121 | #define MIN_QUEUESMAX 1 | ||
122 | #define DFLT_QUEUESMAX 256 | 121 | #define DFLT_QUEUESMAX 256 |
123 | #define HARD_QUEUESMAX 1024 | ||
124 | #define MIN_MSGMAX 1 | 122 | #define MIN_MSGMAX 1 |
125 | #define DFLT_MSG 10U | 123 | #define DFLT_MSG 10U |
126 | #define DFLT_MSGMAX 10 | 124 | #define DFLT_MSGMAX 10 |
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 5be9f0228a3b..d267623c28cf 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h | |||
@@ -249,7 +249,8 @@ void kernfs_notify(struct kernfs_node *kn); | |||
249 | 249 | ||
250 | const void *kernfs_super_ns(struct super_block *sb); | 250 | const void *kernfs_super_ns(struct super_block *sb); |
251 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 251 | struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
252 | struct kernfs_root *root, const void *ns); | 252 | struct kernfs_root *root, bool *new_sb_created, |
253 | const void *ns); | ||
253 | void kernfs_kill_sb(struct super_block *sb); | 254 | void kernfs_kill_sb(struct super_block *sb); |
254 | 255 | ||
255 | void kernfs_init(void); | 256 | void kernfs_init(void); |
@@ -317,7 +318,7 @@ static inline const void *kernfs_super_ns(struct super_block *sb) | |||
317 | 318 | ||
318 | static inline struct dentry * | 319 | static inline struct dentry * |
319 | kernfs_mount_ns(struct file_system_type *fs_type, int flags, | 320 | kernfs_mount_ns(struct file_system_type *fs_type, int flags, |
320 | struct kernfs_root *root, const void *ns) | 321 | struct kernfs_root *root, bool *new_sb_created, const void *ns) |
321 | { return ERR_PTR(-ENOSYS); } | 322 | { return ERR_PTR(-ENOSYS); } |
322 | 323 | ||
323 | static inline void kernfs_kill_sb(struct super_block *sb) { } | 324 | static inline void kernfs_kill_sb(struct super_block *sb) { } |
@@ -368,9 +369,9 @@ static inline int kernfs_remove_by_name(struct kernfs_node *parent, | |||
368 | 369 | ||
369 | static inline struct dentry * | 370 | static inline struct dentry * |
370 | kernfs_mount(struct file_system_type *fs_type, int flags, | 371 | kernfs_mount(struct file_system_type *fs_type, int flags, |
371 | struct kernfs_root *root) | 372 | struct kernfs_root *root, bool *new_sb_created) |
372 | { | 373 | { |
373 | return kernfs_mount_ns(fs_type, flags, root, NULL); | 374 | return kernfs_mount_ns(fs_type, flags, root, new_sb_created, NULL); |
374 | } | 375 | } |
375 | 376 | ||
376 | #endif /* __LINUX_KERNFS_H */ | 377 | #endif /* __LINUX_KERNFS_H */ |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index fc0e4320aa6d..021b8a319b9e 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -97,7 +97,7 @@ void writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | |||
97 | int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); | 97 | int try_to_writeback_inodes_sb(struct super_block *, enum wb_reason reason); |
98 | int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, | 98 | int try_to_writeback_inodes_sb_nr(struct super_block *, unsigned long nr, |
99 | enum wb_reason reason); | 99 | enum wb_reason reason); |
100 | void sync_inodes_sb(struct super_block *sb, unsigned long older_than_this); | 100 | void sync_inodes_sb(struct super_block *); |
101 | void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); | 101 | void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); |
102 | void inode_wait_for_writeback(struct inode *inode); | 102 | void inode_wait_for_writeback(struct inode *inode); |
103 | 103 | ||
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 68d92e36facd..6e89ef6c11c1 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -449,14 +449,22 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | |||
449 | /* dapm audio pin control and status */ | 449 | /* dapm audio pin control and status */ |
450 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, | 450 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, |
451 | const char *pin); | 451 | const char *pin); |
452 | int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
453 | const char *pin); | ||
452 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, | 454 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
453 | const char *pin); | 455 | const char *pin); |
456 | int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
457 | const char *pin); | ||
454 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); | 458 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); |
459 | int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
460 | const char *pin); | ||
455 | int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, | 461 | int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, |
456 | const char *pin); | 462 | const char *pin); |
457 | int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); | 463 | int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); |
458 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | 464 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, |
459 | const char *pin); | 465 | const char *pin); |
466 | int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
467 | const char *pin); | ||
460 | int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, | 468 | int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, |
461 | const char *pin); | 469 | const char *pin); |
462 | void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); | 470 | void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index c7bbbe794e65..464ea82e10db 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -287,11 +287,11 @@ TRACE_EVENT(writeback_queue_io, | |||
287 | __field(int, reason) | 287 | __field(int, reason) |
288 | ), | 288 | ), |
289 | TP_fast_assign( | 289 | TP_fast_assign( |
290 | unsigned long older_than_this = work->older_than_this; | 290 | unsigned long *older_than_this = work->older_than_this; |
291 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); | 291 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); |
292 | __entry->older = older_than_this; | 292 | __entry->older = older_than_this ? *older_than_this : 0; |
293 | __entry->age = older_than_this ? | 293 | __entry->age = older_than_this ? |
294 | (jiffies - older_than_this) * 1000 / HZ : -1; | 294 | (jiffies - *older_than_this) * 1000 / HZ : -1; |
295 | __entry->moved = moved; | 295 | __entry->moved = moved; |
296 | __entry->reason = work->reason; | 296 | __entry->reason = work->reason; |
297 | ), | 297 | ), |
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index a20a9b4d3871..dde8041f40d2 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h | |||
@@ -692,9 +692,13 @@ __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ | |||
692 | __SYSCALL(__NR_kcmp, sys_kcmp) | 692 | __SYSCALL(__NR_kcmp, sys_kcmp) |
693 | #define __NR_finit_module 273 | 693 | #define __NR_finit_module 273 |
694 | __SYSCALL(__NR_finit_module, sys_finit_module) | 694 | __SYSCALL(__NR_finit_module, sys_finit_module) |
695 | #define __NR_sched_setattr 274 | ||
696 | __SYSCALL(__NR_sched_setattr, sys_sched_setattr) | ||
697 | #define __NR_sched_getattr 275 | ||
698 | __SYSCALL(__NR_sched_getattr, sys_sched_getattr) | ||
695 | 699 | ||
696 | #undef __NR_syscalls | 700 | #undef __NR_syscalls |
697 | #define __NR_syscalls 274 | 701 | #define __NR_syscalls 276 |
698 | 702 | ||
699 | /* | 703 | /* |
700 | * All syscalls below here should go away really, | 704 | * All syscalls below here should go away really, |
diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c index 383d638340b8..5bb8bfe67149 100644 --- a/ipc/mq_sysctl.c +++ b/ipc/mq_sysctl.c | |||
@@ -22,6 +22,16 @@ static void *get_mq(ctl_table *table) | |||
22 | return which; | 22 | return which; |
23 | } | 23 | } |
24 | 24 | ||
25 | static int proc_mq_dointvec(ctl_table *table, int write, | ||
26 | void __user *buffer, size_t *lenp, loff_t *ppos) | ||
27 | { | ||
28 | struct ctl_table mq_table; | ||
29 | memcpy(&mq_table, table, sizeof(mq_table)); | ||
30 | mq_table.data = get_mq(table); | ||
31 | |||
32 | return proc_dointvec(&mq_table, write, buffer, lenp, ppos); | ||
33 | } | ||
34 | |||
25 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, | 35 | static int proc_mq_dointvec_minmax(ctl_table *table, int write, |
26 | void __user *buffer, size_t *lenp, loff_t *ppos) | 36 | void __user *buffer, size_t *lenp, loff_t *ppos) |
27 | { | 37 | { |
@@ -33,12 +43,10 @@ static int proc_mq_dointvec_minmax(ctl_table *table, int write, | |||
33 | lenp, ppos); | 43 | lenp, ppos); |
34 | } | 44 | } |
35 | #else | 45 | #else |
46 | #define proc_mq_dointvec NULL | ||
36 | #define proc_mq_dointvec_minmax NULL | 47 | #define proc_mq_dointvec_minmax NULL |
37 | #endif | 48 | #endif |
38 | 49 | ||
39 | static int msg_queues_limit_min = MIN_QUEUESMAX; | ||
40 | static int msg_queues_limit_max = HARD_QUEUESMAX; | ||
41 | |||
42 | static int msg_max_limit_min = MIN_MSGMAX; | 50 | static int msg_max_limit_min = MIN_MSGMAX; |
43 | static int msg_max_limit_max = HARD_MSGMAX; | 51 | static int msg_max_limit_max = HARD_MSGMAX; |
44 | 52 | ||
@@ -51,9 +59,7 @@ static ctl_table mq_sysctls[] = { | |||
51 | .data = &init_ipc_ns.mq_queues_max, | 59 | .data = &init_ipc_ns.mq_queues_max, |
52 | .maxlen = sizeof(int), | 60 | .maxlen = sizeof(int), |
53 | .mode = 0644, | 61 | .mode = 0644, |
54 | .proc_handler = proc_mq_dointvec_minmax, | 62 | .proc_handler = proc_mq_dointvec, |
55 | .extra1 = &msg_queues_limit_min, | ||
56 | .extra2 = &msg_queues_limit_max, | ||
57 | }, | 63 | }, |
58 | { | 64 | { |
59 | .procname = "msg_max", | 65 | .procname = "msg_max", |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index ccf1f9fd263a..c3b31179122c 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -433,9 +433,9 @@ static int mqueue_create(struct inode *dir, struct dentry *dentry, | |||
433 | error = -EACCES; | 433 | error = -EACCES; |
434 | goto out_unlock; | 434 | goto out_unlock; |
435 | } | 435 | } |
436 | if (ipc_ns->mq_queues_count >= HARD_QUEUESMAX || | 436 | |
437 | (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && | 437 | if (ipc_ns->mq_queues_count >= ipc_ns->mq_queues_max && |
438 | !capable(CAP_SYS_RESOURCE))) { | 438 | !capable(CAP_SYS_RESOURCE)) { |
439 | error = -ENOSPC; | 439 | error = -ENOSPC; |
440 | goto out_unlock; | 440 | goto out_unlock; |
441 | } | 441 | } |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 67ccf0e7cca9..135944a7b28a 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -916,7 +916,7 @@ static int audit_tree_handle_event(struct fsnotify_group *group, | |||
916 | struct fsnotify_mark *inode_mark, | 916 | struct fsnotify_mark *inode_mark, |
917 | struct fsnotify_mark *vfsmount_mark, | 917 | struct fsnotify_mark *vfsmount_mark, |
918 | u32 mask, void *data, int data_type, | 918 | u32 mask, void *data, int data_type, |
919 | const unsigned char *file_name) | 919 | const unsigned char *file_name, u32 cookie) |
920 | { | 920 | { |
921 | return 0; | 921 | return 0; |
922 | } | 922 | } |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 2596fac5dcb4..70b4554d2fbe 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -471,7 +471,7 @@ static int audit_watch_handle_event(struct fsnotify_group *group, | |||
471 | struct fsnotify_mark *inode_mark, | 471 | struct fsnotify_mark *inode_mark, |
472 | struct fsnotify_mark *vfsmount_mark, | 472 | struct fsnotify_mark *vfsmount_mark, |
473 | u32 mask, void *data, int data_type, | 473 | u32 mask, void *data, int data_type, |
474 | const unsigned char *dname) | 474 | const unsigned char *dname, u32 cookie) |
475 | { | 475 | { |
476 | struct inode *inode; | 476 | struct inode *inode; |
477 | struct audit_parent *parent; | 477 | struct audit_parent *parent; |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 56003c6edfd3..fa0b2d4ad83c 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -7856,14 +7856,14 @@ static void perf_pmu_rotate_stop(struct pmu *pmu) | |||
7856 | static void __perf_event_exit_context(void *__info) | 7856 | static void __perf_event_exit_context(void *__info) |
7857 | { | 7857 | { |
7858 | struct perf_event_context *ctx = __info; | 7858 | struct perf_event_context *ctx = __info; |
7859 | struct perf_event *event, *tmp; | 7859 | struct perf_event *event; |
7860 | 7860 | ||
7861 | perf_pmu_rotate_stop(ctx->pmu); | 7861 | perf_pmu_rotate_stop(ctx->pmu); |
7862 | 7862 | ||
7863 | list_for_each_entry_safe(event, tmp, &ctx->pinned_groups, group_entry) | 7863 | rcu_read_lock(); |
7864 | __perf_remove_from_context(event); | 7864 | list_for_each_entry_rcu(event, &ctx->event_list, event_entry) |
7865 | list_for_each_entry_safe(event, tmp, &ctx->flexible_groups, group_entry) | ||
7866 | __perf_remove_from_context(event); | 7865 | __perf_remove_from_context(event); |
7866 | rcu_read_unlock(); | ||
7867 | } | 7867 | } |
7868 | 7868 | ||
7869 | static void perf_event_exit_cpu_context(int cpu) | 7869 | static void perf_event_exit_cpu_context(int cpu) |
@@ -7887,11 +7887,11 @@ static void perf_event_exit_cpu(int cpu) | |||
7887 | { | 7887 | { |
7888 | struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); | 7888 | struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); |
7889 | 7889 | ||
7890 | perf_event_exit_cpu_context(cpu); | ||
7891 | |||
7890 | mutex_lock(&swhash->hlist_mutex); | 7892 | mutex_lock(&swhash->hlist_mutex); |
7891 | swevent_hlist_release(swhash); | 7893 | swevent_hlist_release(swhash); |
7892 | mutex_unlock(&swhash->hlist_mutex); | 7894 | mutex_unlock(&swhash->hlist_mutex); |
7893 | |||
7894 | perf_event_exit_cpu_context(cpu); | ||
7895 | } | 7895 | } |
7896 | #else | 7896 | #else |
7897 | static inline void perf_event_exit_cpu(int cpu) { } | 7897 | static inline void perf_event_exit_cpu(int cpu) { } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index da23eb96779f..4df39b1bde91 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -1166,8 +1166,10 @@ alloc: | |||
1166 | } else { | 1166 | } else { |
1167 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, | 1167 | ret = do_huge_pmd_wp_page_fallback(mm, vma, address, |
1168 | pmd, orig_pmd, page, haddr); | 1168 | pmd, orig_pmd, page, haddr); |
1169 | if (ret & VM_FAULT_OOM) | 1169 | if (ret & VM_FAULT_OOM) { |
1170 | split_huge_page(page); | 1170 | split_huge_page(page); |
1171 | ret |= VM_FAULT_FALLBACK; | ||
1172 | } | ||
1171 | put_page(page); | 1173 | put_page(page); |
1172 | } | 1174 | } |
1173 | count_vm_event(THP_FAULT_FALLBACK); | 1175 | count_vm_event(THP_FAULT_FALLBACK); |
@@ -1179,9 +1181,10 @@ alloc: | |||
1179 | if (page) { | 1181 | if (page) { |
1180 | split_huge_page(page); | 1182 | split_huge_page(page); |
1181 | put_page(page); | 1183 | put_page(page); |
1182 | } | 1184 | } else |
1185 | split_huge_page_pmd(vma, address, pmd); | ||
1186 | ret |= VM_FAULT_FALLBACK; | ||
1183 | count_vm_event(THP_FAULT_FALLBACK); | 1187 | count_vm_event(THP_FAULT_FALLBACK); |
1184 | ret |= VM_FAULT_OOM; | ||
1185 | goto out; | 1188 | goto out; |
1186 | } | 1189 | } |
1187 | 1190 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 53385cd4e6f0..ce7a8cc7b404 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1687,7 +1687,7 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1687 | * protects memcg_name and makes sure that parallel ooms do not | 1687 | * protects memcg_name and makes sure that parallel ooms do not |
1688 | * interleave | 1688 | * interleave |
1689 | */ | 1689 | */ |
1690 | static DEFINE_SPINLOCK(oom_info_lock); | 1690 | static DEFINE_MUTEX(oom_info_lock); |
1691 | struct cgroup *task_cgrp; | 1691 | struct cgroup *task_cgrp; |
1692 | struct cgroup *mem_cgrp; | 1692 | struct cgroup *mem_cgrp; |
1693 | static char memcg_name[PATH_MAX]; | 1693 | static char memcg_name[PATH_MAX]; |
@@ -1698,7 +1698,7 @@ void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
1698 | if (!p) | 1698 | if (!p) |
1699 | return; | 1699 | return; |
1700 | 1700 | ||
1701 | spin_lock(&oom_info_lock); | 1701 | mutex_lock(&oom_info_lock); |
1702 | rcu_read_lock(); | 1702 | rcu_read_lock(); |
1703 | 1703 | ||
1704 | mem_cgrp = memcg->css.cgroup; | 1704 | mem_cgrp = memcg->css.cgroup; |
@@ -1767,7 +1767,7 @@ done: | |||
1767 | 1767 | ||
1768 | pr_cont("\n"); | 1768 | pr_cont("\n"); |
1769 | } | 1769 | } |
1770 | spin_unlock(&oom_info_lock); | 1770 | mutex_unlock(&oom_info_lock); |
1771 | } | 1771 | } |
1772 | 1772 | ||
1773 | /* | 1773 | /* |
diff --git a/mm/memory.c b/mm/memory.c index be6a0c0d4ae0..22dfa617bddb 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -3348,6 +3348,7 @@ static int __do_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3348 | if (ret & VM_FAULT_LOCKED) | 3348 | if (ret & VM_FAULT_LOCKED) |
3349 | unlock_page(vmf.page); | 3349 | unlock_page(vmf.page); |
3350 | ret = VM_FAULT_HWPOISON; | 3350 | ret = VM_FAULT_HWPOISON; |
3351 | page_cache_release(vmf.page); | ||
3351 | goto uncharge_out; | 3352 | goto uncharge_out; |
3352 | } | 3353 | } |
3353 | 3354 | ||
@@ -3703,7 +3704,6 @@ static int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3703 | if (unlikely(is_vm_hugetlb_page(vma))) | 3704 | if (unlikely(is_vm_hugetlb_page(vma))) |
3704 | return hugetlb_fault(mm, vma, address, flags); | 3705 | return hugetlb_fault(mm, vma, address, flags); |
3705 | 3706 | ||
3706 | retry: | ||
3707 | pgd = pgd_offset(mm, address); | 3707 | pgd = pgd_offset(mm, address); |
3708 | pud = pud_alloc(mm, pgd, address); | 3708 | pud = pud_alloc(mm, pgd, address); |
3709 | if (!pud) | 3709 | if (!pud) |
@@ -3741,20 +3741,13 @@ retry: | |||
3741 | if (dirty && !pmd_write(orig_pmd)) { | 3741 | if (dirty && !pmd_write(orig_pmd)) { |
3742 | ret = do_huge_pmd_wp_page(mm, vma, address, pmd, | 3742 | ret = do_huge_pmd_wp_page(mm, vma, address, pmd, |
3743 | orig_pmd); | 3743 | orig_pmd); |
3744 | /* | 3744 | if (!(ret & VM_FAULT_FALLBACK)) |
3745 | * If COW results in an oom, the huge pmd will | 3745 | return ret; |
3746 | * have been split, so retry the fault on the | ||
3747 | * pte for a smaller charge. | ||
3748 | */ | ||
3749 | if (unlikely(ret & VM_FAULT_OOM)) | ||
3750 | goto retry; | ||
3751 | return ret; | ||
3752 | } else { | 3746 | } else { |
3753 | huge_pmd_set_accessed(mm, vma, address, pmd, | 3747 | huge_pmd_set_accessed(mm, vma, address, pmd, |
3754 | orig_pmd, dirty); | 3748 | orig_pmd, dirty); |
3749 | return 0; | ||
3755 | } | 3750 | } |
3756 | |||
3757 | return 0; | ||
3758 | } | 3751 | } |
3759 | } | 3752 | } |
3760 | 3753 | ||
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index c0f498842129..9c5cdc2caaef 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c | |||
@@ -3338,10 +3338,10 @@ static int filename_write_helper(void *key, void *data, void *ptr) | |||
3338 | if (rc) | 3338 | if (rc) |
3339 | return rc; | 3339 | return rc; |
3340 | 3340 | ||
3341 | buf[0] = ft->stype; | 3341 | buf[0] = cpu_to_le32(ft->stype); |
3342 | buf[1] = ft->ttype; | 3342 | buf[1] = cpu_to_le32(ft->ttype); |
3343 | buf[2] = ft->tclass; | 3343 | buf[2] = cpu_to_le32(ft->tclass); |
3344 | buf[3] = otype->otype; | 3344 | buf[3] = cpu_to_le32(otype->otype); |
3345 | 3345 | ||
3346 | rc = put_entry(buf, sizeof(u32), 4, fp); | 3346 | rc = put_entry(buf, sizeof(u32), 4, fp); |
3347 | if (rc) | 3347 | if (rc) |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6eb903cc6237..ec304f3ae3b4 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4319,6 +4319,54 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4319 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4319 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4320 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4320 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4321 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), | 4321 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), |
4322 | /* ALC282 */ | ||
4323 | SND_PCI_QUIRK(0x103c, 0x220f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4324 | SND_PCI_QUIRK(0x103c, 0x2213, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4325 | SND_PCI_QUIRK(0x103c, 0x2266, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4326 | SND_PCI_QUIRK(0x103c, 0x2267, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4327 | SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4328 | SND_PCI_QUIRK(0x103c, 0x2269, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4329 | SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4330 | SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4331 | SND_PCI_QUIRK(0x103c, 0x227a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4332 | SND_PCI_QUIRK(0x103c, 0x227b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4333 | SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4334 | SND_PCI_QUIRK(0x103c, 0x22a0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4335 | SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4336 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4337 | SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4338 | SND_PCI_QUIRK(0x103c, 0x22c0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4339 | SND_PCI_QUIRK(0x103c, 0x22c1, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4340 | SND_PCI_QUIRK(0x103c, 0x22c2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4341 | SND_PCI_QUIRK(0x103c, 0x22cd, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4342 | SND_PCI_QUIRK(0x103c, 0x22ce, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4343 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4344 | SND_PCI_QUIRK(0x103c, 0x22d0, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4345 | /* ALC290 */ | ||
4346 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4347 | SND_PCI_QUIRK(0x103c, 0x2261, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4348 | SND_PCI_QUIRK(0x103c, 0x2262, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4349 | SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4350 | SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4351 | SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4352 | SND_PCI_QUIRK(0x103c, 0x227d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4353 | SND_PCI_QUIRK(0x103c, 0x227e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4354 | SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4355 | SND_PCI_QUIRK(0x103c, 0x2280, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4356 | SND_PCI_QUIRK(0x103c, 0x2281, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4357 | SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4358 | SND_PCI_QUIRK(0x103c, 0x2289, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4359 | SND_PCI_QUIRK(0x103c, 0x228a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4360 | SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4361 | SND_PCI_QUIRK(0x103c, 0x228c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4362 | SND_PCI_QUIRK(0x103c, 0x228d, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4363 | SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4364 | SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4365 | SND_PCI_QUIRK(0x103c, 0x22c6, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4366 | SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4367 | SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4368 | SND_PCI_QUIRK(0x103c, 0x22c3, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4369 | SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | ||
4322 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), | 4370 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), |
4323 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), | 4371 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
4324 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4372 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a2f11bf8155c..3bc29c9b2529 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -98,6 +98,7 @@ enum { | |||
98 | STAC_92HD83XXX_HP_LED, | 98 | STAC_92HD83XXX_HP_LED, |
99 | STAC_92HD83XXX_HP_INV_LED, | 99 | STAC_92HD83XXX_HP_INV_LED, |
100 | STAC_92HD83XXX_HP_MIC_LED, | 100 | STAC_92HD83XXX_HP_MIC_LED, |
101 | STAC_HP_LED_GPIO10, | ||
101 | STAC_92HD83XXX_HEADSET_JACK, | 102 | STAC_92HD83XXX_HEADSET_JACK, |
102 | STAC_92HD83XXX_HP, | 103 | STAC_92HD83XXX_HP, |
103 | STAC_HP_ENVY_BASS, | 104 | STAC_HP_ENVY_BASS, |
@@ -2130,6 +2131,17 @@ static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec, | |||
2130 | } | 2131 | } |
2131 | } | 2132 | } |
2132 | 2133 | ||
2134 | static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec, | ||
2135 | const struct hda_fixup *fix, int action) | ||
2136 | { | ||
2137 | struct sigmatel_spec *spec = codec->spec; | ||
2138 | |||
2139 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
2140 | spec->gpio_led = 0x10; /* GPIO4 */ | ||
2141 | spec->default_polarity = 0; | ||
2142 | } | ||
2143 | } | ||
2144 | |||
2133 | static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, | 2145 | static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, |
2134 | const struct hda_fixup *fix, int action) | 2146 | const struct hda_fixup *fix, int action) |
2135 | { | 2147 | { |
@@ -2624,6 +2636,12 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = { | |||
2624 | .chained = true, | 2636 | .chained = true, |
2625 | .chain_id = STAC_92HD83XXX_HP, | 2637 | .chain_id = STAC_92HD83XXX_HP, |
2626 | }, | 2638 | }, |
2639 | [STAC_HP_LED_GPIO10] = { | ||
2640 | .type = HDA_FIXUP_FUNC, | ||
2641 | .v.func = stac92hd83xxx_fixup_hp_led_gpio10, | ||
2642 | .chained = true, | ||
2643 | .chain_id = STAC_92HD83XXX_HP, | ||
2644 | }, | ||
2627 | [STAC_92HD83XXX_HEADSET_JACK] = { | 2645 | [STAC_92HD83XXX_HEADSET_JACK] = { |
2628 | .type = HDA_FIXUP_FUNC, | 2646 | .type = HDA_FIXUP_FUNC, |
2629 | .v.func = stac92hd83xxx_fixup_headset_jack, | 2647 | .v.func = stac92hd83xxx_fixup_headset_jack, |
@@ -2702,6 +2720,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = { | |||
2702 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 2720 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
2703 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888, | 2721 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888, |
2704 | "HP Envy Spectre", STAC_HP_ENVY_BASS), | 2722 | "HP Envy Spectre", STAC_HP_ENVY_BASS), |
2723 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899, | ||
2724 | "HP Folio 13", STAC_HP_LED_GPIO10), | ||
2705 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, | 2725 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, |
2706 | "HP Folio", STAC_HP_BNB13_EQ), | 2726 | "HP Folio", STAC_HP_BNB13_EQ), |
2707 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, | 2727 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, |
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 7257a8885f42..34d965a4a040 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -57,8 +57,8 @@ static const u16 ad1980_reg[] = { | |||
57 | static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", | 57 | static const char *ad1980_rec_sel[] = {"Mic", "CD", "NC", "AUX", "Line", |
58 | "Stereo Mix", "Mono Mix", "Phone"}; | 58 | "Stereo Mix", "Mono Mix", "Phone"}; |
59 | 59 | ||
60 | static const struct soc_enum ad1980_cap_src = | 60 | static SOC_ENUM_DOUBLE_DECL(ad1980_cap_src, |
61 | SOC_ENUM_DOUBLE(AC97_REC_SEL, 8, 0, 7, ad1980_rec_sel); | 61 | AC97_REC_SEL, 8, 0, ad1980_rec_sel); |
62 | 62 | ||
63 | static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { | 63 | static const struct snd_kcontrol_new ad1980_snd_ac97_controls[] = { |
64 | SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), | 64 | SOC_DOUBLE("Master Playback Volume", AC97_MASTER, 8, 0, 31, 1), |
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index f295b6569910..f4d965ebc29e 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c | |||
@@ -1268,11 +1268,23 @@ static struct snd_soc_dai_driver da732x_dai[] = { | |||
1268 | }, | 1268 | }, |
1269 | }; | 1269 | }; |
1270 | 1270 | ||
1271 | static bool da732x_volatile(struct device *dev, unsigned int reg) | ||
1272 | { | ||
1273 | switch (reg) { | ||
1274 | case DA732X_REG_HPL_DAC_OFF_CNTL: | ||
1275 | case DA732X_REG_HPR_DAC_OFF_CNTL: | ||
1276 | return true; | ||
1277 | default: | ||
1278 | return false; | ||
1279 | } | ||
1280 | } | ||
1281 | |||
1271 | static const struct regmap_config da732x_regmap = { | 1282 | static const struct regmap_config da732x_regmap = { |
1272 | .reg_bits = 8, | 1283 | .reg_bits = 8, |
1273 | .val_bits = 8, | 1284 | .val_bits = 8, |
1274 | 1285 | ||
1275 | .max_register = DA732X_MAX_REG, | 1286 | .max_register = DA732X_MAX_REG, |
1287 | .volatile_reg = da732x_volatile, | ||
1276 | .reg_defaults = da732x_reg_cache, | 1288 | .reg_defaults = da732x_reg_cache, |
1277 | .num_reg_defaults = ARRAY_SIZE(da732x_reg_cache), | 1289 | .num_reg_defaults = ARRAY_SIZE(da732x_reg_cache), |
1278 | .cache_type = REGCACHE_RBTREE, | 1290 | .cache_type = REGCACHE_RBTREE, |
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c index 5839048ec467..cb736ddc446d 100644 --- a/sound/soc/codecs/isabelle.c +++ b/sound/soc/codecs/isabelle.c | |||
@@ -140,13 +140,17 @@ static const char *isabelle_rx1_texts[] = {"VRX1", "ARX1"}; | |||
140 | static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"}; | 140 | static const char *isabelle_rx2_texts[] = {"VRX2", "ARX2"}; |
141 | 141 | ||
142 | static const struct soc_enum isabelle_rx1_enum[] = { | 142 | static const struct soc_enum isabelle_rx1_enum[] = { |
143 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, 1, isabelle_rx1_texts), | 143 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 3, |
144 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, 1, isabelle_rx1_texts), | 144 | ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts), |
145 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 5, | ||
146 | ARRAY_SIZE(isabelle_rx1_texts), isabelle_rx1_texts), | ||
145 | }; | 147 | }; |
146 | 148 | ||
147 | static const struct soc_enum isabelle_rx2_enum[] = { | 149 | static const struct soc_enum isabelle_rx2_enum[] = { |
148 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, 1, isabelle_rx2_texts), | 150 | SOC_ENUM_SINGLE(ISABELLE_VOICE_HPF_CFG_REG, 2, |
149 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, 1, isabelle_rx2_texts), | 151 | ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts), |
152 | SOC_ENUM_SINGLE(ISABELLE_AUDIO_HPF_CFG_REG, 4, | ||
153 | ARRAY_SIZE(isabelle_rx2_texts), isabelle_rx2_texts), | ||
150 | }; | 154 | }; |
151 | 155 | ||
152 | /* Headset DAC playback switches */ | 156 | /* Headset DAC playback switches */ |
@@ -161,13 +165,17 @@ static const char *isabelle_atx_texts[] = {"AMIC1", "DMIC"}; | |||
161 | static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"}; | 165 | static const char *isabelle_vtx_texts[] = {"AMIC2", "DMIC"}; |
162 | 166 | ||
163 | static const struct soc_enum isabelle_atx_enum[] = { | 167 | static const struct soc_enum isabelle_atx_enum[] = { |
164 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, 1, isabelle_atx_texts), | 168 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 7, |
165 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_atx_texts), | 169 | ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts), |
170 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, | ||
171 | ARRAY_SIZE(isabelle_atx_texts), isabelle_atx_texts), | ||
166 | }; | 172 | }; |
167 | 173 | ||
168 | static const struct soc_enum isabelle_vtx_enum[] = { | 174 | static const struct soc_enum isabelle_vtx_enum[] = { |
169 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, 1, isabelle_vtx_texts), | 175 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 6, |
170 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, 1, isabelle_vtx_texts), | 176 | ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts), |
177 | SOC_ENUM_SINGLE(ISABELLE_DMIC_CFG_REG, 0, | ||
178 | ARRAY_SIZE(isabelle_vtx_texts), isabelle_vtx_texts), | ||
171 | }; | 179 | }; |
172 | 180 | ||
173 | static const struct snd_kcontrol_new atx_mux_controls = | 181 | static const struct snd_kcontrol_new atx_mux_controls = |
@@ -183,17 +191,13 @@ static const char *isabelle_amic1_texts[] = { | |||
183 | /* Left analog microphone selection */ | 191 | /* Left analog microphone selection */ |
184 | static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"}; | 192 | static const char *isabelle_amic2_texts[] = {"Sub Mic", "Aux/FM Right"}; |
185 | 193 | ||
186 | static const struct soc_enum isabelle_amic1_enum[] = { | 194 | static SOC_ENUM_SINGLE_DECL(isabelle_amic1_enum, |
187 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 5, | 195 | ISABELLE_AMIC_CFG_REG, 5, |
188 | ARRAY_SIZE(isabelle_amic1_texts), | 196 | isabelle_amic1_texts); |
189 | isabelle_amic1_texts), | ||
190 | }; | ||
191 | 197 | ||
192 | static const struct soc_enum isabelle_amic2_enum[] = { | 198 | static SOC_ENUM_SINGLE_DECL(isabelle_amic2_enum, |
193 | SOC_ENUM_SINGLE(ISABELLE_AMIC_CFG_REG, 4, | 199 | ISABELLE_AMIC_CFG_REG, 4, |
194 | ARRAY_SIZE(isabelle_amic2_texts), | 200 | isabelle_amic2_texts); |
195 | isabelle_amic2_texts), | ||
196 | }; | ||
197 | 201 | ||
198 | static const struct snd_kcontrol_new amic1_control = | 202 | static const struct snd_kcontrol_new amic1_control = |
199 | SOC_DAPM_ENUM("Route", isabelle_amic1_enum); | 203 | SOC_DAPM_ENUM("Route", isabelle_amic1_enum); |
@@ -206,16 +210,20 @@ static const char *isabelle_st_audio_texts[] = {"ATX1", "ATX2"}; | |||
206 | static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"}; | 210 | static const char *isabelle_st_voice_texts[] = {"VTX1", "VTX2"}; |
207 | 211 | ||
208 | static const struct soc_enum isabelle_st_audio_enum[] = { | 212 | static const struct soc_enum isabelle_st_audio_enum[] = { |
209 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, 1, | 213 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA1_CFG_REG, 7, |
214 | ARRAY_SIZE(isabelle_st_audio_texts), | ||
210 | isabelle_st_audio_texts), | 215 | isabelle_st_audio_texts), |
211 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, 1, | 216 | SOC_ENUM_SINGLE(ISABELLE_ATX_STPGA2_CFG_REG, 7, |
217 | ARRAY_SIZE(isabelle_st_audio_texts), | ||
212 | isabelle_st_audio_texts), | 218 | isabelle_st_audio_texts), |
213 | }; | 219 | }; |
214 | 220 | ||
215 | static const struct soc_enum isabelle_st_voice_enum[] = { | 221 | static const struct soc_enum isabelle_st_voice_enum[] = { |
216 | SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, 1, | 222 | SOC_ENUM_SINGLE(ISABELLE_VTX_STPGA1_CFG_REG, 7, |
223 | ARRAY_SIZE(isabelle_st_voice_texts), | ||
217 | isabelle_st_voice_texts), | 224 | isabelle_st_voice_texts), |
218 | SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, 1, | 225 | SOC_ENUM_SINGLE(ISABELLE_VTX2_STPGA2_CFG_REG, 7, |
226 | ARRAY_SIZE(isabelle_st_voice_texts), | ||
219 | isabelle_st_voice_texts), | 227 | isabelle_st_voice_texts), |
220 | }; | 228 | }; |
221 | 229 | ||
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 06edb396e733..2735361a4c3c 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c | |||
@@ -187,42 +187,42 @@ static const unsigned int sta32x_limiter_drc_release_tlv[] = { | |||
187 | 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), | 187 | 13, 16, TLV_DB_SCALE_ITEM(-1500, 300, 0), |
188 | }; | 188 | }; |
189 | 189 | ||
190 | static const struct soc_enum sta32x_drc_ac_enum = | 190 | static SOC_ENUM_SINGLE_DECL(sta32x_drc_ac_enum, |
191 | SOC_ENUM_SINGLE(STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, | 191 | STA32X_CONFD, STA32X_CONFD_DRC_SHIFT, |
192 | 2, sta32x_drc_ac); | 192 | sta32x_drc_ac); |
193 | static const struct soc_enum sta32x_auto_eq_enum = | 193 | static SOC_ENUM_SINGLE_DECL(sta32x_auto_eq_enum, |
194 | SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, | 194 | STA32X_AUTO1, STA32X_AUTO1_AMEQ_SHIFT, |
195 | 3, sta32x_auto_eq_mode); | 195 | sta32x_auto_eq_mode); |
196 | static const struct soc_enum sta32x_auto_gc_enum = | 196 | static SOC_ENUM_SINGLE_DECL(sta32x_auto_gc_enum, |
197 | SOC_ENUM_SINGLE(STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, | 197 | STA32X_AUTO1, STA32X_AUTO1_AMGC_SHIFT, |
198 | 4, sta32x_auto_gc_mode); | 198 | sta32x_auto_gc_mode); |
199 | static const struct soc_enum sta32x_auto_xo_enum = | 199 | static SOC_ENUM_SINGLE_DECL(sta32x_auto_xo_enum, |
200 | SOC_ENUM_SINGLE(STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, | 200 | STA32X_AUTO2, STA32X_AUTO2_XO_SHIFT, |
201 | 16, sta32x_auto_xo_mode); | 201 | sta32x_auto_xo_mode); |
202 | static const struct soc_enum sta32x_preset_eq_enum = | 202 | static SOC_ENUM_SINGLE_DECL(sta32x_preset_eq_enum, |
203 | SOC_ENUM_SINGLE(STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, | 203 | STA32X_AUTO3, STA32X_AUTO3_PEQ_SHIFT, |
204 | 32, sta32x_preset_eq_mode); | 204 | sta32x_preset_eq_mode); |
205 | static const struct soc_enum sta32x_limiter_ch1_enum = | 205 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch1_enum, |
206 | SOC_ENUM_SINGLE(STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, | 206 | STA32X_C1CFG, STA32X_CxCFG_LS_SHIFT, |
207 | 3, sta32x_limiter_select); | 207 | sta32x_limiter_select); |
208 | static const struct soc_enum sta32x_limiter_ch2_enum = | 208 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch2_enum, |
209 | SOC_ENUM_SINGLE(STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, | 209 | STA32X_C2CFG, STA32X_CxCFG_LS_SHIFT, |
210 | 3, sta32x_limiter_select); | 210 | sta32x_limiter_select); |
211 | static const struct soc_enum sta32x_limiter_ch3_enum = | 211 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter_ch3_enum, |
212 | SOC_ENUM_SINGLE(STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, | 212 | STA32X_C3CFG, STA32X_CxCFG_LS_SHIFT, |
213 | 3, sta32x_limiter_select); | 213 | sta32x_limiter_select); |
214 | static const struct soc_enum sta32x_limiter1_attack_rate_enum = | 214 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_attack_rate_enum, |
215 | SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxA_SHIFT, | 215 | STA32X_L1AR, STA32X_LxA_SHIFT, |
216 | 16, sta32x_limiter_attack_rate); | 216 | sta32x_limiter_attack_rate); |
217 | static const struct soc_enum sta32x_limiter2_attack_rate_enum = | 217 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_attack_rate_enum, |
218 | SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxA_SHIFT, | 218 | STA32X_L2AR, STA32X_LxA_SHIFT, |
219 | 16, sta32x_limiter_attack_rate); | 219 | sta32x_limiter_attack_rate); |
220 | static const struct soc_enum sta32x_limiter1_release_rate_enum = | 220 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter1_release_rate_enum, |
221 | SOC_ENUM_SINGLE(STA32X_L1AR, STA32X_LxR_SHIFT, | 221 | STA32X_L1AR, STA32X_LxR_SHIFT, |
222 | 16, sta32x_limiter_release_rate); | 222 | sta32x_limiter_release_rate); |
223 | static const struct soc_enum sta32x_limiter2_release_rate_enum = | 223 | static SOC_ENUM_SINGLE_DECL(sta32x_limiter2_release_rate_enum, |
224 | SOC_ENUM_SINGLE(STA32X_L2AR, STA32X_LxR_SHIFT, | 224 | STA32X_L2AR, STA32X_LxR_SHIFT, |
225 | 16, sta32x_limiter_release_rate); | 225 | sta32x_limiter_release_rate); |
226 | 226 | ||
227 | /* byte array controls for setting biquad, mixer, scaling coefficients; | 227 | /* byte array controls for setting biquad, mixer, scaling coefficients; |
228 | * for biquads all five coefficients need to be set in one go, | 228 | * for biquads all five coefficients need to be set in one go, |
@@ -331,7 +331,7 @@ static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) | |||
331 | 331 | ||
332 | static int sta32x_cache_sync(struct snd_soc_codec *codec) | 332 | static int sta32x_cache_sync(struct snd_soc_codec *codec) |
333 | { | 333 | { |
334 | struct sta32x_priv *sta32x = codec->control_data; | 334 | struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); |
335 | unsigned int mute; | 335 | unsigned int mute; |
336 | int rc; | 336 | int rc; |
337 | 337 | ||
@@ -434,7 +434,7 @@ SOC_SINGLE_TLV("Treble Tone Control", STA32X_TONE, STA32X_TONE_TTC_SHIFT, 15, 0, | |||
434 | SOC_ENUM("Limiter1 Attack Rate (dB/ms)", sta32x_limiter1_attack_rate_enum), | 434 | SOC_ENUM("Limiter1 Attack Rate (dB/ms)", sta32x_limiter1_attack_rate_enum), |
435 | SOC_ENUM("Limiter2 Attack Rate (dB/ms)", sta32x_limiter2_attack_rate_enum), | 435 | SOC_ENUM("Limiter2 Attack Rate (dB/ms)", sta32x_limiter2_attack_rate_enum), |
436 | SOC_ENUM("Limiter1 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), | 436 | SOC_ENUM("Limiter1 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), |
437 | SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter1_release_rate_enum), | 437 | SOC_ENUM("Limiter2 Release Rate (dB/ms)", sta32x_limiter2_release_rate_enum), |
438 | 438 | ||
439 | /* depending on mode, the attack/release thresholds have | 439 | /* depending on mode, the attack/release thresholds have |
440 | * two different enum definitions; provide both | 440 | * two different enum definitions; provide both |
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 48dc7d2fee36..6d684d934f4d 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -117,19 +117,23 @@ static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, | |||
117 | static const char *wm8400_digital_sidetone[] = | 117 | static const char *wm8400_digital_sidetone[] = |
118 | {"None", "Left ADC", "Right ADC", "Reserved"}; | 118 | {"None", "Left ADC", "Right ADC", "Reserved"}; |
119 | 119 | ||
120 | static const struct soc_enum wm8400_left_digital_sidetone_enum = | 120 | static SOC_ENUM_SINGLE_DECL(wm8400_left_digital_sidetone_enum, |
121 | SOC_ENUM_SINGLE(WM8400_DIGITAL_SIDE_TONE, | 121 | WM8400_DIGITAL_SIDE_TONE, |
122 | WM8400_ADC_TO_DACL_SHIFT, 2, wm8400_digital_sidetone); | 122 | WM8400_ADC_TO_DACL_SHIFT, |
123 | wm8400_digital_sidetone); | ||
123 | 124 | ||
124 | static const struct soc_enum wm8400_right_digital_sidetone_enum = | 125 | static SOC_ENUM_SINGLE_DECL(wm8400_right_digital_sidetone_enum, |
125 | SOC_ENUM_SINGLE(WM8400_DIGITAL_SIDE_TONE, | 126 | WM8400_DIGITAL_SIDE_TONE, |
126 | WM8400_ADC_TO_DACR_SHIFT, 2, wm8400_digital_sidetone); | 127 | WM8400_ADC_TO_DACR_SHIFT, |
128 | wm8400_digital_sidetone); | ||
127 | 129 | ||
128 | static const char *wm8400_adcmode[] = | 130 | static const char *wm8400_adcmode[] = |
129 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; | 131 | {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"}; |
130 | 132 | ||
131 | static const struct soc_enum wm8400_right_adcmode_enum = | 133 | static SOC_ENUM_SINGLE_DECL(wm8400_right_adcmode_enum, |
132 | SOC_ENUM_SINGLE(WM8400_ADC_CTRL, WM8400_ADC_HPF_CUT_SHIFT, 3, wm8400_adcmode); | 134 | WM8400_ADC_CTRL, |
135 | WM8400_ADC_HPF_CUT_SHIFT, | ||
136 | wm8400_adcmode); | ||
133 | 137 | ||
134 | static const struct snd_kcontrol_new wm8400_snd_controls[] = { | 138 | static const struct snd_kcontrol_new wm8400_snd_controls[] = { |
135 | /* INMIXL */ | 139 | /* INMIXL */ |
@@ -422,9 +426,10 @@ SOC_DAPM_SINGLE("RINPGA34 Switch", WM8400_INPUT_MIXER3, WM8400_L34MNB_SHIFT, | |||
422 | static const char *wm8400_ainlmux[] = | 426 | static const char *wm8400_ainlmux[] = |
423 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; | 427 | {"INMIXL Mix", "RXVOICE Mix", "DIFFINL Mix"}; |
424 | 428 | ||
425 | static const struct soc_enum wm8400_ainlmux_enum = | 429 | static SOC_ENUM_SINGLE_DECL(wm8400_ainlmux_enum, |
426 | SOC_ENUM_SINGLE( WM8400_INPUT_MIXER1, WM8400_AINLMODE_SHIFT, | 430 | WM8400_INPUT_MIXER1, |
427 | ARRAY_SIZE(wm8400_ainlmux), wm8400_ainlmux); | 431 | WM8400_AINLMODE_SHIFT, |
432 | wm8400_ainlmux); | ||
428 | 433 | ||
429 | static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls = | 434 | static const struct snd_kcontrol_new wm8400_dapm_ainlmux_controls = |
430 | SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); | 435 | SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); |
@@ -435,9 +440,10 @@ SOC_DAPM_ENUM("Route", wm8400_ainlmux_enum); | |||
435 | static const char *wm8400_ainrmux[] = | 440 | static const char *wm8400_ainrmux[] = |
436 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; | 441 | {"INMIXR Mix", "RXVOICE Mix", "DIFFINR Mix"}; |
437 | 442 | ||
438 | static const struct soc_enum wm8400_ainrmux_enum = | 443 | static SOC_ENUM_SINGLE_DECL(wm8400_ainrmux_enum, |
439 | SOC_ENUM_SINGLE( WM8400_INPUT_MIXER1, WM8400_AINRMODE_SHIFT, | 444 | WM8400_INPUT_MIXER1, |
440 | ARRAY_SIZE(wm8400_ainrmux), wm8400_ainrmux); | 445 | WM8400_AINRMODE_SHIFT, |
446 | wm8400_ainrmux); | ||
441 | 447 | ||
442 | static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls = | 448 | static const struct snd_kcontrol_new wm8400_dapm_ainrmux_controls = |
443 | SOC_DAPM_ENUM("Route", wm8400_ainrmux_enum); | 449 | SOC_DAPM_ENUM("Route", wm8400_ainrmux_enum); |
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c index 89a18d82f303..5bce21013485 100644 --- a/sound/soc/codecs/wm8770.c +++ b/sound/soc/codecs/wm8770.c | |||
@@ -196,8 +196,8 @@ static const char *ain_text[] = { | |||
196 | "AIN5", "AIN6", "AIN7", "AIN8" | 196 | "AIN5", "AIN6", "AIN7", "AIN8" |
197 | }; | 197 | }; |
198 | 198 | ||
199 | static const struct soc_enum ain_enum = | 199 | static SOC_ENUM_DOUBLE_DECL(ain_enum, |
200 | SOC_ENUM_DOUBLE(WM8770_ADCMUX, 0, 4, 8, ain_text); | 200 | WM8770_ADCMUX, 0, 4, ain_text); |
201 | 201 | ||
202 | static const struct snd_kcontrol_new ain_mux = | 202 | static const struct snd_kcontrol_new ain_mux = |
203 | SOC_DAPM_ENUM("Capture Mux", ain_enum); | 203 | SOC_DAPM_ENUM("Capture Mux", ain_enum); |
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c index e98bc7038a08..43c2201cb901 100644 --- a/sound/soc/codecs/wm8900.c +++ b/sound/soc/codecs/wm8900.c | |||
@@ -304,53 +304,53 @@ static const DECLARE_TLV_DB_SCALE(adc_tlv, -7200, 75, 1); | |||
304 | 304 | ||
305 | static const char *mic_bias_level_txt[] = { "0.9*AVDD", "0.65*AVDD" }; | 305 | static const char *mic_bias_level_txt[] = { "0.9*AVDD", "0.65*AVDD" }; |
306 | 306 | ||
307 | static const struct soc_enum mic_bias_level = | 307 | static SOC_ENUM_SINGLE_DECL(mic_bias_level, |
308 | SOC_ENUM_SINGLE(WM8900_REG_INCTL, 8, 2, mic_bias_level_txt); | 308 | WM8900_REG_INCTL, 8, mic_bias_level_txt); |
309 | 309 | ||
310 | static const char *dac_mute_rate_txt[] = { "Fast", "Slow" }; | 310 | static const char *dac_mute_rate_txt[] = { "Fast", "Slow" }; |
311 | 311 | ||
312 | static const struct soc_enum dac_mute_rate = | 312 | static SOC_ENUM_SINGLE_DECL(dac_mute_rate, |
313 | SOC_ENUM_SINGLE(WM8900_REG_DACCTRL, 7, 2, dac_mute_rate_txt); | 313 | WM8900_REG_DACCTRL, 7, dac_mute_rate_txt); |
314 | 314 | ||
315 | static const char *dac_deemphasis_txt[] = { | 315 | static const char *dac_deemphasis_txt[] = { |
316 | "Disabled", "32kHz", "44.1kHz", "48kHz" | 316 | "Disabled", "32kHz", "44.1kHz", "48kHz" |
317 | }; | 317 | }; |
318 | 318 | ||
319 | static const struct soc_enum dac_deemphasis = | 319 | static SOC_ENUM_SINGLE_DECL(dac_deemphasis, |
320 | SOC_ENUM_SINGLE(WM8900_REG_DACCTRL, 4, 4, dac_deemphasis_txt); | 320 | WM8900_REG_DACCTRL, 4, dac_deemphasis_txt); |
321 | 321 | ||
322 | static const char *adc_hpf_cut_txt[] = { | 322 | static const char *adc_hpf_cut_txt[] = { |
323 | "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3" | 323 | "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3" |
324 | }; | 324 | }; |
325 | 325 | ||
326 | static const struct soc_enum adc_hpf_cut = | 326 | static SOC_ENUM_SINGLE_DECL(adc_hpf_cut, |
327 | SOC_ENUM_SINGLE(WM8900_REG_ADCCTRL, 5, 4, adc_hpf_cut_txt); | 327 | WM8900_REG_ADCCTRL, 5, adc_hpf_cut_txt); |
328 | 328 | ||
329 | static const char *lr_txt[] = { | 329 | static const char *lr_txt[] = { |
330 | "Left", "Right" | 330 | "Left", "Right" |
331 | }; | 331 | }; |
332 | 332 | ||
333 | static const struct soc_enum aifl_src = | 333 | static SOC_ENUM_SINGLE_DECL(aifl_src, |
334 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO1, 15, 2, lr_txt); | 334 | WM8900_REG_AUDIO1, 15, lr_txt); |
335 | 335 | ||
336 | static const struct soc_enum aifr_src = | 336 | static SOC_ENUM_SINGLE_DECL(aifr_src, |
337 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO1, 14, 2, lr_txt); | 337 | WM8900_REG_AUDIO1, 14, lr_txt); |
338 | 338 | ||
339 | static const struct soc_enum dacl_src = | 339 | static SOC_ENUM_SINGLE_DECL(dacl_src, |
340 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO2, 15, 2, lr_txt); | 340 | WM8900_REG_AUDIO2, 15, lr_txt); |
341 | 341 | ||
342 | static const struct soc_enum dacr_src = | 342 | static SOC_ENUM_SINGLE_DECL(dacr_src, |
343 | SOC_ENUM_SINGLE(WM8900_REG_AUDIO2, 14, 2, lr_txt); | 343 | WM8900_REG_AUDIO2, 14, lr_txt); |
344 | 344 | ||
345 | static const char *sidetone_txt[] = { | 345 | static const char *sidetone_txt[] = { |
346 | "Disabled", "Left ADC", "Right ADC" | 346 | "Disabled", "Left ADC", "Right ADC" |
347 | }; | 347 | }; |
348 | 348 | ||
349 | static const struct soc_enum dacl_sidetone = | 349 | static SOC_ENUM_SINGLE_DECL(dacl_sidetone, |
350 | SOC_ENUM_SINGLE(WM8900_REG_SIDETONE, 2, 3, sidetone_txt); | 350 | WM8900_REG_SIDETONE, 2, sidetone_txt); |
351 | 351 | ||
352 | static const struct soc_enum dacr_sidetone = | 352 | static SOC_ENUM_SINGLE_DECL(dacr_sidetone, |
353 | SOC_ENUM_SINGLE(WM8900_REG_SIDETONE, 0, 3, sidetone_txt); | 353 | WM8900_REG_SIDETONE, 0, sidetone_txt); |
354 | 354 | ||
355 | static const struct snd_kcontrol_new wm8900_snd_controls[] = { | 355 | static const struct snd_kcontrol_new wm8900_snd_controls[] = { |
356 | SOC_ENUM("Mic Bias Level", mic_bias_level), | 356 | SOC_ENUM("Mic Bias Level", mic_bias_level), |
@@ -496,8 +496,8 @@ SOC_DAPM_SINGLE("RINPUT3 Switch", WM8900_REG_INCTL, 0, 1, 0), | |||
496 | 496 | ||
497 | static const char *wm8900_lp_mux[] = { "Disabled", "Enabled" }; | 497 | static const char *wm8900_lp_mux[] = { "Disabled", "Enabled" }; |
498 | 498 | ||
499 | static const struct soc_enum wm8900_lineout2_lp_mux = | 499 | static SOC_ENUM_SINGLE_DECL(wm8900_lineout2_lp_mux, |
500 | SOC_ENUM_SINGLE(WM8900_REG_LOUTMIXCTL1, 1, 2, wm8900_lp_mux); | 500 | WM8900_REG_LOUTMIXCTL1, 1, wm8900_lp_mux); |
501 | 501 | ||
502 | static const struct snd_kcontrol_new wm8900_lineout2_lp = | 502 | static const struct snd_kcontrol_new wm8900_lineout2_lp = |
503 | SOC_DAPM_ENUM("Route", wm8900_lineout2_lp_mux); | 503 | SOC_DAPM_ENUM("Route", wm8900_lineout2_lp_mux); |
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index b7488f190d2b..d4248e00160e 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -153,7 +153,7 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name, | |||
153 | 153 | ||
154 | data32 &= 0xffffff; | 154 | data32 &= 0xffffff; |
155 | 155 | ||
156 | wm8994_bulk_write(codec->control_data, | 156 | wm8994_bulk_write(wm8994->wm8994, |
157 | data32 & 0xffffff, | 157 | data32 & 0xffffff, |
158 | block_len / 2, | 158 | block_len / 2, |
159 | (void *)(data + 8)); | 159 | (void *)(data + 8)); |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index b9be9cbc4603..adb72063d44e 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -265,21 +265,21 @@ static const char *sidetone_hpf_text[] = { | |||
265 | "2.7kHz", "1.35kHz", "675Hz", "370Hz", "180Hz", "90Hz", "45Hz" | 265 | "2.7kHz", "1.35kHz", "675Hz", "370Hz", "180Hz", "90Hz", "45Hz" |
266 | }; | 266 | }; |
267 | 267 | ||
268 | static const struct soc_enum sidetone_hpf = | 268 | static SOC_ENUM_SINGLE_DECL(sidetone_hpf, |
269 | SOC_ENUM_SINGLE(WM8994_SIDETONE, 7, 7, sidetone_hpf_text); | 269 | WM8994_SIDETONE, 7, sidetone_hpf_text); |
270 | 270 | ||
271 | static const char *adc_hpf_text[] = { | 271 | static const char *adc_hpf_text[] = { |
272 | "HiFi", "Voice 1", "Voice 2", "Voice 3" | 272 | "HiFi", "Voice 1", "Voice 2", "Voice 3" |
273 | }; | 273 | }; |
274 | 274 | ||
275 | static const struct soc_enum aif1adc1_hpf = | 275 | static SOC_ENUM_SINGLE_DECL(aif1adc1_hpf, |
276 | SOC_ENUM_SINGLE(WM8994_AIF1_ADC1_FILTERS, 13, 4, adc_hpf_text); | 276 | WM8994_AIF1_ADC1_FILTERS, 13, adc_hpf_text); |
277 | 277 | ||
278 | static const struct soc_enum aif1adc2_hpf = | 278 | static SOC_ENUM_SINGLE_DECL(aif1adc2_hpf, |
279 | SOC_ENUM_SINGLE(WM8994_AIF1_ADC2_FILTERS, 13, 4, adc_hpf_text); | 279 | WM8994_AIF1_ADC2_FILTERS, 13, adc_hpf_text); |
280 | 280 | ||
281 | static const struct soc_enum aif2adc_hpf = | 281 | static SOC_ENUM_SINGLE_DECL(aif2adc_hpf, |
282 | SOC_ENUM_SINGLE(WM8994_AIF2_ADC_FILTERS, 13, 4, adc_hpf_text); | 282 | WM8994_AIF2_ADC_FILTERS, 13, adc_hpf_text); |
283 | 283 | ||
284 | static const DECLARE_TLV_DB_SCALE(aif_tlv, 0, 600, 0); | 284 | static const DECLARE_TLV_DB_SCALE(aif_tlv, 0, 600, 0); |
285 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); | 285 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); |
@@ -501,39 +501,39 @@ static const char *aif_chan_src_text[] = { | |||
501 | "Left", "Right" | 501 | "Left", "Right" |
502 | }; | 502 | }; |
503 | 503 | ||
504 | static const struct soc_enum aif1adcl_src = | 504 | static SOC_ENUM_SINGLE_DECL(aif1adcl_src, |
505 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_1, 15, 2, aif_chan_src_text); | 505 | WM8994_AIF1_CONTROL_1, 15, aif_chan_src_text); |
506 | 506 | ||
507 | static const struct soc_enum aif1adcr_src = | 507 | static SOC_ENUM_SINGLE_DECL(aif1adcr_src, |
508 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_1, 14, 2, aif_chan_src_text); | 508 | WM8994_AIF1_CONTROL_1, 14, aif_chan_src_text); |
509 | 509 | ||
510 | static const struct soc_enum aif2adcl_src = | 510 | static SOC_ENUM_SINGLE_DECL(aif2adcl_src, |
511 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_1, 15, 2, aif_chan_src_text); | 511 | WM8994_AIF2_CONTROL_1, 15, aif_chan_src_text); |
512 | 512 | ||
513 | static const struct soc_enum aif2adcr_src = | 513 | static SOC_ENUM_SINGLE_DECL(aif2adcr_src, |
514 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_1, 14, 2, aif_chan_src_text); | 514 | WM8994_AIF2_CONTROL_1, 14, aif_chan_src_text); |
515 | 515 | ||
516 | static const struct soc_enum aif1dacl_src = | 516 | static SOC_ENUM_SINGLE_DECL(aif1dacl_src, |
517 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, 15, 2, aif_chan_src_text); | 517 | WM8994_AIF1_CONTROL_2, 15, aif_chan_src_text); |
518 | 518 | ||
519 | static const struct soc_enum aif1dacr_src = | 519 | static SOC_ENUM_SINGLE_DECL(aif1dacr_src, |
520 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, 14, 2, aif_chan_src_text); | 520 | WM8994_AIF1_CONTROL_2, 14, aif_chan_src_text); |
521 | 521 | ||
522 | static const struct soc_enum aif2dacl_src = | 522 | static SOC_ENUM_SINGLE_DECL(aif2dacl_src, |
523 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, 15, 2, aif_chan_src_text); | 523 | WM8994_AIF2_CONTROL_2, 15, aif_chan_src_text); |
524 | 524 | ||
525 | static const struct soc_enum aif2dacr_src = | 525 | static SOC_ENUM_SINGLE_DECL(aif2dacr_src, |
526 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, 14, 2, aif_chan_src_text); | 526 | WM8994_AIF2_CONTROL_2, 14, aif_chan_src_text); |
527 | 527 | ||
528 | static const char *osr_text[] = { | 528 | static const char *osr_text[] = { |
529 | "Low Power", "High Performance", | 529 | "Low Power", "High Performance", |
530 | }; | 530 | }; |
531 | 531 | ||
532 | static const struct soc_enum dac_osr = | 532 | static SOC_ENUM_SINGLE_DECL(dac_osr, |
533 | SOC_ENUM_SINGLE(WM8994_OVERSAMPLING, 0, 2, osr_text); | 533 | WM8994_OVERSAMPLING, 0, osr_text); |
534 | 534 | ||
535 | static const struct soc_enum adc_osr = | 535 | static SOC_ENUM_SINGLE_DECL(adc_osr, |
536 | SOC_ENUM_SINGLE(WM8994_OVERSAMPLING, 1, 2, osr_text); | 536 | WM8994_OVERSAMPLING, 1, osr_text); |
537 | 537 | ||
538 | static const struct snd_kcontrol_new wm8994_snd_controls[] = { | 538 | static const struct snd_kcontrol_new wm8994_snd_controls[] = { |
539 | SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, | 539 | SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME, |
@@ -690,17 +690,20 @@ static const char *wm8958_ng_text[] = { | |||
690 | "30ms", "125ms", "250ms", "500ms", | 690 | "30ms", "125ms", "250ms", "500ms", |
691 | }; | 691 | }; |
692 | 692 | ||
693 | static const struct soc_enum wm8958_aif1dac1_ng_hold = | 693 | static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac1_ng_hold, |
694 | SOC_ENUM_SINGLE(WM8958_AIF1_DAC1_NOISE_GATE, | 694 | WM8958_AIF1_DAC1_NOISE_GATE, |
695 | WM8958_AIF1DAC1_NG_THR_SHIFT, 4, wm8958_ng_text); | 695 | WM8958_AIF1DAC1_NG_THR_SHIFT, |
696 | wm8958_ng_text); | ||
696 | 697 | ||
697 | static const struct soc_enum wm8958_aif1dac2_ng_hold = | 698 | static SOC_ENUM_SINGLE_DECL(wm8958_aif1dac2_ng_hold, |
698 | SOC_ENUM_SINGLE(WM8958_AIF1_DAC2_NOISE_GATE, | 699 | WM8958_AIF1_DAC2_NOISE_GATE, |
699 | WM8958_AIF1DAC2_NG_THR_SHIFT, 4, wm8958_ng_text); | 700 | WM8958_AIF1DAC2_NG_THR_SHIFT, |
701 | wm8958_ng_text); | ||
700 | 702 | ||
701 | static const struct soc_enum wm8958_aif2dac_ng_hold = | 703 | static SOC_ENUM_SINGLE_DECL(wm8958_aif2dac_ng_hold, |
702 | SOC_ENUM_SINGLE(WM8958_AIF2_DAC_NOISE_GATE, | 704 | WM8958_AIF2_DAC_NOISE_GATE, |
703 | WM8958_AIF2DAC_NG_THR_SHIFT, 4, wm8958_ng_text); | 705 | WM8958_AIF2DAC_NG_THR_SHIFT, |
706 | wm8958_ng_text); | ||
704 | 707 | ||
705 | static const struct snd_kcontrol_new wm8958_snd_controls[] = { | 708 | static const struct snd_kcontrol_new wm8958_snd_controls[] = { |
706 | SOC_SINGLE_TLV("AIF3 Boost Volume", WM8958_AIF3_CONTROL_2, 10, 3, 0, aif_tlv), | 709 | SOC_SINGLE_TLV("AIF3 Boost Volume", WM8958_AIF3_CONTROL_2, 10, 3, 0, aif_tlv), |
@@ -1341,8 +1344,8 @@ static const char *adc_mux_text[] = { | |||
1341 | "DMIC", | 1344 | "DMIC", |
1342 | }; | 1345 | }; |
1343 | 1346 | ||
1344 | static const struct soc_enum adc_enum = | 1347 | static SOC_ENUM_SINGLE_DECL(adc_enum, |
1345 | SOC_ENUM_SINGLE(0, 0, 2, adc_mux_text); | 1348 | 0, 0, adc_mux_text); |
1346 | 1349 | ||
1347 | static const struct snd_kcontrol_new adcl_mux = | 1350 | static const struct snd_kcontrol_new adcl_mux = |
1348 | SOC_DAPM_ENUM_VIRT("ADCL Mux", adc_enum); | 1351 | SOC_DAPM_ENUM_VIRT("ADCL Mux", adc_enum); |
@@ -1478,14 +1481,14 @@ static const char *sidetone_text[] = { | |||
1478 | "ADC/DMIC1", "DMIC2", | 1481 | "ADC/DMIC1", "DMIC2", |
1479 | }; | 1482 | }; |
1480 | 1483 | ||
1481 | static const struct soc_enum sidetone1_enum = | 1484 | static SOC_ENUM_SINGLE_DECL(sidetone1_enum, |
1482 | SOC_ENUM_SINGLE(WM8994_SIDETONE, 0, 2, sidetone_text); | 1485 | WM8994_SIDETONE, 0, sidetone_text); |
1483 | 1486 | ||
1484 | static const struct snd_kcontrol_new sidetone1_mux = | 1487 | static const struct snd_kcontrol_new sidetone1_mux = |
1485 | SOC_DAPM_ENUM("Left Sidetone Mux", sidetone1_enum); | 1488 | SOC_DAPM_ENUM("Left Sidetone Mux", sidetone1_enum); |
1486 | 1489 | ||
1487 | static const struct soc_enum sidetone2_enum = | 1490 | static SOC_ENUM_SINGLE_DECL(sidetone2_enum, |
1488 | SOC_ENUM_SINGLE(WM8994_SIDETONE, 1, 2, sidetone_text); | 1491 | WM8994_SIDETONE, 1, sidetone_text); |
1489 | 1492 | ||
1490 | static const struct snd_kcontrol_new sidetone2_mux = | 1493 | static const struct snd_kcontrol_new sidetone2_mux = |
1491 | SOC_DAPM_ENUM("Right Sidetone Mux", sidetone2_enum); | 1494 | SOC_DAPM_ENUM("Right Sidetone Mux", sidetone2_enum); |
@@ -1498,22 +1501,24 @@ static const char *loopback_text[] = { | |||
1498 | "None", "ADCDAT", | 1501 | "None", "ADCDAT", |
1499 | }; | 1502 | }; |
1500 | 1503 | ||
1501 | static const struct soc_enum aif1_loopback_enum = | 1504 | static SOC_ENUM_SINGLE_DECL(aif1_loopback_enum, |
1502 | SOC_ENUM_SINGLE(WM8994_AIF1_CONTROL_2, WM8994_AIF1_LOOPBACK_SHIFT, 2, | 1505 | WM8994_AIF1_CONTROL_2, |
1503 | loopback_text); | 1506 | WM8994_AIF1_LOOPBACK_SHIFT, |
1507 | loopback_text); | ||
1504 | 1508 | ||
1505 | static const struct snd_kcontrol_new aif1_loopback = | 1509 | static const struct snd_kcontrol_new aif1_loopback = |
1506 | SOC_DAPM_ENUM("AIF1 Loopback", aif1_loopback_enum); | 1510 | SOC_DAPM_ENUM("AIF1 Loopback", aif1_loopback_enum); |
1507 | 1511 | ||
1508 | static const struct soc_enum aif2_loopback_enum = | 1512 | static SOC_ENUM_SINGLE_DECL(aif2_loopback_enum, |
1509 | SOC_ENUM_SINGLE(WM8994_AIF2_CONTROL_2, WM8994_AIF2_LOOPBACK_SHIFT, 2, | 1513 | WM8994_AIF2_CONTROL_2, |
1510 | loopback_text); | 1514 | WM8994_AIF2_LOOPBACK_SHIFT, |
1515 | loopback_text); | ||
1511 | 1516 | ||
1512 | static const struct snd_kcontrol_new aif2_loopback = | 1517 | static const struct snd_kcontrol_new aif2_loopback = |
1513 | SOC_DAPM_ENUM("AIF2 Loopback", aif2_loopback_enum); | 1518 | SOC_DAPM_ENUM("AIF2 Loopback", aif2_loopback_enum); |
1514 | 1519 | ||
1515 | static const struct soc_enum aif1dac_enum = | 1520 | static SOC_ENUM_SINGLE_DECL(aif1dac_enum, |
1516 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 0, 2, aif1dac_text); | 1521 | WM8994_POWER_MANAGEMENT_6, 0, aif1dac_text); |
1517 | 1522 | ||
1518 | static const struct snd_kcontrol_new aif1dac_mux = | 1523 | static const struct snd_kcontrol_new aif1dac_mux = |
1519 | SOC_DAPM_ENUM("AIF1DAC Mux", aif1dac_enum); | 1524 | SOC_DAPM_ENUM("AIF1DAC Mux", aif1dac_enum); |
@@ -1522,8 +1527,8 @@ static const char *aif2dac_text[] = { | |||
1522 | "AIF2DACDAT", "AIF3DACDAT", | 1527 | "AIF2DACDAT", "AIF3DACDAT", |
1523 | }; | 1528 | }; |
1524 | 1529 | ||
1525 | static const struct soc_enum aif2dac_enum = | 1530 | static SOC_ENUM_SINGLE_DECL(aif2dac_enum, |
1526 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 1, 2, aif2dac_text); | 1531 | WM8994_POWER_MANAGEMENT_6, 1, aif2dac_text); |
1527 | 1532 | ||
1528 | static const struct snd_kcontrol_new aif2dac_mux = | 1533 | static const struct snd_kcontrol_new aif2dac_mux = |
1529 | SOC_DAPM_ENUM("AIF2DAC Mux", aif2dac_enum); | 1534 | SOC_DAPM_ENUM("AIF2DAC Mux", aif2dac_enum); |
@@ -1532,8 +1537,8 @@ static const char *aif2adc_text[] = { | |||
1532 | "AIF2ADCDAT", "AIF3DACDAT", | 1537 | "AIF2ADCDAT", "AIF3DACDAT", |
1533 | }; | 1538 | }; |
1534 | 1539 | ||
1535 | static const struct soc_enum aif2adc_enum = | 1540 | static SOC_ENUM_SINGLE_DECL(aif2adc_enum, |
1536 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 2, 2, aif2adc_text); | 1541 | WM8994_POWER_MANAGEMENT_6, 2, aif2adc_text); |
1537 | 1542 | ||
1538 | static const struct snd_kcontrol_new aif2adc_mux = | 1543 | static const struct snd_kcontrol_new aif2adc_mux = |
1539 | SOC_DAPM_ENUM("AIF2ADC Mux", aif2adc_enum); | 1544 | SOC_DAPM_ENUM("AIF2ADC Mux", aif2adc_enum); |
@@ -1542,14 +1547,14 @@ static const char *aif3adc_text[] = { | |||
1542 | "AIF1ADCDAT", "AIF2ADCDAT", "AIF2DACDAT", "Mono PCM", | 1547 | "AIF1ADCDAT", "AIF2ADCDAT", "AIF2DACDAT", "Mono PCM", |
1543 | }; | 1548 | }; |
1544 | 1549 | ||
1545 | static const struct soc_enum wm8994_aif3adc_enum = | 1550 | static SOC_ENUM_SINGLE_DECL(wm8994_aif3adc_enum, |
1546 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 3, 3, aif3adc_text); | 1551 | WM8994_POWER_MANAGEMENT_6, 3, aif3adc_text); |
1547 | 1552 | ||
1548 | static const struct snd_kcontrol_new wm8994_aif3adc_mux = | 1553 | static const struct snd_kcontrol_new wm8994_aif3adc_mux = |
1549 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8994_aif3adc_enum); | 1554 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8994_aif3adc_enum); |
1550 | 1555 | ||
1551 | static const struct soc_enum wm8958_aif3adc_enum = | 1556 | static SOC_ENUM_SINGLE_DECL(wm8958_aif3adc_enum, |
1552 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 3, 4, aif3adc_text); | 1557 | WM8994_POWER_MANAGEMENT_6, 3, aif3adc_text); |
1553 | 1558 | ||
1554 | static const struct snd_kcontrol_new wm8958_aif3adc_mux = | 1559 | static const struct snd_kcontrol_new wm8958_aif3adc_mux = |
1555 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8958_aif3adc_enum); | 1560 | SOC_DAPM_ENUM("AIF3ADC Mux", wm8958_aif3adc_enum); |
@@ -1558,8 +1563,8 @@ static const char *mono_pcm_out_text[] = { | |||
1558 | "None", "AIF2ADCL", "AIF2ADCR", | 1563 | "None", "AIF2ADCL", "AIF2ADCR", |
1559 | }; | 1564 | }; |
1560 | 1565 | ||
1561 | static const struct soc_enum mono_pcm_out_enum = | 1566 | static SOC_ENUM_SINGLE_DECL(mono_pcm_out_enum, |
1562 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 9, 3, mono_pcm_out_text); | 1567 | WM8994_POWER_MANAGEMENT_6, 9, mono_pcm_out_text); |
1563 | 1568 | ||
1564 | static const struct snd_kcontrol_new mono_pcm_out_mux = | 1569 | static const struct snd_kcontrol_new mono_pcm_out_mux = |
1565 | SOC_DAPM_ENUM("Mono PCM Out Mux", mono_pcm_out_enum); | 1570 | SOC_DAPM_ENUM("Mono PCM Out Mux", mono_pcm_out_enum); |
@@ -1569,14 +1574,14 @@ static const char *aif2dac_src_text[] = { | |||
1569 | }; | 1574 | }; |
1570 | 1575 | ||
1571 | /* Note that these two control shouldn't be simultaneously switched to AIF3 */ | 1576 | /* Note that these two control shouldn't be simultaneously switched to AIF3 */ |
1572 | static const struct soc_enum aif2dacl_src_enum = | 1577 | static SOC_ENUM_SINGLE_DECL(aif2dacl_src_enum, |
1573 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 7, 2, aif2dac_src_text); | 1578 | WM8994_POWER_MANAGEMENT_6, 7, aif2dac_src_text); |
1574 | 1579 | ||
1575 | static const struct snd_kcontrol_new aif2dacl_src_mux = | 1580 | static const struct snd_kcontrol_new aif2dacl_src_mux = |
1576 | SOC_DAPM_ENUM("AIF2DACL Mux", aif2dacl_src_enum); | 1581 | SOC_DAPM_ENUM("AIF2DACL Mux", aif2dacl_src_enum); |
1577 | 1582 | ||
1578 | static const struct soc_enum aif2dacr_src_enum = | 1583 | static SOC_ENUM_SINGLE_DECL(aif2dacr_src_enum, |
1579 | SOC_ENUM_SINGLE(WM8994_POWER_MANAGEMENT_6, 8, 2, aif2dac_src_text); | 1584 | WM8994_POWER_MANAGEMENT_6, 8, aif2dac_src_text); |
1580 | 1585 | ||
1581 | static const struct snd_kcontrol_new aif2dacr_src_mux = | 1586 | static const struct snd_kcontrol_new aif2dacr_src_mux = |
1582 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); | 1587 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index dc8ff13187f7..b9dc6acbba8c 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1218,7 +1218,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, | |||
1218 | ret = regulator_allow_bypass(w->regulator, false); | 1218 | ret = regulator_allow_bypass(w->regulator, false); |
1219 | if (ret != 0) | 1219 | if (ret != 0) |
1220 | dev_warn(w->dapm->dev, | 1220 | dev_warn(w->dapm->dev, |
1221 | "ASoC: Failed to bypass %s: %d\n", | 1221 | "ASoC: Failed to unbypass %s: %d\n", |
1222 | w->name, ret); | 1222 | w->name, ret); |
1223 | } | 1223 | } |
1224 | 1224 | ||
@@ -1228,7 +1228,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w, | |||
1228 | ret = regulator_allow_bypass(w->regulator, true); | 1228 | ret = regulator_allow_bypass(w->regulator, true); |
1229 | if (ret != 0) | 1229 | if (ret != 0) |
1230 | dev_warn(w->dapm->dev, | 1230 | dev_warn(w->dapm->dev, |
1231 | "ASoC: Failed to unbypass %s: %d\n", | 1231 | "ASoC: Failed to bypass %s: %d\n", |
1232 | w->name, ret); | 1232 | w->name, ret); |
1233 | } | 1233 | } |
1234 | 1234 | ||
@@ -3210,15 +3210,11 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, | |||
3210 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); | 3210 | struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); |
3211 | const char *pin = (const char *)kcontrol->private_value; | 3211 | const char *pin = (const char *)kcontrol->private_value; |
3212 | 3212 | ||
3213 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3214 | |||
3215 | if (ucontrol->value.integer.value[0]) | 3213 | if (ucontrol->value.integer.value[0]) |
3216 | snd_soc_dapm_enable_pin(&card->dapm, pin); | 3214 | snd_soc_dapm_enable_pin(&card->dapm, pin); |
3217 | else | 3215 | else |
3218 | snd_soc_dapm_disable_pin(&card->dapm, pin); | 3216 | snd_soc_dapm_disable_pin(&card->dapm, pin); |
3219 | 3217 | ||
3220 | mutex_unlock(&card->dapm_mutex); | ||
3221 | |||
3222 | snd_soc_dapm_sync(&card->dapm); | 3218 | snd_soc_dapm_sync(&card->dapm); |
3223 | return 0; | 3219 | return 0; |
3224 | } | 3220 | } |
@@ -3248,7 +3244,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3248 | ret = regulator_allow_bypass(w->regulator, true); | 3244 | ret = regulator_allow_bypass(w->regulator, true); |
3249 | if (ret != 0) | 3245 | if (ret != 0) |
3250 | dev_warn(w->dapm->dev, | 3246 | dev_warn(w->dapm->dev, |
3251 | "ASoC: Failed to unbypass %s: %d\n", | 3247 | "ASoC: Failed to bypass %s: %d\n", |
3252 | w->name, ret); | 3248 | w->name, ret); |
3253 | } | 3249 | } |
3254 | break; | 3250 | break; |
@@ -3767,23 +3763,52 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | |||
3767 | } | 3763 | } |
3768 | 3764 | ||
3769 | /** | 3765 | /** |
3766 | * snd_soc_dapm_enable_pin_unlocked - enable pin. | ||
3767 | * @dapm: DAPM context | ||
3768 | * @pin: pin name | ||
3769 | * | ||
3770 | * Enables input/output pin and its parents or children widgets iff there is | ||
3771 | * a valid audio route and active audio stream. | ||
3772 | * | ||
3773 | * Requires external locking. | ||
3774 | * | ||
3775 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3776 | * do any widget power switching. | ||
3777 | */ | ||
3778 | int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3779 | const char *pin) | ||
3780 | { | ||
3781 | return snd_soc_dapm_set_pin(dapm, pin, 1); | ||
3782 | } | ||
3783 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_unlocked); | ||
3784 | |||
3785 | /** | ||
3770 | * snd_soc_dapm_enable_pin - enable pin. | 3786 | * snd_soc_dapm_enable_pin - enable pin. |
3771 | * @dapm: DAPM context | 3787 | * @dapm: DAPM context |
3772 | * @pin: pin name | 3788 | * @pin: pin name |
3773 | * | 3789 | * |
3774 | * Enables input/output pin and its parents or children widgets iff there is | 3790 | * Enables input/output pin and its parents or children widgets iff there is |
3775 | * a valid audio route and active audio stream. | 3791 | * a valid audio route and active audio stream. |
3792 | * | ||
3776 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3793 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3777 | * do any widget power switching. | 3794 | * do any widget power switching. |
3778 | */ | 3795 | */ |
3779 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) | 3796 | int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) |
3780 | { | 3797 | { |
3781 | return snd_soc_dapm_set_pin(dapm, pin, 1); | 3798 | int ret; |
3799 | |||
3800 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3801 | |||
3802 | ret = snd_soc_dapm_set_pin(dapm, pin, 1); | ||
3803 | |||
3804 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3805 | |||
3806 | return ret; | ||
3782 | } | 3807 | } |
3783 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | 3808 | EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); |
3784 | 3809 | ||
3785 | /** | 3810 | /** |
3786 | * snd_soc_dapm_force_enable_pin - force a pin to be enabled | 3811 | * snd_soc_dapm_force_enable_pin_unlocked - force a pin to be enabled |
3787 | * @dapm: DAPM context | 3812 | * @dapm: DAPM context |
3788 | * @pin: pin name | 3813 | * @pin: pin name |
3789 | * | 3814 | * |
@@ -3791,11 +3816,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | |||
3791 | * intended for use with microphone bias supplies used in microphone | 3816 | * intended for use with microphone bias supplies used in microphone |
3792 | * jack detection. | 3817 | * jack detection. |
3793 | * | 3818 | * |
3819 | * Requires external locking. | ||
3820 | * | ||
3794 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3821 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3795 | * do any widget power switching. | 3822 | * do any widget power switching. |
3796 | */ | 3823 | */ |
3797 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | 3824 | int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, |
3798 | const char *pin) | 3825 | const char *pin) |
3799 | { | 3826 | { |
3800 | struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); | 3827 | struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); |
3801 | 3828 | ||
@@ -3811,25 +3838,103 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | |||
3811 | 3838 | ||
3812 | return 0; | 3839 | return 0; |
3813 | } | 3840 | } |
3841 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin_unlocked); | ||
3842 | |||
3843 | /** | ||
3844 | * snd_soc_dapm_force_enable_pin - force a pin to be enabled | ||
3845 | * @dapm: DAPM context | ||
3846 | * @pin: pin name | ||
3847 | * | ||
3848 | * Enables input/output pin regardless of any other state. This is | ||
3849 | * intended for use with microphone bias supplies used in microphone | ||
3850 | * jack detection. | ||
3851 | * | ||
3852 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3853 | * do any widget power switching. | ||
3854 | */ | ||
3855 | int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, | ||
3856 | const char *pin) | ||
3857 | { | ||
3858 | int ret; | ||
3859 | |||
3860 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3861 | |||
3862 | ret = snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); | ||
3863 | |||
3864 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3865 | |||
3866 | return ret; | ||
3867 | } | ||
3814 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); | 3868 | EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); |
3815 | 3869 | ||
3816 | /** | 3870 | /** |
3871 | * snd_soc_dapm_disable_pin_unlocked - disable pin. | ||
3872 | * @dapm: DAPM context | ||
3873 | * @pin: pin name | ||
3874 | * | ||
3875 | * Disables input/output pin and its parents or children widgets. | ||
3876 | * | ||
3877 | * Requires external locking. | ||
3878 | * | ||
3879 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3880 | * do any widget power switching. | ||
3881 | */ | ||
3882 | int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3883 | const char *pin) | ||
3884 | { | ||
3885 | return snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3886 | } | ||
3887 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin_unlocked); | ||
3888 | |||
3889 | /** | ||
3817 | * snd_soc_dapm_disable_pin - disable pin. | 3890 | * snd_soc_dapm_disable_pin - disable pin. |
3818 | * @dapm: DAPM context | 3891 | * @dapm: DAPM context |
3819 | * @pin: pin name | 3892 | * @pin: pin name |
3820 | * | 3893 | * |
3821 | * Disables input/output pin and its parents or children widgets. | 3894 | * Disables input/output pin and its parents or children widgets. |
3895 | * | ||
3822 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 3896 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
3823 | * do any widget power switching. | 3897 | * do any widget power switching. |
3824 | */ | 3898 | */ |
3825 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, | 3899 | int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, |
3826 | const char *pin) | 3900 | const char *pin) |
3827 | { | 3901 | { |
3828 | return snd_soc_dapm_set_pin(dapm, pin, 0); | 3902 | int ret; |
3903 | |||
3904 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3905 | |||
3906 | ret = snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3907 | |||
3908 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3909 | |||
3910 | return ret; | ||
3829 | } | 3911 | } |
3830 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | 3912 | EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); |
3831 | 3913 | ||
3832 | /** | 3914 | /** |
3915 | * snd_soc_dapm_nc_pin_unlocked - permanently disable pin. | ||
3916 | * @dapm: DAPM context | ||
3917 | * @pin: pin name | ||
3918 | * | ||
3919 | * Marks the specified pin as being not connected, disabling it along | ||
3920 | * any parent or child widgets. At present this is identical to | ||
3921 | * snd_soc_dapm_disable_pin() but in future it will be extended to do | ||
3922 | * additional things such as disabling controls which only affect | ||
3923 | * paths through the pin. | ||
3924 | * | ||
3925 | * Requires external locking. | ||
3926 | * | ||
3927 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | ||
3928 | * do any widget power switching. | ||
3929 | */ | ||
3930 | int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, | ||
3931 | const char *pin) | ||
3932 | { | ||
3933 | return snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3934 | } | ||
3935 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin_unlocked); | ||
3936 | |||
3937 | /** | ||
3833 | * snd_soc_dapm_nc_pin - permanently disable pin. | 3938 | * snd_soc_dapm_nc_pin - permanently disable pin. |
3834 | * @dapm: DAPM context | 3939 | * @dapm: DAPM context |
3835 | * @pin: pin name | 3940 | * @pin: pin name |
@@ -3845,7 +3950,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | |||
3845 | */ | 3950 | */ |
3846 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) | 3951 | int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin) |
3847 | { | 3952 | { |
3848 | return snd_soc_dapm_set_pin(dapm, pin, 0); | 3953 | int ret; |
3954 | |||
3955 | mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); | ||
3956 | |||
3957 | ret = snd_soc_dapm_set_pin(dapm, pin, 0); | ||
3958 | |||
3959 | mutex_unlock(&dapm->card->dapm_mutex); | ||
3960 | |||
3961 | return ret; | ||
3849 | } | 3962 | } |
3850 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); | 3963 | EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); |
3851 | 3964 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 3c53ec268fbc..02f985f3a396 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -113,14 +113,16 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati | |||
113 | if (!he) | 113 | if (!he) |
114 | return -ENOMEM; | 114 | return -ENOMEM; |
115 | 115 | ||
116 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 116 | if (ui__has_annotation()) { |
117 | if (err) | 117 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); |
118 | goto out; | 118 | if (err) |
119 | goto out; | ||
119 | 120 | ||
120 | mx = he->mem_info; | 121 | mx = he->mem_info; |
121 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); | 122 | err = addr_map_symbol__inc_samples(&mx->daddr, evsel->idx); |
122 | if (err) | 123 | if (err) |
123 | goto out; | 124 | goto out; |
125 | } | ||
124 | 126 | ||
125 | evsel->hists.stats.total_period += cost; | 127 | evsel->hists.stats.total_period += cost; |
126 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 128 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -164,14 +166,18 @@ static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_loc | |||
164 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, | 166 | he = __hists__add_entry(&evsel->hists, al, parent, &bi[i], NULL, |
165 | 1, 1, 0); | 167 | 1, 1, 0); |
166 | if (he) { | 168 | if (he) { |
167 | bx = he->branch_info; | 169 | if (ui__has_annotation()) { |
168 | err = addr_map_symbol__inc_samples(&bx->from, evsel->idx); | 170 | bx = he->branch_info; |
169 | if (err) | 171 | err = addr_map_symbol__inc_samples(&bx->from, |
170 | goto out; | 172 | evsel->idx); |
171 | 173 | if (err) | |
172 | err = addr_map_symbol__inc_samples(&bx->to, evsel->idx); | 174 | goto out; |
173 | if (err) | 175 | |
174 | goto out; | 176 | err = addr_map_symbol__inc_samples(&bx->to, |
177 | evsel->idx); | ||
178 | if (err) | ||
179 | goto out; | ||
180 | } | ||
175 | 181 | ||
176 | evsel->hists.stats.total_period += 1; | 182 | evsel->hists.stats.total_period += 1; |
177 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 183 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
@@ -205,7 +211,9 @@ static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evs | |||
205 | if (err) | 211 | if (err) |
206 | goto out; | 212 | goto out; |
207 | 213 | ||
208 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 214 | if (ui__has_annotation()) |
215 | err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | ||
216 | |||
209 | evsel->hists.stats.total_period += sample->period; | 217 | evsel->hists.stats.total_period += sample->period; |
210 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); | 218 | hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); |
211 | out: | 219 | out: |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 76cd510d34d0..5f989a7d8bc2 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -176,7 +176,7 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
176 | { | 176 | { |
177 | struct annotation *notes; | 177 | struct annotation *notes; |
178 | struct symbol *sym; | 178 | struct symbol *sym; |
179 | int err; | 179 | int err = 0; |
180 | 180 | ||
181 | if (he == NULL || he->ms.sym == NULL || | 181 | if (he == NULL || he->ms.sym == NULL || |
182 | ((top->sym_filter_entry == NULL || | 182 | ((top->sym_filter_entry == NULL || |
@@ -190,7 +190,9 @@ static void perf_top__record_precise_ip(struct perf_top *top, | |||
190 | return; | 190 | return; |
191 | 191 | ||
192 | ip = he->ms.map->map_ip(he->ms.map, ip); | 192 | ip = he->ms.map->map_ip(he->ms.map, ip); |
193 | err = hist_entry__inc_addr_samples(he, counter, ip); | 193 | |
194 | if (ui__has_annotation()) | ||
195 | err = hist_entry__inc_addr_samples(he, counter, ip); | ||
194 | 196 | ||
195 | pthread_mutex_unlock(¬es->lock); | 197 | pthread_mutex_unlock(¬es->lock); |
196 | 198 | ||
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index c48d44958172..0331ea2701a3 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -478,7 +478,7 @@ else | |||
478 | endif | 478 | endif |
479 | 479 | ||
480 | ifeq ($(feature-libbfd), 1) | 480 | ifeq ($(feature-libbfd), 1) |
481 | EXTLIBS += -lbfd | 481 | EXTLIBS += -lbfd -lz -liberty |
482 | endif | 482 | endif |
483 | 483 | ||
484 | ifdef NO_DEMANGLE | 484 | ifdef NO_DEMANGLE |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 12e551346fa6..523b7bc10553 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -121,7 +121,7 @@ test-libpython-version.bin: | |||
121 | $(BUILD) $(FLAGS_PYTHON_EMBED) | 121 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
122 | 122 | ||
123 | test-libbfd.bin: | 123 | test-libbfd.bin: |
124 | $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl | 124 | $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl |
125 | 125 | ||
126 | test-liberty.bin: | 126 | test-liberty.bin: |
127 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty | 127 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 469eb679fb9d..3aa555ff9d89 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -8,6 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "util.h" | 10 | #include "util.h" |
11 | #include "ui/ui.h" | ||
12 | #include "sort.h" | ||
11 | #include "build-id.h" | 13 | #include "build-id.h" |
12 | #include "color.h" | 14 | #include "color.h" |
13 | #include "cache.h" | 15 | #include "cache.h" |
@@ -489,7 +491,7 @@ static int symbol__inc_addr_samples(struct symbol *sym, struct map *map, | |||
489 | { | 491 | { |
490 | struct annotation *notes; | 492 | struct annotation *notes; |
491 | 493 | ||
492 | if (sym == NULL || use_browser != 1 || !sort__has_sym) | 494 | if (sym == NULL) |
493 | return 0; | 495 | return 0; |
494 | 496 | ||
495 | notes = symbol__annotation(sym); | 497 | notes = symbol__annotation(sym); |
@@ -1399,3 +1401,8 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize) | |||
1399 | { | 1401 | { |
1400 | return symbol__annotate(he->ms.sym, he->ms.map, privsize); | 1402 | return symbol__annotate(he->ms.sym, he->ms.map, privsize); |
1401 | } | 1403 | } |
1404 | |||
1405 | bool ui__has_annotation(void) | ||
1406 | { | ||
1407 | return use_browser == 1 && sort__has_sym; | ||
1408 | } | ||
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index b2aef59d6bb2..56ad4f5287de 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h | |||
@@ -151,6 +151,8 @@ void symbol__annotate_zero_histogram(struct symbol *sym, int evidx); | |||
151 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); | 151 | void symbol__annotate_decay_histogram(struct symbol *sym, int evidx); |
152 | void disasm__purge(struct list_head *head); | 152 | void disasm__purge(struct list_head *head); |
153 | 153 | ||
154 | bool ui__has_annotation(void); | ||
155 | |||
154 | int symbol__tty_annotate(struct symbol *sym, struct map *map, | 156 | int symbol__tty_annotate(struct symbol *sym, struct map *map, |
155 | struct perf_evsel *evsel, bool print_lines, | 157 | struct perf_evsel *evsel, bool print_lines, |
156 | bool full_paths, int min_pcnt, int max_lines); | 158 | bool full_paths, int min_pcnt, int max_lines); |
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h index 45cf10a562bd..dadfa7e54287 100644 --- a/tools/perf/util/include/linux/bitops.h +++ b/tools/perf/util/include/linux/bitops.h | |||
@@ -87,13 +87,15 @@ static __always_inline unsigned long __ffs(unsigned long word) | |||
87 | return num; | 87 | return num; |
88 | } | 88 | } |
89 | 89 | ||
90 | typedef const unsigned long __attribute__((__may_alias__)) long_alias_t; | ||
91 | |||
90 | /* | 92 | /* |
91 | * Find the first set bit in a memory region. | 93 | * Find the first set bit in a memory region. |
92 | */ | 94 | */ |
93 | static inline unsigned long | 95 | static inline unsigned long |
94 | find_first_bit(const unsigned long *addr, unsigned long size) | 96 | find_first_bit(const unsigned long *addr, unsigned long size) |
95 | { | 97 | { |
96 | const unsigned long *p = addr; | 98 | long_alias_t *p = (long_alias_t *) addr; |
97 | unsigned long result = 0; | 99 | unsigned long result = 0; |
98 | unsigned long tmp; | 100 | unsigned long tmp; |
99 | 101 | ||
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index a9d758a3b371..e89afc097d8a 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1336,6 +1336,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1336 | 1336 | ||
1337 | if (syms_ss && runtime_ss) | 1337 | if (syms_ss && runtime_ss) |
1338 | break; | 1338 | break; |
1339 | } else { | ||
1340 | symsrc__destroy(ss); | ||
1339 | } | 1341 | } |
1340 | 1342 | ||
1341 | } | 1343 | } |