diff options
205 files changed, 2202 insertions, 960 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 0e1abe8cc684..9a76a404ea96 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1741,7 +1741,7 @@ S: Maintained | |||
| 1741 | F: drivers/net/ethernet/atheros/ | 1741 | F: drivers/net/ethernet/atheros/ |
| 1742 | 1742 | ||
| 1743 | ATM | 1743 | ATM |
| 1744 | M: Chas Williams <chas@cmf.nrl.navy.mil> | 1744 | M: Chas Williams <3chas3@gmail.com> |
| 1745 | L: linux-atm-general@lists.sourceforge.net (moderated for non-subscribers) | 1745 | L: linux-atm-general@lists.sourceforge.net (moderated for non-subscribers) |
| 1746 | L: netdev@vger.kernel.org | 1746 | L: netdev@vger.kernel.org |
| 1747 | W: http://linux-atm.sourceforge.net | 1747 | W: http://linux-atm.sourceforge.net |
diff --git a/arch/arm/crypto/aesbs-core.S_shipped b/arch/arm/crypto/aesbs-core.S_shipped index 71e5fc7cfb18..1d1800f71c5b 100644 --- a/arch/arm/crypto/aesbs-core.S_shipped +++ b/arch/arm/crypto/aesbs-core.S_shipped | |||
| @@ -58,14 +58,18 @@ | |||
| 58 | # define VFP_ABI_FRAME 0 | 58 | # define VFP_ABI_FRAME 0 |
| 59 | # define BSAES_ASM_EXTENDED_KEY | 59 | # define BSAES_ASM_EXTENDED_KEY |
| 60 | # define XTS_CHAIN_TWEAK | 60 | # define XTS_CHAIN_TWEAK |
| 61 | # define __ARM_ARCH__ 7 | 61 | # define __ARM_ARCH__ __LINUX_ARM_ARCH__ |
| 62 | # define __ARM_MAX_ARCH__ 7 | ||
| 62 | #endif | 63 | #endif |
| 63 | 64 | ||
| 64 | #ifdef __thumb__ | 65 | #ifdef __thumb__ |
| 65 | # define adrl adr | 66 | # define adrl adr |
| 66 | #endif | 67 | #endif |
| 67 | 68 | ||
| 68 | #if __ARM_ARCH__>=7 | 69 | #if __ARM_MAX_ARCH__>=7 |
| 70 | .arch armv7-a | ||
| 71 | .fpu neon | ||
| 72 | |||
| 69 | .text | 73 | .text |
| 70 | .syntax unified @ ARMv7-capable assembler is expected to handle this | 74 | .syntax unified @ ARMv7-capable assembler is expected to handle this |
| 71 | #ifdef __thumb2__ | 75 | #ifdef __thumb2__ |
| @@ -74,8 +78,6 @@ | |||
| 74 | .code 32 | 78 | .code 32 |
| 75 | #endif | 79 | #endif |
| 76 | 80 | ||
| 77 | .fpu neon | ||
| 78 | |||
| 79 | .type _bsaes_decrypt8,%function | 81 | .type _bsaes_decrypt8,%function |
| 80 | .align 4 | 82 | .align 4 |
| 81 | _bsaes_decrypt8: | 83 | _bsaes_decrypt8: |
| @@ -2095,9 +2097,11 @@ bsaes_xts_decrypt: | |||
| 2095 | vld1.8 {q8}, [r0] @ initial tweak | 2097 | vld1.8 {q8}, [r0] @ initial tweak |
| 2096 | adr r2, .Lxts_magic | 2098 | adr r2, .Lxts_magic |
| 2097 | 2099 | ||
| 2100 | #ifndef XTS_CHAIN_TWEAK | ||
| 2098 | tst r9, #0xf @ if not multiple of 16 | 2101 | tst r9, #0xf @ if not multiple of 16 |
| 2099 | it ne @ Thumb2 thing, sanity check in ARM | 2102 | it ne @ Thumb2 thing, sanity check in ARM |
| 2100 | subne r9, #0x10 @ subtract another 16 bytes | 2103 | subne r9, #0x10 @ subtract another 16 bytes |
| 2104 | #endif | ||
| 2101 | subs r9, #0x80 | 2105 | subs r9, #0x80 |
| 2102 | 2106 | ||
| 2103 | blo .Lxts_dec_short | 2107 | blo .Lxts_dec_short |
diff --git a/arch/arm/crypto/bsaes-armv7.pl b/arch/arm/crypto/bsaes-armv7.pl index be068db960ee..a4d3856e7d24 100644 --- a/arch/arm/crypto/bsaes-armv7.pl +++ b/arch/arm/crypto/bsaes-armv7.pl | |||
| @@ -701,14 +701,18 @@ $code.=<<___; | |||
| 701 | # define VFP_ABI_FRAME 0 | 701 | # define VFP_ABI_FRAME 0 |
| 702 | # define BSAES_ASM_EXTENDED_KEY | 702 | # define BSAES_ASM_EXTENDED_KEY |
| 703 | # define XTS_CHAIN_TWEAK | 703 | # define XTS_CHAIN_TWEAK |
| 704 | # define __ARM_ARCH__ 7 | 704 | # define __ARM_ARCH__ __LINUX_ARM_ARCH__ |
| 705 | # define __ARM_MAX_ARCH__ 7 | ||
| 705 | #endif | 706 | #endif |
| 706 | 707 | ||
| 707 | #ifdef __thumb__ | 708 | #ifdef __thumb__ |
| 708 | # define adrl adr | 709 | # define adrl adr |
| 709 | #endif | 710 | #endif |
| 710 | 711 | ||
| 711 | #if __ARM_ARCH__>=7 | 712 | #if __ARM_MAX_ARCH__>=7 |
| 713 | .arch armv7-a | ||
| 714 | .fpu neon | ||
| 715 | |||
| 712 | .text | 716 | .text |
| 713 | .syntax unified @ ARMv7-capable assembler is expected to handle this | 717 | .syntax unified @ ARMv7-capable assembler is expected to handle this |
| 714 | #ifdef __thumb2__ | 718 | #ifdef __thumb2__ |
| @@ -717,8 +721,6 @@ $code.=<<___; | |||
| 717 | .code 32 | 721 | .code 32 |
| 718 | #endif | 722 | #endif |
| 719 | 723 | ||
| 720 | .fpu neon | ||
| 721 | |||
| 722 | .type _bsaes_decrypt8,%function | 724 | .type _bsaes_decrypt8,%function |
| 723 | .align 4 | 725 | .align 4 |
| 724 | _bsaes_decrypt8: | 726 | _bsaes_decrypt8: |
| @@ -2076,9 +2078,11 @@ bsaes_xts_decrypt: | |||
| 2076 | vld1.8 {@XMM[8]}, [r0] @ initial tweak | 2078 | vld1.8 {@XMM[8]}, [r0] @ initial tweak |
| 2077 | adr $magic, .Lxts_magic | 2079 | adr $magic, .Lxts_magic |
| 2078 | 2080 | ||
| 2081 | #ifndef XTS_CHAIN_TWEAK | ||
| 2079 | tst $len, #0xf @ if not multiple of 16 | 2082 | tst $len, #0xf @ if not multiple of 16 |
| 2080 | it ne @ Thumb2 thing, sanity check in ARM | 2083 | it ne @ Thumb2 thing, sanity check in ARM |
| 2081 | subne $len, #0x10 @ subtract another 16 bytes | 2084 | subne $len, #0x10 @ subtract another 16 bytes |
| 2085 | #endif | ||
| 2082 | subs $len, #0x80 | 2086 | subs $len, #0x80 |
| 2083 | 2087 | ||
| 2084 | blo .Lxts_dec_short | 2088 | blo .Lxts_dec_short |
diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h index bf0fe99e8ca9..4cf48c3aca13 100644 --- a/arch/arm/include/asm/kvm_mmu.h +++ b/arch/arm/include/asm/kvm_mmu.h | |||
| @@ -149,29 +149,28 @@ static inline bool kvm_s2pmd_readonly(pmd_t *pmd) | |||
| 149 | (__boundary - 1 < (end) - 1)? __boundary: (end); \ | 149 | (__boundary - 1 < (end) - 1)? __boundary: (end); \ |
| 150 | }) | 150 | }) |
| 151 | 151 | ||
| 152 | #define kvm_pgd_index(addr) pgd_index(addr) | ||
| 153 | |||
| 152 | static inline bool kvm_page_empty(void *ptr) | 154 | static inline bool kvm_page_empty(void *ptr) |
| 153 | { | 155 | { |
| 154 | struct page *ptr_page = virt_to_page(ptr); | 156 | struct page *ptr_page = virt_to_page(ptr); |
| 155 | return page_count(ptr_page) == 1; | 157 | return page_count(ptr_page) == 1; |
| 156 | } | 158 | } |
| 157 | 159 | ||
| 158 | |||
| 159 | #define kvm_pte_table_empty(kvm, ptep) kvm_page_empty(ptep) | 160 | #define kvm_pte_table_empty(kvm, ptep) kvm_page_empty(ptep) |
| 160 | #define kvm_pmd_table_empty(kvm, pmdp) kvm_page_empty(pmdp) | 161 | #define kvm_pmd_table_empty(kvm, pmdp) kvm_page_empty(pmdp) |
| 161 | #define kvm_pud_table_empty(kvm, pudp) (0) | 162 | #define kvm_pud_table_empty(kvm, pudp) (0) |
| 162 | 163 | ||
| 163 | #define KVM_PREALLOC_LEVEL 0 | 164 | #define KVM_PREALLOC_LEVEL 0 |
| 164 | 165 | ||
| 165 | static inline int kvm_prealloc_hwpgd(struct kvm *kvm, pgd_t *pgd) | 166 | static inline void *kvm_get_hwpgd(struct kvm *kvm) |
| 166 | { | 167 | { |
| 167 | return 0; | 168 | return kvm->arch.pgd; |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | static inline void kvm_free_hwpgd(struct kvm *kvm) { } | 171 | static inline unsigned int kvm_get_hwpgd_size(void) |
| 171 | |||
| 172 | static inline void *kvm_get_hwpgd(struct kvm *kvm) | ||
| 173 | { | 172 | { |
| 174 | return kvm->arch.pgd; | 173 | return PTRS_PER_S2_PGD * sizeof(pgd_t); |
| 175 | } | 174 | } |
| 176 | 175 | ||
| 177 | struct kvm; | 176 | struct kvm; |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index e55408e96559..1d60bebea4b8 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
| @@ -246,12 +246,9 @@ static int __get_cpu_architecture(void) | |||
| 246 | if (cpu_arch) | 246 | if (cpu_arch) |
| 247 | cpu_arch += CPU_ARCH_ARMv3; | 247 | cpu_arch += CPU_ARCH_ARMv3; |
| 248 | } else if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) { | 248 | } else if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) { |
| 249 | unsigned int mmfr0; | ||
| 250 | |||
| 251 | /* Revised CPUID format. Read the Memory Model Feature | 249 | /* Revised CPUID format. Read the Memory Model Feature |
| 252 | * Register 0 and check for VMSAv7 or PMSAv7 */ | 250 | * Register 0 and check for VMSAv7 or PMSAv7 */ |
| 253 | asm("mrc p15, 0, %0, c0, c1, 4" | 251 | unsigned int mmfr0 = read_cpuid_ext(CPUID_EXT_MMFR0); |
| 254 | : "=r" (mmfr0)); | ||
| 255 | if ((mmfr0 & 0x0000000f) >= 0x00000003 || | 252 | if ((mmfr0 & 0x0000000f) >= 0x00000003 || |
| 256 | (mmfr0 & 0x000000f0) >= 0x00000030) | 253 | (mmfr0 & 0x000000f0) >= 0x00000030) |
| 257 | cpu_arch = CPU_ARCH_ARMv7; | 254 | cpu_arch = CPU_ARCH_ARMv7; |
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 3e6859bc3e11..5656d79c5a44 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c | |||
| @@ -290,7 +290,7 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, | |||
| 290 | phys_addr_t addr = start, end = start + size; | 290 | phys_addr_t addr = start, end = start + size; |
| 291 | phys_addr_t next; | 291 | phys_addr_t next; |
| 292 | 292 | ||
| 293 | pgd = pgdp + pgd_index(addr); | 293 | pgd = pgdp + kvm_pgd_index(addr); |
| 294 | do { | 294 | do { |
| 295 | next = kvm_pgd_addr_end(addr, end); | 295 | next = kvm_pgd_addr_end(addr, end); |
| 296 | if (!pgd_none(*pgd)) | 296 | if (!pgd_none(*pgd)) |
| @@ -355,7 +355,7 @@ static void stage2_flush_memslot(struct kvm *kvm, | |||
| 355 | phys_addr_t next; | 355 | phys_addr_t next; |
| 356 | pgd_t *pgd; | 356 | pgd_t *pgd; |
| 357 | 357 | ||
| 358 | pgd = kvm->arch.pgd + pgd_index(addr); | 358 | pgd = kvm->arch.pgd + kvm_pgd_index(addr); |
| 359 | do { | 359 | do { |
| 360 | next = kvm_pgd_addr_end(addr, end); | 360 | next = kvm_pgd_addr_end(addr, end); |
| 361 | stage2_flush_puds(kvm, pgd, addr, next); | 361 | stage2_flush_puds(kvm, pgd, addr, next); |
| @@ -632,6 +632,20 @@ int create_hyp_io_mappings(void *from, void *to, phys_addr_t phys_addr) | |||
| 632 | __phys_to_pfn(phys_addr), PAGE_HYP_DEVICE); | 632 | __phys_to_pfn(phys_addr), PAGE_HYP_DEVICE); |
| 633 | } | 633 | } |
| 634 | 634 | ||
| 635 | /* Free the HW pgd, one page at a time */ | ||
| 636 | static void kvm_free_hwpgd(void *hwpgd) | ||
| 637 | { | ||
| 638 | free_pages_exact(hwpgd, kvm_get_hwpgd_size()); | ||
| 639 | } | ||
| 640 | |||
| 641 | /* Allocate the HW PGD, making sure that each page gets its own refcount */ | ||
| 642 | static void *kvm_alloc_hwpgd(void) | ||
| 643 | { | ||
| 644 | unsigned int size = kvm_get_hwpgd_size(); | ||
| 645 | |||
| 646 | return alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); | ||
| 647 | } | ||
| 648 | |||
| 635 | /** | 649 | /** |
| 636 | * kvm_alloc_stage2_pgd - allocate level-1 table for stage-2 translation. | 650 | * kvm_alloc_stage2_pgd - allocate level-1 table for stage-2 translation. |
| 637 | * @kvm: The KVM struct pointer for the VM. | 651 | * @kvm: The KVM struct pointer for the VM. |
| @@ -645,15 +659,31 @@ int create_hyp_io_mappings(void *from, void *to, phys_addr_t phys_addr) | |||
| 645 | */ | 659 | */ |
| 646 | int kvm_alloc_stage2_pgd(struct kvm *kvm) | 660 | int kvm_alloc_stage2_pgd(struct kvm *kvm) |
| 647 | { | 661 | { |
| 648 | int ret; | ||
| 649 | pgd_t *pgd; | 662 | pgd_t *pgd; |
| 663 | void *hwpgd; | ||
| 650 | 664 | ||
| 651 | if (kvm->arch.pgd != NULL) { | 665 | if (kvm->arch.pgd != NULL) { |
| 652 | kvm_err("kvm_arch already initialized?\n"); | 666 | kvm_err("kvm_arch already initialized?\n"); |
| 653 | return -EINVAL; | 667 | return -EINVAL; |
| 654 | } | 668 | } |
| 655 | 669 | ||
| 670 | hwpgd = kvm_alloc_hwpgd(); | ||
| 671 | if (!hwpgd) | ||
| 672 | return -ENOMEM; | ||
| 673 | |||
| 674 | /* When the kernel uses more levels of page tables than the | ||
| 675 | * guest, we allocate a fake PGD and pre-populate it to point | ||
| 676 | * to the next-level page table, which will be the real | ||
| 677 | * initial page table pointed to by the VTTBR. | ||
| 678 | * | ||
| 679 | * When KVM_PREALLOC_LEVEL==2, we allocate a single page for | ||
| 680 | * the PMD and the kernel will use folded pud. | ||
| 681 | * When KVM_PREALLOC_LEVEL==1, we allocate 2 consecutive PUD | ||
| 682 | * pages. | ||
| 683 | */ | ||
| 656 | if (KVM_PREALLOC_LEVEL > 0) { | 684 | if (KVM_PREALLOC_LEVEL > 0) { |
| 685 | int i; | ||
| 686 | |||
| 657 | /* | 687 | /* |
| 658 | * Allocate fake pgd for the page table manipulation macros to | 688 | * Allocate fake pgd for the page table manipulation macros to |
| 659 | * work. This is not used by the hardware and we have no | 689 | * work. This is not used by the hardware and we have no |
| @@ -661,30 +691,32 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm) | |||
| 661 | */ | 691 | */ |
| 662 | pgd = (pgd_t *)kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t), | 692 | pgd = (pgd_t *)kmalloc(PTRS_PER_S2_PGD * sizeof(pgd_t), |
| 663 | GFP_KERNEL | __GFP_ZERO); | 693 | GFP_KERNEL | __GFP_ZERO); |
| 694 | |||
| 695 | if (!pgd) { | ||
| 696 | kvm_free_hwpgd(hwpgd); | ||
| 697 | return -ENOMEM; | ||
| 698 | } | ||
| 699 | |||
| 700 | /* Plug the HW PGD into the fake one. */ | ||
| 701 | for (i = 0; i < PTRS_PER_S2_PGD; i++) { | ||
| 702 | if (KVM_PREALLOC_LEVEL == 1) | ||
| 703 | pgd_populate(NULL, pgd + i, | ||
| 704 | (pud_t *)hwpgd + i * PTRS_PER_PUD); | ||
| 705 | else if (KVM_PREALLOC_LEVEL == 2) | ||
| 706 | pud_populate(NULL, pud_offset(pgd, 0) + i, | ||
| 707 | (pmd_t *)hwpgd + i * PTRS_PER_PMD); | ||
| 708 | } | ||
| 664 | } else { | 709 | } else { |
| 665 | /* | 710 | /* |
| 666 | * Allocate actual first-level Stage-2 page table used by the | 711 | * Allocate actual first-level Stage-2 page table used by the |
| 667 | * hardware for Stage-2 page table walks. | 712 | * hardware for Stage-2 page table walks. |
| 668 | */ | 713 | */ |
| 669 | pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, S2_PGD_ORDER); | 714 | pgd = (pgd_t *)hwpgd; |
| 670 | } | 715 | } |
| 671 | 716 | ||
| 672 | if (!pgd) | ||
| 673 | return -ENOMEM; | ||
| 674 | |||
| 675 | ret = kvm_prealloc_hwpgd(kvm, pgd); | ||
| 676 | if (ret) | ||
| 677 | goto out_err; | ||
| 678 | |||
| 679 | kvm_clean_pgd(pgd); | 717 | kvm_clean_pgd(pgd); |
| 680 | kvm->arch.pgd = pgd; | 718 | kvm->arch.pgd = pgd; |
| 681 | return 0; | 719 | return 0; |
| 682 | out_err: | ||
| 683 | if (KVM_PREALLOC_LEVEL > 0) | ||
| 684 | kfree(pgd); | ||
| 685 | else | ||
| 686 | free_pages((unsigned long)pgd, S2_PGD_ORDER); | ||
| 687 | return ret; | ||
| 688 | } | 720 | } |
| 689 | 721 | ||
| 690 | /** | 722 | /** |
| @@ -785,11 +817,10 @@ void kvm_free_stage2_pgd(struct kvm *kvm) | |||
| 785 | return; | 817 | return; |
| 786 | 818 | ||
| 787 | unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE); | 819 | unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE); |
| 788 | kvm_free_hwpgd(kvm); | 820 | kvm_free_hwpgd(kvm_get_hwpgd(kvm)); |
| 789 | if (KVM_PREALLOC_LEVEL > 0) | 821 | if (KVM_PREALLOC_LEVEL > 0) |
| 790 | kfree(kvm->arch.pgd); | 822 | kfree(kvm->arch.pgd); |
| 791 | else | 823 | |
| 792 | free_pages((unsigned long)kvm->arch.pgd, S2_PGD_ORDER); | ||
| 793 | kvm->arch.pgd = NULL; | 824 | kvm->arch.pgd = NULL; |
| 794 | } | 825 | } |
| 795 | 826 | ||
| @@ -799,7 +830,7 @@ static pud_t *stage2_get_pud(struct kvm *kvm, struct kvm_mmu_memory_cache *cache | |||
| 799 | pgd_t *pgd; | 830 | pgd_t *pgd; |
| 800 | pud_t *pud; | 831 | pud_t *pud; |
| 801 | 832 | ||
| 802 | pgd = kvm->arch.pgd + pgd_index(addr); | 833 | pgd = kvm->arch.pgd + kvm_pgd_index(addr); |
| 803 | if (WARN_ON(pgd_none(*pgd))) { | 834 | if (WARN_ON(pgd_none(*pgd))) { |
| 804 | if (!cache) | 835 | if (!cache) |
| 805 | return NULL; | 836 | return NULL; |
| @@ -1089,7 +1120,7 @@ static void stage2_wp_range(struct kvm *kvm, phys_addr_t addr, phys_addr_t end) | |||
| 1089 | pgd_t *pgd; | 1120 | pgd_t *pgd; |
| 1090 | phys_addr_t next; | 1121 | phys_addr_t next; |
| 1091 | 1122 | ||
| 1092 | pgd = kvm->arch.pgd + pgd_index(addr); | 1123 | pgd = kvm->arch.pgd + kvm_pgd_index(addr); |
| 1093 | do { | 1124 | do { |
| 1094 | /* | 1125 | /* |
| 1095 | * Release kvm_mmu_lock periodically if the memory region is | 1126 | * Release kvm_mmu_lock periodically if the memory region is |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index c6c7696b8db9..8f15f70622a6 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
| @@ -1131,23 +1131,22 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
| 1131 | } | 1131 | } |
| 1132 | 1132 | ||
| 1133 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); | 1133 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); |
| 1134 | if (ret) | 1134 | if (!ret) { |
| 1135 | return; | 1135 | switch (assoc) { |
| 1136 | 1136 | case 16: | |
| 1137 | switch (assoc) { | 1137 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
| 1138 | case 16: | 1138 | *aux_val |= L310_AUX_CTRL_ASSOCIATIVITY_16; |
| 1139 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1139 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
| 1140 | *aux_val |= L310_AUX_CTRL_ASSOCIATIVITY_16; | 1140 | break; |
| 1141 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1141 | case 8: |
| 1142 | break; | 1142 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
| 1143 | case 8: | 1143 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
| 1144 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1144 | break; |
| 1145 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1145 | default: |
| 1146 | break; | 1146 | pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n", |
| 1147 | default: | 1147 | assoc); |
| 1148 | pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n", | 1148 | break; |
| 1149 | assoc); | 1149 | } |
| 1150 | break; | ||
| 1151 | } | 1150 | } |
| 1152 | 1151 | ||
| 1153 | prefetch = l2x0_saved_regs.prefetch_ctrl; | 1152 | prefetch = l2x0_saved_regs.prefetch_ctrl; |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 170a116d1b29..c27447653903 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
| @@ -171,7 +171,7 @@ static int __dma_supported(struct device *dev, u64 mask, bool warn) | |||
| 171 | */ | 171 | */ |
| 172 | if (sizeof(mask) != sizeof(dma_addr_t) && | 172 | if (sizeof(mask) != sizeof(dma_addr_t) && |
| 173 | mask > (dma_addr_t)~0 && | 173 | mask > (dma_addr_t)~0 && |
| 174 | dma_to_pfn(dev, ~0) < max_pfn) { | 174 | dma_to_pfn(dev, ~0) < max_pfn - 1) { |
| 175 | if (warn) { | 175 | if (warn) { |
| 176 | dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n", | 176 | dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n", |
| 177 | mask); | 177 | mask); |
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index a982dc3190df..6333d9c17875 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c | |||
| @@ -552,6 +552,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs) | |||
| 552 | 552 | ||
| 553 | pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n", | 553 | pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n", |
| 554 | inf->name, fsr, addr); | 554 | inf->name, fsr, addr); |
| 555 | show_pte(current->mm, addr); | ||
| 555 | 556 | ||
| 556 | info.si_signo = inf->sig; | 557 | info.si_signo = inf->sig; |
| 557 | info.si_errno = 0; | 558 | info.si_errno = 0; |
diff --git a/arch/arm/mm/pageattr.c b/arch/arm/mm/pageattr.c index 004e35cdcfff..cf30daff8932 100644 --- a/arch/arm/mm/pageattr.c +++ b/arch/arm/mm/pageattr.c | |||
| @@ -49,7 +49,10 @@ static int change_memory_common(unsigned long addr, int numpages, | |||
| 49 | WARN_ON_ONCE(1); | 49 | WARN_ON_ONCE(1); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | if (!is_module_address(start) || !is_module_address(end - 1)) | 52 | if (start < MODULES_VADDR || start >= MODULES_END) |
| 53 | return -EINVAL; | ||
| 54 | |||
| 55 | if (end < MODULES_VADDR || start >= MODULES_END) | ||
| 53 | return -EINVAL; | 56 | return -EINVAL; |
| 54 | 57 | ||
| 55 | data.set_mask = set_mask; | 58 | data.set_mask = set_mask; |
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index 94674eb7e7bb..54bb4ba97441 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h | |||
| @@ -129,6 +129,9 @@ | |||
| 129 | * 40 bits wide (T0SZ = 24). Systems with a PARange smaller than 40 bits are | 129 | * 40 bits wide (T0SZ = 24). Systems with a PARange smaller than 40 bits are |
| 130 | * not known to exist and will break with this configuration. | 130 | * not known to exist and will break with this configuration. |
| 131 | * | 131 | * |
| 132 | * VTCR_EL2.PS is extracted from ID_AA64MMFR0_EL1.PARange at boot time | ||
| 133 | * (see hyp-init.S). | ||
| 134 | * | ||
| 132 | * Note that when using 4K pages, we concatenate two first level page tables | 135 | * Note that when using 4K pages, we concatenate two first level page tables |
| 133 | * together. | 136 | * together. |
| 134 | * | 137 | * |
| @@ -138,7 +141,6 @@ | |||
| 138 | #ifdef CONFIG_ARM64_64K_PAGES | 141 | #ifdef CONFIG_ARM64_64K_PAGES |
| 139 | /* | 142 | /* |
| 140 | * Stage2 translation configuration: | 143 | * Stage2 translation configuration: |
| 141 | * 40bits output (PS = 2) | ||
| 142 | * 40bits input (T0SZ = 24) | 144 | * 40bits input (T0SZ = 24) |
| 143 | * 64kB pages (TG0 = 1) | 145 | * 64kB pages (TG0 = 1) |
| 144 | * 2 level page tables (SL = 1) | 146 | * 2 level page tables (SL = 1) |
| @@ -150,7 +152,6 @@ | |||
| 150 | #else | 152 | #else |
| 151 | /* | 153 | /* |
| 152 | * Stage2 translation configuration: | 154 | * Stage2 translation configuration: |
| 153 | * 40bits output (PS = 2) | ||
| 154 | * 40bits input (T0SZ = 24) | 155 | * 40bits input (T0SZ = 24) |
| 155 | * 4kB pages (TG0 = 0) | 156 | * 4kB pages (TG0 = 0) |
| 156 | * 3 level page tables (SL = 1) | 157 | * 3 level page tables (SL = 1) |
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index 6458b5373142..bbfb600fa822 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h | |||
| @@ -158,6 +158,8 @@ static inline bool kvm_s2pmd_readonly(pmd_t *pmd) | |||
| 158 | #define PTRS_PER_S2_PGD (1 << PTRS_PER_S2_PGD_SHIFT) | 158 | #define PTRS_PER_S2_PGD (1 << PTRS_PER_S2_PGD_SHIFT) |
| 159 | #define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t)) | 159 | #define S2_PGD_ORDER get_order(PTRS_PER_S2_PGD * sizeof(pgd_t)) |
| 160 | 160 | ||
| 161 | #define kvm_pgd_index(addr) (((addr) >> PGDIR_SHIFT) & (PTRS_PER_S2_PGD - 1)) | ||
| 162 | |||
| 161 | /* | 163 | /* |
| 162 | * If we are concatenating first level stage-2 page tables, we would have less | 164 | * If we are concatenating first level stage-2 page tables, we would have less |
| 163 | * than or equal to 16 pointers in the fake PGD, because that's what the | 165 | * than or equal to 16 pointers in the fake PGD, because that's what the |
| @@ -171,43 +173,6 @@ static inline bool kvm_s2pmd_readonly(pmd_t *pmd) | |||
| 171 | #define KVM_PREALLOC_LEVEL (0) | 173 | #define KVM_PREALLOC_LEVEL (0) |
| 172 | #endif | 174 | #endif |
| 173 | 175 | ||
| 174 | /** | ||
| 175 | * kvm_prealloc_hwpgd - allocate inital table for VTTBR | ||
| 176 | * @kvm: The KVM struct pointer for the VM. | ||
| 177 | * @pgd: The kernel pseudo pgd | ||
| 178 | * | ||
| 179 | * When the kernel uses more levels of page tables than the guest, we allocate | ||
| 180 | * a fake PGD and pre-populate it to point to the next-level page table, which | ||
| 181 | * will be the real initial page table pointed to by the VTTBR. | ||
| 182 | * | ||
| 183 | * When KVM_PREALLOC_LEVEL==2, we allocate a single page for the PMD and | ||
| 184 | * the kernel will use folded pud. When KVM_PREALLOC_LEVEL==1, we | ||
| 185 | * allocate 2 consecutive PUD pages. | ||
| 186 | */ | ||
| 187 | static inline int kvm_prealloc_hwpgd(struct kvm *kvm, pgd_t *pgd) | ||
| 188 | { | ||
| 189 | unsigned int i; | ||
| 190 | unsigned long hwpgd; | ||
| 191 | |||
| 192 | if (KVM_PREALLOC_LEVEL == 0) | ||
| 193 | return 0; | ||
| 194 | |||
| 195 | hwpgd = __get_free_pages(GFP_KERNEL | __GFP_ZERO, PTRS_PER_S2_PGD_SHIFT); | ||
| 196 | if (!hwpgd) | ||
| 197 | return -ENOMEM; | ||
| 198 | |||
| 199 | for (i = 0; i < PTRS_PER_S2_PGD; i++) { | ||
| 200 | if (KVM_PREALLOC_LEVEL == 1) | ||
| 201 | pgd_populate(NULL, pgd + i, | ||
| 202 | (pud_t *)hwpgd + i * PTRS_PER_PUD); | ||
| 203 | else if (KVM_PREALLOC_LEVEL == 2) | ||
| 204 | pud_populate(NULL, pud_offset(pgd, 0) + i, | ||
| 205 | (pmd_t *)hwpgd + i * PTRS_PER_PMD); | ||
| 206 | } | ||
| 207 | |||
| 208 | return 0; | ||
| 209 | } | ||
| 210 | |||
| 211 | static inline void *kvm_get_hwpgd(struct kvm *kvm) | 176 | static inline void *kvm_get_hwpgd(struct kvm *kvm) |
| 212 | { | 177 | { |
| 213 | pgd_t *pgd = kvm->arch.pgd; | 178 | pgd_t *pgd = kvm->arch.pgd; |
| @@ -224,12 +189,11 @@ static inline void *kvm_get_hwpgd(struct kvm *kvm) | |||
| 224 | return pmd_offset(pud, 0); | 189 | return pmd_offset(pud, 0); |
| 225 | } | 190 | } |
| 226 | 191 | ||
| 227 | static inline void kvm_free_hwpgd(struct kvm *kvm) | 192 | static inline unsigned int kvm_get_hwpgd_size(void) |
| 228 | { | 193 | { |
| 229 | if (KVM_PREALLOC_LEVEL > 0) { | 194 | if (KVM_PREALLOC_LEVEL > 0) |
| 230 | unsigned long hwpgd = (unsigned long)kvm_get_hwpgd(kvm); | 195 | return PTRS_PER_S2_PGD * PAGE_SIZE; |
| 231 | free_pages(hwpgd, PTRS_PER_S2_PGD_SHIFT); | 196 | return PTRS_PER_S2_PGD * sizeof(pgd_t); |
| 232 | } | ||
| 233 | } | 197 | } |
| 234 | 198 | ||
| 235 | static inline bool kvm_page_empty(void *ptr) | 199 | static inline bool kvm_page_empty(void *ptr) |
diff --git a/arch/arm64/include/asm/proc-fns.h b/arch/arm64/include/asm/proc-fns.h index 9a8fd84f8fb2..941c375616e2 100644 --- a/arch/arm64/include/asm/proc-fns.h +++ b/arch/arm64/include/asm/proc-fns.h | |||
| @@ -39,7 +39,11 @@ extern u64 cpu_do_resume(phys_addr_t ptr, u64 idmap_ttbr); | |||
| 39 | 39 | ||
| 40 | #include <asm/memory.h> | 40 | #include <asm/memory.h> |
| 41 | 41 | ||
| 42 | #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm) | 42 | #define cpu_switch_mm(pgd,mm) \ |
| 43 | do { \ | ||
| 44 | BUG_ON(pgd == swapper_pg_dir); \ | ||
| 45 | cpu_do_switch_mm(virt_to_phys(pgd),mm); \ | ||
| 46 | } while (0) | ||
| 43 | 47 | ||
| 44 | #define cpu_get_pgd() \ | 48 | #define cpu_get_pgd() \ |
| 45 | ({ \ | 49 | ({ \ |
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 2b8d70164428..ab21e0d58278 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c | |||
| @@ -337,7 +337,11 @@ core_initcall(arm64_dmi_init); | |||
| 337 | 337 | ||
| 338 | static void efi_set_pgd(struct mm_struct *mm) | 338 | static void efi_set_pgd(struct mm_struct *mm) |
| 339 | { | 339 | { |
| 340 | cpu_switch_mm(mm->pgd, mm); | 340 | if (mm == &init_mm) |
| 341 | cpu_set_reserved_ttbr0(); | ||
| 342 | else | ||
| 343 | cpu_switch_mm(mm->pgd, mm); | ||
| 344 | |||
| 341 | flush_tlb_all(); | 345 | flush_tlb_all(); |
| 342 | if (icache_is_aivivt()) | 346 | if (icache_is_aivivt()) |
| 343 | __flush_icache_all(); | 347 | __flush_icache_all(); |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 58e0c2bdde04..ef7d112f5ce0 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
| @@ -51,7 +51,7 @@ static int __init early_coherent_pool(char *p) | |||
| 51 | } | 51 | } |
| 52 | early_param("coherent_pool", early_coherent_pool); | 52 | early_param("coherent_pool", early_coherent_pool); |
| 53 | 53 | ||
| 54 | static void *__alloc_from_pool(size_t size, struct page **ret_page) | 54 | static void *__alloc_from_pool(size_t size, struct page **ret_page, gfp_t flags) |
| 55 | { | 55 | { |
| 56 | unsigned long val; | 56 | unsigned long val; |
| 57 | void *ptr = NULL; | 57 | void *ptr = NULL; |
| @@ -67,6 +67,8 @@ static void *__alloc_from_pool(size_t size, struct page **ret_page) | |||
| 67 | 67 | ||
| 68 | *ret_page = phys_to_page(phys); | 68 | *ret_page = phys_to_page(phys); |
| 69 | ptr = (void *)val; | 69 | ptr = (void *)val; |
| 70 | if (flags & __GFP_ZERO) | ||
| 71 | memset(ptr, 0, size); | ||
| 70 | } | 72 | } |
| 71 | 73 | ||
| 72 | return ptr; | 74 | return ptr; |
| @@ -101,6 +103,7 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, | |||
| 101 | flags |= GFP_DMA; | 103 | flags |= GFP_DMA; |
| 102 | if (IS_ENABLED(CONFIG_DMA_CMA) && (flags & __GFP_WAIT)) { | 104 | if (IS_ENABLED(CONFIG_DMA_CMA) && (flags & __GFP_WAIT)) { |
| 103 | struct page *page; | 105 | struct page *page; |
| 106 | void *addr; | ||
| 104 | 107 | ||
| 105 | size = PAGE_ALIGN(size); | 108 | size = PAGE_ALIGN(size); |
| 106 | page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, | 109 | page = dma_alloc_from_contiguous(dev, size >> PAGE_SHIFT, |
| @@ -109,7 +112,10 @@ static void *__dma_alloc_coherent(struct device *dev, size_t size, | |||
| 109 | return NULL; | 112 | return NULL; |
| 110 | 113 | ||
| 111 | *dma_handle = phys_to_dma(dev, page_to_phys(page)); | 114 | *dma_handle = phys_to_dma(dev, page_to_phys(page)); |
| 112 | return page_address(page); | 115 | addr = page_address(page); |
| 116 | if (flags & __GFP_ZERO) | ||
| 117 | memset(addr, 0, size); | ||
| 118 | return addr; | ||
| 113 | } else { | 119 | } else { |
| 114 | return swiotlb_alloc_coherent(dev, size, dma_handle, flags); | 120 | return swiotlb_alloc_coherent(dev, size, dma_handle, flags); |
| 115 | } | 121 | } |
| @@ -146,7 +152,7 @@ static void *__dma_alloc(struct device *dev, size_t size, | |||
| 146 | 152 | ||
| 147 | if (!coherent && !(flags & __GFP_WAIT)) { | 153 | if (!coherent && !(flags & __GFP_WAIT)) { |
| 148 | struct page *page = NULL; | 154 | struct page *page = NULL; |
| 149 | void *addr = __alloc_from_pool(size, &page); | 155 | void *addr = __alloc_from_pool(size, &page, flags); |
| 150 | 156 | ||
| 151 | if (addr) | 157 | if (addr) |
| 152 | *dma_handle = phys_to_dma(dev, page_to_phys(page)); | 158 | *dma_handle = phys_to_dma(dev, page_to_phys(page)); |
diff --git a/arch/nios2/include/uapi/asm/Kbuild b/arch/nios2/include/uapi/asm/Kbuild index 376131194cc3..e0bb972a50d7 100644 --- a/arch/nios2/include/uapi/asm/Kbuild +++ b/arch/nios2/include/uapi/asm/Kbuild | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | include include/uapi/asm-generic/Kbuild.asm | 1 | include include/uapi/asm-generic/Kbuild.asm |
| 2 | 2 | ||
| 3 | header-y += elf.h | 3 | header-y += elf.h |
| 4 | header-y += ucontext.h | ||
| 5 | 4 | ||
| 6 | generic-y += ucontext.h | 5 | generic-y += ucontext.h |
diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c index 0d231adfe576..0c9b6afe69e9 100644 --- a/arch/nios2/mm/fault.c +++ b/arch/nios2/mm/fault.c | |||
| @@ -126,7 +126,6 @@ good_area: | |||
| 126 | break; | 126 | break; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | survive: | ||
| 130 | /* | 129 | /* |
| 131 | * If for any reason at all we couldn't handle the fault, | 130 | * If for any reason at all we couldn't handle the fault, |
| 132 | * make sure we exit gracefully rather than endlessly redo | 131 | * make sure we exit gracefully rather than endlessly redo |
| @@ -220,11 +219,6 @@ no_context: | |||
| 220 | */ | 219 | */ |
| 221 | out_of_memory: | 220 | out_of_memory: |
| 222 | up_read(&mm->mmap_sem); | 221 | up_read(&mm->mmap_sem); |
| 223 | if (is_global_init(tsk)) { | ||
| 224 | yield(); | ||
| 225 | down_read(&mm->mmap_sem); | ||
| 226 | goto survive; | ||
| 227 | } | ||
| 228 | if (!user_mode(regs)) | 222 | if (!user_mode(regs)) |
| 229 | goto no_context; | 223 | goto no_context; |
| 230 | pagefault_out_of_memory(); | 224 | pagefault_out_of_memory(); |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index f6579cfde2df..19e17bd7aec0 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
| @@ -165,7 +165,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) | |||
| 165 | case KVM_CAP_ONE_REG: | 165 | case KVM_CAP_ONE_REG: |
| 166 | case KVM_CAP_ENABLE_CAP: | 166 | case KVM_CAP_ENABLE_CAP: |
| 167 | case KVM_CAP_S390_CSS_SUPPORT: | 167 | case KVM_CAP_S390_CSS_SUPPORT: |
| 168 | case KVM_CAP_IRQFD: | ||
| 169 | case KVM_CAP_IOEVENTFD: | 168 | case KVM_CAP_IOEVENTFD: |
| 170 | case KVM_CAP_DEVICE_CTRL: | 169 | case KVM_CAP_DEVICE_CTRL: |
| 171 | case KVM_CAP_ENABLE_CAP_VM: | 170 | case KVM_CAP_ENABLE_CAP_VM: |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 96ac69c5eba0..efb00ec75805 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
| @@ -86,6 +86,9 @@ config ARCH_DEFCONFIG | |||
| 86 | default "arch/sparc/configs/sparc32_defconfig" if SPARC32 | 86 | default "arch/sparc/configs/sparc32_defconfig" if SPARC32 |
| 87 | default "arch/sparc/configs/sparc64_defconfig" if SPARC64 | 87 | default "arch/sparc/configs/sparc64_defconfig" if SPARC64 |
| 88 | 88 | ||
| 89 | config ARCH_PROC_KCORE_TEXT | ||
| 90 | def_bool y | ||
| 91 | |||
| 89 | config IOMMU_HELPER | 92 | config IOMMU_HELPER |
| 90 | bool | 93 | bool |
| 91 | default y if SPARC64 | 94 | default y if SPARC64 |
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h index 9b672be70dda..50d4840d9aeb 100644 --- a/arch/sparc/include/asm/io_64.h +++ b/arch/sparc/include/asm/io_64.h | |||
| @@ -407,16 +407,16 @@ static inline void iounmap(volatile void __iomem *addr) | |||
| 407 | { | 407 | { |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | #define ioread8(X) readb(X) | 410 | #define ioread8 readb |
| 411 | #define ioread16(X) readw(X) | 411 | #define ioread16 readw |
| 412 | #define ioread16be(X) __raw_readw(X) | 412 | #define ioread16be __raw_readw |
| 413 | #define ioread32(X) readl(X) | 413 | #define ioread32 readl |
| 414 | #define ioread32be(X) __raw_readl(X) | 414 | #define ioread32be __raw_readl |
| 415 | #define iowrite8(val,X) writeb(val,X) | 415 | #define iowrite8 writeb |
| 416 | #define iowrite16(val,X) writew(val,X) | 416 | #define iowrite16 writew |
| 417 | #define iowrite16be(val,X) __raw_writew(val,X) | 417 | #define iowrite16be __raw_writew |
| 418 | #define iowrite32(val,X) writel(val,X) | 418 | #define iowrite32 writel |
| 419 | #define iowrite32be(val,X) __raw_writel(val,X) | 419 | #define iowrite32be __raw_writel |
| 420 | 420 | ||
| 421 | /* Create a virtual mapping cookie for an IO port range */ | 421 | /* Create a virtual mapping cookie for an IO port range */ |
| 422 | void __iomem *ioport_map(unsigned long port, unsigned int nr); | 422 | void __iomem *ioport_map(unsigned long port, unsigned int nr); |
diff --git a/arch/sparc/include/asm/starfire.h b/arch/sparc/include/asm/starfire.h index c100dc27a0a9..176fa0ad19f1 100644 --- a/arch/sparc/include/asm/starfire.h +++ b/arch/sparc/include/asm/starfire.h | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | extern int this_is_starfire; | 12 | extern int this_is_starfire; |
| 13 | 13 | ||
| 14 | void check_if_starfire(void); | 14 | void check_if_starfire(void); |
| 15 | int starfire_hard_smp_processor_id(void); | ||
| 16 | void starfire_hookup(int); | 15 | void starfire_hookup(int); |
| 17 | unsigned int starfire_translate(unsigned long imap, unsigned int upaid); | 16 | unsigned int starfire_translate(unsigned long imap, unsigned int upaid); |
| 18 | 17 | ||
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h index 88d322b67fac..07cc49e541f4 100644 --- a/arch/sparc/kernel/entry.h +++ b/arch/sparc/kernel/entry.h | |||
| @@ -98,11 +98,7 @@ void sun4v_do_mna(struct pt_regs *regs, | |||
| 98 | void do_privop(struct pt_regs *regs); | 98 | void do_privop(struct pt_regs *regs); |
| 99 | void do_privact(struct pt_regs *regs); | 99 | void do_privact(struct pt_regs *regs); |
| 100 | void do_cee(struct pt_regs *regs); | 100 | void do_cee(struct pt_regs *regs); |
| 101 | void do_cee_tl1(struct pt_regs *regs); | ||
| 102 | void do_dae_tl1(struct pt_regs *regs); | ||
| 103 | void do_iae_tl1(struct pt_regs *regs); | ||
| 104 | void do_div0_tl1(struct pt_regs *regs); | 101 | void do_div0_tl1(struct pt_regs *regs); |
| 105 | void do_fpdis_tl1(struct pt_regs *regs); | ||
| 106 | void do_fpieee_tl1(struct pt_regs *regs); | 102 | void do_fpieee_tl1(struct pt_regs *regs); |
| 107 | void do_fpother_tl1(struct pt_regs *regs); | 103 | void do_fpother_tl1(struct pt_regs *regs); |
| 108 | void do_ill_tl1(struct pt_regs *regs); | 104 | void do_ill_tl1(struct pt_regs *regs); |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index da6f1a7fc4db..61139d9924ca 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
| @@ -1406,11 +1406,32 @@ void __irq_entry smp_receive_signal_client(int irq, struct pt_regs *regs) | |||
| 1406 | scheduler_ipi(); | 1406 | scheduler_ipi(); |
| 1407 | } | 1407 | } |
| 1408 | 1408 | ||
| 1409 | /* This is a nop because we capture all other cpus | 1409 | static void stop_this_cpu(void *dummy) |
| 1410 | * anyways when making the PROM active. | 1410 | { |
| 1411 | */ | 1411 | prom_stopself(); |
| 1412 | } | ||
| 1413 | |||
| 1412 | void smp_send_stop(void) | 1414 | void smp_send_stop(void) |
| 1413 | { | 1415 | { |
| 1416 | int cpu; | ||
| 1417 | |||
| 1418 | if (tlb_type == hypervisor) { | ||
| 1419 | for_each_online_cpu(cpu) { | ||
| 1420 | if (cpu == smp_processor_id()) | ||
| 1421 | continue; | ||
| 1422 | #ifdef CONFIG_SUN_LDOMS | ||
| 1423 | if (ldom_domaining_enabled) { | ||
| 1424 | unsigned long hv_err; | ||
| 1425 | hv_err = sun4v_cpu_stop(cpu); | ||
| 1426 | if (hv_err) | ||
| 1427 | printk(KERN_ERR "sun4v_cpu_stop() " | ||
| 1428 | "failed err=%lu\n", hv_err); | ||
| 1429 | } else | ||
| 1430 | #endif | ||
| 1431 | prom_stopcpu_cpuid(cpu); | ||
| 1432 | } | ||
| 1433 | } else | ||
| 1434 | smp_call_function(stop_this_cpu, NULL, 0); | ||
| 1414 | } | 1435 | } |
| 1415 | 1436 | ||
| 1416 | /** | 1437 | /** |
diff --git a/arch/sparc/kernel/starfire.c b/arch/sparc/kernel/starfire.c index 82281a566bb8..167fdfd9c837 100644 --- a/arch/sparc/kernel/starfire.c +++ b/arch/sparc/kernel/starfire.c | |||
| @@ -28,11 +28,6 @@ void check_if_starfire(void) | |||
| 28 | this_is_starfire = 1; | 28 | this_is_starfire = 1; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | int starfire_hard_smp_processor_id(void) | ||
| 32 | { | ||
| 33 | return upa_readl(0x1fff40000d0UL); | ||
| 34 | } | ||
| 35 | |||
| 36 | /* | 31 | /* |
| 37 | * Each Starfire board has 32 registers which perform translation | 32 | * Each Starfire board has 32 registers which perform translation |
| 38 | * and delivery of traditional interrupt packets into the extended | 33 | * and delivery of traditional interrupt packets into the extended |
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c index c85403d0496c..30e7ddb27a3a 100644 --- a/arch/sparc/kernel/sys_sparc_64.c +++ b/arch/sparc/kernel/sys_sparc_64.c | |||
| @@ -333,7 +333,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second | |||
| 333 | long err; | 333 | long err; |
| 334 | 334 | ||
| 335 | /* No need for backward compatibility. We can start fresh... */ | 335 | /* No need for backward compatibility. We can start fresh... */ |
| 336 | if (call <= SEMCTL) { | 336 | if (call <= SEMTIMEDOP) { |
| 337 | switch (call) { | 337 | switch (call) { |
| 338 | case SEMOP: | 338 | case SEMOP: |
| 339 | err = sys_semtimedop(first, ptr, | 339 | err = sys_semtimedop(first, ptr, |
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c index a27651e866e7..0e699745d643 100644 --- a/arch/sparc/kernel/traps_64.c +++ b/arch/sparc/kernel/traps_64.c | |||
| @@ -2427,6 +2427,8 @@ void __noreturn die_if_kernel(char *str, struct pt_regs *regs) | |||
| 2427 | } | 2427 | } |
| 2428 | user_instruction_dump ((unsigned int __user *) regs->tpc); | 2428 | user_instruction_dump ((unsigned int __user *) regs->tpc); |
| 2429 | } | 2429 | } |
| 2430 | if (panic_on_oops) | ||
| 2431 | panic("Fatal exception"); | ||
| 2430 | if (regs->tstate & TSTATE_PRIV) | 2432 | if (regs->tstate & TSTATE_PRIV) |
| 2431 | do_exit(SIGKILL); | 2433 | do_exit(SIGKILL); |
| 2432 | do_exit(SIGSEGV); | 2434 | do_exit(SIGSEGV); |
| @@ -2564,27 +2566,6 @@ void do_cee(struct pt_regs *regs) | |||
| 2564 | die_if_kernel("TL0: Cache Error Exception", regs); | 2566 | die_if_kernel("TL0: Cache Error Exception", regs); |
| 2565 | } | 2567 | } |
| 2566 | 2568 | ||
| 2567 | void do_cee_tl1(struct pt_regs *regs) | ||
| 2568 | { | ||
| 2569 | exception_enter(); | ||
| 2570 | dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); | ||
| 2571 | die_if_kernel("TL1: Cache Error Exception", regs); | ||
| 2572 | } | ||
| 2573 | |||
| 2574 | void do_dae_tl1(struct pt_regs *regs) | ||
| 2575 | { | ||
| 2576 | exception_enter(); | ||
| 2577 | dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); | ||
| 2578 | die_if_kernel("TL1: Data Access Exception", regs); | ||
| 2579 | } | ||
| 2580 | |||
| 2581 | void do_iae_tl1(struct pt_regs *regs) | ||
| 2582 | { | ||
| 2583 | exception_enter(); | ||
| 2584 | dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); | ||
| 2585 | die_if_kernel("TL1: Instruction Access Exception", regs); | ||
| 2586 | } | ||
| 2587 | |||
| 2588 | void do_div0_tl1(struct pt_regs *regs) | 2569 | void do_div0_tl1(struct pt_regs *regs) |
| 2589 | { | 2570 | { |
| 2590 | exception_enter(); | 2571 | exception_enter(); |
| @@ -2592,13 +2573,6 @@ void do_div0_tl1(struct pt_regs *regs) | |||
| 2592 | die_if_kernel("TL1: DIV0 Exception", regs); | 2573 | die_if_kernel("TL1: DIV0 Exception", regs); |
| 2593 | } | 2574 | } |
| 2594 | 2575 | ||
| 2595 | void do_fpdis_tl1(struct pt_regs *regs) | ||
| 2596 | { | ||
| 2597 | exception_enter(); | ||
| 2598 | dump_tl1_traplog((struct tl1_traplog *)(regs + 1)); | ||
| 2599 | die_if_kernel("TL1: FPU Disabled", regs); | ||
| 2600 | } | ||
| 2601 | |||
| 2602 | void do_fpieee_tl1(struct pt_regs *regs) | 2576 | void do_fpieee_tl1(struct pt_regs *regs) |
| 2603 | { | 2577 | { |
| 2604 | exception_enter(); | 2578 | exception_enter(); |
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c index 3ea267c53320..4ca0d6ba5ec8 100644 --- a/arch/sparc/mm/init_64.c +++ b/arch/sparc/mm/init_64.c | |||
| @@ -2820,7 +2820,7 @@ static int __init report_memory(void) | |||
| 2820 | 2820 | ||
| 2821 | return 0; | 2821 | return 0; |
| 2822 | } | 2822 | } |
| 2823 | device_initcall(report_memory); | 2823 | arch_initcall(report_memory); |
| 2824 | 2824 | ||
| 2825 | #ifdef CONFIG_SMP | 2825 | #ifdef CONFIG_SMP |
| 2826 | #define do_flush_tlb_kernel_range smp_flush_tlb_kernel_range | 2826 | #define do_flush_tlb_kernel_range smp_flush_tlb_kernel_range |
diff --git a/arch/x86/boot/compressed/aslr.c b/arch/x86/boot/compressed/aslr.c index 7083c16cccba..bb1376381985 100644 --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c | |||
| @@ -14,13 +14,6 @@ | |||
| 14 | static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@" | 14 | static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@" |
| 15 | LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION; | 15 | LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION; |
| 16 | 16 | ||
| 17 | struct kaslr_setup_data { | ||
| 18 | __u64 next; | ||
| 19 | __u32 type; | ||
| 20 | __u32 len; | ||
| 21 | __u8 data[1]; | ||
| 22 | } kaslr_setup_data; | ||
| 23 | |||
| 24 | #define I8254_PORT_CONTROL 0x43 | 17 | #define I8254_PORT_CONTROL 0x43 |
| 25 | #define I8254_PORT_COUNTER0 0x40 | 18 | #define I8254_PORT_COUNTER0 0x40 |
| 26 | #define I8254_CMD_READBACK 0xC0 | 19 | #define I8254_CMD_READBACK 0xC0 |
| @@ -302,29 +295,7 @@ static unsigned long find_random_addr(unsigned long minimum, | |||
| 302 | return slots_fetch_random(); | 295 | return slots_fetch_random(); |
| 303 | } | 296 | } |
| 304 | 297 | ||
| 305 | static void add_kaslr_setup_data(struct boot_params *params, __u8 enabled) | 298 | unsigned char *choose_kernel_location(unsigned char *input, |
| 306 | { | ||
| 307 | struct setup_data *data; | ||
| 308 | |||
| 309 | kaslr_setup_data.type = SETUP_KASLR; | ||
| 310 | kaslr_setup_data.len = 1; | ||
| 311 | kaslr_setup_data.next = 0; | ||
| 312 | kaslr_setup_data.data[0] = enabled; | ||
| 313 | |||
| 314 | data = (struct setup_data *)(unsigned long)params->hdr.setup_data; | ||
| 315 | |||
| 316 | while (data && data->next) | ||
| 317 | data = (struct setup_data *)(unsigned long)data->next; | ||
| 318 | |||
| 319 | if (data) | ||
| 320 | data->next = (unsigned long)&kaslr_setup_data; | ||
| 321 | else | ||
| 322 | params->hdr.setup_data = (unsigned long)&kaslr_setup_data; | ||
| 323 | |||
| 324 | } | ||
| 325 | |||
| 326 | unsigned char *choose_kernel_location(struct boot_params *params, | ||
| 327 | unsigned char *input, | ||
| 328 | unsigned long input_size, | 299 | unsigned long input_size, |
| 329 | unsigned char *output, | 300 | unsigned char *output, |
| 330 | unsigned long output_size) | 301 | unsigned long output_size) |
| @@ -335,17 +306,14 @@ unsigned char *choose_kernel_location(struct boot_params *params, | |||
| 335 | #ifdef CONFIG_HIBERNATION | 306 | #ifdef CONFIG_HIBERNATION |
| 336 | if (!cmdline_find_option_bool("kaslr")) { | 307 | if (!cmdline_find_option_bool("kaslr")) { |
| 337 | debug_putstr("KASLR disabled by default...\n"); | 308 | debug_putstr("KASLR disabled by default...\n"); |
| 338 | add_kaslr_setup_data(params, 0); | ||
| 339 | goto out; | 309 | goto out; |
| 340 | } | 310 | } |
| 341 | #else | 311 | #else |
| 342 | if (cmdline_find_option_bool("nokaslr")) { | 312 | if (cmdline_find_option_bool("nokaslr")) { |
| 343 | debug_putstr("KASLR disabled by cmdline...\n"); | 313 | debug_putstr("KASLR disabled by cmdline...\n"); |
| 344 | add_kaslr_setup_data(params, 0); | ||
| 345 | goto out; | 314 | goto out; |
| 346 | } | 315 | } |
| 347 | #endif | 316 | #endif |
| 348 | add_kaslr_setup_data(params, 1); | ||
| 349 | 317 | ||
| 350 | /* Record the various known unsafe memory ranges. */ | 318 | /* Record the various known unsafe memory ranges. */ |
| 351 | mem_avoid_init((unsigned long)input, input_size, | 319 | mem_avoid_init((unsigned long)input, input_size, |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 5903089c818f..a950864a64da 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
| @@ -401,8 +401,7 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, | |||
| 401 | * the entire decompressed kernel plus relocation table, or the | 401 | * the entire decompressed kernel plus relocation table, or the |
| 402 | * entire decompressed kernel plus .bss and .brk sections. | 402 | * entire decompressed kernel plus .bss and .brk sections. |
| 403 | */ | 403 | */ |
| 404 | output = choose_kernel_location(real_mode, input_data, input_len, | 404 | output = choose_kernel_location(input_data, input_len, output, |
| 405 | output, | ||
| 406 | output_len > run_size ? output_len | 405 | output_len > run_size ? output_len |
| 407 | : run_size); | 406 | : run_size); |
| 408 | 407 | ||
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h index ee3576b2666b..04477d68403f 100644 --- a/arch/x86/boot/compressed/misc.h +++ b/arch/x86/boot/compressed/misc.h | |||
| @@ -57,8 +57,7 @@ int cmdline_find_option_bool(const char *option); | |||
| 57 | 57 | ||
| 58 | #if CONFIG_RANDOMIZE_BASE | 58 | #if CONFIG_RANDOMIZE_BASE |
| 59 | /* aslr.c */ | 59 | /* aslr.c */ |
| 60 | unsigned char *choose_kernel_location(struct boot_params *params, | 60 | unsigned char *choose_kernel_location(unsigned char *input, |
| 61 | unsigned char *input, | ||
| 62 | unsigned long input_size, | 61 | unsigned long input_size, |
| 63 | unsigned char *output, | 62 | unsigned char *output, |
| 64 | unsigned long output_size); | 63 | unsigned long output_size); |
| @@ -66,8 +65,7 @@ unsigned char *choose_kernel_location(struct boot_params *params, | |||
| 66 | bool has_cpuflag(int flag); | 65 | bool has_cpuflag(int flag); |
| 67 | #else | 66 | #else |
| 68 | static inline | 67 | static inline |
| 69 | unsigned char *choose_kernel_location(struct boot_params *params, | 68 | unsigned char *choose_kernel_location(unsigned char *input, |
| 70 | unsigned char *input, | ||
| 71 | unsigned long input_size, | 69 | unsigned long input_size, |
| 72 | unsigned char *output, | 70 | unsigned char *output, |
| 73 | unsigned long output_size) | 71 | unsigned long output_size) |
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c index 947c6bf52c33..54f60ab41c63 100644 --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c | |||
| @@ -1155,7 +1155,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) | |||
| 1155 | src = kmalloc(req->cryptlen + req->assoclen, GFP_ATOMIC); | 1155 | src = kmalloc(req->cryptlen + req->assoclen, GFP_ATOMIC); |
| 1156 | if (!src) | 1156 | if (!src) |
| 1157 | return -ENOMEM; | 1157 | return -ENOMEM; |
| 1158 | assoc = (src + req->cryptlen + auth_tag_len); | 1158 | assoc = (src + req->cryptlen); |
| 1159 | scatterwalk_map_and_copy(src, req->src, 0, req->cryptlen, 0); | 1159 | scatterwalk_map_and_copy(src, req->src, 0, req->cryptlen, 0); |
| 1160 | scatterwalk_map_and_copy(assoc, req->assoc, 0, | 1160 | scatterwalk_map_and_copy(assoc, req->assoc, 0, |
| 1161 | req->assoclen, 0); | 1161 | req->assoclen, 0); |
| @@ -1180,7 +1180,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) | |||
| 1180 | scatterwalk_done(&src_sg_walk, 0, 0); | 1180 | scatterwalk_done(&src_sg_walk, 0, 0); |
| 1181 | scatterwalk_done(&assoc_sg_walk, 0, 0); | 1181 | scatterwalk_done(&assoc_sg_walk, 0, 0); |
| 1182 | } else { | 1182 | } else { |
| 1183 | scatterwalk_map_and_copy(dst, req->dst, 0, req->cryptlen, 1); | 1183 | scatterwalk_map_and_copy(dst, req->dst, 0, tempCipherLen, 1); |
| 1184 | kfree(src); | 1184 | kfree(src); |
| 1185 | } | 1185 | } |
| 1186 | return retval; | 1186 | return retval; |
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h index 0dbc08282291..72ba21a8b5fc 100644 --- a/arch/x86/include/asm/fpu-internal.h +++ b/arch/x86/include/asm/fpu-internal.h | |||
| @@ -370,7 +370,7 @@ static inline void drop_fpu(struct task_struct *tsk) | |||
| 370 | preempt_disable(); | 370 | preempt_disable(); |
| 371 | tsk->thread.fpu_counter = 0; | 371 | tsk->thread.fpu_counter = 0; |
| 372 | __drop_fpu(tsk); | 372 | __drop_fpu(tsk); |
| 373 | clear_used_math(); | 373 | clear_stopped_child_used_math(tsk); |
| 374 | preempt_enable(); | 374 | preempt_enable(); |
| 375 | } | 375 | } |
| 376 | 376 | ||
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 95e11f79f123..f97fbe3abb67 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
| @@ -51,8 +51,6 @@ extern int devmem_is_allowed(unsigned long pagenr); | |||
| 51 | extern unsigned long max_low_pfn_mapped; | 51 | extern unsigned long max_low_pfn_mapped; |
| 52 | extern unsigned long max_pfn_mapped; | 52 | extern unsigned long max_pfn_mapped; |
| 53 | 53 | ||
| 54 | extern bool kaslr_enabled; | ||
| 55 | |||
| 56 | static inline phys_addr_t get_max_mapped(void) | 54 | static inline phys_addr_t get_max_mapped(void) |
| 57 | { | 55 | { |
| 58 | return (phys_addr_t)max_pfn_mapped << PAGE_SHIFT; | 56 | return (phys_addr_t)max_pfn_mapped << PAGE_SHIFT; |
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h index 44e6dd7e36a2..225b0988043a 100644 --- a/arch/x86/include/uapi/asm/bootparam.h +++ b/arch/x86/include/uapi/asm/bootparam.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #define SETUP_DTB 2 | 7 | #define SETUP_DTB 2 |
| 8 | #define SETUP_PCI 3 | 8 | #define SETUP_PCI 3 |
| 9 | #define SETUP_EFI 4 | 9 | #define SETUP_EFI 4 |
| 10 | #define SETUP_KASLR 5 | ||
| 11 | 10 | ||
| 12 | /* ram_size flags */ | 11 | /* ram_size flags */ |
| 13 | #define RAMDISK_IMAGE_START_MASK 0x07FF | 12 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 3d525c6124f6..803b684676ff 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -1338,6 +1338,26 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) | |||
| 1338 | } | 1338 | } |
| 1339 | 1339 | ||
| 1340 | /* | 1340 | /* |
| 1341 | * ACPI offers an alternative platform interface model that removes | ||
| 1342 | * ACPI hardware requirements for platforms that do not implement | ||
| 1343 | * the PC Architecture. | ||
| 1344 | * | ||
| 1345 | * We initialize the Hardware-reduced ACPI model here: | ||
| 1346 | */ | ||
| 1347 | static void __init acpi_reduced_hw_init(void) | ||
| 1348 | { | ||
| 1349 | if (acpi_gbl_reduced_hardware) { | ||
| 1350 | /* | ||
| 1351 | * Override x86_init functions and bypass legacy pic | ||
| 1352 | * in Hardware-reduced ACPI mode | ||
| 1353 | */ | ||
| 1354 | x86_init.timers.timer_init = x86_init_noop; | ||
| 1355 | x86_init.irqs.pre_vector_init = x86_init_noop; | ||
| 1356 | legacy_pic = &null_legacy_pic; | ||
| 1357 | } | ||
| 1358 | } | ||
| 1359 | |||
| 1360 | /* | ||
| 1341 | * If your system is blacklisted here, but you find that acpi=force | 1361 | * If your system is blacklisted here, but you find that acpi=force |
| 1342 | * works for you, please contact linux-acpi@vger.kernel.org | 1362 | * works for you, please contact linux-acpi@vger.kernel.org |
| 1343 | */ | 1363 | */ |
| @@ -1536,6 +1556,11 @@ int __init early_acpi_boot_init(void) | |||
| 1536 | */ | 1556 | */ |
| 1537 | early_acpi_process_madt(); | 1557 | early_acpi_process_madt(); |
| 1538 | 1558 | ||
| 1559 | /* | ||
| 1560 | * Hardware-reduced ACPI mode initialization: | ||
| 1561 | */ | ||
| 1562 | acpi_reduced_hw_init(); | ||
| 1563 | |||
| 1539 | return 0; | 1564 | return 0; |
| 1540 | } | 1565 | } |
| 1541 | 1566 | ||
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index c2fd21fed002..017149cded07 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c | |||
| @@ -37,10 +37,12 @@ static const struct apic apic_numachip; | |||
| 37 | static unsigned int get_apic_id(unsigned long x) | 37 | static unsigned int get_apic_id(unsigned long x) |
| 38 | { | 38 | { |
| 39 | unsigned long value; | 39 | unsigned long value; |
| 40 | unsigned int id; | 40 | unsigned int id = (x >> 24) & 0xff; |
| 41 | 41 | ||
| 42 | rdmsrl(MSR_FAM10H_NODE_ID, value); | 42 | if (static_cpu_has_safe(X86_FEATURE_NODEID_MSR)) { |
| 43 | id = ((x >> 24) & 0xffU) | ((value << 2) & 0xff00U); | 43 | rdmsrl(MSR_FAM10H_NODE_ID, value); |
| 44 | id |= (value << 2) & 0xff00; | ||
| 45 | } | ||
| 44 | 46 | ||
| 45 | return id; | 47 | return id; |
| 46 | } | 48 | } |
| @@ -155,10 +157,18 @@ static int __init numachip_probe(void) | |||
| 155 | 157 | ||
| 156 | static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) | 158 | static void fixup_cpu_id(struct cpuinfo_x86 *c, int node) |
| 157 | { | 159 | { |
| 158 | if (c->phys_proc_id != node) { | 160 | u64 val; |
| 159 | c->phys_proc_id = node; | 161 | u32 nodes = 1; |
| 160 | per_cpu(cpu_llc_id, smp_processor_id()) = node; | 162 | |
| 163 | this_cpu_write(cpu_llc_id, node); | ||
| 164 | |||
| 165 | /* Account for nodes per socket in multi-core-module processors */ | ||
| 166 | if (static_cpu_has_safe(X86_FEATURE_NODEID_MSR)) { | ||
| 167 | rdmsrl(MSR_FAM10H_NODE_ID, val); | ||
| 168 | nodes = ((val >> 3) & 7) + 1; | ||
| 161 | } | 169 | } |
| 170 | |||
| 171 | c->phys_proc_id = node / nodes; | ||
| 162 | } | 172 | } |
| 163 | 173 | ||
| 164 | static int __init numachip_system_init(void) | 174 | static int __init numachip_system_init(void) |
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 9bbb9b35c144..d1ac80b72c72 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c | |||
| @@ -47,13 +47,21 @@ do { \ | |||
| 47 | 47 | ||
| 48 | #ifdef CONFIG_RANDOMIZE_BASE | 48 | #ifdef CONFIG_RANDOMIZE_BASE |
| 49 | static unsigned long module_load_offset; | 49 | static unsigned long module_load_offset; |
| 50 | static int randomize_modules = 1; | ||
| 50 | 51 | ||
| 51 | /* Mutex protects the module_load_offset. */ | 52 | /* Mutex protects the module_load_offset. */ |
| 52 | static DEFINE_MUTEX(module_kaslr_mutex); | 53 | static DEFINE_MUTEX(module_kaslr_mutex); |
| 53 | 54 | ||
| 55 | static int __init parse_nokaslr(char *p) | ||
| 56 | { | ||
| 57 | randomize_modules = 0; | ||
| 58 | return 0; | ||
| 59 | } | ||
| 60 | early_param("nokaslr", parse_nokaslr); | ||
| 61 | |||
| 54 | static unsigned long int get_module_load_offset(void) | 62 | static unsigned long int get_module_load_offset(void) |
| 55 | { | 63 | { |
| 56 | if (kaslr_enabled) { | 64 | if (randomize_modules) { |
| 57 | mutex_lock(&module_kaslr_mutex); | 65 | mutex_lock(&module_kaslr_mutex); |
| 58 | /* | 66 | /* |
| 59 | * Calculate the module_load_offset the first time this | 67 | * Calculate the module_load_offset the first time this |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 98dc9317286e..0a2421cca01f 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -122,8 +122,6 @@ | |||
| 122 | unsigned long max_low_pfn_mapped; | 122 | unsigned long max_low_pfn_mapped; |
| 123 | unsigned long max_pfn_mapped; | 123 | unsigned long max_pfn_mapped; |
| 124 | 124 | ||
| 125 | bool __read_mostly kaslr_enabled = false; | ||
| 126 | |||
| 127 | #ifdef CONFIG_DMI | 125 | #ifdef CONFIG_DMI |
| 128 | RESERVE_BRK(dmi_alloc, 65536); | 126 | RESERVE_BRK(dmi_alloc, 65536); |
| 129 | #endif | 127 | #endif |
| @@ -427,11 +425,6 @@ static void __init reserve_initrd(void) | |||
| 427 | } | 425 | } |
| 428 | #endif /* CONFIG_BLK_DEV_INITRD */ | 426 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 429 | 427 | ||
| 430 | static void __init parse_kaslr_setup(u64 pa_data, u32 data_len) | ||
| 431 | { | ||
| 432 | kaslr_enabled = (bool)(pa_data + sizeof(struct setup_data)); | ||
| 433 | } | ||
| 434 | |||
| 435 | static void __init parse_setup_data(void) | 428 | static void __init parse_setup_data(void) |
| 436 | { | 429 | { |
| 437 | struct setup_data *data; | 430 | struct setup_data *data; |
| @@ -457,9 +450,6 @@ static void __init parse_setup_data(void) | |||
| 457 | case SETUP_EFI: | 450 | case SETUP_EFI: |
| 458 | parse_efi_setup(pa_data, data_len); | 451 | parse_efi_setup(pa_data, data_len); |
| 459 | break; | 452 | break; |
| 460 | case SETUP_KASLR: | ||
| 461 | parse_kaslr_setup(pa_data, data_len); | ||
| 462 | break; | ||
| 463 | default: | 453 | default: |
| 464 | break; | 454 | break; |
| 465 | } | 455 | } |
| @@ -842,14 +832,10 @@ static void __init trim_low_memory_range(void) | |||
| 842 | static int | 832 | static int |
| 843 | dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) | 833 | dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p) |
| 844 | { | 834 | { |
| 845 | if (kaslr_enabled) | 835 | pr_emerg("Kernel Offset: 0x%lx from 0x%lx " |
| 846 | pr_emerg("Kernel Offset: 0x%lx from 0x%lx (relocation range: 0x%lx-0x%lx)\n", | 836 | "(relocation range: 0x%lx-0x%lx)\n", |
| 847 | (unsigned long)&_text - __START_KERNEL, | 837 | (unsigned long)&_text - __START_KERNEL, __START_KERNEL, |
| 848 | __START_KERNEL, | 838 | __START_KERNEL_map, MODULES_VADDR-1); |
| 849 | __START_KERNEL_map, | ||
| 850 | MODULES_VADDR-1); | ||
| 851 | else | ||
| 852 | pr_emerg("Kernel Offset: disabled\n"); | ||
| 853 | 839 | ||
| 854 | return 0; | 840 | return 0; |
| 855 | } | 841 | } |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 9d2073e2ecc9..4ff5d162ff9f 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
| @@ -384,7 +384,7 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) | |||
| 384 | goto exit; | 384 | goto exit; |
| 385 | conditional_sti(regs); | 385 | conditional_sti(regs); |
| 386 | 386 | ||
| 387 | if (!user_mode(regs)) | 387 | if (!user_mode_vm(regs)) |
| 388 | die("bounds", regs, error_code); | 388 | die("bounds", regs, error_code); |
| 389 | 389 | ||
| 390 | if (!cpu_feature_enabled(X86_FEATURE_MPX)) { | 390 | if (!cpu_feature_enabled(X86_FEATURE_MPX)) { |
| @@ -637,7 +637,7 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code) | |||
| 637 | * then it's very likely the result of an icebp/int01 trap. | 637 | * then it's very likely the result of an icebp/int01 trap. |
| 638 | * User wants a sigtrap for that. | 638 | * User wants a sigtrap for that. |
| 639 | */ | 639 | */ |
| 640 | if (!dr6 && user_mode(regs)) | 640 | if (!dr6 && user_mode_vm(regs)) |
| 641 | user_icebp = 1; | 641 | user_icebp = 1; |
| 642 | 642 | ||
| 643 | /* Catch kmemcheck conditions first of all! */ | 643 | /* Catch kmemcheck conditions first of all! */ |
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 34f66e58a896..cdc6cf903078 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
| @@ -379,7 +379,7 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) | |||
| 379 | * thread's fpu state, reconstruct fxstate from the fsave | 379 | * thread's fpu state, reconstruct fxstate from the fsave |
| 380 | * header. Sanitize the copied state etc. | 380 | * header. Sanitize the copied state etc. |
| 381 | */ | 381 | */ |
| 382 | struct xsave_struct *xsave = &tsk->thread.fpu.state->xsave; | 382 | struct fpu *fpu = &tsk->thread.fpu; |
| 383 | struct user_i387_ia32_struct env; | 383 | struct user_i387_ia32_struct env; |
| 384 | int err = 0; | 384 | int err = 0; |
| 385 | 385 | ||
| @@ -393,14 +393,15 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) | |||
| 393 | */ | 393 | */ |
| 394 | drop_fpu(tsk); | 394 | drop_fpu(tsk); |
| 395 | 395 | ||
| 396 | if (__copy_from_user(xsave, buf_fx, state_size) || | 396 | if (__copy_from_user(&fpu->state->xsave, buf_fx, state_size) || |
| 397 | __copy_from_user(&env, buf, sizeof(env))) { | 397 | __copy_from_user(&env, buf, sizeof(env))) { |
| 398 | fpu_finit(fpu); | ||
| 398 | err = -1; | 399 | err = -1; |
| 399 | } else { | 400 | } else { |
| 400 | sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only); | 401 | sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only); |
| 401 | set_used_math(); | ||
| 402 | } | 402 | } |
| 403 | 403 | ||
| 404 | set_used_math(); | ||
| 404 | if (use_eager_fpu()) { | 405 | if (use_eager_fpu()) { |
| 405 | preempt_disable(); | 406 | preempt_disable(); |
| 406 | math_state_restore(); | 407 | math_state_restore(); |
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index cc31f7c06d3d..9541ba34126b 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
| @@ -507,6 +507,7 @@ static int picdev_read(struct kvm_pic *s, | |||
| 507 | return -EOPNOTSUPP; | 507 | return -EOPNOTSUPP; |
| 508 | 508 | ||
| 509 | if (len != 1) { | 509 | if (len != 1) { |
| 510 | memset(val, 0, len); | ||
| 510 | pr_pic_unimpl("non byte read\n"); | 511 | pr_pic_unimpl("non byte read\n"); |
| 511 | return 0; | 512 | return 0; |
| 512 | } | 513 | } |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f7b20b417a3a..10a481b7674d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -2168,7 +2168,10 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu) | |||
| 2168 | { | 2168 | { |
| 2169 | unsigned long *msr_bitmap; | 2169 | unsigned long *msr_bitmap; |
| 2170 | 2170 | ||
| 2171 | if (irqchip_in_kernel(vcpu->kvm) && apic_x2apic_mode(vcpu->arch.apic)) { | 2171 | if (is_guest_mode(vcpu)) |
| 2172 | msr_bitmap = vmx_msr_bitmap_nested; | ||
| 2173 | else if (irqchip_in_kernel(vcpu->kvm) && | ||
| 2174 | apic_x2apic_mode(vcpu->arch.apic)) { | ||
| 2172 | if (is_long_mode(vcpu)) | 2175 | if (is_long_mode(vcpu)) |
| 2173 | msr_bitmap = vmx_msr_bitmap_longmode_x2apic; | 2176 | msr_bitmap = vmx_msr_bitmap_longmode_x2apic; |
| 2174 | else | 2177 | else |
| @@ -9218,9 +9221,9 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) | |||
| 9218 | } | 9221 | } |
| 9219 | 9222 | ||
| 9220 | if (cpu_has_vmx_msr_bitmap() && | 9223 | if (cpu_has_vmx_msr_bitmap() && |
| 9221 | exec_control & CPU_BASED_USE_MSR_BITMAPS && | 9224 | exec_control & CPU_BASED_USE_MSR_BITMAPS) { |
| 9222 | nested_vmx_merge_msr_bitmap(vcpu, vmcs12)) { | 9225 | nested_vmx_merge_msr_bitmap(vcpu, vmcs12); |
| 9223 | vmcs_write64(MSR_BITMAP, __pa(vmx_msr_bitmap_nested)); | 9226 | /* MSR_BITMAP will be set by following vmx_set_efer. */ |
| 9224 | } else | 9227 | } else |
| 9225 | exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; | 9228 | exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; |
| 9226 | 9229 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index bd7a70be41b3..32bf19ef3115 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -2744,7 +2744,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) | |||
| 2744 | case KVM_CAP_USER_NMI: | 2744 | case KVM_CAP_USER_NMI: |
| 2745 | case KVM_CAP_REINJECT_CONTROL: | 2745 | case KVM_CAP_REINJECT_CONTROL: |
| 2746 | case KVM_CAP_IRQ_INJECT_STATUS: | 2746 | case KVM_CAP_IRQ_INJECT_STATUS: |
| 2747 | case KVM_CAP_IRQFD: | ||
| 2748 | case KVM_CAP_IOEVENTFD: | 2747 | case KVM_CAP_IOEVENTFD: |
| 2749 | case KVM_CAP_IOEVENTFD_NO_LENGTH: | 2748 | case KVM_CAP_IOEVENTFD_NO_LENGTH: |
| 2750 | case KVM_CAP_PIT2: | 2749 | case KVM_CAP_PIT2: |
diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S index 31776d0efc8c..d7ec4e251c0a 100644 --- a/arch/x86/vdso/vdso32/sigreturn.S +++ b/arch/x86/vdso/vdso32/sigreturn.S | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | .text | 17 | .text |
| 18 | .globl __kernel_sigreturn | 18 | .globl __kernel_sigreturn |
| 19 | .type __kernel_sigreturn,@function | 19 | .type __kernel_sigreturn,@function |
| 20 | nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */ | ||
| 20 | ALIGN | 21 | ALIGN |
| 21 | __kernel_sigreturn: | 22 | __kernel_sigreturn: |
| 22 | .LSTART_sigreturn: | 23 | .LSTART_sigreturn: |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index d453a2c98ad0..81751a49d8bf 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
| @@ -307,7 +307,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, | |||
| 307 | if (pos == 0) { | 307 | if (pos == 0) { |
| 308 | memmove(blk + offset * map->cache_word_size, | 308 | memmove(blk + offset * map->cache_word_size, |
| 309 | blk, rbnode->blklen * map->cache_word_size); | 309 | blk, rbnode->blklen * map->cache_word_size); |
| 310 | bitmap_shift_right(present, present, offset, blklen); | 310 | bitmap_shift_left(present, present, offset, blklen); |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | /* update the rbnode block, its size and the base register */ | 313 | /* update the rbnode block, its size and the base register */ |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index f373c35f9e1d..da84f544c544 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
| @@ -608,7 +608,8 @@ static int regcache_sync_block_single(struct regmap *map, void *block, | |||
| 608 | for (i = start; i < end; i++) { | 608 | for (i = start; i < end; i++) { |
| 609 | regtmp = block_base + (i * map->reg_stride); | 609 | regtmp = block_base + (i * map->reg_stride); |
| 610 | 610 | ||
| 611 | if (!regcache_reg_present(cache_present, i)) | 611 | if (!regcache_reg_present(cache_present, i) || |
| 612 | !regmap_writeable(map, regtmp)) | ||
| 612 | continue; | 613 | continue; |
| 613 | 614 | ||
| 614 | val = regcache_get_val(map, block, i); | 615 | val = regcache_get_val(map, block, i); |
| @@ -677,7 +678,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block, | |||
| 677 | for (i = start; i < end; i++) { | 678 | for (i = start; i < end; i++) { |
| 678 | regtmp = block_base + (i * map->reg_stride); | 679 | regtmp = block_base + (i * map->reg_stride); |
| 679 | 680 | ||
| 680 | if (!regcache_reg_present(cache_present, i)) { | 681 | if (!regcache_reg_present(cache_present, i) || |
| 682 | !regmap_writeable(map, regtmp)) { | ||
| 681 | ret = regcache_sync_block_raw_flush(map, &data, | 683 | ret = regcache_sync_block_raw_flush(map, &data, |
| 682 | base, regtmp); | 684 | base, regtmp); |
| 683 | if (ret != 0) | 685 | if (ret != 0) |
diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 6299a50a5960..a6c3f75b4b01 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c | |||
| @@ -499,7 +499,8 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags, | |||
| 499 | goto err_alloc; | 499 | goto err_alloc; |
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | ret = request_threaded_irq(irq, NULL, regmap_irq_thread, irq_flags, | 502 | ret = request_threaded_irq(irq, NULL, regmap_irq_thread, |
| 503 | irq_flags | IRQF_ONESHOT, | ||
| 503 | chip->name, d); | 504 | chip->name, d); |
| 504 | if (ret != 0) { | 505 | if (ret != 0) { |
| 505 | dev_err(map->dev, "Failed to request IRQ %d for %s: %d\n", | 506 | dev_err(map->dev, "Failed to request IRQ %d for %s: %d\n", |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index fae2dbbf5745..72d7028f779b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -142,6 +142,7 @@ struct ports_device { | |||
| 142 | * notification | 142 | * notification |
| 143 | */ | 143 | */ |
| 144 | struct work_struct control_work; | 144 | struct work_struct control_work; |
| 145 | struct work_struct config_work; | ||
| 145 | 146 | ||
| 146 | struct list_head ports; | 147 | struct list_head ports; |
| 147 | 148 | ||
| @@ -1837,10 +1838,21 @@ static void config_intr(struct virtio_device *vdev) | |||
| 1837 | 1838 | ||
| 1838 | portdev = vdev->priv; | 1839 | portdev = vdev->priv; |
| 1839 | 1840 | ||
| 1841 | if (!use_multiport(portdev)) | ||
| 1842 | schedule_work(&portdev->config_work); | ||
| 1843 | } | ||
| 1844 | |||
| 1845 | static void config_work_handler(struct work_struct *work) | ||
| 1846 | { | ||
| 1847 | struct ports_device *portdev; | ||
| 1848 | |||
| 1849 | portdev = container_of(work, struct ports_device, control_work); | ||
| 1840 | if (!use_multiport(portdev)) { | 1850 | if (!use_multiport(portdev)) { |
| 1851 | struct virtio_device *vdev; | ||
| 1841 | struct port *port; | 1852 | struct port *port; |
| 1842 | u16 rows, cols; | 1853 | u16 rows, cols; |
| 1843 | 1854 | ||
| 1855 | vdev = portdev->vdev; | ||
| 1844 | virtio_cread(vdev, struct virtio_console_config, cols, &cols); | 1856 | virtio_cread(vdev, struct virtio_console_config, cols, &cols); |
| 1845 | virtio_cread(vdev, struct virtio_console_config, rows, &rows); | 1857 | virtio_cread(vdev, struct virtio_console_config, rows, &rows); |
| 1846 | 1858 | ||
| @@ -2040,12 +2052,14 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
| 2040 | 2052 | ||
| 2041 | virtio_device_ready(portdev->vdev); | 2053 | virtio_device_ready(portdev->vdev); |
| 2042 | 2054 | ||
| 2055 | INIT_WORK(&portdev->config_work, &config_work_handler); | ||
| 2056 | INIT_WORK(&portdev->control_work, &control_work_handler); | ||
| 2057 | |||
| 2043 | if (multiport) { | 2058 | if (multiport) { |
| 2044 | unsigned int nr_added_bufs; | 2059 | unsigned int nr_added_bufs; |
| 2045 | 2060 | ||
| 2046 | spin_lock_init(&portdev->c_ivq_lock); | 2061 | spin_lock_init(&portdev->c_ivq_lock); |
| 2047 | spin_lock_init(&portdev->c_ovq_lock); | 2062 | spin_lock_init(&portdev->c_ovq_lock); |
| 2048 | INIT_WORK(&portdev->control_work, &control_work_handler); | ||
| 2049 | 2063 | ||
| 2050 | nr_added_bufs = fill_queue(portdev->c_ivq, | 2064 | nr_added_bufs = fill_queue(portdev->c_ivq, |
| 2051 | &portdev->c_ivq_lock); | 2065 | &portdev->c_ivq_lock); |
| @@ -2113,6 +2127,8 @@ static void virtcons_remove(struct virtio_device *vdev) | |||
| 2113 | /* Finish up work that's lined up */ | 2127 | /* Finish up work that's lined up */ |
| 2114 | if (use_multiport(portdev)) | 2128 | if (use_multiport(portdev)) |
| 2115 | cancel_work_sync(&portdev->control_work); | 2129 | cancel_work_sync(&portdev->control_work); |
| 2130 | else | ||
| 2131 | cancel_work_sync(&portdev->config_work); | ||
| 2116 | 2132 | ||
| 2117 | list_for_each_entry_safe(port, port2, &portdev->ports, list) | 2133 | list_for_each_entry_safe(port, port2, &portdev->ports, list) |
| 2118 | unplug_port(port); | 2134 | unplug_port(port); |
| @@ -2164,6 +2180,7 @@ static int virtcons_freeze(struct virtio_device *vdev) | |||
| 2164 | 2180 | ||
| 2165 | virtqueue_disable_cb(portdev->c_ivq); | 2181 | virtqueue_disable_cb(portdev->c_ivq); |
| 2166 | cancel_work_sync(&portdev->control_work); | 2182 | cancel_work_sync(&portdev->control_work); |
| 2183 | cancel_work_sync(&portdev->config_work); | ||
| 2167 | /* | 2184 | /* |
| 2168 | * Once more: if control_work_handler() was running, it would | 2185 | * Once more: if control_work_handler() was running, it would |
| 2169 | * enable the cb as the last step. | 2186 | * enable the cb as the last step. |
diff --git a/drivers/clocksource/time-efm32.c b/drivers/clocksource/time-efm32.c index bba62f9deefb..ec57ba2bbd87 100644 --- a/drivers/clocksource/time-efm32.c +++ b/drivers/clocksource/time-efm32.c | |||
| @@ -225,12 +225,12 @@ static int __init efm32_clockevent_init(struct device_node *np) | |||
| 225 | clock_event_ddata.base = base; | 225 | clock_event_ddata.base = base; |
| 226 | clock_event_ddata.periodic_top = DIV_ROUND_CLOSEST(rate, 1024 * HZ); | 226 | clock_event_ddata.periodic_top = DIV_ROUND_CLOSEST(rate, 1024 * HZ); |
| 227 | 227 | ||
| 228 | setup_irq(irq, &efm32_clock_event_irq); | ||
| 229 | |||
| 230 | clockevents_config_and_register(&clock_event_ddata.evtdev, | 228 | clockevents_config_and_register(&clock_event_ddata.evtdev, |
| 231 | DIV_ROUND_CLOSEST(rate, 1024), | 229 | DIV_ROUND_CLOSEST(rate, 1024), |
| 232 | 0xf, 0xffff); | 230 | 0xf, 0xffff); |
| 233 | 231 | ||
| 232 | setup_irq(irq, &efm32_clock_event_irq); | ||
| 233 | |||
| 234 | return 0; | 234 | return 0; |
| 235 | 235 | ||
| 236 | err_get_irq: | 236 | err_get_irq: |
diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c index 02268448dc85..5dcbf90b8015 100644 --- a/drivers/clocksource/timer-sun5i.c +++ b/drivers/clocksource/timer-sun5i.c | |||
| @@ -178,10 +178,6 @@ static void __init sun5i_timer_init(struct device_node *node) | |||
| 178 | 178 | ||
| 179 | ticks_per_jiffy = DIV_ROUND_UP(rate, HZ); | 179 | ticks_per_jiffy = DIV_ROUND_UP(rate, HZ); |
| 180 | 180 | ||
| 181 | ret = setup_irq(irq, &sun5i_timer_irq); | ||
| 182 | if (ret) | ||
| 183 | pr_warn("failed to setup irq %d\n", irq); | ||
| 184 | |||
| 185 | /* Enable timer0 interrupt */ | 181 | /* Enable timer0 interrupt */ |
| 186 | val = readl(timer_base + TIMER_IRQ_EN_REG); | 182 | val = readl(timer_base + TIMER_IRQ_EN_REG); |
| 187 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); | 183 | writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG); |
| @@ -191,6 +187,10 @@ static void __init sun5i_timer_init(struct device_node *node) | |||
| 191 | 187 | ||
| 192 | clockevents_config_and_register(&sun5i_clockevent, rate, | 188 | clockevents_config_and_register(&sun5i_clockevent, rate, |
| 193 | TIMER_SYNC_TICKS, 0xffffffff); | 189 | TIMER_SYNC_TICKS, 0xffffffff); |
| 190 | |||
| 191 | ret = setup_irq(irq, &sun5i_timer_irq); | ||
| 192 | if (ret) | ||
| 193 | pr_warn("failed to setup irq %d\n", irq); | ||
| 194 | } | 194 | } |
| 195 | CLOCKSOURCE_OF_DECLARE(sun5i_a13, "allwinner,sun5i-a13-hstimer", | 195 | CLOCKSOURCE_OF_DECLARE(sun5i_a13, "allwinner,sun5i-a13-hstimer", |
| 196 | sun5i_timer_init); | 196 | sun5i_timer_init); |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 7c669c328c4c..56ce8c2b5530 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1959,6 +1959,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 1959 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, | 1959 | { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb65a) }, |
| 1960 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 1960 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
| 1961 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 1961 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
| 1962 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, | ||
| 1962 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, | 1963 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
| 1963 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, | 1964 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
| 1964 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, | 1965 | { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 204312bfab2c..9c4786759f16 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -586,6 +586,7 @@ | |||
| 586 | #define USB_VENDOR_ID_LOGITECH 0x046d | 586 | #define USB_VENDOR_ID_LOGITECH 0x046d |
| 587 | #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e | 587 | #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e |
| 588 | #define USB_DEVICE_ID_LOGITECH_T651 0xb00c | 588 | #define USB_DEVICE_ID_LOGITECH_T651 0xb00c |
| 589 | #define USB_DEVICE_ID_LOGITECH_C077 0xc007 | ||
| 589 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | 590 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 |
| 590 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 | 591 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 |
| 591 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f | 592 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f |
| @@ -898,6 +899,7 @@ | |||
| 898 | #define USB_VENDOR_ID_TIVO 0x150a | 899 | #define USB_VENDOR_ID_TIVO 0x150a |
| 899 | #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 | 900 | #define USB_DEVICE_ID_TIVO_SLIDE_BT 0x1200 |
| 900 | #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 | 901 | #define USB_DEVICE_ID_TIVO_SLIDE 0x1201 |
| 902 | #define USB_DEVICE_ID_TIVO_SLIDE_PRO 0x1203 | ||
| 901 | 903 | ||
| 902 | #define USB_VENDOR_ID_TOPSEED 0x0766 | 904 | #define USB_VENDOR_ID_TOPSEED 0x0766 |
| 903 | #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 | 905 | #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204 |
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c index d790d8d71f7f..d98696927453 100644 --- a/drivers/hid/hid-tivo.c +++ b/drivers/hid/hid-tivo.c | |||
| @@ -64,6 +64,7 @@ static const struct hid_device_id tivo_devices[] = { | |||
| 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ | 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
| 65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
| 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
| 67 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_PRO) }, | ||
| 67 | { } | 68 | { } |
| 68 | }; | 69 | }; |
| 69 | MODULE_DEVICE_TABLE(hid, tivo_devices); | 70 | MODULE_DEVICE_TABLE(hid, tivo_devices); |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 9be99a67bfe2..a82127753461 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -78,6 +78,7 @@ static const struct hid_blacklist { | |||
| 78 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 78 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
| 79 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 79 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
| 80 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 80 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
| 81 | { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL }, | ||
| 81 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | 82 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, |
| 82 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, | 83 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, |
| 83 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, | 84 | { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 046351cf17f3..bbe32d66e500 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
| @@ -551,9 +551,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) | |||
| 551 | (features->type == CINTIQ && !(data[1] & 0x40))) | 551 | (features->type == CINTIQ && !(data[1] & 0x40))) |
| 552 | return 1; | 552 | return 1; |
| 553 | 553 | ||
| 554 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) | 554 | if (wacom->shared) { |
| 555 | wacom->shared->stylus_in_proximity = true; | 555 | wacom->shared->stylus_in_proximity = true; |
| 556 | 556 | ||
| 557 | if (wacom->shared->touch_down) | ||
| 558 | return 1; | ||
| 559 | } | ||
| 560 | |||
| 557 | /* in Range while exiting */ | 561 | /* in Range while exiting */ |
| 558 | if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { | 562 | if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) { |
| 559 | input_report_key(input, BTN_TOUCH, 0); | 563 | input_report_key(input, BTN_TOUCH, 0); |
| @@ -1043,27 +1047,28 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom) | |||
| 1043 | struct input_dev *input = wacom->input; | 1047 | struct input_dev *input = wacom->input; |
| 1044 | unsigned char *data = wacom->data; | 1048 | unsigned char *data = wacom->data; |
| 1045 | int i; | 1049 | int i; |
| 1046 | int current_num_contacts = 0; | 1050 | int current_num_contacts = data[61]; |
| 1047 | int contacts_to_send = 0; | 1051 | int contacts_to_send = 0; |
| 1048 | int num_contacts_left = 4; /* maximum contacts per packet */ | 1052 | int num_contacts_left = 4; /* maximum contacts per packet */ |
| 1049 | int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; | 1053 | int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET; |
| 1050 | int y_offset = 2; | 1054 | int y_offset = 2; |
| 1055 | static int contact_with_no_pen_down_count = 0; | ||
| 1051 | 1056 | ||
| 1052 | if (wacom->features.type == WACOM_27QHDT) { | 1057 | if (wacom->features.type == WACOM_27QHDT) { |
| 1053 | current_num_contacts = data[63]; | 1058 | current_num_contacts = data[63]; |
| 1054 | num_contacts_left = 10; | 1059 | num_contacts_left = 10; |
| 1055 | byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; | 1060 | byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET; |
| 1056 | y_offset = 0; | 1061 | y_offset = 0; |
| 1057 | } else { | ||
| 1058 | current_num_contacts = data[61]; | ||
| 1059 | } | 1062 | } |
| 1060 | 1063 | ||
| 1061 | /* | 1064 | /* |
| 1062 | * First packet resets the counter since only the first | 1065 | * First packet resets the counter since only the first |
| 1063 | * packet in series will have non-zero current_num_contacts. | 1066 | * packet in series will have non-zero current_num_contacts. |
| 1064 | */ | 1067 | */ |
| 1065 | if (current_num_contacts) | 1068 | if (current_num_contacts) { |
| 1066 | wacom->num_contacts_left = current_num_contacts; | 1069 | wacom->num_contacts_left = current_num_contacts; |
| 1070 | contact_with_no_pen_down_count = 0; | ||
| 1071 | } | ||
| 1067 | 1072 | ||
| 1068 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); | 1073 | contacts_to_send = min(num_contacts_left, wacom->num_contacts_left); |
| 1069 | 1074 | ||
| @@ -1096,15 +1101,16 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom) | |||
| 1096 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); | 1101 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); |
| 1097 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); | 1102 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); |
| 1098 | } | 1103 | } |
| 1104 | contact_with_no_pen_down_count++; | ||
| 1099 | } | 1105 | } |
| 1100 | } | 1106 | } |
| 1101 | input_mt_report_pointer_emulation(input, true); | 1107 | input_mt_report_pointer_emulation(input, true); |
| 1102 | 1108 | ||
| 1103 | wacom->num_contacts_left -= contacts_to_send; | 1109 | wacom->num_contacts_left -= contacts_to_send; |
| 1104 | if (wacom->num_contacts_left <= 0) | 1110 | if (wacom->num_contacts_left <= 0) { |
| 1105 | wacom->num_contacts_left = 0; | 1111 | wacom->num_contacts_left = 0; |
| 1106 | 1112 | wacom->shared->touch_down = (contact_with_no_pen_down_count > 0); | |
| 1107 | wacom->shared->touch_down = (wacom->num_contacts_left > 0); | 1113 | } |
| 1108 | return 1; | 1114 | return 1; |
| 1109 | } | 1115 | } |
| 1110 | 1116 | ||
| @@ -1116,6 +1122,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom) | |||
| 1116 | int current_num_contacts = data[2]; | 1122 | int current_num_contacts = data[2]; |
| 1117 | int contacts_to_send = 0; | 1123 | int contacts_to_send = 0; |
| 1118 | int x_offset = 0; | 1124 | int x_offset = 0; |
| 1125 | static int contact_with_no_pen_down_count = 0; | ||
| 1119 | 1126 | ||
| 1120 | /* MTTPC does not support Height and Width */ | 1127 | /* MTTPC does not support Height and Width */ |
| 1121 | if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) | 1128 | if (wacom->features.type == MTTPC || wacom->features.type == MTTPC_B) |
| @@ -1125,8 +1132,10 @@ static int wacom_mt_touch(struct wacom_wac *wacom) | |||
| 1125 | * First packet resets the counter since only the first | 1132 | * First packet resets the counter since only the first |
| 1126 | * packet in series will have non-zero current_num_contacts. | 1133 | * packet in series will have non-zero current_num_contacts. |
| 1127 | */ | 1134 | */ |
| 1128 | if (current_num_contacts) | 1135 | if (current_num_contacts) { |
| 1129 | wacom->num_contacts_left = current_num_contacts; | 1136 | wacom->num_contacts_left = current_num_contacts; |
| 1137 | contact_with_no_pen_down_count = 0; | ||
| 1138 | } | ||
| 1130 | 1139 | ||
| 1131 | /* There are at most 5 contacts per packet */ | 1140 | /* There are at most 5 contacts per packet */ |
| 1132 | contacts_to_send = min(5, wacom->num_contacts_left); | 1141 | contacts_to_send = min(5, wacom->num_contacts_left); |
| @@ -1147,15 +1156,16 @@ static int wacom_mt_touch(struct wacom_wac *wacom) | |||
| 1147 | int y = get_unaligned_le16(&data[offset + x_offset + 9]); | 1156 | int y = get_unaligned_le16(&data[offset + x_offset + 9]); |
| 1148 | input_report_abs(input, ABS_MT_POSITION_X, x); | 1157 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1149 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 1158 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 1159 | contact_with_no_pen_down_count++; | ||
| 1150 | } | 1160 | } |
| 1151 | } | 1161 | } |
| 1152 | input_mt_report_pointer_emulation(input, true); | 1162 | input_mt_report_pointer_emulation(input, true); |
| 1153 | 1163 | ||
| 1154 | wacom->num_contacts_left -= contacts_to_send; | 1164 | wacom->num_contacts_left -= contacts_to_send; |
| 1155 | if (wacom->num_contacts_left < 0) | 1165 | if (wacom->num_contacts_left <= 0) { |
| 1156 | wacom->num_contacts_left = 0; | 1166 | wacom->num_contacts_left = 0; |
| 1157 | 1167 | wacom->shared->touch_down = (contact_with_no_pen_down_count > 0); | |
| 1158 | wacom->shared->touch_down = (wacom->num_contacts_left > 0); | 1168 | } |
| 1159 | return 1; | 1169 | return 1; |
| 1160 | } | 1170 | } |
| 1161 | 1171 | ||
| @@ -1193,29 +1203,25 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) | |||
| 1193 | { | 1203 | { |
| 1194 | unsigned char *data = wacom->data; | 1204 | unsigned char *data = wacom->data; |
| 1195 | struct input_dev *input = wacom->input; | 1205 | struct input_dev *input = wacom->input; |
| 1196 | bool prox; | 1206 | bool prox = !wacom->shared->stylus_in_proximity; |
| 1197 | int x = 0, y = 0; | 1207 | int x = 0, y = 0; |
| 1198 | 1208 | ||
| 1199 | if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) | 1209 | if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG) |
| 1200 | return 0; | 1210 | return 0; |
| 1201 | 1211 | ||
| 1202 | if (!wacom->shared->stylus_in_proximity) { | 1212 | if (len == WACOM_PKGLEN_TPC1FG) { |
| 1203 | if (len == WACOM_PKGLEN_TPC1FG) { | 1213 | prox = prox && (data[0] & 0x01); |
| 1204 | prox = data[0] & 0x01; | 1214 | x = get_unaligned_le16(&data[1]); |
| 1205 | x = get_unaligned_le16(&data[1]); | 1215 | y = get_unaligned_le16(&data[3]); |
| 1206 | y = get_unaligned_le16(&data[3]); | 1216 | } else if (len == WACOM_PKGLEN_TPC1FG_B) { |
| 1207 | } else if (len == WACOM_PKGLEN_TPC1FG_B) { | 1217 | prox = prox && (data[2] & 0x01); |
| 1208 | prox = data[2] & 0x01; | 1218 | x = get_unaligned_le16(&data[3]); |
| 1209 | x = get_unaligned_le16(&data[3]); | 1219 | y = get_unaligned_le16(&data[5]); |
| 1210 | y = get_unaligned_le16(&data[5]); | 1220 | } else { |
| 1211 | } else { | 1221 | prox = prox && (data[1] & 0x01); |
| 1212 | prox = data[1] & 0x01; | 1222 | x = le16_to_cpup((__le16 *)&data[2]); |
| 1213 | x = le16_to_cpup((__le16 *)&data[2]); | 1223 | y = le16_to_cpup((__le16 *)&data[4]); |
| 1214 | y = le16_to_cpup((__le16 *)&data[4]); | 1224 | } |
| 1215 | } | ||
| 1216 | } else | ||
| 1217 | /* force touch out when pen is in prox */ | ||
| 1218 | prox = 0; | ||
| 1219 | 1225 | ||
| 1220 | if (prox) { | 1226 | if (prox) { |
| 1221 | input_report_abs(input, ABS_X, x); | 1227 | input_report_abs(input, ABS_X, x); |
| @@ -1613,6 +1619,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
| 1613 | struct input_dev *pad_input = wacom->pad_input; | 1619 | struct input_dev *pad_input = wacom->pad_input; |
| 1614 | unsigned char *data = wacom->data; | 1620 | unsigned char *data = wacom->data; |
| 1615 | int i; | 1621 | int i; |
| 1622 | int contact_with_no_pen_down_count = 0; | ||
| 1616 | 1623 | ||
| 1617 | if (data[0] != 0x02) | 1624 | if (data[0] != 0x02) |
| 1618 | return 0; | 1625 | return 0; |
| @@ -1640,6 +1647,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
| 1640 | } | 1647 | } |
| 1641 | input_report_abs(input, ABS_MT_POSITION_X, x); | 1648 | input_report_abs(input, ABS_MT_POSITION_X, x); |
| 1642 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 1649 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 1650 | contact_with_no_pen_down_count++; | ||
| 1643 | } | 1651 | } |
| 1644 | } | 1652 | } |
| 1645 | 1653 | ||
| @@ -1649,11 +1657,12 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
| 1649 | input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); | 1657 | input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); |
| 1650 | input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); | 1658 | input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); |
| 1651 | input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); | 1659 | input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); |
| 1660 | wacom->shared->touch_down = (contact_with_no_pen_down_count > 0); | ||
| 1652 | 1661 | ||
| 1653 | return 1; | 1662 | return 1; |
| 1654 | } | 1663 | } |
| 1655 | 1664 | ||
| 1656 | static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | 1665 | static int wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data, int last_touch_count) |
| 1657 | { | 1666 | { |
| 1658 | struct wacom_features *features = &wacom->features; | 1667 | struct wacom_features *features = &wacom->features; |
| 1659 | struct input_dev *input = wacom->input; | 1668 | struct input_dev *input = wacom->input; |
| @@ -1661,7 +1670,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | |||
| 1661 | int slot = input_mt_get_slot_by_key(input, data[0]); | 1670 | int slot = input_mt_get_slot_by_key(input, data[0]); |
| 1662 | 1671 | ||
| 1663 | if (slot < 0) | 1672 | if (slot < 0) |
| 1664 | return; | 1673 | return 0; |
| 1665 | 1674 | ||
| 1666 | touch = touch && !wacom->shared->stylus_in_proximity; | 1675 | touch = touch && !wacom->shared->stylus_in_proximity; |
| 1667 | 1676 | ||
| @@ -1693,7 +1702,9 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | |||
| 1693 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 1702 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
| 1694 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); | 1703 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, width); |
| 1695 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); | 1704 | input_report_abs(input, ABS_MT_TOUCH_MINOR, height); |
| 1705 | last_touch_count++; | ||
| 1696 | } | 1706 | } |
| 1707 | return last_touch_count; | ||
| 1697 | } | 1708 | } |
| 1698 | 1709 | ||
| 1699 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) | 1710 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) |
| @@ -1718,6 +1729,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom) | |||
| 1718 | unsigned char *data = wacom->data; | 1729 | unsigned char *data = wacom->data; |
| 1719 | int count = data[1] & 0x07; | 1730 | int count = data[1] & 0x07; |
| 1720 | int i; | 1731 | int i; |
| 1732 | int contact_with_no_pen_down_count = 0; | ||
| 1721 | 1733 | ||
| 1722 | if (data[0] != 0x02) | 1734 | if (data[0] != 0x02) |
| 1723 | return 0; | 1735 | return 0; |
| @@ -1728,12 +1740,15 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom) | |||
| 1728 | int msg_id = data[offset]; | 1740 | int msg_id = data[offset]; |
| 1729 | 1741 | ||
| 1730 | if (msg_id >= 2 && msg_id <= 17) | 1742 | if (msg_id >= 2 && msg_id <= 17) |
| 1731 | wacom_bpt3_touch_msg(wacom, data + offset); | 1743 | contact_with_no_pen_down_count = |
| 1744 | wacom_bpt3_touch_msg(wacom, data + offset, | ||
| 1745 | contact_with_no_pen_down_count); | ||
| 1732 | else if (msg_id == 128) | 1746 | else if (msg_id == 128) |
| 1733 | wacom_bpt3_button_msg(wacom, data + offset); | 1747 | wacom_bpt3_button_msg(wacom, data + offset); |
| 1734 | 1748 | ||
| 1735 | } | 1749 | } |
| 1736 | input_mt_report_pointer_emulation(input, true); | 1750 | input_mt_report_pointer_emulation(input, true); |
| 1751 | wacom->shared->touch_down = (contact_with_no_pen_down_count > 0); | ||
| 1737 | 1752 | ||
| 1738 | return 1; | 1753 | return 1; |
| 1739 | } | 1754 | } |
| @@ -1759,6 +1774,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) | |||
| 1759 | return 0; | 1774 | return 0; |
| 1760 | } | 1775 | } |
| 1761 | 1776 | ||
| 1777 | if (wacom->shared->touch_down) | ||
| 1778 | return 0; | ||
| 1779 | |||
| 1762 | prox = (data[1] & 0x20) == 0x20; | 1780 | prox = (data[1] & 0x20) == 0x20; |
| 1763 | 1781 | ||
| 1764 | /* | 1782 | /* |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 1793aea4a7d2..6eb738ca6d2f 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
| @@ -1793,11 +1793,11 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
| 1793 | tape->best_dsc_rw_freq = clamp_t(unsigned long, t, IDETAPE_DSC_RW_MIN, | 1793 | tape->best_dsc_rw_freq = clamp_t(unsigned long, t, IDETAPE_DSC_RW_MIN, |
| 1794 | IDETAPE_DSC_RW_MAX); | 1794 | IDETAPE_DSC_RW_MAX); |
| 1795 | printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " | 1795 | printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, " |
| 1796 | "%lums tDSC%s\n", | 1796 | "%ums tDSC%s\n", |
| 1797 | drive->name, tape->name, *(u16 *)&tape->caps[14], | 1797 | drive->name, tape->name, *(u16 *)&tape->caps[14], |
| 1798 | (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, | 1798 | (*(u16 *)&tape->caps[16] * 512) / tape->buffer_size, |
| 1799 | tape->buffer_size / 1024, | 1799 | tape->buffer_size / 1024, |
| 1800 | tape->best_dsc_rw_freq * 1000 / HZ, | 1800 | jiffies_to_msecs(tape->best_dsc_rw_freq), |
| 1801 | (drive->dev_flags & IDE_DFLAG_USING_DMA) ? ", DMA" : ""); | 1801 | (drive->dev_flags & IDE_DFLAG_USING_DMA) ? ", DMA" : ""); |
| 1802 | 1802 | ||
| 1803 | ide_proc_register_driver(drive, tape->driver); | 1803 | ide_proc_register_driver(drive, tape->driver); |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index c7619716c31d..59040265e361 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
| @@ -64,6 +64,14 @@ enum { | |||
| 64 | #define GUID_TBL_BLK_NUM_ENTRIES 8 | 64 | #define GUID_TBL_BLK_NUM_ENTRIES 8 |
| 65 | #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) | 65 | #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) |
| 66 | 66 | ||
| 67 | /* Counters should be saturate once they reach their maximum value */ | ||
| 68 | #define ASSIGN_32BIT_COUNTER(counter, value) do {\ | ||
| 69 | if ((value) > U32_MAX) \ | ||
| 70 | counter = cpu_to_be32(U32_MAX); \ | ||
| 71 | else \ | ||
| 72 | counter = cpu_to_be32(value); \ | ||
| 73 | } while (0) | ||
| 74 | |||
| 67 | struct mlx4_mad_rcv_buf { | 75 | struct mlx4_mad_rcv_buf { |
| 68 | struct ib_grh grh; | 76 | struct ib_grh grh; |
| 69 | u8 payload[256]; | 77 | u8 payload[256]; |
| @@ -806,10 +814,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | |||
| 806 | static void edit_counter(struct mlx4_counter *cnt, | 814 | static void edit_counter(struct mlx4_counter *cnt, |
| 807 | struct ib_pma_portcounters *pma_cnt) | 815 | struct ib_pma_portcounters *pma_cnt) |
| 808 | { | 816 | { |
| 809 | pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2)); | 817 | ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data, |
| 810 | pma_cnt->port_rcv_data = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2)); | 818 | (be64_to_cpu(cnt->tx_bytes) >> 2)); |
| 811 | pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames)); | 819 | ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data, |
| 812 | pma_cnt->port_rcv_packets = cpu_to_be32(be64_to_cpu(cnt->rx_frames)); | 820 | (be64_to_cpu(cnt->rx_bytes) >> 2)); |
| 821 | ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets, | ||
| 822 | be64_to_cpu(cnt->tx_frames)); | ||
| 823 | ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets, | ||
| 824 | be64_to_cpu(cnt->rx_frames)); | ||
| 813 | } | 825 | } |
| 814 | 826 | ||
| 815 | static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, | 827 | static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index ac6e2b710ea6..b972c0b41799 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -2697,8 +2697,12 @@ static void handle_bonded_port_state_event(struct work_struct *work) | |||
| 2697 | spin_lock_bh(&ibdev->iboe.lock); | 2697 | spin_lock_bh(&ibdev->iboe.lock); |
| 2698 | for (i = 0; i < MLX4_MAX_PORTS; ++i) { | 2698 | for (i = 0; i < MLX4_MAX_PORTS; ++i) { |
| 2699 | struct net_device *curr_netdev = ibdev->iboe.netdevs[i]; | 2699 | struct net_device *curr_netdev = ibdev->iboe.netdevs[i]; |
| 2700 | enum ib_port_state curr_port_state; | ||
| 2700 | 2701 | ||
| 2701 | enum ib_port_state curr_port_state = | 2702 | if (!curr_netdev) |
| 2703 | continue; | ||
| 2704 | |||
| 2705 | curr_port_state = | ||
| 2702 | (netif_running(curr_netdev) && | 2706 | (netif_running(curr_netdev) && |
| 2703 | netif_carrier_ok(curr_netdev)) ? | 2707 | netif_carrier_ok(curr_netdev)) ? |
| 2704 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 2708 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index f2cceb6493a0..dda605836546 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -67,9 +67,6 @@ | |||
| 67 | #define X_MAX_POSITIVE 8176 | 67 | #define X_MAX_POSITIVE 8176 |
| 68 | #define Y_MAX_POSITIVE 8176 | 68 | #define Y_MAX_POSITIVE 8176 |
| 69 | 69 | ||
| 70 | /* maximum ABS_MT_POSITION displacement (in mm) */ | ||
| 71 | #define DMAX 10 | ||
| 72 | |||
| 73 | /***************************************************************************** | 70 | /***************************************************************************** |
| 74 | * Stuff we need even when we do not want native Synaptics support | 71 | * Stuff we need even when we do not want native Synaptics support |
| 75 | ****************************************************************************/ | 72 | ****************************************************************************/ |
| @@ -123,32 +120,41 @@ void synaptics_reset(struct psmouse *psmouse) | |||
| 123 | 120 | ||
| 124 | static bool cr48_profile_sensor; | 121 | static bool cr48_profile_sensor; |
| 125 | 122 | ||
| 123 | #define ANY_BOARD_ID 0 | ||
| 126 | struct min_max_quirk { | 124 | struct min_max_quirk { |
| 127 | const char * const *pnp_ids; | 125 | const char * const *pnp_ids; |
| 126 | struct { | ||
| 127 | unsigned long int min, max; | ||
| 128 | } board_id; | ||
| 128 | int x_min, x_max, y_min, y_max; | 129 | int x_min, x_max, y_min, y_max; |
| 129 | }; | 130 | }; |
| 130 | 131 | ||
| 131 | static const struct min_max_quirk min_max_pnpid_table[] = { | 132 | static const struct min_max_quirk min_max_pnpid_table[] = { |
| 132 | { | 133 | { |
| 133 | (const char * const []){"LEN0033", NULL}, | 134 | (const char * const []){"LEN0033", NULL}, |
| 135 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
| 134 | 1024, 5052, 2258, 4832 | 136 | 1024, 5052, 2258, 4832 |
| 135 | }, | 137 | }, |
| 136 | { | 138 | { |
| 137 | (const char * const []){"LEN0035", "LEN0042", NULL}, | 139 | (const char * const []){"LEN0042", NULL}, |
| 140 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
| 138 | 1232, 5710, 1156, 4696 | 141 | 1232, 5710, 1156, 4696 |
| 139 | }, | 142 | }, |
| 140 | { | 143 | { |
| 141 | (const char * const []){"LEN0034", "LEN0036", "LEN0037", | 144 | (const char * const []){"LEN0034", "LEN0036", "LEN0037", |
| 142 | "LEN0039", "LEN2002", "LEN2004", | 145 | "LEN0039", "LEN2002", "LEN2004", |
| 143 | NULL}, | 146 | NULL}, |
| 147 | {ANY_BOARD_ID, 2961}, | ||
| 144 | 1024, 5112, 2024, 4832 | 148 | 1024, 5112, 2024, 4832 |
| 145 | }, | 149 | }, |
| 146 | { | 150 | { |
| 147 | (const char * const []){"LEN2001", NULL}, | 151 | (const char * const []){"LEN2001", NULL}, |
| 152 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
| 148 | 1024, 5022, 2508, 4832 | 153 | 1024, 5022, 2508, 4832 |
| 149 | }, | 154 | }, |
| 150 | { | 155 | { |
| 151 | (const char * const []){"LEN2006", NULL}, | 156 | (const char * const []){"LEN2006", NULL}, |
| 157 | {ANY_BOARD_ID, ANY_BOARD_ID}, | ||
| 152 | 1264, 5675, 1171, 4688 | 158 | 1264, 5675, 1171, 4688 |
| 153 | }, | 159 | }, |
| 154 | { } | 160 | { } |
| @@ -175,9 +181,7 @@ static const char * const topbuttonpad_pnp_ids[] = { | |||
| 175 | "LEN0041", | 181 | "LEN0041", |
| 176 | "LEN0042", /* Yoga */ | 182 | "LEN0042", /* Yoga */ |
| 177 | "LEN0045", | 183 | "LEN0045", |
| 178 | "LEN0046", | ||
| 179 | "LEN0047", | 184 | "LEN0047", |
| 180 | "LEN0048", | ||
| 181 | "LEN0049", | 185 | "LEN0049", |
| 182 | "LEN2000", | 186 | "LEN2000", |
| 183 | "LEN2001", /* Edge E431 */ | 187 | "LEN2001", /* Edge E431 */ |
| @@ -235,18 +239,39 @@ static int synaptics_model_id(struct psmouse *psmouse) | |||
| 235 | return 0; | 239 | return 0; |
| 236 | } | 240 | } |
| 237 | 241 | ||
| 242 | static int synaptics_more_extended_queries(struct psmouse *psmouse) | ||
| 243 | { | ||
| 244 | struct synaptics_data *priv = psmouse->private; | ||
| 245 | unsigned char buf[3]; | ||
| 246 | |||
| 247 | if (synaptics_send_cmd(psmouse, SYN_QUE_MEXT_CAPAB_10, buf)) | ||
| 248 | return -1; | ||
| 249 | |||
| 250 | priv->ext_cap_10 = (buf[0]<<16) | (buf[1]<<8) | buf[2]; | ||
| 251 | |||
| 252 | return 0; | ||
| 253 | } | ||
| 254 | |||
| 238 | /* | 255 | /* |
| 239 | * Read the board id from the touchpad | 256 | * Read the board id and the "More Extended Queries" from the touchpad |
| 240 | * The board id is encoded in the "QUERY MODES" response | 257 | * The board id is encoded in the "QUERY MODES" response |
| 241 | */ | 258 | */ |
| 242 | static int synaptics_board_id(struct psmouse *psmouse) | 259 | static int synaptics_query_modes(struct psmouse *psmouse) |
| 243 | { | 260 | { |
| 244 | struct synaptics_data *priv = psmouse->private; | 261 | struct synaptics_data *priv = psmouse->private; |
| 245 | unsigned char bid[3]; | 262 | unsigned char bid[3]; |
| 246 | 263 | ||
| 264 | /* firmwares prior 7.5 have no board_id encoded */ | ||
| 265 | if (SYN_ID_FULL(priv->identity) < 0x705) | ||
| 266 | return 0; | ||
| 267 | |||
| 247 | if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid)) | 268 | if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid)) |
| 248 | return -1; | 269 | return -1; |
| 249 | priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; | 270 | priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; |
| 271 | |||
| 272 | if (SYN_MEXT_CAP_BIT(bid[0])) | ||
| 273 | return synaptics_more_extended_queries(psmouse); | ||
| 274 | |||
| 250 | return 0; | 275 | return 0; |
| 251 | } | 276 | } |
| 252 | 277 | ||
| @@ -346,7 +371,6 @@ static int synaptics_resolution(struct psmouse *psmouse) | |||
| 346 | { | 371 | { |
| 347 | struct synaptics_data *priv = psmouse->private; | 372 | struct synaptics_data *priv = psmouse->private; |
| 348 | unsigned char resp[3]; | 373 | unsigned char resp[3]; |
| 349 | int i; | ||
| 350 | 374 | ||
| 351 | if (SYN_ID_MAJOR(priv->identity) < 4) | 375 | if (SYN_ID_MAJOR(priv->identity) < 4) |
| 352 | return 0; | 376 | return 0; |
| @@ -358,17 +382,6 @@ static int synaptics_resolution(struct psmouse *psmouse) | |||
| 358 | } | 382 | } |
| 359 | } | 383 | } |
| 360 | 384 | ||
| 361 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { | ||
| 362 | if (psmouse_matches_pnp_id(psmouse, | ||
| 363 | min_max_pnpid_table[i].pnp_ids)) { | ||
| 364 | priv->x_min = min_max_pnpid_table[i].x_min; | ||
| 365 | priv->x_max = min_max_pnpid_table[i].x_max; | ||
| 366 | priv->y_min = min_max_pnpid_table[i].y_min; | ||
| 367 | priv->y_max = min_max_pnpid_table[i].y_max; | ||
| 368 | return 0; | ||
| 369 | } | ||
| 370 | } | ||
| 371 | |||
| 372 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && | 385 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && |
| 373 | SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { | 386 | SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { |
| 374 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) { | 387 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) { |
| @@ -377,23 +390,69 @@ static int synaptics_resolution(struct psmouse *psmouse) | |||
| 377 | } else { | 390 | } else { |
| 378 | priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); | 391 | priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); |
| 379 | priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); | 392 | priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); |
| 393 | psmouse_info(psmouse, | ||
| 394 | "queried max coordinates: x [..%d], y [..%d]\n", | ||
| 395 | priv->x_max, priv->y_max); | ||
| 380 | } | 396 | } |
| 381 | } | 397 | } |
| 382 | 398 | ||
| 383 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 && | 399 | if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) && |
| 384 | SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) { | 400 | (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 || |
| 401 | /* | ||
| 402 | * Firmware v8.1 does not report proper number of extended | ||
| 403 | * capabilities, but has been proven to report correct min | ||
| 404 | * coordinates. | ||
| 405 | */ | ||
| 406 | SYN_ID_FULL(priv->identity) == 0x801)) { | ||
| 385 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) { | 407 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) { |
| 386 | psmouse_warn(psmouse, | 408 | psmouse_warn(psmouse, |
| 387 | "device claims to have min coordinates query, but I'm not able to read it.\n"); | 409 | "device claims to have min coordinates query, but I'm not able to read it.\n"); |
| 388 | } else { | 410 | } else { |
| 389 | priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); | 411 | priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); |
| 390 | priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); | 412 | priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); |
| 413 | psmouse_info(psmouse, | ||
| 414 | "queried min coordinates: x [%d..], y [%d..]\n", | ||
| 415 | priv->x_min, priv->y_min); | ||
| 391 | } | 416 | } |
| 392 | } | 417 | } |
| 393 | 418 | ||
| 394 | return 0; | 419 | return 0; |
| 395 | } | 420 | } |
| 396 | 421 | ||
| 422 | /* | ||
| 423 | * Apply quirk(s) if the hardware matches | ||
| 424 | */ | ||
| 425 | |||
| 426 | static void synaptics_apply_quirks(struct psmouse *psmouse) | ||
| 427 | { | ||
| 428 | struct synaptics_data *priv = psmouse->private; | ||
| 429 | int i; | ||
| 430 | |||
| 431 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { | ||
| 432 | if (!psmouse_matches_pnp_id(psmouse, | ||
| 433 | min_max_pnpid_table[i].pnp_ids)) | ||
| 434 | continue; | ||
| 435 | |||
| 436 | if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID && | ||
| 437 | priv->board_id < min_max_pnpid_table[i].board_id.min) | ||
| 438 | continue; | ||
| 439 | |||
| 440 | if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID && | ||
| 441 | priv->board_id > min_max_pnpid_table[i].board_id.max) | ||
| 442 | continue; | ||
| 443 | |||
| 444 | priv->x_min = min_max_pnpid_table[i].x_min; | ||
| 445 | priv->x_max = min_max_pnpid_table[i].x_max; | ||
| 446 | priv->y_min = min_max_pnpid_table[i].y_min; | ||
| 447 | priv->y_max = min_max_pnpid_table[i].y_max; | ||
| 448 | psmouse_info(psmouse, | ||
| 449 | "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n", | ||
| 450 | priv->x_min, priv->x_max, | ||
| 451 | priv->y_min, priv->y_max); | ||
| 452 | break; | ||
| 453 | } | ||
| 454 | } | ||
| 455 | |||
| 397 | static int synaptics_query_hardware(struct psmouse *psmouse) | 456 | static int synaptics_query_hardware(struct psmouse *psmouse) |
| 398 | { | 457 | { |
| 399 | if (synaptics_identify(psmouse)) | 458 | if (synaptics_identify(psmouse)) |
| @@ -402,13 +461,15 @@ static int synaptics_query_hardware(struct psmouse *psmouse) | |||
| 402 | return -1; | 461 | return -1; |
| 403 | if (synaptics_firmware_id(psmouse)) | 462 | if (synaptics_firmware_id(psmouse)) |
| 404 | return -1; | 463 | return -1; |
| 405 | if (synaptics_board_id(psmouse)) | 464 | if (synaptics_query_modes(psmouse)) |
| 406 | return -1; | 465 | return -1; |
| 407 | if (synaptics_capability(psmouse)) | 466 | if (synaptics_capability(psmouse)) |
| 408 | return -1; | 467 | return -1; |
| 409 | if (synaptics_resolution(psmouse)) | 468 | if (synaptics_resolution(psmouse)) |
| 410 | return -1; | 469 | return -1; |
| 411 | 470 | ||
| 471 | synaptics_apply_quirks(psmouse); | ||
| 472 | |||
| 412 | return 0; | 473 | return 0; |
| 413 | } | 474 | } |
| 414 | 475 | ||
| @@ -516,18 +577,22 @@ static int synaptics_is_pt_packet(unsigned char *buf) | |||
| 516 | return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; | 577 | return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; |
| 517 | } | 578 | } |
| 518 | 579 | ||
| 519 | static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet) | 580 | static void synaptics_pass_pt_packet(struct psmouse *psmouse, |
| 581 | struct serio *ptport, | ||
| 582 | unsigned char *packet) | ||
| 520 | { | 583 | { |
| 584 | struct synaptics_data *priv = psmouse->private; | ||
| 521 | struct psmouse *child = serio_get_drvdata(ptport); | 585 | struct psmouse *child = serio_get_drvdata(ptport); |
| 522 | 586 | ||
| 523 | if (child && child->state == PSMOUSE_ACTIVATED) { | 587 | if (child && child->state == PSMOUSE_ACTIVATED) { |
| 524 | serio_interrupt(ptport, packet[1], 0); | 588 | serio_interrupt(ptport, packet[1] | priv->pt_buttons, 0); |
| 525 | serio_interrupt(ptport, packet[4], 0); | 589 | serio_interrupt(ptport, packet[4], 0); |
| 526 | serio_interrupt(ptport, packet[5], 0); | 590 | serio_interrupt(ptport, packet[5], 0); |
| 527 | if (child->pktsize == 4) | 591 | if (child->pktsize == 4) |
| 528 | serio_interrupt(ptport, packet[2], 0); | 592 | serio_interrupt(ptport, packet[2], 0); |
| 529 | } else | 593 | } else { |
| 530 | serio_interrupt(ptport, packet[1], 0); | 594 | serio_interrupt(ptport, packet[1], 0); |
| 595 | } | ||
| 531 | } | 596 | } |
| 532 | 597 | ||
| 533 | static void synaptics_pt_activate(struct psmouse *psmouse) | 598 | static void synaptics_pt_activate(struct psmouse *psmouse) |
| @@ -605,6 +670,18 @@ static void synaptics_parse_agm(const unsigned char buf[], | |||
| 605 | } | 670 | } |
| 606 | } | 671 | } |
| 607 | 672 | ||
| 673 | static void synaptics_parse_ext_buttons(const unsigned char buf[], | ||
| 674 | struct synaptics_data *priv, | ||
| 675 | struct synaptics_hw_state *hw) | ||
| 676 | { | ||
| 677 | unsigned int ext_bits = | ||
| 678 | (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1; | ||
| 679 | unsigned int ext_mask = GENMASK(ext_bits - 1, 0); | ||
| 680 | |||
| 681 | hw->ext_buttons = buf[4] & ext_mask; | ||
| 682 | hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits; | ||
| 683 | } | ||
| 684 | |||
| 608 | static bool is_forcepad; | 685 | static bool is_forcepad; |
| 609 | 686 | ||
| 610 | static int synaptics_parse_hw_state(const unsigned char buf[], | 687 | static int synaptics_parse_hw_state(const unsigned char buf[], |
| @@ -691,28 +768,9 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
| 691 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; | 768 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; |
| 692 | } | 769 | } |
| 693 | 770 | ||
| 694 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && | 771 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 0 && |
| 695 | ((buf[0] ^ buf[3]) & 0x02)) { | 772 | ((buf[0] ^ buf[3]) & 0x02)) { |
| 696 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { | 773 | synaptics_parse_ext_buttons(buf, priv, hw); |
| 697 | default: | ||
| 698 | /* | ||
| 699 | * if nExtBtn is greater than 8 it should be | ||
| 700 | * considered invalid and treated as 0 | ||
| 701 | */ | ||
| 702 | break; | ||
| 703 | case 8: | ||
| 704 | hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0; | ||
| 705 | hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0; | ||
| 706 | case 6: | ||
| 707 | hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0; | ||
| 708 | hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0; | ||
| 709 | case 4: | ||
| 710 | hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0; | ||
| 711 | hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0; | ||
| 712 | case 2: | ||
| 713 | hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0; | ||
| 714 | hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0; | ||
| 715 | } | ||
| 716 | } | 774 | } |
| 717 | } else { | 775 | } else { |
| 718 | hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); | 776 | hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); |
| @@ -774,12 +832,54 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev, | |||
| 774 | } | 832 | } |
| 775 | } | 833 | } |
| 776 | 834 | ||
| 835 | static void synaptics_report_ext_buttons(struct psmouse *psmouse, | ||
| 836 | const struct synaptics_hw_state *hw) | ||
| 837 | { | ||
| 838 | struct input_dev *dev = psmouse->dev; | ||
| 839 | struct synaptics_data *priv = psmouse->private; | ||
| 840 | int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1; | ||
| 841 | char buf[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
| 842 | int i; | ||
| 843 | |||
| 844 | if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap)) | ||
| 845 | return; | ||
| 846 | |||
| 847 | /* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */ | ||
| 848 | if (SYN_ID_FULL(priv->identity) == 0x801 && | ||
| 849 | !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02)) | ||
| 850 | return; | ||
| 851 | |||
| 852 | if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10)) { | ||
| 853 | for (i = 0; i < ext_bits; i++) { | ||
| 854 | input_report_key(dev, BTN_0 + 2 * i, | ||
| 855 | hw->ext_buttons & (1 << i)); | ||
| 856 | input_report_key(dev, BTN_1 + 2 * i, | ||
| 857 | hw->ext_buttons & (1 << (i + ext_bits))); | ||
| 858 | } | ||
| 859 | return; | ||
| 860 | } | ||
| 861 | |||
| 862 | /* | ||
| 863 | * This generation of touchpads has the trackstick buttons | ||
| 864 | * physically wired to the touchpad. Re-route them through | ||
| 865 | * the pass-through interface. | ||
| 866 | */ | ||
| 867 | if (!priv->pt_port) | ||
| 868 | return; | ||
| 869 | |||
| 870 | /* The trackstick expects at most 3 buttons */ | ||
| 871 | priv->pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) | | ||
| 872 | SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 | | ||
| 873 | SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2; | ||
| 874 | |||
| 875 | synaptics_pass_pt_packet(psmouse, priv->pt_port, buf); | ||
| 876 | } | ||
| 877 | |||
| 777 | static void synaptics_report_buttons(struct psmouse *psmouse, | 878 | static void synaptics_report_buttons(struct psmouse *psmouse, |
| 778 | const struct synaptics_hw_state *hw) | 879 | const struct synaptics_hw_state *hw) |
| 779 | { | 880 | { |
| 780 | struct input_dev *dev = psmouse->dev; | 881 | struct input_dev *dev = psmouse->dev; |
| 781 | struct synaptics_data *priv = psmouse->private; | 882 | struct synaptics_data *priv = psmouse->private; |
| 782 | int i; | ||
| 783 | 883 | ||
| 784 | input_report_key(dev, BTN_LEFT, hw->left); | 884 | input_report_key(dev, BTN_LEFT, hw->left); |
| 785 | input_report_key(dev, BTN_RIGHT, hw->right); | 885 | input_report_key(dev, BTN_RIGHT, hw->right); |
| @@ -792,8 +892,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse, | |||
| 792 | input_report_key(dev, BTN_BACK, hw->down); | 892 | input_report_key(dev, BTN_BACK, hw->down); |
| 793 | } | 893 | } |
| 794 | 894 | ||
| 795 | for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) | 895 | synaptics_report_ext_buttons(psmouse, hw); |
| 796 | input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i)); | ||
| 797 | } | 896 | } |
| 798 | 897 | ||
| 799 | static void synaptics_report_mt_data(struct psmouse *psmouse, | 898 | static void synaptics_report_mt_data(struct psmouse *psmouse, |
| @@ -813,7 +912,7 @@ static void synaptics_report_mt_data(struct psmouse *psmouse, | |||
| 813 | pos[i].y = synaptics_invert_y(hw[i]->y); | 912 | pos[i].y = synaptics_invert_y(hw[i]->y); |
| 814 | } | 913 | } |
| 815 | 914 | ||
| 816 | input_mt_assign_slots(dev, slot, pos, nsemi, DMAX * priv->x_res); | 915 | input_mt_assign_slots(dev, slot, pos, nsemi, 0); |
| 817 | 916 | ||
| 818 | for (i = 0; i < nsemi; i++) { | 917 | for (i = 0; i < nsemi; i++) { |
| 819 | input_mt_slot(dev, slot[i]); | 918 | input_mt_slot(dev, slot[i]); |
| @@ -1014,7 +1113,8 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse) | |||
| 1014 | if (SYN_CAP_PASS_THROUGH(priv->capabilities) && | 1113 | if (SYN_CAP_PASS_THROUGH(priv->capabilities) && |
| 1015 | synaptics_is_pt_packet(psmouse->packet)) { | 1114 | synaptics_is_pt_packet(psmouse->packet)) { |
| 1016 | if (priv->pt_port) | 1115 | if (priv->pt_port) |
| 1017 | synaptics_pass_pt_packet(priv->pt_port, psmouse->packet); | 1116 | synaptics_pass_pt_packet(psmouse, priv->pt_port, |
| 1117 | psmouse->packet); | ||
| 1018 | } else | 1118 | } else |
| 1019 | synaptics_process_packet(psmouse); | 1119 | synaptics_process_packet(psmouse); |
| 1020 | 1120 | ||
| @@ -1116,8 +1216,9 @@ static void set_input_params(struct psmouse *psmouse, | |||
| 1116 | __set_bit(BTN_BACK, dev->keybit); | 1216 | __set_bit(BTN_BACK, dev->keybit); |
| 1117 | } | 1217 | } |
| 1118 | 1218 | ||
| 1119 | for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) | 1219 | if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10)) |
| 1120 | __set_bit(BTN_0 + i, dev->keybit); | 1220 | for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) |
| 1221 | __set_bit(BTN_0 + i, dev->keybit); | ||
| 1121 | 1222 | ||
| 1122 | __clear_bit(EV_REL, dev->evbit); | 1223 | __clear_bit(EV_REL, dev->evbit); |
| 1123 | __clear_bit(REL_X, dev->relbit); | 1224 | __clear_bit(REL_X, dev->relbit); |
| @@ -1125,7 +1226,8 @@ static void set_input_params(struct psmouse *psmouse, | |||
| 1125 | 1226 | ||
| 1126 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 1227 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
| 1127 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | 1228 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
| 1128 | if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids)) | 1229 | if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) && |
| 1230 | !SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10)) | ||
| 1129 | __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); | 1231 | __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); |
| 1130 | /* Clickpads report only left button */ | 1232 | /* Clickpads report only left button */ |
| 1131 | __clear_bit(BTN_RIGHT, dev->keybit); | 1233 | __clear_bit(BTN_RIGHT, dev->keybit); |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index aedc3299b14e..ee4bd0d12b26 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #define SYN_QUE_EXT_CAPAB_0C 0x0c | 22 | #define SYN_QUE_EXT_CAPAB_0C 0x0c |
| 23 | #define SYN_QUE_EXT_MAX_COORDS 0x0d | 23 | #define SYN_QUE_EXT_MAX_COORDS 0x0d |
| 24 | #define SYN_QUE_EXT_MIN_COORDS 0x0f | 24 | #define SYN_QUE_EXT_MIN_COORDS 0x0f |
| 25 | #define SYN_QUE_MEXT_CAPAB_10 0x10 | ||
| 25 | 26 | ||
| 26 | /* synatics modes */ | 27 | /* synatics modes */ |
| 27 | #define SYN_BIT_ABSOLUTE_MODE (1 << 7) | 28 | #define SYN_BIT_ABSOLUTE_MODE (1 << 7) |
| @@ -53,6 +54,7 @@ | |||
| 53 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) | 54 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) |
| 54 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) | 55 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
| 55 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) | 56 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) |
| 57 | #define SYN_MEXT_CAP_BIT(m) ((m) & (1 << 1)) | ||
| 56 | 58 | ||
| 57 | /* | 59 | /* |
| 58 | * The following describes response for the 0x0c query. | 60 | * The following describes response for the 0x0c query. |
| @@ -89,6 +91,30 @@ | |||
| 89 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) | 91 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) |
| 90 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) | 92 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) |
| 91 | 93 | ||
| 94 | /* | ||
| 95 | * The following descibes response for the 0x10 query. | ||
| 96 | * | ||
| 97 | * byte mask name meaning | ||
| 98 | * ---- ---- ------- ------------ | ||
| 99 | * 1 0x01 ext buttons are stick buttons exported in the extended | ||
| 100 | * capability are actually meant to be used | ||
| 101 | * by the tracktick (pass-through). | ||
| 102 | * 1 0x02 SecurePad the touchpad is a SecurePad, so it | ||
| 103 | * contains a built-in fingerprint reader. | ||
| 104 | * 1 0xe0 more ext count how many more extented queries are | ||
| 105 | * available after this one. | ||
| 106 | * 2 0xff SecurePad width the width of the SecurePad fingerprint | ||
| 107 | * reader. | ||
| 108 | * 3 0xff SecurePad height the height of the SecurePad fingerprint | ||
| 109 | * reader. | ||
| 110 | */ | ||
| 111 | #define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000) | ||
| 112 | #define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000) | ||
| 113 | |||
| 114 | #define SYN_CAP_EXT_BUTTON_STICK_L(eb) (!!((eb) & 0x01)) | ||
| 115 | #define SYN_CAP_EXT_BUTTON_STICK_M(eb) (!!((eb) & 0x02)) | ||
| 116 | #define SYN_CAP_EXT_BUTTON_STICK_R(eb) (!!((eb) & 0x04)) | ||
| 117 | |||
| 92 | /* synaptics modes query bits */ | 118 | /* synaptics modes query bits */ |
| 93 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) | 119 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) |
| 94 | #define SYN_MODE_RATE(m) ((m) & (1 << 6)) | 120 | #define SYN_MODE_RATE(m) ((m) & (1 << 6)) |
| @@ -143,6 +169,7 @@ struct synaptics_data { | |||
| 143 | unsigned long int capabilities; /* Capabilities */ | 169 | unsigned long int capabilities; /* Capabilities */ |
| 144 | unsigned long int ext_cap; /* Extended Capabilities */ | 170 | unsigned long int ext_cap; /* Extended Capabilities */ |
| 145 | unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ | 171 | unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ |
| 172 | unsigned long int ext_cap_10; /* Ext Caps from 0x10 query */ | ||
| 146 | unsigned long int identity; /* Identification */ | 173 | unsigned long int identity; /* Identification */ |
| 147 | unsigned int x_res, y_res; /* X/Y resolution in units/mm */ | 174 | unsigned int x_res, y_res; /* X/Y resolution in units/mm */ |
| 148 | unsigned int x_max, y_max; /* Max coordinates (from FW) */ | 175 | unsigned int x_max, y_max; /* Max coordinates (from FW) */ |
| @@ -156,6 +183,7 @@ struct synaptics_data { | |||
| 156 | bool disable_gesture; /* disable gestures */ | 183 | bool disable_gesture; /* disable gestures */ |
| 157 | 184 | ||
| 158 | struct serio *pt_port; /* Pass-through serio port */ | 185 | struct serio *pt_port; /* Pass-through serio port */ |
| 186 | unsigned char pt_buttons; /* Pass-through buttons */ | ||
| 159 | 187 | ||
| 160 | /* | 188 | /* |
| 161 | * Last received Advanced Gesture Mode (AGM) packet. An AGM packet | 189 | * Last received Advanced Gesture Mode (AGM) packet. An AGM packet |
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c index 6a7447c304ac..358a574d9e8b 100644 --- a/drivers/isdn/icn/icn.c +++ b/drivers/isdn/icn/icn.c | |||
| @@ -1609,7 +1609,7 @@ icn_setup(char *line) | |||
| 1609 | if (ints[0] > 1) | 1609 | if (ints[0] > 1) |
| 1610 | membase = (unsigned long)ints[2]; | 1610 | membase = (unsigned long)ints[2]; |
| 1611 | if (str && *str) { | 1611 | if (str && *str) { |
| 1612 | strcpy(sid, str); | 1612 | strlcpy(sid, str, sizeof(sid)); |
| 1613 | icn_id = sid; | 1613 | icn_id = sid; |
| 1614 | if ((p = strchr(sid, ','))) { | 1614 | if ((p = strchr(sid, ','))) { |
| 1615 | *p++ = 0; | 1615 | *p++ = 0; |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 37de0173b6d2..74adcd2c967e 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
| @@ -289,9 +289,16 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, | |||
| 289 | struct request_queue *q = bdev_get_queue(where->bdev); | 289 | struct request_queue *q = bdev_get_queue(where->bdev); |
| 290 | unsigned short logical_block_size = queue_logical_block_size(q); | 290 | unsigned short logical_block_size = queue_logical_block_size(q); |
| 291 | sector_t num_sectors; | 291 | sector_t num_sectors; |
| 292 | unsigned int uninitialized_var(special_cmd_max_sectors); | ||
| 292 | 293 | ||
| 293 | /* Reject unsupported discard requests */ | 294 | /* |
| 294 | if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) { | 295 | * Reject unsupported discard and write same requests. |
| 296 | */ | ||
| 297 | if (rw & REQ_DISCARD) | ||
| 298 | special_cmd_max_sectors = q->limits.max_discard_sectors; | ||
| 299 | else if (rw & REQ_WRITE_SAME) | ||
| 300 | special_cmd_max_sectors = q->limits.max_write_same_sectors; | ||
| 301 | if ((rw & (REQ_DISCARD | REQ_WRITE_SAME)) && special_cmd_max_sectors == 0) { | ||
| 295 | dec_count(io, region, -EOPNOTSUPP); | 302 | dec_count(io, region, -EOPNOTSUPP); |
| 296 | return; | 303 | return; |
| 297 | } | 304 | } |
| @@ -317,7 +324,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, | |||
| 317 | store_io_and_region_in_bio(bio, io, region); | 324 | store_io_and_region_in_bio(bio, io, region); |
| 318 | 325 | ||
| 319 | if (rw & REQ_DISCARD) { | 326 | if (rw & REQ_DISCARD) { |
| 320 | num_sectors = min_t(sector_t, q->limits.max_discard_sectors, remaining); | 327 | num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining); |
| 321 | bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; | 328 | bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; |
| 322 | remaining -= num_sectors; | 329 | remaining -= num_sectors; |
| 323 | } else if (rw & REQ_WRITE_SAME) { | 330 | } else if (rw & REQ_WRITE_SAME) { |
| @@ -326,7 +333,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, | |||
| 326 | */ | 333 | */ |
| 327 | dp->get_page(dp, &page, &len, &offset); | 334 | dp->get_page(dp, &page, &len, &offset); |
| 328 | bio_add_page(bio, page, logical_block_size, offset); | 335 | bio_add_page(bio, page, logical_block_size, offset); |
| 329 | num_sectors = min_t(sector_t, q->limits.max_write_same_sectors, remaining); | 336 | num_sectors = min_t(sector_t, special_cmd_max_sectors, remaining); |
| 330 | bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; | 337 | bio->bi_iter.bi_size = num_sectors << SECTOR_SHIFT; |
| 331 | 338 | ||
| 332 | offset = 0; | 339 | offset = 0; |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 8b204ae216ab..f83a0f3fc365 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
| 21 | #include <linux/dm-kcopyd.h> | 21 | #include <linux/dm-kcopyd.h> |
| 22 | 22 | ||
| 23 | #include "dm.h" | ||
| 24 | |||
| 23 | #include "dm-exception-store.h" | 25 | #include "dm-exception-store.h" |
| 24 | 26 | ||
| 25 | #define DM_MSG_PREFIX "snapshots" | 27 | #define DM_MSG_PREFIX "snapshots" |
| @@ -291,12 +293,23 @@ struct origin { | |||
| 291 | }; | 293 | }; |
| 292 | 294 | ||
| 293 | /* | 295 | /* |
| 296 | * This structure is allocated for each origin target | ||
| 297 | */ | ||
| 298 | struct dm_origin { | ||
| 299 | struct dm_dev *dev; | ||
| 300 | struct dm_target *ti; | ||
| 301 | unsigned split_boundary; | ||
| 302 | struct list_head hash_list; | ||
| 303 | }; | ||
| 304 | |||
| 305 | /* | ||
| 294 | * Size of the hash table for origin volumes. If we make this | 306 | * Size of the hash table for origin volumes. If we make this |
| 295 | * the size of the minors list then it should be nearly perfect | 307 | * the size of the minors list then it should be nearly perfect |
| 296 | */ | 308 | */ |
| 297 | #define ORIGIN_HASH_SIZE 256 | 309 | #define ORIGIN_HASH_SIZE 256 |
| 298 | #define ORIGIN_MASK 0xFF | 310 | #define ORIGIN_MASK 0xFF |
| 299 | static struct list_head *_origins; | 311 | static struct list_head *_origins; |
| 312 | static struct list_head *_dm_origins; | ||
| 300 | static struct rw_semaphore _origins_lock; | 313 | static struct rw_semaphore _origins_lock; |
| 301 | 314 | ||
| 302 | static DECLARE_WAIT_QUEUE_HEAD(_pending_exceptions_done); | 315 | static DECLARE_WAIT_QUEUE_HEAD(_pending_exceptions_done); |
| @@ -310,12 +323,22 @@ static int init_origin_hash(void) | |||
| 310 | _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), | 323 | _origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), |
| 311 | GFP_KERNEL); | 324 | GFP_KERNEL); |
| 312 | if (!_origins) { | 325 | if (!_origins) { |
| 313 | DMERR("unable to allocate memory"); | 326 | DMERR("unable to allocate memory for _origins"); |
| 314 | return -ENOMEM; | 327 | return -ENOMEM; |
| 315 | } | 328 | } |
| 316 | |||
| 317 | for (i = 0; i < ORIGIN_HASH_SIZE; i++) | 329 | for (i = 0; i < ORIGIN_HASH_SIZE; i++) |
| 318 | INIT_LIST_HEAD(_origins + i); | 330 | INIT_LIST_HEAD(_origins + i); |
| 331 | |||
| 332 | _dm_origins = kmalloc(ORIGIN_HASH_SIZE * sizeof(struct list_head), | ||
| 333 | GFP_KERNEL); | ||
| 334 | if (!_dm_origins) { | ||
| 335 | DMERR("unable to allocate memory for _dm_origins"); | ||
| 336 | kfree(_origins); | ||
| 337 | return -ENOMEM; | ||
| 338 | } | ||
| 339 | for (i = 0; i < ORIGIN_HASH_SIZE; i++) | ||
| 340 | INIT_LIST_HEAD(_dm_origins + i); | ||
| 341 | |||
| 319 | init_rwsem(&_origins_lock); | 342 | init_rwsem(&_origins_lock); |
| 320 | 343 | ||
| 321 | return 0; | 344 | return 0; |
| @@ -324,6 +347,7 @@ static int init_origin_hash(void) | |||
| 324 | static void exit_origin_hash(void) | 347 | static void exit_origin_hash(void) |
| 325 | { | 348 | { |
| 326 | kfree(_origins); | 349 | kfree(_origins); |
| 350 | kfree(_dm_origins); | ||
| 327 | } | 351 | } |
| 328 | 352 | ||
| 329 | static unsigned origin_hash(struct block_device *bdev) | 353 | static unsigned origin_hash(struct block_device *bdev) |
| @@ -350,6 +374,30 @@ static void __insert_origin(struct origin *o) | |||
| 350 | list_add_tail(&o->hash_list, sl); | 374 | list_add_tail(&o->hash_list, sl); |
| 351 | } | 375 | } |
| 352 | 376 | ||
| 377 | static struct dm_origin *__lookup_dm_origin(struct block_device *origin) | ||
| 378 | { | ||
| 379 | struct list_head *ol; | ||
| 380 | struct dm_origin *o; | ||
| 381 | |||
| 382 | ol = &_dm_origins[origin_hash(origin)]; | ||
| 383 | list_for_each_entry (o, ol, hash_list) | ||
| 384 | if (bdev_equal(o->dev->bdev, origin)) | ||
| 385 | return o; | ||
| 386 | |||
| 387 | return NULL; | ||
| 388 | } | ||
| 389 | |||
| 390 | static void __insert_dm_origin(struct dm_origin *o) | ||
| 391 | { | ||
| 392 | struct list_head *sl = &_dm_origins[origin_hash(o->dev->bdev)]; | ||
| 393 | list_add_tail(&o->hash_list, sl); | ||
| 394 | } | ||
| 395 | |||
| 396 | static void __remove_dm_origin(struct dm_origin *o) | ||
| 397 | { | ||
| 398 | list_del(&o->hash_list); | ||
| 399 | } | ||
| 400 | |||
| 353 | /* | 401 | /* |
| 354 | * _origins_lock must be held when calling this function. | 402 | * _origins_lock must be held when calling this function. |
| 355 | * Returns number of snapshots registered using the supplied cow device, plus: | 403 | * Returns number of snapshots registered using the supplied cow device, plus: |
| @@ -1840,9 +1888,40 @@ static int snapshot_preresume(struct dm_target *ti) | |||
| 1840 | static void snapshot_resume(struct dm_target *ti) | 1888 | static void snapshot_resume(struct dm_target *ti) |
| 1841 | { | 1889 | { |
| 1842 | struct dm_snapshot *s = ti->private; | 1890 | struct dm_snapshot *s = ti->private; |
| 1843 | struct dm_snapshot *snap_src = NULL, *snap_dest = NULL; | 1891 | struct dm_snapshot *snap_src = NULL, *snap_dest = NULL, *snap_merging = NULL; |
| 1892 | struct dm_origin *o; | ||
| 1893 | struct mapped_device *origin_md = NULL; | ||
| 1894 | bool must_restart_merging = false; | ||
| 1844 | 1895 | ||
| 1845 | down_read(&_origins_lock); | 1896 | down_read(&_origins_lock); |
| 1897 | |||
| 1898 | o = __lookup_dm_origin(s->origin->bdev); | ||
| 1899 | if (o) | ||
| 1900 | origin_md = dm_table_get_md(o->ti->table); | ||
| 1901 | if (!origin_md) { | ||
| 1902 | (void) __find_snapshots_sharing_cow(s, NULL, NULL, &snap_merging); | ||
| 1903 | if (snap_merging) | ||
| 1904 | origin_md = dm_table_get_md(snap_merging->ti->table); | ||
| 1905 | } | ||
| 1906 | if (origin_md == dm_table_get_md(ti->table)) | ||
| 1907 | origin_md = NULL; | ||
| 1908 | if (origin_md) { | ||
| 1909 | if (dm_hold(origin_md)) | ||
| 1910 | origin_md = NULL; | ||
| 1911 | } | ||
| 1912 | |||
| 1913 | up_read(&_origins_lock); | ||
| 1914 | |||
| 1915 | if (origin_md) { | ||
| 1916 | dm_internal_suspend_fast(origin_md); | ||
| 1917 | if (snap_merging && test_bit(RUNNING_MERGE, &snap_merging->state_bits)) { | ||
| 1918 | must_restart_merging = true; | ||
| 1919 | stop_merge(snap_merging); | ||
| 1920 | } | ||
| 1921 | } | ||
| 1922 | |||
| 1923 | down_read(&_origins_lock); | ||
| 1924 | |||
| 1846 | (void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL); | 1925 | (void) __find_snapshots_sharing_cow(s, &snap_src, &snap_dest, NULL); |
| 1847 | if (snap_src && snap_dest) { | 1926 | if (snap_src && snap_dest) { |
| 1848 | down_write(&snap_src->lock); | 1927 | down_write(&snap_src->lock); |
| @@ -1851,8 +1930,16 @@ static void snapshot_resume(struct dm_target *ti) | |||
| 1851 | up_write(&snap_dest->lock); | 1930 | up_write(&snap_dest->lock); |
| 1852 | up_write(&snap_src->lock); | 1931 | up_write(&snap_src->lock); |
| 1853 | } | 1932 | } |
| 1933 | |||
| 1854 | up_read(&_origins_lock); | 1934 | up_read(&_origins_lock); |
| 1855 | 1935 | ||
| 1936 | if (origin_md) { | ||
| 1937 | if (must_restart_merging) | ||
| 1938 | start_merge(snap_merging); | ||
| 1939 | dm_internal_resume_fast(origin_md); | ||
| 1940 | dm_put(origin_md); | ||
| 1941 | } | ||
| 1942 | |||
| 1856 | /* Now we have correct chunk size, reregister */ | 1943 | /* Now we have correct chunk size, reregister */ |
| 1857 | reregister_snapshot(s); | 1944 | reregister_snapshot(s); |
| 1858 | 1945 | ||
| @@ -2133,11 +2220,6 @@ static int origin_write_extent(struct dm_snapshot *merging_snap, | |||
| 2133 | * Origin: maps a linear range of a device, with hooks for snapshotting. | 2220 | * Origin: maps a linear range of a device, with hooks for snapshotting. |
| 2134 | */ | 2221 | */ |
| 2135 | 2222 | ||
| 2136 | struct dm_origin { | ||
| 2137 | struct dm_dev *dev; | ||
| 2138 | unsigned split_boundary; | ||
| 2139 | }; | ||
| 2140 | |||
| 2141 | /* | 2223 | /* |
| 2142 | * Construct an origin mapping: <dev_path> | 2224 | * Construct an origin mapping: <dev_path> |
| 2143 | * The context for an origin is merely a 'struct dm_dev *' | 2225 | * The context for an origin is merely a 'struct dm_dev *' |
| @@ -2166,6 +2248,7 @@ static int origin_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 2166 | goto bad_open; | 2248 | goto bad_open; |
| 2167 | } | 2249 | } |
| 2168 | 2250 | ||
| 2251 | o->ti = ti; | ||
| 2169 | ti->private = o; | 2252 | ti->private = o; |
| 2170 | ti->num_flush_bios = 1; | 2253 | ti->num_flush_bios = 1; |
| 2171 | 2254 | ||
| @@ -2180,6 +2263,7 @@ bad_alloc: | |||
| 2180 | static void origin_dtr(struct dm_target *ti) | 2263 | static void origin_dtr(struct dm_target *ti) |
| 2181 | { | 2264 | { |
| 2182 | struct dm_origin *o = ti->private; | 2265 | struct dm_origin *o = ti->private; |
| 2266 | |||
| 2183 | dm_put_device(ti, o->dev); | 2267 | dm_put_device(ti, o->dev); |
| 2184 | kfree(o); | 2268 | kfree(o); |
| 2185 | } | 2269 | } |
| @@ -2216,6 +2300,19 @@ static void origin_resume(struct dm_target *ti) | |||
| 2216 | struct dm_origin *o = ti->private; | 2300 | struct dm_origin *o = ti->private; |
| 2217 | 2301 | ||
| 2218 | o->split_boundary = get_origin_minimum_chunksize(o->dev->bdev); | 2302 | o->split_boundary = get_origin_minimum_chunksize(o->dev->bdev); |
| 2303 | |||
| 2304 | down_write(&_origins_lock); | ||
| 2305 | __insert_dm_origin(o); | ||
| 2306 | up_write(&_origins_lock); | ||
| 2307 | } | ||
| 2308 | |||
| 2309 | static void origin_postsuspend(struct dm_target *ti) | ||
| 2310 | { | ||
| 2311 | struct dm_origin *o = ti->private; | ||
| 2312 | |||
| 2313 | down_write(&_origins_lock); | ||
| 2314 | __remove_dm_origin(o); | ||
| 2315 | up_write(&_origins_lock); | ||
| 2219 | } | 2316 | } |
| 2220 | 2317 | ||
| 2221 | static void origin_status(struct dm_target *ti, status_type_t type, | 2318 | static void origin_status(struct dm_target *ti, status_type_t type, |
| @@ -2258,12 +2355,13 @@ static int origin_iterate_devices(struct dm_target *ti, | |||
| 2258 | 2355 | ||
| 2259 | static struct target_type origin_target = { | 2356 | static struct target_type origin_target = { |
| 2260 | .name = "snapshot-origin", | 2357 | .name = "snapshot-origin", |
| 2261 | .version = {1, 8, 1}, | 2358 | .version = {1, 9, 0}, |
| 2262 | .module = THIS_MODULE, | 2359 | .module = THIS_MODULE, |
| 2263 | .ctr = origin_ctr, | 2360 | .ctr = origin_ctr, |
| 2264 | .dtr = origin_dtr, | 2361 | .dtr = origin_dtr, |
| 2265 | .map = origin_map, | 2362 | .map = origin_map, |
| 2266 | .resume = origin_resume, | 2363 | .resume = origin_resume, |
| 2364 | .postsuspend = origin_postsuspend, | ||
| 2267 | .status = origin_status, | 2365 | .status = origin_status, |
| 2268 | .merge = origin_merge, | 2366 | .merge = origin_merge, |
| 2269 | .iterate_devices = origin_iterate_devices, | 2367 | .iterate_devices = origin_iterate_devices, |
| @@ -2271,7 +2369,7 @@ static struct target_type origin_target = { | |||
| 2271 | 2369 | ||
| 2272 | static struct target_type snapshot_target = { | 2370 | static struct target_type snapshot_target = { |
| 2273 | .name = "snapshot", | 2371 | .name = "snapshot", |
| 2274 | .version = {1, 12, 0}, | 2372 | .version = {1, 13, 0}, |
| 2275 | .module = THIS_MODULE, | 2373 | .module = THIS_MODULE, |
| 2276 | .ctr = snapshot_ctr, | 2374 | .ctr = snapshot_ctr, |
| 2277 | .dtr = snapshot_dtr, | 2375 | .dtr = snapshot_dtr, |
| @@ -2285,7 +2383,7 @@ static struct target_type snapshot_target = { | |||
| 2285 | 2383 | ||
| 2286 | static struct target_type merge_target = { | 2384 | static struct target_type merge_target = { |
| 2287 | .name = dm_snapshot_merge_target_name, | 2385 | .name = dm_snapshot_merge_target_name, |
| 2288 | .version = {1, 2, 0}, | 2386 | .version = {1, 3, 0}, |
| 2289 | .module = THIS_MODULE, | 2387 | .module = THIS_MODULE, |
| 2290 | .ctr = snapshot_ctr, | 2388 | .ctr = snapshot_ctr, |
| 2291 | .dtr = snapshot_dtr, | 2389 | .dtr = snapshot_dtr, |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 654773cb1eee..921aafd12aee 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -2358,17 +2358,6 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
| 2358 | return DM_MAPIO_REMAPPED; | 2358 | return DM_MAPIO_REMAPPED; |
| 2359 | 2359 | ||
| 2360 | case -ENODATA: | 2360 | case -ENODATA: |
| 2361 | if (get_pool_mode(tc->pool) == PM_READ_ONLY) { | ||
| 2362 | /* | ||
| 2363 | * This block isn't provisioned, and we have no way | ||
| 2364 | * of doing so. | ||
| 2365 | */ | ||
| 2366 | handle_unserviceable_bio(tc->pool, bio); | ||
| 2367 | cell_defer_no_holder(tc, virt_cell); | ||
| 2368 | return DM_MAPIO_SUBMITTED; | ||
| 2369 | } | ||
| 2370 | /* fall through */ | ||
| 2371 | |||
| 2372 | case -EWOULDBLOCK: | 2361 | case -EWOULDBLOCK: |
| 2373 | thin_defer_cell(tc, virt_cell); | 2362 | thin_defer_cell(tc, virt_cell); |
| 2374 | return DM_MAPIO_SUBMITTED; | 2363 | return DM_MAPIO_SUBMITTED; |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 73f28802dc7a..9b641b38b857 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -2616,6 +2616,19 @@ void dm_get(struct mapped_device *md) | |||
| 2616 | BUG_ON(test_bit(DMF_FREEING, &md->flags)); | 2616 | BUG_ON(test_bit(DMF_FREEING, &md->flags)); |
| 2617 | } | 2617 | } |
| 2618 | 2618 | ||
| 2619 | int dm_hold(struct mapped_device *md) | ||
| 2620 | { | ||
| 2621 | spin_lock(&_minor_lock); | ||
| 2622 | if (test_bit(DMF_FREEING, &md->flags)) { | ||
| 2623 | spin_unlock(&_minor_lock); | ||
| 2624 | return -EBUSY; | ||
| 2625 | } | ||
| 2626 | dm_get(md); | ||
| 2627 | spin_unlock(&_minor_lock); | ||
| 2628 | return 0; | ||
| 2629 | } | ||
| 2630 | EXPORT_SYMBOL_GPL(dm_hold); | ||
| 2631 | |||
| 2619 | const char *dm_device_name(struct mapped_device *md) | 2632 | const char *dm_device_name(struct mapped_device *md) |
| 2620 | { | 2633 | { |
| 2621 | return md->name; | 2634 | return md->name; |
| @@ -2638,10 +2651,16 @@ static void __dm_destroy(struct mapped_device *md, bool wait) | |||
| 2638 | if (dm_request_based(md)) | 2651 | if (dm_request_based(md)) |
| 2639 | flush_kthread_worker(&md->kworker); | 2652 | flush_kthread_worker(&md->kworker); |
| 2640 | 2653 | ||
| 2654 | /* | ||
| 2655 | * Take suspend_lock so that presuspend and postsuspend methods | ||
| 2656 | * do not race with internal suspend. | ||
| 2657 | */ | ||
| 2658 | mutex_lock(&md->suspend_lock); | ||
| 2641 | if (!dm_suspended_md(md)) { | 2659 | if (!dm_suspended_md(md)) { |
| 2642 | dm_table_presuspend_targets(map); | 2660 | dm_table_presuspend_targets(map); |
| 2643 | dm_table_postsuspend_targets(map); | 2661 | dm_table_postsuspend_targets(map); |
| 2644 | } | 2662 | } |
| 2663 | mutex_unlock(&md->suspend_lock); | ||
| 2645 | 2664 | ||
| 2646 | /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ | 2665 | /* dm_put_live_table must be before msleep, otherwise deadlock is possible */ |
| 2647 | dm_put_live_table(md, srcu_idx); | 2666 | dm_put_live_table(md, srcu_idx); |
| @@ -3115,6 +3134,7 @@ void dm_internal_suspend_fast(struct mapped_device *md) | |||
| 3115 | flush_workqueue(md->wq); | 3134 | flush_workqueue(md->wq); |
| 3116 | dm_wait_for_completion(md, TASK_UNINTERRUPTIBLE); | 3135 | dm_wait_for_completion(md, TASK_UNINTERRUPTIBLE); |
| 3117 | } | 3136 | } |
| 3137 | EXPORT_SYMBOL_GPL(dm_internal_suspend_fast); | ||
| 3118 | 3138 | ||
| 3119 | void dm_internal_resume_fast(struct mapped_device *md) | 3139 | void dm_internal_resume_fast(struct mapped_device *md) |
| 3120 | { | 3140 | { |
| @@ -3126,6 +3146,7 @@ void dm_internal_resume_fast(struct mapped_device *md) | |||
| 3126 | done: | 3146 | done: |
| 3127 | mutex_unlock(&md->suspend_lock); | 3147 | mutex_unlock(&md->suspend_lock); |
| 3128 | } | 3148 | } |
| 3149 | EXPORT_SYMBOL_GPL(dm_internal_resume_fast); | ||
| 3129 | 3150 | ||
| 3130 | /*----------------------------------------------------------------- | 3151 | /*----------------------------------------------------------------- |
| 3131 | * Event notification. | 3152 | * Event notification. |
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index e9f1d8d84613..c53f14a7ce54 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c | |||
| @@ -124,7 +124,7 @@ int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev) | |||
| 124 | PTR_ERR(pwrseq->reset_gpios[i]) != -ENOSYS) { | 124 | PTR_ERR(pwrseq->reset_gpios[i]) != -ENOSYS) { |
| 125 | ret = PTR_ERR(pwrseq->reset_gpios[i]); | 125 | ret = PTR_ERR(pwrseq->reset_gpios[i]); |
| 126 | 126 | ||
| 127 | while (--i) | 127 | while (i--) |
| 128 | gpiod_put(pwrseq->reset_gpios[i]); | 128 | gpiod_put(pwrseq->reset_gpios[i]); |
| 129 | 129 | ||
| 130 | goto clk_put; | 130 | goto clk_put; |
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index da4c79259f67..16e34b37d134 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
| @@ -425,9 +425,10 @@ retry: | |||
| 425 | ubi_warn(ubi, "corrupted VID header at PEB %d, LEB %d:%d", | 425 | ubi_warn(ubi, "corrupted VID header at PEB %d, LEB %d:%d", |
| 426 | pnum, vol_id, lnum); | 426 | pnum, vol_id, lnum); |
| 427 | err = -EBADMSG; | 427 | err = -EBADMSG; |
| 428 | } else | 428 | } else { |
| 429 | err = -EINVAL; | 429 | err = -EINVAL; |
| 430 | ubi_ro_mode(ubi); | 430 | ubi_ro_mode(ubi); |
| 431 | } | ||
| 431 | } | 432 | } |
| 432 | goto out_free; | 433 | goto out_free; |
| 433 | } else if (err == UBI_IO_BITFLIPS) | 434 | } else if (err == UBI_IO_BITFLIPS) |
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 98d73aab52fe..58808f651452 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig | |||
| @@ -131,7 +131,7 @@ config CAN_RCAR | |||
| 131 | 131 | ||
| 132 | config CAN_XILINXCAN | 132 | config CAN_XILINXCAN |
| 133 | tristate "Xilinx CAN" | 133 | tristate "Xilinx CAN" |
| 134 | depends on ARCH_ZYNQ || MICROBLAZE || COMPILE_TEST | 134 | depends on ARCH_ZYNQ || ARM64 || MICROBLAZE || COMPILE_TEST |
| 135 | depends on COMMON_CLK && HAS_IOMEM | 135 | depends on COMMON_CLK && HAS_IOMEM |
| 136 | ---help--- | 136 | ---help--- |
| 137 | Xilinx CAN driver. This driver supports both soft AXI CAN IP and | 137 | Xilinx CAN driver. This driver supports both soft AXI CAN IP and |
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c index a316fa4b91ab..e97a08ce0b90 100644 --- a/drivers/net/can/usb/kvaser_usb.c +++ b/drivers/net/can/usb/kvaser_usb.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | * Copyright (C) 2015 Valeo S.A. | 14 | * Copyright (C) 2015 Valeo S.A. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include <linux/spinlock.h> | ||
| 17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
| 18 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
| 19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
| @@ -467,10 +468,11 @@ struct kvaser_usb { | |||
| 467 | struct kvaser_usb_net_priv { | 468 | struct kvaser_usb_net_priv { |
| 468 | struct can_priv can; | 469 | struct can_priv can; |
| 469 | 470 | ||
| 470 | atomic_t active_tx_urbs; | 471 | spinlock_t tx_contexts_lock; |
| 471 | struct usb_anchor tx_submitted; | 472 | int active_tx_contexts; |
| 472 | struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS]; | 473 | struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS]; |
| 473 | 474 | ||
| 475 | struct usb_anchor tx_submitted; | ||
| 474 | struct completion start_comp, stop_comp; | 476 | struct completion start_comp, stop_comp; |
| 475 | 477 | ||
| 476 | struct kvaser_usb *dev; | 478 | struct kvaser_usb *dev; |
| @@ -694,6 +696,7 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, | |||
| 694 | struct kvaser_usb_net_priv *priv; | 696 | struct kvaser_usb_net_priv *priv; |
| 695 | struct sk_buff *skb; | 697 | struct sk_buff *skb; |
| 696 | struct can_frame *cf; | 698 | struct can_frame *cf; |
| 699 | unsigned long flags; | ||
| 697 | u8 channel, tid; | 700 | u8 channel, tid; |
| 698 | 701 | ||
| 699 | channel = msg->u.tx_acknowledge_header.channel; | 702 | channel = msg->u.tx_acknowledge_header.channel; |
| @@ -737,12 +740,15 @@ static void kvaser_usb_tx_acknowledge(const struct kvaser_usb *dev, | |||
| 737 | 740 | ||
| 738 | stats->tx_packets++; | 741 | stats->tx_packets++; |
| 739 | stats->tx_bytes += context->dlc; | 742 | stats->tx_bytes += context->dlc; |
| 740 | can_get_echo_skb(priv->netdev, context->echo_index); | ||
| 741 | 743 | ||
| 742 | context->echo_index = MAX_TX_URBS; | 744 | spin_lock_irqsave(&priv->tx_contexts_lock, flags); |
| 743 | atomic_dec(&priv->active_tx_urbs); | ||
| 744 | 745 | ||
| 746 | can_get_echo_skb(priv->netdev, context->echo_index); | ||
| 747 | context->echo_index = MAX_TX_URBS; | ||
| 748 | --priv->active_tx_contexts; | ||
| 745 | netif_wake_queue(priv->netdev); | 749 | netif_wake_queue(priv->netdev); |
| 750 | |||
| 751 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); | ||
| 746 | } | 752 | } |
| 747 | 753 | ||
| 748 | static void kvaser_usb_simple_msg_callback(struct urb *urb) | 754 | static void kvaser_usb_simple_msg_callback(struct urb *urb) |
| @@ -803,17 +809,6 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, | |||
| 803 | return 0; | 809 | return 0; |
| 804 | } | 810 | } |
| 805 | 811 | ||
| 806 | static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) | ||
| 807 | { | ||
| 808 | int i; | ||
| 809 | |||
| 810 | usb_kill_anchored_urbs(&priv->tx_submitted); | ||
| 811 | atomic_set(&priv->active_tx_urbs, 0); | ||
| 812 | |||
| 813 | for (i = 0; i < MAX_TX_URBS; i++) | ||
| 814 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | ||
| 815 | } | ||
| 816 | |||
| 817 | static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv *priv, | 812 | static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv *priv, |
| 818 | const struct kvaser_usb_error_summary *es, | 813 | const struct kvaser_usb_error_summary *es, |
| 819 | struct can_frame *cf) | 814 | struct can_frame *cf) |
| @@ -1515,6 +1510,24 @@ error: | |||
| 1515 | return err; | 1510 | return err; |
| 1516 | } | 1511 | } |
| 1517 | 1512 | ||
| 1513 | static void kvaser_usb_reset_tx_urb_contexts(struct kvaser_usb_net_priv *priv) | ||
| 1514 | { | ||
| 1515 | int i; | ||
| 1516 | |||
| 1517 | priv->active_tx_contexts = 0; | ||
| 1518 | for (i = 0; i < MAX_TX_URBS; i++) | ||
| 1519 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | ||
| 1520 | } | ||
| 1521 | |||
| 1522 | /* This method might sleep. Do not call it in the atomic context | ||
| 1523 | * of URB completions. | ||
| 1524 | */ | ||
| 1525 | static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv) | ||
| 1526 | { | ||
| 1527 | usb_kill_anchored_urbs(&priv->tx_submitted); | ||
| 1528 | kvaser_usb_reset_tx_urb_contexts(priv); | ||
| 1529 | } | ||
| 1530 | |||
| 1518 | static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) | 1531 | static void kvaser_usb_unlink_all_urbs(struct kvaser_usb *dev) |
| 1519 | { | 1532 | { |
| 1520 | int i; | 1533 | int i; |
| @@ -1634,6 +1647,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1634 | struct kvaser_msg *msg; | 1647 | struct kvaser_msg *msg; |
| 1635 | int i, err, ret = NETDEV_TX_OK; | 1648 | int i, err, ret = NETDEV_TX_OK; |
| 1636 | u8 *msg_tx_can_flags = NULL; /* GCC */ | 1649 | u8 *msg_tx_can_flags = NULL; /* GCC */ |
| 1650 | unsigned long flags; | ||
| 1637 | 1651 | ||
| 1638 | if (can_dropped_invalid_skb(netdev, skb)) | 1652 | if (can_dropped_invalid_skb(netdev, skb)) |
| 1639 | return NETDEV_TX_OK; | 1653 | return NETDEV_TX_OK; |
| @@ -1687,12 +1701,21 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1687 | if (cf->can_id & CAN_RTR_FLAG) | 1701 | if (cf->can_id & CAN_RTR_FLAG) |
| 1688 | *msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME; | 1702 | *msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME; |
| 1689 | 1703 | ||
| 1704 | spin_lock_irqsave(&priv->tx_contexts_lock, flags); | ||
| 1690 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { | 1705 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) { |
| 1691 | if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { | 1706 | if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { |
| 1692 | context = &priv->tx_contexts[i]; | 1707 | context = &priv->tx_contexts[i]; |
| 1708 | |||
| 1709 | context->echo_index = i; | ||
| 1710 | can_put_echo_skb(skb, netdev, context->echo_index); | ||
| 1711 | ++priv->active_tx_contexts; | ||
| 1712 | if (priv->active_tx_contexts >= MAX_TX_URBS) | ||
| 1713 | netif_stop_queue(netdev); | ||
| 1714 | |||
| 1693 | break; | 1715 | break; |
| 1694 | } | 1716 | } |
| 1695 | } | 1717 | } |
| 1718 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); | ||
| 1696 | 1719 | ||
| 1697 | /* This should never happen; it implies a flow control bug */ | 1720 | /* This should never happen; it implies a flow control bug */ |
| 1698 | if (!context) { | 1721 | if (!context) { |
| @@ -1704,7 +1727,6 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1704 | } | 1727 | } |
| 1705 | 1728 | ||
| 1706 | context->priv = priv; | 1729 | context->priv = priv; |
| 1707 | context->echo_index = i; | ||
| 1708 | context->dlc = cf->can_dlc; | 1730 | context->dlc = cf->can_dlc; |
| 1709 | 1731 | ||
| 1710 | msg->u.tx_can.tid = context->echo_index; | 1732 | msg->u.tx_can.tid = context->echo_index; |
| @@ -1716,18 +1738,17 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, | |||
| 1716 | kvaser_usb_write_bulk_callback, context); | 1738 | kvaser_usb_write_bulk_callback, context); |
| 1717 | usb_anchor_urb(urb, &priv->tx_submitted); | 1739 | usb_anchor_urb(urb, &priv->tx_submitted); |
| 1718 | 1740 | ||
| 1719 | can_put_echo_skb(skb, netdev, context->echo_index); | ||
| 1720 | |||
| 1721 | atomic_inc(&priv->active_tx_urbs); | ||
| 1722 | |||
| 1723 | if (atomic_read(&priv->active_tx_urbs) >= MAX_TX_URBS) | ||
| 1724 | netif_stop_queue(netdev); | ||
| 1725 | |||
| 1726 | err = usb_submit_urb(urb, GFP_ATOMIC); | 1741 | err = usb_submit_urb(urb, GFP_ATOMIC); |
| 1727 | if (unlikely(err)) { | 1742 | if (unlikely(err)) { |
| 1743 | spin_lock_irqsave(&priv->tx_contexts_lock, flags); | ||
| 1744 | |||
| 1728 | can_free_echo_skb(netdev, context->echo_index); | 1745 | can_free_echo_skb(netdev, context->echo_index); |
| 1746 | context->echo_index = MAX_TX_URBS; | ||
| 1747 | --priv->active_tx_contexts; | ||
| 1748 | netif_wake_queue(netdev); | ||
| 1749 | |||
| 1750 | spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); | ||
| 1729 | 1751 | ||
| 1730 | atomic_dec(&priv->active_tx_urbs); | ||
| 1731 | usb_unanchor_urb(urb); | 1752 | usb_unanchor_urb(urb); |
| 1732 | 1753 | ||
| 1733 | stats->tx_dropped++; | 1754 | stats->tx_dropped++; |
| @@ -1854,7 +1875,7 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
| 1854 | struct kvaser_usb *dev = usb_get_intfdata(intf); | 1875 | struct kvaser_usb *dev = usb_get_intfdata(intf); |
| 1855 | struct net_device *netdev; | 1876 | struct net_device *netdev; |
| 1856 | struct kvaser_usb_net_priv *priv; | 1877 | struct kvaser_usb_net_priv *priv; |
| 1857 | int i, err; | 1878 | int err; |
| 1858 | 1879 | ||
| 1859 | err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); | 1880 | err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, channel); |
| 1860 | if (err) | 1881 | if (err) |
| @@ -1868,19 +1889,17 @@ static int kvaser_usb_init_one(struct usb_interface *intf, | |||
| 1868 | 1889 | ||
| 1869 | priv = netdev_priv(netdev); | 1890 | priv = netdev_priv(netdev); |
| 1870 | 1891 | ||
| 1892 | init_usb_anchor(&priv->tx_submitted); | ||
| 1871 | init_completion(&priv->start_comp); | 1893 | init_completion(&priv->start_comp); |
| 1872 | init_completion(&priv->stop_comp); | 1894 | init_completion(&priv->stop_comp); |
| 1873 | 1895 | ||
| 1874 | init_usb_anchor(&priv->tx_submitted); | ||
| 1875 | atomic_set(&priv->active_tx_urbs, 0); | ||
| 1876 | |||
| 1877 | for (i = 0; i < ARRAY_SIZE(priv->tx_contexts); i++) | ||
| 1878 | priv->tx_contexts[i].echo_index = MAX_TX_URBS; | ||
| 1879 | |||
| 1880 | priv->dev = dev; | 1896 | priv->dev = dev; |
| 1881 | priv->netdev = netdev; | 1897 | priv->netdev = netdev; |
| 1882 | priv->channel = channel; | 1898 | priv->channel = channel; |
| 1883 | 1899 | ||
| 1900 | spin_lock_init(&priv->tx_contexts_lock); | ||
| 1901 | kvaser_usb_reset_tx_urb_contexts(priv); | ||
| 1902 | |||
| 1884 | priv->can.state = CAN_STATE_STOPPED; | 1903 | priv->can.state = CAN_STATE_STOPPED; |
| 1885 | priv->can.clock.freq = CAN_USB_CLOCK; | 1904 | priv->can.clock.freq = CAN_USB_CLOCK; |
| 1886 | priv->can.bittiming_const = &kvaser_usb_bittiming_const; | 1905 | priv->can.bittiming_const = &kvaser_usb_bittiming_const; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index bef750a09027..996e215fc324 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -12769,7 +12769,7 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, | |||
| 12769 | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | | 12769 | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | |
| 12770 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | | 12770 | NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO | |
| 12771 | NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; | 12771 | NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX; |
| 12772 | if (!CHIP_IS_E1x(bp)) { | 12772 | if (!chip_is_e1x) { |
| 12773 | dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL | | 12773 | dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL | |
| 12774 | NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT; | 12774 | NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT; |
| 12775 | dev->hw_enc_features = | 12775 | dev->hw_enc_features = |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 853c38997c82..1abdfa123c6c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
| @@ -1120,7 +1120,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, | |||
| 1120 | } | 1120 | } |
| 1121 | 1121 | ||
| 1122 | /* Installed successfully, update the cached header too. */ | 1122 | /* Installed successfully, update the cached header too. */ |
| 1123 | memcpy(card_fw, fs_fw, sizeof(*card_fw)); | 1123 | *card_fw = *fs_fw; |
| 1124 | card_fw_usable = 1; | 1124 | card_fw_usable = 1; |
| 1125 | *reset = 0; /* already reset as part of load_fw */ | 1125 | *reset = 0; /* already reset as part of load_fw */ |
| 1126 | } | 1126 | } |
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c index 3b42556f7f8d..ed41559bae77 100644 --- a/drivers/net/ethernet/dec/tulip/tulip_core.c +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c | |||
| @@ -589,7 +589,7 @@ static void tulip_tx_timeout(struct net_device *dev) | |||
| 589 | (unsigned int)tp->rx_ring[i].buffer1, | 589 | (unsigned int)tp->rx_ring[i].buffer1, |
| 590 | (unsigned int)tp->rx_ring[i].buffer2, | 590 | (unsigned int)tp->rx_ring[i].buffer2, |
| 591 | buf[0], buf[1], buf[2]); | 591 | buf[0], buf[1], buf[2]); |
| 592 | for (j = 0; buf[j] != 0xee && j < 1600; j++) | 592 | for (j = 0; ((j < 1600) && buf[j] != 0xee); j++) |
| 593 | if (j < 100) | 593 | if (j < 100) |
| 594 | pr_cont(" %02x", buf[j]); | 594 | pr_cont(" %02x", buf[j]); |
| 595 | pr_cont(" j=%d\n", j); | 595 | pr_cont(" j=%d\n", j); |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 99492b7e3713..78e1ce09b1ab 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
| @@ -1189,13 +1189,12 @@ static void | |||
| 1189 | fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) | 1189 | fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) |
| 1190 | { | 1190 | { |
| 1191 | struct fec_enet_private *fep; | 1191 | struct fec_enet_private *fep; |
| 1192 | struct bufdesc *bdp, *bdp_t; | 1192 | struct bufdesc *bdp; |
| 1193 | unsigned short status; | 1193 | unsigned short status; |
| 1194 | struct sk_buff *skb; | 1194 | struct sk_buff *skb; |
| 1195 | struct fec_enet_priv_tx_q *txq; | 1195 | struct fec_enet_priv_tx_q *txq; |
| 1196 | struct netdev_queue *nq; | 1196 | struct netdev_queue *nq; |
| 1197 | int index = 0; | 1197 | int index = 0; |
| 1198 | int i, bdnum; | ||
| 1199 | int entries_free; | 1198 | int entries_free; |
| 1200 | 1199 | ||
| 1201 | fep = netdev_priv(ndev); | 1200 | fep = netdev_priv(ndev); |
| @@ -1216,29 +1215,18 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) | |||
| 1216 | if (bdp == txq->cur_tx) | 1215 | if (bdp == txq->cur_tx) |
| 1217 | break; | 1216 | break; |
| 1218 | 1217 | ||
| 1219 | bdp_t = bdp; | 1218 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp, fep); |
| 1220 | bdnum = 1; | ||
| 1221 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep); | ||
| 1222 | skb = txq->tx_skbuff[index]; | ||
| 1223 | while (!skb) { | ||
| 1224 | bdp_t = fec_enet_get_nextdesc(bdp_t, fep, queue_id); | ||
| 1225 | index = fec_enet_get_bd_index(txq->tx_bd_base, bdp_t, fep); | ||
| 1226 | skb = txq->tx_skbuff[index]; | ||
| 1227 | bdnum++; | ||
| 1228 | } | ||
| 1229 | if (skb_shinfo(skb)->nr_frags && | ||
| 1230 | (status = bdp_t->cbd_sc) & BD_ENET_TX_READY) | ||
| 1231 | break; | ||
| 1232 | 1219 | ||
| 1233 | for (i = 0; i < bdnum; i++) { | 1220 | skb = txq->tx_skbuff[index]; |
| 1234 | if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) | ||
| 1235 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
| 1236 | bdp->cbd_datlen, DMA_TO_DEVICE); | ||
| 1237 | bdp->cbd_bufaddr = 0; | ||
| 1238 | if (i < bdnum - 1) | ||
| 1239 | bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); | ||
| 1240 | } | ||
| 1241 | txq->tx_skbuff[index] = NULL; | 1221 | txq->tx_skbuff[index] = NULL; |
| 1222 | if (!IS_TSO_HEADER(txq, bdp->cbd_bufaddr)) | ||
| 1223 | dma_unmap_single(&fep->pdev->dev, bdp->cbd_bufaddr, | ||
| 1224 | bdp->cbd_datlen, DMA_TO_DEVICE); | ||
| 1225 | bdp->cbd_bufaddr = 0; | ||
| 1226 | if (!skb) { | ||
| 1227 | bdp = fec_enet_get_nextdesc(bdp, fep, queue_id); | ||
| 1228 | continue; | ||
| 1229 | } | ||
| 1242 | 1230 | ||
| 1243 | /* Check for errors. */ | 1231 | /* Check for errors. */ |
| 1244 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | | 1232 | if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | |
| @@ -1479,8 +1467,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
| 1479 | 1467 | ||
| 1480 | vlan_packet_rcvd = true; | 1468 | vlan_packet_rcvd = true; |
| 1481 | 1469 | ||
| 1482 | skb_copy_to_linear_data_offset(skb, VLAN_HLEN, | 1470 | memmove(skb->data + VLAN_HLEN, data, ETH_ALEN * 2); |
| 1483 | data, (2 * ETH_ALEN)); | ||
| 1484 | skb_pull(skb, VLAN_HLEN); | 1471 | skb_pull(skb, VLAN_HLEN); |
| 1485 | } | 1472 | } |
| 1486 | 1473 | ||
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c index 072426a72745..cd7675ac5bf9 100644 --- a/drivers/net/ethernet/ibm/ibmveth.c +++ b/drivers/net/ethernet/ibm/ibmveth.c | |||
| @@ -1136,6 +1136,8 @@ restart_poll: | |||
| 1136 | ibmveth_replenish_task(adapter); | 1136 | ibmveth_replenish_task(adapter); |
| 1137 | 1137 | ||
| 1138 | if (frames_processed < budget) { | 1138 | if (frames_processed < budget) { |
| 1139 | napi_complete(napi); | ||
| 1140 | |||
| 1139 | /* We think we are done - reenable interrupts, | 1141 | /* We think we are done - reenable interrupts, |
| 1140 | * then check once more to make sure we are done. | 1142 | * then check once more to make sure we are done. |
| 1141 | */ | 1143 | */ |
| @@ -1144,8 +1146,6 @@ restart_poll: | |||
| 1144 | 1146 | ||
| 1145 | BUG_ON(lpar_rc != H_SUCCESS); | 1147 | BUG_ON(lpar_rc != H_SUCCESS); |
| 1146 | 1148 | ||
| 1147 | napi_complete(napi); | ||
| 1148 | |||
| 1149 | if (ibmveth_rxq_pending_buffer(adapter) && | 1149 | if (ibmveth_rxq_pending_buffer(adapter) && |
| 1150 | napi_reschedule(napi)) { | 1150 | napi_reschedule(napi)) { |
| 1151 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, | 1151 | lpar_rc = h_vio_signal(adapter->vdev->unit_address, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 2a210c4efb89..ebce5bb24df9 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -1698,8 +1698,6 @@ int mlx4_en_start_port(struct net_device *dev) | |||
| 1698 | /* Schedule multicast task to populate multicast list */ | 1698 | /* Schedule multicast task to populate multicast list */ |
| 1699 | queue_work(mdev->workqueue, &priv->rx_mode_task); | 1699 | queue_work(mdev->workqueue, &priv->rx_mode_task); |
| 1700 | 1700 | ||
| 1701 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | ||
| 1702 | |||
| 1703 | #ifdef CONFIG_MLX4_EN_VXLAN | 1701 | #ifdef CONFIG_MLX4_EN_VXLAN |
| 1704 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | 1702 | if (priv->mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
| 1705 | vxlan_get_rx_port(dev); | 1703 | vxlan_get_rx_port(dev); |
| @@ -2853,6 +2851,8 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
| 2853 | queue_delayed_work(mdev->workqueue, &priv->service_task, | 2851 | queue_delayed_work(mdev->workqueue, &priv->service_task, |
| 2854 | SERVICE_TASK_DELAY); | 2852 | SERVICE_TASK_DELAY); |
| 2855 | 2853 | ||
| 2854 | mlx4_set_stats_bitmap(mdev->dev, &priv->stats_bitmap); | ||
| 2855 | |||
| 2856 | return 0; | 2856 | return 0; |
| 2857 | 2857 | ||
| 2858 | out: | 2858 | out: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 2a8268e6be15..ebbe244e80dd 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
| @@ -453,7 +453,7 @@ struct mlx4_en_port_stats { | |||
| 453 | unsigned long rx_chksum_none; | 453 | unsigned long rx_chksum_none; |
| 454 | unsigned long rx_chksum_complete; | 454 | unsigned long rx_chksum_complete; |
| 455 | unsigned long tx_chksum_offload; | 455 | unsigned long tx_chksum_offload; |
| 456 | #define NUM_PORT_STATS 9 | 456 | #define NUM_PORT_STATS 10 |
| 457 | }; | 457 | }; |
| 458 | 458 | ||
| 459 | struct mlx4_en_perf_stats { | 459 | struct mlx4_en_perf_stats { |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 5d093dc0f5f5..8678e39aba08 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
| @@ -2248,10 +2248,9 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
| 2248 | const struct of_device_id *match = NULL; | 2248 | const struct of_device_id *match = NULL; |
| 2249 | struct smc_local *lp; | 2249 | struct smc_local *lp; |
| 2250 | struct net_device *ndev; | 2250 | struct net_device *ndev; |
| 2251 | struct resource *res; | 2251 | struct resource *res, *ires; |
| 2252 | unsigned int __iomem *addr; | 2252 | unsigned int __iomem *addr; |
| 2253 | unsigned long irq_flags = SMC_IRQ_FLAGS; | 2253 | unsigned long irq_flags = SMC_IRQ_FLAGS; |
| 2254 | unsigned long irq_resflags; | ||
| 2255 | int ret; | 2254 | int ret; |
| 2256 | 2255 | ||
| 2257 | ndev = alloc_etherdev(sizeof(struct smc_local)); | 2256 | ndev = alloc_etherdev(sizeof(struct smc_local)); |
| @@ -2343,19 +2342,16 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
| 2343 | goto out_free_netdev; | 2342 | goto out_free_netdev; |
| 2344 | } | 2343 | } |
| 2345 | 2344 | ||
| 2346 | ndev->irq = platform_get_irq(pdev, 0); | 2345 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 2347 | if (ndev->irq <= 0) { | 2346 | if (!ires) { |
| 2348 | ret = -ENODEV; | 2347 | ret = -ENODEV; |
| 2349 | goto out_release_io; | 2348 | goto out_release_io; |
| 2350 | } | 2349 | } |
| 2351 | /* | 2350 | |
| 2352 | * If this platform does not specify any special irqflags, or if | 2351 | ndev->irq = ires->start; |
| 2353 | * the resource supplies a trigger, override the irqflags with | 2352 | |
| 2354 | * the trigger flags from the resource. | 2353 | if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) |
| 2355 | */ | 2354 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; |
| 2356 | irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); | ||
| 2357 | if (irq_flags == -1 || irq_resflags & IRQF_TRIGGER_MASK) | ||
| 2358 | irq_flags = irq_resflags & IRQF_TRIGGER_MASK; | ||
| 2359 | 2355 | ||
| 2360 | ret = smc_request_attrib(pdev, ndev); | 2356 | ret = smc_request_attrib(pdev, ndev); |
| 2361 | if (ret) | 2357 | if (ret) |
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c index a495931a66a1..0e0fbb5842b3 100644 --- a/drivers/net/ethernet/wiznet/w5100.c +++ b/drivers/net/ethernet/wiznet/w5100.c | |||
| @@ -498,9 +498,9 @@ static int w5100_napi_poll(struct napi_struct *napi, int budget) | |||
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | if (rx_count < budget) { | 500 | if (rx_count < budget) { |
| 501 | napi_complete(napi); | ||
| 501 | w5100_write(priv, W5100_IMR, IR_S0); | 502 | w5100_write(priv, W5100_IMR, IR_S0); |
| 502 | mmiowb(); | 503 | mmiowb(); |
| 503 | napi_complete(napi); | ||
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | return rx_count; | 506 | return rx_count; |
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c index 09322d9db578..4b310002258d 100644 --- a/drivers/net/ethernet/wiznet/w5300.c +++ b/drivers/net/ethernet/wiznet/w5300.c | |||
| @@ -418,9 +418,9 @@ static int w5300_napi_poll(struct napi_struct *napi, int budget) | |||
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | if (rx_count < budget) { | 420 | if (rx_count < budget) { |
| 421 | napi_complete(napi); | ||
| 421 | w5300_write(priv, W5300_IMR, IR_S0); | 422 | w5300_write(priv, W5300_IMR, IR_S0); |
| 422 | mmiowb(); | 423 | mmiowb(); |
| 423 | napi_complete(napi); | ||
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | return rx_count; | 426 | return rx_count; |
diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c index 3eed708a6182..fe48f4c51373 100644 --- a/drivers/net/usb/cx82310_eth.c +++ b/drivers/net/usb/cx82310_eth.c | |||
| @@ -300,9 +300,18 @@ static const struct driver_info cx82310_info = { | |||
| 300 | .tx_fixup = cx82310_tx_fixup, | 300 | .tx_fixup = cx82310_tx_fixup, |
| 301 | }; | 301 | }; |
| 302 | 302 | ||
| 303 | #define USB_DEVICE_CLASS(vend, prod, cl, sc, pr) \ | ||
| 304 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | ||
| 305 | USB_DEVICE_ID_MATCH_DEV_INFO, \ | ||
| 306 | .idVendor = (vend), \ | ||
| 307 | .idProduct = (prod), \ | ||
| 308 | .bDeviceClass = (cl), \ | ||
| 309 | .bDeviceSubClass = (sc), \ | ||
| 310 | .bDeviceProtocol = (pr) | ||
| 311 | |||
| 303 | static const struct usb_device_id products[] = { | 312 | static const struct usb_device_id products[] = { |
| 304 | { | 313 | { |
| 305 | USB_DEVICE_AND_INTERFACE_INFO(0x0572, 0xcb01, 0xff, 0, 0), | 314 | USB_DEVICE_CLASS(0x0572, 0xcb01, 0xff, 0, 0), |
| 306 | .driver_info = (unsigned long) &cx82310_info | 315 | .driver_info = (unsigned long) &cx82310_info |
| 307 | }, | 316 | }, |
| 308 | { }, | 317 | { }, |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f1ff3666f090..59b0e9754ae3 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -1448,8 +1448,10 @@ static void virtnet_free_queues(struct virtnet_info *vi) | |||
| 1448 | { | 1448 | { |
| 1449 | int i; | 1449 | int i; |
| 1450 | 1450 | ||
| 1451 | for (i = 0; i < vi->max_queue_pairs; i++) | 1451 | for (i = 0; i < vi->max_queue_pairs; i++) { |
| 1452 | napi_hash_del(&vi->rq[i].napi); | ||
| 1452 | netif_napi_del(&vi->rq[i].napi); | 1453 | netif_napi_del(&vi->rq[i].napi); |
| 1454 | } | ||
| 1453 | 1455 | ||
| 1454 | kfree(vi->rq); | 1456 | kfree(vi->rq); |
| 1455 | kfree(vi->sq); | 1457 | kfree(vi->sq); |
| @@ -1948,11 +1950,8 @@ static int virtnet_freeze(struct virtio_device *vdev) | |||
| 1948 | cancel_delayed_work_sync(&vi->refill); | 1950 | cancel_delayed_work_sync(&vi->refill); |
| 1949 | 1951 | ||
| 1950 | if (netif_running(vi->dev)) { | 1952 | if (netif_running(vi->dev)) { |
| 1951 | for (i = 0; i < vi->max_queue_pairs; i++) { | 1953 | for (i = 0; i < vi->max_queue_pairs; i++) |
| 1952 | napi_disable(&vi->rq[i].napi); | 1954 | napi_disable(&vi->rq[i].napi); |
| 1953 | napi_hash_del(&vi->rq[i].napi); | ||
| 1954 | netif_napi_del(&vi->rq[i].napi); | ||
| 1955 | } | ||
| 1956 | } | 1955 | } |
| 1957 | 1956 | ||
| 1958 | remove_vq_common(vi); | 1957 | remove_vq_common(vi); |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1e0a775ea882..f8528a4cf54f 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -1218,7 +1218,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
| 1218 | goto drop; | 1218 | goto drop; |
| 1219 | 1219 | ||
| 1220 | flags &= ~VXLAN_HF_RCO; | 1220 | flags &= ~VXLAN_HF_RCO; |
| 1221 | vni &= VXLAN_VID_MASK; | 1221 | vni &= VXLAN_VNI_MASK; |
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | /* For backwards compatibility, only allow reserved fields to be | 1224 | /* For backwards compatibility, only allow reserved fields to be |
| @@ -1239,7 +1239,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
| 1239 | flags &= ~VXLAN_GBP_USED_BITS; | 1239 | flags &= ~VXLAN_GBP_USED_BITS; |
| 1240 | } | 1240 | } |
| 1241 | 1241 | ||
| 1242 | if (flags || (vni & ~VXLAN_VID_MASK)) { | 1242 | if (flags || vni & ~VXLAN_VNI_MASK) { |
| 1243 | /* If there are any unprocessed flags remaining treat | 1243 | /* If there are any unprocessed flags remaining treat |
| 1244 | * this as a malformed packet. This behavior diverges from | 1244 | * this as a malformed packet. This behavior diverges from |
| 1245 | * VXLAN RFC (RFC7348) which stipulates that bits in reserved | 1245 | * VXLAN RFC (RFC7348) which stipulates that bits in reserved |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ccbdb05b28cd..75345c1e8c34 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -5370,6 +5370,7 @@ static void b43_supported_bands(struct b43_wldev *dev, bool *have_2ghz_phy, | |||
| 5370 | case 0x432a: /* BCM4321 */ | 5370 | case 0x432a: /* BCM4321 */ |
| 5371 | case 0x432d: /* BCM4322 */ | 5371 | case 0x432d: /* BCM4322 */ |
| 5372 | case 0x4352: /* BCM43222 */ | 5372 | case 0x4352: /* BCM43222 */ |
| 5373 | case 0x435a: /* BCM43228 */ | ||
| 5373 | case 0x4333: /* BCM4331 */ | 5374 | case 0x4333: /* BCM4331 */ |
| 5374 | case 0x43a2: /* BCM4360 */ | 5375 | case 0x43a2: /* BCM4360 */ |
| 5375 | case 0x43b3: /* BCM4352 */ | 5376 | case 0x43b3: /* BCM4352 */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/brcm80211/brcmfmac/vendor.c index 50cdf7090198..8eff2753abad 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/vendor.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/vendor.c | |||
| @@ -39,13 +39,22 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, | |||
| 39 | void *dcmd_buf = NULL, *wr_pointer; | 39 | void *dcmd_buf = NULL, *wr_pointer; |
| 40 | u16 msglen, maxmsglen = PAGE_SIZE - 0x100; | 40 | u16 msglen, maxmsglen = PAGE_SIZE - 0x100; |
| 41 | 41 | ||
| 42 | brcmf_dbg(TRACE, "cmd %x set %d len %d\n", cmdhdr->cmd, cmdhdr->set, | 42 | if (len < sizeof(*cmdhdr)) { |
| 43 | cmdhdr->len); | 43 | brcmf_err("vendor command too short: %d\n", len); |
| 44 | return -EINVAL; | ||
| 45 | } | ||
| 44 | 46 | ||
| 45 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); | 47 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); |
| 46 | ifp = vif->ifp; | 48 | ifp = vif->ifp; |
| 47 | 49 | ||
| 48 | len -= sizeof(struct brcmf_vndr_dcmd_hdr); | 50 | brcmf_dbg(TRACE, "ifidx=%d, cmd=%d\n", ifp->ifidx, cmdhdr->cmd); |
| 51 | |||
| 52 | if (cmdhdr->offset > len) { | ||
| 53 | brcmf_err("bad buffer offset %d > %d\n", cmdhdr->offset, len); | ||
| 54 | return -EINVAL; | ||
| 55 | } | ||
| 56 | |||
| 57 | len -= cmdhdr->offset; | ||
| 49 | ret_len = cmdhdr->len; | 58 | ret_len = cmdhdr->len; |
| 50 | if (ret_len > 0 || len > 0) { | 59 | if (ret_len > 0 || len > 0) { |
| 51 | if (len > BRCMF_DCMD_MAXLEN) { | 60 | if (len > BRCMF_DCMD_MAXLEN) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index c3817fae16c0..06f6cc08f451 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
| @@ -95,7 +95,8 @@ static const struct iwl_eeprom_params iwl1000_eeprom_params = { | |||
| 95 | .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ | 95 | .nvm_calib_ver = EEPROM_1000_TX_POWER_VERSION, \ |
| 96 | .base_params = &iwl1000_base_params, \ | 96 | .base_params = &iwl1000_base_params, \ |
| 97 | .eeprom_params = &iwl1000_eeprom_params, \ | 97 | .eeprom_params = &iwl1000_eeprom_params, \ |
| 98 | .led_mode = IWL_LED_BLINK | 98 | .led_mode = IWL_LED_BLINK, \ |
| 99 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 99 | 100 | ||
| 100 | const struct iwl_cfg iwl1000_bgn_cfg = { | 101 | const struct iwl_cfg iwl1000_bgn_cfg = { |
| 101 | .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN", | 102 | .name = "Intel(R) Centrino(R) Wireless-N 1000 BGN", |
| @@ -121,7 +122,8 @@ const struct iwl_cfg iwl1000_bg_cfg = { | |||
| 121 | .base_params = &iwl1000_base_params, \ | 122 | .base_params = &iwl1000_base_params, \ |
| 122 | .eeprom_params = &iwl1000_eeprom_params, \ | 123 | .eeprom_params = &iwl1000_eeprom_params, \ |
| 123 | .led_mode = IWL_LED_RF_STATE, \ | 124 | .led_mode = IWL_LED_RF_STATE, \ |
| 124 | .rx_with_siso_diversity = true | 125 | .rx_with_siso_diversity = true, \ |
| 126 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 125 | 127 | ||
| 126 | const struct iwl_cfg iwl100_bgn_cfg = { | 128 | const struct iwl_cfg iwl100_bgn_cfg = { |
| 127 | .name = "Intel(R) Centrino(R) Wireless-N 100 BGN", | 129 | .name = "Intel(R) Centrino(R) Wireless-N 100 BGN", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 21e5d0843a62..890b95f497d6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
| @@ -123,7 +123,9 @@ static const struct iwl_eeprom_params iwl20x0_eeprom_params = { | |||
| 123 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ | 123 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ |
| 124 | .base_params = &iwl2000_base_params, \ | 124 | .base_params = &iwl2000_base_params, \ |
| 125 | .eeprom_params = &iwl20x0_eeprom_params, \ | 125 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 126 | .led_mode = IWL_LED_RF_STATE | 126 | .led_mode = IWL_LED_RF_STATE, \ |
| 127 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 128 | |||
| 127 | 129 | ||
| 128 | const struct iwl_cfg iwl2000_2bgn_cfg = { | 130 | const struct iwl_cfg iwl2000_2bgn_cfg = { |
| 129 | .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN", | 131 | .name = "Intel(R) Centrino(R) Wireless-N 2200 BGN", |
| @@ -149,7 +151,8 @@ const struct iwl_cfg iwl2000_2bgn_d_cfg = { | |||
| 149 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ | 151 | .nvm_calib_ver = EEPROM_2000_TX_POWER_VERSION, \ |
| 150 | .base_params = &iwl2030_base_params, \ | 152 | .base_params = &iwl2030_base_params, \ |
| 151 | .eeprom_params = &iwl20x0_eeprom_params, \ | 153 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 152 | .led_mode = IWL_LED_RF_STATE | 154 | .led_mode = IWL_LED_RF_STATE, \ |
| 155 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 153 | 156 | ||
| 154 | const struct iwl_cfg iwl2030_2bgn_cfg = { | 157 | const struct iwl_cfg iwl2030_2bgn_cfg = { |
| 155 | .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN", | 158 | .name = "Intel(R) Centrino(R) Wireless-N 2230 BGN", |
| @@ -170,7 +173,8 @@ const struct iwl_cfg iwl2030_2bgn_cfg = { | |||
| 170 | .base_params = &iwl2000_base_params, \ | 173 | .base_params = &iwl2000_base_params, \ |
| 171 | .eeprom_params = &iwl20x0_eeprom_params, \ | 174 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 172 | .led_mode = IWL_LED_RF_STATE, \ | 175 | .led_mode = IWL_LED_RF_STATE, \ |
| 173 | .rx_with_siso_diversity = true | 176 | .rx_with_siso_diversity = true, \ |
| 177 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 174 | 178 | ||
| 175 | const struct iwl_cfg iwl105_bgn_cfg = { | 179 | const struct iwl_cfg iwl105_bgn_cfg = { |
| 176 | .name = "Intel(R) Centrino(R) Wireless-N 105 BGN", | 180 | .name = "Intel(R) Centrino(R) Wireless-N 105 BGN", |
| @@ -197,7 +201,8 @@ const struct iwl_cfg iwl105_bgn_d_cfg = { | |||
| 197 | .base_params = &iwl2030_base_params, \ | 201 | .base_params = &iwl2030_base_params, \ |
| 198 | .eeprom_params = &iwl20x0_eeprom_params, \ | 202 | .eeprom_params = &iwl20x0_eeprom_params, \ |
| 199 | .led_mode = IWL_LED_RF_STATE, \ | 203 | .led_mode = IWL_LED_RF_STATE, \ |
| 200 | .rx_with_siso_diversity = true | 204 | .rx_with_siso_diversity = true, \ |
| 205 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 201 | 206 | ||
| 202 | const struct iwl_cfg iwl135_bgn_cfg = { | 207 | const struct iwl_cfg iwl135_bgn_cfg = { |
| 203 | .name = "Intel(R) Centrino(R) Wireless-N 135 BGN", | 208 | .name = "Intel(R) Centrino(R) Wireless-N 135 BGN", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 332bbede39e5..724194e23414 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
| @@ -93,7 +93,8 @@ static const struct iwl_eeprom_params iwl5000_eeprom_params = { | |||
| 93 | .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ | 93 | .nvm_calib_ver = EEPROM_5000_TX_POWER_VERSION, \ |
| 94 | .base_params = &iwl5000_base_params, \ | 94 | .base_params = &iwl5000_base_params, \ |
| 95 | .eeprom_params = &iwl5000_eeprom_params, \ | 95 | .eeprom_params = &iwl5000_eeprom_params, \ |
| 96 | .led_mode = IWL_LED_BLINK | 96 | .led_mode = IWL_LED_BLINK, \ |
| 97 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 97 | 98 | ||
| 98 | const struct iwl_cfg iwl5300_agn_cfg = { | 99 | const struct iwl_cfg iwl5300_agn_cfg = { |
| 99 | .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", | 100 | .name = "Intel(R) Ultimate N WiFi Link 5300 AGN", |
| @@ -158,7 +159,8 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
| 158 | .base_params = &iwl5000_base_params, \ | 159 | .base_params = &iwl5000_base_params, \ |
| 159 | .eeprom_params = &iwl5000_eeprom_params, \ | 160 | .eeprom_params = &iwl5000_eeprom_params, \ |
| 160 | .led_mode = IWL_LED_BLINK, \ | 161 | .led_mode = IWL_LED_BLINK, \ |
| 161 | .internal_wimax_coex = true | 162 | .internal_wimax_coex = true, \ |
| 163 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 162 | 164 | ||
| 163 | const struct iwl_cfg iwl5150_agn_cfg = { | 165 | const struct iwl_cfg iwl5150_agn_cfg = { |
| 164 | .name = "Intel(R) WiMAX/WiFi Link 5150 AGN", | 166 | .name = "Intel(R) WiMAX/WiFi Link 5150 AGN", |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 8f2c3c8c6b84..21b2630763dc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
| @@ -145,7 +145,8 @@ static const struct iwl_eeprom_params iwl6000_eeprom_params = { | |||
| 145 | .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ | 145 | .nvm_calib_ver = EEPROM_6005_TX_POWER_VERSION, \ |
| 146 | .base_params = &iwl6000_g2_base_params, \ | 146 | .base_params = &iwl6000_g2_base_params, \ |
| 147 | .eeprom_params = &iwl6000_eeprom_params, \ | 147 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 148 | .led_mode = IWL_LED_RF_STATE | 148 | .led_mode = IWL_LED_RF_STATE, \ |
| 149 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 149 | 150 | ||
| 150 | const struct iwl_cfg iwl6005_2agn_cfg = { | 151 | const struct iwl_cfg iwl6005_2agn_cfg = { |
| 151 | .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", | 152 | .name = "Intel(R) Centrino(R) Advanced-N 6205 AGN", |
| @@ -199,7 +200,8 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
| 199 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ | 200 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ |
| 200 | .base_params = &iwl6000_g2_base_params, \ | 201 | .base_params = &iwl6000_g2_base_params, \ |
| 201 | .eeprom_params = &iwl6000_eeprom_params, \ | 202 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 202 | .led_mode = IWL_LED_RF_STATE | 203 | .led_mode = IWL_LED_RF_STATE, \ |
| 204 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 203 | 205 | ||
| 204 | const struct iwl_cfg iwl6030_2agn_cfg = { | 206 | const struct iwl_cfg iwl6030_2agn_cfg = { |
| 205 | .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", | 207 | .name = "Intel(R) Centrino(R) Advanced-N 6230 AGN", |
| @@ -235,7 +237,8 @@ const struct iwl_cfg iwl6030_2bg_cfg = { | |||
| 235 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ | 237 | .nvm_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ |
| 236 | .base_params = &iwl6000_g2_base_params, \ | 238 | .base_params = &iwl6000_g2_base_params, \ |
| 237 | .eeprom_params = &iwl6000_eeprom_params, \ | 239 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 238 | .led_mode = IWL_LED_RF_STATE | 240 | .led_mode = IWL_LED_RF_STATE, \ |
| 241 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 239 | 242 | ||
| 240 | const struct iwl_cfg iwl6035_2agn_cfg = { | 243 | const struct iwl_cfg iwl6035_2agn_cfg = { |
| 241 | .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", | 244 | .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", |
| @@ -290,7 +293,8 @@ const struct iwl_cfg iwl130_bg_cfg = { | |||
| 290 | .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ | 293 | .nvm_calib_ver = EEPROM_6000_TX_POWER_VERSION, \ |
| 291 | .base_params = &iwl6000_base_params, \ | 294 | .base_params = &iwl6000_base_params, \ |
| 292 | .eeprom_params = &iwl6000_eeprom_params, \ | 295 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 293 | .led_mode = IWL_LED_BLINK | 296 | .led_mode = IWL_LED_BLINK, \ |
| 297 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 294 | 298 | ||
| 295 | const struct iwl_cfg iwl6000i_2agn_cfg = { | 299 | const struct iwl_cfg iwl6000i_2agn_cfg = { |
| 296 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", | 300 | .name = "Intel(R) Centrino(R) Advanced-N 6200 AGN", |
| @@ -322,7 +326,8 @@ const struct iwl_cfg iwl6000i_2bg_cfg = { | |||
| 322 | .base_params = &iwl6050_base_params, \ | 326 | .base_params = &iwl6050_base_params, \ |
| 323 | .eeprom_params = &iwl6000_eeprom_params, \ | 327 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 324 | .led_mode = IWL_LED_BLINK, \ | 328 | .led_mode = IWL_LED_BLINK, \ |
| 325 | .internal_wimax_coex = true | 329 | .internal_wimax_coex = true, \ |
| 330 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 326 | 331 | ||
| 327 | const struct iwl_cfg iwl6050_2agn_cfg = { | 332 | const struct iwl_cfg iwl6050_2agn_cfg = { |
| 328 | .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN", | 333 | .name = "Intel(R) Centrino(R) Advanced-N + WiMAX 6250 AGN", |
| @@ -347,7 +352,8 @@ const struct iwl_cfg iwl6050_2abg_cfg = { | |||
| 347 | .base_params = &iwl6050_base_params, \ | 352 | .base_params = &iwl6050_base_params, \ |
| 348 | .eeprom_params = &iwl6000_eeprom_params, \ | 353 | .eeprom_params = &iwl6000_eeprom_params, \ |
| 349 | .led_mode = IWL_LED_BLINK, \ | 354 | .led_mode = IWL_LED_BLINK, \ |
| 350 | .internal_wimax_coex = true | 355 | .internal_wimax_coex = true, \ |
| 356 | .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K | ||
| 351 | 357 | ||
| 352 | const struct iwl_cfg iwl6150_bgn_cfg = { | 358 | const struct iwl_cfg iwl6150_bgn_cfg = { |
| 353 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", | 359 | .name = "Intel(R) Centrino(R) Wireless-N + WiMAX 6150 BGN", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 1ec4d55155f7..7810c41cf9a7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
| @@ -793,7 +793,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
| 793 | if (!vif->bss_conf.assoc) | 793 | if (!vif->bss_conf.assoc) |
| 794 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 794 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 795 | 795 | ||
| 796 | if (IWL_COEX_IS_RRC_ON(mvm->last_bt_notif.ttc_rrc_status, | 796 | if (mvmvif->phy_ctxt && |
| 797 | IWL_COEX_IS_RRC_ON(mvm->last_bt_notif.ttc_rrc_status, | ||
| 797 | mvmvif->phy_ctxt->id)) | 798 | mvmvif->phy_ctxt->id)) |
| 798 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 799 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 799 | 800 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c index d530ef3da107..542ee74f290a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | |||
| @@ -832,7 +832,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
| 832 | if (!vif->bss_conf.assoc) | 832 | if (!vif->bss_conf.assoc) |
| 833 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 833 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 834 | 834 | ||
| 835 | if (data->notif->rrc_enabled & BIT(mvmvif->phy_ctxt->id)) | 835 | if (mvmvif->phy_ctxt && |
| 836 | data->notif->rrc_enabled & BIT(mvmvif->phy_ctxt->id)) | ||
| 836 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 837 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
| 837 | 838 | ||
| 838 | IWL_DEBUG_COEX(data->mvm, | 839 | IWL_DEBUG_COEX(data->mvm, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 1ff7ec08532d..09654e73a533 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
| @@ -405,7 +405,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
| 405 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 405 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
| 406 | &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; | 406 | &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; |
| 407 | 407 | ||
| 408 | if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_BEAMFORMER) | 408 | if ((mvm->fw->ucode_capa.capa[0] & |
| 409 | IWL_UCODE_TLV_CAPA_BEAMFORMER) && | ||
| 410 | (mvm->fw->ucode_capa.api[0] & | ||
| 411 | IWL_UCODE_TLV_API_LQ_SS_PARAMS)) | ||
| 409 | hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |= | 412 | hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |= |
| 410 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; | 413 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 411 | } | 414 | } |
| @@ -2215,7 +2218,19 @@ static void iwl_mvm_mac_cancel_hw_scan(struct ieee80211_hw *hw, | |||
| 2215 | 2218 | ||
| 2216 | mutex_lock(&mvm->mutex); | 2219 | mutex_lock(&mvm->mutex); |
| 2217 | 2220 | ||
| 2218 | iwl_mvm_cancel_scan(mvm); | 2221 | /* Due to a race condition, it's possible that mac80211 asks |
| 2222 | * us to stop a hw_scan when it's already stopped. This can | ||
| 2223 | * happen, for instance, if we stopped the scan ourselves, | ||
| 2224 | * called ieee80211_scan_completed() and the userspace called | ||
| 2225 | * cancel scan scan before ieee80211_scan_work() could run. | ||
| 2226 | * To handle that, simply return if the scan is not running. | ||
| 2227 | */ | ||
| 2228 | /* FIXME: for now, we ignore this race for UMAC scans, since | ||
| 2229 | * they don't set the scan_status. | ||
| 2230 | */ | ||
| 2231 | if ((mvm->scan_status == IWL_MVM_SCAN_OS) || | ||
| 2232 | (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) | ||
| 2233 | iwl_mvm_cancel_scan(mvm); | ||
| 2219 | 2234 | ||
| 2220 | mutex_unlock(&mvm->mutex); | 2235 | mutex_unlock(&mvm->mutex); |
| 2221 | } | 2236 | } |
| @@ -2559,12 +2574,29 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, | |||
| 2559 | int ret; | 2574 | int ret; |
| 2560 | 2575 | ||
| 2561 | mutex_lock(&mvm->mutex); | 2576 | mutex_lock(&mvm->mutex); |
| 2577 | |||
| 2578 | /* Due to a race condition, it's possible that mac80211 asks | ||
| 2579 | * us to stop a sched_scan when it's already stopped. This | ||
| 2580 | * can happen, for instance, if we stopped the scan ourselves, | ||
| 2581 | * called ieee80211_sched_scan_stopped() and the userspace called | ||
| 2582 | * stop sched scan scan before ieee80211_sched_scan_stopped_work() | ||
| 2583 | * could run. To handle this, simply return if the scan is | ||
| 2584 | * not running. | ||
| 2585 | */ | ||
| 2586 | /* FIXME: for now, we ignore this race for UMAC scans, since | ||
| 2587 | * they don't set the scan_status. | ||
| 2588 | */ | ||
| 2589 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && | ||
| 2590 | !(mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN)) { | ||
| 2591 | mutex_unlock(&mvm->mutex); | ||
| 2592 | return 0; | ||
| 2593 | } | ||
| 2594 | |||
| 2562 | ret = iwl_mvm_scan_offload_stop(mvm, false); | 2595 | ret = iwl_mvm_scan_offload_stop(mvm, false); |
| 2563 | mutex_unlock(&mvm->mutex); | 2596 | mutex_unlock(&mvm->mutex); |
| 2564 | iwl_mvm_wait_for_async_handlers(mvm); | 2597 | iwl_mvm_wait_for_async_handlers(mvm); |
| 2565 | 2598 | ||
| 2566 | return ret; | 2599 | return ret; |
| 2567 | |||
| 2568 | } | 2600 | } |
| 2569 | 2601 | ||
| 2570 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, | 2602 | static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index 194bd1f939ca..efa9688a4cf1 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
| @@ -134,9 +134,12 @@ enum rs_column_mode { | |||
| 134 | #define MAX_NEXT_COLUMNS 7 | 134 | #define MAX_NEXT_COLUMNS 7 |
| 135 | #define MAX_COLUMN_CHECKS 3 | 135 | #define MAX_COLUMN_CHECKS 3 |
| 136 | 136 | ||
| 137 | struct rs_tx_column; | ||
| 138 | |||
| 137 | typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, | 139 | typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, |
| 138 | struct ieee80211_sta *sta, | 140 | struct ieee80211_sta *sta, |
| 139 | struct iwl_scale_tbl_info *tbl); | 141 | struct iwl_scale_tbl_info *tbl, |
| 142 | const struct rs_tx_column *next_col); | ||
| 140 | 143 | ||
| 141 | struct rs_tx_column { | 144 | struct rs_tx_column { |
| 142 | enum rs_column_mode mode; | 145 | enum rs_column_mode mode; |
| @@ -147,13 +150,15 @@ struct rs_tx_column { | |||
| 147 | }; | 150 | }; |
| 148 | 151 | ||
| 149 | static bool rs_ant_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 152 | static bool rs_ant_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 150 | struct iwl_scale_tbl_info *tbl) | 153 | struct iwl_scale_tbl_info *tbl, |
| 154 | const struct rs_tx_column *next_col) | ||
| 151 | { | 155 | { |
| 152 | return iwl_mvm_bt_coex_is_ant_avail(mvm, tbl->rate.ant); | 156 | return iwl_mvm_bt_coex_is_ant_avail(mvm, next_col->ant); |
| 153 | } | 157 | } |
| 154 | 158 | ||
| 155 | static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 159 | static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 156 | struct iwl_scale_tbl_info *tbl) | 160 | struct iwl_scale_tbl_info *tbl, |
| 161 | const struct rs_tx_column *next_col) | ||
| 157 | { | 162 | { |
| 158 | if (!sta->ht_cap.ht_supported) | 163 | if (!sta->ht_cap.ht_supported) |
| 159 | return false; | 164 | return false; |
| @@ -171,7 +176,8 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
| 171 | } | 176 | } |
| 172 | 177 | ||
| 173 | static bool rs_siso_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 178 | static bool rs_siso_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 174 | struct iwl_scale_tbl_info *tbl) | 179 | struct iwl_scale_tbl_info *tbl, |
| 180 | const struct rs_tx_column *next_col) | ||
| 175 | { | 181 | { |
| 176 | if (!sta->ht_cap.ht_supported) | 182 | if (!sta->ht_cap.ht_supported) |
| 177 | return false; | 183 | return false; |
| @@ -180,7 +186,8 @@ static bool rs_siso_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
| 180 | } | 186 | } |
| 181 | 187 | ||
| 182 | static bool rs_sgi_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 188 | static bool rs_sgi_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
| 183 | struct iwl_scale_tbl_info *tbl) | 189 | struct iwl_scale_tbl_info *tbl, |
| 190 | const struct rs_tx_column *next_col) | ||
| 184 | { | 191 | { |
| 185 | struct rs_rate *rate = &tbl->rate; | 192 | struct rs_rate *rate = &tbl->rate; |
| 186 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 193 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
| @@ -1590,7 +1597,7 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, | |||
| 1590 | 1597 | ||
| 1591 | for (j = 0; j < MAX_COLUMN_CHECKS; j++) { | 1598 | for (j = 0; j < MAX_COLUMN_CHECKS; j++) { |
| 1592 | allow_func = next_col->checks[j]; | 1599 | allow_func = next_col->checks[j]; |
| 1593 | if (allow_func && !allow_func(mvm, sta, tbl)) | 1600 | if (allow_func && !allow_func(mvm, sta, tbl, next_col)) |
| 1594 | break; | 1601 | break; |
| 1595 | } | 1602 | } |
| 1596 | 1603 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 7e9aa3cb3254..c47c8051da77 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
| @@ -1128,8 +1128,10 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) | |||
| 1128 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) | 1128 | if (mvm->scan_status == IWL_MVM_SCAN_NONE) |
| 1129 | return 0; | 1129 | return 0; |
| 1130 | 1130 | ||
| 1131 | if (iwl_mvm_is_radio_killed(mvm)) | 1131 | if (iwl_mvm_is_radio_killed(mvm)) { |
| 1132 | ret = 0; | ||
| 1132 | goto out; | 1133 | goto out; |
| 1134 | } | ||
| 1133 | 1135 | ||
| 1134 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && | 1136 | if (mvm->scan_status != IWL_MVM_SCAN_SCHED && |
| 1135 | (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) || | 1137 | (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) || |
| @@ -1148,16 +1150,14 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) | |||
| 1148 | IWL_DEBUG_SCAN(mvm, "Send stop %sscan failed %d\n", | 1150 | IWL_DEBUG_SCAN(mvm, "Send stop %sscan failed %d\n", |
| 1149 | sched ? "offloaded " : "", ret); | 1151 | sched ? "offloaded " : "", ret); |
| 1150 | iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); | 1152 | iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); |
| 1151 | return ret; | 1153 | goto out; |
| 1152 | } | 1154 | } |
| 1153 | 1155 | ||
| 1154 | IWL_DEBUG_SCAN(mvm, "Successfully sent stop %sscan\n", | 1156 | IWL_DEBUG_SCAN(mvm, "Successfully sent stop %sscan\n", |
| 1155 | sched ? "offloaded " : ""); | 1157 | sched ? "offloaded " : ""); |
| 1156 | 1158 | ||
| 1157 | ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, 1 * HZ); | 1159 | ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, 1 * HZ); |
| 1158 | if (ret) | 1160 | out: |
| 1159 | return ret; | ||
| 1160 | |||
| 1161 | /* | 1161 | /* |
| 1162 | * Clear the scan status so the next scan requests will succeed. This | 1162 | * Clear the scan status so the next scan requests will succeed. This |
| 1163 | * also ensures the Rx handler doesn't do anything, as the scan was | 1163 | * also ensures the Rx handler doesn't do anything, as the scan was |
| @@ -1167,7 +1167,6 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify) | |||
| 1167 | if (mvm->scan_status == IWL_MVM_SCAN_OS) | 1167 | if (mvm->scan_status == IWL_MVM_SCAN_OS) |
| 1168 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 1168 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
| 1169 | 1169 | ||
| 1170 | out: | ||
| 1171 | mvm->scan_status = IWL_MVM_SCAN_NONE; | 1170 | mvm->scan_status = IWL_MVM_SCAN_NONE; |
| 1172 | 1171 | ||
| 1173 | if (notify) { | 1172 | if (notify) { |
| @@ -1177,7 +1176,7 @@ out: | |||
| 1177 | ieee80211_scan_completed(mvm->hw, true); | 1176 | ieee80211_scan_completed(mvm->hw, true); |
| 1178 | } | 1177 | } |
| 1179 | 1178 | ||
| 1180 | return 0; | 1179 | return ret; |
| 1181 | } | 1180 | } |
| 1182 | 1181 | ||
| 1183 | static void iwl_mvm_unified_scan_fill_tx_cmd(struct iwl_mvm *mvm, | 1182 | static void iwl_mvm_unified_scan_fill_tx_cmd(struct iwl_mvm *mvm, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index 54fafbf9a711..f8d6f306dd76 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
| @@ -750,8 +750,7 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm) | |||
| 750 | * request | 750 | * request |
| 751 | */ | 751 | */ |
| 752 | list_for_each_entry(te_data, &mvm->time_event_list, list) { | 752 | list_for_each_entry(te_data, &mvm->time_event_list, list) { |
| 753 | if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE && | 753 | if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { |
| 754 | te_data->running) { | ||
| 755 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); | 754 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); |
| 756 | is_p2p = true; | 755 | is_p2p = true; |
| 757 | goto remove_te; | 756 | goto remove_te; |
| @@ -766,10 +765,8 @@ void iwl_mvm_stop_roc(struct iwl_mvm *mvm) | |||
| 766 | * request | 765 | * request |
| 767 | */ | 766 | */ |
| 768 | list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) { | 767 | list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) { |
| 769 | if (te_data->running) { | 768 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); |
| 770 | mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); | 769 | goto remove_te; |
| 771 | goto remove_te; | ||
| 772 | } | ||
| 773 | } | 770 | } |
| 774 | 771 | ||
| 775 | remove_te: | 772 | remove_te: |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 1d4677460711..074f716020aa 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
| @@ -1386,8 +1386,11 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
| 1386 | } | 1386 | } |
| 1387 | 1387 | ||
| 1388 | return true; | 1388 | return true; |
| 1389 | } else if (0x86DD == ether_type) { | 1389 | } else if (ETH_P_IPV6 == ether_type) { |
| 1390 | return true; | 1390 | /* TODO: Handle any IPv6 cases that need special handling. |
| 1391 | * For now, always return false | ||
| 1392 | */ | ||
| 1393 | goto end; | ||
| 1391 | } | 1394 | } |
| 1392 | 1395 | ||
| 1393 | end: | 1396 | end: |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index cab9f5257f57..997cf0901ac2 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
| @@ -96,6 +96,7 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, | |||
| 96 | static void make_tx_response(struct xenvif_queue *queue, | 96 | static void make_tx_response(struct xenvif_queue *queue, |
| 97 | struct xen_netif_tx_request *txp, | 97 | struct xen_netif_tx_request *txp, |
| 98 | s8 st); | 98 | s8 st); |
| 99 | static void push_tx_responses(struct xenvif_queue *queue); | ||
| 99 | 100 | ||
| 100 | static inline int tx_work_todo(struct xenvif_queue *queue); | 101 | static inline int tx_work_todo(struct xenvif_queue *queue); |
| 101 | 102 | ||
| @@ -655,15 +656,10 @@ static void xenvif_tx_err(struct xenvif_queue *queue, | |||
| 655 | unsigned long flags; | 656 | unsigned long flags; |
| 656 | 657 | ||
| 657 | do { | 658 | do { |
| 658 | int notify; | ||
| 659 | |||
| 660 | spin_lock_irqsave(&queue->response_lock, flags); | 659 | spin_lock_irqsave(&queue->response_lock, flags); |
| 661 | make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR); | 660 | make_tx_response(queue, txp, XEN_NETIF_RSP_ERROR); |
| 662 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); | 661 | push_tx_responses(queue); |
| 663 | spin_unlock_irqrestore(&queue->response_lock, flags); | 662 | spin_unlock_irqrestore(&queue->response_lock, flags); |
| 664 | if (notify) | ||
| 665 | notify_remote_via_irq(queue->tx_irq); | ||
| 666 | |||
| 667 | if (cons == end) | 663 | if (cons == end) |
| 668 | break; | 664 | break; |
| 669 | txp = RING_GET_REQUEST(&queue->tx, cons++); | 665 | txp = RING_GET_REQUEST(&queue->tx, cons++); |
| @@ -1657,7 +1653,6 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, | |||
| 1657 | { | 1653 | { |
| 1658 | struct pending_tx_info *pending_tx_info; | 1654 | struct pending_tx_info *pending_tx_info; |
| 1659 | pending_ring_idx_t index; | 1655 | pending_ring_idx_t index; |
| 1660 | int notify; | ||
| 1661 | unsigned long flags; | 1656 | unsigned long flags; |
| 1662 | 1657 | ||
| 1663 | pending_tx_info = &queue->pending_tx_info[pending_idx]; | 1658 | pending_tx_info = &queue->pending_tx_info[pending_idx]; |
| @@ -1673,12 +1668,9 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, | |||
| 1673 | index = pending_index(queue->pending_prod++); | 1668 | index = pending_index(queue->pending_prod++); |
| 1674 | queue->pending_ring[index] = pending_idx; | 1669 | queue->pending_ring[index] = pending_idx; |
| 1675 | 1670 | ||
| 1676 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); | 1671 | push_tx_responses(queue); |
| 1677 | 1672 | ||
| 1678 | spin_unlock_irqrestore(&queue->response_lock, flags); | 1673 | spin_unlock_irqrestore(&queue->response_lock, flags); |
| 1679 | |||
| 1680 | if (notify) | ||
| 1681 | notify_remote_via_irq(queue->tx_irq); | ||
| 1682 | } | 1674 | } |
| 1683 | 1675 | ||
| 1684 | 1676 | ||
| @@ -1699,6 +1691,15 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
| 1699 | queue->tx.rsp_prod_pvt = ++i; | 1691 | queue->tx.rsp_prod_pvt = ++i; |
| 1700 | } | 1692 | } |
| 1701 | 1693 | ||
| 1694 | static void push_tx_responses(struct xenvif_queue *queue) | ||
| 1695 | { | ||
| 1696 | int notify; | ||
| 1697 | |||
| 1698 | RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify); | ||
| 1699 | if (notify) | ||
| 1700 | notify_remote_via_irq(queue->tx_irq); | ||
| 1701 | } | ||
| 1702 | |||
| 1702 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, | 1703 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, |
| 1703 | u16 id, | 1704 | u16 id, |
| 1704 | s8 st, | 1705 | s8 st, |
diff --git a/drivers/of/base.c b/drivers/of/base.c index adb8764861c0..8f165b112e03 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
| @@ -715,13 +715,8 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent, | |||
| 715 | { | 715 | { |
| 716 | struct device_node *child; | 716 | struct device_node *child; |
| 717 | int len; | 717 | int len; |
| 718 | const char *end; | ||
| 719 | 718 | ||
| 720 | end = strchr(path, ':'); | 719 | len = strcspn(path, "/:"); |
| 721 | if (!end) | ||
| 722 | end = strchrnul(path, '/'); | ||
| 723 | |||
| 724 | len = end - path; | ||
| 725 | if (!len) | 720 | if (!len) |
| 726 | return NULL; | 721 | return NULL; |
| 727 | 722 | ||
| @@ -1893,10 +1888,8 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
| 1893 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); | 1888 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); |
| 1894 | if (IS_ENABLED(CONFIG_PPC) && !name) | 1889 | if (IS_ENABLED(CONFIG_PPC) && !name) |
| 1895 | name = of_get_property(of_aliases, "stdout", NULL); | 1890 | name = of_get_property(of_aliases, "stdout", NULL); |
| 1896 | if (name) { | 1891 | if (name) |
| 1897 | of_stdout = of_find_node_opts_by_path(name, &of_stdout_options); | 1892 | of_stdout = of_find_node_opts_by_path(name, &of_stdout_options); |
| 1898 | add_preferred_console("stdout-path", 0, NULL); | ||
| 1899 | } | ||
| 1900 | } | 1893 | } |
| 1901 | 1894 | ||
| 1902 | if (!of_aliases) | 1895 | if (!of_aliases) |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 0d7765807f49..1a7980692f25 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
| @@ -290,7 +290,7 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar | |||
| 290 | struct device_node *p; | 290 | struct device_node *p; |
| 291 | const __be32 *intspec, *tmp, *addr; | 291 | const __be32 *intspec, *tmp, *addr; |
| 292 | u32 intsize, intlen; | 292 | u32 intsize, intlen; |
| 293 | int i, res = -EINVAL; | 293 | int i, res; |
| 294 | 294 | ||
| 295 | pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); | 295 | pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); |
| 296 | 296 | ||
| @@ -323,15 +323,19 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar | |||
| 323 | 323 | ||
| 324 | /* Get size of interrupt specifier */ | 324 | /* Get size of interrupt specifier */ |
| 325 | tmp = of_get_property(p, "#interrupt-cells", NULL); | 325 | tmp = of_get_property(p, "#interrupt-cells", NULL); |
| 326 | if (tmp == NULL) | 326 | if (tmp == NULL) { |
| 327 | res = -EINVAL; | ||
| 327 | goto out; | 328 | goto out; |
| 329 | } | ||
| 328 | intsize = be32_to_cpu(*tmp); | 330 | intsize = be32_to_cpu(*tmp); |
| 329 | 331 | ||
| 330 | pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); | 332 | pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); |
| 331 | 333 | ||
| 332 | /* Check index */ | 334 | /* Check index */ |
| 333 | if ((index + 1) * intsize > intlen) | 335 | if ((index + 1) * intsize > intlen) { |
| 336 | res = -EINVAL; | ||
| 334 | goto out; | 337 | goto out; |
| 338 | } | ||
| 335 | 339 | ||
| 336 | /* Copy intspec into irq structure */ | 340 | /* Copy intspec into irq structure */ |
| 337 | intspec += index * intsize; | 341 | intspec += index * intsize; |
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index aba8946cac46..52c45c7df07f 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c | |||
| @@ -97,6 +97,11 @@ static void __init of_selftest_find_node_by_name(void) | |||
| 97 | "option path test, subcase #1 failed\n"); | 97 | "option path test, subcase #1 failed\n"); |
| 98 | of_node_put(np); | 98 | of_node_put(np); |
| 99 | 99 | ||
| 100 | np = of_find_node_opts_by_path("/testcase-data/testcase-device1:test/option", &options); | ||
| 101 | selftest(np && !strcmp("test/option", options), | ||
| 102 | "option path test, subcase #2 failed\n"); | ||
| 103 | of_node_put(np); | ||
| 104 | |||
| 100 | np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); | 105 | np = of_find_node_opts_by_path("/testcase-data:testoption", NULL); |
| 101 | selftest(np, "NULL option path test failed\n"); | 106 | selftest(np, "NULL option path test failed\n"); |
| 102 | of_node_put(np); | 107 | of_node_put(np); |
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 5afe03e28b91..2062c224e32f 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c | |||
| @@ -66,6 +66,10 @@ | |||
| 66 | #define BYT_DIR_MASK (BIT(1) | BIT(2)) | 66 | #define BYT_DIR_MASK (BIT(1) | BIT(2)) |
| 67 | #define BYT_TRIG_MASK (BIT(26) | BIT(25) | BIT(24)) | 67 | #define BYT_TRIG_MASK (BIT(26) | BIT(25) | BIT(24)) |
| 68 | 68 | ||
| 69 | #define BYT_CONF0_RESTORE_MASK (BYT_DIRECT_IRQ_EN | BYT_TRIG_MASK | \ | ||
| 70 | BYT_PIN_MUX) | ||
| 71 | #define BYT_VAL_RESTORE_MASK (BYT_DIR_MASK | BYT_LEVEL) | ||
| 72 | |||
| 69 | #define BYT_NGPIO_SCORE 102 | 73 | #define BYT_NGPIO_SCORE 102 |
| 70 | #define BYT_NGPIO_NCORE 28 | 74 | #define BYT_NGPIO_NCORE 28 |
| 71 | #define BYT_NGPIO_SUS 44 | 75 | #define BYT_NGPIO_SUS 44 |
| @@ -134,12 +138,18 @@ static struct pinctrl_gpio_range byt_ranges[] = { | |||
| 134 | }, | 138 | }, |
| 135 | }; | 139 | }; |
| 136 | 140 | ||
| 141 | struct byt_gpio_pin_context { | ||
| 142 | u32 conf0; | ||
| 143 | u32 val; | ||
| 144 | }; | ||
| 145 | |||
| 137 | struct byt_gpio { | 146 | struct byt_gpio { |
| 138 | struct gpio_chip chip; | 147 | struct gpio_chip chip; |
| 139 | struct platform_device *pdev; | 148 | struct platform_device *pdev; |
| 140 | spinlock_t lock; | 149 | spinlock_t lock; |
| 141 | void __iomem *reg_base; | 150 | void __iomem *reg_base; |
| 142 | struct pinctrl_gpio_range *range; | 151 | struct pinctrl_gpio_range *range; |
| 152 | struct byt_gpio_pin_context *saved_context; | ||
| 143 | }; | 153 | }; |
| 144 | 154 | ||
| 145 | #define to_byt_gpio(c) container_of(c, struct byt_gpio, chip) | 155 | #define to_byt_gpio(c) container_of(c, struct byt_gpio, chip) |
| @@ -158,40 +168,62 @@ static void __iomem *byt_gpio_reg(struct gpio_chip *chip, unsigned offset, | |||
| 158 | return vg->reg_base + reg_offset + reg; | 168 | return vg->reg_base + reg_offset + reg; |
| 159 | } | 169 | } |
| 160 | 170 | ||
| 161 | static bool is_special_pin(struct byt_gpio *vg, unsigned offset) | 171 | static void byt_gpio_clear_triggering(struct byt_gpio *vg, unsigned offset) |
| 172 | { | ||
| 173 | void __iomem *reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG); | ||
| 174 | unsigned long flags; | ||
| 175 | u32 value; | ||
| 176 | |||
| 177 | spin_lock_irqsave(&vg->lock, flags); | ||
| 178 | value = readl(reg); | ||
| 179 | value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); | ||
| 180 | writel(value, reg); | ||
| 181 | spin_unlock_irqrestore(&vg->lock, flags); | ||
| 182 | } | ||
| 183 | |||
| 184 | static u32 byt_get_gpio_mux(struct byt_gpio *vg, unsigned offset) | ||
| 162 | { | 185 | { |
| 163 | /* SCORE pin 92-93 */ | 186 | /* SCORE pin 92-93 */ |
| 164 | if (!strcmp(vg->range->name, BYT_SCORE_ACPI_UID) && | 187 | if (!strcmp(vg->range->name, BYT_SCORE_ACPI_UID) && |
| 165 | offset >= 92 && offset <= 93) | 188 | offset >= 92 && offset <= 93) |
| 166 | return true; | 189 | return 1; |
| 167 | 190 | ||
| 168 | /* SUS pin 11-21 */ | 191 | /* SUS pin 11-21 */ |
| 169 | if (!strcmp(vg->range->name, BYT_SUS_ACPI_UID) && | 192 | if (!strcmp(vg->range->name, BYT_SUS_ACPI_UID) && |
| 170 | offset >= 11 && offset <= 21) | 193 | offset >= 11 && offset <= 21) |
| 171 | return true; | 194 | return 1; |
| 172 | 195 | ||
| 173 | return false; | 196 | return 0; |
| 174 | } | 197 | } |
| 175 | 198 | ||
| 176 | static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) | 199 | static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) |
| 177 | { | 200 | { |
| 178 | struct byt_gpio *vg = to_byt_gpio(chip); | 201 | struct byt_gpio *vg = to_byt_gpio(chip); |
| 179 | void __iomem *reg = byt_gpio_reg(chip, offset, BYT_CONF0_REG); | 202 | void __iomem *reg = byt_gpio_reg(chip, offset, BYT_CONF0_REG); |
| 180 | u32 value; | 203 | u32 value, gpio_mux; |
| 181 | bool special; | ||
| 182 | 204 | ||
| 183 | /* | 205 | /* |
| 184 | * In most cases, func pin mux 000 means GPIO function. | 206 | * In most cases, func pin mux 000 means GPIO function. |
| 185 | * But, some pins may have func pin mux 001 represents | 207 | * But, some pins may have func pin mux 001 represents |
| 186 | * GPIO function. Only allow user to export pin with | 208 | * GPIO function. |
| 187 | * func pin mux preset as GPIO function by BIOS/FW. | 209 | * |
| 210 | * Because there are devices out there where some pins were not | ||
| 211 | * configured correctly we allow changing the mux value from | ||
| 212 | * request (but print out warning about that). | ||
| 188 | */ | 213 | */ |
| 189 | value = readl(reg) & BYT_PIN_MUX; | 214 | value = readl(reg) & BYT_PIN_MUX; |
| 190 | special = is_special_pin(vg, offset); | 215 | gpio_mux = byt_get_gpio_mux(vg, offset); |
| 191 | if ((special && value != 1) || (!special && value)) { | 216 | if (WARN_ON(gpio_mux != value)) { |
| 192 | dev_err(&vg->pdev->dev, | 217 | unsigned long flags; |
| 193 | "pin %u cannot be used as GPIO.\n", offset); | 218 | |
| 194 | return -EINVAL; | 219 | spin_lock_irqsave(&vg->lock, flags); |
| 220 | value = readl(reg) & ~BYT_PIN_MUX; | ||
| 221 | value |= gpio_mux; | ||
| 222 | writel(value, reg); | ||
| 223 | spin_unlock_irqrestore(&vg->lock, flags); | ||
| 224 | |||
| 225 | dev_warn(&vg->pdev->dev, | ||
| 226 | "pin %u forcibly re-configured as GPIO\n", offset); | ||
| 195 | } | 227 | } |
| 196 | 228 | ||
| 197 | pm_runtime_get(&vg->pdev->dev); | 229 | pm_runtime_get(&vg->pdev->dev); |
| @@ -202,14 +234,8 @@ static int byt_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
| 202 | static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) | 234 | static void byt_gpio_free(struct gpio_chip *chip, unsigned offset) |
| 203 | { | 235 | { |
| 204 | struct byt_gpio *vg = to_byt_gpio(chip); | 236 | struct byt_gpio *vg = to_byt_gpio(chip); |
| 205 | void __iomem *reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG); | ||
| 206 | u32 value; | ||
| 207 | |||
| 208 | /* clear interrupt triggering */ | ||
| 209 | value = readl(reg); | ||
| 210 | value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); | ||
| 211 | writel(value, reg); | ||
| 212 | 237 | ||
| 238 | byt_gpio_clear_triggering(vg, offset); | ||
| 213 | pm_runtime_put(&vg->pdev->dev); | 239 | pm_runtime_put(&vg->pdev->dev); |
| 214 | } | 240 | } |
| 215 | 241 | ||
| @@ -236,23 +262,13 @@ static int byt_irq_type(struct irq_data *d, unsigned type) | |||
| 236 | value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG | | 262 | value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG | |
| 237 | BYT_TRIG_LVL); | 263 | BYT_TRIG_LVL); |
| 238 | 264 | ||
| 239 | switch (type) { | ||
| 240 | case IRQ_TYPE_LEVEL_HIGH: | ||
| 241 | value |= BYT_TRIG_LVL; | ||
| 242 | case IRQ_TYPE_EDGE_RISING: | ||
| 243 | value |= BYT_TRIG_POS; | ||
| 244 | break; | ||
| 245 | case IRQ_TYPE_LEVEL_LOW: | ||
| 246 | value |= BYT_TRIG_LVL; | ||
| 247 | case IRQ_TYPE_EDGE_FALLING: | ||
| 248 | value |= BYT_TRIG_NEG; | ||
| 249 | break; | ||
| 250 | case IRQ_TYPE_EDGE_BOTH: | ||
| 251 | value |= (BYT_TRIG_NEG | BYT_TRIG_POS); | ||
| 252 | break; | ||
| 253 | } | ||
| 254 | writel(value, reg); | 265 | writel(value, reg); |
| 255 | 266 | ||
| 267 | if (type & IRQ_TYPE_EDGE_BOTH) | ||
| 268 | __irq_set_handler_locked(d->irq, handle_edge_irq); | ||
| 269 | else if (type & IRQ_TYPE_LEVEL_MASK) | ||
| 270 | __irq_set_handler_locked(d->irq, handle_level_irq); | ||
| 271 | |||
| 256 | spin_unlock_irqrestore(&vg->lock, flags); | 272 | spin_unlock_irqrestore(&vg->lock, flags); |
| 257 | 273 | ||
| 258 | return 0; | 274 | return 0; |
| @@ -410,58 +426,80 @@ static void byt_gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
| 410 | struct irq_data *data = irq_desc_get_irq_data(desc); | 426 | struct irq_data *data = irq_desc_get_irq_data(desc); |
| 411 | struct byt_gpio *vg = to_byt_gpio(irq_desc_get_handler_data(desc)); | 427 | struct byt_gpio *vg = to_byt_gpio(irq_desc_get_handler_data(desc)); |
| 412 | struct irq_chip *chip = irq_data_get_irq_chip(data); | 428 | struct irq_chip *chip = irq_data_get_irq_chip(data); |
| 413 | u32 base, pin, mask; | 429 | u32 base, pin; |
| 414 | void __iomem *reg; | 430 | void __iomem *reg; |
| 415 | u32 pending; | 431 | unsigned long pending; |
| 416 | unsigned virq; | 432 | unsigned virq; |
| 417 | int looplimit = 0; | ||
| 418 | 433 | ||
| 419 | /* check from GPIO controller which pin triggered the interrupt */ | 434 | /* check from GPIO controller which pin triggered the interrupt */ |
| 420 | for (base = 0; base < vg->chip.ngpio; base += 32) { | 435 | for (base = 0; base < vg->chip.ngpio; base += 32) { |
| 421 | |||
| 422 | reg = byt_gpio_reg(&vg->chip, base, BYT_INT_STAT_REG); | 436 | reg = byt_gpio_reg(&vg->chip, base, BYT_INT_STAT_REG); |
| 423 | 437 | pending = readl(reg); | |
| 424 | while ((pending = readl(reg))) { | 438 | for_each_set_bit(pin, &pending, 32) { |
| 425 | pin = __ffs(pending); | ||
| 426 | mask = BIT(pin); | ||
| 427 | /* Clear before handling so we can't lose an edge */ | ||
| 428 | writel(mask, reg); | ||
| 429 | |||
| 430 | virq = irq_find_mapping(vg->chip.irqdomain, base + pin); | 439 | virq = irq_find_mapping(vg->chip.irqdomain, base + pin); |
| 431 | generic_handle_irq(virq); | 440 | generic_handle_irq(virq); |
| 432 | |||
| 433 | /* In case bios or user sets triggering incorretly a pin | ||
| 434 | * might remain in "interrupt triggered" state. | ||
| 435 | */ | ||
| 436 | if (looplimit++ > 32) { | ||
| 437 | dev_err(&vg->pdev->dev, | ||
| 438 | "Gpio %d interrupt flood, disabling\n", | ||
| 439 | base + pin); | ||
| 440 | |||
| 441 | reg = byt_gpio_reg(&vg->chip, base + pin, | ||
| 442 | BYT_CONF0_REG); | ||
| 443 | mask = readl(reg); | ||
| 444 | mask &= ~(BYT_TRIG_NEG | BYT_TRIG_POS | | ||
| 445 | BYT_TRIG_LVL); | ||
| 446 | writel(mask, reg); | ||
| 447 | mask = readl(reg); /* flush */ | ||
| 448 | break; | ||
| 449 | } | ||
| 450 | } | 441 | } |
| 451 | } | 442 | } |
| 452 | chip->irq_eoi(data); | 443 | chip->irq_eoi(data); |
| 453 | } | 444 | } |
| 454 | 445 | ||
| 446 | static void byt_irq_ack(struct irq_data *d) | ||
| 447 | { | ||
| 448 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | ||
| 449 | struct byt_gpio *vg = to_byt_gpio(gc); | ||
| 450 | unsigned offset = irqd_to_hwirq(d); | ||
| 451 | void __iomem *reg; | ||
| 452 | |||
| 453 | reg = byt_gpio_reg(&vg->chip, offset, BYT_INT_STAT_REG); | ||
| 454 | writel(BIT(offset % 32), reg); | ||
| 455 | } | ||
| 456 | |||
| 455 | static void byt_irq_unmask(struct irq_data *d) | 457 | static void byt_irq_unmask(struct irq_data *d) |
| 456 | { | 458 | { |
| 459 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | ||
| 460 | struct byt_gpio *vg = to_byt_gpio(gc); | ||
| 461 | unsigned offset = irqd_to_hwirq(d); | ||
| 462 | unsigned long flags; | ||
| 463 | void __iomem *reg; | ||
| 464 | u32 value; | ||
| 465 | |||
| 466 | spin_lock_irqsave(&vg->lock, flags); | ||
| 467 | |||
| 468 | reg = byt_gpio_reg(&vg->chip, offset, BYT_CONF0_REG); | ||
| 469 | value = readl(reg); | ||
| 470 | |||
| 471 | switch (irqd_get_trigger_type(d)) { | ||
| 472 | case IRQ_TYPE_LEVEL_HIGH: | ||
| 473 | value |= BYT_TRIG_LVL; | ||
| 474 | case IRQ_TYPE_EDGE_RISING: | ||
| 475 | value |= BYT_TRIG_POS; | ||
| 476 | break; | ||
| 477 | case IRQ_TYPE_LEVEL_LOW: | ||
| 478 | value |= BYT_TRIG_LVL; | ||
| 479 | case IRQ_TYPE_EDGE_FALLING: | ||
| 480 | value |= BYT_TRIG_NEG; | ||
| 481 | break; | ||
| 482 | case IRQ_TYPE_EDGE_BOTH: | ||
| 483 | value |= (BYT_TRIG_NEG | BYT_TRIG_POS); | ||
| 484 | break; | ||
| 485 | } | ||
| 486 | |||
| 487 | writel(value, reg); | ||
| 488 | |||
| 489 | spin_unlock_irqrestore(&vg->lock, flags); | ||
| 457 | } | 490 | } |
| 458 | 491 | ||
| 459 | static void byt_irq_mask(struct irq_data *d) | 492 | static void byt_irq_mask(struct irq_data *d) |
| 460 | { | 493 | { |
| 494 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | ||
| 495 | struct byt_gpio *vg = to_byt_gpio(gc); | ||
| 496 | |||
| 497 | byt_gpio_clear_triggering(vg, irqd_to_hwirq(d)); | ||
| 461 | } | 498 | } |
| 462 | 499 | ||
| 463 | static struct irq_chip byt_irqchip = { | 500 | static struct irq_chip byt_irqchip = { |
| 464 | .name = "BYT-GPIO", | 501 | .name = "BYT-GPIO", |
| 502 | .irq_ack = byt_irq_ack, | ||
| 465 | .irq_mask = byt_irq_mask, | 503 | .irq_mask = byt_irq_mask, |
| 466 | .irq_unmask = byt_irq_unmask, | 504 | .irq_unmask = byt_irq_unmask, |
| 467 | .irq_set_type = byt_irq_type, | 505 | .irq_set_type = byt_irq_type, |
| @@ -472,6 +510,21 @@ static void byt_gpio_irq_init_hw(struct byt_gpio *vg) | |||
| 472 | { | 510 | { |
| 473 | void __iomem *reg; | 511 | void __iomem *reg; |
| 474 | u32 base, value; | 512 | u32 base, value; |
| 513 | int i; | ||
| 514 | |||
| 515 | /* | ||
| 516 | * Clear interrupt triggers for all pins that are GPIOs and | ||
| 517 | * do not use direct IRQ mode. This will prevent spurious | ||
| 518 | * interrupts from misconfigured pins. | ||
| 519 | */ | ||
| 520 | for (i = 0; i < vg->chip.ngpio; i++) { | ||
| 521 | value = readl(byt_gpio_reg(&vg->chip, i, BYT_CONF0_REG)); | ||
| 522 | if ((value & BYT_PIN_MUX) == byt_get_gpio_mux(vg, i) && | ||
| 523 | !(value & BYT_DIRECT_IRQ_EN)) { | ||
| 524 | byt_gpio_clear_triggering(vg, i); | ||
| 525 | dev_dbg(&vg->pdev->dev, "disabling GPIO %d\n", i); | ||
| 526 | } | ||
| 527 | } | ||
| 475 | 528 | ||
| 476 | /* clear interrupt status trigger registers */ | 529 | /* clear interrupt status trigger registers */ |
| 477 | for (base = 0; base < vg->chip.ngpio; base += 32) { | 530 | for (base = 0; base < vg->chip.ngpio; base += 32) { |
| @@ -541,6 +594,11 @@ static int byt_gpio_probe(struct platform_device *pdev) | |||
| 541 | gc->can_sleep = false; | 594 | gc->can_sleep = false; |
| 542 | gc->dev = dev; | 595 | gc->dev = dev; |
| 543 | 596 | ||
| 597 | #ifdef CONFIG_PM_SLEEP | ||
| 598 | vg->saved_context = devm_kcalloc(&pdev->dev, gc->ngpio, | ||
| 599 | sizeof(*vg->saved_context), GFP_KERNEL); | ||
| 600 | #endif | ||
| 601 | |||
| 544 | ret = gpiochip_add(gc); | 602 | ret = gpiochip_add(gc); |
| 545 | if (ret) { | 603 | if (ret) { |
| 546 | dev_err(&pdev->dev, "failed adding byt-gpio chip\n"); | 604 | dev_err(&pdev->dev, "failed adding byt-gpio chip\n"); |
| @@ -569,6 +627,69 @@ static int byt_gpio_probe(struct platform_device *pdev) | |||
| 569 | return 0; | 627 | return 0; |
| 570 | } | 628 | } |
| 571 | 629 | ||
| 630 | #ifdef CONFIG_PM_SLEEP | ||
| 631 | static int byt_gpio_suspend(struct device *dev) | ||
| 632 | { | ||
| 633 | struct platform_device *pdev = to_platform_device(dev); | ||
| 634 | struct byt_gpio *vg = platform_get_drvdata(pdev); | ||
| 635 | int i; | ||
| 636 | |||
| 637 | for (i = 0; i < vg->chip.ngpio; i++) { | ||
| 638 | void __iomem *reg; | ||
| 639 | u32 value; | ||
| 640 | |||
| 641 | reg = byt_gpio_reg(&vg->chip, i, BYT_CONF0_REG); | ||
| 642 | value = readl(reg) & BYT_CONF0_RESTORE_MASK; | ||
| 643 | vg->saved_context[i].conf0 = value; | ||
| 644 | |||
| 645 | reg = byt_gpio_reg(&vg->chip, i, BYT_VAL_REG); | ||
| 646 | value = readl(reg) & BYT_VAL_RESTORE_MASK; | ||
| 647 | vg->saved_context[i].val = value; | ||
| 648 | } | ||
| 649 | |||
| 650 | return 0; | ||
| 651 | } | ||
| 652 | |||
| 653 | static int byt_gpio_resume(struct device *dev) | ||
| 654 | { | ||
| 655 | struct platform_device *pdev = to_platform_device(dev); | ||
| 656 | struct byt_gpio *vg = platform_get_drvdata(pdev); | ||
| 657 | int i; | ||
| 658 | |||
| 659 | for (i = 0; i < vg->chip.ngpio; i++) { | ||
| 660 | void __iomem *reg; | ||
| 661 | u32 value; | ||
| 662 | |||
| 663 | reg = byt_gpio_reg(&vg->chip, i, BYT_CONF0_REG); | ||
| 664 | value = readl(reg); | ||
| 665 | if ((value & BYT_CONF0_RESTORE_MASK) != | ||
| 666 | vg->saved_context[i].conf0) { | ||
| 667 | value &= ~BYT_CONF0_RESTORE_MASK; | ||
| 668 | value |= vg->saved_context[i].conf0; | ||
| 669 | writel(value, reg); | ||
| 670 | dev_info(dev, "restored pin %d conf0 %#08x", i, value); | ||
| 671 | } | ||
| 672 | |||
| 673 | reg = byt_gpio_reg(&vg->chip, i, BYT_VAL_REG); | ||
| 674 | value = readl(reg); | ||
| 675 | if ((value & BYT_VAL_RESTORE_MASK) != | ||
| 676 | vg->saved_context[i].val) { | ||
| 677 | u32 v; | ||
| 678 | |||
| 679 | v = value & ~BYT_VAL_RESTORE_MASK; | ||
| 680 | v |= vg->saved_context[i].val; | ||
| 681 | if (v != value) { | ||
| 682 | writel(v, reg); | ||
| 683 | dev_dbg(dev, "restored pin %d val %#08x\n", | ||
| 684 | i, v); | ||
| 685 | } | ||
| 686 | } | ||
| 687 | } | ||
| 688 | |||
| 689 | return 0; | ||
| 690 | } | ||
| 691 | #endif | ||
| 692 | |||
| 572 | static int byt_gpio_runtime_suspend(struct device *dev) | 693 | static int byt_gpio_runtime_suspend(struct device *dev) |
| 573 | { | 694 | { |
| 574 | return 0; | 695 | return 0; |
| @@ -580,8 +701,9 @@ static int byt_gpio_runtime_resume(struct device *dev) | |||
| 580 | } | 701 | } |
| 581 | 702 | ||
| 582 | static const struct dev_pm_ops byt_gpio_pm_ops = { | 703 | static const struct dev_pm_ops byt_gpio_pm_ops = { |
| 583 | .runtime_suspend = byt_gpio_runtime_suspend, | 704 | SET_LATE_SYSTEM_SLEEP_PM_OPS(byt_gpio_suspend, byt_gpio_resume) |
| 584 | .runtime_resume = byt_gpio_runtime_resume, | 705 | SET_RUNTIME_PM_OPS(byt_gpio_runtime_suspend, byt_gpio_runtime_resume, |
| 706 | NULL) | ||
| 585 | }; | 707 | }; |
| 586 | 708 | ||
| 587 | static const struct acpi_device_id byt_gpio_acpi_match[] = { | 709 | static const struct acpi_device_id byt_gpio_acpi_match[] = { |
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 3034fd03bced..82f691eeeec4 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c | |||
| @@ -1226,6 +1226,7 @@ static int chv_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
| 1226 | static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | 1226 | static int chv_gpio_direction_output(struct gpio_chip *chip, unsigned offset, |
| 1227 | int value) | 1227 | int value) |
| 1228 | { | 1228 | { |
| 1229 | chv_gpio_set(chip, offset, value); | ||
| 1229 | return pinctrl_gpio_direction_output(chip->base + offset); | 1230 | return pinctrl_gpio_direction_output(chip->base + offset); |
| 1230 | } | 1231 | } |
| 1231 | 1232 | ||
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index f4cd0b9b2438..a4814066ea08 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
| @@ -1477,28 +1477,25 @@ static void gpio_irq_ack(struct irq_data *d) | |||
| 1477 | /* the interrupt is already cleared before by reading ISR */ | 1477 | /* the interrupt is already cleared before by reading ISR */ |
| 1478 | } | 1478 | } |
| 1479 | 1479 | ||
| 1480 | static unsigned int gpio_irq_startup(struct irq_data *d) | 1480 | static int gpio_irq_request_res(struct irq_data *d) |
| 1481 | { | 1481 | { |
| 1482 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); | 1482 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); |
| 1483 | unsigned pin = d->hwirq; | 1483 | unsigned pin = d->hwirq; |
| 1484 | int ret; | 1484 | int ret; |
| 1485 | 1485 | ||
| 1486 | ret = gpiochip_lock_as_irq(&at91_gpio->chip, pin); | 1486 | ret = gpiochip_lock_as_irq(&at91_gpio->chip, pin); |
| 1487 | if (ret) { | 1487 | if (ret) |
| 1488 | dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n", | 1488 | dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n", |
| 1489 | d->hwirq); | 1489 | d->hwirq); |
| 1490 | return ret; | 1490 | |
| 1491 | } | 1491 | return ret; |
| 1492 | gpio_irq_unmask(d); | ||
| 1493 | return 0; | ||
| 1494 | } | 1492 | } |
| 1495 | 1493 | ||
| 1496 | static void gpio_irq_shutdown(struct irq_data *d) | 1494 | static void gpio_irq_release_res(struct irq_data *d) |
| 1497 | { | 1495 | { |
| 1498 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); | 1496 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); |
| 1499 | unsigned pin = d->hwirq; | 1497 | unsigned pin = d->hwirq; |
| 1500 | 1498 | ||
| 1501 | gpio_irq_mask(d); | ||
| 1502 | gpiochip_unlock_as_irq(&at91_gpio->chip, pin); | 1499 | gpiochip_unlock_as_irq(&at91_gpio->chip, pin); |
| 1503 | } | 1500 | } |
| 1504 | 1501 | ||
| @@ -1577,8 +1574,8 @@ void at91_pinctrl_gpio_resume(void) | |||
| 1577 | static struct irq_chip gpio_irqchip = { | 1574 | static struct irq_chip gpio_irqchip = { |
| 1578 | .name = "GPIO", | 1575 | .name = "GPIO", |
| 1579 | .irq_ack = gpio_irq_ack, | 1576 | .irq_ack = gpio_irq_ack, |
| 1580 | .irq_startup = gpio_irq_startup, | 1577 | .irq_request_resources = gpio_irq_request_res, |
| 1581 | .irq_shutdown = gpio_irq_shutdown, | 1578 | .irq_release_resources = gpio_irq_release_res, |
| 1582 | .irq_disable = gpio_irq_mask, | 1579 | .irq_disable = gpio_irq_mask, |
| 1583 | .irq_mask = gpio_irq_mask, | 1580 | .irq_mask = gpio_irq_mask, |
| 1584 | .irq_unmask = gpio_irq_unmask, | 1581 | .irq_unmask = gpio_irq_unmask, |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c index 24c5d88f943f..3c68a8e5e0dd 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c +++ b/drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | |||
| @@ -1011,6 +1011,7 @@ static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = { | |||
| 1011 | .pins = sun4i_a10_pins, | 1011 | .pins = sun4i_a10_pins, |
| 1012 | .npins = ARRAY_SIZE(sun4i_a10_pins), | 1012 | .npins = ARRAY_SIZE(sun4i_a10_pins), |
| 1013 | .irq_banks = 1, | 1013 | .irq_banks = 1, |
| 1014 | .irq_read_needs_mux = true, | ||
| 1014 | }; | 1015 | }; |
| 1015 | 1016 | ||
| 1016 | static int sun4i_a10_pinctrl_probe(struct platform_device *pdev) | 1017 | static int sun4i_a10_pinctrl_probe(struct platform_device *pdev) |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 3d0744337736..f8e171b76693 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 30 | 30 | ||
| 31 | #include "../core.h" | 31 | #include "../core.h" |
| 32 | #include "../../gpio/gpiolib.h" | ||
| 32 | #include "pinctrl-sunxi.h" | 33 | #include "pinctrl-sunxi.h" |
| 33 | 34 | ||
| 34 | static struct irq_chip sunxi_pinctrl_edge_irq_chip; | 35 | static struct irq_chip sunxi_pinctrl_edge_irq_chip; |
| @@ -464,10 +465,19 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip, | |||
| 464 | static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset) | 465 | static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset) |
| 465 | { | 466 | { |
| 466 | struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev); | 467 | struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev); |
| 467 | |||
| 468 | u32 reg = sunxi_data_reg(offset); | 468 | u32 reg = sunxi_data_reg(offset); |
| 469 | u8 index = sunxi_data_offset(offset); | 469 | u8 index = sunxi_data_offset(offset); |
| 470 | u32 val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK; | 470 | u32 set_mux = pctl->desc->irq_read_needs_mux && |
| 471 | test_bit(FLAG_USED_AS_IRQ, &chip->desc[offset].flags); | ||
| 472 | u32 val; | ||
| 473 | |||
| 474 | if (set_mux) | ||
| 475 | sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_INPUT); | ||
| 476 | |||
| 477 | val = (readl(pctl->membase + reg) >> index) & DATA_PINS_MASK; | ||
| 478 | |||
| 479 | if (set_mux) | ||
| 480 | sunxi_pmx_set(pctl->pctl_dev, offset, SUN4I_FUNC_IRQ); | ||
| 471 | 481 | ||
| 472 | return val; | 482 | return val; |
| 473 | } | 483 | } |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.h b/drivers/pinctrl/sunxi/pinctrl-sunxi.h index 5a51523a3459..e248e81a0f9e 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.h | |||
| @@ -77,6 +77,9 @@ | |||
| 77 | #define IRQ_LEVEL_LOW 0x03 | 77 | #define IRQ_LEVEL_LOW 0x03 |
| 78 | #define IRQ_EDGE_BOTH 0x04 | 78 | #define IRQ_EDGE_BOTH 0x04 |
| 79 | 79 | ||
| 80 | #define SUN4I_FUNC_INPUT 0 | ||
| 81 | #define SUN4I_FUNC_IRQ 6 | ||
| 82 | |||
| 80 | struct sunxi_desc_function { | 83 | struct sunxi_desc_function { |
| 81 | const char *name; | 84 | const char *name; |
| 82 | u8 muxval; | 85 | u8 muxval; |
| @@ -94,6 +97,7 @@ struct sunxi_pinctrl_desc { | |||
| 94 | int npins; | 97 | int npins; |
| 95 | unsigned pin_base; | 98 | unsigned pin_base; |
| 96 | unsigned irq_banks; | 99 | unsigned irq_banks; |
| 100 | bool irq_read_needs_mux; | ||
| 97 | }; | 101 | }; |
| 98 | 102 | ||
| 99 | struct sunxi_pinctrl_function { | 103 | struct sunxi_pinctrl_function { |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1245dca79009..a4a8a6dc60c4 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -1839,10 +1839,12 @@ static int _regulator_do_enable(struct regulator_dev *rdev) | |||
| 1839 | } | 1839 | } |
| 1840 | 1840 | ||
| 1841 | if (rdev->ena_pin) { | 1841 | if (rdev->ena_pin) { |
| 1842 | ret = regulator_ena_gpio_ctrl(rdev, true); | 1842 | if (!rdev->ena_gpio_state) { |
| 1843 | if (ret < 0) | 1843 | ret = regulator_ena_gpio_ctrl(rdev, true); |
| 1844 | return ret; | 1844 | if (ret < 0) |
| 1845 | rdev->ena_gpio_state = 1; | 1845 | return ret; |
| 1846 | rdev->ena_gpio_state = 1; | ||
| 1847 | } | ||
| 1846 | } else if (rdev->desc->ops->enable) { | 1848 | } else if (rdev->desc->ops->enable) { |
| 1847 | ret = rdev->desc->ops->enable(rdev); | 1849 | ret = rdev->desc->ops->enable(rdev); |
| 1848 | if (ret < 0) | 1850 | if (ret < 0) |
| @@ -1939,10 +1941,12 @@ static int _regulator_do_disable(struct regulator_dev *rdev) | |||
| 1939 | trace_regulator_disable(rdev_get_name(rdev)); | 1941 | trace_regulator_disable(rdev_get_name(rdev)); |
| 1940 | 1942 | ||
| 1941 | if (rdev->ena_pin) { | 1943 | if (rdev->ena_pin) { |
| 1942 | ret = regulator_ena_gpio_ctrl(rdev, false); | 1944 | if (rdev->ena_gpio_state) { |
| 1943 | if (ret < 0) | 1945 | ret = regulator_ena_gpio_ctrl(rdev, false); |
| 1944 | return ret; | 1946 | if (ret < 0) |
| 1945 | rdev->ena_gpio_state = 0; | 1947 | return ret; |
| 1948 | rdev->ena_gpio_state = 0; | ||
| 1949 | } | ||
| 1946 | 1950 | ||
| 1947 | } else if (rdev->desc->ops->disable) { | 1951 | } else if (rdev->desc->ops->disable) { |
| 1948 | ret = rdev->desc->ops->disable(rdev); | 1952 | ret = rdev->desc->ops->disable(rdev); |
| @@ -3626,12 +3630,6 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
| 3626 | config->ena_gpio, ret); | 3630 | config->ena_gpio, ret); |
| 3627 | goto wash; | 3631 | goto wash; |
| 3628 | } | 3632 | } |
| 3629 | |||
| 3630 | if (config->ena_gpio_flags & GPIOF_OUT_INIT_HIGH) | ||
| 3631 | rdev->ena_gpio_state = 1; | ||
| 3632 | |||
| 3633 | if (config->ena_gpio_invert) | ||
| 3634 | rdev->ena_gpio_state = !rdev->ena_gpio_state; | ||
| 3635 | } | 3633 | } |
| 3636 | 3634 | ||
| 3637 | /* set regulator constraints */ | 3635 | /* set regulator constraints */ |
| @@ -3800,9 +3798,11 @@ int regulator_suspend_finish(void) | |||
| 3800 | list_for_each_entry(rdev, ®ulator_list, list) { | 3798 | list_for_each_entry(rdev, ®ulator_list, list) { |
| 3801 | mutex_lock(&rdev->mutex); | 3799 | mutex_lock(&rdev->mutex); |
| 3802 | if (rdev->use_count > 0 || rdev->constraints->always_on) { | 3800 | if (rdev->use_count > 0 || rdev->constraints->always_on) { |
| 3803 | error = _regulator_do_enable(rdev); | 3801 | if (!_regulator_is_enabled(rdev)) { |
| 3804 | if (error) | 3802 | error = _regulator_do_enable(rdev); |
| 3805 | ret = error; | 3803 | if (error) |
| 3804 | ret = error; | ||
| 3805 | } | ||
| 3806 | } else { | 3806 | } else { |
| 3807 | if (!have_full_constraints()) | 3807 | if (!have_full_constraints()) |
| 3808 | goto unlock; | 3808 | goto unlock; |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index e2cffe01b807..fb991ec76423 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
| 20 | #include <linux/of.h> | ||
| 20 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
| 21 | #include <linux/regulator/driver.h> | 22 | #include <linux/regulator/driver.h> |
| 22 | #include <linux/regulator/machine.h> | 23 | #include <linux/regulator/machine.h> |
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 92f6af6da699..73354ee27877 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
| @@ -951,6 +951,7 @@ static int rpmsg_probe(struct virtio_device *vdev) | |||
| 951 | void *bufs_va; | 951 | void *bufs_va; |
| 952 | int err = 0, i; | 952 | int err = 0, i; |
| 953 | size_t total_buf_space; | 953 | size_t total_buf_space; |
| 954 | bool notify; | ||
| 954 | 955 | ||
| 955 | vrp = kzalloc(sizeof(*vrp), GFP_KERNEL); | 956 | vrp = kzalloc(sizeof(*vrp), GFP_KERNEL); |
| 956 | if (!vrp) | 957 | if (!vrp) |
| @@ -1030,8 +1031,22 @@ static int rpmsg_probe(struct virtio_device *vdev) | |||
| 1030 | } | 1031 | } |
| 1031 | } | 1032 | } |
| 1032 | 1033 | ||
| 1034 | /* | ||
| 1035 | * Prepare to kick but don't notify yet - we can't do this before | ||
| 1036 | * device is ready. | ||
| 1037 | */ | ||
| 1038 | notify = virtqueue_kick_prepare(vrp->rvq); | ||
| 1039 | |||
| 1040 | /* From this point on, we can notify and get callbacks. */ | ||
| 1041 | virtio_device_ready(vdev); | ||
| 1042 | |||
| 1033 | /* tell the remote processor it can start sending messages */ | 1043 | /* tell the remote processor it can start sending messages */ |
| 1034 | virtqueue_kick(vrp->rvq); | 1044 | /* |
| 1045 | * this might be concurrent with callbacks, but we are only | ||
| 1046 | * doing notify, not a full kick here, so that's ok. | ||
| 1047 | */ | ||
| 1048 | if (notify) | ||
| 1049 | virtqueue_notify(vrp->rvq); | ||
| 1035 | 1050 | ||
| 1036 | dev_info(&vdev->dev, "rpmsg host is online\n"); | 1051 | dev_info(&vdev->dev, "rpmsg host is online\n"); |
| 1037 | 1052 | ||
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 99f43b7fc9ab..ab4879e12ea7 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
| @@ -1596,7 +1596,7 @@ static int tcm_qla2xxx_check_initiator_node_acl( | |||
| 1596 | /* | 1596 | /* |
| 1597 | * Finally register the new FC Nexus with TCM | 1597 | * Finally register the new FC Nexus with TCM |
| 1598 | */ | 1598 | */ |
| 1599 | __transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess); | 1599 | transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess); |
| 1600 | 1600 | ||
| 1601 | return 0; | 1601 | return 0; |
| 1602 | } | 1602 | } |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 50bad55a0c42..2accb6e47beb 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
| @@ -4256,11 +4256,17 @@ int iscsit_close_connection( | |||
| 4256 | pr_debug("Closing iSCSI connection CID %hu on SID:" | 4256 | pr_debug("Closing iSCSI connection CID %hu on SID:" |
| 4257 | " %u\n", conn->cid, sess->sid); | 4257 | " %u\n", conn->cid, sess->sid); |
| 4258 | /* | 4258 | /* |
| 4259 | * Always up conn_logout_comp just in case the RX Thread is sleeping | 4259 | * Always up conn_logout_comp for the traditional TCP case just in case |
| 4260 | * and the logout response never got sent because the connection | 4260 | * the RX Thread in iscsi_target_rx_opcode() is sleeping and the logout |
| 4261 | * failed. | 4261 | * response never got sent because the connection failed. |
| 4262 | * | ||
| 4263 | * However for iser-target, isert_wait4logout() is using conn_logout_comp | ||
| 4264 | * to signal logout response TX interrupt completion. Go ahead and skip | ||
| 4265 | * this for iser since isert_rx_opcode() does not wait on logout failure, | ||
| 4266 | * and to avoid iscsi_conn pointer dereference in iser-target code. | ||
| 4262 | */ | 4267 | */ |
| 4263 | complete(&conn->conn_logout_comp); | 4268 | if (conn->conn_transport->transport_type == ISCSI_TCP) |
| 4269 | complete(&conn->conn_logout_comp); | ||
| 4264 | 4270 | ||
| 4265 | iscsi_release_thread_set(conn); | 4271 | iscsi_release_thread_set(conn); |
| 4266 | 4272 | ||
diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c index 1c197bad6132..bdd8731a4daa 100644 --- a/drivers/target/iscsi/iscsi_target_erl0.c +++ b/drivers/target/iscsi/iscsi_target_erl0.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <target/target_core_fabric.h> | 22 | #include <target/target_core_fabric.h> |
| 23 | 23 | ||
| 24 | #include <target/iscsi/iscsi_target_core.h> | 24 | #include <target/iscsi/iscsi_target_core.h> |
| 25 | #include <target/iscsi/iscsi_transport.h> | ||
| 26 | #include "iscsi_target_seq_pdu_list.h" | 25 | #include "iscsi_target_seq_pdu_list.h" |
| 27 | #include "iscsi_target_tq.h" | 26 | #include "iscsi_target_tq.h" |
| 28 | #include "iscsi_target_erl0.h" | 27 | #include "iscsi_target_erl0.h" |
| @@ -940,8 +939,7 @@ void iscsit_take_action_for_connection_exit(struct iscsi_conn *conn) | |||
| 940 | 939 | ||
| 941 | if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) { | 940 | if (conn->conn_state == TARG_CONN_STATE_IN_LOGOUT) { |
| 942 | spin_unlock_bh(&conn->state_lock); | 941 | spin_unlock_bh(&conn->state_lock); |
| 943 | if (conn->conn_transport->transport_type == ISCSI_TCP) | 942 | iscsit_close_connection(conn); |
| 944 | iscsit_close_connection(conn); | ||
| 945 | return; | 943 | return; |
| 946 | } | 944 | } |
| 947 | 945 | ||
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6b3c32954689..c36bd7c29136 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
| @@ -953,11 +953,8 @@ static int tcm_loop_make_nexus( | |||
| 953 | transport_free_session(tl_nexus->se_sess); | 953 | transport_free_session(tl_nexus->se_sess); |
| 954 | goto out; | 954 | goto out; |
| 955 | } | 955 | } |
| 956 | /* | 956 | /* Now, register the SAS I_T Nexus as active. */ |
| 957 | * Now, register the SAS I_T Nexus as active with the call to | 957 | transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, |
| 958 | * transport_register_session() | ||
| 959 | */ | ||
| 960 | __transport_register_session(se_tpg, tl_nexus->se_sess->se_node_acl, | ||
| 961 | tl_nexus->se_sess, tl_nexus); | 958 | tl_nexus->se_sess, tl_nexus); |
| 962 | tl_tpg->tl_nexus = tl_nexus; | 959 | tl_tpg->tl_nexus = tl_nexus; |
| 963 | pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" | 960 | pr_debug("TCM_Loop_ConfigFS: Established I_T Nexus to emulated" |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 58f49ff69b14..79b4ec3ca2db 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
| @@ -650,6 +650,18 @@ static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) | |||
| 650 | return aligned_max_sectors; | 650 | return aligned_max_sectors; |
| 651 | } | 651 | } |
| 652 | 652 | ||
| 653 | bool se_dev_check_wce(struct se_device *dev) | ||
| 654 | { | ||
| 655 | bool wce = false; | ||
| 656 | |||
| 657 | if (dev->transport->get_write_cache) | ||
| 658 | wce = dev->transport->get_write_cache(dev); | ||
| 659 | else if (dev->dev_attrib.emulate_write_cache > 0) | ||
| 660 | wce = true; | ||
| 661 | |||
| 662 | return wce; | ||
| 663 | } | ||
| 664 | |||
| 653 | int se_dev_set_max_unmap_lba_count( | 665 | int se_dev_set_max_unmap_lba_count( |
| 654 | struct se_device *dev, | 666 | struct se_device *dev, |
| 655 | u32 max_unmap_lba_count) | 667 | u32 max_unmap_lba_count) |
| @@ -767,6 +779,16 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | |||
| 767 | pr_err("Illegal value %d\n", flag); | 779 | pr_err("Illegal value %d\n", flag); |
| 768 | return -EINVAL; | 780 | return -EINVAL; |
| 769 | } | 781 | } |
| 782 | if (flag && | ||
| 783 | dev->transport->get_write_cache) { | ||
| 784 | pr_err("emulate_fua_write not supported for this device\n"); | ||
| 785 | return -EINVAL; | ||
| 786 | } | ||
| 787 | if (dev->export_count) { | ||
| 788 | pr_err("emulate_fua_write cannot be changed with active" | ||
| 789 | " exports: %d\n", dev->export_count); | ||
| 790 | return -EINVAL; | ||
| 791 | } | ||
| 770 | dev->dev_attrib.emulate_fua_write = flag; | 792 | dev->dev_attrib.emulate_fua_write = flag; |
| 771 | pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", | 793 | pr_debug("dev[%p]: SE Device Forced Unit Access WRITEs: %d\n", |
| 772 | dev, dev->dev_attrib.emulate_fua_write); | 794 | dev, dev->dev_attrib.emulate_fua_write); |
| @@ -801,7 +823,11 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | |||
| 801 | pr_err("emulate_write_cache not supported for this device\n"); | 823 | pr_err("emulate_write_cache not supported for this device\n"); |
| 802 | return -EINVAL; | 824 | return -EINVAL; |
| 803 | } | 825 | } |
| 804 | 826 | if (dev->export_count) { | |
| 827 | pr_err("emulate_write_cache cannot be changed with active" | ||
| 828 | " exports: %d\n", dev->export_count); | ||
| 829 | return -EINVAL; | ||
| 830 | } | ||
| 805 | dev->dev_attrib.emulate_write_cache = flag; | 831 | dev->dev_attrib.emulate_write_cache = flag; |
| 806 | pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", | 832 | pr_debug("dev[%p]: SE Device WRITE_CACHE_EMULATION flag: %d\n", |
| 807 | dev, dev->dev_attrib.emulate_write_cache); | 833 | dev, dev->dev_attrib.emulate_write_cache); |
| @@ -1534,8 +1560,6 @@ int target_configure_device(struct se_device *dev) | |||
| 1534 | ret = dev->transport->configure_device(dev); | 1560 | ret = dev->transport->configure_device(dev); |
| 1535 | if (ret) | 1561 | if (ret) |
| 1536 | goto out; | 1562 | goto out; |
| 1537 | dev->dev_flags |= DF_CONFIGURED; | ||
| 1538 | |||
| 1539 | /* | 1563 | /* |
| 1540 | * XXX: there is not much point to have two different values here.. | 1564 | * XXX: there is not much point to have two different values here.. |
| 1541 | */ | 1565 | */ |
| @@ -1597,6 +1621,8 @@ int target_configure_device(struct se_device *dev) | |||
| 1597 | list_add_tail(&dev->g_dev_node, &g_device_list); | 1621 | list_add_tail(&dev->g_dev_node, &g_device_list); |
| 1598 | mutex_unlock(&g_device_mutex); | 1622 | mutex_unlock(&g_device_mutex); |
| 1599 | 1623 | ||
| 1624 | dev->dev_flags |= DF_CONFIGURED; | ||
| 1625 | |||
| 1600 | return 0; | 1626 | return 0; |
| 1601 | 1627 | ||
| 1602 | out_free_alua: | 1628 | out_free_alua: |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 1045dcd7bf65..f6c954c4635f 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
| @@ -1121,7 +1121,7 @@ static u32 pscsi_get_device_type(struct se_device *dev) | |||
| 1121 | struct pscsi_dev_virt *pdv = PSCSI_DEV(dev); | 1121 | struct pscsi_dev_virt *pdv = PSCSI_DEV(dev); |
| 1122 | struct scsi_device *sd = pdv->pdv_sd; | 1122 | struct scsi_device *sd = pdv->pdv_sd; |
| 1123 | 1123 | ||
| 1124 | return sd->type; | 1124 | return (sd) ? sd->type : TYPE_NO_LUN; |
| 1125 | } | 1125 | } |
| 1126 | 1126 | ||
| 1127 | static sector_t pscsi_get_blocks(struct se_device *dev) | 1127 | static sector_t pscsi_get_blocks(struct se_device *dev) |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 9a2f9d3a6e70..3e7297411110 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
| @@ -708,8 +708,7 @@ sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb) | |||
| 708 | } | 708 | } |
| 709 | } | 709 | } |
| 710 | if (cdb[1] & 0x8) { | 710 | if (cdb[1] & 0x8) { |
| 711 | if (!dev->dev_attrib.emulate_fua_write || | 711 | if (!dev->dev_attrib.emulate_fua_write || !se_dev_check_wce(dev)) { |
| 712 | !dev->dev_attrib.emulate_write_cache) { | ||
| 713 | pr_err("Got CDB: 0x%02x with FUA bit set, but device" | 712 | pr_err("Got CDB: 0x%02x with FUA bit set, but device" |
| 714 | " does not advertise support for FUA write\n", | 713 | " does not advertise support for FUA write\n", |
| 715 | cdb[0]); | 714 | cdb[0]); |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 460e93109473..6c8bd6bc175c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
| @@ -454,19 +454,6 @@ check_scsi_name: | |||
| 454 | } | 454 | } |
| 455 | EXPORT_SYMBOL(spc_emulate_evpd_83); | 455 | EXPORT_SYMBOL(spc_emulate_evpd_83); |
| 456 | 456 | ||
| 457 | static bool | ||
| 458 | spc_check_dev_wce(struct se_device *dev) | ||
| 459 | { | ||
| 460 | bool wce = false; | ||
| 461 | |||
| 462 | if (dev->transport->get_write_cache) | ||
| 463 | wce = dev->transport->get_write_cache(dev); | ||
| 464 | else if (dev->dev_attrib.emulate_write_cache > 0) | ||
| 465 | wce = true; | ||
| 466 | |||
| 467 | return wce; | ||
| 468 | } | ||
| 469 | |||
| 470 | /* Extended INQUIRY Data VPD Page */ | 457 | /* Extended INQUIRY Data VPD Page */ |
| 471 | static sense_reason_t | 458 | static sense_reason_t |
| 472 | spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | 459 | spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) |
| @@ -490,7 +477,7 @@ spc_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | |||
| 490 | buf[5] = 0x07; | 477 | buf[5] = 0x07; |
| 491 | 478 | ||
| 492 | /* If WriteCache emulation is enabled, set V_SUP */ | 479 | /* If WriteCache emulation is enabled, set V_SUP */ |
| 493 | if (spc_check_dev_wce(dev)) | 480 | if (se_dev_check_wce(dev)) |
| 494 | buf[6] = 0x01; | 481 | buf[6] = 0x01; |
| 495 | /* If an LBA map is present set R_SUP */ | 482 | /* If an LBA map is present set R_SUP */ |
| 496 | spin_lock(&cmd->se_dev->t10_alua.lba_map_lock); | 483 | spin_lock(&cmd->se_dev->t10_alua.lba_map_lock); |
| @@ -897,7 +884,7 @@ static int spc_modesense_caching(struct se_cmd *cmd, u8 pc, u8 *p) | |||
| 897 | if (pc == 1) | 884 | if (pc == 1) |
| 898 | goto out; | 885 | goto out; |
| 899 | 886 | ||
| 900 | if (spc_check_dev_wce(dev)) | 887 | if (se_dev_check_wce(dev)) |
| 901 | p[2] = 0x04; /* Write Cache Enable */ | 888 | p[2] = 0x04; /* Write Cache Enable */ |
| 902 | p[12] = 0x20; /* Disabled Read Ahead */ | 889 | p[12] = 0x20; /* Disabled Read Ahead */ |
| 903 | 890 | ||
| @@ -1009,7 +996,7 @@ static sense_reason_t spc_emulate_modesense(struct se_cmd *cmd) | |||
| 1009 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) | 996 | (cmd->se_deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY))) |
| 1010 | spc_modesense_write_protect(&buf[length], type); | 997 | spc_modesense_write_protect(&buf[length], type); |
| 1011 | 998 | ||
| 1012 | if ((spc_check_dev_wce(dev)) && | 999 | if ((se_dev_check_wce(dev)) && |
| 1013 | (dev->dev_attrib.emulate_fua_write > 0)) | 1000 | (dev->dev_attrib.emulate_fua_write > 0)) |
| 1014 | spc_modesense_dpofua(&buf[length], type); | 1001 | spc_modesense_dpofua(&buf[length], type); |
| 1015 | 1002 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0adc0f650213..ac3cbabdbdf0 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -2389,6 +2389,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, | |||
| 2389 | list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); | 2389 | list_add_tail(&se_cmd->se_cmd_list, &se_sess->sess_cmd_list); |
| 2390 | out: | 2390 | out: |
| 2391 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 2391 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
| 2392 | |||
| 2393 | if (ret && ack_kref) | ||
| 2394 | target_put_sess_cmd(se_sess, se_cmd); | ||
| 2395 | |||
| 2392 | return ret; | 2396 | return ret; |
| 2393 | } | 2397 | } |
| 2394 | EXPORT_SYMBOL(target_get_sess_cmd); | 2398 | EXPORT_SYMBOL(target_get_sess_cmd); |
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c index 97b486c3dda1..583e755d8091 100644 --- a/drivers/target/tcm_fc/tfc_io.c +++ b/drivers/target/tcm_fc/tfc_io.c | |||
| @@ -359,7 +359,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) | |||
| 359 | ep = fc_seq_exch(seq); | 359 | ep = fc_seq_exch(seq); |
| 360 | if (ep) { | 360 | if (ep) { |
| 361 | lport = ep->lp; | 361 | lport = ep->lp; |
| 362 | if (lport && (ep->xid <= lport->lro_xid)) | 362 | if (lport && (ep->xid <= lport->lro_xid)) { |
| 363 | /* | 363 | /* |
| 364 | * "ddp_done" trigger invalidation of HW | 364 | * "ddp_done" trigger invalidation of HW |
| 365 | * specific DDP context | 365 | * specific DDP context |
| @@ -374,6 +374,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) | |||
| 374 | * identified using ep->xid) | 374 | * identified using ep->xid) |
| 375 | */ | 375 | */ |
| 376 | cmd->was_ddp_setup = 0; | 376 | cmd->was_ddp_setup = 0; |
| 377 | } | ||
| 377 | } | 378 | } |
| 378 | } | 379 | } |
| 379 | } | 380 | } |
diff --git a/drivers/usb/gadget/legacy/tcm_usb_gadget.c b/drivers/usb/gadget/legacy/tcm_usb_gadget.c index 3a494168661e..6e0a019aad54 100644 --- a/drivers/usb/gadget/legacy/tcm_usb_gadget.c +++ b/drivers/usb/gadget/legacy/tcm_usb_gadget.c | |||
| @@ -1740,10 +1740,9 @@ static int tcm_usbg_make_nexus(struct usbg_tpg *tpg, char *name) | |||
| 1740 | goto err_session; | 1740 | goto err_session; |
| 1741 | } | 1741 | } |
| 1742 | /* | 1742 | /* |
| 1743 | * Now register the TCM vHost virtual I_T Nexus as active with the | 1743 | * Now register the TCM vHost virtual I_T Nexus as active. |
| 1744 | * call to __transport_register_session() | ||
| 1745 | */ | 1744 | */ |
| 1746 | __transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, | 1745 | transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, |
| 1747 | tv_nexus->tvn_se_sess, tv_nexus); | 1746 | tv_nexus->tvn_se_sess, tv_nexus); |
| 1748 | tpg->tpg_nexus = tv_nexus; | 1747 | tpg->tpg_nexus = tv_nexus; |
| 1749 | mutex_unlock(&tpg->tpg_mutex); | 1748 | mutex_unlock(&tpg->tpg_mutex); |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 8d4f3f1ff799..71df240a467a 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -1956,10 +1956,9 @@ static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg, | |||
| 1956 | goto out; | 1956 | goto out; |
| 1957 | } | 1957 | } |
| 1958 | /* | 1958 | /* |
| 1959 | * Now register the TCM vhost virtual I_T Nexus as active with the | 1959 | * Now register the TCM vhost virtual I_T Nexus as active. |
| 1960 | * call to __transport_register_session() | ||
| 1961 | */ | 1960 | */ |
| 1962 | __transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, | 1961 | transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, |
| 1963 | tv_nexus->tvn_se_sess, tv_nexus); | 1962 | tv_nexus->tvn_se_sess, tv_nexus); |
| 1964 | tpg->tpg_nexus = tv_nexus; | 1963 | tpg->tpg_nexus = tv_nexus; |
| 1965 | 1964 | ||
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 0413157f3b49..6a356e344f82 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
| 30 | #include <linux/balloon_compaction.h> | 30 | #include <linux/balloon_compaction.h> |
| 31 | #include <linux/oom.h> | 31 | #include <linux/oom.h> |
| 32 | #include <linux/wait.h> | ||
| 32 | 33 | ||
| 33 | /* | 34 | /* |
| 34 | * Balloon device works in 4K page units. So each page is pointed to by | 35 | * Balloon device works in 4K page units. So each page is pointed to by |
| @@ -334,17 +335,25 @@ static int virtballoon_oom_notify(struct notifier_block *self, | |||
| 334 | static int balloon(void *_vballoon) | 335 | static int balloon(void *_vballoon) |
| 335 | { | 336 | { |
| 336 | struct virtio_balloon *vb = _vballoon; | 337 | struct virtio_balloon *vb = _vballoon; |
| 338 | DEFINE_WAIT_FUNC(wait, woken_wake_function); | ||
| 337 | 339 | ||
| 338 | set_freezable(); | 340 | set_freezable(); |
| 339 | while (!kthread_should_stop()) { | 341 | while (!kthread_should_stop()) { |
| 340 | s64 diff; | 342 | s64 diff; |
| 341 | 343 | ||
| 342 | try_to_freeze(); | 344 | try_to_freeze(); |
| 343 | wait_event_interruptible(vb->config_change, | 345 | |
| 344 | (diff = towards_target(vb)) != 0 | 346 | add_wait_queue(&vb->config_change, &wait); |
| 345 | || vb->need_stats_update | 347 | for (;;) { |
| 346 | || kthread_should_stop() | 348 | if ((diff = towards_target(vb)) != 0 || |
| 347 | || freezing(current)); | 349 | vb->need_stats_update || |
| 350 | kthread_should_stop() || | ||
| 351 | freezing(current)) | ||
| 352 | break; | ||
| 353 | wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); | ||
| 354 | } | ||
| 355 | remove_wait_queue(&vb->config_change, &wait); | ||
| 356 | |||
| 348 | if (vb->need_stats_update) | 357 | if (vb->need_stats_update) |
| 349 | stats_handle_request(vb); | 358 | stats_handle_request(vb); |
| 350 | if (diff > 0) | 359 | if (diff > 0) |
| @@ -499,6 +508,8 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
| 499 | if (err < 0) | 508 | if (err < 0) |
| 500 | goto out_oom_notify; | 509 | goto out_oom_notify; |
| 501 | 510 | ||
| 511 | virtio_device_ready(vdev); | ||
| 512 | |||
| 502 | vb->thread = kthread_run(balloon, vb, "vballoon"); | 513 | vb->thread = kthread_run(balloon, vb, "vballoon"); |
| 503 | if (IS_ERR(vb->thread)) { | 514 | if (IS_ERR(vb->thread)) { |
| 504 | err = PTR_ERR(vb->thread); | 515 | err = PTR_ERR(vb->thread); |
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index cad569890908..6010d7ec0a0f 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c | |||
| @@ -156,22 +156,95 @@ static void vm_get(struct virtio_device *vdev, unsigned offset, | |||
| 156 | void *buf, unsigned len) | 156 | void *buf, unsigned len) |
| 157 | { | 157 | { |
| 158 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); | 158 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); |
| 159 | u8 *ptr = buf; | 159 | void __iomem *base = vm_dev->base + VIRTIO_MMIO_CONFIG; |
| 160 | int i; | 160 | u8 b; |
| 161 | __le16 w; | ||
| 162 | __le32 l; | ||
| 161 | 163 | ||
| 162 | for (i = 0; i < len; i++) | 164 | if (vm_dev->version == 1) { |
| 163 | ptr[i] = readb(vm_dev->base + VIRTIO_MMIO_CONFIG + offset + i); | 165 | u8 *ptr = buf; |
| 166 | int i; | ||
| 167 | |||
| 168 | for (i = 0; i < len; i++) | ||
| 169 | ptr[i] = readb(base + offset + i); | ||
| 170 | return; | ||
| 171 | } | ||
| 172 | |||
| 173 | switch (len) { | ||
| 174 | case 1: | ||
| 175 | b = readb(base + offset); | ||
| 176 | memcpy(buf, &b, sizeof b); | ||
| 177 | break; | ||
| 178 | case 2: | ||
| 179 | w = cpu_to_le16(readw(base + offset)); | ||
| 180 | memcpy(buf, &w, sizeof w); | ||
| 181 | break; | ||
| 182 | case 4: | ||
| 183 | l = cpu_to_le32(readl(base + offset)); | ||
| 184 | memcpy(buf, &l, sizeof l); | ||
| 185 | break; | ||
| 186 | case 8: | ||
| 187 | l = cpu_to_le32(readl(base + offset)); | ||
| 188 | memcpy(buf, &l, sizeof l); | ||
| 189 | l = cpu_to_le32(ioread32(base + offset + sizeof l)); | ||
| 190 | memcpy(buf + sizeof l, &l, sizeof l); | ||
| 191 | break; | ||
| 192 | default: | ||
| 193 | BUG(); | ||
| 194 | } | ||
| 164 | } | 195 | } |
| 165 | 196 | ||
| 166 | static void vm_set(struct virtio_device *vdev, unsigned offset, | 197 | static void vm_set(struct virtio_device *vdev, unsigned offset, |
| 167 | const void *buf, unsigned len) | 198 | const void *buf, unsigned len) |
| 168 | { | 199 | { |
| 169 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); | 200 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); |
| 170 | const u8 *ptr = buf; | 201 | void __iomem *base = vm_dev->base + VIRTIO_MMIO_CONFIG; |
| 171 | int i; | 202 | u8 b; |
| 203 | __le16 w; | ||
| 204 | __le32 l; | ||
| 172 | 205 | ||
| 173 | for (i = 0; i < len; i++) | 206 | if (vm_dev->version == 1) { |
| 174 | writeb(ptr[i], vm_dev->base + VIRTIO_MMIO_CONFIG + offset + i); | 207 | const u8 *ptr = buf; |
| 208 | int i; | ||
| 209 | |||
| 210 | for (i = 0; i < len; i++) | ||
| 211 | writeb(ptr[i], base + offset + i); | ||
| 212 | |||
| 213 | return; | ||
| 214 | } | ||
| 215 | |||
| 216 | switch (len) { | ||
| 217 | case 1: | ||
| 218 | memcpy(&b, buf, sizeof b); | ||
| 219 | writeb(b, base + offset); | ||
| 220 | break; | ||
| 221 | case 2: | ||
| 222 | memcpy(&w, buf, sizeof w); | ||
| 223 | writew(le16_to_cpu(w), base + offset); | ||
| 224 | break; | ||
| 225 | case 4: | ||
| 226 | memcpy(&l, buf, sizeof l); | ||
| 227 | writel(le32_to_cpu(l), base + offset); | ||
| 228 | break; | ||
| 229 | case 8: | ||
| 230 | memcpy(&l, buf, sizeof l); | ||
| 231 | writel(le32_to_cpu(l), base + offset); | ||
| 232 | memcpy(&l, buf + sizeof l, sizeof l); | ||
| 233 | writel(le32_to_cpu(l), base + offset + sizeof l); | ||
| 234 | break; | ||
| 235 | default: | ||
| 236 | BUG(); | ||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | static u32 vm_generation(struct virtio_device *vdev) | ||
| 241 | { | ||
| 242 | struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); | ||
| 243 | |||
| 244 | if (vm_dev->version == 1) | ||
| 245 | return 0; | ||
| 246 | else | ||
| 247 | return readl(vm_dev->base + VIRTIO_MMIO_CONFIG_GENERATION); | ||
| 175 | } | 248 | } |
| 176 | 249 | ||
| 177 | static u8 vm_get_status(struct virtio_device *vdev) | 250 | static u8 vm_get_status(struct virtio_device *vdev) |
| @@ -440,6 +513,7 @@ static const char *vm_bus_name(struct virtio_device *vdev) | |||
| 440 | static const struct virtio_config_ops virtio_mmio_config_ops = { | 513 | static const struct virtio_config_ops virtio_mmio_config_ops = { |
| 441 | .get = vm_get, | 514 | .get = vm_get, |
| 442 | .set = vm_set, | 515 | .set = vm_set, |
| 516 | .generation = vm_generation, | ||
| 443 | .get_status = vm_get_status, | 517 | .get_status = vm_get_status, |
| 444 | .set_status = vm_set_status, | 518 | .set_status = vm_set_status, |
| 445 | .reset = vm_reset, | 519 | .reset = vm_reset, |
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 9faca6a60bb0..42bd55a6c237 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c | |||
| @@ -1659,11 +1659,8 @@ static int scsiback_make_nexus(struct scsiback_tpg *tpg, | |||
| 1659 | name); | 1659 | name); |
| 1660 | goto out; | 1660 | goto out; |
| 1661 | } | 1661 | } |
| 1662 | /* | 1662 | /* Now register the TCM pvscsi virtual I_T Nexus as active. */ |
| 1663 | * Now register the TCM pvscsi virtual I_T Nexus as active with the | 1663 | transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, |
| 1664 | * call to __transport_register_session() | ||
| 1665 | */ | ||
| 1666 | __transport_register_session(se_tpg, tv_nexus->tvn_se_sess->se_node_acl, | ||
| 1667 | tv_nexus->tvn_se_sess, tv_nexus); | 1664 | tv_nexus->tvn_se_sess, tv_nexus); |
| 1668 | tpg->tpg_nexus = tv_nexus; | 1665 | tpg->tpg_nexus = tv_nexus; |
| 1669 | 1666 | ||
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 84c3b00f3de8..f9c89cae39ee 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -3387,6 +3387,8 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | |||
| 3387 | 3387 | ||
| 3388 | int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, | 3388 | int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, |
| 3389 | struct btrfs_root *root); | 3389 | struct btrfs_root *root); |
| 3390 | int btrfs_setup_space_cache(struct btrfs_trans_handle *trans, | ||
| 3391 | struct btrfs_root *root); | ||
| 3390 | int btrfs_extent_readonly(struct btrfs_root *root, u64 bytenr); | 3392 | int btrfs_extent_readonly(struct btrfs_root *root, u64 bytenr); |
| 3391 | int btrfs_free_block_groups(struct btrfs_fs_info *info); | 3393 | int btrfs_free_block_groups(struct btrfs_fs_info *info); |
| 3392 | int btrfs_read_block_groups(struct btrfs_root *root); | 3394 | int btrfs_read_block_groups(struct btrfs_root *root); |
| @@ -3909,6 +3911,9 @@ int btrfs_prealloc_file_range_trans(struct inode *inode, | |||
| 3909 | loff_t actual_len, u64 *alloc_hint); | 3911 | loff_t actual_len, u64 *alloc_hint); |
| 3910 | int btrfs_inode_check_errors(struct inode *inode); | 3912 | int btrfs_inode_check_errors(struct inode *inode); |
| 3911 | extern const struct dentry_operations btrfs_dentry_operations; | 3913 | extern const struct dentry_operations btrfs_dentry_operations; |
| 3914 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | ||
| 3915 | void btrfs_test_inode_set_ops(struct inode *inode); | ||
| 3916 | #endif | ||
| 3912 | 3917 | ||
| 3913 | /* ioctl.c */ | 3918 | /* ioctl.c */ |
| 3914 | long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 3919 | long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f79f38542a73..639f2663ed3f 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
| @@ -3921,7 +3921,7 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
| 3921 | } | 3921 | } |
| 3922 | if (btrfs_super_sys_array_size(sb) < sizeof(struct btrfs_disk_key) | 3922 | if (btrfs_super_sys_array_size(sb) < sizeof(struct btrfs_disk_key) |
| 3923 | + sizeof(struct btrfs_chunk)) { | 3923 | + sizeof(struct btrfs_chunk)) { |
| 3924 | printk(KERN_ERR "BTRFS: system chunk array too small %u < %lu\n", | 3924 | printk(KERN_ERR "BTRFS: system chunk array too small %u < %zu\n", |
| 3925 | btrfs_super_sys_array_size(sb), | 3925 | btrfs_super_sys_array_size(sb), |
| 3926 | sizeof(struct btrfs_disk_key) | 3926 | sizeof(struct btrfs_disk_key) |
| 3927 | + sizeof(struct btrfs_chunk)); | 3927 | + sizeof(struct btrfs_chunk)); |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 6f080451fcb1..8b353ad02f03 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -3325,6 +3325,32 @@ out: | |||
| 3325 | return ret; | 3325 | return ret; |
| 3326 | } | 3326 | } |
| 3327 | 3327 | ||
| 3328 | int btrfs_setup_space_cache(struct btrfs_trans_handle *trans, | ||
| 3329 | struct btrfs_root *root) | ||
| 3330 | { | ||
| 3331 | struct btrfs_block_group_cache *cache, *tmp; | ||
| 3332 | struct btrfs_transaction *cur_trans = trans->transaction; | ||
| 3333 | struct btrfs_path *path; | ||
| 3334 | |||
| 3335 | if (list_empty(&cur_trans->dirty_bgs) || | ||
| 3336 | !btrfs_test_opt(root, SPACE_CACHE)) | ||
| 3337 | return 0; | ||
| 3338 | |||
| 3339 | path = btrfs_alloc_path(); | ||
| 3340 | if (!path) | ||
| 3341 | return -ENOMEM; | ||
| 3342 | |||
| 3343 | /* Could add new block groups, use _safe just in case */ | ||
| 3344 | list_for_each_entry_safe(cache, tmp, &cur_trans->dirty_bgs, | ||
| 3345 | dirty_list) { | ||
| 3346 | if (cache->disk_cache_state == BTRFS_DC_CLEAR) | ||
| 3347 | cache_save_setup(cache, trans, path); | ||
| 3348 | } | ||
| 3349 | |||
| 3350 | btrfs_free_path(path); | ||
| 3351 | return 0; | ||
| 3352 | } | ||
| 3353 | |||
| 3328 | int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, | 3354 | int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, |
| 3329 | struct btrfs_root *root) | 3355 | struct btrfs_root *root) |
| 3330 | { | 3356 | { |
| @@ -5110,7 +5136,11 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
| 5110 | num_bytes = ALIGN(num_bytes, root->sectorsize); | 5136 | num_bytes = ALIGN(num_bytes, root->sectorsize); |
| 5111 | 5137 | ||
| 5112 | spin_lock(&BTRFS_I(inode)->lock); | 5138 | spin_lock(&BTRFS_I(inode)->lock); |
| 5113 | BTRFS_I(inode)->outstanding_extents++; | 5139 | nr_extents = (unsigned)div64_u64(num_bytes + |
| 5140 | BTRFS_MAX_EXTENT_SIZE - 1, | ||
| 5141 | BTRFS_MAX_EXTENT_SIZE); | ||
| 5142 | BTRFS_I(inode)->outstanding_extents += nr_extents; | ||
| 5143 | nr_extents = 0; | ||
| 5114 | 5144 | ||
| 5115 | if (BTRFS_I(inode)->outstanding_extents > | 5145 | if (BTRFS_I(inode)->outstanding_extents > |
| 5116 | BTRFS_I(inode)->reserved_extents) | 5146 | BTRFS_I(inode)->reserved_extents) |
| @@ -5255,6 +5285,9 @@ void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes) | |||
| 5255 | if (dropped > 0) | 5285 | if (dropped > 0) |
| 5256 | to_free += btrfs_calc_trans_metadata_size(root, dropped); | 5286 | to_free += btrfs_calc_trans_metadata_size(root, dropped); |
| 5257 | 5287 | ||
| 5288 | if (btrfs_test_is_dummy_root(root)) | ||
| 5289 | return; | ||
| 5290 | |||
| 5258 | trace_btrfs_space_reservation(root->fs_info, "delalloc", | 5291 | trace_btrfs_space_reservation(root->fs_info, "delalloc", |
| 5259 | btrfs_ino(inode), to_free, 0); | 5292 | btrfs_ino(inode), to_free, 0); |
| 5260 | if (root->fs_info->quota_enabled) { | 5293 | if (root->fs_info->quota_enabled) { |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index c7233ff1d533..d688cfe5d496 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
| @@ -4968,6 +4968,12 @@ static int release_extent_buffer(struct extent_buffer *eb) | |||
| 4968 | 4968 | ||
| 4969 | /* Should be safe to release our pages at this point */ | 4969 | /* Should be safe to release our pages at this point */ |
| 4970 | btrfs_release_extent_buffer_page(eb); | 4970 | btrfs_release_extent_buffer_page(eb); |
| 4971 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | ||
| 4972 | if (unlikely(test_bit(EXTENT_BUFFER_DUMMY, &eb->bflags))) { | ||
| 4973 | __free_extent_buffer(eb); | ||
| 4974 | return 1; | ||
| 4975 | } | ||
| 4976 | #endif | ||
| 4971 | call_rcu(&eb->rcu_head, btrfs_release_extent_buffer_rcu); | 4977 | call_rcu(&eb->rcu_head, btrfs_release_extent_buffer_rcu); |
| 4972 | return 1; | 4978 | return 1; |
| 4973 | } | 4979 | } |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index da828cf5e8f8..d2e732d7af52 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -108,6 +108,13 @@ static struct extent_map *create_pinned_em(struct inode *inode, u64 start, | |||
| 108 | 108 | ||
| 109 | static int btrfs_dirty_inode(struct inode *inode); | 109 | static int btrfs_dirty_inode(struct inode *inode); |
| 110 | 110 | ||
| 111 | #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS | ||
| 112 | void btrfs_test_inode_set_ops(struct inode *inode) | ||
| 113 | { | ||
| 114 | BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; | ||
| 115 | } | ||
| 116 | #endif | ||
| 117 | |||
| 111 | static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, | 118 | static int btrfs_init_inode_security(struct btrfs_trans_handle *trans, |
| 112 | struct inode *inode, struct inode *dir, | 119 | struct inode *inode, struct inode *dir, |
| 113 | const struct qstr *qstr) | 120 | const struct qstr *qstr) |
| @@ -1542,30 +1549,17 @@ static void btrfs_split_extent_hook(struct inode *inode, | |||
| 1542 | u64 new_size; | 1549 | u64 new_size; |
| 1543 | 1550 | ||
| 1544 | /* | 1551 | /* |
| 1545 | * We need the largest size of the remaining extent to see if we | 1552 | * See the explanation in btrfs_merge_extent_hook, the same |
| 1546 | * need to add a new outstanding extent. Think of the following | 1553 | * applies here, just in reverse. |
| 1547 | * case | ||
| 1548 | * | ||
| 1549 | * [MEAX_EXTENT_SIZEx2 - 4k][4k] | ||
| 1550 | * | ||
| 1551 | * The new_size would just be 4k and we'd think we had enough | ||
| 1552 | * outstanding extents for this if we only took one side of the | ||
| 1553 | * split, same goes for the other direction. We need to see if | ||
| 1554 | * the larger size still is the same amount of extents as the | ||
| 1555 | * original size, because if it is we need to add a new | ||
| 1556 | * outstanding extent. But if we split up and the larger size | ||
| 1557 | * is less than the original then we are good to go since we've | ||
| 1558 | * already accounted for the extra extent in our original | ||
| 1559 | * accounting. | ||
| 1560 | */ | 1554 | */ |
| 1561 | new_size = orig->end - split + 1; | 1555 | new_size = orig->end - split + 1; |
| 1562 | if ((split - orig->start) > new_size) | 1556 | num_extents = div64_u64(new_size + BTRFS_MAX_EXTENT_SIZE - 1, |
| 1563 | new_size = split - orig->start; | ||
| 1564 | |||
| 1565 | num_extents = div64_u64(size + BTRFS_MAX_EXTENT_SIZE - 1, | ||
| 1566 | BTRFS_MAX_EXTENT_SIZE); | 1557 | BTRFS_MAX_EXTENT_SIZE); |
| 1567 | if (div64_u64(new_size + BTRFS_MAX_EXTENT_SIZE - 1, | 1558 | new_size = split - orig->start; |
| 1568 | BTRFS_MAX_EXTENT_SIZE) < num_extents) | 1559 | num_extents += div64_u64(new_size + BTRFS_MAX_EXTENT_SIZE - 1, |
| 1560 | BTRFS_MAX_EXTENT_SIZE); | ||
| 1561 | if (div64_u64(size + BTRFS_MAX_EXTENT_SIZE - 1, | ||
| 1562 | BTRFS_MAX_EXTENT_SIZE) >= num_extents) | ||
| 1569 | return; | 1563 | return; |
| 1570 | } | 1564 | } |
| 1571 | 1565 | ||
| @@ -1591,8 +1585,10 @@ static void btrfs_merge_extent_hook(struct inode *inode, | |||
| 1591 | if (!(other->state & EXTENT_DELALLOC)) | 1585 | if (!(other->state & EXTENT_DELALLOC)) |
| 1592 | return; | 1586 | return; |
| 1593 | 1587 | ||
| 1594 | old_size = other->end - other->start + 1; | 1588 | if (new->start > other->start) |
| 1595 | new_size = old_size + (new->end - new->start + 1); | 1589 | new_size = new->end - other->start + 1; |
| 1590 | else | ||
| 1591 | new_size = other->end - new->start + 1; | ||
| 1596 | 1592 | ||
| 1597 | /* we're not bigger than the max, unreserve the space and go */ | 1593 | /* we're not bigger than the max, unreserve the space and go */ |
| 1598 | if (new_size <= BTRFS_MAX_EXTENT_SIZE) { | 1594 | if (new_size <= BTRFS_MAX_EXTENT_SIZE) { |
| @@ -1603,13 +1599,32 @@ static void btrfs_merge_extent_hook(struct inode *inode, | |||
| 1603 | } | 1599 | } |
| 1604 | 1600 | ||
| 1605 | /* | 1601 | /* |
| 1606 | * If we grew by another max_extent, just return, we want to keep that | 1602 | * We have to add up either side to figure out how many extents were |
| 1607 | * reserved amount. | 1603 | * accounted for before we merged into one big extent. If the number of |
| 1604 | * extents we accounted for is <= the amount we need for the new range | ||
| 1605 | * then we can return, otherwise drop. Think of it like this | ||
| 1606 | * | ||
| 1607 | * [ 4k][MAX_SIZE] | ||
| 1608 | * | ||
| 1609 | * So we've grown the extent by a MAX_SIZE extent, this would mean we | ||
| 1610 | * need 2 outstanding extents, on one side we have 1 and the other side | ||
| 1611 | * we have 1 so they are == and we can return. But in this case | ||
| 1612 | * | ||
| 1613 | * [MAX_SIZE+4k][MAX_SIZE+4k] | ||
| 1614 | * | ||
| 1615 | * Each range on their own accounts for 2 extents, but merged together | ||
| 1616 | * they are only 3 extents worth of accounting, so we need to drop in | ||
| 1617 | * this case. | ||
| 1608 | */ | 1618 | */ |
| 1619 | old_size = other->end - other->start + 1; | ||
| 1609 | num_extents = div64_u64(old_size + BTRFS_MAX_EXTENT_SIZE - 1, | 1620 | num_extents = div64_u64(old_size + BTRFS_MAX_EXTENT_SIZE - 1, |
| 1610 | BTRFS_MAX_EXTENT_SIZE); | 1621 | BTRFS_MAX_EXTENT_SIZE); |
| 1622 | old_size = new->end - new->start + 1; | ||
| 1623 | num_extents += div64_u64(old_size + BTRFS_MAX_EXTENT_SIZE - 1, | ||
| 1624 | BTRFS_MAX_EXTENT_SIZE); | ||
| 1625 | |||
| 1611 | if (div64_u64(new_size + BTRFS_MAX_EXTENT_SIZE - 1, | 1626 | if (div64_u64(new_size + BTRFS_MAX_EXTENT_SIZE - 1, |
| 1612 | BTRFS_MAX_EXTENT_SIZE) > num_extents) | 1627 | BTRFS_MAX_EXTENT_SIZE) >= num_extents) |
| 1613 | return; | 1628 | return; |
| 1614 | 1629 | ||
| 1615 | spin_lock(&BTRFS_I(inode)->lock); | 1630 | spin_lock(&BTRFS_I(inode)->lock); |
| @@ -1686,6 +1701,10 @@ static void btrfs_set_bit_hook(struct inode *inode, | |||
| 1686 | spin_unlock(&BTRFS_I(inode)->lock); | 1701 | spin_unlock(&BTRFS_I(inode)->lock); |
| 1687 | } | 1702 | } |
| 1688 | 1703 | ||
| 1704 | /* For sanity tests */ | ||
| 1705 | if (btrfs_test_is_dummy_root(root)) | ||
| 1706 | return; | ||
| 1707 | |||
| 1689 | __percpu_counter_add(&root->fs_info->delalloc_bytes, len, | 1708 | __percpu_counter_add(&root->fs_info->delalloc_bytes, len, |
| 1690 | root->fs_info->delalloc_batch); | 1709 | root->fs_info->delalloc_batch); |
| 1691 | spin_lock(&BTRFS_I(inode)->lock); | 1710 | spin_lock(&BTRFS_I(inode)->lock); |
| @@ -1741,6 +1760,10 @@ static void btrfs_clear_bit_hook(struct inode *inode, | |||
| 1741 | root != root->fs_info->tree_root) | 1760 | root != root->fs_info->tree_root) |
| 1742 | btrfs_delalloc_release_metadata(inode, len); | 1761 | btrfs_delalloc_release_metadata(inode, len); |
| 1743 | 1762 | ||
| 1763 | /* For sanity tests. */ | ||
| 1764 | if (btrfs_test_is_dummy_root(root)) | ||
| 1765 | return; | ||
| 1766 | |||
| 1744 | if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID | 1767 | if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID |
| 1745 | && do_list && !(state->state & EXTENT_NORESERVE)) | 1768 | && do_list && !(state->state & EXTENT_NORESERVE)) |
| 1746 | btrfs_free_reserved_data_space(inode, len); | 1769 | btrfs_free_reserved_data_space(inode, len); |
| @@ -7213,7 +7236,7 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, | |||
| 7213 | u64 start = iblock << inode->i_blkbits; | 7236 | u64 start = iblock << inode->i_blkbits; |
| 7214 | u64 lockstart, lockend; | 7237 | u64 lockstart, lockend; |
| 7215 | u64 len = bh_result->b_size; | 7238 | u64 len = bh_result->b_size; |
| 7216 | u64 orig_len = len; | 7239 | u64 *outstanding_extents = NULL; |
| 7217 | int unlock_bits = EXTENT_LOCKED; | 7240 | int unlock_bits = EXTENT_LOCKED; |
| 7218 | int ret = 0; | 7241 | int ret = 0; |
| 7219 | 7242 | ||
| @@ -7225,6 +7248,16 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, | |||
| 7225 | lockstart = start; | 7248 | lockstart = start; |
| 7226 | lockend = start + len - 1; | 7249 | lockend = start + len - 1; |
| 7227 | 7250 | ||
| 7251 | if (current->journal_info) { | ||
| 7252 | /* | ||
| 7253 | * Need to pull our outstanding extents and set journal_info to NULL so | ||
| 7254 | * that anything that needs to check if there's a transction doesn't get | ||
| 7255 | * confused. | ||
| 7256 | */ | ||
| 7257 | outstanding_extents = current->journal_info; | ||
| 7258 | current->journal_info = NULL; | ||
| 7259 | } | ||
| 7260 | |||
| 7228 | /* | 7261 | /* |
| 7229 | * If this errors out it's because we couldn't invalidate pagecache for | 7262 | * If this errors out it's because we couldn't invalidate pagecache for |
| 7230 | * this range and we need to fallback to buffered. | 7263 | * this range and we need to fallback to buffered. |
| @@ -7348,11 +7381,20 @@ unlock: | |||
| 7348 | if (start + len > i_size_read(inode)) | 7381 | if (start + len > i_size_read(inode)) |
| 7349 | i_size_write(inode, start + len); | 7382 | i_size_write(inode, start + len); |
| 7350 | 7383 | ||
| 7351 | if (len < orig_len) { | 7384 | /* |
| 7385 | * If we have an outstanding_extents count still set then we're | ||
| 7386 | * within our reservation, otherwise we need to adjust our inode | ||
| 7387 | * counter appropriately. | ||
| 7388 | */ | ||
| 7389 | if (*outstanding_extents) { | ||
| 7390 | (*outstanding_extents)--; | ||
| 7391 | } else { | ||
| 7352 | spin_lock(&BTRFS_I(inode)->lock); | 7392 | spin_lock(&BTRFS_I(inode)->lock); |
| 7353 | BTRFS_I(inode)->outstanding_extents++; | 7393 | BTRFS_I(inode)->outstanding_extents++; |
| 7354 | spin_unlock(&BTRFS_I(inode)->lock); | 7394 | spin_unlock(&BTRFS_I(inode)->lock); |
| 7355 | } | 7395 | } |
| 7396 | |||
| 7397 | current->journal_info = outstanding_extents; | ||
| 7356 | btrfs_free_reserved_data_space(inode, len); | 7398 | btrfs_free_reserved_data_space(inode, len); |
| 7357 | } | 7399 | } |
| 7358 | 7400 | ||
| @@ -7376,6 +7418,8 @@ unlock: | |||
| 7376 | unlock_err: | 7418 | unlock_err: |
| 7377 | clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, lockend, | 7419 | clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, lockend, |
| 7378 | unlock_bits, 1, 0, &cached_state, GFP_NOFS); | 7420 | unlock_bits, 1, 0, &cached_state, GFP_NOFS); |
| 7421 | if (outstanding_extents) | ||
| 7422 | current->journal_info = outstanding_extents; | ||
| 7379 | return ret; | 7423 | return ret; |
| 7380 | } | 7424 | } |
| 7381 | 7425 | ||
| @@ -8075,6 +8119,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
| 8075 | { | 8119 | { |
| 8076 | struct file *file = iocb->ki_filp; | 8120 | struct file *file = iocb->ki_filp; |
| 8077 | struct inode *inode = file->f_mapping->host; | 8121 | struct inode *inode = file->f_mapping->host; |
| 8122 | u64 outstanding_extents = 0; | ||
| 8078 | size_t count = 0; | 8123 | size_t count = 0; |
| 8079 | int flags = 0; | 8124 | int flags = 0; |
| 8080 | bool wakeup = true; | 8125 | bool wakeup = true; |
| @@ -8112,6 +8157,16 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
| 8112 | ret = btrfs_delalloc_reserve_space(inode, count); | 8157 | ret = btrfs_delalloc_reserve_space(inode, count); |
| 8113 | if (ret) | 8158 | if (ret) |
| 8114 | goto out; | 8159 | goto out; |
| 8160 | outstanding_extents = div64_u64(count + | ||
| 8161 | BTRFS_MAX_EXTENT_SIZE - 1, | ||
| 8162 | BTRFS_MAX_EXTENT_SIZE); | ||
| 8163 | |||
| 8164 | /* | ||
| 8165 | * We need to know how many extents we reserved so that we can | ||
| 8166 | * do the accounting properly if we go over the number we | ||
| 8167 | * originally calculated. Abuse current->journal_info for this. | ||
| 8168 | */ | ||
| 8169 | current->journal_info = &outstanding_extents; | ||
| 8115 | } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, | 8170 | } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, |
| 8116 | &BTRFS_I(inode)->runtime_flags)) { | 8171 | &BTRFS_I(inode)->runtime_flags)) { |
| 8117 | inode_dio_done(inode); | 8172 | inode_dio_done(inode); |
| @@ -8124,6 +8179,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, | |||
| 8124 | iter, offset, btrfs_get_blocks_direct, NULL, | 8179 | iter, offset, btrfs_get_blocks_direct, NULL, |
| 8125 | btrfs_submit_direct, flags); | 8180 | btrfs_submit_direct, flags); |
| 8126 | if (rw & WRITE) { | 8181 | if (rw & WRITE) { |
| 8182 | current->journal_info = NULL; | ||
| 8127 | if (ret < 0 && ret != -EIOCBQUEUED) | 8183 | if (ret < 0 && ret != -EIOCBQUEUED) |
| 8128 | btrfs_delalloc_release_space(inode, count); | 8184 | btrfs_delalloc_release_space(inode, count); |
| 8129 | else if (ret >= 0 && (size_t)ret < count) | 8185 | else if (ret >= 0 && (size_t)ret < count) |
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 97159a8e91d4..058c79eecbfb 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
| @@ -1259,7 +1259,7 @@ static int comp_oper(struct btrfs_qgroup_operation *oper1, | |||
| 1259 | if (oper1->seq < oper2->seq) | 1259 | if (oper1->seq < oper2->seq) |
| 1260 | return -1; | 1260 | return -1; |
| 1261 | if (oper1->seq > oper2->seq) | 1261 | if (oper1->seq > oper2->seq) |
| 1262 | return -1; | 1262 | return 1; |
| 1263 | if (oper1->ref_root < oper2->ref_root) | 1263 | if (oper1->ref_root < oper2->ref_root) |
| 1264 | return -1; | 1264 | return -1; |
| 1265 | if (oper1->ref_root > oper2->ref_root) | 1265 | if (oper1->ref_root > oper2->ref_root) |
diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c index a116b55ce788..054fc0d97131 100644 --- a/fs/btrfs/tests/inode-tests.c +++ b/fs/btrfs/tests/inode-tests.c | |||
| @@ -911,6 +911,197 @@ out: | |||
| 911 | return ret; | 911 | return ret; |
| 912 | } | 912 | } |
| 913 | 913 | ||
| 914 | static int test_extent_accounting(void) | ||
| 915 | { | ||
| 916 | struct inode *inode = NULL; | ||
| 917 | struct btrfs_root *root = NULL; | ||
| 918 | int ret = -ENOMEM; | ||
| 919 | |||
| 920 | inode = btrfs_new_test_inode(); | ||
| 921 | if (!inode) { | ||
| 922 | test_msg("Couldn't allocate inode\n"); | ||
| 923 | return ret; | ||
| 924 | } | ||
| 925 | |||
| 926 | root = btrfs_alloc_dummy_root(); | ||
| 927 | if (IS_ERR(root)) { | ||
| 928 | test_msg("Couldn't allocate root\n"); | ||
| 929 | goto out; | ||
| 930 | } | ||
| 931 | |||
| 932 | root->fs_info = btrfs_alloc_dummy_fs_info(); | ||
| 933 | if (!root->fs_info) { | ||
| 934 | test_msg("Couldn't allocate dummy fs info\n"); | ||
| 935 | goto out; | ||
| 936 | } | ||
| 937 | |||
| 938 | BTRFS_I(inode)->root = root; | ||
| 939 | btrfs_test_inode_set_ops(inode); | ||
| 940 | |||
| 941 | /* [BTRFS_MAX_EXTENT_SIZE] */ | ||
| 942 | BTRFS_I(inode)->outstanding_extents++; | ||
| 943 | ret = btrfs_set_extent_delalloc(inode, 0, BTRFS_MAX_EXTENT_SIZE - 1, | ||
| 944 | NULL); | ||
| 945 | if (ret) { | ||
| 946 | test_msg("btrfs_set_extent_delalloc returned %d\n", ret); | ||
| 947 | goto out; | ||
| 948 | } | ||
| 949 | if (BTRFS_I(inode)->outstanding_extents != 1) { | ||
| 950 | ret = -EINVAL; | ||
| 951 | test_msg("Miscount, wanted 1, got %u\n", | ||
| 952 | BTRFS_I(inode)->outstanding_extents); | ||
| 953 | goto out; | ||
| 954 | } | ||
| 955 | |||
| 956 | /* [BTRFS_MAX_EXTENT_SIZE][4k] */ | ||
| 957 | BTRFS_I(inode)->outstanding_extents++; | ||
| 958 | ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE, | ||
| 959 | BTRFS_MAX_EXTENT_SIZE + 4095, NULL); | ||
| 960 | if (ret) { | ||
| 961 | test_msg("btrfs_set_extent_delalloc returned %d\n", ret); | ||
| 962 | goto out; | ||
| 963 | } | ||
| 964 | if (BTRFS_I(inode)->outstanding_extents != 2) { | ||
| 965 | ret = -EINVAL; | ||
| 966 | test_msg("Miscount, wanted 2, got %u\n", | ||
| 967 | BTRFS_I(inode)->outstanding_extents); | ||
| 968 | goto out; | ||
| 969 | } | ||
| 970 | |||
| 971 | /* [BTRFS_MAX_EXTENT_SIZE/2][4K HOLE][the rest] */ | ||
| 972 | ret = clear_extent_bit(&BTRFS_I(inode)->io_tree, | ||
| 973 | BTRFS_MAX_EXTENT_SIZE >> 1, | ||
| 974 | (BTRFS_MAX_EXTENT_SIZE >> 1) + 4095, | ||
| 975 | EXTENT_DELALLOC | EXTENT_DIRTY | | ||
| 976 | EXTENT_UPTODATE | EXTENT_DO_ACCOUNTING, 0, 0, | ||
| 977 | NULL, GFP_NOFS); | ||
| 978 | if (ret) { | ||
| 979 | test_msg("clear_extent_bit returned %d\n", ret); | ||
| 980 | goto out; | ||
| 981 | } | ||
| 982 | if (BTRFS_I(inode)->outstanding_extents != 2) { | ||
| 983 | ret = -EINVAL; | ||
| 984 | test_msg("Miscount, wanted 2, got %u\n", | ||
| 985 | BTRFS_I(inode)->outstanding_extents); | ||
| 986 | goto out; | ||
| 987 | } | ||
| 988 | |||
| 989 | /* [BTRFS_MAX_EXTENT_SIZE][4K] */ | ||
| 990 | BTRFS_I(inode)->outstanding_extents++; | ||
| 991 | ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE >> 1, | ||
| 992 | (BTRFS_MAX_EXTENT_SIZE >> 1) + 4095, | ||
| 993 | NULL); | ||
| 994 | if (ret) { | ||
| 995 | test_msg("btrfs_set_extent_delalloc returned %d\n", ret); | ||
| 996 | goto out; | ||
| 997 | } | ||
| 998 | if (BTRFS_I(inode)->outstanding_extents != 2) { | ||
| 999 | ret = -EINVAL; | ||
| 1000 | test_msg("Miscount, wanted 2, got %u\n", | ||
| 1001 | BTRFS_I(inode)->outstanding_extents); | ||
| 1002 | goto out; | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | /* | ||
| 1006 | * [BTRFS_MAX_EXTENT_SIZE+4K][4K HOLE][BTRFS_MAX_EXTENT_SIZE+4K] | ||
| 1007 | * | ||
| 1008 | * I'm artificially adding 2 to outstanding_extents because in the | ||
| 1009 | * buffered IO case we'd add things up as we go, but I don't feel like | ||
| 1010 | * doing that here, this isn't the interesting case we want to test. | ||
| 1011 | */ | ||
| 1012 | BTRFS_I(inode)->outstanding_extents += 2; | ||
| 1013 | ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE + 8192, | ||
| 1014 | (BTRFS_MAX_EXTENT_SIZE << 1) + 12287, | ||
| 1015 | NULL); | ||
| 1016 | if (ret) { | ||
| 1017 | test_msg("btrfs_set_extent_delalloc returned %d\n", ret); | ||
| 1018 | goto out; | ||
| 1019 | } | ||
| 1020 | if (BTRFS_I(inode)->outstanding_extents != 4) { | ||
| 1021 | ret = -EINVAL; | ||
| 1022 | test_msg("Miscount, wanted 4, got %u\n", | ||
| 1023 | BTRFS_I(inode)->outstanding_extents); | ||
| 1024 | goto out; | ||
| 1025 | } | ||
| 1026 | |||
| 1027 | /* [BTRFS_MAX_EXTENT_SIZE+4k][4k][BTRFS_MAX_EXTENT_SIZE+4k] */ | ||
| 1028 | BTRFS_I(inode)->outstanding_extents++; | ||
| 1029 | ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE+4096, | ||
| 1030 | BTRFS_MAX_EXTENT_SIZE+8191, NULL); | ||
| 1031 | if (ret) { | ||
| 1032 | test_msg("btrfs_set_extent_delalloc returned %d\n", ret); | ||
| 1033 | goto out; | ||
| 1034 | } | ||
| 1035 | if (BTRFS_I(inode)->outstanding_extents != 3) { | ||
| 1036 | ret = -EINVAL; | ||
| 1037 | test_msg("Miscount, wanted 3, got %u\n", | ||
| 1038 | BTRFS_I(inode)->outstanding_extents); | ||
| 1039 | goto out; | ||
| 1040 | } | ||
| 1041 | |||
| 1042 | /* [BTRFS_MAX_EXTENT_SIZE+4k][4K HOLE][BTRFS_MAX_EXTENT_SIZE+4k] */ | ||
| 1043 | ret = clear_extent_bit(&BTRFS_I(inode)->io_tree, | ||
| 1044 | BTRFS_MAX_EXTENT_SIZE+4096, | ||
| 1045 | BTRFS_MAX_EXTENT_SIZE+8191, | ||
| 1046 | EXTENT_DIRTY | EXTENT_DELALLOC | | ||
| 1047 | EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0, | ||
| 1048 | NULL, GFP_NOFS); | ||
| 1049 | if (ret) { | ||
| 1050 | test_msg("clear_extent_bit returned %d\n", ret); | ||
| 1051 | goto out; | ||
| 1052 | } | ||
| 1053 | if (BTRFS_I(inode)->outstanding_extents != 4) { | ||
| 1054 | ret = -EINVAL; | ||
| 1055 | test_msg("Miscount, wanted 4, got %u\n", | ||
| 1056 | BTRFS_I(inode)->outstanding_extents); | ||
| 1057 | goto out; | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | /* | ||
| 1061 | * Refill the hole again just for good measure, because I thought it | ||
| 1062 | * might fail and I'd rather satisfy my paranoia at this point. | ||
| 1063 | */ | ||
| 1064 | BTRFS_I(inode)->outstanding_extents++; | ||
| 1065 | ret = btrfs_set_extent_delalloc(inode, BTRFS_MAX_EXTENT_SIZE+4096, | ||
| 1066 | BTRFS_MAX_EXTENT_SIZE+8191, NULL); | ||
| 1067 | if (ret) { | ||
| 1068 | test_msg("btrfs_set_extent_delalloc returned %d\n", ret); | ||
| 1069 | goto out; | ||
| 1070 | } | ||
| 1071 | if (BTRFS_I(inode)->outstanding_extents != 3) { | ||
| 1072 | ret = -EINVAL; | ||
| 1073 | test_msg("Miscount, wanted 3, got %u\n", | ||
| 1074 | BTRFS_I(inode)->outstanding_extents); | ||
| 1075 | goto out; | ||
| 1076 | } | ||
| 1077 | |||
| 1078 | /* Empty */ | ||
| 1079 | ret = clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1, | ||
| 1080 | EXTENT_DIRTY | EXTENT_DELALLOC | | ||
| 1081 | EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0, | ||
| 1082 | NULL, GFP_NOFS); | ||
| 1083 | if (ret) { | ||
| 1084 | test_msg("clear_extent_bit returned %d\n", ret); | ||
| 1085 | goto out; | ||
| 1086 | } | ||
| 1087 | if (BTRFS_I(inode)->outstanding_extents) { | ||
| 1088 | ret = -EINVAL; | ||
| 1089 | test_msg("Miscount, wanted 0, got %u\n", | ||
| 1090 | BTRFS_I(inode)->outstanding_extents); | ||
| 1091 | goto out; | ||
| 1092 | } | ||
| 1093 | ret = 0; | ||
| 1094 | out: | ||
| 1095 | if (ret) | ||
| 1096 | clear_extent_bit(&BTRFS_I(inode)->io_tree, 0, (u64)-1, | ||
| 1097 | EXTENT_DIRTY | EXTENT_DELALLOC | | ||
| 1098 | EXTENT_DO_ACCOUNTING | EXTENT_UPTODATE, 0, 0, | ||
| 1099 | NULL, GFP_NOFS); | ||
| 1100 | iput(inode); | ||
| 1101 | btrfs_free_dummy_root(root); | ||
| 1102 | return ret; | ||
| 1103 | } | ||
| 1104 | |||
| 914 | int btrfs_test_inodes(void) | 1105 | int btrfs_test_inodes(void) |
| 915 | { | 1106 | { |
| 916 | int ret; | 1107 | int ret; |
| @@ -924,5 +1115,9 @@ int btrfs_test_inodes(void) | |||
| 924 | if (ret) | 1115 | if (ret) |
| 925 | return ret; | 1116 | return ret; |
| 926 | test_msg("Running hole first btrfs_get_extent test\n"); | 1117 | test_msg("Running hole first btrfs_get_extent test\n"); |
| 927 | return test_hole_first(); | 1118 | ret = test_hole_first(); |
| 1119 | if (ret) | ||
| 1120 | return ret; | ||
| 1121 | test_msg("Running outstanding_extents tests\n"); | ||
| 1122 | return test_extent_accounting(); | ||
| 928 | } | 1123 | } |
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 88e51aded6bd..8be4278e25e8 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
| @@ -1023,17 +1023,13 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans, | |||
| 1023 | u64 old_root_bytenr; | 1023 | u64 old_root_bytenr; |
| 1024 | u64 old_root_used; | 1024 | u64 old_root_used; |
| 1025 | struct btrfs_root *tree_root = root->fs_info->tree_root; | 1025 | struct btrfs_root *tree_root = root->fs_info->tree_root; |
| 1026 | bool extent_root = (root->objectid == BTRFS_EXTENT_TREE_OBJECTID); | ||
| 1027 | 1026 | ||
| 1028 | old_root_used = btrfs_root_used(&root->root_item); | 1027 | old_root_used = btrfs_root_used(&root->root_item); |
| 1029 | btrfs_write_dirty_block_groups(trans, root); | ||
| 1030 | 1028 | ||
| 1031 | while (1) { | 1029 | while (1) { |
| 1032 | old_root_bytenr = btrfs_root_bytenr(&root->root_item); | 1030 | old_root_bytenr = btrfs_root_bytenr(&root->root_item); |
| 1033 | if (old_root_bytenr == root->node->start && | 1031 | if (old_root_bytenr == root->node->start && |
| 1034 | old_root_used == btrfs_root_used(&root->root_item) && | 1032 | old_root_used == btrfs_root_used(&root->root_item)) |
| 1035 | (!extent_root || | ||
| 1036 | list_empty(&trans->transaction->dirty_bgs))) | ||
| 1037 | break; | 1033 | break; |
| 1038 | 1034 | ||
| 1039 | btrfs_set_root_node(&root->root_item, root->node); | 1035 | btrfs_set_root_node(&root->root_item, root->node); |
| @@ -1044,14 +1040,6 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans, | |||
| 1044 | return ret; | 1040 | return ret; |
| 1045 | 1041 | ||
| 1046 | old_root_used = btrfs_root_used(&root->root_item); | 1042 | old_root_used = btrfs_root_used(&root->root_item); |
| 1047 | if (extent_root) { | ||
| 1048 | ret = btrfs_write_dirty_block_groups(trans, root); | ||
| 1049 | if (ret) | ||
| 1050 | return ret; | ||
| 1051 | } | ||
| 1052 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | ||
| 1053 | if (ret) | ||
| 1054 | return ret; | ||
| 1055 | } | 1043 | } |
| 1056 | 1044 | ||
| 1057 | return 0; | 1045 | return 0; |
| @@ -1068,6 +1056,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans, | |||
| 1068 | struct btrfs_root *root) | 1056 | struct btrfs_root *root) |
| 1069 | { | 1057 | { |
| 1070 | struct btrfs_fs_info *fs_info = root->fs_info; | 1058 | struct btrfs_fs_info *fs_info = root->fs_info; |
| 1059 | struct list_head *dirty_bgs = &trans->transaction->dirty_bgs; | ||
| 1071 | struct list_head *next; | 1060 | struct list_head *next; |
| 1072 | struct extent_buffer *eb; | 1061 | struct extent_buffer *eb; |
| 1073 | int ret; | 1062 | int ret; |
| @@ -1095,11 +1084,15 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans, | |||
| 1095 | if (ret) | 1084 | if (ret) |
| 1096 | return ret; | 1085 | return ret; |
| 1097 | 1086 | ||
| 1087 | ret = btrfs_setup_space_cache(trans, root); | ||
| 1088 | if (ret) | ||
| 1089 | return ret; | ||
| 1090 | |||
| 1098 | /* run_qgroups might have added some more refs */ | 1091 | /* run_qgroups might have added some more refs */ |
| 1099 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | 1092 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); |
| 1100 | if (ret) | 1093 | if (ret) |
| 1101 | return ret; | 1094 | return ret; |
| 1102 | 1095 | again: | |
| 1103 | while (!list_empty(&fs_info->dirty_cowonly_roots)) { | 1096 | while (!list_empty(&fs_info->dirty_cowonly_roots)) { |
| 1104 | next = fs_info->dirty_cowonly_roots.next; | 1097 | next = fs_info->dirty_cowonly_roots.next; |
| 1105 | list_del_init(next); | 1098 | list_del_init(next); |
| @@ -1112,8 +1105,23 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans, | |||
| 1112 | ret = update_cowonly_root(trans, root); | 1105 | ret = update_cowonly_root(trans, root); |
| 1113 | if (ret) | 1106 | if (ret) |
| 1114 | return ret; | 1107 | return ret; |
| 1108 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | ||
| 1109 | if (ret) | ||
| 1110 | return ret; | ||
| 1115 | } | 1111 | } |
| 1116 | 1112 | ||
| 1113 | while (!list_empty(dirty_bgs)) { | ||
| 1114 | ret = btrfs_write_dirty_block_groups(trans, root); | ||
| 1115 | if (ret) | ||
| 1116 | return ret; | ||
| 1117 | ret = btrfs_run_delayed_refs(trans, root, (unsigned long)-1); | ||
| 1118 | if (ret) | ||
| 1119 | return ret; | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | if (!list_empty(&fs_info->dirty_cowonly_roots)) | ||
| 1123 | goto again; | ||
| 1124 | |||
| 1117 | list_add_tail(&fs_info->extent_root->dirty_list, | 1125 | list_add_tail(&fs_info->extent_root->dirty_list, |
| 1118 | &trans->transaction->switch_commits); | 1126 | &trans->transaction->switch_commits); |
| 1119 | btrfs_after_dev_replace_commit(fs_info); | 1127 | btrfs_after_dev_replace_commit(fs_info); |
| @@ -1811,6 +1819,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | |||
| 1811 | 1819 | ||
| 1812 | wait_for_commit(root, cur_trans); | 1820 | wait_for_commit(root, cur_trans); |
| 1813 | 1821 | ||
| 1822 | if (unlikely(cur_trans->aborted)) | ||
| 1823 | ret = cur_trans->aborted; | ||
| 1824 | |||
| 1814 | btrfs_put_transaction(cur_trans); | 1825 | btrfs_put_transaction(cur_trans); |
| 1815 | 1826 | ||
| 1816 | return ret; | 1827 | return ret; |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ed19a7d622fa..39706c57ad3c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -890,8 +890,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) | |||
| 890 | 890 | ||
| 891 | newpage = buf->page; | 891 | newpage = buf->page; |
| 892 | 892 | ||
| 893 | if (WARN_ON(!PageUptodate(newpage))) | 893 | if (!PageUptodate(newpage)) |
| 894 | return -EIO; | 894 | SetPageUptodate(newpage); |
| 895 | 895 | ||
| 896 | ClearPageMappedToDisk(newpage); | 896 | ClearPageMappedToDisk(newpage); |
| 897 | 897 | ||
| @@ -1353,6 +1353,17 @@ static ssize_t fuse_dev_do_read(struct fuse_conn *fc, struct file *file, | |||
| 1353 | return err; | 1353 | return err; |
| 1354 | } | 1354 | } |
| 1355 | 1355 | ||
| 1356 | static int fuse_dev_open(struct inode *inode, struct file *file) | ||
| 1357 | { | ||
| 1358 | /* | ||
| 1359 | * The fuse device's file's private_data is used to hold | ||
| 1360 | * the fuse_conn(ection) when it is mounted, and is used to | ||
| 1361 | * keep track of whether the file has been mounted already. | ||
| 1362 | */ | ||
| 1363 | file->private_data = NULL; | ||
| 1364 | return 0; | ||
| 1365 | } | ||
| 1366 | |||
| 1356 | static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov, | 1367 | static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov, |
| 1357 | unsigned long nr_segs, loff_t pos) | 1368 | unsigned long nr_segs, loff_t pos) |
| 1358 | { | 1369 | { |
| @@ -1797,6 +1808,9 @@ copy_finish: | |||
| 1797 | static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, | 1808 | static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, |
| 1798 | unsigned int size, struct fuse_copy_state *cs) | 1809 | unsigned int size, struct fuse_copy_state *cs) |
| 1799 | { | 1810 | { |
| 1811 | /* Don't try to move pages (yet) */ | ||
| 1812 | cs->move_pages = 0; | ||
| 1813 | |||
| 1800 | switch (code) { | 1814 | switch (code) { |
| 1801 | case FUSE_NOTIFY_POLL: | 1815 | case FUSE_NOTIFY_POLL: |
| 1802 | return fuse_notify_poll(fc, size, cs); | 1816 | return fuse_notify_poll(fc, size, cs); |
| @@ -2217,6 +2231,7 @@ static int fuse_dev_fasync(int fd, struct file *file, int on) | |||
| 2217 | 2231 | ||
| 2218 | const struct file_operations fuse_dev_operations = { | 2232 | const struct file_operations fuse_dev_operations = { |
| 2219 | .owner = THIS_MODULE, | 2233 | .owner = THIS_MODULE, |
| 2234 | .open = fuse_dev_open, | ||
| 2220 | .llseek = no_llseek, | 2235 | .llseek = no_llseek, |
| 2221 | .read = do_sync_read, | 2236 | .read = do_sync_read, |
| 2222 | .aio_read = fuse_dev_read, | 2237 | .aio_read = fuse_dev_read, |
diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 3c1bfa155571..1028a0629543 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c | |||
| @@ -587,8 +587,6 @@ nfsd4_cb_layout_fail(struct nfs4_layout_stateid *ls) | |||
| 587 | 587 | ||
| 588 | rpc_ntop((struct sockaddr *)&clp->cl_addr, addr_str, sizeof(addr_str)); | 588 | rpc_ntop((struct sockaddr *)&clp->cl_addr, addr_str, sizeof(addr_str)); |
| 589 | 589 | ||
| 590 | nfsd4_cb_layout_fail(ls); | ||
| 591 | |||
| 592 | printk(KERN_WARNING | 590 | printk(KERN_WARNING |
| 593 | "nfsd: client %s failed to respond to layout recall. " | 591 | "nfsd: client %s failed to respond to layout recall. " |
| 594 | " Fencing..\n", addr_str); | 592 | " Fencing..\n", addr_str); |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index b90952f528b1..5f0d1993e6e3 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
| @@ -529,8 +529,7 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data) | |||
| 529 | { | 529 | { |
| 530 | struct ovl_fs *ufs = sb->s_fs_info; | 530 | struct ovl_fs *ufs = sb->s_fs_info; |
| 531 | 531 | ||
| 532 | if (!(*flags & MS_RDONLY) && | 532 | if (!(*flags & MS_RDONLY) && !ufs->upper_mnt) |
| 533 | (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))) | ||
| 534 | return -EROFS; | 533 | return -EROFS; |
| 535 | 534 | ||
| 536 | return 0; | 535 | return 0; |
| @@ -615,9 +614,19 @@ static int ovl_parse_opt(char *opt, struct ovl_config *config) | |||
| 615 | break; | 614 | break; |
| 616 | 615 | ||
| 617 | default: | 616 | default: |
| 617 | pr_err("overlayfs: unrecognized mount option \"%s\" or missing value\n", p); | ||
| 618 | return -EINVAL; | 618 | return -EINVAL; |
| 619 | } | 619 | } |
| 620 | } | 620 | } |
| 621 | |||
| 622 | /* Workdir is useless in non-upper mount */ | ||
| 623 | if (!config->upperdir && config->workdir) { | ||
| 624 | pr_info("overlayfs: option \"workdir=%s\" is useless in a non-upper mount, ignore\n", | ||
| 625 | config->workdir); | ||
| 626 | kfree(config->workdir); | ||
| 627 | config->workdir = NULL; | ||
| 628 | } | ||
| 629 | |||
| 621 | return 0; | 630 | return 0; |
| 622 | } | 631 | } |
| 623 | 632 | ||
| @@ -837,7 +846,6 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
| 837 | 846 | ||
| 838 | sb->s_stack_depth = 0; | 847 | sb->s_stack_depth = 0; |
| 839 | if (ufs->config.upperdir) { | 848 | if (ufs->config.upperdir) { |
| 840 | /* FIXME: workdir is not needed for a R/O mount */ | ||
| 841 | if (!ufs->config.workdir) { | 849 | if (!ufs->config.workdir) { |
| 842 | pr_err("overlayfs: missing 'workdir'\n"); | 850 | pr_err("overlayfs: missing 'workdir'\n"); |
| 843 | goto out_free_config; | 851 | goto out_free_config; |
| @@ -847,6 +855,13 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
| 847 | if (err) | 855 | if (err) |
| 848 | goto out_free_config; | 856 | goto out_free_config; |
| 849 | 857 | ||
| 858 | /* Upper fs should not be r/o */ | ||
| 859 | if (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY) { | ||
| 860 | pr_err("overlayfs: upper fs is r/o, try multi-lower layers mount\n"); | ||
| 861 | err = -EINVAL; | ||
| 862 | goto out_put_upperpath; | ||
| 863 | } | ||
| 864 | |||
| 850 | err = ovl_mount_dir(ufs->config.workdir, &workpath); | 865 | err = ovl_mount_dir(ufs->config.workdir, &workpath); |
| 851 | if (err) | 866 | if (err) |
| 852 | goto out_put_upperpath; | 867 | goto out_put_upperpath; |
| @@ -869,8 +884,14 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
| 869 | 884 | ||
| 870 | err = -EINVAL; | 885 | err = -EINVAL; |
| 871 | stacklen = ovl_split_lowerdirs(lowertmp); | 886 | stacklen = ovl_split_lowerdirs(lowertmp); |
| 872 | if (stacklen > OVL_MAX_STACK) | 887 | if (stacklen > OVL_MAX_STACK) { |
| 888 | pr_err("overlayfs: too many lower directries, limit is %d\n", | ||
| 889 | OVL_MAX_STACK); | ||
| 873 | goto out_free_lowertmp; | 890 | goto out_free_lowertmp; |
| 891 | } else if (!ufs->config.upperdir && stacklen == 1) { | ||
| 892 | pr_err("overlayfs: at least 2 lowerdir are needed while upperdir nonexistent\n"); | ||
| 893 | goto out_free_lowertmp; | ||
| 894 | } | ||
| 874 | 895 | ||
| 875 | stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL); | 896 | stack = kcalloc(stacklen, sizeof(struct path), GFP_KERNEL); |
| 876 | if (!stack) | 897 | if (!stack) |
| @@ -932,8 +953,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
| 932 | ufs->numlower++; | 953 | ufs->numlower++; |
| 933 | } | 954 | } |
| 934 | 955 | ||
| 935 | /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */ | 956 | /* If the upper fs is nonexistent, we mark overlayfs r/o too */ |
| 936 | if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY)) | 957 | if (!ufs->upper_mnt) |
| 937 | sb->s_flags |= MS_RDONLY; | 958 | sb->s_flags |= MS_RDONLY; |
| 938 | 959 | ||
| 939 | sb->s_d_op = &ovl_dentry_operations; | 960 | sb->s_d_op = &ovl_dentry_operations; |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 956b75d61809..6dee68d013ff 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
| @@ -1325,6 +1325,9 @@ out: | |||
| 1325 | 1325 | ||
| 1326 | static int pagemap_open(struct inode *inode, struct file *file) | 1326 | static int pagemap_open(struct inode *inode, struct file *file) |
| 1327 | { | 1327 | { |
| 1328 | /* do not disclose physical addresses: attack vector */ | ||
| 1329 | if (!capable(CAP_SYS_ADMIN)) | ||
| 1330 | return -EPERM; | ||
| 1328 | pr_warn_once("Bits 55-60 of /proc/PID/pagemap entries are about " | 1331 | pr_warn_once("Bits 55-60 of /proc/PID/pagemap entries are about " |
| 1329 | "to stop being page-shift some time soon. See the " | 1332 | "to stop being page-shift some time soon. See the " |
| 1330 | "linux/Documentation/vm/pagemap.txt for details.\n"); | 1333 | "linux/Documentation/vm/pagemap.txt for details.\n"); |
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index 7c55dd5dd2c9..66203b268984 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h | |||
| @@ -114,6 +114,7 @@ struct vgic_ops { | |||
| 114 | void (*sync_lr_elrsr)(struct kvm_vcpu *, int, struct vgic_lr); | 114 | void (*sync_lr_elrsr)(struct kvm_vcpu *, int, struct vgic_lr); |
| 115 | u64 (*get_elrsr)(const struct kvm_vcpu *vcpu); | 115 | u64 (*get_elrsr)(const struct kvm_vcpu *vcpu); |
| 116 | u64 (*get_eisr)(const struct kvm_vcpu *vcpu); | 116 | u64 (*get_eisr)(const struct kvm_vcpu *vcpu); |
| 117 | void (*clear_eisr)(struct kvm_vcpu *vcpu); | ||
| 117 | u32 (*get_interrupt_status)(const struct kvm_vcpu *vcpu); | 118 | u32 (*get_interrupt_status)(const struct kvm_vcpu *vcpu); |
| 118 | void (*enable_underflow)(struct kvm_vcpu *vcpu); | 119 | void (*enable_underflow)(struct kvm_vcpu *vcpu); |
| 119 | void (*disable_underflow)(struct kvm_vcpu *vcpu); | 120 | void (*disable_underflow)(struct kvm_vcpu *vcpu); |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 2646aed1d3fe..fd23978d93fe 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
| @@ -375,6 +375,7 @@ int dm_create(int minor, struct mapped_device **md); | |||
| 375 | */ | 375 | */ |
| 376 | struct mapped_device *dm_get_md(dev_t dev); | 376 | struct mapped_device *dm_get_md(dev_t dev); |
| 377 | void dm_get(struct mapped_device *md); | 377 | void dm_get(struct mapped_device *md); |
| 378 | int dm_hold(struct mapped_device *md); | ||
| 378 | void dm_put(struct mapped_device *md); | 379 | void dm_put(struct mapped_device *md); |
| 379 | 380 | ||
| 380 | /* | 381 | /* |
diff --git a/include/linux/module.h b/include/linux/module.h index 42999fe2dbd0..b03485bcb82a 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -344,6 +344,10 @@ struct module { | |||
| 344 | unsigned long *ftrace_callsites; | 344 | unsigned long *ftrace_callsites; |
| 345 | #endif | 345 | #endif |
| 346 | 346 | ||
| 347 | #ifdef CONFIG_LIVEPATCH | ||
| 348 | bool klp_alive; | ||
| 349 | #endif | ||
| 350 | |||
| 347 | #ifdef CONFIG_MODULE_UNLOAD | 351 | #ifdef CONFIG_MODULE_UNLOAD |
| 348 | /* What modules depend on me? */ | 352 | /* What modules depend on me? */ |
| 349 | struct list_head source_list; | 353 | struct list_head source_list; |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 429d1790a27e..dcf6ec27739b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -965,9 +965,12 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev, | |||
| 965 | * Used to add FDB entries to dump requests. Implementers should add | 965 | * Used to add FDB entries to dump requests. Implementers should add |
| 966 | * entries to skb and update idx with the number of entries. | 966 | * entries to skb and update idx with the number of entries. |
| 967 | * | 967 | * |
| 968 | * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh) | 968 | * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh, |
| 969 | * u16 flags) | ||
| 969 | * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, | 970 | * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, |
| 970 | * struct net_device *dev, u32 filter_mask) | 971 | * struct net_device *dev, u32 filter_mask) |
| 972 | * int (*ndo_bridge_dellink)(struct net_device *dev, struct nlmsghdr *nlh, | ||
| 973 | * u16 flags); | ||
| 971 | * | 974 | * |
| 972 | * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); | 975 | * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier); |
| 973 | * Called to change device carrier. Soft-devices (like dummy, team, etc) | 976 | * Called to change device carrier. Soft-devices (like dummy, team, etc) |
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h index 72c0415d6c21..18eccefea06e 100644 --- a/include/linux/pinctrl/consumer.h +++ b/include/linux/pinctrl/consumer.h | |||
| @@ -82,7 +82,7 @@ static inline int pinctrl_gpio_direction_output(unsigned gpio) | |||
| 82 | 82 | ||
| 83 | static inline struct pinctrl * __must_check pinctrl_get(struct device *dev) | 83 | static inline struct pinctrl * __must_check pinctrl_get(struct device *dev) |
| 84 | { | 84 | { |
| 85 | return ERR_PTR(-ENOSYS); | 85 | return NULL; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | static inline void pinctrl_put(struct pinctrl *p) | 88 | static inline void pinctrl_put(struct pinctrl *p) |
| @@ -93,7 +93,7 @@ static inline struct pinctrl_state * __must_check pinctrl_lookup_state( | |||
| 93 | struct pinctrl *p, | 93 | struct pinctrl *p, |
| 94 | const char *name) | 94 | const char *name) |
| 95 | { | 95 | { |
| 96 | return ERR_PTR(-ENOSYS); | 96 | return NULL; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static inline int pinctrl_select_state(struct pinctrl *p, | 99 | static inline int pinctrl_select_state(struct pinctrl *p, |
| @@ -104,7 +104,7 @@ static inline int pinctrl_select_state(struct pinctrl *p, | |||
| 104 | 104 | ||
| 105 | static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev) | 105 | static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev) |
| 106 | { | 106 | { |
| 107 | return ERR_PTR(-ENOSYS); | 107 | return NULL; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | static inline void devm_pinctrl_put(struct pinctrl *p) | 110 | static inline void devm_pinctrl_put(struct pinctrl *p) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 30007afe70b3..f54d6659713a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -948,6 +948,13 @@ static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) | |||
| 948 | to->l4_hash = from->l4_hash; | 948 | to->l4_hash = from->l4_hash; |
| 949 | }; | 949 | }; |
| 950 | 950 | ||
| 951 | static inline void skb_sender_cpu_clear(struct sk_buff *skb) | ||
| 952 | { | ||
| 953 | #ifdef CONFIG_XPS | ||
| 954 | skb->sender_cpu = 0; | ||
| 955 | #endif | ||
| 956 | } | ||
| 957 | |||
| 951 | #ifdef NET_SKBUFF_DATA_USES_OFFSET | 958 | #ifdef NET_SKBUFF_DATA_USES_OFFSET |
| 952 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) | 959 | static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) |
| 953 | { | 960 | { |
diff --git a/include/net/dst.h b/include/net/dst.h index a8ae4e760778..0fb99a26e973 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -481,6 +481,7 @@ void dst_init(void); | |||
| 481 | enum { | 481 | enum { |
| 482 | XFRM_LOOKUP_ICMP = 1 << 0, | 482 | XFRM_LOOKUP_ICMP = 1 << 0, |
| 483 | XFRM_LOOKUP_QUEUE = 1 << 1, | 483 | XFRM_LOOKUP_QUEUE = 1 << 1, |
| 484 | XFRM_LOOKUP_KEEP_DST_REF = 1 << 2, | ||
| 484 | }; | 485 | }; |
| 485 | 486 | ||
| 486 | struct flowi; | 487 | struct flowi; |
diff --git a/include/net/vxlan.h b/include/net/vxlan.h index eabd3a038674..c73e7abbbaa5 100644 --- a/include/net/vxlan.h +++ b/include/net/vxlan.h | |||
| @@ -91,6 +91,7 @@ struct vxlanhdr { | |||
| 91 | 91 | ||
| 92 | #define VXLAN_N_VID (1u << 24) | 92 | #define VXLAN_N_VID (1u << 24) |
| 93 | #define VXLAN_VID_MASK (VXLAN_N_VID - 1) | 93 | #define VXLAN_VID_MASK (VXLAN_N_VID - 1) |
| 94 | #define VXLAN_VNI_MASK (VXLAN_VID_MASK << 8) | ||
| 94 | #define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr)) | 95 | #define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr)) |
| 95 | 96 | ||
| 96 | struct vxlan_metadata { | 97 | struct vxlan_metadata { |
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index db81c65b8f48..d61be7297b2c 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
| @@ -111,6 +111,7 @@ void array_free(void *array, int n); | |||
| 111 | void target_core_setup_sub_cits(struct se_subsystem_api *); | 111 | void target_core_setup_sub_cits(struct se_subsystem_api *); |
| 112 | 112 | ||
| 113 | /* attribute helpers from target_core_device.c for backend drivers */ | 113 | /* attribute helpers from target_core_device.c for backend drivers */ |
| 114 | bool se_dev_check_wce(struct se_device *); | ||
| 114 | int se_dev_set_max_unmap_lba_count(struct se_device *, u32); | 115 | int se_dev_set_max_unmap_lba_count(struct se_device *, u32); |
| 115 | int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32); | 116 | int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32); |
| 116 | int se_dev_set_unmap_granularity(struct se_device *, u32); | 117 | int se_dev_set_unmap_granularity(struct se_device *, u32); |
diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h index 3c53eec4ae22..19c66fcbab8a 100644 --- a/include/uapi/linux/virtio_blk.h +++ b/include/uapi/linux/virtio_blk.h | |||
| @@ -60,7 +60,7 @@ struct virtio_blk_config { | |||
| 60 | __u32 size_max; | 60 | __u32 size_max; |
| 61 | /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ | 61 | /* The maximum number of segments (if VIRTIO_BLK_F_SEG_MAX) */ |
| 62 | __u32 seg_max; | 62 | __u32 seg_max; |
| 63 | /* geometry the device (if VIRTIO_BLK_F_GEOMETRY) */ | 63 | /* geometry of the device (if VIRTIO_BLK_F_GEOMETRY) */ |
| 64 | struct virtio_blk_geometry { | 64 | struct virtio_blk_geometry { |
| 65 | __u16 cylinders; | 65 | __u16 cylinders; |
| 66 | __u8 heads; | 66 | __u8 heads; |
| @@ -119,7 +119,11 @@ struct virtio_blk_config { | |||
| 119 | #define VIRTIO_BLK_T_BARRIER 0x80000000 | 119 | #define VIRTIO_BLK_T_BARRIER 0x80000000 |
| 120 | #endif /* !VIRTIO_BLK_NO_LEGACY */ | 120 | #endif /* !VIRTIO_BLK_NO_LEGACY */ |
| 121 | 121 | ||
| 122 | /* This is the first element of the read scatter-gather list. */ | 122 | /* |
| 123 | * This comes first in the read scatter-gather list. | ||
| 124 | * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, | ||
| 125 | * this is the first element of the read scatter-gather list. | ||
| 126 | */ | ||
| 123 | struct virtio_blk_outhdr { | 127 | struct virtio_blk_outhdr { |
| 124 | /* VIRTIO_BLK_T* */ | 128 | /* VIRTIO_BLK_T* */ |
| 125 | __virtio32 type; | 129 | __virtio32 type; |
diff --git a/include/uapi/linux/virtio_scsi.h b/include/uapi/linux/virtio_scsi.h index 42b9370771b0..cc18ef8825c0 100644 --- a/include/uapi/linux/virtio_scsi.h +++ b/include/uapi/linux/virtio_scsi.h | |||
| @@ -29,8 +29,16 @@ | |||
| 29 | 29 | ||
| 30 | #include <linux/virtio_types.h> | 30 | #include <linux/virtio_types.h> |
| 31 | 31 | ||
| 32 | #define VIRTIO_SCSI_CDB_SIZE 32 | 32 | /* Default values of the CDB and sense data size configuration fields */ |
| 33 | #define VIRTIO_SCSI_SENSE_SIZE 96 | 33 | #define VIRTIO_SCSI_CDB_DEFAULT_SIZE 32 |
| 34 | #define VIRTIO_SCSI_SENSE_DEFAULT_SIZE 96 | ||
| 35 | |||
| 36 | #ifndef VIRTIO_SCSI_CDB_SIZE | ||
| 37 | #define VIRTIO_SCSI_CDB_SIZE VIRTIO_SCSI_CDB_DEFAULT_SIZE | ||
| 38 | #endif | ||
| 39 | #ifndef VIRTIO_SCSI_SENSE_SIZE | ||
| 40 | #define VIRTIO_SCSI_SENSE_SIZE VIRTIO_SCSI_SENSE_DEFAULT_SIZE | ||
| 41 | #endif | ||
| 34 | 42 | ||
| 35 | /* SCSI command request, followed by data-out */ | 43 | /* SCSI command request, followed by data-out */ |
| 36 | struct virtio_scsi_cmd_req { | 44 | struct virtio_scsi_cmd_req { |
diff --git a/kernel/events/core.c b/kernel/events/core.c index f04daabfd1cf..453ef61311d4 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
| @@ -3591,7 +3591,7 @@ static void put_event(struct perf_event *event) | |||
| 3591 | ctx = perf_event_ctx_lock_nested(event, SINGLE_DEPTH_NESTING); | 3591 | ctx = perf_event_ctx_lock_nested(event, SINGLE_DEPTH_NESTING); |
| 3592 | WARN_ON_ONCE(ctx->parent_ctx); | 3592 | WARN_ON_ONCE(ctx->parent_ctx); |
| 3593 | perf_remove_from_context(event, true); | 3593 | perf_remove_from_context(event, true); |
| 3594 | mutex_unlock(&ctx->mutex); | 3594 | perf_event_ctx_unlock(event, ctx); |
| 3595 | 3595 | ||
| 3596 | _free_event(event); | 3596 | _free_event(event); |
| 3597 | } | 3597 | } |
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 01ca08804f51..3f9f1d6b4c2e 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c | |||
| @@ -89,16 +89,28 @@ static bool klp_is_object_loaded(struct klp_object *obj) | |||
| 89 | /* sets obj->mod if object is not vmlinux and module is found */ | 89 | /* sets obj->mod if object is not vmlinux and module is found */ |
| 90 | static void klp_find_object_module(struct klp_object *obj) | 90 | static void klp_find_object_module(struct klp_object *obj) |
| 91 | { | 91 | { |
| 92 | struct module *mod; | ||
| 93 | |||
| 92 | if (!klp_is_module(obj)) | 94 | if (!klp_is_module(obj)) |
| 93 | return; | 95 | return; |
| 94 | 96 | ||
| 95 | mutex_lock(&module_mutex); | 97 | mutex_lock(&module_mutex); |
| 96 | /* | 98 | /* |
| 97 | * We don't need to take a reference on the module here because we have | 99 | * We do not want to block removal of patched modules and therefore |
| 98 | * the klp_mutex, which is also taken by the module notifier. This | 100 | * we do not take a reference here. The patches are removed by |
| 99 | * prevents any module from unloading until we release the klp_mutex. | 101 | * a going module handler instead. |
| 102 | */ | ||
| 103 | mod = find_module(obj->name); | ||
| 104 | /* | ||
| 105 | * Do not mess work of the module coming and going notifiers. | ||
| 106 | * Note that the patch might still be needed before the going handler | ||
| 107 | * is called. Module functions can be called even in the GOING state | ||
| 108 | * until mod->exit() finishes. This is especially important for | ||
| 109 | * patches that modify semantic of the functions. | ||
| 100 | */ | 110 | */ |
| 101 | obj->mod = find_module(obj->name); | 111 | if (mod && mod->klp_alive) |
| 112 | obj->mod = mod; | ||
| 113 | |||
| 102 | mutex_unlock(&module_mutex); | 114 | mutex_unlock(&module_mutex); |
| 103 | } | 115 | } |
| 104 | 116 | ||
| @@ -767,6 +779,7 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj) | |||
| 767 | return -EINVAL; | 779 | return -EINVAL; |
| 768 | 780 | ||
| 769 | obj->state = KLP_DISABLED; | 781 | obj->state = KLP_DISABLED; |
| 782 | obj->mod = NULL; | ||
| 770 | 783 | ||
| 771 | klp_find_object_module(obj); | 784 | klp_find_object_module(obj); |
| 772 | 785 | ||
| @@ -961,6 +974,15 @@ static int klp_module_notify(struct notifier_block *nb, unsigned long action, | |||
| 961 | 974 | ||
| 962 | mutex_lock(&klp_mutex); | 975 | mutex_lock(&klp_mutex); |
| 963 | 976 | ||
| 977 | /* | ||
| 978 | * Each module has to know that the notifier has been called. | ||
| 979 | * We never know what module will get patched by a new patch. | ||
| 980 | */ | ||
| 981 | if (action == MODULE_STATE_COMING) | ||
| 982 | mod->klp_alive = true; | ||
| 983 | else /* MODULE_STATE_GOING */ | ||
| 984 | mod->klp_alive = false; | ||
| 985 | |||
| 964 | list_for_each_entry(patch, &klp_patches, list) { | 986 | list_for_each_entry(patch, &klp_patches, list) { |
| 965 | for (obj = patch->objs; obj->funcs; obj++) { | 987 | for (obj = patch->objs; obj->funcs; obj++) { |
| 966 | if (!klp_is_module(obj) || strcmp(obj->name, mod->name)) | 988 | if (!klp_is_module(obj) || strcmp(obj->name, mod->name)) |
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index d8e376a5f0f1..36a1a739ad68 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
| @@ -658,14 +658,30 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args) | |||
| 658 | static void p9_virtio_remove(struct virtio_device *vdev) | 658 | static void p9_virtio_remove(struct virtio_device *vdev) |
| 659 | { | 659 | { |
| 660 | struct virtio_chan *chan = vdev->priv; | 660 | struct virtio_chan *chan = vdev->priv; |
| 661 | 661 | unsigned long warning_time; | |
| 662 | if (chan->inuse) | ||
| 663 | p9_virtio_close(chan->client); | ||
| 664 | vdev->config->del_vqs(vdev); | ||
| 665 | 662 | ||
| 666 | mutex_lock(&virtio_9p_lock); | 663 | mutex_lock(&virtio_9p_lock); |
| 664 | |||
| 665 | /* Remove self from list so we don't get new users. */ | ||
| 667 | list_del(&chan->chan_list); | 666 | list_del(&chan->chan_list); |
| 667 | warning_time = jiffies; | ||
| 668 | |||
| 669 | /* Wait for existing users to close. */ | ||
| 670 | while (chan->inuse) { | ||
| 671 | mutex_unlock(&virtio_9p_lock); | ||
| 672 | msleep(250); | ||
| 673 | if (time_after(jiffies, warning_time + 10 * HZ)) { | ||
| 674 | dev_emerg(&vdev->dev, | ||
| 675 | "p9_virtio_remove: waiting for device in use.\n"); | ||
| 676 | warning_time = jiffies; | ||
| 677 | } | ||
| 678 | mutex_lock(&virtio_9p_lock); | ||
| 679 | } | ||
| 680 | |||
| 668 | mutex_unlock(&virtio_9p_lock); | 681 | mutex_unlock(&virtio_9p_lock); |
| 682 | |||
| 683 | vdev->config->del_vqs(vdev); | ||
| 684 | |||
| 669 | sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); | 685 | sysfs_remove_file(&(vdev->dev.kobj), &dev_attr_mount_tag.attr); |
| 670 | kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE); | 686 | kobject_uevent(&(vdev->dev.kobj), KOBJ_CHANGE); |
| 671 | kfree(chan->tag); | 687 | kfree(chan->tag); |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index b087d278c679..1849d96b3c91 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
| @@ -563,6 +563,8 @@ int br_del_if(struct net_bridge *br, struct net_device *dev) | |||
| 563 | */ | 563 | */ |
| 564 | del_nbp(p); | 564 | del_nbp(p); |
| 565 | 565 | ||
| 566 | dev_set_mtu(br->dev, br_min_mtu(br)); | ||
| 567 | |||
| 566 | spin_lock_bh(&br->lock); | 568 | spin_lock_bh(&br->lock); |
| 567 | changed_addr = br_stp_recalculate_bridge_id(br); | 569 | changed_addr = br_stp_recalculate_bridge_id(br); |
| 568 | spin_unlock_bh(&br->lock); | 570 | spin_unlock_bh(&br->lock); |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 769b185fefbd..a6e2da0bc718 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
| @@ -281,7 +281,7 @@ static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 281 | int copylen; | 281 | int copylen; |
| 282 | 282 | ||
| 283 | ret = -EOPNOTSUPP; | 283 | ret = -EOPNOTSUPP; |
| 284 | if (m->msg_flags&MSG_OOB) | 284 | if (flags & MSG_OOB) |
| 285 | goto read_error; | 285 | goto read_error; |
| 286 | 286 | ||
| 287 | skb = skb_recv_datagram(sk, flags, 0 , &ret); | 287 | skb = skb_recv_datagram(sk, flags, 0 , &ret); |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 25b4b5d23485..ee0608bb3bc0 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
| @@ -2166,28 +2166,28 @@ replay: | |||
| 2166 | } | 2166 | } |
| 2167 | } | 2167 | } |
| 2168 | err = rtnl_configure_link(dev, ifm); | 2168 | err = rtnl_configure_link(dev, ifm); |
| 2169 | if (err < 0) { | 2169 | if (err < 0) |
| 2170 | if (ops->newlink) { | 2170 | goto out_unregister; |
| 2171 | LIST_HEAD(list_kill); | ||
| 2172 | |||
| 2173 | ops->dellink(dev, &list_kill); | ||
| 2174 | unregister_netdevice_many(&list_kill); | ||
| 2175 | } else { | ||
| 2176 | unregister_netdevice(dev); | ||
| 2177 | } | ||
| 2178 | goto out; | ||
| 2179 | } | ||
| 2180 | |||
| 2181 | if (link_net) { | 2171 | if (link_net) { |
| 2182 | err = dev_change_net_namespace(dev, dest_net, ifname); | 2172 | err = dev_change_net_namespace(dev, dest_net, ifname); |
| 2183 | if (err < 0) | 2173 | if (err < 0) |
| 2184 | unregister_netdevice(dev); | 2174 | goto out_unregister; |
| 2185 | } | 2175 | } |
| 2186 | out: | 2176 | out: |
| 2187 | if (link_net) | 2177 | if (link_net) |
| 2188 | put_net(link_net); | 2178 | put_net(link_net); |
| 2189 | put_net(dest_net); | 2179 | put_net(dest_net); |
| 2190 | return err; | 2180 | return err; |
| 2181 | out_unregister: | ||
| 2182 | if (ops->newlink) { | ||
| 2183 | LIST_HEAD(list_kill); | ||
| 2184 | |||
| 2185 | ops->dellink(dev, &list_kill); | ||
| 2186 | unregister_netdevice_many(&list_kill); | ||
| 2187 | } else { | ||
| 2188 | unregister_netdevice(dev); | ||
| 2189 | } | ||
| 2190 | goto out; | ||
| 2191 | } | 2191 | } |
| 2192 | } | 2192 | } |
| 2193 | 2193 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index f80507823531..8e4ac97c8477 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
| @@ -3733,9 +3733,13 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, | |||
| 3733 | struct sock *sk, int tstype) | 3733 | struct sock *sk, int tstype) |
| 3734 | { | 3734 | { |
| 3735 | struct sk_buff *skb; | 3735 | struct sk_buff *skb; |
| 3736 | bool tsonly = sk->sk_tsflags & SOF_TIMESTAMPING_OPT_TSONLY; | 3736 | bool tsonly; |
| 3737 | 3737 | ||
| 3738 | if (!sk || !skb_may_tx_timestamp(sk, tsonly)) | 3738 | if (!sk) |
| 3739 | return; | ||
| 3740 | |||
| 3741 | tsonly = sk->sk_tsflags & SOF_TIMESTAMPING_OPT_TSONLY; | ||
| 3742 | if (!skb_may_tx_timestamp(sk, tsonly)) | ||
| 3739 | return; | 3743 | return; |
| 3740 | 3744 | ||
| 3741 | if (tsonly) | 3745 | if (tsonly) |
| @@ -4173,7 +4177,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) | |||
| 4173 | skb->ignore_df = 0; | 4177 | skb->ignore_df = 0; |
| 4174 | skb_dst_drop(skb); | 4178 | skb_dst_drop(skb); |
| 4175 | skb->mark = 0; | 4179 | skb->mark = 0; |
| 4176 | skb->sender_cpu = 0; | 4180 | skb_sender_cpu_clear(skb); |
| 4177 | skb_init_secmark(skb); | 4181 | skb_init_secmark(skb); |
| 4178 | secpath_reset(skb); | 4182 | secpath_reset(skb); |
| 4179 | nf_reset(skb); | 4183 | nf_reset(skb); |
diff --git a/net/core/sock.c b/net/core/sock.c index 93c8b20c91e4..78e89eb7eb70 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
| @@ -1655,6 +1655,10 @@ void sock_rfree(struct sk_buff *skb) | |||
| 1655 | } | 1655 | } |
| 1656 | EXPORT_SYMBOL(sock_rfree); | 1656 | EXPORT_SYMBOL(sock_rfree); |
| 1657 | 1657 | ||
| 1658 | /* | ||
| 1659 | * Buffer destructor for skbs that are not used directly in read or write | ||
| 1660 | * path, e.g. for error handler skbs. Automatically called from kfree_skb. | ||
| 1661 | */ | ||
| 1658 | void sock_efree(struct sk_buff *skb) | 1662 | void sock_efree(struct sk_buff *skb) |
| 1659 | { | 1663 | { |
| 1660 | sock_put(skb->sk); | 1664 | sock_put(skb->sk); |
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index 433424804284..8ce351ffceb1 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | static int zero = 0; | 25 | static int zero = 0; |
| 26 | static int one = 1; | 26 | static int one = 1; |
| 27 | static int ushort_max = USHRT_MAX; | 27 | static int ushort_max = USHRT_MAX; |
| 28 | static int min_sndbuf = SOCK_MIN_SNDBUF; | ||
| 29 | static int min_rcvbuf = SOCK_MIN_RCVBUF; | ||
| 28 | 30 | ||
| 29 | static int net_msg_warn; /* Unused, but still a sysctl */ | 31 | static int net_msg_warn; /* Unused, but still a sysctl */ |
| 30 | 32 | ||
| @@ -237,7 +239,7 @@ static struct ctl_table net_core_table[] = { | |||
| 237 | .maxlen = sizeof(int), | 239 | .maxlen = sizeof(int), |
| 238 | .mode = 0644, | 240 | .mode = 0644, |
| 239 | .proc_handler = proc_dointvec_minmax, | 241 | .proc_handler = proc_dointvec_minmax, |
| 240 | .extra1 = &one, | 242 | .extra1 = &min_sndbuf, |
| 241 | }, | 243 | }, |
| 242 | { | 244 | { |
| 243 | .procname = "rmem_max", | 245 | .procname = "rmem_max", |
| @@ -245,7 +247,7 @@ static struct ctl_table net_core_table[] = { | |||
| 245 | .maxlen = sizeof(int), | 247 | .maxlen = sizeof(int), |
| 246 | .mode = 0644, | 248 | .mode = 0644, |
| 247 | .proc_handler = proc_dointvec_minmax, | 249 | .proc_handler = proc_dointvec_minmax, |
| 248 | .extra1 = &one, | 250 | .extra1 = &min_rcvbuf, |
| 249 | }, | 251 | }, |
| 250 | { | 252 | { |
| 251 | .procname = "wmem_default", | 253 | .procname = "wmem_default", |
| @@ -253,7 +255,7 @@ static struct ctl_table net_core_table[] = { | |||
| 253 | .maxlen = sizeof(int), | 255 | .maxlen = sizeof(int), |
| 254 | .mode = 0644, | 256 | .mode = 0644, |
| 255 | .proc_handler = proc_dointvec_minmax, | 257 | .proc_handler = proc_dointvec_minmax, |
| 256 | .extra1 = &one, | 258 | .extra1 = &min_sndbuf, |
| 257 | }, | 259 | }, |
| 258 | { | 260 | { |
| 259 | .procname = "rmem_default", | 261 | .procname = "rmem_default", |
| @@ -261,7 +263,7 @@ static struct ctl_table net_core_table[] = { | |||
| 261 | .maxlen = sizeof(int), | 263 | .maxlen = sizeof(int), |
| 262 | .mode = 0644, | 264 | .mode = 0644, |
| 263 | .proc_handler = proc_dointvec_minmax, | 265 | .proc_handler = proc_dointvec_minmax, |
| 264 | .extra1 = &one, | 266 | .extra1 = &min_rcvbuf, |
| 265 | }, | 267 | }, |
| 266 | { | 268 | { |
| 267 | .procname = "dev_weight", | 269 | .procname = "dev_weight", |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 14d02ea905b6..3e44b9b0b78e 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
| @@ -268,6 +268,7 @@ static int inet_csk_wait_for_connect(struct sock *sk, long timeo) | |||
| 268 | release_sock(sk); | 268 | release_sock(sk); |
| 269 | if (reqsk_queue_empty(&icsk->icsk_accept_queue)) | 269 | if (reqsk_queue_empty(&icsk->icsk_accept_queue)) |
| 270 | timeo = schedule_timeout(timeo); | 270 | timeo = schedule_timeout(timeo); |
| 271 | sched_annotate_sleep(); | ||
| 271 | lock_sock(sk); | 272 | lock_sock(sk); |
| 272 | err = 0; | 273 | err = 0; |
| 273 | if (!reqsk_queue_empty(&icsk->icsk_accept_queue)) | 274 | if (!reqsk_queue_empty(&icsk->icsk_accept_queue)) |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 81751f12645f..592aff37366b 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
| @@ -71,6 +71,20 @@ static inline void inet_diag_unlock_handler( | |||
| 71 | mutex_unlock(&inet_diag_table_mutex); | 71 | mutex_unlock(&inet_diag_table_mutex); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static size_t inet_sk_attr_size(void) | ||
| 75 | { | ||
| 76 | return nla_total_size(sizeof(struct tcp_info)) | ||
| 77 | + nla_total_size(1) /* INET_DIAG_SHUTDOWN */ | ||
| 78 | + nla_total_size(1) /* INET_DIAG_TOS */ | ||
| 79 | + nla_total_size(1) /* INET_DIAG_TCLASS */ | ||
| 80 | + nla_total_size(sizeof(struct inet_diag_meminfo)) | ||
| 81 | + nla_total_size(sizeof(struct inet_diag_msg)) | ||
| 82 | + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) | ||
| 83 | + nla_total_size(TCP_CA_NAME_MAX) | ||
| 84 | + nla_total_size(sizeof(struct tcpvegas_info)) | ||
| 85 | + 64; | ||
| 86 | } | ||
| 87 | |||
| 74 | int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, | 88 | int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, |
| 75 | struct sk_buff *skb, struct inet_diag_req_v2 *req, | 89 | struct sk_buff *skb, struct inet_diag_req_v2 *req, |
| 76 | struct user_namespace *user_ns, | 90 | struct user_namespace *user_ns, |
| @@ -326,9 +340,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_s | |||
| 326 | if (err) | 340 | if (err) |
| 327 | goto out; | 341 | goto out; |
| 328 | 342 | ||
| 329 | rep = nlmsg_new(sizeof(struct inet_diag_msg) + | 343 | rep = nlmsg_new(inet_sk_attr_size(), GFP_KERNEL); |
| 330 | sizeof(struct inet_diag_meminfo) + | ||
| 331 | sizeof(struct tcp_info) + 64, GFP_KERNEL); | ||
| 332 | if (!rep) { | 344 | if (!rep) { |
| 333 | err = -ENOMEM; | 345 | err = -ENOMEM; |
| 334 | goto out; | 346 | goto out; |
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 787b3c294ce6..d9bc28ac5d1b 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
| @@ -67,6 +67,7 @@ static int ip_forward_finish(struct sk_buff *skb) | |||
| 67 | if (unlikely(opt->optlen)) | 67 | if (unlikely(opt->optlen)) |
| 68 | ip_forward_options(skb); | 68 | ip_forward_options(skb); |
| 69 | 69 | ||
| 70 | skb_sender_cpu_clear(skb); | ||
| 70 | return dst_output(skb); | 71 | return dst_output(skb); |
| 71 | } | 72 | } |
| 72 | 73 | ||
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index d694088214cd..62856e185a93 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
| @@ -378,6 +378,12 @@ EXPORT_SYMBOL_GPL(tcp_slow_start); | |||
| 378 | */ | 378 | */ |
| 379 | void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked) | 379 | void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked) |
| 380 | { | 380 | { |
| 381 | /* If credits accumulated at a higher w, apply them gently now. */ | ||
| 382 | if (tp->snd_cwnd_cnt >= w) { | ||
| 383 | tp->snd_cwnd_cnt = 0; | ||
| 384 | tp->snd_cwnd++; | ||
| 385 | } | ||
| 386 | |||
| 381 | tp->snd_cwnd_cnt += acked; | 387 | tp->snd_cwnd_cnt += acked; |
| 382 | if (tp->snd_cwnd_cnt >= w) { | 388 | if (tp->snd_cwnd_cnt >= w) { |
| 383 | u32 delta = tp->snd_cwnd_cnt / w; | 389 | u32 delta = tp->snd_cwnd_cnt / w; |
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 4b276d1ed980..06d3d665a9fd 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c | |||
| @@ -306,8 +306,10 @@ tcp_friendliness: | |||
| 306 | } | 306 | } |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | if (ca->cnt == 0) /* cannot be zero */ | 309 | /* The maximum rate of cwnd increase CUBIC allows is 1 packet per |
| 310 | ca->cnt = 1; | 310 | * 2 packets ACKed, meaning cwnd grows at 1.5x per RTT. |
| 311 | */ | ||
| 312 | ca->cnt = max(ca->cnt, 2U); | ||
| 311 | } | 313 | } |
| 312 | 314 | ||
| 313 | static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) | 315 | static void bictcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) |
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index d5f6bd9a210a..dab73813cb92 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
| @@ -63,6 +63,7 @@ int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb) | |||
| 63 | return err; | 63 | return err; |
| 64 | 64 | ||
| 65 | IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE; | 65 | IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE; |
| 66 | skb->protocol = htons(ETH_P_IP); | ||
| 66 | 67 | ||
| 67 | return x->outer_mode->output2(x, skb); | 68 | return x->outer_mode->output2(x, skb); |
| 68 | } | 69 | } |
| @@ -71,7 +72,6 @@ EXPORT_SYMBOL(xfrm4_prepare_output); | |||
| 71 | int xfrm4_output_finish(struct sk_buff *skb) | 72 | int xfrm4_output_finish(struct sk_buff *skb) |
| 72 | { | 73 | { |
| 73 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); | 74 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
| 74 | skb->protocol = htons(ETH_P_IP); | ||
| 75 | 75 | ||
| 76 | #ifdef CONFIG_NETFILTER | 76 | #ifdef CONFIG_NETFILTER |
| 77 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; | 77 | IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 0a04a37305d5..7e80b61b51ff 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
| @@ -318,6 +318,7 @@ static int ip6_forward_proxy_check(struct sk_buff *skb) | |||
| 318 | 318 | ||
| 319 | static inline int ip6_forward_finish(struct sk_buff *skb) | 319 | static inline int ip6_forward_finish(struct sk_buff *skb) |
| 320 | { | 320 | { |
| 321 | skb_sender_cpu_clear(skb); | ||
| 321 | return dst_output(skb); | 322 | return dst_output(skb); |
| 322 | } | 323 | } |
| 323 | 324 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 266a264ec212..ddd94eca19b3 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
| @@ -314,7 +314,7 @@ out: | |||
| 314 | * Create tunnel matching given parameters. | 314 | * Create tunnel matching given parameters. |
| 315 | * | 315 | * |
| 316 | * Return: | 316 | * Return: |
| 317 | * created tunnel or NULL | 317 | * created tunnel or error pointer |
| 318 | **/ | 318 | **/ |
| 319 | 319 | ||
| 320 | static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) | 320 | static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) |
| @@ -322,7 +322,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) | |||
| 322 | struct net_device *dev; | 322 | struct net_device *dev; |
| 323 | struct ip6_tnl *t; | 323 | struct ip6_tnl *t; |
| 324 | char name[IFNAMSIZ]; | 324 | char name[IFNAMSIZ]; |
| 325 | int err; | 325 | int err = -ENOMEM; |
| 326 | 326 | ||
| 327 | if (p->name[0]) | 327 | if (p->name[0]) |
| 328 | strlcpy(name, p->name, IFNAMSIZ); | 328 | strlcpy(name, p->name, IFNAMSIZ); |
| @@ -348,7 +348,7 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct __ip6_tnl_parm *p) | |||
| 348 | failed_free: | 348 | failed_free: |
| 349 | ip6_dev_free(dev); | 349 | ip6_dev_free(dev); |
| 350 | failed: | 350 | failed: |
| 351 | return NULL; | 351 | return ERR_PTR(err); |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | /** | 354 | /** |
| @@ -362,7 +362,7 @@ failed: | |||
| 362 | * tunnel device is created and registered for use. | 362 | * tunnel device is created and registered for use. |
| 363 | * | 363 | * |
| 364 | * Return: | 364 | * Return: |
| 365 | * matching tunnel or NULL | 365 | * matching tunnel or error pointer |
| 366 | **/ | 366 | **/ |
| 367 | 367 | ||
| 368 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, | 368 | static struct ip6_tnl *ip6_tnl_locate(struct net *net, |
| @@ -380,13 +380,13 @@ static struct ip6_tnl *ip6_tnl_locate(struct net *net, | |||
| 380 | if (ipv6_addr_equal(local, &t->parms.laddr) && | 380 | if (ipv6_addr_equal(local, &t->parms.laddr) && |
| 381 | ipv6_addr_equal(remote, &t->parms.raddr)) { | 381 | ipv6_addr_equal(remote, &t->parms.raddr)) { |
| 382 | if (create) | 382 | if (create) |
| 383 | return NULL; | 383 | return ERR_PTR(-EEXIST); |
| 384 | 384 | ||
| 385 | return t; | 385 | return t; |
| 386 | } | 386 | } |
| 387 | } | 387 | } |
| 388 | if (!create) | 388 | if (!create) |
| 389 | return NULL; | 389 | return ERR_PTR(-ENODEV); |
| 390 | return ip6_tnl_create(net, p); | 390 | return ip6_tnl_create(net, p); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| @@ -1420,7 +1420,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
| 1420 | } | 1420 | } |
| 1421 | ip6_tnl_parm_from_user(&p1, &p); | 1421 | ip6_tnl_parm_from_user(&p1, &p); |
| 1422 | t = ip6_tnl_locate(net, &p1, 0); | 1422 | t = ip6_tnl_locate(net, &p1, 0); |
| 1423 | if (t == NULL) | 1423 | if (IS_ERR(t)) |
| 1424 | t = netdev_priv(dev); | 1424 | t = netdev_priv(dev); |
| 1425 | } else { | 1425 | } else { |
| 1426 | memset(&p, 0, sizeof(p)); | 1426 | memset(&p, 0, sizeof(p)); |
| @@ -1445,7 +1445,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
| 1445 | ip6_tnl_parm_from_user(&p1, &p); | 1445 | ip6_tnl_parm_from_user(&p1, &p); |
| 1446 | t = ip6_tnl_locate(net, &p1, cmd == SIOCADDTUNNEL); | 1446 | t = ip6_tnl_locate(net, &p1, cmd == SIOCADDTUNNEL); |
| 1447 | if (cmd == SIOCCHGTUNNEL) { | 1447 | if (cmd == SIOCCHGTUNNEL) { |
| 1448 | if (t != NULL) { | 1448 | if (!IS_ERR(t)) { |
| 1449 | if (t->dev != dev) { | 1449 | if (t->dev != dev) { |
| 1450 | err = -EEXIST; | 1450 | err = -EEXIST; |
| 1451 | break; | 1451 | break; |
| @@ -1457,14 +1457,15 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
| 1457 | else | 1457 | else |
| 1458 | err = ip6_tnl_update(t, &p1); | 1458 | err = ip6_tnl_update(t, &p1); |
| 1459 | } | 1459 | } |
| 1460 | if (t) { | 1460 | if (!IS_ERR(t)) { |
| 1461 | err = 0; | 1461 | err = 0; |
| 1462 | ip6_tnl_parm_to_user(&p, &t->parms); | 1462 | ip6_tnl_parm_to_user(&p, &t->parms); |
| 1463 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) | 1463 | if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof(p))) |
| 1464 | err = -EFAULT; | 1464 | err = -EFAULT; |
| 1465 | 1465 | ||
| 1466 | } else | 1466 | } else { |
| 1467 | err = (cmd == SIOCADDTUNNEL ? -ENOBUFS : -ENOENT); | 1467 | err = PTR_ERR(t); |
| 1468 | } | ||
| 1468 | break; | 1469 | break; |
| 1469 | case SIOCDELTUNNEL: | 1470 | case SIOCDELTUNNEL: |
| 1470 | err = -EPERM; | 1471 | err = -EPERM; |
| @@ -1478,7 +1479,7 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
| 1478 | err = -ENOENT; | 1479 | err = -ENOENT; |
| 1479 | ip6_tnl_parm_from_user(&p1, &p); | 1480 | ip6_tnl_parm_from_user(&p1, &p); |
| 1480 | t = ip6_tnl_locate(net, &p1, 0); | 1481 | t = ip6_tnl_locate(net, &p1, 0); |
| 1481 | if (t == NULL) | 1482 | if (IS_ERR(t)) |
| 1482 | break; | 1483 | break; |
| 1483 | err = -EPERM; | 1484 | err = -EPERM; |
| 1484 | if (t->dev == ip6n->fb_tnl_dev) | 1485 | if (t->dev == ip6n->fb_tnl_dev) |
| @@ -1672,12 +1673,13 @@ static int ip6_tnl_newlink(struct net *src_net, struct net_device *dev, | |||
| 1672 | struct nlattr *tb[], struct nlattr *data[]) | 1673 | struct nlattr *tb[], struct nlattr *data[]) |
| 1673 | { | 1674 | { |
| 1674 | struct net *net = dev_net(dev); | 1675 | struct net *net = dev_net(dev); |
| 1675 | struct ip6_tnl *nt; | 1676 | struct ip6_tnl *nt, *t; |
| 1676 | 1677 | ||
| 1677 | nt = netdev_priv(dev); | 1678 | nt = netdev_priv(dev); |
| 1678 | ip6_tnl_netlink_parms(data, &nt->parms); | 1679 | ip6_tnl_netlink_parms(data, &nt->parms); |
| 1679 | 1680 | ||
| 1680 | if (ip6_tnl_locate(net, &nt->parms, 0)) | 1681 | t = ip6_tnl_locate(net, &nt->parms, 0); |
| 1682 | if (!IS_ERR(t)) | ||
| 1681 | return -EEXIST; | 1683 | return -EEXIST; |
| 1682 | 1684 | ||
| 1683 | return ip6_tnl_create2(dev); | 1685 | return ip6_tnl_create2(dev); |
| @@ -1697,8 +1699,7 @@ static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[], | |||
| 1697 | ip6_tnl_netlink_parms(data, &p); | 1699 | ip6_tnl_netlink_parms(data, &p); |
| 1698 | 1700 | ||
| 1699 | t = ip6_tnl_locate(net, &p, 0); | 1701 | t = ip6_tnl_locate(net, &p, 0); |
| 1700 | 1702 | if (!IS_ERR(t)) { | |
| 1701 | if (t) { | ||
| 1702 | if (t->dev != dev) | 1703 | if (t->dev != dev) |
| 1703 | return -EEXIST; | 1704 | return -EEXIST; |
| 1704 | } else | 1705 | } else |
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index ca3f29b98ae5..010f8bd2d577 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c | |||
| @@ -114,6 +114,7 @@ int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb) | |||
| 114 | return err; | 114 | return err; |
| 115 | 115 | ||
| 116 | skb->ignore_df = 1; | 116 | skb->ignore_df = 1; |
| 117 | skb->protocol = htons(ETH_P_IPV6); | ||
| 117 | 118 | ||
| 118 | return x->outer_mode->output2(x, skb); | 119 | return x->outer_mode->output2(x, skb); |
| 119 | } | 120 | } |
| @@ -122,7 +123,6 @@ EXPORT_SYMBOL(xfrm6_prepare_output); | |||
| 122 | int xfrm6_output_finish(struct sk_buff *skb) | 123 | int xfrm6_output_finish(struct sk_buff *skb) |
| 123 | { | 124 | { |
| 124 | memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); | 125 | memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); |
| 125 | skb->protocol = htons(ETH_P_IPV6); | ||
| 126 | 126 | ||
| 127 | #ifdef CONFIG_NETFILTER | 127 | #ifdef CONFIG_NETFILTER |
| 128 | IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; | 128 | IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED; |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 48bf5a06847b..8d2d01b4800a 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
| @@ -200,6 +200,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
| 200 | 200 | ||
| 201 | #if IS_ENABLED(CONFIG_IPV6_MIP6) | 201 | #if IS_ENABLED(CONFIG_IPV6_MIP6) |
| 202 | case IPPROTO_MH: | 202 | case IPPROTO_MH: |
| 203 | offset += ipv6_optlen(exthdr); | ||
| 203 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { | 204 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { |
| 204 | struct ip6_mh *mh; | 205 | struct ip6_mh *mh; |
| 205 | 206 | ||
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 3afe36824703..8d53d65bd2ab 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -58,13 +58,24 @@ struct ieee80211_local; | |||
| 58 | #define IEEE80211_UNSET_POWER_LEVEL INT_MIN | 58 | #define IEEE80211_UNSET_POWER_LEVEL INT_MIN |
| 59 | 59 | ||
| 60 | /* | 60 | /* |
| 61 | * Some APs experience problems when working with U-APSD. Decrease the | 61 | * Some APs experience problems when working with U-APSD. Decreasing the |
| 62 | * probability of that happening by using legacy mode for all ACs but VO. | 62 | * probability of that happening by using legacy mode for all ACs but VO isn't |
| 63 | * The AP that caused us trouble was a Cisco 4410N. It ignores our | 63 | * enough. |
| 64 | * setting, and always treats non-VO ACs as legacy. | 64 | * |
| 65 | * Cisco 4410N originally forced us to enable VO by default only because it | ||
| 66 | * treated non-VO ACs as legacy. | ||
| 67 | * | ||
| 68 | * However some APs (notably Netgear R7000) silently reclassify packets to | ||
| 69 | * different ACs. Since u-APSD ACs require trigger frames for frame retrieval | ||
| 70 | * clients would never see some frames (e.g. ARP responses) or would fetch them | ||
| 71 | * accidentally after a long time. | ||
| 72 | * | ||
| 73 | * It makes little sense to enable u-APSD queues by default because it needs | ||
| 74 | * userspace applications to be aware of it to actually take advantage of the | ||
| 75 | * possible additional powersavings. Implicitly depending on driver autotrigger | ||
| 76 | * frame support doesn't make much sense. | ||
| 65 | */ | 77 | */ |
| 66 | #define IEEE80211_DEFAULT_UAPSD_QUEUES \ | 78 | #define IEEE80211_DEFAULT_UAPSD_QUEUES 0 |
| 67 | IEEE80211_WMM_IE_STA_QOSINFO_AC_VO | ||
| 68 | 79 | ||
| 69 | #define IEEE80211_DEFAULT_MAX_SP_LEN \ | 80 | #define IEEE80211_DEFAULT_MAX_SP_LEN \ |
| 70 | IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL | 81 | IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL |
| @@ -453,6 +464,7 @@ struct ieee80211_if_managed { | |||
| 453 | unsigned int flags; | 464 | unsigned int flags; |
| 454 | 465 | ||
| 455 | bool csa_waiting_bcn; | 466 | bool csa_waiting_bcn; |
| 467 | bool csa_ignored_same_chan; | ||
| 456 | 468 | ||
| 457 | bool beacon_crc_valid; | 469 | bool beacon_crc_valid; |
| 458 | u32 beacon_crc; | 470 | u32 beacon_crc; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 10ac6324c1d0..142f66aece18 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -1150,6 +1150,17 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
| 1150 | return; | 1150 | return; |
| 1151 | } | 1151 | } |
| 1152 | 1152 | ||
| 1153 | if (cfg80211_chandef_identical(&csa_ie.chandef, | ||
| 1154 | &sdata->vif.bss_conf.chandef)) { | ||
| 1155 | if (ifmgd->csa_ignored_same_chan) | ||
| 1156 | return; | ||
| 1157 | sdata_info(sdata, | ||
| 1158 | "AP %pM tries to chanswitch to same channel, ignore\n", | ||
| 1159 | ifmgd->associated->bssid); | ||
| 1160 | ifmgd->csa_ignored_same_chan = true; | ||
| 1161 | return; | ||
| 1162 | } | ||
| 1163 | |||
| 1153 | mutex_lock(&local->mtx); | 1164 | mutex_lock(&local->mtx); |
| 1154 | mutex_lock(&local->chanctx_mtx); | 1165 | mutex_lock(&local->chanctx_mtx); |
| 1155 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, | 1166 | conf = rcu_dereference_protected(sdata->vif.chanctx_conf, |
| @@ -1210,6 +1221,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
| 1210 | sdata->vif.csa_active = true; | 1221 | sdata->vif.csa_active = true; |
| 1211 | sdata->csa_chandef = csa_ie.chandef; | 1222 | sdata->csa_chandef = csa_ie.chandef; |
| 1212 | sdata->csa_block_tx = csa_ie.mode; | 1223 | sdata->csa_block_tx = csa_ie.mode; |
| 1224 | ifmgd->csa_ignored_same_chan = false; | ||
| 1213 | 1225 | ||
| 1214 | if (sdata->csa_block_tx) | 1226 | if (sdata->csa_block_tx) |
| 1215 | ieee80211_stop_vif_queues(local, sdata, | 1227 | ieee80211_stop_vif_queues(local, sdata, |
| @@ -2090,6 +2102,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, | |||
| 2090 | 2102 | ||
| 2091 | sdata->vif.csa_active = false; | 2103 | sdata->vif.csa_active = false; |
| 2092 | ifmgd->csa_waiting_bcn = false; | 2104 | ifmgd->csa_waiting_bcn = false; |
| 2105 | ifmgd->csa_ignored_same_chan = false; | ||
| 2093 | if (sdata->csa_block_tx) { | 2106 | if (sdata->csa_block_tx) { |
| 2094 | ieee80211_wake_vif_queues(local, sdata, | 2107 | ieee80211_wake_vif_queues(local, sdata, |
| 2095 | IEEE80211_QUEUE_STOP_REASON_CSA); | 2108 | IEEE80211_QUEUE_STOP_REASON_CSA); |
| @@ -3204,7 +3217,8 @@ static const u64 care_about_ies = | |||
| 3204 | (1ULL << WLAN_EID_CHANNEL_SWITCH) | | 3217 | (1ULL << WLAN_EID_CHANNEL_SWITCH) | |
| 3205 | (1ULL << WLAN_EID_PWR_CONSTRAINT) | | 3218 | (1ULL << WLAN_EID_PWR_CONSTRAINT) | |
| 3206 | (1ULL << WLAN_EID_HT_CAPABILITY) | | 3219 | (1ULL << WLAN_EID_HT_CAPABILITY) | |
| 3207 | (1ULL << WLAN_EID_HT_OPERATION); | 3220 | (1ULL << WLAN_EID_HT_OPERATION) | |
| 3221 | (1ULL << WLAN_EID_EXT_CHANSWITCH_ANN); | ||
| 3208 | 3222 | ||
| 3209 | static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | 3223 | static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
| 3210 | struct ieee80211_mgmt *mgmt, size_t len, | 3224 | struct ieee80211_mgmt *mgmt, size_t len, |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 1101563357ea..944bdc04e913 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -2214,6 +2214,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
| 2214 | hdr = (struct ieee80211_hdr *) skb->data; | 2214 | hdr = (struct ieee80211_hdr *) skb->data; |
| 2215 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | 2215 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); |
| 2216 | 2216 | ||
| 2217 | if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) | ||
| 2218 | return RX_DROP_MONITOR; | ||
| 2219 | |||
| 2217 | /* frame is in RMC, don't forward */ | 2220 | /* frame is in RMC, don't forward */ |
| 2218 | if (ieee80211_is_data(hdr->frame_control) && | 2221 | if (ieee80211_is_data(hdr->frame_control) && |
| 2219 | is_multicast_ether_addr(hdr->addr1) && | 2222 | is_multicast_ether_addr(hdr->addr1) && |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 8428f4a95479..747bdcf72e92 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
| @@ -3178,7 +3178,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, | |||
| 3178 | wdev_iter = &sdata_iter->wdev; | 3178 | wdev_iter = &sdata_iter->wdev; |
| 3179 | 3179 | ||
| 3180 | if (sdata_iter == sdata || | 3180 | if (sdata_iter == sdata || |
| 3181 | rcu_access_pointer(sdata_iter->vif.chanctx_conf) == NULL || | 3181 | !ieee80211_sdata_running(sdata_iter) || |
| 3182 | local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype)) | 3182 | local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype)) |
| 3183 | continue; | 3183 | continue; |
| 3184 | 3184 | ||
diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c index a817705ce2d0..dba8d0864f18 100644 --- a/net/rds/iw_rdma.c +++ b/net/rds/iw_rdma.c | |||
| @@ -88,7 +88,9 @@ static unsigned int rds_iw_unmap_fastreg_list(struct rds_iw_mr_pool *pool, | |||
| 88 | int *unpinned); | 88 | int *unpinned); |
| 89 | static void rds_iw_destroy_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr); | 89 | static void rds_iw_destroy_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr); |
| 90 | 90 | ||
| 91 | static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwdev, struct rdma_cm_id **cm_id) | 91 | static int rds_iw_get_device(struct sockaddr_in *src, struct sockaddr_in *dst, |
| 92 | struct rds_iw_device **rds_iwdev, | ||
| 93 | struct rdma_cm_id **cm_id) | ||
| 92 | { | 94 | { |
| 93 | struct rds_iw_device *iwdev; | 95 | struct rds_iw_device *iwdev; |
| 94 | struct rds_iw_cm_id *i_cm_id; | 96 | struct rds_iw_cm_id *i_cm_id; |
| @@ -112,15 +114,15 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd | |||
| 112 | src_addr->sin_port, | 114 | src_addr->sin_port, |
| 113 | dst_addr->sin_addr.s_addr, | 115 | dst_addr->sin_addr.s_addr, |
| 114 | dst_addr->sin_port, | 116 | dst_addr->sin_port, |
| 115 | rs->rs_bound_addr, | 117 | src->sin_addr.s_addr, |
| 116 | rs->rs_bound_port, | 118 | src->sin_port, |
| 117 | rs->rs_conn_addr, | 119 | dst->sin_addr.s_addr, |
| 118 | rs->rs_conn_port); | 120 | dst->sin_port); |
| 119 | #ifdef WORKING_TUPLE_DETECTION | 121 | #ifdef WORKING_TUPLE_DETECTION |
| 120 | if (src_addr->sin_addr.s_addr == rs->rs_bound_addr && | 122 | if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr && |
| 121 | src_addr->sin_port == rs->rs_bound_port && | 123 | src_addr->sin_port == src->sin_port && |
| 122 | dst_addr->sin_addr.s_addr == rs->rs_conn_addr && | 124 | dst_addr->sin_addr.s_addr == dst->sin_addr.s_addr && |
| 123 | dst_addr->sin_port == rs->rs_conn_port) { | 125 | dst_addr->sin_port == dst->sin_port) { |
| 124 | #else | 126 | #else |
| 125 | /* FIXME - needs to compare the local and remote | 127 | /* FIXME - needs to compare the local and remote |
| 126 | * ipaddr/port tuple, but the ipaddr is the only | 128 | * ipaddr/port tuple, but the ipaddr is the only |
| @@ -128,7 +130,7 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd | |||
| 128 | * zero'ed. It doesn't appear to be properly populated | 130 | * zero'ed. It doesn't appear to be properly populated |
| 129 | * during connection setup... | 131 | * during connection setup... |
| 130 | */ | 132 | */ |
| 131 | if (src_addr->sin_addr.s_addr == rs->rs_bound_addr) { | 133 | if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr) { |
| 132 | #endif | 134 | #endif |
| 133 | spin_unlock_irq(&iwdev->spinlock); | 135 | spin_unlock_irq(&iwdev->spinlock); |
| 134 | *rds_iwdev = iwdev; | 136 | *rds_iwdev = iwdev; |
| @@ -180,19 +182,13 @@ int rds_iw_update_cm_id(struct rds_iw_device *rds_iwdev, struct rdma_cm_id *cm_i | |||
| 180 | { | 182 | { |
| 181 | struct sockaddr_in *src_addr, *dst_addr; | 183 | struct sockaddr_in *src_addr, *dst_addr; |
| 182 | struct rds_iw_device *rds_iwdev_old; | 184 | struct rds_iw_device *rds_iwdev_old; |
| 183 | struct rds_sock rs; | ||
| 184 | struct rdma_cm_id *pcm_id; | 185 | struct rdma_cm_id *pcm_id; |
| 185 | int rc; | 186 | int rc; |
| 186 | 187 | ||
| 187 | src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr; | 188 | src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr; |
| 188 | dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr; | 189 | dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr; |
| 189 | 190 | ||
| 190 | rs.rs_bound_addr = src_addr->sin_addr.s_addr; | 191 | rc = rds_iw_get_device(src_addr, dst_addr, &rds_iwdev_old, &pcm_id); |
| 191 | rs.rs_bound_port = src_addr->sin_port; | ||
| 192 | rs.rs_conn_addr = dst_addr->sin_addr.s_addr; | ||
| 193 | rs.rs_conn_port = dst_addr->sin_port; | ||
| 194 | |||
| 195 | rc = rds_iw_get_device(&rs, &rds_iwdev_old, &pcm_id); | ||
| 196 | if (rc) | 192 | if (rc) |
| 197 | rds_iw_remove_cm_id(rds_iwdev, cm_id); | 193 | rds_iw_remove_cm_id(rds_iwdev, cm_id); |
| 198 | 194 | ||
| @@ -598,9 +594,17 @@ void *rds_iw_get_mr(struct scatterlist *sg, unsigned long nents, | |||
| 598 | struct rds_iw_device *rds_iwdev; | 594 | struct rds_iw_device *rds_iwdev; |
| 599 | struct rds_iw_mr *ibmr = NULL; | 595 | struct rds_iw_mr *ibmr = NULL; |
| 600 | struct rdma_cm_id *cm_id; | 596 | struct rdma_cm_id *cm_id; |
| 597 | struct sockaddr_in src = { | ||
| 598 | .sin_addr.s_addr = rs->rs_bound_addr, | ||
| 599 | .sin_port = rs->rs_bound_port, | ||
| 600 | }; | ||
| 601 | struct sockaddr_in dst = { | ||
| 602 | .sin_addr.s_addr = rs->rs_conn_addr, | ||
| 603 | .sin_port = rs->rs_conn_port, | ||
| 604 | }; | ||
| 601 | int ret; | 605 | int ret; |
| 602 | 606 | ||
| 603 | ret = rds_iw_get_device(rs, &rds_iwdev, &cm_id); | 607 | ret = rds_iw_get_device(&src, &dst, &rds_iwdev, &cm_id); |
| 604 | if (ret || !cm_id) { | 608 | if (ret || !cm_id) { |
| 605 | ret = -ENODEV; | 609 | ret = -ENODEV; |
| 606 | goto out; | 610 | goto out; |
diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c index 4575485ad1b4..19a560626dc4 100644 --- a/net/rxrpc/ar-recvmsg.c +++ b/net/rxrpc/ar-recvmsg.c | |||
| @@ -87,7 +87,7 @@ int rxrpc_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 87 | if (!skb) { | 87 | if (!skb) { |
| 88 | /* nothing remains on the queue */ | 88 | /* nothing remains on the queue */ |
| 89 | if (copied && | 89 | if (copied && |
| 90 | (msg->msg_flags & MSG_PEEK || timeo == 0)) | 90 | (flags & MSG_PEEK || timeo == 0)) |
| 91 | goto out; | 91 | goto out; |
| 92 | 92 | ||
| 93 | /* wait for a message to turn up */ | 93 | /* wait for a message to turn up */ |
diff --git a/net/sched/act_bpf.c b/net/sched/act_bpf.c index 82c5d7fc1988..5f6288fa3f12 100644 --- a/net/sched/act_bpf.c +++ b/net/sched/act_bpf.c | |||
| @@ -25,21 +25,41 @@ static int tcf_bpf(struct sk_buff *skb, const struct tc_action *a, | |||
| 25 | struct tcf_result *res) | 25 | struct tcf_result *res) |
| 26 | { | 26 | { |
| 27 | struct tcf_bpf *b = a->priv; | 27 | struct tcf_bpf *b = a->priv; |
| 28 | int action; | 28 | int action, filter_res; |
| 29 | int filter_res; | ||
| 30 | 29 | ||
| 31 | spin_lock(&b->tcf_lock); | 30 | spin_lock(&b->tcf_lock); |
| 31 | |||
| 32 | b->tcf_tm.lastuse = jiffies; | 32 | b->tcf_tm.lastuse = jiffies; |
| 33 | bstats_update(&b->tcf_bstats, skb); | 33 | bstats_update(&b->tcf_bstats, skb); |
| 34 | action = b->tcf_action; | ||
| 35 | 34 | ||
| 36 | filter_res = BPF_PROG_RUN(b->filter, skb); | 35 | filter_res = BPF_PROG_RUN(b->filter, skb); |
| 37 | if (filter_res == 0) { | 36 | |
| 38 | /* Return code 0 from the BPF program | 37 | /* A BPF program may overwrite the default action opcode. |
| 39 | * is being interpreted as a drop here. | 38 | * Similarly as in cls_bpf, if filter_res == -1 we use the |
| 40 | */ | 39 | * default action specified from tc. |
| 41 | action = TC_ACT_SHOT; | 40 | * |
| 41 | * In case a different well-known TC_ACT opcode has been | ||
| 42 | * returned, it will overwrite the default one. | ||
| 43 | * | ||
| 44 | * For everything else that is unkown, TC_ACT_UNSPEC is | ||
| 45 | * returned. | ||
| 46 | */ | ||
| 47 | switch (filter_res) { | ||
| 48 | case TC_ACT_PIPE: | ||
| 49 | case TC_ACT_RECLASSIFY: | ||
| 50 | case TC_ACT_OK: | ||
| 51 | action = filter_res; | ||
| 52 | break; | ||
| 53 | case TC_ACT_SHOT: | ||
| 54 | action = filter_res; | ||
| 42 | b->tcf_qstats.drops++; | 55 | b->tcf_qstats.drops++; |
| 56 | break; | ||
| 57 | case TC_ACT_UNSPEC: | ||
| 58 | action = b->tcf_action; | ||
| 59 | break; | ||
| 60 | default: | ||
| 61 | action = TC_ACT_UNSPEC; | ||
| 62 | break; | ||
| 43 | } | 63 | } |
| 44 | 64 | ||
| 45 | spin_unlock(&b->tcf_lock); | 65 | spin_unlock(&b->tcf_lock); |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 09487afbfd51..95fdf4e40051 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
| @@ -78,8 +78,11 @@ struct tc_u_hnode { | |||
| 78 | struct tc_u_common *tp_c; | 78 | struct tc_u_common *tp_c; |
| 79 | int refcnt; | 79 | int refcnt; |
| 80 | unsigned int divisor; | 80 | unsigned int divisor; |
| 81 | struct tc_u_knode __rcu *ht[1]; | ||
| 82 | struct rcu_head rcu; | 81 | struct rcu_head rcu; |
| 82 | /* The 'ht' field MUST be the last field in structure to allow for | ||
| 83 | * more entries allocated at end of structure. | ||
| 84 | */ | ||
| 85 | struct tc_u_knode __rcu *ht[1]; | ||
| 83 | }; | 86 | }; |
| 84 | 87 | ||
| 85 | struct tc_u_common { | 88 | struct tc_u_common { |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index be2501538011..b6f84f6a2a09 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -4400,6 +4400,16 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) | |||
| 4400 | if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) | 4400 | if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) |
| 4401 | return -EINVAL; | 4401 | return -EINVAL; |
| 4402 | 4402 | ||
| 4403 | /* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT | ||
| 4404 | * as userspace might just pass through the capabilities from the IEs | ||
| 4405 | * directly, rather than enforcing this restriction and returning an | ||
| 4406 | * error in this case. | ||
| 4407 | */ | ||
| 4408 | if (!(params.sta_flags_set & BIT(NL80211_STA_FLAG_WME))) { | ||
| 4409 | params.ht_capa = NULL; | ||
| 4410 | params.vht_capa = NULL; | ||
| 4411 | } | ||
| 4412 | |||
| 4403 | /* When you run into this, adjust the code below for the new flag */ | 4413 | /* When you run into this, adjust the code below for the new flag */ |
| 4404 | BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 7); | 4414 | BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 7); |
| 4405 | 4415 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index cee479bc655c..638af0655aaf 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -2269,11 +2269,9 @@ struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, | |||
| 2269 | * have the xfrm_state's. We need to wait for KM to | 2269 | * have the xfrm_state's. We need to wait for KM to |
| 2270 | * negotiate new SA's or bail out with error.*/ | 2270 | * negotiate new SA's or bail out with error.*/ |
| 2271 | if (net->xfrm.sysctl_larval_drop) { | 2271 | if (net->xfrm.sysctl_larval_drop) { |
| 2272 | dst_release(dst); | ||
| 2273 | xfrm_pols_put(pols, drop_pols); | ||
| 2274 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); | 2272 | XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); |
| 2275 | 2273 | err = -EREMOTE; | |
| 2276 | return ERR_PTR(-EREMOTE); | 2274 | goto error; |
| 2277 | } | 2275 | } |
| 2278 | 2276 | ||
| 2279 | err = -EAGAIN; | 2277 | err = -EAGAIN; |
| @@ -2324,7 +2322,8 @@ nopol: | |||
| 2324 | error: | 2322 | error: |
| 2325 | dst_release(dst); | 2323 | dst_release(dst); |
| 2326 | dropdst: | 2324 | dropdst: |
| 2327 | dst_release(dst_orig); | 2325 | if (!(flags & XFRM_LOOKUP_KEEP_DST_REF)) |
| 2326 | dst_release(dst_orig); | ||
| 2328 | xfrm_pols_put(pols, drop_pols); | 2327 | xfrm_pols_put(pols, drop_pols); |
| 2329 | return ERR_PTR(err); | 2328 | return ERR_PTR(err); |
| 2330 | } | 2329 | } |
| @@ -2338,7 +2337,8 @@ struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, | |||
| 2338 | struct sock *sk, int flags) | 2337 | struct sock *sk, int flags) |
| 2339 | { | 2338 | { |
| 2340 | struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, | 2339 | struct dst_entry *dst = xfrm_lookup(net, dst_orig, fl, sk, |
| 2341 | flags | XFRM_LOOKUP_QUEUE); | 2340 | flags | XFRM_LOOKUP_QUEUE | |
| 2341 | XFRM_LOOKUP_KEEP_DST_REF); | ||
| 2342 | 2342 | ||
| 2343 | if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) | 2343 | if (IS_ERR(dst) && PTR_ERR(dst) == -EREMOTE) |
| 2344 | return make_blackhole(net, dst_orig->ops->family, dst_orig); | 2344 | return make_blackhole(net, dst_orig->ops->family, dst_orig); |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index fe18071bf93a..8ec5289f8e05 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
| @@ -687,13 +687,30 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, | |||
| 687 | return val; | 687 | return val; |
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | /* is this a stereo widget or a stereo-to-mono mix? */ | ||
| 691 | static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, int dir) | ||
| 692 | { | ||
| 693 | unsigned int wcaps = get_wcaps(codec, nid); | ||
| 694 | hda_nid_t conn; | ||
| 695 | |||
| 696 | if (wcaps & AC_WCAP_STEREO) | ||
| 697 | return true; | ||
| 698 | if (dir != HDA_INPUT || get_wcaps_type(wcaps) != AC_WID_AUD_MIX) | ||
| 699 | return false; | ||
| 700 | if (snd_hda_get_num_conns(codec, nid) != 1) | ||
| 701 | return false; | ||
| 702 | if (snd_hda_get_connections(codec, nid, &conn, 1) < 0) | ||
| 703 | return false; | ||
| 704 | return !!(get_wcaps(codec, conn) & AC_WCAP_STEREO); | ||
| 705 | } | ||
| 706 | |||
| 690 | /* initialize the amp value (only at the first time) */ | 707 | /* initialize the amp value (only at the first time) */ |
| 691 | static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) | 708 | static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) |
| 692 | { | 709 | { |
| 693 | unsigned int caps = query_amp_caps(codec, nid, dir); | 710 | unsigned int caps = query_amp_caps(codec, nid, dir); |
| 694 | int val = get_amp_val_to_activate(codec, nid, dir, caps, false); | 711 | int val = get_amp_val_to_activate(codec, nid, dir, caps, false); |
| 695 | 712 | ||
| 696 | if (get_wcaps(codec, nid) & AC_WCAP_STEREO) | 713 | if (is_stereo_amps(codec, nid, dir)) |
| 697 | snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); | 714 | snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); |
| 698 | else | 715 | else |
| 699 | snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val); | 716 | snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val); |
| @@ -703,7 +720,7 @@ static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) | |||
| 703 | static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx, | 720 | static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx, |
| 704 | unsigned int mask, unsigned int val) | 721 | unsigned int mask, unsigned int val) |
| 705 | { | 722 | { |
| 706 | if (get_wcaps(codec, nid) & AC_WCAP_STEREO) | 723 | if (is_stereo_amps(codec, nid, dir)) |
| 707 | return snd_hda_codec_amp_stereo(codec, nid, dir, idx, | 724 | return snd_hda_codec_amp_stereo(codec, nid, dir, idx, |
| 708 | mask, val); | 725 | mask, val); |
| 709 | else | 726 | else |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index ce5a6da83419..05e19f78b4cb 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
| @@ -134,13 +134,38 @@ static void print_amp_caps(struct snd_info_buffer *buffer, | |||
| 134 | (caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT); | 134 | (caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /* is this a stereo widget or a stereo-to-mono mix? */ | ||
| 138 | static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, | ||
| 139 | int dir, unsigned int wcaps, int indices) | ||
| 140 | { | ||
| 141 | hda_nid_t conn; | ||
| 142 | |||
| 143 | if (wcaps & AC_WCAP_STEREO) | ||
| 144 | return true; | ||
| 145 | /* check for a stereo-to-mono mix; it must be: | ||
| 146 | * only a single connection, only for input, and only a mixer widget | ||
| 147 | */ | ||
| 148 | if (indices != 1 || dir != HDA_INPUT || | ||
| 149 | get_wcaps_type(wcaps) != AC_WID_AUD_MIX) | ||
| 150 | return false; | ||
| 151 | |||
| 152 | if (snd_hda_get_raw_connections(codec, nid, &conn, 1) < 0) | ||
| 153 | return false; | ||
| 154 | /* the connection source is a stereo? */ | ||
| 155 | wcaps = snd_hda_param_read(codec, conn, AC_PAR_AUDIO_WIDGET_CAP); | ||
| 156 | return !!(wcaps & AC_WCAP_STEREO); | ||
| 157 | } | ||
| 158 | |||
| 137 | static void print_amp_vals(struct snd_info_buffer *buffer, | 159 | static void print_amp_vals(struct snd_info_buffer *buffer, |
| 138 | struct hda_codec *codec, hda_nid_t nid, | 160 | struct hda_codec *codec, hda_nid_t nid, |
| 139 | int dir, int stereo, int indices) | 161 | int dir, unsigned int wcaps, int indices) |
| 140 | { | 162 | { |
| 141 | unsigned int val; | 163 | unsigned int val; |
| 164 | bool stereo; | ||
| 142 | int i; | 165 | int i; |
| 143 | 166 | ||
| 167 | stereo = is_stereo_amps(codec, nid, dir, wcaps, indices); | ||
| 168 | |||
| 144 | dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT; | 169 | dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT; |
| 145 | for (i = 0; i < indices; i++) { | 170 | for (i = 0; i < indices; i++) { |
| 146 | snd_iprintf(buffer, " ["); | 171 | snd_iprintf(buffer, " ["); |
| @@ -757,12 +782,10 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
| 757 | (codec->single_adc_amp && | 782 | (codec->single_adc_amp && |
| 758 | wid_type == AC_WID_AUD_IN)) | 783 | wid_type == AC_WID_AUD_IN)) |
| 759 | print_amp_vals(buffer, codec, nid, HDA_INPUT, | 784 | print_amp_vals(buffer, codec, nid, HDA_INPUT, |
| 760 | wid_caps & AC_WCAP_STEREO, | 785 | wid_caps, 1); |
| 761 | 1); | ||
| 762 | else | 786 | else |
| 763 | print_amp_vals(buffer, codec, nid, HDA_INPUT, | 787 | print_amp_vals(buffer, codec, nid, HDA_INPUT, |
| 764 | wid_caps & AC_WCAP_STEREO, | 788 | wid_caps, conn_len); |
| 765 | conn_len); | ||
| 766 | } | 789 | } |
| 767 | if (wid_caps & AC_WCAP_OUT_AMP) { | 790 | if (wid_caps & AC_WCAP_OUT_AMP) { |
| 768 | snd_iprintf(buffer, " Amp-Out caps: "); | 791 | snd_iprintf(buffer, " Amp-Out caps: "); |
| @@ -771,11 +794,10 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
| 771 | if (wid_type == AC_WID_PIN && | 794 | if (wid_type == AC_WID_PIN && |
| 772 | codec->pin_amp_workaround) | 795 | codec->pin_amp_workaround) |
| 773 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, | 796 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, |
| 774 | wid_caps & AC_WCAP_STEREO, | 797 | wid_caps, conn_len); |
| 775 | conn_len); | ||
| 776 | else | 798 | else |
| 777 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, | 799 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, |
| 778 | wid_caps & AC_WCAP_STEREO, 1); | 800 | wid_caps, 1); |
| 779 | } | 801 | } |
| 780 | 802 | ||
| 781 | switch (wid_type) { | 803 | switch (wid_type) { |
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c index b67480f1b1aa..4373ada95648 100644 --- a/sound/soc/codecs/adav80x.c +++ b/sound/soc/codecs/adav80x.c | |||
| @@ -317,7 +317,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 317 | { | 317 | { |
| 318 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 318 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 319 | struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); | 319 | struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); |
| 320 | unsigned int deemph = ucontrol->value.enumerated.item[0]; | 320 | unsigned int deemph = ucontrol->value.integer.value[0]; |
| 321 | 321 | ||
| 322 | if (deemph > 1) | 322 | if (deemph > 1) |
| 323 | return -EINVAL; | 323 | return -EINVAL; |
| @@ -333,7 +333,7 @@ static int adav80x_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 333 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 333 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 334 | struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); | 334 | struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); |
| 335 | 335 | ||
| 336 | ucontrol->value.enumerated.item[0] = adav80x->deemph; | 336 | ucontrol->value.integer.value[0] = adav80x->deemph; |
| 337 | return 0; | 337 | return 0; |
| 338 | }; | 338 | }; |
| 339 | 339 | ||
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c index 70861c7b1631..81b54a270bd8 100644 --- a/sound/soc/codecs/ak4641.c +++ b/sound/soc/codecs/ak4641.c | |||
| @@ -76,7 +76,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 76 | { | 76 | { |
| 77 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 77 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 78 | struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); | 78 | struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); |
| 79 | int deemph = ucontrol->value.enumerated.item[0]; | 79 | int deemph = ucontrol->value.integer.value[0]; |
| 80 | 80 | ||
| 81 | if (deemph > 1) | 81 | if (deemph > 1) |
| 82 | return -EINVAL; | 82 | return -EINVAL; |
| @@ -92,7 +92,7 @@ static int ak4641_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 92 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 92 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 93 | struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); | 93 | struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); |
| 94 | 94 | ||
| 95 | ucontrol->value.enumerated.item[0] = ak4641->deemph; | 95 | ucontrol->value.integer.value[0] = ak4641->deemph; |
| 96 | return 0; | 96 | return 0; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c index 632e89f793a7..2a58b1dccd2f 100644 --- a/sound/soc/codecs/ak4671.c +++ b/sound/soc/codecs/ak4671.c | |||
| @@ -343,25 +343,25 @@ static const struct snd_soc_dapm_widget ak4671_dapm_widgets[] = { | |||
| 343 | }; | 343 | }; |
| 344 | 344 | ||
| 345 | static const struct snd_soc_dapm_route ak4671_intercon[] = { | 345 | static const struct snd_soc_dapm_route ak4671_intercon[] = { |
| 346 | {"DAC Left", "NULL", "PMPLL"}, | 346 | {"DAC Left", NULL, "PMPLL"}, |
| 347 | {"DAC Right", "NULL", "PMPLL"}, | 347 | {"DAC Right", NULL, "PMPLL"}, |
| 348 | {"ADC Left", "NULL", "PMPLL"}, | 348 | {"ADC Left", NULL, "PMPLL"}, |
| 349 | {"ADC Right", "NULL", "PMPLL"}, | 349 | {"ADC Right", NULL, "PMPLL"}, |
| 350 | 350 | ||
| 351 | /* Outputs */ | 351 | /* Outputs */ |
| 352 | {"LOUT1", "NULL", "LOUT1 Mixer"}, | 352 | {"LOUT1", NULL, "LOUT1 Mixer"}, |
| 353 | {"ROUT1", "NULL", "ROUT1 Mixer"}, | 353 | {"ROUT1", NULL, "ROUT1 Mixer"}, |
| 354 | {"LOUT2", "NULL", "LOUT2 Mix Amp"}, | 354 | {"LOUT2", NULL, "LOUT2 Mix Amp"}, |
| 355 | {"ROUT2", "NULL", "ROUT2 Mix Amp"}, | 355 | {"ROUT2", NULL, "ROUT2 Mix Amp"}, |
| 356 | {"LOUT3", "NULL", "LOUT3 Mixer"}, | 356 | {"LOUT3", NULL, "LOUT3 Mixer"}, |
| 357 | {"ROUT3", "NULL", "ROUT3 Mixer"}, | 357 | {"ROUT3", NULL, "ROUT3 Mixer"}, |
| 358 | 358 | ||
| 359 | {"LOUT1 Mixer", "DACL", "DAC Left"}, | 359 | {"LOUT1 Mixer", "DACL", "DAC Left"}, |
| 360 | {"ROUT1 Mixer", "DACR", "DAC Right"}, | 360 | {"ROUT1 Mixer", "DACR", "DAC Right"}, |
| 361 | {"LOUT2 Mixer", "DACHL", "DAC Left"}, | 361 | {"LOUT2 Mixer", "DACHL", "DAC Left"}, |
| 362 | {"ROUT2 Mixer", "DACHR", "DAC Right"}, | 362 | {"ROUT2 Mixer", "DACHR", "DAC Right"}, |
| 363 | {"LOUT2 Mix Amp", "NULL", "LOUT2 Mixer"}, | 363 | {"LOUT2 Mix Amp", NULL, "LOUT2 Mixer"}, |
| 364 | {"ROUT2 Mix Amp", "NULL", "ROUT2 Mixer"}, | 364 | {"ROUT2 Mix Amp", NULL, "ROUT2 Mixer"}, |
| 365 | {"LOUT3 Mixer", "DACSL", "DAC Left"}, | 365 | {"LOUT3 Mixer", "DACSL", "DAC Left"}, |
| 366 | {"ROUT3 Mixer", "DACSR", "DAC Right"}, | 366 | {"ROUT3 Mixer", "DACSR", "DAC Right"}, |
| 367 | 367 | ||
| @@ -381,18 +381,18 @@ static const struct snd_soc_dapm_route ak4671_intercon[] = { | |||
| 381 | {"LIN2", NULL, "Mic Bias"}, | 381 | {"LIN2", NULL, "Mic Bias"}, |
| 382 | {"RIN2", NULL, "Mic Bias"}, | 382 | {"RIN2", NULL, "Mic Bias"}, |
| 383 | 383 | ||
| 384 | {"ADC Left", "NULL", "LIN MUX"}, | 384 | {"ADC Left", NULL, "LIN MUX"}, |
| 385 | {"ADC Right", "NULL", "RIN MUX"}, | 385 | {"ADC Right", NULL, "RIN MUX"}, |
| 386 | 386 | ||
| 387 | /* Analog Loops */ | 387 | /* Analog Loops */ |
| 388 | {"LIN1 Mixing Circuit", "NULL", "LIN1"}, | 388 | {"LIN1 Mixing Circuit", NULL, "LIN1"}, |
| 389 | {"RIN1 Mixing Circuit", "NULL", "RIN1"}, | 389 | {"RIN1 Mixing Circuit", NULL, "RIN1"}, |
| 390 | {"LIN2 Mixing Circuit", "NULL", "LIN2"}, | 390 | {"LIN2 Mixing Circuit", NULL, "LIN2"}, |
| 391 | {"RIN2 Mixing Circuit", "NULL", "RIN2"}, | 391 | {"RIN2 Mixing Circuit", NULL, "RIN2"}, |
| 392 | {"LIN3 Mixing Circuit", "NULL", "LIN3"}, | 392 | {"LIN3 Mixing Circuit", NULL, "LIN3"}, |
| 393 | {"RIN3 Mixing Circuit", "NULL", "RIN3"}, | 393 | {"RIN3 Mixing Circuit", NULL, "RIN3"}, |
| 394 | {"LIN4 Mixing Circuit", "NULL", "LIN4"}, | 394 | {"LIN4 Mixing Circuit", NULL, "LIN4"}, |
| 395 | {"RIN4 Mixing Circuit", "NULL", "RIN4"}, | 395 | {"RIN4 Mixing Circuit", NULL, "RIN4"}, |
| 396 | 396 | ||
| 397 | {"LOUT1 Mixer", "LINL1", "LIN1 Mixing Circuit"}, | 397 | {"LOUT1 Mixer", "LINL1", "LIN1 Mixing Circuit"}, |
| 398 | {"ROUT1 Mixer", "RINR1", "RIN1 Mixing Circuit"}, | 398 | {"ROUT1 Mixer", "RINR1", "RIN1 Mixing Circuit"}, |
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 79a4efcb894c..7d3a6accaf9a 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c | |||
| @@ -286,7 +286,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 286 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 286 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 287 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); | 287 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); |
| 288 | 288 | ||
| 289 | ucontrol->value.enumerated.item[0] = cs4271->deemph; | 289 | ucontrol->value.integer.value[0] = cs4271->deemph; |
| 290 | return 0; | 290 | return 0; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| @@ -296,7 +296,7 @@ static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 296 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 296 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 297 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); | 297 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); |
| 298 | 298 | ||
| 299 | cs4271->deemph = ucontrol->value.enumerated.item[0]; | 299 | cs4271->deemph = ucontrol->value.integer.value[0]; |
| 300 | return cs4271_set_deemph(codec); | 300 | return cs4271_set_deemph(codec); |
| 301 | } | 301 | } |
| 302 | 302 | ||
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index ffe96175a8a5..911c26c705fc 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c | |||
| @@ -876,11 +876,11 @@ static const struct snd_soc_dapm_widget da732x_dapm_widgets[] = { | |||
| 876 | 876 | ||
| 877 | static const struct snd_soc_dapm_route da732x_dapm_routes[] = { | 877 | static const struct snd_soc_dapm_route da732x_dapm_routes[] = { |
| 878 | /* Inputs */ | 878 | /* Inputs */ |
| 879 | {"AUX1L PGA", "NULL", "AUX1L"}, | 879 | {"AUX1L PGA", NULL, "AUX1L"}, |
| 880 | {"AUX1R PGA", "NULL", "AUX1R"}, | 880 | {"AUX1R PGA", NULL, "AUX1R"}, |
| 881 | {"MIC1 PGA", NULL, "MIC1"}, | 881 | {"MIC1 PGA", NULL, "MIC1"}, |
| 882 | {"MIC2 PGA", "NULL", "MIC2"}, | 882 | {"MIC2 PGA", NULL, "MIC2"}, |
| 883 | {"MIC3 PGA", "NULL", "MIC3"}, | 883 | {"MIC3 PGA", NULL, "MIC3"}, |
| 884 | 884 | ||
| 885 | /* Capture Path */ | 885 | /* Capture Path */ |
| 886 | {"ADC1 Left MUX", "MIC1", "MIC1 PGA"}, | 886 | {"ADC1 Left MUX", "MIC1", "MIC1 PGA"}, |
diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index f27325155ace..c5f35a07e8e4 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c | |||
| @@ -120,7 +120,7 @@ static int es8328_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 120 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 120 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 121 | struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec); | 121 | struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec); |
| 122 | 122 | ||
| 123 | ucontrol->value.enumerated.item[0] = es8328->deemph; | 123 | ucontrol->value.integer.value[0] = es8328->deemph; |
| 124 | return 0; | 124 | return 0; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| @@ -129,7 +129,7 @@ static int es8328_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 129 | { | 129 | { |
| 130 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 130 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 131 | struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec); | 131 | struct es8328_priv *es8328 = snd_soc_codec_get_drvdata(codec); |
| 132 | int deemph = ucontrol->value.enumerated.item[0]; | 132 | int deemph = ucontrol->value.integer.value[0]; |
| 133 | int ret; | 133 | int ret; |
| 134 | 134 | ||
| 135 | if (deemph > 1) | 135 | if (deemph > 1) |
diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c index a722a023c262..477e13d30971 100644 --- a/sound/soc/codecs/pcm1681.c +++ b/sound/soc/codecs/pcm1681.c | |||
| @@ -118,7 +118,7 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 118 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 118 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 119 | struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); | 119 | struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); |
| 120 | 120 | ||
| 121 | ucontrol->value.enumerated.item[0] = priv->deemph; | 121 | ucontrol->value.integer.value[0] = priv->deemph; |
| 122 | 122 | ||
| 123 | return 0; | 123 | return 0; |
| 124 | } | 124 | } |
| @@ -129,7 +129,7 @@ static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 129 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 129 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 130 | struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); | 130 | struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec); |
| 131 | 131 | ||
| 132 | priv->deemph = ucontrol->value.enumerated.item[0]; | 132 | priv->deemph = ucontrol->value.integer.value[0]; |
| 133 | 133 | ||
| 134 | return pcm1681_set_deemph(codec); | 134 | return pcm1681_set_deemph(codec); |
| 135 | } | 135 | } |
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index f374840a5a7c..9b541e52da8c 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
| @@ -1198,7 +1198,7 @@ static struct dmi_system_id dmi_dell_dino[] = { | |||
| 1198 | .ident = "Dell Dino", | 1198 | .ident = "Dell Dino", |
| 1199 | .matches = { | 1199 | .matches = { |
| 1200 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | 1200 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
| 1201 | DMI_MATCH(DMI_BOARD_NAME, "0144P8") | 1201 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9343") |
| 1202 | } | 1202 | } |
| 1203 | }, | 1203 | }, |
| 1204 | { } | 1204 | { } |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index e182e6569bbd..3593a1496056 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
| @@ -1151,13 +1151,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) | |||
| 1151 | /* Enable VDDC charge pump */ | 1151 | /* Enable VDDC charge pump */ |
| 1152 | ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP; | 1152 | ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP; |
| 1153 | } else if (vddio >= 3100 && vdda >= 3100) { | 1153 | } else if (vddio >= 3100 && vdda >= 3100) { |
| 1154 | /* | 1154 | ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP; |
| 1155 | * if vddio and vddd > 3.1v, | ||
| 1156 | * charge pump should be clean before set ana_pwr | ||
| 1157 | */ | ||
| 1158 | snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, | ||
| 1159 | SGTL5000_VDDC_CHRGPMP_POWERUP, 0); | ||
| 1160 | |||
| 1161 | /* VDDC use VDDIO rail */ | 1155 | /* VDDC use VDDIO rail */ |
| 1162 | lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD; | 1156 | lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD; |
| 1163 | lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO << | 1157 | lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO << |
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 47b257e41809..82095d6cd070 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c | |||
| @@ -538,8 +538,8 @@ static const struct snd_soc_dapm_route sn95031_audio_map[] = { | |||
| 538 | /* speaker map */ | 538 | /* speaker map */ |
| 539 | { "IHFOUTL", NULL, "Speaker Rail"}, | 539 | { "IHFOUTL", NULL, "Speaker Rail"}, |
| 540 | { "IHFOUTR", NULL, "Speaker Rail"}, | 540 | { "IHFOUTR", NULL, "Speaker Rail"}, |
| 541 | { "IHFOUTL", "NULL", "Speaker Left Playback"}, | 541 | { "IHFOUTL", NULL, "Speaker Left Playback"}, |
| 542 | { "IHFOUTR", "NULL", "Speaker Right Playback"}, | 542 | { "IHFOUTR", NULL, "Speaker Right Playback"}, |
| 543 | { "Speaker Left Playback", NULL, "Speaker Left Filter"}, | 543 | { "Speaker Left Playback", NULL, "Speaker Left Filter"}, |
| 544 | { "Speaker Right Playback", NULL, "Speaker Right Filter"}, | 544 | { "Speaker Right Playback", NULL, "Speaker Right Filter"}, |
| 545 | { "Speaker Left Filter", NULL, "IHFDAC Left"}, | 545 | { "Speaker Left Filter", NULL, "IHFDAC Left"}, |
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index 249ef5c4c762..32942bed34b1 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c | |||
| @@ -281,7 +281,7 @@ static int tas5086_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 281 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 281 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 282 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | 282 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); |
| 283 | 283 | ||
| 284 | ucontrol->value.enumerated.item[0] = priv->deemph; | 284 | ucontrol->value.integer.value[0] = priv->deemph; |
| 285 | 285 | ||
| 286 | return 0; | 286 | return 0; |
| 287 | } | 287 | } |
| @@ -292,7 +292,7 @@ static int tas5086_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 292 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 292 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 293 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | 293 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); |
| 294 | 294 | ||
| 295 | priv->deemph = ucontrol->value.enumerated.item[0]; | 295 | priv->deemph = ucontrol->value.integer.value[0]; |
| 296 | 296 | ||
| 297 | return tas5086_set_deemph(codec); | 297 | return tas5086_set_deemph(codec); |
| 298 | } | 298 | } |
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index 8d9de49a5052..21d5402e343f 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
| @@ -610,7 +610,7 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, | |||
| 610 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 610 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 611 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 611 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); |
| 612 | 612 | ||
| 613 | ucontrol->value.enumerated.item[0] = wm2000->anc_active; | 613 | ucontrol->value.integer.value[0] = wm2000->anc_active; |
| 614 | 614 | ||
| 615 | return 0; | 615 | return 0; |
| 616 | } | 616 | } |
| @@ -620,7 +620,7 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, | |||
| 620 | { | 620 | { |
| 621 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 621 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 622 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 622 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); |
| 623 | int anc_active = ucontrol->value.enumerated.item[0]; | 623 | int anc_active = ucontrol->value.integer.value[0]; |
| 624 | int ret; | 624 | int ret; |
| 625 | 625 | ||
| 626 | if (anc_active > 1) | 626 | if (anc_active > 1) |
| @@ -643,7 +643,7 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, | |||
| 643 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 643 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 644 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 644 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); |
| 645 | 645 | ||
| 646 | ucontrol->value.enumerated.item[0] = wm2000->spk_ena; | 646 | ucontrol->value.integer.value[0] = wm2000->spk_ena; |
| 647 | 647 | ||
| 648 | return 0; | 648 | return 0; |
| 649 | } | 649 | } |
| @@ -653,7 +653,7 @@ static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, | |||
| 653 | { | 653 | { |
| 654 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 654 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 655 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 655 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); |
| 656 | int val = ucontrol->value.enumerated.item[0]; | 656 | int val = ucontrol->value.integer.value[0]; |
| 657 | int ret; | 657 | int ret; |
| 658 | 658 | ||
| 659 | if (val > 1) | 659 | if (val > 1) |
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 098c143f44d6..c6d10533e2bd 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
| @@ -125,7 +125,7 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 125 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 125 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 126 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); | 126 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); |
| 127 | 127 | ||
| 128 | ucontrol->value.enumerated.item[0] = wm8731->deemph; | 128 | ucontrol->value.integer.value[0] = wm8731->deemph; |
| 129 | 129 | ||
| 130 | return 0; | 130 | return 0; |
| 131 | } | 131 | } |
| @@ -135,7 +135,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 135 | { | 135 | { |
| 136 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 136 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 137 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); | 137 | struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); |
| 138 | int deemph = ucontrol->value.enumerated.item[0]; | 138 | int deemph = ucontrol->value.integer.value[0]; |
| 139 | int ret = 0; | 139 | int ret = 0; |
| 140 | 140 | ||
| 141 | if (deemph > 1) | 141 | if (deemph > 1) |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index dde462c082be..04b04f8e147c 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
| @@ -442,7 +442,7 @@ static int wm8903_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 442 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 442 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 443 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | 443 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); |
| 444 | 444 | ||
| 445 | ucontrol->value.enumerated.item[0] = wm8903->deemph; | 445 | ucontrol->value.integer.value[0] = wm8903->deemph; |
| 446 | 446 | ||
| 447 | return 0; | 447 | return 0; |
| 448 | } | 448 | } |
| @@ -452,7 +452,7 @@ static int wm8903_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 452 | { | 452 | { |
| 453 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 453 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 454 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); | 454 | struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); |
| 455 | int deemph = ucontrol->value.enumerated.item[0]; | 455 | int deemph = ucontrol->value.integer.value[0]; |
| 456 | int ret = 0; | 456 | int ret = 0; |
| 457 | 457 | ||
| 458 | if (deemph > 1) | 458 | if (deemph > 1) |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index d3b3f57668cc..215e93c1ddf0 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
| @@ -525,7 +525,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 525 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 525 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 526 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 526 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
| 527 | 527 | ||
| 528 | ucontrol->value.enumerated.item[0] = wm8904->deemph; | 528 | ucontrol->value.integer.value[0] = wm8904->deemph; |
| 529 | return 0; | 529 | return 0; |
| 530 | } | 530 | } |
| 531 | 531 | ||
| @@ -534,7 +534,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 534 | { | 534 | { |
| 535 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 535 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 536 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 536 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
| 537 | int deemph = ucontrol->value.enumerated.item[0]; | 537 | int deemph = ucontrol->value.integer.value[0]; |
| 538 | 538 | ||
| 539 | if (deemph > 1) | 539 | if (deemph > 1) |
| 540 | return -EINVAL; | 540 | return -EINVAL; |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 1ab2d462afad..00bec915d652 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
| @@ -393,7 +393,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 393 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 393 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 394 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 394 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
| 395 | 395 | ||
| 396 | ucontrol->value.enumerated.item[0] = wm8955->deemph; | 396 | ucontrol->value.integer.value[0] = wm8955->deemph; |
| 397 | return 0; | 397 | return 0; |
| 398 | } | 398 | } |
| 399 | 399 | ||
| @@ -402,7 +402,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 402 | { | 402 | { |
| 403 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 403 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 404 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 404 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
| 405 | int deemph = ucontrol->value.enumerated.item[0]; | 405 | int deemph = ucontrol->value.integer.value[0]; |
| 406 | 406 | ||
| 407 | if (deemph > 1) | 407 | if (deemph > 1) |
| 408 | return -EINVAL; | 408 | return -EINVAL; |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index cf8fecf97f2c..3035d9856415 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
| @@ -184,7 +184,7 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol, | |||
| 184 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 184 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 185 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); | 185 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); |
| 186 | 186 | ||
| 187 | ucontrol->value.enumerated.item[0] = wm8960->deemph; | 187 | ucontrol->value.integer.value[0] = wm8960->deemph; |
| 188 | return 0; | 188 | return 0; |
| 189 | } | 189 | } |
| 190 | 190 | ||
| @@ -193,7 +193,7 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, | |||
| 193 | { | 193 | { |
| 194 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 194 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
| 195 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); | 195 | struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); |
| 196 | int deemph = ucontrol->value.enumerated.item[0]; | 196 | int deemph = ucontrol->value.integer.value[0]; |
| 197 | 197 | ||
| 198 | if (deemph > 1) | 198 | if (deemph > 1) |
| 199 | return -EINVAL; | 199 | return -EINVAL; |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 9517571e820d..98c9525bd751 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
| @@ -180,7 +180,7 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol, | |||
| 180 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 180 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); |
| 181 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); | 181 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); |
| 182 | struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); | 182 | struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); |
| 183 | unsigned int val = ucontrol->value.enumerated.item[0]; | 183 | unsigned int val = ucontrol->value.integer.value[0]; |
| 184 | struct soc_mixer_control *mc = | 184 | struct soc_mixer_control *mc = |
| 185 | (struct soc_mixer_control *)kcontrol->private_value; | 185 | (struct soc_mixer_control *)kcontrol->private_value; |
| 186 | unsigned int mixer, mask, shift, old; | 186 | unsigned int mixer, mask, shift, old; |
| @@ -193,7 +193,7 @@ static int wm9712_hp_mixer_put(struct snd_kcontrol *kcontrol, | |||
| 193 | 193 | ||
| 194 | mutex_lock(&wm9712->lock); | 194 | mutex_lock(&wm9712->lock); |
| 195 | old = wm9712->hp_mixer[mixer]; | 195 | old = wm9712->hp_mixer[mixer]; |
| 196 | if (ucontrol->value.enumerated.item[0]) | 196 | if (ucontrol->value.integer.value[0]) |
| 197 | wm9712->hp_mixer[mixer] |= mask; | 197 | wm9712->hp_mixer[mixer] |= mask; |
| 198 | else | 198 | else |
| 199 | wm9712->hp_mixer[mixer] &= ~mask; | 199 | wm9712->hp_mixer[mixer] &= ~mask; |
| @@ -231,7 +231,7 @@ static int wm9712_hp_mixer_get(struct snd_kcontrol *kcontrol, | |||
| 231 | mixer = mc->shift >> 8; | 231 | mixer = mc->shift >> 8; |
| 232 | shift = mc->shift & 0xff; | 232 | shift = mc->shift & 0xff; |
| 233 | 233 | ||
| 234 | ucontrol->value.enumerated.item[0] = | 234 | ucontrol->value.integer.value[0] = |
| 235 | (wm9712->hp_mixer[mixer] >> shift) & 1; | 235 | (wm9712->hp_mixer[mixer] >> shift) & 1; |
| 236 | 236 | ||
| 237 | return 0; | 237 | return 0; |
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 68222917b396..79552953e1bd 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
| @@ -255,7 +255,7 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol, | |||
| 255 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 255 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); |
| 256 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); | 256 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); |
| 257 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); | 257 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); |
| 258 | unsigned int val = ucontrol->value.enumerated.item[0]; | 258 | unsigned int val = ucontrol->value.integer.value[0]; |
| 259 | struct soc_mixer_control *mc = | 259 | struct soc_mixer_control *mc = |
| 260 | (struct soc_mixer_control *)kcontrol->private_value; | 260 | (struct soc_mixer_control *)kcontrol->private_value; |
| 261 | unsigned int mixer, mask, shift, old; | 261 | unsigned int mixer, mask, shift, old; |
| @@ -268,7 +268,7 @@ static int wm9713_hp_mixer_put(struct snd_kcontrol *kcontrol, | |||
| 268 | 268 | ||
| 269 | mutex_lock(&wm9713->lock); | 269 | mutex_lock(&wm9713->lock); |
| 270 | old = wm9713->hp_mixer[mixer]; | 270 | old = wm9713->hp_mixer[mixer]; |
| 271 | if (ucontrol->value.enumerated.item[0]) | 271 | if (ucontrol->value.integer.value[0]) |
| 272 | wm9713->hp_mixer[mixer] |= mask; | 272 | wm9713->hp_mixer[mixer] |= mask; |
| 273 | else | 273 | else |
| 274 | wm9713->hp_mixer[mixer] &= ~mask; | 274 | wm9713->hp_mixer[mixer] &= ~mask; |
| @@ -306,7 +306,7 @@ static int wm9713_hp_mixer_get(struct snd_kcontrol *kcontrol, | |||
| 306 | mixer = mc->shift >> 8; | 306 | mixer = mc->shift >> 8; |
| 307 | shift = mc->shift & 0xff; | 307 | shift = mc->shift & 0xff; |
| 308 | 308 | ||
| 309 | ucontrol->value.enumerated.item[0] = | 309 | ucontrol->value.integer.value[0] = |
| 310 | (wm9713->hp_mixer[mixer] >> shift) & 1; | 310 | (wm9713->hp_mixer[mixer] >> shift) & 1; |
| 311 | 311 | ||
| 312 | return 0; | 312 | return 0; |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index b9fabbf69db6..6b0c8f717ec2 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
| @@ -603,7 +603,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, | |||
| 603 | factor = (div2 + 1) * (7 * psr + 1) * 2; | 603 | factor = (div2 + 1) * (7 * psr + 1) * 2; |
| 604 | 604 | ||
| 605 | for (i = 0; i < 255; i++) { | 605 | for (i = 0; i < 255; i++) { |
| 606 | tmprate = freq * factor * (i + 2); | 606 | tmprate = freq * factor * (i + 1); |
| 607 | 607 | ||
| 608 | if (baudclk_is_used) | 608 | if (baudclk_is_used) |
| 609 | clkrate = clk_get_rate(ssi_private->baudclk); | 609 | clkrate = clk_get_rate(ssi_private->baudclk); |
| @@ -1227,7 +1227,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, | |||
| 1227 | ssi_private->dma_params_tx.addr = ssi_private->ssi_phys + CCSR_SSI_STX0; | 1227 | ssi_private->dma_params_tx.addr = ssi_private->ssi_phys + CCSR_SSI_STX0; |
| 1228 | ssi_private->dma_params_rx.addr = ssi_private->ssi_phys + CCSR_SSI_SRX0; | 1228 | ssi_private->dma_params_rx.addr = ssi_private->ssi_phys + CCSR_SSI_SRX0; |
| 1229 | 1229 | ||
| 1230 | ret = !of_property_read_u32_array(np, "dmas", dmas, 4); | 1230 | ret = of_property_read_u32_array(np, "dmas", dmas, 4); |
| 1231 | if (ssi_private->use_dma && !ret && dmas[2] == IMX_DMATYPE_SSI_DUAL) { | 1231 | if (ssi_private->use_dma && !ret && dmas[2] == IMX_DMATYPE_SSI_DUAL) { |
| 1232 | ssi_private->use_dual_fifo = true; | 1232 | ssi_private->use_dual_fifo = true; |
| 1233 | /* When using dual fifo mode, we need to keep watermark | 1233 | /* When using dual fifo mode, we need to keep watermark |
diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c index c42ffae5fe9f..402b728c0a06 100644 --- a/sound/soc/intel/sst-haswell-dsp.c +++ b/sound/soc/intel/sst-haswell-dsp.c | |||
| @@ -207,9 +207,6 @@ static int hsw_parse_fw_image(struct sst_fw *sst_fw) | |||
| 207 | module = (void *)module + sizeof(*module) + module->mod_size; | 207 | module = (void *)module + sizeof(*module) + module->mod_size; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | /* allocate scratch mem regions */ | ||
| 211 | sst_block_alloc_scratch(dsp); | ||
| 212 | |||
| 213 | return 0; | 210 | return 0; |
| 214 | } | 211 | } |
| 215 | 212 | ||
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index 394af5684c05..863a9ca34b8e 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c | |||
| @@ -1732,6 +1732,7 @@ static void sst_hsw_drop_all(struct sst_hsw *hsw) | |||
| 1732 | int sst_hsw_dsp_load(struct sst_hsw *hsw) | 1732 | int sst_hsw_dsp_load(struct sst_hsw *hsw) |
| 1733 | { | 1733 | { |
| 1734 | struct sst_dsp *dsp = hsw->dsp; | 1734 | struct sst_dsp *dsp = hsw->dsp; |
| 1735 | struct sst_fw *sst_fw, *t; | ||
| 1735 | int ret; | 1736 | int ret; |
| 1736 | 1737 | ||
| 1737 | dev_dbg(hsw->dev, "loading audio DSP...."); | 1738 | dev_dbg(hsw->dev, "loading audio DSP...."); |
| @@ -1748,12 +1749,17 @@ int sst_hsw_dsp_load(struct sst_hsw *hsw) | |||
| 1748 | return ret; | 1749 | return ret; |
| 1749 | } | 1750 | } |
| 1750 | 1751 | ||
| 1751 | ret = sst_fw_reload(hsw->sst_fw); | 1752 | list_for_each_entry_safe_reverse(sst_fw, t, &dsp->fw_list, list) { |
| 1752 | if (ret < 0) { | 1753 | ret = sst_fw_reload(sst_fw); |
| 1753 | dev_err(hsw->dev, "error: SST FW reload failed\n"); | 1754 | if (ret < 0) { |
| 1754 | sst_dsp_dma_put_channel(dsp); | 1755 | dev_err(hsw->dev, "error: SST FW reload failed\n"); |
| 1755 | return -ENOMEM; | 1756 | sst_dsp_dma_put_channel(dsp); |
| 1757 | return -ENOMEM; | ||
| 1758 | } | ||
| 1756 | } | 1759 | } |
| 1760 | ret = sst_block_alloc_scratch(hsw->dsp); | ||
| 1761 | if (ret < 0) | ||
| 1762 | return -EINVAL; | ||
| 1757 | 1763 | ||
| 1758 | sst_dsp_dma_put_channel(dsp); | 1764 | sst_dsp_dma_put_channel(dsp); |
| 1759 | return 0; | 1765 | return 0; |
| @@ -1809,12 +1815,17 @@ int sst_hsw_dsp_runtime_suspend(struct sst_hsw *hsw) | |||
| 1809 | 1815 | ||
| 1810 | int sst_hsw_dsp_runtime_sleep(struct sst_hsw *hsw) | 1816 | int sst_hsw_dsp_runtime_sleep(struct sst_hsw *hsw) |
| 1811 | { | 1817 | { |
| 1812 | sst_fw_unload(hsw->sst_fw); | 1818 | struct sst_fw *sst_fw, *t; |
| 1813 | sst_block_free_scratch(hsw->dsp); | 1819 | struct sst_dsp *dsp = hsw->dsp; |
| 1820 | |||
| 1821 | list_for_each_entry_safe(sst_fw, t, &dsp->fw_list, list) { | ||
| 1822 | sst_fw_unload(sst_fw); | ||
| 1823 | } | ||
| 1824 | sst_block_free_scratch(dsp); | ||
| 1814 | 1825 | ||
| 1815 | hsw->boot_complete = false; | 1826 | hsw->boot_complete = false; |
| 1816 | 1827 | ||
| 1817 | sst_dsp_sleep(hsw->dsp); | 1828 | sst_dsp_sleep(dsp); |
| 1818 | 1829 | ||
| 1819 | return 0; | 1830 | return 0; |
| 1820 | } | 1831 | } |
| @@ -1943,6 +1954,11 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata) | |||
| 1943 | goto fw_err; | 1954 | goto fw_err; |
| 1944 | } | 1955 | } |
| 1945 | 1956 | ||
| 1957 | /* allocate scratch mem regions */ | ||
| 1958 | ret = sst_block_alloc_scratch(hsw->dsp); | ||
| 1959 | if (ret < 0) | ||
| 1960 | goto boot_err; | ||
| 1961 | |||
| 1946 | /* wait for DSP boot completion */ | 1962 | /* wait for DSP boot completion */ |
| 1947 | sst_dsp_boot(hsw->dsp); | 1963 | sst_dsp_boot(hsw->dsp); |
| 1948 | ret = wait_event_timeout(hsw->boot_wait, hsw->boot_complete, | 1964 | ret = wait_event_timeout(hsw->boot_wait, hsw->boot_complete, |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 30579ca5bacb..e5c990889dcc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -347,6 +347,8 @@ static ssize_t codec_list_read_file(struct file *file, char __user *user_buf, | |||
| 347 | if (!buf) | 347 | if (!buf) |
| 348 | return -ENOMEM; | 348 | return -ENOMEM; |
| 349 | 349 | ||
| 350 | mutex_lock(&client_mutex); | ||
| 351 | |||
| 350 | list_for_each_entry(codec, &codec_list, list) { | 352 | list_for_each_entry(codec, &codec_list, list) { |
| 351 | len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", | 353 | len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", |
| 352 | codec->component.name); | 354 | codec->component.name); |
| @@ -358,6 +360,8 @@ static ssize_t codec_list_read_file(struct file *file, char __user *user_buf, | |||
| 358 | } | 360 | } |
| 359 | } | 361 | } |
| 360 | 362 | ||
| 363 | mutex_unlock(&client_mutex); | ||
| 364 | |||
| 361 | if (ret >= 0) | 365 | if (ret >= 0) |
| 362 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); | 366 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); |
| 363 | 367 | ||
| @@ -382,6 +386,8 @@ static ssize_t dai_list_read_file(struct file *file, char __user *user_buf, | |||
| 382 | if (!buf) | 386 | if (!buf) |
| 383 | return -ENOMEM; | 387 | return -ENOMEM; |
| 384 | 388 | ||
| 389 | mutex_lock(&client_mutex); | ||
| 390 | |||
| 385 | list_for_each_entry(component, &component_list, list) { | 391 | list_for_each_entry(component, &component_list, list) { |
| 386 | list_for_each_entry(dai, &component->dai_list, list) { | 392 | list_for_each_entry(dai, &component->dai_list, list) { |
| 387 | len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", | 393 | len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", |
| @@ -395,6 +401,8 @@ static ssize_t dai_list_read_file(struct file *file, char __user *user_buf, | |||
| 395 | } | 401 | } |
| 396 | } | 402 | } |
| 397 | 403 | ||
| 404 | mutex_unlock(&client_mutex); | ||
| 405 | |||
| 398 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); | 406 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); |
| 399 | 407 | ||
| 400 | kfree(buf); | 408 | kfree(buf); |
| @@ -418,6 +426,8 @@ static ssize_t platform_list_read_file(struct file *file, | |||
| 418 | if (!buf) | 426 | if (!buf) |
| 419 | return -ENOMEM; | 427 | return -ENOMEM; |
| 420 | 428 | ||
| 429 | mutex_lock(&client_mutex); | ||
| 430 | |||
| 421 | list_for_each_entry(platform, &platform_list, list) { | 431 | list_for_each_entry(platform, &platform_list, list) { |
| 422 | len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", | 432 | len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", |
| 423 | platform->component.name); | 433 | platform->component.name); |
| @@ -429,6 +439,8 @@ static ssize_t platform_list_read_file(struct file *file, | |||
| 429 | } | 439 | } |
| 430 | } | 440 | } |
| 431 | 441 | ||
| 442 | mutex_unlock(&client_mutex); | ||
| 443 | |||
| 432 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); | 444 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); |
| 433 | 445 | ||
| 434 | kfree(buf); | 446 | kfree(buf); |
| @@ -836,6 +848,8 @@ static struct snd_soc_component *soc_find_component( | |||
| 836 | { | 848 | { |
| 837 | struct snd_soc_component *component; | 849 | struct snd_soc_component *component; |
| 838 | 850 | ||
| 851 | lockdep_assert_held(&client_mutex); | ||
| 852 | |||
| 839 | list_for_each_entry(component, &component_list, list) { | 853 | list_for_each_entry(component, &component_list, list) { |
| 840 | if (of_node) { | 854 | if (of_node) { |
| 841 | if (component->dev->of_node == of_node) | 855 | if (component->dev->of_node == of_node) |
| @@ -854,6 +868,8 @@ static struct snd_soc_dai *snd_soc_find_dai( | |||
| 854 | struct snd_soc_component *component; | 868 | struct snd_soc_component *component; |
| 855 | struct snd_soc_dai *dai; | 869 | struct snd_soc_dai *dai; |
| 856 | 870 | ||
| 871 | lockdep_assert_held(&client_mutex); | ||
| 872 | |||
| 857 | /* Find CPU DAI from registered DAIs*/ | 873 | /* Find CPU DAI from registered DAIs*/ |
| 858 | list_for_each_entry(component, &component_list, list) { | 874 | list_for_each_entry(component, &component_list, list) { |
| 859 | if (dlc->of_node && component->dev->of_node != dlc->of_node) | 875 | if (dlc->of_node && component->dev->of_node != dlc->of_node) |
| @@ -1508,6 +1524,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) | |||
| 1508 | struct snd_soc_codec *codec; | 1524 | struct snd_soc_codec *codec; |
| 1509 | int ret, i, order; | 1525 | int ret, i, order; |
| 1510 | 1526 | ||
| 1527 | mutex_lock(&client_mutex); | ||
| 1511 | mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT); | 1528 | mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT); |
| 1512 | 1529 | ||
| 1513 | /* bind DAIs */ | 1530 | /* bind DAIs */ |
| @@ -1662,6 +1679,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) | |||
| 1662 | card->instantiated = 1; | 1679 | card->instantiated = 1; |
| 1663 | snd_soc_dapm_sync(&card->dapm); | 1680 | snd_soc_dapm_sync(&card->dapm); |
| 1664 | mutex_unlock(&card->mutex); | 1681 | mutex_unlock(&card->mutex); |
| 1682 | mutex_unlock(&client_mutex); | ||
| 1665 | 1683 | ||
| 1666 | return 0; | 1684 | return 0; |
| 1667 | 1685 | ||
| @@ -1680,6 +1698,7 @@ card_probe_error: | |||
| 1680 | 1698 | ||
| 1681 | base_error: | 1699 | base_error: |
| 1682 | mutex_unlock(&card->mutex); | 1700 | mutex_unlock(&card->mutex); |
| 1701 | mutex_unlock(&client_mutex); | ||
| 1683 | 1702 | ||
| 1684 | return ret; | 1703 | return ret; |
| 1685 | } | 1704 | } |
| @@ -2713,13 +2732,6 @@ static void snd_soc_component_del_unlocked(struct snd_soc_component *component) | |||
| 2713 | list_del(&component->list); | 2732 | list_del(&component->list); |
| 2714 | } | 2733 | } |
| 2715 | 2734 | ||
| 2716 | static void snd_soc_component_del(struct snd_soc_component *component) | ||
| 2717 | { | ||
| 2718 | mutex_lock(&client_mutex); | ||
| 2719 | snd_soc_component_del_unlocked(component); | ||
| 2720 | mutex_unlock(&client_mutex); | ||
| 2721 | } | ||
| 2722 | |||
| 2723 | int snd_soc_register_component(struct device *dev, | 2735 | int snd_soc_register_component(struct device *dev, |
| 2724 | const struct snd_soc_component_driver *cmpnt_drv, | 2736 | const struct snd_soc_component_driver *cmpnt_drv, |
| 2725 | struct snd_soc_dai_driver *dai_drv, | 2737 | struct snd_soc_dai_driver *dai_drv, |
| @@ -2767,14 +2779,17 @@ void snd_soc_unregister_component(struct device *dev) | |||
| 2767 | { | 2779 | { |
| 2768 | struct snd_soc_component *cmpnt; | 2780 | struct snd_soc_component *cmpnt; |
| 2769 | 2781 | ||
| 2782 | mutex_lock(&client_mutex); | ||
| 2770 | list_for_each_entry(cmpnt, &component_list, list) { | 2783 | list_for_each_entry(cmpnt, &component_list, list) { |
| 2771 | if (dev == cmpnt->dev && cmpnt->registered_as_component) | 2784 | if (dev == cmpnt->dev && cmpnt->registered_as_component) |
| 2772 | goto found; | 2785 | goto found; |
| 2773 | } | 2786 | } |
| 2787 | mutex_unlock(&client_mutex); | ||
| 2774 | return; | 2788 | return; |
| 2775 | 2789 | ||
| 2776 | found: | 2790 | found: |
| 2777 | snd_soc_component_del(cmpnt); | 2791 | snd_soc_component_del_unlocked(cmpnt); |
| 2792 | mutex_unlock(&client_mutex); | ||
| 2778 | snd_soc_component_cleanup(cmpnt); | 2793 | snd_soc_component_cleanup(cmpnt); |
| 2779 | kfree(cmpnt); | 2794 | kfree(cmpnt); |
| 2780 | } | 2795 | } |
| @@ -2882,10 +2897,14 @@ struct snd_soc_platform *snd_soc_lookup_platform(struct device *dev) | |||
| 2882 | { | 2897 | { |
| 2883 | struct snd_soc_platform *platform; | 2898 | struct snd_soc_platform *platform; |
| 2884 | 2899 | ||
| 2900 | mutex_lock(&client_mutex); | ||
| 2885 | list_for_each_entry(platform, &platform_list, list) { | 2901 | list_for_each_entry(platform, &platform_list, list) { |
| 2886 | if (dev == platform->dev) | 2902 | if (dev == platform->dev) { |
| 2903 | mutex_unlock(&client_mutex); | ||
| 2887 | return platform; | 2904 | return platform; |
| 2905 | } | ||
| 2888 | } | 2906 | } |
| 2907 | mutex_unlock(&client_mutex); | ||
| 2889 | 2908 | ||
| 2890 | return NULL; | 2909 | return NULL; |
| 2891 | } | 2910 | } |
| @@ -3090,15 +3109,15 @@ void snd_soc_unregister_codec(struct device *dev) | |||
| 3090 | { | 3109 | { |
| 3091 | struct snd_soc_codec *codec; | 3110 | struct snd_soc_codec *codec; |
| 3092 | 3111 | ||
| 3112 | mutex_lock(&client_mutex); | ||
| 3093 | list_for_each_entry(codec, &codec_list, list) { | 3113 | list_for_each_entry(codec, &codec_list, list) { |
| 3094 | if (dev == codec->dev) | 3114 | if (dev == codec->dev) |
| 3095 | goto found; | 3115 | goto found; |
| 3096 | } | 3116 | } |
| 3117 | mutex_unlock(&client_mutex); | ||
| 3097 | return; | 3118 | return; |
| 3098 | 3119 | ||
| 3099 | found: | 3120 | found: |
| 3100 | |||
| 3101 | mutex_lock(&client_mutex); | ||
| 3102 | list_del(&codec->list); | 3121 | list_del(&codec->list); |
| 3103 | snd_soc_component_del_unlocked(&codec->component); | 3122 | snd_soc_component_del_unlocked(&codec->component); |
| 3104 | mutex_unlock(&client_mutex); | 3123 | mutex_unlock(&client_mutex); |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 61bf9128e1f2..9d9db3b296dd 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
| @@ -30,6 +30,8 @@ static int disasm_line__parse(char *line, char **namep, char **rawp); | |||
| 30 | 30 | ||
| 31 | static void ins__delete(struct ins_operands *ops) | 31 | static void ins__delete(struct ins_operands *ops) |
| 32 | { | 32 | { |
| 33 | if (ops == NULL) | ||
| 34 | return; | ||
| 33 | zfree(&ops->source.raw); | 35 | zfree(&ops->source.raw); |
| 34 | zfree(&ops->source.name); | 36 | zfree(&ops->source.name); |
| 35 | zfree(&ops->target.raw); | 37 | zfree(&ops->target.raw); |
diff --git a/virt/kvm/arm/vgic-v2.c b/virt/kvm/arm/vgic-v2.c index a0a7b5d1a070..f9b9c7c51372 100644 --- a/virt/kvm/arm/vgic-v2.c +++ b/virt/kvm/arm/vgic-v2.c | |||
| @@ -72,6 +72,8 @@ static void vgic_v2_sync_lr_elrsr(struct kvm_vcpu *vcpu, int lr, | |||
| 72 | { | 72 | { |
| 73 | if (!(lr_desc.state & LR_STATE_MASK)) | 73 | if (!(lr_desc.state & LR_STATE_MASK)) |
| 74 | vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr |= (1ULL << lr); | 74 | vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr |= (1ULL << lr); |
| 75 | else | ||
| 76 | vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr &= ~(1ULL << lr); | ||
| 75 | } | 77 | } |
| 76 | 78 | ||
| 77 | static u64 vgic_v2_get_elrsr(const struct kvm_vcpu *vcpu) | 79 | static u64 vgic_v2_get_elrsr(const struct kvm_vcpu *vcpu) |
| @@ -84,6 +86,11 @@ static u64 vgic_v2_get_eisr(const struct kvm_vcpu *vcpu) | |||
| 84 | return vcpu->arch.vgic_cpu.vgic_v2.vgic_eisr; | 86 | return vcpu->arch.vgic_cpu.vgic_v2.vgic_eisr; |
| 85 | } | 87 | } |
| 86 | 88 | ||
| 89 | static void vgic_v2_clear_eisr(struct kvm_vcpu *vcpu) | ||
| 90 | { | ||
| 91 | vcpu->arch.vgic_cpu.vgic_v2.vgic_eisr = 0; | ||
| 92 | } | ||
| 93 | |||
| 87 | static u32 vgic_v2_get_interrupt_status(const struct kvm_vcpu *vcpu) | 94 | static u32 vgic_v2_get_interrupt_status(const struct kvm_vcpu *vcpu) |
| 88 | { | 95 | { |
| 89 | u32 misr = vcpu->arch.vgic_cpu.vgic_v2.vgic_misr; | 96 | u32 misr = vcpu->arch.vgic_cpu.vgic_v2.vgic_misr; |
| @@ -148,6 +155,7 @@ static const struct vgic_ops vgic_v2_ops = { | |||
| 148 | .sync_lr_elrsr = vgic_v2_sync_lr_elrsr, | 155 | .sync_lr_elrsr = vgic_v2_sync_lr_elrsr, |
| 149 | .get_elrsr = vgic_v2_get_elrsr, | 156 | .get_elrsr = vgic_v2_get_elrsr, |
| 150 | .get_eisr = vgic_v2_get_eisr, | 157 | .get_eisr = vgic_v2_get_eisr, |
| 158 | .clear_eisr = vgic_v2_clear_eisr, | ||
| 151 | .get_interrupt_status = vgic_v2_get_interrupt_status, | 159 | .get_interrupt_status = vgic_v2_get_interrupt_status, |
| 152 | .enable_underflow = vgic_v2_enable_underflow, | 160 | .enable_underflow = vgic_v2_enable_underflow, |
| 153 | .disable_underflow = vgic_v2_disable_underflow, | 161 | .disable_underflow = vgic_v2_disable_underflow, |
diff --git a/virt/kvm/arm/vgic-v3.c b/virt/kvm/arm/vgic-v3.c index 3a62d8a9a2c6..dff06021e748 100644 --- a/virt/kvm/arm/vgic-v3.c +++ b/virt/kvm/arm/vgic-v3.c | |||
| @@ -104,6 +104,8 @@ static void vgic_v3_sync_lr_elrsr(struct kvm_vcpu *vcpu, int lr, | |||
| 104 | { | 104 | { |
| 105 | if (!(lr_desc.state & LR_STATE_MASK)) | 105 | if (!(lr_desc.state & LR_STATE_MASK)) |
| 106 | vcpu->arch.vgic_cpu.vgic_v3.vgic_elrsr |= (1U << lr); | 106 | vcpu->arch.vgic_cpu.vgic_v3.vgic_elrsr |= (1U << lr); |
| 107 | else | ||
| 108 | vcpu->arch.vgic_cpu.vgic_v3.vgic_elrsr &= ~(1U << lr); | ||
| 107 | } | 109 | } |
| 108 | 110 | ||
| 109 | static u64 vgic_v3_get_elrsr(const struct kvm_vcpu *vcpu) | 111 | static u64 vgic_v3_get_elrsr(const struct kvm_vcpu *vcpu) |
| @@ -116,6 +118,11 @@ static u64 vgic_v3_get_eisr(const struct kvm_vcpu *vcpu) | |||
| 116 | return vcpu->arch.vgic_cpu.vgic_v3.vgic_eisr; | 118 | return vcpu->arch.vgic_cpu.vgic_v3.vgic_eisr; |
| 117 | } | 119 | } |
| 118 | 120 | ||
| 121 | static void vgic_v3_clear_eisr(struct kvm_vcpu *vcpu) | ||
| 122 | { | ||
| 123 | vcpu->arch.vgic_cpu.vgic_v3.vgic_eisr = 0; | ||
| 124 | } | ||
| 125 | |||
| 119 | static u32 vgic_v3_get_interrupt_status(const struct kvm_vcpu *vcpu) | 126 | static u32 vgic_v3_get_interrupt_status(const struct kvm_vcpu *vcpu) |
| 120 | { | 127 | { |
| 121 | u32 misr = vcpu->arch.vgic_cpu.vgic_v3.vgic_misr; | 128 | u32 misr = vcpu->arch.vgic_cpu.vgic_v3.vgic_misr; |
| @@ -192,6 +199,7 @@ static const struct vgic_ops vgic_v3_ops = { | |||
| 192 | .sync_lr_elrsr = vgic_v3_sync_lr_elrsr, | 199 | .sync_lr_elrsr = vgic_v3_sync_lr_elrsr, |
| 193 | .get_elrsr = vgic_v3_get_elrsr, | 200 | .get_elrsr = vgic_v3_get_elrsr, |
| 194 | .get_eisr = vgic_v3_get_eisr, | 201 | .get_eisr = vgic_v3_get_eisr, |
| 202 | .clear_eisr = vgic_v3_clear_eisr, | ||
| 195 | .get_interrupt_status = vgic_v3_get_interrupt_status, | 203 | .get_interrupt_status = vgic_v3_get_interrupt_status, |
| 196 | .enable_underflow = vgic_v3_enable_underflow, | 204 | .enable_underflow = vgic_v3_enable_underflow, |
| 197 | .disable_underflow = vgic_v3_disable_underflow, | 205 | .disable_underflow = vgic_v3_disable_underflow, |
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 0cc6ab6005a0..c9f60f524588 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
| @@ -883,6 +883,11 @@ static inline u64 vgic_get_eisr(struct kvm_vcpu *vcpu) | |||
| 883 | return vgic_ops->get_eisr(vcpu); | 883 | return vgic_ops->get_eisr(vcpu); |
| 884 | } | 884 | } |
| 885 | 885 | ||
| 886 | static inline void vgic_clear_eisr(struct kvm_vcpu *vcpu) | ||
| 887 | { | ||
| 888 | vgic_ops->clear_eisr(vcpu); | ||
| 889 | } | ||
| 890 | |||
| 886 | static inline u32 vgic_get_interrupt_status(struct kvm_vcpu *vcpu) | 891 | static inline u32 vgic_get_interrupt_status(struct kvm_vcpu *vcpu) |
| 887 | { | 892 | { |
| 888 | return vgic_ops->get_interrupt_status(vcpu); | 893 | return vgic_ops->get_interrupt_status(vcpu); |
| @@ -922,6 +927,7 @@ static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu) | |||
| 922 | vgic_set_lr(vcpu, lr_nr, vlr); | 927 | vgic_set_lr(vcpu, lr_nr, vlr); |
| 923 | clear_bit(lr_nr, vgic_cpu->lr_used); | 928 | clear_bit(lr_nr, vgic_cpu->lr_used); |
| 924 | vgic_cpu->vgic_irq_lr_map[irq] = LR_EMPTY; | 929 | vgic_cpu->vgic_irq_lr_map[irq] = LR_EMPTY; |
| 930 | vgic_sync_lr_elrsr(vcpu, lr_nr, vlr); | ||
| 925 | } | 931 | } |
| 926 | 932 | ||
| 927 | /* | 933 | /* |
| @@ -978,6 +984,7 @@ bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq) | |||
| 978 | BUG_ON(!test_bit(lr, vgic_cpu->lr_used)); | 984 | BUG_ON(!test_bit(lr, vgic_cpu->lr_used)); |
| 979 | vlr.state |= LR_STATE_PENDING; | 985 | vlr.state |= LR_STATE_PENDING; |
| 980 | vgic_set_lr(vcpu, lr, vlr); | 986 | vgic_set_lr(vcpu, lr, vlr); |
| 987 | vgic_sync_lr_elrsr(vcpu, lr, vlr); | ||
| 981 | return true; | 988 | return true; |
| 982 | } | 989 | } |
| 983 | } | 990 | } |
| @@ -999,6 +1006,7 @@ bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq) | |||
| 999 | vlr.state |= LR_EOI_INT; | 1006 | vlr.state |= LR_EOI_INT; |
| 1000 | 1007 | ||
| 1001 | vgic_set_lr(vcpu, lr, vlr); | 1008 | vgic_set_lr(vcpu, lr, vlr); |
| 1009 | vgic_sync_lr_elrsr(vcpu, lr, vlr); | ||
| 1002 | 1010 | ||
| 1003 | return true; | 1011 | return true; |
| 1004 | } | 1012 | } |
| @@ -1136,6 +1144,14 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) | |||
| 1136 | if (status & INT_STATUS_UNDERFLOW) | 1144 | if (status & INT_STATUS_UNDERFLOW) |
| 1137 | vgic_disable_underflow(vcpu); | 1145 | vgic_disable_underflow(vcpu); |
| 1138 | 1146 | ||
| 1147 | /* | ||
| 1148 | * In the next iterations of the vcpu loop, if we sync the vgic state | ||
| 1149 | * after flushing it, but before entering the guest (this happens for | ||
| 1150 | * pending signals and vmid rollovers), then make sure we don't pick | ||
| 1151 | * up any old maintenance interrupts here. | ||
| 1152 | */ | ||
| 1153 | vgic_clear_eisr(vcpu); | ||
| 1154 | |||
| 1139 | return level_pending; | 1155 | return level_pending; |
| 1140 | } | 1156 | } |
| 1141 | 1157 | ||
| @@ -1583,8 +1599,10 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) | |||
| 1583 | * emulation. So check this here again. KVM_CREATE_DEVICE does | 1599 | * emulation. So check this here again. KVM_CREATE_DEVICE does |
| 1584 | * the proper checks already. | 1600 | * the proper checks already. |
| 1585 | */ | 1601 | */ |
| 1586 | if (type == KVM_DEV_TYPE_ARM_VGIC_V2 && !vgic->can_emulate_gicv2) | 1602 | if (type == KVM_DEV_TYPE_ARM_VGIC_V2 && !vgic->can_emulate_gicv2) { |
| 1587 | return -ENODEV; | 1603 | ret = -ENODEV; |
| 1604 | goto out; | ||
| 1605 | } | ||
| 1588 | 1606 | ||
| 1589 | /* | 1607 | /* |
| 1590 | * Any time a vcpu is run, vcpu_load is called which tries to grab the | 1608 | * Any time a vcpu is run, vcpu_load is called which tries to grab the |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a1093700f3a4..a2214d9609bd 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
| @@ -2492,6 +2492,7 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) | |||
| 2492 | case KVM_CAP_SIGNAL_MSI: | 2492 | case KVM_CAP_SIGNAL_MSI: |
| 2493 | #endif | 2493 | #endif |
| 2494 | #ifdef CONFIG_HAVE_KVM_IRQFD | 2494 | #ifdef CONFIG_HAVE_KVM_IRQFD |
| 2495 | case KVM_CAP_IRQFD: | ||
| 2495 | case KVM_CAP_IRQFD_RESAMPLE: | 2496 | case KVM_CAP_IRQFD_RESAMPLE: |
| 2496 | #endif | 2497 | #endif |
| 2497 | case KVM_CAP_CHECK_EXTENSION_VM: | 2498 | case KVM_CAP_CHECK_EXTENSION_VM: |
